Index: trunk/source/Lib/TLibCommon/ContextTables.h
===================================================================
--- trunk/source/Lib/TLibCommon/ContextTables.h	(revision 1180)
+++ trunk/source/Lib/TLibCommon/ContextTables.h	(revision 1196)
@@ -51,12 +51,7 @@
 #define NUM_SPLIT_FLAG_CTX            3       ///< number of context models for split flag
 #define NUM_SKIP_FLAG_CTX             3       ///< number of context models for skip flag
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
+#if H_3D
 #define NUM_DIS_FLAG_CTX              1
 #define NUM_DIS_TYPE_CTX              1       
-#else
-#if H_3D_SINGLE_DEPTH
-#define NUM_SINGLEDEPTH_FLAG_CTX                     1
-#define NUM_SINGLE_DEPTH_VALUE_DATA_CTX              1       
-#endif
 #endif
 #define NUM_MERGE_FLAG_EXT_CTX        1       ///< number of context models for merge flag of merge extended
@@ -158,5 +153,5 @@
   { CNU,  CNU,  CNU, }, 
 };
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
+#if H_3D
 static const UChar 
 INIT_DIS_FLAG[3][NUM_DIS_FLAG_CTX] =  
@@ -173,21 +168,4 @@
     { 137 }, 
 };
-#else
-#if H_3D_SINGLE_DEPTH
-static const UChar 
-INIT_SINGLEDEPTH_FLAG[3][NUM_SINGLEDEPTH_FLAG_CTX] =  
-{
-  { 185 }, 
-  { 185 }, 
-  { 185 }, 
-};
-static const UChar
-INIT_SINGLE_DEPTH_VALUE_DATA[3][NUM_SINGLE_DEPTH_VALUE_DATA_CTX] = 
-{
-  { 137 }, 
-  { 137 }, 
-  { 137 }, 
-};
-#endif
 #endif
 static const UChar
Index: trunk/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComDataCU.cpp	(revision 1180)
+++ trunk/source/Lib/TLibCommon/TComDataCU.cpp	(revision 1196)
@@ -60,12 +60,7 @@
   
   m_skipFlag           = NULL;
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
+#if H_3D
   m_bDISFlag           = NULL;
   m_uiDISType          = NULL;
-#else
-#if H_3D_SINGLE_DEPTH
-  m_singleDepthFlag     = NULL;
-  m_apSingleDepthValue  = NULL;
-#endif
 #endif
   m_pePartSize         = NULL;
@@ -158,5 +153,4 @@
   m_pbDBBPFlag         = NULL;
 #endif
-
 }
 
@@ -186,12 +180,7 @@
 
     m_skipFlag           = new Bool[ uiNumPartition ];
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
+#if H_3D
     m_bDISFlag           = new Bool[ uiNumPartition ];
     m_uiDISType          = (UInt*)xMalloc(UInt, uiNumPartition);
-#else
-#if H_3D_SINGLE_DEPTH
-    m_singleDepthFlag     = new Bool[ uiNumPartition ];
-    m_apSingleDepthValue  = (Pel*)xMalloc(Pel, uiNumPartition);
-#endif
 #endif
     m_pePartSize         = new Char[ uiNumPartition ];
@@ -337,12 +326,7 @@
 
     if ( m_skipFlag           ) { delete[] m_skipFlag;          m_skipFlag          = NULL; }
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
+#if H_3D
     if ( m_bDISFlag           ) { delete[] m_bDISFlag;   m_bDISFlag     = NULL; }
     if ( m_uiDISType         ) { xFree(m_uiDISType);  m_uiDISType    = NULL; }
-#else
-#if H_3D_SINGLE_DEPTH
-    if ( m_singleDepthFlag    ) { delete[] m_singleDepthFlag;   m_singleDepthFlag     = NULL; }
-    if ( m_apSingleDepthValue ) { xFree(m_apSingleDepthValue);  m_apSingleDepthValue  = NULL; }
-#endif
 #endif
     if ( m_pePartSize         ) { delete[] m_pePartSize;        m_pePartSize        = NULL; }
@@ -506,12 +490,7 @@
     TComDataCU * pcFrom = pcPic->getCU(getAddr());
     m_skipFlag[ui]   = pcFrom->getSkipFlag(ui);
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
+#if H_3D
     m_bDISFlag[ui]   = pcFrom->getDISFlag(ui);
     m_uiDISType[ui]  = pcFrom->getDISType(ui);
-#else
-#if H_3D_SINGLE_DEPTH
-    m_singleDepthFlag[ui]    = pcFrom->getSingleDepthFlag(ui);
-    m_apSingleDepthValue[ui] = pcFrom->getSingleDepthValue(ui);
-#endif
 #endif
     m_pePartSize[ui] = pcFrom->getPartitionSize(ui);
@@ -566,12 +545,7 @@
   {
     memset( m_skipFlag          + firstElement, false,                    numElements * sizeof( *m_skipFlag ) );
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
+#if H_3D
     memset( m_bDISFlag          + firstElement, false,                    numElements * sizeof( *m_bDISFlag ) );
     memset( m_uiDISType         + firstElement,     0,                    numElements * sizeof( *m_uiDISType) );
-#else
-#if H_3D_SINGLE_DEPTH
-    memset( m_singleDepthFlag     + firstElement, false,                  numElements * sizeof( *m_singleDepthFlag ) );
-    memset( m_apSingleDepthValue  + firstElement,     0,                  numElements * sizeof( *m_apSingleDepthValue ) );
-#endif
 #endif
     memset( m_pePartSize        + firstElement, SIZE_NONE,                numElements * sizeof( *m_pePartSize ) );
@@ -758,12 +732,7 @@
       m_puhTransformSkip[2][ui] = 0;
       m_skipFlag[ui]   = false;
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
+#if H_3D
       m_bDISFlag[ui]   = false;
       m_uiDISType[ui]  = 0;
-#else
-#if H_3D_SINGLE_DEPTH
-      m_singleDepthFlag[ui]     = false;
-      m_apSingleDepthValue[ui]  = 0;
-#endif
 #endif
       m_pePartSize[ui] = SIZE_NONE;
@@ -891,7 +860,4 @@
   memset( m_puhCbf[2],          0, iSizeInUchar );
   memset( m_puhDepth,     uiDepth, iSizeInUchar );
-#if H_3D_NBDV && !SEC_ARP_REM_ENC_RESTRICT_K0035
-  m_pDvInfo->bDV = false;
-#endif
 #if H_3D_ARP
   memset( m_puhARPW,            0, iSizeInUchar  );
@@ -934,12 +900,7 @@
   {
     m_skipFlag[ui]   = false;
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
+#if H_3D
     m_bDISFlag[ui]   = false;
     m_uiDISType[ui]  = 0;
-#else
-#if H_3D_SINGLE_DEPTH
-    m_singleDepthFlag[ui]   = false;
-    m_apSingleDepthValue[ui]= 0;
-#endif
 #endif
     m_pePartSize[ui] = SIZE_NONE;
@@ -964,12 +925,7 @@
       m_puhTransformSkip[2][ui] = pcCU->getTransformSkip(uiPartOffset+ui,TEXT_CHROMA_V);
       m_skipFlag[ui]   = pcCU->getSkipFlag(uiPartOffset+ui);
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
+#if H_3D
       m_bDISFlag[ui]    = pcCU->getDISFlag(uiPartOffset+ui);
       m_uiDISType[ui]   = pcCU->getDISType(uiPartOffset+ui);
-#else
-#if H_3D_SINGLE_DEPTH
-      m_singleDepthFlag[ui]    = pcCU->getSingleDepthFlag(uiPartOffset+ui);
-      m_apSingleDepthValue[ui] = pcCU->getSingleDepthValue(uiPartOffset+ui);
-#endif
 #endif
       m_pePartSize[ui] = pcCU->getPartitionSize(uiPartOffset+ui);
@@ -1000,6 +956,4 @@
       m_pbICFlag          [ui] = pcCU->m_pbICFlag[uiPartOffset+ui];
 #endif
-
-
 #if H_3D_DIM
       for( Int i = 0; i < DIM_NUM_TYPE; i++ )
@@ -1118,12 +1072,7 @@
   
   m_skipFlag=pcCU->getSkipFlag()          + uiPart;
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
+#if H_3D
   m_bDISFlag     = pcCU->getDISFlag()     + uiPart;
   m_uiDISType    = pcCU->getDISType()     + uiPart;
-#else
-#if H_3D_SINGLE_DEPTH
-  m_singleDepthFlag     = pcCU->getSingleDepthFlag()   + uiPart;
-  m_apSingleDepthValue  = pcCU->getSingleDepthValue()  + uiPart;
-#endif
 #endif
   m_phQP=pcCU->getQP()                    + uiPart;
@@ -1143,5 +1092,4 @@
   m_pbSPIVMPFlag        = pcCU->getSPIVMPFlag()          + uiPart;
 #endif
-
 #if H_3D_ARP
   m_puhARPW             = pcCU->getARPW()             + uiPart;
@@ -1150,6 +1098,4 @@
   m_pbICFlag            = pcCU->getICFlag()           + uiPart;
 #endif
-
-
   m_puhLumaIntraDir     = pcCU->getLumaIntraDir()     + uiPart;
   m_puhChromaIntraDir   = pcCU->getChromaIntraDir()   + uiPart;
@@ -1260,12 +1206,7 @@
   
   m_skipFlag           = pcCU->getSkipFlag ()             + uiAbsPartIdx;
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
+#if H_3D
   m_bDISFlag           = pcCU->getDISFlag ()              + uiAbsPartIdx;
   m_uiDISType          = pcCU->getDISType()               + uiAbsPartIdx;
-#else
-#if H_3D_SINGLE_DEPTH
-  m_singleDepthFlag     = pcCU->getSingleDepthFlag ()             + uiAbsPartIdx;
-  m_apSingleDepthValue  = pcCU->getSingleDepthValue ()            + uiAbsPartIdx;
-#endif
 #endif
   m_pePartSize         = pcCU->getPartitionSize ()        + uiAbsPartIdx;
@@ -1295,15 +1236,11 @@
 #endif
 #if H_3D_SPIVMP
-  m_pbSPIVMPFlag       = pcCU->getSPIVMPFlag()               + uiAbsPartIdx;
-#endif
-
+  m_pbSPIVMPFlag       = pcCU->getSPIVMPFlag()            + uiAbsPartIdx;
+#endif
   m_apiMVPIdx[eRefPicList] = pcCU->getMVPIdx(eRefPicList) + uiAbsPartIdx;
-  m_apiMVPNum[eRefPicList] = pcCU->getMVPNum(eRefPicList) + uiAbsPartIdx;
-  
+  m_apiMVPNum[eRefPicList] = pcCU->getMVPNum(eRefPicList) + uiAbsPartIdx;  
 #if H_3D_ARP
   m_puhARPW            = pcCU->getARPW()                  + uiAbsPartIdx;
-#endif
-
-    
+#endif    
 #if H_3D_DBBP
   m_pbDBBPFlag       = pcCU->getDBBPFlag()              + uiAbsPartIdx;
@@ -1340,12 +1277,7 @@
   Int sizeInChar  = sizeof( Char ) * uiNumPartition;
   memcpy( m_skipFlag   + uiOffset, pcCU->getSkipFlag(),       sizeof( *m_skipFlag )   * uiNumPartition );
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
+#if H_3D
   memcpy( m_bDISFlag   + uiOffset, pcCU->getDISFlag(),       sizeof( *m_bDISFlag )   * uiNumPartition );
   memcpy( m_uiDISType  + uiOffset, pcCU->getDISType(),       sizeof( *m_uiDISType )  * uiNumPartition);
-#else
-#if H_3D_SINGLE_DEPTH
-  memcpy( m_singleDepthFlag     + uiOffset, pcCU->getSingleDepthFlag(),       sizeof( *m_singleDepthFlag )   * uiNumPartition );
-  memcpy( m_apSingleDepthValue  + uiOffset, pcCU->getSingleDepthValue(),      sizeof( *m_apSingleDepthValue ) * uiNumPartition);
-#endif
 #endif
   memcpy( m_phQP       + uiOffset, pcCU->getQP(),             sizeInChar                        );
@@ -1358,5 +1290,4 @@
   memcpy( m_piVSPFlag           + uiOffset, pcCU->getVSPFlag(),           sizeof( Char ) * uiNumPartition );
   memcpy( m_pDvInfo             + uiOffset, pcCU->getDvInfo(),            sizeof( *m_pDvInfo ) * uiNumPartition );
-
 #endif
 #if H_3D_SPIVMP
@@ -1374,7 +1305,4 @@
   memcpy( m_puhCbf[1] + uiOffset, pcCU->getCbf(TEXT_CHROMA_U), iSizeInUchar );
   memcpy( m_puhCbf[2] + uiOffset, pcCU->getCbf(TEXT_CHROMA_V), iSizeInUchar );
-
-
-
 #if H_3D_DIM
   for( Int i = 0; i < DIM_NUM_TYPE; i++ )
@@ -1465,12 +1393,7 @@
 
   memcpy( rpcCU->getSkipFlag() + m_uiAbsIdxInLCU, m_skipFlag, sizeof( *m_skipFlag ) * m_uiNumPartition );
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
+#if H_3D
   memcpy( rpcCU->getDISFlag()  + m_uiAbsIdxInLCU, m_bDISFlag,    sizeof( *m_bDISFlag )  * m_uiNumPartition );
   memcpy( rpcCU->getDISType()  + m_uiAbsIdxInLCU, m_uiDISType,   sizeof( *m_uiDISType ) * m_uiNumPartition );
-#else
-#if H_3D_SINGLE_DEPTH
-  memcpy( rpcCU->getSingleDepthFlag()  + m_uiAbsIdxInLCU, m_singleDepthFlag,    sizeof( *m_singleDepthFlag ) * m_uiNumPartition );
-  memcpy( rpcCU->getSingleDepthValue() + m_uiAbsIdxInLCU, m_apSingleDepthValue, sizeof( *m_apSingleDepthValue ) * m_uiNumPartition);
-#endif
 #endif
   memcpy( rpcCU->getQP() + m_uiAbsIdxInLCU, m_phQP, sizeInChar  );
@@ -1478,6 +1401,4 @@
   memcpy( rpcCU->getDvInfo()         + m_uiAbsIdxInLCU, m_pDvInfo,    sizeof(* m_pDvInfo)     * m_uiNumPartition );
 #endif
-
-
   memcpy( rpcCU->getPartitionSize()  + m_uiAbsIdxInLCU, m_pePartSize, sizeof( *m_pePartSize ) * m_uiNumPartition );
   memcpy( rpcCU->getPredictionMode() + m_uiAbsIdxInLCU, m_pePredMode, sizeof( *m_pePredMode ) * m_uiNumPartition );
@@ -1585,12 +1506,7 @@
   Int sizeInChar  = sizeof( Char ) * uiQNumPart;
   memcpy( rpcCU->getSkipFlag()       + uiPartOffset, m_skipFlag,   sizeof( *m_skipFlag )   * uiQNumPart );
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
+#if H_3D
   memcpy( rpcCU->getDISFlag()  + uiPartOffset, m_bDISFlag,    sizeof( *m_bDISFlag )   * uiQNumPart );
   memcpy( rpcCU->getDISType()  + uiPartOffset, m_uiDISType,   sizeof( *m_uiDISType )  * uiQNumPart );
-#else
-#if H_3D_SINGLE_DEPTH
-  memcpy( rpcCU->getSingleDepthFlag()  + uiPartOffset, m_singleDepthFlag,    sizeof( *m_singleDepthFlag )   * uiQNumPart );
-  memcpy( rpcCU->getSingleDepthValue() + uiPartOffset, m_apSingleDepthValue, sizeof( *m_apSingleDepthValue ) * uiQNumPart);
-#endif
 #endif
   memcpy( rpcCU->getQP() + uiPartOffset, m_phQP, sizeInChar );
@@ -1616,6 +1532,4 @@
   memcpy( rpcCU->getCbf(TEXT_CHROMA_U) + uiPartOffset, m_puhCbf[1], iSizeInUchar );
   memcpy( rpcCU->getCbf(TEXT_CHROMA_V) + uiPartOffset, m_puhCbf[2], iSizeInUchar );
-
-
 #if H_3D_DIM
   for( Int i = 0; i < DMM_NUM_TYPE; i++ )
@@ -2352,6 +2266,5 @@
   {
     return NULL;
-  }
-  
+  }  
 #if H_3D_FCO
   TComPic* depthPic = getSlice()->getIvPic(true, getSlice()->getViewIndex() );
@@ -2388,8 +2301,4 @@
     Int iPictureHeight = depthPicYuv->getHeight();
     
-#if !HS_DBBP_CLEAN_K0048
-    Int iWidth  = uiWidth;
-    Int iHeight = uiHeight;
-#endif
     
     Bool depthRefineFlag = false;
@@ -2404,11 +2313,6 @@
     }
     
-#if HS_DBBP_CLEAN_K0048
     Int depthPosX = Clip3(0,   iPictureWidth - 1,  iBlkX + ((cDv.getHor()+2)>>2));
     Int depthPosY = Clip3(0,   iPictureHeight - 1, iBlkY + ((cDv.getVer()+2)>>2));
-#else
-    Int depthPosX = Clip3(0,   iPictureWidth - iWidth,  iBlkX + ((cDv.getHor()+2)>>2));
-    Int depthPosY = Clip3(0,   iPictureHeight- iHeight, iBlkY + ((cDv.getVer()+2)>>2));
-#endif
     
     pDepthPels = depthPicYuv->getLumaAddr() + depthPosX + depthPosY * uiDepthStride;
@@ -2500,6 +2404,5 @@
   memset( m_skipFlag + absPartIdx, skip, m_pcPic->getNumPartInCU() >> ( 2 * depth ) );
 }
-
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
+#if H_3D
 Void TComDataCU::setDISFlagSubParts( Bool bDIS, UInt absPartIdx, UInt depth )
 {
@@ -2512,17 +2415,4 @@
     setSubPartT( uiDISType, m_uiDISType, uiAbsPartIdx, uiDepth, uiPUIdx );
 }
-#else
-#if H_3D_SINGLE_DEPTH
-Void TComDataCU::setSingleDepthFlagSubParts( Bool singleDepth, UInt absPartIdx, UInt depth )
-{
-  assert( sizeof( *m_singleDepthFlag) == 1 );
-  memset( m_singleDepthFlag + absPartIdx, singleDepth, m_pcPic->getNumPartInCU() >> ( 2 * depth ) );
-}
-
-Void TComDataCU::setSingleDepthValueSubParts(Pel singleDepthValue, UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth )
-{
-  setSubPartT<Pel>( singleDepthValue, m_apSingleDepthValue, uiAbsPartIdx, uiDepth, uiPUIdx );
-}
-#endif
 #endif
 
@@ -3941,5 +3831,5 @@
 #endif
 #if H_3D_ARP
-  Bool bARPFlag = getARPW(uiAbsPartIdx)>0 ? true : false;
+  Bool bARPFlag = getARPW(uiAbsPartIdx) > 0;
 #endif
 #if H_3D_DBBP
