<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="Generator" content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"Arial Narrow";
        panose-1:2 11 6 6 2 2 2 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body lang="EN-US" link="blue" vlink="purple"><div class="WordSection1"><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Ximing - thanks for your contribution!</span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Pradeep - This early decision optimization certainly looks like it has good potential to be a smart tradeoff for intermediate presets (like medium).   Sure, the test was only for 2 seconds of video, but for this test case we see a 10% performance gain with no loss of quality... so that’s very promising.  You’re right;  more testing is needed to fully understand the cost/benefit under a wide range of conditions.  Can we ask one of our engineers to run some tests?  </span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I also think we need to take the lead when it comes to naming CLI options and parameters.  Maybe --splitrdskip?</span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks,</span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Tom</span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> x265-devel [mailto:<a href="mailto:x265-devel-bounces@videolan.org">x265-devel-bounces@videolan.org</a>] <b>On Behalf Of </b>Pradeep Ramachandran<br><b>Sent:</b> Tuesday, July 18, 2017 10:10 AM<br><b>To:</b> Development for x265<br><b>Subject:</b> Re: [x265] [PATCH] intra: skip RD analysis when sum of sub CU splitcost bigger than non-split cost</span></p><p class="MsoNormal"> </p><div><div><p class="MsoNormal"> </p><div><p class="MsoNormal">On Fri, Jul 14, 2017 at 10:38 PM, Ximing Cheng <<a href="mailto:chengximing1989@foxmail.com" target="_blank">chengximing1989@foxmail.com</a>> wrote:</p><div><p class="MsoNormal">command line:</p></div><div><p class="MsoNormal">x265 --input BasketballDrive_1920x1080_50.yuv --input-res 1920x1080 --fps 50 --frames 100 --keyint 0 -o test.265</p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">before patch </p></div><div><p class="MsoNormal">encoded 100 frames in 57.28s (1.75 fps), 10496.03 kb/s, Avg QP:34.74</p></div><div><p class="MsoNormal">after patch</p></div><div><p class="MsoNormal">encoded 100 frames in 51.52s (1.94 fps), 10496.03 kb/s, Avg QP:34.74</p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">Thanks for your test data. Looks like this is an intra-only optimization. Could you please share more results with longer test sequences at different resolutions, if you have them? We can also run additional tests before considering this improvement if the results are more wide-spread.</p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">Also, please add a new param field and cli option that may be used to exercise this. It is always better to do this instead of affect default encodes with such performance optimizations. They param should be off by default, and if we can clearly see the benefits to <i>all possible encodes</i> for a given preset, then we can consider enabling that optimization for that given preset.</p></div><div><p class="MsoNormal"> </p></div><blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in"><div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Arial Narrow","sans-serif"">------------------ Original ------------------</span></p></div><div><div><p class="MsoNormal" style="background:#efefef"><b><span style="font-size:9.0pt">From: </span></b><span style="font-size:9.0pt"> "Ximing Cheng";<<a href="mailto:chengximing1989@foxmail.com" target="_blank">chengximing1989@foxmail.com</a>>;</span></p></div><div><p class="MsoNormal" style="background:#efefef"><b><span style="font-size:9.0pt">Send time:</span></b><span style="font-size:9.0pt"> Saturday, Jul 15, 2017 1:07 AM</span></p></div><div><p class="MsoNormal" style="background:#efefef"><b><span style="font-size:9.0pt">To:</span></b><span style="font-size:9.0pt"> "x265-devel"<<a href="mailto:x265-devel@videolan.org" target="_blank">x265-devel@videolan.org</a>>; </span></p></div><div><p class="MsoNormal" style="background:#efefef"><b><span style="font-size:9.0pt">Subject: </span></b><span style="font-size:9.0pt"> [x265] [PATCH] intra: skip RD analysis when sum of sub CU splitcost bigger than non-split cost</span></p></div></div><div><div><div><p class="MsoNormal"> </p></div><p class="MsoNormal"># HG changeset patch<br># User Ximing Cheng <<a href="mailto:ximingcheng@tencent.com" target="_blank">ximingcheng@tencent.com</a>><br># Date 1500052036 -28800<br>#      Sat Jul 15 01:07:16 2017 +0800<br># Node ID 9c2e9f6c6ee73e75b94c2e52f85a64bca628baf0<br># Parent  3f6841d271e36dc324936f09846d1f2cb77c63e5<br>intra: skip RD analysis when sum of sub CU split cost bigger than non-split cost<br>This patch will speed up all intra case with almost no BDRATE loss<br><br>diff -r 3f6841d271e3 -r 9c2e9f6c6ee7 source/encoder/analysis.cpp<br>--- a/source/encoder/analysis.cpp Wed Jun 28 10:44:19 2017 +0530<br>+++ b/source/encoder/analysis.cpp Sat Jul 15 01:07:16 2017 +0800<br>@@ -485,7 +485,7 @@<br>     md.bestMode->reconYuv.copyToPicYuv(*m_frame->m_reconPic, parentCTU.m_cuAddr, cuGeom.absPartIdx);<br> }<br> <br>-void Analysis::compressIntraCU(const CUData& parentCTU, const CUGeom& cuGeom, int32_t qp)<br>+uint64_t Analysis::compressIntraCU(const CUData& parentCTU, const CUGeom& cuGeom, int32_t qp)<br> {<br>     uint32_t depth = cuGeom.depth;<br>     ModeDepth& md = m_modeDepth[depth];<br>@@ -561,6 +561,9 @@<br>         Entropy* nextContext = &m_rqt[depth].cur;<br>         int32_t nextQP = qp;<br> <br>+        uint64_t curCost = 0;<br>+        int skipSplitCheck = 0;<br>+<br>         for (uint32_t subPartIdx = 0; subPartIdx < 4; subPartIdx++)<br>         {<br>             const CUGeom& childGeom = *(&cuGeom + cuGeom.childOffset + subPartIdx);<br>@@ -572,7 +575,12 @@<br>                 if (m_slice->m_pps->bUseDQP && nextDepth <= m_slice->m_pps->maxCuDQPDepth)<br>                     nextQP = setLambdaFromQP(parentCTU, calculateQpforCuSize(parentCTU, childGeom));<br> <br>-                compressIntraCU(parentCTU, childGeom, nextQP);<br>+                curCost += compressIntraCU(parentCTU, childGeom, nextQP);<br>+                if (m_modeDepth[depth].bestMode && curCost > m_modeDepth[depth].bestMode->rdCost)<br>+                {<br>+                    skipSplitCheck = 1;<br>+                    break;<br>+                }<br> <br>                 // Save best CU and pred data for this sub CU<br>                 splitCU->copyPartFrom(nd.bestMode->cu, childGeom, subPartIdx);<br>@@ -590,14 +598,18 @@<br>                     memset(parentCTU.m_cuDepth + childGeom.absPartIdx, 0, childGeom.numPartitions);<br>             }<br>         }<br>-        nextContext->store(splitPred->contexts);<br>-        if (mightNotSplit)<br>-            addSplitFlagCost(*splitPred, cuGeom.depth);<br>-        else<br>-            updateModeCost(*splitPred);<br>-<br>-        checkDQPForSplitPred(*splitPred, cuGeom);<br>-        checkBestMode(*splitPred, depth);<br>+<br>+        if (!skipSplitCheck)<br>+        {<br>+            nextContext->store(splitPred->contexts);<br>+            if (mightNotSplit)<br>+                addSplitFlagCost(*splitPred, cuGeom.depth);<br>+            else<br>+                updateModeCost(*splitPred);<br>+<br>+            checkDQPForSplitPred(*splitPred, cuGeom);<br>+            checkBestMode(*splitPred, depth);<br>+        }<br>     }<br> <br>     if (m_param->bEnableRdRefine && depth <= m_slice->m_pps->maxCuDQPDepth)<br>@@ -620,6 +632,8 @@<br>     md.bestMode->cu.copyToPic(depth);<br>     if (md.bestMode != &md.pred[PRED_SPLIT])<br>         md.bestMode->reconYuv.copyToPicYuv(*m_frame->m_reconPic, parentCTU.m_cuAddr, cuGeom.absPartIdx);<br>+<br>+    return md.bestMode->rdCost;<br> }<br> <br> void Analysis::PMODE::processTasks(int workerThreadId)<br>diff -r 3f6841d271e3 -r 9c2e9f6c6ee7 source/encoder/analysis.h<br>--- a/source/encoder/analysis.h Wed Jun 28 10:44:19 2017 +0530<br>+++ b/source/encoder/analysis.h Sat Jul 15 01:07:16 2017 +0800<br>@@ -145,7 +145,7 @@<br>     void qprdRefine(const CUData& parentCTU, const CUGeom& cuGeom, int32_t qp, int32_t lqp);<br> <br>     /* full analysis for an I-slice CU */<br>-    void compressIntraCU(const CUData& parentCTU, const CUGeom& cuGeom, int32_t qp);<br>+    uint64_t compressIntraCU(const CUData& parentCTU, const CUGeom& cuGeom, int32_t qp);<br> <br>     /* full analysis for a P or B slice CU */<br>     uint32_t compressInterCU_dist(const CUData& parentCTU, const CUGeom& cuGeom, int32_t qp);<br><br><br>_______________________________________________<br>x265-devel mailing list<br><a href="mailto:x265-devel@videolan.org" target="_blank">x265-devel@videolan.org</a><br><a href="https://mailman.videolan.org/listinfo/x265-devel" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a></p></div></div></div><p class="MsoNormal" style="margin-bottom:12.0pt"><br>_______________________________________________<br>x265-devel mailing list<br><a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br><a href="https://mailman.videolan.org/listinfo/x265-devel" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a></p></blockquote></div><p class="MsoNormal"> </p></div></div></div></body></html>