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

119106 Commits

Author SHA1 Message Date
Timo Rothenpieler
4c7d0f88f5 avcodec/Makefile: remove redundant object
It's already listed in OBJS-$(CONFIG_JNI), which should cover all cases
STLIBOBJS does and more.
2025-03-13 01:28:50 +01:00
Andreas Rheinhardt
34aa8449b8 avcodec/pthread*: Mark init, free, flush functions as av_cold
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-12 17:00:24 +01:00
Andreas Rheinhardt
8abac5898b avcodec/sbcdec_data: Merge data into header
sbcdec_data.h is only included by sbcdec.c, so this won't
cause the data to be included multiple times in the binary.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-12 17:00:24 +01:00
Andreas Rheinhardt
a6c58450da all: Fix doxy comments wrongly designated as trailing ///<
The ///< or /**< form of doxygen comments are only to be used
when the documentation follows the member and the comment
block starts on the same line as the member. This commit
fixes wrong uses of them; in particular, this fixes the comment
for mb_height in H.264 SPS's structure which was wrongly added
to mb_width.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-12 17:00:24 +01:00
Andreas Rheinhardt
e99faf28d5 avcodec/vc2enc: Avoid excessive inlining
There is no reason to inline put_vc2_ue_uint() everywhere;
only one call site is actually hot: The one in encode_subband()
(which accounts for 35735040 of 35739495 calls to said function
in a FATE run). Uninline all the others.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-12 16:58:53 +01:00
Andreas Rheinhardt
fcd5df5904 fftools/ffmpeg_opt: Remove unused alt_bsf
Forgotten in 6325aede08.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-12 16:58:16 +01:00
Zhao Zhili
0f7d77fc42 avformat/flvdec: Use appropriate error code
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
2025-03-12 16:07:20 +08:00
Zhao Zhili
fa5a100ed2 avformat/flvdec: Fix error handling of parse_video_color_info
Some error should not be ignored.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
2025-03-12 16:07:09 +08:00
Zhao Zhili
291fdc96ab avformat/flvdec: Use float for FLVMasteringMeta
The precision should be enough for primaries and luminance.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
2025-03-12 16:04:00 +08:00
Zhao Zhili
888f5ea72b avformat/flvdec: Use appropriate types in FLVMetaVideoColor
This also reduce memory usage.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
2025-03-12 16:03:56 +08:00
Zhao Zhili
f0cf122cf4 avformat/flvdec: Remove one level of indentation
Also remove the condition of AMF_DATA_TYPE_BOOL when parse color
info. There is no AMF_DATA_TYPE_BOOL type in color info.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
2025-03-12 16:03:38 +08:00
Zhao Zhili
4f53ecf114 avformat/flvdec: Put FLVMetaVideoColor inside FLVContext directly
1. Rename metaVideoColor to meta_color_info
2. Allocated FLVMetaVideoColor together with FLVContext
3. Improve the use of meta_color_info_flag. Do a sequence of strcmp
only if meta_color_info_flag is FLV_COLOR_INFO_FLAG_PARSING.
4. Check return value of amf_parse_object().

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
2025-03-12 16:03:15 +08:00
Zhao Zhili
f34294897f avformat/flvdec: Fix use sizeof(AVMasteringDisplayMetadata)
sizeof AVMasteringDisplayMetadata isn't part of ABI.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Reviewed-by: James Almer <jamrial@gmail.com>
2025-03-12 16:02:12 +08:00
Zhao Zhili
7b81676be4 tests: Add enhanced-flv-hevc-hdr10 for demux and mux HDR color info
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
2025-03-12 16:01:20 +08:00
Andreas Rheinhardt
74412bd108 avcodec/snow: Remove ff_snow_release_buffer()
Pointless after 7e41f95dce.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-12 07:29:40 +01:00
Andreas Rheinhardt
b0af322654 avcodec/vc2enc: Use LUT to assemble interleaved golomb code
Up until now, the encoder processed only one bit at a time.
With this patch, it is eight bits.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-12 07:27:48 +01:00
Michael Niedermayer
0b097ed9f1 avcodec/ffv1enc_template: Be a bit more verbose on error
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-03-11 14:17:02 +01:00
Michael Niedermayer
a8a83e06f9 avcodec/ffv1: Fix remap and float with golomb rice
Sponsored-by: Sovereign Tech Fund
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-03-11 14:17:02 +01:00
Michael Niedermayer
99f0f6e401 avcodec/ffv1enc: Fix slice coding mode 1 with rgb frames
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-03-11 14:17:01 +01:00
Nil Fons Miret
9899da8175 libavfilter: guard against ff_draw_init/ff_draw_init2 failures
The return value of ff_draw_init and ff_draw_init2 are not checked in
most usages. However, if they return an error, they don't get to the
point where they set the attributes of the FFDrawContext. These
functions are typically used in conjunction with ff_draw_color, which
checks draw->desc->flags, causing a null pointer dereference.

