ffmpeg.git
9 hours agoswscale/rgb2rgb: Remove set-but-unused functions master
Andreas Rheinhardt [Sun, 1 Mar 2026 20:50:17 +0000 (21:50 +0100)]
swscale/rgb2rgb: Remove set-but-unused functions

yuy2toyv12, vu9_to_vu12 and yvu9_to_yuy2 are unused. Removing
them saved 7808B of .text and 102B of .text.unlikely
as well as 24B of .bss here.
Thanks to James Almer for pointing out that yuy2toyv12 is unused.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
9 hours agoswscale/rgb2rgb_template: Remove unused uyvytoyv12_c()
Andreas Rheinhardt [Sun, 1 Mar 2026 17:00:02 +0000 (18:00 +0100)]
swscale/rgb2rgb_template: Remove unused uyvytoyv12_c()

Added in 81c0590e6c88b6c0752e52ef77e003cef3eaadf5,
but it seems to have always been unused.
See also 5421dee0e7e0028f59a7285be26fc7f12ae42a8b.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
11 hours agoswscale/vulkan/ops: fix typo
Niklas Haas [Fri, 27 Feb 2026 22:14:37 +0000 (23:14 +0100)]
swscale/vulkan/ops: fix typo

Checks src.interlaced twice.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
11 hours agoswscale/graph: correctly adjust field height for interlaced frames
Niklas Haas [Fri, 27 Feb 2026 22:13:22 +0000 (23:13 +0100)]
swscale/graph: correctly adjust field height for interlaced frames

This is a pre-existing bug from 67f36272671be9405248386bfbc467a6a772d5ce.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
11 hours agoswscale/graph: reintroduce SwsFrame
Niklas Haas [Fri, 27 Feb 2026 20:53:24 +0000 (21:53 +0100)]
swscale/graph: reintroduce SwsFrame

AVFrame just really doesn't have the semantics we want. However, there a
tangible benefit to having SwsFrame act as a carbon copy of a (subset of)
AVFrame.

This partially reverts commit 67f36272671be9405248386bfbc467a6a772d5ce.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
22 hours agoavcodec/x86/huffyuvencdsp_init: Remove pointless av_unused
Andreas Rheinhardt [Thu, 26 Feb 2026 01:46:40 +0000 (02:46 +0100)]
avcodec/x86/huffyuvencdsp_init: Remove pointless av_unused

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
22 hours agoavcodec/x86/huffyuvencdsp: Remove MMX sub_hfyu_median_pred_int16
Andreas Rheinhardt [Thu, 26 Feb 2026 01:44:37 +0000 (02:44 +0100)]
avcodec/x86/huffyuvencdsp: Remove MMX sub_hfyu_median_pred_int16

Superseded by SSE2 and AVX2.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
22 hours agoavcodec/x86/huffyuvencdsp: Add AVX2 sub_hfyu_median_pred_int16
Andreas Rheinhardt [Thu, 26 Feb 2026 01:37:48 +0000 (02:37 +0100)]
avcodec/x86/huffyuvencdsp: Add AVX2 sub_hfyu_median_pred_int16

This version can also process 16bpp.

Benchmarks:
sub_hfyu_median_pred_int16_9bpp_c:                   12667.7 ( 1.00x)
sub_hfyu_median_pred_int16_9bpp_mmxext:               1966.5 ( 6.44x)
sub_hfyu_median_pred_int16_9bpp_sse2:                  997.6 (12.70x)
sub_hfyu_median_pred_int16_9bpp_avx2:                  474.8 (26.68x)
sub_hfyu_median_pred_int16_9bpp_aligned_c:           12604.6 ( 1.00x)
sub_hfyu_median_pred_int16_9bpp_aligned_mmxext:       1964.6 ( 6.42x)
sub_hfyu_median_pred_int16_9bpp_aligned_sse2:          981.9 (12.84x)
sub_hfyu_median_pred_int16_9bpp_aligned_avx2:          462.6 (27.25x)
sub_hfyu_median_pred_int16_16bpp_c:                  12592.5 ( 1.00x)
sub_hfyu_median_pred_int16_16bpp_avx2:                 465.6 (27.04x)
sub_hfyu_median_pred_int16_16bpp_aligned_c:          12587.5 ( 1.00x)
sub_hfyu_median_pred_int16_16bpp_aligned_avx2:         462.5 (27.22x)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
22 hours agoavcodec/x86/huffyuvencdsp: Add SSE2 sub_hfyu_median_pred_int16
Andreas Rheinhardt [Wed, 25 Feb 2026 23:43:09 +0000 (00:43 +0100)]
avcodec/x86/huffyuvencdsp: Add SSE2 sub_hfyu_median_pred_int16

Contrary to the MMXEXT version this version does not overread at all
(the MMXEXT version processes the input of 2*w bytes in eight byte
chunks and overreads by a further six bytes, because it loads
the next left and left top values at the end of the loop,
i.e. it reads FFALIGN(2*w,8)+6 bytes instead of 2*w).

Benchmarks:
sub_hfyu_median_pred_int16_9bpp_c:                   12673.6 ( 1.00x)
sub_hfyu_median_pred_int16_9bpp_mmxext:               1947.7 ( 6.51x)
sub_hfyu_median_pred_int16_9bpp_sse2:                  993.9 (12.75x)
sub_hfyu_median_pred_int16_9bpp_aligned_c:           12596.1 ( 1.00x)
sub_hfyu_median_pred_int16_9bpp_aligned_mmxext:       1956.1 ( 6.44x)
sub_hfyu_median_pred_int16_9bpp_aligned_sse2:          989.4 (12.73x)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
22 hours agoavcodec/huffyuvencdsp: Add width parameter to init
Andreas Rheinhardt [Wed, 25 Feb 2026 20:50:46 +0000 (21:50 +0100)]
avcodec/huffyuvencdsp: Add width parameter to init

