[x265] [PATCH] rc: fix bugs in using boundary condition for cu while encoding each frame

aarthi at multicorewareinc.com aarthi at multicorewareinc.com
Wed Sep 17 14:32:49 CEST 2014


# HG changeset patch
# User Aarthi Thirumalai
# Date 1410954592 -19800
#      Wed Sep 17 17:19:52 2014 +0530
# Node ID 902af935f3c33d70912cdaef54b773a8ba7c40bd
# Parent  86686bd153db547c33cfe23407f32e5e050f9d62
rc: fix bugs in using boundary condition for cu while encoding each frame.

fixes the binary mismatch in 2 pass completely.

diff -r 86686bd153db -r 902af935f3c3 source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp	Wed Sep 17 12:52:38 2014 +0200
+++ b/source/encoder/analysis.cpp	Wed Sep 17 17:19:52 2014 +0530
@@ -462,11 +462,10 @@
         for (uint32_t partUnitIdx = 0; partUnitIdx < 4; partUnitIdx++)
         {
             CU *child_cu = cuPicsym->m_CULocalData + cu->childIdx + partUnitIdx;
-
+            int qp = outTempCU->getQP(0);
+            subBestPartCU->initSubCU(outTempCU, partUnitIdx, nextDepth, qp); // clear sub partition datas or init.
             if (child_cu->flags & CU::PRESENT)
             {
-                int qp = outTempCU->getQP(0);
-                subBestPartCU->initSubCU(outTempCU, partUnitIdx, nextDepth, qp); // clear sub partition datas or init.
                 subTempPartCU->initSubCU(outTempCU, partUnitIdx, nextDepth, qp); // clear sub partition datas or init.
                 if (0 == partUnitIdx) //initialize RD with previous depth buffer
                     m_rdEntropyCoders[nextDepth][CI_CURR_BEST].load(m_rdEntropyCoders[depth][CI_CURR_BEST]);
@@ -483,7 +482,7 @@
                 outTempCU->copyPartFrom(subBestPartCU, partUnitIdx, nextDepth);
             }
         }
-        if (cu->flags & CU::PRESENT)
+        if (cu_unsplit_flag)
         {
             m_entropyCoder->resetBits();
             m_entropyCoder->codeSplitFlag(outTempCU, 0, depth);
@@ -525,7 +524,8 @@
 
     // TODO: write the best CTU at the end of complete CTU analysis
     outBestCU->copyToPic(depth); // Copy Best data to Picture for next partition prediction.
-
+    if (!cu_unsplit_flag)
+        return;
     // Copy Yuv data to picture Yuv
     copyYuv2Pic(pic, outBestCU->getAddr(), outBestCU->getZorderIdxInCU(), depth);
 
@@ -595,11 +595,10 @@
         for (uint32_t partUnitIdx = 0; partUnitIdx < 4; partUnitIdx++)
         {
             CU *child_cu = cuPicsym->m_CULocalData + cu->childIdx + partUnitIdx;
-
+            int qp = outTempCU->getQP(0);
+            subBestPartCU->initSubCU(outTempCU, partUnitIdx, nextDepth, qp); // clear sub partition datas or init.
             if (child_cu->flags & CU::PRESENT)
             {
-                int32_t qp = outTempCU->getQP(0);
-                subBestPartCU->initSubCU(outTempCU, partUnitIdx, nextDepth, qp); // clear sub partition datas or init.
                 subTempPartCU->initSubCU(outTempCU, partUnitIdx, nextDepth, qp); // clear sub partition datas or init.
 
                 if (partUnitIdx) // initialize RD with previous depth buffer
@@ -628,7 +627,7 @@
             }
         }
 
-        if (cu->flags & CU::PRESENT)
+        if (cu_unsplit_flag)
         {
             m_entropyCoder->resetBits();
             m_entropyCoder->codeSplitFlag(outTempCU, 0, depth);
@@ -661,6 +660,8 @@
         checkBestMode(outBestCU, outTempCU, depth);
     }
     outBestCU->copyToPic(depth);
+    if (!cu_unsplit_flag)
+        return;
     copyYuv2Pic(pic, outBestCU->getAddr(), outBestCU->getZorderIdxInCU(), depth);
 
 #if CHECKED_BUILD || _DEBUG


More information about the x265-devel mailing list