7036 Commits

Author SHA1 Message Date
Diego de Souza
74db061f0a avutil/hwcontext_cuda: add P012 and P212 to supported formats
NVDEC and CUVID decode 12-bit 4:2:0 content to AV_PIX_FMT_P012 and
12-bit 4:2:2 to AV_PIX_FMT_P212, but these formats were missing from
the CUDA frames context supported format list. As a result
av_hwframe_ctx_init() rejected them ("Pixel format not supported",
AVERROR(ENOSYS)), so decoding 12-bit content to CUDA frames and
hwdownload of such frames both failed.

Add P012 and P212 next to the existing P010/P016 and P210/P216 entries.
The per-plane device transfer is derived generically from the pixel
descriptor, so no other changes are required.

Signed-off-by: Diego de Souza <ddesouza@nvidia.com>
2026-06-23 23:58:45 +00:00
marcos ashton
2985d42978 libavutil/pixdesc: fix prefix matching in *_from_name() functions
The seven *_from_name() functions in pixdesc.c (color_range,
color_primaries, color_transfer, color_space, chroma_location,
alpha_mode) used av_strstart() for prefix matching, which returns
incorrect results when one name is a prefix of another.

av_color_space_from_name("ycgco-re") matched "ycgco" at index
AVCOL_SPC_YCGCO and returned 8 instead of AVCOL_SPC_YCGCO_RE.
av_color_space_from_name("ycgco-ro") had the same issue. The
*_ext name lookups inside av_color_primaries_from_name and
av_color_transfer_from_name had the same flaw.

Switch all eight call sites from av_strstart() to strcmp() for
exact matching. No in-tree callers rely on prefix matching.

Signed-off-by: marcos ashton <marcosashiglesias@gmail.com>
2026-06-23 23:42:38 +00:00
Andreas Rheinhardt
762b94e672 libs: Bump major version of all libraries
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-06-23 19:15:57 +02:00
Andreas Rheinhardt
2d3776b8cc avutil/x86/emms: Unavpriv avpriv_emms_asm()
This fallback function is used if external MMX is available,
while inline MMX and intrinsics for emitting emms are unavailable.
It is implemented as an avpriv function, which has several
drawbacks for shared builds:
1. The function is so small (3 bytes; 16 with padding)
that the overhead of exporting and importing it dwarfs
the gains from code deduplication.
2. A call to an external library has more overhead than
a library-internal one.
3. It may cause linking failures when a libavutil not exporting
avpriv_emms_asm() is paired with a library needing it
(if inline assembly and intrinsics were unavailable when building
the dependent library). I am not aware of this ever happening.
4. We would be forced to keep avpriv_emms_asm() around for ABI stability
even after it is no longer needed.

This commit therefore uses the STLIBOBJS, SHLIBOBJS approach
to duplicating it into each library on its own if needed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-06-23 19:15:57 +02:00
Andreas Rheinhardt
fff992a5bc avutil/xga_font_data: Stop exporting font data directly
Commit c6c8063186 added getters for them.
Also remove av_export_avutil and the BUILDING_foo macro.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-06-23 19:15:57 +02:00
Andreas Rheinhardt
da0ea43984 avutil/hwcontext_vulkan: Move AVVkFrame.internal to the end
This allows us to remove it by allocating AVVkFrameInternal
jointly with AVVkFrame.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-06-23 19:15:57 +02:00
Lynne
61693f6c35 hwcontext_vulkan: switch to VkAccessFlagBits2 2026-06-23 19:15:57 +02:00
Andreas Rheinhardt
1c36aa8e33 avutil/opt: Remove FF_API_OPT_PTR
Deprecated on 2024-10-16.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-06-23 19:15:57 +02:00
Andreas Rheinhardt
c32a719cb2 avutil: Remove FF_API_OPT_INT_LIST
Deprecated on 2024-09-30.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-06-23 19:15:57 +02:00
Andreas Rheinhardt
38990c59d7 avutil/hwcontext_vulkan: Remove FF_API_VULKAN_FIXED_QUEUES
Deprecated on 2024-08-11.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-06-23 19:15:57 +02:00
Andreas Rheinhardt
46d52299f5 avutil/cpu: Remove FF_API_RISCV_FD_ZBA
Deprecated on 2024-08-05.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-06-23 19:15:57 +02:00
Andreas Rheinhardt
51231c5588 avutil/common: Remove FF_API_MOD_UINTP2
Deprecated on 2024-06-13.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-06-23 19:15:57 +02:00
Kacper Michajłow
64ce854ef5 avutil/hwcontext_d3d11va: support native P016 format
Map DXGI_FORMAT_P016 to AV_PIX_FMT_P016 and keep the 12-bit P012 as a
compatibility entry, matching how Y216 and Y416 already expose both their
native 16-bit and 12-bit variants.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-06-22 11:06:13 +00:00
Kirill A. Korinsky
b57ff00bcf configure/x86: split 7-register check from EBP availability
LLVM commit
0d471b3f64
made Clang save and restore EBP around inline asm that only
clobbers it. This can make the existing EBP crash probe pass even
when the compiler still cannot allocate the 7-register i386 inline
asm used behind HAVE_7REGS.

