[x265] CU is square

Satoshi Nakagawa nakagawa424 at oki.com
Thu Mar 6 03:06:06 CET 2014


# HG changeset patch
# User Satoshi Nakagawa <nakagawa424 at oki.com>
# Date 1394071319 -32400
#      Thu Mar 06 11:01:59 2014 +0900
# Node ID 1e7709ecd0a01cf2f5e44b7512cc22fcaa3844cf
# Parent  01547efd182dcd261422eb26a8dcc9cf1bb5bc21
CU is square

unify TComDataCU::m_width and m_height to m_cuSize


diff -r 01547efd182d -r 1e7709ecd0a0 source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp	Wed Mar 05 16:18:38 2014 -0600
+++ b/source/Lib/TLibCommon/TComDataCU.cpp	Thu Mar 06 11:01:59 2014 +0900
@@ -67,8 +67,7 @@
     m_partSizes = NULL;
     m_predModes = NULL;
     m_cuTransquantBypass = NULL;
-    m_width = NULL;
-    m_height = NULL;
+    m_cuSize = NULL;
     m_qp = NULL;
     m_bMergeFlags = NULL;
     m_mergeIndex = NULL;
@@ -127,8 +126,7 @@
 
     CHECKED_MALLOC(m_qp, char,  numPartition);
     CHECKED_MALLOC(m_depth, UChar, numPartition);
-    CHECKED_MALLOC(m_width, UChar, numPartition);
-    CHECKED_MALLOC(m_height, UChar, numPartition);
+    CHECKED_MALLOC(m_cuSize, uint8_t, numPartition);
     CHECKED_MALLOC(m_skipFlag, bool, numPartition);
     CHECKED_MALLOC(m_partSizes, char, numPartition);
     CHECKED_MALLOC(m_predModes, char, numPartition);
@@ -174,8 +172,7 @@
     X265_FREE(m_pattern);
     X265_FREE(m_qp);
     X265_FREE(m_depth);
-    X265_FREE(m_width);
-    X265_FREE(m_height);
+    X265_FREE(m_cuSize);
     X265_FREE(m_cbf[0]);
     X265_FREE(m_cbf[1]);
     X265_FREE(m_cbf[2]);
@@ -227,8 +224,8 @@
     m_pic              = pic;
     m_slice            = pic->getSlice();
     m_cuAddr           = cuAddr;
-    m_cuPelX           = (cuAddr % pic->getFrameWidthInCU()) * g_maxCUWidth;
-    m_cuPelY           = (cuAddr / pic->getFrameWidthInCU()) * g_maxCUHeight;
+    m_cuPelX           = (cuAddr % pic->getFrameWidthInCU()) * g_maxCUSize;
+    m_cuPelY           = (cuAddr / pic->getFrameWidthInCU()) * g_maxCUSize;
     m_absIdxInLCU      = 0;
     m_totalCost        = MAX_INT64;
     m_sa8dCost         = MAX_INT64;
@@ -256,8 +253,7 @@
         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_cuSize,             g_maxCUSize,   numElements * sizeof(*m_cuSize));
         memset(m_qp,                 qp,            numElements * sizeof(*m_qp));
         memset(m_bMergeFlags,        false,         numElements * sizeof(*m_bMergeFlags));
         memset(m_mergeIndex,         0,             numElements * sizeof(*m_mergeIndex));
@@ -270,8 +266,8 @@
         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);
+    uint32_t y_tmp = g_maxCUSize * g_maxCUSize;
+    uint32_t c_tmp = (g_maxCUSize >> m_hChromaShift) * (g_maxCUSize >> m_vChromaShift);
     {
         m_cuMvField[0].clearMvField();
         m_cuMvField[1].clearMvField();
@@ -340,14 +336,12 @@
     m_totalDistortion  = 0;
     m_totalBits        = 0;
 
-    UChar width  = g_maxCUWidth  >> depth;
-    UChar height = g_maxCUHeight >> depth;
+    UChar cuSize = g_maxCUSize >> depth;
 
     for (uint32_t i = 0; i < m_numPartitions; i++)
     {
         m_depth[i] = depth;
-        m_width[i] = width;
-        m_height[i] = height;
+        m_cuSize[i] = cuSize;
         m_trIdx[i] = 0;
         m_transformSkip[0][i] = 0;
         m_transformSkip[1][i] = 0;
@@ -383,8 +377,8 @@
     m_cuAddr           = cu->getAddr();
     m_absIdxInLCU      = cu->getZorderIdxInCU() + partOffset;
 
-    m_cuPelX           = cu->getCUPelX() + (g_maxCUWidth >> depth) * (partUnitIdx &  1);
-    m_cuPelY           = cu->getCUPelY() + (g_maxCUHeight >> depth) * (partUnitIdx >> 1);
+    m_cuPelX           = cu->getCUPelX() + (g_maxCUSize >> depth) * (partUnitIdx &  1);
+    m_cuPelY           = cu->getCUPelY() + (g_maxCUSize >> depth) * (partUnitIdx >> 1);
 
     m_totalCost        = MAX_INT64;
     m_sa8dCost         = MAX_INT64;
@@ -417,10 +411,8 @@
     memset(m_cbf[2],          0, iSizeInUchar);
     memset(m_depth, depth, iSizeInUchar);
 
-    UChar width  = g_maxCUWidth  >> depth;
-    UChar heigth = g_maxCUHeight >> depth;
-    memset(m_width,     width,  iSizeInUchar);
-    memset(m_height,    heigth, iSizeInUchar);
+    UChar cuSize = g_maxCUSize >> depth;
+    memset(m_cuSize,    cuSize,  iSizeInUchar);
     memset(m_iPCMFlags, 0, iSizeInBool);
     for (uint32_t i = 0; i < m_numPartitions; i++)
     {
@@ -453,8 +445,8 @@
     m_cuAddr           = cu->getAddr();
     m_absIdxInLCU      = cu->getZorderIdxInCU() + partOffset;
 
-    m_cuPelX           = cu->getCUPelX() + (g_maxCUWidth >> depth) * (partUnitIdx & 1);
-    m_cuPelY           = cu->getCUPelY() + (g_maxCUHeight >> depth) * (partUnitIdx >> 1);
+    m_cuPelX           = cu->getCUPelX() + (g_maxCUSize >> depth) * (partUnitIdx & 1);
+    m_cuPelY           = cu->getCUPelY() + (g_maxCUSize >> depth) * (partUnitIdx >> 1);
 
     m_totalCost        = MAX_INT64;
     m_sa8dCost         = MAX_INT64;
@@ -474,8 +466,7 @@
 
     memcpy(m_lumaIntraDir, rpcCU->getLumaIntraDir() + m_absIdxInLCU, iSizeInUchar);
     memcpy(m_depth, rpcCU->getDepth() + m_absIdxInLCU, iSizeInUchar);
-    memcpy(m_width, rpcCU->getWidth() + m_absIdxInLCU, iSizeInUchar);
-    memcpy(m_height, rpcCU->getHeight() + m_absIdxInLCU, iSizeInUchar);
+    memcpy(m_cuSize, rpcCU->getCUSize() + m_absIdxInLCU, iSizeInUchar);
 }
 
 // --------------------------------------------------------------------------------------------------------------------
@@ -520,8 +511,7 @@
     memcpy(m_cbf[2] + offset, cu->getCbf(TEXT_CHROMA_V), iSizeInUchar);
 
     memcpy(m_depth  + offset, cu->getDepth(),  iSizeInUchar);
-    memcpy(m_width  + offset, cu->getWidth(),  iSizeInUchar);
-    memcpy(m_height + offset, cu->getHeight(), iSizeInUchar);
+    memcpy(m_cuSize + offset, cu->getCUSize(), iSizeInUchar);
 
     memcpy(m_mvpIdx[0] + offset, cu->getMVPIdx(REF_PIC_LIST_0), iSizeInUchar);
     memcpy(m_mvpIdx[1] + offset, cu->getMVPIdx(REF_PIC_LIST_1), iSizeInUchar);
@@ -539,12 +529,12 @@
     m_cuMvField[0].copyFrom(cu->getCUMvField(REF_PIC_LIST_0), cu->getTotalNumPart(), offset);
     m_cuMvField[1].copyFrom(cu->getCUMvField(REF_PIC_LIST_1), cu->getTotalNumPart(), offset);
 
-    uint32_t tmp  = g_maxCUWidth * g_maxCUHeight >> (depth << 1);
+    uint32_t tmp  = g_maxCUSize * g_maxCUSize >> (depth << 1);
     uint32_t tmp2 = partUnitIdx * tmp;
     memcpy(m_trCoeffY  + tmp2, cu->getCoeffY(),  sizeof(TCoeff) * tmp);
     memcpy(m_iPCMSampleY + tmp2, cu->getPCMSampleY(), sizeof(Pel) * tmp);
 
-    tmp  = (g_maxCUWidth >> m_hChromaShift) * (g_maxCUHeight >> m_vChromaShift) >> (depth << 1);
+    tmp  = (g_maxCUSize >> m_hChromaShift) * (g_maxCUSize >> m_vChromaShift) >> (depth << 1);
     tmp2 = partUnitIdx * tmp;
     memcpy(m_trCoeffCb + tmp2, cu->getCoeffCb(), sizeof(TCoeff) * tmp);
     memcpy(m_trCoeffCr + tmp2, cu->getCoeffCr(), sizeof(TCoeff) * tmp);
@@ -589,8 +579,7 @@
     memcpy(rpcCU->getCbf(TEXT_CHROMA_V) + m_absIdxInLCU, m_cbf[2], iSizeInUchar);
 
     memcpy(rpcCU->getDepth()  + m_absIdxInLCU, m_depth,  iSizeInUchar);
-    memcpy(rpcCU->getWidth()  + m_absIdxInLCU, m_width,  iSizeInUchar);
-    memcpy(rpcCU->getHeight() + m_absIdxInLCU, m_height, iSizeInUchar);
+    memcpy(rpcCU->getCUSize() + m_absIdxInLCU, m_cuSize, iSizeInUchar);
 
     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);
@@ -600,12 +589,12 @@
 
     memcpy(rpcCU->getIPCMFlag() + m_absIdxInLCU, m_iPCMFlags,         iSizeInBool);
 
-    uint32_t tmp  = (g_maxCUWidth * g_maxCUHeight) >> (uhDepth << 1);
-    uint32_t tmp2 = m_absIdxInLCU * m_pic->getMinCUWidth() * m_pic->getMinCUHeight();
+    uint32_t tmp  = (g_maxCUSize * g_maxCUSize) >> (uhDepth << 1);
+    uint32_t tmp2 = m_absIdxInLCU * m_pic->getMinCUSize() * m_pic->getMinCUSize();
     memcpy(rpcCU->getCoeffY()     + tmp2, m_trCoeffY,    sizeof(TCoeff) * tmp);
     memcpy(rpcCU->getPCMSampleY() + tmp2, m_iPCMSampleY, sizeof(Pel) * tmp);
-    tmp  = ((g_maxCUWidth >> m_hChromaShift) * (g_maxCUHeight >> m_vChromaShift)) >> (uhDepth << 1);
-    tmp2 = m_absIdxInLCU * (m_pic->getMinCUWidth() >> m_hChromaShift) * (m_pic->getMinCUHeight() >> m_vChromaShift);
+    tmp  = ((g_maxCUSize >> m_hChromaShift) * (g_maxCUSize >> m_vChromaShift)) >> (uhDepth << 1);
+    tmp2 = m_absIdxInLCU * (m_pic->getMinCUSize() >> m_hChromaShift) * (m_pic->getMinCUSize() >> m_vChromaShift);
     memcpy(rpcCU->getCoeffCb() + tmp2, m_trCoeffCb, sizeof(TCoeff) * tmp);
     memcpy(rpcCU->getCoeffCr() + tmp2, m_trCoeffCr, sizeof(TCoeff) * tmp);
     memcpy(rpcCU->getPCMSampleCb() + tmp2, m_iPCMSampleCb, sizeof(Pel) * tmp);
@@ -630,12 +619,12 @@
     memcpy(rpcCU->getCbf(TEXT_CHROMA_U) + m_absIdxInLCU, m_cbf[1], iSizeInUchar);
     memcpy(rpcCU->getCbf(TEXT_CHROMA_V) + m_absIdxInLCU, m_cbf[2], iSizeInUchar);
 
-    uint32_t tmp  = (g_maxCUWidth * g_maxCUHeight) >> (depth << 1);
-    uint32_t tmp2 = m_absIdxInLCU * m_pic->getMinCUWidth() * m_pic->getMinCUHeight();
+    uint32_t tmp  = (g_maxCUSize * g_maxCUSize) >> (depth << 1);
+    uint32_t tmp2 = m_absIdxInLCU * m_pic->getMinCUSize() * m_pic->getMinCUSize();
     memcpy(rpcCU->getCoeffY() + tmp2, m_trCoeffY, sizeof(TCoeff) * tmp);
 
-    tmp  = ((g_maxCUWidth >> m_hChromaShift) * (g_maxCUHeight >> m_hChromaShift)) >> (depth << 1);
-    tmp2 = m_absIdxInLCU * (m_pic->getMinCUWidth() >> m_hChromaShift) * (m_pic->getMinCUHeight() >> m_vChromaShift);
+    tmp  = ((g_maxCUSize >> m_hChromaShift) * (g_maxCUSize >> m_hChromaShift)) >> (depth << 1);
+    tmp2 = m_absIdxInLCU * (m_pic->getMinCUSize() >> m_hChromaShift) * (m_pic->getMinCUSize() >> m_vChromaShift);
     memcpy(rpcCU->getCoeffCb() + tmp2, m_trCoeffCb, sizeof(TCoeff) * tmp);
     memcpy(rpcCU->getCoeffCr() + tmp2, m_trCoeffCr, sizeof(TCoeff) * tmp);
 }
@@ -676,8 +665,7 @@
     memcpy(cu->getCbf(TEXT_CHROMA_V) + partOffset, m_cbf[2], sizeInUchar);
 
     memcpy(cu->getDepth()  + partOffset, m_depth,  sizeInUchar);
-    memcpy(cu->getWidth()  + partOffset, m_width,  sizeInUchar);
-    memcpy(cu->getHeight() + partOffset, m_height, sizeInUchar);
+    memcpy(cu->getCUSize() + partOffset, m_cuSize, sizeInUchar);
 
     memcpy(cu->getMVPIdx(REF_PIC_LIST_0) + partOffset, m_mvpIdx[0], sizeInUchar);
     memcpy(cu->getMVPIdx(REF_PIC_LIST_1) + partOffset, m_mvpIdx[1], sizeInUchar);
@@ -686,13 +674,13 @@
 
     memcpy(cu->getIPCMFlag() + partOffset, m_iPCMFlags, sizeInBool);
 
-    uint32_t tmp  = (g_maxCUWidth * g_maxCUHeight) >> ((depth + partDepth) << 1);
-    uint32_t tmp2 = partOffset * m_pic->getMinCUWidth() * m_pic->getMinCUHeight();
+    uint32_t tmp  = (g_maxCUSize * g_maxCUSize) >> ((depth + partDepth) << 1);
+    uint32_t tmp2 = partOffset * m_pic->getMinCUSize() * m_pic->getMinCUSize();
     memcpy(cu->getCoeffY()  + tmp2, m_trCoeffY,  sizeof(TCoeff) * tmp);
     memcpy(cu->getPCMSampleY() + tmp2, m_iPCMSampleY, sizeof(Pel) * tmp);
 
-    tmp  = ((g_maxCUWidth >> m_hChromaShift) * (g_maxCUHeight >> m_vChromaShift)) >> ((depth + partDepth) << 1);
-    tmp2 = partOffset * (m_pic->getMinCUWidth() >> m_hChromaShift) * (m_pic->getMinCUHeight() >> m_vChromaShift);
+    tmp  = ((g_maxCUSize >> m_hChromaShift) * (g_maxCUSize >> m_vChromaShift)) >> ((depth + partDepth) << 1);
+    tmp2 = partOffset * (m_pic->getMinCUSize() >> m_hChromaShift) * (m_pic->getMinCUSize() >> m_vChromaShift);
     memcpy(cu->getCoeffCb() + tmp2, m_trCoeffCb, sizeof(TCoeff) * tmp);
     memcpy(cu->getCoeffCr() + tmp2, m_trCoeffCr, sizeof(TCoeff) * tmp);
     memcpy(cu->getPCMSampleCb() + tmp2, m_iPCMSampleCb, sizeof(Pel) * tmp);
@@ -820,10 +808,10 @@
 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_width[0] / m_pic->getMinCUWidth() - 1;
+    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->getMinCUWidth()) >= m_slice->getSPS()->getPicWidthInLumaSamples())
+    if ((m_pic->getCU(m_cuAddr)->getCUPelX() + g_rasterToPelX[absPartIdxRT] + m_pic->getMinCUSize()) >= m_slice->getSPS()->getPicWidthInLumaSamples())
     {
         arPartUnitIdx = MAX_UINT;
         return NULL;
@@ -875,10 +863,10 @@
 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_height[0] / m_pic->getMinCUHeight() - 1) * m_pic->getNumPartInWidth();
