diff options
author | Agatha Hu <ahu@nvidia.com> | 2015-12-14 10:34:59 +0100 |
---|---|---|
committer | Timo Rothenpieler <timo@rothenpieler.org> | 2015-12-14 10:34:59 +0100 |
commit | 758be457564983b879122f6e08701aa236a7f3bf (patch) | |
tree | 1b9bedd30979a0eaabee02facafc9c25ce8c1b10 | |
parent | f1a889737532ad8696574cdb95b844371f74c864 (diff) | |
download | ffmpeg-758be457564983b879122f6e08701aa236a7f3bf.tar.gz |
avcodec/nvenc: clamp initial qp value to [1, 51]
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
-rw-r--r-- | libavcodec/nvenc.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 4ab56fe8b7..31f2dfdd33 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -843,10 +843,10 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx) ctx->encode_config.rcParams.initialRCQP.qpInterP = qp_inter_p; if(avctx->i_quant_factor != 0.0 && avctx->b_quant_factor != 0.0) { - ctx->encode_config.rcParams.initialRCQP.qpIntra = qp_inter_p * fabs(avctx->i_quant_factor); - ctx->encode_config.rcParams.initialRCQP.qpIntra += avctx->i_quant_offset; - ctx->encode_config.rcParams.initialRCQP.qpInterB = qp_inter_p * fabs(avctx->b_quant_factor); - ctx->encode_config.rcParams.initialRCQP.qpInterB += avctx->b_quant_offset; + ctx->encode_config.rcParams.initialRCQP.qpIntra = av_clip( + qp_inter_p * fabs(avctx->i_quant_factor) + avctx->i_quant_offset, 0, 51); + ctx->encode_config.rcParams.initialRCQP.qpInterB = av_clip( + qp_inter_p * fabs(avctx->b_quant_factor) + avctx->b_quant_offset, 0, 51); } else { ctx->encode_config.rcParams.initialRCQP.qpIntra = qp_inter_p; ctx->encode_config.rcParams.initialRCQP.qpInterB = qp_inter_p; |