<div dir="ltr">Ok, Identified the root cause, the issue here is the reference state of the reference frame getting changed during the encode, <div>this cause the CU QP is non-deterministic for this frame, and this is the reason for inconsistent output when we use frame-threads > 1,</div>
<div><br></div><div>I have fixed this issue, and will send the patch</div><div><br></div><div>Thanks </div><div>Gopu G<br><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Apr 3, 2014 at 12:22 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On Wed, Apr 2, 2014 at 12:52 AM,  <<a href="mailto:gopu@multicorewareinc.com">gopu@multicorewareinc.com</a>> wrote:<br>

</div><div><div class="h5">> # HG changeset patch<br>
> # User Gopu Govindaswamy<br>
> # Date 1396417894 -19800<br>
> #      Wed Apr 02 11:21:34 2014 +0530<br>
> # Node ID 931b4cd4da91dc667efd16d26b4e9ea834007623<br>
> # Parent  03bad90e94adce6fb89c6d5edb86919a1e783402<br>
> cutree: when cutree enabled P_SLICE CU QP always calculated from qpoffset,<br>
><br>
> diff -r 03bad90e94ad -r 931b4cd4da91 source/encoder/frameencoder.cpp<br>
> --- a/source/encoder/frameencoder.cpp   Wed Apr 02 06:51:35 2014 +0530<br>
> +++ b/source/encoder/frameencoder.cpp   Wed Apr 02 11:21:34 2014 +0530<br>
> @@ -1228,7 +1228,17 @@<br>
>      int block_y = (cuAddr / m_pic->getPicSym()->getFrameWidthInCU()) * noOfBlocks;<br>
>      int block_x = (cuAddr * noOfBlocks) - block_y * m_pic->getPicSym()->getFrameWidthInCU();<br>
><br>
> -    double *qpoffs = (m_pic->getSlice()->isReferenced() && m_cfg->param->rc.cuTree) ? m_pic->m_lowres.qpOffset : m_pic->m_lowres.qpAqOffset;<br>
> +    double *qpoffs;<br>
> +    if (m_cfg->param->rc.cuTree)<br>
> +    {<br>
> +       if(m_pic->getSlice()->isReferenced() || m_pic->getSlice()->getSliceType() == P_SLICE)<br>
> +           qpoffs = m_pic->m_lowres.qpOffset;<br>
> +       else<br>
> +           qpoffs = m_pic->m_lowres.qpAqOffset;<br>
> +    }<br>
> +    else<br>
> +       qpoffs = m_pic->m_lowres.qpAqOffset;<br>
<br>
</div></div>Ok, I've realized qpOffset is the buffer holding the cuTree adjusted<br>
offsets while qpAqOffset has just the AQ adjustments (these variable<br>
names suck, but that is out-of-scope for this patch discussion)<br>
<br>
So the net effect of this patch is to treat all P slices as referenced<br>
and force them to use cuTree modified AQ offsets because apparently<br>
the reference flag is not deterministic.<br>
<br>
Your commit message was unclear, it should have looked more like this:<br>
<br>
"""<br>
cutree: force P slices to use cuTree offsets, even if unreferenced<br>
<br>
We find that the referenced state of P frames is non-deterministic,<br>
leading to non-deterministic encodes.  This patch makes the encodes<br>
deterministic.<br>
"""<br>
<br>
Then we could make a better evaluation on the merits of the patch, and<br>
the first thing that pops into my head is:  "Why is the reference<br>
state of P frames non-deterministic?" That is the root cause of the<br>
problem and it needs to be tackled next.  Once that is fixed this<br>
workaround can be backed out, since I see an equivalent patch was<br>
already applied.<br>
<div class="HOEnZb"><div class="h5"><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>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Thanks & Regards<br>Gopu G<br>Multicoreware Inc <br><br>
</div>