[x265] cleanup TComCUMvField::m_cAMVPInfo

Satoshi Nakagawa nakagawa424 at oki.com
Sun Jan 26 09:43:40 CET 2014


# HG changeset patch
# User Satoshi Nakagawa <nakagawa424 at oki.com>
# Date 1390656949 -32400
#      Sat Jan 25 22:35:49 2014 +0900
# Node ID ec3089ed27c26508f2639ceeb6988e2eb700fa61
# Parent  237bf66674056639581ef2aa3466ea2fc5523ceb
cleanup TComCUMvField::m_cAMVPInfo

diff -r 237bf6667405 -r ec3089ed27c2 source/Lib/TLibCommon/TComMotionInfo.h
--- a/source/Lib/TLibCommon/TComMotionInfo.h	Fri Jan 24 14:43:31 2014 -0600
+++ b/source/Lib/TLibCommon/TComMotionInfo.h	Sat Jan 25 22:35:49 2014 +0900
@@ -90,7 +90,6 @@
     MV* m_mvd;
     char*     m_refIdx;
     uint32_t      m_numPartitions;
-    AMVPInfo  m_cAMVPInfo;
 
     template<typename T>
     void setAll(T *p, T const & val, PartSize cuMode, int partAddr, uint32_t depth, int partIdx);
@@ -126,8 +125,6 @@
 
     int getRefIdx(int idx) const { return m_refIdx[idx]; }
 
-    AMVPInfo* getAMVPInfo() { return &m_cAMVPInfo; }
-
     // ------------------------------------------------------------------------------------------------------------------
     // set
     // ------------------------------------------------------------------------------------------------------------------
diff -r 237bf6667405 -r ec3089ed27c2 source/Lib/TLibCommon/TComPrediction.cpp
--- a/source/Lib/TLibCommon/TComPrediction.cpp	Fri Jan 24 14:43:31 2014 -0600
+++ b/source/Lib/TLibCommon/TComPrediction.cpp	Sat Jan 25 22:35:49 2014 +0900
@@ -603,21 +603,4 @@
     }
 }
 
-// AMVP
-void TComPrediction::getMvPredAMVP(TComDataCU* cu, uint32_t partIdx, uint32_t partAddr, int list, MV& mvPred)
-{
-    AMVPInfo* pcAMVPInfo = cu->getCUMvField(list)->getAMVPInfo();
-
-    if (pcAMVPInfo->m_num <= 1)
-    {
-        mvPred = pcAMVPInfo->m_mvCand[0];
-
-        cu->setMVPIdxSubParts(0, list, partAddr, partIdx, cu->getDepth(partAddr));
-        return;
-    }
-
-    assert(cu->getMVPIdx(list, partAddr) >= 0);
-    mvPred = pcAMVPInfo->m_mvCand[cu->getMVPIdx(list, partAddr)];
-}
-
 //! \}
diff -r 237bf6667405 -r ec3089ed27c2 source/Lib/TLibCommon/TComPrediction.h
--- a/source/Lib/TLibCommon/TComPrediction.h	Fri Jan 24 14:43:31 2014 -0600
+++ b/source/Lib/TLibCommon/TComPrediction.h	Sat Jan 25 22:35:49 2014 +0900
@@ -104,9 +104,6 @@
     // inter
     void motionCompensation(TComDataCU* cu, TComYuv* predYuv, int picList = REF_PIC_LIST_X, int partIdx = -1, bool bLuma = true, bool bChroma = true);
 
-    // motion vector prediction
-    void getMvPredAMVP(TComDataCU* cu, uint32_t partIdx, uint32_t partAddr, int picList, MV& mvPred);
-
     // Angular Intra
     void predIntraLumaAng(uint32_t dirMode, Pel* pred, intptr_t stride, int width);
     void predIntraChromaAng(Pel* src, uint32_t dirMode, Pel* pred, intptr_t stride, int width);
diff -r 237bf6667405 -r ec3089ed27c2 source/Lib/TLibEncoder/TEncCu.cpp
--- a/source/Lib/TLibEncoder/TEncCu.cpp	Fri Jan 24 14:43:31 2014 -0600
+++ b/source/Lib/TLibEncoder/TEncCu.cpp	Sat Jan 25 22:35:49 2014 +0900
@@ -1581,16 +1581,6 @@
     }
 }
 
