[x265] [PATCH] slicetype: fix the BRef cost estimates in vbv lookahead
aarthi at multicorewareinc.com
aarthi at multicorewareinc.com
Mon Feb 16 07:48:29 CET 2015
# HG changeset patch
# User Aarthi Thirumalai
# Date 1424063038 -19800
# Mon Feb 16 10:33:58 2015 +0530
# Node ID 540697e77bbce88e1065035d41b5222da45318cb
# Parent 164bd8337e72624a7605424cc3bdc67042dd5294
slicetype: fix the BRef cost estimates in vbv lookahead.
diff -r 164bd8337e72 -r 540697e77bbc 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++;
@@ -622,19 +623,19 @@
satdCost = vbvFrameCost(frames, nextBRef, curNonB, i);
}
else
- satdCost = vbvFrameCost(frames, prevNonB, nextNonB, i);
+ satdCost = vbvFrameCost(frames, prevNonB, curNonB, i);
frames[nextNonB]->plannedSatd[idx] = satdCost;
frames[nextNonB]->plannedType[idx] = type;
/* Save the nextB Cost in each B frame of the current miniGop */
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