Changeset 296 in SHVCSoftware for branches/SHM-2.1-dev/source


Ignore:
Timestamp:
20 Jun 2013, 17:44:29 (12 years ago)
Author:
nokia
Message:

Implementation of JCTVC-M0040 "Adaptive Resolution Change"

Location:
branches/SHM-2.1-dev/source
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncCfg.cpp

    r294 r296  
    843843  ("ConstantPicRateIdc",           cfg_constantPicRateIdc,            string(""), "List of constant picture rate IDCs; include non-negative number even if corresponding flag is 0")
    844844#endif
     845#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     846  ("AdaptiveResolutionChange",     m_adaptiveResolutionChange, 0, "Adaptive resolution change frame number. Should coincide with EL RAP picture. (0: disable)")
     847#endif
    845848  ;
    846849 
     
    21372140  }
    21382141#endif
     2142#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     2143  if (m_adaptiveResolutionChange > 0)
     2144  {
     2145    xConfirmPara(m_numLayers != 2, "Adaptive resolution change works with 2 layers only");
     2146    xConfirmPara(m_acLayerCfg[1].m_iIntraPeriod == 0 || (m_adaptiveResolutionChange % m_acLayerCfg[1].m_iIntraPeriod) != 0, "Adaptive resolution change must happen at enhancement layer RAP picture");
     2147  }
     2148#endif
    21392149#undef xConfirmPara
    21402150  if (check_failed)
     
    21752185  printf("Multiview                     : %d\n", m_scalabilityMask[0] );
    21762186  printf("Scalable                      : %d\n", m_scalabilityMask[1] );
     2187#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     2188  printf("Adaptive Resolution Change    : %d\n", m_adaptiveResolutionChange );
     2189#endif
    21772190  for(UInt layer=0; layer<m_numLayers; layer++)
    21782191  {
  • branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncCfg.h

    r292 r296  
    369369  Int*      m_constantPicRateIdc;                                ///< Indicates constant picture rate idc for various sub-layers
    370370#endif
     371#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     372  Int       m_adaptiveResolutionChange;                       ///< Indicate adaptive resolution change frame
     373#endif
    371374public:
    372375  TAppEncCfg();
  • branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r292 r296  
    515515    }
    516516#endif
     517#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     518    m_acTEncTop[layer].setAdaptiveResolutionChange( m_adaptiveResolutionChange );
     519#endif
    517520  }
    518521}
     
    10311034    vps->setMaxOneActiveRefLayerFlag(maxDirectRefLayers > 1 ? false : true);
    10321035#endif
     1036#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     1037  vps->setSingleLayerForNonIrapFlag(m_adaptiveResolutionChange > 0 ? true : false);
     1038#endif
    10331039#else
    10341040  m_cTEncTop.init();
     
    11501156#endif
    11511157
     1158#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     1159    if (m_adaptiveResolutionChange)
     1160    {
     1161      for(UInt layer = 0; layer < m_numLayers; layer++)
     1162      {
     1163        TComList<TComPicYuv*>::iterator iterPicYuvRec;
     1164        for (iterPicYuvRec = m_acListPicYuvRec[layer].begin(); iterPicYuvRec != m_acListPicYuvRec[layer].end(); iterPicYuvRec++)
     1165        {
     1166          TComPicYuv* recPic = *(iterPicYuvRec);
     1167          recPic->setReconstructed(false);
     1168        }
     1169      }
     1170    }
     1171#endif
     1172
    11521173    // loop through frames in one GOP
    11531174    for ( UInt iPicIdInGOP=0; iPicIdInGOP < (bFirstFrame? 1:m_iGOPSize); iPicIdInGOP++ )
     
    14161437  {
    14171438    TComPicYuv*  pcPicYuvRec  = *(iterPicYuvRec++);
     1439#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     1440    if (!m_acLayerCfg[layer].getReconFile().empty() && pcPicYuvRec->isReconstructed())
     1441#else
    14181442    if (!m_acLayerCfg[layer].getReconFile().empty())
     1443#endif
    14191444    {
    14201445      m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConfLeft(), m_acLayerCfg[layer].getConfRight(),
     
    14301455  list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin();
    14311456
     1457#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     1458  for ( i = 0; i < iNumEncoded && iterBitstream != accessUnits.end(); i++ )
     1459#else
    14321460  for ( i = 0; i < iNumEncoded; i++ )
     1461#endif
    14331462  {
    14341463    const AccessUnit& au = *(iterBitstream++);
  • branches/SHM-2.1-dev/source/Lib/TLibCommon/TComPicYuv.h

    r236 r296  
    9292#endif
    9393
     94#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     95  Bool    m_isReconstructed;
     96#endif
     97
    9498  Bool  m_bIsBorderExtended;
    9599 
     
    174178  //  Dump picture
    175179  Void  dump (Char* pFileName, Bool bAdd = false);
    176  
     180
     181#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     182  Void  setReconstructed(Bool x) { m_isReconstructed = x;    }
     183  Bool  isReconstructed()        { return m_isReconstructed; }
     184#endif
     185
    177186  // Set border extension flag
    178187  Void  setBorderExtension(Bool b) { m_bIsBorderExtended = b; }
  • branches/SHM-2.1-dev/source/Lib/TLibCommon/TComSlice.cpp

    r291 r296  
    572572#if ILR_RESTR
    573573  Int numInterLayerRPSPics = 0;
     574#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     575  if( m_layerId > 0 && m_activeNumILRRefIdx > 0 )
     576#else
    574577  if( m_layerId > 0 )
     578#endif
    575579  {
    576580    for( i=0; i < m_pcVPS->getNumDirectRefLayers( m_layerId ); i++ )
  • branches/SHM-2.1-dev/source/Lib/TLibCommon/TComSlice.h

    r291 r296  
    567567  UInt       m_maxSublayerForIlpPlus1[MAX_VPS_LAYER_ID_PLUS1 - 1];
    568568#endif
     569#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     570  Bool       m_singleLayerForNonIrapFlag;
     571#endif
    569572public:
    570573  TComVPS();
     
    730733  Bool   getMaxSublayerForIlpPlus1(Int layerId)                     { return m_maxSublayerForIlpPlus1[layerId];                   }
    731734  Void   setMaxSublayerForIlpPlus1(Int layerId, UInt maxSublayer)   { m_maxSublayerForIlpPlus1[layerId] = maxSublayer;            }
     735#endif
     736#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     737  Bool   getSingleLayerForNonIrapFlag()                             { return m_singleLayerForNonIrapFlag; }
     738  Void   setSingleLayerForNonIrapFlag(Bool x)                       { m_singleLayerForNonIrapFlag = x;    }
    732739#endif
    733740};
  • branches/SHM-2.1-dev/source/Lib/TLibCommon/TypeDef.h

    r292 r296  
    6262#define VPS_SPLIT_FLAG                   1      ///< M0163: Do not signal dimension_id and the last dimension_id_len_minus1, when splitting_flag is equal to 1.
    6363#define M0457_PREDICTION_INDICATIONS     1
     64#define M0040_ADAPTIVE_RESOLUTION_CHANGE 1
    6465#endif
    6566
  • branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r291 r296  
    11581158  }
    11591159#endif
     1160#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     1161  READ_FLAG(uiCode, "single_layer_for_non_irap_flag" ); vps->setSingleLayerForNonIrapFlag(uiCode == 1 ? true : false);
     1162#endif
    11601163}
    11611164#endif
     
    16191622      rpcSlice->setColRefLayerIdx( 0 );
    16201623      rpcSlice->setAltColIndicationFlag( false );
    1621       if ( sps->getLayerId() > 0 && rpcSlice->getNumMotionPredRefLayers() > 0 )
     1624      if ( sps->getLayerId() > 0 && rpcSlice->getActiveNumILRRefIdx() > 0 && rpcSlice->getNumMotionPredRefLayers() > 0 )
    16221625      {
    16231626        READ_FLAG( uiCode, "alt_collocated_indication_flag" );
  • branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecTop.cpp

    r295 r296  
    937937      pcSlice->setRefPicList( m_cListPic, false, m_cIlpPic);
    938938    }
     939#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     940    else if ( m_layerId > 0 )
     941    {
     942      pcSlice->setRefPicList( m_cListPic, false, NULL);
     943    }
     944#endif
    939945#endif
    940946
  • branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp

    r291 r296  
    879879  }
    880880#endif
     881#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     882  WRITE_FLAG(vps->getSingleLayerForNonIrapFlag(), "single_layer_for_non_irap_flag" );
     883#endif
    881884}
    882885#endif
     
    12221225    {
    12231226#if REF_IDX_FRAMEWORK && M0457_COL_PICTURE_SIGNALING
    1224       if ( !pcSlice->getIdrPicFlag() && pcSlice->getLayerId() > 0 && pcSlice->getNumMotionPredRefLayers() > 0 )
    1225       {
    1226         WRITE_FLAG( 1, "alt_collocated_indication_flag" );
    1227         if (pcSlice->getNumMotionPredRefLayers() > 1)
     1227      if ( !pcSlice->getIdrPicFlag() && pcSlice->getLayerId() > 0 && pcSlice->getActiveNumILRRefIdx() > 0 && pcSlice->getNumMotionPredRefLayers() > 0 )
     1228      {
     1229        WRITE_FLAG( pcSlice->getAltColIndicationFlag() ? 1 : 0, "alt_collocated_indication_flag" );
     1230        if (pcSlice->getAltColIndicationFlag() && pcSlice->getNumMotionPredRefLayers() > 1)
    12281231        {
    12291232          WRITE_UVLC(0, "collocated_ref_layer_idx");
  • branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncCfg.h

    r292 r296  
    367367#if REF_IDX_FRAMEWORK
    368368  Int      m_elRapSliceBEnabled;
     369#endif
     370#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     371  Int      m_adaptiveResolutionChange;
    369372#endif
    370373
     
    888891  Int       getElRapSliceTypeB()              {return m_elRapSliceBEnabled;}
    889892#endif
     893#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     894  Void      setAdaptiveResolutionChange(Int x) { m_adaptiveResolutionChange = x;    }
     895  Int       getAdaptiveResolutionChange()      { return m_adaptiveResolutionChange; }
     896#endif
    890897};
    891898
  • branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r295 r296  
    498498    }
    499499
     500#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     501    if (m_pcEncTop->getAdaptiveResolutionChange() > 0 && ((m_layerId == 1 && pocCurr < m_pcEncTop->getAdaptiveResolutionChange()) ||
     502                                                          (m_layerId == 0 && pocCurr > m_pcEncTop->getAdaptiveResolutionChange())) )
     503    {
     504      continue;
     505    }
     506#endif
     507
    500508    if( getNalUnitType(pocCurr, m_iLastIDR) == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType(pocCurr, m_iLastIDR) == NAL_UNIT_CODED_SLICE_IDR_N_LP )
    501509    {
     
    518526    m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, m_pcEncTop->getSPS(), m_pcEncTop->getPPS() );
    519527#endif
     528
     529#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     530    if (m_pcEncTop->getAdaptiveResolutionChange() > 0 && m_layerId == 1 && pocCurr > m_pcEncTop->getAdaptiveResolutionChange())
     531    {
     532      pcSlice->setActiveNumILRRefIdx(0);
     533      pcSlice->setInterLayerPredEnabledFlag(false);
    520534#if M0457_COL_PICTURE_SIGNALING
    521     pcSlice->setMFMEnabledFlag(m_pcEncTop->getMFMEnabledFlag());
    522     pcSlice->setAltColIndicationFlag(m_pcEncTop->getNumMotionPredRefLayers() > 0 ? true : false);
    523     pcSlice->setColRefLayerIdx(0);
    524 #endif
     535      pcSlice->setMFMEnabledFlag(false);
     536      pcSlice->setAltColIndicationFlag(false);
     537#endif
     538    }
     539#endif
     540
    525541    pcSlice->setLastIDR(m_iLastIDR);
    526542    pcSlice->setSliceIdx(0);
     
    797813#if REF_IDX_FRAMEWORK
    798814#if M0457_COL_PICTURE_SIGNALING
    799     if ( pcSlice->getSliceType() == B_SLICE && !pcSlice->getAltColIndicationFlag() )
     815    if ( pcSlice->getSliceType() == B_SLICE && !(pcSlice->getActiveNumILRRefIdx() > 0 && m_pcEncTop->getNumMotionPredRefLayers() > 0) )
    800816#else
    801817    if( pcSlice->getSliceType() == B_SLICE )
     
    846862#if REF_IDX_MFM
    847863#if M0457_COL_PICTURE_SIGNALING
    848       if( pcSlice->getMFMEnabledFlag() && !pcSlice->getAltColIndicationFlag() )
     864      if( pcSlice->getMFMEnabledFlag() && !(pcSlice->getActiveNumILRRefIdx() > 0 && m_pcEncTop->getNumMotionPredRefLayers() > 0) )
    849865#else
    850866      if( pcSlice->getSPS()->getMFMEnabledFlag() )
     
    22602276      pcPic->getPicYuvRec()->copyToPic(pcPicYuvRecOut);
    22612277
     2278#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     2279      pcPicYuvRecOut->setReconstructed(true);
     2280#endif
     2281
    22622282      pcPic->setReconMark   ( true );
    22632283      m_bFirst = false;
  • branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncSlice.cpp

    r282 r296  
    502502#else
    503503    rpcSlice->setNumILRRefIdx( rpcSlice->getVPS()->getNumDirectRefLayers( layerId ) );
    504 #endif
     504#endif
     505#if M0457_COL_PICTURE_SIGNALING
     506    rpcSlice->setMFMEnabledFlag(m_ppcTEncTop[layerId]->getMFMEnabledFlag());
     507    rpcSlice->setAltColIndicationFlag(rpcSlice->getMFMEnabledFlag());
     508#endif
    505509  }
    506510
Note: See TracChangeset for help on using the changeset viewer.