<p dir="ltr"><br>
For the last pass in multi pass encodes, slice types are taken from the stats file before the frame is added into the lookahead queue. We would not do slice type analysis here and just stick with slice types read from the file.<br>
So, at this point, we would already know slice types along with CUTree offsets which we also copy  from the previous pass for all referenced slices. Only for the unreferenced frames, we would need to recompute aqoffsets as the data for those won't be written in the log files.</p>
<p dir="ltr">Since calcAdaptive() rewrites all the arrays - both AQ&CUTree offsets, we should not do this and overwrite the values for referenced frames. This flow was broken when the NUMA related commits were pushed in.</p>
<div class="gmail_quote">On Mar 30, 2015 9:14 PM, "Steve Borho" <<a href="mailto:steve@borho.org">steve@borho.org</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 03/30, <a href="mailto:santhoshini@multicorewareinc.com">santhoshini@multicorewareinc.com</a> wrote:<br>
> # HG changeset patch<br>
> # User Santhoshini Sekar<<a href="mailto:santhoshini@multicorewareinc.com">santhoshini@multicorewareinc.com</a>><br>
> # Date 1427716771 -19800<br>
> #      Mon Mar 30 17:29:31 2015 +0530<br>
> # Node ID 1bdeb44d775d5be7523925017a1483294da2575d<br>
> # Parent  22a312799bb033d40a66fc83a1ac7af192ce2420<br>
> rc: fix bug in ABR 2 pass, calculate aq-offset only for unreferenced frame in 2 pass<br>
><br>
> diff -r 22a312799bb0 -r 1bdeb44d775d source/encoder/slicetype.cpp<br>
> --- a/source/encoder/slicetype.cpp    Fri Mar 27 22:59:30 2015 -0500<br>
> +++ b/source/encoder/slicetype.cpp    Mon Mar 30 17:29:31 2015 +0530<br>
> @@ -699,7 +699,7 @@<br>
>              ProfileScopeEvent(prelookahead);<br>
><br>
>              preFrame->m_lowres.init(preFrame->m_fencPic, preFrame->m_poc);<br>
> -            if (m_bAdaptiveQuant)<br>
> +            if (m_bAdaptiveQuant && (!m_param->rc.bStatRead ||(m_param->rc.bStatRead &&(!m_param->rc.cuTree || ! IS_REFERENCED(preFrame)))))<br>
<br>
1. white-space<br>
<br>
2. this is pre-lookahead, the slice type and reference status is not<br>
   known yet. If the AQ offsets aren't needed, you'll need to clear them<br>
   after lookahead or just ignore them. If AQ offsets shouldn't be<br>
   generated regardless of slice type, m_bAdaptiveQuant should be<br>
   set to false much earlier<br>
<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>
</blockquote></div>