Ignore:
Timestamp:
7 Nov 2013, 08:07:50 (11 years ago)
Author:
seregin
Message:

enable layer-specific CTB structure

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncCfg.cpp

    r442 r445  
    362362  Int*    cfg_IntraPeriod   [MAX_LAYERS];
    363363  Int*    cfg_conformanceMode  [MAX_LAYERS];
     364#if LAYER_CTB
     365  // coding unit (CU) definition
     366  UInt*      cfg_uiMaxCUWidth[MAX_LAYERS];                                   ///< max. CU width in pixel
     367  UInt*      cfg_uiMaxCUHeight[MAX_LAYERS];                                  ///< max. CU height in pixel
     368  UInt*      cfg_uiMaxCUDepth[MAX_LAYERS];                                   ///< max. CU depth
     369 
     370  // transfom unit (TU) definition
     371  UInt*      cfg_uiQuadtreeTULog2MaxSize[MAX_LAYERS];
     372  UInt*      cfg_uiQuadtreeTULog2MinSize[MAX_LAYERS];
     373 
     374  UInt*      cfg_uiQuadtreeTUMaxDepthInter[MAX_LAYERS];
     375  UInt*      cfg_uiQuadtreeTUMaxDepthIntra[MAX_LAYERS];
     376#endif
    364377#if VPS_EXTN_DIRECT_REF_LAYERS
    365378#if M0457_PREDICTION_INDICATIONS
     
    416429    cfg_IntraPeriod[layer]  = &m_acLayerCfg[layer].m_iIntraPeriod;
    417430    cfg_conformanceMode[layer] = &m_acLayerCfg[layer].m_conformanceMode;
     431#if LAYER_CTB
     432    // coding unit (CU) definition
     433    cfg_uiMaxCUWidth[layer]  = &m_acLayerCfg[layer].m_uiMaxCUWidth;
     434    cfg_uiMaxCUHeight[layer] = &m_acLayerCfg[layer].m_uiMaxCUHeight;
     435    cfg_uiMaxCUDepth[layer]  = &m_acLayerCfg[layer].m_uiMaxCUDepth;
     436
     437    // transfom unit (TU) definition.
     438    cfg_uiQuadtreeTULog2MaxSize[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTULog2MaxSize;
     439    cfg_uiQuadtreeTULog2MinSize[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTULog2MinSize;
     440
     441    cfg_uiQuadtreeTUMaxDepthInter[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthInter;
     442    cfg_uiQuadtreeTUMaxDepthIntra[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthIntra;
     443#endif
    418444#if VPS_EXTN_DIRECT_REF_LAYERS
    419445#if M0457_PREDICTION_INDICATIONS
     
    585611  ("FrameOnly",         m_frameOnlyConstraintFlag, false, "Indicate that the bitstream contains only frames")
    586612
     613#if LAYER_CTB
     614  // Unit definition parameters
     615  ("MaxCUWidth%d",              cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU width")
     616  ("MaxCUHeight%d",             cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU height")
     617  // todo: remove defaults from MaxCUSize
     618  ("MaxCUSize%d,s%d",           cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU size")
     619  ("MaxCUSize%d,s%d",           cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU size")
     620  ("MaxPartitionDepth%d,h%d",   cfg_uiMaxCUDepth,              4u, MAX_LAYERS, "CU depth")
     621 
     622  ("QuadtreeTULog2MaxSize%d",   cfg_uiQuadtreeTULog2MaxSize,   6u, MAX_LAYERS, "Maximum TU size in logarithm base 2")
     623  ("QuadtreeTULog2MinSize%d",   cfg_uiQuadtreeTULog2MinSize,   2u, MAX_LAYERS, "Minimum TU size in logarithm base 2")
     624 
     625  ("QuadtreeTUMaxDepthIntra%d", cfg_uiQuadtreeTUMaxDepthIntra, 1u, MAX_LAYERS, "Depth of TU tree for intra CUs")
     626  ("QuadtreeTUMaxDepthInter%d", cfg_uiQuadtreeTUMaxDepthInter, 2u, MAX_LAYERS, "Depth of TU tree for inter CUs")
     627
     628
     629  // set the same CU realted settings across all the layers if config file parameters are not layer specific
     630  ("MaxCUWidth",              cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU width")
     631  ("MaxCUHeight",             cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU height")
     632  // todo: remove defaults from MaxCUSize
     633  ("MaxCUSize,s",             cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU size")
     634  ("MaxCUSize,s",             cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU size")
     635  ("MaxPartitionDepth,h",     cfg_uiMaxCUDepth,              4u, MAX_LAYERS, "CU depth")
     636 
     637  ("QuadtreeTULog2MaxSize",   cfg_uiQuadtreeTULog2MaxSize,   6u, MAX_LAYERS, "Maximum TU size in logarithm base 2")
     638  ("QuadtreeTULog2MinSize",   cfg_uiQuadtreeTULog2MinSize,   2u, MAX_LAYERS, "Minimum TU size in logarithm base 2")
     639 
     640  ("QuadtreeTUMaxDepthIntra", cfg_uiQuadtreeTUMaxDepthIntra, 1u, MAX_LAYERS, "Depth of TU tree for intra CUs")
     641  ("QuadtreeTUMaxDepthInter", cfg_uiQuadtreeTUMaxDepthInter, 2u, MAX_LAYERS, "Depth of TU tree for inter CUs")
     642#else
    587643  // Unit definition parameters
    588644  ("MaxCUWidth",              m_uiMaxCUWidth,             64u)
     
    598654  ("QuadtreeTUMaxDepthIntra", m_uiQuadtreeTUMaxDepthIntra, 1u, "Depth of TU tree for intra CUs")
    599655  ("QuadtreeTUMaxDepthInter", m_uiQuadtreeTUMaxDepthInter, 2u, "Depth of TU tree for inter CUs")
     656#endif
    600657 
    601658  // Coding structure paramters
     
    14111468 
    14121469  // set global varibles
     1470#if LAYER_CTB
     1471  for(Int layer = 0; layer < MAX_LAYERS; layer++)
     1472  {
     1473    xSetGlobal(layer);
     1474  }
     1475#else
    14131476  xSetGlobal();
     1477#endif
    14141478 
    14151479  // print-out parameters
     
    14711535  xConfirmPara( m_bipredSearchRange < 0 ,                                                   "Search Range must be more than 0" );
    14721536  xConfirmPara( m_iMaxDeltaQP > 7,                                                          "Absolute Delta QP exceeds supported range (0 to 7)" );
     1537#if LAYER_CTB
     1538  for(UInt layer = 0; layer < MAX_LAYERS; layer++)
     1539  {
     1540    xConfirmPara( m_iMaxCuDQPDepth > m_acLayerCfg[layer].m_uiMaxCUDepth - 1,                "Absolute depth for a minimum CuDQP exceeds maximum coding unit depth" );
     1541  }
     1542#else
    14731543  xConfirmPara( m_iMaxCuDQPDepth > m_uiMaxCUDepth - 1,                                          "Absolute depth for a minimum CuDQP exceeds maximum coding unit depth" );
     1544#endif
    14741545
    14751546  xConfirmPara( m_cbQpOffset < -12,   "Min. Chroma Cb QP Offset is -12" );
     
    14851556  }
    14861557#endif
     1558#if !LAYER_CTB
    14871559  xConfirmPara( (m_uiMaxCUWidth  >> m_uiMaxCUDepth) < 4,                                    "Minimum partition width size should be larger than or equal to 8");
    14881560  xConfirmPara( (m_uiMaxCUHeight >> m_uiMaxCUDepth) < 4,                                    "Minimum partition height size should be larger than or equal to 8");
    14891561  xConfirmPara( m_uiMaxCUWidth < 16,                                                        "Maximum partition width size should be larger than or equal to 16");
    14901562  xConfirmPara( m_uiMaxCUHeight < 16,                                                       "Maximum partition height size should be larger than or equal to 16");
     1563#endif
    14911564#if !SVC_EXTENSION
    14921565  xConfirmPara( (m_iSourceWidth  % (m_uiMaxCUWidth  >> (m_uiMaxCUDepth-1)))!=0,             "Resulting coded frame width must be a multiple of the minimum CU size");
     
    14941567#endif
    14951568 
     1569#if !LAYER_CTB
    14961570  xConfirmPara( m_uiQuadtreeTULog2MinSize < 2,                                        "QuadtreeTULog2MinSize must be 2 or greater.");
    14971571  xConfirmPara( m_uiQuadtreeTULog2MaxSize > 5,                                        "QuadtreeTULog2MaxSize must be 5 or smaller.");
     
    15071581  xConfirmPara( m_uiQuadtreeTUMaxDepthIntra < 1,                                                         "QuadtreeTUMaxDepthIntra must be greater than or equal to 1" );
    15081582  xConfirmPara( m_uiMaxCUWidth < ( 1 << (m_uiQuadtreeTULog2MinSize + m_uiQuadtreeTUMaxDepthIntra - 1) ), "QuadtreeTUMaxDepthInter must be less than or equal to the difference between log2(maxCUSize) and QuadtreeTULog2MinSize plus 1" );
     1583#endif
    15091584 
    15101585  xConfirmPara(  m_maxNumMergeCand < 1,  "MaxNumMergeCand must be 1 or greater.");
     
    15541629#endif
    15551630
     1631#if !LAYER_CTB
    15561632  // max CU width and height should be power of 2
    15571633  UInt ui = m_uiMaxCUWidth;
     
    15691645      xConfirmPara( ui != 1 , "Height should be 2^n");
    15701646  }
    1571 
     1647#endif
    15721648
    15731649  /* if this is an intra-only sequence, ie IntraPeriod=1, don't verify the GOP structure
     
    19662042    Int m_iSourceWidth = m_acLayerCfg[layer].m_iSourceWidth;
    19672043    Int m_iSourceHeight = m_acLayerCfg[layer].m_iSourceHeight;
     2044#if LAYER_CTB
     2045    Int m_uiMaxCUWidth = m_acLayerCfg[layer].m_uiMaxCUWidth;
     2046    Int m_uiMaxCUHeight = m_acLayerCfg[layer].m_uiMaxCUHeight;
     2047#endif
    19682048#endif
    19692049  if(m_vuiParametersPresentFlag && m_bitstreamRestrictionFlag)
     
    22102290/** \todo use of global variables should be removed later
    22112291 */
     2292#if LAYER_CTB
     2293Void TAppEncCfg::xSetGlobal(UInt layerId)
     2294{
     2295  // set max CU width & height
     2296  g_auiLayerMaxCUWidth[layerId]  = m_acLayerCfg[layerId].m_uiMaxCUWidth;
     2297  g_auiLayerMaxCUHeight[layerId] = m_acLayerCfg[layerId].m_uiMaxCUHeight;
     2298 
     2299  // compute actual CU depth with respect to config depth and max transform size
     2300  g_auiLayerAddCUDepth[layerId]  = 0;
     2301  while( (m_acLayerCfg[layerId].m_uiMaxCUWidth>>m_acLayerCfg[layerId].m_uiMaxCUDepth) > ( 1 << ( m_acLayerCfg[layerId].m_uiQuadtreeTULog2MinSize + g_auiLayerAddCUDepth[layerId] )  ) ) g_auiLayerAddCUDepth[layerId]++;
     2302 
     2303  m_acLayerCfg[layerId].m_uiMaxCUDepth += g_auiLayerAddCUDepth[layerId];
     2304  g_auiLayerAddCUDepth[layerId]++;
     2305  g_auiLayerMaxCUDepth[layerId] = m_acLayerCfg[layerId].m_uiMaxCUDepth;
     2306 
     2307  // set internal bit-depth and constants
     2308  g_bitDepthY = m_internalBitDepthY;
     2309  g_bitDepthC = m_internalBitDepthC;
     2310 
     2311  g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_inputBitDepthY : m_internalBitDepthY;
     2312  g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_inputBitDepthC : m_internalBitDepthC;
     2313}
     2314#else
    22122315Void TAppEncCfg::xSetGlobal()
    22132316{
     
    22312334  g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_inputBitDepthC : m_internalBitDepthC;
    22322335}
     2336#endif
    22332337
    22342338Void TAppEncCfg::xPrintParameter()
     
    22842388    printf("Frame index                  : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
    22852389  }
     2390#if !LAYER_CTB
    22862391  printf("CU size / depth              : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth );
    22872392  printf("RQT trans. size (min / max)  : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize );
    22882393  printf("Max RQT depth inter          : %d\n", m_uiQuadtreeTUMaxDepthInter);
    22892394  printf("Max RQT depth intra          : %d\n", m_uiQuadtreeTUMaxDepthIntra);
     2395#endif
    22902396  printf("Min PCM size                 : %d\n", 1 << m_uiPCMLog2MinSize);
    22912397  printf("Motion search range          : %d\n", m_iSearchRange );
     
    23622468  printf("CIP:%d ", m_bUseConstrainedIntraPred);
    23632469  printf("SAO:%d ", (m_bUseSAO)?(1):(0));
     2470#if !LAYER_CTB
    23642471  printf("PCM:%d ", (m_usePCM && (1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0);
     2472#endif
    23652473  printf("SAOLcuBasedOptimization:%d ", (m_saoLcuBasedOptimization)?(1):(0));
    23662474
Note: See TracChangeset for help on using the changeset viewer.