Index: branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComDataCU.cpp	(revision 289)
+++ branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComDataCU.cpp	(revision 290)
@@ -3853,8 +3853,8 @@
   UInt uiIdx = 1;
 #if HHI_INTER_VIEW_MOTION_PRED
-  bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ];
+  Bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ];
   for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS_MEM; ++ui )
 #else
-  bool abCandIsInter[ MRG_MAX_NUM_CANDS ];
+  Bool abCandIsInter[ MRG_MAX_NUM_CANDS ];
   for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS; ++ui )
 #endif
@@ -6655,6 +6655,4 @@
       DisInfo cDisInfo;
       cDisInfo.iN = 0;
-
-#if FIX_LGE_IVMP_PARALLEL_MERGE_B0136
       getDisMvpCandNBDV(uiPartIdx, uiPartAddr, &cDisInfo, false
 #if MERL_VSP_C0152
@@ -6662,7 +6660,4 @@
 #endif
               ); 
-#else  // FIX_LGE_IVMP_PARALLEL_MERGE_B0136
-      getDisMvpCandNBDV(uiPartIdx, uiPartAddr, &cDisInfo); 
-#endif // FIX_LGE_IVMP_PARALLEL_MERGE_B0136
       if(cDisInfo.iN==0)
       {
@@ -6735,9 +6730,5 @@
   if(m_pcSlice->getSPS()->getViewId() && m_pcSlice->getSPS()->getMultiviewMvPredMode())
   {
-#if FIX_LGE_IVMP_PARALLEL_MERGE_B0136
     getDisMvpCandNBDV(uiPartIdx, uiPartAddr, &cDisInfo, false);
-#else
-    getDisMvpCandNBDV(uiPartIdx, uiPartAddr, &cDisInfo);
-#endif
   }
   if(cDisInfo.iN==0)
@@ -8751,9 +8742,5 @@
 #if HHI_INTER_VIEW_RESIDUAL_PRED
 Bool
-TComDataCU::getResidualSamples( UInt uiPartIdx, 
-#if QC_SIMPLIFIEDIVRP_M24938
-  Bool bRecon ,
-#endif
-  TComYuv* pcYuv )
+TComDataCU::getResidualSamples( UInt uiPartIdx, Bool bRecon, TComYuv* pcYuv )
 {
   TComResidualGenerator*  pcResidualGenerator = m_pcSlice->getSPS()->getResidualGenerator();
@@ -8764,9 +8751,5 @@
   PartSize m_peSaved =  getPartitionSize( 0 );
   m_pePartSize[0] =  SIZE_2Nx2N;
-#if FIX_LGE_IVMP_PARALLEL_MERGE_B0136
   getDisMvpCandNBDV( 0, 0,  &cDisInfo, false );
-#else
-  getDisMvpCandNBDV( 0, 0,  &cDisInfo);
-#endif
   if( cDisInfo.iN == 0)
   {
@@ -8777,15 +8760,7 @@
   {
 #if MTK_RELEASE_DV_CONSTRAINT_C0129
-    Bool bAvailable = pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, cDisInfo.m_acMvCand[0] 
-#if QC_SIMPLIFIEDIVRP_M24938
-     , bRecon 
-#endif
-     );
-#else
-    Bool bAvailable = pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, cDisInfo.m_acMvCand[0].getHor() 
-#if QC_SIMPLIFIEDIVRP_M24938
-      , bRecon 
-#endif
-      );
+    Bool bAvailable = pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, cDisInfo.m_acMvCand[0], bRecon );       
+#else
+    Bool bAvailable = pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, cDisInfo.m_acMvCand[0].getHor(), bRecon ); 
 #endif
     m_pePartSize[0] = m_peSaved;
@@ -8793,9 +8768,5 @@
   }
 #else
-  return pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv 
-#if QC_SIMPLIFIEDIVRP_M24938
-    , bRecon 
-#endif
-    );
+  return pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, bRecon ); 
 #endif
 }
Index: branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComDataCU.h
===================================================================
--- branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComDataCU.h	(revision 289)
+++ branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComDataCU.h	(revision 290)
@@ -241,9 +241,5 @@
   Bool          m_bDecSubCu;          ///< indicates decoder-mode
   Double        m_dTotalCost;         ///< sum of partition RD costs
