Commit Graph
125781 Commits
Author SHA1 Message Date
Nicolas George ef82d0789a fftools/ffmpeg: remove extra \n 2026-07-27 10:51:09 +02:00
Nicolas George ad1f8a09a6 lavfi/vf_format: factor parsing the lists 2026-07-27 10:51:09 +02:00
Nicolas George cf6abefe83 lavfi/vf_format: report error for invalid names 2026-07-27 10:51:09 +02:00
Nicolas George a757b708ae lavfi: cosmetic: rename variable 2026-07-27 10:27:27 +02:00
Nicolas George f3431169da lavfi: do not send premultiplied alpha to filters not ready for it
The arithmetic to process colors in premultiplied alpha is
completely different from the arithmetic for straight alpha.
Running a filter using straight arithmetic on premultiplied
will result in incorrect and sometimes invalid output.
Therefore, premultiplied alpha should only be selected for
filters that either explicitly support it or only use
elementary color arithmetic or none at all.
For other filters, automatic conversion will do its work.
2026-07-27 10:27:27 +02:00
Nicolas George cd9d265344 Revert "avfilter/avfiltergraph: always retry format negotiation after auto-filters"
This reverts commit 978a0821ee.

The stability of the negotiation process has never been studied
with multiple rounds.

It has always been documented to users that scale was the filter
to insert to manage format conversions. A second filter for
a specific type of conversion should never have been added:
the proper fix for the issue that this commit tried to fix is
to give scale the ability to handle premultiplication too.
2026-07-27 10:27:27 +02:00
Michael Niedermayer 7058900614 avcodec/screenpresso: reject deflate output shorter than the frame
Fixes: use of uninitialized memory
Fixes: screenpresso_short_zlib_heap_disclosure.avi
Fixes: ksUBwBOjJodq
Found-by: Adrian Junge (vurlo)
2026-07-27 03:33:28 +00:00
Nathan Lucas 7002e01c19 tests/fate/spdif: add TrueHD branch padding test
Add a small synthetic TrueHD sample that exercises large MAT padding in
spdifenc. The sample covers both the input_timing path with padding above
MAT_FRAME_SIZE / 2 and the output_timing discontinuity path.

It also verifies queued MAT frame emission when one input packet completes
more than one MAT frame.

Signed-off-by: Nathan Lucas <nlucasgit@gmail.com>
2026-07-25 20:12:16 -06:00
Nathan Lucas 2db563fac2 avformat/spdifenc: preserve TrueHD MAT padding across branches
Some TrueHD streams, particularly remuxes of seamless branching Blu-rays,
contain input_timing gaps that require more padding than the current
MAT_FRAME_SIZE / 2 limit allows.  spdifenc treats this padding as
invalid and drops it, breaking MAT timing and IEC 61937 carrier cadence,
causing TrueHD/Atmos dropouts on some receivers.

Allow larger valid padding gaps and queue completed MAT buffers so the
muxer can preserve the carrier cadence while still writing at most one
MAT buffer per input packet.

Some branches also have discontinuous timing, so input_timing cannot be
directly used to compute padding at those boundaries.  When output_timing
is available from a TrueHD restart header, use it to detect those
discontinuities and compute padding from the change in
output_timing - input_timing offset across the boundary instead.

Fixes: https://trac.ffmpeg.org/ticket/9569
Fixes: https://trac.ffmpeg.org/ticket/10948
See also: https://github.com/mpv-player/mpv/issues/9659
See also: https://github.com/mpv-player/mpv/issues/13943

Signed-off-by: Nathan Lucas <nlucasgit@gmail.com>
2026-07-25 20:12:16 -06:00
Steven Liu 601d9ee881 avformat/hlsenc: Handle extensionless URIs in extract_segment_number()
fix: vulnerability:019f3b84-90fb-737a-ae7a-b3e0219266fc
extract_segment_number() used strrchr(filename, '.') and immediately did
dot - 1 without checking for NULL. A segment URI with no extension would
cause undefined behavior (NULL pointer arithmetic) when resuming an
append_list playlist with subtitle variants.

Add a NULL check and return -1 early when no dot is found.

Fixes a crash/UB in HLS muxer resume path.

