Index: branches/HTM-8.2-dev0-Cleanup/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- branches/HTM-8.2-dev0-Cleanup/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 647)
+++ branches/HTM-8.2-dev0-Cleanup/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 648)
@@ -228,10 +228,4 @@
     in>>entry.m_interViewRefPosL[1][i];
   }
-#if !H_MV5
-  if (entry.m_numActiveRefLayerPics > 0 )
-  {
-    in>>entry.m_collocatedRefLayerIdx; 
-  }
-#endif
 #endif
   return in;
@@ -373,19 +367,11 @@
   ("NumberOfLayers",        m_numberOfLayers     , 1,                     "Number of layers")
 #if !H_3D
-#if H_MV5
   ("ScalabilityMask",       m_scalabilityMask    , 2                    , "Scalability Mask")    
-#else
-  ("ScalabilityMask",       m_scalabilityMask    , 1                    , "Scalability Mask")    
-#endif
 #else
   ("ScalabilityMask",       m_scalabilityMask    , 3                    , "Scalability Mask, 1: Texture 3: Texture + Depth ")    
 #endif  
   ("DimensionIdLen",        m_dimensionIdLen     , cfg_dimensionLength  , "Number of bits used to store dimensions Id")
-#if H_MV5
   ("ViewOrderIndex",        m_viewOrderIndex     , std::vector<Int>(1,0), "View Order Index per layer")
   ("ViewId",                m_viewId             , std::vector<Int>(1,0), "View Id per View Order Index")
-#else
-  ("ViewId",                m_viewId             , std::vector<Int>(1,0), "View Id")
-#endif
 #if H_3D
   ("DepthFlag",             m_depthFlag          , std::vector<Int>(1,0), "Depth Flag")
@@ -620,5 +606,4 @@
 #endif
 
-#if H_MV5
 #if H_MV
   // VPS VUI
@@ -637,5 +622,4 @@
   ("CtuBasedOffsetEnabledFlag"   , m_ctuBasedOffsetEnabledFlag   , std::vector< Bool >(1,0)  ,MAX_NUM_LAYERS       , "CtuBasedOffsetEnabledFlag    per direct reference for the N-th layer")
   ("MinHorizontalCtuOffsetPlus1" , m_minHorizontalCtuOffsetPlus1 , std::vector< Int  >(1,0)  ,MAX_NUM_LAYERS       , "MinHorizontalCtuOffsetPlus1  per direct reference for the N-th layer")
-#endif
 #endif
 
