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

125308 Commits

Author SHA1 Message Date
Michael Niedermayer
d66e84695b Bump minor after release/9.0 branch on master
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
n9.1-dev
2026-06-26 02:47:51 +02:00
Michael Niedermayer
47e9d68e20 Bump minor for release/9.0
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-26 02:43:34 +02:00
Michael Niedermayer
b140509940 pre branch Update
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-26 02:26:01 +02:00
Diego de Souza
41d8d12cc2 avcodec/nvenc: accept P012/P212/YUV444P12MSB input (truncated to 10-bit)
NVDEC and CUVID now output AV_PIX_FMT_P012 (12-bit 4:2:0),
AV_PIX_FMT_P212 (12-bit 4:2:2) and AV_PIX_FMT_YUV444P12MSB (12-bit 4:4:4)
for high-bit-depth content, but nvenc rejected them: nvenc_map_buffer_format()
returned NV_ENC_BUFFER_FORMAT_UNDEFINED, so a pipeline such as
"-hwaccel cuda -i 12bit.mp4 -c:v hevc_nvenc" failed with EINVAL.

NVENC has no native 12-bit encode format. As is already done for the
16-bit inputs (P016, YUV444P16, GBRP16), accept the 12-bit formats and
map them to the 10-bit NVENC buffer formats, truncating the two least
significant bits: P012 -> YUV420_10BIT, P212 -> P210, YUV444P12MSB ->
YUV444_10BIT. They are added to the supported input format list and to
the IS_10BIT / IS_YUV444 / IS_YUV422 helpers accordingly.

Signed-off-by: Diego de Souza <ddesouza@nvidia.com>
2026-06-25 21:45:06 +00:00
Bogdan Lisman
b5ef72c16b tests/fate/filter-video: gate mcdeint testsrc tests on scale filter
fate-filter-mcdeint-slow and -slow-edge feed testsrc (RGB24 only) into
mcdeint (YUV420P/YUV444P only), so ffmpeg auto-inserts a scale filter to
convert the pixel format.  That conversion needs swscale, so both tests
fail to configure the filter graph under --disable-swscale:

    Error configuring filter graph: Invalid argument
    Conversion failed!

Reported by the x86_64-archlinux-gcc-disableswscale FATE slot.  Add
SCALE_FILTER to their dependency list so they are skipped when the scale
filter (and thus swscale) is unavailable, matching the existing
convention for conversion-dependent FATE tests.

Signed-off-by: Bogdan Lisman <bogdan@pydevsolutions.com>
2026-06-25 16:39:27 +00:00
Niklas Haas
e5a3c5e409 avformat/http: accept case-insensitive Connection header value
RFC 9110 defines this as case-insensitive, and some servers (e.g. MythTV)
send it as "Close" instead of "close".

See-Also: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/23222
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-25 15:50:43 +00:00
Niklas Haas
bd51105806 avformat/http: infer default s->willclose based on request header
If we send `Connection: close` but don't get any response Connection header
back from the HTTP server, we should still assume the server will close our
connection.

There is a minor bit of ambiguity about what state to assume if the user
overrode the "Connection:" header, but I'm optimistically leaning in
favor of keep-alive as the more likely value for a user to set.

Not updating our internal state tracking as a result of user-provided
headers overriding our own headers is a prior problem with http.c that is
outside the scope of this PR to fix.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-25 15:50:43 +00:00
Martin Storsjö
1499c4ac6d avformat/tls_openssl: Add a missing <string.h> include
This is needed when building with OpenSSL enabled on macOS after
c32a719cb2.

The tls_openssl.c contains a number of explicit calls to strlen(),
which require including <string.h>.
2026-06-25 15:34:04 +03:00
Martin Storsjö
b2b37802a9 configure: Check for division of __int128
This fixes detection on toolchains where the compiler is able to
compile code with __int128, but the toolchain doesn't automatically
link in suitable helper functions needed for handling division.
(In practice, clang targeting MSVC environments.)
2026-06-25 11:15:10 +00:00
Martin Storsjö
93ebde18e1 checkasm: Trim out unused upstream files
We only need the source files themselves; keep them and the
LICENSE file.
2026-06-25 12:47:17 +03:00
Martin Storsjö
d5d62e04b9 tools: Add a script for updating the checkasm subtree
Trim out any files we don't need downstream.

