Index: /branches/HTM-6.2-dev2-Qualcomm/CommonTestConditionsCfgs/baseCfg_2view+depth.cfg
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/CommonTestConditionsCfgs/baseCfg_2view+depth.cfg	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/CommonTestConditionsCfgs/baseCfg_2view+depth.cfg	(revision 373)
@@ -192,5 +192,5 @@
 MultiviewMvRegMode        : 1                                      # use original depth maps for regularizing inter-view motion vector
 MultiviewMvRegLambdaScale : 1.0                                    # lambda scale factor for inter-view motion vector regularization
-MultiviewResPred          : 1                                      # inter-view residual prediction (0:off, 1:on)
+MultiviewResPred          : 1                                      # advanced inter-view residual prediction (0:off, 1:on)
 InterViewSkip             : 0                                      # interview SKIP mode
 InterViewSkipLambdaScale  : 8                                      # lambda scale for inter-view skip mode
Index: /branches/HTM-6.2-dev2-Qualcomm/CommonTestConditionsCfgs/baseCfg_2view.cfg
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/CommonTestConditionsCfgs/baseCfg_2view.cfg	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/CommonTestConditionsCfgs/baseCfg_2view.cfg	(revision 373)
@@ -186,5 +186,5 @@
 MultiviewMvRegMode        : 0                                      # use original depth maps for regularizing inter-view motion vector
 MultiviewMvRegLambdaScale : 0.0                                    # lambda scale factor for inter-view motion vector regularization
-MultiviewResPred          : 1                                      # inter-view residual prediction (0:off, 1:on)
+MultiviewResPred          : 1                                      # advanced inter-view residual prediction (0:off, 1:on)
 InterViewSkip             : 0                                      # interview SKIP mode
 InterViewSkipLambdaScale  : 8                                      # lambda scale for inter-view skip mode
Index: /branches/HTM-6.2-dev2-Qualcomm/CommonTestConditionsCfgs/baseCfg_3view+depth.cfg
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/CommonTestConditionsCfgs/baseCfg_3view+depth.cfg	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/CommonTestConditionsCfgs/baseCfg_3view+depth.cfg	(revision 373)
@@ -196,5 +196,5 @@
 MultiviewMvRegMode        : 1                                      # use original depth maps for regularizing inter-view motion vector
 MultiviewMvRegLambdaScale : 1.0                                    # lambda scale factor for inter-view motion vector regularization
-MultiviewResPred          : 1                                      # inter-view residual prediction (0:off, 1:on)
+MultiviewResPred          : 1                                      # advanced inter-view residual prediction (0:off, 1:on)
 InterViewSkip             : 0                                      # interview SKIP mode
 InterViewSkipLambdaScale  : 8                                      # lambda scale for inter-view skip mode
Index: /branches/HTM-6.2-dev2-Qualcomm/CommonTestConditionsCfgs/baseCfg_3view.cfg
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/CommonTestConditionsCfgs/baseCfg_3view.cfg	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/CommonTestConditionsCfgs/baseCfg_3view.cfg	(revision 373)
@@ -188,5 +188,5 @@
 MultiviewMvRegMode        : 0                                      # use original depth maps for regularizing inter-view motion vector
 MultiviewMvRegLambdaScale : 0.0                                    # lambda scale factor for inter-view motion vector regularization
-MultiviewResPred          : 1                                      # inter-view residual prediction (0:off, 1:on)
+MultiviewResPred          : 1                                      # advanced inter-view residual prediction (0:off, 1:on)
 InterViewSkip             : 0                                      # interview SKIP mode
 InterViewSkipLambdaScale  : 8                                      # lambda scale for inter-view skip mode
Index: /branches/HTM-6.2-dev2-Qualcomm/cfg/IBPsetting_balloons.cfg
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/cfg/IBPsetting_balloons.cfg	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/cfg/IBPsetting_balloons.cfg	(revision 373)
@@ -199,5 +199,5 @@
 MultiviewMvRegMode        : 1                                      # use original depth maps for regularizing inter-view motion vector
 MultiviewMvRegLambdaScale : 1.0                                    # lambda scale factor for inter-view motion vector regularization
-MultiviewResPred          : 1                                      # inter-view residual prediction (0:off, 1:on)
+MultiviewResPred          : 1                                      # advanced inter-view residual prediction (0:off, 1:on)
 InterViewSkip             : 0                                      # interview SKIP mode
 InterViewSkipLambdaScale  : 8                                      # lambda scale for inter-view skip mode
Index: /branches/HTM-6.2-dev2-Qualcomm/cfg/IBPsetting_gtfly.cfg
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/cfg/IBPsetting_gtfly.cfg	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/cfg/IBPsetting_gtfly.cfg	(revision 373)
@@ -199,5 +199,5 @@
 MultiviewMvRegMode        : 1                                      # use original depth maps for regularizing inter-view motion vector
 MultiviewMvRegLambdaScale : 1.0                                    # lambda scale factor for inter-view motion vector regularization
-MultiviewResPred          : 1                                      # inter-view residual prediction (0:off, 1:on)
+MultiviewResPred          : 1                                      # advanced inter-view residual prediction (0:off, 1:on)
 InterViewSkip             : 0                                      # interview SKIP mode
 InterViewSkipLambdaScale  : 8                                      # lambda scale for inter-view skip mode
Index: /branches/HTM-6.2-dev2-Qualcomm/cfg/IBPsetting_kendo.cfg
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/cfg/IBPsetting_kendo.cfg	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/cfg/IBPsetting_kendo.cfg	(revision 373)
@@ -199,5 +199,5 @@
 MultiviewMvRegMode        : 1                                      # use original depth maps for regularizing inter-view motion vector
 MultiviewMvRegLambdaScale : 1.0                                    # lambda scale factor for inter-view motion vector regularization
-MultiviewResPred          : 1                                      # inter-view residual prediction (0:off, 1:on)
+MultiviewResPred          : 1                                      # advanced inter-view residual prediction (0:off, 1:on)
 InterViewSkip             : 0                                      # interview SKIP mode
 InterViewSkipLambdaScale  : 8                                      # lambda scale for inter-view skip mode
Index: /branches/HTM-6.2-dev2-Qualcomm/cfg/IBPsetting_news.cfg
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/cfg/IBPsetting_news.cfg	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/cfg/IBPsetting_news.cfg	(revision 373)
@@ -199,5 +199,5 @@
 MultiviewMvRegMode        : 1                                      # use original depth maps for regularizing inter-view motion vector
 MultiviewMvRegLambdaScale : 1.0                                    # lambda scale factor for inter-view motion vector regularization
-MultiviewResPred          : 1                                      # inter-view residual prediction (0:off, 1:on)
+MultiviewResPred          : 1                                      # advanced inter-view residual prediction (0:off, 1:on)
 InterViewSkip             : 0                                      # interview SKIP mode
 InterViewSkipLambdaScale  : 8                                      # lambda scale for inter-view skip mode
Index: /branches/HTM-6.2-dev2-Qualcomm/cfg/IBPsetting_poznanhall.cfg
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/cfg/IBPsetting_poznanhall.cfg	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/cfg/IBPsetting_poznanhall.cfg	(revision 373)
@@ -199,5 +199,5 @@
 MultiviewMvRegMode        : 1                                      # use original depth maps for regularizing inter-view motion vector
 MultiviewMvRegLambdaScale : 1.0                                    # lambda scale factor for inter-view motion vector regularization
-MultiviewResPred          : 1                                      # inter-view residual prediction (0:off, 1:on)
+MultiviewResPred          : 1                                      # advanced inter-view residual prediction (0:off, 1:on)
 InterViewSkip             : 0                                      # interview SKIP mode
 InterViewSkipLambdaScale  : 8                                      # lambda scale for inter-view skip mode
Index: /branches/HTM-6.2-dev2-Qualcomm/cfg/IBPsetting_poznanstreet.cfg
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/cfg/IBPsetting_poznanstreet.cfg	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/cfg/IBPsetting_poznanstreet.cfg	(revision 373)
@@ -199,5 +199,5 @@
 MultiviewMvRegMode        : 1                                      # use original depth maps for regularizing inter-view motion vector
 MultiviewMvRegLambdaScale : 1.0                                    # lambda scale factor for inter-view motion vector regularization
-MultiviewResPred          : 1                                      # inter-view residual prediction (0:off, 1:on)
+MultiviewResPred          : 1                                      # advanced inter-view residual prediction (0:off, 1:on)
 InterViewSkip             : 0                                      # interview SKIP mode
 InterViewSkipLambdaScale  : 8                                      # lambda scale for inter-view skip mode
Index: /branches/HTM-6.2-dev2-Qualcomm/cfg/IBPsetting_undodancer.cfg
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/cfg/IBPsetting_undodancer.cfg	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/cfg/IBPsetting_undodancer.cfg	(revision 373)
@@ -199,5 +199,5 @@
 MultiviewMvRegMode        : 1                                      # use original depth maps for regularizing inter-view motion vector
 MultiviewMvRegLambdaScale : 1.0                                    # lambda scale factor for inter-view motion vector regularization
-MultiviewResPred          : 1                                      # inter-view residual prediction (0:off, 1:on)
+MultiviewResPred          : 1                                      # advanced inter-view residual prediction (0:off, 1:on)
 InterViewSkip             : 0                                      # interview SKIP mode
 InterViewSkipLambdaScale  : 8                                      # lambda scale for inter-view skip mode
Index: /branches/HTM-6.2-dev2-Qualcomm/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 373)
@@ -383,5 +383,9 @@
 #endif
 #if H3D_IVRP
+#if QC_ARP_D0177
+  ("MultiviewResPred", m_nUseAdvResPred,           (UInt)0, "usage of Advanced residual prediction" )
+#else
   ("MultiviewResPred", m_uiMultiviewResPredMode,   (UInt)0, "usage of inter-view residual prediction" )
+#endif
 #endif
 
@@ -917,6 +921,10 @@
 #endif
 #if H3D_IVRP
+#if QC_ARP_D0177
+  xConfirmPara     ( m_nUseAdvResPred < 0 || m_nUseAdvResPred > 1 , "0<=ARP<=1" );
+#else
   xConfirmPara    ( m_uiMultiviewResPredMode > 1,                                     "MultiviewResPred must be less than or equal to 1" );
   xConfirmPara    ( m_uiMultiviewResPredMode > 0 && m_uiPredDepthMapGeneration == 0 , "MultiviewResPred > 0 requires PredDepthMapGen > 0" );
+#endif
 #endif
   if( m_bUsingDepthMaps )
@@ -1672,4 +1680,7 @@
   printf("IVSEnable: %d ", m_bUseIVS);
 #endif
+#if QC_ARP_D0177
+  printf(" ARP:%d  " , m_nUseAdvResPred  );
+#endif
   printf("\n");
 
Index: /branches/HTM-6.2-dev2-Qualcomm/source/App/TAppEncoder/TAppEncCfg.h
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/App/TAppEncoder/TAppEncCfg.h	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/App/TAppEncoder/TAppEncCfg.h	(revision 373)
@@ -217,6 +217,10 @@
   Double    m_dMultiviewMvRegLambdaScale;                     ///< lambda scale for multiview motion vectors regularization
 #endif
-#if H3D_IVRP
+#if H3D_IVRP 
+#if QC_ARP_D0177
+  UInt      m_nUseAdvResPred;
+#else
   UInt      m_uiMultiviewResPredMode;          ///< using multiview residual prediction
+#endif
 #endif
 
Index: /branches/HTM-6.2-dev2-Qualcomm/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/App/TAppEncoder/TAppEncTop.cpp	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/App/TAppEncoder/TAppEncTop.cpp	(revision 373)
@@ -223,5 +223,10 @@
 #endif
 #if H3D_IVRP
+#if QC_ARP_D0177
+    m_acTEncTopList[iViewIdx]->setUseAdvRP                     ( iViewIdx ? m_nUseAdvResPred             : 0   );
+    m_acTEncTopList[iViewIdx]->setARPStepNum                   ( iViewIdx ? QC_ARP_WFNR                  : 1   );
+#else
     m_acTEncTopList[iViewIdx]->setMultiviewResPredMode         ( m_uiMultiviewResPredMode );
+#endif
 #endif
 
@@ -560,6 +565,11 @@
       m_acTEncDepthTopList[iViewIdx]->setMultiviewMvRegLambdaScale    ( 0.0 );
 #endif
-#if H3D_IVRP
-      m_acTEncDepthTopList[iViewIdx]->setMultiviewResPredMode         ( 0 );
+#if H3D_IVRP 
+#if QC_ARP_D0177
+    m_acTEncDepthTopList[iViewIdx]->setUseAdvRP                          ( 0 );
+    m_acTEncDepthTopList[iViewIdx]->setARPStepNum                        ( 1 );
+#else
+    m_acTEncDepthTopList[iViewIdx]->setMultiviewResPredMode         ( 0 );
+#endif
 #endif
 
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/ContextTables.h
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/ContextTables.h	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/ContextTables.h	(revision 373)
@@ -487,4 +487,14 @@
 #endif
 };
+#if QC_ARP_D0177
+#define NUM_ARPW_CTX                  4       ///< number of context models for generalized residual prediction weighting factor
+static const UChar 
+INIT_ARPW[3][NUM_ARPW_CTX] = 
+{
+  { 154 , 154 , 154 , 154 }, 
+  { 154 , 154 , 154 , 154 }, 
+  { 154 , 154 , 154 , 154 }, 
+};
+#endif
 
 #if LGE_EDGE_INTRA_A0070
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComDataCU.cpp	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComDataCU.cpp	(revision 373)
@@ -225,4 +225,7 @@
   m_pbResPredFlag      = NULL;
 #endif
