aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Arzumanyan <rarzumanyan@nvidia.com>2020-04-20 13:53:36 +0300
committerTimo Rothenpieler <timo@rothenpieler.org>2020-06-01 19:23:47 +0200
commit0842fd2c25c050e595083ba1e8c5176da3d55c9b (patch)
treeee548b7d802f40673fffa665def0d227ae262d57
parent7f76f20fa0a8aad6de50634a5cb60dc53117d6ab (diff)
downloadffmpeg-0842fd2c25c050e595083ba1e8c5176da3d55c9b.tar.gz
avcodec/nvenc: zero avg and max bitrate in CQ mode
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
-rw-r--r--libavcodec/nvenc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index cbdddd33f9..a9f9600fde 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -947,12 +947,17 @@ static av_cold void nvenc_setup_rate_control(AVCodecContext *avctx)
if (ctx->zerolatency)
ctx->encode_config.rcParams.zeroReorderDelay = 1;
- if (ctx->quality)
- {
+ if (ctx->quality) {
//convert from float to fixed point 8.8
int tmp_quality = (int)(ctx->quality * 256.0f);
ctx->encode_config.rcParams.targetQuality = (uint8_t)(tmp_quality >> 8);
ctx->encode_config.rcParams.targetQualityLSB = (uint8_t)(tmp_quality & 0xff);
+
+ av_log(avctx, AV_LOG_VERBOSE, "CQ(%d) mode enabled.\n", tmp_quality);
+
+ //CQ mode shall discard max & avg bitrate;
+ avctx->bit_rate = ctx->encode_config.rcParams.averageBitRate = 0;
+ avctx->rc_max_rate = ctx->encode_config.rcParams.maxBitRate = 0;
}
}