Changeset 442 in SHVCSoftware for trunk/source/Lib/TLibDecoder


Ignore:
Timestamp:
21 Oct 2013, 13:41:29 (11 years ago)
Author:
seregin
Message:

reintegrate SHM-3.1-dev branch

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/source

  • trunk/source/Lib/TLibDecoder/SEIread.cpp

    r313 r442  
    101101    fprintf( g_hTrace, "=========== SOP Description SEI message ===========\n");
    102102    break;
     103#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     104  case SEI::INTER_LAYER_CONSTRAINED_TILE_SETS:
     105    fprintf( g_hTrace, "=========== Inter Layer Constrained Tile Sets SEI message ===========\n");
     106    break;
     107#endif
    103108  case SEI::SCALABLE_NESTING:
    104109    fprintf( g_hTrace, "=========== Scalable Nesting SEI message ===========\n");
     
    266271      xParseSEISOPDescription((SEISOPDescription&) *sei, payloadSize);
    267272      break;
     273#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     274    case SEI::INTER_LAYER_CONSTRAINED_TILE_SETS:
     275      sei = new SEIInterLayerConstrainedTileSets;
     276      xParseSEIInterLayerConstrainedTileSets((SEIInterLayerConstrainedTileSets&) *sei, payloadSize);
     277      break;
     278#endif
    268279    case SEI::SCALABLE_NESTING:
    269280      sei = new SEIScalableNesting;
     
    349360
    350361  /* restore primary bitstream for sei_message */
     362  getBitstream()->deleteFifo();
    351363  delete getBitstream();
    352364  setBitstream(bs);
     
    774786}
    775787
     788#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     789Void SEIReader::xParseSEIInterLayerConstrainedTileSets (SEIInterLayerConstrainedTileSets &sei, UInt payloadSize)
     790{
     791  UInt uiCode;
     792
     793  READ_FLAG( uiCode, "il_all_tiles_exact_sample_value_match_flag"   ); sei.m_ilAllTilesExactSampleValueMatchFlag = uiCode;
     794  READ_FLAG( uiCode, "il_one_tile_per_tile_set_flag"                ); sei.m_ilOneTilePerTileSetFlag = uiCode;
     795  if( !sei.m_ilOneTilePerTileSetFlag )
     796  {
     797    READ_UVLC( uiCode, "il_num_sets_in_message_minus1"                ); sei.m_ilNumSetsInMessageMinus1 = uiCode;
     798    if( sei.m_ilNumSetsInMessageMinus1 )
     799    {
     800      READ_FLAG( uiCode, "skipped_tile_set_present_flag"                ); sei.m_skippedTileSetPresentFlag = uiCode;
     801    }
     802    else
     803    {
     804      sei.m_skippedTileSetPresentFlag = false;
     805    }
     806    UInt numSignificantSets = sei.m_ilNumSetsInMessageMinus1 - (sei.m_skippedTileSetPresentFlag ? 1 : 0) + 1;
     807    for( UInt i = 0; i < numSignificantSets; i++ )
     808    {
     809      READ_UVLC( uiCode, "ilcts_id"                                     ); sei.m_ilctsId[i] = uiCode;
     810      READ_UVLC( uiCode, "il_num_tile_rects_in_set_minus1"              ) ;sei.m_ilNumTileRectsInSetMinus1[i] = uiCode;
     811      for( UInt j = 0; j <= sei.m_ilNumTileRectsInSetMinus1[i]; j++ )
     812      {
     813        READ_UVLC( uiCode, "il_top_left_tile_index"                       ); sei.m_ilTopLeftTileIndex[i][j] = uiCode;
     814        READ_UVLC( uiCode, "il_bottom_right_tile_index"                   ); sei.m_ilBottomRightTileIndex[i][j] = uiCode;
     815      }
     816      READ_CODE( 2, uiCode, "ilc_idc"                                   ); sei.m_ilcIdc[i] = uiCode;
     817      if( sei.m_ilAllTilesExactSampleValueMatchFlag )
     818      {
     819        READ_FLAG( uiCode, "il_exact_sample_value_match_flag"             ); sei.m_ilExactSampleValueMatchFlag[i] = uiCode;
     820      }
     821    }
     822  }
     823  else
     824  {
     825    READ_CODE( 2, uiCode, "all_tiles_ilc_idc"                         ); sei.m_allTilesIlcIdc = uiCode;
     826  }
     827
     828  xParseByteAlign();
     829}
     830#endif
     831
    776832#if M0043_LAYERS_PRESENT_SEI
    777833Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComVPS *vps, TComSPS *sps)
  • trunk/source/Lib/TLibDecoder/SEIread.h

    r313 r442  
    8080  Void xParseSEIToneMappingInfo       (SEIToneMappingInfo& sei, UInt payloadSize);
    8181  Void xParseSEISOPDescription        (SEISOPDescription &sei, UInt payloadSize);
     82#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     83  Void xParseSEIInterLayerConstrainedTileSets (SEIInterLayerConstrainedTileSets &sei, UInt payloadSize);
     84#endif
    8285#if M0043_LAYERS_PRESENT_SEI
    8386  Void xParseSEILayersPresent         (SEILayersPresent &sei, UInt payloadSize, TComVPS *vps);
  • trunk/source/Lib/TLibDecoder/SyntaxElementParser.cpp

    r313 r442  
    5252  if (length < 10)
    5353  {
    54     fprintf( g_hTrace, "%-50s u(%d)  : %d\n", pSymbolName, length, rValue );
     54    fprintf( g_hTrace, "%-50s u(%d)  : %u\n", pSymbolName, length, rValue );
    5555  }
    5656  else
    5757  {
    58     fprintf( g_hTrace, "%-50s u(%d) : %d\n", pSymbolName, length, rValue );
     58    fprintf( g_hTrace, "%-50s u(%d) : %u\n", pSymbolName, length, rValue );
    5959  }
    6060  fflush ( g_hTrace );
     
    6565  xReadUvlc (rValue);
    6666  fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter++ );
    67   fprintf( g_hTrace, "%-50s ue(v) : %d\n", pSymbolName, rValue );
     67  fprintf( g_hTrace, "%-50s ue(v) : %u\n", pSymbolName, rValue );
    6868  fflush ( g_hTrace );
    6969}
  • trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r345 r442  
    291291  }
    292292  READ_FLAG( uiCode, "pps_scaling_list_data_present_flag" );           pcPPS->setScalingListPresentFlag( uiCode ? true : false );
     293
     294#if IL_SL_SIGNALLING_N0371
     295  pcPPS->setPPS( pcPPS->getLayerId(), pcPPS ); 
     296#endif
     297
    293298  if(pcPPS->getScalingListPresentFlag ())
    294299  {
     300#if IL_SL_SIGNALLING_N0371
     301    pcPPS->getScalingList()->setLayerId( pcPPS->getLayerId() );
     302
     303    if( pcPPS->getLayerId() > 0 )
     304    {
     305      READ_FLAG( uiCode, "pps_pred_scaling_list_flag" );           pcPPS->setPredScalingListFlag( uiCode ? true : false );
     306      pcPPS->getScalingList()->setPredScalingListFlag( pcPPS->getPredScalingListFlag() );
     307     
     308      if( pcPPS->getPredScalingListFlag() )
     309      {
     310        READ_UVLC ( uiCode, "scaling_list_pps_ref_layer_id" );   pcPPS->setScalingListRefLayerId( uiCode );
     311
     312        // The value of pps_scaling_list_ref_layer_id shall be in the range of 0 to 62, inclusive
     313        assert( /*pcPPS->getScalingListRefLayerId() >= 0 &&*/ pcPPS->getScalingListRefLayerId() <= 62 );
     314
     315        // When avc_base_layer_flag is equal to 1, it is a requirement of bitstream conformance that the value of pps_scaling_list_ref_layer_id shall be greater than 0
     316        if( pcPPS->getSPS()->getVPS()->getAvcBaseLayerFlag() )
     317        {
     318          assert( pcPPS->getScalingListRefLayerId() > 0 );
     319        }
     320
     321        // It is a requirement of bitstream conformance that, when a PPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB and
     322        // pps_infer_scaling_list_flag in the PPS is equal to 1, pps_infer_scaling_list_flag shall be equal to 0 for the PPS that is active for the layer with nuh_layer_id equal to pps_scaling_list_ref_layer_id
     323        assert( pcPPS->getPPS( pcPPS->getScalingListRefLayerId() )->getPredScalingListFlag() == false );
     324
     325        // It is a requirement of bitstream conformance that, when a PPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB,
     326        // the layer with nuh_layer_id equal to pps_scaling_list_ref_layer_id shall be a direct or indirect reference layer of the layer with nuh_layer_id equal to nuhLayerIdB
     327        assert( pcPPS->getSPS()->getVPS()->getScalingListLayerDependency( pcPPS->getLayerId(), pcPPS->getScalingListRefLayerId() ) == true );
     328
     329        pcPPS->getScalingList()->setScalingListRefLayerId( pcPPS->getScalingListRefLayerId() );
     330        parseScalingList( pcPPS->getScalingList() );
     331      }
     332      else
     333      {
     334        parseScalingList( pcPPS->getScalingList() );
     335      }
     336    }
     337    else
     338    {
     339      parseScalingList( pcPPS->getScalingList() );
     340    }
     341#else
    295342    parseScalingList( pcPPS->getScalingList() );
     343#endif
    296344  }
    297345
     
    377425  TimingInfo *timingInfo = pcVUI->getTimingInfo();
    378426  READ_FLAG(       uiCode, "vui_timing_info_present_flag");         timingInfo->setTimingInfoPresentFlag      (uiCode ? true : false);
     427#if TIMING_INFO_NONZERO_LAYERID_SPS
     428  if( pcSPS->getLayerId() > 0 )
     429  {
     430    assert( timingInfo->getTimingInfoPresentFlag() == false );
     431  }
     432#endif
    379433  if(timingInfo->getTimingInfoPresentFlag())
    380434  {
     
    516570  }
    517571#endif
     572#if IL_SL_SIGNALLING_N0371
     573  pcSPS->setVPS( parameterSetManager->getPrefetchedVPS(pcSPS->getVPSId()) );
     574  pcSPS->setSPS( pcSPS->getLayerId(), pcSPS );
     575#endif
    518576  if ( pcSPS->getMaxTLayers() == 1 )
    519577  {
     
    525583#endif
    526584  }
    527 
     585#ifdef SPS_PTL_FIX
     586  if ( pcSPS->getLayerId() == 0)
     587  {
     588    parsePTL(pcSPS->getPTL(), 1, pcSPS->getMaxTLayers() - 1);
     589  }
     590#else
    528591  parsePTL(pcSPS->getPTL(), 1, pcSPS->getMaxTLayers() - 1);
     592#endif
     593
    529594  READ_UVLC(     uiCode, "sps_seq_parameter_set_id" );           pcSPS->setSPSId( uiCode );
    530595  assert(uiCode <= 15);
    531  
    532   READ_UVLC(     uiCode, "chroma_format_idc" );                  pcSPS->setChromaFormatIdc( uiCode );
    533   assert(uiCode <= 3);
    534   // in the first version we only support chroma_format_idc equal to 1 (4:2:0), so separate_colour_plane_flag cannot appear in the bitstream
    535   assert (uiCode == 1);
    536   if( uiCode == 3 )
    537   {
    538     READ_FLAG(     uiCode, "separate_colour_plane_flag");        assert(uiCode == 0);
    539   }
    540 
    541   READ_UVLC (    uiCode, "pic_width_in_luma_samples" );          pcSPS->setPicWidthInLumaSamples ( uiCode    );
    542   READ_UVLC (    uiCode, "pic_height_in_luma_samples" );         pcSPS->setPicHeightInLumaSamples( uiCode    );
     596
     597#if REPN_FORMAT_IN_VPS
     598  if( pcSPS->getLayerId() > 0 )
     599  {
     600    READ_FLAG( uiCode, "update_rep_format_flag" );                 
     601    pcSPS->setUpdateRepFormatFlag( uiCode ? true : false );
     602  }
     603  else
     604  {
     605    pcSPS->setUpdateRepFormatFlag( true );
     606  }
     607  if( pcSPS->getLayerId() == 0 || pcSPS->getUpdateRepFormatFlag() )
     608  {
     609#endif
     610    READ_UVLC(     uiCode, "chroma_format_idc" );                  pcSPS->setChromaFormatIdc( uiCode );
     611    assert(uiCode <= 3);
     612    // in the first version we only support chroma_format_idc equal to 1 (4:2:0), so separate_colour_plane_flag cannot appear in the bitstream
     613    assert (uiCode == 1);
     614    if( uiCode == 3 )
     615    {
     616      READ_FLAG(     uiCode, "separate_colour_plane_flag");        assert(uiCode == 0);
     617    }
     618
     619    READ_UVLC (    uiCode, "pic_width_in_luma_samples" );          pcSPS->setPicWidthInLumaSamples ( uiCode    );
     620    READ_UVLC (    uiCode, "pic_height_in_luma_samples" );         pcSPS->setPicHeightInLumaSamples( uiCode    );
     621#if REPN_FORMAT_IN_VPS
     622  }
     623#endif
    543624  READ_FLAG(     uiCode, "conformance_window_flag");
    544625  if (uiCode != 0)
    545626  {
    546627    Window &conf = pcSPS->getConformanceWindow();
     628#if REPN_FORMAT_IN_VPS
     629    READ_UVLC(   uiCode, "conf_win_left_offset" );               conf.setWindowLeftOffset  ( uiCode );
     630    READ_UVLC(   uiCode, "conf_win_right_offset" );              conf.setWindowRightOffset ( uiCode );
     631    READ_UVLC(   uiCode, "conf_win_top_offset" );                conf.setWindowTopOffset   ( uiCode );
     632    READ_UVLC(   uiCode, "conf_win_bottom_offset" );             conf.setWindowBottomOffset( uiCode );
     633#else
    547634    READ_UVLC(   uiCode, "conf_win_left_offset" );               conf.setWindowLeftOffset  ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) );
    548635    READ_UVLC(   uiCode, "conf_win_right_offset" );              conf.setWindowRightOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) );
    549636    READ_UVLC(   uiCode, "conf_win_top_offset" );                conf.setWindowTopOffset   ( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) );
    550637    READ_UVLC(   uiCode, "conf_win_bottom_offset" );             conf.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) );
    551   }
    552 
    553   READ_UVLC(     uiCode, "bit_depth_luma_minus8" );
    554   assert(uiCode <= 6);
    555   pcSPS->setBitDepthY( uiCode + 8 );
    556   pcSPS->setQpBDOffsetY( (Int) (6*uiCode) );
    557 
    558   READ_UVLC( uiCode,    "bit_depth_chroma_minus8" );
    559   assert(uiCode <= 6);
    560   pcSPS->setBitDepthC( uiCode + 8 );
    561   pcSPS->setQpBDOffsetC( (Int) (6*uiCode) );
    562 
     638#endif
     639  }
     640#if REPN_FORMAT_IN_VPS
     641  if(  pcSPS->getLayerId() == 0 || pcSPS->getUpdateRepFormatFlag() )
     642  {
     643#endif
     644    READ_UVLC(     uiCode, "bit_depth_luma_minus8" );
     645    assert(uiCode <= 6);
     646    pcSPS->setBitDepthY( uiCode + 8 );
     647    pcSPS->setQpBDOffsetY( (Int) (6*uiCode) );
     648
     649    READ_UVLC( uiCode,    "bit_depth_chroma_minus8" );
     650    assert(uiCode <= 6);
     651    pcSPS->setBitDepthC( uiCode + 8 );
     652    pcSPS->setQpBDOffsetC( (Int) (6*uiCode) );
     653#if REPN_FORMAT_IN_VPS
     654  }
     655#endif
    563656  READ_UVLC( uiCode,    "log2_max_pic_order_cnt_lsb_minus4" );   pcSPS->setBitsForPOC( 4 + uiCode );
    564657  assert(uiCode <= 12);
     
    606699  Int addCuDepth = max (0, log2MinCUSize - (Int)pcSPS->getQuadtreeTULog2MinSize() );
    607700  pcSPS->setMaxCUDepth( maxCUDepthDelta + addCuDepth );
    608 
    609701  READ_FLAG( uiCode, "scaling_list_enabled_flag" );                 pcSPS->setScalingListFlag ( uiCode );
     702
    610703  if(pcSPS->getScalingListFlag())
    611704  {
     
    613706    if(pcSPS->getScalingListPresentFlag ())
    614707    {
     708
     709#if IL_SL_SIGNALLING_N0371
     710      pcSPS->getScalingList()->setLayerId( pcSPS->getLayerId() );
     711
     712      if( pcSPS->getLayerId() > 0 )
     713      {
     714        READ_FLAG( uiCode, "sps_pred_scaling_list_flag" );  pcSPS->setPredScalingListFlag ( uiCode );
     715        pcSPS->getScalingList()->setPredScalingListFlag( pcSPS->getPredScalingListFlag() );
     716
     717        if( pcSPS->getPredScalingListFlag() )
     718        {
     719          READ_UVLC( uiCode, "scaling_list_sps_ref_layer_id" );    pcSPS->setScalingListRefLayerId( uiCode );
     720
     721          // The value of sps_scaling_list_ref_layer_id shall be in the range of 0 to 62, inclusive
     722          assert( /*pcSPS->getScalingListRefLayerId() >= 0 &&*/ pcSPS->getScalingListRefLayerId() <= 62 );
     723
     724          // When avc_base_layer_flag is equal to 1, it is a requirement of bitstream conformance that the value of sps_scaling_list_ref_layer_id shall be greater than 0
     725          if( pcSPS->getVPS()->getAvcBaseLayerFlag() )
     726          {
     727            assert( pcSPS->getScalingListRefLayerId() > 0 );
     728          }
     729
     730          // It is a requirement of bitstream conformance that, when an SPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB and
     731          // sps_infer_scaling_list_flag in the SPS is equal to 1, sps_infer_scaling_list_flag shall be equal to 0 for the SPS that is active for the layer with nuh_layer_id equal to sps_scaling_list_ref_layer_id
     732          assert( pcSPS->getSPS( pcSPS->getScalingListRefLayerId() )->getPredScalingListFlag() == false );
     733
     734          // It is a requirement of bitstream conformance that, when an SPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB,
     735          // the layer with nuh_layer_id equal to sps_scaling_list_ref_layer_id shall be a direct or indirect reference layer of the layer with nuh_layer_id equal to nuhLayerIdB
     736          assert( pcSPS->getVPS()->getScalingListLayerDependency( pcSPS->getLayerId(), pcSPS->getScalingListRefLayerId() ) == true );
     737
     738          pcSPS->getScalingList()->setScalingListRefLayerId( pcSPS->getScalingListRefLayerId() );
     739          parseScalingList( pcSPS->getScalingList() );
     740        }
     741        else
     742        {
     743          parseScalingList( pcSPS->getScalingList() );
     744        }
     745      }
     746      else
     747      {
     748        parseScalingList( pcSPS->getScalingList() );
     749      }
     750#else
    615751      parseScalingList( pcSPS->getScalingList() );
     752#endif
     753
    616754    }
    617755  }
     
    697835  UInt uiCode;
    698836  // more syntax elements to be parsed here
     837
     838#if VERT_MV_CONSTRAINT
     839  READ_FLAG( uiCode, "inter_view_mv_vert_constraint_flag" );
     840  // Vertical MV component restriction is not used in SHVC CTC
     841  assert( uiCode == 0 );
     842#endif
    699843#if SCALED_REF_LAYER_OFFSETS
    700 #if SCALED_REF_LAYER_OFFSET_FLAG
    701   READ_FLAG( uiCode, "scaled_ref_layer_offset_present_flag" );
    702   if( uiCode )
    703 #else
    704844  if( pcSPS->getLayerId() > 0 )
    705 #endif
    706845  {
    707846    Int iCode;
     
    754893  READ_FLAG(     uiCode,  "vps_temporal_id_nesting_flag" );       pcVPS->setTemporalNestingFlag( uiCode ? true:false );
    755894  assert (pcVPS->getMaxTLayers()>1||pcVPS->getTemporalNestingFlag());
     895#if VPS_EXTN_OFFSET
     896  READ_CODE( 16, uiCode,  "vps_extension_offset" );               pcVPS->setExtensionOffset( uiCode );
     897#else
    756898  READ_CODE( 16, uiCode,  "vps_reserved_ffff_16bits" );           assert(uiCode == 0xffff);
     899#endif
    757900  parsePTL ( pcVPS->getPTL(), true, pcVPS->getMaxTLayers()-1);
    758901  UInt subLayerOrderingInfoPresentFlag;
     
    833976  {
    834977#if VPS_EXTNS
     978    while ( m_pcBitstream->getNumBitsRead() % 8 != 0 )
     979    {
     980      READ_FLAG( uiCode, "vps_extension_alignment_bit_equal_to_one"); assert(uiCode == 1);
     981    }
    835982    parseVPSExtension(pcVPS);
    836983    READ_FLAG( uiCode, "vps_entension2_flag" );
     
    9271074      assert( uiCode <= vps->getMaxLayerId() );
    9281075    }
     1076  }
     1077#endif
     1078#if VIEW_ID_RELATED_SIGNALING
     1079  // if ( pcVPS->getNumViews() > 1 ) 
     1080  //   However, this is a bug in the text since, view_id_len_minus1 is needed to parse view_id_val.
     1081  {
     1082    READ_CODE( 4, uiCode, "view_id_len_minus1" ); vps->setViewIdLenMinus1( uiCode );
     1083  }
     1084
     1085  for(  i = 0; i < vps->getNumViews(); i++ )
     1086  {
     1087    READ_CODE( vps->getViewIdLenMinus1( ) + 1, uiCode, "view_id_val[i]" ); vps->setViewIdVal( i, uiCode );
    9291088  }
    9301089#endif
     
    9521111#if JCTVC_M0203_INTERLAYER_PRED_IDC
    9531112#if N0120_MAX_TID_REF_PRESENT_FLAG
    954   READ_FLAG( uiCode, "max_tid_il_ref_pics_plus1_present_flag"); vps->setMaxTidIlRefPicsPlus1PresentFlag(uiCode ? true : false);
    955   if (vps->getMaxTidIlRefPicsPlus1PresentFlag())
     1113  READ_FLAG( uiCode, "max_tid_ref_present_flag"); vps->setMaxTidRefPresentFlag(uiCode ? true : false);
     1114  if (vps->getMaxTidRefPresentFlag())
    9561115  {
    9571116    for(i = 0; i < vps->getMaxLayers() - 1; i++)
    9581117    {
    959       READ_CODE( 3, uiCode, "max_sublayer_for_ilp_plus1[i]" ); vps->setMaxSublayerForIlpPlus1(i, uiCode);
    960       assert( uiCode <= vps->getMaxTLayers() );
     1118      READ_CODE( 3, uiCode, "max_tid_il_ref_pics_plus1[i]" ); vps->setMaxTidIlRefPicsPlus1(i, uiCode);
     1119#if N0120_MAX_TID_REF_CFG
     1120      assert( uiCode <= vps->getMaxTLayers());
     1121#else
     1122      assert( uiCode <= vps->getMaxTLayers()+ 1 );
     1123#endif
    9611124    }
    9621125  }
     
    9651128    for(i = 0; i < vps->getMaxLayers() - 1; i++)
    9661129    {
    967       vps->setMaxSublayerForIlpPlus1(i, 7);
     1130      vps->setMaxTidIlRefPicsPlus1(i, 7);
    9681131    }
    9691132  }
     
    9711134  for(i = 0; i < vps->getMaxLayers() - 1; i++)
    9721135  {
    973     READ_CODE( 3, uiCode, "max_sublayer_for_ilp_plus1[i]" ); vps->setMaxSublayerForIlpPlus1(i, uiCode);
     1136    READ_CODE( 3, uiCode, "max_tid_il_ref_pics_plus1[i]" ); vps->setMaxTidIlRefPicsPlus1(i, uiCode);
    9741137    assert( uiCode <= vps->getMaxTLayers() );
    9751138  }
     
    10901253#endif
    10911254#endif
     1255#if REPN_FORMAT_IN_VPS
     1256  READ_FLAG( uiCode, "rep_format_idx_present_flag");
     1257  vps->setRepFormatIdxPresentFlag( uiCode ? true : false );
     1258
     1259  if( vps->getRepFormatIdxPresentFlag() )
     1260  {
     1261    READ_CODE( 4, uiCode, "vps_num_rep_formats_minus1" );
     1262    vps->setVpsNumRepFormats( uiCode + 1 );
     1263  }
     1264  else
     1265  {
     1266    // default assignment
     1267    assert (vps->getMaxLayers() <= 16);       // If max_layers_is more than 15, num_rep_formats has to be signaled
     1268    vps->setVpsNumRepFormats( vps->getMaxLayers() );
     1269  }
     1270  for(i = 0; i < vps->getVpsNumRepFormats(); i++)
     1271  {
     1272    // Read rep_format_structures
     1273    parseRepFormat( vps->getVpsRepFormat(i) );
     1274  }
     1275 
     1276  // Default assignment for layer 0
     1277  vps->setVpsRepFormatIdx( 0, 0 );
     1278  if( vps->getRepFormatIdxPresentFlag() )
     1279  {
     1280    for(i = 1; i < vps->getMaxLayers(); i++)
     1281    {
     1282      if( vps->getVpsNumRepFormats() > 1 )
     1283      {
     1284        READ_CODE( 4, uiCode, "vps_rep_format_idx[i]" );
     1285        vps->setVpsRepFormatIdx( i, uiCode );
     1286      }
     1287      else
     1288      {
     1289        // default assignment - only one rep_format() structure
     1290        vps->setVpsRepFormatIdx( i, 0 );
     1291      }
     1292    }
     1293  }
     1294  else
     1295  {
     1296    // default assignment - each layer assigned each rep_format() structure in the order signaled
     1297    for(i = 1; i < vps->getMaxLayers(); i++)
     1298    {
     1299      vps->setVpsRepFormatIdx( i, i );
     1300    }
     1301  }
     1302#endif
    10921303#if JCTVC_M0458_INTERLAYER_RPS_SIG
    1093    READ_FLAG(uiCode, "max_one_active_ref_layer_flag" );
    1094    vps->setMaxOneActiveRefLayerFlag(uiCode);
    1095 #endif
     1304  READ_FLAG(uiCode, "max_one_active_ref_layer_flag" );
     1305  vps->setMaxOneActiveRefLayerFlag(uiCode);
     1306#endif
     1307
     1308#if N0147_IRAP_ALIGN_FLAG
     1309  READ_FLAG(uiCode, "cross_layer_irap_aligned_flag" );
     1310  vps->setCrossLayerIrapAlignFlag(uiCode);
     1311#endif
    10961312
    10971313#if !VPS_MOVE_DIR_DEPENDENCY_FLAG
     
    11281344    }
    11291345  }
    1130 #endif
     1346
     1347#endif
     1348
     1349#if IL_SL_SIGNALLING_N0371
     1350  for(i = 1; i < vps->getMaxLayers(); i++)
     1351    {
     1352      for(j = 0; j < i; j++)
     1353        {     
     1354          vps->setScalingListLayerDependency( i, j, vps->checkLayerDependency( i,j ) );
     1355        }
     1356    }
     1357#endif
     1358
    11311359#if M0040_ADAPTIVE_RESOLUTION_CHANGE
    11321360  READ_FLAG(uiCode, "single_layer_for_non_irap_flag" ); vps->setSingleLayerForNonIrapFlag(uiCode == 1 ? true : false);
    11331361#endif
    1134 }
    1135 #endif
    1136 
     1362
     1363  READ_FLAG( uiCode,  "vps_vui_present_flag" );
     1364  if (uiCode)
     1365  {
     1366#if VPS_VUI
     1367    while ( m_pcBitstream->getNumBitsRead() % 8 != 0 )
     1368    {
     1369      READ_FLAG( uiCode, "vps_vui_alignment_bit_equal_to_one"); assert(uiCode == 1);
     1370    }
     1371    parseVPSVUI(vps);
     1372#endif
     1373  }
     1374}
     1375#endif
     1376#if REPN_FORMAT_IN_VPS
     1377Void  TDecCavlc::parseRepFormat      ( RepFormat *repFormat )
     1378{
     1379  UInt uiCode;
     1380  READ_CODE( 2, uiCode, "chroma_format_idc" );               repFormat->setChromaFormatVpsIdc( uiCode );
     1381 
     1382  if( repFormat->getChromaFormatVpsIdc() == 3 )
     1383  {
     1384    READ_FLAG( uiCode, "separate_colour_plane_flag");        repFormat->setSeparateColourPlaneVpsFlag(uiCode ? true : false);
     1385  }
     1386
     1387  READ_CODE ( 16, uiCode, "pic_width_in_luma_samples" );     repFormat->setPicWidthVpsInLumaSamples ( uiCode );
     1388  READ_CODE ( 16, uiCode, "pic_height_in_luma_samples" );    repFormat->setPicHeightVpsInLumaSamples( uiCode );
     1389 
     1390  READ_CODE( 4, uiCode, "bit_depth_luma_minus8" );           repFormat->setBitDepthVpsLuma  ( uiCode + 8 );
     1391  READ_CODE( 4, uiCode, "bit_depth_chroma_minus8" );         repFormat->setBitDepthVpsChroma( uiCode + 8 );
     1392
     1393}
     1394#endif
     1395#if VPS_VUI
     1396Void TDecCavlc::parseVPSVUI(TComVPS *vps)
     1397{
     1398  UInt i,j;
     1399  UInt uiCode;
     1400#if VPS_VUI_BITRATE_PICRATE
     1401  READ_FLAG( uiCode,        "bit_rate_present_vps_flag" );  vps->setBitRatePresentVpsFlag( uiCode ? true : false );
     1402  READ_FLAG( uiCode,        "pic_rate_present_vps_flag" );  vps->setPicRatePresentVpsFlag( uiCode ? true : false );
     1403
     1404  Bool parseFlag = vps->getBitRatePresentVpsFlag() || vps->getPicRatePresentVpsFlag();
     1405  {
     1406    for( i = 0; i < vps->getNumLayerSets(); i++ )
     1407    {
     1408      for( j = 0; j < vps->getMaxTLayers(); j++ )
     1409      {
     1410        if( parseFlag && vps->getBitRatePresentVpsFlag() )
     1411        {
     1412          READ_FLAG( uiCode,        "bit_rate_present_vps_flag[i][j]" );  vps->setBitRatePresentFlag( i, j, uiCode ? true : false );
     1413        }
     1414        else
     1415        {
     1416          vps->setBitRatePresentFlag( i, j, false );
     1417        }
     1418        if( parseFlag && vps->getPicRatePresentVpsFlag() )
     1419        {
     1420          READ_FLAG( uiCode,        "pic_rate_present_vps_flag[i][j]" );  vps->setPicRatePresentFlag( i, j, uiCode ? true : false );
     1421        }
     1422        else
     1423        {
     1424          vps->setPicRatePresentFlag( i, j, false );
     1425        }
     1426        if( parseFlag && vps->getBitRatePresentFlag(i, j) )
     1427        {
     1428          READ_CODE( 16, uiCode,    "avg_bit_rate[i][j]" ); vps->setAvgBitRate( i, j, uiCode );
     1429          READ_CODE( 16, uiCode,    "max_bit_rate[i][j]" ); vps->setMaxBitRate( i, j, uiCode );
     1430        }
     1431        else
     1432        {
     1433          vps->setAvgBitRate( i, j, 0 );
     1434          vps->setMaxBitRate( i, j, 0 );
     1435        }
     1436        if( parseFlag && vps->getPicRatePresentFlag(i, j) )
     1437        {
     1438          READ_CODE( 2 , uiCode,    "constant_pic_rate_idc[i][j]" ); vps->setConstPicRateIdc( i, j, uiCode );
     1439          READ_CODE( 16, uiCode,    "avg_pic_rate[i][j]"          ); vps->setAvgPicRate( i, j, uiCode );
     1440        }
     1441        else
     1442        {
     1443          vps->setConstPicRateIdc( i, j, 0 );
     1444          vps->setAvgPicRate     ( i, j, 0 );
     1445        }
     1446      }
     1447    }
     1448  }
     1449#endif
     1450#if TILE_BOUNDARY_ALIGNED_FLAG
     1451  for(i = 1; i < vps->getMaxLayers(); i++)
     1452  {
     1453    for(j = 0; j < vps->getNumDirectRefLayers(vps->getLayerIdInNuh(i)); j++)
     1454    {
     1455      READ_FLAG( uiCode, "tile_boundaries_aligned_flag[i][j]" ); vps->setTileBoundariesAlignedFlag(i,j,(uiCode == 1));     
     1456    }
     1457  } 
     1458#endif
     1459#if N0160_VUI_EXT_ILP_REF
     1460    READ_FLAG( uiCode, "num_ilp_restricted_ref_layers" ); vps->setNumIlpRestrictedRefLayers( uiCode == 1 );
     1461  if( vps->getNumIlpRestrictedRefLayers())
     1462  {
     1463    for(i = 1; i < vps->getMaxLayers(); i++)
     1464    {
     1465      for(j = 0; j < vps->getNumDirectRefLayers(vps->getLayerIdInNuh(i)); j++)
     1466      {
     1467        READ_UVLC( uiCode, "min_spatial_segment_offset_plus1[i][j]" ); vps->setMinSpatialSegmentOffsetPlus1( i, j, uiCode );
     1468        if( vps->getMinSpatialSegmentOffsetPlus1(i,j ) > 0 )
     1469        { 
     1470          READ_FLAG( uiCode, "ctu_based_offset_enabled_flag[i][j]"); vps->setCtuBasedOffsetEnabledFlag(i, j, uiCode == 1 );
     1471          if(vps->getCtuBasedOffsetEnabledFlag(i,j)) 
     1472          {
     1473            READ_UVLC( uiCode, "min_horizontal_ctu_offset_plus1[i][j]"); vps->setMinHorizontalCtuOffsetPlus1( i,j, uiCode );
     1474          }
     1475        } 
     1476      } 
     1477    }
     1478  }
     1479#endif
     1480}
     1481#endif
    11371482Void TDecCavlc::parseSliceHeader (TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager)
    11381483{
     
    11691514    rpcSlice->setDependentSliceSegmentFlag(false);
    11701515  }
     1516#if REPN_FORMAT_IN_VPS
     1517  Int numCTUs = ((rpcSlice->getPicWidthInLumaSamples()+sps->getMaxCUWidth()-1)/sps->getMaxCUWidth())*((rpcSlice->getPicHeightInLumaSamples()+sps->getMaxCUHeight()-1)/sps->getMaxCUHeight());
     1518#else
    11711519  Int numCTUs = ((sps->getPicWidthInLumaSamples()+sps->getMaxCUWidth()-1)/sps->getMaxCUWidth())*((sps->getPicHeightInLumaSamples()+sps->getMaxCUHeight()-1)/sps->getMaxCUHeight());
     1520#endif
    11721521  Int maxParts = (1<<(sps->getMaxCUDepth()<<1));
    11731522  UInt sliceSegmentAddress = 0;
     
    12031552  if(!rpcSlice->getDependentSliceSegmentFlag())
    12041553  {
    1205 
     1554#if POC_RESET_FLAG
     1555    Int iBits = 0;
     1556    if(rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > iBits)
     1557    {
     1558      READ_FLAG(uiCode, "poc_reset_flag");      rpcSlice->setPocResetFlag( uiCode ? true : false );
     1559      iBits++;
     1560    }
     1561    if(rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > iBits)
     1562    {
     1563      READ_FLAG(uiCode, "discardable_flag"); // ignored
     1564      iBits++;
     1565    }
     1566    for (; iBits < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); iBits++)
     1567    {
     1568      READ_FLAG(uiCode, "slice_reserved_undetermined_flag[]"); // ignored
     1569    }
     1570#else
    12061571#if SH_DISCARDABLE_FLAG
    12071572    if(rpcSlice->getPPS()->getNumExtraSliceHeaderBits()>0)
     
    12181583      READ_FLAG(uiCode, "slice_reserved_undetermined_flag[]"); // ignored
    12191584    }
     1585#endif
    12201586#endif
    12211587
     
    12441610      rpcSlice->setRPS(rps);
    12451611    }
     1612#if N0065_LAYER_POC_ALIGNMENT
     1613    if( rpcSlice->getLayerId() > 0 || !rpcSlice->getIdrPicFlag() )
     1614#else
    12461615    else
     1616#endif
    12471617    {
    12481618      READ_CODE(sps->getBitsForPOC(), uiCode, "pic_order_cnt_lsb");
    12491619      Int iPOClsb = uiCode;
    1250       Int iPrevPOC = rpcSlice->getPrevPOC();
     1620      Int iPrevPOC = rpcSlice->getPrevTid0POC();
    12511621      Int iMaxPOClsb = 1<< sps->getBitsForPOC();
    1252       Int iPrevPOClsb = iPrevPOC%iMaxPOClsb;
     1622      Int iPrevPOClsb = iPrevPOC & (iMaxPOClsb - 1);
    12531623      Int iPrevPOCmsb = iPrevPOC-iPrevPOClsb;
    12541624      Int iPOCmsb;
     
    12741644      rpcSlice->setPOC              (iPOCmsb+iPOClsb);
    12751645
     1646#if N0065_LAYER_POC_ALIGNMENT
     1647      if( !rpcSlice->getIdrPicFlag() )
     1648      {
     1649#endif
    12761650      TComReferencePictureSet* rps;
    12771651      rps = rpcSlice->getLocalRPS();
     
    13721746            rps->setDeltaPOC(j, - rpcSlice->getPOC() + pocLsbLt);
    13731747            rps->setCheckLTMSBPresent(j,false);
     1748           
     1749            // reset deltaPocMSBCycleLT for first LTRP from slice header if MSB not present
     1750            if( j == offset+(numOfLtrp-numLtrpInSPS)-1 )
     1751            {
     1752              deltaPocMSBCycleLT = 0;
     1753            }
    13741754          }
    13751755          prevDeltaMSB = deltaPocMSBCycleLT;
     
    13991779        rpcSlice->setEnableTMVPFlag(false);
    14001780      }
    1401     }
    1402 
    1403 #if REF_IDX_FRAMEWORK
     1781#if N0065_LAYER_POC_ALIGNMENT
     1782    }
     1783#endif
     1784    }
     1785
     1786#if SVC_EXTENSION
    14041787#if JCTVC_M0458_INTERLAYER_RPS_SIG
    14051788    rpcSlice->setActiveNumILRRefIdx(0);
     
    16242007    if ( rpcSlice->getEnableTMVPFlag() )
    16252008    {
    1626 #if REF_IDX_FRAMEWORK && M0457_COL_PICTURE_SIGNALING
     2009#if M0457_COL_PICTURE_SIGNALING
    16272010#if REMOVE_COL_PICTURE_SIGNALING
    16282011      rpcSlice->setMFMEnabledFlag( rpcSlice->getNumMotionPredRefLayers() > 0 ? true : false );
     
    16672050        rpcSlice->setColRefIdx(0);
    16682051      }
    1669 #if REF_IDX_FRAMEWORK && M0457_COL_PICTURE_SIGNALING && !REMOVE_COL_PICTURE_SIGNALING
     2052#if M0457_COL_PICTURE_SIGNALING && !REMOVE_COL_PICTURE_SIGNALING
    16702053      }
    16712054#endif
     
    16852068    rpcSlice->setSliceQp (26 + pps->getPicInitQPMinus26() + iCode);
    16862069
     2070#if REPN_FORMAT_IN_VPS
     2071    assert( rpcSlice->getSliceQp() >= -rpcSlice->getQpBDOffsetY() );
     2072#else
    16872073    assert( rpcSlice->getSliceQp() >= -sps->getQpBDOffsetY() );
     2074#endif
    16882075    assert( rpcSlice->getSliceQp() <=  51 );
    16892076
     
    20162403  xReadSvlc( iDQp );
    20172404
     2405#if REPN_FORMAT_IN_VPS
     2406  Int qpBdOffsetY = pcCU->getSlice()->getQpBDOffsetY();
     2407#else
    20182408  Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffsetY();
     2409#endif
    20192410  qp = (((Int) pcCU->getRefQP( uiAbsPartIdx ) + iDQp + 52 + 2*qpBdOffsetY )%(52+ qpBdOffsetY)) -  qpBdOffsetY;
    20202411
     
    21862577  UInt  code, sizeId, listId;
    21872578  Bool scalingListPredModeFlag;
     2579
    21882580  //for each size
    21892581  for(sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++)
     
    21912583    for(listId = 0; listId <  g_scalingListNum[sizeId]; listId++)
    21922584    {
     2585#if IL_SL_SIGNALLING_N0371
     2586      if ( scalingList->getLayerId() > 0 && scalingList->getPredScalingListFlag() )
     2587      {
     2588        READ_FLAG( code, "scaling_list_pred_mode_flag");
     2589        scalingListPredModeFlag = (code) ? true : false;
     2590        if(!scalingListPredModeFlag) //Copy Mode
     2591        {
     2592          READ_UVLC( code, "scaling_list_pred_matrix_id_delta");
     2593          scalingList->setRefMatrixId (sizeId,listId,(UInt)((Int)(listId)-(code)));
     2594          if( sizeId > SCALING_LIST_8x8 )
     2595          {
     2596            scalingList->setScalingListDC(sizeId,listId,((listId == scalingList->getRefMatrixId (sizeId,listId))? 16 :scalingList->getScalingListDC(sizeId, scalingList->getRefMatrixId (sizeId,listId))));
     2597          }
     2598          scalingList->processRefMatrix( sizeId, listId, scalingList->getRefMatrixId (sizeId,listId));
     2599
     2600        }
     2601        else //DPCM Mode
     2602        {
     2603          xDecodeScalingList(scalingList, sizeId, listId);
     2604        }
     2605      }
     2606      else
     2607      {
     2608        READ_FLAG( code, "scaling_list_pred_mode_flag");
     2609        scalingListPredModeFlag = (code) ? true : false;
     2610        if(!scalingListPredModeFlag) //Copy Mode
     2611        {
     2612          READ_UVLC( code, "scaling_list_pred_matrix_id_delta");
     2613          scalingList->setRefMatrixId (sizeId,listId,(UInt)((Int)(listId)-(code)));
     2614          if( sizeId > SCALING_LIST_8x8 )
     2615          {
     2616            scalingList->setScalingListDC(sizeId,listId,((listId == scalingList->getRefMatrixId (sizeId,listId))? 16 :scalingList->getScalingListDC(sizeId, scalingList->getRefMatrixId (sizeId,listId))));
     2617          }
     2618          scalingList->processRefMatrix( sizeId, listId, scalingList->getRefMatrixId (sizeId,listId));
     2619
     2620        }
     2621        else //DPCM Mode
     2622        {
     2623          xDecodeScalingList(scalingList, sizeId, listId);
     2624        }
     2625      }
     2626#else
    21932627      READ_FLAG( code, "scaling_list_pred_mode_flag");
    21942628      scalingListPredModeFlag = (code) ? true : false;
     
    22082642        xDecodeScalingList(scalingList, sizeId, listId);
    22092643      }
     2644#endif
    22102645    }
    22112646  }
     
    22292664  if( sizeId > SCALING_LIST_8x8 )
    22302665  {
     2666#if IL_SL_SIGNALLING_N0371
     2667    if( scalingList->getLayerId() > 0 && scalingList->getPredScalingListFlag() )
     2668    {
     2669      ref_scalingListDC[scalingList->getLayerId()][sizeId][listId] = scalingList->getScalingListDC(sizeId,listId);
     2670      scalingList->setScalingListDC(sizeId,listId,ref_scalingListDC[scalingList->getScalingListRefLayerId()][sizeId][listId]);
     2671    }
     2672    else
     2673    {
     2674      READ_SVLC( scalingListDcCoefMinus8, "scaling_list_dc_coef_minus8");
     2675      scalingList->setScalingListDC(sizeId,listId,scalingListDcCoefMinus8 + 8);
     2676      nextCoef = scalingList->getScalingListDC(sizeId,listId);
     2677      ref_scalingListDC[scalingList->getLayerId()][sizeId][listId] = scalingList->getScalingListDC(sizeId,listId);
     2678    }
     2679#else
    22312680    READ_SVLC( scalingListDcCoefMinus8, "scaling_list_dc_coef_minus8");
    22322681    scalingList->setScalingListDC(sizeId,listId,scalingListDcCoefMinus8 + 8);
    22332682    nextCoef = scalingList->getScalingListDC(sizeId,listId);
     2683#endif
    22342684  }
    22352685
    22362686  for(i = 0; i < coefNum; i++)
    22372687  {
     2688#if IL_SL_SIGNALLING_N0371
     2689    if( scalingList->getLayerId() > 0 && scalingList->getPredScalingListFlag() )
     2690    {
     2691      ref_scalingListCoef[scalingList->getLayerId()][sizeId][listId][i] = dst[scan[i]];
     2692      dst[scan[i]] = ref_scalingListCoef[scalingList->getScalingListRefLayerId()][sizeId][listId][i];
     2693    }
     2694    else
     2695    {
     2696      READ_SVLC( data, "scaling_list_delta_coef");
     2697      nextCoef = (nextCoef + data + 256 ) % 256;
     2698      dst[scan[i]] = nextCoef;
     2699      ref_scalingListCoef[scalingList->getLayerId()][sizeId][listId][i] = dst[scan[i]];
     2700    }
     2701#else
    22382702    READ_SVLC( data, "scaling_list_delta_coef");
    22392703    nextCoef = (nextCoef + data + 256 ) % 256;
    22402704    dst[scan[i]] = nextCoef;
     2705#endif
    22412706  }
    22422707}
  • trunk/source/Lib/TLibDecoder/TDecCAVLC.h

    r345 r442  
    7575  Void  parseVPSExtension   ( TComVPS* pcVPS );
    7676#endif
     77
     78#if VPS_VUI
     79  Void  parseVPSVUI   ( TComVPS* pcVPS );
     80#endif
     81#if REPN_FORMAT_IN_VPS
     82  Void  parseRepFormat      ( RepFormat *repFormat );
     83#endif
    7784#if SPS_SUB_LAYER_INFO
    7885  Void  parseSPS            ( TComSPS* pcSPS, ParameterSetManagerDecoder *parameterSetManager );
  • trunk/source/Lib/TLibDecoder/TDecCu.cpp

    r345 r442  
    177177  TComSlice * pcSlice = pcPic->getSlice(pcPic->getCurrSliceIdx());
    178178  UInt uiCurNumParts    = pcPic->getNumPartInCU() >> (uiDepth<<1);
     179#if REPN_FORMAT_IN_VPS
     180  UInt uiWidth  = pcSlice->getPicWidthInLumaSamples();
     181  UInt uiHeight = pcSlice->getPicHeightInLumaSamples();
     182#else
    179183  UInt uiWidth = pcSlice->getSPS()->getPicWidthInLumaSamples();
    180184  UInt uiHeight = pcSlice->getSPS()->getPicHeightInLumaSamples();
     185#endif
    181186  UInt uiGranularityWidth = g_uiMaxCUWidth;
    182187  UInt uiPosX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ];
     
    230235  TComSlice * pcSlice = pcCU->getPic()->getSlice(pcCU->getPic()->getCurrSliceIdx());
    231236  Bool bStartInCU = pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts>pcSlice->getSliceSegmentCurStartCUAddr()&&pcCU->getSCUAddr()+uiAbsPartIdx<pcSlice->getSliceSegmentCurStartCUAddr();
     237#if REPN_FORMAT_IN_VPS
     238  if((!bStartInCU) && ( uiRPelX < pcSlice->getPicWidthInLumaSamples()           ) && ( uiBPelY < pcSlice->getPicHeightInLumaSamples()           ) )
     239#else
    232240  if((!bStartInCU) && ( uiRPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiBPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
     241#endif
    233242  {
    234243    m_pcEntropyDecoder->decodeSplitFlag( pcCU, uiAbsPartIdx, uiDepth );
     
    256265      if ( bSubInSlice )
    257266      {
     267#if REPN_FORMAT_IN_VPS
     268        if ( !ruiIsLast && ( uiLPelX < pcCU->getSlice()->getPicWidthInLumaSamples()           ) && ( uiTPelY < pcCU->getSlice()->getPicHeightInLumaSamples()           ) )
     269#else
    258270        if ( !ruiIsLast && ( uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ) )
     271#endif
    259272        {
    260273          xDecodeCU( pcCU, uiIdx, uiDepth+1, ruiIsLast );
     
    385398  TComSlice * pcSlice = pcCU->getPic()->getSlice(pcCU->getPic()->getCurrSliceIdx());
    386399  Bool bStartInCU = pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts>pcSlice->getSliceSegmentCurStartCUAddr()&&pcCU->getSCUAddr()+uiAbsPartIdx<pcSlice->getSliceSegmentCurStartCUAddr();
     400#if REPN_FORMAT_IN_VPS
     401  if(bStartInCU||( uiRPelX >= pcSlice->getPicWidthInLumaSamples()           ) || ( uiBPelY >= pcSlice->getPicHeightInLumaSamples()           ) )
     402#else
    387403  if(bStartInCU||( uiRPelX >= pcSlice->getSPS()->getPicWidthInLumaSamples() ) || ( uiBPelY >= pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
     404#endif
    388405  {
    389406    bBoundary = true;
     
    401418     
    402419      Bool binSlice = (pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->getSliceSegmentCurStartCUAddr())&&(pcCU->getSCUAddr()+uiIdx<pcSlice->getSliceSegmentCurEndCUAddr());
     420#if REPN_FORMAT_IN_VPS
     421      if(binSlice&&( uiLPelX < pcSlice->getPicWidthInLumaSamples()           ) && ( uiTPelY < pcSlice->getPicHeightInLumaSamples()           ) )
     422#else
    403423      if(binSlice&&( uiLPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
     424#endif
    404425      {
    405426        xDecompressCU(pcCU, uiIdx, uiNextDepth );
     
    494515 
    495516  //===== inverse transform =====
     517#if REPN_FORMAT_IN_VPS
     518  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), TEXT_LUMA, pcCU->getSlice()->getQpBDOffsetY(), 0 );
     519#else
    496520  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
     521#endif
    497522
    498523  Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)TEXT_LUMA];
     
    733758  pResi = m_ppcYuvResi[uiDepth]->getLumaAddr();
    734759
     760#if REPN_FORMAT_IN_VPS
     761  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_LUMA, pcCU->getSlice()->getQpBDOffsetY(), 0 );
     762#else
    735763  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
     764#endif
    736765
    737766  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pResi, 0, m_ppcYuvResi[uiDepth]->getStride(), uiWidth, uiHeight, trMode, 0, piCoeff );
  • trunk/source/Lib/TLibDecoder/TDecGop.cpp

    r313 r442  
    247247    for (Int iRefIndex = 0; iRefIndex < pcSlice->getNumRefIdx(RefPicList(iRefList)); iRefIndex++)
    248248    {
    249 #if REF_IDX_FRAMEWORK && VPS_EXTN_DIRECT_REF_LAYERS
     249#if SVC_EXTENSION
     250#if VPS_EXTN_DIRECT_REF_LAYERS
    250251      if( pcSlice->getRefPic(RefPicList(iRefList), iRefIndex)->isILR( m_layerId ) )
    251252      {
    252         printf( "%d(%d) ", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex), pcSlice->getRefPic(RefPicList(iRefList), iRefIndex)->getLayerId() );
     253        printf( "%d(%d)", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex), pcSlice->getRefPic(RefPicList(iRefList), iRefIndex)->getLayerId() );
    253254      }
    254255      else
    255 #endif
     256      {
     257        printf ("%d", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex));
     258      }
     259#endif
     260      if( pcSlice->getEnableTMVPFlag() && iRefList == 1 - pcSlice->getColFromL0Flag() && iRefIndex == pcSlice->getColRefIdx() )
     261      {
     262        printf( "c" );
     263      }
     264
     265      printf( " " );
     266#else
    256267      printf ("%d ", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex));
     268#endif
    257269    }
    258270    printf ("] ");
  • trunk/source/Lib/TLibDecoder/TDecSbac.cpp

    r345 r442  
    860860  {
    861861    UInt uiSign;
     862#if REPN_FORMAT_IN_VPS
     863    Int qpBdOffsetY = pcCU->getSlice()->getQpBDOffsetY();
     864#else
    862865    Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffsetY();
     866#endif
    863867    m_pcTDecBinIf->decodeBinEP(uiSign);
    864868    iDQp = uiDQp;
  • trunk/source/Lib/TLibDecoder/TDecSlice.h

    r313 r442  
    6565  TDecEntropy*    m_pcEntropyDecoder;
    6666  TDecCu*         m_pcCuDecoder;
    67   UInt            m_uiCurrSliceIdx;
    6867
    6968  TDecSbac*       m_pcBufferSbacDecoders;   ///< line to store temporary contexts, one per column of tiles.
  • trunk/source/Lib/TLibDecoder/TDecTop.cpp

    r345 r442  
    5757  g_nSymbolCounter = 0;
    5858#endif
     59  m_associatedIRAPType = NAL_UNIT_INVALID;
    5960  m_pocCRA = 0;
    60   m_prevRAPisBLA = false;
    6161  m_pocRandomAccess = MAX_INT;         
    6262#if !SVC_EXTENSION
     
    7272  m_pBLReconFile = NULL;
    7373#endif
    74 #endif
    75 #if REF_IDX_FRAMEWORK
    7674  memset(m_cIlpPic, 0, sizeof(m_cIlpPic));
    7775#endif
     
    7977  m_pBLSyntaxFile = NULL;
    8078#endif
    81 
     79  m_prevSliceSkipped = false;
     80  m_skippedPOC = 0;
    8281}
    8382
     
    108107 
    109108  m_cSliceDecoder.destroy();
    110 #if REF_IDX_FRAMEWORK
     109#if SVC_EXTENSION
    111110  for(Int i=0; i<MAX_NUM_REF; i++)
    112111  {
     
    137136}
    138137
    139 #if REF_IDX_FRAMEWORK
     138#if SVC_EXTENSION
     139#if !REPN_FORMAT_IN_VPS
    140140Void TDecTop::xInitILRP(TComSPS *pcSPS)
    141 {
     141#else
     142Void TDecTop::xInitILRP(TComSlice *slice)
     143#endif
     144{
     145#if REPN_FORMAT_IN_VPS
     146  TComSPS* pcSPS = slice->getSPS();
     147  Int bitDepthY   = slice->getBitDepthY();
     148  Int bitDepthC   = slice->getBitDepthC();
     149  Int picWidth    = slice->getPicWidthInLumaSamples();
     150  Int picHeight   = slice->getPicHeightInLumaSamples();
     151#endif
    142152  if(m_layerId>0)
    143153  {
     154#if REPN_FORMAT_IN_VPS
     155    g_bitDepthY     = bitDepthY;
     156    g_bitDepthC     = bitDepthC;
     157#else
    144158    g_bitDepthY     = pcSPS->getBitDepthY();
    145159    g_bitDepthC     = pcSPS->getBitDepthC();
     160#endif
    146161    g_uiMaxCUWidth  = pcSPS->getMaxCUWidth();
    147162    g_uiMaxCUHeight = pcSPS->getMaxCUHeight();
     
    164179
    165180        m_cIlpPic[j] = new  TComPic;
     181#if REPN_FORMAT_IN_VPS
     182#if SVC_UPSAMPLING
     183        m_cIlpPic[j]->create(picWidth, picHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, pcSPS, true);
     184#else
     185        m_cIlpPic[j]->create(picWidth, picHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, true);
     186#endif
     187#else
    166188#if SVC_UPSAMPLING
    167189        m_cIlpPic[j]->create(pcSPS->getPicWidthInLumaSamples(), pcSPS->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, pcSPS, true);
    168190#else
    169191        m_cIlpPic[j]->create(pcSPS->getPicWidthInLumaSamples(), pcSPS->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, true);
     192#endif
    170193#endif
    171194        for (Int i=0; i<m_cIlpPic[j]->getPicSym()->getNumberOfCUsInFrame(); i++)
     
    177200  }
    178201}
     202
     203
    179204
    180205Void TDecTop::setILRPic(TComPic *pcPic)
     
    191216      m_cIlpPic[refLayerIdc]->getPicYuvRec()->setBorderExtension(false);
    192217      m_cIlpPic[refLayerIdc]->getPicYuvRec()->extendPicBorder();
     218      for (Int j=0; j<m_cIlpPic[refLayerIdc]->getPicSym()->getNumberOfCUsInFrame(); j++)  // set reference CU layerId
     219      {
     220        m_cIlpPic[refLayerIdc]->getPicSym()->getCU(j)->setLayerId(m_cIlpPic[refLayerIdc]->getLayerId());
     221      }
    193222    }
    194223  }
     
    266295        //TComPic*                      pcPic = *(pcTDecTopBase->getListPic()->begin());
    267296        TComPicYuv* pcPicYuvRecBase = (*(pcTDecTopBase->getListPic()->begin()))->getPicYuvRec();
     297#if REPN_FORMAT_IN_VPS
     298        if(pcPicYuvRecBase->getWidth() != pcSlice->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getPicHeightInLumaSamples() || !zeroOffsets )
     299#else
    268300        if(pcPicYuvRecBase->getWidth() != pcSlice->getSPS()->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getSPS()->getPicHeightInLumaSamples() || !zeroOffsets )
     301#endif
    269302        {
    270303          rpcPic->setSpatialEnhLayerFlag( i, true );
    271304
    272305          //only for scalable extension
     306#if SCALABILITY_MASK_E0104
     307          assert( pcSlice->getVPS()->getScalabilityMask(2) == true );
     308#else
    273309          assert( pcSlice->getVPS()->getScalabilityMask(1) == true );
     310#endif
    274311        }
    275312#if MAX_ONE_RESAMPLING_DIRECT_LAYERS
     313#if SCALABILITY_MASK_E0104
     314        if(pcSlice->getVPS()->getScalabilityMask(2))
     315#else
    276316        if(pcSlice->getVPS()->getScalabilityMask(1))
     317#endif
    277318        {
    278319          pcSlice->setPic(rpcPic);
     
    283324#endif
    284325   
     326#if REPN_FORMAT_IN_VPS
     327#if SVC_UPSAMPLING
     328    rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
     329                     conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true);
     330#else
     331    rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
     332                     conformanceWindow, defaultDisplayWindow, numReorderPics, true);
     333#endif
     334#else
    285335#if SVC_UPSAMPLING
    286336    rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
     
    290340                     conformanceWindow, defaultDisplayWindow, numReorderPics, true);
    291341#endif
     342#endif
     343
    292344    rpcPic->getPicSym()->allocSaoParam(&m_cSAO);
    293345    m_cListPic.pushBack( rpcPic );
     
    329381  rpcPic->destroy();
    330382
     383#if REPN_FORMAT_IN_VPS
     384#if SVC_UPSAMPLING
     385  rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
     386                   conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true);
     387
     388#else
     389  rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
     390                   conformanceWindow, defaultDisplayWindow, numReorderPics, true);
     391#endif
     392#else
    331393#if SVC_UPSAMPLING
    332394  rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
     
    336398  rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
    337399                   conformanceWindow, defaultDisplayWindow, numReorderPics, true);
     400#endif
    338401#endif
    339402  rpcPic->getPicSym()->allocSaoParam(&m_cSAO);
     
    366429}
    367430
     431#if EARLY_REF_PIC_MARKING
     432Void TDecTop::earlyPicMarking(Int maxTemporalLayer, std::vector<Int>& targetDecLayerIdSet)
     433{
     434  UInt currTid = m_pcPic->getTLayer();
     435  UInt highestTid = (maxTemporalLayer >= 0) ? maxTemporalLayer : (m_pcPic->getSlice(0)->getSPS()->getMaxTLayers() - 1);
     436  UInt latestDecLayerId = m_layerId;
     437  UInt numTargetDecLayers = 0;
     438  Int targetDecLayerIdList[MAX_LAYERS];
     439  UInt latestDecIdx = 0;
     440  TComSlice* pcSlice = m_pcPic->getSlice(0);
     441
     442  if ( currTid != highestTid )  // Marking  process is only applicaple for highest decoded TLayer
     443  {
     444    return;
     445  }
     446
     447  // currPic must be marked as "used for reference" and must be a sub-layer non-reference picture
     448  if ( !((pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_N  ||
     449          pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N    ||
     450          pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N   ||
     451          pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N   ||
     452          pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N   ||
     453          pcSlice->getNalUnitType() == NAL_UNIT_RESERVED_VCL_N10     ||
     454          pcSlice->getNalUnitType() == NAL_UNIT_RESERVED_VCL_N12     ||
     455          pcSlice->getNalUnitType() == NAL_UNIT_RESERVED_VCL_N14) && pcSlice->isReferenced()))
     456  {
     457    return;
     458  }
     459
     460  if ( targetDecLayerIdSet.size() == 0 ) // Cannot mark if we don't know the number of scalable layers
     461  {
     462    return;
     463  }
     464
     465  for (std::vector<Int>::iterator it = targetDecLayerIdSet.begin(); it != targetDecLayerIdSet.end(); it++)
     466  {
     467    if ( latestDecLayerId == (*it) )
     468    {
     469      latestDecIdx = numTargetDecLayers;
     470    }
     471    targetDecLayerIdList[numTargetDecLayers++] = (*it);
     472  }
     473
     474  Int remainingInterLayerReferencesFlag = 0;
     475  if ( currTid <= pcSlice->getVPS()->getMaxTidIlRefPicsPlus1(latestDecLayerId) - 1 )
     476  {
     477    for ( Int j = latestDecIdx + 1; j < numTargetDecLayers; j++ )
     478    {
     479      for ( Int k = 0; k < m_ppcTDecTop[targetDecLayerIdList[j]]->getNumDirectRefLayers(); k++ )
     480      {
     481        if ( latestDecIdx == m_ppcTDecTop[targetDecLayerIdList[j]]->getRefLayerId(k) )
     482        {
     483          remainingInterLayerReferencesFlag = 1;
     484        }
     485      }
     486    }
     487  }
     488
     489  if ( remainingInterLayerReferencesFlag == 0 )
     490  {
     491    pcSlice->setReferenced(false);
     492  }
     493}
     494#endif
     495
    368496Void TDecTop::xCreateLostPicture(Int iLostPoc)
    369497{
     
    478606  m_apcSlicePilot->setSPS(sps);
    479607  pps->setSPS(sps);
     608#if REPN_FORMAT_IN_VPS
    480609  pps->setNumSubstreams(pps->getEntropyCodingSyncEnabledFlag() ? ((sps->getPicHeightInLumaSamples() + sps->getMaxCUHeight() - 1) / sps->getMaxCUHeight()) * (pps->getNumColumnsMinus1() + 1) : 1);
     610#else
     611  pps->setNumSubstreams(pps->getEntropyCodingSyncEnabledFlag() ? ((sps->getPicHeightInLumaSamples() + sps->getMaxCUHeight() - 1) / sps->getMaxCUHeight()) * (pps->getNumColumnsMinus1() + 1) : 1);
     612#endif
    481613  pps->setMinCuDQPSize( sps->getMaxCUWidth() >> ( pps->getMaxCuDQPDepth()) );
    482614
     615#if REPN_FORMAT_IN_VPS
     616  g_bitDepthY     = m_apcSlicePilot->getBitDepthY();
     617  g_bitDepthC     = m_apcSlicePilot->getBitDepthC();
     618#else
    483619  g_bitDepthY     = sps->getBitDepthY();
    484620  g_bitDepthC     = sps->getBitDepthC();
     621#endif
    485622  g_uiMaxCUWidth  = sps->getMaxCUWidth();
    486623  g_uiMaxCUHeight = sps->getMaxCUHeight();
     
    499636
    500637  m_cSAO.destroy();
     638#if REPN_FORMAT_IN_VPS
     639  m_cSAO.create( m_apcSlicePilot->getPicWidthInLumaSamples(), m_apcSlicePilot->getPicHeightInLumaSamples(), sps->getMaxCUWidth(), sps->getMaxCUHeight() );
     640#else
    501641  m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getMaxCUWidth(), sps->getMaxCUHeight() );
     642#endif
    502643  m_cLoopFilter.create( sps->getMaxCUDepth() );
    503644}
    504645
    505646#if SVC_EXTENSION
     647#if POC_RESET_FLAG
     648Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int &iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC )
     649#else
    506650Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC )
     651#endif
    507652#else
    508653Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay )
     
    538683  m_apcSlicePilot->setTLayerInfo(nalu.m_temporalId);
    539684
     685#if SVC_EXTENSION
    540686#if VPS_EXTN_DIRECT_REF_LAYERS && M0457_PREDICTION_INDICATIONS
    541687  setRefLayerParams(m_apcSlicePilot->getVPS());
    542688#endif
    543 #if REF_IDX_FRAMEWORK && M0457_COL_PICTURE_SIGNALING
     689#if M0457_COL_PICTURE_SIGNALING
    544690  m_apcSlicePilot->setNumMotionPredRefLayers(m_numMotionPredRefLayers);
    545691#endif
    546 
    547 #if SVC_EXTENSION
    548692#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
    549693  m_apcSlicePilot->setNumSamplePredRefLayers( getNumSamplePredRefLayers() );
     
    554698#endif
    555699
     700  // set POC for dependent slices in skipped pictures
     701  if(m_apcSlicePilot->getDependentSliceSegmentFlag() && m_prevSliceSkipped)
     702  {
     703    m_apcSlicePilot->setPOC(m_skippedPOC);
     704  }
     705
     706  m_apcSlicePilot->setAssociatedIRAPPOC(m_pocCRA);
     707  m_apcSlicePilot->setAssociatedIRAPType(m_associatedIRAPType);
     708
    556709  // Skip pictures due to random access
    557710  if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay))
    558711  {
     712    m_prevSliceSkipped = true;
     713    m_skippedPOC = m_apcSlicePilot->getPOC();
    559714    return false;
    560715  }
     
    562717  if (isSkipPictureForBLA(iPOCLastDisplay))
    563718  {
     719    m_prevSliceSkipped = true;
     720    m_skippedPOC = m_apcSlicePilot->getPOC();
    564721    return false;
    565722  }
     723
     724  // clear previous slice skipped flag
     725  m_prevSliceSkipped = false;
    566726
    567727  // exit when a new picture is found
     
    594754  // actual decoding starts here
    595755  xActivateParameterSets();
    596 
     756#if 0 // N0147_IRAP_ALIGN_FLAG Disabled for now!
     757  //When cross_layer_irap_aligned_flag is equal to 0, num_extra_slice_header_bits >=1
     758  if(!m_apcSlicePilot->getVPS()->getCrossLayerIrapAlignFlag() )
     759  {
     760    assert( m_apcSlicePilot->getPPS()->getNumExtraSliceHeaderBits() > 0);
     761  }
     762  //When cross_layer_irap_aligned_flag is equal to 1, the value of poc_reset_flag shall be equal to 0 
     763  if( m_apcSlicePilot->getVPS()->getCrossLayerIrapAlignFlag() )
     764  {
     765    assert( m_apcSlicePilot->getPocResetFlag() == 0);
     766  }
     767#endif
     768
     769#if REPN_FORMAT_IN_VPS
     770  // Initialize ILRP if needed, only for the current layer 
     771  // ILRP intialization should go along with activation of parameters sets,
     772  // although activation of parameter sets itself need not be done for each and every slice!!!
     773  xInitILRP(m_apcSlicePilot);
     774#endif
    597775  if (m_apcSlicePilot->isNextSlice())
    598776  {
     
    604782  }
    605783  m_bFirstSliceInSequence = false;
     784#if POC_RESET_FLAG
     785  // This operation would do the following:
     786  // 1. Update the other picture in the DPB. This should be done only for the first slice of the picture.
     787  // 2. Update the value of m_pocCRA.
     788  // 3. Reset the POC values at the decoder for the current picture to be zero.
     789  // 4. update value of POCLastDisplay
     790  if( m_apcSlicePilot->getPocResetFlag() )
     791  {
     792    if( m_apcSlicePilot->getSliceIdx() == 0 )
     793    {
     794      Int pocAdjustValue = m_apcSlicePilot->getPOC();
     795
     796      // If poc reset flag is set to 1, reset all POC for DPB -> basically do it for each slice in the picutre
     797      TComList<TComPic*>::iterator  iterPic = m_cListPic.begin(); 
     798
     799      // Iterate through all picture in DPB
     800      while( iterPic != m_cListPic.end() )
     801      {
     802        TComPic *dpbPic = *iterPic;
     803        // Check if the picture pointed to by iterPic is either used for reference or
     804        // needed for output, are in the same layer, and not the current picture.
     805        if( /*  ( ( dpbPic->getSlice(0)->isReferenced() ) || ( dpbPic->getOutputMark() ) )
     806            &&*/ ( dpbPic->getLayerId() == m_apcSlicePilot->getLayerId() )
     807              && ( dpbPic->getReconMark() )
     808          )
     809        {
     810          for(Int i = dpbPic->getNumAllocatedSlice()-1; i >= 0; i--)
     811          {
     812
     813            TComSlice *slice = dpbPic->getSlice(i);
     814            TComReferencePictureSet *rps = slice->getRPS();
     815            slice->setPOC( slice->getPOC() - pocAdjustValue );
     816
     817            // Also adjust the POC value stored in the RPS of each such slice
     818            for(Int j = rps->getNumberOfPictures(); j >= 0; j--)
     819            {
     820              rps->setPOC( j, rps->getPOC(j) - pocAdjustValue );
     821            }
     822            // Also adjust the value of refPOC
     823            for(Int k = 0; k < 2; k++)  // For List 0 and List 1
     824            {
     825              RefPicList list = (k == 1) ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
     826              for(Int j = 0; j < slice->getNumRefIdx(list); j++)
     827              {
     828                slice->setRefPOC( slice->getRefPOC(list, j) - pocAdjustValue, list, j);
     829              }
     830            }
     831          }
     832        }
     833        iterPic++;
     834      }
     835      // Update the value of pocCRA
     836      m_pocCRA -= pocAdjustValue;
     837      // Update value of POCLastDisplay
     838      iPOCLastDisplay -= pocAdjustValue;
     839    }
     840    // Reset current poc for current slice and RPS
     841    m_apcSlicePilot->setPOC( 0 );
     842  }
     843#endif
     844#if ALIGN_TSA_STSA_PICS
     845  if( m_apcSlicePilot->getLayerId() > 0 )
     846  {
     847    // Check for TSA alignment
     848    if( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N ||
     849        m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TLA_R
     850         )
     851    {
     852      for(Int dependentLayerIdx = 0; dependentLayerIdx < m_apcSlicePilot->getVPS()->getNumDirectRefLayers(m_layerId); dependentLayerIdx++)
     853      {
     854        TComList<TComPic*> *cListPic = getRefLayerDec( dependentLayerIdx )->getListPic();
     855        TComPic* refpicLayer = m_apcSlicePilot->getRefPic(*cListPic, m_apcSlicePilot->getPOC() );
     856        if( refpicLayer )
     857        {
     858          assert( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N ||
     859                    m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TLA_R );    // TSA pictures should be aligned among depenedent layers
     860        }
     861      }
     862    }
     863    // Check for STSA alignment
     864    if( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N ||
     865         m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_R
     866         )
     867    {
     868      for(Int dependentLayerIdx = 0; dependentLayerIdx < m_apcSlicePilot->getVPS()->getNumDirectRefLayers(m_layerId); dependentLayerIdx++)
     869      {
     870        TComList<TComPic*> *cListPic = getRefLayerDec( dependentLayerIdx )->getListPic();
     871        TComPic* refpicLayer = m_apcSlicePilot->getRefPic(*cListPic, m_apcSlicePilot->getPOC() ); // STSA pictures should be aligned among dependent layers
     872        if( refpicLayer )
     873
     874        {
     875          assert( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N ||
     876                    m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_R );
     877        }
     878      }
     879    }
     880  }
     881#endif
    606882  //detect lost reference picture and insert copy of earlier frame.
    607883  Int lostPoc;
     
    617893      TComPic* pBLPic = (*m_ppcTDecTop[0]->getListPic()->begin());
    618894      fstream* pFile  = m_ppcTDecTop[0]->getBLReconFile();
    619 #if ILP_DECODED_PICTURE
    620895      UInt uiWidth    = pBLPic->getPicYuvRec()->getWidth();
    621896      UInt uiHeight   = pBLPic->getPicYuvRec()->getHeight();
    622 #else
    623       const Window &conf = pBLPic->getConformanceWindow();
    624       UInt uiWidth    = pBLPic->getPicYuvRec()->getWidth() - conf.getWindowLeftOffset() - conf.getWindowRightOffset();
    625       UInt uiHeight   = pBLPic->getPicYuvRec()->getHeight() - conf.getWindowTopOffset() - conf.getWindowBottomOffset();
    626 #endif
    627897
    628898      if( pFile->good() )
     
    674944    xGetNewPicBuffer (m_apcSlicePilot, pcPic);
    675945
     946    Bool isField = false;
     947    Bool isTff = false;
     948   
     949    if(!m_SEIs.empty())
     950    {
     951      // Check if any new Picture Timing SEI has arrived
     952      SEIMessages pictureTimingSEIs = extractSeisByType (m_SEIs, SEI::PICTURE_TIMING);
     953      if (pictureTimingSEIs.size()>0)
     954      {
     955        SEIPictureTiming* pictureTiming = (SEIPictureTiming*) *(pictureTimingSEIs.begin());
     956        isField = (pictureTiming->m_picStruct == 1) || (pictureTiming->m_picStruct == 2);
     957        isTff =  (pictureTiming->m_picStruct == 1);
     958      }
     959    }
     960   
     961    //Set Field/Frame coding mode
     962    m_pcPic->setField(isField);
     963    m_pcPic->setTopField(isTff);
     964
    676965    // transfer any SEI messages that have been received to the picture
    677966    pcPic->setSEIs(m_SEIs);
     
    8131102  if (bNextSlice)
    8141103  {
    815     pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_prevRAPisBLA, m_cListPic );
     1104    pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_associatedIRAPType, m_cListPic );
    8161105    // Set reference list
    817 #if REF_IDX_FRAMEWORK
     1106#if SVC_EXTENSION
    8181107    if (m_layerId == 0)
    8191108#endif
     
    8671156#endif
    8681157
    869 #if SIMPLIFIED_MV_POS_SCALING
    8701158#if SCALED_REF_LAYER_OFFSETS
    8711159        const Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc);
     
    8911179        g_posScalingFactor[refLayerIdc][0] = ((widthBL  << 16) + (widthEL  >> 1)) / widthEL;
    8921180        g_posScalingFactor[refLayerIdc][1] = ((heightBL << 16) + (heightEL >> 1)) / heightEL;
    893 #endif
    8941181
    8951182#if SVC_UPSAMPLING
     
    9111198    }
    9121199
    913 #if REF_IDX_FRAMEWORK
    9141200    if( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() )
    9151201    {
     
    9271213#endif
    9281214      }
    929 #endif
    9301215      pcSlice->setRefPicList( m_cListPic, false, m_cIlpPic);
    9311216    }
     
    9401225#endif //SVC_EXTENSION
    9411226
     1227#if N0147_IRAP_ALIGN_FLAG
     1228    if(  m_layerId > 0 && pcSlice->getVPS()->getCrossLayerIrapAlignFlag())
     1229    {
     1230      for(Int dependentLayerIdx = 0; dependentLayerIdx < pcSlice->getVPS()->getNumDirectRefLayers(m_layerId); dependentLayerIdx++)
     1231      {
     1232        TComList<TComPic*> *cListPic = getRefLayerDec( dependentLayerIdx )->getListPic();
     1233        TComPic* refpicLayer = pcSlice->getRefPic(*cListPic, pcSlice->getPOC() );
     1234        if(refpicLayer && pcSlice->isIRAP())
     1235        {                 
     1236          assert(pcSlice->getNalUnitType() == refpicLayer->getSlice(0)->getNalUnitType());
     1237        }
     1238      }
     1239    }
     1240#endif
     1241   
    9421242    // For generalized B
    9431243    // note: maybe not existed case (always L0 is copied to L1 if L1 is empty)
     
    9861286  if(pcSlice->getSPS()->getScalingListFlag())
    9871287  {
     1288#if IL_SL_SIGNALLING_N0371
     1289    pcSlice->getSPS()->getScalingList()->setLayerId( m_layerId );
     1290#endif
     1291
    9881292    pcSlice->setScalingList ( pcSlice->getSPS()->getScalingList()  );
     1293
    9891294    if(pcSlice->getPPS()->getScalingListPresentFlag())
    9901295    {
     1296#if IL_SL_SIGNALLING_N0371
     1297      pcSlice->getPPS()->getScalingList()->setLayerId( m_layerId );
     1298#endif
     1299
    9911300      pcSlice->setScalingList ( pcSlice->getPPS()->getScalingList()  );
    9921301    }
    993     pcSlice->getScalingList()->setUseTransformSkip(pcSlice->getPPS()->getUseTransformSkip());
    9941302    if(!pcSlice->getPPS()->getScalingListPresentFlag() && !pcSlice->getSPS()->getScalingListPresentFlag())
    9951303    {
     1304#if IL_SL_SIGNALLING_N0371
     1305      pcSlice->setDefaultScalingList( m_layerId );
     1306#else
    9961307      pcSlice->setDefaultScalingList();
     1308#endif
    9971309    }
    9981310    m_cTrQuant.setScalingListDec(pcSlice->getScalingList());
     
    10011313  else
    10021314  {
     1315#if IL_SL_SIGNALLING_N0371
     1316    m_cTrQuant.setFlatScalingList( m_layerId );
     1317#else
    10031318    m_cTrQuant.setFlatScalingList();
     1319#endif
    10041320    m_cTrQuant.setUseScalingList(false);
    10051321  }
     
    10321348  sps->setLayerId(m_layerId);
    10331349#endif
     1350
    10341351#if SPS_SUB_LAYER_INFO
    10351352  m_cEntropyDecoder.decodeSPS( sps, &m_parameterSetManagerDecoder[0] );
     
    10421359  m_parameterSetManagerDecoder.storePrefetchedSPS(sps);
    10431360#endif
    1044 #if REF_IDX_FRAMEWORK
     1361#if SVC_EXTENSION
     1362#if !REPN_FORMAT_IN_VPS   // ILRP can only be initialized at activation 
    10451363  if(m_numLayer>0)
    10461364  {
     
    10481366  }
    10491367#endif
     1368#endif
    10501369}
    10511370
     
    10531372{
    10541373  TComPPS* pps = new TComPPS();
     1374
     1375#if IL_SL_SIGNALLING_N0371
     1376  pps->setLayerId(m_layerId);
     1377#endif
     1378
    10551379  m_cEntropyDecoder.decodePPS( pps );
    10561380#if SVC_EXTENSION
     
    10791403  if(nalUnitType == NAL_UNIT_SUFFIX_SEI)
    10801404  {
     1405#if RANDOM_ACCESS_SEI_FIX
     1406    if (m_prevSliceSkipped) // No need to decode SEI messages of a skipped access unit
     1407    {
     1408      return;
     1409    }
     1410#endif
    10811411#if M0043_LAYERS_PRESENT_SEI
    10821412    m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder[m_layerId].getActiveVPS(), m_parameterSetManagerDecoder[m_layerId].getActiveSPS() );
     
    11481478  {
    11491479    case NAL_UNIT_VPS:
     1480#if VPS_NUH_LAYER_ID
     1481      assert( nalu.m_layerId == 0 ); // Non-conforming bitstream. The value of nuh_layer_id of VPS NAL unit shall be equal to 0.
     1482#endif
    11501483      xDecodeVPS();
    11511484#if AVC_BASE
     
    12471580Bool TDecTop::isSkipPictureForBLA(Int& iPOCLastDisplay)
    12481581{
    1249   if (m_prevRAPisBLA && m_apcSlicePilot->getPOC() < m_pocCRA && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N))
     1582  if ((m_associatedIRAPType == NAL_UNIT_CODED_SLICE_BLA_N_LP || m_associatedIRAPType == NAL_UNIT_CODED_SLICE_BLA_W_LP || m_associatedIRAPType == NAL_UNIT_CODED_SLICE_BLA_W_RADL) &&
     1583       m_apcSlicePilot->getPOC() < m_pocCRA && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N))
    12501584  {
    12511585    iPOCLastDisplay++;
  • trunk/source/Lib/TLibDecoder/TDecTop.h

    r345 r442  
    6767  Int                     m_iMaxRefPicNum;
    6868 
     69  NalUnitType             m_associatedIRAPType; ///< NAL unit type of the associated IRAP picture
    6970  Int                     m_pocCRA;            ///< POC number of the latest CRA picture
    70   Bool                    m_prevRAPisBLA;      ///< true if the previous RAP (CRA/CRANT/BLA/BLANT/IDR) picture is a BLA/BLANT picture
    7171  Int                     m_pocRandomAccess;   ///< POC number of the random access point (the first IDR or CRA picture)
    7272
     
    7979
    8080  TComSlice*              m_apcSlicePilot;
    81  
     81
    8282  SEIMessages             m_SEIs; ///< List of SEI messages that have been received before the first slice and between slices
    8383
     
    107107  Bool                    m_bFirstSliceInSequence;
    108108#endif
     109  Bool                    m_prevSliceSkipped;
     110  Int                     m_skippedPOC;
    109111
    110112#if SVC_EXTENSION
     
    118120  fstream*                m_pBLReconFile;
    119121  Int                     m_iBLSourceWidth;
    120   Int                     m_iBLSourceHeight;
     122  Int                     m_iBLSourceHeight; 
    121123#endif
    122124#if VPS_EXTN_DIRECT_REF_LAYERS && M0457_PREDICTION_INDICATIONS
     
    130132  Bool                    m_motionPredEnabledFlag[MAX_VPS_LAYER_ID_PLUS1];
    131133#endif
     134  TComPic*                m_cIlpPic[MAX_NUM_REF];                    ///<  Inter layer Prediction picture =  upsampled picture
    132135#endif
    133136#if AVC_SYNTAX || SYNTAX_OUTPUT
    134137  fstream*               m_pBLSyntaxFile;
    135 #endif
    136 #if REF_IDX_FRAMEWORK
    137   TComPic*                m_cIlpPic[MAX_NUM_REF];                    ///<  Inter layer Prediction picture =  upsampled picture
    138138#endif
    139139
     
    157157
    158158  Void executeLoopFilters(Int& poc, TComList<TComPic*>*& rpcListPic);
    159 
    160 #if SVC_EXTENSION
     159#if SVC_EXTENSION
     160#if EARLY_REF_PIC_MARKING
     161  Void earlyPicMarking(Int maxTemporalLayer, std::vector<Int>& targetDecLayerIdList);
     162#endif
    161163  UInt      getLayerId            () { return m_layerId;              }
    162164  Void      setLayerId            (UInt layer) { m_layerId = layer; }
     
    206208  Int       getBLHeight() { return  m_iBLSourceHeight; }
    207209#endif
     210#if REPN_FORMAT_IN_VPS
     211  Void      xInitILRP(TComSlice *slice);
     212#else
     213  Void      xInitILRP(TComSPS *pcSPS);
     214#endif
     215  Void      setILRPic(TComPic *pcPic);
    208216#endif
    209217#if AVC_SYNTAX || SYNTAX_OUTPUT
     
    211219  fstream* getBLSyntaxFile() { return m_pBLSyntaxFile; }
    212220#endif
    213 #if REF_IDX_FRAMEWORK
    214   Void      xInitILRP(TComSPS *pcSPS);
    215   Void      setILRPic(TComPic *pcPic);
    216 #endif
    217221
    218222protected:
     
    222226  Void      xActivateParameterSets();
    223227#if SVC_EXTENSION
     228#if POC_RESET_FLAG
     229  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int &iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC);
     230#else
    224231  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC);
     232#endif
    225233#else
    226234  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay);
Note: See TracChangeset for help on using the changeset viewer.