[x265-commits] [x265] slicetype: use fast intra scan unconditionally in lookahead

Steve Borho steve at borho.org
Mon Aug 18 20:47:29 CEST 2014


details:   http://hg.videolan.org/x265/rev/c01a334a1043
branches:  
changeset: 7805:c01a334a1043
user:      Steve Borho <steve at borho.org>
date:      Sat Aug 16 11:58:04 2014 -0500
description:
slicetype: use fast intra scan unconditionally in lookahead

We don't want the lookahead output to be variable depending on --fast-intra
since this would make two-pass turbo mode more difficult.
Subject: [x265] param: enable --fast-intra for all fast modes and turbo first-pass, document

details:   http://hg.videolan.org/x265/rev/866f21378d94
branches:  
changeset: 7806:866f21378d94
user:      Steve Borho <steve at borho.org>
date:      Sat Aug 16 12:12:55 2014 -0500
description:
param: enable --fast-intra for all fast modes and turbo first-pass, document
Subject: [x265] merge with default, feature freeze for 1.3

details:   http://hg.videolan.org/x265/rev/24a79f4d6f72
branches:  stable
changeset: 7807:24a79f4d6f72
user:      Steve Borho <steve at borho.org>
date:      Sat Aug 16 12:13:40 2014 -0500
description:
merge with default, feature freeze for 1.3
Subject: [x265] rest: fix typo, document default psy-rdoq value

details:   http://hg.videolan.org/x265/rev/87400d5c90aa
branches:  stable
changeset: 7808:87400d5c90aa
user:      Steve Borho <steve at borho.org>
date:      Sat Aug 16 12:45:27 2014 -0500
description:
rest: fix typo, document default psy-rdoq value
Subject: [x265] introduction.rst edited online with Bitbucket - added link to MPEG-LA

details:   http://hg.videolan.org/x265/rev/bff42bfd0652
branches:  
changeset: 7809:bff42bfd0652
user:      Tom Vaughan <tom.vaughan at multicorewareinc.com>
date:      Mon Aug 18 05:32:40 2014 +0000
description:
introduction.rst edited online with Bitbucket - added link to MPEG-LA
Subject: [x265] introduction.rst edited online with Bitbucket

details:   http://hg.videolan.org/x265/rev/9a0d24274357
branches:  
changeset: 7810:9a0d24274357
user:      Tom Vaughan <tom.vaughan at multicorewareinc.com>
date:      Mon Aug 18 05:34:51 2014 +0000
description:
introduction.rst edited online with Bitbucket
Subject: [x265] analysis: missing braces caused a bug in CABAC context save for rd=2

details:   http://hg.videolan.org/x265/rev/5d5a4c09182d
branches:  stable
changeset: 7811:5d5a4c09182d
user:      Deepthi Nandakumar <deepthi at multicorewareinc.com>
date:      Mon Aug 18 16:06:54 2014 +0530
description:
analysis: missing braces caused a bug in CABAC context save for rd=2
Subject: [x265] Merge with stable

details:   http://hg.videolan.org/x265/rev/2c68dc7e3827
branches:  
changeset: 7812:2c68dc7e3827
user:      Deepthi Nandakumar <deepthi at multicorewareinc.com>
date:      Mon Aug 18 16:08:12 2014 +0530
description:
Merge with stable
Subject: [x265] analysis: move encodeCU() methods and friends to Entropy

details:   http://hg.videolan.org/x265/rev/bb6ea1337d82
branches:  
changeset: 7813:bb6ea1337d82
user:      Steve Borho <steve at borho.org>
date:      Sat Aug 16 13:26:23 2014 -0500
description:
analysis: move encodeCU() methods and friends to Entropy

This function only encodes a fully finished CTU; it is performing no analysis
and it needs none of the features or members of the Analysis class. It is much
more clear as a member of the Entropy class.

Note: the way bEncodeDQP is communicated is a huge mess and needs to be cleaned
up soon. And finishCU() can also likely be hugely simplified
Subject: [x265] ctu: optimize away per-row bitstream coders, no output changes

details:   http://hg.videolan.org/x265/rev/dd594e7362e2
branches:  
changeset: 7814:dd594e7362e2
user:      Steve Borho <steve at borho.org>
date:      Sat Aug 16 14:16:39 2014 -0500
description:
ctu: optimize away per-row bitstream coders, no output changes

They were really only being used to hold the proper initial state for each
row. This avoids an entropy load/save per CU in encodeSlice() and while I was
in the area I removed another pile of resetEntropy() calls.  The initial slice
entropy state is calculated once and then kept in the frame encoder for all
future uses.
Subject: [x265] cli: update psy-rdoq rangw in CLI help

details:   http://hg.videolan.org/x265/rev/cda8e5c21a9b
branches:  stable
changeset: 7815:cda8e5c21a9b
user:      Steve Borho <steve at borho.org>
date:      Mon Aug 18 11:11:30 2014 -0500
description:
cli: update psy-rdoq rangw in CLI help
Subject: [x265] param: add psy-rd and psy-rdoq to param2string (for info SEI and stats file)

