<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Oct 21, 2013 at 12:35 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"># HG changeset patch<br>
# User Aarthi Thirumalai<<a href="mailto:aarthi@multicorewareinc.com">aarthi@multicorewareinc.com</a>><br>
# Date 1382376878 -19800<br>
#      Mon Oct 21 23:04:38 2013 +0530<br>
# Node ID 8bee2e580fd438b3fbf631c71cbdbbf8e3eef2ff<br>
# Parent  40c3771b3b15a68cda4f59f7f9a36f41d0733520<br>
slicetype: calculate weighted frame costs for Aq<br></blockquote><div><br></div><div>I've queued the first three patches, but not this one.  I have one comment</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<br>
diff -r 40c3771b3b15 -r 8bee2e580fd4 source/encoder/slicetype.cpp<br>
--- a/source/encoder/slicetype.cpp      Mon Oct 21 22:48:35 2013 +0530<br>
+++ b/source/encoder/slicetype.cpp      Mon Oct 21 23:04:38 2013 +0530<br>
@@ -197,7 +197,7 @@<br>
         if (bDoSearch[1]) fenc->lowresMvs[1][p1 - b - 1][0].x = 0;<br>
<br>
         fenc->costEst[b - p0][p1 - b] = 0;<br>
-<br>
+        fenc->costEstAq[b - p0][p1 - b] = 0;<br>
         // TODO: use lowres MVs as motion candidates in full-res search<br>
<br>
         for (int i = 0; i < heightInCU; i++)<br>
@@ -233,6 +233,11 @@<br>
         {<br>
             score += lhrows[row].costEst;<br>
             fenc->costEst[0][0] += lhrows[row].costIntra;<br>
+            if (cfg->param.rc.aqMode)<br>
+            {<br>
+                fenc->costEstAq[0][0] += lhrows[row].costIntraAq;<br>
+                fenc->costEst[b - p0][p1 - b] += lhrows[row].costEstAq;<br>
+            }<br>
             fenc->intraMbs[b - p0] += lhrows[row].intraMbs;<br>
         }<br>
<br>
@@ -250,6 +255,11 @@<br>
         int ncu = NUM_CUS;<br>
         score += (uint64_t)score * fenc->intraMbs[b - p0] / (ncu * 8);<br>
     }<br>
+<br>
+    if (cfg->param.rc.aqMode)<br>
+        fenc->satdCost = fenc->costEstAq[b - p0][p1 - b];<br>
+    else<br>
+        fenc->satdCost = score;<br></blockquote><div><br></div><div>The check for param.rc.aqMode belongs in getEstimatedPictureCost(), or if you know this function was being called from getEstimatedPictureCost.  Because this function is called many times and there is only one satdCost variable for the frame.  Ping me if you have further questions about this.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
     x265_emms();<br>
     return score;<br>
 }<br>
@@ -459,7 +469,12 @@<br>
         // TOOD: i_icost += intra_penalty + lowres_penalty;<br>
         fenc->intraCost[cuXY] = icost;<br>
         fenc->rowSatds[0][0][cuy] += icost;<br>
-        if (bFrameScoreCU) costIntra += icost;<br>
+        if (bFrameScoreCU)<br>
+        {<br>
+            costIntra += icost;<br>
+            if (fenc->m_qpAqOffset[cuXY])<br>
+                costIntraAq += (icost * x265_exp2fix8(fenc->m_qpAqOffset[cuXY]) + 128) >> 8;<br>
+        }<br>
     }<br>
<br>
     if (!bBidir)<br>
@@ -476,7 +491,12 @@<br>
     if (p0 != p1)<br>
     {<br>
         fenc->rowSatds[b - p0][p1 - b][cuy] += bcost;<br>
-        if (bFrameScoreCU) costEst += bcost;<br>
+        if (bFrameScoreCU)<br>
+        {<br>
+            costEst += bcost;<br>
+            if (fenc->m_qpAqOffset[cuXY])<br>
+                costEstAq += (bcost * x265_exp2fix8(fenc->m_qpAqOffset[cuXY]) + 128) >> 8;<br>
+        }<br>
     }<br>
     fenc->lowresCosts[b - p0][p1 - b][cuXY] = (uint16_t)(X265_MIN(bcost, LOWRES_COST_MASK) | (listused << LOWRES_COST_SHIFT));<br>
 }<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><br><br clear="all"><div><br></div>-- <br>Steve Borho
</div></div>