-void TEncCu::xCopyAMVPInfo(AMVPInfo* src, AMVPInfo* dst)
-{
-    // TODO: SJB - there are multiple implementations of this function, it should be an AMVPInfo method
-    dst->m_num = src->m_num;
-    for (int i = 0; i < src->m_num; i++)
-    {
-        dst->m_mvCand[i] = src->m_mvCand[i];
-    }
-}
-
 void TEncCu::xCopyYuv2Pic(TComPic* outPic, uint32_t cuAddr, uint32_t absPartIdx, uint32_t depth, uint32_t srcDepth, TComDataCU* cu, uint32_t lpelx, uint32_t tpely)
 {
     uint32_t rpelx = lpelx + (g_maxCUWidth >> depth)  - 1;
diff -r 237bf6667405 -r ec3089ed27c2 source/Lib/TLibEncoder/TEncCu.h
--- a/source/Lib/TLibEncoder/TEncCu.h	Fri Jan 24 14:43:31 2014 -0600
+++ b/source/Lib/TLibEncoder/TEncCu.h	Sat Jan 25 22:35:49 2014 +0900
@@ -180,7 +180,6 @@
     void xCheckDQP(TComDataCU* cu);
 
     void xCheckIntraPCM(TComDataCU*& outBestCU, TComDataCU*& outTempCU);
-    void xCopyAMVPInfo(AMVPInfo* src, AMVPInfo* dst);
     void xCopyYuv2Pic(TComPic* outPic, uint32_t cuAddr, uint32_t absPartIdx, uint32_t depth, uint32_t uiSrcDepth, TComDataCU* cu,
                       uint32_t lpelx, uint32_t tpely);
     void xCopyYuv2Tmp(uint32_t uhPartUnitIdx, uint32_t depth);
diff -r 237bf6667405 -r ec3089ed27c2 source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp	Fri Jan 24 14:43:31 2014 -0600
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp	Sat Jan 25 22:35:49 2014 +0900
@@ -2561,7 +2561,7 @@
                         bitsTemp += idx + 1;
                         if (idx == cu->getSlice()->getNumRefIdx(list) - 1) bitsTemp--;
                     }
-                    xEstimateMvPredAMVP(cu, partIdx, list, idx, mvPred[list][idx], &biPDistTemp);
+                    xEstimateMvPredAMVP(cu, partIdx, list, idx, mvPred[list][idx], &amvpInfo[list][idx], &biPDistTemp);
                     mvpIdx[list][idx] = cu->getMVPIdx(list, partAddr);
 
                     bitsTemp += m_mvpIdxCost[mvpIdx[list][idx]][AMVP_MAX_NUM_CANDS];
@@ -2578,8 +2578,7 @@
                     bitsTemp += m_me.bitcost(outmv);
                     costTemp = (satdCost - m_me.mvcost(outmv)) + m_rdCost->getCost(bitsTemp);
 
