Commit Graph

122641 Commits

Author SHA1 Message Date
Marton Balint
30be62b711 fftools/ffprobe: print AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL id and data
Data is only printed if -show_data is used.

Signed-off-by: Marton Balint <cus@passwd.hu>
2026-02-04 21:46:30 +01: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
Andreas Rheinhardt
462fac0e0f tests/checkasm/vc1dsp: Use correct function argument
Fixes a stack-buffer overflow (detected by ASAN) when benching
vc1dsp.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-02-04 13:28:49 +01:00
Zhao Zhili
e250854ecf aarch64/h264pred: disable inefficient functions
These assembly optimizations have been identified as "performance
regressions." Due to advancements in modern CPU micro-architectures
and compiler optimization the C implementations now consistently
outperform these handwritten routines.

Test Name          	 A55-clang       M1             A76-gcc-14      A510-clang      A715-clang      X3-clang
--------------------------------------------------------------------------------------------------------------------
pred8x8_dc_8_neon        55.9 ( 0.79x)!  0.2 ( 0.31x)!  35.7 ( 0.63x)!  98.3 ( 0.37x)!  35.9 ( 0.45x)!  33.6 ( 0.38x)!
pred8x8_dc_10_neon       57.0 ( 1.04x)   0.3 ( 0.36x)!  35.9 ( 0.94x)!  98.2 ( 0.53x)!  35.8 ( 0.58x)!  33.2 ( 0.50x)!
pred8x8_dc_128_8_neon    26.0 ( 0.69x)!  0.1 ( 0.43x)!  15.3 ( 0.73x)!  46.4 ( 0.36x)!  10.6 ( 0.48x)!  10.3 ( 1.09x)
pred8x8_dc_128_10_neon   25.3 ( 0.99x)!  0.1 ( 0.42x)!  19.3 ( 0.48x)!  44.5 ( 0.42x)!  10.0 ( 0.61x)!  11.0 ( 1.00x)
pred8x8_left_dc_8_neon   46.9 ( 0.72x)!  0.2 ( 0.26x)!  30.2 ( 0.49x)!  71.4 ( 0.39x)!  29.8 ( 0.35x)!  26.5 ( 0.44x)!
pred8x8_left_dc_10_neon  45.4 ( 0.82x)!  0.2 ( 0.29x)!  28.1 ( 0.67x)!  70.2 ( 0.47x)!  30.0 ( 0.38x)!  26.5 ( 0.43x)!
pred16x16_dc_8_neon      74.4 ( 1.34x)   0.3 ( 0.62x)!  44.7 ( 0.89x)!  128.0 ( 0.79x)! 48.5 ( 0.67x)!  39.4 ( 0.71x)!
pred16x16_dc_128_8_neon  37.9 ( 0.79x)!  0.1 ( 0.60x)!  20.1 ( 0.80x)!  41.8 ( 0.46x)!  16.2 ( 0.81x)!  12.8 ( 0.95x)!
pred16x16_left_dc_8_neon 69.9 ( 1.19x)   0.3 ( 0.46x)!  49.6 ( 0.54x)!  116.8 ( 0.62x)! 52.8 ( 0.45x)!  44.2 ( 0.51x)!
pred8x8_hori_8_neon      30.6 ( 1.39x)   0.1 ( 0.45x)!  19.4 ( 0.81x)!  71.0 ( 0.50x)!  15.9 ( 0.55x)!  12.2 ( 0.94x)!
pred8x8_hori_10_neon*    29.3 ( 1.82x)   0.1 ( 0.59x)!  18.5 ( 1.56x)   68.9 ( 0.64x)!  15.8 ( 0.62x)!  11.8 ( 0.97x)!
pred8x8_top_dc_8_neon    35.8 ( 0.96x)!  0.1 ( 0.59x)!  16.8 ( 0.81x)!  58.9 ( 0.44x)!  11.3 ( 0.89x)!  11.4 ( 0.99x)!
pred8x8_top_dc_10_neon   37.4 ( 1.24x)   0.1 ( 0.92x)!  20.4 ( 0.81x)!  59.5 ( 0.69x)!  10.5 ( 1.48x)   11.8 ( 1.02x)
pred8x8_vertical_8_neon  18.3 ( 1.08x)   0.1 ( 0.54x)!  12.8 ( 0.89x)!  37.2 ( 0.40x)!   8.3 ( 0.77x)!  11.2 ( 1.00x)
pred8x8_vertical_10_neon 19.0 ( 1.24x)   0.1 ( 0.55x)!  15.3 ( 0.62x)!  39.7 ( 0.50x)!   8.2 ( 0.91x)!  11.1 ( 0.99x)!

