[x265] [PATCH] analysis: Do not save/load MV's if analysis mode is enabled

sagar at multicorewareinc.com sagar at multicorewareinc.com
Tue Mar 8 09:14:36 CET 2016


# HG changeset patch
# User Sagar Kotecha<sagar at multicorewareinc.com>
# Date 1457341277 -19800
#      Mon Mar 07 14:31:17 2016 +0530
# Node ID 42fd78c163fbae6992493ade1ac0f693b0d38d84
# Parent  88aebc166fa8e16f91d5f0acce77690003be9d91
analysis: Do not save/load MV's if analysis mode is enabled

diff -r 88aebc166fa8 -r 42fd78c163fb source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp	Fri Mar 04 16:59:45 2016 +0530
+++ b/source/encoder/analysis.cpp	Mon Mar 07 14:31:17 2016 +0530
@@ -74,7 +74,6 @@
 {
     m_reuseInterDataCTU = NULL;
     m_reuseRef = NULL;
-    m_reuseMv = NULL;
 }
 bool Analysis::create(ThreadLocalData *tld)
 {
@@ -148,7 +147,6 @@
         int numPredDir = m_slice->isInterP() ? 1 : 2;
         m_reuseInterDataCTU = (analysis_inter_data*)m_frame->m_analysisData.interData;
         m_reuseRef = &m_reuseInterDataCTU->ref[ctu.m_cuAddr * X265_MAX_PRED_MODE_PER_CTU * numPredDir];
-        m_reuseMv = &m_reuseInterDataCTU->mv[ctu.m_cuAddr * X265_MAX_PRED_MODE_PER_CTU * numPredDir];
     }
     ProfileCUScope(ctu, totalCTUTime, totalCTUs);
 
@@ -2085,9 +2083,6 @@
             {
                 bestME[i].ref = *m_reuseRef;
                 m_reuseRef++;
-
-                bestME[i].mv = *m_reuseMv;
-                m_reuseMv++;
             }
         }
     }
@@ -2110,16 +2105,11 @@
         uint32_t numPU = interMode.cu.getNumPartInter(0);
         for (uint32_t puIdx = 0; puIdx < numPU; puIdx++)
         {
-            PredictionUnit pu(interMode.cu, cuGeom, puIdx);
             MotionData* bestME = interMode.bestME[puIdx];
             for (int32_t i = 0; i < numPredDir; i++)
             {
-                if (bestME[i].ref >= 0)
-                    *m_reuseMv = getLowresMV(interMode.cu, pu, i, bestME[i].ref);
-
                 *m_reuseRef = bestME[i].ref;
                 m_reuseRef++;
-                m_reuseMv++;
             }
         }
     }
@@ -2142,9 +2132,6 @@
             {
                 bestME[i].ref = *m_reuseRef;
                 m_reuseRef++;
-
-                bestME[i].mv = *m_reuseMv;
-                m_reuseMv++;
             }
         }
     }
@@ -2158,16 +2145,11 @@
         uint32_t numPU = interMode.cu.getNumPartInter(0);
         for (uint32_t puIdx = 0; puIdx < numPU; puIdx++)
         {
-            PredictionUnit pu(interMode.cu, cuGeom, puIdx);
             MotionData* bestME = interMode.bestME[puIdx];
             for (int32_t i = 0; i < numPredDir; i++)
             {
-                if (bestME[i].ref >= 0)
-                    *m_reuseMv = getLowresMV(interMode.cu, pu, i, bestME[i].ref);
-
                 *m_reuseRef = bestME[i].ref;
                 m_reuseRef++;
-                m_reuseMv++;
             }
         }
     }
diff -r 88aebc166fa8 -r 42fd78c163fb source/encoder/analysis.h
--- a/source/encoder/analysis.h	Fri Mar 04 16:59:45 2016 +0530
+++ b/source/encoder/analysis.h	Mon Mar 07 14:31:17 2016 +0530
@@ -119,8 +119,8 @@
 protected:
     /* Analysis data for load/save modes, keeps getting incremented as CTU analysis proceeds and data is consumed or read */
     analysis_inter_data* m_reuseInterDataCTU;
-    MV*                  m_reuseMv;
     int32_t*             m_reuseRef;
+
     uint32_t m_splitRefIdx[4];
     uint64_t* cacheCost;
 
