Index: branches/HTM-5.1-dev1-LG/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- branches/HTM-5.1-dev1-LG/source/Lib/TLibCommon/TComDataCU.cpp	(revision 251)
+++ branches/HTM-5.1-dev1-LG/source/Lib/TLibCommon/TComDataCU.cpp	(revision 253)
@@ -3096,4 +3096,58 @@
 }
 
+#if LGE_ILLUCOMP_DEPTH_C0046
+//This modification is not needed after integrating JCT3V-C0137
+Bool TComDataCU::isICFlagRequired(UInt uiAbsPartIdx, UInt uiDepth)
+{
+  UInt uiPartAddr;
+  UInt iNumbPart;
+
+  if(!getSlice()->getIsDepth())
+  {
+    Int iWidth, iHeight;
+
+    iNumbPart = ( getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ? 1 : (getPartitionSize(uiAbsPartIdx) == SIZE_NxN ? 4 : 2) );
+
+    for(UInt i = 0; i < iNumbPart; i++)
+    {
+      getPartIndexAndSize(i, uiPartAddr, iWidth, iHeight, uiAbsPartIdx, true);
+      uiPartAddr += uiAbsPartIdx;
+
+      for(UInt uiRefIdx = 0; uiRefIdx < 2; uiRefIdx++)
+      {
+        RefPicList eRefList = uiRefIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
+        Int iBestRefIdx = getCUMvField(eRefList)->getRefIdx(uiPartAddr);
+
+        if((getInterDir(uiPartAddr) & (uiRefIdx+1)) && iBestRefIdx >= 0 && getSlice()->getViewId() != getSlice()->getRefViewId(eRefList, iBestRefIdx))
+        {
+          return true;
+        }
+      }
+    }
+  }
+  else
+  {
+    iNumbPart = getPic()->getNumPartInCU() >> (uiDepth << 1);
+
+    for(UInt i = 0; i < iNumbPart; i++)
+    {
+      uiPartAddr = uiAbsPartIdx + i;
+
+      for(UInt uiRefIdx = 0; uiRefIdx < 2; uiRefIdx++)
+      {
+        RefPicList eRefList = uiRefIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
+        Int iBestRefIdx = getCUMvField(eRefList)->getRefIdx(uiPartAddr);
+
+        if((getInterDir(uiPartAddr) & (uiRefIdx+1)) && iBestRefIdx >= 0 && getSlice()->getViewId() != getSlice()->getRefViewId(eRefList, iBestRefIdx))
+        {
+          return true;
+        }
+      }
+    }
+  }
+
+  return false;
+}
+#else
 Bool TComDataCU::isICFlagRequired(UInt uiAbsPartIdx)
 {
@@ -3124,4 +3178,5 @@
   return false;
 }
+#endif
 #endif
 
Index: branches/HTM-5.1-dev1-LG/source/Lib/TLibCommon/TComDataCU.h
===================================================================
--- branches/HTM-5.1-dev1-LG/source/Lib/TLibCommon/TComDataCU.h	(revision 251)
+++ branches/HTM-5.1-dev1-LG/source/Lib/TLibCommon/TComDataCU.h	(revision 253)
@@ -482,5 +482,9 @@
   Void          setICFlag             ( UInt uiIdx, Bool  uh )  { m_pbICFlag[uiIdx] = uh;          }
   Void          setICFlagSubParts     ( Bool bICFlag,  UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
+#if LGE_ILLUCOMP_DEPTH_C0046
+  Bool          isICFlagRequired      (UInt uiAbsPartIdx, UInt uiDepth); //This modification is not needed after integrating JCT3V-C0137
+#else
   Bool          isICFlagRequired      (UInt uiAbsPartIdx);
+#endif
 #endif
 
Index: branches/HTM-5.1-dev1-LG/source/Lib/TLibCommon/TComPrediction.cpp
===================================================================
--- branches/HTM-5.1-dev1-LG/source/Lib/TLibCommon/TComPrediction.cpp	(revision 251)
+++ branches/HTM-5.1-dev1-LG/source/Lib/TLibCommon/TComPrediction.cpp	(revision 253)
@@ -786,6 +786,13 @@
     UInt uiRShift = ( bi ? 14-g_uiBitDepth-g_uiBitIncrement : 0 );
     UInt uiOffset = bi ? IF_INTERNAL_OFFS : 0;
+#if LGE_ILLUCOMP_DEPTH_C0046
+    Bool bICFlag = pcCU->getICFlag(uiPartAddr) && (pcCU->getSlice()->getRefViewId( eRefPicList, iRefIdx ) != pcCU->getSlice()->getViewId());
+#endif
 #if DEPTH_MAP_GENERATION
-    xPredInterPrdDepthMap( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, 0, 0, rpcYuvPred, uiRShift, uiOffset );
+    xPredInterPrdDepthMap( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, 0, 0, rpcYuvPred, uiRShift, uiOffset 
+#if LGE_ILLUCOMP_DEPTH_C0046
+        , bICFlag
+#endif
+        );
 #else
     xPredInterPrdDepthMap( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, uiRShift, uiOffset );
@@ -889,5 +896,9 @@
 Void 
 #if DEPTH_MAP_GENERATION
-TComPrediction::xPredInterPrdDepthMap( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuv, UInt uiRShift, UInt uiOffset )
+TComPrediction::xPredInterPrdDepthMap( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuv, UInt uiRShift, UInt uiOffset 
+#if LGE_ILLUCOMP_DEPTH_C0046
+, Bool bICFlag
+#endif
+)
 #else
 TComPrediction::xPredInterPrdDepthMap( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight, TComYuv*& rpcYuv, UInt uiRShift, UInt uiOffset )
@@ -941,4 +952,31 @@
     }
   }