@@ -3974,6 +3864,5 @@
     m_mergCands[MRG_A1].setCand( &pcMvFieldNeighbours[m_baseListidc<<1], puhInterDirNeighbours[m_baseListidc]
 #if H_3D_VSP
-    , 
-      (pcCULeft->getVSPFlag(uiLeftPartIdx) != 0
+    , (pcCULeft->getVSPFlag(uiLeftPartIdx) != 0
 #if H_3D_IC
       && !bICFlag
@@ -3998,6 +3887,5 @@
     m_mergCands[MRG_B1].setCand( &pcMvFieldNeighbours[m_baseListidc<<1], puhInterDirNeighbours[m_baseListidc]
 #if H_3D_VSP
-    ,
-      false
+    , false
 #endif
       , false
@@ -4026,6 +3914,5 @@
     m_mergCands[MRG_A0].setCand( &pcMvFieldNeighbours[m_baseListidc<<1], puhInterDirNeighbours[m_baseListidc]
 #if H_3D_VSP
-    ,
-      false
+    , false
 #endif
       , false
@@ -4040,6 +3927,5 @@
     m_mergCands[MRG_B2].setCand( &pcMvFieldNeighbours[m_baseListidc<<1], puhInterDirNeighbours[m_baseListidc]
 #if H_3D_VSP
-    ,
-      false
+    , false
 #endif
       , false
@@ -4068,9 +3954,5 @@
     TComPic * pcTexPic = m_pcSlice->getTexturePic();
 #if H_3D_FCO
-#if H_3D_FCO
     if (pcTexPic && pcTexPic->getReconMark())
-#else
-    if (pcTexturePic->getReconMark())
-#endif
     {
 #endif    
@@ -4107,5 +3989,5 @@
       Int         iTexPosX, iTexPosY;
       const TComMv cMvRounding( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) );
-      
+
       Int         iCenterPosX = iCurrPosX + ( ( iWidth /  iPUWidth ) >> 1 )  * iPUWidth + ( iPUWidth >> 1 );
       Int         iCenterPosY = iCurrPosY + ( ( iHeight /  iPUHeight ) >> 1 )  * iPUHeight + (iPUHeight >> 1);
@@ -4114,6 +3996,6 @@
       if(iWidth == iPUWidth && iHeight == iPUHeight)
       {
-          iCenterPosX = iCurrPosX + (iWidth >> 1);
-          iCenterPosY = iCurrPosY + (iHeight >> 1);
+        iCenterPosX = iCurrPosX + (iWidth >> 1);
+        iCenterPosY = iCurrPosY + (iHeight >> 1);
       }
 
@@ -4151,8 +4033,8 @@
       if ( bSPIVMPFlag == true )
       {   
-          iInterDirSaved = (cMvFieldSaved[0].getRefIdx()!=-1 ? 1: 0) + (cMvFieldSaved[1].getRefIdx()!=-1 ? 2: 0);
-          tmpDir = iInterDirSaved;
-          tmpMV[0] = cMvFieldSaved[0];
-          tmpMV[1] = cMvFieldSaved[1];
+        iInterDirSaved = (cMvFieldSaved[0].getRefIdx()!=-1 ? 1: 0) + (cMvFieldSaved[1].getRefIdx()!=-1 ? 2: 0);
+        tmpDir = iInterDirSaved;
+        tmpMV[0] = cMvFieldSaved[0];
+        tmpMV[1] = cMvFieldSaved[1];
       }
 
@@ -4180,7 +4062,4 @@
                   TComMv cMv = cTexMvField.getMv() + cMvRounding;
                   cMv >>=2;          
-#if !(NTT_BUG_FIX_TK54)
-                  this->clipMv( cMv );
-#endif
                   pcMvFieldSP[2*iPartition + uiCurrRefListId].setMvField(cMv, iValidDepRef);
                 }
@@ -4197,14 +4076,4 @@
               }
             }
-#if !SHARP_SUBBLOCK_CLEAN_K0044
-            if (iPUHeight + iPUWidth == 12)
-            {
-              if (puhInterDirSP[iPartition] == 3)
-              {
-                puhInterDirSP[iPartition] = 1;
-                pcMvFieldSP[2*iPartition + 1].setMvField(TComMv(0,0), -1);
-              }
-            }
-#endif
 
             iPartition ++;
@@ -4309,14 +4178,14 @@
     if (!bRemoveSpa)
     {
-      Bool SPIVMPFlag = false;
+      Bool spiMvpFlag = false;
       if(!m_pcSlice->getIsDepth())
       {
-        SPIVMPFlag = true;
+        spiMvpFlag = true;
       }
 #if H_3D_DBBP
-      SPIVMPFlag &= !bDBBPFlag;
-#endif
-
-      m_mergCands[MRG_IVMC].setCand( tmpMV, ivCandDir[0], false, SPIVMPFlag);
+      spiMvpFlag &= !bDBBPFlag;
+#endif
+
+      m_mergCands[MRG_IVMC].setCand( tmpMV, ivCandDir[0], false, spiMvpFlag);
 
       if ( mrgCandIdx == iCount )
@@ -5422,6 +5291,6 @@
 }
 
-#if SONY_MV_V_CONST_C0078
-Void TComDataCU::checkMV_V (TComMv&  rcMv,  RefPicList eRefPicList, int iRefIdx )
+#if H_MV
+Void TComDataCU::checkMvVertRest (TComMv&  rcMv,  RefPicList eRefPicList, int iRefIdx )
 {
   if ( getSlice()->getSPS()->getInterViewMvVertConstraintFlag() )
@@ -5780,28 +5649,17 @@
   }
 
-  if ( bIsCurrRefLongTerm || bIsColRefLongTerm ) // CY: this condition equals to both bIsCurrRefLongTerm and bIsColRefLongTerm being 1
+  if ( bIsCurrRefLongTerm || bIsColRefLongTerm )
   {
 #if H_3D_TMVP
-#if !H_3D_FIX_TMVP_SCALING_VIEW_ID
-    Int iCurrViewId    = m_pcSlice->getViewIndex (); 
-    Int iCurrRefViewId = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewIndex (); 
-    Int iColViewId     = pColCU->getSlice()->getViewIndex(); 
-    Int iColRefViewId  = pColCU->getSlice()->getRefPic( eColRefPicList, pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr))->getViewIndex(); 
-#else
     Int iCurrViewId    = m_pcSlice->getViewId (); 
     Int iCurrRefViewId = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewId (); 
     Int iColViewId     = pColCU->getSlice()->getViewId(); 
     Int iColRefViewId  = pColCU->getSlice()->getRefPic( eColRefPicList, pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr))->getViewId(); 
-#endif
-#if H_3D_TMVP_SCALING_FIX_K0053
     iScale = 4096;
     if ( iCurrRefViewId != iCurrViewId && iColViewId != iColRefViewId )
-#endif
+    {
       iScale = xGetDistScaleFactor( iCurrViewId, iCurrRefViewId, iColViewId, iColRefViewId );
-#if H_3D_TMVP_FIX_TICKET_97 
+    }
     if ( bMRG && iScale != 4096 && m_pcSlice->getIvMvScalingFlag( ) ) 
-#else
-    if ( iScale != 4096 && m_pcSlice->getIvMvScalingFlag( ) )
-#endif
     {
       rcMv = cColMv.scaleMv( iScale );
@@ -5815,5 +5673,5 @@
 #endif
   }
-  else // CY: both bIsCurrRefLongTerm and bIsColRefLongTerm are 0
+  else
   {
     iScale = xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iColPOC, iColRefPOC);
@@ -5979,12 +5837,8 @@
 }
 #endif
+
 #if H_3D_IV_MERGE
-#if SEC_ARP_REM_ENC_RESTRICT_K0035
 Void TComDataCU::getDispforDepth (UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDisp)
-#else
-Bool TComDataCU::getDispforDepth (UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDisp)
-#endif
-{
-
+{
   assert(getPartitionSize( uiPartAddr ) == SIZE_2Nx2N);
 
@@ -5992,26 +5846,19 @@
   if ( getSlice()->getDefaultRefViewIdxAvailableFlag() )
   {
-      Int iViewIdx = getSlice()->getDefaultRefViewIdx();
-      pDisp->m_aVIdxCan = iViewIdx;
-      Int iDisp     = getSlice()->getDepthToDisparityB( iViewIdx )[ (Int64) (1 << ( getSlice()->getSPS()->getBitDepthY() - 1 )) ];
-
-      cMv.setHor(iDisp);
-      cMv.setVer(0);
-      pDisp->m_acNBDV = cMv;
-      pDisp->m_aVIdxCan = iViewIdx;
-#if !SEC_ARP_REM_ENC_RESTRICT_K0035
-      return true;
-#endif
-  }
-#if !SEC_ARP_REM_ENC_RESTRICT_K0035
-  return false;
-#endif
-}
-#endif
-
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
+    Int iViewIdx = getSlice()->getDefaultRefViewIdx();
+    pDisp->m_aVIdxCan = iViewIdx;
+    Int iDisp     = getSlice()->getDepthToDisparityB( iViewIdx )[ (Int64) (1 << ( getSlice()->getSPS()->getBitDepthY() - 1 )) ];
+
+    cMv.setHor(iDisp);
+    cMv.setVer(0);
+    pDisp->m_acNBDV = cMv;
+    pDisp->m_aVIdxCan = iViewIdx;
+  }
+}
+#endif
+
+#if H_3D
 Bool TComDataCU::getNeighDepth ( UInt uiPartIdx, UInt uiPartAddr, Pel* pNeighDepth, Int index )
 {
-#if NEIGHBORING_PIX_AVAILABILITY_FIX
   UInt  uiPartIdxLT, uiPartIdxRT;
   this->deriveLeftRightTopIdxAdi( uiPartIdxLT, uiPartIdxRT, 0, 0 );
@@ -6066,72 +5913,6 @@
 
   return bDepAvail;
-#else
-  Bool bDepAvail = false;
-  Pel *pDepth  = this->getPic()->getPicYuvRec()->getLumaAddr();
-  Int iDepStride =  this->getPic()->getPicYuvRec()->getStride();
-
-  Int xP, yP, nPSW, nPSH;
-  this->getPartPosition(uiPartIdx, xP, yP, nPSW, nPSH);
-  UInt PicHeight=this->getPic()->getPicYuvRec()->getHeight();
-  UInt PicWidth=this->getPic()->getPicYuvRec()->getWidth();
-  switch(index)
-  {
-  case 0: // Mid Left
-    if( ( xP != 0 ) && ( ( yP + ( nPSH >> 1 ) ) < PicHeight ) )
-    {
-      *pNeighDepth = pDepth[ (yP+(nPSH>>1)) * iDepStride + (xP-1) ];
-      bDepAvail = true;
-    }
-    break;
-  case 1: // Mid Above
-    if( ( yP != 0 ) && ( ( xP + ( nPSW >> 1 ) ) < PicWidth ) )
-    {
-      *pNeighDepth = pDepth[ (yP-1) * iDepStride + (xP + (nPSW>>1)) ];
-      bDepAvail = true;
-    }
-    break;
-  default:
-    break;
-  }
-  return bDepAvail;
-#endif
-}
-#else
-#if H_3D_SINGLE_DEPTH
-Bool TComDataCU::getNeighDepth (UInt uiPartIdx, UInt uiPartAddr, Pel* pNeighDepth, Int index)
-{
-
-  Bool bDepAvail = false;
-  Pel *pDepth  = this->getPic()->getPicYuvRec()->getLumaAddr();
-  Int iDepStride =  this->getPic()->getPicYuvRec()->getStride();
-
-  Int xP, yP, nPSW, nPSH;
-  this->getPartPosition(uiPartIdx, xP, yP, nPSW, nPSH);
-  UInt PicHeight=this->getPic()->getPicYuvRec()->getHeight();
-  UInt PicWidth=this->getPic()->getPicYuvRec()->getWidth();
-  switch(index)
-  {
-  case 0: // Mid Left
-    if( ( xP != 0 ) && ( ( yP + ( nPSH >> 1 ) ) < PicHeight ) )
-    {
-      *pNeighDepth = pDepth[ (yP+(nPSH>>1)) * iDepStride + (xP-1) ];
-      bDepAvail = true;
-    }
-    break;
-  case 1: // Mid Above
-    if( ( yP != 0 ) && ( ( xP + ( nPSW >> 1 ) ) < PicWidth ) )
-    {
-      *pNeighDepth = pDepth[ (yP-1) * iDepStride + (xP + (nPSW>>1)) ];
-      bDepAvail = true;
-    }
-    break;
-  default:
-      break;
-  }
-  return bDepAvail;
-}
-#endif
-#endif
-
+}
+#endif
 #if H_3D_NBDV 
 //Notes from QC:
@@ -6139,9 +5920,5 @@
 //TBD#2: set of DvMCP values need to be done as part of inter-view motion prediction process. Remove this comment once merge related integration is done
 //To be checked: Parallel Merge features for NBDV, related to DV_DERIVATION_PARALLEL_B0096 and LGE_IVMP_PARALLEL_MERGE_B0136 are not integrated. The need of these features due to the adoption of CU-based NBDV is not clear. We need confirmation on this, especially by proponents
-#if SEC_ARP_REM_ENC_RESTRICT_K0035
 Void TComDataCU::getDisMvpCandNBDV( DisInfo* pDInfo
-#else
-Bool TComDataCU::getDisMvpCandNBDV( DisInfo* pDInfo
-#endif
 #if H_3D_NBDV_REF
 , Bool bDepthRefine
@@ -6151,7 +5928,4 @@
   //// ******* Init variables ******* /////
   // Init disparity struct for results
-#if !SEC_ARP_REM_ENC_RESTRICT_K0035
-  pDInfo->bDV = false;   
-#endif
   pDInfo->m_aVIdxCan = -1;
 
@@ -6217,7 +5991,4 @@
       if( bCheck )
       {
-#if !(NTT_BUG_FIX_TK54)
-        clipMv(cColMv);
-#endif
         pDInfo->m_acNBDV = cColMv;
         pDInfo->m_aVIdxCan  = iTargetViewIdx;
@@ -6239,18 +6010,12 @@
 #else
         picDepth = getSlice()->getIvPic( true, iTargetViewIdx );
-#if !BUG_FIX_TK65
-        assert(picDepth != NULL);
-#endif
 #endif
         if (picDepth && bDepthRefine)
+        {
           estimateDVFromDM(iTargetViewIdx, uiPartIdx, picDepth, uiPartAddr, &cColMv );
-
+        }
         pDInfo->m_acDoNBDV  = cColMv;
 #endif //H_3D_NBDV_REF
-#if SEC_ARP_REM_ENC_RESTRICT_K0035
         return;
-#else
-        return true;
-#endif
       }
     }
@@ -6269,9 +6034,5 @@
 #endif
     ) )
-#if SEC_ARP_REM_ENC_RESTRICT_K0035
     return;
-#else
-    return true;
-#endif
 
   //// ******* Get disparity from above block ******* /////
@@ -6285,9 +6046,5 @@
 #endif
       ) )
-#if SEC_ARP_REM_ENC_RESTRICT_K0035
       return;
-#else
-      return true;
-#endif
   }
 
@@ -6302,7 +6059,4 @@
         {
           TComMv cDispVec = cIDVInfo.m_acMvCand[iList][ curPos ];
-#if !(NTT_BUG_FIX_TK54)
-          clipMv( cDispVec );
-#endif
           pDInfo->m_acNBDV = cDispVec;
           pDInfo->m_aVIdxCan = cIDVInfo.m_aVIdxCan[iList][ curPos ];
@@ -6324,7 +6078,4 @@
 #else
           TComPic* picDepth = getSlice()->getIvPic( true, pDInfo->m_aVIdxCan );
-#if !BUG_FIX_TK65
-          assert(picDepth!=NULL);
-#endif
 #endif
 
@@ -6335,9 +6086,5 @@
           pDInfo->m_acDoNBDV = cDispVec;
 #endif
-#if SEC_ARP_REM_ENC_RESTRICT_K0035
           return;
-#else
-          return true;
-#endif
         }
       }
@@ -6350,36 +6097,30 @@
   if (getSlice()->getDefaultRefViewIdxAvailableFlag())
   {
-      pDInfo->m_aVIdxCan = getSlice()->getDefaultRefViewIdx();
+    pDInfo->m_aVIdxCan = getSlice()->getDefaultRefViewIdx();
 
 #if H_3D_NBDV_REF
-          TComPic* picDepth = NULL;
+    TComPic* picDepth = NULL;
 #if H_3D_FCO_VSP_DONBDV_E0163
-          picDepth  = getSlice()->getIvPic(true, getSlice()->getViewIndex() );
-      if ( picDepth->getPicYuvRec() != NULL )  
-      {
-          defaultDV.setZero();
-      }
-      else // Go back with virtual depth
-      {
-          picDepth = getSlice()->getIvPic( true, getSlice()->getDefaultRefViewIdx());
-      }
-
-      assert(picDepth != NULL);
+    picDepth  = getSlice()->getIvPic(true, getSlice()->getViewIndex() );
+    if ( picDepth->getPicYuvRec() != NULL )  
+    {
+      defaultDV.setZero();
+    }
+    else // Go back with virtual depth
+    {
+      picDepth = getSlice()->getIvPic( true, getSlice()->getDefaultRefViewIdx());
+    }
+
+    assert(picDepth != NULL);
 #else
-          picDepth = getSlice()->getIvPic( true, getSlice()->getDefaultRefViewIdx());
-#endif
-      if (picDepth && bDepthRefine)
-      {
-          estimateDVFromDM(getSlice()->getDefaultRefViewIdx(), uiPartIdx, picDepth, uiPartAddr, &defaultDV ); // from base view
-      }
-      pDInfo->m_acDoNBDV = defaultDV;
-#endif
-#if !SEC_ARP_REM_ENC_RESTRICT_K0035
-      return true;
-#endif
-  }
-#if !SEC_ARP_REM_ENC_RESTRICT_K0035
-  return false; 
-#endif
+    picDepth = getSlice()->getIvPic( true, getSlice()->getDefaultRefViewIdx());
+#endif
+    if (picDepth && bDepthRefine)
+    {
+      estimateDVFromDM(getSlice()->getDefaultRefViewIdx(), uiPartIdx, picDepth, uiPartAddr, &defaultDV ); // from base view
+    }
+    pDInfo->m_acDoNBDV = defaultDV;
+#endif
+  }
 }
 
@@ -6423,7 +6164,4 @@
     Pel iDisp = getMcpFromDM( pcBaseViewDepthPicYuv, cMvPred, iBlkX, iBlkY, iWidth, iHeight, aiShiftLUT );
     cMvPred->setHor( iDisp );
-#if !(NTT_BUG_FIX_TK54)
-    clipMv(*cMvPred);
-#endif
   }
 }
