changeset 5763:5828f199d745

rd: remove redundant checkDQP and add checkDQP for rd 0 checkDQP is called on bestCU, so no need to call it after each encode. For rd0, call checkDQP after residual encode at depth 0.
author Deepthi Devaki <deepthidevaki@multicorewareinc.com>
date Tue, 17 Dec 2013 15:09:43 +0530
parents 8133378e2250
children f9c427b44459
files source/Lib/TLibCommon/TComDataCU.cpp source/encoder/compress.cpp
diffstat 2 files changed, 5 insertions(+-), 4 deletions(-) [+]
line wrap: on
line diff
--- a/source/Lib/TLibCommon/TComDataCU.cpp	Thu Dec 19 17:47:16 2013 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.cpp	Tue Dec 17 15:09:43 2013 +0530
@@ -656,6 +656,7 @@ void TComDataCU::copyCodedToPic(UChar de
     memcpy(rpcCU->getTransformSkip(TEXT_CHROMA_U) + m_absIdxInLCU, m_transformSkip[1], iSizeInUchar);
     memcpy(rpcCU->getTransformSkip(TEXT_CHROMA_V) + m_absIdxInLCU, m_transformSkip[2], iSizeInUchar);
     memcpy(rpcCU->getChromaIntraDir() + m_absIdxInLCU, m_chromaIntraDir, iSizeInUchar);
+    memcpy(rpcCU->getQP() + m_absIdxInLCU, m_qp, sizeof(char) * m_numPartitions);
 
     memcpy(rpcCU->getCbf(TEXT_LUMA) + m_absIdxInLCU, m_cbf[0], iSizeInUchar);
     memcpy(rpcCU->getCbf(TEXT_CHROMA_U) + m_absIdxInLCU, m_cbf[1], iSizeInUchar);
--- a/source/encoder/compress.cpp	Thu Dec 19 17:47:16 2013 +0530
+++ b/source/encoder/compress.cpp	Tue Dec 17 15:09:43 2013 +0530
@@ -74,7 +74,6 @@ void TEncCu::xEncodeIntraInInter(TComDat
 
     cu->m_totalBits = m_entropyCoder->getNumberOfWrittenBits();
     cu->m_totalCost = m_rdCost->calcRdCost(cu->m_totalDistortion, cu->m_totalBits);
-    xCheckDQP(cu);
 }
 
 void TEncCu::xComputeCostIntraInInter(TComDataCU* cu, PartSize partSize)
@@ -303,7 +302,6 @@ void TEncCu::xComputeCostMerge2Nx2N(TCom
 
         //No-residue mode
         m_search->encodeResAndCalcRdInterCU(outBestCU, m_origYuv[depth], bestPredYuv, m_tmpResiYuv[depth], m_bestResiYuv[depth], m_tmpRecoYuv[depth], true);
-        xCheckDQP(outTempCU);
 
         TComYuv* yuv = yuvReconBest;
         yuvReconBest = m_tmpRecoYuv[depth];
@@ -311,7 +309,6 @@ void TEncCu::xComputeCostMerge2Nx2N(TCom
 
         //Encode with residue
         m_search->encodeResAndCalcRdInterCU(outTempCU, m_origYuv[depth], bestPredYuv, m_tmpResiYuv[depth], m_bestResiYuv[depth], m_tmpRecoYuv[depth], false);
-        xCheckDQP(outTempCU);
 
         if (outTempCU->m_totalCost < outBestCU->m_totalCost)    //Choose best from no-residue mode and residue mode
         {
@@ -621,7 +618,8 @@ void TEncCu::xCompressInterCU(TComDataCU
                 }
             }
 
-            xCheckDQP(outBestCU);
+            if (m_cfg->param.rdLevel > 0) //checkDQP can be done only after residual encoding is done
+                xCheckDQP(outBestCU);
             /* Disable recursive analysis for whole CUs temporarily */
             if ((outBestCU != 0) && (outBestCU->isSkipped(0)))
                 bSubBranch = false;
@@ -933,6 +931,7 @@ void TEncCu::encodeResidue(TComDataCU* l
                 reco = m_bestRecoYuv[0]->getCrAddr(absPartIdx);
                 primitives.chroma[m_cfg->param.internalCsp].add_ps[part](reco, dststride, pred, res, src1stride, src2stride);
                 m_bestRecoYuv[0]->copyToPicYuv(lcu->getPic()->getPicYuvRec(), lcu->getAddr(), 0);
+                xCheckDQP(cu);
                 return;
             }
         }
@@ -964,4 +963,5 @@ void TEncCu::encodeResidue(TComDataCU* l
         m_tmpRecoYuv[depth]->copyToPartYuv(m_bestRecoYuv[0], absPartIdx);
         cu->copyCodedToPic(depth);
     }
+    xCheckDQP(cu);
 }