Index: /branches/HTM-4.0-dev0/CommonTestConditionsCfgs/baseCfg_2view+depth.cfg
===================================================================
--- /branches/HTM-4.0-dev0/CommonTestConditionsCfgs/baseCfg_2view+depth.cfg	(revision 132)
+++ /branches/HTM-4.0-dev0/CommonTestConditionsCfgs/baseCfg_2view+depth.cfg	(revision 133)
@@ -133,5 +133,5 @@
 
 #========== deblocking ==========
-DeblockingFilterControlPresent : 0                                 # Dbl control params present (0=not present, 1=present)
+DeblockingFilterControlPresent : 1                                 # Dbl control params present (0=not present, 1=present)
 LoopFilterOffsetInAPS          : 0                                 # Dbl params in APS or SliceHeader (0=SliceHeader, 1=APS)
 LoopFilterDisable              : 0 1                               # disable deblocking filter
Index: /branches/HTM-4.0-dev0/CommonTestConditionsCfgs/baseCfg_2view.cfg
===================================================================
--- /branches/HTM-4.0-dev0/CommonTestConditionsCfgs/baseCfg_2view.cfg	(revision 132)
+++ /branches/HTM-4.0-dev0/CommonTestConditionsCfgs/baseCfg_2view.cfg	(revision 133)
@@ -127,5 +127,5 @@
 
 #========== deblocking ==========
-DeblockingFilterControlPresent : 0                                 # Dbl control params present (0=not present, 1=present)
+DeblockingFilterControlPresent : 1                                 # Dbl control params present (0=not present, 1=present)
 LoopFilterOffsetInAPS          : 0                                 # Dbl params in APS or SliceHeader (0=SliceHeader, 1=APS)
 LoopFilterDisable              : 0 1                               # disable deblocking filter
Index: /branches/HTM-4.0-dev0/CommonTestConditionsCfgs/baseCfg_3view+depth.cfg
===================================================================
--- /branches/HTM-4.0-dev0/CommonTestConditionsCfgs/baseCfg_3view+depth.cfg	(revision 132)
+++ /branches/HTM-4.0-dev0/CommonTestConditionsCfgs/baseCfg_3view+depth.cfg	(revision 133)
@@ -137,5 +137,5 @@
 
 #========== deblocking ==========
-DeblockingFilterControlPresent : 0                                 # Dbl control params present (0=not present, 1=present)
+DeblockingFilterControlPresent : 1                                 # Dbl control params present (0=not present, 1=present)
 LoopFilterOffsetInAPS          : 0                                 # Dbl params in APS or SliceHeader (0=SliceHeader, 1=APS)
 LoopFilterDisable              : 0 1                               # disable deblocking filter
Index: /branches/HTM-4.0-dev0/CommonTestConditionsCfgs/baseCfg_3view.cfg
===================================================================
--- /branches/HTM-4.0-dev0/CommonTestConditionsCfgs/baseCfg_3view.cfg	(revision 132)
+++ /branches/HTM-4.0-dev0/CommonTestConditionsCfgs/baseCfg_3view.cfg	(revision 133)
@@ -129,5 +129,5 @@
 
 #========== deblocking ==========
-DeblockingFilterControlPresent : 0                                 # Dbl control params present (0=not present, 1=present)
+DeblockingFilterControlPresent : 1                                 # Dbl control params present (0=not present, 1=present)
 LoopFilterOffsetInAPS          : 0                                 # Dbl params in APS or SliceHeader (0=SliceHeader, 1=APS)
 LoopFilterDisable              : 0 1                               # disable deblocking filter
Index: /branches/HTM-4.0-dev0/cfg/encoder_mvd.cfg
===================================================================
--- /branches/HTM-4.0-dev0/cfg/encoder_mvd.cfg	(revision 132)
+++ /branches/HTM-4.0-dev0/cfg/encoder_mvd.cfg	(revision 133)
@@ -136,5 +136,5 @@
 
 #========== deblocking ==========
-DeblockingFilterControlPresent: 0           # Dbl control params present (0=not present, 1=present)
+DeblockingFilterControlPresent: 1           # Dbl control params present (0=not present, 1=present)
 LoopFilterOffsetInAPS         : 0           # Dbl params in APS or SliceHeader (0=SliceHeader, 1=APS)
 LoopFilterDisable              : 0 1                               # disable deblocking filter
Index: /branches/HTM-4.0-dev0/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- /branches/HTM-4.0-dev0/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 132)
+++ /branches/HTM-4.0-dev0/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 133)
@@ -306,5 +306,9 @@
   ("LoopFilterTcOffset_div2", m_loopFilterTcOffsetDiv2, 0 )
 #if DBL_CONTROL
+#if FIX_DBL_CONTROL_DEFAULT
+  ("DeblockingFilterControlPresent", m_DeblockingFilterControlPresent, true)
+#else
   ("DeblockingFilterControlPresent", m_DeblockingFilterControlPresent, false)
+#endif
 #endif
 
