FFmpeg
Data Structures | Macros | Typedefs | Functions | Variables
qsvenc.h File Reference
#include <stdint.h>
#include <sys/types.h>
#include <mfx/mfxvideo.h>
#include "libavutil/avutil.h"
#include "libavutil/fifo.h"
#include "avcodec.h"
#include "hwconfig.h"
#include "qsv_internal.h"

Go to the source code of this file.

Data Structures

struct  QSVEncContext
 

Macros

#define QSV_HAVE_CO2   QSV_VERSION_ATLEAST(1, 6)
 
#define QSV_HAVE_CO3   QSV_VERSION_ATLEAST(1, 11)
 
#define QSV_HAVE_CO_VPS   QSV_VERSION_ATLEAST(1, 17)
 
#define QSV_HAVE_EXT_HEVC_TILES   QSV_VERSION_ATLEAST(1, 13)
 
#define QSV_HAVE_EXT_VP9_PARAM   QSV_VERSION_ATLEAST(1, 26)
 
#define QSV_HAVE_TRELLIS   QSV_VERSION_ATLEAST(1, 8)
 
#define QSV_HAVE_MAX_SLICE_SIZE   QSV_VERSION_ATLEAST(1, 9)
 
#define QSV_HAVE_BREF_TYPE   QSV_VERSION_ATLEAST(1, 8)
 
#define QSV_HAVE_LA   QSV_VERSION_ATLEAST(1, 7)
 
#define QSV_HAVE_LA_DS   QSV_VERSION_ATLEAST(1, 8)
 
#define QSV_HAVE_LA_HRD   QSV_VERSION_ATLEAST(1, 11)
 
#define QSV_HAVE_VDENC   QSV_VERSION_ATLEAST(1, 15)
 
#define QSV_HAVE_GPB   QSV_VERSION_ATLEAST(1, 18)
 
#define QSV_HAVE_AVBR   0
 
#define QSV_HAVE_ICQ   QSV_VERSION_ATLEAST(1, 28)
 
#define QSV_HAVE_VCM   0
 
#define QSV_HAVE_QVBR   QSV_VERSION_ATLEAST(1, 28)
 
#define QSV_HAVE_MF   QSV_VERSION_ATLEAST(1, 25)
 
#define MFX_LOOKAHEAD_DS_UNKNOWN   0
 
#define MFX_LOOKAHEAD_DS_OFF   0
 
#define MFX_LOOKAHEAD_DS_2x   0
 
#define MFX_LOOKAHEAD_DS_4x   0
 
#define QSV_COMMON_OPTS
 

Typedefs

typedef int SetEncodeCtrlCB(AVCodecContext *avctx, const AVFrame *frame, mfxEncodeCtrl *enc_ctrl)
 

Functions

int ff_qsv_enc_init (AVCodecContext *avctx, QSVEncContext *q)
 
int ff_qsv_encode (AVCodecContext *avctx, QSVEncContext *q, AVPacket *pkt, const AVFrame *frame, int *got_packet)
 
int ff_qsv_enc_close (AVCodecContext *avctx, QSVEncContext *q)
 

Variables

const AVCodecHWConfigInternalff_qsv_enc_hw_configs []
 

Macro Definition Documentation

◆ QSV_HAVE_CO2

#define QSV_HAVE_CO2   QSV_VERSION_ATLEAST(1, 6)

Definition at line 38 of file qsvenc.h.

◆ QSV_HAVE_CO3

#define QSV_HAVE_CO3   QSV_VERSION_ATLEAST(1, 11)

Definition at line 39 of file qsvenc.h.

◆ QSV_HAVE_CO_VPS

#define QSV_HAVE_CO_VPS   QSV_VERSION_ATLEAST(1, 17)

Definition at line 40 of file qsvenc.h.

◆ QSV_HAVE_EXT_HEVC_TILES

#define QSV_HAVE_EXT_HEVC_TILES   QSV_VERSION_ATLEAST(1, 13)

Definition at line 42 of file qsvenc.h.

◆ QSV_HAVE_EXT_VP9_PARAM

