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

119346 Commits

Author SHA1 Message Date
ce538ef97a swscale/output: Fix integer overflow in yuv2gbrp_full_X_c()
Fixes: signed integer overflow: 1966895953 + 210305024 cannot be represented in type 'int'
Fixes: 391921975/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-5916798905548800

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-04-10 03:01:32 +02:00
3aec1f87c9 avcodec/ffv1enc: permit 1024 slices
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-04-10 03:01:32 +02:00
00c50a29ab avcodec/nvdec_vc1: add marker insertion logic
This mirrors existing code in d3dxx and dxva hwaccels

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2025-04-09 21:08:55 +02:00
d073d0d3bb avcodec/dovi_rpuenc: Constify dv_levels
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-09 13:52:29 +02:00
1267273663 avcodec/m[jx]pegdec: Simplify freeing frame
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-09 13:52:29 +02:00
7ddcd55d51 tests/fate/vcodec: Test "default" Huffman tables, too
Since 45eeb1f785
optimal Huffman tables are the default (without slice-threading).
This made the fate-vsynth*-mjpeg-{trell-,}-huffman tests
identical to their corresponding tests without "-huffman".

This is of course wasteful, so switch the two tests with
"-huffman" counterparts back to the default tables.
Also use one of these tests to test slice threaded encoding.
It has so far been untested.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-09 13:52:29 +02:00
31d5686c39 avocdec/mjpegenc_huffman: Avoid redundant loop
There is no point in iterating over the list twice.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-09 13:52:29 +02:00
7ad16a4410 avcodec/mjpegenc_huffman: Make ff_mjpegenc_huffman_compute_bits() static
Only used here and in a test tool.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-09 13:52:29 +02:00
a2136d545c avcodec/aacenc_is: Make ff_aac_is_encoding_err() static
Possible since 9b11fefb88.
Also remove a now always-zero parameter.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-09 13:52:29 +02:00
d78cb537a2 avcodec/x86/hevcdsp: Move to x86/hevc
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-09 13:52:29 +02:00
05ae73ac90 avcodec/x86/hevcdsp: Move macro to dsp_init.c
It belongs to the [EQ]PEL_LINKS macros.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-09 13:52:29 +02:00
35aee3ca95 avcodec/x86/hevc/dsp_init: Reindent after the previous commits
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-09 13:52:29 +02:00
6875f495d9 avcodec/x86/hevc/dsp_init: Make ff_hevc_put_bi_[eq]?pel* funcs static
Given that there are actually ASM functions of this type,
one can't simply remove the ff_ prefix from the definitions
and declare them as static. Yet one can do nearly that
if one keeps the ff_ prefix and removes the declarations
for the (now static) functions defined in dsp_init.c
from hevcdsp.h and if one defines the functions in the correct
order (smaller width first) so that no forward declarations
are necessary (which was already true).

The new declarations avoid nested macros to simplify things.
It nevertheless turned out to be beneficial line-wise.

