Ignore:
Timestamp:
2 Mar 2013, 09:25:00 (12 years ago)
Author:
seregin
Message:

port simulcast

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComSlice.cpp

    r51 r54  
    8181, m_bNoBackPredFlag               ( false )
    8282, m_uiTLayer                      ( 0 )
     83#if SVC_EXTENSION
     84, m_layerId                     ( 0 )
     85, m_pcBaseColPic                  ( NULL )
     86#endif
    8387, m_bTLayerSwitchingFlag          ( false )
    8488, m_sliceMode                   ( 0 )
     
    136140
    137141
     142#if SET_SLICE_LAYER_ID
     143Void TComSlice::initSlice( UInt layerId )
     144#else
    138145Void TComSlice::initSlice()
    139 {
     146#endif
     147{
     148#if SET_SLICE_LAYER_ID
     149  m_layerId = layerId;
     150#endif
    140151  m_aiNumRefIdx[0]      = 0;
    141152  m_aiNumRefIdx[1]      = 0;
     
    344355Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic )
    345356{
     357#if REF_IDX_FRAMEWORK
     358  if( m_eSliceType == I_SLICE || ( getSPS()->getLayerId() &&
     359      (getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA) &&
     360      (getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) ) )
     361#else
    346362  if (m_eSliceType == I_SLICE)
     363#endif
    347364  {
    348365    ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList));
     
    12611278, m_vuiParametersPresentFlag  (false)
    12621279, m_vuiParameters             ()
     1280#if SVC_EXTENSION
     1281, m_layerId(0)
     1282#endif
    12631283{
    12641284  for ( Int i = 0; i < MAX_TLAYER; i++ )
     
    19261946//! activate a PPS and depending on isIDR parameter also SPS and VPS
    19271947//! \returns true, if activation is successful
     1948#if SVC_EXTENSION
     1949Bool ParameterSetManager::activatePPS(Int ppsId, Bool isIDR, UInt layerId)
     1950#else
    19281951Bool ParameterSetManager::activatePPS(Int ppsId, Bool isIDR)
     1952#endif
    19291953{
    19301954  TComPPS *pps = m_ppsMap.getPS(ppsId);
     
    19321956  {
    19331957    Int spsId = pps->getSPSId();
     1958#if SVC_EXTENSION
     1959    if (!isIDR && (spsId != layerId ))
     1960#else
    19341961    if (!isIDR && (spsId != m_activeSPSId))
     1962#endif
    19351963    {
    19361964      printf("Warning: tried to activate PPS referring to a inactive SPS at non-IDR.");
     
    20012029}
    20022030#endif
     2031
     2032#if SVC_EXTENSION
     2033#if AVC_SYNTAX
     2034Void TComSlice::initBaseLayerRPL( TComSlice *pcSlice )
     2035{
     2036// Assumed that RPL of the base layer is same to the EL, otherwise this information should be also dumped and read from the metadata file
     2037  setPOC( pcSlice->getPOC() );
     2038  if( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA )
     2039  {
     2040    setSliceType( I_SLICE );
     2041  }
     2042  else
     2043  {
     2044    setSliceType( pcSlice->getSliceType() );
     2045  }
     2046
     2047  if( this->isIntra() )
     2048  {
     2049    return;
     2050  }
     2051
     2052  //initialize reference POC of BL
     2053  for( Int iRefPicList = 0; iRefPicList < 2; iRefPicList++ )
     2054  {
     2055    RefPicList eRefPicList = RefPicList( iRefPicList );
     2056
     2057    assert( pcSlice->getNumRefIdx( eRefPicList) > 0 );
     2058    setNumRefIdx( eRefPicList, pcSlice->getNumRefIdx( eRefPicList ) - 1 );
     2059    assert( getNumRefIdx( eRefPicList) <= MAX_NUM_REF);
     2060
     2061    for(Int refIdx = 0; refIdx < getNumRefIdx( eRefPicList ); refIdx++)
     2062    {
     2063      setRefPOC( pcSlice->getRefPic( eRefPicList, refIdx )->getPOC(), eRefPicList, refIdx );
     2064      setRefPic( pcSlice->getRefPic( eRefPicList, refIdx ), eRefPicList, refIdx );
     2065      /*
     2066      // should be set if the base layer has its own instance of the reference picture lists, currently EL RPL is reused.
     2067      getRefPic( eRefPicList, refIdx )->setLayerId( 0 );
     2068      getRefPic( eRefPicList, refIdx )->setIsLongTerm( pcSlice->getRefPic( eRefPicList, refIdx )->getIsLongTerm() );
     2069      getRefPic( eRefPicList, refIdx )->setIsUsedAsLongTerm( pcSlice->getRefPic( eRefPicList, refIdx )->getIsUsedAsLongTerm() );
     2070      */
     2071
     2072    }
     2073  } 
     2074  return;
     2075}
     2076#endif
     2077
     2078Void TComSlice::setBaseColPic(  TComList<TComPic*>& rcListPic, UInt layerID )
     2079
     2080  if (layerID == 0)
     2081  {
     2082    m_pcBaseColPic = NULL;
     2083    return;
     2084  }       
     2085  setBaseColPic(xGetRefPic(rcListPic, getPOC()));
     2086}
     2087#endif
     2088
     2089#if REF_IDX_FRAMEWORK
     2090Void TComSlice::addRefPicList( TComPic **pIlpPicList, Int iRefPicNum, Int iInsertOffset )
     2091{
     2092  if(getSPS()->getLayerId() && m_eSliceType != I_SLICE)
     2093  {
     2094#if REF_IDX_MFM
     2095    assert(iRefPicNum == 1);
     2096    if( getPOC() != 0 )
     2097    {
     2098      pIlpPicList[0]->copyUpsampledMvField(getBaseColPic());
     2099    }
     2100#endif
     2101    //add to list 0;
     2102    Int iOffset;
     2103    m_aiNumRefIdx[REF_PIC_LIST_0] += iInsertOffset;
     2104    iOffset = m_aiNumRefIdx[REF_PIC_LIST_0];
     2105    for (Int i=0; i<iRefPicNum; i++)
     2106    {
     2107      pIlpPicList[i]->setIsLongTerm(1);  //mark ilp as long-term reference
     2108      pIlpPicList[i]->setIsUsedAsLongTerm(1);  //mark ilp as long-term reference
     2109      m_apcRefPicList[REF_PIC_LIST_0][iOffset + i] = pIlpPicList[i];
     2110      m_aiNumRefIdx[REF_PIC_LIST_0]++;
     2111      //m_aiNumRefIdx[REF_PIC_LIST_C]++;
     2112    }
     2113    if(m_eSliceType == B_SLICE)
     2114    {
     2115      m_aiNumRefIdx[REF_PIC_LIST_1] += iInsertOffset;
     2116      iOffset = m_aiNumRefIdx[REF_PIC_LIST_1];
     2117      for (Int i=0; i<iRefPicNum; i++)
     2118      {
     2119        pIlpPicList[i]->setIsLongTerm(1);  //mark ilp as long-term reference
     2120        pIlpPicList[i]->setIsUsedAsLongTerm(1);  //mark ilp as long-term reference
     2121        m_apcRefPicList[REF_PIC_LIST_1][iOffset + i] = pIlpPicList[i];
     2122        m_aiNumRefIdx[REF_PIC_LIST_1]++;
     2123        //m_aiNumRefIdx[REF_PIC_LIST_C]++;
     2124      }
     2125    }
     2126  }
     2127}
     2128
     2129#if REF_IDX_MFM
     2130Void TComSlice::setRefPOCListILP( TComPic** ilpPic, TComPic *pcRefPicBL )
     2131{
     2132  //set reference picture POC of each ILP reference
     2133  Int thePoc = ilpPic[0]->getPOC();
     2134  assert(thePoc >= 0);
     2135  assert(thePoc == pcRefPicBL->getPOC());
     2136
     2137#if REUSE_MVSCALE || REUSE_BLKMAPPING
     2138  ilpPic[0]->getSlice(0)->setBaseColPic( pcRefPicBL );
     2139#endif
     2140
     2141  //initialize reference POC of ILP
     2142  for(Int refIdx = 0; refIdx < MAX_NUM_REF; refIdx++)
     2143  {
     2144    ilpPic[0]->getSlice(0)->setRefPOC(0, REF_PIC_LIST_0, refIdx);
     2145    ilpPic[0]->getSlice(0)->setRefPOC(0, REF_PIC_LIST_1, refIdx);
     2146
     2147    ilpPic[0]->getSlice(0)->setRefPic(NULL, REF_PIC_LIST_0, refIdx);
     2148    ilpPic[0]->getSlice(0)->setRefPic(NULL, REF_PIC_LIST_1, refIdx);
     2149  }
     2150
     2151  //set reference POC of ILP
     2152  ilpPic[0]->getSlice(0)->setNumRefIdx(REF_PIC_LIST_0, pcRefPicBL->getSlice(0)->getNumRefIdx(REF_PIC_LIST_0));
     2153  assert(ilpPic[0]->getSlice(0)->getNumRefIdx(REF_PIC_LIST_0) <= MAX_NUM_REF);
     2154  ilpPic[0]->getSlice(0)->setNumRefIdx(REF_PIC_LIST_1, pcRefPicBL->getSlice(0)->getNumRefIdx(REF_PIC_LIST_1));
     2155  assert(ilpPic[0]->getSlice(0)->getNumRefIdx(REF_PIC_LIST_1) <= MAX_NUM_REF);
     2156
     2157  for(Int refIdx = 0; refIdx < pcRefPicBL->getSlice(0)->getNumRefIdx(REF_PIC_LIST_0); refIdx++)
     2158  {
     2159    ilpPic[0]->getSlice(0)->setRefPOC(pcRefPicBL->getSlice(0)->getRefPOC(REF_PIC_LIST_0, refIdx), REF_PIC_LIST_0, refIdx);
     2160  }
     2161  for(Int refIdx = 0; refIdx < pcRefPicBL->getSlice(0)->getNumRefIdx(REF_PIC_LIST_1); refIdx++)
     2162  {
     2163    ilpPic[0]->getSlice(0)->setRefPOC(pcRefPicBL->getSlice(0)->getRefPOC(REF_PIC_LIST_1, refIdx), REF_PIC_LIST_1, refIdx);
     2164  }
     2165  for(Int refIdx = 0; refIdx < pcRefPicBL->getSlice(0)->getNumRefIdx(REF_PIC_LIST_0); refIdx++)
     2166  {
     2167    ilpPic[0]->getSlice(0)->setRefPic(pcRefPicBL->getSlice(0)->getRefPic(REF_PIC_LIST_0, refIdx), REF_PIC_LIST_0, refIdx);
     2168  }
     2169  for(Int refIdx = 0; refIdx < pcRefPicBL->getSlice(0)->getNumRefIdx(REF_PIC_LIST_1); refIdx++)
     2170  {
     2171    ilpPic[0]->getSlice(0)->setRefPic(pcRefPicBL->getSlice(0)->getRefPic(REF_PIC_LIST_1, refIdx), REF_PIC_LIST_1, refIdx);
     2172  }
     2173  return;
     2174}
     2175#endif
     2176
     2177
     2178#endif
    20032179//! \}
Note: See TracChangeset for help on using the changeset viewer.