-#if FIX_RDO_NEGDIST
   Dist          m_uiTotalDistortion;  ///< sum of partition distortion
-#else
-  UInt          m_uiTotalDistortion;  ///< sum of partition distortion
-#endif
   UInt          m_uiTotalBits;        ///< sum of partition bits
   UInt          m_uiTotalBins;       ///< sum of partition bins
@@ -617,9 +613,5 @@
 #endif
 #if HHI_INTER_VIEW_RESIDUAL_PRED
-  Bool          getResidualSamples( UInt uiPartIdx, 
-#if QC_SIMPLIFIEDIVRP_M24938
-    Bool bRecon ,
-#endif
-    TComYuv* pcYuv = 0 );
+  Bool          getResidualSamples( UInt uiPartIdx, Bool bRecon, TComYuv* pcYuv = 0 );
 #endif
   // -------------------------------------------------------------------------------------------------------------------
@@ -777,9 +769,5 @@
   
   Double&       getTotalCost()                  { return m_dTotalCost;        }
-#if FIX_RDO_NEGDIST
   Dist&         getTotalDistortion()            { return m_uiTotalDistortion; }
-#else
-  UInt&         getTotalDistortion()            { return m_uiTotalDistortion; }
-#endif
   UInt&         getTotalBits()                  { return m_uiTotalBits;       }
   UInt&         getTotalNumPart()               { return m_uiNumPartition;    }
Index: branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComPrediction.cpp
===================================================================
--- branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComPrediction.cpp	(revision 289)
+++ branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComPrediction.cpp	(revision 290)
@@ -858,9 +858,5 @@
   Bool bResAvail = false;
 
-  bResAvail = pcCU->getResidualSamples( 0, 
-#if QC_SIMPLIFIEDIVRP_M24938
-    true,
-#endif
-    pcYuvResPred );
+  bResAvail = pcCU->getResidualSamples( 0, true, pcYuvResPred );
 
   assert (bResAvail);
Index: branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComResidualGenerator.cpp
===================================================================
--- branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComResidualGenerator.cpp	(revision 289)
+++ branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComResidualGenerator.cpp	(revision 290)
@@ -229,24 +229,12 @@
 #if MTK_RELEASE_DV_CONSTRAINT_C0129
 Bool
-TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, TComMv iDisp
-#if QC_SIMPLIFIEDIVRP_M24938
-  , Bool bRecon
-#endif
-  ) 
+TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, TComMv iDisp, Bool bRecon  ) 
 #else
 Bool
-TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, Int iDisp
-#if QC_SIMPLIFIEDIVRP_M24938
-  , Bool bRecon
-#endif
- ) 
+TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, Int iDisp, Bool bRecon  ) 
 #endif
 #else
 Bool
-TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv 
-#if QC_SIMPLIFIEDIVRP_M24938
-  , Bool bRecon
-#endif
-  )
+TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, Bool bRecon ) 
 #endif //H3D_NBDV
 {
@@ -261,22 +249,10 @@
 #if H3D_NBDV
 #if MTK_RELEASE_DV_CONSTRAINT_C0129
-  return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, iDisp 
-#if QC_SIMPLIFIEDIVRP_M24938
-    , bRecon
-#endif
-  );
-#else
-  return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, iDisp 
-#if QC_SIMPLIFIEDIVRP_M24938
-    , bRecon
-#endif
-  );
-#endif
-#else
-  return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv 
-#if QC_SIMPLIFIEDIVRP_M24938
-    , bRecon
-#endif
-    );
+  return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, iDisp, bRecon);   
+#else
+  return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, iDisp, bRecon); 
+#endif
+#else
+  return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, bRecon); 
 #endif // H3D_NBDV
 }
@@ -285,24 +261,12 @@
 #if MTK_RELEASE_DV_CONSTRAINT_C0129
 Bool
-TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, TComMv iDisp  
-#if QC_SIMPLIFIEDIVRP_M24938
-  , Bool bRecon
-#endif
-)
+TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, TComMv iDisp, Bool bRecon)  
 #else
 Bool
-TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp 
-#if QC_SIMPLIFIEDIVRP_M24938
-  , Bool bRecon
-#endif
-)
+TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp, Bool bRecon) 
 #endif
 #else
 Bool
-TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv 
-#if QC_SIMPLIFIEDIVRP_M24938
-  , Bool bRecon
-#endif
-  )
+TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Bool bRecon) 
 #endif
 {
@@ -316,40 +280,21 @@
     pcYuv = m_ppcYuvTmp[1];
   }
-#if QC_SIMPLIFIEDIVRP_M24938
   UInt uiXPosInRefView = uiXPos , uiYPosInRefView = uiYPos;
-#endif
 #if H3D_NBDV
 #if MTK_RELEASE_DV_CONSTRAINT_C0129
-  xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, iDisp
-#if QC_SIMPLIFIEDIVRP_M24938
-   , &uiXPosInRefView , &uiYPosInRefView , bRecon
-#endif  
-  );
-#else
-  xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, iDisp
-#if QC_SIMPLIFIEDIVRP_M24938
-    , &uiXPosInRefView , &uiYPosInRefView , bRecon
-#endif  
-  );
-#endif
-#else
-  xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv 
-#if QC_SIMPLIFIEDIVRP_M24938
-    , &uiXPosInRefView , &uiYPosInRefView , bRecon
-#endif
-    );
+  xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, iDisp, &uiXPosInRefView , &uiYPosInRefView , bRecon  );
+#else
+  xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, iDisp, &uiXPosInRefView , &uiYPosInRefView , bRecon  );
+#endif
+#else
+  xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, &uiXPosInRefView , &uiYPosInRefView , bRecon    );
 #endif
 #if MTK_MDIVRP_C0138
   return true;
 #else
-#if QC_SIMPLIFIEDIVRP_M24938
   return xIsNonZeroByCBF( uiBaseViewId , uiXPosInRefView , uiYPosInRefView , uiBlkWidth , uiBlkHeight );
-#else
-  return xIsNonZero( pcYuv, uiBlkWidth, uiBlkHeight );
-#endif
-#endif
-}
-
-#if QC_SIMPLIFIEDIVRP_M24938
+#endif
+}
+
 Bool TComResidualGenerator::xIsNonZeroByCBF( UInt uiBaseViewId , UInt uiXPos , UInt uiYPos, UInt uiBlkWidth , UInt uiBlkHeight )
 {
@@ -377,5 +322,4 @@
   return( false );
 }
