FFmpeg
Data Structures | Functions | Variables
vulkan_hevc.c File Reference
#include "hevcdec.h"
#include "hevc_data.h"
#include "hevc_ps.h"
#include "vulkan_decode.h"

Go to the source code of this file.

Data Structures

struct  HEVCHeaderSPS
 
struct  HEVCHeaderPPS
 
struct  HEVCHeaderVPSSet
 
struct  HEVCHeaderVPS
 
struct  HEVCHeaderSet
 
struct  HEVCVulkanDecodePicture
 

Functions

static int alloc_hevc_header_structs (FFVulkanDecodeContext *s, int nb_vps, const int vps_list_idx[HEVC_MAX_VPS_COUNT], const HEVCVPS *const vps_list[HEVC_MAX_VPS_COUNT])
 
static int vk_hevc_fill_pict (AVCodecContext *avctx, HEVCFrame **ref_src, VkVideoReferenceSlotInfoKHR *ref_slot, VkVideoPictureResourceInfoKHR *ref, VkVideoDecodeH265DpbSlotInfoKHR *vkh265_ref, StdVideoDecodeH265ReferenceInfo *h265_ref, HEVCFrame *pic, int is_current, int pic_id)
 
static StdVideoH265LevelIdc convert_to_vk_level_idc (int level_idc)
 
static void copy_scaling_list (const ScalingList *sl, StdVideoH265ScalingLists *vksl)
 
static void set_sps (const HEVCSPS *sps, int sps_idx, StdVideoH265ScalingLists *vksps_scaling, StdVideoH265HrdParameters *vksps_vui_header, StdVideoH265SequenceParameterSetVui *vksps_vui, StdVideoH265SequenceParameterSet *vksps, StdVideoH265SubLayerHrdParameters *slhdrnal, StdVideoH265SubLayerHrdParameters *slhdrvcl, StdVideoH265ProfileTierLevel *ptl, StdVideoH265DecPicBufMgr *dpbm, StdVideoH265PredictorPaletteEntries *pal, StdVideoH265ShortTermRefPicSet *str, StdVideoH265LongTermRefPicsSps *ltr)
 
static void set_pps (const HEVCPPS *pps, const HEVCSPS *sps, StdVideoH265ScalingLists *vkpps_scaling, StdVideoH265PictureParameterSet *vkpps, StdVideoH265PredictorPaletteEntries *pal)
 
static void set_vps (const HEVCVPS *vps, StdVideoH265VideoParameterSet *vkvps, StdVideoH265ProfileTierLevel *ptl, StdVideoH265DecPicBufMgr *dpbm, StdVideoH265HrdParameters *sls_hdr, HEVCHeaderVPSSet sls[])
 
static int vk_hevc_create_params (AVCodecContext *avctx, AVBufferRef **buf)
 
