1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00
Commit Graph

116257 Commits

Author SHA1 Message Date
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
James Almer
bd1bcb07e0 x86/intreadwrite: use intrinsics instead of inline asm for AV_COPY128
This has the benefit of removing any SSE -> AVX penalty that may happen when
the compiler emits VEX encoded instructions.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-10 13:25:44 -03:00
James Almer
4a04cca69a x86/intreadwrite: use intrinsics instead of inline asm for AV_ZERO128
When called inside a loop, the inline asm version results in one pxor
unnecessarely emitted per iteration, as the contents of the __asm__() block are
opaque to the compiler's instruction scheduler.
This is not the case with intrinsics, where pxor will be emitted once with any
half decent compiler.

This also has the benefit of removing any SSE -> AVX penalty that may happen
when the compiler emits VEX encoded instructions.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-10 13:25:44 -03:00
Sean McGovern
34b4ca8696
swscale: prevent undefined behaviour in the PUTRGBA macro
For even small values of 'asrc[x]', shifting them by 24 bits or more
will cause arithmetic overflow and be caught by
GCC's undefined behaviour sanitizer.

Ensure the values do not overflow by up-casting the bracketed
expressions involving 'asrc' to uint32_t.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-10 18:10:10 +02:00
Michael Niedermayer
e9e8bea2e7
avutil/wchar_filename: Correct sizeof
Fixes: CID1591930 Wrong sizeof argument

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Steve Lhomme <robux4@ycbcr.xyz>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-10 18:10:10 +02:00
Michael Niedermayer
628ba061c8
avutil/hwcontext_d3d11va: correct sizeof IDirect3DSurface9
Fixes: CID1591944 Wrong sizeof argument

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Steve Lhomme <robux4@ycbcr.xyz>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-10 18:10:09 +02:00
Michael Niedermayer
cf22f944d5
avutil/hwcontext_d3d11va: Free AVD3D11FrameDescriptor on error
Fixes: CID1598558 Resource leak

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Steve Lhomme <robux4@ycbcr.xyz>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-10 18:10:09 +02:00
Michael Niedermayer
698ed0d5a5
avutil/hwcontext_d3d11va: correct sizeof AVD3D11FrameDescriptor
Fixes: CID1591909 Wrong sizeof argument

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Steve Lhomme <robux4@ycbcr.xyz>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-10 18:10:09 +02:00
Michael Niedermayer
eb552ecd54
avcodec/vvc/refs: Use unsigned mask
Not a bugfix, but might fix CID1604361 Overflowed constant

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Nuo Mi <nuomi2021@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-10 18:10:08 +02:00
Marvin Scholz
6d9c4bd69e
lavfi/perlin: Fix out of bounds stack buffer write
An incorrect calculation in ff_perlin_init causes a write to the
stack array at index 256, which is out of bounds.

Fixes: CID1608711
Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-10 18:10:08 +02:00
Tong Wu
f2f2b27517
MAINTAINERS: add myself as d3d12va_encode maintainer
Signed-off-by: Tong Wu <wutong1208@outlook.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-10 18:10:08 +02:00
Michael Niedermayer
3e4bfff211
doc/examples/vaapi_encode: Try to check fwrite() for failure
Fixes: CID1604548 Unused value

Sponsored-by: Sovereign Tech Fund
Reviewed-by: "Xiang, Haihao" <haihao.xiang-at-intel.com@ffmpeg.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-10 18:10:07 +02:00
Ramiro Polla
ac6263945a swscale/x86/yuv2rgb: Detemplatize
Every function in yuv2rgb_template.c is only compiled exactly
once, so detemplatize it.
2024-07-10 12:25:32 +02:00
Ramiro Polla
4f7f9b1026 swscale: remove unconditional #define DITHER1XBPP
This seems to have had an use in the past, but it is now defined
unconditionally.
2024-07-10 12:25:03 +02:00
Ramiro Polla
7405f1ad53 configure: restore autodetection of v4l2 and fbdev
The detection logic for v4l2 and fbdev was accidentally modified to
depend on v4l2-m2m in 43b3412.
2024-07-10 12:24:33 +02:00
Niklas Haas
0deb301ba9 avfilter/vf_scale: test return code of scale_frame()
Instead of testing the returned frame against NULL, test the return code
itself, going more in line with the usual behavior of such functions.
2024-07-10 11:38:44 +02:00
Niklas Haas
084e0b364d avfilter/vf_scale: fix frame lifetimes
scale_frame() inconsistently handled the lifetime of `in`. Fixes a
possible double free and a possible memory leak.

