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>
av_get_frame_filename() is a trivial function that uses no lavf API, only lavu,
so it can be duplicated here to save an unnecessary dependency.
Signed-off-by: James Almer <jamrial@gmail.com>
Configure now will die and report correct error message if
unsupported sanitizer is requested. Instead of adding flags
unconditionally.
The linker flags are added only if supported. Some compilers like MSVC,
does not need/want them. The same goes for -fno-omit-frame-pointer which
is added only when supported now.
Probing needs the temporary files and the probed tools, neither of which
exists where the toolchain is selected, hence the requested sanitizers
are gathered and actual probe is defered to after toolchain is
established.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
0ce413af9c gave check_disable_warning() a C++ checks at a time when
unknown_warning_flags was a single set probed with test_cflags, so it
said nothing about what the C++ compiler accepts. The -Werror was added
as a glue that reject C only flags from C++ compilation and probe time.
However, after 005510501e made those flags per language and
unknown_warning_cxxflags is now probed with test_cxxflags, so the Werror
is no longer relevant.
This is not only cosmetic change, because -Werror itself is not valid
flag for MSVC, all tests were failing there.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
0ce413af9c stopped prepending CFLAGS to CXXFLAGS and converted the call
sites that have to reach every language, but not these. So, things were
silently not added for C++ compilation.
The impact is small, because we have only handful of C++ files, but
still this needed fixing.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
ObjC is compiled with the C flags. OBJCCFLAGS in ffbuild/common.mak
includes CFLAGS and test_objcc() passes it as well. OBJCFLAGS is meant
for what ObjC needs beyond C. No need to duplicate all flags there.
They were needed for the short while 0ce413af9c had $CFLAGS taken out of
test_objcc(). 189d0b83b2 put it back and left the duplication.
Note that the issue is not only cosmetic duplication, for example MSVC
cannot compile ObjC, so the check_allcflags never suceeded there. While
the ObjC were checked last, flags were added for C/CXX, but the return
value was always false.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
Add the ASTC codec ID and descriptor together with encoder and decoder
wrappers for Arm's astc-encoder library. Support the four ASTC profiles,
2D and 3D block footprints, LDR RGB/RGBA input, and floating-point HDR
input without clamping the decoded result to 8-bit.
Keep the ASTC image dimensions and compressed block sizes bounded by the
format and packet limits, and pass KTX-provided color profile metadata to
the decoder when no explicit profile was selected.
libastcenc is distributed under the Apache License 2.0, so the library is
only available when FFmpeg is built with --enable-version3; list it with
the other libraries that require that option.
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
stdatomic.h is always available, either the native or the compat version,
so the stdatomic dependency was always incorrect. The stdatomic check is
internal to configure, it only decides whether the compat version has to
be added, and should not be used as a dependency of any code. Before the
recent compat/atomics rewrite the compat headers were not compatible with
the way shared.c uses atomics, so the protocol was silently disabled with
them, probably by accident. The compat win32 version now works just fine
with shared.c.
What the protocol does need are atomic operations that synchronize
processes sharing the cache. The dummy backed is excluded, we need
working atomic operations even in single-threaded build. However small,
such configuration is, every relevant target should have stdatomic
available anyway.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>