Index: /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TComDataCU.cpp	(revision 1209)
+++ /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TComDataCU.cpp	(revision 1210)
@@ -125,5 +125,5 @@
   m_bDecSubCu          = false;
 
-#if H_3D_NBDV
+#if NH_3D_NBDV
   m_pDvInfo              = NULL;
 #endif
@@ -208,5 +208,5 @@
     }
 
-#if H_3D_NBDV 
+#if NH_3D_NBDV 
     m_pDvInfo            = (DisInfo* )xMalloc(DisInfo,  uiNumPartition);
 #endif
@@ -463,5 +463,5 @@
       m_acCUMvField[rpl].destroy();
     }
-#if H_3D_NBDV 
+#if NH_3D_NBDV 
     if ( m_pDvInfo            ) { xFree(m_pDvInfo);             m_pDvInfo           = NULL; }
 #endif
@@ -1078,5 +1078,5 @@
   m_pePredMode=pcCU->getPredictionMode()  + uiPart;
   m_CUTransquantBypass  = pcCU->getCUTransquantBypass()+uiPart;
-#if H_3D_NBDV
+#if NH_3D_NBDV
   m_pDvInfo             = pcCU->getDvInfo()           + uiPart;
 #endif
@@ -1177,5 +1177,5 @@
 }
 
