aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Rothenpieler <timo@rothenpieler.org>2021-08-09 15:16:58 +0200
committerTimo Rothenpieler <timo@rothenpieler.org>2021-08-09 15:16:58 +0200
commit00b579890d866f0dd2f34bcb8aceb890ab29f582 (patch)
tree9ed81fa6c2513a35b21c1fdf16bf098888c9ee7d
parentc60b76d0c880037309e78badd62943455f715e6e (diff)
downloadffmpeg-00b579890d866f0dd2f34bcb8aceb890ab29f582.tar.gz
avcodec/nvenc: always set qp cr/cb offsets
-rw-r--r--libavcodec/nvenc.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index df8e472e73..815b9429b3 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -749,15 +749,6 @@ static av_cold void set_constqp(AVCodecContext *avctx)
rc->constQP.qpIntra = av_clip(ctx->cqp * fabs(avctx->i_quant_factor) + avctx->i_quant_offset + 0.5, 0, 51);
}
-#ifdef NVENC_HAVE_QP_CHROMA_OFFSETS
- rc->cbQPIndexOffset = ctx->qp_cb_offset;
- rc->crQPIndexOffset = ctx->qp_cr_offset;
-#else
- if (ctx->qp_cb_offset || ctx->qp_cr_offset) {
- av_log(avctx, AV_LOG_WARNING, "Failed setting QP CB/CR offsets, SDK 11.1 or greater required at compile time.\n");
- }
-#endif
-
avctx->qmin = -1;
avctx->qmax = -1;
}
@@ -977,6 +968,14 @@ static av_cold void nvenc_setup_rate_control(AVCodecContext *avctx)
ctx->rc &= ~RC_MODE_DEPRECATED;
}
+#ifdef NVENC_HAVE_QP_CHROMA_OFFSETS
+ ctx->encode_config.rcParams.cbQPIndexOffset = ctx->qp_cb_offset;
+ ctx->encode_config.rcParams.crQPIndexOffset = ctx->qp_cr_offset;
+#else
+ if (ctx->qp_cb_offset || ctx->qp_cr_offset)
+ av_log(avctx, AV_LOG_WARNING, "Failed setting QP CB/CR offsets, SDK 11.1 or greater required at compile time.\n");
+#endif
+
#ifdef NVENC_HAVE_LDKFS
if (ctx->ldkfs)
ctx->encode_config.rcParams.lowDelayKeyFrameScale = ctx->ldkfs;