Index: /branches/HTM-4.0-dev0/source/Lib/TLibCommon/TComYuv.cpp
===================================================================
--- /branches/HTM-4.0-dev0/source/Lib/TLibCommon/TComYuv.cpp	(revision 132)
+++ /branches/HTM-4.0-dev0/source/Lib/TLibCommon/TComYuv.cpp	(revision 133)
@@ -711,19 +711,20 @@
   getPUXYOffset(uhPartitionSize, uiPartSize, uiPartSize, iXOffset, iYOffset);
 
-  for ( y = uiPartSize-1; y >= iYOffset; y-- )
-  {
-    if(iPUResiPredShift[3] >= 0)
-    {
-      for ( x = uiPartSize-1; x >= iXOffset; x-- )
-      {
-        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[3]);
-      }
-    }
-
-    if(iPUResiPredShift[2] >= 0)
-    {
-      for ( x = iXOffset-1; x >= 0; x-- )
-      {
-        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[2]);
+#if FIX_LG_RESTRICTEDRESPRED_M24766
+  for ( y = 0; y < iYOffset; y++ )
+  {
+    if(iPUResiPredShift[0] >= 0)
+    {
+      for ( x = 0; x < iXOffset; x++ )
+      {
+        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[0]);
+      }
+    }
+
+    if(iPUResiPredShift[1] >= 0)
+    {
+      for ( x = iXOffset; x < uiPartSize; x++ )
+      {
+        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[1]);
       }
     }
@@ -733,19 +734,19 @@
   }
 
-  for ( y = iYOffset-1; y >= 0; y-- )
-  {
-    if(iPUResiPredShift[1] >= 0)
-    {
-      for ( x = uiPartSize-1; x >= iXOffset; x-- )
+  for ( y = iYOffset; y < uiPartSize; y++ )
+  {
+    if(iPUResiPredShift[2] >= 0)
+    {
+      for ( x = 0; x < iXOffset; x++ )
+      {
+        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[2]);
+      }
+    }
+
+    if(iPUResiPredShift[3] >= 0)
+    {
+      for ( x = iXOffset; x < uiPartSize; x++ )
       {
         pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[3]);
-      }
-    }
-
-    if(iPUResiPredShift[0] >= 0)
-    {
-      for ( x = iXOffset-1; x >= 0; x-- )
-      {
-        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[2]);
       }
     }
@@ -754,5 +755,49 @@
     pDst  += iDstStride;
   }
-
+#else
+  for ( y = uiPartSize-1; y >= iYOffset; y-- )
+  {
+    if(iPUResiPredShift[3] >= 0)
+    {
+      for ( x = uiPartSize-1; x >= iXOffset; x-- )
+      {
+        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[3]);
+      }
+    }
+
+    if(iPUResiPredShift[2] >= 0)
+    {
+      for ( x = iXOffset-1; x >= 0; x-- )
+      {
+        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[2]);
+      }
+    }
+    pSrc0 += iSrc0Stride;
+    pSrc1 += iSrc1Stride;
+    pDst  += iDstStride;
+  }
+
+  for ( y = iYOffset-1; y >= 0; y-- )
+  {
+    if(iPUResiPredShift[1] >= 0)
+    {
+      for ( x = uiPartSize-1; x >= iXOffset; x-- )
+      {
+        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[3]);
+      }
+    }
+
+    if(iPUResiPredShift[0] >= 0)
+    {
+      for ( x = iXOffset-1; x >= 0; x-- )
+      {
+        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[2]);
+      }
+    }
+    pSrc0 += iSrc0Stride;
+    pSrc1 += iSrc1Stride;
+    pDst  += iDstStride;
+  }
+#endif
 #else
   for ( y = uiPartSize-1; y >= 0; y-- )
@@ -792,21 +837,22 @@
   getPUXYOffset(uhPartitionSize, uiPartSize, uiPartSize, iXOffset, iYOffset);
 
-  for ( y = uiPartSize-1; y >= iYOffset; y-- )
-  {
-    if(iPUResiPredShift[3] >= 0)
-    {
-      for ( x = uiPartSize-1; x >= iXOffset; x-- )
-      {
-        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[3]);
-        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[3]);
-      }
-    }
-
-    if(iPUResiPredShift[2] >= 0)
-    {
-      for ( x = iXOffset-1; x >= 0; x-- )
-      {
-        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[2]);
-        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[2]);
+#if FIX_LG_RESTRICTEDRESPRED_M24766
+  for ( y = 0; y < iYOffset; y++ )
+  {
+    if(iPUResiPredShift[0] >= 0)
+    {
+      for ( x = 0; x < iXOffset; x++ )
+      {
+        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[0]);
+        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[0]);
+      }
+    }
+
+    if(iPUResiPredShift[1] >= 0)
+    {
+      for ( x = iXOffset; x < uiPartSize; x++ )
+      {
+        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[1]);
+        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[1]);
       }
     }
@@ -819,21 +865,21 @@
   }
 
