1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-02-04 06:08:26 +02:00

118419 Commits

Author SHA1 Message Date
Dmitrii Ovchinnikov
88a8ba5c99 avcodec/amfenc: redesign to use hwcontext_amf.
Co-authored-by: Evgeny Pavlov <lucenticus@gmail.com>
v3: cleanup code
2025-02-04 00:14:14 +01:00
Evgeny Pavlov
1f94cc4588 doc/filters: Add documentation for AMF filters
Signed-off-by: Evgeny Pavlov <lucenticus@gmail.com>
2025-02-04 00:14:14 +01:00
Evgeny Pavlov
4b77a0a681 avfilter/scale_amf: Add AMF VPP & super resolution filters
This commit adds two AMF filters: vpp_amf & sr_amf.
Both filters are using AMF hardware acceleration.
vpp_amf supports simple scaling algorithms & color conversion.
sr_amf supports advanced scaling algorithms such as FSR & can
be used for upscaling only.
2025-02-04 00:14:14 +01:00
Evgeny Pavlov
fbfde33230 avcodec: add amfdec.
Added AMF based h264, hevc, av1 decoders.
Co-authored-by: Dmitrii Ovchinnikov <ovchinnikov.dmitrii@gmail.com>
v2: added encoder reinitialisation
v3: use AMF_SURFACE_UNKNOWN to int decoder(ctx->output_format before)
2025-02-04 00:14:14 +01:00
Dmitrii Ovchinnikov
9e7242579e avutil: add hwcontext_amf.
Adds  hwcontext_amf, enabling a shared AMF context for encoders,
decoders, and AMF-based filters, without copy to the host memory.
Code also was tested in HandBrake.

Benefits:
 - Optimizations for direct video memory access from CPU
 - Significant performance boost in full AMF pipelines with filters
 - Integration of GPU filters like VPP, Super Resolution, and
    Compression Artefact Removal(in future plans)
 - VCN power management control for decoders.
 - Ability to specify which VCN instance to use for decoding
   (like for encoder)
 - AMD will soon introduce full AMF API for multimedia accelerator MA35D
   - With AMF API, integration will be much easier:
      GPU and the accelerator will have the same API
   - including encoder, decoder, scaler, color converter,
      Windows and Linux.
   Learn more:
      https://www.amd.com/en/products/accelerators/alveo/ma35d.html

Changes by versions:
v2: Header file cleanup.
v3: Removed an unnecessary class.
v4: code cleanup and improved error handling
v5: Fixes related to HandBrake integration.
v6: Sequential filters error and memory leak have been fixed.
2025-02-04 00:14:14 +01:00
Zhao Zhili
1c5961e4b4 avformat/seek: Remove always true condition
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-02-04 01:24:23 +08:00
Zhao Zhili
ef3ffd8c5c avformat/seek: Remove dead code
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Reviewed-by: Marth64 <marth64@proxyid.net>
2025-02-04 01:22:57 +08:00
Zhao Zhili
1438f6997d avcodec/nvenc: Enable recovery point SEI for intra refresh mode
Otherwise all frames can be dropped after seek without the
output_corrupt/showall flags.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
2025-02-04 01:21:26 +08:00
James Almer
4a0e1cfc6f avcodec/speexdec: fix frame_size for mode == 2
Should match the non-extradata path now, and fix ticket #11078.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-02-03 13:23:30 -03:00
James Almer
49726a922f avfilter/vf_scale: remove global side data when it no longer applies after scaling
Signed-off-by: James Almer <jamrial@gmail.com>
2025-02-03 11:05:59 -03:00
James Almer
db7ff13574 avfilter/avfilter: remove accidental loop index variable reset
Fixes ticket #11442.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-02-03 11:05:59 -03:00
Shreesh Adiga
59f9dbaa31 swscale/x86/rgb2rgb: add AVX512ICL versions of shuffle_bytes
On a AMD 7950x Zen 4

