[x265] [PATCH] rc: calculate mvBits, coefBits per Cu for 2 pass in skip mode as well

aarthi at multicorewareinc.com aarthi at multicorewareinc.com
Wed Jul 23 21:11:35 CEST 2014


# HG changeset patch
# User Aarthi Thirumalai
# Date 1406142491 -19800
#      Thu Jul 24 00:38:11 2014 +0530
# Node ID 8152013bebccfc2856121ac1ba2acc3f9d5110d8
# Parent  6920d5d634dc0f4bf3312b0127ecd700f7e6b550
rc: calculate mvBits, coefBits per Cu for 2 pass in skip mode as well

diff -r 6920d5d634dc -r 8152013bebcc source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp	Thu Jul 24 00:37:15 2014 +0530
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp	Thu Jul 24 00:38:11 2014 +0530
@@ -2296,7 +2296,7 @@
     if (cu->isIntra(0))
         return;
 
-    uint32_t bits = 0, bestBits = 0;
+    uint32_t bits = 0, bestBits = 0, bestCoeffBits = 0;
     uint32_t distortion = 0, bestDist = 0;
 
     uint32_t log2CUSize = cu->getLog2CUSize(0);
@@ -2328,7 +2328,8 @@
         m_entropyCoder->codeMergeIndex(cu, 0);
 
         bits = m_entropyCoder->getNumberOfWrittenBits();
-        
+        cu->m_mvBits = bits;
+        cu->m_coeffBits = 0;
         cu->m_totalBits       = bits;
         cu->m_totalDistortion = distortion;
         if (m_rdCost.psyRdEnabled())
@@ -2434,6 +2435,7 @@
 
             bestBits = bits;
             bestCost = cost;
+            bestCoeffBits = cu->m_coeffBits;
             m_entropyCoder->store(m_rdEntropyCoders[depth][CI_TEMP_BEST]);
         }
 
@@ -2461,6 +2463,8 @@
             cu->m_totalRDCost = m_rdCost.calcRdCost(bestDist, bestBits);
         cu->m_totalBits       = bestBits;
         cu->m_totalDistortion = bestDist;
+        cu->m_coeffBits = bestCoeffBits;
+        cu->m_mvBits = bestBits - bestCoeffBits;
 
         if (cu->isSkipped(0))
             cu->clearCbf(0, depth);
@@ -3707,6 +3711,7 @@
             m_entropyCoder->codeSkipFlag(cu, 0);
         m_entropyCoder->codeMergeIndex(cu, 0);
         cu->m_mvBits = m_entropyCoder->getNumberOfWrittenBits();
+        cu->m_coeffBits = 0;
         return m_entropyCoder->getNumberOfWrittenBits();
     }
     else


More information about the x265-devel mailing list