1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00
Commit Graph

118540 Commits

Author SHA1 Message Date
8e6032990c fftools/ffmpeg_dec: don't try to copy side data from the decoder if it already exists in the output frame
We can't use AV_FRAME_SIDE_DATA_FLAG_REPLACE here because the side data already in the
frame should have priority over the global one, so just ensure we don't copy any if
it already exists.

Fixes ticket #11468.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-02-25 19:51:18 -03:00
d161604625 tests: Add fate-hevc-alpha
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-02-25 11:40:33 +08:00
a37f634383 tools: Add binaries to .gitignore
Signed-off-by: Frank Plowman <post@frankplowman.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-02-25 02:03:58 +01:00
4ff1d1f3d6 add tools/compare-cvelists.sh
This compares the MITRE CVE list with our webpage security list and
produces a diff, so people can investigate, fix, backport and correct
differences

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-02-24 15:39:03 +01:00
37348e1b20 fftools/ffprobe: Switch to AVMutex
This removes several #if checks. While just at it, also switch
to static mutex initialization.
This commit does not enable -show_log for builds without threads
though.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-02-24 15:09:54 +01:00
6232f416b1 ffmpeg_demux: add option readrate_catchup
At present, if reading from a readrate-limited input is stalled,
then upon resumption, ffmpeg will read the input without any
throttle till the average readrate matches the specified readrate.

This new option allows to set a speed limit when reading is resumed
until the average readrate matches the primary readrate.

Fixes #11469
2025-02-24 15:16:59 +05:30
a060b4d9a9 fftools: notify user of flags upon loglevel parse failure 2025-02-24 15:15:53 +05:30
5021764413 avformat/mov: (v4) fix get_eia608_packet
The problem is reproducible with "Test for Quicktime 608 CC file.mov"
from https://samples.ffmpeg.org/MPEG2/subcc/

ffmpeg -i "Test for Quicktime 608 CC file.mov" -map 0 -c copy -y remuxed.mov

See https://trac.ffmpeg.org/ticket/11470
2025-02-23 09:43:56 -07:00
d5dbcc00d8 lavc/vvc: Ensure subpictures don't overlap
This is essentially a re-implementation of
https://patchwork.ffmpeg.org/project/ffmpeg/patch/20241005223955.54158-1-post@frankplowman.com/

That patch was not applied last time.  Instead we opted to identify
issues which could be caused by invalid subpicture layouts and remedy
those issues where they manifest, either through error detection or code
hardening.  This was primarily implemented in the set
https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=13381.

This has worked to some degree, however issues with subpicture layouts
continue to crop up from the fuzzer and I've fixed a number of bugs
related to subpicture layouts since then.  I think it's best to return
to the initial plan and simply check if the subpicture layout is valid
initially.

This implementation is also lighter than the first time -- by doing a
bit more logic in pps_subpic_less_than_one_tile_slice, we are able to
store a tile_in_subpic map rather than a ctu_in_subpic map.  This
reduces the size of the map to the point it becomes possible to allocate
it on the stack.  Similar to 8bd66a8c95,
the layout is also validated in the slice map construction code, rather
than in the CBS, which avoids duplicating some logic.

Signed-off-by: Frank Plowman <post@frankplowman.com>
2025-02-23 21:39:42 +08:00
93aae172ea lavc/vvc: Fix slice map construction for small subpics
In the case pps_subpic_less_than_one_tile_slice is called, the
subpicture is smaller than the tile and so there are multiple
subpictures in the tile.  Of course, then, not all the
subpictures can start in the top-left corner as the code before the
patch does.  Patch fixes this, so each subpicture starts at the
signalled location as is specified in section 6.5.1 of H.266(V3).

Signed-off-by: Frank Plowman <post@frankplowman.com>
2025-02-23 21:39:42 +08:00
87d7b8ff4b fate/demux: add a test for Theora in OGG
Signed-off-by: James Almer <jamrial@gmail.com>
2025-02-23 00:13:35 -03:00
8f2af8fda6 avcodec/mpegvideo_{dec,enc}: Reindent after the previous commit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-02-23 02:01:18 +01:00
b05ec7fec9 avcodec/mpv_reconstruct_mb_template: Merge template into its users
A large part of this template is decoder-only. This makes
the complexity of the IS_ENCODER-checks not worth it.
So simply merge the template into both its users.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-02-23 02:01:18 +01:00
fc64b2ee5d avcodec/mpegvideo_enc: Don't reset intra buffers in mpv_reconstruct_mb()
It is not part of reconstructing the macroblock.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-02-23 02:01:18 +01:00
5826166836 avcodec/h263dec: Clean intra tables in decoder, not ff_mpv_reconstruct_mb
This is a more appropriate place than a function designed
to reconstruct a macroblock. It furthermore limits these checks
to the codecs that actually need it (and removes it from e.g.
RV10 and RV20 -- the latter actually uses these buffers, but
only for intra-frames, so they don't need to be cleaned
manually).

