[x265] [PATCH] slicetype: selected best cu cost and added into rowsatd, lowrescost, costest and intrambs

gopu at multicorewareinc.com gopu at multicorewareinc.com
Wed Aug 14 10:46:13 CEST 2013


# HG changeset patch
# User ggopu
# Date 1376469957 -19800
# Node ID 80b5866ef7565be1e07d94c0a0a90543f416d106
# Parent  11cce4de927a519602849cb0e206753da4c4759c
slicetype: selected best cu cost and added into rowsatd, lowrescost, costest and intrambs

diff -r 11cce4de927a -r 80b5866ef756 source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp	Wed Aug 14 00:59:31 2013 -0500
+++ b/source/encoder/slicetype.cpp	Wed Aug 14 14:15:57 2013 +0530
@@ -192,7 +192,7 @@
     return score;
 }
 
-int Lookahead::estimateCUCost(int cux, int cuy, int p0, int p1, int b, int do_search[2])
+void Lookahead::estimateCUCost(int cux, int cuy, int p0, int p1, int b, int do_search[2])
 {
     LookaheadFrame *fref0 = frames[p0];
     LookaheadFrame *fref1 = frames[p1];
@@ -251,10 +251,10 @@
         // TODO: add bidir
     }
 
+    int bcost = me.COST_MAX, cost;
     if (!fenc->bIntraCalculated)
     {
         Int nLog2SizeMinus2 = g_convertToBit[cu_size]; // partition size
-        int bcost = me.COST_MAX, cost;
 
         fenc->bIntraCalculated = true;
 
@@ -294,8 +294,25 @@
         }
         fenc->lowresMvCosts[0][0][cu_xy] = bcost;
     }
-
-    return 0;
+    
+    if (!b_bidir)
+    {
+        int icost = *fenc_costs[0];
+        /* best inter cost */
+        if(*fenc_costs[1] < icost)  icost = *fenc_costs[1];
+        
+        /* best CU cost */
+        if(icost < bcost)  bcost = icost; 
+        
+        fenc->intraMbs[b - p0] += bcost;
+    }
+    
+    if (p0 != p1)
+    {
+        fenc->rowSatds[b - p0][p1 - b][cuy] += bcost;
+        fenc->costEst[b - p0][p1 - b] += bcost;
+        fenc->lowresCosts[b - p0][p1 -b][cu_xy] += (uint16_t) bcost;
+    }    
 }
 
 #if 0
diff -r 11cce4de927a -r 80b5866ef756 source/encoder/slicetype.h
--- a/source/encoder/slicetype.h	Wed Aug 14 00:59:31 2013 -0500
+++ b/source/encoder/slicetype.h	Wed Aug 14 14:15:57 2013 +0530
@@ -60,7 +60,7 @@
     void slicetypeDecide();
 
     int estimateFrameCost(int p0, int p1, int b, int bIntraPenalty);
-    int estimateCUCost(int cux, int cuy, int p0, int p1, int b, int do_search[2]);
+    void estimateCUCost(int cux, int cuy, int p0, int p1, int b, int do_search[2]);
 };
 
 }


More information about the x265-devel mailing list