+
+#if LGE_ILLUCOMP_DEPTH_C0046
+  if(bICFlag)
+  {
+    Int a, b, iShift;
+    TComMv tTmpMV(pcMv->getHor()<<2, pcMv->getVer()<<2);
+
+    piRefY      = pcPicYuvRef->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr ) + iRefOffset;
+    piDstY      = rpcYuv->getLumaAddr( uiPartAddr );
+
+    xGetLLSICPrediction(pcCU, &tTmpMV, pcPicYuvRef, a, b, iShift);
+
+    for( Int y = 0; y < iHeight; y++, piDstY += iDstStride, piRefY += iRefStride )
+    {
+      for( Int x = 0; x < iWidth; x++ )
+      {
+        if(uiOffset)
+        {
+          Int iIFshift = IF_INTERNAL_PREC - ( g_uiBitDepth + g_uiBitIncrement );
+          piDstY[ x ] = ( (a*piDstY[ x ]+a*IF_INTERNAL_OFFS) >> iShift ) + b*(1<<iIFshift) - IF_INTERNAL_OFFS;
+        }
+        else
+          piDstY[ x ] = Clip( ( (a*piDstY[ x ]) >> iShift ) + b );
+      }
+    }
+  }
+#endif
 }
 
@@ -1704,6 +1742,11 @@
   iCUPelX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]];
   iCUPelY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]];
+#if FIX_LGE_ILLUCOMP_B0045
+  iRefX   = iCUPelX + (pMv->getHor() >> 2);
+  iRefY   = iCUPelY + (pMv->getVer() >> 2);
+#else
   iRefX   = iCUPelX + (pMv->getHor() >> 3);
   iRefY   = iCUPelY + (pMv->getVer() >> 3);
+#endif
   uiWidth = pcCU->getWidth(0) >> 1;
   uiHeight = pcCU->getHeight(0) >> 1;
Index: branches/HTM-5.1-dev1-LG/source/Lib/TLibCommon/TComPrediction.h
===================================================================
--- branches/HTM-5.1-dev1-LG/source/Lib/TLibCommon/TComPrediction.h	(revision 251)
+++ branches/HTM-5.1-dev1-LG/source/Lib/TLibCommon/TComPrediction.h	(revision 253)
@@ -90,5 +90,9 @@
 #if DEPTH_MAP_GENERATION
   Void xPredInterBi             ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap );
-  Void xPredInterPrdDepthMap    ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuv, UInt uiRShift, UInt uiOffset );
+  Void xPredInterPrdDepthMap    ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuv, UInt uiRShift, UInt uiOffset 
+#if LGE_ILLUCOMP_DEPTH_C0046
+      , Bool bICFlag = false
+#endif
+      );
 #else
   Void xPredInterBi             ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight,                         TComYuv*& rpcYuvPred, Int iPartIdx          );
Index: branches/HTM-5.1-dev1-LG/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- branches/HTM-5.1-dev1-LG/source/Lib/TLibCommon/TComSlice.cpp	(revision 251)
+++ branches/HTM-5.1-dev1-LG/source/Lib/TLibCommon/TComSlice.cpp	(revision 253)
@@ -1382,5 +1382,9 @@
     Int iRefStride = pcRefPicYuvOrg->getStride();
     Int iSumOrgSAD = 0;
+#if LGE_ILLUCOMP_DEPTH_C0046
+    Double dThresholdOrgSAD = getIsDepth() ? 0.1 : 0.05;
+#else
     double dThresholdOrgSAD = 0.05;
+#endif
     // Histogram building - luminance
     for ( Int y = 0; y < iHeight; y++)
Index: branches/HTM-5.1-dev1-LG/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- branches/HTM-5.1-dev1-LG/source/Lib/TLibCommon/TypeDef.h	(revision 251)
+++ branches/HTM-5.1-dev1-LG/source/Lib/TLibCommon/TypeDef.h	(revision 253)
@@ -140,4 +140,6 @@
 #if LGE_ILLUCOMP_B0045
 #define LGE_ILLUCOMP_B0045_ENCSIMP        1
+#define FIX_LGE_ILLUCOMP_B0045            1
+#define LGE_ILLUCOMP_DEPTH_C0046          1   // JCT2-C0046 Apply illumination compensation to depth
 #endif
 
