[FFmpeg-cvslog] qsv: Set the correct range for la_depth

Luca Barbato git at videolan.org
Wed May 17 21:26:59 EEST 2017


ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Wed Dec 14 11:58:18 2016 +0100| [f8f7ad758d0e1f36915467567f4d75541d98c12f] | committer: Luca Barbato

qsv: Set the correct range for la_depth

Setting an invalid range for it makes the encoder behave inconsistently.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f8f7ad758d0e1f36915467567f4d75541d98c12f
---

 libavcodec/qsvenc.c | 2 +-
 libavcodec/qsvenc.h | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index d680fc8cbc..85af146ad8 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -273,7 +273,7 @@ static int select_rc_mode(AVCodecContext *avctx, QSVEncContext *q)
     const char *rc_desc;
     mfxU16      rc_mode;
 
-    int want_la     = q->la_depth >= 0;
+    int want_la     = q->la_depth >= 10;
     int want_qscale = !!(avctx->flags & AV_CODEC_FLAG_QSCALE);
     int want_vcm    = q->vcm;
 
diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
index 7ac5dc700b..13e4c47481 100644
--- a/libavcodec/qsvenc.h
+++ b/libavcodec/qsvenc.h
@@ -55,7 +55,8 @@
 { "fast",   NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_TARGETUSAGE_BEST_SPEED  },   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_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 = -1 }, -1, INT16_MAX, VE },        \
+{ "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" },  \
 { "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 }, \



More information about the ffmpeg-cvslog mailing list