Commit Graph

6767 Commits

Author SHA1 Message Date
James Almer
799c133273 avutil/tests/aes_ctr: extend the test to cover payloads smaller than a block
Signed-off-by: James Almer <jamrial@gmail.com>
2025-09-11 18:32:24 -03:00
James Almer
335ba4a649 avutil/aes_ctr: reintroduce the block offset state
Wrongly removed in fe73b84879, it's required for
calls with a payload smaller than a full block.

Fixes issue #20474.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-09-11 18:32:23 -03:00
Dmitrii Ovchinnikov
1b97966199 avutil/hwcontext_d3d12va: added resource and heap flags to DeviceContext 2025-09-08 15:44:47 +00:00
Alan Kelly
f4b044bbe3 swscale: Disable avx2 hscale 8to15 on IceLake and below due to Intel Gather Data Sampling mitigation performance loss
Intel provided a microcode update to mitigate this security
    vulnerability which has a huge negative performance impact on gather
    instructions. This means that hscale 8to15 avx2, which uses gather
    extensively, is no longer faster than SSSE3 on impacted CPUs.

    https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/technical-documentation/gather-data-sampling.html

    Broadwell:
    hscale_8_to_15__fs_4_dstW_512_c:                      3379.5 ( 1.00x)
    hscale_8_to_15__fs_4_dstW_512_sse2:                    615.7 ( 5.49x)
    hscale_8_to_15__fs_4_dstW_512_ssse3:                   613.4 ( 5.51x)
    hscale_8_to_15__fs_4_dstW_512_avx2:                    495.7 ( 6.82x)

    Skylake:
    hscale_8_to_15__fs_4_dstW_512_c:                      3411.4 ( 1.00x)
    hscale_8_to_15__fs_4_dstW_512_sse2:                    591.0 ( 5.77x)
    hscale_8_to_15__fs_4_dstW_512_ssse3:                   591.5 ( 5.77x)
    hscale_8_to_15__fs_4_dstW_512_avx2:                   1386.2 ( 2.46x)

    Cascade Lake:
    hscale_8_to_15__fs_4_dstW_512_c:                      3231.3 ( 1.00x)
    hscale_8_to_15__fs_4_dstW_512_sse2:                    517.9 ( 6.24x)
    hscale_8_to_15__fs_4_dstW_512_ssse3:                   521.6 ( 6.19x)
    hscale_8_to_15__fs_4_dstW_512_avx2:                   1775.0 ( 1.82x)

    Sapphire Rapids:
    hscale_8_to_15__fs_4_dstW_512_c:                      1840.0 ( 1.00x)
    hscale_8_to_15__fs_4_dstW_512_sse2:                    287.9 ( 6.39x)
    hscale_8_to_15__fs_4_dstW_512_ssse3:                   293.8 ( 6.26x)
    hscale_8_to_15__fs_4_dstW_512_avx2:                    219.2 ( 8.40x)
2025-09-06 20:57:48 +00:00
Cameron Gutman
37f02603b1 avutil/hwcontext_drm: fix mapping when dst format is unset
av_hwframe_map() is documented to work with a blank dst frame, but
hwcontext_drm currently fails if dst->format == AV_PIX_FMT_NONE.

Signed-off-by: Cameron Gutman <aicommander@gmail.com>
2025-09-03 20:21:51 -05:00
Wu Jianhua
858aa6176b avutil/version: bump minor after recent change
See c2ce387385

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-09-03 22:34:40 +00:00
Araz Iusubov
c2ce387385 avcodec/d3d12va_encode: texture array support for HEVC
This patch adds support for the texture array feature
used by AMD boards in the D3D12 HEVC encoder.
In texture array mode, a single texture array is shared for all
reference and reconstructed pictures using different subresources.
The implementation ensures compatibility
and has been successfully tested on AMD, Intel, and NVIDIA GPUs.
2025-09-03 11:56:06 +02:00
Niklas Haas
22929bd044 avutil/frame: add AVFrame.alpha_mode
FFmpeg currently handles alpha in a quasi-arbitrary way. Some filters/codecs
assume alpha is premultiplied, others assume it is independent. If there is
to be any hope for order in this chaos, we need to start by defining an enum
for the possible range of values.
2025-09-02 17:05:50 +02:00
Marton Balint
2296a9c1bc avutil/bprint: fix av_bprint_strftime with %p format string reporting truncated output
strftime returns 0 in case of an empty output (e.g. %p format string with some
locales), there is no way to distinguish this from a buffer-too-small error
condition. So we must use some heuristics to handle this case, and not consume
INT_MAX RAM and falsely report a truncated output.

Signed-off-by: Marton Balint <cus@passwd.hu>
2025-08-31 09:37:59 +02:00
Marton Balint
50e94aadb2 avutil/bprint: make av_bprintf use av_vbprintf
No reason to duplicate the code.

Signed-off-by: Marton Balint <cus@passwd.hu>
2025-08-31 09:37:59 +02:00
Marton Balint
7a774829f9 avutil/opt: also print option names on parse error
It is more user-friendly to print which option caused the parse error.

