[x265-commits] [x265] api: repair `--keyint -1` behavior; single keyframe at be...

Steve Borho steve at borho.org
Mon Feb 10 18:08:49 CET 2014


details:   http://hg.videolan.org/x265/rev/60e6a7339027
branches:  
changeset: 6058:60e6a7339027
user:      Steve Borho <steve at borho.org>
date:      Sun Feb 09 21:35:46 2014 -0600
description:
api: repair `--keyint -1` behavior; single keyframe at beginning of stream

Also, disable scene cut detection to save a few cycles in lookahead. Fix and/or
improve documentation for the keyint parameters
Subject: [x265] cleanup MPM related

details:   http://hg.videolan.org/x265/rev/0b44c6c07582
branches:  
changeset: 6059:0b44c6c07582
user:      Satoshi Nakagawa <nakagawa424 at oki.com>
date:      Sun Feb 09 16:56:37 2014 +0900
description:
cleanup MPM related
Subject: [x265] improve getInterMergeCandidates()

details:   http://hg.videolan.org/x265/rev/2fc9c0a08534
branches:  
changeset: 6060:2fc9c0a08534
user:      Satoshi Nakagawa <nakagawa424 at oki.com>
date:      Sat Feb 08 22:50:38 2014 +0900
description:
improve getInterMergeCandidates()
Subject: [x265] TComPic: clean up data member ordering, add comments

details:   http://hg.videolan.org/x265/rev/17847935873a
branches:  
changeset: 6061:17847935873a
user:      Steve Borho <steve at borho.org>
date:      Mon Feb 10 10:57:42 2014 -0600
description:
TComPic: clean up data member ordering, add comments
Subject: [x265] weightp rewrite without a class

details:   http://hg.videolan.org/x265/rev/4ec4065fc392
branches:  
changeset: 6062:4ec4065fc392
user:      Steve Borho <steve at borho.org>
date:      Fri Feb 07 13:58:20 2014 -0600
description:
weightp rewrite without a class

weightp analysis for the main encoder is performed with motion compensation
(using lowres motion vectors from lookahead) when available.  The lowres
luma plane is used for luma analysis and the chroma planes are analysed as-is.
Subject: [x265] weightp: extend chroma borders before mcChroma, remove redundant checks

details:   http://hg.videolan.org/x265/rev/62c760413522
branches:  
changeset: 6063:62c760413522
user:      Kavitha Sampath <kavitha at multicorewareinc.com>
date:      Mon Feb 10 20:03:41 2014 +0530
description:
weightp: extend chroma borders before mcChroma, remove redundant checks
Subject: [x265] TComPic: add m_chromaPlanesExtended member var

details:   http://hg.videolan.org/x265/rev/8d98425e0a0a
branches:  
changeset: 6064:8d98425e0a0a
user:      Steve Borho <steve at borho.org>
date:      Mon Feb 10 10:57:44 2014 -0600
description:
TComPic: add m_chromaPlanesExtended member var
Subject: [x265] weightp: avoid redundant chroma extensions

details:   http://hg.videolan.org/x265/rev/ce7191f49948
branches:  
changeset: 6065:ce7191f49948
user:      Steve Borho <steve at borho.org>
date:      Mon Feb 10 11:07:53 2014 -0600
description:
weightp: avoid redundant chroma extensions

diffstat:

 source/Lib/TLibCommon/TComDataCU.cpp  |  193 ++++-------
 source/Lib/TLibCommon/TComDataCU.h    |    4 +-
 source/Lib/TLibCommon/TComPic.cpp     |    1 +
 source/Lib/TLibCommon/TComPic.h       |   15 +-
 source/Lib/TLibEncoder/TEncSbac.cpp   |    5 +-
 source/Lib/TLibEncoder/TEncSearch.cpp |   18 +-
 source/common/common.cpp              |   12 +-
 source/encoder/CMakeLists.txt         |    2 +-
 source/encoder/dpb.cpp                |    1 +
 source/encoder/encoder.cpp            |   21 +-
 source/encoder/frameencoder.cpp       |   24 +-
 source/encoder/frameencoder.h         |    1 -
 source/encoder/weightPrediction.cpp   |  543 +++++++++++++++++++--------------
 source/encoder/weightPrediction.h     |   59 ---
 source/x265.cpp                       |    4 +-
 source/x265.h                         |   11 +-
 16 files changed, 445 insertions(+), 469 deletions(-)

diffs (truncated from 1529 to 300 lines):

