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

120033 Commits

Author SHA1 Message Date
64116800be tests/fate/hevc: Fix dependancy for hevc-alpha
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-06-01 16:35:23 +08:00
9a19ba4067 tests/fate/cbs: Add hevc metadata set color test
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-06-01 16:35:23 +08:00
c80002aa81 avcodec/h2645_vui: Ensure color primaries/trc/space isn't reserved value
Fix error reported by swscaler:
Unsupported input (Operation not supported): fmt:yuv420p csp:unknown prim:reserved trc:bt709 -> fmt:yuv420p csp:bt709 prim:reserved trc:bt709

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-06-01 16:35:23 +08:00
6c291232cf avformat/movenc: fix VVC encoding with leading pictures
The default behavior for VVenC (since v1.10.0) is to create an IDR with
leading pictures for the first picture in decoding order (POC 32). This
leads to FFmpeg generating an edit list with an empty entry, skipping
the leading pictures.

This patch fixes the calculation for the start_pts, while the DTS is
negative (as produced by vvenc).

Signed-off-by: Gabriel Hege <g+ffmpeg@hege.cc>
2025-05-31 09:47:50 +08:00
a02e880e35 avcodec/vvc/sei: add decode_mastering_display_colour_volume
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
f6d2f38530 avcodec/vvc/sei: add decode_ambient_viewing_environment
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
761f75db74 avcodec/vvc: support fields
passed files:
    FIELD_A_Panasonic_4.bit
    FIELD_B_Panasonic_2.bit

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
870fa133af avcodec/vvc/sei: add decode_frame_field_info
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
299544bd0c avcodec/h274: add H274SEIFrameFieldInfo struct
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
33d511b581 avcodec/cbs_sei_syntax_template: add sei message frame_field_information
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
97137e38c1 avcodec/vvc/sei: add decode_content_light_level_info
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
40bc5e119e avcodec/vvc/sei: add decode_display_orientation
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
d140648c31 avcodec/cbs_sei_syntax_template: add sei message sei_display_orientation
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
23e9912315 avcodec/vvcdec: verify picture hash
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
9620c95edb avcodec/h274: add ff_h274_hash functions
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
8dfc24cdce avcodec/vvc/sei: add decode_decoded_picture_hash
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
942cf59e9d avcodec/h274: add H274SEIPictureHash struct
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
312f8ef2ca avcodec/vvc/dec: support removing film grain params from side data
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
a8d949bd96 avcodec/vvc/dec: support applying film grain by the decoder
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
1608d60001 avcodec/vvc/dec: export sei to the frame when the frame starts
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
1c87e3625a avcodec/vvc/sei: add decode_film_grain_characteristics
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
ab5df96cef avcodec/vvc: support decoding prefix and suffix nal units
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
bf3a7291db avcodec/cbs_sei_syntax_template: add sei message film_grain_characteristics
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
e618f7d5cf avcodec/cbs_h2645: add cbs_sei_h274_types
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2025-05-31 09:35:54 +08:00
848ceb1329 Revert "ogg/vorbis: implement header packet skip in chained ogg bitstreams."
non flat extradata is problematic and was missed by reviewers

