Commit Graph

116281 Commits

Author SHA1 Message Date
Niklas Haas
4ec45aca36 swscale/utils: fix leak on threaded ctx init failure
This count gets incremented after init succeeds, when it should be
incremented after *alloc* succeeds. Otherwise, we leak the context on
failure.

There are no negative consequences of incrementing for
allocated-but-not-initialized contexts, as the only functions that
reference it will, in the worst case, simply behave as if called on
allocated-but-not-initialized contexts, which is in line with expected
behavior when sws_init_context() fails.
2024-07-14 13:48:59 +02:00
Alexander Strasser
36aee69f0d libavdevice: Improve example in deprecation message for opengl and sdl
When piping ffmpeg into ffplay both programs write a status line in
the terminal. That causes flickering and invisibility of one or the
other status line.

As compromise set ffplay log level to warning, so it doesn't show
the status line.

The user is usually testing ffmpeg command lines and want's a
preview of the result. This way the user can see the ffmpeg output
and still see errors and warnings from ffplay, should they occur.

Additionally set PTS to zero in ffplay to lessen the delay until
the frames are displayed. Without it delay is quite observable
when e.g. live capturing with low frame rates.
2024-07-14 13:31:03 +02:00
Rémi Denis-Courmont
8b3d997bed lavc/h264dsp: remove MMI 8-bit 4:2:2 chroma DC dequant
The function is exactly identical to the C reference, only with the
constant propagated and the loop unrolled manually.
2024-07-14 11:39:35 +03:00
Rémi Denis-Courmont
a194131cb6 lavc/h264dsp: remove MMI 8-bit chroma DC dequant
The function is exactly identical to the C reference, only with the
constant propagated manually. It does not optimise anything.
2024-07-14 11:39:35 +03:00
Rémi Denis-Courmont
4e0e872881 lavc/h264dsp: R-V V high-depth h264_idct_add
T-Head C908 (cycles):
h264_idct4_add_9bpp_c:        248.2
h264_idct4_add_9bpp_rvv_i32:  128.7
h264_idct4_add_10bpp_c:       256.7
h264_idct4_add_10bpp_rvv_i32: 128.7
h264_idct4_add_12bpp_c:       252.5
h264_idct4_add_12bpp_rvv_i32: 129.7
h264_idct4_add_14bpp_c:       258.0
h264_idct4_add_14bpp_rvv_i32: 129.7
2024-07-14 11:39:35 +03:00
James Almer
d059ea5663 avcodec/bsf/showinfo: print packet data checksum
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-13 23:48:34 -03:00
Marth64
f1abb754aa avformat/dvdvideodec: Fix incorrect padding cell trim logic
When -trim option is used (by default), padding cells
at the beginning of the title are supposed to be ignored.
The current implementation does the ignoring after we
have locked on to the PGC navigation event stream,
but does not set the PGC/PG state properly.

This causes false positives and errors on some discs
due to a search for a program stream cell that
never succeeds. User would have to know to disable
the -trim option to work around the issue.

Simplify the logic and move it to the NAV packet
event handling, in turn implementing the behaviour
correctly and fixing the trim function for impacted discs.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-07-13 17:17:36 +02:00
Marth64
f37f86a774 avformat/dvdvideodec: Remove redundant ret initializations
Remove initializing ret = 0, in areas where ret is
only used to hold an error value, immediately returned,
and the function would otherwise return a literal 0.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-07-13 17:17:27 +02:00
Marth64
eb07a593d3 avformat/dvdvideodec: Don't add chapter markers for empty/dummy PTTs
Some discs (usually same ones with padding cells), also have empty
padding PTTs / chapters to accompany them. This results, for example,
in an extra chapter marker that starts and ends at 0 (no duration).

