Changeset 1290 in SHVCSoftware for branches/SHM-dev/source/Lib/TLibEncoder


Ignore:
Timestamp:
18 Jul 2015, 01:59:29 (10 years ago)
Author:
seregin
Message:

port rev 4324 (g_uiMaxDepth, g_uiAddDepth)

Location:
branches/SHM-dev/source/Lib/TLibEncoder
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp

    r1287 r1290  
    642642#endif
    643643  assert( pcSPS->getMaxCUWidth() == pcSPS->getMaxCUHeight() );
    644 
    645644  WRITE_UVLC( pcSPS->getLog2MinCodingBlockSize() - 3,                                "log2_min_luma_coding_block_size_minus3" );
    646645  WRITE_UVLC( pcSPS->getLog2DiffMaxMinCodingBlockSize(),                             "log2_diff_max_min_luma_coding_block_size" );
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h

    r1289 r1290  
    148148  UInt      m_maxCUWidth;
    149149  UInt      m_maxCUHeight;
     150  UInt      m_maxTotalCUDepth;
     151  UInt      m_log2DiffMaxMinCodingBlockSize;
     152
    150153  //======= Transform =============
    151154  UInt      m_uiQuadtreeTULog2MaxSize;
     
    515518  Void      setMaxCUWidth                   ( UInt  u )      { m_maxCUWidth  = u; }
    516519  Void      setMaxCUHeight                  ( UInt  u )      { m_maxCUHeight = u; }
     520  Void      setMaxTotalCUDepth              ( UInt  u )      { m_maxTotalCUDepth = u; }
     521  Void      setLog2DiffMaxMinCodingBlockSize( UInt  u )      { m_log2DiffMaxMinCodingBlockSize = u; }
    517522
    518523  //======== Transform =============
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncCu.cpp

    r1289 r1290  
    374374  const TComPPS &pps=*(rpcTempCU->getSlice()->getPPS());
    375375  const TComSPS &sps=*(rpcTempCU->getSlice()->getSPS());
    376   const UInt maxCUWidth = sps.getMaxCUWidth();
    377376
    378377  // get Original YUV data from picture
     
    399398  const UInt numberValidComponents = rpcBestCU->getPic()->getNumberValidComponents();
    400399
    401   if( (maxCUWidth>>uiDepth) >= (maxCUWidth >> ( pps.getMaxCuDQPDepth())) ) // TODO: tidy expression
     400  if( uiDepth <= pps.getMaxCuDQPDepth() )
    402401  {
    403402    Int idQP = m_pcEncCfg->getMaxDeltaQP();
     
    565564        {
    566565          // 2Nx2N, NxN
     566
    567567          if(!( (rpcBestCU->getWidth(0)==8) && (rpcBestCU->getHeight(0)==8) ))
    568568          {
    569             if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth && doNotBlockPu)
     569            if( uiDepth == sps.getLog2DiffMaxMinCodingBlockSize() && doNotBlockPu)
    570570            {
    571571              xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_NxN DEBUG_STRING_PASS_INTO(sDebug)   );
     
    594594
    595595          //! Try AMP (SIZE_2NxnU, SIZE_2NxnD, SIZE_nLx2N, SIZE_nRx2N)
    596           if(sps.getUseAMP() && uiDepth < g_uiMaxCUDepth-g_uiAddCUDepth )
     596          if(sps.getUseAMP() && uiDepth < sps.getLog2DiffMaxMinCodingBlockSize() )
    597597          {
    598598#if AMP_ENC_SPEEDUP
     
    721721          xCheckRDCostIntra( rpcBestCU, rpcTempCU, intraCost, SIZE_2Nx2N DEBUG_STRING_PASS_INTO(sDebug) );
    722722          rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    723           if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth )
     723          if( uiDepth == sps.getLog2DiffMaxMinCodingBlockSize() )
    724724          {
    725725            if( rpcTempCU->getWidth(0) > ( 1 << sps.getQuadtreeTULog2MinSize() ) )
     
    802802  }
    803803
    804   if( (maxCUWidth>>uiDepth) == (maxCUWidth >> ( pps.getMaxCuDQPDepth())) ) // TODO: tidy expression
     804  if( uiDepth == pps.getMaxCuDQPDepth() )
    805805  {
    806806    Int idQP = m_pcEncCfg->getMaxDeltaQP();
     
    813813#endif   
    814814  }
    815   else if( (maxCUWidth>>uiDepth) > (maxCUWidth >> ( pps.getMaxCuDQPDepth())) ) // TODO: tidy expression
     815  else if( uiDepth < pps.getMaxCuDQPDepth() )
    816816  {
    817817    iMinQP = iBaseQP;
     
    843843
    844844    // further split
    845     if( bSubBranch && uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth )
     845    if( bSubBranch && uiDepth < sps.getLog2DiffMaxMinCodingBlockSize() )
    846846    {
    847847      UChar       uhNextDepth         = uiDepth+1;
     
    906906      rpcTempCU->getTotalCost()  = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
    907907
    908       if( (maxCUWidth>>uiDepth) == (maxCUWidth >> ( pps.getMaxCuDQPDepth())) && pps.getUseDQP()) // TODO: tidy expression
     908      if( uiDepth == pps.getMaxCuDQPDepth() && pps.getUseDQP())
    909909      {
    910910        Bool hasResidual = false;
     
    10821082  }
    10831083
    1084   if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < (g_uiMaxCUDepth-g_uiAddCUDepth) ) ) || bBoundary )
     1084  if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < sps.getLog2DiffMaxMinCodingBlockSize() ) ) || bBoundary )
    10851085  {
    10861086    UInt uiQNumParts = ( pcPic->getNumPartitionsInCtu() >> (uiDepth<<1) )>>2;
    1087     if( (maxCUWidth>>uiDepth) == (maxCUWidth >> ( pps.getMaxCuDQPDepth())) && pps.getUseDQP()) // TODO: tidy expression
     1087    if( uiDepth == pps.getMaxCuDQPDepth() && pps.getUseDQP())
    10881088    {
    10891089      setdQPFlag(true);
    10901090    }
    10911091
    1092     if( (maxCUWidth>>uiDepth) == (maxCUWidth >> ( pps.getMaxCuChromaQpAdjDepth())) && pcSlice->getUseChromaQpAdj()) // TODO: tidy expression
     1092    if( uiDepth == pps.getMaxCuChromaQpAdjDepth() && pcSlice->getUseChromaQpAdj())
    10931093    {
    10941094      setCodeChromaQpAdjFlag(true);
     
    11121112  }
    11131113
    1114   if( (maxCUWidth>>uiDepth) >= (maxCUWidth >> ( pps.getMaxCuDQPDepth())) && pps.getUseDQP()) // TODO: tidy expression
     1114  if( uiDepth <= pps.getMaxCuDQPDepth() && pps.getUseDQP())
    11151115  {
    11161116    setdQPFlag(true);
    11171117  }
    11181118
    1119   if( (maxCUWidth>>uiDepth) >= (maxCUWidth >> ( pps.getMaxCuChromaQpAdjDepth())) && pcSlice->getUseChromaQpAdj()) // TODO: tidy expression
     1119  if( uiDepth <= pps.getMaxCuChromaQpAdjDepth() && pcSlice->getUseChromaQpAdj())
    11201120  {
    11211121    setCodeChromaQpAdjFlag(true);
     
    16481648
    16491649  const TComPPS &pps = *(pcCU->getSlice()->getPPS());
    1650   const TComSPS &sps = *(pcCU->getSlice()->getSPS());
    1651   if ( pps.getUseDQP() && (sps.getMaxCUWidth()>>uiDepth) >= (sps.getMaxCUWidth() >> ( pps.getMaxCuDQPDepth())) ) // TODO: tidy expression
     1650  if ( pps.getUseDQP() && uiDepth <= pps.getMaxCuDQPDepth() )
    16521651  {
    16531652    if ( pcCU->getQtRootCbf( 0) )
     
    17671766  const TComSPS &sps = *(pCtu->getSlice()->getSPS());
    17681767
    1769   const UInt uiMinCUWidth = sps.getMaxCUWidth() >> g_uiMaxCUDepth;
    1770   UInt uiMinNumCoeffInCU = 1 << uiMinCUWidth;
     1768  const UInt uiMinCUWidth = sps.getMaxCUWidth() >> sps.getMaxTotalCUDepth(); // NOTE: ed - this is not the minimum CU width. It is the square-root of the number of coefficients per part.
     1769  const UInt uiMinNumCoeffInCU = 1 << uiMinCUWidth;                          // NOTE: ed - what is this?
    17711770
    17721771  memset( cSum, 0, sizeof( Double )*(LEVEL_RANGE+1) );
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncEntropy.cpp

    r1286 r1290  
    473473  UInt uiNumPU = ( ePartSize == SIZE_2Nx2N ? 1 : ( ePartSize == SIZE_NxN ? 4 : 2 ) );
    474474  UInt uiDepth = pcCU->getDepth( uiAbsPartIdx );
    475   UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxCUDepth() - uiDepth ) << 1 ) ) >> 4;
     475  UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxTotalCUDepth() - uiDepth ) << 1 ) ) >> 4;
    476476
    477477  for ( UInt uiPartIdx = 0, uiSubPartIdx = uiAbsPartIdx; uiPartIdx < uiNumPU; uiPartIdx++, uiSubPartIdx += uiPUOffset )
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r1289 r1290  
    202202
    203203    const TComVPS *vps = pcTEncTop->getVPS();
    204 
    205     const Int bitDepthLuma = vps->getBitDepth(CHANNEL_TYPE_LUMA, pcTEncTop->getSPS(), pcTEncTop->getLayerId());
    206     const Int bitDepthChroma = vps->getBitDepth(CHANNEL_TYPE_CHROMA, pcTEncTop->getSPS(), pcTEncTop->getLayerId());
     204    const TComSPS *sps = pcTEncTop->getSPS();
     205
     206    const Int bitDepthLuma = vps->getBitDepth(CHANNEL_TYPE_LUMA, sps, pcTEncTop->getLayerId());
     207    const Int bitDepthChroma = vps->getBitDepth(CHANNEL_TYPE_CHROMA, sps, pcTEncTop->getLayerId());
    207208    const Int prevBitDepthLuma = vps->getBitDepth(CHANNEL_TYPE_LUMA, m_ppcTEncTop[prevLayerIdx]->getSPS(), prevLayerId);
    208209    const Int prevBitDepthChroma = vps->getBitDepth(CHANNEL_TYPE_CHROMA, m_ppcTEncTop[prevLayerIdx]->getSPS(), prevLayerId);
     
    214215    {
    215216      m_pColorMappedPic = new TComPicYuv;
    216       m_pColorMappedPic->create( m_ppcTEncTop[0]->getSourceWidth(), m_ppcTEncTop[0]->getSourceHeight(), m_ppcTEncTop[0]->getChromaFormatIDC(), pcTEncTop->getSPS()->getMaxCUWidth(), pcTEncTop->getSPS()->getMaxCUHeight(), g_uiMaxCUDepth, true, NULL );
     217      m_pColorMappedPic->create( m_ppcTEncTop[0]->getSourceWidth(), m_ppcTEncTop[0]->getSourceHeight(), m_ppcTEncTop[0]->getChromaFormatIDC(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxTotalCUDepth(), true, NULL );
    217218    }
    218219  }
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncPic.cpp

    r1289 r1290  
    119119 * \param sps reference to used SPS
    120120 * \param pps reference to used PPS
    121  * \param uiMaxWidth Maximum CU width
    122  * \param uiMaxHeight Maximum CU height
    123  * \param uiMaxDepth Maximum CU depth
    124  * \param uiMaxAQDepth Maximum depth of unit block for assigning QP adaptive to local image characteristics
     121 * \param uiMaxAdaptiveQPDepth Maximum depth of unit block for assigning QP adaptive to local image characteristics
    125122 * \param bIsVirtual
    126123 */
     
    128125#if SVC_EXTENSION
    129126// * \param vps reference to used VPS
    130 Void TEncPic::create( const TComVPS& vps, const TComSPS &sps, const TComPPS &pps, UInt uiMaxDepth, UInt uiMaxAQDepth, Bool bIsVirtual, const UInt layerId )
     127Void TEncPic::create( const TComVPS& vps, const TComSPS &sps, const TComPPS &pps, UInt uiMaxAdaptiveQPDepth, Bool bIsVirtual, const UInt layerId )
    131128{
    132   TComPic::create( vps, sps, pps, uiMaxDepth, bIsVirtual, layerId );
     129  TComPic::create( vps, sps, pps, bIsVirtual, layerId );
    133130
    134131  const Int iWidth  = vps.getPicWidthInLumaSamples(&sps, layerId);
    135132  const Int iHeight = vps.getPicHeightInLumaSamples(&sps, layerId);
    136133#else
    137 Void TEncPic::create( const TComSPS &sps, const TComPPS &pps, UInt uiMaxDepth, UInt uiMaxAQDepth, Bool bIsVirtual )
     134Void TEncPic::create( const TComSPS &sps, const TComPPS &pps, UInt uiMaxAdaptiveQPDepth, Bool bIsVirtual )
    138135{
    139   TComPic::create( sps, pps, uiMaxDepth, bIsVirtual );
     136  TComPic::create( sps, pps, bIsVirtual );
    140137  const Int  iWidth      = sps.getPicWidthInLumaSamples();
    141138  const Int  iHeight     = sps.getPicHeightInLumaSamples();
     
    144141  const UInt uiMaxWidth  = sps.getMaxCUWidth();
    145142  const UInt uiMaxHeight = sps.getMaxCUHeight();
    146   m_uiMaxAQDepth = uiMaxAQDepth;
    147   if ( uiMaxAQDepth > 0 )
     143  m_uiMaxAQDepth = uiMaxAdaptiveQPDepth;
     144  if ( uiMaxAdaptiveQPDepth > 0 )
    148145  {
    149146    m_acAQLayer = new TEncPicQPAdaptationLayer[ m_uiMaxAQDepth ];
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncPic.h

    r1289 r1290  
    106106
    107107#if SVC_EXTENSION
    108   Void          create( const TComVPS &vps, const TComSPS &sps, const TComPPS &pps, UInt uiMaxDepth, UInt uiMaxAQDepth, Bool bIsVirtual /* = false*/, const UInt layerId );
     108  Void          create( const TComVPS &vps, const TComSPS &sps, const TComPPS &pps, UInt uiMaxAdaptiveQPDepth, Bool bIsVirtual /* = false*/, const UInt layerId );
    109109#else  //SVC_EXTENSION
    110   Void          create( const TComSPS &sps, const TComPPS &pps, UInt uiMaxDepth, UInt uiMaxAQDepth, Bool bIsVirtual /* = false*/ );
     110  Void          create( const TComSPS &sps, const TComPPS &pps, UInt uiMaxAdaptiveQPDepth, Bool bIsVirtual /* = false*/ );
    111111#endif //SVC_EXTENSION
    112112
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncSbac.cpp

    r1287 r1290  
    441441{
    442442  PartSize eSize         = pcCU->getPartitionSize( uiAbsPartIdx );
     443  const UInt log2DiffMaxMinCodingBlockSize = pcCU->getSlice()->getSPS()->getLog2DiffMaxMinCodingBlockSize();
    443444
    444445  if ( pcCU->isIntra( uiAbsPartIdx ) )
    445446  {
    446     if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth )
     447    if( uiDepth == log2DiffMaxMinCodingBlockSize )
    447448    {
    448449      m_pcBinIf->encodeBin( eSize == SIZE_2Nx2N? 1 : 0, m_cCUPartSizeSCModel.get( 0, 0, 0 ) );
     
    464465      m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );
    465466      m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 1) );
    466       if ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < g_uiMaxCUDepth-g_uiAddCUDepth )
     467      if ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < log2DiffMaxMinCodingBlockSize )
    467468      {
    468469        if (eSize == SIZE_2NxN)
     
    485486      m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 1) );
    486487
    487       if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth && !( pcCU->getWidth(uiAbsPartIdx) == 8 && pcCU->getHeight(uiAbsPartIdx) == 8 ) )
     488      if( uiDepth == log2DiffMaxMinCodingBlockSize && !( pcCU->getWidth(uiAbsPartIdx) == 8 && pcCU->getHeight(uiAbsPartIdx) == 8 ) )
    488489      {
    489490        m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 2) );
    490491      }
    491492
    492       if ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < g_uiMaxCUDepth-g_uiAddCUDepth )
     493      if ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < log2DiffMaxMinCodingBlockSize )
    493494      {
    494495        if (eSize == SIZE_Nx2N)
     
    506507    case SIZE_NxN:
    507508    {
    508       if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth && !( pcCU->getWidth(uiAbsPartIdx) == 8 && pcCU->getHeight(uiAbsPartIdx) == 8 ) )
     509      if( uiDepth == log2DiffMaxMinCodingBlockSize && !( pcCU->getWidth(uiAbsPartIdx) == 8 && pcCU->getHeight(uiAbsPartIdx) == 8 ) )
    509510      {
    510511        m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );
     
    617618Void TEncSbac::codeSplitFlag   ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    618619{
    619   if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth )
     620  if( uiDepth == pcCU->getSlice()->getSPS()->getLog2DiffMaxMinCodingBlockSize() )
    620621  {
    621622    return;
     
    11941195  const UInt uiWidth=tuRect.width;
    11951196  const UInt uiHeight=tuRect.height;
     1197  const TComSPS &sps=*(pcCU->getSlice()->getSPS());
    11961198
    11971199  DTRACE_CABAC_VL( g_nSymbolCounter++ )
     
    12251227  //--------------------------------------------------------------------------------------------------
    12261228
    1227   if( uiWidth > m_pcSlice->getSPS()->getMaxTrSize() )
     1229  if( uiWidth > sps.getMaxTrSize() )
    12281230  {
    12291231    std::cerr << "ERROR: codeCoeffNxN was passed a TU with dimensions larger than the maximum allowed size" << std::endl;
     
    12511253
    12521254  const ChannelType  channelType       = toChannelType(compID);
    1253   const Bool         extendedPrecision = pcCU->getSlice()->getSPS()->getUseExtendedPrecision();
    1254 
    1255   const Bool         alignCABACBeforeBypass = pcCU->getSlice()->getSPS()->getAlignCABACBeforeBypass();
    1256   const Int          maxLog2TrDynamicRange  = pcCU->getSlice()->getSPS()->getMaxLog2TrDynamicRange(channelType);
     1255  const Bool         extendedPrecision = sps.getUseExtendedPrecision();
     1256
     1257  const Bool         alignCABACBeforeBypass = sps.getAlignCABACBeforeBypass();
     1258  const Int          maxLog2TrDynamicRange  = sps.getMaxLog2TrDynamicRange(channelType);
    12571259
    12581260  Bool beValid;
     
    12661268      uiIntraMode = pcCU->getIntraDir( toChannelType(compID), uiAbsPartIdx );
    12671269
    1268       uiIntraMode = (uiIntraMode==DM_CHROMA_IDX && !bIsLuma) ? pcCU->getIntraDir(CHANNEL_TYPE_LUMA, getChromasCorrespondingPULumaIdx(uiAbsPartIdx, rTu.GetChromaFormat())) : uiIntraMode;
     1270      const UInt partsPerMinCU = 1<<(2*(sps.getMaxTotalCUDepth() - sps.getLog2DiffMaxMinCodingBlockSize()));
     1271      uiIntraMode = (uiIntraMode==DM_CHROMA_IDX && !bIsLuma) ? pcCU->getIntraDir(CHANNEL_TYPE_LUMA, getChromasCorrespondingPULumaIdx(uiAbsPartIdx, rTu.GetChromaFormat(), partsPerMinCU)) : uiIntraMode;
    12691272      uiIntraMode = ((rTu.GetChromaFormat() == CHROMA_422) && !bIsLuma) ? g_chroma422IntraAngleMappingTable[uiIntraMode] : uiIntraMode;
    12701273    }
     
    13071310  //--------------------------------------------------------------------------------------------------
    13081311
    1309   const Bool  bUseGolombRiceParameterAdaptation = pcCU->getSlice()->getSPS()->getUseGolombRiceParameterAdaptation();
     1312  const Bool  bUseGolombRiceParameterAdaptation = sps.getUseGolombRiceParameterAdaptation();
    13101313        UInt &currentGolombRiceStatistic        = m_golombRiceAdaptationStatistics[rTu.getGolombRiceStatisticsIndex(compID)];
    13111314
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp

    r1289 r1290  
    206206                      const UInt    maxCUWidth,
    207207                      const UInt    maxCUHeight,
     208                      const UInt    maxTotalCUDepth,
    208209                      TEncEntropy*  pcEntropyCoder,
    209210                      TComRdCost*   pcRdCost,
     
    255256
    256257  const UInt uiNumLayersToAllocate = pcEncCfg->getQuadtreeTULog2MaxSize()-pcEncCfg->getQuadtreeTULog2MinSize()+1;
    257   const UInt uiNumPartitions = 1<<(g_uiMaxCUDepth<<1);
     258  const UInt uiNumPartitions = 1<<(maxTotalCUDepth<<1);
    258259  for (UInt ch=0; ch<MAX_NUM_COMPONENT; ch++)
    259260  {
     
    11071108    return;
    11081109  }
    1109   const Bool       bIsLuma = isLuma(compID);
    1110   const TComRectangle &rect= rTu.getRect(compID);
    1111   TComDataCU *pcCU=rTu.getCU();
    1112   const UInt uiAbsPartIdx=rTu.GetAbsPartIdxTU();
    1113 
    1114   const UInt uiTrDepth=rTu.GetTransformDepthRelAdj(compID);
    1115   const UInt uiFullDepth   = rTu.GetTransformDepthTotal();
    1116   const UInt uiLog2TrSize  = rTu.GetLog2LumaTrSize();
    1117   const ChromaFormat chFmt = pcOrgYuv->getChromaFormat();
    1118   const ChannelType chType = toChannelType(compID);
     1110  const Bool           bIsLuma          = isLuma(compID);
     1111  const TComRectangle &rect             = rTu.getRect(compID);
     1112        TComDataCU    *pcCU             = rTu.getCU();
     1113  const UInt           uiAbsPartIdx     = rTu.GetAbsPartIdxTU();
     1114  const TComSPS       &sps              = *(pcCU->getSlice()->getSPS());
     1115
     1116  const UInt           uiTrDepth        = rTu.GetTransformDepthRelAdj(compID);
     1117  const UInt           uiFullDepth      = rTu.GetTransformDepthTotal();
     1118  const UInt           uiLog2TrSize     = rTu.GetLog2LumaTrSize();
     1119  const ChromaFormat   chFmt            = pcOrgYuv->getChromaFormat();
     1120  const ChannelType    chType           = toChannelType(compID);
    11191121#if SVC_EXTENSION
    1120   const Int  bitDepth = pcCU->getSlice()->getBitDepth(chType);
     1122  const Int            bitDepth        = pcCU->getSlice()->getBitDepth(chType);
    11211123#else
    1122   const Int  bitDepth = pcCU->getSlice()->getSPS()->getBitDepth(chType);
    1123 #endif
    1124 
    1125   const UInt    uiWidth           = rect.width;
    1126   const UInt    uiHeight          = rect.height;
    1127   const UInt    uiStride          = pcOrgYuv ->getStride (compID);
    1128         Pel*    piOrg             = pcOrgYuv ->getAddr( compID, uiAbsPartIdx );
    1129         Pel*    piPred            = pcPredYuv->getAddr( compID, uiAbsPartIdx );
    1130         Pel*    piResi            = pcResiYuv->getAddr( compID, uiAbsPartIdx );
    1131         Pel*    piReco            = pcPredYuv->getAddr( compID, uiAbsPartIdx );
    1132   const UInt    uiQTLayer           = pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - uiLog2TrSize;
    1133         Pel*    piRecQt           = m_pcQTTempTComYuv[ uiQTLayer ].getAddr( compID, uiAbsPartIdx );
    1134   const UInt    uiRecQtStride     = m_pcQTTempTComYuv[ uiQTLayer ].getStride(compID);
    1135   const UInt    uiZOrder            = pcCU->getZorderIdxInCtu() + uiAbsPartIdx;
    1136         Pel*    piRecIPred        = pcCU->getPic()->getPicYuvRec()->getAddr( compID, pcCU->getCtuRsAddr(), uiZOrder );
    1137         UInt    uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride  ( compID );
    1138         TCoeff* pcCoeff           = m_ppcQTTempCoeff[compID][uiQTLayer] + rTu.getCoefficientOffset(compID);
    1139         Bool    useTransformSkip = pcCU->getTransformSkip(uiAbsPartIdx, compID);
     1124  const Int            bitDepth         = sps.getBitDepth(chType);
     1125#endif
     1126
     1127  const UInt           uiWidth          = rect.width;
     1128  const UInt           uiHeight         = rect.height;
     1129  const UInt           uiStride         = pcOrgYuv ->getStride (compID);
     1130        Pel           *piOrg            = pcOrgYuv ->getAddr( compID, uiAbsPartIdx );
     1131        Pel           *piPred           = pcPredYuv->getAddr( compID, uiAbsPartIdx );
     1132        Pel           *piResi           = pcResiYuv->getAddr( compID, uiAbsPartIdx );
     1133        Pel           *piReco           = pcPredYuv->getAddr( compID, uiAbsPartIdx );
     1134  const UInt           uiQTLayer        = sps.getQuadtreeTULog2MaxSize() - uiLog2TrSize;
     1135        Pel           *piRecQt          = m_pcQTTempTComYuv[ uiQTLayer ].getAddr( compID, uiAbsPartIdx );
     1136  const UInt           uiRecQtStride    = m_pcQTTempTComYuv[ uiQTLayer ].getStride(compID);
     1137  const UInt           uiZOrder         = pcCU->getZorderIdxInCtu() + uiAbsPartIdx;
     1138        Pel           *piRecIPred       = pcCU->getPic()->getPicYuvRec()->getAddr( compID, pcCU->getCtuRsAddr(), uiZOrder );
     1139        UInt           uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride  ( compID );
     1140        TCoeff        *pcCoeff          = m_ppcQTTempCoeff[compID][uiQTLayer] + rTu.getCoefficientOffset(compID);
     1141        Bool           useTransformSkip = pcCU->getTransformSkip(uiAbsPartIdx, compID);
    11401142
    11411143#if ADAPTIVE_QP_SELECTION
    1142         TCoeff*    pcArlCoeff     = m_ppcQTTempArlCoeff[compID][ uiQTLayer ] + rTu.getCoefficientOffset(compID);
    1143 #endif
    1144 
    1145   const UInt uiChPredMode         = pcCU->getIntraDir( chType, uiAbsPartIdx );
    1146   const UInt uiChCodedMode        = (uiChPredMode==DM_CHROMA_IDX && !bIsLuma) ? pcCU->getIntraDir(CHANNEL_TYPE_LUMA, getChromasCorrespondingPULumaIdx(uiAbsPartIdx, chFmt)) : uiChPredMode;
    1147   const UInt uiChFinalMode        = ((chFmt == CHROMA_422)       && !bIsLuma) ? g_chroma422IntraAngleMappingTable[uiChCodedMode] : uiChCodedMode;
    1148 
    1149   const Int         blkX                                 = g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
    1150   const Int         blkY                                 = g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
    1151   const Int         bufferOffset                         = blkX + (blkY * MAX_CU_SIZE);
    1152         Pel  *const encoderLumaResidual                  = resiLuma[RESIDUAL_ENCODER_SIDE ] + bufferOffset;
    1153         Pel  *const reconstructedLumaResidual            = resiLuma[RESIDUAL_RECONSTRUCTED] + bufferOffset;
    1154   const Bool        bUseCrossCPrediction                 = isChroma(compID) && (uiChPredMode == DM_CHROMA_IDX) && checkCrossCPrediction;
    1155   const Bool        bUseReconstructedResidualForEstimate = m_pcEncCfg->getUseReconBasedCrossCPredictionEstimate();
    1156         Pel *const  lumaResidualForEstimate              = bUseReconstructedResidualForEstimate ? reconstructedLumaResidual : encoderLumaResidual;
     1144        TCoeff        *pcArlCoeff       = m_ppcQTTempArlCoeff[compID][ uiQTLayer ] + rTu.getCoefficientOffset(compID);
     1145#endif
     1146
     1147  const UInt           uiChPredMode     = pcCU->getIntraDir( chType, uiAbsPartIdx );
     1148  const UInt           partsPerMinCU    = 1<<(2*(sps.getMaxTotalCUDepth() - sps.getLog2DiffMaxMinCodingBlockSize()));
     1149  const UInt           uiChCodedMode    = (uiChPredMode==DM_CHROMA_IDX && !bIsLuma) ? pcCU->getIntraDir(CHANNEL_TYPE_LUMA, getChromasCorrespondingPULumaIdx(uiAbsPartIdx, chFmt, partsPerMinCU)) : uiChPredMode;
     1150  const UInt           uiChFinalMode    = ((chFmt == CHROMA_422)       && !bIsLuma) ? g_chroma422IntraAngleMappingTable[uiChCodedMode] : uiChCodedMode;
     1151
     1152  const Int            blkX                                 = g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
     1153  const Int            blkY                                 = g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
     1154  const Int            bufferOffset                         = blkX + (blkY * MAX_CU_SIZE);
     1155        Pel  *const    encoderLumaResidual                  = resiLuma[RESIDUAL_ENCODER_SIDE ] + bufferOffset;
     1156        Pel  *const    reconstructedLumaResidual            = resiLuma[RESIDUAL_RECONSTRUCTED] + bufferOffset;
     1157  const Bool           bUseCrossCPrediction                 = isChroma(compID) && (uiChPredMode == DM_CHROMA_IDX) && checkCrossCPrediction;
     1158  const Bool           bUseReconstructedResidualForEstimate = m_pcEncCfg->getUseReconBasedCrossCPredictionEstimate();
     1159        Pel *const     lumaResidualForEstimate              = bUseReconstructedResidualForEstimate ? reconstructedLumaResidual : encoderLumaResidual;
    11571160
    11581161#ifdef DEBUG_STRING
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.h

    r1289 r1290  
    140140            const UInt    maxCUWidth,
    141141            const UInt    maxCUHeight,
     142            const UInt    maxTotalCUDepth,
    142143            TEncEntropy*  pcEntropyCoder,
    143144            TComRdCost*   pcRdCost,
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.cpp

    r1289 r1290  
    117117  m_cGOPEncoder.        create( );
    118118#endif
    119   m_cSliceEncoder.      create( getSourceWidth(), getSourceHeight(), m_chromaFormatIDC, m_maxCUWidth, m_maxCUHeight, g_uiMaxCUDepth );
    120   m_cCuEncoder.         create( g_uiMaxCUDepth, m_maxCUWidth, m_maxCUHeight, m_chromaFormatIDC );
     119  m_cSliceEncoder.      create( getSourceWidth(), getSourceHeight(), m_chromaFormatIDC, m_maxCUWidth, m_maxCUHeight, m_maxTotalCUDepth );
     120  m_cCuEncoder.         create( m_maxTotalCUDepth, m_maxCUWidth, m_maxCUHeight, m_chromaFormatIDC );
    121121  if (m_bUseSAO)
    122122  {
    123     m_cEncSAO.create( getSourceWidth(), getSourceHeight(), m_chromaFormatIDC, m_maxCUWidth, m_maxCUHeight, g_uiMaxCUDepth, m_saoOffsetBitShift[CHANNEL_TYPE_LUMA], m_saoOffsetBitShift[CHANNEL_TYPE_CHROMA] );
     123    m_cEncSAO.create( getSourceWidth(), getSourceHeight(), m_chromaFormatIDC, m_maxCUWidth, m_maxCUHeight, m_maxTotalCUDepth, m_saoOffsetBitShift[CHANNEL_TYPE_LUMA], m_saoOffsetBitShift[CHANNEL_TYPE_CHROMA] );
    124124#if SAO_ENCODE_ALLOW_USE_PREDEBLOCK
    125125    m_cEncSAO.createEncData(getSaoCtuBoundary());
     
    135135#endif
    136136
    137   m_cLoopFilter.create( g_uiMaxCUDepth );
     137  m_cLoopFilter.create( m_maxTotalCUDepth );
    138138
    139139  if ( m_RCEnableRateControl )
     
    143143  }
    144144
    145   m_pppcRDSbacCoder = new TEncSbac** [g_uiMaxCUDepth+1];
     145  m_pppcRDSbacCoder = new TEncSbac** [m_maxTotalCUDepth+1];
    146146#if FAST_BIT_EST
    147   m_pppcBinCoderCABAC = new TEncBinCABACCounter** [g_uiMaxCUDepth+1];
     147  m_pppcBinCoderCABAC = new TEncBinCABACCounter** [m_maxTotalCUDepth+1];
    148148#else
    149   m_pppcBinCoderCABAC = new TEncBinCABAC** [g_uiMaxCUDepth+1];
    150 #endif
    151 
    152   for ( Int iDepth = 0; iDepth < g_uiMaxCUDepth+1; iDepth++ )
     149  m_pppcBinCoderCABAC = new TEncBinCABAC** [m_maxTotalCUDepth+1];
     150#endif
     151
     152  for ( Int iDepth = 0; iDepth < m_maxTotalCUDepth+1; iDepth++ )
    153153  {
    154154    m_pppcRDSbacCoder[iDepth] = new TEncSbac* [CI_NUM];
     
    190190  m_cRateCtrl.          destroy();
    191191  Int iDepth;
    192   for ( iDepth = 0; iDepth < g_uiMaxCUDepth+1; iDepth++ )
     192  for ( iDepth = 0; iDepth < m_maxTotalCUDepth+1; iDepth++ )
    193193  {
    194194    for (Int iCIIdx = 0; iCIIdx < CI_NUM; iCIIdx ++ )
     
    199199  }
    200200
    201   for ( iDepth = 0; iDepth < g_uiMaxCUDepth+1; iDepth++ )
     201  for ( iDepth = 0; iDepth < m_maxTotalCUDepth+1; iDepth++ )
    202202  {
    203203    delete [] m_pppcRDSbacCoder[iDepth];
     
    258258
    259259  // initialize encoder search class
    260   m_cSearch.init( this, &m_cTrQuant, m_iSearchRange, m_bipredSearchRange, m_iFastSearch, m_maxCUWidth, m_maxCUHeight, &m_cEntropyCoder, &m_cRdCost, getRDSbacCoder(), getRDGoOnSbacCoder() );
     260  m_cSearch.init( this, &m_cTrQuant, m_iSearchRange, m_bipredSearchRange, m_iFastSearch, m_maxCUWidth, m_maxCUHeight, m_maxTotalCUDepth, &m_cEntropyCoder, &m_cRdCost, getRDSbacCoder(), getRDGoOnSbacCoder() );
    261261
    262262  m_iMaxRefPicNum = 0;
     
    579579        {
    580580          rpcPicYuvRec = new TComPicYuv;
    581           rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_maxCUWidth, m_maxCUHeight, g_uiMaxCUDepth, true);
     581          rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_maxCUWidth, m_maxCUHeight, m_maxTotalCUDepth, true);
    582582        }
    583583        rcListPicYuvRecOut.pushBack( rpcPicYuvRec );
     
    620620        {
    621621          rpcPicYuvRec = new TComPicYuv;
    622           rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_maxCUWidth, m_maxCUHeight, g_uiMaxCUDepth, true);
     622          rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_maxCUWidth, m_maxCUHeight, m_maxTotalCUDepth, true);
    623623        }
    624624        rcListPicYuvRecOut.pushBack( rpcPicYuvRec );
     
    750750      }
    751751
    752       pcEPic->create( m_cVPS, m_cSPS, m_cPPS, g_uiMaxCUDepth, m_cPPS.getMaxCuDQPDepth()+1, false, m_layerId);
     752      pcEPic->create( m_cVPS, m_cSPS, m_cPPS, m_cPPS.getMaxCuDQPDepth()+1, false, m_layerId);
    753753#else  //SVC_EXTENSION
    754       pcEPic->create( m_cSPS, m_cPPS, g_uiMaxCUDepth, m_cPPS.getMaxCuDQPDepth()+1, false);
     754      pcEPic->create( m_cSPS, m_cPPS, m_cPPS.getMaxCuDQPDepth()+1, false);
    755755#endif //SVC_EXTENSION
    756756      rpcPic = pcEPic;
     
    800800      }
    801801
    802       rpcPic->create( m_cVPS, m_cSPS, m_cPPS, g_uiMaxCUDepth, false, m_layerId );
     802      rpcPic->create( m_cVPS, m_cSPS, m_cPPS, false, m_layerId );
    803803#else  //SVC_EXTENSION
    804       rpcPic->create( m_cSPS, m_cPPS, g_uiMaxCUDepth, false );
     804      rpcPic->create( m_cSPS, m_cPPS, false );
    805805#endif //SVC_EXTENSION
    806806    }
     
    884884   * that chooses the actual compatibility based upon options */
    885885
    886   m_cSPS.setPicWidthInLumaSamples         ( m_iSourceWidth      );
    887   m_cSPS.setPicHeightInLumaSamples        ( m_iSourceHeight     );
    888   m_cSPS.setConformanceWindow             ( m_conformanceWindow );
    889   m_cSPS.setMaxCUWidth    ( m_maxCUWidth      );
    890   m_cSPS.setMaxCUHeight   ( m_maxCUHeight     );
    891   m_cSPS.setMaxCUDepth    ( g_uiMaxCUDepth      );
     886  m_cSPS.setPicWidthInLumaSamples  ( m_iSourceWidth      );
     887  m_cSPS.setPicHeightInLumaSamples ( m_iSourceHeight     );
     888  m_cSPS.setConformanceWindow      ( m_conformanceWindow );
     889  m_cSPS.setMaxCUWidth             ( m_maxCUWidth        );
     890  m_cSPS.setMaxCUHeight            ( m_maxCUHeight       );
     891  m_cSPS.setMaxTotalCUDepth        ( m_maxTotalCUDepth   );
    892892  m_cSPS.setChromaFormatIdc( m_chromaFormatIDC);
    893 
    894   Int minCUSize = m_cSPS.getMaxCUWidth() >> ( m_cSPS.getMaxCUDepth()-g_uiAddCUDepth );
     893  m_cSPS.setLog2DiffMaxMinCodingBlockSize(m_log2DiffMaxMinCodingBlockSize);
     894
     895  Int minCUSize = m_cSPS.getMaxCUWidth() >> ( m_cSPS.getLog2DiffMaxMinCodingBlockSize() );
    895896  Int log2MinCUSize = 0;
    896897  while(minCUSize > 1)
     
    901902
    902903  m_cSPS.setLog2MinCodingBlockSize(log2MinCUSize);
    903   m_cSPS.setLog2DiffMaxMinCodingBlockSize(m_cSPS.getMaxCUDepth()-g_uiAddCUDepth-getMaxCUDepthOffset(m_cSPS.getChromaFormatIdc(), m_cSPS.getQuadtreeTULog2MinSize()));
     904 
    904905#if SVC_EXTENSION
    905906  m_cSPS.setSPSId         ( m_iSPSIdCnt       );
     
    924925  {
    925926#if SVC_EXTENSION
    926     m_cSPS.setBitDepth    (ChannelType(channelType), m_cVPS.getVpsRepFormat( m_cVPS.getVpsRepFormatIdx( m_cVPS.getLayerIdxInVps( m_layerId ) ) )->getBitDepthVps(ChannelType(channelType))            );
     927    m_cSPS.setBitDepth    (ChannelType(channelType), m_cVPS.getVpsRepFormat( m_cVPS.getVpsRepFormatIdx( m_cVPS.getLayerIdxInVps( m_layerId ) ) )->getBitDepthVps(ChannelType(channelType))            );   
     928#if O0043_BEST_EFFORT_DECODING
     929    m_cSPS.setStreamBitDepth(ChannelType(channelType), m_bitDepth[channelType] );
     930#endif
    927931    m_cSPS.setQpBDOffset  (ChannelType(channelType), (6 * (m_cVPS.getVpsRepFormat( m_cVPS.getVpsRepFormatIdx( m_cVPS.getLayerIdxInVps( m_layerId ) ) )->getBitDepthVps(ChannelType(channelType)) - 8)));
    928 #if O0043_BEST_EFFORT_DECODING
    929     m_cSPS.setStreamBitDepth(ChannelType(channelType), m_cVPS.getVpsRepFormat( m_cVPS.getVpsRepFormatIdx( m_cVPS.getLayerIdxInVps( m_layerId ) ) )->getBitDepthVps(ChannelType(channelType)) );
    930 #endif
    931932#else
     933    m_cSPS.setBitDepth      (ChannelType(channelType), m_bitDepth[channelType] );
    932934#if O0043_BEST_EFFORT_DECODING
    933935    m_cSPS.setStreamBitDepth(ChannelType(channelType), m_bitDepth[channelType] );
     
    15051507  if( m_layerId > 0 )
    15061508  {
    1507     g_uiMaxCUDepth  = m_cSPS.getMaxCUDepth();
    1508     g_uiAddCUDepth  = max (0, m_cSPS.getLog2MinCodingBlockSize() - (Int)m_cSPS.getQuadtreeTULog2MinSize() );
    1509 
    1510     if (m_cIlpPic[0] == NULL)
     1509    if( m_cIlpPic[0] == NULL )
    15111510    {
    15121511      for (Int j=0; j < m_numDirectRefLayers; j++)
    15131512      {
    15141513        m_cIlpPic[j] = new TComPic;
    1515         m_cIlpPic[j]->create(m_cVPS, m_cSPS, m_cPPS, g_uiMaxCUDepth, true, m_layerId);
     1514        m_cIlpPic[j]->create(m_cVPS, m_cSPS, m_cPPS, true, m_layerId);
    15161515        for (Int i=0; i<m_cIlpPic[j]->getPicSym()->getNumberOfCtusInFrame(); i++)
    15171516        {
Note: See TracChangeset for help on using the changeset viewer.