+    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->getMinCUHeight()) >= m_slice->getSPS()->getPicHeightInLumaSamples())
+    if ((m_pic->getCU(m_cuAddr)->getCUPelY() + g_rasterToPelY[absPartIdxLB] + m_pic->getMinCUSize()) >= m_slice->getSPS()->getPicHeightInLumaSamples())
     {
         blPartUnitIdx = MAX_UINT;
         return NULL;
@@ -919,10 +907,10 @@
 TComDataCU* TComDataCU::getPUBelowLeftAdi(uint32_t& blPartUnitIdx,  uint32_t curPartUnitIdx, uint32_t partUnitOffset)
 {
     uint32_t absPartIdxLB     = g_zscanToRaster[curPartUnitIdx];
-    uint32_t absZorderCUIdxLB = g_zscanToRaster[m_absIdxInLCU] + ((m_height[0] / m_pic->getMinCUHeight()) - 1) * m_pic->getNumPartInWidth();
+    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->getPicSym()->getMinCUHeight() * partUnitOffset)) >=
+    if ((m_pic->getCU(m_cuAddr)->getCUPelY() + g_rasterToPelY[absPartIdxLB] + (m_pic->getPicSym()->getMinCUSize() * partUnitOffset)) >=
         m_slice->getSPS()->getPicHeightInLumaSamples())
     {
         blPartUnitIdx = MAX_UINT;
@@ -964,10 +952,10 @@
 TComDataCU* TComDataCU::getPUAboveRightAdi(uint32_t& arPartUnitIdx, uint32_t curPartUnitIdx, uint32_t partUnitOffset)
 {
     uint32_t absPartIdxRT     = g_zscanToRaster[curPartUnitIdx];
-    uint32_t absZorderCUIdx   = g_zscanToRaster[m_absIdxInLCU] + (m_width[0] / m_pic->getMinCUWidth()) - 1;
+    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->getPicSym()->getMinCUHeight() * partUnitOffset)) >=
+    if ((m_pic->getCU(m_cuAddr)->getCUPelX() + g_rasterToPelX[absPartIdxRT] + (m_pic->getPicSym()->getMinCUSize() * partUnitOffset)) >=
         m_slice->getSPS()->getPicWidthInLumaSamples())
     {
         arPartUnitIdx = MAX_UINT;
@@ -1229,7 +1217,7 @@
 
 uint32_t TComDataCU::getQuadtreeTULog2MinSizeInCU(uint32_t absPartIdx)
 {
-    uint32_t log2CbSize = g_convertToBit[getWidth(absPartIdx)] + 2;
+    uint32_t log2CUSize = g_convertToBit[getCUSize(absPartIdx)] + 2;
     PartSize  partSize  = getPartitionSize(absPartIdx);
     uint32_t quadtreeTUMaxDepth = getPredictionMode(absPartIdx) == MODE_INTRA ? m_slice->getSPS()->getQuadtreeTUMaxDepthIntra() : m_slice->getSPS()->getQuadtreeTUMaxDepthInter();
     int intraSplitFlag = (getPredictionMode(absPartIdx) == MODE_INTRA && partSize == SIZE_NxN) ? 1 : 0;
@@ -1237,7 +1225,7 @@
 
     uint32_t log2MinTUSizeInCU = 0;
 
-    if (log2CbSize < (m_slice->getSPS()->getQuadtreeTULog2MinSize() + quadtreeTUMaxDepth - 1 + interSplitFlag + intraSplitFlag))
+    if (log2CUSize < (m_slice->getSPS()->getQuadtreeTULog2MinSize() + quadtreeTUMaxDepth - 1 + interSplitFlag + intraSplitFlag))
     {
         // when fully making use of signaled TUMaxDepth + inter/intraSplitFlag, resulting luma TB size is < QuadtreeTULog2MinSize
         log2MinTUSizeInCU = m_slice->getSPS()->getQuadtreeTULog2MinSize();
@@ -1245,7 +1233,7 @@
     else
     {
         // when fully making use of signaled TUMaxDepth + inter/intraSplitFlag, resulting luma TB size is still >= QuadtreeTULog2MinSize
-        log2MinTUSizeInCU = log2CbSize - (quadtreeTUMaxDepth - 1 + interSplitFlag + intraSplitFlag); // stop when trafoDepth == hierarchy_depth = splitFlag
+        log2MinTUSizeInCU = log2CUSize - (quadtreeTUMaxDepth - 1 + interSplitFlag + intraSplitFlag); // stop when trafoDepth == hierarchy_depth = splitFlag
         if (log2MinTUSizeInCU > m_slice->getSPS()->getQuadtreeTULog2MaxSize())
         {
             // when fully making use of signaled TUMaxDepth + inter/intraSplitFlag, resulting luma TB size is still > QuadtreeTULog2MaxSize
@@ -1552,47 +1540,48 @@
 
 void TComDataCU::getPartIndexAndSize(uint32_t partIdx, uint32_t& outPartAddr, int& outWidth, int& outHeight)
 {
+    int cuSize = getCUSize(0);
     switch (m_partSizes[0])
     {
     case SIZE_2NxN:
-        outWidth = getWidth(0);
-        outHeight = getHeight(0) >> 1;
+        outWidth = cuSize;
+        outHeight = cuSize >> 1;
         outPartAddr = (partIdx == 0) ? 0 : m_numPartitions >> 1;
         break;
     case SIZE_Nx2N:
-        outWidth = getWidth(0) >> 1;
-        outHeight = getHeight(0);
+        outWidth = cuSize >> 1;
+        outHeight = cuSize;
         outPartAddr = (partIdx == 0) ? 0 : m_numPartitions >> 2;
         break;
     case SIZE_NxN:
-        outWidth = getWidth(0) >> 1;
-        outHeight = getHeight(0) >> 1;
+        outWidth = cuSize >> 1;
+        outHeight = cuSize >> 1;
         outPartAddr = (m_numPartitions >> 2) * partIdx;
         break;
     case SIZE_2NxnU:
-        outWidth     = getWidth(0);
-        outHeight    = (partIdx == 0) ?  getHeight(0) >> 2 : (getHeight(0) >> 2) + (getHeight(0) >> 1);
+        outWidth     = cuSize;
+        outHeight    = (partIdx == 0) ?  cuSize >> 2 : (cuSize >> 2) + (cuSize >> 1);
         outPartAddr = (partIdx == 0) ? 0 : m_numPartitions >> 3;
         break;
     case SIZE_2NxnD:
-        outWidth     = getWidth(0);
-        outHeight    = (partIdx == 0) ?  (getHeight(0) >> 2) + (getHeight(0) >> 1) : getHeight(0) >> 2;
+        outWidth     = cuSize;
+        outHeight    = (partIdx == 0) ?  (cuSize >> 2) + (cuSize >> 1) : cuSize >> 2;
         outPartAddr = (partIdx == 0) ? 0 : (m_numPartitions >> 1) + (m_numPartitions >> 3);
         break;
     case SIZE_nLx2N:
-        outWidth     = (partIdx == 0) ? getWidth(0) >> 2 : (getWidth(0) >> 2) + (getWidth(0) >> 1);
-        outHeight    = getHeight(0);
+        outWidth     = (partIdx == 0) ? cuSize >> 2 : (cuSize >> 2) + (cuSize >> 1);
+        outHeight    = cuSize;
         outPartAddr = (partIdx == 0) ? 0 : m_numPartitions >> 4;
         break;
     case SIZE_nRx2N:
-        outWidth     = (partIdx == 0) ? (getWidth(0) >> 2) + (getWidth(0) >> 1) : getWidth(0) >> 2;
-        outHeight    = getHeight(0);
+        outWidth     = (partIdx == 0) ? (cuSize >> 2) + (cuSize >> 1) : cuSize >> 2;
+        outHeight    = cuSize;
         outPartAddr = (partIdx == 0) ? 0 : (m_numPartitions >> 2) + (m_numPartitions >> 4);
         break;
     default:
         assert(m_partSizes[0] == SIZE_2Nx2N);
-        outWidth = getWidth(0);
-        outHeight = getHeight(0);
+        outWidth = cuSize;
+        outHeight = cuSize;
         outPartAddr = 0;
         break;
     }
@@ -1618,26 +1607,26 @@
 
     switch (m_partSizes[absPartIdx])
     {
-    case SIZE_2Nx2N: puWidth = m_width[absPartIdx];
+    case SIZE_2Nx2N: puWidth = m_cuSize[absPartIdx];
         break;
-    case SIZE_2NxN:  puWidth = m_width[absPartIdx];
+    case SIZE_2NxN:  puWidth = m_cuSize[absPartIdx];
         break;
-    case SIZE_Nx2N:  puWidth = m_width[absPartIdx]  >> 1;
+    case SIZE_Nx2N:  puWidth = m_cuSize[absPartIdx]  >> 1;
         break;
-    case SIZE_NxN:   puWidth = m_width[absPartIdx]  >> 1;
+    case SIZE_NxN:   puWidth = m_cuSize[absPartIdx]  >> 1;
         break;
-    case SIZE_2NxnU: puWidth = m_width[absPartIdx];
+    case SIZE_2NxnU: puWidth = m_cuSize[absPartIdx];
         break;
-    case SIZE_2NxnD: puWidth = m_width[absPartIdx];
+    case SIZE_2NxnD: puWidth = m_cuSize[absPartIdx];
         break;
     case SIZE_nLx2N:
         if (partIdx == 0)
         {
-            puWidth = m_width[absPartIdx]  >> 2;
+            puWidth = m_cuSize[absPartIdx]  >> 2;
         }
         else if (partIdx == 1)
         {
-            puWidth = (m_width[absPartIdx]  >> 1) + (m_width[absPartIdx]  >> 2);
+            puWidth = (m_cuSize[absPartIdx]  >> 1) + (m_cuSize[absPartIdx]  >> 2);
         }
         else
         {
@@ -1647,11 +1636,11 @@
     case SIZE_nRx2N:
         if (partIdx == 0)
         {
-            puWidth = (m_width[absPartIdx]  >> 1) + (m_width[absPartIdx]  >> 2);
+            puWidth = (m_cuSize[absPartIdx]  >> 1) + (m_cuSize[absPartIdx]  >> 2);
         }
         else if (partIdx == 1)
         {
-            puWidth = m_width[absPartIdx]  >> 2;
+            puWidth = m_cuSize[absPartIdx]  >> 2;
         }
         else
         {
@@ -1663,7 +1652,7 @@
         break;
     }
 
-    outPartIdxRT = g_rasterToZscan[g_zscanToRaster[outPartIdxLT] + puWidth / m_pic->getMinCUWidth() - 1];
+    outPartIdxRT = g_rasterToZscan[g_zscanToRaster[outPartIdxLT] + puWidth / m_pic->getMinCUSize() - 1];
 }
 
 void TComDataCU::deriveLeftBottomIdxGeneral(uint32_t absPartIdx, uint32_t partIdx, uint32_t& outPartIdxLB)
@@ -1672,22 +1661,22 @@
 
     switch (m_partSizes[absPartIdx])
     {
-    case SIZE_2Nx2N: puHeight = m_height[absPartIdx];
+    case SIZE_2Nx2N: puHeight = m_cuSize[absPartIdx];
         break;
-    case SIZE_2NxN:  puHeight = m_height[absPartIdx] >> 1;
+    case SIZE_2NxN:  puHeight = m_cuSize[absPartIdx] >> 1;
         break;
-    case SIZE_Nx2N:  puHeight = m_height[absPartIdx];
+    case SIZE_Nx2N:  puHeight = m_cuSize[absPartIdx];
         break;
-    case SIZE_NxN:   puHeight = m_height[absPartIdx] >> 1;
+    case SIZE_NxN:   puHeight = m_cuSize[absPartIdx] >> 1;
         break;
     case SIZE_2NxnU:
         if (partIdx == 0)
         {
-            puHeight = m_height[absPartIdx] >> 2;
+            puHeight = m_cuSize[absPartIdx] >> 2;
         }
         else if (partIdx == 1)
         {
-            puHeight = (m_height[absPartIdx] >> 1) + (m_height[absPartIdx] >> 2);
+            puHeight = (m_cuSize[absPartIdx] >> 1) + (m_cuSize[absPartIdx] >> 2);
         }
         else
         {
@@ -1697,33 +1686,33 @@
     case SIZE_2NxnD:
         if (partIdx == 0)
         {
-            puHeight = (m_height[absPartIdx] >> 1) + (m_height[absPartIdx] >> 2);
+            puHeight = (m_cuSize[absPartIdx] >> 1) + (m_cuSize[absPartIdx] >> 2);
         }
         else if (partIdx == 1)
         {
-            puHeight = m_height[absPartIdx] >> 2;
+            puHeight = m_cuSize[absPartIdx] >> 2;
         }
         else
         {
             assert(0);
         }
         break;
-    case SIZE_nLx2N: puHeight = m_height[absPartIdx];
+    case SIZE_nLx2N: puHeight = m_cuSize[absPartIdx];
         break;
-    case SIZE_nRx2N: puHeight = m_height[absPartIdx];
+    case SIZE_nRx2N: puHeight = m_cuSize[absPartIdx];
         break;
     default:
         assert(0);
         break;
     }
 
-    outPartIdxLB = g_rasterToZscan[g_zscanToRaster[m_absIdxInLCU + absPartIdx] + ((puHeight / m_pic->getMinCUHeight()) - 1) * m_pic->getNumPartInWidth()];
+    outPartIdxLB = g_rasterToZscan[g_zscanToRaster[m_absIdxInLCU + absPartIdx] + ((puHeight / m_pic->getMinCUSize()) - 1) * m_pic->getNumPartInWidth()];
 }
 
 void TComDataCU::deriveLeftRightTopIdx(uint32_t partIdx, uint32_t& ruiPartIdxLT, uint32_t& ruiPartIdxRT)
 {
     ruiPartIdxLT = m_absIdxInLCU;
-    ruiPartIdxRT = g_rasterToZscan[g_zscanToRaster[ruiPartIdxLT] + m_width[0] / m_pic->getMinCUWidth() - 1];
+    ruiPartIdxRT = g_rasterToZscan[g_zscanToRaster[ruiPartIdxLT] + m_cuSize[0] / m_pic->getMinCUSize() - 1];
 
     switch (m_partSizes[0])
     {
@@ -1764,7 +1753,7 @@
 
 void TComDataCU::deriveLeftBottomIdx(uint32_t partIdx, uint32_t& outPartIdxLB)
 {
-    outPartIdxLB = g_rasterToZscan[g_zscanToRaster[m_absIdxInLCU] + (((m_height[0] / m_pic->getMinCUHeight()) >> 1) - 1) * m_pic->getNumPartInWidth()];
+    outPartIdxLB = g_rasterToZscan[g_zscanToRaster[m_absIdxInLCU] + (((m_cuSize[0] / m_pic->getMinCUSize()) >> 1) - 1) * m_pic->getNumPartInWidth()];
 
     switch (m_partSizes[0])
     {
@@ -1805,8 +1794,8 @@
  */
 void TComDataCU::deriveRightBottomIdx(uint32_t partIdx, uint32_t& outPartIdxRB)
 {
-    outPartIdxRB = g_rasterToZscan[g_zscanToRaster[m_absIdxInLCU] + (((m_height[0] / m_pic->getMinCUHeight()) >> 1) - 1) *
-                                   m_pic->getNumPartInWidth() +  m_width[0] / m_pic->getMinCUWidth() - 1];
+    outPartIdxRB = g_rasterToZscan[g_zscanToRaster[m_absIdxInLCU] + (((m_cuSize[0] / m_pic->getMinCUSize()) >> 1) - 1) *
+                                   m_pic->getNumPartInWidth() +  m_cuSize[0] / m_pic->getMinCUSize() - 1];
 
     switch (m_partSizes[0])
     {
@@ -1842,7 +1831,7 @@
 
 void TComDataCU::deriveLeftRightTopIdxAdi(uint32_t& outPartIdxLT, uint32_t& outPartIdxRT, uint32_t partOffset, uint32_t partDepth)
 {
-    uint32_t numPartInWidth = (m_width[0] / m_pic->getMinCUWidth()) >> partDepth;
+    uint32_t numPartInWidth = (m_cuSize[0] / m_pic->getMinCUSize()) >> partDepth;
 
     outPartIdxLT = m_absIdxInLCU + partOffset;
     outPartIdxRT = g_rasterToZscan[g_zscanToRaster[outPartIdxLT] + numPartInWidth - 1];
@@ -1853,8 +1842,8 @@
     uint32_t absIdx;
     uint32_t minCUWidth, widthInMinCUs;
 
-    minCUWidth    = getPic()->getMinCUWidth();
-    widthInMinCUs = (getWidth(0) / minCUWidth) >> partDepth;
+    minCUWidth    = getPic()->getMinCUSize();
+    widthInMinCUs = (getCUSize(0) / minCUWidth) >> partDepth;
     absIdx        = getZorderIdxInCU() + partOffset + (m_numPartitions >> (partDepth << 1)) - 1;
     absIdx        = g_zscanToRaster[absIdx] - (widthInMinCUs - 1);
     outPartIdxLB    = g_rasterToZscan[absIdx];
@@ -2060,10 +2049,10 @@
         int refIdx;
         int lcuIdx = -1;
 
-        if ((m_pic->getCU(m_cuAddr)->getCUPelX() + g_rasterToPelX[uiAbsPartIdxTmp] + m_pic->getMinCUWidth()) >= m_slice->getSPS()->getPicWidthInLumaSamples())  // image boundary check
+        if ((m_pic->getCU(m_cuAddr)->getCUPelX() + g_rasterToPelX[uiAbsPartIdxTmp] + m_pic->getMinCUSize()) >= m_slice->getSPS()->getPicWidthInLumaSamples())  // image boundary check
         {
         }
-        else if ((m_pic->getCU(m_cuAddr)->getCUPelY() + g_rasterToPelY[uiAbsPartIdxTmp] + m_pic->getMinCUHeight()) >= m_slice->getSPS()->getPicHeightInLumaSamples())
+        else if ((m_pic->getCU(m_cuAddr)->getCUPelY() + g_rasterToPelY[uiAbsPartIdxTmp] + m_pic->getMinCUSize()) >= m_slice->getSPS()->getPicHeightInLumaSamples())
         {
         }
         else
@@ -2228,55 +2217,56 @@
 {
     uint32_t col = m_cuPelX;
     uint32_t row = m_cuPelY;
+    uint32_t cuSize = getCUSize(0);
 
     switch (m_partSizes[0])
     {
     case SIZE_2NxN:
-        nPSW = getWidth(0);
-        nPSH = getHeight(0) >> 1;
+        nPSW = cuSize;
+        nPSH = cuSize >> 1;
         xP   = col;
         yP   = (partIdx == 0) ? row : row + nPSH;
         break;
     case SIZE_Nx2N:
-        nPSW = getWidth(0) >> 1;
-        nPSH = getHeight(0);
+        nPSW = cuSize >> 1;
+        nPSH = cuSize;
         xP   = (partIdx == 0) ? col : col + nPSW;
         yP   = row;
         break;
     case SIZE_NxN:
-        nPSW = getWidth(0) >> 1;
-        nPSH = getHeight(0) >> 1;
+        nPSW = cuSize >> 1;
+        nPSH = cuSize >> 1;
         xP   = col + (partIdx & 0x1) * nPSW;
         yP   = row + (partIdx >> 1) * nPSH;
         break;
     case SIZE_2NxnU:
-        nPSW = getWidth(0);
-        nPSH = (partIdx == 0) ?  getHeight(0) >> 2 : (getHeight(0) >> 2) + (getHeight(0) >> 1);
+        nPSW = cuSize;
+        nPSH = (partIdx == 0) ?  cuSize >> 2 : (cuSize >> 2) + (cuSize >> 1);
         xP   = col;
-        yP   = (partIdx == 0) ? row : row + getHeight(0) - nPSH;
+        yP   = (partIdx == 0) ? row : row + cuSize - nPSH;
         break;
     case SIZE_2NxnD:
-        nPSW = getWidth(0);
-        nPSH = (partIdx == 0) ?  (getHeight(0) >> 2) + (getHeight(0) >> 1) : getHeight(0) >> 2;
+        nPSW = cuSize;
+        nPSH = (partIdx == 0) ?  (cuSize >> 2) + (cuSize >> 1) : cuSize >> 2;
         xP   = col;
-        yP   = (partIdx == 0) ? row : row + getHeight(0) - nPSH;
+        yP   = (partIdx == 0) ? row : row + cuSize - nPSH;
         break;
     case SIZE_nLx2N:
-        nPSW = (partIdx == 0) ? getWidth(0) >> 2 : (getWidth(0) >> 2) + (getWidth(0) >> 1);
-        nPSH = getHeight(0);
-        xP   = (partIdx == 0) ? col : col + getWidth(0) - nPSW;
+        nPSW = (partIdx == 0) ? cuSize >> 2 : (cuSize >> 2) + (cuSize >> 1);
+        nPSH = cuSize;
+        xP   = (partIdx == 0) ? col : col + cuSize - nPSW;
         yP   = row;
         break;
     case SIZE_nRx2N:
-        nPSW = (partIdx == 0) ? (getWidth(0) >> 2) + (getWidth(0) >> 1) : getWidth(0) >> 2;
-        nPSH = getHeight(0);
-        xP   = (partIdx == 0) ? col : col + getWidth(0) - nPSW;
+        nPSW = (partIdx == 0) ? (cuSize >> 2) + (cuSize >> 1) : cuSize >> 2;
+        nPSH = cuSize;
+        xP   = (partIdx == 0) ? col : col + cuSize - nPSW;
         yP   = row;
         break;
     default:
         assert(m_partSizes[0] == SIZE_2Nx2N);
-        nPSW = getWidth(0);
-        nPSH = getHeight(0);
+        nPSW = cuSize;
+        nPSH = cuSize;
         xP   = col;
         yP   = row;
 
@@ -2388,10 +2378,10 @@
         //----  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
+        if ((m_pic->getCU(m_cuAddr)->getCUPelX() + g_rasterToPelX[absPartIdx] + m_pic->getMinCUSize()) >= m_slice->getSPS()->getPicWidthInLumaSamples())  // image boundary check
         {
         }
-        else if ((m_pic->getCU(m_cuAddr)->getCUPelY() + g_rasterToPelY[absPartIdx] + m_pic->getMinCUHeight()) >= m_slice->getSPS()->getPicHeightInLumaSamples())
+        else if ((m_pic->getCU(m_cuAddr)->getCUPelY() + g_rasterToPelY[absPartIdx] + m_pic->getMinCUSize()) >= m_slice->getSPS()->getPicHeightInLumaSamples())
         {
         }
         else
@@ -2443,7 +2433,7 @@
 
 bool TComDataCU::isBipredRestriction()
 {
-    return getWidth(0) == 8 && getPartitionSize(0) != SIZE_2Nx2N;
+    return getCUSize(0) == 8 && getPartitionSize(0) != SIZE_2Nx2N;
 }
 
 void TComDataCU::clipMv(MV& outMV)
@@ -2451,10 +2441,10 @@
     int mvshift = 2;
     int offset = 8;
     int xmax = (m_slice->getSPS()->getPicWidthInLumaSamples() + offset - m_cuPelX - 1) << mvshift;
-    int xmin = (-(int)g_maxCUWidth - offset - (int)m_cuPelX + 1) << mvshift;
+    int xmin = (-(int)g_maxCUSize - offset - (int)m_cuPelX + 1) << mvshift;
 
     int ymax = (m_slice->getSPS()->getPicHeightInLumaSamples() + offset - m_cuPelY - 1) << mvshift;
-    int ymin = (-(int)g_maxCUHeight - offset - (int)m_cuPelY + 1) << mvshift;
+    int ymin = (-(int)g_maxCUSize - offset - (int)m_cuPelY + 1) << mvshift;
 
     outMV.x = X265_MIN(xmax, X265_MAX(xmin, (int)outMV.x));
     outMV.y = X265_MIN(ymax, X265_MAX(ymin, (int)outMV.y));
@@ -2464,7 +2454,7 @@
 {
     uint32_t shift = (m_partSizes[absPartIdx] == SIZE_NxN ? 1 : 0);
 
-    UChar width = m_width[absPartIdx] >> shift;
+    UChar width = m_cuSize[absPartIdx] >> shift;
     uint32_t  cnt = 0;
 
     while (width)
@@ -2829,8 +2819,8 @@
 
     outPartIdxCenter = m_absIdxInLCU + partAddr; // partition origin.
     outPartIdxCenter = g_rasterToZscan[g_zscanToRaster[outPartIdxCenter]
-                                       + (partHeight / m_pic->getMinCUHeight()) / 2 * m_pic->getNumPartInWidth()
-                                       + (partWidth / m_pic->getMinCUWidth()) / 2];
+                                       + (partHeight / m_pic->getMinCUSize()) / 2 * m_pic->getNumPartInWidth()
+                                       + (partWidth / m_pic->getMinCUSize()) / 2];
 }
 
 uint32_t TComDataCU::getCoefScanIdx(uint32_t absPartIdx, uint32_t log2TrSize, bool bIsLuma, bool bIsIntra)
diff -r 01547efd182d -r 1e7709ecd0a0 source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.h	Wed Mar 05 16:18:38 2014 -0600
+++ b/source/Lib/TLibCommon/TComDataCU.h	Thu Mar 06 11:01:59 2014 +0900
@@ -97,8 +97,7 @@
     uint32_t      m_cuPelX;          ///< CU position in a pixel (X)
     uint32_t      m_cuPelY;          ///< CU position in a pixel (Y)
     uint32_t      m_numPartitions;   ///< total number of minimum partitions in a CU
-    UChar*        m_width;           ///< array of widths
-    UChar*        m_height;          ///< array of heights
+    uint8_t*      m_cuSize;          ///< array of cu width/height
     UChar*        m_depth;           ///< array of depths
     int           m_chromaFormat;
     int           m_hChromaShift;
@@ -254,13 +253,9 @@
 
     void          setPredModeSubParts(PredMode eMode, uint32_t absPartIdx, uint32_t depth);
 
-    UChar*        getWidth()                     { return m_width; }
+    uint8_t*      getCUSize()                     { return m_cuSize; }
 
-    UChar         getWidth(uint32_t idx)             { return m_width[idx]; }
-
-    UChar*        getHeight()                    { return m_height; }
-
-    UChar         getHeight(uint32_t idx)            { return m_height[idx]; }
+    uint8_t       getCUSize(uint32_t idx)            { return m_cuSize[idx]; }
 
     char*         getQP()                        { return m_qp; }
 
diff -r 01547efd182d -r 1e7709ecd0a0 source/Lib/TLibCommon/TComLoopFilter.cpp
--- a/source/Lib/TLibCommon/TComLoopFilter.cpp	Wed Mar 05 16:18:38 2014 -0600
+++ b/source/Lib/TLibCommon/TComLoopFilter.cpp	Thu Mar 06 11:01:59 2014 +0900
@@ -205,7 +205,7 @@
     for (uint32_t partIdx = absZOrderIdx; partIdx < absZOrderIdx + curNumParts; partIdx++)
     {
         uint32_t bsCheck;
-        if ((g_maxCUWidth >> g_maxCUDepth) == 4)
+        if ((g_maxCUSize >> g_maxCUDepth) == 4)
         {
             bsCheck = (dir == EDGE_VER && partIdx % 2 == 0) || (dir == EDGE_HOR && (partIdx - ((partIdx >> 2) << 2)) / 2 == 0);
         }
@@ -220,7 +220,7 @@
         }
     }
 
-    uint32_t pelsInPart = g_maxCUWidth >> g_maxCUDepth;
+    uint32_t pelsInPart = g_maxCUSize >> g_maxCUDepth;
     uint32_t partIdxIncr = DEBLOCK_SMALLEST_BLOCK / pelsInPart ? DEBLOCK_SMALLEST_BLOCK / pelsInPart : 1;
 
     uint32_t sizeInPU = pic->getNumPartInWidth() >> (depth);
@@ -275,11 +275,11 @@
         return;
     }
 
-    int trWidth  = cu->getWidth(absZOrderIdx) >> cu->getTransformIdx(absZOrderIdx);
-    int trHeight = cu->getHeight(absZOrderIdx) >> cu->getTransformIdx(absZOrderIdx);
+    int trWidth  = cu->getCUSize(absZOrderIdx) >> cu->getTransformIdx(absZOrderIdx);
+    int trHeight = cu->getCUSize(absZOrderIdx) >> cu->getTransformIdx(absZOrderIdx);
 
-    uint32_t widthInBaseUnits  = trWidth / (g_maxCUWidth >> g_maxCUDepth);
-    uint32_t heightInBaseUnits = trHeight / (g_maxCUWidth >> g_maxCUDepth);
+    uint32_t widthInBaseUnits  = trWidth / (g_maxCUSize >> g_maxCUDepth);
+    uint32_t heightInBaseUnits = trHeight / (g_maxCUSize >> g_maxCUDepth);
 
     xSetEdgefilterMultiple(cu, absTUPartIdx, depth, EDGE_VER, 0, true, widthInBaseUnits, heightInBaseUnits);
     xSetEdgefilterMultiple(cu, absTUPartIdx, depth, EDGE_HOR, 0, true, widthInBaseUnits, heightInBaseUnits);
@@ -531,7 +531,7 @@
     int qpQ = 0;
     uint32_t numParts = cu->getPic()->getNumPartInWidth() >> depth;
 
-    uint32_t pelsInPart = g_maxCUWidth >> g_maxCUDepth;
+    uint32_t pelsInPart = g_maxCUSize >> g_maxCUDepth;
     uint32_t bsAbsIdx = 0, bs = 0;
     int  offset, srcStep;
 
@@ -640,7 +640,7 @@
     int qp = 0;
     int qpP = 0;
     int qpQ = 0;
-    uint32_t  pelsInPartChroma = g_maxCUWidth >> (g_maxCUDepth + cu->getHorzChromaShift());
+    uint32_t  pelsInPartChroma = g_maxCUSize >> (g_maxCUDepth + cu->getHorzChromaShift());
     int   offset, srcStep;
 
     const uint32_t lcuWidthInBaseUnits = cu->getPic()->getNumPartInWidth();
diff -r 01547efd182d -r 1e7709ecd0a0 source/Lib/TLibCommon/TComPattern.cpp
--- a/source/Lib/TLibCommon/TComPattern.cpp	Wed Mar 05 16:18:38 2014 -0600
+++ b/source/Lib/TLibCommon/TComPattern.cpp	Thu Mar 06 11:01:59 2014 +0900
@@ -53,8 +53,8 @@
 {
     pixel* roiOrigin;
     pixel* adiTemp;
-    uint32_t cuWidth = cu->getWidth(0) >> partDepth;
-    uint32_t cuHeight = cu->getHeight(0) >> partDepth;
+    uint32_t cuWidth = cu->getCUSize(0) >> partDepth;
+    uint32_t cuHeight = cu->getCUSize(0) >> partDepth;
     uint32_t cuWidth2  = cuWidth << 1;
     uint32_t cuHeight2 = cuHeight << 1;
     uint32_t width;
@@ -71,7 +71,7 @@
     cu->deriveLeftRightTopIdxAdi(partIdxLT, partIdxRT, zOrderIdxInPart, partDepth);
     cu->deriveLeftBottomIdxAdi(partIdxLB,              zOrderIdxInPart, partDepth);
 
-    unitSize      = g_maxCUWidth >> g_maxCUDepth;
+    unitSize      = g_maxCUSize >> g_maxCUDepth;
     numUnitsInCU  = cuWidth / unitSize;
     totalUnits    = (numUnitsInCU << 2) + 1;
 
@@ -183,8 +183,8 @@
                                  pixel* refAbove, pixel* refLeft, pixel* refAboveFlt, pixel* refLeftFlt)
 {
     initAdiPattern(cu, zOrderIdxInPart, partDepth, adiBuf, strideOrig, heightOrig);
-    uint32_t cuWidth   = cu->getWidth(0) >> partDepth;
-    uint32_t cuHeight  = cu->getHeight(0) >> partDepth;
+    uint32_t cuWidth   = cu->getCUSize(0) >> partDepth;
+    uint32_t cuHeight  = cu->getCUSize(0) >> partDepth;
     uint32_t cuWidth2  = cuWidth << 1;
     uint32_t cuHeight2 = cuHeight << 1;
 
@@ -208,8 +208,8 @@
 {
     pixel*  roiOrigin;
     pixel*  adiTemp;
-    uint32_t  cuWidth  = cu->getWidth(0) >> partDepth;
-    uint32_t  cuHeight = cu->getHeight(0) >> partDepth;
+    uint32_t  cuWidth  = cu->getCUSize(0) >> partDepth;
+    uint32_t  cuHeight = cu->getCUSize(0) >> partDepth;
     uint32_t  width;
     uint32_t  height;
     int   picStride = cu->getPic()->getCStride();
@@ -225,7 +225,7 @@
     cu->deriveLeftRightTopIdxAdi(partIdxLT, partIdxRT, zOrderIdxInPart, partDepth);
     cu->deriveLeftBottomIdxAdi(partIdxLB,              zOrderIdxInPart, partDepth);
 
-    unitSize      = (g_maxCUWidth >> g_maxCUDepth) >> cu->getHorzChromaShift(); // for chroma
+    unitSize      = (g_maxCUSize >> g_maxCUDepth) >> cu->getHorzChromaShift(); // for chroma
     numUnitsInCU  = (cuWidth / unitSize) >> cu->getHorzChromaShift();           // for chroma
     totalUnits    = (numUnitsInCU << 2) + 1;
 
diff -r 01547efd182d -r 1e7709ecd0a0 source/Lib/TLibCommon/TComPic.cpp
--- a/source/Lib/TLibCommon/TComPic.cpp	Wed Mar 05 16:18:38 2014 -0600
+++ b/source/Lib/TLibCommon/TComPic.cpp	Thu Mar 06 11:01:59 2014 +0900
@@ -101,9 +101,9 @@
         return false;
 
     bool ok = true;
-    ok &= m_picSym->create(cfg->param->sourceWidth, cfg->param->sourceHeight, cfg->param->internalCsp, g_maxCUWidth, g_maxCUHeight, g_maxCUDepth);
-    ok &= m_origPicYuv->create(cfg->param->sourceWidth, cfg->param->sourceHeight, cfg->param->internalCsp, g_maxCUWidth, g_maxCUHeight, g_maxCUDepth);
-    ok &= m_reconPicYuv->create(cfg->param->sourceWidth, cfg->param->sourceHeight, cfg->param->internalCsp, g_maxCUWidth, g_maxCUHeight, g_maxCUDepth);
+    ok &= m_picSym->create(cfg->param->sourceWidth, cfg->param->sourceHeight, cfg->param->internalCsp, g_maxCUSize, g_maxCUDepth);
+    ok &= m_origPicYuv->create(cfg->param->sourceWidth, cfg->param->sourceHeight, cfg->param->internalCsp, g_maxCUSize, g_maxCUSize, g_maxCUDepth);
+    ok &= m_reconPicYuv->create(cfg->param->sourceWidth, cfg->param->sourceHeight, cfg->param->internalCsp, g_maxCUSize, g_maxCUSize, g_maxCUDepth);
     ok &= m_lowres.create(m_origPicYuv, cfg->param->bframes, !!cfg->param->rc.aqMode);
 
     bool isVbv = cfg->param->rc.vbvBufferSize > 0 && cfg->param->rc.vbvMaxBitrate > 0;
diff -r 01547efd182d -r 1e7709ecd0a0 source/Lib/TLibCommon/TComPic.h
--- a/source/Lib/TLibCommon/TComPic.h	Wed Mar 05 16:18:38 2014 -0600
+++ b/source/Lib/TLibCommon/TComPic.h	Thu Mar 06 11:01:59 2014 +0900
@@ -158,9 +158,7 @@
 
     uint32_t      getFrameHeightInCU()    { return m_picSym->getFrameHeightInCU(); }
 
-    uint32_t      getMinCUWidth()         { return m_picSym->getMinCUWidth(); }
-
-    uint32_t      getMinCUHeight()        { return m_picSym->getMinCUHeight(); }
+    uint32_t      getMinCUSize()          { return m_picSym->getMinCUSize(); }
 
     uint32_t      getParPelX(UChar partIdx) { return getParPelX(partIdx); }
 
diff -r 01547efd182d -r 1e7709ecd0a0 source/Lib/TLibCommon/TComPicSym.cpp
--- a/source/Lib/TLibCommon/TComPicSym.cpp	Wed Mar 05 16:18:38 2014 -0600
+++ b/source/Lib/TLibCommon/TComPicSym.cpp	Thu Mar 06 11:01:59 2014 +0900
@@ -50,10 +50,8 @@
 TComPicSym::TComPicSym()
     : m_widthInCU(0)
     , m_heightInCU(0)
-    , m_maxCUWidth(0)
-    , m_maxCUHeight(0)
-    , m_minCUWidth(0)
-    , m_minCUHeight(0)
+    , m_maxCUSize(0)
+    , m_minCUSize(0)
     , m_totalDepth(0)
     , m_numPartitions(0)
     , m_numPartInWidth(0)
@@ -63,7 +61,7 @@
     , m_cuData(NULL)
 {}
 
-bool TComPicSym::create(int picWidth, int picHeight, int picCsp, uint32_t maxWidth, uint32_t maxHeight, uint32_t maxDepth)
+bool TComPicSym::create(int picWidth, int picHeight, int picCsp, uint32_t maxCUSize, uint32_t maxDepth)
 {
     uint32_t i;
 
@@ -71,17 +69,15 @@
     m_totalDepth      = maxDepth;
     m_numPartitions   = 1 << (m_totalDepth << 1);
 
-    m_maxCUWidth      = maxWidth;
-    m_maxCUHeight     = maxHeight;
+    m_maxCUSize       = maxCUSize;
 
-    m_minCUWidth      = maxWidth  >> m_totalDepth;
-    m_minCUHeight     = maxHeight >> m_totalDepth;
+    m_minCUSize       = maxCUSize  >> m_totalDepth;
 
-    m_numPartInWidth  = m_maxCUWidth / m_minCUWidth;
-    m_numPartInHeight = m_maxCUHeight / m_minCUHeight;
+    m_numPartInWidth  = m_maxCUSize / m_minCUSize;
+    m_numPartInHeight = m_maxCUSize / m_minCUSize;
 
-    m_widthInCU       = (picWidth % m_maxCUWidth) ? picWidth / m_maxCUWidth  + 1 : picWidth / m_maxCUWidth;
-    m_heightInCU      = (picHeight % m_maxCUHeight) ? picHeight / m_maxCUHeight + 1 : picHeight / m_maxCUHeight;
+    m_widthInCU       = (picWidth % m_maxCUSize) ? picWidth / m_maxCUSize  + 1 : picWidth / m_maxCUSize;
+    m_heightInCU      = (picHeight % m_maxCUSize) ? picHeight / m_maxCUSize + 1 : picHeight / m_maxCUSize;
 
     m_numCUsInFrame   = m_widthInCU * m_heightInCU;
 
@@ -95,7 +91,7 @@
         m_cuData[i] = new TComDataCU;
         if (!m_cuData[i])
             return false;
-        if (!m_cuData[i]->create(m_numPartitions, m_maxCUWidth, m_maxCUHeight, m_maxCUWidth >> m_totalDepth, picCsp))
+        if (!m_cuData[i]->create(m_numPartitions, m_maxCUSize, m_maxCUSize, m_maxCUSize >> m_totalDepth, picCsp))
             return false;
     }
 
diff -r 01547efd182d -r 1e7709ecd0a0 source/Lib/TLibCommon/TComPicSym.h
--- a/source/Lib/TLibCommon/TComPicSym.h	Wed Mar 05 16:18:38 2014 -0600
+++ b/source/Lib/TLibCommon/TComPicSym.h	Thu Mar 06 11:01:59 2014 +0900
@@ -64,10 +64,8 @@
     uint32_t      m_widthInCU;
     uint32_t      m_heightInCU;
 
-    uint32_t      m_maxCUWidth;
-    uint32_t      m_maxCUHeight;
-    uint32_t      m_minCUWidth;
-    uint32_t      m_minCUHeight;
+    uint32_t      m_maxCUSize;
+    uint32_t      m_minCUSize;
 
     UChar         m_totalDepth;
     uint32_t      m_numPartitions;
@@ -82,7 +80,7 @@
 
 public:
 
-    bool        create(int picWidth, int picHeight, int picCsp, uint32_t maxWidth, uint32_t maxHeight, uint32_t maxDepth);
+    bool        create(int picWidth, int picHeight, int picCsp, uint32_t maxCUSize, uint32_t maxDepth);
     void        destroy();
 
     TComPicSym();
@@ -93,9 +91,7 @@
 
     uint32_t    getFrameHeightInCU()      { return m_heightInCU; }
 
-    uint32_t    getMinCUWidth()           { return m_minCUWidth; }
-
-    uint32_t    getMinCUHeight()          { return m_minCUHeight; }
+    uint32_t    getMinCUSize()            { return m_minCUSize; }
 
     uint32_t    getNumberOfCUsInFrame()   { return m_numCUsInFrame; }
 
diff -r 01547efd182d -r 1e7709ecd0a0 source/Lib/TLibCommon/TComPicYuv.cpp
--- a/source/Lib/TLibCommon/TComPicYuv.cpp	Wed Mar 05 16:18:38 2014 -0600
+++ b/source/Lib/TLibCommon/TComPicYuv.cpp	Thu Mar 06 11:01:59 2014 +0900
@@ -83,15 +83,15 @@
     m_numCuInWidth = (m_picWidth + m_cuWidth - 1)  / m_cuWidth;
     m_numCuInHeight = (m_picHeight + m_cuHeight - 1) / m_cuHeight;
 
-    m_lumaMarginX = g_maxCUWidth  + 32; // search margin and 8-tap filter half-length, padded for 32-byte alignment
-    m_lumaMarginY = g_maxCUHeight + 16; // margin for 8-tap filter and infinite padding
-    m_stride = (m_numCuInWidth * g_maxCUWidth) + (m_lumaMarginX << 1);
+    m_lumaMarginX = g_maxCUSize + 32; // search margin and 8-tap filter half-length, padded for 32-byte alignment
+    m_lumaMarginY = g_maxCUSize + 16; // margin for 8-tap filter and infinite padding
+    m_stride = (m_numCuInWidth * g_maxCUSize) + (m_lumaMarginX << 1);
 
     m_chromaMarginX = m_lumaMarginX;    // keep 16-byte alignment for chroma CTUs
     m_chromaMarginY = m_lumaMarginY >> m_vChromaShift;
 
-    m_strideC = ((m_numCuInWidth * g_maxCUWidth) >> m_hChromaShift) + (m_chromaMarginX * 2);
-    int maxHeight = m_numCuInHeight * g_maxCUHeight;
+    m_strideC = ((m_numCuInWidth * g_maxCUSize) >> m_hChromaShift) + (m_chromaMarginX * 2);
+    int maxHeight = m_numCuInHeight * g_maxCUSize;
 
     CHECKED_MALLOC(m_picBufY, pixel, m_stride * (maxHeight + (m_lumaMarginY * 2)));
     CHECKED_MALLOC(m_picBufU, pixel, m_strideC * ((maxHeight >> m_vChromaShift) + (m_chromaMarginY * 2)));
@@ -146,9 +146,9 @@
     uint32_t height;
 
     if (rowNum == m_numCuInHeight - 1)
-        height = ((getHeight() % g_maxCUHeight) ? (getHeight() % g_maxCUHeight) : g_maxCUHeight);
+        height = ((getHeight() % g_maxCUSize) ? (getHeight() % g_maxCUSize) : g_maxCUSize);
     else
-        height = g_maxCUHeight;
+        height = g_maxCUSize;
     return height;
 }
 
diff -r 01547efd182d -r 1e7709ecd0a0 source/Lib/TLibCommon/TComRom.cpp
--- a/source/Lib/TLibCommon/TComRom.cpp	Wed Mar 05 16:18:38 2014 -0600
+++ b/source/Lib/TLibCommon/TComRom.cpp	Thu Mar 06 11:01:59 2014 +0900
@@ -227,8 +227,7 @@
 // Data structure related table & variable
 // ====================================================================================================================
 
-uint32_t g_maxCUWidth  = MAX_CU_SIZE;
-uint32_t g_maxCUHeight = MAX_CU_SIZE;
+uint32_t g_maxCUSize   = MAX_CU_SIZE;
 uint32_t g_maxCUDepth  = MAX_CU_DEPTH;
 uint32_t g_addCUDepth  = 0;
 uint32_t g_zscanToRaster[MAX_NUM_SPU_W * MAX_NUM_SPU_W] = { 0, };
diff -r 01547efd182d -r 1e7709ecd0a0 source/Lib/TLibCommon/TComRom.h
--- a/source/Lib/TLibCommon/TComRom.h	Wed Mar 05 16:18:38 2014 -0600
+++ b/source/Lib/TLibCommon/TComRom.h	Thu Mar 06 11:01:59 2014 +0900
@@ -89,8 +89,7 @@
 void initRasterToPelXY(uint32_t maxCUWidth, uint32_t maxCUHeight, uint32_t maxCUDepth);
 
 // global variable (LCU width/height, max. CU depth)
-extern uint32_t g_maxCUWidth;
-extern uint32_t g_maxCUHeight;
+extern uint32_t g_maxCUSize;
 extern uint32_t g_maxCUDepth;
 extern uint32_t g_addCUDepth;
 
diff -r 01547efd182d -r 1e7709ecd0a0 source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp
--- a/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp	Wed Mar 05 16:18:38 2014 -0600
+++ b/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp	Thu Mar 06 11:01:59 2014 +0900
@@ -1371,7 +1371,7 @@
     uint32_t height;
     uint32_t pcmLeftShiftBit;
     uint32_t x, y;
-    uint32_t minCoeffSize = cu->getPic()->getMinCUWidth() * cu->getPic()->getMinCUHeight();
+    uint32_t minCoeffSize = cu->getPic()->getMinCUSize() * cu->getPic()->getMinCUSize();
     uint32_t lumaOffset   = minCoeffSize * absZOrderIdx;
     uint32_t chromaOffset = lumaOffset >> 2;
 
@@ -1380,8 +1380,8 @@
         src = pcPicYuvRec->getLumaAddr(cu->getAddr(), absZOrderIdx);
         pcm = cu->getPCMSampleY() + lumaOffset;
         stride  = pcPicYuvRec->getStride();
-        width  = (g_maxCUWidth >> depth);
-        height = (g_maxCUHeight >> depth);
+        width  = (g_maxCUSize >> depth);
+        height = (g_maxCUSize >> depth);
         if (cu->isLosslessCoded(absZOrderIdx) && !cu->getIPCMFlag(absZOrderIdx))
         {
             pcmLeftShiftBit = 0;
@@ -1405,8 +1405,8 @@
         }
 
         stride = pcPicYuvRec->getCStride();
-        width  = ((g_maxCUWidth >> depth) / 2);
-        height = ((g_maxCUWidth >> depth) / 2);
+        width  = ((g_maxCUSize >> depth) / 2);
+        height = ((g_maxCUSize >> depth) / 2);
         if (cu->isLosslessCoded(absZOrderIdx) && !cu->getIPCMFlag(absZOrderIdx))
         {
             pcmLeftShiftBit = 0;
diff -r 01547efd182d -r 1e7709ecd0a0 source/Lib/TLibCommon/TComSlice.cpp
--- a/source/Lib/TLibCommon/TComSlice.cpp	Wed Mar 05 16:18:38 2014 -0600
+++ b/source/Lib/TLibCommon/TComSlice.cpp	Thu Mar 06 11:01:59 2014 +0900
@@ -543,8 +543,7 @@
     , m_picHeightInLumaSamples(288)
     , m_log2MinCodingBlockSize(0)
     , m_log2DiffMaxMinCodingBlockSize(0)
-    , m_maxCUWidth(32)
-    , m_maxCUHeight(32)
+    , m_maxCUSize(32)
     , m_maxCUDepth(3)
     , m_bLongTermRefsPresent(false)
     , m_quadtreeTULog2MaxSize(0)
diff -r 01547efd182d -r 1e7709ecd0a0 source/Lib/TLibCommon/TComSlice.h
--- a/source/Lib/TLibCommon/TComSlice.h	Wed Mar 05 16:18:38 2014 -0600
+++ b/source/Lib/TLibCommon/TComSlice.h	Thu Mar 06 11:01:59 2014 +0900
@@ -793,8 +793,7 @@
 
     int         m_log2MinCodingBlockSize;
     int         m_log2DiffMaxMinCodingBlockSize;
-    uint32_t    m_maxCUWidth;
-    uint32_t    m_maxCUHeight;
+    uint32_t    m_maxCUSize;
     uint32_t    m_maxCUDepth;
 
     Window      m_conformanceWindow;
@@ -910,13 +909,9 @@
 
     void setLog2DiffMaxMinCodingBlockSize(int val) { m_log2DiffMaxMinCodingBlockSize = val; }
 
-    void setMaxCUWidth(uint32_t u) { m_maxCUWidth = u; }
+    void setMaxCUSize(uint32_t u) { m_maxCUSize = u; }
 
-    uint32_t getMaxCUWidth() const  { return m_maxCUWidth; }
-
-    void setMaxCUHeight(uint32_t u) { m_maxCUHeight = u; }
-
-    uint32_t getMaxCUHeight() const { return m_maxCUHeight; }
+    uint32_t getMaxCUSize() const  { return m_maxCUSize; }
 
     void setMaxCUDepth(uint32_t u) { m_maxCUDepth = u; }
 
diff -r 01547efd182d -r 1e7709ecd0a0 source/Lib/TLibEncoder/TEncCu.cpp
--- a/source/Lib/TLibEncoder/TEncCu.cpp	Wed Mar 05 16:18:38 2014 -0600
+++ b/source/Lib/TLibEncoder/TEncCu.cpp	Thu Mar 06 11:01:59 2014 +0900
@@ -507,7 +507,7 @@
         bTestMergeAMP_Ver = true;
     }
 
-    if (outBestCU->getWidth(0) == 64)
+    if (outBestCU->getCUSize(0) == 64)
     {
         bTestAMP_Hor = false;
         bTestAMP_Ver = false;
@@ -551,9 +551,9 @@
     bool bBoundary = false;
 
     uint32_t lpelx = outBestCU->getCUPelX();
-    uint32_t rpelx = lpelx + outBestCU->getWidth(0)  - 1;
+    uint32_t rpelx = lpelx + outBestCU->getCUSize(0) - 1;
     uint32_t tpelx = outBestCU->getCUPelY();
-    uint32_t bpely = tpelx + outBestCU->getHeight(0) - 1;
+    uint32_t bpely = tpelx + outBestCU->getCUSize(0) - 1;
     int qp = outTempCU->getQP(0);
 
     // If slice start or slice end is within this cu...
@@ -576,7 +576,7 @@
 
         if (depth == g_maxCUDepth - g_addCUDepth)
         {
-            if (outTempCU->getWidth(0) > (1 << outTempCU->getSlice()->getSPS()->getQuadtreeTULog2MinSize()))
+            if (outTempCU->getCUSize(0) > (1 << outTempCU->getSlice()->getSPS()->getQuadtreeTULog2MinSize()))
             {
                 xCheckRDCostIntra(outBestCU, outTempCU, SIZE_NxN);
             }
@@ -643,7 +643,7 @@
         }
         outTempCU->m_totalCost = m_rdCost->calcRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits);
 
-        if ((g_maxCUWidth >> depth) == outTempCU->getSlice()->getPPS()->getMinCuDQPSize() && outTempCU->getSlice()->getPPS()->getUseDQP())
+        if ((g_maxCUSize >> depth) == outTempCU->getSlice()->getPPS()->getMinCuDQPSize() && outTempCU->getSlice()->getPPS()->getUseDQP())
         {
             bool hasResidual = false;
             for (uint32_t uiBlkIdx = 0; uiBlkIdx < outTempCU->getTotalNumPart(); uiBlkIdx++)
@@ -712,9 +712,9 @@
 
     bool bBoundary = false;
     uint32_t lpelx = outBestCU->getCUPelX();
-    uint32_t rpelx = lpelx + outBestCU->getWidth(0)  - 1;
+    uint32_t rpelx = lpelx + outBestCU->getCUSize(0) - 1;
     uint32_t tpely = outBestCU->getCUPelY();
-    uint32_t bpely = tpely + outBestCU->getHeight(0) - 1;
+    uint32_t bpely = tpely + outBestCU->getCUSize(0) - 1;
 
     int qp = outTempCU->getQP(0);
 
@@ -764,7 +764,7 @@
             if (outBestCU->getSlice()->getSliceType() != I_SLICE)
             {
                 // 2Nx2N, NxN
-                if (!((outBestCU->getWidth(0) == 8) && (outBestCU->getHeight(0) == 8)))
+                if (!(outBestCU->getCUSize(0) == 8))
                 {
                     if (depth == g_maxCUDepth - g_addCUDepth && doNotBlockPu)
                     {
@@ -898,7 +898,7 @@
 
                 if (depth == g_maxCUDepth - g_addCUDepth)
                 {
-                    if (outTempCU->getWidth(0) > (1 << outTempCU->getSlice()->getSPS()->getQuadtreeTULog2MinSize()))
+                    if (outTempCU->getCUSize(0) > (1 << outTempCU->getSlice()->getSPS()->getQuadtreeTULog2MinSize()))
                     {
                         xCheckRDCostIntraInInter(outBestCU, outTempCU, SIZE_NxN);
                         outTempCU->initEstData(depth, qp);
@@ -907,10 +907,10 @@
             }
             // test PCM
             if (pic->getSlice()->getSPS()->getUsePCM()
-                && outTempCU->getWidth(0) <= (1 << pic->getSlice()->getSPS()->getPCMLog2MaxSize())
-                && outTempCU->getWidth(0) >= (1 << pic->getSlice()->getSPS()->getPCMLog2MinSize()))
+                && outTempCU->getCUSize(0) <= (1 << pic->getSlice()->getSPS()->getPCMLog2MaxSize())
+                && outTempCU->getCUSize(0) >= (1 << pic->getSlice()->getSPS()->getPCMLog2MinSize()))
             {
-                uint32_t rawbits = (2 * X265_DEPTH + X265_DEPTH) * outBestCU->getWidth(0) * outBestCU->getHeight(0) / 2;
+                uint32_t rawbits = (2 * X265_DEPTH + X265_DEPTH) * outBestCU->getCUSize(0) * outBestCU->getCUSize(0) / 2;
                 uint32_t bestbits = outBestCU->m_totalBits;
                 if ((bestbits > rawbits) || (outBestCU->m_totalCost > m_rdCost->calcRdCost(0, rawbits)))
                 {
@@ -988,7 +988,7 @@
         }
         outTempCU->m_totalCost = m_rdCost->calcRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits);
 
-        if ((g_maxCUWidth >> depth) == outTempCU->getSlice()->getPPS()->getMinCuDQPSize() && outTempCU->getSlice()->getPPS()->getUseDQP())
+        if ((g_maxCUSize >> depth) == outTempCU->getSlice()->getPPS()->getMinCuDQPSize() && outTempCU->getSlice()->getPPS()->getUseDQP())
         {
             bool hasResidual = false;
             for (uint32_t blkIdx = 0; blkIdx < outTempCU->getTotalNumPart(); blkIdx++)
@@ -1047,16 +1047,16 @@
 
     uint32_t internalAddress = (slice->getSliceCurEndCUAddr() - 1) % pic->getNumPartInCU();
     uint32_t externalAddress = (slice->getSliceCurEndCUAddr() - 1) / pic->getNumPartInCU();
-    uint32_t posx = (externalAddress % pic->getFrameWidthInCU()) * g_maxCUWidth + g_rasterToPelX[g_zscanToRaster[internalAddress]];
-    uint32_t posy = (externalAddress / pic->getFrameWidthInCU()) * g_maxCUHeight + g_rasterToPelY[g_zscanToRaster[internalAddress]];
+    uint32_t posx = (externalAddress % pic->getFrameWidthInCU()) * g_maxCUSize + g_rasterToPelX[g_zscanToRaster[internalAddress]];
+    uint32_t posy = (externalAddress / pic->getFrameWidthInCU()) * g_maxCUSize + g_rasterToPelY[g_zscanToRaster[internalAddress]];
     uint32_t width = slice->getSPS()->getPicWidthInLumaSamples();
     uint32_t height = slice->getSPS()->getPicHeightInLumaSamples();
 
     while (posx >= width || posy >= height)
     {
         internalAddress--;
-        posx = (externalAddress % pic->getFrameWidthInCU()) * g_maxCUWidth + g_rasterToPelX[g_zscanToRaster[internalAddress]];
-        posy = (externalAddress / pic->getFrameWidthInCU()) * g_maxCUHeight + g_rasterToPelY[g_zscanToRaster[internalAddress]];
+        posx = (externalAddress % pic->getFrameWidthInCU()) * g_maxCUSize + g_rasterToPelX[g_zscanToRaster[internalAddress]];
+        posy = (externalAddress / pic->getFrameWidthInCU()) * g_maxCUSize + g_rasterToPelY[g_zscanToRaster[internalAddress]];
     }
 
     internalAddress++;
@@ -1073,11 +1073,11 @@
     {
         bTerminateSlice = true;
     }
-    uint32_t uiGranularityWidth = g_maxCUWidth;
+    uint32_t uiGranularityWidth = g_maxCUSize;
     posx = cu->getCUPelX() + g_rasterToPelX[g_zscanToRaster[absPartIdx]];
     posy = cu->getCUPelY() + g_rasterToPelY[g_zscanToRaster[absPartIdx]];
-    bool granularityBoundary = ((posx + cu->getWidth(absPartIdx)) % uiGranularityWidth == 0 || (posx + cu->getWidth(absPartIdx) == width))
-        && ((posy + cu->getHeight(absPartIdx)) % uiGranularityWidth == 0 || (posy + cu->getHeight(absPartIdx) == height));
+    bool granularityBoundary = ((posx + cu->getCUSize(absPartIdx)) % uiGranularityWidth == 0 || (posx + cu->getCUSize(absPartIdx) == width))
+        && ((posy + cu->getCUSize(absPartIdx)) % uiGranularityWidth == 0 || (posy + cu->getCUSize(absPartIdx) == height));
 
     if (granularityBoundary)
     {
@@ -1126,9 +1126,9 @@
 
     bool bBoundary = false;
     uint32_t lpelx = cu->getCUPelX() + g_rasterToPelX[g_zscanToRaster[absPartIdx]];
-    uint32_t rpelx = lpelx + (g_maxCUWidth >> depth)  - 1;
+    uint32_t rpelx = lpelx + (g_maxCUSize >> depth) - 1;
     uint32_t tpely = cu->getCUPelY() + g_rasterToPelY[g_zscanToRaster[absPartIdx]];
-    uint32_t bpely = tpely + (g_maxCUHeight >> depth) - 1;
+    uint32_t bpely = tpely + (g_maxCUSize >> depth) - 1;
 
     TComSlice* slice = cu->getPic()->getSlice();
 
@@ -1147,7 +1147,7 @@
     if (((depth < cu->getDepth(absPartIdx)) && (depth < (g_maxCUDepth - g_addCUDepth))) || bBoundary)
     {
         uint32_t qNumParts = (pic->getNumPartInCU() >> (depth << 1)) >> 2;
-        if ((g_maxCUWidth >> depth) == cu->getSlice()->getPPS()->getMinCuDQPSize() && cu->getSlice()->getPPS()->getUseDQP())
+        if ((g_maxCUSize >> depth) == cu->getSlice()->getPPS()->getMinCuDQPSize() && cu->getSlice()->getPPS()->getUseDQP())
         {
             setdQPFlag(true);
         }
@@ -1165,7 +1165,7 @@
         return;
     }
 
-    if ((g_maxCUWidth >> depth) >= cu->getSlice()->getPPS()->getMinCuDQPSize() && cu->getSlice()->getPPS()->getUseDQP())
+    if ((g_maxCUSize >> depth) >= cu->getSlice()->getPPS()->getMinCuDQPSize() && cu->getSlice()->getPPS()->getUseDQP())
     {
         setdQPFlag(true);
     }
@@ -1205,7 +1205,7 @@
 
     // Encode Coefficients
     bool bCodeDQP = getdQPFlag();
-    m_entropyCoder->encodeCoeff(cu, absPartIdx, depth, cu->getWidth(absPartIdx), cu->getHeight(absPartIdx), bCodeDQP);
+    m_entropyCoder->encodeCoeff(cu, absPartIdx, depth, cu->getCUSize(absPartIdx), cu->getCUSize(absPartIdx), bCodeDQP);
     setdQPFlag(bCodeDQP);
 
     // --- write terminating bit ---
@@ -1404,7 +1404,7 @@
 
     // Encode Coefficients
     bool bCodeDQP = getdQPFlag();
-    m_entropyCoder->encodeCoeff(outTempCU, 0, depth, outTempCU->getWidth(0), outTempCU->getHeight(0), bCodeDQP);
+    m_entropyCoder->encodeCoeff(outTempCU, 0, depth, outTempCU->getCUSize(0), outTempCU->getCUSize(0), bCodeDQP);
     setdQPFlag(bCodeDQP);
 
     m_rdGoOnSbacCoder->store(m_rdSbacCoders[depth][CI_TEMP_BEST]);
@@ -1451,7 +1451,7 @@
 
     // Encode Coefficients
     bool bCodeDQP = getdQPFlag();
-    m_entropyCoder->encodeCoeff(outTempCU, 0, depth, outTempCU->getWidth(0), outTempCU->getHeight(0), bCodeDQP);
+    m_entropyCoder->encodeCoeff(outTempCU, 0, depth, outTempCU->getCUSize(0), outTempCU->getCUSize(0), bCodeDQP);
     setdQPFlag(bCodeDQP);
 
     m_rdGoOnSbacCoder->store(m_rdSbacCoders[depth][CI_TEMP_BEST]);
@@ -1540,7 +1540,7 @@
 {
     uint32_t depth = cu->getDepth(0);
 
-    if (cu->getSlice()->getPPS()->getUseDQP() && (g_maxCUWidth >> depth) >= cu->getSlice()->getPPS()->getMinCuDQPSize())
+    if (cu->getSlice()->getPPS()->getUseDQP() && (g_maxCUSize >> depth) >= cu->getSlice()->getPPS()->getMinCuDQPSize())
     {
         if (!cu->getCbf(0, TEXT_LUMA, 0) && !cu->getCbf(0, TEXT_CHROMA_U, 0) && !cu->getCbf(0, TEXT_CHROMA_V, 0))
             cu->setQPSubParts(cu->getRefQP(0), 0, depth); // set QP to default QP
@@ -1549,8 +1549,8 @@
 
 void TEncCu::xCopyYuv2Pic(TComPic* outPic, uint32_t cuAddr, uint32_t absPartIdx, uint32_t depth, uint32_t srcDepth, TComDataCU* cu, uint32_t lpelx, uint32_t tpely)
 {
-    uint32_t rpelx = lpelx + (g_maxCUWidth >> depth)  - 1;
-    uint32_t bpely = tpely + (g_maxCUHeight >> depth) - 1;
+    uint32_t rpelx = lpelx + (g_maxCUSize >> depth) - 1;
+    uint32_t bpely = tpely + (g_maxCUSize >> depth) - 1;
     TComSlice* slice = cu->getPic()->getSlice();
     bool bSliceEnd = slice->getSliceCurEndCUAddr() > (cu->getAddr()) * cu->getPic()->getNumPartInCU() + absPartIdx &&
         slice->getSliceCurEndCUAddr() < (cu->getAddr()) * cu->getPic()->getNumPartInCU() + absPartIdx + (cu->getPic()->getNumPartInCU() >> (depth << 1));
@@ -1571,8 +1571,8 @@
 
         for (uint32_t partUnitIdx = 0; partUnitIdx < 4; partUnitIdx++, absPartIdx += qNumParts)
         {
-            uint32_t subCULPelX = lpelx + (g_maxCUWidth >> (depth + 1)) * (partUnitIdx &  1);
-            uint32_t subCUTPelY = tpely + (g_maxCUHeight >> (depth + 1)) * (partUnitIdx >> 1);
+            uint32_t subCULPelX = lpelx + (g_maxCUSize >> (depth + 1)) * (partUnitIdx &  1);
+            uint32_t subCUTPelY = tpely + (g_maxCUSize >> (depth + 1)) * (partUnitIdx >> 1);
 
             bool bInSlice = cu->getAddr() * cu->getPic()->getNumPartInCU() + absPartIdx < slice->getSliceCurEndCUAddr();
             if (bInSlice && (subCULPelX < slice->getSPS()->getPicWidthInLumaSamples()) && (subCUTPelY < slice->getSPS()->getPicHeightInLumaSamples()))
@@ -1595,8 +1595,8 @@
  */
 void TEncCu::xFillPCMBuffer(TComDataCU* cu, TComYuv* fencYuv)
 {
-    uint32_t width = cu->getWidth(0);
-    uint32_t height = cu->getHeight(0);
+    uint32_t width = cu->getCUSize(0);
+    uint32_t height = cu->getCUSize(0);
 
     Pel* srcY = fencYuv->getLumaAddr(0, width);
     Pel* dstY = cu->getPCMSampleY();
diff -r 01547efd182d -r 1e7709ecd0a0 source/Lib/TLibEncoder/TEncEntropy.cpp
--- a/source/Lib/TLibEncoder/TEncEntropy.cpp	Wed Mar 05 16:18:38 2014 -0600
+++ b/source/Lib/TLibEncoder/TEncEntropy.cpp	Thu Mar 06 11:01:59 2014 +0900
@@ -199,8 +199,8 @@
 void TEncEntropy::encodeIPCMInfo(TComDataCU* cu, uint32_t absPartIdx, bool bRD)
 {
     if (!cu->getSlice()->getSPS()->getUsePCM()
-        || cu->getWidth(absPartIdx) > (1 << cu->getSlice()->getSPS()->getPCMLog2MaxSize())
-        || cu->getWidth(absPartIdx) < (1 << cu->getSlice()->getSPS()->getPCMLog2MinSize()))
+        || cu->getCUSize(absPartIdx) > (1 << cu->getSlice()->getSPS()->getPCMLog2MaxSize())
+        || cu->getCUSize(absPartIdx) < (1 << cu->getSlice()->getSPS()->getPCMLog2MinSize()))
     {
         return;
     }
@@ -216,7 +216,7 @@
 void TEncEntropy::xEncodeTransform(TComDataCU* cu, uint32_t offsetLuma, uint32_t offsetChroma, uint32_t absPartIdx, uint32_t depth, uint32_t width, uint32_t height, uint32_t trIdx, bool& bCodeDQP)
 {
     const uint32_t subdiv = cu->getTransformIdx(absPartIdx) + cu->getDepth(absPartIdx) > depth;
-    const uint32_t log2TrafoSize = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUWidth()] + 2 - depth;
+    const uint32_t log2TrafoSize = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize()] + 2 - depth;
     uint32_t cbfY = cu->getCbf(absPartIdx, TEXT_LUMA, trIdx);
     uint32_t cbfU = cu->getCbf(absPartIdx, TEXT_CHROMA_U, trIdx);
     uint32_t cbfV = cu->getCbf(absPartIdx, TEXT_CHROMA_V, trIdx);
@@ -597,7 +597,7 @@
  */
 void TEncEntropy::encodeCoeff(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, uint32_t width, uint32_t height, bool& bCodeDQP)
 {
-    uint32_t minCoeffSize = cu->getPic()->getMinCUWidth() * cu->getPic()->getMinCUHeight();
+    uint32_t minCoeffSize = cu->getPic()->getMinCUSize() * cu->getPic()->getMinCUSize();
     uint32_t lumaOffset   = minCoeffSize * absPartIdx;
     uint32_t chromaOffset = lumaOffset >> (cu->getHorzChromaShift() + cu->getVertChromaShift());
 
diff -r 01547efd182d -r 1e7709ecd0a0 source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp
--- a/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp	Wed Mar 05 16:18:38 2014 -0600
+++ b/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp	Thu Mar 06 11:01:59 2014 +0900
@@ -553,8 +553,8 @@
     pixel* fenc;
     pixel* pRec;
     int stride;
-    int iLcuHeight = pTmpSPS->getMaxCUHeight();
-    int iLcuWidth  = pTmpSPS->getMaxCUWidth();
+    int iLcuHeight = pTmpSPS->getMaxCUSize();
+    int iLcuWidth  = pTmpSPS->getMaxCUSize();
     uint32_t lpelx   = pTmpCu->getCUPelX();
     uint32_t tpely   = pTmpCu->getCUPelY();
     uint32_t rpelx;
@@ -854,8 +854,8 @@
     {
         for (idxX = 0; idxX < frameWidthInCU; idxX++)
         {
-            lcuHeight = pTmpSPS->getMaxCUHeight();
-            lcuWidth  = pTmpSPS->getMaxCUWidth();
+            lcuHeight = pTmpSPS->getMaxCUSize();
+            lcuWidth  = pTmpSPS->getMaxCUSize();
             addr     = idxX  + frameWidthInCU * idxY;
             pTmpCu = pic->getCU(addr);
             lPelX   = pTmpCu->getCUPelX();
diff -r 01547efd182d -r 1e7709ecd0a0 source/Lib/TLibEncoder/TEncSbac.cpp
--- a/source/Lib/TLibEncoder/TEncSbac.cpp	Wed Mar 05 16:18:38 2014 -0600
+++ b/source/Lib/TLibEncoder/TEncSbac.cpp	Thu Mar 06 11:01:59 2014 +0900
@@ -463,8 +463,6 @@
         }
     }
 
-    assert(sps->getMaxCUWidth() == sps->getMaxCUHeight());
-
     WRITE_UVLC(sps->getLog2MinCodingBlockSize() - 3,    "log2_min_coding_block_size_minus3");
     WRITE_UVLC(sps->getLog2DiffMaxMinCodingBlockSize(), "log2_diff_max_min_coding_block_size");
     WRITE_UVLC(sps->getQuadtreeTULog2MinSize() - 2,     "log2_min_transform_block_size_minus2");
@@ -1486,7 +1484,7 @@
     case SIZE_nRx2N:
         m_binIf->encodeBin(0, m_contextModels[OFF_PART_SIZE_CTX + 0]);
         m_binIf->encodeBin(0, m_contextModels[OFF_PART_SIZE_CTX + 1]);
-        if (depth == g_maxCUDepth - g_addCUDepth && !(cu->getWidth(absPartIdx) == 8))
+        if (depth == g_maxCUDepth - g_addCUDepth && !(cu->getCUSize(absPartIdx) == 8))
         {
             m_binIf->encodeBin(1, m_contextModels[OFF_PART_SIZE_CTX + 2]);
         }
@@ -1501,7 +1499,7 @@
         break;
 
     case SIZE_NxN:
-        if (depth == g_maxCUDepth - g_addCUDepth && !(cu->getWidth(absPartIdx) == 8))
+        if (depth == g_maxCUDepth - g_addCUDepth && !(cu->getCUSize(absPartIdx) == 8))
         {
             m_binIf->encodeBin(0, m_contextModels[OFF_PART_SIZE_CTX + 0]);
             m_binIf->encodeBin(0, m_contextModels[OFF_PART_SIZE_CTX + 1]);
@@ -1725,7 +1723,7 @@
     const uint32_t interDir = cu->getInterDir(absPartIdx) - 1;
     const uint32_t ctx      = cu->getCtxInterDir(absPartIdx);
 
-    if (cu->getPartitionSize(absPartIdx) == SIZE_2Nx2N || cu->getWidth(absPartIdx) != 8)
+    if (cu->getPartitionSize(absPartIdx) == SIZE_2Nx2N || cu->getCUSize(absPartIdx) != 8)
     {
         m_binIf->encodeBin(interDir == 2 ? 1 : 0, m_contextModels[OFF_INTER_DIR_CTX + ctx]);
     }
@@ -1894,7 +1892,7 @@
     {
         m_binIf->encodePCMAlignBits();
 
-        uint32_t minCoeffSize = cu->getPic()->getMinCUWidth() * cu->getPic()->getMinCUHeight();
+        uint32_t minCoeffSize = cu->getPic()->getMinCUSize() * cu->getPic()->getMinCUSize();
         uint32_t lumaOffset   = minCoeffSize * absPartIdx;
         uint32_t chromaOffset = lumaOffset >> 2;
         uint32_t width;
@@ -1903,8 +1901,8 @@
         uint32_t x, y;
 
         pixel *pcmSample = cu->getPCMSampleY() + lumaOffset;
-        width = cu->getWidth(absPartIdx);
-        height = cu->getHeight(absPartIdx);
+        width = cu->getCUSize(absPartIdx);
+        height = cu->getCUSize(absPartIdx);
         sampleBits = cu->getSlice()->getSPS()->getPCMBitDepthLuma();
 
         for (y = 0; y < height; y++)
@@ -1920,8 +1918,8 @@
         }
 
         pcmSample = cu->getPCMSampleCb() + chromaOffset;
-        width = cu->getWidth(absPartIdx) / 2;
-        height = cu->getHeight(absPartIdx) / 2;
+        width = cu->getCUSize(absPartIdx) / 2;
+        height = cu->getCUSize(absPartIdx) / 2;
         sampleBits = cu->getSlice()->getSPS()->getPCMBitDepthChroma();
 
         for (y = 0; y < height; y++)
diff -r 01547efd182d -r 1e7709ecd0a0 source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp	Wed Mar 05 16:18:38 2014 -0600
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp	Thu Mar 06 11:01:59 2014 +0900
@@ -139,9 +139,9 @@
     m_qtTempShortYuv = new ShortYuv[numLayersToAllocate];
     for (uint32_t i = 0; i < numLayersToAllocate; ++i)
     {
-        m_qtTempCoeffY[i]  = X265_MALLOC(TCoeff, g_maxCUWidth * g_maxCUHeight);
-        m_qtTempCoeffCb[i] = X265_MALLOC(TCoeff, (g_maxCUWidth >> m_hChromaShift) * (g_maxCUHeight >> m_vChromaShift));
-        m_qtTempCoeffCr[i] = X265_MALLOC(TCoeff, (g_maxCUWidth >> m_hChromaShift) * (g_maxCUHeight >> m_vChromaShift));
+        m_qtTempCoeffY[i]  = X265_MALLOC(TCoeff, g_maxCUSize * g_maxCUSize);
+        m_qtTempCoeffCb[i] = X265_MALLOC(TCoeff, (g_maxCUSize >> m_hChromaShift) * (g_maxCUSize >> m_vChromaShift));
+        m_qtTempCoeffCr[i] = X265_MALLOC(TCoeff, (g_maxCUSize >> m_hChromaShift) * (g_maxCUSize >> m_vChromaShift));
         m_qtTempShortYuv[i].create(MAX_CU_SIZE, MAX_CU_SIZE, cfg->param->internalCsp);
     }
 
@@ -161,7 +161,7 @@
     CHECKED_MALLOC(m_qtTempTUCoeffCb, TCoeff, MAX_TS_WIDTH * MAX_TS_HEIGHT);
     CHECKED_MALLOC(m_qtTempTUCoeffCr, TCoeff, MAX_TS_WIDTH * MAX_TS_HEIGHT);
 
-    return m_qtTempTransformSkipYuv.create(g_maxCUWidth, g_maxCUHeight, cfg->param->internalCsp) &&
+    return m_qtTempTransformSkipYuv.create(g_maxCUSize, g_maxCUSize, cfg->param->internalCsp) &&
            m_tmpYuvPred.create(MAX_CU_SIZE, MAX_CU_SIZE, cfg->param->internalCsp);
 
 fail:
@@ -179,7 +179,7 @@
     uint32_t fullDepth  = cu->getDepth(0) + trDepth;
     uint32_t trMode     = cu->getTransformIdx(absPartIdx);
     uint32_t subdiv     = (trMode > trDepth ? 1 : 0);
-    uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUWidth()] + 2 - fullDepth;
+    uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize()] + 2 - fullDepth;
     int      chFmt      = cu->getChromaFormat();
 
     if (cu->getPredictionMode(0) == MODE_INTRA && cu->getPartitionSize(0) == SIZE_NxN && trDepth == 0)
@@ -241,7 +241,7 @@
     uint32_t fullDepth  = cu->getDepth(0) + trDepth;
     uint32_t trMode     = cu->getTransformIdx(absPartIdx);
     uint32_t subdiv     = (trMode > trDepth ? 1 : 0);
-    uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUWidth()] + 2 - fullDepth;
+    uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize()] + 2 - fullDepth;
     uint32_t chroma     = (ttype != TEXT_LUMA ? 1 : 0);
     int chFmt           = cu->getChromaFormat();
 
@@ -271,9 +271,9 @@
     //===== coefficients =====
     int cspx = chroma ? m_hChromaShift : 0;
     int cspy = chroma ? m_vChromaShift : 0;
-    uint32_t width = cu->getWidth(0) >> (trDepth + cspx);
-    uint32_t height = cu->getHeight(0) >> (trDepth + cspy);
-    uint32_t coeffOffset = (cu->getPic()->getMinCUWidth() >> cspx) * (cu->getPic()->getMinCUHeight() >> cspy) * absPartIdx;
+    uint32_t width = cu->getCUSize(0) >> (trDepth + cspx);
+    uint32_t height = cu->getCUSize(0) >> (trDepth + cspy);
+    uint32_t coeffOffset = (cu->getPic()->getMinCUSize() >> cspx) * (cu->getPic()->getMinCUSize() >> cspy) * absPartIdx;
     uint32_t qtLayer = cu->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - trSizeLog2;
     TCoeff* coeff = 0;
     switch (ttype)
@@ -409,8 +409,8 @@
 {
     uint32_t lumaPredMode = cu->getLumaIntraDir(absPartIdx);
     uint32_t fullDepth    = cu->getDepth(0)  + trDepth;
-    uint32_t width        = cu->getWidth(0) >> trDepth;
-    uint32_t height       = cu->getHeight(0) >> trDepth;
+    uint32_t width        = cu->getCUSize(0) >> trDepth;
+    uint32_t height       = cu->getCUSize(0) >> trDepth;
     uint32_t stride       = fencYuv->getStride();
     Pel*     fenc         = fencYuv->getLumaAddr(absPartIdx);
     Pel*     pred         = predYuv->getLumaAddr(absPartIdx);
@@ -419,9 +419,9 @@
     int      chFmt        = cu->getChromaFormat();
     int      part         = partitionFromSizes(width, height);
 
-    uint32_t trSizeLog2     = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUWidth() >> fullDepth] + 2;
+    uint32_t trSizeLog2     = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize() >> fullDepth] + 2;
     uint32_t qtLayer        = cu->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - trSizeLog2;
-    uint32_t numCoeffPerInc = cu->getSlice()->getSPS()->getMaxCUWidth() * cu->getSlice()->getSPS()->getMaxCUHeight() >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1);
+    uint32_t numCoeffPerInc = cu->getSlice()->getSPS()->getMaxCUSize() * cu->getSlice()->getSPS()->getMaxCUSize() >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1);
     TCoeff*  coeff          = m_qtTempCoeffY[qtLayer] + numCoeffPerInc * absPartIdx;
 
     int16_t* reconQt        = m_qtTempShortYuv[qtLayer].getLumaAddr(absPartIdx);
@@ -512,7 +512,7 @@
 {
     uint32_t origTrDepth = trDepth;
     uint32_t fullDepth   = cu->getDepth(0) + trDepth;
-    uint32_t trSizeLog2  = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUWidth() >> fullDepth] + 2;
+    uint32_t trSizeLog2  = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize() >> fullDepth] + 2;
     int      chFmt       = cu->getChromaFormat();
 
     if ((trSizeLog2 == 2) && !(chFmt == CHROMA_444))
@@ -529,8 +529,8 @@
 
     TextType ttype          = (chromaId > 0 ? TEXT_CHROMA_V : TEXT_CHROMA_U);
     uint32_t chromaPredMode = cu->getChromaIntraDir(absPartIdx);
-    uint32_t width          = cu->getWidth(0) >> (trDepth + m_hChromaShift);
-    uint32_t height         = cu->getHeight(0) >> (trDepth + m_vChromaShift);
+    uint32_t width          = cu->getCUSize(0) >> (trDepth + m_hChromaShift);
+    uint32_t height         = cu->getCUSize(0) >> (trDepth + m_vChromaShift);
     uint32_t stride         = fencYuv->getCStride();
     Pel*     fenc           = (chromaId > 0 ? fencYuv->getCrAddr(absPartIdx) : fencYuv->getCbAddr(absPartIdx));
     Pel*     pred           = (chromaId > 0 ? predYuv->getCrAddr(absPartIdx) : predYuv->getCbAddr(absPartIdx));
@@ -538,7 +538,7 @@
     Pel*     recon          = (chromaId > 0 ? predYuv->getCrAddr(absPartIdx) : predYuv->getCbAddr(absPartIdx));
 
     uint32_t qtlayer        = cu->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - trSizeLog2;
-    uint32_t numCoeffPerInc = (cu->getSlice()->getSPS()->getMaxCUWidth() * cu->getSlice()->getSPS()->getMaxCUHeight() >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1)) >> (m_hChromaShift + m_vChromaShift);
+    uint32_t numCoeffPerInc = (cu->getSlice()->getSPS()->getMaxCUSize() * cu->getSlice()->getSPS()->getMaxCUSize() >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1)) >> (m_hChromaShift + m_vChromaShift);
     TCoeff*  coeff          = (chromaId > 0 ? m_qtTempCoeffCr[qtlayer] : m_qtTempCoeffCb[qtlayer]) + numCoeffPerInc * absPartIdx;
     int16_t* reconQt        = (chromaId > 0 ? m_qtTempShortYuv[qtlayer].getCrAddr(absPartIdx) : m_qtTempShortYuv[qtlayer].getCbAddr(absPartIdx));
     uint32_t reconQtStride  = m_qtTempShortYuv[qtlayer].m_cwidth;
@@ -661,7 +661,7 @@
                                      uint64_t&   rdCost)
 {
     uint32_t fullDepth   = cu->getDepth(0) +  trDepth;
-    uint32_t trSizeLog2  = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUWidth() >> fullDepth] + 2;
+    uint32_t trSizeLog2  = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize() >> fullDepth] + 2;
     bool     bCheckFull  = (trSizeLog2 <= cu->getSlice()->getSPS()->getQuadtreeTULog2MaxSize());
     bool     bCheckSplit = (trSizeLog2 > cu->getQuadtreeTULog2MinSizeInCU(absPartIdx));
 
@@ -694,8 +694,8 @@
     uint32_t singleCbfU  = 0;
     uint32_t singleCbfV  = 0;
     bool   checkTransformSkip  = cu->getSlice()->getPPS()->getUseTransformSkip();
-    uint32_t widthTransformSkip  = cu->getWidth(0) >> trDepth;
-    uint32_t heightTransformSkip = cu->getHeight(0) >> trDepth;
+    uint32_t widthTransformSkip  = cu->getCUSize(0) >> trDepth;
+    uint32_t heightTransformSkip = cu->getCUSize(0) >> trDepth;
     int    bestModeId    = 0;
     int    bestModeIdUV[2] = { 0, 0 };
 
@@ -942,8 +942,8 @@
         }
 
         //--- set reconstruction for next intra prediction blocks ---
-        uint32_t width     = cu->getWidth(0) >> trDepth;
-        uint32_t height    = cu->getHeight(0) >> trDepth;
+        uint32_t width     = cu->getCUSize(0) >> trDepth;
+        uint32_t height    = cu->getCUSize(0) >> trDepth;
         uint32_t qtLayer   = cu->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - trSizeLog2;
         uint32_t zorder    = cu->getZorderIdxInCU() + absPartIdx;
         int16_t* src       = m_qtTempShortYuv[qtLayer].getLumaAddr(absPartIdx);
@@ -982,7 +982,7 @@
                                              TComYuv*    reconYuv)
 {
     uint32_t fullDepth   = cu->getDepth(0) +  trDepth;
-    uint32_t trSizeLog2  = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUWidth() >> fullDepth] + 2;
+    uint32_t trSizeLog2  = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize() >> fullDepth] + 2;
     bool     bCheckFull  = (trSizeLog2 <= cu->getSlice()->getSPS()->getQuadtreeTULog2MaxSize());
     bool     bCheckSplit = (trSizeLog2 > cu->getQuadtreeTULog2MinSizeInCU(absPartIdx));
 
@@ -1003,8 +1003,8 @@
 
         //----- code luma block with given intra prediction mode and store Cbf-----
         uint32_t lumaPredMode = cu->getLumaIntraDir(absPartIdx);
-        uint32_t width        = cu->getWidth(0) >> trDepth;
-        uint32_t height       = cu->getHeight(0) >> trDepth;
+        uint32_t width        = cu->getCUSize(0) >> trDepth;
+        uint32_t height       = cu->getCUSize(0) >> trDepth;
         int      chFmt        = cu->getChromaFormat();
         uint32_t stride       = fencYuv->getStride();
         Pel*     fenc         = fencYuv->getLumaAddr(absPartIdx);
@@ -1012,7 +1012,7 @@
         int16_t* residual     = resiYuv->getLumaAddr(absPartIdx);
         Pel*     recon        = reconYuv->getLumaAddr(absPartIdx);
 
-        uint32_t numCoeffPerInc = cu->getSlice()->getSPS()->getMaxCUWidth() * cu->getSlice()->getSPS()->getMaxCUHeight() >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1);
+        uint32_t numCoeffPerInc = cu->getSlice()->getSPS()->getMaxCUSize() * cu->getSlice()->getSPS()->getMaxCUSize() >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1);
         TCoeff*  coeff          = cu->getCoeffY() + numCoeffPerInc * absPartIdx;
 
         uint32_t zorder           = cu->getZorderIdxInCU() + absPartIdx;
@@ -1097,7 +1097,7 @@
 
     if (trMode == trDepth)
     {
-        uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUWidth() >> fullDepth] + 2;
+        uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize() >> fullDepth] + 2;
         uint32_t qtlayer    = cu->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - trSizeLog2;
 
         bool bSkipChroma = false;
@@ -1111,8 +1111,8 @@
         }
 
         //===== copy transform coefficients =====
-        uint32_t numCoeffY    = (cu->getSlice()->getSPS()->getMaxCUWidth() * cu->getSlice()->getSPS()->getMaxCUHeight()) >> (fullDepth << 1);
-        uint32_t numCoeffIncY = (cu->getSlice()->getSPS()->getMaxCUWidth() * cu->getSlice()->getSPS()->getMaxCUHeight()) >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1);
+        uint32_t numCoeffY    = (cu->getSlice()->getSPS()->getMaxCUSize() * cu->getSlice()->getSPS()->getMaxCUSize()) >> (fullDepth << 1);
+        uint32_t numCoeffIncY = (cu->getSlice()->getSPS()->getMaxCUSize() * cu->getSlice()->getSPS()->getMaxCUSize()) >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1);
         TCoeff* coeffSrcY = m_qtTempCoeffY[qtlayer] + (numCoeffIncY * absPartIdx);
         TCoeff* coeffDestY = cu->getCoeffY()        + (numCoeffIncY * absPartIdx);
         ::memcpy(coeffDestY, coeffSrcY, sizeof(TCoeff) * numCoeffY);
@@ -1151,7 +1151,7 @@
 {
     uint32_t fullMode = cu->getDepth(0) + trDepth;
 
-    uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUWidth() >> fullMode] + 2;
+    uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize() >> fullMode] + 2;
     uint32_t qtlayer    = cu->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - trSizeLog2;
 
     bool bSkipChroma  = false;
@@ -1166,8 +1166,8 @@
     }
 
     //===== copy transform coefficients =====
-    uint32_t numCoeffY    = (cu->getSlice()->getSPS()->getMaxCUWidth() * cu->getSlice()->getSPS()->getMaxCUHeight()) >> (fullMode << 1);
-    uint32_t numCoeffIncY = (cu->getSlice()->getSPS()->getMaxCUWidth() * cu->getSlice()->getSPS()->getMaxCUHeight()) >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1);
+    uint32_t numCoeffY    = (cu->getSlice()->getSPS()->getMaxCUSize() * cu->getSlice()->getSPS()->getMaxCUSize()) >> (fullMode << 1);
+    uint32_t numCoeffIncY = (cu->getSlice()->getSPS()->getMaxCUSize() * cu->getSlice()->getSPS()->getMaxCUSize()) >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1);
     TCoeff* coeffSrcY = m_qtTempCoeffY[qtlayer] + (numCoeffIncY * absPartIdx);
     TCoeff* coeffDstY = m_qtTempTUCoeffY;
     ::memcpy(coeffDstY, coeffSrcY, sizeof(TCoeff) * numCoeffY);
@@ -1198,7 +1198,7 @@
 {
     uint32_t fullDepth = cu->getDepth(0) + trDepth;
 
-    uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUWidth() >> fullDepth] + 2;
+    uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize() >> fullDepth] + 2;
     uint32_t qtlayer    = cu->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - trSizeLog2;
 
     bool bSkipChroma = false;
