[FFmpeg-cvslog] avcodec/nvenc: clamp initial qp value to [1, 51]
Agatha Hu
git at videolan.org
Mon Dec 14 10:54:07 CET 2015
ffmpeg | branch: master | Agatha Hu <ahu at nvidia.com> | Mon Dec 14 10:34:59 2015 +0100| [758be457564983b879122f6e08701aa236a7f3bf] | committer: Timo Rothenpieler
avcodec/nvenc: clamp initial qp value to [1, 51]
Signed-off-by: Timo Rothenpieler <timo at rothenpieler.org>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=758be457564983b879122f6e08701aa236a7f3bf
---
libavcodec/nvenc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 4ab56fe..31f2dfd 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;
More information about the ffmpeg-cvslog
mailing list