[x265] [PATCH 13 of 14] predict: remove list argument from motionCompensation(), always REF_PIC_LIST_X

Steve Borho steve at borho.org
Sat Sep 20 18:46:12 CEST 2014


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1411234752 -3600
#      Sat Sep 20 18:39:12 2014 +0100
# Node ID f8ee6c103fafc6537eb98483ab6c082859190d3b
# Parent  692d56f307081135f2aacd7b7692b010cae33498
predict: remove list argument from motionCompensation(), always REF_PIC_LIST_X

diff -r 692d56f30708 -r f8ee6c103faf source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp	Sat Sep 20 18:30:35 2014 +0100
+++ b/source/encoder/analysis.cpp	Sat Sep 20 18:39:12 2014 +0100
@@ -858,7 +858,7 @@
                     for (int partIdx = 0; partIdx < numPart; partIdx++)
                     {
                         prepMotionCompensation(outBestCU, partIdx);
-                        motionCompensation(outBestCU, m_bestPredYuv[depth], REF_PIC_LIST_X, false, true);
+                        motionCompensation(outBestCU, m_bestPredYuv[depth], false, true);
                     }
 
                     encodeResAndCalcRdInterCU(outBestCU, m_origYuv[depth], m_bestPredYuv[depth], m_tmpResiYuv[depth],
@@ -928,7 +928,7 @@
                         for (int partIdx = 0; partIdx < numPart; partIdx++)
                         {
                             prepMotionCompensation(outBestCU, partIdx);
-                            motionCompensation(outBestCU, m_bestPredYuv[depth], REF_PIC_LIST_X, false, true);
+                            motionCompensation(outBestCU, m_bestPredYuv[depth], false, true);
                         }
 
                         encodeResAndCalcRdInterCU(outBestCU, m_origYuv[depth], m_bestPredYuv[depth], m_tmpResiYuv[depth],
@@ -955,7 +955,7 @@
                         for (int partIdx = 0; partIdx < numPart; partIdx++)
                         {
                             prepMotionCompensation(outBestCU, partIdx);
-                            motionCompensation(outBestCU, m_bestPredYuv[depth], REF_PIC_LIST_X, false, true);
+                            motionCompensation(outBestCU, m_bestPredYuv[depth], false, true);
                         }
 
                         m_tmpResiYuv[depth]->subtract(m_origYuv[depth], m_bestPredYuv[depth], outBestCU->getLog2CUSize(0));
@@ -972,7 +972,7 @@
                         for (int partIdx = 0; partIdx < numPart; partIdx++)
                         {
                             prepMotionCompensation(outBestCU, partIdx);
-                            motionCompensation(outBestCU, m_bestPredYuv[depth], REF_PIC_LIST_X, false, true);
+                            motionCompensation(outBestCU, m_bestPredYuv[depth], false, true);
                         }
                     }
                 }
@@ -1562,7 +1562,7 @@
             // do MC only for Luma part
             /* Set CU parameters for motion compensation */
             prepMotionCompensation(outTempCU, 0);
