Index: /branches/SHM-2.0-dev/source/App/TAppDecoder/TAppDecTop.cpp
===================================================================
--- /branches/SHM-2.0-dev/source/App/TAppDecoder/TAppDecTop.cpp	(revision 186)
+++ /branches/SHM-2.0-dev/source/App/TAppDecoder/TAppDecTop.cpp	(revision 187)
@@ -560,9 +560,9 @@
       if ( m_pchReconFile )
       {
+#if SYNTAX_OUTPUT && ILP_DECODED_PICTURE
+        m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec() );
+#else
         const Window &conf = pcPic->getConformanceWindow();
         const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
-#if SYNTAX_OUTPUT && ILP_DECODED_PICTURE
-      m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec() );
-#else
         m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
                                        conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
Index: /branches/SHM-2.0-dev/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- /branches/SHM-2.0-dev/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 186)
+++ /branches/SHM-2.0-dev/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 187)
@@ -66,4 +66,7 @@
 TAppEncCfg::TAppEncCfg()
 : m_pBitstreamFile()
+#if AVC_BASE
+, m_avcBaseLayerFlag(0)
+#endif
 , m_pColumnWidth()
 , m_pRowHeight()
@@ -423,5 +426,5 @@
 #endif
 #if AVC_BASE
-  ("AvcBase",                 m_avcBaseLayerFlag,     0, "AVC_BASElayer_flag")
+  ("AvcBase,-avc",            m_avcBaseLayerFlag,     0, "avc_base_layer_flag")
   ("InputBLFile,-ibl",        cfg_BLInputFile,     string(""), "Base layer rec YUV input file name")
 #if AVC_SYNTAX
@@ -430,5 +433,5 @@
 #endif
 #if REF_IDX_FRAMEWORK
-  ("EnableElRapB,-use-rap-b",  m_elRapSliceBEnabled, 0, "Set ILP over base-layer I picture to B picture (default is P picture_")
+  ("EnableElRapB,-use-rap-b",  m_elRapSliceBEnabled, 0, "Set ILP over base-layer I picture to B picture (default is P picture)")
 #endif  
 #else  
@@ -741,11 +744,4 @@
   ;
   
-#if AVC_BASE
-  if( m_avcBaseLayerFlag )
-  {
-    *cfg_InputFile[0] = cfg_BLInputFile;
-  }
-#endif
-
   for(Int i=1; i<MAX_GOP+1; i++) {
     std::ostringstream cOSS;
@@ -773,4 +769,10 @@
   /* convert std::string to c string for compatability */
 #if SVC_EXTENSION
+#if AVC_BASE
+  if( m_avcBaseLayerFlag )
+  {
+    *cfg_InputFile[0] = cfg_BLInputFile;
+  }
+#endif
   m_pBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str());
 #if AVC_SYNTAX
@@ -1827,5 +1829,9 @@
   {
     printf("=== Layer %d settings === \n", layer);
+#if AVC_SYNTAX
+    m_acLayerCfg[layer].xPrintParameter( layer );
+#else
     m_acLayerCfg[layer].xPrintParameter();
+#endif
     printf("\n");
   }
Index: /branches/SHM-2.0-dev/source/App/TAppEncoder/TAppEncLayerCfg.cpp
===================================================================
--- /branches/SHM-2.0-dev/source/App/TAppEncoder/TAppEncLayerCfg.cpp	(revision 186)
+++ /branches/SHM-2.0-dev/source/App/TAppEncoder/TAppEncLayerCfg.cpp	(revision 187)
@@ -116,10 +116,17 @@
 }
 
+#if AVC_SYNTAX
+Void TAppEncLayerCfg::xPrintParameter( UInt layerId )
+#else
 Void TAppEncLayerCfg::xPrintParameter()
