Index: /branches/HTM-11.2-dev3-Samsung/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /branches/HTM-11.2-dev3-Samsung/source/Lib/TLibCommon/TypeDef.h	(revision 1013)
+++ /branches/HTM-11.2-dev3-Samsung/source/Lib/TLibCommon/TypeDef.h	(revision 1014)
@@ -299,4 +299,5 @@
 #define SHARP_DMM1_I0110                  1   // LUT size reduction for DMM1 proposed in JCT3V-I0110 
 #define FIX_WARNING                       1   // fix narrowing conversion of NumPocStCurr0,NumPocStCurr1 at TComSlice.cpp
+#define FAST_SDC_OFFSET_DECISION_I0084    1
 
 #if H_3D_DIM_DLT
Index: /branches/HTM-11.2-dev3-Samsung/source/Lib/TLibEncoder/TEncCu.cpp
===================================================================
--- /branches/HTM-11.2-dev3-Samsung/source/Lib/TLibEncoder/TEncCu.cpp	(revision 1013)
+++ /branches/HTM-11.2-dev3-Samsung/source/Lib/TLibEncoder/TEncCu.cpp	(revision 1014)
@@ -2003,6 +2003,28 @@
           if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) && rpcTempCU->getSlice()->getIsDepth() && !uiNoResidual )
           {
+#if FAST_SDC_OFFSET_DECISION_I0084
+            Double dOffsetCost[3] = {MAX_DOUBLE,MAX_DOUBLE,MAX_DOUBLE};
+            for( Int uiOffest = 1 ; uiOffest <= 5 ; uiOffest++ )
+#else
             for( Int uiOffest = -2 ; uiOffest <= 2 ; uiOffest++ )
+#endif
             {
+#if FAST_SDC_OFFSET_DECISION_I0084
+              if( uiOffest > 3)
+              {
+                if ( dOffsetCost[0] < (0.9*dOffsetCost[1]) && dOffsetCost[0] < (0.9*dOffsetCost[2]) )
+                {
+                  continue;
+                }
+                if ( dOffsetCost[1] < dOffsetCost[0] && dOffsetCost[0] < dOffsetCost[2] &&  uiOffest == 5)
+                {
+                  continue;
+                }
+                if ( dOffsetCost[0] < dOffsetCost[1] && dOffsetCost[2] < dOffsetCost[0] &&  uiOffest == 4)
+                {
+                  continue;
+                }
+              }
+#endif
               if( rpcTempCU != rpcTempCUPre )
               {
@@ -2026,4 +2048,26 @@
               }
 #endif
+#if FAST_SDC_OFFSET_DECISION_I0084
+              Int iSdcOffset = 0;
+              if(uiOffest % 2 == 0)
+              {
+                iSdcOffset = uiOffest >> 1;
+              }
+              else
+              {
+                iSdcOffset = -1 * (uiOffest >> 1);
+              }
+              m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU, 
+                m_ppcOrigYuv[uhDepth], 
+                ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth], 
+                m_ppcResiYuvTemp[uhDepth], 
+                m_ppcRecoYuvTemp[uhDepth],
+                iSdcOffset,
+                uhDepth );
+              if (uiOffest <= 3 )
+              {
+                dOffsetCost [uiOffest -1] = rpcTempCU->getTotalCost();
+              }
+#else
               m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU, 
                 m_ppcOrigYuv[uhDepth], 
@@ -2033,4 +2077,5 @@
                 uiOffest,
                 uhDepth );
+#endif
 
               xCheckDQP( rpcTempCU );
