Index: trunk/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 547)
+++ trunk/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 588)
@@ -167,20 +167,20 @@
 }
 
-#if M0043_LAYERS_PRESENT_SEI
-SEILayersPresent* TEncGOP::xCreateSEILayersPresent ()
+#if LAYERS_NOT_PRESENT_SEI
+SEILayersNotPresent* TEncGOP::xCreateSEILayersNotPresent ()
 {
   UInt i = 0;
-  SEILayersPresent *seiLayersPresent = new SEILayersPresent(); 
-  seiLayersPresent->m_activeVpsId = m_pcCfg->getVPS()->getVPSId(); 
-  seiLayersPresent->m_vpsMaxLayers = m_pcCfg->getVPS()->getMaxLayers();
-  for ( ; i < seiLayersPresent->m_vpsMaxLayers; i++)
-  {
-    seiLayersPresent->m_layerPresentFlag[i] = true; 
+  SEILayersNotPresent *seiLayersNotPresent = new SEILayersNotPresent(); 
+  seiLayersNotPresent->m_activeVpsId = m_pcCfg->getVPS()->getVPSId(); 
+  seiLayersNotPresent->m_vpsMaxLayers = m_pcCfg->getVPS()->getMaxLayers();
+  for ( ; i < seiLayersNotPresent->m_vpsMaxLayers; i++)
+  {
+    seiLayersNotPresent->m_layerNotPresentFlag[i] = true; 
   }
   for ( ; i < MAX_LAYERS; i++)
   {
-    seiLayersPresent->m_layerPresentFlag[i] = false; 
-  }
-  return seiLayersPresent;
+    seiLayersNotPresent->m_layerNotPresentFlag[i] = false; 
+  }
+  return seiLayersNotPresent;
 }
 #endif
@@ -363,8 +363,8 @@
   }
 
-#if M0043_LAYERS_PRESENT_SEI
-  if(m_pcCfg->getLayersPresentSEIEnabled())
-  {
-    SEILayersPresent *sei = xCreateSEILayersPresent ();
+#if LAYERS_NOT_PRESENT_SEI
+  if(m_pcCfg->getLayersNotPresentSEIEnabled())
+  {
+    SEILayersNotPresent *sei = xCreateSEILayersNotPresent ();
     m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps); 
@@ -690,22 +690,5 @@
       pcSlice->setActiveNumILRRefIdx(0);
       pcSlice->setInterLayerPredEnabledFlag(false);
-#if M0457_COL_PICTURE_SIGNALING
       pcSlice->setMFMEnabledFlag(false);
-#if !REMOVE_COL_PICTURE_SIGNALING
-      pcSlice->setAltColIndicationFlag(false);
-#endif
-#endif
-    }
-#endif
-
-#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
-    pcSlice->setNumSamplePredRefLayers( m_pcEncTop->getNumSamplePredRefLayers() );
-    pcSlice->setInterLayerSamplePredOnlyFlag( 0 );
-    if( pcSlice->getNumSamplePredRefLayers() > 0 && pcSlice->getActiveNumILRRefIdx() > 0 )
-    {
-      if( m_pcEncTop->getIlSampleOnlyPred() > 0 )
-      {
-        pcSlice->setInterLayerSamplePredOnlyFlag( true );
-      }
     }
 #endif
@@ -1159,5 +1142,4 @@
     if( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() )
     {
-#if RESTR_CHK
 #if POC_RESET_FLAG
       if ( pocCurr > 0          && pcSlice->isRADL() && pcPic->getSlice(0)->getBaseColPic(pcPic->getSlice(0)->getInterLayerPredLayerIdc(0))->getSlice(0)->isRASL())
@@ -1166,13 +1148,7 @@
 #endif
       {
-#if JCTVC_M0458_INTERLAYER_RPS_SIG
         pcSlice->setActiveNumILRRefIdx(0);
         pcSlice->setInterLayerPredEnabledFlag(0);
-#else
-        pcSlice->setNumILRRefIdx(0);
-#endif
-      }
-#endif
-#if JCTVC_M0458_INTERLAYER_RPS_SIG
+      }
       if( pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA )
       {
@@ -1185,16 +1161,4 @@
         pcSlice->setNumRefIdx(REF_PIC_LIST_1, pcSlice->getNumRefIdx(REF_PIC_LIST_1)+pcSlice->getActiveNumILRRefIdx());
       }
-#else
-      if( pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA )
-      {
-        pcSlice->setNumRefIdx(REF_PIC_LIST_0, pcSlice->getNumILRRefIdx());
-        pcSlice->setNumRefIdx(REF_PIC_LIST_1, pcSlice->getNumILRRefIdx());
-      }
-      else
-      {
-        pcSlice->setNumRefIdx(REF_PIC_LIST_0, pcSlice->getNumRefIdx(REF_PIC_LIST_0)+pcSlice->getNumILRRefIdx());
-        pcSlice->setNumRefIdx(REF_PIC_LIST_1, pcSlice->getNumRefIdx(REF_PIC_LIST_1)+pcSlice->getNumILRRefIdx());
-      }
-#endif
     }
 #endif //SVC_EXTENSION
@@ -1205,9 +1169,5 @@
 
 #if SVC_EXTENSION
-#if M0457_COL_PICTURE_SIGNALING && !REMOVE_COL_PICTURE_SIGNALING
-    if ( pcSlice->getSliceType() == B_SLICE && !(pcSlice->getActiveNumILRRefIdx() > 0 && m_pcEncTop->getNumMotionPredRefLayers() > 0) )
-#else
     if( pcSlice->getSliceType() == B_SLICE )
