[x265-commits] [x265] encoder: correct logging of number of WPP streams

Steve Borho steve at borho.org
Sun Oct 5 18:21:31 CEST 2014


details:   http://hg.videolan.org/x265/rev/b6d49505b179
branches:  
changeset: 8203:b6d49505b179
user:      Steve Borho <steve at borho.org>
date:      Thu Oct 02 16:47:55 2014 -0500
description:
encoder: correct logging of number of WPP streams
Subject: [x265] api: add --pmode to enable parallel mode decision

details:   http://hg.videolan.org/x265/rev/57f93ba0df23
branches:  
changeset: 8204:57f93ba0df23
user:      Steve Borho <steve at borho.org>
date:      Wed Oct 01 13:28:29 2014 -0500
description:
api: add --pmode to enable parallel mode decision
Subject: [x265] analysis: further parallelME progress

details:   http://hg.videolan.org/x265/rev/4cdc0528e0aa
branches:  
changeset: 8205:4cdc0528e0aa
user:      Steve Borho <steve at borho.org>
date:      Thu Oct 02 01:12:12 2014 -0500
description:
analysis: further parallelME progress
Subject: [x265] api: add --pme to enable parallel motion estimation

details:   http://hg.videolan.org/x265/rev/bc99dfbed4b7
branches:  
changeset: 8206:bc99dfbed4b7
user:      Steve Borho <steve at borho.org>
date:      Thu Oct 02 16:39:33 2014 -0500
description:
api: add --pme to enable parallel motion estimation
Subject: [x265] analysis: support --pme for all rd levels

details:   http://hg.videolan.org/x265/rev/dd2acbbd545c
branches:  
changeset: 8207:dd2acbbd545c
user:      Steve Borho <steve at borho.org>
date:      Thu Oct 02 17:25:05 2014 -0500
description:
analysis: support --pme for all rd levels
Subject: [x265] analysis: parallel ME can get partsize and depth from ME CU

details:   http://hg.videolan.org/x265/rev/cf722336b836
branches:  
changeset: 8208:cf722336b836
user:      Steve Borho <steve at borho.org>
date:      Thu Oct 02 17:46:52 2014 -0500
description:
analysis: parallel ME can get partsize and depth from ME CU
Subject: [x265] analysis: prevent race hazard in parallel ME state variables

details:   http://hg.videolan.org/x265/rev/70c5681f56b9
branches:  
changeset: 8209:70c5681f56b9
user:      Steve Borho <steve at borho.org>
date:      Thu Oct 02 17:55:31 2014 -0500
description:
analysis: prevent race hazard in parallel ME state variables

the inserted comment should explain the risk, which manifested in a deadlock
Subject: [x265] analysis: cleanup variable names

details:   http://hg.videolan.org/x265/rev/ec0cb8779f84
branches:  
changeset: 8210:ec0cb8779f84
user:      Steve Borho <steve at borho.org>
date:      Fri Oct 03 00:49:11 2014 -0500
description:
analysis: cleanup variable names
Subject: [x265] analysis: --pme workers do not need m_origYuv in slave instance

details:   http://hg.videolan.org/x265/rev/a6b9e8e235d7
branches:  
changeset: 8211:a6b9e8e235d7
user:      Steve Borho <steve at borho.org>
date:      Fri Oct 03 12:40:33 2014 -0500
description:
analysis: --pme workers do not need m_origYuv in slave instance
Subject: [x265] analysis: replace prepMotionCompensation() calls in parallelInterSearch()

details:   http://hg.videolan.org/x265/rev/71de0b881801
branches:  
changeset: 8212:71de0b881801
user:      Steve Borho <steve at borho.org>
date:      Fri Oct 03 12:45:17 2014 -0500
description:
analysis: replace prepMotionCompensation() calls in parallelInterSearch()
Subject: [x265] analysis: use slave instance for MVP eval for --pme

details:   http://hg.videolan.org/x265/rev/15dff1469408
branches:  
changeset: 8213:15dff1469408
user:      Steve Borho <steve at borho.org>
date:      Fri Oct 03 12:52:23 2014 -0500
description:
analysis: use slave instance for MVP eval for --pme

this avoids a race hazard with Predict::m_immedVals
Subject: [x265] TComDataCU: make most get methods const, remove some trivial access methods

