Commit graph

53520 commits

Author SHA1 Message Date
Lynne
fdee87d06d
ffv1enc_vulkan: convert RCT search shader to compile-time SPIR-V generation 2026-02-19 19:42:28 +01:00
Lynne
a548c2f0a3
vulkan_ffv1: move common spec constant setting to ffv1_vulkan.c
It will be shared between encoder and decoder.
2026-02-19 19:42:28 +01:00
Lynne
ab2ba27c18
ffv1enc_vulkan: remove golomb gb context from main slice context 2026-02-19 19:42:28 +01:00
Lynne
6c0b2be235
vulkan_ffv1: remove golomb gb context from main slice context 2026-02-19 19:42:28 +01:00
Lynne
ea9ae1166b
vulkan_ffv1: precalculate bits and use a specialization constant 2026-02-19 19:42:28 +01:00
Lynne
3dceda7769
vulkan_ffv1: convert to compile-time SPIR-V generation 2026-02-19 19:42:27 +01:00
Lynne
82f0818ff2
vulkan/common: add debug shorthand 2026-02-19 19:42:27 +01:00
Lynne
8b447a670a
vulkan/dpx: bounds check with image sizes
Prevents out of bounds accesses.
2026-02-19 19:42:27 +01:00
Lynne
67d5e7e86a
vulkan_prores_raw: fix a single statement's indentation
Annoying.
2026-02-19 19:42:26 +01:00
Lynne
d616269035
vulkan: don't set FFVulkanDescriptorSetBinding.name when not necessary
It just bloats the code with unused strings.
2026-02-19 19:42:26 +01:00
Lynne
ae1a227cf6
Makefile: specify GLSL version via command line arguments
GLSL strictly mandates the version must be the very first non-comment
statement, which results in issues when #including for templating.
2026-02-19 19:42:20 +01:00
Michael Niedermayer
52b676bb29 avcodec/cfhd: Check transform type before continuing
Fixes: null pointer dereference
Fixes: 471768165/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_DEC_fuzzer-6187504467509248

The first frame allocates buffers with one transform type
the second frame sets up another transform type but the code to reallocate buffers is never triggered

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-02-18 23:45:28 +00:00
Michael Niedermayer
2263e05e41 avcodec/cfhd: Add CFHDSegment enum and named identifiers
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-02-18 23:45:28 +00:00
Michael Niedermayer
d138169966 avcodec/libvorbisdec: output AV_SAMPLE_FMT_FLTP
This removes the internal sample format convert

Fixes: nan is outside the range of representable values of type 'int'
Fixes: 471946097/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LIBVORBIS_DEC_fuzzer-4843605174059008

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-02-18 23:38:16 +00:00
Michael Niedermayer
5ec37f61b2 avcodec/hevc/ps: Check bit_depth_cm in/out relation
Fixes: Assertion n>0 && n<=25 failed at ./libavcodec/get_bits.h:3
Fixes: 472463689/clusterfuzz-testcase-minimized-ffmpeg_dem_HXVS_fuzzer-6012944883449856

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-02-18 13:57:28 +00:00
James Almer
7c877b2e80 avcodec/opus/enc: rescale packet duration when calculating discarded samples
Signed-off-by: James Almer <jamrial@gmail.com>
2026-02-17 20:17:23 -03:00
James Almer
0aa3a6fe41 avcodec/libvorbisenc: rescale packet duration when calculating discarded samples
Signed-off-by: James Almer <jamrial@gmail.com>
2026-02-17 20:17:23 -03:00
James Almer
84bb5b0748 avcodec/libopusenc: rescale packet duration when calculating discarded samples
Signed-off-by: James Almer <jamrial@gmail.com>
2026-02-17 20:17:23 -03:00
James Almer
5863cab885 avcodec/libmp3lame: rescale packet duration when calculating discarded samples
Signed-off-by: James Almer <jamrial@gmail.com>
2026-02-17 20:17:23 -03:00
James Almer
e3061be971 avcodec/libfdk-aacenc: rescale packet duration when calculating discarded samples
Signed-off-by: James Almer <jamrial@gmail.com>
2026-02-17 20:17:23 -03:00
James Almer
dd9756286d avcodec/encode: add a helper to convert from a duration to samples
Signed-off-by: James Almer <jamrial@gmail.com>
2026-02-17 20:17:23 -03:00
Diego de Souza
cb0f4de1f5 avcodec/nvenc_av1: fix b_ref_mode "middle" help string for AV1
For AV1, NV_ENC_BFRAME_REF_MODE_MIDDLE does not use a single middle
B-frame. Per the NVENC Programming Guide, it sets every other B-frame
as an Altref2 reference except the last B-frame in the Altref interval.