Keep ebp_available for HAVE_6REGS and add a separate
x86_32_7regs probe for HAVE_7REGS.

Discussion:
https://marc.info/?t=178015389900001&r=1&w=2
2026-06-20 11:46:49 +00:00
Andreas Rheinhardt
4bbb7d9b99 avutil/x86/x86util: Force VEX encoding when using -mavx
This avoids reg-reg moves and saves 90112B of .text here.
It also makes the code less reliant on a clean upper ymm state.

Not all functions use VEX encoding yet; besides inline assembly
functions which are not influenced by x86inc.asm there are also
functions using a mixture of xmm and mmx registers (e.g.
h264_intrapred.asm) using INIT_MMX where the automatic VEX translation
is not active. This means that some parts of the code still rely
on a clean upper ymm state.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-06-19 20:39:56 +02:00
Dmitrii Gershenkop
485f195690 avutil/hwcontext_amf: Implement AMF hardware memory mapping support. 2026-06-17 12:30:56 +00:00
Zhao Zhili
7338d08bcf avutil: zero size output parameter on allocation failure
Several _alloc() functions taking a size_t *size output parameter
either left it uninitialized or unconditionally set it to sizeof(...)
when the underlying av_mallocz() failed. Callers that check the
returned pointer first are unaffected, but the stale value is a trap
for any code path that inspects size without a NULL check.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2026-06-16 12:41:53 +00:00
Bogdan Lisman
3d1d546f70 avutil/eval: apply unary sign to print, squish, gauss and lerp
The leading sign of a (sub)expression is stored as +-1 in each node's
value field (parse_factor) and every other function multiplies its
result by it. print, squish, gauss and lerp ignored it, so e.g.
-print(1) evaluated to 1 instead of -1 and -gauss(0) to 0.398942
instead of -0.398942, while -1*print(1) was correct.

Fixes: ticket #9833
Reported-by: Player701
Signed-off-by: Bogdan Lisman <bogdan@pydevsolutions.com>
2026-06-15 19:11:59 +00:00
WyattBlue
b1d2190f5f avutil/riscv: Include unistd.h for musl Linux
Before, glibc appears to transitively pull in the syscall number
definitions, but musl does not do this. Thus, `__NR_riscv_hwprobe`
is undeclared and an error is emitted.

Fix this by including `<asm/unistd.h>`, which makes the macro
visible on musl.
2026-06-14 13:51:25 +00:00
Lynne
03be563053 hwcontext_vulkan: fix BGRA/BGR0 images
The fix was a lot simpler than I thought it was.
2026-06-12 10:14:33 +09:00
Kacper Michajłow
f43f609bb8 avutil/x86/tx_float: add missing vzeroupper to 15xM PFA FFT
The AVX2 15xM PFA FFT calls its second-dimension subtransform with dirty
YMM. That subtransform may be a legacy-SSE codelet (fft4 is SSE2 only),
causing AVX<->SSE transition penalties. Clear them after the first
dimension, before the calls.

Detected with `sde64 -ast` FATE job.

Fixes: ace42cf581
2026-06-09 17:54:21 +00:00
Lynne
12dc67b6fe lavu/frame: add camera raw codec side data
Required to correctly present raw video.
Codec-specific since I'd like to support ARRIRAW in the future, which
has a different format.
2026-06-10 02:38:35 +09:00
Zhao Zhili
1e86a92a1c lavu/aarch64: unroll butterflies_float to 8 floats/iter
butterflies_float_neon:   before           after
  Cortex-A76 (gcc 12.4):  163.1 (3.95x)    147.0 (4.37x)
  Apple M1 (clang 16):      0.7 (0.85x)      0.6 (0.99x)

