[x265] [PATCH] remove redundant memset

ashok at multicorewareinc.com ashok at multicorewareinc.com
Tue Jul 1 17:18:50 CEST 2014


# HG changeset patch
# User Ashok Kumar Mishra<ashok at multicorewareinc.com>
# Date 1404205727 -19800
#      Tue Jul 01 14:38:47 2014 +0530
# Node ID 58bfb044b36a37e1a7c754f20f86998a351cbe6f
# Parent  38da32f28481f6acd17a9ab4f2e73ad057c54972
remove redundant memset

diff -r 38da32f28481 -r 58bfb044b36a source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp	Mon Jun 30 12:42:51 2014 -0500
+++ b/source/Lib/TLibCommon/TComDataCU.cpp	Tue Jul 01 14:38:47 2014 +0530
@@ -405,14 +405,8 @@
     }
 }
 
-/** initialize prediction data with enabling sub-LCU-level delta QP
-*\param  depth  depth of the current CU
-*\param  qp     qp for the current CU
-*- set CU width and CU height according to depth
-*- set qp value according to input qp
-*- set last-coded qp value according to input last-coded qp
-*/
-void TComDataCU::initEstData(uint32_t depth, int qp)
+// initialize prediction data
+void TComDataCU::initEstData()
 {
     m_psyEnergy        = 0;
     m_totalPsyCost     = MAX_INT64;
@@ -423,68 +417,6 @@
     m_mvBits           = 0;
     m_coeffBits        = 0;
 
-    uint8_t cuSize = g_maxCUSize >> depth;
-
-    for (uint32_t i = 0; i < m_numPartitions; i++)
-    {
-        m_depth[i] = depth;
-        m_cuSize[i] = cuSize;
-        m_trIdx[i] = 0;
-        m_transformSkip[0][i] = 0;
-        m_transformSkip[1][i] = 0;
-        m_transformSkip[2][i] = 0;
-        m_skipFlag[i]   = false;
-        m_partSizes[i] = SIZE_NONE;
-        m_predModes[i] = MODE_NONE;
-        m_cuTransquantBypass[i] = false;
-        m_qp[i] = qp;
-        m_bMergeFlags[i] = 0;
-        m_lumaIntraDir[i] = DC_IDX;
-        m_chromaIntraDir[i] = 0;
-        m_interDir[i] = 0;
-        m_cbf[0][i] = 0;
-        m_cbf[1][i] = 0;
-        m_cbf[2][i] = 0;
-    }
-
-    m_cuMvField[0].clearMvField();
-    m_cuMvField[1].clearMvField();
-}
-
-void TComDataCU::initEstData(uint32_t depth)
-{
-    m_psyEnergy        = 0;
-    m_totalPsyCost     = MAX_INT64;
-    m_totalRDCost      = MAX_INT64;
-    m_sa8dCost         = MAX_INT64;
-    m_totalDistortion  = 0;
-    m_totalBits        = 0;
-    m_mvBits           = 0;
-    m_coeffBits        = 0;
-
-    uint8_t cuSize = g_maxCUSize >> depth;
-
-    for (uint32_t i = 0; i < m_numPartitions; i++)
-    {
-        m_depth[i] = depth;
-        m_cuSize[i] = cuSize;
-        m_trIdx[i] = 0;
-        m_transformSkip[0][i] = 0;
-        m_transformSkip[1][i] = 0;
-        m_transformSkip[2][i] = 0;
-        m_skipFlag[i]   = false;
-        m_partSizes[i] = SIZE_NONE;
-        m_predModes[i] = MODE_NONE;
-        m_cuTransquantBypass[i] = false;
-        m_bMergeFlags[i] = 0;
-        m_lumaIntraDir[i] = DC_IDX;
-        m_chromaIntraDir[i] = 0;
-        m_interDir[i] = 0;
-        m_cbf[0][i] = 0;
-        m_cbf[1][i] = 0;
-        m_cbf[2][i] = 0;
-    }
-
     m_cuMvField[0].clearMvField();
     m_cuMvField[1].clearMvField();
 }