This allows to only use certain functions using wide registers
if there is enough work to do and if one can even read a whole
register wide without overreading.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
22 hours agotests/checkasm: Fix huffyuvdsp test criterion
Andreas Rheinhardt [Wed, 25 Feb 2026 20:49:31 +0000 (21:49 +0100)]
tests/checkasm: Fix huffyuvdsp test criterion

Use CONFIG_HUFFYUVDSP, not CONFIG_HUFFYUV_DECODER
(although they are equivalent).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
22 hours agotests/checkasm: Add huffyuvencdsp test
Andreas Rheinhardt [Wed, 25 Feb 2026 20:38:30 +0000 (21:38 +0100)]
tests/checkasm: Add huffyuvencdsp test

Only covers sub_hfyu_median_pred_int16 for now.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
22 hours agoavcodec/huffyuvencdsp: Pass bpp, not AVPixelFormat for init
Andreas Rheinhardt [Wed, 25 Feb 2026 19:33:04 +0000 (20:33 +0100)]
avcodec/huffyuvencdsp: Pass bpp, not AVPixelFormat for init

Avoids having to get a pixel format descriptor.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
22 hours agoavcodec/huffyuvenc: Mark unreachable code as such
Andreas Rheinhardt [Wed, 25 Feb 2026 19:13:50 +0000 (20:13 +0100)]
avcodec/huffyuvenc: Mark unreachable code as such

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
22 hours agoavcodec/huffyuvenc: Calculate mask only once
Andreas Rheinhardt [Wed, 25 Feb 2026 19:00:46 +0000 (20:00 +0100)]
avcodec/huffyuvenc: Calculate mask only once

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
26 hours agoavformat/whip: use av_dict_set_int() for payload_type and ssrc
Jack Lau [Sat, 28 Feb 2026 01:35:44 +0000 (09:35 +0800)]
avformat/whip: use av_dict_set_int() for payload_type and ssrc

Now WHIP can directly pass SSRC as UINT32 instead of
converting it as INT for match wrong rtpenc option
range Since 69568479a9.

And Converting SSRC from UINT32 to INT64 is safe to
pass by av_dict_set_int().

Signed-off-by: Jack Lau <jacklau1222gm@gmail.com>
28 hours agotests/fate/flvenc: add vvc in enhanced flv test case
Steven Liu [Sat, 28 Feb 2026 14:33:22 +0000 (22:33 +0800)]
tests/fate/flvenc: add vvc in enhanced flv test case

28 hours agoavformat/rtmpproto: add vvc1 string into enhanced_codecs list
Steven Liu [Wed, 4 Feb 2026 10:14:53 +0000 (18:14 +0800)]
avformat/rtmpproto: add vvc1 string into enhanced_codecs list

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
28 hours agoavformat/flvdec: support demux vvc in enhanced flv
Steven Liu [Thu, 26 Feb 2026 09:30:18 +0000 (17:30 +0800)]
avformat/flvdec: support demux vvc in enhanced flv

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
28 hours agoavformat/flvenc: support mux vvc in enhanced flv
Steven Liu [Wed, 4 Feb 2026 10:09:06 +0000 (18:09 +0800)]
avformat/flvenc: support mux vvc in enhanced flv

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
34 hours agoavcodec/bsf/extract_extradata: remove dead code
James Almer [Sat, 28 Feb 2026 22:42:06 +0000 (19:42 -0300)]
avcodec/bsf/extract_extradata: remove dead code

Applied accidentally in 3dba9eb80663.

Signed-off-by: James Almer <jamrial@gmail.com>
37 hours agoavcodec/bsf: add a LCEVC metadata bitstream filter
James Almer [Thu, 19 Feb 2026 13:40:48 +0000 (10:40 -0300)]
avcodec/bsf: add a LCEVC metadata bitstream filter

Signed-off-by: James Almer <jamrial@gmail.com>
37 hours agoavcodec/cbs: add support for LCEVC bitstreams
James Almer [Thu, 19 Feb 2026 00:15:17 +0000 (21:15 -0300)]
avcodec/cbs: add support for LCEVC bitstreams

As defined in ISO/IEC 23094-2:2021/FDAM 1:2023

Signed-off-by: James Almer <jamrial@gmail.com>
37 hours agoavcodec/h2645_parse: add support for LCEVC
James Almer [Mon, 16 Feb 2026 14:59:15 +0000 (11:59 -0300)]
avcodec/h2645_parse: add support for LCEVC

Signed-off-by: James Almer <jamrial@gmail.com>
37 hours agoavcodec/bsf/extract_extradata: add support for LCEVC
James Almer [Mon, 16 Feb 2026 14:58:46 +0000 (11:58 -0300)]
avcodec/bsf/extract_extradata: add support for LCEVC

Signed-off-by: James Almer <jamrial@gmail.com>
44 hours agofftools/cmdutils: constify string
Kacper Michajłow [Sat, 28 Feb 2026 02:15:28 +0000 (03:15 +0100)]
fftools/cmdutils: constify string

Fixes:
warning: initializing 'char *' with an expression of type 'const char *'
discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
44 hours agoavfilter/buffersink: use correct enum for alpha_modes
Weixie Cui [Sat, 28 Feb 2026 01:21:27 +0000 (09:21 +0800)]
avfilter/buffersink: use correct enum for alpha_modes

