Commit Graph

113886 Commits

Author SHA1 Message Date
Anton Khirnov 067fde4966 lavu/opt: document AVOption.flags 2024-03-01 16:57:24 +01:00
Anton Khirnov 39a3a1c69b lavu/opt: cosmetics, move AV_OPT_FLAG_* out of AVOption
Also drop an obsolete FIXME.
2024-03-01 16:57:24 +01:00
Anton Khirnov 105a1bc150 lavu/opt: cosmetics, change option flags to (1 << N) style
It is easier to read. Also, change their doxy comments to use the same
style.
2024-03-01 16:57:24 +01:00
Anton Khirnov e48055fdce fftools/ffmpeg: remove options deprecated before 6.0 2024-03-01 16:51:11 +01:00
Zhao Zhili f7545e90df avutil/hwcontext_opencl: Add map from Videotoolbox to OpenCL
For example:
./ffmpeg -hwaccel videotoolbox \
	-hwaccel_output_format videotoolbox_vld \
	-i foo.mp4 \
	-vf hwmap=derive_device=opencl,transpose_opencl=dir=clock,hwmap,format=nv12 \
	-c:v hevc_videotoolbox \
	-c:a copy \
	-b:v 2M -tag:v hvc1 bar.mp4

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-03-01 17:24:00 +08:00
Zhao Zhili dcfc6089b1 avutil/hwcontext_opencl: Fix missing linesize when map from opencl
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-03-01 17:23:50 +08:00
Zhao Zhili 35dc129940 avcodec/encode: Fix default setting of bits_per_raw_sample
bits_per_raw_sample doesn't always match size of AV_SAMPLE_FMT_,
e.g., S24.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-03-01 17:23:38 +08:00
Zhao Zhili b56b343e43 avformat/mov: Update bits_per_coded_sample after read pcmC
Fix #10878
2024-03-01 17:23:18 +08:00
Zhao Zhili ab8aab5e2f avfilter/vf_scale_vulkan: Fix typo
Fix #10875

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-03-01 17:22:25 +08:00
Zhao Zhili 74e27d9e31 avutil/hwcontext_vulkan: Fix memleaks when transfer to vulkan
Without ff_vk_exec_discard_deps which is called by ff_vk_exec_wait,
the reference count of hwframe context cannot reach zero due to
circular reference created by ff_vk_exec_add_dep_frame.

Fix #10873

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-03-01 17:22:14 +08:00
Zhao Zhili f6f06fb42a avutil/vulkan: avoid overreads in ff_vk_count_images
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-03-01 17:20:35 +08:00
Zhao Zhili 03275b0f09 avutil/hwcontext_vulkan: Fix leaks in map_from_drm
Also simplify error handing.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-03-01 17:20:29 +08:00
Zhao Zhili 6f9730cb28 avutil/hwcontext_vulkan: Fix leaks when semaphore creation fails
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-03-01 17:20:21 +08:00
Zhao Zhili 3bb00c0a42 avutil/hwcontext: Don't assume frames_uninit is reentrant
Fix heap use after free when vulkan_frames_init failed.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-03-01 17:20:00 +08:00
Zhao Zhili 90bbe1e8e2 avutil/hwcontext: Don't assume device_uninit is reentrant
device_uninit will be called by hwdevice_ctx_free. vulkan_device_uninit
is non-reentrant.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-03-01 17:19:52 +08:00
Zhao Zhili 39a0c55347 fftools/ffplay: Fix output color_spaces of filter
The sdl_supported_color_spaces only meant for SDL builtin renderer.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-03-01 17:19:15 +08:00
Andreas Rheinhardt 601bb6a739 avcodec/mss[12]: Cleanup generically on init failure
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:35:42 +01:00
Andreas Rheinhardt 80736531da avcodec/decode: Improve validity check a bit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:35:42 +01:00
Andreas Rheinhardt 22dda5615e avutil/mem_internal: Remove unneeded headers
Unneeded since 21814a70db.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:35:42 +01:00
Andreas Rheinhardt 72becd0627 avcodec/refstruct: Don't use STRIDE_ALIGN for alignment
It was always intended that the buffers returned by
RefStruct shall have the same alignment guarantees
as the buffers returned by av_malloc(); said alignment
depends upon the arch and the enabled instruction set
and the code used STRIDE_ALIGN as a proxy for this.