@@ -782,7 +766,5 @@
     if( k == 0 )
     {
-#if H_MV5
       m_GOPListMvc[0][0].m_sliceType = 'I'; 
-#endif
       for( Int i = 1; i < MAX_GOP + 1; i++ ) 
       {
@@ -988,5 +970,4 @@
   // allocate slice-based dQP values
 #if H_MV
-#if H_MV5
   xResizeVector( m_viewOrderIndex    ); 
 
@@ -1008,26 +989,4 @@
 #if H_3D
   xResizeVector( m_depthFlag ); 
-#endif
-#else
-  xResizeVector( m_viewId    ); 
-#if H_3D
-  xResizeVector( m_depthFlag ); 
-
-  std::vector<Int> uniqueViewIds; 
-  for( Int layer = 0; layer < m_numberOfLayers; layer++ )
-  {    
-    Bool isIn = false; 
-    for ( Int i = 0 ; i < uniqueViewIds.size(); i++ )
-    {
-      isIn = isIn || ( m_viewId[ layer ] == uniqueViewIds[ i ] ); 
-    }
-    if ( !isIn ) 
-    {
-      uniqueViewIds.push_back( m_viewId[ layer ] ); 
-    } 
-  }
-  m_iNumberOfViews = (Int) uniqueViewIds.size(); 
-#endif
-
 #endif
   xResizeVector( m_fQP ); 
@@ -1303,5 +1262,4 @@
   xConfirmPara( (m_layerIdInNuh.size()!=1) && (m_layerIdInNuh.size() < m_numberOfLayers) , "LayerIdInNuh must be given for all layers. ");
   
-#if H_MV5
 #if H_3D
   xConfirmPara( m_scalabilityMask != 2 && m_scalabilityMask != 3, "Scalability Mask must be equal to 2 or 3. ");
@@ -1318,19 +1276,4 @@
 
   m_dimIds.push_back( m_viewOrderIndex );   
-#else
-#if H_3D
-  xConfirmPara( m_scalabilityMask != 1 && m_scalabilityMask != 3, "Scalability Mask must be equal to 1 or 3. ");
-#else
-  xConfirmPara( m_scalabilityMask != 1 , "Scalability Mask must be equal to 1. ");
-#endif
- 
-  m_dimIds.push_back( m_viewId ); 
-  const Int viewDimPosition = 0; 
-#if H_3D
-  if ( m_scalabilityMask & ( 1 << DEPTH_ID ) )
-    m_dimIds.push_back( m_depthFlag ); 
-#endif
-
-#endif
   xConfirmPara(  m_dimensionIdLen.size() < m_dimIds.size(), "DimensionIdLen must be given for all dimensions. "   );   Int dimBitOffset[MAX_NUM_SCALABILITY_TYPES+1]; 
 
@@ -1349,9 +1292,5 @@
   {    
     xConfirmPara( m_dimIds[j].size() < m_numberOfLayers,  "DimensionId must be given for all layers and all dimensions. ");   
-#if H_MV5   
     xConfirmPara( (m_dimIds[j][0] != 0)                 , "DimensionId of layer 0 must be 0. " );
-#else
-    xConfirmPara( ( j != viewDimPosition ) &&  (m_dimIds[j][0] != 0), "DimensionId of layer 0 must be 0. " );
-#endif
     xConfirmPara( m_dimensionIdLen[j] < 1 || m_dimensionIdLen[j] > 8, "DimensionIdLen must be greater than 0 and less than 9 in all dimensions. " ); 
      
@@ -1396,18 +1335,10 @@
      {
        Bool inc = m_dimIds[ lastDiff ][ i ] > m_dimIds[ lastDiff ][ j ]; 
-#if H_MV5
        Bool shallBeButIsNotIncreasing = ( !inc  ) ; 
-#else
-       Bool shallBeButIsNotIncreasing = ( !inc && ( lastDiff != viewDimPosition ) ) ; 
-#endif
        if ( shallBeButIsNotIncreasing )
        {       
          printf( "\nError: Positions of Layers %d and %d is not increasing in dimension %d \n", i, j, lastDiff);        
        }
-#if H_MV5
        xConfirmPara( shallBeButIsNotIncreasing,  "DimensionIds shall be increasing within one dimension. " );
-#else
-       xConfirmPara( shallBeButIsNotIncreasing && ( lastDiff != viewDimPosition ),  "DimensionIds shall be increasing within one dimension. " );
-#endif
      }
 #endif
@@ -1415,5 +1346,4 @@
  }
 
-#if H_MV5
  /// ViewId 
  xConfirmPara( m_viewId.size() != m_iNumberOfViews, "The number of ViewIds must be equal to the number of views." ); 
@@ -1421,7 +1351,4 @@
   /// Layer sets
   xConfirmPara( m_vpsNumLayerSets < 0 || m_vpsNumLayerSets > 1024, "VpsNumLayerSets must be greater than 0 and less than 1025. ") ; 
-#else
-  xConfirmPara( m_vpsNumLayerSets < 0 || m_vpsNumLayerSets > 1024, "VpsNumLayerSets must be greater than 0 and less than 1025") ; 
-#endif
   for( Int lsIdx = 0; lsIdx < m_vpsNumLayerSets; lsIdx++ )
   {
@@ -2185,5 +2112,4 @@
   }
 #endif
-#if H_MV5
 #if H_MV
   // VPS VUI
@@ -2208,5 +2134,4 @@
   }
 #endif
-#endif
 
   xConfirmPara(!m_TransquantBypassEnableFlag && m_CUTransquantBypassFlagValue, "CUTransquantBypassFlagValue cannot be 1 when TransquantBypassEnableFlag is 0");
@@ -2274,10 +2199,6 @@
 #endif
 #if H_MV
-#if H_MV5
   xPrintParaVector( "ViewIdVal"     , m_viewId ); 
   xPrintParaVector( "ViewOrderIndex", m_viewOrderIndex ); 
-#else
-  xPrintParaVector( "ViewId", m_viewId ); 
-#endif
 #endif
 #if H_3D
Index: branches/HTM-8.2-dev0-Cleanup/source/App/TAppEncoder/TAppEncCfg.h
===================================================================
--- branches/HTM-8.2-dev0-Cleanup/source/App/TAppEncoder/TAppEncCfg.h	(revision 647)
+++ branches/HTM-8.2-dev0-Cleanup/source/App/TAppEncoder/TAppEncCfg.h	(revision 648)
@@ -69,11 +69,5 @@
   std::vector<char*>     m_pchReconFileList;                  ///< output reconstruction file names
   Int                    m_numberOfLayers;                    ///< number of Layers to Encode
-#if H_MV5
   Int                    m_iNumberOfViews;                    ///< number of Layers that are views
-#else
-#if H_3D
-  Int                    m_iNumberOfViews;                    ///< number of Layers that are views
-#endif
-#endif
 #else
   Char*     m_pchReconFile;                                   ///< output reconstruction file
@@ -83,7 +77,5 @@
   std::vector< std::vector<Int> > m_dimIds;                   ///< dimension ids ( pointers to m_viewId and m_depthFlag 
   std::vector<Int>       m_viewId;                            ///< view id
-#if H_MV5
   std::vector<Int>       m_viewOrderIndex;                    ///< view order index  
-#endif
 #if H_3D
   std::vector<Int>       m_depthFlag;                         ///< depth flag
@@ -106,5 +98,4 @@
   std::vector< std::vector<Int> > m_dependencyTypes;          ///< Dependency types of direct reference layers
 
-#if H_MV5
   // VPS VUI
   Bool m_vpsVuiPresentFlag;
@@ -122,5 +113,4 @@
   std::vector< std::vector<Bool > > m_ctuBasedOffsetEnabledFlag;
   std::vector< std::vector<Int  > > m_minHorizontalCtuOffsetPlus1;
-#endif
 
 #if H_3D_IV_MERGE
Index: branches/HTM-8.2-dev0-Cleanup/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- branches/HTM-8.2-dev0-Cleanup/source/App/TAppEncoder/TAppEncTop.cpp	(revision 647)
+++ branches/HTM-8.2-dev0-Cleanup/source/App/TAppEncoder/TAppEncTop.cpp	(revision 648)
@@ -88,9 +88,5 @@
     vps.setTemporalNestingFlag(true);
   }
