FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
vulkan_encode_h265.c File Reference
#include "libavutil/opt.h"
#include "libavutil/mem.h"
#include "cbs.h"
#include "cbs_h265.h"
#include "atsc_a53.h"
#include "libavutil/mastering_display_metadata.h"
#include "codec_internal.h"
#include "version.h"
#include "hw_base_encode_h265.h"
#include "vulkan_encode.h"

Go to the source code of this file.

Data Structures

struct  VulkanEncodeH265Picture
 
struct  VulkanEncodeH265Context
 
struct  VulkanH265Units
 

Macros

#define OFFSET(x)   offsetof(VulkanEncodeH265Context, x)
 
#define FLAGS   (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
 
#define PROFILE(name, value)
 
#define LEVEL(name, value)
 

Enumerations

enum  UnitElems {
  UNIT_AUD = 1 << 0, UNIT_SEI_TIMING = 1 << 1, UNIT_SEI_IDENTIFIER = 1 << 2, UNIT_SEI_RECOVERY = 1 << 3,
  UNIT_SEI_A53_CC = 1 << 4, UNIT_AUD = 1 << 0, UNIT_SEI_MASTERING_DISPLAY = 1 << 1, UNIT_SEI_CONTENT_LIGHT_LEVEL = 1 << 2,
  UNIT_SEI_A53_CC = 1 << 3
}
 

Functions

static int init_pic_rc (AVCodecContext *avctx, FFHWBaseEncodePicture *pic, VkVideoEncodeRateControlInfoKHR *rc_info, VkVideoEncodeRateControlLayerInfoKHR *rc_layer)
 
static int vk_enc_h265_update_pic_info (AVCodecContext *avctx, FFHWBaseEncodePicture *pic)
 
static void setup_slices (AVCodecContext *avctx, FFHWBaseEncodePicture *pic)
 
static void setup_refs (AVCodecContext *avctx, FFHWBaseEncodePicture *pic, VkVideoEncodeInfoKHR *encode_info)
 
static int init_pic_params (AVCodecContext *avctx, FFHWBaseEncodePicture *pic, VkVideoEncodeInfoKHR *encode_info)
 
static int init_profile (AVCodecContext *avctx, VkVideoProfileInfoKHR *profile, void *pnext)
 
static int init_enc_options (AVCodecContext *avctx)
 
static av_cold int init_sequence_headers (AVCodecContext *avctx)
 
static av_cold int base_unit_to_vk (AVCodecContext *avctx, VulkanH265Units *vk_units)
 
static int create_session_params (AVCodecContext *avctx)
 
static int parse_feedback_units (AVCodecContext *avctx, const uint8_t *data, size_t size, int sps_override, int pps_override)
 
static int init_base_units (AVCodecContext *avctx)
 
static int vulkan_encode_h265_add_nal (AVCodecContext *avctx, CodedBitstreamFragment *au, void *nal_unit)
 
static int write_access_unit (AVCodecContext *avctx, uint8_t *data, size_t *data_len, CodedBitstreamFragment *au)
 
static int write_sequence_headers (AVCodecContext *avctx, FFHWBaseEncodePicture *base_pic, uint8_t *data, size_t *data_len)
 
static int write_extra_headers (AVCodecContext *avctx, FFHWBaseEncodePicture *base_pic, uint8_t *data, size_t *data_len)
 
static int write_filler (AVCodecContext *avctx, uint32_t filler, uint8_t *data, size_t *data_len)
 
static av_cold int vulkan_encode_h265_init (AVCodecContext *avctx)
 
static av_cold int vulkan_encode_h265_close (AVCodecContext *avctx)
 

Variables

const FFVulkanEncodeDescriptor ff_vk_enc_h265_desc
 
static const FFVulkanCodec enc_cb
 
static const AVOption vulkan_encode_h265_options []
 
static const FFCodecDefault vulkan_encode_h265_defaults []
 
static const AVClass vulkan_encode_h265_class
 