@@ -6451,7 +6189,4 @@
         if (refViewIdx != m_pcSlice->getViewIndex()) 
         {
-#if !(NTT_BUG_FIX_TK54)
-          clipMv(cMvPred);
-#endif
           pNbDvInfo->m_acNBDV = cMvPred;
           pNbDvInfo->m_aVIdxCan = refViewIdx;
@@ -6472,7 +6207,4 @@
 #else
           picDepth   = getSlice()->getIvPic (true, refViewIdx );
-#if !BUG_FIX_TK65
-          assert(picDepth != NULL);
-#endif
 #endif
           UInt uiPartIdx = 0;   //Notes from MTK: Please confirm that using 0 as partition index and partition address is correct for CU-level DoNBDV
@@ -6480,6 +6212,7 @@
 
           if (picDepth && bDepthRefine)
+          {
             estimateDVFromDM(refViewIdx, uiPartIdx, picDepth, uiPartAddr, &cMvPred );
-
+          }
           pNbDvInfo->m_acDoNBDV = cMvPred;
 #endif
@@ -6870,7 +6603,4 @@
 #endif
 #endif
-#if !(NTT_BUG_FIX_TK54)
-                      clipMv( cMv );
-#endif
                       paiPdmRefIdx  [ uiCurrRefListId ] = iPdmRefIdx;
                       pacPdmMv      [ uiCurrRefListId ] = cMv;
@@ -6904,6 +6634,6 @@
                 {
                   RefPicList  eCurrRefPicList = RefPicList( uiCurrRefListId );
-                  Bool bLoop_stop = false;
-                  for(Int iLoop = 0; iLoop < 2 && !bLoop_stop; ++iLoop)
+                  Bool bLoopStop = false;
+                  for(Int iLoop = 0; iLoop < 2 && !bLoopStop; ++iLoop)
                   {
                     RefPicList eBaseRefPicList = (iLoop ==1)? RefPicList( 1 -  uiCurrRefListId ) : RefPicList( uiCurrRefListId );
@@ -6931,8 +6661,5 @@
                             }
 
-#if !(NTT_BUG_FIX_TK54)
-                            clipMv( cMv );
-#endif
-                            bLoop_stop = true;
+                            bLoopStop = true;
 
                             pcMvFieldSP[2*iPartition + uiCurrRefListId].setMvField(cMv, iPdmRefIdx);
@@ -6954,14 +6681,4 @@
 
               }
-#if !SHARP_SUBBLOCK_CLEAN_K0044
-              if (iSPHeight + iSPWidth == 12)
-              {
-                if (puhInterDirSP[iPartition] == 3)
-                {
-                  puhInterDirSP[iPartition] = 1;
-                  pcMvFieldSP[2*iPartition + 1].setMvField(TComMv(0,0), -1);
-                }
-              }
-#endif
               iPartition ++;
             }
@@ -6996,11 +6713,6 @@
       Int         iBaseAbsPartIdx;
 
-#if SEC_SHIFTED_IVMC_POS_K0036
       Int offsetW = (iLoopCan == 0) ? 0 : ( iWidth  * 2 );
       Int offsetH = (iLoopCan == 0) ? 0 : ( iHeight * 2 );
-#else
-      Int offsetW = (iLoopCan == 0) ? 0 : ( ((iWidth /2)*4) + 4 );
-      Int offsetH = (iLoopCan == 0) ? 0 : ( ((iHeight/2)*4) + 4 );
-#endif
 
       Int         iBasePosX   = Clip3( 0, pcBaseRec->getWidth () - 1, iCurrPosX + ( (cDv.getHor() + offsetW + 2 ) >> 2 ) );
@@ -7048,7 +6760,4 @@
 #endif
 #endif
-#if !(NTT_BUG_FIX_TK54)
-                    clipMv( cMv );
-#endif
                     paiPdmRefIdx  [ (uiCurrRefListId + (iLoopCan<<2)) ] = iPdmRefIdx;
                     pacPdmMv      [ (uiCurrRefListId + (iLoopCan<<2)) ] = cMv;
@@ -7104,7 +6813,4 @@
 #endif
             cMv.setVer( 0 );
-#if !(NTT_BUG_FIX_TK54)
-            clipMv( cMv );
-#endif
             pacPdmMv      [iRefListId + 2 + (iLoopCan<<2)] = cMv;
           }
@@ -7187,5 +6893,8 @@
 {
   UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1);
-  for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) { m_dmmWedgeTabIdx[dmmType][uiAbsPartIdx+ui] = tabIdx; }
+  for( UInt ui = 0; ui < uiCurrPartNumb; ui++ )
+  { 
+    m_dmmWedgeTabIdx[dmmType][uiAbsPartIdx+ui] = tabIdx; 
+  }
 }
 #endif
Index: trunk/source/Lib/TLibCommon/TComDataCU.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComDataCU.h	(revision 1180)
+++ trunk/source/Lib/TLibCommon/TComDataCU.h	(revision 1196)
@@ -72,5 +72,5 @@
   PartSize    eVirtualPartSize;
   UInt        uiVirtualPartIndex;
-} DBBPTmpData;
+} DbbpTmpData;
 #endif
 
@@ -110,12 +110,7 @@
   // -------------------------------------------------------------------------------------------------------------------
   Bool*         m_skipFlag;           ///< array of skip flags
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
+#if H_3D
   Bool*         m_bDISFlag;         
   UInt*         m_uiDISType;
-#else
-#if H_3D_SINGLE_DEPTH
-  Bool*         m_singleDepthFlag;           ///< array of single depth flags
-  Pel*          m_apSingleDepthValue;
-#endif
 #endif
   Char*         m_pePartSize;         ///< array of partition sizes
@@ -178,10 +173,8 @@
 #endif
 #if H_3D_VSP
-  Char*         m_piVSPFlag;          ///< array of VSP flags to indicate whehter a block uses VSP or not
-                                      ///< 0: non-VSP; 1: VSP
+  Char*         m_piVSPFlag;          ///< array of VSP flags to indicate whehter a block uses VSP or not  ///< 0: non-VSP; 1: VSP
 #endif
 #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
+  Bool*         m_pbSPIVMPFlag;       ///< array of sub-PU IVMP flags to indicate whehter a block uses sub-PU IVMP ///< 0: non-SPIVMP; 1: SPIVMP
 #endif
 #if H_3D_ARP
@@ -199,10 +192,10 @@
   Bool*         m_pbSDCFlag;
   Pel*          m_apSegmentDCOffset[2];
-  Pel          m_apDmmPredictor[2];
+  Pel           m_apDmmPredictor[2];
 #endif
 #endif
 #if H_3D_DBBP
   Bool*         m_pbDBBPFlag;        ///< array of DBBP flags
-  DBBPTmpData   m_sDBBPTmpData;
+  DbbpTmpData   m_sDBBPTmpData;
 #endif
 #if H_3D
@@ -252,6 +245,5 @@
   Bool          xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx 
 #if H_3D_TMVP
-  ,
-  Bool bMRG = true
+  ,  Bool bMRG = true
 #endif
   );
@@ -350,5 +342,5 @@
   Void         setSkipFlag           ( UInt idx, Bool skip)     { m_skipFlag[idx] = skip;   }
   Void         setSkipFlagSubParts   ( Bool skip, UInt absPartIdx, UInt depth );
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
+#if H_3D
   Bool*        getDISFlag            ()                         { return m_bDISFlag;          }
   Bool         getDISFlag            ( UInt idx)                { return m_bDISFlag[idx];     }
@@ -360,16 +352,4 @@
   Void         getDISType            ( UInt idx, UInt uiDISType)     { m_uiDISType[idx] = uiDISType;   }
   Void         setDISTypeSubParts    ( UInt uiDISType, UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth );
-#else
-#if H_3D_SINGLE_DEPTH
-  Bool*        getSingleDepthFlag            ()                        { return m_singleDepthFlag;          }
-  Bool         getSingleDepthFlag            (UInt idx)                { return m_singleDepthFlag[idx];     }
-  Void         setSingleDepthFlag           ( UInt idx, Bool singleDepth)     { m_singleDepthFlag[idx] = singleDepth;   }
-  Void         setSingleDepthFlagSubParts   ( Bool singleDepth, UInt absPartIdx, UInt depth );
-
-  Pel*         getSingleDepthValue( ) { return m_apSingleDepthValue; }
-  Pel          getSingleDepthValue            (UInt idx)                { return m_apSingleDepthValue[idx];     }
-  Void         setSingleDepthValue           ( UInt idx, Pel pDepthValue)     { m_apSingleDepthValue[idx] = pDepthValue;   }
-  Void         setSingleDepthValueSubParts   (Pel singleDepthValue, UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth );
-#endif  
 #endif
   Char*         getPredictionMode     ()                        { return m_pePredMode;        }
@@ -385,5 +365,5 @@
   Void          setDBBPFlag           ( UInt uiIdx, Bool b )    { m_pbDBBPFlag[uiIdx] = b;           }
   Void          setDBBPFlagSubParts   ( Bool bDBBPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
-  DBBPTmpData*  getDBBPTmpData        () { return &m_sDBBPTmpData; }
+  DbbpTmpData*  getDBBPTmpData        () { return &m_sDBBPTmpData; }
 #endif
   
@@ -506,9 +486,5 @@
   );
   Bool          xGetColDisMV      ( Int currCandPic, RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int & iTargetViewIdx, Int & iStartViewIdx );
-#if SEC_ARP_REM_ENC_RESTRICT_K0035
   Void          getDisMvpCandNBDV ( DisInfo* pDInfo
-#else
-  Bool          getDisMvpCandNBDV ( DisInfo* pDInfo
-#endif
 #if H_3D_NBDV_REF
    , Bool bDepthRefine = false
@@ -517,17 +493,8 @@
    
 #if H_3D
-#if SEC_ARP_REM_ENC_RESTRICT_K0035
   Void          getDispforDepth  ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* cDisp);
-#else
-  Bool          getDispforDepth  ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* cDisp);
-#endif
   Bool          getDispMvPredCan(UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDis, Int* iPdm );
-#endif
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
+
    Bool          getNeighDepth (UInt uiPartIdx, UInt uiPartAddr, Pel* pNeighDepth, Int index);
-#else
-#if H_3D_SINGLE_DEPTH
-   Bool          getNeighDepth (UInt uiPartIdx, UInt uiPartAddr, Pel* pNeighDepth, Int index);
-#endif
 #endif
 #if H_3D_NBDV_REF
@@ -625,6 +592,6 @@
   
   Void          clipMv                ( TComMv&     rcMv     );
-#if SONY_MV_V_CONST_C0078
-  Void          checkMV_V (TComMv&  rcMv,  RefPicList eRefPicList, int iRefIdx );
+#if H_MV
+  Void          checkMvVertRest (TComMv&  rcMv,  RefPicList eRefPicList, int iRefIdx );
 #endif
   Void          getMvPredLeft         ( TComMv&     rcMvPred )   { rcMvPred = m_cMvFieldA.getMv(); }
Index: trunk/source/Lib/TLibCommon/TComMotionInfo.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComMotionInfo.cpp	(revision 1180)
+++ trunk/source/Lib/TLibCommon/TComMotionInfo.cpp	(revision 1196)
@@ -335,7 +335,5 @@
   Int iStartPelY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIdx]];
   Int iEndPelX = iStartPelX + iWidth;
-  Int iEndPelY = iStartPelY + iHeight;
-
-  Int iCurrRaster, uiPartAddr;
+  Int iEndPelY = iStartPelY + iHeight;  
 
   for (Int i=iStartPelY; i<iEndPelY; i+=pcCU->getPic()->getMinCUHeight())
@@ -343,6 +341,6 @@
     for (Int j=iStartPelX; j < iEndPelX; j += pcCU->getPic()->getMinCUWidth())
     {
-      iCurrRaster = i / pcCU->getPic()->getMinCUHeight() * pcCU->getPic()->getNumPartInWidth() + j/pcCU->getPic()->getMinCUWidth();
-      uiPartAddr = g_auiRasterToZscan[iCurrRaster];
+      Int iCurrRaster = i / pcCU->getPic()->getMinCUHeight() * pcCU->getPic()->getNumPartInWidth() + j/pcCU->getPic()->getMinCUWidth();
+      Int uiPartAddr = g_auiRasterToZscan[iCurrRaster];
       uiPartAddr -= pcCU->getZorderIdxInCU();  
 
Index: trunk/source/Lib/TLibCommon/TComMotionInfo.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComMotionInfo.h	(revision 1180)
+++ trunk/source/Lib/TLibCommon/TComMotionInfo.h	(revision 1196)
@@ -63,7 +63,4 @@
 typedef struct _DisCand 
 {
-#if !SEC_ARP_REM_ENC_RESTRICT_K0035
-  Bool bDV;
-#endif
   TComMv m_acNBDV;              // DV from NBDV
 #if H_3D_NBDV_REF 
Index: trunk/source/Lib/TLibCommon/TComPrediction.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComPrediction.cpp	(revision 1180)
+++ trunk/source/Lib/TLibCommon/TComPrediction.cpp	(revision 1196)
@@ -54,5 +54,7 @@
   m_pDepthBlock = (Int*) malloc(MAX_NUM_SPU_W*MAX_NUM_SPU_W*sizeof(Int));
   if (m_pDepthBlock == NULL)
+  {
       printf("ERROR: UKTGHU, No memory allocated.\n");
+  }
 #endif
 }
@@ -62,5 +64,7 @@
 #if H_3D_VSP
   if (m_pDepthBlock != NULL)
-      free(m_pDepthBlock);
+  {
+    free(m_pDepthBlock);
+  }
   m_cYuvDepthOnVsp.destroy();
 #endif
@@ -513,5 +517,9 @@
 
 #if H_3D_DIM_DMM
-  if( dimType == DMM4_IDX && dmm4Segmentation == NULL ) { dmmSegmentation->destroy(); delete dmmSegmentation; }
+  if( dimType == DMM4_IDX && dmm4Segmentation == NULL )
+  { 
+    dmmSegmentation->destroy(); 
+    delete dmmSegmentation; 
+  }
 #endif
 }
@@ -630,18 +638,13 @@
 
 #if H_3D_DBBP
-#if HS_DBBP_CLEAN_K0048
 PartSize TComPrediction::getPartitionSizeFromDepth(Pel* pDepthPels, UInt uiDepthStride, UInt uiSize, TComDataCU*& pcCU)
-#else
-PartSize TComPrediction::getPartitionSizeFromDepth(Pel* pDepthPels, UInt uiDepthStride, UInt uiSize)
-#endif
 {
   // find virtual partitioning for this CU based on depth block
   // segmentation of texture block --> mask IDs
   Pel*  pDepthBlockStart      = pDepthPels;
-  
+
   // first compute average of depth block for thresholding
   Int iSumDepth = 0;
   Int iSubSample = 4;
-#if HS_DBBP_CLEAN_K0048
   Int iPictureWidth = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getWidth();
   Int iPictureHeight = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getHeight();
@@ -653,51 +656,41 @@
   Int iBlkX = ( pcCU->getAddr() % pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCU() ) * g_uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ pcCU->getZorderIdxInCU() ] ]+ ((cDv.getHor()+2)>>2);
   Int iBlkY = ( pcCU->getAddr() / pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ pcCU->getZorderIdxInCU() ] ]+ ((cDv.getVer()+2)>>2);
+  
   UInt t=0;
 
   for (Int y=0; y<uiSize; y+=iSubSample)
-   {
+  {
     for (Int x=0; x<uiSize; x+=iSubSample)
-   {
-if (iBlkX+x>iPictureWidth)
-{
-    Int depthPel = pDepthPels[t];
-    iSumDepth += depthPel;
-} 
-else
-{
-    Int depthPel = pDepthPels[x];
-    t=x;
-    iSumDepth += depthPel;
-}
-   }
-    
+    {
+      if (iBlkX+x>iPictureWidth)
+      {
+        Int depthPel = pDepthPels[t];
+        iSumDepth += depthPel;
+      } 
+      else
+      {
+        Int depthPel = pDepthPels[x];
+        t=x;
+        iSumDepth += depthPel;
+      }
+    }
+
     // next row
     if (!(iBlkY+y+4>iPictureHeight))
-    pDepthPels += uiDepthStride*iSubSample;
-#else
-  for (Int y=0; y<uiSize; y+=iSubSample)
-  {
-    for (Int x=0; x<uiSize; x+=iSubSample)
-    {
-      Int depthPel = pDepthPels[x];
-      
-      iSumDepth += depthPel;
-    }
-    
-    // next row
-    pDepthPels += uiDepthStride*iSubSample;
-#endif
-  }
-  
+    {
+      pDepthPels += uiDepthStride*iSubSample;
+    }
+  }
+
   Int iSizeInBits = g_aucConvertToBit[uiSize] - g_aucConvertToBit[iSubSample];  // respect sub-sampling factor
   Int iMean = iSumDepth >> iSizeInBits*2;       // iMean /= (uiSize*uiSize);
-  
+
   // start again for segmentation
   pDepthPels = pDepthBlockStart;
-  
+
   // start mapping process
   Int matchedPartSum[2][2] = {{0,0},{0,0}}; // counter for each part size and boolean option
   PartSize virtualPartSizes[2] = { SIZE_Nx2N, SIZE_2NxN};
-  
+
   UInt uiHalfSize = uiSize>>1;
   for (Int y=0; y<uiSize; y+=iSubSample)
@@ -705,24 +698,20 @@
     for (Int x=0; x<uiSize; x+=iSubSample)
     {
-#if HS_DBBP_CLEAN_K0048
       Int depthPel = 0;
-if (iBlkX+x>iPictureWidth)
-{
-    depthPel = pDepthPels[t];
-}
-else
-{ 
-    depthPel = pDepthPels[x];
-     t=x;
-}
-#else
-      Int depthPel = pDepthPels[x];
-#endif
-      
+      if (iBlkX+x>iPictureWidth)
+      {
+        depthPel = pDepthPels[t];
+      }
+      else
+      { 
+        depthPel = pDepthPels[x];
+        t=x;
+      }
+
       // decide which segment this pixel belongs to
       Int ucSegment = (Int)(depthPel>iMean);
-      
+
       // Matched Filter to find optimal (conventional) partitioning
-      
+
       // SIZE_Nx2N
       if(x<uiHalfSize)  // left
@@ -734,5 +723,5 @@
         matchedPartSum[0][1-ucSegment]++;
       }
-      
+
       // SIZE_2NxN
       if(y<uiHalfSize)  // top
@@ -745,14 +734,14 @@
       }
     }
-    
+
     // next row
-#if HS_DBBP_CLEAN_K0048
     if (!(iBlkY+y+4>iPictureHeight))
-#endif
-    pDepthPels += uiDepthStride*iSubSample;
-  }
-  
+    {
+      pDepthPels += uiDepthStride*iSubSample;
+    }
+  }
+
   PartSize matchedPartSize = SIZE_NONE;
-  
+
   Int iMaxMatchSum = 0;
   for(Int p=0; p<2; p++)  // loop over partition
@@ -767,15 +756,11 @@
     }
   }
-  
+
   AOF( matchedPartSize != SIZE_NONE );
-  
+
   return matchedPartSize;
 }
 
-#if HS_DBBP_CLEAN_K0048
 Bool TComPrediction::getSegmentMaskFromDepth( Pel* pDepthPels, UInt uiDepthStride, UInt uiWidth, UInt uiHeight, Bool* pMask, TComDataCU*& pcCU)