shuffle_bytes_0321_c:                                   56.5 ( 1.00x)
shuffle_bytes_0321_ssse3:                               15.2 ( 3.70x)
shuffle_bytes_0321_avx2:                                10.2 ( 5.51x)
shuffle_bytes_0321_avx512icl:                            9.2 ( 6.11x)
shuffle_bytes_1230_c:                                   84.5 ( 1.00x)
shuffle_bytes_1230_ssse3:                               14.2 ( 5.93x)
shuffle_bytes_1230_avx2:                                15.2 ( 5.54x)
shuffle_bytes_1230_avx512icl:                           11.2 ( 7.51x)
shuffle_bytes_2103_c:                                   48.5 ( 1.00x)
shuffle_bytes_2103_ssse3:                               21.2 ( 2.28x)
shuffle_bytes_2103_avx2:                                13.8 ( 3.53x)
shuffle_bytes_2103_avx512icl:                            9.2 ( 5.24x)
shuffle_bytes_3012_c:                                   84.5 ( 1.00x)
shuffle_bytes_3012_ssse3:                               14.2 ( 5.93x)
shuffle_bytes_3012_avx2:                                16.2 ( 5.20x)
shuffle_bytes_3012_avx512icl:                           10.2 ( 8.24x)
shuffle_bytes_3210_c:                                   89.2 ( 1.00x)
shuffle_bytes_3210_ssse3:                               24.2 ( 3.68x)
shuffle_bytes_3210_avx2:                                16.2 ( 5.49x)
shuffle_bytes_3210_avx512icl:                            9.2 ( 9.65x)

Signed-off-by: Shreesh Adiga <16567adigashreesh@gmail.com>
2025-02-03 10:16:44 -03:00
Dale Curtis
957eb2323a avcodec/h264dec: make slice header parse errors fatal under AV_EF_EXPLODE
This fixes timeout issues and seems like it was intended
since the line emits an error log.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Marth64 <marth64@proxyid.net>
2025-02-02 21:38:19 -06:00
Scott Theisen
33daef5f49 avcodec/mpeg12dec: rename 0x0502 CC format
The format is used by at least Dish Network, but is not
defined in any DVB standard, so remove references to DVB.

This is a simple rename, no functional change.

Signed-off-by: Marth64 <marth64@proxyid.net>
2025-02-02 21:38:19 -06:00
Timo Rothenpieler
b37606e562 avcodec/nvenc: finalize SDK 13.0 support 2025-02-02 20:02:16 +01:00
Timo Rothenpieler
89b37b4dcb avcodec/nvenc: use encoder level options for qmin/qmax
AV1 uses a vastly different range than what the global options permit,
and also for the other codecs the range of the global options is at
least misaligned.

Fixes #11365
2025-02-02 20:02:16 +01:00
Diego de Souza
a583f7e2fd avcodec/nvenc: add Temporal Filtering for AV1 and H.264 in NVENC
This commit extends the support for Temporal Filtering in NVENC for
AV1 and H.264 codecs. For natural videos with noise, NVENC temporal
filtering improves video coding efficiency by 4-5%.

Signed-off-by: Diego de Souza <ddesouza@nvidia.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2025-02-02 20:02:12 +01:00
Diego de Souza
ed80e55586 avcodec/nvenc: add UHQ to AV1 for NVENC
This commit adds support for Ultra High Quality mode for AV1 on
NVIDIA GPUs.

Signed-off-by: Diego de Souza <ddesouza@nvidia.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2025-02-02 20:02:08 +01:00
Diego de Souza
2cfef29f97 avcodec/nvenc: add 4:2:2 encoding and H.264 10-bit support
This commit adds support for 4:2:2 encoding for HEVC and H.264 on
NVIDIA Blackwell GPUs. Additionally, it supports 10-bit encoding
for H.264 on Blackwell GPUs.

Signed-off-by: Diego de Souza <ddesouza@nvidia.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2025-02-02 20:02:04 +01:00
Diego de Souza
7e9655800d avcodec/cuviddec: add HEVC/H.264 4:2:2 and H.264 10-bit support
This commit adds support for 4:2:2 decoding for HEVC and H.264 on
NVIDIA Blackwell GPUs for cuviddec. Moreover, it supports 10-bit
decoding for H.264 on Blackwell GPUs.

Signed-off-by: Diego de Souza <ddesouza@nvidia.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2025-02-02 20:02:00 +01:00
Diego de Souza
30e6effff9 avcodec/nvdec: add 4:2:2 decoding and 10-bit support
This commit adds support for 4:2:2 decoding for HEVC and H.264 on
NVIDIA Blackwell GPUs. Additionally, it supports 10-bit decoding
for H.264 on Blackwell GPUs.