-#if H_MV5
   vps.setMaxLayersMinus1( m_numberOfLayers - 1);
-#else
-  vps.setMaxLayers( m_numberOfLayers );
-#endif
   for(Int i = 0; i < MAX_TLAYER; i++)
   {
@@ -124,15 +120,8 @@
   xSetDependencies( vps );
   xSetProfileTierLevel     ( vps ); 
-#if H_MV5
   xSetRepFormat            ( vps ); 
-#endif
   xSetLayerSets            ( vps ); 
-#if H_MV5
   xSetVPSVUI               ( vps ); 
-#endif
 #if H_3D
-#if !H_MV5
-  vps.initViewIndex(); 
-#endif
   xSetVPSExtension2        ( vps ); 
   m_ivPicLists.setVPS      ( &vps ); 
@@ -140,9 +129,5 @@
 
 
-#if H_MV5
   for(Int layerIdInVps = 0; layerIdInVps < m_numberOfLayers; layerIdInVps++)
-#else 
-  for(Int layer = 0; layer < m_numberOfLayers; layer++)
-#endif
   {
     m_frameRcvd                 .push_back(0);
@@ -151,5 +136,4 @@
     m_acTVideoIOYuvReconFileList.push_back(new TVideoIOYuv);
     m_picYuvRec                 .push_back(new TComList<TComPicYuv*>) ;
-#if H_MV5   
     m_ivPicLists.push_back( m_acTEncTopList[ layerIdInVps ]->getListPic()  ); 
     TEncTop& m_cTEncTop = *m_acTEncTopList[ layerIdInVps ];  // It is not a member, but this name helps avoiding code duplication !!!
@@ -160,20 +144,6 @@
     m_cTEncTop.setViewId                       ( vps.getViewId      (  layerId ) );
     m_cTEncTop.setViewIndex                    ( vps.getViewIndex   (  layerId ) );
-#else
-    m_ivPicLists.push_back( m_acTEncTopList[ layer ]->getListPic()  ); 
-    TEncTop& m_cTEncTop = *m_acTEncTopList[ layer ];  // It is not a member, but this name helps avoiding code duplication !!!
-    
-    m_cTEncTop.setLayerIdInVps                 ( layer ); 
-    m_cTEncTop.setLayerId                      ( vps.getLayerIdInNuh( layer ) );    
-    m_cTEncTop.setViewId                       ( vps.getViewId      ( layer ) );
-
-#endif
 #if H_3D
-#if H_MV5
     Bool isDepth = ( vps.getDepthId     ( layerId ) != 0 ) ;
-#else
-    Bool isDepth = ( vps.getDepthId     ( layer ) != 0 ) ;
-    m_cTEncTop.setViewIndex                    ( vps.getViewIndex   ( layer ) );
-#endif
     m_cTEncTop.setIsDepth                      ( isDepth );
     //====== Camera Parameters =========
@@ -201,5 +171,4 @@
     m_cTEncTop.setDWeight                      ( isDepth ? m_iDWeight             : 0     );
 #endif // H_3D_VSO
-#if H_MV5
 #if H_3D_ARP
     //====== Advanced Inter-view Residual Prediction =========
@@ -209,14 +178,4 @@
 #if H_3D_IC
     m_cTEncTop.setUseIC                        ( vps.getViewIndex( layerId ) == 0 ? false : m_abUseIC[isDepth ? 1 : 0] );
-#endif
-#else
-#if H_3D_ARP
-    //====== Advanced Inter-view Residual Prediction =========
-    m_cTEncTop.setUseAdvRP                     ( ( isDepth || 0==layer ) ? 0 : m_uiUseAdvResPred );
-    m_cTEncTop.setARPStepNum                   ( ( isDepth || 0==layer ) ? 1 : H_3D_ARP_WFNR     );
-#endif
-#if H_3D_IC
-    m_cTEncTop.setUseIC                        ( vps.getViewIndex( layer ) == 0 ? false : m_abUseIC[isDepth ? 1 : 0] );
-#endif
 #endif
   //========== Depth intra modes ==========
@@ -260,5 +219,4 @@
   m_cTEncTop.setGOPSize                      ( m_iGOPSize );
 #if H_MV
-#if H_MV5
 m_cTEncTop.setGopList                      ( m_GOPListMvc[layerIdInVps] );
   m_cTEncTop.setExtraRPSs                    ( m_extraRPSsMvc[layerIdInVps] );
@@ -269,13 +227,4 @@
   }
 #else
-  m_cTEncTop.setGopList                      ( m_GOPListMvc[layer] );
-  m_cTEncTop.setExtraRPSs                    ( m_extraRPSsMvc[layer] );
-  for(Int i = 0; i < MAX_TLAYER; i++)
-  {
-    m_cTEncTop.setNumReorderPics             ( m_numReorderPicsMvc[layer][i], i );
-    m_cTEncTop.setMaxDecPicBuffering         ( m_maxDecPicBufferingMvc[layer][i], i );
-  }
-#endif
-#else
   m_cTEncTop.setGopList                      ( m_GOPList );
   m_cTEncTop.setExtraRPSs                    ( m_extraRPSs );
@@ -291,10 +240,6 @@
   }
 #if H_MV
