Commit Graph

123997 Commits

Author SHA1 Message Date
Niklas Haas
53ce7265ab avfilter/framepool: use strongly typed union of pixel/sample format
Replacing the generic `int format` field. This aids in debugging, as
e.g. gdb will tend to translate the strongly typed enums back into human
readable names automatically.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-04-10 15:12:18 +02:00
Niklas Haas
9034587d10 avfilter/framepool: make ff_sws_frame_pool_{audio,video}_init static
Not used outside of the (strictly more flexible) _reinit() anymore.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-04-10 15:12:18 +02:00
Niklas Haas
39ecc89988 avfilter/framepool: nuke ff_frame_pool_get_*_config
This helper is of dubious utility - it was only used to reinitialize the
frame pools, which is better handled by `ff_frame_pool_reinit()`, and at
present only serves to make extending the API harder.

Users who really need to randomly query the state of the frame pool can
already keep track of the values they set.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-04-10 15:12:18 +02:00
Niklas Haas
a0510f7f72 avfilter/framepool: update frame dimensions on reinit
The previous logic (ported from libavfilter/video.c) would leave the frame
pool intact if the linesize did not change as a result of changing the frame
dimensions. However, this caused ff_default_get_video_buffer2() to return
frames with the old width/height.

I think this bug was avoided in practice because the only filters to actually
support changing the resolution at runtime already always explicitly overrode
the width/height of allocated output buffers by the link properties.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-04-10 15:12:18 +02:00
Niklas Haas
ad7956d5bb avfilter/{audio,video}: switch to ff_frame_pool_*_reinit()
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-04-10 15:12:17 +02:00
Niklas Haas
083a014746 avfilter/framepool: add ff_frame_pool_*_reinit() helpers
This moves the check-uninit-reinit logic out of audio.c/video.c and into
framepool.c, where it can be more conveniently re-used by future users.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-04-10 15:12:17 +02:00
Niklas Haas
143b810e75 avfilter/framepool: remove alloc argument
Not really needed by anything and makes this API a bit clunkier to extend.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-04-10 15:12:17 +02:00
Niklas Haas
82871857eb avfilter/framepool: actually use specified allocator for audio frames
This bug means audio buffers were never correctly zero'd as intended by
libavfilter/audio.c

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-04-10 15:12:17 +02:00
Tymur Boiko
25e187f849 vulkan: fix DRM map, decode barriers, and video frame setup for modifier output
When mapping Vulkan Video frames to DMA-BUF, synchronize using an exportable
binary semaphore and sync_fd where supported. Submit a lightweight exec that
waits on each plane's timeline semaphore at the current value, signals a
SYNC_FD-exportable binary semaphore, then export with vkGetSemaphoreFdKHR.
Store that binary semaphore in AVVkFrameInternal and reuse it across maps
instead of creating and destroying each time: for
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT, copy transference means a
successful vkGetSemaphoreFdKHR unsignals the semaphore like a wait, so it can
be signaled again on the next map submit. If export is unavailable, fall back
to vkWaitSemaphores.

Moved drm_sync_sem destroy to vulkan_free_internal

Export dma-buf fds with GetMemoryFdKHR for each populated f->mem[i], iterating
up to the sw_format plane count instead of stopping at the image count, so
multi-memory bindings are not skipped. Describe DRM layers using
max(sw planes, image count) and query subresource layout with the correct
aspect and image index when one VkImage backs multiple planes. Reference the
source hw_frames_ctx on the mapped frame and close dma-buf fds on failure paths.

For DMA-BUF-capable pools, honor VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT
from format export queries when binding memory. With DRM modifiers and a
video profile in create_pnext, preserve caller usage and image flags instead of
overwriting them from generic supported_usage probing; use the modifier list
create info when probing export flags for modifier tiling.

Include VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR from the output frames
context's usage together with DST (fixes
VUID-VkVideoBeginCodingInfoKHR-slotIndex-07245) instead of adding DPB usage
only when !is_current.