- pred8x8_horizontal_10 also underperforms on new architectures, but useful on A55 and A76.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2026-02-04 09:06:37 +00:00
Zhao Zhili
f54841d375 avcodec/aarch64: add pngdsp
Test Name                    A55-gcc-11        M1-clang           A76-gcc-12          A510-clang        X3-clang
-------------------------------------------------------------------------------------------------------------------
add_bytes_l2_4096_neon        1807.2 ( 2.01x)    1.6 ( 1.94x)    333.0 ( 6.35x)   1058.2 ( 2.34x)    214.3 ( 1.99x)
add_paeth_prediction_3_neon  33036.1 ( 2.41x)  145.1 ( 1.66x)  20443.3 ( 1.97x)  35225.1 ( 1.23x)  19420.8 ( 1.05x)
add_paeth_prediction_4_neon  24368.6 ( 3.26x)  106.7 ( 2.01x)  15163.8 ( 2.77x)  26454.7 ( 1.62x)  14319.0 ( 1.35x)
add_paeth_prediction_6_neon  17900.6 ( 4.44x)   72.0 ( 2.70x)  10214.3 ( 4.20x)  18296.9 ( 2.27x)   9693.1 ( 1.97x)
add_paeth_prediction_8_neon  12615.4 ( 6.31x)   54.1 ( 2.58x)   7706.0 ( 5.45x)  13733.3 ( 2.94x)   7272.6 ( 2.63x)

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2026-02-04 12:05:35 +08:00
Zhao Zhili
a0d4c07b86 tests/checkasm: add test for png
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2026-02-04 12:05:35 +08:00
Zhao Zhili
9ebfd68096 swscale/swscale: force SwsDither and SwsAlphaBlend to 32 bits
The 'sws_dither' and 'alphablend' options access 'SwsDither' and
'SwsAlphaBlend' enum fields as integers. This is unsafe when the
code is compiled with -fshort-enums, as the enum size might be
smaller than an int.

Since the 'dither' and 'alpha_blend' struct members are part of the
public API, their types cannot be easily changed.

To ensure safe integer access and maintain ABI compatibility across
different compiler settings, a MAX_ENUM value is added to force the
enums to a 32-bit underlying type.
2026-02-04 04:00:53 +00:00
Jack Lau
36b23092f9 avformat/rtsp: replace the deprecated localport with localrtpport
The `localport` already deprecated in 3a29702cb6

Signed-off-by: Jack Lau <jacklau1222gm@gmail.com>
2026-02-04 00:26:26 +00:00
Michael Niedermayer
1fd718c6a9 avformat/mpegts: Check program_info_length
Fixes: overread
No testcase

Found-by: Marton Balint
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-02-04 00:04:41 +00:00
Michael Niedermayer
5975149603 avformat/mpegts: Check IOD_DESCRIPTOR len
Fixes: out of array read
Fixes: VULN-7/poc.ts

Found-by: Zhenpeng (Leo) Lin from depthfirst
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-02-04 00:04:41 +00:00
Jack Lau
5c6c12acb1 avformat/rtpenc: fix memleak when sdp create failed
Fix #20712

When print_sdp() fails during rtp streaming, sch_start()
returns error code without calling wirte_trailer, causing
a memory leak.

The avformat_free_context() will call the mux->deinit, so
we should add a rtp_deinit() to free all internal allocations.

Signed-off-by: Jack Lau <jacklau1222gm@gmail.com>
2026-02-03 23:31:17 +00:00
zhanghongyuan
52f9e8c205 fftools/opt_common: Make -sources/-sinks options work without arguments
The -sources and -sinks options were defined with OPT_FUNC_ARG flag,
which requires an argument. This caused "Missing argument for option
'sources'" error when running ffprobe -sources without arguments.
Removing OPT_FUNC_ARG flag allows these options to work without
arguments, listing all available devices, while still supporting
optional device name argument for filtering specific devices.
2026-02-03 23:22:03 +00:00
WyattBlue
065c2582c0 avfilter/af_whisper: Add newline for txt format 2026-02-03 21:45:43 +00:00
Ruikai Peng
55d5b2b507 avfilter/drawvg: limit VGS parser recursion depth 2026-02-03 21:07:29 +00:00
Oliver Chang
a795ca89fa avcodec/qdm2: fix heap-use-after-free in qdm2_decode_frame
The `sub_packet` index in `QDM2Context` was not reset to 0 when
`qdm2_decode_frame` started processing a new packet. If an error
occurred during the decoding of a previous packet, `sub_packet` would
retain a non-zero value.

In subsequent calls to `qdm2_decode_frame` with a new packet, this
non-zero `sub_packet` value caused `qdm2_decode` to skip
`qdm2_decode_super_block`. This function is responsible for initializing
packet lists with pointers to the current packet's data. Skipping it led
to the use of stale pointers from the previous (freed) packet, resulting
in a heap-use-after-free vulnerability.