-#if H_MV5
   m_cTEncTop.setQP                           ( m_iQP[layerIdInVps] );
 #else
-  m_cTEncTop.setQP                           ( m_iQP[layer] );
-#endif
-#else
   m_cTEncTop.setQP                           ( m_iQP );
 #endif
@@ -303,10 +248,6 @@
 
 #if H_MV
-#if H_MV5
   m_cTEncTop.setMaxTempLayer                 ( m_maxTempLayerMvc[layerIdInVps] );
 #else
-  m_cTEncTop.setMaxTempLayer                 ( m_maxTempLayerMvc[layer] );
-#endif
-#else
   m_cTEncTop.setMaxTempLayer                 ( m_maxTempLayer );
 #endif
@@ -317,9 +258,5 @@
   //====== Loop/Deblock Filter ========
 #if H_MV
-#if H_MV5
   m_cTEncTop.setLoopFilterDisable            ( m_bLoopFilterDisable[layerIdInVps]);
-#else
-  m_cTEncTop.setLoopFilterDisable            ( m_bLoopFilterDisable[layer]);
-#endif
 #else
   m_cTEncTop.setLoopFilterDisable            ( m_bLoopFilterDisable       );
@@ -351,9 +288,5 @@
 
 #if H_MV
-#if H_MV5
   if ((m_iMaxDeltaQP == 0 ) && (m_iQP[layerIdInVps] == lowestQP) && (m_useLossless == true))
