Index: trunk/source/Lib/TAppCommon/TAppComCamPara.cpp
===================================================================
--- trunk/source/Lib/TAppCommon/TAppComCamPara.cpp	(revision 1085)
+++ trunk/source/Lib/TAppCommon/TAppComCamPara.cpp	(revision 1124)
@@ -1203,6 +1203,8 @@
   m_uiCamParsCodedPrecision = uiCodedCamParsPrecision;
   m_iLog2Precision          = iLog2Precision;
+#if !HHI_TOOL_PARAMETERS_I2_J0107
 #if HHI_INTERVIEW_SKIP
   m_iCurrentFrameId         = 0 ;
+#endif
 #endif
 
Index: trunk/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComDataCU.cpp	(revision 1085)
+++ trunk/source/Lib/TLibCommon/TComDataCU.cpp	(revision 1124)
@@ -154,7 +154,9 @@
 #endif
 
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
   m_pucDisparityDerivedDepth = NULL;
   m_pbUseDDD = NULL;
+#endif
 #endif
 }
@@ -298,9 +300,11 @@
   // create pattern memory
   m_pcPattern            = (TComPattern*)xMalloc(TComPattern, 1);
-  
+
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
   m_pucDisparityDerivedDepth         = (UChar*  )xMalloc( UChar,  uiNumPartition);
   m_pbUseDDD                         = (Bool*  ) xMalloc( Bool,   uiNumPartition);
 #endif 
+#endif
 
   // create motion vector fields
@@ -386,7 +390,9 @@
 #endif
 
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
     if ( m_pucDisparityDerivedDepth ) { xFree(m_pucDisparityDerivedDepth);          m_pucDisparityDerivedDepth        = NULL; }
     if ( m_pbUseDDD                 ) { xFree(m_pbUseDDD);                          m_pbUseDDD                        = NULL; }
+#endif
 #endif
 
@@ -518,9 +524,10 @@
 #endif
 
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
     m_pucDisparityDerivedDepth[ui] = pcFrom->m_pucDisparityDerivedDepth[ui];
     m_pbUseDDD[ui] = pcFrom->m_pbUseDDD[ui];
 #endif
-
+#endif
     m_puhWidth  [ui] = pcFrom->getWidth(ui);
     m_puhHeight [ui] = pcFrom->getHeight(ui);
@@ -604,7 +611,9 @@
 #endif
 
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
     memset( m_pucDisparityDerivedDepth        + firstElement, 0,           numElements * sizeof( *m_pucDisparityDerivedDepth ) );
     memset( m_pbUseDDD                        + firstElement, 0,           numElements * sizeof( *m_pbUseDDD ) );
+#endif
 #endif
 
@@ -784,7 +793,9 @@
 #endif
 
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
       m_pucDisparityDerivedDepth[ui] = 0;
       m_pbUseDDD[ui] = 0;
+#endif
 #endif
 
@@ -893,7 +904,9 @@
 #endif
 
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
   memset( m_pucDisparityDerivedDepth,         0, iSizeInUchar );
   memset( m_pbUseDDD,                         0, iSizeInBool );
+#endif
 #endif
 
@@ -990,7 +1003,9 @@
 #endif
 
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
       m_pucDisparityDerivedDepth[ui] = pcCU->m_pucDisparityDerivedDepth[uiPartOffset+ui];
       m_pbUseDDD[ui]                 = pcCU->m_pbUseDDD[uiPartOffset+ui];
+#endif
 #endif
 
@@ -1139,7 +1154,9 @@
 #endif
 
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
   m_pucDisparityDerivedDepth          = pcCU->getDDDepth()        + uiPart;
   m_pbUseDDD                          = pcCU->getUseDDD()         + uiPart;
+#endif
 #endif
 
@@ -1292,7 +1309,9 @@
 #endif
 
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
   m_pucDisparityDerivedDepth         = pcCU->getDDDepth()              + uiAbsPartIdx;
   m_pbUseDDD                         = pcCU->getUseDDD()              + uiAbsPartIdx;
+#endif
 #endif
     
@@ -1360,8 +1379,10 @@
   memcpy( m_puhCbf[1] + uiOffset, pcCU->getCbf(TEXT_CHROMA_U), iSizeInUchar );
   memcpy( m_puhCbf[2] + uiOffset, pcCU->getCbf(TEXT_CHROMA_V), iSizeInUchar );
-  
+
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
   memcpy( m_pucDisparityDerivedDepth          + uiOffset, pcCU->getDDDepth(),         iSizeInUchar );
   memcpy( m_pbUseDDD                          + uiOffset, pcCU->getUseDDD(),          iSizeInBool );
+#endif
 #endif
 
@@ -1464,7 +1485,9 @@
 #endif
 
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
   memcpy( rpcCU->getDDDepth()          + m_uiAbsIdxInLCU, m_pucDisparityDerivedDepth,         iSizeInUchar  );
   memcpy( rpcCU->getUseDDD()           + m_uiAbsIdxInLCU, m_pbUseDDD,                         iSizeInBool  );
+#endif
 #endif
 
@@ -1600,8 +1623,10 @@
   memcpy( rpcCU->getCbf(TEXT_CHROMA_U) + uiPartOffset, m_puhCbf[1], iSizeInUchar );
   memcpy( rpcCU->getCbf(TEXT_CHROMA_V) + uiPartOffset, m_puhCbf[2], iSizeInUchar );
-  
+
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
   memcpy( rpcCU->getDDDepth()          + uiPartOffset, m_pucDisparityDerivedDepth,         iSizeInUchar );
   memcpy( rpcCU->getUseDDD()           + uiPartOffset, m_pbUseDDD,                         iSizeInBool );
+#endif
 #endif
 
@@ -1671,4 +1696,5 @@
 }
 
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
 Void TComDataCU::setDDDepthSubParts ( UChar ucDDD, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
@@ -1687,4 +1713,5 @@
 }
 
+#endif
 #endif
 
@@ -2398,5 +2425,9 @@
     Bool depthRefineFlag = false;
 #if H_3D_NBDV_REF
+#if HHI_TOOL_PARAMETERS_I2_J0107
+    depthRefineFlag = m_pcSlice->getDepthRefinementFlag(  );
+#else
     depthRefineFlag = m_pcSlice->getVPS()->getDepthRefinementFlag( m_pcSlice->getLayerIdInVps() );
+#endif
 #endif // H_3D_NBDV_REF
     
@@ -3309,5 +3340,9 @@
 inline Bool TComDataCU::xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount)
 {
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  if ( m_pcSlice->getViewIndex() == 0 || !m_pcSlice->getViewSynthesisPredFlag( ) || m_pcSlice->getIsDepth() || pDInfo->m_aVIdxCan == -1)
+#else
   if ( m_pcSlice->getViewIndex() == 0 || !m_pcSlice->getVPS()->getViewSynthesisPredFlag( m_pcSlice->getLayerIdInVps() ) || m_pcSlice->getIsDepth() || pDInfo->m_aVIdxCan == -1)
+#endif
   {
     return false;
@@ -3864,5 +3899,7 @@
 )
 {
+#if !SEC_A1_BASED_VSP_J0039
   UInt uiAbsPartAddr = m_uiAbsIdxInLCU + uiAbsPartIdx;
+#endif
 #if H_3D_IV_MERGE
   ////////////////////////////
@@ -3877,6 +3914,8 @@
   UChar tmpDir;
 
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
   m_iUseDDDCandIdx = -1;
+#endif
 #endif
 
@@ -3919,5 +3958,9 @@
   deriveLeftBottomIdxGeneral  ( uiAbsPartIdx, uiPUIdx, uiPartIdxLB );
 #if H_3D
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  Bool bMPIFlag   = getSlice()->getMpiFlag(); 
+#else
   Bool bMPIFlag   = getSlice()->getVPS()->getMPIFlag( getSlice()->getLayerIdInVps() );
+#endif
   Bool bIsDepth = getSlice()->getIsDepth();
 #endif 
@@ -3979,7 +4022,9 @@
 
   // above
+#if !SEC_A1_BASED_VSP_J0039
   UInt uiAbovePartIdx = 0;
   TComDataCU* pcCUAbove = 0;
   pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT );
+#endif
 
   if (getAvailableFlagB1())
@@ -3988,4 +4033,7 @@
 #if H_3D_VSP
     ,
+#if SEC_A1_BASED_VSP_J0039
+      false
+#else
       ( ( ( getAddr() - pcCUAbove->getAddr() ) == 0) && (pcCUAbove->getVSPFlag(uiAbovePartIdx) != 0) 
 #if H_3D_IC
@@ -4000,4 +4048,5 @@
       )
 #endif
+#endif
       , false
       ); 
@@ -4006,7 +4055,9 @@
 
   // above right
+#if !SEC_A1_BASED_VSP_J0039
   UInt uiAboveRightPartIdx = 0;
   TComDataCU* pcCUAboveRight = 0;
   pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT );
+#endif
 
   if (getAvailableFlagB0())
@@ -4015,4 +4066,7 @@
 #if H_3D_VSP
     ,
+#if SEC_A1_BASED_VSP_J0039
+      false
+#else
       ( ( ( getAddr() - pcCUAboveRight->getAddr() ) == 0) && (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) != 0) 
 #if H_3D_IC
@@ -4027,4 +4081,5 @@
       )
 #endif
+#endif
       , false
       ); 
@@ -4033,6 +4088,8 @@
 
   // left bottom
+#if !SEC_A1_BASED_VSP_J0039
   UInt uiLeftBottomPartIdx = 0;
   TComDataCU* pcCULeftBottom = getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB );
+#endif
 
   if (getAvailableFlagA0())
@@ -4041,4 +4098,7 @@
 #if H_3D_VSP
     ,
+#if SEC_A1_BASED_VSP_J0039
+      false
+#else
       (pcCULeftBottom->getVSPFlag(uiLeftBottomPartIdx) != 0
 #if H_3D_IC
@@ -4053,4 +4113,5 @@
       )
 #endif
+#endif
       , false
       ); 
@@ -4059,7 +4120,9 @@
 
   // above left
+#if !SEC_A1_BASED_VSP_J0039
   UInt uiAboveLeftPartIdx = 0;
   TComDataCU* pcCUAboveLeft = 0;
   pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr );
+#endif
 
   if (getAvailableFlagB2())
@@ -4068,4 +4131,7 @@
 #if H_3D_VSP
     ,
+#if SEC_A1_BASED_VSP_J0039
+      false
+#else
       ( ( ( getAddr() - pcCUAboveLeft->getAddr() ) == 0) && (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) != 0) 
 #if H_3D_IC
@@ -4079,4 +4145,5 @@
 #endif
       )
+#endif
 #endif
       , false
@@ -4276,4 +4343,5 @@
     }
   }
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
   if( m_pcSlice->getIsDepth() && m_pcSlice->getViewIndex() != 0  && bMPIFlag )
@@ -4360,4 +4428,5 @@
   }
 #endif
+#endif
   /////////////////////////////////////////////////////////////////
   //////// DERIVE IvMC, IvMCShift,IvDCShift, IvDC  Candidates /////
@@ -4372,5 +4441,9 @@
   Int    ivCandDir   [4] = {0, 0, 0, 0};
 
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  Bool ivMvPredFlag   = getSlice()->getIvMvPredFlag();
+#else
   Bool ivMvPredFlag   = getSlice()->getVPS()->getIvMvPredFlag( getSlice()->getLayerIdInVps() );
+#endif
 
   ivMvPredFlag &= (nPSW + nPSH > 12);
@@ -4455,5 +4528,9 @@
 
 #if H_3D
+#if SEC_A1_BASED_VSP_J0039
+  iCount += m_mergCands[MRG_A1].m_bAvailable + m_mergCands[MRG_B1].m_bAvailable;
+#else
   iCount += m_mergCands[MRG_A1].m_bAvailable + m_mergCands[MRG_B1].m_bAvailable + m_mergCands[MRG_B0].m_bAvailable;
+#endif
 #else
   //left
@@ -4554,4 +4631,5 @@
 #endif
 
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
   // early termination
@@ -4561,4 +4639,47 @@
   }
 #endif
+#endif
+
+#if SEC_A1_BASED_VSP_J0039
+#if H_3D_VSP
+  /////////////////////////////////////////////////
+  //////// VIEW SYNTHESIS PREDICTION (VSP) ////////
+  /////////////////////////////////////////////////
+  if (iCount<getSlice()->getMaxNumMergeCand())
+  {
+    if (
+      (!getAvailableFlagA1() || !(pcCULeft->getVSPFlag(uiLeftPartIdx) != 0)) &&
+#if H_3D_IC
+      !bICFlag &&
+#endif
+#if H_3D_ARP
+      !bARPFlag &&
+#endif
+#if H_3D
+      (nPSW + nPSH > 12) &&
+#endif
+#if H_3D_DBBP
+      !bDBBPFlag &&
+#endif
+      xAddVspCand( mrgCandIdx, &cDisInfo, iCount ) )
+    {
+      return;
+    }
+
+    // early termination
+    if (iCount == getSlice()->getMaxNumMergeCand())
+    {
+      return;
+    }
+#endif
+#if H_3D_VSP
+  }
+#endif
+
+#if H_3D
+  iCount += m_mergCands[MRG_B0].m_bAvailable;
+#endif
+#endif
+
 
 #if H_3D_IV_MERGE 
@@ -4615,4 +4736,5 @@
 #endif // H_3D_IV_MERGE 
 
+#if !SEC_A1_BASED_VSP_J0039
 #if H_3D_VSP
   /////////////////////////////////////////////////
@@ -4648,4 +4770,5 @@
 #if H_3D
   }
+#endif
 #endif
 
@@ -5893,5 +6016,9 @@
     iScale = xGetDistScaleFactor( iCurrViewId, iCurrRefViewId, iColViewId, iColRefViewId );
 
+#if HHI_TOOL_PARAMETERS_I2_J0107
+    if ( iScale != 4096 && m_pcSlice->getIvMvScalingFlag( ) )
+#else
     if ( iScale != 4096 && m_pcSlice->getVPS()->getIvMvScalingFlag(getSlice()->getLayerIdInVps()) ) 
+#endif
     {
       rcMv = cColMv.scaleMv( iScale );
@@ -6076,4 +6203,24 @@
 
   TComMv cMv; 
+#if LGE_DEFAULT_DV_J0046
+  if ( getSlice()->getDefaultRefViewIdxAvailableFlag() )
+  {
+      Int iViewIdx = getSlice()->getDefaultRefViewIdx();
+      pDisp->m_aVIdxCan = iViewIdx;
+#if HHI_TOOL_PARAMETERS_I2_J0107
+      Int iDisp     = getSlice()->getDepthToDisparityB( iViewIdx )[ (Int64) (1 << ( getSlice()->getSPS()->getBitDepthY() - 1 )) ];
+#else
+      Int iDisp     = getSlice()->getDepthToDisparityB( iViewIdx )[ 1 << ( getSlice()->getSPS()->getBitDepthY() - 1 ) ];
+#endif
+
+      cMv.setHor(iDisp);
+      cMv.setVer(0);
+      pDisp->m_acNBDV = cMv;
+      pDisp->m_aVIdxCan = iViewIdx;
+
+      return true;
+  }
+  return false;
+#else
 #if MTK_I0093
   Int iDisp     = getSlice()->getDepthToDisparityB( 0 )[ (Int64) (1 << ( getSlice()->getSPS()->getBitDepthY() - 1 )) ];
@@ -6087,4 +6234,5 @@
 
   return true;
+#endif
 }
 #endif
@@ -6118,4 +6266,5 @@
     }
     break;
+#if !SINGLE_DEPTH_SIMP_J0115
   case 2: // Above
     if(yP != 0)
@@ -6139,4 +6288,5 @@
     }
     break;
+#endif
   default:
       break;
@@ -6177,5 +6327,9 @@
   }
 #if H_3D_NBDV_REF
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  if( !m_pcSlice->getDepthRefinementFlag( ) )
+#else
   if( !m_pcSlice->getVPS()->getDepthRefinementFlag( m_pcSlice->getLayerIdInVps() ) )
+#endif
   {
     bDepthRefine = false;
@@ -6338,4 +6492,37 @@
   pDInfo->m_acNBDV = defaultDV;
 
+#if LGE_DEFAULT_DV_J0046
+  if (getSlice()->getDefaultRefViewIdxAvailableFlag())
+  {
+      pDInfo->m_aVIdxCan = getSlice()->getDefaultRefViewIdx();
+
+#if H_3D_NBDV_REF
+          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);
+#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 LGE_SIMP_DISP_AVAIL_J0041
+      return true;
+#endif
+  }
+#else
   Int valid = 0;
   Int viewIndex = 0;
@@ -6389,5 +6576,9 @@
     pDInfo->m_acDoNBDV = defaultDV;
 #endif
-  }
+#if LGE_SIMP_DISP_AVAIL_J0041
+    return true;
+#endif
+  }
+#endif
   return false; 
 }
@@ -6643,5 +6834,9 @@
   Bool depthRefineFlag = false; 
 #if H_3D_NBDV_REF
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  depthRefineFlag = m_pcSlice->getDepthRefinementFlag( ); 
+#else
   depthRefineFlag = m_pcSlice->getVPS()->getDepthRefinementFlag( m_pcSlice->getLayerIdInVps() ); 
+#endif
 #endif // H_3D_NBDV_REF
 
@@ -6701,4 +6896,7 @@
 Void TComDataCU::getSPPara(Int iPUWidth, Int iPUHeight, Int& iNumSP, Int& iNumSPInOneLine, Int& iSPWidth, Int& iSPHeight)
 {
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  Int iSubPUSize = ( getSlice()->getIsDepth() ? getSlice()->getMpiSubPbSize() : getSlice()->getSubPbSize() );
+#else
   Int iSubPUSize = 1<<getSlice()->getVPS()->getSubPULog2Size(getSlice()->getLayerId());
   if( getSlice()->getIsDepth() )
@@ -6706,9 +6904,17 @@
     iSubPUSize = 1<<getSlice()->getVPS()->getSubPUMPILog2Size(getSlice()->getLayerId());
   }
+#endif
 
   iNumSPInOneLine = iPUWidth/iSubPUSize;
+#if !HS_SP_SIMP_J0066
   iNumSPInOneLine = iNumSPInOneLine < 1 ? 1: iNumSPInOneLine;
+#endif
   Int iNumSPInOneColumn = iPUHeight/iSubPUSize;
+#if !HS_SP_SIMP_J0066
   iNumSPInOneColumn = iNumSPInOneColumn < 1 ? 1: iNumSPInOneColumn;
+#else
+  iNumSPInOneLine = (iPUHeight % iSubPUSize != 0 || iPUWidth % iSubPUSize != 0 ) ? 1 : iNumSPInOneLine;
+  iNumSPInOneColumn = (iPUHeight % iSubPUSize != 0  || iPUWidth % iSubPUSize != 0 ) ? 1 : iNumSPInOneColumn;
+#endif
   iNumSP = iNumSPInOneLine * iNumSPInOneColumn;
 
@@ -6784,5 +6990,9 @@
   Bool depthRefineFlag = false; 
 #if H_3D_NBDV_REF
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  depthRefineFlag = m_pcSlice->getDepthRefinementFlag( ); 
+#else
   depthRefineFlag = m_pcSlice->getVPS()->getDepthRefinementFlag( m_pcSlice->getLayerIdInVps() ); 
+#endif
 #endif // H_3D_NBDV_REF
 
Index: trunk/source/Lib/TLibCommon/TComDataCU.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComDataCU.h	(revision 1085)
+++ trunk/source/Lib/TLibCommon/TComDataCU.h	(revision 1124)
@@ -227,5 +227,5 @@
   DisInfo       m_cDefaultDisInfo;    ///< Default disparity information for initializing
 #endif
-
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
   UChar*        m_pucDisparityDerivedDepth;
@@ -234,5 +234,5 @@
   UChar         m_ucDDTmpDepth;
 #endif
-
+#endif
 #if H_3D_IV_MERGE
   TComMotionCand  m_mergCands[MRG_IVSHIFT+1];
@@ -743,4 +743,5 @@
   UInt          getCoefScanIdx(UInt uiAbsPartIdx, UInt uiWidth, Bool bIsLuma, Bool bIsIntra);
 
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
   UChar*       getDDDepth        ()                        { return m_pucDisparityDerivedDepth;        }
@@ -759,4 +760,5 @@
   Int          getUseDDDCandIdx(){ return m_iUseDDDCandIdx;}
 
+#endif
 #endif
 
Index: trunk/source/Lib/TLibCommon/TComPrediction.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComPrediction.cpp	(revision 1085)
+++ trunk/source/Lib/TLibCommon/TComPrediction.cpp	(revision 1124)
@@ -1158,4 +1158,5 @@
   pcCU->clipMv(cMv);
 
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
   if( pcCU->getUseDDD( uiPartAddr ) )