-#endif
     {
       pcSlice->setColFromL0Flag(1-uiColDir);
@@ -1224,14 +1184,7 @@
       pcSlice->setILRPic( m_pcEncTop->getIlpList() );
 #if REF_IDX_MFM
-#if M0457_COL_PICTURE_SIGNALING
       if( pcSlice->getMFMEnabledFlag() )
-#else
-      if( pcSlice->getSPS()->getMFMEnabledFlag() )
-#endif
       {
         pcSlice->setRefPOCListILP(m_pcEncTop->getIlpList(), pcSlice->getBaseColPic());
-#if M0457_COL_PICTURE_SIGNALING && !REMOVE_COL_PICTURE_SIGNALING
-        pcSlice->setMotionPredIlp(getMotionPredIlp(pcSlice));
-#endif
       }
 #else
@@ -1243,13 +1196,5 @@
 
 #if REF_IDX_MFM
-#if M0457_COL_PICTURE_SIGNALING
-#if REMOVE_COL_PICTURE_SIGNALING
       if( pcSlice->getMFMEnabledFlag() )
-#else
-      if( pcSlice->getMFMEnabledFlag() && !(pcSlice->getActiveNumILRRefIdx() > 0 && m_pcEncTop->getNumMotionPredRefLayers() > 0) )
-#endif
-#else
-      if( pcSlice->getSPS()->getMFMEnabledFlag() )
-#endif
       {
         Bool found         = false;
@@ -1308,9 +1253,5 @@
     }
 
-#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
-    if (pcSlice->getSliceType() == B_SLICE && m_pcEncTop->getIlSampleOnlyPred() == 0)
-#else
     if (pcSlice->getSliceType() == B_SLICE)
-#endif
     {
 #if !SVC_EXTENSION
@@ -1617,5 +1558,8 @@
 #if O0194_WEIGHTED_PREDICTION_CGS
       // Calculate for the base layer to be used in EL as Inter layer reference
-      m_pcSliceEncoder->estimateILWpParam( pcSlice );
+      if( m_pcEncTop->getInterLayerWeightedPredFlag() )
+      {
+        m_pcSliceEncoder->estimateILWpParam( pcSlice );
+      }
 #endif
 #if AVC_SYNTAX
@@ -1756,8 +1700,10 @@
       // The following code also calculates the VPS VUI offset
 #endif
+#if !P0125_REVERT_VPS_EXTN_OFFSET_TO_RESERVED
 #if VPS_EXTN_OFFSET_CALC
       OutputNALUnit tempNalu(NAL_UNIT_VPS, 0, 0        ); // The value of nuh_layer_id of VPS NAL unit shall be equal to 0.
       m_pcEntropyCoder->setBitstream(&tempNalu.m_Bitstream);
       m_pcEntropyCoder->encodeVPS(m_pcEncTop->getVPS());  // Use to calculate the VPS extension offset
+#endif
 #endif
       m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
@@ -2068,5 +2014,5 @@
             startCUAddrSliceSegmentIdx++;
           }
-#if SVC_EXTENSION && M0457_COL_PICTURE_SIGNALING
+#if SVC_EXTENSION
           pcSlice->setNumMotionPredRefLayers(m_pcEncTop->getNumMotionPredRefLayers());
 #endif
@@ -3111,19 +3057,21 @@
 
 #if SVC_EXTENSION
-#if ADAPTIVE_QP_SELECTION
-  printf("POC %4d LId: %1d TId: %1d ( %c-SLICE, nQP %d QP %d ) %10d bits",
+#if ADAPTIVE_QP_SELECTION  
+  printf("POC %4d LId: %1d TId: %1d ( %c-SLICE %s, nQP %d QP %d ) %10d bits",
          pcSlice->getPOC(),
          pcSlice->getLayerId(),
          pcSlice->getTLayer(),
          c,
+         NaluToStr( pcSlice->getNalUnitType() ).data(),
          pcSlice->getSliceQpBase(),
          pcSlice->getSliceQp(),
          uibits );
 #else
-  printf("POC %4d LId: %1d TId: %1d ( %c-SLICE, QP %d ) %10d bits",
+  printf("POC %4d LId: %1d TId: %1d ( %c-SLICE %s, QP %d ) %10d bits",
          pcSlice->getPOC()-pcSlice->getLastIDR(),
          pcSlice->getLayerId(),
          pcSlice->getTLayer(),
          c,
+         NaluToStr( pcSlice->getNalUnitType() ).data().
          pcSlice->getSliceQp(),
          uibits );
@@ -3750,33 +3698,3 @@
   free(rowSAD);
 }
-
-#if M0457_COL_PICTURE_SIGNALING && !REMOVE_COL_PICTURE_SIGNALING
-TComPic* TEncGOP::getMotionPredIlp(TComSlice* pcSlice)
-{
-  TComPic* ilpPic = NULL;
-  Int activeMotionPredReflayerIdx = 0;
-
-  for( Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ )
-  {
-    UInt refLayerIdc = pcSlice->getInterLayerPredLayerIdc(i);
-    if( m_pcEncTop->getMotionPredEnabledFlag( pcSlice->getVPS()->getRefLayerId( m_layerId, refLayerIdc ) ) )
-    {
-      if (activeMotionPredReflayerIdx == pcSlice->getColRefLayerIdx())
-      {
-        ilpPic = m_pcEncTop->getIlpList()[refLayerIdc];
-        break;
-      }
-      else
-      {
-        activeMotionPredReflayerIdx++;
-      }
-    }
-  }
-
-  assert(ilpPic != NULL);
-
-  return ilpPic;
-}
-#endif
-
 //! \}