-#else
-Bool TComPrediction::getSegmentMaskFromDepth( Pel* pDepthPels, UInt uiDepthStride, UInt uiWidth, UInt uiHeight, Bool* pMask )
-#endif
 {
   // segmentation of texture block --> mask IDs
@@ -786,9 +771,8 @@
   Int uiMinDepth = MAX_INT;
   Int uiMaxDepth = 0;
-#if HS_DBBP_CLEAN_K0048
   uiMinDepth = pDepthPels[ 0 ];
   uiMaxDepth = pDepthPels[ 0 ];
   iSumDepth  = pDepthPels[ 0 ];
-  UInt t=0;
+  
   Int iPictureWidth = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getWidth();
   Int iPictureHeight = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getHeight();  
@@ -848,20 +832,4 @@
     uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) + uiWidth - 1 ]);
   }
-#else
-  iSumDepth  = pDepthPels[ 0 ];
-  iSumDepth += pDepthPels[ uiWidth - 1 ];
-  iSumDepth += pDepthPels[ uiDepthStride * (uiHeight - 1) ];
-  iSumDepth += pDepthPels[ uiDepthStride * (uiHeight - 1) + uiWidth - 1 ];
-
-  uiMinDepth = pDepthPels[ 0 ];
-  uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiWidth - 1 ]);
-  uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) ]);
-  uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) + uiWidth - 1 ]);
-
-  uiMaxDepth = pDepthPels[ 0 ];
-  uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiWidth - 1 ]);
-  uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) ]);
-  uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) + uiWidth - 1 ]);
-#endif
 
   // don't generate mask for blocks with small depth range (encoder decision)
@@ -880,4 +848,5 @@
 
   // generate mask
+  UInt t=0;
   UInt uiSumPix[2] = {0,0};
   for (Int y=0; y<uiHeight; y++)
@@ -885,5 +854,4 @@
     for (Int x=0; x<uiHeight; x++)
     {
-#if HS_DBBP_CLEAN_K0048
       Int depthPel = 0;
       if (iBlkX+x>iPictureWidth)
@@ -896,7 +864,4 @@
         t=x;
       }
-#else
-      Int depthPel = pDepthPels[x];
-#endif
 
       // decide which segment this pixel belongs to
@@ -916,7 +881,5 @@
 
     // next row
-#if HS_DBBP_CLEAN_K0048
     if (!(iBlkY+y+1>iPictureHeight))
-#endif
       pDepthPels += uiDepthStride;
     pMask += MAX_CU_SIZE;
@@ -1003,5 +966,9 @@
   }
 
-  if ( tmpTar    ) { xFree(tmpTar);             tmpTar        = NULL; }
+  if ( tmpTar    ) 
+  { 
+    xFree(tmpTar);             
+    tmpTar        = NULL; 
+  }
   
   // now combine chroma
@@ -1106,6 +1073,14 @@
   }
 
-  if ( tmpTarU    ) { xFree(tmpTarU);             tmpTarU        = NULL; }
-  if ( tmpTarV    ) { xFree(tmpTarV);             tmpTarV        = NULL; }
+  if( tmpTarU )
+  {
+    xFree(tmpTarU);
+    tmpTarU        = NULL;
+  }
+  if ( tmpTarV    ) 
+  {
+    xFree(tmpTarV);
+    tmpTarV        = NULL; 
+  }
 }
 #endif
@@ -1293,6 +1268,6 @@
   TComMv      cMv         = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr );
   pcCU->clipMv(cMv);
-#if SONY_MV_V_CONST_C0078
-  pcCU->checkMV_V(cMv, eRefPicList, iRefIdx );
+#if H_MV
+  pcCU->checkMvVertRest(cMv, eRefPicList, iRefIdx );
 #endif
 #if H_3D_ARP
@@ -1393,28 +1368,11 @@
 #if H_3D_NBDV
   DisInfo cDistparity;
-#if SEC_ARP_REM_ENC_RESTRICT_K0035
   cDistparity.m_acNBDV = pcCU->getDvInfo(0).m_acNBDV;
   cDistparity.m_aVIdxCan = pcCU->getDvInfo(uiPartAddr).m_aVIdxCan;
 #else
-  cDistparity.bDV           = pcCU->getDvInfo(uiPartAddr).bDV;
-  if( cDistparity.bDV )
-  {
-    cDistparity.m_acNBDV = pcCU->getDvInfo(0).m_acNBDV;
-    assert(pcCU->getDvInfo(uiPartAddr).bDV ==  pcCU->getDvInfo(0).bDV);
-    cDistparity.m_aVIdxCan = pcCU->getDvInfo(uiPartAddr).m_aVIdxCan;
-  }
-#endif
-#else
   assert(0); // ARP can be applied only when a DV is available
 #endif
-#if SEC_ARP_REM_ENC_RESTRICT_K0035
   UChar dW = pcCU->getARPW ( uiPartAddr );
-#else
-  UChar dW = cDistparity.bDV ? pcCU->getARPW ( uiPartAddr ) : 0;
-#endif
-
-#if !SEC_ARP_REM_ENC_RESTRICT_K0035
-  if( cDistparity.bDV ) 
-#endif
+
   {
     Int arpRefIdx = pcCU->getSlice()->getFirstTRefIdx(eRefPicList);
@@ -1468,7 +1426,4 @@
       pYuvB0->clear(); pYuvB1->clear();
     }
-#if !SEC_ARP_REM_ENC_RESTRICT_K0035
-    assert ( cDistparity.bDV );
-#endif    
     TComMv cNBDV = cDistparity.m_acNBDV;
     pcCU->clipMv( cNBDV );
@@ -2438,6 +2393,12 @@
     for( UInt k = 0; k < (patternStride * patternStride); k++ )
     {
-      if( true == biSegPattern[k] ) { ptrDst[k] = valDC2; }
-      else                          { ptrDst[k] = valDC1; }
+      if( true == biSegPattern[k] )
+      { 
+        ptrDst[k] = valDC2; 
+      }
+      else                          
+      { 
+        ptrDst[k] = valDC1; 
+      }
     }
   }
@@ -2449,6 +2410,12 @@
       for( UInt uiX = 0; uiX < patternStride; uiX++ )
       {
-        if( true == biSegPattern[uiX] ) { piTemp[uiX] = valDC2; }
-        else                            { piTemp[uiX] = valDC1; }
+        if( true == biSegPattern[uiX] ) 
+        { 
+          piTemp[uiX] = valDC2; 
+        }
+        else                            
+        { 
+          piTemp[uiX] = valDC1; 
+        }
       }
       piTemp       += dstStride;
@@ -2520,9 +2487,11 @@
   Int iSumPix[2];
   memset(iSumPix, 0, sizeof(Int)*2);
+
   for( Int i = 0; i < uiNumSegments; i++ )
   {
-    rpSegMeans[i] = 0;
-  }
-  if (orgDC == false)
+    rpSegMeans[i] = 0;  
+  }
+
+  if ( !orgDC )
   {
     Pel* pLeftTop = pOrig;
@@ -2544,4 +2513,5 @@
     subSamplePix = 1;
   }
+
   for (Int y=0; y<uiSize; y+=subSamplePix)
   {
@@ -2563,7 +2533,11 @@
   {
     if( iSumPix[ucSeg] > 0 )
+    {
       rpSegMeans[ucSeg] = iSumDepth[ucSeg] / iSumPix[ucSeg];
+    }
     else
+    {
       rpSegMeans[ucSeg] = 0;  // this happens for zero-segments
+    }
   }
 }
Index: trunk/source/Lib/TLibCommon/TComPrediction.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComPrediction.h	(revision 1180)
+++ trunk/source/Lib/TLibCommon/TComPrediction.h	(revision 1196)
@@ -121,7 +121,5 @@
   Void xPredInterUniSubPU        ( TComDataCU *cu, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, Int widthSubPU=4, Int heightSubPU=4 );
 #endif
-
-  Void xWeightedAverage         ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst );
-  
+  Void xWeightedAverage         ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst );  
   Void xGetLLSPrediction ( TComPattern* pcPattern, Int* pSrc0, Int iSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt uiExt0 );
 #if H_3D_IC
@@ -175,11 +173,6 @@
   
 #if H_3D_DBBP
-#if HS_DBBP_CLEAN_K0048
   PartSize      getPartitionSizeFromDepth(Pel* pDepthPels, UInt uiDepthStride, UInt uiSize, TComDataCU*& pcCU);
   Bool          getSegmentMaskFromDepth( Pel* pDepthPels, UInt uiDepthStride, UInt uiWidth, UInt uiHeight, Bool* pMask, TComDataCU*& pcCU);
-#else
-  PartSize      getPartitionSizeFromDepth(Pel* pDepthPels, UInt uiDepthStride, UInt uiSize);
-  Bool          getSegmentMaskFromDepth( Pel* pDepthPels, UInt uiDepthStride, UInt uiWidth, UInt uiHeight, Bool* pMask );
-#endif
   Void          combineSegmentsWithMask( TComYuv* pInYuv[2], TComYuv* pOutYuv, Bool* pMask, UInt uiWidth, UInt uiHeight, UInt uiPartAddr, UInt partSize );
 #endif
Index: trunk/source/Lib/TLibCommon/TComRdCost.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComRdCost.cpp	(revision 1180)
+++ trunk/source/Lib/TLibCommon/TComRdCost.cpp	(revision 1196)
@@ -341,9 +341,5 @@
     else if( eDFunc >= DF_HADS && eDFunc <= DF_HADS16N )
     {
-#if !RWTH_DBBP_NO_SATD_K0028
-      rcDistParam.DistFunc = TComRdCost::xGetMaskedHADs;
-#else
       rcDistParam.DistFunc = TComRdCost::xGetMaskedSAD;
-#endif
     }
     else if( eDFunc >= DF_VSD && eDFunc <= DF_VSD16N )
@@ -445,9 +441,5 @@
   if( m_bUseMask )
   {
-#if !RWTH_DBBP_NO_SATD_K0028
-    rcDistParam.DistFunc = (bHADME)?TComRdCost::xGetMaskedHADs:TComRdCost::xGetMaskedSAD;
-#else
     rcDistParam.DistFunc = TComRdCost::xGetMaskedSAD;
-#endif
   }
 #endif
@@ -472,9 +464,5 @@
   if( m_bUseMask )
   {
-#if !RWTH_DBBP_NO_SATD_K0028
-    rcDP.DistFunc = (bHadamard)?TComRdCost::xGetMaskedHADs:TComRdCost::xGetMaskedSAD;
-#else
     rcDP.DistFunc = TComRdCost::xGetMaskedSAD;
-#endif
   }
 #endif
@@ -729,123 +717,4 @@
 }
 
