[x265-commits] [x265] cmake: prevent extra errors when system has no C++ compiler

Steve Borho steve at borho.org
Tue Feb 11 06:32:07 CET 2014


details:   http://hg.videolan.org/x265/rev/6b3defda16c1
branches:  
changeset: 6066:6b3defda16c1
user:      Steve Borho <steve at borho.org>
date:      Mon Feb 10 18:49:04 2014 -0600
description:
cmake: prevent extra errors when system has no C++ compiler
Subject: [x265] help: move --cutree just after aq options

details:   http://hg.videolan.org/x265/rev/75f724dd6d4c
branches:  
changeset: 6067:75f724dd6d4c
user:      Steve Borho <steve at borho.org>
date:      Mon Feb 10 19:24:08 2014 -0600
description:
help: move --cutree just after aq options
Subject: [x265] help: --cutree is a boolean flag

details:   http://hg.videolan.org/x265/rev/d002f45eee16
branches:  
changeset: 6068:d002f45eee16
user:      Steve Borho <steve at borho.org>
date:      Mon Feb 10 19:27:33 2014 -0600
description:
help: --cutree is a boolean flag
Subject: [x265] TComPicYuv: replace xExtendPicCompBorder with an optimized function

details:   http://hg.videolan.org/x265/rev/47592ed6aa2c
branches:  
changeset: 6069:47592ed6aa2c
user:      Steve Borho <steve at borho.org>
date:      Mon Feb 10 12:45:19 2014 -0600
description:
TComPicYuv: replace xExtendPicCompBorder with an optimized function

We've had a primitive for the side borders for some time, it just wasn't hooked
up.  This function never should have been a method of that class.
Subject: [x265] lowres: nits

details:   http://hg.videolan.org/x265/rev/96d16486e317
branches:  
changeset: 6070:96d16486e317
user:      Steve Borho <steve at borho.org>
date:      Mon Feb 10 12:45:36 2014 -0600
description:
lowres: nits
Subject: [x265] pic: mask impossible input bits

details:   http://hg.videolan.org/x265/rev/8538c3383ade
branches:  
changeset: 6071:8538c3383ade
user:      Steve Borho <steve at borho.org>
date:      Mon Feb 10 17:08:25 2014 -0600
description:
pic: mask impossible input bits
Subject: [x265] pic: use C style comments

details:   http://hg.videolan.org/x265/rev/01d0f7758171
branches:  
changeset: 6072:01d0f7758171
user:      Steve Borho <steve at borho.org>
date:      Mon Feb 10 17:08:41 2014 -0600
description:
pic: use C style comments
Subject: [x265] cleanup unused

details:   http://hg.videolan.org/x265/rev/b449d4d4f02d
branches:  
changeset: 6073:b449d4d4f02d
user:      Satoshi Nakagawa <nakagawa424 at oki.com>
date:      Mon Feb 10 18:04:10 2014 +0900
description:
cleanup unused
Subject: [x265] cleanup AMVP related

details:   http://hg.videolan.org/x265/rev/2316e8e33512
branches:  
changeset: 6074:2316e8e33512
user:      Satoshi Nakagawa <nakagawa424 at oki.com>
date:      Tue Feb 11 13:03:34 2014 +0900
description:
cleanup AMVP related

diffstat:

 source/CMakeLists.txt                 |   6 +-
 source/Lib/TLibCommon/TComDataCU.cpp  |  23 ++++--------
 source/Lib/TLibCommon/TComPattern.cpp |  63 -----------------------------------
 source/Lib/TLibCommon/TComPattern.h   |  10 +-----
 source/Lib/TLibCommon/TComPicYuv.cpp  |  54 +++++++----------------------
 source/Lib/TLibCommon/TComPicYuv.h    |   2 -
 source/Lib/TLibEncoder/TEncCu.cpp     |   3 -
 source/Lib/TLibEncoder/TEncSearch.cpp |  61 ++++++++++-----------------------
 source/Lib/TLibEncoder/TEncSearch.h   |   9 ++--
 source/common/lowres.cpp              |  12 +++---
 source/common/pixel.cpp               |  25 +++++++++++++-
 source/common/primitives.h            |   2 +
 source/encoder/weightPrediction.cpp   |   4 +-
 source/x265.cpp                       |   2 +-
 14 files changed, 83 insertions(+), 193 deletions(-)

diffs (truncated from 637 to 300 lines):

