Index: branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibCommon/CommonDef.h
===================================================================
--- branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibCommon/CommonDef.h	(revision 647)
+++ branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibCommon/CommonDef.h	(revision 648)
@@ -187,5 +187,4 @@
 }
 
-#if H_MV5
 template <typename T>
 __inline T gCeilLog2( T val )
@@ -196,5 +195,4 @@
   return ceilLog2;
 }
-#endif
 
 #define RemoveBitIncrement( exp ) ( exp >> ( g_bitDepthY - 8 ) )
Index: branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibCommon/TComDataCU.cpp	(revision 647)
+++ branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibCommon/TComDataCU.cpp	(revision 648)
@@ -4804,21 +4804,5 @@
 
   // use coldir.
-#if H_MV5
   TComPic *pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? 1-getSlice()->getColFromL0Flag() : 0), getSlice()->getColRefIdx());
-#else
-#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
-#endif
   TComDataCU *pColCU = pColPic->getCU( uiCUAddr );
   if(pColCU->getPic()==0||pColCU->getPartitionSize(uiPartUnitIdx)==SIZE_NONE)
Index: branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibCommon/TComSlice.cpp	(revision 647)
+++ branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibCommon/TComSlice.cpp	(revision 648)
@@ -101,32 +101,16 @@
 , m_enableTMVPFlag                ( true )
 #if H_MV
-#if H_MV5
 , m_refPicSetInterLayer0           ( NULL )
 , m_refPicSetInterLayer1           ( NULL )
-#else
-, m_refPicSetInterLayer           ( NULL )
-#endif
 , m_layerId                       (0)
 , m_viewId                        (0)
-#if H_MV5
 , m_viewIndex                     (0)
-#endif
 #if H_3D
-#if !H_MV5
-, m_viewIndex                     (0)
-#endif
 , m_isDepth                       (false)
 #endif
-#if H_MV5
 , m_pocResetFlag                  (false)
-#endif
 , m_discardableFlag               (false)
 , m_interLayerPredEnabledFlag     (false)
 , m_numInterLayerRefPicsMinus1    (0)
-#if !H_MV5
-, m_interLayerSamplePredOnlyFlag  (false)
-, m_altCollocatedIndicationFlag   (0)
-, m_collocatedRefLayerIdx         (0)
-#endif
 #if H_3D_IC
 , m_bApplyIC                      ( false )
@@ -164,9 +148,5 @@
   for (Int i = 0; i < MAX_NUM_LAYERS; i++ )
   {
-#if H_MV5
    m_interLayerPredLayerIdc[ i ] = i;
-#else
-   m_interLayerPredLayerIdc[ i ] = 0;
-#endif
   }
 #endif
@@ -387,5 +367,4 @@
   }
 }
-#if H_MV5
 #if !H_MV
 #if FIX1071
@@ -730,256 +709,20 @@
 }
 #endif
-#else
+Int TComSlice::getNumRpsCurrTempList()
+{
+  Int numRpsCurrTempList = 0;
+
+  if (m_eSliceType == I_SLICE) 
+  {
+    return 0;
+  }
+  for(UInt i=0; i < m_pcRPS->getNumberOfNegativePictures()+ m_pcRPS->getNumberOfPositivePictures() + m_pcRPS->getNumberOfLongtermPictures(); i++)
+  {
+    if(m_pcRPS->getUsed(i))
+    {
+      numRpsCurrTempList++;
+    }
+  }
 #if H_MV
-Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& refPicSetInterLayer , Bool checkNumPocTotalCurr)
-#else
-#if FIX1071
-Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr )
-#else
-Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic )
-#endif
-#endif
-{
-#if FIX1071
-  if (!checkNumPocTotalCurr)
-#endif
-  {
-    if (m_eSliceType == I_SLICE)
-    {
-      ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList));
-      ::memset( m_aiNumRefIdx,   0, sizeof ( m_aiNumRefIdx ));
-      
-      return;
-    }
-    
-#if !H_MV
-    m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0);
-    m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1);
-#endif
-  }
-
-  TComPic*  pcRefPic= NULL;
-  TComPic*  RefPicSetStCurr0[16];
-  TComPic*  RefPicSetStCurr1[16];
-  TComPic*  RefPicSetLtCurr[16];
-  UInt NumPocStCurr0 = 0;
-  UInt NumPocStCurr1 = 0;
-  UInt NumPocLtCurr = 0;
-  Int i;
-
-  for(i=0; i < m_pcRPS->getNumberOfNegativePictures(); i++)
-  {
-    if(m_pcRPS->getUsed(i))
-    {
-      pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pcRPS->getDeltaPOC(i));
-      pcRefPic->setIsLongTerm(0);
-      pcRefPic->getPicYuvRec()->extendPicBorder();
-      RefPicSetStCurr0[NumPocStCurr0] = pcRefPic;
-      NumPocStCurr0++;
-      pcRefPic->setCheckLTMSBPresent(false);  
-    }
-  }
-  
-  for(; i < m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures(); i++)
-  {
-    if(m_pcRPS->getUsed(i))
-    {
-      pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pcRPS->getDeltaPOC(i));
-      pcRefPic->setIsLongTerm(0);
-      pcRefPic->getPicYuvRec()->extendPicBorder();
-      RefPicSetStCurr1[NumPocStCurr1] = pcRefPic;
-      NumPocStCurr1++;
-      pcRefPic->setCheckLTMSBPresent(false);  
-    }
-  }
-  
-  for(i = m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()+m_pcRPS->getNumberOfLongtermPictures()-1; i > m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()-1 ; i--)
-  {
-    if(m_pcRPS->getUsed(i))
-    {
-      pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i));
-      pcRefPic->setIsLongTerm(1);
-      pcRefPic->getPicYuvRec()->extendPicBorder();
-      RefPicSetLtCurr[NumPocLtCurr] = pcRefPic;
-      NumPocLtCurr++;
-    }
-    if(pcRefPic==NULL) 
-    {
-      pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i));
-    }
-    pcRefPic->setCheckLTMSBPresent(m_pcRPS->getCheckLTMSBPresent(i));  
-  }
-
-  // ref_pic_list_init
-  TComPic*  rpsCurrList0[MAX_NUM_REF+1];
-  TComPic*  rpsCurrList1[MAX_NUM_REF+1];
-#if H_MV
-  Int numPocInterCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr; 
-  assert( numPocInterCurr == 0 || getInterRefEnabledInRPLFlag() ); 
-  Int numPocTotalCurr = numPocInterCurr + getNumActiveRefLayerPics( );
-  assert( numPocTotalCurr == getNumRpsCurrTempList() );
-#else
-  Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr;
-#endif
-#if FIX1071
-  if (checkNumPocTotalCurr)
-  {
-    // The variable NumPocTotalCurr is derived as specified in subclause 7.4.7.2. It is a requirement of bitstream conformance that the following applies to the value of NumPocTotalCurr:
-#if H_MV
-    // ??If nuh_layer_id is equal to 0 and the current picture is a BLA picture or a CRA picture, the value of NumPocTotalCurr shall be equal to 0.
-    // ??Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0.
-    if ( getRapPicFlag() && m_layerId == 0 )
-#else
-    // ??If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0.
-    // ??Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0.
-    if (getRapPicFlag())
-#endif
-    {
-      assert(numPocTotalCurr == 0);
-    }
-
-    if (m_eSliceType == I_SLICE)
-    {
-      ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList));
-      ::memset( m_aiNumRefIdx,   0, sizeof ( m_aiNumRefIdx ));
-      
-      return;
-    }
-    
-    assert(numPocTotalCurr > 0);
-    
-    m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0);
-    m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1);
-  }
-#endif
-
-  Int cIdx = 0;
-#if H_MV
-  if ( getInterRefEnabledInRPLFlag() )
-  {  
-#endif
-  for ( i=0; i<NumPocStCurr0; i++, cIdx++)
-  {
-    rpsCurrList0[cIdx] = RefPicSetStCurr0[i];
-  }
-  for ( i=0; i<NumPocStCurr1; i++, cIdx++)
-  {
-    rpsCurrList0[cIdx] = RefPicSetStCurr1[i];
-  }
-  for ( i=0; i<NumPocLtCurr;  i++, cIdx++)
-  {
-    rpsCurrList0[cIdx] = RefPicSetLtCurr[i];
-  }
-#if H_MV
-  }
-  for ( i=0; i < getNumActiveRefLayerPics( );  i++, cIdx++)
-    {
-    assert( cIdx < MAX_NUM_REF );    
-      rpsCurrList0[cIdx] = refPicSetInterLayer[i];
-    }
-#endif
-  assert(cIdx == numPocTotalCurr);
-
-  if (m_eSliceType==B_SLICE)
-  {
-    cIdx = 0;
-#if H_MV
-    if ( getInterRefEnabledInRPLFlag() )
-    {  
-#endif
-    for ( i=0; i<NumPocStCurr1; i++, cIdx++)
-    {
-      rpsCurrList1[cIdx] = RefPicSetStCurr1[i];
-    }
-    for ( i=0; i<NumPocStCurr0; i++, cIdx++)
-    {
-      rpsCurrList1[cIdx] = RefPicSetStCurr0[i];
-    }
-    for ( i=0; i<NumPocLtCurr;  i++, cIdx++)
-    {
-      rpsCurrList1[cIdx] = RefPicSetLtCurr[i];
-    }
-#if H_MV
-    }
-    for ( i=0; i < getNumActiveRefLayerPics( );  i++, cIdx++)
-      {
-      assert( cIdx < MAX_NUM_REF );    
-        rpsCurrList1[cIdx] = refPicSetInterLayer[i];
-      }
-#endif
-    assert(cIdx == numPocTotalCurr);
-  }
-
-  ::memset(m_bIsUsedAsLongTerm, 0, sizeof(m_bIsUsedAsLongTerm));
-
-#if H_MV
-  Int numPocSt = NumPocStCurr0 + NumPocStCurr1; 
-  assert(  getInterRefEnabledInRPLFlag( ) || numPocSt == 0 );
-
-  for (Int li = 0; li < 2; li++)
-  {
-    if ( m_eSliceType == P_SLICE && li == 1 )
-    {
-      m_aiNumRefIdx[1] = 0;
-      ::memset( m_apcRefPicList[1], 0, sizeof(m_apcRefPicList[1]));
-    } 
-    else
-    {
-      for (Int rIdx = 0; rIdx <= (m_aiNumRefIdx[ li ] - 1 ); rIdx ++)
-      { 
-        Bool listModified             =                m_RefPicListModification.getRefPicListModificationFlagL( li ); 
-        Int orgIdx                    = listModified ? m_RefPicListModification.getRefPicSetIdxL(li, rIdx) : (rIdx % numPocTotalCurr); 
-
-        m_apcRefPicList    [li][rIdx] = ( li == 0 )  ? rpsCurrList0[ orgIdx  ] : rpsCurrList1[ orgIdx  ];
-        m_bIsUsedAsLongTerm[li][rIdx] = ( orgIdx >= numPocSt ) ; 
-      }
-    }
-  }
-#else
-  for (Int rIdx = 0; rIdx < m_aiNumRefIdx[0]; rIdx ++)
-  {
-    cIdx = m_RefPicListModification.getRefPicListModificationFlagL0() ? m_RefPicListModification.getRefPicSetIdxL0(rIdx) : rIdx % numPocTotalCurr;
-    assert(cIdx >= 0 && cIdx < numPocTotalCurr);
-    m_apcRefPicList[0][rIdx] = rpsCurrList0[ cIdx ];
-    m_bIsUsedAsLongTerm[0][rIdx] = ( cIdx >= NumPocStCurr0 + NumPocStCurr1 );
-  }
-  if ( m_eSliceType != B_SLICE )
-  {
-    m_aiNumRefIdx[1] = 0;
-    ::memset( m_apcRefPicList[1], 0, sizeof(m_apcRefPicList[1]));
-  }
-  else
-  {
-    for (Int rIdx = 0; rIdx < m_aiNumRefIdx[1]; rIdx ++)
-    {
-      cIdx = m_RefPicListModification.getRefPicListModificationFlagL1() ? m_RefPicListModification.getRefPicSetIdxL1(rIdx) : rIdx % numPocTotalCurr;
-      assert(cIdx >= 0 && cIdx < numPocTotalCurr);
-      m_apcRefPicList[1][rIdx] = rpsCurrList1[ cIdx ];
-      m_bIsUsedAsLongTerm[1][rIdx] = ( cIdx >= NumPocStCurr0 + NumPocStCurr1 );
-    }
-  }
-#endif
-}
-
-#endif
-Int TComSlice::getNumRpsCurrTempList()
-{
-  Int numRpsCurrTempList = 0;
-
-  if (m_eSliceType == I_SLICE) 
-  {
-    return 0;
-  }
-  for(UInt i=0; i < m_pcRPS->getNumberOfNegativePictures()+ m_pcRPS->getNumberOfPositivePictures() + m_pcRPS->getNumberOfLongtermPictures(); i++)
-  {
-    if(m_pcRPS->getUsed(i))
-    {
-      numRpsCurrTempList++;
-    }
-  }
-#if H_MV
-#if !H_MV5
-  assert( ( numRpsCurrTempList == 0 ) || getInterRefEnabledInRPLFlag() ); 
-#endif
   numRpsCurrTempList = numRpsCurrTempList + getNumActiveRefLayerPics();
 #endif
@@ -1295,7 +1038,5 @@
 #if H_MV
   // Additional slice header syntax elements 
-#if H_MV5
   m_pocResetFlag               = pSrc->m_pocResetFlag; 
-#endif
   m_discardableFlag            = pSrc->m_discardableFlag; 
   m_interLayerPredEnabledFlag  = pSrc->m_interLayerPredEnabledFlag; 
@@ -1306,15 +1047,4 @@
     m_interLayerPredLayerIdc[ layer ] = pSrc->m_interLayerPredLayerIdc[ layer ]; 
   }
-#if !H_MV5
-  m_interLayerSamplePredOnlyFlag = pSrc->m_interLayerSamplePredOnlyFlag;
-  m_altCollocatedIndicationFlag  = pSrc->m_altCollocatedIndicationFlag ;   
-  m_collocatedRefLayerIdx        = pSrc->m_collocatedRefLayerIdx       ;
-  m_numActiveMotionPredRefLayers = pSrc->m_numActiveMotionPredRefLayers;
-
-  for (Int layer = 0; layer < MAX_NUM_LAYER_IDS; layer++)
-  {    
-    m_interLayerPredLayerIdc[layer] = pSrc->m_interLayerPredLayerIdc[layer];
-  }
-#endif
 #endif
 #if H_3D_IC
@@ -1781,10 +1511,6 @@
 : m_VPSId                     (  0)
 , m_uiMaxTLayers              (  1)
-#if H_MV5
 #if H_MV
 , m_uiMaxLayersMinus1         (  0)
-#else
-, m_uiMaxLayers               (  1)
-#endif
 #else
 , m_uiMaxLayers               (  1)
@@ -1800,8 +1526,6 @@
 , m_hrdOpSetIdx               (NULL)
 , m_cprmsPresentFlag          (NULL)
-#if H_MV5
 #if H_MV
 , m_vpsVUI                 (  NULL )
-#endif
 #endif
 {
@@ -1848,16 +1572,10 @@
 
   m_avcBaseLayerFlag = false;
-#if H_MV5
   m_vpsVuiOffset     = 0; 
-#endif
   m_splittingFlag    = false;
   
   for( Int i = 0; i < MAX_NUM_SCALABILITY_TYPES; i++ )
   {
-#if H_MV5
     m_scalabilityMaskFlag[i] = false;
-#else
-    m_scalabilityMask[i] = false;
-#endif
     m_dimensionIdLen [i]  = -1; 
   }
@@ -1885,12 +1603,8 @@
     m_layerIdInNuh      [i] = ( i == 0 ) ? 0 : -1; 
     m_numDirectRefLayers[i] = 0; 
-#if H_MV5
     m_maxTidIlRefPicPlus1[i] = 7;
     m_vpsRepFormatIdx    [i] = 0; 
     m_repFormat          [i] = NULL; 
     m_viewIdVal          [i] = 0; 
-#else
-    m_maxTidIlRefPicPlus1[i] = -1; 
-#endif
 
 #if H_3D
@@ -1935,7 +1649,5 @@
 #endif
   }
-#if H_MV5
   m_vpsVUI = new TComVPSVUI; 
-#endif
 #if H_3D
   for( Int i = 0; i < MAX_NUM_LAYERS; i++ )
@@ -1963,5 +1675,4 @@
   if( m_hrdOpSetIdx      != NULL )     delete[] m_hrdOpSetIdx;
   if( m_cprmsPresentFlag != NULL )     delete[] m_cprmsPresentFlag;
-#if H_MV5
 #if H_MV
   if ( m_vpsVUI          != NULL )     delete m_vpsVUI; 
@@ -1983,23 +1694,4 @@
 #endif
   }
-#endif
-#else
-#if H_3D_DIM_DLT
-  for( Int i = 0; i < MAX_NUM_LAYERS; i++ )
-  {
-    if ( m_iDepthValue2Idx[i] != 0 ) 
-    {
-       xFree( m_iDepthValue2Idx[i] );
-       m_iDepthValue2Idx[i] = 0; 
-    }
-
-    if ( m_iIdx2DepthValue[i] != 0 ) 
-    {
-      xFree( m_iIdx2DepthValue[i] );
-      m_iIdx2DepthValue[i] = 0; 
-
-    }
-  }
-#endif
 #endif
 }