details:   http://hg.videolan.org/x265/rev/2e6163426c95
branches:  
changeset: 8214:2e6163426c95
user:      Steve Borho <steve at borho.org>
date:      Fri Oct 03 14:29:59 2014 -0500
description:
TComDataCU: make most get methods const, remove some trivial access methods
Subject: [x265] analysis: remove default argument for compressInterCU_rd5_6

details:   http://hg.videolan.org/x265/rev/2351a963a676
branches:  
changeset: 8215:2351a963a676
user:      Steve Borho <steve at borho.org>
date:      Fri Oct 03 16:00:34 2014 -0500
description:
analysis: remove default argument for compressInterCU_rd5_6
Subject: [x265] param: show when pmode and pme are enabled

details:   http://hg.videolan.org/x265/rev/5849804cd0c3
branches:  
changeset: 8216:5849804cd0c3
user:      Steve Borho <steve at borho.org>
date:      Fri Oct 03 15:47:24 2014 -0500
description:
param: show when pmode and pme are enabled
Subject: [x265] analysis: do not pass member vars to checkMerge2Nx2N_rd0_4 as pointer references

details:   http://hg.videolan.org/x265/rev/5e4aa3b6d136
branches:  
changeset: 8217:5e4aa3b6d136
user:      Steve Borho <steve at borho.org>
date:      Fri Oct 03 16:02:40 2014 -0500
description:
analysis: do not pass member vars to checkMerge2Nx2N_rd0_4 as pointer references
Subject: [x265] analysis: measure best pmode intra RD cost in worker thread

details:   http://hg.videolan.org/x265/rev/51f689bede6a
branches:  
changeset: 8218:51f689bede6a
user:      Steve Borho <steve at borho.org>
date:      Fri Oct 03 15:56:19 2014 -0500
description:
analysis: measure best pmode intra RD cost in worker thread

it required adding storage for the best intra recon and entropy state
includes prep work for supporting --pmode with --rdlevel > 4
Subject: [x265] analysis: cleanups

details:   http://hg.videolan.org/x265/rev/9872cc99362e
branches:  
changeset: 8219:9872cc99362e
user:      Steve Borho <steve at borho.org>
date:      Fri Oct 03 16:03:12 2014 -0500
description:
analysis: cleanups
Subject: [x265] analysis: add a hack to try and match --pmode with --no-pmode

details:   http://hg.videolan.org/x265/rev/39e5b26733b8
branches:  
changeset: 8220:39e5b26733b8
user:      Steve Borho <steve at borho.org>
date:      Fri Oct 03 17:23:16 2014 -0500
description:
analysis: add a hack to try and match --pmode with --no-pmode
Subject: [x265] analysis: use enums to enumerate prediction buffers

details:   http://hg.videolan.org/x265/rev/c61dca79ea0f
branches:  
changeset: 8221:c61dca79ea0f
user:      Steve Borho <steve at borho.org>
date:      Fri Oct 03 21:39:21 2014 -0500
description:
analysis: use enums to enumerate prediction buffers

value 4 was never used, so this reduces the buffer count by one
Subject: [x265] analysis: encodeIntraInInter() must write directly to given cabac context

details:   http://hg.videolan.org/x265/rev/45ef431c1490
branches:  
changeset: 8222:45ef431c1490
user:      Steve Borho <steve at borho.org>
date:      Sat Oct 04 21:01:56 2014 -0500
description:
analysis: encodeIntraInInter() must write directly to given cabac context

writing to m_rdEntropyCoders[depth][CI_TEMP_BEST] was not thread save since the
slave thread is using the same m_rdEntropyCoders objects as the master thread
Subject: [x265] encoder: prevent broken combinations of options

details:   http://hg.videolan.org/x265/rev/f312deb51d55
branches:  
changeset: 8223:f312deb51d55
user:      Steve Borho <steve at borho.org>
date:      Sat Oct 04 22:08:34 2014 -0500
description:
encoder: prevent broken combinations of options

with --no-wpp; something in the slave state is not being initialized correctly
causing crashes in motion estimation
Subject: [x265] cmake: bump X265_BUILD for new parallelism params

