Changeset 622 in 3DVCSoftware for trunk/source/Lib/TLibEncoder/TEncGOP.cpp


Ignore:
Timestamp:
11 Sep 2013, 14:40:25 (11 years ago)
Author:
tech
Message:

Merged 8.0-dev0@621 (MV-HEVC 5 HLS).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibEncoder/TEncGOP.cpp

    r608 r622  
    471471    pcPic->setCurrSliceIdx(0);
    472472
     473
     474#if H_MV5
     475#if H_MV
     476    m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, m_pcEncTop->getVPS(), m_pcEncTop->getSPS(), m_pcEncTop->getPPS(), getLayerId() );     
     477#else
     478    m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, m_pcEncTop->getSPS(), m_pcEncTop->getPPS() );
     479#endif
     480#else
    473481#if H_3D
    474482    m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, m_pcEncTop->getVPS(), m_pcEncTop->getSPS(), m_pcEncTop->getPPS(), getLayerId() );     
    475483#else
    476484    m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, m_pcEncTop->getSPS(), m_pcEncTop->getPPS() );
     485#endif
    477486#endif
    478487    pcSlice->setLastIDR(m_iLastIDR);
    479488    pcSlice->setSliceIdx(0);
    480489#if H_MV
     490#if H_MV5
     491    pcSlice->setRefPicSetInterLayer ( &m_refPicSetInterLayer0, &m_refPicSetInterLayer1 );
     492#else
    481493    pcSlice->setRefPicSetInterLayer ( &m_refPicSetInterLayer );
     494#endif
    482495    pcPic  ->setLayerId     ( getLayerId()   );
    483496    pcPic  ->setViewId      ( getViewId()    );   
     
    642655    refPicListModification->setRefPicListModificationFlagL1(0);
    643656#if H_MV
     657#if H_MV5
     658    if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > 1 )
     659    {
     660      // Some more sophisticated algorithm to determine discardable_flag might be added here.
     661      pcSlice->setDiscardableFlag           ( false );     
     662    }   
     663
     664    TComVPS*           vps = pcSlice->getVPS();     
     665    Int numDirectRefLayers = vps    ->getNumDirectRefLayers( getLayerId() );
     666    GOPEntry gopEntry      = m_pcCfg->getGOPEntry( (pcSlice->getRapPicFlag() && getLayerId() > 0) ? MAX_GOP : iGOPid );     
     667   
     668    if ( getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && numDirectRefLayers > 0 )
     669    {         
     670      pcSlice->setInterLayerPredEnabledFlag ( gopEntry.m_numActiveRefLayerPics > 0 );     
     671      if ( pcSlice->getInterLayerPredEnabledFlag() && numDirectRefLayers > 1 )
     672      {
     673        if ( !vps->getMaxOneActiveRefLayerFlag() )
     674        {   
     675          pcSlice->setNumInterLayerRefPicsMinus1( gopEntry.m_numActiveRefLayerPics - 1 );
     676        }
     677        if ( gopEntry.m_numActiveRefLayerPics != vps->getNumDirectRefLayers( getLayerId() ) )
     678        {       
     679          for (Int i = 0; i < gopEntry.m_numActiveRefLayerPics; i++ )
     680          {
     681            pcSlice->setInterLayerPredLayerIdc( i, gopEntry.m_interLayerPredLayerIdc[ i ] );
     682          }
     683        }
     684      }
     685    }
     686    assert( pcSlice->getNumActiveRefLayerPics() == gopEntry.m_numActiveRefLayerPics );
     687   
     688    pcSlice->createInterLayerReferencePictureSet( m_ivPicLists, m_refPicSetInterLayer0, m_refPicSetInterLayer1 );
     689    pcSlice->setNumRefIdx(REF_PIC_LIST_0,min(gopEntry.m_numRefPicsActive,( pcSlice->getRPS()->getNumberOfPictures() + (Int) m_refPicSetInterLayer0.size() + (Int) m_refPicSetInterLayer1.size()) ) );
     690    pcSlice->setNumRefIdx(REF_PIC_LIST_1,min(gopEntry.m_numRefPicsActive,( pcSlice->getRPS()->getNumberOfPictures() + (Int) m_refPicSetInterLayer0.size() + (Int) m_refPicSetInterLayer1.size()) ) );
     691
     692    std::vector< TComPic* >    tempRefPicLists[2];
     693    std::vector< Bool     >    usedAsLongTerm [2];
     694    Int       numPocTotalCurr;
     695
     696    pcSlice->getTempRefPicLists( rcListPic, m_refPicSetInterLayer0, m_refPicSetInterLayer1, tempRefPicLists, usedAsLongTerm, numPocTotalCurr, true );
     697   
     698
     699    xSetRefPicListModificationsMv( tempRefPicLists, pcSlice, iGOPid );   
     700#else
    644701    if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > 0 )
    645702    {
     
    692749    }
    693750
     751#endif
    694752#else
    695753    pcSlice->setNumRefIdx(REF_PIC_LIST_0,min(m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive,pcSlice->getRPS()->getNumberOfPictures()));
     
    702760
    703761    //  Set reference list
     762#if H_MV5
     763#if H_MV   
     764    pcSlice->setRefPicList( tempRefPicLists, usedAsLongTerm, numPocTotalCurr );
     765#else
     766    pcSlice->setRefPicList ( rcListPic );
     767#endif
     768 
     769#if H_3D_ARP
     770    //GT: This seems to be broken when layerId in vps is not equal to layerId in nuh
     771    pcSlice->setARPStepNum();
     772    if(pcSlice->getARPStepNum() > 1)
     773    {
     774      for(Int iLayerId = 0; iLayerId < getLayerId(); iLayerId ++ )
     775      {
     776        Int  iViewIdx =   pcSlice->getVPS()->getViewIndex(iLayerId);
     777        Bool bIsDepth = ( pcSlice->getVPS()->getDepthId  ( iLayerId ) == 1 );
     778        if( iViewIdx<getViewIndex() && !bIsDepth )
     779        {
     780          pcSlice->setBaseViewRefPicList( m_ivPicLists->getPicList( iLayerId ), iViewIdx );
     781        }
     782      }
     783    }
     784#endif
     785#else
    704786#if H_MV   
    705787    pcSlice->setRefPicList( rcListPic, m_refPicSetInterLayer );
     
    722804    pcSlice->setRefPicList ( rcListPic );
    723805#endif
    724 
     806#endif
    725807#if H_3D
    726808    pcSlice->setIvPicLists( m_ivPicLists );         
     
    18161898          digestStr = digestToString(sei_recon_picture_digest.digest, 4);
    18171899        }
     1900#if H_MV_FIX_LID_PIC_HASH_SEI_T40
     1901        OutputNALUnit nalu(NAL_UNIT_SUFFIX_SEI, pcSlice->getTLayer(), getLayerId() );
     1902#else
    18181903        OutputNALUnit nalu(NAL_UNIT_SUFFIX_SEI, pcSlice->getTLayer());
     1904#endif
    18191905
    18201906        /* write the SEI messages */
     
    20802166      pcPic->setReconMark   ( true );
    20812167#if H_MV
     2168#if H_MV5
     2169      TComSlice::markIvRefPicsAsShortTerm( m_refPicSetInterLayer0, m_refPicSetInterLayer1 ); 
     2170#else
    20822171      TComSlice::markIvRefPicsAsShortTerm( m_refPicSetInterLayer ); 
     2172#endif
    20832173      std::vector<Int> temp;
    20842174      TComSlice::markCurrPic( pcPic );
     
    29123002
    29133003#if H_MV
     3004#if H_MV5
     3005Void TEncGOP::xSetRefPicListModificationsMv( std::vector<TComPic*> tempPicLists[2], TComSlice* pcSlice, UInt iGOPid )
     3006{
     3007 
     3008  if( pcSlice->getSliceType() == I_SLICE || !(pcSlice->getPPS()->getListsModificationPresentFlag()) || pcSlice->getNumActiveRefLayerPics() == 0 )
     3009  {
     3010    return;
     3011  }
     3012 
     3013  GOPEntry ge = m_pcCfg->getGOPEntry( (pcSlice->getRapPicFlag() && ( pcSlice->getLayerId( ) > 0) ) ? MAX_GOP : iGOPid );
     3014  assert( ge.m_numActiveRefLayerPics == pcSlice->getNumActiveRefLayerPics() );
     3015
     3016  Int numPicsInTempList     = pcSlice->getNumRpsCurrTempList(); 
     3017
     3018  // GT: check if SliceType should be checked here.
     3019  for (Int li = 0; li < 2; li ++) // Loop over lists L0 and L1
     3020  {
     3021    Int numPicsInFinalRefList = pcSlice->getNumRefIdx( ( li == 0 ) ? REF_PIC_LIST_0 : REF_PIC_LIST_1 );
     3022           
     3023    Int finalIdxToTempIdxMap[16];
     3024    for( Int k = 0; k < 16; k++ )
     3025    {
     3026      finalIdxToTempIdxMap[ k ] = -1;
     3027    }
     3028
     3029    Bool isModified = false;
     3030    if ( numPicsInTempList > 1 )
     3031    {
     3032      for( Int k = 0; k < pcSlice->getNumActiveRefLayerPics(); k++ )
     3033      {
     3034        // get position in temp. list
     3035        Int refPicLayerId = pcSlice->getRefPicLayerId(k);
     3036        Int idxInTempList = 0;
     3037        for (; idxInTempList < numPicsInTempList; idxInTempList++)
     3038        {
     3039          if ( (tempPicLists[li][idxInTempList])->getLayerId() == refPicLayerId )
     3040          {
     3041            break;
     3042          }
     3043        }
     3044
     3045        Int idxInFinalList = ge.m_interViewRefPosL[ li ][ k ];
     3046       
     3047        // Add negative from behind
     3048        idxInFinalList = ( idxInFinalList < 0 )? ( numPicsInTempList + idxInFinalList ) : idxInFinalList;
     3049       
     3050        Bool curIsModified = ( idxInFinalList != idxInTempList ) && ( ( idxInTempList < numPicsInFinalRefList ) || ( idxInFinalList < numPicsInFinalRefList ) ) ;
     3051        if ( curIsModified )
     3052        {
     3053          isModified = true;
     3054          assert( finalIdxToTempIdxMap[ idxInFinalList ] == -1 ); // Assert when two inter layer reference pictures are sorted to the same position
     3055        }
     3056        finalIdxToTempIdxMap[ idxInFinalList ] = idxInTempList;             
     3057      }
     3058    }
     3059
     3060    TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification();
     3061    refPicListModification->setRefPicListModificationFlagL( li, isModified ); 
     3062
     3063    if( isModified )
     3064    {
     3065      Int refIdx = 0;
     3066     
     3067      for( Int i = 0; i < numPicsInFinalRefList; i++ )
     3068      {
     3069        if( finalIdxToTempIdxMap[i] >= 0 )
     3070        {
     3071          refPicListModification->setRefPicSetIdxL( li, i, finalIdxToTempIdxMap[i] );
     3072        }
     3073        else
     3074        {
     3075          ///* Fill gaps with temporal references *///
     3076          // Forward inter layer reference pictures
     3077          while( ( refIdx < numPicsInTempList ) && ( tempPicLists[li][refIdx]->getLayerId() != getLayerId())  )
     3078          {
     3079            refIdx++;
     3080          }
     3081          refPicListModification->setRefPicSetIdxL( li, i, refIdx );
     3082          refIdx++;
     3083        }
     3084      }
     3085    }
     3086  }
     3087}
     3088#else
    29143089Void TEncGOP::xSetRefPicListModificationsMv( TComSlice* pcSlice, UInt iGOPid )
    29153090{
     
    29753150}
    29763151#endif
     3152#endif
    29773153//! \}
Note: See TracChangeset for help on using the changeset viewer.