summaryrefslogtreecommitdiff
path: root/libavcodec/qsvenc.c
diff options
context:
space:
mode:
authorZhong Li <zhong.li@intel.com>2018-08-27 16:23:31 +0800
committerMaxym Dmytrychenko <maxim.d33@gmail.com>2018-09-02 20:01:42 +0200
commite16b20782a597e36a9c7488487c3179375a25b97 (patch)
tree5f4f2cffa90208d85756fa070050fa840dda1898 /libavcodec/qsvenc.c
parent83678dbbae64ad8c501e0c732c1117e642c25dae (diff)
lavc/qsvenc: allow to set qp range for h264 BRC
Signed-off-by: Zhong Li <zhong.li@intel.com> Signed-off-by: Maxym Dmytrychenko <maxim.d33@gmail.com>
Diffstat (limited to 'libavcodec/qsvenc.c')
-rw-r--r--libavcodec/qsvenc.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index e7ca62fedf..c2c2911229 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -665,6 +665,20 @@ FF_ENABLE_DEPRECATION_WARNINGS
q->extco2.AdaptiveB = q->adaptive_b ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
#endif
+#if QSV_VERSION_ATLEAST(1, 9)
+ if (avctx->qmin >= 0 && avctx->qmax >= 0 && avctx->qmin > avctx->qmax) {
+ av_log(avctx, AV_LOG_ERROR, "qmin and or qmax are set but invalid, please make sure min <= max\n");
+ return AVERROR(EINVAL);
+ }
+ if (avctx->qmin >= 0) {
+ q->extco2.MinQPI = avctx->qmin > 51 ? 51 : avctx->qmin;
+ q->extco2.MinQPP = q->extco2.MinQPB = q->extco2.MinQPI;
+ }
+ if (avctx->qmax >= 0) {
+ q->extco2.MaxQPI = avctx->qmax > 51 ? 51 : avctx->qmax;
+ q->extco2.MaxQPP = q->extco2.MaxQPB = q->extco2.MaxQPI;
+ }
+#endif
q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer *)&q->extco2;
}
#endif