-#if !RWTH_DBBP_NO_SATD_K0028
-UInt TComRdCost::xGetMaskedHADs( DistParam* pcDtParam )
-{
-  AOF(!pcDtParam->bApplyWeight);
-#if H_3D_IC
-  AOF(!pcDtParam->bUseIC);
-#endif
-  Pel* piOrg   = pcDtParam->pOrg;
-  Pel* piCur   = pcDtParam->pCur;
-  Int  iRows   = pcDtParam->iRows;
-  Int  iCols   = pcDtParam->iCols;
-  Int  iStrideCur = pcDtParam->iStrideCur;
-  Int  iStrideOrg = pcDtParam->iStrideOrg;
-  Int  iStep  = pcDtParam->iStep;
-  
-  Int  x, y;
-  
-  UInt uiSum = 0;
-  
-#if NS_HAD
-  if( ( ( iRows % 8 == 0) && (iCols % 8 == 0) && ( iRows == iCols ) ) || ( ( iRows % 8 == 0 ) && (iCols % 8 == 0) && !pcDtParam->bUseNSHAD ) )
-#else
-    if( ( iRows % 8 == 0) && (iCols % 8 == 0) )
-#endif
-    {
-      Int  iOffsetOrg = iStrideOrg<<3;
-      Int  iOffsetCur = iStrideCur<<3;
-      for ( y=0; y<iRows; y+= 8 )
-      {
-        for ( x=0; x<iCols; x+= 8 )
-        {
-          if( piOrg[x] != DBBP_INVALID_SHORT )
-          {
-            uiSum += xCalcHADs8x8( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
-          }
-        }
-        piOrg += iOffsetOrg;
-        piCur += iOffsetCur;
-      }
-    }
-#if NS_HAD
-    else if ( ( iCols > 8 ) && ( iCols > iRows ) && pcDtParam->bUseNSHAD )
-    {
-      Int  iOffsetOrg = iStrideOrg<<2;
-      Int  iOffsetCur = iStrideCur<<2;
-      for ( y=0; y<iRows; y+= 4 )
-      {
-        for ( x=0; x<iCols; x+= 16 )
-        {
-          if( piOrg[x] != DBBP_INVALID_SHORT )
-          {
-            uiSum += xCalcHADs16x4( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
-          }
-        }
-        piOrg += iOffsetOrg;
-        piCur += iOffsetCur;
-      }
-    }
-    else if ( ( iRows > 8 ) && ( iCols < iRows ) && pcDtParam->bUseNSHAD )
-    {
-      Int  iOffsetOrg = iStrideOrg<<4;
-      Int  iOffsetCur = iStrideCur<<4;
-      for ( y=0; y<iRows; y+= 16 )
-      {
-        for ( x=0; x<iCols; x+= 4 )
-        {
-          if( piOrg[x] != DBBP_INVALID_SHORT )
-          {
-            uiSum += xCalcHADs4x16( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
-          }
-        }
-        piOrg += iOffsetOrg;
-        piCur += iOffsetCur;
-      }
-    }
-#endif
-    else if( ( iRows % 4 == 0) && (iCols % 4 == 0) )
-    {
-      Int  iOffsetOrg = iStrideOrg<<2;
-      Int  iOffsetCur = iStrideCur<<2;
-      
-      for ( y=0; y<iRows; y+= 4 )
-      {
-        for ( x=0; x<iCols; x+= 4 )
-        {
-          if( piOrg[x] != DBBP_INVALID_SHORT )
-          {
-            uiSum += xCalcHADs4x4( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
-          }
-        }
-        piOrg += iOffsetOrg;
-        piCur += iOffsetCur;
-      }
-    }
-    else if( ( iRows % 2 == 0) && (iCols % 2 == 0) )
-    {
-      Int  iOffsetOrg = iStrideOrg<<1;
-      Int  iOffsetCur = iStrideCur<<1;
-      for ( y=0; y<iRows; y+=2 )
-      {
-        for ( x=0; x<iCols; x+=2 )
-        {
-          if( piOrg[x] != DBBP_INVALID_SHORT )
-          {
-            uiSum += xCalcHADs2x2( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
-          }
-        }
-        piOrg += iOffsetOrg;
-        piCur += iOffsetCur;
-      }
-    }
-    else
-    {
-      assert(false);
-    }
-  
-  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
-}
-#endif
 
 UInt TComRdCost::xGetMaskedVSD( DistParam* pcDtParam )
@@ -2993,12 +2862,9 @@
 UInt TComRdCost::getVSDEstimate( Int dDM, Pel* pOrg, Int iOrgStride,  Pel* pVirRec, Pel* pVirOrg, Int iVirStride, Int x, Int y )
 {
-  Double dD;
-  Int iTemp;
-
-  dD = ( (Double) ( dDM >> DISTORTION_PRECISION_ADJUSTMENT( g_bitDepthY - 8 ) ) ) * m_dDisparityCoeff;
+  Double  dD = ( (Double) ( dDM >> DISTORTION_PRECISION_ADJUSTMENT( g_bitDepthY - 8 ) ) ) * m_dDisparityCoeff;
 
   Double dDepthWeight = ( pOrg[x] >=  ( (1<<(g_bitDepthY - 3)) + (1<<(g_bitDepthY - 2)) ) ? 4 : pOrg[x] > ((1<<g_bitDepthY) >> 4) ? (Float)(pOrg[x] - ((1<<g_bitDepthY) >> 4))/(Float)((1<<g_bitDepthY) >> 3) + 1 : 1.0 );
   Double dTemp = ( 0.5 * fabs(dD) * dDepthWeight * ( abs( (Int) pVirRec[ x+y*iVirStride ] - (Int) pVirRec[ x-1+y*iVirStride ] ) + abs( (Int) pVirRec[ x+y*iVirStride ] - (Int) pVirRec[ x+1+y*iVirStride ] ) ) );
-  iTemp = (Int) (((dTemp) < 0)? (Int)((dTemp) - 0.5) : (Int)((dTemp) + 0.5));
+  Int iTemp = (Int) (((dTemp) < 0)? (Int)((dTemp) - 0.5) : (Int)((dTemp) + 0.5));
 
   return (UInt) ( (iTemp*iTemp)>>1 );
Index: trunk/source/Lib/TLibCommon/TComRdCost.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComRdCost.h	(revision 1180)
+++ trunk/source/Lib/TLibCommon/TComRdCost.h	(revision 1196)
@@ -320,7 +320,4 @@
   static UInt xGetMaskedSSE     ( DistParam* pcDtParam );
   static UInt xGetMaskedSAD     ( DistParam* pcDtParam );
-#if !RWTH_DBBP_NO_SATD_K0028
-  static UInt xGetMaskedHADs    ( DistParam* pcDtParam );
-#endif
   static UInt xGetMaskedVSD     ( DistParam* pcDtParam );
 #endif
Index: trunk/source/Lib/TLibCommon/TComRom.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComRom.cpp	(revision 1180)
+++ trunk/source/Lib/TLibCommon/TComRom.cpp	(revision 1196)
@@ -104,10 +104,16 @@
   if( !g_dmmWedgeLists.empty() ) 
   {
-    for( UInt ui = 0; ui < g_dmmWedgeLists.size(); ui++ ) { g_dmmWedgeLists[ui].clear(); }
+    for( UInt ui = 0; ui < g_dmmWedgeLists.size(); ui++ )
+    { 
+      g_dmmWedgeLists[ui].clear(); 
+    }
     g_dmmWedgeLists.clear();
   }
   if( !g_dmmWedgeRefLists.empty() )
   {
-    for( UInt ui = 0; ui < g_dmmWedgeRefLists.size(); ui++ ) { g_dmmWedgeRefLists[ui].clear(); }
+    for( UInt ui = 0; ui < g_dmmWedgeRefLists.size(); ui++ ) 
+    { 
+      g_dmmWedgeRefLists[ui].clear(); 
+    }
     g_dmmWedgeRefLists.clear();
   }
@@ -115,5 +121,8 @@
   if( !g_dmmWedgeNodeLists.empty() )
   {
-    for( UInt ui = 0; ui < g_dmmWedgeNodeLists.size(); ui++ ) { g_dmmWedgeNodeLists[ui].clear(); }
+    for( UInt ui = 0; ui < g_dmmWedgeNodeLists.size(); ui++ )
+    { 
+      g_dmmWedgeNodeLists[ui].clear(); 
+    }
     g_dmmWedgeNodeLists.clear();
   }
@@ -745,10 +754,5 @@
   assert( uiWidth == uiHeight );
 
-#if SHARP_DMM_CLEAN_K0042
   Int posStart = 0, posEnd = 0;
-#else
-  UChar    uhStartX = 0,    uhStartY = 0,    uhEndX = 0,    uhEndY = 0;
-  Int   iStepStartX = 0, iStepStartY = 0, iStepEndX = 0, iStepEndY = 0;
-#endif
 
   UInt uiBlockSize = 0;
@@ -762,27 +766,12 @@
   for( UInt uiOri = 0; uiOri < 6; uiOri++ )
   {
-#if !SHARP_DMM_CLEAN_K0042
-    // init the edge line parameters for each of the 6 wedgelet types
-    switch( uiOri )
-    {
-    case( 0 ): {  uhStartX = 0;               uhStartY = 0;               uhEndX = 0;               uhEndY = 0;               iStepStartX = +1; iStepStartY =  0; iStepEndX =  0; iStepEndY = +1; break; }
-    case( 1 ): {  uhStartX = (uiBlockSize-1); uhStartY = 0;               uhEndX = (uiBlockSize-1); uhEndY = 0;               iStepStartX =  0; iStepStartY = +1; iStepEndX = -1; iStepEndY =  0; break; }
-    case( 2 ): {  uhStartX = (uiBlockSize-1); uhStartY = (uiBlockSize-1); uhEndX = (uiBlockSize-1); uhEndY = (uiBlockSize-1); iStepStartX = -1; iStepStartY =  0; iStepEndX =  0; iStepEndY = -1; break; }
-    case( 3 ): {  uhStartX = 0;               uhStartY = (uiBlockSize-1); uhEndX = 0;               uhEndY = (uiBlockSize-1); iStepStartX =  0; iStepStartY = -1; iStepEndX = +1; iStepEndY =  0; break; }
-    case( 4 ): {  uhStartX = 0;               uhStartY = 0;               uhEndX = 0;               uhEndY = (uiBlockSize-1); iStepStartX = +1; iStepStartY =  0; iStepEndX = +1; iStepEndY =  0; break; }
-    case( 5 ): {  uhStartX = (uiBlockSize-1); uhStartY = 0;               uhEndX = 0;               uhEndY = 0;               iStepStartX =  0; iStepStartY = +1; iStepEndX =  0; iStepEndY = +1; break; }
-    }
-#endif
-
-#if SHARP_DMM_CLEAN_K0042
+
     posEnd = (Int) racWedgeList.size();
     if (uiOri == 0 || uiOri == 4)
     {
-#endif
     for( Int iK = 0; iK < uiBlockSize; iK += (uiWidth>=16 ?2:1))
     {
       for( Int iL = 0; iL < uiBlockSize; iL += ((uiWidth>=16 && uiOri<4)?2:1) )
       {
-#if SHARP_DMM_CLEAN_K0042
         Int xS = iK;
         Int yS = 0;
@@ -790,11 +779,7 @@
         Int yE = (uiOri == 0) ? iL : uiBlockSize - 1;
         cTempWedgelet.setWedgelet( xS, yS, xE, yE, uiOri, eWedgeRes, ((iL%2)==0 && (iK%2)==0) );
-#else
-        cTempWedgelet.setWedgelet( uhStartX + (iK*iStepStartX) , uhStartY + (iK*iStepStartY), uhEndX + (iL*iStepEndX), uhEndY + (iL*iStepEndY), (UChar)uiOri, eWedgeRes, ((iL%2)==0 && (iK%2)==0) );
-#endif
         addWedgeletToList( cTempWedgelet, racWedgeList, racWedgeRefList );
       }
     }
-#if SHARP_DMM_CLEAN_K0042
     }
     else
@@ -807,5 +792,4 @@
     }
     posStart = posEnd;
-#endif
   }
 
Index: trunk/source/Lib/TLibCommon/TComRom.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComRom.h	(revision 1180)
+++ trunk/source/Lib/TLibCommon/TComRom.h	(revision 1196)
@@ -290,11 +290,11 @@
 
 #if H_MV_ENC_DEC_TRAC
-#define DTRACE_CU(x,y)             
-#define DTRACE_PU(x,y)             
-#define DTRACE_TU(x,y)             
-
-#define DTRACE_CU_S(x)             
-#define DTRACE_PU_S(x)             
-#define DTRACE_TU_S(x)             
+#define DTRACE_CU(x,y) ;             
+#define DTRACE_PU(x,y) ;            
+#define DTRACE_TU(x,y) ;            
+
+#define DTRACE_CU_S(x) ;            
+#define DTRACE_PU_S(x) ;            
+#define DTRACE_TU_S(x) ;            
 
 #endif
Index: trunk/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComSlice.cpp	(revision 1180)
+++ trunk/source/Lib/TLibCommon/TComSlice.cpp	(revision 1196)
@@ -137,19 +137,10 @@
 #endif
 #if H_3D
-#if HHI_INTER_COMP_PRED_K0052
 , m_inCmpPredFlag                 ( false )
-#endif
-#if HHI_CAM_PARA_K0052
 , m_numViews                        ( 0    )
-#endif
 , m_depthToDisparityB             ( NULL )
 , m_depthToDisparityF             ( NULL )
-#endif
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
+
 , m_bApplyDIS                     (false)
-#else
-#if H_3D_SINGLE_DEPTH
-, m_bApplySingleDepthMode         (false)
-#endif
 #endif
 #endif
@@ -191,5 +182,5 @@
   m_iDefaultRefViewIdx = -1;
   m_bDefaultRefViewIdxAvailableFlag = false;
-#if HHI_INTER_COMP_PRED_K0052
+#if H_3D
   m_ivMvPredFlag           = false;
   m_ivMvScalingFlag        = false;
@@ -214,9 +205,5 @@
   m_puiSubstreamSizes = NULL;
 #if H_3D
-#if HHI_CAM_PARA_K0052   
   for( UInt i = 0; i < m_numViews; i++ )
-#else
-  for( UInt i = 0; i < getViewIndex(); i++ )
-#endif
   {
     if ( m_depthToDisparityB && m_depthToDisparityB[ i ] )
@@ -604,9 +591,7 @@
   UInt NumPocLtCurr = 0;
   Int i;
-
-#if HHI_RES_PRED_K0052
+#if H_3D
   m_pocsInCurrRPSs.clear();
 #endif
-
   for(i=0; i < m_pcRPS->getNumberOfNegativePictures(); i++)
   {
@@ -619,5 +604,5 @@
       NumPocStCurr0++;
       pcRefPic->setCheckLTMSBPresent(false);  
-#if HHI_RES_PRED_K0052
+#if H_3D
       m_pocsInCurrRPSs.push_back( pcRefPic->getPOC() ); 
 #endif
@@ -635,5 +620,5 @@
       NumPocStCurr1++;
       pcRefPic->setCheckLTMSBPresent(false);  
-#if HHI_RES_PRED_K0052
+#if H_3D
       m_pocsInCurrRPSs.push_back( pcRefPic->getPOC() ); 
 #endif
@@ -650,5 +635,5 @@
       RefPicSetLtCurr[NumPocLtCurr] = pcRefPic;
       NumPocLtCurr++;
-#if HHI_RES_PRED_K0052
+#if H_3D
       m_pocsInCurrRPSs.push_back( pcRefPic->getPOC() ); 
 #endif
@@ -662,5 +647,5 @@
 
   Int numPocInterCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr; 
-#if HHI_RES_PRED_K0052
+#if H_3D
   assert( numPocInterCurr == (Int) m_pocsInCurrRPSs.size() ); 
 #endif
@@ -837,5 +822,4 @@
 Void TComSlice::setCamparaSlice( Int** aaiScale, Int** aaiOffset )
 {  
-#if HHI_CAM_PARA_K0052
   Int voiInVps      = m_pcVPS->getVoiInVps(getViewIndex() ); 
   if( m_pcVPS->getNumCp( voiInVps ) > 0 )
@@ -855,16 +839,4 @@
     }
   } 
-#else
-  if( m_pcVPS->hasCamParInSliceHeader( m_viewIndex ) )
-  {    
-    for( UInt uiBaseViewIndex = 0; uiBaseViewIndex < m_viewIndex; uiBaseViewIndex++ )
-    {
-      m_aaiCodedScale [ 0 ][ uiBaseViewIndex ] = aaiScale [ uiBaseViewIndex ][     m_viewIndex ];
-      m_aaiCodedScale [ 1 ][ uiBaseViewIndex ] = aaiScale [     m_viewIndex ][ uiBaseViewIndex ];
-      m_aaiCodedOffset[ 0 ][ uiBaseViewIndex ] = aaiOffset[ uiBaseViewIndex ][     m_viewIndex ];
-      m_aaiCodedOffset[ 1 ][ uiBaseViewIndex ] = aaiOffset[     m_viewIndex ][ uiBaseViewIndex ];
-    }
-  } 
-#endif
 }
 #endif
@@ -1165,10 +1137,6 @@
   }
 #endif
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
+#if H_3D
   m_bApplyDIS = pSrc->m_bApplyDIS;
-#else
-#if H_3D_SINGLE_DEPTH
-  m_bApplySingleDepthMode = pSrc->m_bApplySingleDepthMode;
-#endif
 #endif
 #if H_3D_IC
@@ -2217,5 +2185,4 @@
 {
   m_numViews = 1; 
-#if HHI_VIEW_ID_LIST_I5_J0107 || HHI_INTER_COMP_PRED_K0052
 #if H_3D
   AOF( m_viewOIdxList.size() == 0 ); 
@@ -2223,5 +2190,4 @@
   m_viewOIdxList.push_back( 0 );        
 #endif
-#endif
 
   for( Int i = 0; i <=  getMaxLayersMinus1(); i++ )
@@ -2241,9 +2207,7 @@
       {
         m_numViews++;
-#if HHI_VIEW_ID_LIST_I5_J0107  || HHI_INTER_COMP_PRED_K0052
 #if H_3D
         m_viewOIdxList.push_back( getViewOrderIdx( lId ) );        
 #endif
-#endif
       }
     }
@@ -2271,7 +2235,4 @@
     }
   }
-#if !BUG_FIX_TK65
-  assert( foundLayerIdinNuh != -1 ); 
-#endif
   return foundLayerIdinNuh;
 }
@@ -2281,5 +2242,4 @@
   Int i = 0, j = 0;
 
-#if HHI_CAM_PARA_K0052
   m_numCp    = new Int [ iNumViews ];
   m_cpRefVoi = new Int*[ iNumViews ];
@@ -2287,8 +2247,4 @@
 
   m_cpPresentFlag  = new Bool*[ iNumViews ]; 
-#else
-  m_bCamParPresent = new Bool[ iNumViews ];
-  m_bCamParInSliceHeader = new Bool[ iNumViews ];
-#endif
   
 
@@ -2297,15 +2253,9 @@
   for ( i = 0; i < iNumViews ; i++ )
   {
-#if HHI_CAM_PARA_K0052
     m_cpInSliceSegmentHeaderFlag[i] = false;     
-#else
-    m_bCamParPresent[i] = false; 
-    m_bCamParInSliceHeader[i] = false; 
-#endif
     
     m_aaaiCodedScale[i] = new Int*[ 2 ];
     m_aaaiCodedOffset[i] = new Int*[ 2 ];
 
-#if HHI_CAM_PARA_K0052
     m_numCp   [i] = 0; 
     m_cpRefVoi[i] = new Int[ iNumViews ];
@@ -2316,5 +2266,4 @@
       m_cpPresentFlag[i][j] = false; 
     }
-#endif
     for ( j = 0; j < 2; j++ )
     {
@@ -2335,14 +2284,4 @@
   Int i = 0, j = 0;
 
-#if !HHI_CAM_PARA_K0052
-  if ( m_bCamParPresent != NULL )
-  {
-    delete [] m_bCamParPresent;
-  }
-  if ( m_bCamParInSliceHeader != NULL )
-  {
-    delete [] m_bCamParInSliceHeader;
-  }
-#else
   if ( m_numCp != NULL )
   {
@@ -2373,5 +2312,4 @@
     delete [] m_cpInSliceSegmentHeaderFlag;
   }
-#endif
 
 
@@ -2404,25 +2342,4 @@
 
 
-#if !HHI_CAM_PARA_K0052
-Void TComVPS::initCamParaVPS( UInt uiViewIndex, Bool bCamParPresent, UInt uiCamParPrecision, Bool bCamParSlice, Int** aaiScale, Int** aaiOffset )
-{
-  AOT( uiViewIndex != 0 && !bCamParSlice && ( aaiScale == 0 || aaiOffset == 0 ) );  
-
-  m_uiCamParPrecision = ( ( uiViewIndex != 0 )? uiCamParPrecision : 0 );
-  m_bCamParPresent[ uiViewIndex ] = (( uiViewIndex != 0 )? bCamParPresent  : false );
-  m_bCamParInSliceHeader[ uiViewIndex ]  = ( (uiViewIndex != 0)? bCamParSlice  : false );
-
-  if( !m_bCamParInSliceHeader[ uiViewIndex ] )
-  {
-    for( UInt uiBaseViewIndex = 0; uiBaseViewIndex < uiViewIndex; uiBaseViewIndex++ )
-    {
-      m_aaaiCodedScale [ uiViewIndex ][ 0 ][ uiBaseViewIndex ] = aaiScale [ uiBaseViewIndex ][     uiViewIndex ];
-      m_aaaiCodedScale [ uiViewIndex ][ 1 ][ uiBaseViewIndex ] = aaiScale [     uiViewIndex ][ uiBaseViewIndex ];
-      m_aaaiCodedOffset[ uiViewIndex ][ 0 ][ uiBaseViewIndex ] = aaiOffset[ uiBaseViewIndex ][     uiViewIndex ];
-      m_aaaiCodedOffset[ uiViewIndex ][ 1 ][ uiBaseViewIndex ] = aaiOffset[     uiViewIndex ][ uiBaseViewIndex ];
-    }
-  }
-}
-#endif
 
 #endif // H_3D
@@ -2804,4 +2721,65 @@
 }
 
+#if H_3D
+Void TComVPS::initViewCompLayer()
+{
+  assert( m_viewCompLayerId.size() == 0 && m_viewCompLayerPresentFlag.size() == 0  );
+  for( Int i = 0; i < getNumViews(); i++ )
+  {
+    m_viewCompLayerId         .push_back( std::vector<Int>(0)  );
+    m_viewCompLayerPresentFlag.push_back( std::vector<Bool>(0) );      
+
+    for( Int depFlag = 0; depFlag  <=  1; depFlag++ )
+    {
+      Int iViewOIdx = getViewOIdxList( i );
+      Int layerId = -1;
+      for( Int j = 0; j  <=  getMaxLayersMinus1(); j++ ) 
+      {
+        Int jNuhLId = getLayerIdInNuh( j );
+        if( getVpsDepthFlag( jNuhLId ) == ( (Bool) depFlag )  &&  getViewOrderIdx( jNuhLId )  ==  iViewOIdx  
+          &&  getDependencyId( jNuhLId )  ==  0  &&  getAuxId( jNuhLId )  ==  0 )
+        {
+          layerId = jNuhLId;
+        }
+      }
+      m_viewCompLayerPresentFlag[ i ].push_back( layerId  !=  -1 );
+      m_viewCompLayerId         [ i ].push_back( layerId );        
+    }
+  }
+}
+
+Int TComVPS::getVoiInVps(Int viewOIdx)
+{
+  for ( Int i = 0; i < m_viewOIdxList.size(); i++ )
+  {
+    if  ( m_viewOIdxList[ i ] == viewOIdx )
+    {
+      return i; 
+    }
+  }
+  assert( 0 );   
+  return -1;
+}
+
+Void TComVPS::deriveCpPresentFlag()
+{
+  for( Int nInVps = 0; nInVps < getNumViews(); nInVps++  )
+  {
+    for( Int mInVps = 0; mInVps < getNumViews(); mInVps++ )
+    {
+      m_cpPresentFlag[nInVps][mInVps] = 0; 
+    }
+  }
+
+  for( Int n = 1; n < getNumViews(); n++ )
+  {
+    Int iInVps = getVoiInVps(  getViewOIdxList( n ) );      
+    for( Int m = 0; m < getNumCp( iInVps ); m++ )
+    {
+      m_cpPresentFlag[ iInVps ][ getVoiInVps( getCpRefVoi( iInVps, m ) ) ] = 1;
+    }
+  }
+}
+#endif
 
 #endif // H_MV
@@ -2858,9 +2836,4 @@
 , m_interViewMvVertConstraintFlag (false)
 #endif
-#if H_3D
-#if !HHI_CAM_PARA_K0052
-, m_bCamParInSliceHeader      (false)
-#endif
-#endif
 {
   for ( Int i = 0; i < MAX_TLAYER; i++ )
@@ -3885,5 +3858,5 @@
       {
         Int layerIdInNuh = getRefPicLayerId( i );
-#if HHI_RES_PRED_K0052
+
         TComPic* picV = getIvPic( getIsDepth(), getVPS()->getViewIndex( layerIdInNuh ) );
         assert( picV != NULL ); 
@@ -3900,9 +3873,4 @@
 
         if (getFirstTRefIdx(eRefPicList) >= 0 && refRpRefAvailFlag )
-#else
-        Int viewIdx = getVPS()->getViewId( layerIdInNuh );
-        TComPic*pcPicPrev = ivPicLists->getPic(viewIdx, 0, prevPOC);
-        if (getFirstTRefIdx(eRefPicList) >= 0 && pcPicPrev && pcPicPrev->getSlice( 0 )->isReferenced())
-#endif
         {
           m_arpRefPicAvailable[eRefPicList][layerIdInNuh] = true;
@@ -3917,5 +3885,7 @@
 }
 #endif
+
 #if H_3D_IC
+// This is an encoder only function and should be moved to TEncSlice or TEncSearch!!
 Void TComSlice::xSetApplyIC(Bool bUseLowLatencyICEnc)
 {
@@ -3981,78 +3951,75 @@
   }
   else
-  {
-  Int iMaxPelValue = ( 1 << g_bitDepthY ); 
-  Int *aiRefOrgHist;
-  Int *aiCurrHist;
-  aiRefOrgHist = (Int *) xMalloc( Int,iMaxPelValue );
-  aiCurrHist   = (Int *) xMalloc( Int,iMaxPelValue );
-  memset( aiRefOrgHist, 0, iMaxPelValue*sizeof(Int) );
-  memset( aiCurrHist, 0, iMaxPelValue*sizeof(Int) );
-  // Reference Idx Number
-  Int iNumRefIdx = getNumRefIdx( REF_PIC_LIST_0 );
-  TComPic* pcCurrPic = NULL;
-  TComPic* pcRefPic = NULL;
-  TComPicYuv* pcCurrPicYuv = NULL;
-  TComPicYuv* pcRefPicYuvOrg = NULL;
-  pcCurrPic = getPic();
-  pcCurrPicYuv = pcCurrPic->getPicYuvOrg();
-  Int iWidth = pcCurrPicYuv->getWidth();
-  Int iHeight = pcCurrPicYuv->getHeight();
-
-
-  // Get InterView Reference picture
-  // !!!!! Assume only one Interview Reference Picture in L0
-  for ( Int i = 0; i < iNumRefIdx; i++ )
-  {
-    pcRefPic = getRefPic( REF_PIC_LIST_0, i );
-    if ( pcRefPic != NULL )
-    {
-      if ( pcCurrPic->getViewIndex() != pcRefPic->getViewIndex() )
-      {
-        pcRefPicYuvOrg = pcRefPic->getPicYuvOrg();
-      }
-    }
-  }
-
-  if ( pcRefPicYuvOrg != NULL )
-  {
-    Pel* pCurrY = pcCurrPicYuv ->getLumaAddr();
-    Pel* pRefOrgY = pcRefPicYuvOrg  ->getLumaAddr();
-    Int iCurrStride = pcCurrPicYuv->getStride();
-    Int iRefStride = pcRefPicYuvOrg->getStride();
-    Int iSumOrgSAD = 0;
-    Double dThresholdOrgSAD = getIsDepth() ? 0.1 : 0.05;
-
-    // Histogram building - luminance
-    for ( Int y = 0; y < iHeight; y++ )
-    {
-      for ( Int x = 0; x < iWidth; x++ )
-      {
-        aiCurrHist[pCurrY[x]]++;
-        aiRefOrgHist[pRefOrgY[x]]++;
-      }
-      pCurrY += iCurrStride;
-      pRefOrgY += iRefStride;
-    }
-    // Histogram SAD
-    for ( Int i = 0; i < iMaxPelValue; i++ )
-    {
-      iSumOrgSAD += abs( aiCurrHist[i] - aiRefOrgHist[i] );
-    }
-    // Setting
-    if ( iSumOrgSAD > Int( dThresholdOrgSAD * iWidth * iHeight ) )
-    {
-      m_bApplyIC = true;
-    }
-    else
-    {
-      m_bApplyIC = false;
-    }
-  }
-
-  xFree( aiCurrHist   );
-  xFree( aiRefOrgHist );
-  aiCurrHist = NULL;
-  aiRefOrgHist = NULL;
+  {        
+    TComPic*    pcCurrPic = getPic();
+    TComPicYuv* pcCurrPicYuv = pcCurrPic->getPicYuvOrg();
+    
+    // Get InterView Reference picture
+    // !!!!! Assume only one Interview Reference Picture in L0
+    // GT: Is this assumption correct?
+
+    TComPicYuv* pcRefPicYuvOrg = NULL;
+    for ( Int i = 0; i < getNumRefIdx( REF_PIC_LIST_0 ); i++ )
+    {
+      TComPic* pcRefPic = getRefPic( REF_PIC_LIST_0, i );
+      if ( pcRefPic != NULL )
+      {
+        if ( pcCurrPic->getViewIndex() != pcRefPic->getViewIndex() )
+        {
+          pcRefPicYuvOrg = pcRefPic->getPicYuvOrg();
+        }
+      }
+    }
+
+    if ( pcRefPicYuvOrg != NULL )
+    {
+      // Histogram building - luminance
+      Int iMaxPelValue = ( 1 << g_bitDepthY ); 
+      Int *aiRefOrgHist = (Int *) xMalloc( Int,iMaxPelValue );
+      Int *aiCurrHist   = (Int *) xMalloc( Int,iMaxPelValue );
+      memset( aiRefOrgHist, 0, iMaxPelValue*sizeof(Int) );
+      memset( aiCurrHist, 0, iMaxPelValue*sizeof(Int) );
+
+      Int iWidth   = pcCurrPicYuv->getWidth();
+      Int iHeight  = pcCurrPicYuv->getHeight();
+
+      Pel* pCurrY   = pcCurrPicYuv ->getLumaAddr();
+      Pel* pRefOrgY = pcRefPicYuvOrg  ->getLumaAddr();
+      Int iCurrStride = pcCurrPicYuv->getStride();
+      Int iRefStride = pcRefPicYuvOrg->getStride();
+
+      for ( Int y = 0; y < iHeight; y++ )
+      {
+        for ( Int x = 0; x < iWidth; x++ )
+        {
+          aiCurrHist[pCurrY[x]]++;
+          aiRefOrgHist[pRefOrgY[x]]++;
+        }
+        pCurrY += iCurrStride;
+        pRefOrgY += iRefStride;
+      }
+
+      // Histogram SAD
+      Int iSumOrgSAD = 0;
+      for ( Int i = 0; i < iMaxPelValue; i++ )
+      {
+        iSumOrgSAD += abs( aiCurrHist[i] - aiRefOrgHist[i] );
+      }
+
+      // Setting
+      Double dThresholdOrgSAD = getIsDepth() ? 0.1 : 0.05;
+
+      if ( iSumOrgSAD > Int( dThresholdOrgSAD * iWidth * iHeight ) )
+      {
+        m_bApplyIC = true;
+      }
+      else
+      {
+        m_bApplyIC = false;
+      }
+
+      xFree( aiCurrHist   );
+      xFree( aiRefOrgHist );
+    }
   }//if(bUseLowLatencyICEnc)
 }
@@ -4087,17 +4054,10 @@
     return; 
 
-#if HHI_CAM_PARA_K0052
   m_numViews = getVPS()->getNumViews(); 
-#endif
   /// GT: Allocation should be moved to a better place later; 
   if ( m_depthToDisparityB == NULL )
   {
-#if HHI_CAM_PARA_K0052    
     m_depthToDisparityB = new Int*[ m_numViews ];
     for ( Int i = 0; i < getVPS()->getNumViews(); i++ )
-#else
-    m_depthToDisparityB = new Int*[ getViewIndex() ];
-    for ( Int i = 0; i < getViewIndex(); i++ )
-#endif
     {
       m_depthToDisparityB[ i ] = new Int[ Int(1 << g_bitDepthY) ]; 
@@ -4108,11 +4068,6 @@
   if ( m_depthToDisparityF == NULL )
   {
-#if HHI_CAM_PARA_K0052    
     m_depthToDisparityF = new Int*[ m_numViews ];
     for ( Int i = 0; i < m_numViews; i++ )
-#else
-    m_depthToDisparityF= new Int*[ getViewIndex() ];
-    for ( Int i = 0; i < getViewIndex(); i++ )
-#endif
     {
       m_depthToDisparityF[ i ] = new Int[ Int(1 << g_bitDepthY) ]; 
@@ -4125,5 +4080,4 @@
   TComVPS* vps = getVPS(); 
 
-#if HHI_CAM_PARA_K0052
   Int log2Div = g_bitDepthY - 1 + vps->getCpPrecision();
   Int voiInVps = vps->getVoiInVps( getViewIndex() ); 
@@ -4155,28 +4109,4 @@
     }
   }
-#else
-  Int log2Div = g_bitDepthY - 1 + vps->getCamParPrecision();
-
-  Int viewIndex = getViewIndex();
-
-  Bool camParaSH = vps->hasCamParInSliceHeader( viewIndex );
-
-  Int* codScale     = camParaSH ? m_aaiCodedScale [ 0 ] : vps->getCodedScale    ( viewIndex ); 
-  Int* codOffset    = camParaSH ? m_aaiCodedOffset[ 0 ] : vps->getCodedOffset   ( viewIndex ); 
-  Int* invCodScale  = camParaSH ? m_aaiCodedScale [ 1 ] : vps->getInvCodedScale ( viewIndex ); 
-  Int* invCodOffset = camParaSH ? m_aaiCodedOffset[ 1 ] : vps->getInvCodedOffset( viewIndex ); 
-
-  for (Int i = 0; i <= ( getViewIndex() - 1); i++)
-  {
-    for ( Int d = 0; d <= ( ( 1 << g_bitDepthY ) - 1 ); d++ )
-    {
-      Int offset =    ( codOffset  [ i ] << g_bitDepthY ) + ( ( 1 << log2Div ) >> 1 );         
-      m_depthToDisparityB[ i ][ d ] = ( codScale [ i ] * d + offset ) >> log2Div; 
-
-      Int invOffset = ( invCodOffset[ i ] << g_bitDepthY ) + ( ( 1 << log2Div ) >> 1 );         
-      m_depthToDisparityF[ i ][ d ] = ( invCodScale[ i ] * d + invOffset ) >> log2Div; 
-    }
-  }
-#endif
 }
 #endif
@@ -4222,76 +4152,4 @@
   Bool depthFlag = getIsDepth();
 
-#if !HHI_INTER_COMP_PRED_K0052
-  Bool depthOfRefViewsAvailFlag = false; 
-  Bool textOfCurViewAvailFlag = false; 
-
-  TComVPS* vps = getVPS(); 
-
-  if( !depthFlag )
-  {
-    depthOfRefViewsAvailFlag = true;
-    for( Int i = 0; i <= vps->getNumRefListLayers( getLayerId() ) - 1; i++)
-    {
-      Bool curDepthAvailableFlag = false;    
-      for (Int j = 0; j <= vps->getMaxLayersMinus1(); j++ )
-      {
-        if ( vps->getDirectDependencyFlag( vps->getLayerIdInVps( getLayerId() ), j )
-          && vps->getVpsDepthFlag        ( vps->getLayerIdInNuh( j ) ) == 1
-          && vps->getViewOrderIdx( vps->getLayerIdInNuh( j ) ) == vps->getViewOrderIdx( vps->getIdRefListLayer( getLayerId(), i ) )
-          && vps->getDependencyId( vps->getLayerIdInNuh( j ) ) == 0
-          && vps->getAuxId       ( vps->getLayerIdInNuh( j ) ) == 0
-          )
-        {
-          curDepthAvailableFlag = true; 
-        }
-      }
-      if ( !curDepthAvailableFlag )
-      {
-        depthOfRefViewsAvailFlag = false; 
-      }    
-    }
-  }
-  else
-  {
-    for (Int j = 0; j <= vps->getMaxLayersMinus1(); j++ )
-    {
-      if ( vps->getDirectDependencyFlag( vps->getLayerIdInVps( getLayerId() ), j ) 
-        && vps->getVpsDepthFlag( vps->getLayerIdInNuh( j ) ) == 0
-        && vps->getViewOrderIdx( vps->getLayerIdInNuh( j ) ) == getViewIndex() 
-        && vps->getDependencyId( vps->getLayerIdInNuh( j ) ) == 0
-        && vps->getAuxId       ( vps->getLayerIdInNuh( j ) ) == 0
-        )
-      {        
-        textOfCurViewAvailFlag = true; 
-      }
-    }
-  }
-
-
-  Bool lidG0  = ( getLayerId() > 0 );
-  Bool nRLLG0 =  ( getVPS()->getNumRefListLayers( getLayerId() ) > 0 );     
-
-  TComSps3dExtension* sps3dExt = getSPS()->getSps3dExtension();
-
-  m_ivMvPredFlag           = sps3dExt->getIvMvPredFlag         ( depthFlag ) && lidG0 && nRLLG0                           ;                             
-  m_ivMvScalingFlag        = sps3dExt->getIvMvScalingFlag      ( depthFlag ) && lidG0                                    ;                             
-  m_ivResPredFlag          = sps3dExt->getIvResPredFlag        ( depthFlag ) && lidG0 && nRLLG0                           ;                               
-  m_depthRefinementFlag    = sps3dExt->getDepthRefinementFlag  ( depthFlag ) && lidG0           && depthOfRefViewsAvailFlag;                            
-  m_viewSynthesisPredFlag  = sps3dExt->getViewSynthesisPredFlag( depthFlag ) && lidG0 && nRLLG0 && depthOfRefViewsAvailFlag;                          
-  m_depthBasedBlkPartFlag  = sps3dExt->getDepthBasedBlkPartFlag( depthFlag ) && lidG0           && depthOfRefViewsAvailFlag;                          
-  m_mpiFlag                = sps3dExt->getMpiFlag              ( depthFlag ) && lidG0           &&   textOfCurViewAvailFlag;
-  m_intraContourFlag       = sps3dExt->getIntraContourFlag     ( depthFlag ) && lidG0           &&   textOfCurViewAvailFlag;
-  m_intraSdcWedgeFlag      = sps3dExt->getIntraSdcWedgeFlag    ( depthFlag ) && lidG0                                     ;                          
-  m_qtPredFlag             = sps3dExt->getQtPredFlag           ( depthFlag ) && lidG0           &&   textOfCurViewAvailFlag;
-  m_interSdcFlag           = sps3dExt->getInterSdcFlag         ( depthFlag ) && lidG0                                    ;  
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
-  m_depthIntraSkipFlag     = sps3dExt->getDepthIntraSkipFlag   ( depthFlag ) && lidG0                                    ;                          
-#else
-  m_intraSingleFlag        = sps3dExt->getIntraSingleFlag      ( depthFlag ) && lidG0                                    ;                          
-#endif
-
-  m_subPbSize              = lidG0 ? ( 1 << ( sps3dExt->getLog2SubPbSizeMinus3   ( depthFlag ) + 3 ) ) : getSPS()->getMaxCUWidth();  
-  m_mpiSubPbSize           = 1 << ( sps3dExt->getLog2MpiSubPbSizeMinus3( depthFlag ) + 3 );
-#else
   Bool nRLLG0 =  ( getVPS()->getNumRefListLayers( getLayerId() ) > 0 );     
 
@@ -4301,11 +4159,6 @@
   m_ivMvScalingFlag        = sps3dExt->getIvMvScalingFlag      ( depthFlag )                                 ;                             
   m_ivResPredFlag          = sps3dExt->getIvResPredFlag        ( depthFlag ) && nRLLG0                       ;                               
-#if HHI_CAM_PARA_K0052
   m_depthRefinementFlag    = sps3dExt->getDepthRefinementFlag  ( depthFlag )           && getInCompPredFlag() && m_cpAvailableFlag;
   m_viewSynthesisPredFlag  = sps3dExt->getViewSynthesisPredFlag( depthFlag ) && nRLLG0 && getInCompPredFlag() && m_cpAvailableFlag;
-#else
-  m_depthRefinementFlag    = sps3dExt->getDepthRefinementFlag  ( depthFlag )           && getInCompPredFlag();                            
-  m_viewSynthesisPredFlag  = sps3dExt->getViewSynthesisPredFlag( depthFlag ) && nRLLG0 && getInCompPredFlag();                            
-#endif
   m_depthBasedBlkPartFlag  = sps3dExt->getDepthBasedBlkPartFlag( depthFlag )           && getInCompPredFlag();                          
   m_mpiFlag                = sps3dExt->getMpiFlag              ( depthFlag )           && getInCompPredFlag();
@@ -4319,5 +4172,4 @@
   m_mpiSubPbSize           =  1 << ( sps3dExt->getLog2MpiSubPbSizeMinus3( depthFlag ) + 3 );
 
-#endif
 
 #if H_3D_OUTPUT_ACTIVE_TOOLS
@@ -4325,12 +4177,6 @@
   std::cout << "DepthFlag:              :" << getIsDepth()             << std::endl;
   std::cout << "ViewOrderIdx:           :" << getViewIndex()           << std::endl;
-#if HHI_INTER_COMP_PRED_K0052
   std::cout << "InterCmpPredAvailableFlag:" << getInCmpPredAvailFlag() << std::endl;
   std::cout << "InterCompPredFlag       :"  << getInCompPredFlag()     << std::endl;
-  //std::cout << "TextOfCurViewAvailFlag  :" << textOfCurViewAvailFlag   << std::endl;
-#else
-  std::cout << "DepthOfRefViewsAvailFlag:" << depthOfRefViewsAvailFlag << std::endl;
-  std::cout << "TextOfCurViewAvailFlag  :" << textOfCurViewAvailFlag   << std::endl;
-#endif
   
   std::cout << "ivMvPredFlag            :" << m_ivMvPredFlag           << std::endl;
@@ -4345,13 +4191,91 @@
   std::cout << "qtPredFlag              :" << m_qtPredFlag             << std::endl;
   std::cout << "interSdcFlag            :" << m_interSdcFlag           << std::endl;
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
   std::cout << "depthIntraSkipFlag      :" << m_depthIntraSkipFlag     << std::endl;    
-#else
-  std::cout << "intraSingleFlag         :" << m_intraSingleFlag        << std::endl;    
-#endif
   std::cout << "subPbSize               :" << m_subPbSize              << std::endl;
   std::cout << "mpiSubPbSize            :" << m_mpiSubPbSize           << std::endl;
 #endif
 }
+
+Void TComSlice::deriveInCmpPredAndCpAvailFlag()
+{
+  Int numCurCmpLIds = getIsDepth() ? 1 : getNumActiveRefLayerPics(); 
+  std::vector<Int> curCmpLIds;
+  if ( getIsDepth() )
+  {
+    curCmpLIds.push_back( getLayerId() );
+  }
+  else
+  {
+    for (Int i = 0; i < numCurCmpLIds; i++)
+    {
+      curCmpLIds.push_back( getRefPicLayerId( i ) );
+    }
+  }
+
+  m_cpAvailableFlag = true;
+  m_inCmpRefViewIdcs.clear();
+  Bool allRefCmpLayersAvailFlag = true;
+
+  for( Int i = 0; i <= numCurCmpLIds - 1; i++ )
+  {      
+    m_inCmpRefViewIdcs.push_back( getVPS()->getViewOrderIdx( curCmpLIds[ i ] ));
+    if( !getVPS()->getCpPresentFlag( getVPS()->getVoiInVps( getViewIndex() ),  getVPS()->getVoiInVps( m_inCmpRefViewIdcs[ i ] ) ) )
+    {
+      m_cpAvailableFlag = false;
+    }
+    Bool refCmpCurLIdAvailFlag = false;
+    if( getVPS()->getViewCompLayerPresentFlag( m_inCmpRefViewIdcs[ i ], !getIsDepth() ) )
+    {
+      Int j = getVPS()->getLayerIdInVps( getVPS()->getViewCompLayerId( m_inCmpRefViewIdcs[ i ],  !getIsDepth() ) );
+      if  ( getVPS()->getDirectDependencyFlag( getVPS()->getLayerIdInVps( getLayerId() ) ,  j ) &&
+        getVPS()->getSubLayersVpsMaxMinus1( j ) >= getTemporalId()   &&
+        ( getTemporalId() == 0 || getVPS()->getMaxTidIlRefPicsPlus1( j , getVPS()->getLayerIdInVps( getLayerId() ) ) > getTemporalId() )        
+        )
+      {
+        refCmpCurLIdAvailFlag = true;
+      }
+    }
+    if( !refCmpCurLIdAvailFlag )
+    {
+      allRefCmpLayersAvailFlag = false;
+    }
+  }
+
+  if( !allRefCmpLayersAvailFlag )
+  {
+    m_inCmpPredAvailFlag = false;
+  }  
+  else 
+  {
+    TComSps3dExtension* sps3dExt = getSPS()->getSps3dExtension();
+    if( !getIsDepth() )
+    {
+      m_inCmpPredAvailFlag = sps3dExt->getViewSynthesisPredFlag( getIsDepth() ) || 
+        sps3dExt->getDepthBasedBlkPartFlag( getIsDepth() ) || 
+        sps3dExt->getDepthRefinementFlag  ( getIsDepth() );                            
+    }
+    else
+    {
+      m_inCmpPredAvailFlag = sps3dExt->getIntraContourFlag( getIsDepth() ) || 
+        sps3dExt->getQtPredFlag( getIsDepth() ) || 
+        sps3dExt->getMpiFlag( getIsDepth() );                                  
+    }
+  }
+}
+
+Void TComSlice::checkInCompPredRefLayers()
+{
+  if ( getInCompPredFlag() )
+  {
+    for (Int i = 0; i < getNumCurCmpLIds(); i++ )
+    {
+      assert( getIvPic(!getIsDepth(), getInCmpRefViewIdcs( i ) ) != NULL );       
+      //  It is a requirement of bitstream conformance that there 
+      //  is a picture in the DPB with PicOrderCntVal equal to the PicOrderCntVal of the current picture, 
+      //  and a nuh_layer_id value equal to ViewCompLayerId[ inCmpRefViewIdcs[ i ] ][ !DepthFlag ].
+    }
+  }
+}
+
 #endif
 
Index: trunk/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComSlice.h	(revision 1180)
+++ trunk/source/Lib/TLibCommon/TComSlice.h	(revision 1196)
@@ -912,7 +912,7 @@
   Int         xGetDimBitOffset( Int j );
   Void        xSetRefLayerFlags( Int currLayerId );
+
   // VPS EXTENSION 2 SYNTAX ELEMENTS
 #if H_3D
-#if HHI_CAM_PARA_K0052  
   Int*        m_numCp;  
   Int**       m_cpRefVoi;
@@ -920,19 +920,10 @@
   Int         m_cpPrecision;
   Bool*       m_cpInSliceSegmentHeaderFlag;
-#else
-  UInt        m_uiCamParPrecision;
-  Bool*       m_bCamParInSliceHeader;
-  Bool*       m_bCamParPresent;
-#endif
   Int         ***m_aaaiCodedScale ;
   Int         ***m_aaaiCodedOffset;
 
-#if HHI_VIEW_ID_LIST_I5_J0107 ||  HHI_INTER_COMP_PRED_K0052
   std::vector<Int>  m_viewOIdxList;
-#endif
-#if HHI_INTER_COMP_PRED_K0052
   std::vector< std::vector<Bool> > m_viewCompLayerPresentFlag;
   std::vector< std::vector<Int>  > m_viewCompLayerId;
-#endif
 #endif
 
@@ -1021,5 +1012,6 @@
   Void    setVpsNonVuiExtensionLength( Int  val )                          { m_vpsNonVuiExtensionLength = val; } 
   Int     getVpsNonVuiExtensionLength(  )                                  { return m_vpsNonVuiExtensionLength; } 
-
+  
+  // VPS Extension
   Void    setSplittingFlag( Bool val )                                     { m_splittingFlag = val;  }
   Bool    getSplittingFlag()                                               { return m_splittingFlag; }
@@ -1163,67 +1155,13 @@
   Int     getNumViews()                                                    { return m_numViews; }
   Void    initNumViews();
-#if HHI_INTER_COMP_PRED_K0052
 #if H_3D
-  Void   initViewCompLayer( )
-  { 
-    assert( m_viewCompLayerId.size() == 0 && m_viewCompLayerPresentFlag.size() == 0  );
-    for( Int i = 0; i < getNumViews(); i++ )
-    {
-      m_viewCompLayerId         .push_back( std::vector<Int>(0)  );
-      m_viewCompLayerPresentFlag.push_back( std::vector<Bool>(0) );      
-
-      for( Int depFlag = 0; depFlag  <=  1; depFlag++ )
-      {
-        Int iViewOIdx = getViewOIdxList( i );
-        Int layerId = -1;
-        for( Int j = 0; j  <=  getMaxLayersMinus1(); j++ ) 
-        {
-          Int jNuhLId = getLayerIdInNuh( j );
-          if( getVpsDepthFlag( jNuhLId ) == ( (Bool) depFlag )  &&  getViewOrderIdx( jNuhLId )  ==  iViewOIdx  
-            &&  getDependencyId( jNuhLId )  ==  0  &&  getAuxId( jNuhLId )  ==  0 )
-          {
-            layerId = jNuhLId;
-          }
-        }
-        m_viewCompLayerPresentFlag[ i ].push_back( layerId  !=  -1 );
-        m_viewCompLayerId         [ i ].push_back( layerId );        
-      }
-    }
-  };
-#endif
-#endif
-
-#if HHI_VIEW_ID_LIST_I5_J0107 || HHI_INTER_COMP_PRED_K0052
+  Void   initViewCompLayer( );
   Int     getViewOIdxList( Int i )                                         { return m_viewOIdxList[i]; }
-#if HHI_CAM_PARA_K0052
   std::vector<Int> getViewOIdxList( )                                               { return m_viewOIdxList; }
-#endif
-#endif
-
-#if HHI_INTER_COMP_PRED_K0052
-#if HHI_CAM_PARA_K0052
-  Int     getVoiInVps( Int viewOIdx )                                      
-#else
-  Int     getInvViewOIdxList( Int viewOIdx )                                      
-#endif
-  {    
-    for ( Int i = 0; i < m_viewOIdxList.size(); i++ )
-    {
-      if  ( m_viewOIdxList[ i ] == viewOIdx )
-      {
-        return i; 
-      }
-    }
-    assert( 0 );   
-    return -1; 
-  };
-
-#if HHI_CAM_PARA_K0052
+
+  Int     getVoiInVps( Int viewOIdx );;
+
   Bool    getViewCompLayerPresentFlag (Int i, Bool d ) { return  m_viewCompLayerPresentFlag[ getVoiInVps(i) ][d]; }
   Bool    getViewCompLayerId          (Int i, Bool d ) { return  m_viewCompLayerId         [ getVoiInVps(i) ][d]; }
-#else
-  Bool    getViewCompLayerPresentFlag (Int i, Bool d ) { return  m_viewCompLayerPresentFlag[ getInvViewOIdxList(i) ][d]; }
-  Bool    getViewCompLayerId          (Int i, Bool d ) { return  m_viewCompLayerId         [ getInvViewOIdxList(i) ][d]; }
-#endif
 #endif
   Bool    getDependencyFlag( Int i, Int j )                                { return m_dependencyFlag[i][j]; }
@@ -1347,11 +1285,6 @@
   Void createCamPars(Int iNumViews);
   Void deleteCamPars();
-#if HHI_CAM_PARA_K0052
   Void initCamParaVPS( Int vOIdxInVps, Int numCp, Bool cpInSliceSegmentHeaderFlag, Int* cpRefVoi, Int** aaiScale, Int** aaiOffset ); 
-#else
-  Void initCamParaVPS      (  UInt uiViewIndex, Bool bCamParPresent = false, UInt uiCamParPrecision = 0, Bool bCamParSlice = false, Int** aaiScale = 0, Int** aaiOffset = 0 );
-#endif
-  
-#if HHI_CAM_PARA_K0052
+  
 
   Void setCpPrecision( Int  val ) { m_cpPrecision = val; } 
@@ -1380,35 +1313,9 @@
 
 // Derived
-  Void deriveCpPresentFlag( )
-  {
-    for( Int nInVps = 0; nInVps < getNumViews(); nInVps++  )
-    {
-      for( Int mInVps = 0; mInVps < getNumViews(); mInVps++ )
-      {
-        m_cpPresentFlag[nInVps][mInVps] = 0; 
-      }
-    }
-
-   for( Int n = 1; n < getNumViews(); n++ )
-   {
-      Int iInVps = getVoiInVps(  getViewOIdxList( n ) );      
-      for( Int m = 0; m < getNumCp( iInVps ); m++ )
-      {
-         m_cpPresentFlag[ iInVps ][ getVoiInVps( getCpRefVoi( iInVps, m ) ) ] = 1;
-      }
-    }
-  }
+  Void deriveCpPresentFlag( );
 
   Void setCpPresentFlag( Int i, Int m, Bool flag ) { m_cpPresentFlag[i][m] = flag; } 
   Bool getCpPresentFlag( Int i, Int m )           { return m_cpPresentFlag[i][m]; }   
 
-#else
-  UInt getCamParPrecision    ()  { return m_uiCamParPrecision; }
-
-  Bool getCamParPresent      ( Int viewIndex )  { return m_bCamParPresent[viewIndex]; }
-  Void setCamParPresent      ( Int viewIndex, Bool val )  { m_bCamParPresent[viewIndex] = val; }
-  Bool hasCamParInSliceHeader( Int viewIndex )  { return m_bCamParInSliceHeader[viewIndex]; }
-  Void setHasCamParInSliceHeader( Int viewIndex, Bool b )  { m_bCamParInSliceHeader[viewIndex] = b; }
-#endif
 
 
@@ -1705,9 +1612,5 @@
       m_qtPredFlag            [d] = false; 
       m_interSdcFlag          [d] = false; 
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
       m_depthIntraSkipFlag    [d] = false;   
-#else
-      m_intraSingleFlag       [d] = false; 
-#endif
     }
   }
@@ -1752,11 +1655,6 @@
   Bool getInterSdcFlag( Int d ) { return m_interSdcFlag[d]; } 
 
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
   Void setDepthIntraSkipFlag( Int d, Bool flag ) { m_depthIntraSkipFlag[d] = flag; } 
   Bool getDepthIntraSkipFlag( Int d ) { return m_depthIntraSkipFlag[d]; } 
-#else
-  Void setIntraSingleFlag( Int d, Bool flag ) { m_intraSingleFlag[d] = flag; } 
-  Bool getIntraSingleFlag( Int d ) { return m_intraSingleFlag[d]; } 
-#endif
 
 private:
@@ -1775,9 +1673,5 @@
   Bool        m_qtPredFlag            [2];
   Bool        m_interSdcFlag          [2];
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
   Bool        m_depthIntraSkipFlag    [2];  
-#else
-  Bool        m_intraSingleFlag       [2];  
-#endif
 };
 
