aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/vulkan_hevc.c
Commit message (Collapse)AuthorAgeFilesLines
* avutil/common: Don't auto-include mem.hAndreas Rheinhardt2024-03-311-0/+1
| | | | | | | | | | | There are lots of files that don't need it: The number of object files that actually need it went down from 2011 to 884 here. Keep it for external users in order to not cause breakages. Also improve the other headers a bit while just at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/hevc_ps: fix setting HEVCHdrParams fieldsJames Almer2024-03-211-8/+8
| | | | | | | | These were defined in a way compatible with the Vulkan HEVC acceleration, which expects bitmasks, yet the fields were being overwritting on each loop with the latest read value. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/vulkan_decode: Un-sparse extensions tableAndreas Rheinhardt2024-03-071-0/+1
| | | | | | | | | Only three of the 226 (== AV_CODEC_ID_AV1) entries have been used. Unsparsing this table is especially important given that this array lives in .data.rel.ro. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vulkan_video: Merge dec part of FFVkCodecMap and extension propsAndreas Rheinhardt2024-03-071-3/+7
| | | | | | | | | | | | | | | | All the fields of FFVkCodecMap are either decoder-only or encoder-only (with the latter being unused and unset for now). Yet there is already a per-decoder struct containing static information about these decoders, namely VkExtensionProperties. This commit merges the decoder-parts of FFVkCodecMap with the VkExtensionProperties into a common structure. Given that FFVkCodecMap is now unused, it is removed. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* libavcodec: fix -Wint-conversion in vulkanSam James2024-01-061-1/+1
| | | | | | | | | | | | | | | | | | | FIx warnings (soon to be errors in GCC 14, already so in Clang 15): ``` src/libavcodec/vulkan_av1.c: In function ‘vk_av1_create_params’: src/libavcodec/vulkan_av1.c:183:43: error: initialization of ‘long long unsigned int’ from ‘void *’ makes integer from pointer without a cast [-Wint-conversion] 183 | .videoSessionParametersTemplate = NULL, | ^~~~ src/libavcodec/vulkan_av1.c:183:43: note: (near initialization for ‘(anonymous).videoSessionParametersTemplate’) ``` Use Vulkan's VK_NULL_HANDLE instead of bare NULL. Fix Trac ticket #10724. Was reported downstream in Gentoo at https://bugs.gentoo.org/919067. Signed-off-by: Sam James <sam@gentoo.org>
* avcodec/vulkan_decode: Use RefStruct API for shared_refAndreas Rheinhardt2023-10-071-1/+1
| | | | | | | | | Avoids allocations, error checks and indirections. Also increases type-safety. Reviewed-by: Lynne <dev@lynne.ee> Tested-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/decode: Use RefStruct API for hwaccel_picture_privateAndreas Rheinhardt2023-10-071-6/+3
| | | | | | | | | | | | Avoids allocations and therefore error checks: Syncing hwaccel_picture_private across threads can't fail any more. Also gets rid of an unnecessary pointer in structures and in the parameter list of ff_hwaccel_frame_priv_alloc(). Reviewed-by: Anton Khirnov <anton@khirnov.net> Reviewed-by: Lynne <dev@lynne.ee> Tested-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/hevc_ps: Use RefStruct API for parameter setsAndreas Rheinhardt2023-10-071-8/+8
| | | | | | | | | | Avoids allocations and error checks for these allocations; e.g. syncing buffers across threads can't fail any more and needn't be checked. It also gets rid of casts and indirections. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* vulkan_hevc: handle non-contiguous SPS/PPS/VPS idsBenjamin Cheng2023-10-051-19/+27
| | | | | | | | | | | | | | Some clips (i.e. SLIST_B_Sony_9) will use PPS 0 and 8, before PPS 1-7. vulkan_hevc expects {sps,pps,vps}_list to be filled in order, which causes PPS 8 to not be added to the Vulkan session params when it is being used by a picture. This removes the expectation that these lists are filled in order. The indicies into vps_list are saved since there are multiple usages of it. This also fixes a bug with some clips (i.e. PPS_A_qualcomm_7) which use all 64 available PPS slots, causing the old loop to think there are more than 64 PPS-es.
* vulkan_hevc: switch from a buffer pool to a malloc and simplifyLynne2023-09-151-35/+17
| | | | Simpler and more robust now that contexts are not shared between threads.
* avcodec/vulkan_decode: Factor creating session params out, fix leakAndreas Rheinhardt2023-09-151-24/+3
| | | | | | | | | | | | | All Vulkan HWAccels share the same boilerplate code for creating session params and this includes a common bug: In case actually creating the video session parameters fails, the buffer destined to hold them leaks; in case of HEVC this is also true if get_data_set_buf() fails. This commit factors this code out and fixes the leak. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/avcodec: Add FFHWAccel, hide internals of AVHWAccelAndreas Rheinhardt2023-08-071-5/+5
| | | | | | | | | This commit is the AVHWAccel analogue of commit 20f972701806be20a77f808db332d9489343bb78: It moves the private fields of AVHWAccel to a new struct FFHWAccel extending AVHWAccel in an internal header (namely hwaccel_internal.h). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* vulkan_hevc: use diagonal scan order for scaling listsBenjamin Cheng2023-07-281-42/+40
| | | | | | | | | | The hevc parser parses the diagonal scan order in bitstream into raster scan order. However, the Vulkan spec wants it as specified in H265 spec, which is diagonal scan order. Tested on RADV. v2: fix copy-paste typo with PPS.
* vulkan/hevc: handle missing active PPSPhilip Langdale2023-07-101-1/+14
| | | | | | | | | | I don't pretend to understand how we get into this situation, but there are files out there where we can end up with the active PPS not being identified when we call vk_hevc_end_frame. In these situations today, we will segfault. So, before we give up, see if we can get the active PPS id from the slice header, and use that if possible. If that still doesn't work, return an error instead of segfaulting.
* vulkan_decode: reject decoding of frames with no slicesLynne2023-06-221-0/+3
| | | | | | | | | | | As per the spec: VUID-VkVideoDecodeH264PictureInfoKHR-sliceCount-arraylength sliceCount must be greater than 0 VUID-VkVideoDecodeH265PictureInfoKHR-sliceSegmentCount-arraylength sliceSegmentCount must be greater than 0 This particularly happens with seeking in field-coded H264.
* vulkan_decode: simplify and make session parameter generation more robustLynne2023-06-221-4/+16
| | | | | | | | This commit scraps a bool to signal to recreate the session parameters, but instead destroys them, forcing them to be recreated. As this can happen between start_frame and end_frame, do this at both places.
* vulkan_decode: clean up slice handlingLynne2023-06-221-1/+0
| | | | | | | Move the slice offsets buffer to the thread decode context. It isn't part of the resources for frame decoding, the driver has to process and finish with it at submission time. That way, it doesn't need to be alloc'd + freed on every frame.
* vulkan/hevc: fix 32x32 scaling list indexingDave Airlie2023-06-081-6/+6
| | | | | This fixes another problem in the hevc scaling lists and aligns the code with what other hwaccels do.
* hevcdec: remove redundant bits_used_for_short_term_rps fieldLynne2023-06-071-1/+1
| | | | | | | It was introduced for Vulkan, but it is equivalent to short_term_ref_pic_set_size when !short_term_ref_pic_set_sps_flag, and when !!short_term_ref_pic_set_sps_flag, Vulkan hardcodes a zero anyway.
* vulkan/hevc: fix scaling lists sizes.Dave Airlie2023-06-061-6/+6
|
* vulkan: replace usage of %lu with %"SIZE_SPECIFIER"Lynne2023-05-291-1/+1
|
* hevcdec: add Vulkan hwaccelLynne2023-05-291-0/+948
Thanks to Dave Airlie for figuring out a lot of the parameters.