<div dir="ltr"><div></div>The satdCost returned by motionEstimate already has the mv cost added to it. You need to subtract mvcost from this to set the bool correctly.<br><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 15, 2014 at 10:10 AM, Gopu Govindaswamy <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"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Wed, Oct 15, 2014 at 12:44 AM, Steve Borho <span dir="ltr"><<a href="mailto:steve@borho.org" target="_blank">steve@borho.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div>On 10/14, <a href="mailto:gopu@multicorewareinc.com" target="_blank">gopu@multicorewareinc.com</a> wrote:<br>
> # HG changeset patch<br>
> # User Gopu Govindaswamy <<a href="mailto:gopu@multicorewareinc.com" target="_blank">gopu@multicorewareinc.com</a>><br>
> # Date 1413280221 -19800<br>
> # Tue Oct 14 15:20:21 2014 +0530<br>
> # Node ID 188757dfe944c7e70429ffe1316775d135d87d13<br>
> # Parent f26e81eb555aa586380b34314c302ea9b148f357<br>
> search: dump the best motion statistics for P&B slices into analysisdata file<br>
><br>
> diff -r f26e81eb555a -r 188757dfe944 source/Lib/TLibCommon/TComRom.h<br>
> --- a/source/Lib/TLibCommon/TComRom.h Mon Oct 13 14:36:40 2014 +0530<br>
> +++ b/source/Lib/TLibCommon/TComRom.h Tue Oct 14 15:20:21 2014 +0530<br>
> @@ -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>
> diff -r f26e81eb555a -r 188757dfe944 source/encoder/analysis.cpp<br>
> --- a/source/encoder/analysis.cpp Mon Oct 13 14:36:40 2014 +0530<br>
> +++ b/source/encoder/analysis.cpp Tue Oct 14 15:20:21 2014 +0530<br>
> @@ -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,10 +715,10 @@<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>
> + int qp = outTempCU->getQP(0);<br>
> + subBestPartCU->initSubCU(outTempCU, child_cu, partUnitIdx, nextDepth, qp); // clear sub partition datas or init.<br>
> subTempPartCU->initSubCU(outTempCU, child_cu, partUnitIdx, nextDepth, qp); // clear sub partition datas or init.<br>
><br>
> if (partUnitIdx) // initialize RD with previous depth buffer<br>
> @@ -1386,6 +1389,10 @@<br>
> m_bestRecoYuv[depth]->copyToPicYuv(pic->getPicYuvRec(), cuAddr, absPartIdx);<br>
> }<br>
><br>
> + /* increment the analysisData buffer for each recursive call */<br>
> + if (m_interAnalysisData)<br>
> + m_interAnalysisData++;<br>
> +<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>
> @@ -1450,6 +1457,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 +2104,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 +2135,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>
> diff -r f26e81eb555a -r 188757dfe944 source/encoder/analysis.h<br>
> --- a/source/encoder/analysis.h Mon Oct 13 14:36:40 2014 +0530<br>
> +++ b/source/encoder/analysis.h Tue Oct 14 15:20:21 2014 +0530<br>
> @@ -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>
> diff -r f26e81eb555a -r 188757dfe944 source/encoder/search.cpp<br>
> --- a/source/encoder/search.cpp Mon Oct 13 14:36:40 2014 +0530<br>
> +++ b/source/encoder/search.cpp Tue Oct 14 15:20:21 2014 +0530<br>
> @@ -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>
> + bool costZero[2];<br>
<br>
</div></div>it would be cleaner to add costZero to MotionData<br>
<span><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>
</span>since satdCost includes MV cost, it doesn't seem possible for it to ever<br>
be completely zero<br></blockquote><div><br></div></div></div><div> Yes right, For analysis load mode if the satdCost is zero for any MV, we are just take the MV cost, not necessary to call subpelCompare, i have given the snapshot of the logic below<br> <br> if (isCostZero)<br> satdCost = m_me.mvcost(bmv);<br> else<br> satdCost = m_me.subpelCompare(&slice->m_mref[l][ref], bmv, m_me.satd) + m_me.mvcost(bmv);<br><br></div><div> bmv - is the shared MVs, this will be an separate patch for sharing MVs<br></div><div><div class="h5"><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div><div><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>
> diff -r f26e81eb555a -r 188757dfe944 source/encoder/search.h<br>
> --- a/source/encoder/search.h Mon Oct 13 14:36:40 2014 +0530<br>
> +++ b/source/encoder/search.h Tue Oct 14 15:20:21 2014 +0530<br>
> @@ -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>> _______________________________________________<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><br>
<span><font color="#888888"><br>
--<br>
Steve Borho<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><br>
</font></span></blockquote></div></div></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><br>-- <br>Thanks & Regards<br>Gopu G<br>Multicoreware Inc <br><br>
</font></span></div></div>
<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>
<br></blockquote></div><br></div>