Index: branches/HTM-DEV-0.3-dev0/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- branches/HTM-DEV-0.3-dev0/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 490)
+++ branches/HTM-DEV-0.3-dev0/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 491)
@@ -732,4 +732,8 @@
         cOSS<<"Frame"<<i;
         opts.addOptions()( cOSS.str(), m_GOPListMvc[k][i-1], GOPEntry() );
+        if ( i != 1 )
+        {
+          opts.opt_list.back()->opt->opt_duplicate = true; 
+        }        
       }
     }
@@ -738,5 +742,11 @@
       std::ostringstream cOSS1;
       cOSS1<<"FrameI"<<"_l"<<k;
+
       opts.addOptions()(cOSS1.str(), m_GOPListMvc[k][MAX_GOP], GOPEntry());
+      if ( k > 1 )
+      {
+        opts.opt_list.back()->opt->opt_duplicate = true; 
+      }        
+
 
       for( Int i = 1; i < MAX_GOP + 1; i++ ) 
@@ -745,4 +755,8 @@
         cOSS2<<"Frame"<<i<<"_l"<<k;
         opts.addOptions()(cOSS2.str(), m_GOPListMvc[k][i-1], GOPEntry());
+        if ( i != 1 || k > 0 )
+        {
+          opts.opt_list.back()->opt->opt_duplicate = true; 
+        }        
       }
     }
Index: branches/HTM-DEV-0.3-dev0/source/Lib/TAppCommon/program_options_lite.cpp
===================================================================
--- branches/HTM-DEV-0.3-dev0/source/Lib/TAppCommon/program_options_lite.cpp	(revision 490)
+++ branches/HTM-DEV-0.3-dev0/source/Lib/TAppCommon/program_options_lite.cpp	(revision 491)
@@ -39,5 +39,5 @@
 #include <map>
 #include "program_options_lite.h"
-
+#include  "../TLibCommon/TypeDef.h"
 using namespace std;
 
@@ -146,4 +146,7 @@
       for(Options::NamesPtrList::iterator it = opts.opt_list.begin(); it != opts.opt_list.end(); it++)
       {
+#if H_MV
+        if  ( (*it)->opt->opt_duplicate ) continue; 
+#endif
         ostringstream line(ios_base::out);
         doHelpOpt(line, **it, pad_short);
@@ -161,4 +164,8 @@
       for(Options::NamesPtrList::iterator it = opts.opt_list.begin(); it != opts.opt_list.end(); it++)
       {
+#if H_MV
+        if  ( (*it)->opt->opt_duplicate ) continue; 
+#endif
+
         ostringstream line(ios_base::out);
         line << "  ";
Index: branches/HTM-DEV-0.3-dev0/source/Lib/TAppCommon/program_options_lite.h
===================================================================
--- branches/HTM-DEV-0.3-dev0/source/Lib/TAppCommon/program_options_lite.h	(revision 490)
+++ branches/HTM-DEV-0.3-dev0/source/Lib/TAppCommon/program_options_lite.h	(revision 491)
@@ -36,4 +36,5 @@
 #include <list>
 #include <map>
+#include  "../TLibCommon/TypeDef.h"
 
 #if H_MV
@@ -41,5 +42,4 @@
 #include <errno.h>
 #include <cstring>
-
 #ifdef WIN32
 #define strdup _strdup
@@ -85,6 +85,11 @@
     struct OptionBase
     {
+#if H_MV      
+      OptionBase(const std::string& name, const std::string& desc, bool duplicate = false)
+        : opt_string(name), opt_desc(desc), opt_duplicate(duplicate)
+#else
       OptionBase(const std::string& name, const std::string& desc)
       : opt_string(name), opt_desc(desc)
+#endif
       {};
       
@@ -98,4 +103,7 @@
       std::string opt_string;
       std::string opt_desc;
+#if H_MV
+      bool        opt_duplicate; 
+#endif
     };
     
@@ -104,6 +112,11 @@
     struct Option : public OptionBase
     {
+#if H_MV
+      Option(const std::string& name, T& storage, T default_val, const std::string& desc, bool duplicate = false)
+        : OptionBase(name, desc, duplicate), opt_storage(storage), opt_default_val(default_val)
+#else
       Option(const std::string& name, T& storage, T default_val, const std::string& desc)
       : OptionBase(name, desc), opt_storage(storage), opt_default_val(default_val)
+#endif
       {}
       
@@ -374,5 +387,5 @@
           sprintf((char*) cDescriptionBuffer.c_str(),desc.c_str(),uiK,uiK);
 
-          parent.addOption(new Option<T>( cNameBuffer, (storage[uiK]), default_val, cDescriptionBuffer ));
+          parent.addOption(new Option<T>( cNameBuffer, (storage[uiK]), default_val, cDescriptionBuffer, uiK != 0 ));
         }
 
Index: branches/HTM-DEV-0.3-dev0/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- branches/HTM-DEV-0.3-dev0/source/Lib/TLibCommon/TComDataCU.cpp	(revision 490)
+++ branches/HTM-DEV-0.3-dev0/source/Lib/TLibCommon/TComDataCU.cpp	(revision 491)
@@ -3280,5 +3280,17 @@
 
   // use coldir.
+#if H_MV
+  TComPic *pColPic;  
+  if (getSlice()->getAltCollocatedIndicationFlag() )
+  {
+    pColPic = getSlice()->getPicFromRefPicSetInterLayer( getSlice()->getActiveMotionPredRefLayerId( getSlice()->getCollocatedRefLayerIdx() )); 
+  }
+  else
+  {
+    pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? 1-getSlice()->getColFromL0Flag() : 0), getSlice()->getColRefIdx());  
+  }  
+#else
   TComPic *pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? 1-getSlice()->getColFromL0Flag() : 0), getSlice()->getColRefIdx());
