[x265-commits] [x265] rc: rename m_bframes to m_leadingBframes

Aarthi at videolan.org Aarthi at videolan.org
Wed Aug 27 21:55:24 CEST 2014


details:   http://hg.videolan.org/x265/rev/c34b059dff1c
branches:  stable
changeset: 7893:c34b059dff1c
user:      Aarthi Thirumalai
date:      Wed Aug 27 11:23:54 2014 +0530
description:
rc: rename m_bframes to m_leadingBframes
Subject: [x265] rc: fix bitrate accuracy for vbv in fast presets.

details:   http://hg.videolan.org/x265/rev/a6c318bd69ce
branches:  stable
changeset: 7894:a6c318bd69ce
user:      Aarthi Thirumalai
date:      Wed Aug 27 11:29:04 2014 +0530
description:
rc: fix bitrate accuracy for vbv in fast presets.
Subject: [x265] Merge with stable

details:   http://hg.videolan.org/x265/rev/77fe0cc583e8
branches:  
changeset: 7895:77fe0cc583e8
user:      Deepthi Nandakumar <deepthi at multicorewareinc.com>
date:      Wed Aug 27 14:25:17 2014 +0530
description:
Merge with stable
Subject: [x265] rc: fix bug in predicting B frame bits in vbv

details:   http://hg.videolan.org/x265/rev/35b2d9e774c8
branches:  stable
changeset: 7896:35b2d9e774c8
user:      Aarthi Thirumalai
date:      Wed Aug 27 17:52:56 2014 +0530
description:
rc: fix bug in predicting B frame bits in vbv
Subject: [x265] TEncSearch: remove redundant function call

details:   http://hg.videolan.org/x265/rev/5d246ebff000
branches:  
changeset: 7897:5d246ebff000
user:      Ashok Kumar Mishra<ashok at multicorewareinc.com>
date:      Wed Aug 27 19:10:02 2014 +0530
description:
TEncSearch: remove redundant function call
Subject: [x265] mbdst: use fixed buffer allocations, cleanup some tests

details:   http://hg.videolan.org/x265/rev/b5642a14c51f
branches:  
changeset: 7898:b5642a14c51f
user:      Steve Borho <steve at borho.org>
date:      Wed Aug 27 14:24:40 2014 -0500
description:
mbdst: use fixed buffer allocations, cleanup some tests
Subject: [x265] mbdst: add missing test of dequant_scaling

details:   http://hg.videolan.org/x265/rev/d471b6de26c9
branches:  
changeset: 7899:d471b6de26c9
user:      Steve Borho <steve at borho.org>
date:      Wed Aug 27 14:34:36 2014 -0500
description:
mbdst: add missing test of dequant_scaling
Subject: [x265] docs: fix a typo

details:   http://hg.videolan.org/x265/rev/ce614aebb395
branches:  stable
changeset: 7900:ce614aebb395
user:      Steve Borho <steve at borho.org>
date:      Wed Aug 27 14:42:55 2014 -0500
description:
docs: fix a typo
Subject: [x265] Merge with stable

details:   http://hg.videolan.org/x265/rev/5426270aee62
branches:  
changeset: 7901:5426270aee62
user:      Steve Borho <steve at borho.org>
date:      Wed Aug 27 14:54:30 2014 -0500
description:
Merge with stable

