[x265-commits] [x265] weightp: fix hash mismatch when --ref > 3

Kavitha Sampath kavitha at multicorewareinc.com
Wed Jan 22 19:36:18 CET 2014


details:   http://hg.videolan.org/x265/rev/d56dd4d8e08b
branches:  stable
changeset: 5860:d56dd4d8e08b
user:      Kavitha Sampath <kavitha at multicorewareinc.com>
date:      Wed Jan 22 10:05:43 2014 +0530
description:
weightp: fix hash mismatch when --ref > 3
Subject: [x265] WeightPrediction: Do not use lowres MV/MVcost for invalid MVs/MVcosts

details:   http://hg.videolan.org/x265/rev/9497c55d7be2
branches:  stable
changeset: 5861:9497c55d7be2
user:      Kavitha Sampath <kavitha at multicorewareinc.com>
date:      Wed Jan 22 14:33:03 2014 +0530
description:
WeightPrediction: Do not use lowres MV/MVcost for invalid MVs/MVcosts
Subject: [x265] Merge from stable

details:   http://hg.videolan.org/x265/rev/d8a1e3bebdf8
branches:  
changeset: 5862:d8a1e3bebdf8
user:      Deepthi Nandakumar <deepthi at multicorewareinc.com>
date:      Wed Jan 22 17:53:04 2014 +0530
description:
Merge from stable
Subject: [x265] asm : Hook up chroma_vsp with the encoder.

details:   http://hg.videolan.org/x265/rev/d2bfe01c0f29
branches:  
changeset: 5863:d2bfe01c0f29
user:      Nabajit Deka
date:      Wed Jan 22 19:04:24 2014 +0530
description:
asm : Hook up chroma_vsp with the encoder.
Subject: [x265] vec: drop unused vectorized chroma_vsp primitive, ipfilter-sse41.cpp

details:   http://hg.videolan.org/x265/rev/29c1940c8acb
branches:  
changeset: 5864:29c1940c8acb
user:      Steve Borho <steve at borho.org>
date:      Wed Jan 22 12:35:33 2014 -0600
description:
vec: drop unused vectorized chroma_vsp primitive, ipfilter-sse41.cpp

diffstat:

 source/CMakeLists.txt                    |    4 +-
 source/Lib/TLibCommon/TComDataCU.cpp     |   89 +---
 source/Lib/TLibCommon/TComDataCU.h       |    6 -
 source/Lib/TLibCommon/TComPic.h          |    5 +-
 source/Lib/TLibCommon/TComPrediction.cpp |   13 +-
 source/Lib/TLibCommon/TComTrQuant.h      |    2 +-
 source/Lib/TLibCommon/TComYuv.cpp        |   49 +--
 source/Lib/TLibEncoder/TEncSbac.cpp      |   12 +-
 source/Lib/TLibEncoder/TEncSearch.cpp    |   12 -
 source/common/CMakeLists.txt             |    4 +-
 source/common/common.cpp                 |   35 +-
 source/common/common.h                   |    1 -
 source/common/ipfilter.cpp               |    1 -
 source/common/pixel.cpp                  |   23 +
 source/common/primitives.h               |    6 +-
 source/common/vec/ipfilter-sse41.cpp     |  257 ----------------
 source/common/vec/vec-primitives.cpp     |    3 -
 source/common/x86/asm-primitives.cpp     |   22 +-
 source/common/x86/intrapred.h            |   57 +++-
 source/common/x86/intrapred8.asm         |  486 +++++++++++++++++++++++++++++++
 source/common/x86/ipfilter8.asm          |   94 ++++-
 source/encoder/compress.cpp              |    4 -
 source/encoder/dpb.cpp                   |    4 +-
 source/encoder/encoder.cpp               |  106 ++++-
 source/encoder/encoder.h                 |    7 +-
 source/encoder/frameencoder.cpp          |   19 +-
 source/encoder/frameencoder.h            |    1 +
 source/encoder/slicetype.cpp             |  393 ++++++++++--------------
 source/encoder/slicetype.h               |    3 +-
 source/encoder/weightPrediction.cpp      |   42 +-
 source/test/ipfilterharness.cpp          |   17 -
 source/test/pixelharness.cpp             |   54 +++
 source/test/pixelharness.h               |    1 +
 source/x265.cpp                          |    7 +-
 source/x265.h                            |    7 +-
 35 files changed, 1061 insertions(+), 785 deletions(-)

diffs (truncated from 2803 to 300 lines):

diff -r 3cf5a75a8002 -r 29c1940c8acb source/CMakeLists.txt
--- a/source/CMakeLists.txt	Tue Jan 21 12:58:25 2014 -0600
+++ b/source/CMakeLists.txt	Wed Jan 22 12:35:33 2014 -0600
@@ -13,7 +13,7 @@ include(CheckFunctionExists)
 include(CheckCXXCompilerFlag)
 
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 4)
+set(X265_BUILD 5)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
                "${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