Yet since 7945d30e91
there is a better way to get av_malloc's alignment:
ALIGN_64 in mem_internal.h. So use this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:35:42 +01:00
Andreas Rheinhardt d36cb46681 avcodec/libxeve: Use av_dict_iterate()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:34:26 +01:00
Andreas Rheinhardt fbf1e51352 avcodec/libxevd: Fix "if (ret = ff_foo() < 0)" precedence problem
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:34:26 +01:00
Andreas Rheinhardt 0c92c8e6e3 avcodec/libxevd: Improve included headers a bit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:34:26 +01:00
Andreas Rheinhardt ec0bd89297 avcodec/libxevd: Use CODEC_LONG_NAME()
Brings the length of the line down to less than 80 chars.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:34:26 +01:00
Andreas Rheinhardt 9209350f8d avcodec/libxevd: Remove useless AVClass
This decoder does not have options.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:34:26 +01:00
Andreas Rheinhardt c4dceb8354 avcodec/libxevd: Reindent after the previous commit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:34:26 +01:00
Andreas Rheinhardt cb9fb80c7f avcodec/libxevd: Deduplicate code
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:34:26 +01:00
Andreas Rheinhardt 85fc5a0c3f avcodec/libxevd: Avoid cloning AVPacket
Cloning a packet whose source is going to be unreferenced
immediately afterwards is wasteful.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:34:26 +01:00
Andreas Rheinhardt 4e14a8e6be avcodec/libxevd: Set AV_CODEC_CAP_DR1
This decoder uses av_image_copy() to copy decoded images
to buffers obtained via ff_get_buffer(); ergo it can handle
user-provided buffers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:34:26 +01:00
Andreas Rheinhardt bbeee3339f avcodec/libxevd: Remove FF_CODEC_CAP_SETS_PKT_DTS cap
This decoder implements the receive_frame API; such decoders
always have to set the pkt_dts field themselves and the avcodec
test checks for this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:34:19 +01:00
Andreas Rheinhardt 5a4702cba9 avcodec/Makefile: Add missing AV1 decoder->av1_parse.o dependency
Needed for ff_av1_framerate().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-01 01:33:03 +01:00
James Almer 194414f62d avcodec/av1dec: implement FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
Fixes errors when opening streams with no extradata (like those from raw OBU
sources). It also calls get_format() on new Sequence Headers when required.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-29 14:48:00 -03:00
James Almer ec7937f4a5 avformat/iamf: remove duplicated function
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-29 12:57:25 -03:00
Andreas Rheinhardt 4a134eb14a avcodec/intrax8: Fix assert
Commit 900ce6f8c3 replaced
IntraX8Context.ac_vlc by IntraX8Context.ac_vlc_table,
but forgot to update an av_assert2()*.
cf7ed01938 then
replaced this with a check for j_ac_vlc[mode],
but this makes no sense as j_ac_vlc is of type
const VLCElem [2][2][8][].

Worse yet, mode can be up to three and then
j_ac_vlc[mode] is undefined behaviour. This happened
during the wmv8-x8intra FATE test.

*: Since 84f16bb5e6
config.h was no longer auto-included in avassert.h
and this disabled av_assert1() and av_assert2()
in files where config.h has not been included before
the inclusion of avassert.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-29 10:30:16 +01:00
Haihao Xiang d263fce2b2 lavc/qsvenc: update the selection of bitrate control method
The default method is changed to CQP

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-02-29 13:36:41 +08:00
Fei Wang 57fbe929f3 avcodec/av1dec: Return error for unsupported tile list OBU
Otherwise decoding maybe successful but output result is incorrect.

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2024-02-29 13:36:41 +08:00
Fei Wang 3f7e50f539 avcodec/av1dec: Move message of OBU info back to the beginning
So that can show OBU info even it doesn't have decomposed content. And
add OBU content status into the message.

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2024-02-29 13:36:41 +08:00
J. Dekker 2b17a74df5 avdevice: deprecate sdl outdev
Signed-off-by: J. Dekker <jdek@itanimul.li>
2024-02-28 10:28:49 +01:00
J. Dekker e4c0cdf8df avdevice: deprecate opengl outdev
Signed-off-by: J. Dekker <jdek@itanimul.li>
2024-02-28 10:28:49 +01:00
J. Dekker 570052cd2a avcodec/aarch64/hevc: add luma deblock NEON
Benched using single-threaded full decode on an Ampere Altra.

Bpp Before  After  Speedup
8   73,3s   65,2s  1.124x
10  114,2s  104,0s 1.098x
12  125,8s  115,7s 1.087x

