Index: branches/HTM-8.2-dev2-Qualcomm/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- branches/HTM-8.2-dev2-Qualcomm/source/Lib/TLibCommon/TComDataCU.cpp	(revision 664)
+++ branches/HTM-8.2-dev2-Qualcomm/source/Lib/TLibCommon/TComDataCU.cpp	(revision 669)
@@ -3522,4 +3522,8 @@
   deriveLeftRightTopIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT );
   deriveLeftBottomIdxGeneral  ( uiAbsPartIdx, uiPUIdx, uiPartIdxLB );
+#if QC_DEPTH_IV_MRG_F0125
+  Bool bIsDepth = getSlice()->getIsDepth();
+  Bool bDepthIPMCAvai = false;
+#endif 
 #if H_3D_IV_MERGE
   
@@ -3621,5 +3625,9 @@
   if ( ivMvPredFlag )
   {
-    getInterViewMergeCands(uiPUIdx, ivCandRefIdx, ivCandMv, &cDisInfo, ivCandDir );
+    getInterViewMergeCands(uiPUIdx, ivCandRefIdx, ivCandMv, &cDisInfo, ivCandDir 
+#if QC_DEPTH_IV_MRG_F0125
+    , bIsDepth
+#endif
+    );
   }  
   
@@ -3642,4 +3650,30 @@
     }
 
+#if QC_DEPTH_IV_MRG_F0125
+    if ( bIsDepth )
+    {
+      Bool bRemoveSpa = false;
+      Int iCnloop = iCount-1;
+      for(; iCnloop >= 0; iCnloop --)
+      {
+        if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
+        {
+          bRemoveSpa                      = true;
+          abCandIsInter        [ iCount ] = false;
+
+          puhInterDirNeighbours[iCount]   = 0;
+          pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID );
+          pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
+          break;
+        }
+      }
+      if(!bRemoveSpa)
+      {
+        bDepthIPMCAvai = true;
+      }
+    }
+    if ( bDepthIPMCAvai || !bIsDepth )
+    {
+#endif
     if ( mrgCandIdx == iCount )
     {
@@ -3647,4 +3681,7 @@
     }
     iCount ++;
+#if QC_DEPTH_IV_MRG_F0125
+    }
+#endif
   } 
 
@@ -3682,5 +3719,9 @@
 #if H_3D_IV_MERGE 
     Bool bRemoveSpa = false; //pruning to inter-view candidates
+#if QC_DEPTH_IV_MRG_F0125
+    Int  iCnloop = bDepthIPMCAvai ? (iCount-2): (iCount-1);
+#else
     Int  iCnloop    = iCount - 1;
+#endif
     for(; iCnloop >= 0; iCnloop --)
     {
@@ -3758,5 +3799,13 @@
 #if H_3D_IV_MERGE 
     Bool bRemoveSpa = false; //pruning to inter-view candidates
+#if QC_DEPTH_IV_MRG_F0125
+    Int iCnloop;
+    if( bIsDepth )
+      iCnloop = (bLeftAvai && bDepthIPMCAvai) ? (iCount-3) : ((bLeftAvai || bDepthIPMCAvai)  ? (iCount-2): (iCount-1));
+    else
+      iCnloop = bLeftAvai? (iCount-2): (iCount-1);
+#else
     Int  iCnloop    = bLeftAvai? (iCount-2): (iCount-1);
+#endif
     for(; iCnloop >= 0; iCnloop --)
     {
@@ -5411,4 +5460,54 @@
   riPosX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIndex]] + getCUPelX();
   riPosY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIndex]] + getCUPelY();  