Signed-off-by: Diego de Souza <ddesouza@nvidia.com>
2026-02-17 16:36:51 +00:00
Marton Balint
33b215d155 avcodec/libvpxenc: add experimental support for alpha pixel formats other than YUV 4:2:0.
I could not find any documentation which disallows the use of transparency for
pixel formats other than YUV 4:2:0, so this patch adds support for transparency
using 4:2:2, 4:4:4, RGB, and their high bit depth variants.

It is not quite clear if the alpha channel should be encoded using the
same pixel format as the normal channels, or it should be always YUV 4:2:0. I
sticked to 4:2:0.

Unfortunately the browsers I tested (chrome, firefox) only support 4:2:0
properly, so let's require an experimental flag to generate files with the new,
more exotic pixel formats.

Signed-off-by: Marton Balint <cus@passwd.hu>
2026-02-15 20:28:31 +01:00
Marton Balint
d373dfe157 avcodec/libvpxdec: add support for decoding pixel formats other than YUV420 with alpha
Signed-off-by: Marton Balint <cus@passwd.hu>
2026-02-15 20:28:31 +01:00
Michael Niedermayer
0d59620bff
avcodec/bmp: Move picture allocation after some checks
Fixes: Timeout
Fixes: 479872424/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BMP_DEC_fuzzer-5311478919135232

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-02-15 20:09:54 +01:00
Michael Niedermayer
50adb62670
avcodec/bmp: fix indention
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-02-15 20:09:54 +01:00
Michael Niedermayer
33b3dbaf15
avcodec/exr: Handle axmax like bxmin in 04d7a6d3db
Fixes: out of array access
Fixes: 418335931/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_DEC_fuzzer-6718455383654400
Fixes: 471611870/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_DEC_fuzzer-6645447302381568

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-02-15 19:57:42 +01:00
Andreas Rheinhardt
4ef5efc2b6 avcodec/aacps_tablegen_template: Fix hardcoded tables with assert-level 2
In this case an av_assert2 in lavu/softfloat.h pulls in
a dependency on av_log(), which is not available at all,
because the tablegen tools are created for and run on
the host, not the target. This leads to linking failures.

Fix this by undefining ASSERT_LEVEL before the inclusion
of avassert.h.

Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-02-14 20:14:47 +01:00
Michael Niedermayer
be1fd6d9d4 avcodec/prores_raw: Tiles of width less than 16 result in undefined behavior
Fixes: passing zero to __builtin_clz(), which is not a valid argument
Fixes: 471569982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PRORES_RAW_DEC_fuzzer-5832576221904896

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-02-14 18:53:08 +00:00
Michael Niedermayer
2ad078b589 avcodec/exif: Check that the values read exist in the input
Fixes: Timeout
Fixes: 471568865/clusterfuzz-testcase-minimized-ffmpeg_dem_AVI_fuzzer-4864048211755008
Fixes: 471951381/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_DEC_fuzzer-5069855998148608
Fixes: 471472005/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AMV_DEC_fuzzer-4660042365468672
Fixes: 471591900/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WEBP_fuzzer-5083936243122176
Fixes: 471593729/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEG_DEC_fuzzer-5401314998943744

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-02-14 18:52:43 +00:00
Valerii Zapodovnikov
4eca335d94 avcodec/hevc/hevcdec: take into account YUV400 in block length
Also move some definitions around.

Signed-off-by: Valerii Zapodovnikov <val.zapod.vz@gmail.com>
2026-02-14 16:23:16 +00:00
James Almer
a7522f3fef avcodec/libvorbisenc: export padding samples if needed
Based on code from libopus encoder wrapper.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-02-13 11:50:32 -03:00
James Almer
23dce39d5a avcodec/libvorbisenc: export initial padding during init()
Priming samples don't depend on the contents of the first frame passed to the
encoder but rather on encoder configuration, so use dummy vorbis_dsp_state and
vorbis_block with the main encoder vorbis_info to generate a packet we can then
parse to derive the initial padding.