Signed-off-by: J. Dekker <jdek@itanimul.li>
2024-02-28 10:14:58 +01:00
Cosmin Stejerean 69dd1ce610 avcodec/libsvtav1: send the EOS signal without a one frame delay to allow for the library to operate in a low-delay mode
Co-authored-by: Amir Naghdinezhad <amir.naghdinezhad@intel.com>
Signed-off-by: Cosmin Stejerean <cosmin@cosmin.at>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-02-27 19:38:23 -03:00
Andreas Rheinhardt 0c204ce9f6 avcodec/dxvenc: Use proper alignment, write endian-independent output
Fixes the dxv3enc-dxt1 FATE test with UBSan and on big-endian
hardware.

Reviewed-by: James Almer <jamrial@gmail.com>
Tested-by: Sean McGovern <gseanmcg@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-27 23:05:26 +01:00
Timo Rothenpieler 7945d30e91 avutil/mem: limit alignment to maximum simd align
FFmpeg has instances of DECLARE_ALIGNED(32, ...) in a lot of structs,
which then end up heap-allocated.
By declaring any variable in a struct, or tree of structs, to be 32 byte
aligned, it allows the compiler to safely assume the entire struct
itself is also 32 byte aligned.

This might make the compiler emit code which straight up crashes or
misbehaves in other ways, and at least in one instances is now
documented to actually do (see ticket 10549 on trac).
The issue there is that an unrelated variable in SingleChannelElement is
declared to have an alignment of 32 bytes. So if the compiler does a copy
in decode_cpe() with avx instructions, but ffmpeg is built with
--disable-avx, this results in a crash, since the memory is only 16 byte
aligned.

Mind you, even if the compiler does not emit avx instructions, the code
is still invalid and could misbehave. It just happens not to. Declaring
any variable in a struct with a 32 byte alignment promises 32 byte
alignment of the whole struct to the compiler.

This patch limits the maximum alignment to the maximum possible simd
alignment according to configure.
While not perfect, it at the very least gets rid of a lot of UB, by
matching up the maximum DECLARE_ALIGNED value with the alignment of heap
allocations done by lavu.
2024-02-27 19:41:09 +01:00
sunyuechi 40911bc1a1 lavc/dnxhdenc: add ff_dnxhdenc_init
This is for clarity and use in testing, consistent with other parts of the code.

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-27 20:32:37 +02:00
sunyuechi a7ad76fbbf lavc/me_cmp: R-V V nsse
C908:
nsse_0_c: 1990.0
nsse_0_rvv_i32: 572.0
nsse_1_c: 910.0
nsse_1_rvv_i32: 456.0

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-02-27 20:31:30 +02:00
Andreas Rheinhardt 1bb7d5ca9f avformat/mov: Don't use entry[-1] in pointer arithmetic
It is undefined behaviour.
Fixes many failed tests with UBSan and GCC 13 like
"src/libavformat/mov.c:4229:44: runtime error: store to address
0x5572abe20f80 with insufficient space for an object of type 'struct
MOVIndexRange'"
(The line number does not refer to the line where &entry[-1]
is assigned.)

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-27 10:27:42 +01:00
Andreas Rheinhardt 9d7d03ea45 Revert "avformat/mov: zero initialize the index ranges buffer"
This reverts commit eee3b7e2fb.
It has been made in an attempt to fix UBSan test failures with
GCC 13 (see e.g. [1]), but it did not help at all. So revert it,
but use av_malloc_array() instead of going back to av_malloc().

[1]: https://fate.ffmpeg.org/report.cgi?slot=x86_64-archlinux-gcc-ubsan&time=20240226182430

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-27 00:17:39 +01:00
Andreas Rheinhardt a6aa043baa avcodec/aac: Split ChannelElement in decoder and encoder structs
The AAC decoders share no common code with the AAC encoder,
so they are not restricted to using the same structures.
This implies that one can use different structs for each
component and remove elements not used by the decoders/
the encoder. This leads to quite sizeable savings:
sizeof(ChannelElement) for the encoder went down to 134432B
here from 547552B; for the decoder it went down to 512800B.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-27 00:11:21 +01:00
Andreas Rheinhardt 6c92347ab9 avcodec/sbr: Remove unused AACDecContext* parameter from sbr_lf_gen_mips
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-27 00:11:21 +01:00
Andreas Rheinhardt 80eca6ec99 avcodec/aacps: Inline ff_ps_ctx_init()
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-27 00:11:21 +01:00