@@ -1193,4 +1194,5 @@
       //return;
   } else
+#endif
 #endif
 #if H_3D_ARP
@@ -1949,4 +1951,5 @@
     Int a, b, i, j;
     const Int iShift = IC_CONST_SHIFT;
+
     xGetLLSICPrediction( cu, mv, refPic, a, b, TEXT_CHROMA_U ); // Cb
     for ( i = 0; i < cxHeight; i++ )
@@ -2187,6 +2190,13 @@
       x += pRef[j];
       y += pRec[j];
-      xx += (pRef[j] * pRef[j])>>precShift;
-      xy += (pRef[j] * pRec[j])>>precShift;
+#if LGE_CHROMA_IC_J0050_J0034
+      if ( eType == TEXT_LUMA )
+      {
+#endif
+        xx += (pRef[j] * pRef[j])>>precShift;
+        xy += (pRef[j] * pRec[j])>>precShift;
+#if LGE_CHROMA_IC_J0050_J0034
+      }
+#endif
     }
     iCountShift += g_aucConvertToBit[ uiWidth ] + 1;
@@ -2217,8 +2227,13 @@
       x += pRef[0];
       y += pRec[0];
-
-      xx += (pRef[0] * pRef[0])>>precShift;
-      xy += (pRef[0] * pRec[0])>>precShift;
-
+#if LGE_CHROMA_IC_J0050_J0034
+      if ( eType == TEXT_LUMA )
+      {
+#endif
+        xx += (pRef[0] * pRef[0])>>precShift;
+        xy += (pRef[0] * pRec[0])>>precShift;
+#if LGE_CHROMA_IC_J0050_J0034
+      }
+#endif      
       pRef += iRefStride*2;
       pRec += iRecStride*2;
@@ -2234,4 +2249,13 @@
   }
 
+#if LGE_CHROMA_IC_J0050_J0034
+  if (  eType != TEXT_LUMA )
+  {
+    a = 32;
+    b = (  y - x + ( 1 << ( iCountShift - 1 ) ) ) >> iCountShift;
+  }
+  else
+  {
+#endif
   xy += xx >> IC_REG_COST_SHIFT;
   xx += xx >> IC_REG_COST_SHIFT;
@@ -2275,4 +2299,7 @@
     }
   }   
+#if LGE_CHROMA_IC_J0050_J0034
+  }
+#endif
 }
 #endif
Index: trunk/source/Lib/TLibCommon/TComRom.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComRom.cpp	(revision 1085)
+++ trunk/source/Lib/TLibCommon/TComRom.cpp	(revision 1124)
@@ -362,5 +362,9 @@
 const UChar g_dmm1TabIdxBits[6] =
 { //2x2   4x4   8x8 16x16 32x32 64x64
+#if MTK_DMM_SIM_J0035 
+     0,    7,   10,   9,    9,   13 };
+#else
      0,    7,   10,   11,   11,   13 };
+#endif
 
 const UChar g_dmm3IntraTabIdxBits[6] =
@@ -763,4 +767,14 @@
     }
 
+#if MTK_DMM_SIM_J0035
+    for( Int iK = 0; iK < uiBlockSize; iK += (uiWidth>=16 ?2:1))
+    {
+      for( Int iL = 0; iL < uiBlockSize; iL += ((uiWidth>=16 && uiOri<4)?2:1) )
+      {
+        cTempWedgelet.setWedgelet( uhStartX + (iK*iStepStartX) , uhStartY + (iK*iStepStartY), uhEndX + (iL*iStepEndX), uhEndY + (iL*iStepEndY), (UChar)uiOri, eWedgeRes, ((iL%2)==0 && (iK%2)==0) );
+        addWedgeletToList( cTempWedgelet, racWedgeList, racWedgeRefList );
+      }
+    }
+#else
     for( Int iK = 0; iK < uiBlockSize; iK++ )
     {
@@ -771,4 +785,5 @@
       }
     }
+#endif
   }
 
Index: trunk/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComSlice.cpp	(revision 1085)
+++ trunk/source/Lib/TLibCommon/TComSlice.cpp	(revision 1124)
@@ -179,4 +179,8 @@
   }
 #endif
+#if LGE_DEFAULT_DV_J0046
+  m_iDefaultRefViewIdx = -1;
+  m_bDefaultRefViewIdxAvailableFlag = false;
+#endif
 }
 
@@ -1874,4 +1878,9 @@
   m_vpsBaseLayerInternalFlag = true; 
   m_vpsBaseLayerAvailableFlag = true; 
+
+#if  H_MV_FIX_NUM_VIEWS
+  m_numViews = 0; 
+#endif
+
 #endif
 
@@ -1909,4 +1918,7 @@
   m_repFormatIdxPresentFlag = false; 
   m_maxOneActiveRefLayerFlag = false; 
+#if H_MV_HLS_FIX
+  m_vpsPocLsbAlignedFlag  = false; 
+#endif
   m_directDepTypeLenMinus2   = 0;         
   
@@ -1915,4 +1927,5 @@
   m_vpsNonVuiExtensionLength = 0;
   m_splittingFlag    = false;
+
   
   for( Int i = 0; i < MAX_NUM_SCALABILITY_TYPES; i++ )
@@ -1943,4 +1956,9 @@
     m_layerIdInNuh      [i] = ( i == 0 ) ? 0 : -1; 
     m_numDirectRefLayers[i] = 0; 
+#if HHI_DEPENDENCY_SIGNALLING_I1_J0107
+#if H_3D
+    m_numRefListLayers[i] = 0; 
+#endif
+#endif
     m_vpsRepFormatIdx    [i] = 0; 
     m_pocLsbNotPresentFlag[i] = 0;
@@ -1950,7 +1968,12 @@
 #if H_3D
     m_viewIndex         [i] = -1; 
+#if !HHI_TOOL_PARAMETERS_I2_J0107
     m_vpsDepthModesFlag [i] = false;
     m_ivMvScalingFlag[i] = true; 
     m_bIVPFlag [i]      = false;
+#if MTK_SINGLE_DEPTH_VPS_FLAG_J0060
+    m_singleDepthModeFlag[ i ] = false;
+#endif
+#endif
 #endif
 
@@ -1961,4 +1984,9 @@
       m_dependencyFlag  [i][j]    = false; 
       m_idDirectRefLayer[i][j]    = -1; 
+#if HHI_DEPENDENCY_SIGNALLING_I1_J0107
+#if H_3D
+      m_idRefListLayer[i][j]    = -1; 
+#endif
+#endif
       m_idPredictedLayer[i][j]    = -1; 
       m_idRefLayer      [i][j]    = -1; 
@@ -1971,11 +1999,14 @@
     }
 #if H_3D_ARP
+#if !HHI_TOOL_PARAMETERS_I2_J0107
     m_uiUseAdvResPred[i]  = 0;
     m_uiARPStepNum[i]     = 1;
 #endif
+#endif
   }
   m_vpsVUI = new TComVPSVUI; 
   m_dpbSize = new TComDpbSize; 
 
+#if !HHI_TOOL_PARAMETERS_I2_J0107
 #if H_3D
   for( Int i = 0; i < MAX_NUM_LAYERS; i++ )
@@ -2010,4 +2041,6 @@
   }  
 #endif
+#endif
+
 #endif
 }
@@ -2099,6 +2132,12 @@
     Int iNuhLId = getLayerIdInNuh( i );
     Int d = 0;
+#if HHI_DEPENDENCY_SIGNALLING_I1_J0107
+#if H_3D
+    Int l = 0; 
+#endif
+#endif
     Int r = 0;
     Int p = 0;
+
     for( Int j = 0; j  <=  getMaxLayersMinus1(); j++ )
     {
@@ -2108,4 +2147,13 @@
         m_idDirectRefLayer[iNuhLId][d++] = jNuhLid;
       }
+#if HHI_DEPENDENCY_SIGNALLING_I1_J0107
+#if H_3D
+      if( getDirectDependencyFlag( i , j ) && ( getDepthId( iNuhLId ) == getDepthId( jNuhLid ) ))
+      {
+        m_idRefListLayer [iNuhLId][l++] = jNuhLid;
+      }
+#endif
+#endif
+
       if( getDependencyFlag( i , j ) )
       {
@@ -2118,4 +2166,10 @@
     }
     m_numDirectRefLayers[ iNuhLId ] = d;
+#if HHI_DEPENDENCY_SIGNALLING_I1_J0107
+#if H_3D
+    m_numRefListLayers[ iNuhLId ] = l; 
+#endif
+#endif
+
     m_numRefLayers      [ iNuhLId ] = r;
     m_numPredictedLayers[ iNuhLId ] = p;
@@ -2152,4 +2206,43 @@
 
 
+#if H_MV_FIX_NUM_VIEWS
+Void     TComVPS::initNumViews( )
+{
+  m_numViews = 1; 
+#if HHI_VIEW_ID_LIST_I5_J0107
+#if H_3D
+  AOF( m_viewOIdxList.size() == 0 ); 
+  m_viewOIdxList.push_back( 0 );        
+#endif
+#endif
+
+  for( Int i = 0; i <=  getMaxLayersMinus1(); i++ )
+  {
+    Int lId = getLayerIdInNuh( i ); 
+    if( i > 0 )
+    {
+      Bool newViewFlag = true; 
+      for( Int j = 0; j < i; j++ )
+      {
+        if( getViewOrderIdx( lId )  ==  getViewOrderIdx( getLayerIdInNuh( j ) )  )
+        {
+          newViewFlag = false;
+        }
+      }
+      if( newViewFlag )
+      {
+        m_numViews++;
+#if HHI_VIEW_ID_LIST_I5_J0107
+#if H_3D
+        m_viewOIdxList.push_back( getViewOrderIdx( lId ) );        
+#endif
+#endif
+      }
+    }
+  }
+}
+#endif
+
+
 Int TComVPS::getScalabilityId( Int layerIdInVps, ScalabilityType scalType )
 {
@@ -2310,4 +2403,5 @@
 }
 
+#if !H_MV_FIX_NUM_VIEWS
 Int TComVPS::getNumViews()
 {
@@ -2321,7 +2415,7 @@
     }    
   }
-
   return numViews;
 }
+#endif
 
 
@@ -2562,4 +2656,10 @@
   xPrintArray( "IdRefLayer"      , getMaxLayersMinus1() + 1, m_layerIdInNuh, m_numRefLayers, m_idRefLayer, true );
   xPrintArray( "IdDirectRefLayer", getMaxLayersMinus1() + 1, m_layerIdInNuh, m_numDirectRefLayers, m_idDirectRefLayer, true );
+#if HHI_DEPENDENCY_SIGNALLING_I1_J0107
+#if H_3D
+  xPrintArray( "IdRefListLayer", getMaxLayersMinus1() + 1, m_layerIdInNuh, m_numRefListLayers, m_idRefListLayer, true );
+#endif
+#endif
+
   std::cout << std::endl;
 }
@@ -2984,4 +3084,7 @@
       i++;
     }
+#if SHARP_DLT_SIMP_J0029
+    iIdxUp = bFound ?  iIdxDown + 1 : iNumDepthValues-1;
+#else
     // iterate over indices to find upper closest depth
     i = iNumDepthValues-2;
@@ -3000,4 +3103,5 @@
     // assert monotony
     assert(iIdxDown<=iIdxUp);
+#endif
 
     // assign closer depth value/idx
@@ -3580,9 +3684,21 @@
 {
   TComVPS* vps = getVPS(); 
+#if HHI_DEPENDENCY_SIGNALLING_I1_J0107
+#if H_3D
+  Int refLayerIdx = vps->getLayerIdInVps( vps->getIdRefListLayer( getLayerId(), i ) ); 
+#else
   Int refLayerIdx = vps->getLayerIdInVps( vps->getIdDirectRefLayer( getLayerId(), i ) ); 
-
+#endif
+#else
+  Int refLayerIdx = vps->getLayerIdInVps( vps->getIdDirectRefLayer( getLayerId(), i ) ); 
+#endif
+
+#if H_MV_FIX_REF_LAYER_PIC_FLAG
+  Bool refLayerPicFlag = ( vps->getSubLayersVpsMaxMinus1( refLayerIdx ) >=  getTLayer()  && ( getTLayer() == 0   ||
+    vps->getMaxTidIlRefPicsPlus1( refLayerIdx, vps->getLayerIdInVps( getLayerId() )) > getTLayer() )); 
+#else
   Bool refLayerPicFlag = ( vps->getSubLayersVpsMaxMinus1( refLayerIdx ) >=  getTLayer() )  && ( getTLayer() == 0  ) &&
     ( vps->getMaxTidIlRefPicsPlus1( refLayerIdx, vps->getLayerIdInVps( getLayerId() )) > getTLayer() ); 
-
+#endif
   return refLayerPicFlag;       
 }    
@@ -3592,5 +3708,13 @@
   Int refLayerPicIdc = -1; 
   Int curj = 0; 
+#if HHI_DEPENDENCY_SIGNALLING_I1_J0107
+#if H_3D
+  for( Int i = 0;  i < getVPS()->getNumRefListLayers( getLayerId()) ; i++ )
+#else
   for( Int i = 0;  i < getVPS()->getNumDirectRefLayers( getLayerId()) ; i++ )
+#endif
+#else
+  for( Int i = 0;  i < getVPS()->getNumDirectRefLayers( getLayerId()) ; i++ )
+#endif
   {
     if( getRefLayerPicFlag( i ) )
@@ -3613,5 +3737,13 @@
 {  
   Int numRefLayerPics = 0; 
+#if HHI_DEPENDENCY_SIGNALLING_I1_J0107
+#if H_3D
+  for( Int i = 0;  i < getVPS()->getNumRefListLayers( getLayerId()) ; i++ )
+#else
   for( Int i = 0;  i < getVPS()->getNumDirectRefLayers( getLayerId()) ; i++ )
+#endif
+#else
+  for( Int i = 0;  i < getVPS()->getNumDirectRefLayers( getLayerId()) ; i++ )
+#endif
   {
     numRefLayerPics += getRefLayerPicFlag( i ); 
@@ -3638,5 +3770,13 @@
     numActiveRefLayerPics = 0; 
   }
+#if HHI_DEPENDENCY_SIGNALLING_I1_J0107
+#if H_3D
+  else if( getVPS()->getMaxOneActiveRefLayerFlag() || getVPS()->getNumRefListLayers( getLayerId() ) == 1 )
+#else
   else if( getVPS()->getMaxOneActiveRefLayerFlag() || getVPS()->getNumDirectRefLayers( getLayerId() ) == 1 )
+#endif
+#else
+  else if( getVPS()->getMaxOneActiveRefLayerFlag() || getVPS()->getNumDirectRefLayers( getLayerId() ) == 1 )
+#endif  
   {
     numActiveRefLayerPics = 1; 
@@ -3651,6 +3791,47 @@
 Int TComSlice::getRefPicLayerId( Int i )
 {
+#if HHI_DEPENDENCY_SIGNALLING_I1_J0107
+#if H_3D
+  return getVPS()->getIdRefListLayer( getLayerId(), getInterLayerPredLayerIdc( i ) );
+#else
   return getVPS()->getIdDirectRefLayer( getLayerId(), getInterLayerPredLayerIdc( i ) );
-}
+#endif
+#else
+  return getVPS()->getIdDirectRefLayer( getLayerId(), getInterLayerPredLayerIdc( i ) );
+#endif
+}
+
+#if SEC_ARP_VIEW_REF_CHECK_J0037 || SEC_DBBP_VIEW_REF_CHECK_J0037
+Void TComSlice::setDefaultRefView( )
+{
+  setDefaultRefViewIdx( -1 );
+  setDefaultRefViewIdxAvailableFlag( false ); 
+
+  Int valid = 0;
+  Int DefaultRefViewIdx = -1;
+  for( UInt curViewIdx = 0; curViewIdx < getViewIndex() && valid == 0; curViewIdx++ )
+  {
+    for( Int iRefListId = 0; ( iRefListId < (isInterB() ? 2 : 1) ) && !isIntra() && valid == 0; iRefListId++ )
+    {
+      RefPicList eRefPicList = RefPicList( iRefListId );
+      Int        iNumRefPics = getNumRefIdx( eRefPicList );
+      for( Int i = 0; i < iNumRefPics; i++ )
+      { 
+        if(getPOC() == getRefPic( eRefPicList, i )->getPOC() && curViewIdx == getRefPic( eRefPicList, i )->getViewIndex())
+        {
+          valid = 1;
+          DefaultRefViewIdx = curViewIdx;
+          break;
+        }
+      }
+    }
+  }
+  if( valid )
+  {
+    setDefaultRefViewIdx( DefaultRefViewIdx );
+    setDefaultRefViewIdxAvailableFlag( true );   
+  }
+}
+#endif
 
 #if H_3D_ARP
@@ -3658,5 +3839,9 @@
 {
   Bool tempRefPicInListsFlag = false;
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  if( !getIvResPredFlag() || this->isIRAP())
+#else
   if(!getVPS()->getUseAdvRP(getLayerId()) || this->isIRAP())
+#endif
   {
     m_nARPStepNum = 0;
@@ -3686,6 +3871,14 @@
       }
     }
+#if SEC_ARP_VIEW_REF_CHECK_J0037
+    tempRefPicInListsFlag = (getFirstTRefIdx(REF_PIC_LIST_0) >= 0 || getFirstTRefIdx(REF_PIC_LIST_1) >= 0) && getDefaultRefViewIdxAvailableFlag();
+#else
     tempRefPicInListsFlag = getFirstTRefIdx(REF_PIC_LIST_0) >= 0 || getFirstTRefIdx(REF_PIC_LIST_1) >= 0;
+#endif
+#if HHI_TOOL_PARAMETERS_I2_J0107
+    m_nARPStepNum = tempRefPicInListsFlag ?  H_3D_ARP_WFNR : 0;
+#else
     m_nARPStepNum = tempRefPicInListsFlag ? getVPS()->getARPStepNum(getLayerId()) : 0;
+#endif
   }
 
@@ -3869,18 +4062,31 @@
 { 
   Bool setupLUT = false; 
+  
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  setupLUT = setupLUT || getViewSynthesisPredFlag( ); 
+#else
   Int layerIdInVPS = getVPS()->getLayerIdInNuh( m_layerId ); 
-
 #if H_3D_VSP
   setupLUT = setupLUT || getVPS()->getViewSynthesisPredFlag( layerIdInVPS); 
 #endif
+#endif
 
 #if H_3D_NBDV_REF
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  setupLUT = setupLUT || getDepthRefinementFlag( );
+#else
   setupLUT = setupLUT || getVPS()->getDepthRefinementFlag( layerIdInVPS );
+#endif
 #endif 
 
 #if H_3D_IV_MERGE
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  setupLUT = setupLUT || ( getIvMvPredFlag() && getIsDepth() );
+#else
   setupLUT = setupLUT || ( getVPS()->getIvMvPredFlag(layerIdInVPS ) && getIsDepth() );
 #endif
-
+#endif
+
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
 #if H_3D_FCO
@@ -3896,4 +4102,5 @@
   }  
 #endif 
+#endif
 
   if( !setupLUT )
@@ -3944,13 +4151,15 @@
       m_depthToDisparityF[ i ][ d ] = ( invCodScale[ i ] * d + invOffset ) >> log2Div; 
     }
-
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
     initializeDDDPara( vps->getCamParPrecision(), codScale[ i ], codOffset[ i ], i );
 #endif
-  }
-}
-#endif
-#endif
-
+#endif
+  }
+}
+#endif
+#endif
+
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
 Void TComSlice::initializeDDDPara( UInt uiCamParsCodedPrecision, Int  iCodedScale,Int  iCodedOffset, Int iBaseViewIdx )
@@ -4015,4 +4224,5 @@
 
 #endif
+#endif
 
 #if H_MV
@@ -4048,4 +4258,5 @@
 #endif
 
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DBBP
 Int TComSlice::getDepthFromDV( Int iDV, Int iBaseViewIdx )
@@ -4054,4 +4265,105 @@
 }
 #endif