@@ -1213,8 +1213,8 @@
     }
 
     //===== copy transform coefficients =====
-    uint32_t numCoeffY    = (cu->getSlice()->getSPS()->getMaxCUWidth() * cu->getSlice()->getSPS()->getMaxCUHeight()) >> (fullDepth << 1);
-    uint32_t numCoeffIncY = (cu->getSlice()->getSPS()->getMaxCUWidth() * cu->getSlice()->getSPS()->getMaxCUHeight()) >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1);
+    uint32_t numCoeffY    = (cu->getSlice()->getSPS()->getMaxCUSize() * cu->getSlice()->getSPS()->getMaxCUSize()) >> (fullDepth << 1);
+    uint32_t numCoeffIncY = (cu->getSlice()->getSPS()->getMaxCUSize() * cu->getSlice()->getSPS()->getMaxCUSize()) >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1);
     TCoeff* coeffDstY = m_qtTempCoeffY[qtlayer] + (numCoeffIncY * absPartIdx);
     TCoeff* coeffSrcY = m_qtTempTUCoeffY;
     ::memcpy(coeffDstY, coeffSrcY, sizeof(TCoeff) * numCoeffY);
@@ -1238,8 +1238,8 @@
     pixel*     reconIPred       = cu->getPic()->getPicYuvRec()->getLumaAddr(cu->getAddr(), zOrder);
     uint32_t   reconIPredStride = cu->getPic()->getPicYuvRec()->getStride();
     int16_t*   reconQt          = m_qtTempShortYuv[qtlayer].getLumaAddr(absPartIdx);