Found-by: depthfirst
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2026-07-26 01:05:03 +00:00
Steven Liu 23602df9cd avformat/hls: Enforce protocol checks when opening child playlists
Fix: vulnerability:019f3b84-903b-75fb-a8de-fad1c2d7e99c
The parse_playlist() path for opening a new child playlist (in == NULL)
directly called c->ctx->io_open(), bypassing the protocol whitelist and
file-extension checks that open_url() enforces. This allowed child URLs
from a master playlist to use protocols other than file/http/data or to
have disallowed extensions.

Route the !in branch through open_url() so that all child playlists are
subject to the same security policy as segment URLs.

Fixes a security bypass in HLS master playlist parsing.

Found-by: depthfirst
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2026-07-26 01:05:03 +00:00
Steven Liu 275e217b10 avformat/hlsenc: Fix heap buffer overflow in parse_playlist()
Fix: vulnerability:019f3b84-903b-75fb-a8de-fe6f84d6bc32

When parsing IV=0x... followed by a comma, end - ptr was passed directly
to av_strlcpy() as the destination size. Since iv_string is only 33 bytes
(KEYSIZE*2 + 1), a long IV token could overflow into adjacent heap data.

Use FFMIN(end - ptr + 1, sizeof(buf)) to cap the copy size to the actual
buffer size. Apply the same fix to key_uri parsing for consistency.

Fixes a heap buffer overflow in append_list mode when reading an existing
playlist with a crafted IV or URI token length.

Found-by: depthfirst
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2026-07-26 01:05:03 +00:00
Raja-89 b52c71e438 avfilter/dnn: fix async teardown race condition in all backends
When the filter graph is torn down early (e.g. at EOF with -frames:v),
the main thread calls dnn_free_model and destroys the request queue
while async inference threads may still be running. When a detached
thread finishes and tries to push its result back to the destroyed
queue, it triggers a segmentation fault.

Add ff_dnn_wait_requests() to dnn_backend_common which blocks
until all allocated request items (ctx->nireq) have been safely
returned to the request_queue. Call it from dnn_free_model in the
torch, tensorflow, openvino, and onnx backends before destroying the queue.
2026-07-25 15:08:07 +00:00
Guo Yejun d09db42d8f configure: add manual check for openvino v2 2026-07-25 19:39:16 +08:00
wang-bin 2a06abd2d7 hwcontext_vaapi: fix undefined close() on windows 2026-07-25 05:30:55 +00:00
Zuxy Meng 9e598c5188 avcodec/x86/h264_intrapred: Deprecate MMX from pred8x8l_down_left_8
Convert use of MMX to SSE2, also remove the SSSE3 impl. since we no
longer use palignr

Before:
  pred8x8l_down_left_8_sse2:               18.0 ( 4.04x)
  pred8x8l_down_left_8_ssse3:              16.2 ( 4.49x)

After:
  pred8x8l_down_left_8_sse2:               14.2 ( 5.14x)

Signed-off-by: Zuxy Meng <zuxy.meng@gmail.com>
2026-07-24 19:16:45 -07:00
Zuxy Meng c87b51a93e avcodec/x86/h264_intrapred: Deprecate MMX from all pred4x4 functions
Convert all use of MMX to XMM; no change in performance.

Signed-off-by: Zuxy Meng <zuxy.meng@gmail.com>
2026-07-24 19:16:45 -07:00
Zuxy Meng 9e3d688314 avcodec/x86/h264_intrapred: Deprecate MMX from pred16x16_dc_8
Convert use of MMX to SSE2; no change in performance.

Signed-off-by: Zuxy Meng <zuxy.meng@gmail.com>
2026-07-24 19:16:45 -07:00
Zuxy Meng 1a0747633c avcodec/x86/h264_intrapred: Deprecate MMX from pred8x8l_horizontal_down_8
Convert use of MMX to SSE2, also fix checkasm test.

Before:
 pred8x8l_horizontal_down_8_sse2:                        33.2 ( 2.53x)
 pred8x8l_horizontal_down_8_ssse3:                       27.8 ( 3.02x)

After:
 pred8x8l_horizontal_down_8_sse2:                        24.3 ( 3.45x)
 pred8x8l_horizontal_down_8_ssse3:                       22.6 ( 3.71x)

Signed-off-by: Zuxy Meng <zuxy.meng@gmail.com>
2026-07-24 19:16:45 -07:00
Zuxy Meng 093fda3c21 avcodec/x86/h264_intrapred: Deprecate MMX from pred8x8l_vertical_left_8
Convert use of MMX to SSE2, also remove the SSSE3 impl. since we no
longer use palignr