-  for ( y = iYOffset-1; y >= 0; y-- )
-  {
-    if(iPUResiPredShift[1] >= 0)
-    {
-      for ( x = uiPartSize-1; x >= iXOffset; x-- )
-      {
-        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[1]);
-        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[1]);
-      }
-    }
-
-    if(iPUResiPredShift[0] >= 0)
-    {
-      for ( x = iXOffset-1; x >= 0; x-- )
-      {
-        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[0]);
-        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[0]);
+  for ( y = iYOffset; y < uiPartSize; y++ )
+  {
+    if(iPUResiPredShift[2] >= 0)
+    {
+      for ( x = 0; x < iXOffset; x++ )
+      {
+        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[2]);
+        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[2]);
+      }
+    }
+
+    if(iPUResiPredShift[3] >= 0)
+    {
+      for ( x = iXOffset; x < uiPartSize; x++ )
+      {
+        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[3]);
+        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[3]);
       }
     }
@@ -845,4 +891,59 @@
     pDstV  += iDstStride;
   }
+#else
+  for ( y = uiPartSize-1; y >= iYOffset; y-- )
+  {
+    if(iPUResiPredShift[3] >= 0)
+    {
+      for ( x = uiPartSize-1; x >= iXOffset; x-- )
+      {
+        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[3]);
+        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[3]);
+      }
+    }
+
+    if(iPUResiPredShift[2] >= 0)
+    {
+      for ( x = iXOffset-1; x >= 0; x-- )
+      {
+        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[2]);
+        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[2]);
+      }
+    }
+    pSrcU0 += iSrc0Stride;
+    pSrcU1 += iSrc1Stride;
+    pSrcV0 += iSrc0Stride;
+    pSrcV1 += iSrc1Stride;
+    pDstU  += iDstStride;
+    pDstV  += iDstStride;
+  }
+
+  for ( y = iYOffset-1; y >= 0; y-- )
+  {
+    if(iPUResiPredShift[1] >= 0)
+    {
+      for ( x = uiPartSize-1; x >= iXOffset; x-- )
+      {
+        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[1]);
+        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[1]);
+      }
+    }
+
+    if(iPUResiPredShift[0] >= 0)
+    {
+      for ( x = iXOffset-1; x >= 0; x-- )
+      {
+        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[0]);
+        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[0]);
+      }
+    }
+    pSrcU0 += iSrc0Stride;
+    pSrcU1 += iSrc1Stride;
+    pSrcV0 += iSrc0Stride;
+    pSrcV1 += iSrc1Stride;
+    pDstU  += iDstStride;
+    pDstV  += iDstStride;
+  }
+#endif
 #else
   for ( y = uiPartSize-1; y >= 0; y-- )
Index: /branches/HTM-4.0-dev0/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /branches/HTM-4.0-dev0/source/Lib/TLibCommon/TypeDef.h	(revision 132)
+++ /branches/HTM-4.0-dev0/source/Lib/TLibCommon/TypeDef.h	(revision 133)
@@ -47,4 +47,7 @@
 #define FIX_INIT_ROM                      1
 #define FIX_VIRT_DESTRUCTOR               1
+#define FIX_DBL_CONTROL_DEFAULT           1
+#define FIX_RDO_MACRO                     1
+#define FIX_LG_RESTRICTEDRESPRED_M24766   1
 
 
Index: /branches/HTM-4.0-dev0/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- /branches/HTM-4.0-dev0/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 132)
+++ /branches/HTM-4.0-dev0/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 133)
@@ -6113,4 +6113,5 @@
         
         Dist uiActDist = RDO_DIST_MAX;
+#if FIX_RDO_MACRO
 #if SAIT_VSO_EST_A0033
         if ( m_pcRdCost->getUseEstimatedVSD() )
@@ -6121,9 +6122,23 @@
         }
         else       
-#else
+#endif // SAIT_VSO_EST_A0033
         {        
           uiActDist = m_pcRdCost->getDistVS( pcCU, 0, piPredic, uiStride,  piOrig, uiStride, uiWidth, uiHeight, false, 0 );
         }
-#endif
+#else // FIX_RDO_MACRO
+#if SAIT_VSO_EST_A0033
+        if ( m_pcRdCost->getUseEstimatedVSD() )
+        {          
+          TComPicYuv* pcVirRec = m_pcRdCost->getVideoRecPicYuv();
+          TComPicYuv* pcVirOrg = m_pcRdCost->getDepthPicYuv();
+          uiActDist = m_pcRdCost->getDistPart( piPredic, uiStride, piOrig, uiStride, pcVirRec->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()), pcVirOrg->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()), pcVirRec->getStride(), uiWidth, uiHeight );
+        }
+        else       
+#else  // SAIT_VSO_EST_A0033 <-- wrong #else statement should be #endif
+        {        
+          uiActDist = m_pcRdCost->getDistVS( pcCU, 0, piPredic, uiStride,  piOrig, uiStride, uiWidth, uiHeight, false, 0 );
+        }
+#endif // SAIT_VSO_EST_A0033 <-- wrong #endif should be removed
+#endif // FIX_RDO_MACRO
 
         if( uiActDist < uiBestDist || uiBestDist == RDO_DIST_MAX )