Signed-off-by: Weixie Cui <cuiweixie@gmail.com>
2 days agoswscale/swscale_internal: Move altivec parts to ppc/
Andreas Rheinhardt [Tue, 24 Feb 2026 15:41:07 +0000 (16:41 +0100)]
swscale/swscale_internal: Move altivec parts to ppc/

Up until now, several altivec-specific fields are directly
put into SwsInternal #if HAVE_ALTIVEC is true. These fields
are of altivec-specific vector types and therefore
require altivec specific headers to be included.

Unfortunately, said altivec specific headers redefine
bool in a manner that is incompatible with stdbool.
swscale/ops.h uses bool and this led graph.c and ops.c
to disagree about the layout of structures from ops.h,
leading to heap corruption [1], [2] in the sws-unscaled
FATE test.

Fix this by moving the altivec-specific parts out of SwsInternal
and into a structure that extends SwsInternal and is allocated
jointly with it. Said structure is local to yuv2rgb_altivec.c,
because this is the only file accessing said fields. Should
more files need them, an altivec-specific swscale header would
need to be added.

Thanks to jfiusdq <jfiusdq@proton.me> for analyzing the issue.

[1]: https://fate.ffmpeg.org/report.cgi?slot=ppc64-linux-gcc-14.3-asan&time=20260224065643
[2]: https://fate.ffmpeg.org/report.cgi?slot=ppc64-linux-gcc-14.3&time=20260224051615

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2 days agoswscale/utils: Move altivec init/free code to yuv2rgb_altivec.c
Andreas Rheinhardt [Tue, 24 Feb 2026 14:16:35 +0000 (15:16 +0100)]
swscale/utils: Move altivec init/free code to yuv2rgb_altivec.c

This is in preparation for removing the util_altivec.h inclusion
in swscale_internal.h, which causes problems (on PPC) because
it redefines bool to something different from stdbool.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2 days agoavformat/mov: add support for multiple decryption keys
Adrien Guinet [Mon, 13 Nov 2023 08:40:19 +0000 (09:40 +0100)]
avformat/mov: add support for multiple decryption keys

This commit introduces new options to support more than one decryption
keys:
* add a decryption_keys option to MOV, that supports a dictionary of
  KID=>key (in hex), using AV_OPT_TYPE_DICT
* add the corresponding cenc_decryption_keys option to DASH

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2 days agoavformat/rtpenc: use unsigned type for ssrc option
Neko Asakura [Fri, 20 Feb 2026 20:24:08 +0000 (20:24 +0000)]
avformat/rtpenc: use unsigned type for ssrc option

The ssrc option used AV_OPT_TYPE_INT with range [INT_MIN, INT_MAX],
but the underlying struct field is uint32_t and RFC 3550 defines SSRC
as a 32-bit identifier covering the full [0, UINT32_MAX] range. This
caused ffmpeg to reject any SSRC value above INT_MAX (~2.1 billion),
which is roughly half of all valid values.

The auto-generated fallback path (av_get_random_seed()) already
returns uint32_t and can produce values above INT_MAX, creating an
inconsistency where the automatic path succeeds but the explicit
-ssrc option rejects the same value.

Change the option to AV_OPT_TYPE_UINT with range [0, UINT32_MAX]
to match the field type and allow the full identifier space.

Fixes ticket #9080.

Signed-off-by: Neko Asakura <neko.asakura@outlook.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 days agoavcodec/x86/bswapdsp: Avoid aligned vs unaligned codepaths for AVX2
Andreas Rheinhardt [Fri, 27 Feb 2026 12:54:21 +0000 (13:54 +0100)]
avcodec/x86/bswapdsp: Avoid aligned vs unaligned codepaths for AVX2

For modern cpus (like those supporting AVX2) loads and stores
using the unaligned versions of instructions are as fast
as aligned ones if the address is aligned, so remove
the aligned AVX2 version (and the alignment check) and just
use the unaligned one.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2 days agoavcodec/x86/bswapdsp: combine shifting, avoid check for AVX2
Andreas Rheinhardt [Fri, 27 Feb 2026 12:24:04 +0000 (13:24 +0100)]
avcodec/x86/bswapdsp: combine shifting, avoid check for AVX2

This avoids a check and a shift if >=8 elements are processed;
it adds a check if < 8 elements are processed (which should
be rare).
No change in benchmarks here.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2 days agoavcodec/x86/bswapdsp: Avoid register copies
Andreas Rheinhardt [Fri, 27 Feb 2026 12:19:47 +0000 (13:19 +0100)]
avcodec/x86/bswapdsp: Avoid register copies

No change in benchmarks here.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2 days agotests/checkasm: Fix whitespace cosmetics
Niklas Haas [Wed, 17 Dec 2025 16:57:23 +0000 (17:57 +0100)]
tests/checkasm: Fix whitespace cosmetics

This line was left misaligned in
b863b81500f374a2829e9dfb3a244c61e3fc1a60.

2 days agotests/checkasm/sw_ops: Switch to opaques for deciding when to test
Martin Storsjö [Wed, 25 Feb 2026 13:45:23 +0000 (15:45 +0200)]
tests/checkasm/sw_ops: Switch to opaques for deciding when to test

This uses the new mechanisms introduced in
cf7e2b67735d500768b06c6f411826bfef923b0f, as used by the crc test
in 0629ebb5ffda39add5f1fbce524bbc989ba5d6c6.

2 days agoswscale/ops_backend: mark unreachable branch
Ramiro Polla [Fri, 27 Feb 2026 16:07:42 +0000 (17:07 +0100)]
swscale/ops_backend: mark unreachable branch

The pixel format for the process loops have already been checked at
this point to be valid.