@@ -493,7 +425,7 @@
 void TComDataCU::initSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t depth, int qp)
 {
     X265_CHECK(partUnitIdx < 4, "part unit should be less than 4\n");
-
+    uint8_t cuSize = g_maxCUSize >> depth;
     uint32_t partOffset = (cu->getTotalNumPart() >> 2) * partUnitIdx;
 
     m_pic              = cu->getPic();
@@ -501,8 +433,8 @@
     m_cuAddr           = cu->getAddr();
     m_absIdxInLCU      = cu->getZorderIdxInCU() + partOffset;
 
-    m_cuPelX           = cu->getCUPelX() + (g_maxCUSize >> depth) * (partUnitIdx &  1);
-    m_cuPelY           = cu->getCUPelY() + (g_maxCUSize >> depth) * (partUnitIdx >> 1);
+    m_cuPelX           = cu->getCUPelX() + cuSize * (partUnitIdx &  1);
+    m_cuPelY           = cu->getCUPelY() + cuSize * (partUnitIdx >> 1);
 
     m_psyEnergy        = 0;
     m_totalPsyCost     = MAX_INT64;
@@ -523,102 +455,33 @@
 
     int sizeInBool = sizeof(bool) * m_numPartitions;
     int sizeInChar = sizeof(char) * m_numPartitions;
-    memset(m_qp, qp, sizeInChar);
 
-    memset(m_bMergeFlags,     0, sizeInBool);
-    memset(m_lumaIntraDir,    DC_IDX, sizeInChar);
-    memset(m_chromaIntraDir,  0, sizeInChar);
-    memset(m_interDir,        0, sizeInChar);
-    memset(m_trIdx,           0, sizeInChar);
-    memset(m_transformSkip[0], 0, sizeInChar);
-    memset(m_transformSkip[1], 0, sizeInChar);
-    memset(m_transformSkip[2], 0, sizeInChar);
-    memset(m_cbf[0],          0, sizeInChar);
-    memset(m_cbf[1],          0, sizeInChar);
-    memset(m_cbf[2],          0, sizeInChar);
-    memset(m_depth, depth, sizeInChar);
+    memset(m_qp,                 qp,     sizeInChar);
+    memset(m_lumaIntraDir,       DC_IDX, sizeInChar);
+    memset(m_chromaIntraDir,     0,      sizeInChar);
+    memset(m_trIdx,              0,      sizeInChar);
+    memset(m_transformSkip[0],   0,      sizeInChar);
+    memset(m_transformSkip[1],   0,      sizeInChar);
+    memset(m_transformSkip[2],   0,      sizeInChar);
+    memset(m_cbf[0],             0,      sizeInChar);
+    memset(m_cbf[1],             0,      sizeInChar);
+    memset(m_cbf[2],             0,      sizeInChar);
+    memset(m_depth,              depth,  sizeInChar);
+    memset(m_cuSize,             cuSize, sizeInChar);
+    memset(m_partSizes,          SIZE_NONE, sizeInChar);
+    memset(m_predModes,          MODE_NONE, sizeInChar);
+    memset(m_skipFlag,           false, sizeInBool);
+    memset(m_cuTransquantBypass, false, sizeInBool);
 
-    uint8_t cuSize = g_maxCUSize >> depth;
-    memset(m_cuSize,    cuSize,  sizeInChar);
-    for (uint32_t i = 0; i < m_numPartitions; i++)
+    if (getSlice()->getSliceType() != I_SLICE)
     {
-        m_skipFlag[i]   = false;
-        m_partSizes[i] = SIZE_NONE;
-        m_predModes[i] = MODE_NONE;
-        m_cuTransquantBypass[i] = false;
+        memset(m_bMergeFlags,      0, sizeInBool);
+        memset(m_interDir,         0, sizeInChar);
+
+        m_cuMvField[0].clearMvField();
+        m_cuMvField[1].clearMvField();
     }
 
-    m_cuMvField[0].clearMvField();
-    m_cuMvField[1].clearMvField();
-
-    m_cuLeft        = cu->getCULeft();
-    m_cuAbove       = cu->getCUAbove();
-    m_cuAboveLeft   = cu->getCUAboveLeft();
-    m_cuAboveRight  = cu->getCUAboveRight();
-}
-
-// initialize Sub partition
-void TComDataCU::initSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t depth)
-{
-    X265_CHECK(partUnitIdx < 4, "part unit should be less than 4\n");
-
-    uint32_t partOffset = (cu->getTotalNumPart() >> 2) * partUnitIdx;
-
-    m_pic              = cu->getPic();
-    m_slice            = m_pic->getSlice();
-    m_cuAddr           = cu->getAddr();
-    m_absIdxInLCU      = cu->getZorderIdxInCU() + partOffset;
-
-    m_cuPelX           = cu->getCUPelX() + (g_maxCUSize >> depth) * (partUnitIdx &  1);
-    m_cuPelY           = cu->getCUPelY() + (g_maxCUSize >> depth) * (partUnitIdx >> 1);
-
-    m_psyEnergy        = 0;
-    m_totalPsyCost     = MAX_INT64;
-    m_totalRDCost      = MAX_INT64;
-    m_sa8dCost         = MAX_INT64;
-    m_totalDistortion  = 0;
-    m_totalBits        = 0;
-    m_mvBits           = 0;
-    m_coeffBits        = 0;
-    m_numPartitions    = cu->getTotalNumPart() >> 2;
-
-    for (int i = 0; i < 4; i++)
-    {
-        m_avgCost[i] = cu->m_avgCost[i];
-        m_count[i] = cu->m_count[i];
-    }
-
-    int sizeInBool = sizeof(bool) * m_numPartitions;
-    int sizeInChar = sizeof(char) * m_numPartitions;
-
-    memcpy(m_qp, cu->getQP() + partOffset, sizeInChar);
-    memset(m_bMergeFlags,     0, sizeInBool);
-    memset(m_lumaIntraDir,    DC_IDX, sizeInChar);
-    memset(m_chromaIntraDir,  0, sizeInChar);
-    memset(m_interDir,        0, sizeInChar);
-    memset(m_trIdx,           0, sizeInChar);
-    memset(m_transformSkip[0], 0, sizeInChar);
-    memset(m_transformSkip[1], 0, sizeInChar);
-    memset(m_transformSkip[2], 0, sizeInChar);
-    memset(m_cbf[0],          0, sizeInChar);
-    memset(m_cbf[1],          0, sizeInChar);
-    memset(m_cbf[2],          0, sizeInChar);
-    memset(m_depth, depth, sizeInChar);
-
-    uint8_t cuSize = g_maxCUSize >> depth;
-    memset(m_cuSize, cuSize, sizeInChar);
-
-    for (uint32_t i = 0; i < m_numPartitions; i++)
-    {
-        m_skipFlag[i]   = false;
-        m_partSizes[i] = SIZE_NONE;
-        m_predModes[i] = MODE_NONE;
-        m_cuTransquantBypass[i] = false;
-    }
-
-    m_cuMvField[0].clearMvField();
-    m_cuMvField[1].clearMvField();
-
     m_cuLeft        = cu->getCULeft();
     m_cuAbove       = cu->getCUAbove();
     m_cuAboveLeft   = cu->getCUAboveLeft();
@@ -1457,24 +1320,24 @@
 void TComDataCU::setPartSizeSubParts(PartSize mode, uint32_t absPartIdx, uint32_t depth)
 {
     X265_CHECK(sizeof(*m_partSizes) == 1, "size check failure\n");
-    memset(m_partSizes + absPartIdx, mode, m_pic->getNumPartInCU() >> (2 * depth));
+    memset(m_partSizes + absPartIdx, mode, m_pic->getNumPartInCU() >> (depth << 1));
 }
 
 void TComDataCU::setCUTransquantBypassSubParts(bool flag, uint32_t absPartIdx, uint32_t depth)
 {
-    memset(m_cuTransquantBypass + absPartIdx, flag, m_pic->getNumPartInCU() >> (2 * depth));
+    memset(m_cuTransquantBypass + absPartIdx, flag, m_pic->getNumPartInCU() >> (depth << 1));
 }
 
 void TComDataCU::setSkipFlagSubParts(bool skip, uint32_t absPartIdx, uint32_t depth)
 {
     X265_CHECK(sizeof(*m_skipFlag) == 1, "size check failure\n");
-    memset(m_skipFlag + absPartIdx, skip, m_pic->getNumPartInCU() >> (2 * depth));
+    memset(m_skipFlag + absPartIdx, skip, m_pic->getNumPartInCU() >> (depth << 1));
 }
 
 void TComDataCU::setPredModeSubParts(PredMode eMode, uint32_t absPartIdx, uint32_t depth)
 {
     X265_CHECK(sizeof(*m_predModes) == 1, "size check failure\n");
-    memset(m_predModes + absPartIdx, eMode, m_pic->getNumPartInCU() >> (2 * depth));
+    memset(m_predModes + absPartIdx, eMode, m_pic->getNumPartInCU() >> (depth << 1));
 }
 
 void TComDataCU::setQPSubCUs(int qp, TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool &foundNonZeroCbf)
diff -r 38da32f28481 -r 58bfb044b36a source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.h	Mon Jun 30 12:42:51 2014 -0500
+++ b/source/Lib/TLibCommon/TComDataCU.h	Tue Jul 01 14:38:47 2014 +0530
@@ -210,9 +210,7 @@
     void          destroy();
 
     void          initCU(Frame* pic, uint32_t cuAddr);
-    void          initEstData(uint32_t depth);
-    void          initEstData(uint32_t depth, int qp);
-    void          initSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t depth);
+    void          initEstData();
     void          initSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t depth, int qp);
 
     void          copyToSubCU(TComDataCU* lcu, uint32_t partUnitIdx, uint32_t depth);