diffstat:

 doc/reST/cli.rst                                    |     2 +-
 doc/reST/introduction.rst                           |     4 +-
 source/Lib/TLibCommon/CommonDef.h                   |     9 +-
 source/Lib/TLibCommon/TComDataCU.cpp                |   252 +-
 source/Lib/TLibCommon/TComDataCU.h                  |    11 +-
 source/Lib/TLibCommon/TComMotionInfo.h              |     7 -
 source/Lib/TLibCommon/TComPattern.cpp               |    12 +-
 source/Lib/TLibCommon/TComPattern.h                 |     2 +-
 source/Lib/TLibCommon/TComPicSym.cpp                |    45 +-
 source/Lib/TLibCommon/TComPicSym.h                  |    28 +-
 source/Lib/TLibCommon/TComPicYuv.cpp                |    15 +-
 source/Lib/TLibCommon/TComPicYuv.h                  |     4 +-
 source/Lib/TLibCommon/TComRom.cpp                   |   106 +-
 source/Lib/TLibCommon/TComRom.h                     |    30 +-
 source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp  |  1329 ---------
 source/Lib/TLibCommon/TComSampleAdaptiveOffset.h    |   233 -
 source/Lib/TLibCommon/TComYuv.h                     |    12 +-
 source/Lib/TLibCommon/TypeDef.h                     |     1 -
 source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp |  1729 ------------
 source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h   |   119 -
 source/Lib/TLibEncoder/TEncSearch.cpp               |   368 +-
 source/Lib/TLibEncoder/TEncSearch.h                 |     2 +-
 source/common/CMakeLists.txt                        |     2 -
 source/common/common.h                              |   100 +
 source/common/deblock.cpp                           |    49 +-
 source/common/deblock.h                             |     2 +-
 source/common/frame.cpp                             |     4 +-
 source/common/frame.h                               |     4 -
 source/common/param.cpp                             |    31 +-
 source/common/quant.cpp                             |    10 +-
 source/common/shortyuv.h                            |    10 +-
 source/common/slice.cpp                             |    23 +
 source/common/slice.h                               |     3 +-
 source/common/x86/pixel-util8.asm                   |    62 +-
 source/common/x86/x86inc.asm                        |    41 +-
 source/encoder/CMakeLists.txt                       |     3 +-
 source/encoder/analysis.cpp                         |   357 +-
 source/encoder/analysis.h                           |    32 +-
 source/encoder/bitcost.h                            |    10 +-
 source/encoder/cturow.cpp                           |     8 +-
 source/encoder/cturow.h                             |    20 +-
 source/encoder/dpb.cpp                              |     2 +
 source/encoder/encoder.cpp                          |    59 +-
 source/encoder/encoder.h                            |     1 -
 source/encoder/entropy.cpp                          |   167 +-
 source/encoder/entropy.h                            |    19 +-
 source/encoder/frameencoder.cpp                     |   102 +-
 source/encoder/frameencoder.h                       |    60 +-
 source/encoder/framefilter.cpp                      |   174 +-
 source/encoder/framefilter.h                        |    47 +-
 source/encoder/ratecontrol.cpp                      |    49 +-
 source/encoder/ratecontrol.h                        |     2 +-
 source/encoder/sao.cpp                              |  2602 +++++++++++++++++++
 source/encoder/sao.h                                |   179 +
 source/test/mbdstharness.cpp                        |   167 +-
 source/test/mbdstharness.h                          |    31 +-
 56 files changed, 4003 insertions(+), 4749 deletions(-)

diffs (truncated from 11569 to 300 lines):

diff -r 5fe473327183 -r 5426270aee62 doc/reST/cli.rst
--- a/doc/reST/cli.rst	Mon Aug 25 11:59:51 2014 +0530
+++ b/doc/reST/cli.rst	Wed Aug 27 14:54:30 2014 -0500
@@ -353,7 +353,7 @@ Profile, Level, Tier
 
 .. option:: --high-tier, --no-high-tier
 
-	If :option:`--level-idc` has been specied, the option adds the
+	If :option:`--level-idc` has been specified, the option adds the
 	intention to support the High tier of that level. If your specified
 	level does not support a High tier, a warning is issued and this
 	modifier flag is ignored.
diff -r 5fe473327183 -r 5426270aee62 doc/reST/introduction.rst
--- a/doc/reST/introduction.rst	Mon Aug 25 11:59:51 2014 +0530
+++ b/doc/reST/introduction.rst	Wed Aug 27 14:54:30 2014 -0500
@@ -74,8 +74,8 @@ executable software created from the x26
 responsible for understanding the laws in your country, and for
 licensing all applicable patent rights needed for use or distribution of
 software applications created from the x265 source code.  A good place
-to start is with the Motion Picture Experts Group - Licensing Authority
-- HEVC Licensing Program.
+to start is with the `Motion Picture Experts Group - Licensing Authority
+- HEVC Licensing Program<http://www.mpegla.com/main/PID/HEVC/default.aspx>`_.
 
 x265 is a registered trademark of MulticoreWare, Inc.  The x265 logo is
 a trademark of MulticoreWare, and may only be used with explicit written