details:   http://hg.videolan.org/x265/rev/3c0b9a637349
branches:  
changeset: 8224:3c0b9a637349
user:      Steve Borho <steve at borho.org>
date:      Sun Oct 05 11:18:08 2014 -0500
description:
cmake: bump X265_BUILD for new parallelism params
Subject: [x265] entropy: make copy methods properly const

details:   http://hg.videolan.org/x265/rev/997b210ab94a
branches:  
changeset: 8225:997b210ab94a
user:      Steve Borho <steve at borho.org>
date:      Sun Oct 05 10:28:25 2014 -0500
description:
entropy: make copy methods properly const

diffstat:

 source/CMakeLists.txt                 |    2 +-
 source/Lib/TLibCommon/TComDataCU.cpp  |  300 ++++++--------
 source/Lib/TLibCommon/TComDataCU.h    |  164 +++----
 source/Lib/TLibCommon/TComPattern.cpp |   38 +-
 source/Lib/TLibCommon/TComYuv.h       |    8 -
 source/common/deblock.cpp             |   64 +-
 source/common/param.cpp               |    4 +
 source/common/quant.cpp               |    7 +-
 source/common/quant.h                 |    2 +-
 source/common/shortyuv.h              |    8 -
 source/encoder/analysis.cpp           |  670 +++++++++++++++++++++++----------
 source/encoder/analysis.h             |   24 +-
 source/encoder/encoder.cpp            |   16 +-
 source/encoder/entropy.cpp            |   26 +-
 source/encoder/entropy.h              |   13 +-
 source/encoder/predict.cpp            |   10 +-
 source/encoder/sao.cpp                |   26 +-
 source/encoder/search.cpp             |   62 +-
 source/x265.cpp                       |    6 +
 source/x265.h                         |    8 +
 20 files changed, 825 insertions(+), 633 deletions(-)

diffs (truncated from 3293 to 300 lines):

diff -r 50490cd35e57 -r 997b210ab94a source/CMakeLists.txt
--- a/source/CMakeLists.txt	Thu Oct 02 01:12:32 2014 -0500
+++ b/source/CMakeLists.txt	Sun Oct 05 10:28:25 2014 -0500
@@ -21,7 +21,7 @@ include(CheckSymbolExists)
 include(CheckCXXCompilerFlag)
 
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 33)
+set(X265_BUILD 34)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
                "${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r 50490cd35e57 -r 997b210ab94a source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp	Thu Oct 02 01:12:32 2014 -0500
