Changeset 445 in SHVCSoftware


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

enable layer-specific CTB structure

Location:
branches/SHM-4.0-dev/source
Files:
12 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
  • branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncCfg.h

    r442 r445  
    150150  Int       m_maxTempLayer;                                  ///< Max temporal layer
    151151
     152#if !LAYER_CTB
    152153  // coding unit (CU) definition
    153154  UInt      m_uiMaxCUWidth;                                   ///< max. CU width in pixel
     
    161162  UInt      m_uiQuadtreeTUMaxDepthInter;
    162163  UInt      m_uiQuadtreeTUMaxDepthIntra;
     164#endif
    163165 
    164166  // coding tools (bit-depth)
     
    354356#endif
    355357  // internal member functions
     358#if LAYER_CTB
     359  Void  xSetGlobal      (UInt layerId);                       ///< set global variables
     360#else
    356361  Void  xSetGlobal      ();                                   ///< set global variables
     362#endif
    357363  Void  xCheckParameter ();                                   ///< check validity of configuration values
    358364  Void  xPrintParameter ();                                   ///< print configuration values
     
    390396  UInt getInternalBitDepthY()      {return m_internalBitDepthY; }
    391397  UInt getInternalBitDepthC()      {return m_internalBitDepthC; }
     398#if !LAYER_CTB
    392399  UInt getMaxCUWidth()             {return m_uiMaxCUWidth;      }
    393400  UInt getMaxCUHeight()            {return m_uiMaxCUHeight;     }
    394401  UInt getMaxCUDepth()             {return m_uiMaxCUDepth;      }
     402#endif
    395403  Int  getDecodingRefreshType()    {return m_iDecodingRefreshType; }
    396404  Int  getWaveFrontSynchro()        { return m_iWaveFrontSynchro; }
     
    405413  RepFormatCfg* getRepFormatCfg(Int i)  { return &m_repFormatCfg[i]; }
    406414#endif
     415#if LAYER_CTB
     416  Bool getUsePCM()                  { return m_usePCM;               }
     417  UInt getPCMLog2MinSize  ()        { return  m_uiPCMLog2MinSize;    }
     418#endif
    407419#endif
    408420};// END CLASS DEFINITION TAppEncCfg
  • branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncLayerCfg.cpp

    r442 r445  
    142142  printf("Real     Format               : %dx%d %dHz\n", m_iSourceWidth - m_confLeft - m_confRight, m_iSourceHeight - m_confTop - m_confBottom, m_iFrameRate );
    143143  printf("Internal Format               : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate );
     144#if LAYER_CTB
     145  printf("CU size / depth               : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth );
     146  printf("RQT trans. size (min / max)   : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize );
     147  printf("Max RQT depth inter           : %d\n", m_uiQuadtreeTUMaxDepthInter);
     148  printf("Max RQT depth intra           : %d\n", m_uiQuadtreeTUMaxDepthIntra);
     149#endif
    144150  printf("QP                            : %5.2f\n", m_fQP );
    145151  printf("Intra period                  : %d\n", m_iIntraPeriod );
     
    157163#endif
    158164  printf("WaveFrontSynchro:%d WaveFrontSubstreams:%d", m_cAppEncCfg->getWaveFrontSynchro(), m_iWaveFrontSubstreams);
     165#if LAYER_CTB
     166  printf("PCM:%d ", (m_cAppEncCfg->getUsePCM() && (1<<m_cAppEncCfg->getPCMLog2MinSize()) <= m_uiMaxCUWidth)? 1 : 0);
     167#endif
    159168}
    160169
     
    175184    {
    176185      // automatic padding to minimum CU size
     186#if LAYER_CTB
     187      Int minCuSize = m_uiMaxCUHeight >> (m_uiMaxCUDepth - 1);
     188#else
    177189      Int minCuSize = m_cAppEncCfg->getMaxCUHeight() >> (m_cAppEncCfg->getMaxCUDepth() - 1);
     190#endif
    178191      if (m_iSourceWidth % minCuSize)
    179192      {
     
    240253  }
    241254
     255#if LAYER_CTB
     256  UInt maxCUWidth = m_uiMaxCUWidth;
     257  UInt maxCUHeight = m_uiMaxCUHeight;
     258  UInt maxCUDepth = m_uiMaxCUDepth;
     259#else
    242260  UInt maxCUWidth = m_cAppEncCfg->getMaxCUWidth();
    243261  UInt maxCUHeight = m_cAppEncCfg->getMaxCUHeight();
    244262  UInt maxCUDepth = m_cAppEncCfg->getMaxCUDepth();
     263#endif
    245264  bool check_failed = false; /* abort if there is a fatal configuration problem */
    246265#define xConfirmPara(a,b) check_failed |= confirmPara(a,b)
     
    258277
    259278
    260   m_iWaveFrontSubstreams = m_cAppEncCfg->getWaveFrontSynchro() ? (m_iSourceHeight + m_cAppEncCfg->getMaxCUHeight() - 1) / m_cAppEncCfg->getMaxCUHeight() : 1;
     279  m_iWaveFrontSubstreams = m_cAppEncCfg->getWaveFrontSynchro() ? (m_iSourceHeight + maxCUHeight - 1) / maxCUHeight : 1;
    261280  xConfirmPara( m_iWaveFrontSubstreams <= 0, "WaveFrontSubstreams must be positive" );
    262281  xConfirmPara( m_iWaveFrontSubstreams > 1 && !m_cAppEncCfg->getWaveFrontSynchro(), "Must have WaveFrontSynchro > 0 in order to have WaveFrontSubstreams > 1" );
     
    273292  xConfirmPara( m_confTop    % TComSPS::getWinUnitY(CHROMA_420) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling");
    274293  xConfirmPara( m_confBottom % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling");
     294
     295#if LAYER_CTB 
     296  xConfirmPara( (m_uiMaxCUWidth  >> m_uiMaxCUDepth) < 4,                                    "Minimum partition width size should be larger than or equal to 8");
     297  xConfirmPara( (m_uiMaxCUHeight >> m_uiMaxCUDepth) < 4,                                    "Minimum partition height size should be larger than or equal to 8");
     298  xConfirmPara( m_uiMaxCUWidth < 16,                                                        "Maximum partition width size should be larger than or equal to 16");
     299  xConfirmPara( m_uiMaxCUHeight < 16,                                                       "Maximum partition height size should be larger than or equal to 16");
     300  xConfirmPara( m_uiQuadtreeTULog2MinSize < 2,                                        "QuadtreeTULog2MinSize must be 2 or greater.");
     301  xConfirmPara( m_uiQuadtreeTULog2MaxSize > 5,                                        "QuadtreeTULog2MaxSize must be 5 or smaller.");
     302  xConfirmPara( (1<<m_uiQuadtreeTULog2MaxSize) > m_uiMaxCUWidth,                                        "QuadtreeTULog2MaxSize must be log2(maxCUSize) or smaller.");
     303  xConfirmPara( m_uiQuadtreeTULog2MaxSize < m_uiQuadtreeTULog2MinSize,                "QuadtreeTULog2MaxSize must be greater than or equal to m_uiQuadtreeTULog2MinSize.");
     304  xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUWidth >>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS
     305  xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUHeight>>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS
     306  xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUWidth  >> m_uiMaxCUDepth ), "Minimum CU width must be greater than minimum transform size." );
     307  xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUHeight >> m_uiMaxCUDepth ), "Minimum CU height must be greater than minimum transform size." );
     308  xConfirmPara( m_uiQuadtreeTUMaxDepthInter < 1,                                                         "QuadtreeTUMaxDepthInter must be greater than or equal to 1" );
     309  xConfirmPara( m_uiMaxCUWidth < ( 1 << (m_uiQuadtreeTULog2MinSize + m_uiQuadtreeTUMaxDepthInter - 1) ), "QuadtreeTUMaxDepthInter must be less than or equal to the difference between log2(maxCUSize) and QuadtreeTULog2MinSize plus 1" );
     310  xConfirmPara( m_uiQuadtreeTUMaxDepthIntra < 1,                                                         "QuadtreeTUMaxDepthIntra must be greater than or equal to 1" );
     311  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" );
     312
     313  // max CU width and height should be power of 2
     314  UInt ui = m_uiMaxCUWidth;
     315  while(ui)
     316  {
     317    ui >>= 1;
     318    if( (ui & 1) == 1)
     319      xConfirmPara( ui != 1 , "Width should be 2^n");
     320  }
     321  ui = m_uiMaxCUHeight;
     322  while(ui)
     323  {
     324    ui >>= 1;
     325    if( (ui & 1) == 1)
     326      xConfirmPara( ui != 1 , "Height should be 2^n");
     327  }
     328#endif
     329
    275330#undef xConfirmPara
    276331  return check_failed;
  • branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncLayerCfg.h

    r442 r445  
    5555  Int       *m_predLayerIds;
    5656  Int       m_numActiveRefLayers;
     57#endif
     58
     59#if LAYER_CTB
     60  // coding unit (CU) definition
     61  UInt      m_uiMaxCUWidth;                                   ///< max. CU width in pixel
     62  UInt      m_uiMaxCUHeight;                                  ///< max. CU height in pixel
     63  UInt      m_uiMaxCUDepth;                                   ///< max. CU depth
     64 
     65  // transfom unit (TU) definition
     66  UInt      m_uiQuadtreeTULog2MaxSize;
     67  UInt      m_uiQuadtreeTULog2MinSize;
     68 
     69  UInt      m_uiQuadtreeTUMaxDepthInter;
     70  UInt      m_uiQuadtreeTUMaxDepthIntra;
    5771#endif
    5872
     
    163177#if N0120_MAX_TID_REF_CFG
    164178  Int     getMaxTidIlRefPicsPlus1()   { return m_maxTidIlRefPicsPlus1; }
    165 #endif
     179#endif
     180#if LAYER_CTB
     181  UInt getMaxCUWidth()             {return m_uiMaxCUWidth;      }
     182  UInt getMaxCUHeight()            {return m_uiMaxCUHeight;     }
     183  UInt getMaxCUDepth()             {return m_uiMaxCUDepth;      }
     184#endif
    166185}; // END CLASS DEFINITION TAppEncLayerCfg
    167186
  • branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r442 r445  
    358358    m_acTEncTop[layer].setUseRDOQTS                    ( m_useRDOQTS   );
    359359    m_acTEncTop[layer].setRDpenalty                    ( m_rdPenalty );
     360#if LAYER_CTB
     361    m_acTEncTop[layer].setQuadtreeTULog2MaxSize        ( m_acLayerCfg[layer].m_uiQuadtreeTULog2MaxSize );
     362    m_acTEncTop[layer].setQuadtreeTULog2MinSize        ( m_acLayerCfg[layer].m_uiQuadtreeTULog2MinSize );
     363    m_acTEncTop[layer].setQuadtreeTUMaxDepthInter      ( m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthInter );
     364    m_acTEncTop[layer].setQuadtreeTUMaxDepthIntra      ( m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthIntra );
     365#else
    360366    m_acTEncTop[layer].setQuadtreeTULog2MaxSize        ( m_uiQuadtreeTULog2MaxSize );
    361367    m_acTEncTop[layer].setQuadtreeTULog2MinSize        ( m_uiQuadtreeTULog2MinSize );
    362368    m_acTEncTop[layer].setQuadtreeTUMaxDepthInter      ( m_uiQuadtreeTUMaxDepthInter );
    363369    m_acTEncTop[layer].setQuadtreeTUMaxDepthIntra      ( m_uiQuadtreeTUMaxDepthIntra );
     370#endif
    364371    m_acTEncTop[layer].setUseFastEnc                   ( m_bUseFastEnc  );
    365372    m_acTEncTop[layer].setUseEarlyCU                   ( m_bUseEarlyCU  );
     
    393400    m_acTEncTop[layer].setSliceSegmentMode        ( m_sliceSegmentMode         );
    394401    m_acTEncTop[layer].setSliceSegmentArgument    ( m_sliceSegmentArgument     );
     402#if LAYER_CTB
     403    Int iNumPartInCU = 1<<(m_acLayerCfg[layer].m_uiMaxCUDepth<<1);
     404#else
    395405    Int iNumPartInCU = 1<<(m_uiMaxCUDepth<<1);
     406#endif
    396407    if(m_sliceSegmentMode==FIXED_NUMBER_OF_LCU)
    397408    {
     
    851862  for(UInt layer=0; layer<m_numLayers; layer++)
    852863  {
     864#if LAYER_CTB
     865    g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
     866    g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer];
     867    g_uiMaxCUDepth  = g_auiLayerMaxCUDepth[layer];
     868    g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
     869#endif
    853870    m_acTVideoIOYuvInputFile[layer].open( (Char *)m_acLayerCfg[layer].getInputFile().c_str(),  false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC );  // read  mode
    854871    m_acTVideoIOYuvInputFile[layer].skipFrames(m_FrameSkip, m_acLayerCfg[layer].getSourceWidth() - m_acLayerCfg[layer].getPad()[0], m_acLayerCfg[layer].getSourceHeight() - m_acLayerCfg[layer].getPad()[1]);
     
    882899  for(UInt layer=0; layer<m_numLayers; layer++)
    883900  {
     901#if LAYER_CTB
     902    g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
     903    g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer];
     904    g_uiMaxCUDepth  = g_auiLayerMaxCUDepth[layer];
     905    g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
     906#endif
     907
    884908    m_acTVideoIOYuvInputFile[layer].close();
    885909    m_acTVideoIOYuvReconFile[layer].close();
     
    901925  for(UInt layer=0; layer<m_numLayers; layer++)
    902926  {
     927#if LAYER_CTB
     928    g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
     929    g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer];
     930    g_uiMaxCUDepth  = g_auiLayerMaxCUDepth[layer];
     931    g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
     932       
     933    memcpy( g_auiZscanToRaster, g_auiLayerZscanToRaster[layer], sizeof( g_auiZscanToRaster ) );
     934    memcpy( g_auiRasterToZscan, g_auiLayerRasterToZscan[layer], sizeof( g_auiRasterToZscan ) );
     935    memcpy( g_auiRasterToPelX,  g_auiLayerRasterToPelX[layer],  sizeof( g_auiRasterToPelX ) );
     936    memcpy( g_auiRasterToPelY,  g_auiLayerRasterToPelY[layer],  sizeof( g_auiRasterToPelY ) );
     937#endif
    903938    m_acTEncTop[layer].init(isFieldCoding);
    904939  }
     
    11531188    {
    11541189#if SVC_UPSAMPLING
     1190#if LAYER_CTB
     1191      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
     1192#else
    11551193      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
     1194#endif
    11561195#else
    11571196      pcPicYuvOrg->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     
    11611200    {
    11621201#if SVC_UPSAMPLING
     1202#if LAYER_CTB
     1203      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
     1204#else
    11631205      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
     1206#endif
    11641207#else
    11651208      pcPicYuvOrg->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     
    11961239      for(UInt layer=0; layer<m_numLayers; layer++)
    11971240      {
     1241#if LAYER_CTB
     1242        g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
     1243        g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer];
     1244        g_uiMaxCUDepth  = g_auiLayerMaxCUDepth[layer];
     1245        g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
     1246#endif
     1247
    11981248        // get buffers
    11991249        xGetBuffer(pcPicYuvRec, layer);
     
    12631313      for(UInt layer=0; layer<m_numLayers; layer++)
    12641314      {
     1315#if LAYER_CTB
     1316        g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
     1317        g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer];
     1318        g_uiMaxCUDepth  = g_auiLayerMaxCUDepth[layer];
     1319        g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
     1320
     1321        memcpy( g_auiZscanToRaster, g_auiLayerZscanToRaster[layer], sizeof( g_auiZscanToRaster ) );
     1322        memcpy( g_auiRasterToZscan, g_auiLayerRasterToZscan[layer], sizeof( g_auiRasterToZscan ) );
     1323        memcpy( g_auiRasterToPelX,  g_auiLayerRasterToPelX[layer],  sizeof( g_auiRasterToPelX ) );
     1324        memcpy( g_auiRasterToPelY,  g_auiLayerRasterToPelY[layer],  sizeof( g_auiRasterToPelY ) );
     1325#endif
    12651326        // call encoding function for one frame
    12661327        if ( m_isField )
     
    15281589
    15291590#if SVC_UPSAMPLING
     1591#if LAYER_CTB
     1592    rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
     1593#else
    15301594    rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
     1595#endif
    15311596#else
    15321597    rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
  • branches/SHM-4.0-dev/source/Lib/TLibCommon/TComDataCU.cpp

    r442 r445  
    40044004  uiPelY = (UInt)Clip3<UInt>(0, m_pcPic->getPicYuvRec()->getHeight() - 1, uiPelY);
    40054005
     4006#if !LAYER_CTB
    40064007  UInt uiMinUnitSize = m_pcPic->getMinCUWidth();
     4008#endif
    40074009
    40084010#if SCALED_REF_LAYER_OFFSETS
     
    40344036  }
    40354037
     4038#if LAYER_CTB
     4039  UInt baseMaxCUHeight = cBaseColPic->getPicSym()->getMaxCUHeight();
     4040  UInt baseMaxCUWidth  = cBaseColPic->getPicSym()->getMaxCUWidth();
     4041  UInt baseMinUnitSize = cBaseColPic->getMinCUWidth();
     4042 
     4043  uiCUAddrBase = ( iBY / cBaseColPic->getPicSym()->getMaxCUHeight() ) * cBaseColPic->getFrameWidthInCU() + ( iBX / cBaseColPic->getPicSym()->getMaxCUWidth() );
     4044#else
    40364045  uiCUAddrBase = (iBY/g_uiMaxCUHeight)*cBaseColPic->getFrameWidthInCU() + (iBX/g_uiMaxCUWidth);
     4046#endif
    40374047
    40384048  assert(uiCUAddrBase < cBaseColPic->getNumCUsInFrame());
    40394049
     4050#if LAYER_CTB
     4051  UInt uiRasterAddrBase = ( iBY - (iBY/baseMaxCUHeight)*baseMaxCUHeight ) / baseMinUnitSize * cBaseColPic->getNumPartInWidth() + ( iBX - (iBX/baseMaxCUWidth)*baseMaxCUWidth ) / baseMinUnitSize;
     4052 
     4053  uiAbsPartIdxBase = g_auiLayerRasterToZscan[cBaseColPic->getLayerId()][uiRasterAddrBase];
     4054#else
    40404055  UInt uiRasterAddrBase = (iBY - (iBY/g_uiMaxCUHeight)*g_uiMaxCUHeight)/uiMinUnitSize*cBaseColPic->getNumPartInWidth()
    40414056    + (iBX - (iBX/g_uiMaxCUWidth)*g_uiMaxCUWidth)/uiMinUnitSize;
    40424057
    40434058  uiAbsPartIdxBase = g_auiRasterToZscan[uiRasterAddrBase];
     4059#endif
    40444060
    40454061  return cBaseColPic->getCU(uiCUAddrBase);
  • branches/SHM-4.0-dev/source/Lib/TLibCommon/TComPicSym.h

    r442 r445  
    126126  TComDataCU*&  getCU( UInt uiCUAddr )  { return m_apcTComDataCU[uiCUAddr];     }
    127127 
     128#if LAYER_CTB
     129  UInt        getMaxCUWidth()           { return m_uiMaxCUWidth;                }
     130  UInt        getMaxCUHeight()          { return m_uiMaxCUHeight;               }
     131#endif
     132
    128133#if AVC_SYNTAX
    129134  UInt        getMaxCUWidth()           { return m_uiMaxCUWidth;                }
  • branches/SHM-4.0-dev/source/Lib/TLibCommon/TComPicYuv.cpp

    r313 r445  
    9090  Int numCuInHeight = m_iPicHeight / m_iCuHeight + (m_iPicHeight % m_iCuHeight != 0);
    9191 
     92#if LAYER_CTB
     93  m_iLumaMarginX    = uiMaxCUWidth  + 16; // for 16-byte alignment
     94  m_iLumaMarginY    = uiMaxCUHeight + 16;  // margin for 8-tap filter and infinite padding
     95#else
    9296  m_iLumaMarginX    = g_uiMaxCUWidth  + 16; // for 16-byte alignment
    9397  m_iLumaMarginY    = g_uiMaxCUHeight + 16;  // margin for 8-tap filter and infinite padding
     98#endif
    9499 
    95100  m_iChromaMarginX  = m_iLumaMarginX>>1;
  • branches/SHM-4.0-dev/source/Lib/TLibCommon/TComRom.cpp

    r442 r445  
    8686// Data structure related table & variable
    8787// ====================================================================================================================
    88 
     88#if LAYER_CTB
     89UInt g_auiLayerMaxCUWidth[MAX_LAYERS];
     90UInt g_auiLayerMaxCUHeight[MAX_LAYERS];
     91UInt g_auiLayerMaxCUDepth[MAX_LAYERS];
     92UInt g_auiLayerAddCUDepth[MAX_LAYERS];
     93UInt g_auiLayerZscanToRaster[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
     94UInt g_auiLayerRasterToZscan[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
     95UInt g_auiLayerRasterToPelX[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
     96UInt g_auiLayerRasterToPelY[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
     97#endif
    8998UInt g_uiMaxCUWidth  = MAX_CU_SIZE;
    9099UInt g_uiMaxCUHeight = MAX_CU_SIZE;
  • branches/SHM-4.0-dev/source/Lib/TLibCommon/TComRom.h

    r442 r445  
    8181
    8282// global variable (LCU width/height, max. CU depth)
     83#if LAYER_CTB
     84extern       UInt g_auiLayerMaxCUWidth[MAX_LAYERS];
     85extern       UInt g_auiLayerMaxCUHeight[MAX_LAYERS];
     86extern       UInt g_auiLayerMaxCUDepth[MAX_LAYERS];
     87extern       UInt g_auiLayerAddCUDepth[MAX_LAYERS];
     88extern       UInt g_auiLayerZscanToRaster[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
     89extern       UInt g_auiLayerRasterToZscan[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
     90extern       UInt g_auiLayerRasterToPelX[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
     91extern       UInt g_auiLayerRasterToPelY[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
     92#endif
    8393extern       UInt g_uiMaxCUWidth;
    8494extern       UInt g_uiMaxCUHeight;
  • branches/SHM-4.0-dev/source/Lib/TLibCommon/TypeDef.h

    r442 r445  
    6464#define VERT_MV_CONSTRAINT               1      ///< Vertical MV component constraint flag
    6565#define SCALABILITY_MASK_E0104           1      ///< JCT3V-E0104: scalability mask for depth
     66#define LAYER_CTB                        0      ///< enable layer-specific CTB structure
    6667
    6768#define ILP_SSH_SIG                      1      ///< JCTVC-N0195 proposal 2, JCTVC-N0118: add presence flag in VPS ext to condition inter-layer prediction signaling in slice segment header
  • branches/SHM-4.0-dev/source/Lib/TLibEncoder/TEncTop.cpp

    r442 r445  
    175175    }
    176176  }
     177
     178#if LAYER_CTB
     179  memcpy(g_auiLayerZscanToRaster[m_layerId], g_auiZscanToRaster, sizeof( g_auiZscanToRaster ) );
     180  memcpy(g_auiLayerRasterToZscan[m_layerId], g_auiRasterToZscan, sizeof( g_auiRasterToZscan ) );
     181  memcpy(g_auiLayerRasterToPelX[m_layerId],  g_auiRasterToPelX,  sizeof( g_auiRasterToPelX ) );
     182  memcpy(g_auiLayerRasterToPelY[m_layerId],  g_auiRasterToPelY,  sizeof( g_auiRasterToPelY ) );
     183#endif
    177184}
    178185
Note: See TracChangeset for help on using the changeset viewer.