static int vk_hevc_start_frame (AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
 
static int vk_hevc_decode_slice (AVCodecContext *avctx, const uint8_t *data, uint32_t size)
 
static int vk_hevc_end_frame (AVCodecContext *avctx)
 
static void vk_hevc_free_frame_priv (FFRefStructOpaque _hwctx, void *data)
 

Variables

const FFVulkanDecodeDescriptor ff_vk_dec_hevc_desc
 
const FFHWAccel ff_hevc_vulkan_hwaccel
 

Function Documentation

◆ alloc_hevc_header_structs()

static int alloc_hevc_header_structs ( FFVulkanDecodeContext s,
int  nb_vps,
const int  vps_list_idx[HEVC_MAX_VPS_COUNT],
const HEVCVPS *const  vps_list[HEVC_MAX_VPS_COUNT] 
)
static

Definition at line 76 of file vulkan_hevc.c.

Referenced by vk_hevc_create_params().

◆ vk_hevc_fill_pict()

static int vk_hevc_fill_pict ( AVCodecContext avctx,
HEVCFrame **  ref_src,
VkVideoReferenceSlotInfoKHR *  ref_slot,
VkVideoPictureResourceInfoKHR *  ref,
VkVideoDecodeH265DpbSlotInfoKHR *  vkh265_ref,
StdVideoDecodeH265ReferenceInfo *  h265_ref,
HEVCFrame pic,
int  is_current,
int  pic_id 
)
static

Definition at line 130 of file vulkan_hevc.c.

Referenced by vk_hevc_start_frame().

◆ convert_to_vk_level_idc()

static StdVideoH265LevelIdc convert_to_vk_level_idc ( int  level_idc)
static

Definition at line 180 of file vulkan_hevc.c.

Referenced by set_sps(), and set_vps().

◆ copy_scaling_list()

static void copy_scaling_list ( const ScalingList sl,
StdVideoH265ScalingLists *  vksl 
)
static

Definition at line 199 of file vulkan_hevc.c.

Referenced by set_pps(), and set_sps().

◆ set_sps()

static void set_sps ( const HEVCSPS sps,
int  sps_idx,
StdVideoH265ScalingLists *  vksps_scaling,
StdVideoH265HrdParameters *  vksps_vui_header,
StdVideoH265SequenceParameterSetVui *  vksps_vui,
StdVideoH265SequenceParameterSet *  vksps,
StdVideoH265SubLayerHrdParameters *  slhdrnal,
StdVideoH265SubLayerHrdParameters *  slhdrvcl,
StdVideoH265ProfileTierLevel *  ptl,
StdVideoH265DecPicBufMgr *  dpbm,
StdVideoH265PredictorPaletteEntries *  pal,
StdVideoH265ShortTermRefPicSet *  str,
StdVideoH265LongTermRefPicsSps *  ltr 
)
static

Definition at line 236 of file vulkan_hevc.c.

Referenced by vk_hevc_create_params().

◆ set_pps()

static void set_pps ( const HEVCPPS pps,
const HEVCSPS sps,
StdVideoH265ScalingLists *  vkpps_scaling,
StdVideoH265PictureParameterSet *  vkpps,
StdVideoH265PredictorPaletteEntries *  pal 
)
static

Definition at line 470 of file vulkan_hevc.c.

Referenced by vk_hevc_create_params().

◆ set_vps()

static void set_vps ( const HEVCVPS vps,
StdVideoH265VideoParameterSet *  vkvps,
StdVideoH265ProfileTierLevel *  ptl,
StdVideoH265DecPicBufMgr *  dpbm,
StdVideoH265HrdParameters *  sls_hdr,
HEVCHeaderVPSSet  sls[] 
)
static

Definition at line 558 of file vulkan_hevc.c.

Referenced by vk_hevc_create_params().

◆ vk_hevc_create_params()

static int vk_hevc_create_params ( AVCodecContext avctx,
AVBufferRef **  buf 
)
static

Definition at line 640 of file vulkan_hevc.c.

Referenced by vk_hevc_end_frame(), and vk_hevc_start_frame().

◆ vk_hevc_start_frame()

static int vk_hevc_start_frame ( AVCodecContext avctx,
av_unused const uint8_t *  buffer,
av_unused uint32_t  size 
)
static

Definition at line 728 of file vulkan_hevc.c.

◆ vk_hevc_decode_slice()

static int vk_hevc_decode_slice ( AVCodecContext avctx,
const uint8_t *  data,
uint32_t  size 
)
static

Definition at line 849 of file vulkan_hevc.c.

◆ vk_hevc_end_frame()

static int vk_hevc_end_frame ( AVCodecContext avctx)
static

Definition at line 866 of file vulkan_hevc.c.

◆ vk_hevc_free_frame_priv()

static void vk_hevc_free_frame_priv ( FFRefStructOpaque  _hwctx,
void *  data 
)
static

Definition at line 917 of file vulkan_hevc.c.

Variable Documentation

◆ ff_vk_dec_hevc_desc

const FFVulkanDecodeDescriptor ff_vk_dec_hevc_desc
Initial value:
= {
.codec_id = AV_CODEC_ID_HEVC,
.decode_extension = FF_VK_EXT_VIDEO_DECODE_H265,
.decode_op = VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR,
.ext_props = {
.extensionName = VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_EXTENSION_NAME,
.specVersion = VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_SPEC_VERSION,
},
}

Definition at line 25 of file vulkan_hevc.c.

◆ ff_hevc_vulkan_hwaccel

const FFHWAccel ff_hevc_vulkan_hwaccel
Initial value:
= {
.p.name = "hevc_vulkan",
.p.type = AVMEDIA_TYPE_VIDEO,
.p.pix_fmt = AV_PIX_FMT_VULKAN,
.start_frame = &vk_hevc_start_frame,
.decode_slice = &vk_hevc_decode_slice,
.end_frame = &vk_hevc_end_frame,
.free_frame_priv = &vk_hevc_free_frame_priv,
.frame_priv_data_size = sizeof(HEVCVulkanDecodePicture),
.decode_params = &ff_vk_params_invalidate,
.frame_params = &ff_vk_frame_params,
.priv_data_size = sizeof(FFVulkanDecodeContext),
}

Definition at line 926 of file vulkan_hevc.c.

vk_hevc_decode_slice
static int vk_hevc_decode_slice(AVCodecContext *avctx, const uint8_t *data, uint32_t size)
Definition: vulkan_hevc.c:849
FFVulkanDecodeContext
Definition: vulkan_decode.h:65
FF_VK_EXT_VIDEO_DECODE_H265
@ FF_VK_EXT_VIDEO_DECODE_H265
Definition: vulkan_functions.h:45
AV_PIX_FMT_VULKAN
@ AV_PIX_FMT_VULKAN
Vulkan hardware images.
Definition: pixfmt.h:379
vk_hevc_end_frame
static int vk_hevc_end_frame(AVCodecContext *avctx)
Definition: vulkan_hevc.c:866
HWACCEL_CAP_THREAD_SAFE
#define HWACCEL_CAP_THREAD_SAFE
Definition: hwaccel_internal.h:32
vk_hevc_start_frame
static int vk_hevc_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
Definition: vulkan_hevc.c:728
vk_hevc_free_frame_priv
static void vk_hevc_free_frame_priv(FFRefStructOpaque _hwctx, void *data)
Definition: vulkan_hevc.c:917
HWACCEL_CAP_ASYNC_SAFE
#define HWACCEL_CAP_ASYNC_SAFE
Header providing the internals of AVHWAccel.
Definition: hwaccel_internal.h:31
HEVCVulkanDecodePicture
Definition: vulkan_hevc.c:113
ff_vk_decode_uninit
int ff_vk_decode_uninit(AVCodecContext *avctx)
Free decoder.
Definition: vulkan_decode.c:1092
flush
void(* flush)(AVBSFContext *ctx)
Definition: dts2pts.c:367
ff_vk_frame_params
int ff_vk_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
Initialize hw_frames_ctx with the parameters needed to decode the stream using the parameters from av...
Definition: vulkan_decode.c:1006
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:365
uninit
static void uninit(AVBSFContext *ctx)
Definition: pcm_rechunk.c:68
AV_CODEC_ID_HEVC
@ AV_CODEC_ID_HEVC
Definition: codec_id.h:226
update_thread_context
the pkt_dts and pkt_pts fields in AVFrame will work as usual Restrictions on codec whose streams don t reset across will not work because their bitstreams cannot be decoded in parallel *The contents of buffers must not be read before as well as code calling up to before the decode process starts Call have update_thread_context() run it in the next thread. Add AV_CODEC_CAP_FRAME_THREADS to the codec capabilities. There will be very little speed gain at this point but it should work. If there are inter-frame dependencies
ff_vk_decode_flush
void ff_vk_decode_flush(AVCodecContext *avctx)
Flush decoder.
Definition: vulkan_decode.c:312
ff_vk_params_invalidate
int ff_vk_params_invalidate(AVCodecContext *avctx, int t, const uint8_t *b, uint32_t s)
Removes current session parameters to recreate them.
Definition: vulkan_decode.c:120
ff_vk_update_thread_context
int ff_vk_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
Synchronize the contexts between 2 threads.
Definition: vulkan_decode.c:79
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
ff_vk_decode_init
int ff_vk_decode_init(AVCodecContext *avctx)
Initialize decoder.
Definition: vulkan_decode.c:1107