-#endif
 
 
@@ -497,9 +441,5 @@
   {
     AOF( pcCU->getResPredAvail( 0 ) );
-    Bool bOK = pcCU->getResidualSamples( 0, 
-#if QC_SIMPLIFIEDIVRP_M24938
-      true,
-#endif
-      m_ppcYuvTmp[0] );
+    Bool bOK = pcCU->getResidualSamples( 0, true, m_ppcYuvTmp[0] );
     AOF( bOK );
 #if LG_RESTRICTEDRESPRED_M24766
@@ -571,23 +511,14 @@
 Void  
 TComResidualGenerator::xSetPredResidualBlock( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, TComMv iDisp
-#if QC_SIMPLIFIEDIVRP_M24938
-  , UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon
-#endif
-)
+                                             ,UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon )
 #else // MTK_RELEASE_DV_CONSTRAINT_C0129
 Void  
 TComResidualGenerator::xSetPredResidualBlock( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp 
-#if QC_SIMPLIFIEDIVRP_M24938
-  , UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon
-#endif
-)
+                                             ,UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon)
 #endif // MTK_RELEASE_DV_CONSTRAINT_C0129
 #else // H3D_NBDV
 Void  
 TComResidualGenerator::xSetPredResidualBlock( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv 
-#if QC_SIMPLIFIEDIVRP_M24938
-  , UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon
-#endif
-  )
+                                             , UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon  )
 #endif // H3D_NBDV
 {
@@ -644,5 +575,5 @@
   Pel*          pDesSamplesY= pcYuv    ->getLumaAddr ();
 
-#if QC_SIMPLIFIEDIVRP_M24938
+
   if( puiXPosInRefView != NULL )
     *puiXPosInRefView = Max( 0, Min( iYMaxPosX, iYRefPosX0 ) );
@@ -651,5 +582,5 @@
   if( bRecon == false )
     return;
-#endif
+
 #if MTK_RELEASE_DV_CONSTRAINT_C0129
   for(   Int iY = 0; iY < iYHeight; iY++, pSrcSamplesY0 += iSrcStrideY, pSrcSamplesY1 += iSrcStrideY, pDesSamplesY += iDesStrideY )
Index: branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComResidualGenerator.h
===================================================================
--- branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComResidualGenerator.h	(revision 289)
+++ branches/HTM-5.1-dev0/source/Lib/TLibCommon/TComResidualGenerator.h	(revision 290)
@@ -71,38 +71,14 @@
 #if H3D_NBDV
 #if MTK_RELEASE_DV_CONSTRAINT_C0129
-  Bool  getResidualSamples    ( TComDataCU*   pcCU,  UInt uiPUIdx, TComYuv* pcYuv, TComMv iDisp_x
-#if QC_SIMPLIFIEDIVRP_M24938
-    , Bool bRecon
+  Bool  getResidualSamples    ( TComDataCU*   pcCU,  UInt uiPUIdx, TComYuv* pcYuv, TComMv iDisp_x, Bool bRecon );
+  Bool  getResidualSamples    ( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv , TComMv iDisp_x, Bool bRecon );
+#else
+  Bool  getResidualSamples    ( TComDataCU*   pcCU,  UInt uiPUIdx, TComYuv* pcYuv, Int iDisp, Bool bRecon ); 
+  Bool  getResidualSamples    ( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv , Int iDisp, Bool bRecon ); 
 #endif
-);
-  Bool  getResidualSamples    ( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv , TComMv iDisp_x
-#if QC_SIMPLIFIEDIVRP_M24938
-    , Bool bRecon
-#endif  
-  );
-#else
-  Bool  getResidualSamples    ( TComDataCU*   pcCU,  UInt uiPUIdx, TComYuv* pcYuv, Int iDisp 
-#if QC_SIMPLIFIEDIVRP_M24938
-    , Bool bRecon
-#endif
-);
-  Bool  getResidualSamples    ( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv , Int iDisp 
-#if QC_SIMPLIFIEDIVRP_M24938
-    , Bool bRecon
-#endif  
-  );
-#endif
-#else
-  Bool  getResidualSamples    ( TComDataCU*   pcCU,  UInt uiPUIdx, TComYuv* pcYuv 
-#if QC_SIMPLIFIEDIVRP_M24938
-    , Bool bRecon
-#endif
-    );
-  Bool  getResidualSamples    ( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv 
-#if QC_SIMPLIFIEDIVRP_M24938
-    , Bool bRecon
-#endif
-    );
-#endif
+#else // H3D_NBDV
+  Bool  getResidualSamples    ( TComDataCU*   pcCU,  UInt uiPUIdx, TComYuv* pcYuv, Bool bRecon ); 
+  Bool  getResidualSamples    ( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Bool bRecon ); 
+#endif // H3D_NBDV
 
 private:
@@ -115,30 +91,14 @@
 #if H3D_NBDV
 #if MTK_RELEASE_DV_CONSTRAINT_C0129
-  Void  xSetPredResidualBlock ( TComPic*      pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, TComMv iDisp
-#if QC_SIMPLIFIEDIVRP_M24938
-    , UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon
-#endif
-  );
+  Void  xSetPredResidualBlock ( TComPic*      pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, TComMv iDisp, UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon  );    
 #else
-  Void  xSetPredResidualBlock ( TComPic*      pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp 
-#if QC_SIMPLIFIEDIVRP_M24938
-    , UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon
-#endif
-  );
+  Void  xSetPredResidualBlock ( TComPic*      pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp, UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon  ); 
 #endif
 #else
-  Void  xSetPredResidualBlock ( TComPic*      pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv 
-#if QC_SIMPLIFIEDIVRP_M24938
-    , UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon
-#endif
-    );
+  Void  xSetPredResidualBlock ( TComPic*      pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon  ); 
 #endif
   Bool  xIsNonZero            ( TComYuv*      pcYuv, UInt uiBlkWidth, UInt uiBlkHeight );
-#if QC_SIMPLIFIEDIVRP_M24938
   Bool  xIsNonZeroByCBF       ( UInt uiBaseViewId , UInt uiXPos , UInt uiYPos, UInt uiBlkWidth , UInt uiBlkHeight );
-#endif
-
   Void  xDumpResidual         ( TComPic*      pcPic, char* pFilenameBase );
-
 private:
   // general parameters
Index: branches/HTM-5.1-dev0/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- branches/HTM-5.1-dev0/source/Lib/TLibCommon/TypeDef.h	(revision 289)
+++ branches/HTM-5.1-dev0/source/Lib/TLibCommon/TypeDef.h	(revision 290)
@@ -41,74 +41,44 @@
 //! \ingroup TLibCommon
 //! \{
+
+// MV-HEVC
+#define QC_IV_AS_LT_B0046                 1   //JCT3V-B0046: inter-view reference pictures are treated as long-term pictures 
+#define QC_REM_IDV_B0046                  1   //JCT3V-B0046: removal of IDV NAL unit type
+#define DV_V_RESTRICTION_B0037            1   //JCT3V-B0037: disparity vector vertical range restriction
+#define QC_TMVP_IDX_MOD_B0046             1   //JCT3V-B0046: the reference index for temporal merging candidate is set to 0, as defined in HEVC
+
+// 3D-HEVC
 #define QC_MVHEVC_B0046                   0   //JCT3V-B0046: disable 3DHEVC tools
-#define QC_IV_AS_LT_B0046                 1   //JCT3V-B0046: inter-view reference pictures are treated as long-term pictures 
-#define QC_TMVP_IDX_MOD_B0046             1   //JCT3V-B0046: the reference index for temporal merging candidate is set to 0, as defined in HEVC
-#define QC_REM_IDV_B0046                  1   //JCT3V-B0046: removal of IDV NAL unit type
-#define DV_V_RESTRICTION_B0037            1   // JCT3V-B0037 disparity vector vertical range restriction
 
 #if !QC_MVHEVC_B0046
 
-
-// C TRACK 3
-#define MERL_VSP_C0152                                0 // JCT3V-C0152: 1: enable VSP-related tools; 0: disable VSP-related tools
-#define MTK_SAIT_TEMPORAL_FIRST_ORDER_C0141_C0097     1   // JCT3V-C0141/C0097
-#define MTK_SIMPLIFY_DVTC_C0135                       1   // JCT3V-C0135
-#define MTK_RELEASE_DV_CONSTRAINT_C0129               1   // JCT3V-C0129
-#define QC_NBDV_LDB_FIX_C0055                         1   // JCT3V-C0055
-
-///// ***** FIXES *********
-// A
-#define FIX_POZNAN_CABAC_INIT_FLAG        1
-#define FIX_LG_RESTRICTEDRESPRED_M24766   1
-
-// B
-#define FIX_LGE_IVMP_PARALLEL_MERGE_B0136 1
-#define FIX_RDO_NEGDIST                   1
-#define FIX_DMM_NEG_DIST                  1
-
-
-// 3rd meeting
-#define FIX_DMM_CTX_INIT_C0034            1    // JCT3V-C0034 fix for wrong init type of DMM contexts (UChar instead of Short)
-#define FIX_SDC_ENC_C0143                 1    // JCT3V-C0143 fix for unnecessary encoder checks in case of SDC
-
-// FCO 
-#define FLEX_CODING_ORDER_M23723          1
-#if FLEX_CODING_ORDER_M23723
-  #define DISABLE_FCO_FOR_VSO             0 // Optional compile settings to disable VSO with FCO.
-#endif
-#define   QC_TMVP_MRG_REFIDX_C0047        1 //only enabled when QC_TMVP_IDX_MOD_B0046 is enabled.
-
-///// ***** PATCHES *********
-#define TMVP_DEPTH_SWITCH                 1   // JCT3V-B0092 additional encoder option only 
-
-///// ***** DEPTH MODELING MODES *********
+///// ***** DMM *********
 #define HHI_DMM_WEDGE_INTRA               1   // depth model modes independent on texture (explicit and intra-predicted Wedgelet prediction)
 #define HHI_DMM_PRED_TEX                  1   // depth model modes dependent on texture (inter-component Wedgelet and Contour prediction )
 #define LGE_EDGE_INTRA_A0070              1   // JCT3V-A0070
 
-#define RWTH_SDC_DLT_B0036                1   // JCT3V-B0036: Simplified Depth Coding + Depth Lookup Table
-
 #define HHIQC_DMMFASTSEARCH_B0039         1   // JCT3V-B0039: fast Wedgelet search for DMM modes 1 and 3 // --> weg 
 
 #define HHI_DMM_DELTADC_Q1_C0034          1   // JCT3V-C0034: no quantization and fast encoder search for DMM delta DC values
-
 #if HHIQC_DMMFASTSEARCH_B0039 && HHI_DMM_PRED_TEX
 #define LGE_DMM3_SIMP_C0044               1
 #endif
-
+#define FIX_DMM_CTX_INIT_C0034            1    // JCT3V-C0034 fix for wrong init type of DMM contexts (UChar instead of Short)
+
+///// ***** SDC *********
+#define RWTH_SDC_DLT_B0036                1   // JCT3V-B0036: Simplified Depth Coding + Depth Lookup Table
 #if RWTH_SDC_DLT_B0036
 #define SAIT_SDC_C0096                    1   // JCT3V-C0096: Improved Simple Depth Coding(removal of DMM2 among four SDC modes(DC, Planar, DMM1 and DMM2))
 #endif
+#define FIX_SDC_ENC_C0143                 1    // JCT3V-C0143 fix for unnecessary encoder checks in case of SDC
+
+///// ***** TMVP/AMVP *********
+#define TMVP_DEPTH_SWITCH                 1 // JCT3V-B0092 additional encoder option only 
+#define QC_TMVP_MRG_REFIDX_C0047          1 // only enabled when QC_TMVP_IDX_MOD_B0046 is enabled.
+#define INTER_VIEW_VECTOR_SCALING_C0115   1 // JCT3V-C0115 Inter-view vector scaling for TMVP & flag
+#define INTER_VIEW_VECTOR_SCALING_C0116   1 // JCT3V-C0116 Inter-view vector scaling for AMVP
 
 ///// ***** INTERVIEW MOTION VECTOR PREDICTION *********
 #define HHI_INTER_VIEW_MOTION_PRED        1   // inter-view motion parameter prediction
-#define QC_AMVP_MRG_UNIFY_IVCAN_C0051     1
-#define QC_C0051_FIXED_BY_MTK             1   // bug fix for C0051 implementation
-#define SHARP_INTERVIEW_DECOUPLE_B0111    1   // JCT3V-B0111 decoupling inter-view candidate
-#define QC_MRG_CANS_B0048                 1   // JCT3V-B0048, B0086, B0069
-#if     QC_MRG_CANS_B0048
-#define OL_DISMV_POS_B0069                1   // different pos for disparity MV candidate, B0069
-#endif
-#define MTK_INTERVIEW_MERGE_A0049         1   // JCT3V-A0049 second part
 #if HHI_INTER_VIEW_MOTION_PRED         
 #define SAIT_IMPROV_MOTION_PRED_M24829    1   // improved inter-view motion vector prediction
@@ -117,15 +87,27 @@
 #endif                                 
 
+#define SHARP_INTERVIEW_DECOUPLE_B0111    1   // JCT3V-B0111 decoupling inter-view candidate
+#define QC_MRG_CANS_B0048                 1   // JCT3V-B0048, B0086, B0069
+#if     QC_MRG_CANS_B0048
+#define OL_DISMV_POS_B0069                1   // different pos for disparity MV candidate, B0069
+#endif
+#define MTK_INTERVIEW_MERGE_A0049         1   // JCT3V-A0049 second part
+#define QC_AMVP_MRG_UNIFY_IVCAN_C0051     1
+#define QC_C0051_FIXED_BY_MTK             1   // bug fix for C0051 implementation
+
+
 ///// ***** INTERVIEW RESIDUAL PREDICTION *********
 #define HHI_INTER_VIEW_RESIDUAL_PRED      1   // inter-view residual prediction
+                                              // QC_SIMPLIFIEDIVRP_M24938 
 #if HHI_INTER_VIEW_RESIDUAL_PRED       
+#define LG_RESTRICTEDRESPRED_M24766       1   // restricted inter-view residual prediction
+#define FIX_LG_RESTRICTEDRESPRED_M24766   1
+#else                                  
+#define LG_RESTRICTEDRESPRED_M24766       0
+#endif
+
 #define MTK_MDIVRP_C0138                  1   // mode-dependent inter-view residual prediction
 #define MTK_C0138_FIXED                   1   // fix for IBP coding structure in view direction (not CTC)
-#define LG_RESTRICTEDRESPRED_M24766       1   // restricted inter-view residual prediction
-#define QC_SIMPLIFIEDIVRP_M24938          1
-#else                                  
-#define LG_RESTRICTEDRESPRED_M24766       0
-#define QC_SIMPLIFIEDIVRP_M24938          0
-#endif
+
 
 ///// ***** DISPARITY VECTOR DERIVATION *********
@@ -138,4 +120,10 @@
                                               // FIX_LGE_DVMCP_B0133
                                               // LGE_IVMP_PARALLEL_MERGE_B0136, B0136 support of parallel merge/skip in disparity vector derivation
+                                              // FIX_LGE_IVMP_PARALLEL_MERGE_B0136
+
+#define QC_NBDV_LDB_FIX_C0055             1   // JCT3V-C0055
+#define MTK_SAIT_TEMPORAL_FIRST_ORDER_C0141_C0097     1   // JCT3V-C0141/C0097
+#define MTK_RELEASE_DV_CONSTRAINT_C0129   1   // JCT3V-C0129
+#define MTK_SIMPLIFY_DVTC_C0135           1   // JCT3V-C0135
 
 ///// ***** MOTION PARAMETER INHERITANCE  *********
@@ -179,12 +167,17 @@
 ///// ***** OTHERS *********
 #define LG_ZEROINTRADEPTHRESI_A0087       1   // JCT2-A0087
-#define INTER_VIEW_VECTOR_SCALING_C0115   1   // JCT2-C0115 Inter-view vector scaling for TMVP & flag
-#define INTER_VIEW_VECTOR_SCALING_C0116   1   // JCT2-C0116 Inter-view vector scaling for AMVP
 #define HHI_FULL_PEL_DEPTH_MAP_MV_ACC     1   // full-pel mv accuracy for depth maps
-#define VIDYO_VPS_INTEGRATION             1
+#define VIDYO_VPS_INTEGRATION             1   // Integration of VPS
 #define HHI_DEPTH_INTRA_SEARCH_RAU_C0160  1   // JCT3V-C0160 change 1: full Intra search in depth random access units 
+#define FIX_POZNAN_CABAC_INIT_FLAG        1
+
+///// ***** FCO  *********
+#define FLEX_CODING_ORDER_M23723          1
+#if FLEX_CODING_ORDER_M23723
+#define DISABLE_FCO_FOR_VSO               0 // Optional compile settings to disable VSO with FCO.
+#endif
 
 ///// ***** VSP *********
-
+#define MERL_VSP_C0152                    0 // JCT3V-C0152: 1: enable VSP-related tools; 0: disable VSP-related tools
 #if MERL_VSP_C0152
 
@@ -220,5 +213,5 @@
 
 
-///// ***** DEFINED PARAMETERS *********
+///// ***** DERIVED PARAMETERS *********
 #if H3D_NBDV                    
 #define DIS_CANS                          1
@@ -265,4 +258,6 @@
 #define HHI_MPI_MERGE_POS                 0
 #endif
+
+
 ///// ***** HM 6.1 *********
 #define SKIPFRAME_BUGFIX                  1 ///< bug fix to enable skipFrame at decoder
Index: branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecEntropy.cpp
===================================================================
--- branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 289)
+++ branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 290)
@@ -123,9 +123,5 @@
   if( bResPredAllowed )
   {
-    bResPredAvailable       = pcSubCU->getResidualSamples( uiPUIdx 
-#if QC_SIMPLIFIEDIVRP_M24938
-      , false
-#endif
-      );
+    bResPredAvailable       = pcSubCU->getResidualSamples( uiPUIdx , false  );
   }
 
