<div dir="ltr"><div><div><div><div><div><div>I have a few questions.<br><br></div>1. Do we need so many local variables?<br></div><br></div>2. Why are we adding outTempCU->cost to totalCost and then comparing against outBestCU->cost? That doesnt make much sense to me. AFAIk, outTempCU does not contain any valid data - we should remove this.<br>
<br></div>3. Should we be adding costCUColocated0 and costCUColocated1 also? Adding up spatial and temporal costs, and then comparing against a threshold derived from spatial costs - umm, no. Lets leave these out. <br><br>
</div>4. The rest of it looks ok, logically. But now you may need to re-tune this with different weights. <br><br></div>Best,<br>Deepthi<br><div><br><br><div><br><br><div><div><div><br><br><br><div><div><div><div id="__tbSetup">
</div></div></div></div></div></div></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Nov 7, 2013 at 4:59 PM, <span dir="ltr"><<a href="mailto:sumalatha@multicorewareinc.com" target="_blank">sumalatha@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 Sumalatha Polureddy<br>
# Date 1383823751 -19800<br>
# Node ID a54b30b16e83048a7a2ef5584e1e1c9682216075<br>
# Parent 0a1b379be359cbcf76140ac392104c856a037c78<br>
no-rdo: giving weightage to the cost of all CU's and neighbour CU's for early exit<br>
<br>
Early exit is done when CU cost at depth "n" is lessthan sum of 60% of avgcost of all CU's<br>
and 40% of avgcost of neighbour CU's at same depth.<br>
<br>
diff -r 0a1b379be359 -r a54b30b16e83 source/Lib/TLibCommon/TComPic.cpp<br>
--- a/source/Lib/TLibCommon/TComPic.cpp Thu Nov 07 18:17:52 2013 +0800<br>
+++ b/source/Lib/TLibCommon/TComPic.cpp Thu Nov 07 16:59:11 2013 +0530<br>
@@ -69,6 +69,14 @@<br>
m_ssimCnt = 0;<br>
m_frameTime = 0.0;<br>
m_elapsedCompressTime = 0.0;<br>
+ m_avgCost[0] = 0;<br>
+ m_avgCost[1] = 0;<br>
+ m_avgCost[2] = 0;<br>
+ m_avgCost[3] = 0;<br>
+ m_count[0] = 0;<br>
+ m_count[1] = 0;<br>
+ m_count[2] = 0;<br>
+ m_count[3] = 0;<br>
}<br>
<br>
TComPic::~TComPic()<br>
diff -r 0a1b379be359 -r a54b30b16e83 source/Lib/TLibCommon/TComPic.h<br>
--- a/source/Lib/TLibCommon/TComPic.h Thu Nov 07 18:17:52 2013 +0800<br>
+++ b/source/Lib/TLibCommon/TComPic.h Thu Nov 07 16:59:11 2013 +0530<br>
@@ -95,6 +95,8 @@<br>
MD5Context m_state[3];<br>
uint32_t m_crc[3];<br>
uint32_t m_checksum[3];<br>
+ UInt64 m_avgCost[4];<br>
+ uint32_t m_count[4];<br>
<br>
/* SSIM values per frame */<br>
double m_ssim;<br>
diff -r 0a1b379be359 -r a54b30b16e83 source/encoder/compress.cpp<br>
--- a/source/encoder/compress.cpp Thu Nov 07 18:17:52 2013 +0800<br>
+++ b/source/encoder/compress.cpp Thu Nov 07 16:59:11 2013 +0530<br>
@@ -567,13 +567,14 @@<br>
if (bSubBranch && bTrySplitDQP && depth < g_maxCUDepth - g_addCUDepth)<br>
{<br>
#if EARLY_EXIT // turn ON this to enable early exit<br>
- // early exit when the RD cost of best mode at depth n is less than the avgerage of RD cost of the<br>
- // CU's(above, aboveleft, aboveright, left, colocated) at depth "n" of previosuly coded CU's<br>
+ // early exit when the RD cost of best mode at depth n is less than the sum of avgerage of RD cost of the neighbour<br>
+ // CU's(above, aboveleft, aboveright, left, colocated) and all CU's at depth "n" with weightage for each quantity<br>
if (outBestCU != 0)<br>
{<br>
- UInt64 costCU = 0, costCUAbove = 0, costCUAboveLeft = 0, costCUAboveRight = 0, costCULeft = 0, costCUColocated0 = 0, costCUColocated1 = 0, totalCost = 0, avgCost = 0;<br>
+ UInt64 costCU = 0, costCUAbove = 0, costCUAboveLeft = 0, costCUAboveRight = 0, costCULeft = 0, costCUColocated0 = 0, costCUColocated1 = 0, totalCostNeigh = 0, totalCostAll = 0;<br>
+ double avgCost = 0;<br>
UInt64 countCU = 0, countCUAbove = 0, countCUAboveLeft = 0, countCUAboveRight = 0, countCULeft = 0, countCUColocated0 = 0, countCUColocated1 = 0;<br>
- UInt64 totalCount = 0;<br>
+ UInt64 totalCountNeigh = 0, totalCountAll = 0;<br>
TComDataCU* above = outTempCU->getCUAbove();<br>
TComDataCU* aboveLeft = outTempCU->getCUAboveLeft();<br>
TComDataCU* aboveRight = outTempCU->getCUAboveRight();<br>
@@ -614,10 +615,15 @@<br>
countCUColocated1 = colocated1->m_count[depth];<br>
}<br>
<br>
- totalCost = costCU + costCUAbove + costCUAboveLeft + costCUAboveRight + costCULeft + costCUColocated0 + costCUColocated1;<br>
- totalCount = countCU + countCUAbove + countCUAboveLeft + countCUAboveRight + countCULeft + countCUColocated0 + countCUColocated1;<br>
- if (totalCount != 0)<br>
- avgCost = totalCost / totalCount;<br>
+ totalCostNeigh = costCU + costCUAbove + costCUAboveLeft + costCUAboveRight + costCULeft + costCUColocated0 + costCUColocated1;<br>
+ totalCountNeigh = countCU + countCUAbove + countCUAboveLeft + countCUAboveRight + countCULeft + countCUColocated0 + countCUColocated1;<br>
+<br>
+ totalCostAll = (outTempCU->getPic()->m_avgCost[depth] * outTempCU->getPic()->m_count[depth]) - totalCostNeigh;<br>
+ totalCountAll = outTempCU->getPic()->m_count[depth] - totalCountNeigh;<br>
+<br>
+ //giving 60% weight to all CU's and 40% weight to neighbour CU's<br>
+ if (totalCountAll)<br>
+ avgCost = ((0.6 * totalCostAll) + (0.4 * totalCostNeigh)) / ((0.6 * totalCountAll) + (0.4 * totalCountNeigh));<br>
<br>
float lambda = 1.0f;<br>
<br>
@@ -672,6 +678,9 @@<br>
outTempCU->getPic()->getPicSym()->getCU(outTempCU->getAddr())->m_count[depth + 1] += 1;<br>
outTempCU->m_avgCost[depth + 1] = (temp + tempavgCost) / outTempCU->m_count[depth + 1];<br>
outTempCU->getPic()->getPicSym()->getCU(outTempCU->getAddr())->m_avgCost[depth + 1] = outTempCU->m_avgCost[depth + 1];<br>
+ temp = outTempCU->getPic()->m_avgCost[depth+1] * outTempCU->getPic()->m_count[depth+1];<br>
+ outTempCU->getPic()->m_count[depth+1] += 1;<br>
+ outTempCU->getPic()->m_avgCost[depth+1] = (temp + tempavgCost) / outTempCU->getPic()->m_count[depth+1];<br>
}<br>
#endif // if EARLY_EXIT<br>
/* Adding costs from best SUbCUs */<br>
@@ -775,9 +784,12 @@<br>
UInt64 temp = outTempCU->m_avgCost[depth] * outTempCU->m_count[depth];<br>
outTempCU->m_count[depth] += 1;<br>
outTempCU->getPic()->getPicSym()->getCU(outTempCU->getAddr())->m_count[depth] += 1;<br>
-<br>
outTempCU->m_avgCost[depth] = (temp + tempavgCost) / outTempCU->m_count[depth];<br>
outTempCU->getPic()->getPicSym()->getCU(outTempCU->getAddr())->m_avgCost[depth] = outTempCU->m_avgCost[depth];<br>
+<br>
+ temp = outTempCU->getPic()->m_avgCost[depth] * outTempCU->getPic()->m_count[depth];<br>
+ outTempCU->getPic()->m_count[depth] += 1;<br>
+ outTempCU->getPic()->m_avgCost[depth] = (temp + tempavgCost) / outTempCU->getPic()->m_count[depth];<br>
}<br>
if (outTempCU->m_totalCost < outBestCU->m_totalCost)<br>
{<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><br>
</blockquote></div><br></div>