Signed-off-by: Diego de Souza <ddesouza@nvidia.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2025-02-02 20:01:56 +01:00
Diego de Souza
7454a07d58 avutil/hwcontext_cuda: add 4:2:2 pixel format support
This commit adds support for 4:2:2 pixel formats, namely NV16 and
P216 for NVIDIA GPUs.

Signed-off-by: Diego de Souza <ddesouza@nvidia.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2025-02-02 20:01:51 +01:00
Andreas Rheinhardt
452d6738b5 fftools/ffmpeg_opt: Remove audio_drift_threshold
Forgotten in 5a04aae82193d75b8f8814dc7e35f4cc84b1beba.

Reviewed-by: Alexander Strasser <eclipse7@gmx.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-02-02 17:03:32 +01:00
Andreas Rheinhardt
10047fea1c avutil/cpu: Disable ff_getauxval() on x86
Not used there.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-02-02 17:03:20 +01:00
Andreas Rheinhardt
4afe61ea6c swscale/x86/swscale: Make M24 variables static
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-02-02 17:03:13 +01:00
Andreas Rheinhardt
3797e9239e swscale/x86/swscale: Move some constants to rgb2rgb.c
ff_w1111 and ff_bgr2(Y|UV)Offset are only used there
(and only on x86-32 since caaec2ea957290941eecfe5d87baf5c0a500b450).
Also make them static.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-02-02 17:00:07 +01:00
Michael Niedermayer
0113e30806
libavformat/hls: Be more restrictive on mpegts extensions
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-02-02 02:42:03 +01:00
Michael Niedermayer
9e12572933
avformat/hls: .ts is always ok even if its a mov/mp4
Maybe fixes: 11435

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-02-02 02:42:02 +01:00
Marton Balint
9b5a4c0aea avcodec/libxvid: add check for invalid intra/inter matrix values
Signed-off-by: Marton Balint <cus@passwd.hu>
2025-02-01 21:10:20 +01:00
James Almer
c6194b50b1 avdevice/alsa_dec: add a ch_layout option
Missed in ffc4fd3cc2ccb2cadb71f19849842b18ca1281c6, which after
e78173557da898f18a78241cc3525b76694164b5 broke setting channel count.

Should fix ticket #11434.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2025-02-01 01:12:17 -03:00
Michael Niedermayer
0fe33c99a2
avcodec/h263dec: Check against previous dimensions instead of coded
Fixes: out of array access
Fixes: crash-a41ef3db699013f669b076f02f36942925f5a98c

Found-by: Kacper Michajlow <kasper93@gmail.com>
Reviewed-by: Kacper Michajlow <kasper93@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-31 23:10:03 +01:00
Michael Niedermayer
d845533130
avformat/hls: Print input format in error message
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-31 23:10:02 +01:00
Gyan Doshi
221816456a doc/filters: fix typo in format filter
The inline example for option color_ranges used 'color_spaces'

Fixes #11441
2025-01-31 23:15:40 +05:30
Leo Izen
0225fe857d
avcodec/jpegxl_parse{,r}: fix integer overflow for some malformed files
If there's a very large ISOBMFF box that needs to be skipped, it can
cause an overflow for ctx->skip. There's already a safeguard to return
quickly if ctx->skip > bufsize, so changing ctx->skip to int64_t will
allow this to happen even if ctx->skip would overflow a signed int.

Several other members are also changed to int64_t to avoid this problem
in other possible scenarios.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
Reported-by: Kacper Michajlow <kasper93@gmail.com>
Fixes: clusterfuzz-testcase-minimized-fuzzer_loadfile-6085331937460224
2025-01-30 13:46:26 -05:00
Vitaly Buka
c5287178b4 avcodec/hevc/hevcdec: Don't add to null pointer
`POS(1,` and `POS(2,` may trigger UBSAN report:
"runtime error: applying non-zero offset 304 to null pointer"

Looks like values are not used without `chroma_format_idc`,
so maybe there is no other issues than the UB.

Can't reproduce with "fate".

