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


Ignore:
Timestamp:
25 Mar 2014, 21:51:30 (11 years ago)
Author:
seregin
Message:

merge with SHM-5.1-dev branch

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/source

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

    r595 r644  
    111111#endif
    112112#if SUB_BITSTREAM_PROPERTY_SEI
    113     case SEI::SUB_BITSTREAM_PROPERTY:
    114       fprintf( g_hTrace, "=========== Sub-bitstream property SEI message ===========\n");
    115       break;
     113  case SEI::SUB_BITSTREAM_PROPERTY:
     114    fprintf( g_hTrace, "=========== Sub-bitstream property SEI message ===========\n");
     115    break;
     116#endif
     117#if O0164_MULTI_LAYER_HRD
     118  case SEI::BSP_NESTING:
     119    fprintf( g_hTrace, "=========== Bitstream parition nesting SEI message ===========\n");
     120    break;
     121  case SEI::BSP_INITIAL_ARRIVAL_TIME:
     122    fprintf( g_hTrace, "=========== Bitstream parition initial arrival time SEI message ===========\n");
     123    break;
     124  case SEI::BSP_HRD:
     125    fprintf( g_hTrace, "=========== Bitstream parition HRD parameters SEI message ===========\n");
     126    break;
    116127#endif
    117128#endif //SVC_EXTENSION
     
    152163}
    153164
     165#if O0164_MULTI_LAYER_HRD
     166#if LAYERS_NOT_PRESENT_SEI
     167Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps, const SEIScalableNesting *nestingSei, const SEIBspNesting *bspNestingSei)
     168#else
     169Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps, const SEIScalableNesting *nestingSei)
     170#endif
     171#else
    154172#if LAYERS_NOT_PRESENT_SEI
    155173Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps)
    156174#else
    157175Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps)
     176#endif
    158177#endif
    159178{
     
    272291      xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, sps);
    273292#endif
     293      break;
    274294#if SVC_EXTENSION
    275295#if LAYERS_NOT_PRESENT_SEI
     
    296316     sei = new SEISubBitstreamProperty;
    297317     xParseSEISubBitstreamProperty((SEISubBitstreamProperty&) *sei);
     318     break;
     319#endif
     320#if O0164_MULTI_LAYER_HRD
     321   case SEI::BSP_NESTING:
     322     sei = new SEIBspNesting;
     323#if LAYERS_NOT_PRESENT_SEI
     324     xParseSEIBspNesting((SEIBspNesting&) *sei, nalUnitType, vps, sps, *nestingSei);
     325#else
     326     xParseSEIBspNesting((SEIBspNesting&) *sei, nalUnitType, sps, *nestingSei);
     327#endif
     328     break;
     329   case SEI::BSP_INITIAL_ARRIVAL_TIME:
     330     sei = new SEIBspInitialArrivalTime;
     331     xParseSEIBspInitialArrivalTime((SEIBspInitialArrivalTime&) *sei, vps, sps, *nestingSei, *bspNestingSei);
     332     break;
     333   case SEI::BSP_HRD:
     334     sei = new SEIBspHrd;
     335     xParseSEIBspHrd((SEIBspHrd&) *sei, sps, *nestingSei);
    298336     break;
    299337#endif
     
    380418}
    381419
     420#if P0138_USE_ALT_CPB_PARAMS_FLAG
     421/**
     422 * Check if SEI message contains payload extension
     423 */
     424Bool SEIReader::xPayloadExtensionPresent()
     425{
     426  Int payloadBitsRemaining = getBitstream()->getNumBitsLeft();
     427  Bool payloadExtensionPresent = false;
     428
     429  if (payloadBitsRemaining > 8)
     430  {
     431    payloadExtensionPresent = true;
     432  }
     433  else
     434  {
     435    Int finalBits = getBitstream()->peekBits(payloadBitsRemaining);
     436    while (payloadBitsRemaining && (finalBits & 1) == 0)
     437    {
     438      payloadBitsRemaining--;
     439      finalBits >>= 1;
     440    }
     441    payloadBitsRemaining--;
     442    if (payloadBitsRemaining > 0)
     443    {
     444      payloadExtensionPresent = true;
     445    }
     446  }
     447
     448  return payloadExtensionPresent;
     449}
     450#endif
     451
    382452/**
    383453 * parse bitstream bs and unpack a user_data_unregistered SEI message
     
    536606    }
    537607  }
     608
     609#if P0138_USE_ALT_CPB_PARAMS_FLAG
     610  sei.m_useAltCpbParamsFlag = false;
     611  sei.m_useAltCpbParamsFlagPresent = false;
     612  if (xPayloadExtensionPresent())
     613  {
     614    READ_FLAG (code, "use_alt_cpb_params_flag");
     615    sei.m_useAltCpbParamsFlag = code;
     616    sei.m_useAltCpbParamsFlagPresent = true;
     617  }
     618#endif
     619
    538620  xParseByteAlign();
    539621}
     
    826908  // read nested SEI messages
    827909  do {
     910#if O0164_MULTI_LAYER_HRD
     911#if LAYERS_NOT_PRESENT_SEI
     912    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, vps, sps, &sei);
     913#else
     914    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps, &sei);
     915#endif
     916#else
    828917#if LAYERS_NOT_PRESENT_SEI
    829918    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, vps, sps);
    830919#else
    831920    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps);
     921#endif
    832922#endif
    833923  } while (m_pcBitstream->getNumBitsLeft() > 8);
     
    9301020}
    9311021#endif
     1022
     1023#if O0164_MULTI_LAYER_HRD
     1024#if LAYERS_NOT_PRESENT_SEI
     1025Void SEIReader::xParseSEIBspNesting(SEIBspNesting &sei, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei)
     1026#else
     1027Void SEIReader::xParseSEIBspNesting(SEIBspNesting &sei, const NalUnitType nalUnitType, TComSPS *sps, const SEIScalableNesting &nestingSei)
     1028#endif
     1029{
     1030  UInt uiCode;
     1031  READ_UVLC( uiCode, "bsp_idx" ); sei.m_bspIdx = uiCode;
     1032
     1033  // byte alignment
     1034  while ( m_pcBitstream->getNumBitsRead() % 8 != 0 )
     1035  {
     1036    UInt code;
     1037    READ_FLAG( code, "bsp_nesting_zero_bit" );
     1038  }
     1039
     1040  sei.m_callerOwnsSEIs = false;
     1041
     1042  // read nested SEI messages
     1043  do {
     1044#if LAYERS_NOT_PRESENT_SEI
     1045    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, vps, sps, &nestingSei, &sei);
     1046#else
     1047    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps, &nestingSei);
     1048#endif
     1049  } while (m_pcBitstream->getNumBitsLeft() > 8);
     1050}
     1051
     1052Void SEIReader::xParseSEIBspInitialArrivalTime(SEIBspInitialArrivalTime &sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei, const SEIBspNesting &bspNestingSei)
     1053{
     1054  assert(vps->getVpsVuiPresentFlag());
     1055
     1056  UInt schedCombCnt = vps->getNumBspSchedCombinations(nestingSei.m_nestingOpIdx[0]);
     1057  UInt len;
     1058  UInt hrdIdx;
     1059  UInt uiCode;
     1060
     1061  if (schedCombCnt > 0)
     1062  {
     1063    hrdIdx = vps->getBspCombHrdIdx(nestingSei.m_nestingOpIdx[0], 0, bspNestingSei.m_bspIdx);
     1064  }
     1065  else
     1066  {
     1067    hrdIdx = 0;
     1068  }
     1069
     1070  TComHRD *hrd = vps->getBspHrd(hrdIdx);
     1071
     1072  if (hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag())
     1073  {
     1074    len = hrd->getInitialCpbRemovalDelayLengthMinus1() + 1;
     1075  }
     1076  else
     1077  {
     1078    len = 23 + 1;
     1079  }
     1080
     1081  if (hrd->getNalHrdParametersPresentFlag())
     1082  {
     1083    for(UInt i = 0; i < schedCombCnt; i++)
     1084    {
     1085      READ_CODE( len, uiCode, "nal_initial_arrival_delay" ); sei.m_nalInitialArrivalDelay[i] = uiCode;
     1086    }
     1087  }
     1088  else
     1089  {
     1090    for(UInt i = 0; i < schedCombCnt; i++)
     1091    {
     1092      READ_CODE( len, uiCode, "vcl_initial_arrival_delay" ); sei.m_vclInitialArrivalDelay[i] = uiCode;
     1093    }
     1094  }
     1095}
     1096
     1097Void SEIReader::xParseSEIBspHrd(SEIBspHrd &sei, TComSPS *sps, const SEIScalableNesting &nestingSei)
     1098{
     1099  UInt uiCode;
     1100  READ_UVLC( uiCode, "sei_num_bsp_hrd_parameters_minus1" ); sei.m_seiNumBspHrdParametersMinus1 = uiCode;
     1101  for (UInt i = 0; i <= sei.m_seiNumBspHrdParametersMinus1; i++)
     1102  {
     1103    if (i > 0)
     1104    {
     1105      READ_FLAG( uiCode, "sei_bsp_cprms_present_flag" ); sei.m_seiBspCprmsPresentFlag[i] = uiCode;
     1106    }
     1107    xParseHrdParameters(sei.hrd, i==0 ? 1 : sei.m_seiBspCprmsPresentFlag[i], nestingSei.m_nestingMaxTemporalIdPlus1[0]-1);
     1108  }
     1109  for (UInt h = 0; h <= nestingSei.m_nestingNumOpsMinus1; h++)
     1110  {
     1111    UInt lsIdx = nestingSei.m_nestingOpIdx[h];
     1112    READ_UVLC( uiCode, "num_sei_bitstream_partitions_minus1[i]"); sei.m_seiNumBitstreamPartitionsMinus1[lsIdx] = uiCode;
     1113    for (UInt i = 0; i <= sei.m_seiNumBitstreamPartitionsMinus1[lsIdx]; i++)
     1114    {
     1115      for (UInt j = 0; j < sei.m_vpsMaxLayers; j++)
     1116      {
     1117        if (sei.m_layerIdIncludedFlag[lsIdx][j])
     1118        {
     1119          READ_FLAG( uiCode, "sei_layer_in_bsp_flag[lsIdx][i][j]" ); sei.m_seiLayerInBspFlag[lsIdx][i][j] = uiCode;
     1120        }
     1121      }
     1122    }
     1123    READ_UVLC( uiCode, "sei_num_bsp_sched_combinations_minus1[i]"); sei.m_seiNumBspSchedCombinationsMinus1[lsIdx] = uiCode;
     1124    for (UInt i = 0; i <= sei.m_seiNumBspSchedCombinationsMinus1[lsIdx]; i++)
     1125    {
     1126      for (UInt j = 0; j <= sei.m_seiNumBitstreamPartitionsMinus1[lsIdx]; j++)
     1127      {
     1128        READ_UVLC( uiCode, "sei_bsp_comb_hrd_idx[lsIdx][i][j]"); sei.m_seiBspCombHrdIdx[lsIdx][i][j] = uiCode;
     1129        READ_UVLC( uiCode, "sei_bsp_comb_sched_idx[lsIdx][i][j]"); sei.m_seiBspCombScheddx[lsIdx][i][j] = uiCode;
     1130      }
     1131    }
     1132  }
     1133}
     1134
     1135Void SEIReader::xParseHrdParameters(TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1)
     1136{
     1137  UInt  uiCode;
     1138  if( commonInfPresentFlag )
     1139  {
     1140    READ_FLAG( uiCode, "nal_hrd_parameters_present_flag" );           hrd->setNalHrdParametersPresentFlag( uiCode == 1 ? true : false );
     1141    READ_FLAG( uiCode, "vcl_hrd_parameters_present_flag" );           hrd->setVclHrdParametersPresentFlag( uiCode == 1 ? true : false );
     1142    if( hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag() )
     1143    {
     1144      READ_FLAG( uiCode, "sub_pic_cpb_params_present_flag" );         hrd->setSubPicCpbParamsPresentFlag( uiCode == 1 ? true : false );
     1145      if( hrd->getSubPicCpbParamsPresentFlag() )
     1146      {
     1147        READ_CODE( 8, uiCode, "tick_divisor_minus2" );                hrd->setTickDivisorMinus2( uiCode );
     1148        READ_CODE( 5, uiCode, "du_cpb_removal_delay_length_minus1" ); hrd->setDuCpbRemovalDelayLengthMinus1( uiCode );
     1149        READ_FLAG( uiCode, "sub_pic_cpb_params_in_pic_timing_sei_flag" ); hrd->setSubPicCpbParamsInPicTimingSEIFlag( uiCode == 1 ? true : false );
     1150        READ_CODE( 5, uiCode, "dpb_output_delay_du_length_minus1"  ); hrd->setDpbOutputDelayDuLengthMinus1( uiCode );
     1151      }
     1152      READ_CODE( 4, uiCode, "bit_rate_scale" );                       hrd->setBitRateScale( uiCode );
     1153      READ_CODE( 4, uiCode, "cpb_size_scale" );                       hrd->setCpbSizeScale( uiCode );
     1154      if( hrd->getSubPicCpbParamsPresentFlag() )
     1155      {
     1156        READ_CODE( 4, uiCode, "cpb_size_du_scale" );                  hrd->setDuCpbSizeScale( uiCode );
     1157      }
     1158      READ_CODE( 5, uiCode, "initial_cpb_removal_delay_length_minus1" ); hrd->setInitialCpbRemovalDelayLengthMinus1( uiCode );
     1159      READ_CODE( 5, uiCode, "au_cpb_removal_delay_length_minus1" );      hrd->setCpbRemovalDelayLengthMinus1( uiCode );
     1160      READ_CODE( 5, uiCode, "dpb_output_delay_length_minus1" );       hrd->setDpbOutputDelayLengthMinus1( uiCode );
     1161    }
     1162  }
     1163  Int i, j, nalOrVcl;
     1164  for( i = 0; i <= maxNumSubLayersMinus1; i ++ )
     1165  {
     1166    READ_FLAG( uiCode, "fixed_pic_rate_general_flag" );                     hrd->setFixedPicRateFlag( i, uiCode == 1 ? true : false  );
     1167    if( !hrd->getFixedPicRateFlag( i ) )
     1168    {
     1169      READ_FLAG( uiCode, "fixed_pic_rate_within_cvs_flag" );                hrd->setFixedPicRateWithinCvsFlag( i, uiCode == 1 ? true : false  );
     1170    }
     1171    else
     1172    {
     1173      hrd->setFixedPicRateWithinCvsFlag( i, true );
     1174    }
     1175    hrd->setLowDelayHrdFlag( i, 0 ); // Infered to be 0 when not present
     1176    hrd->setCpbCntMinus1   ( i, 0 ); // Infered to be 0 when not present
     1177    if( hrd->getFixedPicRateWithinCvsFlag( i ) )
     1178    {
     1179      READ_UVLC( uiCode, "elemental_duration_in_tc_minus1" );             hrd->setPicDurationInTcMinus1( i, uiCode );
     1180    }
     1181    else
     1182    {
     1183      READ_FLAG( uiCode, "low_delay_hrd_flag" );                      hrd->setLowDelayHrdFlag( i, uiCode == 1 ? true : false  );
     1184    }
     1185    if (!hrd->getLowDelayHrdFlag( i ))
     1186    {
     1187      READ_UVLC( uiCode, "cpb_cnt_minus1" );                          hrd->setCpbCntMinus1( i, uiCode );
     1188    }
     1189    for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ )
     1190    {
     1191      if( ( ( nalOrVcl == 0 ) && ( hrd->getNalHrdParametersPresentFlag() ) ) ||
     1192          ( ( nalOrVcl == 1 ) && ( hrd->getVclHrdParametersPresentFlag() ) ) )
     1193      {
     1194        for( j = 0; j <= ( hrd->getCpbCntMinus1( i ) ); j ++ )
     1195        {
     1196          READ_UVLC( uiCode, "bit_rate_value_minus1" );             hrd->setBitRateValueMinus1( i, j, nalOrVcl, uiCode );
     1197          READ_UVLC( uiCode, "cpb_size_value_minus1" );             hrd->setCpbSizeValueMinus1( i, j, nalOrVcl, uiCode );
     1198          if( hrd->getSubPicCpbParamsPresentFlag() )
     1199          {
     1200            READ_UVLC( uiCode, "cpb_size_du_value_minus1" );       hrd->setDuCpbSizeValueMinus1( i, j, nalOrVcl, uiCode );
     1201            READ_UVLC( uiCode, "bit_rate_du_value_minus1" );       hrd->setDuBitRateValueMinus1( i, j, nalOrVcl, uiCode );
     1202          }
     1203          READ_FLAG( uiCode, "cbr_flag" );                          hrd->setCbrFlag( i, j, nalOrVcl, uiCode == 1 ? true : false  );
     1204        }
     1205      }
     1206    }
     1207  }
     1208}
     1209#endif
     1210
    9321211#endif //SVC_EXTENSION
    9331212
  • trunk/source/Lib/TLibDecoder/SEIread.h

    r595 r644  
    6262#endif
    6363protected:
     64#if O0164_MULTI_LAYER_HRD
     65#if LAYERS_NOT_PRESENT_SEI
     66  Void xReadSEImessage                (SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps, const SEIScalableNesting *nestingSei=NULL, const SEIBspNesting *bspNestingSei=NULL);
     67#else
     68  Void xReadSEImessage                (SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps, const SEIScalableNesting *nestingSei=NULL);
     69#endif
     70#else
    6471#if LAYERS_NOT_PRESENT_SEI
    6572  Void xReadSEImessage                (SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps);
    6673#else
    6774  Void xReadSEImessage                (SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps);
     75#endif
     76#endif
     77#if P0138_USE_ALT_CPB_PARAMS_FLAG
     78  Bool xPayloadExtensionPresent       ();
    6879#endif
    6980  Void xParseSEIuserDataUnregistered  (SEIuserDataUnregistered &sei, UInt payloadSize);
     
    92103  Void xParseSEIScalableNesting       (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComSPS *sps);
    93104#endif
     105#if O0164_MULTI_LAYER_HRD
     106#if LAYERS_NOT_PRESENT_SEI
     107  Void xParseSEIBspNesting(SEIBspNesting &sei, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei);
     108#else
     109  Void xParseSEIBspNesting(SEIBspNesting &sei, const NalUnitType nalUnitType, TComSPS *sps, const SEIScalableNesting &nestingSei);
     110#endif
     111  Void xParseSEIBspInitialArrivalTime(SEIBspInitialArrivalTime &sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei, const SEIBspNesting &bspNestingSei);
     112  Void xParseSEIBspHrd(SEIBspHrd &sei, TComSPS *sps, const SEIScalableNesting &nestingSei);
     113  Void xParseHrdParameters(TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1);
     114#endif
    94115  Void xParseByteAlign();
    95116};
  • trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r595 r644  
    334334  if (uiCode)
    335335  {
     336#if P0166_MODIFIED_PPS_EXTENSION
     337    UInt ppsExtensionTypeFlag[8];
     338    for (UInt i = 0; i < 8; i++)
     339    {
     340      READ_FLAG( ppsExtensionTypeFlag[i], "pps_extension_type_flag" );
     341    }
     342#if !POC_RESET_IDC
     343    if (ppsExtensionTypeFlag[1])
     344    {
     345#else
     346    if( ppsExtensionTypeFlag[0] )
     347    {
     348      READ_FLAG( uiCode, "poc_reset_info_present_flag" );
     349      pcPPS->setPocResetInfoPresentFlag(uiCode ? true : false);
     350#endif
     351    }
     352    if (ppsExtensionTypeFlag[7])
     353    {
     354#endif
     355
    336356    while ( xMoreRbspData() )
    337357    {
    338358      READ_FLAG( uiCode, "pps_extension_data_flag");
    339359    }
     360#if P0166_MODIFIED_PPS_EXTENSION
     361    }
     362#endif
    340363  }
    341364}
     
    514537}
    515538
    516 #if SVC_EXTENSION
     539#if SVC_EXTENSION && !SPS_DPB_PARAMS
    517540Void TDecCavlc::parseSPS(TComSPS* pcSPS, ParameterSetManagerDecoder *parameterSetManager)
    518541#else
     
    536559#if SVC_EXTENSION
    537560  }
     561#if !SPS_DPB_PARAMS
    538562  else
    539563  {
     
    542566  }
    543567#endif
     568#endif
     569
    544570  if ( pcSPS->getMaxTLayers() == 1 )
    545571  {
    546572    // sps_temporal_id_nesting_flag must be 1 when sps_max_sub_layers_minus1 is 0
    547573#if SVC_EXTENSION
     574#if !SPS_DPB_PARAMS
    548575    assert( pcSPS->getTemporalIdNestingFlag() == true );
     576#endif
    549577#else
    550578    assert( uiCode == 1 );
     
    644672  assert(uiCode <= 12);
    645673
    646   UInt subLayerOrderingInfoPresentFlag;
    647   READ_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag");
    648 
    649   for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++)
    650   {
    651     READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1");
    652     pcSPS->setMaxDecPicBuffering( uiCode + 1, i);
    653     READ_UVLC ( uiCode, "sps_num_reorder_pics" );
    654     pcSPS->setNumReorderPics(uiCode, i);
    655     READ_UVLC ( uiCode, "sps_max_latency_increase_plus1");
    656     pcSPS->setMaxLatencyIncrease( uiCode, i );
    657 
    658     if (!subLayerOrderingInfoPresentFlag)
    659     {
    660       for (i++; i <= pcSPS->getMaxTLayers()-1; i++)
    661       {
    662         pcSPS->setMaxDecPicBuffering(pcSPS->getMaxDecPicBuffering(0), i);
    663         pcSPS->setNumReorderPics(pcSPS->getNumReorderPics(0), i);
    664         pcSPS->setMaxLatencyIncrease(pcSPS->getMaxLatencyIncrease(0), i);
    665       }
    666       break;
    667     }
    668   }
    669 
     674#if SPS_DPB_PARAMS
     675  if( pcSPS->getLayerId() == 0 ) 
     676  {
     677#endif
     678    UInt subLayerOrderingInfoPresentFlag;
     679    READ_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag");
     680
     681    for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++)
     682    {
     683      READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1");
     684      pcSPS->setMaxDecPicBuffering( uiCode + 1, i);
     685      READ_UVLC ( uiCode, "sps_num_reorder_pics" );
     686      pcSPS->setNumReorderPics(uiCode, i);
     687      READ_UVLC ( uiCode, "sps_max_latency_increase_plus1");
     688      pcSPS->setMaxLatencyIncrease( uiCode, i );
     689
     690      if (!subLayerOrderingInfoPresentFlag)
     691      {
     692        for (i++; i <= pcSPS->getMaxTLayers()-1; i++)
     693        {
     694          pcSPS->setMaxDecPicBuffering(pcSPS->getMaxDecPicBuffering(0), i);
     695          pcSPS->setNumReorderPics(pcSPS->getNumReorderPics(0), i);
     696          pcSPS->setMaxLatencyIncrease(pcSPS->getMaxLatencyIncrease(0), i);
     697        }
     698        break;
     699      }
     700    }
     701#if SPS_DPB_PARAMS
     702  }
     703#endif
    670704  READ_UVLC( uiCode, "log2_min_coding_block_size_minus3" );
    671705  Int log2MinCUSize = uiCode + 3;
     
    824858      Window& scaledWindow = pcSPS->getScaledRefLayerWindow(i);
    825859#if O0098_SCALED_REF_LAYER_ID
    826       READ_CODE( 6,  uiCode,  "scaled_ref_layer_left_id" );  pcSPS->setScaledRefLayerId( i, uiCode );
     860      READ_CODE( 6,  uiCode,  "scaled_ref_layer_id" );       pcSPS->setScaledRefLayerId( i, uiCode );
    827861#endif
    828862      READ_SVLC( iCode, "scaled_ref_layer_left_offset" );    scaledWindow.setWindowLeftOffset  (iCode << 1);
     
    830864      READ_SVLC( iCode, "scaled_ref_layer_right_offset" );   scaledWindow.setWindowRightOffset (iCode << 1);
    831865      READ_SVLC( iCode, "scaled_ref_layer_bottom_offset" );  scaledWindow.setWindowBottomOffset(iCode << 1);
     866#if P0312_VERT_PHASE_ADJ
     867      READ_FLAG( uiCode, "vert_phase_position_enable_flag" ); scaledWindow.setVertPhasePositionEnableFlag(uiCode);  pcSPS->setVertPhasePositionEnableFlag( pcSPS->getScaledRefLayerId(i), uiCode);   
     868#endif
    832869    }
    833870  }
     
    850887  READ_CODE( 6,  uiCode,  "vps_reserved_zero_6bits" );            assert(uiCode == 0);
    851888#endif
    852   READ_CODE( 3,  uiCode,  "vps_max_sub_layers_minus1" );          pcVPS->setMaxTLayers( uiCode + 1 );
     889  READ_CODE( 3,  uiCode,  "vps_max_sub_layers_minus1" );          pcVPS->setMaxTLayers( uiCode + 1 ); assert(uiCode <= 6);
    853890  READ_FLAG(     uiCode,  "vps_temporal_id_nesting_flag" );       pcVPS->setTemporalNestingFlag( uiCode ? true:false );
    854891  assert (pcVPS->getMaxTLayers()>1||pcVPS->getTemporalNestingFlag());
     
    9701007  UInt uiCode;
    9711008  // ... More syntax elements to be parsed here
     1009#if P0300_ALT_OUTPUT_LAYER_FLAG
     1010  Int NumOutputLayersInOutputLayerSet[MAX_VPS_LAYER_SETS_PLUS1];
     1011  Int OlsHighestOutputLayerId[MAX_VPS_LAYER_SETS_PLUS1];
     1012#endif
    9721013#if VPS_EXTN_MASK_AND_DIM_INFO
    9731014  UInt numScalabilityTypes = 0, i = 0, j = 0;
     
    10911132    if (vps->getMaxTSLayersPresentFlag())
    10921133    {
    1093         for(i = 0; i < vps->getMaxLayers() - 1; i++)
     1134        for(i = 0; i < vps->getMaxLayers(); i++)
    10941135        {
    10951136            READ_CODE( 3, uiCode, "sub_layers_vps_max_minus1[i]" ); vps->setMaxTSLayersMinus1(i, uiCode);
     
    10981139    else
    10991140    {
    1100         for( i = 0; i < vps->getMaxLayers() - 1; i++)
     1141        for( i = 0; i < vps->getMaxLayers(); i++)
    11011142        {
    11021143            vps->setMaxTSLayersMinus1(i, vps->getMaxTLayers()-1);
     
    12381279    {
    12391280      Int lsIdx = vps->getOutputLayerSetIdx(i);
     1281#if NUM_OL_FLAGS
     1282      for(j = 0; j < vps->getNumLayersInIdList(lsIdx) ; j++)
     1283#else
    12401284      for(j = 0; j < vps->getNumLayersInIdList(lsIdx) - 1; j++)
     1285#endif
    12411286      {
    12421287        READ_FLAG( uiCode, "output_layer_flag[i][j]"); vps->setOutputLayerFlag(i, j, uiCode);
     
    12691314    }
    12701315    READ_CODE( numBits, uiCode, "profile_level_tier_idx[i]" );     vps->setProfileLevelTierIdx(i, uiCode);
     1316#if P0300_ALT_OUTPUT_LAYER_FLAG
     1317    NumOutputLayersInOutputLayerSet[i] = 0;
     1318    Int layerSetIdxForOutputLayerSet = vps->getOutputLayerSetIdx(i);
     1319    for (j = 0; j < vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet); j++)
     1320    {
     1321      NumOutputLayersInOutputLayerSet[i] += vps->getOutputLayerFlag(i, j);
     1322      if (vps->getOutputLayerFlag(i, j))
     1323      {
     1324        OlsHighestOutputLayerId[i] = vps->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, j);
     1325      }
     1326    }
     1327    if (NumOutputLayersInOutputLayerSet[i] == 1 && vps->getNumDirectRefLayers(OlsHighestOutputLayerId[i]) > 0)
     1328    {
     1329      READ_FLAG(uiCode, "alt_output_layer_flag[i]");
     1330      vps->setAltOuputLayerFlag(i, uiCode ? true : false);
     1331    }
     1332#endif
    12711333  }
    12721334#else
     
    12921354      READ_CODE( numBits, uiCode, "output_layer_set_idx_minus1");   vps->setOutputLayerSetIdx( i, uiCode + 1);
    12931355      Int lsIdx = vps->getOutputLayerSetIdx(i);
     1356#if NUM_OL_FLAGS
     1357      for(j = 0; j < vps->getNumLayersInIdList(lsIdx) ; j++)
     1358#else
    12941359      for(j = 0; j < vps->getNumLayersInIdList(lsIdx) - 1; j++)
     1360#endif
    12951361      {
    12961362        READ_FLAG( uiCode, "output_layer_flag[i][j]"); vps->setOutputLayerFlag(i, j, uiCode);
     
    13541420#endif
    13551421
     1422#if !P0300_ALT_OUTPUT_LAYER_FLAG
    13561423#if O0153_ALT_OUTPUT_LAYER_FLAG
    13571424  if( vps->getMaxLayers() > 1 )
     
    13601427    vps->setAltOuputLayerFlag( uiCode ? true : false );
    13611428  }
     1429#endif
    13621430#endif
    13631431
     
    15101578#if P0307_VPS_NON_VUI_EXTENSION
    15111579  READ_UVLC( uiCode,           "vps_non_vui_extension_length"); vps->setVpsNonVuiExtLength((Int)uiCode);
     1580#if P0307_VPS_NON_VUI_EXT_UPDATE
     1581  Int nonVuiExtByte = uiCode;
     1582  for (i = 1; i <= nonVuiExtByte; i++)
     1583  {
     1584    READ_CODE( 8, uiCode, "vps_non_vui_extension_data_byte" ); //just parse and discard for now.
     1585  }
     1586#else
    15121587  if ( vps->getVpsNonVuiExtLength() > 0 )
    15131588  {
    15141589    printf("\n\nUp to the current spec, the value of vps_non_vui_extension_length is supposed to be 0\n");
    15151590  }
     1591#endif
    15161592#endif
    15171593
     
    15961672{
    15971673  UInt uiCode;
     1674#if DPB_PARAMS_MAXTLAYERS
     1675    Int * MaxSubLayersInLayerSetMinus1 = new Int[vps->getNumOutputLayerSets()];
     1676    for(Int i = 1; i < vps->getNumOutputLayerSets(); i++)
     1677    {
     1678        UInt maxSLMinus1 = 0;
     1679#if CHANGE_NUMSUBDPB_IDX
     1680        Int optLsIdx = vps->getOutputLayerSetIdx( i );
     1681#else
     1682        Int optLsIdx = i;
     1683#endif
     1684        for(Int k = 0; k < vps->getNumLayersInIdList(optLsIdx); k++ ) {
     1685            Int  lId = vps->getLayerSetLayerIdList(optLsIdx, k);
     1686            maxSLMinus1 = max(maxSLMinus1, vps->getMaxTSLayersMinus1(vps->getLayerIdInVps(lId)));
     1687        }
     1688        MaxSubLayersInLayerSetMinus1[ i ] = maxSLMinus1;
     1689    }
     1690#endif
     1691   
    15981692#if !RESOLUTION_BASED_DPB
    15991693  vps->deriveNumberOfSubDpbs();
     
    16051699#endif
    16061700    READ_FLAG( uiCode, "sub_layer_flag_info_present_flag[i]");  vps->setSubLayerFlagInfoPresentFlag( i, uiCode ? true : false );
    1607     for(Int j = 0; j < vps->getMaxTLayers(); j++)
     1701#if DPB_PARAMS_MAXTLAYERS
     1702      for(Int j = 0; j <= MaxSubLayersInLayerSetMinus1[ i ]; j++)
     1703#else
     1704    for(Int j = 0; j <= vps->getMaxTLayers(); j++)
     1705#endif
    16081706    {
    16091707      if( j > 0 && vps->getSubLayerFlagInfoPresentFlag(i) )
     
    16521750      }
    16531751    }
     1752    for(Int j = vps->getMaxTLayers(); j < MAX_TLAYER; j++)
     1753    {
     1754      vps->setSubLayerDpbInfoPresentFlag( i, j, false );
     1755    }
     1756  }
     1757
     1758  // Infer values when not signalled
     1759  for(Int i = 1; i < vps->getNumOutputLayerSets(); i++)
     1760  {
     1761    Int layerSetIdxForOutputLayerSet = vps->getOutputLayerSetIdx( i );
     1762    for(Int j = 0; j < MAX_TLAYER; j++)
     1763    {
     1764      if( !vps->getSubLayerDpbInfoPresentFlag(i, j) )  // If sub-layer DPB information is NOT present
     1765      {
     1766        for(Int k = 0; k < vps->getNumSubDpbs(layerSetIdxForOutputLayerSet); k++)
     1767        {
     1768          vps->setMaxVpsDecPicBufferingMinus1( i, k, j, vps->getMaxVpsDecPicBufferingMinus1( i, k, j - 1 ) );
     1769        }
     1770        vps->setMaxVpsNumReorderPics( i, j, vps->getMaxVpsNumReorderPics( i, j - 1) );
     1771        for(Int k = 0; k < vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ); k++)
     1772        {
     1773          vps->setMaxVpsLayerDecPicBuffMinus1( i, k, j, vps->getMaxVpsLayerDecPicBuffMinus1( i, k, j - 1));
     1774        }
     1775        vps->setMaxVpsLatencyIncreasePlus1( i, j, vps->getMaxVpsLatencyIncreasePlus1( i, j - 1 ) );
     1776      }
     1777    }
    16541778  }
    16551779}
     
    16691793    READ_FLAG(uiCode, "cross_layer_irap_aligned_flag" );
    16701794    vps->setCrossLayerIrapAlignFlag(uiCode);
     1795#if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG
     1796    if (uiCode)
     1797    {
     1798      READ_FLAG(uiCode, "only_idr_for_IRAP_across_layers" );
     1799      vps->setCrossLayerIrapAlignFlag(uiCode);
     1800    }
     1801#endif
    16711802#endif
    16721803#if O0223_PICTURE_TYPES_ALIGN_FLAG
     
    18251956#endif
    18261957#endif
    1827 
     1958#if P0312_VERT_PHASE_ADJ
     1959  READ_FLAG( uiCode, "vps_vui_vert_phase_in_use_flag" ); vps->setVpsVuiVertPhaseInUseFlag(uiCode);
     1960#endif
    18281961#if N0160_VUI_EXT_ILP_REF
    18291962  READ_FLAG( uiCode, "ilp_restricted_ref_layers_flag" ); vps->setIlpRestrictedRefLayersFlag( uiCode == 1 );
     
    18922025#endif
    18932026#endif
     2027
     2028#if O0164_MULTI_LAYER_HRD
     2029    READ_FLAG(uiCode, "vps_vui_bsp_hrd_present_flag" ); vps->setVpsVuiBspHrdPresentFlag(uiCode);
     2030    if (vps->getVpsVuiBspHrdPresentFlag())
     2031    {
     2032      READ_UVLC( uiCode, "vps_num_bsp_hrd_parameters_minus1" ); vps->setVpsNumBspHrdParametersMinus1(uiCode);
     2033      vps->createBspHrdParamBuffer(vps->getVpsNumBspHrdParametersMinus1() + 1);
     2034      for( i = 0; i <= vps->getVpsNumBspHrdParametersMinus1(); i++ )
     2035      {
     2036        if( i > 0 )
     2037        {
     2038          READ_FLAG( uiCode, "bsp_cprms_present_flag[i]" ); vps->setBspCprmsPresentFlag(i, uiCode);
     2039        }
     2040        parseHrdParameters(vps->getBspHrd(i), i==0 ? 1 : vps->getBspCprmsPresentFlag(i), vps->getMaxTLayers()-1);
     2041      }
     2042      for( UInt h = 1; h <= (vps->getNumLayerSets()-1); h++ )
     2043      {
     2044        READ_UVLC( uiCode, "num_bitstream_partitions[i]"); vps->setNumBitstreamPartitions(h, uiCode);
     2045        for( i = 0; i < vps->getNumBitstreamPartitions(h); i++ )
     2046        {
     2047          for( j = 0; j <= (vps->getMaxLayers()-1); j++ )
     2048          {
     2049            if( vps->getLayerIdIncludedFlag(h, j) )
     2050            {
     2051              READ_FLAG( uiCode, "layer_in_bsp_flag[h][i][j]" ); vps->setLayerInBspFlag(h, i, j, uiCode);
     2052            }
     2053          }
     2054        }
     2055        if (vps->getNumBitstreamPartitions(h))
     2056        {
     2057          READ_UVLC( uiCode, "num_bsp_sched_combinations[h]"); vps->setNumBspSchedCombinations(h, uiCode);
     2058          for( i = 0; i < vps->getNumBspSchedCombinations(h); i++ )
     2059          {
     2060            for( j = 0; j < vps->getNumBitstreamPartitions(h); j++ )
     2061            {
     2062              READ_UVLC( uiCode, "bsp_comb_hrd_idx[h][i][j]"); vps->setBspCombHrdIdx(h, i, j, uiCode);
     2063              READ_UVLC( uiCode, "bsp_comb_sched_idx[h][i][j]"); vps->setBspCombSchedIdx(h, i, j, uiCode);
     2064            }
     2065          }
     2066        }
     2067      }
     2068    }
     2069#endif
     2070
     2071#if P0182_VPS_VUI_PS_FLAG
     2072    for(i = 1; i < vps->getMaxLayers(); i++)
     2073    {
     2074      if (vps->getNumRefLayers(vps->getLayerIdInNuh(i)) == 0)
     2075      {
     2076        READ_FLAG( uiCode, "base_layer_parameter_set_compatibility_flag" );
     2077        vps->setBaseLayerPSCompatibilityFlag( i, uiCode );
     2078      }
     2079      else
     2080      {
     2081        vps->setBaseLayerPSCompatibilityFlag( i, 0 );
     2082      }
     2083    }
     2084#endif
    18942085}
    18952086#endif
     
    19112102  if( rpcSlice->getRapPicFlag())
    19122103  {
     2104#if !NO_OUTPUT_OF_PRIOR_PICS
    19132105    READ_FLAG( uiCode, "no_output_of_prior_pics_flag" );  //ignored
     2106#else
     2107    READ_FLAG( uiCode, "no_output_of_prior_pics_flag" );  rpcSlice->setNoOutputOfPriorPicsFlag( uiCode ? true : false );
     2108#endif
    19142109  }
    19152110  READ_UVLC (    uiCode, "slice_pic_parameter_set_id" );  rpcSlice->setPPSId(uiCode);
     
    22292424#if ILP_SSH_SIG
    22302425#if ILP_SSH_SIG_FIX
    2231     if((sps->getLayerId() > 0) && !(rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag()) && (rpcSlice->getNumILRRefIdx() > 0) )
    2232 #else
    2233     if((sps->getLayerId() > 0) && rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag() && (rpcSlice->getNumILRRefIdx() > 0) )
    2234 #endif
    2235 #else
    2236     if((sps->getLayerId() > 0)  &&  (rpcSlice->getNumILRRefIdx() > 0) )
     2426    if((rpcSlice->getLayerId() > 0) && !(rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag()) && (rpcSlice->getNumILRRefIdx() > 0) )
     2427#else
     2428    if((rpcSlice->getLayerId() > 0) && rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag() && (rpcSlice->getNumILRRefIdx() > 0) )
     2429#endif
     2430#else
     2431    if((rpcSlice->getLayerId() > 0)  &&  (rpcSlice->getNumILRRefIdx() > 0) )
    22372432#endif
    22382433    {
     
    22562451          {
    22572452#if P0079_DERIVE_NUMACTIVE_REF_PICS
    2258             Int   numRefLayerPics = 0;
    2259             Int   i = 0;
    2260             Int   refLayerPicIdc  [MAX_VPS_LAYER_ID_PLUS1];
    2261             for(i = 0, numRefLayerPics = 0;  i < rpcSlice->getNumILRRefIdx(); i++ )
     2453            for( Int i = 0; i < rpcSlice->getNumILRRefIdx(); i++ )
    22622454            {
    22632455              if(rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(rpcSlice->getVPS()->getLayerIdInVps(i),rpcSlice->getLayerId()) >  rpcSlice->getTLayer() &&
    22642456                (rpcSlice->getVPS()->getMaxTSLayersMinus1(rpcSlice->getVPS()->getLayerIdInVps(i)) >=  rpcSlice->getTLayer()) )
    22652457              {         
    2266                 refLayerPicIdc[ numRefLayerPics++ ] = i;
     2458                rpcSlice->setActiveNumILRRefIdx(1);
     2459                break;
    22672460              }
    22682461            }
    2269             if (numRefLayerPics)
    2270               rpcSlice->setActiveNumILRRefIdx(1);
    22712462#else
    22722463            rpcSlice->setActiveNumILRRefIdx(1);
     
    23442535#endif
    23452536#endif
     2537#if P0312_VERT_PHASE_ADJ
     2538    for(Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ )
     2539    {
     2540      UInt refLayerIdc = rpcSlice->getInterLayerPredLayerIdc(i);
     2541      if( rpcSlice->getSPS()->getVertPhasePositionEnableFlag(refLayerIdc) )
     2542      {
     2543        READ_FLAG( uiCode, "vert_phase_position_flag" ); rpcSlice->setVertPhasePositionFlag( uiCode? true : false, refLayerIdc );
     2544      }
     2545    }
     2546#endif
    23462547
    23472548    if(sps->getUseSAO())
     
    26612862  }
    26622863
     2864#if POC_RESET_IDC_SIGNALLING
     2865  Int sliceHederExtensionLength = 0;
     2866  if(pps->getSliceHeaderExtensionPresentFlag())
     2867  {
     2868    READ_UVLC( uiCode, "slice_header_extension_length"); sliceHederExtensionLength = uiCode;
     2869  }
     2870  else
     2871  {
     2872    sliceHederExtensionLength = 0;
     2873  }
     2874  UInt startBits = m_pcBitstream->getNumBitsRead();     // Start counter of # SH Extn bits
     2875  if( sliceHederExtensionLength > 0 )
     2876  {
     2877    if( rpcSlice->getPPS()->getPocResetInfoPresentFlag() )
     2878    {
     2879      READ_CODE( 2, uiCode,       "poc_reset_idc"); rpcSlice->setPocResetIdc(uiCode);
     2880    }
     2881    else
     2882    {
     2883      rpcSlice->setPocResetIdc( 0 );
     2884    }
     2885    if( rpcSlice->getPocResetIdc() > 0 )
     2886    {
     2887      READ_CODE(6, uiCode,      "poc_reset_period_id"); rpcSlice->setPocResetPeriodId(uiCode);
     2888    }
     2889    else
     2890    {
     2891     
     2892      rpcSlice->setPocResetPeriodId( 0 );
     2893    }
     2894
     2895    if (rpcSlice->getPocResetIdc() == 3)
     2896    {
     2897      READ_FLAG( uiCode,        "full_poc_reset_flag"); rpcSlice->setFullPocResetFlag((uiCode == 1) ? true : false);
     2898      READ_CODE(rpcSlice->getSPS()->getBitsForPOC(), uiCode,"poc_lsb_val"); rpcSlice->setPocLsbVal(uiCode);
     2899    }
     2900
     2901    // Derive the value of PocMsbValRequiredFlag
     2902    rpcSlice->setPocMsbValRequiredFlag( rpcSlice->getCraPicFlag() || rpcSlice->getBlaPicFlag()
     2903                                          /* || related to vps_poc_lsb_aligned_flag */
     2904                                          );
     2905
     2906    if( !rpcSlice->getPocMsbValRequiredFlag() /* vps_poc_lsb_aligned_flag */ )
     2907    {
     2908      READ_FLAG( uiCode,    "poc_msb_val_present_flag"); rpcSlice->setPocMsbValPresentFlag( uiCode ? true : false );
     2909    }
     2910    else
     2911    {
     2912      if( rpcSlice->getPocMsbValRequiredFlag() )
     2913      {
     2914        rpcSlice->setPocMsbValPresentFlag( true );
     2915      }
     2916      else
     2917      {
     2918        rpcSlice->setPocMsbValPresentFlag( false );
     2919      }
     2920    }
     2921
     2922    Int maxPocLsb  = 1 << rpcSlice->getSPS()->getBitsForPOC();
     2923    if( rpcSlice->getPocMsbValPresentFlag() )
     2924    {
     2925      READ_UVLC( uiCode,    "poc_msb_val");             rpcSlice->setPocMsbVal( uiCode );
     2926      // Update POC of the slice based on this MSB val
     2927      Int pocLsb     = rpcSlice->getPOC() % maxPocLsb;
     2928      rpcSlice->setPOC((rpcSlice->getPocMsbVal() * maxPocLsb) + pocLsb);
     2929    }
     2930    else
     2931    {
     2932      rpcSlice->setPocMsbVal( rpcSlice->getPOC() / maxPocLsb );
     2933    }
     2934
     2935    // Read remaining bits in the slice header extension.
     2936    UInt endBits = m_pcBitstream->getNumBitsRead();
     2937    Int counter = (endBits - startBits) % 8;
     2938    if( counter )
     2939    {
     2940      counter = 8 - counter;
     2941    }
     2942
     2943    while( counter )
     2944    {
     2945      READ_FLAG( uiCode, "slice_segment_header_extension_reserved_bit" ); assert( uiCode == 1 );
     2946      counter--;
     2947    }
     2948  }
     2949#else
    26632950  if(pps->getSliceHeaderExtensionPresentFlag())
    26642951  {
     
    26702957    }
    26712958  }
     2959#endif
    26722960  m_pcBitstream->readByteAlignment();
    26732961
  • trunk/source/Lib/TLibDecoder/TDecCAVLC.h

    r595 r644  
    8686  Void  parseVpsDpbSizeTable( TComVPS *vps );
    8787#endif
     88#if SPS_DPB_PARAMS
     89  Void  parseSPS            ( TComSPS* pcSPS ); // it should be removed after macro clean up
     90#else
    8891  Void  parseSPS            ( TComSPS* pcSPS, ParameterSetManagerDecoder *parameterSetManager );
     92#endif
    8993  Void  parseSPSExtension    ( TComSPS* pcSPS );
    9094#else //SVC_EXTENSION
  • trunk/source/Lib/TLibDecoder/TDecEntropy.h

    r595 r644  
    6666
    6767  virtual Void  parseVPS                  ( TComVPS* pcVPS )                       = 0;
    68 #if SVC_EXTENSION
     68#if SVC_EXTENSION && !SPS_DPB_PARAMS
    6969  virtual Void  parseSPS                  ( TComSPS* pcSPS, ParameterSetManagerDecoder *parameterSetManager )           = 0;
    7070#else
     
    133133  Void    resetEntropy                ( TComSlice* p)           { m_pcEntropyDecoderIf->resetEntropy(p);                    }
    134134  Void    decodeVPS                   ( TComVPS* pcVPS ) { m_pcEntropyDecoderIf->parseVPS(pcVPS); }
    135 #if SVC_EXTENSION
     135#if SVC_EXTENSION && !SPS_DPB_PARAMS
    136136  Void    decodeSPS                   ( TComSPS* pcSPS, ParameterSetManagerDecoder *parameterSetManager )    { m_pcEntropyDecoderIf->parseSPS(pcSPS, parameterSetManager);                    }
    137137#else
  • trunk/source/Lib/TLibDecoder/TDecSbac.cpp

    r595 r644  
    13941394
    13951395Void TDecSbac::parseSAOBlkParam (SAOBlkParam& saoBlkParam
     1396#if SVC_EXTENSION
     1397                                , UInt* saoMaxOffsetQVal
     1398#endif
    13961399                                , Bool* sliceEnabled
    13971400                                , Bool leftMergeAvail
     
    14681471        for(Int i=0; i< 4; i++)
    14691472        {
     1473#if SVC_EXTENSION
     1474          parseSaoMaxUvlc(uiSymbol,  saoMaxOffsetQVal[compIdx] ); //sao_offset_abs
     1475#else
    14701476          parseSaoMaxUvlc(uiSymbol,  g_saoMaxOffsetQVal[compIdx] ); //sao_offset_abs
     1477#endif
    14711478          offset[i] = (Int)uiSymbol;
    14721479        }
  • trunk/source/Lib/TLibDecoder/TDecSbac.h

    r595 r644  
    7676  Void  setBitstream              ( TComInputBitstream* p  ) { m_pcBitstream = p; m_pcTDecBinIf->init( p ); }
    7777  Void  parseVPS                  ( TComVPS* /*pcVPS*/ ) {}
    78 #if SVC_EXTENSION
     78#if SVC_EXTENSION && !SPS_DPB_PARAMS
    7979  Void  parseSPS                  ( TComSPS* /*pcSPS*/, ParameterSetManagerDecoder * /*parameterSetManager*/ ) {}
    8080#else
     
    9090  Void  parseSaoTypeIdx           ( UInt&  ruiVal  );
    9191  Void  parseSaoUflc              ( UInt uiLength, UInt& ruiVal     );
     92
     93#if SVC_EXTENSION
     94  Void parseSAOBlkParam (SAOBlkParam& saoBlkParam, UInt* saoMaxOffsetQVal, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail );
     95#else
    9296  Void parseSAOBlkParam (SAOBlkParam& saoBlkParam, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail);
     97#endif
    9398  Void parseSaoSign(UInt& val);
    9499private:
  • trunk/source/Lib/TLibDecoder/TDecSlice.cpp

    r595 r644  
    105105
    106106#if SVC_EXTENSION
    107 Void TDecSlice::init(TDecTop** ppcDecTop,TDecEntropy* pcEntropyDecoder, TDecCu* pcCuDecoder)
     107Void TDecSlice::init(TDecEntropy* pcEntropyDecoder, TDecCu* pcCuDecoder, UInt* saoMaxOffsetQVal)
    108108{
    109109  m_pcEntropyDecoder  = pcEntropyDecoder;
    110110  m_pcCuDecoder       = pcCuDecoder;
    111   m_ppcTDecTop        = ppcDecTop;
     111  m_saoMaxOffsetQVal  = saoMaxOffsetQVal;
    112112}
    113113#else
     
    347347          aboveMergeAvail = rpcPic->getSAOMergeAvailability(iCUAddr, iCUAddr-uiWidthInLCUs);
    348348        }
    349 
     349#if SVC_EXTENSION
     350        pcSbacDecoder->parseSAOBlkParam( saoblkParam, m_saoMaxOffsetQVal, sliceEnabled, leftMergeAvail, aboveMergeAvail);
     351#else
    350352        pcSbacDecoder->parseSAOBlkParam( saoblkParam, sliceEnabled, leftMergeAvail, aboveMergeAvail);
     353#endif
    351354      }
    352355      else
  • trunk/source/Lib/TLibDecoder/TDecSlice.h

    r595 r644  
    7272  std::vector<TDecSbac*> CTXMem;
    7373#if SVC_EXTENSION
    74   TDecTop**       m_ppcTDecTop;
     74  UInt*           m_saoMaxOffsetQVal;
    7575#endif
    7676 
     
    8080 
    8181#if SVC_EXTENSION 
    82   Void  init              ( TDecTop** ppcDecTop, TDecEntropy* pcEntropyDecoder, TDecCu* pcMbDecoder );
     82  Void  init              ( TDecEntropy* pcEntropyDecoder, TDecCu* pcMbDecoder, UInt* saoMaxOffsetQVal );
    8383#else
    8484  Void  init              ( TDecEntropy* pcEntropyDecoder, TDecCu* pcMbDecoder );
     
    9191  Void      setCtxMem( TDecSbac* sb, Int b )   { CTXMem[b] = sb; }
    9292  Int       getCtxMemSize( )                   { return (Int)CTXMem.size(); }
    93 #if SVC_EXTENSION
    94   TDecTop*  getLayerDec   ( UInt LayerId )  { return m_ppcTDecTop[LayerId]; } 
    95 #endif
    9693};
    9794
  • trunk/source/Lib/TLibDecoder/TDecTop.cpp

    r595 r644  
    138138#if SVC_EXTENSION
    139139  m_cGopDecoder.init( m_ppcTDecTop, &m_cEntropyDecoder, &m_cSbacDecoder, &m_cBinCABAC, &m_cCavlcDecoder, &m_cSliceDecoder, &m_cLoopFilter, &m_cSAO);
    140   m_cSliceDecoder.init( m_ppcTDecTop, &m_cEntropyDecoder, &m_cCuDecoder );
     140  m_cSliceDecoder.init( &m_cEntropyDecoder, &m_cCuDecoder, m_cSAO.getSaoMaxOffsetQVal() );
    141141#else
    142142  m_cGopDecoder.init( &m_cEntropyDecoder, &m_cSbacDecoder, &m_cBinCABAC, &m_cCavlcDecoder, &m_cSliceDecoder, &m_cLoopFilter, &m_cSAO);
     
    349349        TComPicYuv* pcPicYuvRecBase = (*(pcTDecTopBase->getListPic()->begin()))->getPicYuvRec();
    350350#if REPN_FORMAT_IN_VPS
     351#if O0194_DIFFERENT_BITDEPTH_EL_BL
     352        UInt refLayerId = pcSlice->getVPS()->getRefLayerId(m_layerId, i);
     353        Bool sameBitDepths = ( g_bitDepthYLayer[m_layerId] == g_bitDepthYLayer[refLayerId] ) && ( g_bitDepthCLayer[m_layerId] == g_bitDepthCLayer[refLayerId] );
     354
     355        if( pcPicYuvRecBase->getWidth() != pcSlice->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getPicHeightInLumaSamples() || !zeroOffsets || !sameBitDepths )
     356#else
    351357        if(pcPicYuvRecBase->getWidth() != pcSlice->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getPicHeightInLumaSamples() || !zeroOffsets )
     358#endif
    352359#else
    353360        if(pcPicYuvRecBase->getWidth() != pcSlice->getSPS()->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getSPS()->getPicHeightInLumaSamples() || !zeroOffsets )
     
    726733#endif
    727734
     735#if P0312_VERT_PHASE_ADJ
     736  if( activeVPS->getVpsVuiVertPhaseInUseFlag() == 0 )
     737  {   
     738    for(Int i = 0; i < activeSPS->getNumScaledRefLayerOffsets(); i++)
     739    {
     740      UInt scaledRefLayerId = activeSPS->getScaledRefLayerId(i);
     741      if( activeSPS->getVertPhasePositionEnableFlag( scaledRefLayerId ) )
     742      {
     743        printf("\nWarning: LayerId = %d: vert_phase_position_enable_flag[%d] = 1, however indication vert_phase_position_in_use_flag = 0\n", m_layerId, scaledRefLayerId );
     744        break;
     745      }
     746    }
     747  }
     748#endif
     749
     750#if SPS_DPB_PARAMS
     751  if( m_layerId > 0 )
     752  {
     753    // When not present sps_max_sub_layers_minus1 is inferred to be equal to vps_max_sub_layers_minus1.
     754    sps->setMaxTLayers( activeVPS->getMaxTLayers() );
     755
     756    // When not present sps_temporal_id_nesting_flag is inferred to be equal to vps_temporal_id_nesting_flag
     757    sps->setTemporalIdNestingFlag( activeVPS->getTemporalNestingFlag() );
     758
     759    // 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,
     760    // it is inferred to be equal to max_vps_dec_pic_buffering_minus1[ TargetOptLayerSetIdx ][ currLayerId ][ i ] of the active VPS, where currLayerId is the nuh_layer_id of the layer that refers to the SPS.
     761    for(UInt i=0; i < sps->getMaxTLayers(); i++)
     762    {
     763      // to avoid compiler warning "array subscript is above array bounds"
     764      assert( i < MAX_TLAYER );
     765
     766      sps->setMaxDecPicBuffering( activeVPS->getMaxVpsDecPicBufferingMinus1( getCommonDecoderParams()->getTargetOutputLayerSetIdx(), sps->getLayerId(), i) + 1, i);
     767    }
     768  }
     769#endif
     770
    728771  if( pps->getDependentSliceSegmentsEnabledFlag() )
    729772  {
     
    800843  TComPic*&   pcPic         = m_pcPic;
    801844#if SVC_EXTENSION
     845#if !NO_OUTPUT_OF_PRIOR_PICS
    802846#if NO_CLRAS_OUTPUT_FLAG
    803847  Bool bFirstSliceInSeq;
     848#endif
    804849#endif
    805850  m_apcSlicePilot->setVPS( m_parameterSetManagerDecoder.getPrefetchedVPS(0) );
     
    855900  m_apcSlicePilot->setAssociatedIRAPType(m_associatedIRAPType);
    856901
     902#if NO_OUTPUT_OF_PRIOR_PICS
     903  // Infer the value of NoOutputOfPriorPicsFlag
     904  if( m_apcSlicePilot->getRapPicFlag() )
     905  {
     906    if ( m_apcSlicePilot->getBlaPicFlag() || m_apcSlicePilot->getIdrPicFlag()  ||
     907        (m_apcSlicePilot->getCraPicFlag() && m_bFirstSliceInSequence) ||
     908        (m_apcSlicePilot->getCraPicFlag() && m_apcSlicePilot->getHandleCraAsBlaFlag()))
     909    {
     910      m_apcSlicePilot->setNoRaslOutputFlag( true );
     911    }
     912    else
     913    {
     914      m_apcSlicePilot->setNoRaslOutputFlag( false );
     915    }
     916  }
     917#endif
     918
    857919  // Skip pictures due to random access
    858920  if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay))
     
    876938#if SVC_EXTENSION
    877939  bNewPOC = (m_apcSlicePilot->getPOC()!= m_prevPOC);
     940
     941#if NO_OUTPUT_OF_PRIOR_PICS
     942#if NO_CLRAS_OUTPUT_FLAG
     943  if (m_layerId == 0 && m_apcSlicePilot->getRapPicFlag() )
     944  {
     945    if (m_bFirstSliceInSequence)
     946    {
     947      setNoClrasOutputFlag(true);
     948    }
     949    else if ( m_apcSlicePilot->getBlaPicFlag() )
     950    {
     951      setNoClrasOutputFlag(true);
     952    }
     953#if O0149_CROSS_LAYER_BLA_FLAG
     954    else if (m_apcSlicePilot->getIdrPicFlag() && m_apcSlicePilot->getCrossLayerBLAFlag())
     955    {
     956      setNoClrasOutputFlag(true);
     957    }
     958#endif
     959    else
     960    {
     961      setNoClrasOutputFlag(false);
     962    }     
     963  }
     964  else
     965  {
     966    setNoClrasOutputFlag(false);
     967  }
     968
     969  m_apcSlicePilot->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, m_cListPic, getNoClrasOutputFlag());
     970#endif
     971
     972  // Derive the value of NoOutputOfPriorPicsFlag
     973  if( bNewPOC || m_layerId!=m_uiPrevLayerId )   // i.e. new coded picture
     974  {
     975    if( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_apcSlicePilot->getNoRaslOutputFlag() )
     976    {
     977      this->setNoOutputOfPriorPicsFlags( true );
     978    }
     979    else if( m_apcSlicePilot->getRapPicFlag() && m_apcSlicePilot->getNoRaslOutputFlag() )
     980    {
     981      this->setNoOutputOfPriorPicsFlags( m_apcSlicePilot->getNoOutputOfPriorPicsFlag() );
     982    }
     983    else
     984    {
     985      if( this->m_ppcTDecTop[0]->getNoClrasOutputFlag() )
     986      {
     987        this->setNoOutputOfPriorPicsFlags( true );
     988      }
     989    }
     990  }
     991#endif
     992
     993#if ALIGNED_BUMPING
     994  if (bNewPOC || m_layerId!=m_uiPrevLayerId)
     995  {
     996    m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS());
     997  }
     998#endif
    878999  if (m_apcSlicePilot->isNextSlice() && (bNewPOC || m_layerId!=m_uiPrevLayerId) && !m_bFirstSliceInSequence )
    8791000  {
     
    9291050#endif
    9301051  }
     1052#if !NO_OUTPUT_OF_PRIOR_PICS
    9311053#if NO_CLRAS_OUTPUT_FLAG
    9321054  bFirstSliceInSeq = m_bFirstSliceInSequence;
     1055#endif
    9331056#endif
    9341057  m_bFirstSliceInSequence = false;
     
    10931216#endif
    10941217
     1218#if !NO_OUTPUT_OF_PRIOR_PICS
    10951219#if NO_CLRAS_OUTPUT_FLAG
    10961220    if (m_layerId == 0 &&
     
    11371261    m_apcSlicePilot->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, m_cListPic, getNoClrasOutputFlag());
    11381262#endif
    1139 
     1263#else
     1264    if ( m_layerId == 0 && m_apcSlicePilot->getRapPicFlag() && getNoClrasOutputFlag() )
     1265    {
     1266      for (UInt i = 0; i < m_apcSlicePilot->getVPS()->getMaxLayers(); i++)
     1267      {
     1268        m_ppcTDecTop[i]->setLayerInitializedFlag(false);
     1269        m_ppcTDecTop[i]->setFirstPicInLayerDecodedFlag(false);
     1270      }
     1271    }
     1272#endif
    11401273    // Buffer initialize for prediction.
    11411274    m_cPrediction.initTempBuff();
     1275#if !ALIGNED_BUMPING
    11421276    m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS());
     1277#else
     1278    m_apcSlicePilot->checkLeadingPictureRestrictions(m_cListPic);
     1279#endif
    11431280    //  Get a new picture buffer
    11441281    xGetNewPicBuffer (m_apcSlicePilot, pcPic);
     
    16001737#if SVC_EXTENSION
    16011738  sps->setLayerId(m_layerId);
     1739#if SPS_DPB_PARAMS
     1740  m_cEntropyDecoder.decodeSPS( sps ); // it should be removed after macro clean up
     1741#else
    16021742  m_cEntropyDecoder.decodeSPS( sps, &m_parameterSetManagerDecoder );
     1743#endif
    16031744  m_parameterSetManagerDecoder.storePrefetchedSPS(sps);
    16041745#if !REPN_FORMAT_IN_VPS   // ILRP can only be initialized at activation 
  • trunk/source/Lib/TLibDecoder/TDecTop.h

    r595 r644  
    239239  fstream* getBLSyntaxFile() { return m_pBLSyntaxFile; }
    240240#endif
    241 
     241#if NO_OUTPUT_OF_PRIOR_PICS
     242#if NO_CLRAS_OUTPUT_FLAG
     243  Bool getNoOutputOfPriorPicsFlags()         { return m_noOutputOfPriorPicsFlags;}
     244  Void setNoOutputOfPriorPicsFlags(Bool x)   { m_noOutputOfPriorPicsFlags = x;   }
     245#endif
     246#endif
    242247protected:
    243248  Void  xGetNewPicBuffer  (TComSlice* pcSlice, TComPic*& rpcPic);
     
    266271  Int  getFirstPicInLayerDecodedFlag()       { return m_firstPicInLayerDecodedFlag;}
    267272  Void setFirstPicInLayerDecodedFlag(Bool x) { m_firstPicInLayerDecodedFlag = x;   }
     273#if !NO_OUTPUT_OF_PRIOR_PICS
    268274  Int  getNoOutputOfPriorPicsFlags()         { return m_noOutputOfPriorPicsFlags;}
    269275  Void setNoOutputOfPriorPicsFlags(Bool x)   { m_noOutputOfPriorPicsFlags = x;   }
    270276#endif
     277#endif
    271278};// END CLASS DEFINITION TDecTop
    272279
Note: See TracChangeset for help on using the changeset viewer.