FFmpeg
Data Structures | Macros | Enumerations | Functions
hw_base_encode.h File Reference
#include "avcodec.h"
#include "libavutil/hwcontext.h"
#include "libavutil/fifo.h"

Go to the source code of this file.

Data Structures

struct  FFHWBaseEncodePicture
 
struct  FFHWEncodePictureOperation
 
struct  FFHWBaseEncodeContext
 

Macros

#define MAX_DPB_SIZE   16
 
#define MAX_PICTURE_REFERENCES   2
 
#define MAX_REORDER_DELAY   16
 
#define MAX_ASYNC_DEPTH   64
 
#define MAX_REFERENCE_LIST_NUM   2
 
#define HW_BASE_ENCODE_COMMON_OPTIONS
 

Enumerations

enum  { FF_HW_PICTURE_TYPE_IDR = 0, FF_HW_PICTURE_TYPE_I = 1, FF_HW_PICTURE_TYPE_P = 2, FF_HW_PICTURE_TYPE_B = 3 }
 
enum  {
  FF_HW_FLAG_SLICE_CONTROL = 1 << 0, FF_HW_FLAG_CONSTANT_QUALITY_ONLY = 1 << 1, FF_HW_FLAG_INTRA_ONLY = 1 << 2, FF_HW_FLAG_B_PICTURES = 1 << 3,
  FF_HW_FLAG_B_PICTURE_REFERENCES = 1 << 4, FF_HW_FLAG_NON_IDR_KEY_PICTURES = 1 << 5
}
 

Functions

static const char * ff_hw_base_encode_get_pictype_name (const int type)
 
int ff_hw_base_encode_set_output_property (FFHWBaseEncodeContext *ctx, AVCodecContext *avctx, FFHWBaseEncodePicture *pic, AVPacket *pkt, int flag_no_delay)
 
int ff_hw_base_encode_receive_packet (FFHWBaseEncodeContext *ctx, AVCodecContext *avctx, AVPacket *pkt)
 
int ff_hw_base_init_gop_structure (FFHWBaseEncodeContext *ctx, AVCodecContext *avctx, uint32_t ref_l0, uint32_t ref_l1, int flags, int prediction_pre_only)
 
int ff_hw_base_get_recon_format (FFHWBaseEncodeContext *ctx, const void *hwconfig, enum AVPixelFormat *fmt)
 
int ff_hw_base_encode_free (FFHWBaseEncodePicture *pic)
 
int ff_hw_base_encode_init (AVCodecContext *avctx, FFHWBaseEncodeContext *ctx)
 
int ff_hw_base_encode_close (FFHWBaseEncodeContext *ctx)
 

Macro Definition Documentation

◆ MAX_DPB_SIZE

#define MAX_DPB_SIZE   16

Definition at line 26 of file hw_base_encode.h.

◆ MAX_PICTURE_REFERENCES

#define MAX_PICTURE_REFERENCES   2

Definition at line 27 of file hw_base_encode.h.

◆ MAX_REORDER_DELAY

#define MAX_REORDER_DELAY   16

Definition at line 28 of file hw_base_encode.h.

◆ MAX_ASYNC_DEPTH

#define MAX_ASYNC_DEPTH   64

Definition at line 29 of file hw_base_encode.h.

◆ MAX_REFERENCE_LIST_NUM

#define MAX_REFERENCE_LIST_NUM   2

Definition at line 30 of file hw_base_encode.h.

◆ HW_BASE_ENCODE_COMMON_OPTIONS

#define HW_BASE_ENCODE_COMMON_OPTIONS
Value:
{ "idr_interval", \
"Distance (in I-frames) between key frames", \
OFFSET(common.base.idr_interval), AV_OPT_TYPE_INT, \
{ .i64 = 0 }, 0, INT_MAX, FLAGS }, \
{ "b_depth", \
"Maximum B-frame reference depth", \
OFFSET(common.base.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.", \
OFFSET(common.base.async_depth), AV_OPT_TYPE_INT, \
{ .i64 = 2 }, 1, MAX_ASYNC_DEPTH, FLAGS }

Definition at line 237 of file hw_base_encode.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
FF_HW_PICTURE_TYPE_IDR 
FF_HW_PICTURE_TYPE_I 
FF_HW_PICTURE_TYPE_P 
FF_HW_PICTURE_TYPE_B 

Definition at line 38 of file hw_base_encode.h.

◆ anonymous enum

anonymous enum
Enumerator
FF_HW_FLAG_SLICE_CONTROL 
FF_HW_FLAG_CONSTANT_QUALITY_ONLY 
FF_HW_FLAG_INTRA_ONLY 
FF_HW_FLAG_B_PICTURES 
FF_HW_FLAG_B_PICTURE_REFERENCES 
FF_HW_FLAG_NON_IDR_KEY_PICTURES 

Definition at line 45 of file hw_base_encode.h.

Function Documentation

◆ ff_hw_base_encode_get_pictype_name()

static const char* ff_hw_base_encode_get_pictype_name ( const int  type)
inlinestatic

Definition at line 32 of file hw_base_encode.h.

Referenced by d3d12va_encode_issue(), and vaapi_encode_issue().

◆ ff_hw_base_encode_set_output_property()

int ff_hw_base_encode_set_output_property ( FFHWBaseEncodeContext ctx,
AVCodecContext avctx,
FFHWBaseEncodePicture pic,
AVPacket pkt,
int  flag_no_delay 
)

Definition at line 486 of file hw_base_encode.c.

Referenced by d3d12va_encode_output(), and vaapi_encode_output().

◆ ff_hw_base_encode_receive_packet()

int ff_hw_base_encode_receive_packet ( FFHWBaseEncodeContext ctx,
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 525 of file hw_base_encode.c.

Referenced by ff_d3d12va_encode_receive_packet(), and ff_vaapi_encode_receive_packet().

◆ ff_hw_base_init_gop_structure()

int ff_hw_base_init_gop_structure ( FFHWBaseEncodeContext ctx,
AVCodecContext avctx,
uint32_t  ref_l0,
uint32_t  ref_l1,
int  flags,
int  prediction_pre_only 
)

◆ ff_hw_base_get_recon_format()

int ff_hw_base_get_recon_format ( FFHWBaseEncodeContext ctx,
const void *  hwconfig,
enum AVPixelFormat fmt 
)

◆ ff_hw_base_encode_free()

int ff_hw_base_encode_free ( FFHWBaseEncodePicture pic)

Definition at line 741 of file hw_base_encode.c.

Referenced by d3d12va_encode_free(), and vaapi_encode_free().

◆ ff_hw_base_encode_init()

int ff_hw_base_encode_init ( AVCodecContext avctx,
FFHWBaseEncodeContext ctx 
)

Definition at line 752 of file hw_base_encode.c.

Referenced by ff_d3d12va_encode_init(), and ff_vaapi_encode_init().

◆ ff_hw_base_encode_close()

int ff_hw_base_encode_close ( FFHWBaseEncodeContext ctx)

Definition at line 785 of file hw_base_encode.c.

Referenced by ff_d3d12va_encode_close(), and ff_vaapi_encode_close().

FLAGS
#define FLAGS
Definition: cmdutils.c:581
MAX_ASYNC_DEPTH
#define MAX_ASYNC_DEPTH
Definition: hw_base_encode.h:29
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:245