<div dir="ltr">Pls fix extra newlines and whitespace nits.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jun 25, 2014 at 10:54 PM,  <span dir="ltr"><<a href="mailto:aarthi@multicorewareinc.com" target="_blank">aarthi@multicorewareinc.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Aarthi Thirumalai<<a href="mailto:aarthi@multicorewareinc.com">aarthi@multicorewareinc.com</a>><br>
# Date 1403716735 -19800<br>
#      Wed Jun 25 22:48:55 2014 +0530<br>
# Node ID 0995efabd44470c1192994e1aceeb40ae606467f<br>
# Parent  e71e34d02d7777e228eab43edf1910a71a44417d<br>
rc: accumulate mv bits, coeff bits per frame.<br>
<br>
diff -r e71e34d02d77 -r 0995efabd444 source/Lib/TLibEncoder/TEncCu.cpp<br>
--- a/source/Lib/TLibEncoder/TEncCu.cpp Wed Jun 25 22:46:45 2014 +0530<br>
+++ b/source/Lib/TLibEncoder/TEncCu.cpp Wed Jun 25 22:48:55 2014 +0530<br>
@@ -555,6 +555,7 @@<br>
         m_entropyCoder->resetBits();<br>
         m_entropyCoder->encodeSplitFlag(outBestCU, 0, depth);<br>
         outBestCU->m_totalBits += m_entropyCoder->getNumberOfWrittenBits(); // split bits<br>
+<br>
         if (m_rdCost->psyRdEnabled())<br>
         {<br>
             outBestCU->m_totalPsyCost = m_rdCost->calcPsyRdCost(outBestCU->m_totalDistortion, outBestCU->m_totalBits,<br>
@@ -616,7 +617,7 @@<br>
             m_entropyCoder->encodeSplitFlag(outTempCU, 0, depth);<br>
             outTempCU->m_totalBits += m_entropyCoder->getNumberOfWrittenBits(); // split bits<br>
         }<br>
-<br>
+<br>
         if (m_rdCost->psyRdEnabled())<br>
         {<br>
             outTempCU->m_totalPsyCost = m_rdCost->calcPsyRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits,<br>
@@ -907,6 +908,7 @@<br>
         m_entropyCoder->resetBits();<br>
         m_entropyCoder->encodeSplitFlag(outBestCU, 0, depth);<br>
         outBestCU->m_totalBits += m_entropyCoder->getNumberOfWrittenBits(); // split bits<br>
+<br>
         if (m_rdCost->psyRdEnabled())<br>
         {<br>
             outBestCU->m_totalPsyCost = m_rdCost->calcPsyRdCost(outBestCU->m_totalDistortion, outBestCU->m_totalBits,<br>
@@ -1168,6 +1170,7 @@<br>
         return;<br>
     }<br>
<br>
+<br>
     if (slice->getPPS()->getTransquantBypassEnableFlag())<br>
     {<br>
         m_entropyCoder->encodeCUTransquantBypassFlag(cu, absPartIdx);<br>
@@ -1390,12 +1393,14 @@<br>
     m_entropyCoder->encodePartSize(outTempCU, 0, depth);<br>
     m_entropyCoder->encodePredInfo(outTempCU, 0);<br>
     m_entropyCoder->encodeIPCMInfo(outTempCU, 0);<br>
+    outTempCU->m_mvBits = m_entropyCoder->getNumberOfWrittenBits();<br>
<br>
     // Encode Coefficients<br>
     bool bCodeDQP = getdQPFlag();<br>
     m_entropyCoder->encodeCoeff(outTempCU, 0, depth, outTempCU->getCUSize(0), bCodeDQP);<br>
     m_rdGoOnSbacCoder->store(m_rdSbacCoders[depth][CI_TEMP_BEST]);<br>
     outTempCU->m_totalBits = m_entropyCoder->getNumberOfWrittenBits();<br>
+    outTempCU->m_coeffBits = outTempCU->m_totalBits - outTempCU->m_mvBits;<br>
<br>
     if (m_rdCost->psyRdEnabled())<br>
     {<br>
@@ -1437,12 +1442,13 @@<br>
     m_entropyCoder->encodePartSize(outTempCU, 0, depth);<br>
     m_entropyCoder->encodePredInfo(outTempCU, 0);<br>
     m_entropyCoder->encodeIPCMInfo(outTempCU, 0);<br>
-<br>
+    outTempCU->m_mvBits = m_entropyCoder->getNumberOfWrittenBits();<br>
     // Encode Coefficients<br>
     bool bCodeDQP = getdQPFlag();<br>
     m_entropyCoder->encodeCoeff(outTempCU, 0, depth, outTempCU->getCUSize(0), bCodeDQP);<br>
     m_rdGoOnSbacCoder->store(m_rdSbacCoders[depth][CI_TEMP_BEST]);<br>
     outTempCU->m_totalBits = m_entropyCoder->getNumberOfWrittenBits();<br>
+    outTempCU->m_coeffBits = outTempCU->m_totalBits - outTempCU->m_mvBits;<br>
<br>
     if (m_rdCost->psyRdEnabled())<br>
     {<br>
@@ -1492,12 +1498,14 @@<br>
     m_entropyCoder->encodeSkipFlag(outTempCU, 0);<br>
     m_entropyCoder->encodePredMode(outTempCU, 0);<br>
     m_entropyCoder->encodePartSize(outTempCU, 0, depth);<br>
+    outTempCU->m_mvBits = m_entropyCoder->getNumberOfWrittenBits();<br>
     m_entropyCoder->encodeIPCMInfo(outTempCU, 0);<br>
<br>
     m_rdGoOnSbacCoder->store(m_rdSbacCoders[depth][CI_TEMP_BEST]);<br>
<br>
     outTempCU->m_totalBits = m_entropyCoder->getNumberOfWrittenBits();<br>
     outTempCU->m_totalRDCost = m_rdCost->calcRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits);<br>
+    outTempCU->m_coeffBits = outTempCU->m_totalBits - outTempCU->m_mvBits;<br>
<br>
     xCheckDQP(outTempCU);<br>
     xCheckBestMode(outBestCU, outTempCU, depth);<br>
diff -r e71e34d02d77 -r 0995efabd444 source/Lib/TLibEncoder/TEncSearch.cpp<br>
--- a/source/Lib/TLibEncoder/TEncSearch.cpp     Wed Jun 25 22:46:45 2014 +0530<br>
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp     Wed Jun 25 22:48:55 2014 +0530<br>
@@ -4211,6 +4211,7 @@<br>
         }<br>
         m_entropyCoder->encodeSkipFlag(cu, 0);<br>
         m_entropyCoder->encodeMergeIndex(cu, 0);<br>
+        cu->m_mvBits = m_entropyCoder->getNumberOfWrittenBits();<br>
         return m_entropyCoder->getNumberOfWrittenBits();<br>
     }<br>
     else<br>
@@ -4225,8 +4226,11 @@<br>
         m_entropyCoder->encodePartSize(cu, 0, cu->getDepth(0));<br>
         m_entropyCoder->encodePredInfo(cu, 0);<br>
         bool bDummy = false;<br>
+        cu->m_mvBits = m_entropyCoder->getNumberOfWrittenBits();<br>
         m_entropyCoder->encodeCoeff(cu, 0, cu->getDepth(0), cu->getCUSize(0), bDummy);<br>
-        return m_entropyCoder->getNumberOfWrittenBits();<br>
+        int totalBits = m_entropyCoder->getNumberOfWrittenBits();<br>
+        cu->m_coeffBits = totalBits - cu->m_mvBits;<br>
+        return totalBits;<br>
     }<br>
 }<br>
<br>
diff -r e71e34d02d77 -r 0995efabd444 source/encoder/compress.cpp<br>
--- a/source/encoder/compress.cpp       Wed Jun 25 22:46:45 2014 +0530<br>
+++ b/source/encoder/compress.cpp       Wed Jun 25 22:48:55 2014 +0530<br>
@@ -64,6 +64,7 @@<br>
     m_entropyCoder->encodePartSize(cu, 0, depth);<br>
     m_entropyCoder->encodePredInfo(cu, 0);<br>
     m_entropyCoder->encodeIPCMInfo(cu, 0);<br>
+    cu->m_mvBits += m_entropyCoder->getNumberOfWrittenBits();<br>
<br>
     // Encode Coefficients<br>
     bool bCodeDQP = getdQPFlag();<br>
@@ -72,6 +73,7 @@<br>
     m_rdGoOnSbacCoder->store(m_rdSbacCoders[depth][CI_TEMP_BEST]);<br>
<br>
     cu->m_totalBits = m_entropyCoder->getNumberOfWrittenBits();<br>
+    cu->m_coeffBits = cu->m_totalBits - cu->m_mvBits;<br>
     cu->m_totalRDCost = m_rdCost->calcRdCost(cu->m_totalDistortion, cu->m_totalBits);<br>
 }<br>
