<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Jul 13, 2014 at 6:51 PM,  <span dir="ltr"><<a href="mailto:deepthi@multicorewareinc.com" target="_blank">deepthi@multicorewareinc.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"># HG changeset patch<br>
# User Deepthi Nandakumar <<a href="mailto:deepthi@multicorewareinc.com">deepthi@multicorewareinc.com</a>><br>
# Date 1405255445 -19800<br>
#      Sun Jul 13 18:14:05 2014 +0530<br>
# Node ID 0fe178bf1f2d53636eb84cd0848e95b9b9cc4292<br>
# Parent  454a2fc37fee4ba7010d0044553575c6a9b81442<br>
compress: Fixes fudging in merge costs, stores sa8d costs for bestMergeCU in m_sa8dCost<br>
<br>
diff -r 454a2fc37fee -r 0fe178bf1f2d source/encoder/compress.cpp<br>
--- a/source/encoder/compress.cpp       Sun Jul 13 02:32:31 2014 -0500<br>
+++ b/source/encoder/compress.cpp       Sun Jul 13 18:14:05 2014 +0530<br>
@@ -269,7 +269,7 @@<br>
             outTempCU->m_totalBits = bitsCand;<br>
             outTempCU->m_totalDistortion = primitives.sa8d[sizeIdx](m_origYuv[depth]->getLumaAddr(), m_origYuv[depth]->getStride(),<br>
                                                                     m_tmpPredYuv[depth]->getLumaAddr(), m_tmpPredYuv[depth]->getStride());<br>
-            outTempCU->m_totalRDCost = m_rdCost.calcRdSADCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits);<br>
+            outTempCU->m_sa8dCost = m_rdCost.calcRdSADCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits);<br></blockquote><div><br></div><div>Here we are calculating the SAD cost and saving in m_sa8dCost. But it is not being used for selecting the best merge candidate. The code still uses  "m_totalRDCost" for comparison which always has "MAX_INT64". when we run it in debug mode , it hits X265_CHECK(outBestCU->m_totalRDCost != MAX_INT64, "no best prediction cost\n"); and throws error</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
             if (outTempCU->m_totalRDCost < outBestCU->m_totalRDCost)<br>
             {<br>
@@ -294,10 +294,8 @@<br>
         outTempCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField(mvFieldNeighbours[bestMergeCand][1], SIZE_2Nx2N, 0, 0);<br>
         outTempCU->m_totalBits = outBestCU->m_totalBits;<br>
         outTempCU->m_totalDistortion = outBestCU->m_totalDistortion;<br>
-        outTempCU->m_totalBits = 0;<br>
-        outTempCU->m_totalRDCost = m_rdCost.calcRdSADCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits);<br>
-        outTempCU->m_sa8dCost = outTempCU->m_totalRDCost;<br>
-        outBestCU->m_sa8dCost = outTempCU->m_sa8dCost;<br>
+        outTempCU->m_sa8dCost = outBestCU->m_sa8dCost;<br>
+<br>
         if (m_param->rdLevel >= 1)<br>
         {<br>
             //calculate the motion compensation for chroma for the best mode selected<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></div>