+}
+#endif
+#if QC_DEPTH_IV_MRG_F0125
+Bool TComDataCU::getDispNeighBlocks (UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDisp)
+{
+  Pel pDepPos[3] = {0, 0, 0};
+  assert(getPartitionSize( uiPartAddr ) == SIZE_2Nx2N);
+  Bool bDepAvail = false;
+  Pel *pDepth  = this->getPic()->getPicYuvRec()->getLumaAddr();
+  Int iDepStride =  this->getPic()->getPicYuvRec()->getStride();
+  TComMv cMv; 
+
+  Int xP, yP, nPSW, nPSH;
+  this->getPartPosition(uiPartIdx, xP, yP, nPSW, nPSH);
+
+  if(xP != 0 && yP != 0)
+  {
+    pDepPos[0] = pDepth[ (yP-1) * iDepStride + (xP-1) ];
+    bDepAvail = true;
+  }
+
+  if(xP != 0)
+  {
+    pDepPos[1] = pDepth[ (yP+nPSH-1) * iDepStride + (xP-1) ];
+    bDepAvail = true;
+  }
+
+  if(yP != 0)
+  {
+    pDepPos[2] = pDepth[ (yP-1) * iDepStride + (xP+nPSW-1) ];
+    bDepAvail = true;
+  }
+
+  if (bDepAvail)
+  {
+    Pel pAvgDepth = (xP != 0 && yP != 0) ? ((5*pDepPos[0] + 5*pDepPos[1] + 6*pDepPos[2] + 8)>>4) : (xP == 0) ? pDepPos[2] : pDepPos[1];
+    Int iDisp     = getSlice()->getDepthToDisparityB( 0 )[ pAvgDepth ];
+    cMv.setHor(iDisp);
+    cMv.setVer(0);
+    pDisp->m_acNBDV = cMv;
+    pDisp->m_aVIdxCan = 0;
+    return true;
+  }
+  else
+  {  
+    cMv.setZero();
+    pDisp->m_acNBDV = cMv;
+    pDisp->m_aVIdxCan = 0;
+    return false;
+  }
 }
 #endif
@@ -5944,5 +6043,9 @@
 #if H_3D_IV_MERGE
 Bool
-TComDataCU::getInterViewMergeCands(UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc )
+TComDataCU::getInterViewMergeCands(UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc 
+#if QC_DEPTH_IV_MRG_F0125
+, Bool bIsDepth           
+#endif
+)
 {
   TComSlice*    pcSlice = getSlice ();  
@@ -5950,5 +6053,9 @@
   
   //--- get base CU/PU and check prediction mode ---
+#if QC_DEPTH_IV_MRG_F0125
+  TComPic*    pcBasePic   = pcSlice->getIvPic( bIsDepth, iViewIndex );
+#else
   TComPic*    pcBasePic   = pcSlice->getIvPic( false, iViewIndex );
+#endif
   TComPicYuv* pcBaseRec   = pcBasePic->getPicYuvRec   ();
 
@@ -5961,6 +6068,11 @@
   pcBaseRec->getTopLeftSamplePos( getAddr(), getZorderIdxInCU() + uiPartAddr, iCurrPosX, iCurrPosY );
 
+#if QC_DEPTH_IV_MRG_F0125
+  iCurrPosX  += ( iWidth  >> 1 );
+  iCurrPosY  += ( iHeight >> 1 );
+#else
   iCurrPosX  += ( ( iWidth  - 1 ) >> 1 );
   iCurrPosY  += ( ( iHeight - 1 ) >> 1 );
+#endif
 
   Bool depthRefineFlag = false; 
@@ -6026,8 +6138,15 @@
                   TComMv cMv(cBaseMvField.getHor(), cBaseMvField.getVer());
 #if H_3D_NBDV 
-                  cMv.setIDVFlag   (true);
-                  cMv.setIDVHor    (cDv.getHor());                  
-                  cMv.setIDVVer    (cDv.getVer());  
-                  cMv.setIDVVId    (iViewIndex); 
+#if QC_DEPTH_IV_MRG_F0125
+                  if( !bIsDepth )
+                  {
+#endif
+                    cMv.setIDVFlag   (true);
+                    cMv.setIDVHor    (cDv.getHor());                  
+                    cMv.setIDVVer    (cDv.getVer());  
+                    cMv.setIDVVId    (iViewIndex); 
+#if QC_DEPTH_IV_MRG_F0125
+                  }
+#endif
 #endif
                   clipMv( cMv );
@@ -6071,4 +6190,8 @@
 #endif
           cMv.setHor( cMv.getHor() + ioffsetDV );
+#if QC_DEPTH_IV_MRG_F0125
+          if( bIsDepth )
+            cMv.setHor((cMv.getHor()+2)>>2); 
+#endif
           cMv.setVer( 0 );
           clipMv( cMv );
Index: branches/HTM-8.2-dev2-Qualcomm/source/Lib/TLibCommon/TComDataCU.h
===================================================================
--- branches/HTM-8.2-dev2-Qualcomm/source/Lib/TLibCommon/TComDataCU.h	(revision 664)
+++ branches/HTM-8.2-dev2-Qualcomm/source/Lib/TLibCommon/TComDataCU.h	(revision 669)
@@ -493,4 +493,9 @@
    ); 
    
