Index: branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/CommonDef.h
===================================================================
--- branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/CommonDef.h	(revision 89)
+++ branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/CommonDef.h	(revision 91)
@@ -138,5 +138,5 @@
 #define PDM_NO_INTER_UPDATE               1         // no update for inter (but not inter-view) predicted blocks
 #define PDM_MERGE_POS                     0         // position of pdm in merge list (0..4)
-#if SAIT_IMPROV_MOTION_PRED_M24829
+#if SAIT_IMPROV_MOTION_PRED_M24829&!QC_MULTI_DIS_CAN
 #define PDM_AMVP_POS                      0         // position of pdm in amvp list  (0..3)
 #else
Index: branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/TComDataCU.cpp	(revision 89)
+++ branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/TComDataCU.cpp	(revision 91)
@@ -3358,5 +3358,20 @@
   TComMv  acPdmMv       [2];
   Int     aiPdmRefIdx   [2] = {-1, -1};
+#if QC_MULTI_DIS_CAN
+  DisInfo cDisInfo;
+  cDisInfo.iN = 0;
+  if(!bNoPdmMerge)
+	  getDisMvpCand (uiPUIdx, uiAbsPartIdx, &cDisInfo );
+  if(cDisInfo.iN==0)
+  {
+	  cDisInfo.iN = 1;
+	  cDisInfo.m_acMvCand[0].setHor(0);
+	  cDisInfo.m_acMvCand[0].setVer(0);
+	  cDisInfo.m_aVIdxCan[0] = 0;
+  }
+  Int     iPdmInterDir      = cDisInfo.iN==0? 0:getPdmMergeCandidateDisCan ( uiPUIdx, aiPdmRefIdx, acPdmMv, &cDisInfo  );
+#else
   Int     iPdmInterDir      = getPdmMergeCandidate( uiPUIdx, aiPdmRefIdx, acPdmMv );
+#endif
 
   if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 0 )
@@ -4274,4 +4289,330 @@
   return m_pcSlice->getSPS()->getAMVPMode(m_puhDepth[uiIdx]);
 }
