diff mbox

[FFmpeg-devel] NVENC: Round qpIntra and qpInter calculation

Message ID 58657BDC.4070309@email.cz
State New
Headers show

Commit Message

Miroslav Slugeň Dec. 29, 2016, 9:10 p.m. UTC
Round qpIntra and qpInter calculation instead of old floor behavior.

Adopted from vaapi_encode_h264.c

Comments

Timo Rothenpieler Jan. 1, 2017, 1:52 p.m. UTC | #1
applied
diff mbox

Patch

From f983a74bd055d2786de2f3f0227d444361310721 Mon Sep 17 00:00:00 2001
From: Miroslav Slugen <thunder.m@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