[x265] [PATCH] analysis: fix CABAC context state handling after splits [CHANGES OUTPUTS]

Steve Borho steve at borho.org
Mon Oct 6 00:26:45 CEST 2014


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1412547379 18000
#      Sun Oct 05 17:16:19 2014 -0500
# Node ID c16dfcdeb9f726df3225df7e02656868aa602f5d
# Parent  238f1c725bab887a58a5e195e3ce73719b4f400b
analysis: fix CABAC context state handling after splits [CHANGES OUTPUTS]

In RDlevel<=4, if split is chosen then copy depth+1 next to depth next

This fixes a long standing bug in presets slow and above, and improves
compression efficiency.

diff -r 238f1c725bab -r c16dfcdeb9f7 source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp	Sun Oct 05 11:47:26 2014 -0500
+++ b/source/encoder/analysis.cpp	Sun Oct 05 17:16:19 2014 -0500
@@ -1389,8 +1389,6 @@
                 outTempCU->setQPSubParts(outTempCU->getRefQP(targetPartIdx), 0, depth); // set QP to default QP
         }
 
-        m_rdContexts[nextDepth].next.store(m_rdContexts[depth].temp);
-
         /* If Best Mode is not NULL; then compare costs. Else assign best mode to Sub-CU costs
          * Copy recon data from Temp structure to Best structure */
         if (outBestCU)
@@ -1411,6 +1409,8 @@
                 outBestCU = outTempCU;
                 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);
             }
         }
         else
@@ -1418,6 +1418,8 @@
             outBestCU = outTempCU;
             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);
         }
     }
 


More information about the x265-devel mailing list