Commit Graph

116317 Commits

Author SHA1 Message Date
Zhao Zhili
cb9c98da16 avformat/file: guard fd_dup by FD_PROTOCOL or PIPE_PROTOCOL
fd_dup is unused when fd and pipe have been disabled. This also
fix build error with wasi since 'dup' isn't available.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-07-16 22:50:21 +08:00
Zhao Zhili
e713a2d85d avutil/file_open: Fix build error with wasi
Don't assume tempnam is available when !HAVE_MKSTEMP. Check tempnam
explicitly in configure.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-07-16 22:50:21 +08:00
Rémi Denis-Courmont
3002310b70 lavc/h264dsp: R-V V high-depth add_pixels8
T-Head C908 (cycles);
h264_add_pixels8_9bpp_c:        270.5
h264_add_pixels8_9bpp_rvv_i32:  164.2
h264_add_pixels8_10bpp_c:       270.5
h264_add_pixels8_10bpp_rvv_i32: 164.2
h264_add_pixels8_12bpp_c:       270.5
h264_add_pixels8_12bpp_rvv_i32: 164.2
h264_add_pixels8_14bpp_c:       270.5
h264_add_pixels8_14bpp_rvv_i32: 164.2
2024-07-16 17:25:40 +03:00
Rémi Denis-Courmont
7744c08240 lavc/h264dsp: R-V V add_pixels4 and 8-bit add_pixels8
T-Head C908 (cycles):
h264_add_pixels4_8bpp_c:        93.5
h264_add_pixels4_8bpp_rvv_i32:  39.5
h264_add_pixels4_9bpp_c:        87.5
h264_add_pixels4_9bpp_rvv_i64:  50.5
h264_add_pixels4_10bpp_c:       87.5
h264_add_pixels4_10bpp_rvv_i64: 50.5
h264_add_pixels4_12bpp_c:       87.5
h264_add_pixels4_12bpp_rvv_i64: 50.5
h264_add_pixels4_14bpp_c:       87.5
h264_add_pixels4_14bpp_rvv_i64: 50.5
h264_add_pixels8_8bpp_c:       265.2
h264_add_pixels8_8bpp_rvv_i64:  84.5
2024-07-16 17:25:40 +03:00
Zhao Zhili
635f7c0f6c avcodec/videotoolboxenc: Put ExtraSEI inside BufNode directly
Reduce error path and simplify the code.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-07-16 19:53:53 +08:00
Zhao Zhili
2fca8e400e avcodec/videotoolboxenc: Fix concurrent access to CVPixelBufferRef
For a frame comes from AV_HWDEVICE_TYPE_VIDEOTOOLBOX, it's
CVPixelBufferRef is maintained by a pool. CVPixelBufferRef returned
to the pool when frame buffer reference reached to zero. However,
VTCompressionSessionEncodeFrame also hold a reference to the
CVPixelBufferRef. So a new frame get from av_hwframe_get_buffer
may access a CVPixelBufferRef which still used by the encoder.
It's only after vtenc_output_callback that we can make sure
CVPixelBufferRef has been released by the encoder.

The issue can be tested with sample from trac #10884.
ffmpeg -hwaccel videotoolbox \
	-hwaccel_output_format videotoolbox_vld \
        -i input.mp4 \
	-c:v hevc_videotoolbox \
	-profile:v main \
        -b:v 3M \
        -vf scale_vt=w=iw/2:h=ih/2:color_matrix=bt709:color_primaries=bt709:color_transfer=bt709 \
        -c:a copy \
	-tag:v hvc1 \
	output.mp4

Withtout the patch, there are some out of order images in output.mp4.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-07-16 19:53:53 +08:00
Zhao Zhili
0e338c4114 avcodec/videotoolboxenc: Use BufNode as sourceFrameRefcon
ExtraSEI is used as the sourceFrameRefcon of VTCompressionSessionEncodeFrame.
It cannot hold other information which is necessary to fix another issue
in the following patch.

