[x265-commits] [x265] sbh: early continue for all zero coeff group

Satoshi Nakagawa nakagawa424 at oki.com
Sun Mar 30 03:28:07 CEST 2014


details:   http://hg.videolan.org/x265/rev/0705bb47bfcc
branches:  
changeset: 6623:0705bb47bfcc
user:      Satoshi Nakagawa <nakagawa424 at oki.com>
date:      Thu Mar 27 16:04:48 2014 +0900
description:
sbh: early continue for all zero coeff group
Subject: [x265] refine CUSize related

details:   http://hg.videolan.org/x265/rev/5fb4400d76c2
branches:  
changeset: 6624:5fb4400d76c2
user:      Satoshi Nakagawa <nakagawa424 at oki.com>
date:      Thu Mar 27 18:19:32 2014 +0900
description:
refine CUSize related

rename to clarify.
division to shift.
Subject: [x265] restore WINXP_SUPPORT build option, workaround for CONDITION_VARIABLE on XP

details:   http://hg.videolan.org/x265/rev/3f78e639d9ce
branches:  
changeset: 6625:3f78e639d9ce
user:      Steve Borho <steve at borho.org>
date:      Sat Mar 29 15:06:01 2014 -0500
description:
restore WINXP_SUPPORT build option, workaround for CONDITION_VARIABLE on XP

This adapts x264's code for an XP-safe pthread_cond_t to make an XP-safe
CONDITION_VARIABLE (which was introduced in Windows Vista)

x265 will use native CONDITION_VARIABLE unless the WINXP_SUPPORT cmake option is
enabled. It forces _WIN32_WINNT=_WIN32_WINNT_VISTA for MinGW for this purpose.
Subject: [x265] vbv: enable row restarts when mid-frame qp adjustemets are inadequate

details:   http://hg.videolan.org/x265/rev/1410caf09a39
branches:  
changeset: 6626:1410caf09a39
user:      Aarthi Thirumalai
date:      Tue Mar 11 01:52:38 2014 +0530
description:
vbv: enable row restarts when mid-frame qp adjustemets are inadequate
Subject: [x265] cmake: allow MinGW to target XP by default

details:   http://hg.videolan.org/x265/rev/6f7b323061dc
branches:  
changeset: 6627:6f7b323061dc
user:      Steve Borho <steve at borho.org>
date:      Sat Mar 29 20:27:43 2014 -0500
description:
cmake: allow MinGW to target XP by default

This makes MinGW to use our workaround CONDITION_VARIABLE implementation but it
seems to be on average better than asking MinGW to compile for Vista.

diffstat:

 source/CMakeLists.txt                              |   10 +-
 source/Lib/TLibCommon/TComDataCU.cpp               |  277 ++++++++++----------
 source/Lib/TLibCommon/TComDataCU.h                 |    3 +-
 source/Lib/TLibCommon/TComLoopFilter.cpp           |   16 +-
 source/Lib/TLibCommon/TComLoopFilter.h             |    2 +-
 source/Lib/TLibCommon/TComPattern.cpp              |    4 +-
 source/Lib/TLibCommon/TComPic.cpp                  |    4 +-
 source/Lib/TLibCommon/TComPic.h                    |   18 +-
 source/Lib/TLibCommon/TComPicSym.cpp               |   18 +-
 source/Lib/TLibCommon/TComPicSym.h                 |   22 +-
 source/Lib/TLibCommon/TComPicYuv.cpp               |   17 +-
 source/Lib/TLibCommon/TComPicYuv.h                 |    5 +-
 source/Lib/TLibCommon/TComRom.cpp                  |   32 +-
 source/Lib/TLibCommon/TComRom.h                    |    4 +-
 source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp |   10 +-
 source/Lib/TLibCommon/TComTrQuant.cpp              |  105 +++----
 source/Lib/TLibEncoder/TEncCu.cpp                  |   46 +-
 source/Lib/TLibEncoder/TEncEntropy.cpp             |    3 +-
 source/Lib/TLibEncoder/TEncSbac.cpp                |    4 +-
 source/Lib/TLibEncoder/TEncSearch.cpp              |   17 +-
 source/common/CMakeLists.txt                       |    4 +
 source/common/param.cpp                            |    4 +-
 source/common/threading.h                          |   26 +-
 source/common/wavefront.cpp                        |    8 +
 source/common/wavefront.h                          |    4 +
 source/common/winxp.cpp                            |  128 +++++++++
 source/common/winxp.h                              |   88 ++++++
 source/encoder/cturow.h                            |    2 +
 source/encoder/frameencoder.cpp                    |  141 ++++++++--
 source/encoder/frameencoder.h                      |    3 +
 30 files changed, 647 insertions(+), 378 deletions(-)

