[x265-commits] [x265] wavefront: bug fix

Steve Borho steve at borho.org
Thu Jan 16 19:55:59 CET 2014


details:   http://hg.videolan.org/x265/rev/9e923f539d89
branches:  stable
changeset: 5825:9e923f539d89
user:      Steve Borho <steve at borho.org>
date:      Tue Jan 14 19:08:21 2014 -0600
description:
wavefront: bug fix
Subject: [x265] cleanup MVPNum

details:   http://hg.videolan.org/x265/rev/e7624ab39cff
branches:  
changeset: 5826:e7624ab39cff
user:      Satoshi Nakagawa <nakagawa424 at oki.com>
date:      Thu Jan 09 10:55:07 2014 +0900
description:
cleanup MVPNum
Subject: [x265] Merge with stable

details:   http://hg.videolan.org/x265/rev/7af141be0e7a
branches:  
changeset: 5827:7af141be0e7a
user:      Steve Borho <steve at borho.org>
date:      Tue Jan 14 23:13:35 2014 -0600
description:
Merge with stable
Subject: [x265] slicetype: remove --refresh and use --open-gop(default: enable)

details:   http://hg.videolan.org/x265/rev/27c2dac98a3c
branches:  
changeset: 5828:27c2dac98a3c
user:      Kavitha Sampath <kavitha at multicorewareinc.com>
date:      Tue Dec 17 13:14:20 2013 +0530
description:
slicetype: remove --refresh and use --open-gop(default: enable)
Subject: [x265] x265: help nit

details:   http://hg.videolan.org/x265/rev/e5d28e2c5a82
branches:  
changeset: 5829:e5d28e2c5a82
user:      Steve Borho <steve at borho.org>
date:      Wed Jan 15 10:57:06 2014 -0600
description:
x265: help nit
Subject: [x265] cleanup initCU()

details:   http://hg.videolan.org/x265/rev/37b4ca796088
branches:  
changeset: 5830:37b4ca796088
user:      Min Chen <chenm003 at 163.com>
date:      Wed Jan 15 17:51:11 2014 +0800
description:
cleanup initCU()

diffstat:

 source/CMakeLists.txt                    |   2 +-
 source/Lib/TLibCommon/TComDataCU.cpp     |  89 ++++++++++-------------------
 source/Lib/TLibCommon/TComDataCU.h       |   6 --
 source/Lib/TLibCommon/TComPrediction.cpp |   1 -
 source/Lib/TLibEncoder/TEncSearch.cpp    |  12 ----
 source/common/CMakeLists.txt             |   2 +-
 source/common/common.cpp                 |   7 +-
 source/common/wavefront.cpp              |   2 +-
 source/common/x86/asm-primitives.cpp     |  10 ++-
 source/common/x86/intrapred.h            |  38 ++++++++++++-
 source/common/x86/intrapred8.asm         |  76 +++++++++++++++++++++++++
 source/common/x86/ipfilter8.asm          |  94 ++++++++++++++++++++++++-------
 source/encoder/dpb.cpp                   |   4 +-
 source/encoder/slicetype.cpp             |   2 +-
 source/x265.cpp                          |   5 +-
 source/x265.h                            |   6 +-
 16 files changed, 238 insertions(+), 118 deletions(-)

diffs (truncated from 718 to 300 lines):

diff -r 8e0fa5fcbf15 -r 37b4ca796088 source/CMakeLists.txt
--- a/source/CMakeLists.txt	Mon Jan 13 16:05:56 2014 -0600
+++ b/source/CMakeLists.txt	Wed Jan 15 17:51:11 2014 +0800
@@ -154,8 +154,8 @@ endif()
 
 include(version) # determine X265_VERSION and X265_LATEST_TAG
 include_directories(. Lib common encoder "${PROJECT_BINARY_DIR}")
+add_subdirectory(encoder)
 add_subdirectory(common)
-add_subdirectory(encoder)
 
 if((MSVC_IDE OR XCODE) AND ENABLE_ASSEMBLY)
     # this is horrible. ugly, and hacky, and it reproduces logic found