This patch also fixed leak of ExtraSEI on the error path of
vtenc_output_callback.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-07-16 19:53:53 +08:00
Zhao Zhili
4a3625859b avcodec/videotoolboxenc: Remove unused variable
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-07-16 19:53:53 +08:00
Zhao Zhili
2eae57c862 avcodec/videotoolboxenc: Don't ignore ENOMEM
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-07-16 19:53:53 +08:00
Marvin Scholz
2fc37c4239 avutil/hwcontext_videotoolbox: Fix build with older SDKs
I've accidentally used API not available on the checked version.
Additionally check for the SDK to be new enough to even have the
CVImageBufferCreateColorSpaceFromAttachments API to not fail
the build.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-07-16 19:51:45 +08:00
James Almer
5d74dcf0e3 fate/lavf-container: add a test for L-HEVC remuxing
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-15 18:19:00 -03:00
James Almer
27eb55a9c9 avcodec/cbs_h265: add support for 3D Reference Displays Information SEI
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-15 16:39:44 -03:00
James Almer
64807ccc91 avcodec/cbs_h265: add support for PPS Multilayer extension fields
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-15 16:39:44 -03:00
James Almer
25138fa0f3 avcodec/cbs_h265: reindent after the previous commit
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-15 16:39:44 -03:00
James Almer
41211edc1b avcodec/cbs_h265: add support for SPS Multilayer extension fields
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-15 16:39:44 -03:00
James Almer
5fe13aeb65 avcodec/cbs_h265: fix range of sps_max_sub_layers_minus1
The VPS referenced by the SPS must always be present as the max value for
sps_max_sub_layers_minus1 is vps_max_sub_layers_minus1. This replaces a buggy
custom range check for the aforementioned field.
Also, add the missing conformance check for sps_temporal_id_nesting_flag while
at it.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-15 16:39:44 -03:00
Gyan Doshi
350146a1ea ffmpeg: don't truncate getmaxrss value
Can lead to printing of nonsensical negative memory usage
2024-07-15 15:15:55 +05:30
Fei Wang
246600974f lavc/vaapi_{decode, av1}: Fix memory leak in fail codepath
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2024-07-15 10:25:43 +08:00
Michael Niedermayer
9c8881cb35
avcodec/mpegvideo_enc: Do not duplicate pictures on shifting
Fixes: out of array access
Fixes: 69098/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG2VIDEO_fuzzer-6107989688778752
Fixes: 69599/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-4848626296225792.fuzz

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-15 01:59:41 +02:00
Michael Niedermayer
a7f5845a6c
avfilter: Free out on error
CID1197065 Resource leak

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-15 01:59:41 +02:00
Michael Niedermayer
348968e9f7
avdevice/dshow_capture: Fix error handling in ff_dshow_##prefix##_Create()
Untested, needs review

Fixes: CID1591856 Resource leak
Fixes: CID1591887 Resource leak
Fixes: CID1591874 Resource leak

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-15 01:59:40 +02:00
Michael Niedermayer
66d6b8033b
avcodec/tiff: Check value on positive signed targets
Fixes: CID1604593 Overflowed constant

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-15 01:59:40 +02:00
Michael Niedermayer
19a5a8997c
avfilter/vf_convolution_opencl: Assert that the filter name is one of the filters
Helps with: CID1439572 Uninitialized pointer read

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-15 01:59:40 +02:00
Michael Niedermayer
ec18ec9fc1
avfilter/vf_bm3d: Dont round MSE2SSE to an integer
Fixes: CID1439581 Result is not floating-point

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-15 01:59:39 +02:00
Michael Niedermayer
ffba528bc6
avfilter/vf_avgblur_opencl: Use AV_VIDEO_MAX_PLANES
Fixes: CID1437470 Out-of-bounds read (out of bounds read would only occur with a pixel format of more than 4 planes)

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-15 01:59:39 +02:00
Michael Niedermayer
989e11acb6
avdevice/dshow: Remove NULL check on pin
The pointer is used before the check