This furthermore means that ff_mpv_reconstruct_mb() and therefore
also the error-resilience code no longer needs block_index set.
This fixes a crash caused by 65d5ccb808
when ff_mpv_reconstruct_mb() is called by VC-1 code without
block_index being initialized properly (VC-1 uses and initializes
block_index itself normally).

Fixes: 69814/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1_fuzzer-4868081575329792
Fixes: heap-buffer-overflow

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-02-23 02:01:08 +01:00
58f9e497dc avcodec/mpeg12enc: Move resetting last_dc to encoder
The MPEG-1/2 encoders are the only non-intra-only mpegvideo
encoders that want last_dc reset when encoding non-intra macroblocks.
Therefore move resetting it to mpeg12enc.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-02-23 01:08:45 +01:00
9a46c0160f avcodec/mpeg12dec: Move resetting last_dc to decoder
Only the MPEG-1/2, MSMPEG4V1, MPEG-4 and RV.10 decoders use last_dc
at all. Of these, RV.10 only uses it for intra frames; it does not
need these predictors reset in ff_mpv_reconstruct_mb(). MSMPEG4V1
has h263_pred set, so that last_dc is already not reset in
ff_mpv_reconstruct_mb() (instead it is reset at the beginning
of every line). MPEG-4 also has h263_pred set (and uses last_dc only
for the intra-only studio profile and needs them reset to sligthly
different values anyway).

So only the MPEG-1/2 decoders need these values reset. So move
resetting them there. This avoids resetting them unnecessarily
for FLV1, H.261, H.263I, RV.10, RV.20 and H.263(+)
(for the latter it depends upon whether h263_aic is in use).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-02-23 01:08:45 +01:00
ebf0d34281 avcodec/h261enc: Use LUT to write motion vector differences
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-02-23 01:08:45 +01:00
d1ed5c06e3 avcodec/libsvtav1: unbreak build with latest svtav1
SVT-AV1 made a change in their public API in 988e930c but without a
version bump or any other accessible marker, thus breaking ffmpeg build
with current versions of SVT-AV1.

They have finally bumped versions a month later, so check added.
2025-02-22 18:57:53 +05:30
392aa9daf2 lavc/vvc: Fix derivation of inverse LMCS idx
The clamping of idxYInv from H.266(V3) section 8.8.2.3 was missing.
This could lead to OOB reads from lmcs->pivot or input_pivot.

I also changed the derivation of the forward LMCS idx to use a shift
rather than a division for speed and as this is actually how the
variable is declared in the specification (8.7.5.2).

Signed-off-by: Frank Plowman <post@frankplowman.com>
2025-02-22 12:02:59 +08:00
bb8e95b650 lavc/vvcdec: export stream level VUI information
Previously, VUI information was not exposed.
If the container lacks HDR metadata, HDR videos appear washed out

Command: mp4box -add hdr.mp4#video:colr=nclc,1,1,1 -new new.mp4 && ffprobe new.mp4
Before: Stream #0:0[0x1](und): Video: vvc (vvc1 / 0x31637676), yuv420p10le(bt709), 1920x1080, 12164 kb/s, 50 fps, 50 tbr, 90k tbn (default)
After:  Stream #0:0[0x1](und): Video: vvc (vvc1 / 0x31637676), yuv420p10le(tv, bt2020nc/bt2020/arib-std-b67), 1920x1080 [SAR 1:1 DAR 16:9], 12164 kb/s, 50 fps, 50 tbr, 90k tbn (default)

Reported-by: Barry Warburton <blwarburton@gmail.com>
2025-02-22 11:29:58 +08:00
2d9433f25b lavc/vvcdec: refact, set AVCodecContext->has_b_frames in sps_export_stream_params 2025-02-22 11:29:58 +08:00
2066c5526d gblur_vulkan: simplify buffer content writing
Before .buf_elems, users had to manually print to a string if they
wanted a non-fixed number of elements in an array.

Since we're printing everything to the shaders manually anyway, use
the new mechanism.
2025-02-21 03:19:21 +01:00
f774a9376a vulkan: add .buf_elems to FFVulkanDescriptorSet
This enables users to specify a number that would be appended to
the buf_content string.
Saves users from needing to manually print to a string.

An earlier commit tried doing this via .elems, but it was
faulty, as this also incremented the total number of descriptors
in the descriptor set.
2025-02-21 03:19:20 +01:00
89704f07bb lavc/vulkan: add a u8vec2buf buffer type
Useful, since it doesn't have alignment limitations.
2025-02-21 03:19:20 +01:00
684171c9f7 overlay_vulkan: remove unused variable
Forgotten to be removed after the recent port to imageLoad()
2025-02-21 03:19:19 +01:00
b6bf568a44 vulkan: don't query video queue properties unless the extension is enabled
Fixes validation errors.
2025-02-21 03:19:19 +01:00
542a567d50 ffv1enc_vulkan: support default range coder tables
This adds support for default range coder tables, rather than
only custom ones. Its two lines, as the same code can be used
for both thanks to ffv1enc.c setting f->state_transition properly.
2025-02-21 03:19:19 +01:00
5cf4f145ad ffv1dec: set f->state_transition for default range coder table
The table is only set when f->ac is set to CUSTOM. Setting it
for default range coder tables simplifies hardware accelerator code.
2025-02-21 03:19:14 +01:00
bc1a3bfd2c avcodec/hevc: Add support for output_corrupt/showall flags
Also handle gradual decoding refresh stream.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-02-20 11:39:52 +08:00
b6652115de avcodec/hevc: Parse recovery point SEI
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-02-20 11:33:50 +08:00
5470d024e1 avformat/iamf_parse: ensure there's at most one of each parameter types in audio elements
Should prevent potential memory leaks on invalid files.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-02-19 19:51:21 -03:00
0526535cd5 avformat/iamf_parse: add missing constrains for num_parameters in audio_element_oub()
Fixes ticket #11475.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-02-19 19:51:21 -03:00
6e26f57f67 avformat/demux: don't discard empty Theora packets
Theora signals "Output last frame again" with an empty packet.

