[x265] fix invalid copy source context in rdLevel==0

Satoshi Nakagawa nakagawa424 at oki.com
Wed Oct 8 09:58:57 CEST 2014


# HG changeset patch
# User Satoshi Nakagawa <nakagawa424 at oki.com>
# Date 1412754238 -32400
#      Wed Oct 08 16:43:58 2014 +0900
# Node ID 84c960cf1552f3f317690fa1d35f6536bf4b36b4
# Parent  46c4b98d92ece7ff25d790b0fc69a8185d575524
fix invalid copy source context in rdLevel==0

diff -r 46c4b98d92ec -r 84c960cf1552 source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp	Mon Oct 06 22:07:54 2014 -0500
+++ b/source/encoder/analysis.cpp	Wed Oct 08 16:43:58 2014 +0900
@@ -1275,6 +1275,8 @@
 
         uint32_t nextDepth = depth + 1;
         invalidateContexts(nextDepth);
+        // initialize RD with previous depth buffer
+        m_rdContexts[nextDepth].cur.load(m_rdContexts[depth].cur);
         TComDataCU* subTempPartCU = m_tempCU[nextDepth];
         for (uint32_t partUnitIdx = 0; partUnitIdx < 4; partUnitIdx++)
         {
@@ -1285,10 +1287,8 @@
 
             if (child_cu->flags & CU::PRESENT)
             {
-                if (partUnitIdx) // initialize RD with previous depth buffer
+                if (partUnitIdx && m_param->rdLevel)
                     m_rdContexts[nextDepth].cur.load(m_rdContexts[nextDepth].next);
-                else
-                    m_rdContexts[nextDepth].cur.load(m_rdContexts[depth].cur);
 
                 compressInterCU_rd0_4(subBestPartCU, subTempPartCU, outTempCU, nextDepth, child_cu, cu_unsplit_flag, partUnitIdx, minDepth);
 
@@ -1372,7 +1372,8 @@
                 std::swap(m_bestRecoYuv[depth], m_tmpRecoYuv[depth]);
                 std::swap(m_bestPredYuv[depth], m_tmpPredYuv[depth]);
                 // copy 'next' state from last CU of next depth as next state of this CU
-                m_rdContexts[nextDepth].next.store(m_rdContexts[depth].next);
+                if (m_param->rdLevel)
+                    m_rdContexts[nextDepth].next.store(m_rdContexts[depth].next);
             }
         }
         else
@@ -1381,7 +1382,8 @@
             std::swap(m_bestRecoYuv[depth], m_tmpRecoYuv[depth]);
             std::swap(m_bestPredYuv[depth], m_tmpPredYuv[depth]);
             // copy 'next' state from last CU of next depth as next state of this CU
-            m_rdContexts[nextDepth].next.store(m_rdContexts[depth].next);
+            if (m_param->rdLevel)
+                m_rdContexts[nextDepth].next.store(m_rdContexts[depth].next);
         }
     }
 


More information about the x265-devel mailing list