<div dir="ltr"><div># HG changeset patch</div><div># User Bhavna Hariharan <<a href="mailto:bhavna@multicorewareinc.com">bhavna@multicorewareinc.com</a>></div><div># Date 1479380469 -19800</div><div># Thu Nov 17 16:31:09 2016 +0530</div><div># Node ID d4425aa677c63b8486dde5bb716f9a191da6bdaa</div><div># Parent 07a4e4d785a69f719922129ca5997b12552bb4ab</div><div>limitTU : use neighbouring CUs' TU depth to limit 1st subTU's depth</div><div><br></div><div>diff -r 07a4e4d785a6 -r d4425aa677c6 source/encoder/analysis.cpp</div><div>--- a/source/encoder/analysis.cpp<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>Thu Nov 17 12:19:38 2016 +0530</div><div>+++ b/source/encoder/analysis.cpp<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>Thu Nov 17 16:31:09 2016 +0530</div><div>@@ -377,7 +377,7 @@</div><div> checkBestMode(md.pred[PRED_INTRA_NxN], depth);</div><div> }</div><div> </div><div>- if (limitTU == X265_TU_LIMIT_NEIGH && cuGeom.log2CUSize >= 4)</div><div>+ if ((limitTU & X265_TU_LIMIT_NEIGH) && cuGeom.log2CUSize >= 4)</div><div> {</div><div> CUData* ctu = md.bestMode->cu.m_encData->getPicCTU(parentCTU.m_cuAddr);</div><div> int8_t maxTUDepth = -1;</div><div>@@ -954,7 +954,7 @@</div><div> bool skipRectAmp = false;</div><div> bool chooseMerge = false;</div><div> </div><div>- if (limitTU == X265_TU_LIMIT_NEIGH && cuGeom.log2CUSize >= 4)</div><div>+ if ((limitTU & X265_TU_LIMIT_NEIGH) && cuGeom.log2CUSize >= 4)</div><div> m_maxTUDepth = loadTUDepth(cuGeom, parentCTU);</div><div> </div><div> SplitData splitData[4];</div><div>@@ -1463,7 +1463,7 @@</div><div> if (m_param->rdLevel)</div><div> md.bestMode->reconYuv.copyToPicYuv(reconPic, cuAddr, cuGeom.absPartIdx);</div><div> </div><div>- if (limitTU == X265_TU_LIMIT_NEIGH && cuGeom.log2CUSize >= 4)</div><div>+ if ((limitTU & X265_TU_LIMIT_NEIGH) && cuGeom.log2CUSize >= 4)</div><div> {</div><div> if (mightNotSplit)</div><div> {</div><div>@@ -1498,7 +1498,7 @@</div><div> md.pred[PRED_2Nx2N].rdCost = 0;</div><div> }</div><div> </div><div>- if (limitTU == X265_TU_LIMIT_NEIGH && cuGeom.log2CUSize >= 4)</div><div>+ if ((limitTU & X265_TU_LIMIT_NEIGH) && cuGeom.log2CUSize >= 4)</div><div> m_maxTUDepth = loadTUDepth(cuGeom, parentCTU);</div><div> </div><div> SplitData splitData[4];</div><div>@@ -1827,7 +1827,7 @@</div><div> if (mightSplit)</div><div> addSplitFlagCost(*md.bestMode, cuGeom.depth);</div><div> }</div><div>- if (limitTU == X265_TU_LIMIT_NEIGH && cuGeom.log2CUSize >= 4)</div><div>+ if ((limitTU & X265_TU_LIMIT_NEIGH) && cuGeom.log2CUSize >= 4)</div><div> {</div><div> if (mightNotSplit)</div><div> {</div><div>diff -r 07a4e4d785a6 -r d4425aa677c6 source/encoder/search.cpp</div><div>--- a/source/encoder/search.cpp<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>Thu Nov 17 12:19:38 2016 +0530</div><div>+++ b/source/encoder/search.cpp<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>Thu Nov 17 16:31:09 2016 +0530</div><div>@@ -2625,7 +2625,7 @@</div><div> </div><div> uint32_t tuDepthRange[2];</div><div> cu.getInterTUQtDepthRange(tuDepthRange, 0);</div><div>- if (limitTU == X265_TU_LIMIT_NEIGH)</div><div>+ if (limitTU & X265_TU_LIMIT_NEIGH)</div><div> {</div><div> int maxLog2CUSize = (int)g_log2Size[m_param->maxCUSize];</div><div> m_maxTUDepth = x265_clip3(maxLog2CUSize - (int32_t)tuDepthRange[1], maxLog2CUSize - (int32_t)tuDepthRange[0], m_maxTUDepth);</div><div>@@ -2639,7 +2639,14 @@</div><div> memset(&m_cacheTU, 0, sizeof(TUInfoCache));</div><div> </div><div> Cost costs;</div><div>- estimateResidualQT(interMode, cuGeom, 0, 0, *resiYuv, costs, tuDepthRange);</div><div>+ if (limitTU == X265_TU_LIMIT_DFS_NEIGH)</div><div>+ {</div><div>+ int32_t tempDepth = m_maxTUDepth;</div><div>+ estimateResidualQT(interMode, cuGeom, 0, 0, *resiYuv, costs, tuDepthRange);</div><div>+ m_maxTUDepth = tempDepth;</div><div>+ }</div><div>+ else</div><div>+ estimateResidualQT(interMode, cuGeom, 0, 0, *resiYuv, costs, tuDepthRange);</div><div> </div><div> uint32_t tqBypass = cu.m_tqBypass[0];</div><div> if (!tqBypass)</div><div>@@ -2898,10 +2905,11 @@</div><div> uint32_t ycbf = 0, ucbf = 0, vcbf = 0;</div><div> for (uint32_t qIdx = 0, qPartIdx = absPartIdx; qIdx < 4; ++qIdx, qPartIdx += qNumParts)</div><div> {</div><div>- if (limitTU == X265_TU_LIMIT_DFS && tuDepth == 0 && qIdx == 1)</div><div>+ if (limitTU & X265_TU_LIMIT_DFS && tuDepth == 0 && qIdx == 1)</div><div> {</div><div>+ m_maxTUDepth = cu.m_tuDepth[0];</div><div> // Fetch maximum TU depth of first sub partition to limit recursion of others</div><div>- for (uint32_t i = 0; i < cuGeom.numPartitions / 4; i++)</div><div>+ for (uint32_t i = 1; i < cuGeom.numPartitions / 4; i++)</div><div> m_maxTUDepth = X265_MAX(m_maxTUDepth, cu.m_tuDepth[i]);</div><div> }</div><div> estimateResidualQT(mode, cuGeom, qPartIdx, tuDepth + 1, resiYuv, splitCost, depthRange, splitMore);</div><div>@@ -2968,7 +2976,7 @@</div><div> }</div><div> }</div><div> }</div><div>- else if (limitTU == X265_TU_LIMIT_DFS || limitTU == X265_TU_LIMIT_NEIGH)</div><div>+ else if (limitTU & X265_TU_LIMIT_DFS_NEIGH)</div><div> {</div><div> if (bCheckSplit && m_maxTUDepth >= 0)</div><div> {</div><div><br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><br>Regards,<br><br>Bhavna Hariharan<br></div></div></div></div></div>
<br><div class="gmail_quote">On Thu, Nov 17, 2016 at 5:06 PM, <span dir="ltr"><<a href="mailto:bhavna@multicorewareinc.com" target="_blank">bhavna@multicorewareinc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Bhavna Hariharan <<a href="mailto:bhavna@multicorewareinc.com">bhavna@multicorewareinc.com</a>><br>
# Date 1479380469 -19800<br>
# Thu Nov 17 16:31:09 2016 +0530<br>
# Node ID f5d3a5aedcdf20235ec76dbf9aba51<wbr>6da83e8dd1<br>
# Parent 07a4e4d785a69f719922129ca5997b<wbr>12552bb4ab<br>
limitTU : use neighbouring CUs' TU depth to limit 1st subTU's depth<br>
<br>
diff -r 07a4e4d785a6 -r f5d3a5aedcdf source/encoder/analysis.cpp<br>
--- a/source/encoder/analysis.cpp Thu Nov 17 12:19:38 2016 +0530<br>
+++ b/source/encoder/analysis.cpp Thu Nov 17 16:31:09 2016 +0530<br>
@@ -377,7 +377,7 @@<br>
checkBestMode(md.pred[PRED_<wbr>INTRA_NxN], depth);<br>
}<br>
<br>
- if (limitTU == X265_TU_LIMIT_NEIGH && cuGeom.log2CUSize >= 4)<br>
+ if ((limitTU & X265_TU_LIMIT_NEIGH) && cuGeom.log2CUSize >= 4)<br>
{<br>
CUData* ctu = md.bestMode->cu.m_encData-><wbr>getPicCTU(parentCTU.m_cuAddr);<br>
int8_t maxTUDepth = -1;<br>
@@ -954,7 +954,7 @@<br>
bool skipRectAmp = false;<br>
bool chooseMerge = false;<br>
<br>
- if (limitTU == X265_TU_LIMIT_NEIGH && cuGeom.log2CUSize >= 4)<br>
+ if ((limitTU & X265_TU_LIMIT_NEIGH) && cuGeom.log2CUSize >= 4)<br>
m_maxTUDepth = loadTUDepth(cuGeom, parentCTU);<br>
<br>
SplitData splitData[4];<br>
@@ -1463,7 +1463,7 @@<br>
if (m_param->rdLevel)<br>
md.bestMode->reconYuv.<wbr>copyToPicYuv(reconPic, cuAddr, cuGeom.absPartIdx);<br>
<br>
- if (limitTU == X265_TU_LIMIT_NEIGH && cuGeom.log2CUSize >= 4)<br>
+ if ((limitTU & X265_TU_LIMIT_NEIGH) && cuGeom.log2CUSize >= 4)<br>
{<br>
if (mightNotSplit)<br>
{<br>
@@ -1498,7 +1498,7 @@<br>
md.pred[PRED_2Nx2N].rdCost = 0;<br>
}<br>
<br>
- if (limitTU == X265_TU_LIMIT_NEIGH && cuGeom.log2CUSize >= 4)<br>
+ if ((limitTU & X265_TU_LIMIT_NEIGH) && cuGeom.log2CUSize >= 4)<br>
m_maxTUDepth = loadTUDepth(cuGeom, parentCTU);<br>
<br>
SplitData splitData[4];<br>
@@ -1827,7 +1827,7 @@<br>
if (mightSplit)<br>
addSplitFlagCost(*md.bestMode, cuGeom.depth);<br>
}<br>
- if (limitTU == X265_TU_LIMIT_NEIGH && cuGeom.log2CUSize >= 4)<br>
+ if ((limitTU & X265_TU_LIMIT_NEIGH) && cuGeom.log2CUSize >= 4)<br>
{<br>
if (mightNotSplit)<br>
{<br>
diff -r 07a4e4d785a6 -r f5d3a5aedcdf source/encoder/search.cpp<br>
--- a/source/encoder/search.cpp Thu Nov 17 12:19:38 2016 +0530<br>
+++ b/source/encoder/search.cpp Thu Nov 17 16:31:09 2016 +0530<br>
@@ -2625,7 +2625,7 @@<br>
<br>
uint32_t tuDepthRange[2];<br>
cu.getInterTUQtDepthRange(<wbr>tuDepthRange, 0);<br>
- if (limitTU == X265_TU_LIMIT_NEIGH)<br>
+ if (limitTU & X265_TU_LIMIT_NEIGH)<br>
{<br>
int maxLog2CUSize = (int)g_log2Size[m_param-><wbr>maxCUSize];<br>
m_maxTUDepth = x265_clip3(maxLog2CUSize - (int32_t)tuDepthRange[1], maxLog2CUSize - (int32_t)tuDepthRange[0], m_maxTUDepth);<br>
@@ -2639,7 +2639,12 @@<br>
memset(&m_cacheTU, 0, sizeof(TUInfoCache));<br>
<br>
Cost costs;<br>
- estimateResidualQT(interMode, cuGeom, 0, 0, *resiYuv, costs, tuDepthRange);<br>
+ if (limitTU == X265_TU_LIMIT_DFS_NEIGH)<br>
+ {<br>
+ int32_t tempDepth = m_maxTUDepth;<br>
+ m_maxTUDepth = tempDepth;<br>
+ }<br>
+ estimateResidualQT(interMode, cuGeom, 0, 0, *resiYuv, costs, tuDepthRange);<br>
<br>
uint32_t tqBypass = cu.m_tqBypass[0];<br>
if (!tqBypass)<br>
@@ -2898,10 +2903,11 @@<br>
uint32_t ycbf = 0, ucbf = 0, vcbf = 0;<br>
for (uint32_t qIdx = 0, qPartIdx = absPartIdx; qIdx < 4; ++qIdx, qPartIdx += qNumParts)<br>
{<br>
- if (limitTU == X265_TU_LIMIT_DFS && tuDepth == 0 && qIdx == 1)<br>
+ if (limitTU & X265_TU_LIMIT_DFS && tuDepth == 0 && qIdx == 1)<br>
{<br>
+ m_maxTUDepth = cu.m_tuDepth[0];<br>
// Fetch maximum TU depth of first sub partition to limit recursion of others<br>
- for (uint32_t i = 0; i < cuGeom.numPartitions / 4; i++)<br>
+ for (uint32_t i = 1; i < cuGeom.numPartitions / 4; i++)<br>
m_maxTUDepth = X265_MAX(m_maxTUDepth, cu.m_tuDepth[i]);<br>
}<br>
estimateResidualQT(mode, cuGeom, qPartIdx, tuDepth + 1, resiYuv, splitCost, depthRange, splitMore);<br>
@@ -2968,7 +2974,7 @@<br>
}<br>
}<br>
}<br>
- else if (limitTU == X265_TU_LIMIT_DFS || limitTU == X265_TU_LIMIT_NEIGH)<br>
+ else if (limitTU & X265_TU_LIMIT_DFS_NEIGH)<br>
{<br>
if (bCheckSplit && m_maxTUDepth >= 0)<br>
{<br>
</blockquote></div><br></div>