-#if H_3D_NBDV
+#if NH_3D_NBDV
 Void TComDataCU::copyDVInfoFrom (TComDataCU* pcCU, UInt uiAbsPartIdx)
 {
@@ -1186,5 +1186,5 @@
 // Copy inter prediction info from the biggest CU
 Void TComDataCU::copyInterPredInfoFrom    ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList 
-#if H_3D_NBDV
+#if NH_3D_NBDV
   , Bool bNBDV
 #endif
@@ -1217,5 +1217,5 @@
 
   m_pePartSize         = pcCU->getPartitionSize ()        + uiAbsPartIdx;
-#if H_3D_NBDV
+#if NH_3D_NBDV
   if(bNBDV == true)
   {
@@ -1256,5 +1256,5 @@
 
   m_acCUMvField[ eRefPicList ].linkToWithOffset( pcCU->getCUMvField(eRefPicList), uiAbsPartIdx );
-#if H_3D_NBDV
+#if NH_3D_NBDV
   }
 #endif
@@ -1413,6 +1413,6 @@
 
   memcpy( pCtu->getQP() + m_absZIdxInCtu, m_phQP, sizeInChar  );
-#if H_3D_NBDV
-  memcpy( rpcCU->getDvInfo()         + m_uiAbsIdxInLCU, m_pDvInfo,    sizeof(* m_pDvInfo)     * m_uiNumPartition );
+#if NH_3D_NBDV
+  memcpy( pCtu->getDvInfo() + m_absZIdxInCtu, m_pDvInfo, sizeof(* m_pDvInfo) * m_uiNumPartition );
 #endif
 
@@ -3120,5 +3120,5 @@
         predFlag[iRefListIdX] = 1;
         mvVSP[0+iRefListIdX].setMvField( pDInfo->m_acNBDV, i );
-#if H_3D_NBDV
+#if NH_3D_NBDV
         mvVSP[0+iRefListIdX].getMv().setIDVFlag (false);
 #endif
@@ -3172,5 +3172,5 @@
       if(!bRemove)
       {
-#if H_3D_NBDV
+#if NH_3D_NBDV
         if(iLoop) // For IvMcShift candidate
         {
@@ -3539,5 +3539,5 @@
       puhInterDirNeighbours[uiArrayAddr] = dir;
       abCandIsInter[uiArrayAddr] = true;
-#if H_3D_NBDV
+#if NH_3D_NBDV
       pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
       pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
@@ -3711,5 +3711,5 @@
 
 #if H_3D
-#if H_3D_NBDV
+#if NH_3D_NBDV
   for(Int i = 0; i < MRG_MAX_NUM_CANDS_MEM; i++)  
   {
@@ -4251,5 +4251,5 @@
     if(!bRemoveSpa)
     {
-#if H_3D_NBDV
+#if NH_3D_NBDV
       tmpMV[0].getMv().setIDVFlag (false);
       tmpMV[1].getMv().setIDVFlag (false);
@@ -5758,5 +5758,5 @@
 }
 #endif
-#if H_3D_NBDV 
+#if NH_3D_NBDV 
 //Notes from QC:
 //TBD#1: DoNBDV related contributions are just partially integrated under the marco of H_3D_NBDV_REF, remove this comment once DoNBDV and BVSP are done
@@ -5810,5 +5810,5 @@
     ///*** Derive center position ***
     UInt uiPartIdxCenter;
-    Int  uiLCUIdx   = getAddr();
+    Int  uiLCUIdx = getCtuRsAddr();
     xDeriveCenterIdx(uiPartIdx, uiPartIdxCenter );
 
@@ -5883,5 +5883,5 @@
   if(pcTmpCU != NULL )
   {
-    bCheckMcpDv = ( ( getAddr() - pcTmpCU->getAddr() ) == 0);
+    bCheckMcpDv = ( ( getCtuRsAddr() - pcTmpCU->getCtuRsAddr() ) == 0);
     if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, pDInfo, bCheckMcpDv, &cIDVInfo, DVFROM_ABOVE
 #if H_3D_NBDV_REF
@@ -6080,6 +6080,6 @@
 {
   UInt uiPartIdx = 0;
-  UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();  
-  Int uiLCUIdx = getAddr();
+  UInt uiNumPartInCUWidth = m_pcPic->getNumPartInCtuWidth();  
+  Int uiLCUIdx = getCtuRsAddr();
 
   UInt uiPartIdxRB;
@@ -6087,10 +6087,10 @@
   UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];
 
-  if (( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() )>= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )
+  if (( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() )>= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )
   {
     riLCUIdxRBNb  = -1;
     riPartIdxRBNb = -1;
   }
-  else if(( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() )>= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
+  else if(( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() )>= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
   {
     riLCUIdxRBNb  = -1;
@@ -6100,5 +6100,5 @@
   {
     if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) &&           // is not at the last column of LCU 
-      ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row    of LCU
+      ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInCtuHeight() - 1 ) ) // is not at the last row    of LCU
     {
       riPartIdxRBNb = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ];
@@ -6110,5 +6110,5 @@
       riLCUIdxRBNb  = -1;
     }
-    else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
+    else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInCtuHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
     {
       riPartIdxRBNb = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ];
@@ -6126,5 +6126,5 @@
 Void TComDataCU::setDvInfoSubParts( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiDepth )
 {
-  UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1);
+  UInt uiCurrPartNumb = m_pcPic->getNumPartInCtuWidth() >> (uiDepth << 1);
   for (UInt ui = 0; ui < uiCurrPartNumb; ui++ )
   {
@@ -6145,7 +6145,7 @@
   Int iColViewIdx, iColRefViewIdx;
   TComPic *pColPic = getSlice()->getRefPic( eRefPicList, refidx);
-  TComDataCU *pColCU = pColPic->getCU( uiCUAddr );
+  TComDataCU *pColCU = pColPic->getCtu( uiCUAddr );
   iColViewIdx = pColCU->getSlice()->getViewIndex();
-  if (pColCU->getPic()==0||pColCU->getPartitionSize(uiPartUnitIdx)==SIZE_NONE||pColCU->isIntra(uiPartUnitIdx))
+  if (pColCU->getPic()==0||pColCU->getPartitionSize(uiPartUnitIdx)==NUMBER_OF_PART_SIZES||pColCU->isIntra(uiPartUnitIdx))
   {
     return false;
@@ -6357,5 +6357,5 @@
 
   Bool abPdmAvailable[8] =  {false, false, false, false, false, false, false, false};
-#if H_3D_NBDV
+#if NH_3D_NBDV
   for( Int i = 0; i < 8; i++)
   {
@@ -6433,5 +6433,5 @@
                       abPdmAvailable[ uiCurrRefListId ] = true;
                       TComMv cMv(cDefaultMvField.getHor(), cDefaultMvField.getVer());
-#if H_3D_NBDV 
+#if NH_3D_NBDV 
 #if H_3D_IV_MERGE
                       if( !bIsDepth )
@@ -6590,5 +6590,5 @@
                     abPdmAvailable[ (uiCurrRefListId + (iLoopCan<<2)) ] = true;
                     TComMv cMv(cBaseMvField.getHor(), cBaseMvField.getVer());
-#if H_3D_NBDV 
+#if NH_3D_NBDV 
 #if H_3D_IV_MERGE
                     if( !bIsDepth )
Index: /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TComDataCU.h
===================================================================
--- /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TComDataCU.h	(revision 1209)
+++ /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TComDataCU.h	(revision 1210)
@@ -167,5 +167,5 @@
   Char*         m_apiMVPNum[NUM_REF_PIC_LIST_01];       ///< array of number of possible motion vectors predictors
   Bool*         m_pbIPCMFlag;         ///< array of intra_pcm flags
-#if H_3D_NBDV
+#if NH_3D_NBDV
   DisInfo*      m_pDvInfo;
 #endif
@@ -282,11 +282,11 @@
   Void          initSubCU             ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp );
   Void          setOutsideCUPart      ( UInt uiAbsPartIdx, UInt uiDepth );
-#if H_3D_NBDV
-  Void          copyDVInfoFrom (TComDataCU* pcCU, UInt uiAbsPartIdx);
+#if NH_3D_NBDV
+  Void          copyDVInfoFrom        (TComDataCU* pcCU, UInt uiAbsPartIdx);
 #endif
 
   Void          copySubCU             ( TComDataCU* pcCU, UInt uiPartUnitIdx );
   Void          copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList 
-#if H_3D_NBDV
+#if NH_3D_NBDV
   , Bool bNBDV = false
 #endif
@@ -480,5 +480,5 @@
   Void          setIPCMFlag           (UInt uiIdx, Bool b )     { m_pbIPCMFlag[uiIdx] = b;           }
   Void          setIPCMFlagSubParts   (Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth);
-#if H_3D_NBDV
+#if NH_3D_NBDV
   Void          setDvInfoSubParts     ( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiDepth );
   Void          setDvInfoSubParts     ( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth);
@@ -486,5 +486,5 @@
   DisInfo       getDvInfo             (UInt uiIdx)              { return m_pDvInfo[uiIdx];          }
 #endif
-#if H_3D_NBDV
+#if NH_3D_NBDV
   Void          xDeriveRightBottomNbIdx(Int &uiLCUIdxRBNb, Int &uiPartIdxRBNb );
   Bool          xCheckSpatialNBDV (TComDataCU* pcTmpCU, UInt uiIdx, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, IDVInfo* paMvpDvInfo,
Index: /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TComMotionInfo.h
===================================================================
--- /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TComMotionInfo.h	(revision 1209)
+++ /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TComMotionInfo.h	(revision 1210)
@@ -60,5 +60,5 @@
 } AMVPInfo;
 
-#if H_3D_NBDV
+#if NH_3D_NBDV
 typedef struct _DisCand 
 {
Index: /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TComMv.h
===================================================================
--- /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TComMv.h	(revision 1209)
+++ /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TComMv.h	(revision 1210)
@@ -57,5 +57,5 @@
   Short m_iHor;     ///< horizontal component of motion vector
   Short m_iVer;     ///< vertical component of motion vector
-#if H_3D_NBDV
+#if NH_3D_NBDV
   Bool  m_bIDV;       
   Short m_iIDVHor;    
@@ -72,5 +72,5 @@
   m_iHor(0),
   m_iVer(0)
-#if H_3D_NBDV
+#if NH_3D_NBDV
   , m_bIDV(false)
   , m_iIDVHor(0)
@@ -84,5 +84,5 @@
   m_iHor(iHor),
   m_iVer(iVer)
- #if H_3D_NBDV
+ #if NH_3D_NBDV
   , m_bIDV(false)
   , m_iIDVHor(0)
@@ -101,10 +101,10 @@
   Void  setVer    ( Short i )                   { m_iVer = i;                               }
   Void  setZero   ()                            { m_iHor = m_iVer = 0; 
- #if H_3D_NBDV
+ #if NH_3D_NBDV
    m_bIDV = false; m_iIDVHor = m_iIDVVer = 0;
    m_iIDVVId = 0; 
 #endif
  }
-#if H_3D_NBDV
+#if NH_3D_NBDV
   Void   setIDVHor  (Short i)                    {m_iIDVHor = i;}
   Void   setIDVVer  (Short i)                    {m_iIDVVer = i;}
@@ -120,5 +120,5 @@
   Int   getAbsHor () const { return abs( m_iHor );   }
   Int   getAbsVer () const { return abs( m_iVer );   }
-#if H_3D_NBDV
+#if NH_3D_NBDV
   Short getIDVHor () const { return m_iIDVHor;       }
   Short getIDVVer () const { return m_iIDVVer;       }
Index: /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TComPic.cpp
===================================================================
--- /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TComPic.cpp	(revision 1209)
+++ /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TComPic.cpp	(revision 1210)
@@ -78,5 +78,5 @@
   m_bReduceBitsQTL    = 0;
 #endif
-#if H_3D_NBDV
+#if NH_3D_NBDV
   m_iNumDdvCandPics   = 0;
   m_eRapRefList       = REF_PIC_LIST_0;
@@ -303,6 +303,6 @@
 #endif // NH_MV
 
-#if H_3D_NBDV 
-Int TComPic::getDisCandRefPictures( Int iColPOC )
+#if NH_3D_NBDV 
+Int TComPic::getDisCandRefPictures(Int iColPOC)
 {
   UInt       uiTempLayerCurr = 7;
@@ -310,6 +310,8 @@
   UInt       numDdvCandPics  = 0;
 
-  if ( !currSlice->getEnableTMVPFlag() )
+  if(!currSlice->getEnableTMVPFlag())
+  {
     return numDdvCandPics;
+  }
 
   numDdvCandPics += 1;
@@ -318,18 +320,18 @@
   UInt pocDiff = 255;
 
-  for(UInt lpNr = 0; lpNr < (currSlice->isInterB() ? 2: 1); lpNr ++)
-  {
-    UInt x = lpNr ? currSlice->getColFromL0Flag() : 1 - currSlice->getColFromL0Flag();
-
-    for (UInt i = 0; i < currSlice->getNumRefIdx(RefPicList(x)); i++)
+  for(UInt lpNr = 0; lpNr < (currSlice->isInterB() ? 2: 1); lpNr++)
+  {
+    Bool x = lpNr ? currSlice->getColFromL0Flag() : 1 - currSlice->getColFromL0Flag();
+
+    for(UInt i = 0; i < currSlice->getNumRefIdx(RefPicList(x)); i++)
     {
       if(currSlice->getViewIndex() == currSlice->getRefPic((RefPicList)x, i)->getViewIndex() 
-        && (x == currSlice->getColFromL0Flag()||currSlice->getRefPOC((RefPicList)x, i)!= iColPOC) && numDdvCandPics!=2)
+         && (x == currSlice->getColFromL0Flag() || currSlice->getRefPOC((RefPicList)x, i) != iColPOC) && numDdvCandPics != 2)
       {
         TComSlice* refSlice    = currSlice->getRefPic((RefPicList)x, i)->getSlice(getCurrSliceIdx());
-        Bool       bRAP        = (refSlice->getViewIndex() && refSlice->isIRAP())? 1: 0; 
+        Bool       bRAP        = (refSlice->getViewIndex() && refSlice->isIRAP()) ? 1 : 0; 
         UInt       uiTempLayer = currSlice->getRefPic((RefPicList)x, i)->getSlice(getCurrSliceIdx())->getTLayer(); 
         
-        if( bRAP )
+        if(bRAP)
         {
           this->setRapRefIdx(i);
@@ -350,15 +352,15 @@
   UInt idx = 0;
   
-  for(UInt lpNr = 0; lpNr < (currSlice->isInterB() ? 2: 1); lpNr ++)
-  {
-    UInt x = lpNr? currSlice->getColFromL0Flag() : 1-currSlice->getColFromL0Flag();
+  for(UInt lpNr = 0; lpNr < (currSlice->isInterB() ? 2 : 1); lpNr++)
+  {
+    Bool x = lpNr ? currSlice->getColFromL0Flag() : 1 - currSlice->getColFromL0Flag();
     
-    for (UInt i = 0; i < currSlice->getNumRefIdx(RefPicList(x)); i++)
+    for(UInt i = 0; i < currSlice->getNumRefIdx(RefPicList(x)); i++)
     {
       Int iTempPoc = currSlice->getRefPic((RefPicList)x, i)->getPOC();
-      Int iTempDiff = (iTempPoc > pocCurr) ? (iTempPoc - pocCurr): (pocCurr - iTempPoc);
+      Int iTempDiff = (iTempPoc > pocCurr) ? (iTempPoc - pocCurr) : (pocCurr - iTempPoc);
       
-      if(currSlice->getViewIndex() == currSlice->getRefPic((RefPicList)x, i)->getViewIndex() &&  (x == currSlice->getColFromL0Flag()||currSlice->getRefPOC((RefPicList)x, i)!= iColPOC) 
-        && currSlice->getRefPic((RefPicList)x, i)->getSlice(getCurrSliceIdx())->getTLayer() == uiTempLayerCurr && pocDiff > iTempDiff)
+      if(currSlice->getViewIndex() == currSlice->getRefPic((RefPicList)x, i)->getViewIndex() && (x == currSlice->getColFromL0Flag() || currSlice->getRefPOC((RefPicList)x, i) != iColPOC) 
+         && currSlice->getRefPic((RefPicList)x, i)->getSlice(getCurrSliceIdx())->getTLayer() == uiTempLayerCurr && pocDiff > iTempDiff)
       {
         pocDiff = iTempDiff;
@@ -369,8 +371,8 @@
   }
 
-  if( pocDiff < 255 )
+  if(pocDiff < 255)
   {
     this->setRapRefIdx(idx);
-    this->setRapRefList((RefPicList) z );
+    this->setRapRefList((RefPicList) z);
     numDdvCandPics = 2;
   }
@@ -383,11 +385,12 @@
   TComSlice* currSlice = getSlice(getCurrSliceIdx());
   const Int numCandPics = this->getNumDdvCandPics();
+
   for(Int curCandPic = 0; curCandPic < numCandPics; curCandPic++)
   {
     RefPicList eCurRefPicList   = REF_PIC_LIST_0 ;
     Int        curCandPicRefIdx = 0;
-    if( curCandPic == 0 ) 
+    if(curCandPic == 0) 
     { 
-      eCurRefPicList   = RefPicList(currSlice->isInterB() ? 1-currSlice->getColFromL0Flag() : 0);
+      eCurRefPicList   = RefPicList(currSlice->isInterB() ? 1 - currSlice->getColFromL0Flag() : 0);
       curCandPicRefIdx = currSlice->getColRefIdx();
     }
@@ -397,24 +400,27 @@
       curCandPicRefIdx = this->getRapRefIdx();
     }
-    TComPic* pcCandColPic = currSlice->getRefPic( eCurRefPicList, curCandPicRefIdx);
-    TComSlice* pcCandColSlice = pcCandColPic->getSlice(0);// currently only support single slice
+
+    TComPic* pcCandColPic = currSlice->getRefPic(eCurRefPicList, curCandPicRefIdx);
+    TComSlice* pcCandColSlice = pcCandColPic->getSlice(0); // currently only support single slice
 
     if(!pcCandColSlice->isIntra())
     {
-      for( Int iColRefDir = 0; iColRefDir < (pcCandColSlice->isInterB() ? 2: 1); iColRefDir ++ )
-      {
-        for( Int iColRefIdx =0; iColRefIdx < pcCandColSlice->getNumRefIdx(( RefPicList )iColRefDir ); iColRefIdx++)
+      for(Int iColRefDir = 0; iColRefDir < (pcCandColSlice->isInterB() ? 2 : 1); iColRefDir++)
+      {
+        for(Int iColRefIdx = 0; iColRefIdx < pcCandColSlice->getNumRefIdx((RefPicList)iColRefDir); iColRefIdx++)
         {
           m_abTIVRINCurrRL[curCandPic][iColRefDir][iColRefIdx] = false;
           Int iColViewIdx    = pcCandColSlice->getViewIndex();
-          Int iColRefViewIdx = pcCandColSlice->getRefPic( ( RefPicList )iColRefDir, iColRefIdx)->getViewIndex();
+          Int iColRefViewIdx = pcCandColSlice->getRefPic((RefPicList)iColRefDir, iColRefIdx)->getViewIndex();
           if(iColViewIdx == iColRefViewIdx)
+          {
             continue;
-
-          for(Int iCurrRefDir = 0;(iCurrRefDir < (currSlice->isInterB() ? 2: 1)) && (m_abTIVRINCurrRL[curCandPic][iColRefDir][iColRefIdx] == false ); iCurrRefDir++)
+          }
+
+          for(Int iCurrRefDir = 0; (iCurrRefDir < (currSlice->isInterB() ? 2 : 1)) && (m_abTIVRINCurrRL[curCandPic][iColRefDir][iColRefIdx] == false); iCurrRefDir++)
           {
-            for( Int iCurrRefIdx =0; iCurrRefIdx < currSlice->getNumRefIdx(( RefPicList )iCurrRefDir ); iCurrRefIdx++)
+            for(Int iCurrRefIdx = 0; iCurrRefIdx < currSlice->getNumRefIdx((RefPicList)iCurrRefDir); iCurrRefIdx++)
             {
-              if( currSlice->getRefPic( ( RefPicList )iCurrRefDir, iCurrRefIdx )->getViewIndex() == iColRefViewIdx )
+              if(currSlice->getRefPic((RefPicList)iCurrRefDir, iCurrRefIdx)->getViewIndex() == iColRefViewIdx)
               {  
                 m_abTIVRINCurrRL[curCandPic][iColRefDir][iColRefIdx] = true;
@@ -428,4 +434,5 @@
   }
 }
+
 Bool TComPic::isTempIVRefValid(Int currCandPic, Int iColRefDir, Int iColRefIdx)
 {
@@ -433,27 +440,27 @@
 }
 
-Void TComPic::checkTextureRef(  )
+Void TComPic::checkTextureRef()
 {
   TComSlice* pcCurrSlice = getSlice(getCurrSliceIdx());
-  TComPic* pcTextPic = pcCurrSlice->getTexturePic();
+  TComPic* pcTextPic = pcCurrSlice->getIvPic(0, getViewIndex());
 #if H_3D_FCO
   if ( pcTextPic )
   {
 #endif
-
     TComSlice* pcTextSlice = pcTextPic->getSlice(0); // currently only support single slice
 
-    for( Int iTextRefDir = 0; (iTextRefDir < (pcTextSlice->isInterB()? 2:1) ) && !pcTextSlice->isIntra(); iTextRefDir ++ )
-    {
-      for( Int iTextRefIdx =0; iTextRefIdx<pcTextSlice->getNumRefIdx(( RefPicList )iTextRefDir ); iTextRefIdx++)
-      {
-        Int iTextRefPOC    = pcTextSlice->getRefPOC( ( RefPicList )iTextRefDir, iTextRefIdx);
-        Int iTextRefViewId = pcTextSlice->getRefPic( ( RefPicList )iTextRefDir, iTextRefIdx)->getViewIndex();
+    for(Int iTextRefDir = 0; (iTextRefDir < (pcTextSlice->isInterB() ? 2 :1) ) && !pcTextSlice->isIntra(); iTextRefDir++)
+    {
+      for(Int iTextRefIdx =0; iTextRefIdx < pcTextSlice->getNumRefIdx((RefPicList)iTextRefDir); iTextRefIdx++)
+      {
+        Int iTextRefPOC    = pcTextSlice->getRefPOC((RefPicList)iTextRefDir, iTextRefIdx);
+        Int iTextRefViewId = pcTextSlice->getRefPic((RefPicList)iTextRefDir, iTextRefIdx)->getViewIndex();
         m_aiTexToDepRef[iTextRefDir][iTextRefIdx] = -1;
         Int iCurrRefDir = iTextRefDir;
-        for( Int iCurrRefIdx =0; ( iCurrRefIdx<pcCurrSlice->getNumRefIdx(( RefPicList )iCurrRefDir ) ) && ( m_aiTexToDepRef[iTextRefDir][iTextRefIdx] < 0 ) ; iCurrRefIdx++)
+
+        for(Int iCurrRefIdx = 0; (iCurrRefIdx<pcCurrSlice->getNumRefIdx((RefPicList)iCurrRefDir)) && (m_aiTexToDepRef[iTextRefDir][iTextRefIdx] < 0); iCurrRefIdx++)
         {
-          if( pcCurrSlice->getRefPOC( ( RefPicList )iCurrRefDir, iCurrRefIdx ) == iTextRefPOC && 
-            pcCurrSlice->getRefPic( ( RefPicList )iCurrRefDir, iCurrRefIdx)->getViewIndex() == iTextRefViewId )
+          if(pcCurrSlice->getRefPOC((RefPicList)iCurrRefDir, iCurrRefIdx ) == iTextRefPOC && 
+             pcCurrSlice->getRefPic((RefPicList)iCurrRefDir, iCurrRefIdx)->getViewIndex() == iTextRefViewId)
           {  
             m_aiTexToDepRef[iTextRefDir][iTextRefIdx] = iCurrRefIdx;
@@ -461,5 +468,4 @@
         }
       }
-
     }
 #if H_3D_FCO
Index: /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TComPic.h
===================================================================
--- /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TComPic.h	(revision 1209)
+++ /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TComPic.h	(revision 1210)
@@ -97,9 +97,9 @@
   Bool                  m_bReduceBitsQTL;
 #endif
-#if H_3D_NBDV
+#if NH_3D_NBDV
   UInt        m_uiRapRefIdx;
   RefPicList  m_eRapRefList;
   Int         m_iNumDdvCandPics;
-  Bool        m_abTIVRINCurrRL  [2][2][MAX_NUM_REF]; //whether an inter-view reference picture with the same view index of the inter-view reference picture of temporal reference picture of current picture exists in current reference picture lists
+  Bool        m_abTIVRINCurrRL [2][2][MAX_NUM_REF]; //whether an inter-view reference picture with the same view index of the inter-view reference picture of temporal reference picture of current picture exists in current reference picture lists
   Int         m_aiTexToDepRef  [2][MAX_NUM_REF];
 #endif
@@ -209,5 +209,5 @@
   Void          print( Bool legend );
 #endif
-#if H_3D_NBDV
+#if NH_3D_NBDV
   Int           getNumDdvCandPics()                    {return m_iNumDdvCandPics;   }
   Int           getDisCandRefPictures(Int iColPOC);
Index: /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TComPrediction.cpp
===================================================================
--- /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TComPrediction.cpp	(revision 1209)
+++ /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TComPrediction.cpp	(revision 1210)
@@ -1480,5 +1480,5 @@
   TComPic* pcPicYuvBaseRef = NULL;
 
-#if H_3D_NBDV
+#if NH_3D_NBDV
   DisInfo cDistparity;
   cDistparity.m_acNBDV = pcCU->getDvInfo(0).m_acNBDV;
Index: /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TComSlice.cpp	(revision 1209)
+++ /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TComSlice.cpp	(revision 1210)
@@ -3585,21 +3585,23 @@
 #endif
 }
-#if H_3D
-Void TComSlice::setDefaultRefView( )
-{
-  setDefaultRefViewIdx( -1 );
-  setDefaultRefViewIdxAvailableFlag( false ); 
+#if NH_3D_NBDV
+Void TComSlice::setDefaultRefView()
+{
+  setDefaultRefViewIdx(-1);
+  setDefaultRefViewIdxAvailableFlag(false); 
 
   Int valid = 0;
   Int DefaultRefViewIdx = -1;
-  for( UInt curViewIdx = 0; curViewIdx < getViewIndex() && valid == 0; curViewIdx++ )
-  {
-    for( Int iRefListId = 0; ( iRefListId < (isInterB() ? 2 : 1) ) && !isIntra() && valid == 0; iRefListId++ )
-    {
-      RefPicList eRefPicList = RefPicList( iRefListId );
-      Int        iNumRefPics = getNumRefIdx( eRefPicList );
-      for( Int i = 0; i < iNumRefPics; i++ )
+
+  for(UInt curViewIdx = 0; curViewIdx < getViewIndex() && valid == 0; curViewIdx++)
+  {
+    for(Int iRefListId = 0; (iRefListId < (isInterB() ? 2 : 1)) && !isIntra() && valid == 0; iRefListId++)
+    {
+      RefPicList eRefPicList = RefPicList(iRefListId);
+      Int        iNumRefPics = getNumRefIdx(eRefPicList);
+
+      for(Int i = 0; i < iNumRefPics; i++)
       { 
-        if(getPOC() == getRefPic( eRefPicList, i )->getPOC() && curViewIdx == getRefPic( eRefPicList, i )->getViewIndex())
+        if(getPOC() == getRefPic(eRefPicList, i)->getPOC() && curViewIdx == getRefPic(eRefPicList, i)->getViewIndex())
         {
           valid = 1;
@@ -3610,8 +3612,9 @@
     }
   }
-  if( valid )
-  {
-    setDefaultRefViewIdx( DefaultRefViewIdx );
-    setDefaultRefViewIdxAvailableFlag( true );   
+
+  if(valid)
+  {
+    setDefaultRefViewIdx(DefaultRefViewIdx);
+    setDefaultRefViewIdxAvailableFlag(true);
   }
 }
Index: /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TComSlice.h	(revision 1209)
+++ /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TComSlice.h	(revision 1210)
@@ -3073,4 +3073,12 @@
   Int                         getMpiSubPbSize           ( )                          { return m_mpiSubPbSize           ;                             };
   Int                         getSubPbSize              ( )                          { return m_subPbSize              ;                             };
+#if NH_3D_NBDV
+  Int                         getDefaultRefViewIdx()                                 { return m_iDefaultRefViewIdx;                                  }
+  Void                        setDefaultRefViewIdx(Int iViewIdx)                     { m_iDefaultRefViewIdx = iViewIdx;                              }
+
+  Bool                        getDefaultRefViewIdxAvailableFlag()                    { return m_bDefaultRefViewIdxAvailableFlag;                     }
+  Void                        setDefaultRefViewIdxAvailableFlag(Bool bViewIdx)       { m_bDefaultRefViewIdxAvailableFlag = bViewIdx;                 }
+  Void                        setDefaultRefView( );
+#endif
 #endif
   // Inference 
Index: /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TypeDef.h	(revision 1209)
+++ /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibCommon/TypeDef.h	(revision 1210)
@@ -69,4 +69,5 @@
 #if NH_3D
 #define NH_3D_VSO                         1
+#define NH_3D_NBDV                        1
 #endif
 
@@ -122,5 +123,5 @@
                                               // SEC_IC_NEIGHBOR_CLIP_I0080    // Clipping of neighboring sample position, JCT3V-I0080
                                               // LGE_CHROMA_IC_J0050_J0034
-#if H_3D_NBDV
+#if NH_3D_NBDV
 #define H_3D_NBDV_REF                     1   // Depth oriented neighboring block disparity derivation
                                               // MTK_D0156
@@ -287,5 +288,5 @@
 #endif
 ////   ****** NEIGHBOURING BLOCK-BASED DISPARITY VECTOR  *********
-#if H_3D_NBDV
+#if NH_3D_NBDV
 #define DVFROM_LEFT                       0
 #define DVFROM_ABOVE                      1
Index: /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibDecoder/TDecCu.cpp
===================================================================
--- /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibDecoder/TDecCu.cpp	(revision 1209)
+++ /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibDecoder/TDecCu.cpp	(revision 1210)
@@ -283,5 +283,5 @@
     pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP
   }
-#if H_3D_NBDV 
+#if NH_3D_NBDV 
   DisInfo DvInfo; 
   DvInfo.m_acNBDV.setZero();
@@ -307,12 +307,12 @@
 #endif
     {
-      m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0, true );
-      m_ppcCU[uiDepth]->copyDVInfoFrom( pcCU, uiAbsPartIdx);
+      m_ppcCU[uiDepth]->copyInterPredInfoFrom(pcCU, uiAbsPartIdx, REF_PIC_LIST_0, true);
+      m_ppcCU[uiDepth]->copyDVInfoFrom(pcCU, uiAbsPartIdx);
       PartSize ePartTemp = m_ppcCU[uiDepth]->getPartitionSize(0);
       UChar cWidTemp     = m_ppcCU[uiDepth]->getWidth(0);
       UChar cHeightTemp  = m_ppcCU[uiDepth]->getHeight(0);
-      m_ppcCU[uiDepth]->setWidth  ( 0, pcCU->getSlice()->getSPS()->getMaxCUWidth ()/(1<<uiDepth)  );
-      m_ppcCU[uiDepth]->setHeight ( 0, pcCU->getSlice()->getSPS()->getMaxCUHeight()/(1<<uiDepth)  );
-      m_ppcCU[uiDepth]->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );     
+      m_ppcCU[uiDepth]->setWidth (0, pcCU->getSlice()->getSPS()->getMaxCUWidth () / (1 << uiDepth));
+      m_ppcCU[uiDepth]->setHeight(0, pcCU->getSlice()->getSPS()->getMaxCUHeight() / (1 << uiDepth));
+      m_ppcCU[uiDepth]->setPartSizeSubParts(SIZE_2Nx2N, 0, uiDepth);     
 #if H_3D_IV_MERGE
       if( pcCU->getSlice()->getIsDepth())
@@ -346,9 +346,8 @@
       }
 #endif
-
       pcCU->setDvInfoSubParts(DvInfo, uiAbsPartIdx, uiDepth);
-      m_ppcCU[uiDepth]->setPartSizeSubParts( ePartTemp, 0, uiDepth );
-      m_ppcCU[uiDepth]->setWidth  ( 0, cWidTemp );
-      m_ppcCU[uiDepth]->setHeight ( 0, cHeightTemp );
+      m_ppcCU[uiDepth]->setPartSizeSubParts(ePartTemp, 0, uiDepth);
+      m_ppcCU[uiDepth]->setWidth(0, cWidTemp);
+      m_ppcCU[uiDepth]->setHeight(0, cHeightTemp);
      }
   }
Index: /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibDecoder/TDecGop.cpp
===================================================================
--- /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibDecoder/TDecGop.cpp	(revision 1209)
+++ /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibDecoder/TDecGop.cpp	(revision 1210)
@@ -122,19 +122,19 @@
   }
 
-#if H_3D_NBDV 
+#if NH_3D_NBDV 
   if(pcSlice->getViewIndex() && !pcSlice->getIsDepth()) //Notes from QC: this condition shall be changed once the configuration is completed, e.g. in pcSlice->getSPS()->getMultiviewMvPredMode() || ARP in prev. HTM. Remove this comment once it is done.
   {
-    Int iColPoc = pcSlice->getRefPOC(RefPicList(1-pcSlice->getColFromL0Flag()), pcSlice->getColRefIdx());
-    rpcPic->setNumDdvCandPics(rpcPic->getDisCandRefPictures(iColPoc));
+    Int iColPoc = pcSlice->getRefPOC(RefPicList(1 - pcSlice->getColFromL0Flag()), pcSlice->getColRefIdx());
+    pcPic->setNumDdvCandPics(pcPic->getDisCandRefPictures(iColPoc));
   }
 
   if(pcSlice->getViewIndex() && !pcSlice->getIsDepth() && !pcSlice->isIntra()) //Notes from QC: this condition shall be changed once the configuration is completed, e.g. in pcSlice->getSPS()->getMultiviewMvPredMode() || ARP in prev. HTM. Remove this comment once it is done.
   {
-    rpcPic->checkTemporalIVRef();
+    pcPic->checkTemporalIVRef();
   }
 
   if(pcSlice->getIsDepth())
   {
-    rpcPic->checkTextureRef();
+    pcPic->checkTextureRef();
   }
 #endif
Index: /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibDecoder/TDecTop.cpp	(revision 1209)
+++ /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibDecoder/TDecTop.cpp	(revision 1210)
@@ -1142,5 +1142,5 @@
     pcSlice->getTempRefPicLists( m_cListPic, m_refPicSetInterLayer0, m_refPicSetInterLayer1, tempRefPicLists, usedAsLongTerm, numPocTotalCurr);
     pcSlice->setRefPicList     ( tempRefPicLists, usedAsLongTerm, numPocTotalCurr, true ); 
-#if H_3D
+#if NH_3D_NBDV
     pcSlice->setDefaultRefView();
 #endif
Index: /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibEncoder/TEncCu.cpp
===================================================================
--- /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibEncoder/TEncCu.cpp	(revision 1209)
+++ /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibEncoder/TEncCu.cpp	(revision 1210)
@@ -441,5 +441,5 @@
   Bool    earlyDetectionSkipMode = false;
 
-#if H_3D_VSP
+#if NH_3D_NBDV
   DisInfo DvInfo; 
   DvInfo.m_acNBDV.setZero();
@@ -584,5 +584,5 @@
 #endif
 
-#if H_3D_NBDV
+#if NH_3D_NBDV
       if( rpcTempCU->getSlice()->getSliceType() != I_SLICE )
       {
@@ -602,5 +602,5 @@
         {
           PartSize ePartTemp = rpcTempCU->getPartitionSize(0);
-          rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );     
+          rpcTempCU->setPartSizeSubParts(SIZE_2Nx2N, 0, uiDepth);
 #if H_3D_IV_MERGE
           if (rpcTempCU->getSlice()->getIsDepth() )
Index: /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 1209)
+++ /branches/HTM-14.1-update-dev3-Samsung-Qualcomm/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 1210)
@@ -1471,5 +1471,5 @@
     pcSlice->setRefPicList ( rcListPic );
 #endif
-#if H_3D
+#if NH_3D_NBDV
     pcSlice->setDefaultRefView();
 #endif
@@ -1731,8 +1731,8 @@
     UInt uiNumSliceSegments = 1;
 
-#if H_3D_NBDV
+#if NH_3D_NBDV
       if(pcSlice->getViewIndex() && !pcSlice->getIsDepth()) //Notes from QC: this condition shall be changed once the configuration is completed, e.g. in pcSlice->getSPS()->getMultiviewMvPredMode() || ARP in prev. HTM. Remove this comment once it is done.
       {
-        Int iColPoc = pcSlice->getRefPOC(RefPicList(1-pcSlice->getColFromL0Flag()), pcSlice->getColRefIdx());
+        Int iColPoc = pcSlice->getRefPOC(RefPicList(1 - pcSlice->getColFromL0Flag()), pcSlice->getColRefIdx());
         pcPic->setNumDdvCandPics(pcPic->getDisCandRefPictures(iColPoc));
       }
@@ -1743,5 +1743,5 @@
 #endif
 
-#if H_3D_NBDV
+#if NH_3D_NBDV
       if(pcSlice->getViewIndex() && !pcSlice->getIsDepth() && !pcSlice->isIntra()) //Notes from QC: this condition shall be changed once the configuration is completed, e.g. in pcSlice->getSPS()->getMultiviewMvPredMode() || ARP in prev. HTM. Remove this comment once it is done.
       {