Signed-off-by: Vitaly Buka <vitalybuka@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-30 11:35:10 -03:00
James Almer
02958ab715 avformat/mov: fix overflow in drift timestamp calculation
Fixes: signed integer overflow: 7803923888585309955 - -3407677434275325337 cannot be represented in type 'int64_t' (aka 'long')
Fixes: 377736723/clusterfuzz-testcase-minimized-media_pipeline_integration_fuzzer-5052449500889088

Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-30 10:56:59 -03:00
Gyan Doshi
1911a6ec26 ffmpeg_demux: don't print input error for AVERROR_EXIT
This error code is for expected exits, like after listing options for a
device.
2025-01-30 16:12:05 +05:30
Kacper Michajłow
4ba9ae7742 avformat/vqf: fix memory leak in add_metadata()
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-01-29 21:57:10 +02:00
Nuo Mi
ca3550948c lavc/vvcdec: ensure slices contain nonzero CTUs
fixes https://github.com/ffvvc/tests/tree/main/fuzz/passed/000323.bit

Co-authored-by: Frank Plowman <post@frankplowman.com>
2025-01-29 18:22:41 +08:00
Nuo Mi
974d4a8f0a lavc/vvcdec: remove unneeded VVCContext->pix_fmt
AVCodecContext->sw_pix_fmt is used to hold the software pixel format.

Co-authored-by: Frank Plowman <post@frankplowman.com>
2025-01-29 18:22:41 +08:00
Nuo Mi
61ff0fac35 lavc/vvcdec: remove unneeded set_output_format
Downstream can determine the format from the output frame format

Co-authored-by: Frank Plowman <post@frankplowman.com>
2025-01-29 18:22:41 +08:00
Leo Izen
3380c0d27d
avutil/frame: check return value for cropping offsets
This function can return AVERROR_BUG in theory if something
went wrong, but so can the caller, so we should propagate that
error message upward in that case.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2025-01-28 16:09:56 -05:00
Jan Ekström
4401e4b606 avformat/id3v2: add image/webp for WebP attached pictures
Found out to have been utilized via a user reporting an attached
image not being available in a player utilizing avformat's demuxing
capabilities.
2025-01-28 21:57:35 +02:00
James Almer
a649b2a831 avutil/downmix_info: check for side data allocation success before zeroing it
Fixes coverity #1641638.

Marvin Scholz <epirat07@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-28 15:26:00 -03:00
James Almer
7a16bfa7c9 tests/checkasm/sw_rgb: increase plane array buffers
Fixes stack-buffer-overflow errors running under asan.

Reviewed-by: Marvin Scholz <epirat07@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-28 15:26:00 -03:00
Martin Storsjö
8f4819ce01 rtmpproto: Avoid rare crashes in the fail: codepath in rtmp_open
When running the cleanup in rtmp_close on failures in rtmp_open,
we can in rare cases end up using rt->playpath, assuming that it
is still set.

The crash could happen if we hit the fail codepath in rtmp_open
while publishing (rt->is_input == 0) with rt->state set to
a value > STATE_FCPUBLISH.

This would normally not happen while publishing; either we have
an error (and rt->state <= STATE_FCPUBLISH) or we reach
rt->state = STATE_PUBLISHING, and then we also return successfully
from rtmp_open.

The unexpected combination of states could happen if the server
responds with e.g. "NetStream.Play.Stop" while expecting
"NetStream.Publish.Start"; this sets rt->state to STATE_STOPPED,
which also fulfills the condition "> STATE_FCPUBLISH".

We don't need to free the rt->playpath/tcurl/flashver strings here;
they're handled via AVOption, and thus are freed automatically when
the protocol instance is freed (that's why they aren't freed
manually within the rtmp_close function either).

We also don't need to free the AVDictionary with options; it's
owned by the caller.

A smaller fix would be to just call rtmp_close before freeing
the strings and dictionary, but as we don't need to free them
at all, let's remove that redundant code.

Signed-off-by: Martin Storsjö <martin@martin.st>
2025-01-28 19:56:39 +02:00
Martin Storsjö
3cd4e8470a configure: Improve the check for the rsync --contimeout option
Traditionally, macOS has shipped an old version of rsync that lacked
support for this option, hence this check (added in
a8b3f0c5cf548f654e30c981988bb71981a3f8d3).

