1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-10 06:10:52 +02:00
Commit Graph

118827 Commits

Author SHA1 Message Date
Lynne
3c09aadcf4 hwcontext_vulkan: allow using concurrent access images with more than 5 queues
This limit was not bumped when the queue family rewrite happened.

Fixes validation issues on nvidia.
2025-03-17 08:49:10 +01:00
Lynne
6c9affb3e6 hwcontext_vulkan: fix downloads; use the common host map function to map frame data
This commit uses the recently exported code for host mapping images back
where it was exported from.

The function also had broken download code for image downloading since its
recent refactor.
2025-03-17 08:49:09 +01:00
Lynne
a5b90caacd vulkan: copy host-mapping buffer code from hwcontext
This is useful elsewhere.
2025-03-17 08:49:09 +01:00
Lynne
ed6ee32846 vulkan: add ff_vk_create_imageview 2025-03-17 08:49:09 +01:00
Lynne
7046e65e37 vulkan: rename ff_vk_set_descriptor_image to ff_vk_shader_update_img 2025-03-17 08:49:08 +01:00
Lynne
49af9746e8 pixfmt: add AV_PIX_FMT_GBRAP32
This commit adds a 32-bit *integer* planar RGBA format.
Vulkan FFv1 decoding is best performed on separate planes, rather than
packed RGBA (i.e. RGBA128), hence this is useful as an intermediate format.
2025-03-17 08:49:04 +01:00
Danil Iashchenko
a1c6ca1683 doc/filters: Shift CUDA-based filters to own section. 2025-03-17 12:38:51 +05:30
Andreas Rheinhardt
5ad86d5fbc avcodec: Mark init and close functions as av_cold
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 04:33:11 +01:00
Marvin Scholz
81ca85a087 configure: allow mixed declarations and code for Objective-C
Mixing declarations and code is quite common in Objective-C (as can be
seen by the number of warnings we have for this in Objective-C files)
and forcing to not do it usually results in worse code, with unnecessary
widely scoped variables, which in turn makes variable shadowing and
accidentally using the wrong variable more common and harder to notice.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-03-17 10:59:26 +08:00
Marvin Scholz
163e5fd84d configure: fix passing Objective-C flags
Passing Objective-C flags from configure to the Makefiles was broken, as
configure incorrectly used the OBJCCFLAGS instead of OBJCFLAGS variable
which was then later overwritten in the common.mak:

  OBJCCFLAGS  = $(CPPFLAGS) $(CFLAGS) $(OBJCFLAGS)

The fix for this is simple, analogous to how it is handled for CFLAGS,
use OBJCFLAGS here so that the flags are properly included in the
aforementioned OBJCCFLAGS definition.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-03-17 10:57:29 +08:00
Andreas Rheinhardt
3ad00ebf2c avcodec/mpeg12dec: Don't assert on thread_count
Nothing in this decoder would break if the generic code were to be
changed to allow slice "threading" with only one thread.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:46:00 +01:00
Andreas Rheinhardt
2742de0e4a avcodec/mpeg12dec: Use saturated addition when combining error_count
Fixes undefined integer overflows. The overflows could always
happen, yet before 4d8b706b1d
it was not undefined because the code implicitly used atomic
types, for which signed integer overflow is defined.

Reported-by: Kacper Michajlow <kasper93@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:46:00 +01:00
Andreas Rheinhardt
60f49f4d92 avcodec/qdm2: Use explicit overread checks instead of implicit ones
If there were not enough data, checksum_size would be read
as zero (due to the implicit checks of the bytestream2 API)
and run into a "data block size invalid" error. Erroring out
earlier via "not enough extradata" is better.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
Andreas Rheinhardt
be7642b198 avcodec/qdm2, vorbisdec: Use compile-time const max_depth in get_vlc2
It makes no sense to try to be exact with max depth
in get_vlc2(): It will mean that the compiler emits code
for all three stages of parsing and runtime checks for
whether max_depth is big enough to parse the next stage
when a not yet complete code has been encountered.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
Andreas Rheinhardt
c228ae2b40 avcodec/cfhd: Use smaller scope where appropriate
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
Andreas Rheinhardt
32fba0bce5 avcodec/cfhd: Move GetBitContext from context to stack
Its lifetime is extremely limited.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
Andreas Rheinhardt
8a2e84dc96 avcodec/hqx: Simplify deriving AC table index
It can be simply encoded in the quant coefficients itself
as they are so small.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
Andreas Rheinhardt
2f4f96f1ac avcodec/hqx: Combine checks
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
Andreas Rheinhardt
02b5aee879 avcodec/hqx: Don't zero in small chunks, don't zero twice
Up until now, decode_block() zeroed every block (of 128 bytes)
before decoding a block; yet this is suboptimal for all modes,
because all modes need to reset all the blocks they use anyway
and so it should be done in one go for all blocks.