Automate doing the subtree merges, and automate resolving the
conflicts for updates for files that we want to have removed.
If updates end up with other conflicts, the script (or in practice,
git) exits without creating the intended merge commit - but
regular updates should run automatically.
2026-06-25 12:46:50 +03:00
Niklas Haas
f947bc9c15 tests/fate/swscale: skip fate-sws-uops-macros without int128
This is very slow otherwise (10x slower than with native int128). Developers
can still manually run it if they need to, but we should exclude it from
the default FATE target.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-25 01:20:48 +02:00
Niklas Haas
fe3e67556b swscale/ops_optimizer: remove unneeded 32-bit overflow check
No longer needed with AVRational64. Now we can just apply_op_q(), on
everything except floating point types (which are still not representable
in AVRational64 and likely never will be, though this is mostly a moot
point as the uops layer can still optimize this further).

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-25 01:20:48 +02:00
Niklas Haas
1257f26120 swscale/ops: make ff_sws_apply_op_q slightly more robust
Switch on the exact pixel type and add a range assertion.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-25 01:20:48 +02:00
Niklas Haas
b9481ae3c2 swscale/format: remove no longer needed overflow check
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-25 01:20:48 +02:00
Niklas Haas
d04f7b17c7 tests/checkasm/sw_ops: eliminate unneeded overflow check
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-25 01:20:48 +02:00
Niklas Haas
3743d2851d swscale/ops: switch from AVRational to AVRational64
This has two immediate consequences:

1. Fixes overflow in the range tracker for some 32-bit packed formats:

 rgb24 -> v30xbe:
   [ u8 +++X] SWS_OP_READ         : 3 elem(s) packed >> 0
     min: {0 0 0 _}, max: {255 255 255 _}
   [ u8 +++X] SWS_OP_CONVERT      : u8 -> f32
     min: {0 0 0 _}, max: {255 255 255 _}
   [f32 ...X] SWS_OP_LINEAR       : matrix3+off3 [...]
     min: {64 64 64 _}, max: {940 960 960 _}
   [f32 ...X] SWS_OP_DITHER       : 16x16 matrix + {0 3 2 -1}
     min: {64.001953 64.001953 64.001953 _}, max: {940.998047 960.998047 960.998047 _}
   [f32 +++X] SWS_OP_CONVERT      : f32 -> u32
     min: {64 64 64 _}, max: {940 960 960 _}
   [u32 +++X] SWS_OP_SWIZZLE      : 2013
     min: {64 64 64 _}, max: {960 940 960 _}
   [u32 ++++] SWS_OP_CLEAR        : {_ _ _ 1}
     min: {64 64 64 1}, max: {960 940 960 1}
   [u32 +XXX] SWS_OP_PACK         : {10 10 10 2}
-    min: {268697857 _ _ _}, max: {-264581375 _ _ _}
+    min: {268697857 _ _ _}, max: {4030385921 _ _ _}
   [u32 zXXX] SWS_OP_SWAP_BYTES
-    min: {268697857 _ _ _}, max: {-264581375 _ _ _}
+    min: {268697857 _ _ _}, max: {4030385921 _ _ _}

2. Slightly increases the accuracy of intermediate values for some linear ops:

 yuv444p10be -> rgb48be:
   [u16 zzzX] SWS_OP_READ         : 3 elem(s) planar >> 0
     min: {0 0 0 _}, max: {1023 1023 1023 _}
   [u16 +++X] SWS_OP_SWAP_BYTES
     min: {0 0 0 _}, max: {1023 1023 1023 _}
   [u16 +++X] SWS_OP_CONVERT      : u16 -> f32
     min: {0 0 0 _}, max: {1023 1023 1023 _}
   [f32 ...X] SWS_OP_LINEAR       : matrix3+off3 [...]
46.813777] [0 0 0 1 0]]
-    min: {-57290.842348 -44341.337325 -71146.813777 _}, max: {124144.718860 111375.162457 137973.627845 _}
+    min: {-57290.842348 -44341.337326 -71146.813777 _}, max: {124144.718860 111375.162457 137973.627845 _}
   [f32 ...X] SWS_OP_MAX          : {0 0 0 _} <= x
     min: {0 0 0 _}, max: {124144.718860 111375.162457 137973.627845 _}
   [f32 ...X] SWS_OP_MIN          : x <= {65535 65535 65535 _}
     min: {0 0 0 _}, max: {65535 65535 65535 _}
   [f32 +++X] SWS_OP_CONVERT      : f32 -> u16
     min: {0 0 0 _}, max: {65535 65535 65535 _}
   [u16 zzzX] SWS_OP_SWAP_BYTES
     min: {0 0 0 _}, max: {65535 65535 65535 _}
   [u16 XXXX] SWS_OP_WRITE        : 3 elem(s) packed >> 0
     (X = unused, z = byteswapped, + = exact, 0 = zero)