+#endif
+
+#if HHI_TOOL_PARAMETERS_I2_J0107
+#if H_3D
+
+Void TComSlice::init3dToolParameters()
+{
+  Bool depthFlag = getIsDepth();
+
+  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                                    ;                               
+  m_intraSingleFlag        = sps3dExt->getIntraSingleFlag      ( depthFlag ) && lidG0                                    ;                          
+
+  m_subPbSize              = lidG0 ? ( 1 << ( sps3dExt->getLog2SubPbSizeMinus3   ( depthFlag ) + 3 ) ) : getSPS()->getMaxCUWidth();  
+  m_mpiSubPbSize           = 1 << ( sps3dExt->getLog2MpiSubPbSizeMinus3( depthFlag ) + 3 );
+
+#if H_3D_OUTPUT_ACTIVE_TOOLS
+  std::cout << "Layer:                  :" << getLayerId()             << std::endl;
+  std::cout << "DepthFlag:              :" << getIsDepth()             << std::endl;
+  std::cout << "ViewOrderIdx:           :" << getViewIndex()           << std::endl;
+  std::cout << "DepthOfRefViewsAvailFlag:" << depthOfRefViewsAvailFlag << std::endl;
+  std::cout << "TextOfCurViewAvailFlag  :" << textOfCurViewAvailFlag   << std::endl;
+  
+  std::cout << "ivMvPredFlag            :" << m_ivMvPredFlag           << std::endl;
+  std::cout << "ivMvScalingFlag         :" << m_ivMvScalingFlag        << std::endl;
+  std::cout << "ivResPredFlag           :" << m_ivResPredFlag          << std::endl;
+  std::cout << "depthRefinementFlag     :" << m_depthRefinementFlag    << std::endl;
+  std::cout << "viewSynthesisPredFlag   :" << m_viewSynthesisPredFlag  << std::endl;
+  std::cout << "depthBasedBlkPartFlag   :" << m_depthBasedBlkPartFlag  << std::endl;
+  std::cout << "mpiFlag                 :" << m_mpiFlag                << std::endl;
+  std::cout << "intraContourFlag        :" << m_intraContourFlag       << std::endl;
+  std::cout << "intraSdcWedgeFlag       :" << m_intraSdcWedgeFlag      << std::endl;
+  std::cout << "qtPredFlag              :" << m_qtPredFlag             << std::endl;
+  std::cout << "interSdcFlag            :" << m_interSdcFlag           << std::endl;
+  std::cout << "intraSingleFlag         :" << m_intraSingleFlag        << std::endl;    
+  std::cout << "subPbSize               :" << m_subPbSize              << std::endl;
+  std::cout << "mpiSubPbSize            :" << m_mpiSubPbSize           << std::endl;
+#endif
+}
+#endif
+#endif
+
 
 /** get scaling matrix from RefMatrixID
Index: trunk/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComSlice.h	(revision 1085)
+++ trunk/source/Lib/TLibCommon/TComSlice.h	(revision 1124)
@@ -861,5 +861,5 @@
   TComRepFormat* m_repFormat             [MAX_NUM_LAYERS]; 
   Bool        m_maxOneActiveRefLayerFlag;       
-#if H_MV_HLS7_GEN
+#if H_MV_HLS7_GEN || H_MV_HLS_FIX
   Bool        m_vpsPocLsbAlignedFlag;
 #endif
@@ -884,6 +884,16 @@
   Int         m_dependencyFlag           [MAX_NUM_LAYERS][MAX_NUM_LAYERS]; 
 
+#if H_MV_FIX_NUM_VIEWS
+  Int         m_numViews; 
+#endif
   Int         m_numDirectRefLayers       [MAX_NUM_LAYERS];
   Int         m_idDirectRefLayer         [MAX_NUM_LAYERS][MAX_NUM_LAYERS];  
+#if HHI_DEPENDENCY_SIGNALLING_I1_J0107
+#if H_3D
+  Int         m_numRefListLayers         [MAX_NUM_LAYERS];
+  Int         m_idRefListLayer           [MAX_NUM_LAYERS][MAX_NUM_LAYERS];  
+#endif
+#endif
+
 
   Int         m_numRefLayers             [MAX_NUM_LAYER_IDS]; 
@@ -909,4 +919,5 @@
   Void        xSetRefLayerFlags( Int currLayerId );
   // VPS EXTENSION 2 SYNTAX ELEMENTS
+#if !HHI_TOOL_PARAMETERS_I2_J0107
 #if H_3D_ARP
   UInt        m_uiUseAdvResPred          [MAX_NUM_LAYERS   ];
@@ -934,4 +945,5 @@
   Bool        m_bIVPFlag                 [MAX_NUM_LAYERS   ];
 #endif
+#endif
 #if H_3D
   UInt        m_uiCamParPrecision;
@@ -940,5 +952,13 @@
   Int         ***m_aaaiCodedScale ;
   Int         ***m_aaaiCodedOffset;
-#endif
+
+#if H_MV_FIX_NUM_VIEWS
+#if HHI_VIEW_ID_LIST_I5_J0107
+  std::vector<Int>  m_viewOIdxList;
+#endif
+#endif
+
+#endif
+#if !HHI_TOOL_PARAMETERS_I2_J0107
 #if H_3D_INTER_SDC
   Bool        m_bInterSDCFlag[MAX_NUM_LAYERS   ];
@@ -949,4 +969,8 @@
 #if H_3D_IV_MERGE
   Bool        m_bMPIFlag[MAX_NUM_LAYERS   ];
+#endif
+#if MTK_SINGLE_DEPTH_VPS_FLAG_J0060
+  Bool        m_singleDepthModeFlag    [ MAX_NUM_LAYERS ];
+#endif
 #endif
 
@@ -1135,5 +1159,5 @@
   Bool    getMaxOneActiveRefLayerFlag( )                                   { return m_maxOneActiveRefLayerFlag; } 
 
-#if H_MV_HLS7_GEN
+#if H_MV_HLS7_GEN || H_MV_HLS_FIX
   Void    setVpsPocLsbAlignedFlag( Bool flag )                             { m_vpsPocLsbAlignedFlag = flag; } 
   Bool    getVpsPocLsbAlignedFlag(  )                                      { return m_vpsPocLsbAlignedFlag; } 
@@ -1172,17 +1196,43 @@
   Void    setRefLayers(); 
 
+#if H_MV_FIX_NUM_VIEWS
+  // To be aligned with spec naming, getViewIndex will be removed in future versions
+  Int     getViewOrderIdx ( Int layerIdInNuh )                             { return getScalabilityId( getLayerIdInVps(layerIdInNuh), VIEW_ORDER_INDEX  ); }    
+  Int     getViewIndex    ( Int layerIdInNuh )                             { return getViewOrderIdx( layerIdInNuh ); }    
+#else
   Int     getViewIndex    ( Int layerIdInNuh )                             { return getScalabilityId( getLayerIdInVps(layerIdInNuh), VIEW_ORDER_INDEX  ); }    
+#endif
   Int     getAuxId        ( Int layerIdInNuh )                             { return getScalabilityId( getLayerIdInVps(layerIdInNuh), AUX_ID  ); }    
   Int     getDependencyId ( Int layerIdInNuh )                             { return getScalabilityId( getLayerIdInVps(layerIdInNuh), DEPENDENCY_ID  ); }    
+#if H_MV_FIX_NUM_VIEWS
+  Int     getNumViews()                                                    { return m_numViews; }
+  Void    initNumViews();
+#if HHI_VIEW_ID_LIST_I5_J0107
+  Int     getViewOIdxList( Int i )                                         { return m_viewOIdxList[i]; }
+#endif
+#else
   Int     getNumViews();
+#endif
 
   Bool    getDependencyFlag( Int i, Int j )                                { return m_dependencyFlag[i][j]; }
   Int     getNumDirectRefLayers( Int layerIdInNuh )                        { return m_numDirectRefLayers[ layerIdInNuh ];  };                               
+#if HHI_DEPENDENCY_SIGNALLING_I1_J0107
+#if H_3D
+  Int     getNumRefListLayers( Int layerIdInNuh )                         { return m_numRefListLayers[ layerIdInNuh ];  };                               
+#endif
+#endif
+
   Int     getNumRefLayers            ( Int i )        { return m_numRefLayers[i]; } 
   Int     getNumPredictedLayers      ( Int i )        { return m_numPredictedLayers[i]; } 
+
 
   Int     getIdRefLayer              ( Int i, Int j ) { assert( j >= 0 && j < getNumRefLayers      ( i )); return m_idRefLayer      [i][j]; } 
   Int     getIdPredictedLayer        ( Int i, Int j ) { assert( j >= 0 && j < getNumPredictedLayers( i )); return m_idPredictedLayer[i][j]; } 
   Int     getIdDirectRefLayer        ( Int i, Int j ) { assert( j >= 0 && j < getNumDirectRefLayers( i )); return m_idDirectRefLayer[i][j]; } 
+#if HHI_DEPENDENCY_SIGNALLING_I1_J0107
+#if H_3D
+  Int     getIdRefListLayer          ( Int i, Int j ) { assert( j >= 0 && j < getNumRefListLayers   ( i )); return m_idRefListLayer[i][j]; } 
+#endif
+#endif
   Int     getNumIndependentLayers    (  )             { return m_numIndependentLayers; } 
   Int     getNumLayersInTreePartition( Int i )        { return m_numLayersInTreePartition[i]; } 
@@ -1279,8 +1329,14 @@
 
   /// VPS EXTENSION 2 SYNTAX ELEMENTS
+
+
 #if H_3D  
   Int     getDepthId      ( Int layerIdInNuh)                             { return getScalabilityId( getLayerIdInVps(layerIdInNuh), DEPTH_ID ); }
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  Bool    getVpsDepthFlag( Int layerIdInNuh)                              { return (getDepthId( layerIdInNuh ) > 0);  }
+#endif
   Int     getLayerIdInNuh( Int viewIndex, Bool depthFlag );   
 
+#if !HHI_TOOL_PARAMETERS_I2_J0107
 #if H_3D_ARP
   UInt    getUseAdvRP  ( Int layerIdInVps )                                { return m_uiUseAdvResPred[layerIdInVps];    }
@@ -1288,4 +1344,5 @@
   Void    setUseAdvRP  ( Int layerIdInVps, UInt val )                      { m_uiUseAdvResPred[layerIdInVps] = val;     }
   Void    setARPStepNum( Int layerIdInVps, UInt val )                      { m_uiARPStepNum[layerIdInVps]    = val;     }
+#endif
 #endif
 
@@ -1303,4 +1360,5 @@
   Int* getInvCodedOffset     ( Int viewIndex )  { return m_aaaiCodedOffset[viewIndex][1]; }
 
+#if !HHI_TOOL_PARAMETERS_I2_J0107
 #if H_3D_IV_MERGE
   Void    setIvMvPredFlag     ( Int layerIdInVps, Bool val )  { m_ivMvPredFlag[ layerIdInVps ] = val; }
@@ -1346,5 +1404,10 @@
   Void    setMPIFlag      ( Int layerIdInVps, Bool bval ){ m_bMPIFlag[layerIdInVps] = bval; }
 #endif
+#if MTK_SINGLE_DEPTH_VPS_FLAG_J0060
+  Void    setSingleDepthModeFlag  ( Int layerIdInVps, Bool val )  { m_singleDepthModeFlag[ layerIdInVps ] = val; }
+  Bool    getSingleDepthModeFlag  ( Int layerIdInVps )            { return m_singleDepthModeFlag[ layerIdInVps ]; }; 
+#endif
 #endif  
+#endif
 #endif
 };
@@ -1612,4 +1675,93 @@
 };
 
+#if HHI_TOOL_PARAMETERS_I2_J0107
+#if H_3D
+class TComSps3dExtension
+{
+public:
+  TComSps3dExtension()
+  {
+    for (Int d = 0; d < 2; d++)
+    {
+      m_ivMvPredFlag          [d] = false; 
+      m_ivMvScalingFlag       [d] = false; 
+      m_log2SubPbSizeMinus3   [d] = 3; 
+      m_ivResPredFlag         [d] = false; 
+      m_depthRefinementFlag   [d] = false; 
+      m_viewSynthesisPredFlag [d] = false; 
+      m_depthBasedBlkPartFlag [d] = false; 
+      m_mpiFlag               [d] = false; 
+      m_log2MpiSubPbSizeMinus3[d] = 3; 
+      m_intraContourFlag      [d] = false; 
+      m_intraSdcWedgeFlag     [d] = false; 
+      m_qtPredFlag            [d] = false; 
+      m_interSdcFlag          [d] = false; 
+      m_intraSingleFlag       [d] = false;   
+    }
+  }
+
+  Void setIvMvPredFlag( Int d, Bool flag ) { m_ivMvPredFlag[d] = flag; } 
+  Bool getIvMvPredFlag( Int d ) { return m_ivMvPredFlag[d]; } 
+
+  Void setIvMvScalingFlag( Int d, Bool flag ) { m_ivMvScalingFlag[d] = flag; } 
+  Bool getIvMvScalingFlag( Int d ) { return m_ivMvScalingFlag[d]; } 
+
+  Void setLog2SubPbSizeMinus3( Int d, Int  val ) { m_log2SubPbSizeMinus3[d] = val; } 
+  Int  getLog2SubPbSizeMinus3( Int d ) { return m_log2SubPbSizeMinus3[d]; } 
+
+  Void setIvResPredFlag( Int d, Bool flag ) { m_ivResPredFlag[d] = flag; } 
+  Bool getIvResPredFlag( Int d ) { return m_ivResPredFlag[d]; } 
+
+  Void setDepthRefinementFlag( Int d, Bool flag ) { m_depthRefinementFlag[d] = flag; } 
+  Bool getDepthRefinementFlag( Int d ) { return m_depthRefinementFlag[d]; } 
+
+  Void setViewSynthesisPredFlag( Int d, Bool flag ) { m_viewSynthesisPredFlag[d] = flag; } 
+  Bool getViewSynthesisPredFlag( Int d ) { return m_viewSynthesisPredFlag[d]; } 
+
+  Void setDepthBasedBlkPartFlag( Int d, Bool flag ) { m_depthBasedBlkPartFlag[d] = flag; } 
+  Bool getDepthBasedBlkPartFlag( Int d ) { return m_depthBasedBlkPartFlag[d]; } 
+
+  Void setMpiFlag( Int d, Bool flag ) { m_mpiFlag[d] = flag; } 
+  Bool getMpiFlag( Int d ) { return m_mpiFlag[d]; } 
+
+  Void setLog2MpiSubPbSizeMinus3( Int d, Int  val ) { m_log2MpiSubPbSizeMinus3[d] = val; } 
+  Int  getLog2MpiSubPbSizeMinus3( Int d ) { return m_log2MpiSubPbSizeMinus3[d]; } 
+
+  Void setIntraContourFlag( Int d, Bool flag ) { m_intraContourFlag[d] = flag; } 
+  Bool getIntraContourFlag( Int d ) { return m_intraContourFlag[d]; } 
+
+  Void setIntraSdcWedgeFlag( Int d, Bool flag ) { m_intraSdcWedgeFlag[d] = flag; } 
+  Bool getIntraSdcWedgeFlag( Int d ) { return m_intraSdcWedgeFlag[d]; } 
+
+  Void setQtPredFlag( Int d, Bool flag ) { m_qtPredFlag[d] = flag; } 
+  Bool getQtPredFlag( Int d ) { return m_qtPredFlag[d]; } 
+
+  Void setInterSdcFlag( Int d, Bool flag ) { m_interSdcFlag[d] = flag; } 
+  Bool getInterSdcFlag( Int d ) { return m_interSdcFlag[d]; } 
+
+  Void setIntraSingleFlag( Int d, Bool flag ) { m_intraSingleFlag[d] = flag; } 
+  Bool getIntraSingleFlag( Int d ) { return m_intraSingleFlag[d]; } 
+
+private:
+
+  Bool        m_ivMvPredFlag          [2];
+  Bool        m_ivMvScalingFlag       [2];
+  Int         m_log2SubPbSizeMinus3   [2];
+  Bool        m_ivResPredFlag         [2];
+  Bool        m_depthRefinementFlag   [2];
+  Bool        m_viewSynthesisPredFlag [2];
+  Bool        m_depthBasedBlkPartFlag [2];
+  Bool        m_mpiFlag               [2];
+  Int         m_log2MpiSubPbSizeMinus3[2];
+  Bool        m_intraContourFlag      [2];
+  Bool        m_intraSdcWedgeFlag     [2];
+  Bool        m_qtPredFlag            [2];
+  Bool        m_interSdcFlag          [2];
+  Bool        m_intraSingleFlag       [2];  
+};
+
+#endif
+#endif
+
 /// SPS class
 class TComSPS
@@ -1711,4 +1863,7 @@
 #endif
 #if H_3D
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  TComSps3dExtension m_sps3dExtension; 
+#endif
   UInt        m_uiCamParPrecision;
   Bool        m_bCamParInSliceHeader;
@@ -1884,7 +2039,15 @@
   Void setSpsRepFormatIdx( Int  val )          { m_spsRepFormatIdx = val; } 
   Int  getSpsRepFormatIdx(  )                  { return m_spsRepFormatIdx; } 
-  // SPS Extension 
+  
+// SPS Extension 
   Void setInterViewMvVertConstraintFlag(Bool val) { m_interViewMvVertConstraintFlag = val; }
   Bool getInterViewMvVertConstraintFlag()         { return m_interViewMvVertConstraintFlag;}
+
+#if HHI_TOOL_PARAMETERS_I2_J0107
+#if H_3D
+  Void setSps3dExtension ( TComSps3dExtension& sps3dExtension ) { m_sps3dExtension = sps3dExtension; }
+  TComSps3dExtension* getSps3dExtension ( )                     { return &m_sps3dExtension; }
+#endif
+#endif
 
   // Inference 
@@ -2342,5 +2505,5 @@
 #endif
 #endif
-
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
   Int          m_aiDDDInvScale [MAX_NUM_LAYERS];
@@ -2348,4 +2511,5 @@
   UInt         m_aiDDDShift    [MAX_NUM_LAYERS];
 #endif
+#endif
 #if H_3D_SINGLE_DEPTH
   Bool      m_bApplySingleDepthMode;
@@ -2354,4 +2518,26 @@
   Int *m_aICEnableCandidate;
   Int *m_aICEnableNum;
+#endif
+#if LGE_DEFAULT_DV_J0046
+  Int       m_iDefaultRefViewIdx;
+  Bool      m_bDefaultRefViewIdxAvailableFlag;
+#endif
+
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  Bool m_ivMvPredFlag         ;
+  Bool m_ivMvScalingFlag      ;
+  Bool m_ivResPredFlag        ;
+  Bool m_depthRefinementFlag  ;
+  Bool m_viewSynthesisPredFlag;
+  Bool m_depthBasedBlkPartFlag;
+  Bool m_mpiFlag              ;
+  Bool m_intraContourFlag     ;
+  Bool m_intraSdcWedgeFlag    ;
+  Bool m_qtPredFlag           ;
+  Bool m_interSdcFlag         ;
+  Bool m_intraSingleFlag      ;
+
+  Int  m_mpiSubPbSize         ; 
+  Int  m_subPbSize            ; 
 #endif
 public:
@@ -2425,7 +2611,9 @@
   TComPic*  getTexturePic       ()                              { return  m_ivPicsCurrPoc[0][ m_viewIndex ]; }
 #endif
+#if !MTK_SINGLE_DEPTH_VPS_FLAG_J0060
 #if H_3D_SINGLE_DEPTH
   Void      setApplySingleDepthMode( Bool b )                                { m_bApplySingleDepthMode = b; }
   Bool      getApplySingleDepthMode()                                        { return m_bApplySingleDepthMode; }
+#endif
 #endif
 #if H_3D_IC
@@ -2665,6 +2853,8 @@
   Int* getDepthToDisparityB( Int refViewIdx ) { return m_depthToDisparityB[ refViewIdx ]; }; 
   Int* getDepthToDisparityF( Int refViewIdx ) { return m_depthToDisparityF[ refViewIdx ]; }; 
+#if !HHI_TOOL_PARAMETERS_I2_J0107
   Bool getVpsDepthModesFlag  ()  { return getVPS()->getVpsDepthModesFlag( getVPS()->getLayerIdInVps( m_layerId ) ); }
   Bool getIVPFlag       ()  { return getVPS()->getIVPFlag( getVPS()->getLayerIdInVps( m_layerId ) ); }
+#endif
 #endif
 #if H_3D_IC
@@ -2724,6 +2914,12 @@
   Int  getPocMsbVal(  ) { return m_pocMsbVal; } 
 
+#if H_MV_HLS_FIX
+  Bool getCraOrBlaPicFlag() { return ( getCraPicFlag() || getBlaPicFlag() ); } 
+  Bool getPocMsbValRequiredFlag() { return ( getCraOrBlaPicFlag() && ( getVPS()->getVpsPocLsbAlignedFlag() || getVPS()->getNumDirectRefLayers( getLayerIdInVps() ) == 0 ) );  }
+#else
   Bool getPocMsbValRequiredFlag() { return m_pocMsbValRequiredFlag; }
   Void setPocMsbValRequiredFlag(Bool x) { m_pocMsbValRequiredFlag = x; }
+#endif
+
 
   UInt getPocLsbValLen() { return getSPS()->getBitsForPOC(); }; //log2_max_pic_order_cnt_lsb_minus4 + 4  
@@ -2742,6 +2938,17 @@
   // Additional variables derived in slice header semantics 
 
+#if HHI_DEPENDENCY_SIGNALLING_I1_J0107
+#if H_3D
+  Int  getNumInterLayerRefPicsMinus1Len( ) { return gCeilLog2(  getVPS()->getNumRefListLayers( getLayerId() )); }
+  Int  getInterLayerPredLayerIdcLen    ( ) { return gCeilLog2(  getVPS()->getNumRefListLayers( getLayerId() )); }
+#else
   Int  getNumInterLayerRefPicsMinus1Len( ) { return gCeilLog2(  getVPS()->getNumDirectRefLayers( getLayerId() )); }
   Int  getInterLayerPredLayerIdcLen    ( ) { return gCeilLog2(  getVPS()->getNumDirectRefLayers( getLayerId() )); }
+#endif
+
+#else
+  Int  getNumInterLayerRefPicsMinus1Len( ) { return gCeilLog2(  getVPS()->getNumDirectRefLayers( getLayerId() )); }
+  Int  getInterLayerPredLayerIdcLen    ( ) { return gCeilLog2(  getVPS()->getNumDirectRefLayers( getLayerId() )); }
+#endif
 
   Int  getRefLayerPicFlag( Int i ); 
@@ -2759,10 +2966,46 @@
   TComPic* getPicFromRefPicSetInterLayer( Int setIdc, Int layerId );
 
+
+#if HHI_TOOL_PARAMETERS_I2_J0107
+#if H_3D
+  // 3D-HEVC tool parameters
+  Void init3dToolParameters();   
+  Bool getIvMvPredFlag           ( ) { return m_ivMvPredFlag           ; };
+  Bool getIvMvScalingFlag        ( ) { return m_ivMvScalingFlag        ; };
+  Bool getIvResPredFlag          ( ) { return m_ivResPredFlag          ; };
+  Bool getDepthRefinementFlag    ( ) { return m_depthRefinementFlag    ; };
+  Bool getViewSynthesisPredFlag  ( ) { return m_viewSynthesisPredFlag  ; };
+  Bool getDepthBasedBlkPartFlag  ( ) { return m_depthBasedBlkPartFlag  ; };
+  Bool getMpiFlag                ( ) { return m_mpiFlag                ; };
+  Bool getIntraContourFlag       ( ) { return m_intraContourFlag       ; };
+  Bool getIntraSdcWedgeFlag      ( ) { return m_intraSdcWedgeFlag      ; };
+  Bool getQtPredFlag             ( ) { return m_qtPredFlag             ; };
+  Bool getInterSdcFlag           ( ) { return m_interSdcFlag           ; };
+  Bool getIntraSingleFlag        ( ) { return m_intraSingleFlag        ; };
+
+  Int  getMpiSubPbSize           ( ) { return m_mpiSubPbSize           ; }; 
+  Int  getSubPbSize              ( ) { return m_subPbSize              ; }; 
+#endif
+#endif
+
+
   // Inference 
   Bool inferPocMsbValPresentFlag();  
 #endif
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
   Void initializeDDDPara( UInt uiCamParsCodedPrecision, Int  iCodedScale,Int  iCodedOffset, Int iBaseViewIdx );
   Int  getDepthFromDV( Int iDV, Int iBaseViewIdx );
+#endif
+#endif
+#if LGE_DEFAULT_DV_J0046
+  Int  getDefaultRefViewIdx() { return m_iDefaultRefViewIdx; }
+  Void setDefaultRefViewIdx(Int iViewIdx) { m_iDefaultRefViewIdx = iViewIdx; }
+
+  Bool getDefaultRefViewIdxAvailableFlag() { return m_bDefaultRefViewIdxAvailableFlag; }
+  Void setDefaultRefViewIdxAvailableFlag(Bool bViewIdx) { m_bDefaultRefViewIdxAvailableFlag = bViewIdx; }
+#endif
+#if SEC_ARP_VIEW_REF_CHECK_J0037 || SEC_DBBP_VIEW_REF_CHECK_J0037
+  Void setDefaultRefView( );
 #endif
 
Index: trunk/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- trunk/source/Lib/TLibCommon/TypeDef.h	(revision 1085)
+++ trunk/source/Lib/TLibCommon/TypeDef.h	(revision 1124)
@@ -103,4 +103,5 @@
                                               // MTK_NBDV_TN_FIX_E0172     fix the issue of DV derivation from the temporal neighboring blocks, issue 7 in JCT3V-E0172
                                               // MTK_TEXTURE_MRGCAND_BUGFIX_E0182  Bug fix for TEXTURE MERGING CANDIDATE     , JCT3V-E0182
+#define LGE_SIMP_DISP_AVAIL_J0041    1   // Use 2 status for disparity availability - DISP_AVAILABLE and DISP_NONE
 
 #define H_3D_ARP                          1   // Advanced residual prediction (ARP), JCT3V-D0177
@@ -114,4 +115,5 @@
                                               // 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 H_3D_IC                           1   // Illumination Compensation, JCT3V-B0045, JCT3V-C0046, JCT3V-D0060
@@ -154,4 +156,6 @@
                                               // NTT_STORE_SPDV_VSP_G0148 Storing Sub-PU based DV for VSP
                                               // Restricted bi-prediction for VSP
+#define SEC_A1_BASED_VSP_J0039            1   // Removal of redundant VSP in Merge list
+
 
 #define H_3D_IV_MERGE                     1   // Inter-view motion merge candidate
@@ -178,4 +182,5 @@
                                               // SEC_SIMP_SHIFTED_DV_I0086     Simplification of Shifted DV candidate, JCT3V-I0086
 
+#define MTK_MRG_LIST_SIZE_CLEANUP_J0059   1   // Include VSP for deriving merge candidate list size, JCT3V-J0059
 
 
@@ -231,5 +236,10 @@
 
 #define H_3D_SINGLE_DEPTH                 1   // Single depth mode proposed in JCT3V-I0095
-
+#define MTK_SINGLE_DEPTH_VPS_FLAG_J0060   1   // Add VPS control flags and remove slice header control flag for single depth, JCT3V-J0060
+#define ALIGN_J0060_J0107                 1   // Alignment of changed tool parameters
+#define ALGIN_J0107_J0059                 1   // Alignment of changed tool parameters                
+
+#define MTK_J0033                         1
+#define SHARP_DLT_SIMP_J0029              1   // DLT(DepthValue2Idx[]) table derivation cleanup
 
 #define H_3D_INTER_SDC                    1   // INTER SDC, Inter simplified depth coding
@@ -253,11 +263,12 @@
                                               // 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
-
+#define SEC_DBBP_VIEW_REF_CHECK_J0037     1   // Signaling dbbp_flag when the current slice has view reference picture(s), JCT3V-J0037 item4
 
 #define H_3D_DDD                          1   // Disparity derived depth coding
+#define LGE_DDD_REMOVAL_J0042_J0030       1   // DDD removal
 
 #define H_3D_FCO                          0   // Flexible coding order for 3D
 #if H_3D_FCO
-#define H_3D_FCO                     1
+#define H_3D_FCO                          1
 #endif
 
@@ -272,4 +283,5 @@
 #define H_3D_FAST_DEPTH_INTRA             1   // Fast DMM and RBC Mode Selection
                                               // SCU_HS_FAST_DEPTH_INTRA_E0238_HHIFIX
+#define MTK_DMM_SIM_J0035                 1
 #endif
 
@@ -288,7 +300,19 @@
 // Fixes
 
+
+#if H_3D
+#define HHI_DEPENDENCY_SIGNALLING_I1_J0107     1
+#define HHI_TOOL_PARAMETERS_I2_J0107           1
+#define HHI_VPS_3D_EXTENSION_I3_J0107          1
+#define HHI_VIEW_ID_LIST_I5_J0107              0
+#endif
+#define H_MV_FIX_REF_LAYER_PIC_FLAG            1
+#define H_MV_FIX_NUM_VIEWS                     1
+#define H_3D_OUTPUT_ACTIVE_TOOLS               0
+
 ///// ***** SINGLE DEPTH MODE *********
 #if H_3D_SINGLE_DEPTH
 #define SINGLE_DEPTH_MODE_CAND_LIST_SIZE            2 // size of the sample candidate list
+#define SINGLE_DEPTH_SIMP_J0115           1 
 #endif
 
@@ -307,4 +331,5 @@
 #define DVFROM_ABOVE                      1
 #define IDV_CANDS                         2
+#define LGE_DEFAULT_DV_J0046              1
 #endif
 
@@ -342,4 +367,5 @@
 #define IC_SHIFT_DIFF                     12
 #define IC_LOW_LATENCY_ENCODING_THRESHOLD 0.1 // Threshold for low-latency IC encoding in JCT3V-H0086
+#define LGE_CHROMA_IC_J0050_J0034         1
 #endif
 
@@ -363,8 +389,15 @@
 #endif
 
+
+#if H_3D_SPIVMP
+#define HS_SP_SIMP_J0066                        1
+#endif
+
 /////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////   MV_HEVC HLS  //////////////////////////////
 /////////////////////////////////////////////////////////////////////////////////
 // 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)
@@ -902,4 +935,18 @@
 enum DefaultMergCandOrder
 {
+#if SEC_A1_BASED_VSP_J0039
+  MRG_T = 0,            ///< MPI
+  MRG_D,                ///< DDD
+  MRG_IVMC,             ///< Temporal inter-view
+  MRG_A1,               ///< Left
+  MRG_B1,               ///< Above
+  MRG_VSP,              ///< VSP
+  MRG_B0,               ///< Above right
+  MRG_IVDC,             ///< Disparity inter-view
+  MRG_A0,               ///< Left bottom
+  MRG_B2,               ///< Above left
+  MRG_IVSHIFT,          ///< Shifted IVMC of Shifted IVDC. (These are mutually exclusive)
+  MRG_COL               ///< Temporal co-located
+#else
   MRG_T = 0,            ///< MPI
   MRG_D,                ///< DDD
@@ -914,4 +961,5 @@
   MRG_IVSHIFT,          ///< Shifted IVMC of Shifted IVDC. (These are mutually exclusive)
   MRG_COL               ///< Temporal co-located
+#endif
 };
 #endif
Index: trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 1085)
+++ trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 1124)
@@ -721,8 +721,12 @@
 }
 
+#if HHI_TOOL_PARAMETERS_I2_J0107
+Void TDecCavlc::parseSPS(TComSPS* pcSPS)
+#else
 #if H_3D
 Void TDecCavlc::parseSPS(TComSPS* pcSPS, Int viewIndex, Bool depthFlag )
 #else
 Void TDecCavlc::parseSPS(TComSPS* pcSPS)
+#endif
 #endif
 {
@@ -993,5 +997,9 @@
   if ( pcSPS->getSps3dExtensionFlag() )
   {
+#if HHI_TOOL_PARAMETERS_I2_J0107
+    parseSPS3dExtension( pcSPS ); 
+#else
     parseSPSExtension2( pcSPS, viewIndex, depthFlag  ); 
+#endif
   }
 
@@ -1020,8 +1028,39 @@
 
 #if H_3D
+#if HHI_TOOL_PARAMETERS_I2_J0107
+Void TDecCavlc::parseSPS3dExtension( TComSPS* pcSPS )
+{ 
+  TComSps3dExtension* sps3dExt = pcSPS->getSps3dExtension(); 
+  UInt uiCode; 
+  for( Int d = 0; d  <=  1; d++ )
+  {
+    READ_FLAG( uiCode, "iv_mv_pred_flag" ); sps3dExt->setIvMvPredFlag( d, uiCode == 1 );
+    READ_FLAG( uiCode, "iv_mv_scaling_flag" ); sps3dExt->setIvMvScalingFlag( d, uiCode == 1 );
+    if( d  ==  0 )
+    {
+      READ_UVLC( uiCode, "log2_sub_pb_size_minus3" ); sps3dExt->setLog2SubPbSizeMinus3( d, uiCode );
+      READ_FLAG( uiCode, "iv_res_pred_flag" ); sps3dExt->setIvResPredFlag( d, uiCode == 1 );
+      READ_FLAG( uiCode, "depth_refinement_flag" ); sps3dExt->setDepthRefinementFlag( d, uiCode == 1 );
+      READ_FLAG( uiCode, "view_synthesis_pred_flag" ); sps3dExt->setViewSynthesisPredFlag( d, uiCode == 1 );
+      READ_FLAG( uiCode, "depth_based_blk_part_flag" ); sps3dExt->setDepthBasedBlkPartFlag( d, uiCode == 1 );
+    }
+    else 
+    {
+      READ_FLAG( uiCode, "mpi_flag" ); sps3dExt->setMpiFlag( d, uiCode == 1 );
+      READ_UVLC( uiCode, "log2_mpi_sub_pb_size_minus3" ); sps3dExt->setLog2MpiSubPbSizeMinus3( d, uiCode );
+      READ_FLAG( uiCode, "intra_contour_flag" ); sps3dExt->setIntraContourFlag( d, uiCode == 1 );
+      READ_FLAG( uiCode, "intra_sdc_wedge_flag" ); sps3dExt->setIntraSdcWedgeFlag( d, uiCode == 1 );
+      READ_FLAG( uiCode, "qt_pred_flag" ); sps3dExt->setQtPredFlag( d, uiCode == 1 );
+      READ_FLAG( uiCode, "inter_sdc_flag" ); sps3dExt->setInterSdcFlag( d, uiCode == 1 );
+      READ_FLAG( uiCode, "intra_single_flag" ); sps3dExt->setIntraSingleFlag( d, uiCode == 1 );
+    }
+  }
+}
+#else
 Void TDecCavlc::parseSPSExtension2( TComSPS* pcSPS, Int viewIndex, Bool depthFlag )
 { 
 
 }
+#endif
 #endif
 
@@ -1032,5 +1071,48 @@
   READ_FLAG( uiCode, "pps_infer_scaling_list_flag" ); pcPPS->setPpsInferScalingListFlag( uiCode == 1 );
   READ_CODE( 6, uiCode, "pps_scaling_list_ref_layer_id" ); pcPPS->setPpsScalingListRefLayerId( uiCode );
+#if H_MV_HLS_FIX
+
+  UInt numRefLocOffsets;; 
+  READ_UVLC( numRefLocOffsets, "num_ref_loc_offsets" );
+
+  // All of the following stuff is not needed, but allowed to be present.
+  for (Int i = 0; i < numRefLocOffsets; i++ )
+  { 
+    Int   iCode = 0; 
+    READ_CODE( 6, uiCode, "ref_loc_offset_layer_id" ); 
+    READ_FLAG( uiCode, "scaled_ref_layer_offset_present_flag" );
+
+    if (uiCode)
+    {    
+      READ_SVLC( iCode, "scaled_ref_layer_left_offset" );   
+      READ_SVLC( iCode, "scaled_ref_layer_top_offset" );    
+      READ_SVLC( iCode, "scaled_ref_layer_right_offset" );  
+      READ_SVLC( iCode, "scaled_ref_layer_bottom_offset" ); 
+    }
+
+    READ_FLAG( uiCode, "ref_region_offset_present_flag" );  
+    if (uiCode)
+    {    
+      READ_SVLC( iCode, "ref_region_left_offset" );     
+      READ_SVLC( iCode, "ref_region_top_offset" );      
+      READ_SVLC( iCode, "ref_region_right_offset" );    
+      READ_SVLC( iCode, "ref_region_bottom_offset" );   
+    }
+
+    READ_FLAG( uiCode, "resample_phase_set_present_flag" );
+    if (uiCode)
+    {      
+      READ_UVLC( uiCode, "phase_hor_luma" );             
+      READ_UVLC( uiCode, "phase_ver_luma" );             
+      READ_UVLC( uiCode, "phase_hor_chroma_plus8" );     
+      READ_UVLC( uiCode, "phase_ver_chroma_plus8" );     
+    }
+  }
+  READ_FLAG( uiCode, "colour_mapping_enabled_flag" );   
+  // This is required to equal to 0 for Multiview Main profile. 
+  assert( uiCode == 0 ); 
+#else
   READ_UVLC( uiCode, "num_ref_loc_offsets" ); assert( uiCode == 0 );
+#endif
 }
 
@@ -1155,4 +1237,16 @@
     {
 #if H_3D
+#if HHI_VPS_3D_EXTENSION_I3_J0107
+      READ_FLAG( uiCode,  "vps_3d_extension_flag" );
+      if ( uiCode )
+      {
+        m_pcBitstream->readOutTrailingBits();
+        pcVPS->createCamPars(pcVPS->getNumViews());
+        parseVPS3dExtension( pcVPS );   
+      }
+      READ_FLAG( uiCode,  "vps_extension3_flag" );
+      if (uiCode)
+      {      
+#else
       m_pcBitstream->readOutTrailingBits();
       pcVPS->createCamPars(pcVPS->getNumViews());
@@ -1162,4 +1256,5 @@
       {      
 #endif
+#endif
 #endif  
         while ( xMoreRbspData() )
@@ -1234,4 +1329,8 @@
     }
   }
+
+#if H_MV_FIX_NUM_VIEWS
+  pcVPS->initNumViews(); 
+#endif
 
   READ_CODE( 4, uiCode, "view_id_len" ); pcVPS->setViewIdLen( uiCode );
@@ -1342,5 +1441,9 @@
   for( Int i = 1; i < pcVPS->getNumOutputLayerSets( ); i++ )
   {
+#if H_MV_HLS_FIX
+    if( pcVPS->getNumLayerSets() > 2 && i >= pcVPS->getNumLayerSets( ) )    
+#else
     if( i >= pcVPS->getNumLayerSets( ) )    
+#endif
     {        
       READ_CODE( pcVPS->getLayerSetIdxForOlsMinus1Len( i ), uiCode, "layer_set_idx_for_ols_minus1[i]" ); pcVPS->setLayerSetIdxForOlsMinus1( i, uiCode ); 
@@ -1413,5 +1516,6 @@
 
   READ_FLAG( uiCode, "max_one_active_ref_layer_flag" ); pcVPS->setMaxOneActiveRefLayerFlag ( uiCode == 1 ); 
-#if H_MV_HLS7_GEN
+
+#if H_MV_HLS7_GEN || H_MV_HLS_FIX
   READ_FLAG( uiCode, "vps_poc_lsb_aligned_flag" ); pcVPS->setVpsPocLsbAlignedFlag( uiCode == 1 );
 #endif
@@ -1463,4 +1567,7 @@
     parseVPSVUI( pcVPS ); 
   }     
+#if H_MV_HLS_FIX
+  else
+#endif
   {
     TComVPSVUI* pcVPSVUI = pcVPS->getVPSVUI( ); 
@@ -1838,7 +1945,13 @@
 
 #if H_3D
+#if HHI_VPS_3D_EXTENSION_I3_J0107
+Void TDecCavlc::parseVPS3dExtension( TComVPS* pcVPS )
+#else
 Void TDecCavlc::parseVPSExtension2( TComVPS* pcVPS )
+#endif
 {
   UInt uiCode; 
+
+#if !HHI_TOOL_PARAMETERS_I2_J0107
   for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ )
   {
@@ -1903,7 +2016,11 @@
             READ_FLAG( uiCode, "depth_inter_SDC_flag" );              pcVPS->setInterSDCFlag( i, uiCode ? true : false );
 #endif
-      }
-    }
-  }
+#if MTK_SINGLE_DEPTH_VPS_FLAG_J0060
+        READ_FLAG( uiCode, "single_depth_mode_flag[i]"); pcVPS->setSingleDepthModeFlag( i, uiCode == 1 ? true : false );        
+#endif
+      }
+    }
+  }
+#endif
 
   UInt uiCamParPrecision = 0; 
@@ -1912,6 +2029,12 @@
 
   READ_UVLC( uiCamParPrecision, "cp_precision" );
+#if HHI_VIEW_ID_LIST_I5_J0107
+  for (Int n = 1; n < pcVPS->getNumViews(); n++)
+  {
+    Int viewIndex = pcVPS->getViewOIdxList( n ); 
+#else
   for (UInt viewIndex=1; viewIndex<pcVPS->getNumViews(); viewIndex++)
   {
+#endif
     pcVPS->setCamParPresent         ( viewIndex, false );
     pcVPS->setHasCamParInSliceHeader( viewIndex, false );
@@ -1922,6 +2045,8 @@
       if ( !bCamParSlice )
       {
-        for( UInt uiBaseIndex = 0; uiBaseIndex < viewIndex; uiBaseIndex++ )
-        {
+#if HHI_VIEW_ID_LIST_I5_J0107
+        for( UInt m = 0; m < n; n++ )
+        {
+          Int uiBaseIndex = pcVPS->getViewOIdxList ( m ); 
           Int iCode; 
           READ_SVLC( iCode, "vps_cp_scale" );                m_aaiTempScale  [ uiBaseIndex ][ viewIndex ]   = iCode;
@@ -1932,4 +2057,16 @@
       }
       pcVPS->initCamParaVPS( viewIndex, bCamParPresentFlag, uiCamParPrecision, bCamParSlice, m_aaiTempScale, m_aaiTempOffset ); 
+#else
+        for( UInt uiBaseIndex = 0; uiBaseIndex < viewIndex; uiBaseIndex++ )
+        {
+          Int iCode; 
+          READ_SVLC( iCode, "vps_cp_scale" );                m_aaiTempScale  [ uiBaseIndex ][ viewIndex ]   = iCode;
+          READ_SVLC( iCode, "vps_cp_off" );                  m_aaiTempOffset [ uiBaseIndex ][ viewIndex ]   = iCode;
+          READ_SVLC( iCode, "vps_cp_inv_scale_plus_scale" ); m_aaiTempScale  [ viewIndex   ][ uiBaseIndex ] = iCode - m_aaiTempScale [ uiBaseIndex ][ viewIndex ];
+          READ_SVLC( iCode, "vps_cp_inv_off_plus_off" );     m_aaiTempOffset [ viewIndex   ][ uiBaseIndex ] = iCode - m_aaiTempOffset[ uiBaseIndex ][ viewIndex ];
+        }
+      }
+      pcVPS->initCamParaVPS( viewIndex, bCamParPresentFlag, uiCamParPrecision, bCamParSlice, m_aaiTempScale, m_aaiTempOffset ); 
+#endif
     }
   }
@@ -1994,4 +2131,9 @@
 #endif
   rpcSlice->setSPS(sps);
+#if HHI_TOOL_PARAMETERS_I2_J0107
+#if H_3D
+  rpcSlice->init3dToolParameters();
+#endif
+#endif
   rpcSlice->setPPS(pps);
   if( pps->getDependentSliceSegmentsEnabledFlag() && ( !firstSliceSegmentInPic ))
@@ -2065,5 +2207,5 @@
     rpcSlice->checkCrossLayerBlaFlag( ); 
 
-#if !H_MV_HLS7_GEN
+#if !H_MV_HLS7_GEN && !H_MV_HLS_FIX
     if ( rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
     {
@@ -2350,8 +2492,24 @@
     Bool interLayerPredLayerIdcPresentFlag = false; 
     Int layerId       = rpcSlice->getLayerId(); 
+#if HHI_DEPENDENCY_SIGNALLING_I1_J0107
+#if H_3D
+    if( rpcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumRefListLayers( layerId ) > 0 )
+#else
     if( rpcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumDirectRefLayers( layerId ) > 0 )
+#endif
+#else
+    if( rpcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumDirectRefLayers( layerId ) > 0 )
+#endif
     {   
       READ_FLAG( uiCode, "inter_layer_pred_enabled_flag" ); rpcSlice->setInterLayerPredEnabledFlag( uiCode == 1 );
+#if HHI_DEPENDENCY_SIGNALLING_I1_J0107
+#if H_3D
+      if( rpcSlice->getInterLayerPredEnabledFlag() && vps->getNumRefListLayers( layerId ) > 1 )
+#else
       if( rpcSlice->getInterLayerPredEnabledFlag() && vps->getNumDirectRefLayers( layerId ) > 1 )
+#endif
+#else
+      if( rpcSlice->getInterLayerPredEnabledFlag() && vps->getNumDirectRefLayers( layerId ) > 1 )
+#endif
       {            
         if( !vps->getMaxOneActiveRefLayerFlag())  
@@ -2359,5 +2517,13 @@
           READ_CODE( rpcSlice->getNumInterLayerRefPicsMinus1Len( ), uiCode, "num_inter_layer_ref_pics_minus1" ); rpcSlice->setNumInterLayerRefPicsMinus1( uiCode );
         }
+#if HHI_DEPENDENCY_SIGNALLING_I1_J0107
+#if H_3D
+        if ( rpcSlice->getNumActiveRefLayerPics() != vps->getNumRefListLayers( layerId ) )
+#else
         if ( rpcSlice->getNumActiveRefLayerPics() != vps->getNumDirectRefLayers( layerId ) )
+#endif
+#else
+        if ( rpcSlice->getNumActiveRefLayerPics() != vps->getNumDirectRefLayers( layerId ) )
+#endif
         {
           interLayerPredLayerIdcPresentFlag = true; 
@@ -2545,5 +2711,9 @@
     }
 #if H_3D_IC
+#if HHI_DEPENDENCY_SIGNALLING_I1_J0107
+    else if( rpcSlice->getViewIndex() && ( rpcSlice->getSliceType() == P_SLICE || rpcSlice->getSliceType() == B_SLICE ) && !rpcSlice->getIsDepth() && vps->getNumRefListLayers( layerId ) > 0 )
+#else
     else if( rpcSlice->getViewIndex() && ( rpcSlice->getSliceType() == P_SLICE || rpcSlice->getSliceType() == B_SLICE ) && !rpcSlice->getIsDepth() && vps->getNumDirectRefLayers( layerId ) > 0 )
+#endif
     {
       UInt uiCodeTmp = 0;
@@ -2559,4 +2729,5 @@
     }
 #endif
+#if !MTK_SINGLE_DEPTH_VPS_FLAG_J0060
 #if H_3D_SINGLE_DEPTH
     if(rpcSlice->getIsDepth())
@@ -2567,8 +2738,16 @@
     }
 #endif
+#endif
     if (!rpcSlice->isIntra())
     {
       READ_UVLC( uiCode, "five_minus_max_num_merge_cand");
 #if H_3D_IV_MERGE
+#if HHI_TOOL_PARAMETERS_I2_J0107
+#if ALGIN_J0107_J0059
+      rpcSlice->setMaxNumMergeCand(( ( rpcSlice->getMpiFlag() || rpcSlice->getIvMvPredFlag() || rpcSlice->getViewSynthesisPredFlag() ) ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS) - uiCode);
+#else
+      rpcSlice->setMaxNumMergeCand(( ( rpcSlice->getMpiFlag() || rpcSlice->getIvMvPredFlag() ) ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS) - uiCode);
+#endif
+#else
       if(rpcSlice->getIsDepth())
       {
@@ -2580,7 +2759,12 @@
       {
         Bool ivMvPredFlag = rpcSlice->getVPS()->getIvMvPredFlag( rpcSlice->getLayerIdInVps() ) ;
+#if MTK_MRG_LIST_SIZE_CLEANUP_J0059
+        Bool vspFlag = rpcSlice->getVPS()->getViewSynthesisPredFlag( rpcSlice->getLayerIdInVps() ) ;
+        rpcSlice->setMaxNumMergeCand(( ivMvPredFlag || vspFlag? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS) - uiCode);
+#else
         rpcSlice->setMaxNumMergeCand(( ivMvPredFlag ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS) - uiCode);
-      }
-
+#endif
+      }
+#endif
 #else
       rpcSlice->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode);
@@ -2742,9 +2926,15 @@
 
     // Derive the value of PocMs8bValRequiredFlag
+#if !H_MV_HLS_FIX
     rpcSlice->setPocMsbValRequiredFlag( rpcSlice->getCraPicFlag() || rpcSlice->getBlaPicFlag()
                                           /* || TODO related to vps_poc_lsb_aligned_flag */
                                           );