#define QSV_HAVE_EXT_VP9_PARAM   QSV_VERSION_ATLEAST(1, 26)

Definition at line 43 of file qsvenc.h.

◆ QSV_HAVE_TRELLIS

#define QSV_HAVE_TRELLIS   QSV_VERSION_ATLEAST(1, 8)

Definition at line 45 of file qsvenc.h.

◆ QSV_HAVE_MAX_SLICE_SIZE

#define QSV_HAVE_MAX_SLICE_SIZE   QSV_VERSION_ATLEAST(1, 9)

Definition at line 46 of file qsvenc.h.

◆ QSV_HAVE_BREF_TYPE

#define QSV_HAVE_BREF_TYPE   QSV_VERSION_ATLEAST(1, 8)

Definition at line 47 of file qsvenc.h.

◆ QSV_HAVE_LA

#define QSV_HAVE_LA   QSV_VERSION_ATLEAST(1, 7)

Definition at line 49 of file qsvenc.h.

◆ QSV_HAVE_LA_DS

#define QSV_HAVE_LA_DS   QSV_VERSION_ATLEAST(1, 8)

Definition at line 50 of file qsvenc.h.

◆ QSV_HAVE_LA_HRD

#define QSV_HAVE_LA_HRD   QSV_VERSION_ATLEAST(1, 11)

Definition at line 51 of file qsvenc.h.

◆ QSV_HAVE_VDENC

#define QSV_HAVE_VDENC   QSV_VERSION_ATLEAST(1, 15)

Definition at line 52 of file qsvenc.h.

◆ QSV_HAVE_GPB

#define QSV_HAVE_GPB   QSV_VERSION_ATLEAST(1, 18)

Definition at line 54 of file qsvenc.h.

◆ QSV_HAVE_AVBR

#define QSV_HAVE_AVBR   0

Definition at line 63 of file qsvenc.h.

◆ QSV_HAVE_ICQ

#define QSV_HAVE_ICQ   QSV_VERSION_ATLEAST(1, 28)

Definition at line 64 of file qsvenc.h.

◆ QSV_HAVE_VCM

#define QSV_HAVE_VCM   0

Definition at line 65 of file qsvenc.h.

◆ QSV_HAVE_QVBR

#define QSV_HAVE_QVBR   QSV_VERSION_ATLEAST(1, 28)

Definition at line 66 of file qsvenc.h.

◆ QSV_HAVE_MF

#define QSV_HAVE_MF   QSV_VERSION_ATLEAST(1, 25)

Definition at line 67 of file qsvenc.h.

◆ MFX_LOOKAHEAD_DS_UNKNOWN

#define MFX_LOOKAHEAD_DS_UNKNOWN   0

Definition at line 71 of file qsvenc.h.

◆ MFX_LOOKAHEAD_DS_OFF

#define MFX_LOOKAHEAD_DS_OFF   0

Definition at line 72 of file qsvenc.h.

◆ MFX_LOOKAHEAD_DS_2x

#define MFX_LOOKAHEAD_DS_2x   0

Definition at line 73 of file qsvenc.h.

◆ MFX_LOOKAHEAD_DS_4x

#define MFX_LOOKAHEAD_DS_4x   0

Definition at line 74 of file qsvenc.h.

◆ QSV_COMMON_OPTS