-#else
-  if ((m_iMaxDeltaQP == 0 ) && (m_iQP[layer] == lowestQP) && (m_useLossless == true))
-#endif
 #else
   if ((m_iMaxDeltaQP == 0 ) && (m_iQP == lowestQP) && (m_useLossless == true))
@@ -372,9 +305,5 @@
   m_cTEncTop.setUseLossless                  ( m_useLossless );
 #if H_MV
-#if H_MV5
   m_cTEncTop.setdQPs                         ( m_aidQP[layerIdInVps]   );
-#else
-  m_cTEncTop.setdQPs                         ( m_aidQP[layer]   );
-#endif
 #else
   m_cTEncTop.setdQPs                         ( m_aidQP        );
@@ -435,9 +364,5 @@
   m_cTEncTop.setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag );
 #if H_MV
-#if H_MV5
   m_cTEncTop.setUseSAO ( m_bUseSAO[layerIdInVps] );
-#else
-  m_cTEncTop.setUseSAO ( m_bUseSAO[layer] );
-#endif
 #else
   m_cTEncTop.setUseSAO ( m_bUseSAO );
@@ -1303,17 +1228,9 @@
 Void TAppEncTop::xSetDimensionIdAndLength( TComVPS& vps )
 {   
-#if H_MV5
   vps.setScalabilityMaskFlag( m_scalabilityMask ); 
-#else
-  vps.setScalabilityMask( m_scalabilityMask ); 
-#endif
   for( Int dim = 0; dim < m_dimIds.size(); dim++ )
   {
     vps.setDimensionIdLen( dim, m_dimensionIdLen[ dim ] );
-#if H_MV5
     for( Int layer = 0; layer <= vps.getMaxLayersMinus1(); layer++ )
-#else
-    for( Int layer = 0; layer < vps.getMaxLayers(); layer++ )
-#endif
 
     {        
@@ -1322,5 +1239,4 @@
   }
 
-#if H_MV5
   Int maxViewId = xGetMax( m_viewId ); 
 
@@ -1335,5 +1251,4 @@
 
   assert( m_iNumberOfViews == vps.getNumViews() ); 
-#endif
 }
 
@@ -1362,7 +1277,5 @@
 
   // Max temporal id for inter layer reference pictures + presence flag
-#if H_MV5
   Bool maxTidRefPresentFlag = false; 
-#endif
   for ( Int refLayerIdInVps = 0; refLayerIdInVps < m_numberOfLayers; refLayerIdInVps++)
     {
@@ -1385,27 +1298,15 @@
     }
     vps.setMaxTidIlRefPicPlus1( refLayerIdInVps, maxTid + 1 );
-#if H_MV5
     maxTidRefPresentFlag = maxTidRefPresentFlag || ( maxTid != 6 );    
-#endif
-  }
-
-#if H_MV5
+  }
+
   vps.setMaxTidRefPresentFlag( maxTidRefPresentFlag );