-
+#endif
+
+#if H_MV_HLS_FIX
+    if( !rpcSlice->getPocMsbValRequiredFlag() && rpcSlice->getVPS()->getVpsPocLsbAlignedFlag() )
+#else
     if( !rpcSlice->getPocMsbValRequiredFlag() /* TODO &&  rpcSlice->getVPS()->getVpsPocLsbAlignedFlag() */ )
+#endif
     {
       READ_FLAG( uiCode, "poc_msb_val_present_flag" ); rpcSlice->setPocMsbValPresentFlag( uiCode == 1 );
Index: trunk/source/Lib/TLibDecoder/TDecCAVLC.h
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 1085)
+++ trunk/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 1124)
@@ -90,7 +90,16 @@
 #endif
 #if H_3D
+#if HHI_VPS_3D_EXTENSION_I3_J0107
+  Void  parseVPS3dExtension  ( TComVPS* pcVPS ); 
+#else
   Void  parseVPSExtension2  ( TComVPS* pcVPS ); 
+#endif
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  Void  parseSPS3dExtension ( TComSPS* pcSPS );
+  Void  parseSPS            ( TComSPS* pcSPS );
+#else
   Void  parseSPSExtension2  ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag );
   Void  parseSPS            ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag );
+#endif  
 #else
   Void  parseSPS            ( TComSPS* pcSPS );