For the alpha modes (where blocks need not be coded) all blocks
are zeroed initially anyway, because decode_block() might not
be doing it, so zeroing there again for the coded blocks is
a waste.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
Andreas Rheinhardt
7d70fb3530 avcodec/hqx: Combine memsets
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
Andreas Rheinhardt
997b33f64c avcodec/hqxvlc: Make dc9, dc10 VLC tables static
It allows to share them between frame threads.
dc11 can unfortunately not be made static without increasing
LOCALBUF_ELEMS in vlc.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
Andreas Rheinhardt
004367a0a3 avcodec/hqx: Cache pointer to used dc table
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
Andreas Rheinhardt
5dd83ecfb2 avcodec/hqxvlc: Make cbp_vlc static
This is trivial as well as beneficial because frame threads
now use the same table, saving cache/memory.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
Andreas Rheinhardt
c9d87f4a85 avcodec/hqx: Include hqxvlc directly
This avoids having to expose HQXContext in a header
and allows to make several symbols static.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
Andreas Rheinhardt
09411fef3d avcodec/hqxvlc: Include implicit +1 run in RL VLC tables
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
Andreas Rheinhardt
abffd9313d avcodec/hqxvlc: Avoid hardcoded RL VLC table
hqxvlc.c contains sort-of run-length VLCs in hardcoded form;
they amount to 26688 elements, taking 104KiB. These tables contain
many duplicated entries (they are partially created via a RPT_1024
macro). There are actually only 3039 different codes in all tables
combined, making this very wasteful.

This commit changes this by extracting the underlying entries
and creating a (static) RL-VLC. This only costs 3*3039 bytes
of .rodata. The resulting table needs only 15630 entries,
because our VLC init code uses smaller subtables when possible
(for an incomplete code, the negative of the length stored in
the VLC code is the number of bits the subtable uses; the hardcoded
tables uses a worst-case per table value).

Using GET_RL_VLC also gets rid of an unnecessary reload in case
a code is too long to be parsed in the first stage.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
Andreas Rheinhardt
49d15dfc35 avcodec/rl: Avoid temporary stack VLC array during RL VLC init
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
Andreas Rheinhardt
3869862b00 avcodec/mpeg12: Avoid temporary stack VLC array during RL VLC init
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
Andreas Rheinhardt
0facdafd1e avcodec/vlc: Merge VLCElem and RL_VLC_ELEM
It will simplify creating RL-VLCs (which until now used
a stack-based VLC as temporary buffer).

Notice that there would be another option to merge them, namely:
struct VLCElem {
    union {
        VLCBaseType sym;
        int16_t level;
    };
    int8_t len;
    uint8_t run;
};

The main difference to the current patch is that this would change
the type of the length field of VLCElem to int8_t from int16_t.
It turns out that that this would entail additional sign extensions
on ppc, see https://godbolt.org/z/behWYEYE7. I have therefore refrained
from doing so, although it would make the patch simpler.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:26:07 +01:00
Andreas Rheinhardt
54d582e749 avcodec/pcm: Avoid AVCodec.sample_fmts for decoders
These fields are meant to be for encoders; just use a local
table in pcm_decode_init() to convert from AVCodecID to AVSampleFormat
and also use it to provide sample_size.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:19:12 +01:00
Andreas Rheinhardt
05ab776210 avcodec/pcm: Reindent after the previous commit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:18:15 +01:00
Andreas Rheinhardt
c6d7436508 avcodec/pcm: Use dedicated init function for F16LE, F24LE
This avoids a switch and allows to simply use
a dedicated private context for them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:18:14 +01:00
Andreas Rheinhardt
e76daf6279 avcodec/pcm: Don't allocate LUT when unused
Instead use a dedicated context for the few decoders that
use the LUT. Also use a dedicated init function for them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:11:47 +01:00
Andreas Rheinhardt
f2168f4d86 avcodec/pcm: Remove duplication from FFCodec define macros
Also align it in preparation of a slightly longer macro.