-#endif
   // Max one active ref layer flag
   Bool maxOneActiveRefLayerFlag = true;  
-#if H_MV5
   for ( Int layerIdInVps = 1; layerIdInVps < m_numberOfLayers && maxOneActiveRefLayerFlag; layerIdInVps++)
-#else
-  for ( Int currLayerIdInVps = 1; currLayerIdInVps < m_numberOfLayers && maxOneActiveRefLayerFlag; currLayerIdInVps++)
-#endif
   {
     for( Int i = 0; i < ( getGOPSize() + 1) && maxOneActiveRefLayerFlag; i++ ) 
     {        
-#if H_MV5
       GOPEntry ge =  m_GOPListMvc[layerIdInVps][ ( i < getGOPSize()  ? i : MAX_GOP ) ]; 
-#else
-      GOPEntry ge =  m_GOPListMvc[currLayerIdInVps][ ( i < getGOPSize()  ? i : MAX_GOP ) ]; 
-#endif
       maxOneActiveRefLayerFlag =  maxOneActiveRefLayerFlag && (ge.m_numActiveRefLayerPics <= 1); 
     }            
@@ -1415,5 +1316,4 @@
   
   
-#if H_MV5
   // All Ref layers active flag
   Bool allRefLayersActiveFlag = true; 
@@ -1431,9 +1331,7 @@
   // Currently cross layer irap aligned is always true.   
   vps.setCrossLayerIrapAlignedFlag( true ); 
-#endif
   vps.setRefLayers(); 
 }; 
 
-#if H_MV5
 GOPEntry* TAppEncTop::xGetGopEntry( Int layerIdInVps, Int poc )
 {
@@ -1450,5 +1348,4 @@
   return geFound; 
 }
-#endif
 
 Void TAppEncTop::xSetLayerIds( TComVPS& vps )
@@ -1490,5 +1387,4 @@
 }
 
-#if H_MV5
 
 Void TAppEncTop::xSetRepFormat( TComVPS& vps )
@@ -1515,5 +1411,4 @@
   }
 }
-#endif
 
 Void TAppEncTop::xSetLayerSets( TComVPS& vps )
@@ -1568,5 +1463,4 @@
   }
 }
-#if H_MV5
 
 Void TAppEncTop::xSetVPSVUI( TComVPS& vps )
@@ -1660,14 +1554,9 @@
 }
 #endif
-#endif
 #if H_3D
 Void TAppEncTop::xSetVPSExtension2( TComVPS& vps )
 {
-#if H_MV5
 
   for ( Int layer = 0; layer <= vps.getMaxLayersMinus1(); layer++ )
-#else
-  for ( Int layer = 0; layer < vps.getMaxLayers(); layer++ )
-#endif
   {
     Bool isDepth      = ( vps.getDepthId( layer ) == 1 ) ;
Index: branches/HTM-8.2-dev0-Cleanup/source/App/TAppEncoder/TAppEncTop.h
===================================================================
--- branches/HTM-8.2-dev0-Cleanup/source/App/TAppEncoder/TAppEncTop.h	(revision 647)
+++ branches/HTM-8.2-dev0-Cleanup/source/App/TAppEncoder/TAppEncTop.h	(revision 648)
@@ -124,9 +124,7 @@
   Void xSetLayerSets              ( TComVPS& vps );
   Void xSetProfileTierLevel       ( TComVPS& vps );
-#if H_MV5
   Void xSetRepFormat              ( TComVPS& vps );
   Void xSetVPSVUI                 ( TComVPS& vps );
   GOPEntry* xGetGopEntry( Int layerIdInVps, Int poc );
-#endif
   Int  xGetMax( std::vector<Int>& vec);
 #endif