diff -r 38da32f28481 -r 58bfb044b36a source/Lib/TLibEncoder/TEncCu.cpp
--- a/source/Lib/TLibEncoder/TEncCu.cpp	Mon Jun 30 12:42:51 2014 -0500
+++ b/source/Lib/TLibEncoder/TEncCu.cpp	Tue Jul 01 14:38:47 2014 +0530
@@ -539,10 +539,7 @@
     // We need to split, so don't try these modes.
     if (bInsidePicture)
     {
-        outTempCU->initEstData(depth);
-
         xCheckRDCostIntra(outBestCU, outTempCU, SIZE_2Nx2N);
-        outTempCU->initEstData(depth);
 
         if (depth == g_maxCUDepth - g_addCUDepth)
         {
@@ -572,8 +569,6 @@
         xFillOrigYUVBuffer(outBestCU, m_origYuv[depth]);
     }
 
-    outTempCU->initEstData(depth);
-
     // further split
     if (depth < g_maxCUDepth - g_addCUDepth)
     {
@@ -583,13 +578,14 @@
         uint32_t partUnitIdx = 0;
         for (; partUnitIdx < 4; partUnitIdx++)
         {
-            subBestPartCU->initSubCU(outTempCU, partUnitIdx, nextDepth); // clear sub partition datas or init.
+            int qp = outTempCU->getQP(0);
+            subBestPartCU->initSubCU(outTempCU, partUnitIdx, nextDepth, qp); // clear sub partition datas or init.
 
             if (bInsidePicture ||
                 ((subBestPartCU->getCUPelX() < slice->getSPS()->getPicWidthInLumaSamples()) &&
                  (subBestPartCU->getCUPelY() < slice->getSPS()->getPicHeightInLumaSamples())))
             {
-                subTempPartCU->initSubCU(outTempCU, partUnitIdx, nextDepth); // clear sub partition datas or init.
+                subTempPartCU->initSubCU(outTempCU, partUnitIdx, nextDepth, qp); // clear sub partition datas or init.
                 if (0 == partUnitIdx) //initialize RD with previous depth buffer
                 {
                     m_rdSbacCoders[nextDepth][CI_CURR_BEST]->load(m_rdSbacCoders[depth][CI_CURR_BEST]);
@@ -714,8 +710,6 @@
     // We need to split, so don't try these modes.
     if (bInsidePicture)
     {
-        outTempCU->initEstData(depth);
-
         // do inter modes, SKIP and 2Nx2N
         if (slice->getSliceType() != I_SLICE)
         {
@@ -723,18 +717,18 @@
             if (m_param->bEnableEarlySkip)
             {
                 xCheckRDCostInter(outBestCU, outTempCU, SIZE_2Nx2N);
-                outTempCU->initEstData(depth); // by competition for inter_2Nx2N
+                outTempCU->initEstData(); // by competition for inter_2Nx2N
             }
             // by Merge for inter_2Nx2N
             xCheckRDCostMerge2Nx2N(outBestCU, outTempCU, &earlyDetectionSkipMode, m_bestPredYuv[depth], m_bestRecoYuv[depth]);
 
-            outTempCU->initEstData(depth);
+            outTempCU->initEstData();
 
             if (!m_param->bEnableEarlySkip)
             {
                 // 2Nx2N, NxN
                 xCheckRDCostInter(outBestCU, outTempCU, SIZE_2Nx2N);
-                outTempCU->initEstData(depth);
+                outTempCU->initEstData();
                 if (m_param->bEnableCbfFastMode)
                 {
                     doNotBlockPu = outBestCU->getQtRootCbf(0) != 0;
@@ -744,7 +738,7 @@
 
         if (!earlyDetectionSkipMode)
         {
-            outTempCU->initEstData(depth);
+            outTempCU->initEstData();
 
             // do inter modes, NxN, 2NxN, and Nx2N
             if (slice->getSliceType() != I_SLICE)
@@ -755,7 +749,7 @@
                     if (depth == g_maxCUDepth - g_addCUDepth && doNotBlockPu)
                     {
                         xCheckRDCostInter(outBestCU, outTempCU, SIZE_NxN);
-                        outTempCU->initEstData(depth);
+                        outTempCU->initEstData();
                     }
                 }
 
@@ -765,7 +759,7 @@
                     if (doNotBlockPu)
                     {
                         xCheckRDCostInter(outBestCU, outTempCU, SIZE_Nx2N);
-                        outTempCU->initEstData(depth);
+                        outTempCU->initEstData();
                         if (m_param->bEnableCbfFastMode && outBestCU->getPartitionSize(0) == SIZE_Nx2N)
                         {
                             doNotBlockPu = outBestCU->getQtRootCbf(0) != 0;
@@ -774,7 +768,7 @@
                     if (doNotBlockPu)
                     {
                         xCheckRDCostInter(outBestCU, outTempCU, SIZE_2NxN);
-                        outTempCU->initEstData(depth);
+                        outTempCU->initEstData();
                         if (m_param->bEnableCbfFastMode && outBestCU->getPartitionSize(0) == SIZE_2NxN)
                         {
                             doNotBlockPu = outBestCU->getQtRootCbf(0) != 0;
@@ -796,7 +790,7 @@
                         if (doNotBlockPu)
                         {
                             xCheckRDCostInter(outBestCU, outTempCU, SIZE_2NxnU);
-                            outTempCU->initEstData(depth);
+                            outTempCU->initEstData();
                             if (m_param->bEnableCbfFastMode && outBestCU->getPartitionSize(0) == SIZE_2NxnU)
                             {
                                 doNotBlockPu = outBestCU->getQtRootCbf(0) != 0;
@@ -805,7 +799,7 @@
                         if (doNotBlockPu)
                         {
                             xCheckRDCostInter(outBestCU, outTempCU, SIZE_2NxnD);
-                            outTempCU->initEstData(depth);
+                            outTempCU->initEstData();
                             if (m_param->bEnableCbfFastMode && outBestCU->getPartitionSize(0) == SIZE_2NxnD)
                             {
                                 doNotBlockPu = outBestCU->getQtRootCbf(0) != 0;
@@ -817,7 +811,7 @@
                         if (doNotBlockPu)
                         {
                             xCheckRDCostInter(outBestCU, outTempCU, SIZE_2NxnU, true);
-                            outTempCU->initEstData(depth);
+                            outTempCU->initEstData();
                             if (m_param->bEnableCbfFastMode && outBestCU->getPartitionSize(0) == SIZE_2NxnU)
                             {
                                 doNotBlockPu = outBestCU->getQtRootCbf(0) != 0;
@@ -826,7 +820,7 @@
                         if (doNotBlockPu)
                         {
                             xCheckRDCostInter(outBestCU, outTempCU, SIZE_2NxnD, true);
-                            outTempCU->initEstData(depth);
+                            outTempCU->initEstData();
                             if (m_param->bEnableCbfFastMode && outBestCU->getPartitionSize(0) == SIZE_2NxnD)
                             {
                                 doNotBlockPu = outBestCU->getQtRootCbf(0) != 0;
@@ -840,7 +834,7 @@
                         if (doNotBlockPu)
                         {
                             xCheckRDCostInter(outBestCU, outTempCU, SIZE_nLx2N);
-                            outTempCU->initEstData(depth);
+                            outTempCU->initEstData();
                             if (m_param->bEnableCbfFastMode && outBestCU->getPartitionSize(0) == SIZE_nLx2N)
                             {
                                 doNotBlockPu = outBestCU->getQtRootCbf(0) != 0;
@@ -849,7 +843,7 @@
                         if (doNotBlockPu)
                         {
                             xCheckRDCostInter(outBestCU, outTempCU, SIZE_nRx2N);
-                            outTempCU->initEstData(depth);
+                            outTempCU->initEstData();
                         }
                     }
                     else if (bTestMergeAMP_Ver)
@@ -857,7 +851,7 @@
                         if (doNotBlockPu)
                         {
                             xCheckRDCostInter(outBestCU, outTempCU, SIZE_nLx2N, true);
-                            outTempCU->initEstData(depth);
+                            outTempCU->initEstData();
                             if (m_param->bEnableCbfFastMode && outBestCU->getPartitionSize(0) == SIZE_nLx2N)
                             {
                                 doNotBlockPu = outBestCU->getQtRootCbf(0) != 0;
@@ -866,7 +860,7 @@
                         if (doNotBlockPu)
                         {
                             xCheckRDCostInter(outBestCU, outTempCU, SIZE_nRx2N, true);
-                            outTempCU->initEstData(depth);
+                            outTempCU->initEstData();
                         }
                     }
                 }
@@ -879,14 +873,14 @@
                  outBestCU->getCbf(0, TEXT_CHROMA_V) != 0)  && doIntra)
             {
                 xCheckRDCostIntraInInter(outBestCU, outTempCU, SIZE_2Nx2N);
-                outTempCU->initEstData(depth);
+                outTempCU->initEstData();
 
                 if (depth == g_maxCUDepth - g_addCUDepth)
                 {
                     if (cuSize > (1 << slice->getSPS()->getQuadtreeTULog2MinSize()))
                     {
                         xCheckRDCostIntraInInter(outBestCU, outTempCU, SIZE_NxN);
-                        outTempCU->initEstData(depth);
+                        outTempCU->initEstData();
                     }
                 }
             }
@@ -918,8 +912,6 @@
         xFillOrigYUVBuffer(outBestCU, m_origYuv[depth]);
     }
 
-    outTempCU->initEstData(depth);
-
     // further split
     if (bSubBranch && depth < g_maxCUDepth - g_addCUDepth)
     {
@@ -929,13 +921,14 @@
         uint32_t partUnitIdx = 0;
         for (; partUnitIdx < 4; partUnitIdx++)
         {
-            subBestPartCU->initSubCU(outTempCU, partUnitIdx, nextDepth); // clear sub partition datas or init.
+            int qp = outTempCU->getQP(0);
+            subBestPartCU->initSubCU(outTempCU, partUnitIdx, nextDepth, qp); // clear sub partition datas or init.
 
             if (bInsidePicture ||
                 ((subBestPartCU->getCUPelX() < slice->getSPS()->getPicWidthInLumaSamples()) &&
                  (subBestPartCU->getCUPelY() < slice->getSPS()->getPicHeightInLumaSamples())))
             {
-                subTempPartCU->initSubCU(outTempCU, partUnitIdx, nextDepth); // clear sub partition datas or init.
+                subTempPartCU->initSubCU(outTempCU, partUnitIdx, nextDepth, qp); // clear sub partition datas or init.
                 if (0 == partUnitIdx) //initialize RD with previous depth buffer
                 {
                     m_rdSbacCoders[nextDepth][CI_CURR_BEST]->load(m_rdSbacCoders[depth][CI_CURR_BEST]);
@@ -1212,15 +1205,7 @@
 
     bool bestIsSkip = false;
 
-    uint32_t iteration;
-    if (outTempCU->isLosslessCoded(0))
-    {
-        iteration = 1;
-    }
-    else
-    {
-        iteration = 2;
-    }
+    uint32_t iteration = outTempCU->isLosslessCoded(0) ? 1 : 2;
 
     for (uint32_t noResidual = 0; noResidual < iteration; ++noResidual)
     {
@@ -1283,7 +1268,8 @@
                         rpcYuvReconBest = m_tmpRecoYuv[depth];
                         m_tmpRecoYuv[depth] = yuv;
                     }
-                    outTempCU->initEstData(depth, origQP);
+                    outTempCU->setQPSubParts(origQP, 0, depth);
+                    outTempCU->setSkipFlagSubParts(false, 0, depth);
                     if (!bestIsSkip)
                     {
                         bestIsSkip = !outBestCU->getQtRootCbf(0);
@@ -1328,7 +1314,6 @@
 {
     uint8_t depth = outTempCU->getDepth(0);
 
-    outTempCU->setDepthSubParts(depth);
     outTempCU->setSkipFlagSubParts(false, 0, depth);
     outTempCU->setPartSizeSubParts(partSize, 0, depth);
     outTempCU->setPredModeSubParts(MODE_INTER, 0, depth);
diff -r 38da32f28481 -r 58bfb044b36a source/encoder/compress.cpp
--- a/source/encoder/compress.cpp	Mon Jun 30 12:42:51 2014 -0500
+++ b/source/encoder/compress.cpp	Tue Jul 01 14:38:47 2014 +0530
@@ -291,7 +291,7 @@
     if (bestMergeCand < 0)
     {
         outBestCU->setMergeFlag(0, false);
-        outBestCU->initEstData(depth, outBestCU->getQP(0));
+        outBestCU->setQPSubParts(outBestCU->getQP(0), 0, depth);
     }
     else
     {
@@ -732,7 +732,7 @@
             }
         }
 #endif // if EARLY_EXIT
-        outTempCU->initEstData(depth, qp);
+        outTempCU->setQPSubParts(qp, 0, depth);
         uint8_t     nextDepth = (uint8_t)(depth + 1);
         TComDataCU* subBestPartCU;
         TComDataCU* subTempPartCU = m_tempCU[nextDepth];


More information about the x265-devel mailing list