Found-by: Andreas Rheinhardt
This reverts commit 574f634e49.
2025-05-31 03:18:26 +02:00
0435cd5a62 avfilter/x86/vf_spp: Remove permutation-specific code
The MMX requantize functions have the MMX permutation
(i.e. FF_IDCT_PERM_SIMPLE) hardcoded and therefore
check for the used permutation (namely via a CRC).
Yet this is very ugly and could even lead to misdetection;
furthermore, since d7246ea9f2
the permutation used here is de-facto and since
bfb28b5ce8 definitely
impossible on x64, making this code dead on x64.
So remove it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-31 01:31:09 +02:00
23761c7acd avcodec/asvenc,dvenc: Optimize unaligned checks away if possible
For certain arches (AARCH64, x86, generic) get_pixels and
get_pixels_unaligned always coincide for 8 bit input.
In these cases it is possible to avoid checks for unaligned
input in asvenc, dvenc.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-31 01:28:51 +02:00
fbf5cfaed5 avcodec/pixblockdsp: Fix get_pixels alignment documentation
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-31 01:28:35 +02:00
17d5f30dd5 avcodec/pixblockdsp: Pass bits_per_raw_sample directly
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-31 01:27:09 +02:00
20ddada2a3 avcodec/pixblockdsp: Improve 8 vs 16 bit check
Before this commit, the input in get_pixels and get_pixels_unaligned
has been treated inconsistenly:
- The generic code treated 9, 10, 12 and 14 bits as 16bit input
(these bits correspond to what FFmpeg's dsputils supported),
everything with <= 8 bits as 8 bit and everything else as 8 bit
when used via AVDCT (which exposes these functions and purports
to support up to 14 bits).
- AARCH64, ARM, PPC and RISC-V, x86 ignore this AVDCT special case.
- RISC-V also ignored the restriction to 9, 10, 12 and 14 for its
16bit check and treated everything > 8 bits as 16bit.
- The mmi MIPS code treats everything as 8 bit when used via
AVDCT (this is certainly broken); otherwise it checks for <= 8 bits.
The msa MIPS code behaves like the generic code.

This commit changes this to treat 9..16 bits as 16 bit input,
everything else as 8 bit (the former because it makes sense,
the latter to preserve the behaviour for external users*).

*: The only internal user of AVDCT (the spp filter) always
uses 8, 9 or 10 bits.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-31 01:25:27 +02:00
61a70e8e9e avcodec/dvenc: Check for unaligned pointers, strides
Fixes segfaults on systems where PixblockDSPContext.get_pixels
really requires to be properly aligned (e.g. ARMv7).
Before this commit input created by
-filter_complex nullsrc=s=740x576:r=25,format=yuv420p,crop=w=720:x=2
led to crashes.

(The unaligned strides are in violation of the AVFrame.linesize
documentation, unaligned pointers itself do not seem to be
prohibited for encoders.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-31 01:12:47 +02:00
1a7e802c8f avformat/demux: use io_close2 when closing avfromat
It's not valid to call avio_close() on context that has not been open
with avio_open().

This fixes use of custom IO. (io_open / io_close2 callbacks)

Note that by default io_close2 is set to io_close2_default() which calls
avio_close(), so default case will work the same as before.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-31 00:08:25 +02:00
5030564376 libavformat/oggdec.h: Change paket function documentation to return 1 on header packets only.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-30 22:07:11 +02:00
574f634e49 ogg/vorbis: implement header packet skip in chained ogg bitstreams.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-30 22:07:10 +02:00
c9cc61d620 ogg/vorbis: factor out header processing logic.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-30 22:07:10 +02:00
ba3d4c2ba2 libavformat/oggdec.{c, h}: Add new_extradata, use it to pass extradata to the next decoded packet.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-30 22:07:10 +02:00
791a333a0e avcodec/hevc/hevcdec: Check num_entry_point_offsets
The code uses int, unsigned int and uint16_t to store num_entry_point_offsets
This limits it to the smallest of the 3.
Alternatively uint16_t can be changed and then a larger limit used.
A Check will still be needed.

Fixes: 391974932/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5966648879677440
Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-30 22:07:09 +02:00
f6986e75be avcodec/speexdec: Pass and check remaining packets to decode functions
Fixes: out of array access
Fixes: 394638693/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SPEEX_fuzzer-4868142996455424

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-30 22:07:09 +02:00
67040773dc avcodec/ffv1enc_template: Fix remaining space check
Fixes: Assertion sc->slice_coding_mode == 0 failed at libavcodec/ffv1enc.c:1667
Fixes: 408838118/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFV1_fuzzer-6493138204295168

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-05-30 22:07:09 +02:00
27c5e4b39a avcodec/libaomenc: Increase code locality
Reviewed-by: Niklas Haas <ffmpeg@haasn.xyz>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-30 19:35:32 +02:00
1b5a291dcc avcodec/dovi_rpuenc: Use av_unreachable() instead of av_assert0(0)
Reviewed-by: Niklas Haas <ffmpeg@haasn.xyz>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-30 19:35:27 +02:00
0adfe15829 avcodec/dovi_rpuenc: Use av_cold for ff_dovi_configure init functions
Reviewed-by: Niklas Haas <ffmpeg@haasn.xyz>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-30 19:35:21 +02:00
8d45dc858e avcodec/dovi_rpuenc: Avoid intermediate codec par in ff_dovi_configure()
It invalidates (removes by duplicates)  AVCodecContext.extradata
and AVCodecContext.coded_side_data which is quite surprising
and leads to bugs like #11617 where an AVCPBProperties
is used after it has been freed in ff_dovi_configure().

Reported-by: Ayose
Reviewed-by: Niklas Haas <ffmpeg@haasn.xyz>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-30 19:35:06 +02:00
ab37c7e49f ffv1enc: do not hardcode 1024 slices
Instead use a field where possible and the defined constant when not.

Tested by using 4096 slices.
2025-05-30 01:45:58 +09:00
75960ac270 avcodec/asvenc: Fix crash with unaligned pointers/linesizes
This happens on systems where get_pixels really needs
to be properly aligned, like ARMV7 or RISC-V. For these
systems, 0401ca714a caused
a bus error for the vsynth3-asv[12] tests, because
the stride in these tests is unaligned. See e.g.
https://fate.ffmpeg.org/report.cgi?slot=armv7-linux-gcc-13&time=20250527020548
https://fate.ffmpeg.org/report.cgi?slot=rv64gcvb-linux-gnu-gcc&time=20250527001827

It can also happen (even before said commit) if the pointers
itself are unaligned, e.g. by using the crop filter:
ffmpeg -filter_complex nullsrc=s=740x576:r=25,format=yuv420p,crop=w=720:x=2 \
-c:v asv2 -f null -

The alignment requirements for the frames passed to encoders are
mostly undocumented; the only thing I could find is the documentation
of AVFrame.linesize: "For video the linesizes should be multiples
of the CPUs alignment preference". This means that the FFmpeg cli
violates our API.

Yet as the above command line shows, it can also happen with
unaligned pointers and there does not seem to be a prohibition
of this, so we need to handle this case. This commit does so
by using get_pixels_unaligned when needed.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-29 08:00:21 +02:00
9568e40aeb avutil/vf_scdet_vulkan: add new filter
Carbon copy of vf_scdet.

Signed-off-by: Niklas Haas <git@haasn.dev>
Sponsored-by: nxtedition
2025-05-28 12:21:27 +02:00
0894cfb168 avfilter/blackdetect_vulkan: add hw accelerated blackdetect filter
Like vf_blackdetect but better, faster, stronger, harder.

Signed-off-by: Niklas Haas <git@haasn.dev>
Sponsored-by: nxtedition
2025-05-28 12:21:27 +02:00
7e783fac5b avfilter/vf_blackdetect: add alpha option
Check the alpha plane for (almost) transparent frames, instead of checking
the luma channel for almost black frames.

Signed-off-by: Niklas Haas <git@haasn.dev>
Sponsored-by: nxtedition
2025-05-28 12:21:27 +02:00
02f45a7f3f avfilter/vf_gblur_vulkan: omit unnecessary buffer usage flag
Implied internally now when needed.
2025-05-28 12:21:27 +02:00
0a4cdf8822 avutil/vulkan: automatically enable shader device address usage bit
We require this internally when using descriptor buffers, so it makes sense
to enable it internally, also.
2025-05-28 12:21:20 +02:00