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

120125 Commits

Author SHA1 Message Date
60fc0288ae hwcontext_vulkan: fix 85c0364b70
The issue is that by moving the mprops loading later, we inadvertently
broke some earlier dependencies.
2025-06-24 16:42:43 +09:00
88fee7046a avcodec/g728dec: Remove AVCodec.sample_fmts
It is unnecessary for decoders (they just set
AVCodecContext.sample_fmt). This also fixes a warning
with Clang (because sample_fmts is set directly,
not via CODEC_SAMPLEFMTS).

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-23 21:45:17 +02:00
11428896db hwcontext_vulkan: add workaround for broken Nvidia drivers 2025-06-24 02:30:01 +09:00
85c0364b70 hwcontext_vulkan: move ReBAR check into a new function and use it later
The issue is that vulkan_device_create_internal() is only called for
devices that lavu creates by itself.
For external devices, this was never done.

This also solves some mid-function declaration warnings.
2025-06-24 02:30:01 +09:00
5b1301004b avformat/iff: Check nb_channels == 0 in CHNL
Fixes: division by 0
Fixes: 418396712/clusterfuzz-testcase-minimized-ffmpeg_dem_IFF_fuzzer-6104388018176000
Fixes: 418478219/clusterfuzz-testcase-minimized-ffmpeg_dem_IFF_fuzzer-4569544410857472

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-23 16:31:58 +02:00
f06474faf8 tools/target_dec_fuzzer: adjust threshold for VP8
Fixes: Timeout
Fixes: 416589179/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP8_fuzzer-5432788428062720

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-23 16:29:34 +02:00
a8c21a7158 Add FUNDING.json
We have been contacted by Monet du Plessis of the etherium foundation and
Natascha Buck (Grants at the Better Internet Foundation)

"The Ethereum Foundation is thrilled to inform you that your contribution to
 open-source software development through your work on ffmpeg
 https://github.com/FFmpeg/FFmpeg  has been recognized and rewarded by the
 Devcon team! Your project played a fundamental role in the success of Devcon
 <http://devcon.org/>, helping to create a more meaningful experience for
 the Ethereum community. In collaboration with Drips Network
 <https://www.drips.network/>, we are pleased to award you $2,240.00 in
 appreciation of your efforts and to support your continued efforts in
 open-source development."

To be able to claim donations through the drips network we need to
specify a wallet to do so in FUNDING.json

This will also allow FFmpeg to receive future funding and donations
through the drips network.

The specified wallet is a safe wallet backed by a ledger hw wallet.
We can later change who controls the safe wallet. (For example it
could be passed on to the SPI treasurer)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-23 14:48:40 +02:00
6e5f47f6d3 tools/target_dec_fuzzer: Adjust RV60 threshold
Fixes: Timeout
Fixes: 410324670/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RV60_fuzzer-5697706586865664

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-23 14:36:07 +02:00
f8e30d9eeb avcodec/osq: Request a coding mode 2 sample
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-23 14:28:56 +02:00
a5f861d335 avcodec/osq: Switch back to av_ceil_log2()
This returns to code closer to prior 56c334d732
The prior fixes should limit the sum and avoid the need for double argument log2()

Fixes: Assertion n>=0 && n<=32 failed at libavcodec/get_bits.h:406
Fixes: 410109093/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OSQ_fuzzer-6550900028276736

No testcases except fuzzers

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-23 14:28:55 +02:00
b587afcb65 avcodec/osq: Add note about update_stats() count
It seems this is basically unused and unfinished code

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-23 14:28:55 +02:00
c909ef31be avcodec/osq: Fix signed integer overflow in update_stats()
Fixes: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
Fixes: 410109093/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OSQ_fuzzer-6550900028276736

Note, none of the available osq files uses update_stats(), this change may fix or break
files using coding_mode == 2. The code prior looks wrong though

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-23 14:28:55 +02:00
983a3b17e4 libavcodec/hcadec: fix header parsing after 'comp' section
Need to skip 2 more bytes because comp sections are 12 bytes long.
Fixes decryption since ciph_type is now being set.

Signed-off-by: Pavel Roslyy <roslypav@gmail.com>
2025-06-23 14:28:54 +02:00
c94a419e32 avfilter/codecview: Enable QP visualization for H.264
The codecviewfilter, when used with qp=1, did not display quantization parameter values for H.264 streams because the QP table extraction was restricted to MPEG-2 video.

This patch enables H.264 support by updating ff_qp_table_extractto accept AV_VIDEO_ENC_PARAMS_H264. This allows for correct QP overlay on H.264 video

