[x265] [PATCH] analysis: remove redundant arguments, clean up variable names

deepthi at multicorewareinc.com deepthi at multicorewareinc.com
Mon Sep 15 09:28:55 CEST 2014


# HG changeset patch
# User Deepthi Nandakumar <deepthi at multicorewareinc.com>
# Date 1410765485 -19800
#      Mon Sep 15 12:48:05 2014 +0530
# Node ID 74cc03eb75c49eec3f6b2d8b29d07f0f99bbffbf
# Parent  d8394dcfb62084a89c768e72ebe2fa8ba25d2c6a
analysis: remove redundant arguments, clean up variable names

diff -r d8394dcfb620 -r 74cc03eb75c4 source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp	Mon Sep 15 11:34:44 2014 +0530
+++ b/source/encoder/analysis.cpp	Mon Sep 15 12:48:05 2014 +0530
@@ -320,7 +320,7 @@
     if (m_bestCU[0]->m_slice->m_sliceType == I_SLICE)
     {
         memset(m_bestState[0], 0, sizeof(AnalysisState));
-        compressIntraCU(m_bestCU[0], m_tempCU[0], m_bestState[0], m_curState[0], false, cu, cu->m_CULocalData);
+        compressIntraCU(m_bestCU[0], m_tempCU[0], m_bestState[0], m_curState[0], false, cu->m_CULocalData);
         if (m_param->analysisMode == 1)
         {
             memcpy(&m_bestCU[0]->m_pic->m_intraData->depth[cu->getAddr() * cu->m_numPartitions], m_bestCU[0]->getDepth(), sizeof(uint8_t) * cu->getTotalNumPart());
@@ -361,10 +361,10 @@
 
             /* At the start of analysis, the best CU is a null pointer
              * On return, it points to the CU encode with best chosen mode */
-            compressInterCU_rd0_4(outBestCU, m_tempCU[0], cu, 0, cu, cu->m_CULocalData, false, 0, 4);
+            compressInterCU_rd0_4(outBestCU, m_tempCU[0], cu, 0, cu->m_CULocalData, false, 0, 4);
         }
         else
-            compressInterCU_rd5_6(m_bestCU[0], m_tempCU[0], 0, cu, cu->m_CULocalData);
+            compressInterCU_rd5_6(m_bestCU[0], m_tempCU[0], 0, cu->m_CULocalData);
 
         if (m_param->bLogCuStats || m_param->rc.bStatWrite)
         {
@@ -415,7 +415,7 @@
     }
 }
 void Analysis::compressIntraCU(TComDataCU*& outBestCU, TComDataCU*& outTempCU, AnalysisState*& outBestState,
-                               AnalysisState*& outTempState, uint32_t depth, TComDataCU* cuPicsym, CU *cu)
+                               AnalysisState*& outTempState, uint32_t depth, CU *cu)
 {
     //PPAScopeEvent(CompressIntraCU + depth);
     Frame* pic = outBestCU->m_pic;
@@ -466,7 +466,7 @@
         TComDataCU* subTempPartCU = m_tempCU[nextDepth];
         for (uint32_t partUnitIdx = 0; partUnitIdx < 4; partUnitIdx++)
         {
-            CU *child_cu = cuPicsym->m_CULocalData + cu->childIdx + partUnitIdx;
+            CU *child_cu = pic->getCU(outTempCU->getSCUAddr())->m_CULocalData + cu->childIdx + partUnitIdx;
             AnalysisState* nextBestState = m_bestState[nextDepth];
             AnalysisState* nextTempState = m_curState[nextDepth];
             memset(nextBestState, 0, sizeof(AnalysisState));
@@ -481,7 +481,7 @@
                 else
                     m_rdEntropyCoders[nextDepth][CI_CURR_BEST].load(m_rdEntropyCoders[nextDepth][CI_NEXT_BEST]);
 
-                compressIntraCU(subBestPartCU, subTempPartCU, nextBestState, nextTempState, nextDepth, cuPicsym, child_cu);
+                compressIntraCU(subBestPartCU, subTempPartCU, nextBestState, nextTempState, nextDepth, child_cu);
                 outTempCU->copyPartFrom(subBestPartCU, partUnitIdx, nextDepth); // Keep best part data to current temporary data.
                 outTempState->accumulateFromSubCU(nextBestState, partUnitIdx);
                 copyYuv2Tmp(subBestPartCU->getTotalNumPart() * partUnitIdx, nextDepth);
@@ -596,7 +596,7 @@
     checkDQP(outTempCU);
 }
 
-void Analysis::compressInterCU_rd0_4(TComDataCU*& outBestCU, TComDataCU*& outTempCU, TComDataCU* cu, uint32_t depth, TComDataCU* cuPicsym, CU *cu_t, int bInsidePicture, uint32_t PartitionIndex, uint32_t minDepth)
+void Analysis::compressInterCU_rd0_4(TComDataCU*& outBestCU, TComDataCU*& outTempCU, TComDataCU* parentCU, uint32_t depth, CU *cu, int bInsidePicture, uint32_t PartitionIndex, uint32_t minDepth)
 {
     Frame* pic = outTempCU->m_pic;
     uint32_t absPartIdx = outTempCU->getZorderIdxInCU();
@@ -617,12 +617,12 @@
 #endif
 
     Slice* slice = outTempCU->m_slice;
-    int cu_split_flag = !(cu_t->flags & CU::LEAF);
-    int cu_unsplit_flag = !(cu_t->flags & CU::SPLIT_MANDATORY);
+    int cu_split_flag = !(cu->flags & CU::LEAF);
+    int cu_unsplit_flag = !(cu->flags & CU::SPLIT_MANDATORY);
 
     if (depth == 0 && m_param->rdLevel == 0)
     {
-        m_origYuv[depth]->copyToPicYuv(pic->getPicYuvRec(), cu->getAddr(), 0);
+        m_origYuv[depth]->copyToPicYuv(pic->getPicYuvRec(), parentCU->getAddr(), 0);
     }
     // We need to split, so don't try these modes.
 #if TOPSKIP
@@ -665,21 +665,21 @@
             /* Initialise all Mode-CUs based on parentCU */
             if (depth == 0)
             {
-                m_interCU_2Nx2N[depth]->initCU(pic, cu->getAddr());
-                m_interCU_Nx2N[depth]->initCU(pic, cu->getAddr());
-                m_interCU_2NxN[depth]->initCU(pic, cu->getAddr());
-                m_intraInInterCU[depth]->initCU(pic, cu->getAddr());
-                m_mergeCU[depth]->initCU(pic, cu->getAddr());
-                m_bestMergeCU[depth]->initCU(pic, cu->getAddr());
+                m_interCU_2Nx2N[depth]->initCU(pic, parentCU->getAddr());
+                m_interCU_Nx2N[depth]->initCU(pic, parentCU->getAddr());
+                m_interCU_2NxN[depth]->initCU(pic, parentCU->getAddr());
+                m_intraInInterCU[depth]->initCU(pic, parentCU->getAddr());
+                m_mergeCU[depth]->initCU(pic, parentCU->getAddr());
+                m_bestMergeCU[depth]->initCU(pic, parentCU->getAddr());
             }
             else
             {
-                m_interCU_2Nx2N[depth]->initSubCU(cu, PartitionIndex, depth, qp);
-                m_interCU_2NxN[depth]->initSubCU(cu, PartitionIndex, depth, qp);
-                m_interCU_Nx2N[depth]->initSubCU(cu, PartitionIndex, depth, qp);
-                m_intraInInterCU[depth]->initSubCU(cu, PartitionIndex, depth, qp);
-                m_mergeCU[depth]->initSubCU(cu, PartitionIndex, depth, qp);
-                m_bestMergeCU[depth]->initSubCU(cu, PartitionIndex, depth, qp);
+                m_interCU_2Nx2N[depth]->initSubCU(parentCU, PartitionIndex, depth, qp);
+                m_interCU_2NxN[depth]->initSubCU(parentCU, PartitionIndex, depth, qp);
+                m_interCU_Nx2N[depth]->initSubCU(parentCU, PartitionIndex, depth, qp);
+                m_intraInInterCU[depth]->initSubCU(parentCU, PartitionIndex, depth, qp);
+                m_mergeCU[depth]->initSubCU(parentCU, PartitionIndex, depth, qp);
+                m_bestMergeCU[depth]->initSubCU(parentCU, PartitionIndex, depth, qp);
             }
 
             /* Compute  Merge Cost */
@@ -945,7 +945,7 @@
         TComDataCU* subTempPartCU = m_tempCU[nextDepth];
         for (uint32_t partUnitIdx = 0; partUnitIdx < 4; partUnitIdx++)
         {
-            CU *child_cu = cuPicsym->m_CULocalData + cu_t->childIdx + partUnitIdx;
+            CU *child_cu = pic->getCU(outTempCU->getAddr())->m_CULocalData + cu->childIdx + partUnitIdx;
 
             TComDataCU* subBestPartCU = NULL;
             subTempPartCU->initSubCU(outTempCU, partUnitIdx, nextDepth, qp); // clear sub partition datas or init.
@@ -957,7 +957,7 @@
                 else
                     m_rdEntropyCoders[nextDepth][CI_CURR_BEST].load(m_rdEntropyCoders[nextDepth][CI_NEXT_BEST]);
 
-                compressInterCU_rd0_4(subBestPartCU, subTempPartCU, outTempCU, nextDepth, cuPicsym, child_cu, cu_unsplit_flag, partUnitIdx, minDepth);
+                compressInterCU_rd0_4(subBestPartCU, subTempPartCU, outTempCU, nextDepth, child_cu, cu_unsplit_flag, partUnitIdx, minDepth);
 #if EARLY_EXIT
                 if (subBestPartCU->getPredictionMode(0) != MODE_INTRA)
                 {
@@ -1102,7 +1102,7 @@
     x265_emms();
 }
 
-void Analysis::compressInterCU_rd5_6(TComDataCU*& outBestCU, TComDataCU*& outTempCU, uint32_t depth, TComDataCU* cuPicsym, CU *cu, PartSize parentSize)
+void Analysis::compressInterCU_rd5_6(TComDataCU*& outBestCU, TComDataCU*& outTempCU, uint32_t depth, CU *cu, PartSize parentSize)
 {
     //PPAScopeEvent(CompressCU + depth);
 
@@ -1304,7 +1304,7 @@
         TComDataCU* subTempPartCU = m_tempCU[nextDepth];
         for (uint32_t partUnitIdx = 0; partUnitIdx < 4; partUnitIdx++)
         {
-            CU *child_cu = cuPicsym->m_CULocalData + cu->childIdx + partUnitIdx;
+            CU *child_cu = pic->getCU(outTempCU->getAddr())->m_CULocalData + cu->childIdx + partUnitIdx;
 
             int qp = outTempCU->getQP(0);
             subBestPartCU->initSubCU(outTempCU, partUnitIdx, nextDepth, qp); // clear sub partition datas or init.
@@ -1318,7 +1318,7 @@
                 else
                     m_rdEntropyCoders[nextDepth][CI_CURR_BEST].load(m_rdEntropyCoders[nextDepth][CI_NEXT_BEST]);
 
-                compressInterCU_rd5_6(subBestPartCU, subTempPartCU, nextDepth, cuPicsym, child_cu);
+                compressInterCU_rd5_6(subBestPartCU, subTempPartCU, nextDepth, child_cu);
                 outTempCU->copyPartFrom(subBestPartCU, partUnitIdx, nextDepth); // Keep best part data to current temporary data.
                 copyYuv2Tmp(subBestPartCU->getTotalNumPart() * partUnitIdx, nextDepth);
             }
diff -r d8394dcfb620 -r 74cc03eb75c4 source/encoder/analysis.h
--- a/source/encoder/analysis.h	Mon Sep 15 11:34:44 2014 +0530
+++ b/source/encoder/analysis.h	Mon Sep 15 12:48:05 2014 +0530
@@ -163,12 +163,12 @@
 
     /* Warning: The interface for these functions will undergo significant changes as a major refactor is under progress */
     void compressIntraCU(TComDataCU*& outBestCU, TComDataCU*& outTempCU, AnalysisState*& outBestState, AnalysisState*& outTempState, 
-                         uint32_t depth, TComDataCU* cuPicsym, CU *cu);
+                         uint32_t depth, CU *cu);
     void checkIntra(TComDataCU* outTempCU, AnalysisState* outTempState, PartSize partSize, CU *cu);
 
-    void compressInterCU_rd0_4(TComDataCU*& outBestCU, TComDataCU*& outTempCU, TComDataCU* cu, uint32_t depth, TComDataCU* cuPicsym, CU *cu_t,
+    void compressInterCU_rd0_4(TComDataCU*& outBestCU, TComDataCU*& outTempCU, TComDataCU* cu, uint32_t depth, CU *cu_t,
                                int bInsidePicture, uint32_t partitionIndex, uint32_t minDepth);
-    void compressInterCU_rd5_6(TComDataCU*& outBestCU, TComDataCU*& outTempCU, uint32_t depth, TComDataCU* cuPicsym, CU *cu,
+    void compressInterCU_rd5_6(TComDataCU*& outBestCU, TComDataCU*& outTempCU, uint32_t depth, CU *cu,
                                PartSize parentSize = SIZE_NONE);
     void checkMerge2Nx2N_rd0_4(TComDataCU*& outBestCU, TComDataCU*& outTempCU, TComYuv*& bestPredYuv, TComYuv*& tmpPredYuv);
     void checkMerge2Nx2N_rd5_6(TComDataCU*& outBestCU, TComDataCU*& outTempCU, bool *earlyDetectionSkipMode,


More information about the x265-devel mailing list