const FFCodec ff_hevc_vulkan_encoder
 

Macro Definition Documentation

◆ OFFSET

#define OFFSET (   x)    offsetof(VulkanEncodeH265Context, x)

Definition at line 1701 of file vulkan_encode_h265.c.

◆ FLAGS

Definition at line 1702 of file vulkan_encode_h265.c.

◆ PROFILE

#define PROFILE (   name,
  value 
)
Value:
{ .i64 = value }, 0, 0, FLAGS, .unit = "profile"

◆ LEVEL

#define LEVEL (   name,
  value 
)
Value:
{ .i64 = value }, 0, 0, FLAGS, .unit = "level"

Enumeration Type Documentation

◆ UnitElems

enum UnitElems
Enumerator
UNIT_AUD 
UNIT_SEI_TIMING 
UNIT_SEI_IDENTIFIER 
UNIT_SEI_RECOVERY 
UNIT_SEI_A53_CC 
UNIT_AUD 
UNIT_SEI_MASTERING_DISPLAY 
UNIT_SEI_CONTENT_LIGHT_LEVEL 
UNIT_SEI_A53_CC 

Definition at line 33 of file vulkan_encode_h265.c.

Function Documentation

◆ init_pic_rc()

static int init_pic_rc ( AVCodecContext avctx,
FFHWBaseEncodePicture pic,
VkVideoEncodeRateControlInfoKHR *  rc_info,
VkVideoEncodeRateControlLayerInfoKHR *  rc_layer 
)
static

Definition at line 110 of file vulkan_encode_h265.c.

◆ vk_enc_h265_update_pic_info()

static int vk_enc_h265_update_pic_info ( AVCodecContext avctx,
FFHWBaseEncodePicture pic 
)
static

Definition at line 155 of file vulkan_encode_h265.c.

Referenced by init_pic_params().

◆ setup_slices()

static void setup_slices ( AVCodecContext avctx,
FFHWBaseEncodePicture pic 
)
static

Definition at line 293 of file vulkan_encode_h265.c.

Referenced by init_pic_params().

◆ setup_refs()

static void setup_refs ( AVCodecContext avctx,
FFHWBaseEncodePicture pic,
VkVideoEncodeInfoKHR *  encode_info 
)
static

Definition at line 369 of file vulkan_encode_h265.c.

Referenced by init_pic_params().

◆ init_pic_params()

static int init_pic_params ( AVCodecContext avctx,
FFHWBaseEncodePicture pic,
VkVideoEncodeInfoKHR *  encode_info 
)
static

Definition at line 518 of file vulkan_encode_h265.c.

◆ init_profile()

static int init_profile ( AVCodecContext avctx,
VkVideoProfileInfoKHR *  profile,
void *  pnext 
)
static

Definition at line 593 of file vulkan_encode_h265.c.

◆ init_enc_options()

static int init_enc_options ( AVCodecContext avctx)
static

Definition at line 672 of file vulkan_encode_h265.c.

Referenced by vulkan_encode_h265_init().

◆ init_sequence_headers()

static av_cold int init_sequence_headers ( AVCodecContext avctx)
static

Definition at line 726 of file vulkan_encode_h265.c.

Referenced by init_base_units().

◆ base_unit_to_vk()

static av_cold int base_unit_to_vk ( AVCodecContext avctx,
VulkanH265Units vk_units 
)
static

Definition at line 840 of file vulkan_encode_h265.c.

Referenced by create_session_params().

◆ create_session_params()

static int create_session_params ( AVCodecContext avctx)
static

Definition at line 1155 of file vulkan_encode_h265.c.

Referenced by init_base_units().

◆ parse_feedback_units()

static int parse_feedback_units ( AVCodecContext avctx,
const uint8_t *  data,
size_t  size,
int  sps_override,
int  pps_override 
)
static

Definition at line 1202 of file vulkan_encode_h265.c.

Referenced by init_base_units().

◆ init_base_units()