Index: branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncCu.cpp
===================================================================
--- branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncCu.cpp	(revision 289)
+++ branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncCu.cpp	(revision 290)
@@ -660,9 +660,5 @@
         if( bResPredAllowed )
         {
-          bResPredAvailable       = rpcBestCU->getResidualSamples( 0, 
-#if QC_SIMPLIFIEDIVRP_M24938
-            true ,
-#endif
-            m_ppcResPredTmp[uiDepth] );
+          bResPredAvailable       = rpcBestCU->getResidualSamples( 0, true , m_ppcResPredTmp[uiDepth] );
         }
 
@@ -801,9 +797,5 @@
         if( bResPredAllowed )
         {
-          bResPredAvailable       = rpcBestCU->getResidualSamples( 0, 
-#if QC_SIMPLIFIEDIVRP_M24938
-            true,
-#endif
-            m_ppcResPredTmp[uiDepth] );
+          bResPredAvailable       = rpcBestCU->getResidualSamples( 0, true, m_ppcResPredTmp[uiDepth] );
         }
 
Index: branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 289)
+++ branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 290)
@@ -2015,11 +2015,6 @@
   UInt    uiQNumParts    = pcCU->getTotalNumPart() >> 2;
   UInt    uiWidthBit     = pcCU->getIntraSizeIdx(0);
