[x265] [PATCH] search: fix binary mismatch and inconsistent crash for share inter information

gopu at multicorewareinc.com gopu at multicorewareinc.com
Mon Nov 17 11:06:01 CET 2014


# HG changeset patch
# User Gopu Govindaswamy <gopu at multicorewareinc.com>
# Date 1416218723 -19800
#      Mon Nov 17 15:35:23 2014 +0530
# Node ID 23bba9b2de1c930976a9018c5127b566ba31c44a
# Parent  27d36c4b4a27d2872430c6a6fc538fbddcf791e6
search: fix binary mismatch and inconsistent crash for share inter information

diff -r 27d36c4b4a27 -r 23bba9b2de1c source/common/common.h
--- a/source/common/common.h	Mon Nov 17 01:30:26 2014 +0530
+++ b/source/common/common.h	Mon Nov 17 15:35:23 2014 +0530
@@ -350,9 +350,6 @@
 struct analysis_inter_data
 {
     int      ref;
-    int      costZero;
-    int16_t  mvx;
-    int16_t  mvy;
 };
 
 /* Stores intra analysis data for a single frame. This struct needs better packing */
diff -r 27d36c4b4a27 -r 23bba9b2de1c source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp	Mon Nov 17 01:30:26 2014 +0530
+++ b/source/encoder/analysis.cpp	Mon Nov 17 15:35:23 2014 +0530
@@ -1454,10 +1454,7 @@
             MotionData* bestME = interMode.bestME[part];
             for (int32_t i = 0; i < numPredDir; i++)
             {
-                bestME[i].mv.x = m_reuseInterDataCTU->mvx;
-                bestME[i].mv.y = m_reuseInterDataCTU->mvy;
                 bestME[i].ref = m_reuseInterDataCTU->ref;
-                bestME[i].costZero = !!m_reuseInterDataCTU->costZero;
                 m_reuseInterDataCTU++;
             }
         }
@@ -1477,10 +1474,7 @@
                 MotionData* bestME = interMode.bestME[part];
                 for (int32_t i = 0; i < numPredDir; i++)
                 {
-                    m_reuseInterDataCTU->mvx = bestME[i].mv.x;
-                    m_reuseInterDataCTU->mvy = bestME[i].mv.y;
                     m_reuseInterDataCTU->ref = bestME[i].ref;
-                    m_reuseInterDataCTU->costZero = bestME[i].costZero;
                     m_reuseInterDataCTU++;
                 }
             }
@@ -1507,10 +1501,7 @@
             MotionData* bestME = interMode.bestME[part];
             for (int32_t i = 0; i < numPredDir; i++)
             {
-                bestME[i].mv.x = m_reuseInterDataCTU->mvx;
-                bestME[i].mv.y = m_reuseInterDataCTU->mvy;
                 bestME[i].ref = m_reuseInterDataCTU->ref;
-                bestME[i].costZero = !!m_reuseInterDataCTU->costZero;
                 m_reuseInterDataCTU++;
             }
         }
@@ -1526,10 +1517,7 @@
                 MotionData* bestME = interMode.bestME[part];
                 for (int32_t i = 0; i < numPredDir; i++)
                 {
-                    m_reuseInterDataCTU->mvx = bestME[i].mv.x;
-                    m_reuseInterDataCTU->mvy = bestME[i].mv.y;
                     m_reuseInterDataCTU->ref = bestME[i].ref;
-                    m_reuseInterDataCTU->costZero = bestME[i].costZero;
                     m_reuseInterDataCTU++;
                 }
             }
diff -r 27d36c4b4a27 -r 23bba9b2de1c source/encoder/search.cpp
--- a/source/encoder/search.cpp	Mon Nov 17 01:30:26 2014 +0530
+++ b/source/encoder/search.cpp	Mon Nov 17 15:35:23 2014 +0530
@@ -2001,7 +2001,7 @@
                 uint32_t bits = m_listSelBits[l] + MVP_IDX_BITS;
                 bits += getTUBits(ref, numRefIdx[l]);
 
-                cu.fillMvpCand(puIdx, m_puAbsPartIdx, l, ref, interMode.amvpCand[l][ref], mvc);
+                int numMvc = cu.fillMvpCand(puIdx, m_puAbsPartIdx, l, ref, interMode.amvpCand[l][ref], mvc);
 
                 // Pick the best possible MVP from AMVP candidates based on least residual
                 uint32_t bestCost = MAX_INT;
@@ -2028,18 +2028,14 @@
                 }
 
                 MV mvmin, mvmax, outmv, mvp = interMode.amvpCand[l][ref][mvpIdx];
-                m_me.setMVP(mvp);
-                MV bmv(bestME[l].mv.x, bestME[l].mv.y);
 
                 int satdCost;
-                if (bestME[l].costZero)
-                    satdCost = m_me.mvcost(bmv);
-                else
-                    satdCost = bestME[l].cost;
+                setSearchRange(cu, mvp, merange, mvmin, mvmax);
+                satdCost = m_me.motionEstimate(&slice->m_mref[l][ref], mvmin, mvmax, mvp, numMvc, mvc, merange, outmv);
 
                 /* Get total cost of partition, but only include MV bit cost once */
-                bits += m_me.bitcost(bmv);
-                uint32_t cost = (satdCost - m_me.mvcost(bmv)) + m_rdCost.getCost(bits);
+                bits += m_me.bitcost(outmv);
+                uint32_t cost = (satdCost - m_me.mvcost(outmv)) + m_rdCost.getCost(bits);
 
                 /* Refine MVP selection, updates: mvp, mvpIdx, bits, cost */
                 checkBestMVP(interMode.amvpCand[l][ref], outmv, mvp, mvpIdx, bits, cost);
@@ -2049,7 +2045,6 @@
                     bestME[l].mv = outmv;
                     bestME[l].mvp = mvp;
                     bestME[l].mvpIdx = mvpIdx;
-                    bestME[l].ref = ref;
                     bestME[l].cost = cost;
                     bestME[l].bits = bits;
                 }


More information about the x265-devel mailing list