Finishes fixing ticket #11451.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-02-19 19:51:21 -03:00
84d85e7ad4 avformat/oggenc: don't discard empty packets with no side data
Theora signals "Output last frame again" with an empty packet.
To keep the behaviour of 18f24527eb of ignoring side data only packets, as
generated by the FLAC encoder to propagate updated extradata, also check for
pkt->side_data_size to choose wheter to mux the paket or not.

Fixes part of ticket #11451.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-02-19 19:51:21 -03:00
261ec6c35e avformat/mov: further ensure mov_build_index isn't run twice
If sc->tts_count is not 0, then the sample index has already been built.

Fixes: Null-dereference READ
Fixes: 396192874/clusterfuzz-testcase-minimized-audio_decoder_fuzzer-4589309789143040

Signed-off-by: James Almer <jamrial@gmail.com>
2025-02-19 19:51:21 -03:00
7e84865cff avcodec/codec_internal: remove unnecessary avcodec.h include
Signed-off-by: James Almer <jamrial@gmail.com>
2025-02-19 19:50:05 -03:00
cd81f08491 avfilter/libplacebo: use a transparent default fillcolor
This will leave the background transparent when the target format
contains an alpha channel, without affecting the behavior on formats
without one.
2025-02-19 18:33:21 +01:00
e18f87ed9f swscale/x86/rgb2rgb: add AVX512ICL version of uyvytoyuv422
The scalar loop is replaced with masked AVX512 instructions.
For extracting the Y from UYVY, vperm2b is used instead of
various AND and packuswb.

Instead of loading the vectors with interleaved lanes as done
in AVX2 version, normal load is used. At the end of packuswb,
for U and V, an extra permute operation is done to get the
required layout.

AMD 7950x Zen 4 benchmark data:
uyvytoyuv422_c:                                      29105.0 ( 1.00x)
uyvytoyuv422_sse2:                                    3888.0 ( 7.49x)
uyvytoyuv422_avx:                                     3374.2 ( 8.63x)
uyvytoyuv422_avx2:                                    2649.8 (10.98x)
uyvytoyuv422_avx512icl:                               1615.0 (18.02x)

Signed-off-by: Shreesh Adiga <16567adigashreesh@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2025-02-18 12:43:57 -03:00
08e37fa082 overlay_vulkan: port to imageLoad() 2025-02-18 10:44:56 +01:00
2b8d38cbc1 blend_vulkan: port to imageLoad() 2025-02-18 10:44:56 +01:00
379cfd1855 transpose_vulkan: port to imageLoad() 2025-02-18 10:44:55 +01:00
b02f9157b8 gblur_vulkan: port to imageLoad() 2025-02-18 10:44:55 +01:00
4d3e540fa4 flip_vulkan: port to imageLoad() 2025-02-18 10:44:54 +01:00
a535639620 nlmeans_vulkan: switch to imageLoad() 2025-02-18 10:44:54 +01:00
9c4a26d9b0 avgblur_vulkan: fix duplicated variable error when planes=0 2025-02-18 10:44:54 +01:00
389fb36f92 avgblur_vulkan: port to imageLoad() 2025-02-18 10:44:53 +01:00
779763181f bwdif_vulkan: convert to storage images
texture() uses bilinear scaling; imageLoad() accesses the image directly.
The reason why texture() was used throughout Vulkan filters is that
back when they were written, they were targetting old Intel hardware,
which had a texel cache only for sampled images.

These days, GPUs have a generic cache that doesn't care what source it
gets populated with. Additionally, bypassing the sampling circuitry saves
us some performance.

Finally, all the old texture() code had an issue where unnormalized
coordinates were used, but an offset of 0.5 was not added, hence each
pixel ended up being interpolated. This fixes this.
2025-02-18 10:44:53 +01:00
042ed96d0a vulkan_filter: use GENERAL image layout when no sampler is given
This allows using the generic filter code with STORAGE image inputs.
2025-02-18 10:44:53 +01:00
1029f51285 vulkan: fix crash in ff_vk_shader_free
The issue is if a shader fails to compile, shd->desc_layout would
not exist, but nb_descriptor_sets would.
2025-02-18 10:44:49 +01:00