Index: /branches/HTM-8.2-dev1-Qualcomm/source/Lib/TLibCommon/TComPrediction.cpp
===================================================================
--- /branches/HTM-8.2-dev1-Qualcomm/source/Lib/TLibCommon/TComPrediction.cpp	(revision 665)
+++ /branches/HTM-8.2-dev1-Qualcomm/source/Lib/TLibCommon/TComPrediction.cpp	(revision 666)
@@ -664,4 +664,11 @@
   pcCU->clipMv(cMv);
 #if H_3D_ARP
+#if QC_MTK_INTERVIEW_ARP_F0123_F0108
+  if(pcCU->getARPW( uiPartAddr ) > 0  && pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPOC()== pcCU->getSlice()->getPOC())
+  {
+      xPredInterUniARPviewRef( pcCU , uiPartAddr , iWidth , iHeight , eRefPicList , rpcYuvPred , bi );
+  }
+  else
+#endif
   if(  pcCU->getARPW( uiPartAddr ) > 0 
     && pcCU->getPartitionSize(uiPartAddr)==SIZE_2Nx2N 
@@ -841,4 +848,105 @@
   }
 }
+#if QC_MTK_INTERVIEW_ARP_F0123_F0108
+Void TComPrediction::xPredInterUniARPviewRef( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, TComMvField * pNewMvFiled )
+{
+  Int         iRefIdx       = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );           
+  TComMv      cDMv          = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr );
+  TComMv      cTempDMv      = cDMv;
+  UChar       dW            = pcCU->getARPW ( uiPartAddr );
+
+  TComPic* pcPicYuvBaseTRef = NULL;
+  TComPic* pcPicYuvCurrTRef = NULL;
+  TComPic* pcPicYuvBaseCol  = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx );  
+  TComPicYuv* pcYuvBaseCol  = pcPicYuvBaseCol->getPicYuvRec();   
+  Bool bTMVAvai = false;     
+  TComMv cBaseTMV;
+  if( pNewMvFiled )
+  {
+    iRefIdx = pNewMvFiled->getRefIdx(); 
+    cDMv = pNewMvFiled->getMv();
+  }
+  pcCU->clipMv(cTempDMv);
+
+  assert(dW > 0);
+  Int uiLCUAddr,uiAbsPartAddr;
+  Int irefPUX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[uiPartAddr]] + iWidth/2  + ((cDMv.getHor() + 2)>>2);
+  Int irefPUY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[uiPartAddr]] + iHeight/2 + ((cDMv.getVer() + 2)>>2);
+
+  irefPUX = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()-> getPicWidthInLumaSamples()-1, irefPUX);
+  irefPUY = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples()-1, irefPUY);  
+  pcYuvBaseCol->getCUAddrAndPartIdx( irefPUX, irefPUY, uiLCUAddr, uiAbsPartAddr);
+  TComDataCU *pColCU = pcPicYuvBaseCol->getCU( uiLCUAddr );
+
+  if(!pColCU->isIntra(uiAbsPartAddr))
+  {
+    TComMvField puMVField;
+    for(Int iList = 0; iList < (pColCU->getSlice()->isInterB() ? 2: 1) && !bTMVAvai; iList ++)
+    {
+      RefPicList eRefPicListCurr = RefPicList(iList);
+      Int iRef = pColCU->getCUMvField(eRefPicListCurr)->getRefIdx(uiAbsPartAddr);
+      if( iRef != -1)
+      {
+        pcPicYuvBaseTRef = pColCU->getSlice()->getRefPic(eRefPicListCurr, iRef);  
+        Int  iCurrPOC    = pColCU->getSlice()->getPOC();
+        Int  iCurrRefPOC = pcPicYuvBaseTRef->getPOC();
+        Int  iCurrRef    = pcCU->getSlice()->getFirstTRefIdx(eRefPicListCurr);
+        if( iCurrRef >= 0)
+        {
+          pcPicYuvCurrTRef =  pcCU->getSlice()->getRefPic(eRefPicListCurr,iCurrRef);  
+          Int iTargetPOC = pcPicYuvCurrTRef->getPOC();
+          {
+            pcPicYuvBaseTRef =  pcCU->getSlice()->getBaseViewRefPic(iTargetPOC,  pcPicYuvBaseCol->getViewIndex() );  
+            if(pcPicYuvBaseTRef)
+            {
+              cBaseTMV = pColCU->getCUMvField(eRefPicListCurr)->getMv(uiAbsPartAddr);
+              Int iScale = pcCU-> xGetDistScaleFactor(iCurrPOC, iTargetPOC, iCurrPOC, iCurrRefPOC);
+              if ( iScale != 4096 )
+                cBaseTMV = cBaseTMV.scaleMv( iScale );                  
+              bTMVAvai = true;
+              break;
+            }
+          }
+        }
+      }
+    }
+  }
+  if (bTMVAvai == false)
+  { 
+    bTMVAvai = true;
+    cBaseTMV.set(0, 0);
+    pcPicYuvBaseTRef =  pColCU->getSlice()->getRefPic(eRefPicList,  pcCU->getSlice()->getFirstTRefIdx(eRefPicList));  
+    pcPicYuvCurrTRef =  pcCU->getSlice()->getRefPic  (eRefPicList,  pcCU->getSlice()->getFirstTRefIdx(eRefPicList));      
+  }
+
+  xPredInterLumaBlk  ( pcCU, pcYuvBaseCol, uiPartAddr, &cTempDMv, iWidth, iHeight, rpcYuvPred, bi,        bTMVAvai);
+  xPredInterChromaBlk( pcCU, pcYuvBaseCol, uiPartAddr, &cTempDMv, iWidth, iHeight, rpcYuvPred, bi,        bTMVAvai);
+
+  if( dW > 0 && bTMVAvai ) 
+  {
+    TComYuv*    pYuvCurrTRef    = &m_acYuvPredBase[0];
+    TComYuv*    pYuvBaseTRef    = &m_acYuvPredBase[1];
+    TComPicYuv* pcYuvCurrTref   = pcPicYuvCurrTRef->getPicYuvRec();        
+    TComPicYuv* pcYuvBaseTref   = pcPicYuvBaseTRef->getPicYuvRec();  
+    TComMv      cTempMv         = cDMv + cBaseTMV;
+
+    pcCU->clipMv(cBaseTMV);
+    pcCU->clipMv(cTempMv);
+
+    xPredInterLumaBlk  ( pcCU, pcYuvCurrTref, uiPartAddr, &cBaseTMV, iWidth, iHeight, pYuvCurrTRef, bi,   true);
+    xPredInterChromaBlk( pcCU, pcYuvCurrTref, uiPartAddr, &cBaseTMV, iWidth, iHeight, pYuvCurrTRef, bi,   true);
+    xPredInterLumaBlk  ( pcCU, pcYuvBaseTref, uiPartAddr, &cTempMv,  iWidth, iHeight, pYuvBaseTRef, bi,   true); 
+    xPredInterChromaBlk( pcCU, pcYuvBaseTref, uiPartAddr, &cTempMv,  iWidth, iHeight, pYuvBaseTRef, bi,   true); 
+
+    pYuvCurrTRef->subtractARP( pYuvCurrTRef , pYuvBaseTRef , uiPartAddr , iWidth , iHeight );  
+    if(dW == 2)
+    {
+      pYuvCurrTRef->multiplyARP( uiPartAddr , iWidth , iHeight , dW );
+    }
+    rpcYuvPred->addARP( rpcYuvPred , pYuvCurrTRef , uiPartAddr , iWidth , iHeight , !bi ); 
+  }
+}
+#endif
+
 #endif
 