@@ -1884,8 +1778,4 @@
 #if H_3D
   TComSps3dExtension m_sps3dExtension; 
-#if !HHI_CAM_PARA_K0052
-  UInt        m_uiCamParPrecision;
-  Bool        m_bCamParInSliceHeader;
-#endif
   Int         m_aaiCodedScale [2][MAX_NUM_LAYERS];
   Int         m_aaiCodedOffset[2][MAX_NUM_LAYERS];
@@ -2517,7 +2407,5 @@
   UInt                 m_nARPStepNum; 
   Int         m_aiFirstTRefIdx    [2]; 
-#if HHI_RES_PRED_K0052
   std::vector<Int> m_pocsInCurrRPSs; 
-#endif
 #endif
 #if H_3D_IC
@@ -2526,13 +2414,9 @@
 #endif
 #if H_3D
-#if HHI_INTER_COMP_PRED_K0052
   std::vector<Int> m_inCmpRefViewIdcs;
   Bool       m_inCmpPredAvailFlag; 
   Bool       m_inCmpPredFlag; 
-#endif
-#if HHI_CAM_PARA_K0052
   Bool       m_cpAvailableFlag; 
   Int        m_numViews; 
-#endif
   TComPic*   m_ivPicsCurrPoc [2][MAX_NUM_LAYERS];  
   Int**      m_depthToDisparityB; 