+#endif
 {
   printf("Input File                    : %s\n", m_cInputFile.c_str()  );
   printf("Reconstruction File           : %s\n", m_cReconFile.c_str()  );
 #if AVC_SYNTAX
-  printf("Base layer input file         : %s\n", m_cAppEncCfg->getBLSyntaxFile() );
+  if( layerId == 0 )
+  {
+    printf("Base layer syntax file        : %s\n", m_cAppEncCfg->getBLSyntaxFile() );
+  }
 #endif
   printf("Real     Format               : %dx%d %dHz\n", m_iSourceWidth - m_confLeft - m_confRight, m_iSourceHeight - m_confTop - m_confBottom, m_iFrameRate );
Index: /branches/SHM-2.0-dev/source/App/TAppEncoder/TAppEncLayerCfg.h
===================================================================
--- /branches/SHM-2.0-dev/source/App/TAppEncoder/TAppEncLayerCfg.h	(revision 186)
+++ /branches/SHM-2.0-dev/source/App/TAppEncoder/TAppEncLayerCfg.h	(revision 187)
@@ -69,5 +69,9 @@
   bool  parseCfg  ( const string& cfgFileName );              ///< parse layer configuration file to fill member variables
 
+#if AVC_SYNTAX
+  Void  xPrintParameter( UInt layerId );
+#else
   Void  xPrintParameter();
+#endif
   Bool  xCheckParameter();
 
Index: /branches/SHM-2.0-dev/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- /branches/SHM-2.0-dev/source/Lib/TLibCommon/TComSlice.cpp	(revision 186)
+++ /branches/SHM-2.0-dev/source/Lib/TLibCommon/TComSlice.cpp	(revision 187)
@@ -461,8 +461,12 @@
 
 #if REF_IDX_FRAMEWORK
+#if ZERO_NUM_DIRECT_LAYERS
+  if( m_layerId == 0 || ( m_layerId > 0 && ( m_activeNumILRRefIdx == 0 || !((getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP) && (getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA)) ) ) )
+#else
   if ((getLayerId() == 0) || 
       ((getSPS()->getLayerId()) &&  !((getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP) &&
        (getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA)) )
      )
+#endif
   {
 #endif
@@ -516,5 +520,9 @@
   //inter-layer reference picture
 #if REF_IDX_MFM
+#if ZERO_NUM_DIRECT_LAYERS
+  if( m_layerId > 0 && m_activeNumILRRefIdx > 0 )
+#else
   if (getLayerId())
+#endif
   {
     if(!(getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) && getSPS()->getMFMEnabledFlag())
Index: /branches/SHM-2.0-dev/source/Lib/TLibCommon/TComUpsampleFilter.cpp
===================================================================
--- /branches/SHM-2.0-dev/source/Lib/TLibCommon/TComUpsampleFilter.cpp	(revision 186)
+++ /branches/SHM-2.0-dev/source/Lib/TLibCommon/TComUpsampleFilter.cpp	(revision 187)
@@ -437,5 +437,5 @@
 #if SCALED_REF_LAYER_OFFSETS
       // Only increase the x position of reference upsample picture when within the window
-      // "-2" to ensure that pointer doesn't go beyond the boundeary rightEndL-1
+      // "-2" to ensure that pointer doesn't go beyond the boundary rightEndL-1
       if( (i >= leftStartL) && (i <= rightEndL-2) )
       {
@@ -605,5 +605,5 @@
 #if SCALED_REF_LAYER_OFFSETS
       // Only increase the x position of reference upsample picture when within the window
-      // "-2" to ensure that pointer doesn't go beyond the boundeary rightEndC-1
+      // "-2" to ensure that pointer doesn't go beyond the boundary rightEndC-1
       if( (i >= leftStartC) && (i <= rightEndC-2) )
       {
Index: /branches/SHM-2.0-dev/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /branches/SHM-2.0-dev/source/Lib/TLibCommon/TypeDef.h	(revision 186)
+++ /branches/SHM-2.0-dev/source/Lib/TLibCommon/TypeDef.h	(revision 187)
@@ -90,4 +90,7 @@
 #define REF_IDX_MFM                      1      ///< L0336: motion vector mapping of inter-layer reference picture
 #define JCTVC_M0458_INTERLAYER_RPS_SIG   1      ///< implementation of JCTVC-L0178 (currently only one reference layer is supported )
+#if JCTVC_M0458_INTERLAYER_RPS_SIG
+#define ZERO_NUM_DIRECT_LAYERS           1      ///< support of zero direct reference layers
+#endif
 #else
 #define INTRA_BL                         1      ///< inter-layer texture prediction
Index: /branches/SHM-2.0-dev/source/Lib/TLibDecoder/TDecCu.cpp
===================================================================
--- /branches/SHM-2.0-dev/source/Lib/TLibDecoder/TDecCu.cpp	(revision 186)
+++ /branches/SHM-2.0-dev/source/Lib/TLibDecoder/TDecCu.cpp	(revision 187)
@@ -370,5 +370,5 @@
   m_pcEntropyDecoder->decodePredInfo( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth]);
 #endif
-  
+
   // Coefficient decoding
   Bool bCodeDQP = getdQPFlag();
Index: /branches/SHM-2.0-dev/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- /branches/SHM-2.0-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 186)
+++ /branches/SHM-2.0-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 187)
@@ -1268,5 +1268,9 @@
   if( vps->getNumDirectRefLayers( m_layerId ) <= 0 )
   {
+#if ZERO_NUM_DIRECT_LAYERS
+    return (TDecTop *)getLayerDec( 0 );
+#else
     return NULL;
+#endif
   }
 
@@ -1276,6 +1280,5 @@
   assert( vps->getMaxOneActiveRefLayerFlag() == 1 );
 #endif 
-
-
+  
   return (TDecTop *)getLayerDec( vps->getRefLayerId( m_layerId, 0 ) );
 }
Index: /branches/SHM-2.0-dev/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- /branches/SHM-2.0-dev/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 186)
+++ /branches/SHM-2.0-dev/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 187)
@@ -556,4 +556,11 @@
       pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_CRA);
     }
