Changeset 1356 in 3DVCSoftware for trunk/source/Lib/TLibDecoder


Ignore:
Timestamp:
27 Oct 2015, 11:33:16 (10 years ago)
Author:
tech
Message:

Merged 15.1-dev0-NICT@1355.

Location:
trunk/source/Lib/TLibDecoder
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibDecoder/SEIread.cpp

    r1313 r1356  
    9999}
    100100
     101Void SEIReader::sei_read_string(std::ostream *pOS, UInt uiBufSize, UChar* pucCode, UInt& ruiLength, const Char *pSymbolName)
     102{
     103  READ_STRING(uiBufSize, pucCode, ruiLength, pSymbolName);
     104  if (pOS)
     105  {
     106    (*pOS) << "  " << pSymbolName << ": " << (const char*) pucCode << "\n";
     107  }
     108}
     109
     110#if NH_MV_SEI
     111inline Void SEIReader::output_sei_message_header(SEI &sei, std::ostream *pDecodedMessageOutputStream, UInt payloadSize)
     112#else
    101113static inline Void output_sei_message_header(SEI &sei, std::ostream *pDecodedMessageOutputStream, UInt payloadSize)
     114#endif
    102115{
    103116  if (pDecodedMessageOutputStream)
     
    105118    std::string seiMessageHdr(SEI::getSEIMessageString(sei.payloadType())); seiMessageHdr+=" SEI message";
    106119    (*pDecodedMessageOutputStream) << std::setfill('-') << std::setw(seiMessageHdr.size()) << "-" << std::setfill(' ') << "\n" << seiMessageHdr << " (" << payloadSize << " bytes)"<< "\n";
     120#if NH_MV_SEI
     121    (*pDecodedMessageOutputStream) << std::setfill(' ') << "LayerId: " << m_layerId << std::setw(2) << " Picture: " << m_decOrder << std::setw( 5 ) << std::endl;
     122#endif
    107123  }
    108124}
     
    117133 * unmarshal a single SEI message from bitstream bs
    118134 */
     135#if NH_MV_LAYERS_NOT_PRESENT_SEI
     136Void SEIReader::parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
     137#else
    119138Void SEIReader::parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
     139#endif
    120140{
    121141  setBitstream(bs);
     
    124144  do
    125145  {
     146#if NH_MV_LAYERS_NOT_PRESENT_SEI
     147    xReadSEImessage(seis, nalUnitType, vps, sps, pDecodedMessageOutputStream);
     148#else
    126149    xReadSEImessage(seis, nalUnitType, sps, pDecodedMessageOutputStream);
    127 
     150#endif
    128151    /* SEI messages are an integer number of bytes, something has failed
    129152    * in the parsing if bitstream not byte-aligned */
     
    135158}
    136159
     160#if NH_MV_LAYERS_NOT_PRESENT_SEI
     161Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
     162#else
    137163Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
     164#endif
    138165{
    139166#if ENC_DEC_TRACE
     
    254281    case SEI::SCALABLE_NESTING:
    255282      sei = new SEIScalableNesting;
     283#if NH_MV_LAYERS_NOT_PRESENT_SEI
     284      xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, vps, sps, pDecodedMessageOutputStream);
     285#else
    256286      xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, sps, pDecodedMessageOutputStream);
     287#endif
    257288      break;
    258289    case SEI::TEMP_MOTION_CONSTRAINED_TILE_SETS:
     
    277308      xParseSEIMasteringDisplayColourVolume((SEIMasteringDisplayColourVolume&) *sei, payloadSize, pDecodedMessageOutputStream);
    278309      break;
    279 #if NH_MV
     310#if !NH_MV_SEI
    280311    case SEI::SUB_BITSTREAM_PROPERTY:
    281312      sei = new SEISubBitstreamProperty;
    282313      xParseSEISubBitstreamProperty((SEISubBitstreamProperty&) *sei, payloadSize, pDecodedMessageOutputStream );
    283314      break;
     315#else
     316#if NH_MV_LAYERS_NOT_PRESENT_SEI
     317    case SEI::LAYERS_NOT_PRESENT:
     318      if (!vps)
     319      {
     320        printf ("Warning: Found Layers not present SEI message, but no active VPS is available. Ignoring.");
     321      }
     322      else
     323      {
     324        sei = new SEILayersNotPresent;
     325        xParseSEILayersNotPresent((SEILayersNotPresent&) *sei, payloadSize, vps, pDecodedMessageOutputStream);
     326      }
     327      break;
     328#endif
     329    case SEI::INTER_LAYER_CONSTRAINED_TILE_SETS:
     330      sei = new SEIInterLayerConstrainedTileSets;
     331      xParseSEIInterLayerConstrainedTileSets((SEIInterLayerConstrainedTileSets&) *sei, payloadSize, pDecodedMessageOutputStream );
     332      break;
     333#if NH_MV_TBD
     334    case SEI::BSP_NESTING:
     335      sei = new SEIBspNesting;
     336      xParseSEIBspNesting((SEIBspNesting&) *sei, payloadSize, pDecodedMessageOutputStream );
     337      break;
     338    case SEI::BSP_INITIAL_ARRIVAL_TIME:
     339      sei = new SEIBspInitialArrivalTime;
     340      xParseSEIBspInitialArrivalTime((SEIBspInitialArrivalTime&) *sei, payloadSize, pDecodedMessageOutputStream );
     341      break;
     342#endif
     343    case SEI::SUB_BITSTREAM_PROPERTY:
     344      sei = new SEISubBitstreamProperty;
     345      xParseSEISubBitstreamProperty((SEISubBitstreamProperty&) *sei, payloadSize, pDecodedMessageOutputStream );
     346      break;
     347    case SEI::ALPHA_CHANNEL_INFO:
     348      sei = new SEIAlphaChannelInfo;
     349      xParseSEIAlphaChannelInfo((SEIAlphaChannelInfo&) *sei, payloadSize, pDecodedMessageOutputStream );
     350      break;
     351    case SEI::OVERLAY_INFO:
     352      sei = new SEIOverlayInfo;
     353      xParseSEIOverlayInfo((SEIOverlayInfo&) *sei, payloadSize, pDecodedMessageOutputStream );
     354      break;
     355    case SEI::TEMPORAL_MV_PREDICTION_CONSTRAINTS:
     356      sei = new SEITemporalMvPredictionConstraints;
     357      xParseSEITemporalMvPredictionConstraints((SEITemporalMvPredictionConstraints&) *sei, payloadSize, pDecodedMessageOutputStream );
     358      break;
     359#if NH_MV_SEI_TBD
     360    case SEI::FRAME_FIELD_INFO:
     361      sei = new SEIFrameFieldInfo;
     362      xParseSEIFrameFieldInfo((SEIFrameFieldInfo&) *sei, payloadSize, pDecodedMessageOutputStream );
     363      break;
     364#endif
     365    case SEI::THREE_DIMENSIONAL_REFERENCE_DISPLAYS_INFO:
     366      sei = new SEIThreeDimensionalReferenceDisplaysInfo;
     367      xParseSEIThreeDimensionalReferenceDisplaysInfo((SEIThreeDimensionalReferenceDisplaysInfo&) *sei, payloadSize, pDecodedMessageOutputStream );
     368      break;
     369#if SEI_DRI_F0169
     370    case SEI::DEPTH_REPRESENTATION_INFO:
     371        sei = new SEIDepthRepresentationInfo;
     372        xParseSEIDepthRepresentationInfo((SEIDepthRepresentationInfo&) *sei, payloadSize, pDecodedMessageOutputStream );
     373        break;
     374#endif
     375    case SEI::MULTIVIEW_SCENE_INFO:
     376      sei = new SEIMultiviewSceneInfo;
     377      xParseSEIMultiviewSceneInfo((SEIMultiviewSceneInfo&) *sei, payloadSize, pDecodedMessageOutputStream );
     378      break;
     379
     380    case SEI::MULTIVIEW_ACQUISITION_INFO:
     381      sei = new SEIMultiviewAcquisitionInfo;
     382      xParseSEIMultiviewAcquisitionInfo((SEIMultiviewAcquisitionInfo&) *sei, payloadSize, pDecodedMessageOutputStream );
     383      break;
     384
     385    case SEI::MULTIVIEW_VIEW_POSITION:
     386      sei = new SEIMultiviewViewPosition;
     387      xParseSEIMultiviewViewPosition((SEIMultiviewViewPosition&) *sei, payloadSize, pDecodedMessageOutputStream );
     388      break;
     389#if NH_3D
     390    case SEI::ALTERNATIVE_DEPTH_INFO:
     391      sei = new SEIAlternativeDepthInfo;
     392      xParseSEIAlternativeDepthInfo((SEIAlternativeDepthInfo&) *sei, payloadSize, pDecodedMessageOutputStream );
     393      break;
     394#endif
    284395#endif
    285396    default:
     
    455566Void SEIReader::xParseSEIActiveParameterSets(SEIActiveParameterSets& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
    456567{
    457   UInt val; 
     568  UInt val;
    458569  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
    459570
     
    805916}
    806917
     918#if NH_MV_LAYERS_NOT_PRESENT_SEI
     919Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
     920#else
    807921Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
     922#endif
    808923{
    809924  UInt uiCode;
     
    847962  do
    848963  {
     964#if NH_MV_LAYERS_NOT_PRESENT_SEI
     965    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, vps, sps, pDecodedMessageOutputStream);
     966#else
    849967    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps, pDecodedMessageOutputStream);
     968#endif
    850969  } while (m_pcBitstream->getNumBitsLeft() > 8);
    851970
     
    857976
    858977#if NH_MV
     978#if !NH_MV_SEI
    859979Void SEIReader::xParseSEISubBitstreamProperty(SEISubBitstreamProperty &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream )
    860980{
     
    872992    sei_read_code( pDecodedMessageOutputStream,  16, code, "avg_bit_rate[i]"                 ); sei.m_avgBitRate[i] = code;
    873993    sei_read_code( pDecodedMessageOutputStream,  16, code, "max_bit_rate[i]"                 ); sei.m_maxBitRate[i] = code;
    874   } 
     994  }
    875995}
    876996
     
    8831003  sei.m_maxBitRate.resize( sei.m_numAdditionalSubStreams );
    8841004}
     1005#endif
    8851006#endif
    8861007
     
    11011222}
    11021223
     1224#if NH_MV_LAYERS_NOT_PRESENT_SEI
     1225Void SEIReader::xParseSEILayersNotPresent(SEILayersNotPresent &sei, UInt payloadSize, const TComVPS *vps, std::ostream *pDecodedMessageOutputStream)
     1226{
     1227  UInt code;
     1228
     1229  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1230  sei_read_code( pDecodedMessageOutputStream, 4, code, "lnp_sei_active_vps_id" ); sei.m_lnpSeiActiveVpsId = code;
     1231  assert(vps->getVPSId() == sei.m_lnpSeiActiveVpsId);
     1232
     1233  sei.m_lnpSeiMaxLayers = vps->getMaxLayersMinus1() + 1;
     1234  sei.resizeDimI(sei.m_lnpSeiMaxLayers);
     1235  for (Int i = 0; i < sei.m_lnpSeiMaxLayers; i++)
     1236  {
     1237    sei_read_flag( pDecodedMessageOutputStream, code, "layer_not_present_flag" );
     1238    sei.m_layerNotPresentFlag[i] = (code == 1);
     1239  }
     1240};
     1241#endif
     1242
     1243Void SEIReader::xParseSEIInterLayerConstrainedTileSets(SEIInterLayerConstrainedTileSets& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1244{
     1245  UInt code;
     1246  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1247
     1248  sei_read_flag( pDecodedMessageOutputStream, code, "il_all_tiles_exact_sample_value_match_flag" ); sei.m_ilAllTilesExactSampleValueMatchFlag = (code == 1);
     1249  sei_read_flag( pDecodedMessageOutputStream, code, "il_one_tile_per_tile_set_flag"              ); sei.m_ilOneTilePerTileSetFlag             = (code == 1);
     1250  if( !sei.m_ilOneTilePerTileSetFlag )
     1251  {
     1252    sei_read_uvlc( pDecodedMessageOutputStream, code, "il_num_sets_in_message_minus1" ); sei.m_ilNumSetsInMessageMinus1 = code;
     1253    if( sei.m_ilNumSetsInMessageMinus1 )
     1254    {
     1255      sei_read_flag( pDecodedMessageOutputStream, code, "skipped_tile_set_present_flag" ); sei.m_skippedTileSetPresentFlag = (code == 1);
     1256    }
     1257    Int numSignificantSets = sei.m_ilNumSetsInMessageMinus1 - sei.m_skippedTileSetPresentFlag + 1;
     1258
     1259    sei.resizeDimI( numSignificantSets );
     1260    for( Int i = 0; i < numSignificantSets; i++ )
     1261    {
     1262      sei_read_uvlc( pDecodedMessageOutputStream, code, "ilcts_id"                        ); sei.m_ilctsId                  [i] = code;
     1263      sei_read_uvlc( pDecodedMessageOutputStream, code, "il_num_tile_rects_in_set_minus1" ); sei.m_ilNumTileRectsInSetMinus1[i] = code;
     1264
     1265      sei.resizeDimJ( i, sei.m_ilNumTileRectsInSetMinus1[ i ] + 1 );
     1266      for( Int j = 0; j  <=  sei.m_ilNumTileRectsInSetMinus1[ i ]; j++ )
     1267      {
     1268        sei_read_uvlc( pDecodedMessageOutputStream, code, "il_top_left_tile_index"     ); sei.m_ilTopLeftTileIndex    [i][j] = code;
     1269        sei_read_uvlc( pDecodedMessageOutputStream, code, "il_bottom_right_tile_index" ); sei.m_ilBottomRightTileIndex[i][j] = code;
     1270      }
     1271      sei_read_code( pDecodedMessageOutputStream, 2, code, "ilc_idc" ); sei.m_ilcIdc[i] = code;
     1272      if ( !sei.m_ilAllTilesExactSampleValueMatchFlag )
     1273      {
     1274        sei_read_flag( pDecodedMessageOutputStream, code, "il_exact_sample_value_match_flag" ); sei.m_ilExactSampleValueMatchFlag[i] = (code == 1);
     1275      }
     1276    }
     1277  }
     1278  else
     1279  {
     1280    sei_read_code( pDecodedMessageOutputStream, 2, code, "all_tiles_ilc_idc" ); sei.m_allTilesIlcIdc = code;
     1281  }
     1282};
     1283
     1284#if NH_MV_SEI_TBD
     1285Void SEIReader::xParseSEIBspNesting(SEIBspNesting& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1286{
     1287  UInt code;
     1288  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1289
     1290  sei_read_uvlc( pDecodedMessageOutputStream, code, "sei_ols_idx" ); sei.m_seiOlsIdx = code;
     1291  sei_read_uvlc( pDecodedMessageOutputStream, code, "sei_partitioning_scheme_idx" ); sei.m_seiPartitioningSchemeIdx = code;
     1292  sei_read_uvlc( pDecodedMessageOutputStream, code, "bsp_idx" ); sei.m_bspIdx = code;
     1293  while( !ByteaLigned(() ) );
     1294  {
     1295    sei_read_code( pDecodedMessageOutputStream, *equalto0*/u1, code, "bsp_nesting_zero_bit" ); sei.m_bspNestingZeroBit = code;
     1296  }
     1297  sei_read_uvlc( pDecodedMessageOutputStream, code, "num_seis_in_bsp_minus1" ); sei.m_numSeisInBspMinus1 = code;
     1298  for( Int i = 0; i  <=  NumSeisInBspMinus1( ); i++ )
     1299  {
     1300    SeiMessage(() );
     1301  }
     1302};
     1303
     1304Void SEIReader::xParseSEIBspInitialArrivalTime(SEIBspInitialArrivalTime& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1305{
     1306  UInt code;
     1307  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1308
     1309  psIdx = SeiPartitioningSchemeIdx();
     1310  if( nalInitialArrivalDelayPresent )
     1311  {
     1312    for( Int i = 0; i < BspSchedCnt( SeiOlsIdx(), psIdx, MaxTemporalId( 0 ) ); i++ )
     1313    {
     1314      sei_read_code( pDecodedMessageOutputStream, getNalInitialArrivalDelayLen ), code, "nal_initial_arrival_delay" ); sei.m_nalInitialArrivalDelay[i] = code;
     1315    }
     1316  }
     1317  if( vclInitialArrivalDelayPresent )
     1318  {
     1319    for( Int i = 0; i < BspSchedCnt( SeiOlsIdx(), psIdx, MaxTemporalId( 0 ) ); i++ )
     1320    {
     1321      sei_read_code( pDecodedMessageOutputStream, getVclInitialArrivalDelayLen ), code, "vcl_initial_arrival_delay" ); sei.m_vclInitialArrivalDelay[i] = code;
     1322    }
     1323  }
     1324};
     1325#endif
     1326
     1327Void SEIReader::xParseSEISubBitstreamProperty(SEISubBitstreamProperty& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1328{
     1329  UInt code;
     1330  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1331
     1332  sei_read_code( pDecodedMessageOutputStream, 4, code, "sb_property_active_vps_id" ); sei.m_sbPropertyActiveVpsId = code;
     1333  sei_read_uvlc( pDecodedMessageOutputStream, code, "num_additional_sub_streams_minus1" ); sei.m_numAdditionalSubStreamsMinus1 = code;
     1334  sei.resizeArrays( );
     1335  for( Int i = 0; i  <=  sei.m_numAdditionalSubStreamsMinus1; i++ )
     1336  {
     1337    sei_read_code( pDecodedMessageOutputStream, 2, code, "sub_bitstream_mode" ); sei.m_subBitstreamMode[i] = code;
     1338    sei_read_uvlc( pDecodedMessageOutputStream, code, "ols_idx_to_vps" ); sei.m_olsIdxToVps[i] = code;
     1339    sei_read_code( pDecodedMessageOutputStream, 3, code, "highest_sublayer_id" ); sei.m_highestSublayerId[i] = code;
     1340    sei_read_code( pDecodedMessageOutputStream, 16, code, "avg_sb_property_bit_rate" ); sei.m_avgSbPropertyBitRate[i] = code;
     1341    sei_read_code( pDecodedMessageOutputStream, 16, code, "max_sb_property_bit_rate" ); sei.m_maxSbPropertyBitRate[i] = code;
     1342  }
     1343};
     1344
     1345Void SEIReader::xParseSEIAlphaChannelInfo(SEIAlphaChannelInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1346{
     1347  UInt code;
     1348  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1349
     1350  sei_read_flag( pDecodedMessageOutputStream, code, "alpha_channel_cancel_flag" ); sei.m_alphaChannelCancelFlag = (code == 1);
     1351  if( !sei.m_alphaChannelCancelFlag )
     1352  {
     1353    sei_read_code( pDecodedMessageOutputStream, 3, code, "alpha_channel_use_idc" ); sei.m_alphaChannelUseIdc = code;
     1354    sei_read_code( pDecodedMessageOutputStream, 3, code, "alpha_channel_bit_depth_minus8" ); sei.m_alphaChannelBitDepthMinus8 = code;
     1355    sei_read_code( pDecodedMessageOutputStream, sei.m_alphaChannelBitDepthMinus8+9, code, "alpha_transparent_value" ); sei.m_alphaTransparentValue = code;
     1356    sei_read_code( pDecodedMessageOutputStream, sei.m_alphaChannelBitDepthMinus8+9, code, "alpha_opaque_value" ); sei.m_alphaOpaqueValue = code;
     1357    sei_read_flag( pDecodedMessageOutputStream, code, "alpha_channel_incr_flag" ); sei.m_alphaChannelIncrFlag = (code == 1);
     1358    sei_read_flag( pDecodedMessageOutputStream, code, "alpha_channel_clip_flag" ); sei.m_alphaChannelClipFlag = (code == 1);
     1359    if( sei.m_alphaChannelClipFlag )
     1360    {
     1361      sei_read_flag( pDecodedMessageOutputStream, code, "alpha_channel_clip_type_flag" ); sei.m_alphaChannelClipTypeFlag = (code == 1);
     1362    }
     1363  }
     1364};
     1365
     1366Void SEIReader::xParseSEIOverlayInfo(SEIOverlayInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1367{
     1368  UInt code;
     1369  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1370
     1371  sei_read_flag( pDecodedMessageOutputStream, code, "overlay_info_cancel_flag" ); sei.m_overlayInfoCancelFlag = (code == 1);
     1372  if( !sei.m_overlayInfoCancelFlag )
     1373  {
     1374    sei_read_uvlc( pDecodedMessageOutputStream, code, "overlay_content_aux_id_minus128" );            sei.m_overlayContentAuxIdMinus128 = code;
     1375    sei_read_uvlc( pDecodedMessageOutputStream, code, "overlay_label_aux_id_minus128" );              sei.m_overlayLabelAuxIdMinus128 = code;
     1376    sei_read_uvlc( pDecodedMessageOutputStream, code, "overlay_alpha_aux_id_minus128" );              sei.m_overlayAlphaAuxIdMinus128 = code;
     1377    sei_read_uvlc( pDecodedMessageOutputStream, code, "overlay_element_label_value_length_minus8" );  sei.m_overlayElementLabelValueLengthMinus8 = code;
     1378    sei_read_uvlc( pDecodedMessageOutputStream, code, "num_overlays_minus1" );                        sei.m_numOverlaysMinus1 = code;
     1379
     1380    sei.m_overlayIdx.resize( sei.m_numOverlaysMinus1+1 );
     1381    sei.m_languageOverlayPresentFlag.resize( sei.m_numOverlaysMinus1+1 );
     1382    sei.m_overlayContentLayerId.resize     ( sei.m_numOverlaysMinus1+1 );
     1383    sei.m_overlayLabelPresentFlag.resize   ( sei.m_numOverlaysMinus1+1 );
     1384    sei.m_overlayLabelLayerId.resize       ( sei.m_numOverlaysMinus1+1 );
     1385    sei.m_overlayAlphaPresentFlag.resize   ( sei.m_numOverlaysMinus1+1 );
     1386    sei.m_overlayAlphaLayerId.resize       ( sei.m_numOverlaysMinus1+1 );
     1387    sei.m_numOverlayElementsMinus1.resize  ( sei.m_numOverlaysMinus1+1 );
     1388    sei.m_overlayElementLabelMin.resize    ( sei.m_numOverlaysMinus1+1 );
     1389    sei.m_overlayElementLabelMax.resize    ( sei.m_numOverlaysMinus1+1 );
     1390    for( Int i = 0; i  <=  sei.m_numOverlaysMinus1; i++ )
     1391    {
     1392      sei_read_uvlc( pDecodedMessageOutputStream, code, "overlay_idx" );                    sei.m_overlayIdx[i]                 = code;
     1393      sei_read_flag( pDecodedMessageOutputStream, code, "language_overlay_present_flag" );  sei.m_languageOverlayPresentFlag[i] = (code == 1);
     1394      sei_read_code( pDecodedMessageOutputStream, 6, code, "overlay_content_layer_id" );    sei.m_overlayContentLayerId[i]      = code;
     1395      sei_read_flag( pDecodedMessageOutputStream, code, "overlay_label_present_flag" );     sei.m_overlayLabelPresentFlag[i]    = (code == 1);
     1396      if( sei.m_overlayLabelPresentFlag[i] )
     1397      {
     1398        sei_read_code( pDecodedMessageOutputStream, 6, code, "overlay_label_layer_id" );     sei.m_overlayLabelLayerId[i]       = code;
     1399      }
     1400      sei_read_flag( pDecodedMessageOutputStream, code, "overlay_alpha_present_flag" );      sei.m_overlayAlphaPresentFlag[i]   = (code == 1);
     1401      if( sei.m_overlayAlphaPresentFlag[i] )
     1402      {
     1403        sei_read_code( pDecodedMessageOutputStream, 6, code, "overlay_alpha_layer_id" );     sei.m_overlayAlphaLayerId[i]       = code;
     1404      }
     1405      if( sei.m_overlayLabelPresentFlag[i] )
     1406      {
     1407        sei_read_uvlc( pDecodedMessageOutputStream, code, "num_overlay_elements_minus1" );   sei.m_numOverlayElementsMinus1[i]  = code;
     1408        sei.m_overlayElementLabelMin[i].resize( sei.m_numOverlayElementsMinus1[i]+1 );
     1409        sei.m_overlayElementLabelMax[i].resize( sei.m_numOverlayElementsMinus1[i]+1 );
     1410        for( Int j = 0; j  <=  sei.m_numOverlayElementsMinus1[i]; j++ )
     1411        {
     1412          sei_read_code( pDecodedMessageOutputStream, sei.m_overlayElementLabelValueLengthMinus8 + 8, code, "overlay_element_label_min" ); sei.m_overlayElementLabelMin[i][j] = code;
     1413          sei_read_code( pDecodedMessageOutputStream, sei.m_overlayElementLabelValueLengthMinus8 + 8, code, "overlay_element_label_max" ); sei.m_overlayElementLabelMax[i][j] = code;
     1414        }
     1415      }
     1416    }
     1417
     1418    // byte alignment
     1419    while ( m_pcBitstream->getNumBitsRead() % 8 != 0 )
     1420    {
     1421      sei_read_flag( pDecodedMessageOutputStream, code, "overlay_zero_bit" );
     1422      assert( code==0 );
     1423    }
     1424
     1425    UChar* sval = new UChar[sei.m_numStringBytesMax];
     1426    UInt slen;
     1427    sei.m_overlayLanguage   .resize( sei.m_numOverlaysMinus1 + 1 );
     1428    sei.m_overlayName       .resize( sei.m_numOverlaysMinus1 + 1 );
     1429    sei.m_overlayElementName.resize( sei.m_numOverlaysMinus1 + 1 );
     1430    for( Int i = 0; i  <=  sei.m_numOverlaysMinus1; i++ )
     1431    {
     1432      if( sei.m_languageOverlayPresentFlag[i] )
     1433      {
     1434        sei_read_string(pDecodedMessageOutputStream, sei.m_numStringBytesMax, sval, slen, "overlay_language");
     1435        sei.m_overlayLanguage[i] = std::string((const char*) sval);
     1436      }
     1437      sei_read_string(pDecodedMessageOutputStream, sei.m_numStringBytesMax, sval, slen, "overlay_name");
     1438      sei.m_overlayName[i] = std::string((const char*) sval);
     1439      if( sei.m_overlayLabelPresentFlag[i] )
     1440      {
     1441        sei.m_overlayElementName[i].resize( sei.m_numOverlayElementsMinus1[i]+1 );
     1442        for( Int j = 0; j  <=  sei.m_numOverlayElementsMinus1[i]; j++ )
     1443        {
     1444          sei_read_string(pDecodedMessageOutputStream, sei.m_numStringBytesMax, sval, slen, "overlay_element_name");
     1445          sei.m_overlayElementName[i][j] = std::string((const char*) sval);
     1446        }
     1447      }
     1448    }
     1449    delete [] sval;
     1450    sei_read_flag( pDecodedMessageOutputStream, code, "overlay_info_persistence_flag" ); sei.m_overlayInfoPersistenceFlag = (code == 1);
     1451  }
     1452};
     1453
     1454Void SEIReader::xParseSEITemporalMvPredictionConstraints(SEITemporalMvPredictionConstraints& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1455{
     1456  UInt code;
     1457  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1458
     1459  sei_read_flag( pDecodedMessageOutputStream, code, "prev_pics_not_used_flag"     ); sei.m_prevPicsNotUsedFlag    = (code == 1);
     1460  sei_read_flag( pDecodedMessageOutputStream, code, "no_intra_layer_col_pic_flag" ); sei.m_noIntraLayerColPicFlag = (code == 1);
     1461};
     1462
     1463#if NH_MV_SEI_TBD
     1464Void SEIReader::xParseSEIFrameFieldInfo(SEIFrameFieldInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1465{
     1466  UInt code;
     1467  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1468
     1469  sei_read_code( pDecodedMessageOutputStream, 4, code, "ffinfo_pic_struct" ); sei.m_ffinfoPicStruct = code;
     1470  sei_read_code( pDecodedMessageOutputStream, 2, code, "ffinfo_source_scan_type" ); sei.m_ffinfoSourceScanType = code;
     1471  sei_read_flag( pDecodedMessageOutputStream, code, "ffinfo_duplicate_flag" ); sei.m_ffinfoDuplicateFlag = (code == 1);
     1472};
     1473#endif
     1474
     1475Void SEIReader::xParseSEIThreeDimensionalReferenceDisplaysInfo(SEIThreeDimensionalReferenceDisplaysInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1476{
     1477  UInt code;
     1478  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1479
     1480  sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_ref_display_width" ); sei.m_precRefDisplayWidth = code;
     1481  sei_read_flag( pDecodedMessageOutputStream, code, "ref_viewing_distance_flag" ); sei.m_refViewingDistanceFlag = (code == 1);
     1482  if( sei.m_refViewingDistanceFlag )
     1483  {
     1484    sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_ref_viewing_dist" ); sei.m_precRefViewingDist = code;
     1485  }
     1486  sei_read_uvlc( pDecodedMessageOutputStream, code, "num_ref_displays_minus1" ); sei.m_numRefDisplaysMinus1 = code;
     1487  sei.resizeArrays( );
     1488  for( Int i = 0; i  <=  sei.getNumRefDisplaysMinus1( ); i++ )
     1489  {
     1490    sei_read_uvlc( pDecodedMessageOutputStream, code, "left_view_id" ); sei.m_leftViewId[i] = code;
     1491    sei_read_uvlc( pDecodedMessageOutputStream, code, "right_view_id" ); sei.m_rightViewId[i] = code;
     1492    sei_read_code( pDecodedMessageOutputStream, 6, code, "exponent_ref_display_width" ); sei.m_exponentRefDisplayWidth[i] = code;
     1493    sei_read_code( pDecodedMessageOutputStream, sei.getMantissaReferenceDisplayWidthLen(i), code, "mantissa_ref_display_width" ); sei.m_mantissaRefDisplayWidth[i] =  code      ;
     1494    if( sei.m_refViewingDistanceFlag )
     1495    {
     1496      sei_read_code( pDecodedMessageOutputStream, 6, code, "exponent_ref_viewing_distance" ); sei.m_exponentRefViewingDistance[i] = code;
     1497      sei_read_code( pDecodedMessageOutputStream, sei.getMantissaReferenceViewingDistanceLen(i), code, "mantissa_ref_viewing_distance" ); sei.m_mantissaRefViewingDistance[i] = code;
     1498    }
     1499    sei_read_flag( pDecodedMessageOutputStream, code, "additional_shift_present_flag" ); sei.m_additionalShiftPresentFlag[i] = (code == 1);
     1500    if( sei.m_additionalShiftPresentFlag[i] )
     1501    {
     1502      sei_read_code( pDecodedMessageOutputStream, 10, code, "num_sample_shift_plus512" ); sei.m_numSampleShiftPlus512[i] = code;
     1503    }
     1504  }
     1505  sei_read_flag( pDecodedMessageOutputStream, code, "three_dimensional_reference_displays_extension_flag" ); sei.m_threeDimensionalReferenceDisplaysExtensionFlag = (code == 1);
     1506};
     1507
     1508#if SEI_DRI_F0169
     1509Void SEIReader::xParseSEIDepthRepInfoElement(double& f,std::ostream *pDecodedMessageOutputStream)
     1510{
     1511    UInt val;
     1512    UInt x_sign,x_mantissa_len,x_mantissa;
     1513    Int x_exp;
     1514
     1515    sei_read_flag(pDecodedMessageOutputStream,     val,"da_sign_flag");  x_sign = val ? 1 : 0 ;
     1516    sei_read_code(pDecodedMessageOutputStream,  7, val, "da_exponent" );         x_exp = val-31;
     1517    sei_read_code(pDecodedMessageOutputStream,  5, val, "da_mantissa_len_minus1" );         x_mantissa_len = val+1;
     1518    sei_read_code(pDecodedMessageOutputStream,  x_mantissa_len, val, "da_mantissa" );         x_mantissa = val;
     1519    if (x_mantissa_len>=16)
     1520    {
     1521        f =1.0 +  (x_mantissa*1.0)/(1u<<(x_mantissa_len-16))/(256.0*256.0 );
     1522    }else
     1523    {
     1524        f =1.0 +  (x_mantissa*1.0)/(1u<<x_mantissa_len);
     1525    }
     1526    double m=1.0;
     1527    int i;
     1528    if (x_exp<0)
     1529    {
     1530        for(i=0;i<-x_exp;i++)
     1531            m = m * 2;
     1532
     1533        f = f/m;
     1534    }
     1535    else
     1536    {
     1537        for(i=0;i<x_exp;i++)
     1538            m = m * 2;
     1539
     1540        f= f * m;
     1541    }
     1542    if (x_sign==1)
     1543    {
     1544        f= -f;
     1545    }
     1546};
     1547
     1548Void SEIReader::xParseSEIDepthRepresentationInfo(SEIDepthRepresentationInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1549{
     1550    UInt code;
     1551    double zNear,zFar,dMin,dMax;
     1552    bool zNearFlag,zFarFlag,dMinFlag,dMaxFlag;
     1553    int depth_representation_type,disparityRefViewId,depthNonlinearRepresentationNumMinus1;
     1554    std::vector<int> DepthNonlinearRepresentationModel;
     1555
     1556    sei.clear();
     1557
     1558    output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1559
     1560    sei_read_flag( pDecodedMessageOutputStream, code, "z_near_flag" );    zNearFlag  = (code == 1);
     1561    sei_read_flag( pDecodedMessageOutputStream, code, "z_far_flag" );     zFarFlag = (code == 1);
     1562    sei_read_flag( pDecodedMessageOutputStream, code, "d_min_flag" );     dMinFlag = (code == 1);
     1563    sei_read_flag( pDecodedMessageOutputStream, code, "d_max_flag" );     dMaxFlag = (code == 1);
     1564    sei_read_uvlc( pDecodedMessageOutputStream, code, "depth_representation_type" ); depth_representation_type = code;
     1565
     1566    sei.m_zNearFlag.push_back(zNearFlag);
     1567    sei.m_zFarFlag.push_back(zFarFlag);
     1568    sei.m_dMinFlag.push_back(dMinFlag);
     1569    sei.m_dMaxFlag.push_back(dMaxFlag);
     1570
     1571    sei.m_depthRepresentationType.push_back(IntAry1d(1,depth_representation_type));
     1572
     1573    if( dMinFlag  ||  dMaxFlag )
     1574    {
     1575        sei_read_uvlc( pDecodedMessageOutputStream, code, "disparity_ref_view_id" ); disparityRefViewId = code;
     1576        sei.m_disparityRefViewId.push_back(IntAry1d(1,disparityRefViewId));
     1577    }
     1578    if( zNearFlag )
     1579    {
     1580        xParseSEIDepthRepInfoElement(zNear , pDecodedMessageOutputStream);
     1581        sei.m_zNear.push_back(std::vector<double>(1,zNear));
     1582    }
     1583    if( zFarFlag )
     1584    {
     1585        xParseSEIDepthRepInfoElement(zFar , pDecodedMessageOutputStream);
     1586        sei.m_zFar.push_back(std::vector<double>(1,zFar));
     1587    }
     1588    if( dMinFlag )
     1589    {
     1590        xParseSEIDepthRepInfoElement(dMin , pDecodedMessageOutputStream);
     1591        sei.m_dMin.push_back(std::vector<double>(1,dMin));
     1592    }
     1593    if( dMaxFlag )
     1594    {
     1595        xParseSEIDepthRepInfoElement(dMax , pDecodedMessageOutputStream);
     1596        sei.m_dMax.push_back(std::vector<double>(1,dMax));
     1597    }
     1598    if( depth_representation_type  ==  3 )
     1599    {
     1600        sei_read_uvlc( pDecodedMessageOutputStream, code, "depth_nonlinear_representation_num_minus1" ); depthNonlinearRepresentationNumMinus1 = code;
     1601        sei.m_depthNonlinearRepresentationNumMinus1.push_back(IntAry1d(1,depthNonlinearRepresentationNumMinus1));
     1602        for( Int i = 1; i  <=  depthNonlinearRepresentationNumMinus1 + 1; i++ )
     1603        {
     1604            sei_read_uvlc(pDecodedMessageOutputStream,code,"DepthNonlinearRepresentationModel" ) ;
     1605            DepthNonlinearRepresentationModel.push_back(code);
     1606        }
     1607
     1608        sei.m_depth_nonlinear_representation_model.push_back(DepthNonlinearRepresentationModel);
     1609    }
     1610}
     1611#endif
     1612Void SEIReader::xParseSEIMultiviewSceneInfo(SEIMultiviewSceneInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1613{
     1614  UInt  code;
     1615  Int  sCode;
     1616  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1617
     1618  sei_read_svlc( pDecodedMessageOutputStream, sCode, "min_disparity" )      ; sei.m_minDisparity      = sCode;
     1619  sei_read_uvlc( pDecodedMessageOutputStream, code , "max_disparity_range" ); sei.m_maxDisparityRange = code;
     1620};
     1621
     1622Void SEIReader::xParseSEIMultiviewAcquisitionInfo(SEIMultiviewAcquisitionInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1623{
     1624  UInt code;
     1625  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1626
     1627  sei.resizeArrays( );
     1628  sei_read_flag( pDecodedMessageOutputStream, code, "intrinsic_param_flag" ); sei.m_intrinsicParamFlag = (code == 1);
     1629  sei_read_flag( pDecodedMessageOutputStream, code, "extrinsic_param_flag" ); sei.m_extrinsicParamFlag = (code == 1);
     1630  if( sei.m_intrinsicParamFlag )
     1631  {
     1632    sei_read_flag( pDecodedMessageOutputStream, code, "intrinsic_params_equal_flag" ); sei.m_intrinsicParamsEqualFlag = (code == 1);
     1633    sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_focal_length"           ); sei.m_precFocalLength          =  code      ;
     1634    sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_principal_point"        ); sei.m_precPrincipalPoint       =  code      ;
     1635    sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_skew_factor"            ); sei.m_precSkewFactor           =  code      ;
     1636
     1637    for( Int i = 0; i  <=  ( sei.m_intrinsicParamsEqualFlag ? 0 : sei.getNumViewsMinus1() ); i++ )
     1638    {
     1639      sei_read_flag( pDecodedMessageOutputStream,                                         code, "sign_focal_length_x"        ); sei.m_signFocalLengthX       [i] = (code == 1);
     1640      sei_read_code( pDecodedMessageOutputStream, 6,                                      code, "exponent_focal_length_x"    ); sei.m_exponentFocalLengthX   [i] =  code      ;
     1641      sei_read_code( pDecodedMessageOutputStream, sei.getMantissaFocalLengthXLen   ( i ), code, "mantissa_focal_length_x"    ); sei.m_mantissaFocalLengthX   [i] =  code      ;
     1642      sei_read_flag( pDecodedMessageOutputStream,                                         code, "sign_focal_length_y"        ); sei.m_signFocalLengthY       [i] = (code == 1);
     1643      sei_read_code( pDecodedMessageOutputStream, 6,                                      code, "exponent_focal_length_y"    ); sei.m_exponentFocalLengthY   [i] =  code      ;
     1644      sei_read_code( pDecodedMessageOutputStream, sei.getMantissaFocalLengthYLen   ( i ), code, "mantissa_focal_length_y"    ); sei.m_mantissaFocalLengthY   [i] =  code      ;
     1645      sei_read_flag( pDecodedMessageOutputStream,                                         code, "sign_principal_point_x"     ); sei.m_signPrincipalPointX    [i] = (code == 1);
     1646      sei_read_code( pDecodedMessageOutputStream, 6,                                      code, "exponent_principal_point_x" ); sei.m_exponentPrincipalPointX[i] =  code      ;
     1647      sei_read_code( pDecodedMessageOutputStream, sei.getMantissaPrincipalPointXLen( i ), code, "mantissa_principal_point_x" ); sei.m_mantissaPrincipalPointX[i] =  code      ;
     1648      sei_read_flag( pDecodedMessageOutputStream,                                         code, "sign_principal_point_y"     ); sei.m_signPrincipalPointY    [i] = (code == 1);
     1649      sei_read_code( pDecodedMessageOutputStream, 6,                                      code, "exponent_principal_point_y" ); sei.m_exponentPrincipalPointY[i] =  code      ;
     1650      sei_read_code( pDecodedMessageOutputStream, sei.getMantissaPrincipalPointYLen( i ), code, "mantissa_principal_point_y" ); sei.m_mantissaPrincipalPointY[i] =  code      ;
     1651      sei_read_flag( pDecodedMessageOutputStream,                                         code, "sign_skew_factor"           ); sei.m_signSkewFactor         [i] = (code == 1);
     1652      sei_read_code( pDecodedMessageOutputStream, 6,                                      code, "exponent_skew_factor"       ); sei.m_exponentSkewFactor     [i] =  code      ;
     1653      sei_read_code( pDecodedMessageOutputStream, sei.getMantissaSkewFactorLen     ( i ), code, "mantissa_skew_factor"       ); sei.m_mantissaSkewFactor     [i] =  code      ;
     1654    }
     1655  }
     1656  if( sei.m_extrinsicParamFlag )
     1657  {
     1658    sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_rotation_param"    ); sei.m_precRotationParam    = code;
     1659    sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_translation_param" ); sei.m_precTranslationParam = code;
     1660
     1661    for( Int i = 0; i  <=  sei.getNumViewsMinus1(); i++ )
     1662    {
     1663      for( Int j = 0; j  <=  2; j++ )  /* row */
     1664      {
     1665        for( Int k = 0; k  <=  2; k++ )  /* column */
     1666        {
     1667          sei_read_flag( pDecodedMessageOutputStream,                                 code, "sign_r"     ); sei.m_signR    [i][j][k] = (code == 1);
     1668          sei_read_code( pDecodedMessageOutputStream, 6,                              code, "exponent_r" ); sei.m_exponentR[i][j][k] =  code      ;
     1669          sei_read_code( pDecodedMessageOutputStream, sei.getMantissaRLen( i, j, k ), code, "mantissa_r" ); sei.m_mantissaR[i][j][k] =  code      ;
     1670        }
     1671        sei_read_flag( pDecodedMessageOutputStream,                              code, "sign_t"     ); sei.m_signT    [i][j] = (code == 1);
     1672        sei_read_code( pDecodedMessageOutputStream, 6,                           code, "exponent_t" ); sei.m_exponentT[i][j] =  code      ;
     1673        sei_read_code( pDecodedMessageOutputStream, sei.getMantissaTLen( i, j ), code, "mantissa_t" ); sei.m_mantissaT[i][j] =  code      ;
     1674      }
     1675    }
     1676  }
     1677};
     1678
     1679
     1680
     1681Void SEIReader::xParseSEIMultiviewViewPosition(SEIMultiviewViewPosition& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1682{
     1683  UInt code;
     1684  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1685
     1686  sei_read_uvlc( pDecodedMessageOutputStream, code, "num_views_minus1" ); sei.m_numViewsMinus1 = code;
     1687  sei.m_viewPosition.resize( sei.m_numViewsMinus1 + 1 );
     1688  for( Int i = 0; i  <=  sei.m_numViewsMinus1; i++ )
     1689  {
     1690    sei_read_uvlc( pDecodedMessageOutputStream, code, "view_position" ); sei.m_viewPosition[i] = code;
     1691  }
     1692};
     1693
     1694#if NH_3D
     1695Void SEIReader::xParseSEIAlternativeDepthInfo(SEIAlternativeDepthInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1696{
     1697  UInt code;
     1698  Int scode;
     1699  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     1700
     1701  sei.resizeArrays( );
     1702  sei_read_flag( pDecodedMessageOutputStream, code, "alternative_depth_info_cancel_flag" ); sei.m_alternativeDepthInfoCancelFlag = (code == 1);
     1703  if( sei.m_alternativeDepthInfoCancelFlag  ==  0 )
     1704  {
     1705    sei_read_code( pDecodedMessageOutputStream, 2, code, "depth_type" ); sei.m_depthType = code;
     1706    if( sei.m_depthType  ==  0 )
     1707    {
     1708      sei_read_uvlc( pDecodedMessageOutputStream, code, "num_constituent_views_gvd_minus1" ); sei.m_numConstituentViewsGvdMinus1 = code;
     1709      sei_read_flag( pDecodedMessageOutputStream, code, "depth_present_gvd_flag" ); sei.m_depthPresentGvdFlag = (code == 1);
     1710      sei_read_flag( pDecodedMessageOutputStream, code, "z_gvd_flag" ); sei.m_zGvdFlag = (code == 1);
     1711      sei_read_flag( pDecodedMessageOutputStream, code, "intrinsic_param_gvd_flag" ); sei.m_intrinsicParamGvdFlag = (code == 1);
     1712      sei_read_flag( pDecodedMessageOutputStream, code, "rotation_gvd_flag" ); sei.m_rotationGvdFlag = (code == 1);
     1713      sei_read_flag( pDecodedMessageOutputStream, code, "translation_gvd_flag" ); sei.m_translationGvdFlag = (code == 1);
     1714      if( sei.m_zGvdFlag )
     1715      {
     1716        for( Int i = 0, j = 0; j <=  sei.m_numConstituentViewsGvdMinus1 + 1; j++ )
     1717        {
     1718          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_z_near_flag" ); sei.m_signGvdZNearFlag[i][j] = (code == 1);
     1719          sei_read_code( pDecodedMessageOutputStream, 7, code, "exp_gvd_z_near" ); sei.m_expGvdZNear[i][j] = code;
     1720          sei_read_code( pDecodedMessageOutputStream, 5, code, "man_len_gvd_z_near_minus1" ); sei.m_manLenGvdZNearMinus1[i][j] = code;
     1721          sei_read_code( pDecodedMessageOutputStream, sei.m_manLenGvdZNearMinus1[i][j]+1, code, "man_gvd_z_near" ); sei.m_manGvdZNear[i][j] = code;
     1722          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_z_far_flag" ); sei.m_signGvdZFarFlag[i][j] = (code == 1);
     1723          sei_read_code( pDecodedMessageOutputStream, 7, code, "exp_gvd_z_far" ); sei.m_expGvdZFar[i][j] = code;
     1724          sei_read_code( pDecodedMessageOutputStream, 5, code, "man_len_gvd_z_far_minus1" ); sei.m_manLenGvdZFarMinus1[i][j] = code;
     1725          sei_read_code( pDecodedMessageOutputStream, sei.m_manLenGvdZFarMinus1[i][j]+1, code, "man_gvd_z_far" ); sei.m_manGvdZFar[i][j] = code;
     1726        }
     1727      }
     1728      if( sei.m_intrinsicParamGvdFlag )
     1729      {
     1730        sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_gvd_focal_length" ); sei.m_precGvdFocalLength = code;
     1731        sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_gvd_principal_point" ); sei.m_precGvdPrincipalPoint = code;
     1732      }
     1733      if( sei.m_rotationGvdFlag )
     1734      {
     1735        sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_gvd_rotation_param" ); sei.m_precGvdRotationParam = code;
     1736      }
     1737      if( sei.m_translationGvdFlag )
     1738      {
     1739        sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_gvd_translation_param" ); sei.m_precGvdTranslationParam = code;
     1740      }
     1741      for( Int i = 0, j = 0; j <= sei.m_numConstituentViewsGvdMinus1 + 1; j++ )
     1742      {
     1743        if( sei.m_intrinsicParamGvdFlag )
     1744        {
     1745          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_focal_length_x" ); sei.m_signGvdFocalLengthX[i][j] = (code == 1);
     1746          sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_focal_length_x" ); sei.m_expGvdFocalLengthX[i][j] = code;
     1747          sei_read_code( pDecodedMessageOutputStream, sei.getManGvdFocalLengthXLen(i,j), code, "man_gvd_focal_length_x" ); sei.m_manGvdFocalLengthX[i][j] = code;
     1748          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_focal_length_y" ); sei.m_signGvdFocalLengthY[i][j] = (code == 1);
     1749          sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_focal_length_y" ); sei.m_expGvdFocalLengthY[i][j] = code;
     1750          sei_read_code( pDecodedMessageOutputStream, sei.getManGvdFocalLengthYLen(i,j), code, "man_gvd_focal_length_y" ); sei.m_manGvdFocalLengthY[i][j] = code;
     1751          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_principal_point_x" ); sei.m_signGvdPrincipalPointX[i][j] = (code == 1);
     1752          sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_principal_point_x" ); sei.m_expGvdPrincipalPointX[i][j] = code;
     1753          sei_read_code( pDecodedMessageOutputStream, sei.getManGvdPrincipalPointXLen(i,j), code, "man_gvd_principal_point_x" ); sei.m_manGvdPrincipalPointX[i][j] = code;
     1754          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_principal_point_y" ); sei.m_signGvdPrincipalPointY[i][j] = (code == 1);
     1755          sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_principal_point_y" ); sei.m_expGvdPrincipalPointY[i][j] = code;
     1756          sei_read_code( pDecodedMessageOutputStream, sei.getManGvdPrincipalPointYLen(i,j), code, "man_gvd_principal_point_y" ); sei.m_manGvdPrincipalPointY[i][j] = code;
     1757        }
     1758        if( sei.m_rotationGvdFlag )
     1759        {
     1760          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_r00" ); sei.m_signGvdR00[i][j] = (code == 1);
     1761          sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_r00" ); sei.m_expGvdR00[i][j] = code;
     1762          sei_read_code( pDecodedMessageOutputStream, sei.m_precGvdRotationParam, code, "man_gvd_r00" ); sei.m_manGvdR00[i][j] = code;
     1763          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_r01" ); sei.m_signGvdR01[i][j] = (code == 1);
     1764          sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_r01" ); sei.m_expGvdR01[i][j] = code;
     1765          sei_read_code( pDecodedMessageOutputStream, sei.m_precGvdRotationParam, code, "man_gvd_r01" ); sei.m_manGvdR01[i][j] = code;
     1766          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_r02" ); sei.m_signGvdR02[i][j] = (code == 1);
     1767          sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_r02" ); sei.m_expGvdR02[i][j] = code;
     1768          sei_read_code( pDecodedMessageOutputStream, sei.m_precGvdRotationParam, code, "man_gvd_r02" ); sei.m_manGvdR02[i][j] = code;
     1769          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_r10" ); sei.m_signGvdR10[i][j] = (code == 1);
     1770          sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_r10" ); sei.m_expGvdR10[i][j] = code;
     1771          sei_read_code( pDecodedMessageOutputStream, sei.m_precGvdRotationParam, code, "man_gvd_r10" ); sei.m_manGvdR10[i][j] = code;
     1772          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_r11" ); sei.m_signGvdR11[i][j] = (code == 1);
     1773          sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_r11" ); sei.m_expGvdR11[i][j] = code;
     1774          sei_read_code( pDecodedMessageOutputStream, sei.m_precGvdRotationParam, code, "man_gvd_r11" ); sei.m_manGvdR11[i][j] = code;
     1775          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_r12" ); sei.m_signGvdR12[i][j] = (code == 1);
     1776          sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_r12" ); sei.m_expGvdR12[i][j] = code;
     1777          sei_read_code( pDecodedMessageOutputStream, sei.m_precGvdRotationParam, code, "man_gvd_r12" ); sei.m_manGvdR12[i][j] = code;
     1778          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_r20" ); sei.m_signGvdR20[i][j] = (code == 1);
     1779          sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_r20" ); sei.m_expGvdR20[i][j] = code;
     1780          sei_read_code( pDecodedMessageOutputStream, sei.m_precGvdRotationParam, code, "man_gvd_r20" ); sei.m_manGvdR20[i][j] = code;
     1781          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_r21" ); sei.m_signGvdR21[i][j] = (code == 1);
     1782          sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_r21" ); sei.m_expGvdR21[i][j] = code;
     1783          sei_read_code( pDecodedMessageOutputStream, sei.m_precGvdRotationParam, code, "man_gvd_r21" ); sei.m_manGvdR21[i][j] = code;
     1784          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_r22" ); sei.m_signGvdR22[i][j] = (code == 1);
     1785          sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_r22" ); sei.m_expGvdR22[i][j] = code;
     1786          sei_read_code( pDecodedMessageOutputStream, sei.m_precGvdRotationParam, code, "man_gvd_r22" ); sei.m_manGvdR22[i][j] = code;
     1787          //sei_read_code( pDecodedMessageOutputStream, sei.getManGvdRLen(i,j,k), code, "man_gvd_r" ); sei.m_manGvdR[i][j] = code;
     1788        }
     1789        if( sei.m_translationGvdFlag )
     1790        {
     1791          sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_t_x" ); sei.m_signGvdTX[i][j] = (code == 1);
     1792          sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_t_x" ); sei.m_expGvdTX[i][j] = code;
     1793          sei_read_code( pDecodedMessageOutputStream, sei.getManGvdTXLen(i,j), code, "man_gvd_t_x" ); sei.m_manGvdTX[i][j] = code;
     1794        }
     1795      }
     1796    }
     1797
     1798    if( sei.m_depthType  ==  1 )
     1799    {
     1800      sei_read_svlc( pDecodedMessageOutputStream, scode, "min_offset_x_int" ); sei.m_minOffsetXInt = scode;
     1801      sei_read_code( pDecodedMessageOutputStream, 8, code, "min_offset_x_frac" ); sei.m_minOffsetXFrac = code;
     1802      sei_read_svlc( pDecodedMessageOutputStream, scode, "max_offset_x_int" ); sei.m_maxOffsetXInt = scode;
     1803      sei_read_code( pDecodedMessageOutputStream, 8, code, "max_offset_x_frac" ); sei.m_maxOffsetXFrac = code;
     1804      sei_read_flag( pDecodedMessageOutputStream, code, "offset_y_present_flag" ); sei.m_offsetYPresentFlag = (code == 1);
     1805      if( sei.m_offsetYPresentFlag )
     1806      {
     1807        sei_read_svlc( pDecodedMessageOutputStream, scode, "min_offset_y_int" ); sei.m_minOffsetYInt = scode;
     1808        sei_read_code( pDecodedMessageOutputStream, 8, code, "min_offset_y_frac" ); sei.m_minOffsetYFrac = code;
     1809        sei_read_svlc( pDecodedMessageOutputStream, scode, "max_offset_y_int" ); sei.m_maxOffsetYInt = scode;
     1810        sei_read_code( pDecodedMessageOutputStream, 8, code, "max_offset_y_frac" ); sei.m_maxOffsetYFrac = code;
     1811      }
     1812      sei_read_flag( pDecodedMessageOutputStream, code, "warp_map_size_present_flag" ); sei.m_warpMapSizePresentFlag = (code == 1);
     1813      if( sei.m_warpMapSizePresentFlag )
     1814      {
     1815        sei_read_uvlc( pDecodedMessageOutputStream, code, "warp_map_width_minus2" ); sei.m_warpMapWidthMinus2 = code;
     1816        sei_read_uvlc( pDecodedMessageOutputStream, code, "warp_map_height_minus2" ); sei.m_warpMapHeightMinus2 = code;
     1817      }
     1818    }
     1819  }
     1820};
     1821#endif
     1822
    11031823//! \}
  • trunk/source/Lib/TLibDecoder/SEIread.h

    r1313 r1356  
    5656  SEIReader() {};
    5757  virtual ~SEIReader() {};
     58#if NH_MV_LAYERS_NOT_PRESENT_SEI
     59  Void parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
     60#else
    5861  Void parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
     62#endif
     63#if NH_MV_SEI
     64  Void setLayerId                            ( Int   layerId )   { m_layerId  = layerId; };
     65  Void setDecOrder                           ( Int64 decOrder )  { m_decOrder = decOrder; };
     66#endif
    5967protected:
     68#if NH_MV_LAYERS_NOT_PRESENT_SEI
     69  Void xReadSEImessage                        (SEIMessages& seis, const NalUnitType nalUnitType, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
     70#else
    6071  Void xReadSEImessage                        (SEIMessages& seis, const NalUnitType nalUnitType, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
     72#endif
    6173  Void xParseSEIuserDataUnregistered          (SEIuserDataUnregistered &sei,          UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    6274  Void xParseSEIActiveParameterSets           (SEIActiveParameterSets  &sei,          UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     
    7486  Void xParseSEIToneMappingInfo               (SEIToneMappingInfo& sei,               UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    7587  Void xParseSEISOPDescription                (SEISOPDescription &sei,                UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     88#if NH_MV_LAYERS_NOT_PRESENT_SEI
     89  Void xParseSEIScalableNesting               (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
     90#else
    7691  Void xParseSEIScalableNesting               (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
     92#endif
    7793  Void xParseSEITempMotionConstraintsTileSets (SEITempMotionConstrainedTileSets& sei, UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    7894  Void xParseSEITimeCode                      (SEITimeCode& sei,                      UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     
    8197  Void xParseSEIMasteringDisplayColourVolume  (SEIMasteringDisplayColourVolume& sei,  UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    8298#if NH_MV
     99#if !NH_MV_SEI
    83100  Void  xParseSEISubBitstreamProperty         (SEISubBitstreamProperty &sei        ,  UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    84101  Void  xResizeSubBitstreamPropertySeiArrays  (SEISubBitstreamProperty &sei);
     102#endif
     103#endif
     104#if NH_MV_LAYERS_NOT_PRESENT_SEI
     105  Void xParseSEILayersNotPresent              (SEILayersNotPresent &sei, UInt payloadSize, const TComVPS *vps ,std::ostream *pDecodedMessageOutputStream);
     106#endif
     107  Void xParseSEIInterLayerConstrainedTileSets (SEIInterLayerConstrainedTileSets& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     108#if NH_MV_SEI_TBD
     109  Void xParseSEIBspNesting                    (SEIBspNesting& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     110  Void xParseSEIBspInitialArrivalTime         (SEIBspInitialArrivalTime& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     111#endif
     112  Void xParseSEISubBitstreamProperty          (SEISubBitstreamProperty& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     113  Void xParseSEIAlphaChannelInfo              (SEIAlphaChannelInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     114  Void xParseSEIOverlayInfo                   (SEIOverlayInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     115  Void xParseSEITemporalMvPredictionConstraints(SEITemporalMvPredictionConstraints& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     116#if NH_MV_SEI_TBD
     117  Void xParseSEIFrameFieldInfo                (SEIFrameFieldInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     118#endif
     119  Void xParseSEIThreeDimensionalReferenceDisplaysInfo (SEIThreeDimensionalReferenceDisplaysInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     120#if SEI_DRI_F0169
     121  Void xParseSEIDepthRepInfoElement           (double &f,std::ostream *pDecodedMessageOutputStream);
     122  Void xParseSEIDepthRepresentationInfo       (SEIDepthRepresentationInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     123#endif
     124  Void xParseSEIMultiviewSceneInfo            (SEIMultiviewSceneInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     125
     126  Void xParseSEIMultiviewAcquisitionInfo      (SEIMultiviewAcquisitionInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     127
     128#if NH_MV_SEI
     129  Void xParseSEIMultiviewViewPosition         (SEIMultiviewViewPosition& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     130#endif
     131#if NH_3D
     132  Void xParseSEIAlternativeDepthInfo          (SEIAlternativeDepthInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
    85133#endif
    86134
     
    89137  Void sei_read_svlc(std::ostream *pOS,                Int&  ruiCode, const Char *pSymbolName);
    90138  Void sei_read_flag(std::ostream *pOS,                UInt& ruiCode, const Char *pSymbolName);
     139  Void sei_read_string(std::ostream *pOS, UInt uiBufSize, UChar* pucCode, UInt& ruiLength, const Char *pSymbolName);
     140#if NH_MV_SEI
     141  inline Void output_sei_message_header(SEI &sei, std::ostream *pDecodedMessageOutputStream, UInt payloadSize);
     142private:
     143  Int   m_layerId;
     144  Int64 m_decOrder;   
     145#endif
    91146};
    92147
  • trunk/source/Lib/TLibDecoder/SyntaxElementParser.cpp

    r1313 r1356  
    152152}
    153153
     154Void  SyntaxElementParser::xReadStringTr        (UInt buSize, UChar *pValue, UInt& rLength, const Char *pSymbolName)
     155{
     156#if RExt__DECODER_DEBUG_BIT_STATISTICS
     157  xReadString (buSize, pValue, rLength, pSymbolName);
     158#else
     159  xReadString(buSize, pValue, rLength);
     160#endif 
     161  fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter++ );
     162  fprintf( g_hTrace, "%-50s st(v=%d)  : %s\n", pSymbolName, rLength, pValue );
     163  fflush ( g_hTrace );
     164}
     165
    154166Void  xTraceAccessUnitDelimiter ()
    155167{
     
    269281}
    270282
     283#if RExt__DECODER_DEBUG_BIT_STATISTICS
     284Void  SyntaxElementParser::xReadString  (UInt bufSize, UChar *pVal, UInt& rLength, const Char *pSymbolName)
     285#else
     286Void  SyntaxElementParser::xReadString  (UInt bufSize, UChar *pVal, UInt& rLength)
     287#endif
     288{
     289  assert( m_pcBitstream->getNumBitsRead() % 8 == 0 ); //always start reading at a byte-aligned position 
     290  UInt val;
     291  UInt i;
     292  for (i=0 ; i<bufSize ; ++i )
     293  {
     294    m_pcBitstream->readByte( val );
     295    pVal[i] = val;
     296    if ( val == 0)
     297    {
     298      break;
     299    }
     300  }
     301  rLength = i;
     302  assert( pVal[rLength] == 0 ); 
     303}
     304
    271305Void SyntaxElementParser::xReadRbspTrailingBits()
    272306{
  • trunk/source/Lib/TLibDecoder/SyntaxElementParser.h

    r1313 r1356  
    4949#define READ_SVLC(        code, name)     xReadSvlcTr (         code, name )
    5050#define READ_FLAG(        code, name)     xReadFlagTr (         code, name )
     51#define READ_STRING(bufSize, code, length, name)   xReadStringTr ( bufSize, code, length, name )
    5152
    5253#else
     
    5859#define READ_SVLC(        code, name)     xReadSvlc (         code, name )
    5960#define READ_FLAG(        code, name)     xReadFlag (         code, name )
     61#define READ_STRING(bufSize, code, length, name)   xReadString ( bufSize, code, length, name )
    6062
    6163#else
     
    6567#define READ_SVLC(        code, name)     xReadSvlc (         code )
    6668#define READ_FLAG(        code, name)     xReadFlag (         code )
     69#define READ_STRING(bufSize, code, length, name)   xReadString ( bufSize, code, length )
    6770
    6871#endif
     
    9295  Void  xReadSvlc    ( Int&   val, const Char *pSymbolName );
    9396  Void  xReadFlag    ( UInt&  val, const Char *pSymbolName );
     97  Void  xReadString  ( UInt bufSize, UChar *val, UInt& length, const Char *pSymbolName);
    9498#else
    9599  Void  xReadCode    ( UInt   length, UInt& val );
     
    97101  Void  xReadSvlc    ( Int&   val );
    98102  Void  xReadFlag    ( UInt&  val );
     103  Void  xReadString  ( UInt bufSize, UChar *val, UInt& length);
    99104#endif
    100105#if ENC_DEC_TRACE
     
    103108  Void  xReadSvlcTr  (               Int& rValue, const Char *pSymbolName);
    104109  Void  xReadFlagTr  (              UInt& rValue, const Char *pSymbolName);
     110  Void  xReadStringTr(UInt bufSize, UChar *pValue, UInt& rLength, const Char *pSymbolName);
    105111#endif
    106112public:
  • trunk/source/Lib/TLibDecoder/TDecTop.cpp

    r1321 r1356  
    5959  m_iLog2Precision   = LOG2_DISP_PREC_LUT;
    6060  m_uiBitDepthForLUT = 8; // fixed
    61   m_receivedIdc = NULL; 
    62   m_vps         = NULL; 
     61  m_receivedIdc = NULL;
     62  m_vps         = NULL;
    6363}
    6464
     
    7575  xDeleteArray( m_adBaseViewShiftLUT, MAX_NUM_LAYERS, MAX_NUM_LAYERS, 2 );
    7676  xDeleteArray( m_aiBaseViewShiftLUT, MAX_NUM_LAYERS, MAX_NUM_LAYERS, 2 );
    77   xDeleteArray( m_receivedIdc, m_vps->getNumViews() );
     77  if ( m_receivedIdc != NULL )
     78  {
     79    xDeleteArray( m_receivedIdc, m_vps->getNumViews() );
     80  }
    7881}
    7982
     
    8487  assert( !isInitialized() ); // Only one initialization currently supported
    8588  m_bInitialized            = true;
    86   m_vps                     = vps; 
    87   m_bCamParsVaryOverTime    = false;   
    88   m_lastPoc                 = -1;   
    89   m_firstReceivedPoc        = -2; 
     89  m_vps                     = vps;
     90  m_bCamParsVaryOverTime    = false;
     91  m_lastPoc                 = -1;
     92  m_firstReceivedPoc        = -2;
    9093
    9194  for (Int i = 0; i <= vps->getMaxLayersMinus1(); i++)
    9295  {
    93     Int curViewIdxInVps = m_vps->getVoiInVps( m_vps->getViewIndex( m_vps->getLayerIdInNuh( i ) ) ) ; 
    94     m_bCamParsVaryOverTime = m_bCamParsVaryOverTime || vps->getCpInSliceSegmentHeaderFlag( curViewIdxInVps );   
    95   }
    96 
    97   assert( m_receivedIdc == NULL ); 
    98   m_receivedIdc = new Int*[ m_vps->getNumViews() ]; 
     96    Int curViewIdxInVps = m_vps->getVoiInVps( m_vps->getViewIndex( m_vps->getLayerIdInNuh( i ) ) ) ;
     97    m_bCamParsVaryOverTime = m_bCamParsVaryOverTime || vps->getCpInSliceSegmentHeaderFlag( curViewIdxInVps );
     98  }
     99
     100  assert( m_receivedIdc == NULL );
     101  m_receivedIdc = new Int*[ m_vps->getNumViews() ];
    99102  for (Int i = 0; i < m_vps->getNumViews(); i++)
    100103  {
    101     m_receivedIdc[i] = new Int[ m_vps->getNumViews() ]; 
    102   }
    103 
    104   xResetReceivedIdc( true ); 
     104    m_receivedIdc[i] = new Int[ m_vps->getNumViews() ];
     105  }
     106
     107  xResetReceivedIdc( true );
    105108
    106109  for (Int voiInVps = 0; voiInVps < m_vps->getNumViews(); voiInVps++ )
    107110  {
    108     if( !m_vps->getCpInSliceSegmentHeaderFlag( voiInVps ) ) 
     111    if( !m_vps->getCpInSliceSegmentHeaderFlag( voiInVps ) )
    109112    {
    110113      for (Int baseVoiInVps = 0; baseVoiInVps < m_vps->getNumViews(); baseVoiInVps++ )
    111       { 
     114      {
    112115        if( m_vps->getCpPresentFlag( voiInVps, baseVoiInVps ) )
    113116        {
    114           m_receivedIdc   [ baseVoiInVps ][ voiInVps ] = -1; 
     117          m_receivedIdc   [ baseVoiInVps ][ voiInVps ] = -1;
    115118          m_aaiCodedScale [ baseVoiInVps ][ voiInVps ] = m_vps->getCodedScale    (voiInVps) [ baseVoiInVps ];
    116119          m_aaiCodedOffset[ baseVoiInVps ][ voiInVps ] = m_vps->getCodedOffset   (voiInVps) [ baseVoiInVps ];
    117120
    118           m_receivedIdc   [ voiInVps ][ baseVoiInVps ] = -1; 
     121          m_receivedIdc   [ voiInVps ][ baseVoiInVps ] = -1;
    119122          m_aaiCodedScale [ voiInVps ][ baseVoiInVps ] = m_vps->getInvCodedScale (voiInVps) [ baseVoiInVps ];
    120123          m_aaiCodedOffset[ voiInVps ][ baseVoiInVps ] = m_vps->getInvCodedOffset(voiInVps) [ baseVoiInVps ];
     
    131134{
    132135  for (Int i = 0; i < m_vps->getNumViews(); i++)
    133   { 
     136  {
    134137    for (Int j = 0; j < m_vps->getNumViews(); j++)
    135138    {
    136139      if ( overWriteFlag ||  ( m_receivedIdc[i][j] != -1 ) )
    137140      {
    138         m_receivedIdc[i][j] = 0; 
    139       }     
     141        m_receivedIdc[i][j] = 0;
     142      }
    140143    }
    141144  }
     
    171174}
    172175
    173 Void 
     176Void
    174177  CamParsCollector::xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT)
    175178{
     
    234237  if( m_firstReceivedPoc == -2 )
    235238  {
    236     m_firstReceivedPoc = curPoc; 
    237   }
    238 
    239   Bool newPocFlag = ( m_lastPoc != curPoc ); 
     239    m_firstReceivedPoc = curPoc;
     240  }
     241
     242  Bool newPocFlag = ( m_lastPoc != curPoc );
    240243
    241244  if ( newPocFlag )
    242   {   
     245  {
    243246    if( m_lastPoc != -1 )
    244247    {
     
    246249    }
    247250
    248     xResetReceivedIdc( false ); 
     251    xResetReceivedIdc( false );
    249252    m_lastPoc = pcSlice->getPOC();
    250253  }
    251254
    252   UInt voiInVps          = m_vps->getVoiInVps(pcSlice->getViewIndex()); 
     255  UInt voiInVps          = m_vps->getVoiInVps(pcSlice->getViewIndex());
    253256  if( m_vps->getCpInSliceSegmentHeaderFlag( voiInVps ) ) // check consistency of slice parameters here
    254   {   
     257  {
    255258    for( Int baseVoiInVps = 0; baseVoiInVps < m_vps->getNumViews(); baseVoiInVps++ )
    256     {       
     259    {
    257260      if ( m_vps->getCpPresentFlag( voiInVps, baseVoiInVps ) )
    258261      {
    259262        if ( m_receivedIdc[ voiInVps ][ baseVoiInVps ] != 0 )
    260         {     
     263        {
    261264          AOF( m_aaiCodedScale [ voiInVps ][ baseVoiInVps ] == pcSlice->getInvCodedScale () [ baseVoiInVps ] );
    262265          AOF( m_aaiCodedOffset[ voiInVps ][ baseVoiInVps ] == pcSlice->getInvCodedOffset() [ baseVoiInVps ] );
    263266        }
    264267        else
    265         {         
    266           m_receivedIdc   [ voiInVps ][ baseVoiInVps ]  = 1; 
     268        {
     269          m_receivedIdc   [ voiInVps ][ baseVoiInVps ]  = 1;
    267270          m_aaiCodedScale [ voiInVps ][ baseVoiInVps ]  = pcSlice->getInvCodedScale () [ baseVoiInVps ];
    268271          m_aaiCodedOffset[ voiInVps ][ baseVoiInVps ]  = pcSlice->getInvCodedOffset() [ baseVoiInVps ];
     
    270273        }
    271274        if ( m_receivedIdc[ baseVoiInVps ][ voiInVps ] != 0 )
    272         {     
     275        {
    273276          AOF( m_aaiCodedScale [ baseVoiInVps ][ voiInVps ] == pcSlice->getCodedScale    () [ baseVoiInVps ] );
    274277          AOF( m_aaiCodedOffset[ baseVoiInVps ][ voiInVps ] == pcSlice->getCodedOffset   () [ baseVoiInVps ] );
    275278        }
    276279        else
    277         {       
    278           m_receivedIdc   [ baseVoiInVps ][ voiInVps ]  = 1; 
     280        {
     281          m_receivedIdc   [ baseVoiInVps ][ voiInVps ]  = 1;
    279282          m_aaiCodedScale [ baseVoiInVps ][ voiInVps ]  = pcSlice->getCodedScale    () [ baseVoiInVps ];
    280283          m_aaiCodedOffset[ baseVoiInVps ][ voiInVps ]  = pcSlice->getCodedOffset   () [ baseVoiInVps ];
     
    283286      }
    284287    }
    285   } 
     288  }
    286289}
    287290
     
    295298      fprintf( m_pCodedScaleOffsetFile, "#ViewOrderIdx     ViewIdVal\n" );
    296299      fprintf( m_pCodedScaleOffsetFile, "#------------ -------------\n" );
    297      
     300
    298301      for( UInt voiInVps = 0; voiInVps < m_vps->getNumViews(); voiInVps++ )
    299302      {
     
    315318          {
    316319            if ( m_receivedIdc[baseVoiInVps][voiInVps] != 0 )
    317             {           
     320            {
    318321              fprintf( m_pCodedScaleOffsetFile, "%12d %12d %12d %12d %12d %12d %12d\n",
    319                 iS, iE, m_vps->getViewOIdxList( voiInVps ), m_vps->getViewOIdxList( baseVoiInVps ), 
    320                 m_aaiCodedScale [ baseVoiInVps ][ voiInVps ], 
     322                iS, iE, m_vps->getViewOIdxList( voiInVps ), m_vps->getViewOIdxList( baseVoiInVps ),
     323                m_aaiCodedScale [ baseVoiInVps ][ voiInVps ],
    321324                m_aaiCodedOffset[ baseVoiInVps ][ voiInVps ], m_vps->getCpPrecision() );
    322             }           
     325            }
    323326          }
    324327        }
     
    334337#if !NH_MV
    335338  , m_associatedIRAPType(NAL_UNIT_INVALID)
    336   , m_pocCRA(0) 
     339  , m_pocCRA(0)
    337340  , m_pocRandomAccess(MAX_INT)
    338341  , m_cListPic()
     
    426429    fclose( g_hTrace );
    427430  }
    428 #endif 
     431#endif
    429432#endif
    430433  while (!m_prefixSEINALUs.empty())
     
    465468#endif
    466469#if NH_MV
    467   m_cCavlcDecoder.setDecTop( this ); 
     470  m_cCavlcDecoder.setDecTop( this );
    468471#endif
    469472  m_cGopDecoder.init( &m_cEntropyDecoder, &m_cSbacDecoder, &m_cBinCABAC, &m_cCavlcDecoder, &m_cSliceDecoder, &m_cLoopFilter, &m_cSAO);
     
    653656#if NH_MV
    654657    const TComVPS* vps = m_parameterSetManager.getVPS(sps->getVPSId());
    655     assert (vps != 0); 
    656     // TBD: check the condition on m_firstPicInLayerDecodedFlag 
     658    assert (vps != 0);
     659    // TBD: check the condition on m_firstPicInLayerDecodedFlag
    657660    if (!m_parameterSetManager.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP() || !m_firstPicInLayerDecodedFlag[m_layerId] , m_layerId ) )
    658661#else
     
    671674      {
    672675        //, it is a requirement of bitstream conformance that the value of update_rep_format_flag shall be equal to 0.
    673         assert( sps->getUpdateRepFormatFlag() == false ); 
    674       }
    675       sps->checkRpsMaxNumPics( vps, getLayerId() ); 
    676 
    677       // It is a requirement of bitstream conformance that, when the SPS is referred to by 
    678       // any current picture that belongs to an independent non-base layer, the value of 
     676        assert( sps->getUpdateRepFormatFlag() == false );
     677      }
     678      sps->checkRpsMaxNumPics( vps, getLayerId() );
     679
     680      // It is a requirement of bitstream conformance that, when the SPS is referred to by
     681      // any current picture that belongs to an independent non-base layer, the value of
    679682      // MultiLayerExtSpsFlag derived from the SPS shall be equal to 0.
    680683
    681684      if ( m_layerId > 0 && vps->getNumRefLayers( m_layerId ) == 0 )
    682       { 
    683         assert( sps->getMultiLayerExtSpsFlag() == 0 );
    684       }
    685     }
     685      {
     686        assert( sps->getMultiLayerExtSpsFlag() == 0 );
     687      }
     688    }
     689#if NH_MV_SEI
     690    m_seiReader.setLayerId ( newPic->getLayerId      ( ) );
     691    m_seiReader.setDecOrder( newPic->getDecodingOrder( ) );
     692#endif
    686693#endif
    687694
     
    707714    m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS());
    708715#else
    709     m_pcPic = newPic; 
     716    m_pcPic = newPic;
    710717#endif
    711718
     
    723730#if NH_MV
    724731    pSlice->setPic( m_pcPic );
    725     vps=pSlice->getVPS(); 
     732    vps=pSlice->getVPS();
    726733    // The nuh_layer_id value of the NAL unit containing the PPS that is activated for a layer layerA with nuh_layer_id equal to nuhLayerIdA shall be equal to 0, or nuhLayerIdA, or the nuh_layer_id of a direct or indirect reference layer of layerA.
    727     assert( pps->getLayerId() == m_layerId || pps->getLayerId( ) == 0 || vps->getDependencyFlag( m_layerId, pps->getLayerId() ) );   
     734    assert( pps->getLayerId() == m_layerId || pps->getLayerId( ) == 0 || vps->getDependencyFlag( m_layerId, pps->getLayerId() ) );
    728735    // The nuh_layer_id value of the NAL unit containing the SPS that is activated for a layer layerA with nuh_layer_id equal to nuhLayerIdA shall be equal to 0, or nuhLayerIdA, or the nuh_layer_id of a direct or indirect reference layer of layerA.
    729736    assert( sps->getLayerId() == m_layerId || sps->getLayerId( ) == 0 || vps->getDependencyFlag( m_layerId, sps->getLayerId() ) );
     
    775782  {
    776783#if NH_MV
    777     assert( m_pcPic != NULL ); 
    778     assert( newPic  == NULL ); 
     784    assert( m_pcPic != NULL );
     785    assert( newPic  == NULL );
    779786#endif
    780787    // make the slice-pilot a real slice, and set up the slice-pilot for the next slice
     
    832839    InputNALUnit &nalu=*m_prefixSEINALUs.front();
    833840#if NH_MV
     841#if NH_MV_LAYERS_NOT_PRESENT_SEI
     842    m_seiReader.parseSEImessage(&(nalu.getBitstream()), m_SEIs, nalu.m_nalUnitType, m_parameterSetManager.getActiveVPS(), m_parameterSetManager.getActiveSPS(getLayerId()), m_pDecodedSEIOutputStream);
     843#else
    834844    m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_SEIs, nalu.m_nalUnitType, m_parameterSetManager.getActiveSPS( getLayerId() ), m_pDecodedSEIOutputStream );
     845#endif
    835846#else
    836847    m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_SEIs, nalu.m_nalUnitType, m_parameterSetManager.getActiveSPS(), m_pDecodedSEIOutputStream );
     
    855866  m_cEntropyDecoder.setBitstream      (&(nalu.getBitstream()));
    856867
    857   assert( nalu.m_nuhLayerId == m_layerId );   
     868  assert( nalu.m_nuhLayerId == m_layerId );
    858869  m_apcSlicePilot->initSlice(); // the slice pilot is an object to prepare for a new slice
    859870  // it is not associated with picture, sps or pps structures.
    860   m_apcSlicePilot->setLayerId( nalu.m_nuhLayerId ); 
    861   m_cEntropyDecoder.decodeFirstSliceSegmentInPicFlag( m_apcSlicePilot );   
     871  m_apcSlicePilot->setLayerId( nalu.m_nuhLayerId );
     872  m_cEntropyDecoder.decodeFirstSliceSegmentInPicFlag( m_apcSlicePilot );
    862873  if ( m_apcSlicePilot->getFirstSliceSegementInPicFlag() )
    863874  {
    864 #endif 
     875#endif
    865876    m_uiSliceIdx = 0;
    866877  }
     
    908919  if (m_apcSlicePilot->getRapPicFlag())
    909920  {
    910       if ((m_apcSlicePilot->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && m_apcSlicePilot->getNalUnitType() <= NAL_UNIT_CODED_SLICE_IDR_N_LP) || 
     921      if ((m_apcSlicePilot->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && m_apcSlicePilot->getNalUnitType() <= NAL_UNIT_CODED_SLICE_IDR_N_LP) ||
    911922        (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_bFirstSliceInSequence) ||
    912923        (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_apcSlicePilot->getHandleCraAsBlaFlag()))
     
    924935    else
    925936    {
    926       m_apcSlicePilot->setNoOutputPriorPicsFlag(false); 
     937      m_apcSlicePilot->setNoOutputPriorPicsFlag(false);
    927938    }
    928939
     
    950961    }
    951962  }
    952  
     963
    953964  if (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_craNoRaslOutputFlag) //Reset POC MSB when CRA has NoRaslOutputFlag equal to 1
    954965  {
     
    10441055  {
    10451056    //Check Multiview Main profile constraint in G.11.1.1
    1046     //  When ViewOrderIdx[ i ] derived according to any active VPS is equal to 1 
    1047     //  for the layer with nuh_layer_id equal to i in subBitstream, 
    1048     //  inter_view_mv_vert_constraint_flag shall be equal to 1 
     1057    //  When ViewOrderIdx[ i ] derived according to any active VPS is equal to 1
     1058    //  for the layer with nuh_layer_id equal to i in subBitstream,
     1059    //  inter_view_mv_vert_constraint_flag shall be equal to 1
    10491060    //  in the sps_multilayer_extension( ) syntax structure in each active SPS for that layer.
    10501061    if( pcSlice->getSPS()->getPTL()->getGeneralPTL()->getProfileIdc()==Profile::MULTIVIEWMAIN
    10511062      &&
    1052       pcSlice->getVPS()->getViewOrderIdx(pcSlice->getVPS()->getLayerIdInNuh(getLayerId()))==1 
     1063      pcSlice->getVPS()->getViewOrderIdx(pcSlice->getVPS()->getLayerIdInNuh(getLayerId()))==1
    10531064      )
    10541065    {
     
    10611072    m_pcPic->setViewIndex( getViewIndex() );
    10621073    m_pcPic->setIsDepth  ( getIsDepth  () );
    1063     pcSlice->setIvPicLists( m_dpb );         
    1064 #endif
    1065 #endif
    1066    
     1074    pcSlice->setIvPicLists( m_dpb );
     1075#endif
     1076#endif
     1077
    10671078    // When decoding the slice header, the stored start and end addresses were actually RS addresses, not TS addresses.
    10681079    // Now, having set up the maps, convert them to the correct form.
     
    10971108        else
    10981109        {
    1099           assert( false ); 
     1110          assert( false );
    11001111        }
    11011112      }
     
    11041115#endif
    11051116#if NH_3D_ARP
    1106       pcSlice->setPocsInCurrRPSs(); 
     1117      pcSlice->setPocsInCurrRPSs();
    11071118      pcSlice->setARPStepNum(m_dpb);
    1108 #endif     
     1119#endif
    11091120#endif
    11101121
     
    11911202    if ( decProcAnnexI() )
    11921203    {
    1193       pcSlice->checkInCompPredRefLayers(); 
     1204      pcSlice->checkInCompPredRefLayers();
    11941205    }
    11951206#endif
     
    12301241  TComSPS* sps = new TComSPS();
    12311242#if NH_MV
    1232   sps->setLayerId( getLayerId() ); 
     1243  sps->setLayerId( getLayerId() );
    12331244#endif
    12341245#if O0043_BEST_EFFORT_DECODING
     
    12461257  TComPPS* pps = new TComPPS();
    12471258#if NH_MV
    1248   pps->setLayerId( getLayerId() ); 
     1259  pps->setLayerId( getLayerId() );
    12491260#endif
    12501261#if NH_3D_DLT
     
    13041315      {
    13051316#if NH_MV
    1306         m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_pcPic->getSEIs(), nalu.m_nalUnitType, m_parameterSetManager.getActiveSPS( getLayerId() ), m_pDecodedSEIOutputStream );
     1317#if NH_MV_LAYERS_NOT_PRESENT_SEI
     1318      m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_pcPic->getSEIs(), nalu.m_nalUnitType, m_parameterSetManager.getActiveVPS(), m_parameterSetManager.getActiveSPS(getLayerId()), m_pDecodedSEIOutputStream);
     1319#else
     1320      m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_pcPic->getSEIs(), nalu.m_nalUnitType, m_parameterSetManager.getActiveSPS( getLayerId() ), m_pDecodedSEIOutputStream );
     1321#endif
    13071322#else
    13081323        m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_pcPic->getSEIs(), nalu.m_nalUnitType, m_parameterSetManager.getActiveSPS(), m_pDecodedSEIOutputStream );
     
    13321347    case NAL_UNIT_CODED_SLICE_RASL_R:
    13331348#if NH_MV
    1334       assert( false ); 
    1335       return 1; 
     1349      assert( false );
     1350      return 1;
    13361351#else
    13371352      return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay);
     
    15061521{
    15071522  //Output of this process is PicOrderCntVal, the picture order count of the current picture.
    1508   //  Picture order counts are used to identify pictures, for deriving motion parameters in merge mode and 
     1523  //  Picture order counts are used to identify pictures, for deriving motion parameters in merge mode and
    15091524  //  motion vector prediction and for decoder conformance checking (see clause F.13.5).
    15101525
     
    15131528  TComSlice* slice = m_apcSlicePilot;
    15141529  const Int nuhLayerId   = slice->getLayerId();
    1515   const TComVPS*   vps   = slice->getVPS(); 
    1516   const TComSPS*   sps   = slice->getSPS(); 
    1517 
    1518   Int pocDecrementedInDpbFlag = m_pocDecrementedInDpbFlag[ nuhLayerId ]; 
     1530  const TComVPS*   vps   = slice->getVPS();
     1531  const TComSPS*   sps   = slice->getSPS();
     1532
     1533  Int pocDecrementedInDpbFlag = m_pocDecrementedInDpbFlag[ nuhLayerId ];
    15191534
    15201535  if ( isFstPicOfAllLayOfPocResetPer )
    15211536  {
    1522     //  When the current picture is the first picture among all layers of a POC resetting period, 
     1537    //  When the current picture is the first picture among all layers of a POC resetting period,
    15231538    //  the variable PocDecrementedInDPBFlag[ i ] is set equal to 0 for each value of i in the range of 0 to 62, inclusive.
    1524     pocDecrementedInDpbFlag = false; 
     1539    pocDecrementedInDpbFlag = false;
    15251540  }
    15261541
    15271542  //  The variable pocResettingFlag is derived as follows:
    1528   Bool pocResettingFlag; 
     1543  Bool pocResettingFlag;
    15291544  if ( isPocResettingPicture )
    15301545  {
    1531     //-  If the current picture is a POC resetting picture, the following applies:   
     1546    //-  If the current picture is a POC resetting picture, the following applies:
    15321547    if( vps->getVpsPocLsbAlignedFlag()  )
    15331548    {
    15341549      //  -  If vps_poc_lsb_aligned_flag is equal to 0, pocResettingFlag is set equal to 1.
    1535       pocResettingFlag = true; 
     1550      pocResettingFlag = true;
    15361551    }
    15371552    else if ( pocDecrementedInDpbFlag )
    15381553    {
    15391554      //  -  Otherwise, if PocDecrementedInDPBFlag[ nuh_layer_id ] is equal to 1, pocResettingFlag is set equal to 0.
    1540       pocResettingFlag = false; 
     1555      pocResettingFlag = false;
    15411556    }
    15421557    else
    15431558    {
    15441559      //  -  Otherwise, pocResettingFlag is set equal to 1.
    1545       pocResettingFlag = true; 
     1560      pocResettingFlag = true;
    15461561    }
    15471562  }
     
    15491564  {
    15501565    //  -  Otherwise, pocResettingFlag is set equal to 0.
    1551     pocResettingFlag = false; 
    1552   }
    1553 
    1554   Int picOrderCntMsb; 
    1555   Int picOrderCntVal; 
     1566    pocResettingFlag = false;
     1567  }
     1568
     1569  Int picOrderCntMsb;
     1570  Int picOrderCntVal;
    15561571
    15571572  //  Depending on pocResettingFlag, the following applies:
     
    15611576    if( slice->getPocResetIdc()  ==  1 )
    15621577    {
    1563       picOrderCntVal = slice->getSlicePicOrderCntLsb(); 
    1564     }
    1565     else if (slice->getPocResetIdc()  ==  2 ) 
    1566     {
    1567       picOrderCntVal = 0; 
     1578      picOrderCntVal = slice->getSlicePicOrderCntLsb();
     1579    }
     1580    else if (slice->getPocResetIdc()  ==  2 )
     1581    {
     1582      picOrderCntVal = 0;
    15681583    }
    15691584    else
    15701585    {
    1571       picOrderCntMsb = xGetCurrMsb( slice->getSlicePicOrderCntLsb(), slice->getFullPocResetFlag() ? 0 : slice->getPocLsbVal(), 0, sps->getMaxPicOrderCntLsb() ); 
    1572       picOrderCntVal = picOrderCntMsb + slice->getSlicePicOrderCntLsb(); 
     1586      picOrderCntMsb = xGetCurrMsb( slice->getSlicePicOrderCntLsb(), slice->getFullPocResetFlag() ? 0 : slice->getPocLsbVal(), 0, sps->getMaxPicOrderCntLsb() );
     1587      picOrderCntVal = picOrderCntMsb + slice->getSlicePicOrderCntLsb();
    15731588    }
    15741589  }
     
    15801595    if( slice->getPocMsbCycleValPresentFlag() )
    15811596    {
    1582       picOrderCntMsb = slice->getPocMsbCycleVal() * sps->getMaxPicOrderCntLsb(); 
     1597      picOrderCntMsb = slice->getPocMsbCycleVal() * sps->getMaxPicOrderCntLsb();
    15831598    }
    15841599    else if( !firstPicInLayerDecodedFlag  ||
     
    15861601    {
    15871602      picOrderCntMsb = 0; //     (F 62)
    1588     }   
     1603    }
    15891604    else
    15901605    {
    15911606      Int prevPicOrderCntLsb = m_prevPicOrderCnt & ( sps->getMaxPicOrderCntLsb() - 1 );
    1592       Int prevPicOrderCntMsb = m_prevPicOrderCnt - prevPicOrderCntLsb; 
    1593       picOrderCntMsb = xGetCurrMsb( slice->getSlicePicOrderCntLsb(), prevPicOrderCntLsb, prevPicOrderCntMsb, sps->getMaxPicOrderCntLsb() ); 
    1594     }
    1595     picOrderCntVal = picOrderCntMsb + slice->getSlicePicOrderCntLsb(); 
    1596   } 
     1607      Int prevPicOrderCntMsb = m_prevPicOrderCnt - prevPicOrderCntLsb;
     1608      picOrderCntMsb = xGetCurrMsb( slice->getSlicePicOrderCntLsb(), prevPicOrderCntLsb, prevPicOrderCntMsb, sps->getMaxPicOrderCntLsb() );
     1609    }
     1610    picOrderCntVal = picOrderCntMsb + slice->getSlicePicOrderCntLsb();
     1611  }
    15971612  return picOrderCntVal;
    15981613}
     
    16071622    if ( m_lastPresentPocResetIdc[ m_apcSlicePilot->getLayerId() ] != MIN_INT )
    16081623    {
    1609       // - If the previous picture picA that has poc_reset_period_id present in the slice segment header is present in the same layer 
    1610       //   of the bitstream as the current picture, the value of poc_reset_period_id is inferred to be equal to the value of the 
     1624      // - If the previous picture picA that has poc_reset_period_id present in the slice segment header is present in the same layer
     1625      //   of the bitstream as the current picture, the value of poc_reset_period_id is inferred to be equal to the value of the
    16111626      //   poc_reset_period_id of picA.
    16121627
    1613       m_apcSlicePilot->setPocResetPeriodId( m_lastPresentPocResetIdc[ m_apcSlicePilot->getLayerId() ] ); 
     1628      m_apcSlicePilot->setPocResetPeriodId( m_lastPresentPocResetIdc[ m_apcSlicePilot->getLayerId() ] );
    16141629    }
    16151630    else
    16161631    {
    16171632      //- Otherwise, the value of poc_reset_period_id is inferred to be equal to 0.
    1618       m_apcSlicePilot->setPocResetPeriodId( 0 ); 
     1633      m_apcSlicePilot->setPocResetPeriodId( 0 );
    16191634    }
    16201635  }
    16211636  else
    16221637  {
    1623     m_lastPresentPocResetIdc[ m_apcSlicePilot->getLayerId() ] = m_apcSlicePilot->getPocResetPeriodId(); 
     1638    m_lastPresentPocResetIdc[ m_apcSlicePilot->getLayerId() ] = m_apcSlicePilot->getPocResetPeriodId();
    16241639  }
    16251640}
     
    16271642
    16281643Void TDecTop::decodePocAndRps( )
    1629 { 
     1644{
    16301645  assert( m_uiSliceIdx == 0 );
    16311646  Int nuhLayerId = m_pcPic->getLayerId();
     
    16341649    // 8.1.3 Decoding process for a coded picture with nuh_layer_id equal to 0
    16351650
    1636     // Variables and functions relating to picture order count are derived as 
    1637     // specified in clause 8.3.1. This needs to be invoked only for the first slice 
     1651    // Variables and functions relating to picture order count are derived as
     1652    // specified in clause 8.3.1. This needs to be invoked only for the first slice
    16381653    // segment of a picture.
    16391654    x831DecProcForPicOrderCount( );
    16401655
    1641     // The decoding process for RPS in clause 8.3.2 is invoked, wherein reference 
    1642     // pictures may be marked as "unused for reference" or "used for long-term 
    1643     // reference". This needs to be invoked only for the first slice segment of a 
     1656    // The decoding process for RPS in clause 8.3.2 is invoked, wherein reference
     1657    // pictures may be marked as "unused for reference" or "used for long-term
     1658    // reference". This needs to be invoked only for the first slice segment of a
    16441659    // picture.
    16451660    x832DecProcForRefPicSet    (  false );
     
    16541669      // --> Clause 8.1.3 is invoked with replacments of 8.3.1, 8.3.2, and 8.3.3 by F.8.3.1, 8.3.2, and 8.3.3
    16551670
    1656       // Variables and functions relating to picture order count are derived as 
    1657       // specified in clause 8.3.1. This needs to be invoked only for the first slice 
     1671      // Variables and functions relating to picture order count are derived as
     1672      // specified in clause 8.3.1. This needs to be invoked only for the first slice
    16581673      // segment of a picture.
    16591674      xF831DecProcForPicOrderCount( );
    16601675
    1661       // The decoding process for RPS in clause 8.3.2 is invoked, wherein reference 
    1662       // pictures may be marked as "unused for reference" or "used for long-term 
    1663       // reference". This needs to be invoked only for the first slice segment of a 
     1676      // The decoding process for RPS in clause 8.3.2 is invoked, wherein reference
     1677      // pictures may be marked as "unused for reference" or "used for long-term
     1678      // reference". This needs to be invoked only for the first slice segment of a
    16641679      // picture.
    16651680      xF832DecProcForRefPicSet( );
     
    16701685      // nuh_layer_id greater than 0
    16711686
    1672       // Variables and functions relating to picture order count are derived in clause F.8.3.1. 
    1673       // This needs to be invoked only for the first slice segment of a picture. It is a requirement 
    1674       // of bitstream conformance that PicOrderCntVal of each picture in an access unit shall have the 
     1687      // Variables and functions relating to picture order count are derived in clause F.8.3.1.
     1688      // This needs to be invoked only for the first slice segment of a picture. It is a requirement
     1689      // of bitstream conformance that PicOrderCntVal of each picture in an access unit shall have the
    16751690      // same value during and at the end of decoding of the access unit
    16761691      xF831DecProcForPicOrderCount( );
    16771692
    1678       // The decoding process for RPS in clause F.8.3.2 is invoked, wherein only reference pictures with 
    1679       // nuh_layer_id equal to that of CurrPic may be marked as "unused for reference" or "used for 
    1680       // long-term reference" and any picture with a different value of nuh_layer_id is not marked. 
     1693      // The decoding process for RPS in clause F.8.3.2 is invoked, wherein only reference pictures with
     1694      // nuh_layer_id equal to that of CurrPic may be marked as "unused for reference" or "used for
     1695      // long-term reference" and any picture with a different value of nuh_layer_id is not marked.
    16811696      // This needs to be invoked only for the first slice segment of a picture.
    16821697      xF832DecProcForRefPicSet( );
     
    16851700  else
    16861701  {
    1687     assert( false ); 
     1702    assert( false );
    16881703  }
    16891704}
    16901705
    16911706Void TDecTop::genUnavailableRefPics( )
    1692 { 
     1707{
    16931708  assert( m_uiSliceIdx == 0 );
    16941709  Int nuhLayerId = m_pcPic->getLayerId();
     
    16991714    if ( m_pcPic->isBla() || ( m_pcPic->isCra() && m_pcPic->getNoRaslOutputFlag() ) )
    17001715    {
    1701       // When the current picture is a BLA picture or is a CRA picture 
    1702       // with NoRaslOutputFlag equal to 1, the decoding process for generating 
    1703       // unavailable reference pictures specified in clause 8.3.3 is invoked, 
     1716      // When the current picture is a BLA picture or is a CRA picture
     1717      // with NoRaslOutputFlag equal to 1, the decoding process for generating
     1718      // unavailable reference pictures specified in clause 8.3.3 is invoked,
    17041719      // which needs to be invoked only for the first slice segment of a picture.
    1705       x8331GenDecProcForGenUnavilRefPics();       
     1720      x8331GenDecProcForGenUnavilRefPics();
    17061721    }
    17071722  }
     
    17171732      if ( m_pcPic->isBla() || ( m_pcPic->isCra() && m_pcPic->getNoRaslOutputFlag() ) )
    17181733      {
    1719         // When the current picture is a BLA picture or is a CRA picture 
    1720         // with NoRaslOutputFlag equal to 1, the decoding process for generating 
    1721         // unavailable reference pictures specified in clause 8.3.3 is invoked, 
     1734        // When the current picture is a BLA picture or is a CRA picture
     1735        // with NoRaslOutputFlag equal to 1, the decoding process for generating
     1736        // unavailable reference pictures specified in clause 8.3.3 is invoked,
    17221737        // which needs to be invoked only for the first slice segment of a picture.
    1723         xF833DecProcForGenUnavRefPics(); 
     1738        xF833DecProcForGenUnavRefPics();
    17241739      }
    17251740#if NH_MV_FIX_INIT_NUM_ACTIVE_REF_LAYER_PICS
    1726       TComDecodedRps* decRps = m_pcPic->getDecodedRps(); 
     1741      TComDecodedRps* decRps = m_pcPic->getDecodedRps();
    17271742      decRps->m_numActiveRefLayerPics0 = 0;
    1728       decRps->m_numActiveRefLayerPics1 = 0;     
     1743      decRps->m_numActiveRefLayerPics1 = 0;
    17291744#endif
    17301745    }
     
    17361751      if ( !m_firstPicInLayerDecodedFlag[ nuhLayerId ] )
    17371752      {
    1738         // When FirstPicInLayerDecodedFlag[ nuh_layer_id ] is equal to 0, the decoding process for generating 
    1739         // unavailable reference pictures for pictures first in decoding order within a layer specified in 
     1753        // When FirstPicInLayerDecodedFlag[ nuh_layer_id ] is equal to 0, the decoding process for generating
     1754        // unavailable reference pictures for pictures first in decoding order within a layer specified in
    17401755        // clause F.8.1.7 is invoked, which needs to be invoked only for the first slice segment of a picture.
    17411756        xF817DecProcForGenUnavRefPicForPicsFrstInDecOrderInLay();
     
    17441759      if ( m_firstPicInLayerDecodedFlag[ nuhLayerId ] && ( m_pcPic->isIrap() && m_pcPic->getNoRaslOutputFlag() ) )
    17451760      {
    1746         // When FirstPicInLayerDecodedFlag[ nuh_layer_id ] is equal to 1 and the current picture is an IRAP 
    1747         // picture with NoRaslOutputFlag equal to 1, the decoding process for generating unavailable reference 
    1748         // pictures specified in clause F.8.3.3 is invoked, which needs to be invoked only for the first slice 
     1761        // When FirstPicInLayerDecodedFlag[ nuh_layer_id ] is equal to 1 and the current picture is an IRAP
     1762        // picture with NoRaslOutputFlag equal to 1, the decoding process for generating unavailable reference
     1763        // pictures specified in clause F.8.3.3 is invoked, which needs to be invoked only for the first slice
    17491764        // segment of a picture.
    1750         xF833DecProcForGenUnavRefPics(); 
     1765        xF833DecProcForGenUnavRefPics();
    17511766      }
    17521767
     
    17601775  else
    17611776  {
    1762     assert( false ); 
    1763   }
    1764 
    1765   xCheckUnavailableRefPics();     
     1777    assert( false );
     1778  }
     1779
     1780  xCheckUnavailableRefPics();
    17661781}
    17671782Void TDecTop::executeLoopFilters( )
    17681783{
    1769   assert( m_pcPic != NULL ); 
     1784  assert( m_pcPic != NULL );
    17701785  if ( !m_pcPic->getHasGeneratedRefPics() && !m_pcPic->getIsGenerated() )
    17711786  {
     
    17791794  if( m_pcPic->isIrap() )
    17801795  {
    1781     m_prevIrapPoc           = m_pcPic->getPOC(); 
    1782     m_prevIrapDecodingOrder = m_pcPic->getDecodingOrder(); 
     1796    m_prevIrapPoc           = m_pcPic->getPOC();
     1797    m_prevIrapDecodingOrder = m_pcPic->getDecodingOrder();
    17831798  }
    17841799  if( m_pcPic->isStsa() )
     
    17911806
    17921807Void TDecTop::initFromActiveVps( const TComVPS* vps )
    1793 {   
    1794   setViewId   ( vps->getViewId   ( getLayerId() )      ); 
     1808{
     1809  setViewId   ( vps->getViewId   ( getLayerId() )      );
    17951810#if NH_3D
    1796   setViewIndex( vps->getViewIndex( getLayerId() )      ); 
    1797   setIsDepth  ( vps->getDepthId  ( getLayerId() ) == 1 ); 
     1811  setViewIndex( vps->getViewIndex( getLayerId() )      );
     1812  setIsDepth  ( vps->getDepthId  ( getLayerId() ) == 1 );
    17981813#endif
    17991814
    18001815  if ( !vps->getVpsExtensionFlag() )
    18011816  {
    1802     m_decodingProcess = CLAUSE_8; 
     1817    m_decodingProcess = CLAUSE_8;
    18031818    m_isInOwnTargetDecLayerIdList = ( getLayerId() ==  0 );
    18041819  }
    18051820  else
    1806   { 
     1821  {
    18071822    if ( m_targetOlsIdx == -1 )
    18081823    {
    1809       // Corresponds to specification by "External Means". (Should be set equal to 0, when no external means available. ) 
    1810       m_targetOlsIdx = vps->getVpsNumLayerSetsMinus1(); 
    1811     }
    1812 
    1813     Int targetDecLayerSetIdx = vps->olsIdxToLsIdx( m_targetOlsIdx ); 
     1824      // Corresponds to specification by "External Means". (Should be set equal to 0, when no external means available. )
     1825      m_targetOlsIdx = vps->getVpsNumLayerSetsMinus1();
     1826    }
     1827
     1828    Int targetDecLayerSetIdx = vps->olsIdxToLsIdx( m_targetOlsIdx );
    18141829
    18151830    if ( targetDecLayerSetIdx <= vps->getVpsNumLayerSetsMinus1() && vps->getVpsBaseLayerInternalFlag() )
    18161831    {
    1817       m_smallestLayerId = 0; 
     1832      m_smallestLayerId = 0;
    18181833    }
    18191834    else if ( targetDecLayerSetIdx <= vps->getVpsNumLayerSetsMinus1() && !vps->getVpsBaseLayerInternalFlag() )
    18201835    {
    1821       m_smallestLayerId = 0; 
     1836      m_smallestLayerId = 0;
    18221837    }
    18231838    else if ( targetDecLayerSetIdx > vps->getVpsNumLayerSetsMinus1() && vps->getNumLayersInIdList( targetDecLayerSetIdx) == 1 )
    18241839    {
    1825      
    1826       // m_smallestLayerId = 0;       
    1827       // For now don't do change of layer id here. 
    1828       m_smallestLayerId = vps->getTargetDecLayerIdList( targetDecLayerSetIdx )[ 0 ];   
     1840
     1841      // m_smallestLayerId = 0;
     1842      // For now don't do change of layer id here.
     1843      m_smallestLayerId = vps->getTargetDecLayerIdList( targetDecLayerSetIdx )[ 0 ];
    18291844    }
    18301845    else
    18311846    {
    1832       m_smallestLayerId = vps->getTargetDecLayerIdList( targetDecLayerSetIdx )[ 0 ];   
     1847      m_smallestLayerId = vps->getTargetDecLayerIdList( targetDecLayerSetIdx )[ 0 ];
    18331848    }
    18341849
     
    18361851    // Set profile
    18371852    Int lsIdx = vps->olsIdxToLsIdx( m_targetOlsIdx );
    1838     Int lIdx = -1; 
     1853    Int lIdx = -1;
    18391854    for (Int j = 0; j < vps->getNumLayersInIdList( lsIdx ) ; j++ )
    18401855    {
    18411856      if ( vps->getLayerSetLayerIdList( lsIdx, j ) == getLayerId() )
    1842       {       
    1843         lIdx = j;         
    1844         break; 
    1845       }       
    1846     }
    1847     m_isInOwnTargetDecLayerIdList = (lIdx != -1); 
     1857      {
     1858        lIdx = j;
     1859        break;
     1860      }
     1861    }
     1862    m_isInOwnTargetDecLayerIdList = (lIdx != -1);
    18481863
    18491864    if ( m_isInOwnTargetDecLayerIdList )
    18501865    {
    18511866      Int profileIdc = vps->getPTL( vps->getProfileTierLevelIdx( m_targetOlsIdx, lIdx ) )->getGeneralPTL()->getProfileIdc();
    1852       assert( profileIdc == 1 || profileIdc == 6 || profileIdc == 8 ); 
     1867      assert( profileIdc == 1 || profileIdc == 6 || profileIdc == 8 );
    18531868
    18541869      if (  profileIdc == 6 )
     
    18811896
    18821897  //  Output of this process is PicOrderCntVal, the picture order count of the current picture.
    1883   //  Picture order counts are used to identify pictures, for deriving motion parameters in merge mode and 
     1898  //  Picture order counts are used to identify pictures, for deriving motion parameters in merge mode and
    18841899  //  motion vector prediction, and for decoder conformance checking (see clause C.5).
    18851900  //  Each coded picture is associated with a picture order count variable, denoted as PicOrderCntVal.
    18861901
    1887   const TComSlice* curSlice = m_pcPic->getSlice(0); 
    1888 
    1889   Int prevPicOrderCntLsb = MIN_INT; 
    1890   Int prevPicOrderCntMsb = MIN_INT; 
    1891   if (!(m_pcPic->isIrap() && m_pcPic->getNoRaslOutputFlag() )  ) 
    1892   {
    1893     //  When the current picture is not an IRAP picture with NoRaslOutputFlag equal to 1, 
     1902  const TComSlice* curSlice = m_pcPic->getSlice(0);
     1903
     1904  Int prevPicOrderCntLsb = MIN_INT;
     1905  Int prevPicOrderCntMsb = MIN_INT;
     1906  if (!(m_pcPic->isIrap() && m_pcPic->getNoRaslOutputFlag() )  )
     1907  {
     1908    //  When the current picture is not an IRAP picture with NoRaslOutputFlag equal to 1,
    18941909    //  the variables prevPicOrderCntLsb and prevPicOrderCntMsb are derived as follows:
    18951910
    1896     //  -  Let prevTid0Pic be the previous picture in decoding order that has TemporalId equal to 0 and that is not a RASL picture, 
     1911    //  -  Let prevTid0Pic be the previous picture in decoding order that has TemporalId equal to 0 and that is not a RASL picture,
    18971912    //     a RADL picture or an SLNR picture.
    18981913
    18991914    //  -  The variable prevPicOrderCntLsb is set equal to slice_pic_order_cnt_lsb of prevTid0Pic.
    1900     prevPicOrderCntLsb = m_prevTid0PicSlicePicOrderCntLsb; 
     1915    prevPicOrderCntLsb = m_prevTid0PicSlicePicOrderCntLsb;
    19011916
    19021917    //  -  The variable prevPicOrderCntMsb is set equal to PicOrderCntMsb of prevTid0Pic.
    1903     prevPicOrderCntMsb = m_prevTid0PicPicOrderCntMsb; 
    1904   }
    1905 
    1906   //  The variable PicOrderCntMsb of the current picture is derived as follows: 
    1907  
     1918    prevPicOrderCntMsb = m_prevTid0PicPicOrderCntMsb;
     1919  }
     1920
     1921  //  The variable PicOrderCntMsb of the current picture is derived as follows:
     1922
    19081923  Int slicePicOrderCntLsb = curSlice->getSlicePicOrderCntLsb();
    19091924
    1910   Int picOrderCntMsb; 
     1925  Int picOrderCntMsb;
    19111926
    19121927  if (m_pcPic->isIrap() && m_pcPic->getNoRaslOutputFlag()  )
    19131928  {
    19141929    //-  If the current picture is an IRAP picture with NoRaslOutputFlag equal to 1, PicOrderCntMsb is set equal to 0.
    1915     picOrderCntMsb = 0; 
     1930    picOrderCntMsb = 0;
    19161931  }
    19171932  else
    19181933  {
    1919     Int maxPicOrderCntLsb   = curSlice->getSPS()->getMaxPicOrderCntLsb(); 
     1934    Int maxPicOrderCntLsb   = curSlice->getSPS()->getMaxPicOrderCntLsb();
    19201935
    19211936  //  -  Otherwise, PicOrderCntMsb is derived as follows:
     
    19331948    else
    19341949    {
    1935       picOrderCntMsb = prevPicOrderCntMsb; 
    1936     }
    1937   }
    1938  
     1950      picOrderCntMsb = prevPicOrderCntMsb;
     1951    }
     1952  }
     1953
    19391954  //PicOrderCntVal is derived as follows:
    19401955  Int picOrderCntVal = picOrderCntMsb + slicePicOrderCntLsb; //   (8 2)
    19411956
    1942   //  NOTE 1 - All IDR pictures will have PicOrderCntVal equal to 0 since slice_pic_order_cnt_lsb is inferred to be 0 for IDR 
     1957  //  NOTE 1 - All IDR pictures will have PicOrderCntVal equal to 0 since slice_pic_order_cnt_lsb is inferred to be 0 for IDR
    19431958  //  pictures and prevPicOrderCntLsb and prevPicOrderCntMsb are both set equal to 0.
    19441959
    1945   m_pcPic->getSlice(0)->setPOC( picOrderCntVal ); 
     1960  m_pcPic->getSlice(0)->setPOC( picOrderCntVal );
    19461961
    19471962  // Update prevTid0Pic
     
    19491964  if( curSlice->getTemporalId() == 0  && !m_pcPic->isRasl() && !m_pcPic->isRadl() && !m_pcPic->isSlnr() )
    19501965  {
    1951     m_prevTid0PicSlicePicOrderCntLsb = slicePicOrderCntLsb;     
    1952     m_prevTid0PicPicOrderCntMsb      = picOrderCntMsb; 
     1966    m_prevTid0PicSlicePicOrderCntLsb = slicePicOrderCntLsb;
     1967    m_prevTid0PicPicOrderCntMsb      = picOrderCntMsb;
    19531968  }
    19541969}
     
    19571972{
    19581973  //Output of this process is PicOrderCntVal, the picture order count of the current picture.
    1959   //  Picture order counts are used to identify pictures, for deriving motion parameters in merge mode and 
     1974  //  Picture order counts are used to identify pictures, for deriving motion parameters in merge mode and
    19601975  //  motion vector prediction and for decoder conformance checking (see clause F.13.5).
    19611976
    19621977  //  Each coded picture is associated with a picture order count variable, denoted as PicOrderCntVal.
    19631978
    1964   const TComSlice* slice = m_pcPic->getSlice(0); 
    1965   const Int nuhLayerId   = m_pcPic->getLayerId(); 
    1966   const TComVPS*   vps   = slice->getVPS(); 
    1967   const TComSPS*   sps   = slice->getSPS(); 
     1979  const TComSlice* slice = m_pcPic->getSlice(0);
     1980  const Int nuhLayerId   = m_pcPic->getLayerId();
     1981  const TComVPS*   vps   = slice->getVPS();
     1982  const TComSPS*   sps   = slice->getSPS();
    19681983  if ( m_pcPic->getIsFstPicOfAllLayOfPocResetPer() )
    19691984  {
    1970     //  When the current picture is the first picture among all layers of a POC resetting period, 
     1985    //  When the current picture is the first picture among all layers of a POC resetting period,
    19711986    //  the variable PocDecrementedInDPBFlag[ i ] is set equal to 0 for each value of i in the range of 0 to 62, inclusive.
    19721987    for (Int i = 0; i <= 62; i++)
    19731988    {
    1974       m_pocDecrementedInDpbFlag[ i ] = 0; 
     1989      m_pocDecrementedInDpbFlag[ i ] = 0;
    19751990    }
    19761991  }
    19771992
    19781993  //  The variable pocResettingFlag is derived as follows:
    1979   Bool pocResettingFlag; 
     1994  Bool pocResettingFlag;
    19801995  if (m_pcPic->getIsPocResettingPic() )
    19811996  {
    1982     //-  If the current picture is a POC resetting picture, the following applies:   
     1997    //-  If the current picture is a POC resetting picture, the following applies:
    19831998    if( vps->getVpsPocLsbAlignedFlag()  )
    19841999    {
    19852000      //  -  If vps_poc_lsb_aligned_flag is equal to 0, pocResettingFlag is set equal to 1.
    1986       pocResettingFlag = true; 
     2001      pocResettingFlag = true;
    19872002    }
    19882003    else if ( m_pocDecrementedInDpbFlag[ nuhLayerId ] )
    19892004    {
    19902005      //  -  Otherwise, if PocDecrementedInDPBFlag[ nuh_layer_id ] is equal to 1, pocResettingFlag is set equal to 0.
    1991       pocResettingFlag = false; 
     2006      pocResettingFlag = false;
    19922007    }
    19932008    else
    19942009    {
    19952010      //  -  Otherwise, pocResettingFlag is set equal to 1.
    1996       pocResettingFlag = true; 
     2011      pocResettingFlag = true;
    19972012    }
    19982013  }
     
    20002015  {
    20012016    //  -  Otherwise, pocResettingFlag is set equal to 0.
    2002     pocResettingFlag = false; 
     2017    pocResettingFlag = false;
    20032018  }
    20042019
    20052020  //  The list affectedLayerList is derived as follows:
    2006   std::vector<Int> affectedLayerList; 
     2021  std::vector<Int> affectedLayerList;
    20072022  if (! vps->getVpsPocLsbAlignedFlag() )
    20082023  {
    20092024    //-  If vps_poc_lsb_aligned_flag is equal to 0, affectedLayerList consists of the nuh_layer_id of the current picture.
    2010     affectedLayerList.push_back( nuhLayerId ); 
     2025    affectedLayerList.push_back( nuhLayerId );
    20112026  }
    20122027  else
    20132028  {
    2014     //  -  Otherwise, affectedLayerList consists of the nuh_layer_id of the current picture and the nuh_layer_id values 
    2015     //     equal to IdPredictedLayer[ currNuhLayerId ][ j ] for all values of j in the range of 0 to NumPredictedLayers[ currNuhLayerId ] - 1, 
     2029    //  -  Otherwise, affectedLayerList consists of the nuh_layer_id of the current picture and the nuh_layer_id values
     2030    //     equal to IdPredictedLayer[ currNuhLayerId ][ j ] for all values of j in the range of 0 to NumPredictedLayers[ currNuhLayerId ] - 1,
    20162031    //     inclusive, where currNuhLayerId is the nuh_layer_id value of the current picture.
    2017     affectedLayerList.push_back( nuhLayerId ); 
    2018     Int currNuhLayerId = nuhLayerId; 
     2032    affectedLayerList.push_back( nuhLayerId );
     2033    Int currNuhLayerId = nuhLayerId;
    20192034    for (Int j = 0; j <= vps->getNumPredictedLayers( currNuhLayerId )-1; j++ )
    20202035    {
     
    20222037    }
    20232038  }
    2024  
    2025   Int picOrderCntMsb; 
    2026   Int picOrderCntVal; 
     2039
     2040  Int picOrderCntMsb;
     2041  Int picOrderCntVal;
    20272042
    20282043  //  Depending on pocResettingFlag, the following applies:
     
    20332048    {
    20342049      //-  The variables pocMsbDelta, pocLsbDelta and DeltaPocVal are derived as follows:
    2035       Int pocMsbDelta; 
    2036       Int pocLsbDelta; 
    2037       Int deltaPocVal;       
    2038 
    2039       {
    2040         Int pocLsbVal; 
    2041         Int prevPicOrderCntLsb; 
    2042         Int prevPicOrderCntMsb; 
     2050      Int pocMsbDelta;
     2051      Int pocLsbDelta;
     2052      Int deltaPocVal;
     2053
     2054      {
     2055        Int pocLsbVal;
     2056        Int prevPicOrderCntLsb;
     2057        Int prevPicOrderCntMsb;
    20432058
    20442059        if( slice->getPocResetIdc() ==  3 )
    20452060        {
    2046           pocLsbVal = slice->getPocLsbVal(); 
    2047         }     
     2061          pocLsbVal = slice->getPocLsbVal();
     2062        }
    20482063        else
    20492064        {
    2050           pocLsbVal = slice->getSlicePicOrderCntLsb(); 
     2065          pocLsbVal = slice->getSlicePicOrderCntLsb();
    20512066        }
    20522067
     
    20542069        {
    20552070          pocMsbDelta = slice->getPocMsbCycleVal() * sps->getMaxPicOrderCntLsb();   // (F 60)
    2056         }     
    2057         else
    2058         {
    2059           prevPicOrderCntLsb = m_prevPicOrderCnt & ( sps->getMaxPicOrderCntLsb() - 1 );
    2060           prevPicOrderCntMsb = m_prevPicOrderCnt - prevPicOrderCntLsb;
    2061 
    2062           pocMsbDelta = xGetCurrMsb( pocLsbVal, prevPicOrderCntLsb, prevPicOrderCntMsb, sps->getMaxPicOrderCntLsb() );
    2063         }
    2064 
    2065         if( slice->getPocResetIdc() == 2 ||  ( slice->getPocResetIdc() == 3  &&  slice->getFullPocResetFlag() ) )
    2066         {
    2067           pocLsbDelta = pocLsbVal;
    20682071        }
    20692072        else
    20702073        {
    2071           pocLsbDelta = 0;
     2074          prevPicOrderCntLsb = m_prevPicOrderCnt & ( sps->getMaxPicOrderCntLsb() - 1 );
     2075          prevPicOrderCntMsb = m_prevPicOrderCnt - prevPicOrderCntLsb;
     2076
     2077          pocMsbDelta = xGetCurrMsb( pocLsbVal, prevPicOrderCntLsb, prevPicOrderCntMsb, sps->getMaxPicOrderCntLsb() );
    20722078        }
    2073         deltaPocVal = pocMsbDelta + pocLsbDelta;
    2074       }
    2075 
    2076       //-  The PicOrderCntVal of each picture that has nuh_layer_id value nuhLayerId for which PocDecrementedInDPBFlag[ nuhLayerId ] is equal to 0
     2079
     2080        if( slice->getPocResetIdc() == 2 ||  ( slice->getPocResetIdc() == 3  &&  slice->getFullPocResetFlag() ) )
     2081        {
     2082          pocLsbDelta = pocLsbVal;
     2083        }
     2084        else
     2085        {
     2086          pocLsbDelta = 0;
     2087        }
     2088        deltaPocVal = pocMsbDelta + pocLsbDelta;
     2089      }
     2090
     2091      //-  The PicOrderCntVal of each picture that has nuh_layer_id value nuhLayerId for which PocDecrementedInDPBFlag[ nuhLayerId ] is equal to 0
    20772092      //   and that is equal to any value in affectedLayerList is decremented by DeltaPocVal.
    20782093      for (Int i = 0; i < (Int) affectedLayerList.size(); i++ )
     
    20802095        if ( !m_pocDecrementedInDpbFlag[ affectedLayerList[i] ] )
    20812096        {
    2082           m_dpb->decrementPocsInSubDpb( affectedLayerList[i], deltaPocVal ); 
     2097          m_dpb->decrementPocsInSubDpb( affectedLayerList[i], deltaPocVal );
    20832098        }
    20842099      }
     
    20872102      for (Int i = 0; i < (Int) affectedLayerList.size(); i++ )
    20882103      {
    2089         m_pocDecrementedInDpbFlag[ affectedLayerList[i] ] = true; 
    2090       }
    2091     } 
     2104        m_pocDecrementedInDpbFlag[ affectedLayerList[i] ] = true;
     2105      }
     2106    }
    20922107
    20932108    //-  The PicOrderCntVal of the current picture is derived as follows:
    20942109    if( slice->getPocResetIdc()  ==  1 )
    20952110    {
    2096       picOrderCntVal = slice->getSlicePicOrderCntLsb(); 
    2097     }
    2098     else if (slice->getPocResetIdc()  ==  2 ) 
    2099     {
    2100       picOrderCntVal = 0; 
     2111      picOrderCntVal = slice->getSlicePicOrderCntLsb();
     2112    }
     2113    else if (slice->getPocResetIdc()  ==  2 )
     2114    {
     2115      picOrderCntVal = 0;
    21012116    }
    21022117    else
    21032118    {
    2104        picOrderCntMsb = xGetCurrMsb( slice->getSlicePicOrderCntLsb(), slice->getFullPocResetFlag() ? 0 : slice->getPocLsbVal(), 0, sps->getMaxPicOrderCntLsb() ); 
    2105        picOrderCntVal = picOrderCntMsb + slice->getSlicePicOrderCntLsb(); 
     2119       picOrderCntMsb = xGetCurrMsb( slice->getSlicePicOrderCntLsb(), slice->getFullPocResetFlag() ? 0 : slice->getPocLsbVal(), 0, sps->getMaxPicOrderCntLsb() );
     2120       picOrderCntVal = picOrderCntMsb + slice->getSlicePicOrderCntLsb();
    21062121    }
    21072122  }
     
    21102125    //-  Otherwise (pocResettingFlag is equal to 0), the following applies:
    21112126    //-  The PicOrderCntVal of the current picture is derived as follows:
    2112    
     2127
    21132128    if( slice->getPocMsbCycleValPresentFlag() )
    21142129    {
    2115       picOrderCntMsb = slice->getPocMsbCycleVal() * sps->getMaxPicOrderCntLsb(); 
     2130      picOrderCntMsb = slice->getPocMsbCycleVal() * sps->getMaxPicOrderCntLsb();
    21162131    }
    21172132    else if( !m_firstPicInLayerDecodedFlag[ nuhLayerId ]  ||
     
    21192134    {
    21202135      picOrderCntMsb = 0; //     (F 62)
    2121     }   
     2136    }
    21222137    else
    21232138    {
    21242139        Int prevPicOrderCntLsb = m_prevPicOrderCnt & ( sps->getMaxPicOrderCntLsb() - 1 );
    2125         Int prevPicOrderCntMsb = m_prevPicOrderCnt - prevPicOrderCntLsb; 
    2126         picOrderCntMsb = xGetCurrMsb( slice->getSlicePicOrderCntLsb(), prevPicOrderCntLsb, prevPicOrderCntMsb, sps->getMaxPicOrderCntLsb() ); 
    2127     }
    2128     picOrderCntVal = picOrderCntMsb + slice->getSlicePicOrderCntLsb(); 
    2129   }
    2130  
    2131   m_pcPic->getSlice(0)->setPOC( picOrderCntVal ); 
    2132  
     2140        Int prevPicOrderCntMsb = m_prevPicOrderCnt - prevPicOrderCntLsb;
     2141        picOrderCntMsb = xGetCurrMsb( slice->getSlicePicOrderCntLsb(), prevPicOrderCntLsb, prevPicOrderCntMsb, sps->getMaxPicOrderCntLsb() );
     2142    }
     2143    picOrderCntVal = picOrderCntMsb + slice->getSlicePicOrderCntLsb();
     2144  }
     2145
     2146  m_pcPic->getSlice(0)->setPOC( picOrderCntVal );
     2147
    21332148  for (Int lId = 0; lId < (Int) affectedLayerList.size(); lId++ )
    2134   { 
     2149  {
    21352150    //  The value of PrevPicOrderCnt[ lId ] for each of the lId values included in affectedLayerList is derived as follows:
    21362151
    21372152    if (!m_pcPic->isRasl() && !m_pcPic->isRadl() && !m_pcPic->isSlnr() && slice->getTemporalId() == 0 && !slice->getDiscardableFlag() )
    21382153    {
    2139       //-  If the current picture is not a RASL picture, a RADL picture or a sub-layer non-reference picture, and the current picture 
     2154      //-  If the current picture is not a RASL picture, a RADL picture or a sub-layer non-reference picture, and the current picture
    21402155      //   has TemporalId equal to 0 and discardable_flag equal to 0, PrevPicOrderCnt[ lId ] is set equal to PicOrderCntVal.
    2141       m_prevPicOrderCnt = picOrderCntVal; 
     2156      m_prevPicOrderCnt = picOrderCntVal;
    21422157    }
    21432158    else if ( slice->getPocResetIdc() == 3 &&  (
    2144       ( !m_firstPicInLayerDecodedFlag[ nuhLayerId ]) || 
    2145       ( m_firstPicInLayerDecodedFlag[ nuhLayerId ] && m_pcPic->getIsPocResettingPic() ) 
     2159      ( !m_firstPicInLayerDecodedFlag[ nuhLayerId ]) ||
     2160      ( m_firstPicInLayerDecodedFlag[ nuhLayerId ] && m_pcPic->getIsPocResettingPic() )
    21462161      ) )
    21472162    {
     
    21492164      //     -  FirstPicInLayerDecodedFlag[ nuh_layer_id ] is equal to 0.
    21502165      //     -  FirstPicInLayerDecodedFlag[ nuh_layer_id ] is equal to 1 and the current picture is a POC resetting picture.
    2151       m_prevPicOrderCnt = ( slice->getFullPocResetFlag() ? 0 : slice->getPocLsbVal() ); 
     2166      m_prevPicOrderCnt = ( slice->getFullPocResetFlag() ? 0 : slice->getPocLsbVal() );
    21522167    }
    21532168  }
     
    21562171Int TDecTop::xGetCurrMsb( Int cl, Int pl, Int pm, Int ml )
    21572172{
    2158   Int currMsb; 
     2173  Int currMsb;
    21592174  if ((pl - cl) >= (ml/ 2))
    21602175  {
     
    21632178  else if ( (cl - pl) > (ml / 2))
    21642179  {
    2165     currMsb = pm - ml; 
     2180    currMsb = pm - ml;
    21662181  }
    21672182  else
    21682183  {
    2169     currMsb = pm; 
    2170   }
    2171 
    2172   return currMsb; 
    2173 }   
     2184    currMsb = pm;
     2185  }
     2186
     2187  return currMsb;
     2188}
    21742189
    21752190
     
    21812196  ///////////////////////////////////////////////////////////////////////////////////////
    21822197
    2183   TComSlice* slice = m_pcPic->getSlice( 0 ); 
    2184   const TComSPS* sps = slice->getSPS(); 
    2185   //  This process is invoked once per picture, after decoding of a slice header but prior to the decoding of any coding unit and prior 
    2186   //  to the decoding process for reference picture list construction for the slice as specified in clause 8.3.3. 
    2187   //  This process may result in one or more reference pictures in the DPB being marked as "unused for reference" or 
     2198  TComSlice* slice = m_pcPic->getSlice( 0 );
     2199  const TComSPS* sps = slice->getSPS();
     2200  //  This process is invoked once per picture, after decoding of a slice header but prior to the decoding of any coding unit and prior
     2201  //  to the decoding process for reference picture list construction for the slice as specified in clause 8.3.3.
     2202  //  This process may result in one or more reference pictures in the DPB being marked as "unused for reference" or
    21882203  //  "used for long-term reference".
    21892204
    21902205  // The variable currPicLayerId is set equal to nuh_layer_id of the current picture.
    2191   Int currPicLayerId = m_pcPic->getLayerId(); 
    2192   Int picOrderCntVal = m_pcPic->getPOC(); 
     2206  Int currPicLayerId = m_pcPic->getLayerId();
     2207  Int picOrderCntVal = m_pcPic->getPOC();
    21932208
    21942209  if (m_pcPic->isIrap() && m_pcPic->getNoRaslOutputFlag()  )
    2195   {     
    2196     // When the current picture is an IRAP picture with NoRaslOutputFlag equal to 1, 
    2197     // all reference pictures with nuh_layer_id equal to currPicLayerId currently in the 
     2210  {
     2211    // When the current picture is an IRAP picture with NoRaslOutputFlag equal to 1,
     2212    // all reference pictures with nuh_layer_id equal to currPicLayerId currently in the
    21982213    // DPB (if any) are marked as "unused for reference".
    2199     m_dpb->markSubDpbAsUnusedForReference( currPicLayerId ); 
    2200   }
    2201   // Short-term reference pictures are identified by their PicOrderCntVal values. Long-term reference pictures are identified either by 
     2214    m_dpb->markSubDpbAsUnusedForReference( currPicLayerId );
     2215  }
     2216  // Short-term reference pictures are identified by their PicOrderCntVal values. Long-term reference pictures are identified either by
    22022217  // their PicOrderCntVal values or their slice_pic_order_cnt_lsb values.
    22032218
    2204   // Five lists of picture order count values are constructed to derive the RPS. These five lists are PocStCurrBefore, 
    2205   // PocStCurrAfter, PocStFoll, PocLtCurr and PocLtFoll, with NumPocStCurrBefore, NumPocStCurrAfter, NumPocStFoll, 
     2219  // Five lists of picture order count values are constructed to derive the RPS. These five lists are PocStCurrBefore,
     2220  // PocStCurrAfter, PocStFoll, PocLtCurr and PocLtFoll, with NumPocStCurrBefore, NumPocStCurrAfter, NumPocStFoll,
    22062221  // NumPocLtCurr and NumPocLtFoll number of elements, respectively. The five lists and the five variables are derived as follows:
    2207  
    2208   TComDecodedRps* decRps = m_pcPic->getDecodedRps(); 
     2222
     2223  TComDecodedRps* decRps = m_pcPic->getDecodedRps();
    22092224
    22102225  std::vector<Int>& pocStCurrBefore = decRps->m_pocStCurrBefore;
     
    22142229  std::vector<Int>& pocLtFoll       = decRps->m_pocLtFoll;
    22152230
    2216   Int& numPocStCurrBefore = decRps->m_numPocStCurrBefore; 
     2231  Int& numPocStCurrBefore = decRps->m_numPocStCurrBefore;
    22172232  Int& numPocStCurrAfter  = decRps->m_numPocStCurrAfter;
    22182233  Int& numPocStFoll       = decRps->m_numPocStFoll;
    22192234  Int& numPocLtCurr       = decRps->m_numPocLtCurr;
    2220   Int& numPocLtFoll       = decRps->m_numPocLtFoll;   
    2221 
    2222   std::vector<Int> currDeltaPocMsbPresentFlag, follDeltaPocMsbPresentFlag; 
     2235  Int& numPocLtFoll       = decRps->m_numPocLtFoll;
     2236
     2237  std::vector<Int> currDeltaPocMsbPresentFlag, follDeltaPocMsbPresentFlag;
    22232238
    22242239  if (m_pcPic->isIdr() )
    22252240  {
    2226     // - If the current picture is an IDR picture, PocStCurrBefore, PocStCurrAfter, PocStFoll, 
    2227     //   PocLtCurr and PocLtFoll are all set to be empty, and NumPocStCurrBefore, 
     2241    // - If the current picture is an IDR picture, PocStCurrBefore, PocStCurrAfter, PocStFoll,
     2242    //   PocLtCurr and PocLtFoll are all set to be empty, and NumPocStCurrBefore,
    22282243    //   NumPocStCurrAfter, NumPocStFoll, NumPocLtCurr and NumPocLtFoll are all set equal to 0.
    22292244
     
    22332248    pocLtCurr      .clear();
    22342249    pocLtFoll      .clear();
    2235     numPocStCurrBefore = 0; 
    2236     numPocStCurrAfter  = 0; 
    2237     numPocStFoll       = 0; 
    2238     numPocLtCurr       = 0; 
    2239     numPocLtFoll       = 0; 
     2250    numPocStCurrBefore = 0;
     2251    numPocStCurrAfter  = 0;
     2252    numPocStFoll       = 0;
     2253    numPocLtCurr       = 0;
     2254    numPocLtFoll       = 0;
    22402255  }
    22412256  else
     
    22442259    // -  Otherwise, the following applies:
    22452260
    2246     Int j = 0; 
    2247     Int k = 0; 
     2261    Int j = 0;
     2262    Int k = 0;
    22482263    for( Int i = 0; i < stRps->getNumNegativePicsVar() ; i++ )
    22492264    {
     
    22572272      }
    22582273    }
    2259     numPocStCurrBefore = j;   
    2260 
    2261     j = 0; 
     2274    numPocStCurrBefore = j;
     2275
     2276    j = 0;
    22622277    for (Int i = 0; i < stRps->getNumPositivePicsVar(); i++ )
    22632278    {
    22642279      if (stRps->getUsedByCurrPicS1Var( i ) )
    22652280      {
    2266         pocStCurrAfter.push_back( picOrderCntVal + stRps->getDeltaPocS1Var( i ) ); j++; 
     2281        pocStCurrAfter.push_back( picOrderCntVal + stRps->getDeltaPocS1Var( i ) ); j++;
    22672282      }
    22682283      else
     
    22752290
    22762291
    2277     j = 0; 
    2278     k = 0; 
     2292    j = 0;
     2293    k = 0;
    22792294    for( Int i = 0; i < slice->getNumLongTermSps( ) + slice->getNumLongTermPics(); i++ )
    22802295    {
    2281       Int pocLt = slice->getPocLsbLtVar( i ); 
     2296      Int pocLt = slice->getPocLsbLtVar( i );
    22822297      if( slice->getDeltaPocMsbPresentFlag( i ) )
    22832298      {
     
    22862301      }
    22872302
    2288       if( slice->getUsedByCurrPicLtVar(i)) 
     2303      if( slice->getUsedByCurrPicLtVar(i))
    22892304      {
    22902305        pocLtCurr.push_back( pocLt );
    2291         currDeltaPocMsbPresentFlag.push_back( slice->getDeltaPocMsbPresentFlag( i ) ); j++; 
    2292       } 
     2306        currDeltaPocMsbPresentFlag.push_back( slice->getDeltaPocMsbPresentFlag( i ) ); j++;
     2307      }
    22932308      else
    22942309      {
    22952310        pocLtFoll.push_back( pocLt );
    2296         follDeltaPocMsbPresentFlag.push_back( slice->getDeltaPocMsbPresentFlag( i ) ); k++; 
     2311        follDeltaPocMsbPresentFlag.push_back( slice->getDeltaPocMsbPresentFlag( i ) ); k++;
    22972312      }
    22982313    }
     
    23032318  assert(numPocStCurrAfter  == pocStCurrAfter   .size() );
    23042319  assert(numPocStCurrBefore == pocStCurrBefore  .size() );
    2305   assert(numPocStFoll       == pocStFoll        .size() ); 
    2306   assert(numPocLtCurr       == pocLtCurr        .size() ); 
     2320  assert(numPocStFoll       == pocStFoll        .size() );
     2321  assert(numPocLtCurr       == pocLtCurr        .size() );
    23072322  assert(numPocLtFoll       == pocLtFoll        .size() );
    23082323
    23092324  // where PicOrderCntVal is the picture order count of the current picture as specified in clause 8.3.1.
    23102325
    2311   //   NOTE 2 - A value of CurrRpsIdx in the range of 0 to num_short_term_ref_pic_sets - 1, inclusive, 
    2312   //   indicates that a candidate short-term RPS from the active SPS for the current layer is being used, 
    2313   //   where CurrRpsIdx is the index of the candidate short-term RPS into the list of candidate short-term RPSs signalled 
    2314   //   in the active SPS for the current layer. CurrRpsIdx equal to num_short_term_ref_pic_sets indicates that 
     2326  //   NOTE 2 - A value of CurrRpsIdx in the range of 0 to num_short_term_ref_pic_sets - 1, inclusive,
     2327  //   indicates that a candidate short-term RPS from the active SPS for the current layer is being used,
     2328  //   where CurrRpsIdx is the index of the candidate short-term RPS into the list of candidate short-term RPSs signalled
     2329  //   in the active SPS for the current layer. CurrRpsIdx equal to num_short_term_ref_pic_sets indicates that
    23152330  //   the short-term RPS of the current picture is directly signalled in the slice header.
    23162331
    23172332  for (Int i = 0; i <= numPocLtCurr - 1; i++  )
    23182333  {
    2319       // For each i in the range of 0 to NumPocLtCurr - 1, inclusive, when CurrDeltaPocMsbPresentFlag[ i ] is equal to 1, 
     2334      // For each i in the range of 0 to NumPocLtCurr - 1, inclusive, when CurrDeltaPocMsbPresentFlag[ i ] is equal to 1,
    23202335      // it is a requirement of bitstream conformance that the following conditions apply:
    23212336    if ( currDeltaPocMsbPresentFlag[i] )
    23222337    {
    2323       // -  There shall be no j in the range of 0 to NumPocStCurrBefore - 1, inclusive, 
     2338      // -  There shall be no j in the range of 0 to NumPocStCurrBefore - 1, inclusive,
    23242339      //    for which PocLtCurr[ i ] is equal to PocStCurrBefore[ j ].
    23252340      for (Int j = 0; j <= numPocStCurrBefore - 1; j++ )
     
    23282343      }
    23292344
    2330       // -  There shall be no j in the range of 0 to NumPocStCurrAfter - 1, inclusive, 
    2331       //    for which PocLtCurr[ i ] is equal to PocStCurrAfter[ j ]. 
     2345      // -  There shall be no j in the range of 0 to NumPocStCurrAfter - 1, inclusive,
     2346      //    for which PocLtCurr[ i ] is equal to PocStCurrAfter[ j ].
    23322347      for (Int j = 0; j <= numPocStCurrAfter - 1; j++ )
    23332348      {
     
    23352350      }
    23362351
    2337       // -  There shall be no j in the range of 0 to NumPocStFoll - 1, inclusive, 
     2352      // -  There shall be no j in the range of 0 to NumPocStFoll - 1, inclusive,
    23382353      //    for which PocLtCurr[ i ] is equal to PocStFoll[ j ].
    23392354      for (Int j = 0; j <= numPocStFoll - 1; j++ )
     
    23422357      }
    23432358
    2344       // -  There shall be no j in the range of 0 to NumPocLtCurr - 1, inclusive, 
     2359      // -  There shall be no j in the range of 0 to NumPocLtCurr - 1, inclusive,
    23452360      //    where j is not equal to i, for which PocLtCurr[ i ] is equal to PocLtCurr[ j ].
    23462361      for (Int j = 0; j <= numPocLtCurr - 1; j++ )
    23472362      {
    23482363        if ( i != j )
    2349         {       
     2364        {
    23502365          assert(!( pocLtCurr[ i ] == pocLtCurr[ j ] ) );
    23512366        }
     
    23562371  for (Int i = 0; i <= numPocLtFoll - 1; i++  )
    23572372  {
    2358     // For each i in the range of 0 to NumPocLtFoll - 1, inclusive, when FollDeltaPocMsbPresentFlag[ i ] is equal to 1, 
     2373    // For each i in the range of 0 to NumPocLtFoll - 1, inclusive, when FollDeltaPocMsbPresentFlag[ i ] is equal to 1,
    23592374    // it is a requirement of bitstream conformance that the following conditions apply:
    23602375    if ( follDeltaPocMsbPresentFlag[i] )
    23612376    {
    2362       // -  There shall be no j in the range of 0 to NumPocStCurrBefore - 1, inclusive, 
     2377      // -  There shall be no j in the range of 0 to NumPocStCurrBefore - 1, inclusive,
    23632378      //    for which PocLtFoll[ i ] is equal to PocStCurrBefore[ j ].
    23642379      for (Int j = 0; j <= numPocStCurrBefore - 1; j++ )
     
    23672382      }
    23682383
    2369       // -  There shall be no j in the range of 0 to NumPocStCurrAfter - 1, inclusive, 
     2384      // -  There shall be no j in the range of 0 to NumPocStCurrAfter - 1, inclusive,
    23702385      //    for which PocLtFoll[ i ] is equal to PocStCurrAfter[ j ].
    23712386      for (Int j = 0; j <= numPocStCurrAfter - 1; j++ )
     
    23742389      }
    23752390
    2376       // -  There shall be no j in the range of 0 to NumPocStFoll - 1, inclusive, 
     2391      // -  There shall be no j in the range of 0 to NumPocStFoll - 1, inclusive,
    23772392      //    for which PocLtFoll[ i ] is equal to PocStFoll[ j ].
    23782393      for (Int j = 0; j <= numPocStFoll - 1; j++ )
     
    23812396      }
    23822397
    2383       // -  There shall be no j in the range of 0 to NumPocLtFoll - 1, inclusive, 
     2398      // -  There shall be no j in the range of 0 to NumPocLtFoll - 1, inclusive,
    23842399      //    where j is not equal to i, for which PocLtFoll[ i ] is equal to PocLtFoll[ j ].
    23852400      for (Int j = 0; j <= numPocLtFoll - 1; j++ )
     
    23912406      }
    23922407
    2393       // -  There shall be no j in the range of 0 to NumPocLtCurr - 1, inclusive, 
     2408      // -  There shall be no j in the range of 0 to NumPocLtCurr - 1, inclusive,
    23942409      //    for which PocLtFoll[ i ] is equal to PocLtCurr[ j ].
    23952410      for (Int j = 0; j <= numPocLtCurr - 1; j++ )
     
    24002415  }
    24012416
    2402   Int maxPicOrderCntLsb = sps->getMaxPicOrderCntLsb(); 
     2417  Int maxPicOrderCntLsb = sps->getMaxPicOrderCntLsb();
    24032418  for (Int i = 0; i <= numPocLtCurr - 1; i++  )
    24042419  {
    2405     // For each i in the range of 0 to NumPocLtCurr - 1, inclusive, when CurrDeltaPocMsbPresentFlag[ i ] is equal to 0, 
     2420    // For each i in the range of 0 to NumPocLtCurr - 1, inclusive, when CurrDeltaPocMsbPresentFlag[ i ] is equal to 0,
    24062421    // it is a requirement of bitstream conformance that the following conditions apply:
    24072422    if ( currDeltaPocMsbPresentFlag[ i ] == 0  )
    24082423    {
    2409       // -  There shall be no j in the range of 0 to NumPocStCurrBefore - 1, inclusive, 
     2424      // -  There shall be no j in the range of 0 to NumPocStCurrBefore - 1, inclusive,
    24102425      //    for which PocLtCurr[ i ] is equal to ( PocStCurrBefore[ j ] & ( MaxPicOrderCntLsb - 1 ) ).
    24112426      for (Int j = 0; j <= numPocStCurrBefore - 1; j++ )
     
    24422457  for (Int i = 0; i <= numPocLtFoll - 1; i++  )
    24432458  {
    2444     // For each i in the range of 0 to NumPocLtFoll - 1, inclusive, when FollDeltaPocMsbPresentFlag[ i ] is equal to 0, 
     2459    // For each i in the range of 0 to NumPocLtFoll - 1, inclusive, when FollDeltaPocMsbPresentFlag[ i ] is equal to 0,
    24452460    // it is a requirement of bitstream conformance that the following conditions apply:
    24462461    if ( follDeltaPocMsbPresentFlag[ i ] == 0  )
     
    24742489        {
    24752490          assert(!( pocLtFoll[ i ] == ( pocLtFoll[ j ] & ( maxPicOrderCntLsb - 1 ) ) ) );
    2476         }         
     2491        }
    24772492      }
    24782493
     
    24872502
    24882503  if ( !annexFModifications )
    2489   { 
    2490     // The variable NumPicTotalCurr is derived as specified in clause 7.4.7.2. 
     2504  {
     2505    // The variable NumPicTotalCurr is derived as specified in clause 7.4.7.2.
    24912506
    24922507    // It is a requirement of bitstream conformance that the following applies to the value of NumPicTotalCurr:
     
    24942509    {
    24952510      // -  If the current picture is a BLA or CRA picture, the value of NumPicTotalCurr shall be equal to 0.
    2496       assert( slice->getNumPicTotalCurr() == 0 ); 
     2511      assert( slice->getNumPicTotalCurr() == 0 );
    24972512    }
    24982513    else
    24992514    {
    2500       // -  Otherwise, 
     2515      // -  Otherwise,
    25012516      if ( slice->isInterP() || slice->isInterB() )
    25022517      {
    25032518        // when the current picture contains a P or B slice, the value of NumPicTotalCurr shall not be equal to 0.
    2504         assert( slice->getNumPicTotalCurr() != 0 ); 
    2505       }
    2506     }
    2507   }
    2508    
    2509   // The RPS of the current picture consists of five RPS lists; RefPicSetStCurrBefore, RefPicSetStCurrAfter, RefPicSetStFoll, 
    2510   // RefPicSetLtCurr and RefPicSetLtFoll. RefPicSetStCurrBefore, RefPicSetStCurrAfter and RefPicSetStFoll are collectively 
     2519        assert( slice->getNumPicTotalCurr() != 0 );
     2520      }
     2521    }
     2522  }
     2523
     2524  // The RPS of the current picture consists of five RPS lists; RefPicSetStCurrBefore, RefPicSetStCurrAfter, RefPicSetStFoll,
     2525  // RefPicSetLtCurr and RefPicSetLtFoll. RefPicSetStCurrBefore, RefPicSetStCurrAfter and RefPicSetStFoll are collectively
    25112526  // referred to as the short-term RPS. RefPicSetLtCurr and RefPicSetLtFoll are collectively referred to as the long-term RPS.
    25122527
     
    25162531  std::vector<TComPic*>& refPicSetLtCurr       = decRps->m_refPicSetLtCurr      ;
    25172532  std::vector<TComPic*>& refPicSetLtFoll       = decRps->m_refPicSetLtFoll      ;
    2518  
     2533
    25192534  std::vector<TComPic*>** refPicSetsCurr       = decRps->m_refPicSetsCurr       ;
    25202535  std::vector<TComPic*>** refPicSetsLt         = decRps->m_refPicSetsLt         ;
    25212536  std::vector<TComPic*>** refPicSetsAll        = decRps->m_refPicSetsAll        ;
    2522   //   NOTE 3 - RefPicSetStCurrBefore, RefPicSetStCurrAfter and RefPicSetLtCurr contain all reference pictures that may be 
     2537  //   NOTE 3 - RefPicSetStCurrBefore, RefPicSetStCurrAfter and RefPicSetLtCurr contain all reference pictures that may be
    25232538  //   used for inter prediction of the current picture and one or more pictures that follow the current picture in decoding order.
    2524   //   RefPicSetStFoll and RefPicSetLtFoll consist of all reference pictures that are not used for inter prediction of the current 
     2539  //   RefPicSetStFoll and RefPicSetLtFoll consist of all reference pictures that are not used for inter prediction of the current
    25252540  //   picture but may be used in inter prediction for one or more pictures that follow the current picture in decoding order.
    25262541
     
    25282543  // 1.  The following applies:
    25292544
    2530   TComSubDpb* dpb = m_dpb->getSubDpb( getLayerId(), false );   
     2545  TComSubDpb* dpb = m_dpb->getSubDpb( getLayerId(), false );
    25312546  assert( refPicSetLtCurr.empty() );
    2532   for( Int i = 0; i < numPocLtCurr; i++ ) 
    2533   {
    2534     if( !currDeltaPocMsbPresentFlag[ i ] ) 
    2535     {   
    2536       refPicSetLtCurr.push_back( dpb->getPicFromLsb( pocLtCurr[ i ], maxPicOrderCntLsb ) );       
     2547  for( Int i = 0; i < numPocLtCurr; i++ )
     2548  {
     2549    if( !currDeltaPocMsbPresentFlag[ i ] )
     2550    {
     2551      refPicSetLtCurr.push_back( dpb->getPicFromLsb( pocLtCurr[ i ], maxPicOrderCntLsb ) );
    25372552    }
    25382553    else
    25392554    {
    2540       refPicSetLtCurr.push_back(dpb->getPic( pocLtCurr[ i ] ));       
    2541     }   
     2555      refPicSetLtCurr.push_back(dpb->getPic( pocLtCurr[ i ] ));
     2556    }
    25422557  }
    25432558
     
    25512566   else
    25522567   {
    2553      refPicSetLtFoll.push_back(dpb->getPic( pocLtFoll[ i ] ));       
     2568     refPicSetLtFoll.push_back(dpb->getPic( pocLtFoll[ i ] ));
    25542569   }
    25552570  }
    2556  
    2557   // 2.  All reference pictures that are included in RefPicSetLtCurr or RefPicSetLtFoll and have nuh_layer_id equal 
     2571
     2572  // 2.  All reference pictures that are included in RefPicSetLtCurr or RefPicSetLtFoll and have nuh_layer_id equal
    25582573  //     to currPicLayerId are marked as "used for long-term reference".
    25592574  for (Int i = 0; i < numPocLtCurr; i++)
     
    25612576    if ( refPicSetLtCurr[i] != NULL )
    25622577    {
    2563       refPicSetLtCurr[i]->markAsUsedForLongTermReference(); 
    2564     }   
     2578      refPicSetLtCurr[i]->markAsUsedForLongTermReference();
     2579    }
    25652580  }
    25662581
     
    25692584    if ( refPicSetLtFoll[i] != NULL )
    25702585    {
    2571       refPicSetLtFoll[i]->markAsUsedForLongTermReference(); 
    2572     }   
     2586      refPicSetLtFoll[i]->markAsUsedForLongTermReference();
     2587    }
    25732588  }
    25742589
     
    25772592  for( Int i = 0; i < numPocStCurrBefore; i++ )
    25782593  {
    2579     refPicSetStCurrBefore.push_back(dpb->getShortTermRefPic( pocStCurrBefore[ i ] )); 
     2594    refPicSetStCurrBefore.push_back(dpb->getShortTermRefPic( pocStCurrBefore[ i ] ));
    25802595  }
    25812596
     
    25832598  for( Int i = 0; i < numPocStCurrAfter; i++ )
    25842599  {
    2585     refPicSetStCurrAfter.push_back(dpb->getShortTermRefPic( pocStCurrAfter[ i ] )); 
     2600    refPicSetStCurrAfter.push_back(dpb->getShortTermRefPic( pocStCurrAfter[ i ] ));
    25862601  }
    25872602
     
    25892604  for( Int i = 0; i < numPocStFoll; i++ )
    25902605  {
    2591     refPicSetStFoll.push_back(dpb->getShortTermRefPic( pocStFoll[ i ] )); 
    2592   }
    2593  
    2594   // 4.  All reference pictures in the DPB that are not included in RefPicSetLtCurr, RefPicSetLtFoll, RefPicSetStCurrBefore, 
     2606    refPicSetStFoll.push_back(dpb->getShortTermRefPic( pocStFoll[ i ] ));
     2607  }
     2608
     2609  // 4.  All reference pictures in the DPB that are not included in RefPicSetLtCurr, RefPicSetLtFoll, RefPicSetStCurrBefore,
    25952610  //     RefPicSetStCurrAfter, or RefPicSetStFoll and have nuh_layer_id equal to currPicLayerId are marked as "unused for reference".
    2596   TComSubDpb picsToMark = (*dpb); 
     2611  TComSubDpb picsToMark = (*dpb);
    25972612  for (Int j = 0; j < 5; j++ )
    25982613  {
    2599     picsToMark.removePics( *refPicSetsAll[j] ); 
    2600   } 
    2601   picsToMark.markAllAsUnusedForReference(); 
    2602  
    2603   //     NOTE 4 - There may be one or more entries in the RPS lists that are equal to "no reference picture" because 
    2604   //     the corresponding pictures are not present in the DPB. Entries in RefPicSetStFoll or RefPicSetLtFoll that are equal 
    2605   //     to "no reference picture" should be ignored. An unintentional picture loss should be inferred for each entry in 
     2614    picsToMark.removePics( *refPicSetsAll[j] );
     2615  }
     2616  picsToMark.markAllAsUnusedForReference();
     2617
     2618  //     NOTE 4 - There may be one or more entries in the RPS lists that are equal to "no reference picture" because
     2619  //     the corresponding pictures are not present in the DPB. Entries in RefPicSetStFoll or RefPicSetLtFoll that are equal
     2620  //     to "no reference picture" should be ignored. An unintentional picture loss should be inferred for each entry in
    26062621  //     RefPicSetStCurrBefore, RefPicSetStCurrAfter, or RefPicSetLtCurr that is equal to "no reference picture".
    26072622
    26082623  //     NOTE 5 - A picture cannot be included in more than one of the five RPS lists.
    26092624
    2610  
     2625
    26112626  // It is a requirement of bitstream conformance that the RPS is restricted as follows:
    26122627
     
    26142629#if NH_MV_FIX_NO_REF_PICS_CHECK
    26152630  if ( !annexFModifications || m_firstPicInLayerDecodedFlag[ m_pcPic->getLayerId() ] )
    2616   { 
     2631  {
    26172632#endif
    26182633    for (Int j = 0; j < 3; j++ )
    26192634    {
    2620       // -  There shall be no entry in RefPicSetStCurrBefore, RefPicSetStCurrAfter or RefPicSetLtCurr 
     2635      // -  There shall be no entry in RefPicSetStCurrBefore, RefPicSetStCurrAfter or RefPicSetLtCurr
    26212636      //    for which one or more of the following are true:
    26222637
    2623       std::vector<TComPic*>* currSet = refPicSetsCurr[j]; 
     2638      std::vector<TComPic*>* currSet = refPicSetsCurr[j];
    26242639      for (Int i = 0; i < currSet->size(); i++)
    26252640      {
    2626         TComPic* pic = (*currSet)[i]; 
     2641        TComPic* pic = (*currSet)[i];
    26272642
    26282643        // -  The entry is equal to "no reference picture".
    2629         assert( ! (pic == NULL ) ); 
     2644        assert( ! (pic == NULL ) );
    26302645
    26312646        // -  The entry is an SLNR picture and has TemporalId equal to that of the current picture.
    2632         assert( !( pic->isSlnr() && pic->getTemporalId() == m_pcPic->getTemporalId() ) ); 
     2647        assert( !( pic->isSlnr() && pic->getTemporalId() == m_pcPic->getTemporalId() ) );
    26332648
    26342649        // -  The entry is a picture that has TemporalId greater than that of the current picture.
    2635         assert( !(  pic->getTemporalId() > m_pcPic->getTemporalId() ) ); 
    2636       }     
     2650        assert( !(  pic->getTemporalId() > m_pcPic->getTemporalId() ) );
     2651      }
    26372652    }
    26382653#if NH_MV_FIX_NO_REF_PICS_CHECK
    26392654  }
    26402655#endif
    2641  
    2642   //  -  There shall be no entry in RefPicSetLtCurr or RefPicSetLtFoll for which the 
    2643   //     difference between the picture order count value of the current picture and the picture order count 
     2656
     2657  //  -  There shall be no entry in RefPicSetLtCurr or RefPicSetLtFoll for which the
     2658  //     difference between the picture order count value of the current picture and the picture order count
    26442659  //     value of the entry is greater than or equal to 2^24.
    26452660  for (Int j = 0; j < 2; j++ )
    2646   {   
    2647     std::vector<TComPic*>* ltSet = refPicSetsLt[j]; 
     2661  {
     2662    std::vector<TComPic*>* ltSet = refPicSetsLt[j];
    26482663    for (Int i = 0; i < ltSet->size(); i++)
    26492664    {
    2650       TComPic* pic = (*ltSet)[i]; 
     2665      TComPic* pic = (*ltSet)[i];
    26512666      if( pic != NULL )
    26522667      {
    2653         assert(!( abs( m_pcPic->getPOC() - pic->getPOC() ) >= (1 << 24) )); 
    2654       }
    2655     }
    2656   }
    2657 
    2658   //   -  When the current picture is a temporal sub-layer access (TSA) picture, there shall be no picture 
     2668        assert(!( abs( m_pcPic->getPOC() - pic->getPOC() ) >= (1 << 24) ));
     2669      }
     2670    }
     2671  }
     2672
     2673  //   -  When the current picture is a temporal sub-layer access (TSA) picture, there shall be no picture
    26592674  //      included in the RPS with TemporalId greater than or equal to the TemporalId of the current picture.
    26602675  if (m_pcPic->isTsa() )
    26612676  {
    26622677    for (Int j = 0; j < 5; j++ )
    2663     {   
    2664       std::vector<TComPic*>* aSet = refPicSetsAll[j]; 
     2678    {
     2679      std::vector<TComPic*>* aSet = refPicSetsAll[j];
    26652680      for (Int i = 0; i < aSet->size(); i++)
    26662681      {
    2667         TComPic* pic = (*aSet)[i]; 
     2682        TComPic* pic = (*aSet)[i];
    26682683        if( pic != NULL )
    26692684        {
    2670           assert( ! (pic->getTemporalId() >= m_pcPic->getTemporalId() ) ); 
     2685          assert( ! (pic->getTemporalId() >= m_pcPic->getTemporalId() ) );
    26712686        }
    26722687      }
     
    26742689  }
    26752690
    2676   //   -  When the current picture is a step-wise temporal sub-layer access (STSA) picture, 
     2691  //   -  When the current picture is a step-wise temporal sub-layer access (STSA) picture,
    26772692  //      there shall be no picture included in RefPicSetStCurrBefore, RefPicSetStCurrAfter or RefPicSetLtCurr that has
    26782693  //      TemporalId equal to that of the current picture.
     
    26802695  {
    26812696    for (Int j = 0; j < 3; j++ )
    2682     {   
    2683       std::vector<TComPic*>* cSet = refPicSetsCurr[j]; 
     2697    {
     2698      std::vector<TComPic*>* cSet = refPicSetsCurr[j];
    26842699      for (Int i = 0; i < cSet->size(); i++)
    26852700      {
    2686         TComPic* pic = (*cSet)[i]; 
     2701        TComPic* pic = (*cSet)[i];
    26872702        if( pic != NULL )
    26882703        {
    2689           assert( ! (pic->getTemporalId() == m_pcPic->getTemporalId() ) ); 
     2704          assert( ! (pic->getTemporalId() == m_pcPic->getTemporalId() ) );
    26902705        }
    26912706      }
     
    27002715  {
    27012716    for (Int j = 0; j < 3; j++ )
    2702     {   
    2703       std::vector<TComPic*>* cSet = refPicSetsCurr[j]; 
     2717    {
     2718      std::vector<TComPic*>* cSet = refPicSetsCurr[j];
    27042719      for (Int i = 0; i < cSet->size(); i++)
    27052720      {
    2706         TComPic* pic = (*cSet)[i]; 
     2721        TComPic* pic = (*cSet)[i];
    27072722        if( pic != NULL )
    27082723        {
    2709           assert( ! (pic->getTemporalId() == m_pcPic->getTemporalId() && pic->getDecodingOrder() < m_prevStsaDecOrder  ) ); 
     2724          assert( ! (pic->getTemporalId() == m_pcPic->getTemporalId() && pic->getDecodingOrder() < m_prevStsaDecOrder  ) );
    27102725        }
    27112726      }
    27122727    }
    27132728  }
    2714  
     2729
    27152730  //   -  When the current picture is a CRA picture, there shall be no picture included in the RPS that
    27162731  //      precedes, in output order or decoding order, any preceding IRAP picture in decoding order (when present).
     
    27182733  {
    27192734    for (Int j = 0; j < 5; j++ )
    2720     {   
    2721       std::vector<TComPic*>* aSet = refPicSetsAll[j]; 
     2735    {
     2736      std::vector<TComPic*>* aSet = refPicSetsAll[j];
    27222737      for (Int i = 0; i < aSet->size(); i++)
    27232738      {
    27242739        // TBD check whether it sufficient to test only the last IRAP
    2725         TComPic* pic = (*aSet)[i]; 
     2740        TComPic* pic = (*aSet)[i];
    27262741        if( pic != NULL )
    2727         {       
    2728           assert( ! (pic->getPOC()           < m_prevIrapPoc           ) );           
    2729           assert( ! (pic->getDecodingOrder() < m_prevIrapDecodingOrder ) ); 
     2742        {
     2743          assert( ! (pic->getPOC()           < m_prevIrapPoc           ) );
     2744          assert( ! (pic->getDecodingOrder() < m_prevIrapDecodingOrder ) );
    27302745        }
    27312746      }
    27322747    }
    27332748  }
    2734  
     2749
    27352750  Bool isTrailingPicture = ( !m_pcPic->isIrap() ) && ( m_pcPic->getPOC() > m_prevIrapPoc );
    27362751  //   -  When the current picture is a trailing picture, there shall be no picture in RefPicSetStCurrBefore,
     
    27402755  {
    27412756    for (Int j = 0; j < 3; j++ )
    2742     {   
    2743       std::vector<TComPic*>* cSet = refPicSetsCurr[j]; 
     2757    {
     2758      std::vector<TComPic*>* cSet = refPicSetsCurr[j];
    27442759      for (Int i = 0; i < cSet->size(); i++)
    27452760      {
    2746         TComPic* pic = (*cSet)[i]; 
     2761        TComPic* pic = (*cSet)[i];
    27472762        if( pic != NULL )
    27482763        {
    2749           assert( ! (pic->getIsGeneratedCl833() ) ); 
     2764          assert( ! (pic->getIsGeneratedCl833() ) );
    27502765        }
    27512766      }
     
    27582773  {
    27592774    for (Int j = 0; j < 5; j++ )
    2760     {   
    2761       std::vector<TComPic*>* aSet = refPicSetsAll[j]; 
     2775    {
     2776      std::vector<TComPic*>* aSet = refPicSetsAll[j];
    27622777      for (Int i = 0; i < aSet->size(); i++)
    27632778      {
    27642779        // TBD check whether it sufficient to test only the last IRAP
    2765          TComPic* pic = (*aSet)[i]; 
     2780         TComPic* pic = (*aSet)[i];
    27662781        if( pic != NULL )
    2767         {         
    2768           assert( ! (pic->getPOC()           < m_prevIrapPoc           ) ); 
    2769           assert( ! (pic->getDecodingOrder() < m_prevIrapDecodingOrder ) ); 
     2782        {
     2783          assert( ! (pic->getPOC()           < m_prevIrapPoc           ) );
     2784          assert( ! (pic->getDecodingOrder() < m_prevIrapDecodingOrder ) );
    27702785        }
    27712786      }
     
    27782793  {
    27792794    for (Int j = 0; j < 3; j++ )
    2780     {   
    2781       std::vector<TComPic*>* cSet = refPicSetsCurr[j]; 
     2795    {
     2796      std::vector<TComPic*>* cSet = refPicSetsCurr[j];
    27822797      for (Int i = 0; i < cSet->size(); i++)
    2783       {       
    2784         TComPic* pic = (*cSet)[i]; 
     2798      {
     2799        TComPic* pic = (*cSet)[i];
    27852800        if( pic != NULL )
    2786         {       
     2801        {
    27872802          // -  A RASL picture
    2788           assert( ! (pic->isRasl() ) ); 
    2789           // -  A picture that was generated by the decoding process for generating unavailable reference pictures 
     2803          assert( ! (pic->isRasl() ) );
     2804          // -  A picture that was generated by the decoding process for generating unavailable reference pictures
    27902805          //    as specified in clause 8.3.3
    2791           assert( ! (pic->getIsGeneratedCl833() ) ); 
     2806          assert( ! (pic->getIsGeneratedCl833() ) );
    27922807          // -  A picture that precedes the associated IRAP picture in decoding order
    2793           assert( ! (pic->getDecodingOrder() < m_prevIrapDecodingOrder ) ); 
     2808          assert( ! (pic->getDecodingOrder() < m_prevIrapDecodingOrder ) );
    27942809        }
    27952810      }
    27962811    }
    27972812  }
    2798  
    2799  
     2813
     2814
    28002815  if ( sps->getTemporalIdNestingFlag() )
    28012816  {
    28022817    // -  When sps_temporal_id_nesting_flag is equal to 1, the following applies:
    28032818    //    -  Let tIdA be the value of TemporalId of the current picture picA.
    2804     TComPic* picA = m_pcPic; 
     2819    TComPic* picA = m_pcPic;
    28052820    Int      tIdA = picA->getTemporalId();
    2806     //   -  Any picture picB with TemporalId equal to tIdB that is less than or equal to tIdA shall not be included in 
    2807     //      RefPicSetStCurrBefore, RefPicSetStCurrAfter or RefPicSetLtCurr of picA when there exists a picture picC that 
     2821    //   -  Any picture picB with TemporalId equal to tIdB that is less than or equal to tIdA shall not be included in
     2822    //      RefPicSetStCurrBefore, RefPicSetStCurrAfter or RefPicSetLtCurr of picA when there exists a picture picC that
    28082823    //      has TemporalId less than tIdB, follows picB in decoding order, and precedes picA in decoding order.
    28092824    for (Int j = 0; j < 3; j++ )
    2810     {   
    2811       std::vector<TComPic*>* cSet = refPicSetsCurr[j]; 
     2825    {
     2826      std::vector<TComPic*>* cSet = refPicSetsCurr[j];
    28122827      for (Int i = 0; i < cSet->size(); i++)
    28132828      {
    2814         TComPic* picB = (*cSet)[i]; 
     2829        TComPic* picB = (*cSet)[i];
    28152830        if( picB != NULL )
    28162831        {
    2817           Int tIdB = picB->getTemporalId(); 
     2832          Int tIdB = picB->getTemporalId();
    28182833
    28192834          if (tIdB <= tIdA)
     
    28212836            for ( TComSubDpb::iterator itP = dpb->begin(); itP != dpb->end(); itP++ )
    28222837            {
    2823               TComPic* picC = (*itP); 
    2824               assert(! ( picC->getTemporalId() < tIdB && picC->getDecodingOrder() > picB->getDecodingOrder() && picC->getDecodingOrder() < picA->getDecodingOrder()  )  ); 
     2838              TComPic* picC = (*itP);
     2839              assert(! ( picC->getTemporalId() < tIdB && picC->getDecodingOrder() > picB->getDecodingOrder() && picC->getDecodingOrder() < picA->getDecodingOrder()  )  );
    28252840            }
    28262841          }
     
    28282843      }
    28292844    }
    2830   }   
     2845  }
    28312846}
    28322847
     
    28392854
    28402855  // The specifications in clause 8.3.2 apply with the following changes:
    2841   // -  The references to clauses 7.4.7.2, 8.3.1, 8.3.3 and 8.3.4 are replaced with references to 
     2856  // -  The references to clauses 7.4.7.2, 8.3.1, 8.3.3 and 8.3.4 are replaced with references to
    28422857  //    clauses F.7.4.7.2, F.8.3.1, F.8.3.3 and F.8.3.4, respectively.
    28432858
    2844   x832DecProcForRefPicSet( true ); 
     2859  x832DecProcForRefPicSet( true );
    28452860
    28462861  // -  The following specifications are added:
    28472862  if (m_pcPic->isIrap() && m_pcPic->getLayerId() == m_smallestLayerId )
    28482863  {
    2849     // -  When the current picture is an IRAP picture with nuh_layer_id equal to SmallestLayerId, 
    2850     //    all reference pictures with any value of nuh_layer_id currently in the DPB (if any) are marked 
     2864    // -  When the current picture is an IRAP picture with nuh_layer_id equal to SmallestLayerId,
     2865    //    all reference pictures with any value of nuh_layer_id currently in the DPB (if any) are marked
    28512866    //    as "unused for reference" when at least one of the following conditions is true:
    28522867
     
    28602875
    28612876  // -  It is a requirement of bitstream conformance that the RPS is restricted as follows:
    2862   // -  When the current picture is a CRA picture, there shall be no picture in RefPicSetStCurrBefore, RefPicSetStCurrAfter 
     2877  // -  When the current picture is a CRA picture, there shall be no picture in RefPicSetStCurrBefore, RefPicSetStCurrAfter
    28632878  //    or RefPicSetLtCurr.
    28642879
     
    28672882  if ( m_pcPic->isCra() )
    28682883  {
    2869     for (Int j = 0; j < 3; j++ )   
    2870     {   
    2871       std::vector<TComPic*>* cSet = refPicSetsCurr[j]; 
    2872       assert ( cSet->size() == 0 ); 
     2884    for (Int j = 0; j < 3; j++ )
     2885    {
     2886      std::vector<TComPic*>* cSet = refPicSetsCurr[j];
     2887      assert ( cSet->size() == 0 );
    28732888    }
    28742889  }
     
    28762891  // -  The constraints specified in clause 8.3.2 on the value of NumPicTotalCurr are replaced with the following:
    28772892  //    -  It is a requirement of bitstream conformance that the following applies to the value of NumPicTotalCurr:
    2878   Int numPicTotalCurr = m_pcPic->getSlice(0)->getNumPicTotalCurr(); 
    2879   Int currPicLayerId  = m_pcPic->getLayerId(); 
    2880   const TComVPS* vps  = m_pcPic->getSlice(0)->getVPS(); 
     2893  Int numPicTotalCurr = m_pcPic->getSlice(0)->getNumPicTotalCurr();
     2894  Int currPicLayerId  = m_pcPic->getLayerId();
     2895  const TComVPS* vps  = m_pcPic->getSlice(0)->getVPS();
    28812896
    28822897  if ( ( m_pcPic->isBla() || m_pcPic->isCra() ) && (  (currPicLayerId == 0 ) || ( vps->getNumDirectRefLayers( currPicLayerId ) == 0 ) ) )
    2883   {   
    2884     assert( numPicTotalCurr == 0 ); 
    2885     // -  If the current picture is a BLA or CRA picture and either currPicLayerId is equal to 0 or 
     2898  {
     2899    assert( numPicTotalCurr == 0 );
     2900    // -  If the current picture is a BLA or CRA picture and either currPicLayerId is equal to 0 or
    28862901    //     NumDirectRefLayers[ currPicLayerId ] is equal to 0, the value of NumPicTotalCurr shall be equal to 0.
    28872902  }
     
    28922907    {
    28932908      // -  Otherwise, when the current picture contains a P or B slice, the value of NumPicTotalCurr shall not be equal to 0.
    2894       assert( numPicTotalCurr != 0 ); 
     2909      assert( numPicTotalCurr != 0 );
    28952910    }
    28962911  }
     
    29042919  ////////////////////////////////////////////////////////////////////
    29052920
    2906   // Outputs of this process are updated lists of inter-layer reference pictures RefPicSetInterLayer0 and RefPicSetInterLayer1 
     2921  // Outputs of this process are updated lists of inter-layer reference pictures RefPicSetInterLayer0 and RefPicSetInterLayer1
    29072922  // and the variables NumActiveRefLayerPics0 and NumActiveRefLayerPics1.
    29082923
    2909   TComDecodedRps* decRps = m_pcPic->getDecodedRps(); 
    2910   TComSlice* slice       = m_pcPic->getSlice( 0 ); 
    2911   const TComVPS* vps     =  slice->getVPS(); 
     2924  TComDecodedRps* decRps = m_pcPic->getDecodedRps();
     2925  TComSlice* slice       = m_pcPic->getSlice( 0 );
     2926  const TComVPS* vps     =  slice->getVPS();
    29122927
    29132928  Int&                   numActiveRefLayerPics0 = decRps->m_numActiveRefLayerPics0;
     
    29152930
    29162931  std::vector<TComPic*>& refPicSetInterLayer0   = decRps->m_refPicSetInterLayer0;
    2917   std::vector<TComPic*>& refPicSetInterLayer1   = decRps->m_refPicSetInterLayer1; 
     2932  std::vector<TComPic*>& refPicSetInterLayer1   = decRps->m_refPicSetInterLayer1;
    29182933
    29192934  // The variable currLayerId is set equal to nuh_layer_id of the current picture.
    2920   Int currLayerId = getLayerId(); 
    2921 
    2922   // The lists RefPicSetInterLayer0 and RefPicSetInterLayer1 are first emptied, NumActiveRefLayerPics0 and NumActiveRefLayerPics1 
     2935  Int currLayerId = getLayerId();
     2936
     2937  // The lists RefPicSetInterLayer0 and RefPicSetInterLayer1 are first emptied, NumActiveRefLayerPics0 and NumActiveRefLayerPics1
    29232938  // are set equal to 0 and the following applies:
    29242939
    2925   refPicSetInterLayer0.clear(); 
    2926   refPicSetInterLayer1.clear(); 
    2927 
    2928   numActiveRefLayerPics0 = 0; 
    2929   numActiveRefLayerPics1 = 0; 
    2930 
    2931   Int viewIdCurrLayerId  = vps->getViewId( currLayerId ); 
     2940  refPicSetInterLayer0.clear();
     2941  refPicSetInterLayer1.clear();
     2942
     2943  numActiveRefLayerPics0 = 0;
     2944  numActiveRefLayerPics1 = 0;
     2945
     2946  Int viewIdCurrLayerId  = vps->getViewId( currLayerId );
    29322947  Int viewId0            = vps->getViewId( 0   );
    29332948
    2934   for( Int i = 0; i < slice->getNumActiveRefLayerPics(); i++ )   
    2935   {
    2936     Int viewIdRefPicLayerIdi = vps->getViewId( slice->getRefPicLayerId( i ) ); 
     2949  for( Int i = 0; i < slice->getNumActiveRefLayerPics(); i++ )
     2950  {
     2951    Int viewIdRefPicLayerIdi = vps->getViewId( slice->getRefPicLayerId( i ) );
    29372952
    29382953    Bool refPicSet0Flag =
     
    29442959    {
    29452960      // there is a picture picX in the DPB that is in the same access unit as the current picture and has
    2946       // nuh_layer_id equal to RefPicLayerId[ i ] 
     2961      // nuh_layer_id equal to RefPicLayerId[ i ]
    29472962
    29482963      if ( refPicSet0Flag )
     
    29602975      assert( ! picX->getSlice(0)->getDiscardableFlag() );
    29612976
    2962       // If the current picture is a RADL picture, there shall be no entry in RefPicSetInterLayer0 or RefPicSetInterLayer1 
     2977      // If the current picture is a RADL picture, there shall be no entry in RefPicSetInterLayer0 or RefPicSetInterLayer1
    29632978      // that is a RASL picture.
    29642979      if ( m_pcPic->isRadl() )
     
    29923007  ///////////////////////////////////////////////////////////////////////////////////////
    29933008
    2994   // This process is invoked once per coded picture when the current picture is a 
     3009  // This process is invoked once per coded picture when the current picture is a
    29953010  // BLA picture or is a CRA picture with NoRaslOutputFlag equal to 1.
    29963011
    29973012  assert( m_pcPic->isBla() || (m_pcPic->isCra() && m_pcPic->getNoRaslOutputFlag() ) );
    2998   TComDecodedRps* decRps = m_pcPic->getDecodedRps(); 
     3013  TComDecodedRps* decRps = m_pcPic->getDecodedRps();
    29993014
    30003015  std::vector<TComPic*>& refPicSetStFoll      = decRps->m_refPicSetStFoll;
    3001   std::vector<TComPic*>& refPicSetLtFoll      = decRps->m_refPicSetLtFoll; 
     3016  std::vector<TComPic*>& refPicSetLtFoll      = decRps->m_refPicSetLtFoll;
    30023017
    30033018  const std::vector<Int>& pocStFoll             = decRps->m_pocStFoll;
     
    30053020
    30063021  const Int               numPocStFoll          = decRps->m_numPocStFoll;
    3007   const Int               numPocLtFoll          = decRps->m_numPocLtFoll;   
     3022  const Int               numPocLtFoll          = decRps->m_numPocLtFoll;
    30083023
    30093024  // When this process is invoked, the following applies:
     
    30123027    if ( refPicSetStFoll[ i ] == NULL )
    30133028    {
    3014       //-  For each RefPicSetStFoll[ i ], with i in the range of 0 to NumPocStFoll - 1, inclusive, that is equal 
     3029      //-  For each RefPicSetStFoll[ i ], with i in the range of 0 to NumPocStFoll - 1, inclusive, that is equal
    30153030      //   to "no reference picture", a picture is generated as specified in clause 8.3.3.2, and the following applies:
    3016       TComPic* genPic = x8332GenOfOneUnavailPic( true ); 
     3031      TComPic* genPic = x8332GenOfOneUnavailPic( true );
    30173032
    30183033      // -  The value of PicOrderCntVal for the generated picture is set equal to PocStFoll[ i ].
    30193034      genPic->getSlice(0)->setPOC( pocStFoll[ i ] );
    30203035
    3021       //-  The value of PicOutputFlag for the generated picture is set equal to 0. 
    3022       genPic->setPicOutputFlag( false ); 
     3036      //-  The value of PicOutputFlag for the generated picture is set equal to 0.
     3037      genPic->setPicOutputFlag( false );
    30233038
    30243039      // -  The generated picture is marked as "used for short-term reference".
     
    30293044
    30303045      // -  The value of nuh_layer_id for the generated picture is set equal to nuh_layer_id of the current picture.
    3031       genPic->setLayerId( m_pcPic-> getLayerId() ); 
     3046      genPic->setLayerId( m_pcPic-> getLayerId() );
    30323047
    30333048      // Insert to DPB
    3034       m_dpb->addNewPic( genPic ); 
     3049      m_dpb->addNewPic( genPic );
    30353050    }
    30363051  }
     
    30403055    if ( refPicSetLtFoll[ i ] == NULL )
    30413056    {
    3042       //-  For each RefPicSetLtFoll[ i ], with i in the range of 0 to NumPocLtFoll - 1, inclusive, that is equal to 
     3057      //-  For each RefPicSetLtFoll[ i ], with i in the range of 0 to NumPocLtFoll - 1, inclusive, that is equal to
    30433058      //   "no reference picture", a picture is generated as specified in clause 8.3.3.2, and the following applies:
    3044       TComPic* genPic = x8332GenOfOneUnavailPic( true ); 
     3059      TComPic* genPic = x8332GenOfOneUnavailPic( true );
    30453060
    30463061      //-  The value of PicOrderCntVal for the generated picture is set equal to PocLtFoll[ i ].
     
    30483063
    30493064      //  -  The value of slice_pic_order_cnt_lsb for the generated picture is inferred to be equal to ( PocLtFoll[ i ] & ( MaxPicOrderCntLsb - 1 ) ).
    3050       genPic->getSlice(0)->setSlicePicOrderCntLsb( ( pocLtFoll[ i ] & ( m_pcPic->getSlice(0)->getSPS()->getMaxPicOrderCntLsb() - 1 ) ) ); 
    3051 
    3052       //  -  The value of PicOutputFlag for the generated picture is set equal to 0.   
    3053       genPic->setPicOutputFlag( false ); 
     3065      genPic->getSlice(0)->setSlicePicOrderCntLsb( ( pocLtFoll[ i ] & ( m_pcPic->getSlice(0)->getSPS()->getMaxPicOrderCntLsb() - 1 ) ) );
     3066
     3067      //  -  The value of PicOutputFlag for the generated picture is set equal to 0.
     3068      genPic->setPicOutputFlag( false );
    30543069
    30553070      //  -  The generated picture is marked as "used for long-term reference".
     
    30603075
    30613076      //  -  The value of nuh_layer_id for the generated picture is set equal to nuh_layer_id of the current picture.
    3062       genPic->setLayerId( m_pcPic-> getLayerId() ); 
     3077      genPic->setLayerId( m_pcPic-> getLayerId() );
    30633078
    30643079      // Insert to DPB
    3065       m_dpb->addNewPic( genPic ); 
     3080      m_dpb->addNewPic( genPic );
    30663081    }
    30673082  }
     
    30753090  ///////////////////////////////////////////////////////////////////////////////////////
    30763091
    3077   TComPic* genPic = new TComPic; 
    3078   genPic->create( *m_pcPic->getSlice(0)->getSPS(), *m_pcPic->getSlice(0)->getPPS(), true ); 
    3079   genPic->setIsGenerated( true );     
    3080   genPic->setIsGeneratedCl833( calledFromCl8331 ); 
     3092  TComPic* genPic = new TComPic;
     3093  genPic->create( *m_pcPic->getSlice(0)->getSPS(), *m_pcPic->getSlice(0)->getPPS(), true );
     3094  genPic->setIsGenerated( true );
     3095  genPic->setIsGeneratedCl833( calledFromCl8331 );
    30813096  return genPic;
    30823097}
     
    30863101{
    30873102  ///////////////////////////////////////////////////////////////////////////////////////
    3088   // F.8.1.7 Decoding process for generating unavailable reference pictures for pictures 
     3103  // F.8.1.7 Decoding process for generating unavailable reference pictures for pictures
    30893104  //         first in decoding order within a layer
    30903105  ///////////////////////////////////////////////////////////////////////////////////////
    30913106
    3092   //  This process is invoked for a picture with nuh_layer_id equal to layerId, when FirstPicInLayerDecodedFlag[layerId ] is equal to 0.   
     3107  //  This process is invoked for a picture with nuh_layer_id equal to layerId, when FirstPicInLayerDecodedFlag[layerId ] is equal to 0.
    30933108  assert( !m_firstPicInLayerDecodedFlag[ getLayerId() ] );
    30943109
    30953110
    3096   TComDecodedRps* decRps = m_pcPic->getDecodedRps(); 
    3097 
    3098   std::vector<TComPic*>& refPicSetStCurrBefore = decRps->m_refPicSetStCurrBefore; 
     3111  TComDecodedRps* decRps = m_pcPic->getDecodedRps();
     3112
     3113  std::vector<TComPic*>& refPicSetStCurrBefore = decRps->m_refPicSetStCurrBefore;
    30993114  std::vector<TComPic*>& refPicSetStCurrAfter  = decRps->m_refPicSetStCurrAfter;
    31003115  std::vector<TComPic*>& refPicSetStFoll       = decRps->m_refPicSetStFoll;
    3101   std::vector<TComPic*>& refPicSetLtCurr       = decRps->m_refPicSetLtCurr; 
    3102   std::vector<TComPic*>& refPicSetLtFoll       = decRps->m_refPicSetLtFoll; 
     3116  std::vector<TComPic*>& refPicSetLtCurr       = decRps->m_refPicSetLtCurr;
     3117  std::vector<TComPic*>& refPicSetLtFoll       = decRps->m_refPicSetLtFoll;
    31033118
    31043119
     
    31093124  const std::vector<Int>& pocLtFoll            = decRps->m_pocLtFoll;
    31103125
    3111   const Int numPocStCurrBefore                 = decRps->m_numPocStCurrBefore; 
     3126  const Int numPocStCurrBefore                 = decRps->m_numPocStCurrBefore;
    31123127  const Int numPocStCurrAfter                  = decRps->m_numPocStCurrAfter;
    31133128  const Int numPocStFoll                       = decRps->m_numPocStFoll;
    31143129  const Int numPocLtCurr                       = decRps->m_numPocLtCurr;
    3115   const Int numPocLtFoll                       = decRps->m_numPocLtFoll;   
    3116 
    3117   Int nuhLayerId = m_pcPic-> getLayerId(); 
     3130  const Int numPocLtFoll                       = decRps->m_numPocLtFoll;
     3131
     3132  Int nuhLayerId = m_pcPic-> getLayerId();
    31183133  for ( Int i = 0 ; i <= numPocStCurrBefore - 1; i++ )
    31193134  {
    31203135    if ( refPicSetStCurrBefore[ i ] == NULL )
    31213136    {
    3122       //-  For each RefPicSetStCurrBefore[ i ], with i in the range of 0 to NumPocStCurrBefore - 1, inclusive, that is 
     3137      //-  For each RefPicSetStCurrBefore[ i ], with i in the range of 0 to NumPocStCurrBefore - 1, inclusive, that is
    31233138      //  equal to "no reference picture", a picture is generated as specified in clause 8.3.3.2 and the following applies:
    3124       TComPic* genPic = x8332GenOfOneUnavailPic( false ); 
     3139      TComPic* genPic = x8332GenOfOneUnavailPic( false );
    31253140
    31263141      //-  The value of PicOrderCntVal for the generated picture is set equal to PocStCurrBefore[ i ].
     
    31283143
    31293144      //  -  The value of PicOutputFlag for the generated picture is set equal to 0.
    3130       genPic->setPicOutputFlag( false ); 
     3145      genPic->setPicOutputFlag( false );
    31313146
    31323147      //  -  The generated picture is marked as "used for short-term reference".
     
    31373152
    31383153      //  -  The value of nuh_layer_id for the generated picture is set equal to nuh_layer_id.
    3139       genPic->setLayerId( nuhLayerId ); 
     3154      genPic->setLayerId( nuhLayerId );
    31403155
    31413156      // Insert to DPB
    3142       m_dpb->addNewPic( genPic ); 
     3157      m_dpb->addNewPic( genPic );
    31433158    }
    31443159  }
     
    31483163    if ( refPicSetStCurrAfter[ i ] == NULL )
    31493164    {
    3150       //  -  For each RefPicSetStCurrAfter[ i ], with i in the range of 0 to NumPocStCurrAfter - 1, inclusive, that is equal 
     3165      //  -  For each RefPicSetStCurrAfter[ i ], with i in the range of 0 to NumPocStCurrAfter - 1, inclusive, that is equal
    31513166      //     to "no reference picture", a picture is generated as specified in clause 8.3.3.2 and the following applies:
    3152       TComPic* genPic = x8332GenOfOneUnavailPic( false ); 
     3167      TComPic* genPic = x8332GenOfOneUnavailPic( false );
    31533168
    31543169      //  -  The value of PicOrderCntVal for the generated picture is set equal to PocStCurrAfter[ i ].
     
    31563171
    31573172      //  -  The value of PicOutputFlag for the generated picture is set equal to 0.
    3158       genPic->setPicOutputFlag( false ); 
     3173      genPic->setPicOutputFlag( false );
    31593174
    31603175      //  -  The generated picture is marked as "used for short-term reference".
     
    31653180
    31663181      //  -  The value of nuh_layer_id for the generated picture is set equal to nuh_layer_id.
    3167       genPic->setLayerId( nuhLayerId ); 
     3182      genPic->setLayerId( nuhLayerId );
    31683183
    31693184      // Insert to DPB
    3170       m_dpb->addNewPic( genPic ); 
     3185      m_dpb->addNewPic( genPic );
    31713186
    31723187    }
     
    31773192    if ( refPicSetStFoll[ i ] == NULL )
    31783193    {
    3179       //  -  For each RefPicSetStFoll[ i ], with i in the range of 0 to NumPocStFoll - 1, inclusive, that is equal to "no 
     3194      //  -  For each RefPicSetStFoll[ i ], with i in the range of 0 to NumPocStFoll - 1, inclusive, that is equal to "no
    31803195      //     reference picture", a picture is generated as specified in clause 8.3.3.2 and the following applies:
    3181       TComPic* genPic = x8332GenOfOneUnavailPic( false ); 
     3196      TComPic* genPic = x8332GenOfOneUnavailPic( false );
    31823197
    31833198      //  -  The value of PicOrderCntVal for the generated picture is set equal to PocStFoll[ i ].
     
    31853200
    31863201      //  -  The value of PicOutputFlag for the generated picture is set equal to 0.
    3187       genPic->setPicOutputFlag( false ); 
     3202      genPic->setPicOutputFlag( false );
    31883203
    31893204      //  -  The generated picture is marked as "used for short-term reference".
     
    31943209
    31953210      //  -  The value of nuh_layer_id for the generated picture is set equal to nuh_layer_id.
    3196       genPic->setLayerId( nuhLayerId ); 
     3211      genPic->setLayerId( nuhLayerId );
    31973212
    31983213      // Insert to DPB
    3199       m_dpb->addNewPic( genPic ); 
    3200     }
    3201   }
    3202 
    3203   Int maxPicOrderCntLsb = m_pcPic->getSlice(0)->getSPS()->getMaxPicOrderCntLsb(); 
     3214      m_dpb->addNewPic( genPic );
     3215    }
     3216  }
     3217
     3218  Int maxPicOrderCntLsb = m_pcPic->getSlice(0)->getSPS()->getMaxPicOrderCntLsb();
    32043219  for ( Int i = 0 ; i <= numPocLtCurr - 1; i++ )
    32053220  {
    32063221    if ( refPicSetLtCurr[ i ] == NULL )
    32073222    {
    3208       //  -  For each RefPicSetLtCurr[ i ], with i in the range of 0 to NumPocLtCurr - 1, inclusive, that is equal to "no 
     3223      //  -  For each RefPicSetLtCurr[ i ], with i in the range of 0 to NumPocLtCurr - 1, inclusive, that is equal to "no
    32093224      //     reference picture", a picture is generated as specified in clause 8.3.3.2 and the following applies:
    3210       TComPic* genPic = x8332GenOfOneUnavailPic( false ); 
     3225      TComPic* genPic = x8332GenOfOneUnavailPic( false );
    32113226
    32123227      //  -  The value of PicOrderCntVal for the generated picture is set equal to PocLtCurr[ i ].
    32133228      genPic->getSlice(0)->setPOC( pocLtCurr[ i ] );
    32143229
    3215       //  -  The value of slice_pic_order_cnt_lsb for the generated picture is inferred to be equal to ( PocLtCurr[ i ] & ( 
     3230      //  -  The value of slice_pic_order_cnt_lsb for the generated picture is inferred to be equal to ( PocLtCurr[ i ] & (
    32163231      //     MaxPicOrderCntLsb - 1 ) ).
    3217       genPic->getSlice(0)->setSlicePicOrderCntLsb( ( pocLtCurr[ i ] & ( maxPicOrderCntLsb - 1 ) ) ); 
     3232      genPic->getSlice(0)->setSlicePicOrderCntLsb( ( pocLtCurr[ i ] & ( maxPicOrderCntLsb - 1 ) ) );
    32183233
    32193234      //  -  The value of PicOutputFlag for the generated picture is set equal to 0.
    3220       genPic->setPicOutputFlag( false ); 
     3235      genPic->setPicOutputFlag( false );
    32213236
    32223237      //  -  The generated picture is marked as "used for long-term reference".
     
    32273242
    32283243      //  -  The value of nuh_layer_id for the generated picture is set equal to nuh_layer_id.
    3229       genPic->setLayerId( nuhLayerId ); 
     3244      genPic->setLayerId( nuhLayerId );
    32303245
    32313246      // Insert to DPB
    3232       m_dpb->addNewPic( genPic ); 
     3247      m_dpb->addNewPic( genPic );
    32333248    }
    32343249  }
     
    32383253    if ( refPicSetLtFoll[ i ] == NULL )
    32393254    {
    3240       //  -  For each RefPicSetLtFoll[ i ], with i in the range of 0 to NumPocLtFoll - 1, inclusive, that is equal to "no 
     3255      //  -  For each RefPicSetLtFoll[ i ], with i in the range of 0 to NumPocLtFoll - 1, inclusive, that is equal to "no
    32413256      //     reference picture", a picture is generated as specified in clause 8.3.3.2 and the following applies:
    3242       TComPic* genPic = x8332GenOfOneUnavailPic( false ); 
     3257      TComPic* genPic = x8332GenOfOneUnavailPic( false );
    32433258
    32443259      //  -  The value of PicOrderCntVal for the generated picture is set equal to PocLtFoll[ i ].
    32453260      genPic->getSlice(0)->setPOC( pocLtFoll[ i ] );
    32463261
    3247       //  -  The value of slice_pic_order_cnt_lsb for the generated picture is inferred to be equal to ( PocLtCurr[ i ] & ( 
     3262      //  -  The value of slice_pic_order_cnt_lsb for the generated picture is inferred to be equal to ( PocLtCurr[ i ] & (
    32483263      //     MaxPicOrderCntLsb - 1 ) ).
    3249       genPic->getSlice(0)->setSlicePicOrderCntLsb( ( pocLtCurr[ i ] & ( maxPicOrderCntLsb - 1 ) ) ); 
     3264      genPic->getSlice(0)->setSlicePicOrderCntLsb( ( pocLtCurr[ i ] & ( maxPicOrderCntLsb - 1 ) ) );
    32503265
    32513266      //  -  The value of PicOutputFlag for the generated picture is set equal to 0.
    3252       genPic->setPicOutputFlag( false ); 
     3267      genPic->setPicOutputFlag( false );
    32533268
    32543269      //  -  The generated picture is marked as "used for long-term reference".
     
    32593274
    32603275      //  -  The value of nuh_layer_id for the generated picture is set equal to nuh_layer_id.
    3261       genPic->setLayerId( nuhLayerId ); 
     3276      genPic->setLayerId( nuhLayerId );
    32623277
    32633278      // Insert to DPB
    3264       m_dpb->addNewPic( genPic ); 
     3279      m_dpb->addNewPic( genPic );
    32653280    }
    32663281  }
     
    32803295  std::vector<TComPic*>** refPicSetsCurr       = m_pcPic->getDecodedRps()->m_refPicSetsCurr;
    32813296
    3282   Bool hasGeneratedRefPic = false; 
    3283   for (Int j = 0; j < 3; j++ )   
    3284   {   
    3285     std::vector<TComPic*>* cSet = refPicSetsCurr[j]; 
     3297  Bool hasGeneratedRefPic = false;
     3298  for (Int j = 0; j < 3; j++ )
     3299  {
     3300    std::vector<TComPic*>* cSet = refPicSetsCurr[j];
    32863301    for (Int i = 0 ; i < cSet->size();  i++ )
    32873302    {
     
    32893304      if ((*cSet)[i]->getIsGenerated() )
    32903305      {
    3291         hasGeneratedRefPic = true; 
    3292       }
    3293     }
    3294   }
    3295   m_pcPic->setHasGeneratedRefPics( hasGeneratedRefPic ); 
     3306        hasGeneratedRefPic = true;
     3307      }
     3308    }
     3309  }
     3310  m_pcPic->setHasGeneratedRefPics( hasGeneratedRefPic );
    32963311}
    32973312
Note: See TracChangeset for help on using the changeset viewer.