Index: /branches/HTM-DEV-2.0-dev2-Sharp/source/Lib/TLibCommon/TComPrediction.cpp
===================================================================
--- /branches/HTM-DEV-2.0-dev2-Sharp/source/Lib/TLibCommon/TComPrediction.cpp	(revision 551)
+++ /branches/HTM-DEV-2.0-dev2-Sharp/source/Lib/TLibCommon/TComPrediction.cpp	(revision 552)
@@ -39,4 +39,10 @@
 #include "TComPrediction.h"
 
+#if SHARP_ILLUCOMP_REFINE_E0046
+#define IC_REG_COST_SHIFT 7
+#define IC_CONST_SHIFT 5
+#define IC_SHIFT_DIFF 12
+#endif
+
 //! \ingroup TLibCommon
 //! \{
@@ -131,8 +137,16 @@
   }
 #if H_3D_IC
+#if SHARP_ILLUCOMP_REFINE_E0046
+  m_uiaShift[0] = 0;
   for( Int i = 1; i < 64; i++ )
   {
+    m_uiaShift[i] = ( (1 << 15) + i/2 ) / i;
+  }
+#else
+  for( Int i = 1; i < 64; i++ )
+  {
     m_uiaShift[i-1] = ( (1 << 15) + i/2 ) / i;
   }
+#endif
 #endif
 }
@@ -679,4 +693,7 @@
 #endif
       , bICFlag );
+#if SHARP_ILLUCOMP_REFINE_E0046
+    bICFlag = bICFlag && (iWidth > 8);
+#endif
     xPredInterChromaBlk( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi
 #if H_3D_ARP
@@ -973,7 +990,15 @@
   if( bICFlag )
   {
+#if SHARP_ILLUCOMP_REFINE_E0046
+    Int a, b, i, j;
+    const Int iShift = IC_CONST_SHIFT;
+
+    xGetLLSICPrediction( cu, mv, refPic, a, b, TEXT_LUMA );
+#else
     Int a, b, iShift, i, j;
 
     xGetLLSICPrediction( cu, mv, refPic, a, b, iShift, TEXT_LUMA );
+#endif
+
 
     for ( i = 0; i < height; i++ )
@@ -1093,6 +1118,12 @@
   if( bICFlag )
   {
+#if SHARP_ILLUCOMP_REFINE_E0046
+    Int a, b, i, j;
+    const Int iShift = IC_CONST_SHIFT;
+    xGetLLSICPrediction( cu, mv, refPic, a, b, TEXT_CHROMA_U ); // Cb
+#else
     Int a, b, iShift, i, j;
     xGetLLSICPrediction( cu, mv, refPic, a, b, iShift, TEXT_CHROMA_U ); // Cb
+#endif
     for ( i = 0; i < cxHeight; i++ )
     {
@@ -1109,5 +1140,9 @@
       dstCb += dstStride;
     }
+#if SHARP_ILLUCOMP_REFINE_E0046
+    xGetLLSICPrediction( cu, mv, refPic, a, b, TEXT_CHROMA_V ); // Cr
+#else
     xGetLLSICPrediction( cu, mv, refPic, a, b, iShift, TEXT_CHROMA_V ); // Cr
+#endif
     for ( i = 0; i < cxHeight; i++ )
     {
@@ -1316,5 +1351,9 @@
 /** Function for deriving LM illumination compensation.
  */
+#if SHARP_ILLUCOMP_REFINE_E0046
+Void TComPrediction::xGetLLSICPrediction( TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, TextType eType )
+#else
 Void TComPrediction::xGetLLSICPrediction( TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, Int &iShift, TextType eType )
+#endif
 {
   TComPicYuv *pRecPic = pcCU->getPic()->getPicYuvRec();
@@ -1344,4 +1383,7 @@
 
   Int x = 0, y = 0, xx = 0, xy = 0;
+#if SHARP_ILLUCOMP_REFINE_E0046
+  Int precShift = std::max(0, (( eType == TEXT_LUMA ) ? g_bitDepthY : g_bitDepthC) - 12);
+#endif
 
   if( pcCU->getPUAbove( uiTmpPartIdx, pcCU->getZorderIdxInCU() ) && iCUPelY > 0 && iRefY > 0 )
@@ -1365,12 +1407,25 @@
     }
 
+#if SHARP_ILLUCOMP_REFINE_E0046
+    for( j = 0; j < uiWidth; j+=2 )
+#else
     for( j = 0; j < uiWidth; j++ )
+#endif
     {
       x += pRef[j];
       y += pRec[j];
+#if SHARP_ILLUCOMP_REFINE_E0046
+      xx += (pRef[j] * pRef[j])>>precShift;
+      xy += (pRef[j] * pRec[j])>>precShift;
+#else
       xx += pRef[j] * pRef[j];
       xy += pRef[j] * pRec[j];
-    }
+#endif
+    }
+#if SHARP_ILLUCOMP_REFINE_E0046
+    iCountShift += g_aucConvertToBit[ uiWidth ] + 1;
+#else
     iCountShift += g_aucConvertToBit[ uiWidth ] + 2;
+#endif
   }
 
@@ -1396,8 +1451,19 @@
     }
 
+#if SHARP_ILLUCOMP_REFINE_E0046
+    for( i = 0; i < uiHeight; i+=2 )
+#else
     for( i = 0; i < uiHeight; i++ )
+#endif
     {
       x += pRef[0];
       y += pRec[0];
+#if SHARP_ILLUCOMP_REFINE_E0046
+      xx += (pRef[0] * pRef[0])>>precShift;
+      xy += (pRef[0] * pRec[0])>>precShift;
+
+      pRef += iRefStride*2;
+      pRec += iRecStride*2;
+#else
       xx += pRef[0] * pRef[0];
       xy += pRef[0] * pRec[0];
@@ -1405,8 +1471,21 @@
       pRef += iRefStride;
       pRec += iRecStride;
-    }
+#endif
+    }
+#if SHARP_ILLUCOMP_REFINE_E0046
+    iCountShift += iCountShift > 0 ? 1 : ( g_aucConvertToBit[ uiWidth ] + 1 );
+#else
     iCountShift += iCountShift > 0 ? 1 : ( g_aucConvertToBit[ uiWidth ] + 2 );
