Index: /branches/HTM-8.2-dev1-Sharp/source/Lib/TLibCommon/TComPrediction.cpp
===================================================================
--- /branches/HTM-8.2-dev1-Sharp/source/Lib/TLibCommon/TComPrediction.cpp	(revision 692)
+++ /branches/HTM-8.2-dev1-Sharp/source/Lib/TLibCommon/TComPrediction.cpp	(revision 693)
@@ -784,5 +784,10 @@
   if( cDistparity.bDV ) 
   {
+#if SHARP_ARP_REF_CHECK_F0105
+    Int arpRefIdx = pcCU->getSlice()->getFirstTRefIdx(eRefPicList);
+    if( dW > 0 && pcCU->getSlice()->getRefPic( eRefPicList, arpRefIdx )->getPOC()!= pcCU->getSlice()->getPOC() )
+#else
     if( dW > 0 && pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC()!= pcCU->getSlice()->getPOC() )
+#endif
     {
       bTobeScaled = true;
@@ -790,7 +795,14 @@
 
     pcPicYuvBaseCol =  pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getPOC(),                              cDistparity.m_aVIdxCan );
+
+#if SHARP_ARP_REF_CHECK_F0105
+    pcPicYuvBaseRef =  pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getRefPic( eRefPicList, arpRefIdx )->getPOC(), cDistparity.m_aVIdxCan );
+
+    if (!pcCU->getSlice()->getArpRefPicAvailable( eRefPicList, cDistparity.m_aVIdxCan))
+#else
     pcPicYuvBaseRef =  pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC(), cDistparity.m_aVIdxCan );
-    
+
     if( ( !pcPicYuvBaseCol || pcPicYuvBaseCol->getPOC() != pcCU->getSlice()->getPOC() ) || ( !pcPicYuvBaseRef || pcPicYuvBaseRef->getPOC() != pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC() ) )
+#endif
     {
       dW = 0;
@@ -799,5 +811,9 @@
     else
     {
+#if SHARP_ARP_REF_CHECK_F0105
+      assert( pcPicYuvBaseCol->getPOC() == pcCU->getSlice()->getPOC() && pcPicYuvBaseRef->getPOC() == pcCU->getSlice()->getRefPic( eRefPicList, arpRefIdx )->getPOC() );
+#else
       assert( pcPicYuvBaseCol->getPOC() == pcCU->getSlice()->getPOC() && pcPicYuvBaseRef->getPOC() == pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC() );
+#endif
     }
 
@@ -870,4 +886,10 @@
 
   assert(dW > 0);
+#if SHARP_ARP_REF_CHECK_F0105
+  if (!pcCU->getSlice()->getArpRefPicAvailable( eRefPicList, pcPicYuvBaseCol->getViewIndex()))
+  {
+    dW = 0;
+  }
+#endif
   Int uiLCUAddr,uiAbsPartAddr;
   Int irefPUX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[uiPartAddr]] + iWidth/2  + ((cDMv.getHor() + 2)>>2);
Index: /branches/HTM-8.2-dev1-Sharp/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- /branches/HTM-8.2-dev1-Sharp/source/Lib/TLibCommon/TComSlice.cpp	(revision 692)
+++ /branches/HTM-8.2-dev1-Sharp/source/Lib/TLibCommon/TComSlice.cpp	(revision 693)
@@ -751,4 +751,6 @@
     if ( this->getNumRefIdx( RefPicList( uiRefListIdx ) ) == 0)
         continue;
+#if !SHARP_ARP_REF_CHECK_F0105
+// move the following to setARPStepNum() to define ARP related thing in ARP function.
 #if QC_MTK_INTERVIEW_ARP_F0123_F0108
      for(Int i = 0; i < this->getNumRefIdx(RefPicList(uiRefListIdx)); i++ )
@@ -760,4 +762,5 @@
        }
      }
+#endif
 #endif
     Bool bZeroIdxLtFlag = this->getRefPic(RefPicList(uiRefListIdx), 0)->getIsLongTerm();
@@ -2840,7 +2843,15 @@
 
 #if H_3D_ARP
+#if SHARP_ARP_REF_CHECK_F0105
+Void TComSlice::setARPStepNum( TComPicLists*ivPicLists )
+#else
 Void TComSlice::setARPStepNum()                                  
-{
+#endif
+{
+#if SHARP_ARP_REF_CHECK_F0105
+  Bool tempRefPicInListsFlag = false;
+#else
   Bool bAllIvRef = true;
+#endif
 #if QC_MTK_INTERVIEW_ARP_F0123_F0108
   if(!getVPS()->getUseAdvRP(getLayerId()) || this->isIRAP())
@@ -2853,4 +2864,21 @@
   else
   {
+#if SHARP_ARP_REF_CHECK_F0105
+    setFirstTRefIdx (REF_PIC_LIST_0, -1);
+    setFirstTRefIdx (REF_PIC_LIST_1, -1);
+    for ( Int refListIdx = 0; refListIdx < ((m_eSliceType==B_SLICE) ? 2 : 1); refListIdx++ )
+    {
+      for(Int i = 0; i < getNumRefIdx(RefPicList(refListIdx)); i++ )
+      {
+        if ( getRefPic(RefPicList(refListIdx), i)->getPOC() != getPOC() )
+        {
+          setFirstTRefIdx (RefPicList(refListIdx), i);
+          break;
+        }
+      }
+    }
+    tempRefPicInListsFlag = getFirstTRefIdx(REF_PIC_LIST_0) >= 0 || getFirstTRefIdx(REF_PIC_LIST_1) >= 0;
+    m_nARPStepNum = tempRefPicInListsFlag ? getVPS()->getARPStepNum(getLayerId()) : 0;
+#else
     for( Int iRefListId = 0; iRefListId < 2; iRefListId++ )
     {
@@ -2875,5 +2903,30 @@
     }
     m_nARPStepNum = !bAllIvRef ? getVPS()->getARPStepNum(getLayerId()) : 0;
-  }
+#endif
+  }
+#if SHARP_ARP_REF_CHECK_F0105
+  if (tempRefPicInListsFlag)
+  {
+    for ( Int refListIdx = 0; refListIdx < ((m_eSliceType==B_SLICE) ? 2 : 1); refListIdx++ )
+    {
+      RefPicList eRefPicList = RefPicList( refListIdx );
+      Int prevPOC = getRefPic(eRefPicList, getFirstTRefIdx(eRefPicList) )->getPOC();
+      for( Int i = 0; i < getNumActiveRefLayerPics(); i++ )
+      {
+        Int layerIdInNuh = getRefPicLayerId( i );
+        Int viewIdx = getVPS()->getViewId( layerIdInNuh );
+        TComPic*pcPicPrev = ivPicLists->getPic(viewIdx, 0, prevPOC);
+        if (getFirstTRefIdx(eRefPicList) >= 0 && pcPicPrev && pcPicPrev->getSlice( 0 )->isReferenced())
+        {
+          m_arpRefPicAvailable[eRefPicList][layerIdInNuh] = true;
+        }
+        else
+        {
+          m_arpRefPicAvailable[eRefPicList][layerIdInNuh] = false;
+        }
+      }
+    }
+  }
+#endif
 }
 #endif
