aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGanapathy Kasi <gkasi@nvidia.com>2017-03-01 15:04:47 -0800
committerLuca Barbato <lu_zero@gentoo.org>2017-03-04 08:23:28 +0100
commit3303f86467efa99f23c670707f5be094cc9ce547 (patch)
tree7ed9678c8d336c1748b3c39f76db778fc642c1d3
parentaba5b94859ef1cb8f517dc64bce86a3021316ae8 (diff)
downloadffmpeg-3303f86467efa99f23c670707f5be094cc9ce547.tar.gz
nvenc: Remove qmin and qmax constraints for nvenc vbr
qmin and qmax are not necessary for nvenc vbr. Also fix for using 2 pass vbr mode for slow preset through ctx->flag NVENC_TWO_PASSES. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
-rw-r--r--libavcodec/nvenc.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index fcd496b93f..738a77ebc2 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -559,12 +559,8 @@ static void nvenc_override_rate_control(AVCodecContext *avctx,
return;
case NV_ENC_PARAMS_RC_2_PASS_VBR:
case NV_ENC_PARAMS_RC_VBR:
- if (avctx->qmin < 0 && avctx->qmax < 0) {
- av_log(avctx, AV_LOG_WARNING,
- "The variable bitrate rate-control requires "
- "the 'qmin' and/or 'qmax' option set.\n");
- return;
- }
+ set_vbr(avctx, rc);
+ break;
case NV_ENC_PARAMS_RC_VBR_MINQP:
if (avctx->qmin < 0) {
av_log(avctx, AV_LOG_WARNING,
@@ -606,8 +602,11 @@ static void nvenc_setup_rate_control(AVCodecContext *avctx)
set_lossless(avctx, rc);
} else if (avctx->global_quality > 0) {
set_constqp(avctx, rc);
- } else if (avctx->qmin >= 0 && avctx->qmax >= 0) {
- rc->rateControlMode = NV_ENC_PARAMS_RC_VBR;
+ } else {
+ if (ctx->flags & NVENC_TWO_PASSES)
+ rc->rateControlMode = NV_ENC_PARAMS_RC_2_PASS_VBR;
+ else
+ rc->rateControlMode = NV_ENC_PARAMS_RC_VBR;
set_vbr(avctx, rc);
}