[FFmpeg-cvslog] avcodec/nvenc: round qpIntra and qpInter calculation

Miroslav Slugeň git at videolan.org
Sun Jan 1 15:52:03 EET 2017


ffmpeg | branch: master | Miroslav Slugeň <thunder.m at email.cz> | Thu Dec 29 22:10:52 2016 +0100| [f8c503d9270eaa16126b93fc41c7ab3b42b4dd2c] | committer: Timo Rothenpieler

avcodec/nvenc: round qpIntra and qpInter calculation

Round qpIntra and qpInter calculation instead of old floor behavior.

Adopted from vaapi_encode_h264.c

Signed-off-by: Timo Rothenpieler <timo at rothenpieler.org>

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

 libavcodec/nvenc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index f64fd8a..3fd8482 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -544,9 +544,9 @@ static av_cold void set_vbr(AVCodecContext *avctx)
 
     if (avctx->i_quant_factor != 0.0 && avctx->b_quant_factor != 0.0) {
         rc->initialRCQP.qpIntra = av_clip(
-            qp_inter_p * fabs(avctx->i_quant_factor) + avctx->i_quant_offset, 0, 51);
+            qp_inter_p * fabs(avctx->i_quant_factor) + avctx->i_quant_offset + 0.5, 0, 51);
         rc->initialRCQP.qpInterB = av_clip(
-            qp_inter_p * fabs(avctx->b_quant_factor) + avctx->b_quant_offset, 0, 51);
+            qp_inter_p * fabs(avctx->b_quant_factor) + avctx->b_quant_offset + 0.5, 0, 51);
     } else {
         rc->initialRCQP.qpIntra = qp_inter_p;
         rc->initialRCQP.qpInterB = qp_inter_p;



More information about the ffmpeg-cvslog mailing list