Signed-off-by: Timothee <timothee.informatique@regaud-chapuy.fr>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-06-23 13:40:52 +02:00
e6298e0759 avformat/rtp: G.728 muxing and demuxing 2025-06-23 17:19:18 +10:00
5a8c2b2b50 avformat/aiff: G.728 muxing and demuxing 2025-06-23 17:19:18 +10:00
dee4edfa63 avformat/riff: G.728 muxing and demuxing 2025-06-23 17:19:18 +10:00
52f62468aa avformat/g728dec: raw G.728 demuxer 2025-06-23 17:19:18 +10:00
a107340035 avcodec/g728dec: G.728 decoder 2025-06-23 17:16:42 +10:00
a3c900a0c4 avcodec/lpc_functions: compute_lpc_coefs: add starting lpc order and err cache parameters 2025-06-23 17:11:09 +10:00
a0b9d61faf avcodec/g728_template: make hist parameter constant 2025-06-23 17:11:07 +10:00
93368029e3 avcodec/g728_template: do_hybrid_window() template
intended for use by RealAudio 2.0 (28.8k) and G.728 decoders.
2025-06-23 17:11:03 +10:00
b1172b8cc6 avcodec/mss2dsp: use FF_PTR_ADD to add offsets to a pointer
Fixes: libavcodec/mss2dsp.c:59:14: runtime error: applying zero offset to null pointer

Tested-by: Kacper Michajlow <kasper93@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-22 17:50:26 -03:00
f789d60e11 avformat/mov: add more sanity checks when reading clap boxes
If the apperture window is bigger than the canvas, then the clap box is invalid
and there's no point calculating cropping values.

Fixes: libavformat/mov.c:1295:14: runtime error: -256 is outside the range of representable values of type 'unsigned long'

Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-22 10:30:03 -03:00
dbe94e1110 avfilter/x86/f_ebur128: replace AVX2 instruction with AVX equivalent
Using vpbroadcastq in an AVX function will result in SIGILL errors on pre
Haswell/Zen processors.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-22 09:31:44 -03:00
27590d8653 avutil/hwcontext_vulkan: disable host transfers if ReBAR is disabled
This feature fundamentally relies on host-visible VRAM, which restricts the
set of available memory types to (typically) host-visible device-local ones.

When resizable BAR is disabled, this memory type is usually limited to
e.g. 256 MiB in size, which is just plain insufficient for allocation of
general purpose GPU images, causing OOM errors on even the simplest of
commands.

The easiest solution is to disable host transfers entirely on machines
without host-addressable VRAM. In theory, we could try and recover the use
of host transfers for images which are *not* restricted to device-local
memory types, but this is rarely the case in practice, and the effort
required would exceed the benefit, especially since ReBAR is a standard
feature on all platforms recent enough to have Vulkan drivers, and only
occasionally disabled in the UEFI for by default for some hare-brained
notion of "backwards compatibiility" with ancient software.
2025-06-22 12:13:09 +02:00
baad40bdd1 avcodec/mips: fix build failure when specific decoder/encoder enabled
acelp_kelvin, g729, qcelp, sipr and wmavoice decoders all depend upon
mips/{acelp_filters_mips,celp_filters_mips,acelp_vectors_mips}.o when
arch is mips.

g723_1 depends on mips/{celp_filters_mips,acelp_vectors_mips}.o.

comfortnoise, evrc, ra144 and ra288 depend on mips/celp_filters_mips.o.
2025-06-22 09:15:56 +10:00
b49c4d1034 configure: h264_vulkan_encoder depends on atsc_a53 2025-06-22 09:15:56 +10:00
08943c82c6 configure: cbs_apv depends on cbs 2025-06-22 09:15:56 +10:00
34953e195f avcodec/mpeg4videoenc: Fix data race when using AC prediction
The check for whether we can use the fast path to process
AC coefficients used the qscale value belonging to a different
slice; this worked in practice, because the predicted AC values
are zero in this case, so it does not matter whether we use
the fast or the slow path.

Fix this by checking for first_slice_line instead. This fixes all
the races in the encoding part of the vsynth*-mpeg4-thread tests
(and fixes them if no frame threading is in use for the decoding part).