Index: /branches/HTM-8.2-dev1-Qualcomm/source/Lib/TLibCommon/TComPrediction.h
===================================================================
--- /branches/HTM-8.2-dev1-Qualcomm/source/Lib/TLibCommon/TComPrediction.h	(revision 665)
+++ /branches/HTM-8.2-dev1-Qualcomm/source/Lib/TLibCommon/TComPrediction.h	(revision 666)
@@ -93,4 +93,7 @@
 #if H_3D_ARP
   Void xPredInterUniARP         ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false, TComMvField * pNewMvFiled = NULL );
+#if QC_MTK_INTERVIEW_ARP_F0123_F0108
+  Void xPredInterUniARPviewRef( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, TComMvField * pNewMvFiled = NULL );
+#endif
 #endif
   Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false          );
Index: /branches/HTM-8.2-dev1-Qualcomm/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- /branches/HTM-8.2-dev1-Qualcomm/source/Lib/TLibCommon/TComSlice.cpp	(revision 665)
+++ /branches/HTM-8.2-dev1-Qualcomm/source/Lib/TLibCommon/TComSlice.cpp	(revision 666)
@@ -751,5 +751,14 @@
     if ( this->getNumRefIdx( RefPicList( uiRefListIdx ) ) == 0)
         continue;
-
+#if QC_MTK_INTERVIEW_ARP_F0123_F0108
+     for(Int i = 0; i < this->getNumRefIdx(RefPicList(uiRefListIdx)); i++ )
+     {
+       if ( this->getRefPic(RefPicList(uiRefListIdx), i)->getPOC() != getPOC() )
+       {
+         this->setFirstTRefIdx (RefPicList(uiRefListIdx), i);
+         break;
+       }
+     }
+#endif
     Bool bZeroIdxLtFlag = this->getRefPic(RefPicList(uiRefListIdx), 0)->getIsLongTerm();
     for(Int i = 1; i < this->getNumRefIdx(RefPicList(uiRefListIdx)); i++ )