Before:
 pred8x8l_vertical_left_8_sse2:                          17.3 ( 4.89x)
 pred8x8l_vertical_left_8_ssse3:                         15.0 ( 5.63x)

After:
 pred8x8l_vertical_left_8_sse2:                          11.8 ( 6.80x)

Signed-off-by: Zuxy Meng <zuxy.meng@gmail.com>
2026-07-24 19:16:45 -07:00
Zuxy Meng ea2bf7e775 avcodec/x86/h264_intrapred: Deprecate MMX from pred8x8l_vertical_right_8
Convert use of MMX to SSE2, also remove the SSSE3 impl. since we no
longer use palignr

Before:
 pred8x8l_vertical_right_8_sse2:                         24.1 ( 3.51x)
 pred8x8l_vertical_right_8_ssse3:                        20.8 ( 4.07x)

After:
 pred8x8l_vertical_right_8_sse2:                         19.5 ( 4.38x)

Signed-off-by: Zuxy Meng <zuxy.meng@gmail.com>
2026-07-24 19:16:45 -07:00
Zuxy Meng d03788af83 avcodec/x86/h264_intrapred: Deprecate MMX from pred8x8l_down_right_8
Convert use of MMX to SSE2, also remove the SSSE3 impl. since we no
longer use palignr

Before:
 pred8x8l_down_right_8_sse2:                             26.4 ( 3.26x)
 pred8x8l_down_right_8_ssse3:                            23.0 ( 3.74x)

After:
 pred8x8l_down_right_8_sse2:                             19.7 ( 4.33x)

Signed-off-by: Zuxy Meng <zuxy.meng@gmail.com>
2026-07-24 19:16:45 -07:00
Zuxy Meng 14dfce5eaf avcodec/x86/h264_intrapred: SSE2 impl. of pred8x8_dc_rv40_8
Deprecate MMX. No change in performance. Also add test coverage in
checkasm.

pred8x8_dc_rv40_mmxext:                                 10.0 ( 1.24x)
pred8x8_dc_rv40_sse2:                                   10.0 ( 1.24x)

Signed-off-by: Zuxy Meng <zuxy.meng@gmail.com>
2026-07-24 19:16:45 -07:00
Zuxy Meng 3333082cd7 avcodec/x86/h264_intrapred: SSE2 impl. of pred8x8l_horizontal_up_8
Deprecate MMX. Remove the SSSE3 impl. since we no longer use palignr and
SSE2 is faster.

pred8x8l_horizontal_up_8_mmxext:                        27.1 ( 2.30x)
pred8x8l_horizontal_up_8_ssse3:                         23.9 ( 2.60x)
pred8x8l_horizontal_up_8_sse2:                          20.9 ( 2.96x)

Signed-off-by: Zuxy Meng <zuxy.meng@gmail.com>
2026-07-24 19:16:45 -07:00
Zuxy Meng c7e532e81e avcodec/x86/h264_intrapred: SSE2 impl. of pred8x8l_horizontal_8
Deprecate MMX. Remove the SSSE3 impl. since we no longer use palignr. No
change in performance.

pred8x8l_horizontal_8_mmxext:                           16.2 ( 1.44x)
pred8x8l_horizontal_8_ssse3:                            15.6 ( 1.50x)
pred8x8l_horizontal_8_sse2:                             15.8 ( 1.49x)

Signed-off-by: Zuxy Meng <zuxy.meng@gmail.com>
2026-07-24 19:16:45 -07:00
Zuxy Meng 607862dd66 avcodec/x86/h264_intrapred: SSE2 impl. of pred8x8l_vertical_8
Deprecate MMX. Remove the SSSE3 impl. since we no longer use palignr.

pred8x8l_vertical_8_mmxext:                              7.4 ( 3.61x)
pred8x8l_vertical_8_ssse3:                               6.6 ( 4.03x)
pred8x8l_vertical_8_sse2:                                6.3 ( 4.19x)

Signed-off-by: Zuxy Meng <zuxy.meng@gmail.com>
2026-07-24 19:16:45 -07:00
Michael Niedermayer 92cd5c9781 avfilter/vf_lut3d: do not compute size*size before the size is validated
parse_dat(), parse_cube(), and parse_cinespace() multiply an untrusted LUT size
before allocate_3dlut() validates it, which can overflow int.
Use the validated lutsize2 computed by allocate_3dlut() instead.