In ff_vk_decode_add_slice, pass VkVideoProfileListInfoKHR (from the output
frames context's create_pnext) as the pNext argument to
ff_vk_get_pooled_buffer instead of the full create_pnext chain. In
ff_vk_frame_params, set tiling to OPTIMAL only when it is not already
DRM_FORMAT_MODIFIER_EXT. In ff_vk_decode_init, when the output pool's
create_pnext includes VkImageDrmFormatModifierListCreateInfoEXT, initialize the
DPB pool with that modifier-list pNext and DRM_FORMAT_MODIFIER_EXT tiling;
otherwise use VkVideoProfileListInfoKHR and OPTIMAL as before. When
VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR is unset, the output
and DPB pools cannot use different layouts or tiling, so the DPB pool must
match the output pool.

Also fix av_hwframe_map ioctl sync_fd export, multi-planar semaphore handling,
and related failure-path cleanup.

Signed-off-by: Tymur Boiko <tboiko@nvidia.com>
2026-04-10 11:39:40 +00:00
James Almer
492e6e68dc doc/APIchanges: fix date and version in the latest entry
Signed-off-by: James Almer <jamrial@gmail.com>
2026-04-09 17:21:28 -03:00
Vignesh Venkat
6ba6db4f19 libavutil: Add functions for SMPTE-2094-50 HDR metadata
SMPTE-2094-50 is an upcoming standard that is close to being
finalized.

Define a side data type for carrying this metadata. And add
functions for parsing and writing it. This is very similar to
the handling of HDR10+ metadata.

The spec is available here: https://github.com/SMPTE/st2094-50

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
2026-04-09 20:01:00 +00:00
Lynne
283faf55f8 Changelog: add v360_vulkan to the changelog 2026-04-09 16:51:30 +02:00
Lynne
d3d0b7a5ee lavfi/v360: add a Vulkan-compute based filter
This just adds a Vulkan compute-based 360-degree video conversion.
It implements a sufficient subset of the most popular 360-degree video formats.

Options such as rotation are dynamic and can be adjusted during runtime.

Some of the work was based on Paul B. Mahol's patch from 2020. There
were spots where the arithmetic conversion was incorrect.
2026-04-09 12:31:24 +02:00
Priyanshu Thapliyal
056562a5ff fate/lavf: add PDV round-trip and seek coverage
Add FATE coverage for PDV encoding and decoding via lavf, including
intra and inter frame cases, skip-nokey decoding, and container-level
seek coverage.

Use -strict experimental in the encode commands because the encoder
is marked experimental.
2026-04-09 03:01:43 +00:00
Priyanshu Thapliyal
4c0d563f85 avformat/pdvenc: add Playdate video muxer
Add a muxer for the Playdate PDV container format.

The muxer writes the frame table and packet layout required by the
Playdate runtime. It requires seekable output and a predeclared
maximum number of frames (-max_frames).

Includes validation for single video stream input, dimension and
framerate checks, and bounded payload/table offset checks. The frame
entry table is allocated once in write_header() using max_frames + 1.

Document the muxer in doc/muxers.texi and add a Changelog entry.
2026-04-09 03:01:43 +00:00
Priyanshu Thapliyal
43e5b26c00 avcodec/pdvenc: add Playdate video encoder
Add a native encoder for the Playdate PDV format.

Supports monob (1-bit) video, producing zlib-compressed intra frames
and XOR-based delta frames.

Includes bounds checking, overflow guards, correct linesize handling
using ptrdiff_t, and proper buffer allocation ordering.

Mark the encoder as experimental by setting AV_CODEC_CAP_EXPERIMENTAL,
since it has not been validated against Panic's official Playdate
player or SDK.
2026-04-09 03:01:43 +00:00
Michael Niedermayer
d0761626cf avcodec/escape130: Initialize old_y_avg
Fixes: use of uninitialized memory

Found-by: Carl Sampson <carl.sampson@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-04-09 01:14:39 +02:00
bird
5c3602abaa avformat/sctp: add size check in sctp_read() matching sctp_write()
Commit 5b98cea4 added a size < 2 guard to sctp_write() to prevent
out-of-bounds access when max_streams is enabled, but the identical
pattern in sctp_read() was not addressed.

When max_streams is non-zero, sctp_read() passes (buf + 2, size - 2)
to ff_sctp_recvmsg(). If size < 2, size - 2 wraps to a large value
on the implicit cast to size_t in the callee.

Add the same guard.

Signed-off-by: bird <6666242+bird@users.noreply.github.com>
2026-04-08 20:52:52 +00:00
David Hampton
db53fe1ac2 avdevice/alsa.c: Conditionally compile out ESTRPIPE
NetBSD doesn't have this error code, so put in a test to prevent
compiling related code on NetBSD systems.
2026-04-08 20:44:16 +00:00
Andreas Rheinhardt
87f74e4f39 avcodec/g726: Remove dead sample rate check
Checked generically since 39206c5e58.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-04-08 21:33:43 +02:00
Andreas Rheinhardt
8463ca8dc9 avcodec/g726: Don't return value from g726_reset()
It always returns zero which none of the callers check,
so just return nothing instead.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-04-08 21:33:40 +02:00
Andreas Rheinhardt
e97f52e557 avcodec/g726: Fix indentation
Forgotten in e344c1ea36.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-04-08 21:33:17 +02:00
Andreas Rheinhardt
12b58b86cc avcodec/x86/rv40dsp: Fix wrong comment
Forgotten in d25b3497f2
and 9abf906800.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-04-08 21:00:04 +02:00
Andreas Rheinhardt
ae5314a6bf avcodec/x86/rv34dsp: Port ff_rv34_idct_add_mmxext to SSSE3
With this commit, the RV30 and RV40 decoders no longer clobber
the fpu state for normal decoding (only error resilience can
still do so).

rv34_idct_add_c:                                        58.1 ( 1.00x)
rv34_idct_add_mmxext:                                   16.5 ( 3.52x)
rv34_idct_add_ssse3:                                    12.2 ( 4.76x)

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-04-08 21:00:00 +02:00
Andreas Rheinhardt
d728f3c808 tests/checkasm/rv34dsp: Add test for rv34_idct_add
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-04-08 20:59:56 +02:00
Andreas Rheinhardt
4c64a8a986 avcodec/rv34: Remove pointless has_ac variable
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-04-08 20:59:52 +02:00
Andreas Rheinhardt
c48f21f778 avcodec/rv34: Use VLC symbol table to avoid LUTs
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-04-08 20:54:21 +02:00
James Almer
4c69c5f156 configure: only warn about spirv-headers if vulkan was explicitly requested
Given it's autodected by default, its checks should not print warnings nor abort the process.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-04-08 12:29:28 -03:00
James Almer
58752ffcdd avfilter/af_whisper: don't set an AVOption accessible field to read only memory
It should also not be set to an av_malloc'd one given it's not an exported option.

Fixes issue #22741.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-04-08 11:52:44 -03:00
Timo Rothenpieler
5c35d0b880 avformat/tls_gnutls: actually send client cert if one is provided
Without setting this flag, apparently gnutls will only send the client
certificate according some logic based on what it thinks the server
accepts.
This is not the case a lot of times.
Just force it to send the client cert the user supplied, if one was
supplied, no matter what.

Fixes #22707
2026-04-08 12:26:29 +00:00
Zhao Zhili
9917308cc2 swscale/vulkan: fix dither buffer leak on mapping failure
A failure while preparing a dither buffer leaves the newly allocated
buffer outside the cleanup range, leaking Vulkan resources. Make the
failure path cover the current buffer as well.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2026-04-07 17:53:14 +00:00
Niklas Haas
cd1126a3cd swscale/ops: add assertion that comps_src is sane
This assertion guards against bugs like that fixed in the previous
commit.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-04-07 15:10:04 +00:00
Niklas Haas
420019a313 swscale/ops_optimizer: properly swizzle comps_src when splitting
Fixes a pre-existing latent bug in the subpass splitting, that was
made worse / exposed by 048ca3b367.

Fixes: cba54e9e3b
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-04-07 15:10:04 +00:00
nyanmisaka
dcbfa11c96 avcodec/amfenc: remove the AMF_VIDEO_ENCODER_AV1_CAP_{WIDTH,HEIGHT}_ALIGNMENT_FACTOR_LOCAL
These have been defined in AMF 1.4.35+ but we are on 1.5.0.

Signed-off-by: nyanmisaka <nst799610810@gmail.com>
2026-04-07 14:54:21 +00:00
nyanmisaka
113c1c0624 avcodec/amfenc: let the HEVC encoder profile follow the target bit depth
Previously, you could even set the Main profile for the P010 input and 10-bit output.

Signed-off-by: nyanmisaka <nst799610810@gmail.com>
2026-04-07 14:54:21 +00:00
nyanmisaka
2f592f0699 avcodec/amfenc: use pixel desc to determine YUV and bit depth
Therefore, YUV420P and X2BGR10 are now being taken into consideration.

Signed-off-by: nyanmisaka <nst799610810@gmail.com>
2026-04-07 14:54:21 +00:00
nyanmisaka
0acc73b7fb avcodec/amfenc: support full range in AV1 and update deprecated AMF range flags for H264/HEVC
Furthermore, the flags for H264/HEVC have been updated to those renamed in AMF 1.5.0+,
instead of using the old ones that were already marked as deprecated:

AMF_VIDEO_ENCODER_FULL_RANGE_COLOR -> AMF_VIDEO_ENCODER_OUTPUT_FULL_RANGE_COLOR
AMF_VIDEO_ENCODER_HEVC_NOMINAL_RANGE -> AMF_VIDEO_ENCODER_HEVC_OUTPUT_FULL_RANGE_COLOR

The macro content remains the same, therefore it will not cause regressions.

Signed-off-by: nyanmisaka <nst799610810@gmail.com>
2026-04-07 14:54:21 +00:00
James Almer
e7696357de avformat/dashdec: export LCEVC Stream Groups when the manifest reports the relevant dependency
Signed-off-by: James Almer <jamrial@gmail.com>
2026-04-07 10:04:55 -03:00
Jack Lau
0510aff11b avformat/hlsenc: fix compile error when mp4 is disabled
Regression since dc4c798970

Handle the case where mp4 is disabled since mp4 as
an optional dependency of hls_muxer.

Signed-off-by: Jack Lau <jacklau1222gm@gmail.com>
2026-04-07 02:20:34 +00:00
Ruikai Peng
e90c2ff4b5 avcodec/libdav1d: fix heap overflow in US ITU-T T.35 metadata parsing
The US country_code path in parse_itut_t35_metadata() reads the
the provider_code with bytestream2_get_be16u(), which is a
unchecked version that does not validate the remaining
length before reading. When an AV1 stream contains ITU-T T.35
metadata with country_code set to 0xB5 (which is US) and a
payload shorter than 2 bytes, this results in a heap overflow
reading 2 bytes past the allocation.

The UK country code already guards against this issue by
checking it before the unchecked read. We're using the same
pattern to the US country code path.

Pwno crafted an AV1 IVF with a metadata OBU containing ITU-T T.35
with country_code=0xB5 and a 1-byte payload. Decoding with libdav1d
triggers the overflow. ASan says:

ERROR: AddressSanitizer: heap-buffer-overflow
READ of size 2 at 0x5020000003f0 thread T0
  #0 bytestream_get_be16 src/libavcodec/bytestream.h:98
  #1 bytestream2_get_be16u src/libavcodec/bytestream.h:98
  #2 parse_itut_t35_metadata src/libavcodec/libdav1d.c:376

0x5020000003f1 is located 0 bytes after 1-byte region

Found-by: Pwno
2026-04-06 23:39:40 +00:00
James Almer
757cc97790 avcodec/lcevcdec: support differing base and enhancement bitdepths
Signed-off-by: James Almer <jamrial@gmail.com>
2026-04-06 14:07:59 -03:00
James Almer
3a2eae155d avcodec/lcevcdec: add 14bit pixel formats
Signed-off-by: James Almer <jamrial@gmail.com>
2026-04-06 14:07:59 -03:00
James Almer
01b0b86225 avcodec/lcevc_parser: move pixel format table to a shared file
Signed-off-by: James Almer <jamrial@gmail.com>
2026-04-06 14:07:59 -03:00
Patrice Dumas
589da160b2 configure: add makeinfo option
Rename makeinfo enabled variable to makeinfo_command. Do not put
makeinfo_command in HAVE_LIST, it is not used.
2026-04-06 15:07:17 +00:00
Andreas Rheinhardt
7fd2be97b9 avcodec/x86/h264_chromamc: Avoid mmx in chroma_mc8_ssse3 functions
No impact on performance here.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-04-06 11:28:49 +02:00
Andreas Rheinhardt
0c4c9c66bd avfilter/x86/vf_atadenoise: Don't load args unnecessarily
These args will be read directly from the stack into xmm register,
so loading them into GPRs is unnecessary.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-04-06 11:28:49 +02:00
Andreas Rheinhardt
e1297f3080 avcodec/x86/h264_idct: Use tmp reg in SUMSUB_BA if possible
It allows to exchange a paddw by a movdqa.

Old benchmarks:
idct8_add4_8bpp_c:                                     664.6 ( 1.00x)
idct8_add4_8bpp_sse2:                                  142.2 ( 4.67x)
idct8_add_8bpp_c:                                      215.5 ( 1.00x)
idct8_add_8bpp_sse2:                                    35.1 ( 6.14x)

New benchmarks:
idct8_add4_8bpp_c:                                     666.9 ( 1.00x)
idct8_add4_8bpp_sse2:                                  135.3 ( 4.93x)
idct8_add_8bpp_c:                                      217.7 ( 1.00x)
idct8_add_8bpp_sse2:                                    34.0 ( 6.41x)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-04-06 11:28:49 +02:00
Andreas Rheinhardt
ed116bab02 avcodec/x86/me_cmp: Use tmp reg in SUMSUB_BA if possible
It allows to exchange a paddw by a movdqa.

Old benchmarks:
hadamard8_diff_0_c:                                    366.1 ( 1.00x)
hadamard8_diff_0_sse2:                                  56.4 ( 6.49x)
hadamard8_diff_0_ssse3:                                 53.0 ( 6.90x)
hadamard8_diff_1_c:                                    183.0 ( 1.00x)
hadamard8_diff_1_sse2:                                  28.0 ( 6.53x)
hadamard8_diff_1_ssse3:                                 26.0 ( 7.03x)

New benchmarks:
hadamard8_diff_0_c:                                    371.4 ( 1.00x)
hadamard8_diff_0_sse2:                                  55.0 ( 6.76x)
hadamard8_diff_0_ssse3:                                 49.5 ( 7.50x)
hadamard8_diff_1_c:                                    183.4 ( 1.00x)
hadamard8_diff_1_sse2:                                  26.8 ( 6.85x)
hadamard8_diff_1_ssse3:                                 23.1 ( 7.92x)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-04-06 11:28:49 +02:00
Andreas Rheinhardt
da59f288c6 avcodec/hevc/dsp_template: Add restrict to add_residual functions
Allows the compiler to optimize the the aliasing checks away
and saves 5376B here (GCC 15, -O3).
Also, avoid converting the stride to uint16_t for >8bpp:
stride /= sizeof(pixel) will use an unsigned division
(i.e. a logical right shift)*, which is not what is intended here.

*: If size_t is the corresponding unsigned type to ptrdiff_t

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-04-06 11:28:49 +02:00
Andreas Rheinhardt
72058ccdf8 tests/checkasm/sw_scale: Don't use declare_func_emms in yuv2nv12cX check
There are no implementations of yuv2nv12cX clobbering the fpu state,
so make the test stricter to ensure that it stays that way.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-04-06 11:28:49 +02:00