[x265] [PATCH 2 of 2] rd: remove redundant checkDQP and add checkDQP for rd 0

deepthidevaki at multicorewareinc.com deepthidevaki at multicorewareinc.com
Tue Dec 17 10:40:22 CET 2013


# HG changeset patch
# User Deepthi Devaki <deepthidevaki at multicorewareinc.com>
# Date 1387273183 -19800
# Node ID ddee6ba8609eeed314a398ec2b3dc5da63fa0a3e
# Parent  37e0b00adeec53e94726fa4e0f44a3fdee966354
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.

diff -r 37e0b00adeec -r ddee6ba8609e source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp	Tue Dec 17 14:53:18 2013 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.cpp	Tue Dec 17 15:09:43 2013 +0530
@@ -656,6 +656,7 @@
     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);
diff -r 37e0b00adeec -r ddee6ba8609e source/encoder/compress.cpp
--- a/source/encoder/compress.cpp	Tue Dec 17 14:53:18 2013 +0530
+++ b/source/encoder/compress.cpp	Tue Dec 17 15:09:43 2013 +0530
@@ -74,7 +74,6 @@
 
     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 @@
 
         //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 @@
 
         //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 @@
                 }
             }
 
-            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 @@
                 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 @@
         m_tmpRecoYuv[depth]->copyToPartYuv(m_bestRecoYuv[0], absPartIdx);
         cu->copyCodedToPic(depth);
     }
+    xCheckDQP(cu);
 }


More information about the x265-devel mailing list