[x265] [PATCH 4 of 7] replace g_unitSizeDepth with param member

kavitha at multicorewareinc.com kavitha at multicorewareinc.com
Wed Jun 21 08:44:54 CEST 2017


# HG changeset patch
# User Kavitha Sampath <kavitha at multicorewareinc.com>
# Date 1496122105 -19800
#      Tue May 30 10:58:25 2017 +0530
# Node ID 005dfda46203772f81f94a28dd86b6303aadfef5
# Parent  3b0883b24cd21a2aea3fc4bf82467df717c2e39c
replace g_unitSizeDepth with param member

diff -r 3b0883b24cd2 -r 005dfda46203 source/CMakeLists.txt
--- a/source/CMakeLists.txt	Tue May 30 10:45:50 2017 +0530
+++ b/source/CMakeLists.txt	Tue May 30 10:58:25 2017 +0530
@@ -29,7 +29,7 @@
 option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)
 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 124)
+set(X265_BUILD 125)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
                "${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r 3b0883b24cd2 -r 005dfda46203 source/common/cudata.cpp
--- a/source/common/cudata.cpp	Tue May 30 10:45:50 2017 +0530
+++ b/source/common/cudata.cpp	Tue May 30 10:58:25 2017 +0530
@@ -129,7 +129,7 @@
 
     if (!s_partSet[0])
     {
-        s_numPartInCUSize = 1 << g_unitSizeDepth;
+        s_numPartInCUSize = 1 << param.unitSizeDepth;
         switch (param.maxLog2CUSize)
         {
         case 6:
@@ -801,7 +801,7 @@
 /* Get left QpMinCu */
 const CUData* CUData::getQpMinCuLeft(uint32_t& lPartUnitIdx, uint32_t curAbsIdxInCTU) const
 {
-    uint32_t absZorderQpMinCUIdx = curAbsIdxInCTU & (0xFF << (g_unitSizeDepth - m_slice->m_pps->maxCuDQPDepth) * 2);
+    uint32_t absZorderQpMinCUIdx = curAbsIdxInCTU & (0xFF << (m_encData->m_param->unitSizeDepth - m_slice->m_pps->maxCuDQPDepth) * 2);
     uint32_t absRorderQpMinCUIdx = g_zscanToRaster[absZorderQpMinCUIdx];
 
     // check for left CTU boundary
@@ -818,7 +818,7 @@
 /* Get above QpMinCu */
 const CUData* CUData::getQpMinCuAbove(uint32_t& aPartUnitIdx, uint32_t curAbsIdxInCTU) const
 {
-    uint32_t absZorderQpMinCUIdx = curAbsIdxInCTU & (0xFF << (g_unitSizeDepth - m_slice->m_pps->maxCuDQPDepth) * 2);
+    uint32_t absZorderQpMinCUIdx = curAbsIdxInCTU & (0xFF << (m_encData->m_param->unitSizeDepth - m_slice->m_pps->maxCuDQPDepth) * 2);
     uint32_t absRorderQpMinCUIdx = g_zscanToRaster[absZorderQpMinCUIdx];
 
     // check for top CTU boundary
@@ -857,7 +857,7 @@
 
 int8_t CUData::getLastCodedQP(uint32_t absPartIdx) const
 {
-    uint32_t quPartIdxMask = 0xFF << (g_unitSizeDepth - m_slice->m_pps->maxCuDQPDepth) * 2;
+    uint32_t quPartIdxMask = 0xFF << (m_encData->m_param->unitSizeDepth - m_slice->m_pps->maxCuDQPDepth) * 2;
     int lastValidPartIdx = getLastValidPartIdx(absPartIdx & quPartIdxMask);
 
     if (lastValidPartIdx >= 0)
diff -r 3b0883b24cd2 -r 005dfda46203 source/common/cudata.h
--- a/source/common/cudata.h	Tue May 30 10:45:50 2017 +0530
+++ b/source/common/cudata.h	Tue May 30 10:58:25 2017 +0530
@@ -271,7 +271,7 @@
     void     getInterTUQtDepthRange(uint32_t tuDepthRange[2], uint32_t absPartIdx) const;
     uint32_t getBestRefIdx(uint32_t subPartIdx) const { return ((m_interDir[subPartIdx] & 1) << m_refIdx[0][subPartIdx]) | 
                                                               (((m_interDir[subPartIdx] >> 1) & 1) << (m_refIdx[1][subPartIdx] + 16)); }
-    uint32_t getPUOffset(uint32_t puIdx, uint32_t absPartIdx) const { return (partAddrTable[(int)m_partSize[absPartIdx]][puIdx] << (g_unitSizeDepth - m_cuDepth[absPartIdx]) * 2) >> 4; }
+    uint32_t getPUOffset(uint32_t puIdx, uint32_t absPartIdx) const { return (partAddrTable[(int)m_partSize[absPartIdx]][puIdx] << (m_slice->m_param->unitSizeDepth - m_cuDepth[absPartIdx]) * 2) >> 4; }
 
     uint32_t getNumPartInter(uint32_t absPartIdx) const              { return nbPartsTable[(int)m_partSize[absPartIdx]]; }
     bool     isIntra(uint32_t absPartIdx) const   { return m_predMode[absPartIdx] == MODE_INTRA; }
@@ -285,7 +285,7 @@
     void     getAllowedChromaDir(uint32_t absPartIdx, uint32_t* modeList) const;
     int      getIntraDirLumaPredictor(uint32_t absPartIdx, uint32_t* intraDirPred) const;
 
-    uint32_t getSCUAddr() const                  { return (m_cuAddr << g_unitSizeDepth * 2) + m_absIdxInCTU; }
+    uint32_t getSCUAddr() const                  { return (m_cuAddr << m_slice->m_param->unitSizeDepth * 2) + m_absIdxInCTU; }
     uint32_t getCtxSplitFlag(uint32_t absPartIdx, uint32_t depth) const;
     uint32_t getCtxSkipFlag(uint32_t absPartIdx) const;
     void     getTUEntropyCodingParameters(TUEntropyCodingParameters &result, uint32_t absPartIdx, uint32_t log2TrSize, bool bIsLuma) const;
diff -r 3b0883b24cd2 -r 005dfda46203 source/common/picyuv.cpp
--- a/source/common/picyuv.cpp	Tue May 30 10:45:50 2017 +0530
+++ b/source/common/picyuv.cpp	Tue May 30 10:58:25 2017 +0530
@@ -146,7 +146,7 @@
  * allocated by the same encoder. */
 bool PicYuv::createOffsets(const SPS& sps)
 {
-    uint32_t numPartitions = 1 << (g_unitSizeDepth * 2);
+    uint32_t numPartitions = 1 << (m_param->unitSizeDepth * 2);
 
     if (m_picCsp != X265_CSP_I400)
     {
diff -r 3b0883b24cd2 -r 005dfda46203 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Tue May 30 10:45:50 2017 +0530
+++ b/source/encoder/encoder.cpp	Tue May 30 10:58:25 2017 +0530
@@ -1986,7 +1986,7 @@
     sps->numCuInHeight = (m_param->sourceHeight + m_param->maxCUSize - 1) / m_param->maxCUSize;
     sps->numCUsInFrame = sps->numCuInWidth * sps->numCuInHeight;
     sps->numPartitions = NUM_4x4_PARTITIONS;
-    sps->numPartInCUSize = 1 << g_unitSizeDepth;
+    sps->numPartInCUSize = 1 << m_param->unitSizeDepth;
 
     sps->log2MinCodingBlockSize = m_param->maxLog2CUSize - m_param->maxCUDepth;
     sps->log2DiffMaxMinCodingBlockSize = m_param->maxCUDepth;
@@ -2644,6 +2644,7 @@
     }
     p->maxLog2CUSize = g_log2Size[p->maxCUSize];
     p->maxCUDepth    = p->maxLog2CUSize - g_log2Size[p->minCUSize];
+    p->unitSizeDepth = p->maxLog2CUSize - LOG2_UNIT_SIZE;
 }
 
 void Encoder::allocAnalysis(x265_analysis_data* analysis)
diff -r 3b0883b24cd2 -r 005dfda46203 source/x265.h
--- a/source/x265.h	Tue May 30 10:45:50 2017 +0530
+++ b/source/x265.h	Tue May 30 10:58:25 2017 +0530
@@ -1464,6 +1464,10 @@
 
     /* Actual CU depth with respect to config depth */
     uint32_t  maxCUDepth;
+
+    /* CU depth with respect to maximum transform size */
+    uint32_t  unitSizeDepth;
+
 } x265_param;
 
 /* x265_param_alloc:


More information about the x265-devel mailing list