qsv: Support explicit lookahead downscaling

This commit is contained in:
Luca Barbato 2017-12-12 14:27:52 +00:00
parent f2e9a0ecbe
commit 5083785566
2 changed files with 17 additions and 0 deletions

View File

@ -604,6 +604,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
q->extco2.Trellis = q->trellis;
#endif
#if QSV_HAVE_LA_DS
q->extco2.LookAheadDS = q->la_ds;
#endif
#if QSV_HAVE_BREF_TYPE
#if FF_API_PRIVATE_OPT
FF_DISABLE_DEPRECATION_WARNINGS

View File

@ -42,6 +42,7 @@
#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)
#if defined(_WIN32)
@ -54,6 +55,12 @@
#define QSV_HAVE_QVBR 0
#endif
#if !QSV_HAVE_LA_DS
#define MFX_LOOKAHEAD_DS_OFF 0
#define MFX_LOOKAHEAD_DS_2x 0
#define MFX_LOOKAHEAD_DS_4x 0
#endif
#define QSV_COMMON_OPTS \
{ "async_depth", "Maximum processing parallelism", OFFSET(qsv.async_depth), AV_OPT_TYPE_INT, { .i64 = ASYNC_DEPTH_DEFAULT }, 0, INT_MAX, VE }, \
{ "avbr_accuracy", "Accuracy of the AVBR ratecontrol", OFFSET(qsv.avbr_accuracy), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE }, \
@ -64,6 +71,11 @@
{ "slow", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_TARGETUSAGE_BEST_QUALITY }, INT_MIN, INT_MAX, VE, "preset" }, \
{ "la_depth", "Number of frames to analyze before encoding.", OFFSET(qsv.la_depth), AV_OPT_TYPE_INT, { .i64 = 9 }, 9, 100, VE, "la_depth" }, \
{ "unset", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 9 }, INT_MIN, INT_MAX, VE, "la_depth" }, \
{ "la_ds", "Downscaling factor for the frames saved for the lookahead analysis", OFFSET(qsv.la_ds), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, MFX_LOOKAHEAD_DS_4x, VE, "la_ds" }, \
{ "auto", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = -1 }, INT_MIN, INT_MAX, VE, "la_ds" }, \
{ "off", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_LOOKAHEAD_DS_OFF }, INT_MIN, INT_MAX, VE, "la_ds" }, \
{ "2x", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_LOOKAHEAD_DS_2x }, INT_MIN, INT_MAX, VE, "la_ds" }, \
{ "4x", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_LOOKAHEAD_DS_4x }, INT_MIN, INT_MAX, VE, "la_ds" }, \
{ "vcm", "Use the video conferencing mode ratecontrol", OFFSET(qsv.vcm), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE }, \
{ "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 }, \
@ -116,6 +128,7 @@ typedef struct QSVEncContext {
int avbr_accuracy;
int avbr_convergence;
int la_depth;
int la_ds;
int vcm;
int rdo;
int max_frame_size;