The new code always has `scale_frame` take over ownership of the input
frame. I first tried writing this code in a way where the calling code
retains ownership, but this is nontrivial due to the presence of the
no-op short-circuit condition in which the input frame is directly
returned. (As an alternative, we could use av_frame_clone() instead, but
I wanted to avoid touching the original behavior in this commit)
2024-07-10 11:38:44 +02:00
Rémi Denis-Courmont
f1ed351d3b lavc/h264dsp: R-V V 8-bit h264_biweight_pixels
T-Head C908:
h264_biweight2_8_c:        58.0
h264_biweight2_8_rvv_i32:  11.2
h264_biweight4_8_c:       106.0
h264_biweight4_8_rvv_i32:  22.7
h264_biweight8_8_c:       205.7
h264_biweight8_8_rvv_i32:  50.0
h264_biweight16_8_c:      403.5
h264_biweight16_8_rvv_i32: 83.2

SpacemiT X60:
h264_weight2_8_c:          48.2
h264_weight2_8_rvv_i32:     8.2
h264_weight4_8_c:          90.5
h264_weight4_8_rvv_i32:    16.5
h264_weight8_8_c:         175.2
h264_weight8_8_rvv_i32:    38.0
h264_weight16_8_c:        342.2
h264_weight16_8_rvv_i32:   66.0
2024-07-09 18:03:30 +03:00
Rémi Denis-Courmont
3606e592ea lavc/h264dsp: R-V V 8-bit h264_weight_pixels
There are two implementations here:
- a generic scalable one processing two columns at a time,
- a specialised processing one (fixed-size) row at a time.

Unsurprisingly, the generic one works out better with smaller widths.
With larger widths, the gains from filling vectors are outweighed by
the extra cost of strided loads and stores. In other words, memory
accesses become the bottleneck.

T-Head C908:
h264_weight2_8_c:        54.5
h264_weight2_8_rvv_i32:  13.7
h264_weight4_8_c:       101.7
h264_weight4_8_rvv_i32:  27.5
h264_weight8_8_c:       197.0
h264_weight8_8_rvv_i32:  75.5
h264_weight16_8_c:      385.0
h264_weight16_8_rvv_i32: 74.2

SpacemiT X60:
h264_weight2_8_c:        48.5
h264_weight2_8_rvv_i32:   8.2
h264_weight4_8_c:        90.7
h264_weight4_8_rvv_i32:  16.5
h264_weight8_8_c:       175.0
h264_weight8_8_rvv_i32:  37.7
h264_weight16_8_c:      342.2
h264_weight16_8_rvv_i32: 66.0
2024-07-09 18:03:29 +03:00
Zhao Zhili
85706f5136 avutil/hwcontext_videotoolbox: Fix version check
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-07-09 21:39:09 +08:00
Anton Khirnov
9fb8d13d56 lavf: deprecate avformat_transfer_internal_stream_timing_info()
And av_stream_get_codec_timebase().

They were both added for ffmpeg CLI, which no longer calls either of
them. Furthermore the notion of "internal stream timing info" that needs
to be transferred with a special magic API function is fundamentally
flawed and should be removed.
2024-07-09 11:14:47 +02:00
Anton Khirnov
10185e2d4c fftools/ffmpeg_mux_init: default to input timebase for streamcopy
Stop trying to invent some "framerate-based" timebase when there is no
reason to think the stream is CFR at all.
2024-07-09 11:14:08 +02:00
Anton Khirnov
ff55d1cc20 fftools/ffmpeg_dec: improve detection of lavf-guessed durations
Will be useful in following commit.
2024-07-09 11:14:08 +02:00
Andreas Rheinhardt
b6c43328ee avformat/matroskaenc: Avoid indirection via st->codecpar
Use the already available AVCodecParameters pointer instead.
Shortens lines.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-07-08 20:11:32 +02:00
Andreas Rheinhardt
0d1bc9666c avformat/matroskaenc: Only write useful cropping values
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-07-08 20:11:27 +02:00