Index: /branches/HTM-3.0-Qualcomm/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- /branches/HTM-3.0-Qualcomm/source/Lib/TLibCommon/TComDataCU.cpp	(revision 65)
+++ /branches/HTM-3.0-Qualcomm/source/Lib/TLibCommon/TComDataCU.cpp	(revision 66)
@@ -5952,9 +5952,17 @@
 #if HHI_INTER_VIEW_RESIDUAL_PRED
 Bool
-TComDataCU::getResidualSamples( UInt uiPartIdx, TComYuv* pcYuv )
+TComDataCU::getResidualSamples( UInt uiPartIdx, 
+#if QC_SIMPLIFIEDIVRP_M24938
+  Bool bRecon ,
+#endif
+  TComYuv* pcYuv )
 {
   TComResidualGenerator*  pcResidualGenerator = m_pcSlice->getSPS()->getResidualGenerator();
   ROFRS( pcResidualGenerator, false );
-  return pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv );
+  return pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv 
+#if QC_SIMPLIFIEDIVRP_M24938
+    , bRecon 
+#endif
+    );
 }
 #endif
Index: /branches/HTM-3.0-Qualcomm/source/Lib/TLibCommon/TComDataCU.h
===================================================================
--- /branches/HTM-3.0-Qualcomm/source/Lib/TLibCommon/TComDataCU.h	(revision 65)
+++ /branches/HTM-3.0-Qualcomm/source/Lib/TLibCommon/TComDataCU.h	(revision 66)
@@ -521,5 +521,9 @@
 #endif
 #if HHI_INTER_VIEW_RESIDUAL_PRED
-  Bool          getResidualSamples( UInt uiPartIdx, TComYuv* pcYuv = 0 );
+  Bool          getResidualSamples( UInt uiPartIdx, 
+#if QC_SIMPLIFIEDIVRP_M24938
+    Bool bRecon ,
+#endif
+    TComYuv* pcYuv = 0 );
 #endif
   // -------------------------------------------------------------------------------------------------------------------
Index: /branches/HTM-3.0-Qualcomm/source/Lib/TLibCommon/TComResidualGenerator.cpp
===================================================================
--- /branches/HTM-3.0-Qualcomm/source/Lib/TLibCommon/TComResidualGenerator.cpp	(revision 65)
+++ /branches/HTM-3.0-Qualcomm/source/Lib/TLibCommon/TComResidualGenerator.cpp	(revision 66)
@@ -221,5 +221,9 @@
 
 Bool
-TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv )
+TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv 
+#if QC_SIMPLIFIEDIVRP_M24938
+  , Bool bRecon
+#endif
+  )
 {
   AOF(  pcCU );
@@ -231,9 +235,17 @@
   iBlkHeight  = pcCU->getHeight ( 0 );
   pcCU->getPic()->getPicYuvRec()->getTopLeftSamplePos( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr, iXPos, iYPos );
-  return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv );
+  return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv 
+#if QC_SIMPLIFIEDIVRP_M24938
+    , bRecon
+#endif
+    );
 }
   
 Bool
-TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv )
+TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv 
+#if QC_SIMPLIFIEDIVRP_M24938
+  , Bool bRecon
+#endif
+  )
 {
   UInt  uiBaseViewId  = m_pcDepthMapGenerator->getBaseViewId( 0 );
@@ -243,7 +255,47 @@
     pcYuv = m_ppcYuvTmp[1];
   }
-  xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv );
+#if QC_SIMPLIFIEDIVRP_M24938
+  UInt uiXPosInRefView = uiXPos , uiYPosInRefView = uiYPos;
+#endif
+  xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv 
+#if QC_SIMPLIFIEDIVRP_M24938
+    , &uiXPosInRefView , &uiYPosInRefView , bRecon
+#endif
+    );
+
+#if QC_SIMPLIFIEDIVRP_M24938
+  return xIsNonZeroByCBF( uiBaseViewId , uiXPosInRefView , uiYPosInRefView , uiBlkWidth , uiBlkHeight );
+#else
   return xIsNonZero( pcYuv, uiBlkWidth, uiBlkHeight );