@@ -2072,9 +1764,5 @@
 Bool TComVPS::checkVPSExtensionSyntax()
 {
-#if H_MV5
   for( Int layer = 1; layer <= getMaxLayersMinus1(); layer++ )
-#else
-  for( Int layer = 1; layer < getMaxLayers(); layer++ )
-#endif
   {
     // check layer_id_in_nuh constraint
@@ -2092,17 +1780,9 @@
 {
   assert( scalType >= 0 && scalType <= MAX_NUM_SCALABILITY_TYPES ); 
-#if H_MV5
   assert( scalType == MAX_NUM_SCALABILITY_TYPES || getScalabilityMaskFlag( scalType ) );
-#else
-  assert( scalType == MAX_NUM_SCALABILITY_TYPES || getScalabilityMask( scalType ) );
-#endif
   Int scalIdx = 0; 
   for( Int curScalType = 0; curScalType < scalType; curScalType++ )
   {
-#if H_MV5
     scalIdx += ( getScalabilityMaskFlag( curScalType ) ? 1 : 0 );
-#else
-    scalIdx += ( getScalabilityMask( curScalType ) ? 1 : 0 );
-#endif
 
   }
@@ -2110,5 +1790,4 @@
   return scalIdx; 
 }
-#if H_MV5
 Void TComVPS::setScalabilityMaskFlag( UInt val )
 {
@@ -2118,14 +1797,5 @@
   }
 }
-#else
-Void TComVPS::setScalabilityMask( UInt val )
-{
-  for ( Int scalType = 0; scalType < MAX_NUM_SCALABILITY_TYPES; scalType++ ) 
-    setScalabilityMask( scalType, ( val & (1 << scalType ) ) != 0 );
-}
-
-#endif
-
-#if H_MV5
+
 Void TComVPS::setRefLayers()
 {
@@ -2176,124 +1846,4 @@
 }
 #endif // H_3D
-#else
-Void TComVPS::setRefLayers()
-{
-  for( Int i = 0; i < MAX_NUM_LAYERS; i++ ) 
-  { 
-    m_numSamplePredRefLayers[ i ] = 0;
-    m_numMotionPredRefLayers[ i ] = 0;
-    m_numDirectRefLayers[ i ] = 0; 
-    for( Int j = 0; j < MAX_NUM_LAYERS; j++ ) {
-      m_samplePredEnabledFlag[ i ][ j ] = 0;
-      m_motionPredEnabledFlag[ i ][ j ] = 0;
-      m_refLayerId[ i ][ j ] = 0;
-      m_samplePredRefLayerId[ i ][ j ] = 0;
-      m_motionPredRefLayerId[ i ][ j ] = 0;
-    }
-  }
-
-  for( Int i = 1; i  <= getMaxLayers()- 1; i++ )
-  {
-    for( Int j = 0; j < i; j++ )
-    {
-      if( getDirectDependencyFlag(i,j) )
-      {
-        m_refLayerId[ i ][m_numDirectRefLayers[ i ]++ ] = getLayerIdInNuh( j );
-
-        m_samplePredEnabledFlag [ i ][ j ]  = ( (   getDirectDependencyType( i , j ) + 1 ) & 1 ) == 1;
-        m_numSamplePredRefLayers[ i ]      += m_samplePredEnabledFlag [ i ][ j ] ? 1 : 0; 
-        m_motionPredEnabledFlag [ i ][ j ]  = ( ( ( getDirectDependencyType( i , j ) + 1 ) & 2 ) >> 1 ) == 1;
-        m_numMotionPredRefLayers[ i ]      += m_motionPredEnabledFlag  [ i][ j ] ? 1 : 0; 
-      }
-    }
-  }
-
-  for( Int i = 1, mIdx = 0, sIdx = 0; i <= getMaxLayers()- 1; i++ )
-  {    
-    for( Int j = 0 ; j < i; j++ )
-    {
-      if( m_motionPredEnabledFlag[ i ][ j ] )
-      {
-        m_motionPredRefLayerId[ i ][ mIdx++ ] = getLayerIdInNuh( j );
-      }
-      
-      if( m_samplePredEnabledFlag[ i ][ j ] )
-      {
-        m_samplePredRefLayerId[ i ][ sIdx++ ] = getLayerIdInNuh( j );
-      }
-    }
-  }
-}
-
-Int TComVPS::getRefLayerId( Int layerIdInVps, Int idx )
-{
-  assert( idx >= 0 && idx < m_numDirectRefLayers[layerIdInVps] );     
-  Int layerIdInNuh = m_refLayerId[ layerIdInVps ][ idx ];    
-  assert ( layerIdInNuh >= 0 ); 
-  return layerIdInNuh;
-}
-
-Int TComVPS::getScalabilityId( Int layerIdInVps, ScalabilityType scalType )
-{
-  return getScalabilityMask( scalType ) ? getDimensionId( layerIdInVps, scalTypeToScalIdx( scalType ) ) : 0;
-}
-
-#if H_3D
-Void TComVPS::initViewIndex()
-{
-  Int viewIdList   [ MAX_NUM_LAYERS ]; // ed. should be changed to MAX_VIEW_ID
-  Int viewIndexList[ MAX_NUM_LAYERS ]; 
-  Int numViewIds = 0; 
-
-  for ( Int i = 0 ; i  <  m_uiMaxLayers; i++ )
-  {     
-    Int currViewId = getViewId( i ); 
-
-    Bool viewIdInListFlag = false; 
-    for ( Int j = 0; j < numViewIds; j ++ )
-    {
-      viewIdInListFlag  = viewIdInListFlag || ( currViewId  == viewIdList[ j ]  );
-    }
-
-    if ( !viewIdInListFlag ) 
-    {
-      viewIdList   [ numViewIds ] = currViewId;
-      viewIndexList[ currViewId ] = numViewIds;
-
-      numViewIds++;
-    }  
-
-    m_viewIndex[ i ] = viewIndexList[ currViewId ]; 
-  }
-}
-
-Int TComVPS::getLayerIdInNuh( Int viewIndex, Bool depthFlag )
-{
-  Int foundlayerId = -1; 
-
-  for (Int layer = 0 ; layer < m_uiMaxLayers; layer++ )
-  {
-    if( ( getViewIndex( layer ) == viewIndex ) && ( getDepthId( layer ) == ( depthFlag ? 1 : 0 ) )  )
-    {
-      foundlayerId = layer; 
-      break; 
-    }
-  }
-  assert( foundlayerId != -1 ); 
-
-  return getLayerIdInNuh( foundlayerId );
-}
-
-#endif // H_3D
-
-Int TComVPS::xCeilLog2( Int val )
-{
-  assert( val > 0 ); 
-  Int ceilLog2 = 0;
-  while( val > ( 1 << ceilLog2 ) ) ceilLog2++;
-  return ceilLog2;
-}
-
-#endif // H_MV5
 
 
@@ -2336,5 +1886,4 @@
   return numLayersInIdList;
 }
-#if H_MV5
 Int TComVPS::getNumViews()
 {
@@ -2366,5 +1915,4 @@
   return dependentFlag;
 }
-#endif
 #endif // H_MV
 
@@ -2417,5 +1965,4 @@
 , m_vuiParameters             ()
 #if H_MV
-#if H_MV5
 , m_pcVPS                     ( NULL )
 , m_spsInferScalingListFlag   ( false )
@@ -2423,8 +1970,4 @@
 , m_updateRepFormatFlag       ( true ) 
 , m_interViewMvVertConstraintFlag (false)
-#else
-, m_interViewMvVertConstraintFlag (false)
-, m_numIlpRestrictedRefLayers ( 0 )
-#endif
 #endif
 #if H_3D
@@ -2441,14 +1984,4 @@
   ::memset(m_ltRefPicPocLsbSps, 0, sizeof(m_ltRefPicPocLsbSps));
   ::memset(m_usedByCurrPicLtSPSFlag, 0, sizeof(m_usedByCurrPicLtSPSFlag));
-#if !H_MV5
-#if H_MV
-  for (Int i = 0; i < MAX_NUM_LAYERS; i++ )
-  {
-    m_minSpatialSegmentOffsetPlus1[ i ] = 0;
-    m_ctuBasedOffsetEnabledFlag   [ i ] = false;
-    m_minHorizontalCtuOffsetPlus1 [ i ] = 0;
-  }
-#endif
-#endif
 }
 
@@ -2603,10 +2136,8 @@
 , m_listsModificationPresentFlag(  0)
 , m_numExtraSliceHeaderBits(0)
-#if H_MV5
 #if H_MV
 , m_ppsInferScalingListFlag(false)
 , m_ppsScalingListRefLayerId(0)
 #endif
-#endif
 {
   m_scalingList = new TComScalingList;
@@ -2628,5 +2159,4 @@
 }
 
-#if H_MV5
 #if H_MV
 Void TComSPS::inferRepFormat( TComVPS* vps, Int layerIdCurr )
@@ -2679,5 +2209,4 @@
   }
 }
-#endif
 #endif
 #if H_3D
@@ -2950,5 +2479,4 @@
 
 #if H_MV
-#if H_MV5
 Void TComSlice::createInterLayerReferencePictureSet( TComPicLists* ivPicLists, std::vector<TComPic*>& refPicSetInterLayer0, std::vector<TComPic*>& refPicSetInterLayer1 )
 {
@@ -2982,27 +2510,5 @@
   }
 }
-#else
-Void TComSlice::createAndApplyIvReferencePictureSet( TComPicLists* ivPicLists, std::vector<TComPic*>& refPicSetInterLayer )
-{
-  refPicSetInterLayer.clear(); 
-
-  for( Int i = 0; i < getNumActiveRefLayerPics(); i++ ) 
-  {
-    Int layerIdRef = getRefPicLayerId( i ); 
-    TComPic* picRef = ivPicLists->getPic( layerIdRef, getPOC() ) ; 
-    assert ( picRef != 0 ); 
-
-    picRef->getPicYuvRec()->extendPicBorder(); 
-    picRef->setIsLongTerm( true );        
-    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 ); 
-  }
-}
-#endif
-
-#if H_MV5
+
 Void TComSlice::markIvRefPicsAsShortTerm( std::vector<TComPic*> refPicSetInterLayer0, std::vector<TComPic*> refPicSetInterLayer1 )
 {
@@ -3019,15 +2525,4 @@
 
 }