Don't add these empty chapter markers.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-07-13 17:17:22 +02:00
Michael Niedermayer
9af348bd1a
avcodec/flac_parser: Assert that we do not overrun the link_penalty array
Helps: CID1454676 Out-of-bounds read

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-12 22:49:33 +02:00
Michael Niedermayer
ed34b0c54e avcodec/osq: avoid signed overflow in downsample path
Fixes: signed integer overflow: 865309950 * 256 cannot be represented in type 'int'
Fixes: 69191/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OSQ_fuzzer-6310214413385728

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-12 22:45:58 +02:00
Michael Niedermayer
12dab3860c tools/target_enc_fuzzer: A64MULTI5 encoder is very slow, check and adjust threshold
Fixes: Timeout
Fixes: 68999/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_A64MULTI5_fuzzer-5078418784845824

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-12 22:44:19 +02:00
Michael Niedermayer
032e831ab4 tools/target_enc_fuzzer: A64MULTI encoder is very slow, check and adjust threshold
Fixes: Timeout
Fixes: 69097/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_A64MULTI_fuzzer-5062757287264256

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-12 22:44:17 +02:00
Michael Niedermayer
0474614e6c avcodec/pixlet: Simplify pfx computation
Found by reviewing code related to CID1604365 Overflowed constant

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-12 22:42:46 +02:00
Michael Niedermayer
f18b442370 avcodec/motion_est: Fix score squaring overflow
Fixes: CID1604552 Overflowed constant

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-12 22:42:44 +02:00
Michael Niedermayer
06f01d9fa0 avcodec/mlpenc: Use 64 for ml, mr
Fixes: CID1604429 Overflowed constant

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-12 22:42:42 +02:00
Michael Niedermayer
371265f0ec avcodec/me_cmp: Fix type check
Fixes: CID1604375 Out-of-bounds read

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-12 22:42:40 +02:00
Michael Niedermayer
d553276843 avcodec/loco: Check loco_get_rice() for failure
Fixes: CID1604495 Overflowed constant

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-12 22:42:38 +02:00
Michael Niedermayer
b989986641 avcodec/loco: check get_ur_golomb_jpegls() for failure
Fixes: CID1604400 Overflowed constant

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-12 22:42:35 +02:00
Michael Niedermayer
0e3e7e8aeb avcodec/leaddec: Check init_get_bits8() for failure
Fixes: CID1604416 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-12 22:42:33 +02:00
Michael Niedermayer
6e4c037833 avcodec/imm4: check cbphi for error
Fixes: CID1604356 Overflowed constant
Fixes: CID1604573 Overflowed constant

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-12 22:42:31 +02:00
Michael Niedermayer
cfe66dfebb avcodec/iff: Use signed count
This is more a style fix than a bugfix (CID1604392 Overflowed constant)

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-12 22:42:28 +02:00
Michael Niedermayer
1e888fb006 avcodec/hw_base_encode: Simplify EOF check
Found while reviewing CID1608712 Explicit null dereferenced

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-12 22:42:25 +02:00
Michael Niedermayer
b2aaeb81f6 avcodec/golomb: Assert that k is in the supported range for get_ur/sr_golomb()
Found by code review related to CID1604563 Overflowed return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-12 22:42:23 +02:00
Michael Niedermayer
7cf5b83f6f avcodec/golomb: Document return for get_ur_golomb_jpegls() and get_sr_golomb_flac()
Found while reviewing code related to CID1604409 Overflowed return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-12 22:42:21 +02:00
Michael Niedermayer
e5af1c6e91 avcodec/dxv: Fix type in get_opcodes()
Found by code review related to CID1604386 Overflowed constant

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-12 22:42:20 +02:00
Michael Niedermayer
69dcd123f1 avcodec/cri: Check length
Fixes: CID1604394 Overflowed constant

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-12 22:42:18 +02:00
Michael Niedermayer
96fd9417e2 avcodec/xsubdec: Check parse_timecode()
Fixes: CID1604490 Overflowed constant

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-12 22:42:14 +02:00
Michael Niedermayer
ba63e32957
avutil/imgutils: av_image_check_size2() ensure width and height fit in 32bit
width and height > 32bit is not supported and its easier to check in a central place

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-12 22:16:05 +02:00
Michael Niedermayer
20e59af07e
avfilter/vf_tiltandshift: Free dst on error
Fixes: CID1559901 Resource leak

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-12 21:58:50 +02:00
Michael Niedermayer
e6c0c5731e
doc/examples/mux: remove nop
Found through code review related to CID1604493 Overflowed constant

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-12 16:40:51 +02:00
Michael Niedermayer
93e0265e27
avcodec/proresenc_kostya: use unsigned alpha for rotation
Fixes: left shift of negative value -208
Fixes: 69073/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PRORES_KS_fuzzer-4745020002336768

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-12 16:40:51 +02:00
Michael Niedermayer
f13ae63259
avformat/rtpenc_rfc4175: Use 64bit in computation if copy_offset
Found while reviewing: CID1494441 Untrusted value as argument

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-12 16:40:51 +02:00
Michael Niedermayer
38c2e6a2c7
avformat/rtmpproto: Use AV_DICT_MATCH_CASE instead of litteral number
Found by reviewing: CID1530166 Free of array-typed value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-12 16:40:50 +02:00
Michael Niedermayer
cedbef0394
avformat/rtmppkt: Simplify and deobfuscate amf_tag_skip() slightly
Found while reviewing: CID1530313 Untrusted loop bound

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-12 16:40:50 +02:00
Michael Niedermayer
665be4fa2f
avformat/rmdec: use 64bit for audio_framesize checks
It is not entirely clear what would prevent such overflow so even if it is
not possible, it is better to use 64bit