The switch added in e4abfb8e519 returns AVERROR(EINVAL) in the default
case without calling ff_sws_op_chain_free(chain), but there's no need
to free it since we mark this branch as unreachable.

2 days agoswscale/graph: nuke SwsImg
Niklas Haas [Fri, 27 Feb 2026 10:02:38 +0000 (11:02 +0100)]
swscale/graph: nuke SwsImg

This has now become fully redundant with AVFrame, especially since the
existence of SwsPassBuffer. Delete it, simplifying a lot of things and
avoiding reinventing the wheel everywhere.

Also generally reduces overhead, since there is less redundant copying
going on.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2 days agoswscale/graph: move frame->field init logic to SwsGraph
Niklas Haas [Thu, 26 Feb 2026 18:13:13 +0000 (19:13 +0100)]
swscale/graph: move frame->field init logic to SwsGraph

And have ff_sws_graph_run() just take a bare AVFrame. This will help with
an upcoming change, aside from being a bit friendlier towards API users
in general.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2 days agoswscale/graph: don't pointlessly align data buffers
Niklas Haas [Thu, 26 Feb 2026 19:21:59 +0000 (20:21 +0100)]
swscale/graph: don't pointlessly align data buffers

Since d67d81a3748aa877c9c9, enabling asm explicitly requires aligned malloc,
so this FFALIGN accomplishes nothing.

Signed-off-by: Niklas Haas <git@haasn.dev>
2 days agoswscale/graph: use AVFrame to track internal allocation
Niklas Haas [Thu, 26 Feb 2026 17:07:58 +0000 (18:07 +0100)]
swscale/graph: use AVFrame to track internal allocation

This commit replaces the AVBufferRef inside SwsPassBuffer by an AVFrame, in
anticipation of the SwsImg removal.

Incidentally, we could also now just use av_frame_get_buffer() here, but
at the cost of breaking the 1:1 relationship between planes and buffers,
which is required for per-plane refcopies.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2 days agoswscale/graph: avoid stack copies of SwsImg
Niklas Haas [Thu, 26 Feb 2026 15:49:19 +0000 (16:49 +0100)]
swscale/graph: avoid stack copies of SwsImg

In the process of nuking this abstraction in favor of AVFrame.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2 days agoswscale/graph: simplify output buffer management
Niklas Haas [Sat, 21 Feb 2026 15:50:40 +0000 (16:50 +0100)]
swscale/graph: simplify output buffer management

This function was originally written to support the use case of e.g.
partially allocated planes that implicitly reference the original input
image, but I've decided that this is stupid and doesn't currently work
anyways.

Plus, I have plans to kill SwsImg, so we need to simplify this mess.

Signed-off-by: Niklas Haas <git@haasn.dev>
2 days agoswscale/ops: don't set src/dst_frame_ptr in op_pass_run()
Niklas Haas [Thu, 26 Feb 2026 17:15:02 +0000 (18:15 +0100)]
swscale/ops: don't set src/dst_frame_ptr in op_pass_run()

Already set by setup().

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2 days agoswscale/ops: correctly shift pointers for last row handling
Niklas Haas [Fri, 27 Feb 2026 10:00:39 +0000 (11:00 +0100)]
swscale/ops: correctly shift pointers for last row handling

The current logic didn't take into account the possible plane shift. Just
re-compute the correctly shifted pointers using the row position.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2 days agoswscale/ops: avoid stack copies of SwsImg
Niklas Haas [Fri, 27 Feb 2026 09:48:06 +0000 (10:48 +0100)]
swscale/ops: avoid stack copies of SwsImg

Instead, precompute the correctly swizzled data and stride in setup()
and just reference the SwsOpExec fields directly.

To avoid the stack copies in handle_tail() we can introduce a temporary
array to hold just the pointers.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2 days agoswscale/ops: add subsampling shift to SwsOpExec
Niklas Haas [Fri, 27 Feb 2026 09:30:00 +0000 (10:30 +0100)]
swscale/ops: add subsampling shift to SwsOpExec

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2 days agoavformat/mov: fix cases where we discard iamf packets from enabled streams
James Almer [Fri, 27 Feb 2026 13:41:31 +0000 (10:41 -0300)]
avformat/mov: fix cases where we discard iamf packets from enabled streams

Given the entire iamf struct is inside a single Track, if the first iamf stream
(which is the one sharing the index and id from the Track) was to be disabled,
then packets from every iamf stream would be discarded.
Fix this by actually going through the entire iamf Sample and discarding those
from the disabled streams only.

Signed-off-by: James Almer <jamrial@gmail.com>
2 days agoavformat/mov: fix setting iamf stream id offsets
James Almer [Fri, 27 Feb 2026 13:38:14 +0000 (10:38 -0300)]
avformat/mov: fix setting iamf stream id offsets

If we were to add the highest id of a non iamf stream as offset to iamf stream
ids, and one of the latter was 0, then an id overlap would ocurr.

Signed-off-by: James Almer <jamrial@gmail.com>
2 days agoavformat/whip: skip the unmatch nack packet through ssrc
Jack Lau [Sat, 24 Jan 2026 12:01:55 +0000 (20:01 +0800)]
avformat/whip: skip the unmatch nack packet through ssrc

Signed-off-by: Jack Lau <jacklau1222gm@gmail.com>
2 days agoavformat/whip: add missing ":" in "a=rtcp-fb" when generate sdp
Jack Lau [Tue, 20 Jan 2026 12:32:49 +0000 (20:32 +0800)]
avformat/whip: add missing ":" in "a=rtcp-fb" when generate sdp

Signed-off-by: Jack Lau <jacklau1222gm@gmail.com>
2 days agoavformat/whip: add RTX support
Jack Lau [Tue, 20 Jan 2026 12:30:18 +0000 (20:30 +0800)]
avformat/whip: add RTX support