diff -r 88aebc166fa8 -r 42fd78c163fb source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Fri Mar 04 16:59:45 2016 +0530
+++ b/source/encoder/encoder.cpp	Mon Mar 07 14:31:17 2016 +0530
@@ -1920,7 +1920,6 @@
         CHECKED_MALLOC_ZERO(interData->ref, int32_t, analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir);
         CHECKED_MALLOC(interData->depth, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);
         CHECKED_MALLOC(interData->modes, uint8_t, analysis->numPartitions * analysis->numCUsInFrame);
-        CHECKED_MALLOC_ZERO(interData->mv, MV, analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir);
         CHECKED_MALLOC_ZERO(interData->wt, WeightParam, 3 * numDir);
         analysis->interData = interData;
     }
@@ -1946,7 +1945,6 @@
         X265_FREE(((analysis_inter_data*)analysis->interData)->ref);
         X265_FREE(((analysis_inter_data*)analysis->interData)->depth);
         X265_FREE(((analysis_inter_data*)analysis->interData)->modes);
-        X265_FREE(((analysis_inter_data*)analysis->interData)->mv);
         X265_FREE(((analysis_inter_data*)analysis->interData)->wt);
         X265_FREE(analysis->interData);
     }
@@ -2054,7 +2052,6 @@
         
         int numDir = analysis->sliceType == X265_TYPE_P ? 1 : 2;
         X265_FREAD(((analysis_inter_data *)analysis->interData)->ref, sizeof(int32_t), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir, m_analysisFile);      
-        X265_FREAD(((analysis_inter_data *)analysis->interData)->mv, sizeof(MV), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir, m_analysisFile);
         uint32_t numPlanes = m_param->internalCsp == X265_CSP_I400 ? 1 : 3;
         X265_FREAD(((analysis_inter_data *)analysis->interData)->wt, sizeof(WeightParam), numPlanes * numDir, m_analysisFile);
         consumedBytes += frameRecordSize;
@@ -2137,7 +2134,6 @@
     else
     {
         int numDir = (analysis->sliceType == X265_TYPE_P) ? 1 : 2;
-        analysis->frameRecordSize += sizeof(int32_t) * analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir;
         analysis->frameRecordSize += depthBytes * 2;
         analysis->frameRecordSize += sizeof(MV) * analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir;
         analysis->frameRecordSize += sizeof(WeightParam) * 3 * numDir;
@@ -2164,7 +2160,6 @@
         X265_FWRITE(((analysis_inter_data*)analysis->interData)->depth, sizeof(uint8_t), depthBytes, m_analysisFile);
         X265_FWRITE(((analysis_inter_data*)analysis->interData)->modes, sizeof(uint8_t), depthBytes, m_analysisFile);
         X265_FWRITE(((analysis_inter_data*)analysis->interData)->ref, sizeof(int32_t), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir, m_analysisFile);
-        X265_FWRITE(((analysis_inter_data*)analysis->interData)->mv, sizeof(MV), analysis->numCUsInFrame * X265_MAX_PRED_MODE_PER_CTU * numDir, m_analysisFile);
         uint32_t numPlanes = m_param->internalCsp == X265_CSP_I400 ? 1 : 3;
         X265_FWRITE(((analysis_inter_data*)analysis->interData)->wt, sizeof(WeightParam), numPlanes * numDir, m_analysisFile);
     }
diff -r 88aebc166fa8 -r 42fd78c163fb source/encoder/search.cpp
--- a/source/encoder/search.cpp	Fri Mar 04 16:59:45 2016 +0530
+++ b/source/encoder/search.cpp	Mon Mar 07 14:31:17 2016 +0530
@@ -2109,10 +2109,7 @@
                 const MV* amvp = interMode.amvpCand[list][ref];
                 int mvpIdx = selectMVP(cu, pu, amvp, list, ref);
                 MV mvmin, mvmax, outmv, mvp = amvp[mvpIdx];
-                MV lmv = bestME[list].mv;
-                if (lmv.notZero())
-                    mvc[numMvc++] = lmv;
-
+                
                 setSearchRange(cu, mvp, m_param->searchRange, mvmin, mvmax);
                 int satdCost = m_me.motionEstimate(&slice->m_mref[list][ref], mvmin, mvmax, mvp, numMvc, mvc, m_param->searchRange, outmv);
 


More information about the x265-devel mailing list