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);
