diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2017-12-12 14:27:52 +0000 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2017-12-12 15:43:02 +0000 |
commit | 508378556631dc18d32247b4a4e35703758e1ca9 (patch) | |
tree | b015843fc93aab6f7a5b0b6c456ee5825ede1f50 | |
parent | f2e9a0ecbef5027f9532c49ffcdfc11d199f6150 (diff) | |
download | ffmpeg-508378556631dc18d32247b4a4e35703758e1ca9.tar.gz |
qsv: Support explicit lookahead downscaling
-rw-r--r-- | libavcodec/qsvenc.c | 4 | ||||
-rw-r--r-- | libavcodec/qsvenc.h | 13 |
2 files changed, 17 insertions, 0 deletions
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 5eacf3ca88..24d9ec4d71 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -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 diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h index 7f11460d08..088a61de54 100644 --- a/libavcodec/qsvenc.h +++ b/libavcodec/qsvenc.h @@ -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; |