static int init_base_units ( AVCodecContext avctx)
static

Definition at line 1254 of file vulkan_encode_h265.c.

Referenced by vulkan_encode_h265_init().

◆ vulkan_encode_h265_add_nal()

static int vulkan_encode_h265_add_nal ( AVCodecContext avctx,
CodedBitstreamFragment au,
void *  nal_unit 
)
static

◆ write_access_unit()

static int write_access_unit ( AVCodecContext avctx,
uint8_t *  data,
size_t *  data_len,
CodedBitstreamFragment au 
)
static

◆ write_sequence_headers()

static int write_sequence_headers ( AVCodecContext avctx,
FFHWBaseEncodePicture base_pic,
uint8_t *  data,
size_t *  data_len 
)
static

Definition at line 1396 of file vulkan_encode_h265.c.

◆ write_extra_headers()

static int write_extra_headers ( AVCodecContext avctx,
FFHWBaseEncodePicture base_pic,
uint8_t *  data,
size_t *  data_len 
)
static

Definition at line 1430 of file vulkan_encode_h265.c.

◆ write_filler()

static int write_filler ( AVCodecContext avctx,
uint32_t  filler,
uint8_t *  data,
size_t *  data_len 
)
static

Definition at line 1481 of file vulkan_encode_h265.c.

◆ vulkan_encode_h265_init()

static av_cold int vulkan_encode_h265_init ( AVCodecContext avctx)
static

Definition at line 1521 of file vulkan_encode_h265.c.

◆ vulkan_encode_h265_close()

static av_cold int vulkan_encode_h265_close ( AVCodecContext avctx)
static

Definition at line 1694 of file vulkan_encode_h265.c.

Variable Documentation

◆ ff_vk_enc_h265_desc

const FFVulkanEncodeDescriptor ff_vk_enc_h265_desc
Initial value:
= {
.codec_id = AV_CODEC_ID_H265,
.encode_extension = FF_VK_EXT_VIDEO_ENCODE_H265,
.encode_op = VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR,
.ext_props = {
.extensionName = VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_EXTENSION_NAME,
.specVersion = VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_SPEC_VERSION,
},
}

Definition at line 40 of file vulkan_encode_h265.c.

Referenced by vulkan_encode_h265_init().

◆ enc_cb

const FFVulkanCodec enc_cb
static

◆ vulkan_encode_h265_options

const AVOption vulkan_encode_h265_options[]
static

Definition at line 1703 of file vulkan_encode_h265.c.

◆ vulkan_encode_h265_defaults

const FFCodecDefault vulkan_encode_h265_defaults[]
static
Initial value:
= {
{ "b", "0" },
{ "bf", "2" },
{ "g", "300" },
{ "i_qfactor", "1" },
{ "i_qoffset", "0" },
{ "b_qfactor", "6/5" },
{ "b_qoffset", "0" },
{ "qmin", "-1" },
{ "qmax", "-1" },
{ NULL },
}

Definition at line 1750 of file vulkan_encode_h265.c.

◆ vulkan_encode_h265_class

const AVClass vulkan_encode_h265_class
static
Initial value:
= {
.class_name = "hevc_vulkan",
.item_name = av_default_item_name,
}

Definition at line 1763 of file vulkan_encode_h265.c.

◆ ff_hevc_vulkan_encoder

const FFCodec ff_hevc_vulkan_encoder
Initial value:

Definition at line 1770 of file vulkan_encode_h265.c.

AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
VulkanEncodeH265Picture
Definition: vulkan_encode_h265.c:50
FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: codec_internal.h:43
FF_HW_FLAG_B_PICTURE_REFERENCES
@ FF_HW_FLAG_B_PICTURE_REFERENCES
Definition: hw_base_encode.h:55
ff_vulkan_encode_hw_configs
const AVCodecHWConfigInternal *const ff_vulkan_encode_hw_configs[]
Paperwork.
Definition: vulkan_encode.c:26
AV_CODEC_CAP_HARDWARE
#define AV_CODEC_CAP_HARDWARE
Codec is backed by a hardware implementation.
Definition: codec.h:145
FF_HW_FLAG_B_PICTURES
@ FF_HW_FLAG_B_PICTURES
Definition: hw_base_encode.h:53
VulkanEncodeH265Context
Definition: vulkan_encode_h265.c:79
FLAGS
#define FLAGS
Definition: vulkan_encode_h265.c:1702
write_sequence_headers
static int write_sequence_headers(AVCodecContext *avctx, FFHWBaseEncodePicture *base_pic, uint8_t *data, size_t *data_len)
Definition: vulkan_encode_h265.c:1396
init_pic_rc
static int init_pic_rc(AVCodecContext *avctx, FFHWBaseEncodePicture *pic, VkVideoEncodeRateControlInfoKHR *rc_info, VkVideoEncodeRateControlLayerInfoKHR *rc_layer)
Definition: vulkan_encode_h265.c:110
AV_PIX_FMT_VULKAN
@ AV_PIX_FMT_VULKAN
Vulkan hardware images.
Definition: pixfmt.h:379
FF_VK_EXT_VIDEO_ENCODE_H265
#define FF_VK_EXT_VIDEO_ENCODE_H265
Definition: vulkan_functions.h:63
vulkan_encode_h265_class
static const AVClass vulkan_encode_h265_class
Definition: vulkan_encode_h265.c:1763
AV_CODEC_CAP_ENCODER_FLUSH
#define AV_CODEC_CAP_ENCODER_FLUSH
This encoder can be flushed using avcodec_flush_buffers().
Definition: codec.h:166
init_profile
static int init_profile(AVCodecContext *avctx, VkVideoProfileInfoKHR *profile, void *pnext)
Definition: vulkan_encode_h265.c:593
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
Definition: codec.h:159
init_pic_params
static int init_pic_params(AVCodecContext *avctx, FFHWBaseEncodePicture *pic, VkVideoEncodeInfoKHR *encode_info)
Definition: vulkan_encode_h265.c:518
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:296
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
FF_CODEC_RECEIVE_PACKET_CB
#define FF_CODEC_RECEIVE_PACKET_CB(func)
Definition: codec_internal.h:326
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
write_filler
static int write_filler(AVCodecContext *avctx, uint32_t filler, uint8_t *data, size_t *data_len)
Definition: vulkan_encode_h265.c:1481
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:368
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
vulkan_encode_h265_defaults
static const FFCodecDefault vulkan_encode_h265_defaults[]
Definition: vulkan_encode_h265.c:1750
ff_vulkan_encode_receive_packet
int ff_vulkan_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
Encode.
Definition: vulkan_encode.c:541
AV_CODEC_ID_HEVC
@ AV_CODEC_ID_HEVC
Definition: codec_id.h:226
value
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
Definition: writing_filters.txt:86
write_extra_headers
static int write_extra_headers(AVCodecContext *avctx, FFHWBaseEncodePicture *base_pic, uint8_t *data, size_t *data_len)
Definition: vulkan_encode_h265.c:1430
FF_HW_FLAG_NON_IDR_KEY_PICTURES
@ FF_HW_FLAG_NON_IDR_KEY_PICTURES
Definition: hw_base_encode.h:58
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_CODEC_ID_H265
#define AV_CODEC_ID_H265
Definition: codec_id.h:227
AV_CODEC_CAP_DELAY
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
Definition: codec.h:76
vulkan_encode_h265_close
static av_cold int vulkan_encode_h265_close(AVCodecContext *avctx)
Definition: vulkan_encode_h265.c:1694
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
vulkan_encode_h265_init
static av_cold int vulkan_encode_h265_init(AVCodecContext *avctx)
Definition: vulkan_encode_h265.c:1521
vulkan_encode_h265_options
static const AVOption vulkan_encode_h265_options[]
Definition: vulkan_encode_h265.c:1703