FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
vaapi_encode.h File Reference
#include <stdint.h>
#include <va/va.h>
#include "libavutil/hwcontext.h"
#include "libavutil/hwcontext_vaapi.h"
#include "libavutil/fifo.h"
#include "avcodec.h"
#include "hwconfig.h"

Go to the source code of this file.

Data Structures

struct  VAAPIEncodeSlice
 
struct  VAAPIEncodePicture
 
struct  VAAPIEncodeProfile
 
struct  VAAPIEncodeRCMode
 
struct  VAAPIEncodeContext
 
struct  VAAPIEncodeType
 

Macros

#define VAAPI_ENCODE_COMMON_OPTIONS
 
#define VAAPI_ENCODE_RC_MODE(name, desc)
 
#define VAAPI_ENCODE_RC_OPTIONS
 

Enumerations

enum  {
  MAX_CONFIG_ATTRIBUTES = 4, MAX_GLOBAL_PARAMS = 4, MAX_DPB_SIZE = 16, MAX_PICTURE_REFERENCES = 2,
  MAX_REORDER_DELAY = 16, MAX_PARAM_BUFFER_SIZE = 1024, MAX_TILE_ROWS = 22, MAX_TILE_COLS = 20,
  MAX_ASYNC_DEPTH = 64, MAX_REFERENCE_LIST_NUM = 2
}
 
enum  { PICTURE_TYPE_IDR = 0, PICTURE_TYPE_I = 1, PICTURE_TYPE_P = 2, PICTURE_TYPE_B = 3 }
 
enum  {
  RC_MODE_AUTO, RC_MODE_CQP, RC_MODE_CBR, RC_MODE_VBR,
  RC_MODE_ICQ, RC_MODE_QVBR, RC_MODE_AVBR, RC_MODE_MAX = RC_MODE_AVBR
}
 
enum  {
  FLAG_SLICE_CONTROL = 1 << 0, FLAG_CONSTANT_QUALITY_ONLY = 1 << 1, FLAG_INTRA_ONLY = 1 << 2, FLAG_B_PICTURES = 1 << 3,
  FLAG_B_PICTURE_REFERENCES = 1 << 4, FLAG_NON_IDR_KEY_PICTURES = 1 << 5, FLAG_TIMESTAMP_NO_DELAY = 1 << 6
}
 

Functions

int ff_vaapi_encode_receive_packet (AVCodecContext *avctx, AVPacket *pkt)
 
int ff_vaapi_encode_init (AVCodecContext *avctx)
 
int ff_vaapi_encode_close (AVCodecContext *avctx)
 

Variables

const AVCodecHWConfigInternal *const ff_vaapi_encode_hw_configs []
 

Macro Definition Documentation

◆ VAAPI_ENCODE_COMMON_OPTIONS

#define VAAPI_ENCODE_COMMON_OPTIONS
Value:
{ "low_power", \
"Use low-power encoding mode (only available on some platforms; " \
"may not support all encoding features)", \
OFFSET(common.low_power), AV_OPT_TYPE_BOOL, \
{ .i64 = 0 }, 0, 1, FLAGS }, \
{ "idr_interval", \
"Distance (in I-frames) between IDR frames", \
OFFSET(common.idr_interval), AV_OPT_TYPE_INT, \
{ .i64 = 0 }, 0, INT_MAX, FLAGS }, \
{ "b_depth", \
"Maximum B-frame reference depth", \
OFFSET(common.desired_b_depth), AV_OPT_TYPE_INT, \
{ .i64 = 1 }, 1, INT_MAX, FLAGS }, \
{ "async_depth", "Maximum processing parallelism. " \
"Increase this to improve single channel performance. This option " \
"doesn't work if driver doesn't implement vaSyncBuffer function.", \
OFFSET(common.async_depth), AV_OPT_TYPE_INT, \
{ .i64 = 2 }, 1, MAX_ASYNC_DEPTH, FLAGS }, \
{ "max_frame_size", \
"Maximum frame size (in bytes)",\
OFFSET(common.max_frame_size), AV_OPT_TYPE_INT, \
{ .i64 = 0 }, 0, INT_MAX, FLAGS }

Definition at line 505 of file vaapi_encode.h.

◆ VAAPI_ENCODE_RC_MODE

#define VAAPI_ENCODE_RC_MODE (   name,
  desc 
)
Value:
{ #name, desc, 0, AV_OPT_TYPE_CONST, { .i64 = RC_MODE_ ## name }, \
0, 0, FLAGS, .unit = "rc_mode" }

