[x265] [PATCH] lookahead: fix crash for I frame cost estimation
Deepthi Devaki Akkoorath
deepthidevaki at multicorewareinc.com
Thu Sep 19 11:16:46 CEST 2013
# HG changeset patch
# User Deepthi Devaki <deepthidevaki at multicorewareinc.com>
# Date 1379582068 -19800
# Node ID d52de033d7dde002bbbb55e9d55ece138c33fd61
# Parent 26d6f155f8df69147f40f4945d99c29a52988c56
lookahead: fix crash for I frame cost estimation
diff -r 26d6f155f8df -r d52de033d7dd source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp Wed Sep 18 16:13:33 2013 -0500
+++ b/source/encoder/slicetype.cpp Thu Sep 19 14:44:28 2013 +0530
@@ -360,44 +360,46 @@
mvmax.x = (uint16_t)((widthInCU - cux - 1) * cuSize + 8);
mvmax.y = (uint16_t)((heightInCU - cuy - 1) * cuSize + 8);
- for (int i = 0; i < 1 + bBidir; i++)
+ if (p0 != p1)
{
- if (!bDoSearch[i])
+ for (int i = 0; i < 1 + bBidir; i++)
{
- /* Use previously calculated cost */
+ if (!bDoSearch[i])
+ {
+ /* Use previously calculated cost */
+ COPY2_IF_LT(bcost, *fenc_costs[i], listused, i + 1);
+ continue;
+ }
+ int numc = 0;
+ MV mvc[4], mvp;
+ MV *fenc_mv = fenc_mvs[i];
+
+ /* Reverse-order MV prediction. */
+ mvc[0] = 0;
+ mvc[2] = 0;
+#define MVC(mv) mvc[numc++] = mv;
+ if (cux < widthInCU - 1)
+ MVC(fenc_mv[1]);
+ if (cuy < heightInCU - 1)
+ {
+ MVC(fenc_mv[widthInCU]);
+ if (cux > 0)
+ MVC(fenc_mv[widthInCU - 1]);
+ if (cux < widthInCU - 1)
+ MVC(fenc_mv[widthInCU + 1]);
+ }
+#undef MVC
+ if (numc <= 1)
+ mvp = mvc[0];
+ else
+ {
+ x265_median_mv(mvp, mvc[0], mvc[1], mvc[2]);
+ }
+
+ *fenc_costs[i] = me.motionEstimate(i ? fref1 : fref0, mvmin,
mvmax, mvp, numc, mvc, merange, *fenc_mvs[i]);
COPY2_IF_LT(bcost, *fenc_costs[i], listused, i + 1);
- continue;
}
- int numc = 0;
- MV mvc[4], mvp;
- MV *fenc_mv = fenc_mvs[i];
-
- /* Reverse-order MV prediction. */
- mvc[0] = 0;
- mvc[2] = 0;
-#define MVC(mv) mvc[numc++] = mv;
- if (cux < widthInCU - 1)
- MVC(fenc_mv[1]);
- if (cuy < heightInCU - 1)
- {
- MVC(fenc_mv[widthInCU]);
- if (cux > 0)
- MVC(fenc_mv[widthInCU - 1]);
- if (cux < widthInCU - 1)
- MVC(fenc_mv[widthInCU + 1]);
- }
-#undef MVC
- if (numc <= 1)
- mvp = mvc[0];
- else
- {
- x265_median_mv(mvp, mvc[0], mvc[1], mvc[2]);
- }
-
- *fenc_costs[i] = me.motionEstimate(i ? fref1 : fref0, mvmin,
mvmax, mvp, numc, mvc, merange, *fenc_mvs[i]);
- COPY2_IF_LT(bcost, *fenc_costs[i], listused, i + 1);
}
-
if (!fenc->bIntraCalculated)
{
int nLog2SizeMinus2 = g_convertToBit[cuSize]; // partition size
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20130919/e0c59091/attachment.html>
More information about the x265-devel
mailing list