Signed-off-by: Nil Fons Miret <nilf@netflix.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-03-11 14:17:01 +01:00
Lynne
bdc07f372a hwcontext_vulkan: add support for mapping multiplane images into CUDA
This patch refactors the CUDA import code to allow for Vulkan images
with multiple planes to be mapped.

Currently, a driver bug exists which causes NV12 images to be mapped
incorrectly when the memory being mapped contains both planes, the
issue has been reported to NVIDIA.
yuv420p does work correctly, however.

This is still an improvement, as the code used to crash when trying to
map the memory, unless disable_multiplane=1 was given as an option.
2025-03-11 13:42:19 +01:00
Brad Smith
49c8f33262 lsws/ppc/yuv2rgb_altivec: Fix build in non-VSX environments with Clang v2
v2: test for function if AltiVec is enabled instead of with AltiVec and without VSX
2025-03-11 00:31:47 -04:00
Andreas Rheinhardt
6a7a77023e avcodec/dvdsubenc: Remove pointless wrapper
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-11 04:37:21 +01:00
Andreas Rheinhardt
ede2b391cc avcodec/put_bits: Add and use put_bits63()
When using a 64bit PutBitContext (i.e. on x64), put_bits_no_assert()
can naturally write up to 63 bits. So one can avoid treating the
cases <32bits, 32 bits and <63 bits differently.

As it turns out, no user actually wants to write 64 bit at once
(maybe except testprograms).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-11 04:37:21 +01:00
Andreas Rheinhardt
512e597932 avcodec/vc2enc: Simplify writing dirac golomb codes
The earlier code used a loop to determine the number of bits used
and called ff_log2() on a power of two (and it would be easy to
keep track of the exponent of said power-of-two); neither GCC nor
Clang optimized the loop away or avoided the ff_log2().
This patch replaces the loop and the log2 with a single av_log2().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-11 04:37:21 +01:00
Andreas Rheinhardt
27c82af2fe avutil/vulkan: Remove unused ff_vk_create_avbuf()
Unused since aea4d4b423.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-11 04:35:53 +01:00
Andreas Rheinhardt
e499c85999 avutil/refstruct: Fix documentation
Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-11 04:35:06 +01:00
James Almer
04d7a6d3db avcodec/exr: use luma+alpha float pixel formats
Signed-off-by: James Almer <jamrial@gmail.com>
2025-03-10 10:15:42 -03:00
James Almer
468577d1a5 swscale/input: add support for YAF16 and YAF32
Signed-off-by: James Almer <jamrial@gmail.com>
2025-03-10 10:15:42 -03:00
James Almer
61fc9b6fee avutil/pixfmt: add YAF16 and YAF32 pixel formats
Signed-off-by: James Almer <jamrial@gmail.com>
2025-03-10 10:15:42 -03:00
James Almer
5f5ab22639 avfilter/vsrc_testsrc: add support for semi planar formats to yuvtestsrc
Signed-off-by: James Almer <jamrial@gmail.com>
2025-03-10 10:15:33 -03:00
Martin Storsjö
73f4668ef8 swscale: aarch64: Simplify the assignment of lumToYV12
We normally don't need else statements here; the common pattern
is to assign lower level SIMD implementations first, then
conditionally reassign higher level ones afterwards, if supported.

