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


Ignore:
Timestamp:
30 Jun 2014, 06:13:06 (11 years ago)
Author:
seregin
Message:

merge with SHM-6-dev branch

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/source

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

    r595 r815  
    114114  if ( nalu.m_temporalId )
    115115  {
     116#if !Q0108_TSA_STSA
    116117    assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_LP
    117118         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_RADL
     
    124125         && nalu.m_nalUnitType != NAL_UNIT_EOS
    125126         && nalu.m_nalUnitType != NAL_UNIT_EOB );
     127#else
     128    assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_LP
     129         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_RADL
     130         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_N_LP
     131         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR_W_RADL
     132         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR_N_LP
     133         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_CRA
     134         && nalu.m_nalUnitType != NAL_UNIT_VPS
     135         && nalu.m_nalUnitType != NAL_UNIT_SPS
     136         && nalu.m_nalUnitType != NAL_UNIT_EOS);
     137#endif
    126138  }
    127139  else
    128140  {
     141#if !Q0108_TSA_STSA
    129142    assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_R
    130143         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_N
    131144         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_STSA_R
    132          && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_STSA_N );
     145         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_STSA_N
     146         );
     147#else
     148    assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_R
     149         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_N
     150         );
     151#endif
    133152  }
    134153}
  • trunk/source/Lib/TLibDecoder/SEIread.cpp

    r713 r815  
    9393    fprintf( g_hTrace, "===========Tone Mapping Info SEI message ===========\n");
    9494    break;
     95#if P0050_KNEE_FUNCTION_SEI
     96  case SEI::KNEE_FUNCTION_INFO:
     97    fprintf( g_hTrace, "=========== Knee Function Information SEI message ===========\n");
     98    break;
     99#endif
    95100#if Q0074_SEI_COLOR_MAPPING
    96101  case SEI::COLOR_MAPPING_INFO:
     
    129134  case SEI::BSP_HRD:
    130135    fprintf( g_hTrace, "=========== Bitstream parition HRD parameters SEI message ===========\n");
     136    break;
     137#endif
     138#if Q0078_ADD_LAYER_SETS
     139  case SEI::OUTPUT_LAYER_SET_NESTING:
     140    fprintf(g_hTrace, "=========== Output layer set nesting SEI message ===========\n");
     141    break;
     142  case SEI::VPS_REWRITING:
     143    fprintf(g_hTrace, "=========== VPS rewriting SEI message ===========\n");
    131144    break;
    132145#endif
     
    285298      xParseSEIToneMappingInfo((SEIToneMappingInfo&) *sei, payloadSize);
    286299      break;
     300#if P0050_KNEE_FUNCTION_SEI
     301    case SEI::KNEE_FUNCTION_INFO:
     302      sei = new SEIKneeFunctionInfo;
     303      xParseSEIKneeFunctionInfo((SEIKneeFunctionInfo&) *sei, payloadSize);
     304      break;
     305#endif
    287306#if Q0074_SEI_COLOR_MAPPING
    288307    case SEI::COLOR_MAPPING_INFO:
     
    345364     sei = new SEIBspHrd;
    346365     xParseSEIBspHrd((SEIBspHrd&) *sei, sps, *nestingSei);
     366     break;
     367#endif
     368#if Q0078_ADD_LAYER_SETS
     369   case SEI::OUTPUT_LAYER_SET_NESTING:
     370     sei = new SEIOutputLayerSetNesting;
     371#if LAYERS_NOT_PRESENT_SEI
     372     xParseSEIOutputLayerSetNesting((SEIOutputLayerSetNesting&)*sei, nalUnitType, vps, sps);
     373#else
     374     xParseSEIOutputLayerSetNesting((SEIOutputLayerSetNesting&)*sei, nalUnitType, sps);
     375#endif
     376     break;
     377   case SEI::VPS_REWRITING:
     378     sei = new SEIVPSRewriting;
     379     xParseSEIVPSRewriting((SEIVPSRewriting&)*sei);
     380     break;
     381#endif
     382#if Q0189_TMVP_CONSTRAINTS
     383   case SEI::TMVP_CONSTRAINTS:
     384     sei =  new SEITMVPConstrains;
     385     xParseSEITMVPConstraints((SEITMVPConstrains&) *sei, payloadSize);
     386     break;
     387#endif
     388#if Q0247_FRAME_FIELD_INFO
     389   case SEI::FRAME_FIELD_INFO:
     390     sei =  new SEIFrameFieldInfo;
     391     xParseSEIFrameFieldInfo    ((SEIFrameFieldInfo&) *sei, payloadSize);
    347392     break;
    348393#endif
     
    849894}
    850895
     896#if P0050_KNEE_FUNCTION_SEI
     897Void SEIReader::xParseSEIKneeFunctionInfo(SEIKneeFunctionInfo& sei, UInt /*payloadSize*/){
     898  Int i;
     899  UInt val;
     900  READ_UVLC( val, "knee_function_id" );                   sei.m_kneeId = val;
     901  READ_FLAG( val, "knee_function_cancel_flag" );          sei.m_kneeCancelFlag = val;
     902  if ( !sei.m_kneeCancelFlag )
     903  {
     904    READ_FLAG( val, "knee_function_persistence_flag" );   sei.m_kneePersistenceFlag = val;
     905    READ_FLAG( val, "mapping_flag" );                     sei.m_kneeMappingFlag = val;
     906    READ_CODE( 32, val, "input_d_range" );                sei.m_kneeInputDrange = val;
     907    READ_CODE( 32, val, "input_disp_luminance" );         sei.m_kneeInputDispLuminance = val;
     908    READ_CODE( 32, val, "output_d_range" );               sei.m_kneeOutputDrange = val;
     909    READ_CODE( 32, val, "output_disp_luminance" );        sei.m_kneeOutputDispLuminance = val;
     910    READ_UVLC( val, "num_knee_points_minus1" );           sei.m_kneeNumKneePointsMinus1 = val;
     911    assert( sei.m_kneeNumKneePointsMinus1 > 0 );
     912    sei.m_kneeInputKneePoint.resize(sei.m_kneeNumKneePointsMinus1+1);
     913    sei.m_kneeOutputKneePoint.resize(sei.m_kneeNumKneePointsMinus1+1);
     914    for(i = 0; i <= sei.m_kneeNumKneePointsMinus1; i++ )
     915    {
     916      READ_CODE( 10, val, "input_knee_point" );           sei.m_kneeInputKneePoint[i] = val;
     917      READ_CODE( 10, val, "output_knee_point" );          sei.m_kneeOutputKneePoint[i] = val;
     918    }
     919  }
     920}
     921#endif
     922
    851923#if Q0074_SEI_COLOR_MAPPING
    852924Void SEIReader::xParseSEIColorMappingInfo(SEIColorMappingInfo& sei, UInt /*payloadSize*/)
     
    9601032}
    9611033
     1034#if Q0189_TMVP_CONSTRAINTS
     1035Void SEIReader::xParseSEITMVPConstraints   (SEITMVPConstrains& sei, UInt payloadSize)
     1036{
     1037  UInt uiCode;
     1038  READ_UVLC( uiCode,           "prev_pics_not_used_flag"              ); sei.prev_pics_not_used_flag = uiCode;
     1039  READ_UVLC( uiCode,           "no_intra_layer_col_pic_flag"            ); sei.no_intra_layer_col_pic_flag = uiCode;
     1040  xParseByteAlign();
     1041}
     1042#endif
     1043
     1044#if Q0247_FRAME_FIELD_INFO
     1045Void SEIReader::xParseSEIFrameFieldInfo    (SEIFrameFieldInfo& sei, UInt payloadSize)
     1046{
     1047  UInt code;
     1048  READ_CODE( 4, code, "ffinfo_pic_struct" );             sei.m_ffinfo_picStruct            = code;
     1049  READ_CODE( 2, code, "ffinfo_source_scan_type" );       sei.m_ffinfo_sourceScanType = code;
     1050  READ_FLAG(    code, "ffinfo_duplicate_flag" );         sei.m_ffinfo_duplicateFlag    = ( code == 1 ? true : false );
     1051  xParseByteAlign();
     1052}
     1053#endif
     1054
    9621055#if LAYERS_NOT_PRESENT_SEI
    9631056Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComVPS *vps, TComSPS *sps)
     
    12091302    UInt lsIdx = nestingSei.m_nestingOpIdx[h];
    12101303    READ_UVLC( uiCode, "num_sei_bitstream_partitions_minus1[i]"); sei.m_seiNumBitstreamPartitionsMinus1[lsIdx] = uiCode;
    1211     for (UInt i = 0; i <= sei.m_seiNumBitstreamPartitionsMinus1[lsIdx]; i++)
    1212     {
    1213       for (UInt j = 0; j < sei.m_vpsMaxLayers; j++)
     1304#if HRD_BPB
     1305    Int chkPart=0;
     1306#endif
     1307    UInt i;
     1308    for(i = 0; i <= sei.m_seiNumBitstreamPartitionsMinus1[lsIdx]; i++)
     1309    {
     1310#if HRD_BPB
     1311      UInt nl=0; UInt j;
     1312      for(j = 0; j < sei.m_vpsMaxLayers; j++)
    12141313      {
    12151314        if (sei.m_layerIdIncludedFlag[lsIdx][j])
    12161315        {
     1316          nl++;
     1317        }
     1318      }
     1319      for (j = 0; j < nl; j++)
     1320      {
     1321#else
     1322      for (UInt j = 0; j < sei.m_vpsMaxLayers; j++)
     1323      {
     1324        if (sei.m_layerIdIncludedFlag[lsIdx][j])
     1325        {
     1326#endif
    12171327          READ_FLAG( uiCode, "sei_layer_in_bsp_flag[lsIdx][i][j]" ); sei.m_seiLayerInBspFlag[lsIdx][i][j] = uiCode;
    12181328        }
    1219       }
    1220     }
     1329#if !HRD_BPB
     1330      }
     1331#endif
     1332#if HRD_BPB
     1333      chkPart+=sei.m_seiLayerInBspFlag[lsIdx][i][j];
     1334#endif
     1335    }
     1336#if HRD_BPB
     1337    assert(chkPart<=1);
     1338#endif
     1339#if HRD_BPB
     1340    if(sei.m_seiNumBitstreamPartitionsMinus1[lsIdx]==0)
     1341    {
     1342      Int chkPartition1=0; Int chkPartition2=0;
     1343      for (UInt j = 0; j < sei.m_vpsMaxLayers; j++)
     1344      {
     1345        if( sei.m_layerIdIncludedFlag[lsIdx][j] )
     1346        {
     1347          chkPartition1+=sei.m_seiLayerInBspFlag[lsIdx][0][j];
     1348          chkPartition2++;
     1349        }
     1350      }
     1351      assert(chkPartition1!=chkPartition2);
     1352    }
     1353#endif
     1354     
    12211355    READ_UVLC( uiCode, "sei_num_bsp_sched_combinations_minus1[i]"); sei.m_seiNumBspSchedCombinationsMinus1[lsIdx] = uiCode;
    1222     for (UInt i = 0; i <= sei.m_seiNumBspSchedCombinationsMinus1[lsIdx]; i++)
     1356    for (i = 0; i <= sei.m_seiNumBspSchedCombinationsMinus1[lsIdx]; i++)
    12231357    {
    12241358      for (UInt j = 0; j <= sei.m_seiNumBitstreamPartitionsMinus1[lsIdx]; j++)
    12251359      {
    12261360        READ_UVLC( uiCode, "sei_bsp_comb_hrd_idx[lsIdx][i][j]"); sei.m_seiBspCombHrdIdx[lsIdx][i][j] = uiCode;
     1361#if HRD_BPB
     1362        assert(uiCode <= sei.m_seiNumBspHrdParametersMinus1);
     1363#endif
    12271364        READ_UVLC( uiCode, "sei_bsp_comb_sched_idx[lsIdx][i][j]"); sei.m_seiBspCombScheddx[lsIdx][i][j] = uiCode;
     1365#if HRD_BPB
     1366        assert(uiCode <= sei.hrd->getCpbCntMinus1( sps->getMaxTLayers()-1 ));
     1367#endif
     1368
    12281369      }
    12291370    }
     
    13071448#endif
    13081449
     1450#if Q0078_ADD_LAYER_SETS
     1451
     1452#if LAYERS_NOT_PRESENT_SEI
     1453Void SEIReader::xParseSEIOutputLayerSetNesting(SEIOutputLayerSetNesting& sei, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps)
     1454#else
     1455Void SEIReader::xParseSEIOutputLayerSetNesting(SEIOutputLayerSetNesting& sei, const NalUnitType nalUnitType, TComSPS *sps)
     1456#endif
     1457{
     1458  UInt uiCode;
     1459  SEIMessages seis;
     1460
     1461  READ_FLAG(uiCode, "ols_flag"); sei.m_olsFlag = uiCode;
     1462  READ_UVLC(uiCode, "num_ols_indices_minus1"); sei.m_numOlsIndicesMinus1 = uiCode;
     1463
     1464  for (Int i = 0; i <= sei.m_numOlsIndicesMinus1; i++)
     1465  {
     1466    READ_UVLC(uiCode, "ols_idx[i]"); sei.m_olsIdx[i] = uiCode;
     1467  }
     1468
     1469  // byte alignment
     1470  while (m_pcBitstream->getNumBitsRead() % 8 != 0)
     1471  {
     1472    UInt code;
     1473    READ_FLAG(code, "ols_nesting_zero_bit");
     1474  }
     1475
     1476  sei.m_callerOwnsSEIs = false;
     1477
     1478  // read nested SEI messages
     1479  do {
     1480#if O0164_MULTI_LAYER_HRD
     1481#if LAYERS_NOT_PRESENT_SEI
     1482    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, vps, sps);
     1483#else
     1484    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps);
     1485#endif
     1486#else
     1487#if LAYERS_NOT_PRESENT_SEI
     1488    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, vps, sps);
     1489#else
     1490    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps);
     1491#endif
     1492#endif
     1493  } while (m_pcBitstream->getNumBitsLeft() > 8);
     1494
     1495}
     1496
     1497Void SEIReader::xParseSEIVPSRewriting(SEIVPSRewriting &sei)
     1498{
     1499}
     1500
     1501#endif
     1502
    13091503#endif //SVC_EXTENSION
    13101504
  • trunk/source/Lib/TLibDecoder/SEIread.h

    r713 r815  
    9090  Void xParseSEIGradualDecodingRefreshInfo (SEIGradualDecodingRefreshInfo &sei, UInt payloadSize);
    9191  Void xParseSEIToneMappingInfo       (SEIToneMappingInfo& sei, UInt payloadSize);
     92#if P0050_KNEE_FUNCTION_SEI
     93  Void xParseSEIKneeFunctionInfo      (SEIKneeFunctionInfo& sei, UInt payloadSize);
     94#endif
    9295#if Q0074_SEI_COLOR_MAPPING
    9396  Void xParseSEIColorMappingInfo      (SEIColorMappingInfo& sei, UInt payloadSize);
     
    116119  Void xParseHrdParameters(TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1);
    117120#endif
     121#if Q0078_ADD_LAYER_SETS
     122#if LAYERS_NOT_PRESENT_SEI
     123  Void xParseSEIOutputLayerSetNesting(SEIOutputLayerSetNesting& sei, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps);
     124#else
     125  Void xParseSEIOutputLayerSetNesting(SEIOutputLayerSetNesting& sei, const NalUnitType nalUnitType, TComSPS *sps);
     126#endif
     127  Void xParseSEIVPSRewriting(SEIVPSRewriting &sei);
     128#endif
     129
     130#if Q0189_TMVP_CONSTRAINTS
     131  Void xParseSEITMVPConstraints    (SEITMVPConstrains& sei, UInt payloadSize);
     132#endif
     133#if Q0247_FRAME_FIELD_INFO
     134  Void xParseSEIFrameFieldInfo    (SEIFrameFieldInfo& sei, UInt payloadSize);
     135#endif
    118136  Void xParseByteAlign();
    119137};
  • trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r713 r815  
    339339
    340340  READ_FLAG( uiCode, "pps_extension_flag");
     341#if POC_RESET_INFO_INFERENCE
     342  pcPPS->setExtensionFlag( uiCode ? true : false );
     343
     344  if( pcPPS->getExtensionFlag() )
     345#else
    341346  if (uiCode)
     347#endif 
    342348  {
    343349#if P0166_MODIFIED_PPS_EXTENSION
     
    367373#endif
    368374    }
     375#if POC_RESET_INFO_INFERENCE
     376    else  // Extension type 0 absent
     377    {
     378      pcPPS->setPocResetInfoPresentFlag( false );
     379    }
     380#endif
    369381    if (ppsExtensionTypeFlag[7])
    370382    {
     
    379391#endif
    380392  }
     393#if POC_RESET_INFO_INFERENCE
     394  if( !pcPPS->getExtensionFlag() )
     395  {
     396    pcPPS->setPocResetInfoPresentFlag( false );
     397  }
     398#endif
    381399}
    382400
     
    443461  TimingInfo *timingInfo = pcVUI->getTimingInfo();
    444462  READ_FLAG(       uiCode, "vui_timing_info_present_flag");         timingInfo->setTimingInfoPresentFlag      (uiCode ? true : false);
    445 #if TIMING_INFO_NONZERO_LAYERID_SPS
     463#if SVC_EXTENSION
    446464  if( pcSPS->getLayerId() > 0 )
    447465  {
     
    585603#endif
    586604
     605#if !Q0177_SPS_TEMP_NESTING_FIX   //This part is not needed anymore as it is already covered by implementation in TDecTop::xActivateParameterSets()
    587606  if ( pcSPS->getMaxTLayers() == 1 )
    588607  {
     
    596615#endif
    597616  }
     617#endif
     618
    598619#ifdef SPS_PTL_FIX
    599620  if ( pcSPS->getLayerId() == 0)
     
    827848
    828849  READ_FLAG( uiCode, "sps_extension_flag");
    829   if (uiCode)
    830   {
    831 #if SPS_EXTENSION
    832 
     850
     851#if SVC_EXTENSION
     852  pcSPS->setExtensionFlag( uiCode ? true : false );
     853
     854  if( pcSPS->getExtensionFlag() )
     855  {
    833856#if O0142_CONDITIONAL_SPS_EXTENSION
    834857    UInt spsExtensionTypeFlag[8];
     
    849872    {
    850873#endif
    851 
    852 #endif
    853874      while ( xMoreRbspData() )
    854875      {
    855876        READ_FLAG( uiCode, "sps_extension_data_flag");
    856877      }
    857 #if SPS_EXTENSION
    858     }
    859 #endif
    860   }
    861 }
    862 
    863 #if SPS_EXTENSION
     878    }
     879  }
     880#else
     881  if (uiCode)
     882  {
     883    while ( xMoreRbspData() )
     884    {
     885      READ_FLAG( uiCode, "sps_extension_data_flag");
     886    }
     887  }
     888#endif
     889}
     890
     891#if SVC_EXTENSION
    864892Void TDecCavlc::parseSPSExtension( TComSPS* pcSPS )
    865893{
     
    899927  READ_CODE( 4,  uiCode,  "vps_video_parameter_set_id" );         pcVPS->setVPSId( uiCode );
    900928  READ_CODE( 2,  uiCode,  "vps_reserved_three_2bits" );           assert(uiCode == 3);
    901 #if VPS_RENAME
     929#if SVC_EXTENSION
    902930#if O0137_MAX_LAYERID
    903931  READ_CODE( 6,  uiCode,  "vps_max_layers_minus1" );              pcVPS->setMaxLayers( min( 62u, uiCode) + 1 );
     
    941969  }
    942970
    943 #if VPS_RENAME
     971#if SVC_EXTENSION
    944972  assert( pcVPS->getNumHrdParameters() < MAX_VPS_LAYER_SETS_PLUS1 );
    945973  assert( pcVPS->getMaxLayerId()       < MAX_VPS_LAYER_ID_PLUS1 );
    946974  READ_CODE( 6, uiCode, "vps_max_layer_id" );           pcVPS->setMaxLayerId( uiCode );
     975#if Q0078_ADD_LAYER_SETS
     976  READ_UVLC(uiCode, "vps_num_layer_sets_minus1");  pcVPS->setVpsNumLayerSetsMinus1(uiCode);
     977  pcVPS->setNumLayerSets(pcVPS->getVpsNumLayerSetsMinus1() + 1);
     978  for (UInt opsIdx = 1; opsIdx <= pcVPS->getVpsNumLayerSetsMinus1(); opsIdx++)
     979#else
    947980  READ_UVLC(    uiCode, "vps_num_layer_sets_minus1" );  pcVPS->setNumLayerSets( uiCode + 1 );
    948981  for( UInt opsIdx = 1; opsIdx <= ( pcVPS->getNumLayerSets() - 1 ); opsIdx ++ )
     982#endif
    949983  {
    950984    // Operation point set
     
    9951029  }
    9961030
    997 #if VPS_EXTNS
     1031#if SVC_EXTENSION
    9981032  READ_FLAG( uiCode,  "vps_extension_flag" );      pcVPS->setVpsExtensionFlag( uiCode ? true : false );
    9991033
     
    10401074
    10411075#if SVC_EXTENSION
    1042 #if VPS_EXTNS
    10431076Void TDecCavlc::parseVPSExtension(TComVPS *vps)
    10441077{
     
    10811114  }
    10821115
     1116  // The value of dimBitOffset[ NumScalabilityTypes ] is set equal to 6.
    10831117  if(vps->getSplittingFlag())
    10841118  {
     
    11661200  }
    11671201#endif
     1202#if Q0078_ADD_LAYER_SETS
     1203#if O0092_0094_DEPENDENCY_CONSTRAINT // Moved here
     1204  vps->setNumRefLayers();
     1205
     1206  if (vps->getMaxLayers() > MAX_REF_LAYERS)
     1207  {
     1208    for (i = 1; i < vps->getMaxLayers(); i++)
     1209    {
     1210      assert(vps->getNumRefLayers(vps->getLayerIdInNuh(i)) <= MAX_REF_LAYERS);
     1211    }
     1212  }
     1213#endif
     1214  vps->setPredictedLayerIds();
     1215  vps->setTreePartitionLayerIdList();
     1216#endif
    11681217#if VPS_TSLAYERS
    11691218  READ_FLAG( uiCode, "vps_sub_layers_max_minus1_present_flag"); vps->setMaxTSLayersPresentFlag(uiCode ? true : false);
     
    11841233  }
    11851234#endif
    1186 #if N0120_MAX_TID_REF_PRESENT_FLAG
    11871235  READ_FLAG( uiCode, "max_tid_ref_present_flag"); vps->setMaxTidRefPresentFlag(uiCode ? true : false);
    11881236  if (vps->getMaxTidRefPresentFlag())
     
    12011249#else
    12021250      READ_CODE( 3, uiCode, "max_tid_il_ref_pics_plus1[i]" ); vps->setMaxTidIlRefPicsPlus1(i, uiCode);
    1203 #if N0120_MAX_TID_REF_CFG
    12041251      assert( uiCode <= vps->getMaxTLayers());
    1205 #else
    1206       assert( uiCode <= vps->getMaxTLayers()+ 1 );
    1207 #endif
    12081252#endif
    12091253    }
     
    12231267    }
    12241268  }
    1225 #else
    1226   for(i = 0; i < vps->getMaxLayers() - 1; i++)
    1227   {
    1228 #if O0225_MAX_TID_FOR_REF_LAYERS
    1229        for( j = i+1; j <= vps->getMaxLayers() - 1; j++)
    1230        {
    1231          if(vps->getDirectDependencyFlag(j, i))
    1232          {
    1233            READ_CODE( 3, uiCode, "max_tid_il_ref_pics_plus1[i][j]" ); vps->setMaxTidIlRefPicsPlus1(i, j, uiCode);
    1234            assert( uiCode <= vps->getMaxTLayers() );
    1235          }
    1236        }
    1237 #else
    1238     READ_CODE( 3, uiCode, "max_tid_il_ref_pics_plus1[i]" ); vps->setMaxTidIlRefPicsPlus1(i, uiCode);
    1239     assert( uiCode <= vps->getMaxTLayers() );
    1240 #endif   
    1241   }
    1242 #endif
    1243 #if ILP_SSH_SIG
    1244     READ_FLAG( uiCode, "all_ref_layers_active_flag" ); vps->setIlpSshSignalingEnabledFlag(uiCode ? true : false);
    1245 #endif
     1269  READ_FLAG( uiCode, "all_ref_layers_active_flag" ); vps->setIlpSshSignalingEnabledFlag(uiCode ? true : false);
    12461270#if VPS_EXTN_PROFILE_INFO
    12471271  // Profile-tier-level signalling
     
    12761300#endif
    12771301
     1302#if Q0078_ADD_LAYER_SETS
     1303  if (vps->getNumIndependentLayers() > 1)
     1304  {
     1305    READ_UVLC(uiCode, "num_add_layer_sets"); vps->setNumAddLayerSets(uiCode);
     1306    for (i = 0; i < vps->getNumAddLayerSets(); i++)
     1307    {
     1308      for (j = 1; j < vps->getNumIndependentLayers(); j++)
     1309      {
     1310        int len = 1;
     1311        while ((1 << len) < (vps->getNumLayersInTreePartition(j) + 1))
     1312        {
     1313          len++;
     1314        }
     1315        READ_CODE(len, uiCode, "highest_layer_idx_plus1[i][j]"); vps->setHighestLayerIdxPlus1(i, j, uiCode);
     1316      }
     1317    }
     1318    vps->setNumLayerSets(vps->getNumLayerSets() + vps->getNumAddLayerSets());
     1319    vps->setLayerIdIncludedFlagsForAddLayerSets();
     1320  }
     1321#endif
     1322
    12781323#if !VPS_EXTN_UEV_CODING
    12791324  READ_FLAG( uiCode, "more_output_layer_sets_than_default_flag" ); vps->setMoreOutputLayerSetsThanDefaultFlag( uiCode ? true : false );
     
    12931338  if( vps->getNumLayerSets() > 1 )
    12941339  {
    1295     READ_UVLC( uiCode, "num_add_output_layer_sets" );            vps->setNumAddOutputLayerSets( uiCode );
    1296     READ_CODE( 2, uiCode, "default_target_output_layer_idc" );   vps->setDefaultTargetOutputLayerIdc( uiCode );
     1340    READ_UVLC( uiCode, "num_add_olss" );            vps->setNumAddOutputLayerSets( uiCode );
     1341    READ_CODE( 2, uiCode, "default_output_layer_idc" );   vps->setDefaultTargetOutputLayerIdc( uiCode );
    12971342  }
    12981343  else
     
    13041349#endif
    13051350
    1306   // The value of num_add_output_layer_sets shall be in the range of 0 to 1023, inclusive.
     1351  // The value of num_add_olss shall be in the range of 0 to 1023, inclusive.
    13071352  assert( vps->getNumAddOutputLayerSets() >= 0 && vps->getNumAddOutputLayerSets() < 1024 );
    13081353
     
    13281373        numBits++;
    13291374      }
    1330       READ_CODE( numBits, uiCode, "output_layer_set_idx_minus1");   vps->setOutputLayerSetIdx( i, uiCode + 1);
     1375      READ_CODE( numBits, uiCode, "layer_set_idx_for_ols_minus1");   vps->setOutputLayerSetIdx( i, uiCode + 1);
    13311376    }
    13321377    else
     
    13341379      vps->setOutputLayerSetIdx( i, i );
    13351380    }
     1381#if Q0078_ADD_LAYER_SETS
     1382    if ( i > vps->getVpsNumLayerSetsMinus1() || vps->getDefaultTargetOutputLayerIdc() >= 2 )
     1383#else
    13361384    if ( i > (vps->getNumLayerSets() - 1) || vps->getDefaultTargetOutputLayerIdc() >= 2 )
     1385#endif
    13371386    {
    13381387      Int lsIdx = vps->getOutputLayerSetIdx(i);
     
    16341683#endif
    16351684
    1636 #if N0147_IRAP_ALIGN_FLAG && !IRAP_ALIGN_FLAG_IN_VPS_VUI
     1685#if !IRAP_ALIGN_FLAG_IN_VPS_VUI
    16371686  READ_FLAG(uiCode, "cross_layer_irap_aligned_flag" );
    16381687  vps->setCrossLayerIrapAlignFlag(uiCode);
     
    16781727  }
    16791728#endif
    1680 #if O0092_0094_DEPENDENCY_CONSTRAINT
    1681   for(i = 1; i < vps->getMaxLayers(); i++)
    1682   {
    1683     vps->setNumRefLayers(vps->getLayerIdInNuh(i));   // identify the number of direct and indirect reference layers of current layer and set recursiveRefLayersFlags
    1684   }
     1729#if !Q0078_ADD_LAYER_SETS
     1730#if O0092_0094_DEPENDENCY_CONSTRAINT // Moved up
     1731  vps->setNumRefLayers();
     1732
    16851733  if(vps->getMaxLayers() > MAX_REF_LAYERS)
    16861734  {
     
    16901738    }
    16911739  }
     1740#endif
    16921741#endif
    16931742
     
    17321781#endif
    17331782  {
    1734 #if VPS_VUI
    17351783    while ( m_pcBitstream->getNumBitsRead() % 8 != 0 )
    17361784    {
     
    17381786    }
    17391787    parseVPSVUI(vps);
    1740 #endif
    17411788  }
    17421789  else
     
    17781825  }
    17791826 
    1780   // When not present, the value of num_add_output_layer_sets is inferred to be equal to 0.
    1781   // NumOutputLayerSets = num_add_output_layer_sets + vps_num_layer_sets_minus1 + 1
     1827  // When not present, the value of num_add_olss is inferred to be equal to 0.
     1828  // NumOutputLayerSets = num_add_olss + NumLayerSets
    17821829  vps->setNumOutputLayerSets( vps->getNumLayerSets() );
    17831830
    17841831  // For i in the range of 0 to NumOutputLayerSets-1, inclusive, the variable LayerSetIdxForOutputLayerSet[ i ] is derived as specified in the following:
    1785   // LayerSetIdxForOutputLayerSet[ i ] = ( i <= vps_number_layer_sets_minus1 ) ? i : output_layer_set_idx_minus1[ i ] + 1
     1832  // LayerSetIdxForOutputLayerSet[ i ] = ( i <= vps_number_layer_sets_minus1 ) ? i : layer_set_idx_for_ols_minus1[ i ] + 1
    17861833  for( i = 1; i < vps->getNumOutputLayerSets(); i++ )
    17871834  {
     
    18341881Void TDecCavlc::defaultVPSVUI( TComVPS* vps )
    18351882{
    1836 #if N0147_IRAP_ALIGN_FLAG
    18371883  // When not present, the value of all_layers_idr_aligned_flag is inferred to be equal to 0.
    18381884  vps->setCrossLayerIrapAlignFlag( false );
    1839 #endif
    18401885
    18411886#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     
    18491894#endif
    18501895}
    1851 #endif
    18521896
    18531897#if REPN_FORMAT_IN_VPS
     
    19181962  UInt uiCode;
    19191963#if DPB_PARAMS_MAXTLAYERS
     1964#if BITRATE_PICRATE_SIGNALLING
     1965    Int * MaxSubLayersInLayerSetMinus1 = new Int[vps->getNumLayerSets()];
     1966    for(Int i = 0; i < vps->getNumLayerSets(); i++)
     1967#else
    19201968    Int * MaxSubLayersInLayerSetMinus1 = new Int[vps->getNumOutputLayerSets()];
    19211969    for(Int i = 1; i < vps->getNumOutputLayerSets(); i++)
     1970#endif
    19221971    {
    19231972        UInt maxSLMinus1 = 0;
     
    19271976        Int optLsIdx = i;
    19281977#endif
     1978#if BITRATE_PICRATE_SIGNALLING
     1979        optLsIdx = i;
     1980#endif
    19291981        for(Int k = 0; k < vps->getNumLayersInIdList(optLsIdx); k++ ) {
    19301982            Int  lId = vps->getLayerSetLayerIdList(optLsIdx, k);
     
    19321984        }
    19331985        MaxSubLayersInLayerSetMinus1[ i ] = maxSLMinus1;
     1986#if BITRATE_PICRATE_SIGNALLING
     1987        vps->setMaxSLayersInLayerSetMinus1(i,MaxSubLayersInLayerSetMinus1[ i ]);
     1988#endif
    19341989    }
    19351990#endif
     
    19452000    READ_FLAG( uiCode, "sub_layer_flag_info_present_flag[i]");  vps->setSubLayerFlagInfoPresentFlag( i, uiCode ? true : false );
    19462001#if DPB_PARAMS_MAXTLAYERS
     2002#if BITRATE_PICRATE_SIGNALLING
     2003    for(Int j = 0; j <= MaxSubLayersInLayerSetMinus1[ vps->getOutputLayerSetIdx( i ) ]; j++)
     2004#else
    19472005    for(Int j = 0; j <= MaxSubLayersInLayerSetMinus1[ i ]; j++)
     2006#endif
    19482007#else
    19492008    for(Int j = 0; j <= vps->getMaxTLayers(); j++)
     
    20092068      if( !vps->getSubLayerDpbInfoPresentFlag(i, j) )  // If sub-layer DPB information is NOT present
    20102069      {
     2070#if RESOLUTION_BASED_DPB
    20112071        for(Int k = 0; k < vps->getNumSubDpbs(layerSetIdxForOutputLayerSet); k++)
     2072#else
     2073        for(Int k = 0; k < vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ); k++)
     2074#endif
    20122075        {
    20132076          vps->setMaxVpsDecPicBufferingMinus1( i, k, j, vps->getMaxVpsDecPicBufferingMinus1( i, k, j - 1 ) );
    20142077        }
    20152078        vps->setMaxVpsNumReorderPics( i, j, vps->getMaxVpsNumReorderPics( i, j - 1) );
     2079#if RESOLUTION_BASED_DPB
    20162080        for(Int k = 0; k < vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ); k++)
    20172081        {
    20182082          vps->setMaxVpsLayerDecPicBuffMinus1( i, k, j, vps->getMaxVpsLayerDecPicBuffMinus1( i, k, j - 1));
    20192083        }
     2084#endif
    20202085        vps->setMaxVpsLatencyIncreasePlus1( i, j, vps->getMaxVpsLatencyIncreasePlus1( i, j - 1 ) );
    20212086      }
     
    20242089}
    20252090#endif
    2026 #if VPS_VUI
     2091
    20272092Void TDecCavlc::parseVPSVUI(TComVPS *vps)
    20282093{
     
    20392104    vps->setCrossLayerIrapAlignFlag(uiCode);
    20402105#if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG
    2041     if (uiCode)
    2042     {
    2043       READ_FLAG(uiCode, "all_layers_idr_aligned_flag" );
    2044       vps->setCrossLayerIrapAlignFlag(uiCode);
     2106    if( uiCode )
     2107    {
     2108      READ_FLAG( uiCode, "all_layers_idr_aligned_flag" );
     2109      vps->setCrossLayerAlignedIdrOnlyFlag(uiCode);
    20452110    }
    20462111#endif
     
    20532118  }
    20542119#endif
    2055 #if VPS_VUI_BITRATE_PICRATE
     2120
    20562121  READ_FLAG( uiCode,        "bit_rate_present_vps_flag" );  vps->setBitRatePresentVpsFlag( uiCode ? true : false );
    20572122  READ_FLAG( uiCode,        "pic_rate_present_vps_flag" );  vps->setPicRatePresentVpsFlag( uiCode ? true : false );
    20582123
    20592124  Bool parseFlag = vps->getBitRatePresentVpsFlag() || vps->getPicRatePresentVpsFlag();
    2060   {
    2061     for( i = 0; i < vps->getNumLayerSets(); i++ )
    2062     {
    2063       for( j = 0; j < vps->getMaxTLayers(); j++ )
    2064       {
    2065         if( parseFlag && vps->getBitRatePresentVpsFlag() )
    2066         {
    2067           READ_FLAG( uiCode,        "bit_rate_present_flag[i][j]" );  vps->setBitRatePresentFlag( i, j, uiCode ? true : false );
    2068         }
    2069         else
    2070         {
    2071           vps->setBitRatePresentFlag( i, j, false );
    2072         }
    2073         if( parseFlag && vps->getPicRatePresentVpsFlag() )
    2074         {
    2075           READ_FLAG( uiCode,        "pic_rate_present_flag[i][j]" );  vps->setPicRatePresentFlag( i, j, uiCode ? true : false );
    2076         }
    2077         else
    2078         {
    2079           vps->setPicRatePresentFlag( i, j, false );
    2080         }
    2081         if( parseFlag && vps->getBitRatePresentFlag(i, j) )
    2082         {
    2083           READ_CODE( 16, uiCode,    "avg_bit_rate[i][j]" ); vps->setAvgBitRate( i, j, uiCode );
    2084           READ_CODE( 16, uiCode,    "max_bit_rate[i][j]" ); vps->setMaxBitRate( i, j, uiCode );
    2085         }
    2086         else
    2087         {
    2088           vps->setAvgBitRate( i, j, 0 );
    2089           vps->setMaxBitRate( i, j, 0 );
    2090         }
    2091         if( parseFlag && vps->getPicRatePresentFlag(i, j) )
    2092         {
    2093           READ_CODE( 2 , uiCode,    "constant_pic_rate_idc[i][j]" ); vps->setConstPicRateIdc( i, j, uiCode );
    2094           READ_CODE( 16, uiCode,    "avg_pic_rate[i][j]"          ); vps->setAvgPicRate( i, j, uiCode );
    2095         }
    2096         else
    2097         {
    2098           vps->setConstPicRateIdc( i, j, 0 );
    2099           vps->setAvgPicRate     ( i, j, 0 );
    2100         }
    2101       }
    2102     }
    2103   }
    2104 #endif
     2125
     2126#if Q0078_ADD_LAYER_SETS
     2127  for( i = 0; i <= vps->getVpsNumLayerSetsMinus1(); i++ )
     2128#else
     2129  for( i = 0; i < vps->getNumLayerSets(); i++ )
     2130#endif
     2131  {
     2132#if BITRATE_PICRATE_SIGNALLING
     2133    for( j = 0; j <= vps->getMaxSLayersInLayerSetMinus1(i); j++ )
     2134#else
     2135    for( j = 0; j < vps->getMaxTLayers(); j++ )
     2136#endif
     2137    {
     2138      if( parseFlag && vps->getBitRatePresentVpsFlag() )
     2139      {
     2140        READ_FLAG( uiCode,        "bit_rate_present_flag[i][j]" );  vps->setBitRatePresentFlag( i, j, uiCode ? true : false );
     2141      }
     2142      else
     2143      {
     2144        vps->setBitRatePresentFlag( i, j, false );
     2145      }
     2146      if( parseFlag && vps->getPicRatePresentVpsFlag() )
     2147      {
     2148        READ_FLAG( uiCode,        "pic_rate_present_flag[i][j]" );  vps->setPicRatePresentFlag( i, j, uiCode ? true : false );
     2149      }
     2150      else
     2151      {
     2152        vps->setPicRatePresentFlag( i, j, false );
     2153      }
     2154      if( parseFlag && vps->getBitRatePresentFlag(i, j) )
     2155      {
     2156        READ_CODE( 16, uiCode,    "avg_bit_rate[i][j]" ); vps->setAvgBitRate( i, j, uiCode );
     2157        READ_CODE( 16, uiCode,    "max_bit_rate[i][j]" ); vps->setMaxBitRate( i, j, uiCode );
     2158      }
     2159      else
     2160      {
     2161        vps->setAvgBitRate( i, j, 0 );
     2162        vps->setMaxBitRate( i, j, 0 );
     2163      }
     2164      if( parseFlag && vps->getPicRatePresentFlag(i, j) )
     2165      {
     2166        READ_CODE( 2 , uiCode,    "constant_pic_rate_idc[i][j]" ); vps->setConstPicRateIdc( i, j, uiCode );
     2167        READ_CODE( 16, uiCode,    "avg_pic_rate[i][j]"          ); vps->setAvgPicRate( i, j, uiCode );
     2168      }
     2169      else
     2170      {
     2171        vps->setConstPicRateIdc( i, j, 0 );
     2172        vps->setAvgPicRate     ( i, j, 0 );
     2173      }
     2174    }
     2175  }
    21052176#if VPS_VUI_VIDEO_SIGNAL_MOVE
    21062177  READ_FLAG( uiCode, "video_signal_info_idx_present_flag" ); vps->setVideoSigPresentVpsFlag( uiCode == 1 );
     
    21622233    }
    21632234#endif
    2164 #if TILE_BOUNDARY_ALIGNED_FLAG
     2235
    21652236    for(i = 1; i < vps->getMaxLayers(); i++)
    21662237    {
     
    21772248      }
    21782249    }
    2179 #endif
    21802250#if VPS_VUI_TILES_NOT_IN_USE__FLAG
    21812251  }
     
    22902360        parseHrdParameters(vps->getBspHrd(i), i==0 ? 1 : vps->getBspCprmsPresentFlag(i), vps->getMaxTLayers()-1);
    22912361      }
     2362#if Q0078_ADD_LAYER_SETS
     2363      for (UInt h = 1; h <= vps->getVpsNumLayerSetsMinus1(); h++)
     2364#else
    22922365      for( UInt h = 1; h <= (vps->getNumLayerSets()-1); h++ )
     2366#endif
    22932367      {
    22942368        READ_UVLC( uiCode, "num_bitstream_partitions[i]"); vps->setNumBitstreamPartitions(h, uiCode);
     2369#if HRD_BPB
     2370        Int chkPart=0;
     2371#endif
    22952372        for( i = 0; i < vps->getNumBitstreamPartitions(h); i++ )
    22962373        {
     
    23022379            }
    23032380          }
    2304         }
     2381#if HRD_BPB
     2382          chkPart+=vps->getLayerInBspFlag(h, i, j);
     2383#endif
     2384        }
     2385#if HRD_BPB
     2386        assert(chkPart<=1);
     2387#endif
     2388#if HRD_BPB
     2389        if(vps->getNumBitstreamPartitions(h)==1)
     2390        {
     2391          Int chkPartition1=0; Int chkPartition2=0;
     2392          for( j = 0; j <= (vps->getMaxLayers()-1); j++ )
     2393          {
     2394            if( vps->getLayerIdIncludedFlag(h, j) )
     2395            {
     2396              chkPartition1+=vps->getLayerInBspFlag(h, 0, j);
     2397              chkPartition2++;
     2398            }
     2399          }
     2400          assert(chkPartition1!=chkPartition2);
     2401        }
     2402#endif
    23052403        if (vps->getNumBitstreamPartitions(h))
    23062404        {
     2405#if Q0182_MULTI_LAYER_HRD_UPDATE
     2406          READ_UVLC( uiCode, "num_bsp_sched_combinations_minus1[h]"); vps->setNumBspSchedCombinations(h, uiCode + 1);
     2407#else
    23072408          READ_UVLC( uiCode, "num_bsp_sched_combinations[h]"); vps->setNumBspSchedCombinations(h, uiCode);
     2409#endif
    23082410          for( i = 0; i < vps->getNumBspSchedCombinations(h); i++ )
    23092411          {
     
    23112413            {
    23122414              READ_UVLC( uiCode, "bsp_comb_hrd_idx[h][i][j]"); vps->setBspCombHrdIdx(h, i, j, uiCode);
     2415#if HRD_BPB
     2416              assert(uiCode <= vps->getVpsNumBspHrdParametersMinus1());
     2417#endif
     2418               
    23132419              READ_UVLC( uiCode, "bsp_comb_sched_idx[h][i][j]"); vps->setBspCombSchedIdx(h, i, j, uiCode);
     2420#if HRD_BPB
     2421              assert(uiCode <= vps->getBspHrdParamBufferCpbCntMinus1(uiCode,vps->getMaxTLayers()-1));
     2422#endif
    23142423            }
    23152424          }
     
    23342443#endif
    23352444}
    2336 #endif
    23372445#endif //SVC_EXTENSION
    23382446
     
    24122520  }
    24132521
     2522#if Q0142_POC_LSB_NOT_PRESENT
     2523#if SHM_FIX7
     2524    Int iPOClsb = 0;
     2525#endif
     2526#endif
     2527
    24142528  if(!rpcSlice->getDependentSliceSegmentFlag())
    24152529  {
     
    24842598    }
    24852599#if N0065_LAYER_POC_ALIGNMENT
     2600#if !Q0142_POC_LSB_NOT_PRESENT
    24862601#if SHM_FIX7
    24872602    Int iPOClsb = 0;
    24882603#endif
     2604#endif
    24892605#if O0062_POC_LSB_NOT_PRESENT_FLAG
    24902606    if( ( rpcSlice->getLayerId() > 0 && !rpcSlice->getVPS()->getPocLsbNotPresentFlag( rpcSlice->getVPS()->getLayerIdInVps(rpcSlice->getLayerId())) ) || !rpcSlice->getIdrPicFlag())
     
    24972613    {
    24982614      READ_CODE(sps->getBitsForPOC(), uiCode, "pic_order_cnt_lsb");
     2615#if POC_RESET_IDC_DECODER
     2616      rpcSlice->setPicOrderCntLsb( uiCode );
     2617#endif
    24992618#if SHM_FIX7
    25002619      iPOClsb = uiCode;
     
    25312650#if SHM_FIX7
    25322651      }
     2652#endif
     2653#if POC_RESET_IDC_DECODER
     2654    else
     2655    {
     2656      rpcSlice->setPicOrderCntLsb( 0 );
     2657    }
    25332658#endif
    25342659      if( !rpcSlice->getIdrPicFlag() )
     
    26452770        rps->setNumberOfPictures(offset);
    26462771      }
     2772#if DPB_CONSTRAINTS
     2773          if(rpcSlice->getVPS()->getVpsExtensionFlag()==1)
     2774          {
     2775#if Q0078_ADD_LAYER_SETS
     2776              for (Int ii = 1; ii < (rpcSlice->getVPS()->getVpsNumLayerSetsMinus1() + 1); ii++)  // prevent assert error when num_add_layer_sets > 0
     2777#else
     2778              for (Int ii=1; ii< rpcSlice->getVPS()->getNumOutputLayerSets(); ii++ )
     2779#endif
     2780              {
     2781                  Int layerSetIdxForOutputLayerSet = rpcSlice->getVPS()->getOutputLayerSetIdx( ii );
     2782                  Int chkAssert=0;
     2783                  for(Int kk = 0; kk < rpcSlice->getVPS()->getNumLayersInIdList(layerSetIdxForOutputLayerSet); kk++)
     2784                  {
     2785                      if(rpcSlice->getLayerId()==rpcSlice->getVPS()->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, kk))
     2786                      {
     2787                          chkAssert=1;
     2788                      }
     2789                  }
     2790                  if(chkAssert)
     2791                  {
     2792                      // There may be something wrong here (layer id assumed to be layer idx?)
     2793                      assert(rps->getNumberOfNegativePictures() <= rpcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1(ii , rpcSlice->getLayerId() , rpcSlice->getVPS()->getMaxSLayersInLayerSetMinus1(ii)));
     2794                      assert(rps->getNumberOfPositivePictures() <= rpcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1(ii , rpcSlice->getLayerId() , rpcSlice->getVPS()->getMaxSLayersInLayerSetMinus1(ii)) - rps->getNumberOfNegativePictures());
     2795                      assert((rps->getNumberOfPositivePictures() + rps->getNumberOfNegativePictures() + rps->getNumberOfLongtermPictures()) <= rpcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1(ii , rpcSlice->getLayerId() , rpcSlice->getVPS()->getMaxSLayersInLayerSetMinus1(ii)));
     2796                  }
     2797              }
     2798             
     2799             
     2800          }
     2801          if(rpcSlice->getLayerId() == 0)
     2802          {
     2803              assert(rps->getNumberOfNegativePictures() <= rpcSlice->getSPS()->getMaxDecPicBuffering(rpcSlice->getSPS()->getMaxTLayers()-1) );
     2804              assert(rps->getNumberOfPositivePictures() <= rpcSlice->getSPS()->getMaxDecPicBuffering(rpcSlice->getSPS()->getMaxTLayers()-1) -rps->getNumberOfNegativePictures());
     2805              assert((rps->getNumberOfPositivePictures() + rps->getNumberOfNegativePictures() + rps->getNumberOfLongtermPictures()) <= rpcSlice->getSPS()->getMaxDecPicBuffering(rpcSlice->getSPS()->getMaxTLayers()-1));
     2806          }
     2807#endif
    26472808      if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
    26482809        || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
     
    26732834#if SVC_EXTENSION
    26742835    rpcSlice->setActiveNumILRRefIdx(0);
    2675 #if ILP_SSH_SIG
    2676 #if ILP_SSH_SIG_FIX
    26772836    if((rpcSlice->getLayerId() > 0) && !(rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag()) && (rpcSlice->getNumILRRefIdx() > 0) )
    2678 #else
    2679     if((rpcSlice->getLayerId() > 0) && rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag() && (rpcSlice->getNumILRRefIdx() > 0) )
    2680 #endif
    2681 #else
    2682     if((rpcSlice->getLayerId() > 0)  &&  (rpcSlice->getNumILRRefIdx() > 0) )
    2683 #endif
    26842837    {
    26852838      READ_FLAG(uiCode,"inter_layer_pred_enabled_flag");
     
    27202873#endif
    27212874          }
    2722 #if ILP_NUM_REF_CHK
     2875
    27232876          if( rpcSlice->getActiveNumILRRefIdx() == rpcSlice->getNumILRRefIdx() )
    27242877          {
     
    27302883          else
    27312884          {
    2732 #endif
    2733           for(Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ )
    2734           {
    2735             READ_CODE( numBits,uiCode,"inter_layer_pred_layer_idc[i]" );
    2736             rpcSlice->setInterLayerPredLayerIdc(uiCode,i);
     2885            for(Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ )
     2886            {
     2887              READ_CODE( numBits,uiCode,"inter_layer_pred_layer_idc[i]" );
     2888              rpcSlice->setInterLayerPredLayerIdc(uiCode,i);
     2889            }
    27372890          }
    2738 #if ILP_NUM_REF_CHK
    2739           }
    2740 #endif
    27412891        }
    27422892        else
     
    27602910      }
    27612911    }
    2762 #if ILP_SSH_SIG
    2763 #if ILP_SSH_SIG_FIX
    27642912    else if( rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag() == true &&  (rpcSlice->getLayerId() > 0 ))
    2765 #else
    2766     else if( rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag() == false )
    2767 #endif
    27682913    {
    27692914      rpcSlice->setInterLayerPredEnabledFlag(true);
     
    27992944#endif
    28002945    }
    2801 #endif
    2802 #endif
    28032946#if P0312_VERT_PHASE_ADJ
    28042947    for(Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ )
     
    28112954    }
    28122955#endif
     2956#endif //SVC_EXTENSION
    28132957
    28142958    if(sps->getUseSAO())
     
    29923136#if SVC_EXTENSION && REF_IDX_MFM
    29933137      // set motion mapping flag
    2994       rpcSlice->setMFMEnabledFlag( ( rpcSlice->getNumMotionPredRefLayers() > 0 && rpcSlice->getActiveNumILRRefIdx() ) ? true : false );
     3138      rpcSlice->setMFMEnabledFlag( ( rpcSlice->getNumMotionPredRefLayers() > 0 && rpcSlice->getActiveNumILRRefIdx() && !rpcSlice->isIntra() ) ? true : false );
    29953139#endif
    29963140      if ( rpcSlice->getSliceType() == B_SLICE )
     
    31323276
    31333277#if POC_RESET_IDC_SIGNALLING
    3134   Int sliceHederExtensionLength = 0;
     3278  Int sliceHeaderExtensionLength = 0;
    31353279  if(pps->getSliceHeaderExtensionPresentFlag())
    31363280  {
    3137     READ_UVLC( uiCode, "slice_header_extension_length"); sliceHederExtensionLength = uiCode;
     3281    READ_UVLC( uiCode, "slice_header_extension_length"); sliceHeaderExtensionLength = uiCode;
    31383282  }
    31393283  else
    31403284  {
    3141     sliceHederExtensionLength = 0;
     3285    sliceHeaderExtensionLength = 0;
    31423286  }
    31433287  UInt startBits = m_pcBitstream->getNumBitsRead();     // Start counter of # SH Extn bits
    3144   if( sliceHederExtensionLength > 0 )
     3288  if( sliceHeaderExtensionLength > 0 )
    31453289  {
    31463290    if( rpcSlice->getPPS()->getPocResetInfoPresentFlag() )
     
    31523296      rpcSlice->setPocResetIdc( 0 );
    31533297    }
     3298#if Q0142_POC_LSB_NOT_PRESENT
     3299    if ( rpcSlice->getVPS()->getPocLsbNotPresentFlag(rpcSlice->getLayerId()) && iPOClsb > 0 )
     3300    {
     3301      assert( rpcSlice->getPocResetIdc() != 2 );
     3302    }
     3303#endif
    31543304    if( rpcSlice->getPocResetIdc() > 0 )
    31553305    {
     
    31663316      READ_FLAG( uiCode,        "full_poc_reset_flag"); rpcSlice->setFullPocResetFlag((uiCode == 1) ? true : false);
    31673317      READ_CODE(rpcSlice->getSPS()->getBitsForPOC(), uiCode,"poc_lsb_val"); rpcSlice->setPocLsbVal(uiCode);
     3318#if Q0142_POC_LSB_NOT_PRESENT
     3319      if ( rpcSlice->getVPS()->getPocLsbNotPresentFlag(rpcSlice->getLayerId()) && rpcSlice->getFullPocResetFlag() )
     3320      {
     3321        assert( rpcSlice->getPocLsbVal() == 0 );
     3322      }
     3323#endif
    31683324    }
    31693325
     
    31793335    else
    31803336    {
     3337#if POC_MSB_VAL_PRESENT_FLAG_SEM
     3338      if( sliceHeaderExtensionLength == 0 )
     3339      {
     3340        rpcSlice->setPocMsbValPresentFlag( false );
     3341      }
     3342      else if( rpcSlice->getPocMsbValRequiredFlag() )
     3343#else
    31813344      if( rpcSlice->getPocMsbValRequiredFlag() )
     3345#endif
    31823346      {
    31833347        rpcSlice->setPocMsbValPresentFlag( true );
     
    31893353    }
    31903354
     3355#if !POC_RESET_IDC_DECODER
    31913356    Int maxPocLsb  = 1 << rpcSlice->getSPS()->getBitsForPOC();
     3357#endif
    31923358    if( rpcSlice->getPocMsbValPresentFlag() )
    31933359    {
    31943360      READ_UVLC( uiCode,    "poc_msb_val");             rpcSlice->setPocMsbVal( uiCode );
     3361
     3362#if !POC_RESET_IDC_DECODER
    31953363      // Update POC of the slice based on this MSB val
    31963364      Int pocLsb     = rpcSlice->getPOC() % maxPocLsb;
     
    32003368    {
    32013369      rpcSlice->setPocMsbVal( rpcSlice->getPOC() / maxPocLsb );
     3370#endif
    32023371    }
    32033372
     
    32123381    while( counter )
    32133382    {
     3383#if Q0146_SSH_EXT_DATA_BIT
     3384      READ_FLAG( uiCode, "slice_segment_header_extension_data_bit" );
     3385#else
    32143386      READ_FLAG( uiCode, "slice_segment_header_extension_reserved_bit" ); assert( uiCode == 1 );
     3387#endif
    32153388      counter--;
    32163389    }
  • trunk/source/Lib/TLibDecoder/TDecCAVLC.h

    r713 r815  
    7575  Void  parseQtRootCbf      ( UInt uiAbsPartIdx, UInt& uiQtRootCbf );
    7676  Void  parseVPS            ( TComVPS* pcVPS );
    77 #if SPS_EXTENSION
    78 #if VPS_EXTNS
     77#if SVC_EXTENSION
    7978  Void  parseVPSExtension   ( TComVPS* pcVPS );
    8079  Void  defaultVPSExtension ( TComVPS* pcVPS );
    81 #endif
    82 
    83 #if VPS_VUI
    84   Void  parseVPSVUI   ( TComVPS* pcVPS );
    85   Void  defaultVPSVUI ( TComVPS* pcVPS );
    86 #endif
     80  Void  parseVPSVUI         ( TComVPS* pcVPS );
     81  Void  defaultVPSVUI       ( TComVPS* pcVPS );
    8782#if REPN_FORMAT_IN_VPS
    8883  Void  parseRepFormat      ( RepFormat *repFormat, RepFormat *repFormatPrev );
  • trunk/source/Lib/TLibDecoder/TDecTop.cpp

    r713 r815  
    8585  m_isNoOutputPriorPics = false;
    8686#endif
     87#if Q0177_EOS_CHECKS
     88  m_isLastNALWasEos = false;
     89#endif
    8790#if NO_CLRAS_OUTPUT_FLAG
    8891  m_noClrasOutputFlag          = false;
     
    9396  m_subDpbIdx = -1;
    9497#endif
     98#if POC_RESET_IDC_DECODER
     99  m_parseIdc = -1;
     100  m_lastPocPeriodId = -1;
     101  m_prevPicOrderCnt = 0;
     102#endif
    95103#if Q0048_CGS_3D_ASYMLUT
    96104  m_pColorMappedPic = NULL;
     
    104112TDecTop::~TDecTop()
    105113{
     114#if Q0078_ADD_LAYER_SETS
     115  for (Int psId = 0; psId < MAX_NUM_SPS; psId++)
     116  {
     117    TComSPS* sps = m_parameterSetManagerDecoder.getSPS(psId);
     118    if (sps != NULL)
     119    {
     120      // Remove parameter set from other layers to prevent multiple deletes of the same object
     121      for (Int lId = 0; lId < m_numLayer; lId++)
     122      {
     123        if (m_ppcTDecTop[lId] != this)
     124        {
     125          m_parameterSetManagerDecoder.removeSPS(psId);
     126        }
     127      }
     128    }
     129  }
     130  for (Int psId = 0; psId < MAX_NUM_PPS; psId++)
     131  {
     132    TComPPS* pps = m_parameterSetManagerDecoder.getPPS(psId);
     133    if (pps != NULL)
     134    {
     135      // Remove parameter set from other layers to prevent multiple deletes of the same object
     136      for (Int lId = 0; lId < m_numLayer; lId++)
     137      {
     138        if (m_ppcTDecTop[lId] != this)
     139        {
     140          m_parameterSetManagerDecoder.removePPS(psId);
     141        }
     142      }
     143    }
     144  }
     145#endif
    106146#if ENC_DEC_TRACE
    107147  fclose( g_hTrace );
     
    225265
    226266        m_cIlpPic[j] = new  TComPic;
     267
    227268#if AUXILIARY_PICTURES
    228269#if REPN_FORMAT_IN_VPS
    229 #if SVC_UPSAMPLING
    230270        m_cIlpPic[j]->create(picWidth, picHeight, slice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, pcSPS, true);
    231271#else
    232         m_cIlpPic[j]->create(picWidth, picHeight, slice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, true);
    233 #endif
    234 #else
    235 #if SVC_UPSAMPLING
    236272        m_cIlpPic[j]->create(pcSPS->getPicWidthInLumaSamples(), pcSPS->getPicHeightInLumaSamples(), pcSPS->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, pcSPS, true);
    237 #else
    238         m_cIlpPic[j]->create(pcSPS->getPicWidthInLumaSamples(), pcSPS->getPicHeightInLumaSamples(), pcSPS->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, true);
    239 #endif
    240273#endif
    241274#else
    242275#if REPN_FORMAT_IN_VPS
    243 #if SVC_UPSAMPLING
    244276        m_cIlpPic[j]->create(picWidth, picHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, pcSPS, true);
    245277#else
    246         m_cIlpPic[j]->create(picWidth, picHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, true);
    247 #endif
    248 #else
    249 #if SVC_UPSAMPLING
    250278        m_cIlpPic[j]->create(pcSPS->getPicWidthInLumaSamples(), pcSPS->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, pcSPS, true);
    251 #else
    252         m_cIlpPic[j]->create(pcSPS->getPicWidthInLumaSamples(), pcSPS->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, true);
    253 #endif
    254279#endif
    255280#endif
     
    393418
    394419          //only for scalable extension
    395 #if SCALABILITY_MASK_E0104
    396           assert( pcSlice->getVPS()->getScalabilityMask(2) == true );
    397 #else
    398           assert( pcSlice->getVPS()->getScalabilityMask(1) == true );
    399 #endif
    400         }
    401       }
    402     }
    403 #endif
    404    
     420          assert( pcSlice->getVPS()->getScalabilityMask( SCALABILITY_ID ) == true );
     421        }
     422      }
     423    }
     424
    405425#if AUXILIARY_PICTURES
    406426#if REPN_FORMAT_IN_VPS
    407 #if SVC_UPSAMPLING
    408427    rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), pcSlice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
    409428                     conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true);
    410429#else
    411     rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), pcSlice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
    412                      conformanceWindow, defaultDisplayWindow, numReorderPics, true);
    413 #endif
    414 #else
    415 #if SVC_UPSAMPLING
    416430    rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), pcSlice->getSPS()->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
    417431                     conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true);
    418 #else
    419     rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), pcSlice->getSPS()->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
    420                      conformanceWindow, defaultDisplayWindow, numReorderPics, true);
    421 #endif
    422432#endif
    423433#else
    424434#if REPN_FORMAT_IN_VPS
    425 #if SVC_UPSAMPLING
    426435    rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
    427436                     conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true);
    428437#else
    429     rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
    430                      conformanceWindow, defaultDisplayWindow, numReorderPics, true);
    431 #endif
    432 #else
    433 #if SVC_UPSAMPLING
    434438    rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
    435439                     conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true);
    436 #else
     440#endif
     441#endif
     442
     443#else //SVC_EXTENSION
    437444    rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
    438445                     conformanceWindow, defaultDisplayWindow, numReorderPics, true);
    439 #endif
    440 #endif
    441 #endif
     446#endif //SVC_EXTENSION
     447   
    442448    m_cListPic.pushBack( rpcPic );
    443449   
     
    478484  rpcPic->destroy();
    479485
     486#if SVC_EXTENSION
    480487#if AUXILIARY_PICTURES
    481488#if REPN_FORMAT_IN_VPS
    482 #if SVC_UPSAMPLING
    483489  rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), pcSlice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
    484490                   conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true);
    485 
    486 #else
    487   rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), pcSlice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
    488                    conformanceWindow, defaultDisplayWindow, numReorderPics, true);
    489 #endif
    490 #else
    491 #if SVC_UPSAMPLING
     491#else
    492492  rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), pcSlice->getSPS()->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
    493493                   conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true);
    494 
    495 #else
    496   rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), pcSlice->getSPS()->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
    497                    conformanceWindow, defaultDisplayWindow, numReorderPics, true);
    498 #endif
    499494#endif
    500495#else
    501496#if REPN_FORMAT_IN_VPS
    502 #if SVC_UPSAMPLING
    503497  rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
    504498                   conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true);
    505499
    506500#else
    507   rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
    508                    conformanceWindow, defaultDisplayWindow, numReorderPics, true);
    509 #endif
    510 #else
    511 #if SVC_UPSAMPLING
    512501  rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
    513502                   conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true);
    514 
    515 #else
     503#endif
     504#endif
     505#else  //SVC_EXTENSION
    516506  rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
    517507                   conformanceWindow, defaultDisplayWindow, numReorderPics, true);
    518 #endif
    519 #endif
    520 #endif
     508#endif //SVC_EXTENSION
    521509}
    522510
     
    793781
    794782#if AUXILIARY_PICTURES
    795 #if SVC_UPSAMPLING
    796783#if AVC_SYNTAX
    797784      pBLPic->create( repFormat->getPicWidthVpsInLumaSamples(), repFormat->getPicHeightVpsInLumaSamples(), repFormat->getChromaFormatVpsIdc(), activeSPS->getMaxCUWidth(), activeSPS->getMaxCUHeight(), activeSPS->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, activeSPS, true);
     
    800787#endif
    801788#else
    802       pBLPic->create( repFormat->getPicWidthVpsInLumaSamples(), repFormat->getPicHeightVpsInLumaSamples(), repFormat->getChromaFormatVpsIdc(), activeSPS->getMaxCUWidth(), activeSPS->getMaxCUHeight(), activeSPS->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, true);
    803 #endif
    804 #else
    805 #if SVC_UPSAMPLING
    806789#if AVC_SYNTAX
    807790      pBLPic->create( repFormat->getPicWidthVpsInLumaSamples(), repFormat->getPicHeightVpsInLumaSamples(), activeSPS->getMaxCUWidth(), activeSPS->getMaxCUHeight(), activeSPS->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, activeSPS, true);
    808791#else
    809792      pBLPic->create( repFormat->getPicWidthVpsInLumaSamples(), repFormat->getPicHeightVpsInLumaSamples(), activeSPS->getMaxCUWidth(), activeSPS->getMaxCUHeight(), activeSPS->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, NULL, true);
    810 #endif
    811 #else
    812       pBLPic->create( repFormat->getPicWidthVpsInLumaSamples(), repFormat->getPicHeightVpsInLumaSamples(), activeSPS->getMaxCUWidth(), activeSPS->getMaxCUHeight(), activeSPS->getMaxCUDepth(), onformanceWindow, defaultDisplayWindow, numReorderPics, true);
    813793#endif
    814794#endif
     
    846826
    847827    // When not present sps_temporal_id_nesting_flag is inferred to be equal to vps_temporal_id_nesting_flag
     828#if Q0177_SPS_TEMP_NESTING_FIX
     829    sps->setTemporalIdNestingFlag( (sps->getMaxTLayers() > 1) ? activeVPS->getTemporalNestingFlag() : true );
     830#else
    848831    sps->setTemporalIdNestingFlag( activeVPS->getTemporalNestingFlag() );
     832#endif
    849833
    850834    // When sps_max_dec_pic_buffering_minus1[ i ] is not present for i in the range of 0 to sps_max_sub_layers_minus1, inclusive, due to nuh_layer_id being greater than 0,
     
    854838      // to avoid compiler warning "array subscript is above array bounds"
    855839      assert( i < MAX_TLAYER );
    856 
     840#if LAYER_DECPICBUFF_PARAM && RESOLUTION_BASED_DPB
     841      sps->setMaxDecPicBuffering( activeVPS->getMaxVpsLayerDecPicBuffMinus1( getCommonDecoderParams()->getTargetOutputLayerSetIdx(), sps->getLayerId(), i) + 1, i);
     842#else
    857843      sps->setMaxDecPicBuffering( activeVPS->getMaxVpsDecPicBufferingMinus1( getCommonDecoderParams()->getTargetOutputLayerSetIdx(), sps->getLayerId(), i) + 1, i);
     844#endif
    858845    }
    859846  }
     
    11221109  }
    11231110#endif
     1111#if POC_RESET_IDC_DECODER
     1112  if( m_parseIdc != -1 ) // Second pass for a POC resetting picture
     1113  {
     1114    m_parseIdc++; // Proceed to POC decoding and RPS derivation
     1115  }
     1116 
     1117  if( m_parseIdc == 2 )
     1118  {
     1119    bNewPOC = false;
     1120  }
     1121
     1122  if( (bNewPOC || m_layerId!=m_uiPrevLayerId) && (m_parseIdc == -1) ) // Will be true at the first pass
     1123  {
     1124  //if (bNewPOC || m_layerId!=m_uiPrevLayerId)
     1125  // Check if new reset period has started - this is needed just so that the SHM decoder which calls slice header decoding twice
     1126  // does not invoke the output twice
     1127  //if( m_lastPocPeriodId[m_apcSlicePilot->getLayerId()] == m_apcSlicePilot->getPocResetPeriodId() )
     1128    // Update CurrAU marking
     1129    if(( m_layerId < m_uiPrevLayerId) ||( ( m_layerId == m_uiPrevLayerId) && bNewPOC)) // Decoding a lower layer than or same layer as previous - mark all earlier pictures as not in current AU
     1130    {
     1131      markAllPicsAsNoCurrAu();
     1132    }
     1133
     1134    if( m_apcSlicePilot->getPocResetIdc() && m_apcSlicePilot->getSliceIdx() == 0 )
     1135    {
     1136      Int pocResetPeriodId = m_apcSlicePilot->getPocResetPeriodId();
     1137      if ( m_apcSlicePilot->getPocResetIdc() == 1 || m_apcSlicePilot->getPocResetIdc() == 2 ||
     1138        ( m_apcSlicePilot->getPocResetIdc() == 3 && pocResetPeriodId != getLastPocPeriodId() ) )
     1139      {
     1140        setLastPocPeriodId(pocResetPeriodId);
     1141        m_parseIdc = 0;
     1142      }
     1143    }
     1144    else
     1145    {
     1146      m_parseIdc = 3; // Proceed to decoding POC and RPS
     1147    } 
     1148  }
     1149#endif
    11241150
    11251151#if ALIGNED_BUMPING
     1152#if POC_RESET_IDC_DECODER
     1153  //if(  (bNewPOC || m_layerId != m_uiPrevLayerId) && ( m_parseIdc != 1) )
     1154  if( m_parseIdc == 1 )
     1155  {
     1156    // Invoke output of pictures if the current picture is a POC reset picture
     1157    bNewPOC = true;
     1158    /* Include reset of all POCs in the layer */
     1159
     1160  // This operation would do the following:
     1161  // 1. Update the other picture in the DPB. This should be done only for the first slice of the picture.
     1162  // 2. Update the value of m_pocCRA.
     1163  // 3. Reset the POC values at the decoder for the current picture to be zero - will be done later
     1164  // 4. update value of POCLastDisplay
     1165     
     1166  //Do the reset stuff here
     1167    Int maxPocLsb = 1 << m_apcSlicePilot->getSPS()->getBitsForPOC();
     1168    Int pocLsbVal;
     1169    if( m_apcSlicePilot->getPocResetIdc() == 3 )
     1170    {
     1171      pocLsbVal = m_apcSlicePilot->getPocLsbVal() ;
     1172    }
     1173    else
     1174    {
     1175      pocLsbVal = (m_apcSlicePilot->getPOC() % maxPocLsb);
     1176    }
     1177
     1178    Int pocMsbDelta = 0;
     1179    if ( m_apcSlicePilot->getPocMsbValPresentFlag() )
     1180    {
     1181      pocMsbDelta = m_apcSlicePilot->getPocMsbVal() * maxPocLsb;
     1182    }
     1183    else
     1184    {
     1185      //This MSB derivation can be made into one function. Item to do next.
     1186      Int prevPoc     = this->getPrevPicOrderCnt();
     1187      Int prevPocLsb  = prevPoc & (maxPocLsb - 1);
     1188      Int prevPocMsb  = prevPoc - prevPocLsb;
     1189
     1190      pocMsbDelta = m_apcSlicePilot->getCurrMsb( pocLsbVal, prevPocLsb, prevPocMsb, maxPocLsb );
     1191    }
     1192
     1193    Int pocLsbDelta;
     1194    if( m_apcSlicePilot->getPocResetIdc() == 2 ||  ( m_apcSlicePilot->getPocResetIdc() == 3 && m_apcSlicePilot->getFullPocResetFlag() ))
     1195    {
     1196      pocLsbDelta = pocLsbVal;
     1197    }
     1198    else
     1199    {
     1200      pocLsbDelta = 0;
     1201    }
     1202
     1203    Int deltaPocVal  =  pocMsbDelta + pocLsbDelta;
     1204
     1205    //Reset all POC for DPB -> basically do it for each slice in the picutre
     1206    TComList<TComPic*>::iterator  iterPic = m_cListPic.begin(); 
     1207
     1208    // Iterate through all picture in DPB
     1209    while( iterPic != m_cListPic.end() )
     1210    {
     1211      TComPic *dpbPic = *iterPic;
     1212      // Check if the picture pointed to by iterPic is either used for reference or
     1213      // needed for output, are in the same layer, and not the current picture.
     1214      if( /*  ( ( dpbPic->getSlice(0)->isReferenced() ) || ( dpbPic->getOutputMark() ) )
     1215          &&*/ ( dpbPic->getLayerId() == m_apcSlicePilot->getLayerId() )
     1216            && ( dpbPic->getReconMark() ) && ( dpbPic->getPicSym()->getSlice(0)->getPicOutputFlag() ))
     1217      {
     1218        for(Int i = dpbPic->getNumAllocatedSlice()-1; i >= 0; i--)
     1219        {
     1220
     1221          TComSlice *slice = dpbPic->getSlice(i);
     1222          TComReferencePictureSet *rps = slice->getRPS();
     1223          slice->setPOC( slice->getPOC() - deltaPocVal );
     1224
     1225          // Also adjust the POC value stored in the RPS of each such slice
     1226          for(Int j = rps->getNumberOfPictures(); j >= 0; j--)
     1227          {
     1228            rps->setPOC( j, rps->getPOC(j) - deltaPocVal );
     1229          }
     1230          // Also adjust the value of refPOC
     1231          for(Int k = 0; k < 2; k++)  // For List 0 and List 1
     1232          {
     1233            RefPicList list = (k == 1) ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
     1234            for(Int j = 0; j < slice->getNumRefIdx(list); j++)
     1235            {
     1236              slice->setRefPOC( slice->getRefPOC(list, j) - deltaPocVal, list, j);
     1237            }
     1238          }
     1239        }
     1240      }
     1241      iterPic++;
     1242    }
     1243    // Update the value of pocCRA
     1244    m_pocCRA -= deltaPocVal;
     1245
     1246    // Update value of POCLastDisplay
     1247    iPOCLastDisplay -= deltaPocVal;
     1248  }
     1249  Int maxPocLsb = 1 << m_apcSlicePilot->getSPS()->getBitsForPOC();
     1250  Int slicePicOrderCntLsb = m_apcSlicePilot->getPicOrderCntLsb();
     1251
     1252  if( m_parseIdc == 1 || m_parseIdc == 2 ) // TODO This should be replaced by pocResettingFlag.
     1253  {
     1254    // Set poc for current slice
     1255    if( m_apcSlicePilot->getPocResetIdc() == 1 )
     1256    {       
     1257      m_apcSlicePilot->setPOC( slicePicOrderCntLsb );
     1258    }
     1259    else if( m_apcSlicePilot->getPocResetIdc() == 2 )
     1260    {
     1261      m_apcSlicePilot->setPOC( 0 );
     1262    }
     1263    else
     1264    {
     1265      Int picOrderCntMsb = m_apcSlicePilot->getCurrMsb( slicePicOrderCntLsb, m_apcSlicePilot->getFullPocResetFlag() ? 0 : m_apcSlicePilot->getPocLsbVal(), 0 , maxPocLsb );
     1266      m_apcSlicePilot->setPOC( picOrderCntMsb + slicePicOrderCntLsb );
     1267    }
     1268  }
     1269  else if (m_parseIdc == 3)
     1270  {
     1271    Int picOrderCntMsb = 0;
     1272    if( m_apcSlicePilot->getPocMsbValPresentFlag() )
     1273    {
     1274      picOrderCntMsb = m_apcSlicePilot->getPocMsbVal() * maxPocLsb;
     1275    }
     1276    else if( m_apcSlicePilot->getIdrPicFlag() )
     1277    {
     1278      picOrderCntMsb = 0;
     1279    }
     1280    else
     1281    {
     1282      Int prevPicOrderCntLsb = this->getPrevPicOrderCnt() & ( maxPocLsb - 1);
     1283      Int prevPicOrderCntMsb  = this->getPrevPicOrderCnt() - prevPicOrderCntLsb;
     1284      picOrderCntMsb = m_apcSlicePilot->getCurrMsb(slicePicOrderCntLsb, prevPicOrderCntLsb, prevPicOrderCntMsb, maxPocLsb );
     1285    }
     1286    m_apcSlicePilot->setPOC( picOrderCntMsb + slicePicOrderCntLsb );
     1287  }
     1288
     1289  if( m_parseIdc == 1 || m_parseIdc == 3)
     1290  {
     1291    // Adjust prevPicOrderCnt
     1292    if(    !m_apcSlicePilot->getRaslPicFlag()
     1293        && !m_apcSlicePilot->getRadlPicFlag()
     1294        && (m_apcSlicePilot->getNalUnitType() % 2 == 1)
     1295        && ( nalu.m_temporalId == 0 )
     1296        && !m_apcSlicePilot->getDiscardableFlag() )
     1297    {
     1298      this->setPrevPicOrderCnt( m_apcSlicePilot->getPOC() );
     1299    }
     1300    else if ( m_apcSlicePilot->getPocResetIdc() == 3 )
     1301    {
     1302      this->setPrevPicOrderCnt( m_apcSlicePilot->getFullPocResetFlag()
     1303                                            ? 0 : m_apcSlicePilot->getPocLsbVal() );
     1304    }
     1305#else
    11261306  if (bNewPOC || m_layerId!=m_uiPrevLayerId)
    11271307  {
     1308#endif
    11281309    m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS());
    11291310  }
    11301311#endif
     1312#if POC_RESET_IDC_DECODER
     1313  if (m_apcSlicePilot->isNextSlice() && (bNewPOC || m_layerId!=m_uiPrevLayerId || m_parseIdc == 1) && !m_bFirstSliceInSequence )
     1314#else
    11311315  if (m_apcSlicePilot->isNextSlice() && (bNewPOC || m_layerId!=m_uiPrevLayerId) && !m_bFirstSliceInSequence )
     1316#endif
    11321317  {
    11331318    m_prevPOC = m_apcSlicePilot->getPOC();
     
    11361321    return true;
    11371322  }
    1138 #else
    1139   //we should only get a different poc for a new picture (with CTU address==0)
    1140   if (m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence && (m_apcSlicePilot->getSliceCurStartCUAddr()!=0))
    1141   {
    1142     printf ("Warning, the first slice of a picture might have been lost!\n");
    1143   }
    1144   // exit when a new picture is found
    1145   if (m_apcSlicePilot->isNextSlice() && (m_apcSlicePilot->getSliceCurStartCUAddr() == 0 && !m_bFirstSliceInPicture) && !m_bFirstSliceInSequence )
    1146   {
    1147     if (m_prevPOC >= m_pocRandomAccess)
    1148     {
    1149       m_prevPOC = m_apcSlicePilot->getPOC();
    1150       return true;
    1151     }
    1152     m_prevPOC = m_apcSlicePilot->getPOC();
    1153   }
    1154 #endif
     1323
     1324#if POC_RESET_IDC_DECODER
     1325  m_parseIdc = -1;
     1326#endif
     1327
    11551328  // actual decoding starts here
    1156   xActivateParameterSets();
    1157 #if !O0223_O0139_IRAP_ALIGN_NO_CONTRAINTS && N0147_IRAP_ALIGN_FLAG
    1158   //Note setting O0223_O0139_IRAP_ALIGN_NO_CONTRAINTS to 0 may cause decoder to crash.
    1159   //When cross_layer_irap_aligned_flag is equal to 0, num_extra_slice_header_bits >=1
    1160   if(!m_apcSlicePilot->getVPS()->getCrossLayerIrapAlignFlag() )
    1161   {
    1162     assert( m_apcSlicePilot->getPPS()->getNumExtraSliceHeaderBits() > 0);
    1163   }
    1164   //When cross_layer_irap_aligned_flag is equal to 1, the value of poc_reset_flag shall be equal to 0 
    1165   if( m_apcSlicePilot->getVPS()->getCrossLayerIrapAlignFlag() )
    1166   {
    1167     assert( m_apcSlicePilot->getPocResetFlag() == 0);
    1168   }
    1169 #endif
     1329    xActivateParameterSets();
     1330
    11701331#if REPN_FORMAT_IN_VPS
    11711332  // Initialize ILRP if needed, only for the current layer 
     
    11771338  {
    11781339    m_prevPOC = m_apcSlicePilot->getPOC();
    1179 #if SVC_EXTENSION
    11801340    curLayerId = m_layerId;
    11811341    m_uiPrevLayerId = m_layerId;
    1182 #endif
    11831342  }
    11841343  m_bFirstSliceInSequence = false;
     
    12491408  }
    12501409#endif
    1251 #if ALIGN_TSA_STSA_PICS
     1410  // Alignment of TSA and STSA pictures across AU
     1411#if !Q0108_TSA_STSA
    12521412  if( m_apcSlicePilot->getLayerId() > 0 )
    12531413  {
     
    12871447  }
    12881448#endif
     1449
     1450#else //SVC_EXTENSION
     1451  //we should only get a different poc for a new picture (with CTU address==0)
     1452  if (m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence && (m_apcSlicePilot->getSliceCurStartCUAddr()!=0))
     1453  {
     1454    printf ("Warning, the first slice of a picture might have been lost!\n");
     1455  }
     1456  // exit when a new picture is found
     1457  if (m_apcSlicePilot->isNextSlice() && (m_apcSlicePilot->getSliceCurStartCUAddr() == 0 && !m_bFirstSliceInPicture) && !m_bFirstSliceInSequence )
     1458  {
     1459    if (m_prevPOC >= m_pocRandomAccess)
     1460    {
     1461      m_prevPOC = m_apcSlicePilot->getPOC();
     1462      return true;
     1463    }
     1464    m_prevPOC = m_apcSlicePilot->getPOC();
     1465  }
     1466
     1467  // actual decoding starts here
     1468  xActivateParameterSets();
     1469
     1470  if (m_apcSlicePilot->isNextSlice())
     1471  {
     1472    m_prevPOC = m_apcSlicePilot->getPOC();
     1473  }
     1474  m_bFirstSliceInSequence = false;
     1475#endif //SVC_EXTENSION
    12891476  //detect lost reference picture and insert copy of earlier frame.
    12901477  Int lostPoc;
     
    13011488      pBLPic->getSlice(0)->setReferenced(true);
    13021489      fstream* pFile  = m_ppcTDecTop[0]->getBLReconFile();
    1303       UInt uiWidth    = pBLPic->getPicYuvRec()->getWidth();
    1304       UInt uiHeight   = pBLPic->getPicYuvRec()->getHeight();
    13051490
    13061491      if( pFile->good() )
    13071492      {
     1493        Bool is16bit  = g_bitDepthYLayer[0] > 8 || g_bitDepthCLayer[0] > 8;
     1494        UInt uiWidth  = pBLPic->getPicYuvRec()->getWidth();
     1495        UInt uiHeight = pBLPic->getPicYuvRec()->getHeight();
     1496
     1497        Int len = uiWidth * (is16bit ? 2 : 1);
     1498        UChar *buf = new UChar[len];
     1499
    13081500        UInt64 uiPos = (UInt64) m_apcSlicePilot->getPOC() * uiWidth * uiHeight * 3 / 2;
     1501        if( is16bit )
     1502        {
     1503            uiPos <<= 1;
     1504        }
    13091505
    13101506        pFile->seekg((UInt)uiPos, ios::beg );
    13111507
     1508        // read Y component
    13121509        Pel* pPel = pBLPic->getPicYuvRec()->getLumaAddr();
    13131510        UInt uiStride = pBLPic->getPicYuvRec()->getStride();
    13141511        for( Int i = 0; i < uiHeight; i++ )
    13151512        {
    1316           for( Int j = 0; j < uiWidth; j++ )
     1513          pFile->read(reinterpret_cast<Char*>(buf), len);
     1514
     1515          if( !is16bit )
    13171516          {
    1318             pPel[j] = pFile->get();
     1517            for (Int x = 0; x < uiWidth; x++)
     1518            {
     1519              pPel[x] = buf[x];
     1520            }
    13191521          }
     1522          else
     1523          {
     1524            for (Int x = 0; x < uiWidth; x++)
     1525            {
     1526              pPel[x] = (buf[2*x+1] << 8) | buf[2*x];
     1527            }
     1528          }
     1529     
    13201530          pPel += uiStride;
    13211531        }
    13221532
     1533        len >>= 1;
     1534        uiWidth >>= 1;
     1535        uiHeight >>= 1;
     1536
     1537        // read Cb component
    13231538        pPel = pBLPic->getPicYuvRec()->getCbAddr();
    13241539        uiStride = pBLPic->getPicYuvRec()->getCStride();
    1325         for( Int i = 0; i < uiHeight/2; i++ )
    1326         {
    1327           for( Int j = 0; j < uiWidth/2; j++ )
     1540        for( Int i = 0; i < uiHeight; i++ )
     1541        {
     1542          pFile->read(reinterpret_cast<Char*>(buf), len);
     1543
     1544          if( !is16bit )
    13281545          {
    1329             pPel[j] = pFile->get();
     1546            for( Int x = 0; x < uiWidth; x++ )
     1547            {
     1548              pPel[x] = buf[x];
     1549            }
    13301550          }
     1551          else
     1552          {
     1553            for( Int x = 0; x < uiWidth; x++ )
     1554            {
     1555              pPel[x] = (buf[2*x+1] << 8) | buf[2*x];
     1556            }
     1557          }
     1558     
    13311559          pPel += uiStride;
    13321560        }
    13331561
     1562        // read Cr component
    13341563        pPel = pBLPic->getPicYuvRec()->getCrAddr();
    13351564        uiStride = pBLPic->getPicYuvRec()->getCStride();
    1336         for( Int i = 0; i < uiHeight/2; i++ )
    1337         {
    1338           for( Int j = 0; j < uiWidth/2; j++ )
     1565        for( Int i = 0; i < uiHeight; i++ )
     1566        {
     1567          pFile->read(reinterpret_cast<Char*>(buf), len);
     1568
     1569          if( !is16bit )
    13391570          {
    1340             pPel[j] = pFile->get();
     1571            for( Int x = 0; x < uiWidth; x++ )
     1572            {
     1573              pPel[x] = buf[x];
     1574            }
    13411575          }
     1576          else
     1577          {
     1578            for( Int x = 0; x < uiWidth; x++ )
     1579            {
     1580              pPel[x] = (buf[2*x+1] << 8) | buf[2*x];
     1581            }
     1582          }
     1583     
    13421584          pPel += uiStride;
    13431585        }
     1586
     1587        delete[] buf;
    13441588      }
    13451589    }
     
    13651609    //  Get a new picture buffer
    13661610    xGetNewPicBuffer (m_apcSlicePilot, pcPic);
     1611
     1612#if POC_RESET_IDC_DECODER
     1613  pcPic->setCurrAuFlag( true );
     1614#endif
    13671615
    13681616    Bool isField = false;
     
    15431791      {
    15441792        UInt refLayerIdc = i;
     1793        UInt refLayerId = pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc);
    15451794#if AVC_BASE
    1546         if( pcSlice->getVPS()->getRefLayerId( m_layerId, refLayerIdc ) == 0 && m_parameterSetManagerDecoder.getActiveVPS()->getAvcBaseLayerFlag() )
     1795        if( refLayerId == 0 && m_parameterSetManagerDecoder.getActiveVPS()->getAvcBaseLayerFlag() )
    15471796        {         
    15481797          TComPic* pic = *m_ppcTDecTop[0]->getListPic()->begin();
     
    15931842
    15941843#if O0098_SCALED_REF_LAYER_ID
    1595         const Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc));
     1844        const Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindowForLayer(refLayerId);
    15961845#else
    15971846        const Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc);
     
    16271876        }
    16281877#endif
    1629 #if SVC_UPSAMPLING
     1878#if SVC_EXTENSION
    16301879        if( pcPic->isSpatialEnhLayer(refLayerIdc) )
    1631         {   
     1880        {
     1881          // check for the sample prediction picture type
     1882          if( m_ppcTDecTop[m_layerId]->getSamplePredEnabledFlag(refLayerId) )
     1883          {
    16321884#if O0215_PHASE_ALIGNMENT
    16331885#if O0194_JOINT_US_BITSHIFT
    16341886#if Q0048_CGS_3D_ASYMLUT
    1635           m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), pcSlice->getVPS()->getPhaseAlignFlag() );
    1636 #else
    1637           m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getVPS()->getPhaseAlignFlag() );
     1887            m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), pcSlice->getVPS()->getPhaseAlignFlag() );
     1888#else
     1889            m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getVPS()->getPhaseAlignFlag() );
    16381890#endif
    16391891#else
    16401892#if Q0048_CGS_3D_ASYMLUT
    1641           m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc), pcSlice->getVPS()->getPhaseAlignFlag() );
    1642 #else
    1643           m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() );
     1893            m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc), pcSlice->getVPS()->getPhaseAlignFlag() );
     1894#else
     1895            m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() );
    16441896#endif
    16451897#endif
     
    16471899#if O0194_JOINT_US_BITSHIFT
    16481900#if Q0048_CGS_3D_ASYMLUT
    1649           m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL );
    1650 #else
    1651           m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL );
     1901            m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL );
     1902#else
     1903            m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL );
    16521904#endif
    16531905#else
    16541906#if Q0048_CGS_3D_ASYMLUT
    1655           m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL );
    1656 #else
    1657           m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL );
    1658 #endif
    1659 #endif
    1660 #endif
     1907            m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL );
     1908#else
     1909            m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL );
     1910#endif
     1911#endif
     1912#endif
     1913          }
    16611914        }
    16621915        else
     
    16651918        }
    16661919        pcSlice->setFullPelBaseRec ( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc) );
    1667 #endif
     1920#endif //SVC_EXTENSION
    16681921      }
    16691922    }
     
    17321985    if( pcSlice->getMFMEnabledFlag() )
    17331986    {
    1734       Int refLayerId = pcSlice->getRefPic( pcSlice->getSliceType() == B_SLICE ? ( RefPicList )( 1 - pcSlice->getColFromL0Flag() ) : REF_PIC_LIST_0 , pcSlice->getColRefIdx() )->getLayerId();
     1987      TComPic* refPic = pcSlice->getRefPic( pcSlice->getSliceType() == B_SLICE ? ( RefPicList )( 1 - pcSlice->getColFromL0Flag() ) : REF_PIC_LIST_0 , pcSlice->getColRefIdx() );
     1988
     1989      assert( refPic );
     1990
     1991      Int refLayerId = refPic->getLayerId();
     1992
    17351993      if( refLayerId != pcSlice->getLayerId() )
    17361994      {
     
    17422000#endif
    17432001   
    1744 #if N0147_IRAP_ALIGN_FLAG
    17452002    if( m_layerId > 0 && pcSlice->getVPS()->getCrossLayerIrapAlignFlag() )
    17462003    {
     
    17582015      }
    17592016    }
    1760 #endif
     2017
     2018    if( m_layerId > 0 && !pcSlice->isIntra() && pcSlice->getEnableTMVPFlag() )
     2019    {
     2020      TComPic* refPic = pcSlice->getRefPic(RefPicList(1 - pcSlice->getColFromL0Flag()), pcSlice->getColRefIdx());
     2021
     2022      assert( refPic );
     2023
     2024      // It is a requirement of bitstream conformance when the collocated picture, used for temporal motion vector prediction, is an inter-layer reference picture,
     2025      // VpsInterLayerMotionPredictionEnabled[ LayerIdxInVps[ currLayerId ] ][ LayerIdxInVps[ rLId ] ] shall be equal to 1, where rLId is set equal to nuh_layer_id of the inter-layer picture.
     2026      if( refPic->isILR(pcSlice->getLayerId()) )
     2027      {
     2028        assert( m_ppcTDecTop[m_layerId]->getMotionPredEnabledFlag(refPic->getLayerId()) );
     2029      }
     2030    }
    17612031#endif //SVC_EXTENSION
    17622032   
     
    18562126#endif
    18572127  m_parameterSetManagerDecoder.storePrefetchedSPS(sps);
     2128#if Q0078_ADD_LAYER_SETS
     2129  // Store SPS for all layers
     2130  for (Int lId = 0; lId < m_numLayer; lId++)
     2131  {
     2132    if (m_ppcTDecTop[lId] != this)
     2133    {
     2134      m_ppcTDecTop[lId]->getParameterSetManager()->storePrefetchedSPS(sps);
     2135    }
     2136  }
     2137#endif
    18582138#if !REPN_FORMAT_IN_VPS   // ILRP can only be initialized at activation 
    18592139  if(m_numLayer>0)
     
    18862166    );
    18872167  m_parameterSetManagerDecoder.storePrefetchedPPS( pps );
     2168#if Q0078_ADD_LAYER_SETS
     2169  // Store PPS for all layers
     2170  for (Int lId = 0; lId < m_numLayer; lId++)
     2171  {
     2172    if (m_ppcTDecTop[lId] != this)
     2173    {
     2174      m_ppcTDecTop[lId]->getParameterSetManager()->storePrefetchedPPS(pps);
     2175    }
     2176  }
     2177#endif
    18882178
    18892179  if( pps->getDependentSliceSegmentsEnabledFlag() )
     
    19062196  if(nalUnitType == NAL_UNIT_SUFFIX_SEI)
    19072197  {
    1908 #if RANDOM_ACCESS_SEI_FIX
    19092198    if (m_prevSliceSkipped) // No need to decode SEI messages of a skipped access unit
    19102199    {
    19112200      return;
    19122201    }
    1913 #endif
    19142202#if LAYERS_NOT_PRESENT_SEI
    19152203    m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveVPS(), m_parameterSetManagerDecoder.getActiveSPS() );
     
    19912279  {
    19922280    case NAL_UNIT_VPS:
    1993 #if VPS_NUH_LAYER_ID
     2281#if SVC_EXTENSION
    19942282      assert( nalu.m_layerId == 0 ); // Non-conforming bitstream. The value of nuh_layer_id of VPS NAL unit shall be equal to 0.
    19952283#endif
    19962284      xDecodeVPS();
     2285#if Q0177_EOS_CHECKS
     2286      m_isLastNALWasEos = false;
     2287#endif
    19972288#if AVC_BASE
    19982289      if( m_parameterSetManagerDecoder.getPrefetchedVPS(0)->getAvcBaseLayerFlag() )
     
    20332324    case NAL_UNIT_PREFIX_SEI:
    20342325    case NAL_UNIT_SUFFIX_SEI:
     2326#if Q0177_EOS_CHECKS
     2327      if ( nalu.m_nalUnitType == NAL_UNIT_SUFFIX_SEI )
     2328      {
     2329        assert( m_isLastNALWasEos == false );
     2330      }
     2331#endif
    20352332      xDecodeSEI( nalu.m_Bitstream, nalu.m_nalUnitType );
    20362333      return false;
     
    20522349    case NAL_UNIT_CODED_SLICE_RASL_N:
    20532350    case NAL_UNIT_CODED_SLICE_RASL_R:
     2351#if Q0177_EOS_CHECKS
     2352      if (nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_TRAIL_R || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_TRAIL_N ||
     2353          nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_TSA_R || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_TSA_N ||
     2354          nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA_R || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA_N ||
     2355          nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N ||
     2356          nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N )
     2357      {
     2358        assert( m_isLastNALWasEos == false );
     2359      }
     2360      else
     2361      {
     2362        m_isLastNALWasEos = false;
     2363      }
     2364#endif
    20542365#if SVC_EXTENSION
    20552366      return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay, curLayerId, bNewPOC);
     
    20602371     
    20612372    case NAL_UNIT_EOS:
     2373#if Q0177_EOS_CHECKS
     2374      assert( m_isLastNALWasEos == false );
     2375      //Check layer id of the nalu. if it is not 0, give a warning message and just return without doing anything.
     2376      if (nalu.m_layerId > 0)
     2377      {
     2378        printf( "\nThis bitstream has EOS with non-zero layer id.\n" );
     2379        return false;
     2380      }
     2381      m_isLastNALWasEos = true;
     2382#endif
    20622383      m_associatedIRAPType = NAL_UNIT_INVALID;
    20632384      m_pocCRA = 0;
     
    20852406     
    20862407    case NAL_UNIT_FILLER_DATA:
     2408#if Q0177_EOS_CHECKS
     2409      assert( m_isLastNALWasEos == false );
     2410#endif
    20872411      return false;
    20882412     
     
    22562580    }
    22572581  }
    2258   for ( Int i = 1, mIdx = 0, sIdx = 0; i < m_numLayer; i++ )
    2259   {
     2582  for( Int i = 1; i < m_numLayer; i++ )
     2583  {
     2584    Int mIdx = 0, sIdx = 0;
    22602585    Int iNuhLId = vps->getLayerIdInNuh(i);
    22612586    TDecTop *decTop = (TDecTop *)getLayerDec(iNuhLId);
     
    23922717}
    23932718#endif
    2394 
     2719#if POC_RESET_IDC_DECODER
     2720Void TDecTop::markAllPicsAsNoCurrAu()
     2721{
     2722  for(Int i = 0; i < MAX_LAYERS; i++)
     2723  {
     2724    TComList<TComPic*>* listPic = this->getLayerDec(i)->getListPic();
     2725    TComList<TComPic*>::iterator  iterPic = listPic->begin();
     2726    while ( iterPic != listPic->end() )
     2727    {
     2728      TComPic *pcPic = *(iterPic);
     2729      pcPic->setCurrAuFlag( false );
     2730      iterPic++;
     2731    }
     2732  }
     2733}
     2734#endif
    23952735#if Q0048_CGS_3D_ASYMLUT
    23962736Void TDecTop::initAsymLut(TComSlice *pcSlice)
  • trunk/source/Lib/TLibDecoder/TDecTop.h

    r713 r815  
    162162  Bool                    m_craNoRaslOutputFlag;    //value of variable NoRaslOutputFlag of the last CRA pic
    163163#endif
     164#if Q0177_EOS_CHECKS
     165  Bool                    m_isLastNALWasEos;
     166#endif
    164167
    165168#if SVC_EXTENSION
     
    201204  Bool                    m_firstPicInLayerDecodedFlag;
    202205#endif
     206#if POC_RESET_IDC_DECODER
     207  Int                     m_parseIdc;
     208  Int                     m_lastPocPeriodId;
     209  Int                     m_prevPicOrderCnt;
     210#endif
    203211#if RESOLUTION_BASED_DPB
    204212  Int                     m_subDpbIdx;     // Index to the sub-DPB that the layer belongs to.
     
    241249#if EARLY_REF_PIC_MARKING
    242250  Void earlyPicMarking(Int maxTemporalLayer, std::vector<Int>& targetDecLayerIdList);
     251#endif
     252#if POC_RESET_IDC_DECODER
     253  Int getParseIdc() { return m_parseIdc;}
     254  Void        setParseIdc(Int x) { m_parseIdc = x;}
     255  Void        markAllPicsAsNoCurrAu();
     256
     257  Int   getLastPocPeriodId() { return m_lastPocPeriodId; }
     258  Void  setLastPocPeriodId(Int x)    { m_lastPocPeriodId = x; }
     259
     260  Int   getPrevPicOrderCnt() { return m_prevPicOrderCnt; }
     261  Void  setPrevPicOrderCnt(Int const x) { m_prevPicOrderCnt = x; }
    243262#endif
    244263  UInt      getLayerId            () { return m_layerId;              }
Note: See TracChangeset for help on using the changeset viewer.