diffs (truncated from 2145 to 300 lines):

diff -r 9b378e860ddb -r 6f7b323061dc source/CMakeLists.txt
--- a/source/CMakeLists.txt	Thu Mar 27 18:14:55 2014 -0700
+++ b/source/CMakeLists.txt	Sat Mar 29 20:27:43 2014 -0500
@@ -191,10 +191,12 @@ if (WIN32)
         set(PLATFORM_LIBS ${PLATFORM_LIBS} ${VLD_LIBRARIES})
         link_directories(${VLD_LIBRARY_DIRS})
     endif()
-    if(MINGW)
-        # MinGW requires a forced Windows version in order to use CONDITION_VARIABLE
-        add_definitions(-D_WIN32_WINNT=_WIN32_WINNT_VISTA)
-    endif(MINGW)
+    option(WINXP_SUPPORT "Make binaries compatible with Windows XP" OFF)
+    if(WINXP_SUPPORT)
+        # force use of workarounds for CONDITION_VARIABLE and atomic
+        # intrinsics introduced after XP
+        add_definitions(-D_WIN32_WINNT=_WIN32_WINNT_WINXP)
+    endif()
 endif()
 
 include(version) # determine X265_VERSION and X265_LATEST_TAG
diff -r 9b378e860ddb -r 6f7b323061dc source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp	Thu Mar 27 18:14:55 2014 -0700
+++ b/source/Lib/TLibCommon/TComDataCU.cpp	Sat Mar 29 20:27:43 2014 -0500
@@ -102,7 +102,7 @@ TComDataCU::TComDataCU()
 TComDataCU::~TComDataCU()
 {}
 
