Ignore:
Timestamp:
13 Jul 2013, 10:26:41 (11 years ago)
Author:
tech
Message:

MergeMerged tags/HTM-DEV-1.0.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncGOP.cpp

    r532 r534  
    502502    pcSlice->setSliceIdx(0);
    503503#if H_MV
     504    pcSlice->setRefPicSetInterLayer ( &m_refPicSetInterLayer );
    504505    pcPic  ->setLayerId     ( getLayerId()   );
    505506    pcPic  ->setViewId      ( getViewId()    );   
     
    669670    refPicListModification->setRefPicListModificationFlagL1(0);
    670671#if H_MV
     672    if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > 0 )
     673    {
     674      pcSlice->setDiscardableFlag           ( false );     
     675    }   
     676
     677    TComVPS*           vps = pcSlice->getVPS();
     678    Int       layerIdInVps = vps    ->getLayerIdInVps( getLayerId());
     679    Int numDirectRefLayers = vps    ->getNumDirectRefLayers( layerIdInVps );
     680    GOPEntry gopEntry      = m_pcCfg->getGOPEntry( (pcSlice->getRapPicFlag() && getLayerId() > 0) ? MAX_GOP : iGOPid );     
     681   
     682    if ( getLayerId() > 0 && numDirectRefLayers > 0 )
     683    {         
     684      pcSlice->setInterLayerPredEnabledFlag ( gopEntry.m_numActiveRefLayerPics > 0 );     
     685      if ( pcSlice->getInterLayerPredEnabledFlag() && numDirectRefLayers > 1 )
     686      {
     687        if ( !vps->getMaxOneActiveRefLayerFlag() )
     688        {   
     689          pcSlice->setNumInterLayerRefPicsMinus1( gopEntry.m_numActiveRefLayerPics - 1 );
     690        }
     691        for (Int i = 0; i < gopEntry.m_numActiveRefLayerPics; i++ )
     692        {
     693          pcSlice->setInterLayerPredLayerIdc( i, gopEntry.m_interLayerPredLayerIdc[ i ] );
     694        }
     695      }
     696    }
     697    assert( pcSlice->getNumActiveRefLayerPics() == gopEntry.m_numActiveRefLayerPics );
     698   
     699    if ( vps->getNumSamplePredRefLayers( layerIdInVps ) > 0 && pcSlice->getNumActiveRefLayerPics() > 0)
     700    {
     701      pcSlice->setInterLayerSamplePredOnlyFlag( gopEntry.m_numRefPics == 0 );
     702    }   
     703
    671704    pcSlice->createAndApplyIvReferencePictureSet( m_ivPicLists, m_refPicSetInterLayer );
    672     pcSlice->setNumRefIdx(REF_PIC_LIST_0,min(m_pcCfg->getGOPEntry( (pcSlice->getRapPicFlag() && getLayerId() > 0) ? MAX_GOP : iGOPid ).m_numRefPicsActive,( pcSlice->getRPS()->getNumberOfPictures() + (Int) m_refPicSetInterLayer.size() ) ) );
    673     pcSlice->setNumRefIdx(REF_PIC_LIST_1,min(m_pcCfg->getGOPEntry( (pcSlice->getRapPicFlag() && getLayerId() > 0) ? MAX_GOP : iGOPid ).m_numRefPicsActive,( pcSlice->getRPS()->getNumberOfPictures() + (Int) m_refPicSetInterLayer.size() ) ) );
    674     xSetRefPicListModificationsMvc( pcSlice, pocCurr, iGOPid );   
     705    pcSlice->setNumRefIdx(REF_PIC_LIST_0,min(gopEntry.m_numRefPicsActive,( pcSlice->getRPS()->getNumberOfPictures() + (Int) m_refPicSetInterLayer.size() ) ) );
     706    pcSlice->setNumRefIdx(REF_PIC_LIST_1,min(gopEntry.m_numRefPicsActive,( pcSlice->getRPS()->getNumberOfPictures() + (Int) m_refPicSetInterLayer.size() ) ) );
     707
     708    xSetRefPicListModificationsMv( pcSlice, iGOPid );   
     709
     710    pcSlice->setActiveMotionPredRefLayers( );
     711
     712    if ( getLayerId() > 0 && pcSlice->getNumActiveMotionPredRefLayers() > 0 && pcSlice->getEnableTMVPFlag() &&
     713        ( pcSlice->getSliceType() == B_SLICE || pcSlice->getSliceType() == P_SLICE ))
     714    {
     715      pcSlice->setAltCollocatedIndicationFlag( gopEntry.m_collocatedRefLayerIdx >= 0 );
     716      if ( pcSlice->getNumActiveRefLayerPics() && pcSlice->getNumActiveMotionPredRefLayers() > 0 )
     717      {
     718        pcSlice->setCollocatedRefLayerIdx( gopEntry.m_collocatedRefLayerIdx );
     719      }
     720    }
     721
    675722#else
    676723    pcSlice->setNumRefIdx(REF_PIC_LIST_0,min(m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive,pcSlice->getRPS()->getNumberOfPictures()));
     
    827874      pcSlice->setEnableTMVPFlag(0);
    828875    }
    829 
    830876#if H_MV
    831877    if( pcSlice->getIdrPicFlag() )
     
    21202166      TComSlice::markIvRefPicsAsShortTerm( m_refPicSetInterLayer ); 
    21212167      std::vector<Int> temp;
     2168      TComSlice::markCurrPic( pcPic );
    21222169      TComSlice::markIvRefPicsAsUnused   ( m_ivPicLists, temp, pcPic->getSlice(0)->getVPS(), m_layerId, pcPic->getPOC() );
    21232170#endif
     
    29502997#endif
    29512998#if H_MV
    2952 Void TEncGOP::xSetRefPicListModificationsMvc( TComSlice* pcSlice, UInt uiPOCCurr, UInt iGOPid )
     2999Void TEncGOP::xSetRefPicListModificationsMv( TComSlice* pcSlice, UInt iGOPid )
    29533000{
    2954   TComVPS* vps = pcSlice->getVPS();
    29553001  Int layer    = pcSlice->getLayerIdInVps( );
    29563002 
    2957   if( pcSlice->getSliceType() == I_SLICE || !(pcSlice->getPPS()->getListsModificationPresentFlag()) || vps->getNumDirectRefLayers( layer ) == 0 )
     3003  if( pcSlice->getSliceType() == I_SLICE || !(pcSlice->getPPS()->getListsModificationPresentFlag()) || pcSlice->getNumActiveRefLayerPics() == 0 )
    29583004  {
    29593005    return;
     
    29623008  // analyze inter-view modifications
    29633009  GOPEntry ge = m_pcCfg->getGOPEntry( (pcSlice->getRapPicFlag() && ( layer > 0) ) ? MAX_GOP : iGOPid );
    2964 
    2965   TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification();
     3010  assert( ge.m_numActiveRefLayerPics == pcSlice->getNumActiveRefLayerPics() );
    29663011 
    29673012  Int maxRefListSize  = pcSlice->getNumRpsCurrTempList();
    2968   Int numTemporalRefs = maxRefListSize - vps->getNumDirectRefLayers( layer );
    2969 
     3013  Int numTemporalRefs = maxRefListSize - pcSlice->getNumActiveRefLayerPics();
    29703014
    29713015  for (Int li = 0; li < 2; li ++) // Loop over lists L0 and L1
    29723016  {
    2973     Int numModifications = 0;
    2974    
    2975     for( Int k = 0; k < ge.m_numInterViewRefPics; k++ )
    2976     {
    2977       numModifications +=  ( ge.m_interViewRefPosL[li][k] >= 0 ) ? 1 : 0;
    2978     }
    2979 
    2980     // set inter-view modifications
     3017    // set inter-view modifications   
     3018    Int tempList[16];
     3019    for( Int k = 0; k < 16; k++ )
     3020    {
     3021      tempList[ k ] = -1;
     3022    }
     3023
    29813024    Bool isModified = false;
    2982       Int tempList[16];
    2983       for( Int k = 0; k < 16; k++ ) { tempList[k] = -1; }
    2984 
    2985     if( (maxRefListSize > 1) && (numModifications > 0) )
    2986     {
    2987       for( Int k = 0; k < ge.m_numInterViewRefPics; k++ )
    2988       {
    2989         if( ge.m_interViewRefPosL[li][k] >= 0 )
    2990         {
    2991           Int orgIdx    = numTemporalRefs;
     3025    if ( maxRefListSize > 1 )
     3026    {
     3027      for( Int k = 0, orgIdx = numTemporalRefs; k < ge.m_numActiveRefLayerPics; k++, orgIdx++ )
     3028      {
    29923029          Int targetIdx = ge.m_interViewRefPosL[ li ][ k ];
    2993           for( Int idx = 0; idx < vps->getNumDirectRefLayers( layer ); idx++ )
    2994           {           
    2995             Int refLayer  = vps->getLayerIdInVps( vps->getRefLayerId( layer, idx ) );         
    2996             if( ( layer + ge.m_interViewRefs[ k ]) == refLayer )
     3030
     3031        isModified = ( targetIdx != orgIdx ) && ( targetIdx >= 0  );
     3032        if ( isModified )
    29973033            {
     3034          assert( tempList[ targetIdx ] == -1 ); // Assert when two inter layer reference pictures are sorted to the same position
    29983035              tempList[ targetIdx ] = orgIdx;             
    2999               isModified = ( targetIdx != orgIdx  );
    3000             }
    3001             orgIdx++;
    3002           }
    3003         }
    3004       }
    3005     }
    3006 
     3036        }
     3037      }
     3038    }
     3039
     3040    TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification();
    30073041    refPicListModification->setRefPicListModificationFlagL( li, isModified ); 
    30083042
Note: See TracChangeset for help on using the changeset viewer.