Muxers will now be aware of the initial padding before receiving packets, which
will allow them to write proper container headers during init without any extra
considerations like having to do a second pass or rewrite during write_trailer.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-02-13 11:50:32 -03:00
Andreas Rheinhardt
0a629df0a8 avcodec/ratecontrol: Move emms_c() to the only callsite needing it
Namely to one of the three callsites in snowenc.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-02-13 09:21:33 +01:00
Andreas Rheinhardt
059654a73b avcodec/ratecontrol: Remove unnecessary emms_c()
ff_rate_control_init/uninit() are only called during
codec init or close and no DSP calls happen in these,
so there is no need to reset the floating point state.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-02-13 09:21:33 +01:00
Andreas Rheinhardt
fe1742618d avcodec/snowenc: Remove redundant emms_c()
This emms_c() has been superseded by the one added
a few lines above in 2c1d38d1e1.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-02-13 09:21:33 +01:00
Andreas Rheinhardt
c5d9711be4 avcodec/mpegvideoenc: Remove MMX from comment
The MMX code has been removed in 5ef613bcb0
and MMX was not used for most cpus even before then.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-02-13 09:21:33 +01:00
Andreas Rheinhardt
fe0d8cb3e4 avcodec/x86/dirac_dwt: Remove MMX in comment
Forgotten in 5e332fe35c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-02-13 09:21:33 +01:00
James Almer
ff98352c3d avcodec: set skip_samples in generic code
Decoders should only worry about exporting AVCodeContext->delay during init.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-02-12 09:59:54 -03:00
Andreas Rheinhardt
afb374f109 avcodec/dpcm: Remove unnecessary flush callbacks
{INTERPLAY,ROQ,XAN}_DPCM does not use the stored samples at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-02-12 11:06:33 +01:00
Andreas Rheinhardt
e3ec6322bb avcodec/dpcm: Avoid trailing '_' in macro parameters
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-02-12 11:06:33 +01:00
Andreas Rheinhardt
66c7bf3bf8 avcodec/adpcmenc: Don't advertise ineffective options
ADPCM_ARGO, ADPCM_IMA_QT and ADPCM_SWF don't use
the block_size option at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-02-12 10:34:19 +01:00
Andreas Rheinhardt
b764f40eaa avcodec/adpcmenc: Check sample rates, ch layouts generically
This also advertises the supported sample rates/channel layouts.
For ADPCM_IMA_AMV, it actually fixes the advertised channel layouts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-02-12 10:34:19 +01:00
Andreas Rheinhardt
77d7891052 avcodec/adpcmenc: Mark unreachable code as such
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-02-12 10:34:19 +01:00
James Almer
10acab8df5 avcodec/hevc/hevcdec: report unparsed unknown NALUs types at verbose level
Reduces spamming at default log level.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-02-11 21:57:20 -03:00
Kacper Michajłow
3b4281e919 avcodec/hevc/hevcdec: skip logging 'Skipping NAL unit 63'
We know that this is Dolby Vision Enhancement Layer and while it's not
handled, we can just reduce log spam for this, as it's if fact
recognized.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-02-12 00:56:21 +00:00
Kacper Michajłow
fa36645f7e avcodec/bsf/dovi_rpu: fix typo
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-02-12 00:56:21 +00:00
John Chadwick
a469598191 avcodec/psd: Support auxiliary channels
Photoshop documents can contain additional "auxiliary" channels that
don't take part in layer compositing, therefore, using the channel count
to determine the presence of an alpha channel in the merged image is
incorrect. Instead, as per the PSD specification, use the sign of the
layer count (present in the layers and masks section) to determine if
there is an alpha channel, then determine the number of primary channels
using both the presence of the alpha channel and the pixel format.
2026-02-11 20:35:20 +00:00
Andreas Rheinhardt
7e3781e3ca avcodec/libcodec2: Remove always-false checks
Already checked via CODEC_SAMPLERATES and CODEC_SAMPLEFMTS.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-02-11 12:07:38 +01:00
Andreas Rheinhardt
12c2a4e117 avcodec: Don't set AVCodec.sample_fmts,ch_layouts for decoders
It is pointless for them given that these values will
be overridden by the decoder lateron anyway.
The only exceptions to this are scenarios where the decoder
actually checks request_sample_fmt or where there are both
fixed- and floating point decoders.

(IMO something like get_format() for audio would be better for
both cases.)

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-02-11 12:07:35 +01:00