-bool TComDataCU::create(uint32_t numPartition, uint32_t width, uint32_t height, int unitSize, int csp)
+bool TComDataCU::create(uint32_t numPartition, uint32_t cuSize, int unitSize, int csp)
 {
     m_hChromaShift = CHROMA_H_SHIFT(csp);
     m_vChromaShift = CHROMA_V_SHIFT(csp);
@@ -111,7 +111,6 @@ bool TComDataCU::create(uint32_t numPart
     m_pic           = NULL;
     m_slice         = NULL;
     m_numPartitions = numPartition;
-    m_unitSize = unitSize;
 
     uint32_t tmp = 4 * AMVP_DECIMATION_FACTOR / unitSize;
     tmp = tmp * tmp;
@@ -148,14 +147,14 @@ bool TComDataCU::create(uint32_t numPart
     CHECKED_MALLOC(m_mvpIdx[0], uint8_t, numPartition * 2);
     m_mvpIdx[1] = m_mvpIdx[0] + numPartition;
 
-    CHECKED_MALLOC(m_trCoeffY, coeff_t, width * height);
-    CHECKED_MALLOC(m_trCoeffCb, coeff_t, (width >> m_hChromaShift) * (height >> m_vChromaShift));
-    CHECKED_MALLOC(m_trCoeffCr, coeff_t, (width >> m_hChromaShift) * (height >> m_vChromaShift));
+    CHECKED_MALLOC(m_trCoeffY, coeff_t, cuSize * cuSize);
+    CHECKED_MALLOC(m_trCoeffCb, coeff_t, cuSize * cuSize >> (m_hChromaShift + m_vChromaShift));
+    CHECKED_MALLOC(m_trCoeffCr, coeff_t, cuSize * cuSize >> (m_hChromaShift + m_vChromaShift));
 
     CHECKED_MALLOC(m_iPCMFlags, bool, numPartition);
-    CHECKED_MALLOC(m_iPCMSampleY, pixel, width * height);
-    CHECKED_MALLOC(m_iPCMSampleCb, pixel, (width >> m_hChromaShift) * (height >> m_vChromaShift));
-    CHECKED_MALLOC(m_iPCMSampleCr, pixel, (width >> m_hChromaShift) * (height >> m_vChromaShift));
+    CHECKED_MALLOC(m_iPCMSampleY, pixel, cuSize * cuSize);
+    CHECKED_MALLOC(m_iPCMSampleCb, pixel, cuSize * cuSize >> (m_hChromaShift + m_vChromaShift));
+    CHECKED_MALLOC(m_iPCMSampleCr, pixel, cuSize * cuSize >> (m_hChromaShift + m_vChromaShift));
 
     memset(m_partSizes, SIZE_NONE, numPartition * sizeof(*m_partSizes));
     return ok;
@@ -261,7 +260,7 @@ void TComDataCU::initCU(TComPic* pic, ui
     }
 
     uint32_t y_tmp = g_maxCUSize * g_maxCUSize;
-    uint32_t c_tmp = (g_maxCUSize >> m_hChromaShift) * (g_maxCUSize >> m_vChromaShift);
+    uint32_t c_tmp = g_maxCUSize * g_maxCUSize >> (m_hChromaShift + m_vChromaShift);
     {
         m_cuMvField[0].clearMvField();
         m_cuMvField[1].clearMvField();
@@ -632,7 +631,7 @@ void TComDataCU::copyPartFrom(TComDataCU
     memcpy(m_trCoeffY  + tmp2, cu->getCoeffY(),  sizeof(coeff_t) * tmp);
     memcpy(m_iPCMSampleY + tmp2, cu->getPCMSampleY(), sizeof(pixel) * tmp);
 
-    tmp  = (g_maxCUSize >> m_hChromaShift) * (g_maxCUSize >> m_vChromaShift) >> (depth << 1);
+    tmp  >>= m_hChromaShift + m_vChromaShift;
     tmp2 = partUnitIdx * tmp;
     memcpy(m_trCoeffCb + tmp2, cu->getCoeffCb(), sizeof(coeff_t) * tmp);
     memcpy(m_trCoeffCr + tmp2, cu->getCoeffCr(), sizeof(coeff_t) * tmp);
@@ -687,11 +686,11 @@ void TComDataCU::copyToPic(uint8_t uhDep
     memcpy(rpcCU->getIPCMFlag() + m_absIdxInLCU, m_iPCMFlags,         iSizeInBool);
 
     uint32_t tmp  = (g_maxCUSize * g_maxCUSize) >> (uhDepth << 1);
-    uint32_t tmp2 = m_absIdxInLCU * m_pic->getMinCUSize() * m_pic->getMinCUSize();
+    uint32_t tmp2 = m_absIdxInLCU << m_pic->getLog2UnitSize() * 2;
     memcpy(rpcCU->getCoeffY()     + tmp2, m_trCoeffY,    sizeof(coeff_t) * tmp);
     memcpy(rpcCU->getPCMSampleY() + tmp2, m_iPCMSampleY, sizeof(pixel) * tmp);
-    tmp  = ((g_maxCUSize >> m_hChromaShift) * (g_maxCUSize >> m_vChromaShift)) >> (uhDepth << 1);
-    tmp2 = m_absIdxInLCU * (m_pic->getMinCUSize() >> m_hChromaShift) * (m_pic->getMinCUSize() >> m_vChromaShift);
+    tmp  >>= m_hChromaShift + m_vChromaShift;
+    tmp2 >>= m_hChromaShift + m_vChromaShift;
     memcpy(rpcCU->getCoeffCb() + tmp2, m_trCoeffCb, sizeof(coeff_t) * tmp);
     memcpy(rpcCU->getCoeffCr() + tmp2, m_trCoeffCr, sizeof(coeff_t) * tmp);
     memcpy(rpcCU->getPCMSampleCb() + tmp2, m_iPCMSampleCb, sizeof(pixel) * tmp);
@@ -717,11 +716,11 @@ void TComDataCU::copyCodedToPic(uint8_t 
     memcpy(rpcCU->getCbf(TEXT_CHROMA_V) + m_absIdxInLCU, m_cbf[2], iSizeInUchar);
 
     uint32_t tmp  = (g_maxCUSize * g_maxCUSize) >> (depth << 1);
-    uint32_t tmp2 = m_absIdxInLCU * m_pic->getMinCUSize() * m_pic->getMinCUSize();
+    uint32_t tmp2 = m_absIdxInLCU << m_pic->getLog2UnitSize() * 2;
     memcpy(rpcCU->getCoeffY() + tmp2, m_trCoeffY, sizeof(coeff_t) * tmp);
 
-    tmp  = ((g_maxCUSize >> m_hChromaShift) * (g_maxCUSize >> m_hChromaShift)) >> (depth << 1);
-    tmp2 = m_absIdxInLCU * (m_pic->getMinCUSize() >> m_hChromaShift) * (m_pic->getMinCUSize() >> m_vChromaShift);
+    tmp  >>= m_hChromaShift + m_vChromaShift;
+    tmp2 >>= m_hChromaShift + m_vChromaShift;
     memcpy(rpcCU->getCoeffCb() + tmp2, m_trCoeffCb, sizeof(coeff_t) * tmp);
     memcpy(rpcCU->getCoeffCr() + tmp2, m_trCoeffCr, sizeof(coeff_t) * tmp);
 }
@@ -771,12 +770,12 @@ void TComDataCU::copyToPic(uint8_t depth
     memcpy(cu->getIPCMFlag() + partOffset, m_iPCMFlags, sizeInBool);
 
     uint32_t tmp  = (g_maxCUSize * g_maxCUSize) >> ((depth + partDepth) << 1);
-    uint32_t tmp2 = partOffset * m_pic->getMinCUSize() * m_pic->getMinCUSize();
+    uint32_t tmp2 = partOffset << m_pic->getLog2UnitSize() * 2;
     memcpy(cu->getCoeffY()  + tmp2, m_trCoeffY,  sizeof(coeff_t) * tmp);
     memcpy(cu->getPCMSampleY() + tmp2, m_iPCMSampleY, sizeof(pixel) * tmp);
 
-    tmp  = ((g_maxCUSize >> m_hChromaShift) * (g_maxCUSize >> m_vChromaShift)) >> ((depth + partDepth) << 1);
-    tmp2 = partOffset * (m_pic->getMinCUSize() >> m_hChromaShift) * (m_pic->getMinCUSize() >> m_vChromaShift);
+    tmp  >>= m_hChromaShift + m_vChromaShift;
+    tmp2 >>= m_hChromaShift + m_vChromaShift;
     memcpy(cu->getCoeffCb() + tmp2, m_trCoeffCb, sizeof(coeff_t) * tmp);
     memcpy(cu->getCoeffCr() + tmp2, m_trCoeffCr, sizeof(coeff_t) * tmp);
     memcpy(cu->getPCMSampleCb() + tmp2, m_iPCMSampleCb, sizeof(pixel) * tmp);
@@ -791,12 +790,12 @@ TComDataCU* TComDataCU::getPULeft(uint32
 {
     uint32_t absPartIdx       = g_zscanToRaster[curPartUnitIdx];
     uint32_t absZorderCUIdx   = g_zscanToRaster[m_absIdxInLCU];
-    uint32_t numPartInCUWidth = m_pic->getNumPartInWidth();
-
-    if (!RasterAddress::isZeroCol(absPartIdx, numPartInCUWidth))
+    uint32_t numPartInCUSize  = m_pic->getNumPartInCUSize();
+
+    if (!RasterAddress::isZeroCol(absPartIdx, numPartInCUSize))
     {
         lPartUnitIdx = g_rasterToZscan[absPartIdx - 1];
-        if (RasterAddress::isEqualCol(absPartIdx, absZorderCUIdx, numPartInCUWidth))
+        if (RasterAddress::isEqualCol(absPartIdx, absZorderCUIdx, numPartInCUSize))
         {
             return m_pic->getCU(getAddr());
         }
@@ -807,7 +806,7 @@ TComDataCU* TComDataCU::getPULeft(uint32
         }
     }
 
-    lPartUnitIdx = g_rasterToZscan[absPartIdx + numPartInCUWidth - 1];
+    lPartUnitIdx = g_rasterToZscan[absPartIdx + numPartInCUSize - 1];
 
     if ((bEnforceSliceRestriction && (m_cuLeft == NULL || m_cuLeft->getSlice() == NULL)) ||
         (bEnforceTileRestriction && (m_cuLeft == NULL || m_cuLeft->getSlice() == NULL)))
@@ -822,12 +821,12 @@ TComDataCU* TComDataCU::getPUAbove(uint3
 {
     uint32_t absPartIdx       = g_zscanToRaster[curPartUnitIdx];
     uint32_t absZorderCUIdx   = g_zscanToRaster[m_absIdxInLCU];
-    uint32_t numPartInCUWidth = m_pic->getNumPartInWidth();
-
-    if (!RasterAddress::isZeroRow(absPartIdx, numPartInCUWidth))
+    uint32_t numPartInCUSize  = m_pic->getNumPartInCUSize();
+
+    if (!RasterAddress::isZeroRow(absPartIdx, numPartInCUSize))
     {
-        aPartUnitIdx = g_rasterToZscan[absPartIdx - numPartInCUWidth];
-        if (RasterAddress::isEqualRow(absPartIdx, absZorderCUIdx, numPartInCUWidth))
+        aPartUnitIdx = g_rasterToZscan[absPartIdx - numPartInCUSize];
+        if (RasterAddress::isEqualRow(absPartIdx, absZorderCUIdx, numPartInCUSize))
         {
             return m_pic->getCU(getAddr());
         }
@@ -843,7 +842,7 @@ TComDataCU* TComDataCU::getPUAbove(uint3
         return NULL;
     }
 
-    aPartUnitIdx = g_rasterToZscan[absPartIdx + m_pic->getNumPartInCU() - numPartInCUWidth];
+    aPartUnitIdx = g_rasterToZscan[absPartIdx + m_pic->getNumPartInCU() - numPartInCUSize];
 
     if ((bEnforceSliceRestriction && (m_cuAbove == NULL || m_cuAbove->getSlice() == NULL)) ||
         (bEnforceTileRestriction && (m_cuAbove == NULL || m_cuAbove->getSlice() == NULL)))
@@ -857,14 +856,14 @@ TComDataCU* TComDataCU::getPUAboveLeft(u
 {
     uint32_t absPartIdx       = g_zscanToRaster[curPartUnitIdx];
     uint32_t absZorderCUIdx   = g_zscanToRaster[m_absIdxInLCU];
-    uint32_t numPartInCUWidth = m_pic->getNumPartInWidth();
-
-    if (!RasterAddress::isZeroCol(absPartIdx, numPartInCUWidth))
+    uint32_t numPartInCUSize  = m_pic->getNumPartInCUSize();
+
+    if (!RasterAddress::isZeroCol(absPartIdx, numPartInCUSize))
     {
-        if (!RasterAddress::isZeroRow(absPartIdx, numPartInCUWidth))
+        if (!RasterAddress::isZeroRow(absPartIdx, numPartInCUSize))
         {
-            alPartUnitIdx = g_rasterToZscan[absPartIdx - numPartInCUWidth - 1];
-            if (RasterAddress::isEqualRowOrCol(absPartIdx, absZorderCUIdx, numPartInCUWidth))
+            alPartUnitIdx = g_rasterToZscan[absPartIdx - numPartInCUSize - 1];
+            if (RasterAddress::isEqualRowOrCol(absPartIdx, absZorderCUIdx, numPartInCUSize))
             {
                 return m_pic->getCU(getAddr());
             }
@@ -874,7 +873,7 @@ TComDataCU* TComDataCU::getPUAboveLeft(u
                 return this;
             }
         }
-        alPartUnitIdx = g_rasterToZscan[absPartIdx + getPic()->getNumPartInCU() - numPartInCUWidth - 1];
+        alPartUnitIdx = g_rasterToZscan[absPartIdx + getPic()->getNumPartInCU() - numPartInCUSize - 1];
         if ((bEnforceSliceRestriction && (m_cuAbove == NULL || m_cuAbove->getSlice() == NULL)))
         {
             return NULL;
@@ -882,7 +881,7 @@ TComDataCU* TComDataCU::getPUAboveLeft(u
         return m_cuAbove;
     }
 
-    if (!RasterAddress::isZeroRow(absPartIdx, numPartInCUWidth))
+    if (!RasterAddress::isZeroRow(absPartIdx, numPartInCUSize))
     {
         alPartUnitIdx = g_rasterToZscan[absPartIdx - 1];
         if ((bEnforceSliceRestriction && (m_cuLeft == NULL || m_cuLeft->getSlice() == NULL))
@@ -904,23 +903,23 @@ TComDataCU* TComDataCU::getPUAboveLeft(u
 TComDataCU* TComDataCU::getPUAboveRight(uint32_t& arPartUnitIdx, uint32_t curPartUnitIdx, bool bEnforceSliceRestriction)
 {
     uint32_t absPartIdxRT     = g_zscanToRaster[curPartUnitIdx];
-    uint32_t absZorderCUIdx   = g_zscanToRaster[m_absIdxInLCU] + m_cuSize[0] / m_pic->getMinCUSize() - 1;
-    uint32_t numPartInCUWidth = m_pic->getNumPartInWidth();
-
-    if ((m_pic->getCU(m_cuAddr)->getCUPelX() + g_rasterToPelX[absPartIdxRT] + m_pic->getMinCUSize()) >= m_slice->getSPS()->getPicWidthInLumaSamples())
+    uint32_t absZorderCUIdx   = g_zscanToRaster[m_absIdxInLCU] + (m_cuSize[0] >> m_pic->getLog2UnitSize()) - 1;
+    uint32_t numPartInCUSize  = m_pic->getNumPartInCUSize();
+
+    if ((m_pic->getCU(m_cuAddr)->getCUPelX() + g_rasterToPelX[absPartIdxRT] + m_pic->getUnitSize()) >= m_slice->getSPS()->getPicWidthInLumaSamples())
     {
         arPartUnitIdx = MAX_UINT;
         return NULL;
     }
 
-    if (RasterAddress::lessThanCol(absPartIdxRT, numPartInCUWidth - 1, numPartInCUWidth))
+    if (RasterAddress::lessThanCol(absPartIdxRT, numPartInCUSize - 1, numPartInCUSize))
     {
-        if (!RasterAddress::isZeroRow(absPartIdxRT, numPartInCUWidth))
+        if (!RasterAddress::isZeroRow(absPartIdxRT, numPartInCUSize))
         {
-            if (curPartUnitIdx > g_rasterToZscan[absPartIdxRT - numPartInCUWidth + 1])
+            if (curPartUnitIdx > g_rasterToZscan[absPartIdxRT - numPartInCUSize + 1])
             {
-                arPartUnitIdx = g_rasterToZscan[absPartIdxRT - numPartInCUWidth + 1];
-                if (RasterAddress::isEqualRowOrCol(absPartIdxRT, absZorderCUIdx, numPartInCUWidth))
+                arPartUnitIdx = g_rasterToZscan[absPartIdxRT - numPartInCUSize + 1];
+                if (RasterAddress::isEqualRowOrCol(absPartIdxRT, absZorderCUIdx, numPartInCUSize))
                 {
                     return m_pic->getCU(getAddr());
                 }
@@ -933,7 +932,7 @@ TComDataCU* TComDataCU::getPUAboveRight(
             arPartUnitIdx = MAX_UINT;
             return NULL;
         }
-        arPartUnitIdx = g_rasterToZscan[absPartIdxRT + m_pic->getNumPartInCU() - numPartInCUWidth + 1];
+        arPartUnitIdx = g_rasterToZscan[absPartIdxRT + m_pic->getNumPartInCU() - numPartInCUSize + 1];
         if ((bEnforceSliceRestriction && (m_cuAbove == NULL || m_cuAbove->getSlice() == NULL)))
         {
             return NULL;
@@ -941,13 +940,13 @@ TComDataCU* TComDataCU::getPUAboveRight(
         return m_cuAbove;
     }
 
-    if (!RasterAddress::isZeroRow(absPartIdxRT, numPartInCUWidth))
+    if (!RasterAddress::isZeroRow(absPartIdxRT, numPartInCUSize))
     {
         arPartUnitIdx = MAX_UINT;
         return NULL;
     }
 
-    arPartUnitIdx = g_rasterToZscan[m_pic->getNumPartInCU() - numPartInCUWidth];
+    arPartUnitIdx = g_rasterToZscan[m_pic->getNumPartInCU() - numPartInCUSize];
     if ((bEnforceSliceRestriction && (m_cuAboveRight == NULL || m_cuAboveRight->getSlice() == NULL ||
                                       (m_cuAboveRight->getAddr()) > getAddr())))
     {
@@ -959,23 +958,23 @@ TComDataCU* TComDataCU::getPUAboveRight(
 TComDataCU* TComDataCU::getPUBelowLeft(uint32_t& blPartUnitIdx, uint32_t curPartUnitIdx, bool bEnforceSliceRestriction)
 {
     uint32_t absPartIdxLB     = g_zscanToRaster[curPartUnitIdx];
-    uint32_t absZorderCUIdxLB = g_zscanToRaster[m_absIdxInLCU] + (m_cuSize[0] / m_pic->getMinCUSize() - 1) * m_pic->getNumPartInWidth();
-    uint32_t numPartInCUWidth = m_pic->getNumPartInWidth();
-
-    if ((m_pic->getCU(m_cuAddr)->getCUPelY() + g_rasterToPelY[absPartIdxLB] + m_pic->getMinCUSize()) >= m_slice->getSPS()->getPicHeightInLumaSamples())
+    uint32_t absZorderCUIdxLB = g_zscanToRaster[m_absIdxInLCU] + ((m_cuSize[0] >> m_pic->getLog2UnitSize()) - 1) * m_pic->getNumPartInCUSize();
+    uint32_t numPartInCUSize  = m_pic->getNumPartInCUSize();
+
+    if ((m_pic->getCU(m_cuAddr)->getCUPelY() + g_rasterToPelY[absPartIdxLB] + m_pic->getUnitSize()) >= m_slice->getSPS()->getPicHeightInLumaSamples())
     {
         blPartUnitIdx = MAX_UINT;
         return NULL;
     }
 
-    if (RasterAddress::lessThanRow(absPartIdxLB, m_pic->getNumPartInHeight() - 1, numPartInCUWidth))
+    if (RasterAddress::lessThanRow(absPartIdxLB, numPartInCUSize - 1, numPartInCUSize))
     {
-        if (!RasterAddress::isZeroCol(absPartIdxLB, numPartInCUWidth))
+        if (!RasterAddress::isZeroCol(absPartIdxLB, numPartInCUSize))
         {
-            if (curPartUnitIdx > g_rasterToZscan[absPartIdxLB + numPartInCUWidth - 1])
+            if (curPartUnitIdx > g_rasterToZscan[absPartIdxLB + numPartInCUSize - 1])


More information about the x265-commits mailing list