+#endif
   TComDataCU *pColCU = pColPic->getCU( uiCUAddr );
   if(pColCU->getPic()==0||pColCU->getPartitionSize(uiPartUnitIdx)==SIZE_NONE)
Index: branches/HTM-DEV-0.3-dev0/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- branches/HTM-DEV-0.3-dev0/source/Lib/TLibCommon/TComSlice.cpp	(revision 490)
+++ branches/HTM-DEV-0.3-dev0/source/Lib/TLibCommon/TComSlice.cpp	(revision 491)
@@ -108,4 +108,5 @@
 , m_enableTMVPFlag                ( true )
 #if H_MV
+, m_refPicSetInterLayer           ( NULL )
 , m_layerId                       (0)
 , m_viewId                        (0)
@@ -468,8 +469,4 @@
   UInt NumPocStCurr1 = 0;
   UInt NumPocLtCurr = 0;
-#if H_MV
-  Int numDirectRefLayers  = getVPS()->getNumDirectRefLayers( getLayerIdInVps() );
-  assert( numDirectRefLayers == refPicSetInterLayer.size() ); 
-#endif
   Int i;
   for(i=0; i < m_pcRPS->getNumberOfNegativePictures(); i++)
@@ -519,6 +516,8 @@
   TComPic*  rpsCurrList0[MAX_NUM_REF+1];
   TComPic*  rpsCurrList1[MAX_NUM_REF+1];
+
 #if H_MV
-  Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr + numDirectRefLayers;
+  
+  Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr + getNumActiveRefLayerPics( );
   assert( numPocTotalCurr == getNumRpsCurrTempList() );
 #else
@@ -558,4 +557,8 @@
 
   Int cIdx = 0;