Fixes: CID1591884 Dereference before null check

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Roger Pack <rogerdpack@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-15 01:59:39 +02:00
Michael Niedermayer
2c2e727088
avdevice/dshow: check ff_dshow_pin_ConnectionMediaType() for failure
Maybe Fixes: CID1598557 Explicit null dereferenced

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Roger Pack <rogerdpack@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-15 01:59:38 +02:00
Michael Niedermayer
175c191668
avdevice/dshow: Check device_filter_unique_name before use
Fixes: CID1591931 Explicit null dereferenced

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Roger Pack <rogerdpack@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-15 01:59:38 +02:00
Michael Niedermayer
25f9211bdd
avdevice/dshow: Cleanup also on av_log case
Fixes: CID1598550 Resource leak

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Roger Pack <rogerdpack@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-15 01:59:38 +02:00
Michael Niedermayer
daf61dddc8
avdevice/dshow_filter: Use wcscpy_s()
Fixes: CID1591929 Copy into fixed size buffer

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Roger Pack <rogerdpack@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-15 01:59:37 +02:00
Michael Niedermayer
8f74c313f1
avcodec/vvc/ctu: Simplify code at the end of pred_mode_decode()
This simplification assumes that the code is correct

Fixes: CID1560036 Logically dead code

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-15 01:59:37 +02:00
Tong Wu
affeca005a
mailmap: add entry for myself
Signed-off-by: Tong Wu <wutong1208@outlook.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-15 01:59:37 +02:00
Marvin Scholz
613c85a8f5
avfilter/af_channelsplit: fix mixed declaration and code
Fix a "mixing declarations and code is incompatible with standards
before C99" warning.
2024-07-14 15:43:01 -04:00
Rémi Denis-Courmont
c654e37254 lavc/h264dsp: R-V V high-depth h264_idct8_add
Unlike the 8-bit version, we need two iterations to process this within
128-bit vectors. This adds some extra complexity for pointer arithmetic
and counting down which is unnecessary in the 8-bit variant.

Accordingly the gain relative to C are just slight better than half as
good with 128-bit vectors as with 256-bit ones.

T-Head C908 (2 iterations):
h264_idct8_add_9bpp_c:       17.5
h264_idct8_add_9bpp_rvv_i32: 10.0
h264_idct8_add_10bpp_c:      17.5
h264_idct8_add_10bpp_rvv_i32: 9.7
h264_idct8_add_12bpp_c:      17.7
h264_idct8_add_12bpp_rvv_i32: 9.7
h264_idct8_add_14bpp_c:      17.7
h264_idct8_add_14bpp_rvv_i32: 9.7

SpacemiT X60 (single iteration):
h264_idct8_add_9bpp_c:       15.2
h264_idct8_add_9bpp_rvv_i32:  5.0
h264_idct8_add_10bpp_c:      15.2
h264_idct8_add_10bpp_rvv_i32: 5.0
h264_idct8_add_12bpp_c:      14.7
h264_idct8_add_12bpp_rvv_i32: 5.0
h264_idct8_add_14bpp_c:      14.7
h264_idct8_add_14bpp_rvv_i32: 4.7
2024-07-14 21:06:50 +03:00
Lynne
80ddc72717
vulkan: rename read_only to singular
There's nothing stopping users from writing to such buffers.
Its more accurate to say they are singular, i.e. not duplicated
between multiple submissions.

This can be helpful for global statistics, or error propagation
purposes.
2024-07-14 18:33:56 +02:00
Lynne
e11087b162
vulkan: set VkDescriptorAddressInfoEXT.sType
This was not done, resulting in validation issues, and potential
driver issues.
2024-07-14 18:31:44 +02:00
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