diff -r ce7191f49948 -r 2316e8e33512 source/CMakeLists.txt
--- a/source/CMakeLists.txt	Mon Feb 10 11:07:53 2014 -0600
+++ b/source/CMakeLists.txt	Tue Feb 11 13:03:34 2014 +0900
@@ -61,13 +61,13 @@ if (APPLE)
   add_definitions(-DMACOS)
 endif()
 
-if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
     set(CLANG 1)
 endif()
-if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
     set(INTEL_CXX 1)
 endif()
-if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
     set(GCC 1)
 endif()
 
diff -r ce7191f49948 -r 2316e8e33512 source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp	Mon Feb 10 11:07:53 2014 -0600
+++ b/source/Lib/TLibCommon/TComDataCU.cpp	Tue Feb 11 13:03:34 2014 +0900
@@ -2309,7 +2309,6 @@ void TComDataCU::getPartPosition(uint32_
  */
 void TComDataCU::fillMvpCand(uint32_t partIdx, uint32_t partAddr, int picList, int refIdx, AMVPInfo* info)
 {
-    MV mvp;
     bool bAddedSmvp = false;
 
     info->m_num = 0;
@@ -2320,7 +2319,6 @@ void TComDataCU::fillMvpCand(uint32_t pa
 
     //-- Get Spatial MV
     uint32_t partIdxLT, partIdxRT, partIdxLB;
-    uint32_t numPartInCUWidth = m_pic->getNumPartInWidth();
     bool bAdded = false;
 
     deriveLeftRightTopIdx(partIdx, partIdxLT, partIdxRT);
@@ -2364,10 +2362,8 @@ void TComDataCU::fillMvpCand(uint32_t pa
     {
         xAddMVPCand(info, picList, refIdx, partIdxLT, MD_ABOVE_LEFT);
     }
-    bAdded = bAddedSmvp;
-    if (info->m_num == 2) bAdded = true;
-
-    if (!bAdded)
+
+    if (!bAddedSmvp)
     {
         bAdded = xAddMVPCandOrder(info, picList, refIdx, partIdxRT, MD_ABOVE_RIGHT);
         if (!bAdded)
@@ -2387,6 +2383,10 @@ void TComDataCU::fillMvpCand(uint32_t pa
         {
             info->m_num = 1;
         }
+        else
+        {
+            return;
+        }
     }
 
     if (getSlice()->getEnableTMVPFlag())
@@ -2397,23 +2397,22 @@ void TComDataCU::fillMvpCand(uint32_t pa
         uint32_t partIdxRB;
         uint32_t absPartIdx;
         uint32_t absPartAddr;
-        int lcuIdx;
 
         deriveRightBottomIdx(partIdx, partIdxRB);
         absPartAddr = m_absIdxInLCU + partAddr;
 
         //----  co-located RightBottom Temporal Predictor (H) ---//
         absPartIdx = g_zscanToRaster[partIdxRB];
+        int lcuIdx = -1;
         if ((m_pic->getCU(m_cuAddr)->getCUPelX() + g_rasterToPelX[absPartIdx] + m_pic->getMinCUWidth()) >= m_slice->getSPS()->getPicWidthInLumaSamples())  // image boundary check
         {
-            lcuIdx = -1;
         }
         else if ((m_pic->getCU(m_cuAddr)->getCUPelY() + g_rasterToPelY[absPartIdx] + m_pic->getMinCUHeight()) >= m_slice->getSPS()->getPicHeightInLumaSamples())
         {
-            lcuIdx = -1;
         }
         else
         {
+            uint32_t numPartInCUWidth = m_pic->getNumPartInWidth();
             if ((absPartIdx % numPartInCUWidth < numPartInCUWidth - 1) &&        // is not at the last column of LCU
                 (absPartIdx / numPartInCUWidth < m_pic->getNumPartInHeight() - 1)) // is not at the last row    of LCU
             {
@@ -2423,7 +2422,6 @@ void TComDataCU::fillMvpCand(uint32_t pa
             else if (absPartIdx % numPartInCUWidth < numPartInCUWidth - 1)       // is not at the last column of LCU But is last row of LCU
             {
                 absPartAddr = g_rasterToZscan[(absPartIdx + numPartInCUWidth + 1) % m_pic->getNumPartInCU()];
-                lcuIdx      = -1;
             }
             else if (absPartIdx / numPartInCUWidth < m_pic->getNumPartInHeight() - 1) // is not at the last row of LCU But is last column of LCU
             {
@@ -2433,7 +2431,6 @@ void TComDataCU::fillMvpCand(uint32_t pa
             else //is the right bottom corner of LCU
             {
                 absPartAddr = 0;
-                lcuIdx      = -1;
             }
         }
         if (lcuIdx >= 0 && xGetColMVP(picList, lcuIdx, absPartAddr, colmv, refIdxCol))
@@ -2453,10 +2450,6 @@ void TComDataCU::fillMvpCand(uint32_t pa
         //----  co-located RightBottom Temporal Predictor  ---//
     }
 
-    if (info->m_num > AMVP_MAX_NUM_CANDS)
-    {
-        info->m_num = AMVP_MAX_NUM_CANDS;
-    }
     while (info->m_num < AMVP_MAX_NUM_CANDS)
     {
         info->m_mvCand[info->m_num] = 0;
diff -r ce7191f49948 -r 2316e8e33512 source/Lib/TLibCommon/TComPattern.cpp
--- a/source/Lib/TLibCommon/TComPattern.cpp	Mon Feb 10 11:07:53 2014 -0600
+++ b/source/Lib/TLibCommon/TComPattern.cpp	Tue Feb 11 13:03:34 2014 +0900
@@ -45,19 +45,6 @@ using namespace x265;
 //! \{
 
 // ====================================================================================================================
-// Tables
-// ====================================================================================================================
-
-const UChar TComPattern::m_intraFilter[5] =
-{
-    10, //4x4
-    7, //8x8
-    1, //16x16
-    0, //32x32
-    10, //64x64
-};
-
-// ====================================================================================================================
 // Public member functions (TComPattern)
 // ====================================================================================================================
 
@@ -436,56 +423,6 @@ void TComPattern::fillReferenceSamples(P
     }
 }
 
-Pel* TComPattern::getAdiOrgBuf(int /*cuWidth*/, int /*cuHeight*/, Pel* adiBuf)
-{
-    return adiBuf;
-}
-
-Pel* TComPattern::getAdiCbBuf(int /*cuWidth*/, int /*cuHeight*/, Pel* adiBuf)
-{
-    return adiBuf;
-}
-
-Pel* TComPattern::getAdiCrBuf(int /*cuWidth*/, int cuHeight, Pel* adiBuf)
-{
-    return adiBuf + ADI_BUF_STRIDE * (cuHeight * 2 + 1);
-}
-
-/** Get pointer to reference samples for intra prediction
- * \param dirMode     prediction mode index
- * \param log2BlkSize size of block (2 = 4x4, 3 = 8x8, 4 = 16x16, 5 = 32x32, 6 = 64x64)
- * \param adiBuf    pointer to unfiltered reference samples
- * \return            pointer to (possibly filtered) reference samples
- *
- * The prediction mode index is used to determine whether a smoothed reference sample buffer is returned.
- */
-Pel* TComPattern::getPredictorPtr(uint32_t dirMode, uint32_t log2BlkSize, Pel* adiBuf)
-{
-    Pel* src;
-
-    assert(log2BlkSize >= 2 && log2BlkSize < 7);
-    int diff = std::min<int>(abs((int)dirMode - HOR_IDX), abs((int)dirMode - VER_IDX));
-    UChar ucFiltIdx = diff > m_intraFilter[log2BlkSize - 2] ? 1 : 0;
-    if (dirMode == DC_IDX)
-    {
-        ucFiltIdx = 0; //no smoothing for DC or LM chroma
-    }
-
-    assert(ucFiltIdx <= 1);
-
-    int width  = 1 << log2BlkSize;
-    int height = 1 << log2BlkSize;
-
-    src = getAdiOrgBuf(width, height, adiBuf);
-
-    if (ucFiltIdx)
-    {
-        src += ADI_BUF_STRIDE * (2 * height + 1);
-    }
-
-    return src;
-}
-
 bool TComPattern::isAboveLeftAvailable(TComDataCU* cu, uint32_t partIdxLT)
 {
     bool bAboveLeftFlag;
diff -r ce7191f49948 -r 2316e8e33512 source/Lib/TLibCommon/TComPattern.h
--- a/source/Lib/TLibCommon/TComPattern.h	Mon Feb 10 11:07:53 2014 -0600
+++ b/source/Lib/TLibCommon/TComPattern.h	Tue Feb 11 13:03:34 2014 +0900
@@ -56,18 +56,10 @@ class TComDataCU;
 /// neighboring pixel access class for all components
 class TComPattern
 {
-private:
-
-    static const UChar m_intraFilter[5];
-
 public:
 
     // access functions of ADI buffers
-    Pel*  getAdiOrgBuf(int cuWidth, int cuHeight, Pel* adiBuf);
-    Pel*  getAdiCbBuf(int cuWidth, int cuHeight, Pel* adiBuf);
-    Pel*  getAdiCrBuf(int cuWidth, int cuHeight, Pel* adiBuf);
-
-    Pel*  getPredictorPtr(uint32_t dirMode, uint32_t uiWidthBits, Pel* adiBuf);
+    static Pel* getAdiChromaBuf(int chromaId, int cuHeight, Pel* adiBuf) { return adiBuf + (chromaId == 0 ? 0 : ADI_BUF_STRIDE * (cuHeight * 2 + 1)); }
 
     // -------------------------------------------------------------------------------------------------------------------
     // initialization functions
diff -r ce7191f49948 -r 2316e8e33512 source/Lib/TLibCommon/TComPicYuv.cpp
--- a/source/Lib/TLibCommon/TComPicYuv.cpp	Mon Feb 10 11:07:53 2014 -0600
+++ b/source/Lib/TLibCommon/TComPicYuv.cpp	Tue Feb 11 13:03:34 2014 +0900
@@ -146,35 +146,6 @@ uint32_t TComPicYuv::getCUHeight(int row
     return height;
 }
 
-void TComPicYuv::xExtendPicCompBorder(Pel* recon, int stride, int width, int height, int marginX, int marginY)
-{
-    int x, y;
-
-    /* TODO: this should become a performance primitive */
-    for (y = 0; y < height; y++)
-    {
-        for (x = 0; x < marginX; x++)
-        {
-            recon[-marginX + x] = recon[0];
-            recon[width + x] = recon[width - 1];
-        }
-
-        recon += stride;
-    }
-
-    recon -= (stride + marginX);
-    for (y = 0; y < marginY; y++)
-    {
-        ::memcpy(recon + (y + 1) * stride, recon, sizeof(Pel) * (width + (marginX << 1)));
-    }
-
-    recon -= ((height - 1) * stride);
-    for (y = 0; y < marginY; y++)
-    {
-        ::memcpy(recon - (y + 1) * stride, recon, sizeof(Pel) * (width + (marginX << 1)));
-    }
-}
-
 /* Copy pixels from an input picture (C structure) into internal TComPicYuv instance
  * Upscale pixels from 8bits to 16 bits when required, but do not modify
  * pixels. */
@@ -184,14 +155,14 @@ void TComPicYuv::copyFromPicture(const x
     Pel *U = getCbAddr();
     Pel *V = getCrAddr();
 
-    // m_picWidth is the width that is being encoded, padx indicates how many
-    // of those pixels are padding to reach multiple of MinCU(4) size.
-    //
-    // Internally, we need to extend rows out to a multiple of 16 for lowres
-    // downscale and other operations. But those padding pixels are never
-    // encoded.
-    //
-    // The same applies to m_picHeight and pady
+    /* m_picWidth is the width that is being encoded, padx indicates how many
+     * of those pixels are padding to reach multiple of MinCU(4) size.
+     *
+     * Internally, we need to extend rows out to a multiple of 16 for lowres
+     * downscale and other operations. But those padding pixels are never
+     * encoded.
+     *
+     * The same applies to m_picHeight and pady */
 
     int padx = pad[0];
     int pady = pad[1];
@@ -218,12 +189,15 @@ void TComPicYuv::copyFromPicture(const x
         uint16_t *u = (uint16_t*)pic.planes[1];
         uint16_t *v = (uint16_t*)pic.planes[2];
 
+        /* defensive programming, mask off bits that are supposed to be zero */
+        uint16_t mask = (1 << X265_DEPTH) - 1;
+
         // Manually copy pixels to up-size them
         for (int r = 0; r < height; r++)
         {
             for (int c = 0; c < width; c++)
             {
-                Y[c] = (Pel)y[c];
+                Y[c] = (pixel)(y[c] & mask);
             }
 
             for (int x = 0; x < padx; x++)
@@ -239,8 +213,8 @@ void TComPicYuv::copyFromPicture(const x
         {


More information about the x265-commits mailing list