+#if H_MV
+  if ( getInterRefEnabledInRPLFlag() )
+  {  
+#endif
   for ( i=0; i<NumPocStCurr0; i++, cIdx++)
   {
@@ -571,10 +574,9 @@
   }
 #if H_MV
-  for ( i=0; i<numDirectRefLayers;  i++, cIdx++)
-  {
-    if( cIdx <= MAX_NUM_REF )
-    {
-      rpsCurrList0[cIdx] = refPicSetInterLayer[i];
-    }
+  }
+  for ( i=0; i < getNumActiveRefLayerPics( );  i++, cIdx++)
+  {
+    assert( cIdx < MAX_NUM_REF );    
+    rpsCurrList0[cIdx] = refPicSetInterLayer[i];    
   }
 #endif
@@ -583,4 +585,8 @@
   {
     cIdx = 0;
+#if H_MV
+    if ( getInterRefEnabledInRPLFlag() )
+    {  
+#endif
     for ( i=0; i<NumPocStCurr1; i++, cIdx++)
     {
@@ -596,10 +602,9 @@
     }
 #if H_MV
-    for ( i=0; i<numDirectRefLayers;  i++, cIdx++)
-    {
-      if( cIdx <= MAX_NUM_REF )
-      {
-        rpsCurrList1[cIdx] = refPicSetInterLayer[i];
-      }
+    }
+    for ( i=0; i < getNumActiveRefLayerPics( );  i++, cIdx++)
+    {
+      assert( cIdx < MAX_NUM_REF );    
+      rpsCurrList1[cIdx] = refPicSetInterLayer[i];    
     }
 #endif
@@ -664,5 +669,5 @@
   }
 #if H_MV
-  numRpsCurrTempList = numRpsCurrTempList + getVPS()->getNumDirectRefLayers( getLayerIdInVps() );
+  numRpsCurrTempList = numRpsCurrTempList + getNumActiveRefLayerPics();
 #endif
   return numRpsCurrTempList;
@@ -2273,7 +2278,7 @@
   refPicSetInterLayer.clear(); 
 
-  for( Int i = 0; i < getVPS()->getNumDirectRefLayers( getLayerIdInVps() ); i++ ) 
-  {
-    Int layerIdRef = getVPS()->getRefLayerId( getLayerIdInVps(), i ); 
+  for( Int i = 0; i < getNumActiveRefLayerPics(); i++ ) 
+  {
+    Int layerIdRef = getRefPicLayerId( i ); 
     TComPic* picRef = ivPicLists->getPic( layerIdRef, getPOC() ) ; 
     assert ( picRef != 0 ); 
@@ -2283,4 +2288,6 @@
     picRef->getSlice(0)->setReferenced( true );       
 
+    // Consider to check here: 
+    // "If the current picture is a RADL picture, there shall be no entry in the RefPicSetInterLayer that is a RASL picture. "
     refPicSetInterLayer.push_back( picRef ); 
   }
@@ -2361,4 +2368,38 @@
   while( val > ( 1 << ceilLog2 ) ) ceilLog2++;
   return ceilLog2;
+}
+
+Void TComSlice::markCurrPic( TComPic* currPic )
+{
+  if ( currPic->getSlice(0)->getDiscardableFlag() )
+  {
+    currPic->getSlice(0)->setReferenced( true ) ; 
+    currPic->setIsLongTerm( false ); 
+  }
+  else
+  {
+    currPic->getSlice(0)->setReferenced( false ) ; 
+  }
+}
+
+Void TComSlice::setRefPicSetInterLayer( std::vector<TComPic*>* refPicSetInterLayer )
+{
+  m_refPicSetInterLayer = refPicSetInterLayer; 
+}
+
+TComPic* TComSlice::getPicFromRefPicSetInterLayer( Int layerId )
+{
+  assert( m_refPicSetInterLayer != 0 ); 
+  assert( (*m_refPicSetInterLayer).size() == getNumActiveRefLayerPics() ); 
+  TComPic* pcPic = NULL; 
+  for ( Int i = 0; i < getNumActiveRefLayerPics(); i++ )
+  {
+    if ((*m_refPicSetInterLayer)[ i ]->getLayerId() == layerId)
+    {
+      pcPic = (*m_refPicSetInterLayer)[ i ]; 
+    }
+  }
+  assert(pcPic != NULL); 
+  return pcPic;
 }
 
Index: branches/HTM-DEV-0.3-dev0/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- branches/HTM-DEV-0.3-dev0/source/Lib/TLibCommon/TComSlice.h	(revision 490)
+++ branches/HTM-DEV-0.3-dev0/source/Lib/TLibCommon/TComSlice.h	(revision 491)
@@ -1586,4 +1586,5 @@
   Bool       m_enableTMVPFlag;
 #if H_MV
+  std::vector<TComPic*>* m_refPicSetInterLayer; 
   Int        m_layerId; 
   Int        m_viewId;
@@ -1781,8 +1782,7 @@
   Void createAndApplyIvReferencePictureSet( TComPicLists* ivPicLists, std::vector<TComPic*>& refPicSetInterLayer );
   static Void markIvRefPicsAsShortTerm    ( std::vector<TComPic*> refPicSetInterLayer );
-  static Void markIvRefPicsAsUnused       ( TComPicLists* ivPicLists, std::vector<Int> targetDecLayerIdSet, TComVPS* vps, Int curLayerId, Int curPoc  );
-
-
-  Void xPrintRefPicList();
+  static Void markCurrPic                 ( TComPic* currPic );; 
+  static Void markIvRefPicsAsUnused       ( TComPicLists* ivPicLists, std::vector<Int> targetDecLayerIdSet, TComVPS* vps, Int curLayerId, Int curPoc );
+   Void xPrintRefPicList();
 #endif
   Bool isTemporalLayerSwitchingPoint( TComList<TComPic*>& rcListPic );
@@ -1962,5 +1962,12 @@
   return interRefEnabledInRPLFlag; 
 }
-#endif
+
+Void setRefPicSetInterLayer( std::vector<TComPic*>* m_refPicSetInterLayer );
+
+TComPic* getPicFromRefPicSetInterLayer( Int layerId );
+
+#endif
+
+
 protected:
   TComPic*  xGetRefPic  (TComList<TComPic*>& rcListPic,
@@ -1968,5 +1975,4 @@
 TComPic*  xGetLongTermRefPic(TComList<TComPic*>& rcListPic, Int poc, Bool pocHasMsb);
 #if H_MV
-  TComPic*  xGetInterLayerRefPic( std::vector<TComPic*>& rcListIlPic, Int layerId );
   Int       xCeilLog2( Int val );
 #endif
Index: branches/HTM-DEV-0.3-dev0/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- branches/HTM-DEV-0.3-dev0/source/Lib/TLibDecoder/TDecTop.cpp	(revision 490)
+++ branches/HTM-DEV-0.3-dev0/source/Lib/TLibDecoder/TDecTop.cpp	(revision 491)
@@ -518,4 +518,5 @@
 #if H_MV 
   TComSlice::markIvRefPicsAsShortTerm( m_refPicSetInterLayer );  
+  TComSlice::markCurrPic( pcPic ); 
   TComSlice::markIvRefPicsAsUnused   ( m_ivPicLists, targetDecLayerIdSet, m_parameterSetManagerDecoder.getActiveVPS(), m_layerId, poc ); 
 #endif
@@ -673,4 +674,5 @@
 
 #if H_MV
+  m_apcSlicePilot->setRefPicSetInterLayer( & m_refPicSetInterLayer ); 
   m_apcSlicePilot->setLayerId( nalu.m_layerId );
 #endif
Index: branches/HTM-DEV-0.3-dev0/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- branches/HTM-DEV-0.3-dev0/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 490)
+++ branches/HTM-DEV-0.3-dev0/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 491)
@@ -498,4 +498,5 @@
     pcSlice->setSliceIdx(0);
 #if H_MV
+    pcSlice->setRefPicSetInterLayer ( &m_refPicSetInterLayer ); 
     pcPic  ->setLayerId     ( getLayerId()   );
     pcPic  ->setViewId      ( getViewId()    );    
@@ -2061,7 +2062,8 @@
 
       pcPic->setReconMark   ( true );
-#if H_MV
+#if H_MV      
       TComSlice::markIvRefPicsAsShortTerm( m_refPicSetInterLayer );  
       std::vector<Int> temp; 
+      TComSlice::markCurrPic( pcPic ); 
       TComSlice::markIvRefPicsAsUnused   ( m_ivPicLists, temp, pcPic->getSlice(0)->getVPS(), m_layerId, pcPic->getPOC() ); 
 #endif