-    uint32_t   width            = cu->getWidth(0) >> trDepth;
-    uint32_t   height           = cu->getHeight(0) >> trDepth;
+    uint32_t   width            = cu->getCUSize(0) >> trDepth;
+    uint32_t   height           = cu->getCUSize(0) >> trDepth;
     primitives.blockcpy_ps(width, height, reconIPred, reconIPredStride, reconQt, MAX_CU_SIZE);
     assert(m_qtTempShortYuv[qtlayer].m_width == MAX_CU_SIZE);
 
@@ -1266,7 +1266,7 @@
 
     if (trMode == trDepth)
     {
-        uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUWidth() >> fullDepth] + 2;
+        uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize() >> fullDepth] + 2;
         uint32_t qtlayer    = cu->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - trSizeLog2;
 
         bool bChromaSame = false;
@@ -1283,12 +1283,12 @@
         }
 
         //===== copy transform coefficients =====
-        uint32_t numCoeffC = (cu->getSlice()->getSPS()->getMaxCUWidth() * cu->getSlice()->getSPS()->getMaxCUHeight()) >> (fullDepth << 1);
+        uint32_t numCoeffC = (cu->getSlice()->getSPS()->getMaxCUSize() * cu->getSlice()->getSPS()->getMaxCUSize()) >> (fullDepth << 1);
         if (!bChromaSame)
         {
             numCoeffC >>= 2;
         }