Importantly, none of the changes affect the actual operation list, just the
range tracking metadata.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-25 01:20:44 +02:00
Niklas Haas
aff6d64ecd swscale/ops_optimizer: omit overflow check on SWS_OP_SCALE
1. This is currently impossible to trigger
2. We're about to switch to AVRational64, eliminating this concern
3. The AVRational64 API intentionally doesn't expose av_reduce64()

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-25 01:20:15 +02:00
Niklas Haas
845a3bfcec swscale/format: factor out intmax_q() and make more robust
This formulation is generally preferred as it avoids the risk of (1 << depth)
overflowing when depth is 32/64/etc.

I also wanted to have these in a common place to make the upcoming changes
easier.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-25 01:20:15 +02:00
Niklas Haas
eda15846b2 swscale/format: avoid Q0/Q1 macros
These come with some challenging ambiguity in the following patch to switch
from AVRational to AVRational64, so best just avoid them and have individual
usage sites define them locally with the correct type.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-25 01:20:15 +02:00
Niklas Haas
82a73428e1 swscale/ops: don't re-define Q() macro
It's already in ops_internal.h

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-25 01:20:15 +02:00
Niklas Haas
b568f20f32 swscale/rational64: add 64-bit rational type
This is needed by the ops code, to represent intermediate values for 32-bit
formats, which can exceed the value range of int32_t (especially for
intermediate products).

I copied the math almost 1:1 from rational.c, but adapted to use the 128-bit
integer wrappers defined by int128.h. I added a generous amount of tests in
any case.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-25 01:20:15 +02:00
Niklas Haas
6a853ce327 avutil/rational: avoid signed integer overflow
Passing -INT_MIN to av_sub_q() overflows due to the negation. Writing out
the formula explicitly avoids this.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-25 01:20:15 +02:00
Niklas Haas
33e5fca2ee avutil/tests/rational: add explicit unit tests for edge cases
The existing tests don't really stress test the edge-case behavior when adding
or multiplying values that over/underflow.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-25 01:20:15 +02:00
Niklas Haas
9e3343a94d avutil/int128: add header for 128-bit integers
These can be implemented efficiently on most modern 64-bit compilers. Fallback
is only needed for 32-bit, which we do using the existing generic "integer.h"
header (currently also hard-coded as 128 bits).

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-25 01:20:15 +02:00
Ramiro Polla
46997547a6 swscale/uops: reduce size of uop_names[] array
Uses an offset into the full name to get the macro name. Also spells
out the names of the types to make the code easier to grep.
2026-06-24 22:39:31 +00:00
Marton Balint
18d164a573 avformat/asfdec_f: do not truncate get_value result
Also change the function to return 0 on error, this is a more sensible error
value for aspect ratios anyway.

Signed-off-by: Marton Balint <cus@passwd.hu>
2026-06-24 23:31:54 +02:00
Marton Balint
99aab32380 avformat/asfdec_f: simplify get_tag/get_value usage
get_tag() only behaves differently for the BOOLs of Extended Content
Description Object, so lets adjust the type there instead of passing BOOL width
for all calls. Similar to what asfdec_o does.

Signed-off-by: Marton Balint <cus@passwd.hu>
2026-06-24 23:31:54 +02:00
Marton Balint
cfb76bc38c tests/fate/id3v2: add ID3 test with alternate asf demuxer
This tests the previously untested alternative ASF demuxer, plus the metadata
is actually a bit different from what is returned by the historical ASF
demuxer.

Signed-off-by: Marton Balint <cus@passwd.hu>
2026-06-24 23:31:54 +02:00
Marton Balint
dab1ac3e6e avformat/utils: fix ff_dict_set_timestamp() with negative timestamps
Signed-off-by: Marton Balint <cus@passwd.hu>
2026-06-24 23:31:53 +02:00
Marton Balint
c434d0a160 avformat/asfdec_f: set creation time as metadata
Signed-off-by: Marton Balint <cus@passwd.hu>
2026-06-24 23:31:53 +02:00
Marton Balint
2bbf0da31a avformat/asfdec_o: use common function for setting creation time
This also increases precision.

Signed-off-by: Marton Balint <cus@passwd.hu>
2026-06-24 23:31:53 +02:00
Marton Balint
83c6534d5a avformat/asfenc: use common function for timestamp conversion
Signed-off-by: Marton Balint <cus@passwd.hu>
2026-06-24 23:31:53 +02:00
Marton Balint
2d2a810294 avformat/wtvdec: use ISO timestamps with timezone and higher precision
Signed-off-by: Marton Balint <cus@passwd.hu>
2026-06-24 23:31:53 +02:00
Marton Balint
2b1cf52dbe avformat/asf: add helper functions to convert between filetime and avtime
Signed-off-by: Marton Balint <cus@passwd.hu>
2026-06-24 23:31:53 +02:00
Marton Balint
ce104d1054 avformat/asfdec_o: fix EOF check in read_header
Since d1ac645636 ff_get_guid() never returns
EOF. This change completely broke the asfdec_o demuxer returning failure on
every file.

