<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Oct 29, 2013 at 2:41 AM, Gopu Govindaswamy <span dir="ltr"><<a href="mailto:gopu@multicorewareinc.com" target="_blank">gopu@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 Gopu Govindaswamy <<a href="mailto:gopu@multicorewareinc.com">gopu@multicorewareinc.com</a>><br>
# Date 1383032464 -19800<br>
# Node ID 70f5410baece7d2b1d2c278611dadacf768c2b0e<br>
# Parent  8846f5cf6d8d1b06496055a1bc756ed4dd3fa1c5<br>
slicetype:lookaheadrow variable initialization using MACRO and removed the init()<br>
<br>
diff -r 8846f5cf6d8d -r 70f5410baece source/encoder/slicetype.cpp<br>
--- a/source/encoder/slicetype.cpp      Tue Oct 29 01:05:47 2013 -0500<br>
+++ b/source/encoder/slicetype.cpp      Tue Oct 29 13:11:04 2013 +0530<br>
@@ -191,6 +191,13 @@<br>
 }<br>
<br>
 #define NUM_CUS (widthInCU > 2 && heightInCU > 2 ? (widthInCU - 2) * (heightInCU - 2) : widthInCU * heightInCU)<br>
+#define INIT(lrows)    lrows.costEst = 0; \<br>
+    lrows.costEstAq = 0; \<br>
+    lrows.costIntra = 0; \<br>
+    lrows.costIntraAq = 0; \<br>
+    lrows.intraMbs = 0; \<br>
+    lrows.active = false; \<br>
+    lrows.completed = 0;<br></blockquote><div><br></div><div>All this does is obsfucate the initialization, which was only done in one place to begin with.</div><div><br></div><div>The functions which need to be cleaned up are ones like these:</div>
<br>TShortYUV::clear, TComDataCU::initCU, TComDataCU::initSubCU, TComDataCU::setSubPart</div><div class="gmail_quote"><br></div><div class="gmail_quote">And these aren't quick tasks, each function needs to be carefully analyzed to figure out how much is necessary and what can be left out, and which memsets could be combined.<br>
<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">
 int Lookahead::estimateFrameCost(int p0, int p1, int b, bool bIntraPenalty)<br>
 {<br>
@@ -218,7 +225,8 @@<br>
<br>
         for (int i = 0; i < heightInCU; i++)<br>
         {<br>
-            lhrows[i].init();<br>
+            LookaheadRow &lrows = lhrows[i];<br>
+            INIT(lrows);<br>
             lhrows[i].me.setSourcePlane(fenc->lowresPlane[0], fenc->lumaStride);<br>
         }<br>
<br>
@@ -275,17 +283,6 @@<br>
     return score;<br>
 }<br>
<br>
-void LookaheadRow::init()<br>
-{<br>
-    costEst = 0;<br>
-    costEstAq = 0;<br>
-    costIntra = 0;<br>
-    costIntraAq = 0;<br>
-    intraMbs = 0;<br>
-    active = false;<br>
-    completed = 0;<br>
-}<br>
-<br>
 void LookaheadRow::estimateCUCost(int cux, int cuy, int p0, int p1, int b, bool bDoSearch[2])<br>
 {<br>
     Lowres *fref0 = frames[p0];<br>
diff -r 8846f5cf6d8d -r 70f5410baece source/encoder/slicetype.h<br>
--- a/source/encoder/slicetype.h        Tue Oct 29 01:05:47 2013 -0500<br>
+++ b/source/encoder/slicetype.h        Tue Oct 29 13:11:04 2013 +0530<br>
@@ -67,7 +67,6 @@<br>
         X265_FREE(predictions);<br>
     }<br>
<br>
-    void init();<br>
<br>
     void estimateCUCost(int cux, int cuy, int p0, int p1, int b, bool bDoSearch[2]);<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>