-            motionCompensation(outTempCU, m_tmpPredYuv[depth], REF_PIC_LIST_X, true, false);
+            motionCompensation(outTempCU, m_tmpPredYuv[depth], true, false);
             uint32_t bitsCand = getTUBits(mergeCand, maxNumMergeCand);
             outTempCU->m_totalBits = bitsCand;
             outTempCU->m_totalDistortion = primitives.sa8d[sizeIdx](m_origYuv[depth]->getLumaAddr(), m_origYuv[depth]->getStride(),
@@ -1601,7 +1601,7 @@
             for (int partIdx = 0; partIdx < numPart; partIdx++)
             {
                 prepMotionCompensation(outBestCU, partIdx);
-                motionCompensation(outBestCU, bestPredYuv, REF_PIC_LIST_X, false, true);
+                motionCompensation(outBestCU, bestPredYuv, false, true);
             }
 
             if (outTempCU->isLosslessCoded(0))
@@ -1675,7 +1675,7 @@
 
                     // do MC
                     prepMotionCompensation(outTempCU, 0);
-                    motionCompensation(outTempCU, m_tmpPredYuv[depth], REF_PIC_LIST_X, true, true);
+                    motionCompensation(outTempCU, m_tmpPredYuv[depth], true, true);
                     // estimate residual and encode everything
                     if (noResidual)
                         encodeResAndCalcRdSkipCU(outTempCU,
diff -r 692d56f30708 -r f8ee6c103faf source/encoder/predict.cpp
--- a/source/encoder/predict.cpp	Sat Sep 20 18:30:35 2014 +0100
+++ b/source/encoder/predict.cpp	Sat Sep 20 18:39:12 2014 +0100
@@ -194,27 +194,25 @@
     cu->clipMv(m_clippedMv[1]);
 }
 
-void Predict::motionCompensation(TComDataCU* cu, TComYuv* predYuv, int list, bool bLuma, bool bChroma)
+void Predict::motionCompensation(TComDataCU* cu, TComYuv* predYuv, bool bLuma, bool bChroma)
 {
     if (m_slice->isInterP())
-        list = REF_PIC_LIST_0;
-    if (list != REF_PIC_LIST_X)
     {
         if (m_slice->m_pps->bUseWeightPred)
         {
             ShortYuv* shortYuv = &m_predShortYuv[0];
-            int refId = m_mvField[list]->getRefIdx(m_partAddr);
+            int refId = m_mvField[0]->getRefIdx(m_partAddr);
             X265_CHECK(refId >= 0, "refidx is not positive\n");
 
             if (bLuma)
-                predInterLumaBlk(m_slice->m_refPicList[list][refId]->getPicYuvRec(), shortYuv, &m_clippedMv[list]);
+                predInterLumaBlk(m_slice->m_refPicList[0][refId]->getPicYuvRec(), shortYuv, &m_clippedMv[0]);
             if (bChroma)
-                predInterChromaBlk(m_slice->m_refPicList[list][refId]->getPicYuvRec(), shortYuv, &m_clippedMv[list]);
+                predInterChromaBlk(m_slice->m_refPicList[0][refId]->getPicYuvRec(), shortYuv, &m_clippedMv[0]);
 
-            weightedPredictionUni(cu, shortYuv, m_partAddr, m_width, m_height, list, predYuv, -1, bLuma, bChroma);
+            weightedPredictionUni(cu, shortYuv, m_partAddr, m_width, m_height, 0, predYuv, -1, bLuma, bChroma);
         }
         else
-            predInterUni(list, predYuv, bLuma, bChroma);
+            predInterUni(0, predYuv, bLuma, bChroma);
     }
     else
     {
@@ -288,6 +286,7 @@
 
             if (pwp0->bPresentFlag)
             {
+                /* TODO: can we use fast weighted uni-prediction here? */
                 predInterUni(0, &m_predShortYuv[0], bLuma, bChroma);
                 addWeightUni(&m_predShortYuv[0], m_partAddr, m_width, m_height, pwp0, outPredYuv, bLuma, bChroma);
             }
@@ -301,6 +300,7 @@
 
             if (pwp1->bPresentFlag)
             {
+                /* TODO: can we use fast weighted uni-prediction here? */
                 predInterUni(1, &m_predShortYuv[1], bLuma, bChroma);
                 addWeightUni(&m_predShortYuv[1], m_partAddr, m_width, m_height, pwp1, outPredYuv, bLuma, bChroma);
             }
diff -r 692d56f30708 -r f8ee6c103faf source/encoder/predict.h
--- a/source/encoder/predict.h	Sat Sep 20 18:30:35 2014 +0100
+++ b/source/encoder/predict.h	Sat Sep 20 18:39:12 2014 +0100
@@ -95,7 +95,7 @@
 
     // prepMotionCompensation needs to be called to prepare MC with CU-relevant data */
     void prepMotionCompensation(TComDataCU* cu, int partIdx);
-    void motionCompensation(TComDataCU* cu, TComYuv* predYuv, int picList, bool bLuma, bool bChroma);
+    void motionCompensation(TComDataCU* cu, TComYuv* predYuv, bool bLuma, bool bChroma);
 
     // Angular Intra
     void predIntraLumaAng(uint32_t dirMode, pixel* pred, intptr_t stride, uint32_t log2TrSize);
diff -r 692d56f30708 -r f8ee6c103faf source/encoder/search.cpp
--- a/source/encoder/search.cpp	Sat Sep 20 18:30:35 2014 +0100
+++ b/source/encoder/search.cpp	Sat Sep 20 18:39:12 2014 +0100
@@ -1637,7 +1637,7 @@
         cu->getCUMvField(REF_PIC_LIST_1)->m_refIdx[m.absPartIdx] = (char)m.mvFieldNeighbours[mergeCand][1].refIdx;
 
         prepMotionCompensation(cu, puIdx);
-        motionCompensation(cu, &m_predTempYuv, REF_PIC_LIST_X, true, false);
+        motionCompensation(cu, &m_predTempYuv, true, false);
         uint32_t costCand = m_me.bufSATD(m_predTempYuv.getLumaAddr(m.absPartIdx), m_predTempYuv.getStride());
         uint32_t bitsCand = getTUBits(mergeCand, m.maxNumMergeCand);
         costCand = costCand + m_rdCost.getCost(bitsCand);
@@ -1717,7 +1717,7 @@
                 totalmebits += merge.bits;
 
                 prepMotionCompensation(cu, partIdx);
-                motionCompensation(cu, predYuv, REF_PIC_LIST_X, true, bChroma);
+                motionCompensation(cu, predYuv, true, bChroma);
                 continue;
             }
         }
@@ -1933,7 +1933,7 @@
             totalmebits += list[1].bits;
         }
         prepMotionCompensation(cu, partIdx);
-        motionCompensation(cu, predYuv, REF_PIC_LIST_X, true, bChroma);
+        motionCompensation(cu, predYuv, true, bChroma);
     }
 
     m_predYuv[0].destroy();


More information about the x265-devel mailing list