details:   http://hg.videolan.org/x265/rev/0e4558e42ccc
branches:  stable
changeset: 7816:0e4558e42ccc
user:      Steve Borho <steve at borho.org>
date:      Mon Aug 18 11:13:44 2014 -0500
description:
param: add psy-rd and psy-rdoq to param2string (for info SEI and stats file)
Subject: [x265] cli: fix help syntax

details:   http://hg.videolan.org/x265/rev/6a1b41049f71
branches:  stable
changeset: 7817:6a1b41049f71
user:      Steve Borho <steve at borho.org>
date:      Mon Aug 18 11:45:29 2014 -0500
description:
cli: fix help syntax
Subject: [x265] refine depth related.

details:   http://hg.videolan.org/x265/rev/0eab29da63d3
branches:  
changeset: 7818:0eab29da63d3
user:      Satoshi Nakagawa <nakagawa424 at oki.com>
date:      Mon Aug 18 16:33:59 2014 +0900
description:
refine depth related.

maxCUDepth:	CU depth
maxFullDepth:	CU+TU or CU+PU depth
unitSize:	always 4
Subject: [x265] encoder: remove m_maxCuDQPDepth, simplify dqp logic

details:   http://hg.videolan.org/x265/rev/9f038f7a2eb6
branches:  
changeset: 7819:9f038f7a2eb6
user:      Steve Borho <steve at borho.org>
date:      Mon Aug 18 12:37:13 2014 -0500
description:
encoder: remove m_maxCuDQPDepth, simplify dqp logic
Subject: [x265] Merge with stable

details:   http://hg.videolan.org/x265/rev/13651e65b820
branches:  
changeset: 7820:13651e65b820
user:      Steve Borho <steve at borho.org>
date:      Mon Aug 18 13:46:39 2014 -0500
description:
Merge with stable

diffstat:

 doc/reST/cli.rst                                   |   17 +-
 doc/reST/introduction.rst                          |    4 +-
 doc/reST/presets.rst                               |    2 +
 source/Lib/TLibCommon/TComDataCU.cpp               |   75 +--
 source/Lib/TLibCommon/TComDataCU.h                 |    9 +-
 source/Lib/TLibCommon/TComPattern.cpp              |    4 +-
 source/Lib/TLibCommon/TComPicSym.cpp               |   14 +-
 source/Lib/TLibCommon/TComPicSym.h                 |    7 -
 source/Lib/TLibCommon/TComPicYuv.cpp               |   15 +-
 source/Lib/TLibCommon/TComPicYuv.h                 |    2 +-
 source/Lib/TLibCommon/TComRom.cpp                  |   42 +-
 source/Lib/TLibCommon/TComRom.h                    |   22 +-
 source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp |    5 +-
 source/Lib/TLibEncoder/TEncSearch.cpp              |   48 +-
 source/common/deblock.cpp                          |   31 +-
 source/common/deblock.h                            |    2 +-
 source/common/frame.cpp                            |    4 +-
 source/common/frame.h                              |    4 -
 source/common/param.cpp                            |   35 +-
 source/common/slice.h                              |    1 -
 source/encoder/analysis.cpp                        |  349 ++++++--------------
 source/encoder/analysis.h                          |   32 +-
 source/encoder/cturow.cpp                          |    8 +-
 source/encoder/cturow.h                            |   20 +-
 source/encoder/encoder.cpp                         |   47 +-
 source/encoder/encoder.h                           |    1 -
 source/encoder/entropy.cpp                         |  151 ++++++++-
 source/encoder/entropy.h                           |    6 +-
 source/encoder/frameencoder.cpp                    |   53 +-
 source/encoder/frameencoder.h                      |    1 +
 source/encoder/slicetype.cpp                       |   80 +---
 source/x265.cpp                                    |    4 +-
 32 files changed, 502 insertions(+), 593 deletions(-)

diffs (truncated from 2605 to 300 lines):

diff -r 184748d40276 -r 13651e65b820 doc/reST/cli.rst
--- a/doc/reST/cli.rst	Fri Aug 15 20:13:04 2014 -0500
+++ b/doc/reST/cli.rst	Mon Aug 18 13:46:39 2014 -0500
@@ -536,6 +536,15 @@ Mode decision / Analysis
 	the encoder from perhaps finding other predictions that also have no
 	residual but require less signaling bits. Default disabled
 
+.. option:: --fast-intra, --no-fast-intra
+
+	Perform an initial scan of every fifth intra angular mode, then
+	check modes +/- 2 distance from the best mode, then +/- 1 distance
+	from the best mode, effectively performing a gradient descent. When
+	enabled 10 modes in total are checked. When disabled all 33 angular
+	modes are checked.  Only applicable for :option:`--rd` levels 3 and
+	below (medium preset and faster).
+
 .. option:: --weightp, -w, --no-weightp
 
 	Enable weighted prediction in P slices. This enables weighting
@@ -595,8 +604,8 @@ Mode decision / Analysis
 	must be toggled, and then to determine which one can be toggled with
 	the least amount of distortion. Default enabled
  
