<div dir="ltr">This is the correct patch. <div><br><div><div># HG changeset patch</div><div># User Aarthi Thirumalai</div><div># Date 1399381528 -19800</div><div>#      Tue May 06 18:35:28 2014 +0530</div><div># Node ID 65cb5558ad4a474114aa95d45a7c155ea16f0008</div>
<div># Parent  a6c7325e6ee60827142c18eaf4141e0eb4d6d98a</div><div>slicetype: update the lowresCosts and intraCosts when cutree is enabled</div><div><br></div><div>diff -r a6c7325e6ee6 -r 65cb5558ad4a source/encoder/frameencoder.cpp</div>
<div>--- a/source/encoder/frameencoder.cpp<span class="" style="white-space:pre">       </span>Tue May 06 15:31:18 2014 +0530</div><div>+++ b/source/encoder/frameencoder.cpp<span class="" style="white-space:pre">        </span>Tue May 06 18:35:28 2014 +0530</div>
<div>@@ -1261,15 +1261,8 @@</div><div>                 qp_offset += qpoffs[idx];</div><div>             if (bIsVbv)</div><div>             {</div><div>-                uint16_t lowresCuCost = m_pic->m_lowres.lowresCostForRc[idx] & LOWRES_COST_MASK;</div>
<div>-                uint16_t intraCuCost = m_pic->m_lowres.intraCost[idx];</div><div>-                if (m_cfg->param->rc.cuTree)</div><div>-                {</div><div>-                    lowresCuCost = (lowresCuCost * x265_exp2fix8(qpoffs[idx]) + 128) >> 8;</div>
<div>-                    intraCuCost = (intraCuCost * x265_exp2fix8(qpoffs[idx]) + 128) >> 8;</div><div>-                }</div><div>-                m_pic->m_cuCostsForVbv[cuAddr] += lowresCuCost;</div><div>-                m_pic->m_intraCuCostsForVbv[cuAddr] += intraCuCost;</div>
<div>+                m_pic->m_cuCostsForVbv[cuAddr] += m_pic->m_lowres.lowresCostForRc[idx];</div><div>+                m_pic->m_intraCuCostsForVbv[cuAddr] += m_pic->m_lowres.intraCost[idx];</div><div>             }</div>
<div>             cnt++;</div><div>         }</div><div>diff -r a6c7325e6ee6 -r 65cb5558ad4a source/encoder/slicetype.cpp</div><div>--- a/source/encoder/slicetype.cpp<span class="" style="white-space:pre">   </span>Tue May 06 15:31:18 2014 +0530</div>
<div>+++ b/source/encoder/slicetype.cpp<span class="" style="white-space:pre">  </span>Tue May 06 18:35:28 2014 +0530</div><div>@@ -255,6 +255,7 @@</div><div>         uint32_t lowresRow = 0, lowresCol = 0, lowresCuIdx = 0, sum = 0;</div>
<div>         uint32_t scale = param->maxCUSize / (2 * X265_LOWRES_CU_SIZE);</div><div>         uint32_t widthInLowresCu = (uint32_t)widthInCU, heightInLowresCu = (uint32_t)heightInCU;</div><div>+        double *qp_offset =frames[b]->sliceType == X265_TYPE_B ? frames[b]->qpAqOffset : frames[b]->qpOffset;</div>
<div> </div><div>         for (uint32_t row = 0; row < pic->getFrameHeightInCU(); row++)</div><div>         {</div><div>@@ -265,9 +266,16 @@</div><div>                 lowresCuIdx = lowresRow * widthInLowresCu;</div>
<div>                 for (lowresCol = 0; lowresCol < widthInLowresCu; lowresCol++, lowresCuIdx++)</div><div>                 {</div><div>-                    sum += pic->m_lowres.lowresCostForRc[lowresCuIdx] & LOWRES_COST_MASK;</div>
<div>+                    uint16_t lowresCuCost = pic->m_lowres.lowresCostForRc[lowresCuIdx] & LOWRES_COST_MASK;</div><div>+                    if (param->rc.cuTree)</div><div>+                    {</div><div>+                        lowresCuCost = (lowresCuCost * x265_exp2fix8(qp_offset[lowresCuIdx]) + 128) >> 8;</div>
<div>+                        uint16_t intraCuCost = pic->m_lowres.intraCost[lowresCuIdx];</div><div>+                        pic->m_lowres.intraCost[lowresCuIdx] = (intraCuCost * x265_exp2fix8(qp_offset[lowresCuIdx]) + 128) >> 8;</div>
<div>+                    }</div><div>+                    pic->m_lowres.lowresCostForRc[lowresCuIdx] = lowresCuCost;</div><div>+                    sum += lowresCuCost;</div><div>                 }</div><div>-</div><div>
                 pic->m_rowSatdForVbv[row] += sum;</div><div>             }</div><div>         }</div></div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 6, 2014 at 5:15 PM,  <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"># HG changeset patch<br>
