[x265] [PATCH] cleanup: remove explicit passing of zOrder to compressInter of rd 5, 6

kavitha at multicorewareinc.com kavitha at multicorewareinc.com
Wed Feb 17 08:59:26 CET 2016


# HG changeset patch
# User Kavitha Sampath <kavitha at multicorewareinc.com>
# Date 1454916325 -19800
#      Mon Feb 08 12:55:25 2016 +0530
# Node ID 85ec1441c95f2935881ab14d813c8ec212dd32c5
# Parent  892192a2788c97cfb6de5ffa228e34827b204b03
cleanup: remove explicit passing of zOrder to compressInter of rd 5,6

Also cleanup earlySkip used in compressInter functions

diff -r 892192a2788c -r 85ec1441c95f source/common/constants.cpp
--- a/source/common/constants.cpp	Fri Feb 05 14:09:46 2016 +0530
+++ b/source/common/constants.cpp	Mon Feb 08 12:55:25 2016 +0530
@@ -555,18 +555,6 @@
     0x38, 
 };
 
-/* Contains how much to increment shared depth buffer for different ctu sizes to get next best depth
- * here, depth 0 = 64x64, depth 1 = 32x32, depth 2 = 16x16 and depth 3 = 8x8
- * if ctu = 64, depth buffer size is 256 combination of depth values 0, 1, 2, 3
- * if ctu = 32, depth buffer size is 64 combination of depth values 1, 2, 3
- * if ctu = 16, depth buffer size is 16 combination of depth values 2, 3 */
-const uint32_t g_depthInc[3][4] =
-{
-    { 16,  4,  0, 0},
-    { 64, 16,  4, 1},
-    {256, 64, 16, 4}
-};
-
 /* g_depthScanIdx [y][x] */
 const uint32_t g_depthScanIdx[8][8] =
 {
diff -r 892192a2788c -r 85ec1441c95f source/common/constants.h
--- a/source/common/constants.h	Fri Feb 05 14:09:46 2016 +0530
+++ b/source/common/constants.h	Mon Feb 08 12:55:25 2016 +0530
@@ -96,7 +96,6 @@
 // Intra tables
 extern const uint8_t g_intraFilterFlags[NUM_INTRA_MODE];
 
-extern const uint32_t g_depthInc[3][4];
 extern const uint32_t g_depthScanIdx[8][8];
 
 }
diff -r 892192a2788c -r 85ec1441c95f source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp	Fri Feb 05 14:09:46 2016 +0530
+++ b/source/encoder/analysis.cpp	Mon Feb 08 12:55:25 2016 +0530
@@ -186,10 +186,7 @@
         else if (m_param->rdLevel <= 4)
             compressInterCU_rd0_4(ctu, cuGeom, qp);
         else
-        {
-            uint32_t zOrder = 0;
-            compressInterCU_rd5_6(ctu, cuGeom, zOrder, qp);
-        }
+            compressInterCU_rd5_6(ctu, cuGeom, qp);
     }
 
     if (m_param->bEnableRdRefine)
@@ -899,7 +896,7 @@
         md.pred[PRED_2Nx2N].sa8dCost = 0;
     }
 
-    bool bNoSplit = false;
+    bool foundSkip = false;
     if (m_param->analysisMode == X265_ANALYSIS_LOAD)
     {
         uint8_t* reuseDepth = &m_reuseInterDataCTU->depth[parentCTU.m_cuAddr * parentCTU.m_numPartitions];
@@ -910,13 +907,14 @@
             md.pred[PRED_SKIP].cu.initSubCU(parentCTU, cuGeom, qp);
             checkMerge2Nx2N_rd0_4(md.pred[PRED_SKIP], md.pred[PRED_MERGE], cuGeom);
 
-            bNoSplit = true;
-            earlyskip = md.bestMode && m_param->bEnableEarlySkip;
+            foundSkip = true;
+            if (m_param->rdLevel)
+                earlyskip = md.bestMode && m_param->bEnableEarlySkip;
         }
     }
 
     /* Step 1. Evaluate Merge/Skip candidates for likely early-outs */
-    if (mightNotSplit && depth >= minDepth && !bNoSplit)
+    if (mightNotSplit && depth >= minDepth && !foundSkip)
     {
         /* Compute Merge Cost */
         md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);
@@ -928,13 +926,13 @@
 
     if (md.bestMode)
     {
-        bNoSplit = md.bestMode->cu.isSkipped(0);
-        if (mightSplit && depth && depth >= minDepth && !bNoSplit)
-            bNoSplit = recursionDepthCheck(parentCTU, cuGeom, *md.bestMode);
+        foundSkip = md.bestMode->cu.isSkipped(0);
+        if (mightSplit && depth && depth >= minDepth && !foundSkip)
+            foundSkip = recursionDepthCheck(parentCTU, cuGeom, *md.bestMode);
     }
 
     /* Step 2. Evaluate each of the 4 split sub-blocks in series */
-    if (mightSplit && !bNoSplit)
+    if (mightSplit && !foundSkip)
     {
         Mode* splitPred = &md.pred[PRED_SPLIT];
         splitPred->initCosts();
@@ -1311,7 +1309,7 @@
             addSplitFlagCost(*md.bestMode, cuGeom.depth);
     }
 
