Round qpIntra and qpInter calculation instead of old floor behavior.

Adopted from vaapi_encode_h264.c

--
Miroslav Slugeň






>From f983a74bd055d2786de2f3f0227d444361310721 Mon Sep 17 00:00:00 2001
From: Miroslav Slugen <thunde...@email.cz>
Date: Thu, 29 Dec 2016 22:08:41 +0100
Subject: [PATCH 1/1] NVENC: Round qpIntra and qpInter calculation

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

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index d57a90c..1fa9659 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;
-- 
2.1.4

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to