[x265] [PATCH] compress: cleanup, remove unused data structs

deepthi at multicorewareinc.com deepthi at multicorewareinc.com
Thu Oct 31 11:10:36 CET 2013


# HG changeset patch
# User Deepthi Nandakumar <deepthi at multicorewareinc.com>
# Date 1383214067 -19800
# Node ID c92fadfe223a9740ab353f8abc0f7b8723a46287
# Parent  ec6b4d35f11053b06d0e1ea46df798ff89a4c127
compress: cleanup, remove unused data structs

diff -r ec6b4d35f110 -r c92fadfe223a source/Lib/TLibEncoder/TEncCu.cpp
--- a/source/Lib/TLibEncoder/TEncCu.cpp	Thu Oct 31 00:09:49 2013 -0500
+++ b/source/Lib/TLibEncoder/TEncCu.cpp	Thu Oct 31 15:37:47 2013 +0530
@@ -86,12 +86,7 @@
     m_bestPredYuv = new TComYuv*[m_totalDepth - 1];
     m_bestResiYuv = new TShortYUV*[m_totalDepth - 1];
     m_bestRecoYuv = new TComYuv*[m_totalDepth - 1];
-    for (int j = 0; j < 4; j++)
-    {
-        m_bestPredYuvNxN[j] = new TComYuv*[m_totalDepth - 1];
-        m_interCU_NxN[j]  = new TComDataCU*[m_totalDepth - 1];
-    }
-
+    
     m_tmpPredYuv = new TComYuv*[m_totalDepth - 1];
 
     m_modePredYuv[0] = new TComYuv*[m_totalDepth - 1];
@@ -119,12 +114,6 @@
         m_tempCU[i] = new TComDataCU;
         m_tempCU[i]->create(numPartitions, width, height, maxWidth >> (m_totalDepth - 1));
 
-        for (int j = 0; j < 4; j++)
-        {
-            m_interCU_NxN[j][i] = new TComDataCU;
-            m_interCU_NxN[j][i]->create(numPartitions, width, height, maxWidth >> (m_totalDepth - 1));
-        }
-
         m_interCU_2Nx2N[i] = new TComDataCU;
         m_interCU_2Nx2N[i]->create(numPartitions, width, height, maxWidth >> (m_totalDepth - 1));
         m_interCU_2NxN[i] = new TComDataCU;
@@ -144,12 +133,6 @@
         m_bestRecoYuv[i] = new TComYuv;
         m_bestRecoYuv[i]->create(width, height);
 
-        for (int j = 0; j < 4; j++)
-        {
-            m_bestPredYuvNxN[j][i] = new TComYuv;
-            m_bestPredYuvNxN[j][i]->create(width, height);
-        }
-
         m_tmpPredYuv[i] = new TComYuv;
         m_tmpPredYuv[i]->create(width, height);
 
@@ -231,16 +214,6 @@
             m_tempCU[i] = NULL;
         }
 
-        for (int j = 0; j < 4; j++)
-        {
-            if (m_interCU_NxN[j][i])
-            {
-                m_interCU_NxN[j][i]->destroy();
-                delete m_interCU_NxN[j][i];
-                m_interCU_NxN[j][i] = NULL;
-            }
-        }
-
         if (m_bestPredYuv[i])
         {
             m_bestPredYuv[i]->destroy();
@@ -259,16 +232,7 @@
             delete m_bestRecoYuv[i];
             m_bestRecoYuv[i] = NULL;
         }