(The left prediction check may use data from a different slice, too,
but said slice is always processed by the same thread, so that no race
can happen. Given that out-of-slice AC values are zero, it does not
matter whether we use the fast path or the slow path either.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-21 22:08:52 +02:00
5cdce56a79 avcodec/mpegvideo: Reduce stack usage when copying MpegEncContext
(GCC did not perform this on its own; Clang did.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-21 22:08:52 +02:00
f8c0ac9984 avcodec/ituh263enc: Simplify encoding umotion vectors
There is no need to use two loops.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-21 22:08:52 +02:00
689cde75ee avcodec/mpeg4video: Move ff_mpeg4_pred_dc() to decoder
Only used by the decoder now that the encoder solves
out-of-slice predictions by setting the out-of-slice
values appropriately.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-21 22:08:52 +02:00
56fd45d2a9 avcodec/{ituh263,mpeg4video}enc: Simplify out-of-slice DC prediction
Now that every slice (and therefore every thread) uses its own
DC array, one can simply set the out-of-slice DC values to its
expected values (this is not possible for the decoders due
to error resilience).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-21 22:08:52 +02:00
c84a03d752 avcodec/mpegvideo: Allocate dc_val for each encoder slice
This fixes data races (which are UB) in the MPEG-4 and H.263+
encoder when predicting DC values; these encoders unconditionally
read values from the line above the current line and only check
lateron (via first_slice_line) whether said prediction can be used
at all. It will also allow to remove said checks (by setting the
entries to 1024 upon opening a new slice).

The vsynth{1,2,3,_lena}-mpeg4-thread FATE tests were affected by this:
https://fate.ffmpeg.org/report.cgi?slot=x86_64-archlinux-gcc-tsan-slices&time=20250613002615

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-21 22:08:52 +02:00
eb597d9a1e avcodec/vc1: Only keep mb_type[0]
The chroma mb_type[1] and mb_type[2] pointers are unused.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-21 22:08:52 +02:00
81ab1106c8 avcodec/mpegvideo: Only keep MpegEncContext.dc_val[0]
The chroma dc_val pointers are mostly unused (accesses use
dc_val[0] and block_index), so remove them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-21 22:08:52 +02:00
c4fd33a951 avcodec/mpegvideo: Zero-init mbintra_table
Up until now, they are marked as dirty (filled with 1), meaning that
the entries are in need of a reset via ff_clean_intra_table_entries();
but actually, the entries are initialized to the state that
ff_clean_intra_table_entries() produces, so they can be marked
as non-dirty (i.e. filled with 0).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-21 22:08:52 +02:00
c4ebe55f94 avcodec/mpegvideo: Allocate ac_val jointly
They are currently allocated separately per slice; allocating them
jointly allows to avoid saving them in ff_update_duplicate_context().

The way it is done also avoids allocating ac_val for encoders that
don't need it (e.g. H.263 or H.263+ with AIC).

This entailed moving setting nb_slices to ff_mpv_init_context_frame()
which is called from ff_mpv_common_frame_size_change(). The resultant
nb_slices will always be one when called from a decoder using
ff_mpv_common_frame_size_change().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-21 22:08:52 +02:00
dba1061ba4 avcodec/mpegvideo: Only use a single ac_val pointer
The chroma pointers ac_val[1] and ac_val[2] are no longer used anywhere.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-21 22:08:52 +02:00
4aca6b19ac avcodec/mpeg4video: Don't use ac_val[1], ac_val[2] when cleaning buffers
This is in preparation for removing removing ac_val[1]
and ac_val[2]. ff_mpeg4_clean_buffers() was the last user of them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-21 22:08:52 +02:00
b2661569b1 avcodec/mpegvideo: Combine stores
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-21 22:08:52 +02:00
70ce68d021 avcodec/mpegvideo: Don't reset AC values of upper-left luma block
Said block will only be referenced by blocks from the same macroblock,
which will read the new AC values instead of the reset values
from this function.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-21 22:08:52 +02:00
dcd7408c92 avcodec/mpegvideo: Provide alignment hint to compiler
The underlying element type has always a size of 32B,
so that the pointer is always at least 16B aligned.
Clang uses this to upgrade the (inlined) memset to
aligned stores. GCC doesn't (it does it only when
the alignment hint is provided via __builtin_assume_aligned).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-21 22:08:52 +02:00
32cbadcd74 avcodec/mpegvideo: Avoid {a,d}c_val[{1,2}]
These are already mostly unused; not using them here is in
preparation for removing them altogether. Use block_index[4..5]
instead for addressing.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-21 22:08:52 +02:00
13527b39bb avcodec/mpegvideo: Redo resetting intra table entry
All callers check the corresponding entry of MpegEncContext.mbintra_table
and if set (indicating that the intra tables might have been written to
when decodeing a intra MB, so that they are "dirty"), call
ff_clean_intra_table_entries(), which resets them to default values
and resets the mbintra_table entry. Move resetting to the callers
(via an inline function that also performs the checks). This currently
has the advantage that the additional load of the mbintra_table ptr
can be avoided. It will also allow to simplify
ff_clean_intra_table_entries() (by using block_index[4] and [5]).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-21 22:08:52 +02:00
514e5ea0db avcodec/flvenc: Move ff_flv2_encode_ac_esc() to ituh263enc.c
This is the only place where it is used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-21 22:08:52 +02:00
61d34c2b8e avcodec/flvenc: Combine writing bits
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-21 22:08:52 +02:00
7643269ec2 avcodec/ituh263enc: Simplify AIC handling
Namely with block_index and block_wrap.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-21 22:08:52 +02:00
950137a7c8 avcodec/ituh263dec: Simplify AIC handling
Possible by using block_index.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-06-21 22:08:52 +02:00