+#if QC_ARP_D0177
+  m_puhARPW           = NULL;
+#endif
 #if LGE_EDGE_INTRA_A0070
   m_pucEdgeCode         = NULL;
@@ -301,4 +304,7 @@
     m_pbResPredAvailable = (Bool*  )xMalloc(Bool,   uiNumPartition);
     m_pbResPredFlag      = (Bool*  )xMalloc(Bool,   uiNumPartition);
+#if QC_ARP_D0177
+    m_puhARPW            = new UChar[ uiNumPartition];
+#endif
 #endif
     m_puhLumaIntraDir    = (UChar* )xMalloc(UChar,  uiNumPartition);
@@ -463,4 +469,7 @@
     if ( m_pDvInfo            ) { xFree(m_pDvInfo);             m_pDvInfo           = NULL; }
 #endif
+#if QC_ARP_D0177
+    if ( m_puhARPW           )  { delete[] m_puhARPW;          m_puhARPW          = NULL; }
+#endif
     if ( m_puhLumaIntraDir    ) { xFree(m_puhLumaIntraDir);     m_puhLumaIntraDir   = NULL; }
     if ( m_puhChromaIntraDir  ) { xFree(m_puhChromaIntraDir);   m_puhChromaIntraDir = NULL; }
@@ -636,4 +645,7 @@
     m_pbSDCFlag[ui] = pcFrom->getSDCFlag(ui);
 #endif
+#if QC_ARP_D0177
+    m_puhARPW[ui] = pcFrom->getARPW( ui );
+#endif
     m_puhWidth  [ui] = pcFrom->getWidth(ui);
     m_puhHeight [ui] = pcFrom->getHeight(ui);
@@ -733,4 +745,7 @@
     memset( m_pbResPredFlag            + firstElement, 0    , sizeof( Bool ) * numElements );
 #endif
+#if QC_ARP_D0177
+    memset( m_puhARPW                  + firstElement, 0    , sizeof( UChar ) * numElements  );
+#endif
   }
   
@@ -875,4 +890,7 @@
       m_pbResPredFlag[ui]      = 0;
 #endif
+#if QC_ARP_D0177
+      m_puhARPW[ui] = 0;
+#endif
       m_puhLumaIntraDir[ui] = 2;
       m_puhChromaIntraDir[ui] = 0;
@@ -985,4 +1003,7 @@
   memset( m_pbResPredAvailable, 0, iSizeInBool  );
   memset( m_pbResPredFlag,      0, iSizeInBool  );
+#endif
+#if QC_ARP_D0177
+  memset( m_puhARPW,            0, iSizeInUchar  );
 #endif
   memset( m_puhLumaIntraDir,    2, iSizeInUchar );
@@ -1102,4 +1123,7 @@
       m_pbResPredFlag     [ui] = pcCU->m_pbResPredFlag     [ uiPartOffset + ui ];
 #endif
+#if QC_ARP_D0177
+      m_puhARPW           [ui] = pcCU->getARPW( uiPartOffset+ui );
+#endif
 #if RWTH_SDC_DLT_B0036
       m_pbSDCFlag         [ui] = pcCU->m_pbSDCFlag         [ uiPartOffset + ui ];
@@ -1224,4 +1248,7 @@
   m_pbResPredFlag       = pcCU->getResPredFlag ()     + uiPart;
 #endif
+#if QC_ARP_D0177
+  m_puhARPW             = pcCU->getARPW() + uiPart;
+#endif
   m_puhLumaIntraDir     = pcCU->getLumaIntraDir()     + uiPart;
   m_puhChromaIntraDir   = pcCU->getChromaIntraDir()   + uiPart;
@@ -1392,4 +1419,7 @@
   m_pbResPredFlag      = pcCU->getResPredFlag ()          + uiAbsPartIdx;
 #endif
+#if QC_ARP_D0177
+  m_puhARPW           = pcCU->getARPW()                 + uiAbsPartIdx;
+#endif
   m_apiMVPIdx[eRefPicList] = pcCU->getMVPIdx(eRefPicList) + uiAbsPartIdx;
   m_apiMVPNum[eRefPicList] = pcCU->getMVPNum(eRefPicList) + uiAbsPartIdx;
@@ -1409,5 +1439,10 @@
 // Copy small CU to bigger CU.
 // One of quarter parts overwritten by predicted sub part.
-Void TComDataCU::copyPartFrom( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth )
+Void TComDataCU::copyPartFrom( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth 
+#if QC_ARP_D0177
+     ,
+    Bool bRP
+#endif
+    )
 {
   assert( uiPartUnitIdx<4 );
@@ -1446,4 +1481,7 @@
   memcpy( m_pbResPredFlag       + uiOffset, pcCU->getResPredFlag(),       iSizeInBool  );
 #endif
+#if QC_ARP_D0177
+  memcpy( m_puhARPW            + uiOffset,  pcCU->getARPW(),              iSizeInUchar );
+#endif
   memcpy( m_puhLumaIntraDir     + uiOffset, pcCU->getLumaIntraDir(),      iSizeInUchar );
   memcpy( m_puhChromaIntraDir   + uiOffset, pcCU->getChromaIntraDir(),    iSizeInUchar );
@@ -1522,5 +1560,9 @@
 
 #if LGE_EDGE_INTRA_A0070
+#if QC_ARP_D0177
+  if( !bRP && pcCU->getSlice()->getSPS()->isDepth() )
+#else
   if( getSlice()->getSPS()->isDepth() )
+#endif
   {
     memcpy( getEdgeCode( uiOffset ), pcCU->getEdgeCode(0), iSizeInUchar * LGE_EDGE_INTRA_MAX_EDGE_NUM_PER_4x4 );
@@ -1588,4 +1630,7 @@
   memcpy( rpcCU->getResPredFlag()       + m_uiAbsIdxInLCU, m_pbResPredFlag,       iSizeInBool  );
 #endif
+#if QC_ARP_D0177
+  memcpy( rpcCU->getARPW()              + m_uiAbsIdxInLCU, m_puhARPW,             iSizeInUchar );
+#endif
   memcpy( rpcCU->getLumaIntraDir()      + m_uiAbsIdxInLCU, m_puhLumaIntraDir,     iSizeInUchar );
   memcpy( rpcCU->getChromaIntraDir()    + m_uiAbsIdxInLCU, m_puhChromaIntraDir,   iSizeInUchar );
@@ -1718,4 +1763,7 @@
   memcpy( rpcCU->getResPredAvail()      + uiPartOffset, m_pbResPredAvailable,  iSizeInBool  );
   memcpy( rpcCU->getResPredFlag()       + uiPartOffset, m_pbResPredFlag,       iSizeInBool  );
+#endif
+#if QC_ARP_D0177
+  memcpy( rpcCU->getARPW()              + uiPartOffset, m_puhARPW,            iSizeInUchar );
 #endif
   memcpy( rpcCU->getLumaIntraDir()      + uiPartOffset, m_puhLumaIntraDir,     iSizeInUchar );
@@ -2709,5 +2757,20 @@
   return uiCtx;
 }
-
+#if QC_ARP_D0177
+UInt TComDataCU::getCTXARPWFlag( UInt uiAbsPartIdx )
+{
+  TComDataCU* pcTempCU;
+  UInt        uiTempPartIdx;
+  UInt        uiCtx = 0;
+  
+  pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx );
+  uiCtx    = ( pcTempCU ) ? ((pcTempCU->getARPW( uiTempPartIdx )==0)?0:1) : 0;
+  
+  pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx );
+  uiCtx   += ( pcTempCU ) ? ((pcTempCU->getARPW( uiTempPartIdx )==0)?0:1): 0;
+  
+  return uiCtx;
+}
+#endif
 #if LGE_ILLUCOMP_B0045
 UInt TComDataCU::getCtxICFlag( UInt uiAbsPartIdx )
@@ -3632,5 +3695,5 @@
 #endif //H3D_NBDV
 
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
   Bool bDVAvail = true;
 #endif
@@ -3689,5 +3752,5 @@
     cDisInfo.m_aVIdxCan[0] = 0;
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
     bDVAvail = false;
 #endif
@@ -3752,5 +3815,5 @@
   iPdmDir[1] = iPdmInterDir; 
 #endif // H3D_NBDV
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
   if (m_pcSlice->getSPS()->getMultiviewResPredMode()==1 && iPdmDir[0] && !bNoPdmMerge && cCurPS == SIZE_2Nx2N && bDVAvail)
   {
@@ -7278,6 +7341,9 @@
 TComDataCU::getResidualSamples( UInt uiPartIdx, Bool bRecon, TComYuv* pcYuv )
 {
+#if !QC_ARP_D0177
   TComResidualGenerator*  pcResidualGenerator = m_pcSlice->getSPS()->getResidualGenerator();
   ROFRS( pcResidualGenerator, false );
+#endif
+
 #if H3D_NBDV
   DisInfo cDisInfo;
@@ -7308,5 +7374,4 @@
 #if !QC_CU_NBDV_D0181
   getDisMvpCandNBDV( 0, 0,  &cDisInfo, false );  
-
   if( cDisInfo.iN == 0)
 #else
@@ -7326,4 +7391,13 @@
   }
   else
+#if QC_ARP_D0177
+  if(m_pcSlice->getSPS()->getUseAdvRP())  
+  {
+     m_pePartSize[0] = m_peSaved;
+     return true;
+  }
+  else
+    return false;
+#else
   {
     Bool bAvailable = pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, cDisInfo.m_acMvCand[0], bRecon );       
@@ -7331,4 +7405,5 @@
     return bAvailable;
   }
+#endif
 #else
   return pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, bRecon ); 
@@ -7336,5 +7411,11 @@
 }
 #endif
-
+#if QC_ARP_D0177
+Void TComDataCU::setARPWSubParts ( UChar w, UInt uiAbsPartIdx, UInt uiDepth )
+{
+  assert( sizeof( *m_puhARPW) == 1 );
+  memset( m_puhARPW + uiAbsPartIdx, w, m_pcPic->getNumPartInCU() >> ( 2 * uiDepth ) );
+}
+#endif
 #if LGE_EDGE_INTRA_A0070
 Void TComDataCU::reconPartition( UInt uiAbsPartIdx, UInt uiDepth, Bool bLeft, UChar ucStartPos, UChar ucNumEdge, UChar* pucEdgeCode, Bool* pbRegion )
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComDataCU.h
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComDataCU.h	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComDataCU.h	(revision 373)
@@ -214,5 +214,7 @@
   Bool*         m_pbResPredFlag;      ///< array of residual prediction flags
 #endif
-
+#if QC_ARP_D0177
+  UChar*        m_puhARPW;
+#endif
 #if LGE_EDGE_INTRA_A0070
   UChar*        m_pucEdgeCode;          ///< array of edge code
@@ -301,6 +303,7 @@
   
   /// compute scaling factor from POC difference
+#if !QC_ARP_D0177
   Int           xGetDistScaleFactor   ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC );
-  
+#endif
   Void xDeriveCenterIdx( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxCenter );
   Bool xGetCenterCol( UInt uiPartIdx, RefPicList eRefPicList, int iRefIdx, TComMv *pcMv );
@@ -316,5 +319,8 @@
   // create / destroy / initialize / copy
   // -------------------------------------------------------------------------------------------------------------------
-  
+#if QC_ARP_D0177
+  Int           xGetDistScaleFactor   ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC );
+#endif  
+
   Void          create                ( UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu, Int unitSize
 #if ADAPTIVE_QP_SELECTION
@@ -337,5 +343,10 @@
 #endif
   );
-  Void          copyPartFrom          ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth );
+  Void          copyPartFrom          ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth 
+#if QC_ARP_D0177
+      ,
+      Bool bRP = false
+#endif
+  );
   
   Void          copyToPic             ( UChar uiDepth );
@@ -585,4 +596,11 @@
   Bool          getResidualSamples( UInt uiPartIdx, Bool bRecon, TComYuv* pcYuv = 0 );
 #endif
+#if QC_ARP_D0177
+  UChar*        getARPW          ()                        { return m_puhARPW;               }
+  UChar         getARPW          ( UInt uiIdx )            { return m_puhARPW[uiIdx];        }
+  Void          setARPW          ( UInt uiIdx, UChar w )   { m_puhARPW[uiIdx] = w;           }
+  Void          setARPWSubParts  ( UChar w, UInt uiAbsPartIdx, UInt uiDepth );
+  Double        getARPWFactor    ( UInt uiIdx );
+#endif
   // -------------------------------------------------------------------------------------------------------------------
   // member functions for accessing partition information
@@ -705,5 +723,7 @@
   UInt          getCtxResPredFlag               ( UInt   uiAbsPartIdx                                 );
 #endif
-  
+#if QC_ARP_D0177
+  UInt          getCTXARPWFlag                 ( UInt   uiAbsPartIdx                                 );
+#endif  
   UInt          getSliceStartCU         ( UInt pos )                  { return m_uiSliceStartCU[pos-m_uiAbsIdxInLCU];                                                                                          }
   UInt          getEntropySliceStartCU  ( UInt pos )                  { return m_uiEntropySliceStartCU[pos-m_uiAbsIdxInLCU];                                                                                   }
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComDepthMapGenerator.h
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComDepthMapGenerator.h	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComDepthMapGenerator.h	(revision 373)
@@ -80,5 +80,5 @@
 
   UInt      getPdm  ()                            { if( m_aacActiveSPS[0][1] ) { return m_aacActiveSPS[0][1]->getPredDepthMapGeneration(); } return 0; }
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
   UInt      getResPrd ()                          { if( m_aacActiveSPS[0][1] ) { return m_aacActiveSPS[0][1]->getMultiviewResPredMode  (); } return 0; }
 #endif
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComInterpolationFilter.cpp
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComInterpolationFilter.cpp	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComInterpolationFilter.cpp	(revision 373)
@@ -72,5 +72,24 @@
   { -2, 10, 58, -2 }
 };