-#if FIX_RDO_NEGDIST
   Dist    uiOverallDistY = 0;
   Dist    uiOverallDistC = 0;
-#else
-  UInt    uiOverallDistY = 0;
-  UInt    uiOverallDistC = 0;
-#endif
   UInt    CandNum;
   Double  CandCostList[ FAST_UDI_MAX_RDMODE_NUM ];
@@ -2158,7 +2153,4 @@
         CandNum += xUpdateCandList( uiMode, cost, numModesForFullRD, uiRdModeList, CandCostList );
 
-#if (HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX) && !FIX_DMM_NEG_DIST
-        if( bTestDmm ) bTestDmm = uiSad ? true : false;
-#endif
 #if LGE_EDGE_INTRA_A0070
         if ( bTestEdgeIntra ) bTestEdgeIntra = uiSad ? true : false;
@@ -2302,11 +2294,6 @@
     
     UInt    uiBestPUMode  = 0;
-#if FIX_RDO_NEGDIST
     Dist    uiBestPUDistY = 0;
     Dist    uiBestPUDistC = 0;
-#else
-    UInt    uiBestPUDistY = 0;
-    UInt    uiBestPUDistC = 0;
-#endif
     Double  dBestPUCost   = MAX_DOUBLE;
 #if RWTH_SDC_DLT_B0036