@@ -2540,14 +2424,8 @@
 #endif
 #endif
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
   Bool      m_bApplyDIS;
-#else
-#if H_3D_SINGLE_DEPTH
-  Bool      m_bApplySingleDepthMode;
-#endif
-#endif
 #if H_3D_IC
-  Int *m_aICEnableCandidate;
-  Int *m_aICEnableNum;
+  Int*      m_aICEnableCandidate;
+  Int*      m_aICEnableNum;
 #endif
   Int       m_iDefaultRefViewIdx;
@@ -2565,9 +2443,5 @@
   Bool m_qtPredFlag           ;
   Bool m_interSdcFlag         ;
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
   Bool m_depthIntraSkipFlag   ;
-#else
-  Bool m_intraSingleFlag      ;
-#endif
   Int  m_mpiSubPbSize         ; 
   Int  m_subPbSize            ; 
@@ -2637,14 +2511,10 @@
   Int       getRefPOC           ( RefPicList e, Int iRefIdx)    { return  m_aiRefPOCList[e][iRefIdx];   }
 #if H_3D
-#if HHI_INTER_COMP_PRED_K0052
   Bool      getInCmpPredAvailFlag( )                             { return m_inCmpPredAvailFlag;    } 
-#if HHI_CAM_PARA_K0052
   Bool      getCpAvailableFlag( )                             { return m_cpAvailableFlag;    } 
-#endif
   Bool      getInCompPredFlag( )                                 { return m_inCmpPredFlag;         }    
   Void      setInCompPredFlag( Bool b )                          { m_inCmpPredFlag = b;            }    
   Int       getInCmpRefViewIdcs( Int i )                         { return m_inCmpRefViewIdcs  [i]; }
   Int       getNumCurCmpLIds( )                                  { return (Int) m_inCmpRefViewIdcs.size(); } 
-#endif
   TComPic*  getIvPic            ( Bool depthFlag, Int viewIndex){ return  m_ivPicsCurrPoc[ depthFlag ? 1 : 0 ][ viewIndex ]; }
 #endif
@@ -2875,7 +2745,5 @@
   Void      setFirstTRefIdx        ( RefPicList e, Int i )         { m_aiFirstTRefIdx[e]    = i;      }
   Bool      getArpRefPicAvailable( RefPicList e, Int viewIdx) {return m_arpRefPicAvailable[e][getVPS()->getLayerIdInNuh(viewIdx, 0)]; }
-#if HHI_RES_PRED_K0052
   std::vector<Int> getPocsInCurrRPSs()                             { return m_pocsInCurrRPSs; }; 
-#endif
 #endif
   Void      setIsDepth            ( Bool isDepth )   { m_isDepth = isDepth; }
@@ -2886,5 +2754,4 @@
   Int*      getInvCodedScale      ()  { return m_aaiCodedScale [1]; }
   Int*      getInvCodedOffset     ()  { return m_aaiCodedOffset[1]; }
-#if HHI_CAM_PARA_K0052
   Void      setCpScale( Int j, Int  val ) { m_aaiCodedScale[0][j] = val; } 
   Int       getCpScale( Int j ) { return m_aaiCodedScale[0][j]; } 
@@ -2898,5 +2765,4 @@
   Void      setCpInvOff( Int j, Int  val ) { m_aaiCodedOffset[1][j] = val; } 
   Int       getCpInvOff( Int j ) { return m_aaiCodedOffset[1][j]; } 
-#endif
 
 #endif
@@ -2906,11 +2772,6 @@
   Void    setDepthToDisparityLUTs();
 
-#if HHI_CAM_PARA_K0052
   Int* getDepthToDisparityB( Int refViewIdx ) { return m_depthToDisparityB[ getVPS()->getVoiInVps( refViewIdx) ]; }; 
   Int* getDepthToDisparityF( Int refViewIdx ) { return m_depthToDisparityF[ getVPS()->getVoiInVps( refViewIdx) ]; }; 
-#else
-  Int* getDepthToDisparityB( Int refViewIdx ) { return m_depthToDisparityB[ refViewIdx ]; }; 
-  Int* getDepthToDisparityF( Int refViewIdx ) { return m_depthToDisparityF[ refViewIdx ]; }; 
-#endif
 #endif
 #if H_3D_IC
@@ -3015,95 +2876,8 @@
 #if H_3D
   // 3D-HEVC tool parameters
-#if HHI_INTER_COMP_PRED_K0052
-  Void deriveInCmpPredAndCpAvailFlag()
-  { 
-    Int numCurCmpLIds = getIsDepth() ? 1 : getNumActiveRefLayerPics(); 
-    std::vector<Int> curCmpLIds;
-    if ( getIsDepth() )
-    {
-      curCmpLIds.push_back( getLayerId() );
-    }
-    else
-    {
-      for (Int i = 0; i < numCurCmpLIds; i++)
-      {
-        curCmpLIds.push_back( getRefPicLayerId( i ) );
-      }
-    }
-
-#if HHI_CAM_PARA_K0052
-    m_cpAvailableFlag = true;
-    m_inCmpRefViewIdcs.clear();
-#endif
-    Bool allRefCmpLayersAvailFlag = true;
-
-    for( Int i = 0; i <= numCurCmpLIds - 1; i++ )
-    {      
-      m_inCmpRefViewIdcs.push_back( getVPS()->getViewOrderIdx( curCmpLIds[ i ] ));
-#if HHI_CAM_PARA_K0052
-      if( !getVPS()->getCpPresentFlag( getVPS()->getVoiInVps( getViewIndex() ),  getVPS()->getVoiInVps( m_inCmpRefViewIdcs[ i ] ) ) )
-      {
-        m_cpAvailableFlag = false;
-      }
-#endif
-      Bool refCmpCurLIdAvailFlag = false;
-      if( getVPS()->getViewCompLayerPresentFlag( m_inCmpRefViewIdcs[ i ], !getIsDepth() ) )
-      {
-        Int j = getVPS()->getLayerIdInVps( getVPS()->getViewCompLayerId( m_inCmpRefViewIdcs[ i ],  !getIsDepth() ) );
-        if  ( getVPS()->getDirectDependencyFlag( getVPS()->getLayerIdInVps( getLayerId() ) ,  j ) &&
-          getVPS()->getSubLayersVpsMaxMinus1( j ) >= getTemporalId()   &&
-          ( getTemporalId() == 0 || getVPS()->getMaxTidIlRefPicsPlus1( j , getVPS()->getLayerIdInVps( getLayerId() ) ) > getTemporalId() )        
-          )
-        {
-          refCmpCurLIdAvailFlag = true;
-        }
-      }
-      if( !refCmpCurLIdAvailFlag )
-      {
-        allRefCmpLayersAvailFlag = false;
-      }
-    }
-
-    if( !allRefCmpLayersAvailFlag )
-    {
-      m_inCmpPredAvailFlag = false;
-    }  
-    else 
-    {
-      TComSps3dExtension* sps3dExt = getSPS()->getSps3dExtension();
-      if( !getIsDepth() )
-      {
-        m_inCmpPredAvailFlag = sps3dExt->getViewSynthesisPredFlag( getIsDepth() ) || 
-          sps3dExt->getDepthBasedBlkPartFlag( getIsDepth() ) || 
-          sps3dExt->getDepthRefinementFlag  ( getIsDepth() );                            
-      }
-      else
-      {
-        m_inCmpPredAvailFlag = sps3dExt->getIntraContourFlag( getIsDepth() ) || 
-          sps3dExt->getQtPredFlag( getIsDepth() ) || 
-          sps3dExt->getMpiFlag( getIsDepth() );                                  
-      }
-    }  
-  };
-
-#endif
-
+  Void deriveInCmpPredAndCpAvailFlag();
   Void init3dToolParameters();   