-        uint32_t numCoeffIncC = (cu->getSlice()->getSPS()->getMaxCUWidth() * cu->getSlice()->getSPS()->getMaxCUHeight()) >> ((cu->getSlice()->getSPS()->getMaxCUDepth() << 1) + 2);
+        uint32_t numCoeffIncC = (cu->getSlice()->getSPS()->getMaxCUSize() * cu->getSlice()->getSPS()->getMaxCUSize()) >> ((cu->getSlice()->getSPS()->getMaxCUDepth() << 1) + 2);
         if (stateU0V1Both2 == 0 || stateU0V1Both2 == 2)
         {
             TCoeff* coeffSrcU = m_qtTempCoeffCb[qtlayer] + (numCoeffIncC * absPartIdx);
@@ -1315,7 +1315,7 @@
 
     if (trMode == trDepth)
     {
-        uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUWidth() >> fullDepth] + 2;
+        uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize() >> fullDepth] + 2;
         uint32_t qtlayer    = cu->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - trSizeLog2;
 
         bool bChromaSame = false;
@@ -1332,12 +1332,12 @@
         }
 
         //===== copy transform coefficients =====
-        uint32_t numCoeffC = (cu->getSlice()->getSPS()->getMaxCUWidth() * cu->getSlice()->getSPS()->getMaxCUHeight()) >> (fullDepth << 1);
+        uint32_t numCoeffC = (cu->getSlice()->getSPS()->getMaxCUSize() * cu->getSlice()->getSPS()->getMaxCUSize()) >> (fullDepth << 1);
         if (!bChromaSame)
         {
             numCoeffC >>= 2;
         }