-
+#if QC_ARP_D0177
+const Short TComInterpolationFilter::m_lumaFilterARP[4][NTAPS_LUMA_ARP] =
+{
+  {64,  0},
+  {48, 16},
+  {32, 32},
+  {16, 48}
+};
+const Short TComInterpolationFilter::m_chromaFilterARP[8][NTAPS_CHROMA_ARP] =
+{
+  {64,  0},
+  {56,  8},
+  {48, 16},
+  {40, 24},
+  {32, 32},
+  {24, 40},
+  {16, 48},
+  {8,  56}
+};
+#endif
 // ====================================================================================================================
 // Private member functions
@@ -320,5 +339,10 @@
  * \param  isLast     Flag indicating whether it is the last filtering operation
  */
-Void TComInterpolationFilter::filterHorLuma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast )
+Void TComInterpolationFilter::filterHorLuma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast 
+#if QC_ARP_D0177
+    ,
+    Bool filterType
+#endif
+    )
 {
   assert(frac >= 0 && frac < 4);
@@ -330,5 +354,10 @@
   else
   {
-    filterHor<NTAPS_LUMA>(src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilter[frac]);
+#if QC_ARP_D0177
+    if(filterType)
+      filterHor<NTAPS_LUMA_ARP>(src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilterARP[frac]);
+    else
+#endif
+      filterHor<NTAPS_LUMA>(src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilter[frac]);
   }
 }
@@ -347,5 +376,10 @@
  * \param  isLast     Flag indicating whether it is the last filtering operation
  */
-Void TComInterpolationFilter::filterVerLuma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast )
+Void TComInterpolationFilter::filterVerLuma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast
+#if QC_ARP_D0177
+    ,
+    Bool filterType
+#endif
+    )
 {
   assert(frac >= 0 && frac < 4);
@@ -357,5 +391,10 @@
   else
   {
-    filterVer<NTAPS_LUMA>(src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilter[frac]);    
+#if QC_ARP_D0177
+    if(filterType)
+      filterVer<NTAPS_LUMA_ARP>(src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilterARP[frac]);    
+    else
+#endif
+      filterVer<NTAPS_LUMA>(src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilter[frac]);    
   }
 }
@@ -373,5 +412,10 @@
  * \param  isLast     Flag indicating whether it is the last filtering operation
  */
-Void TComInterpolationFilter::filterHorChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast )
+Void TComInterpolationFilter::filterHorChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast
+#if QC_ARP_D0177
+    ,
+    Bool filterType
+#endif
+    )
 {
   assert(frac >= 0 && frac < 8);
@@ -383,4 +427,9 @@
   else
   {
+#if QC_ARP_D0177
+    if(filterType)
+      filterHor<NTAPS_CHROMA_ARP>(src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilterARP[frac]);   
+    else
+#endif
     filterHor<NTAPS_CHROMA>(src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilter[frac]);
   }
@@ -400,5 +449,10 @@
  * \param  isLast     Flag indicating whether it is the last filtering operation
  */
-Void TComInterpolationFilter::filterVerChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast )
+Void TComInterpolationFilter::filterVerChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast
+#if QC_ARP_D0177
+    ,
+    Bool filterType
+#endif
+    )
 {
   assert(frac >= 0 && frac < 8);
@@ -410,5 +464,10 @@
   else
   {
-    filterVer<NTAPS_CHROMA>(src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilter[frac]);    
+#if QC_ARP_D0177
+    if(filterType)
+      filterVer<NTAPS_CHROMA_ARP>(src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilterARP[frac]);  
+    else
+#endif
+      filterVer<NTAPS_CHROMA>(src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilter[frac]);    
   }
 }
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComInterpolationFilter.h
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComInterpolationFilter.h	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComInterpolationFilter.h	(revision 373)
@@ -44,4 +44,8 @@
 //! \ingroup TLibCommon
 //! \{
+#if QC_ARP_D0177
+#define NTAPS_LUMA_ARP    2 ///< Number of taps for luma
+#define NTAPS_CHROMA_ARP  2 ///< Number of taps for chroma
+#endif
 
 #define NTAPS_LUMA        8 ///< Number of taps for luma
@@ -58,5 +62,9 @@
   static const Short m_lumaFilter[4][NTAPS_LUMA];     ///< Luma filter taps
   static const Short m_chromaFilter[8][NTAPS_CHROMA]; ///< Chroma filter taps
-  
+#if QC_ARP_D0177
+  static const Short m_lumaFilterARP  [4][NTAPS_LUMA_ARP];     ///< Luma filter taps
+  static const Short m_chromaFilterARP[8][NTAPS_CHROMA_ARP]; ///< Chroma filter taps
+#endif
+
   static Void filterCopy(const Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Bool isFirst, Bool isLast);
   
@@ -73,8 +81,28 @@
   ~TComInterpolationFilter() {}
 
-  Void filterHorLuma  (Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac,               Bool isLast );
-  Void filterVerLuma  (Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast );
-  Void filterHorChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac,               Bool isLast );
-  Void filterVerChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast );
+  Void filterHorLuma  (Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac,               Bool isLast
+#if QC_ARP_D0177
+    ,
+    Bool filterType = 0
+#endif
+    );
+  Void filterVerLuma  (Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast 
+#if QC_ARP_D0177
+    ,
+    Bool filterType = 0
+#endif
+    );
+  Void filterHorChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac,               Bool isLast
+#if QC_ARP_D0177
+    ,
+    Bool filterType = 0
+#endif
+    );
+  Void filterVerChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast
+#if QC_ARP_D0177
+    ,
+    Bool filterType = 0
+#endif
+    );
 };
 
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComPicYuv.cpp
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComPicYuv.cpp	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComPicYuv.cpp	(revision 373)
@@ -488,4 +488,11 @@
   }
 }
-
+#if QC_ARP_D0177
+Void  TComPicYuv::clearPic()
+{
+  ::memset ( m_apiPicBufY, 0 , sizeof (Pel) * ( m_iPicWidth       + (m_iLumaMarginX   << 1)) * ( m_iPicHeight       + (m_iLumaMarginY   << 1)) );
+  ::memset ( m_apiPicBufU, 0 , sizeof (Pel) * ((m_iPicWidth >> 1) + (m_iChromaMarginX << 1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY << 1)) );
+  ::memset ( m_apiPicBufV, 0 , sizeof (Pel) * ((m_iPicWidth >> 1) + (m_iChromaMarginX << 1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY << 1)) );
+}
+#endif
 //! \}
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComPicYuv.h
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComPicYuv.h	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComPicYuv.h	(revision 373)
@@ -183,5 +183,7 @@
   Void  setLumaTo    ( Pel pVal );  
   Void  setChromaTo  ( Pel pVal );  
-
+#if QC_ARP_D0177
+  Void    clearPic();
+#endif
 };// END CLASS DEFINITION TComPicYuv
 
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComPrediction.cpp
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComPrediction.cpp	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComPrediction.cpp	(revision 373)
@@ -78,5 +78,10 @@
 
   m_cYuvPredTemp.destroy();
-
+#if QC_ARP_D0177
+  m_acYuvPredBase[0].destroy();
+  m_acYuvPredBase[1].destroy();
+  m_acYuvDiff[0].destroy();
+  m_acYuvDiff[1].destroy();
+#endif
   if( m_pLumaRecBuffer )
   {
@@ -119,4 +124,10 @@
 
     m_cYuvPredTemp.create( g_uiMaxCUWidth, g_uiMaxCUHeight );
+#if QC_ARP_D0177
+    m_acYuvPredBase[0] .create( g_uiMaxCUWidth, g_uiMaxCUHeight );
+    m_acYuvPredBase[1] .create( g_uiMaxCUWidth, g_uiMaxCUHeight );
+    m_acYuvDiff    [0] .create( g_uiMaxCUWidth, g_uiMaxCUHeight );
+    m_acYuvDiff    [1] .create( g_uiMaxCUWidth, g_uiMaxCUHeight );
+#endif
   }
 
@@ -751,5 +762,5 @@
 }
 
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
 Void TComPrediction::residualPrediction(TComDataCU* pcCU, TComYuv* pcYuvPred, TComYuv* pcYuvResPred)
 {
@@ -810,5 +821,18 @@
   }
 #endif
-
+#if QC_ARP_D0177
+  if( pcCU->getSlice()->getSPS()->isDepth() == false
+    && pcCU->getSlice()->getSPS()->getViewId() > 0
+    && pcCU->getSlice()->getSPS()->getUseAdvRP() > 0
+    && pcCU->getARPW( uiPartAddr ) > 0 
+    && pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPOC()!= pcCU->getSlice()->getPOC()
+    && (pcCU->getPartitionSize(uiPartAddr)==SIZE_2Nx2N || pcCU->isSkipped(uiPartAddr))
+    )
+  {
+    xPredInterUniARP( pcCU , uiPartAddr , iWidth , iHeight , eRefPicList , rpcYuvPred , iPartIdx , bi );
+  }
+  else
+  {
+#endif
 #if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
   if( pcCU->getSlice()->getSPS()->isDepth() )
@@ -911,6 +935,124 @@
    }
 #endif
-}
-
+#if QC_ARP_D0177
+  }
+#endif
+}
+
+#if QC_ARP_D0177
+Void TComPrediction::xPredInterUniARP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bi, TComMvField * pNewMvFiled )
+{
+  Int         iRefIdx     = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );           
+  TComMv      cMv         = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr );
+  Bool        bTobeScaled = false;
+  UChar dW = pcCU->getARPW ( uiPartAddr );
+  TComPic* pcPicYuvBaseCol =  NULL;
+  TComPic* pcPicYuvBaseRef =  NULL;
+  DisInfo cDistparity;
+
+  if( pNewMvFiled )
+  {
+    iRefIdx = pNewMvFiled->getRefIdx(); 
+    cMv = pNewMvFiled->getMv();
+  }
+
+#if QC_CU_NBDV_D0181
+  cDistparity.bDV           = pcCU->getDvInfo(uiPartAddr).bDV;
+  if( cDistparity.bDV )
+  {
+#if MERL_VSP_C0152
+    cDistparity.m_acMvCand[0] = pcCU->getDvInfo(0).m_acMvCandNoRef[0];
+#else
+    cDistparity.m_acMvCand[0] = pcCU->getDvInfo(0).m_acMvCand[0];
+#endif
+    assert(pcCU->getDvInfo(uiPartAddr).bDV ==  pcCU->getDvInfo(0).bDV);
+    cDistparity.m_aVIdxCan[0] = pcCU->getDvInfo(uiPartAddr).m_aVIdxCan[0];
+    cDistparity.iN            = pcCU->getDvInfo(uiPartAddr).iN;
+  }
+  else
+    cDistparity.iN    =  0;
+#else
+  pcCU->getDisMvpCandNBDV( iPartIdx, uiPartAddr,  &cDistparity, false );
+#endif
+
+  dW = !cDistparity.iN ? 0: dW;
+  if( cDistparity.iN ) 
+  {
+    if(dW > 0 && pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC()!= pcCU->getSlice()->getPOC())
+      bTobeScaled = true;
+    pcPicYuvBaseCol =  pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getPOC(),                              cDistparity.m_aVIdxCan[0] );
+    pcPicYuvBaseRef =  pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC(), cDistparity.m_aVIdxCan[0] );
+    if( (!pcPicYuvBaseCol || pcPicYuvBaseCol->getPOC() != pcCU->getSlice()->getPOC()) || (!pcPicYuvBaseRef || pcPicYuvBaseRef->getPOC() != pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC() ))
+    {
+      dW = 0;
+      bTobeScaled = false;
+    }
+    else
+      assert( pcPicYuvBaseCol->getPOC() == pcCU->getSlice()->getPOC() && pcPicYuvBaseRef->getPOC() == pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC() );
+    if(bTobeScaled)
+    {     
+      Int iCurrPOC = pcCU->getSlice()->getPOC();
+      Int iColRefPOC  = pcCU->getSlice()->getRefPOC( eRefPicList, iRefIdx );
+      Int iCurrRefPOC = pcCU->getSlice()->getRefPOC( eRefPicList,  0);
+      Int iScale = pcCU-> xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iCurrPOC, iColRefPOC);
+      if ( iScale != 4096 )
+        cMv = cMv.scaleMv( iScale );
+      iRefIdx = 0;
+    }
+  }
+  pcCU->clipMv(cMv);
+  TComPicYuv* pcPicYuvRef = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec();
+  xPredInterLumaBlk  ( pcCU, pcPicYuvRef, uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi
+#if LGE_ILLUCOMP_B0045
+    , false
+#endif
+    , true 
+    );
+  xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi
+#if LGE_ILLUCOMP_B0045
+    , false
+#endif
+    , true
+    );
+  if( dW > 0 )
+  {
+    TComYuv * pYuvmB0 = &m_acYuvPredBase[0];
+    TComYuv * pYuvB1  = &m_acYuvPredBase[1];
+    assert ( cDistparity.iN == 1 );
+    pcPicYuvRef = pcPicYuvBaseCol->getPicYuvRec();
+    xPredInterLumaBlk  ( pcCU, pcPicYuvRef, uiPartAddr, &cDistparity.m_acMvCand[0], iWidth, iHeight, pYuvB1, bi
+#if LGE_ILLUCOMP_B0045
+      , false
+#endif
+      ,  true
+      );
+    xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cDistparity.m_acMvCand[0], iWidth, iHeight, pYuvB1, bi 
+#if LGE_ILLUCOMP_B0045
+      , false
+#endif
+      , true
+      );
+    pcPicYuvRef = pcPicYuvBaseRef->getPicYuvRec();
+    TComMv cMVwithDisparity = cMv + cDistparity.m_acMvCand[0];
+    pcCU->clipMv(cMVwithDisparity);
+    xPredInterLumaBlk  ( pcCU, pcPicYuvRef, uiPartAddr, &cMVwithDisparity, iWidth, iHeight, pYuvmB0, bi 
+#if LGE_ILLUCOMP_B0045
+      , false
+#endif
+      , true
+      );
+    xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMVwithDisparity, iWidth, iHeight, pYuvmB0, bi 
+#if LGE_ILLUCOMP_B0045
+      , false
+#endif
+      , true
+      );
+    pYuvB1->subtractARP( pYuvB1 , pYuvmB0 , uiPartAddr , iWidth , iHeight );
+    if(dW == 2)
+      pYuvB1->multiplyARP( uiPartAddr , iWidth , iHeight , dW );
+    rpcYuvPred->addARP( rpcYuvPred , pYuvB1 , uiPartAddr , iWidth , iHeight , !bi );
+  }
+}
+#endif
 
 #if MERL_VSP_C0152