# User Aarthi Thirumalai<br>
# Date 1399375233 -19800<br>
#      Tue May 06 16:50:33 2014 +0530<br>
# Node ID a3a234d72841f94f605c6075a5531e93f06eaeb6<br>
# Parent  075705aa41a9144bb1a4d7f12d837169767630e1<br>
slicetype: update the lowresCosts and intraCosts when cutree is enabled.<br>
<br>
diff -r 075705aa41a9 -r a3a234d72841 source/encoder/frameencoder.cpp<br>
--- a/source/encoder/frameencoder.cpp   Mon May 05 23:26:59 2014 -0500<br>
+++ b/source/encoder/frameencoder.cpp   Tue May 06 16:50:33 2014 +0530<br>
@@ -1261,8 +1261,15 @@<br>
                 qp_offset += qpoffs[idx];<br>
             if (bIsVbv)<br>
             {<br>
-                m_pic->m_cuCostsForVbv[cuAddr] += m_pic->m_lowres.lowresCostForRc[idx] & LOWRES_COST_MASK;<br>
-                m_pic->m_intraCuCostsForVbv[cuAddr] += m_pic->m_lowres.intraCost[idx];<br>
+                uint16_t lowresCuCost = m_pic->m_lowres.lowresCostForRc[idx] & LOWRES_COST_MASK;<br>
+                uint16_t intraCuCost = m_pic->m_lowres.intraCost[idx];<br>
+                if (m_cfg->param->rc.cuTree)<br>
+                {<br>
+                    lowresCuCost = (lowresCuCost * x265_exp2fix8(qpoffs[idx]) + 128) >> 8;<br>
+                    intraCuCost = (intraCuCost * x265_exp2fix8(qpoffs[idx]) + 128) >> 8;<br>
+                }<br>
+                m_pic->m_cuCostsForVbv[cuAddr] += lowresCuCost;<br>
+                m_pic->m_intraCuCostsForVbv[cuAddr] += intraCuCost;<br>
             }<br>
             cnt++;<br>
         }<br>
diff -r 075705aa41a9 -r a3a234d72841 source/encoder/slicetype.cpp<br>
--- a/source/encoder/slicetype.cpp      Mon May 05 23:26:59 2014 -0500<br>
+++ b/source/encoder/slicetype.cpp      Tue May 06 16:50:33 2014 +0530<br>
@@ -1141,7 +1141,7 @@<br>
 {<br>
     int64_t score = 0;<br>
     int *rowSatd = frames[b]->rowSatds[b - p0][p1 - b];<br>
-    double *qp_offset = IS_X265_TYPE_B(frames[b]->sliceType) ? frames[b]->qpAqOffset : frames[b]->qpOffset;<br>
+    double *qp_offset =frames[b]->sliceType == X265_TYPE_B ? frames[b]->qpAqOffset : frames[b]->qpOffset;<br>
<br>
     x265_emms();<br>
     for (int cuy = heightInCU - 1; cuy >= 0; cuy--)<br>
</blockquote></div><br></div>