[x265] [PATCH] slicetype: fix the BRef cost estimates in vbv lookahead

aarthi at multicorewareinc.com aarthi at multicorewareinc.com
Mon Feb 16 07:46:54 CET 2015


# HG changeset patch
# User Aarthi Thirumalai
# Date 1424063038 -19800
#      Mon Feb 16 10:33:58 2015 +0530
# Node ID b14b95a4565986c9678442dbc510fed974bb413c
# Parent  164bd8337e72624a7605424cc3bdc67042dd5294
slicetype: fix the BRef cost estimates in vbv lookahead.

diff -r 164bd8337e72 -r b14b95a45659 source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp	Sun Feb 15 20:13:22 2015 -0600
+++ b/source/encoder/slicetype.cpp	Mon Feb 16 10:33:58 2015 +0530
@@ -580,7 +580,9 @@
         curNonB++;
     int nextNonB = keyframe ? prevNonB : curNonB;
     int nextB = prevNonB + 1;
-    int nextBRef = 0;
+    int nextBRef = 0, curBRef = 0;
+    if (m_param->bBPyramid && curNonB - prevNonB > 1)
+        curBRef = (prevNonB + curNonB + 1) / 2;
     int miniGopEnd = keyframe ? prevNonB : curNonB;
     while (curNonB < numFrames + !keyframe)
     {
@@ -597,7 +599,6 @@
                 {
                     frames[j]->plannedSatd[frames[j]->indB] = frames[nextNonB]->plannedSatd[idx];
                     frames[j]->plannedType[frames[j]->indB++] = frames[nextNonB]->plannedType[idx];
-                
                 }
             }
             idx++;
@@ -629,12 +630,12 @@
 
             for (int j = nextB; j < miniGopEnd; j++)
             {
-                if (nextBRef && i == nextBRef)
+                if (curBRef && curBRef == i)
                     break;
                 if (j >= i && j !=nextBRef)
                     continue;
                 frames[j]->plannedSatd[frames[j]->indB] = satdCost;
-                frames[j]->plannedType[frames[j]->indB++] = X265_TYPE_B;
+                frames[j]->plannedType[frames[j]->indB++] = type;
             }
         }
         prevNonB = curNonB;


More information about the x265-devel mailing list