Fixes: CID1491898 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-12 16:40:42 +02:00
Fei Wang
71f802cdc9 lavc/hevcdec: Update slice index before hwaccel decode slice
Otherwise, slice index will never update for hwaccel decode, and slice
RPL will be always overlap into first one which use slice index to construct.

Fixes hwaccel decoding after 47d34ba7fb

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2024-07-12 16:27:34 +08:00
Fei Wang
e741cf665d lavc/hevcdec: Put slice address checking after hwaccel decode slice
Slice address tab only been updated in software decode slice data.

Fixes hwaccel decoding after d725c737fe.

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2024-07-12 16:27:34 +08:00
James Almer
092ef4097c Changelog: mention cropping support in Matroska and MP4
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-11 21:35:40 -03:00
James Almer
70c6b904be x86/intreadwrite: add missing casts to pointer arguments
Should make strict compilers happy.

Also, make AV_COPY128 use integer operations while at it. Removing the
inclusion of immintrin.h ensures a lot less intrinsic related headers are
included as well, which fixes a clash of defines with some Clang versions.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-11 18:24:26 -03:00
Rémi Denis-Courmont
d28a7e8eb7 lavc/h264dsp: avoid \+ expansion
This seems to be unsupported by LLVM-as.
2024-07-11 21:07:17 +03:00
James Almer
58cb0cab5e avformat/mov: ensure pasp box derived SAR is used if present
It's meant to override any codec specific (but still container level)
information, but its position is not guaranteed, so apply the values after the
entire trak structure has been parsed.
Also, replace the ugly roundabout int -> double -> int method to set SAR from
existing dimensions while at it.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-11 10:22:47 -03:00
James Almer
32588a9394 avformat/movenc: support writing cropping values
Finishes implementing ticket #7437.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-11 10:22:47 -03:00
James Almer
93be6b425e avformat/mov: export cropping values from clap boxes
Addresses part of ticket #7437.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-11 10:22:47 -03:00
James Almer
0b6c5e9df4 avfilter/vf_crop: prevent integer overflows when calculating SAR
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-11 10:22:47 -03:00
Zhao Zhili
0e5f8ddc1d avcodec/vvc: Use static const for function table 2024-07-11 20:26:47 +08:00
Zhao Zhili
906b883e7b avutil/executor: Fix stack overflow due to recursive call
av_executor_execute run the task directly when thread is disabled.
The task can schedule a new task by call av_executor_execute. This
forms an implicit recursive call. This patch removed the recursive
call.
2024-07-11 20:26:23 +08:00
Zhao Zhili
54f9469fa1 avutil/executor: Fix missing check before using mutex 2024-07-11 20:24:11 +08:00
James Almer
1a86a7a48d x86/intreadwrite: fix include of config.h
Should fix make checkheaders.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-10 13:52:52 -03:00
James Almer
15056dd650 x86/intreadwrite.h: add missing preprocessor checks
Removed by accident in the previous commits. This makes the code only run when
compiled with GCC and Clang like before. Support for other compilers like msvc
can be added later.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-10 13:49:21 -03:00