diff -r 8e0fa5fcbf15 -r 37b4ca796088 source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp	Mon Jan 13 16:05:56 2014 -0600
+++ b/source/Lib/TLibCommon/TComDataCU.cpp	Wed Jan 15 17:51:11 2014 +0800
@@ -98,8 +98,6 @@ TComDataCU::TComDataCU()
     m_cuColocated[1] = NULL;
     m_mvpIdx[0] = NULL;
     m_mvpIdx[1] = NULL;
-    m_mvpNum[0] = NULL;
-    m_mvpNum[1] = NULL;
     m_chromaFormat = 0;
 }
 
@@ -152,8 +150,6 @@ void TComDataCU::create(uint32_t numPart
 
     m_mvpIdx[0] = new char[numPartition];
     m_mvpIdx[1] = new char[numPartition];
-    m_mvpNum[0] = new char[numPartition];
-    m_mvpNum[1] = new char[numPartition];
 
     m_trCoeffY  = (TCoeff*)X265_MALLOC(TCoeff, width * height);
     m_trCoeffCb = (TCoeff*)X265_MALLOC(TCoeff, (width >> m_hChromaShift) * (height >> m_vChromaShift));
@@ -203,10 +199,6 @@ void TComDataCU::destroy()
     m_mvpIdx[0] = NULL;
     delete[] m_mvpIdx[1];
     m_mvpIdx[1] = NULL;
-    delete[] m_mvpNum[0];
-    m_mvpNum[0] = NULL;
-    delete[] m_mvpNum[1];
-    m_mvpNum[1] = NULL;
     delete[] m_skipFlag;
     m_skipFlag = NULL;
     delete[] m_partSizes;
@@ -254,49 +246,45 @@ void TComDataCU::initCU(TComPic* pic, ui
     }
 
     // CHECK_ME: why partStartIdx always negative
-    int partStartIdx = 0 - (cuAddr) * pic->getNumPartInCU();
-    int firstElement = std::max<int>(partStartIdx, 0);
-    int numElements = m_numPartitions - firstElement;
-
-    if (numElements > 0)
+    int numElements = m_numPartitions;
+    assert(numElements > 0);
+
     {
-        memset(m_skipFlag         + firstElement, false,                    numElements * sizeof(*m_skipFlag));
-        memset(m_predModes        + firstElement, MODE_NONE,                numElements * sizeof(*m_predModes));
-        memset(m_cuTransquantBypass + firstElement, false,                  numElements * sizeof(*m_cuTransquantBypass));
-        memset(m_depth            + firstElement, 0,                        numElements * sizeof(*m_depth));
-        memset(m_trIdx            + firstElement, 0,                        numElements * sizeof(*m_trIdx));
-        memset(m_transformSkip[0] + firstElement, 0,                        numElements * sizeof(*m_transformSkip[0]));
-        memset(m_transformSkip[1] + firstElement, 0,                        numElements * sizeof(*m_transformSkip[1]));
-        memset(m_transformSkip[2] + firstElement, 0,                        numElements * sizeof(*m_transformSkip[2]));
-        memset(m_width            + firstElement, g_maxCUWidth,             numElements * sizeof(*m_width));
-        memset(m_height           + firstElement, g_maxCUHeight,            numElements * sizeof(*m_height));
-        memset(m_mvpNum[0]        + firstElement, -1,                       numElements * sizeof(*m_mvpNum[0]));
-        memset(m_mvpNum[1]        + firstElement, -1,                       numElements * sizeof(*m_mvpNum[1]));
-        memset(m_qp               + firstElement, qp,                       numElements * sizeof(*m_qp));
-        memset(m_bMergeFlags      + firstElement, false,                    numElements * sizeof(*m_bMergeFlags));
-        memset(m_mergeIndex       + firstElement, 0,                        numElements * sizeof(*m_mergeIndex));
-        memset(m_lumaIntraDir     + firstElement, DC_IDX,                   numElements * sizeof(*m_lumaIntraDir));
-        memset(m_chromaIntraDir   + firstElement, 0,                        numElements * sizeof(*m_chromaIntraDir));
-        memset(m_interDir         + firstElement, 0,                        numElements * sizeof(*m_interDir));
-        memset(m_cbf[0]           + firstElement, 0,                        numElements * sizeof(*m_cbf[0]));
-        memset(m_cbf[1]           + firstElement, 0,                        numElements * sizeof(*m_cbf[1]));
-        memset(m_cbf[2]           + firstElement, 0,                        numElements * sizeof(*m_cbf[2]));
-        memset(m_iPCMFlags        + firstElement, false,                    numElements * sizeof(*m_iPCMFlags));
+        memset(m_skipFlag         , false,                    numElements * sizeof(*m_skipFlag));
+        memset(m_predModes        , MODE_NONE,                numElements * sizeof(*m_predModes));
+        memset(m_cuTransquantBypass, false,                   numElements * sizeof(*m_cuTransquantBypass));
+        memset(m_depth            , 0,                        numElements * sizeof(*m_depth));
+        memset(m_trIdx            , 0,                        numElements * sizeof(*m_trIdx));
+        memset(m_transformSkip[0] , 0,                        numElements * sizeof(*m_transformSkip[0]));
+        memset(m_transformSkip[1] , 0,                        numElements * sizeof(*m_transformSkip[1]));
+        memset(m_transformSkip[2] , 0,                        numElements * sizeof(*m_transformSkip[2]));
+        memset(m_width            , g_maxCUWidth,             numElements * sizeof(*m_width));
+        memset(m_height           , g_maxCUHeight,            numElements * sizeof(*m_height));
+        memset(m_qp               , qp,                       numElements * sizeof(*m_qp));
+        memset(m_bMergeFlags      , false,                    numElements * sizeof(*m_bMergeFlags));
+        memset(m_mergeIndex       , 0,                        numElements * sizeof(*m_mergeIndex));
+        memset(m_lumaIntraDir     , DC_IDX,                   numElements * sizeof(*m_lumaIntraDir));
+        memset(m_chromaIntraDir   , 0,                        numElements * sizeof(*m_chromaIntraDir));
+        memset(m_interDir         , 0,                        numElements * sizeof(*m_interDir));
+        memset(m_cbf[0]           , 0,                        numElements * sizeof(*m_cbf[0]));
+        memset(m_cbf[1]           , 0,                        numElements * sizeof(*m_cbf[1]));
+        memset(m_cbf[2]           , 0,                        numElements * sizeof(*m_cbf[2]));
+        memset(m_iPCMFlags        , false,                    numElements * sizeof(*m_iPCMFlags));
     }
 
     uint32_t y_tmp = g_maxCUWidth * g_maxCUHeight;
     uint32_t c_tmp = (g_maxCUWidth >> m_hChromaShift) * (g_maxCUHeight >> m_vChromaShift);
-    if (0 >= partStartIdx)
     {
         m_cuMvField[0].clearMvField();
         m_cuMvField[1].clearMvField();
-        memset(m_trCoeffY, 0, sizeof(TCoeff) * y_tmp);
-        memset(m_iPCMSampleY, 0, sizeof(Pel) * y_tmp);
-
-        memset(m_trCoeffCb, 0, sizeof(TCoeff) * c_tmp);
-        memset(m_trCoeffCr, 0, sizeof(TCoeff) * c_tmp);
-        memset(m_iPCMSampleCb, 0, sizeof(Pel) * c_tmp);
-        memset(m_iPCMSampleCr, 0, sizeof(Pel) * c_tmp);
+
+        // TODO: can be remove, but I haven't data to verify it, remove later
+        if (getSlice()->getSPS()->getUsePCM())
+        {
+            memset(m_iPCMSampleY, 0, sizeof(Pel) * y_tmp);
+            memset(m_iPCMSampleCb, 0, sizeof(Pel) * c_tmp);
+            memset(m_iPCMSampleCr, 0, sizeof(Pel) * c_tmp);
+        }
     }
 
     // Setting neighbor CU
@@ -360,8 +348,6 @@ void TComDataCU::initEstData(uint32_t de
     {
         m_mvpIdx[0][i] = -1;
         m_mvpIdx[1][i] = -1;
-        m_mvpNum[0][i] = -1;
-        m_mvpNum[1][i] = -1;
         m_depth[i] = depth;
         m_width[i] = width;
         m_height[i] = height;
@@ -448,8 +434,6 @@ void TComDataCU::initSubCU(TComDataCU* c
         m_cuTransquantBypass[i] = false;
         m_mvpIdx[0][i] = -1;
         m_mvpIdx[1][i] = -1;
-        m_mvpNum[0][i] = -1;
-        m_mvpNum[1][i] = -1;
     }
 
     m_cuMvField[0].clearMvField();
@@ -545,8 +529,6 @@ void TComDataCU::copyPartFrom(TComDataCU
 
     memcpy(m_mvpIdx[0] + offset, cu->getMVPIdx(REF_PIC_LIST_0), iSizeInUchar);
     memcpy(m_mvpIdx[1] + offset, cu->getMVPIdx(REF_PIC_LIST_1), iSizeInUchar);
-    memcpy(m_mvpNum[0] + offset, cu->getMVPNum(REF_PIC_LIST_0), iSizeInUchar);
-    memcpy(m_mvpNum[1] + offset, cu->getMVPNum(REF_PIC_LIST_1), iSizeInUchar);
 
     memcpy(m_iPCMFlags + offset, cu->getIPCMFlag(), iSizeInBool);
 
@@ -616,8 +598,6 @@ void TComDataCU::copyToPic(UChar uhDepth
 
     memcpy(rpcCU->getMVPIdx(REF_PIC_LIST_0) + m_absIdxInLCU, m_mvpIdx[0], iSizeInUchar);
     memcpy(rpcCU->getMVPIdx(REF_PIC_LIST_1) + m_absIdxInLCU, m_mvpIdx[1], iSizeInUchar);
-    memcpy(rpcCU->getMVPNum(REF_PIC_LIST_0) + m_absIdxInLCU, m_mvpNum[0], iSizeInUchar);
-    memcpy(rpcCU->getMVPNum(REF_PIC_LIST_1) + m_absIdxInLCU, m_mvpNum[1], iSizeInUchar);
 
     m_cuMvField[0].copyTo(rpcCU->getCUMvField(REF_PIC_LIST_0), m_absIdxInLCU);
     m_cuMvField[1].copyTo(rpcCU->getCUMvField(REF_PIC_LIST_1), m_absIdxInLCU);
@@ -706,8 +686,6 @@ void TComDataCU::copyToPic(UChar depth, 
 
     memcpy(cu->getMVPIdx(REF_PIC_LIST_0) + partOffset, m_mvpIdx[0], sizeInUchar);
     memcpy(cu->getMVPIdx(REF_PIC_LIST_1) + partOffset, m_mvpIdx[1], sizeInUchar);
-    memcpy(cu->getMVPNum(REF_PIC_LIST_0) + partOffset, m_mvpNum[0], sizeInUchar);
-    memcpy(cu->getMVPNum(REF_PIC_LIST_1) + partOffset, m_mvpNum[1], sizeInUchar);
     m_cuMvField[0].copyTo(cu->getCUMvField(REF_PIC_LIST_0), m_absIdxInLCU, uiPartStart, qNumPart);
     m_cuMvField[1].copyTo(cu->getCUMvField(REF_PIC_LIST_1), m_absIdxInLCU, uiPartStart, qNumPart);
 
@@ -1560,11 +1538,6 @@ void TComDataCU::setMVPIdxSubParts(int m
     setSubPart<char>(mvpIdx, m_mvpIdx[picList], absPartIdx, depth, partIdx);
 }
 
-void TComDataCU::setMVPNumSubParts(int mvpNum, int picList, uint32_t absPartIdx, uint32_t partIdx, uint32_t depth)
-{
-    setSubPart<char>(mvpNum, m_mvpNum[picList], absPartIdx, depth, partIdx);
-}
-
 void TComDataCU::setTrIdxSubParts(uint32_t trIdx, uint32_t absPartIdx, uint32_t depth)
 {
     uint32_t curPartNum = m_pic->getNumPartInCU() >> (depth << 1);
diff -r 8e0fa5fcbf15 -r 37b4ca796088 source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.h	Mon Jan 13 16:05:56 2014 -0600
+++ b/source/Lib/TLibCommon/TComDataCU.h	Wed Jan 15 17:51:11 2014 +0800
@@ -150,7 +150,6 @@ private:
     UChar*        m_chromaIntraDir;   ///< array of intra directions (chroma)
     UChar*        m_interDir;         ///< array of inter directions
     char*         m_mvpIdx[2];        ///< array of motion vector predictor candidates
-    char*         m_mvpNum[2];        ///< array of number of possible motion vectors predictors
     bool*         m_iPCMFlags;        ///< array of intra_pcm flags
 
     // -------------------------------------------------------------------------------------------------------------------
@@ -390,12 +389,7 @@ public:
 
     char*         getMVPIdx(int picList)                       { return m_mvpIdx[picList]; }
 
-    int           getMVPNum(int picList, uint32_t idx)             { return m_mvpNum[picList][idx]; }
-
-    char*         getMVPNum(int picList)                       { return m_mvpNum[picList]; }
-
     void          setMVPIdxSubParts(int mvpIdx, int picList, uint32_t absPartIdx, uint32_t partIdx, uint32_t depth);
-    void          setMVPNumSubParts(int iMVPNum, int picList, uint32_t absPartIdx, uint32_t partIdx, uint32_t depth);
 
     void          clipMv(MV& outMV);
 
diff -r 8e0fa5fcbf15 -r 37b4ca796088 source/Lib/TLibCommon/TComPrediction.cpp
--- a/source/Lib/TLibCommon/TComPrediction.cpp	Mon Jan 13 16:05:56 2014 -0600
+++ b/source/Lib/TLibCommon/TComPrediction.cpp	Wed Jan 15 17:51:11 2014 +0800
@@ -617,7 +617,6 @@ void TComPrediction::getMvPredAMVP(TComD
         mvPred = pcAMVPInfo->m_mvCand[0];
 
         cu->setMVPIdxSubParts(0, list, partAddr, partIdx, cu->getDepth(partAddr));
-        cu->setMVPNumSubParts(pcAMVPInfo->m_num, list, partAddr, partIdx, cu->getDepth(partAddr));
         return;
     }
 
diff -r 8e0fa5fcbf15 -r 37b4ca796088 source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp	Mon Jan 13 16:05:56 2014 -0600
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp	Wed Jan 15 17:51:11 2014 +0800
@@ -2508,7 +2508,6 @@ void TEncSearch::predInterSearch(TComDat
 
     int mvpIdxBi[2][33];
     int mvpIdx[2][33];
-    int mvpNum[2][33];
     AMVPInfo amvpInfo[2][33];
 
     uint32_t mbBits[3] = { 1, 1, 0 };
@@ -2574,7 +2573,6 @@ void TEncSearch::predInterSearch(TComDat
                     }
                     xEstimateMvPredAMVP(cu, partIdx, list, idx, mvPred[list][idx], &biPDistTemp);
                     mvpIdx[list][idx] = cu->getMVPIdx(list, partAddr);
-                    mvpNum[list][idx] = cu->getMVPNum(list, partAddr);
 
                     bitsTemp += m_mvpIdxCost[mvpIdx[list][idx]][AMVP_MAX_NUM_CANDS];
                     int merange = m_adaptiveRange[list][idx];
@@ -2694,9 +2692,7 @@ void TEncSearch::predInterSearch(TComDat
         cu->getCUMvField(REF_PIC_LIST_1)->setAllMvd(mvzero, partSize, partAddr, 0, partIdx);
 
         cu->setMVPIdxSubParts(-1, REF_PIC_LIST_0, partAddr, partIdx, cu->getDepth(partAddr));
-        cu->setMVPNumSubParts(-1, REF_PIC_LIST_0, partAddr, partIdx, cu->getDepth(partAddr));
         cu->setMVPIdxSubParts(-1, REF_PIC_LIST_1, partAddr, partIdx, cu->getDepth(partAddr));
-        cu->setMVPNumSubParts(-1, REF_PIC_LIST_1, partAddr, partIdx, cu->getDepth(partAddr));
 
         uint32_t mebits = 0;
         // Set Motion Field_
@@ -2728,9 +2724,7 @@ void TEncSearch::predInterSearch(TComDat
                 cu->setInterDirSubParts(3, partAddr, partIdx, cu->getDepth(0));
 
                 cu->setMVPIdxSubParts(mvpIdxBi[0][refIdxBidir[0]], REF_PIC_LIST_0, partAddr, partIdx, cu->getDepth(partAddr));
-                cu->setMVPNumSubParts(mvpNum[0][refIdxBidir[0]], REF_PIC_LIST_0, partAddr, partIdx, cu->getDepth(partAddr));
                 cu->setMVPIdxSubParts(mvpIdxBi[1][refIdxBidir[1]], REF_PIC_LIST_1, partAddr, partIdx, cu->getDepth(partAddr));
-                cu->setMVPNumSubParts(mvpNum[1][refIdxBidir[1]], REF_PIC_LIST_1, partAddr, partIdx, cu->getDepth(partAddr));
 
                 mebits = bits[2];
             }
@@ -2746,7 +2740,6 @@ void TEncSearch::predInterSearch(TComDat
                 cu->setInterDirSubParts(1, partAddr, partIdx, cu->getDepth(0));
 
                 cu->setMVPIdxSubParts(mvpIdx[0][refIdx[0]], REF_PIC_LIST_0, partAddr, partIdx, cu->getDepth(partAddr));
-                cu->setMVPNumSubParts(mvpNum[0][refIdx[0]], REF_PIC_LIST_0, partAddr, partIdx, cu->getDepth(partAddr));
 
                 mebits = bits[0];
             }
@@ -2762,7 +2755,6 @@ void TEncSearch::predInterSearch(TComDat
                 cu->setInterDirSubParts(2, partAddr, partIdx, cu->getDepth(0));
 
                 cu->setMVPIdxSubParts(mvpIdx[1][refIdx[1]], REF_PIC_LIST_1, partAddr, partIdx, cu->getDepth(partAddr));
-                cu->setMVPNumSubParts(mvpNum[1][refIdx[1]], REF_PIC_LIST_1, partAddr, partIdx, cu->getDepth(partAddr));
 
                 mebits = bits[1];
             }
@@ -2811,9 +2803,7 @@ void TEncSearch::predInterSearch(TComDat
                 cu->getCUMvField(REF_PIC_LIST_1)->setAllMvd(mvzero, partSize, partAddr, 0, partIdx);
 
                 cu->setMVPIdxSubParts(-1, REF_PIC_LIST_0, partAddr, partIdx, cu->getDepth(partAddr));
-                cu->setMVPNumSubParts(-1, REF_PIC_LIST_0, partAddr, partIdx, cu->getDepth(partAddr));
                 cu->setMVPIdxSubParts(-1, REF_PIC_LIST_1, partAddr, partIdx, cu->getDepth(partAddr));
-                cu->setMVPNumSubParts(-1, REF_PIC_LIST_1, partAddr, partIdx, cu->getDepth(partAddr));
                 totalmebits += mrgBits;
             }
             else
@@ -2863,7 +2853,6 @@ void TEncSearch::xEstimateMvPredAMVP(TCo
         mvPred = bestMv;
 
         cu->setMVPIdxSubParts(bestIdx, list, partAddr, partIdx, cu->getDepth(partAddr));
-        cu->setMVPNumSubParts(amvpInfo->m_num, list, partAddr, partIdx, cu->getDepth(partAddr));
 
         if (cu->getSlice()->getMvdL1ZeroFlag() && list == REF_PIC_LIST_1)
         {
@@ -2892,7 +2881,6 @@ void TEncSearch::xEstimateMvPredAMVP(TCo
     // Setting Best MVP
     mvPred = bestMv;
     cu->setMVPIdxSubParts(bestIdx, list, partAddr, partIdx, cu->getDepth(partAddr));
-    cu->setMVPNumSubParts(amvpInfo->m_num, list, partAddr, partIdx, cu->getDepth(partAddr));
 }
 
 uint32_t TEncSearch::xGetMvpIdxBits(int idx, int num)
diff -r 8e0fa5fcbf15 -r 37b4ca796088 source/common/CMakeLists.txt


More information about the x265-commits mailing list