FFmpeg
Data Structures | Macros | Typedefs | Functions | Variables
vulkan_encode.h File Reference
#include "codec_id.h"
#include "internal.h"
#include "encode.h"
#include "hwconfig.h"
#include "vulkan_video.h"
#include "hw_base_encode.h"

Go to the source code of this file.

Data Structures

struct  FFVulkanEncodeDescriptor
 
struct  FFVulkanEncodePicture
 
struct  FFVulkanCodec
 
struct  FFVkEncodeCommonOptions
 
struct  FFVulkanEncodeContext
 

Macros

#define VK_ENC_FLAG_NO_DELAY   1 << 6
 
#define FF_VK_RC_MODE_AUTO   0xFFFFFFFF
 
#define VULKAN_ENCODE_COMMON_OPTIONS
 

Typedefs

typedef int(* vkenc_cb_write_stream_headers) (AVCodecContext *avctx, uint8_t *data, size_t *data_len)
 Callback for writing stream-level headers. More...
 
typedef int(* vkenc_cb_init_pic_headers) (AVCodecContext *avctx, FFVulkanEncodePicture *pic)
 Callback for initializing codec-specific picture headers. More...
 
typedef int(* vkenc_cb_write_filler) (AVCodecContext *avctx, uint32_t filler, uint8_t *data, size_t *data_len)
 Callback for writing alignment data. More...
 
typedef int(* vkenc_cb_write_extra_headers) (AVCodecContext *avctx, FFVulkanEncodePicture *pic, uint8_t *data, size_t *data_len)
 Callback for writing any extra units requested. More...
 

Functions

av_cold int ff_vulkan_encode_init (AVCodecContext *avctx, FFVulkanEncodeContext *ctx, const FFVulkanEncodeDescriptor *vk_desc, const FFVulkanCodec *codec, void *codec_caps, void *quality_pnext)
 Initialize encoder. More...
 
av_cold int ff_vulkan_write_global_header (AVCodecContext *avctx, FFVulkanEncodeContext *ctx)
 Write out the extradata in case its needed. More...
 
int ff_vulkan_encode_receive_packet (AVCodecContext *avctx, AVPacket *pkt)
 Encode. More...
 
void ff_vulkan_encode_uninit (FFVulkanEncodeContext *ctx)
 Uninitialize encoder. More...
 
int ff_vulkan_encode_create_session_params (AVCodecContext *avctx, FFVulkanEncodeContext *ctx, void *codec_params_pnext)
 Create session parameters. More...
 

Variables

const AVCodecHWConfigInternal *const ff_vulkan_encode_hw_configs []
 Paperwork. More...
 

Macro Definition Documentation

◆ VK_ENC_FLAG_NO_DELAY

#define VK_ENC_FLAG_NO_DELAY   1 << 6

Definition at line 97 of file vulkan_encode.h.

◆ FF_VK_RC_MODE_AUTO

#define FF_VK_RC_MODE_AUTO   0xFFFFFFFF

Definition at line 162 of file vulkan_encode.h.

◆ VULKAN_ENCODE_COMMON_OPTIONS