(It would be possible to avoid most of these declarations:
It is legal to repeat a function declaration without static
if the first declaration declared a function as static.
So if the macros simply declared all the functions that
they call, one could avoid declarations for the functions
that are called. While this is legal C, it unfortuntaly
clashes with GCC's -Wredundant-decls (which configure enables)
and it is also ugly, as these macro definitions would
provide declarations used in ff_hevc_dsp_init_x86().)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-09 13:52:29 +02:00
9211abfe7e avcodec/x86/hevc/dsp_init: Make ff_hevc_put_[eq]?pel_* static
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-09 13:52:29 +02:00
3f1aacff1c avcodec/x86/hevc/dsp_init: Make ff_hevc_put_uni_[qe]?pel* funcs static
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-09 13:52:29 +02:00
c34d77317e avcodec/x86/hevc/dsp_init: Make ff_hevc_put_bi_w_* functions static
They are always C wrappers around other functions.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-09 13:52:29 +02:00
0cd67da909 avcodec/x86/hevc/dsp_init: Make ff_hevc_put_uni_w_* functions static
These are always C functions.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-09 13:52:29 +02:00
977d65ae17 avcodec/x86/hevc/mc: Remove unused functions
Saved 11536B here.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-09 13:52:29 +02:00
d72a9af528 avcodec/celp_math: Mark ff_celp_math_init() as av_cold
Also do the same for ff_celp_math_init_mips().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-09 13:52:29 +02:00
77b147d3a2 avcodec/lsp: Make ff_acelp_lsp2lpc() static
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-09 13:52:29 +02:00
2c65d3be81 avcodec/celp_math: Reuse ff_scalarproduct_float_c()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-09 13:52:29 +02:00
159b482835 avcodec/x86/vvc/dsp_init: Make avg wrappers static
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-09 13:52:29 +02:00
5c619da0ed avcodec/x86/vvc/dsp_init: Make alf wrappers static
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-09 13:52:29 +02:00
ed37a8f75a avcodec/x86/vvc/dsp_init: Make ff_vvc_apply_bdof_##bd##_avx2 static
These wrappers around ff_vvc_apply_bdof_avx2() are only used in
dsp_init.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-09 13:52:29 +02:00
9ba6f99a62 avcodec/x86/vvc/dsp_init: Make put wrappers static
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-09 13:52:29 +02:00
aeed747f41 avutil/aes: use pthread_once to fill the static tables
Signed-off-by: James Almer <jamrial@gmail.com>
2025-04-09 08:44:50 -03:00
890b8da1ce configure: Allow mixing declarations and statements
This C90 rule forces us to use a too big scope and should
therefore be dropped. Given that we already require C11,
all supported compilers can handle mixed declarations
and statements just fine.

Reviewed-by: Zhao Zhili <quinkblack-at-foxmail.com@ffmpeg.org>
Reviewed-by: Marvin Scholz <epirat07@gmail.com>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-09 11:45:21 +02:00
830fab6891 avutil/tests/channel_layout: Improve enum range check
Both GCC and Clang use unsigned as underlying type of
an enum with no negative enumeration constants, making
checks like "layout->order >= 0" here tautologically true.
Clang warns about this. Combine both range checks
by casting to unsigned to suppress this warning.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-09 11:45:14 +02:00
02eda84bf2 avcodec/h264: fix reference reordering
Fixes hardware decoders depending on long_term_pic_idx.
Relevant ITU conformance test vectors: MR6_BT_B, MR8_BT_B

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-04-08 20:44:35 +08:00
1e5c65f539 avutil/dict: fix memleak in av_dict_set()
Regression since 19e9a203b7.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-04-07 23:38:09 -03:00
f3f1a48a07 APIChanges & version bump for AV_DICT_DEDUP
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-04-07 01:46:05 +02:00
89df6d4068 avcodec/ffv1enc: Fix remap > 0 with gbrp12, that is non float
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-04-07 01:02:43 +02:00
175cd4ced0 avcodec/ffv1enc: avoid slices larger than 360x288 if no value is specified
This improves speed by providing more independent things for more CPUs

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-04-07 01:02:43 +02:00
1b04fb385c avcodec/ffv1enc: Remove 65536 pixel per slice limit for remap
About 1% better compression with large slices

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-04-07 01:02:42 +02:00
feceed9222 avcodec/ffv1: Store slices*planes with the minimum bits needed after remap
This also means that if a plane*slice has only 1 color nothing
is stored after the remap table

This also corrects the RCT offset to the exact value after remap
not a fixed 65536

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-04-07 01:02:42 +02:00
80b77e8e8d lavf/id3v2dec: support multiple values and TIPL frames
Fixes https://trac.ffmpeg.org/ticket/6949

Ordinary text frames in ID3v2 are allowed to have multiple
(null-separated) values. This technically isn't allowed in TXXX,
but it's used in practice by Picard, and supporting it is harmless.