+#if ZERO_NUM_DIRECT_LAYERS
+    if( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() == 0 && pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA )
+    {
+      pcSlice->setSliceType(I_SLICE);
+    }
+    else
+#endif
     if( m_layerId > 0 && !m_pcEncTop->getElRapSliceTypeB() )
     {
@@ -657,5 +664,9 @@
 
 #if REF_IDX_FRAMEWORK
+#if ZERO_NUM_DIRECT_LAYERS
+    if( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() )
+#else
     if(m_layerId > 0)
+#endif
     {
 #if JCTVC_M0458_INTERLAYER_RPS_SIG
@@ -690,5 +701,9 @@
 
 #if SVC_EXTENSION      
+#if ZERO_NUM_DIRECT_LAYERS
+    if( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() )
+#else
     if(m_layerId > 0)
+#endif
     {
 #if !IDR_ALIGNMENT
@@ -723,5 +738,9 @@
     //  Set reference list
 #if REF_IDX_FRAMEWORK
+#if ZERO_NUM_DIRECT_LAYERS
+    if(m_layerId ==  0 || ( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() == 0 ) )
+#else
     if(m_layerId ==  0)
+#endif
     {
       pcSlice->setRefPicList( rcListPic);
@@ -731,5 +750,9 @@
 #endif
 #if REF_IDX_FRAMEWORK
+#if ZERO_NUM_DIRECT_LAYERS
+    if( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() )
+#else
     if(m_layerId > 0)
+#endif
     {
       m_pcEncTop->setILRPic(pcPic);
Index: /branches/SHM-2.0-dev/source/Lib/TLibEncoder/TEncTop.cpp
===================================================================
--- /branches/SHM-2.0-dev/source/Lib/TLibEncoder/TEncTop.cpp	(revision 186)
+++ /branches/SHM-2.0-dev/source/Lib/TLibEncoder/TEncTop.cpp	(revision 187)
@@ -1193,5 +1193,9 @@
   if( m_ppcTEncTop[m_layerId]->getNumDirectRefLayers() <= 0 )
   {
+#if ZERO_NUM_DIRECT_LAYERS
+    return (TEncTop *)getLayerEnc( 0 );
+#else
     return NULL;
+#endif
   }
 
