FFmpeg
Data Structures | Functions | Variables
vulkan_h264.c File Reference
#include "h264dec.h"
#include "h264_ps.h"
#include "vulkan_decode.h"

Go to the source code of this file.

Data Structures

struct  H264VulkanDecodePicture
 

Functions

static int vk_h264_fill_pict (AVCodecContext *avctx, H264Picture **ref_src, VkVideoReferenceSlotInfoKHR *ref_slot, VkVideoPictureResourceInfoKHR *ref, VkVideoDecodeH264DpbSlotInfoKHR *vkh264_ref, StdVideoDecodeH264ReferenceInfo *h264_ref, H264Picture *pic, int is_current, int is_field, int picture_structure, int dpb_slot_index)
 
static StdVideoH264LevelIdc convert_to_vk_level_idc (int level_idc)
 
static void set_sps (const SPS *sps, StdVideoH264ScalingLists *vksps_scaling, StdVideoH264HrdParameters *vksps_vui_header, StdVideoH264SequenceParameterSetVui *vksps_vui, StdVideoH264SequenceParameterSet *vksps)
 
static void set_pps (const PPS *pps, const SPS *sps, StdVideoH264ScalingLists *vkpps_scaling, StdVideoH264PictureParameterSet *vkpps)
 
static int vk_h264_create_params (AVCodecContext *avctx, AVBufferRef **buf)
 
static int vk_h264_start_frame (AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
 
static int vk_h264_decode_slice (AVCodecContext *avctx, const uint8_t *data, uint32_t size)
 
static int vk_h264_end_frame (AVCodecContext *avctx)
 
static void vk_h264_free_frame_priv (FFRefStructOpaque _hwctx, void *data)
 

Variables

const FFVulkanDecodeDescriptor ff_vk_dec_h264_desc
 
const static int h264_scaling_list8_order [] = { 0, 3, 1, 4, 2, 5 }
 
const FFHWAccel ff_h264_vulkan_hwaccel
 

Function Documentation

◆ vk_h264_fill_pict()

static int vk_h264_fill_pict ( AVCodecContext avctx,
H264Picture **  ref_src,
VkVideoReferenceSlotInfoKHR *  ref_slot,
VkVideoPictureResourceInfoKHR *  ref,
VkVideoDecodeH264DpbSlotInfoKHR *  vkh264_ref,
StdVideoDecodeH264ReferenceInfo *  h264_ref,
H264Picture pic,
int  is_current,
int  is_field,
int  picture_structure,
int  dpb_slot_index 
)
static

Definition at line 53 of file vulkan_h264.c.

Referenced by vk_h264_start_frame().

◆ convert_to_vk_level_idc()

static StdVideoH264LevelIdc convert_to_vk_level_idc ( int  level_idc)
static

Definition at line 115 of file vulkan_h264.c.

Referenced by set_sps().

◆ set_sps()

static void set_sps ( const SPS sps,
StdVideoH264ScalingLists *  vksps_scaling,
StdVideoH264HrdParameters *  vksps_vui_header,
StdVideoH264SequenceParameterSetVui *  vksps_vui,
StdVideoH264SequenceParameterSet *  vksps 
)
static

Definition at line 141 of file vulkan_h264.c.

Referenced by vk_h264_create_params().

◆ set_pps()

static void set_pps ( const PPS pps,
const SPS sps,
StdVideoH264ScalingLists *  vkpps_scaling,
StdVideoH264PictureParameterSet *  vkpps 
)
static

Definition at line 249 of file vulkan_h264.c.

Referenced by vk_h264_create_params().

◆ vk_h264_create_params()

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

Definition at line 291 of file vulkan_h264.c.

Referenced by vk_h264_end_frame(), and vk_h264_start_frame().

◆ vk_h264_start_frame()

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

Definition at line 359 of file vulkan_h264.c.

◆ vk_h264_decode_slice()

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

Definition at line 479 of file vulkan_h264.c.

◆ vk_h264_end_frame()

static int vk_h264_end_frame ( AVCodecContext avctx)
static

Definition at line 504 of file vulkan_h264.c.

◆ vk_h264_free_frame_priv()

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

Definition at line 543 of file vulkan_h264.c.

Variable Documentation

◆ ff_vk_dec_h264_desc

const FFVulkanDecodeDescriptor ff_vk_dec_h264_desc
Initial value:
= {
.codec_id = AV_CODEC_ID_H264,
.decode_extension = FF_VK_EXT_VIDEO_DECODE_H264,
.decode_op = VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR,
.ext_props = {
.extensionName = VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_EXTENSION_NAME,
.specVersion = VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_SPEC_VERSION,
},
}

Definition at line 24 of file vulkan_h264.c.

◆ h264_scaling_list8_order

const static int h264_scaling_list8_order[] = { 0, 3, 1, 4, 2, 5 }
static

Definition at line 51 of file vulkan_h264.c.

Referenced by set_pps(), and set_sps().

◆ ff_h264_vulkan_hwaccel

const FFHWAccel ff_h264_vulkan_hwaccel
Initial value:
= {
.p.name = "h264_vulkan",
.p.type = AVMEDIA_TYPE_VIDEO,
.p.pix_fmt = AV_PIX_FMT_VULKAN,
.start_frame = &vk_h264_start_frame,
.decode_slice = &vk_h264_decode_slice,
.end_frame = &vk_h264_end_frame,
.free_frame_priv = &vk_h264_free_frame_priv,
.frame_priv_data_size = sizeof(H264VulkanDecodePicture),
.decode_params = &ff_vk_params_invalidate,
.frame_params = &ff_vk_frame_params,
.priv_data_size = sizeof(FFVulkanDecodeContext),
}

Definition at line 552 of file vulkan_h264.c.

FF_VK_EXT_VIDEO_DECODE_H264
@ FF_VK_EXT_VIDEO_DECODE_H264
Definition: vulkan_functions.h:44
FFVulkanDecodeContext
Definition: vulkan_decode.h:65
AV_PIX_FMT_VULKAN
@ AV_PIX_FMT_VULKAN
Vulkan hardware images.
Definition: pixfmt.h:379
HWACCEL_CAP_THREAD_SAFE
#define HWACCEL_CAP_THREAD_SAFE
Definition: hwaccel_internal.h:32
vk_h264_free_frame_priv
static void vk_h264_free_frame_priv(FFRefStructOpaque _hwctx, void *data)
Definition: vulkan_h264.c:543
vk_h264_decode_slice
static int vk_h264_decode_slice(AVCodecContext *avctx, const uint8_t *data, uint32_t size)
Definition: vulkan_h264.c:479
H264VulkanDecodePicture
Definition: vulkan_h264.c:34
AV_CODEC_ID_H264
@ AV_CODEC_ID_H264
Definition: codec_id.h:79
HWACCEL_CAP_ASYNC_SAFE
#define HWACCEL_CAP_ASYNC_SAFE
Header providing the internals of AVHWAccel.
Definition: hwaccel_internal.h:31
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
vk_h264_end_frame
static int vk_h264_end_frame(AVCodecContext *avctx)
Definition: vulkan_h264.c:504
vk_h264_start_frame
static int vk_h264_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
Definition: vulkan_h264.c:359
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