@@ -1108,7 +1250,17 @@
  */
 #if LGE_ILLUCOMP_B0045
-Void TComPrediction::xPredInterLumaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi, Bool bICFlag)
-#else
-Void TComPrediction::xPredInterLumaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi )
+Void TComPrediction::xPredInterLumaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi, Bool bICFlag
+#if QC_ARP_D0177
+    ,
+    Int filterType
+#endif 
+    )
+#else
+Void TComPrediction::xPredInterLumaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi
+#if QC_ARP_D0177
+    ,
+    Int filterType
+#endif 
+    )
 #endif
 {
@@ -1129,9 +1281,19 @@
   if ( yFrac == 0 )
   {
-    m_if.filterHorLuma( ref, refStride, dst, dstStride, width, height, xFrac,       !bi );
+    m_if.filterHorLuma( ref, refStride, dst, dstStride, width, height, xFrac,       !bi
+#if QC_ARP_D0177
+    ,
+    filterType
+#endif
+    );
   }
   else if ( xFrac == 0 )
   {
-    m_if.filterVerLuma( ref, refStride, dst, dstStride, width, height, yFrac, true, !bi );
+    m_if.filterVerLuma( ref, refStride, dst, dstStride, width, height, yFrac, true, !bi
+#if QC_ARP_D0177
+    ,
+    filterType
+#endif
+    );
   }
   else
@@ -1143,6 +1305,16 @@
     Int halfFilterSize = ( filterSize >> 1 );
 
-    m_if.filterHorLuma(ref - (halfFilterSize-1)*refStride, refStride, tmp, tmpStride, width, height+filterSize-1, xFrac, false     );
-    m_if.filterVerLuma(tmp + (halfFilterSize-1)*tmpStride, tmpStride, dst, dstStride, width, height,              yFrac, false, !bi);    
+    m_if.filterHorLuma(ref - (halfFilterSize-1)*refStride, refStride, tmp, tmpStride, width, height+filterSize-1, xFrac, false     
+ #if QC_ARP_D0177
+    ,
+    filterType
+#endif 
+    );
+    m_if.filterVerLuma(tmp + (halfFilterSize-1)*tmpStride, tmpStride, dst, dstStride, width, height,              yFrac, false, !bi
+ #if QC_ARP_D0177
+    ,
+    filterType
+#endif 
+    );    
   }
 
@@ -1185,7 +1357,16 @@
  */
 #if LGE_ILLUCOMP_B0045
-Void TComPrediction::xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi, Bool bICFlag )
-#else
-Void TComPrediction::xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi )
+Void TComPrediction::xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi, Bool bICFlag
+#if QC_ARP_D0177
+    ,
+    Int filterType
+#endif    
+    )
+#else
+Void TComPrediction::xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi
+#if QC_ARP_D0177
+  , Int filterType
+#endif
+  )
 #endif
 {
@@ -1215,19 +1396,59 @@
   if ( yFrac == 0 )
   {
-    m_if.filterHorChroma(refCb, refStride, dstCb,  dstStride, cxWidth, cxHeight, xFrac, !bi);    
-    m_if.filterHorChroma(refCr, refStride, dstCr,  dstStride, cxWidth, cxHeight, xFrac, !bi);    
+    m_if.filterHorChroma(refCb, refStride, dstCb,  dstStride, cxWidth, cxHeight, xFrac, !bi
+#if QC_ARP_D0177
+    ,
+    filterType
+#endif   
+    );    
+    m_if.filterHorChroma(refCr, refStride, dstCr,  dstStride, cxWidth, cxHeight, xFrac, !bi
+#if QC_ARP_D0177
+    ,
+    filterType
+#endif   
+    );    
   }
   else if ( xFrac == 0 )
   {
-    m_if.filterVerChroma(refCb, refStride, dstCb, dstStride, cxWidth, cxHeight, yFrac, true, !bi);    
-    m_if.filterVerChroma(refCr, refStride, dstCr, dstStride, cxWidth, cxHeight, yFrac, true, !bi);    
+    m_if.filterVerChroma(refCb, refStride, dstCb, dstStride, cxWidth, cxHeight, yFrac, true, !bi
+ #if QC_ARP_D0177
+    ,
+    filterType
+#endif   
+    );    
+    m_if.filterVerChroma(refCr, refStride, dstCr, dstStride, cxWidth, cxHeight, yFrac, true, !bi
+ #if QC_ARP_D0177
+    ,
+    filterType
+#endif   
+    );    
   }
   else
   {
-    m_if.filterHorChroma(refCb - (halfFilterSize-1)*refStride, refStride, extY,  extStride, cxWidth, cxHeight+filterSize-1, xFrac, false);
-    m_if.filterVerChroma(extY  + (halfFilterSize-1)*extStride, extStride, dstCb, dstStride, cxWidth, cxHeight  , yFrac, false, !bi);
+    m_if.filterHorChroma(refCb - (halfFilterSize-1)*refStride, refStride, extY,  extStride, cxWidth, cxHeight+filterSize-1, xFrac, false
+#if QC_ARP_D0177
+    ,
+    filterType
+#endif   
+    );
+    m_if.filterVerChroma(extY  + (halfFilterSize-1)*extStride, extStride, dstCb, dstStride, cxWidth, cxHeight  , yFrac, false, !bi
+#if QC_ARP_D0177
+    ,
+    filterType
+#endif   
+    );
     
-    m_if.filterHorChroma(refCr - (halfFilterSize-1)*refStride, refStride, extY,  extStride, cxWidth, cxHeight+filterSize-1, xFrac, false);
-    m_if.filterVerChroma(extY  + (halfFilterSize-1)*extStride, extStride, dstCr, dstStride, cxWidth, cxHeight  , yFrac, false, !bi);    
+    m_if.filterHorChroma(refCr - (halfFilterSize-1)*refStride, refStride, extY,  extStride, cxWidth, cxHeight+filterSize-1, xFrac, false
+#if QC_ARP_D0177
+    ,
+    filterType
+#endif   
+    );
+    m_if.filterVerChroma(extY  + (halfFilterSize-1)*extStride, extStride, dstCr, dstStride, cxWidth, cxHeight  , yFrac, false, !bi
+#if QC_ARP_D0177
+    ,
+    filterType
+#endif   
+    );    
   }
 #if LGE_ILLUCOMP_B0045
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComPrediction.h
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComPrediction.h	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComPrediction.h	(revision 373)
@@ -69,4 +69,8 @@
   TComYuv   m_acYuvPred[2];
   TComYuv   m_cYuvPredTemp;
+#if QC_ARP_D0177
+  TComYuv   m_acYuvPredBase[2];
+  TComYuv   m_acYuvDiff[2];
+#endif
   TComYuv m_filteredBlock[4][4];
   TComYuv m_filteredBlockTmp[4];
@@ -86,4 +90,7 @@
   
   // motion compensation functions
+#if QC_ARP_D0177
+  Void xPredInterUniARP       ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bi=false, TComMvField * pNewMvFiled = NULL );
+#endif
 #if MERL_VSP_C0152
   Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,       UInt uiAbsPartIdx,        Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX = 0, UInt uiSubSampExpY = 0, Bool bi=false );
@@ -113,9 +120,29 @@
 
 #if LGE_ILLUCOMP_B0045
-  Void xPredInterLumaBlk  ( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi, Bool bICFlag = false );
-  Void xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi, Bool bICFlag = false );
-#else
-  Void xPredInterLumaBlk  ( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi );
-  Void xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi );
+  Void xPredInterLumaBlk  ( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi, Bool bICFlag = false
+#if QC_ARP_D0177
+    ,
+    Int filterType = 0
+#endif
+    );
+  Void xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi, Bool bICFlag = false
+#if QC_ARP_D0177
+    ,
+    Int filterType = 0
+#endif
+    );
+#else
+  Void xPredInterLumaBlk  ( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi
+#if QC_ARP_D0177
+    ,
+    Int filterType = 0
+#endif
+    );
+  Void xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi
+#if QC_ARP_D0177
+    ,
+    Int filterType = 0
+#endif
+    );
 #endif
   Void xWeightedAverage         ( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst );
@@ -169,5 +196,5 @@
 #endif
 
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
   Void residualPrediction         (TComDataCU* pcCU, TComYuv* pcYuvPred, TComYuv* pcYuvResPred);
 #endif
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComResidualGenerator.cpp
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComResidualGenerator.cpp	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComResidualGenerator.cpp	(revision 373)
@@ -44,5 +44,5 @@
 
 
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
 
 
@@ -225,5 +225,7 @@
   }
 }
-
+#endif
+
+#if !QC_ARP_D0177
 #if H3D_NBDV
 Bool
@@ -249,5 +251,5 @@
 }
   
-#if H3D_NBDV
+#if H3D_NBDV 
 Bool
 TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, TComMv iDisp, Bool bRecon)  
@@ -263,4 +265,8 @@
   }
   UInt uiXPosInRefView = uiXPos , uiYPosInRefView = uiYPos;
+#if QC_ARP_D0177
+  if(pcPic->getSPS()->getMultiviewResPredMode())
+  {
+#endif
 #if H3D_NBDV
   xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, iDisp, &uiXPosInRefView , &uiYPosInRefView , bRecon  );
@@ -269,4 +275,9 @@
 #endif
   return true;
+#if QC_ARP_D0177
+  }
+  else
+    return true;
+#endif
 }
 
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComResidualGenerator.h
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComResidualGenerator.h	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComResidualGenerator.h	(revision 373)
@@ -50,5 +50,5 @@
 
 
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
 
 class TComResidualGenerator
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComSlice.cpp	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComSlice.cpp	(revision 373)
@@ -1386,5 +1386,36 @@
 }
 #endif
-
+#if QC_ARP_D0177
+Void TComSlice::setARPStepNum()                                  
+{
+  Bool bAllIvRef = false;
+  if(!getSPS()->getUseAdvRP())
+    m_nARPStepNum = 0;
+  else
+  {
+    for( Int iRefListId = 0; iRefListId < 2; iRefListId++ )
+    {
+      RefPicList  eRefPicList = RefPicList( iRefListId );
+      Int iNumRefIdx = getNumRefIdx(eRefPicList);
+      if( iNumRefIdx <= 0 )
+        continue;
+      for (Int i = 0; i < iNumRefIdx; i++)
+      {
+        if(getRefPic( REF_PIC_LIST_0, i)->getPOC() != getPOC())
+        {
+          bAllIvRef = true;
+          break;
+        }
+      }
+      if( bAllIvRef == true )
+        break;
+    }
+    if(bAllIvRef== true)
+      m_nARPStepNum = getSPS()->getARPStepNum();
+    else
+      m_nARPStepNum = 0;
+  }
+}
+#endif
 // ------------------------------------------------------------------------------------------------
 // Video parameter set (VPS)
@@ -1576,5 +1607,8 @@
   m_uiMultiviewMvPredMode    = 0;
 #endif
-
+#if QC_ARP_D0177
+  m_nUseAdvResPred           = 0;
+  m_nARPStepNum              = 1;
+#endif
   ::memset( m_aiUsableInterViewRefs, 0, sizeof( m_aiUsableInterViewRefs ) );
   
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComSlice.h	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComSlice.h	(revision 373)
@@ -54,5 +54,5 @@
 class TComDepthMapGenerator;
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
 class TComResidualGenerator;
 #endif
@@ -390,5 +390,10 @@
 #endif
 #if H3D_IVRP
+#if QC_ARP_D0177
+  UInt         m_nUseAdvResPred;
+  UInt         m_nARPStepNum;
+#else
   UInt  m_uiMultiviewResPredMode;
+#endif
 #endif
 
@@ -396,5 +401,5 @@
   TComDepthMapGenerator* m_pcDepthMapGenerator;
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
   TComResidualGenerator* m_pcResidualGenerator;
 #endif
@@ -643,5 +648,5 @@
   Void setPredDepthMapGeneration( UInt uiViewId, Bool bIsDepth, UInt uiPdmGenMode = 0, UInt uiPdmMvPredMode = 0, UInt uiPdmPrec = 0, Int** aaiPdmScaleNomDelta = 0, Int** aaiPdmOffset = 0 );
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
   Void  setMultiviewResPredMode  ( UInt uiResPrdMode ) { m_uiMultiviewResPredMode = uiResPrdMode; }
 #endif
@@ -658,5 +663,12 @@
 #endif
 #if H3D_IVRP
