Changeset 1356 in 3DVCSoftware for trunk/source/Lib/TLibDecoder/TDecTop.cpp


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

Merged 15.1-dev0-NICT@1355.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.