-                    xCopyAMVPInfo(cu->getCUMvField(list)->getAMVPInfo(), &amvpInfo[list][idx]); // must always be done ( also when AMVP_MODE = AM_NONE )
-                    xCheckBestMVP(cu, list, mvTemp[list][idx], mvPred[list][idx], mvpIdx[list][idx], bitsTemp, costTemp);
+                    xCheckBestMVP(&amvpInfo[list][idx], mvTemp[list][idx], mvPred[list][idx], mvpIdx[list][idx], bitsTemp, costTemp);
 
                     if (costTemp < listCost[list])
                     {
@@ -2653,12 +2652,10 @@
                     int mvpidxZero[2];
                     mvpZero[0] = mvPredBi[0][refIdxBidir[0]];
                     mvpidxZero[0] = mvpIdxBi[0][refIdxBidir[0]];
-                    xCopyAMVPInfo(&amvpInfo[0][refIdxBidir[0]], cu->getCUMvField(REF_PIC_LIST_0)->getAMVPInfo());
-                    xCheckBestMVP(cu, REF_PIC_LIST_0, mvzero, mvpZero[0], mvpidxZero[0], bitsZero0, costZero);
+                    xCheckBestMVP(&amvpInfo[0][refIdxBidir[0]], mvzero, mvpZero[0], mvpidxZero[0], bitsZero0, costZero);
                     mvpZero[1] = mvPredBi[1][refIdxBidir[1]];
                     mvpidxZero[1] = mvpIdxBi[1][refIdxBidir[1]];
-                    xCopyAMVPInfo(&amvpInfo[1][refIdxBidir[1]], cu->getCUMvField(REF_PIC_LIST_1)->getAMVPInfo());
-                    xCheckBestMVP(cu, REF_PIC_LIST_1, mvzero, mvpZero[1], mvpidxZero[1], bitsZero1, costZero);
+                    xCheckBestMVP(&amvpInfo[1][refIdxBidir[1]], mvzero, mvpZero[1], mvpidxZero[1], bitsZero1, costZero);
 
                     if (costZero < costbi)
                     {
@@ -2821,10 +2818,8 @@
 }
 
 // AMVP
-void TEncSearch::xEstimateMvPredAMVP(TComDataCU* cu, uint32_t partIdx, int list, int refIdx, MV& mvPred, uint32_t* distBiP)
+void TEncSearch::xEstimateMvPredAMVP(TComDataCU* cu, uint32_t partIdx, int list, int refIdx, MV& mvPred, AMVPInfo* amvpInfo, uint32_t* distBiP)
 {
-    AMVPInfo* amvpInfo = cu->getCUMvField(list)->getAMVPInfo();
-
     MV   bestMv;
     int  bestIdx = 0;
     uint32_t bestCost = MAX_INT;
@@ -2948,20 +2943,9 @@
     }
 }
 
-void TEncSearch::xCopyAMVPInfo(AMVPInfo* src, AMVPInfo* dst)
+/* Check if using an alternative MVP would result in a smaller MVD + signal bits */
+void TEncSearch::xCheckBestMVP(AMVPInfo* amvpInfo, MV mv, MV& mvPred, int& outMvpIdx, uint32_t& outBits, uint32_t& outCost)
 {
-    dst->m_num = src->m_num;
-    for (int i = 0; i < src->m_num; i++)
-    {
-        dst->m_mvCand[i] = src->m_mvCand[i];
-    }
-}
-
-/* Check if using an alternative MVP would result in a smaller MVD + signal bits */
-void TEncSearch::xCheckBestMVP(TComDataCU* cu, int list, MV mv, MV& mvPred, int& outMvpIdx, uint32_t& outBits, uint32_t& outCost)
-{
-    AMVPInfo* amvpInfo = cu->getCUMvField(list)->getAMVPInfo();
-
     assert(amvpInfo->m_mvCand[outMvpIdx] == mvPred);
     if (amvpInfo->m_num < 2) return;
 
diff -r 237bf6667405 -r ec3089ed27c2 source/Lib/TLibEncoder/TEncSearch.h
--- a/source/Lib/TLibEncoder/TEncSearch.h	Fri Jan 24 14:43:31 2014 -0600
+++ b/source/Lib/TLibEncoder/TEncSearch.h	Sat Jan 25 22:35:49 2014 +0900
@@ -222,15 +222,14 @@
     // --------------------------------------------------------------------------------------------
 
     void xEstimateMvPredAMVP(TComDataCU* cu, uint32_t partIdx, int picList, int refIdx,
-                             MV& mvPred, uint32_t* distBiP = NULL);
+                             MV& mvPred, AMVPInfo* amvpInfo, uint32_t* distBiP = NULL);
 
-    void xCheckBestMVP(TComDataCU* cu, int picList, MV cMv, MV& mvPred, int& mvpIdx,
+    void xCheckBestMVP(AMVPInfo* amvpInfo, MV cMv, MV& mvPred, int& mvpIdx,
                        uint32_t& outBits, uint32_t& outCost);
 
     uint32_t xGetTemplateCost(TComDataCU* cu, uint32_t partAddr, TComYuv* templateCand, MV mvCand, int mvpIdx,
                               int mvpCandCount, int picList, int refIdx, int sizex, int sizey);
 
-    void xCopyAMVPInfo(AMVPInfo* src, AMVPInfo* dst);
     uint32_t xGetMvpIdxBits(int idx, int num);
     void xGetBlkBits(PartSize cuMode, bool bPSlice, int partIdx, uint32_t lastMode, uint32_t blockBit[3]);
 


More information about the x265-devel mailing list