@@ -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 3cf5a75a8002 -r 29c1940c8acb source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp	Tue Jan 21 12:58:25 2014 -0600
+++ b/source/Lib/TLibCommon/TComDataCU.cpp	Wed Jan 22 12:35:33 2014 -0600
@@ -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 3cf5a75a8002 -r 29c1940c8acb source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.h	Tue Jan 21 12:58:25 2014 -0600
+++ b/source/Lib/TLibCommon/TComDataCU.h	Wed Jan 22 12:35:33 2014 -0600
@@ -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 3cf5a75a8002 -r 29c1940c8acb source/Lib/TLibCommon/TComPic.h
--- a/source/Lib/TLibCommon/TComPic.h	Tue Jan 21 12:58:25 2014 -0600
+++ b/source/Lib/TLibCommon/TComPic.h	Wed Jan 22 12:35:33 2014 -0600
@@ -81,8 +81,11 @@ public:
     volatile uint32_t     m_countRefEncoders;   // count of FrameEncoder threads monitoring m_reconRowCount
     Event                 m_reconRowWait;       // event triggered m_countRefEncoders times each time a recon row is completed
     void*                 m_userData;           // user provided pointer passed in with this picture
+    
     int64_t               m_pts;                // user provided presentation time stamp
-
+    int64_t               m_reorderedPts;
+    int64_t               m_dts;
+    
     Lowres                m_lowres;
 
     TComPic*              m_next;
diff -r 3cf5a75a8002 -r 29c1940c8acb source/Lib/TLibCommon/TComPrediction.cpp
--- a/source/Lib/TLibCommon/TComPrediction.cpp	Tue Jan 21 12:58:25 2014 -0600
+++ b/source/Lib/TLibCommon/TComPrediction.cpp	Wed Jan 22 12:35:33 2014 -0600
@@ -522,19 +522,15 @@ void TComPrediction::xPredInterChromaBlk
     }
     else
     {
-        int hShift = CHROMA_H_SHIFT(csp);
-        int vShift = CHROMA_V_SHIFT(csp);
-        uint32_t cxWidth = width >> hShift;
-        uint32_t cxHeight = height >> vShift;
-        int extStride = cxWidth;
+        int extStride = width >> 1;
         int filterSize = NTAPS_CHROMA;
         int halfFilterSize = (filterSize >> 1);
 
-        primitives.chroma[csp].filter_hps[partEnum](refCb, refStride, m_immedVals, extStride,  xFrac, 1);
-        primitives.chroma_vsp(m_immedVals + (halfFilterSize - 1) * extStride, extStride, dstCb, dstStride, cxWidth, cxHeight, yFrac);
+        primitives.chroma[csp].filter_hps[partEnum](refCb, refStride, m_immedVals, extStride, xFrac, 1);
+        primitives.chroma[csp].filter_vsp[partEnum](m_immedVals + (halfFilterSize - 1) * extStride, extStride, dstCb, dstStride, yFrac);
 
         primitives.chroma[csp].filter_hps[partEnum](refCr, refStride, m_immedVals, extStride, xFrac, 1);
-        primitives.chroma_vsp(m_immedVals + (halfFilterSize - 1) * extStride, extStride, dstCr, dstStride, cxWidth, cxHeight, yFrac);
+        primitives.chroma[csp].filter_vsp[partEnum](m_immedVals + (halfFilterSize - 1) * extStride, extStride, dstCr, dstStride, yFrac);
     }
 }
 
@@ -617,7 +613,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 3cf5a75a8002 -r 29c1940c8acb source/Lib/TLibCommon/TComTrQuant.h
--- a/source/Lib/TLibCommon/TComTrQuant.h	Tue Jan 21 12:58:25 2014 -0600
+++ b/source/Lib/TLibCommon/TComTrQuant.h	Wed Jan 22 12:35:33 2014 -0600
@@ -68,7 +68,7 @@ typedef struct
     int greaterOneBits[NUM_ONE_FLAG_CTX][2];
     int levelAbsBits[NUM_ABS_FLAG_CTX][2];
 
-    int blockCbpBits[3 * NUM_QT_CBF_CTX][2];
+    int blockCbpBits[2 * NUM_QT_CBF_CTX][2];
     int blockRootCbpBits[4][2];
 } estBitsSbacStruct;
 
diff -r 3cf5a75a8002 -r 29c1940c8acb source/Lib/TLibCommon/TComYuv.cpp
--- a/source/Lib/TLibCommon/TComYuv.cpp	Tue Jan 21 12:58:25 2014 -0600
+++ b/source/Lib/TLibCommon/TComYuv.cpp	Wed Jan 22 12:35:33 2014 -0600
@@ -572,9 +572,7 @@ void TComYuv::addAvg(TComYuv* srcYuv0, T
 
 void TComYuv::addAvg(TShortYUV* srcYuv0, TShortYUV* srcYuv1, uint32_t partUnitIdx, uint32_t width, uint32_t height, bool bLuma, bool bChroma)
 {
-    int x, y;
     uint32_t src0Stride, src1Stride, dststride;
-    int shiftNum, offset;
 
     int16_t* srcY0 = srcYuv0->getLumaAddr(partUnitIdx);
     int16_t* srcU0 = srcYuv0->getCbAddr(partUnitIdx);
@@ -588,61 +586,24 @@ void TComYuv::addAvg(TShortYUV* srcYuv0,
     Pel* dstU = getCbAddr(partUnitIdx);
     Pel* dstV = getCrAddr(partUnitIdx);
 
+    int part = partitionFromSizes(width, height);
+
     if (bLuma)
     {


More information about the x265-commits mailing list