Index: trunk/source/Lib/TLibDecoder/TDecEntropy.cpp
===================================================================
--- trunk/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 189)
+++ trunk/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 296)
@@ -72,5 +72,9 @@
   pcCU->setICFlagSubParts( false , uiAbsPartIdx, 0, uiDepth );
 
-  if (pcCU->isIntra(uiAbsPartIdx) || (pcCU->getSlice()->getViewId() == 0) || pcCU->getSlice()->getSPS()->isDepth())
+  if (pcCU->isIntra(uiAbsPartIdx) || (pcCU->getSlice()->getViewId() == 0) 
+#if !LGE_ILLUCOMP_DEPTH_C0046
+      || pcCU->getSlice()->getSPS()->isDepth()
+#endif
+      )
   {
     return;
@@ -80,5 +84,9 @@
     return;
 
+#if LGE_ILLUCOMP_DEPTH_C0046
+  if(pcCU->isICFlagRequired(uiAbsPartIdx, uiDepth)) //This modification is not needed after integrating JCT3V-C0137
+#else
   if(pcCU->isICFlagRequired(uiAbsPartIdx))
+#endif
     m_pcEntropyDecoderIf->parseICFlag( pcCU, uiAbsPartIdx, uiDepth );
 }
@@ -100,5 +108,5 @@
 }
 
-#if HHI_INTER_VIEW_RESIDUAL_PRED
+#if H3D_IVRP && !MTK_MDIVRP_C0138
 Void
 TDecEntropy::decodeResPredFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU, UInt uiPUIdx )
@@ -115,9 +123,5 @@
   if( bResPredAllowed )
   {
-    bResPredAvailable       = pcSubCU->getResidualSamples( uiPUIdx 
-#if QC_SIMPLIFIEDIVRP_M24938
-      , false
-#endif
-      );
+    bResPredAvailable       = pcSubCU->getResidualSamples( uiPUIdx , false  );
   }
 
@@ -272,5 +276,5 @@
 
 #if CU_BASED_MRG_CAND_LIST
-#if HHI_INTER_VIEW_MOTION_PRED
+#if H3D_IVMP
   TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists
   UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];
@@ -293,5 +297,5 @@
   {
 #if !CU_BASED_MRG_CAND_LIST
-#if HHI_INTER_VIEW_MOTION_PRED
+#if H3D_IVMP
     TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists
     UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];
@@ -326,19 +330,43 @@
       else
       {
-#if SIMP_MRG_PRUN
         uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
         pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
-#else      
-        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
-        uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
-#endif
       }
 #else
-#if SIMP_MRG_PRUN       
       UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
+#if MERL_VSP_C0152
+      Int iVSPIndexTrue[3] = {-1, -1, -1};
+      pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, iVSPIndexTrue, uiMergeIndex );
+
+#if HHI_MPI
+      if(pcCU->getTextureModeDepth( uiSubPartIdx ) == uiDepth)//MPI is used
+      {
+        TComDataCU *pcTextureCU = pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() );
+        UInt uiCurrPartNumb = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);
+        for( UInt ui = 0; ui < uiCurrPartNumb; ui++ )
+        {
+          Int vspIdx = pcTextureCU->getVSPIndex( uiAbsPartIdx + ui);
+          pcCU->setVSPIndex( uiAbsPartIdx + ui, vspIdx);
+        }
+      }
+      else // MPI not used
+#endif
+      {
+        Int iVSPIdx = 0;
+        Int numVspIdx;
+        numVspIdx = 3;
+        for (Int i = 0; i < numVspIdx; i++)
+        {
+          if (iVSPIndexTrue[i] == uiMergeIndex)
+            {
+              iVSPIdx = i+1;
+              break;
+            }
+        }
+        pcCU->setVSPIndexSubParts( iVSPIdx, uiSubPartIdx, uiPartIdx, uiDepth );  //Initialize the VSP, may change later in get InterMergeCandidates()
+      }
+
+#else
       pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
-#else      
-      pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
-      UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
 #endif
 #endif