Signed-off-by: Martin Storsjö <martin@martin.st>
2025-03-10 14:03:58 +02:00
Andreas Rheinhardt
87e5da9067 avcodec/wmaenc: Don't unnecessarily reset AVPacket.size
The packet is unreferenced generically lateron anyway.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-10 04:52:31 +01:00
Andreas Rheinhardt
196ee9fc86 avcodec/wma: Mark ff_wma_end() as av_cold
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-10 04:52:15 +01:00
Andreas Rheinhardt
b98beb3704 all: Use put_bytes_output() instead of put_bits_ptr - pb->buf
Avoids accessing internals of PutBitContext.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-10 04:51:57 +01:00
Andreas Rheinhardt
0971fcf0a0 avcodec/codec_internal, all: Use macros to set deprecated AVCodec fields
The aim of this is twofold: a) Clang warns when setting a deprecated
field in a definition and because several of the widely set
AVCodec fields are deprecated, one gets several hundred warnings
from Clang for an ordinary build. Yet fortunately Clang (unlike GCC)
allows to disable deprecation warnings inside a definition, so
that one can create simple macros to set these fields that also suppress
deprecation warnings for Clang. This has already been done in
fdff1b9cbf for AVCodec.channel_layouts.
b) Using macros will allow to easily migrate these fields to internal ones.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-10 00:57:23 +01:00
Andreas Rheinhardt
0349ae3ec4 avcodec/vp8: Remove always-false hwaccel checks for VP7
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-10 00:51:04 +01:00
Andreas Rheinhardt
a41baa743d avcodec/vp8: Move VPx specific functions inside #if CONFIG_VPx block
where appropriate. Avoids including ff_vp8_decode_frame()
when the VP8 decoder is disabled.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-10 00:50:57 +01:00
Andreas Rheinhardt
4040dc0782 avcodec/vp8: Move codec-specific init code out of common init
While just at it, also move the init functions inside
the #if CONFIG_VP?_DECODER (to avoid linking failures).
While just at it, also declare these init functions
as av_cold and uninline the remaining common init function.

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-10 00:50:49 +01:00
Andreas Rheinhardt
b6602a17e1 avcodec/vp8: Fix wrong #endif comment
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-10 00:50:24 +01:00
Frank Plowman
20a6eb1ca3 lavc/vvc: Stricter bound on pps_exp_slice_height_in_ctus_minus1
When pps_num_exp_slices_in_tile[i] is nonzero, the ith tile is made up
of pps_num_exp_slices_in_tile[i] slices stacked atop one another, where
the height of the jth slice in the ith tile is given by
pps_exp_slice_height_in_ctus_minus1[i][j].  The sum of the heights of
the slices in the tile should not exceed the height of the tile itself.

Signed-off-by: Frank Plowman <post@frankplowman.com>
2025-03-09 21:35:53 +08:00
Andreas Rheinhardt
e934fd96c1 avcodec/snow: Remove outdated assert
It comes from a time before frames were refcounted; it has indeed been
added in a follow-up commit to c13e490dce:
"codec_release_buffer: fix handling of non user buffers". This type
of check is obsolete now.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-09 04:23:40 +01:00
Andreas Rheinhardt
d7820a2b6f avcodec/sbcenc: Don't use deprecated AVCodec.supported_samplerates
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-09 04:20:52 +01:00
Andreas Rheinhardt
1b6f37ac13 avcodec/sbcenc: Mark sbc_encode_init() as av_cold
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-09 04:20:52 +01:00
Michael Niedermayer
1bce40cb73 avcodec/ffv1: Use dual run coder for fltmap
This improves compression by 0.1% overall and 44% for the changed table
I tried several other things but so far this is the best
compromise between complexity and compression

This can also be extended to 32 and 64bit floats

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-03-08 20:55:39 +01:00
Michael Niedermayer
9bad2634ee avcodec/ffv1: Store remap flag per slice
This allows switching it on conditionally and also for non float,
it may improve compression for RGB data that was paletted
or other synthetic images

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-03-08 20:55:38 +01:00
Michael Niedermayer
4a0c285dfe avcodec/ffv1: flip half of float16 and Compactify floats
float16 (and more so float32) have many odd values
half the values are negative, many are larger than "1.0"
and many values are very close to 0.

Storing the 16bits as is, looses compression because of the mixture
of dense and sparse regions and also many completely unused ones.

This simply remaps the 65536 values so no unused values remain
This improves compression by about 1.5% for the ACES_OT_VWG_SampleFrames testset
(this testset contains all kind of funny values including many images
 with negative rgb values)

The space needed for the map is insignificant compared to the
compression gained

This patch also flips half the float range as it can be done
using the same table.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-03-08 20:55:38 +01:00
Michael Niedermayer
c1b330bf24 avcodec/ffv1: Basic float16 support
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-03-08 20:55:38 +01:00
Manuel Lauss
114e9864e1 avcodec/sanm: ignore unknown codecs in FOBJs
Don't error out, just ignore unknown codec numbers and pretend
decode succeeded.  This is useful for older LucasArts titles
which stack a lot of different FOBJs with different codecs into
a single frame.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-03-08 20:55:37 +01:00
Andreas Rheinhardt
f641c6846a avutil/log: Set AVClass* in av_expr_eval()
Otherwise it is possible for av_log() to receive a non-NULL object
with a NULL AVClass pointer; the default log callback handles it
gracefully, yet this is probably an API violation.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-03-08 01:05:47 +01:00