@@ -2834,6 +2843,9 @@
 {
   Bool bAllIvRef = true;
-
+#if QC_MTK_INTERVIEW_ARP_F0123_F0108
+  if(!getVPS()->getUseAdvRP(getLayerId()) || this->isIRAP())
+#else
   if(!getVPS()->getUseAdvRP(getLayerId()))
+#endif
   {
     m_nARPStepNum = 0;
Index: /branches/HTM-8.2-dev1-Qualcomm/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- /branches/HTM-8.2-dev1-Qualcomm/source/Lib/TLibCommon/TComSlice.h	(revision 665)
+++ /branches/HTM-8.2-dev1-Qualcomm/source/Lib/TLibCommon/TComSlice.h	(revision 666)
@@ -1732,4 +1732,7 @@
   TComList<TComPic*> * m_pBaseViewRefPicList[MAX_NUM_LAYERS];
   UInt                 m_nARPStepNum; 
+#if QC_MTK_INTERVIEW_ARP_F0123_F0108
+  Int         m_aiFirstTRefIdx    [2]; 
+#endif
 #endif
 #if H_3D_IC
@@ -2019,4 +2022,8 @@
   Int       getAlterRefIdx          ( RefPicList e )        { return  m_aiAlterRefIdx[e];     }
 #endif
+#if QC_MTK_INTERVIEW_ARP_F0123_F0108
+  Int       getFirstTRefIdx        ( RefPicList e )                { return  m_aiFirstTRefIdx[e];     }
+  Void      setFirstTRefIdx        ( RefPicList e, Int i )         { m_aiFirstTRefIdx[e]    = i;      }
+#endif
   Void      setIsDepth            ( Bool isDepth )   { m_isDepth = isDepth; }
   Bool      getIsDepth            ()                 { return m_isDepth; }
Index: /branches/HTM-8.2-dev1-Qualcomm/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /branches/HTM-8.2-dev1-Qualcomm/source/Lib/TLibCommon/TypeDef.h	(revision 665)
+++ /branches/HTM-8.2-dev1-Qualcomm/source/Lib/TLibCommon/TypeDef.h	(revision 666)
@@ -207,4 +207,6 @@
 #if H_3D_ARP
 #define H_3D_ARP_WFNR                     3
+#define QC_MTK_INTERVIEW_ARP_F0123_F0108  1 //JCT3V-F0123; JCT3V-F0108
+#define QC_MTK_INTERVIEW_ARP_F0123_F0108  1 //JCT3V-F0123; JCT3V-F0108
 #endif
 
Index: /branches/HTM-8.2-dev1-Qualcomm/source/Lib/TLibEncoder/TEncCu.cpp
===================================================================
--- /branches/HTM-8.2-dev1-Qualcomm/source/Lib/TLibEncoder/TEncCu.cpp	(revision 665)
+++ /branches/HTM-8.2-dev1-Qualcomm/source/Lib/TLibEncoder/TEncCu.cpp	(revision 666)
@@ -1845,5 +1845,5 @@
           rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
 
-#if H_3D_ARP
+#if H_3D_ARP && !QC_MTK_INTERVIEW_ARP_F0123_F0108
           if( nARPW )
           {
@@ -2050,5 +2050,5 @@
 
     m_pcPredSearch->motionCompensation( rpcTempCU , m_ppcPredYuvTemp[uhDepth] );
-
+#if !QC_MTK_INTERVIEW_ARP_F0123_F0108
     if(rpcTempCU->getPartitionSize(0)==SIZE_2Nx2N)
     {
@@ -2068,4 +2068,5 @@
       }
     }
+#endif
   }
   else
@@ -2087,5 +2088,5 @@
    {
      m_ppcWeightedTempCU[uhDepth]->copyPartFrom( rpcTempCU , 0 , uhDepth );
-
+#if !QC_MTK_INTERVIEW_ARP_F0123_F0108
      Bool bSignalflag[2] = { true, true };
      for(UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx ++ )
@@ -2102,4 +2103,5 @@
        rpcTempCU->setARPWSubParts( 0 , 0 , uhDepth );
      }
+#endif
    }
   }
