FFmpeg
Data Structures | Macros | Functions | Variables
vulkan_video.c File Reference
#include "codec_id.h"
#include "vulkan_video.h"

Go to the source code of this file.

Data Structures

struct  FFVkFormatMapEntry
 

Macros

#define ASPECT_2PLANE   (VK_IMAGE_ASPECT_PLANE_0_BIT | VK_IMAGE_ASPECT_PLANE_1_BIT)
 
#define ASPECT_3PLANE   (VK_IMAGE_ASPECT_PLANE_0_BIT | VK_IMAGE_ASPECT_PLANE_1_BIT | VK_IMAGE_ASPECT_PLANE_2_BIT)
 

Functions

enum AVPixelFormat ff_vk_pix_fmt_from_vkfmt (VkFormat vkf)
 Get pixfmt from a Vulkan format. More...
 
VkImageAspectFlags ff_vk_aspect_bits_from_vkfmt (VkFormat vkf)
 Get aspect bits which include all planes from a VkFormat. More...
 
VkVideoChromaSubsamplingFlagBitsKHR ff_vk_subsampling_from_av_desc (const AVPixFmtDescriptor *desc)
 Get Vulkan's chroma subsampling from a pixfmt descriptor. More...
 
VkVideoComponentBitDepthFlagBitsKHR ff_vk_depth_from_av_depth (int depth)
 Get Vulkan's bit depth from an [8:12] integer. More...
 
int ff_vk_h264_level_to_av (StdVideoH264LevelIdc level)
 Convert level from Vulkan to AV. More...
 
int ff_vk_h265_level_to_av (StdVideoH265LevelIdc level)
 
static void free_data_buf (void *opaque, uint8_t *data)
 
static AVBufferRefalloc_data_buf (void *opaque, size_t size)
 
int ff_vk_video_get_buffer (FFVulkanContext *ctx, FFVkVideoCommon *s, AVBufferRef **buf, VkBufferUsageFlags usage, void *create_pNext, size_t size)
 Get a mapped FFVkPooledBuffer with a specific guaranteed minimum size from a pool. More...
 
av_cold void ff_vk_video_common_uninit (FFVulkanContext *s, FFVkVideoCommon *common)
 Free video session and required resources. More...
 
av_cold int ff_vk_video_common_init (void *log, FFVulkanContext *s, FFVkVideoCommon *common, VkVideoSessionCreateInfoKHR *session_create)
 Initialize video session, allocating and binding necessary memory. More...
 

Variables

const FFVkCodecMap ff_vk_codec_map [3]
 
static const struct FFVkFormatMapEntry vk_format_map []
 
static const int nb_vk_format_map = FF_ARRAY_ELEMS(vk_format_map)
 

Macro Definition Documentation

◆ ASPECT_2PLANE

#define ASPECT_2PLANE   (VK_IMAGE_ASPECT_PLANE_0_BIT | VK_IMAGE_ASPECT_PLANE_1_BIT)

Definition at line 47 of file vulkan_video.c.

◆ ASPECT_3PLANE

#define ASPECT_3PLANE   (VK_IMAGE_ASPECT_PLANE_0_BIT | VK_IMAGE_ASPECT_PLANE_1_BIT | VK_IMAGE_ASPECT_PLANE_2_BIT)

Definition at line 48 of file vulkan_video.c.

Function Documentation

◆ ff_vk_pix_fmt_from_vkfmt()

enum AVPixelFormat ff_vk_pix_fmt_from_vkfmt ( VkFormat  vkf)

Get pixfmt from a Vulkan format.

Definition at line 120 of file vulkan_video.c.

Referenced by vulkan_decode_get_profile().

◆ ff_vk_aspect_bits_from_vkfmt()

VkImageAspectFlags ff_vk_aspect_bits_from_vkfmt ( VkFormat  vkf)

Get aspect bits which include all planes from a VkFormat.

Definition at line 128 of file vulkan_video.c.

Referenced by vk_decode_create_view().

◆ ff_vk_subsampling_from_av_desc()

VkVideoChromaSubsamplingFlagBitsKHR ff_vk_subsampling_from_av_desc ( const AVPixFmtDescriptor desc)

Get Vulkan's chroma subsampling from a pixfmt descriptor.