Index: trunk/source/Lib/TLibDecoder/TDecCu.cpp
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecCu.cpp	(revision 1085)
+++ trunk/source/Lib/TLibDecoder/TDecCu.cpp	(revision 1124)
@@ -291,8 +291,8 @@
   DTRACE_CU_S("=========== coding_unit ===========\n")
 #endif
-
-
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
       pcCU->setUseDDD( false, uiAbsPartIdx, uiDepth );
+#endif
 #endif
 
@@ -315,5 +315,9 @@
   {
 #if H_3D_ARP && H_3D_IV_MERGE
+#if HHI_TOOL_PARAMETERS_I2_J0107
+    if( pcCU->getSlice()->getIvResPredFlag() || pcCU->getSlice()->getIvMvPredFlag() )
+#else
     if( pcCU->getSlice()->getVPS()->getUseAdvRP( pcCU->getSlice()->getLayerId() ) || pcCU->getSlice()->getVPS()->getIvMvPredFlag( pcCU->getSlice()->getLayerId() ))
+#endif
 #else 
 #if H_3D_ARP
@@ -345,5 +349,9 @@
 #endif
 #if H_3D_NBDV_REF
+#if HHI_TOOL_PARAMETERS_I2_J0107
+      if( pcCU->getSlice()->getDepthBasedBlkPartFlag() )  //Notes from QC: please check the condition for DoNBDV. Remove this comment once it is done.
+#else
       if(pcCU->getSlice()->getVPS()->getDepthRefinementFlag( pcCU->getSlice()->getLayerIdInVps() ))  //Notes from QC: please check the condition for DoNBDV. Remove this comment once it is done.
+#endif
       {
         DvInfo.bDV = m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo, true);
@@ -452,5 +460,5 @@
 #endif
     pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
-
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
     if( uiMergeIndex == m_ppcCU[uiDepth]->getUseDDDCandIdx() )
@@ -460,4 +468,5 @@
         pcCU->setDDDepthSubParts( m_ppcCU[uiDepth]->getDDTmpDepth(),uiAbsPartIdx, 0, uiDepth );
     }
+#endif
 #endif
 
@@ -735,7 +744,15 @@
   //construction of depth candidates
   Pel testDepth;
+#if SINGLE_DEPTH_SIMP_J0115
+  Pel DepthNeighbours[2];
+#else
   Pel DepthNeighbours[5];
+#endif
   Int index =0;
+#if SINGLE_DEPTH_SIMP_J0115
+  for( Int i = 0; (i < 2) && (index<SINGLE_DEPTH_MODE_CAND_LIST_SIZE) ; i++ )
+#else
   for( Int i = 0; (i < 5) && (index<SINGLE_DEPTH_MODE_CAND_LIST_SIZE) ; i++ )
+#endif
   {
     if(!pcCU->getNeighDepth (0, uiAbsPartIdx, &testDepth, i))
@@ -745,4 +762,5 @@
     DepthNeighbours[index]=testDepth;
     index++;
+#if !SINGLE_DEPTH_SIMP_J0115
     for(Int j=0;j<index-1;j++)
     {
@@ -753,4 +771,5 @@
      }
     }
+#endif
   }
 
@@ -1063,5 +1082,5 @@
     }
   }
-  
+
   TextType  eText             = ( uiChromaId > 0 ? TEXT_CHROMA_V : TEXT_CHROMA_U );
   UInt      uiWidth           = pcCU     ->getWidth   ( 0 ) >> ( uiTrDepth + 1 );
@@ -1071,10 +1090,10 @@
   Pel*      piPred            = ( uiChromaId > 0 ? pcPredYuv->getCrAddr( uiAbsPartIdx ) : pcPredYuv->getCbAddr( uiAbsPartIdx ) );
   Pel*      piResi            = ( uiChromaId > 0 ? pcResiYuv->getCrAddr( uiAbsPartIdx ) : pcResiYuv->getCbAddr( uiAbsPartIdx ) );
-  
+
   UInt      uiNumCoeffInc     = ( ( pcCU->getSlice()->getSPS()->getMaxCUWidth() * pcCU->getSlice()->getSPS()->getMaxCUHeight() ) >> ( pcCU->getSlice()->getSPS()->getMaxCUDepth() << 1 ) ) >> 2;
   TCoeff*   pcCoeff           = ( uiChromaId > 0 ? pcCU->getCoeffCr() : pcCU->getCoeffCb() ) + ( uiNumCoeffInc * uiAbsPartIdx );
-  
+
   UInt      uiChromaPredMode  = pcCU->getChromaIntraDir( 0 );
-  
+
   UInt      uiZOrder          = pcCU->getZorderIdxInCU() + uiAbsPartIdx;
   Pel*      piRecIPred        = ( uiChromaId > 0 ? pcCU->getPic()->getPicYuvRec()->getCrAddr( pcCU->getAddr(), uiZOrder ) : pcCU->getPic()->getPicYuvRec()->getCbAddr( pcCU->getAddr(), uiZOrder ) );
@@ -1087,10 +1106,10 @@
 
   pcCU->getPattern()->initAdiPatternChroma( pcCU, uiAbsPartIdx, uiTrDepth,
-                                           m_pcPrediction->getPredicBuf       (),
-                                           m_pcPrediction->getPredicBufWidth  (),
-                                           m_pcPrediction->getPredicBufHeight (),
-                                           bAboveAvail, bLeftAvail );
+    m_pcPrediction->getPredicBuf       (),
+    m_pcPrediction->getPredicBufWidth  (),
+    m_pcPrediction->getPredicBufHeight (),
+    bAboveAvail, bLeftAvail );
   Int* pPatChroma   = ( uiChromaId > 0 ? pcCU->getPattern()->getAdiCrBuf( uiWidth, uiHeight, m_pcPrediction->getPredicBuf() ) : pcCU->getPattern()->getAdiCbBuf( uiWidth, uiHeight, m_pcPrediction->getPredicBuf() ) );
-  
+
   //===== get prediction signal =====
   {
@@ -1107,38 +1126,38 @@
   if ( pcCU->getCbf( uiAbsPartIdx, eText, uiTrDepth ) )
   {
-  //===== inverse transform =====
-  Int curChromaQpOffset;
-  if(eText == TEXT_CHROMA_U)
-  {
-    curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCbQpOffset() + pcCU->getSlice()->getSliceQpDeltaCb();
-  }
-  else
-  {
-    curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCrQpOffset() + pcCU->getSlice()->getSliceQpDeltaCr();
-  }
-  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
-
-  Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)eText];
+    //===== inverse transform =====
+    Int curChromaQpOffset;
+    if(eText == TEXT_CHROMA_U)
+    {
+      curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCbQpOffset() + pcCU->getSlice()->getSliceQpDeltaCb();
+    }
+    else
+    {
+      curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCrQpOffset() + pcCU->getSlice()->getSliceQpDeltaCr();
+    }
+    m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
+
+    Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)eText];
     assert(scalingListType < SCALING_LIST_NUM);
-  m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), eText, REG_DCT, piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType, useTransformSkipChroma );
-
-  //===== reconstruction =====
-  Pel* pPred      = piPred;
-  Pel* pResi      = piResi;
-  Pel* pReco      = piReco;
-  Pel* pRecIPred  = piRecIPred;
-  for( UInt uiY = 0; uiY < uiHeight; uiY++ )
-  {
-    for( UInt uiX = 0; uiX < uiWidth; uiX++ )
-    {
-      pReco    [ uiX ] = ClipC( pPred[ uiX ] + pResi[ uiX ] );
-      pRecIPred[ uiX ] = pReco[ uiX ];
-    }
-    pPred     += uiStride;
-    pResi     += uiStride;
-    pReco     += uiStride;
-    pRecIPred += uiRecIPredStride;
-  }
-}
+    m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), eText, REG_DCT, piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType, useTransformSkipChroma );
+
+    //===== reconstruction =====
+    Pel* pPred      = piPred;
+    Pel* pResi      = piResi;
+    Pel* pReco      = piReco;
+    Pel* pRecIPred  = piRecIPred;
+    for( UInt uiY = 0; uiY < uiHeight; uiY++ )
+    {
+      for( UInt uiX = 0; uiX < uiWidth; uiX++ )
+      {
+        pReco    [ uiX ] = ClipC( pPred[ uiX ] + pResi[ uiX ] );
+        pRecIPred[ uiX ] = pReco[ uiX ];
+      }
+      pPred     += uiStride;
+      pResi     += uiStride;
+      pReco     += uiStride;
+      pRecIPred += uiRecIPredStride;
+    }
+  }
   else
   {
Index: trunk/source/Lib/TLibDecoder/TDecEntropy.cpp
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 1085)
+++ trunk/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 1124)
@@ -55,12 +55,27 @@
 Void TDecEntropy::decodeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
 {
+  if( !pcCU->getSlice()->getIntraSingleFlag() )
+  {
+    return;
+  }  
+#if ALIGN_J0060_J0107
+#else
   if ( !pcCU->getSlice()->getIsDepth() )
   {
     return;
   }
+#if MTK_SINGLE_DEPTH_VPS_FLAG_J0060
+  if(!pcCU->getSlice()->getVPS()->getSingleDepthModeFlag(pcCU->getSlice()->getLayerIdInVps()))
+  {
+     return;
+  }
+#else
   if(!pcCU->getSlice()->getApplySingleDepthMode())
   {
      return;
   }
+#endif
+#endif
+
   m_pcEntropyDecoderIf->parseSingleDepthMode( pcCU, uiAbsPartIdx, uiDepth );
 }
@@ -152,5 +167,13 @@
   
 #if H_3D_DBBP
+#if SEC_DBBP_VIEW_REF_CHECK_J0037
+  #if HHI_TOOL_PARAMETERS_I2_J0107
+if( pcCU->getSlice()->getDepthBasedBlkPartFlag() && (pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN || pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_Nx2N) && pcCU->getWidth(uiAbsPartIdx) > 8 && pcCU->getSlice()->getDefaultRefViewIdxAvailableFlag() )
+#else
+if( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) && (pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN || pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_Nx2N) && pcCU->getWidth(uiAbsPartIdx) > 8 && pcCU->getSlice()->getDefaultRefViewIdxAvailableFlag() )
+#endif
+#else
   if( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) && (pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN || pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_Nx2N) && pcCU->getWidth(uiAbsPartIdx) > 8 )
+#endif
   {
     decodeDBBPFlag(pcCU, uiAbsPartIdx, uiDepth);
@@ -337,5 +360,5 @@
       }
       pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
-
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
       if( uiMergeIndex == pcSubCU->getUseDDDCandIdx() )
@@ -349,4 +372,5 @@
           pcCU->setUseDDD( false, uiSubPartIdx, uiPartIdx, uiDepth );
       }
+#endif
 #endif
 
@@ -828,6 +852,11 @@
   pcCU->setSDCFlagSubParts( false, uiAbsPartIdx, uiDepth );
 
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  if( ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getInterSdcFlag() ) || 
+    ( pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getIntraSdcWedgeFlag() ) )
+#else
   if( ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getVPS()->getInterSDCFlag( pcCU->getSlice()->getLayerIdInVps() ) ) || 
     ( pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getVPS()->getVpsDepthModesFlag( pcCU->getSlice()->getLayerIdInVps() ) ) )
+#endif
   {
     return;
Index: trunk/source/Lib/TLibDecoder/TDecEntropy.h
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecEntropy.h	(revision 1085)
+++ trunk/source/Lib/TLibDecoder/TDecEntropy.h	(revision 1124)
@@ -66,8 +66,12 @@
 
   virtual Void  parseVPS                  ( TComVPS* pcVPS )                       = 0;
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  virtual Void  parseSPS                  ( TComSPS* pcSPS )                                      = 0;
+#else
 #if H_3D
   virtual Void  parseSPS                  ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag  )                    = 0;
 #else
   virtual Void  parseSPS                  ( TComSPS* pcSPS )                                      = 0;
+#endif
 #endif
 #if H_3D
@@ -157,8 +161,12 @@
   Void    resetEntropy                ( TComSlice* p)           { m_pcEntropyDecoderIf->resetEntropy(p);                    }
   Void    decodeVPS                   ( TComVPS* pcVPS ) { m_pcEntropyDecoderIf->parseVPS(pcVPS); }
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  Void    decodeSPS                   ( TComSPS* pcSPS     )    { m_pcEntropyDecoderIf->parseSPS(pcSPS);                    }
+#else
 #if H_3D
   Void    decodeSPS                   ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag )    { m_pcEntropyDecoderIf->parseSPS(pcSPS, viewIndex, depthFlag );                    }
 #else
   Void    decodeSPS                   ( TComSPS* pcSPS     )    { m_pcEntropyDecoderIf->parseSPS(pcSPS);                    }
