af_whisper writes its output through AVIO. Without avformat in the
filter dependencies and avfilter_deps, a minimal shared build leaves
avio_closep, avio_write and avio_open unresolved. The library builds,
but linking a consumer with -Wl,--no-allow-shlib-undefined fails with
undefined references to all three symbols. With --disable-avformat,
configure also kept the filter enabled; it is now disabled cleanly.
Signed-off-by: lusoris <lusoris@proton.me>
f_metadata.c opens its output file with avio_open() and writes it
with avio_vprintf(). metadata_filter_deps and ametadata_filter_deps
list avformat, but the conditional library dependency list has no
entry for either filter, so a build with only one of them enabled sets
avfilter_FFLIBS=avutil and a shared libavfilter has no libavformat
NEEDED entry; a consumer linked with -Wl,--no-allow-shlib-undefined
fails on the avio symbols.
With these entries avfilter_FFLIBS=avformat avcodec avutil and the
consumer links and runs with LD_BIND_NOW=1.
Signed-off-by: lusoris <lusoris@proton.me>
scale_vulkan calls sws_alloc_context(), sws_scale_frame() and
sws_free_context(), and scale_vulkan_filter_deps lists swscale, but
the conditional library dependency list has no entry for the filter.
A build with only this filter enabled sets avfilter_FFLIBS=avutil, so
a shared libavfilter has no libswscale NEEDED entry and a consumer
linked with -Wl,--no-allow-shlib-undefined fails on the three sws_*
symbols.
With this entry avfilter_FFLIBS=swscale avutil and the consumer links
and runs with LD_BIND_NOW=1. A standalone scale_vulkan build also
needs scale_eval.o, which "avfilter/Makefile: add missing objects for
standalone Vulkan filters" adds.
Signed-off-by: lusoris <lusoris@proton.me>
Forgejo CI runs FATE on ppc64, mips64 and riscv64 with GCC 16 under
QEMU, and FATE has native ppc64le (GCC 15) and riscv64 (GCC 14) clients,
so these architectures get the same coverage as x86, arm and aarch64.
On loongarch GCC 14.0-14.3 and 15.0-15.1 miscompile vector permutations
(GCC PR121064), fixed in 14.4, 15.2 and newer, so vectorization is
disabled only for those versions.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
The PPC SIMD code is selected at runtime, but configure added
-maltivec -mabi=altivec and -mvsx to CFLAGS, so GCC could emit AltiVec
and VSX instructions in any function. It does, so a default PPC32 build
crashes on CPUs without AltiVec. Collect the flags in ALTIVECFLAGS and
VSXFLAGS and add them only to the ALTIVEC-OBJS and VSX-OBJS objects and
to the header check of util_altivec.h. VSX is only enabled on
little-endian, where the AltiVec code loads and stores with VSX, so
there the AltiVec files get the VSX flags, as they did through CFLAGS.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
This filter takes a scene graph in the libplacebo scene JSON format and
exposes it as a filter. The number of inputs and their properties are
determined by the scene graph.
I decided to make this a separate filter because it invalidates most of
the existing options, including e.g. the existing scaling and fitting logic.
For simplicity, scene graphs are always assumed to have a fixed canvas size,
which the user continues specifying at init time.
Requires libplacebo API version 386 or newer, which we probe the existence
for as a separate capability so we can selectively expose the filter.
Sponsored-by: nxtedition AB
Signed-off-by: Niklas Haas <git@haasn.dev>
Since b5bfb7716c ("avcodec/ac3enc: drain the buffered samples at the
end of encoding"), ac3enc.c uses ff_af_queue_*, but the AC-3 encoders
never selected audio_frame_queue. Builds that enable only these
encoders (e.g. --disable-everything --enable-encoder=ac3) fail to link.
Signed-off-by: Vanilagy <1696106+Vanilagy@users.noreply.github.com>
The SPIR-V backend is built on top of the ops code, which is only compiled
with CONFIG_UNSTABLE. Express this dependency in configure instead of
guarding the vulkan Makefile include and ff_sws_vk_init() call separately.
This also fixes linking with --disable-unstable when vulkan is enabled, as
graph.c referenced ff_sws_vk_device_ref() from the excluded vulkan objects.
Fixes: 51d4406e07 ("swscale/graph: support allocating hardware intermediate frames")
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Niklas Haas <git@haasn.dev>
A frame that cannot be output is skipped and its base freed.
Fixes: out of array write
Fixes: yOAdvErxaeGg
Fixes: DAHozZoXi03N/hijack2_twogc.h264
Found-by: Ayoub Nabil Boubagrat <237098474+ayoubnabil@users.noreply.github.com>
Out of array write Replicated through UnModified FFmpeg with ASAN
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
LAME 3.101 adds pkg-config support, generating and installing lame.pc.
Its autotools build also replaces the bundled mpglib decoder with
external libmpg123. Static libmp3lame builds with decoding support
therefore require additional libraries when linking.
The existing check links only against libmp3lame and libm, ignoring
pkg-config metadata and failing with undefined mpg123_* references.
Try pkg-config first to obtain the compiler and linker flags, honoring
the configured pkg-config flags for static dependencies. Keep the
existing library check as a fallback for older LAME releases and other
installations without usable pkg-config metadata.
Signed-off-by: Ruonan <yu_ruonan@outlook.com>
This format is only auto-probed when we can be certain that the image is a
JPEG MPF file; as evidenced either by the extension (.mpo), or by the
presence of an MPF APP2 marker or an ISO21496 gain map stub.
This does require parsing possibly arbitrarily far into the file, since
the MPF header can be after a > 2 KB EXIF header; and this matches files
produced in the wild (by e.g. Apple's jpeg ultra hdr encoder).
The probe function returns AVERROR(EAGAIN) to request more data until it
reaches either the MPF marker or the start of the entropy coded data. If
the probe limit or EOF is hit first, the best scoring other format wins,
e.g. image2 for regular .jpg files.
A few additional notes:
- libultrahdr produces quite spec-incompliant files which we unfortunately
have to work around
- since the MPF format table can be arbitrarily far from the header, we
also need to store possibly a lot of data and re-return it to the caller;
I have followed the convention established by e.g. fitsdec.c of just keeping
a spare AVPacket for bytes already read during header parsing (cf. also
jpegxl_anim_dec.c)
Signed-off-by: Niklas Haas <git@haasn.dev>
ff_network_wait_fd() can only return after its poll() slice, so a
thread blocked in it notices a request from another thread up to
POLLING_TIME late. Add a one-shot channel that a second thread can
signal to end the wait at once, together with a wait function that
polls it next to the socket.
The channel is an eventfd where available and a pipe otherwise. On
Windows neither can be waited on together with sockets, so it is a
loopback datagram socket connected to itself.
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Cast each probed symbol to intptr_t and store it in a static volatile
object instead of casting it to long in a wrapper function whose address
main() masks. The volatile stores keep the references under LTO and
intptr_t avoids the pointer truncation warnings on LLP64 targets
(-Wpointer-to-int-cast). Also deduplicate it with check_host_lib.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
The device transfers directly to and from page-locked host memory,
while pageable memory is copied through a buffer of the driver.
Pageable memory remains in use when page-locked memory cannot be
allocated and with ffnvcodec headers that lack cuMemHostAlloc().
As a page-locked source is read by the device after the upload
returns, uploads now wait for the transfer to complete, like downloads.
ffmpeg -hwaccel cuda -i hevc.mp4 -f null - on a RTX 5090, mean of 10
runs: 1080p 1773 -> 1855 fps, 2160p 497 -> 533 fps, 4320p 112 -> 124 fps.
Assisted-by: Claude
HAVE_PTHREAD_CANCEL has no consumers left: udp no longer cancels its
receive thread, and the dnn guards were already removed.
Android bionic and Windows w32threads do not provide pthread_cancel(),
and on Darwin a cancel request made while cancellation is disabled may
never acted on (see PR #24886). Probing for pthread_cancel may invite
new code to depend on it.
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
The OpenGL output device was removed, but configure still exposed --enable-opengl and probed OpenGL headers and functions.
Remove the stale option, dependency checks, configure probes, and related device metadata.
Signed-off-by: Ruonan <yu_ruonan@outlook.com>
GNU binutils spells the MMI instructions pxor, pand, por, pnor, ssrld
and sslld as xor, and, or, nor, dsrl and dsll on floating point
registers, with -march=loongson2e/2f/3a and since 2.32 with
-mloongson-mmi; the p-named entries in its opcode table are the R5900
instructions on general purpose registers. The other 43 p-named MMI
instructions FFmpeg uses are spelled the same by everyone. Loongson's
gcc toolchain accepts both spellings (ebedd26eef), the binutils 2.24
of their cross-gcc-4.9.3-n64-loongson-rc6.1 only the GNU ones.
Since 903c5d58f0 configure probes pxor and so silently disables MMI
with every GNU binutils. Probe Loongson's spelling first and fall
back to the GNU one together with assembler macros that define the
six names, as asmdefs.h already does for parse_r. The macros assemble
to the same encodings as the GNU spelling with binutils 2.24, 2.28
and 2.42.
The GNU fallback is limited to little-endian mips64: the MMI code does
not build for O32 and its unaligned loads assume little-endian.
This commit enables the DNN video filter to run entirely on the GPU
for the full D3D12 pipeline (decode, AI inference, and encode)
without ever copying frames back to system memory, making it
significantly faster on D3D12 hardware.
Benchmarked the new zero-copy D3D12/DirectML DNN pipeline against
the existing CPU round-trip pipeline on three major GPU vendors; up
to 10x throughput improvement was measured across every vendor.
Add dnn_onnx_d3d12, a helper that binds the DirectML execution
provider to a D3D12VA input frame's own device and does NV12
texture<->tensor conversion on the GPU (CopyTextureRegion + compute
shaders), avoiding a host round-trip.
dnn_processing negotiates this automatically for D3D12 NV12 input
with device=dml. Software-frame input retains the host I/O path.
D3D12 input requires successful DirectML negotiation; unsupported
hardware-input configurations fail during configuration. Currently
limited to single-channel FLOAT/NCHW models; chroma bypasses the
model and is copied/upscaled on the GPU. At runtime, DirectML.dll
and d3dcompiler_47.dll must be loadable from the application
directory or System32.
Example usage:
# Zero-copy pipeline
ffmpeg.exe -y -loglevel info \
-hwaccel d3d12va -hwaccel_output_format d3d12 \
-i input-1920x1080.mp4 \
-vf "dnn_processing=dnn_backend=onnx:device=dml:model=ecbsrnet_y_fused.onnx:input=input:output=output" \
-c:v h264_d3d12va -bf 0 -c:a copy \
output_2x_sr_zero_copy.mp4
# CPU round-trip pipeline
ffmpeg.exe -y -loglevel info \
-init_hw_device d3d12va=dev -filter_hw_device dev -hwaccel d3d12va \
-i input-1920x1080.mp4 \
-vf "dnn_processing=dnn_backend=onnx:device=dml:model=ecbsrnet_y_fused.onnx:input=input:output=output,hwupload" \
-c:v h264_d3d12va -bf 0 -c:a copy \
output_2x_sr_round_trip.mp4
Signed-off-by: younengxiao <steven.xiao@amd.com>
asf_o is a second, non-default implementation of the ASF demuxer next
to asfdec_f.c. Security issues keep being reported against it, so it
is a maintenance burden without a benefit over the default demuxer.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
If Vulkan was enabled but no SPIR-V headers were found, the Vulkan code
in swscale was still compiled, but no backend was exported. Vulkan
frames were still reported as supported by sws_test_hw_format().
Add a swscale_vulkan configure symbol, enabled when Vulkan and either
SPIR-V header are available, and use it for all Vulkan code in swscale
and for the spirv FATE tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The o key lists the directory of the input, local or remote, in the
list. Enter or a click lists the chosen directory or plays the chosen
file instead of the input once it opened, so a file that is no media
leaves the input playing. Directories come first, hidden entries are
left out, and the popup of a file shows its size.
Assisted-by: Claude
The strips were rendered by the ass filter over a color source in a
filter graph, whose generic blending took most of the time. libass now
renders each strip and its glyphs are composited over the strip
background where they cover it; a row strip at 1080p takes 0.47 instead
of 1.29 ms. ffplay suggests libass instead of the ass filter and no
longer selects the color filter.
Assisted-by: Claude
This is a new library, separate from the existing fdk-aac (but
built from the same upstream repo), for encoding xHE-AAC.
This library has the same traits as fdk-aac; it's being distributed
from Fraunhofer to Android Open Source Project, and further
repackaged and distributed through opencore-amr [1] (and in a
personal repo on github at [2]). It is distributed under the
same license as fdk-aac.
This is an initial, barebones wrapper around the library - not
all features of the library are hooked up currently.
In particular, do note that the wrapper currently only handles
loudness in the live operating mode (single pass), where encoding
is done with a single loudness level set before encoding. This may
affect the dynamics of the input.
The preferred and intended mode of use for the fdk-xhe-aac encoder
is for it to be used in two pass mode, which handles the loudness
properly. The two pass operation mode is not set up in the
encoder wrapper yet, but may be added later.
[1] https://sourceforge.net/projects/opencore-amr/
[2] https://github.com/mstorsjo/fdk-aac
Like the fd protocol, but takes a raw Windows HANDLE instead of a CRT file descriptor.
On Windows, CRT file descriptors cannot be reliably passed to child processes, so
HANDLEs need to be used instead.
Signed-off-by: Felipe Araújo <felipdsa21@outlook.com>
The dcbzl probe runs unconditionally and re-enables dcbzl whenever the
assembler accepts it, overriding --disable-dcbzl and the "disable dcbzl"
in the e500 and e500v2 --cpu cases. e500 cores trap on dcbzl, so ffmpeg
dies with SIGILL in ff_blockdsp_init_ppc() on a P2020 (e500v2) as soon
as it opens an MPEG-2 decoder.
Only run the probe when dcbzl is not disabled.
Fixes: #24747
Suggested-by: Michael Niedermayer <michael@niedermayer.cc>
Original-patch-by: Peter Krefting <peter@softwolves.pp.se>
Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
After CFLAGS stopped being passed to the C++ compiler, supplying the
DeckLink SDK include path only through --extra-cflags still passed
configure but failed when building the DeckLink C++ sources.
Compile the DeckLinkAPI.h check as C++ and check the SDK version in both
languages. The C wrappers also include DeckLinkAPIVersion.h, so document
that both --extra-cflags and --extra-cxxflags need the SDK include path.
Fixes: 0ce413af9cFixes: #23072
Assisted-by: Fairy
GCC warns when a warning option is valid for another language and no -W
option controls that warning, so after 45ec2cae19 dropped -Werror from
the probe, -Wno-pointer-sign passed the C++ check and ended up in
CXXFLAGS. Clang likewise warns about unknown warning options. -Werror
covers both, so use it directly instead of the Clang specific -Werror=
flags, and translate it to -WX for MSVC, which does not accept the GCC
spelling.
Using -Werror already includes more specific warnigns, so remove
`unknown_warning_cflags` and just use -Werror.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
All DNN backends (TensorFlow, OpenVINO, libtorch, ONNX Runtime) require
multithreading at runtime, and the DNN async inference path uses pthread
APIs directly. Disabling thread support while building DNN is not a real
use case.
Page up/down fade in a list of the chapters around the current one and
fade it out again half a second after the last key press, "l" keeps it
on screen, and while it is kept down/up move the selection. Enter seeks
to the selected chapter and the mouse wheel moves the selection whenever
the list is visible. Each entry shows the chapter's number, its title
with the artist beneath it, both clipped to their column, and its
length; a bar at the left edge marks the chapter being played and moves
along with playback.
The ass filter renders the list onto a transparent canvas the size of
the panel, only when its content changes, and SDL composites the result
as a texture whose alpha modulation does the fading. The video path is
untouched and nothing is drawn while the list is hidden. The list is not
available with the Vulkan renderer, which bypasses SDL rendering.
Assisted-by: Claude
MSYS2 emulates ln -s by copying the target unless native links are
requested, so the src link test never passed there and out of tree
builds on Windows got the absolute source path in every -I flag and
dependency file. Native links need Developer Mode or the symlink
privilege. When that is missing, both MSYS2 and Cygwin fall back to link
types only their own tools can read, which the shell test accepts while
the compiler cannot open a header through them.
Request native links, create the src link itself instead of probing a
temporary one, and keep it only if it is a symbolic link and the
compiler can preprocess a header through the src path. A copying link
tool would otherwise pass the compiler test with a stale snapshot of
the tree, so anything else the tool created is removed. That also drops
the temporary files and their cleanup.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
CONFIG_MEMORY_POISONING fills fresh allocations with a pattern. Memory
checkers that track initialization take that fill for real data and stop
reporting reads of it, which defeats the purpose of the fill.
MSan is told in every MSan build, its cost is expected there. The
Valgrind client requests are only compiled in memory poisoning builds,
since they would otherwise cost every allocation a few instructions in
any ordinary build made where the Valgrind headers are installed.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
d49fcd7f82 moved seg_gather.comp.spv.o to CONFIG_VULKAN, so every build
with Vulkan enabled now compiles GLSL, and one without a GLSL compiler
fails with "glslc: command not found". Vulkan itself does not need a GLSL
compiler.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
Clang targeting MSVC compiles __int128, but nothing links the compiler-rt
builtins that implement 128-bit division. The clang driver defaults to
the libgcc runtime, which adds nothing on MSVC, and link.exe or lld-link
invoked directly do not know the library either. Since b2b37802a9 the
check therefore fails for these toolchains and libswscale falls back to
AVInteger.
Ask the driver for the library name and retry the check with it. The
driver and lld-link search the clang runtime directory on their own, so
this covers linking through clang as well as calling lld-link directly.
link.exe only finds the library through LIB, where the copy shipped with
MSVC is built with cl and lacks the 128-bit routines, so the check keeps
failing there and nothing changes for such setups.
The library is recorded in int128_extralibs and pulled in by libswscale,
the only user of av_int128, the same way libatomic is handled.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
Both non-pthread thread backends depend on atomics_native, so
check_deps has already disabled them, or died for an explicit request,
before this line runs. The remedies it suggests refer to the pthread
emulation and the gcc builtins backend, both removed in 8c185ef4e7.
The remaining case, C11 atomics missing on a pthreads target, is still
caught by the abort at the compat include path selection.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
atomics_os2 was not a backend. It has no compat directory and nothing
reads it. It aliased stdatomic without a target guard, so it enabled
atomics_native on every platform with C11 atomics as a side effect,
only to satisfy the os2threads dependency on OS/2.
State the rule directly instead. atomics_native is stdatomic or the
win32 compat backend, and every non-pthread thread backend depends on
it. os2threads stays enabled exactly when stdatomic is available, and
the shared protocol can depend on atomics_native alone, without the
internal stdatomic check as a dependency.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
Nothing has called MemoryBarrier() since the backend rewrite. Check the
_InterlockedOr directly and drop HAVE_MEMORYBARRIER which is not used
anywhere.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
This makes this available on Windows too. The mmap and unistd_h
dependencies are gone, the protocol builds everywhere and
av_file_map_shared() reports the platforms without shared mappings at
runtime.
The cache file is no longer shortened when it is longer than the known
file size, the mapping simply covers its beginning.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
Many toolchains provide compilers named "gcc" (or "<triple>-gcc")
that still are identified as cc_type="clang" by our configure.
For these, rewrite "gcc" into "g++", rather than rewriting "cc" into
"c++" (which results in "gc++").
This fixes the default value of cxx on macOS when no compiler is
specified by the user (where we default to "gcc") after
662ea4a3e7.
configure never looks at the C++ compiler on its own. There is no
probe_cc for it, and CXXFLAGS take the C compiler's flag filter and
object conventions, so one toolchain for both is already assumed. Make
it so by deriving cxx from cc the way as, objcc and ld are.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
b4bd8d1f64 made the status the AND of both compilers and 50e64f97d9 put
it in charge of the arm, mips and darwin decisions. That couples C to
C++ both ways. A C rejection stops C++ from being probed at all, and a
C++ rejection is reported as if C had rejected too. That is not
expacted. Separate the probe, C++ sets flags that it understand now and
the return status of check_allcflags() is C only.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
This reverts commit 59dd21047e.
The new tool does not properly resolve relative paths on MSYS2, and
potentially other targets.
It tries to make paths relative that are outside of the virtual MSYS
root dir, trying to .. below it. Resulting in invalid paths that send
MSYS make into an infinite loop somehow.
The SPIR-V header probe runs while vulkan is still auto-enabled, before
check_deps has a chance to disable it for a missing dependency such as
threads.
This fixes builds without threads, which would fail to link:
error: undefined symbol: backend_spirv
referenced by ops.c:42 (libswscale/ops.c:42)
Fixes: 2b6fbcad6d
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>