summaryrefslogtreecommitdiff
path: root/libavutil
Commit message (Collapse)AuthorAge
* avutil: remove deprecated FF_API_XVMCJames Almer2024-03-07
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil: remove deprecated FF_API_FIFO_OLD_APIJames Almer2024-03-07
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil: remove deprecated FF_API_FIFO_PEEK2James Almer2024-03-07
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/hwcontext_videotoolbox: Allocate pub and priv frames hwctx togetherAndreas Rheinhardt2024-03-05
| | | | | | | | | | This is possible because the lifetime of both coincide. Besides reducing the number of allocations this also simplifies access to VTFramesContext as one no longer has to go through AVHWFramesInternal. Tested-by: Jan Ekström <jeebjp@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/hwcontext_qsv: Allocate pub and priv frames hwctx togetherAndreas Rheinhardt2024-03-05
| | | | | | | | | This is possible because the lifetime of both coincide. Besides reducing the number of allocations this also simplifies access to QSVFramesContext as one no longer has to go through AVHWFramesInternal. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/hwcontext_qsv: Allocate public and priv device hwctx togetherAndreas Rheinhardt2024-03-05
| | | | | | | | | This is possible because the lifetime of both coincide. Besides reducing the number of allocations this also simplifies access to QSVDeviceContext as one no longer has to go through AVHWDeviceInternal. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/hwcontext_d3d11va: Allocate pub and priv frames hwctx togetherAndreas Rheinhardt2024-03-05
| | | | | | | | | This is possible because the lifetime of both coincide. Besides reducing the number of allocations this also simplifies access to D3D11VAFramesContext as one no longer has to go through AVHWFramesInternal. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/hwcontext_dxva2: Allocate pub and priv frames hwctx togetherAndreas Rheinhardt2024-03-05
| | | | | | | | | This is possible because the lifetime of both coincide. Besides reducing the number of allocations this also simplifies access to DXVA2FramesContext as one no longer has to go through AVHWFramesInternal. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fix "@param foo[in/out]" to "@param[in, out] foo"Andrew Sayers2024-03-04
| | | | | | | | | | | | | | Fix a few invalid doxygen comments: /** * @param[in,out] correctly_formatted * @param incorrect1[in] - [in] must come immediately after @param * @param incorrect2[in/out] - '/' must be ',' */ Actual command: sed -i -e "s/\(\* .*param\)\( [^\[]*\)\(\[.*\]\)/\1\3\2/g" -e "s/in\//in,/" $( git grep -l "\* .*param .*\[\(in\|out\)" ) Signed-off-by: Andrew Sayers <ffmpeg-devel@pileofstuff.org>
* fix "param"s that should be "@param"Andrew Sayers2024-03-04
| | | | | | Actual command: sed -i -e "s/\(^ *\\* \)\(param[^a-z]\)/\1@\2/" $( git grep -l "^ *\\* param[^a-z]" ) Signed-off-by: Andrew Sayers <ffmpeg-devel@pileofstuff.org>
* avutil/hwcontext_vdpau: Don't use AVHWFramesInternal.privAndreas Rheinhardt2024-03-04
| | | | | | | | Use AVHWFramesContext.hwctx instead. This simplifies access to VDPAUFramesContext as one no longer has to go through AVHWFramesInternal. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/hwcontext_vdpau: Allocate public and priv device hwctx togetherAndreas Rheinhardt2024-03-04
| | | | | | | | | This is possible because the lifetime of both coincide. Besides reducing the number of allocations this also simplifies access to VDPAUDeviceContext as one no longer has to go through AVHWDeviceInternal. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* aarch64: Use regular hwcaps flags instead of HWCAP_CPUID for CPU feature ↵Martin Storsjö2024-03-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | detection on Linux This makes the code much simpler (especially for adding support for other instruction set extensions), avoids needing inline assembly for this feature, and generally is more of the canonical way to do this. The CPU feature detection was added in 493fcde50a84cb23854335bcb0e55c6f383d55db, using HWCAP_CPUID. The argument for using that, was that HWCAP_CPUID was added much earlier in the kernel (in Linux v4.11), while the HWCAP flags for individual features always come later. This allows detecting support for new CPU extensions before the kernel exposes information about them via hwcap flags. However in practice, there's probably quite little advantage in this. E.g. HWCAP2_I8MM was added in Linux v5.10 - long after HWCAP_CPUID, but there's probably very little practical cases where one would run a kernel older than that on a CPU that supports those instructions. Additionally, we provide our own definitions of the flag values to check (as they are fixed constants anyway), with names not conflicting with the ones from system headers. This reduces the number of ifdefs needed, and allows detecting those features even if building with userland headers that are lacking the definitions of those flags. Also, slightly older versions of QEMU, e.g. 6.2 in Ubuntu 22.04, do expose support for these features via HWCAP flags, but the emulated cpuid registers are missing the bits for exposing e.g. I8MM. (This issue is fixed in later versions of QEMU though.) Signed-off-by: Martin Storsjö <martin@martin.st>
* avutil/hwcontext_opencl: Allocate pub and priv frames hwctx togetherAndreas Rheinhardt2024-03-04
| | | | | | | | | This is possible because the lifetime of both coincide. Besides reducing the number of allocations this also simplifies access to OpenCLFramesContext as one no longer has to go through AVHWFramesInternal. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/hwcontext_opencl: Allocate pub and priv device hwctx togetherAndreas Rheinhardt2024-03-04
| | | | | | | | | This is possible because the lifetime of both coincide. Besides reducing the number of allocations this also simplifies access to OpenCLDeviceContext as one no longer has to go through AVHWDeviceInternal. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/vulkan: Remove unused ff_vk_set_descriptor_sampler()Andreas Rheinhardt2024-03-03
| | | | | Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/vulkan: Make ff_vk_set_descriptor_image() staticAndreas Rheinhardt2024-03-03
| | | | | | | Only used in vulkan.c. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/vulkan: Avoid shadowingAndreas Rheinhardt2024-03-03
| | | | | Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/vulkan_loader: Avoid relocations for stringsAndreas Rheinhardt2024-03-03
| | | | | | | | | | To do so, concatenate all the names together to one big string name1\0name2\0....lastname\0\0. This avoids the pointer in the FunctionLoadInfo structure and thereby moves vk_load_info into .rodata (and makes it smaller by 888B). Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/vulkan_loader: Use smaller typesAndreas Rheinhardt2024-03-03
| | | | | | | | | Saves 16B per entry here (four of these 16 bytes are padding); leads to 1776 B of savings in each file that uses ff_vk_load_functions(). Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/vulkan_loader: Avoid redundant strings and relocationsAndreas Rheinhardt2024-03-03
| | | | | | | | | | | | | | | | | | There are three possible names for the functions requested; they only differ in an extension: "", "EXT" or "KHR". Yet vk_load_info contained pointers to all these strings. This is wasteful and this commit changes it to avoid the latter two strings. This saves 6353B of strings, 1776 B of .data.rel.ro as well as 5328 B due to the removed relocations (corresponding to 2 * 111 removed pointers) in lavc/vulkan_decode.o alone (ff_vk_load_functions() is inlined in lavfi/vulkan_filter.c, lavu/hwcontext_vulkan.c and lavc_vulkan_decode.c, so the savings are three times this for shared builds; for static builds, the number may be smaller depending upon whether strings are deduplicated). Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/vulkan: Don't autoinclude vulkan_loader.hAndreas Rheinhardt2024-03-03
| | | | | | | Only include it where necessary. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/timestamp: Constify av_ts_make_time_string()Andreas Rheinhardt2024-03-02
| | | | | | (Actually, the time base should be passed by value.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/hwcontext_vulkan: Allocate pub and priv frames hwctx togetherAndreas Rheinhardt2024-03-01
| | | | | | | | | This is possible because the lifetime of both coincide. Besides reducing the number of allocations this also simplifies access to VulkanFramesPriv as one no longer has to go through AVHWFramesInternal. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/hwcontext_vulkan: Allocate public and priv device hwctx togetherAndreas Rheinhardt2024-03-01
| | | | | | | | | This is possible because the lifetime of both coincide. Besides reducing the number of allocations this also simplifies access to VulkanDevicePriv as one no longer has to go through AVHWDeviceInternal. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/hwcontext_cuda: Allocate public and internal device ctx jointlyAndreas Rheinhardt2024-03-01
| | | | | Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/hwcontext_cuda: Don't use AVHWFramesInternal.privAndreas Rheinhardt2024-03-01
| | | | | | | | | Use AVHWFramesContext.hwctx instead. This simplifies accesses to VDPAUFramesContext as one no longer has to go through AVHWFramesInternal. Tested-by: Timo Rothenpieler <timo@rothenpieler.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/hwcontext: Clarify documentation of AVHWFramesContext.hwctxAndreas Rheinhardt2024-03-01
| | | | | | | | | | | | Correct the names of the format-specific headers (not hwframe_*.h) and clarify that the user shall ignore this field if there is no public context associated with it. In particular, this allows to use this field for the private context alone if there is no public context. This can't break conforming API users, because they always have to live with the possibility that a new public context has been introduced. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavu/opt: get rid of useless read_number() callsAnton Khirnov2024-03-01
| | | | | The option type is known and fixed for all these, so reading the value directly is simpler and more clear.
* lavu/opt: simplify error handling in get_number()Anton Khirnov2024-03-01
|
* lavu/opt: drop an always-NULL argument to get_number()Anton Khirnov2024-03-01
|
* lavu/opt: drop useless handling of NULL return from get_bool_name()Anton Khirnov2024-03-01
| | | | That function always returns an actual string.
* lavu/opt: factor out printing option default from opt_list()Anton Khirnov2024-03-01
|
* lavu/opt: simplify printing option type in opt_list()Anton Khirnov2024-03-01
|
* lavu/opt: cosmetics, group option reading function togetherAnton Khirnov2024-03-01
|
* lavu/opt: cosmetics, group option setting function togetherAnton Khirnov2024-03-01
|
* lavu/opt: cosmetics, group (un)init and management functions togetherAnton Khirnov2024-03-01
|
* lavu/opt: document AVOption.flagsAnton Khirnov2024-03-01
|
* lavu/opt: cosmetics, move AV_OPT_FLAG_* out of AVOptionAnton Khirnov2024-03-01
| | | | Also drop an obsolete FIXME.
* lavu/opt: cosmetics, change option flags to (1 << N) styleAnton Khirnov2024-03-01
| | | | | It is easier to read. Also, change their doxy comments to use the same style.
* avutil/hwcontext_opencl: Add map from Videotoolbox to OpenCLZhao Zhili2024-03-01
| | | | | | | | | | | | | 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>
* avutil/hwcontext_opencl: Fix missing linesize when map from openclZhao Zhili2024-03-01
| | | | Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avutil/hwcontext_vulkan: Fix memleaks when transfer to vulkanZhao Zhili2024-03-01
| | | | | | | | | | 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>
* avutil/vulkan: avoid overreads in ff_vk_count_imagesZhao Zhili2024-03-01
| | | | Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avutil/hwcontext_vulkan: Fix leaks in map_from_drmZhao Zhili2024-03-01
| | | | | | Also simplify error handing. Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avutil/hwcontext_vulkan: Fix leaks when semaphore creation failsZhao Zhili2024-03-01
| | | | Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avutil/hwcontext: Don't assume frames_uninit is reentrantZhao Zhili2024-03-01
| | | | | | Fix heap use after free when vulkan_frames_init failed. Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avutil/hwcontext: Don't assume device_uninit is reentrantZhao Zhili2024-03-01
| | | | | | | device_uninit will be called by hwdevice_ctx_free. vulkan_device_uninit is non-reentrant. Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avutil/mem_internal: Remove unneeded headersAndreas Rheinhardt2024-03-01
| | | | | | Unneeded since 21814a70db08999efee49531c67f62e2678a62f4. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/mem: limit alignment to maximum simd alignTimo Rothenpieler2024-02-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.