-#else
-Void TComSlice::markIvRefPicsAsShortTerm( std::vector<TComPic*> refPicSetInterLayer )
-{
-  // Mark as shortterm 
-  for ( Int i = 0; i < refPicSetInterLayer.size(); i++ ) 
-  {
-    refPicSetInterLayer[i]->setIsLongTerm( false ); 
-  }
-}
-
-#endif
 Void TComSlice::markIvRefPicsAsUnused( TComPicLists* ivPicLists, std::vector<Int> targetDecLayerIdSet, TComVPS* vps, Int curLayerId, Int curPoc )
 {
@@ -3035,9 +2530,5 @@
   if (targetDecLayerIdSet.size() == 0 )    
   {
-#if H_MV5
     for ( Int layerIdInVps = 0; layerIdInVps <= vps->getMaxLayersMinus1(); layerIdInVps++ )
-#else
-    for ( Int layerIdInVps = 0; layerIdInVps < vps->getMaxLayers(); layerIdInVps++ )
-#endif
     {
       targetDecLayerIdSet.push_back( vps->getLayerIdInNuh( layerIdInVps ) ); 
@@ -3068,14 +2559,7 @@
           if ( vps->nuhLayerIdIncluded( targetDecLayerIdSet[ j ] ) )
           {
-#if H_MV5
             for( Int k = 0; k < vpsSlice->getNumDirectRefLayers( targetDecLayerIdSet[ j ] ); k++ )
             {
               if ( targetDecLayerIdSet[ i ] == vpsSlice->getRefLayerId( targetDecLayerIdSet[ j ],  k  ) )
-#else
-            Int targetDecLayerIdinVPS = vpsSlice->getLayerIdInVps( targetDecLayerIdSet[ j ] ); 
-            for( Int k = 0; k < vpsSlice->getNumDirectRefLayers( targetDecLayerIdinVPS ); k++ )
-            {
-              if ( targetDecLayerIdSet[ i ] == vpsSlice->getRefLayerId( targetDecLayerIdinVPS,  k  ) )
-#endif
               {
                 remainingInterLayerReferencesFlag = true;
@@ -3093,9 +2577,5 @@
 }
 
-#if H_MV5
 Void TComSlice::printRefPicList()
-#else
-Void TComSlice::xPrintRefPicList()
-#endif
 {  
   for ( Int li = 0; li < 2; li++)
@@ -3110,13 +2590,4 @@
   }
 }
-#if !H_MV5
-Int TComSlice::xCeilLog2( Int val )
-{
-  assert( val > 0 ); 
-  Int ceilLog2 = 0;
-  while( val > ( 1 << ceilLog2 ) ) ceilLog2++;
-  return ceilLog2;
-}
-#endif
 
 Void TComSlice::markCurrPic( TComPic* currPic )
@@ -3133,5 +2604,4 @@
 }
 
-#if H_MV5
 Void TComSlice::setRefPicSetInterLayer( std::vector<TComPic*>* refPicSetInterLayer0, std::vector<TComPic*>* refPicSetInterLayer1 )
 {
@@ -3158,31 +2628,8 @@
   return pcPic;
 }
-#else
-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;
-}
-#endif
 Int TComSlice::getNumActiveRefLayerPics()
 {
   Int numActiveRefLayerPics; 
 
-#if H_MV5
   if( getLayerId() == 0 || getVPS()->getNumDirectRefLayers( getLayerId() ) ==  0 )
   {
@@ -3198,11 +2645,4 @@
   }
   else if( getVPS()->getMaxOneActiveRefLayerFlag() || getVPS()->getNumDirectRefLayers( getLayerId() ) == 1 )
-#else
-  if( getLayerId() == 0 || getVPS()->getNumDirectRefLayers( getLayerIdInVps() ) ==  0 || !getInterLayerPredEnabledFlag() )
-  {
-    numActiveRefLayerPics = 0; 
-  }
-  else if( getVPS()->getMaxOneActiveRefLayerFlag() || getVPS()->getNumDirectRefLayers( getLayerIdInVps() ) == 1 )
-#endif
   {
     numActiveRefLayerPics = 1; 
@@ -3217,41 +2657,7 @@
 Int TComSlice::getRefPicLayerId( Int i )
 {
-#if H_MV5
   return getVPS()->getRefLayerId( getLayerId(), getInterLayerPredLayerIdc( i ) );
-#else
-  return getVPS()->getRefLayerId( getLayerIdInVps(), getInterLayerPredLayerIdc( i ) );
-#endif
-}
-
-#if !H_MV5
-Void TComSlice::setActiveMotionPredRefLayers()
-{
-  Int j = 0; 
-  for( Int i = 0; i < getNumActiveRefLayerPics(); i++)
-  {
-    if( getVPS()->getMotionPredEnabledFlag( getLayerIdInVps(), getInterLayerPredLayerIdc( i ))  )
-    {
-      m_activeMotionPredRefLayerId[ j++ ] = getVPS()->getRefLayerId( getLayerIdInVps(), i ); 
-    }
-  }
-  m_numActiveMotionPredRefLayers = j;
-
-  // Consider incorporating bitstream conformance tests on derived variables here.
-}
-
-Bool TComSlice::getInterRefEnabledInRPLFlag()
-{
-  Bool interRefEnabledInRPLFlag; 
-  if ( getVPS()->getNumSamplePredRefLayers( getLayerIdInVps() ) > 0 && getNumActiveRefLayerPics() > 0 )
-  {
-    interRefEnabledInRPLFlag = !getInterLayerSamplePredOnlyFlag(); 
-  }
-  else
-  {
-    interRefEnabledInRPLFlag = 1; 
-  }
-  return interRefEnabledInRPLFlag;
-}
-#endif
+}
+
 #if H_3D_ARP
 Void TComSlice::setARPStepNum()                                  
@@ -3531,5 +2937,4 @@
 }
 
-#if H_MV5
 #if H_MV
 Void TComScalingList::inferFrom( TComScalingList* srcScLi )
@@ -3545,5 +2950,4 @@
   }
 }
-#endif
 #endif
 /** initialization process of quantization matrix array
@@ -3636,5 +3040,4 @@
 , m_ppsMap(MAX_NUM_PPS)
 , m_activeVPSId(-1)
-#if H_MV5
 #if !H_MV
 , m_activeSPSId(-1)
@@ -3649,9 +3052,4 @@
   }
 #endif
-#else
-, m_activeSPSId(-1)
-, m_activePPSId(-1)
-{
-#endif
 }
 
@@ -3663,5 +3061,4 @@
 //! activate a SPS from a active parameter sets SEI message
 //! \returns true, if activation is successful
-#if H_MV5
 #if H_MV
 Bool ParameterSetManager::activateSPSWithSEI(Int spsId, Int layerId )
@@ -3669,7 +3066,4 @@
 Bool ParameterSetManager::activateSPSWithSEI(Int spsId)
 #endif
-#else
-Bool ParameterSetManager::activateSPSWithSEI(Int spsId)
-#endif
 {
   TComSPS *sps = m_spsMap.getPS(spsId);
@@ -3680,7 +3074,4 @@
     {
       m_activeVPSId = vpsId;
-#if !H_MV5
-      m_activeSPSId = spsId;
-#else
 #if H_MV
       m_activeSPSId[ layerId ] = spsId;
@@ -3688,5 +3079,4 @@
       m_activeSPSId = spsId;
 #endif
-#endif
       return true;
     }
@@ -3705,5 +3095,4 @@
 //! activate a PPS and depending on isIDR parameter also SPS and VPS
 //! \returns true, if activation is successful
-#if H_MV5
 #if H_MV
 Bool ParameterSetManager::activatePPS(Int ppsId, Bool isIRAP, Int layerId )
@@ -3742,35 +3131,4 @@
         m_activeSPSId[ layerId ] = spsId;
 #else
-        m_activePPSId = ppsId;
-        m_activeVPSId = vpsId;
-        m_activeSPSId = spsId;
-#endif
-#else
-Bool ParameterSetManager::activatePPS(Int ppsId, Bool isIRAP)
-{
-  TComPPS *pps = m_ppsMap.getPS(ppsId);
-  if (pps)
-  {
-    Int spsId = pps->getSPSId();
-#if H_MV
-    // active parameter sets per layer should be used here
-#else
-    if (!isIRAP && (spsId != m_activeSPSId))
-    {
-      printf("Warning: tried to activate PPS referring to a inactive SPS at non-IRAP.");
-      return false;
-    }
-#endif
-    TComSPS *sps = m_spsMap.getPS(spsId);
-    if (sps)
-    {
-      Int vpsId = sps->getVPSId();
-      if (!isIRAP && (vpsId != m_activeVPSId))
-      {
-        printf("Warning: tried to activate PPS referring to a inactive VPS at non-IRAP.");
-        return false;
-      }
-      if (m_vpsMap.getPS(vpsId))
-      {
         m_activePPSId = ppsId;
         m_activeVPSId = vpsId;
@@ -3828,5 +3186,4 @@
 //! \}
 
-#if H_MV5
 #if H_MV
 TComVPSVUI::TComVPSVUI()
@@ -3861,3 +3218,2 @@
 }
 #endif
-#endif
Index: branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibCommon/TComSlice.h	(revision 647)
+++ branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibCommon/TComSlice.h	(revision 648)
@@ -169,8 +169,6 @@
   Void     processRefMatrix               (UInt sizeId, UInt listId , UInt refListId );
   Bool     xParseScalingList              (Char* pchFile);
-#if H_MV5
 #if H_MV
   Void     inferFrom                      ( TComScalingList* srcScLi );
-#endif
 #endif
 
@@ -407,5 +405,4 @@
 };
 
-#if H_MV5
 #if H_MV
 class TComVPSVUI
@@ -502,5 +499,4 @@
 };
 #endif
-#endif
 
 class TComVPS
@@ -510,10 +506,6 @@
   UInt        m_uiMaxTLayers;
 
-#if H_MV5
 #if H_MV
   UInt        m_uiMaxLayersMinus1;
-#else
-  UInt        m_uiMaxLayers;
-#endif
 #else
   UInt        m_uiMaxLayers;
@@ -551,29 +543,17 @@
   /// VPS EXTENSION SYNTAX ELEMENTS
   Bool        m_avcBaseLayerFlag;
-#if H_MV5
   Int         m_vpsVuiOffset;
-#endif
   Bool        m_splittingFlag;
-#if H_MV5
   Bool        m_scalabilityMaskFlag          [MAX_NUM_SCALABILITY_TYPES];
-#else
-  Bool        m_scalabilityMask          [MAX_NUM_SCALABILITY_TYPES];
-#endif
   Int         m_dimensionIdLen           [MAX_NUM_SCALABILITY_TYPES];
   Bool        m_vpsNuhLayerIdPresentFlag;
   Int         m_layerIdInNuh             [MAX_NUM_LAYER_IDS];
   Int         m_dimensionId              [MAX_NUM_LAYER_IDS][MAX_NUM_SCALABILITY_TYPES];  
-#if H_MV5
   Int         m_viewIdLenMinus1;
   Int         m_viewIdVal                [MAX_NUM_LAYERS];
-#endif
   Bool        m_directDependencyFlag     [MAX_NUM_LAYER_IDS][MAX_NUM_LAYER_IDS];
-#if H_MV5
   Bool        m_maxTidRefPresentFlag;
-#endif
   Int         m_maxTidIlRefPicPlus1      [MAX_NUM_LAYERS];
-#if H_MV5
   Bool        m_allRefLayersActiveFlag;
-#endif
   Int         m_vpsNumberLayerSetsMinus1; 
   Int         m_vpsNumProfileTierLevelMinus1;   
@@ -586,19 +566,13 @@
   Bool        m_outputLayerFlag          [MAX_VPS_OUTPUTLAYER_SETS][MAX_VPS_NUH_LAYER_ID_PLUS1];
   Int         m_profileLevelTierIdx      [MAX_VPS_OUTPUTLAYER_SETS ];
-#if H_MV5
   Bool        m_repFormatIdxPresentFlag;
   Int         m_vpsNumRepFormatsMinus1;
   Int         m_vpsRepFormatIdx          [MAX_NUM_LAYERS];
   TComRepFormat* m_repFormat             [MAX_NUM_LAYERS]; 
-#endif
   Bool        m_maxOneActiveRefLayerFlag;       
-#if H_MV5
   Bool        m_crossLayerIrapAlignedFlag;
-#endif
   Int         m_directDepTypeLenMinus2;         
-#if H_MV5
   Bool        m_vpsVuiPresentFlag;
   TComVPSVUI* m_vpsVUI; 
-#endif
   Int         m_directDependencyType     [MAX_NUM_LAYERS] [MAX_NUM_LAYERS];
 
@@ -616,13 +590,5 @@
   Bool        m_motionPredEnabledFlag    [MAX_NUM_LAYERS][MAX_NUM_LAYERS];
   Int         m_motionPredRefLayerId     [MAX_NUM_LAYERS][MAX_NUM_LAYERS];
-#if H_MV5
   Int         m_viewIndex                [MAX_NUM_LAYERS   ];
-#else
-#if H_3D
-  Int         m_viewIndex                [MAX_NUM_LAYERS   ];
-#endif
-
-  Int         xCeilLog2       ( Int val );
-#endif
   Int         xGetDimBitOffset( Int j );
   
@@ -681,5 +647,4 @@
   Void    setMaxTLayers  (UInt t)             { m_uiMaxTLayers = t; }
   
-#if H_MV5
 #if H_MV    
   UInt    getMaxLayersMinus1()                { return m_uiMaxLayersMinus1;  }; 
@@ -689,8 +654,4 @@
   Void    setMaxLayers   (UInt l)             { m_uiMaxLayers = l; }
 #endif
-#else
-  UInt    getMaxLayers   ()                   { return m_uiMaxLayers;   }
-  Void    setMaxLayers   (UInt l)             { m_uiMaxLayers = l; }
-#endif
 
   Bool    getTemporalNestingFlag   ()         { return m_bTemporalIdNestingFlag;   }
@@ -735,22 +696,13 @@
   Bool    getAvcBaseLayerFlag()                                            { return m_avcBaseLayerFlag; } 
 
-#if H_MV5
   Void    setVpsVuiOffset( Int  val )                                      { m_vpsVuiOffset = val; } 
   Int     getVpsVuiOffset(  )                                              { return m_vpsVuiOffset; } 
-#endif
 
   Void    setSplittingFlag( Bool val )                                     { m_splittingFlag = val;  }
   Bool    getSplittingFlag()                                               { return m_splittingFlag; }
 
-#if H_MV5
   Void    setScalabilityMaskFlag( UInt val );
   Void    setScalabilityMaskFlag( Int scalType, Bool val )                     { m_scalabilityMaskFlag[scalType] = val;  }
   Bool    getScalabilityMaskFlag( Int scalType )                               { return m_scalabilityMaskFlag[scalType]; }
-#else
-  Void    setScalabilityMask( UInt val );
-
-  Void    setScalabilityMask( Int scalType, Bool val )              { m_scalabilityMask[scalType] = val;  }
-  Bool    getScalabilityMask( Int scalType )                        { return m_scalabilityMask[scalType]; }
-#endif
   Int     getNumScalabilityTypes( );
 
@@ -769,5 +721,4 @@
   Int     getDimensionId( Int layerIdInVps, Int scalIdx )                  { return m_dimensionId[layerIdInVps][scalIdx]; }
 
-#if H_MV5
   Void    setViewIdLenMinus1( Int  val )                                   { m_viewIdLenMinus1 = val; } 
   Int     getViewIdLenMinus1(  )                                           { return m_viewIdLenMinus1; } 
@@ -775,18 +726,13 @@
   Void    setViewIdVal( Int viewOrderIndex, Int  val )                     { m_viewIdVal[viewOrderIndex] = val; } 
   Int     getViewIdVal( Int viewOrderIndex )                               { return m_viewIdVal[viewOrderIndex]; } 
-#endif
   Void    setDirectDependencyFlag( Int depLayeridInVps, Int refLayeridInVps, Bool val ) { m_directDependencyFlag[depLayeridInVps][refLayeridInVps] = val;  }
   Bool    getDirectDependencyFlag( Int depLayeridInVps, Int refLayeridInVps )           { return m_directDependencyFlag[depLayeridInVps][refLayeridInVps]; }
 
-#if H_MV5
   Void    setMaxTidRefPresentFlag( Bool flag )                             { m_maxTidRefPresentFlag = flag; } 
   Bool    getMaxTidRefPresentFlag(  )                                      { return m_maxTidRefPresentFlag; } 
-#endif
   Void    setMaxTidIlRefPicPlus1( Int layerIdInVps, Int val )              { m_maxTidIlRefPicPlus1[ layerIdInVps ] = val;  } 
   Int     getMaxTidIlRefPicPlus1( Int layerIdInVps )                       { return m_maxTidIlRefPicPlus1[ layerIdInVps ]; } 
-#if H_MV5
   Void    setAllRefLayersActiveFlag( Bool flag )                           { m_allRefLayersActiveFlag = flag; } 
   Bool    getAllRefLayersActiveFlag(  )                                    { return m_allRefLayersActiveFlag; } 
-#endif
   Void    setVpsNumberLayerSetsMinus1( Int val )                           { m_vpsNumberLayerSetsMinus1 = val;  } 
   Int     getVpsNumberLayerSetsMinus1( )                                   { return m_vpsNumberLayerSetsMinus1; } 
@@ -819,5 +765,4 @@
   Int     getProfileLevelTierIdx( Int outLayerSetIdx )                     { return m_profileLevelTierIdx[ outLayerSetIdx ]; } 
 
-#if H_MV5
   Void    setRepFormatIdxPresentFlag( Bool flag )                          { m_repFormatIdxPresentFlag = flag; } 
   Bool    getRepFormatIdxPresentFlag(  )                                   { return m_repFormatIdxPresentFlag; } 
@@ -831,11 +776,8 @@
   Void    setRepFormat( Int i, TComRepFormat* val )                        { m_repFormat[i] = val;  }
   TComRepFormat* getRepFormat( Int i )                                     { return m_repFormat[i]; }
-#endif
   Void    setMaxOneActiveRefLayerFlag( Bool flag)                          { m_maxOneActiveRefLayerFlag = flag; } 
   Bool    getMaxOneActiveRefLayerFlag( )                                   { return m_maxOneActiveRefLayerFlag; } 
-#if H_MV5
   Void    setCrossLayerIrapAlignedFlag( Bool flag )                        { m_crossLayerIrapAlignedFlag = flag; } 
   Bool    getCrossLayerIrapAlignedFlag(  )                                 { return m_crossLayerIrapAlignedFlag; } 
-#endif
   Void    setDirectDepTypeLenMinus2( Int val)                              { m_directDepTypeLenMinus2 = val; } 
   Int     getDirectDepTypeLenMinus2( )                                     { return m_directDepTypeLenMinus2; } 
@@ -843,10 +785,8 @@
   Void    setDirectDependencyType( Int depLayeridInVps, Int refLayeridInVps, Int val) { m_directDependencyType[ depLayeridInVps ][ refLayeridInVps ] = val; } 
   Int     getDirectDependencyType( Int depLayeridInVps, Int refLayeridInVps)   { return m_directDependencyType[ depLayeridInVps ][ refLayeridInVps ]; } 
-#if H_MV5  
   Void    setVpsVuiPresentFlag( Bool flag )                                { m_vpsVuiPresentFlag = flag; } 
   Bool    getVpsVuiPresentFlag(  )                                         { return m_vpsVuiPresentFlag; } 
 
   TComVPSVUI* getVPSVUI(  )                                                { return m_vpsVUI;  }
-#endif
   // VPS EXTENSION SEMANTICS VARIABLES
   Void    setLayerIdInVps( Int layerIdInNuh, Int val )                     { m_layerIdInVps[layerIdInNuh] = val;  }
@@ -854,13 +794,7 @@
 
   Int     getScalabilityId ( Int layerIdInVps, ScalabilityType scalType );
-#if H_MV5
   Int     getViewId        ( Int layerIdInNuh )                            { return m_viewIdVal[ getViewIndex( getLayerIdInVps( layerIdInNuh) )]; }
-#else
-  Int     getViewId  ( Int layerIdInVps )                                  { return getScalabilityId( layerIdInVps, VIEW_ID  ); }
-
-#endif
   Void    setRefLayers(); 
 
-#if H_MV5
   Int     getViewIndex    ( Int layerIdInNuh )                             { return getScalabilityId( getLayerIdInVps(layerIdInNuh), VIEW_ORDER_INDEX  ); }    
   Int     getNumViews();
@@ -868,24 +802,8 @@
   Int     getNumDirectRefLayers( Int layerIdInNuh )                        { return m_numDirectRefLayers[ layerIdInNuh ];  };                               
   Int     getRefLayerId        ( Int layerIdInNuh, Int idx );; 
-#else
-  Int     getNumDirectRefLayers( Int layerIdInVps )          { return m_numDirectRefLayers[ layerIdInVps ];  };                               
-  Int     getRefLayerId        ( Int layerIdInVps, Int idx );; 
-  
-  Int     getNumSamplePredRefLayers( Int layerIdInVps )          { return m_numSamplePredRefLayers[layerIdInVps]; } 
-  Bool    getSamplePredEnabledFlag ( Int layerIdInVps, Int idx ) { return m_samplePredEnabledFlag [layerIdInVps][idx]; } 
-  Int     getSamplePredRefLayerId  ( Int layerIdInVps, Int idx ) { return m_samplePredRefLayerId  [layerIdInVps][idx]; } 
-
-  Int     getNumMotionPredRefLayers( Int layerIdInVps )          { return m_numMotionPredRefLayers[layerIdInVps]; } 
-  Bool    getMotionPredEnabledFlag ( Int layerIdInVps, Int idx ) { return m_motionPredEnabledFlag [layerIdInVps][idx]; } 
-  Int     getMotionPredRefLayerId  ( Int layerIdInVps, Int idx ) { return m_motionPredRefLayerId  [layerIdInVps][idx]; } 
-#endif  
   Bool    checkVPSExtensionSyntax(); 
   Int     scalTypeToScalIdx   ( ScalabilityType scalType );
 
-  #if H_MV5
 Int     getProfileLevelTierIdxLen()                                      { return gCeilLog2( getVpsNumProfileTierLevelMinus1() + 1 ); };       
-#else
-  Int     getProfileLevelTierIdxLen() { return xCeilLog2( getVpsNumProfileTierLevelMinus1() + 1 ); };       
-#endif
 
   Int     getNumLayersInIdList              ( Int lsIdx );; 
@@ -895,17 +813,9 @@
   Int     inferLastDimsionIdLenMinus1();
 
-#if H_MV5
   // helpers
   Bool    getInDirectDependencyFlag( Int depLayeridInVps, Int refLayeridInVps, Int depth = 0 );
-#endif
   /// VPS EXTENSION 2 SYNTAX ELEMENTS
 #if H_3D  
-#if H_MV5
   Int     getDepthId      ( Int layerIdInNuh)                             { return getScalabilityId( getLayerIdInVps(layerIdInNuh), DEPTH_ID ); }
-#else
-  Void    initViewIndex(); 
-  Int     getViewIndex    ( Int layerIdInVps )                             { return m_viewIndex[ layerIdInVps ]; }    
-  Int     getDepthId      ( Int layerIdInVps )                             { return getScalabilityId( layerIdInVps, DEPTH_ID ); }
-#endif
   Int     getLayerIdInNuh( Int viewIndex, Bool depthFlag );   
 
@@ -960,8 +870,6 @@
   Int           m_winTopOffset;
   Int           m_winBottomOffset;
-#if H_MV5
 #if H_MV
   Bool          m_scaledFlag; 
-#endif
 #endif
 public:
@@ -972,8 +880,6 @@
   , m_winTopOffset      (0)
   , m_winBottomOffset   (0)
-#if H_MV5
 #if H_MV
   , m_scaledFlag(true)
-#endif
 #endif
   { }
@@ -990,5 +896,4 @@
   Void          setWindowBottomOffset(Int val)    { m_winBottomOffset = val; m_enabledFlag = true; }
 
-#if H_MV5
 #if H_MV
   Void          setScaledFlag(Bool flag)          { m_scaledFlag = flag;  } 
@@ -1005,5 +910,4 @@
     }
   }
-#endif
 #endif
   Void          setWindow(Int offsetLeft, Int offsetLRight, Int offsetLTop, Int offsetLBottom)
@@ -1054,9 +958,4 @@
   TComHRD m_hrdParameters;
   TimingInfo m_timingInfo;
-#if !H_MV5
-#if H_MV
-  Bool m_tileBoundariesAlignedFlag;
-#endif
-#endif
 
 public:
@@ -1091,9 +990,4 @@
     ,m_log2MaxMvLengthHorizontal(15)
     ,m_log2MaxMvLengthVertical(15)
-#if !H_MV5
-#if H_MV
-    ,m_tileBoundariesAlignedFlag(true)
-#endif
-#endif
   {}
 
@@ -1191,10 +1085,4 @@
   TComHRD* getHrdParameters                 ()             { return &m_hrdParameters; }
   TimingInfo* getTimingInfo() { return &m_timingInfo; }
-#if !H_MV5
-#if H_MV
-Bool getTileBoundariesAlignedFlag(  ) { return m_tileBoundariesAlignedFlag; } 
-  Void setTileBoundariesAlignedFlag( Bool flag ) { m_tileBoundariesAlignedFlag = flag; } 
-#endif
-#endif
 
 };
@@ -1281,5 +1169,4 @@
   TComPTL     m_pcPTL;
 #if H_MV
-#if H_MV5
   TComVPS*    m_pcVPS; 
   // SPS 
@@ -1287,13 +1174,6 @@
   Int         m_spsScalingListRefLayerId;
   Bool        m_updateRepFormatFlag;
-#endif
   // SPS Extension 
   Bool        m_interViewMvVertConstraintFlag;
-#if !H_MV5
-  Int         m_numIlpRestrictedRefLayers        ;
-  Int         m_minSpatialSegmentOffsetPlus1[MAX_NUM_LAYERS];
-  Bool        m_ctuBasedOffsetEnabledFlag   [MAX_NUM_LAYERS];
-  Int         m_minHorizontalCtuOffsetPlus1 [MAX_NUM_LAYERS];
-#endif
 #endif
 #if H_3D
@@ -1432,5 +1312,4 @@
   TComPTL* getPTL()     { return &m_pcPTL; }
 #if H_MV
-#if H_MV5
   Void      setVPS          ( TComVPS* pcVPS ) { m_pcVPS = pcVPS; }
   TComVPS*  getVPS          () { return m_pcVPS; }
@@ -1444,27 +1323,11 @@
   Void setUpdateRepFormatFlag( Bool flag )     { m_updateRepFormatFlag = flag; } 
   Bool getUpdateRepFormatFlag(  )              { return m_updateRepFormatFlag; } 
-#endif
   // SPS Extension 
   Void setInterViewMvVertConstraintFlag(Bool val) { m_interViewMvVertConstraintFlag = val; }
   Bool getInterViewMvVertConstraintFlag()         { return m_interViewMvVertConstraintFlag;}
-#if H_MV5
   // Inference 
   Void inferRepFormat( TComVPS* vps, Int layerIdCurr );
 
   Void inferScalingList( TComSPS* spsSrc );
-#else
-  Void setNumIlpRestrictedRefLayers   ( Int val )        { m_numIlpRestrictedRefLayers         = val;}
-  Int  getNumIlpRestrictedRefLayers   ( )                { return m_numIlpRestrictedRefLayers        ;}
-  
-  Void setMinSpatialSegmentOffsetPlus1( Int i, Int val ) { m_minSpatialSegmentOffsetPlus1[ i ] = val;}
-  Int  getMinSpatialSegmentOffsetPlus1( Int i )          { return m_minSpatialSegmentOffsetPlus1[ i ];}
-  
-  Void setCtuBasedOffsetEnabledFlag   ( Int i, Bool flag ) { m_ctuBasedOffsetEnabledFlag   [ i ] = flag;}
-  Bool getCtuBasedOffsetEnabledFlag   ( Int i )            { return m_ctuBasedOffsetEnabledFlag   [ i ];}
-
-  Void setMinHorizontalCtuOffsetPlus1 ( Int i, Int val )   { m_minHorizontalCtuOffsetPlus1 [ i ] = val;}
-  Int  getMinHorizontalCtuOffsetPlus1 ( Int i )            { return m_minHorizontalCtuOffsetPlus1 [ i ];}
-
-#endif
 #endif
 #if H_3D_QTLPC
@@ -1582,10 +1445,8 @@
   Int m_numExtraSliceHeaderBits;
 
-#if H_MV5
 #if H_MV
   Int  m_layerId; 
   Bool m_ppsInferScalingListFlag;
   Int  m_ppsScalingListRefLayerId;
-#endif
 #endif
 public:
@@ -1710,5 +1571,4 @@
   Bool getSliceHeaderExtensionPresentFlag   ()                    { return m_sliceHeaderExtensionPresentFlag; }
   Void setSliceHeaderExtensionPresentFlag   (Bool val)            { m_sliceHeaderExtensionPresentFlag = val; }
-#if H_MV5
 #if H_MV
   Void setLayerId( Int  val ) { m_layerId = val; } 
@@ -1720,5 +1580,4 @@
   Void setPpsScalingListRefLayerId( Int  val ) { m_ppsScalingListRefLayerId = val; } 
   Int  getPpsScalingListRefLayerId(  ) { return m_ppsScalingListRefLayerId; } 
-#endif
 #endif
 };
@@ -1754,8 +1613,6 @@
   Bool        m_PicOutputFlag;        ///< pic_output_flag 
   Int         m_iPOC;
-#if H_MV5
 #if H_MV
   Int         m_iPOCBeforeReset; 
-#endif
 #endif
   Int         m_iLastIDR;
@@ -1853,5 +1710,4 @@
   Bool       m_enableTMVPFlag;
 #if H_MV
-#if H_MV5
   std::vector<TComPic*>* m_refPicSetInterLayer0; 
   std::vector<TComPic*>* m_refPicSetInterLayer1; 
@@ -1862,31 +1718,11 @@
   Bool       m_isDepth;
 #endif
-#else
-  std::vector<TComPic*>* m_refPicSetInterLayer; 
-  Int        m_layerId; 
-  Int        m_viewId;
-#if H_3D
-  Int        m_viewIndex; 
-  Bool       m_isDepth;
-#endif
-#endif
 
 // Additional slice header syntax elements 
-#if H_MV5
   Bool       m_pocResetFlag; 
-#endif
   Bool       m_discardableFlag;
   Bool       m_interLayerPredEnabledFlag;
   Int        m_numInterLayerRefPicsMinus1;
   Int        m_interLayerPredLayerIdc       [MAX_NUM_LAYERS];
-#if !H_MV5
-  Bool       m_interLayerSamplePredOnlyFlag;
-  Bool       m_altCollocatedIndicationFlag;
-  Int        m_collocatedRefLayerIdx;
-// Additional slice header semantics variables
-  Int        m_numActiveMotionPredRefLayers;
-  Int        m_activeMotionPredRefLayerId   [ MAX_NUM_LAYER_IDS ];
-
-#endif
   Int        m_aaiCodedScale [2][MAX_NUM_LAYERS];
   Int        m_aaiCodedOffset[2][MAX_NUM_LAYERS];
@@ -2022,18 +1858,12 @@
   
 #if H_MV
-#if H_MV5
   Void      setPocBeforeReset   ( Int i )                       { m_iPOCBeforeReset = i; }
   Int       getPocBeforeReset   ( )                             { return m_iPOCBeforeReset; }
-#endif
   Int       getRefLayerId        ( RefPicList e, Int iRefIdx)    { return  m_aiRefLayerIdList[e][iRefIdx]; }
   Void      setRefLayerId        ( Int i, RefPicList e, Int iRefIdx ) { m_aiRefLayerIdList[e][iRefIdx] = i; }
-#if H_MV5
   Void      getTempRefPicLists   ( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& refPicSetInterLayer0, std::vector<TComPic*>& refPicSetInterLayer1,                                     
                                    std::vector<TComPic*> rpsCurrList[2], std::vector<Bool> usedAsLongTerm[2], Int& numPocTotalCurr, Bool checkNumPocTotalCurr = false );
 
   Void      setRefPicList        ( std::vector<TComPic*> rpsCurrList[2], std::vector<Bool> usedAsLongTerm[2], Int numPocTotalCurr, Bool checkNumPocTotalCurr = false ); 
-#else
-  Void      setRefPicList       ( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& interLayerRefPicSet , Bool checkNumPocTotalCurr = false );
-#endif
 #else
 #if FIX1071
@@ -2084,18 +1914,9 @@
   Void applyReferencePictureSet( TComList<TComPic*>& rcListPic, TComReferencePictureSet *RPSList);
 #if H_MV
-#if !H_MV5
-  Void createAndApplyIvReferencePictureSet( TComPicLists* ivPicLists, std::vector<TComPic*>& refPicSetInterLayer );
-  static Void markIvRefPicsAsShortTerm    ( std::vector<TComPic*> refPicSetInterLayer );
-#else
   Void createInterLayerReferencePictureSet( TComPicLists* ivPicLists, std::vector<TComPic*>& refPicSetInterLayer0, std::vector<TComPic*>& refPicSetInterLayer1 );
   static Void markIvRefPicsAsShortTerm    ( std::vector<TComPic*> refPicSetInterLayer0, std::vector<TComPic*> refPicSetInterLayer1 );
-#endif
   static Void markCurrPic                 ( TComPic* currPic );; 
   static Void markIvRefPicsAsUnused       ( TComPicLists* ivPicLists, std::vector<Int> targetDecLayerIdSet, TComVPS* vps, Int curLayerId, Int curPoc  );
-#if H_MV5
   Void        printRefPicList();
-#else
-  Void        xPrintRefPicList();
-#endif
 #endif
   Bool isTemporalLayerSwitchingPoint( TComList<TComPic*>& rcListPic );
@@ -2184,8 +2005,6 @@
   Void      setViewId             ( Int viewId )     { m_viewId = viewId;   }
   Int       getViewId             ()                 { return m_viewId;     }
-#if H_MV5
   Void      setViewIndex          ( Int viewIndex )  { m_viewIndex = viewIndex;   }
   Int       getViewIndex          ()                 { return m_viewIndex;     }
-#endif
 #if H_3D
 #if H_3D_TMVP
@@ -2193,8 +2012,4 @@
   Void      setAlterRefIdx          ( RefPicList e, Int i ) { m_aiAlterRefIdx[e]    = i;      }
   Int       getAlterRefIdx          ( RefPicList e )        { return  m_aiAlterRefIdx[e];     }
-#endif
-#if !H_MV5
-  Void      setViewIndex          ( Int viewIndex )  { m_viewIndex = viewIndex;   }
-  Int       getViewIndex          ()                 { return m_viewIndex;     }
 #endif
   Void      setIsDepth            ( Bool isDepth )   { m_isDepth = isDepth; }
@@ -2219,8 +2034,6 @@
 // Additional slice header syntax elements
 
-#if H_MV5
   Void setPocResetFlag( Bool flag ) { m_pocResetFlag = flag; } 
   Bool getPocResetFlag(  ) { return m_pocResetFlag; } 
-#endif
 
 Void setDiscardableFlag( Bool flag ) { m_discardableFlag = flag; } 
@@ -2236,5 +2049,4 @@
 Int  getInterLayerPredLayerIdc( Int i ) { return m_interLayerPredLayerIdc[i]; } 
 
-#if H_MV5 
   // Additional variables derived in slice header semantics 
   Int  getNumInterLayerRefPicsMinus1Len( ) { return gCeilLog2(  getVPS()->getNumDirectRefLayers( getLayerId() )); }
@@ -2250,32 +2062,4 @@
   Void     setRefPicSetInterLayer       ( std::vector<TComPic*>* refPicSetInterLayer0, std::vector<TComPic*>* refPicSetInterLayer1);
   TComPic* getPicFromRefPicSetInterLayer( Int setIdc, Int layerId );
-#else
-Void setInterLayerSamplePredOnlyFlag( Bool flag ) { m_interLayerSamplePredOnlyFlag = flag; } 
-Bool getInterLayerSamplePredOnlyFlag(  ) { return m_interLayerSamplePredOnlyFlag; } 
-
-Void setAltCollocatedIndicationFlag( Bool flag ) { m_altCollocatedIndicationFlag = flag; } 
-Bool getAltCollocatedIndicationFlag(  ) { return m_altCollocatedIndicationFlag; } 
-
-Void setCollocatedRefLayerIdx( Int  val ) { m_collocatedRefLayerIdx = val; } 
-Int  getCollocatedRefLayerIdx(  ) { return m_collocatedRefLayerIdx; } 
-
-// Additional variables derived in slice header semantics 
-Int  getNumInterLayerRefPicsMinus1Len( ) { return xCeilLog2(  getVPS()->getNumDirectRefLayers( getLayerIdInVps() )); }
-Int  getInterLayerPredLayerIdcLen    ( ) { return xCeilLog2(  getVPS()->getNumDirectRefLayers( getLayerIdInVps() )); }
-
-Int  getNumActiveRefLayerPics( );
-Int  getRefPicLayerId               ( Int i );
-
-Void setActiveMotionPredRefLayers   ( );
-
-Int  getNumActiveMotionPredRefLayers(  )      { return m_numActiveMotionPredRefLayers; } 
-Int  getActiveMotionPredRefLayerId  ( Int i ) { return m_activeMotionPredRefLayerId[i]; } 
-
-Bool getInterRefEnabledInRPLFlag( );
-
-Void     setRefPicSetInterLayer       ( std::vector<TComPic*>* m_refPicSetInterLayer );
-TComPic* getPicFromRefPicSetInterLayer( Int layerId );
-
-#endif
 #endif
 protected:
@@ -2284,7 +2068,4 @@
 TComPic*  xGetLongTermRefPic(TComList<TComPic*>& rcListPic, Int poc, Bool pocHasMsb);
 #if H_MV
-#if !H_MV5
-  Int       xCeilLog2( Int val );
-#endif
   TComPic*  xGetInterLayerRefPic( std::vector<TComPic*>& rcListIlPic, Int layerId );  
 #endif
@@ -2368,25 +2149,4 @@
   //! activate a SPS from a active parameter sets SEI message
   //! \returns true, if activation is successful
-#if !H_MV5
-  Bool activateSPSWithSEI(Int SPSId);
-
-  //! activate a PPS and depending on isIDR parameter also SPS and VPS
-  //! \returns true, if activation is successful
-  Bool activatePPS(Int ppsId, Bool isIRAP);
-
-  TComVPS* getActiveVPS(){ return m_vpsMap.getPS(m_activeVPSId); };
-  TComSPS* getActiveSPS(){ return m_spsMap.getPS(m_activeSPSId); };
-  TComPPS* getActivePPS(){ return m_ppsMap.getPS(m_activePPSId); };
-
-protected:
-  
-  ParameterSetMap<TComVPS> m_vpsMap;
-  ParameterSetMap<TComSPS> m_spsMap; 
-  ParameterSetMap<TComPPS> m_ppsMap;
-
-  Int m_activeVPSId;
-  Int m_activeSPSId;
-  Int m_activePPSId;
-#else
 #if H_MV
   Bool activateSPSWithSEI(Int SPSId, Int layerId );
@@ -2426,5 +2186,4 @@
 #endif
 
-#endif
 };
 
Index: branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibCommon/TypeDef.h	(revision 647)
+++ branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibCommon/TypeDef.h	(revision 648)
@@ -181,9 +181,4 @@
 #define KWU_RC_MADPRED_E0227              0  ///< JCT3V-E0227, inter-view MAD prediction
 
-
-/// FIXES
-#if H_MV
-#define H_MV5                             1   // Update to MV-HEVC 5 HLS
-#endif
 /////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////   DERIVED DEFINES ///////////////////////////////////  
@@ -769,15 +764,8 @@
   enum ScalabilityType
   {
-#if H_MV5
 #if H_3D
     DEPTH_ID = 0,    
 #endif    
     VIEW_ORDER_INDEX  = 1,
-#else
-    VIEW_ID  = 0,
-#if H_3D
-    DEPTH_ID = 1,    
-#endif    
-#endif
   };
 #endif
Index: branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 647)
+++ branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 648)
@@ -330,5 +330,4 @@
     }
   }
-#if H_MV5
 #if H_MV
   if ( pcPPS->getLayerId() > 0 )
@@ -344,5 +343,4 @@
   {  
 #endif
-#endif
   READ_FLAG( uiCode, "pps_scaling_list_data_present_flag" );           pcPPS->setScalingListPresentFlag( uiCode ? true : false );
   if(pcPPS->getScalingListPresentFlag ())
@@ -350,8 +348,6 @@
     parseScalingList( pcPPS->getScalingList() );
   }
-#if H_MV5
-#if H_MV
-  }
-#endif
+#if H_MV
+  }
 #endif
 
@@ -430,10 +426,4 @@
   {
     Window &defDisp = pcVUI->getDefaultDisplayWindow();
-#if !H_MV5
-    READ_UVLC(   uiCode, "def_disp_win_left_offset" );                defDisp.setWindowLeftOffset  ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc()) );
-    READ_UVLC(   uiCode, "def_disp_win_right_offset" );               defDisp.setWindowRightOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc()) );
-    READ_UVLC(   uiCode, "def_disp_win_top_offset" );                 defDisp.setWindowTopOffset   ( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) );
-    READ_UVLC(   uiCode, "def_disp_win_bottom_offset" );              defDisp.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) );
-#else
 #if H_MV
     defDisp.setScaledFlag( false ); 
@@ -448,5 +438,4 @@
     READ_UVLC(   uiCode, "def_disp_win_bottom_offset" );              defDisp.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) );
 #endif
-#endif
   }
   TimingInfo *timingInfo = pcVUI->getTimingInfo();
@@ -471,12 +460,4 @@
   {
     READ_FLAG(   uiCode, "tiles_fixed_structure_flag");               pcVUI->setTilesFixedStructureFlag(uiCode);
-#if !H_MV5
-#if H_MV
-    if ( pcSPS->getLayerId() > 0 )
-    {
-      READ_FLAG( uiCode, "tile_boundaries_aligned_flag" ); pcVUI->setTileBoundariesAlignedFlag( uiCode == 1 );
-    }
-#endif
-#endif
     READ_FLAG(   uiCode, "motion_vectors_over_pic_boundaries_flag");  pcVUI->setMotionVectorsOverPicBoundariesFlag(uiCode);
     READ_FLAG(   uiCode, "restricted_ref_pic_lists_flag");            pcVUI->setRestrictedRefPicListsFlag(uiCode);
@@ -597,5 +578,4 @@
   READ_UVLC(     uiCode, "sps_seq_parameter_set_id" );           pcSPS->setSPSId( uiCode );
   assert(uiCode <= 15);
-#if H_MV5
 #if H_MV
   if ( pcSPS->getLayerId() > 0 )
@@ -606,5 +586,4 @@
   if ( pcSPS->getUpdateRepFormatFlag() )
   { 
-#endif
 #endif
   READ_UVLC(     uiCode, "chroma_format_idc" );                  pcSPS->setChromaFormatIdc( uiCode );
@@ -619,8 +598,6 @@
   READ_UVLC (    uiCode, "pic_width_in_luma_samples" );          pcSPS->setPicWidthInLumaSamples ( uiCode    );
   READ_UVLC (    uiCode, "pic_height_in_luma_samples" );         pcSPS->setPicHeightInLumaSamples( uiCode    );
-#if H_MV5
-#if H_MV
-  }
-#endif
+#if H_MV
+  }
 #endif
   READ_FLAG(     uiCode, "conformance_window_flag");
@@ -628,5 +605,4 @@
   {
     Window &conf = pcSPS->getConformanceWindow();
-#if H_MV5
 #if H_MV
     // Needs to be scaled later, when ChromaFormatIdc is known. 
@@ -642,17 +618,9 @@
     READ_UVLC(   uiCode, "conf_win_bottom_offset" );             conf.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) );
 #endif
-#else
-    READ_UVLC(   uiCode, "conf_win_left_offset" );               conf.setWindowLeftOffset  ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) );
-    READ_UVLC(   uiCode, "conf_win_right_offset" );              conf.setWindowRightOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) );
-    READ_UVLC(   uiCode, "conf_win_top_offset" );                conf.setWindowTopOffset   ( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) );
-    READ_UVLC(   uiCode, "conf_win_bottom_offset" );             conf.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) );
-#endif
-  }
-
-#if H_MV5
+  }
+
 #if H_MV
   if ( pcSPS->getUpdateRepFormatFlag() )
   { 
-#endif
 #endif
   READ_UVLC(     uiCode, "bit_depth_luma_minus8" );
@@ -665,8 +633,6 @@
   pcSPS->setBitDepthC( uiCode + 8 );
   pcSPS->setQpBDOffsetC( (Int) (6*uiCode) );
-#if H_MV5
-#if H_MV
-  }
-#endif
+#if H_MV
+  }
 #endif
 
@@ -692,9 +658,5 @@
     pcSPS->setNumReorderPics(uiCode, i);
 #if H_MV
-#if H_MV5
     READ_UVLC ( uiCode, "sps_max_latency_increase_plus1[i]");
-#else
-    READ_UVLC ( uiCode, "sps_max_latency_increase[i]");
-#endif
 #else
     READ_UVLC ( uiCode, "sps_max_latency_increase_plus1");
@@ -736,5 +698,4 @@
   if(pcSPS->getScalingListFlag())
   {
-#if H_MV5
 #if H_MV
     if ( pcSPS->getLayerId() > 0 )
@@ -750,5 +711,4 @@
     {    
 #endif
-#endif
     READ_FLAG( uiCode, "sps_scaling_list_data_present_flag" );                 pcSPS->setScalingListPresentFlag ( uiCode );
     if(pcSPS->getScalingListPresentFlag ())
@@ -756,8 +716,6 @@
       parseScalingList( pcSPS->getScalingList() );
     }
-#if H_MV5
-#if H_MV
-    }
-#endif
+#if H_MV
+    }
 #endif
   }
@@ -814,84 +772,4 @@
   if (uiCode)
   {
-#if !H_MV5
-#if !H_MV
-    while ( xMoreRbspData() )
-    {
-      READ_FLAG( uiCode, "sps_extension_data_flag");
-    }
-#else
-    READ_FLAG( uiCode, "inter_view_mv_vert_constraint_flag" );    pcSPS->setInterViewMvVertConstraintFlag(uiCode == 1 ? true : false);
-    ////   sps_extension_vui_parameters( )
-    if( pcSPS->getVuiParameters()->getBitstreamRestrictionFlag() )
-    {  
-      READ_UVLC( uiCode, "num_ilp_restricted_ref_layers" ); pcSPS->setNumIlpRestrictedRefLayers( uiCode ); 
-      for( Int i = 0; i < pcSPS->getNumIlpRestrictedRefLayers( ); i++ ) 
-      {  
-        READ_UVLC( uiCode, "min_spatial_segment_offset_plus1" ); pcSPS->setMinSpatialSegmentOffsetPlus1( i, uiCode ); 
-        if( pcSPS->getMinSpatialSegmentOffsetPlus1( i ) > 0 ) 
-        {  
-          READ_FLAG( uiCode, "ctu_based_offset_enabled_flag[ i ]"); pcSPS->setCtuBasedOffsetEnabledFlag(i, uiCode == 1 ); 
-          if( pcSPS->getCtuBasedOffsetEnabledFlag( i ) )  
-          {
-            READ_UVLC( uiCode, "min_horizontal_ctu_offset_plus1[ i ]"); pcSPS->setMinHorizontalCtuOffsetPlus1( i, uiCode ); 
-          }
-        }  
-      }  
-    }
-
-#if H_3D_QTLPC
-    if( depthFlag )
-    {
-      READ_FLAG( uiCode, "use_qtl_flag" );
-      pcSPS->setUseQTL( uiCode );
-      READ_FLAG( uiCode, "use_pc_flag" );
-      pcSPS->setUsePC( uiCode );
-    }
-#endif
-    ////   sps_extension_vui_parameters( ) END
-    READ_UVLC( uiCode, "sps_shvc_reserved_zero_idc" ); 
-    READ_FLAG( uiCode, "sps_extension2_flag");
-    if ( uiCode )
-    {
-#if !H_3D
-      while ( xMoreRbspData() )
-      {
-        READ_FLAG( uiCode, "sps_extension_data_flag");
-      }
-#else
-      
-      UInt uiCamParPrecision = 0; 
-      Bool bCamParSlice      = false; 
-      if ( !depthFlag )
-      {      
-        READ_UVLC( uiCamParPrecision, "cp_precision" );
-        READ_FLAG( uiCode, "cp_in_slice_header_flag" );    bCamParSlice = ( uiCode == 1 );
-        if( !bCamParSlice )
-        {       
-          for( UInt uiBaseIndex = 0; uiBaseIndex < viewIndex; uiBaseIndex++ )
-          {
-            Int iCode; 
-            READ_SVLC( iCode, "cp_scale" );                m_aaiTempScale  [ uiBaseIndex ][ viewIndex ]   = iCode;
-            READ_SVLC( iCode, "cp_off" );                  m_aaiTempOffset [ uiBaseIndex ][ viewIndex ]   = iCode;
-            READ_SVLC( iCode, "cp_inv_scale_plus_scale" ); m_aaiTempScale  [ viewIndex   ][ uiBaseIndex ] = iCode - m_aaiTempScale [ uiBaseIndex ][ viewIndex ];
-            READ_SVLC( iCode, "cp_inv_off_plus_off" );     m_aaiTempOffset [ viewIndex   ][ uiBaseIndex ] = iCode - m_aaiTempOffset[ uiBaseIndex ][ viewIndex ];
-          }
-        }
-      }
-      pcSPS->initCamParaSPS( viewIndex, uiCamParPrecision, bCamParSlice, m_aaiTempScale, m_aaiTempOffset );
-      READ_FLAG( uiCode, "sps_extension3_flag");
-      if ( uiCode )
-      {
-        while ( xMoreRbspData() )
-        {
-          READ_FLAG( uiCode, "sps_extension_data_flag");
-        }
-      }
-#endif // !H_3D
-    }
-#endif // !H_MV
-  }
-}
-#else 
 #if H_MV
     parseSPSExtension( pcSPS ); 
@@ -918,6 +796,4 @@
   }
 }
-#endif
-#if H_MV5
 Void TDecCavlc::parseSPSExtension( TComSPS* pcSPS )
 {
@@ -963,5 +839,4 @@
 }
 #endif
-#endif
 
 Void TDecCavlc::parseVPS(TComVPS* pcVPS)
@@ -972,9 +847,5 @@
   READ_CODE( 2,  uiCode,  "vps_reserved_three_2bits" );           assert(uiCode == 3);
 #if H_MV
-#if H_MV5
   READ_CODE( 6,  uiCode,  "vps_max_layers_minus1" );              pcVPS->setMaxLayersMinus1( uiCode  );
-#else
-  READ_CODE( 6,  uiCode,  "vps_max_layers_minus1" );              pcVPS->setMaxLayers( uiCode + 1 );
-#endif
 #else
   READ_CODE( 6,  uiCode,  "vps_reserved_zero_6bits" );            assert(uiCode == 0);
@@ -1061,223 +932,4 @@
   if (uiCode)
   {
-#if !H_MV5
-#if H_MV
-    m_pcBitstream->readOutTrailingBits();
-
-    READ_FLAG( uiCode, "avc_base_layer_flag" );                     pcVPS->setAvcBaseLayerFlag( uiCode == 1 ? true : false );
-    READ_FLAG( uiCode, "splitting_flag" );                          pcVPS->setSplittingFlag( uiCode == 1 ? true : false );
-
-    for( Int sIdx = 0; sIdx < MAX_NUM_SCALABILITY_TYPES; sIdx++ )
-    {
-      READ_FLAG( uiCode,  "scalability_mask[i]" );                  pcVPS->setScalabilityMask( sIdx, uiCode == 1 ? true : false );      
-    }
-
-    for( Int sIdx = 0; sIdx < pcVPS->getNumScalabilityTypes( ) - ( pcVPS->getSplittingFlag() ? 1 : 0 ); sIdx++ )
-    {
-        READ_CODE( 3, uiCode, "dimension_id_len_minus1[j]" );       pcVPS->setDimensionIdLen( sIdx, uiCode + 1 );
-    }
-
-    if ( pcVPS->getSplittingFlag() )
-      {
-      pcVPS->setDimensionIdLen( pcVPS->getNumScalabilityTypes( ) - 1, pcVPS->inferLastDimsionIdLenMinus1() );       
-      }
-
-    READ_FLAG( uiCode, "vps_nuh_layer_id_present_flag" );           pcVPS->setVpsNuhLayerIdPresentFlag( uiCode == 1 ? true : false );
-
-    for( Int i = 0; i <= pcVPS->getMaxLayers() - 1; i++ )
-    {
-      if ( pcVPS->getVpsNuhLayerIdPresentFlag() && ( i > 0 ) )
-      {
-        READ_CODE( 6, uiCode, "layer_id_in_nuh[i]" );                pcVPS->setLayerIdInNuh( i, uiCode );
-      }
-      else
-      {
-        pcVPS->setLayerIdInNuh( i, i );; 
-    }
-
-      pcVPS->setLayerIdInVps( pcVPS->getLayerIdInNuh( i ), i ); 
-    
-      for( Int j = 0; j < pcVPS->getNumScalabilityTypes() ; j++ ) 
-    {
-        if ( !pcVPS->getSplittingFlag() )
-      {
-          READ_CODE( pcVPS->getDimensionIdLen( j ), uiCode, "dimension_id[i][j]" );  pcVPS->setDimensionId( i, j, uiCode );
-        }
-        else
-        {
-          pcVPS->setDimensionId( i, j, pcVPS->inferDimensionId( i, j)  );
-        }
-      }
-    }
-
-
-    for( Int i = 1; i <= pcVPS->getMaxLayers() - 1; i++ )
-    {
-      for( Int j = 0; j < i; j++ )
-      {
-        READ_FLAG( uiCode, "direct_dependency_flag[i][j]" );             pcVPS->setDirectDependencyFlag( i, j, uiCode );
-      }
-    }
-
-    for( Int i = 0; i < pcVPS->getMaxLayers() - 1; i++ )
-    {
-      READ_CODE( 3, uiCode,       "max_tid_il_ref_pics_plus1[i]" );      pcVPS->setMaxTidIlRefPicPlus1( i , uiCode ); 
-    }
-
-    READ_CODE( 10, uiCode, "vps_number_layer_sets_minus1"      );  pcVPS->setVpsNumberLayerSetsMinus1    ( uiCode ); 
-    READ_CODE( 6,  uiCode, "vps_num_profile_tier_level_minus1" );  pcVPS->setVpsNumProfileTierLevelMinus1( uiCode );
-
-    for( Int i = 1; i <= pcVPS->getVpsNumProfileTierLevelMinus1(); i++ )
-    {
-      READ_FLAG(  uiCode, "vps_profile_present_flag[i]" );    pcVPS->setVpsProfilePresentFlag( i, uiCode == 1 );
-      if( !pcVPS->getVpsProfilePresentFlag( i ) )
-      {
-        READ_CODE( 6, uiCode, "profile_ref_minus1[i]" ); pcVPS->setProfileRefMinus1( i, uiCode );
-      }
-      parsePTL ( pcVPS->getPTL( i ), pcVPS->getVpsProfilePresentFlag( i ), pcVPS->getMaxTLayers()-1);
-      if( !pcVPS->getVpsProfilePresentFlag( i ) )
-      {
-        TComPTL temp = *pcVPS->getPTL( i );
-        *pcVPS->getPTL( i ) = *pcVPS->getPTL( pcVPS->getProfileRefMinus1( i ) + 1 );
-        pcVPS->getPTL( i )->copyLevelFrom( &temp );
-      }
-    }
-
-    Int numOutputLayerSets = pcVPS->getVpsNumberLayerSetsMinus1( ) + 1; 
-
-    READ_FLAG( uiCode, "more_output_layer_sets_than_default_flag" ); pcVPS->setMoreOutputLayerSetsThanDefaultFlag( uiCode == 1 );
-
-    if ( pcVPS->getMoreOutputLayerSetsThanDefaultFlag( ) )
-    {
-      READ_CODE( 10, uiCode, "num_add_output_layer_sets_minus1"      ); pcVPS->setNumAddOutputLayerSetsMinus1( uiCode );
-      numOutputLayerSets += ( pcVPS->getNumAddOutputLayerSetsMinus1( ) + 1); 
-    }
-
-    if( numOutputLayerSets > 1)
-    {
-      READ_FLAG( uiCode, "default_one_target_output_layer_flag" ); pcVPS->setDefaultOneTargetOutputLayerFlag(  uiCode == 1); 
-    }  
-
-    for( Int i = 1; i < numOutputLayerSets; i++ )
-    {
-      if( i > pcVPS->getVpsNumberLayerSetsMinus1( ) )
-      {        
-        READ_UVLC( uiCode,      "output_layer_set_idx_minus1[i]" ); pcVPS->setOutputLayerSetIdxMinus1( i, uiCode ); 
-        for( Int j = 0; j < pcVPS->getNumLayersInIdList( j ) - 1; j++ )
-        {
-          READ_FLAG( uiCode, "output_layer_flag" ); pcVPS->setOutputLayerFlag( i, j, uiCode == 1 ); 
-        }        
-      }
-      if ( pcVPS->getProfileLevelTierIdxLen()  > 0 )
-      {      
-        READ_CODE( pcVPS->getProfileLevelTierIdxLen(), uiCode,"profile_level_tier_idx[ i ]" );   pcVPS->setProfileLevelTierIdx( i , uiCode ); 
-      }
-    }
-
-    READ_FLAG( uiCode , "max_one_active_ref_layer_flag" ); pcVPS->setMaxOneActiveRefLayerFlag( uiCode == 1 ); 
-    READ_UVLC( uiCode,  "direct_dep_type_len_minus2"); pcVPS->setDirectDepTypeLenMinus2 ( uiCode ); 
-
-    for( Int i = 1; i <= pcVPS->getMaxLayers() - 1; i++ )
-    {
-      for( Int j = 0; j < i; j++ )
-      {
-        if (pcVPS->getDirectDependencyFlag( i, j) )
-        {        
-          READ_CODE( pcVPS->getDirectDepTypeLenMinus2( ) + 2,  uiCode, "direct_dependency_type[i][j]" ); pcVPS->setDirectDependencyType( i, j , uiCode);
-        }
-      }
-    }
-
-    READ_FLAG ( uiCode,                    "vps_shvc_reserved_zero_flag" ); 
-
-#if H_3D    
-    READ_FLAG( uiCode,  "vps_extension2_flag" );
-    if (uiCode)
-    {
-      m_pcBitstream->readOutTrailingBits();
-
-      for( Int i = 0; i <= pcVPS->getMaxLayers() - 1; i++ )
-      {
-
-#if H_3D_ARP
-        pcVPS->setUseAdvRP  ( i, 0 );
-        pcVPS->setARPStepNum( i, 1 );
-#endif  
-        if ( i != 0 )
-        {
-          if( !( pcVPS->getDepthId( i ) == 1 ) )
-          {
-#if H_3D_IV_MERGE
-                READ_FLAG( uiCode, "iv_mv_pred_flag[i]");          pcVPS->setIvMvPredFlag         ( i, uiCode == 1 ? true : false );
-#endif
-#if H_3D_ARP
-                READ_FLAG( uiCode, "iv_res_pred_flag[i]"  );  pcVPS->setUseAdvRP  ( i, uiCode ); pcVPS->setARPStepNum( i, uiCode ? H_3D_ARP_WFNR : 1 );
-
-#endif
-#if H_3D_NBDV_REF
-                READ_FLAG( uiCode, "depth_refinement_flag[i]");    pcVPS->setDepthRefinementFlag  ( i, uiCode == 1 ? true : false );
-#endif
-#if H_3D_VSP
-                READ_FLAG( uiCode, "view_synthesis_pred_flag[i]"); pcVPS->setViewSynthesisPredFlag( i, uiCode == 1 ? true : false );
-#endif
-          }
-          else
-          {
-
-            READ_FLAG( uiCode, "vps_depth_modes_flag[i]" );             pcVPS->setVpsDepthModesFlag( i, uiCode == 1 ? true : false );
-            //          READ_FLAG( uiCode, "lim_qt_pred_flag[i]");                  pcVPS->setLimQtPreFlag     ( i, uiCode == 1 ? true : false ); 
-#if H_3D_DIM_DLT
-            if( pcVPS->getVpsDepthModesFlag( i ) )
-            {
-              READ_FLAG( uiCode, "dlt_flag[i]" );                       pcVPS->setUseDLTFlag( i, uiCode == 1 ? true : false );
-            }
-            if( pcVPS->getUseDLTFlag( i ) )
-            {
-              // decode mapping
-              UInt uiNumDepthValues;
-              // parse number of values in DLT
-              READ_UVLC(uiNumDepthValues, "num_depth_values_in_dlt[i]");
-
-              // parse actual DLT values
-              Int* aiIdx2DepthValue = (Int*) calloc(uiNumDepthValues, sizeof(Int));
-              for(Int d=0; d<uiNumDepthValues; d++)
-              {
-                READ_UVLC(uiCode, "dlt_depth_value[i][d]");
-                aiIdx2DepthValue[d] = (Int)uiCode;
-              }
-
-              pcVPS->setDepthLUTs(i, aiIdx2DepthValue, uiNumDepthValues);
-
-              // clean memory
-              free(aiIdx2DepthValue);
-            }
-#endif
-#if H_3D_INTER_SDC
-            READ_FLAG( uiCode, "depth_inter_SDC_flag" );              pcVPS->setInterSDCFlag( i, uiCode ? true : false );
-#endif
-          }
-        }
-      }
-      READ_FLAG( uiCode, "iv_mv_scaling_flag");                       pcVPS->setIvMvScalingFlag( uiCode == 1 ? true : false ); 
-    }
-#endif
-    pcVPS->checkVPSExtensionSyntax(); 
-
-    pcVPS->setRefLayers(); 
-
-#else
-    while ( xMoreRbspData() )
-    {
-      READ_FLAG( uiCode, "vps_extension_data_flag");
-    }
-#endif    
-  }
-
-#if H_3D
-  pcVPS->initViewIndex(); 
-#endif
-  return;
-}
-#else
 #if H_MV
     m_pcBitstream->readOutTrailingBits();
@@ -1306,7 +958,5 @@
   }
 }
-#endif
-
-#if H_MV5
+
 #if H_MV
 Void TDecCavlc::parseVPSExtension( TComVPS* pcVPS )
@@ -1649,5 +1299,4 @@
 }
 #endif
-#endif
 
 Void TDecCavlc::parseSliceHeader (TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager)
@@ -1680,5 +1329,4 @@
 #if H_MV
   vps = parameterSetManager->getPrefetchedVPS(sps->getVPSId());
-#if H_MV5
   assert( vps != NULL );
   
@@ -1692,13 +1340,4 @@
   rpcSlice->setIsDepth  ( vps->getDepthId  ( rpcSlice->getLayerId() ) == 1 );
 #endif
-#else
-  assert(vps!=0);
-  rpcSlice->setVPS(vps);      
-  rpcSlice->setViewId   ( vps->getViewId   ( rpcSlice->getLayerIdInVps() )      );
-#if H_3D  
-  rpcSlice->setViewIndex( vps->getViewIndex( rpcSlice->getLayerIdInVps() )      );  
-  rpcSlice->setIsDepth  ( vps->getDepthId  ( rpcSlice->getLayerIdInVps() ) == 1 );
-#endif
-#endif
 #endif
   rpcSlice->setSPS(sps);
@@ -1747,5 +1386,4 @@
   {
 #if H_MV    
-#if H_MV5
     Int esb = 0; //Don't use i, otherwise will shadow something below
     if ( rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
@@ -1762,12 +1400,4 @@
 
     for (; esb < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); esb++)    
-#else
-    if ( rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > 0 )
-    {
-      READ_FLAG( uiCode, "discardable_flag" ); rpcSlice->setDiscardableFlag( uiCode == 1 );
-    }
-
-    for (Int i = 1; i < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++)    
-#endif
 #else
     for (Int i = 0; i < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++)
@@ -1833,5 +1463,4 @@
       }
       rpcSlice->setPOC              (iPOCmsb+iPOClsb);
-#if H_MV5
 #if H_MV
       if ( rpcSlice->getPocResetFlag() )  
@@ -1841,5 +1470,4 @@
 
       }      
-#endif
 #endif
       TComReferencePictureSet* rps;
@@ -1970,5 +1598,4 @@
     }
 #if H_MV
-#if H_MV5
     Int layerId       = rpcSlice->getLayerId(); 
     if( rpcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumDirectRefLayers( layerId ) > 0 )    {   
@@ -1989,29 +1616,4 @@
       }  
     }
-#else
-    Int layerIdInVps       = rpcSlice->getLayerIdInVps(); 
-    if( rpcSlice->getLayerId() > 0 && vps->getNumDirectRefLayers( layerIdInVps ) > 0 )
-    {   
-      READ_FLAG( uiCode, "inter_layer_pred_enabled_flag" ); rpcSlice->setInterLayerPredEnabledFlag( uiCode == 1 );
-      if( rpcSlice->getInterLayerPredEnabledFlag() && vps->getNumDirectRefLayers( layerIdInVps ) > 1 )
-      {            
-        if( !vps->getMaxOneActiveRefLayerFlag())  
-        {
-          READ_CODE( rpcSlice->getNumInterLayerRefPicsMinus1Len( ), uiCode, "num_inter_layer_ref_pics_minus1" ); rpcSlice->setNumInterLayerRefPicsMinus1( uiCode );
-        }
-        for( Int i = 0; i < rpcSlice->getNumActiveRefLayerPics(); i++ )   
-        {
-          READ_CODE( rpcSlice->getInterLayerPredLayerIdcLen( ), uiCode, "inter_layer_pred_layer_idc" ); rpcSlice->setInterLayerPredLayerIdc( i, uiCode );
-        }
-      }  
-    }
-
-    rpcSlice->setActiveMotionPredRefLayers( );
-
-    if( vps->getNumSamplePredRefLayers( layerIdInVps ) > 0  &&  rpcSlice->getNumActiveRefLayerPics() > 0 )
-    {
-      READ_FLAG( uiCode, "inter_layer_sample_pred_only_flag" ); rpcSlice->setInterLayerSamplePredOnlyFlag( uiCode == 1 );
-    }
-#endif
 #endif
     if(sps->getUseSAO())
@@ -2155,19 +1757,4 @@
     if ( rpcSlice->getEnableTMVPFlag() )
     {
-#if !H_MV5
-#if H_MV
-      if( rpcSlice->getLayerId() > 0 && rpcSlice->getNumActiveMotionPredRefLayers() > 0 )
-      {
-        READ_FLAG( uiCode, "alt_collocated_indication_flag" ); rpcSlice->setAltCollocatedIndicationFlag( uiCode == 1 );
-      }
-
-      if( rpcSlice->getAltCollocatedIndicationFlag() && rpcSlice->getNumActiveMotionPredRefLayers() > 1 ) 
-      {          
-        READ_UVLC( uiCode, "collocated_ref_layer_idx" ); rpcSlice->setCollocatedRefLayerIdx( uiCode );
-      }      
-      else 
-      {
-#endif
-#endif
       if ( rpcSlice->getSliceType() == B_SLICE )
       {
@@ -2191,9 +1778,4 @@
         rpcSlice->setColRefIdx(0);
       }
-#if !H_MV5
-#if H_MV
-      }
-#endif
-#endif
     }
     if ( (pps->getUseWP() && rpcSlice->getSliceType()==P_SLICE) || (pps->getWPBiPred() && rpcSlice->getSliceType()==B_SLICE) )
Index: branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibDecoder/TDecCAVLC.h
===================================================================
--- branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 647)
+++ branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 648)
@@ -76,5 +76,4 @@
   Void  parseQtRootCbf      ( UInt uiAbsPartIdx, UInt& uiQtRootCbf );
   Void  parseVPS            ( TComVPS* pcVPS );
-#if H_MV5
 #if H_MV
   Void  parseVPSExtension   ( TComVPS* pcVPS ); 
@@ -86,10 +85,7 @@
   Void  parseSPSExtension   ( TComSPS* pcSPS );  
 #endif
-#endif
 #if H_3D
-#if H_MV5
   Void  parseVPSExtension2  ( TComVPS* pcVPS ); 
   Void  parseSPSExtension2  ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag );
-#endif
   Void  parseSPS            ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag );
 #else
Index: branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibDecoder/TDecTop.cpp	(revision 647)
+++ branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibDecoder/TDecTop.cpp	(revision 648)
@@ -436,9 +436,7 @@
   Window defaultDisplayWindow = pcSlice->getSPS()->getVuiParametersPresentFlag() ? pcSlice->getSPS()->getVuiParameters()->getDefaultDisplayWindow() : Window();
 
-#if H_MV5
 #if H_MV
     assert( conformanceWindow   .getScaledFlag() ); 
     assert( defaultDisplayWindow.getScaledFlag() );
-#endif
 #endif
   for( Int temporalLayer=0; temporalLayer < MAX_TLAYER; temporalLayer++) 
@@ -518,9 +516,5 @@
   m_cCuDecoder.destroy();        
 #if H_MV 
-#if H_MV5
   TComSlice::markIvRefPicsAsShortTerm( m_refPicSetInterLayer0, m_refPicSetInterLayer1 );  
-#else
-  TComSlice::markIvRefPicsAsShortTerm( m_refPicSetInterLayer );  
-#endif
   TComSlice::markCurrPic( pcPic ); 
   TComSlice::markIvRefPicsAsUnused   ( m_ivPicLists, targetDecLayerIdSet, m_parameterSetManagerDecoder.getActiveVPS(), m_layerId, poc ); 
@@ -591,5 +585,4 @@
   assert (sps != 0);
 
-#if H_MV5
 #if H_MV
   TComVPS* vps = m_parameterSetManagerDecoder.getVPS(sps->getVPSId());
@@ -599,7 +592,4 @@
   if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP()))
 #endif
-#else
-  if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP()))
-#endif
   {
     printf ("Parameter set activation failed!");
@@ -627,11 +617,7 @@
   m_apcSlicePilot->setSPS(sps);
 #if H_MV
-#if H_MV5
   m_apcSlicePilot->setVPS(vps);  
   sps->inferRepFormat  ( vps , m_layerId ); 
   sps->inferScalingList( m_parameterSetManagerDecoder.getActiveSPS( sps->getSpsScalingListRefLayerId() ) ); 
-#else
-  m_apcSlicePilot->setVPS( m_parameterSetManagerDecoder.getActiveVPS() );
-#endif
 #endif
   pps->setSPS(sps);
@@ -695,9 +681,5 @@
 
 #if H_MV
-#if H_MV5
   m_apcSlicePilot->setRefPicSetInterLayer( & m_refPicSetInterLayer0, &m_refPicSetInterLayer1 ); 
-#else
-  m_apcSlicePilot->setRefPicSetInterLayer( & m_refPicSetInterLayer ); 
-#endif
   m_apcSlicePilot->setLayerId( nalu.m_layerId );
 #endif
@@ -706,5 +688,4 @@
 #if H_MV  
   TComVPS* vps     = m_apcSlicePilot->getVPS();
-#if H_MV5
   Int layerId  = nalu.m_layerId;   
   setViewId   ( vps->getViewId   ( layerId )      );  
@@ -714,13 +695,4 @@
   m_ivPicLists->setVPS( vps ); 
 #endif
-#else
-  Int layerIdInVps = vps->getLayerIdInVps( nalu.m_layerId );  
-  setViewId   ( vps->getViewId   ( layerIdInVps )      );  
-#if H_3D
-  setViewIndex( vps->getViewIndex( layerIdInVps )      );  
-  setIsDepth  ( vps->getDepthId  ( layerIdInVps ) == 1 );  
-  m_ivPicLists->setVPS( vps ); 
-#endif
-#endif
 #endif
     // Skip pictures due to random access
@@ -763,5 +735,4 @@
 #endif
   // actual decoding starts here
-#if H_MV5
 #if H_MV
    // This part needs further testing !
@@ -771,5 +742,4 @@
    }
 #endif
-#endif
   xActivateParameterSets();
 
@@ -791,9 +761,5 @@
     m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS());
 #if H_MV
-#if H_MV5
     m_apcSlicePilot->createInterLayerReferencePictureSet( m_ivPicLists, m_refPicSetInterLayer0, m_refPicSetInterLayer1 ); 
-#else
-    m_apcSlicePilot->createAndApplyIvReferencePictureSet( m_ivPicLists, m_refPicSetInterLayer ); 
-#endif
 #endif
     //  Get a new picture buffer
@@ -941,5 +907,4 @@
     // Set reference list
 #if H_MV    
-#if H_MV5
     std::vector< TComPic* > tempRefPicLists[2];
     std::vector< Bool     > usedAsLongTerm [2];
@@ -948,7 +913,4 @@
     pcSlice->getTempRefPicLists( m_cListPic, m_refPicSetInterLayer0, m_refPicSetInterLayer1, tempRefPicLists, usedAsLongTerm, numPocTotalCurr);
     pcSlice->setRefPicList     ( tempRefPicLists, usedAsLongTerm, numPocTotalCurr, true ); 
-#else
-    pcSlice->setRefPicList( m_cListPic, m_refPicSetInterLayer, true );    
-#endif
 #if H_3D_ARP
     pcSlice->setARPStepNum();
@@ -1088,11 +1050,6 @@
   TComVPS* vps = m_parameterSetManagerDecoder.getPrefetchedVPS( 0 ); 
   assert( vps != 0 ); 
-#if H_MV5
   m_cEntropyDecoder.decodeSPS( sps, vps->getViewIndex( m_layerId ), ( vps->getDepthId( m_layerId ) == 1 ) );
 #else
-  Int layerIdInVPS = vps->getLayerIdInVps( m_layerId ); 
-  m_cEntropyDecoder.decodeSPS( sps, vps->getViewIndex( layerIdInVPS ), ( vps->getDepthId( layerIdInVPS ) == 1 ) );
-#endif
-#else
   m_cEntropyDecoder.decodeSPS( sps );
 #endif
@@ -1103,8 +1060,6 @@
 {
   TComPPS* pps = new TComPPS();
-#if H_MV5
 #if H_MV
   pps->setLayerId( getLayerId() ); 
-#endif
 #endif
   m_cEntropyDecoder.decodePPS( pps );
@@ -1116,5 +1071,4 @@
   if(nalUnitType == NAL_UNIT_SUFFIX_SEI)
   {
-#if H_MV5
 #if H_MV
     m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS( m_layerId ) );
@@ -1122,11 +1076,7 @@
     m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() );
 #endif
-#else
-    m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() );  
-#endif
   }
   else
   {
-#if H_MV5
 #if H_MV
     m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveSPS( m_layerId ) );
@@ -1134,7 +1084,4 @@
     m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() );
 #endif
-#else
-    m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() );
-#endif
     SEIMessages activeParamSets = getSeisByType(m_SEIs, SEI::ACTIVE_PARAMETER_SETS);
     if (activeParamSets.size()>0)
@@ -1143,10 +1090,6 @@
       m_parameterSetManagerDecoder.applyPrefetchedPS();
       assert(seiAps->activeSeqParamSetId.size()>0);
-#if H_MV5
 #if H_MV
       if (! m_parameterSetManagerDecoder.activateSPSWithSEI(seiAps->activeSeqParamSetId[0], m_layerId ))
-#else
-      if (! m_parameterSetManagerDecoder.activateSPSWithSEI(seiAps->activeSeqParamSetId[0] ))
-#endif
 #else
       if (! m_parameterSetManagerDecoder.activateSPSWithSEI(seiAps->activeSeqParamSetId[0] ))
@@ -1310,5 +1253,4 @@
 }
 
-#if H_MV5
 Void TDecTop::xResetPocInPicBuffer()
 {
@@ -1328,4 +1270,3 @@
 }
 #endif
-#endif
 //! \}
Index: branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibDecoder/TDecTop.h
===================================================================
--- branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibDecoder/TDecTop.h	(revision 647)
+++ branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibDecoder/TDecTop.h	(revision 648)
@@ -216,10 +216,6 @@
   Int                     m_viewId;
   TComPicLists*           m_ivPicLists;
-#if H_MV5
   std::vector<TComPic*>   m_refPicSetInterLayer0; 
   std::vector<TComPic*>   m_refPicSetInterLayer1; 
-#else
-  std::vector<TComPic*>   m_refPicSetInterLayer; 
-#endif
 #if H_3D
   Int                     m_viewIndex; 
@@ -279,7 +275,5 @@
   TComPic*  xGetPic( Int layerId, Int poc ); 
   Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, Bool newLayerFlag );  
-#if H_MV5
   Void      xResetPocInPicBuffer();
-#endif
 #else
   Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay);
Index: branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 647)
+++ branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 648)
@@ -229,5 +229,4 @@
     }
   }
-#if H_MV5
 #if H_MV
   if ( pcPPS->getLayerId() > 0 )
@@ -243,5 +242,4 @@
   {  
 #endif  
-#endif
   WRITE_FLAG( pcPPS->getScalingListPresentFlag() ? 1 : 0,                          "pps_scaling_list_data_present_flag" ); 
   if( pcPPS->getScalingListPresentFlag() )
@@ -252,8 +250,6 @@
     codeScalingList( m_pcSlice->getScalingList() );
   }
-#if H_MV5
 #if H_MV
   }
-#endif
 #endif
   WRITE_FLAG( pcPPS->getListsModificationPresentFlag(), "lists_modification_present_flag");
@@ -339,12 +335,4 @@
   {
     WRITE_FLAG(pcVUI->getTilesFixedStructureFlag(),             "tiles_fixed_structure_flag");
-#if !H_MV5
-#if H_MV
-    if ( pcSPS->getLayerId() > 0 )
-    {
-      WRITE_FLAG( pcVUI->getTileBoundariesAlignedFlag( ) ? 1 : 0 , "tile_boundaries_aligned_flag" );
-    }
-#endif
-#endif
     WRITE_FLAG(pcVUI->getMotionVectorsOverPicBoundariesFlag(),  "motion_vectors_over_pic_boundaries_flag");
     WRITE_FLAG(pcVUI->getRestrictedRefPicListsFlag(),           "restricted_ref_pic_lists_flag");
@@ -451,5 +439,4 @@
 #endif
   WRITE_UVLC( pcSPS->getSPSId (),                   "sps_seq_parameter_set_id" );
-#if H_MV5
 #if H_MV
   if ( pcSPS->getLayerId() > 0 )
@@ -460,5 +447,4 @@
   if ( pcSPS->getUpdateRepFormatFlag() )
   { 
-#endif
 #endif
   WRITE_UVLC( pcSPS->getChromaFormatIdc (),         "chroma_format_idc" );
@@ -472,8 +458,6 @@
   WRITE_UVLC( pcSPS->getPicWidthInLumaSamples (),   "pic_width_in_luma_samples" );
   WRITE_UVLC( pcSPS->getPicHeightInLumaSamples(),   "pic_height_in_luma_samples" );
-#if H_MV5
 #if H_MV
   }
-#endif
 #endif
   Window conf = pcSPS->getConformanceWindow();
@@ -487,16 +471,12 @@
     WRITE_UVLC( conf.getWindowBottomOffset() / TComSPS::getWinUnitY(pcSPS->getChromaFormatIdc() ), "conf_win_bottom_offset" );
   }
-#if H_MV5
 #if H_MV
   if ( pcSPS->getUpdateRepFormatFlag() )
   { 
 #endif
-#endif
   WRITE_UVLC( pcSPS->getBitDepthY() - 8,             "bit_depth_luma_minus8" );
   WRITE_UVLC( pcSPS->getBitDepthC() - 8,             "bit_depth_chroma_minus8" );
-#if H_MV5
 #if H_MV
   }
-#endif
 #endif
   WRITE_UVLC( pcSPS->getBitsForPOC()-4,                 "log2_max_pic_order_cnt_lsb_minus4" );
@@ -525,5 +505,4 @@
   if(pcSPS->getScalingListFlag())
   {
-#if H_MV5
 #if H_MV
     if ( pcSPS->getLayerId() > 0 )
@@ -539,5 +518,4 @@
     {    
 #endif
-#endif
     WRITE_FLAG( pcSPS->getScalingListPresentFlag() ? 1 : 0,                          "sps_scaling_list_data_present_flag" ); 
     if(pcSPS->getScalingListPresentFlag())
@@ -548,8 +526,6 @@
       codeScalingList( m_pcSlice->getScalingList() );
     }
-#if H_MV5
 #if H_MV
     }
-#endif
 #endif
   }
@@ -598,61 +574,4 @@
   }
 
-#if !H_MV5
-#if H_MV
-  WRITE_FLAG( 1, "sps_extension_flag" );
-  WRITE_FLAG( pcSPS->getInterViewMvVertConstraintFlag() ? 1 : 0, "inter_view_mv_vert_constraint_flag" );
-  ////   sps_extension_vui_parameters( )
-  if( pcSPS->getVuiParameters()->getBitstreamRestrictionFlag() )
-  {  
-    WRITE_UVLC( pcSPS->getNumIlpRestrictedRefLayers( ),           "num_ilp_restricted_ref_layers" ); 
-    for( Int i = 0; i < pcSPS->getNumIlpRestrictedRefLayers( ); i++ ) 
-    {  
-      WRITE_UVLC( pcSPS->getMinSpatialSegmentOffsetPlus1( i ),    "min_spatial_segment_offset_plus1" ); 
-      if( pcSPS->getMinSpatialSegmentOffsetPlus1( i ) > 0 ) 
-      {  
-        WRITE_FLAG( pcSPS->getCtuBasedOffsetEnabledFlag( i ),      "ctu_based_offset_enabled_flag[ i ]"); 
-        if( pcSPS->getCtuBasedOffsetEnabledFlag( i ) )  
-        {
-          WRITE_UVLC( pcSPS->getMinHorizontalCtuOffsetPlus1( i ), "min_horizontal_ctu_offset_plus1[ i ]"); 
-        }
-      }  
-    }  
-  } 
-#if H_3D_QTLPC
-  if( depthFlag )
-  {
-    WRITE_FLAG( pcSPS->getUseQTL() ? 1 : 0, "use_qtl_flag");
-    WRITE_FLAG( pcSPS->getUsePC()  ? 1 : 0, "use_pc_flag");
-  }
-#endif
-  ////   sps_extension_vui_parameters( ) END
-  WRITE_UVLC( 0, "sps_shvc_reserved_zero_idc" ); 
-#if !H_3D
-  WRITE_FLAG( 0, "sps_extension2_flag" );
-#else
-  WRITE_FLAG( 1, "sps_extension2_flag"  );
-  if (!depthFlag )
-  {
-    WRITE_UVLC( pcSPS->getCamParPrecision(), "cp_precision" );
-    WRITE_FLAG( pcSPS->hasCamParInSliceHeader() ? 1 : 0, "cp_in_slice_header_flag" );
-    if( !pcSPS->hasCamParInSliceHeader() )
-    {
-      for( UInt uiIndex = 0; uiIndex < viewIndex; uiIndex++ )
-      {
-        WRITE_SVLC( pcSPS->getCodedScale    ()[ uiIndex ],                                      "cp_scale" );
-        WRITE_SVLC( pcSPS->getCodedOffset   ()[ uiIndex ],                                      "cp_off" );
-        WRITE_SVLC( pcSPS->getInvCodedScale ()[ uiIndex ] + pcSPS->getCodedScale ()[ uiIndex ], "cp_inv_scale_plus_scale" );
-        WRITE_SVLC( pcSPS->getInvCodedOffset()[ uiIndex ] + pcSPS->getCodedOffset()[ uiIndex ], "cp_inv_off_plus_off" );
-      }
-    }
-  }
-
-  WRITE_FLAG( 0, "sps_extension3_flag" );
-#endif
-#else
-  WRITE_FLAG( 0, "sps_extension_flag" );
-#endif
-}
-#else
 #if !H_MV
   WRITE_FLAG( 0, "sps_extension_flag" );
@@ -706,5 +625,4 @@
 }
 #endif
-#endif
 
 Void TEncCavlc::codeVPS( TComVPS* pcVPS )
@@ -713,9 +631,5 @@
   WRITE_CODE( 3,                                    2,        "vps_reserved_three_2bits" );
 #if H_MV
-#if H_MV5
   WRITE_CODE( pcVPS->getMaxLayersMinus1(),       6,        "vps_max_layers_minus1" );
-#else
-  WRITE_CODE( pcVPS->getMaxLayers() - 1,            6,        "vps_max_layers_minus1" );
-#endif
 #else
   WRITE_CODE( 0,                                    6,        "vps_reserved_zero_6bits" );
@@ -800,191 +714,4 @@
     }
   }
-#if !H_MV5
-#if H_MV
-  WRITE_FLAG( 1,                                             "vps_extension_flag" );
-
-  m_pcBitIf->writeAlignOne();                        
-
-  WRITE_FLAG( pcVPS->getAvcBaseLayerFlag() ? 1 : 0,          "avc_base_layer_flag" );
-  WRITE_FLAG( pcVPS->getSplittingFlag() ? 1 : 0,             "splitting_flag" );
-  
-  for( Int type = 0; type < MAX_NUM_SCALABILITY_TYPES; type++ )
-  {
-    WRITE_FLAG( pcVPS->getScalabilityMask( type ) ? 1 : 0,   "scalability_mask[i]" );
-  }
-
-  for( Int sIdx = 0; sIdx < pcVPS->getNumScalabilityTypes( ) - ( pcVPS->getSplittingFlag() ? 1 : 0 ); sIdx++ )
-  {
-    WRITE_CODE( pcVPS->getDimensionIdLen( sIdx ) - 1 , 3,    "dimension_id_len_minus1[j]");    
-  }
-
-  if ( pcVPS->getSplittingFlag() )
-  { // Ignore old dimension id length
-    pcVPS->setDimensionIdLen( pcVPS->getNumScalabilityTypes( ) - 1 ,pcVPS->inferLastDimsionIdLenMinus1() + 1 );       
-  }    
-
-
-  WRITE_FLAG( pcVPS->getVpsNuhLayerIdPresentFlag() ? 1 : 0,  "vps_nuh_layer_id_present_flag");
-
-  for( Int i = 0; i <= pcVPS->getMaxLayers() - 1; i++ )
-  {
-    if ( pcVPS->getVpsNuhLayerIdPresentFlag() && ( i > 0 ) )
-    {      
-      WRITE_CODE( pcVPS->getLayerIdInNuh( i ), 6,          "layer_id_in_nuh[i]");
-  }
-    else
-    {
-      assert( pcVPS->getLayerIdInNuh( i ) == i ); 
-  }
-
-    assert(  pcVPS->getLayerIdInVps( pcVPS->getLayerIdInNuh( i ) ) == i ); 
-
-    for( Int j = 0; j < pcVPS->getNumScalabilityTypes() ; j++ )
-  {
-      if ( !pcVPS->getSplittingFlag() )
-    {
-        WRITE_CODE( pcVPS->getDimensionId( i, j ), pcVPS->getDimensionIdLen( j ), "dimension_id[i][j]");      
-      }
-      else
-      {
-        assert( pcVPS->getDimensionId( i, j ) ==  pcVPS->inferDimensionId( i, j )  );
-      }
-    }
-  }
-
-  for( Int i = 1; i <= pcVPS->getMaxLayers() - 1; i++ )
-  {
-    for( Int j = 0; j < i; j++ )
-    {
-      WRITE_FLAG( pcVPS->getDirectDependencyFlag( i, j ),    "direct_dependency_flag[i][j]" );
-    }
-  }
-
-  for( Int i = 0; i < pcVPS->getMaxLayers() - 1; i++ )
-  {
-    WRITE_CODE( pcVPS->getMaxTidIlRefPicPlus1( i ), 3,       "max_tid_il_ref_pics_plus1[i]" );
-  }
-
-  WRITE_CODE( pcVPS->getVpsNumberLayerSetsMinus1( )    , 10,    "vps_number_layer_sets_minus1"      );
-  WRITE_CODE( pcVPS->getVpsNumProfileTierLevelMinus1( ), 6,     "vps_num_profile_tier_level_minus1" );
-
-  for( Int i = 1; i <= pcVPS->getVpsNumProfileTierLevelMinus1(); i++ )
-  {
-    WRITE_FLAG( pcVPS->getVpsProfilePresentFlag( i ) ? 1 : 0, "vps_profile_present_flag[i]" );
-    if( !pcVPS->getVpsProfilePresentFlag( i ) )
-    {    
-      WRITE_CODE( pcVPS->getProfileRefMinus1( i ), 6, "profile_ref_minus1[i]" );
-    }
-    codePTL( pcVPS->getPTL( i ), pcVPS->getVpsProfilePresentFlag( i ), pcVPS->getMaxTLayers() - 1 );
-  }
-
-  Int numOutputLayerSets = pcVPS->getVpsNumberLayerSetsMinus1( ) + 1; 
-
-  WRITE_FLAG( pcVPS->getMoreOutputLayerSetsThanDefaultFlag( ) ? 1 : 0, "more_output_layer_sets_than_default_flag" );
-
-  if ( pcVPS->getMoreOutputLayerSetsThanDefaultFlag( ) )
-  {
-    WRITE_CODE( pcVPS->getNumAddOutputLayerSetsMinus1( )    , 10,    "num_add_output_layer_sets_minus1"      );
-    numOutputLayerSets += ( pcVPS->getNumAddOutputLayerSetsMinus1( ) + 1 ); 
-  }
-
-  if( numOutputLayerSets > 1)
-  {
-    WRITE_FLAG( pcVPS->getDefaultOneTargetOutputLayerFlag( ) ? 1 : 0, "default_one_target_output_layer_flag" );
-  }  
-
-  for( Int i = 1; i < numOutputLayerSets; i++ )
-  {
-    if( i > pcVPS->getVpsNumberLayerSetsMinus1( ) )
-    {      
-      WRITE_UVLC( pcVPS->getOutputLayerSetIdxMinus1( i ),      "output_layer_set_idx_minus1[i]" );
-      for( Int j = 0; j < pcVPS->getNumLayersInIdList( j ) - 1 ; j++ )
-      {
-        WRITE_FLAG( pcVPS->getOutputLayerFlag( i, j) ? 1 : 0, "output_layer_flag" );
-      }      
-    }
-    if ( pcVPS->getProfileLevelTierIdxLen()  > 0 )
-    {      
-      WRITE_CODE( pcVPS->getProfileLevelTierIdx( i ), pcVPS->getProfileLevelTierIdxLen() ,"profile_level_tier_idx[ i ]" );   
-    }
-  }
-
-  WRITE_FLAG( pcVPS->getMaxOneActiveRefLayerFlag( ) ? 1 : 0, "max_one_active_ref_layer_flag" );
-  WRITE_UVLC( pcVPS->getDirectDepTypeLenMinus2 ( ),         "direct_dep_type_len_minus2"); 
-
-    for( Int i = 1; i <= pcVPS->getMaxLayers() - 1; i++ )
-    {
-      for( Int j = 0; j < i; j++ )
-      {
-        if (pcVPS->getDirectDependencyFlag( i, j) )
-        {        
-          assert ( pcVPS->getDirectDependencyType( i, j ) != -1 ); 
-          WRITE_CODE( pcVPS->getDirectDependencyType( i, j ),pcVPS->getDirectDepTypeLenMinus2( ) + 2,  "direct_dependency_type[i][j]" );
-        }
-      }
-    }
-
-    WRITE_FLAG ( 0,                    "vps_shvc_reserved_zero_flag" ); 
-
-#if H_3D
-  WRITE_FLAG( 1,                                             "vps_extension2_flag" );
-  m_pcBitIf->writeAlignOne();      
-  for( Int i = 0; i <= pcVPS->getMaxLayers() - 1; i++ )
-  {
-    if (i!= 0)
-    {
-      if ( !( pcVPS->getDepthId( i ) == 1 ) )
-      {
-#if H_3D_IV_MERGE
-        WRITE_FLAG( pcVPS->getIvMvPredFlag         ( i ) ? 1 : 0 , "iv_mv_pred_flag[i]");
-#endif
-#if H_3D_ARP
-        WRITE_FLAG( pcVPS->getUseAdvRP             ( i ) ? 1 : 0,  "iv_res_pred_flag[i]"  );
-#endif
-#if H_3D_NBDV_REF
-        WRITE_FLAG( pcVPS->getDepthRefinementFlag  ( i ) ? 1 : 0 , "depth_refinement_flag[i]");
-#endif
-#if H_3D_VSP
-        WRITE_FLAG( pcVPS->getViewSynthesisPredFlag( i ) ? 1 : 0 , "view_synthesis_pred_flag[i]");
-#endif
-      }          
-      else
-      {
-        WRITE_FLAG( pcVPS->getVpsDepthModesFlag( i ) ? 1 : 0 ,          "vps_depth_modes_flag[i]" );
-        //WRITE_FLAG( pcVPS->getLimQtPredFlag    ( i ) ? 1 : 0 ,          "lim_qt_pred_flag[i]"     ); 
-#if H_3D_DIM_DLT
-        if( pcVPS->getVpsDepthModesFlag( i ) )
-        {
-          WRITE_FLAG( pcVPS->getUseDLTFlag( i ) ? 1 : 0, "dlt_flag[i]" );
-        }
-        if( pcVPS->getUseDLTFlag( i ) )
-        {
-          // code mapping
-          WRITE_UVLC(pcVPS->getNumDepthValues(i), "num_depth_values_in_dlt[i]");
-          for(Int d=0; d<pcVPS->getNumDepthValues(i); d++)
-          {
-            WRITE_UVLC( pcVPS->idx2DepthValue(i, d), "dlt_depth_value[i][d]" );
-          }
-        }        
-#endif
-#if H_3D_INTER_SDC
-        WRITE_FLAG( pcVPS->getInterSDCFlag( i ) ? 1 : 0, "depth_inter_SDC_flag" );
-#endif
-      }
-    }  
-  }
-  WRITE_FLAG( pcVPS->getIvMvScalingFlag( ) ? 1 : 0 ,          "iv_mv_scaling_flag" );
-#else
-  WRITE_FLAG( 0,                                             "vps_extension2_flag" );
-#endif
-#else
-  WRITE_FLAG( 0,                     "vps_extension_flag" );
-#endif
-  
-  //future extensions here..
-  
-  return;
-}
-#else
 #if H_MV
   WRITE_FLAG( 1,                     "vps_extension_flag" );
@@ -1005,8 +732,6 @@
 }
 
-#endif
-
-
-#if H_MV5
+
+
 #if H_MV
 Void TEncCavlc::codeVPSExtension( TComVPS *pcVPS ) 
@@ -1320,5 +1045,4 @@
 }
 #endif
-#endif
 
 Void TEncCavlc::codeSliceHeader         ( TComSlice* pcSlice )
@@ -1370,5 +1094,4 @@
   {
 #if H_MV    
-#if H_MV5
     Int esb = 0;  //Don't use i, otherwise will shadow something below
     if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
@@ -1385,12 +1108,4 @@
 
     for (; esb < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); esb++)    
-#else
-    if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > 0 )
-    {
-      WRITE_FLAG( pcSlice->getDiscardableFlag( ) ? 1 : 0 , "discardable_flag" );
-    }
-
-    for (Int i = 1; i < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++)    
-#endif
 #else
     for (Int i = 0; i < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++)
@@ -1530,5 +1245,4 @@
     }
 #if H_MV
-#if H_MV5
     Int layerId = pcSlice->getLayerId(); 
     if( pcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumDirectRefLayers( layerId ) > 0 )
@@ -1550,28 +1264,4 @@
       }  
     }
-#else
-    Int layerIdInVps       = pcSlice->getLayerIdInVps(); 
-    if( pcSlice->getLayerId() > 0 && vps->getNumDirectRefLayers( layerIdInVps ) > 0 )
-    {   
-      WRITE_FLAG( pcSlice->getInterLayerPredEnabledFlag( ) ? 1 : 0 , "inter_layer_pred_enabled_flag" );
-      if( pcSlice->getInterLayerPredEnabledFlag() && vps->getNumDirectRefLayers( layerIdInVps ) > 1 )
-      {            
-        if( !vps->getMaxOneActiveRefLayerFlag())  
-        {
-          WRITE_CODE( pcSlice->getNumInterLayerRefPicsMinus1( ), pcSlice->getNumInterLayerRefPicsMinus1Len( ), "num_inter_layer_ref_pics_minus1" );
-        }
-        for( Int i = 0; i < pcSlice->getNumActiveRefLayerPics(); i++ )   
-        {
-          WRITE_CODE( pcSlice->getInterLayerPredLayerIdc( i ), pcSlice->getInterLayerPredLayerIdcLen( ), "inter_layer_pred_layer_idc" );
-        }
-      }  
-    }
-
-    if( vps->getNumSamplePredRefLayers( layerIdInVps ) > 0  &&  pcSlice->getNumActiveRefLayerPics() > 0 )
-    {
-      WRITE_FLAG( pcSlice->getInterLayerSamplePredOnlyFlag( ) ? 1 : 0 , "inter_layer_sample_pred_only_flag" );
-    }
-
-#endif
 #endif
     if(pcSlice->getSPS()->getUseSAO())
@@ -1678,18 +1368,4 @@
     if ( pcSlice->getEnableTMVPFlag() )
     {
-#if !H_MV5
-#if H_MV
-      if( pcSlice->getLayerId() > 0 && pcSlice->getNumActiveMotionPredRefLayers() > 0 )
-      {
-        WRITE_FLAG( pcSlice->getAltCollocatedIndicationFlag( ) ? 1 : 0 , "alt_collocated_indication_flag" );
-      }
-      if( pcSlice->getAltCollocatedIndicationFlag() && pcSlice->getNumActiveMotionPredRefLayers() > 1 ) 
-      {          
-        WRITE_UVLC( pcSlice->getCollocatedRefLayerIdx( ), "collocated_ref_layer_idx" );
-      }      
-      else 
-      {
-#endif
-#endif
       if ( pcSlice->getSliceType() == B_SLICE )
       {
@@ -1704,9 +1380,4 @@
       }
     }
-#if !H_MV5
-#if H_MV
-    }
-#endif
-#endif
     if ( (pcSlice->getPPS()->getUseWP() && pcSlice->getSliceType()==P_SLICE) || (pcSlice->getPPS()->getWPBiPred() && pcSlice->getSliceType()==B_SLICE) )
     {
Index: branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncCavlc.h
===================================================================
--- branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncCavlc.h	(revision 647)
+++ branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncCavlc.h	(revision 648)
@@ -84,5 +84,4 @@
   UInt  getCoeffCost          ()                { return  m_uiCoeffCost;  }
   Void  codeVPS                 ( TComVPS* pcVPS );
-#if H_MV5
 #if H_MV
   Void  codeVPSExtension       ( TComVPS *pcVPS );
@@ -90,16 +89,11 @@
   Void  codeVPSVUI             ( TComVPS* pcVPS );
 #endif 
-#endif
   Void  codeVUI                 ( TComVUI *pcVUI, TComSPS* pcSPS );
-#if H_MV5
 #if H_MV
   Void  codeSPSExtension        ( TComSPS* pcSPS ); 
 #endif
-#endif
 #if H_3D
-#if H_MV5
   Void  codeVPSExtension2       ( TComVPS* pcVPS ); 
   Void  codeSPSExtension2       ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag  ); 
-#endif
   Void  codeSPS                 ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag );
 #else
Index: branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncCfg.h
===================================================================
--- branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncCfg.h	(revision 647)
+++ branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncCfg.h	(revision 648)
@@ -77,7 +77,4 @@
   Int m_interLayerPredLayerIdc [MAX_NUM_REF_PICS];
   Int m_interViewRefPosL[2][MAX_NUM_REF_PICS];  
-#if !H_MV5
-  Int m_collocatedRefLayerIdx; 
-#endif
 #endif
   GOPEntry()
@@ -97,7 +94,4 @@
 #if H_MV
   , m_numActiveRefLayerPics(0)
-#if !H_MV5
-  , m_collocatedRefLayerIdx(-1)
-#endif
 #endif
   {
@@ -375,13 +369,8 @@
   Int       m_layerIdInVps;
   Int       m_viewId;
-#if H_MV5
   Int       m_viewIndex; 
-#endif
 #endif 
 
 #if H_3D
-#if !H_MV5
-  Int       m_viewIndex; 
-#endif
   Bool      m_isDepth;
 
@@ -440,11 +429,6 @@
   , m_layerIdInVps(-1)
   , m_viewId(-1)
-#if H_MV5
   , m_viewIndex(-1)
-#endif
 #if H_3D
-#if !H_MV5
-  , m_viewIndex(-1)
-#endif
   , m_isDepth(false)
   , m_bUseVSO(false)
@@ -479,13 +463,7 @@
   Void      setViewId                        ( Int viewId  )      { m_viewId  = viewId;  }
   Int       getViewId                        ()                   { return m_viewId;    }
-#if H_MV5
   Void      setViewIndex                     ( Int viewIndex  )   { m_viewIndex  = viewIndex;  }
   Int       getViewIndex                     ()                   { return m_viewIndex;    }
-#endif
 #if H_3D
-#if !H_MV5
-  Void      setViewIndex                     ( Int viewIndex  )   { m_viewIndex  = viewIndex;  }
-  Int       getViewIndex                     ()                   { return m_viewIndex;    }
-#endif
   Void      setIsDepth                       ( Bool isDepth )   { m_isDepth = isDepth; }
   Bool      getIsDepth                       ()                 { return m_isDepth; }
Index: branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 647)
+++ branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 648)
@@ -476,25 +476,13 @@
 
 
-#if H_MV5
 #if H_MV
     m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, m_pcEncTop->getVPS(), m_pcEncTop->getSPS(), m_pcEncTop->getPPS(), getLayerId() );     
 #else
     m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, m_pcEncTop->getSPS(), m_pcEncTop->getPPS() );
-#endif
-#else
-#if H_3D
-    m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, m_pcEncTop->getVPS(), m_pcEncTop->getSPS(), m_pcEncTop->getPPS(), getLayerId() );     
-#else
-    m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, m_pcEncTop->getSPS(), m_pcEncTop->getPPS() );
-#endif
 #endif
     pcSlice->setLastIDR(m_iLastIDR);
     pcSlice->setSliceIdx(0);
 #if H_MV
-#if H_MV5
     pcSlice->setRefPicSetInterLayer ( &m_refPicSetInterLayer0, &m_refPicSetInterLayer1 ); 
-#else
-    pcSlice->setRefPicSetInterLayer ( &m_refPicSetInterLayer ); 
-#endif
     pcPic  ->setLayerId     ( getLayerId()   );
     pcPic  ->setViewId      ( getViewId()    );    
@@ -659,5 +647,4 @@
     refPicListModification->setRefPicListModificationFlagL1(0);
 #if H_MV
-#if H_MV5
     if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > 1 )
     {
@@ -703,56 +690,4 @@
     xSetRefPicListModificationsMv( tempRefPicLists, pcSlice, iGOPid );    
 #else
-    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(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() ) ) );
-
-    xSetRefPicListModificationsMv( 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 );
-      }
-    }
-
-#endif
-#else
     pcSlice->setNumRefIdx(REF_PIC_LIST_0,min(m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive,pcSlice->getRPS()->getNumberOfPictures()));
     pcSlice->setNumRefIdx(REF_PIC_LIST_1,min(m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive,pcSlice->getRPS()->getNumberOfPictures()));
@@ -764,5 +699,4 @@
 
     //  Set reference list
-#if H_MV5
 #if H_MV    
     pcSlice->setRefPicList( tempRefPicLists, usedAsLongTerm, numPocTotalCurr ); 
@@ -786,26 +720,4 @@
       }
     }
-#endif
-#else
-#if H_MV    
-    pcSlice->setRefPicList( rcListPic, m_refPicSetInterLayer );
-#if H_3D_ARP
-    pcSlice->setARPStepNum();
-    if(pcSlice->getARPStepNum() > 1)
-    {
-      for(Int iLayerId = 0; iLayerId < getLayerId(); iLayerId ++ )
-      {
-        Int  iViewIdx =   pcSlice->getVPS()->getViewIndex(iLayerId);
-        Bool bIsDepth = ( pcSlice->getVPS()->getDepthId  ( iLayerId ) == 1 );
-        if( iViewIdx<getViewIndex() && !bIsDepth )
-        {
-          pcSlice->setBaseViewRefPicList( m_ivPicLists->getPicList( iLayerId ), iViewIdx );
-        }
-      }
-    }
-#endif
-#else
-    pcSlice->setRefPicList ( rcListPic );
-#endif
 #endif
 #if H_3D
@@ -2198,9 +2110,5 @@
       pcPic->setReconMark   ( true );
 #if H_MV
-#if H_MV5
       TComSlice::markIvRefPicsAsShortTerm( m_refPicSetInterLayer0, m_refPicSetInterLayer1 );  
-#else
-      TComSlice::markIvRefPicsAsShortTerm( m_refPicSetInterLayer );  
-#endif
       std::vector<Int> temp; 
       TComSlice::markCurrPic( pcPic ); 
@@ -3034,5 +2942,4 @@
 
 #if H_MV
-#if H_MV5
 Void TEncGOP::xSetRefPicListModificationsMv( std::vector<TComPic*> tempPicLists[2], TComSlice* pcSlice, UInt iGOPid )
 { 
@@ -3118,68 +3025,4 @@
   }
 }
-#else
-Void TEncGOP::xSetRefPicListModificationsMv( TComSlice* pcSlice, UInt iGOPid )
-{ 
-  Int layer    = pcSlice->getLayerIdInVps( ); 
-  
-  if( pcSlice->getSliceType() == I_SLICE || !(pcSlice->getPPS()->getListsModificationPresentFlag()) || pcSlice->getNumActiveRefLayerPics() == 0 )
-  {
-    return;
-  }
-
-  // analyze inter-view modifications
-  GOPEntry ge = m_pcCfg->getGOPEntry( (pcSlice->getRapPicFlag() && ( layer > 0) ) ? MAX_GOP : iGOPid );
-  assert( ge.m_numActiveRefLayerPics == pcSlice->getNumActiveRefLayerPics() ); 
-  
-  Int maxRefListSize  = pcSlice->getNumRpsCurrTempList();
-  Int numTemporalRefs = maxRefListSize - pcSlice->getNumActiveRefLayerPics();
-
-  for (Int li = 0; li < 2; li ++) // Loop over lists L0 and L1
-  {
-    // set inter-view modifications    
-    Int tempList[16];
-    for( Int k = 0; k < 16; k++ )
-    {
-      tempList[ k ] = -1;
-    }
-
-    Bool isModified = false;
-    if ( maxRefListSize > 1 )
-    {
-      for( Int k = 0, orgIdx = numTemporalRefs; k < ge.m_numActiveRefLayerPics; k++, orgIdx++ )
-      {
-          Int targetIdx = ge.m_interViewRefPosL[ li ][ k ];
-
-        isModified = ( targetIdx != orgIdx ) && ( targetIdx >= 0  );
-        if ( isModified )
-            {
-          assert( tempList[ targetIdx ] == -1 ); // Assert when two inter layer reference pictures are sorted to the same position
-              tempList[ targetIdx ] = orgIdx;              
-        }
-      }
-    }
-
-    TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification();
-    refPicListModification->setRefPicListModificationFlagL( li, isModified );  
-
-      if( isModified )
-      {
-        Int temporalRefIdx = 0;
-        for( Int i = 0; i < pcSlice->getNumRefIdx( ( li == 0 ) ? REF_PIC_LIST_0 : REF_PIC_LIST_1 ); i++ )
-        {
-          if( tempList[i] >= 0 ) 
-          {
-            refPicListModification->setRefPicSetIdxL( li, i, tempList[i] );
-          }
-          else
-          {
-            refPicListModification->setRefPicSetIdxL( li, i, temporalRefIdx );
-            temporalRefIdx++;
-          }
-        }
-      }
-  }
-}
-#endif
 #endif
 //! \}
Index: branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncGOP.h
===================================================================
--- branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncGOP.h	(revision 647)
+++ branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncGOP.h	(revision 648)
@@ -102,10 +102,6 @@
 #if H_MV
   TComPicLists*           m_ivPicLists;
-#if H_MV5
   std::vector<TComPic*>   m_refPicSetInterLayer0; 
   std::vector<TComPic*>   m_refPicSetInterLayer1; 
-#else
-  std::vector<TComPic*>   m_refPicSetInterLayer; 
-#endif
 
   Int                     m_pocLastCoded;
@@ -223,9 +219,5 @@
   }
 #if H_MV
-#if H_MV5
    Void  xSetRefPicListModificationsMv( std::vector<TComPic*> tempPicLists[2], TComSlice* pcSlice, UInt iGOPid );
-#else
-   Void  xSetRefPicListModificationsMv( TComSlice* pcSlice, UInt iGOPid );
-#endif
 #endif
   Void dblMetric( TComPic* pcPic, UInt uiNumSlices );
Index: branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncSlice.cpp
===================================================================
--- branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncSlice.cpp	(revision 647)
+++ branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncSlice.cpp	(revision 648)
@@ -187,16 +187,8 @@
  \param pPPS          PPS associated with the slice
  */
-#if H_MV5
 #if H_MV
 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComVPS* pVPS, TComSPS* pSPS, TComPPS *pPPS, Int layerId )
 #else
 Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS )
-#endif
-#else
-#if H_3D
-Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComVPS* pVPS, TComSPS* pSPS, TComPPS *pPPS, Int layerId )
-#else
-Void TEncSlice::initEncSlice( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS )
-#endif
 #endif
 {
@@ -206,5 +198,4 @@
   rpcSlice = pcPic->getSlice(0);
 
-#if H_MV5
   rpcSlice->setVPS( pVPS ); 
 
@@ -214,16 +205,4 @@
 #if H_3D
   rpcSlice->setIsDepth     ( pVPS->getDepthId     ( layerId ) != 0 );    
-#endif
-#else
-#if H_3D
-  // GT: Should also be activated for MV-HEVC at some stage
-  rpcSlice->setVPS( pVPS );
-  Int vpsLayerId = pVPS->getLayerIdInNuh( layerId ); 
-
-  rpcSlice->setLayerId     ( layerId );
-  rpcSlice->setViewId      ( pVPS->getViewId      ( vpsLayerId ) );    
-  rpcSlice->setViewIndex   ( pVPS->getViewIndex   ( vpsLayerId ) );
-  rpcSlice->setIsDepth     ( pVPS->getDepthId     ( vpsLayerId ) != 0 );    
-#endif
 #endif
   rpcSlice->setSPS( pSPS );
Index: branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncSlice.h
===================================================================
--- branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncSlice.h	(revision 647)
+++ branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncSlice.h	(revision 648)
@@ -116,5 +116,4 @@
   
   /// preparation of slice encoding (reference marking, QP and lambda)
-#if H_MV5
 #if H_MV
   Void    initEncSlice        ( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, 
@@ -123,13 +122,4 @@
   Void    initEncSlice        ( TComPic*  pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd,
                                 Int iGOPid,   TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS );
-#endif
-#else
-#if H_3D
-  Void    initEncSlice        ( TComPic* pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd, 
-                                Int iGOPid, TComSlice*& rpcSlice, TComVPS* pVPS, TComSPS* pSPS, TComPPS *pPPS, Int layerId ); 
-#else
-  Void    initEncSlice        ( TComPic*  pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd,
-                                Int iGOPid,   TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS );
-#endif
 #endif
 #if RATE_CONTROL_LAMBDA_DOMAIN
Index: branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncTop.cpp
===================================================================
--- branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncTop.cpp	(revision 647)
+++ branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibEncoder/TEncTop.cpp	(revision 648)
@@ -562,10 +562,8 @@
    * that chooses the actual compatibility based upon options */
 
-#if H_MV5
 #if H_MV  
   m_cSPS.setUpdateRepFormatFlag           ( m_layerId == 0 );    
   m_cSPS.setSpsInferScalingListFlag       ( m_layerId > 0 && m_cVPS->getInDirectDependencyFlag( getLayerIdInVps(), 0 ) ); 
   m_cSPS.setSpsScalingListRefLayerId      ( 0              ); 
-#endif
 #endif
   m_cSPS.setPicWidthInLumaSamples         ( m_iSourceWidth      );
@@ -691,10 +689,6 @@
 {
 #if H_MV
-#if H_MV5
   m_cPPS.setLayerId( getLayerId() );
   if( getVPS()->getNumDirectRefLayers( getLayerId() ) > 0 )
-#else
-  if( getVPS()->getNumDirectRefLayers( getLayerIdInVps() ) > 0 )
-#endif
   {
     m_cPPS.setListsModificationPresentFlag( true );
@@ -770,9 +764,5 @@
   m_cPPS.setOutputFlagPresentFlag( false );
 #if H_MV
-#if H_MV5
   m_cPPS.setNumExtraSliceHeaderBits( 2 ); 
-#else
-  m_cPPS.setNumExtraSliceHeaderBits( 1 ); 
-#endif
 #endif
   m_cPPS.setSignHideFlag(getSignHideFlag());
Index: branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibExtractor/TExtrTop.cpp
===================================================================
--- branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibExtractor/TExtrTop.cpp	(revision 647)
+++ branches/HTM-8.2-dev0-Cleanup/source/Lib/TLibExtractor/TExtrTop.cpp	(revision 648)
@@ -100,5 +100,4 @@
 Void TExtrTop::dumpVpsInfo( std::ostream& rcVpsInfoHandle )
 { 
-#if H_MV5
   rcVpsInfoHandle << "MaxLayers      = " << m_cVPS.getMaxLayersMinus1() + 1 << std::endl; 
   rcVpsInfoHandle << "MaxNuhLayerId  = " << m_cVPS.getVpsMaxLayerId() << std::endl;                      
@@ -114,18 +113,4 @@
 #endif
     rcVpsInfoHandle << "ViewId         = " << m_cVPS.getViewId        ( layerId ) << std::endl;     
-#else
-  rcVpsInfoHandle << "MaxLayers = "     << m_cVPS.getMaxLayers()     << std::endl; 
-  rcVpsInfoHandle << "MaxNuhLayerId = " << m_cVPS.getVpsMaxLayerId() << std::endl; 
-  
-  for ( Int layerIdxInVps = 0; layerIdxInVps < m_cVPS.getMaxLayers(); layerIdxInVps++ )
-  {  
-    rcVpsInfoHandle << "LayerIdxInVps =  " << layerIdxInVps                           << std::endl; 
-    rcVpsInfoHandle << "LayerIdInNuh = "   << m_cVPS.getLayerIdInNuh( layerIdxInVps ) << std::endl; 
-    rcVpsInfoHandle << "ViewId = "         << m_cVPS.getViewId      ( layerIdxInVps ) << std::endl; 
-#if H_3D
-    rcVpsInfoHandle << "DepthFlag = "      << m_cVPS.getViewIndex   ( layerIdxInVps ) << std::endl;     
-    rcVpsInfoHandle << "DepthFlag = "      << m_cVPS.getDepthId     ( layerIdxInVps ) << std::endl;     
-#endif
-#endif
   }
 }
