[x265] [PATCH] slicetype:lookaheadrow variable initialization using MACRO and removed the init()

Gopu Govindaswamy gopu at multicorewareinc.com
Tue Oct 29 08:41:14 CET 2013


# HG changeset patch
# User Gopu Govindaswamy <gopu at multicorewareinc.com>
# Date 1383032464 -19800
# Node ID 70f5410baece7d2b1d2c278611dadacf768c2b0e
# Parent  8846f5cf6d8d1b06496055a1bc756ed4dd3fa1c5
slicetype:lookaheadrow variable initialization using MACRO and removed the init()

diff -r 8846f5cf6d8d -r 70f5410baece source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp	Tue Oct 29 01:05:47 2013 -0500
+++ b/source/encoder/slicetype.cpp	Tue Oct 29 13:11:04 2013 +0530
@@ -191,6 +191,13 @@
 }
 
 #define NUM_CUS (widthInCU > 2 && heightInCU > 2 ? (widthInCU - 2) * (heightInCU - 2) : widthInCU * heightInCU)
+#define INIT(lrows)    lrows.costEst = 0; \
+    lrows.costEstAq = 0; \
+    lrows.costIntra = 0; \
+    lrows.costIntraAq = 0; \
+    lrows.intraMbs = 0; \
+    lrows.active = false; \
+    lrows.completed = 0; 
 
 int Lookahead::estimateFrameCost(int p0, int p1, int b, bool bIntraPenalty)
 {
@@ -218,7 +225,8 @@
 
         for (int i = 0; i < heightInCU; i++)
         {
-            lhrows[i].init();
+            LookaheadRow &lrows = lhrows[i];
+            INIT(lrows);
             lhrows[i].me.setSourcePlane(fenc->lowresPlane[0], fenc->lumaStride);
         }
 
@@ -275,17 +283,6 @@
     return score;
 }
 
-void LookaheadRow::init()
-{
-    costEst = 0;
-    costEstAq = 0;
-    costIntra = 0;
-    costIntraAq = 0;
-    intraMbs = 0;
-    active = false;
-    completed = 0;
-}
-
 void LookaheadRow::estimateCUCost(int cux, int cuy, int p0, int p1, int b, bool bDoSearch[2])
 {
     Lowres *fref0 = frames[p0];
diff -r 8846f5cf6d8d -r 70f5410baece source/encoder/slicetype.h
--- a/source/encoder/slicetype.h	Tue Oct 29 01:05:47 2013 -0500
+++ b/source/encoder/slicetype.h	Tue Oct 29 13:11:04 2013 +0530
@@ -67,7 +67,6 @@
         X265_FREE(predictions);
     }
 
-    void init();
 
     void estimateCUCost(int cux, int cuy, int p0, int p1, int b, bool bDoSearch[2]);
 };


More information about the x265-devel mailing list