-Pycho-visual options
-====================
+Psycho-visual options
+=====================
 
 Left to its own devices, the encoder will make mode decisions based on a
 simple rate distortion formula, trading distortion for bitrate. This is
@@ -659,7 +668,8 @@ psycho-visual settings.
 	energy in the reconstructed image. This generally improves perceived
 	visual quality at the cost of lower quality metric scores.  It only
 	has effect on slower presets which use RDO Quantization
-	(:option:`--rd` 4, 5 and 6). 1.0 is a typical value. Experimental
+	(:option:`--rd` 4, 5 and 6). 1.0 is a typical value. Default
+	disabled. Experimental
 
 	**Range of values:** 0 .. 10.0
 
@@ -898,6 +908,7 @@ Quality, rate control and rate distortio
 	When **turbo** first pass is not disabled, these options are
 	set on the first pass to improve performance:
 	
+	* :option:`--fast-intra`
 	* :option:`--no-rect`
 	* :option:`--no-amp`
 	* :option:`--early-skip`
diff -r 184748d40276 -r 13651e65b820 doc/reST/introduction.rst
--- a/doc/reST/introduction.rst	Fri Aug 15 20:13:04 2014 -0500
+++ b/doc/reST/introduction.rst	Mon Aug 18 13:46:39 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 184748d40276 -r 13651e65b820 doc/reST/presets.rst
--- a/doc/reST/presets.rst	Fri Aug 15 20:13:04 2014 -0500
+++ b/doc/reST/presets.rst	Mon Aug 18 13:46:39 2014 -0500
@@ -48,6 +48,8 @@ The presets adjust encoder parameters to
 +--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
 | early-skip   |    1      |     1     |    1     |   1    |  0   |    0   |  0   |   0    |    0     |    0    |
 +--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
+| fast-intra   |    1      |     1     |    1     |   1    |  1   |    0   |  0   |   0    |    0     |    0    |
++--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
 | fast-cbf     |    1      |     1     |    1     |   1    |  0   |    0   |  0   |   0    |    0     |    0    |
 +--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
 | sao          |    0      |     1     |    1     |   1    |  1   |    1   |  1   |   1    |    1     |    1    |
diff -r 184748d40276 -r 13651e65b820 source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp	Fri Aug 15 20:13:04 2014 -0500
+++ b/source/Lib/TLibCommon/TComDataCU.cpp	Mon Aug 18 13:46:39 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);
@@ -825,7 +819,7 @@ TComDataCU* TComDataCU::getPUAboveRight(
     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)
+    if ((m_pic->getCU(m_cuAddr)->getCUPelX() + g_rasterToPelX[absPartIdxRT] + UNIT_SIZE) >= m_slice->m_sps->picWidthInLumaSamples)
         return NULL;
 
     if (RasterAddress::lessThanCol(absPartIdxRT, numPartInCUSize - 1, numPartInCUSize))
@@ -834,7 +828,7 @@ TComDataCU* TComDataCU::getPUAboveRight(
         {
             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))
                 {
@@ -865,7 +859,7 @@ TComDataCU* TComDataCU::getPUBelowLeft(u
 {
     uint32_t absPartIdxLB     = g_zscanToRaster[curPartUnitIdx];
 
-    if ((m_pic->getCU(m_cuAddr)->getCUPelY() + g_rasterToPelY[absPartIdxLB] + m_pic->getUnitSize()) >= m_slice->m_sps->picHeightInLumaSamples)
+    if ((m_pic->getCU(m_cuAddr)->getCUPelY() + g_rasterToPelY[absPartIdxLB] + UNIT_SIZE) >= m_slice->m_sps->picHeightInLumaSamples)
     {
         return NULL;
     }
@@ -878,7 +872,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))
                 {
@@ -903,7 +897,7 @@ TComDataCU* TComDataCU::getPUBelowLeftAd
 {
     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_rasterToPelY[absPartIdxLB] + (partUnitOffset << LOG2_UNIT_SIZE)) >=
         m_slice->m_sps->picHeightInLumaSamples)
     {
         return NULL;
@@ -917,7 +911,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))
                 {
@@ -946,7 +940,7 @@ TComDataCU* TComDataCU::getPUAboveRightA
 {
     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_rasterToPelX[absPartIdxRT] + (partUnitOffset << LOG2_UNIT_SIZE)) >=
         m_slice->m_sps->picWidthInLumaSamples)
     {
         return NULL;
@@ -960,7 +954,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 +998,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 +1022,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 +1066,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 +1518,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 +1559,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 +1601,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 +1638,7 @@ void TComDataCU::deriveRightBottomIdx(ui
 
 void TComDataCU::deriveLeftRightTopIdxAdi(uint32_t& outPartIdxLT, uint32_t& outPartIdxRT, uint32_t partOffset, uint32_t partDepth)
 {
-    uint32_t numPartInWidth = 1 << (m_log2CUSize[0] - m_pic->getLog2UnitSize() - partDepth);
+    uint32_t numPartInWidth = 1 << (m_log2CUSize[0] - LOG2_UNIT_SIZE - partDepth);
 
     outPartIdxLT = m_absIdxInLCU + partOffset;


More information about the x265-commits mailing list