@@ -2239,6 +2284,28 @@
   if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) && rpcTempCU->getSlice()->getIsDepth() && ePartSize == SIZE_2Nx2N)
   {
+#if FAST_SDC_OFFSET_DECISION_I0084
+    Double dOffsetCost[3] = {MAX_DOUBLE,MAX_DOUBLE,MAX_DOUBLE};
+    for( Int uiOffest = 1 ; uiOffest <= 5 ; uiOffest++ )
+#else
     for( Int uiOffest = -2 ; uiOffest <= 2 ; uiOffest++ )
-    {
+#endif
+    {
+#if FAST_SDC_OFFSET_DECISION_I0084
+      if( uiOffest > 3)
+      {
+        if ( dOffsetCost[0] < (0.9*dOffsetCost[1]) && dOffsetCost[0] < (0.9*dOffsetCost[2]) )
+        {
+          continue;
+        }
+        if ( dOffsetCost[1] < dOffsetCost[0] && dOffsetCost[0] < dOffsetCost[2] &&  uiOffest == 5)
+        {
+          continue;
+        }
+        if ( dOffsetCost[0] < dOffsetCost[1] && dOffsetCost[2] < dOffsetCost[0] &&  uiOffest == 4)
+        {
+          continue;
+        }
+      }
+#endif
       if( rpcTempCU != rpcTempCUPre )
       {
@@ -2264,4 +2331,26 @@
 #endif
 
+#if FAST_SDC_OFFSET_DECISION_I0084
+      Int iSdcOffset = 0;
+      if(uiOffest % 2 == 0)
+      {
+        iSdcOffset = uiOffest >> 1;
+      }
+      else
+      {
+        iSdcOffset = -1 * (uiOffest >> 1);
+      }
+      m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU, 
+        m_ppcOrigYuv[uhDepth],
+        ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth],
+        m_ppcResiYuvTemp[uhDepth],
+        m_ppcRecoYuvTemp[uhDepth],
+        iSdcOffset,
+        uhDepth );
+      if (uiOffest <= 3 )
+      {
+        dOffsetCost [uiOffest -1] = rpcTempCU->getTotalCost();
+      }
+#else
       m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU, 
         m_ppcOrigYuv[uhDepth],
@@ -2271,4 +2360,5 @@
         uiOffest,
         uhDepth );
+#endif
 
       xCheckDQP( rpcTempCU );
Index: /branches/HTM-11.2-dev3-Samsung/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- /branches/HTM-11.2-dev3-Samsung/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 1013)
+++ /branches/HTM-11.2-dev3-Samsung/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 1014)
@@ -3284,10 +3284,43 @@
 #endif
         pcCU->setSDCFlagSubParts( (uiSDC != 0), uiPartOffset, uiDepth + uiInitTrDepth );
+#if FAST_SDC_OFFSET_DECISION_I0084
+        Double dOffsetCost[3] = {MAX_DOUBLE,MAX_DOUBLE,MAX_DOUBLE};
+        for( Int iOffset = 1; iOffset <= 5; iOffset++ )
+#else
         for( Int iSDCDeltaResi = -2; iSDCDeltaResi <= 2; iSDCDeltaResi++ )
-        {
+#endif
+        {
+#if FAST_SDC_OFFSET_DECISION_I0084
+          Int iSDCDeltaResi = 0;
+          if(iOffset % 2 == 0)
+          {
+            iSDCDeltaResi = iOffset >> 1;
+          }
+          else
+          {
+            iSDCDeltaResi = -1 * (iOffset >> 1);
+          }
+#endif
           if( ( uiSDC == 0 ) && iSDCDeltaResi != 0 )
           {
             continue;
           }
+#if FAST_SDC_OFFSET_DECISION_I0084
+          if( iOffset > 3)
+          {
+            if ( dOffsetCost[0] < (0.9*dOffsetCost[1]) && dOffsetCost[0] < (0.9*dOffsetCost[2]) )
+            {
+              continue;
+            }
+            if ( dOffsetCost[1] < dOffsetCost[0] && dOffsetCost[0] < dOffsetCost[2] &&  iOffset == 5)
+            {
+              continue;
+            }
+            if ( dOffsetCost[0] < dOffsetCost[1] && dOffsetCost[2] < dOffsetCost[0] &&  iOffset == 4)
+            {
+              continue;
+            }
+          }
+#endif
 #endif
       
@@ -3335,4 +3368,10 @@
           // start encoding with SDC
           xIntraCodingSDC(pcCU, uiPartOffset, pcOrgYuv, pcPredYuv, uiPUDistY, dPUCost, ( testZeroResi != 0 ), iSDCDeltaResi );
+#if FAST_SDC_OFFSET_DECISION_I0084
+          if ( testZeroResi == 0 && iOffset <= 3 )
+          {
+            dOffsetCost [iOffset -1] = dPUCost;
+          }
+#endif
         }
         else