TIPL/IPL (Involved People List) and TMCL (Musician Credits List) work
similarly to TXXX, but alternate key-value-key-value.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-04-07 01:02:42 +02:00
172e7ca668 lavf/metadata: support duplicate keys in ff_metadata_conv
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-04-07 01:02:41 +02:00
19e9a203b7 lavu/dict: add AV_DICT_DEDUP
This is useful when multiple metadata inputs may set the same value
(e.g. both a container-specific header and an ID3 tag).

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-04-07 01:02:35 +02:00
779cbc2b97 checkasm: add tests for AES
Signed-off-by: James Almer <jamrial@gmail.com>
2025-04-06 11:02:10 -03:00
a35b4e8d29 avutil/x86/aes: ignore the upper bits in count
The argument is an int.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-04-06 11:02:09 -03:00
3f30ae823e avutil/aes_ctr: simplify incrementing the counter
Signed-off-by: James Almer <jamrial@gmail.com>
2025-04-05 20:46:40 -03:00
fe73b84879 avutil/aes_ctr: simplify and optimize av_aes_ctr_crypt()
Process data in chunks of four or eight bytes, depending on host, instead of
one at a time.

before:
55561 decicycles in av_aes_ctr_crypt

after:
52204 decicycles in av_aes_ctr_crypt

Signed-off-by: James Almer <jamrial@gmail.com>
2025-04-05 20:46:40 -03:00
2ea3c51795 lavu/aes: add x86 AESNI optimizations
crypto_bench comparison for AES-128-ECB:

lavu_aesni AES-128-ECB  size: 1048576  runs:   1024  time:    0.596 +- 0.081
lavu_c     AES-128-ECB  size: 1048576  runs:   1024  time:   17.007 +- 2.131
crypto     AES-128-ECB  size: 1048576  runs:   1024  time:    0.612 +- 1.857
gcrypt     AES-128-ECB  size: 1048576  runs:   1024  time:    1.123 +- 0.224
tomcrypt   AES-128-ECB  size: 1048576  runs:   1024  time:    9.038 +- 0.790

Improved-By: Henrik Gramner <henrik@gramner.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2025-04-05 20:46:40 -03:00
2daaafafc6 avutil/tests/aes_ctr: also randomize the encryption key
And not just the IV.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-04-05 20:46:40 -03:00
462d35dc72 avutil/tests/aes_ctr: reindent after the previous commit
Signed-off-by: James Almer <jamrial@gmail.com>
2025-04-05 20:46:40 -03:00
19085287b4 avutil/tests/aes_ctr: also check the encrypted buffer
The test in its current form is just ensuring the plain text output is the same
as the plain text input, not bothering to check if anything was done with the
latter. av_aes_ctr_crypt() could be a simple memcpy under the hood and this
test would still succeed.

To check the integrity of the encrypted buffer, both the IV and the key need to
be fixed. As such, and in order to not remove the existing randomization of the
input IV, do two runs, one with random initialization data, and one with static
data.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-04-05 20:46:40 -03:00
0a34f009aa avutil/tests/aes_ctr: test more than a single block worth of data
This should exercise the implementation more thoroughly after an upcoming
change.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-04-05 20:46:39 -03:00
ccf073e772 avcodec/d3d12va_decode: enable reference-only mode
The Reference-Only feature in DirectX 12 is a memory optimization
technique designed for video decoding scenarios.
This feature requires that reference resources must be allocated with
the D3D12_RESOURCE_FLAG_VIDEO_DECODE_REFERENCE_ONLY resource flag.
Reference textures must also be separated from output textures.
This feature is not supported in the current version of ffmpeg.
Since AMD GPU uses this feature in Direct 12 decoder,
ffmpeg does not support AMD GPU Direct 12 decoding.

Signed-off-by: Tong Wu <wutong1208@outlook.com>
2025-04-05 11:57:49 +08:00
37a319fb95 avcodec/ffv1enc: Consider 2s x s slice configurations
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-04-04 20:30:42 +02:00
2d9c9dae14 avcodec/ffv1dec: Limit size of fltmap* to pixel number
This reduces needed memory and also removes the 65536 maximum for remap
on the decoder side

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-04-04 20:30:42 +02:00