Changeset 467 in SHVCSoftware for branches/SHM-4.0-dev/source/App


Ignore:
Timestamp:
14 Nov 2013, 00:54:41 (11 years ago)
Author:
seregin
Message:

undelete the code from the previous revision

Location:
branches/SHM-4.0-dev/source/App
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-4.0-dev/source/App/TAppDecoder/TAppDecTop.cpp

    r466 r467  
    242242        if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; }       
    243243        if (!m_outputBitDepthC) { m_outputBitDepthC = g_bitDepthC; }
     244
    244245        m_acTVideoIOYuvReconFile[curLayerId].open( m_pchReconFile[curLayerId], true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode
    245246
  • branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncCfg.cpp

    r466 r467  
    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
     
    379392  string* cfg_predLayerIdsPtr    [MAX_LAYERS];
    380393#endif
    381 #if SCALED_REF_LAYER_OFFSETS
    382394  string    cfg_scaledRefLayerLeftOffset [MAX_LAYERS];
    383395  string    cfg_scaledRefLayerTopOffset [MAX_LAYERS];
     
    390402  string*    cfg_scaledRefLayerRightOffsetPtr  [MAX_LAYERS];
    391403  string*    cfg_scaledRefLayerBottomOffsetPtr [MAX_LAYERS];
    392 #endif
    393404#if RC_SHVC_HARMONIZATION
    394405  Bool*   cfg_RCEnableRateControl  [MAX_LAYERS];
     
    424435    cfg_IntraPeriod[layer]  = &m_acLayerCfg[layer].m_iIntraPeriod;
    425436    cfg_conformanceMode[layer] = &m_acLayerCfg[layer].m_conformanceMode;
     437#if LAYER_CTB
     438    // coding unit (CU) definition
     439    cfg_uiMaxCUWidth[layer]  = &m_acLayerCfg[layer].m_uiMaxCUWidth;
     440    cfg_uiMaxCUHeight[layer] = &m_acLayerCfg[layer].m_uiMaxCUHeight;
     441    cfg_uiMaxCUDepth[layer]  = &m_acLayerCfg[layer].m_uiMaxCUDepth;
     442
     443    // transfom unit (TU) definition.
     444    cfg_uiQuadtreeTULog2MaxSize[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTULog2MaxSize;
     445    cfg_uiQuadtreeTULog2MinSize[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTULog2MinSize;
     446
     447    cfg_uiQuadtreeTUMaxDepthInter[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthInter;
     448    cfg_uiQuadtreeTUMaxDepthIntra[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthIntra;
     449#endif
    426450#if VPS_EXTN_DIRECT_REF_LAYERS
    427451#if M0457_PREDICTION_INDICATIONS
     
    437461    cfg_predLayerIdsPtr     [layer]  = &cfg_predLayerIds[layer];
    438462#endif
    439 #if SCALED_REF_LAYER_OFFSETS
    440463    cfg_numScaledRefLayerOffsets [layer] = &m_acLayerCfg[layer].m_numScaledRefLayerOffsets;
    441464    for(Int i = 0; i < MAX_LAYERS; i++)
     
    446469      cfg_scaledRefLayerBottomOffsetPtr[layer] = &cfg_scaledRefLayerBottomOffset[layer];
    447470    }
    448 #endif
    449471#if RC_SHVC_HARMONIZATION
    450472    cfg_RCEnableRateControl[layer]   = &m_acLayerCfg[layer].m_RCEnableRateControl;
     
    477499  string  cfg_tileSets;
    478500#endif
    479 #else
     501#else //SVC_EXTENSION
    480502  string cfg_InputFile;
    481503  string cfg_BitstreamFile;
    482504  string cfg_ReconFile;
    483505  string cfg_dQPFile;
    484 #endif
     506#endif //SVC_EXTENSION
    485507  string cfg_ColumnWidth;
    486508  string cfg_RowHeight;
     
    541563  ("InternalBitDepthC",       m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)")
    542564#endif
    543 #if SCALED_REF_LAYER_OFFSETS
    544565  ("NumScaledRefLayerOffsets%d",    cfg_numScaledRefLayerOffsets,     0, MAX_LAYERS,  "Number of scaled offset layer sets ")
    545566  ("ScaledRefLayerLeftOffset%d",   cfg_scaledRefLayerLeftOffsetPtr,  string(""), MAX_LAYERS, "Horizontal offset of top-left luma sample of scaled base layer picture with respect to"
     
    551572  ("ScaledRefLayerBottomOffset%d", cfg_scaledRefLayerBottomOffsetPtr,string(""), MAX_LAYERS, "Vertical offset of bottom-right luma sample of scaled base layer picture with respect to"
    552573                                                                 " bottom-right luma sample of the EL picture, in units of two luma samples")
    553 #endif
    554574#if O0194_DIFFERENT_BITDEPTH_EL_BL
    555575  ("InputBitDepth%d",       cfg_InputBitDepthY,    8, MAX_LAYERS, "Bit-depth of input file for layer %d")
     
    576596  ("IlSampleOnlyPred%d",       m_ilSampleOnlyPred, 0, MAX_LAYERS, "Set inter_layer_sample_pred_only_flag for all slices")
    577597#endif
    578 #else
     598#else //SVC_EXTENSION
    579599  ("InputFile,i",           cfg_InputFile,     string(""), "Original YUV input file name")
    580600  ("BitstreamFile,b",       cfg_BitstreamFile, string(""), "Bitstream output file name")
     
    597617  ("ConfBottom",            m_confBottom,          0, "Bottom offset for window conformance mode 3")
    598618  ("FrameRate,-fr",         m_iFrameRate,          0, "Frame rate")
    599 #endif
     619#endif //SVC_EXTENSION
    600620
    601621  //Field coding parameters
     
    614634  ("FrameOnly",         m_frameOnlyConstraintFlag, false, "Indicate that the bitstream contains only frames")
    615635
     636#if LAYER_CTB
     637  // Unit definition parameters
     638  ("MaxCUWidth%d",              cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU width")
     639  ("MaxCUHeight%d",             cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU height")
     640  // todo: remove defaults from MaxCUSize
     641  ("MaxCUSize%d,s%d",           cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU size")
     642  ("MaxCUSize%d,s%d",           cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU size")
     643  ("MaxPartitionDepth%d,h%d",   cfg_uiMaxCUDepth,              4u, MAX_LAYERS, "CU depth")
     644 
     645  ("QuadtreeTULog2MaxSize%d",   cfg_uiQuadtreeTULog2MaxSize,   6u, MAX_LAYERS, "Maximum TU size in logarithm base 2")
     646  ("QuadtreeTULog2MinSize%d",   cfg_uiQuadtreeTULog2MinSize,   2u, MAX_LAYERS, "Minimum TU size in logarithm base 2")
     647 
     648  ("QuadtreeTUMaxDepthIntra%d", cfg_uiQuadtreeTUMaxDepthIntra, 1u, MAX_LAYERS, "Depth of TU tree for intra CUs")
     649  ("QuadtreeTUMaxDepthInter%d", cfg_uiQuadtreeTUMaxDepthInter, 2u, MAX_LAYERS, "Depth of TU tree for inter CUs")
     650
     651
     652  // set the same CU realted settings across all the layers if config file parameters are not layer specific
     653  ("MaxCUWidth",              cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU width")
     654  ("MaxCUHeight",             cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU height")
     655  // todo: remove defaults from MaxCUSize
     656  ("MaxCUSize,s",             cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU size")
     657  ("MaxCUSize,s",             cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU size")
     658  ("MaxPartitionDepth,h",     cfg_uiMaxCUDepth,              4u, MAX_LAYERS, "CU depth")
     659 
     660  ("QuadtreeTULog2MaxSize",   cfg_uiQuadtreeTULog2MaxSize,   6u, MAX_LAYERS, "Maximum TU size in logarithm base 2")
     661  ("QuadtreeTULog2MinSize",   cfg_uiQuadtreeTULog2MinSize,   2u, MAX_LAYERS, "Minimum TU size in logarithm base 2")
     662 
     663  ("QuadtreeTUMaxDepthIntra", cfg_uiQuadtreeTUMaxDepthIntra, 1u, MAX_LAYERS, "Depth of TU tree for intra CUs")
     664  ("QuadtreeTUMaxDepthInter", cfg_uiQuadtreeTUMaxDepthInter, 2u, MAX_LAYERS, "Depth of TU tree for inter CUs")
     665#else
    616666  // Unit definition parameters
    617667  ("MaxCUWidth",              m_uiMaxCUWidth,             64u)
     
    627677  ("QuadtreeTUMaxDepthIntra", m_uiQuadtreeTUMaxDepthIntra, 1u, "Depth of TU tree for intra CUs")
    628678  ("QuadtreeTUMaxDepthInter", m_uiQuadtreeTUMaxDepthInter, 2u, "Depth of TU tree for inter CUs")
     679#endif
    629680 
    630681  // Coding structure paramters
     
    9501001  m_BLSyntaxFile = cfg_BLSyntaxFile.empty() ? NULL : strdup(cfg_BLSyntaxFile.c_str());
    9511002#endif
    952 #else
     1003#else //SVC_EXTENSION
    9531004  m_pchInputFile = cfg_InputFile.empty() ? NULL : strdup(cfg_InputFile.c_str());
    9541005  m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str());
    9551006  m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str());
    9561007  m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str());
    957 #endif
     1008#endif //SVC_EXTENSION
    9581009
    9591010  Char* pColumnWidth = cfg_ColumnWidth.empty() ? NULL: strdup(cfg_ColumnWidth.c_str());
     
    10141065    m_pRowHeight = NULL;
    10151066  }
    1016 #if SCALED_REF_LAYER_OFFSETS
     1067#if SVC_EXTENSION
    10171068  for(Int layer = 0; layer < MAX_LAYERS; layer++)
    10181069  {
     
    10841135    }
    10851136  }
    1086 #endif
    10871137#if VPS_EXTN_DIRECT_REF_LAYERS
    10881138#if M0457_PREDICTION_INDICATIONS
     
    12141264  }
    12151265#endif
     1266#endif //SVC_EXTENSION
    12161267  m_scalingListFile = cfg_ScalingListFile.empty() ? NULL : strdup(cfg_ScalingListFile.c_str());
    12171268
     
    14431494 
    14441495  // set global varibles
     1496#if LAYER_CTB
     1497  for(Int layer = 0; layer < MAX_LAYERS; layer++)
     1498  {
     1499    xSetGlobal(layer);
     1500  }
     1501#else
    14451502  xSetGlobal();
     1503#endif
    14461504 
    14471505  // print-out parameters
     
    15101568  xConfirmPara( m_bipredSearchRange < 0 ,                                                   "Search Range must be more than 0" );
    15111569  xConfirmPara( m_iMaxDeltaQP > 7,                                                          "Absolute Delta QP exceeds supported range (0 to 7)" );
     1570#if LAYER_CTB
     1571  for(UInt layer = 0; layer < MAX_LAYERS; layer++)
     1572  {
     1573    xConfirmPara( m_iMaxCuDQPDepth > m_acLayerCfg[layer].m_uiMaxCUDepth - 1,                "Absolute depth for a minimum CuDQP exceeds maximum coding unit depth" );
     1574  }
     1575#else
    15121576  xConfirmPara( m_iMaxCuDQPDepth > m_uiMaxCUDepth - 1,                                          "Absolute depth for a minimum CuDQP exceeds maximum coding unit depth" );
     1577#endif
    15131578
    15141579  xConfirmPara( m_cbQpOffset < -12,   "Min. Chroma Cb QP Offset is -12" );
     
    15241589  }
    15251590#endif
     1591#if !LAYER_CTB
    15261592  xConfirmPara( (m_uiMaxCUWidth  >> m_uiMaxCUDepth) < 4,                                    "Minimum partition width size should be larger than or equal to 8");
    15271593  xConfirmPara( (m_uiMaxCUHeight >> m_uiMaxCUDepth) < 4,                                    "Minimum partition height size should be larger than or equal to 8");
    15281594  xConfirmPara( m_uiMaxCUWidth < 16,                                                        "Maximum partition width size should be larger than or equal to 16");
    15291595  xConfirmPara( m_uiMaxCUHeight < 16,                                                       "Maximum partition height size should be larger than or equal to 16");
     1596#endif
    15301597#if !SVC_EXTENSION
    15311598  xConfirmPara( (m_iSourceWidth  % (m_uiMaxCUWidth  >> (m_uiMaxCUDepth-1)))!=0,             "Resulting coded frame width must be a multiple of the minimum CU size");
     
    15331600#endif
    15341601 
     1602#if !LAYER_CTB
    15351603  xConfirmPara( m_uiQuadtreeTULog2MinSize < 2,                                        "QuadtreeTULog2MinSize must be 2 or greater.");
    15361604  xConfirmPara( m_uiQuadtreeTULog2MaxSize > 5,                                        "QuadtreeTULog2MaxSize must be 5 or smaller.");
     
    15461614  xConfirmPara( m_uiQuadtreeTUMaxDepthIntra < 1,                                                         "QuadtreeTUMaxDepthIntra must be greater than or equal to 1" );
    15471615  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" );
     1616#endif
    15481617 
    15491618  xConfirmPara(  m_maxNumMergeCand < 1,  "MaxNumMergeCand must be 1 or greater.");
     
    15931662#endif
    15941663
     1664#if !LAYER_CTB
    15951665  // max CU width and height should be power of 2
    15961666  UInt ui = m_uiMaxCUWidth;
     
    16081678      xConfirmPara( ui != 1 , "Height should be 2^n");
    16091679  }
    1610 
     1680#endif
    16111681
    16121682  /* if this is an intra-only sequence, ie IntraPeriod=1, don't verify the GOP structure
     
    20052075    Int m_iSourceWidth = m_acLayerCfg[layer].m_iSourceWidth;
    20062076    Int m_iSourceHeight = m_acLayerCfg[layer].m_iSourceHeight;
     2077#if LAYER_CTB
     2078    Int m_uiMaxCUWidth = m_acLayerCfg[layer].m_uiMaxCUWidth;
     2079    Int m_uiMaxCUHeight = m_acLayerCfg[layer].m_uiMaxCUHeight;
     2080#endif
    20072081#endif
    20082082  if(m_vuiParametersPresentFlag && m_bitstreamRestrictionFlag)
     
    22492323/** \todo use of global variables should be removed later
    22502324 */
     2325#if LAYER_CTB
     2326Void TAppEncCfg::xSetGlobal(UInt layerId)
     2327{
     2328  // set max CU width & height
     2329  g_auiLayerMaxCUWidth[layerId]  = m_acLayerCfg[layerId].m_uiMaxCUWidth;
     2330  g_auiLayerMaxCUHeight[layerId] = m_acLayerCfg[layerId].m_uiMaxCUHeight;
     2331 
     2332  // compute actual CU depth with respect to config depth and max transform size
     2333  g_auiLayerAddCUDepth[layerId]  = 0;
     2334  while( (m_acLayerCfg[layerId].m_uiMaxCUWidth>>m_acLayerCfg[layerId].m_uiMaxCUDepth) > ( 1 << ( m_acLayerCfg[layerId].m_uiQuadtreeTULog2MinSize + g_auiLayerAddCUDepth[layerId] )  ) ) g_auiLayerAddCUDepth[layerId]++;
     2335 
     2336  m_acLayerCfg[layerId].m_uiMaxCUDepth += g_auiLayerAddCUDepth[layerId];
     2337  g_auiLayerAddCUDepth[layerId]++;
     2338  g_auiLayerMaxCUDepth[layerId] = m_acLayerCfg[layerId].m_uiMaxCUDepth;
     2339 
     2340#if O0194_DIFFERENT_BITDEPTH_EL_BL
     2341  // set internal bit-depth to constant value to make sure to be updated later
     2342  g_bitDepthY = -1;
     2343  g_bitDepthC = -1;
     2344 
     2345  g_uiPCMBitDepthLuma = -1;
     2346  g_uiPCMBitDepthChroma = -1;
     2347#else
     2348  // set internal bit-depth and constants
     2349  g_bitDepthY = m_internalBitDepthY;
     2350  g_bitDepthC = m_internalBitDepthC;
     2351 
     2352  g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_inputBitDepthY : m_internalBitDepthY;
     2353  g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_inputBitDepthC : m_internalBitDepthC;
     2354#endif
     2355}
     2356#else
    22512357Void TAppEncCfg::xSetGlobal()
    22522358{
     
    22782384#endif
    22792385}
     2386#endif
    22802387
    22812388Void TAppEncCfg::xPrintParameter()
     
    23312438    printf("Frame index                  : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
    23322439  }
     2440#if !LAYER_CTB
    23332441  printf("CU size / depth              : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth );
    23342442  printf("RQT trans. size (min / max)  : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize );
    23352443  printf("Max RQT depth inter          : %d\n", m_uiQuadtreeTUMaxDepthInter);
    23362444  printf("Max RQT depth intra          : %d\n", m_uiQuadtreeTUMaxDepthIntra);
     2445#endif
    23372446  printf("Min PCM size                 : %d\n", 1 << m_uiPCMLog2MinSize);
    23382447  printf("Motion search range          : %d\n", m_iSearchRange );
     
    24222531  printf("CIP:%d ", m_bUseConstrainedIntraPred);
    24232532  printf("SAO:%d ", (m_bUseSAO)?(1):(0));
     2533#if !LAYER_CTB
    24242534  printf("PCM:%d ", (m_usePCM && (1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0);
     2535#endif
    24252536  printf("SAOLcuBasedOptimization:%d ", (m_saoLcuBasedOptimization)?(1):(0));
    24262537
     
    24722583}
    24732584
    2474 #if SCALED_REF_LAYER_OFFSETS
     2585#if SVC_EXTENSION
    24752586Void TAppEncCfg::cfgStringToArray(Int **arr, string cfgString, Int numEntries, const char* logString)
    24762587{
     
    25052616  }
    25062617}
    2507 #endif
    25082618
    25092619#if FINAL_RPL_CHANGE_N0082
     
    27212831}
    27222832#endif
     2833#endif //SVC_EXTENSION
    27232834//! \}
  • branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncCfg.h

    r466 r467  
    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)
     
    355357#endif
    356358  // internal member functions
     359#if LAYER_CTB
     360  Void  xSetGlobal      (UInt layerId);                       ///< set global variables
     361#else
    357362  Void  xSetGlobal      ();                                   ///< set global variables
     363#endif
    358364  Void  xCheckParameter ();                                   ///< check validity of configuration values
    359365  Void  xPrintParameter ();                                   ///< print configuration values
     
    399405  UInt getInternalBitDepthC()      {return m_internalBitDepthC; }
    400406#endif
     407#if !LAYER_CTB
    401408  UInt getMaxCUWidth()             {return m_uiMaxCUWidth;      }
    402409  UInt getMaxCUHeight()            {return m_uiMaxCUHeight;     }
    403410  UInt getMaxCUDepth()             {return m_uiMaxCUDepth;      }
     411#endif
    404412  Int  getDecodingRefreshType()    {return m_iDecodingRefreshType; }
    405413  Int  getWaveFrontSynchro()        { return m_iWaveFrontSynchro; }
     
    408416  Char* getBLSyntaxFile()           { return m_BLSyntaxFile;      }
    409417#endif
    410 #if SCALED_REF_LAYER_OFFSETS
    411418  Void cfgStringToArray(Int **arr, string cfgString, Int numEntries, const char* logString);
    412 #endif
    413419#if REPN_FORMAT_IN_VPS
    414420  RepFormatCfg* getRepFormatCfg(Int i)  { return &m_repFormatCfg[i]; }
    415421#endif
     422#if LAYER_CTB
     423  Bool getUsePCM()                  { return m_usePCM;               }
     424  UInt getPCMLog2MinSize  ()        { return  m_uiPCMLog2MinSize;    }
     425#endif
    416426#endif
    417427};// END CLASS DEFINITION TAppEncCfg
  • branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncLayerCfg.cpp

    r466 r467  
    3838  m_confLeft = m_confRight = m_confTop = m_confBottom = 0;
    3939  m_aiPad[1] = m_aiPad[0] = 0;
    40 #if SCALED_REF_LAYER_OFFSETS
    4140  m_numScaledRefLayerOffsets = 0;
    4241  ::memset(m_scaledRefLayerLeftOffset,   0, sizeof(m_scaledRefLayerLeftOffset));
     
    4443  ::memset(m_scaledRefLayerRightOffset,  0, sizeof(m_scaledRefLayerRightOffset));
    4544  ::memset(m_scaledRefLayerBottomOffset, 0, sizeof(m_scaledRefLayerBottomOffset));
    46 #endif
    4745}
    4846
     
    142140  printf("Real     Format               : %dx%d %dHz\n", m_iSourceWidth - m_confLeft - m_confRight, m_iSourceHeight - m_confTop - m_confBottom, m_iFrameRate );
    143141  printf("Internal Format               : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate );
     142#if LAYER_CTB
     143  printf("CU size / depth               : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth );
     144  printf("RQT trans. size (min / max)   : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize );
     145  printf("Max RQT depth inter           : %d\n", m_uiQuadtreeTUMaxDepthInter);
     146  printf("Max RQT depth intra           : %d\n", m_uiQuadtreeTUMaxDepthIntra);
     147#endif
    144148  printf("QP                            : %5.2f\n", m_fQP );
    145149  printf("Intra period                  : %d\n", m_iIntraPeriod );
     
    157161#endif
    158162  printf("WaveFrontSynchro:%d WaveFrontSubstreams:%d", m_cAppEncCfg->getWaveFrontSynchro(), m_iWaveFrontSubstreams);
     163#if LAYER_CTB
     164  printf("PCM:%d ", (m_cAppEncCfg->getUsePCM() && (1<<m_cAppEncCfg->getPCMLog2MinSize()) <= m_uiMaxCUWidth)? 1 : 0);
     165#endif
    159166}
    160167
     
    175182    {
    176183      // automatic padding to minimum CU size
     184#if LAYER_CTB
     185      Int minCuSize = m_uiMaxCUHeight >> (m_uiMaxCUDepth - 1);
     186#else
    177187      Int minCuSize = m_cAppEncCfg->getMaxCUHeight() >> (m_cAppEncCfg->getMaxCUDepth() - 1);
     188#endif
    178189      if (m_iSourceWidth % minCuSize)
    179190      {
     
    240251  }
    241252
     253#if LAYER_CTB
     254  UInt maxCUWidth = m_uiMaxCUWidth;
     255  UInt maxCUHeight = m_uiMaxCUHeight;
     256  UInt maxCUDepth = m_uiMaxCUDepth;
     257#else
    242258  UInt maxCUWidth = m_cAppEncCfg->getMaxCUWidth();
    243259  UInt maxCUHeight = m_cAppEncCfg->getMaxCUHeight();
    244260  UInt maxCUDepth = m_cAppEncCfg->getMaxCUDepth();
     261#endif
    245262  bool check_failed = false; /* abort if there is a fatal configuration problem */
    246263#define xConfirmPara(a,b) check_failed |= confirmPara(a,b)
     
    264281
    265282
    266   m_iWaveFrontSubstreams = m_cAppEncCfg->getWaveFrontSynchro() ? (m_iSourceHeight + m_cAppEncCfg->getMaxCUHeight() - 1) / m_cAppEncCfg->getMaxCUHeight() : 1;
     283  m_iWaveFrontSubstreams = m_cAppEncCfg->getWaveFrontSynchro() ? (m_iSourceHeight + maxCUHeight - 1) / maxCUHeight : 1;
    267284  xConfirmPara( m_iWaveFrontSubstreams <= 0, "WaveFrontSubstreams must be positive" );
    268285  xConfirmPara( m_iWaveFrontSubstreams > 1 && !m_cAppEncCfg->getWaveFrontSynchro(), "Must have WaveFrontSynchro > 0 in order to have WaveFrontSubstreams > 1" );
     
    279296  xConfirmPara( m_confTop    % TComSPS::getWinUnitY(CHROMA_420) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling");
    280297  xConfirmPara( m_confBottom % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling");
     298
     299#if LAYER_CTB 
     300  xConfirmPara( (m_uiMaxCUWidth  >> m_uiMaxCUDepth) < 4,                                    "Minimum partition width size should be larger than or equal to 8");
     301  xConfirmPara( (m_uiMaxCUHeight >> m_uiMaxCUDepth) < 4,                                    "Minimum partition height size should be larger than or equal to 8");
     302  xConfirmPara( m_uiMaxCUWidth < 16,                                                        "Maximum partition width size should be larger than or equal to 16");
     303  xConfirmPara( m_uiMaxCUHeight < 16,                                                       "Maximum partition height size should be larger than or equal to 16");
     304  xConfirmPara( m_uiQuadtreeTULog2MinSize < 2,                                        "QuadtreeTULog2MinSize must be 2 or greater.");
     305  xConfirmPara( m_uiQuadtreeTULog2MaxSize > 5,                                        "QuadtreeTULog2MaxSize must be 5 or smaller.");
     306  xConfirmPara( (1<<m_uiQuadtreeTULog2MaxSize) > m_uiMaxCUWidth,                                        "QuadtreeTULog2MaxSize must be log2(maxCUSize) or smaller.");
     307  xConfirmPara( m_uiQuadtreeTULog2MaxSize < m_uiQuadtreeTULog2MinSize,                "QuadtreeTULog2MaxSize must be greater than or equal to m_uiQuadtreeTULog2MinSize.");
     308  xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUWidth >>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS
     309  xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUHeight>>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS
     310  xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUWidth  >> m_uiMaxCUDepth ), "Minimum CU width must be greater than minimum transform size." );
     311  xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUHeight >> m_uiMaxCUDepth ), "Minimum CU height must be greater than minimum transform size." );
     312  xConfirmPara( m_uiQuadtreeTUMaxDepthInter < 1,                                                         "QuadtreeTUMaxDepthInter must be greater than or equal to 1" );
     313  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" );
     314  xConfirmPara( m_uiQuadtreeTUMaxDepthIntra < 1,                                                         "QuadtreeTUMaxDepthIntra must be greater than or equal to 1" );
     315  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" );
     316
     317  // max CU width and height should be power of 2
     318  UInt ui = m_uiMaxCUWidth;
     319  while(ui)
     320  {
     321    ui >>= 1;
     322    if( (ui & 1) == 1)
     323      xConfirmPara( ui != 1 , "Width should be 2^n");
     324  }
     325  ui = m_uiMaxCUHeight;
     326  while(ui)
     327  {
     328    ui >>= 1;
     329    if( (ui & 1) == 1)
     330      xConfirmPara( ui != 1 , "Height should be 2^n");
     331  }
     332#endif
     333
    281334#undef xConfirmPara
    282335  return check_failed;
    283336}
    284337
    285 #endif
     338#endif //SVC_EXTENSION
    286339
    287340
  • branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncLayerCfg.h

    r466 r467  
    4343  Int       m_iIntraPeriod;                                   ///< period of I-slice (random access period)
    4444  Double    m_fQP;                                            ///< QP value of key-picture (floating point)
     45#if SVC_EXTENSION
    4546#if VPS_EXTN_DIRECT_REF_LAYERS
    4647#if M0457_PREDICTION_INDICATIONS
     
    5556  Int       *m_predLayerIds;
    5657  Int       m_numActiveRefLayers;
     58#endif
     59
     60#if LAYER_CTB
     61  // coding unit (CU) definition
     62  UInt      m_uiMaxCUWidth;                                   ///< max. CU width in pixel
     63  UInt      m_uiMaxCUHeight;                                  ///< max. CU height in pixel
     64  UInt      m_uiMaxCUDepth;                                   ///< max. CU depth
     65 
     66  // transfom unit (TU) definition
     67  UInt      m_uiQuadtreeTULog2MaxSize;
     68  UInt      m_uiQuadtreeTULog2MinSize;
     69 
     70  UInt      m_uiQuadtreeTUMaxDepthInter;
     71  UInt      m_uiQuadtreeTUMaxDepthIntra;
    5772#endif
    5873
     
    7085  Int       m_maxTidIlRefPicsPlus1;
    7186#endif
    72 #if SVC_EXTENSION
    7387  Int       m_iWaveFrontSubstreams; //< If iWaveFrontSynchro, this is the number of substreams per frame (dependent tiles) or per tile (independent tiles).
    74 #endif
     88#endif //SVC_EXTENSION
    7589
    7690  Int       m_iQP;                                            ///< QP value of key-picture (integer)
     
    7892  Int*      m_aidQP;                                          ///< array of slice QP values
    7993  TAppEncCfg* m_cAppEncCfg;                                   ///< pointer to app encoder config
    80 #if SCALED_REF_LAYER_OFFSETS
     94#if SVC_EXTENSION
    8195  Int       m_numScaledRefLayerOffsets  ;
    8296  Int       m_scaledRefLayerLeftOffset  [MAX_LAYERS];
     
    8498  Int       m_scaledRefLayerRightOffset [MAX_LAYERS];
    8599  Int       m_scaledRefLayerBottomOffset[MAX_LAYERS];
    86 #endif 
    87100#if FINAL_RPL_CHANGE_N0082
    88101  GOPEntry  m_GOPListLayer[MAX_GOP];                            ///< for layer
     
    99112  Int       m_repFormatIdx;
    100113#endif
     114#endif //SVC_EXTENSION
    101115public:
    102116  TAppEncLayerCfg();
     
    133147  Int     getIntQP()                  {return m_iQP;              }
    134148  Int*    getdQPs()                   {return m_aidQP;            }
     149#if SVC_EXTENSION
    135150#if VPS_EXTN_DIRECT_REF_LAYERS
    136151#if M0457_PREDICTION_INDICATIONS
     
    172187  Int     getMaxTidIlRefPicsPlus1()   { return m_maxTidIlRefPicsPlus1; }
    173188#endif
     189#if LAYER_CTB
     190  UInt getMaxCUWidth()             {return m_uiMaxCUWidth;      }
     191  UInt getMaxCUHeight()            {return m_uiMaxCUHeight;     }
     192  UInt getMaxCUDepth()             {return m_uiMaxCUDepth;      }
     193#endif
     194#endif //SVC_EXTENSION
    174195}; // END CLASS DEFINITION TAppEncLayerCfg
    175196
  • branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r466 r467  
    375375    m_acTEncTop[layer].setUseRDOQTS                    ( m_useRDOQTS   );
    376376    m_acTEncTop[layer].setRDpenalty                    ( m_rdPenalty );
     377#if LAYER_CTB
     378    m_acTEncTop[layer].setQuadtreeTULog2MaxSize        ( m_acLayerCfg[layer].m_uiQuadtreeTULog2MaxSize );
     379    m_acTEncTop[layer].setQuadtreeTULog2MinSize        ( m_acLayerCfg[layer].m_uiQuadtreeTULog2MinSize );
     380    m_acTEncTop[layer].setQuadtreeTUMaxDepthInter      ( m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthInter );
     381    m_acTEncTop[layer].setQuadtreeTUMaxDepthIntra      ( m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthIntra );
     382#else
    377383    m_acTEncTop[layer].setQuadtreeTULog2MaxSize        ( m_uiQuadtreeTULog2MaxSize );
    378384    m_acTEncTop[layer].setQuadtreeTULog2MinSize        ( m_uiQuadtreeTULog2MinSize );
    379385    m_acTEncTop[layer].setQuadtreeTUMaxDepthInter      ( m_uiQuadtreeTUMaxDepthInter );
    380386    m_acTEncTop[layer].setQuadtreeTUMaxDepthIntra      ( m_uiQuadtreeTUMaxDepthIntra );
     387#endif
    381388    m_acTEncTop[layer].setUseFastEnc                   ( m_bUseFastEnc  );
    382389    m_acTEncTop[layer].setUseEarlyCU                   ( m_bUseEarlyCU  );
     
    417424    m_acTEncTop[layer].setSliceSegmentMode        ( m_sliceSegmentMode         );
    418425    m_acTEncTop[layer].setSliceSegmentArgument    ( m_sliceSegmentArgument     );
     426#if LAYER_CTB
     427    Int iNumPartInCU = 1<<(m_acLayerCfg[layer].m_uiMaxCUDepth<<1);
     428#else
    419429    Int iNumPartInCU = 1<<(m_uiMaxCUDepth<<1);
     430#endif
    420431    if(m_sliceSegmentMode==FIXED_NUMBER_OF_LCU)
    421432    {
     
    574585    m_acTEncTop[layer].setLog2MaxMvLengthVertical( m_log2MaxMvLengthVertical );
    575586    m_acTEncTop[layer].setElRapSliceTypeB(layer == 0? 0 : m_elRapSliceBEnabled);
    576 #if SCALED_REF_LAYER_OFFSETS
    577587    if( layer > 0 )
    578588    {
     
    584594      }
    585595    }
    586 #endif
    587596#if M0040_ADAPTIVE_RESOLUTION_CHANGE
    588597    m_acTEncTop[layer].setAdaptiveResolutionChange( m_adaptiveResolutionChange );
     
    590599  }
    591600}
    592 #else
     601#else //SVC_EXTENSION
    593602Void TAppEncTop::xInitLibCfg()
    594603{
     
    864873  m_cTEncTop.setLog2MaxMvLengthVertical( m_log2MaxMvLengthVertical );
    865874}
    866 #endif
     875#endif //SVC_EXTENSION
    867876
    868877Void TAppEncTop::xCreateLib()
     
    875884  for(UInt layer=0; layer<m_numLayers; layer++)
    876885  {
     886#if LAYER_CTB
     887    g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
     888    g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer];
     889    g_uiMaxCUDepth  = g_auiLayerMaxCUDepth[layer];
     890    g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
     891#endif
    877892#if O0194_DIFFERENT_BITDEPTH_EL_BL
    878893    //2
     
    901916    m_acTEncTop[layer].create();
    902917  }
    903 #else
     918#else //SVC_EXTENSION
    904919  m_cTVideoIOYuvInputFile.open( m_pchInputFile,     false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC );  // read  mode
    905920  m_cTVideoIOYuvInputFile.skipFrames(m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1]);
     
    910925  // Neo Decoder
    911926  m_cTEncTop.create();
    912 #endif
     927#endif //SVC_EXTENSION
    913928}
    914929
     
    922937  for(UInt layer=0; layer<m_numLayers; layer++)
    923938  {
     939#if LAYER_CTB
     940    g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
     941    g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer];
     942    g_uiMaxCUDepth  = g_auiLayerMaxCUDepth[layer];
     943    g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
     944#endif
     945
    924946    m_acTVideoIOYuvInputFile[layer].close();
    925947    m_acTVideoIOYuvReconFile[layer].close();
     
    927949    m_acTEncTop[layer].destroy();
    928950  }
    929 #else
     951#else //SVC_EXTENSION
    930952  m_cTVideoIOYuvInputFile.close();
    931953  m_cTVideoIOYuvReconFile.close();
     
    933955  // Neo Decoder
    934956  m_cTEncTop.destroy();
    935 #endif
     957#endif //SVC_EXTENSION
    936958}
    937959
     
    941963  for(UInt layer=0; layer<m_numLayers; layer++)
    942964  {
     965#if LAYER_CTB
     966    g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
     967    g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer];
     968    g_uiMaxCUDepth  = g_auiLayerMaxCUDepth[layer];
     969    g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
     970       
     971    memcpy( g_auiZscanToRaster, g_auiLayerZscanToRaster[layer], sizeof( g_auiZscanToRaster ) );
     972    memcpy( g_auiRasterToZscan, g_auiLayerRasterToZscan[layer], sizeof( g_auiRasterToZscan ) );
     973    memcpy( g_auiRasterToPelX,  g_auiLayerRasterToPelX[layer],  sizeof( g_auiRasterToPelX ) );
     974    memcpy( g_auiRasterToPelY,  g_auiLayerRasterToPelY[layer],  sizeof( g_auiRasterToPelY ) );
     975#endif
    943976#if O0194_DIFFERENT_BITDEPTH_EL_BL
    944977    //3
     
    10581091#endif
    10591092  // Target output layer
    1060 #if VPS_PROFILE_OUTPUT_LAYERS
    10611093  vps->setNumOutputLayerSets(vps->getNumLayerSets());
    10621094  vps->setNumProfileTierLevel(vps->getNumLayerSets());
     
    10671099    vps->setOutputLayerSetIdx(i, i);
    10681100  }
    1069 #else
    1070   vps->setNumOutputLayerSets(1);
    1071   Int lsIdx = 1;
    1072   vps->setOutputLayerSetIdx(0, lsIdx); // Because only one layer set
    1073 #endif
     1101
    10741102  for(Int lsIdx = 1; lsIdx < vps->getNumLayerSets(); lsIdx++)
    10751103  {
     
    12281256    {
    12291257#if SVC_UPSAMPLING
     1258#if LAYER_CTB
     1259      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 );
     1260#else
    12301261      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
     1262#endif
    12311263#else
    12321264      pcPicYuvOrg->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     
    12361268    {
    12371269#if SVC_UPSAMPLING
     1270#if LAYER_CTB
     1271      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 );
     1272#else
    12381273      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
     1274#endif
    12391275#else
    12401276      pcPicYuvOrg->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     
    12711307      for(UInt layer=0; layer<m_numLayers; layer++)
    12721308      {
     1309#if LAYER_CTB
     1310        g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
     1311        g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer];
     1312        g_uiMaxCUDepth  = g_auiLayerMaxCUDepth[layer];
     1313        g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
     1314#endif
    12731315#if O0194_DIFFERENT_BITDEPTH_EL_BL
    12741316        //6
     
    13461388      for(UInt layer=0; layer<m_numLayers; layer++)
    13471389      {
     1390#if LAYER_CTB
     1391        g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
     1392        g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer];
     1393        g_uiMaxCUDepth  = g_auiLayerMaxCUDepth[layer];
     1394        g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
     1395
     1396        memcpy( g_auiZscanToRaster, g_auiLayerZscanToRaster[layer], sizeof( g_auiZscanToRaster ) );
     1397        memcpy( g_auiRasterToZscan, g_auiLayerRasterToZscan[layer], sizeof( g_auiRasterToZscan ) );
     1398        memcpy( g_auiRasterToPelX,  g_auiLayerRasterToPelX[layer],  sizeof( g_auiRasterToPelX ) );
     1399        memcpy( g_auiRasterToPelY,  g_auiLayerRasterToPelY[layer],  sizeof( g_auiRasterToPelY ) );
     1400#endif
    13481401#if O0194_DIFFERENT_BITDEPTH_EL_BL
    13491402        //7
     
    16271680
    16281681#if SVC_UPSAMPLING
     1682#if LAYER_CTB
     1683    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 );
     1684#else
    16291685    rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
     1686#endif
    16301687#else
    16311688    rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
Note: See TracChangeset for help on using the changeset viewer.