aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/vulkan_hevc.c
Commit message (Collapse)AuthorAgeFilesLines
* avcodec/vulkan_{av1, h264, hevc}: demote per frame logs to AV_LOG_DEBUGllyyr2025-04-201-1/+1
| | | | | | Matches vaapi and software decoding behavior Signed-off-by: llyyr <llyyr.public@gmail.com>
* vulkan_decode: only create sequence params in end_frameLynne2025-04-141-9/+0
| | | | | | | We tried to create sequence params in both start_frame and end_frame. This was redundant. Just always create them in end_frame.
* FFHWAccel: add buffer_ref argument to start_frameLynne2025-03-171-0/+1
| | | | | | | | This commit adds a reference to the buffer as an argument to start_frame, and adapts all existing code. This allows for asynchronous hardware accelerators to skip copying packet data by referencing it.
* vulkan_hevc: use VK_KHR_video_maintenance2 if availableLynne2025-03-171-6/+43
|
* vulkan_decode: support multiple image viewsLynne2025-03-171-2/+2
| | | | | Enables non-monochrome video decoding using all our existing functions in the context of an SDR decoder.
* vulkan_decode: add queue_flags field to specify queue usedLynne2024-12-231-0/+1
|
* lavc/refstruct: move to lavu and make publicAnton Khirnov2024-12-151-1/+1
| | | | It is highly versatile and generally useful.
* lavc: add hevc_vulkan hardware encoderLynne2024-09-171-22/+3
| | | | | This commit adds a Vulkan hardware HEVC encoder, with full support of the spec - I, P, and B-frames.
* vulkan_video: move imageview creation and DPB fields to common contextLynne2024-09-091-1/+2
| | | | Shared between decoders and encoders.
* lavc/hevcdec: add a per-layer contextAnton Khirnov2024-09-061-8/+9
| | | | | | | Start by moving the DPB to it. Only one context exists for now, so decoder behaviour should not change with this commit, but that will change in the future.
* avcodec: use the renamed av_zero_extendJames Almer2024-06-131-1/+1
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* lavc/hevcdec: move active PPS from HEVCParamSets to HEVCContextAnton Khirnov2024-06-111-4/+4
| | | | | "Currently active PPS" is a property of the decoding process, not of the list of available parameter sets.
* lavc/hevc*: move to hevc/ subdirAnton Khirnov2024-06-041-3/+3
|
* lavc/hevcdec: rename HEVCFrame.frame to just fAnton Khirnov2024-06-041-5/+5
| | | | | This is shorter, loses no information, and is consistent with other similar structs.
* lavc/hevcdec: rename HEVCContext.ref to cur_frameAnton Khirnov2024-06-041-3/+3
| | | | Since it stores a pointer to the current frame.
* lavc/hevc_ps: compactify ShortTermRPSAnton Khirnov2024-05-311-1/+1
| | | | | | Do not use larger fields than needed, use size-1 bitfields for flags. Reduces sizeof(HEVCSPS) by 1280 bytes.
* lavc/hevc_ps: reduce the size of ShortTermRPS.usedAnton Khirnov2024-05-311-8/+5
| | | | | | | It is currently an array of 32 uint8_t, each storing a single flag. A single uint32_t is sufficient. Reduces sizeof(HEVCSPS) by 1792 bytes.
* lavc/hevc_ps: do not store delta_poc_s[01] in ShortTermRPSAnton Khirnov2024-05-311-3/+6
| | | | | | | | | They are only used in vulkan_hevc and are not actually needed, as they can be computed from delta_poc. Reduces sizeof(HEVCSPS) by 16kB. Also, fix a typo (s0->s1) in the code being touched.
* lavc/hevc_ps/HEVCSPS: change flags into uint8_tAnton Khirnov2024-05-311-28/+28
| | | | | | | Reduces sizeof(HEVCSPS) by 64 bytes. Also improve flag names: drop redundant suffixes and prefixes, and consistently use disabled/enabled.
* lavc/hevc_ps: reduce the size of used_by_curr_pic_lt_sps_flagAnton Khirnov2024-05-311-2/+1
| | | | | It is currently an array of 32 uint8_t, each storing a single flag. A single uint32_t is sufficient.
* 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.