aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2017-12-14 19:04:37 -0300
committerJames Almer <jamrial@gmail.com>2017-12-14 19:05:55 -0300
commit374f818bfbc5f7ad3a88f6a17770abb14abec4d1 (patch)
tree460eb0eaa23712634cb0eb45891618719fdca853
parentb4718b76937a6677ce89866e06d929d778c57b64 (diff)
parent508378556631dc18d32247b4a4e35703758e1ca9 (diff)
downloadffmpeg-374f818bfbc5f7ad3a88f6a17770abb14abec4d1.tar.gz
Merge commit '508378556631dc18d32247b4a4e35703758e1ca9'
* commit '508378556631dc18d32247b4a4e35703758e1ca9': qsv: Support explicit lookahead downscaling Merged-by: James Almer <jamrial@gmail.com>
-rw-r--r--libavcodec/qsvenc.c8
-rw-r--r--libavcodec/qsvenc.h7
-rw-r--r--libavcodec/qsvenc_h264.c5
3 files changed, 15 insertions, 5 deletions
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index d44bec3313..fee2f9f0e8 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -599,6 +599,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
q->extco2.Trellis = q->trellis;
#endif
+#if QSV_HAVE_LA_DS
+ q->extco2.LookAheadDS = q->look_ahead_downsampling;
+#endif
+
#if QSV_HAVE_BREF_TYPE
#if FF_API_PRIVATE_OPT
FF_DISABLE_DEPRECATION_WARNINGS
@@ -615,10 +619,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
#endif
q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer *)&q->extco2;
-
-#if QSV_HAVE_LA_DS
- q->extco2.LookAheadDS = q->look_ahead_downsampling;
-#endif
}
#endif
}
diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
index fae98e17b8..88e0728110 100644
--- a/libavcodec/qsvenc.h
+++ b/libavcodec/qsvenc.h
@@ -55,6 +55,13 @@
#define QSV_HAVE_QVBR 0
#endif
+#if !QSV_HAVE_LA_DS
+#define MFX_LOOKAHEAD_DS_UNKNOWN 0
+#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 }, \
diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c
index 77fb2823d4..09e4c0e599 100644
--- a/libavcodec/qsvenc_h264.c
+++ b/libavcodec/qsvenc_h264.c
@@ -113,10 +113,13 @@ static const AVOption options[] = {
{ "look_ahead_depth", "Depth of look ahead in number frames", OFFSET(qsv.look_ahead_depth), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 100, VE },
#endif
#if QSV_HAVE_LA_DS
- { "look_ahead_downsampling", NULL, OFFSET(qsv.look_ahead_downsampling), AV_OPT_TYPE_INT, { .i64 = MFX_LOOKAHEAD_DS_UNKNOWN }, MFX_LOOKAHEAD_DS_UNKNOWN, MFX_LOOKAHEAD_DS_2x, VE, "look_ahead_downsampling" },
+ { "look_ahead_downsampling", "Downscaling factor for the frames saved for the lookahead analysis", OFFSET(qsv.look_ahead_downsampling),
+ AV_OPT_TYPE_INT, { .i64 = MFX_LOOKAHEAD_DS_UNKNOWN }, MFX_LOOKAHEAD_DS_UNKNOWN, MFX_LOOKAHEAD_DS_2x, VE, "look_ahead_downsampling" },
{ "unknown" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_LOOKAHEAD_DS_UNKNOWN }, INT_MIN, INT_MAX, VE, "look_ahead_downsampling" },
+ { "auto" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_LOOKAHEAD_DS_UNKNOWN }, INT_MIN, INT_MAX, VE, "look_ahead_downsampling" },
{ "off" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_LOOKAHEAD_DS_OFF }, INT_MIN, INT_MAX, VE, "look_ahead_downsampling" },
{ "2x" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_LOOKAHEAD_DS_2x }, INT_MIN, INT_MAX, VE, "look_ahead_downsampling" },
+ { "4x" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_LOOKAHEAD_DS_4x }, INT_MIN, INT_MAX, VE, "look_ahead_downsampling" },
#endif
{ "int_ref_type", "Intra refresh type", OFFSET(qsv.int_ref_type), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, UINT16_MAX, VE, "int_ref_type" },