+#if QC_ARP_D0177
+  UInt  getUseAdvRP()              { return m_nUseAdvResPred;   }
+  Void  setUseAdvRP(UInt n)        { m_nUseAdvResPred = n;      }
+  UInt  getARPStepNum()            { return m_nARPStepNum;      }
+  Void  setARPStepNum(UInt n)      { m_nARPStepNum = n;         }
+#else
   UInt  getMultiviewResPredMode  ()          { return m_uiMultiviewResPredMode;   }
+#endif
 #endif
 
@@ -665,5 +677,5 @@
   TComDepthMapGenerator*  getDepthMapGenerator()                                              { return m_pcDepthMapGenerator; }
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
   Void                    setResidualGenerator( TComResidualGenerator* pcResidualGenerator )  { m_pcResidualGenerator = pcResidualGenerator; }
   TComResidualGenerator*  getResidualGenerator()                                              { return m_pcResidualGenerator; }
@@ -1107,4 +1119,8 @@
   Bool        m_bApplyIC;
 #endif
+#if QC_ARP_D0177
+  TComList<TComPic*> * m_pBaseViewRefPicList[MAX_VIEW_NUM];
+  UInt                 m_nARPStepNum; 
+#endif
 #if INTER_VIEW_VECTOR_SCALING_C0115|QC_MVHEVC_B0046
   Bool       m_bIVScalingFlag;
@@ -1253,5 +1269,10 @@
   Void      setRefPicListMvc    ( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& rapcInterViewRefPics );
   Void      setRefPOCnViewListsMvc();
-
+#if QC_ARP_D0177
+  Void      setBaseViewRefPicList( TComList<TComPic*> *pListPic, Int iViewIdx )      { m_pBaseViewRefPicList[iViewIdx] = pListPic; }
+  TComPic*  getBaseViewRefPic    ( UInt uiPOC , Int iViewIdx )                       { return xGetRefPic( *m_pBaseViewRefPicList[iViewIdx], uiPOC ); }
+  Void      setARPStepNum();                                 
+  UInt      getARPStepNum( )                                      { return m_nARPStepNum;      }  
+#endif
   Void      setColDir           ( UInt uiDir ) { m_uiColDir = uiDir; }
 #if COLLOCATED_REF_IDX
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComYuv.cpp
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComYuv.cpp	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComYuv.cpp	(revision 373)
@@ -741,3 +741,169 @@
   }
 }
+#if QC_ARP_D0177
+Void TComYuv::addARP(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip )
+{
+  addARPLuma   ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth   , uiHeight    , bClip );
+  addARPChroma ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth>>1, uiHeight>>1 , bClip );
+}
+
+Void TComYuv::addARPLuma(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip )
+{
+  Int x, y;
+
+  Pel* pSrc0 = pcYuvSrc0->getLumaAddr( uiAbsPartIdx );
+  Pel* pSrc1 = pcYuvSrc1->getLumaAddr( uiAbsPartIdx );
+  Pel* pDst  = getLumaAddr( uiAbsPartIdx );
+
+  UInt iSrc0Stride = pcYuvSrc0->getStride();
+  UInt iSrc1Stride = pcYuvSrc1->getStride();
+  UInt iDstStride  = getStride();
+  for ( y = uiHeight-1; y >= 0; y-- )
+  {
+    for ( x = uiWidth-1; x >= 0; x-- )
+    {
+      pDst[x] = pSrc0[x] + pSrc1[x];
+      if( bClip )
+        pDst[x] = Clip( pDst[x] );
+    }
+    pSrc0 += iSrc0Stride;
+    pSrc1 += iSrc1Stride;
+    pDst  += iDstStride;
+  }
+}
+
+Void TComYuv::addARPChroma(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip )
+{
+  Int x, y;
+
+  Pel* pSrcU0 = pcYuvSrc0->getCbAddr( uiAbsPartIdx );
+  Pel* pSrcU1 = pcYuvSrc1->getCbAddr( uiAbsPartIdx );
+  Pel* pSrcV0 = pcYuvSrc0->getCrAddr( uiAbsPartIdx );
+  Pel* pSrcV1 = pcYuvSrc1->getCrAddr( uiAbsPartIdx );
+  Pel* pDstU = getCbAddr( uiAbsPartIdx );
+  Pel* pDstV = getCrAddr( uiAbsPartIdx );
+
+  UInt  iSrc0Stride = pcYuvSrc0->getCStride();
+  UInt  iSrc1Stride = pcYuvSrc1->getCStride();
+  UInt  iDstStride  = getCStride();
+  for ( y = uiHeight-1; y >= 0; y-- )
+  {
+    for ( x = uiWidth-1; x >= 0; x-- )
+    {
+      pDstU[x] = pSrcU0[x] + pSrcU1[x];
+      pDstV[x] = pSrcV0[x] + pSrcV1[x];
+      if( bClip )
+      {
+        pDstU[x] = Clip( pDstU[x] );
+        pDstV[x] = Clip( pDstV[x] );
+      }
+    }
+
+    pSrcU0 += iSrc0Stride;
+    pSrcU1 += iSrc1Stride;
+    pSrcV0 += iSrc0Stride;
+    pSrcV1 += iSrc1Stride;
+    pDstU  += iDstStride;
+    pDstV  += iDstStride;
+  }
+}
+
+Void TComYuv::subtractARP(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight)
+{
+  subtractARPLuma  ( pcYuvSrc0, pcYuvSrc1,  uiAbsPartIdx, uiWidth    , uiHeight    );
+  subtractARPChroma( pcYuvSrc0, pcYuvSrc1,  uiAbsPartIdx, uiWidth>>1 , uiHeight>>1 );
+}
+
+Void TComYuv::subtractARPLuma(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight)
+{
+  Int x, y;
+
+  Pel* pSrc0 = pcYuvSrc0->getLumaAddr( uiAbsPartIdx );
+  Pel* pSrc1 = pcYuvSrc1->getLumaAddr( uiAbsPartIdx );
+  Pel* pDst  = getLumaAddr( uiAbsPartIdx );
+
+  Int  iSrc0Stride = pcYuvSrc0->getStride();
+  Int  iSrc1Stride = pcYuvSrc1->getStride();
+  Int  iDstStride  = getStride();
+  for ( y = uiHeight-1; y >= 0; y-- )
+  {
+    for ( x = uiWidth-1; x >= 0; x-- )
+    {
+      pDst[x] = pSrc0[x] - pSrc1[x];
+    }
+    pSrc0 += iSrc0Stride;
+    pSrc1 += iSrc1Stride;
+    pDst  += iDstStride;
+  }
+}
+
+Void TComYuv::subtractARPChroma(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight)
+{
+  Int x, y;
+
+  Pel* pSrcU0 = pcYuvSrc0->getCbAddr( uiAbsPartIdx );
+  Pel* pSrcU1 = pcYuvSrc1->getCbAddr( uiAbsPartIdx );
+  Pel* pSrcV0 = pcYuvSrc0->getCrAddr( uiAbsPartIdx );
+  Pel* pSrcV1 = pcYuvSrc1->getCrAddr( uiAbsPartIdx );
+  Pel* pDstU  = getCbAddr( uiAbsPartIdx );
+  Pel* pDstV  = getCrAddr( uiAbsPartIdx );
+
+  Int  iSrc0Stride = pcYuvSrc0->getCStride();
+  Int  iSrc1Stride = pcYuvSrc1->getCStride();
+  Int  iDstStride  = getCStride();
+  for ( y = uiHeight-1; y >= 0; y-- )
+  {
+    for ( x = uiWidth-1; x >= 0; x-- )
+    {
+      pDstU[x] = pSrcU0[x] - pSrcU1[x];
+      pDstV[x] = pSrcV0[x] - pSrcV1[x];
+    }
+    pSrcU0 += iSrc0Stride;
+    pSrcU1 += iSrc1Stride;
+    pSrcV0 += iSrc0Stride;
+    pSrcV1 += iSrc1Stride;
+    pDstU  += iDstStride;
+    pDstV  += iDstStride;
+  }
+}
+
+Void TComYuv::multiplyARP( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW )
+{
+  multiplyARPLuma( uiAbsPartIdx , uiWidth , uiHeight , dW );
+  multiplyARPChroma( uiAbsPartIdx , uiWidth >> 1 , uiHeight >> 1 , dW );
+}
+
+Void TComYuv::xxMultiplyLine( Pel * pSrcDst , UInt uiWidth , UChar dW )
+{
+  assert( dW == 2 );
+  for( UInt x = 0 ; x < uiWidth ; x++ )
+    pSrcDst[x] =  pSrcDst[x] >> 1;
+}
+
+Void TComYuv::multiplyARPLuma( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW )
+{
+  Pel* pDst  = getLumaAddr( uiAbsPartIdx );
+  Int  iDstStride  = getStride();
+  for ( Int y = uiHeight-1; y >= 0; y-- )
+  {
+    xxMultiplyLine( pDst , uiWidth , dW );
+    pDst  += iDstStride;
+  }
+}
+
+Void TComYuv::multiplyARPChroma( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW )
+{
+  Pel* pDstU  = getCbAddr( uiAbsPartIdx );
+  Pel* pDstV  = getCrAddr( uiAbsPartIdx );
+
+  Int  iDstStride  = getCStride();
+  for ( Int y = uiHeight-1; y >= 0; y-- )
+  {
+    xxMultiplyLine( pDstU , uiWidth , dW );
+    xxMultiplyLine( pDstV , uiWidth , dW );
+    pDstU  += iDstStride;
+    pDstV  += iDstStride;
+  }
+}
+#endif
 //! \}
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComYuv.h
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComYuv.h	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TComYuv.h	(revision 373)
@@ -199,4 +199,17 @@
 
   __inline Pel  xClip  (Pel x )      { return ( (x < 0) ? 0 : (x > (Pel)g_uiIBDI_MAX) ? (Pel)g_uiIBDI_MAX : x ); }
+#if QC_ARP_D0177
+  Void    addARP           ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip );
+  Void    addARPLuma       ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip );
+  Void    addARPChroma     ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip );
+  Void    subtractARP      ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight );
+  Void    subtractARPLuma  ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight );
+  Void    subtractARPChroma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight );
+  Void    multiplyARP      ( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW );
+  Void    multiplyARPLuma  ( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW );
+  Void    multiplyARPChroma( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW );
+private:
+  Void    xxMultiplyLine( Pel * pSrcDst , UInt uiWidth , UChar dW );
+#endif
 };// END CLASS DEFINITION TComYuv
 
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TypeDef.h	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibCommon/TypeDef.h	(revision 373)
@@ -95,4 +95,8 @@
                                               // FIX_LG_RESTRICTEDRESPRED_M24766   1
 
+#define QC_ARP_D0177            1      ////< advanced residual prediction
+#if QC_ARP_D0177
+#define QC_ARP_WFNR       3
+#endif
 ///// ***** DISPARITY VECTOR DERIVATION *********
 #define H3D_NBDV                          1   // Neighboring block disparity derivation 
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 373)
@@ -1493,6 +1493,12 @@
 #endif
 #if H3D_IVRP
-    pcSPS->setMultiviewResPredMode  ( 0 );
-#endif
+#if QC_ARP_D0177
+     pcSPS->setUseAdvRP  ( 0 );
+     pcSPS->setARPStepNum( 1 );
+#else
+     pcSPS->setMultiviewResPredMode  ( 0 );
+#endif
+#endif
+
     }
     else
@@ -1544,6 +1550,12 @@
 #endif
 #if H3D_IVRP
+#if QC_ARP_D0177
+      pcSPS->setUseAdvRP  ( 0 );
+      pcSPS->setARPStepNum( 1 );
+#else
       pcSPS->setMultiviewResPredMode  ( 0 );
 #endif
+#endif
+
       }
       else
@@ -1573,5 +1585,5 @@
         UInt uiMultiviewMvPredMode = 0;
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
       UInt uiMultiviewResPredMode = 0;
 #endif
@@ -1588,5 +1600,5 @@
           READ_UVLC( uiMultiviewMvPredMode, "multi_view_mv_pred_mode" );
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
           READ_FLAG( uiMultiviewResPredMode, "multi_view_residual_pred_mode" );
 #endif
@@ -1599,6 +1611,15 @@
 #endif
 #if H3D_IVRP
+#if QC_ARP_D0177
+      READ_FLAG( uiCode , "advanced_residual_pred_flag" );           pcSPS->setUseAdvRP( uiCode );
+      if( pcSPS->getUseAdvRP()  )
+          pcSPS->setARPStepNum( QC_ARP_WFNR );
+      else
+       pcSPS->setARPStepNum( 1 );
+#else
       pcSPS->setMultiviewResPredMode  ( uiMultiviewResPredMode );
 #endif
+#endif
+
       }
     }
@@ -2424,5 +2445,10 @@
 }
 #endif
-
+#if QC_ARP_D0177
+Void TDecCavlc::parseARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
+{
+  assert( false );
+}
+#endif
 #if RWTH_SDC_DLT_B0036
 Void TDecCavlc::parseSDCFlag    ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecCAVLC.h
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 373)
@@ -144,4 +144,7 @@
   Void parseResPredFlag     ( TComDataCU* pcCU, Bool& rbResPredFlag, UInt uiAbsPartIdx, UInt uiDepth );
 #endif
+#if QC_ARP_D0177
+  Void parseARPW( TComDataCU* pcCU, UInt uiAbsPartIdx,UInt uiDepth );
+#endif
   Void parseSplitFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
   Void parsePartSize        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecCu.cpp
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecCu.cpp	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecCu.cpp	(revision 373)
@@ -54,5 +54,5 @@
   m_ppcYuvResi = NULL;
   m_ppcYuvReco = NULL;
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
   m_ppcYuvResPred = NULL;
 #endif
