1
0
mirror of https://git.ffmpeg.org/ffmpeg.git synced 2026-10-24 02:09:03 +03:00
Commit Graph

6932 Commits

Author SHA1 Message Date
marcos ashton
270c44b229 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>
(cherry picked from commit 2985d42978)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:26:46 +02:00
Kirill A. Korinsky
93d57157ed 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
(cherry picked from commit b57ff00bcf)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-09-19 14:26:46 +02:00
nyanmisaka
ce3c09c101 avutil/hwcontext_cuda: fix yuv420p V/U plane overlap in cuda_get_buffer()
Odd-height yuv420p result in incorrect calculations of the U-plane
address offset. The last row of the V-plane overlapped with and was
overwritten by the first row of the U-plane, leading to chroma artifacts.

```
ffmpeg -init_hw_device cuda=cu -filter_hw_device cu -f lavfi -i \
testsrc=s=1920x1081,format=yuv420p -vf hwupload -c:v hevc_nvenc \
-vframes 1 -y <OUTPUT>
```

Signed-off-by: nyanmisaka <nst799610810@gmail.com>
(cherry picked from commit 3f6bf150cb)
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2026-06-29 17:41:14 +02:00
Michael Niedermayer
38b88335f9 Bump for 8.1.2
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-17 04:33:35 +02:00
Bogdan Lisman
213b6561ba 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>
(cherry picked from commit 3d1d546f70)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-15 23:57:24 +02:00
Michael Niedermayer
239f2c733d Bump micro for 8.1.1
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-05-04 00:07:35 +02:00
Michael Niedermayer
ea84befff6 avutil/samplefmt: Dont claim that av_get_sample_fmt_string checks sample_fmt
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit b11729f154)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-05-03 19:24:51 +02:00
marcos ashton
ff47e29b10 avutil/bswap: fix implicit conversion warning in av_bswap64
Explicitly cast uint64_t arguments to uint32_t before passing them
to av_bswap32(). The truncation is intentional (extracting low and
high halves), but clang on macOS 26 warns about it.

Fixes: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/22453
Signed-off-by: marcos ashton <marcosashiglesias@gmail.com>
(cherry picked from commit dfa53aae5f)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-05-03 19:24:48 +02:00
Martin Storsjö
3ec48e4bc6 aarch64: Add Armv9.3-A GCS (Guarded Control Stack) support
Signal that our assembly is compliant with the GCS feature, if
the GCS feature is enabled in the compiler (available since Clang
18 and GCC 15) - this is enabled by -mbranch-protection=standard
with a new enough compiler.

GCS doesn't require any specific modifications to the assembly
code, but requires that all functions return to the expected call
address (checked through a shadow stack).

(cherry picked from commit 846746be4b)
2026-03-20 13:12:08 +02:00
Marvin Scholz
9047fa1b08 avutil: attributes: fix AV_HAS_STD_ATTRIBUTE checks
Attributes with the language-supported [[attr]] style are only supported
since C++11 and C23 respectively, so this needs to be accounted for in
these checks.

This solves a huge amount of warning spam of:
  warning: [[]] attributes are a C23 extension [-Wc23-extensions]
when using --enable-extra-warnings.

(cherry picked from commit cce545a74b)
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2026-03-16 18:46:24 +01:00
Michael Niedermayer
56217dccd6 avutil/timecode: Check for integer overflow in av_timecode_init_from_components()
Fixes: integer overflow
Fixes: testcase that calls av_timecode_init_from_components() with hh set explicitly to INT_MAX

Found-by: Youngjae Choi, Mingyoung Ban, Seunghoon Woo
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit eb5d607861)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-03-15 00:49:56 +01:00
Lynne
c9a5f7c6ca hwcontext_vulkan: deprecate AVVulkanDeviceContext.lock/unlock_queue
Without replacement, as VK_KHR_internally_synchronized_queues will be required.

(cherry picked from commit c102e89448)
2026-03-14 18:54:46 +01:00
Michael Niedermayer
67c886222f Bump versions for release/8.1
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-03-08 02:29:20 +01:00
Ramiro Polla
252ab61726 avutil/frame: fix typos 2026-03-07 00:54:49 +00:00
Andreas Rheinhardt
5d3ad4f06e avutil/error: Fix overflow when negating
-INT_MIN is not representable in an int.
Fixes issue #22388.

