[x265] [PATCH 1 of 3 REVIEW] rename variable g_maxFullDepth to g_numCUDepth for better clarity

Steve Borho steve at borho.org
Mon Feb 16 03:29:35 CET 2015


On 02/13, santhoshini at multicorewareinc.com wrote:
> # HG changeset patch
> # User Santhoshini Sekar<santhoshini at multicorewareinc.com>
> # Date 1423802090 -19800
> #      Fri Feb 13 10:04:50 2015 +0530
> # Node ID ffb5d5c4dfca93def3bd2fe153070663a63546ea
> # Parent  9ab104096834f51bd799ea1cf1160092f8182944
> rename variable g_maxFullDepth to g_numCUDepth for better clarity
> 
> diff -r 9ab104096834 -r ffb5d5c4dfca source/common/common.h
> --- a/source/common/common.h	Wed Feb 11 16:15:33 2015 -0600
> +++ b/source/common/common.h	Fri Feb 13 10:04:50 2015 +0530
> @@ -257,7 +257,7 @@
>  #define UNIT_SIZE               (1 << LOG2_UNIT_SIZE)       // unit size of CU partition
>  
>  #define MAX_NUM_PARTITIONS      256
> -#define NUM_CU_PARTITIONS       (1U << (g_maxFullDepth << 1))
> +#define NUM_CU_PARTITIONS       (1U << (g_numCUDepth << 1))

The same issue with global variables applies here. If we vary
g_numCUDepth based on the min CU size, then we must enforce all encoders
in the same proxess to use the same min CU size.

>  #define MIN_PU_SIZE             4
>  #define MIN_TU_SIZE             4
> diff -r 9ab104096834 -r ffb5d5c4dfca source/common/constants.cpp
> --- a/source/common/constants.cpp	Wed Feb 11 16:15:33 2015 -0600
> +++ b/source/common/constants.cpp	Fri Feb 13 10:04:50 2015 +0530
> @@ -121,7 +121,7 @@
>  
>  uint32_t g_maxLog2CUSize = MAX_LOG2_CU_SIZE;
>  uint32_t g_maxCUSize     = MAX_CU_SIZE;
> -uint32_t g_maxFullDepth  = NUM_FULL_DEPTH - 1;
> +uint32_t g_numCUDepth  = NUM_CU_DEPTH;

w/s nit