-    if (mightSplit && !bNoSplit)
+    if (mightSplit && !foundSkip)
     {
         Mode* splitPred = &md.pred[PRED_SPLIT];
         if (!md.bestMode)
@@ -1367,7 +1365,7 @@
     return splitCUData;
 }
 
-SplitData Analysis::compressInterCU_rd5_6(const CUData& parentCTU, const CUGeom& cuGeom, uint32_t &zOrder, int32_t qp)
+SplitData Analysis::compressInterCU_rd5_6(const CUData& parentCTU, const CUGeom& cuGeom, int32_t qp)
 {
     uint32_t depth = cuGeom.depth;
     ModeDepth& md = m_modeDepth[depth];
@@ -1376,6 +1374,7 @@
     bool mightSplit = !(cuGeom.flags & CUGeom::LEAF);
     bool mightNotSplit = !(cuGeom.flags & CUGeom::SPLIT_MANDATORY);
     bool foundSkip = false;
+    bool earlyskip = false;
     bool splitIntra = true;
 
     // avoid uninitialize value in below reference
@@ -1390,18 +1389,16 @@
     {
         uint8_t* reuseDepth  = &m_reuseInterDataCTU->depth[parentCTU.m_cuAddr * parentCTU.m_numPartitions];
         uint8_t* reuseModes  = &m_reuseInterDataCTU->modes[parentCTU.m_cuAddr * parentCTU.m_numPartitions];
-        if (mightNotSplit && depth == reuseDepth[zOrder] && zOrder == cuGeom.absPartIdx && reuseModes[zOrder] == MODE_SKIP)
+        if (mightNotSplit && depth == reuseDepth[cuGeom.absPartIdx] && reuseModes[cuGeom.absPartIdx] == MODE_SKIP)
         {
             md.pred[PRED_SKIP].cu.initSubCU(parentCTU, cuGeom, qp);
             md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);
             checkMerge2Nx2N_rd5_6(md.pred[PRED_SKIP], md.pred[PRED_MERGE], cuGeom);
 
-            // increment zOrder offset to point to next best depth in sharedDepth buffer
-            zOrder += g_depthInc[g_maxCUDepth - 1][reuseDepth[zOrder]];
-
             foundSkip = true;
+            earlyskip = m_param->bEnableEarlySkip && 1;
         }
-    }  
+    }
 
     SplitData splitData[4];
     splitData[0].initSplitCUData();
@@ -1416,6 +1413,7 @@
         md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);
         checkMerge2Nx2N_rd5_6(md.pred[PRED_SKIP], md.pred[PRED_MERGE], cuGeom);
         foundSkip = md.bestMode && !md.bestMode->cu.getQtRootCbf(0);
+        earlyskip = m_param->bEnableEarlySkip && foundSkip;
     }
 
     // estimate split cost
@@ -1445,7 +1443,7 @@
                 if (m_slice->m_pps->bUseDQP && nextDepth <= m_slice->m_pps->maxCuDQPDepth)
                     nextQP = setLambdaFromQP(parentCTU, calculateQpforCuSize(parentCTU, childGeom));
 
-                splitData[subPartIdx] = compressInterCU_rd5_6(parentCTU, childGeom, zOrder, nextQP);
+                splitData[subPartIdx] = compressInterCU_rd5_6(parentCTU, childGeom, nextQP);
 
                 // Save best CU and pred data for this sub CU
                 splitIntra |= nd.bestMode->cu.isIntra(0);
@@ -1457,7 +1455,6 @@
             else
             {
                 splitCU->setEmptyPart(childGeom, subPartIdx);
-                zOrder += g_depthInc[g_maxCUDepth - 1][nextDepth];
             }
         }
         nextContext->store(splitPred->contexts);
@@ -1479,7 +1476,7 @@
         if (m_slice->m_pps->bUseDQP && depth <= m_slice->m_pps->maxCuDQPDepth && m_slice->m_pps->maxCuDQPDepth != 0)
             setLambdaFromQP(parentCTU, qp);
 
-        if (!(foundSkip && m_param->bEnableEarlySkip))
+        if (!earlyskip)
         {
             uint32_t refMasks[2];
             refMasks[0] = allSplitRefs;
diff -r 892192a2788c -r 85ec1441c95f source/encoder/analysis.h
--- a/source/encoder/analysis.h	Fri Feb 05 14:09:46 2016 +0530
+++ b/source/encoder/analysis.h	Mon Feb 08 12:55:25 2016 +0530
@@ -133,7 +133,7 @@
     /* full analysis for a P or B slice CU */
     uint32_t compressInterCU_dist(const CUData& parentCTU, const CUGeom& cuGeom, int32_t qp);
     SplitData compressInterCU_rd0_4(const CUData& parentCTU, const CUGeom& cuGeom, int32_t qp);
-    SplitData compressInterCU_rd5_6(const CUData& parentCTU, const CUGeom& cuGeom, uint32_t &zOrder, int32_t qp);
+    SplitData compressInterCU_rd5_6(const CUData& parentCTU, const CUGeom& cuGeom, int32_t qp);
 
     void recodeCU(const CUData& parentCTU, const CUGeom& cuGeom, int32_t qp, int32_t origqp = -1);
 


More information about the x265-devel mailing list