-}
+#endif
+}
+
+#if QC_SIMPLIFIEDIVRP_M24938
+Bool TComResidualGenerator::xIsNonZeroByCBF( UInt uiBaseViewId , UInt uiXPos , UInt uiYPos, UInt uiBlkWidth , UInt uiBlkHeight )
+{
+  TComPic* pcBasePic   = m_pcAUPicAccess->getPic( uiBaseViewId );
+  const Int nMaxPicX = pcBasePic->getSPS()->getPicWidthInLumaSamples() - 1;
+  const Int nMaxPicY = pcBasePic->getSPS()->getPicHeightInLumaSamples() - 1;
+  for( UInt y = 0 ; y < uiBlkHeight ; y +=4 )
+  {
+    for( UInt x = 0 ; x <= uiBlkWidth ; x += 4 )
+    {      // to cover both the mapped CU and the 1-pixel-right-shifted mapped CU
+      Int iCuAddr = 0, iAbsZorderIdx = 0;
+      pcBasePic->getPicYuvRec()->getCUAddrAndPartIdx( Min( uiXPos + x , nMaxPicX ) , Min( uiYPos + y , nMaxPicY ) , iCuAddr , iAbsZorderIdx );
+      TComDataCU *pCUInRefView = pcBasePic->getCU( iCuAddr );
+      if( pCUInRefView->isIntra( iAbsZorderIdx ) )
+        // no inter-view residual pred from a intra CU
+        continue;
+      UInt uiTempTrDepth = pCUInRefView->getTransformIdx( iAbsZorderIdx );
+      if( pCUInRefView->getCbf( iAbsZorderIdx , TEXT_LUMA , uiTempTrDepth )
+        || pCUInRefView->getCbf( iAbsZorderIdx , TEXT_CHROMA_U , uiTempTrDepth )
+        || pCUInRefView->getCbf( iAbsZorderIdx , TEXT_CHROMA_V , uiTempTrDepth ) )
+        return( true );
+    }
+  }
+
+  return( false );
+}
+#endif
 
 
@@ -364,5 +416,9 @@
   {
     AOF( pcCU->getResPredAvail( 0 ) );
-    Bool bOK = pcCU->getResidualSamples( 0, m_ppcYuvTmp[0] );
+    Bool bOK = pcCU->getResidualSamples( 0, 
+#if QC_SIMPLIFIEDIVRP_M24938
+      true,
+#endif
+      m_ppcYuvTmp[0] );
     AOF( bOK );
 #if LG_RESTRICTEDRESPRED_M24766
@@ -431,5 +487,9 @@
 
 Void  
-TComResidualGenerator::xSetPredResidualBlock( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv )
+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
+  )
 {
   //===== set and check some basic variables =====
@@ -464,4 +524,14 @@
   Pel*          pSrcSamplesY= pcBaseRes->getLumaAddr ( 0 ) + uiYPos * iSrcStrideY;
   Pel*          pDesSamplesY= pcYuv    ->getLumaAddr ();
+
+#if QC_SIMPLIFIEDIVRP_M24938
+  if( puiXPosInRefView != NULL )
+    *puiXPosInRefView = Max( 0, Min( iYMaxPosX, iYRefPosX0 ) );
+  if( puiYPosInRefView != NULL )
+    *puiYPosInRefView = uiYPos;
+  if( bRecon == false )
+    return;
+#endif
+
   for(   Int iY = 0; iY < iYHeight; iY++, pSrcSamplesY += iSrcStrideY, pDesSamplesY += iDesStrideY )
   {
Index: /branches/HTM-3.0-Qualcomm/source/Lib/TLibCommon/TComResidualGenerator.h
===================================================================
--- /branches/HTM-3.0-Qualcomm/source/Lib/TLibCommon/TComResidualGenerator.h	(revision 65)
+++ /branches/HTM-3.0-Qualcomm/source/Lib/TLibCommon/TComResidualGenerator.h	(revision 66)
@@ -69,6 +69,14 @@
   Void  setRecResidualPic     ( TComPic*      pcPic );
 
-  Bool  getResidualSamples    ( TComDataCU*   pcCU,  UInt uiPUIdx, TComYuv* pcYuv );
-  Bool  getResidualSamples    ( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv );
+  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
+    );
 
 private:
@@ -80,6 +88,13 @@
   Void  xClearResidual        (                      TComYuv* pcCUResidual, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight );
 
-  Void  xSetPredResidualBlock ( TComPic*      pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv );
+  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
+    );
   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 );