-        uint32_t numCoeffIncC = (cu->getSlice()->getSPS()->getMaxCUWidth() * cu->getSlice()->getSPS()->getMaxCUHeight()) >> ((cu->getSlice()->getSPS()->getMaxCUDepth() << 1) + 2);
+        uint32_t numCoeffIncC = (cu->getSlice()->getSPS()->getMaxCUSize() * cu->getSlice()->getSPS()->getMaxCUSize()) >> ((cu->getSlice()->getSPS()->getMaxCUDepth() << 1) + 2);
 
         if (stateU0V1Both2 == 0 || stateU0V1Both2 == 2)
         {
@@ -1357,8 +1357,8 @@
         m_qtTempTransformSkipYuv.copyPartToPartChroma(&m_qtTempShortYuv[qtlayer], absPartIdx, lumaSize, stateU0V1Both2);
 
         uint32_t zorder           = cu->getZorderIdxInCU() + absPartIdx;
-        uint32_t width            = cu->getWidth(0) >> (trDepth + 1);
-        uint32_t height           = cu->getHeight(0) >> (trDepth + 1);
+        uint32_t width            = cu->getCUSize(0) >> (trDepth + 1);
+        uint32_t height           = cu->getCUSize(0) >> (trDepth + 1);
         uint32_t reconQtStride    = m_qtTempShortYuv[qtlayer].m_cwidth;
         uint32_t reconIPredStride = cu->getPic()->getPicYuvRec()->getCStride();
 
@@ -1391,7 +1391,7 @@
     if (trMode == trDepth)
     {
         bool checkTransformSkip = cu->getSlice()->getPPS()->getUseTransformSkip();
-        uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUWidth() >> fullDepth] + 2;
+        uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize() >> fullDepth] + 2;
 
         uint32_t actualTrDepth = trDepth;
         if ((trSizeLog2 == 2) && !(cu->getChromaFormat() == CHROMA_444))
