Go to the documentation of this file.
23 #ifndef AVCODEC_D3D12VA_ENCODE_H
24 #define AVCODEC_D3D12VA_ENCODE_H
39 #define MAX_PARAM_BUFFER_SIZE 4096
40 #define D3D12VA_VIDEO_ENC_ASYNC_DEPTH 8
55 D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA
pic_ctl;
234 D3D12_FEATURE_DATA_VIDEO_ENCODER_RESOURCE_REQUIREMENTS
req;
236 D3D12_FEATURE_DATA_VIDEO_ENCODER_RESOLUTION_SUPPORT_LIMITS
res_limits;
245 D3D12_VIDEO_ENCODER_RATE_CONTROL
rc;
247 D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE
gop;
249 D3D12_VIDEO_ENCODER_LEVEL_SETTING
level;
312 char *
data,
size_t *data_len);
320 #define D3D12VA_ENCODE_RC_MODE(name, desc) \
321 { #name, desc, 0, AV_OPT_TYPE_CONST, { .i64 = RC_MODE_ ## name }, \
322 0, 0, FLAGS, .unit = "rc_mode" }
323 #define D3D12VA_ENCODE_RC_OPTIONS \
325 "Set rate control mode", \
326 OFFSET(common.explicit_rc_mode), AV_OPT_TYPE_INT, \
327 { .i64 = RC_MODE_AUTO }, RC_MODE_AUTO, RC_MODE_MAX, FLAGS, .unit = "rc_mode" }, \
328 { "auto", "Choose mode automatically based on other parameters", \
329 0, AV_OPT_TYPE_CONST, { .i64 = RC_MODE_AUTO }, 0, 0, FLAGS, .unit = "rc_mode" }, \
330 D3D12VA_ENCODE_RC_MODE(CQP, "Constant-quality"), \
331 D3D12VA_ENCODE_RC_MODE(CBR, "Constant-bitrate"), \
332 D3D12VA_ENCODE_RC_MODE(VBR, "Variable-bitrate"), \
333 D3D12VA_ENCODE_RC_MODE(QVBR, "Quality-defined variable-bitrate")
int mode
Mode from above enum (RC_MODE_*).
int(* init_sequence_params)(AVCodecContext *avctx)
Fill the corresponding parameters.
D3D12_VIDEO_ENCODER_PROFILE_DESC d3d12_profile
D3D12 profile value.
D3D12_VIDEO_ENCODER_CODEC d3d12_codec
D3D12 codec name.
int(* init_picture_params)(AVCodecContext *avctx, FFHWBaseEncodePicture *base_pic)
ID3D12VideoEncoderHeap * encoder_heap
D3D12 video encoder heap.
AVD3D12VAFrame * input_surface
D3D12_FEATURE_DATA_VIDEO_ENCODER_RESOURCE_REQUIREMENTS req
D3D12_FEATURE structures.
int explicit_rc_mode
Explicitly set RC mode (otherwise attempt to pick from available modes).
D3D12_VIDEO_ENCODER_RATE_CONTROL_MODE d3d12_mode
D3D12 mode value.
AVBufferRef * encoder_ref
D3D12 video encoder.
int maxrate
Supports maxrate distinct from bitrate.
ID3D12VideoEncoder * encoder
int(* configure)(AVCodecContext *avctx)
Perform any extra codec-specific configuration.
AVD3D12VASyncContext sync_ctx
The sync context used to sync command queue.
D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC resolution
D3D12_VIDEO_ENCODER structures.
int quality
Uses quality value.
ID3D12Resource * resolved_metadata
AVBufferRef * output_buffer_ref
int rc_quality
RC quality level - meaning depends on codec and RC mode.
ID3D12Resource * output_buffer
AVD3D12VADeviceContext * hwctx
AVD3D12VAFrame * recon_surface
int ff_d3d12va_encode_close(AVCodecContext *avctx)
int bi_not_empty
The bi_not_empty feature.
int default_quality
Default quality for this codec - used as quantiser or RC quality factor depending on RC mode.
int bitrate
Uses bitrate parameters.
void(* free_picture_params)(D3D12VAEncodePicture *pic)
int log2_chroma_w
Chroma subsampling in width dimension.
int ff_d3d12va_encode_init(AVCodecContext *avctx)
size_t picture_priv_data_size
The size of any private data structure associated with each picture (can be zero if not required).
int nb_components
Number of components.
D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA pic_ctl
This struct is used to sync d3d12 execution.
ID3D12Device3 * device3
ID3D12Device3 interface.
FFHWBaseEncodeContext base
const D3D12VAEncodeProfile * profile
Chosen encoding profile details.
int flags
Codec feature flags.
D3D12_VIDEO_ENCODER_RATE_CONTROL rc
AVFifo * allocator_queue
A cached queue for reusing the D3D12 command allocators.
D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION codec_conf
D3D12_FEATURE_DATA_VIDEO_ENCODER_RESOLUTION_SUPPORT_LIMITS res_limits
const struct D3D12VAEncodeType * codec
Codec-specific hooks.
const AVCodecHWConfigInternal *const ff_d3d12va_encode_hw_configs[]
D3D12VA frame descriptor for pool allocation.
ID3D12Resource * encoded_metadata
D3D12_VIDEO_ENCODER_LEVEL_SETTING level
int ff_d3d12va_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
This struct is allocated as AVHWDeviceContext.hwctx.
int log2_chroma_h
Chroma subsampling in height dimension.
int hrd
Supports HRD/VBV parameters.
int(* write_sequence_header)(AVCodecContext *avctx, char *data, size_t *data_len)
Write the packed header data to the provided buffer.
int av_profile
lavc profile value (AV_PROFILE_*).
ID3D12VideoEncodeCommandList2 * command_list
D3D12 video encode command list.
int(* get_encoder_caps)(AVCodecContext *avctx)
Query codec configuration and determine encode parameters like block sizes for surface alignment and ...
ID3D12CommandQueue * command_queue
D3D12 command queue.
int(* set_level)(AVCodecContext *avctx)
Set codec-specific level setting.
main external API structure.
ID3D12VideoDevice3 * video_device3
ID3D12VideoDevice3 interface.
AVBufferPool * output_buffer_pool
Pool of (reusable) bitstream output buffers.
int depth
Supported bit depth.
D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE gop
A reference to a data buffer.
This structure stores compressed data.
const D3D12VAEncodeProfile * profiles
List of supported profiles.
int explicit_qp
Explicitly-set QP, for use with the "qp" options.