-#if HHI_INTER_COMP_PRED_K0052
-  Void checkInCompPredRefLayers()
-  {
-    if ( getInCompPredFlag() )
-    {
-      for (Int i = 0; i < getNumCurCmpLIds(); i++ )
-      {
-        assert( getIvPic(!getIsDepth(), getInCmpRefViewIdcs( i ) ) != NULL );       
-        //  It is a requirement of bitstream conformance that there 
-        //  is a picture in the DPB with PicOrderCntVal equal to the PicOrderCntVal of the current picture, 
-        //  and a nuh_layer_id value equal to ViewCompLayerId[ inCmpRefViewIdcs[ i ] ][ !DepthFlag ].
-      }
-    }
-  };
-
-#endif
+  Void checkInCompPredRefLayers();;
+
   Bool getIvMvPredFlag           ( ) { return m_ivMvPredFlag           ; };
   Bool getIvMvScalingFlag        ( ) { return m_ivMvScalingFlag        ; };
@@ -3117,9 +2891,5 @@
   Bool getQtPredFlag             ( ) { return m_qtPredFlag             ; };
   Bool getInterSdcFlag           ( ) { return m_interSdcFlag           ; };
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
   Bool getDepthIntraSkipFlag     ( ) { return m_depthIntraSkipFlag     ; };
-#else
-  Bool getIntraSingleFlag        ( ) { return m_intraSingleFlag        ; };
-#endif
 
   Int  getMpiSubPbSize           ( ) { return m_mpiSubPbSize           ; }; 
Index: trunk/source/Lib/TLibCommon/TComWedgelet.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComWedgelet.cpp	(revision 1180)
+++ trunk/source/Lib/TLibCommon/TComWedgelet.cpp	(revision 1196)
@@ -177,5 +177,4 @@
 }
 
-#if SHARP_DMM_CLEAN_K0042
 Void TComWedgelet::generateWedgePatternByRotate(const TComWedgelet &rcWedge, Int rotate)
 {
@@ -210,5 +209,4 @@
   m_uiHeight = rcWedge.m_uiHeight;
 }
-#endif
 
 Void TComWedgelet::xGenerateWedgePattern()
@@ -228,5 +226,4 @@
   xDrawEdgeLine( uhXs, uhYs, uhXe, uhYe, pbTempPattern, iTempStride );
 
-#if SHARP_DMM_CLEAN_K0042
   Int shift = (m_eWedgeRes == HALF_PEL) ? 1 : 0;
   Int endPos = uhYe>>shift;
@@ -242,65 +239,4 @@
     m_pbPattern[k] = pbTempPattern[k];
   };
-#else
-  switch( m_uhOri )
-  {
-  case( 0 ): { for( UInt iX = 0;                 iX < uhXs;            iX++ ) { UInt iY = 0;                 while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iY++; } } } break;
-  case( 1 ): { for( UInt iY = 0;                 iY < uhYs;            iY++ ) { UInt iX = uiTempBlockSize-1; while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iX--; } } } break;
-  case( 2 ): { for( UInt iX = uiTempBlockSize-1; iX > uhXs;            iX-- ) { UInt iY = uiTempBlockSize-1; while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iY--; } } } break;
-  case( 3 ): { for( UInt iY = uiTempBlockSize-1; iY > uhYs;            iY-- ) { UInt iX = 0;                 while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iX++; } } } break;
-  case( 4 ): 
-    { 
-      if( (uhXs+uhXe) < uiTempBlockSize ) { for( UInt iY = 0; iY < uiTempBlockSize; iY++ ) { UInt iX = 0;                 while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iX++; } } }
-      else                                { for( UInt iY = 0; iY < uiTempBlockSize; iY++ ) { UInt iX = uiTempBlockSize-1; while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iX--; } } }
-    }
-    break;
-  case( 5 ): 
-    { 
-      if( (uhYs+uhYe) < uiTempBlockSize ) { for( UInt iX = 0; iX < uiTempBlockSize; iX++ ) { UInt iY = 0;                 while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iY++; } } }
-      else                                { for( UInt iX = 0; iX < uiTempBlockSize; iX++ ) { UInt iY = uiTempBlockSize-1; while( pbTempPattern[(iY * iTempStride) + iX] == false ) { pbTempPattern[(iY * iTempStride) + iX] = true; iY--; } } }
-    }
-  }
-
-  clear();
-  switch( m_eWedgeRes )
-  {
-  case(   FULL_PEL ): { for( UInt k = 0; k < (m_uiWidth * m_uiHeight); k++ ) { m_pbPattern[k] = pbTempPattern[k]; }; } break;
-  case(   HALF_PEL ): // sub-sampling by factor 2
-    {
-      Int iStride = getStride();
-
-      UInt uiOffX, uiOffY;
-      switch( m_uhOri )
-      {
-      case( 0 ): { uiOffX = 0; uiOffY = 0; } break;
-      case( 1 ): { uiOffX = 1; uiOffY = 0; } break;
-      case( 2 ): { uiOffX = 1; uiOffY = 1; } break;
-      case( 3 ): { uiOffX = 0; uiOffY = 1; } break;
-      case( 4 ): 
-        { 
-          if( (uhXs+uhXe) < uiTempBlockSize ) { uiOffX = 0; uiOffY = 0; }
-          else                                { uiOffX = 1; uiOffY = 0; }
-        } 
-        break;
-      case( 5 ): 
-        { 
-          if( (uhYs+uhYe) < uiTempBlockSize ) { uiOffX = 0; uiOffY = 0; }
-          else                                { uiOffX = 0; uiOffY = 1; }
-        } 
-        break;
-      default:   { uiOffX = 0; uiOffY = 0; } break;
-      }
-
-      for(Int iY = 0; iY < m_uiHeight; iY++)
-      {
-        for(Int iX = 0; iX < m_uiWidth; iX++)
-        {
-          m_pbPattern[(iY * iStride) + iX] = pbTempPattern[(((iY<<1)+uiOffY) * iTempStride) + ((iX<<1)+uiOffX)];
-        }
-      }
-    }
-    break;
-  }
-#endif
 
   if( pbTempPattern )
@@ -345,13 +281,8 @@
   for( Int x = x0; x <= x1; x++ )
   {
-#if SHARP_DMM_CLEAN_K0042
     Int shift = (m_eWedgeRes == HALF_PEL) ? 1 : 0;
     Int stride = iPatternStride >> shift;
     if( steep ) { pbPattern[((x>>shift) * stride) + (y>>shift)] = true; }
     else        { pbPattern[((y>>shift) * stride) + (x>>shift)] = true; }
-#else
-    if( steep ) { pbPattern[(x * iPatternStride) + y] = true; }
-    else        { pbPattern[(y * iPatternStride) + x] = true; }
-#endif
 
     error += deltaerr;
Index: trunk/source/Lib/TLibCommon/TComWedgelet.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComWedgelet.h	(revision 1180)
+++ trunk/source/Lib/TLibCommon/TComWedgelet.h	(revision 1196)
@@ -124,7 +124,5 @@
   Bool*           getScaledPattern(UInt uiWidth);
 
-#if SHARP_DMM_CLEAN_K0042
   Void  generateWedgePatternByRotate(const TComWedgelet &rcWedge, Int rotate);
-#endif
   Void  setWedgelet( UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe, UChar uhOri, WedgeResolution eWedgeRes, Bool bIsCoarse = false );
   Void  findClosestAngle();
Index: trunk/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- trunk/source/Lib/TLibCommon/TypeDef.h	(revision 1180)
+++ trunk/source/Lib/TLibCommon/TypeDef.h	(revision 1196)
@@ -65,15 +65,5 @@
 #define H_3D          ( HEVC_EXT == 2)
 
-#if H_MV
-#define SONY_MV_V_CONST_C0078            1   // Control disparity vector search range via configuration file
-#define H_MV_FIX_CONF_WINDOW             1   
-#endif
-
-#define NTT_BUG_FIX_TK54    1
-#define BUG_FIX_TK65        1
-
-#define MTK_I0093           1
-
-#define RWTH_DBBP_NO_SATD_K0028       1
+
 /////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////   MAJOR DEFINES   ///////////////////////////////////  
@@ -85,11 +75,4 @@
 
 #if H_3D
-#define SEC_DEPTH_INTRA_SKIP_MODE_K0033   1   // Depth intra skip mode
-
-#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
-#define NEIGHBORING_PIX_AVAILABILITY_FIX  1
-#endif
-
-
 #define H_3D_QTLPC                        1   // OL_QTLIMIT_PREDCODING_B0068 //JCT3V-B0068
                                               // HHI_QTLPC_RAU_OFF_C0160 JCT3V-C0160 change 2: quadtree limitation and predictive coding switched off in random access units 
@@ -129,7 +112,6 @@
                                               // SHARP_ARP_CHROMA_I0104     
                                               // MTK_I0072_IVARP_SCALING_FIX
-#define SEC_ARP_VIEW_REF_CHECK_J0037      1   // Signaling iv_res_pred_weight_idx when the current slice has both view and temporal reference picture(s), JCT3V-J0037 item1
-
-#define SEC_ARP_REM_ENC_RESTRICT_K0035    1   // Removal of encoder restriction of ARP, JCT3V-K0035
+                                              // SEC_ARP_VIEW_REF_CHECK_J0037    Signaling iv_res_pred_weight_idx when the current slice has both view and temporal reference picture(s), JCT3V-J0037 item1
+                                              // SEC_ARP_REM_ENC_RESTRICT_K0035    Removal of encoder restriction of ARP, JCT3V-K0035
 
 #define H_3D_IC                           1   // Illumination Compensation, JCT3V-B0045, JCT3V-C0046, JCT3V-D0060
@@ -200,13 +182,11 @@
                                               // SEC_ADAPT_DISABLE_IVMP        Disabling IVMP merge candidates when IC is enabled, JCT3V-H0070
                                               // SEC_SIMP_SHIFTED_DV_I0086     Simplification of Shifted DV candidate, JCT3V-I0086
-
-#define SEC_SHIFTED_IVMC_POS_K0036        1   // Position Derivation for Shifted-IVMC, JCT3V-K0036
+                                              // SEC_SHIFTED_IVMC_POS_K0036    Position Derivation for Shifted-IVMC, JCT3V-K0036
 
 
 #define H_3D_TMVP                         1   // QC_TMVP_C0047 
                                               // Sony_M23639
-#if H_3D_TMVP
-#define H_3D_TMVP_SCALING_FIX_K0053       1   // QC/CY for K0053
-#endif
+                                              // H_3D_TMVP_SCALING_FIX_K0053       1   // QC/CY for K0053
+
 
 #define H_3D_DIM                          1   // DIM, Depth intra modes, includes:
@@ -249,5 +229,5 @@
                                               // MTK_DLT_CODING_FIX_H0091 
                                               // HS_DMM_SIGNALLING_I0120
-                                              // SHARP_DMM1_I0110 // LUT size reduction for DMM1 proposed in JCT3V-I0110 
+                                              // SHARP_DMM1_I0110 LUT size reduction for DMM1 proposed in JCT3V-I0110 
                                               // FAST_SDC_OFFSET_DECISION_I0084
                                               // SEPARATE_FLAG_I0085
@@ -256,12 +236,7 @@
                                               // MTK_DMM_SIM_J0035
                                               // MTK_J0033
-                                              // SHARP_DLT_SIMP_J0029              1   // DLT(DepthValue2Idx[]) table derivation cleanup
-
-#if !SEC_DEPTH_INTRA_SKIP_MODE_K0033
-#define H_3D_SINGLE_DEPTH                 1   // Single depth mode proposed in JCT3V-I0095
-                                              // HS_SP_SIMP_J0066
-                                              // SINGLE_DEPTH_SIMP_J0115           1 
-                                              // MTK_SINGLE_DEPTH_VPS_FLAG_J0060   1   // Add VPS control flags and remove slice header control flag for single depth, JCT3V-J0060
-#endif
+                                              // SHARP_DLT_SIMP_J0029 DLT(DepthValue2Idx[]) table derivation cleanup
+                                              // SHARP_DMM_CLEAN_K0042             1   // Generate DMM pattern with rotation 
+
 
 #define H_3D_INTER_SDC                    1   // INTER SDC, Inter simplified depth coding
@@ -269,5 +244,5 @@
                                               // SEC_INTER_SDC_G0101 Improved inter SDC with multiple DC candidates
 
-#define H_3D_SPIVMP                       1   // H_3D_SPIVMP    // JCT3V-F0110: Sub-PU level inter-view motion prediction
+#define H_3D_SPIVMP                       1   // H_3D_SPIVMP JCT3V-F0110: Sub-PU level inter-view motion prediction
                                               // SEC_SPIVMP_MCP_SIZE_G0077, Apply SPIVMP only to 2Nx2N partition, JCT3V-G0077
                                               // QC_SPIVMP_MPI_G0119 Sub-PU level MPI merge candidate
@@ -280,19 +255,20 @@
                                               // SEC_DBBP_FILTERING_H0104 
                                               // MTK_DBBP_SIGNALING_H0094    
-                                              // H_3D_FIX_DBBP_IVMP        Fix . Enable IVMP is always disabled, when DBBP is enabled. The original intention is to disable Sub-PU IVMP when DBBP is enabled, not to disable IVMP itself. 
-                                              // SEC_DBBP_EXPLICIT_SIG_I0077       1   // Remove the partition derivation and signal dbbp_flag only when the partition mode is 2NxN/Nx2N, JCT3V-I0077
+                                              // H_3D_FIX_DBBP_IVMP Fix . Enable IVMP is always disabled, when DBBP is enabled. The original intention is to disable Sub-PU IVMP when DBBP is enabled, not to disable IVMP itself. 
+                                              // SEC_DBBP_EXPLICIT_SIG_I0077 Remove the partition derivation and signal dbbp_flag only when the partition mode is 2NxN/Nx2N, JCT3V-I0077
                                               // Disallow DBBP in 8x8 CU, JCT3V-I0078
-                                              // SHARP_DBBP_SIMPLE_FLTER_I0109     1   // Simple condition and one dimensional filter for DBBP
-                                              // SEC_DBBP_DMM4_THRESHOLD_I0076     Simplification of threshold derivation for DBBP and DMM4, JCT3V-I0076
-                                              // SEC_DBBP_VIEW_REF_CHECK_J0037     1   // Signaling dbbp_flag when the current slice has view reference picture(s), JCT3V-J0037 item4
-#define HS_DBBP_CLEAN_K0048     1 
+                                              // SHARP_DBBP_SIMPLE_FLTER_I0109 Simple condition and one dimensional filter for DBBP
+                                              // SEC_DBBP_DMM4_THRESHOLD_I0076 Simplification of threshold derivation for DBBP and DMM4, JCT3V-I0076
+                                              // SEC_DBBP_VIEW_REF_CHECK_J0037 Signaling dbbp_flag when the current slice has view reference picture(s), JCT3V-J0037 item4
+                                              // RWTH_DBBP_NO_SATD_K0028
+                                              // HS_DBBP_CLEAN_K0048
 
 #define H_3D_DDD                          1   // Disparity derived depth coding
                                               // LGE_DDD_REMOVAL_J0042_J0030 DDD removal
 
+#define H_3D_DIS                          1   // Depth intra skip 
+                                              // SEC_DEPTH_INTRA_SKIP_MODE_K0033  Depth intra skip mode
+
 #define H_3D_FCO                          0   // Flexible coding order for 3D
-#if H_3D_FCO
-#define H_3D_FCO                          1
-#endif
 
 #define H_3D_FAST_INTRA_SDC               1   // I0123
@@ -300,16 +276,20 @@
 // OTHERS
                                               // MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170 // Progressive MV Compression, JCT3V-E0170
-#define H_3D_REN_MAX_DEV_OUT              0   // Output maximal possible shift deviation 
+
 #define H_3D_FAST_TEXTURE_ENCODING        1   // Fast merge mode decision and early CU determination for texture component of dependent view, JCT3V-E0173
                                               // MTK_FAST_TEXTURE_ENCODING_E0173
 #if H_3D_DIM
-#define H_3D_FAST_DEPTH_INTRA             1   // Fast DMM and RBC Mode Selection
+#define H_3D_FAST_DEPTH_INTRA             1   // Fast DMM Selection
                                               // SCU_HS_FAST_DEPTH_INTRA_E0238_HHIFIX
 #endif
 
 //HLS
-//HHI_DEPENDENCY_SIGNALLING_I1_J0107
-//HHI_TOOL_PARAMETERS_I2_J0107
-//HHI_VPS_3D_EXTENSION_I3_J0107
+                                             // HHI_DEPENDENCY_SIGNALLING_I1_J0107
+                                             // HHI_TOOL_PARAMETERS_I2_J0107
+                                             // HHI_VPS_3D_EXTENSION_I3_J0107
+                                             // HHI_INTER_COMP_PRED_K0052
+                                             // HHI_RES_PRED_K0052       
+                                             // HHI_CAM_PARA_K0052       
+                                             // H_3D_DIRECT_DEP_TYPE     
 
 // Rate Control
@@ -319,36 +299,12 @@
 #endif // H_3D
 
-
-
 /////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////   DERIVED DEFINES ///////////////////////////////////  
 /////////////////////////////////////////////////////////////////////////////////////////
 
-// Fixes
-
-#define FIX_TICKET_95                          1   // pps_scaling_list_ref_layer_id parsing
-
 #if H_3D
 #define H_3D_DISABLE_CHROMA                    1 
-#define HHI_VIEW_ID_LIST_I5_J0107              0
-#define HHI_INTER_COMP_PRED_K0052              1
-#define HHI_RES_PRED_K0052                     1
-#define HHI_CAM_PARA_K0052                     1
-#define HHI_MOVE_SYN_K0052                     1
-#define H_3D_ANNEX_SELECTION_FIX               1
-#define H_3D_TMVP_FIX_TICKET_97                1
-#define H_3D_DIRECT_DEP_TYPE                   1
-#define H_3D_FIX_TMVP_SCALING_VIEW_ID          1
-#endif
-#define H_MV_FIX_REF_LAYER_PIC_FLAG            1
-#define H_MV_FIX_NUM_VIEWS                     1
 #define H_3D_OUTPUT_ACTIVE_TOOLS               0
-
-#if !SEC_DEPTH_INTRA_SKIP_MODE_K0033
-///// ***** SINGLE DEPTH MODE *********
-#if H_3D_SINGLE_DEPTH
-#define SINGLE_DEPTH_MODE_CAND_LIST_SIZE            2 // size of the sample candidate list
-
-#endif
+#define H_3D_REN_MAX_DEV_OUT                   0
 #endif
 
@@ -384,8 +340,4 @@
                                               // HHI_DEPTH_INTRA_SEARCH_RAU_C0160
                                               // LG_ZEROINTRADEPTHRESI_A0087
-#define SHARP_DMM_CLEAN_K0042             1   // Generate DMM pattern with rotation 
-
-#define TICKET083_IVPFLAG_FIX             1
-#define SHARP_SUBBLOCK_CLEAN_K0044        1   // Remove unused bipred restriction
 
 #endif
@@ -434,8 +386,7 @@
 // TBD: Check if integration is necessary. 
 
-#define H_MV_HLS_FIX                         1
+
 #define H_MV_HLS_PTL_LIMITS                  0
 #define H_MV_HLS7_GEN                        0  // General changes (not tested)
-#define H_MV_ALIGN_HM_15                     1  
 
 // POC
