Commit Graph

123615 Commits

Author SHA1 Message Date
Ted Meyer
fc7cab6be3 avformat/mov: Handle integer overflow in MOV parser
A chromium UBSAN fuzzer caught this instance.
2026-03-24 23:48:18 +00:00
wangbin
49c449b33a avformat/codecstring: fix undefined lcevc symbols if muxers are disabled 2026-03-24 23:14:41 +00:00
Andreas Rheinhardt
76a5d7c545 avfilter/framepool: Mark init, uninit functions as av_cold
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-24 23:13:00 +00:00
Andreas Rheinhardt
c3486e96dd avfilter/framepool: Reindent after the previous commit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-24 23:13:00 +00:00
Andreas Rheinhardt
e1e2c85537 avfilter/framepool: Use av_unreachable() for unreachable code
Instead of av_assert0(0).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-24 23:13:00 +00:00
Andreas Rheinhardt
1c101330d6 avfilter/framepool: Remove impossible branches
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-24 23:13:00 +00:00
Andreas Rheinhardt
92d06a8027 avcodec/vvc/ctu: Put scratchbufs into union to save space
This reduces sizeof(VVCLocalContext) from 4580576B to
3408032B here.

Reviewed-by: Frank Plowman <post@frankplowman.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-24 18:12:00 +01:00
Andreas Rheinhardt
a10c731723 avcodec/vvc/ctu: Move often accessed fields to the start of structs
And move the big buffers to the end. This reduces codesize
as offset+displacement addressing modes are either unavailable
or require more bytes of displacement is too large. E.g. this
saves 5952B on x64 here and 3008B on AArch64. This change should
also improve data locality.

Reviewed-by: Frank Plowman <post@frankplowman.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-24 18:10:55 +01:00
Andreas Rheinhardt
e41799d6ec avcodec/vvc: Use static_assert where appropriate
Reviewed-by: Frank Plowman <post@frankplowman.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-24 18:09:43 +01:00
Lynne
f40fcf8024 libavfilter/scale_vulkan: do not unnencessarily set s->qf on every frame
The initialization function already does this.

Sponsored-by: Sovereign Tech Fund
2026-03-24 15:21:23 +01:00
Lynne
940e407c64 libavfilter/scale_vulkan: use swscale's Vulkan code
This commit enables using swscale's newly added Vulkan code.

Sponsored-by: Sovereign Tech Fund
2026-03-24 15:21:17 +01:00
Lynne
e88d4ef718 swscale/vulkan: take order_src/order_dst into account
This fixes rgba/gbrap/bgra conversions.

Sponsored-by: Sovereign Tech Fund
2026-03-24 15:21:17 +01:00
Lynne
e01d19aad6 swscale/vulkan: implement SWS_OP_LINEAR
Sponsored-by: Sovereign Tech Fund
2026-03-24 15:21:17 +01:00
Lynne
4805f317a6 swscale/vulkan: implement SWS_OP_DITHER
Sponsored-by: Sovereign Tech Fund
2026-03-24 15:21:17 +01:00
Lynne
d212ff08e0 swscale/vulkan: implement SWS_OP_CONVERT
Sponsored-by: Sovereign Tech Fund
2026-03-24 15:21:17 +01:00
Lynne
bea41f1f90 swscale/vulkan: implement SWS_OP_LSHIFT/SWS_OP_RSHIFT
Sponsored-by: Sovereign Tech Fund
2026-03-24 15:21:17 +01:00
Lynne
d35a77879c swscale/vulkan: implement SWS_OP_MIN/SWS_OP_MAX
Sponsored-by: Sovereign Tech Fund
2026-03-24 15:21:16 +01:00
Lynne
bf93a67733 swscale/vulkan: implement SW_OP_SCALE
Sponsored-by: Sovereign Tech Fund
2026-03-24 15:21:16 +01:00
Lynne
41f748d2ee swscale/vulkan: add precise qualifier to f32
Sponsored-by: Sovereign Tech Fund
2026-03-24 15:21:09 +01:00
James Almer
d61d724905 avcodec/bsf/lcevc_metadata: write Aditional Info blocks after the Global Config block
Signed-off-by: James Almer <jamrial@gmail.com>
2026-03-24 11:14:17 -03:00
James Almer
35a1e43a6a avcodec/cbs_lcevc: fix writing process blocks with size 6
6 is an undefined value for payload_size_type. For those, 7 is used to signal
a custom_byte_size synxtax element.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-03-24 11:12:25 -03:00
Niklas Haas
00d1f41b2e swscale/ops_backend: avoid UB (null pointer arithmetic)
Just use uintptr_t, it accomplishes the exact same thing while being defined
behavior.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-03-24 13:20:59 +00:00
Scott Theisen
7516bf24db libavformat/mpegts.c: pat_cb(): Ensure all PIDs are valid
but just ignore invalid PAT entries so subsequent valid
entries are parsed.

