Index: branches/HTM-DEV-0.3-dev0/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- branches/HTM-DEV-0.3-dev0/source/Lib/TLibCommon/TComSlice.h	(revision 492)
+++ branches/HTM-DEV-0.3-dev0/source/Lib/TLibCommon/TComSlice.h	(revision 493)
@@ -871,5 +871,5 @@
 #endif
 #if H_MV
-    ,m_tileBoundariesAlignedFlag(false)
+    ,m_tileBoundariesAlignedFlag(true)
 #endif
   {}
Index: branches/HTM-DEV-0.3-dev0/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- branches/HTM-DEV-0.3-dev0/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 492)
+++ branches/HTM-DEV-0.3-dev0/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 493)
@@ -1054,6 +1054,4 @@
     }
 
-    pcSlice->setActiveMotionPredRefLayers( );
-
     if( vps->getNumSamplePredRefLayers( layerIdInVps ) > 0  &&  pcSlice->getNumActiveRefLayerPics() > 0 )
     {
Index: branches/HTM-DEV-0.3-dev0/source/Lib/TLibEncoder/TEncCfg.h
===================================================================
--- branches/HTM-DEV-0.3-dev0/source/Lib/TLibEncoder/TEncCfg.h	(revision 492)
+++ branches/HTM-DEV-0.3-dev0/source/Lib/TLibEncoder/TEncCfg.h	(revision 493)
@@ -74,7 +74,8 @@
   Int m_refIdc[MAX_NUM_REF_PICS+1];
 #if H_MV
-  Int m_numInterViewRefPics;
-  Int m_interViewRefs    [MAX_NUM_REF_PICS];
-  Int m_interViewRefPosL[2][MAX_NUM_REF_PICS];  
+  Int m_numActiveRefLayerPics;
+  Int m_interLayerPredLayerIdc [MAX_NUM_REF_PICS];
+  Int m_interViewRefPosL[2]    [MAX_NUM_REF_PICS];  
+  Int m_collocatedRefLayerIdx; 
 #endif
   GOPEntry()
@@ -93,5 +94,6 @@
   , m_numRefIdc(0)
 #if H_MV
-  , m_numInterViewRefPics(0)
+  , m_numActiveRefLayerPics(0)
+  , m_collocatedRefLayerIdx(-1)
 #endif
   {
@@ -100,5 +102,5 @@
     ::memset( m_refIdc,        0, sizeof(m_refIdc) );
 #if H_MV
-    ::memset( m_interViewRefs,   0, sizeof(m_interViewRefs) );
+    ::memset( m_interLayerPredLayerIdc,   0, sizeof(m_interLayerPredLayerIdc) );
     ::memset( m_interViewRefPosL[0], -1, sizeof(m_interViewRefPosL[0]) );
     ::memset( m_interViewRefPosL[1], -1, sizeof(m_interViewRefPosL[1]) );
Index: branches/HTM-DEV-0.3-dev0/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- branches/HTM-DEV-0.3-dev0/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 492)
+++ branches/HTM-DEV-0.3-dev0/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 493)
@@ -655,8 +655,54 @@
     refPicListModification->setRefPicListModificationFlagL1(0);
 #if H_MV
+
+    if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > 0 )
+    {
+      pcSlice->setDiscardableFlag           ( false );     
+    }    
+
+    TComVPS*           vps = pcSlice->getVPS(); 
+    Int       layerIdInVps = vps    ->getLayerIdInVps( getLayerId()); 
+    Int numDirectRefLayers = vps    ->getNumDirectRefLayers( layerIdInVps ); 
+    GOPEntry gopEntry      = m_pcCfg->getGOPEntry( (pcSlice->getRapPicFlag() && getLayerId() > 0) ? MAX_GOP : iGOPid );     
+    
+    if ( getLayerId() > 0 && numDirectRefLayers > 0 )
+    {         
+      pcSlice->setInterLayerPredEnabledFlag ( gopEntry.m_numActiveRefLayerPics > 0 );     
+      if ( pcSlice->getInterLayerPredEnabledFlag() && numDirectRefLayers > 1 )
+      {
+        if ( !vps->getMaxOneActiveRefLayerFlag() )
+        {    
+          pcSlice->setNumInterLayerRefPicsMinus1( gopEntry.m_numActiveRefLayerPics - 1 ); 
+        }
+        for (Int i = 0; i < gopEntry.m_numActiveRefLayerPics; i++ )
+        {
+          pcSlice->setInterLayerPredLayerIdc( i, gopEntry.m_interLayerPredLayerIdc[ i ] ); 
+        }
+      }
+    }
+    assert( pcSlice->getNumActiveRefLayerPics() == gopEntry.m_numActiveRefLayerPics ); 
+    
+    if ( vps->getNumSamplePredRefLayers( layerIdInVps ) > 0 && pcSlice->getNumActiveRefLayerPics() > 0)
+    {
+      pcSlice->setInterLayerSamplePredOnlyFlag( gopEntry.m_numRefPics == 0 ); 
+    }    
+
     pcSlice->createAndApplyIvReferencePictureSet( m_ivPicLists, m_refPicSetInterLayer ); 
