[FFmpeg-cvslog] avcodec/nvenc: always set qp cr/cb offsets
Timo Rothenpieler
git at videolan.org
Mon Aug 9 16:25:08 EEST 2021
ffmpeg | branch: master | Timo Rothenpieler <timo at rothenpieler.org> | Mon Aug 9 15:16:58 2021 +0200| [00b579890d866f0dd2f34bcb8aceb890ab29f582] | committer: Timo Rothenpieler
avcodec/nvenc: always set qp cr/cb offsets
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=00b579890d866f0dd2f34bcb8aceb890ab29f582
---
libavcodec/nvenc.c | 17 ++++++++---------
1 file 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;
More information about the ffmpeg-cvslog
mailing list