[x265] [PATCH] rc: Fix inconsistency in --const-vbv (issue #381)

aruna at multicorewareinc.com aruna at multicorewareinc.com
Fri Dec 22 11:21:29 CET 2017


# HG changeset patch
# User Aruna Matheswaran <aruna at multicorewareinc.com>
# Date 1512624552 -19800
#      Thu Dec 07 10:59:12 2017 +0530
# Branch stable
# Node ID 2e684b80d90fac3d674fbbcd4b41572e4337b736
# Parent  78c0f2c8ba087b38e291226a9555b4b4dab323a5
rc: Fix inconsistency in --const-vbv (issue #381)

VBV intializations during ABR-reset is removed.
Inconsistent rowTotalBits in rc-update with --const-vbv is fixed.

diff -r 78c0f2c8ba08 -r 2e684b80d90f source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Fri Dec 22 12:48:37 2017 +0530
+++ b/source/encoder/frameencoder.cpp	Thu Dec 07 10:59:12 2017 +0530
@@ -1746,8 +1746,8 @@
         if (rowInSlice == rowCount)
         {
             m_rowSliceTotalBits[sliceId] = 0;
-            if (bIsVbv)
-            {                
+            if (bIsVbv && !(m_param->rc.bEnableConstVbv && m_param->bEnableWavefront))
+            {          
                 for (uint32_t i = m_sliceBaseRow[sliceId]; i < rowCount + m_sliceBaseRow[sliceId]; i++)
                     m_rowSliceTotalBits[sliceId] += curEncData.m_rowStat[i].encodedBits;
             }
diff -r 78c0f2c8ba08 -r 2e684b80d90f source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Fri Dec 22 12:48:37 2017 +0530
+++ b/source/encoder/ratecontrol.cpp	Thu Dec 07 10:59:12 2017 +0530
@@ -219,6 +219,7 @@
     m_param->rc.vbvMaxBitrate = x265_clip3(0, 2000000, m_param->rc.vbvMaxBitrate);
     m_param->rc.vbvBufferInit = x265_clip3(0.0, 2000000.0, m_param->rc.vbvBufferInit);
     m_param->vbvBufferEnd = x265_clip3(0.0, 2000000.0, m_param->vbvBufferEnd);
+    m_initVbv = false;
     m_singleFrameVbv = 0;
     m_rateTolerance = 1.0;
 
@@ -319,7 +320,7 @@
 
 bool RateControl::init(const SPS& sps)
 {
-    if (m_isVbv)
+    if (m_isVbv && !m_initVbv)
     {
         /* We don't support changing the ABR bitrate right now,
          * so if the stream starts as CBR, keep it CBR. */
@@ -353,6 +354,7 @@
         m_bufferFillFinal = m_bufferSize * m_param->rc.vbvBufferInit;
         m_bufferFillActual = m_bufferFillFinal;
         m_bufferExcess = 0;
+        m_initVbv = true;
     }
 
     m_totalBits = 0;
diff -r 78c0f2c8ba08 -r 2e684b80d90f source/encoder/ratecontrol.h
--- a/source/encoder/ratecontrol.h	Fri Dec 22 12:48:37 2017 +0530
+++ b/source/encoder/ratecontrol.h	Thu Dec 07 10:59:12 2017 +0530
@@ -132,6 +132,7 @@
     bool   m_isGrainEnabled;
     bool   m_isAbrReset;
     bool   m_isNextGop;
+    bool   m_initVbv;
     int    m_lastAbrResetPoc;
 
     double m_rateTolerance;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x265.patch
Type: text/x-patch
Size: 2540 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20171222/16b72508/attachment.bin>


More information about the x265-devel mailing list