[x265] [PATCH] mode: remove debug checks

Divya Manivannan divya at multicorewareinc.com
Wed Sep 30 12:58:29 CEST 2015


# HG changeset patch
# User Divya Manivannan <divya at multicorewareinc.com>
# Date 1443610497 -19800
#      Wed Sep 30 16:24:57 2015 +0530
# Node ID 4a54caf900a969cd94185a865b2593db1f19813f
# Parent  aadec6615a3d5f33b4fdb00079e236b019ef1e95
mode: remove debug checks

diff -r aadec6615a3d -r 4a54caf900a9 source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp	Wed Sep 30 15:31:39 2015 +0530
+++ b/source/encoder/analysis.cpp	Wed Sep 30 16:24:57 2015 +0530
@@ -128,9 +128,6 @@
     m_frame = &frame;
 
 #if _DEBUG || CHECKED_BUILD
-    for (uint32_t i = 0; i <= g_maxCUDepth; i++)
-        for (uint32_t j = 0; j < MAX_PRED_TYPES; j++)
-            m_modeDepth[i].pred[j].invalidate();
     invalidateContexts(0);
 #endif
 
@@ -806,7 +803,6 @@
     }
 
     /* Copy best data to encData CTU and recon */
-    X265_CHECK(md.bestMode->ok(), "best mode is not ok");
     md.bestMode->cu.copyToPic(depth);
     md.bestMode->reconYuv.copyToPicYuv(*m_frame->m_reconPic, cuAddr, cuGeom.absPartIdx);
 
@@ -1169,7 +1165,6 @@
     }
 
     /* Copy best data to encData CTU and recon */
-    X265_CHECK(md.bestMode->ok(), "best mode is not ok");
     md.bestMode->cu.copyToPic(depth);
     if (m_param->rdLevel)
         md.bestMode->reconYuv.copyToPicYuv(reconPic, cuAddr, cuGeom.absPartIdx);
@@ -1419,7 +1414,6 @@
     }
 
     /* Copy best data to encData CTU and recon */
-    X265_CHECK(md.bestMode->ok(), "best mode is not ok");
     md.bestMode->cu.copyToPic(depth);
     md.bestMode->reconYuv.copyToPicYuv(*m_frame->m_reconPic, parentCTU.m_cuAddr, cuGeom.absPartIdx);
 
@@ -1532,7 +1526,6 @@
     md.bestMode->cu.setPURefIdx(0, (int8_t)candMvField[bestSadCand][0].refIdx, 0, 0);
     md.bestMode->cu.setPURefIdx(1, (int8_t)candMvField[bestSadCand][1].refIdx, 0, 0);
     checkDQP(*md.bestMode, cuGeom);
-    X265_CHECK(md.bestMode->ok(), "Merge mode not ok\n");
 }
 
 /* sets md.bestMode if a valid merge candidate is found, else leaves it NULL */
@@ -1655,7 +1648,6 @@
         bestPred->cu.setPURefIdx(0, (int8_t)candMvField[bestCand][0].refIdx, 0, 0);
         bestPred->cu.setPURefIdx(1, (int8_t)candMvField[bestCand][1].refIdx, 0, 0);
         checkDQP(*bestPred, cuGeom);
-        X265_CHECK(bestPred->ok(), "merge mode is not ok");
     }
 
     if (m_param->analysisMode)