See https://datatracker.ietf.org/doc/html/rfc4588

Parse sequence number from NACKs, then create RTX
packet and send it.

Signed-off-by: Jack Lau <jacklau1222gm@gmail.com>
avformat/whip: set NACK logs as DEBUG

Signed-off-by: Jack Lau <jacklau1222gm@gmail.com>
2 days agoavformat/whip: add rtp history store and find method
Jack Lau [Fri, 3 Oct 2025 02:33:55 +0000 (10:33 +0800)]
avformat/whip: add rtp history store and find method

This patch aims to enable rtp history store for RTX

Signed-off-by: Jack Lau <jacklau1222@qq.com>
2 days agoavformat/http: add -request-size option
Niklas Haas [Mon, 9 Feb 2026 15:56:25 +0000 (16:56 +0100)]
avformat/http: add -request-size option

It has come to my attention that a way to limit the request range size
would be useful in general, for reasons beyond just speeding up initial
header parsing.

This patch generalizez -initial_request_size to -request_size. I decided
to continue allowing both options to be used simultaneously, so users can
e.g. set -request_size to something large like 10 MiB, but still use a smaller
size for initial header parsing (e.g. 256 KiB).

Fixes: https://github.com/mpv-player/mpv/issues/8655

3 days agoswscale/x86/ops: fix MSVC compiler error
Niklas Haas [Fri, 27 Feb 2026 07:59:25 +0000 (08:59 +0100)]
swscale/x86/ops: fix MSVC compiler error

src/libswscale/x86/ops.c(534): error C2099: initializer is not a constant
src/libswscale/x86/ops.c(535): error C2099: initializer is not a constant
src/libswscale/x86/ops.c(536): error C2099: initializer is not a constant
src/libswscale/x86/ops.c(537): error C2099: initializer is not a constant
src/libswscale/x86/ops.c(539): error C2099: initializer is not a constant
src/libswscale/x86/ops.c(540): error C2099: initializer is not a constant

Fixes: ec959e20c5852e288f3d7bbecb8b09303a53c61b
Signed-off-by: Niklas Haas <git@haasn.dev>
3 days agoconfigure: add pkg-config check for amr related libs
Jack Lau [Fri, 12 Dec 2025 12:30:37 +0000 (20:30 +0800)]
configure: add pkg-config check for amr related libs

This patch doesn't break previous approach, just add
one possible valid method to find the lib.

Signed-off-by: Jack Lau <jacklau1222gm@gmail.com>
3 days agoavformat/tls_openssl: use SHA-256 instead of SHA-1 for self-signed cert
Nariman-Sayed [Sat, 21 Feb 2026 21:37:36 +0000 (23:37 +0200)]
avformat/tls_openssl: use SHA-256 instead of SHA-1 for self-signed cert

SHA-1 is deprecated and considered cryptographically weak.
Replace EVP_sha1() with EVP_sha256() when signing self-generated
certificates to comply with modern security standards.

3 days agoswscale/swscale: fix typos
Ramiro Polla [Thu, 26 Feb 2026 16:46:26 +0000 (17:46 +0100)]
swscale/swscale: fix typos

3 days agoswscale/format: add assertion to guard UB
Niklas Haas [Sat, 21 Feb 2026 14:45:58 +0000 (15:45 +0100)]
swscale/format: add assertion to guard UB

AVRational still can't handle 32-bit values...

Signed-off-by: Niklas Haas <git@haasn.dev>
3 days agoswscale/format: check pixel type in ff_sws_encode/decode_colors()
Niklas Haas [Sat, 21 Feb 2026 14:44:16 +0000 (15:44 +0100)]
swscale/format: check pixel type in ff_sws_encode/decode_colors()

This would otherwise generate illegal ops and undefined behavior, for
pixel formats without any supported corresponding pixel type.

This didn't cause any issues previously because the following
`ff_sws_encode_pixfmt` would normally fail for such formats, and the UB
was ignored in practice.

Signed-off-by: Niklas Haas <git@haasn.dev>
3 days agoswscale/ops: reorder fields in SwsOpList
Niklas Haas [Fri, 20 Feb 2026 18:52:53 +0000 (19:52 +0100)]
swscale/ops: reorder fields in SwsOpList

For some reason, this avoids triggering a compiler bug in gcc-15 on PowerPC,
that was introduced with commit da47951bd7b0dc8bfb8.

3 days agotests/swscale: disable fate-sws-ops-list on BE platforms
Niklas Haas [Fri, 20 Feb 2026 16:50:39 +0000 (17:50 +0100)]
tests/swscale: disable fate-sws-ops-list on BE platforms

The issue is that every le/be pair ends up with a swapped op list:

 rgb24 -> rgb48be:
   [ u8 XXXX -> +++X] SWS_OP_READ         : 3 elem(s) packed >> 0
   [ u8 ...X -> +++X] SWS_OP_CONVERT      : u8 -> u16 (expand)
-  [u16 ...X -> zzzX] SWS_OP_SWAP_BYTES
-  [u16 ...X -> zzzX] SWS_OP_WRITE        : 3 elem(s) packed >> 0
+  [u16 ...X -> +++X] SWS_OP_WRITE        : 3 elem(s) packed >> 0
     (X = unused, z = byteswapped, + = exact, 0 = zero)
 rgb24 -> rgb48le:
   [ u8 XXXX -> +++X] SWS_OP_READ         : 3 elem(s) packed >> 0
   [ u8 ...X -> +++X] SWS_OP_CONVERT      : u8 -> u16 (expand)