Fixes: signed integer overflow
2026-07-24 19:09:44 +00:00
Guo Yejun 6095372a70 avfilter/dnn: use batch_size in DnnContext instead of ov_option
batch_size in DnnContext is a common variable for all dnn backends
2026-07-24 14:06:09 +00:00
Jun Zhao 2f209337fc avformat/mov: read DTS metadata from ddts box
The MOV demuxer only handled the low four bits of ChannelLayout and
did not expose the DTS profile carried by StreamConstruction. It also
discarded the sample-entry channel count when ChannelLayout was zero.

Parse StreamConstruction, RepresentationType, and all 16 ChannelLayout
bits according to ETSI TS 102 114. Map StreamConstruction to the
corresponding FFmpeg DTS profile, and preserve the sample-entry channel
count for zero layouts unless RepresentationType explicitly signals two
encoded channels.

This also provides profile and channel metadata for encrypted samples
whose frame headers cannot be inspected.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-07-24 10:36:46 +08:00
Marcos Ashton Iglesias 9347affa3d avcodec/x86/hevc: add SSE2 and AVX transform_4x4_luma
Implements the 4x4 luma DST-VII inverse transform for 8 and 10 bit,
using pmaddwd on (src0,src2)/(src1,src3) pairs, mirroring the
existing 4x4 IDCT structure.

checkasm --bench on a Core Ultra 7 155H:
hevc_transform_luma_4x4_8_c:        151.0
hevc_transform_luma_4x4_8_sse2:      35.9 ( 4.20x)
hevc_transform_luma_4x4_8_avx:       34.2 ( 4.42x)
hevc_transform_luma_4x4_10_c:       146.5
hevc_transform_luma_4x4_10_sse2:     35.0 ( 4.19x)
hevc_transform_luma_4x4_10_avx:      33.7 ( 4.35x)

Part of #23022.
2026-07-23 17:58:45 +00:00
James Almer b3d4ce20a4 avformat/lcevc: add a log context parameter to all functions
Printing to NULL should be avoided when possible.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-07-23 13:56:54 -03:00
James Almer e1c1b6c558 avcodec/get_buffer: use frame pixel format instead of context
The documentation for get_buffer2() states:

"This callback must use the frame values, not the codec context values, to
calculate the required buffer size."

Fixes wrong output on hbd LCEVC enhanced samples where the base stream is
8bit.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-07-23 10:39:47 -03:00
Zhao Zhili 80eb9e99b9 avutil/hwcontext_cuda: fix unused variable 'i' warning
The variable i is only used inside the HAVE_FFNVCODEC_CUARRAY block.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2026-07-23 11:26:15 +08:00
James Almer afb74faff6 tests/ref: update references
Missed in 642ae726ff after a faulty rebase.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-07-22 21:14:07 -03:00
James Almer 9c8fc66ce1 tests/fate/matroska: add a test for Track Timescale handling
Signed-off-by: James Almer <jamrial@gmail.com>
2026-07-22 20:50:14 -03:00
James Almer 642ae726ff avformat/matroska: rescale default duration derived block durations to stream timebase
Block timestamps and durations are in Track Ticks, meaning they are scaled with both
Segment timescale and Track timescale.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-07-22 20:50:14 -03:00
Philip Langdale 2cf3f4d64d avutil/hwcontext_cuda: remove format allowlist, accept any pixel format
Remove the static supported_formats[] allowlist from hwcontext_cuda.
cuda_frames_get_constraints() now iterates all registered pixel formats
and includes every non-hwaccel, non-palette format. cuda_frames_init()
validates with av_pix_fmt_desc_get() instead of checking against the
allowlist.

Palette formats have a special-cased use of plane[1] for the palette itself
and it's not worth the hassle of supporting in an otherwise clean generic
copy loop.

Also add a roundtrip test that uploads a deterministic byte pattern to
CUDA, downloads it back, and verifies the data match. This tests all
non-hwaccel pixel formats. The test is gated on CONFIG_CUDA.
2026-07-22 21:42:40 +00:00
Andreas Rheinhardt c450bf833c Revert "avformat/concatdec: Check recursion depth"
This reverts commit 58d39e99e2.
Superseded by the generic recursion limit introduced
in 597036b692.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-07-22 16:08:17 +02:00
Ramiro Polla c61690153c swscale/aarch64: split ops_static.c out of ops_asmgen.c
ops_asmgen.c contains common aarch64 asm generation code that will be
used by CPS backend and the JIT backend.