Signed-off-by: Zhao Zhili <quinkblack@foxmail.com>
2026-06-03 09:36:59 +00:00
Zhao Zhili
1f66f9041b lavu/aarch64: split FMLA chain in scalarproduct_float
Unroll to 16 floats per iteration with four independent accumulators
and reduce them once after the loop.

scalarproduct_float_neon:  before          after
  Apple M1 (clang 16):      0.9 (3.56x)    0.4 (9.18x)
  Cortex-A76 (gcc 12.4):  118.7 (4.43x)   85.3 (6.15x)

Signed-off-by: Zhao Zhili <quinkblack@foxmail.com>
2026-06-03 09:36:59 +00:00
Niklas Haas
9fe5758da5 avutil/hwcontext_vulkan: publicly expose queue device creation flags
These are needed for interop with e.g. libplacebo, which needs to know the
correct flags to call vkGetDeviceQueue2.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-02 13:32:43 +02:00
Lynne
2806afd28f vulkan/ffv1: read raw 16-bit float images via R16_UINT view to preserve denormals
GPUs filter out denormals when reading floats via imageLoad. Denormals shouldn't
be present in general, but if they are, this is a lossless codec, and we have to
preserve them. This allows reading the exact values.

Sponsored-by: Sovereign Tech Fund
2026-05-26 17:47:04 +09:00
marcos ashton
0bdda94ccc tests/fate/libavutil: add FATE test for csp
Test the five public functions not already covered by
tests/color_utils: av_csp_luma_coeffs_from_avcsp,
av_csp_primaries_desc_from_id, av_csp_primaries_id_from_desc,
av_csp_approximate_trc_gamma, and av_csp_approximate_eotf_gamma.
Iterates every AVCOL_SPC, AVCOL_PRI, and AVCOL_TRC value including
the extended ranges, round-trips primaries via desc_eq so the
canonical first-match (e.g. smpte170m for smpte240m) is accepted,
checks that a garbage desc returns AVCOL_PRI_UNSPECIFIED, and that
out-of-range enum values return NULL or 0.0 as documented. The
trc/eotf gamma values come from static lookup tables so the
floating point output is bitexact across platforms.

Coverage for libavutil/csp.c: 88.50% -> 94.46%
2026-05-25 21:18:34 +00:00
marcos ashton
907b738995 tests/fate/libavutil: add FATE test for ambient_viewing_environment
Test av_ambient_viewing_environment_alloc with and without the size
out-parameter, and av_ambient_viewing_environment_create_side_data.
Verifies the {0, 1} rational defaults set by get_defaults(),
write/read-back of the three AVRational fields, frame side data
attachment, and OOM paths via av_max_alloc.

Coverage for libavutil/ambient_viewing_environment.c: 60.00% -> 100.00%
2026-05-25 21:18:34 +00:00
Lynne
dd0ac641a5 vulkan: properly check if the internally synchronized queue extension is supported
libplacebo enables the extension string but does not enable the extension flag
if it's unsupported.
2026-05-22 23:06:38 +09:00
Lynne
5f2877b532 hwcontext_vulkan: enable X2BGR10
The format itself was working perfectly. Unlike BGR0/BGRA, all known
Vulkan implementations support storage images just fine.
2026-05-19 03:22:29 +09:00
Lynne
561e32c9cf hwcontext_vulkan: reenable X2RGB10
Now that all issues are fixed, we can go ahead with it.

Sponsored-by: Sovereign Tech Fund
2026-05-19 03:22:29 +09:00
Lynne
f73acb8618 hwcontext_vulkan: reenable and remap XV30
The issue was that XV30 is a native 444 10-bit format, rather than
16-bits. This resulted in padding leaking into bits where it shouldn't.

Sponsored-by: Sovereign Tech Fund
2026-05-19 03:22:24 +09:00
wangbin
239c679c54 lavc: add ProRes RAW videotoolbox hwaccel 2026-05-17 03:47:23 +00:00
Lynne
0e8cf39541 hwcontext_vulkan: add support for AV_PIX_FMT_RGBAF16 2026-05-17 12:02:51 +09:00
Marvin Scholz
99908c6e05 avutil: add IAMF frame side data types
These contain the same data as the packet side data equivalents.
2026-05-13 15:19:11 +02:00
Marvin Scholz
4851060ccd avutil: hdr_dynamic_metadata: fix error code
When s is NULL in av_dynamic_hdr_smpte2094_app5_from_t35, that's not an
allocation error but just invalid API usage. If there is any allocation
failure beforehand that would lead to this, the caller has to check it,
like is already done in all usages of this function in FFmpeg itself.
2026-05-12 17:18:38 +02:00
Marvin Scholz
37ff8fad47 avutil: hdr_dynamic_metadata: handle allocation failure
Handle allocation failure properly in
av_dynamic_hdr_smpte2094_app5_from_t35.