Reviewed-by: Sean McGovern <gseanmcg@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-06 17:28:00 +01:00
Alexandru Ardelean
3291afd30f libavutil: hwcontext_amf: remove unreachable statements
Inside the amf_device_derive() function, there seem to be some
unreachable 'break' statements, which can be removed.
And also the final 'return 0' statement will also be unreachable
especially since there is a default case in the switch block.

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
2026-03-05 15:42:00 +00:00
Georgii Zagoruiko
0edd75e150 aarch64/asm.S: to support SME added macro to save/restore registers d8-d16 2026-03-04 23:52:58 +02:00
Georgii Zagoruiko
905348df9d configure: add detection of SME-I16I64 extension 2026-03-04 23:52:57 +02:00
Georgii Zagoruiko
70691bbb27 configure: add detection of assembler support for SME2 2026-03-04 23:52:36 +02:00
Martin Storsjö
a0d23706e8 aarch64: Switch to a more correct Windows flag for detecting I8MM
Newer revisions of WinSDK 10.0.26100.0 have exposed more flags for
IsProcessorFeaturePresent; now there is a separate one for
detecting specifically I8MM and not just SVE-I8MM. Switch to using
this flag instead.
2026-03-04 21:46:18 +00:00
Shreesh Adiga
22d484f498 avutil/cpu: add static CPU feature flag for AArch64 CRC32 2026-03-03 21:38:00 +00:00
Michael Niedermayer
5554d9d555 avutil/eval: Store *prng_state / var only in root AVExpr
AFter this, depth and the root element flag is stored in space
needed for alignment and thus does not increase the AVExpr size

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-03-03 03:28:37 +01:00
Michael Niedermayer
1528ccb6a1 avutil/eval: use anonymous union
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-03-03 03:28:37 +01:00
Michael Niedermayer
ed5040e6f5 avutil/eval: Check depth of AVExpr
we already check the depth of the parser but the AVExpr tree differs

Fixes: stack exhaustion
Fixes: YWH-PGM40646-39

Found-by: jpraveenrao
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-03-03 03:28:37 +01:00
Andreas Rheinhardt
ac46514327 avutil/emms: Add ff_assert[01]_fpu()
These will be used to mark and check parts of the code
where the floating point state is supposed to be not
clobbered. They are an improvement on the (deprecated)
av_assert0_fpu() because of proper file and line number
information; they also reset the floating point state
if the assert is actually triggered.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-02 11:55:30 +01:00
Lynne
d80d5b4ee7 vulkan_spirv: reduce shader print level from TRACE to DEBUG
The issue was that FFv1 concat'd a lot of separate files, each with
a license header, inflating the total shader size to over 3000 lines.

As all codec shaders were rewritten for compile-time SPIR-V, this became
unnencessarily restrictive.

Sponsored-by: Sovereign Tech Fund
2026-02-26 14:10:21 +01:00
Lynne
0c34fcf0a8 vulkan: constify FFVulkanShader arg in ff_vk_exec_bind_shader
Sponsored-by: Sovereign Tech Fund
2026-02-26 14:10:21 +01:00
Lynne
6c5dc2011b vulkan: reset exec context when uninitializing
Sponsored-by: Sovereign Tech Fund
2026-02-26 14:10:19 +01:00
Andreas Rheinhardt
0b77f79191 avutil/attributes_internal: Add attribute_nonstring
This attribute is used to signal to the compiler
that an array object initialized via a string literal
is not a real string and may lack the space for
the trailing zero, as in char fourcc[4]="FOUR".

This is in preparation for enabling
the -Wunterminated-string-initialization warning.

Reviewed-by: J. Dekker <jdek@itanimul.li>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-02-20 11:59:37 +01:00
Andreas Rheinhardt
acde43703f avutil/error: Remove size from error_stringtable
This stringtable is a concatenation of strings, with their
own trailing \0. Without an explicit size said stringtable
ends with two \0 (one from the last string and one more
because it is initialized via a string literal); the explicit
size exists to discard the last \0.

Yet this makes GCC (but not Clang) think that this is an
unterminated string, leading to warnings when
-Wunterminated-string-initialization is enabled.
So just remove the explicit size to avoid this.

