[x265] [PATCH 4 of 4] rd: optimize rd 0

deepthidevaki at multicorewareinc.com deepthidevaki at multicorewareinc.com
Fri Dec 20 11:37:44 CET 2013


# HG changeset patch
# User Deepthi Devaki <deepthidevaki at multicorewareinc.com>
# Date 1387367747 -19800
# Node ID 3e98f0e66e0beb62f269230d382862502c51e696
# Parent  c69ef62da2b6ec3344fff69e9db9205b6b4d0846
rd: optimize rd 0

diff -r c69ef62da2b6 -r 3e98f0e66e0b source/encoder/compress.cpp
--- a/source/encoder/compress.cpp	Wed Dec 18 17:25:13 2013 +0530
+++ b/source/encoder/compress.cpp	Wed Dec 18 17:25:47 2013 +0530
@@ -343,6 +343,10 @@
     bool bInsidePicture = (rpelx < outTempCU->getSlice()->getSPS()->getPicWidthInLumaSamples()) &&
         (bpely < outTempCU->getSlice()->getSPS()->getPicHeightInLumaSamples());
 
+    if(depth == 0 && m_cfg->param.rdLevel == 0)
+    {
+        m_origYuv[depth]->copyToPicYuv(cu->getPic()->getPicYuvRec(), cu->getAddr(), 0);
+    }
     // We need to split, so don't try these modes.
     TComYuv* tempYuv = NULL;
 #if TOPSKIP
@@ -441,7 +445,6 @@
                     }
 
                     xCheckDQP(m_bestMergeCU[depth]);
-                    m_origYuv[depth]->copyPartToPartYuv(m_bestMergeRecoYuv[depth], 0, m_bestMergeCU[depth]->getWidth(0), m_bestMergeCU[depth]->getHeight(0), true, true);
                     earlyskip = true;
                 }
             }
@@ -561,10 +564,6 @@
                             m_tmpResiYuv[depth]->subtract(m_origYuv[depth], m_bestPredYuv[depth], 0, outBestCU->getWidth(0));
                             m_search->generateCoeffRecon(outBestCU, m_origYuv[depth], m_bestPredYuv[depth], m_tmpResiYuv[depth], m_bestRecoYuv[depth], false);
                         }
-                        else if (m_cfg->param.rdLevel == 0)
-                        {
-                            m_origYuv[depth]->copyPartToPartYuv(m_bestRecoYuv[depth], 0, outBestCU->getWidth(0), outBestCU->getHeight(0), true, true);
-                        }
                     }
                     else
                     {
@@ -574,10 +573,6 @@
                         {
                             m_search->generateCoeffRecon(outBestCU, m_origYuv[depth], m_bestPredYuv[depth], m_tmpResiYuv[depth], m_bestRecoYuv[depth], false);
                         }
-                        else if (m_cfg->param.rdLevel == 0)
-                        {
-                            m_origYuv[depth]->copyPartToPartYuv(m_bestRecoYuv[depth], 0, outBestCU->getWidth(0), outBestCU->getHeight(0), true, true);
-                        }
                     }
                     //Check Merge-skip
                     if (m_cfg->param.rdLevel == 2)
@@ -696,7 +691,8 @@
                 outBestCU->copyToPic((UChar)depth);
 
                 /* Copy Yuv data to picture Yuv */
-                xCopyYuv2Pic(outBestCU->getPic(), outBestCU->getAddr(), outBestCU->getZorderIdxInCU(), depth, depth, outBestCU, lpelx, tpely);
+                if(m_cfg->param.rdLevel != 0)
+                    xCopyYuv2Pic(outBestCU->getPic(), outBestCU->getAddr(), outBestCU->getZorderIdxInCU(), depth, depth, outBestCU, lpelx, tpely);
                 return;
             }
         }
@@ -734,7 +730,8 @@
 #endif // if EARLY_EXIT
                 /* Adding costs from best SUbCUs */
                 outTempCU->copyPartFrom(subBestPartCU, nextDepth_partIndex, nextDepth, true); // Keep best part data to current temporary data.
-                xCopyYuv2Tmp(subBestPartCU->getTotalNumPart() * nextDepth_partIndex, nextDepth);
+                if(m_cfg->param.rdLevel != 0)
+                    xCopyYuv2Tmp(subBestPartCU->getTotalNumPart() * nextDepth_partIndex, nextDepth);
                 if (m_cfg->param.rdLevel == 0)
                     m_bestPredYuv[nextDepth]->copyToPartYuv(m_tmpPredYuv[depth], subBestPartCU->getTotalNumPart() * nextDepth_partIndex);
             }
@@ -831,7 +828,7 @@
     {
         encodeResidue(outBestCU, outBestCU, 0, 0);
     }
-    else
+    else if(m_cfg->param.rdLevel != 0)
     {
         /* Copy Yuv data to picture Yuv */
         xCopyYuv2Pic(outBestCU->getPic(), outBestCU->getAddr(), outBestCU->getZorderIdxInCU(), depth, depth, outBestCU, lpelx, tpely);


More information about the x265-devel mailing list