-    pcSlice->setNumRefIdx(REF_PIC_LIST_0,min(m_pcCfg->getGOPEntry( (pcSlice->getRapPicFlag() && getLayerId() > 0) ? MAX_GOP : iGOPid ).m_numRefPicsActive,( pcSlice->getRPS()->getNumberOfPictures() + (Int) m_refPicSetInterLayer.size() ) ) );
-    pcSlice->setNumRefIdx(REF_PIC_LIST_1,min(m_pcCfg->getGOPEntry( (pcSlice->getRapPicFlag() && getLayerId() > 0) ? MAX_GOP : iGOPid ).m_numRefPicsActive,( pcSlice->getRPS()->getNumberOfPictures() + (Int) m_refPicSetInterLayer.size() ) ) );
-    xSetRefPicListModificationsMvc( pcSlice, pocCurr, iGOPid );    
+    pcSlice->setNumRefIdx(REF_PIC_LIST_0,min(gopEntry.m_numRefPicsActive,( pcSlice->getRPS()->getNumberOfPictures() + (Int) m_refPicSetInterLayer.size() ) ) );
+    pcSlice->setNumRefIdx(REF_PIC_LIST_1,min(gopEntry.m_numRefPicsActive,( pcSlice->getRPS()->getNumberOfPictures() + (Int) m_refPicSetInterLayer.size() ) ) );
+    xSetRefPicListModificationsMvc( pcSlice, iGOPid );    
+
+    pcSlice->setActiveMotionPredRefLayers( );
+
+    if ( getLayerId() > 0 && pcSlice->getNumActiveMotionPredRefLayers() > 0 && pcSlice->getEnableTMVPFlag() && 
+        ( pcSlice->getSliceType() == B_SLICE || pcSlice->getSliceType() == P_SLICE ))
+    {
+      pcSlice->setAltCollocatedIndicationFlag( gopEntry.m_collocatedRefLayerIdx >= 0 );
+      if ( pcSlice->getNumActiveRefLayerPics() && pcSlice->getNumActiveMotionPredRefLayers() > 0 )
+      {
+        pcSlice->setCollocatedRefLayerIdx( gopEntry.m_collocatedRefLayerIdx );
+      }
+    }
+
 #else
     pcSlice->setNumRefIdx(REF_PIC_LIST_0,min(m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive,pcSlice->getRPS()->getNumberOfPictures()));
@@ -2896,5 +2942,5 @@
 #endif
 #if H_MV
-Void TEncGOP::xSetRefPicListModificationsMvc( TComSlice* pcSlice, UInt uiPOCCurr, UInt iGOPid )
+Void TEncGOP::xSetRefPicListModificationsMvc( TComSlice* pcSlice, UInt iGOPid )
 { 
   TComVPS* vps = pcSlice->getVPS(); 
@@ -2919,5 +2965,5 @@
     Int numModifications = 0;
     
-    for( Int k = 0; k < ge.m_numInterViewRefPics; k++ ) 
+    for( Int k = 0; k < ge.m_numActiveRefLayerPics; k++ ) 
     {
       numModifications +=  ( ge.m_interViewRefPosL[li][k] >= 0 ) ? 1 : 0; 
@@ -2931,5 +2977,5 @@
     if( (maxRefListSize > 1) && (numModifications > 0) )
     {
-      for( Int k = 0; k < ge.m_numInterViewRefPics; k++ )
+      for( Int k = 0; k < ge.m_numActiveRefLayerPics; k++ )
       {
         if( ge.m_interViewRefPosL[li][k] >= 0 )
@@ -2940,5 +2986,5 @@
           {            
             Int refLayer  = vps->getLayerIdInVps( vps->getRefLayerId( layer, idx ) );          
-            if( ( layer + ge.m_interViewRefs[ k ]) == refLayer )
+            if( ( layer + ge.m_interLayerPredLayerIdc[ k ]) == refLayer )
             {
               tempList[ targetIdx ] = orgIdx;              
Index: branches/HTM-DEV-0.3-dev0/source/Lib/TLibEncoder/TEncGOP.h
===================================================================
--- branches/HTM-DEV-0.3-dev0/source/Lib/TLibEncoder/TEncGOP.h	(revision 492)
+++ branches/HTM-DEV-0.3-dev0/source/Lib/TLibEncoder/TEncGOP.h	(revision 493)
@@ -221,5 +221,5 @@
 #endif
 #if H_MV
-   Void  xSetRefPicListModificationsMvc( TComSlice* pcSlice, UInt uiPOCCurr, UInt iGOPid );
+   Void  xSetRefPicListModificationsMvc( TComSlice* pcSlice, UInt iGOPid );
 #endif
 #if L0386_DB_METRIC
Index: branches/HTM-DEV-0.3-dev0/source/Lib/TLibEncoder/TEncTop.cpp
===================================================================
--- branches/HTM-DEV-0.3-dev0/source/Lib/TLibEncoder/TEncTop.cpp	(revision 492)
+++ branches/HTM-DEV-0.3-dev0/source/Lib/TLibEncoder/TEncTop.cpp	(revision 493)
@@ -731,4 +731,7 @@
   m_cPPS.setWPBiPred( m_useWeightedBiPred );
   m_cPPS.setOutputFlagPresentFlag( false );
+#if H_MV
+  m_cPPS.setNumExtraSliceHeaderBits( 1 ); 
+#endif
   m_cPPS.setSignHideFlag(getSignHideFlag());
 #if L0386_DB_METRIC