diff -r fa9f7b56d4d8 -r ce7191f49948 source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp	Fri Feb 07 21:37:17 2014 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.cpp	Mon Feb 10 11:07:53 2014 -0600
@@ -1162,7 +1162,7 @@ void TComDataCU::getAllowedChromaDir(uin
 *\param   piMode          it is set with MPM mode in case both MPM are equal. It is used to restrict RD search at encode side.
 *\returns Number of MPM
 */
-void TComDataCU::getIntraDirLumaPredictor(uint32_t absPartIdx, int32_t* intraDirPred, int32_t* modes)
+int TComDataCU::getIntraDirLumaPredictor(uint32_t absPartIdx, int32_t* intraDirPred)
 {
     TComDataCU* tempCU;
     uint32_t        tempPartIdx;
@@ -1171,25 +1171,20 @@ void TComDataCU::getIntraDirLumaPredicto
     // Get intra direction of left PU
     tempCU = getPULeft(tempPartIdx, m_absIdxInLCU + absPartIdx);
 
-    leftIntraDir  = tempCU ? (tempCU->isIntra(tempPartIdx) ? tempCU->getLumaIntraDir(tempPartIdx) : DC_IDX) : DC_IDX;
+    leftIntraDir  = (tempCU && tempCU->isIntra(tempPartIdx)) ? tempCU->getLumaIntraDir(tempPartIdx) : DC_IDX;
 
     // Get intra direction of above PU
     tempCU = getPUAbove(tempPartIdx, m_absIdxInLCU + absPartIdx, true, true);
 
-    aboveIntraDir = tempCU ? (tempCU->isIntra(tempPartIdx) ? tempCU->getLumaIntraDir(tempPartIdx) : DC_IDX) : DC_IDX;
+    aboveIntraDir = (tempCU && tempCU->isIntra(tempPartIdx)) ? tempCU->getLumaIntraDir(tempPartIdx) : DC_IDX;
 
     if (leftIntraDir == aboveIntraDir)
     {
-        if (modes)
-        {
-            *modes = 1;
-        }
-
-        if (leftIntraDir > 1) // angular modes
+        if (leftIntraDir >= 2) // angular modes
         {
             intraDirPred[0] = leftIntraDir;
-            intraDirPred[1] = ((leftIntraDir + 29) % 32) + 2;
-            intraDirPred[2] = ((leftIntraDir - 1) % 32) + 2;
+            intraDirPred[1] = ((leftIntraDir - 2 + 31) & 31) + 2;
+            intraDirPred[2] = ((leftIntraDir - 2 +  1) & 31) + 2;
         }
         else //non-angular
         {
@@ -1197,13 +1192,10 @@ void TComDataCU::getIntraDirLumaPredicto
             intraDirPred[1] = DC_IDX;
             intraDirPred[2] = VER_IDX;
         }
+        return 1;
     }
     else
     {
-        if (modes)
-        {
-            *modes = 2;
-        }
         intraDirPred[0] = leftIntraDir;
         intraDirPred[1] = aboveIntraDir;
 
@@ -1215,6 +1207,7 @@ void TComDataCU::getIntraDirLumaPredicto
         {
             intraDirPred[2] =  (leftIntraDir + aboveIntraDir) < 2 ? VER_IDX : DC_IDX;
         }
+        return 2;
     }
 }
 
@@ -1914,19 +1907,19 @@ bool TComDataCU::hasEqualMotion(uint32_t
  * \param numValidMergeCand
  */
 void TComDataCU::getInterMergeCandidates(uint32_t absPartIdx, uint32_t puIdx, TComMvField* mvFieldNeighbours, UChar* interDirNeighbours,
-                                         int& numValidMergeCand, int mrgCandIdx)
+                                         int& numValidMergeCand)
 {
     uint32_t absPartAddr = m_absIdxInLCU + absPartIdx;
-    bool abCandIsInter[MRG_MAX_NUM_CANDS];
-
-    for (uint32_t i = 0; i < getSlice()->getMaxNumMergeCand(); ++i)
+    const uint32_t maxNumMergeCand = getSlice()->getMaxNumMergeCand();
+    const bool isInterB = getSlice()->isInterB();
+
+    for (uint32_t i = 0; i < maxNumMergeCand; ++i)
     {
-        abCandIsInter[i] = false;
         mvFieldNeighbours[(i << 1)].refIdx = NOT_VALID;
         mvFieldNeighbours[(i << 1) + 1].refIdx = NOT_VALID;
     }
 
-    numValidMergeCand = getSlice()->getMaxNumMergeCand();
+    numValidMergeCand = maxNumMergeCand;
     // compute the location of the current PU
     int xP, yP, nPSW, nPSH;
     this->getPartPosition(puIdx, xP, yP, nPSW, nPSH);
@@ -1935,7 +1928,6 @@ void TComDataCU::getInterMergeCandidates
 
     uint32_t partIdxLT, partIdxRT, partIdxLB;
     PartSize curPS = getPartitionSize(absPartIdx);
-    deriveLeftRightTopIdxGeneral(absPartIdx, puIdx, partIdxLT, partIdxRT);
     deriveLeftBottomIdxGeneral(absPartIdx, puIdx, partIdxLB);
 
     //left
@@ -1948,27 +1940,24 @@ void TComDataCU::getInterMergeCandidates
         !cuLeft->isIntra(leftPartIdx);
     if (isAvailableA1)
     {
-        abCandIsInter[count] = true;
         // get Inter Dir
         interDirNeighbours[count] = cuLeft->getInterDir(leftPartIdx);
         // get Mv from Left
         cuLeft->getMvField(cuLeft, leftPartIdx, REF_PIC_LIST_0, mvFieldNeighbours[count << 1]);
-        if (getSlice()->isInterB())
+        if (isInterB)
         {
             cuLeft->getMvField(cuLeft, leftPartIdx, REF_PIC_LIST_1, mvFieldNeighbours[(count << 1) + 1]);
         }
-        if (mrgCandIdx == count)
+        count++;
+        // early termination
+        if (count == maxNumMergeCand)
         {
             return;
         }
-        count++;
     }
 
-    // early termination
-    if (count == getSlice()->getMaxNumMergeCand())
-    {
-        return;
-    }
+    deriveLeftRightTopIdxGeneral(absPartIdx, puIdx, partIdxLT, partIdxRT);
+
     // above
     uint32_t abovePartIdx = 0;
     TComDataCU* cuAbove = 0;
@@ -1979,25 +1968,20 @@ void TComDataCU::getInterMergeCandidates
         !cuAbove->isIntra(abovePartIdx);
     if (isAvailableB1 && (!isAvailableA1 || !cuLeft->hasEqualMotion(leftPartIdx, cuAbove, abovePartIdx)))
     {
-        abCandIsInter[count] = true;
         // get Inter Dir
         interDirNeighbours[count] = cuAbove->getInterDir(abovePartIdx);
         // get Mv from Left
         cuAbove->getMvField(cuAbove, abovePartIdx, REF_PIC_LIST_0, mvFieldNeighbours[count << 1]);
-        if (getSlice()->isInterB())
+        if (isInterB)
         {
             cuAbove->getMvField(cuAbove, abovePartIdx, REF_PIC_LIST_1, mvFieldNeighbours[(count << 1) + 1]);
         }
-        if (mrgCandIdx == count)
+        count++;
+        // early termination
+        if (count == maxNumMergeCand)
         {
             return;
         }
-        count++;
-    }
-    // early termination
-    if (count == getSlice()->getMaxNumMergeCand())
-    {
-        return;
     }
 
     // above right
@@ -2009,25 +1993,20 @@ void TComDataCU::getInterMergeCandidates
         !cuAboveRight->isIntra(aboveRightPartIdx);
     if (isAvailableB0 && (!isAvailableB1 || !cuAbove->hasEqualMotion(abovePartIdx, cuAboveRight, aboveRightPartIdx)))
     {
-        abCandIsInter[count] = true;
         // get Inter Dir
         interDirNeighbours[count] = cuAboveRight->getInterDir(aboveRightPartIdx);
         // get Mv from Left
         cuAboveRight->getMvField(cuAboveRight, aboveRightPartIdx, REF_PIC_LIST_0, mvFieldNeighbours[count << 1]);
-        if (getSlice()->isInterB())
+        if (isInterB)
         {
             cuAboveRight->getMvField(cuAboveRight, aboveRightPartIdx, REF_PIC_LIST_1, mvFieldNeighbours[(count << 1) + 1]);
         }
-        if (mrgCandIdx == count)
+        count++;
+        // early termination
+        if (count == maxNumMergeCand)
         {
             return;
         }
-        count++;
-    }
-    // early termination
-    if (count == getSlice()->getMaxNumMergeCand())
-    {
-        return;
     }
 
     //left bottom
@@ -2039,26 +2018,22 @@ void TComDataCU::getInterMergeCandidates
         !cuLeftBottom->isIntra(leftBottomPartIdx);
     if (isAvailableA0 && (!isAvailableA1 || !cuLeft->hasEqualMotion(leftPartIdx, cuLeftBottom, leftBottomPartIdx)))
     {
-        abCandIsInter[count] = true;
         // get Inter Dir
         interDirNeighbours[count] = cuLeftBottom->getInterDir(leftBottomPartIdx);
         // get Mv from Left
         cuLeftBottom->getMvField(cuLeftBottom, leftBottomPartIdx, REF_PIC_LIST_0, mvFieldNeighbours[count << 1]);
-        if (getSlice()->isInterB())
+        if (isInterB)
         {
             cuLeftBottom->getMvField(cuLeftBottom, leftBottomPartIdx, REF_PIC_LIST_1, mvFieldNeighbours[(count << 1) + 1]);
         }
-        if (mrgCandIdx == count)
+        count++;
+        // early termination
+        if (count == maxNumMergeCand)
         {
             return;
         }
-        count++;
     }
-    // early termination
-    if (count == getSlice()->getMaxNumMergeCand())
-    {
-        return;
-    }
+
     // above left
     if (count < 4)
     {
@@ -2071,32 +2046,26 @@ void TComDataCU::getInterMergeCandidates
         if (isAvailableB2 && (!isAvailableA1 || !cuLeft->hasEqualMotion(leftPartIdx, cuAboveLeft, aboveLeftPartIdx))
             && (!isAvailableB1 || !cuAbove->hasEqualMotion(abovePartIdx, cuAboveLeft, aboveLeftPartIdx)))
         {
-            abCandIsInter[count] = true;
             // get Inter Dir
             interDirNeighbours[count] = cuAboveLeft->getInterDir(aboveLeftPartIdx);
             // get Mv from Left
             cuAboveLeft->getMvField(cuAboveLeft, aboveLeftPartIdx, REF_PIC_LIST_0, mvFieldNeighbours[count << 1]);
-            if (getSlice()->isInterB())
+            if (isInterB)
             {
                 cuAboveLeft->getMvField(cuAboveLeft, aboveLeftPartIdx, REF_PIC_LIST_1, mvFieldNeighbours[(count << 1) + 1]);
             }
-            if (mrgCandIdx == count)
+            count++;
+            // early termination
+            if (count == maxNumMergeCand)
             {
                 return;
             }
-            count++;
         }
     }
-    // early termination
-    if (count == getSlice()->getMaxNumMergeCand())
-    {
-        return;
-    }
     if (getSlice()->getEnableTMVPFlag())
     {
         //>> MTK colocated-RightBottom
         uint32_t partIdxRB;
-        int lcuIdx;
 
         deriveRightBottomIdx(puIdx, partIdxRB);
 
@@ -2105,14 +2074,13 @@ void TComDataCU::getInterMergeCandidates
 
         MV colmv;
         int refIdx;
+        int lcuIdx = -1;
 
         if ((m_pic->getCU(m_cuAddr)->getCUPelX() + g_rasterToPelX[uiAbsPartIdxTmp] + m_pic->getMinCUWidth()) >= m_slice->getSPS()->getPicWidthInLumaSamples())  // image boundary check
         {
-            lcuIdx = -1;
         }
         else if ((m_pic->getCU(m_cuAddr)->getCUPelY() + g_rasterToPelY[uiAbsPartIdxTmp] + m_pic->getMinCUHeight()) >= m_slice->getSPS()->getPicHeightInLumaSamples())
         {
-            lcuIdx = -1;
         }
         else
         {
@@ -2125,7 +2093,6 @@ void TComDataCU::getInterMergeCandidates
             else if (uiAbsPartIdxTmp % numPartInCUWidth < numPartInCUWidth - 1)       // is not at the last column of LCU But is last row of LCU
             {
                 absPartAddr = g_rasterToZscan[(uiAbsPartIdxTmp + numPartInCUWidth + 1) % m_pic->getNumPartInCU()];
-                lcuIdx = -1;
             }
             else if (uiAbsPartIdxTmp / numPartInCUWidth < m_pic->getNumPartInHeight() - 1) // is not at the last row of LCU But is last column of LCU
             {
@@ -2135,7 +2102,6 @@ void TComDataCU::getInterMergeCandidates
             else //is the right bottom corner of LCU
             {
                 absPartAddr = 0;
-                lcuIdx = -1;
             }
         }
 
@@ -2157,7 +2123,7 @@ void TComDataCU::getInterMergeCandidates
             mvFieldNeighbours[2 * arrayAddr].setMvField(colmv, refIdx);
         }
 
-        if (getSlice()->isInterB())


More information about the x265-commits mailing list