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

119467 Commits

Author SHA1 Message Date
12c9ffa569 avcodec/hq: Include alpha in cbp VLC table
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-13 08:21:29 +02:00
e38616c4ac avcodec/hq{xvlc,_hqadata}: Deduplicate and hardcode cbp table
This table is so small (32 elements amounting to 128 bytes)
that it is more efficient size-wise to hardcode it instead
of initializing it at runtime.

Also stop duplicating it in hq_hqa.o and hqx.o.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-13 08:14:51 +02:00
30996b7195 avcodec/avcodec: Remove always-false check
avcodec_free_context() only calls ff_codec_close() if there
is an AVCodecContext and avcodec_open2() unconditionally
dereferences the AVCodecContext*.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-12 09:58:58 +02:00
cf1c52c5c6 avcodec/h261dec: Set pict_type during init
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-12 09:58:58 +02:00
88d8150de7 avcodec/h261dec: Export key frame information
Implements ticket #8343.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-12 09:58:58 +02:00
6a202c3431 avcodec/asvenc: Use tighter MAX_MB_SIZE constant
Also document the constant.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-12 09:58:12 +02:00
9bb617b3e7 avcodec/asvenc: Don't use FF_INPUT_BUFFER_MIN_SIZE
ASV-1/2 does not really have a header and so using
FF_INPUT_BUFFER_MIN_SIZE is wasteful as well as ugly
(such bounds should be codec-specific).

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-12 09:57:13 +02:00
b02985b12c avcodec/amfenc_av1: Add B-frame QP control 2025-04-11 12:21:37 +02:00
f702cf422a avcodec/mediacodecdec: Reset optional fields when parse format
Parse format can be called multiple times, e.g., when resolution
changed. If getInt32 fails, optional member variables will retain
their previously set values without modification. This can be a
big problem for new resolution with old crop info.

This patch reset optional fields to zero when getInt32 failed.
2025-04-11 17:26:15 +08:00
93ae305ce1 fftools/ffprobe: Rename AVTextFormatContext variables (w => tfc)
Signed-off-by: softworkz <softworkz@hotmail.com>
2025-04-11 03:06:48 +02:00
15e99b2398 fftools/ffprobe: Rename writer_print_section_* and WriterContext
separated for better clarity of the preceding commit

Signed-off-by: softworkz <softworkz@hotmail.com>
ren
2025-04-11 03:06:47 +02:00
d7a3f68fea fftools/ffprobe: Change to use textformat api
Signed-off-by: softworkz <softworkz@hotmail.com>
2025-04-11 03:06:47 +02:00
97d680d450 fftools/textformat: Extract and generalize textformat api from ffprobe.c
Signed-off-by: softworkz <softworkz@hotmail.com>
2025-04-11 03:06:47 +02:00
d79e4f6d0b tests/fate/checkasm: add the aes test
Signed-off-by: James Almer <jamrial@gmail.com>
2025-04-10 12:03:52 -03:00
a039726c2a avutil/x86/aes: remove a few branches
The rounds value is constant and can be one of three hardcoded values, so
instead of checking it on every loop, just split the function into three
different implementations for each value.

Before:
aes_decrypt_128_aesni:                                  93.8 (47.58x)
aes_decrypt_192_aesni:                                 106.9 (49.30x)
aes_decrypt_256_aesni:                                 109.8 (56.50x)
aes_encrypt_128_aesni:                                  93.2 (47.70x)
aes_encrypt_192_aesni:                                 111.1 (48.36x)
aes_encrypt_256_aesni:                                 113.6 (56.27x)

After:
aes_decrypt_128_aesni:                                  71.5 (63.31x)
aes_decrypt_192_aesni:                                  96.8 (55.64x)
aes_decrypt_256_aesni:                                 106.1 (58.51x)
aes_encrypt_128_aesni:                                  81.3 (55.92x)
aes_encrypt_192_aesni:                                  91.2 (59.78x)
aes_encrypt_256_aesni:                                 109.0 (58.26x)

Signed-off-by: James Almer <jamrial@gmail.com>
2025-04-10 12:02:34 -03:00
4d4b301e4a checkasm: hevc_pel: Use helpers for checking for writes out of bounds
This allows catching whether the functions write outside of
the designated rectangle, and if run with "checkasm -v", it also
prints out on which side of the rectangle the overwrite was.

Signed-off-by: Martin Storsjö <martin@martin.st>
2025-04-10 13:30:18 +03:00
f6cd9bfa82 doc/encoders: Document png pred
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-04-10 03:01:34 +02:00
fbf002dbd2 avcodec/pngenc: set default prediction method to PAETH
this is a good compromise between speed and compression

-rw-r----- 1 michael michael 180987 Feb  6 14:29 lena-def.png
-rw-r----- 1 michael michael 128430 Feb  6 14:36 lena-pavg.png
-rw-r----- 1 michael michael 126269 Feb  6 14:36 lena-pmixed.png
-rw-r----- 1 michael michael 180987 Feb  6 14:35 lena-pnone.png
-rw-r----- 1 michael michael 127758 Feb  6 14:35 lena-ppaeth.png

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-04-10 03:01:33 +02:00
e47a3c7d62 doc/encoders: Document compression_level for PNG
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-04-10 03:01:33 +02:00
c6a889f3e0 avcodec/osq: avoid undefined negation
Fixes: negation of -2147483648 cannot be represented in type 'int32_t' (aka 'int'); cast to an unsigned type to negate this value to itself
Fixes: 390646659/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OSQ_fuzzer-5040277374435328

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:33 +02:00
d16a058dbc swscale/swscale: Do not crash on floats
Fixes: shift exponent 32 is too large for 32-bit type 'unsigned int'
Fixes: division by zero
Fixes: 391981061/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-6691017763389440
Fixes: 392929028/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-5142088307507200

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
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