However, in macOS 15.x, Apple have switched to providing rsync as a
different tool, openrsync. The version of openrsync in at least
macOS 15.2 does include "[--contimeout]" (note the lack of "=" after
the option), in the output of "rsync --help", but when used, the tool
errors out with "rsync: --contimeout=60: unknown option". So apparently
the tool erroenously lists the option as supported, while it really
isn't.

The original rsync tool (with a new enough version) prints
"--contimeout=SECONDS" in the output of "rsync --help".

It is unclear which version of openrsync Apple are shipping; the latest
upstream openrsync from OpenBSD does support the option and includes
"[--contimeout=seconds]" in the output of "--help", and older versions
don't seem to include the option as listed at all.

Therefore, check for "--conntimeout=" with the "=", this should
properly detect both new enough rsync and openrsync.

This fixes running "fate-rsync" on macOS 15.x.

Signed-off-by: Martin Storsjö <martin@martin.st>
2025-01-28 19:55:45 +02:00
James Almer
85a327d9d0 avfilter/buffersrc: remove unused variable
Added by mistake in 7a025e1cb5fe61888a3e71a9b33842add02c8340.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-28 10:01:17 -03:00
Krzysztof Pyrkosz
83e4b068d9 avcodec/aarch64/aacencdsp: NEON implementation
This patch supplies handwritten NEON code for AAC.

The benchmarks below were collected by invoking these two commands on
each of my boards, A78, A72 and Thinkpad x13s:
1) ./tests/checkasm/checkasm --test=aacencdsp --bench --runs=12
2) ./ffmpeg -y -t 10:00 -f lavfi -i sine /tmp/foo.aac (the first line is
speed without the patch, second, with)

- A78
abs_pow34_c:                                          4161.5 ( 1.00x)
abs_pow34_neon:                                       3586.2 ( 1.16x)
quant_bands_signed_c:                                 5548.0 ( 1.00x)
quant_bands_signed_neon:                              1126.8 ( 4.92x)
quant_bands_unsigned_c:                               3979.2 ( 1.00x)
quant_bands_unsigned_neon:                             800.2 ( 4.97x)

size=    5251KiB time=00:10:00.00 bitrate=  71.7kbits/s speed=71.6x
size=    5251KiB time=00:10:00.00 bitrate=  71.7kbits/s speed=82.3x

- A72
abs_pow34_c:                                         15362.2 ( 1.00x)
abs_pow34_neon:                                      15382.5 ( 1.00x)
quant_bands_signed_c:                                 9926.5 ( 1.00x)
quant_bands_signed_neon:                              2467.8 ( 4.02x)
quant_bands_unsigned_c:                               5469.8 ( 1.00x)
quant_bands_unsigned_neon:                            2089.5 ( 2.62x)

size=    5251KiB time=00:10:00.00 bitrate=  71.7kbits/s speed=34.3x
size=    5251KiB time=00:10:00.00 bitrate=  71.7kbits/s speed=37.8

- x13s
abs_pow34_c:                                          2413.4 ( 1.00x)
abs_pow34_neon:                                       1796.2 ( 1.34x)
quant_bands_signed_c:                                 2968.9 ( 1.00x)
quant_bands_signed_neon:                               675.6 ( 4.39x)
quant_bands_unsigned_c:                               2311.9 ( 1.00x)
quant_bands_unsigned_neon:                             477.1 ( 4.85x)

size=    5251KiB time=00:10:00.00 bitrate=  71.7kbits/s speed= 135x
size=    5251KiB time=00:10:00.00 bitrate=  71.7kbits/s speed= 159x

Signed-off-by: Martin Storsjö <martin@martin.st>
2025-01-28 10:44:40 +02:00
Gyan Doshi
959b799c8d avfilter/setpts: add option strip_fps to decide framerate handling
In f121d95, the outlink framerate was unconditionally unset.
This breaks/bloats outputs from CFR muxers unless the user explicitly
sets a sane framerate. And the most common invocation for setpts seen in
workflows, our docs and across the web is `PTS-STARTPTS` or others of the
general form `PTS+constant` which preserves the input framerate.

Default value is false, which restores old behaviour.

Fixes #11428
2025-01-27 15:40:09 +05:30