(An alternative would be to mark this as a non-string
for GCC, but not for Clang, but this has been deemed ugly;
another alternative would be to omit the internal \0 from
the stringtable and use length fields instead, but
the necessary copying code more than outweighs the size benefits
of omitting the \0.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-02-20 11:59:37 +01:00
Lynne
4b6396a49b ffv1enc_vulkan: allocate all results memory upfront
Suballocation is the Vulkan way.
2026-02-19 19:42:34 +01:00
Lynne
3ba81f2af4 vulkan: drop support for descriptor buffers
Descriptor buffers were a neat attempt at organizing descriptors.
Simple, robust, reliable.

Unfortunately, driver support never caught on, and neither did validation
layer support.

Now they're being replaced by descriptor heaps, which promises to be
the future. We'll see how it goes.
2026-02-19 19:42:31 +01:00
Lynne
61ca28d6e0 hwcontext_vulkan: correctly set stride for host image uploads
Cursed.
2026-02-19 19:42:27 +01:00
Lynne
6452e0c56e hwcontext_vulkan: drop debug=3 (profile)
The mode is useless with pregenerated SPIR-V.
2026-02-19 19:42:27 +01:00
Lynne
6f749ec0a7 hwcontext_vulkan: zero-pad optional_instance_exts
The layer settings extension was enabled since the list was blank,
and some compilers complained about that, and it should have been
always supported on all platforms everywhere.

Unfortunately, some platforms LIE, claim they support it and yet
they error out that the extension is missing.

Juse zero pad the array.
2026-02-19 19:42:27 +01:00
Lynne
ee1d5da27f hwcontext_vulkan: enable VK_KHR_shader_relaxed_extended_instruction by default
We compile our shaders with debug information by default.
2026-02-19 19:42:26 +01:00
Lynne
eadfbc109d hwcontext_vulkan: disable shader object when debugging 2026-02-19 19:42:26 +01:00
Tim Blechmann
2799aaa5af avutil: hwcontext_videotoolbox: support YUYV422 pixel format 2026-02-19 16:52:58 +00:00
lompik
38cd91c99a hwdec/vulkan: fix invalid number of planes usage in map_to_drm
This fixes a SIGSEGV happening (for >1 plane images) in drivers as we
are sending a null semaphore for them to wait on.
2026-02-18 13:48:04 +04:00
Andreas Rheinhardt
66766bb1c7 avutil/avassert: Deprecate av_assert0_fpu()
Said function has presumably been added in order to check
that we have successfully reset the floating point state
after having violated the ABI/calling convention by not
issuing emms in our MMX DSP routines.

Yet the ability to check this should not have been made public,
because there is no external need for it and because the
function does not even always achieve what its documentation
claims to do: It only works when inline assembly is available.
It should have been implemented in emms.h like emms_c()
(which is where a replacement should be put if there is still
ABI-violating MMX code when av_assert0_fpu() is removed).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-02-13 09:21:02 +01:00
Andreas Rheinhardt
fb8a12db17 avutil/opt: Improve type-safety
In particular, make this code -fshort-enums compatible.
The branch can be optimized away by compilers when
sizeof(enum AVPixelFormat) == sizeof(enum AVSampleFormat).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-02-10 19:44:46 +01:00
James Almer
706d4e4736 avutil/iamf: stop setting parameter definition block defaults
It was done for the sake of having subblock_duration not be zero as the spec
forbids that value, but harcoding it to any arbitrary value is no better
considering the user is meant to fill the entire structure.

This helps speeding up the function when trying to allocate a struct with a
huge amount of blocks.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-02-08 21:58:06 -03:00
Brad Smith
c352a9ab02 avutil/cpu: add CPU feature detection for AArch64 CRC32 on OpenBSD
Signed-off-by: Brad Smith <brad@comstyle.com>
2026-02-06 14:24:01 -05:00
Michael Niedermayer
d1a43f1486 avutil/dovi_meta: Document valid range for index of av_dovi_get_ext()
Every use case in libavcodec already checks the index

Found-by: 이동준 <ldj6192@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-02-04 15:25:18 +00:00
Dmitrii Ovchinnikov
714152dd9a avutil/hwcontext_d3d11va: added resource and heap flags to DeviceContext 2026-01-26 10:39:10 +00:00
Lynne
e2f9861036 hwcontext_vulkan: fix stride for host image copy uploads
Can this cursed extension ever bloody ever even work!?!
2026-01-21 21:21:32 +01:00
Dmitrii Ovchinnikov
6972b127de avfilter: Add vsrc_amf - AMF based screen capture
This patch adds screen capture support via AMF vsrc_amf:
ffmpeg -y \
    -filter_complex "vsrc_amf=framerate=120:capture_mode=keep_framerate" \
    -c:v hevc_amf \
    -frames:v 300 \
    output_grab.mp4

If the HW frames pool is insufficient,
increase extra_hw_frames in filter_complex.
2026-01-19 10:16:37 +00:00
AnandajithS
ed085692d9 doc: fix typos
Fix trivial grammatical errors.

Signed-off-by: AnandajithS <anandajiths2006@gmail.com>
2026-01-18 03:33:04 +00:00
Zhao Zhili
e8daa03fee arm/timer: disable PMCCNTR timer for Android
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2026-01-15 16:06:13 +00:00
Zhao Zhili
9bb5ae3a42 avutil/hwcontext_vulkan: fix vulkan callback function prototype
Fix -Wincompatible-function-pointer-types.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2026-01-15 16:05:56 +00:00