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


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/TLibDecoder
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r1287 r1290  
    868868
    869869  Int addCuDepth = max (0, log2MinCUSize - (Int)pcSPS->getQuadtreeTULog2MinSize() );
    870   pcSPS->setMaxCUDepth( maxCUDepthDelta + addCuDepth  + getMaxCUDepthOffset(pcSPS->getChromaFormatIdc(), pcSPS->getQuadtreeTULog2MinSize()) );
     870  pcSPS->setMaxTotalCUDepth( maxCUDepthDelta + addCuDepth  + getMaxCUDepthOffset(pcSPS->getChromaFormatIdc(), pcSPS->getQuadtreeTULog2MinSize()) );
    871871
    872872  READ_FLAG( uiCode, "scaling_list_enabled_flag" );                 pcSPS->setScalingListFlag ( uiCode );
     
    23472347Void TDecCavlc::parseDeltaQP( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    23482348{
    2349   Int qp;
    23502349  Int  iDQp;
    23512350
     
    23612360  Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA);
    23622361#endif
    2363   qp = (((Int) pcCU->getRefQP( uiAbsPartIdx ) + iDQp + 52 + 2*qpBdOffsetY )%(52+ qpBdOffsetY)) -  qpBdOffsetY;
    2364 
    2365   UInt uiAbsQpCUPartIdx = (uiAbsPartIdx>>((g_uiMaxCUDepth - pcCU->getSlice()->getPPS()->getMaxCuDQPDepth())<<1))<<((g_uiMaxCUDepth - pcCU->getSlice()->getPPS()->getMaxCuDQPDepth())<<1) ;
    2366   UInt uiQpCUDepth =   min(uiDepth,pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()) ;
     2362  const Int qp = (((Int) pcCU->getRefQP( uiAbsPartIdx ) + iDQp + 52 + 2*qpBdOffsetY )%(52+ qpBdOffsetY)) -  qpBdOffsetY;
     2363
     2364  const UInt maxCUDepth        = pcCU->getSlice()->getSPS()->getMaxTotalCUDepth();
     2365  const UInt maxCuDQPDepth     = pcCU->getSlice()->getPPS()->getMaxCuDQPDepth();
     2366  const UInt doubleDepthDifference = ((maxCUDepth - maxCuDQPDepth)<<1);
     2367  const UInt uiAbsQpCUPartIdx = (uiAbsPartIdx>>doubleDepthDifference)<<doubleDepthDifference ;
     2368  const UInt uiQpCUDepth =   min(uiDepth,pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()) ;
    23672369
    23682370  pcCU->setQPSubParts( qp, uiAbsQpCUPartIdx, uiQpCUDepth );
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecCu.cpp

    r1289 r1290  
    235235    bBoundary = true;
    236236  }
    237 
    238   if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth ) ) || bBoundary )
     237  if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < sps.getLog2DiffMaxMinCodingBlockSize() ) ) || bBoundary )
    239238  {
    240239    UInt uiIdx = uiAbsPartIdx;
    241     if( (maxCuWidth>>uiDepth) == (maxCuWidth >> ( pps.getMaxCuDQPDepth())) && pps.getUseDQP()) // TODO: tidy expression
     240    if( uiDepth == pps.getMaxCuDQPDepth() && pps.getUseDQP())
    242241    {
    243242      setdQPFlag(true);
     
    245244    }
    246245
    247     if( (maxCuWidth>>uiDepth) == (maxCuWidth >> ( pps.getMaxCuChromaQpAdjDepth())) && pcCU->getSlice()->getUseChromaQpAdj() ) // TODO: tidy expression
     246    if( uiDepth == pps.getMaxCuChromaQpAdjDepth() && pcCU->getSlice()->getUseChromaQpAdj() )
    248247    {
    249248      setIsChromaQpAdjCoded(true);
     
    270269      uiIdx += uiQNumParts;
    271270    }
    272     if( (maxCuWidth>>uiDepth) == (maxCuWidth >> ( pps.getMaxCuDQPDepth())) && pps.getUseDQP()) // TODO: tidy expression
     271    if( uiDepth == pps.getMaxCuDQPDepth() && pps.getUseDQP())
    273272    {
    274273      if ( getdQPFlag() )
     
    281280  }
    282281
    283   if( (maxCuWidth>>uiDepth) >= (maxCuWidth >> ( pps.getMaxCuDQPDepth())) && pps.getUseDQP()) // TODO: tidy expression
     282  if( uiDepth <= pps.getMaxCuDQPDepth() && pps.getUseDQP())
    284283  {
    285284    setdQPFlag(true);
     
    287286  }
    288287
    289   if( (maxCuWidth>>uiDepth) >= (maxCuWidth >> ( pps.getMaxCuChromaQpAdjDepth())) && pcCU->getSlice()->getUseChromaQpAdj() ) // TODO: tidy expression
     288  if( uiDepth <= pps.getMaxCuChromaQpAdjDepth() && pcCU->getSlice()->getUseChromaQpAdj() )
    290289  {
    291290    setIsChromaQpAdjCoded(true);
     
    416415  }
    417416
    418   if( ( ( uiDepth < pCtu->getDepth( uiAbsPartIdx ) ) && ( uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth ) ) || bBoundary )
     417  if( ( ( uiDepth < pCtu->getDepth( uiAbsPartIdx ) ) && ( uiDepth < sps.getLog2DiffMaxMinCodingBlockSize() ) ) || bBoundary )
    419418  {
    420419    UInt uiNextDepth = uiDepth + 1;
     
    569568
    570569  const UInt uiChPredMode  = pcCU->getIntraDir( toChannelType(compID), uiAbsPartIdx );
    571   const UInt uiChCodedMode = (uiChPredMode==DM_CHROMA_IDX && !bIsLuma) ? pcCU->getIntraDir(CHANNEL_TYPE_LUMA, getChromasCorrespondingPULumaIdx(uiAbsPartIdx, chFmt)) : uiChPredMode;
     570  const UInt partsPerMinCU = 1<<(2*(sps.getMaxTotalCUDepth() - sps.getLog2DiffMaxMinCodingBlockSize()));
     571  const UInt uiChCodedMode = (uiChPredMode==DM_CHROMA_IDX && !bIsLuma) ? pcCU->getIntraDir(CHANNEL_TYPE_LUMA, getChromasCorrespondingPULumaIdx(uiAbsPartIdx, chFmt, partsPerMinCU)) : uiChPredMode;
    572572  const UInt uiChFinalMode = ((chFmt == CHROMA_422)       && !bIsLuma) ? g_chroma422IntraAngleMappingTable[uiChCodedMode] : uiChCodedMode;
    573573
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecEntropy.cpp

    r1286 r1290  
    184184  PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx );
    185185  UInt uiNumPU = ( ePartSize == SIZE_2Nx2N ? 1 : ( ePartSize == SIZE_NxN ? 4 : 2 ) );
    186   UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxCUDepth() - uiDepth ) << 1 ) ) >> 4;
     186  UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxTotalCUDepth() - uiDepth ) << 1 ) ) >> 4;
    187187
    188188  TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecSbac.cpp

    r1289 r1290  
    510510Void TDecSbac::parseSplitFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    511511{
    512   if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth )
     512  if( uiDepth == pcCU->getSlice()->getSPS()->getLog2DiffMaxMinCodingBlockSize() )
    513513  {
    514514    pcCU->setDepthSubParts( uiDepth, uiAbsPartIdx );
     
    540540  const UChar cuWidth =UChar(pcCU->getSlice()->getSPS()->getMaxCUWidth()>>uiDepth);
    541541  const UChar cuHeight=UChar(pcCU->getSlice()->getSPS()->getMaxCUHeight()>>uiDepth);
     542  const Int log2DiffMaxMinCodingBlockSize = pcCU->getSlice()->getSPS()->getLog2DiffMaxMinCodingBlockSize();
    542543
    543544#if RExt__DECODER_DEBUG_BIT_STATISTICS
     
    545546#endif
    546547
     548  assert ( pcCU->getSlice()->getSPS()->getLog2DiffMaxMinCodingBlockSize() == log2DiffMaxMinCodingBlockSize);
    547549  if ( pcCU->isIntra( uiAbsPartIdx ) )
    548550  {
    549551    uiSymbol = 1;
    550     if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth )
     552    if( uiDepth == log2DiffMaxMinCodingBlockSize )
    551553    {
    552554      m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, 0) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype) );
     
    570572    UInt uiMaxNumBits = 2;
    571573
    572     if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth && !( cuWidth == 8 && cuHeight == 8 ) )
     574    if( uiDepth == log2DiffMaxMinCodingBlockSize && !( cuWidth == 8 && cuHeight == 8 ) )
    573575    {
    574576      uiMaxNumBits ++;
     
    585587    }
    586588    eMode = (PartSize) uiMode;
    587     if ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < g_uiMaxCUDepth-g_uiAddCUDepth )
     589    if ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < log2DiffMaxMinCodingBlockSize )
    588590    {
    589591      if (eMode == SIZE_2NxN)
     
    12331235  const UInt uiHeight=rRect.height;
    12341236  TCoeff* pcCoef=(pcCU->getCoeff(compID)+rTu.getCoefficientOffset(compID));
     1237  const TComSPS &sps=*(pcCU->getSlice()->getSPS());
    12351238
    12361239  DTRACE_CABAC_VL( g_nSymbolCounter++ )
     
    12651268  //--------------------------------------------------------------------------------------------------
    12661269
    1267   if( uiWidth > pcCU->getSlice()->getSPS()->getMaxTrSize() )
     1270  if( uiWidth > sps.getMaxTrSize() )
    12681271  {
    12691272    std::cerr << "ERROR: parseCoeffNxN was passed a TU with dimensions larger than the maximum allowed size" << std::endl;
     
    12831286
    12841287  const ChannelType  channelType       = toChannelType(compID);
    1285   const Bool         extendedPrecision = pcCU->getSlice()->getSPS()->getUseExtendedPrecision();
    1286 
    1287   const Bool         alignCABACBeforeBypass = pcCU->getSlice()->getSPS()->getAlignCABACBeforeBypass();
    1288   const Int          maxLog2TrDynamicRange  = pcCU->getSlice()->getSPS()->getMaxLog2TrDynamicRange(channelType);
     1288  const Bool         extendedPrecision = sps.getUseExtendedPrecision();
     1289
     1290  const Bool         alignCABACBeforeBypass = sps.getAlignCABACBeforeBypass();
     1291  const Int          maxLog2TrDynamicRange  = sps.getMaxLog2TrDynamicRange(channelType);
    12891292
    12901293#if RExt__DECODER_DEBUG_BIT_STATISTICS
     
    13331336  if ( isIntra && pcCU->isRDPCMEnabled(uiAbsPartIdx) )
    13341337  {
     1338    const UInt partsPerMinCU = 1<<(2*(sps.getMaxTotalCUDepth() - sps.getLog2DiffMaxMinCodingBlockSize()));
    13351339    uiIntraMode = pcCU->getIntraDir( toChannelType(compID), uiAbsPartIdx );
    1336     uiIntraMode = (uiIntraMode==DM_CHROMA_IDX && !bIsLuma) ? pcCU->getIntraDir(CHANNEL_TYPE_LUMA, getChromasCorrespondingPULumaIdx(uiAbsPartIdx, rTu.GetChromaFormat())) : uiIntraMode;
     1340    uiIntraMode = (uiIntraMode==DM_CHROMA_IDX && !bIsLuma) ? pcCU->getIntraDir(CHANNEL_TYPE_LUMA, getChromasCorrespondingPULumaIdx(uiAbsPartIdx, rTu.GetChromaFormat(), partsPerMinCU)) : uiIntraMode;
    13371341    uiIntraMode = ((rTu.GetChromaFormat() == CHROMA_422) && !bIsLuma) ? g_chroma422IntraAngleMappingTable[uiIntraMode] : uiIntraMode;
    13381342
     
    13471351  //--------------------------------------------------------------------------------------------------
    13481352
    1349   const Bool  bUseGolombRiceParameterAdaptation = pcCU->getSlice()->getSPS()->getUseGolombRiceParameterAdaptation();
     1353  const Bool  bUseGolombRiceParameterAdaptation = sps.getUseGolombRiceParameterAdaptation();
    13501354        UInt &currentGolombRiceStatistic        = m_golombRiceAdaptationStatistics[rTu.getGolombRiceStatisticsIndex(compID)];
    13511355
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp

    r1289 r1290  
    254254    }
    255255
    256     rpcPic->create( vps, sps, pps, g_uiMaxCUDepth, true, m_layerId);
     256    rpcPic->create( vps, sps, pps, true, m_layerId);
    257257#else //SVC_EXTENSION
    258     rpcPic->create ( sps, pps, g_uiMaxCUDepth, true);
     258    rpcPic->create ( sps, pps, true);
    259259#endif //SVC_EXTENSION
    260260   
     
    303303  }
    304304
    305   rpcPic->create( vps, sps, pps, g_uiMaxCUDepth, true, m_layerId);
     305  rpcPic->create( vps, sps, pps, true, m_layerId);
    306306#else  //SVC_EXTENSION
    307   rpcPic->create ( sps, pps, g_uiMaxCUDepth, true);
     307  rpcPic->create ( sps, pps, true);
    308308#endif //SVC_EXTENSION
    309309}
     
    493493        UInt refLayerId = 0;
    494494
    495         pBLPic->create( *vps, *sps, *pps, sps->getMaxCUDepth(), true, refLayerId);
     495        pBLPic->create( *vps, *sps, *pps, true, refLayerId);
    496496
    497497        // it is needed where the VPS is accessed through the slice
     
    571571#endif //SVC_EXTENSION
    572572
    573     // TODO: remove the use of the following globals:
    574     g_uiMaxCUDepth  = sps->getMaxCUDepth();
    575 #if SVC_EXTENSION
    576     g_uiAddCUDepth  = max (0, sps->getLog2MinCodingBlockSize() - (Int)sps->getQuadtreeTULog2MinSize() + (Int)getMaxCUDepthOffset(vps->getChromaFormatIdc(sps, m_apcSlicePilot->getLayerId()), sps->getQuadtreeTULog2MinSize()));
    577 #else
    578     g_uiAddCUDepth  = max (0, sps->getLog2MinCodingBlockSize() - (Int)sps->getQuadtreeTULog2MinSize() + (Int)getMaxCUDepthOffset(sps->getChromaFormatIdc(), sps->getQuadtreeTULog2MinSize()));
    579 #endif
     573    // NOTE: globals were set up here originally. You can now use:
     574    // g_uiMaxCUDepth = sps->getMaxTotalCUDepth();
     575    // g_uiAddCUDepth = sps->getMaxTotalCUDepth() - sps->getLog2DiffMaxMinCodingBlockSize()
    580576
    581577    //  Get a new picture buffer. This will also set up m_pcPic, and therefore give us a SPS and PPS pointer that we can use.
     
    605601    // Initialise the various objects for the new set of settings
    606602#if SVC_EXTENSION
    607     m_cSAO.create( pSlice->getPicWidthInLumaSamples(), pSlice->getPicHeightInLumaSamples(), pSlice->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), pps->getSaoOffsetBitShift(CHANNEL_TYPE_LUMA), pps->getSaoOffsetBitShift(CHANNEL_TYPE_CHROMA) );
     603    m_cSAO.create( pSlice->getPicWidthInLumaSamples(), pSlice->getPicHeightInLumaSamples(), pSlice->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxTotalCUDepth(), pps->getSaoOffsetBitShift(CHANNEL_TYPE_LUMA), pps->getSaoOffsetBitShift(CHANNEL_TYPE_CHROMA) );
    608604#else
    609     m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), pps->getSaoOffsetBitShift(CHANNEL_TYPE_LUMA), pps->getSaoOffsetBitShift(CHANNEL_TYPE_CHROMA) );
    610 #endif
    611     m_cLoopFilter.create( sps->getMaxCUDepth() );
     605    m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxTotalCUDepth(), pps->getSaoOffsetBitShift(CHANNEL_TYPE_LUMA), pps->getSaoOffsetBitShift(CHANNEL_TYPE_CHROMA) );
     606#endif
     607    m_cLoopFilter.create( sps->getMaxTotalCUDepth() );
    612608    m_cPrediction.initTempBuff(sps->getChromaFormatIdc());
    613609
     
    666662    // Recursive structure
    667663#if SVC_EXTENSION
    668     m_cCuDecoder.create ( sps->getMaxCUDepth(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), pSlice->getChromaFormatIdc() );
     664    m_cCuDecoder.create ( sps->getMaxTotalCUDepth(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), pSlice->getChromaFormatIdc() );
    669665    m_cCuDecoder.init   ( m_ppcTDecTop, &m_cEntropyDecoder, &m_cTrQuant, &m_cPrediction, m_layerId );
    670666#else
    671     m_cCuDecoder.create ( sps->getMaxCUDepth(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getChromaFormatIdc() );
     667    m_cCuDecoder.create ( sps->getMaxTotalCUDepth(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getChromaFormatIdc() );
    672668    m_cCuDecoder.init   ( &m_cEntropyDecoder, &m_cTrQuant, &m_cPrediction );
    673669#endif
     
    21982194  if( m_layerId > 0 )
    21992195  {
    2200     g_uiMaxCUDepth  = sps->getMaxCUDepth();
    2201     g_uiAddCUDepth  = max (0, sps->getLog2MinCodingBlockSize() - (Int)sps->getQuadtreeTULog2MinSize() );
    2202 
    22032196    if (m_cIlpPic[0] == NULL)
    22042197    {
     
    22072200        m_cIlpPic[j] = new  TComPic;
    22082201
    2209         m_cIlpPic[j]->create(*vps, *sps, *slice->getPPS(), g_uiMaxCUDepth, true, m_layerId);
     2202        m_cIlpPic[j]->create(*vps, *sps, *slice->getPPS(), true, m_layerId);
    22102203
    22112204        for (Int i=0; i<m_cIlpPic[j]->getPicSym()->getNumberOfCtusInFrame(); i++)
     
    23792372Void TDecTop::initAsymLut(TComSlice *pcSlice)
    23802373{
    2381   if(m_layerId>0)
    2382   {
    2383     if(!m_pColorMappedPic)
    2384     {
    2385       Int picWidth    = pcSlice->getPicWidthInLumaSamples();
    2386       Int picHeight   = pcSlice->getPicHeightInLumaSamples();
     2374  if( m_layerId > 0 )
     2375  {
     2376    if( !m_pColorMappedPic )
     2377    {
    23872378      m_pColorMappedPic = new TComPicYuv;
    2388       m_pColorMappedPic->create( picWidth, picHeight, pcSlice->getChromaFormatIdc()/*CHROMA_420*/, pcSlice->getSPS()->getMaxCUWidth(), pcSlice->getSPS()->getMaxCUHeight(), g_uiMaxCUDepth, true, NULL );
     2379      m_pColorMappedPic->create( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), pcSlice->getChromaFormatIdc()/*CHROMA_420*/, pcSlice->getSPS()->getMaxCUWidth(), pcSlice->getSPS()->getMaxCUHeight(), pcSlice->getSPS()->getMaxTotalCUDepth(), true, NULL );
    23892380    }
    23902381  }
Note: See TracChangeset for help on using the changeset viewer.