-        for (int j = 0; j < 4; j++)
-        {
-            if (m_bestPredYuvNxN[j][i])
-            {
-                m_bestPredYuvNxN[j][i]->destroy();
-                delete m_bestPredYuvNxN[j][i];
-                m_bestPredYuvNxN[j][i] = NULL;
-            }
-        }
-
+    
         if (m_tmpPredYuv[i])
         {
             m_tmpPredYuv[i]->destroy();
@@ -329,12 +293,6 @@
     delete [] m_tempCU;
     m_tempCU = NULL;
 
-    for (int j = 0; j < 4; j++)
-    {
-        delete [] m_interCU_NxN[j];
-        m_interCU_NxN[j] = NULL;
-    }
-
     delete [] m_bestPredYuv;
     m_bestPredYuv = NULL;
     delete [] m_bestResiYuv;
@@ -342,12 +300,6 @@
     delete [] m_bestRecoYuv;
     m_bestRecoYuv = NULL;
 
-    for (int j = 0; j < 4; j++)
-    {
-        delete [] m_bestPredYuvNxN[j];
-        m_bestPredYuvNxN[j] = NULL;
-    }
-
     delete [] m_bestMergeRecoYuv;
     m_bestMergeRecoYuv = NULL;
     delete [] m_tmpPredYuv;
diff -r ec6b4d35f110 -r c92fadfe223a source/Lib/TLibEncoder/TEncCu.h
--- a/source/Lib/TLibEncoder/TEncCu.h	Thu Oct 31 00:09:49 2013 -0500
+++ b/source/Lib/TLibEncoder/TEncCu.h	Thu Oct 31 15:37:47 2013 +0530
@@ -76,15 +76,13 @@
     TComDataCU** m_intraInInterCU;
     TComDataCU** m_mergeCU;
     TComDataCU** m_bestMergeCU;
-    TComDataCU** m_interCU_NxN[4];
     TComDataCU** m_bestCU;      ///< Best CUs at each depth
     TComDataCU** m_tempCU;      ///< Temporary CUs at each depth
 
     TComYuv**    m_bestPredYuv; ///< Best Prediction Yuv for each depth
     TShortYUV**  m_bestResiYuv; ///< Best Residual Yuv for each depth
     TComYuv**    m_bestRecoYuv; ///< Best Reconstruction Yuv for each depth
-    TComYuv**    m_bestPredYuvNxN[4];
-
+   
     TComYuv**    m_tmpPredYuv;  ///< Temporary Prediction Yuv for each depth
     TShortYUV**  m_tmpResiYuv;  ///< Temporary Residual Yuv for each depth
     TComYuv**    m_tmpRecoYuv;  ///< Temporary Reconstruction Yuv for each depth
diff -r ec6b4d35f110 -r c92fadfe223a source/encoder/compress.cpp
--- a/source/encoder/compress.cpp	Thu Oct 31 00:09:49 2013 -0500
+++ b/source/encoder/compress.cpp	Thu Oct 31 15:37:47 2013 +0530
@@ -426,7 +426,6 @@
         if (!earlyDetectionSkip)
         {
             /*Compute 2Nx2N mode costs*/
-            //if (depth == 0)
             {
                 xComputeCostInter(m_interCU_2Nx2N[depth], m_modePredYuv[0][depth], SIZE_2Nx2N);
                 /*Choose best mode; initialise outBestCU to 2Nx2N*/
@@ -435,15 +434,6 @@
                 m_modePredYuv[0][depth] = m_bestPredYuv[depth];
                 m_bestPredYuv[depth] = tempYuv;
             }
-            //reusing the buffer gives md5 hash error - need to look into it. suspect it happens when inSlice condition is false.
-
-            /*else
-            {
-                outBestCU = m_interCU_NxN[PartitionIndex][depth];
-                tempYuv = m_bestPredYuvNxN[PartitionIndex][depth];
-                m_bestPredYuvNxN[PartitionIndex][depth] = m_bestPredYuv[depth];
-                m_bestPredYuv[depth] = tempYuv;
-            }*/
 
             bTrySplitDQP = bTrySplit;
 
@@ -643,67 +633,6 @@
             }
         }
 #endif
