<div dir="ltr">I think the point is, m_cuTreeStats.qpBuffer contains the Fix8 values for 2-pass, but the m_lowres buffers keep double offsets for both AQ and cutree. <br><br>We can push this patch, so Gopu can proceed with the rest of fine grained AQ. Sreelakshmy, your next task should be to modify both the double buffers in m_lowres, so FIX8 versions are used by ratecontrol. <br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 12, 2015 at 1:45 PM, Sreelakshmy Govindan <span dir="ltr"><<a href="mailto:sreelakshmy@multicorewareinc.com" target="_blank">sreelakshmy@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">Hi Steve, <div>  </div><div>      I think the FIX8 version of <span style="color:rgb(80,0,80);font-size:12.8000001907349px">qpCuTreeOffset</span><span style="color:rgb(80,0,80);font-size:12.8000001907349px">  and </span><span style="color:rgb(80,0,80);font-size:12.8000001907349px">qpAqOffset are not present as such in our code. </span></div><div><span style="color:rgb(80,0,80);font-size:12.8000001907349px">      There is a FIX8 version of qpbuffer which is calculated in ratecontrol.cpp as below</span></div><div><span style="color:rgb(80,0,80);font-size:12.8000001907349px"><br></span></div><div><span style="color:rgb(80,0,80);font-size:12.8000001907349px">      </span><font color="#500050"><span style="font-size:12.8000001907349px">m_cuTreeStats.qpBuffer[0][i] = (uint16_t)(curFrame->m_lowres.qpCuTreeOffset[i] * 256.0);</span></font></div><div><font color="#500050"><span style="font-size:12.8000001907349px"><br></span></font></div><div><font color="#500050"><span style="font-size:12.8000001907349px">      But I am not able to find it for Aq and Cutree offsets.</span></font></div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 12, 2015 at 10:30 AM, Sreelakshmy Govindan <span dir="ltr"><<a href="mailto:sreelakshmy@multicorewareinc.com" target="_blank">sreelakshmy@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">Okay Aarthi, Thanks. I will check that too .<div><br></div><div><br></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 12, 2015 at 10:26 AM, Aarthi Priya Thirumalai <span dir="ltr"><<a href="mailto:aarthi@multicorewareinc.com" target="_blank">aarthi@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"><div>Also, since vbv may be changing the qp for each row, you need to pick up the base qp from  </div><div>curEncData.m_cuStat[cuAddr].baseQp instead of m_frame->m_encData->m_avgQpRc;</div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 12, 2015 at 10:25 AM, Sreelakshmy Govindan <span dir="ltr"><<a href="mailto:sreelakshmy@multicorewareinc.com" target="_blank">sreelakshmy@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">Thanks Steve. I will make the changes and resend the patch.<div><br></div><div><br></div><div>Regards,</div><div>Sreelakshmy</div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 12, 2015 at 9:32 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"><span>On Wed, Mar 11, 2015 at 10:36 PM,  <<a href="mailto:sreelakshmy@multicorewareinc.com" target="_blank">sreelakshmy@multicorewareinc.com</a>> wrote:<br>
> # HG changeset patch<br>
> # User Sreelakshmy V G <<a href="mailto:sreelakshmy@multicorewareinc.com" target="_blank">sreelakshmy@multicorewareinc.com</a>><br>
> # Date 1426131126 -19800<br>
> #      Thu Mar 12 09:02:06 2015 +0530<br>
> # Node ID c7182de7496906e81b57cb94278d60cbcc446648<br>
> # Parent  b931c50d55011a1ddc08f0a230b9632fcb4674d7<br>
> analysis:add logic for calculate qp for a given cu size<br>
<br>
</span>the commit message should mention that the commit is adding the<br>
function but that it is not yet used, for the convenience of reviewers<br>
<span><br>
> diff -r b931c50d5501 -r c7182de74969 source/encoder/analysis.cpp<br>
> --- a/source/encoder/analysis.cpp       Wed Mar 11 21:58:02 2015 -0500<br>
> +++ b/source/encoder/analysis.cpp       Thu Mar 12 09:02:06 2015 +0530<br>
> @@ -1895,3 +1895,41 @@<br>
><br>
>      return false;<br>
>  }<br>
> +<br>
> +int Analysis::calculateQpforCuSize(CUData& ctu, const CUGeom& cuGeom)<br>
> +{<br>
> +    x265_emms();<br>
<br>
</span>it doesn't appear that this function needs to use floats, so EMMS<br>
should eventually be unnecessary<br>
<span><br>
> +    int depth = cuGeom.depth;<br>
> +    uint32_t ctuAddr;<br>
> +    ctuAddr = ctu.m_cuAddr;<br>
> +    double qp = m_frame->m_encData->m_avgQpRc;<br>
> +<br>
> +    uint32_t width = m_frame->m_fencPic->m_picWidth;<br>
> +    uint32_t height = m_frame->m_fencPic->m_picHeight;<br>
> +    uint32_t block_x = ctu.m_cuPelX + g_zscanToPelX[cuGeom.absPartIdx];<br>
> +    uint32_t block_y = ctu.m_cuPelY + g_zscanToPelY[cuGeom.absPartIdx];<br>
> +    uint32_t maxCols = (m_frame->m_fencPic->m_picWidth + (16 - 1)) / 16;<br>
> +    uint32_t blockSize = g_maxCUSize / (uint32_t)pow(2, depth);<br>
<br>
</span>g_maxCUSize >> cuGeom.depth<br>
<span><br>
> +    double qp_offset = 0;<br>
> +    uint32_t cnt = 0;<br>
> +    uint32_t idx;<br>
> +<br>
> +    /* Use cuTree offsets if cuTree enabled and frame is referenced, else use AQ offsets */<br>
> +    bool isReferenced = IS_REFERENCED(m_frame);<br>
> +    double *qpoffs = (isReferenced && m_param->rc.cuTree) ? m_frame->m_lowres.qpCuTreeOffset : m_frame->m_lowres.qpAqOffset;<br>
<br>
</span>the lookahead is generating FIX8 versions of these values, so integer<br>
math can be used in later parts of the encoder.<br>
<div><div><br>
> +    for (uint32_t block_yy = block_y; block_yy < block_y + blockSize && block_yy < height; block_yy += 16)<br>
> +    {<br>
> +        for (uint32_t block_xx = block_x; block_xx < block_x + blockSize && block_xx < width; block_xx += 16)<br>
> +        {<br>
> +            idx = ((block_yy / 16) * (maxCols)) + (block_xx / 16);<br>
> +            qp_offset += qpoffs[idx];<br>
> +            cnt++;<br>
> +        }<br>
> +    }<br>
> +<br>
> +    qp_offset /= cnt;<br>
> +    qp += qp_offset;<br>
> +    return x265_clip3(QP_MIN, QP_MAX_MAX, (int)(qp + 0.5));<br>
> +}<br>
> +<br>
> diff -r b931c50d5501 -r c7182de74969 source/encoder/analysis.h<br>
> --- a/source/encoder/analysis.h Wed Mar 11 21:58:02 2015 -0500<br>
> +++ b/source/encoder/analysis.h Thu Mar 12 09:02:06 2015 +0530<br>
> @@ -139,6 +139,8 @@<br>
>      /* generate residual and recon pixels for an entire CTU recursively (RD0) */<br>
>      void encodeResidue(const CUData& parentCTU, const CUGeom& cuGeom);<br>
><br>
> +    int calculateQpforCuSize(CUData& ctu, const CUGeom& cuGeom);<br>
> +<br>
>      /* check whether current mode is the new best */<br>
>      inline void checkBestMode(Mode& mode, uint32_t depth)<br>
>      {<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>
<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><br></div>
</div></div><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>
<br></blockquote></div><br></div>
</div></div><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>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</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>