-  [u16 ...X -> +++X] SWS_OP_WRITE        : 3 elem(s) packed >> 0
+  [u16 ...X -> zzzX] SWS_OP_SWAP_BYTES
+  [u16 ...X -> zzzX] SWS_OP_WRITE        : 3 elem(s) packed >> 0
     (X = unused, z = byteswapped, + = exact, 0 = zero)

I'm not sure of a good work-around that's not needlessly difficult to
implement, so just disable it on BE platforms for now. The actual underlying
conversions should still be covered by the sws-unscaled test.

3 days agoswscale/format: pass SwsFormat by ref instead of by value where possible
Niklas Haas [Fri, 20 Feb 2026 16:39:46 +0000 (17:39 +0100)]
swscale/format: pass SwsFormat by ref instead of by value where possible

The one exception is in adapt_colors(), which mutates these structs on
its own stack anyways.

3 days agoswscale/format: don't mark single byte formats as byte swapped
Niklas Haas [Fri, 20 Feb 2026 15:59:07 +0000 (16:59 +0100)]
swscale/format: don't mark single byte formats as byte swapped

Fixes a bug where all format lists contained redundant byte swapped
annotations on big-endian platforms, even for single-byte formats.

3 days agoswscale/output: Fix some integer overflows in yuv2rgba64_full*()
Michael Niedermayer [Thu, 12 Feb 2026 23:16:24 +0000 (00:16 +0100)]
swscale/output: Fix some integer overflows in yuv2rgba64_full*()

Fixes: integer overflows
Fixes: 471587361/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-5015347829997568

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 days agoChangelog: add entry about swscale Vulkan support
Lynne [Thu, 26 Feb 2026 09:33:58 +0000 (10:33 +0100)]
Changelog: add entry about swscale Vulkan support

The SW in swscale can stand for something else now.

Sponsored-by: Sovereign Tech Fund
3 days agoswscale/vulkan: initialize GLSL compilation and shader execution
Lynne [Mon, 23 Feb 2026 21:11:44 +0000 (22:11 +0100)]
swscale/vulkan: initialize GLSL compilation and shader execution

Sponsored-by: Sovereign Tech Fund
3 days agoswscale: add support for processing hardware frames
Lynne [Wed, 25 Feb 2026 14:14:48 +0000 (15:14 +0100)]
swscale: add support for processing hardware frames

Sponsored-by: Sovereign Tech Fund
3 days agoswscale: add a Vulkan backend for ops.c
Lynne [Mon, 23 Feb 2026 20:04:02 +0000 (21:04 +0100)]
swscale: add a Vulkan backend for ops.c

Sponsored-by: Sovereign Tech Fund
3 days agoswscale/ops: add SwsOpBackend.hw_format
Lynne [Wed, 25 Feb 2026 18:14:22 +0000 (19:14 +0100)]
swscale/ops: add SwsOpBackend.hw_format

Allows to filter hardware formats.

Sponsored-by: Sovereign Tech Fund
3 days agoswscale: forward original frame pointers to ops.c backend
Lynne [Tue, 24 Feb 2026 18:10:09 +0000 (19:10 +0100)]
swscale: forward original frame pointers to ops.c backend

Sponsored-by: Sovereign Tech Fund
3 days agoswscale/ops: realign after adding slice_align
Lynne [Mon, 23 Feb 2026 21:29:22 +0000 (22:29 +0100)]
swscale/ops: realign after adding slice_align

This is a separate commit since it makes it easier to see the changes.

Sponsored-by: Sovereign Tech Fund
3 days agoswscale: add SwsCompiledOp.slice_align
Lynne [Mon, 23 Feb 2026 20:12:34 +0000 (21:12 +0100)]
swscale: add SwsCompiledOp.slice_align

Certain backends may not support (or need) slices, since they
would handle slicing themselves.

Sponsored-by: Sovereign Tech Fund
3 days agoswscale: add SwsFormat.hw_format and populate it
Lynne [Mon, 23 Feb 2026 18:22:18 +0000 (19:22 +0100)]
swscale: add SwsFormat.hw_format and populate it

Sponsored-by: Sovereign Tech Fund
3 days agovulkan_spirv: reduce shader print level from TRACE to DEBUG
Lynne [Thu, 26 Feb 2026 13:00:06 +0000 (14:00 +0100)]
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
3 days agovulkan: constify FFVulkanShader arg in ff_vk_exec_bind_shader
Lynne [Mon, 23 Feb 2026 21:11:17 +0000 (22:11 +0100)]
vulkan: constify FFVulkanShader arg in ff_vk_exec_bind_shader

Sponsored-by: Sovereign Tech Fund
3 days agovulkan: reset exec context when uninitializing
Lynne [Thu, 26 Feb 2026 10:48:13 +0000 (11:48 +0100)]
vulkan: reset exec context when uninitializing

Sponsored-by: Sovereign Tech Fund
3 days agoswscale: add sws_test_hw_format()
Niklas Haas [Thu, 26 Feb 2026 11:40:33 +0000 (12:40 +0100)]
swscale: add sws_test_hw_format()

Allows users to test if a given hardware pixel format is supported by swscale.
This is only a rough heuristic anyways, because the actual support may
depend on the specific *combination* of frame attributes, and ultimately
is better served by the `sws_test_frame` and `sws_frame_setup()` APIs anyways.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
3 days agoswscale/ops_optimizer: eliminate unnecessary dither indices
Niklas Haas [Wed, 25 Feb 2026 16:29:43 +0000 (17:29 +0100)]
swscale/ops_optimizer: eliminate unnecessary dither indices

Generates a lot of incremental diffs due to things like ignored alpha
planes or chroma planes that are not actually modified.