#define QSV_COMMON_OPTS
Value:
{ "async_depth", "Maximum processing parallelism", OFFSET(qsv.async_depth), AV_OPT_TYPE_INT, { .i64 = ASYNC_DEPTH_DEFAULT }, 1, INT_MAX, VE }, \
{ "avbr_accuracy", "Accuracy of the AVBR ratecontrol", OFFSET(qsv.avbr_accuracy), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE }, \
{ "avbr_convergence", "Convergence of the AVBR ratecontrol", OFFSET(qsv.avbr_convergence), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE }, \
{ "preset", NULL, OFFSET(qsv.preset), AV_OPT_TYPE_INT, { .i64 = MFX_TARGETUSAGE_BALANCED }, MFX_TARGETUSAGE_BEST_QUALITY, MFX_TARGETUSAGE_BEST_SPEED, VE, "preset" }, \
{ "veryfast", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_TARGETUSAGE_BEST_SPEED }, INT_MIN, INT_MAX, VE, "preset" }, \
{ "faster", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_TARGETUSAGE_6 }, INT_MIN, INT_MAX, VE, "preset" }, \
{ "fast", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_TARGETUSAGE_5 }, INT_MIN, INT_MAX, VE, "preset" }, \
{ "medium", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_TARGETUSAGE_BALANCED }, INT_MIN, INT_MAX, VE, "preset" }, \
{ "slow", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_TARGETUSAGE_3 }, INT_MIN, INT_MAX, VE, "preset" }, \
{ "slower", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_TARGETUSAGE_2 }, INT_MIN, INT_MAX, VE, "preset" }, \
{ "veryslow", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_TARGETUSAGE_BEST_QUALITY }, INT_MIN, INT_MAX, VE, "preset" }, \
{ "rdo", "Enable rate distortion optimization", OFFSET(qsv.rdo), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, \
{ "max_frame_size", "Maximum encoded frame size in bytes", OFFSET(qsv.max_frame_size), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, UINT16_MAX, VE }, \
{ "max_slice_size", "Maximum encoded slice size in bytes", OFFSET(qsv.max_slice_size), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, UINT16_MAX, VE }, \
{ "bitrate_limit", "Toggle bitrate limitations", OFFSET(qsv.bitrate_limit), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, \
{ "mbbrc", "MB level bitrate control", OFFSET(qsv.mbbrc), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, \
{ "extbrc", "Extended bitrate control", OFFSET(qsv.extbrc), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, \
{ "adaptive_i", "Adaptive I-frame placement", OFFSET(qsv.adaptive_i), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, \
{ "adaptive_b", "Adaptive B-frame placement", OFFSET(qsv.adaptive_b), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, \
{ "b_strategy", "Strategy to choose between I/P/B-frames", OFFSET(qsv.b_strategy), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, \
{ "forced_idr", "Forcing I frames as IDR frames", OFFSET(qsv.forced_idr), AV_OPT_TYPE_BOOL,{ .i64 = 0 }, 0, 1, VE }, \
{ "low_power", "enable low power mode(experimental: many limitations by mfx version, BRC modes, etc.)", OFFSET(qsv.low_power), AV_OPT_TYPE_BOOL, { .i64 = 0}, 0, 1, VE},\

Definition at line 77 of file qsvenc.h.

Typedef Documentation

◆ SetEncodeCtrlCB

typedef int SetEncodeCtrlCB(AVCodecContext *avctx, const AVFrame *frame, mfxEncodeCtrl *enc_ctrl)

Definition at line 103 of file qsvenc.h.

Function Documentation

◆ ff_qsv_enc_init()

int ff_qsv_enc_init ( AVCodecContext avctx,
QSVEncContext q 
)

Definition at line 1101 of file qsvenc.c.

Referenced by qsv_enc_init().

◆ ff_qsv_encode()

int ff_qsv_encode ( AVCodecContext avctx,
QSVEncContext q,
AVPacket pkt,
const AVFrame frame,
int got_packet 
)

Definition at line 1521 of file qsvenc.c.

Referenced by qsv_enc_frame().

◆ ff_qsv_enc_close()

int ff_qsv_enc_close ( AVCodecContext avctx,
QSVEncContext q 
)

Definition at line 1613 of file qsvenc.c.

Referenced by qsv_enc_close(), and qsv_enc_init().

Variable Documentation

◆ ff_qsv_enc_hw_configs

const AVCodecHWConfigInternal* ff_qsv_enc_hw_configs[]

Definition at line 1659 of file qsvenc.c.

ASYNC_DEPTH_DEFAULT
#define ASYNC_DEPTH_DEFAULT
Definition: qsv_internal.h:49
NULL
#define NULL
Definition: coverity.c:32
VE
#define VE
Definition: amfenc_h264.c:26
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
Definition: opt.h:223
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:240
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:232