diff -r 5fe473327183 -r 5426270aee62 source/Lib/TLibCommon/CommonDef.h
--- a/source/Lib/TLibCommon/CommonDef.h	Mon Aug 25 11:59:51 2014 +0530
+++ b/source/Lib/TLibCommon/CommonDef.h	Wed Aug 27 14:54:30 2014 -0500
@@ -94,14 +94,7 @@
 #define REF_PIC_LIST_X              100
 #define NOT_VALID                   -1
 
-#define MIN_QP                      0
-#define MAX_QP                      51
-#define MAX_MAX_QP                  69
-
-#define MIN_QPSCALE                 0.21249999999999999
-#define MAX_MAX_QPSCALE             615.46574234477100
-
-#define AMVP_MAX_NUM_CANDS          2 // max number of final AMVP candidates
+#define AMVP_NUM_CANDS              2 // number of AMVP candidates
 #define MRG_MAX_NUM_CANDS           5 // max number of final merge candidates
 
 #define MAX_CHROMA_FORMAT_IDC       3 //  TODO: Remove me
diff -r 5fe473327183 -r 5426270aee62 source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp	Mon Aug 25 11:59:51 2014 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.cpp	Wed Aug 27 14:54:30 2014 -0500
@@ -129,7 +129,7 @@ fail:
     return ok;
 }
 