@@ -1537,7 +1537,7 @@
 
     if (trMode == trDepth)
     {
-        uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUWidth() >> fullDepth] + 2;
+        uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize() >> fullDepth] + 2;
         uint32_t qtlayer    = cu->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - trSizeLog2;
 
         bool bChromaSame  = false;
@@ -1553,13 +1553,13 @@
         }
 
         //===== copy transform coefficients =====
-        uint32_t numCoeffC = (cu->getSlice()->getSPS()->getMaxCUWidth() * cu->getSlice()->getSPS()->getMaxCUHeight()) >> (fullDepth << 1);
+        uint32_t numCoeffC = (cu->getSlice()->getSPS()->getMaxCUSize() * cu->getSlice()->getSPS()->getMaxCUSize()) >> (fullDepth << 1);
         if (!bChromaSame)
         {
-            numCoeffC = ((cu->getSlice()->getSPS()->getMaxCUWidth() >> m_hChromaShift) * (cu->getSlice()->getSPS()->getMaxCUHeight() >> m_vChromaShift)) >> (fullDepth << 1);
+            numCoeffC = ((cu->getSlice()->getSPS()->getMaxCUSize() >> m_hChromaShift) * (cu->getSlice()->getSPS()->getMaxCUSize() >> m_vChromaShift)) >> (fullDepth << 1);
         }
 
-        uint32_t numCoeffIncC = ((cu->getSlice()->getSPS()->getMaxCUWidth() >> m_hChromaShift) * (cu->getSlice()->getSPS()->getMaxCUHeight() >> m_vChromaShift)) >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1);
+        uint32_t numCoeffIncC = ((cu->getSlice()->getSPS()->getMaxCUSize() >> m_hChromaShift) * (cu->getSlice()->getSPS()->getMaxCUSize() >> m_vChromaShift)) >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1);
 
         TCoeff* coeffSrcU = m_qtTempCoeffCb[qtlayer] + (numCoeffIncC * absPartIdx);
         TCoeff* coeffSrcV = m_qtTempCoeffCr[qtlayer] + (numCoeffIncC * absPartIdx);
@@ -1596,7 +1596,7 @@
 
     if (trMode == trDepth)
     {
-        uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUWidth() >> fullDepth] + 2;
+        uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize() >> fullDepth] + 2;
         uint32_t actualTrDepth = trDepth;
         if (trSizeLog2 == 2)
         {
@@ -1612,8 +1612,8 @@
 
         cu->setTransformSkipSubParts(0, TEXT_CHROMA_U, absPartIdx, cu->getDepth(0) +  actualTrDepth);
         cu->setTransformSkipSubParts(0, TEXT_CHROMA_V, absPartIdx, cu->getDepth(0) +  actualTrDepth);
-        uint32_t width          = cu->getWidth(0) >> (trDepth + m_hChromaShift);
-        uint32_t height         = cu->getHeight(0) >> (trDepth + m_vChromaShift);
+        uint32_t width          = cu->getCUSize(0) >> (trDepth + m_hChromaShift);
+        uint32_t height         = cu->getCUSize(0) >> (trDepth + m_vChromaShift);
         uint32_t stride         = fencYuv->getCStride();
 
         for (uint32_t chromaId = 0; chromaId < 2; chromaId++)
@@ -1624,7 +1624,7 @@
             Pel*     pred           = (chromaId > 0 ? predYuv->getCrAddr(absPartIdx) : predYuv->getCbAddr(absPartIdx));
             int16_t* residual       = (chromaId > 0 ? resiYuv->getCrAddr(absPartIdx) : resiYuv->getCbAddr(absPartIdx));
             Pel*     recon          = (chromaId > 0 ? reconYuv->getCrAddr(absPartIdx) : reconYuv->getCbAddr(absPartIdx));
-            uint32_t numCoeffPerInc = (cu->getSlice()->getSPS()->getMaxCUWidth() * cu->getSlice()->getSPS()->getMaxCUHeight() >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1)) >> 2;
+            uint32_t numCoeffPerInc = (cu->getSlice()->getSPS()->getMaxCUSize() * cu->getSlice()->getSPS()->getMaxCUSize() >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1)) >> 2;
             TCoeff*  coeff          = (chromaId > 0 ? cu->getCoeffCr() : cu->getCoeffCb()) + numCoeffPerInc * absPartIdx;
 
             uint32_t zorder           = cu->getZorderIdxInCU() + absPartIdx;
@@ -1689,7 +1689,7 @@
             //===== reconstruction =====
             assert(((uint32_t)(size_t)residual & (width - 1)) == 0);
             assert(width <= 32);
-            int part = partitionFromSizes(cu->getWidth(0) >> (trDepth), cu->getHeight(0) >> (trDepth));
+            int part = partitionFromSizes(cu->getCUSize(0) >> (trDepth), cu->getCUSize(0) >> (trDepth));
             primitives.chroma[m_cfg->param->internalCsp].add_ps[part](recon, stride, pred, residual, stride, stride);
             primitives.chroma[m_cfg->param->internalCsp].copy_pp[part](reconIPred, reconIPredStride, recon, stride);
         }
@@ -1717,8 +1717,8 @@
 
 void TEncSearch::preestChromaPredMode(TComDataCU* cu, TComYuv* fencYuv, TComYuv* predYuv)
 {
-    uint32_t width  = cu->getWidth(0) >> 1;
-    uint32_t height = cu->getHeight(0) >> 1;
+    uint32_t width  = cu->getCUSize(0) >> 1;
+    uint32_t height = cu->getCUSize(0) >> 1;
     uint32_t stride = fencYuv->getCStride();
     int      chFmt  = cu->getChromaFormat();
     Pel* fencU      = fencYuv->getCbAddr(0);
@@ -1767,7 +1767,7 @@
     uint32_t depth        = cu->getDepth(0);
     uint32_t numPU        = cu->getNumPartInter();
     uint32_t initTrDepth  = cu->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1;
-    uint32_t width        = cu->getWidth(0) >> initTrDepth;
+    uint32_t width        = cu->getCUSize(0) >> initTrDepth;
     uint32_t qNumParts    = cu->getTotalNumPart() >> 2;
     uint32_t widthBit     = cu->getIntraSizeIdx(0);
     uint32_t overallDistY = 0;
@@ -2021,7 +2021,7 @@
         {
             bool bSkipChroma  = false;
             bool bChromaSame  = false;
-            uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUWidth() >> (cu->getDepth(0) + initTrDepth)] + 2;
+            uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize() >> (cu->getDepth(0) + initTrDepth)] + 2;
             if (!bLumaOnly && trSizeLog2 == 2)
             {
                 assert(initTrDepth  > 0);
@@ -2029,8 +2029,8 @@
                 bChromaSame  = true;
             }
 
-            uint32_t compWidth   = cu->getWidth(0) >> initTrDepth;
-            uint32_t compHeight  = cu->getHeight(0) >> initTrDepth;
+            uint32_t compWidth   = cu->getCUSize(0) >> initTrDepth;
+            uint32_t compHeight  = cu->getCUSize(0) >> initTrDepth;
             uint32_t zorder      = cu->getZorderIdxInCU() + partOffset;
             int      part        = partitionFromSizes(compWidth, compHeight);
             Pel*     dst         = cu->getPic()->getPicYuvRec()->getLumaAddr(cu->getAddr(), zorder);
@@ -2105,8 +2105,8 @@
     uint32_t maxMode = NUM_CHROMA_MODE;
     uint32_t modeList[NUM_CHROMA_MODE];
 
-    uint32_t width          = cu->getWidth(0) >> (trDepth + m_hChromaShift);
-    uint32_t height         = cu->getHeight(0) >> (trDepth + m_vChromaShift);
+    uint32_t width          = cu->getCUSize(0) >> (trDepth + m_hChromaShift);
+    uint32_t height         = cu->getCUSize(0) >> (trDepth + m_vChromaShift);
     int      chFmt          = cu->getChromaFormat();
     uint32_t stride         = fencYuv->getCStride();
     int scaleWidth = width;
@@ -2246,8 +2246,8 @@
 
         if (!isLastSection())
         {
-            uint32_t compWidth   = (cu->getWidth(0) >> m_hChromaShift)  >> initTrDepth;
-            uint32_t compHeight  = (cu->getHeight(0) >> m_vChromaShift) >> initTrDepth;
+            uint32_t compWidth   = (cu->getCUSize(0) >> m_hChromaShift)  >> initTrDepth;
+            uint32_t compHeight  = (cu->getCUSize(0) >> m_vChromaShift) >> initTrDepth;
             uint32_t zorder      = cu->getZorderIdxInCU() + m_partOffset;
             Pel*     dst         = cu->getPic()->getPicYuvRec()->getCbAddr(cu->getAddr(), zorder);
             uint32_t dststride   = cu->getPic()->getPicYuvRec()->getCStride();
@@ -2387,8 +2387,8 @@
 void TEncSearch::IPCMSearch(TComDataCU* cu, TComYuv* fencYuv, TComYuv* predYuv, ShortYuv* resiYuv, TComYuv* reconYuv)
 {
     uint32_t depth      = cu->getDepth(0);
-    uint32_t width      = cu->getWidth(0);
-    uint32_t height     = cu->getHeight(0);
+    uint32_t width      = cu->getCUSize(0);
+    uint32_t height     = cu->getCUSize(0);
     uint32_t stride     = predYuv->getStride();
     uint32_t strideC    = predYuv->getCStride();
     uint32_t widthC     = width  >> 1;
@@ -2398,7 +2398,7 @@
     uint64_t cost;
 
     uint32_t absPartIdx = 0;
-    uint32_t minCoeffSize = cu->getPic()->getMinCUWidth() * cu->getPic()->getMinCUHeight();
+    uint32_t minCoeffSize = cu->getPic()->getMinCUSize() * cu->getPic()->getMinCUSize();
     uint32_t lumaOffset   = minCoeffSize * absPartIdx;
     uint32_t chromaOffset = lumaOffset >> 2;
 
@@ -2477,7 +2477,7 @@
     cu->getPartIndexAndSize(puIdx, absPartIdx, width, height);
     uint32_t depth = cu->getDepth(absPartIdx);
     PartSize partSize = cu->getPartitionSize(0);
-    if (cu->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && partSize != SIZE_2Nx2N && cu->getWidth(0) <= 8)
+    if (cu->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && partSize != SIZE_2Nx2N && cu->getCUSize(0) <= 8)
     {
         cu->setPartSizeSubParts(SIZE_2Nx2N, 0, depth);
         if (puIdx == 0)
@@ -2607,7 +2607,7 @@
 
         bool bTestNormalMC = true;
 
-        if (bUseMRG && cu->getWidth(0) > 8 && numPart == 2)
+        if (bUseMRG && cu->getCUSize(0) > 8 && numPart == 2)
         {
             bTestNormalMC = false;
         }
@@ -3044,8 +3044,8 @@
     uint32_t bits = 0, bestBits = 0;
     uint32_t distortion = 0, bdist = 0;
 
-    uint32_t width  = cu->getWidth(0);
-    uint32_t height = cu->getHeight(0);
+    uint32_t width  = cu->getCUSize(0);
+    uint32_t height = cu->getCUSize(0);
 
     //  No residual coding : SKIP mode
     if (bSkipRes)
@@ -3197,7 +3197,7 @@
     if (cu->getPredictionMode(0) == MODE_INTER)
     {
         residualTransformQuantInter(cu, 0, 0, resiYuv, cu->getDepth(0), true);
-        uint32_t width  = cu->getWidth(0);
+        uint32_t width  = cu->getCUSize(0);
         if (cu->getQtRootCbf(0))
         {
             reconYuv->addClip(predYuv, resiYuv, 0, width);
@@ -3228,7 +3228,7 @@
 {
     assert(cu->getDepth(0) == cu->getDepth(absPartIdx));
     const uint32_t trMode = depth - cu->getDepth(0);
-    const uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUWidth() >> depth] + 2;
+    const uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize() >> depth] + 2;
     int chFmt                 = cu->getChromaFormat();
 
     bool bSplitFlag = ((cu->getSlice()->getSPS()->getQuadtreeTUMaxDepthInter() == 1) && cu->getPredictionMode(absPartIdx) == MODE_INTER && (cu->getPartitionSize(absPartIdx) != SIZE_2Nx2N));
@@ -3257,7 +3257,7 @@
     int lastPosY = -1, lastPosU = -1, lastPosV = -1;
     if (bCheckFull)
     {
-        const uint32_t numCoeffPerAbsPartIdxIncrement = cu->getSlice()->getSPS()->getMaxCUWidth() * cu->getSlice()->getSPS()->getMaxCUHeight() >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1);
+        const uint32_t numCoeffPerAbsPartIdxIncrement = cu->getSlice()->getSPS()->getMaxCUSize() * cu->getSlice()->getSPS()->getMaxCUSize() >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1);
 
         TCoeff *coeffCurY = cu->getCoeffY() + (numCoeffPerAbsPartIdxIncrement * absPartIdx);
         TCoeff *coeffCurU = cu->getCoeffCb() + (numCoeffPerAbsPartIdxIncrement * absPartIdx >> 2);
@@ -3418,8 +3418,8 @@
 {
     assert(cu->getDepth(0) == cu->getDepth(absPartIdx));
     const uint32_t trMode = depth - cu->getDepth(0);
-    const uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUWidth() >> depth] + 2;
-    uint32_t  trSizeCLog2     = g_convertToBit[(cu->getSlice()->getSPS()->getMaxCUWidth() >> m_hChromaShift) >> depth] + 2;
+    const uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize() >> depth] + 2;
+    uint32_t  trSizeCLog2     = g_convertToBit[(cu->getSlice()->getSPS()->getMaxCUSize() >> m_hChromaShift) >> depth] + 2;
     int chFmt                 = cu->getChromaFormat();
 
     bool bSplitFlag = ((cu->getSlice()->getSPS()->getQuadtreeTUMaxDepthInter() == 1) && cu->getPredictionMode(absPartIdx) == MODE_INTER && (cu->getPartitionSize(absPartIdx) != SIZE_2Nx2N));
@@ -3454,7 +3454,7 @@
 
     if (bCheckFull)
     {
-        const uint32_t numCoeffPerAbsPartIdxIncrement = cu->getSlice()->getSPS()->getMaxCUWidth() * cu->getSlice()->getSPS()->getMaxCUHeight() >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1);
+        const uint32_t numCoeffPerAbsPartIdxIncrement = cu->getSlice()->getSPS()->getMaxCUSize() * cu->getSlice()->getSPS()->getMaxCUSize() >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1);
         const uint32_t qtlayer = cu->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - trSizeLog2;
         TCoeff *coeffCurY = m_qtTempCoeffY[qtlayer] + (numCoeffPerAbsPartIdxIncrement * absPartIdx);
         TCoeff *coeffCurU = m_qtTempCoeffCb[qtlayer] + (numCoeffPerAbsPartIdxIncrement * absPartIdx >> (m_hChromaShift + m_vChromaShift));
@@ -4066,8 +4066,8 @@
     const uint32_t curTrMode   = depth - cu->getDepth(0);
     const uint32_t trMode      = cu->getTransformIdx(absPartIdx);
     const bool     bSubdiv     = curTrMode != trMode;
-    const uint32_t trSizeLog2  = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUWidth() >> depth] + 2;
-    uint32_t       trSizeCLog2 = g_convertToBit[(cu->getSlice()->getSPS()->getMaxCUWidth() >> m_hChromaShift) >> depth] + 2;
+    const uint32_t trSizeLog2  = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize() >> depth] + 2;
+    uint32_t       trSizeCLog2 = g_convertToBit[(cu->getSlice()->getSPS()->getMaxCUSize() >> m_hChromaShift) >> depth] + 2;
     int            chFmt       = cu->getChromaFormat();
 
     if (bSubdivAndCbf && trSizeLog2 <= cu->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() && trSizeLog2 > cu->getQuadtreeTULog2MinSizeInCU(absPartIdx))
@@ -4110,7 +4110,7 @@
     if (!bSubdiv)
     {
         //Luma
-        const uint32_t numCoeffPerAbsPartIdxIncrement = cu->getSlice()->getSPS()->getMaxCUWidth() * cu->getSlice()->getSPS()->getMaxCUHeight() >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1);
+        const uint32_t numCoeffPerAbsPartIdxIncrement = cu->getSlice()->getSPS()->getMaxCUSize() * cu->getSlice()->getSPS()->getMaxCUSize() >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1);
         //assert( 16 == uiNumCoeffPerAbsPartIdxIncrement ); // check
         const uint32_t qtlayer = cu->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - trSizeLog2;
         TCoeff *coeffCurY = m_qtTempCoeffY[qtlayer] +  numCoeffPerAbsPartIdxIncrement * absPartIdx;
@@ -4171,8 +4171,8 @@
 
     if (curTrMode == trMode)
     {
-        const uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUWidth() >> depth] + 2;
-        uint32_t  trSizeCLog2     = g_convertToBit[(cu->getSlice()->getSPS()->getMaxCUWidth() >> cu->getHorzChromaShift()) >> depth] + 2;
+        const uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize() >> depth] + 2;
+        uint32_t  trSizeCLog2     = g_convertToBit[(cu->getSlice()->getSPS()->getMaxCUSize() >> cu->getHorzChromaShift()) >> depth] + 2;
         const uint32_t qtlayer    = cu->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - trSizeLog2;
 
         bool  bCodeChroma   = true;