>  uint32_t g_maxCUDepth    = NUM_CU_DEPTH - 1;
>  uint32_t g_zscanToRaster[MAX_NUM_PARTITIONS] = { 0, };
>  uint32_t g_rasterToZscan[MAX_NUM_PARTITIONS] = { 0, };
> diff -r 9ab104096834 -r ffb5d5c4dfca source/common/constants.h
> --- a/source/common/constants.h	Wed Feb 11 16:15:33 2015 -0600
> +++ b/source/common/constants.h	Fri Feb 13 10:04:50 2015 +0530
> @@ -55,7 +55,7 @@
>  extern uint32_t g_maxLog2CUSize;
>  extern uint32_t g_maxCUSize;
>  extern uint32_t g_maxCUDepth;
> -extern uint32_t g_maxFullDepth;
> +extern uint32_t g_numCUDepth;
>  
>  extern const int16_t g_t4[4][4];
>  extern const int16_t g_t8[8][8];
> diff -r 9ab104096834 -r ffb5d5c4dfca source/common/cudata.cpp
> --- a/source/common/cudata.cpp	Wed Feb 11 16:15:33 2015 -0600
> +++ b/source/common/cudata.cpp	Fri Feb 13 10:04:50 2015 +0530
> @@ -163,7 +163,7 @@
>  
>      if (!s_partSet[0])
>      {
> -        s_numPartInCUSize = 1 << g_maxFullDepth;
> +        s_numPartInCUSize = 1 << g_numCUDepth;
>          switch (g_maxLog2CUSize)
>          {
>          case 6:
> @@ -734,7 +734,7 @@
>  /* Get left QpMinCu */
>  const CUData* CUData::getQpMinCuLeft(uint32_t& lPartUnitIdx, uint32_t curAbsIdxInCTU) const
>  {
> -    uint32_t absZorderQpMinCUIdx = curAbsIdxInCTU & (0xFF << (g_maxFullDepth - m_slice->m_pps->maxCuDQPDepth) * 2);
> +    uint32_t absZorderQpMinCUIdx = curAbsIdxInCTU & (0xFF << (g_numCUDepth - m_slice->m_pps->maxCuDQPDepth) * 2);
>      uint32_t absRorderQpMinCUIdx = g_zscanToRaster[absZorderQpMinCUIdx];
>  
>      // check for left CTU boundary
> @@ -751,7 +751,7 @@
>  /* Get above QpMinCu */
>  const CUData* CUData::getQpMinCuAbove(uint32_t& aPartUnitIdx, uint32_t curAbsIdxInCTU) const
>  {
> -    uint32_t absZorderQpMinCUIdx = curAbsIdxInCTU & (0xFF << (g_maxFullDepth - m_slice->m_pps->maxCuDQPDepth) * 2);
> +    uint32_t absZorderQpMinCUIdx = curAbsIdxInCTU & (0xFF << (g_numCUDepth - m_slice->m_pps->maxCuDQPDepth) * 2);
>      uint32_t absRorderQpMinCUIdx = g_zscanToRaster[absZorderQpMinCUIdx];
>  
>      // check for top CTU boundary
> @@ -790,7 +790,7 @@
>  
>  int8_t CUData::getLastCodedQP(uint32_t absPartIdx) const
>  {
> -    uint32_t quPartIdxMask = 0xFF << (g_maxFullDepth - m_slice->m_pps->maxCuDQPDepth) * 2;
> +    uint32_t quPartIdxMask = 0xFF << (g_numCUDepth - m_slice->m_pps->maxCuDQPDepth) * 2;
>      int lastValidPartIdx = getLastValidPartIdx(absPartIdx & quPartIdxMask);
>  
>      if (lastValidPartIdx >= 0)
> diff -r 9ab104096834 -r ffb5d5c4dfca source/common/cudata.h
> --- a/source/common/cudata.h	Wed Feb 11 16:15:33 2015 -0600
> +++ b/source/common/cudata.h	Fri Feb 13 10:04:50 2015 +0530
> @@ -213,7 +213,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_maxFullDepth * 2) + m_absIdxInCTU; }
> +    uint32_t getSCUAddr() const                  { return (m_cuAddr << g_numCUDepth * 2) + m_absIdxInCTU; }
>      uint32_t getCtxSplitFlag(uint32_t absPartIdx, uint32_t depth) const;
>      uint32_t getCtxSkipFlag(uint32_t absPartIdx) const;
>      ScanType getCoefScanIdx(uint32_t absPartIdx, uint32_t log2TrSize, bool bIsLuma, bool bIsIntra) const;
> diff -r 9ab104096834 -r ffb5d5c4dfca source/common/param.cpp
> --- a/source/common/param.cpp	Wed Feb 11 16:15:33 2015 -0600
> +++ b/source/common/param.cpp	Fri Feb 13 10:04:50 2015 +0530
> @@ -1174,12 +1174,12 @@
>  
>          // compute actual CU depth with respect to config depth and max transform size
>          g_maxCUDepth   = maxLog2CUSize - MIN_LOG2_CU_SIZE;
> -        g_maxFullDepth = maxLog2CUSize - LOG2_UNIT_SIZE;
> +        g_numCUDepth = maxLog2CUSize - LOG2_UNIT_SIZE;
>  
>          // initialize partition order
>          uint32_t* tmp = &g_zscanToRaster[0];
> -        initZscanToRaster(g_maxFullDepth, 1, 0, tmp);
> -        initRasterToZscan(g_maxFullDepth);
> +        initZscanToRaster(g_numCUDepth, 1, 0, tmp);
> +        initRasterToZscan(g_numCUDepth);
>      }
>      return 0;
>  }
> diff -r 9ab104096834 -r ffb5d5c4dfca source/common/picyuv.cpp
> --- a/source/common/picyuv.cpp	Wed Feb 11 16:15:33 2015 -0600
> +++ b/source/common/picyuv.cpp	Fri Feb 13 10:04:50 2015 +0530
> @@ -84,7 +84,7 @@
>   * allocated by the same encoder. */
>  bool PicYuv::createOffsets(const SPS& sps)
>  {
> -    uint32_t numPartitions = 1 << (g_maxFullDepth * 2);
> +    uint32_t numPartitions = 1 << (g_numCUDepth * 2);
>      CHECKED_MALLOC(m_cuOffsetY, intptr_t, sps.numCuInWidth * sps.numCuInHeight);
>      CHECKED_MALLOC(m_cuOffsetC, intptr_t, sps.numCuInWidth * sps.numCuInHeight);
>      for (uint32_t cuRow = 0; cuRow < sps.numCuInHeight; cuRow++)
> diff -r 9ab104096834 -r ffb5d5c4dfca source/encoder/encoder.cpp
> --- a/source/encoder/encoder.cpp	Wed Feb 11 16:15:33 2015 -0600
> +++ b/source/encoder/encoder.cpp	Fri Feb 13 10:04:50 2015 +0530
> @@ -1434,7 +1434,7 @@
>      sps->numCuInHeight = (m_param->sourceHeight + g_maxCUSize - 1) / g_maxCUSize;
>      sps->numCUsInFrame = sps->numCuInWidth * sps->numCuInHeight;
>      sps->numPartitions = NUM_CU_PARTITIONS;
> -    sps->numPartInCUSize = 1 << g_maxFullDepth;
> +    sps->numPartInCUSize = 1 << g_numCUDepth;
>  
>      sps->log2MinCodingBlockSize = g_maxLog2CUSize - g_maxCUDepth;
>      sps->log2DiffMaxMinCodingBlockSize = g_maxCUDepth;
> diff -r 9ab104096834 -r ffb5d5c4dfca source/encoder/entropy.cpp
> --- a/source/encoder/entropy.cpp	Wed Feb 11 16:15:33 2015 -0600
> +++ b/source/encoder/entropy.cpp	Fri Feb 13 10:04:50 2015 +0530
> @@ -857,7 +857,7 @@
>      PartSize partSize = (PartSize)cu.m_partSize[absPartIdx];
>      uint32_t numPU = (partSize == SIZE_2Nx2N ? 1 : (partSize == SIZE_NxN ? 4 : 2));
>      uint32_t depth = cu.m_cuDepth[absPartIdx];
> -    uint32_t puOffset = (g_puOffset[uint32_t(partSize)] << (g_maxFullDepth - depth) * 2) >> 4;
> +    uint32_t puOffset = (g_puOffset[uint32_t(partSize)] << (g_numCUDepth - depth) * 2) >> 4;
>  
>      for (uint32_t puIdx = 0, subPartIdx = absPartIdx; puIdx < numPU; puIdx++, subPartIdx += puOffset)
>      {
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel

-- 
Steve Borho


More information about the x265-devel mailing list