Signed-off-by: Marton Balint <cus@passwd.hu>
2025-08-30 18:46:15 +00:00
Levi Zim
c2d17c4db8 avutil/riscv: avoid redefinition of _GNU_SOURCE
Add #ifndef to avoid potential redefinition of _GNU_SOURCE macro.

Signed-off-by: Levi Zim <rsworktech@outlook.com>
2025-08-26 15:08:52 +00:00
Niklas Haas
67c15cf541 avutil/hwcontext_vulkan: add debug option to avoid host ptr imports
In some environments, these are prohibitively slow. Add a debug option
to prefer memcpy instead of importing host pointers.
2025-08-20 15:05:41 +00:00
Niklas Haas
a7efcbd0e3 avutil/hwcontext_vulkan: check driver ID instead of hard-coded vendor check 2025-08-20 15:05:41 +00:00
Niklas Haas
78beb4f5f4 avutil/hwcontext_vulkan: don't re-query driver props in qf setup
This is already queried when the device is selected, so there's no need
to re-query the exact same struct.
2025-08-20 15:05:41 +00:00
Niklas Haas
881224b213 avutil/hwcontext_vulkan: also re-query dprops in device_init()
This can be unset if using an externally provided device, as in this case
device_create() never gets called.
2025-08-20 15:05:41 +00:00
Leo Izen
bb90b262d6 avutil/side_data: add EXIF side data type
This commit adds support for the additional side data type
AV_FRAME_DATA_EXIF, which contains a buffer of an EXIF metadata
payload.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2025-08-19 11:26:46 -04:00
vytskalt
a6b5a382dd hwcontext_vulkan: transfer EXCLUSIVE images to correct queue families 2025-08-19 14:34:17 +00:00
Levi Zim
163518ffab avutil/riscv: add fallthrough comment to switch
This fixes the following warning:

libavutil/riscv/cpu.c:85:9: warning: label at end of compound statement is a C23 extension [-Wc23-extensions]

Signed-off-by: Levi Zim <rsworktech@outlook.com>
2025-08-19 11:29:18 +08:00
Kacper Michajłow
1f4fed5cc3 w32pthreads: add support for setting thread name
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-08-15 19:54:01 +00:00
Kacper Michajłow
47c6af7d29 avutil/avassert: always implement av_assume with av_unreachable
One of the design goals of this macro is the ability to support static
inline predicate functions. Which is emitting warning in clang that a
function may have side-effects and the condition will be ignored. MSVC
doesn't emit warning, but also ignore predicate in such cases.

Instead of using assume builtins, implement it using unreachable. Which
solves this case for MSVC and Clang.

This reverts ea56fe60ac, but also extends
it to MSVC, which is affected in the similar way.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-08-14 19:42:13 +00:00
Kacper Michajłow
01cfb01c9c avutil/tests/pca: comment out unused code
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-08-11 19:29:53 +00:00
nyanmisaka
49f4ef9e79 lavu/log: fix color for AV_CLASS_CATEGORY_HWDEVICE on non-Win32
AV_CLASS_CATEGORY_HWDEVICE was introduced in the past but
no corresponding colors were added for non-Win32 platforms.

Fixes bf1579c ("avutil/log,hwcontext: Add AV_CLASS_CATEGORY_HWDEVICE")

Signed-off-by: nyanmisaka <nst799610810@gmail.com>
2025-08-10 02:24:56 +00:00
Mark Thompson
19473362fc hwcontext_vulkan: Fix build 2025-08-09 22:46:08 +00:00
Mark Thompson
4a42e5a1e2 hwcontext_vulkan: Fix build with older Vulkan headers 2025-08-09 22:46:08 +00:00
Michael Niedermayer
638b521c7b Bump versions for master after release/8.0
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-08-09 18:03:05 +02:00
Michael Niedermayer
7eaa0f799a Bump versions for release/8.0
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-08-09 17:30:39 +02:00
James Almer
1cde49ed82 avutil/hwcontext_vulkan: use uint64_t specifier in an av_log() call
Signed-off-by: James Almer <jamrial@gmail.com>
2025-08-08 15:24:57 +00:00
nyanmisaka
523134587a lavu/hwcontext_vaapi: drop a redundant check
vaapi_get_image_format() will be called in vaapi_map_frame().

So it's a double check, drop it to avoid redundancy.

Signed-off-by: nyanmisaka <nst799610810@gmail.com>
2025-08-08 12:53:39 +00:00
nyanmisaka
eb9070aba4 lavu/hwcontext_vaapi: fix a race mapping to allow CSC to YUV420P
There's a race condition for YUV420P when mapping from pix_fmt
to VA fourcc, both I420 and YV12 could be found by pix_fmt.

Currently, vaapi_get_image_format() iterates over the query results
of pix_fmt and returns the first matching result in the order
declared in the driver. This may result in an incorrect image_format.

Now use fourcc to find the image_format.

Fixes:
ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -i INPUT \
-vf scale_vaapi=format=yuv420p,hwmap,format=yuv420p \
-vframes 1 -f rawvideo -y yuv420p.yuv