-#if 0 // turn ON this to enable early exit
-        //early exit when RD cost of best mode is less than the cumulative RD cost of 4 subpartition
-        UInt64 nxnCost = 0;
-        if (outBestCU != 0 && depth > 0)
-        {
-            outTempCU->initEstData(depth, qp);
-            UChar nextDepth = (UChar)(depth + 1);
-            /*Best CU initialised to NULL; */
-            subBestPartCU = NULL;
-            /*The temp structure is used for boundary analysis, and to copy Best SubCU mode data on return*/
-            nxnCost = 0;
-            for (uint32_t partUnitIdx = 0; partUnitIdx < 4; partUnitIdx++)
-            {
-                subTempPartCU = m_interCU_NxN[partUnitIdx][nextDepth];
-                subTempPartCU->initSubCU(outTempCU, partUnitIdx, nextDepth, qp);     // clear sub partition datas or init.
-                TComPic* subPic = subTempPartCU->getPic();
-                m_origYuv[nextDepth]->copyFromPicYuv(subPic->getPicYuvOrg(), subTempPartCU->getAddr(), subTempPartCU->getZorderIdxInCU());
-                TComSlice * pcSubSlice = subTempPartCU->getPic()->getSlice();
-                bool subSliceEnd = subTempPartCU->getSCUAddr() < slice->getSliceCurEndCUAddr()
-                    && pcSubSlice->getSliceCurEndCUAddr() < subTempPartCU->getSCUAddr() + subTempPartCU->getTotalNumPart();
-                if (!subSliceEnd && (subTempPartCU->getCUPelX() < slice->getSPS()->getPicWidthInLumaSamples()) &&
-                    (subTempPartCU->getCUPelY() < slice->getSPS()->getPicHeightInLumaSamples()))
-                {
-                    if (outBestCU->getPredictionMode(0) == 0)
-                    {
-                        xComputeCostInter(subTempPartCU, m_bestPredYuvNxN[partUnitIdx][nextDepth], outBestCU->getPartitionSize(0), 0);
-                        m_search->encodeResAndCalcRdInterCU(subTempPartCU, m_origYuv[nextDepth], m_bestPredYuvNxN[partUnitIdx][nextDepth], m_tmpResiYuv[nextDepth],
-                                                            m_bestResiYuv[nextDepth], m_tmpRecoYuv[nextDepth], false);
-                        nxnCost += subTempPartCU->m_totalCost;
-                    }
-                    else if (outBestCU->getPredictionMode(0) == 1)
-                    {
-                        xComputeCostIntraInInter(subTempPartCU, SIZE_2Nx2N);
-                        xEncodeIntraInInter(subTempPartCU, m_origYuv[nextDepth], m_modePredYuv[5][nextDepth], m_tmpResiYuv[nextDepth],  m_tmpRecoYuv[nextDepth]);
-                        nxnCost += subTempPartCU->m_totalCost;
-                    }
-                }
-                subTempPartCU->copyToPic((UChar)nextDepth);
-            }
-
-            float lambda = 1.0f;
-            if (outBestCU->getSlice()->getSliceType() == P_SLICE)
-                lambda = 0.9f;
-            else if (outBestCU->getSlice()->getSliceType() == B_SLICE)
-                lambda = 1.1f;
-
-            if (outBestCU->m_totalCost < lambda * nxnCost)
-            {
-                m_entropyCoder->resetBits();
-                m_entropyCoder->encodeSplitFlag(outBestCU, 0, depth, true);
-                outBestCU->m_totalBits += m_entropyCoder->getNumberOfWrittenBits();        // split bits
-                outBestCU->m_totalCost  = m_rdCost->calcRdCost(outBestCU->m_totalDistortion, outBestCU->m_totalBits);
-                /* Copy Best data to Picture for next partition prediction. */
-                outBestCU->copyToPic((UChar)depth);
-
-                /* Copy Yuv data to picture Yuv */
-                xCopyYuv2Pic(outBestCU->getPic(), outBestCU->getAddr(), outBestCU->getZorderIdxInCU(), depth, depth, outBestCU, lpelx, tpely);
-                return;
-            }
-        }
-#endif // early exit
         outTempCU->initEstData(depth, qp);
         UChar nextDepth = (UChar)(depth + 1);
         subTempPartCU = m_tempCU[nextDepth];


More information about the x265-devel mailing list