+#if QC_DEPTH_IV_MRG_F0125
+  Bool          getDispNeighBlocks  ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* cDisp);
+  Bool          getDispMvPredCan(UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDis, Int* iPdm );
+#endif
+
 #if H_3D_NBDV_REF
   Pel           getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT );
@@ -502,5 +507,9 @@
 #endif
 #if H_3D_IV_MERGE
-  Bool          getInterViewMergeCands          ( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc );   
+  Bool          getInterViewMergeCands          ( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc 
+#if QC_DEPTH_IV_MRG_F0125
+    , Bool bIsDepth           
+#endif
+    );   
 #endif
 #if H_3D_ARP
Index: branches/HTM-8.2-dev2-Qualcomm/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- branches/HTM-8.2-dev2-Qualcomm/source/Lib/TLibCommon/TComSlice.cpp	(revision 664)
+++ branches/HTM-8.2-dev2-Qualcomm/source/Lib/TLibCommon/TComSlice.cpp	(revision 669)
@@ -2968,4 +2968,8 @@
 #endif 
 
+#if QC_DEPTH_IV_MRG_F0125
+  setupLUT = setupLUT || ( getVPS()->getIvMvPredFlag(layerIdInVPS ) && getIsDepth() );
+#endif
+
   if( !setupLUT )
     return; 
Index: branches/HTM-8.2-dev2-Qualcomm/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- branches/HTM-8.2-dev2-Qualcomm/source/Lib/TLibCommon/TComSlice.h	(revision 664)
+++ branches/HTM-8.2-dev2-Qualcomm/source/Lib/TLibCommon/TComSlice.h	(revision 669)
@@ -1338,4 +1338,7 @@
   UInt getCamParPrecision    ()  { return m_uiCamParPrecision; }
   Bool hasCamParInSliceHeader()  { return m_bCamParInSliceHeader; }
+#if QC_DEPTH_IV_MRG_F0125
+  Void setHasCamParInSliceHeader( Bool b )  { m_bCamParInSliceHeader = b; }
+#endif
   Int* getCodedScale         ()  { return m_aaiCodedScale [0]; }
   Int* getCodedOffset        ()  { return m_aaiCodedOffset[0]; }
Index: branches/HTM-8.2-dev2-Qualcomm/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- branches/HTM-8.2-dev2-Qualcomm/source/Lib/TLibCommon/TypeDef.h	(revision 664)
+++ branches/HTM-8.2-dev2-Qualcomm/source/Lib/TLibCommon/TypeDef.h	(revision 669)
@@ -207,4 +207,9 @@
 #if H_3D_ARP
 #define H_3D_ARP_WFNR                     3
+#endif
+
+///// ***** Inter-view motion merge candidate *********
+#if H_3D_IV_MERGE
+#define QC_DEPTH_IV_MRG_F0125             1   // JCT3V-F0125: Depth oriented Inter-view MV candidate
 #endif
 