Signed-off-by: Marton Balint <cus@passwd.hu>
2026-06-24 23:31:53 +02:00
Marton Balint
3e4acff3aa avformat/asfdec_o: remove constants already defined in asf.h
Signed-off-by: Marton Balint <cus@passwd.hu>
2026-06-24 23:31:53 +02:00
Jonathan Harris
7587e1224a libavcodec/dxv.c: handle widths not a multiple of 16
The Resolume DXV codec is based on 4x4 pixel DXT1/DXT5/BC4/BC5 blocks, so
it's natural to assume that files would be padded to multiples of 4 in width
and height. But in practice .mov files produced by the Resolume software are
always padded to multiples of 16 in width and height, so FFmpeg currently
decodes them incorrectly.

When encoding FFmpeg already pads both width and height to 16 so no change
is required - see libavcodec/dxvenc.c:37-40 (commit
d4556c98f0):

/*
 * Resolume will refuse to display frames that are not padded to 16x16 pixels.
 */
#define DXV_ALIGN(x) FFALIGN(x, 16)

Signed-off-by: Jonathan Harris <ffmpeg@marginal.org.uk>
2026-06-24 13:49:42 -07:00
Timo Rothenpieler
23881eef2b Changelog: document cleanup of nvenc 2026-06-24 18:51:12 +00:00
Timo Rothenpieler
677c61b8fe avcodec/nvenc: reject deprecated global_quality instead of -qp 2026-06-24 18:51:12 +00:00
Timo Rothenpieler
64e6d750f9 avcodec/nvenc: remove legacy option aliases 2026-06-24 18:51:12 +00:00
Timo Rothenpieler
a66a022332 avcodec/nvenc: remove deprecated preset aliases 2026-06-24 18:51:12 +00:00
Timo Rothenpieler
2b054bc9e6 avcodec/nvenc: remove legacy cbr and 2pass AVOptions 2026-06-24 18:51:12 +00:00
Timo Rothenpieler
dcf339c413 avcodec/nvenc: remove old and long deprecated rc modes 2026-06-24 18:51:12 +00:00
Timo Rothenpieler
6495133363 avcodec/nvenc: remove support for SDK versions older than 11.1 2026-06-24 18:51:12 +00:00
Kacper Michajłow
c3ca443969 tests/fate/seek: exclude hls-seek test without aresample
Fixes build with --disable-swresample.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-06-24 16:04:38 +00:00
Michael Niedermayer
e0a012d129 doc/developer: bug fixes intended for backporting should stay minimal.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-24 14:15:26 +00:00
Ramiro Polla
49e73395b7 swscale/uops: move SWS_MASK* from ops.h to uops.h
These helpers are also needed for uops.
2026-06-24 13:14:35 +00:00
Ramiro Polla
fde02c904c swscale/ops: remove friendly linear mask names
These names are not really useful and the uops list already shows the
shape of the mask.
2026-06-24 13:14:35 +00:00
Diego de Souza
df94900c98 avfilter/cuda: support P012/P212 and MSB 4:4:4 in scale/transpose/thumbnail
NVDEC and CUVID now output AV_PIX_FMT_P012 (12-bit 4:2:0), AV_PIX_FMT_P212
(12-bit 4:2:2) and AV_PIX_FMT_YUV444P10MSB / AV_PIX_FMT_YUV444P12MSB
(10/12-bit 4:4:4) for high-bit-depth content, but these CUDA filters
rejected the formats in their supported-format lists, breaking pipelines
such as "-hwaccel cuda ... -vf scale_cuda" on 12-bit input.

These formats use 16-bit sample storage, and the filters select their CUDA
kernel by byte-storage size and plane layout, not by the number of valid
bits, so they can reuse the existing 16-bit kernels:

- scale_cuda: P012/P212 -> "semiplanar16", YUV444P10MSB/YUV444P12MSB ->
  "planar16".
- transpose_cuda: the ushort/ushort2 kernels are chosen from the pixel
  descriptor (byte size + channel count); just allow the new formats.
- thumbnail_cuda: P012 reuses the P010/P016 path and the MSB 4:4:4 formats
  reuse the YUV444P16 path; P012 is added to the 4:2:0 chroma-histogram
  scaling as well. (thumbnail has no 4:2:2 path, so P212 is not added.)

The CUDA deinterlacers (bwdif_cuda, yadif_cuda) already accept any format
with <= 2 bytes per sample and <= 2 channels, so they need no change. The
8-bit-only filters (overlay_cuda, pad_cuda, bilateral_cuda, chromakey_cuda,
colorspace_cuda) do not support high bit depths and are left untouched.

Signed-off-by: Diego de Souza <ddesouza@nvidia.com>
2026-06-24 12:18:15 +00:00