<div dir="ltr"><div>I wanted to check the performance gain, I measured about 10% improvement for slightly less bitrate, slightly less ssim. <br><br></div>But yes, psy-rd might suffer due to the averaging effect of bidir. For rd 2, certainly makes sense.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 11, 2015 at 7:20 PM, 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 03/11, <a href="mailto:deepthi@multicorewareinc.com">deepthi@multicorewareinc.com</a> wrote:<br>
> # HG changeset patch<br>
> # User Deepthi Nandakumar <<a href="mailto:deepthi@multicorewareinc.com">deepthi@multicorewareinc.com</a>><br>
> # Date 1426065176 -19800<br>
> # Wed Mar 11 14:42:56 2015 +0530<br>
> # Node ID 7d8f7aadfb6d0af071d804a3eec1511cd00818c5<br>
> # Parent 37ec8002eba15ec3b7bf2b16a792af572b099078<br>
> analysis: bidir/inter choice using sa8dCost<br>
><br>
> diff -r 37ec8002eba1 -r 7d8f7aadfb6d source/encoder/analysis.cpp<br>
> --- a/source/encoder/analysis.cpp Wed Mar 11 14:31:57 2015 +0530<br>
> +++ b/source/encoder/analysis.cpp Wed Mar 11 14:42:56 2015 +0530<br>
> @@ -749,7 +749,7 @@<br>
> /* Compute Merge Cost */<br>
> md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom);<br>
> md.pred[PRED_SKIP].cu.initSubCU(parentCTU, cuGeom);<br>
> - checkMerge2Nx2N_rd0_4(md.pred[PRED_SKIP], md.pred[PRED_MERGE], cuGeom);<br>
> + checkMerge2Nx2N_rd0_4(md.pred[PRED_SKIP], md.pred[PRED_MERGE], cuGeom); /* writes into md.bestMode */<br>
><br>
> bool earlyskip = false;<br>
> if (m_param->rdLevel)<br>
> @@ -822,24 +822,26 @@<br>
><br>
> if (m_param->rdLevel >= 3)<br>
> {<br>
> - /* Calculate RD cost of best inter option */<br>
> - if (!m_bChromaSa8d) /* When m_bChromaSa8d is enabled, chroma MC has already been done */<br>
> - {<br>
> - for (uint32_t puIdx = 0; puIdx < bestInter->cu.getNumPartInter(); puIdx++)<br>
> - {<br>
> - PredictionUnit pu(bestInter->cu, cuGeom, puIdx);<br>
> - motionCompensation(bestInter->cu, pu, bestInter->predYuv, false, true);<br>
> - }<br>
> - }<br>
> - encodeResAndCalcRdInterCU(*bestInter, cuGeom);<br>
> - checkBestMode(*bestInter, depth);<br>
> -<br>
> - /* If BIDIR is available and within 17/16 of best inter option, choose by RDO */<br>
> + /* If BIDIR is available and within 17/16 of best inter option, choose bidir */<br>
> if (m_slice->m_sliceType == B_SLICE && md.pred[PRED_BIDIR].sa8dCost != MAX_INT64 &&<br>
> md.pred[PRED_BIDIR].sa8dCost * 16 <= bestInter->sa8dCost * 17)<br>
> {<br>
> encodeResAndCalcRdInterCU(md.pred[PRED_BIDIR], cuGeom);<br>
> - checkBestMode(md.pred[PRED_BIDIR], depth);<br>
> + checkBestMode(md.pred[PRED_BIDIR], depth); /* compare against Merge by RDO*/<br>
> + }<br>
> + else<br>
> + {<br>
> + /* Calculate RD cost of best inter option */<br>
> + if (!m_bChromaSa8d) /* When m_bChromaSa8d is enabled, chroma MC has already been done */<br>
> + {<br>
> + for (uint32_t puIdx = 0; puIdx < bestInter->cu.getNumPartInter(); puIdx++)<br>
> + {<br>
> + PredictionUnit pu(bestInter->cu, cuGeom, puIdx);<br>
> + motionCompensation(bestInter->cu, pu, bestInter->predYuv, false, true);<br>
> + }<br>
> + }<br>
> + encodeResAndCalcRdInterCU(*bestInter, cuGeom);<br>
> + checkBestMode(*bestInter, depth);<br>
> }<br>
<br>
</div></div>If bidir sa8d is within 17/16 of skip/merge sa8d, then compare bidir RD<br>
cost with merge/skip RD cost, else compare merge/skip RD with best inter<br>
RD cost?<br>
<br>
It's giving up the chance to compare inter (psy-)RD cost against bidir<br>
(psy-)RD cost. It might be appropriate for RD levels 0..2, but the case<br>
for 3 and 4 is less solid.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Steve Borho<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>
</font></span></blockquote></div><br></div>