Signed-off-by: nyanmisaka <nst799610810@gmail.com>
2025-08-08 12:53:39 +00:00
Lynne
b2928971e8 lavc: add an av1_vulkan encoder
This commit adds a Vulkan AV1 encoder, using the native acceleration API.
2025-08-08 18:29:40 +09:00
Lynne
2caf23e7c4 vp9: add Vulkan VP9 hwaccel 2025-08-08 18:29:40 +09:00
Lynne
1f72bf5ec8 vulkan: add support for 16-bit RGGB Bayer pixfmt 2025-08-08 01:06:11 +09:00
Kacper Michajłow
ea56fe60ac avutil/avassert: use __builtin_assume if available
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-08-07 13:13:40 +00:00
Kacper Michajłow
56e0a883c1 avutil/tx: zero whole array, not only one element
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-08-07 07:36:33 +00:00
Russell Greene
e0440eb392 hwcontext_vulkan: fix exporting multi-plane DRM modifiers
Previously, it was assumed that `drmFormatModifierPlaneCount` was one
for all modifiers when exporting, which is not always the case, in
particular for AMD GPUs and maybe others.

Fetch the number of memory planes and fill the structs appropriately in this situation.

The encoded stream is still bad in the case whre modifers are involved,
but I think this patch still stands on its own and I suspect that may be a driver bug.

A potential improvement that could be make is to cache the format
information, so we can avoid the two GetPhysicalDeviceFormatProperties2
calls for each export, as well as the allocation. I doubt this is very
expensive, but seemed worth noting.

v2 changes: query the format properties with the test image created in
`vulkan_frames_init` to avoid allocating space for the query during
export

Signed-off-by: Russell Greene <russellgreene8@gmail.com>
2025-08-05 23:53:58 +09:00
Lynne
50756b88d5 hwcontext_vulkan: enable uniformBufferStandardLayout 2025-08-05 23:51:21 +09:00
Lynne
53826f1815 hwcontext_vulkan: temporarily disable host_image_copy
NVIDIA's support for it is a disaster.
Of no benefit to other vendors.

NVIDIA are working on fixing it, but it may take time.
2025-08-05 23:51:21 +09:00
Timo Rothenpieler
262d41c804 all: fix typos found by codespell 2025-08-03 13:48:47 +02:00
Timo Rothenpieler
8d439b2483 all: fix whitespace/new-line issues 2025-08-03 13:48:47 +02:00
Kacper Michajłow
ff52147f59 avutil/hwcontext_qsv: fix format specifier for HRESULT
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-08-02 22:25:28 +00:00
vytskalt
2e19e74a29 hwcontext_vulkan: transfer exclusive images to correct queue family in drm->vulkan mapping 2025-08-02 11:02:59 +03:00
Dash Santosh
96821211c2 avfilter: add scale_d3d11 filter
This commit introduces a new hardware-accelerated video filter, scale_d3d11,
which performs scaling and format conversion using Direct3D 11. The filter enables
efficient GPU-based scaling and pixel format conversion (p010 to nv12), reducing
CPU overhead and latency in video pipelines.
2025-07-31 21:07:51 +00:00
Vittorio Giovara
119d127d05 lavu/spherical: Add support for Spherical Immersive type 2025-07-31 10:58:36 +02:00
Araz Iusubov
cd33219558 avutil/hwcontext_amf: add device cache size
This change improves pipeline stability and reduces
dynamic GPU surface allocations when using AMF with copy_frame = 1.
This optimization has no negative effect.
2025-07-29 23:38:08 +02:00
Kacper Michajłow
ce04877f1f avutil/hmac: avoid calling functions through pointer of invalid type
Add type removed function wrappers to resolve UB of calling function
through pointer to incorrect function type.

Fixes: FATE-{hmac,srtp}
Fixes: call to function av_md5_init through pointer to incorrect
       function type 'void (*)(void *)' and similar for others.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-07-22 19:56:34 +02:00
Kacper Michajłow
6f88b90f6c avutil/avstring: shrink allocation from av_get_token to fit token
av_get_token() allocates an output buffer with the same size as the
input. Generally, this is harmless, but when the input string is large
and consists of many small tokens, calling av_get_token() repeatedly to
extract all tokens will significantly amplify memory allocations.

To fix this, after obtaining the return value, simply realloc the buffer
to the actual size needed for output string.

Fixes OOM when parsing filter graph string.
Fixes OSS-Fuzz: 394983446

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-07-22 19:56:34 +02:00
James Almer
c6c8063186 avutil/xga_font_data: add getters to access the shared arrays
And stop exposing the arrays on the next major bump.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-07-22 09:47:18 -03:00
Jacob Lifshay
157d3b007e lavu: add av_scanf_format() and use it on av_sscanf()
Signed-off-by: Jacob Lifshay <programmerjake@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-07-22 01:35:01 +02:00
Zhao Zhili
fbda5ffb95 avutil/hwcontext: Add ohcodec device and pixel format
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-07-18 14:44:39 +08:00