e.g.

 bgr24 -> gbrap10be:
   [ u8 XXXX -> +++X] SWS_OP_READ         : 3 elem(s) packed >> 0
   [ u8 ...X -> +++X] SWS_OP_CONVERT      : u8 -> f32
   [f32 ...X -> ...X] SWS_OP_SCALE        : * 341/85
-  [f32 ...X -> ...X] SWS_OP_DITHER       : 16x16 matrix + {2 3 0 5}
+  [f32 ...X -> ...X] SWS_OP_DITHER       : 16x16 matrix + {2 3 0 -1}
   [f32 ...X -> ...X] SWS_OP_MIN          : x <= {1023 1023 1023 1023}
   [f32 ...X -> +++X] SWS_OP_CONVERT      : f32 -> u16
   [u16 ...X -> zzzX] SWS_OP_SWAP_BYTES
   [u16 ...X -> zzzX] SWS_OP_SWIZZLE      : 1023
   [u16 ...X -> zzz+] SWS_OP_CLEAR        : {_ _ _ 65283}
   [u16 .... -> zzz+] SWS_OP_WRITE        : 4 elem(s) planar >> 0
     (X = unused, z = byteswapped, + = exact, 0 = zero)

Signed-off-by: Niklas Haas <git@haasn.dev>
3 days agoswscale/x86/ops: add support for optional dither indices
Niklas Haas [Wed, 25 Feb 2026 16:00:07 +0000 (17:00 +0100)]
swscale/x86/ops: add support for optional dither indices

Instead of defining multiple patterns for the dither ops, just define a
single generic function that branches internally. The branch is well-predicted
and ridiculously cheap. At least on my end, within margin of error.

Signed-off-by: Niklas Haas <git@haasn.dev>
3 days agoswscale/x86/ops: don't preload dither weights
Niklas Haas [Wed, 25 Feb 2026 14:19:32 +0000 (15:19 +0100)]
swscale/x86/ops: don't preload dither weights

This doesn't actually gain any performance but makes the code needlessly
complicated. Just directly add the indirect address as needed.

Signed-off-by: Niklas Haas <git@haasn.dev>
3 days agoswscale/x86/ops: split off dither0 special case
Niklas Haas [Wed, 25 Feb 2026 14:08:34 +0000 (15:08 +0100)]
swscale/x86/ops: split off dither0 special case

I want to rewrite the dither kernel a bit, and this special case is a bit
too annoying and gets in the way.

Signed-off-by: Niklas Haas <git@haasn.dev>
3 days agoswscale/ops_backend: implement support for optional dither indices
Niklas Haas [Wed, 25 Feb 2026 15:52:09 +0000 (16:52 +0100)]
swscale/ops_backend: implement support for optional dither indices

If you place the branch inside the loop, gcc at least reverts back to scalar
code, so better to just split up and guard the entire loop.

Signed-off-by: Niklas Haas <git@haasn.dev>
3 days agoswscale/ops: allow excluding components from SWS_OP_DITHER
Niklas Haas [Wed, 25 Feb 2026 15:46:04 +0000 (16:46 +0100)]
swscale/ops: allow excluding components from SWS_OP_DITHER

We often need to dither only a subset of the components. Previously this
was not possible, but we can just use the special value -1 for this.

The main motivating factor is actually the fact that "unnecessary" dither ops
would otherwise frequently prevent plane splitting, since e.g. a copied
alpha plane has to come along for the ride through the whole F32/dither
pipeline.

Additionally, it somewhat simplifies implementations.

Signed-off-by: Niklas Haas <git@haasn.dev>
3 days agoconfigure: re-enable memalign for Haiku
Adrien Destugues [Wed, 7 Aug 2019 13:21:32 +0000 (16:21 +0300)]
configure: re-enable memalign for Haiku

This had been disabled in 2011:
https://lists.ffmpeg.org/pipermail/ffmpeg-cvslog/2011-June/038362.html

If there are still problems with it we should rather fix them on Haiku
side.

Signed-off-by: Niklas Haas <git@haasn.dev>
See-Also: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22233

3 days agoconfigure: don't support asm without memalign
Niklas Haas [Fri, 20 Feb 2026 19:36:34 +0000 (20:36 +0100)]
configure: don't support asm without memalign

I tried it, and it broke horribly. We should definitively rule out this.

Unfortunately, it's not as easy as just setting `disable asm` here, because
asm having been enabled will already have affected the build process further
upstream - conversely, we don't know whether or not memalign exists until
fairly late in the build process, and I'm not about to go destroying
the current organization of the file just to work around this.

So an error message it is.

3 days agoswscale/unscaled: fix rgbToRgbWrapper for YUVX
Niklas Haas [Tue, 24 Feb 2026 18:01:05 +0000 (19:01 +0100)]
swscale/unscaled: fix rgbToRgbWrapper for YUVX

This code calculates the pixel step using c->dstFormatBpp, which is wrong;
should use the pixdesc step instead. (dstFormatBpp is 3 for YUVX, but
the actual pixel step is 4 bytes)

This bug was mostly hidden by the fact that the same bug actually disabled
the fast path for the (common) case of strStride == dstStride. Uncovered while
making changes to the swscale.c allocation code.

Reproduced by modifying libswscale in such a way that the dst buffer stride
happened to be exactly 4/3 larger than the src buffer stride, e.g. by adding
extra padding to each dst buffer line, but reproducible in principle by any
API user.

Signed-off-by: Niklas Haas <git@haasn.dev>
3 days agoswscale/unscaled: fix packedCopyWrapper for bitstream formats
Niklas Haas [Tue, 24 Feb 2026 17:41:04 +0000 (18:41 +0100)]
swscale/unscaled: fix packedCopyWrapper for bitstream formats

