Index: trunk/source/Lib/TLibCommon/ContextTables.h
===================================================================
--- trunk/source/Lib/TLibCommon/ContextTables.h	(revision 759)
+++ trunk/source/Lib/TLibCommon/ContextTables.h	(revision 773)
@@ -109,17 +109,7 @@
 #define NUM_DEPTH_INTRA_MODE_CTX      8       ///< number of context models for depth intra modes
 #define NUM_DDC_FLAG_CTX              2       ///< number of context models for deltaDC flag (DMM or RBC)
-#if QC_DIM_DELTADC_UNIFY_F0132
 #define NUM_DDC_DATA_CTX              1       ///< number of context models for deltaDC data (DMM or RBC)
-#else
-#define NUM_DDC_DATA_CTX              2       ///< number of context models for deltaDC data (DMM or RBC)
-#endif
 #if H_3D_DIM_DMM
 #define NUM_DMM1_DATA_CTX             1       ///< number of context models for DMM1 data
-#if !SEC_DMM3_RBC_F0147
-#define NUM_DMM3_DATA_CTX             1       ///< number of context models for DMM3 data
-#endif
-#endif
-#if H_3D_DIM_RBC
-#define NUM_RBC_DATA_CTX              1       ///< number of context models for RBC data
 #endif
 #endif
@@ -377,13 +367,7 @@
 INIT_ARPW[3][NUM_ARPW_CTX] = 
 {
-#if LGE_ARP_CTX_F0161
     { 162, 153, 154, 162 },
     { 162, 153, 154, 162 },
     { 162, 153, 154, 162 },
-#else
-  { 154, 154, 154, 154 }, 
-  { 154, 154, 154, 154 }, 
-  { 154, 154, 154, 154 }, 
-#endif
 };
 #endif
@@ -393,13 +377,7 @@
 INIT_IC_FLAG[3][NUM_IC_FLAG_CTX] =  
 {
-#if LGE_IC_CTX_F0160
     { 154,  154,  154, },
     { 154,  154,  154, },
     { 154,  154,  154, },
-#else
-  { CNU,  CNU,  CNU, }, 
-  { 197,  185,  201, }, 
-  { 197,  185,  201, }, 
-#endif
 };
 #endif
@@ -423,13 +401,7 @@
 INIT_DDC_DATA[3][NUM_DDC_DATA_CTX] = 
 {
-#if QC_DIM_DELTADC_UNIFY_F0132
-  { 154 }, 
-  { 154 }, 
-  { 154 }, 
-#else
-  { CNU, CNU }, 
-  { CNU, CNU }, 
-  { CNU, CNU }, 
-#endif
+  { 154 }, 
+  { 154 }, 
+  { 154 }, 
 };
 #if H_3D_DIM_DMM
@@ -441,22 +413,4 @@
   { CNU }, 
 };
-#if !SEC_DMM3_RBC_F0147
-static const UChar
-INIT_DMM3_DATA[3][NUM_DMM3_DATA_CTX] = 
-{
-  { CNU }, 
-  { CNU }, 
-  { CNU }, 
-};
-#endif
-#endif
-#if H_3D_DIM_RBC
-static const UChar
-INIT_RBC_DATA[3][NUM_RBC_DATA_CTX] = 
-{
-  { CNU }, 
-  { CNU }, 
-  { CNU }, 
-};
 #endif
 #if H_3D_DIM_SDC
Index: trunk/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComDataCU.cpp	(revision 759)
+++ trunk/source/Lib/TLibCommon/TComDataCU.cpp	(revision 773)
@@ -120,14 +120,4 @@
     m_dmmWedgeTabIdx[i] = NULL;
   }
-#if !SEC_DMM3_RBC_F0147
-  m_dmm3IntraTabIdx = NULL;
-#endif
-#endif
-#if H_3D_DIM_RBC
-  m_pucEdgeCode     = NULL;
-  m_pucEdgeNumber   = NULL;
-  m_pucEdgeStartPos = NULL;
-  m_pbEdgeLeftFirst = NULL;
-  m_pbEdgePartition = NULL;
 #endif
 #if H_3D_DIM_SDC
@@ -146,5 +136,5 @@
   m_piVSPFlag            = NULL;
 #endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
   m_pbSPIVMPFlag         = NULL;
 #endif
@@ -200,5 +190,5 @@
     m_piVSPFlag          = (Char*  )xMalloc(Char,   uiNumPartition);
 #endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
     m_pbSPIVMPFlag       = (Bool*  )xMalloc(Bool,   uiNumPartition);
 #endif
@@ -279,14 +269,4 @@
       m_dmmWedgeTabIdx[i]    = (UInt*)xMalloc(UInt, uiNumPartition);
     }
-#if !SEC_DMM3_RBC_F0147
-    m_dmm3IntraTabIdx = (UInt*)xMalloc(UInt, uiNumPartition);
-#endif
-#endif
-#if H_3D_DIM_RBC
-    m_pucEdgeCode     = (UChar*)xMalloc(UChar, uiNumPartition * RBC_MAX_EDGE_NUM_PER_4x4);
-    m_pucEdgeNumber   = (UChar*)xMalloc(UChar, uiNumPartition);
-    m_pucEdgeStartPos = (UChar*)xMalloc(UChar, uiNumPartition);
-    m_pbEdgeLeftFirst = (Bool*)xMalloc(Bool, uiNumPartition);
-    m_pbEdgePartition = (Bool*)xMalloc(Bool, uiNumPartition * 16);
 #endif
 #if H_3D_DIM_SDC
@@ -362,5 +342,5 @@
     if ( m_piVSPFlag          ) { xFree(m_piVSPFlag);           m_piVSPFlag         = NULL; }
 #endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
     if ( m_pbSPIVMPFlag       ) { xFree(m_pbSPIVMPFlag);           m_pbSPIVMPFlag         = NULL; }
 #endif
@@ -417,14 +397,4 @@
       if ( m_dmmWedgeTabIdx[i] ) { xFree( m_dmmWedgeTabIdx[i] ); m_dmmWedgeTabIdx[i] = NULL; }
     }
-#if !SEC_DMM3_RBC_F0147
-    if ( m_dmm3IntraTabIdx ) { xFree( m_dmm3IntraTabIdx ); m_dmm3IntraTabIdx = NULL; }
-#endif
-#endif
-#if H_3D_DIM_RBC
-    if ( m_pbEdgeLeftFirst ) { xFree( m_pbEdgeLeftFirst ); m_pbEdgeLeftFirst = NULL; }
-    if ( m_pucEdgeStartPos ) { xFree( m_pucEdgeStartPos ); m_pucEdgeStartPos = NULL; }
-    if ( m_pucEdgeNumber   ) { xFree( m_pucEdgeNumber   ); m_pucEdgeNumber   = NULL; }
-    if ( m_pucEdgeCode     ) { xFree( m_pucEdgeCode     ); m_pucEdgeCode     = NULL; }
-    if ( m_pbEdgePartition ) { xFree( m_pbEdgePartition ); m_pbEdgePartition = NULL; }
 #endif
 #if H_3D_DIM_SDC
@@ -571,5 +541,5 @@
     m_piVSPFlag[ui] = pcFrom->m_piVSPFlag[ui];
 #endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
     m_pbSPIVMPFlag[ui] = pcFrom->m_pbSPIVMPFlag[ui];
 #endif
@@ -616,5 +586,5 @@
     memset( m_piVSPFlag         + firstElement, 0,                        numElements * sizeof( *m_piVSPFlag ) );
 #endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
     memset( m_pbSPIVMPFlag      + firstElement, 0,                        numElements * sizeof( *m_pbSPIVMPFlag ) );
 #endif
@@ -643,14 +613,4 @@
       memset( m_dmmWedgeTabIdx[i] + firstElement, 0,                      numElements * sizeof( *m_dmmWedgeTabIdx[i] ) );
     }
-#if !SEC_DMM3_RBC_F0147
-    memset( m_dmm3IntraTabIdx   + firstElement, 0,                        numElements * sizeof( *m_dmm3IntraTabIdx ) );
-#endif
-#endif
-#if H_3D_DIM_RBC
-    memset( m_pucEdgeCode       + firstElement, 0,                        numElements * sizeof( *m_pucEdgeCode     ) * RBC_MAX_EDGE_NUM_PER_4x4 );
-    memset( m_pucEdgeNumber     + firstElement, 0,                        numElements * sizeof( *m_pucEdgeNumber   ) );
-    memset( m_pucEdgeStartPos   + firstElement, 0,                        numElements * sizeof( *m_pucEdgeStartPos ) );
-    memset( m_pbEdgeLeftFirst   + firstElement, false,                    numElements * sizeof( *m_pbEdgeLeftFirst ) );
-    memset( m_pbEdgePartition   + firstElement, false,                    numElements * sizeof( *m_pbEdgePartition ) * 16 );
 #endif
 #if H_3D_DIM_SDC
@@ -799,5 +759,5 @@
       m_piVSPFlag[ui] = 0;
 #endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
       m_pbSPIVMPFlag[ui] = 0;
 #endif
@@ -825,7 +785,4 @@
         m_dmmWedgeTabIdx[i] [ui] = 0;
       }
-#if !SEC_DMM3_RBC_F0147
-      m_dmm3IntraTabIdx [ui] = 0;
-#endif
 #endif
 #if H_3D_DIM_SDC
@@ -902,5 +859,5 @@
   memset( m_piVSPFlag,          0, sizeof( Char  ) * m_uiNumPartition );
 #endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
   memset( m_pbSPIVMPFlag,       0, sizeof( Bool  ) * m_uiNumPartition );
 #endif
@@ -941,14 +898,4 @@
     memset( m_dmmWedgeTabIdx[i], 0, sizeof(UInt) * m_uiNumPartition );
   }
-#if !SEC_DMM3_RBC_F0147
-  memset( m_dmm3IntraTabIdx, 0, sizeof(UInt) * m_uiNumPartition );
-#endif
-#endif
-#if H_3D_DIM_RBC
-  memset( m_pucEdgeCode    , 0, iSizeInUchar * RBC_MAX_EDGE_NUM_PER_4x4 );
-  memset( m_pucEdgeNumber  , 0, iSizeInUchar );
-  memset( m_pucEdgeStartPos, 0, iSizeInUchar );
-  memset( m_pbEdgeLeftFirst, 0, iSizeInBool );
-  memset( m_pbEdgePartition, 0, iSizeInBool * 16 );
 #endif
 #if H_3D_DIM_SDC
@@ -1001,5 +948,5 @@
       m_pDvInfo[ ui ] = pcCU->m_pDvInfo[uiPartOffset+ui];
 #endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
       m_pbSPIVMPFlag[ui]=pcCU->m_pbSPIVMPFlag[uiPartOffset+ui];
 #endif
@@ -1028,7 +975,4 @@
         m_dmmWedgeTabIdx[i] [ui] = pcCU->m_dmmWedgeTabIdx[i] [uiPartOffset+ui];
       }
-#if !SEC_DMM3_RBC_F0147
-      m_dmm3IntraTabIdx [ui] = pcCU->m_dmm3IntraTabIdx[uiPartOffset+ui];
-#endif
 #endif
 #if H_3D_DIM_SDC
@@ -1154,5 +1098,5 @@
   m_piVSPFlag           = pcCU->getVSPFlag()          + uiPart;
 #endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
   m_pbSPIVMPFlag        = pcCU->getSPIVMPFlag()          + uiPart;
 #endif
@@ -1187,14 +1131,4 @@
     m_dmmWedgeTabIdx[i] = pcCU->getDmmWedgeTabIdx( i ) + uiPart;
   }
-#if !SEC_DMM3_RBC_F0147
-  m_dmm3IntraTabIdx = pcCU->getDmm3IntraTabIdx() + uiPart;
-#endif
-#endif
-#if H_3D_DIM_RBC
-  m_pucEdgeCode     = pcCU->getEdgeCode( uiPart );
-  m_pucEdgeNumber   = pcCU->getEdgeNumber()      + uiPart;
-  m_pucEdgeStartPos = pcCU->getEdgeStartPos()    + uiPart;
-  m_pbEdgeLeftFirst = pcCU->getEdgeLeftFirst()   + uiPart;
-  m_pbEdgePartition = pcCU->getEdgePartition( uiPart );
 #endif
 #if H_3D_DIM_SDC
@@ -1313,5 +1247,5 @@
   m_pDvInfo            = pcCU->getDvInfo()                + uiAbsPartIdx;
 #endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
   m_pbSPIVMPFlag       = pcCU->getSPIVMPFlag()               + uiAbsPartIdx;
 #endif
@@ -1365,5 +1299,5 @@
 
 #endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
   memcpy( m_pbSPIVMPFlag        + uiOffset, pcCU->getSPIVMPFlag(),        sizeof( Bool ) * uiNumPartition );
 #endif
@@ -1391,14 +1325,4 @@
     memcpy( m_dmmWedgeTabIdx[i] + uiOffset, pcCU->getDmmWedgeTabIdx( i ), sizeof(UInt) * uiNumPartition );
   }
-#if !SEC_DMM3_RBC_F0147
-  memcpy( m_dmm3IntraTabIdx + uiOffset, pcCU->getDmm3IntraTabIdx(), sizeof(UInt) * uiNumPartition );
-#endif
-#endif
-#if H_3D_DIM_RBC
-  memcpy( getEdgeCode( uiOffset ),       pcCU->getEdgeCode(0),      iSizeInUchar * RBC_MAX_EDGE_NUM_PER_4x4 );
-  memcpy( getEdgeNumber()    + uiOffset, pcCU->getEdgeNumber(),     iSizeInUchar );
-  memcpy( getEdgeStartPos()  + uiOffset, pcCU->getEdgeStartPos(),   iSizeInUchar );
-  memcpy( getEdgeLeftFirst() + uiOffset, pcCU->getEdgeLeftFirst(),  iSizeInBool );
-  memcpy( getEdgePartition( uiOffset ),  pcCU->getEdgePartition(0), iSizeInBool * 16 );
 #endif
 #if H_3D_DIM_SDC
@@ -1497,5 +1421,5 @@
   memcpy( rpcCU->getDvInfo()            + m_uiAbsIdxInLCU, m_pDvInfo,             sizeof( *m_pDvInfo ) * m_uiNumPartition );
 #endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
   memcpy( rpcCU->getSPIVMPFlag()        + m_uiAbsIdxInLCU, m_pbSPIVMPFlag,        sizeof( Bool ) * m_uiNumPartition );
 #endif
@@ -1523,14 +1447,4 @@
     memcpy( rpcCU->getDmmWedgeTabIdx( i ) + m_uiAbsIdxInLCU, m_dmmWedgeTabIdx[i], sizeof(UInt) * m_uiNumPartition );
   }
-#if !SEC_DMM3_RBC_F0147
-  memcpy( rpcCU->getDmm3IntraTabIdx() + m_uiAbsIdxInLCU, m_dmm3IntraTabIdx, sizeof(UInt) * m_uiNumPartition );
-#endif
-#endif
-#if H_3D_DIM_RBC
-  memcpy( rpcCU->getEdgeCode( m_uiAbsIdxInLCU ),         m_pucEdgeCode,     iSizeInUchar * RBC_MAX_EDGE_NUM_PER_4x4 );
-  memcpy( rpcCU->getEdgeNumber()      + m_uiAbsIdxInLCU, m_pucEdgeNumber,   iSizeInUchar );
-  memcpy( rpcCU->getEdgeStartPos()    + m_uiAbsIdxInLCU, m_pucEdgeStartPos, iSizeInUchar );
-  memcpy( rpcCU->getEdgeLeftFirst()   + m_uiAbsIdxInLCU, m_pbEdgeLeftFirst, iSizeInBool );
-  memcpy( rpcCU->getEdgePartition( m_uiAbsIdxInLCU ),    m_pbEdgePartition, iSizeInBool * 16 );
 #endif
 #if H_3D_DIM_SDC
@@ -1616,5 +1530,5 @@
   memcpy( rpcCU->getVSPFlag()           + uiPartOffset, m_piVSPFlag,           sizeof(Char) * uiQNumPart );
 #endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
   memcpy( rpcCU->getSPIVMPFlag()        + uiPartOffset, m_pbSPIVMPFlag,        sizeof(Bool) * uiQNumPart );
 #endif
@@ -1641,14 +1555,4 @@
     memcpy( rpcCU->getDmmWedgeTabIdx( i ) + uiPartOffset, m_dmmWedgeTabIdx[i], sizeof(UInt) * uiQNumPart );
   }
-#if !SEC_DMM3_RBC_F0147
-  memcpy( rpcCU->getDmm3IntraTabIdx() + uiPartOffset, m_dmm3IntraTabIdx, sizeof(UInt) * uiQNumPart );
-#endif
-#endif
-#if H_3D_DIM_RBC
-  memcpy( rpcCU->getEdgeCode( uiPartOffset ),         m_pucEdgeCode,     iSizeInUchar * RBC_MAX_EDGE_NUM_PER_4x4 );
-  memcpy( rpcCU->getEdgeNumber()      + uiPartOffset, m_pucEdgeNumber,   iSizeInUchar );
-  memcpy( rpcCU->getEdgeStartPos()    + uiPartOffset, m_pucEdgeStartPos, iSizeInUchar );
-  memcpy( rpcCU->getEdgeLeftFirst()   + uiPartOffset, m_pbEdgeLeftFirst, iSizeInBool );
-  memcpy( rpcCU->getEdgePartition( uiPartOffset ),    m_pbEdgePartition, iSizeInBool * 16 );
 #endif
 #if H_3D_DIM_SDC
@@ -2375,5 +2279,4 @@
   UInt        uiCtx = 0;
 
-#if LGE_IC_CTX_F0160
   TComDataCU* pcTempCU = NULL;
   UInt        uiTempPartIdx = 0;
@@ -2384,5 +2287,4 @@
   pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx );
   uiCtx    += ( pcTempCU ) ? pcTempCU->isIC( uiTempPartIdx ) : 0;
-#endif
 
   return uiCtx;
@@ -2745,5 +2647,5 @@
 }
 
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
 Void TComDataCU::setSPIVMPFlagSubParts( Bool bSPIVMPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
 {
@@ -3345,12 +3247,7 @@
  *   false: otherwise
  */
-#if ETRIKHU_MERGE_REUSE_F0093
 inline Bool TComDataCU::xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount,
   Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag, Int& iCount3DV, InheritedVSPDisInfo*  inheritedVSPDisInfo  )
-#else
-inline Bool TComDataCU::xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount,
-                                     Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag )
-#endif
-{
+  {
   if ( m_pcSlice->getViewIndex() == 0 || !m_pcSlice->getVPS()->getViewSynthesisPredFlag( m_pcSlice->getLayerIdInVps() ) || m_pcSlice->getIsDepth() )
   {
@@ -3367,7 +3264,5 @@
   }
 
-#if ETRIKHU_MERGE_REUSE_F0093
   rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV);
-#endif
   
   Bool  refViewAvailFlag = false;
@@ -3454,11 +3349,6 @@
 
 #if H_3D_IV_MERGE
-#if ETRIKHU_MERGE_REUSE_F0093
 inline Bool TComDataCU::xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* ivCandDir, TComMv* ivCandMv, 
   Int* ivCandRefIdx, Int iPosIvDC, Int* vspFlag, Int &iCount3DV, InheritedVSPDisInfo*  inheritedVSPDisInfo  )
-#else
-inline Bool TComDataCU::xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* ivCandDir, TComMv* ivCandMv, 
-                                       Int* ivCandRefIdx, Int iPosIvDC, Int* vspFlag )
-#endif
 {
   for(Int iLoop = 0; iLoop < 2; iLoop ++ ) 
@@ -3479,7 +3369,5 @@
         clipMv( cMv );
 
-#if ETRIKHU_MERGE_REUSE_F0093
         rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV);
-#endif
 
         abCandIsInter        [ iCount ] = true;
@@ -3502,26 +3390,13 @@
     if(ivCandDir[iLoop + 2])
     {
-#if ETRIKHU_MERGE_REUSE_F0093
       TComMvField tmpMV[2];
       UChar tmpDir = ivCandDir[iLoop + 2];
-#else
-      abCandIsInter        [ iCount ] = true;
-      puhInterDirNeighbours[ iCount ] = ivCandDir[iLoop + 2];
-#endif
       if( ( ivCandDir[iLoop + 2] & 1 ) == 1 )
       {
-#if ETRIKHU_MERGE_REUSE_F0093
         tmpMV[0].setMvField( ivCandMv[ (iLoop<<1) + 4 ], ivCandRefIdx[ (iLoop<<1) + 4 ] ); 
-#else
-        pcMvFieldNeighbours[ iCount<<1 ].setMvField( ivCandMv[ (iLoop<<1) + 4 ], ivCandRefIdx[ (iLoop<<1) + 4 ] ); 
-#endif
       }
       if( ( ivCandDir[iLoop + 2] & 2 ) == 2 )
       {
-#if ETRIKHU_MERGE_REUSE_F0093
         tmpMV[1].setMvField( ivCandMv[ (iLoop<<1) + 5 ], ivCandRefIdx[ (iLoop<<1) + 5 ] );
-#else
-        pcMvFieldNeighbours[ (iCount<<1)+1 ].setMvField( ivCandMv[ (iLoop<<1) + 5 ], ivCandRefIdx[ (iLoop<<1) + 5 ] );
-#endif
       }
      
@@ -3530,24 +3405,11 @@
       if( !iLoop && ivCandDir[0] > 0)
       {
-#if ETRIKHU_MERGE_REUSE_F0093
         if(tmpDir == puhInterDirNeighbours[0] && pcMvFieldNeighbours[0]==tmpMV[0] && pcMvFieldNeighbours[1]==tmpMV[1])
-#else
-        if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[0] && pcMvFieldNeighbours[0 ]== pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[1]==pcMvFieldNeighbours[(iCount<<1)+1])
-#endif
         {
             bRemove                         = true;
-#if !ETRIKHU_MERGE_REUSE_F0093
-            abCandIsInter        [ iCount ] = false;  
-            puhInterDirNeighbours[ iCount ] = 0;
-            TComMv  cZeroMv;
-            pcMvFieldNeighbours  [ iCount<<1   ].setMvField( cZeroMv, NOT_VALID );
-            pcMvFieldNeighbours  [(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
-#endif
         }
       }
       if(!bRemove)
       {
-
-#if ETRIKHU_MERGE_REUSE_F0093
         rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV);
 
@@ -3562,6 +3424,4 @@
           pcMvFieldNeighbours[ (iCount<<1)+1 ].setMvField( ivCandMv[ (iLoop<<1) + 5 ], ivCandRefIdx[ (iLoop<<1) + 5 ] );
         }
-#endif
-
 #if H_3D_NBDV
         if(iLoop) // For IvMcShift candidate
@@ -3603,13 +3463,5 @@
 #endif
 
-
-
-
-
-
-
-
-
-#if ETRIKHU_MERGE_REUSE_F0093
+#if H_3D
 Void TComDataCU::rightShiftMergeCandList( TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* iVSPIndexTrue, InheritedVSPDisInfo*  inheritedVSPDisInfo, UInt start, UInt num, Int &iCount3DV)
 {
@@ -3999,5 +3851,5 @@
  * \param numValidMergeCand
  */
-#if ETRIKHU_MERGE_REUSE_F0093
+#if H_3D
 Void TComDataCU::xGetInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours
 #else
@@ -4008,5 +3860,5 @@
       , InheritedVSPDisInfo*  inheritedVSPDisInfo
 #endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
       , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP
 #endif
@@ -4024,5 +3876,5 @@
   Bool abCandIsInter[ MRG_MAX_NUM_CANDS ];
 #endif
-#if ETRIKHU_MERGE_REUSE_F0093
+#if H_3D
   TComMvField tmpMV[2];
   UChar tmpDir;
@@ -4046,11 +3898,6 @@
   {
     abCandIsInter[ui] = false;
-#if H_3D_IV_MERGE
-    pcMvFieldNeighbours[ ( ui << 1 )     ].setMvField(cZeroMv, NOT_VALID);
-    pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setMvField(cZeroMv, NOT_VALID);
-#else
     pcMvFieldNeighbours[ ( ui << 1 )     ].setRefIdx(NOT_VALID);
     pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setRefIdx(NOT_VALID);
-#endif
   }
 #endif
@@ -4069,20 +3916,14 @@
 
   UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB;
-#if !ETRIKHU_MERGE_REUSE_F0093
+#if !H_3D
   PartSize cCurPS = getPartitionSize( uiAbsPartIdx );
 #endif
   deriveLeftRightTopIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT );
   deriveLeftBottomIdxGeneral  ( uiAbsPartIdx, uiPUIdx, uiPartIdxLB );
-#if SEC_MPI_ENABLING_MERGE_F0150
+#if H_3D
   Bool bMPIFlag   = getSlice()->getVPS()->getMPIFlag( getSlice()->getLayerIdInVps() );
-#endif
-#if QC_DEPTH_IV_MRG_F0125
   Bool bIsDepth = getSlice()->getIsDepth();
-#if !BUGFIX_F0093
-  Bool bDepthIPMCAvai = false;
-#endif
 #endif 
 
-#if LGE_SHARP_VSP_INHERIT_F0104
 #if H_3D_IC
   Bool bICFlag = getICFlag(uiAbsPartIdx);
@@ -4091,7 +3932,6 @@
   Bool bARPFlag = getARPW(uiAbsPartIdx)>0 ? true : false;
 #endif
-#endif
-
-#if ETRIKHU_MERGE_REUSE_F0093
+
+#if H_3D
   Int  iPosLeftAbove[2] = {-1, -1};
 
@@ -4118,5 +3958,4 @@
 #if H_3D_VSP
     if (pcCULeft->getVSPFlag(uiLeftPartIdx) == 1
-#if LGE_SHARP_VSP_INHERIT_F0104
 #if H_3D_IC
       && !bICFlag
@@ -4125,11 +3964,7 @@
       && !bARPFlag
 #endif
-#endif
       )
     {
       vspFlag[numA1B1B0] = 1;
-#if !MTK_VSP_SIMPLIFICATION_F0111
-      xInheritVSPDisInfo(pcCULeft,uiLeftPartIdx,iCount,inheritedVSPDisInfo);
-#endif
     }
 #endif
@@ -4145,10 +3980,5 @@
     iPosLeftAbove[1] = numA1B1B0;
 #if H_3D_VSP
-#if BUGFIX_2_F0093 && MTK_VSP_SIMPLIFICATION_F0111
     if ( ( ( getAddr() - pcCUAbove->getAddr() ) == 0) && (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1) 
-#else
-    if (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1
-#endif
-#if LGE_SHARP_VSP_INHERIT_F0104
 #if H_3D_IC
       && !bICFlag
@@ -4157,11 +3987,7 @@
       && !bARPFlag
 #endif
-#endif
       )
     {
       vspFlag[numA1B1B0] = 1;
-#if !MTK_VSP_SIMPLIFICATION_F0111
-      xInheritVSPDisInfo(pcCUAbove,uiAbovePartIdx,iCount,inheritedVSPDisInfo);
-#endif
     }
 #endif
@@ -4177,10 +4003,5 @@
   {
 #if H_3D_VSP
-#if BUGFIX_2_F0093 && MTK_VSP_SIMPLIFICATION_F0111
     if ( ( ( getAddr() - pcCUAboveRight->getAddr() ) == 0) && (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1) 
-#else
-    if (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1
-#endif
-#if LGE_SHARP_VSP_INHERIT_F0104
 #if H_3D_IC
       && !bICFlag
@@ -4189,11 +4010,7 @@
       && !bARPFlag
 #endif
-#endif
       )
     {
       vspFlag[numA1B1B0] = 1;
-#if !MTK_VSP_SIMPLIFICATION_F0111
-      xInheritVSPDisInfo(pcCUAboveRight,uiAboveRightPartIdx,iCount,inheritedVSPDisInfo);
-#endif
     }
 #endif
@@ -4208,5 +4025,4 @@
 #if H_3D_VSP
     if (pcCULeftBottom->getVSPFlag(uiLeftBottomPartIdx) == 1
-#if LGE_SHARP_VSP_INHERIT_F0104
 #if H_3D_IC
       && !bICFlag
@@ -4215,11 +4031,7 @@
       && !bARPFlag
 #endif
-#endif
       )
     {
       vspFlag[numA1B1B0] = 1;
-#if !MTK_VSP_SIMPLIFICATION_F0111
-      xInheritVSPDisInfo(pcCULeftBottom,uiLeftBottomPartIdx,iCount,inheritedVSPDisInfo);
-#endif
     }
 #endif
@@ -4235,10 +4047,5 @@
   {
 #if H_3D_VSP
-#if BUGFIX_2_F0093 && MTK_VSP_SIMPLIFICATION_F0111
     if ( ( ( getAddr() - pcCUAboveLeft->getAddr() ) == 0) && (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1) 
-#else
-    if (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1
-#endif
-#if LGE_SHARP_VSP_INHERIT_F0104
 #if H_3D_IC
       && !bICFlag
@@ -4247,11 +4054,7 @@
       && !bARPFlag
 #endif
-#endif
       )
     {
       vspFlag[numA1B1B0+iCountHEVC] = 1;
-#if !MTK_VSP_SIMPLIFICATION_F0111
-      xInheritVSPDisInfo(pcCUAboveLeft,uiAboveLeftPartIdx,iCount,inheritedVSPDisInfo);
-#endif
     }
 #endif
@@ -4265,23 +4068,16 @@
 
 #if H_3D_IV_MERGE
-  
+
   /////////////////////////////////////////////
   //////// TEXTURE MERGE CANDIDATE (T) ////////
   /////////////////////////////////////////////
-  
-#if SEC_MPI_ENABLING_MERGE_F0150
+
   if( bMPIFlag)
-#else
-  if( m_pcSlice->getIsDepth())
-#endif
   {
     UInt uiPartIdxCenter;
     xDeriveCenterIdx( uiPUIdx, uiPartIdxCenter );    
-
-#if ETRIKHU_MERGE_REUSE_F0093
     tmpMV[0].setMvField( cZeroMv, NOT_VALID );
     tmpMV[1].setMvField( cZeroMv, NOT_VALID );
     Int tRef[2]={-1, -1};
-#endif
 
 #if H_3D_FCO
@@ -4289,9 +4085,9 @@
     TComDataCU *pcTextureCU = 0;
     if ( pcTexturePic )
-        pcTextureCU = pcTexturePic->getCU( getAddr() );
+      pcTextureCU = pcTexturePic->getCU( getAddr() );
 #else
     TComDataCU *pcTextureCU = m_pcSlice->getTexturePic()->getCU( getAddr() );
 #endif
- 
+
 #if H_3D_FCO
     if ( pcTextureCU && pcTexturePic->getReconMark() && !pcTextureCU->isIntra( uiPartIdxCenter ) )
@@ -4300,5 +4096,4 @@
 #endif
     {
-#if ETRIKHU_MERGE_REUSE_F0093
       pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_0, tmpMV[0] );
       tRef[0] = getPic()->isTextRefValid( REF_PIC_LIST_0, tmpMV[0].getRefIdx() );
@@ -4414,59 +4209,7 @@
         }
         iCount ++;
-
-#else
-      pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
-      Int iValidDepRef = getPic()->isTextRefValid( REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1].getRefIdx() );
-      if( (pcMvFieldNeighbours[iCount<<1].getRefIdx()>=0) && ( iValidDepRef >= 0 ) )
-      {
-        TComMv cMvPred = pcMvFieldNeighbours[iCount<<1].getMv();
-        const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) );
-        cMvPred+=cAdd;
-        cMvPred>>=2;
-        clipMv(cMvPred);
-        pcMvFieldNeighbours[iCount<<1].setMvField(cMvPred,iValidDepRef);
-      }
-      if ( getSlice()->isInterB() )
-      {
-        pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
-        iValidDepRef = getPic()->isTextRefValid( REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx() );
-        if( (pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx()>=0) && ( iValidDepRef >= 0) )
-        {
-          TComMv cMvPred = pcMvFieldNeighbours[(iCount<<1)+1].getMv();
-          const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) );
-          cMvPred+=cAdd;
-          cMvPred>>=2;
-          clipMv(cMvPred);
-          pcMvFieldNeighbours[(iCount<<1)+1].setMvField(cMvPred,iValidDepRef);
-        }
-      }
-      puhInterDirNeighbours[iCount] = (pcMvFieldNeighbours[iCount<<1].getRefIdx()>=0)?1:0;
-      puhInterDirNeighbours[iCount] += (pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx()>=0)?2:0;
-      if( puhInterDirNeighbours[iCount] != 0 )
-      {
-        abCandIsInter[iCount] = true;
-        if ( mrgCandIdx == iCount )
-        {
-          return;
-        }
-        iCount ++;
-      }
-#endif
-      }
-    }
-  }
-
-
-#if !ETRIKHU_MERGE_REUSE_F0093
-  //////////////////////////////////
-  //////// GET DISPARITIES  ////////
-  //////////////////////////////////
-
-  DisInfo cDisInfo = getDvInfo(uiAbsPartIdx);
-  for(Int i = 0; i < MRG_MAX_NUM_CANDS_MEM; i++)
-  {
-    inheritedVSPDisInfo[i].m_acDvInfo = cDisInfo;
-  }
-#endif
+      }
+    }
+  }
 
   /////////////////////////////////////////////////////////////////
@@ -4475,8 +4218,4 @@
 
   Int  posIvDC          = -1;
-#if !ETRIKHU_MERGE_REUSE_F0093
-  Bool bLeftAvai        = false;
-  Int  iPosLeftAbove[2] = {-1, -1};
-#endif
 
   // { IvMCL0, IvMCL1, IvDCL0, IvDCL1, IvMCL0Shift, IvMCL1Shift, IvDCL0Shift, IvDCL1Shift };  
@@ -4489,17 +4228,10 @@
 
   Bool ivMvPredFlag   = getSlice()->getVPS()->getIvMvPredFlag( getSlice()->getLayerIdInVps() );
-  
+
   if ( ivMvPredFlag )
   {
-    getInterViewMergeCands(uiPUIdx, ivCandRefIdx, ivCandMv, &cDisInfo, ivCandDir 
-#if QC_DEPTH_IV_MRG_F0125
-    , bIsDepth
-#endif
-#if MTK_SPIVMP_F0110
-    , pcMvFieldSP, puhInterDirSP
-#endif
-    );
+    getInterViewMergeCands(uiPUIdx, ivCandRefIdx, ivCandMv, &cDisInfo, ivCandDir , bIsDepth, pcMvFieldSP, puhInterDirSP );
   }  
-  
+
   ///////////////////////////////////////////////
   //////// INTER VIEW MOTION COMP(IvMC) /////////
@@ -4508,5 +4240,4 @@
   if( ivCandDir[0] )
   {
-#if ETRIKHU_MERGE_REUSE_F0093
     tmpMV[0].setMvField( cZeroMv, NOT_VALID );
     tmpMV[1].setMvField( cZeroMv, NOT_VALID );
@@ -4525,8 +4256,6 @@
     Int iCnloop=0;
 
-#if BUGFIX_F0093
     if (!bIsDepth)
     {
-#endif
       for(Int i = 0; i < 2; i ++)
       {
@@ -4542,22 +4271,11 @@
         }      
       }
-#if BUGFIX_F0093
-    }
-#endif
-#if QC_DEPTH_IV_MRG_F0125
-#if BUGFIX_F0093
+    }
     if (bIsDepth)
-#else
-    if ( bIsDepth && !bRemoveSpa)
-#endif
     {
       iCnloop = iCount-1;
       for(; iCnloop >= 0; iCnloop --)
       {
-#if BUGFIX_F0093
         if(ivCandDir[0] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==tmpMV[0] && pcMvFieldNeighbours[(iCnloop<<1)+1]==tmpMV[1])  // F0125 compatible with F0093
-#else
-        if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
-#endif
         {
           bRemoveSpa                      = true;
@@ -4565,12 +4283,5 @@
         }
       }
-#if !BUGFIX_F0093
-      if(!bRemoveSpa)
-      {
-        bDepthIPMCAvai = true;
-      }
-#endif
-    }
-#endif
+    }
 
     if (!bRemoveSpa)
@@ -4628,7 +4339,5 @@
     if (bIvMC)
     {
-#if MTK_SPIVMP_F0110
       pbSPIVMPFlag[iCount] = true;
-#endif
       if( ( ivCandDir[0] & 1 ) == 1 )
       {
@@ -4642,59 +4351,4 @@
       puhInterDirNeighbours[ iCount ] = ivCandDir[0];
 
-#if !BUGFIX_F0093
-#if QC_DEPTH_IV_MRG_F0125
-      if ( bDepthIPMCAvai || !bIsDepth )
-      {
-#endif
-#endif
-        if ( mrgCandIdx == iCount )
-        {
-          return;
-        }
-        iCount ++;
-#if !BUGFIX_F0093
-#if QC_DEPTH_IV_MRG_F0125
-      }
-#endif
-#endif
-    }
-#else
-    abCandIsInter        [ iCount ] = true;
-    puhInterDirNeighbours[ iCount ] = ivCandDir[0];    
-
-    if( ( ivCandDir[0] & 1 ) == 1 )
-    {
-      pcMvFieldNeighbours[ iCount<<1    ].setMvField( ivCandMv[ 0 ], ivCandRefIdx[ 0 ] );
-    }
-    if( ( ivCandDir[0] & 2 ) == 2 )
-    {
-      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( ivCandMv[ 1 ], ivCandRefIdx[ 1 ] );
-    }
-#if QC_DEPTH_IV_MRG_F0125
-    if ( bIsDepth )
-    {
-      Bool bRemoveSpa = false;
-      Int iCnloop = iCount-1;
-      for(; iCnloop >= 0; iCnloop --)
-      {
-        if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
-        {
-          bRemoveSpa                      = true;
-          abCandIsInter        [ iCount ] = false;
-
-          puhInterDirNeighbours[iCount]   = 0;
-          pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID );
-          pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
-          break;
-        }
-      }
-      if(!bRemoveSpa)
-      {
-        bDepthIPMCAvai = true;
-      }
-    }
-    if ( bDepthIPMCAvai || !bIsDepth )
-    {
-#endif
       if ( mrgCandIdx == iCount )
       {
@@ -4702,10 +4356,5 @@
       }
       iCount ++;
-#if QC_DEPTH_IV_MRG_F0125
-    }
-#endif
-
-#endif
-
+    }
   } 
 
@@ -4717,16 +4366,7 @@
 #endif
 
-
-
-
-
-#if ETRIKHU_MERGE_REUSE_F0093
+#if H_3D
   iCount += numA1B1B0;
 #else
-#if H_3D
-  ////////////////////////////
-  //////// LEFT (A1) /////////
-  ////////////////////////////
-#endif
   //left
   UInt uiLeftPartIdx = 0;
@@ -4748,58 +4388,5 @@
       pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     }
-#if H_3D_IV_MERGE 
-    Bool bRemoveSpa = false; //pruning to inter-view candidates
-#if QC_DEPTH_IV_MRG_F0125
-    Int  iCnloop = bDepthIPMCAvai ? (iCount-2): (iCount-1);
-#else
-    Int  iCnloop    = iCount - 1;
-#endif
-    for(; iCnloop >= 0; iCnloop --)
-    {
-      if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
-      {
-        bRemoveSpa                      = true;
-        abCandIsInter        [ iCount ] = false;
-
-        //reset to the default value for MC
-        puhInterDirNeighbours[iCount]   = 0;
-        pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID );
-        pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
-        break;
-      }
-    }
-    if(!bRemoveSpa)
-    {
-      bLeftAvai = true;
-      iPosLeftAbove[0] = iCount;
-#if H_3D_NBDV
-      pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
-      pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
-#endif
-#if H_3D_VSP
-      if (pcCULeft->getVSPFlag(uiLeftPartIdx) == 1
-#if LGE_SHARP_VSP_INHERIT_F0104
-#if H_3D_IC
-        && !bICFlag
-#endif
-#if H_3D_ARP
-        && !bARPFlag
-#endif
-#endif
-        )
-      {
-        vspFlag[iCount] = 1;
-#if !MTK_VSP_SIMPLIFICATION_F0111
-        xInheritVSPDisInfo(pcCULeft,uiLeftPartIdx,iCount,inheritedVSPDisInfo);
-#endif
-      }
-#endif
-      if ( mrgCandIdx == iCount )
-      {
-        return;
-      }
-      iCount ++;
-    }
-#else // H_3D_IV_MERGE 
+
     if ( mrgCandIdx == iCount )
     {
@@ -4807,5 +4394,4 @@
     }
     iCount ++;
-#endif // H_3D_IV_MERGE 
   }
 
@@ -4815,9 +4401,5 @@
     return;
   }
-#if H_3D
-  ////////////////////////////
-  //////// ABOVE (B1) ////////
-  ////////////////////////////
-#endif
+
   // above
   UInt uiAbovePartIdx = 0;
@@ -4839,77 +4421,5 @@
       pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     }
-#if H_3D_IV_MERGE 
-    Bool bRemoveSpa = false; //pruning to inter-view candidates
-#if QC_DEPTH_IV_MRG_F0125
-    Int iCnloop;
-    if( bIsDepth )
-      iCnloop = (bLeftAvai && bDepthIPMCAvai) ? (iCount-3) : ((bLeftAvai || bDepthIPMCAvai)  ? (iCount-2): (iCount-1));
-    else
-      iCnloop = bLeftAvai? (iCount-2): (iCount-1);
-#else
-    Int  iCnloop    = bLeftAvai? (iCount-2): (iCount-1);
-#endif
-    for(; iCnloop >= 0; iCnloop --)
-    {
-      if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
-      {
-        bRemoveSpa                      = true;
-        abCandIsInter        [ iCount ] = false;
-
-        //reset to the default value for MC
-        puhInterDirNeighbours[iCount]   = 0;
-
-        pcMvFieldNeighbours[iCount<<1]    .setMvField( cZeroMv, NOT_VALID );
-        pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
-        break;
-      }
-    }
-
-    if(!bRemoveSpa)
-    {
-      iPosLeftAbove[1] = iCount;
-#if H_3D_NBDV
-      pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
-      pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
-#endif
-#if H_3D_VSP
-#if MTK_VSP_SIMPLIFICATION_F0111
-      if ( ( ( getAddr() - pcCUAbove->getAddr() ) == 0) && (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1) 
-#if LGE_SHARP_VSP_INHERIT_F0104
-#if H_3D_IC
-        && !bICFlag
-#endif
-#if H_3D_ARP
-        && !bARPFlag
-#endif
-#endif
-        )
-#else
-      if (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1
-#if LGE_SHARP_VSP_INHERIT_F0104
-#if H_3D_IC
-        && !bICFlag
-#endif
-#if H_3D_ARP
-        && !bARPFlag
-#endif
-#endif
-        )
-#endif
-      {
-
-        vspFlag[iCount] = 1;
-#if !MTK_VSP_SIMPLIFICATION_F0111
-        xInheritVSPDisInfo(pcCUAbove,uiAbovePartIdx,iCount,inheritedVSPDisInfo);
-#endif
-      }
-#endif
-      if ( mrgCandIdx == iCount )
-      {
-        return;
-      }
-      iCount ++;
-    }
-#else // H_3D_IV_MERGE 
+
     if ( mrgCandIdx == iCount )
     {
@@ -4917,5 +4427,4 @@
     }
     iCount ++;
-#endif // H_3D_IV_MERGE 
   }
   // early termination
@@ -4924,10 +4433,4 @@
     return;
   }
-
-#if H_3D
-  //////////////////////////////////
-  //////// ABOVE RIGHT (B0) ////////
-  //////////////////////////////////
-#endif
 
   // above right
@@ -4949,39 +4452,5 @@
       pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     }
-#if H_3D_NBDV
-    pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
-    pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
-#endif
-#if H_3D_VSP
-#if MTK_VSP_SIMPLIFICATION_F0111
-    if ( ( ( getAddr() - pcCUAboveRight->getAddr() ) == 0) && (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1) 
-#if LGE_SHARP_VSP_INHERIT_F0104
-#if H_3D_IC
-      && !bICFlag
-#endif
-#if H_3D_ARP
-      && !bARPFlag
-#endif
-#endif
-      )
-#else
-    if (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1
-#if LGE_SHARP_VSP_INHERIT_F0104
-#if H_3D_IC
-      && !bICFlag
-#endif
-#if H_3D_ARP
-      && !bARPFlag
-#endif
-#endif
-      )
-#endif
-    {
-      vspFlag[iCount] = 1;
-#if !MTK_VSP_SIMPLIFICATION_F0111
-      xInheritVSPDisInfo(pcCUAboveRight,uiAboveRightPartIdx,iCount,inheritedVSPDisInfo);
-#endif
-    }
-#endif
+
     if ( mrgCandIdx == iCount )
     {
@@ -5003,13 +4472,8 @@
   /////////////////////////////////////////////
 
-#if ETRIKHU_MERGE_REUSE_F0093
   if( ivCandDir[1] && iCount < getSlice()->getMaxNumMergeCand())
-#else
-  if( ivCandDir[1] )
-#endif
   {
     assert(iCount < getSlice()->getMaxNumMergeCand());
 
-#if ETRIKHU_MERGE_REUSE_F0093
     tmpMV[0].setMvField( cZeroMv, NOT_VALID );
     tmpMV[1].setMvField( cZeroMv, NOT_VALID );
@@ -5022,16 +4486,4 @@
       tmpMV[1].setMvField( ivCandMv[ 3 ], ivCandRefIdx[ 3 ] );
     }
-#else
-    abCandIsInter        [ iCount ] = true;
-    puhInterDirNeighbours[ iCount ] = ivCandDir[1];
-    if( ( ivCandDir[1] & 1 ) == 1 )
-    {
-      pcMvFieldNeighbours[ iCount<<1    ].setMvField( ivCandMv[ 2 ], ivCandRefIdx[ 2 ] );
-    }
-    if( ( ivCandDir[1] & 2 ) == 2 )
-    {
-      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( ivCandMv[ 3 ], ivCandRefIdx[ 3 ] );
-    }
-#endif
 
     Bool bRemoveSpa = false; //pruning to A1, B1
@@ -5046,11 +4498,4 @@
       {
         bRemoveSpa                      = true;
-#if !ETRIKHU_MERGE_REUSE_F0093
-        abCandIsInter        [ iCount ] = false;
-        //reset to the default value for MC
-        puhInterDirNeighbours[iCount]   = 0;
-        pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID );
-        pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
-#endif
         break;
       }      
@@ -5058,5 +4503,4 @@
     if(!bRemoveSpa)
     {
-#if ETRIKHU_MERGE_REUSE_F0093
       rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV);
       puhInterDirNeighbours[ iCount ] = ivCandDir[1];
@@ -5069,5 +4513,4 @@
         pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( ivCandMv[ 3 ], ivCandRefIdx[ 3 ] );
       }
-#endif
 #if H_3D_NBDV
       pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
@@ -5092,11 +4535,8 @@
   //////// VIEW SYNTHESIS PREDICTION (VSP) ////////
   /////////////////////////////////////////////////
-#if ETRIKHU_MERGE_REUSE_F0093
   if (iCount<getSlice()->getMaxNumMergeCand())
   {
-#endif
 
   if (
-#if LGE_SHARP_VSP_INHERIT_F0104
 #if H_3D_IC
       !bICFlag &&
@@ -5105,10 +4545,5 @@
       !bARPFlag &&
 #endif
-#endif
-#if ETRIKHU_MERGE_REUSE_F0093
       xAddVspCand( mrgCandIdx, &cDisInfo, iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, iCount3DV, inheritedVSPDisInfo ) )
-#else
-      xAddVspCand( mrgCandIdx, &cDisInfo, iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag ) )
-#endif
   {
     return;
@@ -5121,17 +4556,11 @@
   }
 #endif
-#if ETRIKHU_MERGE_REUSE_F0093
-  }
-#endif
-
-#if ETRIKHU_MERGE_REUSE_F0093
+#if H_3D
+  }
+#endif
+
+#if H_3D
   iCount += numA0B2;
 #else
-#if H_3D
-  ///////////////////////////////////
-  //////// LEFT BOTTOM (A0) ////////
-  ///////////////////////////////////
-#endif
-
   //left bottom
   UInt uiLeftBottomPartIdx = 0;
@@ -5152,26 +4581,4 @@
       pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     }
-#if H_3D_NBDV
-    pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
-    pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
-#endif
-#if H_3D_VSP
-    if (pcCULeftBottom->getVSPFlag(uiLeftBottomPartIdx) == 1
-#if LGE_SHARP_VSP_INHERIT_F0104
-#if H_3D_IC
-        && !bICFlag
-#endif
-#if H_3D_ARP
-        && !bARPFlag
-#endif
-#endif
-        )
-    {
-      vspFlag[iCount] = 1;
-#if !MTK_VSP_SIMPLIFICATION_F0111
-      xInheritVSPDisInfo(pcCULeftBottom,uiLeftBottomPartIdx,iCount,inheritedVSPDisInfo);
-#endif
-    }
-#endif
     if ( mrgCandIdx == iCount )
     {
@@ -5185,9 +4592,4 @@
     return;
   }
-#if H_3D
-  ///////////////////////////////////
-  //////// LEFT ABOVE (B2) ////////
-  ///////////////////////////////////
-#endif
 
   // above left 
@@ -5212,39 +4614,4 @@
         pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
       }
-#if H_3D_NBDV
-      pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
-      pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
-#endif
-#if H_3D_VSP
-#if MTK_VSP_SIMPLIFICATION_F0111
-      if ( ( ( getAddr() - pcCUAboveLeft->getAddr() ) == 0) && (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1) 
-#if LGE_SHARP_VSP_INHERIT_F0104
-#if H_3D_IC
-          && !bICFlag
-#endif
-#if H_3D_ARP
-          && !bARPFlag
-#endif
-#endif
-          )
-#else
-      if (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1
-#if LGE_SHARP_VSP_INHERIT_F0104
-#if H_3D_IC
-          && !bICFlag
-#endif
-#if H_3D_ARP
-          && !bARPFlag
-#endif
-#endif
-          )
-#endif
-      {
-        vspFlag[iCount] = 1;
-#if !MTK_VSP_SIMPLIFICATION_F0111
-        xInheritVSPDisInfo(pcCUAboveLeft,uiAboveLeftPartIdx,iCount,inheritedVSPDisInfo);
-#endif
-      }
-#endif
       if ( mrgCandIdx == iCount )
       {
@@ -5266,13 +4633,7 @@
   //////// SHIFTED IV (IvMCShift + IvDCShift) ////////
   ////////////////////////////////////////////////////
-#if ETRIKHU_MERGE_REUSE_F0093
   if(  ivMvPredFlag && iCount < getSlice()->getMaxNumMergeCand() ) 
   {
     if(xAddIvMRGCand( mrgCandIdx,  iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, ivCandDir, ivCandMv, ivCandRefIdx, posIvDC, vspFlag, iCount3DV, inheritedVSPDisInfo ) )
-#else
-  if(  ivMvPredFlag  ) 
-  {
-    if(xAddIvMRGCand( mrgCandIdx,  iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, ivCandDir, ivCandMv, ivCandRefIdx, posIvDC, vspFlag))
-#endif
     {
       return;
@@ -5286,5 +4647,5 @@
 #endif
 
-#if ETRIKHU_MERGE_REUSE_F0093
+#if H_3D
   if (iCountHEVC + iCount3DV > getSlice()->getMaxNumMergeCand())
   {
@@ -5297,9 +4658,4 @@
   numValidMergeCand = iCount;
 #else
-#if H_3D
-  /////////////////////////////////
-  //////// Collocate (COL) ////////
-  /////////////////////////////////
-#endif
   if ( getSlice()->getEnableTMVPFlag())
   {
@@ -5366,7 +4722,4 @@
     if ( getSlice()->isInterB() )
     {
-#if H_3D_TMVP
-      iRefIdx = 0;
-#endif
       bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_1, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx);
       if( bExistMV == false )
@@ -5385,8 +4738,4 @@
       puhInterDirNeighbours[uiArrayAddr] = dir;
       abCandIsInter[uiArrayAddr] = true;
-#if H_3D_NBDV
-      pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
-      pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
-#endif
       if ( mrgCandIdx == iCount )
       {
@@ -5406,31 +4755,11 @@
   if ( getSlice()->isInterB())
   {
-#if H_3D_IV_MERGE
-    UInt uiPriorityList0[20] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3,    0, 4, 1, 4, 2, 4, 3, 4 };
-    UInt uiPriorityList1[20] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2,    4, 0, 4, 1, 4, 2, 4, 3 };
-#else
     UInt uiPriorityList0[12] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3};
     UInt uiPriorityList1[12] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2};
-#endif
 
     for (Int idx=0; idx<uiCutoff*(uiCutoff-1) && uiArrayAddr!= getSlice()->getMaxNumMergeCand(); idx++)
     {
       Int i = uiPriorityList0[idx]; Int j = uiPriorityList1[idx];
-#if H_3D_VSP
-      Bool bValid = true;
-      if ( vspFlag[i] == 1 || vspFlag[j] == 1 )
-      {
-        bValid = false;
-      }
-      if( !m_pcSlice->getVPS()->getViewSynthesisPredFlag( m_pcSlice->getLayerIdInVps() ) )
-      {
-        assert(bValid == true);
-      }
-#endif
-#if H_3D_VSP
-      if (abCandIsInter[i] && abCandIsInter[j] && (puhInterDirNeighbours[i]&0x1) && (puhInterDirNeighbours[j]&0x2) && bValid)
-#else
       if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2))
-#endif
       {
         abCandIsInter[uiArrayAddr] = true;
@@ -5488,8 +4817,4 @@
 #endif
 }
-
-
-
-
 #else
 
@@ -5503,38 +4828,16 @@
  */
 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours
-#if H_3D_VSP
-      , Int* vspFlag
-      , InheritedVSPDisInfo*  inheritedVSPDisInfo
-#endif
       , Int& numValidMergeCand, Int mrgCandIdx
 )
 {
   UInt uiAbsPartAddr = m_uiAbsIdxInLCU + uiAbsPartIdx;
-#if H_3D_IV_MERGE
-  ////////////////////////////
-  //////// INIT LISTS ////////
-  ////////////////////////////
-  TComMv cZeroMv;
-  Bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ];
-#else
   Bool abCandIsInter[ MRG_MAX_NUM_CANDS ];
-#endif
   for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ++ui )
   {
     abCandIsInter[ui] = false;
-#if H_3D_IV_MERGE
-    pcMvFieldNeighbours[ ( ui << 1 )     ].setMvField(cZeroMv, NOT_VALID);
-    pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setMvField(cZeroMv, NOT_VALID);
-#else
     pcMvFieldNeighbours[ ( ui << 1 )     ].setRefIdx(NOT_VALID);
     pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setRefIdx(NOT_VALID);
-#endif
   }
   numValidMergeCand = getSlice()->getMaxNumMergeCand();
-#if H_3D
-  //////////////////////////////////
-  //////// DERIVE LOCATIONS ////////
-  //////////////////////////////////
-#endif
   // compute the location of the current PU
   Int xP, yP, nPSW, nPSH;
@@ -5547,197 +4850,5 @@
   deriveLeftRightTopIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT );
   deriveLeftBottomIdxGeneral  ( uiAbsPartIdx, uiPUIdx, uiPartIdxLB );
-#if SEC_MPI_ENABLING_MERGE_F0150
-  Bool bMPIFlag   = getSlice()->getVPS()->getMPIFlag( getSlice()->getLayerIdInVps() );
-#endif
-#if QC_DEPTH_IV_MRG_F0125
-  Bool bIsDepth = getSlice()->getIsDepth();
-  Bool bDepthIPMCAvai = false;
-#endif 
-
-#if LGE_SHARP_VSP_INHERIT_F0104
-#if H_3D_IC
-  Bool bICFlag = getICFlag(uiAbsPartIdx);
-#endif
-#if H_3D_ARP
-  Bool bARPFlag = getARPW(uiAbsPartIdx)>0 ? true : false;
-#endif
-#endif
-
-#if H_3D_IV_MERGE
-  
-  /////////////////////////////////////////////
-  //////// TEXTURE MERGE CANDIDATE (T) ////////
-  /////////////////////////////////////////////
-
-#if SEC_MPI_ENABLING_MERGE_F0150
-  if( bMPIFlag)
-#else
-  if( m_pcSlice->getIsDepth())
-#endif
-  {
-    UInt uiPartIdxCenter;
-    xDeriveCenterIdx( uiPUIdx, uiPartIdxCenter );    
-#if H_3D_FCO
-    TComPic * pcTexturePic = m_pcSlice->getTexturePic();
-    TComDataCU *pcTextureCU = 0;
-    if ( pcTexturePic )
-        pcTextureCU = pcTexturePic->getCU( getAddr() );
-#else
-    TComDataCU *pcTextureCU = m_pcSlice->getTexturePic()->getCU( getAddr() );
-#endif
- 
-#if H_3D_FCO
-    if ( pcTextureCU && pcTexturePic->getReconMark() && !pcTextureCU->isIntra( uiPartIdxCenter ) )
-#else
-    if ( pcTextureCU && !pcTextureCU->isIntra( uiPartIdxCenter ) )
-#endif
-    {
-      pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
-      Int iValidDepRef = getPic()->isTextRefValid( REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1].getRefIdx() );
-      if( (pcMvFieldNeighbours[iCount<<1].getRefIdx()>=0) && ( iValidDepRef >= 0 ) )
-      {
-        TComMv cMvPred = pcMvFieldNeighbours[iCount<<1].getMv();
-        const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) );
-        cMvPred+=cAdd;
-        cMvPred>>=2;
-        clipMv(cMvPred);
-        pcMvFieldNeighbours[iCount<<1].setMvField(cMvPred,iValidDepRef);
-      }
-
-      if ( getSlice()->isInterB() )
-      {
-        pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
-        iValidDepRef = getPic()->isTextRefValid( REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx() );
-        if( (pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx()>=0) && ( iValidDepRef >= 0) )
-        {
-          TComMv cMvPred = pcMvFieldNeighbours[(iCount<<1)+1].getMv();
-          const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) );
-          cMvPred+=cAdd;
-          cMvPred>>=2;
-          clipMv(cMvPred);
-          pcMvFieldNeighbours[(iCount<<1)+1].setMvField(cMvPred,iValidDepRef);
-        }
-      }
-
-      puhInterDirNeighbours[iCount] = (pcMvFieldNeighbours[iCount<<1].getRefIdx()>=0)?1:0;
-      puhInterDirNeighbours[iCount] += (pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx()>=0)?2:0;
-
-      if( puhInterDirNeighbours[iCount] != 0 )
-      {
-        abCandIsInter[iCount] = true;
-        if ( mrgCandIdx == iCount )
-        {
-          return;
-        }
-        iCount ++;
-      }
-    }
-  }
-
-  //////////////////////////////////
-  //////// GET DISPARITIES  ////////
-  //////////////////////////////////
-
-  DisInfo cDisInfo = getDvInfo(uiAbsPartIdx);
-
-  for(Int i = 0; i < MRG_MAX_NUM_CANDS_MEM; i++)
-  {
-    inheritedVSPDisInfo[i].m_acDvInfo = cDisInfo;
-  }
-
-  /////////////////////////////////////////////////////////////////
-  //////// DERIVE IvMC, IvMCShift,IvDCShift, IvDC  Candidates /////
-  /////////////////////////////////////////////////////////////////
-
-  Int  posIvDC          = -1;
-  Bool bLeftAvai        = false;
-  Int  iPosLeftAbove[2] = {-1, -1};
-
-
-  // { IvMCL0, IvMCL1, IvDCL0, IvDCL1, IvMCL0Shift, IvMCL1Shift, IvDCL0Shift, IvDCL1Shift };  
-  // An enumerator would be appropriate here! 
-  TComMv ivCandMv    [8];
-  Int    ivCandRefIdx[8] = {-1, -1, -1, -1, -1, -1, -1, -1};
-
-  // { IvMC, IvDC, IvMCShift, IvDCShift };  
-  Int    ivCandDir   [4] = {0, 0, 0, 0};
-
-  Bool ivMvPredFlag   = getSlice()->getVPS()->getIvMvPredFlag( getSlice()->getLayerIdInVps() );
-  
-  if ( ivMvPredFlag )
-  {
-    getInterViewMergeCands(uiPUIdx, ivCandRefIdx, ivCandMv, &cDisInfo, ivCandDir 
-#if QC_DEPTH_IV_MRG_F0125
-    , bIsDepth
-#endif
-    );
-  }  
-  
-  ///////////////////////////////////////////////
-  //////// INTER VIEW MOTION COMP(IvMC) /////////
-  ///////////////////////////////////////////////
-
-  if( ivCandDir[0] )
-  {
-    abCandIsInter        [ iCount ] = true;
-    puhInterDirNeighbours[ iCount ] = ivCandDir[0];    
-
-    if( ( ivCandDir[0] & 1 ) == 1 )
-    {
-      pcMvFieldNeighbours[ iCount<<1    ].setMvField( ivCandMv[ 0 ], ivCandRefIdx[ 0 ] );
-    }
-    if( ( ivCandDir[0] & 2 ) == 2 )
-    {
-      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( ivCandMv[ 1 ], ivCandRefIdx[ 1 ] );
-    }
-
-#if QC_DEPTH_IV_MRG_F0125
-    if ( bIsDepth )
-    {
-      Bool bRemoveSpa = false;
-      Int iCnloop = iCount-1;
-      for(; iCnloop >= 0; iCnloop --)
-      {
-        if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
-        {
-          bRemoveSpa                      = true;
-          abCandIsInter        [ iCount ] = false;
-
-          puhInterDirNeighbours[iCount]   = 0;
-          pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID );
-          pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
-          break;
-        }
-      }
-      if(!bRemoveSpa)
-      {
-        bDepthIPMCAvai = true;
-      }
-    }
-    if ( bDepthIPMCAvai || !bIsDepth )
-    {
-#endif
-    if ( mrgCandIdx == iCount )
-    {
-      return;
-    }
-    iCount ++;
-#if QC_DEPTH_IV_MRG_F0125
-    }
-#endif
-  } 
-
-  // early termination
-  if (iCount == getSlice()->getMaxNumMergeCand()) 
-  {
-    return;
-  }
-#endif
-
-#if H_3D
-  ////////////////////////////
-  //////// LEFT (A1) /////////
-  ////////////////////////////
-#endif
+
   //left
   UInt uiLeftPartIdx = 0;
@@ -5759,58 +4870,4 @@
       pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     }
-#if H_3D_IV_MERGE 
-    Bool bRemoveSpa = false; //pruning to inter-view candidates
-#if QC_DEPTH_IV_MRG_F0125
-    Int  iCnloop = bDepthIPMCAvai ? (iCount-2): (iCount-1);
-#else
-    Int  iCnloop    = iCount - 1;
-#endif
-    for(; iCnloop >= 0; iCnloop --)
-    {
-      if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
-      {
-        bRemoveSpa                      = true;
-        abCandIsInter        [ iCount ] = false;
-
-        //reset to the default value for MC
-        puhInterDirNeighbours[iCount]   = 0;
-        pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID );
-        pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
-        break;
-      }
-    }
-    if(!bRemoveSpa)
-    {
-      bLeftAvai = true;
-      iPosLeftAbove[0] = iCount;
-#if H_3D_NBDV
-      pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
-      pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
-#endif
-#if H_3D_VSP
-      if (pcCULeft->getVSPFlag(uiLeftPartIdx) == 1
-#if LGE_SHARP_VSP_INHERIT_F0104
-#if H_3D_IC
-          && !bICFlag
-#endif
-#if H_3D_ARP
-          && !bARPFlag
-#endif
-#endif
-          )
-      {
-        vspFlag[iCount] = 1;
-#if !MTK_VSP_SIMPLIFICATION_F0111
-        xInheritVSPDisInfo(pcCULeft,uiLeftPartIdx,iCount,inheritedVSPDisInfo);
-#endif
-      }
-#endif
-      if ( mrgCandIdx == iCount )
-      {
-        return;
-      }
-      iCount ++;
-    }
-#else // H_3D_IV_MERGE 
     if ( mrgCandIdx == iCount )
     {
@@ -5818,5 +4875,4 @@
     }
     iCount ++;
-#endif // H_3D_IV_MERGE 
   }
   
@@ -5826,9 +4882,5 @@
     return;
   }
-#if H_3D
-  ////////////////////////////
-  //////// ABOVE (B1) ////////
-  ////////////////////////////
-#endif
+
   // above
   UInt uiAbovePartIdx = 0;
@@ -5850,77 +4902,5 @@
       pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     }
-#if H_3D_IV_MERGE 
-    Bool bRemoveSpa = false; //pruning to inter-view candidates
-#if QC_DEPTH_IV_MRG_F0125
-    Int iCnloop;
-    if( bIsDepth )
-      iCnloop = (bLeftAvai && bDepthIPMCAvai) ? (iCount-3) : ((bLeftAvai || bDepthIPMCAvai)  ? (iCount-2): (iCount-1));
-    else
-      iCnloop = bLeftAvai? (iCount-2): (iCount-1);
-#else
-    Int  iCnloop    = bLeftAvai? (iCount-2): (iCount-1);
-#endif
-    for(; iCnloop >= 0; iCnloop --)
-    {
-      if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
-      {
-        bRemoveSpa                      = true;
-        abCandIsInter        [ iCount ] = false;
-
-        //reset to the default value for MC
-        puhInterDirNeighbours[iCount]   = 0;
-
-        pcMvFieldNeighbours[iCount<<1]    .setMvField( cZeroMv, NOT_VALID );
-        pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
-        break;
-      }
-    }
-
-    if(!bRemoveSpa)
-    {
-      iPosLeftAbove[1] = iCount;
-#if H_3D_NBDV
-      pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
-      pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
-#endif
-#if H_3D_VSP
-#if MTK_VSP_SIMPLIFICATION_F0111
-      if ( ( ( getAddr() - pcCUAbove->getAddr() ) == 0) && (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1) 
-#if LGE_SHARP_VSP_INHERIT_F0104
-#if H_3D_IC
-          && !bICFlag
-#endif
-#if H_3D_ARP
-          && !bARPFlag
-#endif
-#endif
-          )
-#else
-      if (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1
-#if LGE_SHARP_VSP_INHERIT_F0104
-#if H_3D_IC
-          && !bICFlag
-#endif
-#if H_3D_ARP
-          && !bARPFlag
-#endif
-#endif
-          )
-#endif
-      {
-
-        vspFlag[iCount] = 1;
-#if !MTK_VSP_SIMPLIFICATION_F0111
-        xInheritVSPDisInfo(pcCUAbove,uiAbovePartIdx,iCount,inheritedVSPDisInfo);
-#endif
-      }
-#endif
-      if ( mrgCandIdx == iCount )
-      {
-        return;
-      }
-      iCount ++;
-    }
-#else // H_3D_IV_MERGE 
+
     if ( mrgCandIdx == iCount )
     {
@@ -5928,5 +4908,4 @@
     }
     iCount ++;
-#endif // H_3D_IV_MERGE 
   }
   // early termination
@@ -5936,9 +4915,4 @@
   }
 
-#if H_3D
-  //////////////////////////////////
-  //////// ABOVE RIGHT (B0) ////////
-  //////////////////////////////////
-#endif
 
   // above right
@@ -5960,39 +4934,4 @@
       pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     }
-#if H_3D_NBDV
-    pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
-    pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
-#endif
-#if H_3D_VSP
-#if MTK_VSP_SIMPLIFICATION_F0111
-    if ( ( ( getAddr() - pcCUAboveRight->getAddr() ) == 0) && (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1) 
-#if LGE_SHARP_VSP_INHERIT_F0104
-#if H_3D_IC
-        && !bICFlag
-#endif
-#if H_3D_ARP
-        && !bARPFlag
-#endif
-#endif
-        )
-#else
-    if (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1
-#if LGE_SHARP_VSP_INHERIT_F0104
-#if H_3D_IC
-        && !bICFlag
-#endif
-#if H_3D_ARP
-        && !bARPFlag
-#endif
-#endif
-        )
-#endif
-    {
-      vspFlag[iCount] = 1;
-#if !MTK_VSP_SIMPLIFICATION_F0111
-      xInheritVSPDisInfo(pcCUAboveRight,uiAboveRightPartIdx,iCount,inheritedVSPDisInfo);
-#endif
-    }
-#endif
     if ( mrgCandIdx == iCount )
     {
@@ -6006,93 +4945,4 @@
     return;
   }
-
-#if H_3D_IV_MERGE 
-  /////////////////////////////////////////////
-  //////// INTER VIEW DISP COMP (IvDC) ////////
-  /////////////////////////////////////////////
-
-  if( ivCandDir[1] )
-  {
-    assert(iCount < getSlice()->getMaxNumMergeCand());
-    abCandIsInter        [ iCount ] = true;
-    puhInterDirNeighbours[ iCount ] = ivCandDir[1];
-    if( ( ivCandDir[1] & 1 ) == 1 )
-    {
-      pcMvFieldNeighbours[ iCount<<1    ].setMvField( ivCandMv[ 2 ], ivCandRefIdx[ 2 ] );
-    }
-    if( ( ivCandDir[1] & 2 ) == 2 )
-    {
-      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( ivCandMv[ 3 ], ivCandRefIdx[ 3 ] );
-    }
-
-    Bool bRemoveSpa = false; //pruning to A1, B1
-    for(Int i = 0; i < 2; i ++)
-    {
-      Int iCnloop = iPosLeftAbove[i];
-      if ( iCnloop == -1 ) 
-      {
-        continue;
-      }
-      if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
-      {
-        bRemoveSpa                      = true;
-        abCandIsInter        [ iCount ] = false;
-        //reset to the default value for MC
-        puhInterDirNeighbours[iCount]   = 0;
-        pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID );
-        pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
-        break;
-      }      
-    }
-    if(!bRemoveSpa)
-    {
-#if H_3D_NBDV
-      pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
-      pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
-#endif
-      posIvDC  = iCount;
-      if ( mrgCandIdx == iCount )
-        return;
-      iCount ++;
-
-      // early termination
-      if (iCount == getSlice()->getMaxNumMergeCand()) 
-      {
-        return;
-      }
-    }
-  } 
-#endif // H_3D_IV_MERGE 
-
-#if H_3D_VSP
-  /////////////////////////////////////////////////
-  //////// VIEW SYNTHESIS PREDICTION (VSP) ////////
-  /////////////////////////////////////////////////
-
-  if (
-#if LGE_SHARP_VSP_INHERIT_F0104
-#if H_3D_IC
-      !bICFlag &&
-#endif
-#if H_3D_ARP
-      !bARPFlag &&
-#endif
-#endif
-      xAddVspCand( mrgCandIdx, &cDisInfo, iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag ) )
-  {
-    return;
-  }
-
-  // early termination
-  if (iCount == getSlice()->getMaxNumMergeCand())
-  {
-    return;
-  }
-#endif
-#if H_3D
-  ///////////////////////////////////
-  //////// LEFT BOTTOM (A0) ////////
-  ///////////////////////////////////
-#endif
 
   //left bottom
@@ -6114,26 +4964,5 @@
       pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     }
-#if H_3D_NBDV
-    pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
-    pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
-#endif
-#if H_3D_VSP
-    if (pcCULeftBottom->getVSPFlag(uiLeftBottomPartIdx) == 1
-#if LGE_SHARP_VSP_INHERIT_F0104
-#if H_3D_IC
-        && !bICFlag
-#endif
-#if H_3D_ARP
-        && !bARPFlag
-#endif
-#endif
-        )
-    {
-      vspFlag[iCount] = 1;
-#if !MTK_VSP_SIMPLIFICATION_F0111
-      xInheritVSPDisInfo(pcCULeftBottom,uiLeftBottomPartIdx,iCount,inheritedVSPDisInfo);
-#endif
-    }
-#endif
+
     if ( mrgCandIdx == iCount )
     {
@@ -6147,9 +4976,4 @@
     return;
   }
-#if H_3D
-  ///////////////////////////////////
-  //////// LEFT ABOVE (B2) ////////
-  ///////////////////////////////////
-#endif
 
   // above left 
@@ -6174,39 +4998,4 @@
         pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
       }
-#if H_3D_NBDV
-      pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
-      pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
-#endif
-#if H_3D_VSP
-#if MTK_VSP_SIMPLIFICATION_F0111
-      if ( ( ( getAddr() - pcCUAboveLeft->getAddr() ) == 0) && (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1) 
-#if LGE_SHARP_VSP_INHERIT_F0104
-#if H_3D_IC
-          && !bICFlag
-#endif
-#if H_3D_ARP
-          && !bARPFlag
-#endif
-#endif
-          )
-#else
-      if (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1
-#if LGE_SHARP_VSP_INHERIT_F0104
-#if H_3D_IC
-          && !bICFlag
-#endif
-#if H_3D_ARP
-          && !bARPFlag
-#endif
-#endif
-          )
-#endif
-      {
-        vspFlag[iCount] = 1;
-#if !MTK_VSP_SIMPLIFICATION_F0111
-        xInheritVSPDisInfo(pcCUAboveLeft,uiAboveLeftPartIdx,iCount,inheritedVSPDisInfo);
-#endif
-      }
-#endif
       if ( mrgCandIdx == iCount )
       {
@@ -6221,27 +5010,5 @@
     return;
   }
-#if H_3D_IV_MERGE
-  ////////////////////////////////////////////////////
-  //////// SHIFTED IV (IvMCShift + IvDCShift) ////////
-  ////////////////////////////////////////////////////
-
-  if(  ivMvPredFlag  ) 
-  {
-    if(xAddIvMRGCand( mrgCandIdx,  iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, ivCandDir, ivCandMv, ivCandRefIdx, posIvDC, vspFlag))
-    {
-      return;
-    }
-    //early termination
-    if (iCount == getSlice()->getMaxNumMergeCand()) 
-    {
-      return;
-    }
-  }
-#endif
-#if H_3D
-  /////////////////////////////////
-  //////// Collocate (COL) ////////
-  /////////////////////////////////
-#endif
+
   if ( getSlice()->getEnableTMVPFlag())
   {
@@ -6308,7 +5075,4 @@
     if ( getSlice()->isInterB() )
     {
-#if H_3D_TMVP
-      iRefIdx = 0;
-#endif
       bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_1, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx);
       if( bExistMV == false )
@@ -6327,8 +5091,4 @@
       puhInterDirNeighbours[uiArrayAddr] = dir;
       abCandIsInter[uiArrayAddr] = true;
-#if H_3D_NBDV
-      pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
-      pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
-#endif
       if ( mrgCandIdx == iCount )
       {
@@ -6348,31 +5108,11 @@
   if ( getSlice()->isInterB())
   {
-#if H_3D_IV_MERGE
-    UInt uiPriorityList0[20] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3,    0, 4, 1, 4, 2, 4, 3, 4 };
-    UInt uiPriorityList1[20] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2,    4, 0, 4, 1, 4, 2, 4, 3 };
-#else
     UInt uiPriorityList0[12] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3};
     UInt uiPriorityList1[12] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2};
-#endif
 
     for (Int idx=0; idx<uiCutoff*(uiCutoff-1) && uiArrayAddr!= getSlice()->getMaxNumMergeCand(); idx++)
     {
       Int i = uiPriorityList0[idx]; Int j = uiPriorityList1[idx];
-#if H_3D_VSP
-      Bool bValid = true;
-      if ( vspFlag[i] == 1 || vspFlag[j] == 1 )
-      {
-        bValid = false;
-      }
-      if( !m_pcSlice->getVPS()->getViewSynthesisPredFlag( m_pcSlice->getLayerIdInVps() ) )
-      {
-        assert(bValid == true);
-      }
-#endif
-#if H_3D_VSP
-      if (abCandIsInter[i] && abCandIsInter[j] && (puhInterDirNeighbours[i]&0x1) && (puhInterDirNeighbours[j]&0x2) && bValid)
-#else
       if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2))
-#endif
       {
         abCandIsInter[uiArrayAddr] = true;
@@ -6429,6 +5169,4 @@
   numValidMergeCand = uiArrayAddr;
 }
-
-
 #endif
 
@@ -6770,5 +5508,5 @@
 }
 
-#if LGE_IC_CTX_F0160
+#if H_3D_IC
 Bool TComDataCU::isIC( UInt uiPartIdx )
 {
@@ -7623,5 +6361,5 @@
 }
 #endif
-#if QC_DEPTH_IV_MRG_F0125
+#if H_3D_IV_MERGE
 Bool TComDataCU::getDispNeighBlocks (UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDisp)
 {
@@ -8203,5 +6941,5 @@
 #endif
 
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
 Void TComDataCU::getSPPara(Int iPUWidth, Int iPUHeight, Int& iNumSP, Int& iNumSPInOneLine, Int& iSPWidth, Int& iSPHeight)
 {
@@ -8255,9 +6993,6 @@
 #if H_3D_IV_MERGE
 Bool
-TComDataCU::getInterViewMergeCands(UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc 
-#if QC_DEPTH_IV_MRG_F0125
-, Bool bIsDepth           
-#endif
-#if MTK_SPIVMP_F0110
+TComDataCU::getInterViewMergeCands(UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc , Bool bIsDepth           
+#if H_3D_SPIVMP
 , TComMvField* pcMvFieldSP, UChar* puhInterDirSP
 #endif
@@ -8268,9 +7003,5 @@
   
   //--- get base CU/PU and check prediction mode ---
-#if QC_DEPTH_IV_MRG_F0125
   TComPic*    pcBasePic   = pcSlice->getIvPic( bIsDepth, iViewIndex );
-#else
-  TComPic*    pcBasePic   = pcSlice->getIvPic( false, iViewIndex );
-#endif
   TComPicYuv* pcBaseRec   = pcBasePic->getPicYuvRec   ();
 
@@ -8283,12 +7014,7 @@
   pcBaseRec->getTopLeftSamplePos( getAddr(), getZorderIdxInCU() + uiPartAddr, iCurrPosX, iCurrPosY );
 
-#if !MTK_SPIVMP_F0110
-#if QC_DEPTH_IV_MRG_F0125
+#if !H_3D_SPIVMP
   iCurrPosX  += ( iWidth  >> 1 );
   iCurrPosY  += ( iHeight >> 1 );
-#else
-  iCurrPosX  += ( ( iWidth  - 1 ) >> 1 );
-  iCurrPosY  += ( ( iHeight - 1 ) >> 1 );
-#endif
 #endif
 
@@ -8308,5 +7034,5 @@
 #endif
 
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
   ////////////////////////////////
   //////////sub-PU IvMC///////////
@@ -8438,5 +7164,5 @@
   ////////////////////////////////
 
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
   for(Int iLoopCan = 1; iLoopCan < 2; iLoopCan ++) 
 #else
@@ -8447,5 +7173,5 @@
     // iLoopCan == 1 --> IvMCShift 
 
-#if !MTK_SPIVMP_F0110
+#if !H_3D_SPIVMP
     Int         iBaseCUAddr;
     Int         iBaseAbsPartIdx;
@@ -8455,5 +7181,5 @@
     Int offsetH = (iLoopCan == 0) ? 0 : ( ((iHeight/2)*4) + 4 );
 
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
     iBasePosX   = Clip3( 0, pcBaseRec->getWidth () - 1, iCurrPosX + ( (cDv.getHor() + offsetW + 2 ) >> 2 ) );
     iBasePosY   = Clip3( 0, pcBaseRec->getHeight() - 1, iCurrPosY + ( (cDv.getVer() + offsetH + 2 ) >> 2 ) ); 
@@ -8464,5 +7190,5 @@
     pcBaseRec->getCUAddrAndPartIdx( iBasePosX , iBasePosY , iBaseCUAddr, iBaseAbsPartIdx );
 
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
     pcBaseCU    = pcBasePic->getCU( iBaseCUAddr );
 #else
@@ -8496,5 +7222,5 @@
                   TComMv cMv(cBaseMvField.getHor(), cBaseMvField.getVer());
 #if H_3D_NBDV 
-#if QC_DEPTH_IV_MRG_F0125
+#if H_3D_IV_MERGE
                   if( !bIsDepth )
                   {
@@ -8504,5 +7230,5 @@
                     cMv.setIDVVer    (cDv.getVer());  
                     cMv.setIDVVId    (iViewIndex); 
-#if QC_DEPTH_IV_MRG_F0125
+#if H_3D_IV_MERGE
                   }
 #endif
@@ -8521,5 +7247,5 @@
     }
   }
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
   for(Int iLoopCan = 1; iLoopCan < 2; iLoopCan ++)
 #else
@@ -8552,5 +7278,5 @@
 #endif
           cMv.setHor( cMv.getHor() + ioffsetDV );
-#if QC_DEPTH_IV_MRG_F0125
+#if H_3D_IV_MERGE 
           if( bIsDepth )
             cMv.setHor((cMv.getHor()+2)>>2); 
@@ -8639,632 +7365,4 @@
   for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) { m_dmmWedgeTabIdx[dmmType][uiAbsPartIdx+ui] = tabIdx; }
 }
-#if !SEC_DMM3_RBC_F0147
-Void  TComDataCU::setDmm3IntraTabIdxSubParts( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth )
-{
-  UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1);
-  for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) { m_dmm3IntraTabIdx[uiAbsPartIdx+ui] = uiTIdx; }
-}
-#endif
-#endif
-#if H_3D_DIM_RBC
-Void TComDataCU::reconPartition( UInt uiAbsPartIdx, UInt uiDepth, Bool bLeft, UChar ucStartPos, UChar ucNumEdge, UChar* pucEdgeCode, Bool* pbRegion )
-{
-  Int iWidth;
-  Int iHeight;
-  if( uiDepth == 0 )
-  {
-    iWidth = 64;
-    iHeight = 64;
-  }
-  else if( uiDepth == 1 )
-  {
-    iWidth = 32;
-    iHeight = 32;
-  }
-  else if( uiDepth == 2 )
-  {
-    iWidth = 16;
-    iHeight = 16;
-  }
-  else if( uiDepth == 3 )
-  {
-    iWidth = 8;
-    iHeight = 8;
-  }
-  else // uiDepth == 4
-  {
-    iWidth = 4;
-    iHeight = 4;
-  }
-
-  Int iPtr = 0;
-  Int iX, iY;
-  Int iDir = -1;
-  Int iDiffX = 0, iDiffY = 0;
-
-  // 1. Edge Code -> Vert & Horz Edges
-  Bool*  pbEdge = (Bool*) xMalloc( Bool, 4 * iWidth * iHeight );
-
-  for( UInt ui = 0; ui < 4 * iWidth * iHeight; ui++ )
-    pbEdge  [ ui ] = false;
-
-  // Direction : left(0), right(1), top(2), bottom(3), left-top(4), right-top(5), left-bottom(6), right-bottom(7)
-  // Code      : 0deg(0), 45deg(1), -45deg(2), 90deg(3), -90deg(4), 135deg(5), -135deg(6)
-  const UChar tableDir[8][7] = { { 0, 6, 4, 3, 2, 7, 5 },
-  { 1, 5, 7, 2, 3, 4, 6 },
-  { 2, 4, 5, 0, 1, 6, 7 },
-  { 3, 7, 6, 1, 0, 5, 4 },
-  { 4, 0, 2, 6, 5, 3, 1 },
-  { 5, 2, 1, 4, 7, 0, 3 },
-  { 6, 3, 0, 7, 4, 1, 2 },
-  { 7, 1, 3, 5, 6, 2, 0 }};
-
-  UChar ucCode = pucEdgeCode[iPtr++];
-
-  if( !bLeft )
-  {
-    iX = ucStartPos;
-    iY = 0;
-
-    switch(ucCode)
-    {
-    case 0: // bottom
-      iDir = 3;
-      if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
-      break;
-    case 2: // left-bottom
-      iDir = 6;
-      if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
-      break;
-    case 1: // right-bottom
-      iDir = 7;
-      if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
-      if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
-      break;
-    case 4: // left
-      iDir = 0;
-      assert(false);
-      break;
-    case 3: // right
-      iDir = 1;
-      if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
-      if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
-      break;
-    }
-  }
-  else
-  {
-    iX = 0;
-    iY = ucStartPos;
-
-    switch(ucCode)
-    {
-    case 0: // right
-      iDir = 1;
-      if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
-      break;
-    case 1: // right-top
-      iDir = 5;
-      if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
-      if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
-      break;
-    case 2: // right-bottom
-      iDir = 7;
-      if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
-      break;
-    case 3: // top
-      iDir = 2;
-      if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
-      if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
-      break;
-    case 4: // bottom
-      iDir = 3;
-      assert(false);
-      break;
-    }
-  }
-
-  switch( iDir )
-  {
-  case 0: // left
-    iDiffX = -1;
-    iDiffY = 0;
-    break;
-  case 1: // right
-    iDiffX = +1;
-    iDiffY = 0;
-    break;
-  case 2: // top
-    iDiffX = 0;
-    iDiffY = -1;
-    break;
-  case 3: // bottom
-    iDiffX = 0;
-    iDiffY = +1;
-    break;
-  case 4: // left-top
-    iDiffX = -1;
-    iDiffY = -1;
-    break;
-  case 5: // right-top
-    iDiffX = +1;
-    iDiffY = -1;
-    break;
-  case 6: // left-bottom
-    iDiffX = -1;
-    iDiffY = +1;
-    break;
-  case 7: // right-bottom
-    iDiffX = +1;
-    iDiffY = +1;
-    break;
-  }
-
-  iX += iDiffX;
-  iY += iDiffY;
-
-  while( iPtr < ucNumEdge )
-  {
-    ucCode = pucEdgeCode[iPtr++];
-
-    Int iNewDir = tableDir[iDir][ucCode];
-
-    switch( iNewDir )
-    {
-    case 0: // left
-      iDiffX = -1;
-      iDiffY = 0;
-      break;
-    case 1: // right
-      iDiffX = +1;
-      iDiffY = 0;
-      break;
-    case 2: // top
-      iDiffX = 0;
-      iDiffY = -1;
-      break;
-    case 3: // bottom
-      iDiffX = 0;
-      iDiffY = +1;
-      break;
-    case 4: // left-top
-      iDiffX = -1;
-      iDiffY = -1;
-      break;
-    case 5: // right-top
-      iDiffX = +1;
-      iDiffY = -1;
-      break;
-    case 6: // left-bottom
-      iDiffX = -1;
-      iDiffY = +1;
-      break;
-    case 7: // right-bottom
-      iDiffX = +1;
-      iDiffY = +1;
-      break;
-    }
-
-    switch( iDir )
-    {
-    case 0: // left
-      switch( ucCode )
-      {
-      case 0:
-      case 2:
-        if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
-        break;
-      case 1:
-      case 3:
-        if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
-        if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
-        break;
-      case 4:
-      case 6:
-        // no
-        break;
-      case 5:
-        if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
-        if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
-        if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
-        break;
-      }
-      break;
-    case 1: // right
-      switch( ucCode )
-      {
-      case 0:
-      case 2:
-        if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
-        break;
-      case 1:
-      case 3:
-        if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
-        if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
-        break;
-      case 4:
-      case 6:
-        // no
-        break;
-      case 5:
-        if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
-        if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
-        if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
-        break;
-      }
-      break;
-    case 2: // top
-      switch( ucCode )
-      {
-      case 0:
-      case 2:
-        if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
-        break;
-      case 1:
-      case 3:
-        if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
-        if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
-        break;
-      case 4:
-      case 6:
-        // no
-        break;
-      case 5:
-        if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
-        if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
-        if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
-        break;
-      }
-      break;
-    case 3: // bottom
-      switch( ucCode )
-      {
-      case 0:
-      case 2:
-        if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
-        break;
-      case 1:
-      case 3:
-        if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
-        if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
-        break;
-      case 4:
-      case 6:
-        // no
-        break;
-      case 5:
-        if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
-        if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
-        if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
-        break;
-      }
-      break;
-    case 4: // left-top
-      switch( ucCode )
-      {
-      case 0:
-      case 1:
-        if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
-        if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
-        break;
-      case 2:
-      case 4:
-        if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
-        break;
-      case 3:
-      case 5:
-        if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
-        if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
-        if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
-        break;
-      case 6:
-        // no
-        break;
-      }
-      break;
-    case 5: // right-top
-      switch( ucCode )
-      {
-      case 0:
-      case 1:
-        if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
-        if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
-        break;
-      case 2:
-      case 4:
-        if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
-        break;
-      case 3:
-      case 5:
-        if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
-        if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
-        if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
-        break;
-      case 6:
-        // no
-        break;
-      }
-      break;
-    case 6: // left-bottom
-      switch( ucCode )
-      {
-      case 0:
-      case 1:
-        if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
-        if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
-        break;
-      case 2:
-      case 4:
-        if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
-        break;
-      case 3:
-      case 5:
-        if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
-        if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
-        if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
-        break;
-      case 6:
-        // no
-        break;
-      }
-      break;
-    case 7: // right-bottom
-      switch( ucCode )
-      {
-      case 0:
-      case 1:
-        if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
-        if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
-        break;
-      case 2:
-      case 4:
-        if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
-        break;
-      case 3:
-      case 5:
-        if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
-        if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
-        if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
-        break;
-      case 6:
-        // no
-        break;
-      }
-      break;
-    }
-
-    assert( iX >= 0 && iX <= iWidth );
-    assert( iY >= 0 && iY <= iHeight );
-
-    iX += iDiffX;
-    iY += iDiffY;
-    iDir = iNewDir;
-  }
-
-  // finalize edge chain
-  if( iX == iWidth-1 )
-  {
-    if( iY == 0 )
-    {
-      if( iDir == 1 )
-      {
-        pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true;
-      }
-      else if( iDir == 5 )
-      {
-        pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true;
-      }
-      else
-      {
-        assert(false);
-      }
-    }
-    else if( iY == iHeight-1 )
-    {
-      if( iDir == 3 )
-      {
-        pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true;
-      }
-      else if( iDir == 7 )
-      {
-        pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true;
-      }
-      else
-      {
-        assert(false);
-      }
-    }
-    else
-    {
-      if( iDir == 1 )
-      {
-        pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true;
-      }
-      else if( iDir == 3 )
-      {
-        pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true;
-        pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true;
-      }
-      else if( iDir == 5 )
-      {
-        pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true;
-      }
-      else if( iDir == 7 )
-      {
-        pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true;
-        pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true;
-      }
-      else
-      {
-        assert(false);
-      }
-    }
-  }
-  else if( iX == 0 )
-  {
-    if( iY == 0 )
-    {
-      if( iDir == 2 )
-      {
-        pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true;
-      }
-      else if( iDir == 4 )
-      {
-        pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true;
-      }
-      else
-      {
-        assert(false);
-      }
-    }
-    else if( iY == iHeight-1 )
-    {
-      if( iDir == 0 )
-      {
-        pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true;
-      }
-      else if( iDir == 6 )
-      {
-        pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true;
-      }
-      else
-      {
-        assert(false);
-      }
-    }
-    else
-    {
-      if( iDir == 0 )
-      {
-        pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true;
-      }
-      else if( iDir == 2 )
-      {
-        pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true;
-        pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true;
-      }
-      else if( iDir == 4 )
-      {
-        pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true;
-        pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true;
-      }
-      else if( iDir == 6 )
-      {
-        pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true;
-      }
-      else
-      {
-        assert(false);
-      }
-    }
-  }
-  else if( iY == 0 )
-  {
-    if( iDir == 1 )
-    {
-      pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true;
-      pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true;
-    }
-    else if( iDir == 2 )
-    {
-      pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true;
-    }
-    else if( iDir == 4 )
-    {
-      pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true;
-    }
-    else if( iDir == 5 )
-    {
-      pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true;
-      pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true;
-    }
-    else
-    {
-      assert(false);
-    }
-  }
-  else if( iY == iHeight-1 )
-  {
-    if( iDir == 0 )
-    {
-      pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true;
-      pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true;
-    }
-    else if( iDir == 3 )
-    {
-      pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true;
-    }
-    else if( iDir == 6 )
-    {
-      pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true;
-      pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true;
-    }
-    else if( iDir == 7 )
-    {
-      pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true;
-    }
-    else
-    {
-      assert(false);
-    }
-  }
-  else
-  {
-    printf("reconPartiton: wrong termination\n");
-    assert(false);
-  }
-
-  // Reconstruct Region from Chain Code
-  Bool* pbVisit  = (Bool*) xMalloc( Bool, iWidth * iHeight );
-  Int*  piStack  = (Int* ) xMalloc( Int,  iWidth * iHeight );
-
-  for( UInt ui = 0; ui < iWidth * iHeight; ui++ )
-  {
-    pbRegion[ ui ] = true; // fill it as region 1 (we'll discover region 0 next)
-    pbVisit [ ui ] = false;
-  }
-
-  iPtr = 0;
-  piStack[iPtr++] = (0 << 8) | (0);
-  pbRegion[ 0 ] = false;
-
-  while(iPtr > 0)
-  {
-    Int iTmp = piStack[--iPtr];
-    Int iX1, iY1;
-    iX1 = iTmp & 0xff;
-    iY1 = (iTmp >> 8) & 0xff;
-
-    pbVisit[ iX1 + iY1 * iWidth ] = true;
-
-    assert( iX1 >= 0 && iX1 < iWidth );
-    assert( iY1 >= 0 && iY1 < iHeight );
-
-    if( iX1 > 0 && !pbEdge[ 2 * iX1 - 1 + 4 * iY1 * iWidth ] && !pbVisit[ iX1 - 1 + iY1 * iWidth ] )
-    {
-      piStack[iPtr++] = (iY1 << 8) | (iX1 - 1);
-      pbRegion[ iX1 - 1 + iY1 * iWidth ] = false;
-    }
-    if( iX1 < iWidth - 1 && !pbEdge[ 2 * iX1 + 1 + 4 * iY1 * iWidth ] && !pbVisit[ iX1 + 1 + iY1 * iWidth ] )
-    {
-      piStack[iPtr++] = (iY1 << 8) | (iX1 + 1);
-      pbRegion[ iX1 + 1 + iY1 * iWidth ] = false;
-    }
-    if( iY1 > 0 && !pbEdge[ 2 * iX1 + 2 * (2 * iY1 - 1) * iWidth ] && !pbVisit[ iX1 + (iY1 - 1) * iWidth ] )
-    {
-      piStack[iPtr++] = ((iY1 - 1) << 8) | iX1;
-      pbRegion[ iX1 + (iY1 - 1) * iWidth ] = false;
-    }
-    if( iY1 < iHeight - 1 && !pbEdge[ 2 * iX1 + 2 * (2 * iY1 + 1) * iWidth ] && !pbVisit[ iX1 + (iY1 + 1) * iWidth ] )
-    {
-      piStack[iPtr++] = ((iY1 + 1) << 8) | iX1;
-      pbRegion[ iX1 + (iY1 + 1) * iWidth ] = false;
-    }
-  }
-
-  xFree( pbEdge );
-  xFree( pbVisit );
-  xFree( piStack );
-}
 #endif
 
Index: trunk/source/Lib/TLibCommon/TComDataCU.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComDataCU.h	(revision 759)
+++ trunk/source/Lib/TLibCommon/TComDataCU.h	(revision 773)
@@ -198,5 +198,5 @@
                                       ///< 0: non-VSP; 1: VSP
 #endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
   Bool*         m_pbSPIVMPFlag;       ///< array of sub-PU IVMP flags to indicate whehter a block uses sub-PU IVMP
                                       ///< 0: non-SPIVMP; 1: SPIVMP
@@ -212,14 +212,4 @@
 #if H_3D_DIM_DMM
   UInt*         m_dmmWedgeTabIdx[DMM_NUM_TYPE]; 
-#if !SEC_DMM3_RBC_F0147
-  UInt*         m_dmm3IntraTabIdx;
-#endif
-#endif
-#if H_3D_DIM_RBC
-  UChar*        m_pucEdgeCode;          ///< array of edge code
-  UChar*        m_pucEdgeNumber;        ///< total number of edge
-  UChar*        m_pucEdgeStartPos;      ///< starting point position
-  Bool*         m_pbEdgeLeftFirst;      ///< true if edge should be checked in left boundary first
-  Bool*         m_pbEdgePartition;      ///< true if it belongs to region 1, otherwise, region 0
 #endif
 #if H_3D_DIM_SDC
@@ -233,5 +223,5 @@
   UChar*        m_pucInterSDCMask;
 #endif
-#if ETRIKHU_MERGE_REUSE_F0093
+#if H_3D
   Bool          m_bAvailableFlagA1;    ///< A1 available flag
   Bool          m_bAvailableFlagB1;    ///< B1 available flag
@@ -256,5 +246,5 @@
   UInt*         m_sliceSegmentStartCU; ///< Start CU address of current slice
   Char          m_codedQP;
-#if ETRIKHU_MERGE_REUSE_F0093
+#if H_3D
   DisInfo       m_cDefaultDisInfo;    ///< Default disparity information for initializing
 #endif
@@ -266,20 +256,10 @@
   Bool          xAddMVPCandOrder      ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );
 #if H_3D_VSP
-#if ETRIKHU_MERGE_REUSE_F0093
   Bool          xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount,
                              Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag, Int& iCount3DV, InheritedVSPDisInfo*  inheritedVSPDisInfo);
-#else
-  Bool          xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount,
-                             Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag );
-#endif
 #endif
 #if H_3D_IV_MERGE
-#if ETRIKHU_MERGE_REUSE_F0093
   Bool          xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int*   ivCandDir, TComMv* ivCandMv, 
                                Int* ivCandRefIdx, Int posIvDC, Int* vspFlag, Int &iCount3DV, InheritedVSPDisInfo*  inheritedVSPDisInfo   ); 
-#else
-  Bool          xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int*   ivCandDir, TComMv* ivCandMv, 
-                               Int* ivCandRefIdx, Int posIvDC, Int* vspFlag ); 
-#endif
   Bool          xGetPosFirstAvailDmvCand( Int iCount, TComMvField* pcMvFieldNeighbours, Int*  ivCandDir, Int posIvDC, Int* vspFlag, Int& iFirDispCand );
 #endif
@@ -519,8 +499,6 @@
    ); 
    
-#if ETRIKHU_MERGE_REUSE_F0093
+#if H_3D
   Void          rightShiftMergeCandList( TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* iVSPIndexTrue, InheritedVSPDisInfo*  inheritedVSPDisInfo, UInt start, UInt num, Int &iCount3DV);
-#endif
-#if QC_DEPTH_IV_MRG_F0125
   Bool          getDispNeighBlocks  ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* cDisp);
   Bool          getDispMvPredCan(UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDis, Int* iPdm );
@@ -535,5 +513,5 @@
   Void          getIVNStatus       ( UInt uiPartIdx,  DisInfo* pDInfo, Bool& bIVFMerge,  Int& iIVFMaxD);
 #endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
   Void          getSPPara(Int iPUWidth, Int iPUHeight, Int& iNumSP, Int& iNumSPInOneLine, Int& iSPWidth, Int& iSPHeight);
   Void          getSPAbsPartIdx(UInt uiBaseAbsPartIdx, Int iWidth, Int iHeight, Int iPartIdx, Int iNumPartLine, UInt& ruiPartAddr );
@@ -541,9 +519,7 @@
 #endif
 #if H_3D_IV_MERGE
-  Bool          getInterViewMergeCands          ( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc 
-#if QC_DEPTH_IV_MRG_F0125
-    , Bool bIsDepth           
-#endif
-#if MTK_SPIVMP_F0110
+  Bool          getInterViewMergeCands          ( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc, Bool bIsDepth           
+
+#if H_3D_SPIVMP
     , TComMvField* pcMFieldSP, UChar* puhInterDirSP
 #endif
@@ -584,29 +560,4 @@
   Void  setDmmWedgeTabIdxSubParts     ( UInt tabIdx, UInt dmmType, UInt uiAbsPartIdx, UInt uiDepth );
 
-#if !SEC_DMM3_RBC_F0147
-  UInt* getDmm3IntraTabIdx            ()                      { return m_dmm3IntraTabIdx;        }
-  UInt  getDmm3IntraTabIdx            ( UInt uiIdx )          { return m_dmm3IntraTabIdx[uiIdx]; }
-  Void  setDmm3IntraTabIdx            ( UInt uiIdx, UInt uh ) { m_dmm3IntraTabIdx[uiIdx] = uh;   }
-  Void  setDmm3IntraTabIdxSubParts    ( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth );
-#endif
-#endif
-#if H_3D_DIM_RBC
-  UChar* getEdgeCode( UInt uiIdx )                 { return &m_pucEdgeCode[uiIdx * RBC_MAX_EDGE_NUM_PER_4x4]; }
-
-  UChar* getEdgeNumber( )                          { return m_pucEdgeNumber;           }
-  UChar  getEdgeNumber( UInt uiIdx )               { return m_pucEdgeNumber[uiIdx];    }
-  Void   setEdgeNumber( UInt uiIdx, UChar val )    { m_pucEdgeNumber[uiIdx] = val;     }
-
-  UChar* getEdgeStartPos( )                        { return m_pucEdgeStartPos;         }
-  UChar  getEdgeStartPos( UInt uiIdx )             { return m_pucEdgeStartPos[uiIdx];  }
-  Void   setEdgeStartPos( UInt uiIdx, UChar val )  { m_pucEdgeStartPos[uiIdx] = val;   }
-
-  Bool*  getEdgeLeftFirst( )                       { return m_pbEdgeLeftFirst;         }
-  Bool   getEdgeLeftFirst( UInt uiIdx )            { return m_pbEdgeLeftFirst[uiIdx];  }
-  Void   setEdgeLeftFirst( UInt uiIdx, Bool val )  { m_pbEdgeLeftFirst[uiIdx] = val;   }
-
-  Bool*  getEdgePartition( UInt uiIdx )            { return &m_pbEdgePartition[uiIdx * 16]; }
-
-  Void   reconPartition( UInt uiAbsPartIdx, UInt uiDepth, Bool bLeft, UChar ucStartPos, UChar ucNumEdge, UChar* pucEdgeCode, Bool* pbRegion );
 #endif
 #if H_3D_DIM_SDC
@@ -704,5 +655,5 @@
   Bool          hasEqualMotion              ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx );
 
-#if ETRIKHU_MERGE_REUSE_F0093
+#if H_3D
   Bool          getAvailableFlagA1() { return m_bAvailableFlagA1;}
   Bool          getAvailableFlagB1() { return m_bAvailableFlagB1;}
@@ -720,5 +671,5 @@
                                             , InheritedVSPDisInfo*  inheritedVSPDisInfo
 #endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
                                             , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP
 #endif
@@ -729,5 +680,5 @@
   inline Void   xInheritVSPDisInfo(TComDataCU* pcCURef, UInt uiAbsPartIdx, Int iCount,  InheritedVSPDisInfo*  inheritedVSPDisInfo);
 
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
   Bool*         getSPIVMPFlag        ()                        { return m_pbSPIVMPFlag;          }
   Bool          getSPIVMPFlag        ( UInt uiIdx )            { return m_pbSPIVMPFlag[uiIdx];   }
@@ -753,5 +704,5 @@
   Bool          isBipredRestriction( UInt puIdx );
 
-#if LGE_IC_CTX_F0160
+#if H_3D_IC
   Bool          isIC      ( UInt uiPartIdx );
 #endif
Index: trunk/source/Lib/TLibCommon/TComMotionInfo.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComMotionInfo.cpp	(revision 759)
+++ trunk/source/Lib/TLibCommon/TComMotionInfo.cpp	(revision 773)
@@ -40,5 +40,5 @@
 #include "assert.h"
 #include <stdlib.h>
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
 #include "TComDataCU.h"
 #include "TComPic.h"
@@ -328,5 +328,5 @@
 }
 
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
 Void TComCUMvField::setMvFieldSP( TComDataCU* pcCU, UInt uiAbsPartIdx, TComMvField cMvField, Int iWidth, Int iHeight  )
 {
Index: trunk/source/Lib/TLibCommon/TComMotionInfo.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComMotionInfo.h	(revision 759)
+++ trunk/source/Lib/TLibCommon/TComMotionInfo.h	(revision 773)
@@ -50,5 +50,5 @@
 // ====================================================================================================================
 
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
 class TComDataCU;
 #endif
@@ -173,5 +173,5 @@
   Void    setAllRefIdx ( Int iRefIdx,                 PartSize eMbMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 );
   Void    setAllMvField( TComMvField const & mvField, PartSize eMbMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 );
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
   Void    setMvFieldSP ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComMvField cMvField, Int iWidth, Int iHeight  );
 #endif
Index: trunk/source/Lib/TLibCommon/TComPrediction.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComPrediction.cpp	(revision 759)
+++ trunk/source/Lib/TLibCommon/TComPrediction.cpp	(revision 773)
@@ -425,7 +425,4 @@
   Bool dimDeltaDC = isDimDeltaDC( uiIntraMode );    
   Bool isDmmMode  = (dimType <  DMM_NUM_TYPE);
-#if !SEC_DMM3_RBC_F0147
-  Bool isRbcMode  = (dimType == RBC_IDX);
-#endif
 
   Bool* biSegPattern  = NULL;
@@ -443,17 +440,4 @@
         dmmSegmentation = &(g_dmmWedgeLists[ g_aucConvertToBit[iWidth] ][ pcCU->getDmmWedgeTabIdx( dimType, uiAbsPartIdx ) ]);
       } break;
-#if !SEC_DMM3_RBC_F0147
-    case( DMM3_IDX ): 
-      {
-        UInt uiTabIdx = 0;
-        if( bFastEnc ) { uiTabIdx = pcCU->getDmmWedgeTabIdx( dimType, uiAbsPartIdx ); }
-        else
-        {
-          uiTabIdx = xPredWedgeFromTex( pcCU, uiAbsPartIdx, iWidth, iHeight, pcCU->getDmm3IntraTabIdx( uiAbsPartIdx ) );
-          pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dimType, uiAbsPartIdx, (pcCU->getDepth(0) + (pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1)) );
-        }
-        dmmSegmentation = &(g_dmmWedgeLists[ g_aucConvertToBit[iWidth] ][ uiTabIdx ]);
-      } break;
-#endif
     case( DMM4_IDX ): 
       {
@@ -468,21 +452,9 @@
   }
 #endif
-#if H_3D_DIM_RBC
-  if( isRbcMode )
-  {
-    biSegPattern  = pcCU->getEdgePartition( uiAbsPartIdx );
-    patternStride = iWidth;
-  }
-#endif
 
   // get predicted partition values
   assert( biSegPattern );
   Int* piMask = NULL;
-#if QC_DIM_DELTADC_UNIFY_F0132 || HHI_DIM_PREDSAMP_FIX_F0171
   piMask = pcCU->getPattern()->getAdiOrgBuf( iWidth, iHeight, m_piYuvExt ); // no filtering
-#else
-  if( isDmmMode ) piMask = pcCU->getPattern()->getAdiOrgBuf( iWidth, iHeight, m_piYuvExt ); // no filtering for DMM
-  else            piMask = pcCU->getPattern()->getPredictorPtr( 0, g_aucConvertToBit[ iWidth ] + 2, m_piYuvExt );
-#endif
   assert( piMask );
   Int maskStride = 2*iWidth + 1;  
@@ -499,31 +471,13 @@
     Pel deltaDC2 = pcCU->getDimDeltaDC( dimType, 1, uiAbsPartIdx );
 #if H_3D_DIM_DMM
-#if QC_DIM_DELTADC_UNIFY_F0132 && !SEC_DMM3_RBC_F0147
-    if( isDmmMode || isRbcMode)
-#else
     if( isDmmMode )
-#endif
     {
 #if H_3D_DIM_DLT
-#if DLT_DIFF_CODING_IN_PPS
       segDC1 = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC1 ) + deltaDC1 );
       segDC2 = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC2 ) + deltaDC2 );
 #else
-      segDC1 = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC1 ) + deltaDC1 );
-      segDC2 = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC2 ) + deltaDC2 );
-#endif
-#else
       segDC1 = ClipY( predDC1 + deltaDC1 );
       segDC2 = ClipY( predDC2 + deltaDC2 );
 #endif
-    }
-#endif
-#if H_3D_DIM_RBC && !QC_DIM_DELTADC_UNIFY_F0132
-    if( isRbcMode )
-    {
-      xDeltaDCQuantScaleUp( pcCU, deltaDC1 );
-      xDeltaDCQuantScaleUp( pcCU, deltaDC2 );
-      segDC1 = ClipY( predDC1 + deltaDC1 );
-      segDC2 = ClipY( predDC2 + deltaDC2 );
     }
 #endif
@@ -566,5 +520,5 @@
 }
 
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
 Void TComPrediction::xGetSubPUAddrAndMerge(TComDataCU* pcCU, UInt uiPartAddr, Int iSPWidth, Int iSPHeight, Int iNumSPInOneLine, Int iNumSP, UInt* uiMergedSPW, UInt* uiMergedSPH, UInt* uiSPAddr )
 {
@@ -677,5 +631,5 @@
       else
       {
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
         if ( pcCU->getSPIVMPFlag(uiPartAddr)!=0)  
         {
@@ -717,5 +671,5 @@
             xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred );
           }
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
         }
 #endif
@@ -763,5 +717,5 @@
       else
       {
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
        if (pcCU->getSPIVMPFlag(uiPartAddr)!=0)  
       {
@@ -802,5 +756,5 @@
           xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred );
         }
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
        }
 #endif
@@ -830,39 +784,39 @@
   pcCU->clipMv(cMv);
 #if H_3D_ARP
-#if QC_MTK_INTERVIEW_ARP_F0123_F0108
   if(pcCU->getARPW( uiPartAddr ) > 0  && pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPOC()== pcCU->getSlice()->getPOC())
   {
-      xPredInterUniARPviewRef( pcCU , uiPartAddr , iWidth , iHeight , eRefPicList , rpcYuvPred , bi );
+    xPredInterUniARPviewRef( pcCU , uiPartAddr , iWidth , iHeight , eRefPicList , rpcYuvPred , bi );
   }
   else
-#endif
-  if(  pcCU->getARPW( uiPartAddr ) > 0 
-    && pcCU->getPartitionSize(uiPartAddr)==SIZE_2Nx2N 
-    && pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPOC()!= pcCU->getSlice()->getPOC() 
-    )
-  {
-    xPredInterUniARP( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, rpcYuvPred, bi );
-  }
-  else
-  {
+  {
+    if(  pcCU->getARPW( uiPartAddr ) > 0 
+      && pcCU->getPartitionSize(uiPartAddr)==SIZE_2Nx2N 
+      && pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPOC()!= pcCU->getSlice()->getPOC() 
+      )
+    {
+      xPredInterUniARP( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, rpcYuvPred, bi );
+    }
+    else
+    {
 #endif
 #if H_3D_IC
-    Bool bICFlag = pcCU->getICFlag( uiPartAddr ) && ( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getViewIndex() != pcCU->getSlice()->getViewIndex() );
-    xPredInterLumaBlk  ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi
+      Bool bICFlag = pcCU->getICFlag( uiPartAddr ) && ( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getViewIndex() != pcCU->getSlice()->getViewIndex() );
+      xPredInterLumaBlk  ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi
 #if H_3D_ARP
-      , false
-#endif
-      , bICFlag );
-    bICFlag = bICFlag && (iWidth > 8);
-    xPredInterChromaBlk( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi
+        , false
+#endif
+        , bICFlag );
+      bICFlag = bICFlag && (iWidth > 8);
+      xPredInterChromaBlk( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi
 #if H_3D_ARP
-      , false
-#endif
-      , bICFlag );
+        , false
+#endif
+        , bICFlag );
 #else
-  xPredInterLumaBlk  ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi );
-  xPredInterChromaBlk( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi );
+      xPredInterLumaBlk  ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi );
+      xPredInterChromaBlk( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi );
 #endif
 #if H_3D_ARP
+    }
   }
 #endif
@@ -918,5 +872,4 @@
   pcBaseViewDepthPicYuv->extendPicBorder();
 
-#if MTK_F0109_LG_F0120_VSP_BLOCK
   Int vspSize=0;
   xGetVirtualDepth( pcCU, pcBaseViewDepthPicYuv, &cDv, uiPartAddr, iWidth, iHeight, &m_cYuvDepthOnVsp,vspSize );
@@ -924,10 +877,4 @@
   xPredInterLumaBlkFromDM   ( pcCU, pcBaseViewTxtPicYuv, &m_cYuvDepthOnVsp, pShiftLUT, &cDv, uiPartAddr, iWidth, iHeight, pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi, vspSize);
   xPredInterChromaBlkFromDM ( pcCU, pcBaseViewTxtPicYuv, &m_cYuvDepthOnVsp, pShiftLUT, &cDv, uiPartAddr, iWidth, iHeight, pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi, vspSize);
-#else
-  xGetVirtualDepth( pcCU, pcBaseViewDepthPicYuv, &cDv, uiPartAddr, iWidth, iHeight, &m_cYuvDepthOnVsp );
-  // sub-PU based compensation
-  xPredInterLumaBlkFromDM   ( pcCU, pcBaseViewTxtPicYuv, &m_cYuvDepthOnVsp, pShiftLUT, &cDv, uiPartAddr, iWidth, iHeight, pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi );
-  xPredInterChromaBlkFromDM ( pcCU, pcBaseViewTxtPicYuv, &m_cYuvDepthOnVsp, pShiftLUT, &cDv, uiPartAddr, iWidth, iHeight, pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi );
-#endif
 }
 #endif
@@ -959,10 +906,6 @@
   if( cDistparity.bDV ) 
   {
-#if SHARP_ARP_REF_CHECK_F0105
     Int arpRefIdx = pcCU->getSlice()->getFirstTRefIdx(eRefPicList);
     if( dW > 0 && pcCU->getSlice()->getRefPic( eRefPicList, arpRefIdx )->getPOC()!= pcCU->getSlice()->getPOC() )
-#else
-    if( dW > 0 && pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC()!= pcCU->getSlice()->getPOC() )
-#endif
     {
       bTobeScaled = true;
@@ -971,13 +914,7 @@
     pcPicYuvBaseCol =  pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getPOC(),                              cDistparity.m_aVIdxCan );
 
-#if SHARP_ARP_REF_CHECK_F0105
     pcPicYuvBaseRef =  pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getRefPic( eRefPicList, arpRefIdx )->getPOC(), cDistparity.m_aVIdxCan );
 
     if (!pcCU->getSlice()->getArpRefPicAvailable( eRefPicList, cDistparity.m_aVIdxCan))
-#else
-    pcPicYuvBaseRef =  pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC(), cDistparity.m_aVIdxCan );
-    
-    if( ( !pcPicYuvBaseCol || pcPicYuvBaseCol->getPOC() != pcCU->getSlice()->getPOC() ) || ( !pcPicYuvBaseRef || pcPicYuvBaseRef->getPOC() != pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC() ) )
-#endif
     {
       dW = 0;
@@ -986,9 +923,5 @@
     else
     {
-#if SHARP_ARP_REF_CHECK_F0105
       assert( pcPicYuvBaseCol->getPOC() == pcCU->getSlice()->getPOC() && pcPicYuvBaseRef->getPOC() == pcCU->getSlice()->getRefPic( eRefPicList, arpRefIdx )->getPOC() );
-#else
-      assert( pcPicYuvBaseCol->getPOC() == pcCU->getSlice()->getPOC() && pcPicYuvBaseRef->getPOC() == pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC() );
-#endif
     }
 
@@ -1039,5 +972,4 @@
   }
 }
-#if QC_MTK_INTERVIEW_ARP_F0123_F0108
 Void TComPrediction::xPredInterUniARPviewRef( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, TComMvField * pNewMvFiled )
 {
@@ -1061,10 +993,8 @@
 
   assert(dW > 0);
-#if SHARP_ARP_REF_CHECK_F0105
   if (!pcCU->getSlice()->getArpRefPicAvailable( eRefPicList, pcPicYuvBaseCol->getViewIndex()))
   {
     dW = 0;
   }
-#endif
   Int uiLCUAddr,uiAbsPartAddr;
   Int irefPUX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[uiPartAddr]] + iWidth/2  + ((cDMv.getHor() + 2)>>2);
@@ -1144,5 +1074,4 @@
   }
 }
-#endif
 
 #endif
@@ -1804,9 +1733,5 @@
 #if H_3D_VSP
 // not fully support iRatioTxtPerDepth* != 1
-#if MTK_F0109_LG_F0120_VSP_BLOCK
 Void TComPrediction::xGetVirtualDepth( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *mv, UInt partAddr, Int width, Int height, TComYuv *yuvDepth, Int &vspSize, Int ratioTxtPerDepthX, Int ratioTxtPerDepthY )
-#else
-Void TComPrediction::xGetVirtualDepth( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *mv, UInt partAddr, Int width, Int height, TComYuv *yuvDepth, Int ratioTxtPerDepthX, Int ratioTxtPerDepthY )
-#endif
 {
   Int nTxtPerDepthX = H_3D_VSP_BLOCKSIZE;
@@ -1836,232 +1761,4 @@
   Pel *depth = yuvDepth->getLumaAddr();
 
-#if !SHARP_VSP_BLOCK_IN_AMP_F0102
-  if( width<8 || height<8 )
-  { // no split
-    Int rightOffset = width - 1;
-    Int depStrideBlock = depStride * nTxtPerDepthY;
-    Pel *refDepthTop = refDepth;
-    Pel *refDepthBot = refDepthTop + (height-1)*refDepStride;
-
-    Pel maxDepth = refDepthTop[0] > refDepthBot[0] ? refDepthTop[0] : refDepthBot[0];
-    if( maxDepth < refDepthTop[rightOffset] ) { maxDepth = refDepthTop[rightOffset]; }
-    if( maxDepth < refDepthBot[rightOffset] ) { maxDepth = refDepthBot[rightOffset]; }
-
-    for( Int sY=0; sY<height; sY+=nTxtPerDepthY )
-    {
-      for( Int sX=0; sX<width; sX+=nTxtPerDepthX )
-      {
-        depth[sX] = maxDepth;
-      }
-      depth += depStrideBlock;
-    }
-#if MTK_F0109_LG_F0120_VSP_BLOCK
-  if(width==4)
-    vspSize=0;
-  else
-    vspSize=1;
-#endif
-  }
-  else
-  { // split to 4x8, or 8x4
-    Int blocksize    = 8;
-    Int subblocksize = 4;
-    Int depStrideBlock = depStride * blocksize;
-    Pel *depthTmp = NULL;
-    Int depStrideTmp = depStride * nTxtPerDepthY;
-    Int offset[4] = { 0, subblocksize-1, subblocksize, blocksize-1 };
-    Pel *refDepthTmp[4] = { NULL, NULL, NULL, NULL };
-    Pel repDepth4x8[2] = {0, 0};
-    Pel repDepth8x4[2] = {0, 0};
-#endif
-
-#if !MTK_F0109_LG_F0120_VSP_BLOCK
-#if SHARP_VSP_BLOCK_IN_AMP_F0102
-    Int blocksize    = 8;
-    Int subblocksize = 4;
-    Int depStrideBlock = depStride * blocksize;
-    Pel *depthTmp = NULL;
-    Int depStrideTmp = depStride * nTxtPerDepthY;
-    Int offset[4] = { 0, subblocksize-1, subblocksize, blocksize-1 };
-    Pel *refDepthTmp[4] = { NULL, NULL, NULL, NULL };
-#endif
-    Int refDepStrideBlock    = refDepStride * blocksize;
-    Int refDepStrideSubBlock = refDepStride * subblocksize;
-
-    refDepthTmp[0] = refDepth;
-    refDepthTmp[2] = refDepthTmp[0] + refDepStrideSubBlock;
-    refDepthTmp[1] = refDepthTmp[2] - refDepStride;
-    refDepthTmp[3] = refDepthTmp[1] + refDepStrideSubBlock;
-
-#if SHARP_VSP_BLOCK_IN_AMP_F0102
-    Int subBlockW, subBlockH;
-    Int blockW, blockH;
-    subBlockW = subBlockH = 8;
-    if (height % 8)
-    {
-      subBlockW = 8;
-      subBlockH = 4;
-      blockW = width;  // no further split
-      blockH = height; // no further split
-    }
-    else if (width % 8)
-    {
-      subBlockW = 4;
-      subBlockH = 8;
-      blockW = width;  // no further split
-      blockH = height; // no further split
-    }
-    else
-    {
-      blockW = blockH = 8;
-    }
-    for( Int y=0; y<height; y+=blockH )
-    {
-      for( Int x=0; x<width; x+=blockW )
-      {
-        if (blockW == 8 && blockH == 8)
-        {
-          Bool ULvsBR = false, URvsBL = false;
-          ULvsBR = refDepthTmp[0][x+offset[0]] < refDepthTmp[3][x+offset[3]];
-          URvsBL = refDepthTmp[0][x+offset[3]] < refDepthTmp[3][x+offset[0]];
-          if( ULvsBR ^ URvsBL )
-          { // 4x8
-            subBlockW = 4;
-            subBlockH = 8;
-          }
-          else
-          {
-            subBlockW = 8;
-            subBlockH = 4;
-          }
-        }
-        for( Int yy=0; yy<blockH; yy+=subBlockH )
-        {
-          for( Int xx=0; xx<blockW; xx+=subBlockW )
-          {
-            Pel  maxDepthVal = 0;
-            Int xP0, xP1, yP0, yP1;
-            xP0 = x+xx;
-            xP1 = x+xx+subBlockW-1;
-            yP0 = yy;
-            yP1 = yy+subBlockH-1;
-            maxDepthVal = std::max( maxDepthVal, refDepthTmp[0][xP0+yP0*refDepStride]);
-            maxDepthVal = std::max( maxDepthVal, refDepthTmp[0][xP1+yP0*refDepStride]);
-            maxDepthVal = std::max( maxDepthVal, refDepthTmp[0][xP0+yP1*refDepStride]);
-            maxDepthVal = std::max( maxDepthVal, refDepthTmp[0][xP1+yP1*refDepStride]);
-            depthTmp = &depth[x+xx+yy*depStride];
-            for( Int sY=0; sY<subBlockH; sY+=nTxtPerDepthY )
-            {
-              for( Int sX=0; sX<subBlockW; sX+=nTxtPerDepthX )
-              {
-                depthTmp[sX] = maxDepthVal;
-              }
-              depthTmp += depStrideTmp;
-            }
-          }
-        }
-      }
-      refDepthTmp[0] += refDepStrideBlock;
-      depth       += depStrideBlock;
-    }
-#else // SHARP_VSP_BLOCK_IN_AMP_F0102
-    for( Int y=0; y<height; y+=blocksize )
-    {
-      for( Int x=0; x<width; x+=blocksize )
-      {
-        Bool ULvsBR = false, URvsBL = false;
-
-        ULvsBR = refDepthTmp[0][x+offset[0]] < refDepthTmp[3][x+offset[3]];
-        URvsBL = refDepthTmp[0][x+offset[3]] < refDepthTmp[3][x+offset[0]];
-
-        if( ULvsBR ^ URvsBL )
-        { // 4x8
-          repDepth4x8[0] = refDepthTmp[0][x+offset[0]] > refDepthTmp[0][x+offset[1]] ? refDepthTmp[0][x+offset[0]] : refDepthTmp[0][x+offset[1]];
-          if( repDepth4x8[0] < refDepthTmp[3][x+offset[0]] )
-          {
-            repDepth4x8[0] = refDepthTmp[3][x+offset[0]];
-          }
-          if( repDepth4x8[0] < refDepthTmp[3][x+offset[1]] )
-          {
-            repDepth4x8[0] = refDepthTmp[3][x+offset[1]];
-          }
-          repDepth4x8[1] = refDepthTmp[0][x+offset[2]] > refDepthTmp[0][x+offset[3]] ? refDepthTmp[0][x+offset[2]] : refDepthTmp[0][x+offset[3]];
-          if( repDepth4x8[1] < refDepthTmp[3][x+offset[2]] )
-          {
-            repDepth4x8[1] = refDepthTmp[3][x+offset[2]];
-          }
-          if( repDepth4x8[1] < refDepthTmp[3][x+offset[3]] )
-          {
-            repDepth4x8[1] = refDepthTmp[3][x+offset[3]];
-          }
-
-          depthTmp = &depth[x];
-          for( Int sY=0; sY<blocksize; sY+=nTxtPerDepthY )
-          {
-            for( Int sX=0; sX<subblocksize; sX+=nTxtPerDepthX )
-            {
-              depthTmp[sX] = repDepth4x8[0];
-            }
-            depthTmp += depStrideTmp;
-          }
-          depthTmp = &depth[x+subblocksize];
-          for( Int sY=0; sY<blocksize; sY+=nTxtPerDepthY )
-          {
-            for( Int sX=0; sX<subblocksize; sX+=nTxtPerDepthX )
-            {
-              depthTmp[sX] = repDepth4x8[1];
-            }
-            depthTmp += depStrideTmp;
-          }
-        }
-        else
-        { // 8x4
-          repDepth8x4[0] = refDepthTmp[0][x+offset[0]] > refDepthTmp[0][x+offset[3]] ? refDepthTmp[0][x+offset[0]] : refDepthTmp[0][x+offset[3]];
-          if( repDepth8x4[0] < refDepthTmp[1][x+offset[0]] )
-          {
-            repDepth8x4[0] = refDepthTmp[1][x+offset[0]];
-          }
-          if( repDepth8x4[0] < refDepthTmp[1][x+offset[3]] )
-          {
-            repDepth8x4[0] = refDepthTmp[1][x+offset[3]];
-          }
-          repDepth8x4[1] = refDepthTmp[2][x+offset[0]] > refDepthTmp[2][x+offset[3]] ? refDepthTmp[2][x+offset[0]] : refDepthTmp[2][x+offset[3]];
-          if( repDepth8x4[1] < refDepthTmp[3][x+offset[0]] )
-          {
-            repDepth8x4[1] = refDepthTmp[3][x+offset[0]];
-          }
-          if( repDepth8x4[1] < refDepthTmp[3][x+offset[3]] )
-          {
-            repDepth8x4[1] = refDepthTmp[3][x+offset[3]];
-          }
-          
-          depthTmp = &depth[x];
-          for( Int sY=0; sY<subblocksize; sY+=nTxtPerDepthY )
-          {
-            for( Int sX=0; sX<blocksize; sX+=nTxtPerDepthX )
-            {
-              depthTmp[sX] = repDepth8x4[0];
-            }
-            depthTmp += depStrideTmp;
-          }
-          for( Int sY=0; sY<subblocksize; sY+=nTxtPerDepthY )
-          {
-            for( Int sX=0; sX<blocksize; sX+=nTxtPerDepthX )
-            {
-              depthTmp[sX] = repDepth8x4[1];
-            }
-            depthTmp += depStrideTmp;
-          }
-        }
-      }
-      refDepthTmp[0] += refDepStrideBlock;
-      refDepthTmp[1] += refDepStrideBlock;
-      refDepthTmp[2] += refDepStrideBlock;
-      refDepthTmp[3] += refDepStrideBlock;
-      depth       += depStrideBlock;
-    }
-#endif // SHARP_VSP_BLOCK_IN_AMP_F0102
-#else
-#if SHARP_VSP_BLOCK_IN_AMP_F0102
   if ((height % 8))
   {
@@ -2115,149 +1812,15 @@
       }
     }
-  }
-#else // SHARP_VSP_BLOCK_IN_AMP_F0102
-    Int refDepStrideBlock    = refDepStride * height;
-    Int refDepStrideSubBlock = refDepStride * height/2;
-    refDepthTmp[0] = refDepth;
-    refDepthTmp[2] = refDepthTmp[0] + refDepStrideSubBlock;
-    refDepthTmp[1] = refDepthTmp[2] - refDepStride;
-    refDepthTmp[3] = refDepthTmp[1] + refDepStrideSubBlock;
-    offset[3] = width-1;
-    Bool ULvsBR = false, URvsBL = false;
-    ULvsBR = refDepthTmp[0][0+offset[0]] < refDepthTmp[3][0+offset[3]];
-    URvsBL = refDepthTmp[0][0+offset[3]] < refDepthTmp[3][0+offset[0]];
-    refDepStrideBlock    = refDepStride * blocksize;
-    refDepStrideSubBlock = refDepStride * subblocksize;
-    refDepthTmp[0] = refDepth;
-    refDepthTmp[2] = refDepthTmp[0] + refDepStrideSubBlock;
-    refDepthTmp[1] = refDepthTmp[2] - refDepStride;
-    refDepthTmp[3] = refDepthTmp[1] + refDepStrideSubBlock;
-    offset[3] = blocksize-1;
-    if( ULvsBR ^ URvsBL )
-    {
-    vspSize = 0;//4x8
-    for( Int y=0; y<height; y+=blocksize )
-    {
-      for( Int x=0; x<width; x+=blocksize )
-      {
-        { // 4x8
-          repDepth4x8[0] = refDepthTmp[0][x+offset[0]] > refDepthTmp[0][x+offset[1]] ? refDepthTmp[0][x+offset[0]] : refDepthTmp[0][x+offset[1]];
-          if( repDepth4x8[0] < refDepthTmp[3][x+offset[0]] )
-          {
-            repDepth4x8[0] = refDepthTmp[3][x+offset[0]];
-          }
-          if( repDepth4x8[0] < refDepthTmp[3][x+offset[1]] )
-          {
-            repDepth4x8[0] = refDepthTmp[3][x+offset[1]];
-          }
-          repDepth4x8[1] = refDepthTmp[0][x+offset[2]] > refDepthTmp[0][x+offset[3]] ? refDepthTmp[0][x+offset[2]] : refDepthTmp[0][x+offset[3]];
-          if( repDepth4x8[1] < refDepthTmp[3][x+offset[2]] )
-          {
-            repDepth4x8[1] = refDepthTmp[3][x+offset[2]];
-          }
-          if( repDepth4x8[1] < refDepthTmp[3][x+offset[3]] )
-          {
-            repDepth4x8[1] = refDepthTmp[3][x+offset[3]];
-  }
-
-          depthTmp = &depth[x];
-          for( Int sY=0; sY<blocksize; sY+=nTxtPerDepthY )
-          {
-            for( Int sX=0; sX<subblocksize; sX+=nTxtPerDepthX )
-            {
-              depthTmp[sX] = repDepth4x8[0];
-            }
-            depthTmp += depStrideTmp;
-          }
-          depthTmp = &depth[x+subblocksize];
-          for( Int sY=0; sY<blocksize; sY+=nTxtPerDepthY )
-          {
-            for( Int sX=0; sX<subblocksize; sX+=nTxtPerDepthX )
-            {
-              depthTmp[sX] = repDepth4x8[1];
-            }
-            depthTmp += depStrideTmp;
-          }
-        }
-      }
-      refDepthTmp[0] += refDepStrideBlock;
-      refDepthTmp[1] += refDepStrideBlock;
-      refDepthTmp[2] += refDepStrideBlock;
-      refDepthTmp[3] += refDepStrideBlock;
-      depth       += depStrideBlock;
-    }
-  }
-  else
-  { // 8x4
-    vspSize = 1;
-    for( Int y=0; y<height; y+=blocksize )
-    {
-      for( Int x=0; x<width; x+=blocksize )
-      {
-        repDepth8x4[0] = refDepthTmp[0][x+offset[0]] > refDepthTmp[0][x+offset[3]] ? refDepthTmp[0][x+offset[0]] : refDepthTmp[0][x+offset[3]];
-        if( repDepth8x4[0] < refDepthTmp[1][x+offset[0]] )
-        {
-          repDepth8x4[0] = refDepthTmp[1][x+offset[0]];
-        }
-        if( repDepth8x4[0] < refDepthTmp[1][x+offset[3]] )
-        {
-          repDepth8x4[0] = refDepthTmp[1][x+offset[3]];
-        }
-        repDepth8x4[1] = refDepthTmp[2][x+offset[0]] > refDepthTmp[2][x+offset[3]] ? refDepthTmp[2][x+offset[0]] : refDepthTmp[2][x+offset[3]];
-        if( repDepth8x4[1] < refDepthTmp[3][x+offset[0]] )
-        {
-          repDepth8x4[1] = refDepthTmp[3][x+offset[0]];
-        }
-        if( repDepth8x4[1] < refDepthTmp[3][x+offset[3]] )
-        {
-          repDepth8x4[1] = refDepthTmp[3][x+offset[3]];
-        }
-
-        depthTmp = &depth[x];
-        for( Int sY=0; sY<subblocksize; sY+=nTxtPerDepthY )
-        {
-          for( Int sX=0; sX<blocksize; sX+=nTxtPerDepthX )
-          {
-            depthTmp[sX] = repDepth8x4[0];
-          }
-          depthTmp += depStrideTmp;
-        }
-        for( Int sY=0; sY<subblocksize; sY+=nTxtPerDepthY )
-        {
-          for( Int sX=0; sX<blocksize; sX+=nTxtPerDepthX )
-          {
-            depthTmp[sX] = repDepth8x4[1];
-          }
-          depthTmp += depStrideTmp;
-}
-      }
-      refDepthTmp[0] += refDepStrideBlock;
-      refDepthTmp[1] += refDepStrideBlock;
-      refDepthTmp[2] += refDepStrideBlock;
-      refDepthTmp[3] += refDepStrideBlock;
-      depth       += depStrideBlock;
-    }
-  }
-#endif    
-#endif
-#if !SHARP_VSP_BLOCK_IN_AMP_F0102
-  }
-#endif
-
-
-}
-#if MTK_F0109_LG_F0120_VSP_BLOCK
+  }    
+}
+
 Void TComPrediction::xPredInterLumaBlkFromDM( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&yuvDst, Bool isBi, Int vspSize)
-#else
-Void TComPrediction::xPredInterLumaBlkFromDM( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&yuvDst, Bool isBi )
-#endif
 {
   Int nTxtPerDepthX = H_3D_VSP_BLOCKSIZE;
   Int nTxtPerDepthY = H_3D_VSP_BLOCKSIZE;
   
-#if MTK_F0109_LG_F0120_VSP_BLOCK
   nTxtPerDepthX = nTxtPerDepthX << vspSize;
   nTxtPerDepthY = nTxtPerDepthY << (1-vspSize);
-#endif
+
   Int refStride = picRef->getStride();
   Int dstStride = yuvDst->getStride();
@@ -2365,9 +1928,5 @@
 }
 
-#if MTK_F0109_LG_F0120_VSP_BLOCK
 Void TComPrediction::xPredInterChromaBlkFromDM  ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&yuvDst, Bool isBi, Int vspSize)
-#else
-Void TComPrediction::xPredInterChromaBlkFromDM  ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&yuvDst, Bool isBi )
-#endif
 {
 #if (H_3D_VSP_BLOCKSIZE==1)
@@ -2379,8 +1938,7 @@
 #endif
 
-#if MTK_F0109_LG_F0120_VSP_BLOCK
   nTxtPerDepthX = nTxtPerDepthX << vspSize;
   nTxtPerDepthY = nTxtPerDepthY << (1-vspSize);
-#endif
+
   Int refStride = picRef->getCStride();
   Int dstStride = yuvDst->getCStride();
@@ -2564,17 +2122,4 @@
 
 #if H_3D_DIM_DMM
-#if !SEC_DMM3_RBC_F0147
-UInt TComPrediction::xPredWedgeFromTex( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt intraTabIdx )
-{
-  TComPic*      pcPicTex = pcCU->getSlice()->getTexturePic();
-  assert( pcPicTex != NULL );
-  TComDataCU*   pcColTexCU = pcPicTex->getCU(pcCU->getAddr());
-  UInt          uiTexPartIdx = pcCU->getZorderIdxInCU() + uiAbsPartIdx;
-  Int           uiColTexIntraDir = pcColTexCU->isIntra( uiTexPartIdx ) ? pcColTexCU->getLumaIntraDir( uiTexPartIdx ) : 255;
-
-  assert( uiColTexIntraDir > DC_IDX && uiColTexIntraDir < 35 );
-  return g_aauiWdgLstM3[g_aucConvertToBit[uiWidth]][uiColTexIntraDir-2].at(intraTabIdx);
-}
-#endif
 
 Void TComPrediction::xPredContourFromTex( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, TComWedgelet* pcContourWedge )
@@ -2628,31 +2173,5 @@
 #endif
 
-#if H_3D_DIM_RBC
-Void TComPrediction::xDeltaDCQuantScaleUp( TComDataCU* pcCU, Pel& rDeltaDC )
-{
-  Int  iSign  = rDeltaDC < 0 ? -1 : 1;
-  UInt uiAbs  = abs( rDeltaDC );
-
-  Int iQp = pcCU->getQP(0);
-  Double dMax = (Double)( 1<<( g_bitDepthY - 1 ) );
-  Double dStepSize = Clip3( 1.0, dMax, pow( 2.0, iQp/10.0 - 2.0 ) );
-
-  rDeltaDC = iSign * roftoi( uiAbs * dStepSize );
-  return;
-}
-
-Void TComPrediction::xDeltaDCQuantScaleDown( TComDataCU*  pcCU, Pel& rDeltaDC )
-{
-  Int  iSign  = rDeltaDC < 0 ? -1 : 1;
-  UInt uiAbs  = abs( rDeltaDC );
-
-  Int iQp = pcCU->getQP(0);
-  Double dMax = (Double)( 1<<( g_bitDepthY - 1 ) );
-  Double dStepSize = Clip3( 1.0, dMax, pow( 2.0, iQp/10.0 - 2.0 ) );
-
-  rDeltaDC = iSign * roftoi( uiAbs / dStepSize );
-  return;
-}
-#endif
+
 #if H_3D_DIM_SDC
 Void TComPrediction::analyzeSegmentsSDC( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride
Index: trunk/source/Lib/TLibCommon/TComPrediction.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComPrediction.h	(revision 759)
+++ trunk/source/Lib/TLibCommon/TComPrediction.h	(revision 773)
@@ -93,7 +93,5 @@
 #if H_3D_ARP
   Void xPredInterUniARP         ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false, TComMvField * pNewMvFiled = NULL );
-#if QC_MTK_INTERVIEW_ARP_F0123_F0108
   Void xPredInterUniARPviewRef( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, TComMvField * pNewMvFiled = NULL );
-#endif
 #endif
   Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false          );
@@ -123,13 +121,7 @@
 
 #if H_3D_VSP
-#if MTK_F0109_LG_F0120_VSP_BLOCK
   Void xGetVirtualDepth           ( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *dv, UInt partAddr, Int width, Int height, TComYuv *yuvDepth, Int &vspSize, Int txtPerDepthX=1, Int txtPerDepthY=1 );
   Void xPredInterLumaBlkFromDM    ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&pcYuvDst, Bool isBi, Int vspSize);
   Void xPredInterChromaBlkFromDM  ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&pcYuvDst, Bool isBi, Int vspSize);
-#else
-  Void xGetVirtualDepth           ( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *dv, UInt partAddr, Int width, Int height, TComYuv *yuvDepth, Int txtPerDepthX=1, Int txtPerDepthY=1 );
-  Void xPredInterLumaBlkFromDM    ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&pcYuvDst, Bool isBi );
-  Void xPredInterChromaBlkFromDM  ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&pcYuvDst, Bool isBi );
-#endif
 #endif
 
@@ -142,5 +134,5 @@
   Void xDCPredFiltering( Int* pSrc, Int iSrcStride, Pel*& rpDst, Int iDstStride, Int iWidth, Int iHeight );
   Bool xCheckIdenticalMotion    ( TComDataCU* pcCU, UInt PartAddr);
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
   Bool xCheckTwoSPMotion ( TComDataCU* pcCU, UInt PartAddr0, UInt PartAddr1 );
   Void xGetSubPUAddrAndMerge(TComDataCU* pcCU, UInt uiPartAddr, Int iSPWidth, Int iSPHeight, Int iNumSPInOneLine, Int iNumSP, UInt* uiMergedSPW, UInt* uiMergedSPH, UInt* uiSPAddr );
@@ -154,8 +146,4 @@
   Void xPredContourFromTex      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, TComWedgelet* pcContourWedge );
   Void xCopyTextureLumaBlock    ( TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piDestBlockY, UInt uiWidth, UInt uiHeight );
-#endif
-#if H_3D_DIM_RBC
-  Void xDeltaDCQuantScaleUp     ( TComDataCU* pcCU, Pel& rDeltaDC );
-  Void xDeltaDCQuantScaleDown   ( TComDataCU* pcCU, Pel& rDeltaDC );
 #endif
 #endif
Index: trunk/source/Lib/TLibCommon/TComRom.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComRom.cpp	(revision 759)
+++ trunk/source/Lib/TLibCommon/TComRom.cpp	(revision 773)
@@ -573,9 +573,5 @@
 #if H_MV_ENC_DEC_TRAC
 #if ENC_DEC_TRACE
-#if H_MV_FIX_TRACE_FILE
 Void writeToTraceFile( const Char* symbolName, Int val, Bool doIt )
-#else
-Void writeToTraceFile( Char* symbolName, Int val, Bool doIt )
-#endif
 {
   if ( ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) && doIt  ) 
@@ -592,9 +588,5 @@
 }
 
-#if H_MV_FIX_TRACE_FILE
 Void writeToTraceFile( const Char* symbolName, Bool doIt )
-#else
-Void writeToTraceFile( Char* symbolName, Bool doIt )
-#endif
 {
   if ( ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) && doIt  ) 
@@ -612,7 +604,4 @@
 std::vector< std::vector<TComWedgeRef>  > g_dmmWedgeRefLists;
 std::vector< std::vector<TComWedgeNode> > g_dmmWedgeNodeLists;
-#if !SEC_DMM3_RBC_F0147
-std::vector< std::vector< std::vector<UInt> > > g_aauiWdgLstM3;
-#endif
 
 Void initWedgeLists( Bool initNodeList )
@@ -733,22 +722,5 @@
   }
 
-#if !SEC_DMM3_RBC_F0147
-  UInt uiThrSz = DMM3_SIMPLIFY_TR;
-  std::vector< std::vector<UInt> > auiWdgListSz;
-  for( Int idxM=2; idxM<=34 ; idxM++)
-  {
-    std::vector<UInt> auiWdgList;
-    for( Int idxW=0; idxW<racWedgeList.size(); idxW++)
-    {
-      UInt uiAbsDiff = abs(idxM-(Int)racWedgeList[idxW].getAng());
-      if( uiAbsDiff <= uiThrSz )
-      {
-        auiWdgList.push_back(idxW);
-      }
-    }
-    auiWdgListSz.push_back(auiWdgList);
-  }
-  g_aauiWdgLstM3.push_back(auiWdgListSz);
-#endif
+
 }
 
Index: trunk/source/Lib/TLibCommon/TComRom.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComRom.h	(revision 759)
+++ trunk/source/Lib/TLibCommon/TComRom.h	(revision 773)
@@ -172,7 +172,4 @@
 extern       std::vector< std::vector<TComWedgeRef> >        g_dmmWedgeRefLists;
 extern       std::vector< std::vector<TComWedgeNode> >       g_dmmWedgeNodeLists;
-#if !SEC_DMM3_RBC_F0147
-extern       std::vector< std::vector< std::vector<UInt> > > g_aauiWdgLstM3;
-#endif
 
 Void initWedgeLists( Bool initNodeList = false );
@@ -236,11 +233,6 @@
 
 
-#if H_MV_FIX_TRACE_FILE
  Void           writeToTraceFile( const Char* symbolName, Int val, Bool doIt );
  Void           writeToTraceFile( const Char* symbolName, Bool doIt );
-#else
- Void           writeToTraceFile( Char* symbolName, Int val, Bool doIt );
- Void           writeToTraceFile( Char* symbolName, Bool doIt );
-#endif
 #endif
 #else
Index: trunk/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComSlice.cpp	(revision 759)
+++ trunk/source/Lib/TLibCommon/TComSlice.cpp	(revision 773)
@@ -110,5 +110,5 @@
 #endif
 , m_pocResetFlag                  (false)
-#if H_MV_6_RALS_O0149_11
+#if H_MV
 , m_crossLayerBlaFlag             (false)
 #endif
@@ -753,18 +753,7 @@
   {        
     if ( this->getNumRefIdx( RefPicList( uiRefListIdx ) ) == 0)
+    {
         continue;
-#if !SHARP_ARP_REF_CHECK_F0105
-// move the following to setARPStepNum() to define ARP related thing in ARP function.
-#if QC_MTK_INTERVIEW_ARP_F0123_F0108
-     for(Int i = 0; i < this->getNumRefIdx(RefPicList(uiRefListIdx)); i++ )
-       {
-       if ( this->getRefPic(RefPicList(uiRefListIdx), i)->getPOC() != getPOC() )
-       {
-         this->setFirstTRefIdx (RefPicList(uiRefListIdx), i);
-         break;
-       }
-     }
-#endif
-#endif
+    }
     Bool bZeroIdxLtFlag = this->getRefPic(RefPicList(uiRefListIdx), 0)->getIsLongTerm();
     for(Int i = 1; i < this->getNumRefIdx(RefPicList(uiRefListIdx)); i++ )
@@ -782,9 +771,5 @@
 Void TComSlice::setCamparaSlice( Int** aaiScale, Int** aaiOffset )
 {  
-#if CAM_HLS_F0136_F0045_F0082
   if( m_pcVPS->hasCamParInSliceHeader( m_viewIndex ) )
-#else
-  if( m_pcSPS->hasCamParInSliceHeader() )
-#endif
   {    
     for( UInt uiBaseViewIndex = 0; uiBaseViewIndex < m_viewIndex; uiBaseViewIndex++ )
@@ -1716,8 +1701,6 @@
 , m_hrdOpSetIdx               (NULL)
 , m_cprmsPresentFlag          (NULL)
-#if H_MV_6_HRD_O0217_13
+#if H_MV
 , m_dpbSize                   (NULL)
-#endif
-#if H_MV
 , m_vpsVUI                 (  NULL )
 #endif
@@ -1734,9 +1717,5 @@
     for( Int layerId = 0; layerId < MAX_VPS_NUH_LAYER_ID_PLUS1; layerId++ )
     {
-#if H_MV_6_HRD_O0217_13
       m_layerIdIncludedFlag[lsIdx][layerId] = (( lsIdx == 0 ) && ( layerId == 0 )) ; 
-#else
-      m_layerIdIncludedFlag[lsIdx][layerId] = false; 
-#endif
     }
   } 
@@ -1752,9 +1731,5 @@
   m_moreOutputLayerSetsThanDefaultFlag = false;   
   m_numAddOutputLayerSetsMinus1        = -1;   
-#if H_MV_6_PS_0109_25
   m_defaultOneTargetOutputLayerIdc     = 0; 
-#else
-  m_defaultOneTargetOutputLayerFlag    = false; 
-#endif
   
   for ( Int i = 0; i < MAX_VPS_OUTPUTLAYER_SETS; i++)
@@ -1767,7 +1742,5 @@
     }
   }
-#if H_MV_6_GEN_0153_28
   m_altOutputLayerFlag       = false; 
-#endif
   m_maxOneActiveRefLayerFlag = false; 
   m_directDepTypeLenMinus2   = 0;         
@@ -1806,11 +1779,6 @@
     m_layerIdInNuh      [i] = ( i == 0 ) ? 0 : -1; 
     m_numDirectRefLayers[i] = 0; 
-#if !H_MV_6_ILDDS_O0225_30
-    m_maxTidIlRefPicPlus1[i] = 7;
-#endif
     m_vpsRepFormatIdx    [i] = 0; 
-#if H_MV_6_MISC_O0062_31
     m_pocLsbNotPresentFlag[i] = 0;
-#endif
     m_repFormat          [i] = NULL; 
     m_viewIdVal          [i] = 0; 
@@ -1819,26 +1787,5 @@
     m_viewIndex         [i] = -1; 
     m_vpsDepthModesFlag [i] = false;
-#if H_3D_DIM_DLT
-#if !DLT_DIFF_CODING_IN_PPS
-    m_bUseDLTFlag         [i] = false;
-    
-    // allocate some memory and initialize with default mapping
-    m_iNumDepthmapValues[i] = ((1 << g_bitDepthY)-1)+1;
-    m_iBitsPerDepthValue[i] = numBitsForValue(m_iNumDepthmapValues[i]);
-    
-    m_iDepthValue2Idx[i]    = (Int*) xMalloc(Int, m_iNumDepthmapValues[i]);
-    m_iIdx2DepthValue[i]    = (Int*) xMalloc(Int, m_iNumDepthmapValues[i]);
-    
-    //default mapping
-    for (Int d=0; d<m_iNumDepthmapValues[i]; d++)
-    {
-      m_iDepthValue2Idx[i][d] = d;
-      m_iIdx2DepthValue[i][d] = d;
-    }
-#endif
-#endif
-#if H_3D
     m_ivMvScalingFlag = true; 
-#endif
 #endif
 
@@ -1848,7 +1795,5 @@
       m_directDependencyType[i][j] = -1; 
       m_refLayerId[i][j]           = -1; 
-#if H_MV_6_ILDDS_O0225_30      
       m_maxTidIlRefPicsPlus1[i][j]  = 7;
-#endif
     }
 
@@ -1863,8 +1808,6 @@
   }
   m_vpsVUI = new TComVPSVUI; 
-#if H_MV_6_HRD_O0217_13
   m_dpbSize = new TComDpbSize; 
-#endif
-#
+
 #if H_3D
   for( Int i = 0; i < MAX_NUM_LAYERS; i++ )
@@ -1872,5 +1815,5 @@
 #if H_3D_IV_MERGE
     m_ivMvPredFlag         [ i ] = false;
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
     m_iSubPULog2Size       [ i ] = 0;
 #endif
@@ -1885,5 +1828,5 @@
     m_bInterSDCFlag        [ i ] = false;
 #endif
-#if SEC_MPI_ENABLING_MERGE_F0150
+#if H_3D_IV_MERGE
     m_bMPIFlag             [ i ] = false;
 #endif
@@ -1895,102 +1838,20 @@
 TComVPS::~TComVPS()
 {
-if( m_hrdParameters    != NULL )     delete[] m_hrdParameters;
+  if( m_hrdParameters    != NULL )     delete[] m_hrdParameters;
   if( m_hrdOpSetIdx      != NULL )     delete[] m_hrdOpSetIdx;
   if( m_cprmsPresentFlag != NULL )     delete[] m_cprmsPresentFlag;
 #if H_MV
   if ( m_vpsVUI          != NULL )     delete m_vpsVUI; 
-#if H_MV_6_HRD_O0217_13
   if ( m_dpbSize         != NULL )     delete m_dpbSize; 
-#endif
 
   for( Int i = 0; i < MAX_NUM_LAYERS; i++ )
   {
     if (m_repFormat[ i ] != NULL )      delete m_repFormat[ i ];    
-#if H_3D_DIM_DLT
-#if !DLT_DIFF_CODING_IN_PPS
-    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
-  }
-#endif
-#if CAM_HLS_F0136_F0045_F0082
+  }
+#endif
+#if H_3D
   deleteCamPars();
 #endif
 }
-
-#if H_3D_DIM_DLT
-#if !DLT_DIFF_CODING_IN_PPS
-  Void TComVPS::setDepthLUTs(Int layerIdInVps, Int* idxToDepthValueTable, Int iNumDepthValues)
-  {
-    if( idxToDepthValueTable == NULL || iNumDepthValues == 0 ) // default mapping only
-      return;
-    
-    // copy idx2DepthValue to internal array
-    memcpy(m_iIdx2DepthValue[layerIdInVps], idxToDepthValueTable, iNumDepthValues*sizeof(UInt));
-    
-    UInt uiMaxDepthValue = ((1 << g_bitDepthY)-1);
-    for(Int p=0; p<=uiMaxDepthValue; p++)
-    {
-      Int iIdxDown    = 0;
-      Int iIdxUp      = iNumDepthValues-1;
-      Bool bFound     = false;
-      
-      // iterate over indices to find lower closest depth
-      Int i = 1;
-      while(!bFound && i<iNumDepthValues)
-      {
-        if( m_iIdx2DepthValue[layerIdInVps][i] > p )
-        {
-          iIdxDown  = i-1;
-          bFound    = true;
-        }
-        
-        i++;
-      }
-      // iterate over indices to find upper closest depth
-      i = iNumDepthValues-2;
-      bFound = false;
-      while(!bFound && i>=0)
-      {
-        if( m_iIdx2DepthValue[layerIdInVps][i] < p )
-        {
-          iIdxUp  = i+1;
-          bFound    = true;
-        }
-        
-        i--;
-      }
-      
-      // assert monotony
-      assert(iIdxDown<=iIdxUp);
-      
-      // assign closer depth value/idx
-      if( abs(p-m_iIdx2DepthValue[layerIdInVps][iIdxDown]) < abs(p-m_iIdx2DepthValue[layerIdInVps][iIdxUp]) )
-      {
-        m_iDepthValue2Idx[layerIdInVps][p] = iIdxDown;
-      }
-      else
-      {
-        m_iDepthValue2Idx[layerIdInVps][p] = iIdxUp;
-      }
-      
-    }
-    
-    // update DLT variables
-    m_iNumDepthmapValues[layerIdInVps] = iNumDepthValues;
-    m_iBitsPerDepthValue[layerIdInVps] = numBitsForValue(m_iNumDepthmapValues[layerIdInVps]);
-  }
-#endif
-#endif
 
 #if H_MV
@@ -2079,5 +1940,5 @@
   return foundLayerIdinNuh;
 }
-#if CAM_HLS_F0136_F0045_F0082
+
 Void TComVPS::createCamPars(Int iNumViews)
 {
@@ -2168,5 +2029,4 @@
   }
 }
-#endif // CAM_HLS_F0136_F0045_F0082
 
 #endif // H_3D
@@ -2204,17 +2064,7 @@
   assert( lsIdx >= 0 ); 
   assert( lsIdx <= getVpsNumLayerSetsMinus1() ); 
-#if H_MV_6_HRD_O0217_13
   return (Int) m_layerSetLayerIdList[ lsIdx ].size(); 
-#else
-  Int numLayersInIdList = 0; 
-  for (Int layerId = 0; layerId < getVpsMaxLayerId(); layerId++ )
-  {
-    numLayersInIdList += ( getLayerIdIncludedFlag( lsIdx, layerId ) ); 
-  }
-  return numLayersInIdList;
-#endif
-}
-
-#if H_MV_6_HRD_O0217_13
+}
+
 Int    TComVPS::getNumOutputLayerSets() 
 {
@@ -2226,5 +2076,4 @@
   return numOutputLayerSets; 
 }
-#endif
 
 Int TComVPS::getNumViews()
@@ -2258,5 +2107,4 @@
 }
 
-#if H_MV_6_HRD_O0217_13
 Void TComVPS::deriveLayerSetLayerIdList()
 {
@@ -2294,5 +2142,4 @@
   }
 }
-#endif
 #endif // H_MV
 
@@ -2349,10 +2196,6 @@
 , m_spsScalingListRefLayerId  ( 0 )
 
-#if !H_MV_6_PS_REP_FORM_18_19_20
-, m_updateRepFormatFlag       ( true ) 
-#else
 , m_updateRepFormatFlag       ( false ) 
 , m_spsRepFormatIdx           ( 0 )
-#endif
 , m_interViewMvVertConstraintFlag (false)
 #endif
@@ -2370,5 +2213,5 @@
   ::memset(m_ltRefPicPocLsbSps, 0, sizeof(m_ltRefPicPocLsbSps));
   ::memset(m_usedByCurrPicLtSPSFlag, 0, sizeof(m_usedByCurrPicLtSPSFlag));
-#if H_MV_6_PSEM_O0142_3
+#if H_MV
   m_spsExtensionFlag = false; 
   for( Int i = 0; i < PS_EX_T_MAX_NUM; i++ ) 
@@ -2376,6 +2219,4 @@
     m_spsExtensionTypeFlag[ i ] = false;
   }
-#endif
-#if H_MV_6_SHVC_O0098_36
   m_numScaledRefLayerOffsets = 0; 
 
@@ -2548,5 +2389,5 @@
 , m_ppsInferScalingListFlag(false)
 , m_ppsScalingListRefLayerId(0)
-#if DLT_DIFF_CODING_IN_PPS
+#if H_3D
 , m_pcDLT(NULL)
 #endif
@@ -2571,5 +2412,5 @@
 }
 
-#if DLT_DIFF_CODING_IN_PPS
+#if H_3D
 TComDLT::TComDLT()
 : m_bDltPresentFlag(false)
@@ -2753,12 +2594,6 @@
   if ( layerIdCurr > 0 )
   { 
-#if H_MV_6_PS_REP_FORM_18_19_20
     Int            repFormatIdx = getUpdateRepFormatFlag() ?  getSpsRepFormatIdx() : vps->getVpsRepFormatIdx( vps->getLayerIdInVps( layerIdCurr ) ) ;
     TComRepFormat* repFormat    = vps->getRepFormat( repFormatIdx ); 
-#else
-    TComRepFormat* repFormat = vps->getRepFormat( vps->getVpsRepFormatIdx( vps->getLayerIdInVps( layerIdCurr ) ) ); 
-    if ( !getUpdateRepFormatFlag() )
-    {        
-#endif
       setChromaFormatIdc( repFormat->getChromaFormatVpsIdc() );         
       //// ToDo: add when supported: 
@@ -2773,10 +2608,5 @@
       setBitDepthC             ( repFormat->getBitDepthVpsChromaMinus8() + 8 ); 
       setQpBDOffsetC           ( (Int) (6* ( getBitDepthC() -8 ) ) );
-#if !H_MV_6_PS_REP_FORM_18_19_20
-    }
-    else
-#else
     if ( getLayerId() > 0 && getUpdateRepFormatFlag() )
-#endif
     {
       assert( getChromaFormatIdc()      <=  repFormat->getChromaFormatVpsIdc()         ); 
@@ -2808,29 +2638,5 @@
 }
 #endif
-#if H_3D
-#if !CAM_HLS_F0136_F0045_F0082
-Void
-TComSPS::initCamParaSPS( UInt uiViewIndex, UInt uiCamParPrecision, Bool bCamParSlice, Int** aaiScale, Int** aaiOffset )
-{
-  AOT( uiViewIndex != 0 && !bCamParSlice && ( aaiScale == 0 || aaiOffset == 0 ) );  
-  
-  m_uiCamParPrecision     = ( uiViewIndex ? uiCamParPrecision : 0 );
-  m_bCamParInSliceHeader  = ( uiViewIndex ? bCamParSlice  : false );
-  ::memset( m_aaiCodedScale,  0x00, sizeof( m_aaiCodedScale  ) );
-  ::memset( m_aaiCodedOffset, 0x00, sizeof( m_aaiCodedOffset ) );
-
-  if( !m_bCamParInSliceHeader )
-  {
-    for( UInt uiBaseViewIndex = 0; uiBaseViewIndex < uiViewIndex; uiBaseViewIndex++ )
-    {
-      m_aaiCodedScale [ 0 ][ uiBaseViewIndex ] = aaiScale [ uiBaseViewIndex ][     uiViewIndex ];
-      m_aaiCodedScale [ 1 ][ uiBaseViewIndex ] = aaiScale [     uiViewIndex ][ uiBaseViewIndex ];
-      m_aaiCodedOffset[ 0 ][ uiBaseViewIndex ] = aaiOffset[ uiBaseViewIndex ][     uiViewIndex ];
-      m_aaiCodedOffset[ 1 ][ uiBaseViewIndex ] = aaiOffset[     uiViewIndex ][ uiBaseViewIndex ];
-    }
-  }
-}
-#endif
-#endif
+
 TComReferencePictureSet::TComReferencePictureSet()
 : m_numberOfPictures (0)
@@ -3150,8 +2956,6 @@
     {
       TComPic* pcPic = ivPicLists->getPic( targetDecLayerIdSet[ i ], curPoc ); 
-#if H_MV_LAYER_WISE_STARTUP
       if ( pcPic )
       {
-#endif
       if( pcPic->getSlice(0)->isReferenced() && pcPic->getSlice(0)->getTemporalLayerNonReferenceFlag() ) 
       { 
@@ -3176,7 +2980,5 @@
       }
     }
-#if H_MV_LAYER_WISE_STARTUP
-      }
-#endif
+      }
   }
 }
@@ -3236,5 +3038,4 @@
 
 
-#if H_MV_6_ILDDS_ILREFPICS_27_34
 Int  TComSlice::getRefLayerPicFlag( Int i ) 
 {
@@ -3279,5 +3080,4 @@
   return numRefLayerPics; 
 }
-#endif
 
 
@@ -3293,9 +3093,5 @@
   else if (getVPS()->getAllRefLayersActiveFlag() )
   {
-#if H_MV_6_ILDDS_ILREFPICS_27_34
     numActiveRefLayerPics = getNumRefLayerPics(); 
-#else
-    numActiveRefLayerPics = getVPS()->getNumDirectRefLayers( getLayerId() );
-#endif
   }
   else if ( !getInterLayerPredEnabledFlag() )
@@ -3305,9 +3101,5 @@
   else if( getVPS()->getMaxOneActiveRefLayerFlag() || getVPS()->getNumDirectRefLayers( getLayerId() ) == 1 )
   {
-#if H_MV_6_ILDDS_ILREFPICS_27_34
     numActiveRefLayerPics = getRefLayerPicFlag( 0 ) ? 1 : 0; 
-#else
-    numActiveRefLayerPics = 1; 
-#endif
   }
   else
@@ -3324,20 +3116,8 @@
 
 #if H_3D_ARP
-#if SHARP_ARP_REF_CHECK_F0105
 Void TComSlice::setARPStepNum( TComPicLists*ivPicLists )
-#else
-Void TComSlice::setARPStepNum()                                  
-#endif
-{
-#if SHARP_ARP_REF_CHECK_F0105
+{
   Bool tempRefPicInListsFlag = false;
-#else
-  Bool bAllIvRef = true;
-#endif
-#if QC_MTK_INTERVIEW_ARP_F0123_F0108
   if(!getVPS()->getUseAdvRP(getLayerId()) || this->isIRAP())
-#else
-  if(!getVPS()->getUseAdvRP(getLayerId()))
-#endif
   {
     m_nARPStepNum = 0;
@@ -3345,5 +3125,4 @@
   else
   {
-#if SHARP_ARP_REF_CHECK_F0105
     setFirstTRefIdx (REF_PIC_LIST_0, -1);
     setFirstTRefIdx (REF_PIC_LIST_1, -1);
@@ -3361,30 +3140,6 @@
     tempRefPicInListsFlag = getFirstTRefIdx(REF_PIC_LIST_0) >= 0 || getFirstTRefIdx(REF_PIC_LIST_1) >= 0;
     m_nARPStepNum = tempRefPicInListsFlag ? getVPS()->getARPStepNum(getLayerId()) : 0;
-#else
-    for( Int iRefListId = 0; iRefListId < 2; iRefListId++ )
-    {
-      RefPicList  eRefPicList = RefPicList( iRefListId );
-      Int iNumRefIdx = getNumRefIdx(eRefPicList);
-      
-      if( iNumRefIdx <= 0 )
-      {
-        continue;
-      }
-
-      for ( Int i = 0; i < iNumRefIdx; i++ )
-      {
-        if( getRefPic( eRefPicList, i)->getPOC() != getPOC() )
-        {
-          bAllIvRef = false;
-          break;
-        }
-      }
-
-      if( bAllIvRef == false ) { break; }
-    }
-    m_nARPStepNum = !bAllIvRef ? getVPS()->getARPStepNum(getLayerId()) : 0;
-#endif
-  }
-#if SHARP_ARP_REF_CHECK_F0105
+  }
+
   if (tempRefPicInListsFlag)
   {
@@ -3407,7 +3162,6 @@
         }
       }
-  }
-}
-#endif
+    }
+  }
 }
 #endif
@@ -3514,5 +3268,5 @@
 #endif 
 
-#if QC_DEPTH_IV_MRG_F0125
+#if H_3D_IV_MERGE
   setupLUT = setupLUT || ( getVPS()->getIvMvPredFlag(layerIdInVPS ) && getIsDepth() );
 #endif
@@ -3543,11 +3297,6 @@
   assert( m_depthToDisparityF != NULL ); 
 
-#if CAM_HLS_F0136_F0045_F0082
   TComVPS* vps = getVPS(); 
-#else
-  TComSPS* sps = getSPS(); 
-#endif
-
-#if CAM_HLS_F0136_F0045_F0082
+
   Int log2Div = g_bitDepthY - 1 + vps->getCamParPrecision();
   Int viewIndex = getViewIndex();
@@ -3559,14 +3308,4 @@
   Int* invCodScale  = camParaSH ? m_aaiCodedScale [ 1 ] : vps->getInvCodedScale ( viewIndex ); 
   Int* invCodOffset = camParaSH ? m_aaiCodedOffset[ 1 ] : vps->getInvCodedOffset( viewIndex ); 
-#else
-  Int log2Div = g_bitDepthY - 1 + sps->getCamParPrecision();
-
-  Bool camParaSH = m_pcSPS->hasCamParInSliceHeader();
-
-  Int* codScale     = camParaSH ? m_aaiCodedScale [ 0 ] : sps->getCodedScale    (); 
-  Int* codOffset    = camParaSH ? m_aaiCodedOffset[ 0 ] : sps->getCodedOffset   (); 
-  Int* invCodScale  = camParaSH ? m_aaiCodedScale [ 1 ] : sps->getInvCodedScale (); 
-  Int* invCodOffset = camParaSH ? m_aaiCodedOffset[ 1 ] : sps->getInvCodedOffset(); 
-#endif
 
   for (Int i = 0; i <= ( getViewIndex() - 1); i++)
@@ -3925,7 +3664,5 @@
 TComVPSVUI::TComVPSVUI()
 {
-#if H_MV_6_PS_O0223_29
   m_crossLayerIrapAlignedFlag = true; 
-#endif
   m_bitRatePresentVpsFlag = false;
   m_picRatePresentVpsFlag = false;
@@ -3955,18 +3692,13 @@
     }
   }
-#if H_MV_6_PS_O0118_33  
   for ( Int i = 0; i < MAX_NUM_VIDEO_SIGNAL_INFO; i++ )
   {
     m_videoSignalInfo          [i] = NULL;     
   }
-#endif
-
-#if H_MV_6_HRD_O0164_15
+
   m_vpsVuiBspHrdPresentFlag = false; 
   m_vpsVuiBspHrdParameters  = new TComVpsVuiBspHrdParameters();
-#endif
-}
-
-#if H_MV_6_PS_O0118_33
+}
+
 TComVPSVUI::~TComVPSVUI()
 {
@@ -3977,12 +3709,8 @@
   }
 
-#if H_MV_6_HRD_O0164_15
   if ( m_vpsVuiBspHrdParameters ) delete m_vpsVuiBspHrdParameters;
   m_vpsVuiBspHrdParameters = NULL; 
-#endif
-}
-#endif
-
-#if H_MV_6_PS_REP_FORM_18_19_20
+}
+
 Void TComRepFormat::inferChromaAndBitDepth( TComRepFormat* prevRepFormat, Bool encoderFlag )
 {
@@ -4002,7 +3730,5 @@
 }
 }
-#endif
-
-#if H_MV_6_HRD_O0164_15
+
 Void TComVpsVuiBspHrdParameters::checkLayerInBspFlag( TComVPS* vps, Int h )
 {
@@ -4031,4 +3757,23 @@
   }
 }
-#endif
-#endif
+
+Void TComVUI::inferVideoSignalInfo( TComVPS* vps, Int layerIdCurr )
+{
+  if ( layerIdCurr == 0 || !vps->getVpsVuiPresentFlag() ) 
+  {
+    return; 
+  }
+
+  TComVPSVUI* vpsVUI = vps->getVPSVUI(); 
+  assert( vpsVUI != NULL );  
+
+  TComVideoSignalInfo* videoSignalInfo = vpsVUI->getVideoSignalInfo( vpsVUI->getVpsVideoSignalInfoIdx( vps->getLayerIdInVps( layerIdCurr ) ) ); 
+  assert( videoSignalInfo != NULL );
+
+  setVideoFormat            ( videoSignalInfo->getVideoVpsFormat            () ); 
+  setVideoFullRangeFlag     ( videoSignalInfo->getVideoFullRangeVpsFlag     () );
+  setColourPrimaries        ( videoSignalInfo->getColourPrimariesVps        () );
+  setTransferCharacteristics( videoSignalInfo->getTransferCharacteristicsVps() );
+  setMatrixCoefficients     ( videoSignalInfo->getMatrixCoeffsVps           () );
+}
+#endif
Index: trunk/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComSlice.h	(revision 759)
+++ trunk/source/Lib/TLibCommon/TComSlice.h	(revision 773)
@@ -53,4 +53,5 @@
 #if H_MV
 class TComPicLists; 
+class TComVPS; 
 #endif
 // ====================================================================================================================
@@ -62,7 +63,4 @@
 // ====================================================================================================================
 
-#if H_MV_6_HRD_O0164_15
-class TComVPS; 
-#endif
 /// Reference Picture Set class
 class TComReferencePictureSet
@@ -407,5 +405,4 @@
 #if H_MV
 
-#if H_MV_6_PS_O0118_33
 class TComVideoSignalInfo
 {
@@ -432,6 +429,4 @@
   Int  getMatrixCoeffsVps(  ) { return m_matrixCoeffsVps; } 
 };
-#endif
-#if H_MV_6_HRD_O0164_15
 class TComVpsVuiBspHrdParameters
 {
@@ -473,12 +468,9 @@
 };
 
-#endif
 class TComVPSVUI
 {
 private:
-#if H_MV_6_PS_O0223_29
   Bool m_crossLayerPicTypeAlignedFlag;
   Bool m_crossLayerIrapAlignedFlag;
-#endif
   Bool m_bitRatePresentVpsFlag;
   Bool m_picRatePresentVpsFlag;
@@ -489,33 +481,24 @@
   Int  m_constantPicRateIdc          [MAX_VPS_OP_SETS_PLUS1][MAX_TLAYER];
   Int  m_avgPicRate                  [MAX_VPS_OP_SETS_PLUS1][MAX_TLAYER];
-#if H_MV_6_O0226_37
   Bool m_tilesNotInUseFlag;
   Bool m_tilesInUseFlag              [MAX_NUM_LAYERS];
   Bool m_loopFilterNotAcrossTilesFlag[MAX_NUM_LAYERS];
-#endif  
   Bool m_tileBoundariesAlignedFlag   [MAX_NUM_LAYERS][MAX_NUM_LAYERS];
-#if H_MV_6_O0226_37
   Bool m_wppNotInUseFlag;
   Bool m_wppInUseFlag                [MAX_NUM_LAYERS];
-#endif
   Bool m_ilpRestrictedRefLayersFlag;
   Int  m_minSpatialSegmentOffsetPlus1[MAX_NUM_LAYERS][MAX_NUM_LAYERS];
   Bool m_ctuBasedOffsetEnabledFlag   [MAX_NUM_LAYERS][MAX_NUM_LAYERS];
   Int  m_minHorizontalCtuOffsetPlus1 [MAX_NUM_LAYERS][MAX_NUM_LAYERS];
-#if H_MV_6_PS_O0118_33
   Bool m_videoSignalInfoIdxPresentFlag;
   Int  m_vpsNumVideoSignalInfoMinus1;
   TComVideoSignalInfo* m_videoSignalInfo[MAX_NUM_VIDEO_SIGNAL_INFO];   
   Int  m_vpsVideoSignalInfoIdx       [MAX_NUM_VIDEO_SIGNAL_INFO];
-#endif
-#if H_MV_6_HRD_O0164_15
   Bool m_vpsVuiBspHrdPresentFlag;
   TComVpsVuiBspHrdParameters* m_vpsVuiBspHrdParameters; 
-#endif
 
 public: 
   TComVPSVUI();
   ~TComVPSVUI(); 
-#if H_MV_6_PS_O0223_29
   Void setCrossLayerPicTypeAlignedFlag( Bool flag ) { m_crossLayerPicTypeAlignedFlag = flag; } 
   Bool getCrossLayerPicTypeAlignedFlag(  ) { return m_crossLayerPicTypeAlignedFlag; } 
@@ -523,5 +506,4 @@
   Void setCrossLayerIrapAlignedFlag( Bool flag ) { m_crossLayerIrapAlignedFlag = flag; } 
   Bool getCrossLayerIrapAlignedFlag(  ) { return m_crossLayerIrapAlignedFlag; } 
-#endif
 
   Void setBitRatePresentVpsFlag( Bool flag ) { m_bitRatePresentVpsFlag = flag; } 
@@ -549,5 +531,4 @@
   Int  getAvgPicRate( Int i, Int j ) { return m_avgPicRate[i][j]; } 
 
-#if H_MV_6_O0226_37
   Void setTilesNotInUseFlag( Bool flag ) { m_tilesNotInUseFlag = flag; } 
   Bool getTilesNotInUseFlag(  ) { return m_tilesNotInUseFlag; } 
@@ -558,10 +539,8 @@
   Void setLoopFilterNotAcrossTilesFlag( Int i, Int  val ) { m_loopFilterNotAcrossTilesFlag[i] = val; } 
   Bool getLoopFilterNotAcrossTilesFlag( Int i ) { return m_loopFilterNotAcrossTilesFlag[i]; } 
-#endif
 
   Void setTileBoundariesAlignedFlag( Int i, Int j, Bool flag ) { m_tileBoundariesAlignedFlag[i][j] = flag; } 
   Bool getTileBoundariesAlignedFlag( Int i, Int j ) { return m_tileBoundariesAlignedFlag[i][j]; } 
 
-#if H_MV_6_O0226_37
   Void setWppNotInUseFlag( Bool flag ) { m_wppNotInUseFlag = flag; } 
   Bool getWppNotInUseFlag(  ) { return m_wppNotInUseFlag; } 
@@ -569,5 +548,4 @@
   Void setWppInUseFlag( Int i, Bool flag ) { m_wppInUseFlag[i] = flag; } 
   Bool getWppInUseFlag( Int i ) { return m_wppInUseFlag[i]; } 
-#endif
 
   Void setIlpRestrictedRefLayersFlag( Bool flag ) { m_ilpRestrictedRefLayersFlag = flag; } 
@@ -583,5 +561,4 @@
   Int  getMinHorizontalCtuOffsetPlus1( Int i, Int j ) { return m_minHorizontalCtuOffsetPlus1[i][j]; } 
 
-#if H_MV_6_PS_O0118_33
   Void setVideoSignalInfoIdxPresentFlag( Bool flag ) { m_videoSignalInfoIdxPresentFlag = flag; } 
   Bool getVideoSignalInfoIdxPresentFlag(  ) { return m_videoSignalInfoIdxPresentFlag; } 
@@ -595,7 +572,5 @@
   Void setVpsVideoSignalInfoIdx( Int i, Int  val ) { m_vpsVideoSignalInfoIdx[i] = val; } 
   Int  getVpsVideoSignalInfoIdx( Int i ) { return m_vpsVideoSignalInfoIdx[i]; } 
-#endif
-
-#if H_MV_6_HRD_O0164_15
+
   Void setVpsVuiBspHrdPresentFlag( Bool flag ) { m_vpsVuiBspHrdPresentFlag = flag; } 
   Bool getVpsVuiBspHrdPresentFlag(  ) { return m_vpsVuiBspHrdPresentFlag; }
@@ -603,5 +578,4 @@
   Void setVpsVuiBspHrdParameters( TComVpsVuiBspHrdParameters* val) {  m_vpsVuiBspHrdParameters = val; } 
   TComVpsVuiBspHrdParameters* getVpsVuiBspHrdParameters(  ) { return m_vpsVuiBspHrdParameters; }
-#endif
 };
 
@@ -609,7 +583,5 @@
 {
 private:
-#if H_MV_6_PS_REP_FORM_18_19_20
   Bool m_chromaAndBitDepthVpsPresentFlag;
-#endif
   Int  m_chromaFormatVpsIdc;
   Bool m_separateColourPlaneVpsFlag;
@@ -622,10 +594,8 @@
   TComRepFormat() { };  
 
-#if H_MV_6_PS_REP_FORM_18_19_20
   Void setChromaAndBitDepthVpsPresentFlag( Bool flag ) { m_chromaAndBitDepthVpsPresentFlag = flag; } 
   Bool getChromaAndBitDepthVpsPresentFlag(  ) { return m_chromaAndBitDepthVpsPresentFlag; } 
   Void checkChromaAndBitDepthVpsPresentFlag( Int i ) { assert( i != 0 || m_chromaAndBitDepthVpsPresentFlag ); } // The value of chroma_and_bit_depth_vps_present_flag of the first rep_format( ) syntax structure in the VPS shall be equal to 1.  
   Void inferChromaAndBitDepth( TComRepFormat* prevRepFormat, Bool encoderFlag );
-#endif
 
   Void setChromaFormatVpsIdc( Int  val ) { m_chromaFormatVpsIdc = val; } 
@@ -647,7 +617,6 @@
   Int  getBitDepthVpsChromaMinus8(  ) { return m_bitDepthVpsChromaMinus8; } 
 };
-#endif
-
-#if H_MV_6_HRD_O0217_13
+
+
 class TComDpbSize
 {
@@ -696,5 +665,4 @@
 };
 #endif
-
 class TComVPS
 {
@@ -748,21 +716,11 @@
   Int         m_dimensionId              [MAX_NUM_LAYER_IDS][MAX_NUM_SCALABILITY_TYPES];  
 
-#if H_MV_6_PS_O0109_22
   Int         m_viewIdLen;
-#else
-  Int         m_viewIdLenMinus1;
-#endif
   Int         m_viewIdVal                [MAX_NUM_LAYERS];
   Bool        m_directDependencyFlag     [MAX_NUM_LAYER_IDS][MAX_NUM_LAYER_IDS];
-#if H_MV_6_ILDSD_O0120_26
   Bool        m_vpsSubLayersMaxMinus1PresentFlag;
   Int         m_subLayersVpsMaxMinus1    [MAX_NUM_LAYERS];
-#endif
   Bool        m_maxTidRefPresentFlag;
-#if H_MV_6_ILDDS_O0225_30
   Int         m_maxTidIlRefPicsPlus1     [MAX_NUM_LAYERS][MAX_NUM_LAYERS];
-#else
-  Int         m_maxTidIlRefPicPlus1      [MAX_NUM_LAYERS];
-#endif
   Bool        m_allRefLayersActiveFlag;
   Int         m_vpsNumberLayerSetsMinus1; 
@@ -772,15 +730,9 @@
   Bool        m_moreOutputLayerSetsThanDefaultFlag;
   Int         m_numAddOutputLayerSetsMinus1;    
-#if H_MV_6_PS_0109_25
   Int         m_defaultOneTargetOutputLayerIdc;
-#else
-  Bool        m_defaultOneTargetOutputLayerFlag;
-#endif
   Int         m_outputLayerSetIdxMinus1  [MAX_VPS_OUTPUTLAYER_SETS];  
   Bool        m_outputLayerFlag          [MAX_VPS_OUTPUTLAYER_SETS][MAX_VPS_NUH_LAYER_ID_PLUS1];
   Int         m_profileLevelTierIdx      [MAX_VPS_OUTPUTLAYER_SETS ];
-#if H_MV_6_GEN_0153_28
   Bool        m_altOutputLayerFlag;
-#endif
   Bool        m_repFormatIdxPresentFlag;
   Int         m_vpsNumRepFormatsMinus1;
@@ -788,19 +740,10 @@
   TComRepFormat* m_repFormat             [MAX_NUM_LAYERS]; 
   Bool        m_maxOneActiveRefLayerFlag;       
-#if H_MV_6_MISC_O0062_31
   Bool        m_pocLsbNotPresentFlag     [MAX_NUM_LAYERS];
-#endif
-
-#if H_MV_6_HRD_O0217_13
+
   TComDpbSize* m_dpbSize; 
-#endif
-#if !H_MV_6_PS_O0223_29       
-  Bool        m_crossLayerIrapAlignedFlag;
-#endif
   Int         m_directDepTypeLenMinus2;         
-#if H_MV_6_PS_O0096_21
   Bool        m_defaultDirectDependencyFlag;
   Int         m_defaultDirectDependencyType;
-#endif
   Bool        m_vpsVuiPresentFlag;
   TComVPSVUI* m_vpsVUI; 
@@ -822,9 +765,7 @@
   Int         m_viewIndex                [MAX_NUM_LAYERS   ];
   
-#if H_MV_6_HRD_O0217_13
   std::vector< std::vector< Int> >       m_targetDecLayerIdLists;   //[TargetOptLayerSetIdx][i]
   std::vector< std::vector< Int> >       m_targetOptLayerIdLists; 
   std::vector< std::vector< Int> >       m_layerSetLayerIdList; 
-#endif
 
 
@@ -838,5 +779,5 @@
 #if H_3D_IV_MERGE
   Bool        m_ivMvPredFlag             [ MAX_NUM_LAYERS ]; 
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
   Int         m_iSubPULog2Size           [MAX_NUM_LAYERS   ];
 #endif
@@ -850,17 +791,5 @@
   Bool        m_vpsDepthModesFlag        [MAX_NUM_LAYERS   ];
 
-#if H_3D_DIM_DLT
-#if !DLT_DIFF_CODING_IN_PPS
-  Bool        m_bUseDLTFlag              [MAX_NUM_LAYERS   ];
-  
-  Int         m_iBitsPerDepthValue       [MAX_NUM_LAYERS   ];
-  Int         m_iNumDepthmapValues       [MAX_NUM_LAYERS   ];
-  Int*        m_iDepthValue2Idx          [MAX_NUM_LAYERS   ];
-  Int*        m_iIdx2DepthValue          [MAX_NUM_LAYERS   ];
-#endif
-#endif
-
 #if H_3D
-#if CAM_HLS_F0136_F0045_F0082
   UInt        m_uiCamParPrecision;
   Bool*       m_bCamParInSliceHeader;
@@ -868,5 +797,4 @@
   Int         ***m_aaaiCodedScale ;
   Int         ***m_aaaiCodedOffset;
-#endif
   Bool        m_ivMvScalingFlag; 
 #endif
@@ -874,5 +802,5 @@
   Bool        m_bInterSDCFlag[MAX_NUM_LAYERS   ];
 #endif
-#if SEC_MPI_ENABLING_MERGE_F0150
+#if H_3D_IV_MERGE
   Bool        m_bMPIFlag[MAX_NUM_LAYERS   ];
 #endif
@@ -901,8 +829,7 @@
   UInt    getMaxTLayers  ()                   { return m_uiMaxTLayers;   }
   Void    setMaxTLayers  (UInt t)             { m_uiMaxTLayers = t; }
-#if H_MV_6_HRD_O0164_15
+
+#if H_MV    
   UInt    getMaxSubLayersMinus1()             { return m_uiMaxTLayers - 1;  }  // For consistency with draft spec
-#endif
-#if H_MV    
   UInt    getMaxLayersMinus1()                { return m_uiMaxLayersMinus1;  }; 
   Void    setMaxLayersMinus1(UInt l)          { m_uiMaxLayersMinus1 = l; }
@@ -978,11 +905,6 @@
   Int     getDimensionId( Int layerIdInVps, Int scalIdx )                  { return m_dimensionId[layerIdInVps][scalIdx]; }
 
-#if H_MV_6_PS_O0109_22
   Void    setViewIdLen( Int  val )                                         { m_viewIdLen = val; } 
   Int     getViewIdLen(  )                                                 { return m_viewIdLen; } 
-#else
-  Void    setViewIdLenMinus1( Int  val )                                   { m_viewIdLenMinus1 = val; } 
-  Int     getViewIdLenMinus1(  )                                           { return m_viewIdLenMinus1; } 
-#endif
 
   Void    setViewIdVal( Int viewOrderIndex, Int  val )                     { m_viewIdVal[viewOrderIndex] = val; } 
@@ -990,5 +912,4 @@
   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_MV_6_ILDSD_O0120_26
   Void    setVpsSubLayersMaxMinus1PresentFlag( Bool flag )                 { m_vpsSubLayersMaxMinus1PresentFlag = flag; } 
   Bool    getVpsSubLayersMaxMinus1PresentFlag(  )                          { return m_vpsSubLayersMaxMinus1PresentFlag; } 
@@ -996,14 +917,8 @@
   Int     getSubLayersVpsMaxMinus1( Int i )                                { return m_subLayersVpsMaxMinus1[i]; } 
   Void    checkSubLayersVpsMaxMinus1( Int i )                              { assert( m_subLayersVpsMaxMinus1[i] >= 0 && m_subLayersVpsMaxMinus1[i] <= m_uiMaxTLayers - 1 ); }
-#endif
   Void    setMaxTidRefPresentFlag( Bool flag )                             { m_maxTidRefPresentFlag = flag; } 
   Bool    getMaxTidRefPresentFlag(  )                                      { return m_maxTidRefPresentFlag; } 
-#if H_MV_6_ILDDS_O0225_30
   Void    setMaxTidIlRefPicsPlus1( Int i, Int j, Int  val )                { m_maxTidIlRefPicsPlus1[i][j] = val; } 
   Int     getMaxTidIlRefPicsPlus1( Int i, Int j )                          { return m_maxTidIlRefPicsPlus1[i][j]; } 
-#else
-  Void    setMaxTidIlRefPicPlus1( Int layerIdInVps, Int val )              { m_maxTidIlRefPicPlus1[ layerIdInVps ] = val;  } 
-  Int     getMaxTidIlRefPicPlus1( Int layerIdInVps )                       { return m_maxTidIlRefPicPlus1[ layerIdInVps ]; } 
-#endif
   Void    setAllRefLayersActiveFlag( Bool flag )                           { m_allRefLayersActiveFlag = flag; } 
   Bool    getAllRefLayersActiveFlag(  )                                    { return m_allRefLayersActiveFlag; } 
@@ -1019,7 +934,5 @@
   Void    setProfileRefMinus1( Int profileTierLevelIdx, Int val )          { m_profileRefMinus1[ profileTierLevelIdx ] = val;  } 
   Int     getProfileRefMinus1( Int profileTierLevelIdx )                   { return m_profileRefMinus1[ profileTierLevelIdx ]; } 
-#if H_MV_6_PS_O0109_23
   Void    checkProfileRefMinus1( Int i )                                   { assert( getProfileRefMinus1( i ) + 1 <= i ); };  //  The value of profile_ref_minus1[ i ] + 1 shall be less than or equal to i.
-#endif
   Void    setMoreOutputLayerSetsThanDefaultFlag( Bool flag )               { m_moreOutputLayerSetsThanDefaultFlag = flag; } 
   Bool    getMoreOutputLayerSetsThanDefaultFlag()                          { return m_moreOutputLayerSetsThanDefaultFlag; } 
@@ -1028,12 +941,7 @@
   Int     getNumAddOutputLayerSetsMinus1( )                                { return m_numAddOutputLayerSetsMinus1; } 
   
-#if H_MV_6_PS_0109_25  
   Void    setDefaultOneTargetOutputLayerIdc( Int  val )                    { m_defaultOneTargetOutputLayerIdc = val; } 
   Int     getDefaultOneTargetOutputLayerIdc(  )                            { return m_defaultOneTargetOutputLayerIdc; } 
   Void    checkDefaultOneTargetOutputLayerIdc( )                           { assert( m_defaultOneTargetOutputLayerIdc >= 0 && m_defaultOneTargetOutputLayerIdc <= 1 ); }
-#else
-  Void    setDefaultOneTargetOutputLayerFlag( Bool flag )                  { m_defaultOneTargetOutputLayerFlag = flag; } 
-  Bool    getDefaultOneTargetOutputLayerFlag( )                            { return m_defaultOneTargetOutputLayerFlag; } 
-#endif
   
   Void    setOutputLayerSetIdxMinus1( Int outLayerSetIdx, Int val )        { m_outputLayerSetIdxMinus1[ outLayerSetIdx ]  = val; } 
@@ -1042,14 +950,10 @@
   Void    setOutputLayerFlag( Int outLayerSetIdx, Int i, Bool flag )       { m_outputLayerFlag[ outLayerSetIdx ][ i ] = flag; } 
   Bool    getOutputLayerFlag( Int outLayerSetIdx, Int i )                  { return m_outputLayerFlag[ outLayerSetIdx ][ i ]; } 
-#if H_MV_6_HRD_O0217_13
   Bool    inferOutputLayerFlag( Int layerSetIdx, Int i )                   { return ( getDefaultOneTargetOutputLayerIdc( ) == 0 || ( ( getDefaultOneTargetOutputLayerIdc( ) == 1 ) && ( i == m_layerSetLayerIdList[layerSetIdx].size() - 1  ) ));  }
-#endif
 
   Void    setProfileLevelTierIdx( Int outLayerSetIdx, Int val )            { m_profileLevelTierIdx[ outLayerSetIdx  = val ]; }
   Int     getProfileLevelTierIdx( Int outLayerSetIdx )                     { return m_profileLevelTierIdx[ outLayerSetIdx ]; } 
-#if H_MV_6_GEN_0153_28
   Void    setAltOutputLayerFlag( Bool flag )                               { m_altOutputLayerFlag = flag; } 
   Bool    getAltOutputLayerFlag(  )                                        { return m_altOutputLayerFlag; } 
-#endif
 
   Void    setRepFormatIdxPresentFlag( Bool flag )                          { m_repFormatIdxPresentFlag = flag; } 
@@ -1067,21 +971,12 @@
   Bool    getMaxOneActiveRefLayerFlag( )                                   { return m_maxOneActiveRefLayerFlag; } 
 
-#if H_MV_6_HRD_O0217_13
   Void    setDpbSize( TComDpbSize* val )                                   { assert( m_dpbSize != 0 ); m_dpbSize = val; } 
   TComDpbSize* getDpbSize( )                                               { return m_dpbSize;} 
-#endif
-
-#if H_MV_6_MISC_O0062_31
+
   Void    setPocLsbNotPresentFlag( Int i, Bool flag )                      { m_pocLsbNotPresentFlag[i] = flag; } 
   Bool    getPocLsbNotPresentFlag( Int i )                                 { return m_pocLsbNotPresentFlag[i]; } 
-#endif
-#if !H_MV_6_PS_O0223_29  
-  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; } 
 
-#if H_MV_6_PS_O0096_21
   Void    setDefaultDirectDependencyFlag( Bool flag )                      { m_defaultDirectDependencyFlag = flag; } 
   Bool    getDefaultDirectDependencyFlag(  )                               { return m_defaultDirectDependencyFlag; } 
@@ -1089,5 +984,4 @@
   Void    setDefaultDirectDependencyType( Int  val )                       { m_defaultDirectDependencyType = val; } 
   Int     getDefaultDirectDependencyType(  )                               { return m_defaultDirectDependencyType; } 
-#endif
   Void    setDirectDependencyType( Int depLayeridInVps, Int refLayeridInVps, Int val) { m_directDependencyType[ depLayeridInVps ][ refLayeridInVps ] = val; } 
   Int     getDirectDependencyType( Int depLayeridInVps, Int refLayeridInVps)   { return m_directDependencyType[ depLayeridInVps ][ refLayeridInVps ]; } 
@@ -1096,14 +990,11 @@
 
   TComVPSVUI* getVPSVUI(  )                                                { return m_vpsVUI;  }
-  // VPS EXTENSION SEMANTICS VARIABLES
+ 
+ // VPS EXTENSION SEMANTICS VARIABLES
   Void    setLayerIdInVps( Int layerIdInNuh, Int val )                     { m_layerIdInVps[layerIdInNuh] = val;  }
   Int     getLayerIdInVps( Int layerIdInNuh )                              { assert( m_layerIdInVps[layerIdInNuh] >= 0 ); return m_layerIdInVps[layerIdInNuh]; }
 
   Int     getScalabilityId ( Int layerIdInVps, ScalabilityType scalType );
-#if H_MV_6_FIX_GET_VIEW_ID
   Int     getViewId        ( Int layerIdInNuh )                            { return m_viewIdVal[ getViewIndex( layerIdInNuh )]; }
-#else
-  Int     getViewId        ( Int layerIdInNuh )                            { return m_viewIdVal[ getViewIndex( getLayerIdInVps( layerIdInNuh) )]; }
-#endif
   Void    setRefLayers(); 
 
@@ -1120,15 +1011,11 @@
   Int     getNumLayersInIdList ( Int lsIdx );
 
-#if H_MV_6_HRD_O0217_13
   Int     getNumOutputLayerSets() ;   
   Int     getNumSubDpbs( Int i )                                           { return getNumLayersInIdList( i ); };  
   Bool    isOutputLayer( Int outLayerSetIdx, Int layerIdInNuh );   
-#if H_MV_6_HRD_O0217_13
   Void    deriveLayerSetLayerIdList();
   Void    deriveTargetLayerIdLists();
   std::vector<Int> getTargetDecLayerIdList( Int targetOptLayerSetIdx )     { return m_targetDecLayerIdLists[targetOptLayerSetIdx]; }; 
   std::vector<Int> getTargetOptLayerIdList( Int targetOptLayerSetIdx )     { return m_targetDecLayerIdLists[targetOptLayerSetIdx]; }; 
-#endif
-#endif
 
 
@@ -1150,5 +1037,5 @@
   Void    setARPStepNum( Int layerIdInVps, UInt val )                      { m_uiARPStepNum[layerIdInVps]    = val;     }
 #endif
-#if CAM_HLS_F0136_F0045_F0082
+
   Void createCamPars(Int iNumViews);
   Void deleteCamPars();
@@ -1162,10 +1049,9 @@
   Int* getInvCodedScale      ( Int viewIndex )  { return m_aaaiCodedScale [viewIndex][1]; }
   Int* getInvCodedOffset     ( Int viewIndex )  { return m_aaaiCodedOffset[viewIndex][1]; }
-#endif
 
 #if H_3D_IV_MERGE
   Void    setIvMvPredFlag     ( Int layerIdInVps, Bool val )  { m_ivMvPredFlag[ layerIdInVps ] = val; }
   Bool    getIvMvPredFlag     ( Int layerIdInVps )            { return m_ivMvPredFlag[ layerIdInVps ]; }; 
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
   Int     getSubPULog2Size(Int layerIdInVps)           { return m_iSubPULog2Size[layerIdInVps]; }
   Void    setSubPULog2Size(Int layerIdInVps, Int u)    { m_iSubPULog2Size[layerIdInVps] = u;}
@@ -1182,17 +1068,4 @@
   Void    setVpsDepthModesFlag( Int layerIdInVps, Bool val )               { m_vpsDepthModesFlag[ layerIdInVps ] = val; }
   Bool    getVpsDepthModesFlag( Int layerIdInVps )                         { return m_vpsDepthModesFlag[ layerIdInVps ]; }
-
-#if H_3D_DIM_DLT
-#if !DLT_DIFF_CODING_IN_PPS
-  Bool    getUseDLTFlag      ( Int layerIdInVps )                         { return m_bUseDLTFlag[ layerIdInVps ]; }
-  Void    setUseDLTFlag      ( Int layerIdInVps, Bool b ) { m_bUseDLTFlag[ layerIdInVps ]  = b;          }
-  
-  Int     getBitsPerDepthValue( Int layerIdInVps )        { return getUseDLTFlag(layerIdInVps)?m_iBitsPerDepthValue[layerIdInVps]:g_bitDepthY; }
-  Int     getNumDepthValues( Int layerIdInVps )           { return getUseDLTFlag(layerIdInVps)?m_iNumDepthmapValues[layerIdInVps]:((1 << g_bitDepthY)-1); }
-  Int     depthValue2idx( Int layerIdInVps, Pel value )   { return getUseDLTFlag(layerIdInVps)?m_iDepthValue2Idx[layerIdInVps][value]:value; }
-  Pel     idx2DepthValue( Int layerIdInVps, UInt uiIdx )  { return getUseDLTFlag(layerIdInVps)?m_iIdx2DepthValue[layerIdInVps][uiIdx]:uiIdx; }
-  Void    setDepthLUTs( Int layerIdInVps, Int* idx2DepthValue = NULL, Int iNumDepthValues = 0 );
-#endif
-#endif
 
   Bool    getIvMvScalingFlag   (  )                       { return m_ivMvScalingFlag; }
@@ -1202,5 +1075,5 @@
   Void    setInterSDCFlag      ( Int layerIdInVps, Bool bval ){ m_bInterSDCFlag[layerIdInVps] = bval; }
 #endif
-#if SEC_MPI_ENABLING_MERGE_F0150
+#if H_3D_IV_MERGE
   Bool    getMPIFlag      ( Int layerIdInVps )           { return m_bMPIFlag[layerIdInVps]; }
   Void    setMPIFlag      ( Int layerIdInVps, Bool bval ){ m_bMPIFlag[layerIdInVps] = bval; }
@@ -1210,5 +1083,5 @@
 };
 
-#if DLT_DIFF_CODING_IN_PPS
+#if H_3D
 class TComDLT
 {
@@ -1481,25 +1354,6 @@
   TComHRD* getHrdParameters                 ()             { return &m_hrdParameters; }
   TimingInfo* getTimingInfo() { return &m_timingInfo; }
-
-#if H_MV_6_PS_O0118_33
-  Void inferVideoSignalInfo( TComVPS* vps, Int layerIdCurr )
-  {
-    if ( layerIdCurr == 0 || !vps->getVpsVuiPresentFlag() ) 
-    {
-      return; 
-    }
-
-    TComVPSVUI* vpsVUI = vps->getVPSVUI(); 
-    assert( vpsVUI != NULL );  
-
-    TComVideoSignalInfo* videoSignalInfo = vpsVUI->getVideoSignalInfo( vpsVUI->getVpsVideoSignalInfoIdx( vps->getLayerIdInVps( layerIdCurr ) ) ); 
-    assert( videoSignalInfo != NULL );
-
-    setVideoFormat            ( videoSignalInfo->getVideoVpsFormat            () ); 
-    setVideoFullRangeFlag     ( videoSignalInfo->getVideoFullRangeVpsFlag     () );
-    setColourPrimaries        ( videoSignalInfo->getColourPrimariesVps        () );
-    setTransferCharacteristics( videoSignalInfo->getTransferCharacteristicsVps() );
-    setMatrixCoefficients     ( videoSignalInfo->getMatrixCoeffsVps           () );     
-  }
+#if H_MV
+  Void inferVideoSignalInfo( TComVPS* vps, Int layerIdCurr );
 #endif
 };
@@ -1588,17 +1442,12 @@
   TComVPS*    m_pcVPS; 
   // SPS 
-#if H_MV_6_PSEM_O0142_3
   Bool        m_spsExtensionFlag; 
   Bool        m_spsExtensionTypeFlag[PS_EX_T_MAX_NUM];
-#endif
   Bool        m_spsInferScalingListFlag;
   Int         m_spsScalingListRefLayerId;
   Bool        m_updateRepFormatFlag;
-#if H_MV_6_PS_REP_FORM_18_19_20  
   Int         m_spsRepFormatIdx;
-#endif
   // SPS Extension 
   Bool        m_interViewMvVertConstraintFlag;
-#if H_MV_6_SHVC_O0098_36
   Int         m_numScaledRefLayerOffsets;
   Int         m_scaledRefLayerId          [MAX_NUM_SCALED_REF_LAYERS];
@@ -1607,5 +1456,4 @@
   Int         m_scaledRefLayerRightOffset [MAX_NUM_LAYERS];
   Int         m_scaledRefLayerBottomOffset[MAX_NUM_LAYERS];
-#endif
 #endif
 #if H_3D
@@ -1744,5 +1592,4 @@
   TComPTL* getPTL()     { return &m_pcPTL; }
 #if H_MV
-#if H_MV_6_PSEM_O0142_3
   Void setSpsExtensionFlag( Bool flag ) { m_spsExtensionFlag = flag; } 
   Bool getSpsExtensionFlag( )  { return m_spsExtensionFlag; }
@@ -1750,5 +1597,4 @@
   Void setSpsExtensionTypeFlag( Int i, Bool flag ) { m_spsExtensionTypeFlag[i] = flag; } 
   Bool getSpsExtensionTypeFlag( Int i ) { return m_spsExtensionTypeFlag[i]; }
-#endif
   Void      setVPS          ( TComVPS* pcVPS ) { m_pcVPS = pcVPS; }
   TComVPS*  getVPS          () { return m_pcVPS; }
@@ -1762,13 +1608,10 @@
   Void setUpdateRepFormatFlag( Bool flag )     { m_updateRepFormatFlag = flag; } 
   Bool getUpdateRepFormatFlag(  )              { return m_updateRepFormatFlag; } 
-#if H_MV_6_PS_REP_FORM_18_19_20
   Void setSpsRepFormatIdx( Int  val )          { m_spsRepFormatIdx = val; } 
   Int  getSpsRepFormatIdx(  )                  { return m_spsRepFormatIdx; } 
-#endif
   // SPS Extension 
   Void setInterViewMvVertConstraintFlag(Bool val) { m_interViewMvVertConstraintFlag = val; }
   Bool getInterViewMvVertConstraintFlag()         { return m_interViewMvVertConstraintFlag;}
 
-#if H_MV_6_SHVC_O0098_36
   Void setNumScaledRefLayerOffsets( Int  val )    { m_numScaledRefLayerOffsets = val; } 
   Int  getNumScaledRefLayerOffsets(  )            { return m_numScaledRefLayerOffsets; } 
@@ -1788,5 +1631,4 @@
   Void setScaledRefLayerBottomOffset( Int j, Int  val ) { m_scaledRefLayerBottomOffset[j] = val; } 
   Int  getScaledRefLayerBottomOffset( Int j )           { return m_scaledRefLayerBottomOffset[j]; } 
-#endif
   // Inference 
   Void inferRepFormat( TComVPS* vps, Int layerIdCurr );
@@ -1799,18 +1641,4 @@
   Void setUsePC ( Bool b ) { m_bUsePC  = b;    }
   Bool getUsePC ()         { return m_bUsePC;  }
-#endif
-#if H_3D
-#if !CAM_HLS_F0136_F0045_F0082
-  Void initCamParaSPS      (  UInt uiViewIndex, UInt uiCamParPrecision = 0, Bool bCamParSlice = false, Int** aaiScale = 0, Int** aaiOffset = 0 );
-  UInt getCamParPrecision    ()  { return m_uiCamParPrecision; }
-  Bool hasCamParInSliceHeader()  { return m_bCamParInSliceHeader; }
-#if QC_DEPTH_IV_MRG_F0125
-  Void setHasCamParInSliceHeader( Bool b )  { m_bCamParInSliceHeader = b; }
-#endif
-  Int* getCodedScale         ()  { return m_aaiCodedScale [0]; }
-  Int* getCodedOffset        ()  { return m_aaiCodedOffset[0]; }
-  Int* getInvCodedScale      ()  { return m_aaiCodedScale [1]; }
-  Int* getInvCodedOffset     ()  { return m_aaiCodedOffset[1]; }
-#endif
 #endif
 #if H_MV
@@ -1919,5 +1747,5 @@
 #endif
 
-#if DLT_DIFF_CODING_IN_PPS
+#if H_3D
   TComDLT*  m_pcDLT; 
 #endif
@@ -1948,5 +1776,5 @@
   UInt      getMinCuDQPSize     ()         { return m_uiMinCuDQPSize; }
 
-#if DLT_DIFF_CODING_IN_PPS
+#if H_3D
   Void      setDLT              ( TComDLT* pcDLT ) { m_pcDLT = pcDLT; }
   TComDLT*  getDLT              ()                 { return m_pcDLT; }
@@ -2201,7 +2029,5 @@
 // Additional slice header syntax elements 
   Bool       m_pocResetFlag; 
-#if H_MV_6_RALS_O0149_11
   Bool       m_crossLayerBlaFlag;
-#endif
   Bool       m_discardableFlag;
   Bool       m_interLayerPredEnabledFlag;
@@ -2214,12 +2040,8 @@
 #endif
 #if H_3D_ARP
-#if SHARP_ARP_REF_CHECK_F0105
   Bool m_arpRefPicAvailable[2][MAX_NUM_LAYERS];
-#endif
   TComList<TComPic*> * m_pBaseViewRefPicList[MAX_NUM_LAYERS];
   UInt                 m_nARPStepNum; 
-#if QC_MTK_INTERVIEW_ARP_F0123_F0108
   Int         m_aiFirstTRefIdx    [2]; 
-#endif
 #endif
 #if H_3D_IC
@@ -2308,9 +2130,5 @@
 #if H_3D_ARP
   Void      setBaseViewRefPicList( TComList<TComPic*> *pListPic, Int iViewIdx )      { m_pBaseViewRefPicList[iViewIdx] = pListPic;                   }
-#if SHARP_ARP_REF_CHECK_F0105
   Void      setARPStepNum( TComPicLists*ivPicLists );
-#else
-  Void      setARPStepNum();                                 
-#endif
   TComPic*  getBaseViewRefPic    ( UInt uiPOC , Int iViewIdx )                       { return xGetRefPic( *m_pBaseViewRefPicList[iViewIdx], uiPOC ); }
   UInt      getARPStepNum( )                                                         { return m_nARPStepNum;                                         }  
@@ -2513,9 +2331,7 @@
   Int       getAlterRefIdx          ( RefPicList e )        { return  m_aiAlterRefIdx[e];     }
 #endif
-#if QC_MTK_INTERVIEW_ARP_F0123_F0108
+#if H_3D_ARP
   Int       getFirstTRefIdx        ( RefPicList e )                { return  m_aiFirstTRefIdx[e];     }
   Void      setFirstTRefIdx        ( RefPicList e, Int i )         { m_aiFirstTRefIdx[e]    = i;      }
-#endif
-#if SHARP_ARP_REF_CHECK_F0105
   Bool      getArpRefPicAvailable( RefPicList e, Int viewIdx) {return m_arpRefPicAvailable[e][getVPS()->getLayerIdInNuh(viewIdx, 0)]; }
 #endif
@@ -2541,5 +2357,4 @@
 // Additional slice header syntax elements
 
-#if H_MV_6_RALS_O0149_11
   Void setCrossLayerBlaFlag( Bool flag ) { m_crossLayerBlaFlag = flag; } 
   Bool getCrossLayerBlaFlag(  ) { return m_crossLayerBlaFlag; } 
@@ -2552,20 +2367,19 @@
     }
   }
-#endif
 
   Void setPocResetFlag( Bool flag ) { m_pocResetFlag = flag; } 
   Bool getPocResetFlag(  ) { return m_pocResetFlag; } 
 
-Void setDiscardableFlag( Bool flag ) { m_discardableFlag = flag; } 
-Bool getDiscardableFlag(  ) { return m_discardableFlag; } 
-
-Void setInterLayerPredEnabledFlag( Bool flag ) { m_interLayerPredEnabledFlag = flag; } 
-Bool getInterLayerPredEnabledFlag(  ) { return m_interLayerPredEnabledFlag; } 
-
-Void setNumInterLayerRefPicsMinus1( Int  val ) { m_numInterLayerRefPicsMinus1 = val; } 
-Int  getNumInterLayerRefPicsMinus1(  ) { return m_numInterLayerRefPicsMinus1; } 
-
-Void setInterLayerPredLayerIdc( Int i, Int  val ) { m_interLayerPredLayerIdc[i] = val; } 
-Int  getInterLayerPredLayerIdc( Int i ) { return m_interLayerPredLayerIdc[i]; } 
+  Void setDiscardableFlag( Bool flag ) { m_discardableFlag = flag; } 
+  Bool getDiscardableFlag(  ) { return m_discardableFlag; } 
+
+  Void setInterLayerPredEnabledFlag( Bool flag ) { m_interLayerPredEnabledFlag = flag; } 
+  Bool getInterLayerPredEnabledFlag(  ) { return m_interLayerPredEnabledFlag; } 
+
+  Void setNumInterLayerRefPicsMinus1( Int  val ) { m_numInterLayerRefPicsMinus1 = val; } 
+  Int  getNumInterLayerRefPicsMinus1(  ) { return m_numInterLayerRefPicsMinus1; } 
+
+  Void setInterLayerPredLayerIdc( Int i, Int  val ) { m_interLayerPredLayerIdc[i] = val; } 
+  Int  getInterLayerPredLayerIdc( Int i ) { return m_interLayerPredLayerIdc[i]; } 
 
   // Additional variables derived in slice header semantics 
@@ -2573,9 +2387,7 @@
   Int  getInterLayerPredLayerIdcLen    ( ) { return gCeilLog2(  getVPS()->getNumDirectRefLayers( getLayerId() )); }
 
-#if H_MV_6_ILDDS_ILREFPICS_27_34
   Int  getRefLayerPicFlag( Int i ); 
   Int  getRefLayerPicIdc ( Int j ); 
   Int  getNumRefLayerPics( ); 
-#endif
 
   Int  getNumActiveRefLayerPics( );
Index: trunk/source/Lib/TLibCommon/TComWedgelet.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComWedgelet.h	(revision 759)
+++ trunk/source/Lib/TLibCommon/TComWedgelet.h	(revision 773)
@@ -50,23 +50,10 @@
 enum DIM_IDX
 {
-#if SEC_DMM3_RBC_F0147
   DMM1_IDX = 0,
   DMM4_IDX = 1,
-#else
-  DMM1_IDX = 0,
-  DMM3_IDX = 1,
-  DMM4_IDX = 2,
-  RBC_IDX  = 3
-#endif
 };
 
-#if SEC_DMM3_RBC_F0147
 #define DMM_NUM_TYPE   2
 #define DIM_NUM_TYPE   (DMM_NUM_TYPE)
-#else
-#define DMM_NUM_TYPE   3
-#define RBC_NUM_TYPE   1
-#define DIM_NUM_TYPE   (DMM_NUM_TYPE+RBC_NUM_TYPE)
-#endif
 #define DIM_NO_IDX     MAX_UINT
 
@@ -76,16 +63,7 @@
 #endif
 
-#if H_3D_DIM_RBC
-#define RBC_THRESHOLD              20
-#define RBC_MAX_EDGE_NUM_PER_4x4   8
-#define RBC_MAX_DISTANCE           255
-#endif
-
 #if H_3D_DIM_DMM
 #define DMM_NO_WEDGEINDEX       MAX_UINT
 #define DMM_NUM_WEDGE_REFINES   8
-#if !SEC_DMM3_RBC_F0147
-#define DMM3_SIMPLIFY_TR        1
-#endif
 
 enum WedgeResolution
Index: trunk/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- trunk/source/Lib/TLibCommon/TypeDef.h	(revision 759)
+++ trunk/source/Lib/TLibCommon/TypeDef.h	(revision 773)
@@ -69,4 +69,5 @@
 ///////////////////////////////////   MAJOR DEFINES   ///////////////////////////////////  
 /////////////////////////////////////////////////////////////////////////////////////////
+
 #if H_MV
 #define H_MV_ENC_DEC_TRAC                 1  //< CU/PU level tracking
@@ -98,4 +99,7 @@
                                               // MTK_TEXTURE_MRGCAND_BUGFIX_E0182  Bug fix for TEXTURE MERGING CANDIDATE     , JCT3V-E0182
 #define H_3D_ARP                          1   // Advanced residual prediction (ARP), JCT3V-D0177
+                                              // QC_MTK_INTERVIEW_ARP_F0123_F0108 JCT3V-F0123; JCT3V-F0108
+                                              // SHARP_ARP_REF_CHECK_F0105        ARP reference picture selection and DPB check
+                                              // LGE_ARP_CTX_F0161                JCT3V-F0161
 #define H_3D_IC                           1   // Illumination Compensation, JCT3V-B0045, JCT3V-C0046, JCT3V-D0060
                                               // Unifying rounding offset, for IC part, JCT3V-D0135
@@ -103,4 +107,6 @@
                                               // SHARP_ILLUCOMP_REFINE_E0046
                                               // MTK_CLIPPING_ALIGN_IC_E0168       // To support simplify bi-prediction PU with identical motion checking, JCT3V-E0168
+                                              // LGE_IC_CTX_F0160 //JCT3V-F0160
+                                              // SEC_ONLY_TEXTURE_IC_F0151
 
 #if H_3D_NBDV
@@ -111,5 +117,4 @@
                                               // NBDV_DEFAULT_VIEWIDX_BUGFIX Bug fix for invalid default view index for NBDV
                                               // NTT_DoNBDV_VECTOR_CLIP_E0141 disparity vector clipping in DoNBDV, JCT3V-E0141 and JCT3V-E0209
-
 #endif
 
@@ -124,4 +129,9 @@
                                               // NTT_VSP_DC_BUGFIX_E0208 bugfix for sub-PU based DC in VSP, JCT3V-E0208
                                               // NTT_VSP_COMMON_E0207_E0208 common part of JCT3V-E0207 and JCT3V-E0208
+                                              // MTK_F0109_LG_F0120_VSP_BLOCK MTK_LG_SIMPLIFY_VSP_BLOCK_PARTITION_F0109_F0120  
+                                              // SHARP_VSP_BLOCK_IN_AMP_F0102 VSP partitioning for AMP
+                                              // MTK_VSP_SIMPLIFICATION_F0111 1. Inherited VSP also use NBDV of current CU, 2. VSP cannot be inherited from above LCU rowss
+                                              // LGE_SHARP_VSP_INHERIT_F0104 
+
 #define H_3D_IV_MERGE                     1   // Inter-view motion merge candidate
                                               // HHI_INTER_VIEW_MOTION_PRED 
@@ -133,6 +143,6 @@
                                               // TEXTURE MERGING CANDIDATE     , JCT3V-C0137
                                               // QC_INRIA_MTK_MRG_E0126 
-
-
+                                              // ETRIKHU_MERGE_REUSE_F0093 QC_DEPTH_IV_MRG_F0125, JCT3V-F0125: Depth oriented Inter-view MV candidate
+                                              // EC_MPI_ENABLING_MERGE_F0150, MPI flag in VPS and enabling in Merge mode
 #define H_3D_TMVP                         1   // QC_TMVP_C0047 
                                               // Sony_M23639
@@ -159,8 +169,14 @@
                                               // LGE_SDC_REMOVE_DC_E0158 Removal of DC mode from SDC
                                               // LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX 1   Removal of overlap between DMM3 and DMM1
+                                              // LGE_PRED_RES_CODING_DLT_DOMAIN_F0159 JCT3V-F0159
+                                              // HHI_DIM_PREDSAMP_FIX_F0171
+                                              // SEC_DMM3_RBC_F0147 Removal of DMM3 and RBC from DMMs
+                                              // QC_DIM_DELTADC_UNIFY_F0132 Unify delta DC coding in depth intra modes
 
 #define H_3D_INTER_SDC                    1   // INTER SDC, Inter simplified depth coding
                                               // LGE_INTER_SDC_E0156  Enable inter SDC for depth coding
+#define H_3D_SPIVMP                       1   // H_3D_SPIVMP    // JCT3V-F0110: Sub-PU level inter-view motion prediction
 #define H_3D_FCO                          0   // Flexible coding order for 3D
+
 
 
@@ -175,9 +191,4 @@
 #endif
 
-#define CAM_HLS_F0136_F0045_F0082         1   // JCT3V-F0136/F0045: view order index based camera parameter signaling 
-                                              // JCT3V-F0082: the cp_in_slice_segment_layer_flag to be view specific and used as a condition of the presence of slice header level camera parameters
-#define CAM_HLS_F0044                     1   // JCT3V-F0044: move camera parameter from slice header extension to slice header
-
-
 // Rate Control
 #define KWU_FIX_URQ                       1
@@ -203,5 +214,5 @@
 #endif
 
-////   ****** neighbouring block-based disparity vector  *********
+////   ****** NEIGHBOURING BLOCK-BASED DISPARITY VECTOR  *********
 #if H_3D_NBDV
 #define DVFROM_LEFT                       0
@@ -222,9 +233,4 @@
 
 #if H_3D_DIM_DLT
-#define DLT_DIFF_CODING_IN_PPS            1   // moving DLT syntax elements from VPS to PPS and differential coding of DLT values
-                                              // JCT3V-F0131, JCT3V-F0139
-#if DLT_DIFF_CODING_IN_PPS
-#define Log2( n ) ( log((double)n) / log(2.0) )
-#endif
 #define H_3D_DELTA_DLT                    1
 #endif
@@ -258,101 +264,23 @@
 #endif
 
-/////////////////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////   HTM-9.2 Integrations //////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////
-
-// !!! PLEASE PUT MACROS RELATED TO HTM-9.2 INTEGRATIONS HERE !!!
-// !!! PLEASE PUT MACROS RELATED TO HTM-9.2 INTEGRATIONS HERE !!!
-// !!! PLEASE PUT MACROS RELATED TO HTM-9.2 INTEGRATIONS HERE !!!
-// !!! PLEASE PUT MACROS RELATED TO HTM-9.2 INTEGRATIONS HERE !!!
-// !!! PLEASE PUT MACROS RELATED TO HTM-9.2 INTEGRATIONS HERE !!!
-
-/////////////////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////   HTM-9.1 Integrations //////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////
-
-#define H_MV_FIX_TRACE_FILE                     1  // Fix linux compilation error related const char conversion 
-
-#define H_MV_LAYER_WISE_STARTUP                 1  // Basic version of layer wise startup.
-#define H_MV_FIX_SKIP_PICTURES                  1  // Fix related to skipping pictures. 
-#define H_MV_6_HRD_O0164_15                     1  // (HRD/O0164/Multilayer HRD) #15 Decision: Adopt, modified as follows: It was suggested to constrain the stalling based on the relative cpb removal times, which must be in decoding order. The "du_based_bpb_sync_flag" is not needed, in view of this. SEI in the highest layer of the layer set or (inclusive "or") VPS VUI is used to carry the parameters (at encoder discretion). SEI in higher layer and SEI in VUI do not need to repeat information available in some lower layer. Shall be after APS SEI and buffering period SEI and before all other SEI of all layers except other HRD related SEI.
-#define H_MV_6_HRD_O0217_13                     1  // (HRD/O0217/Sub-DPB based DPB operations) #13 Decision: Adopt ?Specify a separate DPB capacity for each layer ?no sharing of capacity across layers ?each layer has its own parameters (max pictures, max latency, max reordering). This proposal would specify distinct parameters for each "output layer set" and to change the definition of an operation point to be specific to an output layer set instead of a 'layer set". Decision: Adopted this aspect as well.
-#define H_MV_6_SHVC_O0098_36                    1  // (SHVC/O0098/Scaled ref layer offset) #36 Modify signalling of scaled reference layer offsets to allow signalling of any lower layer, rather than just a direct reference layer, in order to enable alignment of auxiliary pictures. In further JCT-VC and JCT-3V discussion, it was also agreed to use the same offset signalling for MV-HEVC as well as SHVC
-#define H_MV_6_GEN_0153_28                      1  //(Gen/O0153/output highest layer) #28 Add a flag in the VPS to indicate if startup process should output the highest available layer if the target output layer is not available.
-#define H_MV_6_PS_0109_25                       1  //XXX(PS/O0109/default_one_target_output_layer_idc) #25 To change default_one_target_output_layer_flag to a two-bit default_one_target_output_layer_idc, and reserve the values 2 and 3
-#define H_MV_6_O0226_37                         1  //(VUI/O0226/Mod tile WPP) #37 Modifications to the VUI indicators of tile and WPP alignment related syntax elements, from the r1.
-#define H_MV_6_RALS_O0149_11                    1  //XXX (RALS/O0149/Prop2): #11 Proposal: A new slice_reserved_flag is taken into use to indicate if a base-layer IDR picture initiates the layer-wise start-up process. Decision: Adopt (the bit should not be required to be present; if present should be the bit after the discardable_flag, and discardable_flag should be the first one of the three, and the poc reset flag is not required to be present).
-#define H_MV_6_PSEM_O0142_3                     1  // (PSEM/O0142/Conditional extension syntax) #3 Adopt JCTVC-O0142 (as a structure to be used to switch whatever extensions we define in SPS, not necessarily committing to having these extensions be separate for each extension, but the current plan unless decided otherwise is to use one flag for range extensions syntax presence and one flag for SHVC+MV-HEVC extension syntax presence) 
-#define H_MV_6_FIX_GET_VIEW_ID                  1  // Fix get view id
-#define H_MV_6_LAYER_ID_32                      1  // (Gen/O0137,O0200,O0223,Layer id) #32 Add (editorial equivalent of) "The value of nuh_layer_id shall be in the range of 0 to 62. The value of 63 for nuh_layer_id is reserved for future use by ITU-T | ISO/IEC. Decoders shall ignore all data that follow the value 63 for nuh_layer_id in a NAL unit." and specify that vps_max_layers_minus1 shall not be equal to 63, but decoders shall allow that value to appear in the bitstream. Specify that the value 63 is interpreted the same as the value 62 (e.g., MaxLayersMinus1 = Min( 62, vps_max_layers_minus1) and subsequently refer to MaxLayersMinus1 instead of vps_max_layers_minus1)
-#define H_MV_6_PS_O0118_33                      1  // (PS/O0118/visual signal info in vui per layer) #33 Add visual signal information (video_format, video_full_range_flag, colour_primaries, transfer_characteristics, matrix_coeffs) per layer to the VPS VUI, from v2 version of JCTVC-O0118.
-#define H_MV_6_POC_31_35_38                     1  //XXX  Various related to POC
-                                                   // (Misc/O0062/POC LSB present) (SH changes)
-                                                   // (POC/O0117/Modify PicOrderCntVal of prevTid0Pic) #35 Modification of the PicOrderCntVal of prevTid0Pic and modification to the decoding process for reference picture set, to address problems found for cross-layer POC alignment.
-                                                   // (POC/O0211/Fix ambiguity) #38 Modify POC derivation to correct an ambiguity in the spec.
-#define H_MV_6_MISC_O0062_31                    1  // (Misc/O0062/POC LSB present) (without SH changes ) #31 The proposal's "option 3" is to add a flag in the VPS for each EL to control whether these LSBs are present or not (for IDR pictures), and when not present, the LSBs are inferred to be equal to 0. Decision: Adopted (as described herein).
-#define H_MV_6_ILDDS_ILREFPICS_27_34            1  // Various inter layer reference picture derivation 
-                                                   // (ILDSD/O0225/max_tid_il_ref_pics RPL const.) #27 Change derivation of NumActiveRefLayerPics to consider max_tid_il_ref_pics.
-                                                   // (ILDSD/O0120/sub_layers_vps_max_minus1 RPL const) #34 Modify inter-layer reference picture list default construction to incorporate max temporal sub-layers per layer syntax elements in VPS extension, from r2 version of JCTVC-O0120
-#define H_MV_6_ILDDS_O0225_30                   1  // (ILDSD/O0225/signal max_tid_il_ref_pics per layer ) #30 2nd proposal of JCTVC-O0225 regarding signalling of max_tid_il_ref_pics per layer, based upon relation to SCE2 on single loop decoding. Decision: Adopted. 
-#define H_MV_6_ILDSD_O0120_26                   1  // (ILDSD/O0120/sub_layers_vps_max_minus1) #26 Add syntax elements to signal max temporal sub-layers for each layer in the VPS, with a gating flag, from JCTVC- option 2.
-#define H_MV_6_PS_O0223_29                      1  // (PS/O0223/Cross layer alignment type) #29 Add a flag in VPS VUI to indicate cross layer pic type alignment.  Move cross_layer_irap_aligned_flag to VPS VUI and make presence condition on added flag
-#define H_MV_6_PS_0092_17                       1  // (PS/O0092/Sharing SPS PPS) #17 Restrict sharing of SPS and PPS across layers to avoid creating problems during sub-bitstream extraction, based on modification of proposals in JCTVC-O0059 and JCTVC-O0092, reflected in the v2 version of O0092.
-#define H_MV_6_PS_REP_FORM_18_19_20             1  //  Various Rep format
-                                                   // (PS/O0096/rep format syntax element length ) #20 Modification of length to 8 bit as decided later in trac. 
-                                                   // (PS/O0179/Rep. Format) #18 Add flag in rep_format( ) syntax structure to control sending of chroma and bit depth related parameters, as proposed in the v2 version of JCTVC-O0179. 
-                                                   // (PS/O0096/rep format) #20 Modify the SPS syntax for layers with nuh_layer_id > 0 to signal a reference to a rep_format index in the VPS, rather than signalling explicit representation format data in the SPS, from the v2 version of JCTVC-O0096. 
-                                                   // (PS/FIX/N0092/Rep. Format) #19 Inferences. 
-#define H_MV_6_PS_O0096_21                      1  // (PS/O0096/direct_dependency_type gating flag) #21 Add a gating flag in VPS extension to condition the presence of direct dependency type, with a default type signalled, from JCTVC-O0096 
-#define H_MV_6_PS_O0109_22                      1  // (PS/O0109/view_id_len) #22 Modify the VPS extension syntax and semantics to replace view_id_len_minus1 with view_id_len, always signal that syntax element, add a constraint that (1<<view_id_len) >= NumViews, and modify view_id_val semantics to infer value of 0 when not present, from discussion of JCTVC-O0109 
-#define H_MV_6_PS_O0109_23                      1  // (PS/O0109/profile_ref_minus1 constraint) #23 Modify the semantics of profile_ref_minus1[ i ] to replace shall be less than i?with shall be less than or equal to i? from discussion of JCTVC-O0109 
-#define H_MV_6_PS_O0109_24                      1  // (PS/O0109/vps_vui_present_flag move) #24 Move the vps_vui_present_flag to precede vps_vui_offset, and make vps_vui_offset conditional on that flag, from JCTVC-O0109
-/////////////////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////   HTM-9.0 Integrations //////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////
-
 #if H_3D
-
-#define FIX_MISSING_MACRO_R690                  1 // Missing macro in integration to revision 690
-
-#define SEC_MPI_ENABLING_MERGE_F0150            1 // MPI flag in VPS and enabling in Merge mode
-#define ETRIKHU_MERGE_REUSE_F0093               1 // Reuse HEVC merge candidate list construction for base candidates, JCT3V-F0093 
-
-#if H_3D_ARP
-#define QC_MTK_INTERVIEW_ARP_F0123_F0108        1 //JCT3V-F0123; JCT3V-F0108
-#define SHARP_ARP_REF_CHECK_F0105               1 // ARP reference picture selection and DPB check
-#define LGE_ARP_CTX_F0161                       1 //JCT3V-F0161
-#endif
-
-#if H_3D_IV_MERGE
-#define QC_DEPTH_IV_MRG_F0125                   1 // JCT3V-F0125: Depth oriented Inter-view MV candidate
-#define MTK_SPIVMP_F0110                        1 // JCT3V-F0110: Sub-PU level inter-view motion prediction
-#define MTK_F0110_FIX                           1 // Disable Sub-PU IVMP in Depth, fix some delete problems
-#define BUGFIX_F0093                            1 // bug fix for F0093 for depth IvMC pruning
-#define BUGFIX_2_F0093                          1 // bug fix for VSP inheritance
-#endif
-
-#if H_3D_VSP
-#define MTK_F0109_LG_F0120_VSP_BLOCK            1 // MTK_LG_SIMPLIFY_VSP_BLOCK_PARTITION_F0109_F0120  
-#define SHARP_VSP_BLOCK_IN_AMP_F0102            1 // VSP partitioning for AMP
-#define MTK_VSP_SIMPLIFICATION_F0111            1 // 1. Inherited VSP also use NBDV of current CU, 2. VSP cannot be inherited from above LCU rowss
-#define LGE_SHARP_VSP_INHERIT_F0104             1
-#endif
-
-#define LGE_BUGFIX_F0158                        1 //JCT3V-F0158
-#define LGE_IC_CTX_F0160                        1 //JCT3V-F0160
-#define SEC_ONLY_TEXTURE_IC_F0151               1
-
-#if H_3D_DIM
-#define SEC_DMM3_RBC_F0147                      1 // Removal of DMM3 and RBC from DMMs
-#if !SEC_DMM3_RBC_F0147
-#define H_3D_DIM_RBC                            1 // Region Boundary Chain mode
-#endif
-#define QC_DIM_DELTADC_UNIFY_F0132              1 // Unify delta DC coding in depth intra modes
-#define HHI_DIM_PREDSAMP_FIX_F0171              1
-#define LGE_PRED_RES_CODING_DLT_DOMAIN_F0159    1 //JCT3V-F0159
-#endif
-#endif
-
+#define PPS_FIX_DEPTH                           1
+#endif
+
+
+/////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////   HTM-10.0 Integrations //////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////
+
+// !!! PLEASE PUT MACROS RELATED TO HTM-10.0 INTEGRATIONS HERE !!!
+// !!! PLEASE PUT MACROS RELATED TO HTM-10.0 INTEGRATIONS HERE !!!
+// !!! PLEASE PUT MACROS RELATED TO HTM-10.0 INTEGRATIONS HERE !!!
+// !!! PLEASE PUT MACROS RELATED TO HTM-10.0 INTEGRATIONS HERE !!!
+// !!! PLEASE PUT MACROS RELATED TO HTM-10.0 INTEGRATIONS HERE !!!
+// !!! PLEASE PUT MACROS RELATED TO HTM-10.0 INTEGRATIONS HERE !!!
+// !!! PLEASE PUT MACROS RELATED TO HTM-10.0 INTEGRATIONS HERE !!!
+// !!! PLEASE PUT MACROS RELATED TO HTM-10.0 INTEGRATIONS HERE !!!
+// !!! PLEASE PUT MACROS RELATED TO HTM-10.0 INTEGRATIONS HERE !!!
+// !!! PLEASE PUT MACROS RELATED TO HTM-10.0 INTEGRATIONS HERE !!!
 
 /////////////////////////////////////////////////////////////////////////////////////////
@@ -370,9 +298,5 @@
 #define MAX_VPS_OP_SETS_PLUS1                     1024
 #if H_MV
-#if H_MV_6_LAYER_ID_32
 #define MAX_VPS_NUH_LAYER_ID_PLUS1  63
-#else
-#define MAX_VPS_NUH_LAYER_ID_PLUS1  64
-#endif
 #define MAX_NUM_SCALABILITY_TYPES   16
 #define ENC_CFG_CONSOUT_SPACE       29           
@@ -398,25 +322,16 @@
 #define MAX_CPB_CNT                     32  ///< Upper bound of (cpb_cnt_minus1 + 1)
 #if H_MV
-#if H_MV_6_LAYER_ID_32
 #define MAX_NUM_LAYER_IDS               63
 #define MAX_NUM_LAYERS                  63
-#else
-#define MAX_NUM_LAYER_IDS               64
-#define MAX_NUM_LAYERS                  64
-#endif
 #define MAX_VPS_PROFILE_TIER_LEVEL      64
 #define MAX_VPS_ADD_OUTPUT_LAYER_SETS   1024
 #define MAX_VPS_OUTPUTLAYER_SETS        ( MAX_VPS_ADD_OUTPUT_LAYER_SETS + MAX_VPS_OP_SETS_PLUS1 )
-#if H_MV_6_PS_O0118_33
 #define  MAX_NUM_VIDEO_SIGNAL_INFO      16
-#endif
-#if H_MV_6_SHVC_O0098_36
 #define MAX_NUM_SCALED_REF_LAYERS       MAX_NUM_LAYERS-1
-#endif
-#if H_MV_6_HRD_O0164_15
 #define MAX_NUM_BSP_HRD_PARAMETERS      100 ///< Maximum value is actually not specified
 #define MAX_NUM_BITSTREAM_PARTITIONS    100 ///< Maximum value is actually not specified 
 #define MAX_NUM_BSP_SCHED_COMBINATION   100 ///< Maximum value is actually not specified 
-#endif
+#else
+#define MAX_NUM_LAYER_IDS                64
 #endif
 
@@ -896,5 +811,4 @@
 #if H_MV
 
-#if H_MV_6_PSEM_O0142_3
   enum PsExtensionTypes
   {
@@ -906,5 +820,4 @@
     PS_EX_T_MAX_NUM = 8
   };
-#endif
 
 /// scalability types
@@ -937,5 +850,5 @@
   };
 
-
-#endif
-#endif
+#define Log2( n ) ( log((double)n) / log(2.0) ) // Ed.(GT): This is very very bad and should be fixed to used integer arithmetics ( see gCeilLog2 ) moreover it should not be defined in the tool macro section! 
+#endif
+#endif
Index: trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 759)
+++ trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 773)
@@ -215,5 +215,5 @@
 }
 
-#if DLT_DIFF_CODING_IN_PPS
+#if H_3D
 Void TDecCavlc::parsePPS(TComPPS* pcPPS, TComVPS* pcVPS )
 #else
@@ -368,5 +368,5 @@
   if (uiCode)
   {
-#if DLT_DIFF_CODING_IN_PPS
+#if H_3D
     parsePPSExtension( pcPPS, pcVPS );
     READ_FLAG( uiCode, "pps_extension2_flag");
@@ -378,13 +378,14 @@
         READ_FLAG( uiCode, "pps_extension_data_flag");
       }
-#if DLT_DIFF_CODING_IN_PPS
-    }
-#endif
-  }
-}
-
-#if DLT_DIFF_CODING_IN_PPS
+#if H_3D
+    }
+#endif
+  }
+}
+
+#if H_3D
 Void TDecCavlc::parsePPSExtension( TComPPS* pcPPS, TComVPS* pcVPS )
 {
+  //Ed.(GT): pcVPS should not be used here. Needs to be fixed. 
   UInt uiCode = 0; 
   TComDLT* pcDLT = new TComDLT;
@@ -556,8 +557,7 @@
 
   READ_FLAG(     uiCode, "video_signal_type_present_flag");           pcVUI->setVideoSignalTypePresentFlag(uiCode);
-#if H_MV_6_PS_O0118_33
+#if H_MV
   assert( pcSPS->getLayerId() == 0 || !pcVUI->getVideoSignalTypePresentFlag() ); 
 #endif
-
   if (pcVUI->getVideoSignalTypePresentFlag())
   {
@@ -746,5 +746,4 @@
   {
     READ_FLAG( uiCode, "update_rep_format_flag" );               pcSPS->setUpdateRepFormatFlag( uiCode == 1 );
-#if H_MV_6_PS_REP_FORM_18_19_20
     if ( pcSPS->getUpdateRepFormatFlag() )
     { 
@@ -754,10 +753,4 @@
   else
   {
-#else
-  }
-  
-  if ( pcSPS->getUpdateRepFormatFlag() )
-  { 
-#endif
 #endif
   READ_UVLC(     uiCode, "chroma_format_idc" );                  pcSPS->setChromaFormatIdc( uiCode );
@@ -795,9 +788,5 @@
 
 #if H_MV
-#if H_MV_6_PS_REP_FORM_18_19_20
   if ( pcSPS->getLayerId() == 0 )
-#else
-  if ( pcSPS->getUpdateRepFormatFlag() )
-#endif
   { 
 #endif
@@ -948,23 +937,12 @@
 
   READ_FLAG( uiCode, "sps_extension_flag");
-#if H_MV_6_PSEM_O0142_3
+#if H_MV
   pcSPS->setSpsExtensionFlag( uiCode ); 
-#endif
   if (pcSPS->getSpsExtensionFlag( ) )
-  {
-#if !H_MV_6_PSEM_O0142_3
-#if H_MV
-    parseSPSExtension( pcSPS ); 
-    READ_FLAG( uiCode, "sps_extension2_flag");
-    if ( uiCode )
-    {
-#if H_3D
-      parseSPSExtension2( pcSPS, viewIndex, depthFlag ); 
-      READ_FLAG( uiCode, "sps_extension3_flag");
-      if ( uiCode )
-      {
-#endif
-#endif
-#else    
+#else
+  if (uiCode)
+#endif
+  {
+#if H_MV
     for (Int i = 0; i < PS_EX_T_MAX_NUM; i++)
     {
@@ -996,13 +974,6 @@
           READ_FLAG( uiCode, "sps_extension_data_flag");
         }
-#if H_MV_6_PSEM_O0142_3
-    }
-#else
-#if H_MV      
-#if H_3D
-      }
-#endif
-    }
-#endif
+#if H_MV
+    }
 #endif
   }
@@ -1014,7 +985,4 @@
   UInt uiCode; 
   READ_FLAG( uiCode, "inter_view_mv_vert_constraint_flag" );    pcSPS->setInterViewMvVertConstraintFlag(uiCode == 1 ? true : false);
-#if !H_MV_6_SHVC_O0098_36
-  READ_UVLC( uiCode, "sps_shvc_reserved_zero_idc" ); 
-#else
   
   READ_UVLC( uiCode, "num_scaled_ref_layer_offsets" ); pcSPS->setNumScaledRefLayerOffsets( uiCode );
@@ -1031,5 +999,4 @@
     READ_SVLC( iCode, "scaled_ref_layer_bottom_offset" ); pcSPS->setScaledRefLayerBottomOffset( j, iCode );
   }
-#endif  
 }
 
@@ -1048,26 +1015,4 @@
   }
 #endif
-
-#if !CAM_HLS_F0136_F0045_F0082
-  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 ); 
-#endif
 }
 #endif
@@ -1081,9 +1026,5 @@
   READ_CODE( 2,  uiCode,  "vps_reserved_three_2bits" );           assert(uiCode == 3);
 #if H_MV
-#if H_MV_6_LAYER_ID_32
   READ_CODE( 6,  uiCode,  "vps_max_layers_minus1" );              pcVPS->setMaxLayersMinus1( std::min( uiCode, (UInt) ( MAX_NUM_LAYER_IDS-1) )  );
-#else
-  READ_CODE( 6,  uiCode,  "vps_max_layers_minus1" );              pcVPS->setMaxLayersMinus1( uiCode  );
-#endif
 #else
   READ_CODE( 6,  uiCode,  "vps_reserved_zero_6bits" );            assert(uiCode == 0);
@@ -1140,5 +1081,5 @@
     }
   }
-#if H_MV_6_HRD_O0217_13
+#if H_MV
   pcVPS->deriveLayerSetLayerIdList(); 
 #endif
@@ -1181,7 +1122,5 @@
 #if H_3D
       m_pcBitstream->readOutTrailingBits();
-#if CAM_HLS_F0136_F0045_F0082
       pcVPS->createCamPars(pcVPS->getNumViews());
-#endif
       parseVPSExtension2( pcVPS );   
       READ_FLAG( uiCode,  "vps_extension3_flag" );
@@ -1209,12 +1148,8 @@
   UInt uiCode; 
   READ_FLAG( uiCode, "avc_base_layer_flag" );                     pcVPS->setAvcBaseLayerFlag( uiCode == 1 ? true : false );
-#if H_MV_6_PS_O0109_24
   READ_FLAG( uiCode, "vps_vui_present_flag" );                    pcVPS->setVpsVuiPresentFlag( uiCode == 1 );  if ( pcVPS->getVpsVuiPresentFlag() )
   {  
-#endif
   READ_CODE( 16, uiCode, "vps_vui_offset" );                      pcVPS->setVpsVuiOffset( uiCode );
-#if H_MV_6_PS_O0109_24
-  }
-#endif
+  }
 
   READ_FLAG( uiCode, "splitting_flag" );                          pcVPS->setSplittingFlag( uiCode == 1 ? true : false );
@@ -1263,5 +1198,4 @@
   }
 
-#if H_MV_6_PS_O0109_22
   READ_CODE( 4, uiCode, "view_id_len" ); pcVPS->setViewIdLen( uiCode );
 
@@ -1280,17 +1214,4 @@
     }
   }
-#else
-  // GT spec says: trac #39
-  // if ( pcVPS->getNumViews() > 1 )  
-  //   However, this is a bug in the text since, view_id_len_minus1 is needed to parse view_id_val. 
-  {
-    READ_CODE( 4, uiCode, "view_id_len_minus1" ); pcVPS->setViewIdLenMinus1( uiCode );
-  }
-
-  for( Int i = 0; i < pcVPS->getNumViews(); i++ )
-  {
-    READ_CODE( pcVPS->getViewIdLenMinus1( ) + 1, uiCode, "view_id_val[i]" ); pcVPS->setViewIdVal( i, uiCode );
-  }
-#endif
 
 
@@ -1302,8 +1223,5 @@
     }
   }
-#if H_MV_6_MISC_O0062_31
   pcVPS->setRefLayers(); 
-#endif
-#if H_MV_6_ILDSD_O0120_26
   READ_FLAG( uiCode, "vps_sub_layers_max_minus1_present_flag" ); pcVPS->setVpsSubLayersMaxMinus1PresentFlag( uiCode == 1 );
   if ( pcVPS->getVpsSubLayersMaxMinus1PresentFlag() )
@@ -1323,5 +1241,4 @@
     }
   }
-#endif
   READ_FLAG( uiCode, "max_tid_ref_present_flag" ); pcVPS->setMaxTidRefPresentFlag( uiCode == 1 );
 
@@ -1330,5 +1247,4 @@
     for( Int i = 0; i < pcVPS->getMaxLayersMinus1(); i++ )
     {
-#if H_MV_6_ILDDS_O0225_30
       for( Int j = i + 1; j <= pcVPS->getMaxLayersMinus1(); j++ )
       {
@@ -1338,7 +1254,4 @@
         }
       }
-#else
-      READ_CODE( 3, uiCode,       "max_tid_il_ref_pics_plus1[i]" );      pcVPS->setMaxTidIlRefPicPlus1( i , uiCode ); 
-#endif
     }
   }
@@ -1354,7 +1267,5 @@
     {
       READ_CODE( 6, uiCode, "profile_ref_minus1[i]" ); pcVPS->setProfileRefMinus1( i, uiCode );
-#if H_MV_6_PS_O0109_23
       pcVPS->checkProfileRefMinus1( i );      
-#endif
     }
     parsePTL ( pcVPS->getPTL( i ), pcVPS->getVpsProfilePresentFlag( i ), pcVPS->getMaxTLayers()-1);
@@ -1379,16 +1290,10 @@
   if( numOutputLayerSets > 1)
   {
-#if H_MV_6_PS_0109_25
     READ_CODE( 2, uiCode, "default_one_target_output_layer_idc" ); pcVPS->setDefaultOneTargetOutputLayerIdc( uiCode );
     pcVPS->checkDefaultOneTargetOutputLayerIdc(); 
-#else
-    READ_FLAG( uiCode, "default_one_target_output_layer_flag" ); pcVPS->setDefaultOneTargetOutputLayerFlag(  uiCode == 1); 
-#endif
   }  
 
-#if H_MV_6_HRD_O0217_13
   pcVPS->setOutputLayerFlag(0, 0, pcVPS->inferOutputLayerFlag( 0, 0 )); 
   pcVPS->setOutputLayerSetIdxMinus1(0, -1); 
-#endif
   for( Int i = 1; i < numOutputLayerSets; i++ )
   {
@@ -1401,5 +1306,4 @@
       }        
     }
-#if H_MV_6_HRD_O0217_13
     else
     { // These inference rules would also be helpful in spec text
@@ -1410,5 +1314,4 @@
       }
     }
-#endif
 
     if ( pcVPS->getProfileLevelTierIdxLen()  > 0 )
@@ -1417,13 +1320,9 @@
     }
   }
-#if H_MV_6_GEN_0153_28
   if( pcVPS->getMaxLayersMinus1() > 0 )
   {
     READ_FLAG( uiCode, "alt_output_layer_flag" ); pcVPS->setAltOutputLayerFlag( uiCode == 1 );
   }
-#endif
-#if H_MV_6_HRD_O0217_13
   pcVPS->deriveTargetLayerIdLists(); 
-#endif
   READ_FLAG( uiCode, "rep_format_idx_present_flag" ); pcVPS->setRepFormatIdxPresentFlag( uiCode == 1 );
   if ( pcVPS->getRepFormatIdxPresentFlag() )
@@ -1434,5 +1333,4 @@
   for (Int i = 0; i <= pcVPS->getVpsNumRepFormatsMinus1(); i++ )
   { 
-#if H_MV_6_PS_REP_FORM_18_19_20
     assert( pcVPS->getRepFormat(i) == NULL ); 
     TComRepFormat* curRepFormat = new TComRepFormat(); 
@@ -1440,10 +1338,4 @@
     parseRepFormat( i, curRepFormat ,  prevRepFormat); 
     pcVPS->setRepFormat(i, curRepFormat ); 
-#else
-    assert( pcVPS->getRepFormat(i) == NULL ); 
-    TComRepFormat* repFormat = new TComRepFormat(); 
-    parseRepFormat( repFormat );
-    pcVPS->setRepFormat(i, repFormat ); 
-#endif
   }
 
@@ -1454,9 +1346,5 @@
       if( pcVPS->getVpsNumRepFormatsMinus1() > 0 )
       {
-#if H_MV_6_PS_REP_FORM_18_19_20
         READ_CODE( 8, uiCode, "vps_rep_format_idx" ); pcVPS->setVpsRepFormatIdx( i, uiCode );
-#else
-        READ_CODE( 4, uiCode, "vps_rep_format_idx" ); pcVPS->setVpsRepFormatIdx( i, uiCode );
-#endif
       }
     }
@@ -1464,5 +1352,4 @@
 
   READ_FLAG( uiCode, "max_one_active_ref_layer_flag" ); pcVPS->setMaxOneActiveRefLayerFlag ( uiCode == 1 ); 
-#if H_MV_6_MISC_O0062_31
   for( Int i = 1; i  <=  pcVPS->getMaxLayersMinus1(); i++ )
   {
@@ -1472,16 +1359,9 @@
     }
   }
-#endif
-
-#if H_MV_6_HRD_O0217_13
+
   parseDpbSize( pcVPS ); 
-#endif
-
-#if !H_MV_6_PS_O0223_29
-  READ_FLAG( uiCode, "cross_layer_irap_aligned_flag" ); pcVPS->setCrossLayerIrapAlignedFlag( uiCode == 1 );
-#endif
+
   READ_UVLC( uiCode, "direct_dep_type_len_minus2")    ; pcVPS->setDirectDepTypeLenMinus2   ( uiCode ); 
 
-#if H_MV_6_PS_O0096_21
   READ_FLAG( uiCode, "default_direct_dependency_flag" ); pcVPS->setDefaultDirectDependencyFlag( uiCode == 1 );
   if ( pcVPS->getDefaultDirectDependencyFlag( ) )
@@ -1507,21 +1387,6 @@
     }
   }  
-#else
-  for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); 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);
-      }
-    }
-  }
-#endif
 
   READ_FLAG( uiCode, "vps_shvc_reserved_zero_flag" ); 
-#if !H_MV_6_PS_O0109_24
-  READ_FLAG( uiCode, "vps_vui_present_flag" )       ; pcVPS->setVpsVuiPresentFlag( uiCode == 1 );
-#endif
 
   if( pcVPS->getVpsVuiPresentFlag() )
@@ -1532,14 +1397,7 @@
 
   pcVPS->checkVPSExtensionSyntax(); 
-#if !H_MV_6_MISC_O0062_31
-  pcVPS->setRefLayers(); 
-#endif
-}
-
-#if H_MV_6_PS_REP_FORM_18_19_20
+}
+
 Void TDecCavlc::parseRepFormat( Int i, TComRepFormat* pcRepFormat, TComRepFormat* pcPrevRepFormat )
-#else
-Void TDecCavlc::parseRepFormat( TComRepFormat* pcRepFormat )
-#endif
 {
   assert( pcRepFormat ); 
@@ -1547,5 +1405,4 @@
   UInt uiCode; 
 
-#if H_MV_6_PS_REP_FORM_18_19_20
   READ_CODE( 16, uiCode, "pic_width_vps_in_luma_samples" );  pcRepFormat->setPicWidthVpsInLumaSamples ( uiCode );
   READ_CODE( 16, uiCode, "pic_height_vps_in_luma_samples" ); pcRepFormat->setPicHeightVpsInLumaSamples( uiCode );
@@ -1556,5 +1413,4 @@
   if ( pcRepFormat->getChromaAndBitDepthVpsPresentFlag() )
   {  
-#endif
   READ_CODE( 2,  uiCode, "chroma_format_vps_idc" );          pcRepFormat->setChromaFormatVpsIdc       ( uiCode );
   if ( pcRepFormat->getChromaFormatVpsIdc() == 3 )
@@ -1562,11 +1418,6 @@
     READ_FLAG( uiCode, "separate_colour_plane_vps_flag" ); pcRepFormat->setSeparateColourPlaneVpsFlag( uiCode == 1 ); 
   }
-#if !H_MV_6_PS_REP_FORM_18_19_20
-  READ_CODE( 16, uiCode, "pic_width_vps_in_luma_samples" );  pcRepFormat->setPicWidthVpsInLumaSamples ( uiCode );
-  READ_CODE( 16, uiCode, "pic_height_vps_in_luma_samples" ); pcRepFormat->setPicHeightVpsInLumaSamples( uiCode );
-#endif
   READ_CODE( 4,  uiCode, "bit_depth_vps_luma_minus8" );      pcRepFormat->setBitDepthVpsLumaMinus8    ( uiCode );
   READ_CODE( 4,  uiCode, "bit_depth_vps_chroma_minus8" );    pcRepFormat->setBitDepthVpsChromaMinus8  ( uiCode );
-#if H_MV_6_PS_REP_FORM_18_19_20
   }
   else
@@ -1574,5 +1425,4 @@
     pcRepFormat->inferChromaAndBitDepth(pcPrevRepFormat, false ); 
   }
-#endif
 }
 
@@ -1587,5 +1437,4 @@
 
   UInt uiCode; 
-#if H_MV_6_PS_O0223_29
   READ_FLAG( uiCode, "cross_layer_pic_type_aligned_flag" ); pcVPSVUI->setCrossLayerPicTypeAlignedFlag( uiCode == 1 );
   if ( !pcVPSVUI->getCrossLayerPicTypeAlignedFlag() )
@@ -1593,5 +1442,4 @@
     READ_FLAG( uiCode, "cross_layer_irap_aligned_flag" ); pcVPSVUI->setCrossLayerIrapAlignedFlag( uiCode == 1 );
   }
-#endif
   READ_FLAG( uiCode, "bit_rate_present_vps_flag" ); pcVPSVUI->setBitRatePresentVpsFlag( uiCode == 1 );
   READ_FLAG( uiCode, "pic_rate_present_vps_flag" ); pcVPSVUI->setPicRatePresentVpsFlag( uiCode == 1 );
@@ -1624,5 +1472,4 @@
   }
 
-#if H_MV_6_O0226_37
   READ_FLAG( uiCode, "tiles_not_in_use_flag" ); pcVPSVUI->setTilesNotInUseFlag( uiCode == 1 );
   if( !pcVPSVUI->getTilesNotInUseFlag() ) 
@@ -1659,13 +1506,4 @@
     }
   }
-#else
-  for( Int i = 1; i  <=  pcVPS->getMaxLayersMinus1(); i++ )
-  {
-    for( Int  j = 0; j < pcVPS->getNumDirectRefLayers( pcVPS->getLayerIdInNuh( i ) ); j++ ) 
-    {
-      READ_FLAG( uiCode, "tile_boundaries_aligned_flag" ); pcVPSVUI->setTileBoundariesAlignedFlag( i, j, uiCode == 1 );
-    }
-  }
-#endif
 
   READ_FLAG( uiCode, "ilp_restricted_ref_layers_flag" ); pcVPSVUI->setIlpRestrictedRefLayersFlag( uiCode == 1 );
@@ -1690,5 +1528,4 @@
   }
 
-#if H_MV_6_PS_O0118_33
   READ_FLAG( uiCode, "video_signal_info_idx_present_flag" ); pcVPSVUI->setVideoSignalInfoIdxPresentFlag( uiCode == 1 );
   if( pcVPSVUI->getVideoSignalInfoIdxPresentFlag() )
@@ -1724,6 +1561,4 @@
     }
   }
-#endif
-#if H_MV_6_HRD_O0164_15
   READ_FLAG( uiCode, "vps_vui_bsp_hrd_present_flag" ); pcVPSVUI->setVpsVuiBspHrdPresentFlag( uiCode == 1 );
   if ( pcVPSVUI->getVpsVuiBspHrdPresentFlag( ) )
@@ -1731,8 +1566,6 @@
     parseVpsVuiBspHrdParameters( pcVPS ); 
 }
-#endif
-}
-
-#if H_MV_6_HRD_O0164_15
+}
+
 Void TDecCavlc::parseVpsVuiBspHrdParameters( TComVPS* pcVPS )
 {
@@ -1791,7 +1624,5 @@
   }  
 }  
-#endif
-
-#if H_MV_6_PS_O0118_33
+
 Void TDecCavlc::parseVideoSignalInfo( TComVideoSignalInfo* pcVideoSignalInfo ) 
 {
@@ -1803,7 +1634,5 @@
   READ_CODE( 8, uiCode, "matrix_coeffs_vps" );            pcVideoSignalInfo->setMatrixCoeffsVps( uiCode );
 }
-#endif
-
-#if H_MV_6_HRD_O0217_13
+
 Void TDecCavlc::parseDpbSize( TComVPS* vps )
 {
@@ -1847,5 +1676,4 @@
 }
 #endif
-#endif
 
 #if H_3D
@@ -1859,5 +1687,5 @@
     pcVPS->setARPStepNum( i, 1 );
 #endif  
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
     pcVPS->setSubPULog2Size(i, 0);
 #endif
@@ -1868,5 +1696,5 @@
 #if H_3D_IV_MERGE
         READ_FLAG( uiCode, "iv_mv_pred_flag[i]");          pcVPS->setIvMvPredFlag         ( i, uiCode == 1 ? true : false );
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
         READ_UVLC (uiCode, "log2_sub_PU_size_minus2");     pcVPS->setSubPULog2Size(i, uiCode+2); 
 #endif
@@ -1885,5 +1713,5 @@
       else
       {
-#if QC_DEPTH_IV_MRG_F0125 && H_3D_IV_MERGE
+#if H_3D_IV_MERGE
         if(i!=1)
         {
@@ -1891,5 +1719,5 @@
         }
 #endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
         if (i!=1)
         {
@@ -1897,37 +1725,9 @@
         }
 #endif
-#if SEC_MPI_ENABLING_MERGE_F0150
+#if H_3D_IV_MERGE
         READ_FLAG( uiCode, "mpi_flag[i]" );             pcVPS->setMPIFlag( i, uiCode == 1 ? true : false );
 #endif
         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 !DLT_DIFF_CODING_IN_PPS
-        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
-#endif
 #if H_3D_INTER_SDC
             READ_FLAG( uiCode, "depth_inter_SDC_flag" );              pcVPS->setInterSDCFlag( i, uiCode ? true : false );
@@ -1936,5 +1736,5 @@
     }
   }
-#if CAM_HLS_F0136_F0045_F0082
+
   UInt uiCamParPrecision = 0; 
   Bool bCamParSlice      = false; 
@@ -1962,5 +1762,5 @@
     }
   }
-#endif
+
   READ_FLAG( uiCode, "iv_mv_scaling_flag");                       pcVPS->setIvMvScalingFlag( uiCode == 1 ? true : false ); 
 }
@@ -2000,10 +1800,8 @@
   sps->inferRepFormat  ( vps , rpcSlice->getLayerId() ); 
   sps->inferScalingList( parameterSetManager->getActiveSPS( sps->getSpsScalingListRefLayerId() ) );   
-#if H_MV_6_PS_O0118_33
   if ( sps->getVuiParametersPresentFlag() )
   {
     sps->getVuiParameters()->inferVideoSignalInfo( vps, rpcSlice->getLayerId() ); 
   }
-#endif
   rpcSlice->setVPS(vps);      
   rpcSlice->setViewId   ( vps->getViewId   ( rpcSlice->getLayerId() )      );
@@ -2059,5 +1857,18 @@
 #if H_MV    
     Int esb = 0; //Don't use i, otherwise will shadow something below
-#if !H_MV_6_RALS_O0149_11
+
+    if ( rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
+    {
+      esb++; 
+      READ_FLAG( uiCode, "discardable_flag" ); rpcSlice->setDiscardableFlag( uiCode == 1 );
+    }
+
+    if ( rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
+    {
+      esb++; 
+      READ_FLAG( uiCode, "cross_layer_bla_flag" ); rpcSlice->setCrossLayerBlaFlag( uiCode == 1 );
+    }
+    rpcSlice->checkCrossLayerBlaFlag( ); 
+
     if ( rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
     {
@@ -2065,26 +1876,4 @@
       READ_FLAG( uiCode, "poc_reset_flag" ); rpcSlice->setPocResetFlag( uiCode == 1 );
     }
-#endif
-
-    if ( rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
-    {
-      esb++; 
-      READ_FLAG( uiCode, "discardable_flag" ); rpcSlice->setDiscardableFlag( uiCode == 1 );
-    }
-
-#if H_MV_6_RALS_O0149_11
-    if ( rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
-    {
-      esb++; 
-      READ_FLAG( uiCode, "cross_layer_bla_flag" ); rpcSlice->setCrossLayerBlaFlag( uiCode == 1 );
-    }
-    rpcSlice->checkCrossLayerBlaFlag( ); 
-
-    if ( rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
-    {
-      esb++; 
-      READ_FLAG( uiCode, "poc_reset_flag" ); rpcSlice->setPocResetFlag( uiCode == 1 );
-    }
-#endif
 
     for (; esb < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); esb++)    
@@ -2111,5 +1900,5 @@
 
 
-#if H_MV_6_POC_31_35_38
+#if H_MV
     UInt slicePicOrderCntLsb = 0;
     Int iPOClsb = slicePicOrderCntLsb;  // Needed later
@@ -2162,5 +1951,5 @@
     if( rpcSlice->getIdrPicFlag() )
     {
-#if !H_MV_6_POC_31_35_38
+#if !H_MV
       rpcSlice->setPOC(0);
 #endif
@@ -2177,5 +1966,5 @@
     else
     {
-#if !H_MV_6_POC_31_35_38
+#if !H_MV
       READ_CODE(sps->getBitsForPOC(), uiCode, "pic_order_cnt_lsb");  
       Int iPOClsb = uiCode;
@@ -2205,12 +1994,4 @@
       }
       rpcSlice->setPOC              (iPOCmsb+iPOClsb);
-#if H_MV
-      if ( rpcSlice->getPocResetFlag() )  
-      {
-        rpcSlice->setPocBeforeReset   ( rpcSlice->getPOC() ); 
-        rpcSlice->setPOC              ( 0 );
-
-      }      
-#endif
 #endif
       TComReferencePictureSet* rps;
@@ -2347,7 +2128,5 @@
     }
 #if H_MV
-#if H_MV_6_ILDDS_ILREFPICS_27_34
     Bool interLayerPredLayerIdcPresentFlag = false; 
-#endif
     Int layerId       = rpcSlice->getLayerId(); 
     if( rpcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumDirectRefLayers( layerId ) > 0 )
@@ -2362,7 +2141,5 @@
         if ( rpcSlice->getNumActiveRefLayerPics() != vps->getNumDirectRefLayers( layerId ) )
         {
-#if H_MV_6_ILDDS_ILREFPICS_27_34
           interLayerPredLayerIdcPresentFlag = true; 
-#endif
           for( Int idx = 0; idx < rpcSlice->getNumActiveRefLayerPics(); idx++ )   
           {
@@ -2372,5 +2149,4 @@
       }  
     }
-#if H_MV_6_ILDDS_ILREFPICS_27_34
     if ( !interLayerPredLayerIdcPresentFlag )
     {
@@ -2380,5 +2156,4 @@
       }
     }
-#endif
 #endif
     if(sps->getUseSAO())
@@ -2550,9 +2325,5 @@
     }
 #if H_3D_IC
-#if SEC_ONLY_TEXTURE_IC_F0151
     else if( rpcSlice->getViewIndex() && ( rpcSlice->getSliceType() == P_SLICE || rpcSlice->getSliceType() == B_SLICE ) && !rpcSlice->getIsDepth())
-#else
-    else if( rpcSlice->getViewIndex() && ( rpcSlice->getSliceType() == P_SLICE || rpcSlice->getSliceType() == B_SLICE ) )
-#endif
     {
       UInt uiCodeTmp = 0;
@@ -2572,5 +2343,4 @@
       READ_UVLC( uiCode, "five_minus_max_num_merge_cand");
 #if H_3D_IV_MERGE
-#if SEC_MPI_ENABLING_MERGE_F0150
       if(rpcSlice->getIsDepth())
       {
@@ -2584,8 +2354,5 @@
         rpcSlice->setMaxNumMergeCand(( ivMvPredFlag ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS) - uiCode);
       }
-#else
-      Bool ivMvPredFlag = rpcSlice->getVPS()->getIvMvPredFlag( rpcSlice->getLayerIdInVps() ) ;
-      rpcSlice->setMaxNumMergeCand(( ivMvPredFlag ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS) - uiCode);
-#endif
+
 #else
       rpcSlice->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode);
@@ -2689,10 +2456,6 @@
   }
 
-#if CAM_HLS_F0044
-#if CAM_HLS_F0136_F0045_F0082
+#if H_3D
   if( rpcSlice->getVPS()->hasCamParInSliceHeader( rpcSlice->getViewIndex() )  && !rpcSlice->getIsDepth() )
-#else
-  if( rpcSlice->getSPS()->hasCamParInSliceHeader() )
-#endif
   {
     UInt uiViewIndex = rpcSlice->getViewIndex();
@@ -2706,5 +2469,4 @@
     rpcSlice->setCamparaSlice( m_aaiTempScale, m_aaiTempOffset );
   }
-
 #endif
 
@@ -2712,34 +2474,5 @@
   {
     READ_UVLC(uiCode,"slice_header_extension_length");
-#if H_3D && !CAM_HLS_F0044
-#if CAM_HLS_F0136_F0045_F0082
-    if( rpcSlice->getVPS()->hasCamParInSliceHeader( rpcSlice->getViewIndex() )  && !rpcSlice->getIsDepth() )
-#else
-    if( rpcSlice->getSPS()->hasCamParInSliceHeader() )
-#endif
-    {
-      UInt uiViewIndex = rpcSlice->getViewIndex();
-      for( UInt uiBaseIndex = 0; uiBaseIndex < uiViewIndex; uiBaseIndex++ )
-      {
-        READ_SVLC( iCode, "cp_scale" );                m_aaiTempScale [ uiBaseIndex ][ uiViewIndex ] = iCode;
-        READ_SVLC( iCode, "cp_off" );                  m_aaiTempOffset[ uiBaseIndex ][ uiViewIndex ] = iCode;
-        READ_SVLC( iCode, "cp_inv_scale_plus_scale" ); m_aaiTempScale [ uiViewIndex ][ uiBaseIndex ] = iCode - m_aaiTempScale [ uiBaseIndex ][ uiViewIndex ];
-        READ_SVLC( iCode, "cp_inv_off_plus_off" );     m_aaiTempOffset[ uiViewIndex ][ uiBaseIndex ] = iCode - m_aaiTempOffset[ uiBaseIndex ][ uiViewIndex ];
-      }
-      rpcSlice->setCamparaSlice( m_aaiTempScale, m_aaiTempOffset );
-    }
-
-    READ_FLAG(uiCode,"slice_segment_header_extension2_flag"); 
-    if ( uiCode )
-    {    
-      READ_UVLC(uiCode,"slice_header_extension2_length");
-      for(Int i=0; i<uiCode; i++)
-      {
-        UInt ignore;
-        READ_CODE(8,ignore,"slice_header_extension2_data_byte");
-      }
-    }
-  }
-#else
+
     for(Int i=0; i<uiCode; i++)
     {
@@ -2748,5 +2481,5 @@
     }
   }
-#endif
+
   m_pcBitstream->readByteAlignment();
 
Index: trunk/source/Lib/TLibDecoder/TDecCAVLC.h
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 759)
+++ trunk/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 773)
@@ -78,19 +78,9 @@
 #if H_MV
   Void  parseVPSExtension   ( TComVPS* pcVPS ); 
-#if H_MV_6_PS_REP_FORM_18_19_20
   Void  parseRepFormat      ( Int i, TComRepFormat* curRepFormat, TComRepFormat* prevRepFormat );
-#else
-  Void  parseRepFormat      ( TComRepFormat* pcRepFormat );
-#endif
   Void  parseVPSVUI         ( TComVPS* pcVPS );
-#if H_MV_6_PS_O0118_33
   Void parseVideoSignalInfo ( TComVideoSignalInfo* pcVideoSignalInfo ); 
-#endif
-#if H_MV_6_HRD_O0217_13
   Void  parseDpbSize        ( TComVPS* pcVPS ); 
-#endif
-#if H_MV_6_HRD_O0164_15
   Void parseVpsVuiBspHrdParameters( TComVPS* pcVPS ); 
-#endif
 #endif
 
@@ -106,5 +96,5 @@
 #endif
 
-#if H_3D && DLT_DIFF_CODING_IN_PPS
+#if H_3D
   Void  parsePPS            ( TComPPS* pcPPS, TComVPS* pcVPS );
   Void  parsePPSExtension   ( TComPPS* pcPPS, TComVPS* pcVPS );
Index: trunk/source/Lib/TLibDecoder/TDecCu.cpp
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecCu.cpp	(revision 759)
+++ trunk/source/Lib/TLibDecoder/TDecCu.cpp	(revision 773)
@@ -135,5 +135,5 @@
 Void TDecCu::decompressCU( TComDataCU* pcCU )
 {
-#if !QC_DEPTH_IV_MRG_F0125
+#if !H_3D_IV_MERGE
   xDecompressCU( pcCU, 0,  0 );
 #endif
@@ -315,5 +315,5 @@
       m_ppcCU[uiDepth]->setHeight ( 0, pcCU->getSlice()->getSPS()->getMaxCUHeight()/(1<<uiDepth)  );
       m_ppcCU[uiDepth]->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );     
-#if QC_DEPTH_IV_MRG_F0125
+#if H_3D_IV_MERGE
       if( pcCU->getSlice()->getIsDepth())
       {
@@ -333,5 +333,5 @@
         DvInfo.bDV = m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo);
       }
-#if QC_DEPTH_IV_MRG_F0125
+#if H_3D_IV_MERGE
       }
 #endif
@@ -390,5 +390,4 @@
     UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx);
 
-#if LGE_SHARP_VSP_INHERIT_F0104
 #if H_3D_IC
     m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
@@ -396,5 +395,4 @@
 #if H_3D_ARP
     m_pcEntropyDecoder->decodeARPW( pcCU , uiAbsPartIdx , uiDepth );
-#endif
 #endif
 
@@ -403,5 +401,5 @@
     memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
     InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
     Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM];
     memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
@@ -411,18 +409,14 @@
     puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartition()]; 
 #endif
-#if ETRIKHU_MERGE_REUSE_F0093
     m_ppcCU[uiDepth]->initAvailableFlags();
     m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
     m_ppcCU[uiDepth]->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
       , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP
 #endif
       , numValidMergeCand, uiMergeIndex );
-#else
-    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand, uiMergeIndex );
-#endif
     pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
 #else
-#if ETRIKHU_MERGE_REUSE_F0093
+#if H_3D
     m_ppcCU[uiDepth]->initAvailableFlags();
     m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
@@ -468,5 +462,5 @@
       }
     }
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
     pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth ); 
     if (bSPIVMPFlag[uiMergeIndex])
@@ -488,23 +482,10 @@
       }
     }
-#if MTK_F0110_FIX
     delete[] pcMvFieldSP;
     delete[] puhInterDirSP;
-#else
-    delete pcMvFieldSP;
-    delete puhInterDirSP;
-#endif
-#endif
-#if !LGE_SHARP_VSP_INHERIT_F0104
-#if H_3D_IC
-    m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
-#endif
-#if H_3D_ARP
-    m_pcEntropyDecoder->decodeARPW( pcCU , uiAbsPartIdx , uiDepth );
-#endif
 #endif
 
     xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
-#if QC_DEPTH_IV_MRG_F0125
+#if H_3D_IV_MERGE
     xDecompressCU(pcCU, uiAbsPartIdx, uiDepth );
 #endif
@@ -522,5 +503,5 @@
     {
       xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
-#if QC_DEPTH_IV_MRG_F0125
+#if H_3D_IV_MERGE
       xDecompressCU(pcCU, uiAbsPartIdx, uiDepth );
 #endif
@@ -534,12 +515,4 @@
   // prediction mode ( Intra : direction mode, Inter : Mv, reference idx )
   m_pcEntropyDecoder->decodePredInfo( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth]);
-#if !LGE_SHARP_VSP_INHERIT_F0104
-#if H_3D_IC
-  m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
-#endif
-#if H_3D_ARP
-  m_pcEntropyDecoder->decodeARPW    ( pcCU , uiAbsPartIdx , uiDepth );  
-#endif  
-#endif
 #if H_3D_INTER_SDC
   m_pcEntropyDecoder->decodeInterSDCFlag( pcCU, uiAbsPartIdx, uiDepth );
@@ -550,5 +523,5 @@
   setdQPFlag( bCodeDQP );
   xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
-#if QC_DEPTH_IV_MRG_F0125
+#if H_3D_IV_MERGE
   xDecompressCU(pcCU, uiAbsPartIdx, uiDepth );
 #endif
@@ -568,5 +541,5 @@
 {
   TComPic* pcPic = pcCU->getPic();
-#if !QC_DEPTH_IV_MRG_F0125  
+#if !H_3D_IV_MERGE
   Bool bBoundary = false;
   UInt uiLPelX   = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ];
@@ -780,21 +753,13 @@
     for( UInt uiX = 0; uiX < uiWidth; uiX++ )
     {
-#if LGE_PRED_RES_CODING_DLT_DOMAIN_F0159
-#if DLT_DIFF_CODING_IN_PPS
+#if H_3D
       if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getPPS()->getDLT()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
-#else
-      if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getVPS()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
-#endif
-        {
-#if DLT_DIFF_CODING_IN_PPS
-          pReco    [ uiX ] = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), Clip3( 0, pcCU->getSlice()->getPPS()->getDLT()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ) - 1, pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] ) + pResi[ uiX ] ) );
-#else
-          pReco    [ uiX ] = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), Clip3( 0, pcCU->getSlice()->getVPS()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ) - 1, pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] ) + pResi[ uiX ] ) );
-#endif
-        }
-        else
-        {
-      pReco    [ uiX ] = ClipY( pPred[ uiX ] + pResi[ uiX ] );
-        }
+      {
+        pReco    [ uiX ] = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), Clip3( 0, pcCU->getSlice()->getPPS()->getDLT()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ) - 1, pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] ) + pResi[ uiX ] ) );
+      }
+      else
+      {
+        pReco    [ uiX ] = ClipY( pPred[ uiX ] + pResi[ uiX ] );
+      }
 #else
       pReco    [ uiX ] = ClipY( pPred[ uiX ] + pResi[ uiX ] );
@@ -1008,13 +973,7 @@
   {
 #if H_3D_DIM_DLT
-#if DLT_DIFF_CODING_IN_PPS
     Pel   pPredIdx    = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
     Pel   pResiIdx    = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);
     Pel   pRecoValue  = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pPredIdx + pResiIdx );
-#else
-    Pel   pPredIdx    = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
-    Pel   pResiIdx    = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);
-    Pel   pRecoValue  = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pPredIdx + pResiIdx );
-#endif
 
     apDCResiValues[uiSegment]  = pRecoValue - apDCPredValues[uiSegment];
Index: trunk/source/Lib/TLibDecoder/TDecEntropy.cpp
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 759)
+++ trunk/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 773)
@@ -111,9 +111,5 @@
   pcCU->setICFlagSubParts( false , uiAbsPartIdx, 0, uiDepth );
 
-#if SEC_ONLY_TEXTURE_IC_F0151
   if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() )
-#else
-  if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) )
-#endif
   {
     return;
@@ -213,5 +209,5 @@
   UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS];
 #endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
   Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM];
   TComMvField*  pcMvFieldSP;
@@ -245,5 +241,4 @@
       decodeMergeIndex( pcCU, uiPartIdx, uiSubPartIdx, uiDepth );
       UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
-#if LGE_SHARP_VSP_INHERIT_F0104
 #if H_3D_IC
       decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
@@ -251,5 +246,4 @@
 #if H_3D_ARP
       decodeARPW  ( pcCU, uiAbsPartIdx, uiDepth );
-#endif
 #endif
       if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 ) 
@@ -262,18 +256,14 @@
           memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
           InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
           memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
 #endif
-#if ETRIKHU_MERGE_REUSE_F0093
           pcSubCU->initAvailableFlags();
           pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand);
           pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
             , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP
 #endif
             , numValidMergeCand );
-#else
-          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand );
-#endif
           pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
 
@@ -283,5 +273,5 @@
           }
 #else
-#if ETRIKHU_MERGE_REUSE_F0093
+#if H_3D
           pcSubCU->initAvailableFlags();
           pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand);
@@ -303,18 +293,14 @@
         memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
         InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
         memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
 #endif
-#if ETRIKHU_MERGE_REUSE_F0093
         pcSubCU->initAvailableFlags();
         pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
         pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
           , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP
 #endif
           ,numValidMergeCand, uiMergeIndex );
-#else
-        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo,numValidMergeCand, uiMergeIndex );
-#endif
         pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
         if(vspFlag[uiMergeIndex])
@@ -323,5 +309,5 @@
         }
 #else
-#if ETRIKHU_MERGE_REUSE_F0093
+#if H_3D
         pcSubCU->initAvailableFlags();
         pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
@@ -345,5 +331,5 @@
         }
       }
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
       pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );  
       if (bSPIVMPFlag[uiMergeIndex] != 0)
@@ -381,5 +367,4 @@
         }
       }
-#if LGE_SHARP_VSP_INHERIT_F0104
 #if H_3D_IC
       decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
@@ -387,5 +372,4 @@
 #if H_3D_ARP
       decodeARPW  ( pcCU, uiAbsPartIdx, uiDepth );
-#endif
 #endif
     }
@@ -401,12 +385,7 @@
     }
   }
-#if MTK_SPIVMP_F0110
-#if MTK_F0110_FIX
+#if H_3D_SPIVMP
   delete[] pcMvFieldSP;
   delete[] puhInterDirSP;
-#else
-  delete pcMvFieldSP;
-  delete puhInterDirSP;
-#endif
 #endif
   return;
Index: trunk/source/Lib/TLibDecoder/TDecEntropy.h
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecEntropy.h	(revision 759)
+++ trunk/source/Lib/TLibDecoder/TDecEntropy.h	(revision 773)
@@ -71,5 +71,5 @@
   virtual Void  parseSPS                  ( TComSPS* pcSPS )                                      = 0;
 #endif
-#if DLT_DIFF_CODING_IN_PPS
+#if H_3D
   virtual Void  parsePPS                  ( TComPPS* pcPPS, TComVPS* pcVPS )                      = 0;
 #else
@@ -152,5 +152,5 @@
   Void    decodeSPS                   ( TComSPS* pcSPS     )    { m_pcEntropyDecoderIf->parseSPS(pcSPS);                    }
 #endif
-#if DLT_DIFF_CODING_IN_PPS
+#if H_3D
   Void    decodePPS                   ( TComPPS* pcPPS, TComVPS* pcVPS )    { m_pcEntropyDecoderIf->parsePPS(pcPPS, pcVPS);                    }
 #else
Index: trunk/source/Lib/TLibDecoder/TDecSbac.cpp
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 759)
+++ trunk/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 773)
@@ -89,10 +89,4 @@
 #if H_3D_DIM_DMM
 , m_cDmm1DataSCModel          ( 1,             1,               NUM_DMM1_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
-#if !SEC_DMM3_RBC_F0147
-, m_cDmm3DataSCModel          ( 1,             1,               NUM_DMM3_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
-#endif
-#endif
-#if H_3D_DIM_RBC
-, m_cRbcDataSCModel           ( 1,             1,               NUM_RBC_DATA_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
 #endif
 #if H_3D_DIM_SDC
@@ -178,10 +172,4 @@
 #if H_3D_DIM_DMM
   m_cDmm1DataSCModel.initBuffer          ( sliceType, qp, (UChar*)INIT_DMM1_DATA );
-#if !SEC_DMM3_RBC_F0147
-  m_cDmm3DataSCModel.initBuffer          ( sliceType, qp, (UChar*)INIT_DMM3_DATA );
-#endif
-#endif
-#if H_3D_DIM_RBC
-  m_cRbcDataSCModel.initBuffer           ( sliceType, qp, (UChar*)INIT_RBC_DATA );
 #endif
 #if H_3D_DIM_SDC
@@ -253,10 +241,4 @@
 #if H_3D_DIM_DMM
   m_cDmm1DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM1_DATA );
-#if !SEC_DMM3_RBC_F0147
-  m_cDmm3DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM3_DATA );
-#endif
-#endif
-#if H_3D_DIM_RBC
-  m_cRbcDataSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_RBC_DATA );
 #endif
 #if H_3D_DIM_SDC
@@ -414,5 +396,4 @@
 }
 
-#if QC_DIM_DELTADC_UNIFY_F0132
 Void TDecSbac::xParseDimDeltaDC( Pel& rValDeltaDC, UInt uiNumSeg )
 {
@@ -431,22 +412,5 @@
   }
 }
-#else
-Void TDecSbac::xParseDimDeltaDC( Pel& rValDeltaDC, UInt dimType )
-{
-  UInt absValDeltaDC = 0;
-  xReadExGolombLevel( absValDeltaDC, m_cDdcDataSCModel.get(0, 0, (RBC_IDX == dimType) ? 1 : 0) );
-  rValDeltaDC = (Pel)absValDeltaDC;
-
-  if( rValDeltaDC != 0 )
-  {
-    UInt uiSign;
-    m_pcTDecBinIf->decodeBinEP( uiSign );
-    if ( uiSign )
-    {
-      rValDeltaDC = -rValDeltaDC;
-    }
-  }
-}
-#endif
+
 
 #if H_3D_DIM_DMM
@@ -461,96 +425,6 @@
   ruiTabIdx = uiIdx;
 }
-#if !SEC_DMM3_RBC_F0147
-Void TDecSbac::xParseDmm3WedgeIdx( UInt& ruiIntraIdx, Int iNumBit )
-{
-  UInt uiSymbol, uiIdx = 0;
-  for( Int i = 0; i < iNumBit; i++ )
-  {
-    m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmm3DataSCModel.get(0, 0, 0) );
-    uiIdx += uiSymbol << i;
-  }
-  ruiIntraIdx = uiIdx;
-}
-#endif
-#endif
-#if H_3D_DIM_RBC
-Void TDecSbac::xParseRbcEdge( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
-{
-  UInt uiSymbol = 0;
-
-  // 1. Top(0) or Left(1)
-  UChar ucLeft;
-  m_pcTDecBinIf->decodeBinEP( uiSymbol );
-  ucLeft = uiSymbol;
-
-  // 2. Start position (lowest bit first)
-  UChar ucStart = 0;
-  for( UInt ui = 0; ui < 6 - uiDepth; ui++ )
-  {
-    m_pcTDecBinIf->decodeBinEP( uiSymbol );
-    ucStart |= (uiSymbol << ui);
-  }
-
-  // 3. Number of edges
-  UChar ucMax = 0;
-  for( UInt ui = 0; ui < 7 - uiDepth; ui++ )
-  {
-    m_pcTDecBinIf->decodeBinEP( uiSymbol );
-    ucMax |= (uiSymbol << ui);
-  }
-  ucMax++; // +1
-
-  // 4. Edges
-  UChar* pucSymbolList = (UChar*) xMalloc( UChar, 256 * RBC_MAX_EDGE_NUM_PER_4x4 );
-  for( Int iPtr = 0; iPtr < ucMax; iPtr++ )
-  {
-    UChar ucEdge = 0;
-    UInt  uiReorderEdge = 0;
-    for( UInt ui = 0; ui < 6; ui++ )
-    {
-      m_pcTDecBinIf->decodeBin( uiSymbol, m_cRbcDataSCModel.get( 0, 0, 0 ) );
-      ucEdge <<= 1;
-      ucEdge |= uiSymbol;
-      if( uiSymbol == 0 )
-        break;
-    }
-
-    switch( ucEdge )
-    {
-    case 0 :  // "0"       
-      uiReorderEdge = 0;
-      break;
-    case 2 :  // "10"
-      uiReorderEdge = 1;
-      break;
-    case 6 :  // "110"
-      uiReorderEdge = 2;
-      break;
-    case 14 : // "1110"
-      uiReorderEdge = 3;
-      break;
-    case 30 : // "11110"
-      uiReorderEdge = 4;
-      break;
-    case 62 : // "111110"
-      uiReorderEdge = 5;
-      break;
-    case 63 : // "111111"
-      uiReorderEdge = 6;
-      break;
-    default :
-      printf("parseIntraEdgeChain: error (unknown code %d)\n",ucEdge);
-      assert(false);
-      break;
-    }
-    pucSymbolList[iPtr] = uiReorderEdge;
-  }
-  /////////////////////
-  // Edge Reconstruction
-  Bool* pbRegion = pcCU->getEdgePartition( uiAbsPartIdx );
-  pcCU->reconPartition( uiAbsPartIdx, uiDepth, ucLeft == 1, ucStart, ucMax, pucSymbolList, pbRegion );
-  xFree( pucSymbolList );
-}
-#endif
+#endif
+
 #if H_3D_DIM_SDC
 Void TDecSbac::xParseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiSegment )
@@ -568,9 +442,5 @@
   
 #if H_3D_DIM_DLT
-#if DLT_DIFF_CODING_IN_PPS
   UInt uiMaxResidualBits = pcCU->getSlice()->getPPS()->getDLT()->getBitsPerDepthValue( pcCU->getSlice()->getLayerIdInVps() );
-#else
-  UInt uiMaxResidualBits = pcCU->getSlice()->getVPS()->getBitsPerDepthValue( pcCU->getSlice()->getLayerIdInVps() );
-#endif
 #else
   UInt uiMaxResidualBits = g_bitDepthY;
@@ -596,9 +466,5 @@
     UInt uiCount = 0;
 #if H_3D_DIM_DLT
-#if DLT_DIFF_CODING_IN_PPS
     UInt uiNumDepthValues = pcCU->getSlice()->getPPS()->getDLT()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() );
-#else
-    UInt uiNumDepthValues = pcCU->getSlice()->getVPS()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() );
-#endif
 #else
     UInt uiNumDepthValues = ((1 << g_bitDepthY)-1);
@@ -1175,99 +1041,48 @@
       pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dimType, absPartIdx, depth );
     } break;
-#if !SEC_DMM3_RBC_F0147
-  case( DMM3_IDX ):
-    {
-      UInt uiIntraIdx = 0;
-      xParseDmm3WedgeIdx( uiIntraIdx, g_dmm3IntraTabIdxBits[pcCU->getIntraSizeIdx(absPartIdx)] );
-      pcCU->setDmm3IntraTabIdxSubParts( uiIntraIdx, absPartIdx, depth );
-    } break;
-#endif
   case( DMM4_IDX ): break;
 #endif
-#if H_3D_DIM_RBC
-  case( RBC_IDX ): 
-    {
-      xParseRbcEdge( pcCU, absPartIdx, depth );
-    } break;
-#endif
   default: break;
   }
 
-#if H_3D_DIM_SDC && !QC_DIM_DELTADC_UNIFY_F0132
-  if( pcCU->getSDCFlag(absPartIdx) )
-  {
-    assert(pcCU->getPartitionSize(absPartIdx)==SIZE_2Nx2N);
-    pcCU->setTrIdxSubParts(0, absPartIdx, depth);
-    pcCU->setCbfSubParts(1, 1, 1, absPartIdx, depth);
-
-    UInt uiNumSegments = ( dir == DC_IDX || dir == PLANAR_IDX )? 1 : 2;
-    for (UInt uiSeg=0; uiSeg<uiNumSegments; uiSeg++)
-    {
-      xParseSDCResidualData(pcCU, absPartIdx, depth, uiSeg);
-    }
-  }
-  else
-  {
-#endif
-#if QC_DIM_DELTADC_UNIFY_F0132
-    if( dimType < DIM_NUM_TYPE || pcCU->getSDCFlag( absPartIdx ) )
-#else
-    if( dimType < DIM_NUM_TYPE )
-#endif
-    {
-      UInt symbol;
-#if QC_DIM_DELTADC_UNIFY_F0132
-      UInt uiNumSegments = ( dir == PLANAR_IDX ) ? 1 : 2;
+  if( dimType < DIM_NUM_TYPE || pcCU->getSDCFlag( absPartIdx ) )
+  {
+    UInt symbol;
+    UInt uiNumSegments = ( dir == PLANAR_IDX ) ? 1 : 2;
+
+    if( pcCU->getSDCFlag( absPartIdx ) )
+    {
+      assert(pcCU->getPartitionSize(absPartIdx)==SIZE_2Nx2N);
+      pcCU->setTrIdxSubParts(0, absPartIdx, depth);
+      pcCU->setCbfSubParts(1, 1, 1, absPartIdx, depth);
+    }
+
+    m_pcTDecBinIf->decodeBin( symbol, m_cDdcFlagSCModel.get(0, 0, uiNumSegments-1) );
+
+    if( symbol )
+    {
+      if( !pcCU->getSDCFlag( absPartIdx ) )
+      {
+        dir += symbol;
+      }
+    }
+    for( UInt segment = 0; segment < uiNumSegments; segment++ )
+    {
+      Pel valDeltaDC = 0;
+      if( symbol )
+      {
+        xParseDimDeltaDC( valDeltaDC, uiNumSegments );
+      }
 
       if( pcCU->getSDCFlag( absPartIdx ) )
       {
-        assert(pcCU->getPartitionSize(absPartIdx)==SIZE_2Nx2N);
-        pcCU->setTrIdxSubParts(0, absPartIdx, depth);
-        pcCU->setCbfSubParts(1, 1, 1, absPartIdx, depth);
-      }
-
-      m_pcTDecBinIf->decodeBin( symbol, m_cDdcFlagSCModel.get(0, 0, uiNumSegments-1) );
-
-      if( symbol )
-      {
-        if( !pcCU->getSDCFlag( absPartIdx ) )
-        {
-          dir += symbol;
-        }
-      }
-      for( UInt segment = 0; segment < uiNumSegments; segment++ )
-      {
-        Pel valDeltaDC = 0;
-        if( symbol )
-        {
-          xParseDimDeltaDC( valDeltaDC, uiNumSegments );
-        }
-
-        if( pcCU->getSDCFlag( absPartIdx ) )
-        {
-          pcCU->setSDCSegmentDCOffset( valDeltaDC, segment, absPartIdx );
-        }
-        else
-        {
-          pcCU->setDimDeltaDC( dimType, segment, absPartIdx, valDeltaDC );
-        }
-      }
-#else
-      m_pcTDecBinIf->decodeBin( symbol, m_cDdcFlagSCModel.get(0, 0, (RBC_IDX == dimType) ? 1 : 0) );
-      if( symbol )
-      {
-        dir += symbol;
-        for( UInt segment = 0; segment < 2; segment++ )
-        {
-          Pel valDeltaDC = 0;
-          xParseDimDeltaDC( valDeltaDC, dimType );
-          pcCU->setDimDeltaDC( dimType, segment, absPartIdx, valDeltaDC );
-        }
-      }
-#endif
-    }
-#if H_3D_DIM_SDC && !QC_DIM_DELTADC_UNIFY_F0132
-  }
-#endif
+        pcCU->setSDCSegmentDCOffset( valDeltaDC, segment, absPartIdx );
+      }
+      else
+      {
+        pcCU->setDimDeltaDC( dimType, segment, absPartIdx, valDeltaDC );
+      }
+    }
+  }
 
   pcCU->setLumaIntraDirSubParts( (UChar)dir, absPartIdx, depth );
@@ -1297,9 +1112,5 @@
   else if( puIdx == 0 )
   {
-#if SEC_DMM3_RBC_F0147
     while( binNum < 1 && symbol )
-#else
-    while( binNum < 3 && symbol )
-#endif
     {
       ctxDepthMode = puIdx*3 + ((binNum >= 2) ? 2 : binNum);
@@ -1308,17 +1119,17 @@
       binNum++;
     }
-#if SEC_DMM3_RBC_F0147
-    if( modeCode == 0 ) { dir = 0;                       sdcFlag = 0;}
-    else if( modeCode == 1 ) { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 0;}
-#else
-         if( modeCode == 0 ) { dir = 0;                       sdcFlag = 0;}
-    else if( modeCode == 2 ) { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 0;}
-    else if( modeCode == 6 ) { dir = (2*DMM3_IDX+DIM_OFFSET); sdcFlag = 0;}
-    else if( modeCode == 7 ) { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;}
-#endif
+    if( modeCode == 0 ) 
+    { 
+      dir = 0;
+      sdcFlag = 0;
+    }
+    else if ( modeCode == 1 ) 
+    { 
+      dir = (2*DMM1_IDX+DIM_OFFSET); 
+      sdcFlag = 0;
+    }
   }
   else
   {
-#if SEC_DMM3_RBC_F0147
     while( binNum < 4 && symbol )
     {
@@ -1333,37 +1144,5 @@
     else if ( modeCode == 14 )  { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 0;}
     else if ( modeCode == 15 )  { dir = (2*DMM4_IDX+DIM_OFFSET); sdcFlag = 0;}
-#else
-    UInt maxBinNum = 0;
-    m_pcTDecBinIf->decodeBinEP(symbol);
-    if( symbol == 1 )
-    {
-      maxBinNum = 3;
-    }
-    else
-    {
-      maxBinNum = 2;
-      symbol = 1;
-    }
-    while( binNum<maxBinNum && symbol )
-    {
-      ctxDepthMode = puIdx*3 + ( binNum >= 2 ? 2 : binNum );
-      m_pcTDecBinIf->decodeBin(symbol,m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode));
-      modeCode = (modeCode<<1)+symbol;
-      binNum++;
-    }
-    if( maxBinNum == 3 )
-    {
-      if ( modeCode == 0 )       { dir =  PLANAR_IDX;             sdcFlag = 1;}
-      else if ( modeCode == 2 )  { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;}
-      else if ( modeCode == 6 )  { dir = (2*DMM3_IDX+DIM_OFFSET); sdcFlag = 0;}
-      else if ( modeCode == 7 )  { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 0;}
-    }
-    else
-    {
-      if ( modeCode == 0 )       { dir = 5;                       sdcFlag = 0;}
-      else if ( modeCode == 2 )  { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 1;}
-      else if ( modeCode == 3 )  { dir = (2*DMM4_IDX+DIM_OFFSET); sdcFlag = 0;}
-    }
-#endif
+
   }
   pcCU->setLumaIntraDirSubParts( (UChar)dir, absPartIdx, depth );
Index: trunk/source/Lib/TLibDecoder/TDecSbac.h
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecSbac.h	(revision 759)
+++ trunk/source/Lib/TLibDecoder/TDecSbac.h	(revision 773)
@@ -81,5 +81,5 @@
   Void  parseSPS                  ( TComSPS* /*pcSPS*/ ) {}
 #endif
-#if DLT_DIFF_CODING_IN_PPS
+#if H_3D
   Void  parsePPS                  ( TComPPS* /*pcPPS*/, TComVPS* /*pcVPS*/ ) {}
 #else
@@ -103,17 +103,7 @@
 #if H_3D_DIM
   Void  xReadExGolombLevel   ( UInt& ruiSymbol, ContextModel& rcSCModel  );
-#if QC_DIM_DELTADC_UNIFY_F0132
   Void  xParseDimDeltaDC     ( Pel& rValDeltaDC, UInt uiNumSeg );
-#else
-  Void  xParseDimDeltaDC     ( Pel& rValDeltaDC, UInt dimType );
-#endif
 #if H_3D_DIM_DMM
   Void  xParseDmm1WedgeIdx   ( UInt& ruiTabIdx, Int iNumBit );
-#if !SEC_DMM3_RBC_F0147
-  Void  xParseDmm3WedgeIdx   ( UInt& ruiIntraIdx, Int iNumBit );
-#endif
-#endif
-#if H_3D_DIM_RBC
-  Void  xParseRbcEdge        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
 #endif
 #if H_3D_DIM_SDC
@@ -223,10 +213,4 @@
 #if H_3D_DIM_DMM
   ContextModel3DBuffer m_cDmm1DataSCModel;
-#if !SEC_DMM3_RBC_F0147
-  ContextModel3DBuffer m_cDmm3DataSCModel;
-#endif
-#endif
-#if H_3D_DIM_RBC
-  ContextModel3DBuffer m_cRbcDataSCModel;
 #endif
 #if H_3D_DIM_SDC  
Index: trunk/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecTop.cpp	(revision 759)
+++ trunk/source/Lib/TLibDecoder/TDecTop.cpp	(revision 773)
@@ -228,5 +228,5 @@
     m_uiMaxViewIndex                     = std::max( m_uiMaxViewIndex, uiViewIndex );
     m_aiViewId[ uiViewIndex ]            = pcSlice->getViewId();
-#if CAM_HLS_F0136_F0045_F0082
+
     if( uiViewIndex == 1 )
     {
@@ -239,16 +239,5 @@
       AOF( m_bCamParsVaryOverTime    == pcSlice->getVPS()->hasCamParInSliceHeader ( uiViewIndex ) );
     }
-#else
-    if( uiViewIndex == 1 )
-    {
-      m_uiCamParsCodedPrecision       = pcSlice->getSPS()->getCamParPrecision     ();
-      m_bCamParsVaryOverTime          = pcSlice->getSPS()->hasCamParInSliceHeader ();
-    }
-    else if( uiViewIndex > 1 )
-    {
-      AOF( m_uiCamParsCodedPrecision == pcSlice->getSPS()->getCamParPrecision     () );
-      AOF( m_bCamParsVaryOverTime    == pcSlice->getSPS()->hasCamParInSliceHeader () );
-    }
-#endif
+
     for( UInt uiBaseIndex = 0; uiBaseIndex < uiViewIndex; uiBaseIndex++ )
     {
@@ -264,15 +253,8 @@
       else
       {
-#if CAM_HLS_F0136_F0045_F0082
         m_aaiCodedScale [ uiBaseIndex ][ uiViewIndex ]  = pcSlice->getVPS()->getCodedScale    (uiViewIndex) [ uiBaseIndex ];
         m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ]  = pcSlice->getVPS()->getCodedOffset   (uiViewIndex) [ uiBaseIndex ];
         m_aaiCodedScale [ uiViewIndex ][ uiBaseIndex ]  = pcSlice->getVPS()->getInvCodedScale (uiViewIndex) [ uiBaseIndex ];
         m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ]  = pcSlice->getVPS()->getInvCodedOffset(uiViewIndex) [ uiBaseIndex ];
-#else
-        m_aaiCodedScale [ uiBaseIndex ][ uiViewIndex ]  = pcSlice->getSPS()->getCodedScale    () [ uiBaseIndex ];
-        m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ]  = pcSlice->getSPS()->getCodedOffset   () [ uiBaseIndex ];
-        m_aaiCodedScale [ uiViewIndex ][ uiBaseIndex ]  = pcSlice->getSPS()->getInvCodedScale () [ uiBaseIndex ];
-        m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ]  = pcSlice->getSPS()->getInvCodedOffset() [ uiBaseIndex ];
-#endif
         xInitLUTs( uiBaseIndex, uiViewIndex, m_aaiCodedScale[ uiBaseIndex ][ uiViewIndex ], m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );
         xInitLUTs( uiViewIndex, uiBaseIndex, m_aaiCodedScale[ uiViewIndex ][ uiBaseIndex ], m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );
@@ -302,13 +284,8 @@
 }
 
-#if QC_DEPTH_IV_MRG_F0125
+#if H_3D_IV_MERGE
 Void
 CamParsCollector::copyCamParamForSlice( TComSlice* pcSlice )
 {
-#if !CAM_HLS_F0136_F0045_F0082
-  UInt uiViewIndex = pcSlice->getViewIndex();
-
-  pcSlice->getSPS()->initCamParaSPS( uiViewIndex, m_uiCamParsCodedPrecision, m_bCamParsVaryOverTime, m_aaiCodedScale, m_aaiCodedOffset );
-#endif
   if( m_bCamParsVaryOverTime )
   {
@@ -656,10 +633,8 @@
 #if H_MV
   m_apcSlicePilot->setVPS(vps);  
-#if H_MV_6_PS_0092_17
   // The nuh_layer_id value of the NAL unit containing the PPS that is activated for a layer layerA with nuh_layer_id equal to nuhLayerIdA shall be equal to 0, or nuhLayerIdA, or the nuh_layer_id of a direct or indirect reference layer of layerA.
   assert( pps->getLayerId() == m_layerId || pps->getLayerId( ) == 0 || vps->getInDirectDependencyFlag( m_layerId, pps->getLayerId() ) );   
   // The nuh_layer_id value of the NAL unit containing the SPS that is activated for a layer layerA with nuh_layer_id equal to nuhLayerIdA shall be equal to 0, or nuhLayerIdA, or the nuh_layer_id of a direct or indirect reference layer of layerA.
   assert( sps->getLayerId() == m_layerId || sps->getLayerId( ) == 0 || vps->getInDirectDependencyFlag( m_layerId, sps->getLayerId() ) );
-#endif
   sps->inferRepFormat  ( vps , m_layerId ); 
   sps->inferScalingList( m_parameterSetManagerDecoder.getActiveSPS( sps->getSpsScalingListRefLayerId() ) ); 
@@ -692,9 +667,5 @@
 
 #if H_MV
-#if H_MV_FIX_SKIP_PICTURES
 Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, Bool newLayerFlag, Bool& sliceSkippedFlag  )
-#else
-Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, Bool newLayerFlag )
-#endif
 {
   assert( nalu.m_layerId == m_layerId ); 
@@ -754,5 +725,5 @@
 #endif
 
-#if H_MV_LAYER_WISE_STARTUP
+#if H_MV
     xCeckNoClrasOutput();
 #endif
@@ -762,6 +733,6 @@
     m_prevSliceSkipped = true;
     m_skippedPOC = m_apcSlicePilot->getPOC();
-#if H_MV_FIX_SKIP_PICTURES
-      sliceSkippedFlag = true; 
+#if H_MV
+    sliceSkippedFlag = true; 
 #endif
       return false;
@@ -772,6 +743,6 @@
     m_prevSliceSkipped = true;
     m_skippedPOC = m_apcSlicePilot->getPOC();
-#if H_MV_FIX_SKIP_PICTURES
-      sliceSkippedFlag = true; 
+#if H_MV
+    sliceSkippedFlag = true; 
 #endif
       return false;
@@ -1007,9 +978,5 @@
     pcSlice->setRefPicList     ( tempRefPicLists, usedAsLongTerm, numPocTotalCurr, true ); 
 #if H_3D_ARP
-#if SHARP_ARP_REF_CHECK_F0105
     pcSlice->setARPStepNum(m_ivPicLists);
-#else
-    pcSlice->setARPStepNum();
-#endif
     if( pcSlice->getARPStepNum() > 1 )
     {
@@ -1113,5 +1080,5 @@
   }
 
-#if QC_DEPTH_IV_MRG_F0125
+#if H_3D_IV_MERGE
   if( pcSlice->getIsDepth() && m_pcCamParsCollector )
   {
@@ -1127,12 +1094,4 @@
     m_pcCamParsCollector->setSlice( pcSlice );
   }
-#if QC_DEPTH_IV_MRG_F0125
-  if( pcSlice->getIsDepth() )
-  {
-#if !CAM_HLS_F0136_F0045_F0082
-    pcSlice->getSPS()->setHasCamParInSliceHeader( false );
-#endif
-  }
-#endif
 #endif
   m_bFirstSliceInPicture = false;
@@ -1174,5 +1133,5 @@
   pps->setLayerId( getLayerId() ); 
 #endif
-#if DLT_DIFF_CODING_IN_PPS
+#if H_3D
   // Assuming that all PPS indirectly refer to the same VPS via different SPS
   // There is no parsing dependency in decoding DLT in PPS. 
@@ -1181,5 +1140,5 @@
   //   Step 1) decoding DLT tables based on the number of depth layers, and
   //   Step 2) mapping DLT tables to the depth layers
-  // as descripted in the 3D-HEVC WD. 
+  // as described in the 3D-HEVC WD. 
   TComVPS* vps = m_parameterSetManagerDecoder.getPrefetchedVPS( 0 );
   m_cEntropyDecoder.decodePPS( pps, vps );
@@ -1226,9 +1185,5 @@
 
 #if H_MV
-#if H_MV_FIX_SKIP_PICTURES
 Bool TDecTop::decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, Bool newLayerFlag, Bool& sliceSkippedFlag )
-#else
-Bool TDecTop::decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, Bool newLayerFlag)
-#endif
 #else
 Bool TDecTop::decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay)
@@ -1275,9 +1230,5 @@
     case NAL_UNIT_CODED_SLICE_RASL_R:
 #if H_MV
-#if H_MV_FIX_SKIP_PICTURES
       return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay, newLayerFlag, sliceSkippedFlag );
-#else
-      return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay, newLayerFlag);
-#endif
 #else
       return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay);
@@ -1328,5 +1279,5 @@
     return true;
   }
-#if H_MV_LAYER_WISE_STARTUP
+#if H_MV
   else if ( !m_layerInitilizedFlag[ m_layerId ] ) // start of random access point, m_pocRandomAccess has not been set yet.
 #else
@@ -1340,5 +1291,5 @@
     {
 
-#if H_MV_LAYER_WISE_STARTUP
+#if H_MV
       if ( xAllRefLayersInitilized() )
       {
@@ -1357,21 +1308,21 @@
     else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP )
     {
-#if H_MV_LAYER_WISE_STARTUP
+#if H_MV
       if ( xAllRefLayersInitilized() )
       {
         m_layerInitilizedFlag[ m_layerId ] = true; 
+        m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable.
+      }
+      else 
+      {
+        return true; 
+      }
+#else
       m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable.
+#endif
     }
     else 
     {
-        return true; 
-      }
-#else
-      m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable.
-#endif
-    }
-    else 
-    {
-#if H_MV_FIX_SKIP_PICTURES
+#if H_MV
       static Bool warningMessage[MAX_NUM_LAYERS];
       static Bool warningInitFlag = false;
@@ -1408,5 +1359,5 @@
     return true;
   }
-#if H_MV_LAYER_WISE_STARTUP
+#if H_MV
   return !m_layerInitilizedFlag[ getLayerId() ]; 
 #else
@@ -1455,5 +1406,5 @@
 }
 
-#if H_MV_LAYER_WISE_STARTUP
+#if H_MV
 Void TDecTop::xCeckNoClrasOutput()
 {
Index: trunk/source/Lib/TLibDecoder/TDecTop.h
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecTop.h	(revision 759)
+++ trunk/source/Lib/TLibDecoder/TDecTop.h	(revision 773)
@@ -78,5 +78,5 @@
   Int**** getBaseViewShiftLUTI()  { return m_aiBaseViewShiftLUT;   }
 
-#if QC_DEPTH_IV_MRG_F0125
+#if H_3D_IV_MERGE
   Void  copyCamParamForSlice( TComSlice* pcSlice );
 #endif
@@ -186,7 +186,5 @@
   TComList<TComPic*>      m_cListPic;         //  Dynamic buffer
 #if H_MV
-#if H_MV_LAYER_WISE_STARTUP
   Bool*                    m_layerInitilizedFlag; // initialization Layers
-#endif
   static ParameterSetManagerDecoder m_parameterSetManagerDecoder;  // storage for parameter sets 
 #else
@@ -246,9 +244,5 @@
   Void  init();
 #if H_MV  
-#if H_MV_FIX_SKIP_PICTURES
   Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, Bool newLayer, Bool& sliceSkippedFlag );
-#else
-  Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, Bool newLayer );
-#endif
   Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, Bool newLayer );
 #else  
@@ -268,10 +262,6 @@
   TComList<TComPic*>*     getListPic            ()               { return &m_cListPic;  }  
   Void                    setIvPicLists         ( TComPicLists* picLists) { m_ivPicLists = picLists; }
-#if H_MV_LAYER_WISE_STARTUP
   Void                    setLayerInitilizedFlags( Bool* val )    { m_layerInitilizedFlag = val; }
-#endif
-#if H_MV_6_HRD_O0217_13
   TComVPS*                getPrefetchedVPS      ()               { return m_parameterSetManagerDecoder.getPrefetchedVPS( 0 ); }; //Assuming that currently only one VPS is present. 
-#endif
   Int                     getCurrPoc            ()               { return m_apcSlicePilot->getPOC(); }
   Void                    setLayerId            ( Int layer)     { m_layerId = layer;   }
@@ -294,15 +284,9 @@
 #if H_MV  
   TComPic*  xGetPic( Int layerId, Int poc ); 
-#if H_MV_FIX_SKIP_PICTURES
   Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, Bool newLayerFlag, Bool& sliceSkippedFlag );  
-#else
-  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, Bool newLayerFlag );  
-#endif
   Void      xResetPocInPicBuffer();
-#if H_MV_LAYER_WISE_STARTUP
   Void      xCeckNoClrasOutput();
 
   Bool      xAllRefLayersInitilized();
-#endif
 #else
   Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay);
Index: trunk/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 759)
+++ trunk/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 773)
@@ -176,7 +176,18 @@
   WRITE_FLAG( pcPPS->getSignHideFlag(), "sign_data_hiding_flag" );
   WRITE_FLAG( pcPPS->getCabacInitPresentFlag() ? 1 : 0,   "cabac_init_present_flag" );
+#if PPS_FIX_DEPTH
+  if( pcPPS->getSPS()->getVPS()->getDepthId(pcPPS->getSPS()->getLayerId()) )
+  {
+    WRITE_UVLC( pcPPS->getNumRefIdxL0DefaultActive(),     "num_ref_idx_l0_default_active_minus1");
+    WRITE_UVLC( pcPPS->getNumRefIdxL1DefaultActive(),     "num_ref_idx_l1_default_active_minus1");
+  }
+  else
+  {
+#endif
   WRITE_UVLC( pcPPS->getNumRefIdxL0DefaultActive()-1,     "num_ref_idx_l0_default_active_minus1");
   WRITE_UVLC( pcPPS->getNumRefIdxL1DefaultActive()-1,     "num_ref_idx_l1_default_active_minus1");
-
+#if PPS_FIX_DEPTH
+  }
+#endif
   WRITE_SVLC( pcPPS->getPicInitQPMinus26(),                  "init_qp_minus26");
   WRITE_FLAG( pcPPS->getConstrainedIntraPred() ? 1 : 0,      "constrained_intra_pred_flag" );
@@ -253,9 +264,23 @@
   }
 #endif
+#if PPS_FIX_DEPTH
+  if( pcPPS->getSPS()->getVPS()->getDepthId(pcPPS->getSPS()->getLayerId()) )
+  {
+    WRITE_FLAG( 1, "lists_modification_present_flag" );
+  }
+  else
+#endif
   WRITE_FLAG( pcPPS->getListsModificationPresentFlag(), "lists_modification_present_flag");
   WRITE_UVLC( pcPPS->getLog2ParallelMergeLevelMinus2(), "log2_parallel_merge_level_minus2");
+#if PPS_FIX_DEPTH
+  if( pcPPS->getSPS()->getVPS()->getDepthId(pcPPS->getSPS()->getLayerId()) )
+  {
+    WRITE_FLAG( 1, "slice_segment_header_extension_present_flag" );
+  }
+  else
+#endif
   WRITE_FLAG( pcPPS->getSliceHeaderExtensionPresentFlag() ? 1 : 0, "slice_segment_header_extension_present_flag");
 
-#if !DLT_DIFF_CODING_IN_PPS
+#if !H_3D
   WRITE_FLAG( 0, "pps_extension_flag" );
 #else
@@ -266,5 +291,5 @@
 }
 
-#if DLT_DIFF_CODING_IN_PPS
+#if H_3D
 Void  TEncCavlc::codePPSExtension        ( TComPPS* pcPPS )
 {
@@ -275,5 +300,5 @@
   //   Step 1) decoding DLT tables based on the number of depth layers, and
   //   Step 2) mapping DLT tables to the depth layers
-  // as descripted in the 3D-HEVC WD.
+  // as described in the 3D-HEVC WD.
   TComVPS* pcVPS = pcPPS->getSPS()->getVPS();
 
@@ -470,5 +495,5 @@
   }
   WRITE_FLAG(pcVUI->getVideoSignalTypePresentFlag(),            "video_signal_type_present_flag");
-#if H_MV_6_PS_O0118_33
+#if H_MV
   assert( pcSPS->getLayerId() == 0 || !pcVUI->getVideoSignalTypePresentFlag() ); 
 #endif
@@ -636,5 +661,4 @@
   {
     WRITE_FLAG( pcSPS->getUpdateRepFormatFlag( ) ? 1 : 0 , "update_rep_format_flag" );
-#if H_MV_6_PS_REP_FORM_18_19_20    
     if ( pcSPS->getUpdateRepFormatFlag() )
     { 
@@ -644,10 +668,4 @@
   else
   {
-#else
-  }
-
-  if ( pcSPS->getUpdateRepFormatFlag() )
-  { 
-#endif
 #endif
   WRITE_UVLC( pcSPS->getChromaFormatIdc (),         "chroma_format_idc" );
@@ -675,9 +693,5 @@
   }
 #if H_MV
-#if H_MV_6_PS_REP_FORM_18_19_20
   if ( pcSPS->getLayerId() == 0 )
-#else
-  if ( pcSPS->getUpdateRepFormatFlag() )
-#endif
   { 
 #endif
@@ -784,5 +798,4 @@
   WRITE_FLAG( 0, "sps_extension_flag" );
 #else
-#if H_MV_6_PSEM_O0142_3
   WRITE_FLAG( pcSPS->getSpsExtensionFlag(), "sps_extension_flag" );
 
@@ -811,15 +824,4 @@
 #endif
   }
-#else
-  WRITE_FLAG( 1, "sps_extension_flag" );
-  codeSPSExtension( pcSPS ); 
-#if !H_3D
-  WRITE_FLAG( 0, "sps_extension2_flag" );
-#else
-  WRITE_FLAG( 1, "sps_extension2_flag" );
-  codeSPSExtension2( pcSPS, viewIndex, depthFlag ); 
-  WRITE_FLAG( 0, "sps_extension3_flag" );
-#endif  
-#endif
 #endif
 }
@@ -830,7 +832,4 @@
   WRITE_FLAG( pcSPS->getInterViewMvVertConstraintFlag() ? 1 : 0, "inter_view_mv_vert_constraint_flag" );
 
-#if !H_MV_6_SHVC_O0098_36
-  WRITE_UVLC( 0, "sps_shvc_reserved_zero_idc" ); 
-#else
   WRITE_UVLC( pcSPS->getNumScaledRefLayerOffsets( ), "num_scaled_ref_layer_offsets" );
 
@@ -846,5 +845,4 @@
     WRITE_SVLC( pcSPS->getScaledRefLayerBottomOffset( j ), "scaled_ref_layer_bottom_offset" );
   }
-#endif  
 }
 #endif
@@ -859,21 +857,4 @@
   WRITE_FLAG( pcSPS->getUseQTL() ? 1 : 0, "use_qtl_flag");
   WRITE_FLAG( pcSPS->getUsePC()  ? 1 : 0, "use_pc_flag");
-}
-#endif
-#if !CAM_HLS_F0136_F0045_F0082
-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" );
-    }
-  }
 }
 #endif
@@ -995,13 +976,9 @@
 {
   WRITE_FLAG( pcVPS->getAvcBaseLayerFlag() ? 1 : 0,          "avc_base_layer_flag" );
-#if H_MV_6_PS_O0109_24
   WRITE_FLAG( pcVPS->getVpsVuiPresentFlag() ? 1 : 0 , "vps_vui_present_flag" );
   if ( pcVPS->getVpsVuiPresentFlag() )
   {  
-#endif
   WRITE_CODE( pcVPS->getVpsVuiOffset( ), 16,                 "vps_vui_offset" );  // TBD
-#if H_MV_6_PS_O0109_24
-  }
-#endif
+  }
   WRITE_FLAG( pcVPS->getSplittingFlag() ? 1 : 0,             "splitting_flag" );
   
@@ -1050,5 +1027,4 @@
 
 
-#if H_MV_6_PS_O0109_22
     WRITE_CODE( pcVPS->getViewIdLen( ), 4, "view_id_len" );
     
@@ -1067,17 +1043,4 @@
       }
     }
-#else
-  // GT spec says: trac #39
-  // if ( pcVPS->getNumViews() > 1 )  
-  //   However, this is a bug in the text since, view_id_len_minus1 is needed to parse view_id_val. 
-  {
-    WRITE_CODE( pcVPS->getViewIdLenMinus1( ), 4, "view_id_len_minus1" );
-  }
-
-  for( Int i = 0; i < pcVPS->getNumViews(); i++ )
-  {
-    WRITE_CODE( pcVPS->getViewIdVal( i ), pcVPS->getViewIdLenMinus1( ) + 1, "view_id_val[i]" );
-  }
-#endif
 
 
@@ -1089,5 +1052,4 @@
     }
   }
-#if H_MV_6_ILDSD_O0120_26
   WRITE_FLAG( pcVPS->getVpsSubLayersMaxMinus1PresentFlag( ) ? 1 : 0 , "vps_sub_layers_max_minus1_present_flag" );
   if ( pcVPS->getVpsSubLayersMaxMinus1PresentFlag() )
@@ -1106,5 +1068,4 @@
     }
   }
-#endif
   WRITE_FLAG( pcVPS->getMaxTidRefPresentFlag( ) ? 1 : 0 , "max_tid_ref_present_flag" );
 
@@ -1113,5 +1074,4 @@
     for( Int i = 0; i < pcVPS->getMaxLayersMinus1(); i++ )
     {
-#if H_MV_6_ILDDS_O0225_30
       for( Int j = i + 1; j <= pcVPS->getMaxLayersMinus1(); j++ )
       {
@@ -1121,7 +1081,4 @@
         }
       }
-#else
-      WRITE_CODE( pcVPS->getMaxTidIlRefPicPlus1( i ), 3,       "max_tid_il_ref_pics_plus1[i]" );
-#endif
     }
   }
@@ -1137,7 +1094,5 @@
     {    
       WRITE_CODE( pcVPS->getProfileRefMinus1( i ), 6, "profile_ref_minus1[i]" );
-#if H_MV_6_PS_O0109_23
       pcVPS->checkProfileRefMinus1( i );      
-#endif
     }
     codePTL( pcVPS->getPTL( i ), pcVPS->getVpsProfilePresentFlag( i ), pcVPS->getMaxTLayers() - 1 );
@@ -1156,16 +1111,10 @@
   if( numOutputLayerSets > 1)
   {
-#if H_MV_6_PS_0109_25
     WRITE_CODE( pcVPS->getDefaultOneTargetOutputLayerIdc( ), 2, "default_one_target_output_layer_idc" );
     pcVPS->checkDefaultOneTargetOutputLayerIdc(); 
-#else
-    WRITE_FLAG( pcVPS->getDefaultOneTargetOutputLayerFlag( ) ? 1 : 0, "default_one_target_output_layer_flag" );
-#endif        
   }  
 
-#if H_MV_6_HRD_O0217_13
   assert( pcVPS->getOutputLayerFlag(0, 0) == pcVPS->inferOutputLayerFlag( 0, 0 )); 
   assert( pcVPS->getOutputLayerSetIdxMinus1( 0 ) == -1 ); 
-#endif
   for( Int i = 1; i < numOutputLayerSets; i++ )
   {
@@ -1178,5 +1127,4 @@
       }      
     }
-#if H_MV_6_HRD_O0217_13
     else
     { // These inference rules would also be helpful in spec text
@@ -1187,5 +1135,4 @@
       }
     }
-#endif
 
     if ( pcVPS->getProfileLevelTierIdxLen()  > 0 )
@@ -1195,10 +1142,8 @@
   }
 
-#if H_MV_6_GEN_0153_28
   if( pcVPS->getMaxLayersMinus1() > 0 )
   {
     WRITE_FLAG( pcVPS->getAltOutputLayerFlag( ) ? 1 : 0 , "alt_output_layer_flag" );
   }
-#endif
 
   WRITE_FLAG( pcVPS->getRepFormatIdxPresentFlag( ) ? 1 : 0 , "rep_format_idx_present_flag" );
@@ -1210,12 +1155,7 @@
   for (Int i = 0; i <= pcVPS->getVpsNumRepFormatsMinus1(); i++ )
   {    
-#if H_MV_6_PS_REP_FORM_18_19_20
     TComRepFormat* curRepFormat = pcVPS->getRepFormat(i);     
     TComRepFormat* prevRepFormat = i > 0 ? pcVPS->getRepFormat( i - 1) : NULL; 
     codeRepFormat( i, curRepFormat ,  prevRepFormat); 
-#else
-    TComRepFormat* pcRepFormat = pcVPS->getRepFormat(i);     
-    codeRepFormat( pcRepFormat ); 
-#endif
   }
 
@@ -1226,9 +1166,5 @@
       if( pcVPS->getVpsNumRepFormatsMinus1() > 0 )
       {
-#if H_MV_6_PS_REP_FORM_18_19_20
         WRITE_CODE( pcVPS->getVpsRepFormatIdx( i ), 8, "vps_rep_format_idx" );
-#else
-        WRITE_CODE( pcVPS->getVpsRepFormatIdx( i ), 4, "vps_rep_format_idx" );
-#endif
       }
     }
@@ -1236,5 +1172,4 @@
 
   WRITE_FLAG( pcVPS->getMaxOneActiveRefLayerFlag( ) ? 1 : 0, "max_one_active_ref_layer_flag" );
-#if H_MV_6_MISC_O0062_31
   for( Int i = 1; i  <=  pcVPS->getMaxLayersMinus1(); i++ )
   {
@@ -1244,15 +1179,8 @@
     }
   }
-#endif
-#if H_MV_6_HRD_O0217_13
   codeDpbSize( pcVPS ); 
-#endif
-
-#if !H_MV_6_PS_O0223_29
-  WRITE_FLAG( pcVPS->getCrossLayerIrapAlignedFlag( ) ? 1 : 0 , "cross_layer_irap_aligned_flag" );
-#endif
+
   WRITE_UVLC( pcVPS->getDirectDepTypeLenMinus2 ( ),         "direct_dep_type_len_minus2"); 
 
-#if H_MV_6_PS_O0096_21
   WRITE_FLAG( pcVPS->getDefaultDirectDependencyFlag( ) ? 1 : 0 , "default_direct_dependency_flag" );
 
@@ -1280,21 +1208,5 @@
     }
   }  
-#else
-    for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); 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]" );
-        }
-      }
-    }
-#endif
     WRITE_FLAG ( 0,                                      "vps_shvc_reserved_zero_flag" ); 
-#if !H_MV_6_PS_O0109_24
-    WRITE_FLAG( pcVPS->getVpsVuiPresentFlag( ) ? 1 : 0 , "vps_vui_present_flag" );
-#endif
 
     if( pcVPS->getVpsVuiPresentFlag() )
@@ -1304,5 +1216,4 @@
     }     
 }
-#if H_MV_6_PS_O0118_33
 Void TEncCavlc::codeVideoSignalInfo( TComVideoSignalInfo* pcVideoSignalInfo )
 {
@@ -1314,7 +1225,5 @@
   WRITE_CODE( pcVideoSignalInfo->getMatrixCoeffsVps( ), 8, "matrix_coeffs_vps" );
 }
-#endif
-
-#if H_MV_6_HRD_O0217_13
+
 Void TEncCavlc::codeDpbSize( TComVPS* vps )
 { 
@@ -1356,15 +1265,9 @@
   }  
 }
-#endif
-
-#if H_MV_6_PS_REP_FORM_18_19_20
+
 Void TEncCavlc::codeRepFormat( Int i, TComRepFormat* pcRepFormat, TComRepFormat* pcPrevRepFormat )
-#else
-Void TEncCavlc::codeRepFormat( TComRepFormat* pcRepFormat )
-#endif
 {
   assert( pcRepFormat ); 
 
-#if H_MV_6_PS_REP_FORM_18_19_20
   WRITE_CODE( pcRepFormat->getPicWidthVpsInLumaSamples( ),  16, "pic_width_vps_in_luma_samples" );
   WRITE_CODE( pcRepFormat->getPicHeightVpsInLumaSamples( ), 16, "pic_height_vps_in_luma_samples" );
@@ -1375,5 +1278,4 @@
   if ( pcRepFormat->getChromaAndBitDepthVpsPresentFlag() )
   {  
-#endif
   WRITE_CODE( pcRepFormat->getChromaFormatVpsIdc( ), 2, "chroma_format_vps_idc" );
 
@@ -1382,11 +1284,6 @@
     WRITE_FLAG( pcRepFormat->getSeparateColourPlaneVpsFlag( ) ? 1 : 0 , "separate_colour_plane_vps_flag" );
   }
-#if !H_MV_6_PS_REP_FORM_18_19_20
-  WRITE_CODE( pcRepFormat->getPicWidthVpsInLumaSamples( ),  16, "pic_width_vps_in_luma_samples" );
-  WRITE_CODE( pcRepFormat->getPicHeightVpsInLumaSamples( ), 16, "pic_height_vps_in_luma_samples" );
-#endif
   WRITE_CODE( pcRepFormat->getBitDepthVpsLumaMinus8( ),      4, "bit_depth_vps_luma_minus8" );
   WRITE_CODE( pcRepFormat->getBitDepthVpsChromaMinus8( ),    4, "bit_depth_vps_chroma_minus8" );
-#if H_MV_6_PS_REP_FORM_18_19_20
   }
   else
@@ -1394,5 +1291,4 @@
     pcRepFormat->inferChromaAndBitDepth(pcPrevRepFormat, true ); 
   }
-#endif
 }
 
@@ -1405,5 +1301,4 @@
   assert( pcVPSVUI ); 
 
-#if H_MV_6_PS_O0223_29
   WRITE_FLAG( pcVPSVUI->getCrossLayerPicTypeAlignedFlag( ) ? 1 : 0 , "cross_layer_pic_type_aligned_flag" );
   if ( !pcVPSVUI->getCrossLayerPicTypeAlignedFlag() )
@@ -1411,5 +1306,4 @@
     WRITE_FLAG( pcVPSVUI->getCrossLayerIrapAlignedFlag( ) ? 1 : 0 , "cross_layer_irap_aligned_flag" );
   }
-#endif
 
   WRITE_FLAG( pcVPSVUI->getBitRatePresentVpsFlag( ) ? 1 : 0 , "bit_rate_present_vps_flag" );
@@ -1443,5 +1337,4 @@
   }
 
-#if H_MV_6_O0226_37
   WRITE_FLAG( pcVPSVUI->getTilesNotInUseFlag( ) ? 1 : 0 , "tiles_not_in_use_flag" );
   if( !pcVPSVUI->getTilesNotInUseFlag() ) 
@@ -1478,13 +1371,4 @@
     }
   }
-#else
-  for( Int i = 1; i  <=  pcVPS->getMaxLayersMinus1(); i++ )
-  {
-    for( Int  j = 0; j < pcVPS->getNumDirectRefLayers( pcVPS->getLayerIdInNuh( i ) ); j++ ) 
-    {
-      WRITE_FLAG( pcVPSVUI->getTileBoundariesAlignedFlag( i, j ) ? 1 : 0 , "tile_boundaries_aligned_flag" );
-    }
-  }
-#endif
   WRITE_FLAG( pcVPSVUI->getIlpRestrictedRefLayersFlag( ) ? 1 : 0 , "ilp_restricted_ref_layers_flag" );
 
@@ -1507,5 +1391,4 @@
     }
   }
-#if H_MV_6_PS_O0118_33
   WRITE_FLAG( pcVPSVUI->getVideoSignalInfoIdxPresentFlag( ) ? 1 : 0 , "video_signal_info_idx_present_flag" );
   if( pcVPSVUI->getVideoSignalInfoIdxPresentFlag() )
@@ -1540,6 +1423,4 @@
     }
   }
-#endif
-#if H_MV_6_HRD_O0164_15
   WRITE_FLAG( pcVPSVUI->getVpsVuiBspHrdPresentFlag( ) ? 1 : 0 , "vps_vui_bsp_hrd_present_flag" );
   if ( pcVPSVUI->getVpsVuiBspHrdPresentFlag( ) )
@@ -1547,7 +1428,5 @@
     codeVpsVuiBspHrdParameters( pcVPS ); 
   }
-#endif
-}
-#if H_MV_6_HRD_O0164_15
+}
 Void TEncCavlc::codeVpsVuiBspHrdParameters( TComVPS* pcVPS )
 {
@@ -1606,5 +1485,4 @@
   }  
 }  
-#endif
 
 #endif
@@ -1621,5 +1499,5 @@
 #if H_3D_IV_MERGE
         WRITE_FLAG( pcVPS->getIvMvPredFlag         ( i ) ? 1 : 0 , "iv_mv_pred_flag[i]");
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
         WRITE_UVLC( pcVPS->getSubPULog2Size(i)-2, "log2_sub_PU_size_minus2[i]");
 #endif
@@ -1637,11 +1515,9 @@
       else
       {
-#if QC_DEPTH_IV_MRG_F0125
         if(i!=1)
         {
           WRITE_FLAG( pcVPS->getIvMvPredFlag         ( i ) ? 1 : 0 , "iv_mv_pred_flag[i]");
         }
-#endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
         if (i!=1)
         {
@@ -1649,26 +1525,9 @@
         }
 #endif
-#if SEC_MPI_ENABLING_MERGE_F0150
+#if H_3D_IV_MERGE
         WRITE_FLAG( pcVPS->getMPIFlag( i ) ? 1 : 0 ,          "mpi_flag[i]" );
 #endif
         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 !DLT_DIFF_CODING_IN_PPS
-        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
-#endif
 #if H_3D_INTER_SDC
         WRITE_FLAG( pcVPS->getInterSDCFlag( i ) ? 1 : 0, "depth_inter_SDC_flag" );
@@ -1677,5 +1536,4 @@
     }  
   }
-#if CAM_HLS_F0136_F0045_F0082
   WRITE_UVLC( pcVPS->getCamParPrecision(), "cp_precision" );
   for (UInt viewIndex=0; viewIndex<pcVPS->getNumViews(); viewIndex++)
@@ -1697,5 +1555,4 @@
     }
   }
-#endif
 #if H_3D_TMVP
   WRITE_FLAG( pcVPS->getIvMvScalingFlag( ) ? 1 : 0 ,          "iv_mv_scaling_flag" );
@@ -1739,4 +1596,11 @@
     WRITE_FLAG( 0, "no_output_of_prior_pics_flag" );
   }
+#if PPS_FIX_DEPTH
+  if( pcSlice->getIsDepth() )
+  {
+    WRITE_UVLC( 1, "slice_pic_parameter_set_id" );
+  }
+  else
+#endif
   WRITE_UVLC( pcSlice->getPPS()->getPPSId(), "slice_pic_parameter_set_id" );
   pcSlice->setDependentSliceSegmentFlag(!pcSlice->isNextSlice());
@@ -1753,5 +1617,18 @@
 #if H_MV    
     Int esb = 0;  //Don't use i, otherwise will shadow something below
-#if !H_MV_6_RALS_O0149_11
+
+    if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
+    {
+      esb++; 
+      WRITE_FLAG( pcSlice->getDiscardableFlag( ) ? 1 : 0 , "discardable_flag" );
+    }
+
+    if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
+    {
+      esb++; 
+      WRITE_FLAG( pcSlice->getCrossLayerBlaFlag( ) ? 1 : 0 , "cross_layer_bla_flag" );
+    }
+    pcSlice->checkCrossLayerBlaFlag( ); 
+
     if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
     {
@@ -1759,26 +1636,4 @@
       WRITE_FLAG( pcSlice->getPocResetFlag( ) ? 1 : 0 , "poc_reset_flag" );
     }
-#endif
-
-    if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
-    {
-      esb++; 
-      WRITE_FLAG( pcSlice->getDiscardableFlag( ) ? 1 : 0 , "discardable_flag" );
-    }
-
-#if H_MV_6_RALS_O0149_11
-    if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
-    {
-      esb++; 
-      WRITE_FLAG( pcSlice->getCrossLayerBlaFlag( ) ? 1 : 0 , "cross_layer_bla_flag" );
-    }
-    pcSlice->checkCrossLayerBlaFlag( ); 
-
-    if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
-    {
-      esb++; 
-      WRITE_FLAG( pcSlice->getPocResetFlag( ) ? 1 : 0 , "poc_reset_flag" );
-    }
-#endif
 
 
@@ -1804,6 +1659,5 @@
     // if( separate_colour_plane_flag  ==  1 )
     //   colour_plane_id                                      u(2)
-
-#if H_MV_6_POC_31_35_38
+#if H_MV
     if ( (pcSlice->getLayerId() > 0 && !vps->getPocLsbNotPresentFlag( pcSlice->getLayerIdInVps())) || !pcSlice->getIdrPicFlag() )
     {
@@ -1814,5 +1668,5 @@
     if( !pcSlice->getIdrPicFlag() )
     {
-#if !H_MV_6_POC_31_35_38
+#if !H_MV
       Int picOrderCntLSB = (pcSlice->getPOC()-pcSlice->getLastIDR()+(1<<pcSlice->getSPS()->getBitsForPOC())) & ((1<<pcSlice->getSPS()->getBitsForPOC())-1);
       WRITE_CODE( picOrderCntLSB, pcSlice->getSPS()->getBitsForPOC(), "pic_order_cnt_lsb");
@@ -1931,7 +1785,5 @@
     }
 #if H_MV
-#if H_MV_6_ILDDS_ILREFPICS_27_34
     Bool interLayerPredLayerIdcPresentFlag = false; 
-#endif
     Int layerId = pcSlice->getLayerId(); 
     if( pcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumDirectRefLayers( layerId ) > 0 )
@@ -1946,7 +1798,5 @@
         if ( pcSlice->getNumActiveRefLayerPics() != vps->getNumDirectRefLayers( layerId ) )
         {        
-#if H_MV_6_ILDDS_ILREFPICS_27_34
           interLayerPredLayerIdcPresentFlag = true; 
-#endif
           for( Int idx = 0; idx < pcSlice->getNumActiveRefLayerPics(); idx++ )   
           {
@@ -1956,5 +1806,4 @@
       }  
     }
-#if H_MV_6_ILDDS_ILREFPICS_27_34
     if ( !interLayerPredLayerIdcPresentFlag )
     {
@@ -1964,5 +1813,4 @@
       }
     }
-#endif
 #endif
     if(pcSlice->getSPS()->getUseSAO())
@@ -1983,4 +1831,7 @@
     {
       Bool overrideFlag = (pcSlice->getNumRefIdx( REF_PIC_LIST_0 )!=pcSlice->getPPS()->getNumRefIdxL0DefaultActive()||(pcSlice->isInterB()&&pcSlice->getNumRefIdx( REF_PIC_LIST_1 )!=pcSlice->getPPS()->getNumRefIdxL1DefaultActive()));
+#if PPS_FIX_DEPTH
+      overrideFlag |= (pcSlice->getIsDepth() && !pcSlice->getViewIndex());
+#endif
       WRITE_FLAG( overrideFlag ? 1 : 0,                               "num_ref_idx_active_override_flag");
       if (overrideFlag) 
@@ -2002,6 +1853,9 @@
       pcSlice->setNumRefIdx(REF_PIC_LIST_1, 0);
     }
-
+#if PPS_FIX_DEPTH
+    if( (pcSlice->getPPS()->getListsModificationPresentFlag() || (pcSlice->getIsDepth() && !pcSlice->getViewIndex())) && pcSlice->getNumRpsCurrTempList() > 1)
+#else
     if( pcSlice->getPPS()->getListsModificationPresentFlag() && pcSlice->getNumRpsCurrTempList() > 1)
+#endif
     {
       TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification();
@@ -2086,9 +1940,5 @@
     }
 #if H_3D_IC
-#if SEC_ONLY_TEXTURE_IC_F0151
     else if( pcSlice->getViewIndex() && ( pcSlice->getSliceType() == P_SLICE || pcSlice->getSliceType() == B_SLICE ) && !pcSlice->getIsDepth())
-#else
-    else if( pcSlice->getViewIndex() && ( pcSlice->getSliceType() == P_SLICE || pcSlice->getSliceType() == B_SLICE ) )
-#endif
     {
       WRITE_FLAG( pcSlice->getApplyIC() ? 1 : 0, "slice_ic_enable_flag" );
@@ -2108,5 +1958,4 @@
     {
 #if H_3D_IV_MERGE
-#if SEC_MPI_ENABLING_MERGE_F0150
       if(pcSlice->getIsDepth())
       {
@@ -2120,8 +1969,4 @@
         WRITE_UVLC( ( ivMvPredFlag ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS ) - pcSlice->getMaxNumMergeCand(), "five_minus_max_num_merge_cand");
       }
-#else
-      Bool ivMvPredFlag = pcSlice->getVPS()->getIvMvPredFlag( pcSlice->getLayerIdInVps() ) ;
-      WRITE_UVLC( ( ivMvPredFlag ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS ) - pcSlice->getMaxNumMergeCand(), "five_minus_max_num_merge_cand");
-#endif
 #else
       WRITE_UVLC(MRG_MAX_NUM_CANDS - pcSlice->getMaxNumMergeCand(), "five_minus_max_num_merge_cand");
@@ -2162,14 +2007,6 @@
     }
   }
-#if CAM_HLS_F0044
-#if QC_DEPTH_IV_MRG_F0125
-#if CAM_HLS_F0136_F0045_F0082
+#if H_3D
   if( pcSlice->getVPS()->hasCamParInSliceHeader( pcSlice->getViewIndex() ) && !pcSlice->getIsDepth() )
-#else
-  if( pcSlice->getSPS()->hasCamParInSliceHeader() && !pcSlice->getIsDepth() )
-#endif
-#else
-  if( pcSlice->getSPS()->hasCamParInSliceHeader() )
-#endif
   {
     for( UInt uiId = 0; uiId < pcSlice->getViewIndex(); uiId++ )
@@ -2183,36 +2020,11 @@
 #endif
 
+#if PPS_FIX_DEPTH
+  if(pcSlice->getPPS()->getSliceHeaderExtensionPresentFlag() || pcSlice->getIsDepth() )
+#else
   if(pcSlice->getPPS()->getSliceHeaderExtensionPresentFlag())
-  {
-#if !H_3D || CAM_HLS_F0044
+#endif
+  {
     WRITE_UVLC(0,"slice_header_extension_length");
-#else
-    WRITE_UVLC(0,"slice_header_extension_length"); //<- this element needs to be set to the correct value!!
-#if QC_DEPTH_IV_MRG_F0125
-#if CAM_HLS_F0136_F0045_F0082
-    if( pcSlice->getVPS()->hasCamParInSliceHeader( pcSlice->getViewIndex() ) && !pcSlice->getIsDepth() )
-#else
-    if( pcSlice->getSPS()->hasCamParInSliceHeader() && !pcSlice->getIsDepth() )
-#endif
-#else
-    if( pcSlice->getSPS()->hasCamParInSliceHeader() )
-#endif
-    {
-      for( UInt uiId = 0; uiId < pcSlice->getViewIndex(); uiId++ )
-      {
-        WRITE_SVLC( pcSlice->getCodedScale    ()[ uiId ],                                     "cp_scale" );
-        WRITE_SVLC( pcSlice->getCodedOffset   ()[ uiId ],                                     "cp_off" );
-        WRITE_SVLC( pcSlice->getInvCodedScale ()[ uiId ] + pcSlice->getCodedScale ()[ uiId ], "cp_inv_scale_plus_scale" );
-        WRITE_SVLC( pcSlice->getInvCodedOffset()[ uiId ] + pcSlice->getCodedOffset()[ uiId ], "cp_inv_off_plus_off" );
-      }
-    }
-
-    Bool sliceSegmentHeaderExtension2Flag = false; 
-    WRITE_FLAG( sliceSegmentHeaderExtension2Flag ? 1 : 0 , "slice_segment_header_extension2_flag" ); 
-    if ( sliceSegmentHeaderExtension2Flag )
-    {
-      WRITE_UVLC(0,"slice_header_extension2_length");
-    }
-#endif
   }
 }
Index: trunk/source/Lib/TLibEncoder/TEncCavlc.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncCavlc.h	(revision 759)
+++ trunk/source/Lib/TLibEncoder/TEncCavlc.h	(revision 773)
@@ -86,21 +86,11 @@
 #if H_MV
   Void  codeVPSExtension       ( TComVPS *pcVPS );
-#if H_MV_6_PS_O0118_33
   Void  codeVideoSignalInfo     ( TComVideoSignalInfo* pcVideoSignalInfo ); 
-#endif
 
-#if H_MV_6_HRD_O0217_13
   Void  codeDpbSize   ( TComVPS* vps );
-#endif
 
-#if H_MV_6_PS_REP_FORM_18_19_20
   Void  codeRepFormat           ( Int i, TComRepFormat* curRepFormat, TComRepFormat* prevRepFormat );
-#else
-  Void  codeRepFormat          ( TComRepFormat* pcRepFormat );
-#endif
   Void  codeVPSVUI             ( TComVPS* pcVPS );
-#if H_MV_6_HRD_O0164_15
   Void  codeVpsVuiBspHrdParameters( TComVPS* pcVPS ); 
-#endif
 #endif 
   Void  codeVUI                 ( TComVUI *pcVUI, TComSPS* pcSPS );
@@ -117,5 +107,5 @@
   Void  codePPS                 ( TComPPS* pcPPS );
 
-#if DLT_DIFF_CODING_IN_PPS
+#if H_3D
   Void  codePPSExtension        ( TComPPS* pcPPS );
 #endif
Index: trunk/source/Lib/TLibEncoder/TEncCfg.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncCfg.h	(revision 759)
+++ trunk/source/Lib/TLibEncoder/TEncCfg.h	(revision 773)
@@ -331,5 +331,5 @@
 #endif
 
-#if DLT_DIFF_CODING_IN_PPS
+#if H_3D
   TComDLT*  m_cDLT;
 #endif
@@ -408,5 +408,5 @@
   UInt      m_uiARPStepNum;
 #endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
   Int      m_iSubPULog2Size;
 #endif
@@ -420,11 +420,8 @@
 #if H_3D_DIM
   Bool      m_useDMM;
-#if !SEC_DMM3_RBC_F0147
-  Bool      m_useRBC;
-#endif
   Bool      m_useSDC;
   Bool      m_useDLT;
 #endif
-#if SEC_MPI_ENABLING_MERGE_F0150
+#if H_3D_IV_MERGE
   Bool      m_useMPI;
 #endif
@@ -514,5 +511,5 @@
   Void       setARPStepNum                  ( UInt  u )      { m_uiARPStepNum = u;       }
 #endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
   Int        getSubPULog2Size                   ()                   { return m_iSubPULog2Size;}
   Void       setSubPULog2Size                   (Int u)              { m_iSubPULog2Size = u; }     
@@ -873,5 +870,5 @@
 #endif
 
-#if DLT_DIFF_CODING_IN_PPS
+#if H_3D
   Void      setDLT           ( TComDLT *p ) { m_cDLT = p; }
   TComDLT*  getDLT           ()             { return m_cDLT; }
@@ -1003,8 +1000,4 @@
   Bool      getUseDMM                       ()        { return m_useDMM; }
   Void      setUseDMM                       ( Bool b) { m_useDMM = b;    }
-#if !SEC_DMM3_RBC_F0147
-  Bool      getUseRBC                       ()        { return m_useRBC; }
-  Void      setUseRBC                       ( Bool b) { m_useRBC = b;    }
-#endif
   Bool      getUseSDC                       ()        { return m_useSDC; }
   Void      setUseSDC                       ( Bool b) { m_useSDC = b;    }
@@ -1018,5 +1011,5 @@
   Bool      getUsePC                        ()         { return m_bUsePC;  }
 #endif
-#if SEC_MPI_ENABLING_MERGE_F0150
+#if H_3D_IV_MERGE
   Void      setUseMPI                       ( Bool b ) { m_useMPI = b;    }
   Bool      getUseMPI                       ()         { return m_useMPI; }
Index: trunk/source/Lib/TLibEncoder/TEncCu.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncCu.cpp	(revision 759)
+++ trunk/source/Lib/TLibEncoder/TEncCu.cpp	(revision 773)
@@ -497,9 +497,5 @@
 #endif
 #if H_3D_IC
-#if SEC_ONLY_TEXTURE_IC_F0151
   Bool bICEnabled = rpcTempCU->getSlice()->getViewIndex() && ( rpcTempCU->getSlice()->getSliceType() == P_SLICE || rpcTempCU->getSlice()->getSliceType() == B_SLICE ) && !rpcTempCU->getSlice()->getIsDepth();
-#else
-  Bool bICEnabled = rpcTempCU->getSlice()->getViewIndex() && ( rpcTempCU->getSlice()->getSliceType() == P_SLICE || rpcTempCU->getSlice()->getSliceType() == B_SLICE );
-#endif
   bICEnabled = bICEnabled && rpcTempCU->getSlice()->getApplyIC();
 #endif
@@ -571,5 +567,5 @@
           PartSize ePartTemp = rpcTempCU->getPartitionSize(0);
           rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );     
-#if QC_DEPTH_IV_MRG_F0125
+#if H_3D_IV_MERGE
           if (rpcTempCU->getSlice()->getIsDepth() )
           {
@@ -586,5 +582,5 @@
             DvInfo.bDV = rpcTempCU->getDisMvpCandNBDV(&DvInfo);
 
-#if QC_DEPTH_IV_MRG_F0125
+#if H_3D_IV_MERGE
           }
 #endif
@@ -1779,5 +1775,5 @@
 #endif
 
-#if H_3D_ARP && LGE_SHARP_VSP_INHERIT_F0104 
+#if H_3D_ARP
   DisInfo cOrigDisInfo = rpcTempCU->getDvInfo(0);
 #else
@@ -1787,9 +1783,8 @@
 
 #if H_3D_VSP
-#if !(H_3D_ARP && LGE_SHARP_VSP_INHERIT_F0104)
+#if !H_3D_ARP
   Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
   memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
   InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
-#if ETRIKHU_MERGE_REUSE_F0093
   rpcTempCU->m_bAvailableFlagA1 = 0;
   rpcTempCU->m_bAvailableFlagB1 = 0;
@@ -1799,10 +1794,7 @@
   rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
   rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, vspFlag,inheritedVSPDisInfo, numValidMergeCand );
-#else
-  rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand );
-#endif
-#endif
-#else
-#if ETRIKHU_MERGE_REUSE_F0093
+#endif
+#else
+#if H_3D
   rpcTempCU->m_bAvailableFlagA1 = 0;
   rpcTempCU->m_bAvailableFlagB1 = 0;
@@ -1822,5 +1814,5 @@
   Int mergeCandBuffer[MRG_MAX_NUM_CANDS];
 #endif
-#if H_3D_ARP && LGE_SHARP_VSP_INHERIT_F0104
+#if H_3D_ARP
 for( UInt ui = 0; ui < rpcTempCU->getSlice()->getMaxNumMergeCand(); ++ui )
 #else
@@ -1851,10 +1843,5 @@
   for( Int nARPW=nARPWMax; nARPW >= 0 ; nARPW-- )
   {
-#if FIX_MISSING_MACRO_R690
     memset( mergeCandBuffer, 0, MRG_MAX_NUM_CANDS_MEM*sizeof(Int) );
-#else
-    memset( mergeCandBuffer, 0, MRG_MAX_NUM_CANDS*sizeof(Int) );
-#endif
-#if LGE_SHARP_VSP_INHERIT_F0104
     rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level
     rpcTempCU->setCUTransquantBypassSubParts( m_pcEncCfg->getCUTransquantBypassFlagValue(), 0, uhDepth );
@@ -1868,5 +1855,5 @@
     memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
     InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
     Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM];
     memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
@@ -1876,9 +1863,9 @@
     puhInterDirSP = new UChar[rpcTempCU->getPic()->getPicSym()->getNumPartition()]; 
 #endif
-#if ETRIKHU_MERGE_REUSE_F0093
+#if H_3D
     rpcTempCU->initAvailableFlags();
     rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
     rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, vspFlag,inheritedVSPDisInfo
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
       , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP
 #endif
@@ -1888,5 +1875,5 @@
     rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand );
 #endif
-#endif
+
 #endif
   for( UInt uiNoResidual = 0; uiNoResidual < iteration; ++uiNoResidual )
@@ -1923,5 +1910,5 @@
           rpcTempCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeCand].m_acDvInfo, 0, 0, uhDepth );
 #endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
           rpcTempCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeCand], 0, 0, uhDepth);
           if (bSPIVMPFlag[uiMergeCand])
@@ -1949,28 +1936,5 @@
             rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
             rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
-#if MTK_SPIVMP_F0110
-          }
-#endif
-#if H_3D_ARP && !QC_MTK_INTERVIEW_ARP_F0123_F0108
-          if( nARPW )
-          {
-            Bool bSignalflag[2] = { true, true };
-            for( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx ++ )
-            {
-              Int iRefIdx = cMvFieldNeighbours[uiRefListIdx + 2*uiMergeCand].getRefIdx();
-              RefPicList eRefList = uiRefListIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
-              if( iRefIdx < 0 || rpcTempCU->getSlice()->getPOC() == rpcTempCU->getSlice()->getRefPOC(eRefList, iRefIdx) )
-              {
-                bSignalflag[uiRefListIdx] = false;
-              }
-            }
-            if( !bSignalflag[0] && !bSignalflag[1] )
-            {
-#if LGE_SHARP_VSP_INHERIT_F0104
-              continue;
-#else
-              rpcTempCU->setARPWSubParts( 0 , 0 , uhDepth );
-#endif
-            }
+#if H_3D_SPIVMP
           }
 #endif
@@ -2093,12 +2057,7 @@
   }
  }
-#if MTK_SPIVMP_F0110
-#if MTK_F0110_FIX
+#if H_3D_SPIVMP
  delete[] pcMvFieldSP;
  delete[] puhInterDirSP;
-#else
- delete pcMvFieldSP;
- delete puhInterDirSP;
-#endif
 #endif
 #if H_3D_ARP
@@ -2170,24 +2129,4 @@
 
     m_pcPredSearch->motionCompensation( rpcTempCU , m_ppcPredYuvTemp[uhDepth] );
-
-#if !QC_MTK_INTERVIEW_ARP_F0123_F0108
-    if(rpcTempCU->getPartitionSize(0)==SIZE_2Nx2N)
-    {
-      Bool bSignalflag[2] = { true, true };
-      for(UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx ++ )
-      {
-        RefPicList eRefList = uiRefListIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
-        Int iRefIdx = rpcTempCU->getCUMvField(eRefList)->getRefIdx(0);
-        if( iRefIdx < 0 || rpcTempCU->getSlice()->getPOC() == rpcTempCU->getSlice()->getRefPOC(eRefList, iRefIdx) )
-        {
-          bSignalflag[uiRefListIdx] = false;
-        }
-      }
-      if( !bSignalflag[0] && !bSignalflag[1] )
-      {
-        rpcTempCU->setARPWSubParts( 0 , 0 , uhDepth );
-      }
-    }
-#endif
   }
   else
@@ -2209,21 +2148,4 @@
    {
      m_ppcWeightedTempCU[uhDepth]->copyPartFrom( rpcTempCU , 0 , uhDepth );
-
-#if !QC_MTK_INTERVIEW_ARP_F0123_F0108
-     Bool bSignalflag[2] = { true, true };
-     for(UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx ++ )
-     {
-       RefPicList eRefList = uiRefListIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
-       Int iRefIdx = rpcTempCU->getCUMvField(eRefList)->getRefIdx(0);
-       if( iRefIdx < 0 || rpcTempCU->getSlice()->getPOC() == rpcTempCU->getSlice()->getRefPOC(eRefList, iRefIdx) )
-       {
-         bSignalflag[uiRefListIdx] = false;
-       }
-     }
-     if( !bSignalflag[0] && !bSignalflag[1])
-     {
-       rpcTempCU->setARPWSubParts( 0 , 0 , uhDepth );
-     }
-#endif
    }
   }
Index: trunk/source/Lib/TLibEncoder/TEncEntropy.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 759)
+++ trunk/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 773)
@@ -160,9 +160,5 @@
 Void TEncEntropy::encodeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
 {
-#if SEC_ONLY_TEXTURE_IC_F0151
   if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() )
-#else
-  if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) )
-#endif
   {
     return;
Index: trunk/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 759)
+++ trunk/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 773)
@@ -664,9 +664,5 @@
     refPicListModification->setRefPicListModificationFlagL1(0);
 #if H_MV
-#if H_MV_6_RALS_O0149_11
     if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > 0 )
-#else
-    if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > 1 )
-#endif
     {
       // Some more sophisticated algorithm to determine discardable_flag might be added here. 
@@ -678,7 +674,5 @@
     GOPEntry gopEntry      = m_pcCfg->getGOPEntry( (pcSlice->getRapPicFlag() && getLayerId() > 0) ? MAX_GOP : iGOPid );     
     
-#if H_MV_6_ILDDS_ILREFPICS_27_34
     Bool interLayerPredLayerIdcPresentFlag = false; 
-#endif
     if ( getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && numDirectRefLayers > 0 )
     {         
@@ -692,7 +686,5 @@
         if ( gopEntry.m_numActiveRefLayerPics != vps->getNumDirectRefLayers( getLayerId() ) )
         {        
-#if H_MV_6_ILDDS_ILREFPICS_27_34
           interLayerPredLayerIdcPresentFlag = true; 
-#endif
           for (Int i = 0; i < gopEntry.m_numActiveRefLayerPics; i++ )
           {
@@ -702,5 +694,4 @@
       }
     }
-#if H_MV_6_ILDDS_ILREFPICS_27_34
     if ( !interLayerPredLayerIdcPresentFlag )
     {
@@ -710,5 +701,4 @@
       }
     }
-#endif
 
 
@@ -745,9 +735,5 @@
 #if H_3D_ARP
     //GT: This seems to be broken when layerId in vps is not equal to layerId in nuh
-#if SHARP_ARP_REF_CHECK_F0105
     pcSlice->setARPStepNum(m_ivPicLists);
-#else
-    pcSlice->setARPStepNum();
-#endif
     if(pcSlice->getARPStepNum() > 1)
     {
@@ -1319,4 +1305,8 @@
       nalu = NALUnit(NAL_UNIT_PPS);
 #endif
+#if PPS_FIX_DEPTH
+      if(!pcSlice->getIsDepth() || !pcSlice->getViewIndex() )
+      {
+#endif
       m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
       m_pcEntropyCoder->encodePPS(pcSlice->getPPS());
@@ -1326,5 +1316,7 @@
       actualTotalBits += UInt(accessUnit.back()->m_nalUnitData.str().size()) * 8;
 #endif
-
+#if PPS_FIX_DEPTH
+      }
+#endif
       xCreateLeadingSEIMessages(accessUnit, pcSlice->getSPS());
 
Index: trunk/source/Lib/TLibEncoder/TEncSbac.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 759)
+++ trunk/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 773)
@@ -95,10 +95,4 @@
 #if H_3D_DIM_DMM
 , m_cDmm1DataSCModel          ( 1,             1,               NUM_DMM1_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
-#if !SEC_DMM3_RBC_F0147
-, m_cDmm3DataSCModel          ( 1,             1,               NUM_DMM3_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
-#endif
-#endif
-#if H_3D_DIM_RBC
-, m_cRbcDataSCModel           ( 1,             1,               NUM_RBC_DATA_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
 #endif
 #if H_3D_DIM_SDC
@@ -176,10 +170,4 @@
 #if H_3D_DIM_DMM
   m_cDmm1DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM1_DATA );
-#if !SEC_DMM3_RBC_F0147
-  m_cDmm3DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM3_DATA );
-#endif
-#endif
-#if H_3D_DIM_RBC
-  m_cRbcDataSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_RBC_DATA );
 #endif
 #if H_3D_DIM_SDC
@@ -266,10 +254,4 @@
 #if H_3D_DIM_DMM
       curCost += m_cDmm1DataSCModel.calcCost          ( curSliceType, qp, (UChar*)INIT_DMM1_DATA );
-#if !SEC_DMM3_RBC_F0147
-      curCost += m_cDmm3DataSCModel.calcCost          ( curSliceType, qp, (UChar*)INIT_DMM3_DATA );
-#endif
-#endif
-#if H_3D_DIM_RBC
-      curCost += m_cRbcDataSCModel.calcCost           ( curSliceType, qp, (UChar*)INIT_RBC_DATA );
 #endif
     }
@@ -337,10 +319,4 @@
 #if H_3D_DIM_DMM
   m_cDmm1DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM1_DATA );
-#if !SEC_DMM3_RBC_F0147
-  m_cDmm3DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM3_DATA );
-#endif
-#endif
-#if H_3D_DIM_RBC
-  m_cRbcDataSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_RBC_DATA );
 #endif
 #if H_3D_DIM_SDC
@@ -526,5 +502,4 @@
 }
 
-#if QC_DIM_DELTADC_UNIFY_F0132
 Void TEncSbac::xCodeDimDeltaDC( Pel valDeltaDC, UInt uiNumSeg )
 {
@@ -536,15 +511,4 @@
   }
 }
-#else
-Void TEncSbac::xCodeDimDeltaDC( Pel valDeltaDC, UInt dimType )
-{
-  xWriteExGolombLevel( UInt( abs( valDeltaDC ) ), m_cDdcDataSCModel.get(0, 0, (RBC_IDX == dimType) ? 1 : 0) );
-  if( valDeltaDC != 0 )
-  {
-    UInt uiSign = valDeltaDC > 0 ? 0 : 1;
-    m_pcBinIf->encodeBinEP( uiSign );
-  }
-}
-#endif
 
 #if H_3D_DIM_DMM
@@ -557,64 +521,6 @@
 }
 
-#if !SEC_DMM3_RBC_F0147
-Void TEncSbac::xCodeDmm3WedgeIdx( UInt uiIntraIdx, Int iNumBit )
-{
-  for( Int i = 0; i < iNumBit; i++ )
-  {
-    m_pcBinIf->encodeBin( ( uiIntraIdx >> i ) & 1, m_cDmm3DataSCModel.get(0, 0, 0) );
-  }
-}
-#endif
-#endif
-#if H_3D_DIM_RBC
-Void TEncSbac::xCodeRbcEdge( TComDataCU* pcCU, UInt uiAbsPartIdx )
-{
-  UInt   uiDepth        = pcCU->getDepth( uiAbsPartIdx ) + (pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ? 1 : 0);
-  UChar* pucSymbolList  = pcCU->getEdgeCode     ( uiAbsPartIdx );
-  UChar  ucEdgeNumber   = pcCU->getEdgeNumber   ( uiAbsPartIdx );
-  Bool   bLeft          = pcCU->getEdgeLeftFirst( uiAbsPartIdx );
-  UChar  ucStart        = pcCU->getEdgeStartPos ( uiAbsPartIdx );
-  UInt   uiSymbol;
-
-  // 1. Top(0) or Left(1)
-  uiSymbol = (bLeft == false) ? 0 : 1;
-  m_pcBinIf->encodeBinEP( uiSymbol );
-
-  // 2. Start position (lowest bit first)
-  uiSymbol = ucStart;
-  for( UInt ui = 6; ui > uiDepth; ui-- ) // 64(0)->6, 32(1)->5, 16(2)->4, 8(3)->3, 4(4)->2
-  {
-    m_pcBinIf->encodeBinEP( uiSymbol & 0x1 );
-    uiSymbol >>= 1;
-  }
-
-  // 3. Number of edges
-  uiSymbol = ucEdgeNumber > 0 ? ucEdgeNumber - 1 : 0;
-  for( UInt ui = 7; ui > uiDepth; ui-- ) // 64(0)->7, 32(1)->6, 16(2)->5, 8(3)->4, 4(4)->3
-  {
-    m_pcBinIf->encodeBinEP( uiSymbol & 0x1 );
-    uiSymbol >>= 1;
-  }
-
-  if(uiSymbol != 0)
-  {
-    printf(" ucEdgeNumber %d at depth %d\n",ucEdgeNumber, uiDepth);
-    assert(false);
-  }
-
-  // 4. Edges
-  for( Int iPtr2 = 0; iPtr2 < ucEdgeNumber; iPtr2++ )
-  {
-    UInt uiReorderSymbol = pucSymbolList[iPtr2];
-    for( UInt ui = 0; ui < uiReorderSymbol; ui++ )
-    {
-      m_pcBinIf->encodeBin( 1, m_cRbcDataSCModel.get( 0, 0, 0 ) );
-    }
-
-    if( uiReorderSymbol != 6 )
-      m_pcBinIf->encodeBin( 0, m_cRbcDataSCModel.get( 0, 0, 0 ) );
-  }
-}
-#endif
+#endif
+
 #if H_3D_DIM_SDC
 Void TEncSbac::xCodeSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment )
@@ -632,9 +538,5 @@
 
 #if H_3D_DIM_DLT
-#if DLT_DIFF_CODING_IN_PPS
   UInt uiMaxResidualBits = pcCU->getSlice()->getPPS()->getDLT()->getBitsPerDepthValue( pcCU->getSlice()->getLayerIdInVps() );
-#else
-  UInt uiMaxResidualBits = pcCU->getSlice()->getVPS()->getBitsPerDepthValue( pcCU->getSlice()->getLayerIdInVps() );
-#endif
 #else
   UInt uiMaxResidualBits = g_bitDepthY;
@@ -655,14 +557,10 @@
     DTRACE_CU("sdc_residual_sign_flag[i]", uiSign)
 #endif
-    
-#if H_3D_DIM_DLT
-#if DLT_DIFF_CODING_IN_PPS
-      UInt uiNumDepthValues = pcCU->getSlice()->getPPS()->getDLT()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() );
-#else
-      UInt uiNumDepthValues = pcCU->getSlice()->getVPS()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() );
-#endif
+#if H_3D_DIM_DLT    
+    UInt uiNumDepthValues = pcCU->getSlice()->getPPS()->getDLT()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() );
 #else
     UInt uiNumDepthValues = ((1 << g_bitDepthY)-1);
 #endif
+
     assert(uiAbsIdx <= uiNumDepthValues);
     
@@ -1239,97 +1137,47 @@
       xCodeDmm1WedgeIdx( pcCU->getDmmWedgeTabIdx( dimType, absPartIdx ), g_dmm1TabIdxBits[pcCU->getIntraSizeIdx(absPartIdx)] );
     } break;
-#if !SEC_DMM3_RBC_F0147
-  case( DMM3_IDX ):
-    {
-      xCodeDmm3WedgeIdx( pcCU->getDmm3IntraTabIdx( absPartIdx ), g_dmm3IntraTabIdxBits[pcCU->getIntraSizeIdx(absPartIdx)] );
-    } break;
-#endif
   case( DMM4_IDX ): break;
 #endif
-#if H_3D_DIM_RBC
-  case( RBC_IDX ):
-    {
-      assert( pcCU->getWidth( absPartIdx ) < 64 );
-      xCodeRbcEdge( pcCU, absPartIdx );
-    } break;
-#endif
   default: break;
   }
 
-#if H_3D_DIM_SDC && !QC_DIM_DELTADC_UNIFY_F0132
-  if( pcCU->getSDCFlag( absPartIdx ) )
-  {
-    assert(pcCU->getPartitionSize(absPartIdx)==SIZE_2Nx2N);
-    UInt uiNumSegments = ( dir == DC_IDX || dir == PLANAR_IDX )? 1 : 2;
-    for(UInt uiSeg=0; uiSeg<uiNumSegments; uiSeg++)
-    {
-      xCodeSDCResidualData(pcCU, absPartIdx, uiSeg);
-    }
-  }
-  else
-  {
-#endif
-#if QC_DIM_DELTADC_UNIFY_F0132
-    if( dimType < DIM_NUM_TYPE || pcCU->getSDCFlag( absPartIdx ) )
-#else
-    if( dimType < DIM_NUM_TYPE )
-#endif
-    {
-#if QC_DIM_DELTADC_UNIFY_F0132
-      UInt dimDeltaDC;
-      Pel  deltaDC;
-      UInt uiNumSegments = ( dir == PLANAR_IDX ) ? 1 : 2;
-      if( pcCU->getSDCFlag( absPartIdx ) )
-    {
-        if( uiNumSegments==1 )
-        {
-          dimDeltaDC = pcCU->getSDCSegmentDCOffset(0, absPartIdx) ? 1 : 0;
-        }
-        else
-        {
-          dimDeltaDC = ( pcCU->getSDCSegmentDCOffset(0, absPartIdx) || pcCU->getSDCSegmentDCOffset(1, absPartIdx) ) ? 1 : 0;
-        }
+  if( dimType < DIM_NUM_TYPE || pcCU->getSDCFlag( absPartIdx ) )
+  {
+    UInt dimDeltaDC;
+    Pel  deltaDC;
+    UInt uiNumSegments = ( dir == PLANAR_IDX ) ? 1 : 2;
+    if( pcCU->getSDCFlag( absPartIdx ) )
+    {
+      if( uiNumSegments==1 )
+      {
+        dimDeltaDC = pcCU->getSDCSegmentDCOffset(0, absPartIdx) ? 1 : 0;
       }
       else
       {
-        dimDeltaDC = isDimDeltaDC( dir );
-      }
-
-      m_pcBinIf->encodeBin( dimDeltaDC, m_cDdcFlagSCModel.get(0, 0, uiNumSegments-1) );
-
-      if( dimDeltaDC ) 
-      {
-        for( UInt segment = 0; segment < uiNumSegments; segment++ )
-        {
-          deltaDC = pcCU->getSDCFlag( absPartIdx ) ? pcCU->getSDCSegmentDCOffset(segment, absPartIdx) : pcCU->getDimDeltaDC( dimType, segment, absPartIdx );
-          xCodeDimDeltaDC( deltaDC, uiNumSegments );
-        }
-      }
-#else
-      UInt dimDeltaDC = isDimDeltaDC( dir );
-      m_pcBinIf->encodeBin( dimDeltaDC, m_cDdcFlagSCModel.get(0, 0, (RBC_IDX == dimType) ? 1 : 0) );
-      if( dimDeltaDC ) 
-      {
-        for( UInt segment = 0; segment < 2; segment++ )
-        {
-          xCodeDimDeltaDC( pcCU->getDimDeltaDC( dimType, segment, absPartIdx ), dimType );
-        }
-      }
-#endif
-    }
-#if H_3D_DIM_SDC && !QC_DIM_DELTADC_UNIFY_F0132
-  }
-#endif
+        dimDeltaDC = ( pcCU->getSDCSegmentDCOffset(0, absPartIdx) || pcCU->getSDCSegmentDCOffset(1, absPartIdx) ) ? 1 : 0;
+      }
+    }
+    else
+    {
+      dimDeltaDC = isDimDeltaDC( dir );
+    }
+
+    m_pcBinIf->encodeBin( dimDeltaDC, m_cDdcFlagSCModel.get(0, 0, uiNumSegments-1) );
+
+    if( dimDeltaDC ) 
+    {
+      for( UInt segment = 0; segment < uiNumSegments; segment++ )
+      {
+        deltaDC = pcCU->getSDCFlag( absPartIdx ) ? pcCU->getSDCSegmentDCOffset(segment, absPartIdx) : pcCU->getDimDeltaDC( dimType, segment, absPartIdx );
+        xCodeDimDeltaDC( deltaDC, uiNumSegments );
+      }
+    }
+  }
 }
 
 Void TEncSbac::codeIntraDepthMode( TComDataCU* pcCU, UInt absPartIdx )
 {
-#if SEC_DMM3_RBC_F0147
   UInt codeWordTable[3][7] =    {{0, 0, 0, 1, 0, 0, 0},{0, 2, 6, 14, 15, 0, 0},{0, 1, 0, 0, 0, 0, 0}};
   UInt codeWordLenTable[3][7] = {{0, 1, 0, 1, 0, 0, 0},{1, 2, 3,  4,  4, 0, 0},{1, 1, 0, 0, 0, 0, 0}};
-#else
-    UInt codeWordTable[3][7] =    {{0, 0, 0, 2, 0,6, 7},{0, 0, 2, 7, 3, 6, 2},{0, 1, 0, 0, 0, 0, 0}};
-    UInt codeWordLenTable[3][7] = {{0, 1, 0, 2, 0,3, 3},{1, 1, 2, 3, 2, 3, 2},{1, 1, 0, 0, 0, 0, 0}};
-#endif
   UInt dir = pcCU->getLumaIntraDir( absPartIdx );
   UInt puIdx = (pcCU->getWidth(absPartIdx) == 64) ? 2 : ( (pcCU->getPartitionSize(absPartIdx) == SIZE_NxN && pcCU->getWidth(absPartIdx) == 8) ? 0 : 1 );
@@ -1346,8 +1194,4 @@
     case DMM1_IDX: codeIdx = 3; break;
     case DMM4_IDX: codeIdx = 4; break;
-#if !SEC_DMM3_RBC_F0147
-    case DMM3_IDX: codeIdx = 5; break;
-    case  RBC_IDX: codeIdx = 6; break;
-#endif
     default:                    break;
     }
@@ -1362,17 +1206,4 @@
       default:          codeIdx = 2; break;
     }
-  }
-#endif
-#if !SEC_DMM3_RBC_F0147 
-  if( puIdx==1 )
-  {
-      if( codeIdx==1 || codeIdx==2 || codeIdx==4 )
-      {
-          m_pcBinIf->encodeBinEP( 0 );
-      }
-      else
-      {
-          m_pcBinIf->encodeBinEP( 1 );
-      }
   }
 #endif
Index: trunk/source/Lib/TLibEncoder/TEncSbac.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSbac.h	(revision 759)
+++ trunk/source/Lib/TLibEncoder/TEncSbac.h	(revision 773)
@@ -116,19 +116,9 @@
   Void  xWriteEpExGolomb     ( UInt uiSymbol, UInt uiCount );
   Void  xWriteCoefRemainExGolomb ( UInt symbol, UInt &rParam );
-  #if H_3D_DIM
+#if H_3D_DIM
   Void  xWriteExGolombLevel  ( UInt uiSymbol, ContextModel& rcSCModel  );
-#if QC_DIM_DELTADC_UNIFY_F0132
   Void  xCodeDimDeltaDC      ( Pel valDeltaDC, UInt uiNumSeg );
-#else
-  Void  xCodeDimDeltaDC      ( Pel valDeltaDC, UInt dimType );
-#endif
 #if H_3D_DIM_DMM
   Void  xCodeDmm1WedgeIdx    ( UInt uiTabIdx, Int iNumBit );
-#if !SEC_DMM3_RBC_F0147
-  Void  xCodeDmm3WedgeIdx    ( UInt uiIntraIdx, Int iNumBit );
-#endif
-#endif
-#if H_3D_DIM_RBC
-  Void  xCodeRbcEdge         ( TComDataCU* pcCU, UInt uiAbsPartIdx );
 #endif
 #if H_3D_DIM_SDC
@@ -259,10 +249,4 @@
 #if H_3D_DIM_DMM
   ContextModel3DBuffer m_cDmm1DataSCModel;
-#if !SEC_DMM3_RBC_F0147
-  ContextModel3DBuffer m_cDmm3DataSCModel;
-#endif
-#endif
-#if H_3D_DIM_RBC
-  ContextModel3DBuffer m_cRbcDataSCModel;
 #endif
 #if H_3D_DIM_SDC  
Index: trunk/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 759)
+++ trunk/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 773)
@@ -1124,30 +1124,22 @@
       {
 #endif
-      for( UInt uiX = 0; uiX < uiWidth; uiX++ )
-      {
-#if LGE_PRED_RES_CODING_DLT_DOMAIN_F0159
-#if DLT_DIFF_CODING_IN_PPS
-        if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getPPS()->getDLT()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
-#else
-        if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getVPS()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
-#endif
+        for( UInt uiX = 0; uiX < uiWidth; uiX++ )
+        {
+#if H_3D_DIM
+          if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getPPS()->getDLT()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
           {
-#if DLT_DIFF_CODING_IN_PPS
             pResi[ uiX ] = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pOrg[ uiX ] ) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] );
-#else
-            pResi[ uiX ] = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pOrg[ uiX ] ) - pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] );
-#endif
           }
           else
           {
-              pResi[ uiX ] = pOrg[ uiX ] - pPred[ uiX ];
+            pResi[ uiX ] = pOrg[ uiX ] - pPred[ uiX ];
           }
 #else
-        pResi[ uiX ] = pOrg[ uiX ] - pPred[ uiX ];
-#endif
-      }
-      pOrg  += uiStride;
-      pResi += uiStride;
-      pPred += uiStride;
+          pResi[ uiX ] = pOrg[ uiX ] - pPred[ uiX ];
+#endif
+        }
+        pOrg  += uiStride;
+        pResi += uiStride;
+        pPred += uiStride;
 #if H_3D_DIM_ENC
       }
@@ -1209,21 +1201,13 @@
       for( UInt uiX = 0; uiX < uiWidth; uiX++ )
       {
-#if LGE_PRED_RES_CODING_DLT_DOMAIN_F0159
-#if DLT_DIFF_CODING_IN_PPS
+#if H_3D_DIM
         if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getPPS()->getDLT()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
-#else
-        if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getVPS()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
-#endif
-          {
-#if DLT_DIFF_CODING_IN_PPS
-            pReco    [ uiX ] = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), Clip3( 0, pcCU->getSlice()->getPPS()->getDLT()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ) - 1, pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] ) + pResi[ uiX ] ) );
-#else
-            pReco    [ uiX ] = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), Clip3( 0, pcCU->getSlice()->getVPS()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ) - 1, pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] ) + pResi[ uiX ] ) );
-#endif
-          }
-          else
-          {
-              pReco    [ uiX ] = ClipY( pPred[ uiX ] + pResi[ uiX ] );
-          }
+        {
+          pReco    [ uiX ] = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), Clip3( 0, pcCU->getSlice()->getPPS()->getDLT()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ) - 1, pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] ) + pResi[ uiX ] ) );
+        }
+        else
+        {
+          pReco    [ uiX ] = ClipY( pPred[ uiX ] + pResi[ uiX ] );
+        }
 #else
         pReco    [ uiX ] = ClipY( pPred[ uiX ] + pResi[ uiX ] );
@@ -1951,9 +1935,5 @@
     // get residual (idx)
 #if H_3D_DIM_DLT
-#if DLT_DIFF_CODING_IN_PPS
     Pel pResidualIdx = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pDCRec ) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
-#else
-    Pel pResidualIdx = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pDCRec ) - pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
-#endif
 #else
     Pel pResidualIdx = pDCRec - apDCPredValues[uiSegment];
@@ -1969,13 +1949,7 @@
   {
 #if H_3D_DIM_DLT
-#if DLT_DIFF_CODING_IN_PPS
     Pel   pPredIdx    = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
     Pel   pResiIdx    = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);
     Pel   pRecoValue  = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pPredIdx + pResiIdx );
-#else
-    Pel   pPredIdx    = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
-    Pel   pResiIdx    = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);
-    Pel   pRecoValue  = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pPredIdx + pResiIdx );
-#endif
 
     apDCResiValues[uiSegment]  = pRecoValue - apDCPredValues[uiSegment];
@@ -2924,23 +2898,5 @@
               biSegmentation = &(g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])][uiTabIdx]);
             } break;
-#if !SEC_DMM3_RBC_F0147
-          case( DMM3_IDX ):
-            {
-
-              TComPic*      pcPicTex = pcCU->getSlice()->getTexturePic();
-              TComDataCU* pcColTexCU = pcPicTex->getCU( pcCU->getAddr() );
-              UInt      uiTexPartIdx = pcCU->getZorderIdxInCU() + uiPartOffset;
-              Int   uiColTexIntraDir = pcColTexCU->isIntra( uiTexPartIdx ) ? pcColTexCU->getLumaIntraDir( uiTexPartIdx ) : 255;
-
-              if( uiColTexIntraDir > DC_IDX && uiColTexIntraDir < 35 )
-              {
-             UInt uiIntraTabIdx = 0;
-              xSearchDmm3Wedge( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight, uiTabIdx, uiIntraTabIdx, uiColTexIntraDir );
-              pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dmmType, uiPartOffset, uiDepth + uiInitTrDepth );
-              pcCU->setDmm3IntraTabIdxSubParts( uiIntraTabIdx, uiPartOffset, uiDepth + uiInitTrDepth );
-              biSegmentation = &(g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])][uiTabIdx]);
-              }
-            } break;
-#endif
+
           case( DMM4_IDX ):
             {
@@ -2968,27 +2924,4 @@
       }
 #endif
-#if H_3D_DIM_RBC
-      if( m_pcEncCfg->getUseRBC()
-#if H_3D_FAST_DEPTH_INTRA
-          && (uiRdModeList[0] != PLANAR_IDX || varCU >= varThreshold)
-#endif
-        )
-      {
-        if( xSearchRbcEdge( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight ) )
-        {
-          Pel deltaDC1 = 0; Pel deltaDC2 = 0;
-#if QC_DIM_DELTADC_UNIFY_F0132
-          xSearchDmmDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, pcCU->getEdgePartition( uiPartOffset ), uiWidth, uiWidth, uiHeight, deltaDC1, deltaDC2 );
-#else
-          xSearchRbcDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, pcCU->getEdgePartition( uiPartOffset ), uiWidth, uiWidth, uiHeight, deltaDC1, deltaDC2 );
-#endif
-          pcCU->setDimDeltaDC( RBC_IDX, 0, uiPartOffset, deltaDC1 );
-          pcCU->setDimDeltaDC( RBC_IDX, 1, uiPartOffset, deltaDC2 );
-
-          uiRdModeList[ numModesForFullRD++ ] = (2*RBC_IDX  +DIM_OFFSET);
-          uiRdModeList[ numModesForFullRD++ ] = (2*RBC_IDX+1+DIM_OFFSET);
-        }
-      }
-#endif
     }
 #endif
@@ -3029,9 +2962,5 @@
       Bool bTestZeroResi = false;
 #if H_3D_DIM_ENC
-#if LGE_BUGFIX_F0158
       bTestZeroResi |= pcCU->getSlice()->getIsDepth() && !pcCU->getSlice()->isIRAP();
-#else
-      bTestZeroResi |= pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->isIRAP();
-#endif
 #endif
 #if H_3D_DIM_SDC
@@ -3642,5 +3571,5 @@
                                  , InheritedVSPDisInfo*  inheritedVSPDisInfo
 #endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
                                  , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP
 #endif
@@ -3660,5 +3589,5 @@
     if ( iPUIdx == 0 )
     {
-#if ETRIKHU_MERGE_REUSE_F0093
+#if H_3D
       pcCU->initAvailableFlags();
       pcCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand);
@@ -3668,5 +3597,5 @@
                                         , inheritedVSPDisInfo
 #endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
                                         , pbSPIVMPFlag, pcMvFieldSP, puhInterDirSP
 #endif
@@ -3674,11 +3603,5 @@
         );
 #else
-      pcCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours
-#if H_3D_VSP
-                                   , vspFlag
-                                   , inheritedVSPDisInfo
-#endif
-                                   , numValidMergeCand
-                                   );
+      pcCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand );
 #endif
     }
@@ -3687,5 +3610,5 @@
   else
   {
-#if ETRIKHU_MERGE_REUSE_F0093
+#if H_3D
     pcCU->initAvailableFlags();
     pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand);
@@ -3695,5 +3618,5 @@
                                       , inheritedVSPDisInfo
 #endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
                                       , pbSPIVMPFlag, pcMvFieldSP, puhInterDirSP
 #endif
@@ -3701,10 +3624,5 @@
       );
 #else
-    pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours
-#if H_3D_VSP
-                                 , vspFlag
-                                 , inheritedVSPDisInfo
-#endif
-                                 , numValidMergeCand
+    pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand
                                  );
 #endif
@@ -3726,5 +3644,5 @@
       PartSize ePartSize = pcCU->getPartitionSize( 0 );
 
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
       pcCU->setSPIVMPFlagSubParts( pbSPIVMPFlag[uiMergeCand], uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx )); 
       if (pbSPIVMPFlag[uiMergeCand])
@@ -3748,5 +3666,5 @@
         pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx );
         pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx );
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
       }
 #endif
@@ -4427,5 +4345,5 @@
       DisInfo OriginalDvInfo = pcCU->getDvInfo(uiAbsPartIdx);
 #endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
       Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM];
       memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
@@ -4440,5 +4358,5 @@
                       , inheritedVSPDisInfo
 #endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
                       , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP
 #endif 
@@ -4454,5 +4372,5 @@
         pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMRGIndex].m_acDvInfo, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
 #endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
         pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMRGIndex], uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );  
         if (bSPIVMPFlag[uiMRGIndex]!=0)
@@ -4488,5 +4406,5 @@
             pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMRGMvField[1], ePartSize, uiPartAddr, 0, iPartIdx );
           }
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
         }
 #endif
@@ -4502,5 +4420,5 @@
       else
       {
-#if MTK_SPIVMP_F0110        
+#if H_3D_SPIVMP        
         pcCU->setSPIVMPFlagSubParts(0, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 
 #endif
@@ -4517,12 +4435,7 @@
         }
       }
-#if MTK_SPIVMP_F0110
-#if MTK_F0110_FIX
+#if H_3D_SPIVMP
       delete[] pcMvFieldSP;
       delete[] puhInterDirSP;
-#else
-      delete pcMvFieldSP;
-      delete puhInterDirSP;
-#endif
 #endif
     }
@@ -5438,5 +5351,5 @@
       dZeroCost = dCost + 1;
     }
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
     if ( dZeroCost < dCost || pcCU->getQtRootCbf(0)==0)
 #else
@@ -7372,11 +7285,6 @@
 
 #if H_3D_DIM_DLT
-#if DLT_DIFF_CODING_IN_PPS
   rDeltaDC1 = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipY(predDC1 + rDeltaDC1) ) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC1 );
   rDeltaDC2 = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipY(predDC2 + rDeltaDC2) ) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC2 );
-#else
-  rDeltaDC1 = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipY(predDC1 + rDeltaDC1) ) - pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC1 );
-  rDeltaDC2 = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipY(predDC2 + rDeltaDC2) ) - pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC2 );
-#endif
 #endif
 }
@@ -7477,1031 +7385,7 @@
 }
 
-#if !SEC_DMM3_RBC_F0147
-Void TEncSearch::xSearchDmm3Wedge( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx, UInt& ruiIntraTabIdx, UInt colTexIntraDir )
-{
-  ruiTabIdx       = 0;
-  ruiIntraTabIdx  = 0;
-
-  // local pred buffer
-  TComYuv cPredYuv; 
-  cPredYuv.create( uiWidth, uiHeight ); 
-  cPredYuv.clear();
-  Pel* piPred = cPredYuv.getLumaAddr();
-  UInt uiPredStride = cPredYuv.getStride();
-
-  // wedge search
-  UInt uiBestDist = MAX_UINT;
-  WedgeList* pacWedgeList = &g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])];
-  Pel refDC1 = 0; Pel refDC2 = 0;
-
-  std::vector< std::vector<UInt> > pauiWdgLstSz = g_aauiWdgLstM3[g_aucConvertToBit[uiWidth]];
-  std::vector<UInt>* pauiWdgLst = &pauiWdgLstSz[colTexIntraDir-2];
-  for( UInt uiIdxW = 0; uiIdxW < pauiWdgLst->size(); uiIdxW++ )
-  {
-    UInt uiIdx     =   pauiWdgLst->at(uiIdxW);
-    TComWedgelet* pcWedgelet = &(pacWedgeList->at(uiIdx));
-    xCalcBiSegDCs  ( piRef,  uiRefStride,  pcWedgelet->getPattern(), pcWedgelet->getStride(), refDC1, refDC2 );
-    xAssignBiSegDCs( piPred, uiPredStride, pcWedgelet->getPattern(), pcWedgelet->getStride(), refDC1, refDC2 );
-
-    UInt uiActDist = m_pcRdCost->getDistPart( g_bitDepthY, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, TEXT_LUMA, DF_SAD );
-    if( uiActDist < uiBestDist || uiBestDist == MAX_UINT )
-    {
-      uiBestDist     = uiActDist;
-      ruiTabIdx      = uiIdx;
-      ruiIntraTabIdx = uiIdxW;
-    }
-  }
-  cPredYuv.destroy();
-}
-#endif
-#endif
-#if H_3D_DIM_RBC
-Void TEncSearch::xSearchRbcDeltaDCs( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piOrig, Pel* piPredic, UInt uiStride, Bool* biSegPattern, Int patternStride, UInt uiWidth, UInt uiHeight, Pel& rDeltaDC1, Pel& rDeltaDC2 )
-{
-  assert( biSegPattern );
-  Pel origDC1 = 0; Pel origDC2 = 0;
-  xCalcBiSegDCs  ( piOrig,   uiStride, biSegPattern, patternStride, origDC1, origDC2 );
-  xAssignBiSegDCs( piPredic, uiStride, biSegPattern, patternStride, origDC1, origDC2 );
-
-  Int* piMask = pcCU->getPattern()->getAdiOrgBuf( uiWidth, uiHeight, m_piYuvExt ); // no filtering for DMM
-  Int  maskStride = 2*uiWidth + 1;
-  Int* ptrSrc = piMask+maskStride+1;
-  Pel  predDC1 = 0; Pel predDC2 = 0;
-  xPredBiSegDCs( ptrSrc, maskStride, biSegPattern, patternStride, predDC1, predDC2 );
-
-  rDeltaDC1 = origDC1 - predDC1;
-  rDeltaDC2 = origDC2 - predDC2;
-
-#if H_3D_VSO
-  if( m_pcRdCost->getUseVSO() )
-  {
-    Pel fullDeltaDC1 = rDeltaDC1;
-    Pel fullDeltaDC2 = rDeltaDC2;
-
-    xDeltaDCQuantScaleDown( pcCU, fullDeltaDC1 );
-    xDeltaDCQuantScaleDown( pcCU, fullDeltaDC2 );
-
-    Dist uiBestDist     = RDO_DIST_MAX;
-    UInt uiBestQStepDC1 = 0;
-    UInt uiBestQStepDC2 = 0;
-
-    UInt uiDeltaDC1Max = abs(fullDeltaDC1);
-    UInt uiDeltaDC2Max = abs(fullDeltaDC2);
-
-    //VSO Level delta DC check range extension
-    uiDeltaDC1Max += (uiDeltaDC1Max>>1);
-    uiDeltaDC2Max += (uiDeltaDC2Max>>1);
-
-    for( UInt uiQStepDC1 = 1; uiQStepDC1 <= uiDeltaDC1Max; uiQStepDC1++  )
-    {
-      Pel iLevelDeltaDC1 = (Pel)(uiQStepDC1) * (Pel)(( fullDeltaDC1 < 0 ) ? -1 : 1);
-      xDeltaDCQuantScaleUp( pcCU, iLevelDeltaDC1 );
-      Pel testDC1 = ClipY( predDC1 + iLevelDeltaDC1 );
-
-      for( UInt uiQStepDC2 = 1; uiQStepDC2 <= uiDeltaDC2Max; uiQStepDC2++  )
-      {
-        Pel iLevelDeltaDC2 = (Pel)(uiQStepDC2) * (Pel)(( fullDeltaDC2 < 0 ) ? -1 : 1);
-        xDeltaDCQuantScaleUp( pcCU, iLevelDeltaDC2 );
-        Pel testDC2 = ClipY( predDC2 + iLevelDeltaDC2 );
-
-        xAssignBiSegDCs( piPredic, uiStride, biSegPattern, patternStride, testDC1, testDC2 );
-
-        Dist uiActDist = RDO_DIST_MAX;
-        if( m_pcRdCost->getUseEstimatedVSD() )
-        {
-          uiActDist = m_pcRdCost->getDistPartVSD( pcCU, uiAbsPtIdx, piPredic, uiStride, piOrig, uiStride, uiWidth, uiHeight, false );
-        }
-        else
-        {
-          uiActDist = m_pcRdCost->getDistPartVSO( pcCU, uiAbsPtIdx, piPredic, uiStride, piOrig, uiStride, uiWidth, uiHeight, false );
-        }
-
-        if( uiActDist < uiBestDist || uiBestDist == RDO_DIST_MAX )
-        {
-          uiBestDist     = uiActDist;
-          uiBestQStepDC1 = uiQStepDC1;
-          uiBestQStepDC2 = uiQStepDC2;
-        }
-      }
-    }
-
-    fullDeltaDC1 = (Int)(uiBestQStepDC1) * (Int)(( fullDeltaDC1 < 0 ) ? -1 : 1);
-    fullDeltaDC2 = (Int)(uiBestQStepDC2) * (Int)(( fullDeltaDC2 < 0 ) ? -1 : 1);
-    xDeltaDCQuantScaleUp( pcCU, fullDeltaDC1 );
-    xDeltaDCQuantScaleUp( pcCU, fullDeltaDC2 );
-    rDeltaDC1 = fullDeltaDC1;
-    rDeltaDC2 = fullDeltaDC2;
-  }
-#endif
-
-  xDeltaDCQuantScaleDown( pcCU, rDeltaDC1 );
-  xDeltaDCQuantScaleDown( pcCU, rDeltaDC2 );
-}
-
-Bool TEncSearch::xSearchRbcEdge( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piRef, UInt uiRefStride, Int iWidth, Int iHeight )
-{
-  Bool* pbEdge  = (Bool*) xMalloc( Bool, iWidth * iHeight * 4 );
-
-  Short* psDiffX = new Short[ iWidth * iHeight ];
-  Short* psDiffY = new Short[ iWidth * iHeight ];
-  Bool*  pbEdgeX = new Bool [ iWidth * iHeight ];
-  Bool*  pbEdgeY = new Bool [ iWidth * iHeight ];
-
-  // Find Horizontal Gradient & Edge Detection ((x+1, y) - (x,y))
-  for( Int y=0; y<iHeight; y++ )
-  {
-    Short* psDiffXPtr = &psDiffX[ y * iHeight ];
-    Bool*  pbEdgeXPtr = &pbEdgeX[ y * iHeight ];
-    for(Int x=0; x<iWidth-1; x++ )
-    {
-      *psDiffXPtr = piRef[ x+1 + y*uiRefStride ] - piRef[ x + y*uiRefStride ];
-      if(*psDiffXPtr >= RBC_THRESHOLD || *psDiffXPtr <= (-1)*RBC_THRESHOLD)
-      {
-        *pbEdgeXPtr = true;
-      }
-      else
-      {
-        *pbEdgeXPtr = false;
-      }
-
-      psDiffXPtr++;
-      pbEdgeXPtr++;
-    }
-  }
-
-  // Find Vertical Gradient & Edge Detection((x,y+1) - (x,y))
-  for( Int y=0; y<iHeight-1; y++ )
-  {
-    Short* psDiffYPtr = &psDiffY[ y * iHeight ];
-    Bool*  pbEdgeYPtr = &pbEdgeY[ y * iHeight ];
-    for(Int x=0; x<iWidth; x++ )
-    {
-      *psDiffYPtr = piRef[ x + (y+1)*uiRefStride ] - piRef[ x + y*uiRefStride ];
-      if(*psDiffYPtr >= RBC_THRESHOLD || *psDiffYPtr <= (-1)*RBC_THRESHOLD)
-      {
-        *pbEdgeYPtr = true;
-      }
-      else
-      {
-        *pbEdgeYPtr = false;
-      }
-
-      psDiffYPtr++;
-      pbEdgeYPtr++;
-    }
-  }
-
-  // Eliminate local maximum
-  for( Int y=0; y<iHeight; y++ )
-  {
-    Short* psDiffXPtr = &psDiffX[ y * iHeight ];
-    Bool*  pbEdgeXPtr = &pbEdgeX[ y * iHeight ];
-    for( Int x=0; x<iWidth-1; x++ )
-    {
-      UShort usAbs0=0, usAbs1=0, usAbs2=0;  // 0 : left, 1 : current, 2 : right
-
-      if( x > 0 && *(pbEdgeXPtr-1) == true )
-      {
-        if( *(psDiffXPtr-1) >= 0)
-        {
-          usAbs0 = *(psDiffXPtr-1);
-
-        }
-        else
-        {
-          usAbs0 = (-1) * *(psDiffXPtr-1);
-        }
-      }
-      if( *pbEdgeXPtr == true )
-      {
-        if( *(psDiffXPtr) >= 0)
-        {
-          usAbs1 = *(psDiffXPtr);
-        }
-        else
-        {
-          usAbs1 = (-1) * *(psDiffXPtr);
-        }
-      }
-      if( x < iWidth-2 && *(pbEdgeXPtr+1) == true )
-      {
-        if( *(psDiffXPtr+1) >= 0)
-        {
-          usAbs2 = *(psDiffXPtr+1);
-          //bSign2 = true;
-        }
-        else
-        {
-          usAbs2 = (-1) * *(psDiffXPtr+1);
-        }
-      }
-
-      if( x == 0 )
-      {
-        if( usAbs1 < usAbs2 )
-        {
-          *pbEdgeXPtr = false;
-        }
-      }
-      else if( x == iWidth-2 )
-      {
-        if( usAbs1 <= usAbs0 )
-          *pbEdgeXPtr = false;
-      }
-      else
-      {
-        if( usAbs2 > usAbs0 )
-        {
-          if( usAbs1 < usAbs2 )
-            *pbEdgeXPtr = false;
-        }
-        else
-        {
-          if( usAbs1 <= usAbs0 )
-            *pbEdgeXPtr = false;
-        }
-      }
-
-      psDiffXPtr++;
-      pbEdgeXPtr++;
-    }
-  }
-
-  for( Int y=0; y<iHeight-1; y++ )
-  {
-    Short* psDiffYPtr = &psDiffY[ y * iWidth ];
-    Bool*  pbEdgeYPtr = &pbEdgeY[ y * iWidth ];
-    for( Int x=0; x<iWidth; x++ )
-    {
-      UShort usAbs0=0, usAbs1=0, usAbs2=0;  // 0 : upper, 1 : current, 2 : bottom
-      if( y > 0 && *(pbEdgeYPtr-iWidth) == true )
-      {
-        if( *(psDiffYPtr-iWidth) >= 0)
-        {
-          usAbs0 = *(psDiffYPtr-iWidth);
-        }
-        else
-        {
-          usAbs0 = (-1) * *(psDiffYPtr-iWidth);          
-        }
-      }
-      if( *pbEdgeYPtr == true )
-      {
-        if( *(psDiffYPtr) >= 0)
-        {
-          usAbs1 = *(psDiffYPtr);
-        }
-        else
-        {
-          usAbs1 = (-1) * *(psDiffYPtr);
-        }
-      }
-      if( y < iHeight-2 && *(pbEdgeYPtr+iWidth) == true )
-      {
-        if( *(psDiffYPtr+iWidth) >= 0)
-        {
-          usAbs2 = *(psDiffYPtr+iWidth);          
-        }
-        else
-        {
-          usAbs2 = (-1) * *(psDiffYPtr+iWidth);
-        }
-      }
-
-      if( y == 0 )
-      {
-        if( usAbs1 < usAbs2 )
-          *pbEdgeYPtr = false;
-      }
-      else if( y == iHeight-2 )
-      {
-        if( usAbs1 <= usAbs0 )
-          *pbEdgeYPtr = false;
-      }
-      else
-      {
-        if( usAbs2 > usAbs0 )
-        {
-          if( usAbs1 < usAbs2 )
-            *pbEdgeYPtr = false;
-        }
-        else
-        {
-          if( usAbs1 <= usAbs0 )
-            *pbEdgeYPtr = false;
-        }
-      }
-
-      psDiffYPtr++;
-      pbEdgeYPtr++;
-    }
-  }
-
-  // Edge Merging
-  for( Int i=0; i< 4 * iWidth * iHeight; i++ )
-    pbEdge[ i ] = false;
-  /// Even Line (0,2,4,6,...) => Vertical Edge
-  for( Int i=0; i<iHeight; i++)
-  {
-    for( Int j=0; j<iWidth-1; j++)
-    {
-      pbEdge[ (2 * j + 1) + (2 * i) * 2 * iWidth ] = pbEdgeX[ j + i * iHeight ];
-    }
-  }
-  /// Odd Line (1,3,5,7,...) => Horizontal Edge
-  for( Int i=0; i<iHeight-1; i++)
-  {
-    for( Int j=0; j<iWidth; j++)
-    {
-      pbEdge[ (2 * j) + (2 * i + 1) * 2 * iWidth ] = pbEdgeY[ j + i * iHeight ]; 
-    }
-  }
-
-  // Intersection Filling
-  /// Vertical Edge between Horizontal Edges
-  for( Int i = 1; i < 2 * iHeight - 3; i += 2)
-  {
-    for( Int j = 0; j < 2 * iWidth - 1; j += 2)
-    {
-      if( pbEdge[ j + i * 2 * iWidth ] )
-      {
-        if( j != 0 && pbEdge[ (j - 2) + ((i + 2) * 2 * iWidth) ] )
-        {
-          if( !pbEdge[ (j - 1) + ((i - 1) * 2 * iWidth) ] && !pbEdge[ (j - 1) + ((i + 3) * 2 * iWidth) ] )
-            pbEdge[ (j - 1) + ((i + 1) * 2 * iWidth) ] = true;
-        }
-        if( j != 2 * iWidth - 2 && pbEdge[ (j + 2) + ((i + 2) * 2 * iWidth) ] )
-        {
-          if( !pbEdge[ (j + 1) + ((i - 1) * 2 * iWidth) ] && !pbEdge[ (j + 1) + ((i + 3) * 2 * iWidth) ] )
-            pbEdge[ (j + 1) + ((i + 1) * 2 * iWidth) ] = true;
-        }
-      }
-    }
-  }
-  /// Horizontal Edge between Vertical Edges
-  for( Int j = 1; j < 2 * iWidth - 3; j += 2)
-  {
-    for( Int i = 0; i < 2 * iHeight - 1; i += 2)
-    {
-      if( pbEdge[ j + i * 2 * iWidth ] )
-      {
-        if( i != 0 && pbEdge[ (j + 2) + ((i - 2) * 2 * iWidth) ] )
-        {
-          if( !pbEdge[ (j - 1) + ((i - 1) * 2 * iWidth) ] && !pbEdge[ (j + 3) + ((i - 1) * 2 * iWidth) ] )
-            pbEdge[ (j + 1) + ((i - 1) * 2 * iWidth) ] = true;
-        }
-        if( i != 2 * iHeight - 2 && pbEdge[ (j + 2) + ((i + 2) * 2 * iWidth) ] )
-        {
-          if( !pbEdge[ (j - 1) + ((i + 1) * 2 * iWidth) ] && !pbEdge[ (j + 3) + ((i + 1) * 2 * iWidth) ] )
-            pbEdge[ (j + 1) + ((i + 1) * 2 * iWidth) ] = true;
-        }
-      }
-    }
-  }
-
-  // Static Pruning Unnecessary Edges
-  /// Step1. Stack push the unconnected edges
-  UShort* pusUnconnectedEdgeStack = new UShort[ 4 * iWidth * iHeight ]; // approximate size calculation
-  Int iUnconnectedEdgeStackPtr = 0;
-  //// Vertical Edges
-  for( Int i = 0; i < 2 * iHeight - 1; i += 2 )
-  {
-    for( Int j = 1; j < 2 * iWidth - 2; j += 2 )
-    {
-      if( pbEdge[ j + i * 2 * iWidth ] )
-      {
-        if( !xCheckTerminatedEdge( pbEdge, j, i, iWidth, iHeight ) )
-        {
-          pusUnconnectedEdgeStack[iUnconnectedEdgeStackPtr] = (i << 8) | (j);
-          iUnconnectedEdgeStackPtr++;
-        }
-      }
-    }
-  }
-
-  //// Horizontal Edges
-  for( Int i = 1; i < 2 * iHeight - 2; i += 2 )
-  {
-    for( Int j = 0; j < 2 * iWidth - 1; j += 2 )
-    {
-      if( pbEdge[ j + i * 2 * iWidth ] )
-      {
-        if( !xCheckTerminatedEdge( pbEdge, j, i, iWidth, iHeight ) )
-        {
-          pusUnconnectedEdgeStack[iUnconnectedEdgeStackPtr] = (i << 8) | (j);
-          iUnconnectedEdgeStackPtr++;
-        }
-      }
-    }
-  }
-
-  /// Step2. Remove the edges from the stack and push the new unconnected edges
-  //// (This step may contain duplicated edges already in the stack)
-  //// (But it doesn't cause any functional problems)
-  while( iUnconnectedEdgeStackPtr != 0 )
-  {
-    iUnconnectedEdgeStackPtr--;
-    Int iX = pusUnconnectedEdgeStack[ iUnconnectedEdgeStackPtr ] & 0xff;
-    Int iY = pusUnconnectedEdgeStack[ iUnconnectedEdgeStackPtr ] >> 8;
-
-    pbEdge[ iX + iY * 2 * iWidth ] = false;
-
-    if( iY % 2 == 1 && iX > 0 && pbEdge[ iX - 2 + iY * 2 * iWidth ] &&
-      !xCheckTerminatedEdge( pbEdge, iX - 2, iY, iWidth, iHeight ) ) // left
-    {
-      pusUnconnectedEdgeStack[ iUnconnectedEdgeStackPtr ] = ((iY + 0) << 8) | (iX - 2);
-      iUnconnectedEdgeStackPtr++;
-    }
-    if( iY % 2 == 1 && iX < 2 * iWidth - 2 && pbEdge[ iX + 2 + iY * 2 * iWidth ] &&
-      !xCheckTerminatedEdge( pbEdge, iX + 2, iY, iWidth, iHeight ) ) // right
-    {
-      pusUnconnectedEdgeStack[ iUnconnectedEdgeStackPtr ] = ((iY + 0) << 8) | (iX + 2);
-      iUnconnectedEdgeStackPtr++;
-    }
-    if( iY % 2 == 0 && iY > 0 && pbEdge[ iX + (iY - 2) * 2 * iWidth ] &&
-      !xCheckTerminatedEdge( pbEdge, iX, iY - 2, iWidth, iHeight ) ) // top
-    {
-      pusUnconnectedEdgeStack[ iUnconnectedEdgeStackPtr ] = ((iY - 2) << 8) | (iX + 0);
-      iUnconnectedEdgeStackPtr++;
-    }
-    if( iY % 2 == 0 && iY < 2 * iHeight - 2 && pbEdge[ iX + (iY + 2) * 2 * iWidth ] &&
-      !xCheckTerminatedEdge( pbEdge, iX, iY + 2, iWidth, iHeight ) ) // bottom
-    {
-      pusUnconnectedEdgeStack[ iUnconnectedEdgeStackPtr ] = ((iY + 2) << 8) | (iX + 0);
-      iUnconnectedEdgeStackPtr++;
-    }
-    if( iX > 0 && iY > 0 && pbEdge[ iX - 1 + (iY - 1) * 2 * iWidth ] &&
-      !xCheckTerminatedEdge( pbEdge, iX - 1, iY - 1, iWidth, iHeight ) ) // left-top
-    {
-      pusUnconnectedEdgeStack[ iUnconnectedEdgeStackPtr ] = ((iY - 1) << 8) | (iX - 1);
-      iUnconnectedEdgeStackPtr++;
-    }
-    if( iX < 2 * iWidth - 1 && iY > 0 && pbEdge[ iX + 1 + (iY - 1) * 2 * iWidth ] &&
-      !xCheckTerminatedEdge( pbEdge, iX + 1, iY - 1, iWidth, iHeight ) ) // right-top
-    {
-      pusUnconnectedEdgeStack[ iUnconnectedEdgeStackPtr ] = ((iY - 1) << 8) | (iX + 1);
-      iUnconnectedEdgeStackPtr++;
-    }
-    if( iX > 0 && iY < 2 * iHeight - 1 && pbEdge[ iX - 1 + (iY + 1) * 2 * iWidth ] &&
-      !xCheckTerminatedEdge( pbEdge, iX - 1, iY + 1, iWidth, iHeight ) ) // left-bottom
-    {
-      pusUnconnectedEdgeStack[ iUnconnectedEdgeStackPtr ] = ((iY + 1) << 8) | (iX - 1);
-      iUnconnectedEdgeStackPtr++;
-    }
-    if( iX < 2 * iWidth - 1 && iY < 2 * iHeight - 1 && pbEdge[ iX + 1 + (iY + 1) * 2 * iWidth ] &&
-      !xCheckTerminatedEdge( pbEdge, iX + 1, iY + 1, iWidth, iHeight ) ) // right-bottom
-    {
-      pusUnconnectedEdgeStack[ iUnconnectedEdgeStackPtr ] = ((iY + 1) << 8) | (iX + 1);
-      iUnconnectedEdgeStackPtr++;
-    }
-  }
-
-
-  // Region Generation ( edge -> region )
-  Bool* pbRegion = pcCU->getEdgePartition( uiAbsPtIdx );
-  Bool* pbVisit  = new Bool[ iWidth * iHeight ];
-
-  for( UInt ui = 0; ui < iWidth * iHeight; ui++ )
-  {
-    pbRegion[ ui ] = true; // fill it as region 1 (we'll discover region 0 next)
-    pbVisit [ ui ] = false;
-  }
-
-  Int* piStack = new Int[ iWidth * iHeight ];
-
-  Int iPtr = 0;
-
-  piStack[iPtr++] = (0 << 8) | (0);
-  pbRegion[ 0 ] = false;
-
-  while(iPtr > 0)
-  {
-    Int iTmp = piStack[--iPtr];
-    Int iX1, iY1;
-    iX1 = iTmp & 0xff;
-    iY1 = (iTmp >> 8) & 0xff;
-
-    pbVisit[ iX1 + iY1 * iWidth ] = true;
-
-    assert( iX1 >= 0 && iX1 < iWidth );
-    assert( iY1 >= 0 && iY1 < iHeight );
-
-    if( iX1 > 0 && !pbEdge[ 2 * iX1 - 1 + 4 * iY1 * iWidth ] && !pbVisit[ iX1 - 1 + iY1 * iWidth ] )
-    {
-      piStack[iPtr++] = (iY1 << 8) | (iX1 - 1);
-      pbRegion[ iX1 - 1 + iY1 * iWidth ] = false;
-    }
-    if( iX1 < iWidth - 1 && !pbEdge[ 2 * iX1 + 1 + 4 * iY1 * iWidth ] && !pbVisit[ iX1 + 1 + iY1 * iWidth ] )
-    {
-      piStack[iPtr++] = (iY1 << 8) | (iX1 + 1);
-      pbRegion[ iX1 + 1 + iY1 * iWidth ] = false;
-    }
-    if( iY1 > 0 && !pbEdge[ 2 * iX1 + 2 * (2 * iY1 - 1) * iWidth ] && !pbVisit[ iX1 + (iY1 - 1) * iWidth ] )
-    {
-      piStack[iPtr++] = ((iY1 - 1) << 8) | iX1;
-      pbRegion[ iX1 + (iY1 - 1) * iWidth ] = false;
-    }
-    if( iY1 < iHeight - 1 && !pbEdge[ 2 * iX1 + 2 * (2 * iY1 + 1) * iWidth ] && !pbVisit[ iX1 + (iY1 + 1) * iWidth ] )
-    {
-      piStack[iPtr++] = ((iY1 + 1) << 8) | iX1;
-      pbRegion[ iX1 + (iY1 + 1) * iWidth ] = false;
-    }
-  }
-
-  ///////////
-  iPtr = 0;
-  for( Int i = 0; i < iWidth * iHeight; i++ )
-    pbVisit[ i ] = false;
-  piStack[ iPtr++ ] = (0 << 8) | (0); // initial seed
-  while( iPtr > 0 && iPtr < iWidth * iHeight )
-  {
-    Int iX;
-    Int iY;
-    iPtr--;
-    iX = piStack[ iPtr ] & 0xff;
-    iY = piStack[ iPtr ] >> 8;
-    pbVisit[ iY * iWidth + iX ] = true;
-
-    if( iY > 0 && !pbVisit[ (iY - 1) * iWidth + iX ] && pbRegion[ iY * iWidth + iX ] == pbRegion[ (iY - 1) * iWidth + iX ] )
-    {
-      piStack[ iPtr++ ] = ((iY - 1) << 8) | iX;
-    }
-    if( iY < iHeight - 1 && !pbVisit[ (iY + 1) * iWidth + iX ] && pbRegion[ iY * iWidth + iX ] == pbRegion[ (iY + 1) * iWidth + iX ] )
-    {
-      piStack[ iPtr++ ] = ((iY + 1) << 8) | iX;
-    }
-    if( iX > 0 && !pbVisit[ iY * iWidth + (iX - 1) ] && pbRegion[ iY * iWidth + iX ] == pbRegion[ iY * iWidth + (iX - 1) ] )
-    {
-      piStack[ iPtr++ ] = (iY << 8) | (iX - 1);
-    }
-    if( iX < iWidth - 1 && !pbVisit[ iY * iWidth + (iX + 1) ] && pbRegion[ iY * iWidth + iX ] == pbRegion[ iY * iWidth + (iX + 1) ] )
-    {
-      piStack[ iPtr++ ] = (iY << 8) | (iX + 1);
-    }
-  }
-  assert( iPtr == 0 || iPtr == iWidth * iHeight );
-
-  Bool bBipartition;
-  if( iPtr == iWidth * iHeight )
-  {
-    bBipartition = false; // single partition
-  }
-  else
-  {
-    for( Int i = 0; i < iWidth * iHeight; i++ )
-    {
-      if( !pbVisit[ i ] )
-      {
-        piStack[ iPtr++ ] = (( i / iWidth ) << 8) | ( i % iWidth );
-        pbVisit[ i ] = true;
-        break;
-      }
-    }
-    while( iPtr > 0 )
-    {
-      Int iX;
-      Int iY;
-      iPtr--;
-      iX = piStack[ iPtr ] & 0xff;
-      iY = piStack[ iPtr ] >> 8;
-      pbVisit[ iY * iWidth + iX ] = true;
-
-      if( iY > 0 && !pbVisit[ (iY - 1) * iWidth + iX ] && pbRegion[ iY * iWidth + iX ] == pbRegion[ (iY - 1) * iWidth + iX ] )
-      {
-        piStack[ iPtr++ ] = ((iY - 1) << 8) | iX;
-      }
-      if( iY < iHeight - 1 && !pbVisit[ (iY + 1) * iWidth + iX ] && pbRegion[ iY * iWidth + iX ] == pbRegion[ (iY + 1) * iWidth + iX ] )
-      {
-        piStack[ iPtr++ ] = ((iY + 1) << 8) | iX;
-      }
-      if( iX > 0 && !pbVisit[ iY * iWidth + (iX - 1) ] && pbRegion[ iY * iWidth + iX ] == pbRegion[ iY * iWidth + (iX - 1) ] )
-      {
-        piStack[ iPtr++ ] = (iY << 8) | (iX - 1);
-      }
-      if( iX < iWidth - 1 && !pbVisit[ iY * iWidth + (iX + 1) ] && pbRegion[ iY * iWidth + iX ] == pbRegion[ iY * iWidth + (iX + 1) ] )
-      {
-        piStack[ iPtr++ ] = (iY << 8) | (iX + 1);
-      }
-    }
-    bBipartition = true;
-    for( Int i = 0; i < iWidth * iHeight; i++ )
-    {
-      if( !pbVisit[ i ] )
-      {
-        bBipartition = false;
-        break;
-      }
-    }
-  }
-
-  xFree( pbEdge );
-  delete[] pbEdgeX; pbEdgeX = NULL;
-  delete[] pbEdgeY; pbEdgeY = NULL;
-  delete[] psDiffX; psDiffX = NULL;
-  delete[] psDiffY; psDiffY = NULL;
-  delete[] pusUnconnectedEdgeStack; pusUnconnectedEdgeStack = NULL;
-  delete[] pbVisit; pbVisit = NULL;
-  delete[] piStack; piStack = NULL;
-
-  if( bBipartition )
-  {
-    return xConstructChainCode( pcCU, uiAbsPtIdx, (UInt)iWidth, (UInt)iHeight );
-  }
-  else
-  {
-    return false;
-  }
-}
-
-Bool TEncSearch::xCheckTerminatedEdge( Bool* pbEdge, Int iX, Int iY, Int iWidth, Int iHeight )
-{
-  if( (iY % 2) == 0 ) // vertical edge
-  {
-    Bool bTopConnected = false;
-    Bool bBottomConnected = false;
-
-    if( iY != 0 )
-    {
-      if( pbEdge[ iX + (iY - 2) * 2 * iWidth ] )
-        bTopConnected = true;
-      if( pbEdge[ (iX - 1) + (iY - 1) * 2 * iWidth ] )
-        bTopConnected = true;
-      if( pbEdge[ (iX + 1) + (iY - 1) * 2 * iWidth ] )
-        bTopConnected = true;
-    }
-    else
-    {
-      bTopConnected = true;
-    }
-
-
-    if( iY != 2 * iHeight - 2 )
-    {
-      if( pbEdge[ iX + (iY + 2) * 2 * iWidth ] )
-        bBottomConnected = true;
-      if( pbEdge[ (iX - 1) + (iY + 1) * 2 * iWidth ] )
-        bBottomConnected = true;
-      if( pbEdge[ (iX + 1) + (iY + 1) * 2 * iWidth ] )
-        bBottomConnected = true;
-    }
-    else
-    {
-      bBottomConnected = true;
-    }
-
-
-    if( bTopConnected && bBottomConnected )
-    {
-      return true;
-    }
-    else
-    {
-      return false;
-    }
-  }
-  else
-  {
-    Bool bLeftConnected = false;
-    Bool bRightConnected = false;
-
-    if( iX != 0 )
-    {
-      if( pbEdge[ (iX - 2) + iY * 2 * iWidth ] )
-        bLeftConnected = true;
-      if( pbEdge[ (iX - 1) + (iY - 1) * 2 * iWidth ] )
-        bLeftConnected = true;
-      if( pbEdge[ (iX - 1) + (iY + 1) * 2 * iWidth ] )
-        bLeftConnected = true;
-    }
-    else
-    {
-      bLeftConnected = true;
-    }
-
-    if( iX != 2 * iWidth - 2 )
-    {
-      if( pbEdge[ (iX + 2) + iY * 2 * iWidth ] )
-        bRightConnected = true;
-      if( pbEdge[ (iX + 1) + (iY - 1) * 2 * iWidth ] )
-        bRightConnected = true;
-      if( pbEdge[ (iX + 1) + (iY + 1) * 2 * iWidth ] )
-        bRightConnected = true;
-    }
-    else
-    {
-      bRightConnected = true;
-    }
-
-
-    if( bLeftConnected && bRightConnected )
-    {
-      return true;
-    }
-    else
-    {
-      return false;
-    }
-  }
-}
-Bool TEncSearch::xConstructChainCode( TComDataCU* pcCU, UInt uiAbsPtIdx, UInt uiWidth, UInt uiHeight )
-{
-  //UInt   uiWidth    = pcCU->getWidth( uiPartIdx ) >> (bPU4x4 ? 1 : 0);
-  //UInt   uiHeight   = pcCU->getHeight( uiPartIdx ) >> (bPU4x4 ? 1 : 0);
-  Bool*  pbEdge     = (Bool*) xMalloc( Bool, uiWidth * uiHeight * 4 );
-  Bool*  pbVisit    = (Bool*) xMalloc( Bool, uiWidth * uiHeight * 4 );
-  UInt   uiMaxEdge  = uiWidth * (RBC_MAX_EDGE_NUM_PER_4x4 / 4);
-  Bool*  pbRegion   = pcCU->getEdgePartition( uiAbsPtIdx );
-  UChar* piEdgeCode = pcCU->getEdgeCode( uiAbsPtIdx );
-  Bool   bStartLeft = false;
-  Bool   bPossible  = false;
-  Bool   bFinish    = false;
-  Int    iStartPosition = -1;
-  Int    iPtr = 0;
-  Int    iDir = -1, iNextDir = -1;
-  Int    iArrow = -1, iNextArrow = -1;
-  Int    iX = -1, iY = -1;
-  Int    iDiffX = 0, iDiffY = 0;
-  UChar  iCode = 255;
-  UInt   uiWidth2 = uiWidth * 2;
-
-  for( Int i = 0; i < uiWidth * uiHeight * 4; i++ )
-    pbEdge[ i ] = false;
-
-  for( Int i = 0; i < uiHeight; i++ )
-  {
-    for( Int j = 0; j < uiWidth - 1; j++ )
-    {
-      if( pbRegion[ i * uiWidth + j ] != pbRegion[ i * uiWidth + j + 1 ] )
-        pbEdge[ i * uiWidth * 4 + j * 2 + 1 ] = true;
-    }
-  }
-
-  for( Int i = 0; i < uiHeight - 1; i++ )
-  {
-    for( Int j = 0; j < uiWidth; j++ )
-    {
-      if( pbRegion[ (i + 0) * uiWidth + j ] != pbRegion[ (i + 1) * uiWidth + j ] )
-        pbEdge[ (2 * i + 1) * 2 * uiWidth + j * 2 ] = true;
-    }
-  }
-
-  for( Int i = 1; i < uiWidth2 - 2; i+=2 )
-  {
-    if(pbEdge[ i ])
-    {
-      bPossible  = true;
-      bStartLeft = false;
-      iStartPosition = iX = i;
-      iY = 0;
-      iDir = 3;
-      iArrow = 3;
-      break;
-    }
-  }
-
-  if( !bPossible )
-  {
-    for( Int i = 1; i < uiWidth2 - 2; i+=2 )
-    {
-      if(pbEdge[ i * uiWidth2 ])
-      {
-        bPossible  = true;
-        bStartLeft = true;
-        iX = 0;
-        iStartPosition = iY = i;
-        iDir = 1;
-        iArrow = 1;
-        break;
-      }
-    }
-  }
-
-  if( bPossible )
-  {
-    for( Int i = 0; i < 4 * uiWidth * uiHeight; i++ )
-      pbVisit[ i ] = false;
-
-    while( !bFinish )
-    {
-      Bool bArrowSkip = false;
-      pbVisit[ iX + iY * uiWidth2 ] = true;
-
-      switch( iDir )
-      {
-      case 0: // left
-        if( iX > 0 && !pbVisit[ (iX - 2) + iY * uiWidth2 ] && pbEdge[ (iX - 2) + iY * uiWidth2 ] ) // left
-        {
-          iDiffX = -2;
-          iDiffY =  0;
-          iNextDir = 0;
-          iNextArrow = 0;
-        }
-        else if( iX > 0 && !pbVisit[ (iX - 1) + (iY - 1) * uiWidth2 ] && pbEdge[ (iX - 1) + (iY - 1) * uiWidth2 ] ) // top
-        {
-          iDiffX = -1;
-          iDiffY = -1;
-          iNextDir = 2;
-          iNextArrow = 4;
-        }
-        else if( iX > 0 && !pbVisit[ (iX - 1) + (iY + 1) * uiWidth2 ] && pbEdge[ (iX - 1) + (iY + 1) * uiWidth2 ] ) // bottom
-        {
-          iDiffX = -1;
-          iDiffY = +1;
-          iNextDir = 3;
-          iNextArrow = iArrow;
-          if( !(iPtr == 0 && iX == uiWidth2 - 2 && iY == uiHeight * 2 - 3) )
-            bArrowSkip = true;
-          else
-            iNextArrow = 3;
-        }
-        else if( iX == 0 )
-        {
-          iDiffX = 0;
-          iDiffY = 0;
-          iNextDir = iDir;
-          iNextArrow = iArrow;
-          bFinish = true;
-          continue;
-        }
-        else
-        {
-          iPtr = 0; // edge loop or unwanted case
-          bFinish = true;
-          //continue;
-          assert(false);
-        }
-        break;
-      case 1: // right
-        if( iX < uiWidth2 - 2 && !pbVisit[ (iX + 2) + iY * uiWidth2 ] && pbEdge[ (iX + 2) + iY * uiWidth2 ] ) // right
-        {
-          iDiffX = +2;
-          iDiffY =  0;
-          iNextDir = 1;
-          iNextArrow = 1;
-        }
-        else if( iX < uiWidth2 - 2 && !pbVisit[ (iX + 1) + (iY - 1) * uiWidth2 ] && pbEdge[ (iX + 1) + (iY - 1) * uiWidth2 ] ) // top
-        {
-          iDiffX = +1;
-          iDiffY = -1;
-          iNextDir = 2;
-          iNextArrow = iArrow;
-          if( !(iPtr == 0 && iX == 0 && iY == 1) )
-            bArrowSkip = true;
-          else
-            iNextArrow = 2;
-        }
-        else if( iX < uiWidth2 - 2 && !pbVisit[ (iX + 1) + (iY + 1) * uiWidth2 ] && pbEdge[ (iX + 1) + (iY + 1) * uiWidth2 ] ) // bottom
-        {
-          iDiffX = +1;
-          iDiffY = +1;
-          iNextDir = 3;
-          iNextArrow = 7;
-        }
-        else if( iX == uiWidth2 - 2 )
-        {
-          iDiffX = 0;
-          iDiffY = 0;
-          iNextDir = iDir;
-          iNextArrow = iArrow;
-          bFinish = true;
-          continue;
-        }
-        else
-        {
-          iPtr = 0; // edge loop or unwanted case
-          bFinish = true;
-          //continue;
-          assert(false);
-        }
-        break;
-      case 2: // top
-        if( iY > 0 && !pbVisit[ (iX - 1) + (iY - 1) * uiWidth2 ] && pbEdge[ (iX - 1) + (iY - 1) * uiWidth2 ] ) // left
-        {
-          iDiffX = -1;
-          iDiffY = -1;
-          iNextDir = 0;
-          iNextArrow = iArrow;
-          if( !(iPtr == 0 && iX == 1 && iY == uiHeight * 2 - 2) )
-            bArrowSkip = true;
-          else
-            iNextArrow = 0;
-        }
-        else if( iY > 0 && !pbVisit[ (iX + 1) + (iY - 1) * uiWidth2 ] && pbEdge[ (iX + 1) + (iY - 1) * uiWidth2 ] ) // right
-        {
-          iDiffX = +1;
-          iDiffY = -1;
-          iNextDir = 1;
-          iNextArrow = 5;
-        }
-        else if( iY > 0 && !pbVisit[ iX + (iY - 2) * uiWidth2 ] && pbEdge[ iX + (iY - 2) * uiWidth2 ] ) // top
-        {
-          iDiffX =  0;
-          iDiffY = -2;
-          iNextDir = 2;
-          iNextArrow = 2;
-        }
-        else if( iY == 0 )
-        {
-          iDiffX = 0;
-          iDiffY = 0;
-          iNextDir = iDir;
-          iNextArrow = iArrow;
-          bFinish = true;
-          continue;
-        }
-        else
-        {
-          iPtr = 0; // edge loop or unwanted case
-          bFinish = true;
-          //continue;
-          assert(false);
-        }
-        break;
-      case 3: // bottom
-        if( iY < uiWidth2 - 2 && !pbVisit[ (iX - 1) + (iY + 1) * uiWidth2 ] && pbEdge[ (iX - 1) + (iY + 1) * uiWidth2 ] ) // left
-        {
-          iDiffX = -1;
-          iDiffY = +1;
-          iNextDir = 0;
-          iNextArrow = 6;
-        }
-        else if( iY < uiWidth2 - 2 && !pbVisit[ (iX + 1) + (iY + 1) * uiWidth2 ] && pbEdge[ (iX + 1) + (iY + 1) * uiWidth2 ] ) // right
-        {
-          iDiffX = +1;
-          iDiffY = +1;
-          iNextDir = 1;
-          iNextArrow = iArrow;
-          if( !(iPtr == 0 && iX == uiWidth * 2 - 3 && iY == 0) )
-            bArrowSkip = true;
-          else
-            iNextArrow = 1;
-        }
-        else if( iY < uiWidth2 - 2 && !pbVisit[ iX + (iY + 2) * uiWidth2 ] && pbEdge[ iX + (iY + 2) * uiWidth2 ] ) // bottom
-        {
-          iDiffX =  0;
-          iDiffY = +2;
-          iNextDir = 3;
-          iNextArrow = 3;
-        }
-        else if( iY == uiWidth2 - 2 )
-        {
-          iDiffX = 0;
-          iDiffY = 0;
-          iNextDir = iDir;
-          iNextArrow = iArrow;
-          bFinish = true;
-          continue;
-        }
-        else
-        {
-          iPtr = 0; // edge loop or unwanted case
-          bFinish = true;
-          //continue;
-          assert(false);
-        }
-        break;
-      }
-
-      const UChar tableCode[8][8] = { { 0, -1, 4, 3, 2, 6, 1, 5 }, // iArrow(current direction), iNextArrow(next direction)
-      { -1, 0, 3, 4, 5, 1, 6, 2 },
-      { 3, 4, 0, -1, 1, 2, 5, 6 },
-      { 4, 3, -1, 0, 6, 5, 2, 1 },
-      { 1, 6, 2, 5, 0, 4, 3, -1 },
-      { 5, 2, 1, 6, 3, 0, -1, 4 },
-      { 2, 5, 6, 1, 4, -1, 0, 3 },
-      { 6, 1, 5, 2, -1, 3, 4, 0 } };
-
-      iCode = tableCode[iArrow][iNextArrow];
-
-      if(iPtr >= uiMaxEdge)
-      {
-        iPtr = 0; // over the maximum number of edge
-        bPossible = false;
-        break;
-      }
-
-      if( !bArrowSkip )
-      {
-        piEdgeCode[iPtr++] = iCode; // first edge coding
-        //printf("xEdgeCoding: (%d,%d)->(%d,%d) code %d\n",iX,iY, iX+iDiffX, iY+iDiffY, iCode);
-      }
-
-      iX += iDiffX;
-      iY += iDiffY;
-      iDir = iNextDir;
-      iArrow = iNextArrow;
-    }
-  }
-
-  pcCU->setEdgeLeftFirst( uiAbsPtIdx, bStartLeft );
-  pcCU->setEdgeStartPos ( uiAbsPtIdx, bStartLeft ? (iStartPosition - 1) >> 1 : (iStartPosition + 1) >> 1);
-  pcCU->setEdgeNumber   ( uiAbsPtIdx, iPtr );
-
-  xFree( pbEdge );
-  xFree( pbVisit );
-
-  return (iPtr != 0);
-}
-#endif
+
+#endif
+
 #endif
 //! \}
Index: trunk/source/Lib/TLibEncoder/TEncSearch.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSearch.h	(revision 759)
+++ trunk/source/Lib/TLibEncoder/TEncSearch.h	(revision 773)
@@ -351,14 +351,4 @@
   Void xSearchDmmDeltaDCs         ( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piOrig, Pel* piPredic, UInt uiStride, Bool* biSegPattern, Int patternStride, UInt uiWidth, UInt uiHeight, Pel& rDeltaDC1, Pel& rDeltaDC2 );
   Void xSearchDmm1Wedge           ( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx );
-#if !SEC_DMM3_RBC_F0147
-  Void xSearchDmm3Wedge           ( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx, UInt& ruiIntraTabIdx, UInt colTexIntraDir );
-#endif
-#endif
-#if H_3D_DIM_RBC
-  Void xSearchRbcDeltaDCs         ( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piOrig, Pel* piPredic, UInt uiStride, Bool* biSegPattern, Int patternStride, UInt uiWidth, UInt uiHeight, Pel& rDeltaDC1, Pel& rDeltaDC2 );
-  Bool xSearchRbcEdge             ( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piRef, UInt uiRefStride,  Int  iWidth,  Int  iHeight );
-  
-  Bool xCheckTerminatedEdge       ( Bool* pbEdge, Int iX, Int iY, Int iWidth, Int iHeight );
-  Bool xConstructChainCode        ( TComDataCU* pcCU, UInt uiAbsPtIdx, UInt uiWidth, UInt uiHeight );
 #endif
 #if H_3D_DIM_SDC
@@ -427,5 +417,5 @@
                                   , InheritedVSPDisInfo*  inheritedVSPDisInfo
 #endif
-#if MTK_SPIVMP_F0110
+#if H_3D_SPIVMP
                                   , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP
 #endif
Index: trunk/source/Lib/TLibEncoder/TEncSlice.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSlice.cpp	(revision 759)
+++ trunk/source/Lib/TLibEncoder/TEncSlice.cpp	(revision 773)
@@ -556,5 +556,4 @@
   rpcSlice->setSliceSegmentArgument ( m_pcCfg->getSliceSegmentArgument() );
 #if H_3D_IV_MERGE
-#if SEC_MPI_ENABLING_MERGE_F0150
   if(rpcSlice->getIsDepth())
   {
@@ -565,7 +564,4 @@
     rpcSlice->setMaxNumMergeCand      ( m_pcCfg->getMaxNumMergeCand()   + ( rpcSlice->getVPS()->getIvMvPredFlag( rpcSlice->getLayerIdInVps() ) ? 1 : 0 ) );
   }
-#else
-   rpcSlice->setMaxNumMergeCand      ( m_pcCfg->getMaxNumMergeCand()   + ( rpcSlice->getVPS()->getIvMvPredFlag( rpcSlice->getLayerIdInVps() ) ? 1 : 0 ) );
-#endif
 #else
   rpcSlice->setMaxNumMergeCand        ( m_pcCfg->getMaxNumMergeCand()        );
Index: trunk/source/Lib/TLibEncoder/TEncTop.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncTop.cpp	(revision 759)
+++ trunk/source/Lib/TLibEncoder/TEncTop.cpp	(revision 773)
@@ -299,5 +299,5 @@
 {
   // initialize SPS
-#if DLT_DIFF_CODING_IN_PPS
+#if H_3D
   // Assuming that all PPS indirectly refer to the same VPS via different SPS
   m_cSPS.setVPS(m_cVPS);
@@ -723,17 +723,11 @@
 
 #if H_MV  
-#if H_MV_6_PS_REP_FORM_18_19_20
   m_cSPS.setUpdateRepFormatFlag           ( false );    
-#else
-  m_cSPS.setUpdateRepFormatFlag           ( m_layerId == 0 );    
-#endif
   m_cSPS.setSpsInferScalingListFlag       ( m_layerId > 0 && m_cVPS->getInDirectDependencyFlag( getLayerIdInVps(), 0 ) ); 
   m_cSPS.setSpsScalingListRefLayerId      ( 0              ); 
-#if H_MV_6_PSEM_O0142_3
   m_cSPS.setSpsExtensionFlag              ( true ); 
   m_cSPS.setSpsExtensionTypeFlag          ( PS_EX_T_MV ,true ); 
 #if H_3D
   m_cSPS.setSpsExtensionTypeFlag          ( PS_EX_T_3D ,true ); 
-#endif
 #endif
 #endif
@@ -823,8 +817,8 @@
     pcVUI->setOverscanInfoPresentFlag(getOverscanInfoPresentFlag());
     pcVUI->setOverscanAppropriateFlag(getOverscanAppropriateFlag());
-#if H_MV_6_PS_O0118_33
+#if H_MV
     pcVUI->setVideoSignalTypePresentFlag(getVideoSignalTypePresentFlag() && getLayerId() == 0 );
 #else
-    pcVUI->setVideoSignalTypePresentFlag(getVideoSignalTypePresentFlag());
+   pcVUI->setVideoSignalTypePresentFlag(getVideoSignalTypePresentFlag());
 #endif
     pcVUI->setVideoFormat(getVideoFormat());
@@ -853,14 +847,4 @@
     pcVUI->setLog2MaxMvLengthVertical(getLog2MaxMvLengthVertical());
   }
-#if H_3D
-#if !CAM_HLS_F0136_F0045_F0082
-#if !QC_DEPTH_IV_MRG_F0125
-  if ( !m_isDepth )
-#endif
-  {
-    m_cSPS.initCamParaSPS           ( m_viewIndex, m_uiCamParPrecision, m_bCamParInSliceHeader, m_aaiCodedScale, m_aaiCodedOffset );
-  }
-#endif
-#endif
 }
 
@@ -877,5 +861,5 @@
 #endif
 
-#if DLT_DIFF_CODING_IN_PPS
+#if H_3D
   m_cPPS.setDLT( getDLT() );
 #endif
@@ -948,9 +932,5 @@
   m_cPPS.setOutputFlagPresentFlag( false );
 #if H_MV
-#if H_MV_6_RALS_O0149_11
   m_cPPS.setNumExtraSliceHeaderBits( 3 ); 
-#else
-  m_cPPS.setNumExtraSliceHeaderBits( 2 ); 
-#endif
 #endif
   m_cPPS.setSignHideFlag(getSignHideFlag());
@@ -1012,9 +992,5 @@
   }
 #if H_3D
-#if CAM_HLS_F0136_F0045_F0082
   if( m_cVPS->hasCamParInSliceHeader( getViewIndex() ) )
-#else
-  if( m_cSPS.hasCamParInSliceHeader() )
-#endif
   {
     m_cPPS.setSliceHeaderExtensionPresentFlag( true ); 