ISO/IEC 13818-1:2021 specifies a valid range of [0x0010, 0x1FFE] in
§ 2.4.4.6 Semantic definition of fields in program association section
and Table 2-3 – PID table

ts->current_pid is always 0 since that is the PID for the PAT.
2026-03-23 19:50:13 +00:00
Nariman-Sayed
2501954d49 avformat/rtpdec: fix RTCP RR cumulative packet loss clamping
Per RFC 3550 Appendix A.3, the cumulative number of packets lost is a
signed 24-bit field. Clamp to signed 24-bit range using av_clip_intp2
and av_zero_extend to handle duplicate packets correctly.
2026-03-23 19:49:25 +00:00
Romain Beauxis
053fb462d8 tests/fate/ogg-*.mak: Make sure that copy tests do not run when
$(FFMPEG) is not compiled.
2026-03-23 10:53:33 -05:00
James Almer
e1158301f0 avformat/mov: don't try to create an LCEVC group if there's a single track
In this scenario, as it's the case with DASH segments, the lcevc track will be
alone but potentially have a sbas tref entry referencing itself, which will
make avformat_stream_group_add_stream() fail.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-03-23 10:50:13 -03:00
Kacper Michajłow
9c63742425 avutil/attributes: enable av_flatten when available
This enables av_flatten on Clang in particular.

It was disabled because at the time this attribute was not supported.
It was implemented in Clang/LLVM 3.5 [1].

Use `__has_attribute` to check for availability. This has been added in
Clang 2.9 [2].

This reverts change 5858a67f13.