The assumption that w < stride is not held for such formats. Rather than
this brittle logic we can just always copy the smaller of the two strides.
This is unlikely to affect anything in practice, since usually AVFrames with
the same size and format have matching linesizes, and so the fast path should
be taken. However, in the unlikely case that they don't agree, this fixes an
assertion failure when copying monow to monow.

Reproduced by modifying libswscale to pick a larger-than-normal dst buffer
alignment (and corresponding linesize), but reproducible in principle by any
API user.

Signed-off-by: Niklas Haas <git@haasn.dev>
3 days agoswscale/ops: avoid UB in handle_tail()
Niklas Haas [Tue, 24 Feb 2026 11:58:30 +0000 (12:58 +0100)]
swscale/ops: avoid UB in handle_tail()

Stupid NULL + 0 rule.

Signed-off-by: Niklas Haas <git@haasn.dev>
3 days agoswscale/ops_backend: avoid UB from incorrect function signature
Niklas Haas [Tue, 24 Feb 2026 11:54:27 +0000 (12:54 +0100)]
swscale/ops_backend: avoid UB from incorrect function signature

Annoying C-ism; we can't overload the function type even though they will
always be pointers. We can't even get away with using (void *) in the
function signature, despite casts to void * being technically valid.

Avoid the issue altogether by just moving the process loop into the
type-specific template altogether, and just referring to the correct
compiled process function at runtime. Hopefully, the compiler should be
able to optimize these into a single implementation. GCC, at least, compiles
these down into a single implementation plus three stubs that just jmp
to the correct one.

Signed-off-by: Niklas Haas <git@haasn.dev>
3 days agoswscale/x86/ops: add special case for expanding bits to bytes/words
Niklas Haas [Tue, 24 Feb 2026 11:41:38 +0000 (12:41 +0100)]
swscale/x86/ops: add special case for expanding bits to bytes/words

Not super useful but also not expensive to carry.

monob -> gbrp:
 Before: time=84 us, ref=137 us, speedup=1.618x faster
 After:  time=23 us, ref=185 us, speedup=7.773x faster

monob -> gray16le:
 Before: time=75 us, ref=108 us, speedup=1.440x faster
 After:  time=20 us, ref=108 us, speedup=5.192x faster

Signed-off-by: Niklas Haas <git@haasn.dev>
3 days agoswscale/ops_chain: add ability to match fixed scale factor
Niklas Haas [Tue, 24 Feb 2026 11:24:57 +0000 (12:24 +0100)]
swscale/ops_chain: add ability to match fixed scale factor

This is useful especially for the special case of scaling by common
not-quite-power-of-two constants like 255 or 1023.

Signed-off-by: Niklas Haas <git@haasn.dev>
3 days agoswscale/x86/ops: allow matching planar rw against 1-element packed fmt
Niklas Haas [Tue, 24 Feb 2026 10:51:18 +0000 (11:51 +0100)]
swscale/x86/ops: allow matching planar rw against 1-element packed fmt

Otherwise, the x86 backend fails to serve e.g. rgb565le.

For -src rgb565le:
 Before: Overall speedup=2.210x faster, min=0.256x max=60.465x
 After:  Overall speedup=4.929x faster, min=0.638x max=181.260x

Signed-off-by: Niklas Haas <git@haasn.dev>
3 days agoswscale/x86/ops: properly mark SWS_OP_SCALE as flexible
Niklas Haas [Tue, 24 Feb 2026 11:24:32 +0000 (12:24 +0100)]
swscale/x86/ops: properly mark SWS_OP_SCALE as flexible

3 days agoswscale/ops_chain: properly mark unreachable branch
Niklas Haas [Tue, 24 Feb 2026 11:21:11 +0000 (12:21 +0100)]
swscale/ops_chain: properly mark unreachable branch

By breaking to the `av_unreachable` below. This branch is unreachable because
of the `if (entry->flexible)` branch further above.

Signed-off-by: Niklas Haas <git@haasn.dev>
3 days agoChangelog: add entry for recent Vulkan compute codec optimizations
Lynne [Thu, 26 Feb 2026 09:31:06 +0000 (10:31 +0100)]
Changelog: add entry for recent Vulkan compute codec optimizations

All the compute codecs were ported to compile-time SPIR-V, thoroughly
debugged, and optimized. They're ready for prime-time.

4 days agodoc/developer: Add Forgejo as a way to send patches
Jack Lau [Wed, 25 Feb 2026 22:49:32 +0000 (06:49 +0800)]
doc/developer: Add Forgejo as a way to send patches

Signed-off-by: Jack Lau <jacklau1222gm@gmail.com>
4 days agoavfilter: use int instead of enum for AVOption fields
Zhao Zhili [Sun, 25 Jan 2026 14:30:58 +0000 (22:30 +0800)]
avfilter: use int instead of enum for AVOption fields

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
4 days agoavformat: use int instead of enum for AVOption fields
Zhao Zhili [Sun, 25 Jan 2026 14:14:05 +0000 (22:14 +0800)]
avformat: use int instead of enum for AVOption fields

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
4 days agoavcodec: use int instead of enum for AVOption fields
Zhao Zhili [Sun, 25 Jan 2026 14:07:44 +0000 (22:07 +0800)]
avcodec: use int instead of enum for AVOption fields

AVOption with AV_OPT_TYPE_INT assumes the field is int (4 bytes),
but enum size is implementation-defined and may be smaller.
This can cause memory corruption when AVOption writes 4 bytes
to a field that is only 1-2 bytes, potentially overwriting
adjacent struct members.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>