@@ -82,5 +82,5 @@
   m_ppcYuvResi = new TComYuv*[m_uiMaxDepth-1];
   m_ppcYuvReco = new TComYuv*[m_uiMaxDepth-1];
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
   m_ppcYuvResPred = new TComYuv*   [m_uiMaxDepth-1];
 #endif
@@ -96,5 +96,5 @@
     m_ppcYuvResi[ui] = new TComYuv;    m_ppcYuvResi[ui]->create( uiWidth, uiHeight );
     m_ppcYuvReco[ui] = new TComYuv;    m_ppcYuvReco[ui]->create( uiWidth, uiHeight );
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
     m_ppcYuvResPred[ui] = new TComYuv;    m_ppcYuvResPred[ui]->create( uiWidth, uiHeight );
 #endif
@@ -120,5 +120,5 @@
     m_ppcYuvResi[ui]->destroy(); delete m_ppcYuvResi[ui]; m_ppcYuvResi[ui] = NULL;
     m_ppcYuvReco[ui]->destroy(); delete m_ppcYuvReco[ui]; m_ppcYuvReco[ui] = NULL;
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
     m_ppcYuvResPred[ui]->destroy(); delete m_ppcYuvResPred[ui]; m_ppcYuvResPred[ui] = NULL;
 #endif
@@ -128,5 +128,5 @@
   delete [] m_ppcYuvResi; m_ppcYuvResi = NULL;
   delete [] m_ppcYuvReco; m_ppcYuvReco = NULL;
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
   delete [] m_ppcYuvResPred; m_ppcYuvResPred = NULL;
 #endif
@@ -317,5 +317,9 @@
       if(!pcCU->getSlice()->isIntra())
       {
+#if QC_ARP_D0177
+        if(( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() || pcCU->getSlice()->getSPS()->getUseAdvRP())             && pcCU->getSlice()->getViewId())
+#else
         if(( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() || pcCU->getSlice()->getSPS()->getMultiviewResPredMode()) && pcCU->getSlice()->getViewId())
+#endif
         {  
           m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0, true );
@@ -443,4 +447,12 @@
     }
 #endif
+#if QC_ARP_D0177
+    if( pcCU->getSlice()->getSPS()->getUseAdvRP() )
+    {
+      pcCU->setResPredAvailSubParts ( false, uiAbsPartIdx, 0, uiDepth );
+      pcCU->setResPredFlagSubParts  ( false, uiAbsPartIdx, 0, uiDepth );
+      m_pcEntropyDecoder->decodeARPW( pcCU , uiAbsPartIdx , uiDepth, m_ppcCU[uiDepth], 0 );
+    }
+#endif
     xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
     return;
@@ -494,5 +506,11 @@
   }
 #endif
-
+#if QC_ARP_D0177 
+  if (pcCU->getSlice()->getSPS()->getUseAdvRP() && pcCU->isIntra( uiAbsPartIdx ) )
+  {
+    pcCU->setResPredAvailSubParts ( 0, uiAbsPartIdx, 0, uiDepth );
+    pcCU->setResPredFlagSubParts  ( 0, uiAbsPartIdx, 0, uiDepth );
+  }
+#endif
 #if HHI_MPI
     if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == uiDepth )
@@ -704,5 +722,5 @@
   m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] );
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
   if (pcCU->getMergeFlag(0) && pcCU->getMergeIndex(0)==0 && pcCU->getResPredAvail(0))
   {
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecCu.h
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecCu.h	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecCu.h	(revision 373)
@@ -61,5 +61,5 @@
   TComYuv**           m_ppcYuvResi;       ///< array of residual buffer
   TComYuv**           m_ppcYuvReco;       ///< array of prediction & reconstruction buffer
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
   TComYuv**           m_ppcYuvResPred;    ///< residual prediction buffer
 #endif
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecEntropy.cpp
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 373)
@@ -108,4 +108,17 @@
 }
 
+#if QC_ARP_D0177
+Void TDecEntropy::decodeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU, UInt uiPUIdx )
+{
+  if( pcCU->getSlice()->getViewId() == 0 || pcCU->getSlice()->getIsDepth() == true || !pcCU->getSlice()->getARPStepNum() )
+    return;
+  assert( !pcCU->isIntra( uiAbsPartIdx ) );
+  Bool bResPredAvailable = !pcCU->getSlice()->getARPStepNum() ? false: ((pcCU->getPartitionSize(uiAbsPartIdx)==SIZE_2Nx2N || pcCU->isSkipped(uiAbsPartIdx)) ? true: false);
+  if(!bResPredAvailable)
+    pcCU->setARPWSubParts( 0 , uiAbsPartIdx, uiDepth );  
+  else
+    m_pcEntropyDecoderIf->parseARPW( pcCU , uiAbsPartIdx , uiDepth );
+}
+#endif
 Void TDecEntropy::decodeSplitFlag   ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
 {
@@ -189,4 +202,10 @@
   {
     decodePUWise( pcCU, uiAbsPartIdx, uiDepth, pcSubCU );
+#if QC_ARP_D0177
+    if( pcCU->getSlice()->getSPS()->getUseAdvRP() )
+    {
+      decodeARPW( pcCU , uiAbsPartIdx , uiDepth, pcSubCU, 0  );
+    }
+#endif
   }
 }
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecEntropy.h
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecEntropy.h	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecEntropy.h	(revision 373)
@@ -106,4 +106,7 @@
   virtual Void parseResPredFlag   ( TComDataCU* pcCU, Bool& rbResPredFlag, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
 #endif
+#if QC_ARP_D0177
+  virtual Void parseARPW         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
+#endif
   virtual Void parsePartSize      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
   virtual Void parsePredMode      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
@@ -198,4 +201,7 @@
   Void decodeMergeFlag         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx );
   Void decodeMergeIndex        ( TComDataCU* pcSubCU, UInt uiPartIdx, UInt uiPartAddr, PartSize eCUMode, UChar* puhInterDirNeighbours, TComMvField* pcMvFieldNeighbours, UInt uiDepth );
+#if QC_ARP_D0177
+  Void decodeARPW              ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU, UInt uiPUIdx );
+#endif
   Void decodePredMode          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
   Void decodePartSize          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecGop.cpp
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecGop.cpp	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecGop.cpp	(revision 373)
@@ -93,5 +93,5 @@
                    ,TComDepthMapGenerator*  pcDepthMapGenerator
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
                   ,TComResidualGenerator*  pcResidualGenerator
 #endif
@@ -109,5 +109,5 @@
   m_pcDepthMapGenerator   = pcDepthMapGenerator;
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
   m_pcResidualGenerator   = pcResidualGenerator;
 #endif
@@ -298,5 +298,5 @@
       m_pcDepthMapGenerator->predictDepthMap  ( rpcPic );
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
       m_pcResidualGenerator->initViewComponent( rpcPic );
 #endif
@@ -331,5 +331,5 @@
   else
   {
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
     // set residual picture
     m_pcResidualGenerator->setRecResidualPic( rpcPic );
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecGop.h
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecGop.h	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecGop.h	(revision 373)
@@ -90,5 +90,5 @@
   TComDepthMapGenerator*  m_pcDepthMapGenerator;
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
   TComResidualGenerator*  m_pcResidualGenerator;
 #endif
@@ -118,5 +118,5 @@
                  ,TComDepthMapGenerator*  pcDepthMapGenerator
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
                 ,TComResidualGenerator*  pcResidualGenerator
 #endif
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecSbac.cpp
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 373)
@@ -64,4 +64,7 @@
 #if H3D_IVRP
 , m_cResPredFlagSCModel       ( 1,             1,               NUM_RES_PRED_FLAG_CTX         , m_contextModels + m_numContextModels, m_numContextModels)
+#endif
+#if QC_ARP_D0177
+, m_cCUPUARPW                 ( 1,             1,               NUM_ARPW_CTX                 , m_contextModels + m_numContextModels, m_numContextModels)
 #endif
 , m_cCUPartSizeSCModel        ( 1,             1,               NUM_PART_SIZE_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
@@ -162,4 +165,7 @@
   m_cResPredFlagSCModel.initBuffer       ( sliceType, qp, (UChar*)INIT_RES_PRED_FLAG );
 #endif
+#if QC_ARP_D0177
+  m_cCUPUARPW.initBuffer                ( sliceType, qp, (UChar*)INIT_ARPW );
+#endif
   m_cCUAlfCtrlFlagSCModel.initBuffer     ( sliceType, qp, (UChar*)INIT_ALF_CTRL_FLAG );
   m_cCUPartSizeSCModel.initBuffer        ( sliceType, qp, (UChar*)INIT_PART_SIZE );
@@ -248,4 +254,7 @@
 #if H3D_IVRP
   m_cResPredFlagSCModel.initBuffer       ( eSliceType, iQp, (UChar*)INIT_RES_PRED_FLAG );
+#endif
+#if QC_ARP_D0177
+  m_cCUPUARPW.initBuffer                 ( eSliceType, iQp, (UChar*)INIT_ARPW );
 #endif
   m_cCUAlfCtrlFlagSCModel.initBuffer     ( eSliceType, iQp, (UChar*)INIT_ALF_CTRL_FLAG );
@@ -2235,5 +2244,26 @@
 }
 #endif
-
+#if QC_ARP_D0177
+Void TDecSbac::parseARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
+{
+  UInt nMaxW = pcCU->getSlice()->getARPStepNum() - 1;
+  assert (nMaxW >= 0);
+  UInt nW = 0;
+  if( nMaxW > 0 )
+  {
+    UInt nOffset = pcCU->getCTXARPWFlag(uiAbsPartIdx);
+    assert( 0 <= nOffset && nOffset <= 2 );
+    UInt uiCode = 0;
+    m_pcTDecBinIf->decodeBin( uiCode , m_cCUPUARPW.get( 0, 0, 0 + nOffset ) );
+    nW = uiCode;
+    if( nW == 1 )   
+    {
+      m_pcTDecBinIf->decodeBin( uiCode , m_cCUPUARPW.get( 0, 0, 3 ) );
+      nW += ( uiCode == 1 );
+    }
+  }
+  pcCU->setARPWSubParts( ( UChar )( nW ) , uiAbsPartIdx, uiDepth );  
+}
+#endif
 #if LGE_EDGE_INTRA_A0070
 Void TDecSbac::xParseEdgeIntraInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecSbac.h
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecSbac.h	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecSbac.h	(revision 373)
@@ -176,4 +176,7 @@
   Void parseResPredFlag   ( TComDataCU* pcCU, Bool& rbResPredFlag, UInt uiAbsPartIdx, UInt uiDepth );
 #endif
+#if QC_ARP_D0177
+  Void parseARPW          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
+#endif
   Void parsePartSize      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
   Void parsePredMode      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
@@ -218,4 +221,7 @@
 #if H3D_IVRP
   ContextModel3DBuffer m_cResPredFlagSCModel;
+#endif
+#if QC_ARP_D0177
+  ContextModel3DBuffer m_cCUPUARPW;
 #endif
   ContextModel3DBuffer m_cCUPartSizeSCModel;
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecTop.cpp	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecTop.cpp	(revision 373)
@@ -403,5 +403,5 @@
   m_cDepthMapGenerator.destroy();
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
   m_cResidualGenerator.destroy();
 #endif
@@ -420,5 +420,5 @@
                     , &m_cDepthMapGenerator
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
                     , &m_cResidualGenerator
 #endif
@@ -434,5 +434,5 @@
 #endif
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
   m_cResidualGenerator.init( &m_cTrQuant, &m_cDepthMapGenerator );
 #endif
@@ -860,5 +860,5 @@
     }
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
     m_cResidualGenerator.create( true, m_apcSlicePilot->getSPS()->getPicWidthInLumaSamples(), m_apcSlicePilot->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUDepth, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiBitDepth + g_uiBitIncrement );
 #endif
@@ -1083,5 +1083,13 @@
     std::vector<TComPic*> apcInterViewRefPics = m_tAppDecTop->getInterViewRefPics( m_viewId, pcSlice->getPOC(), m_isDepth, pcSlice->getSPS() );
     pcSlice->setRefPicListMvc( m_cListPic, apcInterViewRefPics );
-
+#if QC_ARP_D0177
+    //pcSlice->setBaseViewRefPicList( m_tAppDecTop->getTDecTop( 0 , false )->getListPic() );
+    pcSlice->setARPStepNum();
+    if(pcSlice->getARPStepNum() > 1)
+    {
+      for(Int iViewIdx = 0; iViewIdx < pcSlice->getViewId(); iViewIdx ++ )
+        pcSlice->setBaseViewRefPicList( m_tAppDecTop->getTDecTop( iViewIdx, false )->getListPic(), iViewIdx );
+    }
+#endif
     // For generalized B
     // note: maybe not existed case (always L0 is copied to L1 if L1 is empty)
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecTop.h
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecTop.h	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecTop.h	(revision 373)
@@ -213,5 +213,5 @@
   TComDepthMapGenerator   m_cDepthMapGenerator;
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
   TComResidualGenerator   m_cResidualGenerator;
 #endif
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 373)
@@ -711,8 +711,11 @@
         WRITE_UVLC( pcSPS->getMultiviewMvPredMode(), "multi_view_mv_pred_mode" );
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
         WRITE_FLAG  ( pcSPS->getMultiviewResPredMode(), "multi_view_residual_pred_mode" );
 #endif
       }
+#endif
+#if QC_ARP_D0177
+      WRITE_FLAG( pcSPS->getUseAdvRP () ? 1 : 0,       "advanced_residual_pred_flag"  );
 #endif
     }
