[x265] [PATCH] analysis: patch to be added for quality improvement

ashok at multicorewareinc.com ashok at multicorewareinc.com
Tue Jun 23 17:15:31 CEST 2015


# HG changeset patch
# User Ashok Kumar Mishra<ashok at multicorewareinc.com>
# Date 1435071902 -19800
#      Tue Jun 23 20:35:02 2015 +0530
# Node ID fd198cab8822018343056442f8c18878fcbdf2ba
# Parent  0ea7f7c9544ffdf67c35e234dcf6ca1abbf83c2c
analysis: patch to be added for quality improvement

diff -r 0ea7f7c9544f -r fd198cab8822 source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp	Thu May 21 19:16:28 2015 +0530
+++ b/source/encoder/analysis.cpp	Tue Jun 23 20:35:02 2015 +0530
@@ -1177,7 +1177,10 @@
         md.pred[PRED_SKIP].cu.initSubCU(parentCTU, cuGeom, qp);
         md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);
         checkMerge2Nx2N_rd5_6(md.pred[PRED_SKIP], md.pred[PRED_MERGE], cuGeom, false);
-        foundSkip = md.bestMode && !md.bestMode->cu.getQtRootCbf(0);
+
+        /*Don't split if SKIP mode RD cost is less than neighbor CU's RD cost*/
+        if (md.bestMode && md.bestMode->cu.isSkipped(0))
+            foundSkip = recursionDepthCheck(parentCTU, cuGeom, *md.bestMode);
     }
 
     // estimate split cost
@@ -1325,6 +1328,16 @@
     if (mightSplit && !foundSkip)
         checkBestMode(md.pred[PRED_SPLIT], depth);
 
+    if (mightNotSplit)
+    {
+        /* early-out statistics */
+        FrameData& curEncData = *m_frame->m_encData;
+        FrameData::RCStatCU& cuStat = curEncData.m_cuStat[parentCTU.m_cuAddr];
+        uint64_t temp = cuStat.avgCost[depth] * cuStat.count[depth];
+        cuStat.count[depth] += 1;
+        cuStat.avgCost[depth] = (temp + md.bestMode->rdCost) / cuStat.count[depth];
+    }
+
     /* Copy best data to encData CTU and recon */
     md.bestMode->cu.copyToPic(depth);
     md.bestMode->reconYuv.copyToPicYuv(*m_frame->m_reconPic, parentCTU.m_cuAddr, cuGeom.absPartIdx);
@@ -2024,7 +2037,9 @@
     {
         uint64_t avgCost = ((3 * cuCost) + (2 * neighCost)) / ((3 * cuCount) + (2 * neighCount));
         uint64_t curCost = m_param->rdLevel > 1 ? bestMode.rdCost : bestMode.sa8dCost;
-        if (curCost < avgCost && avgCost)
+        bool bEarlySkip = m_param->rdLevel >= 5 ? (16 * curCost < 19 * avgCost) : (curCost < avgCost && avgCost);
+
+        if (bEarlySkip)
             return true;
     }
 


More information about the x265-devel mailing list