@@ -5692,11 +5679,7 @@
     }
     
-#if FIX_RDO_NEGDIST
+
     Dist uiDistU = 0;
     Dist uiDistV = 0;
-#else
-    UInt uiDistU = 0;
-    UInt uiDistV = 0;
-#endif
     if( bCodeChroma )
     {
@@ -5736,12 +5719,8 @@
 #endif       
         
-#if FIX_RDO_NEGDIST
+
         const Dist uiNonzeroDistU = m_pcRdCost->getDistPart( m_pcQTTempTComYuv[uiQTTempAccessLayer].getCbAddr( absTUPartIdxC), m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride(),
           pcResi->getCbAddr( absTUPartIdxC), pcResi->getCStride(), trWidthC, trHeightC
 
-#else
-        const UInt uiNonzeroDistU = m_pcRdCost->getDistPart( m_pcQTTempTComYuv[uiQTTempAccessLayer].getCbAddr( absTUPartIdxC), m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride(),
-          pcResi->getCbAddr( absTUPartIdxC), pcResi->getCStride(), trWidthC, trHeightC
-#endif
 #if WEIGHTED_CHROMA_DISTORTION
           , true
@@ -5828,11 +5807,6 @@
         m_pcTrQuant->invtransformNxN( TEXT_CHROMA,REG_DCT, pcResiCurrV, m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride(), pcCoeffCurrV, trWidthC, trHeightC, scalingListType );
 #endif
-#if FIX_RDO_NEGDIST
         const Dist uiNonzeroDistV = m_pcRdCost->getDistPart( m_pcQTTempTComYuv[uiQTTempAccessLayer].getCrAddr( absTUPartIdxC ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride(),
           pcResi->getCrAddr( absTUPartIdxC ), pcResi->getCStride(), trWidthC, trHeightC
-#else
-        const UInt uiNonzeroDistV = m_pcRdCost->getDistPart( m_pcQTTempTComYuv[uiQTTempAccessLayer].getCrAddr( absTUPartIdxC ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride(),
-          pcResi->getCrAddr( absTUPartIdxC ), pcResi->getCStride(), trWidthC, trHeightC
-#endif
 #if WEIGHTED_CHROMA_DISTORTION
                                                    , true
