[x265] [PATCH 3 of 3] rd level: fix the incorrect cost calculation for sa8d

sumalatha at multicorewareinc.com sumalatha at multicorewareinc.com
Thu Dec 12 07:38:32 CET 2013


# HG changeset patch
# User Sumalatha Polureddy
# Date 1386830261 -19800
# Node ID cfa2f40d29419a86d829ee2943a7dea80cb20849
# Parent  cf078fec958afeaaa99c652115471196a2b5e502
rd level: fix the incorrect cost calculation for sa8d

In rd level 1, the distortion is sa8d, so cost calculation should be calrdsadcost() instead of calcrdcost()

diff -r cf078fec958a -r cfa2f40d2941 source/encoder/compress.cpp
--- a/source/encoder/compress.cpp	Thu Dec 12 12:02:15 2013 +0530
+++ b/source/encoder/compress.cpp	Thu Dec 12 12:07:41 2013 +0530
@@ -755,10 +755,15 @@
 
         if (!bBoundary)
         {
-            m_entropyCoder->resetBits();
-            m_entropyCoder->encodeSplitFlag(outTempCU, 0, depth, true);
-
-            outTempCU->m_totalBits += m_entropyCoder->getNumberOfWrittenBits(); // split bits
+            if(m_cfg->param.rdLevel > 1)
+            {
+                m_entropyCoder->resetBits();
+                m_entropyCoder->encodeSplitFlag(outTempCU, 0, depth, true);
+                outTempCU->m_totalBits += m_entropyCoder->getNumberOfWrittenBits(); // split bits
+                outTempCU->m_totalCost = m_rdCost->calcRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits);
+            }
+            else
+                outTempCU->m_totalCost = m_rdCost->calcRdSADCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits);
         }
 
         outTempCU->m_totalCost = m_rdCost->calcRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits);


More information about the x265-devel mailing list