-void TComDataCU::create(TComDataCU *cu, uint32_t numPartition, uint32_t cuSize, int unitSize, int csp, int index, bool isLossless)
+void TComDataCU::create(TComDataCU *cu, uint32_t numPartition, uint32_t cuSize, int csp, int index, bool isLossless)
 {
     m_hChromaShift = CHROMA_H_SHIFT(csp);
     m_vChromaShift = CHROMA_V_SHIFT(csp);
@@ -139,12 +139,6 @@ void TComDataCU::create(TComDataCU *cu, 
     m_slice         = NULL;
     m_numPartitions = numPartition;
 
-    uint32_t tmp = 4 * AMVP_DECIMATION_FACTOR / unitSize;
-    tmp = tmp * tmp;
-    X265_CHECK(tmp == (1 << (g_log2Size[tmp])), "unexpected pixel count\n");
-    tmp = g_log2Size[tmp];
-    m_unitMask = ~((1 << tmp) - 1);
-
     uint32_t sizeL = cuSize * cuSize;
     uint32_t sizeC = sizeL >> (m_hChromaShift + m_vChromaShift);
 
@@ -577,7 +571,7 @@ void TComDataCU::copyPartFrom(TComDataCU
 
 // Copy current predicted part to a CU in picture.
 // It is used to predict for next part
-void TComDataCU::copyToPic(uint8_t depth)
+void TComDataCU::copyToPic(uint32_t depth)
 {
     TComDataCU* cu = m_pic->getCU(m_cuAddr);
 
@@ -622,7 +616,7 @@ void TComDataCU::copyToPic(uint8_t depth
     m_cuMvField[1].copyTo(cu->getCUMvField(REF_PIC_LIST_1), m_absIdxInLCU);
 
     uint32_t tmpY  = 1 << ((g_maxLog2CUSize - depth) * 2);
-    uint32_t tmpY2 = m_absIdxInLCU << m_pic->getLog2UnitSize() * 2;
+    uint32_t tmpY2 = m_absIdxInLCU << LOG2_UNIT_SIZE * 2;
     memcpy(cu->getCoeffY() + tmpY2, m_trCoeff[0], sizeof(coeff_t) * tmpY);
 
     uint32_t tmpC  = tmpY  >> (m_hChromaShift + m_vChromaShift);
@@ -633,7 +627,7 @@ void TComDataCU::copyToPic(uint8_t depth
     if (m_slice->m_pps->bTransquantBypassEnabled)
     {
         uint32_t tmp  = 1 << ((g_maxLog2CUSize - depth) * 2);
-        uint32_t tmp2 = m_absIdxInLCU << m_pic->getLog2UnitSize() * 2;
+        uint32_t tmp2 = m_absIdxInLCU << LOG2_UNIT_SIZE * 2;
         memcpy(cu->getLumaOrigYuv() + tmp2, m_tqBypassOrigYuv[0], sizeof(pixel) * tmp);
 
         memcpy(cu->getChromaOrigYuv(1) + tmpC2, m_tqBypassOrigYuv[1], sizeof(pixel) * tmpC);
@@ -641,7 +635,7 @@ void TComDataCU::copyToPic(uint8_t depth
     }
 }
 
-void TComDataCU::copyCodedToPic(uint8_t depth)
+void TComDataCU::copyCodedToPic(uint32_t depth)
 {
     TComDataCU* cu = m_pic->getCU(m_cuAddr);
 
@@ -660,7 +654,7 @@ void TComDataCU::copyCodedToPic(uint8_t 
     memcpy(cu->getCbf(TEXT_CHROMA_V) + m_absIdxInLCU, m_cbf[2], sizeInChar);
 
     uint32_t tmpY  = 1 << ((g_maxLog2CUSize - depth) * 2);
-    uint32_t tmpY2 = m_absIdxInLCU << m_pic->getLog2UnitSize() * 2;
+    uint32_t tmpY2 = m_absIdxInLCU << LOG2_UNIT_SIZE * 2;
     memcpy(cu->getCoeffY() + tmpY2, m_trCoeff[0], sizeof(coeff_t) * tmpY);
     tmpY  >>= m_hChromaShift + m_vChromaShift;
     tmpY2 >>= m_hChromaShift + m_vChromaShift;
@@ -668,7 +662,7 @@ void TComDataCU::copyCodedToPic(uint8_t 
     memcpy(cu->m_trCoeff[2] + tmpY2, m_trCoeff[2], sizeof(coeff_t) * tmpY);
 }
 
-void TComDataCU::copyToPic(uint8_t depth, uint32_t partIdx, uint32_t partDepth)
+void TComDataCU::copyToPic(uint32_t depth, uint32_t partIdx, uint32_t partDepth)
 {
     TComDataCU* cu = m_pic->getCU(m_cuAddr);
     uint32_t qNumPart  = m_numPartitions >> (partDepth << 1);
@@ -713,7 +707,7 @@ void TComDataCU::copyToPic(uint8_t depth
     m_cuMvField[1].copyTo(cu->getCUMvField(REF_PIC_LIST_1), m_absIdxInLCU, partStart, qNumPart);
 
     uint32_t tmpY  = 1 << ((g_maxLog2CUSize - depth - partDepth) * 2);
-    uint32_t tmpY2 = partOffset << m_pic->getLog2UnitSize() * 2;
+    uint32_t tmpY2 = partOffset << LOG2_UNIT_SIZE * 2;
     memcpy(cu->getCoeffY() + tmpY2, m_trCoeff[0],  sizeof(coeff_t) * tmpY);
 
     uint32_t tmpC  = tmpY >> (m_hChromaShift + m_vChromaShift);
@@ -822,19 +816,19 @@ TComDataCU* TComDataCU::getPUAboveLeft(u
 
 TComDataCU* TComDataCU::getPUAboveRight(uint32_t& arPartUnitIdx, uint32_t curPartUnitIdx)
 {
+    if ((m_pic->getCU(m_cuAddr)->getCUPelX() + g_zscanToPelX[curPartUnitIdx] + UNIT_SIZE) >= m_slice->m_sps->picWidthInLumaSamples)
+        return NULL;
+
     uint32_t absPartIdxRT    = g_zscanToRaster[curPartUnitIdx];
     uint32_t numPartInCUSize = m_pic->getNumPartInCUSize();
 
-    if ((m_pic->getCU(m_cuAddr)->getCUPelX() + g_rasterToPelX[absPartIdxRT] + m_pic->getUnitSize()) >= m_slice->m_sps->picWidthInLumaSamples)
-        return NULL;
-
     if (RasterAddress::lessThanCol(absPartIdxRT, numPartInCUSize - 1, numPartInCUSize))
     {
         if (!RasterAddress::isZeroRow(absPartIdxRT, numPartInCUSize))
         {
             if (curPartUnitIdx > g_rasterToZscan[absPartIdxRT - numPartInCUSize + 1])
             {
-                uint32_t absZorderCUIdx  = g_zscanToRaster[m_absIdxInLCU] + (1 << (m_log2CUSize[0] - m_pic->getLog2UnitSize())) - 1;
+                uint32_t absZorderCUIdx  = g_zscanToRaster[m_absIdxInLCU] + (1 << (m_log2CUSize[0] - LOG2_UNIT_SIZE)) - 1;
                 arPartUnitIdx = g_rasterToZscan[absPartIdxRT - numPartInCUSize + 1];
                 if (RasterAddress::isEqualRowOrCol(absPartIdxRT, absZorderCUIdx, numPartInCUSize))
                 {
@@ -863,14 +857,11 @@ TComDataCU* TComDataCU::getPUAboveRight(
 
 TComDataCU* TComDataCU::getPUBelowLeft(uint32_t& blPartUnitIdx, uint32_t curPartUnitIdx)
 {
-    uint32_t absPartIdxLB     = g_zscanToRaster[curPartUnitIdx];
+    if ((m_pic->getCU(m_cuAddr)->getCUPelY() + g_zscanToPelY[curPartUnitIdx] + UNIT_SIZE) >= m_slice->m_sps->picHeightInLumaSamples)
+        return NULL;
 
-    if ((m_pic->getCU(m_cuAddr)->getCUPelY() + g_rasterToPelY[absPartIdxLB] + m_pic->getUnitSize()) >= m_slice->m_sps->picHeightInLumaSamples)
-    {
-        return NULL;
-    }
-
-    uint32_t numPartInCUSize  = m_pic->getNumPartInCUSize();
+    uint32_t absPartIdxLB    = g_zscanToRaster[curPartUnitIdx];
+    uint32_t numPartInCUSize = m_pic->getNumPartInCUSize();
 
     if (RasterAddress::lessThanRow(absPartIdxLB, numPartInCUSize - 1, numPartInCUSize))
     {
@@ -878,7 +869,7 @@ TComDataCU* TComDataCU::getPUBelowLeft(u
         {
             if (curPartUnitIdx > g_rasterToZscan[absPartIdxLB + numPartInCUSize - 1])
             {
-                uint32_t absZorderCUIdxLB = g_zscanToRaster[m_absIdxInLCU] + ((1 << (m_log2CUSize[0] - m_pic->getLog2UnitSize())) - 1) * m_pic->getNumPartInCUSize();
+                uint32_t absZorderCUIdxLB = g_zscanToRaster[m_absIdxInLCU] + ((1 << (m_log2CUSize[0] - LOG2_UNIT_SIZE)) - 1) * m_pic->getNumPartInCUSize();
                 blPartUnitIdx = g_rasterToZscan[absPartIdxLB + numPartInCUSize - 1];
                 if (RasterAddress::isEqualRowOrCol(absPartIdxLB, absZorderCUIdxLB, numPartInCUSize))
                 {
@@ -901,15 +892,14 @@ TComDataCU* TComDataCU::getPUBelowLeft(u
 
 TComDataCU* TComDataCU::getPUBelowLeftAdi(uint32_t& blPartUnitIdx,  uint32_t curPartUnitIdx, uint32_t partUnitOffset)
 {
-    uint32_t absPartIdxLB     = g_zscanToRaster[curPartUnitIdx];
-
-    if ((m_pic->getCU(m_cuAddr)->getCUPelY() + g_rasterToPelY[absPartIdxLB] + (partUnitOffset << m_pic->getLog2UnitSize())) >=
+    if ((m_pic->getCU(m_cuAddr)->getCUPelY() + g_zscanToPelY[curPartUnitIdx] + (partUnitOffset << LOG2_UNIT_SIZE)) >=
         m_slice->m_sps->picHeightInLumaSamples)
     {
         return NULL;
     }
 
-    uint32_t numPartInCUSize  = m_pic->getNumPartInCUSize();
+    uint32_t absPartIdxLB    = g_zscanToRaster[curPartUnitIdx];
+    uint32_t numPartInCUSize = m_pic->getNumPartInCUSize();
 
     if (RasterAddress::lessThanRow(absPartIdxLB, numPartInCUSize - partUnitOffset, numPartInCUSize))
     {
@@ -917,7 +907,7 @@ TComDataCU* TComDataCU::getPUBelowLeftAd
         {
             if (curPartUnitIdx > g_rasterToZscan[absPartIdxLB + partUnitOffset * numPartInCUSize - 1])
             {
-                uint32_t absZorderCUIdxLB = g_zscanToRaster[m_absIdxInLCU] + ((1 << (m_log2CUSize[0] - m_pic->getLog2UnitSize())) - 1) * m_pic->getNumPartInCUSize();
+                uint32_t absZorderCUIdxLB = g_zscanToRaster[m_absIdxInLCU] + ((1 << (m_log2CUSize[0] - LOG2_UNIT_SIZE)) - 1) * m_pic->getNumPartInCUSize();
                 blPartUnitIdx = g_rasterToZscan[absPartIdxLB + partUnitOffset * numPartInCUSize - 1];
                 if (RasterAddress::isEqualRowOrCol(absPartIdxLB, absZorderCUIdxLB, numPartInCUSize))
                 {
@@ -944,14 +934,13 @@ TComDataCU* TComDataCU::getPUBelowLeftAd
 
 TComDataCU* TComDataCU::getPUAboveRightAdi(uint32_t& arPartUnitIdx, uint32_t curPartUnitIdx, uint32_t partUnitOffset)
 {
-    uint32_t absPartIdxRT    = g_zscanToRaster[curPartUnitIdx];
-
-    if ((m_pic->getCU(m_cuAddr)->getCUPelX() + g_rasterToPelX[absPartIdxRT] + (partUnitOffset << m_pic->getLog2UnitSize())) >=
+    if ((m_pic->getCU(m_cuAddr)->getCUPelX() + g_zscanToPelX[curPartUnitIdx] + (partUnitOffset << LOG2_UNIT_SIZE)) >=
         m_slice->m_sps->picWidthInLumaSamples)
     {
         return NULL;
     }
 
+    uint32_t absPartIdxRT    = g_zscanToRaster[curPartUnitIdx];
     uint32_t numPartInCUSize = m_pic->getNumPartInCUSize();
 
     if (RasterAddress::lessThanCol(absPartIdxRT, numPartInCUSize - partUnitOffset, numPartInCUSize))
@@ -960,7 +949,7 @@ TComDataCU* TComDataCU::getPUAboveRightA
         {
             if (curPartUnitIdx > g_rasterToZscan[absPartIdxRT - numPartInCUSize + partUnitOffset])
             {
-                uint32_t absZorderCUIdx  = g_zscanToRaster[m_absIdxInLCU] + (1 << (m_log2CUSize[0] - m_pic->getLog2UnitSize())) - 1;
+                uint32_t absZorderCUIdx = g_zscanToRaster[m_absIdxInLCU] + (1 << (m_log2CUSize[0] - LOG2_UNIT_SIZE)) - 1;
                 arPartUnitIdx = g_rasterToZscan[absPartIdxRT - numPartInCUSize + partUnitOffset];
                 if (RasterAddress::isEqualRowOrCol(absPartIdxRT, absZorderCUIdx, numPartInCUSize))
                 {
@@ -1004,8 +993,7 @@ TComDataCU* TComDataCU::getPUAboveRightA
 TComDataCU* TComDataCU::getQpMinCuLeft(uint32_t& lPartUnitIdx, uint32_t curAbsIdxInLCU)
 {
     uint32_t numPartInCUSize = m_pic->getNumPartInCUSize();
-    uint32_t absZorderQpMinCUIdx = (curAbsIdxInLCU >> ((g_maxCUDepth - m_slice->m_pps->maxCuDQPDepth) << 1)) <<
-        ((g_maxCUDepth - m_slice->m_pps->maxCuDQPDepth) << 1);
+    uint32_t absZorderQpMinCUIdx = curAbsIdxInLCU & (0xFF << (g_maxFullDepth - m_slice->m_pps->maxCuDQPDepth) * 2);
     uint32_t absRorderQpMinCUIdx = g_zscanToRaster[absZorderQpMinCUIdx];
 
     // check for left LCU boundary
@@ -1029,8 +1017,7 @@ TComDataCU* TComDataCU::getQpMinCuLeft(u
 TComDataCU* TComDataCU::getQpMinCuAbove(uint32_t& aPartUnitIdx, uint32_t curAbsIdxInLCU)
 {
     uint32_t numPartInCUSize = m_pic->getNumPartInCUSize();
-    uint32_t absZorderQpMinCUIdx = (curAbsIdxInLCU >> ((g_maxCUDepth - m_slice->m_pps->maxCuDQPDepth) << 1)) <<
-        ((g_maxCUDepth - m_slice->m_pps->maxCuDQPDepth) << 1);
+    uint32_t absZorderQpMinCUIdx = curAbsIdxInLCU & (0xFF << (g_maxFullDepth - m_slice->m_pps->maxCuDQPDepth) * 2);
     uint32_t absRorderQpMinCUIdx = g_zscanToRaster[absZorderQpMinCUIdx];
 
     // check for top LCU boundary
@@ -1074,7 +1061,7 @@ int TComDataCU::getLastValidPartIdx(int 
 
 char TComDataCU::getLastCodedQP(uint32_t absPartIdx)
 {
-    uint32_t quPartIdxMask = ~((1 << ((g_maxCUDepth - m_slice->m_pps->maxCuDQPDepth) << 1)) - 1);
+    uint32_t quPartIdxMask = 0xFF << (g_maxFullDepth - m_slice->m_pps->maxCuDQPDepth) * 2;
     int lastValidPartIdx = getLastValidPartIdx(absPartIdx & quPartIdxMask);
 
     if (lastValidPartIdx >= 0)
@@ -1526,7 +1513,7 @@ void TComDataCU::getMvField(TComDataCU* 
 void TComDataCU::deriveLeftRightTopIdx(uint32_t partIdx, uint32_t& ruiPartIdxLT, uint32_t& ruiPartIdxRT)
 {
     ruiPartIdxLT = m_absIdxInLCU;
-    ruiPartIdxRT = g_rasterToZscan[g_zscanToRaster[ruiPartIdxLT] + (1 << (m_log2CUSize[0] - m_pic->getLog2UnitSize())) - 1];
+    ruiPartIdxRT = g_rasterToZscan[g_zscanToRaster[ruiPartIdxLT] + (1 << (m_log2CUSize[0] - LOG2_UNIT_SIZE)) - 1];
 
     switch (m_partSizes[0])
     {
@@ -1567,7 +1554,7 @@ void TComDataCU::deriveLeftRightTopIdx(u
 
 void TComDataCU::deriveLeftBottomIdx(uint32_t partIdx, uint32_t& outPartIdxLB)
 {
-    outPartIdxLB = g_rasterToZscan[g_zscanToRaster[m_absIdxInLCU] + ((1 << (m_log2CUSize[0] - m_pic->getLog2UnitSize() - 1)) - 1) * m_pic->getNumPartInCUSize()];
+    outPartIdxLB = g_rasterToZscan[g_zscanToRaster[m_absIdxInLCU] + ((1 << (m_log2CUSize[0] - LOG2_UNIT_SIZE - 1)) - 1) * m_pic->getNumPartInCUSize()];
 
     switch (m_partSizes[0])
     {
@@ -1609,8 +1596,8 @@ void TComDataCU::deriveLeftBottomIdx(uin
 void TComDataCU::deriveRightBottomIdx(uint32_t partIdx, uint32_t& outPartIdxRB)
 {
     outPartIdxRB = g_rasterToZscan[g_zscanToRaster[m_absIdxInLCU] +
-                                   ((1 << (m_log2CUSize[0] - m_pic->getLog2UnitSize() - 1)) - 1) * m_pic->getNumPartInCUSize() +
-                                   (1 << (m_log2CUSize[0] - m_pic->getLog2UnitSize())) - 1];
+                                   ((1 << (m_log2CUSize[0] - LOG2_UNIT_SIZE - 1)) - 1) * m_pic->getNumPartInCUSize() +
+                                   (1 << (m_log2CUSize[0] - LOG2_UNIT_SIZE)) - 1];
 
     switch (m_partSizes[0])
     {
@@ -1646,7 +1633,7 @@ void TComDataCU::deriveRightBottomIdx(ui
 
 void TComDataCU::deriveLeftRightTopIdxAdi(uint32_t& outPartIdxLT, uint32_t& outPartIdxRT, uint32_t partOffset, uint32_t partDepth)


More information about the x265-commits mailing list