[FFmpeg-cvslog] avcodec/nvenc: apply quantization factors to cqp

Timo Rothenpieler git at videolan.org
Thu Mar 23 19:21:51 EET 2017


ffmpeg | branch: master | Timo Rothenpieler <timo at rothenpieler.org> | Thu Mar 23 17:10:25 2017 +0100| [d84c2298e28cfe16161060f3b5eac02bca167a0e] | committer: Timo Rothenpieler

avcodec/nvenc: apply quantization factors to cqp

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d84c2298e28cfe16161060f3b5eac02bca167a0e
---

 libavcodec/nvenc.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 49f3222..cf05455 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;



More information about the ffmpeg-cvslog mailing list