@@ -4198,7 +4198,7 @@
         }
         else
         {
-            uint32_t uiNumCoeffPerAbsPartIdxIncrement = cu->getSlice()->getSPS()->getMaxCUWidth() * cu->getSlice()->getSPS()->getMaxCUHeight() >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1);
+            uint32_t uiNumCoeffPerAbsPartIdxIncrement = cu->getSlice()->getSPS()->getMaxCUSize() * cu->getSlice()->getSPS()->getMaxCUSize() >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1);
             uint32_t uiNumCoeffY = (1 << (trSizeLog2 << 1));
             TCoeff* pcCoeffSrcY = m_qtTempCoeffY[qtlayer] +  uiNumCoeffPerAbsPartIdxIncrement * absPartIdx;
             TCoeff* pcCoeffDstY = cu->getCoeffY() + uiNumCoeffPerAbsPartIdxIncrement * absPartIdx;
@@ -4295,7 +4295,7 @@
         m_entropyCoder->encodePartSize(cu, 0, cu->getDepth(0), true);
         m_entropyCoder->encodePredInfo(cu, 0, true);
         bool bDummy = false;
-        m_entropyCoder->encodeCoeff(cu, 0, cu->getDepth(0), cu->getWidth(0), cu->getHeight(0), bDummy);
+        m_entropyCoder->encodeCoeff(cu, 0, cu->getDepth(0), cu->getCUSize(0), cu->getCUSize(0), bDummy);
         return m_entropyCoder->getNumberOfWrittenBits();
     }
 }
diff -r 01547efd182d -r 1e7709ecd0a0 source/common/param.cpp
--- a/source/common/param.cpp	Wed Mar 05 16:18:38 2014 -0600
+++ b/source/common/param.cpp	Thu Mar 06 11:01:59 2014 +0900
@@ -1040,7 +1040,7 @@
 
     if (ATOMIC_CAS32(&once, 0, 1) == 1)
     {
-        if (param->maxCUSize != g_maxCUWidth)
+        if (param->maxCUSize != g_maxCUSize)
         {
             x265_log(param, X265_LOG_ERROR, "maxCUSize must be the same for all encoders in a single process");
             return -1;
@@ -1049,8 +1049,7 @@
     else
     {
         // set max CU width & height
-        g_maxCUWidth  = param->maxCUSize;
-        g_maxCUHeight = param->maxCUSize;
+        g_maxCUSize = param->maxCUSize;
 
         // compute actual CU depth with respect to config depth and max transform size
         g_addCUDepth = 0;
@@ -1066,10 +1065,10 @@
         // initialize partition order
         uint32_t* tmp = &g_zscanToRaster[0];
         initZscanToRaster(g_maxCUDepth + 1, 1, 0, tmp);
-        initRasterToZscan(g_maxCUWidth, g_maxCUHeight, g_maxCUDepth + 1);
+        initRasterToZscan(g_maxCUSize, g_maxCUSize, g_maxCUDepth + 1);
 
         // initialize conversion matrix from partition index to pel
-        initRasterToPelXY(g_maxCUWidth, g_maxCUHeight, g_maxCUDepth + 1);
+        initRasterToPelXY(g_maxCUSize, g_maxCUSize, g_maxCUDepth + 1);
     }
     return 0;
 }
diff -r 01547efd182d -r 1e7709ecd0a0 source/encoder/compress.cpp
--- a/source/encoder/compress.cpp	Wed Mar 05 16:18:38 2014 -0600
+++ b/source/encoder/compress.cpp	Thu Mar 06 11:01:59 2014 +0900
@@ -66,7 +66,7 @@
 
     // Encode Coefficients
     bool bCodeDQP = getdQPFlag();
-    m_entropyCoder->encodeCoeff(cu, 0, depth, cu->getWidth(0), cu->getHeight(0), bCodeDQP);
+    m_entropyCoder->encodeCoeff(cu, 0, depth, cu->getCUSize(0), cu->getCUSize(0), bCodeDQP);
     setdQPFlag(bCodeDQP);
 
     m_rdGoOnSbacCoder->store(m_rdSbacCoders[depth][CI_TEMP_BEST]);
@@ -84,7 +84,7 @@
     cu->setCUTransquantBypassSubParts(m_cfg->m_CUTransquantBypassFlagValue, 0, depth);
 
     uint32_t initTrDepth = cu->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1;
-    uint32_t width       = cu->getWidth(0) >> initTrDepth;
+    uint32_t width       = cu->getCUSize(0) >> initTrDepth;
     uint32_t partOffset  = 0;
 
     // Reference sample smoothing
@@ -204,7 +204,7 @@
     //do motion compensation only for Luma since luma cost alone is calculated
     outTempCU->m_totalBits = 0;
     m_search->predInterSearch(outTempCU, outPredYuv, bUseMRG, true, false);
-    int part =  g_convertToBit[outTempCU->getWidth(0)];
+    int part =  g_convertToBit[outTempCU->getCUSize(0)];
     uint32_t distortion = primitives.sa8d[part](m_origYuv[depth]->getLumaAddr(), m_origYuv[depth]->getStride(),
                                                 outPredYuv->getLumaAddr(), outPredYuv->getStride());
     outTempCU->m_totalDistortion = distortion;
@@ -235,7 +235,7 @@
     outBestCU->setPredModeSubParts(MODE_INTER, 0, depth);
     outBestCU->setMergeFlag(0, true);
 
-    int part = g_convertToBit[outTempCU->getWidth(0)];
+    int part = g_convertToBit[outTempCU->getCUSize(0)];
     int bestMergeCand = -1;
     uint32_t bitsCand = 0;
 
@@ -347,9 +347,9 @@
     bool bSubBranch = true;
     bool bBoundary = false;
     uint32_t lpelx = outTempCU->getCUPelX();
-    uint32_t rpelx = lpelx + outTempCU->getWidth(0)  - 1;
+    uint32_t rpelx = lpelx + outTempCU->getCUSize(0) - 1;
     uint32_t tpely = outTempCU->getCUPelY();
-    uint32_t bpely = tpely + outTempCU->getHeight(0) - 1;
+    uint32_t bpely = tpely + outTempCU->getCUSize(0) - 1;
     TComDataCU* subTempPartCU, * subBestPartCU;
     int qp = outTempCU->getQP(0);
 
@@ -570,7 +570,7 @@
                             m_search->motionCompensation(outBestCU, m_bestPredYuv[depth], REF_PIC_LIST_X, partIdx, false, true);
                         }
 
-                        m_tmpResiYuv[depth]->subtract(m_origYuv[depth], m_bestPredYuv[depth], 0, outBestCU->getWidth(0));
+                        m_tmpResiYuv[depth]->subtract(m_origYuv[depth], m_bestPredYuv[depth], 0, outBestCU->getCUSize(0));
                         m_search->generateCoeffRecon(outBestCU, m_origYuv[depth], m_bestPredYuv[depth], m_tmpResiYuv[depth], m_bestRecoYuv[depth], false);
                     }
                     else
@@ -744,7 +744,7 @@
         else
             outTempCU->m_totalCost = m_rdCost->calcRdSADCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits);
 
-        if ((g_maxCUWidth >> depth) == outTempCU->getSlice()->getPPS()->getMinCuDQPSize() && outTempCU->getSlice()->getPPS()->getUseDQP())
+        if ((g_maxCUSize >> depth) == outTempCU->getSlice()->getPPS()->getMinCuDQPSize() && outTempCU->getSlice()->getPPS()->getUseDQP())
         {
             bool hasResidual = false;
             for (uint32_t uiBlkIdx = 0; uiBlkIdx < outTempCU->getTotalNumPart(); uiBlkIdx++)
@@ -866,7 +866,7 @@
             uint32_t src2stride = m_bestPredYuv[0]->getStride();
             uint32_t src1stride = m_origYuv[0]->getStride();
             uint32_t dststride = m_tmpResiYuv[depth]->m_width;
-            int part = partitionFromSizes(cu->getWidth(0), cu->getWidth(0));
+            int part = partitionFromSizes(cu->getCUSize(0), cu->getCUSize(0));
             primitives.luma_sub_ps[part](dst, dststride, src1, src2, src1stride, src2stride);
 
             src2 = m_bestPredYuv[0]->getCbAddr(absPartIdx);
@@ -924,7 +924,7 @@
 
         //Generate Recon
         TComPicYuv* rec = lcu->getPic()->getPicYuvRec();
-        int part = partitionFromSizes(cu->getWidth(0), cu->getWidth(0));
+        int part = partitionFromSizes(cu->getCUSize(0), cu->getCUSize(0));
         Pel* src = m_bestPredYuv[0]->getLumaAddr(absPartIdx);
         Pel* dst = rec->getLumaAddr(cu->getAddr(), absPartIdx);
         uint32_t srcstride = m_bestPredYuv[0]->getStride();
diff -r 01547efd182d -r 1e7709ecd0a0 source/encoder/cturow.cpp
--- a/source/encoder/cturow.cpp	Wed Mar 05 16:18:38 2014 -0600
+++ b/source/encoder/cturow.cpp	Thu Mar 06 11:01:59 2014 +0900
@@ -63,7 +63,7 @@
     m_search.setRDGoOnSbacCoder(&m_rdGoOnSbacCoder);
 
     return m_search.init(top, &m_rdCost, &m_trQuant) &&
-           m_cuCoder.create((UChar)g_maxCUDepth, g_maxCUWidth);
+           m_cuCoder.create((UChar)g_maxCUDepth, g_maxCUSize);
 }
 
 
diff -r 01547efd182d -r 1e7709ecd0a0 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Wed Mar 05 16:18:38 2014 -0600
+++ b/source/encoder/encoder.cpp	Thu Mar 06 11:01:59 2014 +0900
@@ -179,7 +179,7 @@
 {
     if (m_frameEncoder)
     {
-        int numRows = (param->sourceHeight + g_maxCUHeight - 1) / g_maxCUHeight;
+        int numRows = (param->sourceHeight + g_maxCUSize - 1) / g_maxCUSize;
         for (int i = 0; i < param->frameNumThreads; i++)
         {
             if (!m_frameEncoder[i].init(this, numRows))
@@ -613,7 +613,7 @@
                 }
             }
             // print statistics
-            int cuSize = g_maxCUWidth >> depth;
+            int cuSize = g_maxCUSize >> depth;
             char stats[256] = { 0 };
             int len = 0;
             if (sliceType != I_SLICE)
@@ -989,11 +989,10 @@
     sps->setPicHeightInLumaSamples(param->sourceHeight);
     sps->setConformanceWindow(m_conformanceWindow);
     sps->setChromaFormatIdc(param->internalCsp);
-    sps->setMaxCUWidth(g_maxCUWidth);
-    sps->setMaxCUHeight(g_maxCUHeight);
+    sps->setMaxCUSize(g_maxCUSize);
     sps->setMaxCUDepth(g_maxCUDepth);
 
-    int minCUSize = sps->getMaxCUWidth() >> (sps->getMaxCUDepth() - g_addCUDepth);
+    int minCUSize = sps->getMaxCUSize() >> (sps->getMaxCUDepth() - g_addCUDepth);
     int log2MinCUSize = 0;
     while (minCUSize > 1)
     {
@@ -1131,13 +1130,13 @@
     {
         pps->setUseDQP(true);
         pps->setMaxCuDQPDepth(m_maxCuDQPDepth);
-        pps->setMinCuDQPSize(pps->getSPS()->getMaxCUWidth() >> (pps->getMaxCuDQPDepth()));
+        pps->setMinCuDQPSize(pps->getSPS()->getMaxCUSize() >> (pps->getMaxCuDQPDepth()));
     }
     else
     {
         pps->setUseDQP(false);
         pps->setMaxCuDQPDepth(0);
-        pps->setMinCuDQPSize(pps->getSPS()->getMaxCUWidth() >> (pps->getMaxCuDQPDepth()));
+        pps->setMinCuDQPSize(pps->getSPS()->getMaxCUSize() >> (pps->getMaxCuDQPDepth()));
     }
 
     pps->setChromaCbQpOffset(param->cbQpOffset);
diff -r 01547efd182d -r 1e7709ecd0a0 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Wed Mar 05 16:18:38 2014 -0600
+++ b/source/encoder/frameencoder.cpp	Thu Mar 06 11:01:59 2014 +0900
@@ -936,7 +936,7 @@
     range    += 1;                        /* diamond search range check lag */
     range    += 2;                        /* subpel refine */
     range    += NTAPS_LUMA / 2;           /* subpel filter half-length */
-    uint32_t refLagRows = 1 + ((range + g_maxCUHeight - 1) / g_maxCUHeight);
+    uint32_t refLagRows = 1 + ((range + g_maxCUSize - 1) / g_maxCUSize);
     int numPredDir = slice->isInterP() ? 1 : slice->isInterB() ? 2 : 0;
 
     m_pic->m_SSDY = 0;
@@ -1156,7 +1156,7 @@
     double qp_offset = 0;
     int maxBlockCols = (pic->getPicYuvOrg()->getWidth() + (16 - 1)) / 16;
     int maxBlockRows = (pic->getPicYuvOrg()->getHeight() + (16 - 1)) / 16;
-    int noOfBlocks = g_maxCUWidth / 16;
+    int noOfBlocks = g_maxCUSize / 16;
     int block_y = (cuAddr / pic->getPicSym()->getFrameWidthInCU()) * noOfBlocks;
     int block_x = (cuAddr * noOfBlocks) - block_y * pic->getPicSym()->getFrameWidthInCU();
 
diff -r 01547efd182d -r 1e7709ecd0a0 source/encoder/framefilter.cpp
--- a/source/encoder/framefilter.cpp	Wed Mar 05 16:18:38 2014 -0600
+++ b/source/encoder/framefilter.cpp	Thu Mar 06 11:01:59 2014 +0900
@@ -80,7 +80,7 @@
         m_sao.setSaoLcuBoundary(top->param->saoLcuBoundary);
         m_sao.setSaoLcuBasedOptimization(top->param->saoLcuBasedOptimization);
         m_sao.setMaxNumOffsetsPerPic(top->m_maxNumOffsetsPerPic);
-        m_sao.create(top->param->sourceWidth, top->param->sourceHeight, g_maxCUWidth, g_maxCUHeight, m_cfg->param->internalCsp);
+        m_sao.create(top->param->sourceWidth, top->param->sourceHeight, g_maxCUSize, g_maxCUSize, m_cfg->param->internalCsp);
         m_sao.createEncBuffer();
     }
 
@@ -216,8 +216,8 @@
     const uint32_t numCols = m_pic->getPicSym()->getFrameWidthInCU();
     const uint32_t lineStartCUAddr = row * numCols;
     TComPicYuv *recon = m_pic->getPicYuvRec();
-    const int lastH = ((recon->getHeight() % g_maxCUHeight) ? (recon->getHeight() % g_maxCUHeight) : g_maxCUHeight);
-    const int realH = (row != m_numRows - 1) ? g_maxCUHeight : lastH;
+    const int lastH = ((recon->getHeight() % g_maxCUSize) ? (recon->getHeight() % g_maxCUSize) : g_maxCUSize);
+    const int realH = (row != m_numRows - 1) ? g_maxCUSize : lastH;
 
     // Border extend Left and Right
     primitives.extendRowBorder(recon->getLumaAddr(lineStartCUAddr), recon->getStride(), recon->getWidth(), realH, recon->getLumaMarginX());
@@ -279,9 +279,9 @@
         int height;
 
         if (row == m_numRows - 1)
-            height = ((recon->getHeight() % g_maxCUHeight) ? (recon->getHeight() % g_maxCUHeight) : g_maxCUHeight);
+            height = ((recon->getHeight() % g_maxCUSize) ? (recon->getHeight() % g_maxCUSize) : g_maxCUSize);
         else
-            height = g_maxCUHeight;
+            height = g_maxCUSize;
 
         uint64_t ssdY = computeSSD(orig->getLumaAddr(cuAddr), recon->getLumaAddr(cuAddr), stride, width, height);
         height >>= m_vChromaShift;
@@ -303,8 +303,8 @@
         int stride2 = m_pic->getPicYuvRec()->getStride();
         int bEnd = ((row + 1) == (this->m_numRows - 1));
         int bStart = (row == 0);
-        int minPixY = row * g_maxCUHeight - 4 * !bStart;
-        int maxPixY = (row + 1) * g_maxCUHeight - 4 * !bEnd;
+        int minPixY = row * g_maxCUSize - 4 * !bStart;
+        int maxPixY = (row + 1) * g_maxCUSize - 4 * !bEnd;
         int ssim_cnt;
         x265_emms();
 
@@ -360,7 +360,7 @@
         uint32_t width = recon->getWidth();
         uint32_t height = recon->getCUHeight(row);
         uint32_t stride = recon->getStride();
-        uint32_t cuHeight = g_maxCUHeight;
+        uint32_t cuHeight = g_maxCUSize;
         if (row == 0)
         {
             m_pic->m_checksum[0] = m_pic->m_checksum[1] = m_pic->m_checksum[2] = 0;
diff -r 01547efd182d -r 1e7709ecd0a0 source/encoder/reference.cpp
--- a/source/encoder/reference.cpp	Wed Mar 05 16:18:38 2014 -0600
+++ b/source/encoder/reference.cpp	Thu Mar 06 11:01:59 2014 +0900
@@ -50,7 +50,7 @@
     {
         if (!m_weightBuffer)
         {
-            size_t padheight = (pic->m_numCuInHeight * g_maxCUHeight) + pic->m_lumaMarginY * 2;
+            size_t padheight = (pic->m_numCuInHeight * g_maxCUSize) + pic->m_lumaMarginY * 2;
             m_weightBuffer = X265_MALLOC(pixel, lumaStride * padheight);
             if (!m_weightBuffer)
                 return -1;
@@ -82,12 +82,12 @@
         return;
     int marginX = m_reconPic->m_lumaMarginX;
     int marginY = m_reconPic->m_lumaMarginY;
-    pixel* src = (pixel*)m_reconPic->getLumaAddr() + (m_numWeightedRows * (int)g_maxCUHeight * lumaStride);
-    pixel* dst = fpelPlane + ((m_numWeightedRows * (int)g_maxCUHeight) * lumaStride);
+    pixel* src = (pixel*)m_reconPic->getLumaAddr() + (m_numWeightedRows * (int)g_maxCUSize * lumaStride);
+    pixel* dst = fpelPlane + ((m_numWeightedRows * (int)g_maxCUSize) * lumaStride);
     int width = m_reconPic->getWidth();
-    int height = ((rows - m_numWeightedRows) * g_maxCUHeight);
+    int height = ((rows - m_numWeightedRows) * g_maxCUSize);
     if (rows == numRows)
-        height = ((m_reconPic->getHeight() % g_maxCUHeight) ? (m_reconPic->getHeight() % g_maxCUHeight) : g_maxCUHeight);
+        height = ((m_reconPic->getHeight() % g_maxCUSize) ? (m_reconPic->getHeight() % g_maxCUSize) : g_maxCUSize);
 
     // Computing weighted CU rows
     int correction = IF_INTERNAL_PREC - X265_DEPTH; // intermediate interpolation depth


More information about the x265-devel mailing list