+++ b/source/Lib/TLibCommon/TComDataCU.cpp	Sun Oct 05 10:28:25 2014 -0500
@@ -323,8 +323,8 @@ void TComDataCU::initCU(Frame* pic, uint
     m_mvBits           = 0;
     m_coeffBits        = 0;
     m_numPartitions    = NUM_CU_PARTITIONS;
-    char* qp           = pic->getCU(getAddr())->getQP();
-    m_baseQp           = pic->getCU(getAddr())->m_baseQp;
+    char* qp           = pic->getCU(m_cuAddr)->getQP();
+    m_baseQp           = pic->getCU(m_cuAddr)->m_baseQp;
     for (int i = 0; i < 4; i++)
     {
         m_avgCost[i] = 0;
@@ -396,11 +396,11 @@ void TComDataCU::initSubCU(TComDataCU* c
 
     m_pic              = cu->m_pic;
     m_slice            = cu->m_slice;
-    m_cuAddr           = cu->getAddr();
+    m_cuAddr           = cu->m_cuAddr;
     m_absIdxInCTU      = cuData->encodeIdx;
 
-    m_cuPelX           = cu->getCUPelX() + ((partUnitIdx &  1) << log2CUSize);
-    m_cuPelY           = cu->getCUPelY() + ((partUnitIdx >> 1) << log2CUSize);
+    m_cuPelX           = cu->m_cuPelX + ((partUnitIdx &  1) << log2CUSize);
+    m_cuPelY           = cu->m_cuPelY + ((partUnitIdx >> 1) << log2CUSize);
 
     m_psyEnergy        = 0;
     m_totalPsyCost     = MAX_INT64;
@@ -458,11 +458,11 @@ void TComDataCU::copyFromPic(TComDataCU*
 {
     m_pic              = ctu->m_pic;
     m_slice            = ctu->m_slice;
-    m_cuAddr           = ctu->getAddr();
+    m_cuAddr           = ctu->m_cuAddr;
     m_absIdxInCTU      = cuData->encodeIdx;
 
-    m_cuPelX           = ctu->getCUPelX() + g_zscanToPelX[m_absIdxInCTU];
-    m_cuPelY           = ctu->getCUPelY() + g_zscanToPelY[m_absIdxInCTU];
+    m_cuPelX           = ctu->m_cuPelX + g_zscanToPelX[m_absIdxInCTU];
+    m_cuPelY           = ctu->m_cuPelY + g_zscanToPelY[m_absIdxInCTU];
 
     m_psyEnergy        = 0;
     m_totalPsyCost     = MAX_INT64;
@@ -541,8 +541,8 @@ void TComDataCU::copyPartFrom(TComDataCU
     m_cuAbove          = cu->getCUAbove();
     m_cuLeft           = cu->getCULeft();
 
-    m_cuMvField[0].copyFrom(cu->getCUMvField(REF_PIC_LIST_0), cuData->numPartitions, offset);
-    m_cuMvField[1].copyFrom(cu->getCUMvField(REF_PIC_LIST_1), cuData->numPartitions, offset);
+    m_cuMvField[0].copyFrom(&cu->m_cuMvField[REF_PIC_LIST_0], cuData->numPartitions, offset);
+    m_cuMvField[1].copyFrom(&cu->m_cuMvField[REF_PIC_LIST_1], cuData->numPartitions, offset);
 
     uint32_t tmp  = 1 << ((g_maxLog2CUSize - depth) * 2);
     uint32_t tmp2 = partUnitIdx * tmp;
@@ -605,8 +605,8 @@ void TComDataCU::copyToPic(uint32_t dept
     memcpy(cu->getMVPIdx(REF_PIC_LIST_0) + m_absIdxInCTU, m_mvpIdx[0], sizeInChar);
     memcpy(cu->getMVPIdx(REF_PIC_LIST_1) + m_absIdxInCTU, m_mvpIdx[1], sizeInChar);
 
-    m_cuMvField[0].copyTo(cu->getCUMvField(REF_PIC_LIST_0), m_absIdxInCTU);
-    m_cuMvField[1].copyTo(cu->getCUMvField(REF_PIC_LIST_1), m_absIdxInCTU);
+    m_cuMvField[0].copyTo(&cu->m_cuMvField[REF_PIC_LIST_0], m_absIdxInCTU);
+    m_cuMvField[1].copyTo(&cu->m_cuMvField[REF_PIC_LIST_1], m_absIdxInCTU);
 
     uint32_t tmpY  = 1 << ((g_maxLog2CUSize - depth) * 2);
     uint32_t tmpY2 = m_absIdxInCTU << (LOG2_UNIT_SIZE * 2);
@@ -696,8 +696,8 @@ void TComDataCU::copyToPic(uint32_t dept
 
     memcpy(cu->getMVPIdx(REF_PIC_LIST_0) + partOffset, m_mvpIdx[0], sizeInChar);
     memcpy(cu->getMVPIdx(REF_PIC_LIST_1) + partOffset, m_mvpIdx[1], sizeInChar);
-    m_cuMvField[0].copyTo(cu->getCUMvField(REF_PIC_LIST_0), m_absIdxInCTU, partStart, qNumPart);
-    m_cuMvField[1].copyTo(cu->getCUMvField(REF_PIC_LIST_1), m_absIdxInCTU, partStart, qNumPart);
+    m_cuMvField[0].copyTo(&cu->m_cuMvField[REF_PIC_LIST_0], m_absIdxInCTU, partStart, qNumPart);
+    m_cuMvField[1].copyTo(&cu->m_cuMvField[REF_PIC_LIST_1], m_absIdxInCTU, partStart, qNumPart);
 
     uint32_t tmpY  = 1 << ((g_maxLog2CUSize - depth - partDepth) * 2);
     uint32_t tmpY2 = partOffset << (LOG2_UNIT_SIZE * 2);
@@ -721,7 +721,7 @@ void TComDataCU::copyToPic(uint32_t dept
 // Other public functions
 // --------------------------------------------------------------------------------------------------------------------
 
-TComDataCU* TComDataCU::getPULeft(uint32_t& lPartUnitIdx, uint32_t curPartUnitIdx)
+const TComDataCU* TComDataCU::getPULeft(uint32_t& lPartUnitIdx, uint32_t curPartUnitIdx) const
 {
     uint32_t absPartIdx       = g_zscanToRaster[curPartUnitIdx];
     uint32_t numPartInCUSize  = m_pic->getNumPartInCUSize();
@@ -732,7 +732,7 @@ TComDataCU* TComDataCU::getPULeft(uint32
         lPartUnitIdx = g_rasterToZscan[absPartIdx - 1];
         if (RasterAddress::isEqualCol(absPartIdx, absZorderCUIdx, numPartInCUSize))
         {
-            return m_pic->getCU(getAddr());
+            return m_pic->getCU(m_cuAddr);
         }
         else
         {
@@ -745,7 +745,7 @@ TComDataCU* TComDataCU::getPULeft(uint32
     return m_cuLeft;
 }
 
-TComDataCU* TComDataCU::getPUAbove(uint32_t& aPartUnitIdx, uint32_t curPartUnitIdx, bool planarAtCTUBoundary)
+const TComDataCU* TComDataCU::getPUAbove(uint32_t& aPartUnitIdx, uint32_t curPartUnitIdx, bool planarAtCTUBoundary) const
 {
     uint32_t absPartIdx       = g_zscanToRaster[curPartUnitIdx];
     uint32_t numPartInCUSize  = m_pic->getNumPartInCUSize();
@@ -756,7 +756,7 @@ TComDataCU* TComDataCU::getPUAbove(uint3
         aPartUnitIdx = g_rasterToZscan[absPartIdx - numPartInCUSize];
         if (RasterAddress::isEqualRow(absPartIdx, absZorderCUIdx, numPartInCUSize))
         {
-            return m_pic->getCU(getAddr());
+            return m_pic->getCU(m_cuAddr);
         }
         else
         {
@@ -772,7 +772,7 @@ TComDataCU* TComDataCU::getPUAbove(uint3
     return m_cuAbove;
 }
 
-TComDataCU* TComDataCU::getPUAboveLeft(uint32_t& alPartUnitIdx, uint32_t curPartUnitIdx)
+const TComDataCU* TComDataCU::getPUAboveLeft(uint32_t& alPartUnitIdx, uint32_t curPartUnitIdx) const
 {
     uint32_t absPartIdx      = g_zscanToRaster[curPartUnitIdx];
     uint32_t numPartInCUSize = m_pic->getNumPartInCUSize();
@@ -785,7 +785,7 @@ TComDataCU* TComDataCU::getPUAboveLeft(u
             alPartUnitIdx = g_rasterToZscan[absPartIdx - numPartInCUSize - 1];
             if (RasterAddress::isEqualRowOrCol(absPartIdx, absZorderCUIdx, numPartInCUSize))
             {
-                return m_pic->getCU(getAddr());
+                return m_pic->getCU(m_cuAddr);
             }
             else
             {
@@ -807,9 +807,9 @@ TComDataCU* TComDataCU::getPUAboveLeft(u
     return m_cuAboveLeft;
 }
 
-TComDataCU* TComDataCU::getPUAboveRight(uint32_t& arPartUnitIdx, uint32_t curPartUnitIdx)
+const TComDataCU* TComDataCU::getPUAboveRight(uint32_t& arPartUnitIdx, uint32_t curPartUnitIdx) const
 {
-    if ((m_pic->getCU(m_cuAddr)->getCUPelX() + g_zscanToPelX[curPartUnitIdx] + UNIT_SIZE) >= m_slice->m_sps->picWidthInLumaSamples)
+    if ((m_pic->getCU(m_cuAddr)->m_cuPelX + g_zscanToPelX[curPartUnitIdx] + UNIT_SIZE) >= m_slice->m_sps->picWidthInLumaSamples)
         return NULL;
 
     uint32_t absPartIdxRT    = g_zscanToRaster[curPartUnitIdx];
@@ -825,7 +825,7 @@ TComDataCU* TComDataCU::getPUAboveRight(
                 arPartUnitIdx = g_rasterToZscan[absPartIdxRT - numPartInCUSize + 1];
                 if (RasterAddress::isEqualRowOrCol(absPartIdxRT, absZorderCUIdx, numPartInCUSize))
                 {
-                    return m_pic->getCU(getAddr());
+                    return m_pic->getCU(m_cuAddr);
                 }
                 else
                 {
@@ -848,9 +848,9 @@ TComDataCU* TComDataCU::getPUAboveRight(
     return m_cuAboveRight;
 }
 
-TComDataCU* TComDataCU::getPUBelowLeft(uint32_t& blPartUnitIdx, uint32_t curPartUnitIdx)
+const TComDataCU* TComDataCU::getPUBelowLeft(uint32_t& blPartUnitIdx, uint32_t curPartUnitIdx) const
 {
-    if ((m_pic->getCU(m_cuAddr)->getCUPelY() + g_zscanToPelY[curPartUnitIdx] + UNIT_SIZE) >= m_slice->m_sps->picHeightInLumaSamples)
+    if ((m_pic->getCU(m_cuAddr)->m_cuPelY + g_zscanToPelY[curPartUnitIdx] + UNIT_SIZE) >= m_slice->m_sps->picHeightInLumaSamples)
         return NULL;
 
     uint32_t absPartIdxLB    = g_zscanToRaster[curPartUnitIdx];
@@ -866,7 +866,7 @@ TComDataCU* TComDataCU::getPUBelowLeft(u
                 blPartUnitIdx = g_rasterToZscan[absPartIdxLB + numPartInCUSize - 1];
                 if (RasterAddress::isEqualRowOrCol(absPartIdxLB, absZorderCUIdxLB, numPartInCUSize))
                 {
-                    return m_pic->getCU(getAddr());
+                    return m_pic->getCU(m_cuAddr);
                 }
                 else
                 {
@@ -883,13 +883,10 @@ TComDataCU* TComDataCU::getPUBelowLeft(u
     return NULL;
 }
 
-TComDataCU* TComDataCU::getPUBelowLeftAdi(uint32_t& blPartUnitIdx,  uint32_t curPartUnitIdx, uint32_t partUnitOffset)
+const TComDataCU* TComDataCU::getPUBelowLeftAdi(uint32_t& blPartUnitIdx,  uint32_t curPartUnitIdx, uint32_t partUnitOffset) const
 {
-    if ((m_pic->getCU(m_cuAddr)->getCUPelY() + g_zscanToPelY[curPartUnitIdx] + (partUnitOffset << LOG2_UNIT_SIZE)) >=
-        m_slice->m_sps->picHeightInLumaSamples)
-    {
+    if ((m_pic->getCU(m_cuAddr)->m_cuPelY + g_zscanToPelY[curPartUnitIdx] + (partUnitOffset << LOG2_UNIT_SIZE)) >= m_slice->m_sps->picHeightInLumaSamples)
         return NULL;
-    }
 
     uint32_t absPartIdxLB    = g_zscanToRaster[curPartUnitIdx];
     uint32_t numPartInCUSize = m_pic->getNumPartInCUSize();
@@ -903,9 +900,7 @@ TComDataCU* TComDataCU::getPUBelowLeftAd
                 uint32_t absZorderCUIdxLB = g_zscanToRaster[m_absIdxInCTU] + ((1 << (m_log2CUSize[0] - LOG2_UNIT_SIZE)) - 1) * m_pic->getNumPartInCUSize();
                 blPartUnitIdx = g_rasterToZscan[absPartIdxLB + partUnitOffset * numPartInCUSize - 1];
                 if (RasterAddress::isEqualRowOrCol(absPartIdxLB, absZorderCUIdxLB, numPartInCUSize))
-                {
-                    return m_pic->getCU(getAddr());
-                }
+                    return m_pic->getCU(m_cuAddr);
                 else
                 {
                     blPartUnitIdx -= m_absIdxInCTU;
@@ -915,23 +910,18 @@ TComDataCU* TComDataCU::getPUBelowLeftAd
             return NULL;
         }
         blPartUnitIdx = g_rasterToZscan[absPartIdxLB + (1 + partUnitOffset) * numPartInCUSize - 1];
-        if (m_cuLeft == NULL || m_cuLeft->m_slice == NULL)
-        {
+        if (!m_cuLeft || !m_cuLeft->m_slice)
             return NULL;
-        }
         return m_cuLeft;
     }
 
     return NULL;
 }
 
-TComDataCU* TComDataCU::getPUAboveRightAdi(uint32_t& arPartUnitIdx, uint32_t curPartUnitIdx, uint32_t partUnitOffset)
+const TComDataCU* TComDataCU::getPUAboveRightAdi(uint32_t& arPartUnitIdx, uint32_t curPartUnitIdx, uint32_t partUnitOffset) const
 {
-    if ((m_pic->getCU(m_cuAddr)->getCUPelX() + g_zscanToPelX[curPartUnitIdx] + (partUnitOffset << LOG2_UNIT_SIZE)) >=
-        m_slice->m_sps->picWidthInLumaSamples)
-    {
+    if ((m_pic->getCU(m_cuAddr)->m_cuPelX + g_zscanToPelX[curPartUnitIdx] + (partUnitOffset << LOG2_UNIT_SIZE)) >= m_slice->m_sps->picWidthInLumaSamples)
         return NULL;
-    }
 
     uint32_t absPartIdxRT    = g_zscanToRaster[curPartUnitIdx];
     uint32_t numPartInCUSize = m_pic->getNumPartInCUSize();
@@ -946,7 +936,7 @@ TComDataCU* TComDataCU::getPUAboveRightA
                 arPartUnitIdx = g_rasterToZscan[absPartIdxRT - numPartInCUSize + partUnitOffset];
                 if (RasterAddress::isEqualRowOrCol(absPartIdxRT, absZorderCUIdx, numPartInCUSize))
                 {
-                    return m_pic->getCU(getAddr());
+                    return m_pic->getCU(m_cuAddr);
                 }
                 else
                 {
@@ -957,24 +947,17 @@ TComDataCU* TComDataCU::getPUAboveRightA
             return NULL;
         }
         arPartUnitIdx = g_rasterToZscan[absPartIdxRT + NUM_CU_PARTITIONS - numPartInCUSize + partUnitOffset];
-        if (m_cuAbove == NULL || m_cuAbove->m_slice == NULL)
-        {
+        if (!m_cuAbove || !m_cuAbove->m_slice)
             return NULL;
-        }
         return m_cuAbove;
     }
 
     if (!RasterAddress::isZeroRow(absPartIdxRT, numPartInCUSize))
-    {
         return NULL;
-    }
 
     arPartUnitIdx = g_rasterToZscan[NUM_CU_PARTITIONS - numPartInCUSize + partUnitOffset - 1];
-    if ((m_cuAboveRight == NULL || m_cuAboveRight->m_slice == NULL ||
-         (m_cuAboveRight->getAddr()) > getAddr()))
-    {
+    if ((m_cuAboveRight == NULL || m_cuAboveRight->m_slice == NULL || (m_cuAboveRight->m_cuAddr) > m_cuAddr))
         return NULL;
-    }
     return m_cuAboveRight;
 }
 
@@ -983,7 +966,7 @@ TComDataCU* TComDataCU::getPUAboveRightA
 *\param   curAbsIdxInCTU
 *\returns TComDataCU*   point of TComDataCU of left QpMinCu
 */
-TComDataCU* TComDataCU::getQpMinCuLeft(uint32_t& lPartUnitIdx, uint32_t curAbsIdxInCTU)
+const TComDataCU* TComDataCU::getQpMinCuLeft(uint32_t& lPartUnitIdx, uint32_t curAbsIdxInCTU) const
 {
     uint32_t numPartInCUSize = m_pic->getNumPartInCUSize();
     uint32_t absZorderQpMinCUIdx = curAbsIdxInCTU & (0xFF << (g_maxFullDepth - m_slice->m_pps->maxCuDQPDepth) * 2);
@@ -991,15 +974,13 @@ TComDataCU* TComDataCU::getQpMinCuLeft(u
 
     // check for left CTU boundary
     if (RasterAddress::isZeroCol(absRorderQpMinCUIdx, numPartInCUSize))
-    {
         return NULL;
-    }
 
     // get index of left-CU relative to top-left corner of current quantization group
     lPartUnitIdx = g_rasterToZscan[absRorderQpMinCUIdx - 1];
 
     // return pointer to current CTU
-    return m_pic->getCU(getAddr());
+    return m_pic->getCU(m_cuAddr);
 }
 


More information about the x265-commits mailing list