Fixes Coverity issue #1691448
2026-05-12 17:18:38 +02:00
jiangjie
a67c15dfa5 avutil/hwcontext_vulkan: fix resource leak on alloc_mem failure
Fix by using goto fail so that vulkan_frame_free() properly cleans up
all previously created resources.
2026-05-10 20:01:47 +00:00
Andreas Rheinhardt
5c44245878 avutil/hwcontext_vulkan: Fix shadowing
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-05-05 12:46:26 +02:00
Andreas Rheinhardt
3fbf5faa3f avutil/hwcontext_vulkan: Add av_fallthrough
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-05-05 12:46:23 +02:00
Leo Izen
28e64cad6f avutil/frame.h: re-align dynamic HDR frame data declaration
This is aligned forward by an extra space, because it inheried the
incorrect alignment from the EXIF declaration above it (fixed in the
previous commit).

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2026-05-01 07:40:24 -04:00
Leo Izen
600a8a5a9c avutil/frame.h: fix AV_EXIF_SIDE_DATA declaration
This commit re-aligns the declaration by removing extra whitespace
and fixes the comment above to have the correct acronym. It also
documents what the four magic bytes indicate.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2026-05-01 07:40:18 -04:00
Martin Storsjö
25d703dd2a libavutil/arm: Fix indentation in asm.S 2026-04-29 13:49:27 +03:00
Andreas Rheinhardt
bd1587037f avutil/tests/.gitignore: Add recently added test tools
Reviewed-by: Kacper Michajłow <kasper93@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-04-28 20:08:35 +02:00
marcos ashton
fa3d20072b tests/fate/libavutil: add FATE test for timestamp
Test av_ts_make_string with NOPTS, zero, positive, negative, and
INT64 boundary values, av_ts2str macro, av_ts_make_time_string2
with various timebases, and av_ts_make_time_string pointer
variant.

Coverage for libavutil/timestamp.c: 0.00% -> 100.00%
2026-04-28 16:17:47 +00:00
marcos ashton
9b47495dee tests/fate/libavutil: add FATE test for tdrdi
Test av_tdrdi_alloc with 1 and 3 displays, and the inline
av_tdrdi_get_display accessor. Verifies that the returned
pointer matches entries_offset + idx * entry_size, tests
write/read-back of display width exponent/mantissa and view ID
fields, and OOM paths via av_max_alloc.

Coverage for libavutil/tdrdi.c: 0.00% -> 100.00%
2026-04-28 16:17:47 +00:00
marcos ashton
215799e369 tests/fate/libavutil: add FATE test for hdr_dynamic_vivid_metadata
Test av_dynamic_hdr_vivid_alloc and
av_dynamic_hdr_vivid_create_side_data. Verifies zero defaults,
write/read-back of system_start_code, num_windows, and
color transform params (min/avg/var/max RGB), frame side
data attachment, and OOM paths via av_max_alloc.

Coverage for libavutil/hdr_dynamic_vivid_metadata.c: 0.00% -> 100.00%
2026-04-28 16:17:47 +00:00
marcos ashton
2d9c8a9382 tests/fate/libavutil: add FATE test for buffer
Test av_buffer_alloc, av_buffer_allocz, av_buffer_create with
custom free callback, AV_BUFFER_FLAG_READONLY, av_buffer_ref,
av_buffer_is_writable, av_buffer_get_ref_count,
av_buffer_make_writable, av_buffer_realloc (including from NULL),
av_buffer_replace (including with NULL), av_buffer_pool
init/get/uninit cycle, av_buffer_pool_init2 with custom alloc
and pool_free callbacks, av_buffer_pool_buffer_get_opaque, and
OOM paths via av_max_alloc.

Coverage for libavutil/buffer.c: 0.00% -> 90.19%

Remaining uncovered lines are mutex init failures and
secondary allocation failure paths.
2026-04-28 16:17:47 +00:00
Marvin Scholz
ce740510aa avutil: add fall-through annotations 2026-04-28 12:29:37 +00:00
Marvin Scholz
b50a586583 avutil/avsscanf: add break 2026-04-28 12:29:37 +00:00