+#endif
 #endif
 #if H_3D
Index: trunk/source/Lib/TLibDecoder/TDecSbac.cpp
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 1085)
+++ trunk/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 1124)
@@ -702,6 +702,11 @@
   Bool bParseSplitFlag    = true;
 
+  
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  Bool    bLimQtPredFlag = pcCU->getPic()->getSlice(0)->getQtPredFlag();
+#else
   TComVPS *vps           = pcCU->getPic()->getSlice(0)->getVPS();
   Bool    bLimQtPredFlag = vps->getLimQtPredFlag(pcCU->getPic()->getSlice(0)->getLayerId());
+#endif
   TComPic *pcTexture      = pcCU->getSlice()->getTexturePic();
   Bool bDepthMapDetect    = (pcTexture != NULL);
@@ -756,6 +761,11 @@
 #if H_3D_QTLPC
   Bool bParsePartSize    = true;
+  
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  Bool    bLimQtPredFlag = pcCU->getPic()->getSlice(0)->getQtPredFlag();
+#else
   TComVPS *vps           = pcCU->getPic()->getSlice(0)->getVPS();
   Bool    bLimQtPredFlag = vps->getLimQtPredFlag(pcCU->getPic()->getSlice(0)->getLayerId());
+#endif
   TComPic *pcTexture     = pcCU->getSlice()->getTexturePic();
   Bool bDepthMapDetect   = (pcTexture != NULL);
@@ -982,5 +992,9 @@
   {
 #if H_3D_DIM
+#if HHI_TOOL_PARAMETERS_I2_J0107
+    if( pcCU->getSlice()->getIntraSdcWedgeFlag() || pcCU->getSlice()->getIntraContourFlag() )
+#else
     if( pcCU->getSlice()->getVpsDepthModesFlag() || pcCU->getSlice()->getIVPFlag() )
+#endif
     {
       parseIntraDepth( pcCU, absPartIdx+partOffset*j, depth );
@@ -1096,4 +1110,9 @@
       UInt uiTabIdx = 0;
       xParseDmm1WedgeIdx( uiTabIdx, g_dmm1TabIdxBits[pcCU->getIntraSizeIdx(absPartIdx)] );
+
+#if MTK_J0033
+      assert( uiTabIdx < g_dmmWedgeLists[ g_aucConvertToBit[ pcCU->getDMM1BasePatternWidth( pcCU->getWidth( absPartIdx ) )]].size());
+#endif
+
       pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dimType, absPartIdx, depth );
     } break;
@@ -1124,5 +1143,9 @@
   if( uiIsDimMode )
   {
+#if HHI_TOOL_PARAMETERS_I2_J0107
+    if( pcCU->getSlice()->getIntraSdcWedgeFlag() && pcCU->getSlice()->getIntraContourFlag() )
+#else
     if( pcCU->getSlice()->getVpsDepthModesFlag() && pcCU->getSlice()->getIVPFlag() )
+#endif
     {
       m_pcTDecBinIf->decodeBin( uiSymbol, m_cDepthIntraModeSCModel.get( 0, 0, 0 ) );
@@ -1136,9 +1159,17 @@
       }
     }
+#if HHI_TOOL_PARAMETERS_I2_J0107
+    else if ( pcCU->getSlice()->getIntraSdcWedgeFlag() )
+#else
     else if ( pcCU->getSlice()->getVpsDepthModesFlag() )
+#endif
     {
       pcCU->setLumaIntraDirSubParts( DIM_OFFSET, absPartIdx, depth );
     }
+#if HHI_TOOL_PARAMETERS_I2_J0107
+    else if( pcCU->getSlice()->getIntraContourFlag() )
+#else
     else if( pcCU->getSlice()->getIVPFlag() )
+#endif
     {
       pcCU->setLumaIntraDirSubParts( ( 1+ DIM_OFFSET ), absPartIdx, depth );
@@ -2120,5 +2151,9 @@
 Void TDecSbac::parseDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
 {
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  AOF( pcCU->getSlice()->getDepthBasedBlkPartFlag() );
+#else
   AOF( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) );
+#endif
   AOF( !pcCU->getSlice()->getIsDepth() );
   
Index: trunk/source/Lib/TLibDecoder/TDecSbac.h
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecSbac.h	(revision 1085)
+++ trunk/source/Lib/TLibDecoder/TDecSbac.h	(revision 1124)
@@ -76,8 +76,12 @@
   Void  setBitstream              ( TComInputBitstream* p  ) { m_pcBitstream = p; m_pcTDecBinIf->init( p ); }
   Void  parseVPS                  ( TComVPS* /*pcVPS*/ ) {}
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  Void  parseSPS                  ( TComSPS* /*pcSPS*/ ) {}
+#else
 #if H_3D
   Void  parseSPS                  ( TComSPS* /*pcSPS*/ , Int /*viewIndex*/, Bool /*depthFlag*/ ) {}
 #else
   Void  parseSPS                  ( TComSPS* /*pcSPS*/ ) {}
+#endif
 #endif
 #if H_3D
Index: trunk/source/Lib/TLibDecoder/TDecSlice.cpp
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecSlice.cpp	(revision 1085)
+++ trunk/source/Lib/TLibDecoder/TDecSlice.cpp	(revision 1124)
@@ -280,4 +280,36 @@
       iNumSubstreamsPerTile = 1;
     }
+#if LGE_DEFAULT_DV_J0046 && !SEC_ARP_VIEW_REF_CHECK_J0037 && !SEC_DBBP_VIEW_REF_CHECK_J0037
+    pcSlice->setDefaultRefViewIdx( -1 );
+    pcSlice->setDefaultRefViewIdxAvailableFlag( false ); 
+
+    Int valid = 0;
+    Int viewIndex = 0;
+    for( UInt uiBId = 0; uiBId < pcSlice->getViewIndex() && valid==0; uiBId++ )
+    {
+        UInt        uiBaseId    = uiBId;
+        TComPic*    pcBasePic   = pcSlice->getIvPic( false, uiBaseId );
+        for( Int iRefListId = 0; ( iRefListId < (pcSlice->isInterB()? 2:1) ) && !pcSlice->isIntra() && valid==0; iRefListId++ )
+        {
+            RefPicList  eRefPicListTest = RefPicList( iRefListId );
+            Int         iNumRefPics = pcSlice->getNumRefIdx( eRefPicListTest ) ;
+            for( Int iRefIndex = 0; iRefIndex < iNumRefPics; iRefIndex++ )
+            { 
+                if(pcBasePic->getPOC() == pcSlice->getRefPic( eRefPicListTest, iRefIndex )->getPOC() 
+                    && pcBasePic->getViewIndex() == pcSlice->getRefPic( eRefPicListTest, iRefIndex )->getViewIndex())
+                {
+                    valid=1;
+                    viewIndex = uiBaseId;
+                    break;
+                }
+            }
+        }
+    }
+    if( valid )
+    {
+        pcSlice->setDefaultRefViewIdx( viewIndex );
+        pcSlice->setDefaultRefViewIdxAvailableFlag( true );   
+    }
+#endif
 
     if ( (iCUAddr == rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getFirstCUAddr()) && // 1st in tile.
Index: trunk/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecTop.cpp	(revision 1085)
+++ trunk/source/Lib/TLibDecoder/TDecTop.cpp	(revision 1124)
@@ -726,4 +726,9 @@
 
 #endif
+#if HHI_TOOL_PARAMETERS_I2_J0107
+#if H_3D
+  m_apcSlicePilot->init3dToolParameters();
+#endif
+#endif
   pps->setSPS(sps);
   pps->setNumSubstreams(pps->getEntropyCodingSyncEnabledFlag() ? ((sps->getPicHeightInLumaSamples() + sps->getMaxCUHeight() - 1) / sps->getMaxCUHeight()) * (pps->getNumTileColumnsMinus1() + 1) : 1);
@@ -1082,4 +1087,9 @@
     pcSlice->getTempRefPicLists( m_cListPic, m_refPicSetInterLayer0, m_refPicSetInterLayer1, tempRefPicLists, usedAsLongTerm, numPocTotalCurr);
     pcSlice->setRefPicList     ( tempRefPicLists, usedAsLongTerm, numPocTotalCurr, true ); 
+
+#if SEC_ARP_VIEW_REF_CHECK_J0037 || SEC_DBBP_VIEW_REF_CHECK_J0037
+    pcSlice->setDefaultRefView();
+#endif
+
 #if H_3D_ARP
     pcSlice->setARPStepNum(m_ivPicLists);
@@ -1234,5 +1244,9 @@
   TComVPS* vps = m_parameterSetManagerDecoder.getPrefetchedVPS( 0 ); 
   assert( vps != 0 );
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  m_cEntropyDecoder.decodeSPS( sps );
+#else
   m_cEntropyDecoder.decodeSPS( sps, vps->getViewIndex( m_layerId ), ( vps->getDepthId( m_layerId ) == 1 ) );
+#endif
 #else
   m_cEntropyDecoder.decodeSPS( sps );
Index: trunk/source/Lib/TLibDecoder/TDecTop.h
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecTop.h	(revision 1085)
+++ trunk/source/Lib/TLibDecoder/TDecTop.h	(revision 1124)
@@ -83,8 +83,10 @@
 #endif
 
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
   Int getCodedScale( Int iBaseView, Int iCureView){ return m_aaiCodedScale[ iBaseView ][ iCureView ];}
   Int getCodedOffset( Int iBaseView, Int iCureView){ return m_aaiCodedOffset[ iBaseView ][ iCureView ];}
   UInt getCamParsCodedPrecision(){ return m_vps->getCamParPrecision(); }
+#endif
 #endif
 
Index: trunk/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 1085)
+++ trunk/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 1124)
@@ -638,8 +638,12 @@
 }
 
+#if HHI_TOOL_PARAMETERS_I2_J0107
+Void TEncCavlc::codeSPS( TComSPS* pcSPS )
+#else
 #if H_3D
 Void TEncCavlc::codeSPS( TComSPS* pcSPS, Int viewIndex, Bool depthFlag )
 #else
 Void TEncCavlc::codeSPS( TComSPS* pcSPS )
+#endif
 #endif
 {
@@ -842,5 +846,9 @@
   if ( pcSPS->getSps3dExtensionFlag() )
   {
+#if HHI_TOOL_PARAMETERS_I2_J0107
+    codeSPS3dExtension( pcSPS ); 
+#else
     codeSPSExtension2( pcSPS, viewIndex, depthFlag  ); 
+#endif
   }
 
@@ -863,4 +871,8 @@
   WRITE_CODE( pcPPS->getPpsScalingListRefLayerId( ), 6, "pps_scaling_list_ref_layer_id" );
   WRITE_UVLC( 0, "num_ref_loc_offsets" );
+#if H_MV_HLS_FIX
+  WRITE_FLAG( 0 , "colour_mapping_enabled_flag" );
+#endif
+
 }
 
@@ -868,8 +880,38 @@
 
 #if H_3D
+#if HHI_TOOL_PARAMETERS_I2_J0107
+Void TEncCavlc::codeSPS3dExtension( TComSPS* pcSPS )
+{
+  TComSps3dExtension* sps3dExt = pcSPS->getSps3dExtension();
+  for( Int d = 0; d  <=  1; d++ )
+  {
+    WRITE_FLAG( sps3dExt->getIvMvPredFlag( d ) ? 1 : 0 , "iv_mv_pred_flag" );
+    WRITE_FLAG( sps3dExt->getIvMvScalingFlag( d ) ? 1 : 0 , "iv_mv_scaling_flag" );
+    if( d  ==  0 )
+    {
+      WRITE_UVLC( sps3dExt->getLog2SubPbSizeMinus3( d ), "log2_sub_pb_size_minus3" );
+      WRITE_FLAG( sps3dExt->getIvResPredFlag( d ) ? 1 : 0 , "iv_res_pred_flag" );
+      WRITE_FLAG( sps3dExt->getDepthRefinementFlag( d ) ? 1 : 0 , "depth_refinement_flag" );
+      WRITE_FLAG( sps3dExt->getViewSynthesisPredFlag( d ) ? 1 : 0 , "view_synthesis_pred_flag" );
+      WRITE_FLAG( sps3dExt->getDepthBasedBlkPartFlag( d ) ? 1 : 0 , "depth_based_blk_part_flag" );
+    }
+    else 
+    {
+      WRITE_FLAG( sps3dExt->getMpiFlag( d ) ? 1 : 0 , "mpi_flag" );
+      WRITE_UVLC( sps3dExt->getLog2MpiSubPbSizeMinus3( d ), "log2_mpi_sub_pb_size_minus3" );
+      WRITE_FLAG( sps3dExt->getIntraContourFlag( d ) ? 1 : 0 , "intra_contour_flag" );
+      WRITE_FLAG( sps3dExt->getIntraSdcWedgeFlag( d ) ? 1 : 0 , "intra_sdc_wedge_flag" );
+      WRITE_FLAG( sps3dExt->getQtPredFlag( d ) ? 1 : 0 , "qt_pred_flag" );
+      WRITE_FLAG( sps3dExt->getInterSdcFlag( d ) ? 1 : 0 , "inter_sdc_flag" );
+      WRITE_FLAG( sps3dExt->getIntraSingleFlag( d ) ? 1 : 0 , "intra_single_flag" );
+    }
+  }
+}
+#else
 Void TEncCavlc::codeSPSExtension2( TComSPS* pcSPS, Int viewIndex, Bool depthFlag )
 {
 
 }
+#endif
 #endif
 
@@ -969,7 +1011,13 @@
   codeVPSExtension( pcVPS );                           
 #if H_3D
-  WRITE_FLAG( 1,                     "vps_extension2_flag" );
+  WRITE_FLAG( 1,                     "vps_extension2_flag" );  
+#if HHI_VPS_3D_EXTENSION_I3_J0107
+  WRITE_FLAG( 1,                     "vps_3d_extension_flag" );
+  m_pcBitIf->writeAlignOne();      
+  codeVPS3dExtension( pcVPS ); 
+#else
   m_pcBitIf->writeAlignOne();      
   codeVPSExtension2( pcVPS ); 
+#endif
   WRITE_FLAG( 0,                     "vps_extension3_flag" );
 #else
@@ -1141,5 +1189,9 @@
   for( Int i = 1; i < pcVPS->getNumOutputLayerSets( ); i++ )
   {
+#if H_MV_HLS_FIX
+    if( pcVPS->getNumLayerSets() > 2 && i >= pcVPS->getNumLayerSets( ) )    
+#else
     if( i >= pcVPS->getNumLayerSets( ) )    
+#endif
     {      
       WRITE_CODE( pcVPS->getLayerSetIdxForOlsMinus1( i ), pcVPS->getLayerSetIdxForOlsMinus1Len( i ) ,      "layer_set_idx_for_ols_minus1[i]" );
@@ -1211,5 +1263,5 @@
 
   WRITE_FLAG( pcVPS->getMaxOneActiveRefLayerFlag( ) ? 1 : 0, "max_one_active_ref_layer_flag" );
-#if H_MV_HLS7_GEN
+#if H_MV_HLS7_GEN || H_MV_HLS_FIX
   WRITE_FLAG( pcVPS->getVpsPocLsbAlignedFlag( ) ? 1 : 0 , "vps_poc_lsb_aligned_flag" );
 #endif
@@ -1261,4 +1313,7 @@
     codeVPSVUI( pcVPS ); 
   }     
+#if H_MV_HLS_FIX
+  else
+#endif
   {
     TComVPSVUI* pcVPSVUI = pcVPS->getVPSVUI( ); 
@@ -1575,6 +1630,11 @@
 
 #if H_3D
+#if HHI_VPS_3D_EXTENSION_I3_J0107
+Void TEncCavlc::codeVPS3dExtension( TComVPS* pcVPS )
+#else
 Void TEncCavlc::codeVPSExtension2( TComVPS* pcVPS )
+#endif
 { 
+#if !HHI_TOOL_PARAMETERS_I2_J0107
   for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ )
   {
@@ -1619,7 +1679,11 @@
         WRITE_FLAG( pcVPS->getInterSDCFlag( i ) ? 1 : 0, "depth_inter_SDC_flag" );
 #endif
+#if MTK_SINGLE_DEPTH_VPS_FLAG_J0060
+        WRITE_FLAG( pcVPS->getSingleDepthModeFlag( i ) ? 1 : 0, "single_depth_mode_flag" );
+#endif
       }
     }  
   }
+#endif
   WRITE_UVLC( pcVPS->getCamParPrecision(), "cp_precision" );
   for (UInt viewIndex=1; viewIndex<pcVPS->getNumViews(); viewIndex++)
@@ -1725,5 +1789,5 @@
     }
     pcSlice->checkCrossLayerBlaFlag( ); 
