Ignore:
Timestamp:
26 Jun 2013, 15:57:04 (11 years ago)
Author:
tech
Message:

Fixes to RefPicList modification.

File:
1 edited

Legend:

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

    r495 r497  
    691691    pcSlice->setNumRefIdx(REF_PIC_LIST_0,min(gopEntry.m_numRefPicsActive,( pcSlice->getRPS()->getNumberOfPictures() + (Int) m_refPicSetInterLayer.size() ) ) );
    692692    pcSlice->setNumRefIdx(REF_PIC_LIST_1,min(gopEntry.m_numRefPicsActive,( pcSlice->getRPS()->getNumberOfPictures() + (Int) m_refPicSetInterLayer.size() ) ) );
    693     xSetRefPicListModificationsMvc( pcSlice, iGOPid );   
     693
     694    xSetRefPicListModificationsMv( pcSlice, iGOPid );   
    694695
    695696    pcSlice->setActiveMotionPredRefLayers( );
     
    29482949#endif
    29492950#if H_MV
    2950 Void TEncGOP::xSetRefPicListModificationsMvc( TComSlice* pcSlice, UInt iGOPid )
    2951 {
    2952   TComVPS* vps = pcSlice->getVPS();
     2951Void TEncGOP::xSetRefPicListModificationsMv( TComSlice* pcSlice, UInt iGOPid )
     2952{   
    29532953  Int layer    = pcSlice->getLayerIdInVps( );
    29542954 
    2955   if( pcSlice->getSliceType() == I_SLICE || !(pcSlice->getPPS()->getListsModificationPresentFlag()) || vps->getNumDirectRefLayers( layer ) == 0 )
     2955  if( pcSlice->getSliceType() == I_SLICE || !(pcSlice->getPPS()->getListsModificationPresentFlag()) || pcSlice->getNumActiveRefLayerPics() == 0 )
    29562956  {
    29572957    return;
     
    29602960  // analyze inter-view modifications
    29612961  GOPEntry ge = m_pcCfg->getGOPEntry( (pcSlice->getRapPicFlag() && ( layer > 0) ) ? MAX_GOP : iGOPid );
    2962 
    2963   TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification();
    2964  
     2962  assert( ge.m_numActiveRefLayerPics == pcSlice->getNumActiveRefLayerPics() );
     2963
    29652964  Int maxRefListSize  = pcSlice->getNumRpsCurrTempList();
    2966   Int numTemporalRefs = maxRefListSize - vps->getNumDirectRefLayers( layer );
    2967 
    2968 
     2965  Int numTemporalRefs = maxRefListSize - pcSlice->getNumActiveRefLayerPics();
     2966 
    29692967  for (Int li = 0; li < 2; li ++) // Loop over lists L0 and L1
    29702968  {
    2971     Int numModifications = 0;
    2972    
    2973     for( Int k = 0; k < ge.m_numActiveRefLayerPics; k++ )
    2974     {
    2975       numModifications +=  ( ge.m_interViewRefPosL[li][k] >= 0 ) ? 1 : 0;
    2976     }
    2977 
    2978     // set inter-view modifications
     2969    // set inter-view modifications   
     2970    Int tempList[16];
     2971    for( Int k = 0; k < 16; k++ )
     2972    {
     2973      tempList[ k ] = -1;
     2974    }
     2975
    29792976    Bool isModified = false;
    2980       Int tempList[16];
    2981       for( Int k = 0; k < 16; k++ ) { tempList[k] = -1; }
    2982 
    2983     if( (maxRefListSize > 1) && (numModifications > 0) )
    2984     {
    2985       for( Int k = 0; k < ge.m_numActiveRefLayerPics; k++ )
    2986       {
    2987         if( ge.m_interViewRefPosL[li][k] >= 0 )
    2988         {
    2989           Int orgIdx    = numTemporalRefs;
    2990           Int targetIdx = ge.m_interViewRefPosL[ li ][ k ];
    2991           for( Int idx = 0; idx < vps->getNumDirectRefLayers( layer ); idx++ )
    2992           {           
    2993             Int refLayer  = vps->getLayerIdInVps( vps->getRefLayerId( layer, idx ) );         
    2994             if( ( layer + ge.m_interLayerPredLayerIdc[ k ]) == refLayer )
    2995             {
    2996               tempList[ targetIdx ] = orgIdx;             
    2997               isModified = ( targetIdx != orgIdx  );
    2998             }
    2999             orgIdx++;
    3000           }
    3001         }
    3002       }
    3003     }
    3004 
     2977    if ( maxRefListSize > 1 )
     2978    {     
     2979      for( Int k = 0, orgIdx = numTemporalRefs; k < ge.m_numActiveRefLayerPics; k++, orgIdx++ )
     2980      {
     2981        Int targetIdx = ge.m_interViewRefPosL[ li ][ k ];
     2982
     2983        isModified = ( targetIdx != orgIdx ) && ( targetIdx >= 0  );
     2984        if ( isModified )
     2985        {
     2986          assert( tempList[ targetIdx ] == -1 ); // Assert when two inter layer reference pictures are sorted to the same position
     2987          tempList[ targetIdx ] = orgIdx;             
     2988        }
     2989      }     
     2990    }
     2991
     2992    TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification();
    30052993    refPicListModification->setRefPicListModificationFlagL( li, isModified ); 
    30062994
    3007       if( isModified )
    3008       {
    3009         Int temporalRefIdx = 0;
    3010         for( Int i = 0; i < pcSlice->getNumRefIdx( ( li == 0 ) ? REF_PIC_LIST_0 : REF_PIC_LIST_1 ); i++ )
    3011         {
    3012           if( tempList[i] >= 0 )
    3013           {
    3014             refPicListModification->setRefPicSetIdxL( li, i, tempList[i] );
    3015           }
    3016           else
    3017           {
    3018             refPicListModification->setRefPicSetIdxL( li, i, temporalRefIdx );
    3019             temporalRefIdx++;
    3020           }
    3021         }
    3022       }
     2995    if( isModified )
     2996    {
     2997      Int temporalRefIdx = 0;
     2998      for( Int i = 0; i < pcSlice->getNumRefIdx( ( li == 0 ) ? REF_PIC_LIST_0 : REF_PIC_LIST_1 ); i++ )
     2999      {
     3000        if( tempList[i] >= 0 )
     3001        {
     3002          refPicListModification->setRefPicSetIdxL( li, i, tempList[i] );
     3003        }
     3004        else
     3005        {
     3006          refPicListModification->setRefPicSetIdxL( li, i, temporalRefIdx );
     3007          temporalRefIdx++;
     3008        }
     3009      }
     3010    }
    30233011  }
    30243012}
Note: See TracChangeset for help on using the changeset viewer.