#define VULKAN_ENCODE_COMMON_OPTIONS
Value:
{ "qp", "Use an explicit constant quantizer for the whole stream", OFFSET(common.opts.qp), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 255, FLAGS }, \
{ "quality", "Set encode quality (trades off against speed, higher is faster)", OFFSET(common.opts.quality), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS }, \
{ "rc_mode", "Select rate control type", OFFSET(common.opts.rc_mode), AV_OPT_TYPE_INT, { .i64 = FF_VK_RC_MODE_AUTO }, 0, FF_VK_RC_MODE_AUTO, FLAGS, "rc_mode" }, \
{ "auto", "Choose mode automatically based on parameters", 0, AV_OPT_TYPE_CONST, { .i64 = FF_VK_RC_MODE_AUTO }, INT_MIN, INT_MAX, FLAGS, "rc_mode" }, \
{ "driver", "Driver-specific rate control", 0, AV_OPT_TYPE_CONST, { .i64 = VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DEFAULT_KHR }, INT_MIN, INT_MAX, FLAGS, "rc_mode" }, \
{ "cqp", "Constant quantizer mode", 0, AV_OPT_TYPE_CONST, { .i64 = VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR }, INT_MIN, INT_MAX, FLAGS, "rc_mode" }, \
{ "cbr", "Constant bitrate mode", 0, AV_OPT_TYPE_CONST, { .i64 = VK_VIDEO_ENCODE_RATE_CONTROL_MODE_CBR_BIT_KHR }, INT_MIN, INT_MAX, FLAGS, "rc_mode" }, \
{ "vbr", "Variable bitrate mode", 0, AV_OPT_TYPE_CONST, { .i64 = VK_VIDEO_ENCODE_RATE_CONTROL_MODE_VBR_BIT_KHR }, INT_MIN, INT_MAX, FLAGS, "rc_mode" }, \
{ "tune", "Select tuning type", OFFSET(common.opts.tune), AV_OPT_TYPE_INT, { .i64 = VK_VIDEO_ENCODE_TUNING_MODE_DEFAULT_KHR }, 0, INT_MAX, FLAGS, "tune" }, \
{ "default", "Default tuning", 0, AV_OPT_TYPE_CONST, { .i64 = VK_VIDEO_ENCODE_TUNING_MODE_DEFAULT_KHR }, INT_MIN, INT_MAX, FLAGS, "tune" }, \
{ "hq", "High quality tuning", 0, AV_OPT_TYPE_CONST, { .i64 = VK_VIDEO_ENCODE_TUNING_MODE_HIGH_QUALITY_KHR }, INT_MIN, INT_MAX, FLAGS, "tune" }, \
{ "ll", "Low-latency tuning", 0, AV_OPT_TYPE_CONST, { .i64 = VK_VIDEO_ENCODE_TUNING_MODE_LOW_LATENCY_KHR }, INT_MIN, INT_MAX, FLAGS, "tune" }, \
{ "ull", "Ultra low-latency tuning", 0, AV_OPT_TYPE_CONST, { .i64 = VK_VIDEO_ENCODE_TUNING_MODE_ULTRA_LOW_LATENCY_KHR }, INT_MIN, INT_MAX, FLAGS, "tune" }, \
{ "lossless", "Lossless mode tuning", 0, AV_OPT_TYPE_CONST, { .i64 = VK_VIDEO_ENCODE_TUNING_MODE_LOSSLESS_KHR }, INT_MIN, INT_MAX, FLAGS, "tune" }, \
{ "usage", "Select usage type", OFFSET(common.opts.usage), AV_OPT_TYPE_FLAGS, { .i64 = VK_VIDEO_ENCODE_USAGE_DEFAULT_KHR }, 0, INT_MAX, FLAGS, "usage" }, \
{ "default", "Default optimizations", 0, AV_OPT_TYPE_CONST, { .i64 = VK_VIDEO_ENCODE_USAGE_DEFAULT_KHR }, INT_MIN, INT_MAX, FLAGS, "usage" }, \
{ "transcode", "Optimize for transcoding", 0, AV_OPT_TYPE_CONST, { .i64 = VK_VIDEO_ENCODE_USAGE_TRANSCODING_BIT_KHR }, INT_MIN, INT_MAX, FLAGS, "usage" }, \
{ "stream", "Optimize for streaming", 0, AV_OPT_TYPE_CONST, { .i64 = VK_VIDEO_ENCODE_USAGE_STREAMING_BIT_KHR }, INT_MIN, INT_MAX, FLAGS, "usage" }, \
{ "record", "Optimize for offline recording", 0, AV_OPT_TYPE_CONST, { .i64 = VK_VIDEO_ENCODE_USAGE_RECORDING_BIT_KHR }, INT_MIN, INT_MAX, FLAGS, "usage" }, \
{ "conference", "Optimize for teleconferencing", 0, AV_OPT_TYPE_CONST, { .i64 = VK_VIDEO_ENCODE_USAGE_CONFERENCING_BIT_KHR }, INT_MIN, INT_MAX, FLAGS, "usage" }, \
{ "content", "Select content type", OFFSET(common.opts.content), AV_OPT_TYPE_FLAGS, { .i64 = VK_VIDEO_ENCODE_CONTENT_DEFAULT_KHR }, 0, INT_MAX, FLAGS, "content" }, \
{ "default", "Default content", 0, AV_OPT_TYPE_CONST, { .i64 = VK_VIDEO_ENCODE_CONTENT_DEFAULT_KHR }, INT_MIN, INT_MAX, FLAGS, "content" }, \
{ "camera", "Camera footage", 0, AV_OPT_TYPE_CONST, { .i64 = VK_VIDEO_ENCODE_CONTENT_CAMERA_BIT_KHR }, INT_MIN, INT_MAX, FLAGS, "content" }, \
{ "desktop", "Screen recording", 0, AV_OPT_TYPE_CONST, { .i64 = VK_VIDEO_ENCODE_CONTENT_DESKTOP_BIT_KHR }, INT_MIN, INT_MAX, FLAGS, "content" }, \
{ "rendered", "Game or 3D content", 0, AV_OPT_TYPE_CONST, { .i64 = VK_VIDEO_ENCODE_CONTENT_RENDERED_BIT_KHR }, INT_MIN, INT_MAX, FLAGS, "content" }

