Changeset 976 in 3DVCSoftware for trunk/source/Lib/TLibCommon/TComSlice.cpp


Ignore:
Timestamp:
7 Jul 2014, 17:27:51 (10 years ago)
Author:
tech
Message:
  • Merged 11.1-dev0@975. (Clean ups)
  • Added coding results.
  • Changed version number.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibCommon/TComSlice.cpp

    r964 r976  
    4848TComSlice::TComSlice()
    4949: m_iPPSId                        ( -1 )
    50 #if H_MV_HLS_8_POC_Q0142_32
     50#if H_MV
    5151, m_slicePicOrderCntLsb           ( 0 )
    5252#endif
     
    18631863#endif
    18641864{
    1865 #if H_MV_HLS_8_SYN_Q0041_03
     1865#if H_MV
    18661866  m_vpsBaseLayerInternalFlag = true;
    18671867#endif
     
    18831883  m_vpsNumProfileTierLevelMinus1 = -1;
    18841884   
    1885 #if H_MV_HLS_8_SYN_39_19
    18861885  m_numAddLayerSets              = 0;   
    18871886  m_numAddOlss                   = 0;
    1888 #else
    1889   m_numAddLayerSets              = -1;   
    1890 #endif
    18911887  m_defaultOutputLayerIdc     = 0;
    18921888 
     
    19021898  }
    19031899
    1904 #if H_MV_HLS_8_PMS_Q0195_20
    19051900  m_repFormatIdxPresentFlag = false;
    1906 #endif
    19071901  m_maxOneActiveRefLayerFlag = false;
    19081902  m_directDepTypeLenMinus2   = 0;         
    19091903 
    19101904
    1911 #if H_MV_HLS_8_RPS_Q0100_36
    19121905  m_vpsExtensionFlag = true;
    1913 #endif
    1914   m_avcBaseLayerFlag = false;
    19151906  m_vpsNonVuiExtensionLength = 0;
    19161907  m_splittingFlag    = false;
     
    20322023  }
    20332024
    2034 
    2035 #if H_MV_HLS_8_PMS_Q0195_20
    20362025  //The value of vps_num_rep_formats_minus1 shall be in the range of 0 to 255, inclusive.
    20372026  assert( getVpsNumRepFormatsMinus1() >= 0 );
    20382027  assert( getVpsNumRepFormatsMinus1() <= 255 );
    2039 #endif
    20402028
    20412029  return true;
     
    20832071  }
    20842072
    2085 #if H_MV_HLS_8
    20862073  for (Int i = 0 ; i < MAX_NUM_LAYER_IDS; i++ )
    20872074  {
     
    20962083    }
    20972084  }
    2098 
    20992085
    21002086  for( Int i = 0; i  <=  getMaxLayersMinus1(); i++ )
     
    21072093    }
    21082094  }
    2109 
    21102095
    21112096  for( Int i = 0; i <= getMaxLayersMinus1(); i++ )  // Bug in spec "<" instead of "<="
     
    21492134    m_numIndependentLayers = k;
    21502135  }
    2151 #endif
    21522136}
    21532137
     
    23142298Int    TComVPS::getNumOutputLayerSets()
    23152299{
    2316 #if H_MV_HLS_8_SYN_39_19
    23172300  return getNumAddOlss() + getNumLayerSets();
    2318 #else
    2319   return getNumAddLayerSets() + getVpsNumLayerSetsMinus1() + 1;
    2320 #endif
    23212301}
    23222302
     
    23842364    }
    23852365  } 
    2386 #if H_MV_HLS_8_PMS_Q0165_18
    23872366  assert( getNumOutputLayersInOutputLayerSet( i ) > 0 );
    2388 #endif
    23892367}
    23902368
     
    24202398{
    24212399  Int maxSLMinus1 = 0;
    2422 #if H_MV_HLS_8_MIS_Q0102_30
    24232400  for( Int k = 0; k < getNumLayersInIdList( i ); k++ )
    24242401  {
    24252402    Int lId = m_layerSetLayerIdList[i][k];
    2426 #else 
    2427   Int optLsIdx    = olsIdxToLsIdx( i );
    2428 
    2429   for( Int k = 0; k < getNumLayersInIdList( optLsIdx ); k++ )
    2430   {
    2431     Int lId = m_layerSetLayerIdList[optLsIdx][k];
    2432 #endif
    24332403    maxSLMinus1 = std::max( maxSLMinus1, getSubLayersVpsMaxMinus1( getLayerIdInVps( lId ) ));
    24342404  }
    24352405  return maxSLMinus1;
    24362406}
    2437 #if H_MV_HLS_8_RPS_Q0100_36
     2407
    24382408Void TComVPS::inferDbpSizeLayerSetZero( TComSPS* sps, Bool encoder )
    24392409{
     
    24582428  }
    24592429}
    2460 #endif
     2430
     2431Bool TComVPS::getAltOutputLayerFlagVar( Int i )
     2432{
     2433  // Semantics variable not syntax element !
     2434
     2435  Bool altOptLayerFlag = false;     
     2436  if ( i > 0 && getNumOutputLayersInOutputLayerSet( i ) == 1 &&
     2437    getNumDirectRefLayers( getOlsHighestOutputLayerId( i ) ) > 0 )
     2438  {
     2439    altOptLayerFlag = getAltOutputLayerFlag( i );
     2440  }
     2441  return altOptLayerFlag;
     2442}
     2443
     2444Int TComVPS::getMaxNumPics( Int layerId )
     2445{
     2446  Int maxNumPics = MAX_INT;
     2447  for( Int olsIdx = 0; olsIdx < getNumOutputLayerSets(); olsIdx++)
     2448  {
     2449    Int lsIdx = olsIdxToLsIdx( olsIdx );
     2450    for( Int j = 0; j < getNumLayersInIdList( lsIdx ); j++ )
     2451    {
     2452      if( getLayerSetLayerIdList(lsIdx, j ) ==  layerId )
     2453      {
     2454        Int maxSL = getMaxSubLayersInLayerSetMinus1( lsIdx );
     2455        maxNumPics = std::min( maxNumPics, getDpbSize()->getMaxVpsDecPicBufferingMinus1( olsIdx , j,  maxSL ) );
     2456      }
     2457    }
     2458  }
     2459  assert( maxNumPics != MAX_INT );
     2460  return maxNumPics;
     2461}
     2462
     2463Void TComVPS::xSetRefLayerFlags( Int currLayerId )
     2464{
     2465  for( Int j = 0; j < getNumDirectRefLayers( currLayerId ); j++ )
     2466  {
     2467    Int refLayerId = m_refLayerId[ currLayerId ][ j ];
     2468    m_recursiveRefLayerFlag[ currLayerId ][ refLayerId ] = 1;
     2469    for( Int k = 0; k < MAX_NUM_LAYER_IDS; k++ )
     2470    {
     2471      m_recursiveRefLayerFlag[ currLayerId ][ k ] = m_recursiveRefLayerFlag[ currLayerId ][ k ]  ||  m_recursiveRefLayerFlag[ refLayerId ][ k ];
     2472    }
     2473  }
     2474}
     2475
    24612476#endif // H_MV
    24622477
     
    25302545  ::memset(m_usedByCurrPicLtSPSFlag, 0, sizeof(m_usedByCurrPicLtSPSFlag));
    25312546#if H_MV
    2532 #if !H_MV_HLS_8_SPS_NODOC_48
    2533   m_spsExtensionPresentFlag = false;
    2534   for( Int i = 0; i < PS_EX_T_MAX_NUM; i++ )
    2535   {
    2536     m_spsExtensionTypeFlag[ i ] = false;
    2537   }
    2538 #else
    25392547  m_spsRangeExtensionsFlag     = false;
    25402548  m_spsMultilayerExtensionFlag = false;
     
    25442552#else
    25452553  m_spsExtension6bits          = 0;
    2546 #endif
    25472554#endif
    25482555
     
    27262733
    27272734#if H_MV
    2728 #if H_MV_HLS_8_SPS_NODOC_48
    27292735  m_ppsRangeExtensionsFlag     = false;
    27302736  m_ppsMultilayerExtensionFlag = false;
     
    27342740  m_pps3dExtensionFlag         = false;
    27352741  m_ppsExtension5bits          = 0;
    2736 #endif
    2737 #else
    2738   for( Int i = 0; i < PS_EX_T_MAX_NUM; i++ )
    2739   {
    2740     m_ppsExtensionTypeFlag[ i ] = false;
    2741   }
    27422742#endif
    27432743#endif
     
    29842984  }
    29852985}
     2986
     2987Void TComSPS::inferSpsMaxDecPicBufferingMinus1( TComVPS* vps, Int targetOptLayerSetIdx, Int currLayerId, Bool encoder )
     2988{
     2989  const std::vector<Int>& targetDecLayerIdList = vps->getTargetDecLayerIdList( vps->olsIdxToLsIdx( targetOptLayerSetIdx ));
     2990
     2991  if (getLayerId() > 0 )
     2992  {
     2993    Int layerIdx = 0;         
     2994    while (layerIdx < (Int) targetDecLayerIdList.size() )
     2995    {
     2996      if ( targetDecLayerIdList[layerIdx] == currLayerId )
     2997      {
     2998        break;
     2999      }
     3000      layerIdx++;
     3001    }
     3002
     3003    assert( layerIdx < (Int) targetDecLayerIdList.size() );
     3004
     3005    for (Int i = 0; i <= getSpsMaxSubLayersMinus1(); i++ )
     3006    {
     3007      Int maxDecPicBufferingMinus1 = vps->getDpbSize()->getMaxVpsDecPicBufferingMinus1( targetOptLayerSetIdx, layerIdx, i ) ;
     3008
     3009      if ( encoder )
     3010      {
     3011        assert( getMaxDecPicBuffering( i ) - 1 == maxDecPicBufferingMinus1 );
     3012      }
     3013      else
     3014      {
     3015        setMaxDecPicBuffering(i, maxDecPicBufferingMinus1 + 1 );
     3016      }
     3017    }
     3018  }
     3019}
     3020
     3021Void TComSPS::checkRpsMaxNumPics( TComVPS* vps, Int currLayerId )
     3022{
     3023  // In spec, when rps is in SPS, nuh_layer_id of SPS is used instead
     3024  // of nuh_layer_id of slice (currLayerId), this seems to be a bug.
     3025
     3026  for (Int i = 0; i < getRPSList()->getNumberOfReferencePictureSets(); i++ )
     3027  {
     3028    TComReferencePictureSet* rps = getRPSList()->getReferencePictureSet( i );
     3029    if ( !rps->getInterRPSPrediction() )
     3030    {
     3031      rps->checkMaxNumPics( vps->getVpsExtensionFlag(), vps->getMaxNumPics( currLayerId ),
     3032        getLayerId(), getMaxDecPicBuffering( getSpsMaxSubLayersMinus1() ) - 1 ); 
     3033    }
     3034  }
     3035}
     3036
    29863037#endif
    29873038
     
    31333184  printf("}\n");
    31343185}
     3186#if H_MV
     3187Void TComReferencePictureSet::checkMaxNumPics( Bool vpsExtensionFlag, Int maxNumPics, Int nuhLayerId, Int spsMaxDecPicBufferingMinus1 )
     3188{
     3189  assert( getNumberOfPictures() >= 0 );
     3190  if ( nuhLayerId == 0 )
     3191  {
     3192    assert( getNumberOfPictures() <= spsMaxDecPicBufferingMinus1 );
     3193  }
     3194
     3195  if ( vpsExtensionFlag )
     3196  {
     3197    assert( getNumberOfPictures() <= maxNumPics );
     3198  }
     3199}
     3200#endif
    31353201
    31363202TComRPSList::TComRPSList()
     
    32793345}
    32803346
    3281 #if !H_MV_HLS_8_DBP_NODOC_42
    3282 Void TComSlice::markIvRefPicsAsUnused( TComPicLists* ivPicLists, std::vector<Int> targetDecLayerIdSet, TComVPS* vps, Int curLayerId, Int curPoc )
    3283 {
    3284   // Fill targetDecLayerIdSet with all layers if empty (at encoder side)
    3285   if (targetDecLayerIdSet.size() == 0 )   
    3286   {
    3287     for ( Int layerIdInVps = 0; layerIdInVps <= vps->getMaxLayersMinus1(); layerIdInVps++ )
    3288     {
    3289       targetDecLayerIdSet.push_back( vps->getLayerIdInNuh( layerIdInVps ) );
    3290     }
    3291   }     
    3292 
    3293   Int numTargetDecLayers = (Int) targetDecLayerIdSet.size();
    3294   Int latestDecIdx;
    3295   for ( latestDecIdx = 0; latestDecIdx < numTargetDecLayers; latestDecIdx++)
    3296   {
    3297     if ( targetDecLayerIdSet[ latestDecIdx ] == curLayerId )
    3298     {
    3299       break;
    3300     }       
    3301   }       
    3302 
    3303   for( Int i = 0; i <= latestDecIdx; i++ )
    3304   {
    3305     if ( vps->nuhLayerIdIncluded( targetDecLayerIdSet[ i ] ) )
    3306     {
    3307       TComPic* pcPic = ivPicLists->getPic( targetDecLayerIdSet[ i ], curPoc );
    3308       if ( pcPic )
    3309       {
    3310         if( pcPic->getSlice(0)->isReferenced() && pcPic->getSlice(0)->getTemporalLayerNonReferenceFlag() )
    3311         {
    3312           Bool remainingInterLayerReferencesFlag = false;
    3313           for( Int j = latestDecIdx + 1; j < numTargetDecLayers; j++ )
    3314           {
    3315             TComVPS* vpsSlice = pcPic->getSlice(0)->getVPS();
    3316             if ( vps->nuhLayerIdIncluded( targetDecLayerIdSet[ j ] ) )
    3317             {
    3318               for( Int k = 0; k < vpsSlice->getNumDirectRefLayers( targetDecLayerIdSet[ j ] ); k++ )
    3319               {
    3320                 if ( targetDecLayerIdSet[ i ] == vpsSlice->getRefLayerId( targetDecLayerIdSet[ j ],  k  ) )
    3321                 {
    3322                   remainingInterLayerReferencesFlag = true;
    3323                 }
    3324               }
    3325             }
    3326           }
    3327           if( !remainingInterLayerReferencesFlag )
    3328           {
    3329             pcPic->getSlice(0)->setReferenced( false );                   
    3330           }
    3331         }
    3332       }
    3333     }
    3334   }
    3335 }
    3336 #endif
    33373347Void TComSlice::printRefPicList()
    33383348
     
    33513361Void TComSlice::markCurrPic( TComPic* currPic )
    33523362{
    3353 
    3354 #if !H_MV_HLS_8_DBP_NODOC_42
    3355   if ( !currPic->getSlice(0)->getDiscardableFlag() )
    3356   {
    3357 #endif
    3358     currPic->getSlice(0)->setReferenced( true ) ;
    3359     currPic->setIsLongTerm( false );
    3360 #if !H_MV_HLS_8_DBP_NODOC_42
    3361   }
    3362   else
    3363   {
    3364     currPic->getSlice(0)->setReferenced( false ) ;
    3365   }
    3366 #endif
    3367 
    3368 #if H_MV_HLS_7_VPS_P0300_27
     3363  currPic->getSlice(0)->setReferenced( true ) ;
     3364  currPic->setIsLongTerm( false );
     3365
    33693366  currPic->setReconMark( true );
    33703367  currPic->setPicOutputFlag( currPic->getSlice(0)->getPicOutputFlag() );
    3371 #endif
    33723368}
    33733369
     
    34033399  Int refLayerIdx = vps->getLayerIdInVps( vps->getRefLayerId( getLayerId(), i ) );
    34043400
    3405 #if H_MV_HLS_8_RPS_Q0060_17
    34063401  Bool refLayerPicFlag = ( vps->getSubLayersVpsMaxMinus1( refLayerIdx ) >=  getTLayer() )  && ( getTLayer() == 0  ) &&
    34073402    ( vps->getMaxTidIlRefPicsPlus1( refLayerIdx, vps->getLayerIdInVps( getLayerId() )) > getTLayer() );
    3408 #else
    3409   Bool refLayerPicFlag = ( vps->getSubLayersVpsMaxMinus1( refLayerIdx ) >=  getTLayer() )  &&
    3410     ( vps->getMaxTidIlRefPicsPlus1( refLayerIdx, vps->getLayerIdInVps( getLayerId() )) > getTLayer() );
    3411 #endif
    34123403
    34133404  return refLayerPicFlag;       
     
    35413532#endif
    35423533#if H_3D_IC
    3543 #if MTK_LOW_LATENCY_IC_ENCODING_H0086
    35443534Void TComSlice::xSetApplyIC(Bool bUseLowLatencyICEnc)
    3545 #else
    3546 Void TComSlice::xSetApplyIC()
    3547 #endif
    3548 {
    3549 #if MTK_LOW_LATENCY_IC_ENCODING_H0086
     3535{
    35503536  if(bUseLowLatencyICEnc)
    35513537  {
     
    35923578        Double ratio=Double(g_aICEnableNUM[refLayer])/Double(g_aICEnableCANDIDATE[refLayer]);
    35933579
    3594         if( ratio > MTK_LOW_LATENCY_IC_ENCODING_THRESHOLD_H0086)
     3580        if( ratio > IC_LOW_LATENCY_ENCODING_THRESHOLD)
    35953581{
    35963582          m_bApplyIC=true;
     
    36083594  else
    36093595  {
    3610 #endif
    36113596  Int iMaxPelValue = ( 1 << g_bitDepthY );
    36123597  Int *aiRefOrgHist;
     
    36823667  aiCurrHist = NULL;
    36833668  aiRefOrgHist = NULL;
    3684 #if MTK_LOW_LATENCY_IC_ENCODING_H0086
    36853669  }//if(bUseLowLatencyICEnc)
    3686 #endif
    36873670}
    36883671#endif
     
    37743757
    37753758#if H_3D_DDD
    3776     InitializeDDDPara( vps->getCamParPrecision(), codScale[ i ], codOffset[ i ], i );
     3759    initializeDDDPara( vps->getCamParPrecision(), codScale[ i ], codOffset[ i ], i );
    37773760#endif
    37783761  }
     
    37823765
    37833766#if H_3D_DDD
    3784 Void TComSlice::InitializeDDDPara( UInt uiCamParsCodedPrecision, Int  iCodedScale,Int  iCodedOffset, Int iBaseViewIdx )
     3767Void TComSlice::initializeDDDPara( UInt uiCamParsCodedPrecision, Int  iCodedScale,Int  iCodedOffset, Int iBaseViewIdx )
    37853768{
    37863769    UInt uiViewId     = getViewIndex();
     
    38393822
    38403823    return;
     3824}
     3825
     3826
     3827#endif
     3828
     3829#if H_MV
     3830Void TComSlice::checkCrossLayerBlaFlag()
     3831{
     3832  // cross_layer_bla_flag shall be equal to 0 for pictures with nal_unit_type not equal to IDR_W_RADL or IDR_N_LP or with nuh_layer_id not equal to 0.
     3833  if ( getLayerId() != 0 || getNalUnitType() != NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP )
     3834  {
     3835    assert( m_crossLayerBlaFlag == 0 );
     3836  }
     3837}
     3838
     3839Bool TComSlice::inferPocMsbValPresentFlag()
     3840{
     3841  Bool pocMsbValPresentFlag;
     3842  if( getSliceSegmentHeaderExtensionLength() == 0 )
     3843  {
     3844    pocMsbValPresentFlag = false;
     3845  }
     3846  else if ( getPocMsbValRequiredFlag() )
     3847  {
     3848    pocMsbValPresentFlag = true;
     3849  }
     3850  else
     3851  {
     3852    pocMsbValPresentFlag = false;
     3853  }
     3854
     3855  return pocMsbValPresentFlag;
     3856}
     3857
     3858
     3859#endif
     3860
     3861#if H_3D_DBBP
     3862Int TComSlice::getDepthFromDV( Int iDV, Int iBaseViewIdx )
     3863{
     3864  return ClipY(( iDV * m_aiDDDInvScale[ iBaseViewIdx ] + m_aiDDDInvOffset[ iBaseViewIdx ] ) >> m_aiDDDShift[ iBaseViewIdx ]);
    38413865}
    38423866#endif
     
    43314355}
    43324356
     4357Void TComVpsVuiBspHrdParameters::checkBspCombHrdAndShedIdx( TComVPS* vps, Int h, Int i, Int j )
     4358{
     4359  // bsp_comb_hrd_idx
     4360  assert( getBspCombSchedIdx(h, i, j ) >= 0 );
     4361  assert( getBspCombSchedIdx(h, i, j ) <= getVpsNumBspHrdParametersMinus1() );
     4362
     4363  // bsp_comb_sched_idx
     4364  assert( getBspCombSchedIdx(h, i, j ) >= 0 );
     4365
     4366  //* This check needs to activated,  when HighestTid is available here   
     4367  //  assert(  getBspCombSchedIdx(h, i, j ) <= vps->getHrdParameters( getBspCombHrdIdx( h, i, j ) )->getCpbCntMinus1( highestTid ) );
     4368}
     4369
    43334370Void TComVUI::inferVideoSignalInfo( TComVPS* vps, Int layerIdCurr )
    43344371{
     
    43704407  }
    43714408}
    4372 #endif
     4409
     4410Void Window::scaleOffsets( Int scal )
     4411{
     4412  if (! m_scaledFlag )
     4413  {
     4414    m_scaledFlag         = true;
     4415    m_winLeftOffset     *= scal;
     4416    m_winRightOffset    *= scal;
     4417    m_winTopOffset      *= scal;
     4418    m_winBottomOffset   *= scal;
     4419  }
     4420}
     4421#endif
     4422
Note: See TracChangeset for help on using the changeset viewer.