-  }
-
+#endif
+  }
+
+#if SHARP_ILLUCOMP_REFINE_E0046
+  xy += xx >> IC_REG_COST_SHIFT;
+  xx += xx >> IC_REG_COST_SHIFT;
+  Int a1 = ( xy << iCountShift ) - ((y * x) >> precShift);
+  Int a2 = ( xx << iCountShift ) - ((x * x) >> precShift);
+  const Int iShift = IC_CONST_SHIFT;
+  {
+#else
   Int iTempShift = ( ( eType == TEXT_LUMA ) ? g_bitDepthY : g_bitDepthC ) + g_aucConvertToBit[ uiWidth ] + 3 - 15;
 
@@ -1432,8 +1511,10 @@
     Int a1 = ( xy << iCountShift ) - y * x;
     Int a2 = ( xx << iCountShift ) - x * x;              
-
+#endif
     {
       const Int iShiftA2 = 6;
+#if !SHARP_ILLUCOMP_REFINE_E0046
       const Int iShiftA1 = 15;
+#endif
       const Int iAccuracyShift = 15;
 
@@ -1443,6 +1524,12 @@
       Int a2s = a2;
 
+#if SHARP_ILLUCOMP_REFINE_E0046
+      a1 = Clip3(0, 2*a2, a1);
+      iScaleShiftA2 = GetMSB( abs( a2 ) ) - iShiftA2;
+      iScaleShiftA1 = iScaleShiftA2 - IC_SHIFT_DIFF;
+#else
       iScaleShiftA1 = GetMSB( abs( a1 ) ) - iShiftA1;
       iScaleShiftA2 = GetMSB( abs( a2 ) ) - iShiftA2;  
+#endif
 
       if( iScaleShiftA1 < 0 )
@@ -1458,8 +1545,13 @@
       Int iScaleShiftA = iScaleShiftA2 + iAccuracyShift - iShift - iScaleShiftA1;
 
+
       a2s = a2 >> iScaleShiftA2;
 
       a1s = a1 >> iScaleShiftA1;
 
+#if SHARP_ILLUCOMP_REFINE_E0046
+      a = a1s * m_uiaShift[ a2s ];
+      a = a >> iScaleShiftA;
+#else
       if (a2s >= 1)
       {
@@ -1494,5 +1586,5 @@
         iShift -= (9-n);
       }
-
+#endif
       b = (  y - ( ( a * x ) >> iShift ) + ( 1 << ( iCountShift - 1 ) ) ) >> iCountShift;
     }
Index: /branches/HTM-DEV-2.0-dev2-Sharp/source/Lib/TLibCommon/TComPrediction.h
===================================================================
--- /branches/HTM-DEV-2.0-dev2-Sharp/source/Lib/TLibCommon/TComPrediction.h	(revision 551)
+++ /branches/HTM-DEV-2.0-dev2-Sharp/source/Lib/TLibCommon/TComPrediction.h	(revision 552)
@@ -76,5 +76,9 @@
   Int    m_iLumaRecStride;       ///< stride of #m_pLumaRecBuffer array
 #if H_3D_IC
+#if SHARP_ILLUCOMP_REFINE_E0046
+  UInt   m_uiaShift[ 64 ];       // Table for multiplication to substitue of division operation
+#else
   UInt   m_uiaShift[ 63 ];       // Table for multiplication to substitue of division operation
+#endif
 #endif
 
@@ -127,5 +131,9 @@
   Void xGetLLSPrediction ( TComPattern* pcPattern, Int* pSrc0, Int iSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt uiExt0 );
 #if H_3D_IC
+#if SHARP_ILLUCOMP_REFINE_E0046
+  Void xGetLLSICPrediction( TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, TextType eType );
+#else
   Void xGetLLSICPrediction( TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, Int &iShift, TextType eType );
+#endif
 #endif
   Void xDCPredFiltering( Int* pSrc, Int iSrcStride, Pel*& rpDst, Int iDstStride, Int iWidth, Int iHeight );
Index: /branches/HTM-DEV-2.0-dev2-Sharp/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /branches/HTM-DEV-2.0-dev2-Sharp/source/Lib/TLibCommon/TypeDef.h	(revision 551)
+++ /branches/HTM-DEV-2.0-dev2-Sharp/source/Lib/TLibCommon/TypeDef.h	(revision 552)
@@ -96,4 +96,7 @@
                                               // Unifying rounding offset, for IC part, JCT3V-D0135
                                               // Full Pel Interpolation for Depth, HHI_FULL_PEL_DEPTH_MAP_MV_ACC
+#define SHARP_ILLUCOMP_REFINE_E0046       1
+
+
 #if H_3D_NBDV
 #define H_3D_NBDV_REF                     1   // Depth oriented neighboring block disparity derivation