Index: /branches/HTM-8.2-dev1-Sharp/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- /branches/HTM-8.2-dev1-Sharp/source/Lib/TLibCommon/TComSlice.h	(revision 692)
+++ /branches/HTM-8.2-dev1-Sharp/source/Lib/TLibCommon/TComSlice.h	(revision 693)
@@ -1730,4 +1730,7 @@
 #endif
 #if H_3D_ARP
+#if SHARP_ARP_REF_CHECK_F0105
+  Bool m_arpRefPicAvailable[2][MAX_NUM_LAYERS];
+#endif
   TComList<TComPic*> * m_pBaseViewRefPicList[MAX_NUM_LAYERS];
   UInt                 m_nARPStepNum; 
@@ -1821,5 +1824,9 @@
 #if H_3D_ARP
   Void      setBaseViewRefPicList( TComList<TComPic*> *pListPic, Int iViewIdx )      { m_pBaseViewRefPicList[iViewIdx] = pListPic;                   }
+#if SHARP_ARP_REF_CHECK_F0105
+  Void      setARPStepNum( TComPicLists*ivPicLists );
+#else
   Void      setARPStepNum();                                 
+#endif
   TComPic*  getBaseViewRefPic    ( UInt uiPOC , Int iViewIdx )                       { return xGetRefPic( *m_pBaseViewRefPicList[iViewIdx], uiPOC ); }
   UInt      getARPStepNum( )                                                         { return m_nARPStepNum;                                         }  
@@ -2026,4 +2033,7 @@
   Void      setFirstTRefIdx        ( RefPicList e, Int i )         { m_aiFirstTRefIdx[e]    = i;      }
 #endif
+#if SHARP_ARP_REF_CHECK_F0105
+  Bool      getArpRefPicAvailable( RefPicList e, Int viewIdx) {return m_arpRefPicAvailable[e][getVPS()->getLayerIdInNuh(viewIdx, 0)]; }
+#endif
   Void      setIsDepth            ( Bool isDepth )   { m_isDepth = isDepth; }
   Bool      getIsDepth            ()                 { return m_isDepth; }
Index: /branches/HTM-8.2-dev1-Sharp/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /branches/HTM-8.2-dev1-Sharp/source/Lib/TLibCommon/TypeDef.h	(revision 692)
+++ /branches/HTM-8.2-dev1-Sharp/source/Lib/TLibCommon/TypeDef.h	(revision 693)
@@ -209,4 +209,5 @@
 #define QC_MTK_INTERVIEW_ARP_F0123_F0108  1 //JCT3V-F0123; JCT3V-F0108
 #define QC_MTK_INTERVIEW_ARP_F0123_F0108  1 //JCT3V-F0123; JCT3V-F0108
+#define SHARP_ARP_REF_CHECK_F0105         1 // ARP reference picture selection and DPB check
 #define LGE_ARP_CTX_F0161 1 //JCT3V-F0161
 #endif
Index: /branches/HTM-8.2-dev1-Sharp/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- /branches/HTM-8.2-dev1-Sharp/source/Lib/TLibDecoder/TDecTop.cpp	(revision 692)
+++ /branches/HTM-8.2-dev1-Sharp/source/Lib/TLibDecoder/TDecTop.cpp	(revision 693)
@@ -951,5 +951,9 @@
     pcSlice->setRefPicList     ( tempRefPicLists, usedAsLongTerm, numPocTotalCurr, true ); 
 #if H_3D_ARP
+#if SHARP_ARP_REF_CHECK_F0105
+    pcSlice->setARPStepNum(m_ivPicLists);
+#else
     pcSlice->setARPStepNum();
+#endif
     if( pcSlice->getARPStepNum() > 1 )
     {
Index: /branches/HTM-8.2-dev1-Sharp/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- /branches/HTM-8.2-dev1-Sharp/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 692)
+++ /branches/HTM-8.2-dev1-Sharp/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 693)
@@ -724,5 +724,9 @@
 #if H_3D_ARP
     //GT: This seems to be broken when layerId in vps is not equal to layerId in nuh
+#if SHARP_ARP_REF_CHECK_F0105
+    pcSlice->setARPStepNum(m_ivPicLists);
+#else
     pcSlice->setARPStepNum();
+#endif
     if(pcSlice->getARPStepNum() > 1)
     {