-#if !H_MV_HLS7_GEN
+#if !H_MV_HLS7_GEN && !H_MV_HLS_FIX
     if ( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb )
     {
@@ -1887,8 +1951,24 @@
     Bool interLayerPredLayerIdcPresentFlag = false; 
     Int layerId = pcSlice->getLayerId(); 
+#if HHI_DEPENDENCY_SIGNALLING_I1_J0107
+#if H_3D
+    if( pcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumRefListLayers( layerId ) > 0 )
+#else
     if( pcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumDirectRefLayers( layerId ) > 0 )
+#endif
+#else
+    if( pcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumDirectRefLayers( layerId ) > 0 )
+#endif
     {   
       WRITE_FLAG( pcSlice->getInterLayerPredEnabledFlag( ) ? 1 : 0 , "inter_layer_pred_enabled_flag" );
+#if HHI_DEPENDENCY_SIGNALLING_I1_J0107
+#if H_3D
+      if( pcSlice->getInterLayerPredEnabledFlag() && vps->getNumRefListLayers( layerId ) > 1 )
+#else
       if( pcSlice->getInterLayerPredEnabledFlag() && vps->getNumDirectRefLayers( layerId ) > 1 )
+#endif
+#else
+      if( pcSlice->getInterLayerPredEnabledFlag() && vps->getNumDirectRefLayers( layerId ) > 1 )
+#endif
       {            
         if( !vps->getMaxOneActiveRefLayerFlag())  
@@ -1896,5 +1976,13 @@
           WRITE_CODE( pcSlice->getNumInterLayerRefPicsMinus1( ), pcSlice->getNumInterLayerRefPicsMinus1Len( ), "num_inter_layer_ref_pics_minus1" );
         }
+#if HHI_DEPENDENCY_SIGNALLING_I1_J0107
+#if H_3D
+        if ( pcSlice->getNumActiveRefLayerPics() != vps->getNumRefListLayers( layerId ) )
+#else
         if ( pcSlice->getNumActiveRefLayerPics() != vps->getNumDirectRefLayers( layerId ) )
+#endif
+#else
+        if ( pcSlice->getNumActiveRefLayerPics() != vps->getNumDirectRefLayers( layerId ) )
+#endif
         {        
           interLayerPredLayerIdcPresentFlag = true; 
@@ -2037,5 +2125,9 @@
     }
 #if H_3D_IC
+#if HHI_DEPENDENCY_SIGNALLING_I1_J0107
+    else if( pcSlice->getViewIndex() && ( pcSlice->getSliceType() == P_SLICE || pcSlice->getSliceType() == B_SLICE ) && !pcSlice->getIsDepth() && vps->getNumRefListLayers( layerId ) > 0 )
+#else
     else if( pcSlice->getViewIndex() && ( pcSlice->getSliceType() == P_SLICE || pcSlice->getSliceType() == B_SLICE ) && !pcSlice->getIsDepth() && vps->getNumDirectRefLayers( layerId ) > 0 )
+#endif
     {
       WRITE_FLAG( pcSlice->getApplyIC() ? 1 : 0, "slice_ic_enable_flag" );
@@ -2046,4 +2138,5 @@
     }
 #endif
+#if !MTK_SINGLE_DEPTH_VPS_FLAG_J0060
 #if H_3D_SINGLE_DEPTH
     if(pcSlice->getIsDepth())
@@ -2052,4 +2145,5 @@
     }
 #endif
+#endif
 #if H_3D_IV_MERGE
     assert(pcSlice->getMaxNumMergeCand()<=MRG_MAX_NUM_CANDS_MEM);
@@ -2060,4 +2154,11 @@
     {
 #if H_3D_IV_MERGE
+#if HHI_TOOL_PARAMETERS_I2_J0107      
+#if ALGIN_J0107_J0059
+      WRITE_UVLC( ( ( pcSlice->getMpiFlag( ) || pcSlice->getIvMvPredFlag( ) || pcSlice->getViewSynthesisPredFlag( ) ) ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS ) - pcSlice->getMaxNumMergeCand(), "five_minus_max_num_merge_cand");
+#else
+      WRITE_UVLC( ( ( pcSlice->getMpiFlag( ) || pcSlice->getIvMvPredFlag( ) ) ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS ) - pcSlice->getMaxNumMergeCand(), "five_minus_max_num_merge_cand");
+#endif
+#else
       if(pcSlice->getIsDepth())
       {
@@ -2069,6 +2170,12 @@
       {
         Bool ivMvPredFlag = pcSlice->getVPS()->getIvMvPredFlag( pcSlice->getLayerIdInVps() ) ;
+#if MTK_MRG_LIST_SIZE_CLEANUP_J0059
+        Bool vspFlag = pcSlice->getVPS()->getViewSynthesisPredFlag( pcSlice->getLayerIdInVps() ) ;
+        WRITE_UVLC( ( ivMvPredFlag || vspFlag ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS ) - pcSlice->getMaxNumMergeCand(), "five_minus_max_num_merge_cand");
+#else
         WRITE_UVLC( ( ivMvPredFlag ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS ) - pcSlice->getMaxNumMergeCand(), "five_minus_max_num_merge_cand");
-      }
+#endif
+      }
+#endif
 #else
       WRITE_UVLC(MRG_MAX_NUM_CANDS - pcSlice->getMaxNumMergeCand(), "five_minus_max_num_merge_cand");
@@ -2136,7 +2243,9 @@
   {
     // Derive the value of PocMsbValRequiredFlag
+#if !H_MV_HLS_FIX
     pcSlice->setPocMsbValRequiredFlag( pcSlice->getCraPicFlag() || pcSlice->getBlaPicFlag()
                                           /* || related to vps_poc_lsb_aligned_flag */
                                           );
+#endif
 
     // Determine value of SH extension length.
@@ -2156,5 +2265,9 @@
 
 
+#if H_MV_HLS_FIX
+    if( !pcSlice->getPocMsbValRequiredFlag() &&  pcSlice->getVPS()->getVpsPocLsbAlignedFlag() )
+#else
     if( !pcSlice->getPocMsbValRequiredFlag() /* TODO &&  pcSlice->getVPS()->getVpsPocLsbAlignedFlag() */ )
+#endif
     {
       shExtnLengthInBit++;    // For poc_msb_val_present_flag
@@ -2219,5 +2332,9 @@
     pcSlice->checkPocLsbVal(); 
 
+#if H_MV_HLS_FIX
+    if( !pcSlice->getPocMsbValRequiredFlag() &&  pcSlice->getVPS()->getVpsPocLsbAlignedFlag()  )
+#else
     if( !pcSlice->getPocMsbValRequiredFlag() /* TODO &&  pcSlice->getVPS()->getVpsPocLsbAlignedFlag() */ )
+#endif
     {
       WRITE_FLAG( pcSlice->getPocMsbValPresentFlag( ) ? 1 : 0 , "poc_msb_val_present_flag" );
Index: trunk/source/Lib/TLibEncoder/TEncCavlc.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncCavlc.h	(revision 1085)
+++ trunk/source/Lib/TLibEncoder/TEncCavlc.h	(revision 1124)
@@ -99,7 +99,16 @@
 #endif
 #if H_3D
+#if HHI_VPS_3D_EXTENSION_I3_J0107
+  Void  codeVPS3dExtension       ( TComVPS* pcVPS ); 
+#else
   Void  codeVPSExtension2       ( TComVPS* pcVPS ); 
+#endif
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  Void  codeSPS3dExtension      ( TComSPS* pcSPS );
+  Void  codeSPS                 ( TComSPS* pcSPS );
+#else
   Void  codeSPSExtension2       ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag  ); 
   Void  codeSPS                 ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag );
+#endif
 #else
   Void  codeSPS                 ( TComSPS* pcSPS );
Index: trunk/source/Lib/TLibEncoder/TEncCfg.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncCfg.h	(revision 1085)
+++ trunk/source/Lib/TLibEncoder/TEncCfg.h	(revision 1124)
@@ -392,4 +392,5 @@
   Double    m_dDispCoeff;
 #endif
+#if !HHI_TOOL_PARAMETERS_I2_J0107
 #if H_3D_ARP
   UInt      m_uiUseAdvResPred;
@@ -400,8 +401,10 @@
   Int      m_iSubPUMPILog2Size;
 #endif
+#endif
 #if H_3D_IC
   Bool      m_bUseIC;
   Bool      m_bUseICLowLatencyEnc;
 #endif
+#if !HHI_TOOL_PARAMETERS_I2_J0107
 #if H_3D_INTER_SDC
   bool      m_bInterSDC;
@@ -409,17 +412,23 @@
 #if H_3D_DBBP
   Bool      m_bUseDBBP;
+#endif
 #endif
   //====== Depth Intra Modes ======
 #if H_3D_DIM
   Bool      m_useDMM;
+#if !HHI_TOOL_PARAMETERS_I2_J0107
   Bool      m_useIVP;
+#endif
   Bool      m_useSDC;
   Bool      m_useDLT;
 #endif
+#if !HHI_TOOL_PARAMETERS_I2_J0107
 #if H_3D_SINGLE_DEPTH
   Bool      m_useSingleDepthMode;
 #endif
+
 #if H_3D_IV_MERGE
   Bool      m_useMPI;
+#endif
 #endif
 #if H_3D_QTLPC
@@ -497,4 +506,5 @@
   Void      setMaxTempLayer                 ( Int maxTempLayer )            { m_maxTempLayer = maxTempLayer;      }
 
+#if !HHI_TOOL_PARAMETERS_I2_J0107
 #if H_3D_ARP
   UInt       getUseAdvRP                    ( )              { return m_uiUseAdvResPred; }
@@ -510,4 +520,5 @@
   Void       setSubPUMPILog2Size            (Int u)          { m_iSubPUMPILog2Size = u;   }     
 #endif
+#endif
 #if H_3D_IC
   Void       setUseIC                       ( Bool bVal )    { m_bUseIC = bVal; }
@@ -516,4 +527,5 @@
   Bool       getUseICLowLatencyEnc          ()               { return m_bUseICLowLatencyEnc; }
 #endif
+#if !HHI_TOOL_PARAMETERS_I2_J0107
 #if H_3D_INTER_SDC
   Void       setInterSDCEnable              ( Bool bVal )    { m_bInterSDC = bVal; }
@@ -523,4 +535,5 @@
   Void       setUseDBBP                     ( Bool  b )      { m_bUseDBBP   = b; }
   Bool       getUseDBBP()                                    { return m_bUseDBBP;     }
+#endif
 #endif
   //======== Transform =============
@@ -932,4 +945,6 @@
   Void setFrameOnlyConstraintFlag(Bool b) { m_frameOnlyConstraintFlag = b; }
 #if H_3D
+
+  // Only flags that are not in the SPS3dExtension should go here. 
   /// 3D Tools 
 
@@ -976,23 +991,30 @@
   Bool      getUseDMM                       ()        { return m_useDMM; }
   Void      setUseDMM                       ( Bool b) { m_useDMM = b;    }
+#if !HHI_TOOL_PARAMETERS_I2_J0107
   Bool      getUseIVP                       ()        { return m_useIVP; }
   Void      setUseIVP                       ( Bool b) { m_useIVP = b;    }
+#endif
   Bool      getUseSDC                       ()        { return m_useSDC; }
   Void      setUseSDC                       ( Bool b) { m_useSDC = b;    }
+
   Bool      getUseDLT                       ()        { return m_useDLT; }
   Void      setUseDLT                       ( Bool b) { m_useDLT = b;    }
 #endif
+#if !HHI_TOOL_PARAMETERS_I2_J0107
 #if H_3D_SINGLE_DEPTH
   Void       setUseSingleDepthMode          ( Bool bVal )    { m_useSingleDepthMode = bVal; }
   Bool       getUseSingleDepthMode          ()               { return m_useSingleDepthMode; }
 #endif
+#endif
 #if H_3D_QTLPC
   Void      setUseQTL                       ( Bool b ) { m_bUseQTL = b;    }
   Bool      getUseQTL                       ()         { return m_bUseQTL; }
 #endif
+#if !HHI_TOOL_PARAMETERS_I2_J0107
 #if H_3D_IV_MERGE
   Void      setUseMPI                       ( Bool b ) { m_useMPI = b;    }
   Bool      getUseMPI                       ()         { return m_useMPI; }
 #endif
+#endif
 #endif // H_3D
 };
Index: trunk/source/Lib/TLibEncoder/TEncCu.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncCu.cpp	(revision 1085)
+++ trunk/source/Lib/TLibEncoder/TEncCu.cpp	(revision 1124)
@@ -409,6 +409,10 @@
 
 #if H_3D_QTLPC
-  TComVPS *vps            = pcPic->getSlice(0)->getVPS();
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  Bool  bLimQtPredFalg    = pcPic->getSlice(0)->getQtPredFlag(); 
+#else
+    TComVPS *vps            = pcPic->getSlice(0)->getVPS();
   Bool  bLimQtPredFalg    = vps->getLimQtPredFlag(pcPic->getSlice(0)->getLayerId()); 
+#endif
   TComPic *pcTexture      = rpcBestCU->getSlice()->getTexturePic();
 
@@ -566,5 +570,9 @@
       {
 #if H_3D_ARP && H_3D_IV_MERGE
+#if HHI_TOOL_PARAMETERS_I2_J0107
+        if( rpcTempCU->getSlice()->getIvResPredFlag() || rpcTempCU->getSlice()->getIvMvPredFlag() )
+#else
         if( rpcTempCU->getSlice()->getVPS()->getUseAdvRP(rpcTempCU->getSlice()->getLayerId()) || rpcTempCU->getSlice()->getVPS()->getIvMvPredFlag(rpcTempCU->getSlice()->getLayerId()) )
+#endif
 #else 
 #if H_3D_ARP
@@ -590,5 +598,9 @@
 #endif 
 #if H_3D_NBDV_REF
+#if HHI_TOOL_PARAMETERS_I2_J0107
+          if( rpcTempCU->getSlice()->getDepthRefinementFlag() )
+#else
           if(rpcTempCU->getSlice()->getVPS()->getDepthRefinementFlag( rpcTempCU->getSlice()->getLayerIdInVps()))
+#endif
             DvInfo.bDV = rpcTempCU->getDisMvpCandNBDV(&DvInfo, true);
           else
@@ -605,5 +617,9 @@
       }
 #if  H_3D_FAST_TEXTURE_ENCODING
+#if SEC_ARP_VIEW_REF_CHECK_J0037 || SEC_DBBP_VIEW_REF_CHECK_J0037
+      if(rpcTempCU->getSlice()->getViewIndex() && !rpcTempCU->getSlice()->getIsDepth() && rpcTempCU->getSlice()->getDefaultRefViewIdxAvailableFlag() )
+#else
       if(rpcTempCU->getSlice()->getViewIndex() && !rpcTempCU->getSlice()->getIsDepth())
+#endif
       {
         PartSize ePartTemp = rpcTempCU->getPartitionSize(0);
@@ -668,5 +684,13 @@
           
 #if H_3D_DBBP
+#if SEC_DBBP_VIEW_REF_CHECK_J0037
+#if HHI_TOOL_PARAMETERS_I2_J0107
+          if( rpcTempCU->getSlice()->getDepthBasedBlkPartFlag() && rpcTempCU->getSlice()->getDefaultRefViewIdxAvailableFlag() )
+#else
+          if( m_pcEncCfg->getUseDBBP() && rpcTempCU->getSlice()->getDefaultRefViewIdxAvailableFlag() )
+#endif
+#else
           if( m_pcEncCfg->getUseDBBP() )
+#endif
           {
             xCheckRDCostInterDBBP( rpcBestCU, rpcTempCU, false );
@@ -715,5 +739,13 @@
 #if H_3D_SINGLE_DEPTH
     rpcTempCU->initEstData( uiDepth, iMinQP, isAddLowestQP  );
+#if MTK_SINGLE_DEPTH_VPS_FLAG_J0060
+#if ALIGN_J0060_J0107
+    if( rpcBestCU->getSlice()->getIntraSingleFlag() )
+#else
+    if(rpcBestCU->getSlice()->getVPS()->getSingleDepthModeFlag(rpcBestCU->getSlice()->getLayerIdInVps()))
+#endif
+#else
     if(rpcBestCU->getSlice()->getApplySingleDepthMode())
+#endif
     {
       xCheckRDCostSingleDepth( rpcBestCU, rpcTempCU, SIZE_2Nx2N );
@@ -1869,9 +1901,10 @@
 
 #endif
-
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
     Int iDDDCand = rpcTempCU->getUseDDDCandIdx(); 
     UChar ucDDDepth = rpcTempCU->getDDTmpDepth();
     rpcTempCU->setUseDDD( false, 0, uhDepth );
+#endif
 #endif
 
@@ -1908,4 +1941,5 @@
           rpcTempCU->setVSPFlagSubParts( vspFlag[uiMergeCand], 0, 0, uhDepth );
 #endif
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
           if( rpcTempCU->getSlice()->getIsDepth() && rpcTempCU->getSlice()->getViewIndex() != 0 && iDDDCand == uiMergeCand )
@@ -1918,4 +1952,5 @@
               rpcTempCU->setUseDDD( false, 0, 0, uhDepth );
           }
+#endif
 #endif
 #if H_3D_SPIVMP
@@ -2021,5 +2056,9 @@
           xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
 #if H_3D_INTER_SDC
+#if HHI_TOOL_PARAMETERS_I2_J0107
+          if( rpcTempCU->getSlice()->getInterSdcFlag() && !uiNoResidual )
+#else
           if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) && rpcTempCU->getSlice()->getIsDepth() && !uiNoResidual )
+#endif
           {
             Double dOffsetCost[3] = {MAX_DOUBLE,MAX_DOUBLE,MAX_DOUBLE};
@@ -2093,5 +2132,9 @@
       {
 #if H_3D_INTER_SDC
+#if HHI_TOOL_PARAMETERS_I2_J0107
+        if( rpcTempCU->getSlice()->getInterSdcFlag() )
+#else
         if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) )
+#endif
         {
           bestIsSkip = !rpcBestCU->getSDCFlag( 0 ) && ( rpcBestCU->getQtRootCbf(0) == 0 );
@@ -2169,5 +2212,7 @@
   UChar uhDepth = rpcTempCU->getDepth( 0 );
 #if H_3D_ARP
+#if !HHI_TOOL_PARAMETERS_I2_J0107
   Int iLayerId    = rpcTempCU->getSlice()->getLayerId();
+#endif
   Bool bFirstTime = true;
   Int nARPWMax    = rpcTempCU->getSlice()->getARPStepNum() - 1;
@@ -2180,5 +2225,9 @@
   for( Int nARPW = 0; nARPW <= nARPWMax; nARPW++ )
   {
+#if HHI_TOOL_PARAMETERS_I2_J0107
+    if( !bFirstTime && rpcTempCU->getSlice()->getIvResPredFlag() )
+#else
     if( bFirstTime == false && rpcTempCU->getSlice()->getVPS()->getUseAdvRP( iLayerId ) )
+#endif
     {
       rpcTempCU->initEstData( rpcTempCU->getDepth(0), rpcTempCU->getQP(0),bTransquantBypassFlag );      
@@ -2204,6 +2253,8 @@
   rpcTempCU->setPartSizeSubParts  ( ePartSize,  0, uhDepth );
   rpcTempCU->setPredModeSubParts  ( MODE_INTER, 0, uhDepth );
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
   rpcTempCU->setUseDDD( false, 0, uhDepth );
+#endif
 #endif
 
@@ -2284,5 +2335,9 @@
   xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
 #if H_3D_INTER_SDC
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  if( rpcTempCU->getSlice()->getInterSdcFlag() && ePartSize == SIZE_2Nx2N)
+#else
   if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) && rpcTempCU->getSlice()->getIsDepth() && ePartSize == SIZE_2Nx2N)
+#endif
   {
     Double dOffsetCost[3] = {MAX_DOUBLE,MAX_DOUBLE,MAX_DOUBLE};
Index: trunk/source/Lib/TLibEncoder/TEncEntropy.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 1085)
+++ trunk/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 1124)
@@ -78,4 +78,11 @@
 }
 
+#if HHI_TOOL_PARAMETERS_I2_J0107
+Void TEncEntropy::encodeSPS( TComSPS* pcSPS )
+{
+  m_pcEntropyCoderIf->codeSPS( pcSPS );
+  return;
+}
+#else
 #if H_3D
 Void TEncEntropy::encodeSPS( TComSPS* pcSPS, Int viewIndex, Bool depthFlag )
@@ -91,4 +98,5 @@
 }
 #endif
+#endif
 
 Void TEncEntropy::encodeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
@@ -122,13 +130,26 @@
 Void TEncEntropy::encodeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
 {
+#if ALIGN_J0060_J0107
+  if(!pcCU->getSlice()->getIntraSingleFlag() )
+  {
+    return;
+  }
+#else
   if ( !pcCU->getSlice()->getIsDepth() )
   {
     return;
   }
+#if MTK_SINGLE_DEPTH_VPS_FLAG_J0060
+  if(!pcCU->getSlice()->getVPS()->getSingleDepthModeFlag(pcCU->getSlice()->getLayerIdInVps()))
+  {
+     return;
+  }
+#else
   if(!pcCU->getSlice()->getApplySingleDepthMode())
   {
      return;
   }
-  
+#endif
+#endif
   if( bRD )
   {
@@ -268,5 +289,13 @@
   
 #if H_3D_DBBP
+#if SEC_DBBP_VIEW_REF_CHECK_J0037
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  if( pcCU->getSlice()->getDepthBasedBlkPartFlag() && (pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN || pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_Nx2N) && pcCU->getWidth(uiAbsPartIdx) > 8 && pcCU->getSlice()->getDefaultRefViewIdxAvailableFlag() )
+#else
+  if( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) && (pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN || pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_Nx2N) && pcCU->getWidth(uiAbsPartIdx) > 8 && pcCU->getSlice()->getDefaultRefViewIdxAvailableFlag() )
+#endif
+#else
   if( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) && (pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN || pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_Nx2N) && pcCU->getWidth(uiAbsPartIdx) > 8 )
+#endif
   {
     encodeDBBPFlag(pcCU, uiAbsPartIdx, bRD);
@@ -780,6 +809,11 @@
 Void TEncEntropy::encodeSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
 {
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  if( ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getInterSdcFlag() ) || 
+    ( pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getIntraSdcWedgeFlag() ) )
+#else
   if( ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getVPS()->getInterSDCFlag( pcCU->getSlice()->getLayerIdInVps() ) ) || 
     ( pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getVPS()->getVpsDepthModesFlag( pcCU->getSlice()->getLayerIdInVps() ) ) )
+#endif
   {
     return;
Index: trunk/source/Lib/TLibEncoder/TEncEntropy.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncEntropy.h	(revision 1085)
+++ trunk/source/Lib/TLibEncoder/TEncEntropy.h	(revision 1124)
@@ -69,8 +69,12 @@
 
   virtual Void  codeVPS                 ( TComVPS* pcVPS )                                      = 0;
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  virtual Void  codeSPS                 ( TComSPS* pcSPS )                                      = 0;
+#else
 #if !H_3D
   virtual Void  codeSPS                 ( TComSPS* pcSPS )                                      = 0;
 #else
   virtual Void  codeSPS                 ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag )       = 0;
+#endif
 #endif
   virtual Void  codePPS                 ( TComPPS* pcPPS )                                      = 0;
@@ -165,8 +169,12 @@
   Void encodeVPS               ( TComVPS* pcVPS);
   // SPS
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  Void encodeSPS               ( TComSPS* pcSPS );
+#else
 #if H_3D
   Void encodeSPS               ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag );
 #else
   Void encodeSPS               ( TComSPS* pcSPS );
+#endif
 #endif
   Void encodePPS               ( TComPPS* pcPPS );
Index: trunk/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 1085)
+++ trunk/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 1124)
@@ -880,5 +880,13 @@
 
     TComVPS*           vps = pcSlice->getVPS();     
+#if HHI_DEPENDENCY_SIGNALLING_I1_J0107
+#if H_3D
+    Int numDirectRefLayers = vps    ->getNumRefListLayers( getLayerId() ); 
+#else
     Int numDirectRefLayers = vps    ->getNumDirectRefLayers( getLayerId() ); 
+#endif
+#else
+    Int numDirectRefLayers = vps    ->getNumDirectRefLayers( getLayerId() ); 
+#endif
     GOPEntry gopEntry      = m_pcCfg->getGOPEntry( (pcSlice->getRapPicFlag() && getLayerId() > 0) ? MAX_GOP : iGOPid );     
     
@@ -893,5 +901,13 @@
           pcSlice->setNumInterLayerRefPicsMinus1( gopEntry.m_numActiveRefLayerPics - 1 ); 
         }
