[x265] [PATCH] Fix re-initialization of VBV parameters when SBRC is not enabled

Kirithika Kalirathnam kirithika at multicorewareinc.com
Fri Jan 13 14:11:53 UTC 2023


>From 43207e8bd05a7e19579cec9f983b5064d9bde715 Mon Sep 17 00:00:00 2001
From: Kirithika <kirithika at multicorewareinc.com>
Date: Fri, 13 Jan 2023 15:45:04 +0530
Subject: [PATCH] Fix re-initialization of VBV parameters when SBRC is not
 enabled

---
 source/encoder/ratecontrol.cpp | 6 ++++--
 source/encoder/ratecontrol.h   | 1 -
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/source/encoder/ratecontrol.cpp b/source/encoder/ratecontrol.cpp
index 162c9dd7b..d3e2233de 100644
--- a/source/encoder/ratecontrol.cpp
+++ b/source/encoder/ratecontrol.cpp
@@ -428,11 +428,12 @@ void RateControl::initVBV(const SPS& sps)
     m_bufferExcess = 0;
     m_minBufferFill = m_param->minVbvFullness / 100;
     m_maxBufferFill = 1 - (m_param->maxVbvFullness / 100);
+    m_initVbv = true;
 }

 bool RateControl::init(const SPS& sps)
 {
-    if (m_isVbv)
+    if (m_isVbv && (!m_initVbv || m_param->bEnableSBRC))
         initVBV(sps);

     if (!m_param->bResetZoneConfig && (m_relativeComplexity == NULL))
@@ -2430,7 +2431,8 @@ void RateControl::checkAndResetABR(RateControlEntry*
rce, bool isFrameDone)
                 m_shortTermCplxCount = 1;
                 m_isAbrReset = true;
                 m_lastAbrResetPoc = rce->poc;
-                rce->blurredComplexity = m_shortTermCplxSum /
m_shortTermCplxCount;
+                if(m_param->bEnableSBRC)
+                    rce->blurredComplexity = m_shortTermCplxSum /
m_shortTermCplxCount;
             }
         }
         else if (m_isAbrReset && isFrameDone)
diff --git a/source/encoder/ratecontrol.h b/source/encoder/ratecontrol.h
index 9c2fe0ed6..7c3f60cc7 100644
--- a/source/encoder/ratecontrol.h
+++ b/source/encoder/ratecontrol.h
@@ -150,7 +150,6 @@ public:
     int    m_lastScenecutAwareIFrame;
     double m_rateTolerance;
     double m_frameDuration;     /* current frame duration in seconds */
-    double m_frameDurInGOP;     /* current frame duration when considered
as a segment */
     double m_bitrate;
     double m_rateFactorConstant;
     double m_bufferSize;
-- 
2.28.0.windows.1

*Thanks,*
*Kirithika*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20230113/b1128c99/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-fix-vbv-init.diff
Type: application/octet-stream
Size: 2066 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20230113/b1128c99/attachment.obj>


More information about the x265-devel mailing list