diff -r aadec6615a3d -r 4a54caf900a9 source/encoder/analysis.h
--- a/source/encoder/analysis.h	Wed Sep 30 15:31:39 2015 +0530
+++ b/source/encoder/analysis.h	Wed Sep 30 16:24:57 2015 +0530
@@ -147,8 +147,6 @@
     /* check whether current mode is the new best */
     inline void checkBestMode(Mode& mode, uint32_t depth)
     {
-        X265_CHECK(mode.ok(), "mode costs are uninitialized\n");
-
         ModeDepth& md = m_modeDepth[depth];
         if (md.bestMode)
         {
diff -r aadec6615a3d -r 4a54caf900a9 source/encoder/search.cpp
--- a/source/encoder/search.cpp	Wed Sep 30 15:31:39 2015 +0530
+++ b/source/encoder/search.cpp	Wed Sep 30 16:24:57 2015 +0530
@@ -1365,7 +1365,6 @@
     intraMode.distortion = bsad;
     intraMode.sa8dCost = bcost;
     intraMode.sa8dBits = bbits;
-    X265_CHECK(intraMode.ok(), "intra mode is not ok");
 }
 
 void Search::encodeIntraInInter(Mode& intraMode, const CUGeom& cuGeom)
@@ -2383,7 +2382,6 @@
 
         motionCompensation(cu, pu, *predYuv, true, bChromaMC);
     }
-    X265_CHECK(interMode.ok(), "inter mode is not ok");
     interMode.sa8dBits += totalmebits;
 }
 
diff -r aadec6615a3d -r 4a54caf900a9 source/encoder/search.h
--- a/source/encoder/search.h	Wed Sep 30 15:31:39 2015 +0530
+++ b/source/encoder/search.h	Wed Sep 30 16:24:57 2015 +0530
@@ -133,62 +133,8 @@
         coeffBits = 0;
     }
 
-    void invalidate()
-    {
-        /* set costs to invalid data, catch uninitialized re-use */
-        rdCost = UINT64_MAX / 2;
-        sa8dCost = UINT64_MAX / 2;
-        sa8dBits = MAX_UINT / 2;
-        psyEnergy = MAX_UINT / 2;
-#if X265_DEPTH <= 10
-        resEnergy = MAX_UINT / 2;
-        lumaDistortion = MAX_UINT / 2;
-        chromaDistortion = MAX_UINT / 2;
-        distortion = MAX_UINT / 2;
-#else
-        resEnergy = UINT64_MAX / 2;
-        lumaDistortion = UINT64_MAX / 2;
-        chromaDistortion = UINT64_MAX / 2;
-        distortion = UINT64_MAX / 2;
-#endif
-        totalBits = MAX_UINT / 2;
-        mvBits = MAX_UINT / 2;
-        coeffBits = MAX_UINT / 2;
-    }
-
-    bool ok() const
-    {
-#if X265_DEPTH <= 10
-        return !(rdCost >= UINT64_MAX / 2 ||
-            sa8dCost >= UINT64_MAX / 2 ||
-            sa8dBits >= MAX_UINT / 2 ||
-            psyEnergy >= MAX_UINT / 2 ||
-            resEnergy >= MAX_UINT / 2 ||
-            lumaDistortion >= MAX_UINT / 2 ||
-            chromaDistortion >= MAX_UINT / 2 ||
-            distortion >= MAX_UINT / 2 ||
-            totalBits >= MAX_UINT / 2 ||
-            mvBits >= MAX_UINT / 2 ||
-            coeffBits >= MAX_UINT / 2);
-#else
-        return !(rdCost >= UINT64_MAX / 2 ||
-                 sa8dCost >= UINT64_MAX / 2 ||
-                 sa8dBits >= MAX_UINT / 2 ||
-                 psyEnergy >= MAX_UINT / 2 ||
-                 resEnergy >= UINT64_MAX / 2 ||
-                 lumaDistortion >= UINT64_MAX / 2 ||
-                 chromaDistortion >= UINT64_MAX / 2 ||
-                 distortion >= UINT64_MAX / 2 ||
-                 totalBits >= MAX_UINT / 2 ||
-                 mvBits >= MAX_UINT / 2 ||
-                 coeffBits >= MAX_UINT / 2);
-#endif
-    }
-
     void addSubCosts(const Mode& subMode)
     {
-        X265_CHECK(subMode.ok(), "sub-mode not initialized");
-
         rdCost += subMode.rdCost;
         sa8dCost += subMode.sa8dCost;
         sa8dBits += subMode.sa8dBits;


More information about the x265-devel mailing list