+#if QC_MULTI_DIS_CAN
+/** construct a list of disparity motion vectors from the neighbouring PUs **/
+Void TComDataCU::getDisMvpCand ( UInt uiPartIdx, UInt uiPartAddr,DisInfo* pDInfo )
+{
+	PartSize eCUMode = getPartitionSize( uiPartAddr );
+	TComDataCU* pcTmpCU = NULL;
+	pDInfo->iN = 0;
+
+	RefPicList eRefPicList = REF_PIC_LIST_0 ;
+	//-- Get Spatial MV
+	UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB;
+	UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();
+
+	deriveLeftRightTopIdxGeneral( eCUMode, uiPartAddr, uiPartIdx, uiPartIdxLT, uiPartIdxRT );
+	deriveLeftBottomIdxGeneral( eCUMode, uiPartAddr, uiPartIdx, uiPartIdxLB );
+
+	UInt uiIdx = 0;
+#if MVP_AT_ENTROPYSLICE_BOUNDARY
+      pcTmpCU = getPULeft(uiIdx, uiPartIdxLB, true, false);
+#else
+	  pcTmpCU = getPULeft(uiIdx, uiPartIdxLB);
+#endif
+	if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
+	{
+		for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
+		{
+			eRefPicList = RefPicList(iList);
+			Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
+			if( refId >= 0)
+			{
+				Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
+				if (refViewIdx!= m_pcSlice->getViewId())
+				{
+				   TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
+				   clipMv(cMvPred);
+				   pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; 
+				   pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
+				   return;
+				}
+			}
+		}
+	}
+#if MVP_AT_ENTROPYSLICE_BOUNDARY
+      pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT, true, false, true);
+#else
+	  pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT);
+#endif
+
+	if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
+	{
+		for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
+		{
+			eRefPicList = RefPicList(iList);
+			Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
+			if( refId >= 0)
+			{
+				Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
+				if (refViewIdx!= m_pcSlice->getViewId())
+				{
+				   TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
+				   clipMv(cMvPred);
+				   pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; 
+				   pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
+				   return;
+				}
+			}
+		}
+	}
+
+#if MVP_AT_ENTROPYSLICE_BOUNDARY
+      pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, false, true);
+#else
+      pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, true, true);
+#endif
+	if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
+	{
+		for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
+		{
+			eRefPicList = RefPicList(iList);
+			Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
+			if( refId >= 0)
+			{
+				Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
+				if (refViewIdx!= m_pcSlice->getViewId())
+				{
+				   TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
+				   clipMv(cMvPred);
+				   pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; 
+				   pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
+				   return;
+				}
+			}
+		}
+	}
+#if MVP_AT_ENTROPYSLICE_BOUNDARY
+      pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true, false);
+#else
+      pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB);
+#endif
+	if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
+	{
+		for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
+		{
+			eRefPicList = RefPicList(iList);
+			Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
+			if( refId >= 0)
+			{
+				Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
+				if (refViewIdx!= m_pcSlice->getViewId())
+				{
+				   TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
+				   clipMv(cMvPred);
+				   pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; 
+				   pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
+				   return;
+				}
+			}
+		}
+	}
+
+	// Above predictor search
+#if MVP_AT_ENTROPYSLICE_BOUNDARY
+      pcTmpCU = getPUAboveLeft(uiIdx, (m_uiAbsIdxInLCU + uiPartAddr), true, false, true);
+	  assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr));
+#else
+      pcTmpCU = getPUAboveLeft(uiIdx, uiPartIdxLT, true, true, true);
+#endif
+	if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
+	{
+		for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
+		{
+			eRefPicList = RefPicList(iList);
+			Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
+			if( refId >= 0)
+			{
+				Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
+				if (refViewIdx!= m_pcSlice->getViewId())
+				{
+				   TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
+				   clipMv(cMvPred);
+				   pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred; 
+				   pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
+				   return;
+				}
+			}
+		}
+	}
+	//Get temporal MV
+	TComMv cColMv;
+	Int iTargetViewIdx = 0;
+	Int iTStartViewIdx = 0;
+	UInt uiPartIdxRB, uiBRIdx;
+	Int uiViewIdxCurr= getSlice()->getViewId();
+
+	UInt uiAbsPartAddr;
+	int uiLCUIdx = getAddr();
+	Int uiLCUnew = uiLCUIdx;
+	eCUMode = getPartitionSize( 0 );
+	deriveRightBottomIdx( eCUMode, uiPartIdx, uiPartIdxRB );  
+	uiBRIdx = uiPartIdxLT;
+	UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];
+	if ( (( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) < m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) &&(( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getSPS()->getPicHeightInLumaSamples() ))  // image boundary check
+	{
+		if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) &&           // is not at the last column of LCU 
+			( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row    of LCU
+		{
+			uiBRIdx = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ];
+		}
+		else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 )           // is not at the last column of LCU But is last row of LCU
+		{
+			uiBRIdx = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ];
+			uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU();
+		}
+		else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
+		{
+			uiBRIdx = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ];
+			uiLCUnew = uiLCUIdx + 1;
+		}
+		else //is the right bottom corner of LCU                       
+		{
+			uiBRIdx = 0;
+			uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU() + 1;
+		}
+	}
+
+	Int MaxRef = getSlice()->getNumRefIdx(RefPicList(0));
+	UInt uiNumPartInCUHeight = m_pcPic->getNumPartInHeight();
+	UInt uiPUVert = (UInt)((Int)g_auiZscanToRaster[uiPartIdxLB]/(Int)(uiNumPartInCUWidth)-(Int)g_auiZscanToRaster[uiPartIdxLT]/(Int)(uiNumPartInCUWidth));
+	UInt uiPUHorStart  = g_auiZscanToRaster[uiPartIdxLT];
+	UInt uiPUHorEnd    = g_auiZscanToRaster[uiPartIdxRT];
+	for( Int i= 0; i< getSlice()->getNumRefIdx(RefPicList(0)); i ++)
+	{
+		getSlice()->getRefPic( RefPicList(0), i)->setCandPicCheckedFlag(0);
+	}
+	for( Int i= 0; i< getSlice()->getNumRefIdx(RefPicList(1)); i ++)
+	{
+		getSlice()->getRefPic( RefPicList(1), i)->setCandPicCheckedFlag(0);
+	}
+	{
+		//check the col-located picture
+		eRefPicList = RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0);
+#if COLLOCATED_REF_IDX
+		Int lpRef = getSlice()->getColRefIdx();
+#else
+		Int lpRef = 0;
+#endif
+		if( m_pcSlice->getViewId() == getSlice()->getRefPic( eRefPicList, lpRef)->getViewId() ) 
+		{
+			if (uiViewIdxCurr > 1)  
+			{
+				if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) )
+				{
+					clipMv(cColMv);
+					pDInfo->m_acMvCand[pDInfo->iN] = cColMv;
+					pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx;
+					return ;
+				}
+			}
+			for(UInt uiLoopVert = 0; uiLoopVert <= uiPUVert; uiLoopVert+=4)
+				for( uiIdx = uiPUHorStart; uiIdx <= uiPUHorEnd; uiIdx +=4 )
+				{
+					uiAbsPartAddr = g_auiRasterToZscan[uiIdx+uiNumPartInCUWidth*uiLoopVert];
+					if ( uiLCUIdx >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetViewIdx, iTStartViewIdx ) ) 
+					{
+						clipMv(cColMv);
+						pDInfo->m_acMvCand[pDInfo->iN] = cColMv;
+						pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx;
+						return ;
+					}
+				}
+				for(UInt uiIdx_y = 0; uiIdx_y <uiNumPartInCUHeight; uiIdx_y +=4 )
+					for(UInt uiIdx_X = 0; uiIdx_X <uiNumPartInCUWidth; uiIdx_X +=4 )
+					{
+						uiIdx = uiIdx_X + uiIdx_y * uiNumPartInCUWidth;
+						uiAbsPartAddr = g_auiRasterToZscan[uiIdx];
+						if ( uiLCUIdx >= 0 && xGetColDisMV( eRefPicList,  lpRef, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetViewIdx, iTStartViewIdx ) ) 
+						{
+							clipMv(cColMv);
+							pDInfo->m_acMvCand[pDInfo->iN] = cColMv;
+							pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx;
+							return ;
+						}
+					}
+					if (uiViewIdxCurr == 1)  
+					{
+						if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) ) 
+						{
+							clipMv(cColMv);
+							pDInfo->m_acMvCand[pDInfo->iN] = cColMv;
+							pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx;
+							return ;
+						}
+					}
+		}
+		getSlice()->getRefPic( eRefPicList, lpRef)->setCandPicCheckedFlag(1);
+	}
+	{
+		//check the remaining reference pictures in list0 and list1
+		if(getSlice()->isInterB())
+		{
+			if(getSlice()->getNumRefIdx(RefPicList(0))< getSlice()->getNumRefIdx(RefPicList(1)))
+				MaxRef = getSlice()->getNumRefIdx(RefPicList(1));
+		}
+		for(Int lpRef = 0; lpRef < MaxRef; lpRef++)
+		{
+			for(Int lpNr = 0; lpNr < (getSlice()->isInterB() ? 2: 1); lpNr ++)
+			{
+				eRefPicList = RefPicList(0);
+				if(getSlice()->isInterB())
+					eRefPicList = RefPicList(lpNr==0 ? (getSlice()->getColDir()): (1-getSlice()->getColDir()));
+				if(getSlice()->getRefPic( eRefPicList, lpRef)->getCandPicCheckedFlag())
+					continue;
+				
+				if(lpRef >= getSlice()->getNumRefIdx(eRefPicList)||(m_pcSlice->getViewId() != getSlice()->getRefPic( eRefPicList, lpRef)->getViewId()))
+					continue;
+				if (uiViewIdxCurr > 1 ) 
+				{
+					if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) )
+					{
+					clipMv(cColMv);
+					pDInfo->m_acMvCand[pDInfo->iN] = cColMv;
+					pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx;
+					return ;
+					}
+				}
+				for(UInt uiLoopVert = 0; uiLoopVert <= uiPUVert; uiLoopVert += 4)
+					for( uiIdx = uiPUHorStart; uiIdx <= uiPUHorEnd; uiIdx += 4 )
+					{
+						uiAbsPartAddr = g_auiRasterToZscan[uiIdx+uiNumPartInCUWidth*uiLoopVert];
+						if ( uiLCUIdx >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetViewIdx, iTStartViewIdx ) ) 
+						{
+							clipMv(cColMv);
+							pDInfo->m_acMvCand[pDInfo->iN] = cColMv;
+							pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx;
+							return ;
+						}
+					}
+				for(UInt uiIdx_y = 0; uiIdx_y <uiNumPartInCUHeight; uiIdx_y += 4 )
+					for(UInt uiIdx_X = 0; uiIdx_X <uiNumPartInCUWidth; uiIdx_X += 4 )
+					{
+						uiIdx = uiIdx_X + uiIdx_y * uiNumPartInCUWidth;
+						uiAbsPartAddr = g_auiRasterToZscan[uiIdx];
+						if ( uiLCUIdx >= 0 && xGetColDisMV( eRefPicList,  lpRef, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetViewIdx, iTStartViewIdx ) ) 
+						{
+							clipMv(cColMv);
+							pDInfo->m_acMvCand[pDInfo->iN] = cColMv;
+							pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx;
+							return ;
+						}
+					}
+				if (uiViewIdxCurr == 1 ) 
+				{
+					if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) )
+					{
+						clipMv(cColMv);
+						pDInfo->m_acMvCand[pDInfo->iN] = cColMv;
+						pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx;
+						return ;
+					}
+				}
+				getSlice()->getRefPic( eRefPicList, lpRef)->setCandPicCheckedFlag(1);
+			}//reference lists
+		}//reference indices
+	}//remaining pictures
+}
+#endif
 
 /** Constructs a list of candidates for AMVP
@@ -4295,9 +4636,26 @@
   }
   
+#if QC_MULTI_DIS_CAN
+  DisInfo cDisInfo;
+  cDisInfo.iN = 0;
+  if(m_pcSlice->getSPS()->getViewId() && m_pcSlice->getSPS()->getMultiviewMvPredMode())
+	 getDisMvpCand (uiPartIdx, uiPartAddr, &cDisInfo );
+  if(cDisInfo.iN==0)
+  {
+	  cDisInfo.iN = 1;
+	  cDisInfo.m_acMvCand[0].setHor(0);
+	  cDisInfo.m_acMvCand[0].setVer(0);
+	  cDisInfo.m_aVIdxCan[0] = 0;
+  }
+#endif 
 #if HHI_INTER_VIEW_MOTION_PRED
 #if ( PDM_AMVP_POS == 0 )
   // get inter-view mv predictor (at position 0)
   TComMv  cPdmMvPred;
+#if QC_MULTI_DIS_CAN
+  if( getPdmMvPredDisCan( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred, &cDisInfo ) )
+#else
   if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) )
+#endif
   {
     clipMv( cPdmMvPred );
@@ -4354,5 +4712,9 @@
   // get inter-view mv predictor (at position 1)
   TComMv  cPdmMvPred;
+#if QC_MULTI_DIS_CAN
+  if( getPdmMvPredDisCan( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred, &cDisInfo ) )
+#else
   if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) )
+#endif
   {
     clipMv( cPdmMvPred );
@@ -4402,5 +4764,9 @@
   // get inter-view mv predictor (at position 2)
   TComMv  cPdmMvPred;
+#if QC_MULTI_DIS_CAN
+  if( getPdmMvPredDisCan( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred, &cDisInfo ) )
+#else
   if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) )
+#endif
   {
     clipMv( cPdmMvPred );
@@ -4418,4 +4784,24 @@
     }
   }
+#if  QC_MULTI_DIS_CAN
+  if ( getSlice()->getViewId()!=0 && pInfo->iN == 3 )
+  {
+    if ( pInfo->m_acMvCand[ 1 ] == pInfo->m_acMvCand[ 2 ] )
+    {
+      pInfo->iN = 2;
+	  if( pInfo->m_acMvCand[ 0 ] == pInfo->m_acMvCand[ 1 ] )
+		 pInfo->iN = 1;
+    }else
+	{
+	 if( pInfo->m_acMvCand[ 0 ] == pInfo->m_acMvCand[ 1 ] )
+	  {
+		pInfo->m_acMvCand[1 ] = pInfo->m_acMvCand[ 2 ];
+		pInfo->iN = 2;
+	  }
+	  else if (pInfo->m_acMvCand[ 0 ] == pInfo->m_acMvCand[ 2 ])
+	  	 pInfo->iN = 2;
+	}
+  }
+#endif
 #endif
 
@@ -4488,5 +4874,9 @@
   // get inter-view mv predictor (at position 3)
   TComMv  cPdmMvPred;
+#if QC_MULTI_DIS_CAN
+  if( getPdmMvPredDisCan( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred, &cDisInfo ) )
+#else
   if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) )
+#endif
   {
     clipMv( cPdmMvPred );
@@ -4908,4 +5298,49 @@
 }
 
+#if QC_MULTI_DIS_CAN
+Bool TComDataCU::xGetColDisMV( RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv , Int & iTargetViewIdx, Int & iStartViewIdx )
+{
+
+  UInt uiAbsPartAddr = uiPartUnitIdx;
+
+  RefPicList  eColRefPicList = REF_PIC_LIST_0;
+  Int iColViewIdx, iColRefViewIdx, iCurrViewIdx;
+  iCurrViewIdx     = m_pcSlice->getViewId();
+  TComPic *pColPic = getSlice()->getRefPic( eRefPicList, refidx);
+  TComDataCU *pColCU = pColPic->getCU( uiCUAddr );
+  iColViewIdx = pColCU->getSlice()->getViewId();
+
+  if (pColCU->getPic()==0||pColCU->getPartitionSize(uiPartUnitIdx)==SIZE_NONE||pColCU->isIntra(uiAbsPartAddr))
+  {
+    return false;
+  }
+  for (Int ilist = 0; ilist < (pColCU->getSlice()->isInterB()? 2:1); ilist++) 
+  {
+   if(pColCU->getSlice()->isInterB())
+   {
+		if(ilist == 0 )
+	    	eColRefPicList = getSlice()->getCheckLDC() ? eRefPicList : RefPicList(1-getSlice()->getColDir());
+		else
+		 	eColRefPicList = getSlice()->getCheckLDC() ? (eRefPicList== REF_PIC_LIST_0? REF_PIC_LIST_1:REF_PIC_LIST_0 ): RefPicList(getSlice()->getColDir());
+	}
+    int iColRefIdx = pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr);
+    if (iColRefIdx < 0)
+    {
+      continue;
+    }
+	iColRefViewIdx = pColCU->getSlice()->getRefPic(eColRefPicList, iColRefIdx)->getViewId();
+    if ( iColViewIdx    == iColRefViewIdx ) // temporal vector
+      continue;
+    else 
+    {
+	  rcMv = pColCU->getCUMvField(eColRefPicList)->getMv(uiAbsPartAddr);
+      iTargetViewIdx  = iColRefViewIdx ;
+      iStartViewIdx   = iColViewIdx   ;
+	  return true;    
+    }
+  }
+  return false;
+}
+#endif 
 /** 
  * \param eRefPicList
@@ -5951,4 +6386,5 @@
 // -------------------------------------------------------------------------------------------------------------------
 #if HHI_INTER_VIEW_MOTION_PRED
+#if !QC_MULTI_DIS_CAN
 Int
 TComDataCU::getPdmMergeCandidate( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv )
@@ -5967,4 +6403,22 @@
   return pcDepthMapGenerator->getPdmMvPred( this, uiPartIdx, eRefPicList, iRefIdx, rcMv, bMerge );
 }
+#else
+Int
+TComDataCU::getPdmMergeCandidateDisCan( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo )
+{
+  TComDepthMapGenerator* pcDepthMapGenerator = m_pcSlice->getSPS()->getDepthMapGenerator();
+  ROFRS( pcDepthMapGenerator, 0 );
+  return pcDepthMapGenerator->getPdmMergeCandidate( this, uiPartIdx, paiPdmRefIdx, pacPdmMv, pDInfo );
+}
+Bool
+TComDataCU::getPdmMvPredDisCan( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, DisInfo* pDInfo, Bool bMerge )
+{
+  TComDepthMapGenerator* pcDepthMapGenerator = m_pcSlice->getSPS()->getDepthMapGenerator();
+  ROFRS( pcDepthMapGenerator, false );
+  if (pDInfo->iN > 0 && pcDepthMapGenerator->getDisCanPdmMvPred(this, uiPartIdx, eRefPicList, iRefIdx, rcMv, pDInfo, bMerge )) //bug fix li
+    return true;
+  return false;
+}
+#endif
 
 
@@ -5988,4 +6442,26 @@
   TComResidualGenerator*  pcResidualGenerator = m_pcSlice->getSPS()->getResidualGenerator();
   ROFRS( pcResidualGenerator, false );
+#if QC_MULTI_DIS_CAN
+   DisInfo cDisInfo;
+   cDisInfo.iN = 0;
+   PartSize m_peSaved =  getPartitionSize( 0 );
+   m_pePartSize[0] =  SIZE_2Nx2N;
+   getDisMvpCand        ( 0, 0,  &cDisInfo );
+   if( cDisInfo.iN == 0)
+   {
+	   m_pePartSize[0] = m_peSaved;
+		return false;
+   }
+   else
+   {
+	   Bool bAvailable = pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, cDisInfo.m_acMvCand[0].getHor() 
+#if QC_SIMPLIFIEDIVRP_M24938
+    , bRecon 
+#endif
+	   );
+	   m_pePartSize[0] = m_peSaved;
+	   return bAvailable;
+   }
+#else
   return pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv 
 #if QC_SIMPLIFIEDIVRP_M24938
@@ -5993,4 +6469,5 @@
 #endif
     );
+#endif
 }
 #endif
Index: branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/TComDataCU.h
===================================================================
--- branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/TComDataCU.h	(revision 89)
+++ branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/TComDataCU.h	(revision 91)
@@ -256,4 +256,7 @@
   Void          deriveRightBottomIdx        ( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxRB );
   Bool          xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx );
+#if QC_MULTI_DIS_CAN
+  Bool          xGetColDisMV( RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int & iTargetViewIdx, Int & iStartViewIdx );
+#endif 
   
 #if !AMVP_PRUNING_SIMPLIFICATION
@@ -503,6 +506,12 @@
 
 #if HHI_INTER_VIEW_MOTION_PRED
+#if !QC_MULTI_DIS_CAN
   Int           getPdmMergeCandidate( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv );
   Bool          getPdmMvPred( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, Bool bMerge = false );
+#else
+  Bool          getPdmMvPredDisCan( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, DisInfo* pDInfo, Bool bMerge = false );
+  Int           getPdmMergeCandidateDisCan( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo );
+  Void          getDisMvpCand        ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo );
+#endif
   Bool          getIViewOrgDepthMvPred( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv );
 #endif
Index: branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/TComDepthMapGenerator.cpp
===================================================================
--- branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/TComDepthMapGenerator.cpp	(revision 89)
+++ branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/TComDepthMapGenerator.cpp	(revision 91)
@@ -78,4 +78,5 @@
   m_uiSubSampExpX       = uiSubSampExpX;
   m_uiSubSampExpY       = uiSubSampExpY;
+#if !QC_MULTI_DIS_CAN
   m_ppcYuv              = new TComYuv*    [ m_uiMaxDepth ];
   m_ppcCU               = new TComDataCU* [ m_uiMaxDepth ];
@@ -91,4 +92,5 @@
   m_cTmpPic.create( uiPicWidth >> m_uiSubSampExpX, uiPicHeight >> m_uiSubSampExpY, uiMaxCUWidth >> m_uiSubSampExpX, uiMaxCUHeight >> m_uiSubSampExpY, uiMaxCUDepth );
   xSetChroma( &m_cTmpPic, ( 1 << uiOrgBitDepth ) >> 1 );
+#endif
   m_bCreated    = true;
 }
@@ -100,4 +102,5 @@
   {
     m_bCreated    = false;
+#if !QC_MULTI_DIS_CAN
     for( UInt uiDepth = 0; uiDepth < m_uiMaxDepth; uiDepth++ )
     {
@@ -114,4 +117,5 @@
     delete [] m_ppcCU;  m_ppcCU  = 0;
     m_cTmpPic.destroy();
+#endif
     m_uiMaxDepth          = 0;
     m_uiOrgDepthBitDepth  = 0;
@@ -178,12 +182,15 @@
 
   // set basic SPS parameters
+//#if !QC_MULTI_DIS_CAN
   const Int iDisparityDir = 1; // 1 or -1, depending on the usage of disparity vectors
+//#endif
   TComSPS*  pcSPS         = pcPic->getSPS                 ();
   Int       iVOI          = pcSPS->getViewOrderIdx        ();
+//#if !QC_MULTI_DIS_CAN
   UInt      uiPdmPrec     = pcSPS->getPdmPrecision        ();
   UInt      uiCamPrec     = pcSPS->getCamParPrecision     ();
   Bool      bInSlice      = pcSPS->hasCamParInSliceHeader ();
   Int       iScaleVOI01   = ( 1 << ( uiPdmPrec + PDM_INTER_CALC_SHIFT + PDM_VIRT_DEPTH_PRECISION - 2 ) );
-
+//#endif
   // check availability of base views and set base id list
   std::vector<Int>  aiAbsDeltaVOI;
@@ -214,5 +221,5 @@
     aiAbsDeltaVOI[ uiNextBaseId ] = 0;
   }
-
+//#if !QC_MULTI_DIS_CAN
   // check availability of prediction depth map
   if( m_uiCurrViewId )
@@ -365,7 +372,19 @@
   }
 #endif
-}
-
-
+//#else
+//  if( m_uiCurrViewId )
+//  {
+//    Bool      bCheckVId1  = ( m_uiCurrViewId > 1 && m_auiBaseIdList[0] == 0 );
+//    UInt      uiBaseVId   = ( bCheckVId1 ? 1 : m_auiBaseIdList[0] );
+//    TComPic*  pcBasePic   = m_pcAUPicAccess->getPic( uiBaseVId );
+//    SliceType eSliceType  = pcBasePic->getCurrSlice()->getSliceType();
+//    Bool      bNoRAPdm    = ( pcPic->getSPS()->getPredDepthMapGeneration() == 1 );
+//    m_bPDMAvailable       = ( eSliceType != I_SLICE || !bNoRAPdm );
+//}
+//#endif
+
+}
+
+#if !QC_MULTI_DIS_CAN
 Bool
 TComDepthMapGenerator::predictDepthMap( TComPic* pcPic )
@@ -520,5 +539,5 @@
   m_cTmpPic.dump( acFilename, ( pcPic->getPOC() != 0 )  );
 }
-
+#endif
 
 #if HHI_INTER_VIEW_MOTION_PRED
@@ -563,6 +582,11 @@
 
 #if HHI_INTER_VIEW_MOTION_PRED
+#if QC_MULTI_DIS_CAN
+Int
+TComDepthMapGenerator::getPdmMergeCandidate( TComDataCU* pcCU, UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo )
+#else
 Int
 TComDepthMapGenerator::getPdmMergeCandidate( TComDataCU* pcCU, UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv )
+#endif 
 {
   Int  iMaxNumInterPics  = 1;
@@ -580,5 +604,9 @@
       if( pcCU->getSlice()->getRefPOC( eRefPicList, iPdmRefIdx ) != pcCU->getSlice()->getPOC() )
       {
+#if QC_MULTI_DIS_CAN
+		if( getDisCanPdmMvPred (pcCU, uiPartIdx, eRefPicList, iPdmRefIdx, cMv, pDInfo, true ) )       
+#else 
         if( getPdmMvPred( pcCU, uiPartIdx, eRefPicList, iPdmRefIdx, cMv, true ) )
+#endif
         {
           pcCU->clipMv( cMv );
@@ -602,5 +630,9 @@
       for( Int iPdmRefIdx = 0; iPdmRefIdx < iNumRefPics; iPdmRefIdx++ )
       {
+#if QC_MULTI_DIS_CAN
+		if ( getDisCanPdmMvPred (pcCU, uiPartIdx, eRefPicList, iPdmRefIdx, cMv, pDInfo, true ) ) 
+#else 
         if( getPdmMvPred( pcCU, uiPartIdx, eRefPicList, iPdmRefIdx, cMv, true ) )
+#endif
         {
           pcCU->clipMv( cMv );
@@ -617,5 +649,76 @@
 }
 
-
+#if QC_MULTI_DIS_CAN
+Bool
+TComDepthMapGenerator::getDisCanPdmMvPred    ( TComDataCU*   pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, DisInfo* pDInfo, Bool bMerge )
+{
+  AOF  ( m_bCreated && m_bInit );
+  AOF  ( iRefIdx >= 0 );
+  AOF  ( pcCU );
+  //ROFRS( m_bPDMAvailable, false );
+  TComSlice*    pcSlice     = pcCU->getSlice ();
+  TComSPS*      pcSPS       = pcSlice->getSPS();
+  AOF  ( pcSPS->getViewId() == m_uiCurrViewId );
+  TComPic*      pcRefPic    = pcSlice->getRefPic( eRefPicList, iRefIdx );
+  UInt          uiRefViewId = pcRefPic->getSPS()->getViewId();
+  Int           iRefPoc     = pcRefPic->getPOC();
+  Bool          bInterview  = ( uiRefViewId < m_uiCurrViewId );
+  AOT(  bInterview && iRefPoc != pcSlice->getPOC() );
+  AOT( !bInterview && iRefPoc == pcSlice->getPOC() );
+  Bool          bPdmIView   = ( ( pcSPS->getMultiviewMvPredMode() & PDM_USE_FOR_IVIEW ) == PDM_USE_FOR_IVIEW );
+  Bool          bPdmInter   = ( ( pcSPS->getMultiviewMvPredMode() & PDM_USE_FOR_INTER ) == PDM_USE_FOR_INTER );
+  Bool          bPdmMerge   = ( ( pcSPS->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) == PDM_USE_FOR_MERGE );
+  ROTRS( ( bInterview && !bMerge ) && !bPdmIView, false );
+  ROTRS( (!bInterview && !bMerge ) && !bPdmInter, false );
+  ROTRS(                  bMerge   && !bPdmMerge, false );
+  Int  iCurrPosX, iCurrPosY;
+  TComMv cDisMv;
+
+  if( bInterview )
+  {
+    rcMv = pDInfo->m_acMvCand[0]; 
+	rcMv.setVer(0);
+    return      true;
+  }
+  for( UInt uiBId = 0; uiBId < m_uiCurrViewId; uiBId++ )
+  {
+    UInt        uiBaseId    = uiBId;  //m_auiBaseIdList[ uiBId ];
+	if (m_uiCurrViewId >1 && uiBaseId ==1 ) continue;
+    TComPic*    pcBasePic   = m_pcAUPicAccess->getPic( uiBaseId );
+    TComPicYuv* pcBaseRec   = pcBasePic->getPicYuvRec   ();
+	UInt          uiPartAddr;
+	Int           iWidth;
+	Int           iHeight;
+	pcCU->getPartIndexAndSize( uiPartIdx, uiPartAddr, iWidth, iHeight );
+    pcBaseRec->getTopLeftSamplePos( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr, iCurrPosX, iCurrPosY );
+	iCurrPosX  += ( ( iWidth  - 1 ) >> 1 );
+	iCurrPosY  += ( ( iHeight - 1 ) >> 1 );
+    Int         iBasePosX   = Clip3( 0, pcBaseRec->getWidth () - 1, iCurrPosX + ( (pDInfo->m_acMvCand[0].getHor() + 2 ) >> 2 ) );
+    Int         iBasePosY   = Clip3( 0, pcBaseRec->getHeight() - 1, iCurrPosY + ( (pDInfo->m_acMvCand[0].getVer() + 2 ) >> 2 ));  
+	Int         iBaseCUAddr;
+    Int         iBaseAbsPartIdx;
+	pcBaseRec->getCUAddrAndPartIdx( iBasePosX , iBasePosY , iBaseCUAddr, iBaseAbsPartIdx );
+    TComDataCU* pcBaseCU    = pcBasePic->getCU( iBaseCUAddr );
+    if( pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) != MODE_INTER && pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) != MODE_SKIP )
+    {
+      continue;
+    }
+    for( UInt uiBaseRefListId = 0; uiBaseRefListId < 2; uiBaseRefListId++ )
+    {
+      RefPicList  eBaseRefPicList = RefPicList( uiBaseRefListId );
+      TComMvField cBaseMvField;
+      pcBaseCU->getMvField( pcBaseCU, iBaseAbsPartIdx, eBaseRefPicList, cBaseMvField );
+      Int         iBaseRefIdx     = cBaseMvField.getRefIdx();
+      Int         iBaseRefPoc     = ( iBaseRefIdx >= 0 ? pcBaseCU->getSlice()->getRefPic( eBaseRefPicList, iBaseRefIdx )->getPOC() : -(1<<30) );
+      if( iBaseRefIdx >= 0 && iBaseRefPoc == iRefPoc )
+      {
+        rcMv.set( cBaseMvField.getHor(), cBaseMvField.getVer() );
+        return true;
+      }
+    }
+  }
+  return false;
+}
+#else
 Bool  
 TComDepthMapGenerator::getPdmMvPred( TComDataCU* pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, Bool bMerge )
@@ -697,4 +800,5 @@
   return false;
 }
+#endif
 
 
@@ -744,5 +848,5 @@
 
 
-
+#if !QC_MULTI_DIS_CAN
 /*=======================================================*
  *=====                                             =====*
@@ -1511,4 +1615,5 @@
   return        true;
 }
+#endif
 
 #endif // DEPTH_MAP_GENERATION
Index: branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/TComDepthMapGenerator.h
===================================================================
--- branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/TComDepthMapGenerator.h	(revision 89)
+++ branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/TComDepthMapGenerator.h	(revision 91)
@@ -136,7 +136,9 @@
 
   Void  initViewComponent     ( TComPic*      pcPic );
+#if !QC_MULTI_DIS_CAN
   Bool  predictDepthMap       ( TComPic*      pcPic );
   Void  updateDepthMap        ( TComPic*      pcPic );
   Void  dumpDepthMap          ( TComPic*      pcPic, char* pFilenameBase );
+#endif
 
 #if HHI_INTER_VIEW_MOTION_PRED
@@ -149,6 +151,12 @@
   Int   getDisparity          ( TComPic*      pcPic, Int iPosX, Int iPosY, UInt uiRefViewId );
 #if HHI_INTER_VIEW_MOTION_PRED
+#if QC_MULTI_DIS_CAN
+  Int   getPdmMergeCandidate ( TComDataCU*   pcCU, UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo );
+  Bool  getPdmMvPredDisCan    ( TComDataCU*   pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, DisInfo* pDInfo, Bool bMerge );
+  Bool  getDisCanPdmMvPred    ( TComDataCU*   pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, DisInfo* pDInfo, Bool bMerge );
+#else
   Int   getPdmMergeCandidate  ( TComDataCU*   pcCU, UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv );
   Bool  getPdmMvPred          ( TComDataCU*   pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, Bool bMerge );
+#endif
   Bool  getIViewOrgDepthMvPred( TComDataCU*   pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv );
 #endif
@@ -163,4 +171,5 @@
 private:
   // picture operations
+#if !QC_MULTI_DIS_CAN
   Bool  xConvertDepthMapCurr2Ref  ( TComPic*    pcRef, TComPic* pcCur );
   Bool  xConvertDepthMapRef2Curr  ( TComPic*    pcCur, TComPic* pcRef );
@@ -182,5 +191,5 @@
   Void  xInterPUDepthMapPrediction( TComDataCU* pcCU, TComYuv* pcCUDepthMap, UInt uiPartIdx );                      // PU inter prediction
   Bool  xGetPredDepth             ( TComDataCU* pcCU, UInt uiPartIdx, Int& riPrdDepth, Int* piPosX = 0, Int* piPosY = 0 );
-
+#endif
   // conversion functions
   Int   xGetVirtDepthFromDisparity( UInt uiBaseId, Int iDisparity )
Index: branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/TComMotionInfo.h
===================================================================
--- branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/TComMotionInfo.h	(revision 89)
+++ branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/TComMotionInfo.h	(revision 91)
@@ -59,4 +59,12 @@
 
 // ====================================================================================================================
+#if QC_MULTI_DIS_CAN
+typedef struct _DisCand
+{
+  TComMv m_acMvCand[ DIS_CANS ];            ///< array of motion vector predictor candidates
+  Int    m_aVIdxCan[ DIS_CANS ];            ///< array of motion vector predictor candidates
+  Int    iN;                                ///< number of motion vector predictor candidates
+} DisInfo;
+#endif 
 // Class definition
 // ====================================================================================================================
Index: branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/TComPic.h
===================================================================
--- branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/TComPic.h	(revision 89)
+++ branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/TComPic.h	(revision 91)
@@ -71,4 +71,7 @@
 #if HHI_INTER_VIEW_MOTION_PRED
   TComPicYuv*           m_pcOrgDepthMap;          //  original depth map
+#if QC_MULTI_DIS_CAN
+  Bool					m_checked;
+#endif
 #endif
 #if HHI_INTER_VIEW_RESIDUAL_PRED
@@ -140,4 +143,8 @@
 #if HHI_INTER_VIEW_MOTION_PRED
   TComPicYuv*   getOrgDepthMap()      { return  m_pcOrgDepthMap; }
+#if QC_MULTI_DIS_CAN
+  Void			setCandPicCheckedFlag (Bool bchecked)		{ m_checked = bchecked; }
+  Bool          getCandPicCheckedFlag ()					{ return m_checked;}
+#endif
 #endif
 
Index: branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/TComResidualGenerator.cpp
===================================================================
--- branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/TComResidualGenerator.cpp	(revision 89)
+++ branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/TComResidualGenerator.cpp	(revision 91)
@@ -219,5 +219,12 @@
 }
 
-
+#if QC_MULTI_DIS_CAN
+Bool
+TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, Int iDisp
+#if QC_SIMPLIFIEDIVRP_M24938
+  , Bool bRecon
+#endif
+ ) 
+#else
 Bool
 TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv 
@@ -226,4 +233,5 @@
 #endif
   )
+#endif
 {
   AOF(  pcCU );
@@ -235,4 +243,11 @@
   iBlkHeight  = pcCU->getHeight ( 0 );
   pcCU->getPic()->getPicYuvRec()->getTopLeftSamplePos( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr, iXPos, iYPos );
+#if QC_MULTI_DIS_CAN
+  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 
 #if QC_SIMPLIFIEDIVRP_M24938
@@ -240,6 +255,15 @@
 #endif
     );
+#endif
 }
   
+#if QC_MULTI_DIS_CAN
+Bool
+TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp 
+#if QC_SIMPLIFIEDIVRP_M24938
+  , Bool bRecon
+#endif
+)
+#else
 Bool
 TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv 
@@ -248,4 +272,5 @@
 #endif
   )
+#endif
 {
   UInt  uiBaseViewId  = m_pcDepthMapGenerator->getBaseViewId( 0 );
@@ -258,4 +283,11 @@
   UInt uiXPosInRefView = uiXPos , uiYPosInRefView = uiYPos;
 #endif
+#if QC_MULTI_DIS_CAN
+  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 
 #if QC_SIMPLIFIEDIVRP_M24938
@@ -263,5 +295,5 @@
 #endif
     );
-
+#endif
 #if QC_SIMPLIFIEDIVRP_M24938
   return xIsNonZeroByCBF( uiBaseViewId , uiXPosInRefView , uiYPosInRefView , uiBlkWidth , uiBlkHeight );
@@ -485,5 +517,12 @@
 
 
-
+#if QC_MULTI_DIS_CAN
+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
+)
+#else
 Void  
 TComResidualGenerator::xSetPredResidualBlock( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv 
@@ -492,4 +531,5 @@
 #endif
   )
+#endif
 {
   //===== set and check some basic variables =====
@@ -508,8 +548,11 @@
 
   //===== get disparity =====
+#if QC_MULTI_DIS_CAN
+  Int iDisparity = iDisp;
+#else
   Int           iMidPosX    = Int( uiXPos + ( ( uiBlkWidth  - 1 ) >> 1 ) ) >> m_pcDepthMapGenerator->getSubSampExpX();
   Int           iMidPosY    = Int( uiYPos + ( ( uiBlkHeight - 1 ) >> 1 ) ) >> m_pcDepthMapGenerator->getSubSampExpY();
   Int           iDisparity  = m_pcDepthMapGenerator->getDisparity( pcPic, iMidPosX, iMidPosY, uiBaseViewId );
-
+#endif
   //===== compensate luma =====
   Int           iYWidth     = Int( uiBlkWidth  );
Index: branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/TComResidualGenerator.h
===================================================================
--- branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/TComResidualGenerator.h	(revision 89)
+++ branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/TComResidualGenerator.h	(revision 91)
@@ -69,4 +69,16 @@
   Void  setRecResidualPic     ( TComPic*      pcPic );
 
+#if QC_MULTI_DIS_CAN
+  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  
+  );
+#else
   Bool  getResidualSamples    ( TComDataCU*   pcCU,  UInt uiPUIdx, TComYuv* pcYuv 
 #if QC_SIMPLIFIEDIVRP_M24938
@@ -79,4 +91,5 @@
 #endif
     );
+#endif
 
 private:
@@ -87,5 +100,11 @@
   Void  xClearIntViewResidual ( TComDataCU*   pcCU,  TComYuv* pcCUResidual, UInt uiPartIdx    );
   Void  xClearResidual        (                      TComYuv* pcCUResidual, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight );
-
+#if QC_MULTI_DIS_CAN
+  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
+  );
+#else
   Void  xSetPredResidualBlock ( TComPic*      pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv 
 #if QC_SIMPLIFIEDIVRP_M24938
@@ -93,4 +112,5 @@
 #endif
     );
+#endif
   Bool  xIsNonZero            ( TComYuv*      pcYuv, UInt uiBlkWidth, UInt uiBlkHeight );
 #if QC_SIMPLIFIEDIVRP_M24938
Index: branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/TypeDef.h	(revision 89)
+++ branches/HTM-3.1-Qualcomm/source/Lib/TLibCommon/TypeDef.h	(revision 91)
@@ -47,4 +47,9 @@
 #define HHI_INTER_VIEW_RESIDUAL_PRED      1   // inter-view residual prediction
 #define HHI_FIX                           1   // inter-view prediction and other fixes
+#define QC_MULTI_DIS_CAN			1
+#if QC_MULTI_DIS_CAN
+    #define DIS_CANS				1
+#endif
+
 
 #define HHI_VSO                           1
Index: branches/HTM-3.1-Qualcomm/source/Lib/TLibDecoder/TDecGop.cpp
===================================================================
--- branches/HTM-3.1-Qualcomm/source/Lib/TLibDecoder/TDecGop.cpp	(revision 89)
+++ branches/HTM-3.1-Qualcomm/source/Lib/TLibDecoder/TDecGop.cpp	(revision 91)
@@ -303,5 +303,7 @@
     {
       m_pcDepthMapGenerator->initViewComponent( rpcPic );
+#if !QC_MULTI_DIS_CAN
       m_pcDepthMapGenerator->predictDepthMap  ( rpcPic );
+#endif
 #if HHI_INTER_VIEW_RESIDUAL_PRED
       m_pcResidualGenerator->initViewComponent( rpcPic );
@@ -339,6 +341,8 @@
 #endif
 #if DEPTH_MAP_GENERATION
+#if !QC_MULTI_DIS_CAN
     // update virtual depth map
     m_pcDepthMapGenerator->updateDepthMap( rpcPic );
+#endif
 #endif
     // deblocking filter
Index: branches/HTM-3.1-Qualcomm/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- branches/HTM-3.1-Qualcomm/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 89)
+++ branches/HTM-3.1-Qualcomm/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 91)
@@ -691,8 +691,12 @@
       // init view component and predict virtual depth map
       m_pcDepthMapGenerator->initViewComponent( pcPic );
+#if !QC_MULTI_DIS_CAN
       m_pcDepthMapGenerator->predictDepthMap  ( pcPic );
 #endif
+#endif
 #if HHI_INTER_VIEW_MOTION_PRED
+//#if !QC_MULTI_DIS_CAN
       m_pcDepthMapGenerator->covertOrgDepthMap( pcPic );
+//#endif
 #endif
 #if HHI_INTER_VIEW_RESIDUAL_PRED
@@ -758,6 +762,8 @@
 #endif
 #if DEPTH_MAP_GENERATION
+#if !QC_MULTI_DIS_CAN
       // update virtual depth map
       m_pcDepthMapGenerator->updateDepthMap( pcPic );
+#endif
 #endif
 