@@ -1321,5 +1324,10 @@
 }
 #endif
-
+#if QC_ARP_D0177
+Void TEncCavlc::codeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx )
+{
+  assert( false );
+}
+#endif
 Void TEncCavlc::codeAlfCtrlFlag( TComDataCU* pcCU, UInt uiAbsPartIdx )
 {  
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncCavlc.h
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncCavlc.h	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncCavlc.h	(revision 373)
@@ -160,4 +160,7 @@
   Void codeResPredFlag   ( TComDataCU* pcCU, UInt uiAbsPartIdx );
 #endif
+#if QC_ARP_D0177
+  virtual Void codeARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx );
+#endif
   Void codeAlfCtrlFlag   ( TComDataCU* pcCU, UInt uiAbsPartIdx );
 
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncCfg.h
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncCfg.h	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncCfg.h	(revision 373)
@@ -333,5 +333,10 @@
 #endif
 #if H3D_IVRP
+#if QC_ARP_D0177
+  UInt      m_nUseAdvResPred;
+  UInt      m_nARPStepNum;
+#else
   UInt        m_uiMultiviewResPredMode;
+#endif
 #endif
 
@@ -414,5 +419,12 @@
 #endif
 #if H3D_IVRP
+#if QC_ARP_D0177
+  UInt       getUseAdvRP                    ()                  { return m_nUseAdvResPred; }
+  Void       setUseAdvRP                    ( UInt  u )         { m_nUseAdvResPred = u;    }
+  UInt       getARPStepNum                  ()                  { return m_nARPStepNum;    }
+  Void       setARPStepNum                  ( UInt  u )         { m_nARPStepNum = u;       }
+#else
   Void      setMultiviewResPredMode         ( UInt  u )      { m_uiMultiviewResPredMode     = u; }
+#endif
 #endif
   
@@ -809,4 +821,5 @@
   Int       getViewOrderIdx                 ()      { return  m_iViewOrderIdx; }    // will be changed to view_id
 #endif
+
 };
 
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncCu.cpp
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncCu.cpp	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncCu.cpp	(revision 373)
@@ -64,5 +64,7 @@
   m_ppcBestCU      = new TComDataCU*[m_uhTotalDepth-1];
   m_ppcTempCU      = new TComDataCU*[m_uhTotalDepth-1];
-  
+#if QC_ARP_D0177
+  m_ppcWeightedTempCU = new TComDataCU*[m_uhTotalDepth-1];
+#endif 
   m_ppcPredYuvBest = new TComYuv*[m_uhTotalDepth-1];
   m_ppcResiYuvBest = new TComYuv*[m_uhTotalDepth-1];
@@ -91,5 +93,7 @@
     m_ppcBestCU[i] = new TComDataCU; m_ppcBestCU[i]->create( uiNumPartitions, uiWidth, uiHeight, false, uiMaxWidth >> (m_uhTotalDepth - 1) );
     m_ppcTempCU[i] = new TComDataCU; m_ppcTempCU[i]->create( uiNumPartitions, uiWidth, uiHeight, false, uiMaxWidth >> (m_uhTotalDepth - 1) );
-    
+#if QC_ARP_D0177
+    m_ppcWeightedTempCU[i] = new TComDataCU; m_ppcWeightedTempCU[i]->create( uiNumPartitions, uiWidth, uiHeight, false, uiMaxWidth >> (m_uhTotalDepth - 1) );
+#endif    
     m_ppcPredYuvBest[i] = new TComYuv; m_ppcPredYuvBest[i]->create(uiWidth, uiHeight);
     m_ppcResiYuvBest[i] = new TComYuv; m_ppcResiYuvBest[i]->create(uiWidth, uiHeight);
@@ -170,4 +174,10 @@
     {
       m_ppcResPredTmp [i]->destroy(); delete m_ppcResPredTmp[i];  m_ppcResPredTmp[i] = NULL;
+    }
+#endif
+#if QC_ARP_D0177
+    if(m_ppcWeightedTempCU[i])
+    {
+      m_ppcWeightedTempCU[i]->destroy(); delete m_ppcWeightedTempCU[i]; m_ppcWeightedTempCU[i] = NULL;
     }
 #endif