Index: /branches/HTM-3.0-Qualcomm/source/Lib/TLibCommon/TComRom.cpp
===================================================================
--- /branches/HTM-3.0-Qualcomm/source/Lib/TLibCommon/TComRom.cpp	(revision 65)
+++ /branches/HTM-3.0-Qualcomm/source/Lib/TLibCommon/TComRom.cpp	(revision 66)
@@ -1188,6 +1188,6 @@
   assert( uiWidth == uiHeight );
 
-  UChar    uhStartX,    uhStartY,    uhEndX,    uhEndY;
-  Int   iStepStartX, iStepStartY, iStepEndX, iStepEndY;
+  UChar    uhStartX = 0,    uhStartY = 0,    uhEndX = 0,    uhEndY = 0;
+  Int   iStepStartX = 0, iStepStartY = 0, iStepEndX = 0, iStepEndY = 0;
 
   UInt uiBlockSize = 0;
Index: /branches/HTM-3.0-Qualcomm/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /branches/HTM-3.0-Qualcomm/source/Lib/TLibCommon/TypeDef.h	(revision 65)
+++ /branches/HTM-3.0-Qualcomm/source/Lib/TLibCommon/TypeDef.h	(revision 66)
@@ -70,6 +70,8 @@
 #if HHI_INTER_VIEW_RESIDUAL_PRED
 #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
 
@@ -755,5 +757,4 @@
 };
 
-
 //! \}
 
Index: /branches/HTM-3.0-Qualcomm/source/Lib/TLibDecoder/TDecCu.cpp
===================================================================
--- /branches/HTM-3.0-Qualcomm/source/Lib/TLibDecoder/TDecCu.cpp	(revision 65)
+++ /branches/HTM-3.0-Qualcomm/source/Lib/TLibDecoder/TDecCu.cpp	(revision 66)
@@ -636,5 +636,9 @@
   {
     AOF( pcCU->getResPredAvail( 0 ) );
-    Bool bOK = pcCU->getResidualSamples( 0, m_ppcYuvResPred[uiDepth] );
+    Bool bOK = pcCU->getResidualSamples( 0, 
+#if QC_SIMPLIFIEDIVRP_M24938
+      true,
+#endif
+      m_ppcYuvResPred[uiDepth] );
     AOF( bOK );
 #if LG_RESTRICTEDRESPRED_M24766
Index: /branches/HTM-3.0-Qualcomm/source/Lib/TLibDecoder/TDecEntropy.cpp
===================================================================
--- /branches/HTM-3.0-Qualcomm/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 65)
+++ /branches/HTM-3.0-Qualcomm/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 66)
@@ -98,5 +98,9 @@
   if( bResPredAllowed )
   {
-    bResPredAvailable       = pcSubCU->getResidualSamples( uiPUIdx );
+    bResPredAvailable       = pcSubCU->getResidualSamples( uiPUIdx 
+#if QC_SIMPLIFIEDIVRP_M24938
+      , false
+#endif
+      );
   }
 
Index: /branches/HTM-3.0-Qualcomm/source/Lib/TLibEncoder/TEncCu.cpp
===================================================================
--- /branches/HTM-3.0-Qualcomm/source/Lib/TLibEncoder/TEncCu.cpp	(revision 65)
+++ /branches/HTM-3.0-Qualcomm/source/Lib/TLibEncoder/TEncCu.cpp	(revision 66)
@@ -604,5 +604,9 @@
         if( bResPredAllowed )
         {
-          bResPredAvailable       = rpcBestCU->getResidualSamples( 0, m_ppcResPredTmp[uiDepth] );
+          bResPredAvailable       = rpcBestCU->getResidualSamples( 0, 
+#if QC_SIMPLIFIEDIVRP_M24938
+            true ,
+#endif
+            m_ppcResPredTmp[uiDepth] );
         }
 
@@ -698,5 +702,9 @@
         if( bResPredAllowed )
         {
-          bResPredAvailable       = rpcBestCU->getResidualSamples( 0, m_ppcResPredTmp[uiDepth] );
+          bResPredAvailable       = rpcBestCU->getResidualSamples( 0, 
+#if QC_SIMPLIFIEDIVRP_M24938
+            true,
+#endif
+            m_ppcResPredTmp[uiDepth] );
         }
 
