[x265] [PATCH] vbv: refactor, implement row wise qp updates only if vbv is enabled

aarthi at multicorewareinc.com aarthi at multicorewareinc.com
Mon Feb 24 13:56:19 CET 2014


# HG changeset patch
# User Aarthi Thirumalai
# Date 1393244455 -19800
#      Mon Feb 24 17:50:55 2014 +0530
# Node ID dce74082c20eea1f7ef9eb10f9a9addc5e7c7bb7
# Parent  57ce7f0f4f4cbb9acd401751e8bef7b522774e38
vbv: refactor, implement row wise qp updates only if vbv is enabled.

diff -r 57ce7f0f4f4c -r dce74082c20e source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Thu Feb 20 16:01:28 2014 -0800
+++ b/source/encoder/frameencoder.cpp	Mon Feb 24 17:50:55 2014 +0530
@@ -1058,6 +1058,7 @@
     const uint32_t numCols = m_pic->getPicSym()->getFrameWidthInCU();
     const uint32_t lineStartCUAddr = row * numCols;
     double qpBase = m_pic->m_avgQpRc;
+    bool isVbv = m_cfg->param.rc.vbvBufferSize > 0 && m_cfg->param.rc.vbvMaxBitrate > 0;
     for (uint32_t col = curRow.m_completed; col < numCols; col++)
     {
         const uint32_t cuAddr = lineStartCUAddr + col;
@@ -1068,10 +1069,10 @@
         codeRow.m_entropyCoder.resetEntropy();
         TEncSbac *bufSbac = (m_cfg->param.bEnableWavefront && col == 0 && row > 0) ? &m_rows[row - 1].m_bufferSbacCoder : NULL;
 
-        if ((uint32_t)row >= col && (row != 0))
+        if ((uint32_t)row >= col && (row != 0) && isVbv)
             qpBase = m_pic->getCU(cuAddr - numCols + 1)->m_baseQp;
 
-        if (m_cfg->param.rc.aqMode || (m_cfg->param.rc.vbvBufferSize > 0 && m_cfg->param.rc.vbvMaxBitrate > 0))
+        if (m_cfg->param.rc.aqMode || isVbv)
         {
             int qp = calcQpForCu(m_pic, cuAddr, qpBase);
             setLambda(qp, row);
@@ -1080,7 +1081,7 @@
             cu->m_baseQp = qpBase;
         }
         codeRow.processCU(cu, m_pic->getSlice(), bufSbac, m_cfg->param.bEnableWavefront && col == 1);
-        if (m_cfg->param.rc.vbvBufferSize && m_cfg->param.rc.vbvMaxBitrate)
+        if (isVbv)
         {
             // Update encoded bits, satdCost, baseQP for each CU
             m_pic->m_rowDiagSatd[row] += m_pic->m_cuCostsForVbv[cuAddr];


More information about the x265-devel mailing list