Commit Graph

5838 Commits

Author SHA1 Message Date
Mandava, Mounika b1037d4ebe lavc/qsvenc: add support for oneVPL string API
A new option -qsv_params <str> is added, where <str> is a :-separated
list of key=value parameters.

Example:
$ ffmpeg -y -f lavfi -i testsrc -vf "format=nv12" -c:v h264_qsv -qsv_params
"TargetUsage=1:GopPicSize=30:GopRefDist=2:TargetKbps=5000" -f null -

Signed-off-by: Mounika Mandava <mounika.mandava@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-05-07 11:06:37 +08:00
Rémi Denis-Courmont 95d1052fba lavu/riscv: add hwprobe() for CPU detection
This adds the Linux-specific function call to detect CPU features. Unlike
the more portable auxillary vector, this supports extensions other than
single lettered ones. At this point, FFmpeg already needs this to detect
Zba and Zbb at run-time, and probably will need it for Zvbb in the near
future.

Support will be available in glibc 2.40 onward.
2024-05-06 22:09:41 +03:00
Niklas Haas 71669f2ad5 avcodec/libx264: bump minimum required version to 155
This version is seven years old, and present in Debian oldoldstable,
Ubuntu 20.04 and Leap 15.0.

Allows cleaning up the file substantially. In particular, this is
motivated by the desire to stop relying on init_static_data.
2024-05-02 12:12:49 +02:00
Timo Rothenpieler 476688095f configure: handle xargs versions that exec empty commands
Some versions of xargs don't run any commands if no input is given,
others do run it at least once, causing errors.
Pass -r to xargs to avoid that behaviour and never run empty commands.
2024-05-01 19:40:00 +02:00
Timo Rothenpieler 95edaf72b4 configure: support msvc build inside WSL 2024-05-01 19:00:36 +02:00
Zhao Zhili 9e49915195 avcodec/mediacodecenc: Add global header support
The extradata is generated by encoding a dummy frame, then reset
the encoder state by mediacodec flush(). It only works for pixel
format other than AV_PIX_FMT_MEDIACODEC, since I'm not sure how
to create a dummy frame safely with AV_PIX_FMT_MEDIACODEC.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-04-23 15:35:26 +08:00
Zhao Zhili 98b5e80fd6 avcodec/mediacodec_wrapper: link to NDK mediacodec API directly
Drop support of Android version before 5.0.
2024-04-23 15:35:26 +08:00
Zhao Zhili 309cff378c configure: Lower Android API level requirement of mediandk
AImage_delete is introduced in API level 24, while AMediaFormat_new
is introduced in API level 21. We only need API level 21 to support
NDK mediacodec. This change doesn't break or change of
android_camera_indev since camera2ndk still needs API level 24.
2024-04-23 15:35:26 +08:00
Haihao Xiang 3032a74cac configure: fix rpuenc typos
Otherwise there are link errors:
LD      ffprobe_g
/usr/bin/ld: libavcodec/libavcodec.so: undefined reference to
`ff_dovi_rpu_generate'
/usr/bin/ld: libavcodec/libavcodec.so: undefined reference to
`ff_dovi_configure'
collect2: error: ld returned 1 exit status

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
Reviewed-by: Jan Ekström <jeebjp@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-04-22 17:20:16 -03:00
Niklas Haas 2f3c1e1641 avcodec/libsvtav1: implement dolby vision coding 2024-04-22 12:17:56 +02:00
Niklas Haas 39ca87ed1e avcodec/libx265: implement dolby vision coding
libx265 supports these natively, we just need to attach the generated
NALs to the x265picture, as well as setting the appropriate DV profile.
2024-04-22 12:17:56 +02:00
Niklas Haas 8dea94a146 avcodec/libaomenc: implement dolby vision coding 2024-04-22 12:17:56 +02:00
Niklas Haas f140935005 avcodec/dovi_rpuenc: add ff_dovi_configure()
We need to set up the configuration struct appropriately based on the
codec type, colorspace metadata, and presence/absence of an EL (though,
we currently don't support an EL).

When present, we use the signalled RPU data header to help infer (and
validate) the right values.

Behavior can be controlled by a new DOVIContext.enable flag.
2024-04-22 12:17:51 +02:00
Niklas Haas 783734d979 configure: rename dovi_rpu subsystem to dovi_rpudec
To distinguish it from the to-be-added dovi_rpuenc.
2024-04-22 12:17:05 +02:00
Haihao Xiang 5c55e4e297 lavfi: Add drawbox_vaapi filter
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-04-18 14:43:07 +08:00
Haihao Xiang 42eb10ecc6 lavfi: Add pad_vaapi filter
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-04-18 14:43:07 +08:00
J. Dekker 67e2f8b6bf configure, etc: switch to shebang without space
Note that the config.sh file is left without a shebang, this file is
supposed to be sourced into the current environment.

This commit is purely cosmetic.

Signed-off-by: J. Dekker <jdek@itanimul.li>
2024-04-09 16:01:24 +02:00
J. Dekker 3090106635 configure: simplify bigendian check
The preferred way to use LTO is --enable-lto but often times packagers
still end up with -flto in cflags for various reasons. Using grep
on binary object files is brittle and relies on specific object
representation, which in the case of LLVM bitcode, debug information or
other intermediary formats can fail silently.

This patch changes the check to a more commonly used define for GCC
style compilers. More checks may be needed to cover other potential
compilers that don't use the __BYTE_ORDER__ define.

Signed-off-by: J. Dekker <jdek@itanimul.li>
2024-04-09 15:34:13 +02:00
James Almer 5e0eac3d45 avcodec/libaomenc: bump the minimum required version to 2.0.0
v2.0.0 is already four years old and even newer versions are available on
stable distro releases.
With this we stop setting codec capabilities during static data initialization.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-04-05 14:32:08 -03:00
Antoine Soulier via ffmpeg-devel 240fd04db2 avcodec/liblc3: add encoding/decoding support of LC3 audio codec
The LC3 audio codec is the default codec of Bluetooth LE audio.
This is a wrapper over the liblc3 library (https://github.com/google/liblc3).

Signed-off-by: Antoine Soulier <asoulier@google.com>
2024-04-04 17:47:31 +02:00
Andreas Rheinhardt 3fe28831ed configure: Only enable iamfdec, iamfenc when needed
Since 591e27d1e7 they would
always be compiled even when nothing uses them; for shared
builds the default linker behaviour is to include them
even when not needed.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-03 22:12:55 +02:00
Andreas Rheinhardt 9c4558b596 configure: Fix iamfdec dependencies
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-03 22:04:46 +02:00
Andreas Rheinhardt 924402f783 configure: Add missing libdav1d/av1 decoders->dovi_rpu dependency
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-03 20:07:54 +02:00
Eugene Zemtsov 591e27d1e7 configure: Separate subsystem for Immersive Audio Model
This change allows users to build libavfomat without support
for Immersive Audio Model by specifying --disable-iamf.
It helps to save on binary size in cases where it's important.

Co-authored-by: James Almer <jamrial@gmail.com>
Signed-off-by: Eugene Zemtsov <eugene@chromium.org>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-04-03 09:57:52 -03:00
Andreas Rheinhardt 5d71f97e0e all: Don't use ATOMIC_VAR_INIT
C11 required to use ATOMIC_VAR_INIT to statically initialize
atomic objects with static storage duration. Yet this macro
was unsuitable for initializing structures [1] and was actually
unneeded for all known implementations (this includes our
compatibility fallback implementations which simply wrap the value
in parentheses: #define ATOMIC_VAR_INIT(value) (value)).
Therefore C17 deprecated the macro and C23 actually removed it [2].

Since commit 5ff0eb34d2 we default
to C17 if the compiler supports it; Clang warns about ATOMIC_VAR_INIT
in this mode. Given that no implementation ever needed this macro,
this commit stops using it to avoid this warning.

[1]: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2396.htm#dr_485
[2]: https://en.cppreference.com/w/c/atomic/ATOMIC_VAR_INIT

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-28 09:12:48 +01:00
Andreas Rheinhardt 8d8b5947c3 configure: Make hls demuxer select AAC, AC3 and EAC3 demuxers
The code relies on their presence and would presumably crash
when retrieving in_fmt->name if an encrypted stream with a codec id
without demuxer were encountered.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-26 06:36:43 +01:00
Lynne ecdc94b97f
vulkan_av1: port to the new stable API
Co-Authored-by: Dave Airlie <airlied@redhat.com>
2024-03-25 08:54:40 +01:00
Andreas Rheinhardt 0d43adcbef configure: Explicitly check for static_assert, _Static_assert
C11 provides static assertions via _Static_assert and
provides static_assert as a convenience define for this
in assert.h. Our codebase uses the latter, as _Static_assert
has actually already been deprecated in C23.

Not all toolchains that declare support for C11 actually
support it; e.g. MSVC 19.27 does not support _Static_assert,
but somehow supports static_assert. MSVC 19.27 admits to be
a "preview implementation of the ISO C11 standard",
so this is not surprising (MSVC 19.28 does not come with
this caveat).

Furthermore some FATE boxes [1] use old GCC toolchains (with
only experimental support for C11) where _Static_assert is
supported, but assert.h does not provide the fallback define.
They are broken since the first usage of static_assert.

This commit therefore checks whether static_assert and
_Static_assert work with assert.h included; if not,
configure errors out.

This intentionally drops support for MSVC 19.27. Users like
the old FATE boxes above can still add -Dstatic_assert=_Static_assert
to cflags as a workaround if desired.

[1]: https://fate.ffmpeg.org/report.cgi?time=20240321123620&slot=sh4-debian-qemu-gcc-4.7

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-24 19:05:35 +01:00
Henrik Gramner afa471d0ef x86: Update x86inc.asm
Make things up-to-date with upstream.

https://code.videolan.org/videolan/x86inc.asm
2024-03-24 14:53:57 +01:00
Matthieu Bouron 6567516a5e avformat: add Android content resolver protocol support
Handles Android content URIs starting with content://.
2024-03-23 11:37:29 +01:00
Zhao Zhili 5229778440 avcodec/libx264: fix extradata when config annexb=0
AVCodecContext extradata should be an AVCDecoderConfigurationRecord
when bitstream format is avcc. Simply concatenating the NALUs output
by x264_encoder_headers does not form a standard
AVCDecoderConfigurationRecord. The following cmd generates broken
file before the patch:

ffmpeg -i foo.mp4 -c:v libx264 -x264-params annexb=0 bar.mp4

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-03-22 20:26:53 +08:00
James Almer 5ff0eb34d2 configure: check for C17 by default
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-20 17:11:18 -03:00
James Almer 6c2ff982dc configure: make the C and C++ standard settable
While ensuring it's at least C11, the minimum supported version.
Also, enforce C11 on the host compiler, same as we already do for C11 on the
target compiler.

Tested-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-20 17:10:55 -03:00
Jan Ekström 471c0a34c1 avcodec/libx264: add support for writing out CLL and MDCV
Both of these two structures were first available with X264_BUILD
163, so make relevant functionality conditional on the version
being at least such.

Keep handle_side_data available in all cases as this way X264_init
does not require additional version based conditions within it.

Finally, add a FATE test which verifies that pass-through of the
MDCV/CLL side data is working during encoding.
2024-03-20 19:15:05 +02: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
Andreas Rheinhardt c00cd007e8 configure: Remove av_restrict
All versions of MSVC that support C11 (namely >= v19.27)
also support the restrict keyword, therefore av_restrict
is no longer necessary since 75697836b1.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-15 12:51:15 +01:00
Marton Balint 7196b12b2b avformat/daudenc: force 2000 sample packet size with a bsf
The samples I found all have 2000 sample packets, and by forcing the packet
size with a bsf we could automagically make muxing work for packets containing
more than 3640 samples.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-14 01:37:31 +01:00
Gyan Doshi 9e8be937fc configure: add threads dep for vulkan
Fixes #10900
2024-03-13 09:57:54 +05:30
Andreas Rheinhardt b800327f4c avformat/avformat: Add FFInputFormat, hide internals of AVInputFormat
This commit does for AVInputFormat what commit
59c9dc82f4 did for AVOutputFormat:
It adds a new type FFInputFormat, moves all the internals
of AVInputFormat to it and adds a now reduced AVInputFormat
as first member.

This does not affect/improve extensibility of both public
or private fields for demuxers (it is still a mess due to lavd).

This is possible since 50f34172e0
(which removed the last usage of an internal field of AVInputFormat
in fftools).

(Hint: tools/probetest.c accesses the internals of FFInputFormat
as well, but given that it is a testing tool this is not considered
a problem.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-07 08:53:31 -03:00
James Almer 5b23b18d40 avcodec: remove deprecated FF_CODEC_CRYSTAL_HD
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
Marth64 59981b47db configure: do not specify -ldvdread, as pkg-config check is already done
Reported-by: BtbN
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-03-04 18:54:50 +01:00
Marth64 a1304272c3 libavformat/dvdvideo: add DVD-Video demuxer, powered by libdvdread and libdvdnav
Signed-off-by: Marth64 <marth64@proxyid.net>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-03-02 08:12:29 +01:00
Andreas Rheinhardt 45c612702f configure: Add missing vvc_decoder->cbs_h266 dependency
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-02 13:28:21 +08:00
Zhao Zhili f7545e90df avutil/hwcontext_opencl: Add map from Videotoolbox to OpenCL
For example:
./ffmpeg -hwaccel videotoolbox \
	-hwaccel_output_format videotoolbox_vld \
	-i foo.mp4 \
	-vf hwmap=derive_device=opencl,transpose_opencl=dir=clock,hwmap,format=nv12 \
	-c:v hevc_videotoolbox \
	-c:a copy \
	-b:v 2M -tag:v hvc1 bar.mp4

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-03-01 17:24:00 +08:00
Andreas Rheinhardt 25e0e087c4 configure: Disable linker warnings for common symbols
Common symbols are not part of ISO-C and therefore not used
by FFmpeg at all. Yet linker warnings to ensure it stays
that way are nevertheless wrong, because the existence of
common symbols does not imply that there is a bug in our code.

More precisely, Clang's ASAN implementation uses a common symbol
___asan_globals_registered when used on Elf targets with
the -fsanitize-address-globals-dead-stripping option;
said option is the default since Clang 17 [1].
This leads to 1883 warnings about ___asan_globals_registered
when linking here.
(Even without that option there were warnings like
_ZN14__interception10real_vforkE being overridden.)

Said warning is also unnecessary: The proper way to ensure
that our code is free of common symbols is to let the compiler
enforce this. But this is already the default since GCC 10
and Clang 11, so there is no risk of introducing our own
common symbols.

[1]: https://reviews.llvm.org/D152604

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-26 22:09:19 +01:00
Gyan Doshi ecb3c8a536 configure: select iamfenc as movenc dep
Unbreaks movenc compilation in minimal configuration.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-24 19:44:38 -03:00
Martin Storsjö 1f1abb27f1 configure: Fix a typo
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-02-21 23:28:21 +02:00
James Almer fe637161db avformat/mov: add support for Immersive Audio Model and Formats in ISOBMFF
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-20 11:24:19 -03:00
James Almer c95c8a0158 avformat/iamfenc: further split into shareable modules
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-19 20:53:36 -03:00
James Almer c7266ad60f avformat/iamfdec: further split into shareable modules
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-19 20:53:36 -03:00