[1] 41af7c2fdc
[2] 274a70ed7f

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-03-22 15:55:54 +00:00
Romain Beauxis
878fb73135 libavfilter/vf_frei0r: use .so suffix for plugins on macOS 2026-03-22 14:27:36 +00:00
James Almer
711b1a52bd avformat/movenc: check if a packet is to be discarded when calculating edit list durations
Demuxers like mov will export packets not meant for presentation (e.g. because
an edit list doesn't include them) by flagging them as discard, but the mov
muxer completely ignored this, resulting in output edit lists considering every
packet.

Fixes issue #22552

Signed-off-by: James Almer <jamrial@gmail.com>
2026-03-21 23:35:39 -03:00
Michael Niedermayer
1bde76da89 avcodec/dvdsub_parser: Fix buf_size check
Fixes: signed integer overflow
Fixes: out of array access
Fixes: dvdsub_int_overflow_mixed_ps.mpg

Found-by: Quang Luong of Calif.io in collaboration with OpenAI Codex
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-03-22 00:33:26 +00:00
Andreas Rheinhardt
9d97771bc6 avcodec/bsf/extract_extradata: Remove pointless checks
It doesn't hurt to keep track of filtered_size:
The end result will be ignored if extradata is not removed
from the bitstream.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-21 15:05:17 +00:00
Andreas Rheinhardt
1dd853010a avcodec/bsf/extract_extradata: Redo extracting LCEVC extradata
Changes compared to the current version include:
1. We no longer use a dummy PutByteContext on the first pass
for checking whether there is extradata in the NALU. Instead
the first pass no longer writes anything to any PutByteContext
at all; the size information is passed via additional int*
parameters. (This no longer discards const when initializing
the dummy PutByteContext, fixing a compiler warning.)
2. We actually error out on invalid data in the first pass,
ensuring that the second pass never fails.
3. The first pass is used to get the exact sizes of both
the extradata and the filtered data. This obviates the need
for reallocating the buffers lateron. (It also means
that the extradata side data will have been allocated with
av_malloc (ensuring proper alignment) instead of av_realloc().)
4. The second pass now writes both extradata and (if written)
the filtered data instead of parsing the NALUs twice.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-21 15:05:17 +00:00
Andreas Rheinhardt
548b9f5ca7 avcodec/bsf/extract_extradata: Inline constants
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-21 15:05:17 +00:00
stevxiao
a077da895b avfilter/dnn_backend_torch: add CUDA/ROCm device support
Add support for CUDA and ROCm (AMD GPU) devices in the LibTorch DNN
backend.

This works for both NVIDIA CUDA and AMD ROCm, as PyTorch exposes ROCm
through the CUDA-compatible API.

Usage:

./ffmpeg -i input.mp4 -vf scale=224:224,format=rgb24,dnn_processing=dnn_backend=torch:model=sr_model_torch.pt:device=cuda output.mp4

Reviewed-by: Guo Yejun <yejun.guo@intel.com>
Signed-off-by: younengxiao <steven.xiao@amd.com>
2026-03-21 16:25:40 +08:00
marcos ashton
924cc51ffe tests/fate/pcm: add FATE tests for pcm_bluray encoder and decoder
Add enc_dec_pcm roundtrip tests for the pcm_bluray codec covering
mono, stereo, 5.1, 7.0, and 7.1 channel layouts in s16. The 5.1
and 7.0 tests use an explicit pan filter for channel layout
conversion so the PAN_FILTER dependency is declared only where
needed. An additional s32 test uses a FATE sample file with real
>16-bit content (divertimenti_2ch_96kHz_s24.wav) and decodes to
s32le to verify the full 32-bit round-trip.

enc_dec_pcm is used instead of transcode because the MPEGTS muxer
produces different binary output on 32-bit and 64-bit platforms,
causing the intermediate file checksum to fail on 32-bit CI.

Coverage for libavcodec/pcm-bluray.c: 0.00% -> 93.75%
Coverage for libavcodec/pcm-blurayenc.c: 0.00% -> 91.71%

Signed-off-by: marcos ashton <marcosashiglesias@gmail.com>
2026-03-21 01:04:20 +00:00
marcos ashton
345071f747 tests/fate/libavutil: add FATE test for stereo3d
Add a unit test covering av_stereo3d_alloc, av_stereo3d_alloc_size,
av_stereo3d_create_side_data, av_stereo3d_type_name,
av_stereo3d_from_name, av_stereo3d_view_name,
av_stereo3d_view_from_name, and av_stereo3d_primary_eye_name.
The from_name calls are driven by a static name table so each
string appears exactly once. Round-trip inverse checks verify
that type_name/from_name and view_name/view_from_name are
consistent with each other.

Coverage for libavutil/stereo3d.c: 0.00% -> 100.00%

Signed-off-by: marcos ashton <marcosashiglesias@gmail.com>
2026-03-21 01:04:20 +00:00
marcos ashton
ed19c181c2 tests/fate/libavutil: add FATE test for film_grain_params
Add a unit test covering alloc, create_side_data, and select
for AV1 and H.274 film grain parameter types (22 cases).

Coverage for libavutil/film_grain_params.c: 0.00% -> 97.73%

Signed-off-by: marcos ashton <marcosashiglesias@gmail.com>
2026-03-21 01:04:20 +00:00
marcos ashton
a43ea8bff7 avfilter/af_pan: fix sscanf() return value checks in parse_channel_name
sscanf() returns EOF (-1) on input failure, which is non-zero and
passes a bare truthy check. When this happens, the %n directive is
never processed, so len stays uninitialized. Using that value to
advance the arg pointer causes an out-of-bounds read and crash.

Check for >= 1 instead, matching the fix applied to the other
sscanf() call in init() by commit b5b6391d64.

Fixes: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/22451
Signed-off-by: marcos ashton <marcosashiglesias@gmail.com>
2026-03-21 00:44:30 +00:00
tark1998
442e6c80bf avformat/mov: add m4v to allowed extensions
M4V is a standard extension for MPEG-4 video files, commonly used by
Apple devices and software. While it is functionally similar to MP4,
it was missing from the list of recognized extensions for the
MOV/MP4 demuxer.
2026-03-21 00:40:39 +00:00
marcos ashton
dfa53aae5f 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>
2026-03-21 00:34:50 +00:00
Weidong Wang
06d19d000d avformat/rsd: reject short ADPCM_THP extradata reads
Use ffio_read_size() to enforce exact-length reads of the per-channel
ADPCM_THP coefficient tables. Previously the return value of
avio_read() was unchecked, silently accepting truncated extradata.
2026-03-21 00:29:04 +00:00
Michael Niedermayer
e9c6d411c4 doc/CVSS
A simple (FFmpeg specific) guide how to choose CVSS
2026-03-20 22:01:43 +01:00
Michael Niedermayer
313e776ba7 avcodec/ffv1dec: Allocate the minimum size for fltmap and fltmap32 with the current implementation
Found-by: Lynne
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-03-20 15:50:09 +00:00
Jeremy James
3d4461e16d fftools/ffprobe: Show stream group side data
Specifically output side data from tile groups with -show_stream_groups
which includes rotation information in HEIC images.

Signed-off-by: Jeremy James <jeremy.james@gmail.com>
2026-03-20 12:45:44 +00:00
Martin Storsjö
f72f692afa aarch64: Add PAC sign/validation of the link register
Whenever the link register is stored on the stack, sign it
before storing it and validate at a symmetrical point (with the
stack at the same level as when it was signed).

These macros only have an effect if built with PAC enabled (e.g.
through -mbranch-protection=standard), otherwise they don't
generate any extra instructions.

None of these cases were present when PAC support was added
in 248986a0db in 2022.

Without these changes, PAC still had an effect in the compiler
generated code and in the existing cases where we these macros were
used - but make it apply to the remaining cases of link register
on the stack.
2026-03-20 13:16:06 +02:00
Martin Storsjö
dbf7354d98 aarch64/inter_sme2: Remove needless backup/restore of x29/x30
The sme_entry/sme_exit macros already take care of backing up/restoring
these registers. Additionally, as long as no function calls are
made within the function, x30 doesn't need to be backed up at all.
2026-03-20 13:16:06 +02:00
Peter Bennett
42029a8836 libavcodec/mediacodec: MythTV Fix for incorrect stride with amazon fire stick
With 1080i MPEG2 video, amazon fire stick uses a different stride from what
is returned.
2026-03-20 04:40:06 +00:00
Zhao Zhili
163b9b6c7e avformat/lcevc: return error when no valid NAL units are found
ff_lcvec_parse_config_record() returns success before this patch
when no IDR or NON_IDR NAL units are found.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2026-03-20 10:47:13 +08:00
Zhao Zhili
eadce30402 avformat/lcevc: merge duplicate IDR and NON_IDR branches
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2026-03-20 10:45:31 +08:00
stevxiao
7b534c2bdc avfilter/dnn_backend_tf: fix ctx async field access
ctx->options.async does not exist on DnnContext; the correct
field is ctx->async directly on the context struct.

Signed-off-by: younengxiao <steven.xiao@amd.com>
2026-03-20 02:22:06 +00:00