@@ -485,5 +513,5 @@
   if ( (pcSubCU->getInterDir(uiPartAddr) & ( 1 << eRefList )) && (pcSubCU->getAMVPMode(uiPartAddr) == AM_EXPL) )
   {
-#if HHI_INTER_VIEW_MOTION_PRED
+#if H3D_IVMP
     const Int iNumAMVPCands = AMVP_MAX_NUM_CANDS + ( pcSubCU->getSlice()->getSPS()->getMultiviewMvPredMode() ? 1 : 0 );
     m_pcEntropyDecoderIf->parseMVPIdx( iMVPIdx, iNumAMVPCands );
@@ -492,5 +520,5 @@
 #endif
   }
-#if SHARP_INTERVIEW_DECOUPLE_B0111
+#if H3D_IVMP
   pcSubCU->fillMvpCand(uiPartIdx, uiPartAddr, eRefList, iRefIdx, pAMVPInfo, iMVPIdx);
 #else
@@ -509,14 +537,9 @@
 }
 
-#if UNIFIED_TRANSFORM_TREE
 Void TDecEntropy::xDecodeTransform( TComDataCU* pcCU, UInt offsetLuma, UInt offsetChroma, UInt uiAbsPartIdx, UInt absTUPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, UInt uiInnerQuadIdx, UInt& uiYCbfFront3, UInt& uiUCbfFront3, UInt& uiVCbfFront3, Bool& bCodeDQP )
-#else
-Void TDecEntropy::xDecodeTransformSubdiv( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt absTUPartIdx, UInt uiDepth, UInt uiInnerQuadIdx, UInt& uiYCbfFront3, UInt& uiUCbfFront3, UInt& uiVCbfFront3 )
-#endif
 {
   UInt uiSubdiv;
   const UInt uiLog2TrafoSize = g_aucConvertToBit[pcCU->getSlice()->getSPS()->getMaxCUWidth()]+2 - uiDepth;
 
-#if UNIFIED_TRANSFORM_TREE
   if(uiTrIdx==0)
   {
@@ -532,14 +555,9 @@
     }
   }
-#endif // UNIFIED_TRANSFORM_TREE
   if( pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTRA && pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_NxN && uiDepth == pcCU->getDepth(uiAbsPartIdx) )
   {
     uiSubdiv = 1;
   }
-#if G519_TU_AMP_NSQT_HARMONIZATION
   else if( (pcCU->getSlice()->getSPS()->getQuadtreeTUMaxDepthInter() == 1) && (pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTER) && ( pcCU->getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N ) && (uiDepth == pcCU->getDepth(uiAbsPartIdx)) )
-#else
-  else if( (pcCU->getSlice()->getSPS()->getQuadtreeTUMaxDepthInter() == 1) && (pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTER) && ( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN || pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_Nx2N) && (uiDepth == pcCU->getDepth(uiAbsPartIdx)) )
-#endif
   {
     uiSubdiv = (uiLog2TrafoSize > pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx));
@@ -618,5 +636,4 @@
   if( uiSubdiv )
   {
-#if UNIFIED_TRANSFORM_TREE
     UInt size;
     width  >>= 1;
@@ -624,5 +641,4 @@
     size = width*height;
     uiTrIdx++;
-#endif
     ++uiDepth;
     const UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);
@@ -640,20 +656,12 @@
     for( Int i = 0; i < 4; i++ )
     {
-#if UNIFIED_TRANSFORM_TREE
       UInt nsAddr = 0;
       nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, i, uiTrDepth+1 );
       xDecodeTransform( pcCU, offsetLuma, offsetChroma, uiAbsPartIdx, nsAddr, uiDepth, width, height, uiTrIdx, i, uiCurrentCbfY, uiCurrentCbfU, uiCurrentCbfV, bCodeDQP );
-#else
-      UInt nsAddr = 0;
-      nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, i, uiTrDepth+1 );
-      xDecodeTransformSubdiv( pcCU, uiAbsPartIdx, nsAddr, uiDepth, i, uiCurrentCbfY, uiCurrentCbfU, uiCurrentCbfV );
-#endif
       uiYCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiLumaTrMode );
       uiUCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiChromaTrMode );
       uiVCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiChromaTrMode );
       uiAbsPartIdx += uiQPartNum;
-#if UNIFIED_TRANSFORM_TREE
       offsetLuma += size;  offsetChroma += (size>>2);
-#endif
     }
     
@@ -713,5 +721,4 @@
       }
     }
-#if UNIFIED_TRANSFORM_TREE
     // transform_unit begin
     UInt cbfY = pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA    , uiTrIdx );