The standalone tool with CPS-specific code is now ops_static.c.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Ramiro Polla <ramiro.polla@gmail.com>
2026-07-22 14:07:37 +00:00
Ramiro Polla e69c1d87f2 swscale/aarch64/ops_asmgen: populate operands matrix in asmgen_setup_linear()
This will serve multiple purposes:
- Allow JIT code to populate operands from a deduplicated data pool;
- Simplify the future implementation of integer linear operation, since
  mul/mla take full vector registers as coefficients, and not elements.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Ramiro Polla <ramiro.polla@gmail.com>
2026-07-22 14:07:37 +00:00
Ramiro Polla bc06af02c6 swscale/aarch64/ops_asmgen: use different value for vtmp register index
Use vtmp register index relative to the current matrix column instead
of reusing the position of the value from the packed data.

The i_coeff and derived values will be removed in the following commit.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Ramiro Polla <ramiro.polla@gmail.com>
2026-07-22 14:07:37 +00:00
Ramiro Polla a1fcb227ae swscale/aarch64/ops_asmgen: reword annotations for linear operation
Refer to offset[i] or coeff[i][j] instead of position of the value from
the packed data.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Ramiro Polla <ramiro.polla@gmail.com>
2026-07-22 14:07:37 +00:00
Ramiro Polla ecbb883014 swscale/aarch64/ops_asmgen: move save_mask setup out of asmgen_op_linear() and into asmgen_setup_linear()
The save_mask setup makes copies of input data that would be clobbered
by the linear operation itself. This setup is not entirely necessary
with JIT, since we may have separate input and output vector registers,
so the code is moved into the setup function which will be CPS-only.

This doubles the amount of temp registers needed, since they must all
be copied before both loops.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Ramiro Polla <ramiro.polla@gmail.com>
2026-07-22 14:07:37 +00:00
Ramiro Polla 132187cdbb swscale/aarch64/ops_asmgen: increase the number of temp vectors to 12
This change is done separately from the next commit (which uses the new
temp vectors in the linear op) to make it easier to track changes to
ops_neon.gen.S.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Ramiro Polla <ramiro.polla@gmail.com>
2026-07-22 14:07:37 +00:00
Ramiro Polla 1b66342df2 swscale/aarch64/ops_asmgen: split input/output vector banks into separate register variables
For CPS these will continue being the same vector register numbers,
because of the fixed ABI, but for JIT we will be able to use different
input/output vector registers to implicitly perform swizzles.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Ramiro Polla <ramiro.polla@gmail.com>
2026-07-22 14:07:37 +00:00
Ramiro Polla 940e4b29e1 swscale/aarch64/ops_asmgen: split vector init from reshaping
This changes nothing for the CPS code, but will allow the JIT compiler
to allocate and reorder vector registers without them being affected by
reshaping.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Ramiro Polla <ramiro.polla@gmail.com>
2026-07-22 14:07:37 +00:00
Ramiro Polla 12a0191744 swscale/aarch64/ops_asmgen: setup frame for each function
Currently this is redundant, since all CPS functions share the same
frame.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Ramiro Polla <ramiro.polla@gmail.com>
2026-07-22 14:07:37 +00:00
Ramiro Polla 0096b48825 swscale/aarch64/ops_asmgen: load values from exec before performing setup
This changes little for the current CPS code, which has fairly simple
setup code. But in JIT we will factor out much more code from the main
loop into the setup section.

This also frees up the register used by exec (x0) earlier on, so it may
be reused earlier in JIT code.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Ramiro Polla <ramiro.polla@gmail.com>
2026-07-22 14:07:37 +00:00
Ramiro Polla 25ee9a4218 swscale/aarch64/ops_asmgen: use more (but simpler) loops for exec load generation
Same behaviour, just looks neater.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Ramiro Polla <ramiro.polla@gmail.com>
2026-07-22 14:07:37 +00:00
Ramiro Polla 28a47aea66 swscale/aarch64/ops_asmgen: pass both input and output masks to asmgen_process()
Currently, for CPS code, both masks are the same, similar to how the C
and x86 backends do it.

But the JIT compiler will have more precise input and output masks.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Ramiro Polla <ramiro.polla@gmail.com>
2026-07-22 14:07:37 +00:00