Definition at line 197 of file vulkan_encode.h.

Typedef Documentation

◆ vkenc_cb_write_stream_headers

typedef int(* vkenc_cb_write_stream_headers) (AVCodecContext *avctx, uint8_t *data, size_t *data_len)

Callback for writing stream-level headers.

Definition at line 65 of file vulkan_encode.h.

◆ vkenc_cb_init_pic_headers

typedef int(* vkenc_cb_init_pic_headers) (AVCodecContext *avctx, FFVulkanEncodePicture *pic)

Callback for initializing codec-specific picture headers.

Definition at line 71 of file vulkan_encode.h.

◆ vkenc_cb_write_filler

typedef int(* vkenc_cb_write_filler) (AVCodecContext *avctx, uint32_t filler, uint8_t *data, size_t *data_len)

Callback for writing alignment data.

Align is the value to align offset to.

Definition at line 78 of file vulkan_encode.h.

◆ vkenc_cb_write_extra_headers

typedef int(* vkenc_cb_write_extra_headers) (AVCodecContext *avctx, FFVulkanEncodePicture *pic, uint8_t *data, size_t *data_len)

Callback for writing any extra units requested.

data_len must be set to the available size, and its value will be overwritten by the #bytes written to the output buffer.

Definition at line 86 of file vulkan_encode.h.

Function Documentation

◆ ff_vulkan_encode_init()

av_cold int ff_vulkan_encode_init ( AVCodecContext avctx,
FFVulkanEncodeContext ctx,
const FFVulkanEncodeDescriptor vk_desc,
const FFVulkanCodec codec,
void *  codec_caps,
void *  quality_pnext 
)

Initialize encoder.

Definition at line 701 of file vulkan_encode.c.

Referenced by vulkan_encode_h264_init(), and vulkan_encode_h265_init().

◆ ff_vulkan_write_global_header()

av_cold int ff_vulkan_write_global_header ( AVCodecContext avctx,
FFVulkanEncodeContext ctx 
)

Write out the extradata in case its needed.

Definition at line 671 of file vulkan_encode.c.

Referenced by vulkan_encode_h264_init(), and vulkan_encode_h265_init().

◆ ff_vulkan_encode_receive_packet()

int ff_vulkan_encode_receive_packet ( AVCodecContext avctx,
AVPacket pkt 
)

Encode.

Definition at line 541 of file vulkan_encode.c.

◆ ff_vulkan_encode_uninit()

void ff_vulkan_encode_uninit ( FFVulkanEncodeContext ctx)

Uninitialize encoder.

Definition at line 31 of file vulkan_encode.c.

Referenced by vulkan_encode_h264_close(), and vulkan_encode_h265_close().

◆ ff_vulkan_encode_create_session_params()

int ff_vulkan_encode_create_session_params ( AVCodecContext avctx,
FFVulkanEncodeContext ctx,
void *  codec_params_pnext 
)

Create session parameters.

Definition at line 1026 of file vulkan_encode.c.

Referenced by create_session_params().

Variable Documentation

◆ ff_vulkan_encode_hw_configs

const AVCodecHWConfigInternal* const ff_vulkan_encode_hw_configs[]

Paperwork.

Definition at line 26 of file vulkan_encode.c.

FLAGS
#define FLAGS
Definition: cmdutils.c:593
OFFSET
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 keep it simple and lowercase description are in without and describe what they for example set the foo of the bar offset is the offset of the field in your see the OFFSET() macro
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
FF_VK_RC_MODE_AUTO
#define FF_VK_RC_MODE_AUTO
Definition: vulkan_encode.h:162
AV_OPT_TYPE_FLAGS
@ AV_OPT_TYPE_FLAGS
Underlying C type is unsigned int.
Definition: opt.h:255
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299