This patch explicitly resets `s->sub_packet = 0` at the beginning of
`qdm2_decode_frame`, ensuring correct initialization for each new
packet.

Fixes: OSS-Fuzz issue 476179569
(https://issues.oss-fuzz.com/issues/476179569).
2026-02-03 18:17:32 +00:00
Jun Zhao
17d89757cd checkasm/hevc_pel: rename loop variable 'size' to 'idx' to avoid confusion
The variable 'size' is used as a loop index for the 'sizes' array.
This naming similarity is error-prone and recently led to a typo where
'size[sizes]' was written instead of 'sizes[size]'.

Rename the loop index variable from 'size' to 'idx' across all 10 test
functions to make the code more readable and prevent similar typos.

Additionally, replace the hardcoded loop upper bound '10' with
'FF_ARRAY_ELEMS(sizes)' for better maintainability.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-02-03 14:39:31 +00:00
Jun Zhao
2801d5eafe checkasm/hevc_pel: fix typo size[sizes] -> sizes[size]
Commit 4d4b301e4a introduced a typo where `size[sizes]` was used
instead of `sizes[size]` in 10 places within checkasm_check_pixel_padded
calls.

Since `sizes` is an array and `size` is the loop index, `size[sizes]`
interprets the array pointer as an index, resulting in undefined behavior
and causing AddressSanitizer to detect buffer overflows during testing.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-02-03 14:39:31 +00:00
Michael Niedermayer
2df0ef601a avcodec/jpeg2000dec: allow bpno of -1
Fixes: tickets/4663/levels30.jp2

The file decodes without error messages and no integer overflows
The file before the broader M_b check did decode with error messages and integer overflows but also no visual artifacts

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-02-03 12:39:32 +01:00
Michael Niedermayer
e1472a4e0c avcodec/jpeg2000dec: allow M_b == 31
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-02-03 12:39:32 +01:00
Michael Niedermayer
8a3c7c9c32 avcodec/jpeg2000dec: Print bpno level when erroring out
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-02-03 12:39:32 +01:00
Michael Niedermayer
2efffa9ecd avcodec/jpeg2000dec: Print M_b value when asking for a sample
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-02-03 12:39:31 +01:00
Michael Niedermayer
65fc0db581 avformat/hlsenc: fix format string vulnerability in parse_playlist
Found-by: Sarthak Munshi <sarthakmunshi@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-02-03 11:26:23 +00:00
Niklas Haas
8dc025c706 fftools/ffmpeg_sched: drop unneeded atomic
No longer needed now that this code is always locked.
2026-02-03 12:00:31 +01:00
Niklas Haas
41bd67b9fd fftools/ffmpeg_sched: fix race on SchFilterIn.send_finished
This logic was previously added to the scheduler. That commit added locking
(and rescheduling) when updating the corresponding `receive_finished` flag,
but missed doing the same for `send_finished`.

Fixes: fd1fd5850d
2026-02-03 12:00:31 +01:00
Andreas Rheinhardt
836d34e3ba avformat/tests/movenc: Make objects static
(This also fixes a symbol name collision with libssh,
which has a nonstatic function called md5.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-02-02 23:06:57 +01:00
James Almer
b613eebe78 avformat/demux: don't overwrite packet durations with parser ones if unset
Prevents loss of values taken from the demuxer when the underlying parser
doesn't set durations.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-02-02 12:52:02 -03:00
James Almer
3fc7e39eb8 avformat/cafenc: disable muxing Opus streams
We're not writing a kuki chunk because its contents for Opus are currently
unknown, so it's best if we don't allow the creation of non spec compliant
files.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-02-02 12:52:02 -03:00
James Almer
bec16c0bd3 avformat/cafdec: export Opus extradata
Given the contents of the Opus kuki are not fully clear, generate it
using know values from the desc and pakt chunks.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-02-02 12:52:02 -03:00
James Almer
d151c904df avformat/cafdec: take into account priming samples in timestamps
Signed-off-by: James Almer <jamrial@gmail.com>
2026-02-02 12:52:02 -03:00
stevxiao
7e9fe341df avfilter: version bump for filter mestimate_d3d12
Bump library version for filter 'mestimate_d3d12'.

This is the follow-up for commit https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21217/commits

Signed-off-by: younengxiao <steven.xiao@amd.com>
2026-02-02 04:16:50 +00:00
stevxiao
8fbd31e715 doc/filters: add entry for mestimate_d3d12
Add documentation for the filter "mestimate_d3d12" to the filters documentation.

This is the follow-up for commit https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21217/commits

Signed-off-by: younengxiao <steven.xiao@amd.com>
2026-02-01 09:53:35 -05:00
Frank Plowman
364d5dda91 lavc/vvc: Fix unchecked error codes from add_reconstructed_area 2026-01-31 13:46:13 +00:00
Frank Plowman
f9740eb969 lavc/vvc: Fix unchecked error codes from set_qp_y
Fixes: clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VVC_fuzzer-4957602162475008
2026-01-31 13:46:13 +00:00
Gyan Doshi
50bcc96a75 avformat/cafdec: parse non-intra streams
Needed to set KF flags so that they can be streamcopied using CLI.
2026-01-30 16:59:53 +00:00
Andreas Rheinhardt
39661f9295 fftools/ffmpeg_{filter,mux_init}: Improve type-safety
Reviewed-by: Niklas Haas <ffmpeg@haasn.dev>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-01-30 15:20:08 +01:00
Andreas Rheinhardt
67c87cde99 avfilter/formats,vsrc_testsrc: use type-safe formats functions
Reviewed-by: Niklas Haas <ffmpeg@haasn.dev>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-01-30 15:20:08 +01:00
Andreas Rheinhardt
de3f99d74b avformat/cafenc: Truncate values for avio_w8()
Fixes triggering av_assert2() in avio_w8().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-01-30 13:24:06 +01:00
Andreas Rheinhardt
4367c055b6 avformat/cafenc: Fix segfault upon error, avoid indirection
caf_write_deinit() would segfault if the CAFStreamContext
couldn't be allocated. Fix this by moving everything from
CAFStreamContext to the ordinary CAFContext; the separation
doesn't make sense for a format with only one stream anyway
and removing it also avoids an indirection.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-01-30 11:30:30 +01:00
Martin Storsjö
7ebb6c54eb tools: Lowercase more patterns in aarch64 assembly
Match more SVE/SME specific details.

Also lowercase all register names. As this matches many cases
of code comments that refer to variables elsewhere, not specific
registers, we only apply this tranformation on the part of lines
before a potential comment.
2026-01-30 05:21:27 +00:00
Martin Storsjö
f74c551eaa aarch64: Fix indentation of a few instructions
This file is excempt from the indent checker script, as there
are a few other bits in it that the script wants to reformat
into slightly worse form, or which might not warrant being
reformatted.

But these instructions should indeed be indented this way.
2026-01-30 05:21:27 +00:00
James Almer
277f9cb5d8 avformat/cafenc: add init and deinit callbacks
Signed-off-by: James Almer <jamrial@gmail.com>
2026-01-29 21:09:03 -03:00
James Almer
2d5556b082 avformat/cafenc: reindent after the previous changes
Signed-off-by: James Almer <jamrial@gmail.com>
2026-01-29 21:09:03 -03:00
James Almer
7581abdcb1 avformat/cafenc: support writing Packet Table Chunk Header if there are priming or remainder frames
If a codec has fixed block_align and frame_size but a given sample has either
priming or remainder frames, a pakt chunk can be written declaring zero packets
and no table, reporting only the samples to be discarded.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-01-29 21:09:02 -03:00
James Almer
6ff12c4f6c avformat/cafenc: add support for variable frame size codecs
Signed-off-by: James Almer <jamrial@gmail.com>
2026-01-29 21:09:02 -03:00
James Almer
7600d12383 avformat/cafenc: define a structure to store stream private fields
Will be useful in the following commit.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-01-29 21:09:02 -03:00
James Almer
8d1f247ec1 avformat/cafenc: fix setting frame count fields in Packet Table Description
st->duration is not guaranteed to be set, so store the sum of packet durations instead.
Also, set mPrimingFrames and mRemainderFrames to correct values.

Based on a patch by Jun Zhao.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-01-29 21:09:02 -03:00
James Almer
f5ea09afe8 avformat/cafdec: export frame size when present
Signed-off-by: James Almer <jamrial@gmail.com>
2026-01-29 21:09:02 -03:00
James Almer
c52b287ba9 avformat/cafdec: fix setting stream and packet durations
Take into account priming frames, exported as start time, and remainder frames,
substracted from the stream duration as well as exported as discard padding
side data in the last packet.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-01-29 21:09:02 -03:00
James Almer
041d108958 avcodec/opus/enc: don't remove more samples than needed from the last packet
The hardcoded extra 120 samples results in the side data reporting the need to
discard the entire packet rather than the padding samples.
This is in line with the behavior of the libopus encoder.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-01-29 21:09:02 -03:00
James Almer
c3aea7628c avcodec/opus/enc: set avctx->frame_size to a better guess based on encoder configuration
Signed-off-by: James Almer <jamrial@gmail.com>
2026-01-29 21:09:02 -03:00