<div dir="ltr">Please ignore this patch<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 14, 2014 at 12:08 PM, <span dir="ltr"><<a href="mailto:gopu@multicorewareinc.com" target="_blank">gopu@multicorewareinc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""># HG changeset patch<br>
# User Gopu Govindaswamy <<a href="mailto:gopu@multicorewareinc.com">gopu@multicorewareinc.com</a>><br>
</span># Date 1413268677 -19800<br>
# Tue Oct 14 12:07:57 2014 +0530<br>
# Node ID ef61b042ab3678c9d27b819efed46f5be8969c32<br>
<span class=""># Parent f26e81eb555aa586380b34314c302ea9b148f357<br>
search: dump best motion statistics for P and B slices into analysisdata file<br>
<br>
</span>diff -r f26e81eb555a -r ef61b042ab36 source/Lib/TLibCommon/TComRom.h<br>
<span class="">--- a/source/Lib/TLibCommon/TComRom.h Mon Oct 13 14:36:40 2014 +0530<br>
</span>+++ b/source/Lib/TLibCommon/TComRom.h Tue Oct 14 12:07:57 2014 +0530<br>
<span class="">@@ -68,6 +68,8 @@<br>
<br>
#define SLFASE_CONSTANT 0x5f4e4a53<br>
<br>
+#define MAX_RECURSIVE 85 //maximum recursive call for each cu<br>
+<br>
void initROM();<br>
void destroyROM();<br>
<br>
</span>diff -r f26e81eb555a -r ef61b042ab36 source/encoder/analysis.cpp<br>
<span class="">--- a/source/encoder/analysis.cpp Mon Oct 13 14:36:40 2014 +0530<br>
</span>+++ b/source/encoder/analysis.cpp Tue Oct 14 12:07:57 2014 +0530<br>
<span class="">@@ -477,6 +477,9 @@<br>
}<br>
else<br>
{<br>
+ if (m_param->analysisMode)<br>
+ m_interAnalysisData = ctu->m_pic->m_interData + (ctu->m_cuAddr * MAX_RECURSIVE);<br>
+<br>
if (m_param->rdLevel < 5)<br>
{<br>
TComDataCU* outBestCU = NULL;<br>
@@ -712,8 +715,6 @@<br>
for (uint32_t partUnitIdx = 0; partUnitIdx < 4; partUnitIdx++)<br>
{<br>
CU *child_cu = pic->getCU(outTempCU->m_cuAddr)->m_cuLocalData + cu->childIdx + partUnitIdx;<br>
- int qp = outTempCU->getQP(0);<br>
- subBestPartCU->initSubCU(outTempCU, child_cu, partUnitIdx, nextDepth, qp); // clear sub partition datas or init.<br>
if (child_cu->flags & CU::PRESENT)<br>
{<br>
subTempPartCU->initSubCU(outTempCU, child_cu, partUnitIdx, nextDepth, qp); // clear sub partition datas or init.<br>
</span>@@ -1386,6 +1387,10 @@<br>
m_bestRecoYuv[depth]->copyToPicYuv(pic->getPicYuvRec(), cuAddr, absPartIdx);<br>
<span class=""> }<br>
<br>
+ /* increment the analysisData buffer for each recursive call */<br>
+ if (m_interAnalysisData)<br>
+ m_interAnalysisData++;<br>
</span>+<br>
#if CHECKED_BUILD || _DEBUG<br>
/* Assert if Best prediction mode is NONE<br>
* Selected mode's RD-cost must be not MAX_INT64 */<br>
<span class="">@@ -1450,6 +1455,10 @@<br>
outTempCU->initEstData();<br>
if (m_param->bEnableCbfFastMode)<br>
doNotBlockPu = outBestCU->getQtRootCbf(0) != 0;<br>
+<br>
+ /* increment the analysisData buffer for each recursive call */<br>
+ if (m_interAnalysisData)<br>
+ m_interAnalysisData++;<br>
}<br>
}<br>
<br>
@@ -2093,7 +2102,7 @@<br>
cu->m_totalDistortion = primitives.sa8d[sizeIdx](m_origYuv[depth]->getLumaAddr(), m_origYuv[depth]->getStride(), predYuv->getLumaAddr(), predYuv->getStride());<br>
cu->m_sa8dCost = m_rdCost.calcRdSADCost(cu->m_totalDistortion, cu->m_totalBits);<br>
}<br>
- else if (predInterSearch(cu, cuData, predYuv, false, false))<br>
+ else if (predInterSearch(cu, cuData, predYuv, false, false, m_interAnalysisData))<br>
{<br>
int sizeIdx = cu->getLog2CUSize(0) - 2;<br>
uint32_t distortion = primitives.sa8d[sizeIdx](m_origYuv[depth]->getLumaAddr(), m_origYuv[depth]->getStride(), predYuv->getLumaAddr(), predYuv->getStride());<br>
@@ -2124,7 +2133,7 @@<br>
checkDQP(tempCU);<br>
checkBestMode(bestCU, tempCU, depth);<br>
}<br>
- else if (predInterSearch(tempCU, cuData, m_tmpPredYuv[depth], bMergeOnly, true))<br>
+ else if (predInterSearch(tempCU, cuData, m_tmpPredYuv[depth], bMergeOnly, true, m_interAnalysisData))<br>
{<br>
encodeResAndCalcRdInterCU(tempCU, cuData, m_origYuv[depth], m_tmpPredYuv[depth], m_tmpResiYuv[depth], m_bestResiYuv[depth], m_tmpRecoYuv[depth]);<br>
checkDQP(tempCU);<br>
</span>diff -r f26e81eb555a -r ef61b042ab36 source/encoder/analysis.h<br>
<span class="">--- a/source/encoder/analysis.h Mon Oct 13 14:36:40 2014 +0530<br>
</span>+++ b/source/encoder/analysis.h Tue Oct 14 12:07:57 2014 +0530<br>
<span class="">@@ -109,6 +109,7 @@<br>
<br>
StatisticLog m_sliceTypeLog[3];<br>
StatisticLog* m_log;<br>
+ x265_inter_data* m_interAnalysisData; // To store the inter analysis data per CU<br>
<br>
Analysis();<br>
bool create(uint32_t totalDepth, uint32_t maxWidth, ThreadLocalData* tld);<br>
</span>diff -r f26e81eb555a -r ef61b042ab36 source/encoder/search.cpp<br>
<span class="">--- a/source/encoder/search.cpp Mon Oct 13 14:36:40 2014 +0530<br>
</span>+++ b/source/encoder/search.cpp Tue Oct 14 12:07:57 2014 +0530<br>
<span class="">@@ -1684,7 +1684,7 @@<br>
<br>
/* search of the best candidate for inter prediction<br>
* returns true if predYuv was filled with a motion compensated prediction */<br>
-bool Search::predInterSearch(TComDataCU* cu, CU* cuData, TComYuv* predYuv, bool bMergeOnly, bool bChroma)<br>
+bool Search::predInterSearch(TComDataCU* cu, CU* cuData, TComYuv* predYuv, bool bMergeOnly, bool bChroma, x265_inter_data* interAnalysisData)<br>
{<br>
MV amvpCand[2][MAX_NUM_REF][AMVP_NUM_CANDS];<br>
MV mvc[(MD_ABOVE_LEFT + 1) * 2 + 1];<br>
@@ -1755,6 +1755,11 @@<br>
list[0].cost = MAX_UINT;<br>
list[1].cost = MAX_UINT;<br>
<br>
+ /* require for sharing mode, if cost is zero no need to call subpelCompare<br>
+ * extract the best cost from mvcost and this is only for actual me, not required for<br>
+ * lowres me and isCostZero is NULL when the me is called from slicetype */<br>
</span><span class="">+ bool costZero[2];<br>
+<br>
getBlkBits(partSize, slice->isInterP(), partIdx, lastMode, listSelBits);<br>
<br>
// Uni-directional prediction<br>
@@ -1812,10 +1817,24 @@<br>
list[l].ref = ref;<br>
list[l].cost = cost;<br>
list[l].bits = bits;<br>
+ costZero[l] = !!satdCost;<br>
}<br>
}<br>
}<br>
<br>
+ if (m_param->analysisMode == X265_ANALYSIS_SAVE && interAnalysisData)<br>
+ {<br>
+ for (int32_t i = 0; i < 2; i++)<br>
+ {<br>
+ interAnalysisData->costZero[i] = costZero[i];<br>
+ interAnalysisData->mvx[i] = list[i].mv.x;<br>
+ interAnalysisData->mvy[i] = list[i].mv.y;<br>
+ interAnalysisData->ref[i] = list[i].ref;<br>
+ }<br>
+ interAnalysisData->zOrder = cu->m_absIdxInCTU;<br>
+ interAnalysisData->depth = cu->getDepth(0);<br>
+ }<br>
+<br>
// Bi-directional prediction<br>
if (slice->isInterB() && !cu->isBipredRestriction() && list[0].cost != MAX_UINT && list[1].cost != MAX_UINT)<br>
{<br>
</span>diff -r f26e81eb555a -r ef61b042ab36 source/encoder/search.h<br>
<span class="">--- a/source/encoder/search.h Mon Oct 13 14:36:40 2014 +0530<br>
</span>+++ b/source/encoder/search.h Tue Oct 14 12:07:57 2014 +0530<br>
<div class="HOEnZb"><div class="h5">@@ -101,7 +101,7 @@<br>
void estIntraPredChromaQT(TComDataCU* cu, CU* cuData, TComYuv* fencYuv, TComYuv* predYuv, ShortYuv* resiYuv, TComYuv* reconYuv);<br>
<br>
// estimation inter prediction (non-skip)<br>
- bool predInterSearch(TComDataCU* cu, CU* cuData, TComYuv* predYuv, bool bMergeOnly, bool bChroma);<br>
+ bool predInterSearch(TComDataCU* cu, CU* cuData, TComYuv* predYuv, bool bMergeOnly, bool bChroma, x265_inter_data* m_interAnalysisData);<br>
<br>
// encode residual and compute rd-cost for inter mode<br>
void encodeResAndCalcRdInterCU(TComDataCU* cu, CU* cuData, TComYuv* fencYuv, TComYuv* predYuv, ShortYuv* resiYuv, ShortYuv* bestResiYuv, TComYuv* reconYuv);<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Thanks & Regards<br>Gopu G<br>Multicoreware Inc <br><br>
</div>