Definition at line 529 of file vaapi_encode.h.

◆ VAAPI_ENCODE_RC_OPTIONS

#define VAAPI_ENCODE_RC_OPTIONS
Value:
{ "rc_mode",\
"Set rate control mode", \
OFFSET(common.explicit_rc_mode), AV_OPT_TYPE_INT, \
{ .i64 = RC_MODE_AUTO }, RC_MODE_AUTO, RC_MODE_MAX, FLAGS, .unit = "rc_mode" }, \
{ "auto", "Choose mode automatically based on other parameters", \
0, AV_OPT_TYPE_CONST, { .i64 = RC_MODE_AUTO }, 0, 0, FLAGS, .unit = "rc_mode" }, \
VAAPI_ENCODE_RC_MODE(CQP, "Constant-quality"), \
VAAPI_ENCODE_RC_MODE(CBR, "Constant-bitrate"), \
VAAPI_ENCODE_RC_MODE(VBR, "Variable-bitrate"), \
VAAPI_ENCODE_RC_MODE(ICQ, "Intelligent constant-quality"), \
VAAPI_ENCODE_RC_MODE(QVBR, "Quality-defined variable-bitrate"), \
VAAPI_ENCODE_RC_MODE(AVBR, "Average variable-bitrate"), \
{ "blbrc", \
"Block level based bitrate control",\
OFFSET(common.blbrc), AV_OPT_TYPE_BOOL, \
{ .i64 = 0 }, 0, 1, FLAGS }

Definition at line 532 of file vaapi_encode.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MAX_CONFIG_ATTRIBUTES 
MAX_GLOBAL_PARAMS 
MAX_DPB_SIZE 
MAX_PICTURE_REFERENCES 
MAX_REORDER_DELAY 
MAX_PARAM_BUFFER_SIZE 
MAX_TILE_ROWS 
MAX_TILE_COLS 
MAX_ASYNC_DEPTH 
MAX_REFERENCE_LIST_NUM 

Definition at line 40 of file vaapi_encode.h.

◆ anonymous enum

anonymous enum
Enumerator
PICTURE_TYPE_IDR 
PICTURE_TYPE_I 
PICTURE_TYPE_P 
PICTURE_TYPE_B 

Definition at line 57 of file vaapi_encode.h.

◆ anonymous enum

anonymous enum
Enumerator
RC_MODE_AUTO 
RC_MODE_CQP 
RC_MODE_CBR 
RC_MODE_VBR 
RC_MODE_ICQ 
RC_MODE_QVBR 
RC_MODE_AVBR 
RC_MODE_MAX 

Definition at line 165 of file vaapi_encode.h.

◆ anonymous enum

anonymous enum
Enumerator
FLAG_SLICE_CONTROL 
FLAG_CONSTANT_QUALITY_ONLY 
FLAG_INTRA_ONLY 
FLAG_B_PICTURES 
FLAG_B_PICTURE_REFERENCES 
FLAG_NON_IDR_KEY_PICTURES 
FLAG_TIMESTAMP_NO_DELAY 

Definition at line 400 of file vaapi_encode.h.

Function Documentation

◆ ff_vaapi_encode_receive_packet()

int ff_vaapi_encode_receive_packet ( AVCodecContext avctx,
AVPacket pkt 
)

if no B frame before repeat P frame, sent repeat P frame out.

loop to get an available pkt in encoder flushing.

Definition at line 1396 of file vaapi_encode.c.

◆ ff_vaapi_encode_init()

int ff_vaapi_encode_init ( AVCodecContext avctx)

◆ ff_vaapi_encode_close()

int ff_vaapi_encode_close ( AVCodecContext avctx)

Variable Documentation

◆ ff_vaapi_encode_hw_configs

const AVCodecHWConfigInternal* const ff_vaapi_encode_hw_configs[]

Definition at line 35 of file vaapi_encode.c.

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
RC_MODE_MAX
@ RC_MODE_MAX
Definition: vaapi_encode.h:173
MAX_ASYNC_DEPTH
@ MAX_ASYNC_DEPTH
Definition: vaapi_encode.h:51
FLAGS
#define FLAGS
Definition: cmdutils.c:584
CBR
@ CBR
Definition: af_afade.c:61
RC_MODE_AUTO
@ RC_MODE_AUTO
Definition: vaapi_encode.h:166
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
desc
const char * desc
Definition: libsvtav1.c:75
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:251
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:244