+#if HHI_DEPENDENCY_SIGNALLING_I1_J0107
+#if H_3D
+        if ( gopEntry.m_numActiveRefLayerPics != vps->getNumRefListLayers( getLayerId() ) )
+#else
         if ( gopEntry.m_numActiveRefLayerPics != vps->getNumDirectRefLayers( getLayerId() ) )
+#endif
+#else
+        if ( gopEntry.m_numActiveRefLayerPics != vps->getNumDirectRefLayers( getLayerId() ) )
+#endif
         {        
           interLayerPredLayerIdcPresentFlag = true; 
@@ -941,5 +957,9 @@
     pcSlice->setRefPicList ( rcListPic );
 #endif
+#if !MTK_SINGLE_DEPTH_VPS_FLAG_J0060
 #if H_3D_SINGLE_DEPTH
+#if HHI_TOOL_PARAMETERS_I2_J0107
+    pcSlice->setApplySingleDepthMode( pcSlice->getIntraSingleFlag() );
+#else
     TEncTop* pcEncTop = (TEncTop*) m_pcCfg;
     bool enableSingleDepthMode=false;
@@ -952,5 +972,10 @@
     }
     pcSlice->setApplySingleDepthMode(enableSingleDepthMode);
-#endif    
+#endif
+#endif   
+#endif 
+#if SEC_ARP_VIEW_REF_CHECK_J0037 || SEC_DBBP_VIEW_REF_CHECK_J0037
+    pcSlice->setDefaultRefView();
+#endif
 #if H_3D_ARP
     //GT: This seems to be broken when layerId in vps is not equal to layerId in nuh
@@ -1414,8 +1439,12 @@
         pcSlice->getSPS()->getVuiParameters()->setHrdParametersPresentFlag( true );
       }
+#if HHI_TOOL_PARAMETERS_I2_J0107
+      m_pcEntropyCoder->encodeSPS(pcSlice->getSPS());
+#else
 #if !H_3D
       m_pcEntropyCoder->encodeSPS(pcSlice->getSPS());
 #else
       m_pcEntropyCoder->encodeSPS(pcSlice->getSPS(), pcSlice->getViewIndex(), pcSlice->getIsDepth() );
+#endif
 #endif
       writeRBSPTrailingBits(nalu.m_Bitstream);
Index: trunk/source/Lib/TLibEncoder/TEncSbac.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 1085)
+++ trunk/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 1124)
@@ -255,5 +255,9 @@
       curCost += m_CUTransquantBypassFlagSCModel.calcCost( curSliceType, qp, (UChar*)INIT_CU_TRANSQUANT_BYPASS_FLAG );
 #if H_3D_DIM
+#if HHI_TOOL_PARAMETERS_I2_J0107
+    if( m_pcSlice->getIntraSdcWedgeFlag() || m_pcSlice->getIntraContourFlag() )
+#else
     if( m_pcSlice->getVpsDepthModesFlag() || m_pcSlice->getIVPFlag() )
+#endif
     {
       curCost += m_cDepthIntraModeSCModel.calcCost    ( curSliceType, qp, (UChar*)INIT_DEPTH_INTRA_MODE );
@@ -346,8 +350,12 @@
 }
 
+#if HHI_TOOL_PARAMETERS_I2_J0107
+Void TEncSbac::codeSPS( TComSPS* pcSPS )
+#else
 #if H_3D
 Void TEncSbac::codeSPS( TComSPS* pcSPS, Int viewIndex, Bool depthFlag )
 #else
 Void TEncSbac::codeSPS( TComSPS* pcSPS )
+#endif
 #endif
 {
@@ -625,6 +633,10 @@
   PartSize eSize         = pcCU->getPartitionSize( uiAbsPartIdx );
 #if H_3D_QTLPC
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  Bool    bLimQtPredFlag = pcCU->getPic()->getSlice(0)->getQtPredFlag();
+#else
   TComVPS *vps           = pcCU->getPic()->getSlice(0)->getVPS();
   Bool    bLimQtPredFlag = vps->getLimQtPredFlag(pcCU->getPic()->getSlice(0)->getLayerId());
+#endif
   TComPic *pcTexture     = pcCU->getSlice()->getTexturePic();
   Bool bDepthMapDetect   = (pcTexture != NULL);
@@ -998,6 +1010,11 @@
   Bool bCodeSplitFlag    = true;
 
+  
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  Bool    bLimQtPredFlag = pcCU->getPic()->getSlice(0)->getQtPredFlag(); 
+#else
   TComVPS *vps           = pcCU->getPic()->getSlice(0)->getVPS();
   Bool    bLimQtPredFlag = vps->getLimQtPredFlag(pcCU->getPic()->getSlice(0)->getLayerId());
+#endif
   TComPic *pcTexture     = pcCU->getSlice()->getTexturePic();
   Bool bDepthMapDetect   = (pcTexture != NULL);
@@ -1060,5 +1077,9 @@
     dir[j] = pcCU->getLumaIntraDir( absPartIdx+partOffset*j );
 #if H_3D_DIM
+#if HHI_TOOL_PARAMETERS_I2_J0107
+    if( pcCU->getSlice()->getIntraSdcWedgeFlag() ||  pcCU->getSlice()->getIntraContourFlag() )
+#else
     if( pcCU->getSlice()->getVpsDepthModesFlag() ||  pcCU->getSlice()->getIVPFlag() )
+#endif
     {
       codeIntraDepth( pcCU, absPartIdx+partOffset*j );
@@ -1206,5 +1227,9 @@
     }
     //mode coding
+#if HHI_TOOL_PARAMETERS_I2_J0107
+    if( pcCU->getSlice()->getIntraSdcWedgeFlag() && pcCU->getSlice()->getIntraContourFlag())
+#else
     if( pcCU->getSlice()->getVpsDepthModesFlag() && pcCU->getSlice()->getIVPFlag())
+#endif
     {
       m_pcBinIf->encodeBin( uiCodeIdx == 0 ? 0 : 1, m_cDepthIntraModeSCModel.get( 0, 0, 0 ) );
@@ -2305,5 +2330,9 @@
   PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx );
   AOF( ePartSize == SIZE_2NxN || ePartSize == SIZE_Nx2N );
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  AOF( pcCU->getSlice()->getDepthBasedBlkPartFlag() ); 
+#else
   AOF( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) );
+#endif
   AOF( !pcCU->getSlice()->getIsDepth() );
   
Index: trunk/source/Lib/TLibEncoder/TEncSbac.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSbac.h	(revision 1085)
+++ trunk/source/Lib/TLibEncoder/TEncSbac.h	(revision 1124)
@@ -94,8 +94,12 @@
 
   Void  codeVPS                 ( TComVPS* pcVPS );
+#if HHI_TOOL_PARAMETERS_I2_J0107
+  Void  codeSPS                 ( TComSPS* pcSPS     );
+#else
 #if !H_3D
   Void  codeSPS                 ( TComSPS* pcSPS     );
 #else
   Void  codeSPS                 ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag );
+#endif
 #endif
   Void  codePPS                 ( TComPPS* pcPPS     );
Index: trunk/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 1085)
+++ trunk/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 1124)
@@ -2881,7 +2881,15 @@
   Int index=0;
   Pel testDepth;
+#if SINGLE_DEPTH_SIMP_J0115
+  Pel DepthNeighbours[2];
+#else
   Pel DepthNeighbours[5];
+#endif
   //construction of depth candidates
+#if SINGLE_DEPTH_SIMP_J0115
+  for( Int i = 0; (i < 2)  && (index<SINGLE_DEPTH_MODE_CAND_LIST_SIZE) ; i++ )
+#else
   for( Int i = 0; (i < 5)  && (index<SINGLE_DEPTH_MODE_CAND_LIST_SIZE) ; i++ )
+#endif
   {
     if(!pcCU->getNeighDepth (0, 0, &testDepth, i))
@@ -2891,4 +2899,5 @@
     DepthNeighbours[index]=testDepth;
     index++;
+#if !SINGLE_DEPTH_SIMP_J0115
     for(Int j=0;j<index-1;j++)
     {
@@ -2899,4 +2908,5 @@
       }
     }
+#endif
   }
 
@@ -3117,10 +3127,14 @@
     }
 #endif
-
+    
 #if H_3D_DIM
     //===== determine set of depth intra modes to be tested =====
     if( m_pcEncCfg->getIsDepth() && uiWidth >= DIM_MIN_SIZE && uiWidth <= DIM_MAX_SIZE && uiWidth == uiHeight )
     {
+#if HHI_TOOL_PARAMETERS_I2_J0107
+      if( bOnlyIVP && pcCU->getSlice()->getIntraContourFlag() )
+#else
       if( bOnlyIVP && m_pcEncCfg->getUseIVP() )
+#endif
       {
         TComWedgelet* dmm4Segmentation = new TComWedgelet( uiWidth, uiHeight );
@@ -3144,5 +3158,9 @@
 
 #if H_3D_DIM_DMM
+#if HHI_TOOL_PARAMETERS_I2_J0107
+      if( ( ( m_pcEncCfg->getUseDMM() &&  pcCU->getSlice()->getIntraSdcWedgeFlag() )  || pcCU->getSlice()->getIntraContourFlag() )
+#else
       if( ( m_pcEncCfg->getUseDMM() || m_pcEncCfg->getUseIVP() )
+#endif
 #if H_3D_FAST_DEPTH_INTRA
          && (uiRdModeList[0] != PLANAR_IDX || varCU >= varThreshold)
@@ -3151,15 +3169,27 @@
       {
         UInt uiStart, uiEnd;
+#if HHI_TOOL_PARAMETERS_I2_J0107
+        if( ( m_pcEncCfg->getUseDMM() &&  pcCU->getSlice()->getIntraSdcWedgeFlag() ) &&  pcCU->getSlice()->getIntraContourFlag() )
+#else
         if( m_pcEncCfg->getUseDMM() &&  m_pcEncCfg->getUseIVP() )
+#endif
         {
           uiStart = 0;
           uiEnd   = 2;
         }
+#if HHI_TOOL_PARAMETERS_I2_J0107
+        else if( ( m_pcEncCfg->getUseDMM() &&  pcCU->getSlice()->getIntraSdcWedgeFlag() ) )
+#else
         else if( m_pcEncCfg->getUseDMM() )
+#endif
         {
           uiStart = 0;
           uiEnd   = 1;
         }
+#if HHI_TOOL_PARAMETERS_I2_J0107
+        else if( pcCU->getSlice()->getIntraContourFlag() )
+#else
         else if( m_pcEncCfg->getUseIVP() )
+#endif
         {
           uiStart = 1;
@@ -3299,5 +3329,9 @@
 #if H_3D_DIM_SDC
 #if H_3D_FAST_INTRA_SDC
+#if HHI_TOOL_PARAMETERS_I2_J0107
+      Bool bTestSDC = ( ( m_pcEncCfg->getUseSDC() &&  pcCU->getSlice()->getIntraSdcWedgeFlag() ) && pcCU->getSDCAvailable(uiPartOffset) && uiMode >= numModesForFullRD);
+#else
       Bool bTestSDC = ( m_pcEncCfg->getUseSDC() && pcCU->getSDCAvailable(uiPartOffset) && uiMode >= numModesForFullRD);
+#endif
 #else
       Bool bTestSDC = ( m_pcEncCfg->getUseSDC() && pcCU->getSDCAvailable(uiPartOffset) );
@@ -4143,5 +4177,5 @@
       }
 #endif
-
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
       if( uiMergeCand == pcCU->getUseDDDCandIdx() )
@@ -4154,4 +4188,5 @@
         pcCU->setUseDDD( false, uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx ) );
       }
+#endif
 #endif
 
@@ -4841,4 +4876,5 @@
         pcCU->setVSPFlagSubParts( vspFlag[uiMRGIndex], uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
 #endif
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
         if( uiMRGIndex == pcCU->getUseDDDCandIdx() )
@@ -4853,4 +4889,5 @@
             pcCU->setUseDDD( false, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
         }
+#endif
 #endif
 #if H_3D_SPIVMP
@@ -4930,6 +4967,8 @@
         pcCU->setSPIVMPFlagSubParts(0, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 
 #endif
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
         pcCU->setUseDDD( false, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
+#endif
 #endif
         // set ME result
@@ -5314,4 +5353,7 @@
 #endif
 #if H_3D_INTER_SDC
+#if HHI_TOOL_PARAMETERS_I2_J0107  
+   pcPatternKey->setSDCMRSADFlag( pcCU->getSlice()->getInterSdcFlag() );
+#else
   if ( pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getVPS()->getInterSDCFlag( pcCU->getSlice()->getLayerIdInVps() ) )
   {
@@ -5322,4 +5364,5 @@
     pcPatternKey->setSDCMRSADFlag( false );
   }
+#endif
 #endif
 
Index: trunk/source/Lib/TLibEncoder/TEncSlice.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSlice.cpp	(revision 1085)
+++ trunk/source/Lib/TLibEncoder/TEncSlice.cpp	(revision 1124)
@@ -215,4 +215,9 @@
   rpcSlice->setPicOutputFlag( true );
   rpcSlice->setPOC( pocCurr );
+#if HHI_TOOL_PARAMETERS_I2_J0107
+#if H_3D
+  rpcSlice->init3dToolParameters(); 
+#endif
+#endif
 #if H_3D_IC
   rpcSlice->setApplyIC( false );
@@ -608,4 +613,11 @@
   rpcSlice->setSliceSegmentArgument ( m_pcCfg->getSliceSegmentArgument() );
 #if H_3D_IV_MERGE
+#if HHI_TOOL_PARAMETERS_I2_J0107
+#if ALGIN_J0107_J0059
+  rpcSlice->setMaxNumMergeCand      ( m_pcCfg->getMaxNumMergeCand()   + ( ( rpcSlice->getMpiFlag( ) || rpcSlice->getIvMvPredFlag( ) || rpcSlice->getViewSynthesisPredFlag( )   ) ? 1 : 0 ));
+#else
+  rpcSlice->setMaxNumMergeCand      ( m_pcCfg->getMaxNumMergeCand()   + ( ( rpcSlice->getMpiFlag( ) || rpcSlice->getIvMvPredFlag( ) ) ? 1 : 0 ));
+#endif
+#else
   if(rpcSlice->getIsDepth())
   {
@@ -614,6 +626,11 @@
   else
   {
+#if MTK_MRG_LIST_SIZE_CLEANUP_J0059
+    rpcSlice->setMaxNumMergeCand      ( m_pcCfg->getMaxNumMergeCand()   + ( rpcSlice->getVPS()->getIvMvPredFlag( rpcSlice->getLayerIdInVps() )  || rpcSlice->getVPS()->getViewSynthesisPredFlag( rpcSlice->getLayerIdInVps() ) ? 1 : 0 ) );
+#else
     rpcSlice->setMaxNumMergeCand      ( m_pcCfg->getMaxNumMergeCand()   + ( rpcSlice->getVPS()->getIvMvPredFlag( rpcSlice->getLayerIdInVps() ) ? 1 : 0 ) );
-  }
+#endif
+  }
+#endif
 #else
   rpcSlice->setMaxNumMergeCand        ( m_pcCfg->getMaxNumMergeCand()        );
@@ -1011,4 +1028,37 @@
     }
   }
+#if LGE_DEFAULT_DV_J0046 && !SEC_ARP_VIEW_REF_CHECK_J0037 && !SEC_DBBP_VIEW_REF_CHECK_J0037
+  pcSlice->setDefaultRefViewIdx( -1 );
+  pcSlice->setDefaultRefViewIdxAvailableFlag( false ); 
+
+  Int valid = 0;
+  Int viewIndex = 0;
+  for( UInt uiBId = 0; uiBId < pcSlice->getViewIndex() && valid==0; uiBId++ )
+  {
+      UInt        uiBaseId    = uiBId;
+      TComPic*    pcBasePic   = pcSlice->getIvPic( false, uiBaseId );
+      for( Int iRefListId = 0; ( iRefListId < (pcSlice->isInterB()? 2:1) ) && !pcSlice->isIntra() && valid==0; iRefListId++ )
+      {
+          RefPicList  eRefPicListTest = RefPicList( iRefListId );
+          Int         iNumRefPics = pcSlice->getNumRefIdx( eRefPicListTest ) ;
+          for( Int iRefIndex = 0; iRefIndex < iNumRefPics; iRefIndex++ )
+          { 
+              if(pcBasePic->getPOC() == pcSlice->getRefPic( eRefPicListTest, iRefIndex )->getPOC() 
+                  && pcBasePic->getViewIndex() == pcSlice->getRefPic( eRefPicListTest, iRefIndex )->getViewIndex())
+              {
+                  valid=1;
+                  viewIndex = uiBaseId;
+                  break;
+              }
+          }
+      }
+  }
+  if( valid )
+  {
+      pcSlice->setDefaultRefViewIdx( viewIndex );
+      pcSlice->setDefaultRefViewIdxAvailableFlag( true );   
+  }
+#endif
+
   // for every CU in slice
 #if H_3D
@@ -1169,5 +1219,4 @@
 #endif
       }
-
       // run CU encoder
       m_pcCuEncoder->compressCU( pcCU );
Index: trunk/source/Lib/TLibEncoder/TEncSlice.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSlice.h	(revision 1085)
+++ trunk/source/Lib/TLibEncoder/TEncSlice.h	(revision 1124)
@@ -107,8 +107,10 @@
   UInt                    m_uiSliceIdx;
   std::vector<TEncSbac*> CTXMem;
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
   Int          m_iDDDScale;
   Int          m_iDDDOffset;
   UInt         m_uiDDDPrecision;
+#endif
 #endif
 public:
@@ -145,7 +147,8 @@
   Void      initCtxMem( UInt i );
   Void      setCtxMem( TEncSbac* sb, Int b )   { CTXMem[b] = sb; }
-
+#if !LGE_DDD_REMOVAL_J0042_J0030
 #if H_3D_DDD
   Void setDDDPar( Int iScale, Int iOffset, UInt uiPrecision ){ m_iDDDScale = iScale; m_iDDDOffset = iOffset; m_uiDDDPrecision = uiPrecision; }
+#endif
 #endif
 
Index: trunk/source/Lib/TLibEncoder/TEncTop.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncTop.cpp	(revision 1085)
+++ trunk/source/Lib/TLibEncoder/TEncTop.cpp	(revision 1124)
@@ -534,5 +534,5 @@
 Void TEncTop::encode(Bool flush, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded, bool isTff, Int gopId )
 {
-  assert( 0 ); // Field coding and multiview need to be furhter harmonized. 
+  assert( 0 ); // Field coding and multiview need to be further harmonized. 
 }
 #else
@@ -896,5 +896,14 @@
 #if H_MV
   m_cPPS.setLayerId( getLayerId() );
+#if HHI_DEPENDENCY_SIGNALLING_I1_J0107
+#if H_3D
+  // Check if this condition is still correct
+  if( getVPS()->getNumRefListLayers( getLayerId() ) > 0 )
+#else
   if( getVPS()->getNumDirectRefLayers( getLayerId() ) > 0 )
+#endif
+#else
+  if( getVPS()->getNumDirectRefLayers( getLayerId() ) > 0 )
+#endif
   {
     m_cPPS.setListsModificationPresentFlag( true );
Index: trunk/source/Lib/TLibEncoder/TEncTop.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncTop.h	(revision 1085)
+++ trunk/source/Lib/TLibEncoder/TEncTop.h	(revision 1124)
@@ -270,4 +270,9 @@
   Void                    setIvPicLists         ( TComPicLists* picLists) { m_ivPicLists = picLists; }
 #endif
+#if HHI_TOOL_PARAMETERS_I2_J0107
+#if H_3D
+  Void                    setSps3dExtension     ( TComSps3dExtension sps3dExtension ) { m_cSPS.setSps3dExtension( sps3dExtension );  };
+#endif
+#endif
 #if H_3D_IC
   Void                    setICEnableCandidate         ( Int* ICEnableCandidate) { m_aICEnableCandidate = ICEnableCandidate; }
Index: trunk/source/Lib/TLibExtractor/TExtrTop.cpp
===================================================================
--- trunk/source/Lib/TLibExtractor/TExtrTop.cpp	(revision 1085)
+++ trunk/source/Lib/TLibExtractor/TExtrTop.cpp	(revision 1124)
@@ -73,6 +73,11 @@
      TComSPS     cSPS;
 #if H_3D
-     Int layerIdInVPS = m_cVPS.getLayerIdInVps( uiLayerId ); 
+
+#if HHI_TOOL_PARAMETERS_I2_J0107
+     m_cEntropyDecoder   .decodeSPS( &cSPS );
+#else
+      Int layerIdInVPS = m_cVPS.getLayerIdInVps( uiLayerId ); 
      m_cEntropyDecoder   .decodeSPS( &cSPS, m_cVPS.getViewIndex( layerIdInVPS ), ( m_cVPS.getDepthId( layerIdInVPS ) == 1 ) );
+#endif
 #else
      m_cEntropyDecoder   .decodeSPS( &cSPS );