@@ -596,5 +606,9 @@
       if( rpcTempCU->getSlice()->getSliceType() != I_SLICE )
       {
+#if QC_ARP_D0177
+        if(( rpcTempCU->getSlice()->getSPS()->getMultiviewMvPredMode() || rpcTempCU->getSlice()->getSPS()->getUseAdvRP()) && rpcTempCU->getSlice()->getViewId())
+#else
         if(( rpcTempCU->getSlice()->getSPS()->getMultiviewMvPredMode() || rpcTempCU->getSlice()->getSPS()->getMultiviewResPredMode()) && rpcTempCU->getSlice()->getViewId())
+#endif
         {  
           PartSize ePartTemp = rpcTempCU->getPartitionSize(0);
@@ -624,6 +638,17 @@
       {
 #if H3D_IVRP
+#if QC_ARP_D0177
+        Bool  bResPredAvailable   = false;
+        Bool  bResPredAllowed     =                    (!rpcBestCU->getSlice()->getSPS()->isDepth                () );
+        bResPredAllowed           = bResPredAllowed && ( rpcBestCU->getSlice()->getSPS()->getViewId              () );
+        if( bResPredAllowed )
+        {
+          bResPredAvailable       = rpcBestCU->getResidualSamples( 0, true, m_ppcResPredTmp[uiDepth] );
+        }
+        for( UInt uiResPrdId = 0; uiResPrdId < (rpcBestCU->getSlice()->getSPS()->getUseAdvRP()? 1: ( bResPredAvailable ? 2 : 1 )); uiResPrdId++ )
+#else
         Bool  bResPredAvailable   = false;
         UInt uiResPrdId = 0; 
+#endif
         {
           Bool bResPredFlag  = ( uiResPrdId > 0 );
@@ -743,6 +768,17 @@
       {
 #if H3D_IVRP
+#if QC_ARP_D0177
+        Bool  bResPredAvailable   = false;
+        Bool  bResPredAllowed     =                    (!rpcBestCU->getSlice()->getSPS()->isDepth                () );
+        bResPredAllowed           = bResPredAllowed && ( rpcBestCU->getSlice()->getSPS()->getViewId              () );
+        if( bResPredAllowed )
+        {
+          bResPredAvailable       = rpcBestCU->getResidualSamples( 0, true, m_ppcResPredTmp[uiDepth] );
+        }
+        for( UInt uiResPrdId = 0; uiResPrdId < (rpcBestCU->getSlice()->getSPS()->getUseAdvRP()? 1: ( bResPredAvailable ? 2 : 1 )); uiResPrdId++ )
+#else
         Bool  bResPredAvailable   = false;
         UInt uiResPrdId = 0; 
+#endif
         {
           Bool bResPredFlag  = ( uiResPrdId > 0 );
@@ -1795,4 +1831,7 @@
         );
 #endif
+#if QC_ARP_D0177
+    m_pcEntropyCoder->encodeARPW( pcCU , uiAbsPartIdx, 0, uiDepth);
+#endif
     finishCU(pcCU,uiAbsPartIdx,uiDepth);
     return;
@@ -1861,4 +1900,8 @@
   Int numValidMergeCand = 0;
 
+#if QC_ARP_D0177
+  Bool  bResPrdAvail  = rpcTempCU->getResPredAvail( 0 );
+  Bool  bResPrdFlag   = rpcTempCU->getResPredFlag ( 0 );
+#endif
 #if LGE_ILLUCOMP_B0045
   Bool  bICFlag = rpcTempCU->getICFlag(0);
@@ -1893,10 +1936,16 @@
   rpcTempCU->getInterMergeCandidates( 0, 0, uhDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
   Bool bResPredAvail = rpcTempCU->getResPredAvail(0);
 #endif
 
   Bool bestIsSkip = false;
-  
+#if QC_ARP_D0177
+  Int nGRPW = rpcTempCU->getSlice()->getARPStepNum() - 1;
+  if(nGRPW < 0 || !bResPrdAvail )
+    nGRPW = 0;
+  for( ; nGRPW >= 0 ; nGRPW-- )
+  {
+#endif  
   for( UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand )
   {
@@ -1932,4 +1981,8 @@
           rpcTempCU->setPredModeSubParts( MODE_SKIP, 0, uhDepth ); // interprets depth relative to LCU level
           rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level
+#if QC_ARP_D0177
+          if(rpcTempCU->getSlice()->getSPS()->getUseAdvRP())
+            rpcTempCU->setARPWSubParts( ( UChar )nGRPW , 0 , uhDepth );
+#endif
           rpcTempCU->setMergeFlagSubParts( true, 0, 0, uhDepth ); // interprets depth relative to LCU level
           rpcTempCU->setMergeIndexSubParts( uiMergeCand, 0, 0, uhDepth ); // interprets depth relative to LCU level
@@ -1955,10 +2008,31 @@
 
 #if H3D_IVRP
+#if !QC_ARP_D0177
           rpcTempCU->setResPredAvailSubParts(bResPredAvail, 0, 0, uhDepth);
+#else
+          rpcTempCU->setResPredAvailSubParts( bResPrdAvail, 0, 0, uhDepth );
+          rpcTempCU->setResPredFlagSubParts ( bResPrdFlag,  0, 0, uhDepth );
+#endif  
 #endif
 #if LGE_ILLUCOMP_B0045
           rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uhDepth);
 #endif
-
+#if QC_ARP_D0177
+          if(rpcTempCU->getSlice()->getSPS()->getUseAdvRP())
+          {
+            bool bSignalflag[2] = {true, true};
+            for(UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx ++ )
+            {
+              Int iRefIdx = cMvFieldNeighbours[uiRefListIdx + 2*uiMergeCand].getRefIdx();
+              RefPicList eRefList = uiRefListIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
+              if(iRefIdx < 0 || rpcTempCU->getSlice()->getPOC() == rpcTempCU->getSlice()->getRefPOC(eRefList, iRefIdx))
+                bSignalflag[uiRefListIdx] = false;
+            }
+            if(!bSignalflag[0]&& !bSignalflag[1])
+            {
+              rpcTempCU->setARPWSubParts( 0 , 0 , uhDepth );
+            }
+          }
+#endif
           // do MC
 #if HHI_INTERVIEW_SKIP
@@ -1973,5 +2047,5 @@
             m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] );
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
             if (uiMergeCand == 0 && rpcTempCU->getResPredAvail(0))
             {
@@ -1992,5 +2066,5 @@
               m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] );
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
               if (uiMergeCand == 0 && rpcTempCU->getResPredAvail(0))
               {
@@ -2049,4 +2123,7 @@
     }
   }
+#if QC_ARP_D0177
+  }
+#endif
 }
 
@@ -2066,5 +2143,17 @@
 {
   UChar uhDepth = rpcTempCU->getDepth( 0 );
-  
+#if QC_ARP_D0177
+  Bool bFirstTime = true;
+  Int nARPWMax = rpcTempCU->getSlice()->getARPStepNum() - 1;
+  if(nARPWMax < 0 || !rpcTempCU->getResPredAvail( 0 ) )
+    nARPWMax = 0;
+  if( ePartSize != SIZE_2Nx2N)
+    nARPWMax = 0;
+  Int nARPWStart = 0 , nARPWStep = 1;
+  for( Int nCount = 0 , nGRPW = nARPWStart ; nCount <= nARPWMax ; nCount++ , nGRPW += nARPWStep )
+  {
+    if( bFirstTime == false && rpcTempCU->getSlice()->getSPS()->getUseAdvRP() )
+      rpcTempCU->initEstData( rpcTempCU->getDepth(0), rpcTempCU->getQP(0) );
+#endif  
 #if HHI_VSO
   if( m_pcRdCost->getUseRenModel() )
@@ -2093,4 +2182,37 @@
   rpcTempCU->setPredModeSubParts  ( MODE_INTER, 0, uhDepth );
 
+#if QC_ARP_D0177
+  if(rpcTempCU->getSlice()->getSPS()->getUseAdvRP())
+    rpcTempCU->setARPWSubParts( ( UChar )nGRPW , 0 , uhDepth );
+#endif
+#if QC_ARP_D0177
+  if( bFirstTime == false && rpcTempCU->getSlice()->getSPS()->getUseAdvRP())
+  {
+    assert(!rpcTempCU->getSlice()->getSPS()->isDepth());
+    rpcTempCU->copyPartFrom( m_ppcWeightedTempCU[uhDepth] , 0 , uhDepth, true );
+    rpcTempCU->setARPWSubParts( ( UChar )nGRPW , 0 , uhDepth );
+#if MERL_VSP_C0152
+    m_pcPredSearch->motionCompensation( rpcTempCU , m_ppcPredYuvTemp[uhDepth], 0);
+#else
+    m_pcPredSearch->motionCompensation( rpcTempCU , m_ppcPredYuvTemp[uhDepth] );
+#endif
+    if(rpcTempCU->getPartitionSize(0)==SIZE_2Nx2N)
+    {
+      bool bSignalflag[2] = {true, true};
+      for(UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx ++ )
+      {
+        RefPicList eRefList = uiRefListIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
+        Int iRefIdx = rpcTempCU->getCUMvField(eRefList)->getRefIdx(0);
+        if(iRefIdx < 0 || rpcTempCU->getSlice()->getPOC() == rpcTempCU->getSlice()->getRefPOC(eRefList, iRefIdx))
+          bSignalflag[uiRefListIdx] = false;
+      }
+      if(!bSignalflag[0]&& !bSignalflag[1])
+        rpcTempCU->setARPWSubParts( 0 , 0 , uhDepth );
+    }
+  }
+  else
+  {
+    bFirstTime = false;
+#endif
 #if AMP_MRG
   rpcTempCU->setMergeAMP (true);
@@ -2107,8 +2229,33 @@
 #endif
 #endif
+#if QC_ARP_D0177
+   if(rpcTempCU->getSlice()->getSPS()->getUseAdvRP())
+   {
+     m_ppcWeightedTempCU[uhDepth]->copyPartFrom( rpcTempCU , 0 , uhDepth );
+     if(rpcTempCU->getSlice()->getSPS()->getUseAdvRP() && rpcTempCU->getPartitionSize(0)==SIZE_2Nx2N)
+     {
+       bool bSignalflag[2] = {true, true};
+       for(UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx ++ )
+       {
+         RefPicList eRefList = uiRefListIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
+         Int iRefIdx = rpcTempCU->getCUMvField(eRefList)->getRefIdx(0);
+         if(iRefIdx < 0 || rpcTempCU->getSlice()->getPOC() == rpcTempCU->getSlice()->getRefPOC(eRefList, iRefIdx))
+           bSignalflag[uiRefListIdx] = false;
+       }
+       if(!bSignalflag[0]&& !bSignalflag[1])
+         rpcTempCU->setARPWSubParts( 0 , 0 , uhDepth );
+     }
+   }
+  }
+#endif
 
 #if AMP_MRG
   if ( !rpcTempCU->getMergeAMP() )
   {
+#if QC_ARP_D0177
+    if(rpcTempCU->getSlice()->getSPS()->getUseAdvRP())
+      continue;
+    else
+#endif
     return;
   }
@@ -2151,4 +2298,7 @@
   xCheckDQP( rpcTempCU );
   xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
+#if QC_ARP_D0177
+  }
+#endif
 }
 
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncCu.h
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncCu.h	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncCu.h	(revision 373)
@@ -69,4 +69,7 @@
   TComDataCU**            m_ppcBestCU;      ///< Best CUs in each depth
   TComDataCU**            m_ppcTempCU;      ///< Temporary CUs in each depth
+#if QC_ARP_D0177
+  TComDataCU**            m_ppcWeightedTempCU;   
+#endif
   UChar                   m_uhTotalDepth;
   
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncEntropy.cpp
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 373)
@@ -456,4 +456,34 @@
 
 
+#if QC_ARP_D0177
+Void TEncEntropy::encodeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD, UInt uiDepth)
+{
+  if( pcCU->getSlice()->getViewId() == 0 || pcCU->getSlice()->getIsDepth() == true || !pcCU->getSlice()->getARPStepNum() )
+  {
+    return;
+  }
+  assert( pcCU->isIntra( uiAbsPartIdx ) == false );
+  if( bRD )
+  {
+    uiAbsPartIdx = 0;
+  }
+  bool bSignalflag[2] = {true, true};
+  if (!(pcCU->getPartitionSize(uiAbsPartIdx)==SIZE_2Nx2N || pcCU->isSkipped(uiAbsPartIdx)))
+  {
+    assert(pcCU->getARPW (uiAbsPartIdx) == 0);
+    bSignalflag[0] = false;
+    bSignalflag[1] = false;
+ }
+  if (!(bSignalflag[0]|| bSignalflag[1]))
+  {
+    assert(pcCU->getARPW (uiAbsPartIdx) == 0);
+    if (uiDepth != -1)
+      pcCU->setARPWSubParts(0, uiAbsPartIdx, uiDepth);
+  }
+  else
+     m_pcEntropyCoderIf->codeARPW( pcCU, uiAbsPartIdx );
+ 
+}
+#endif
 /** parse the fixed length code (smaller than one max value) in ALF
  * \param run: coded value
@@ -1233,4 +1263,7 @@
   {
     encodePUWise( pcCU, uiAbsPartIdx, bRD );
+#if QC_ARP_D0177
+    encodeARPW( pcCU , uiAbsPartIdx , bRD );
+#endif
   }
 }
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncEntropy.h
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncEntropy.h	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncEntropy.h	(revision 373)
@@ -117,4 +117,7 @@
   virtual Void codeResPredFlag   ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
 #endif
+#if QC_ARP_D0177
+  virtual Void codeARPW         ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
+#endif
   virtual Void codeSplitFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
   
@@ -250,4 +253,7 @@
   Void encodeMergeFlag    ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPUIdx );
   Void encodeMergeIndex   ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPUIdx, Bool bRD = false );
+#if QC_ARP_D0177
+  Void encodeARPW              ( TComDataCU* pcCU, UInt uiAbspartIdx , Bool bRD = false, UInt uiDepth = -1);
+#endif
   Void encodeAlfCtrlFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
 
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 373)
@@ -78,5 +78,5 @@
   m_pcDepthMapGenerator = NULL;
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
   m_pcResidualGenerator = NULL;
 #endif
@@ -131,5 +131,5 @@
   m_pcDepthMapGenerator  = pcTEncTop->getDepthMapGenerator();
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
   m_pcResidualGenerator  = pcTEncTop->getResidualGenerator();
 #endif
@@ -390,5 +390,12 @@
       std::vector<TComPic*> apcInterViewRefPics = tAppEncTop->getInterViewRefPics( m_pcEncTop->getViewId(), pcSlice->getPOC(), m_pcEncTop->getIsDepth(), pcSlice->getSPS() );
       pcSlice->setRefPicListMvc( rcListPic, apcInterViewRefPics );
-
+#if QC_ARP_D0177
+      pcSlice->setARPStepNum();
+      if(pcSlice->getARPStepNum() > 1)
+      {
+        for(Int iViewIdx = 0; iViewIdx < pcSlice->getViewId(); iViewIdx ++ )
+          pcSlice->setBaseViewRefPicList( tAppEncTop->getTEncTop( iViewIdx , false )->getListPic(), iViewIdx );
+      }
+#endif
       //  Slice info. refinement
       if( pcSlice->getSliceType() == B_SLICE )
@@ -754,5 +761,5 @@
       m_pcDepthMapGenerator->covertOrgDepthMap( pcPic );
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
       m_pcResidualGenerator->initViewComponent( pcPic );
 #endif
@@ -818,5 +825,5 @@
       pcSlice = pcPic->getSlice(0);
 
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
       // set residual picture
       m_pcResidualGenerator->setRecResidualPic( pcPic );
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncGOP.h
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncGOP.h	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncGOP.h	(revision 373)
@@ -97,5 +97,5 @@
   TComDepthMapGenerator*  m_pcDepthMapGenerator;
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
   TComResidualGenerator*  m_pcResidualGenerator;
 #endif
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncSbac.cpp
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 373)
@@ -72,4 +72,7 @@
 #if H3D_IVRP
 , m_cResPredFlagSCModel       ( 1,             1,               NUM_RES_PRED_FLAG_CTX         , m_contextModels + m_numContextModels, m_numContextModels)
+#endif
+#if QC_ARP_D0177
+, m_cCUPUARPW                 ( 1,             1,               NUM_ARPW_CTX                 , m_contextModels + m_numContextModels, m_numContextModels)
 #endif
 , m_cCUPartSizeSCModel        ( 1,             1,               NUM_PART_SIZE_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
@@ -158,4 +161,7 @@
   m_cResPredFlagSCModel.initBuffer       ( eSliceType, iQp, (UChar*)INIT_RES_PRED_FLAG );
 #endif
+#if QC_ARP_D0177
+  m_cCUPUARPW.initBuffer                 ( eSliceType, iQp, (UChar*)INIT_ARPW );
+#endif
   m_cCUPartSizeSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_PART_SIZE );
   m_cCUAMPSCModel.initBuffer             ( eSliceType, iQp, (UChar*)INIT_CU_AMP_POS );
@@ -311,4 +317,7 @@
   m_cResPredFlagSCModel.initBuffer       ( eSliceType, iQp, (UChar*)INIT_RES_PRED_FLAG );
 #endif
+#if QC_ARP_D0177
+  m_cCUPUARPW.initBuffer                 ( eSliceType, iQp, (UChar*)INIT_ARPW );
+#endif
   m_cCUPartSizeSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_PART_SIZE );
   m_cCUAMPSCModel.initBuffer             ( eSliceType, iQp, (UChar*)INIT_CU_AMP_POS );
@@ -840,5 +849,22 @@
 }
 #endif
-
+#if QC_ARP_D0177
+Void TEncSbac::codeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx )
+{
+  Int nW = pcCU->getARPW( uiAbsPartIdx );
+  Int nMaxW = pcCU->getSlice()->getARPStepNum() - 1;
+  assert( 0 <= nW && nW <= nMaxW );
+  assert(nMaxW > 0);
+  if( nMaxW > 0 )
+  {
+    Int nOffset = pcCU->getCTXARPWFlag(uiAbsPartIdx);
+    assert( 0 <= nOffset && nOffset <= 2 );
+    Int nBinNum = nW + ( nW != nMaxW );
+    m_pcBinIf->encodeBin( nW != 0 , m_cCUPUARPW.get( 0, 0, 0 + nOffset ) );
+    if( nBinNum > 1 )
+       m_pcBinIf->encodeBin( nW == nMaxW , m_cCUPUARPW.get( 0, 0, 3 ) );
+  }
+}
+#endif
 Void TEncSbac::codeSplitFlag   ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
 {
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncSbac.h
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncSbac.h	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncSbac.h	(revision 373)
@@ -209,4 +209,7 @@
   Void codeResPredFlag   ( TComDataCU* pcCU, UInt uiAbsPartIdx );
 #endif
+#if QC_ARP_D0177
+  virtual Void codeARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx );
+#endif
   Void codeSplitFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
 #if H3D_IVMP
@@ -265,4 +268,7 @@
 #if H3D_IVRP
   ContextModel3DBuffer m_cResPredFlagSCModel;
+#endif
+#if QC_ARP_D0177
+  ContextModel3DBuffer m_cCUPUARPW;
 #endif
   ContextModel3DBuffer m_cCUPartSizeSCModel;
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 373)
@@ -4674,4 +4674,7 @@
 #endif
       );
+#if QC_ARP_D0177
+    m_pcEntropyCoder->encodeARPW       ( pcCU , 0 , true );
+#endif
 #endif
 #if HHI_MPI
@@ -5954,4 +5957,7 @@
       );
 #endif
+#if QC_ARP_D0177
+    m_pcEntropyCoder->encodeARPW( pcCU , 0 , true );
+#endif
     ruiBits += m_pcEntropyCoder->getNumberOfWrittenBits();
   }
@@ -5977,4 +5983,7 @@
 #endif
       );
+#if QC_ARP_D0177
+    m_pcEntropyCoder->encodeARPW( pcCU , 0 , true );
+#endif
 #endif
 #if HHI_MPI
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncTop.cpp
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncTop.cpp	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncTop.cpp	(revision 373)
@@ -120,5 +120,5 @@
   m_cDepthMapGenerator. create( false, getSourceWidth(), getSourceHeight(), g_uiMaxCUDepth, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiBitDepth + g_uiBitIncrement, PDM_SUB_SAMP_EXP_X(m_uiPredDepthMapGeneration), PDM_SUB_SAMP_EXP_Y(m_uiPredDepthMapGeneration) );
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
   m_cResidualGenerator. create( false, getSourceWidth(), getSourceHeight(), g_uiMaxCUDepth, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiBitDepth + g_uiBitIncrement );
 #endif
@@ -251,5 +251,5 @@
   m_cDepthMapGenerator. destroy();
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
   m_cResidualGenerator. destroy();
 #endif
@@ -347,5 +347,5 @@
 #endif
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
   m_cResidualGenerator.init( &m_cTrQuant, &m_cDepthMapGenerator );
 #endif
@@ -722,6 +722,12 @@
 #endif
 #if H3D_IVRP
+#if QC_ARP_D0177
+    m_cSPS.setUseAdvRP              ( 0 );
+    m_cSPS.setARPStepNum            ( 1 );
+#else
     m_cSPS.setMultiviewResPredMode  ( 0 );
 #endif
+#endif
+
   }
   else
@@ -742,5 +748,10 @@
 #endif
 #if H3D_IVRP
-      m_cSPS.setMultiviewResPredMode  ( m_uiMultiviewResPredMode );
+#if QC_ARP_D0177
+     m_cSPS.setUseAdvRP  ( m_viewId > 0   ? m_nUseAdvResPred : 0 );
+     m_cSPS.setARPStepNum( m_viewId > 0   ? QC_ARP_WFNR      : 1 );
+#else
+     m_cSPS.setMultiviewResPredMode  ( m_uiMultiviewResPredMode );
+#endif
 #endif
     }
@@ -751,5 +762,10 @@
 #endif
 #if H3D_IVRP
+#if QC_ARP_D0177
+      m_cSPS.setUseAdvRP              ( 0 );
+      m_cSPS.setARPStepNum            ( 1 );
+#else
       m_cSPS.setMultiviewResPredMode  ( 0 );
+#endif
 #endif
     }
Index: /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncTop.h
===================================================================
--- /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncTop.h	(revision 372)
+++ /branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibEncoder/TEncTop.h	(revision 373)
@@ -103,5 +103,5 @@
   TComDepthMapGenerator   m_cDepthMapGenerator;           ///< depth map generator
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
   TComResidualGenerator   m_cResidualGenerator;           ///< generator for residual pictures
 #endif
@@ -234,5 +234,5 @@
   TComDepthMapGenerator*  getDepthMapGenerator  () { return  &m_cDepthMapGenerator;   }
 #endif
-#if H3D_IVRP
+#if H3D_IVRP & !QC_ARP_D0177
   TComResidualGenerator*  getResidualGenerator  () { return  &m_cResidualGenerator;   }
 #endif