Reviewed-by: Ramiro Polla <ramiro.polla@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 03:05:39 +01:00
Andreas Rheinhardt
485e5388e9 avcodec/pcm: Cache sample_size value
No need to go through two switches per packet.

Reviewed-by: Ramiro Polla <ramiro.polla@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 02:58:09 +01:00
Andreas Rheinhardt
5247090b0d avcodec/pcm: Remove always-false check
All codecs here have a valid sample size at this point.
This check has (presumably) been added for DVD PCM,
but even for them the check was always-true after
381e195b46 (and the DVD
code was later moved out altogether). So just remove
this check and the leftover DVD comment.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-17 02:57:35 +01:00
James Almer
1eafbf8203 avcodec/exrdec: restore applying color transfer characteristics for float16 samples
Regression since 0e917389fe.
This change also reverts commit 431805c096.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-03-16 11:38:13 -03:00
Andreas Rheinhardt
b5be0c0aa9 avcodec/eamad: Don't store transient macroblock indices in context
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-16 04:24:32 +01:00
Andreas Rheinhardt
f6366cb5ea avcodec/eamad: Optimize processing escape codes
Said escape code is only six bits long, so that one has at least 25 - 6
bits in the bitstream reader's cache after reading it; therefore the
whole following 16 bits (containing the actual code) are already in the
bitstream reader's cache, making it unnecessary to reload the cache.

This is the eamad analogue of fe9bc1cc45.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-16 04:24:32 +01:00
Andreas Rheinhardt
2e5f01e064 avcodec/mdec: Don't update cache unnecessarily
It won't be used anyway.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-16 04:24:32 +01:00
Andreas Rheinhardt
9aeb6940a2 avcodec/mdec: Optimize processing escape codes
Said escape code is only six bits long, so that one has at least 25 - 6
bits in the bitstream reader's cache after reading it; therefore the
whole following 16 bits (containing the actual code) are already in the
bitstream reader's cache, making it unnecessary to reload the cache.

This is the mdec analogue of fe9bc1cc45.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-16 04:24:32 +01:00
Andreas Rheinhardt
de562e8069 avcodec/mdec: Remove write-only block_last_index
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-16 04:24:32 +01:00
Andreas Rheinhardt
461b86fe7d avcodec/intrax8: Stop setting write-only block_last_index
These values are only used by the mpegvideo unquantize functions,
yet these are not active when intrax is in use. Furthermore,
given that ff_intrax8_decode_picture() decodes multiple
macroblocks in a given call, it makes no sense to return
any value (that was in practice the maximum of the indices
of all the macroblocks decoded).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-16 04:24:32 +01:00
Andreas Rheinhardt
1a564c1aff avcodec/vc1_block: Stop setting write-only block_last_index
It is only used by the mpegvideo unquantize functions which
this decoder does not use at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-16 04:24:32 +01:00
Andreas Rheinhardt
594b97e433 avcodec/mpegvideo_dec: Mark init, flush, close functions as av_cold
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-16 04:24:32 +01:00
Andreas Rheinhardt
248a6578a3 avcodec/msmpeg4enc: Inline constant
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-16 04:24:32 +01:00
James Almer
c88614662c avcodec/d3d12va_encode: use the correct specifier to log size_t values
Signed-off-by: James Almer <jamrial@gmail.com>
2025-03-15 21:06:33 -03:00
James Almer
3f57063c58 avcodec/ffv1dec: set the FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM capability
Will prevent decoding frame data during probing.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-03-15 18:43:18 -03:00
James Almer
63fa1f52b9 swscale/swscale_unscaled: make the fast planar copy path work with more formats
dst_depth - src_depth where the result is 6 or 7 in a high bd path means this
is only executed for 16 -> 10 and 16 -> 9.
This patch makes this path general, supporting arbitrary formats as long as
dst_depth > src_depth > 8.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-03-15 18:43:18 -03:00
James Almer
819dec697a swscale/swscale_unscaled: account for semi planar formats with data in the msb
Fixes fate failures introduced by recent tests that exercise the faulty code.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-03-15 18:43:18 -03:00