<br>
@@ -625,7 +627,7 @@<br>
                 m_entropyCoder->resetBits();<br>
                 m_entropyCoder->encodeSplitFlag(outBestCU, 0, depth);<br>
                 outBestCU->m_totalBits += m_entropyCoder->getNumberOfWrittenBits(); // split bits<br>
-                outBestCU->m_totalRDCost  = m_rdCost->calcRdCost(outBestCU->m_totalDistortion, outBestCU->m_totalBits);<br>
+                outBestCU->m_totalRDCost = m_rdCost->calcRdCost(outBestCU->m_totalDistortion, outBestCU->m_totalBits);<br>
             }<br>
<br>
             // copy original YUV samples to PCM buffer<br>
diff -r e71e34d02d77 -r 0995efabd444 source/encoder/frameencoder.cpp<br>
--- a/source/encoder/frameencoder.cpp   Wed Jun 25 22:46:45 2014 +0530<br>
+++ b/source/encoder/frameencoder.cpp   Wed Jun 25 22:48:55 2014 +0530<br>
@@ -694,6 +694,11 @@<br>
         // Store probabilities of second LCU in line into buffer<br>
         if (col == 1 && m_param->bEnableWavefront)<br>
             getBufferSBac(lin)->loadContexts(getSbacCoder(subStrm));<br>
+<br>
+        // Collect Frame Stats for 2 pass<br>
+        m_frame->m_stats.mvBits += cu->m_mvBits;<br>
+        m_frame->m_stats.coeffBits += cu->m_coeffBits;<br>
+        m_frame->m_stats.miscBits += cu->m_totalBits - (cu->m_mvBits + cu->m_coeffBits);<br>
     }<br>
<br>
     if (slice->getPPS()->getCabacInitPresentFlag())<br>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div><br></div>