diff options
author | Timo Rothenpieler <timo@rothenpieler.org> | 2017-03-23 17:10:25 +0100 |
---|---|---|
committer | Timo Rothenpieler <timo@rothenpieler.org> | 2017-03-23 17:10:52 +0100 |
commit | d84c2298e28cfe16161060f3b5eac02bca167a0e (patch) | |
tree | 439d56173dbdf327b960bd9ec7504422a48770a8 /libavcodec/nvenc.c | |
parent | 7fb2a7afa174fcd31c7707d4c93c0afc33f060b7 (diff) | |
download | ffmpeg-d84c2298e28cfe16161060f3b5eac02bca167a0e.tar.gz |
avcodec/nvenc: apply quantization factors to cqp
Diffstat (limited to 'libavcodec/nvenc.c')
-rw-r--r-- | libavcodec/nvenc.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 49f32228bc..cf054550c1 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -523,9 +523,11 @@ static av_cold void set_constqp(AVCodecContext *avctx) rc->constQP.qpInterB = rc->constQP.qpInterP; } } else if (ctx->cqp >= 0) { - rc->constQP.qpInterP = ctx->cqp; - rc->constQP.qpInterB = ctx->cqp; - rc->constQP.qpIntra = ctx->cqp; + rc->constQP.qpInterP = rc->constQP.qpInterB = rc->constQP.qpIntra = ctx->cqp; + if (avctx->b_quant_factor != 0.0) + rc->constQP.qpInterB = av_clip(ctx->cqp * fabs(avctx->b_quant_factor) + avctx->b_quant_offset + 0.5, 0, 51); + if (avctx->i_quant_factor != 0.0) + rc->constQP.qpIntra = av_clip(ctx->cqp * fabs(avctx->i_quant_factor) + avctx->i_quant_offset + 0.5, 0, 51); } avctx->qmin = -1; |