@@ -779,23 +786,8 @@
     }
     // transform_unit end
-#endif // UNIFIED_TRANSFORM_TREE
-  }
-}
-
-#if !UNIFIED_TRANSFORM_TREE
-Void TDecEntropy::decodeTransformIdx( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
-{
-  DTRACE_CABAC_VL( g_nSymbolCounter++ )
-  DTRACE_CABAC_T( "\tdecodeTransformIdx()\tCUDepth=" )
-  DTRACE_CABAC_V( uiDepth )
-  DTRACE_CABAC_T( "\n" )
-  UInt temp = 0;
-  UInt temp1 = 0;
-  UInt temp2 = 0;
-  xDecodeTransformSubdiv( pcCU, uiAbsPartIdx, uiAbsPartIdx, uiDepth, 0, temp, temp1, temp2 );
-}
-#endif // UNIFIED_TRANSFORM_TREE
-
-#if UNIFIED_TRANSFORM_TREE
+  }
+}
+
+
 Void TDecEntropy::decodeQP          ( TComDataCU* pcCU, UInt uiAbsPartIdx )
 {
@@ -805,141 +797,5 @@
   }
 }
-#else
-Void TDecEntropy::decodeQP          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
-{
-  if ( pcCU->getSlice()->getPPS()->getUseDQP() )
-  {
-    m_pcEntropyDecoderIf->parseDeltaQP( pcCU, uiAbsPartIdx, uiDepth );
-  }
-}
-#endif
-
-#if !UNIFIED_TRANSFORM_TREE
-Void TDecEntropy::xDecodeCoeff( TComDataCU* pcCU, UInt uiLumaOffset, UInt uiChromaOffset, UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight, UInt uiTrIdx, UInt uiCurrTrIdx, Bool& bCodeDQP )
-{
-  UInt uiLog2TrSize = g_aucConvertToBit[ pcCU->getSlice()->getSPS()->getMaxCUWidth() >> uiDepth ] + 2;
-  UInt uiCbfY = pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrIdx );
-  UInt uiCbfU = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrIdx );
-  UInt uiCbfV = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrIdx );
-  if( uiLog2TrSize == 2 )
-  {
-    UInt uiQPDiv = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 );
-    if( ( uiAbsPartIdx % uiQPDiv ) == 0 )
-    {
-      m_uiBakAbsPartIdx   = uiAbsPartIdx;
-      m_uiBakChromaOffset = uiChromaOffset;
-    }
-    else if( ( uiAbsPartIdx % uiQPDiv ) == (uiQPDiv - 1) )
-    {
-      uiCbfU = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_U, uiTrIdx );
-      uiCbfV = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_V, uiTrIdx );
-    }
-  }
-
-  if ( uiCbfY || uiCbfU || uiCbfV )
-  {
-    // dQP: only for LCU
-    if ( pcCU->getSlice()->getPPS()->getUseDQP() )
-    {
-      if ( bCodeDQP )
-      {
-        decodeQP( pcCU, uiAbsPartIdx, uiDepth);
-        bCodeDQP = false;
-      }
-    }   
-    UInt uiLumaTrMode, uiChromaTrMode;
-    pcCU->convertTransIdx( uiAbsPartIdx, pcCU->getTransformIdx( uiAbsPartIdx ), uiLumaTrMode, uiChromaTrMode );
-    const UInt uiStopTrMode = uiLumaTrMode;
-    
-    if( uiTrIdx == uiStopTrMode )
-    {
-      if( pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrIdx ) )
-      {
-        Int trWidth = uiWidth;
-        Int trHeight = uiHeight;
-        pcCU->getNSQTSize( uiTrIdx, uiAbsPartIdx, trWidth, trHeight );
-        m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffY()+uiLumaOffset), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_LUMA );
-      }
-      
-      uiWidth  >>= 1;
-      uiHeight >>= 1;
-
-      if( uiLog2TrSize == 2 )
-      {
-        UInt uiQPDiv = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 );
-        if( ( uiAbsPartIdx % uiQPDiv ) == (uiQPDiv - 1) )
-        {
-          uiWidth  <<= 1;
-          uiHeight <<= 1;
-          Int trWidth = uiWidth;
-          Int trHeight = uiHeight;
-          pcCU->getNSQTSize( uiTrIdx-1, uiAbsPartIdx, trWidth, trHeight );
-          if( pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ) )
-          {
-            m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCb()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U );
-          }
-          if( pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ) )
-          {
-            m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCr()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V );
-          }
-        }
-      }
-      else
-      {
-        Int trWidth = uiWidth;
-        Int trHeight = uiHeight;
-        pcCU->getNSQTSize( uiTrIdx, uiAbsPartIdx, trWidth, trHeight );
-        if( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ) )
-        {
-          m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCb()+uiChromaOffset), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U );
-        }
-        if( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ) )
-        {
-          m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCr()+uiChromaOffset), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V );
-        }
-      }
-    }
-    else
-    {
-      {
-        DTRACE_CABAC_VL( g_nSymbolCounter++ );
-        DTRACE_CABAC_T( "\tgoing down\tdepth=" );
-        DTRACE_CABAC_V( uiDepth );
-        DTRACE_CABAC_T( "\ttridx=" );
-        DTRACE_CABAC_V( uiTrIdx );
-        DTRACE_CABAC_T( "\n" );
-      }
-      if( uiCurrTrIdx <= uiTrIdx )
-      {
-        assert(1);
-      }
-      UInt uiSize;
-      uiWidth  >>= 1;
-      uiHeight >>= 1;
-      uiSize = uiWidth*uiHeight;
-      uiDepth++;
-      uiTrIdx++;
-      
-      UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);
-      UInt uiIdx      = uiAbsPartIdx;
-      
-      xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP );
-      uiLumaOffset += uiSize;  uiChromaOffset += (uiSize>>2);  uiIdx += uiQPartNum;
-      
-      xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP );
-      uiLumaOffset += uiSize;  uiChromaOffset += (uiSize>>2);  uiIdx += uiQPartNum;
-      
-      xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP );
-      uiLumaOffset += uiSize;  uiChromaOffset += (uiSize>>2);  uiIdx += uiQPartNum;
-      
-      xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP );
-      {
-        DTRACE_CABAC_VL( g_nSymbolCounter++ );
-        DTRACE_CABAC_T( "\tgoing up\n" );
-      }
-    }
-  }
-}
-#endif // !UNIFIED_TRANSFORM_TREE
+
 
 /** decode coefficients
@@ -956,11 +812,7 @@
   UInt uiLumaOffset   = uiMinCoeffSize*uiAbsPartIdx;
   UInt uiChromaOffset = uiLumaOffset>>2;
-#if UNIFIED_TRANSFORM_TREE
   UInt temp  = 0;
   UInt temp1 = 0;
   UInt temp2 = 0;
-#else
-  UInt uiLumaTrMode, uiChromaTrMode;
-#endif
   
 #if RWTH_SDC_DLT_B0036
@@ -980,10 +832,4 @@
   if( pcCU->isIntra(uiAbsPartIdx) )
   {
-#if !UNIFIED_TRANSFORM_TREE
-    decodeTransformIdx( pcCU, uiAbsPartIdx, pcCU->getDepth(uiAbsPartIdx) );
-    
-    pcCU->convertTransIdx( uiAbsPartIdx, pcCU->getTransformIdx(uiAbsPartIdx), uiLumaTrMode, uiChromaTrMode );
-    
-#endif // !UNIFIED_TRANSFORM_TREE
   }
   else
@@ -1007,9 +853,4 @@
     }
     
-#if !UNIFIED_TRANSFORM_TREE
-    decodeTransformIdx( pcCU, uiAbsPartIdx, pcCU->getDepth(uiAbsPartIdx) );
-    
-    pcCU->convertTransIdx( uiAbsPartIdx, pcCU->getTransformIdx(uiAbsPartIdx), uiLumaTrMode, uiChromaTrMode );
-#endif // !UNIFIED_TRANSFORM_TREE
   }
 
@@ -1030,9 +871,5 @@
 #endif
 
-#if UNIFIED_TRANSFORM_TREE
   xDecodeTransform( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, 0, temp, temp1, temp2, bCodeDQP );
-#else // UNIFIED_TRANSFORM_TREE
-  xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, uiLumaTrMode, bCodeDQP );
-#endif // UNIFIED_TRANSFORM_TREE
 
 #if FIX_MPI_B0065