Definition at line 136 of file vulkan_video.c.

Referenced by vulkan_setup_profile().

◆ ff_vk_depth_from_av_depth()

VkVideoComponentBitDepthFlagBitsKHR ff_vk_depth_from_av_depth ( int  depth)

Get Vulkan's bit depth from an [8:12] integer.

Definition at line 149 of file vulkan_video.c.

Referenced by vulkan_setup_profile().

◆ ff_vk_h264_level_to_av()

int ff_vk_h264_level_to_av ( StdVideoH264LevelIdc  level)

Convert level from Vulkan to AV.

Definition at line 160 of file vulkan_video.c.

Referenced by vulkan_decode_get_profile().

◆ ff_vk_h265_level_to_av()

int ff_vk_h265_level_to_av ( StdVideoH265LevelIdc  level)

Definition at line 186 of file vulkan_video.c.

Referenced by vulkan_decode_get_profile().

◆ free_data_buf()

static void free_data_buf ( void *  opaque,
uint8_t *  data 
)
static

Definition at line 205 of file vulkan_video.c.

Referenced by alloc_data_buf().

◆ alloc_data_buf()

static AVBufferRef* alloc_data_buf ( void *  opaque,
size_t  size 
)
static

Definition at line 214 of file vulkan_video.c.

Referenced by ff_vk_video_get_buffer().

◆ ff_vk_video_get_buffer()

int ff_vk_video_get_buffer ( FFVulkanContext ctx,
FFVkVideoCommon *  s,
AVBufferRef **  buf,
VkBufferUsageFlags  usage,
void *  create_pNext,
size_t  size 
)

Get a mapped FFVkPooledBuffer with a specific guaranteed minimum size from a pool.

Definition at line 227 of file vulkan_video.c.

Referenced by ff_vk_decode_add_slice().

◆ ff_vk_video_common_uninit()

av_cold void ff_vk_video_common_uninit ( FFVulkanContext s,
FFVkVideoCommon *  common 
)

Free video session and required resources.

Definition at line 285 of file vulkan_video.c.

Referenced by ff_vk_video_common_init(), and free_common().

◆ ff_vk_video_common_init()

av_cold int ff_vk_video_common_init ( void *  log,
FFVulkanContext s,
FFVkVideoCommon *  common,
VkVideoSessionCreateInfoKHR *  session_create 
)

Initialize video session, allocating and binding necessary memory.

Definition at line 305 of file vulkan_video.c.

Referenced by ff_vk_decode_init().

Variable Documentation

◆ ff_vk_codec_map

const FFVkCodecMap ff_vk_codec_map[3]
Initial value:
= {
{
.codec_id = AV_CODEC_ID_H264,
0,
0,
VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR,
},
{
.codec_id = AV_CODEC_ID_HEVC,
0,
0,
VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR
},
{
.codec_id = AV_CODEC_ID_AV1,
0,
0,
0x01000000
},
}

Definition at line 23 of file vulkan_video.c.

Referenced by get_codecmap().

◆ vk_format_map

const struct FFVkFormatMapEntry vk_format_map[]
static

◆ nb_vk_format_map

const int nb_vk_format_map = FF_ARRAY_ELEMS(vk_format_map)
static

Definition at line 118 of file vulkan_video.c.

Referenced by ff_vk_aspect_bits_from_vkfmt(), and ff_vk_pix_fmt_from_vkfmt().

FF_VK_EXT_VIDEO_DECODE_H264
@ FF_VK_EXT_VIDEO_DECODE_H264
Definition: vulkan_functions.h:44
FF_VK_EXT_VIDEO_DECODE_AV1
@ FF_VK_EXT_VIDEO_DECODE_AV1
Definition: vulkan_functions.h:46
FF_VK_EXT_VIDEO_DECODE_H265
@ FF_VK_EXT_VIDEO_DECODE_H265
Definition: vulkan_functions.h:45
AV_CODEC_ID_H264
@ AV_CODEC_ID_H264
Definition: codec_id.h:79
AV_CODEC_ID_AV1
@ AV_CODEC_ID_AV1
Definition: codec_id.h:283
AV_CODEC_ID_HEVC
@ AV_CODEC_ID_HEVC
Definition: codec_id.h:226