[x265] [PATCH] analysis-load: fix bug in indexing saved references and merge candidates

sagar at multicorewareinc.com sagar at multicorewareinc.com
Thu Nov 26 05:24:36 CET 2015


# HG changeset patch
# User Kavitha Sampath <kavitha at multicorewareinc.com>
# Date 1446625537 -19800
#      Wed Nov 04 13:55:37 2015 +0530
# Node ID 400d625864498f0f08629579157fb2f67703b7a1
# Parent  e90c2d74de88459dd18837765a310a462d9679ec
analysis-load: fix bug in indexing saved references and merge candidates

The encoder also signals a warning when cu-tree is enabled with analysis-mode

diff -r e90c2d74de88 -r 400d62586449 source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp	Mon Nov 23 12:26:45 2015 +0530
+++ b/source/encoder/analysis.cpp	Wed Nov 04 13:55:37 2015 +0530
@@ -318,6 +318,10 @@
             {
                 /* record the depth of this non-present sub-CU */
                 splitCU->setEmptyPart(childGeom, subPartIdx);
+
+                /* Set depth of non-present CU to 0 to ensure that correct CU is fetched as reference to code deltaQP */
+                if (bAlreadyDecided)
+                    memset(parentCTU.m_cuDepth + childGeom.absPartIdx, 0, childGeom.numPartitions);
             }
         }
         nextContext->store(splitPred->contexts);
@@ -1792,6 +1796,12 @@
     {
         first = *m_reuseBestMergeCand;
         last = first + 1;
+        int numPred = m_slice->isInterB() + 1;
+
+        /* skip refs used for 2Nx2N, Nx2N, 2NxN inter predictions if best mode is SKIP */
+        m_reuseRef += numPred;
+        if (m_param->bEnableRectInter)
+            m_reuseRef += (numPred * 2 * 2);
     }
     int safeX, maxSafeMv;
     if (m_param->bIntraRefresh && m_slice->m_sliceType == P_SLICE)
@@ -1838,7 +1848,8 @@
 
         uint8_t hasCbf = true;
         bool swapped = false;
-        if (!foundCbf0Merge)
+        /* bypass encoding merge with residual if analysis-mode = load as only SKIP CUs enter this function */
+        if (!foundCbf0Merge && !isShareMergeCand)
         {
             /* if the best prediction has CBF (not a skip) then try merge with residual */
 
@@ -1891,9 +1902,9 @@
 
     if (m_param->analysisMode)
     {
-        m_reuseBestMergeCand++;
         if (m_param->analysisMode == X265_ANALYSIS_SAVE)
             *m_reuseBestMergeCand = bestPred->cu.m_mvpIdx[0][0];
+        m_reuseBestMergeCand++;
     }
 }
 
diff -r e90c2d74de88 -r 400d62586449 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Mon Nov 23 12:26:45 2015 +0530
+++ b/source/encoder/encoder.cpp	Wed Nov 04 13:55:37 2015 +0530
@@ -1696,6 +1696,11 @@
         x265_log(p, X265_LOG_WARNING, "Analysis load/save options incompatible with pmode/pme, Disabling pmode/pme\n");
         p->bDistributeMotionEstimation = p->bDistributeModeAnalysis = 0;
     }
+    if (p->analysisMode && p->rc.cuTree)
+    {
+        x265_log(p, X265_LOG_WARNING, "Analysis load/save options works only with cu-tree off, Disabling cu-tree\n");
+        p->rc.cuTree = 0;
+    }
 
     if (p->bDistributeModeAnalysis && (p->limitReferences >> 1) && 1)
     {


More information about the x265-devel mailing list