Changeset 443 in 3DVCSoftware for trunk/source/Lib/TLibCommon/TComDataCU.cpp


Ignore:
Timestamp:
26 May 2013, 15:41:34 (11 years ago)
Author:
tech
Message:
  • Reintegrated branch 6.2-dev0 rev. 442.
  • Changed version number.
  • Added coding results.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibCommon/TComDataCU.cpp

    r332 r443  
    5353#if MERL_VSP_C0152
    5454
     55#if MTK_D0156
     56#define CHECK_ADD_YET(pcCURef,uiIdx,vspIdx) && ( (!m_pcSlice->getSPS()->getUseVSPCompensation()) || (!( (pcCURef)->getVSPIndex(uiIdx) == vspIdx && bVspMvZeroDone[vspIdx-1] )))
     57#else
    5558#define CHECK_ADD_YET(pcCURef,uiIdx,vspIdx) && !( (pcCURef)->getVSPIndex(uiIdx) == vspIdx && bVspMvZeroDone[vspIdx-1] )
    56 
    57 inline Void TComDataCU::xInheritVspMode( TComDataCU* pcCURef, UInt uiIdx, Bool* bVspMvZeroDone, Int iCount, Int* iVSPIndexTrue, TComMvField* pcMvFieldNeighbours, DisInfo* pDInfo )
    58 {
     59#endif
     60
     61inline Void TComDataCU::xInheritVspMode( TComDataCU* pcCURef, UInt uiIdx, Bool* bVspMvZeroDone, Int iCount, Int* iVSPIndexTrue, TComMvField* pcMvFieldNeighbours, DisInfo* pDInfo
     62#if QC_BVSP_CleanUP_D0191
     63  , UChar *puhInterDirNeighbours
     64#endif
     65#if MERL_VSP_NBDV_RefVId_Fix_D0166
     66    , Int*     iVSPDirTrue
     67#endif
     68    )
     69{
     70#if MTK_D0156
     71    if( !m_pcSlice->getSPS()->getUseVSPCompensation() )
     72    {
     73        return;
     74    }
     75#endif
     76
    5977  Int vspIdx = (Int) pcCURef->getVSPIndex(uiIdx);
    6078  if( vspIdx != 0 )
     
    6987    if (vspIdx < 4)
    7088    {
     89#if QC_BVSP_CleanUP_D0191
     90      puhInterDirNeighbours[ iCount] = 1;
     91#endif
     92#if MERL_VSP_NBDV_RefVId_Fix_D0166
     93      if(pDInfo->iN > 0 )
     94      { // using derived disparity and store corresponding used reference list and ref idx
     95        iVSPDirTrue[idx] = pDInfo->m_aListIdx[0];
     96        assert(pDInfo->m_aRefIdx[0] < 0);
     97#if MTK_VSP_USING_NBDV_D0105
     98        pcMvFieldNeighbours[iCount<<1].setMvField( pDInfo->m_acMvCandNoRef[0], pDInfo->m_aRefIdx[0] );
     99#else
     100        pcMvFieldNeighbours[iCount<<1].setMvField( pDInfo->m_acMvCand[0], pDInfo->m_aRefIdx[0] );
     101#endif
     102        if ( pcCURef->getSlice()->isInterB() )
     103        {
     104#if MTK_VSP_USING_NBDV_D0105
     105          pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCandNoRef[0], pDInfo->m_aRefIdx[0] );
     106#else
     107          pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCand[0], pDInfo->m_aRefIdx[0] );
     108#endif
     109        }
     110      }
     111      else
     112      { // using the original neighboring block vsp reference list
     113        TComMv cMvPred = pcCURef->getCUMvField(REF_PIC_LIST_0)->getMv(uiIdx);
     114        Int    refId   = pcCURef->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiIdx);
     115
     116        assert(refId < 0);
     117        iVSPDirTrue[idx] = pcCURef->getVSPDir(uiIdx);
     118        pcMvFieldNeighbours[iCount<<1].setMvField( cMvPred, refId );
     119        if ( pcCURef->getSlice()->isInterB() )
     120        {
     121          pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cMvPred, refId );
     122        }
     123      }
     124
     125#else // !MERL_VSP_NBDV_RefVId_Fix_D0166
     126
     127#if MTK_VSP_USING_NBDV_D0105
     128      pcMvFieldNeighbours[ iCount<<1].setMvField ( pDInfo->m_acMvCandNoRef[0],  NOT_VALID );
     129#else
    71130      pcMvFieldNeighbours[ iCount<<1].setMvField ( pDInfo->m_acMvCand[0],  NOT_VALID );
     131#endif
    72132      if ( pcCURef->getSlice()->isInterB() )
    73133      {
     134#if MTK_VSP_USING_NBDV_D0105
     135        pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField ( pDInfo->m_acMvCandNoRef[0],  NOT_VALID );
     136#else
    74137         pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField ( pDInfo->m_acMvCand[0],  NOT_VALID );
    75       }
    76     }
    77   }
    78 }
    79 
    80 inline Bool TComDataCU::xAddVspMergeCand( UChar ucVspMergePos, Int vspIdx, Bool* bVspMvZeroDone, UInt uiDepth, Bool* abCandIsInter, Int& iCount,
    81                                           UChar* puhInterDirNeighbours, TComMvField* pcMvFieldNeighbours, Int* iVSPIndexTrue, Int mrgCandIdx, DisInfo* pDInfo )
    82 {
     138#endif
     139      }
     140#endif
     141    }
     142  }
     143}
     144
     145inline Bool TComDataCU::xAddVspMergeCand(
     146 UChar ucVspMergePos,
     147#if !LGE_VSP_INHERIT_D0092
     148 Int vspIdx,
     149 Bool* bVspMvZeroDone,
     150#endif
     151 UInt uiDepth,
     152 Bool* abCandIsInter,
     153 Int& iCount,
     154 UChar* puhInterDirNeighbours,
     155 TComMvField* pcMvFieldNeighbours,
     156 Int* iVSPIndexTrue,
     157 Int mrgCandIdx,
     158 DisInfo* pDInfo
     159#if MERL_VSP_NBDV_RefVId_Fix_D0166
     160 , Int*  iVspDirTrue
     161#endif
     162                                          )
     163{
     164#if MTK_D0156
     165    if( !m_pcSlice->getSPS()->getUseVSPCompensation() )
     166    {
     167        return true;
     168    }
     169#endif
     170
     171#if MTK_LGE_VSP_DEPTH_OFF_D0105_D0139
     172  if (getSlice()->getSPS()->isDepth())
     173  {
     174    return true;
     175  }
     176#endif
     177
    83178#if MERL_VSP_C0152_BugFix_ForNoDepthCase
    84179  TComPic* pRefPicBaseDepth = NULL;
    85180  pRefPicBaseDepth = getSlice()->getRefPicBaseDepth();
    86   if(ucVspMergePos == VSP_MERGE_POS && pRefPicBaseDepth) //VSP can be used only when depth is used as input
     181  if(ucVspMergePos == VSP_MERGE_POS && pRefPicBaseDepth) // VSP can be used only when depth is used as input
    87182#else
    88183  if( ucVspMergePos == VSP_MERGE_POS )
     
    90185  if( ucVspMergePos == VSP_MERGE_POS )
    91186  {
     187#if !LGE_VSP_INHERIT_D0092
    92188    Int idx = vspIdx - 1;
    93     {
     189#endif
     190    {
     191#if LGE_VSP_INHERIT_D0092
     192      if( getSlice()->getSPS()->getViewId() != 0 )
     193#else
    94194      if( getSlice()->getSPS()->getViewId() != 0 && bVspMvZeroDone[idx] == false )
     195#endif
    95196      {
    96197        {
    97198          abCandIsInter [iCount] = true;
     199#if !LGE_VSP_INHERIT_D0092
    98200          bVspMvZeroDone[idx] = true;
     201#endif
    99202
    100203          // get Inter Dir
     
    102205            (getSlice()->getNumRefIdx(REF_PIC_LIST_0) > 0 ? 1 : 2));
    103206          puhInterDirNeighbours[iCount] = iInterDir; // The direction information does not matter
     207#if QC_BVSP_CleanUP_D0191
     208         puhInterDirNeighbours[iCount] = 1;
     209#endif
     210#if LGE_VSP_INHERIT_D0092
     211#if MERL_VSP_NBDV_RefVId_Fix_D0166
     212         assert(pDInfo->m_aRefIdx[0] < 0);
     213         iVspDirTrue[0] = pDInfo->m_aListIdx[0];
     214         Int iRefIdxList0 = NOT_VALID;
     215         Int iRefIdxList1 = NOT_VALID;
     216         iRefIdxList0 = getSlice()->getRefPic(REF_PIC_LIST_0, 0)->getPOC()==getSlice()->getPOC() ? 0 : (getSlice()->getNewRefIdx(REF_PIC_LIST_0)==-1 ? NOT_VALID : getSlice()->getNewRefIdx(REF_PIC_LIST_0));
     217         if ( getSlice()->isInterB() )
     218         {
     219            iRefIdxList1 = getSlice()->getRefPic(REF_PIC_LIST_1, 0)->getPOC()==getSlice()->getPOC() ? 0 : (getSlice()->getNewRefIdx(REF_PIC_LIST_1)==-1 ? NOT_VALID : getSlice()->getNewRefIdx(REF_PIC_LIST_1));
     220         }
     221
     222#if MTK_VSP_USING_NBDV_D0105
     223        //pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCandNoRef[0], pDInfo->m_aListIdx[0]==REF_PIC_LIST_0 ? iRefIdxList0 :NOT_VALID  );
     224        pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCandNoRef[0],  iRefIdxList0 );
     225#else
     226        pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCand[0],  iRefIdxList0 );
     227#endif
     228         if ( getSlice()->isInterB() )
     229         {
     230#if MTK_VSP_USING_NBDV_D0105
     231          pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCandNoRef[0], iRefIdxList1 );
     232          //pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCandNoRef[0],  iRefIdxList1);
     233#else
     234          pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCand[0], iRefIdxList1);
     235#endif
     236         }
     237         iVSPIndexTrue[iCount] = 1;
     238#else
     239
     240#if !MERL_General_Fix
     241         Int iRefIdxList0 = NOT_VALID;
     242         Int iRefIdxList1 = NOT_VALID;
     243         iRefIdxList0 = getSlice()->getRefPic(REF_PIC_LIST_0, 0)->getPOC()==getSlice()->getPOC() ? 0 : (getSlice()->getNewRefIdx(REF_PIC_LIST_0)==-1 ? NOT_VALID : getSlice()->getNewRefIdx(REF_PIC_LIST_0));
     244         if ( getSlice()->isInterB() )
     245         {
     246           iRefIdxList1 = getSlice()->getRefPic(REF_PIC_LIST_1, 0)->getPOC()==getSlice()->getPOC() ? 0 : (getSlice()->getNewRefIdx(REF_PIC_LIST_1)==-1 ? NOT_VALID : getSlice()->getNewRefIdx(REF_PIC_LIST_1));
     247         }
     248#if MTK_VSP_USING_NBDV_D0105
     249         pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCandNoRef[0],  iRefIdxList0 );
     250#else
     251         pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCand[0],  iRefIdxList0 );
     252#endif
     253         if ( getSlice()->isInterB() )
     254         {
     255#if MTK_VSP_USING_NBDV_D0105
     256           pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCandNoRef[0], iRefIdxList1 );
     257#else
     258           pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCand[0], iRefIdxList1);
     259#endif
     260         }
     261         iVSPIndexTrue[iCount] = 1;
     262#else
     263         Int iRefIdx = NOT_VALID;
     264
     265#if QC_BVSP_CleanUP_D0191
     266         iRefIdx = getSlice()->getRefPic(REF_PIC_LIST_0, 0)->getPOC()==getSlice()->getPOC() ? 0: getSlice()->getNewRefIdx(REF_PIC_LIST_0);
     267#endif
     268#if MTK_VSP_USING_NBDV_D0105
     269         pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCandNoRef[0], iRefIdx );
     270#else
     271         pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCand[0], iRefIdx );
     272#endif
     273         if ( getSlice()->isInterB() )
     274         {
     275#if MTK_VSP_USING_NBDV_D0105
     276           pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCandNoRef[0], iRefIdx );
     277#else
     278             pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCand[0], iRefIdx );
     279#endif
     280         }
     281         iVSPIndexTrue[iCount] = 1;
     282#endif
     283#endif
     284#else
    104285          // get Mv using checked disparity vector
    105286          if (vspIdx < 4) // spatial
    106287          {
    107             pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCand[0], NOT_VALID );
     288#if MERL_VSP_NBDV_RefVId_Fix_D0166
     289            assert(pDInfo->m_aRefIdx[0] < 0);
     290            iVspDirTrue[idx] = pDInfo->m_aListIdx[0];
     291
     292#if MTK_VSP_USING_NBDV_D0105
     293            pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCandNoRef[0], pDInfo->m_aRefIdx[0] );
     294#else
     295            pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCand[0], pDInfo->m_aRefIdx[0] );
     296#endif
    108297            if ( getSlice()->isInterB() )
    109298            {
     299#if MTK_VSP_USING_NBDV_D0105
     300              pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCandNoRef[0], pDInfo->m_aRefIdx[0] );
     301#else
     302              pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCand[0], pDInfo->m_aRefIdx[0] );
     303#endif
     304            }
     305
     306#else
     307
     308#if MTK_VSP_USING_NBDV_D0105
     309            pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCandNoRef[0], NOT_VALID );
     310#else
     311            pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCand[0], NOT_VALID );
     312#endif
     313            if ( getSlice()->isInterB() )
     314            {
     315#if MTK_VSP_USING_NBDV_D0105
     316              pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCandNoRef[0], NOT_VALID );
     317#else
    110318              pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCand[0], NOT_VALID );
     319#endif
    111320            }
     321#endif
    112322          }
    113323          iVSPIndexTrue[idx] = iCount;
     324#endif
    114325          if ( mrgCandIdx == iCount )
    115326          {
     
    155366#if MERL_VSP_C0152
    156367  m_piVSPIndex         = NULL;
     368#if MERL_VSP_NBDV_RefVId_Fix_D0166
     369  m_piVSPDir           = NULL;
     370#endif
    157371#endif
    158372  m_puhLumaIntraDir    = NULL;
     
    225439  m_pbResPredFlag      = NULL;
    226440#endif
     441#if QC_ARP_D0177
     442  m_puhARPW           = NULL;
     443#endif
    227444#if LGE_EDGE_INTRA_A0070
    228445  m_pucEdgeCode         = NULL;
     
    241458  m_apSegmentDCOffset[1] = NULL;
    242459#endif
     460#if QC_CU_NBDV_D0181
     461  m_pDvInfo              = NULL;
     462#endif
    243463}
    244464
     
    288508    m_pbICFlag           = (Bool*  )xMalloc(Bool,   uiNumPartition);
    289509#endif
     510#if QC_CU_NBDV_D0181
     511    m_pDvInfo            = (DisInfo* )xMalloc(DisInfo,  uiNumPartition);
     512#endif
    290513    m_puhMergeIndex      = (UChar* )xMalloc(UChar,  uiNumPartition);
    291514#if MERL_VSP_C0152
    292515    m_piVSPIndex         = (Char*  )xMalloc(Char,   uiNumPartition);
     516#if MERL_VSP_NBDV_RefVId_Fix_D0166
     517    m_piVSPDir           = (Char*  )xMalloc(Char,   uiNumPartition);
     518#endif
    293519#endif
    294520#if H3D_IVRP
    295521    m_pbResPredAvailable = (Bool*  )xMalloc(Bool,   uiNumPartition);
    296522    m_pbResPredFlag      = (Bool*  )xMalloc(Bool,   uiNumPartition);
     523#if QC_ARP_D0177
     524    m_puhARPW            = new UChar[ uiNumPartition];
     525#endif
    297526#endif
    298527    m_puhLumaIntraDir    = (UChar* )xMalloc(UChar,  uiNumPartition);
     
    448677#if MERL_VSP_C0152
    449678    if ( m_piVSPIndex         ) { xFree(m_piVSPIndex);          m_piVSPIndex        = NULL; }
     679#if MERL_VSP_NBDV_RefVId_Fix_D0166
     680    if ( m_piVSPDir           ) { xFree(m_piVSPDir  );          m_piVSPDir          = NULL; }
     681#endif
    450682#endif
    451683    if ( m_puhMergeIndex      ) { xFree(m_puhMergeIndex);       m_puhMergeIndex     = NULL; }
     
    453685    if ( m_pbResPredAvailable ) { xFree(m_pbResPredAvailable);  m_pbResPredAvailable= NULL; }
    454686    if ( m_pbResPredFlag      ) { xFree(m_pbResPredFlag);       m_pbResPredFlag     = NULL; }
     687#endif
     688#if QC_CU_NBDV_D0181
     689    if ( m_pDvInfo            ) { xFree(m_pDvInfo);             m_pDvInfo           = NULL; }
     690#endif
     691#if QC_ARP_D0177
     692    if ( m_puhARPW           )  { delete[] m_puhARPW;          m_puhARPW          = NULL; }
    455693#endif
    456694    if ( m_puhLumaIntraDir    ) { xFree(m_puhLumaIntraDir);     m_puhLumaIntraDir   = NULL; }
     
    627865    m_pbSDCFlag[ui] = pcFrom->getSDCFlag(ui);
    628866#endif
     867#if QC_ARP_D0177
     868    m_puhARPW[ui] = pcFrom->getARPW( ui );
     869#endif
    629870    m_puhWidth  [ui] = pcFrom->getWidth(ui);
    630871    m_puhHeight [ui] = pcFrom->getHeight(ui);
     
    644885#if MERL_VSP_C0152
    645886    m_piVSPIndex[ui] = pcFrom->m_piVSPIndex[ui];
     887#if MERL_VSP_NBDV_RefVId_Fix_D0166
     888    m_piVSPDir  [ui] = pcFrom->m_piVSPDir  [ui];
     889#endif
    646890#endif
    647891    m_puhLumaIntraDir[ui]=pcFrom->m_puhLumaIntraDir[ui];
     
    687931#if MERL_VSP_C0152
    688932    memset( m_piVSPIndex        + firstElement, 0,                        numElements * sizeof( *m_piVSPIndex ) );
     933#if MERL_VSP_NBDV_RefVId_Fix_D0166
     934    memset( m_piVSPDir          + firstElement, 0,                        numElements * sizeof( *m_piVSPDir   ) );
     935#endif
    689936#endif
    690937    memset( m_puhLumaIntraDir   + firstElement, 2,                        numElements * sizeof( *m_puhLumaIntraDir ) );
     
    723970    memset( m_pbResPredAvailable       + firstElement, 0    , sizeof( Bool ) * numElements );
    724971    memset( m_pbResPredFlag            + firstElement, 0    , sizeof( Bool ) * numElements );
     972#endif
     973#if QC_ARP_D0177
     974    memset( m_puhARPW                  + firstElement, 0    , sizeof( UChar ) * numElements  );
    725975#endif
    726976  }
     
    8611111#if MERL_VSP_C0152
    8621112      m_piVSPIndex[ui] = 0;
     1113#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1114      m_piVSPDir  [ui] = 0;
     1115#endif
    8631116#endif
    8641117#if H3D_IVRP
    8651118      m_pbResPredAvailable[ui] = 0;
    8661119      m_pbResPredFlag[ui]      = 0;
     1120#endif
     1121#if QC_ARP_D0177
     1122      m_puhARPW[ui] = 0;
    8671123#endif
    8681124      m_puhLumaIntraDir[ui] = 2;
     
    9721228#if MERL_VSP_C0152
    9731229  memset( m_piVSPIndex,         0, iSizeInChar );
     1230#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1231  memset( m_piVSPDir  ,         0, iSizeInChar );
     1232#endif
    9741233#endif
    9751234#if H3D_IVRP
    9761235  memset( m_pbResPredAvailable, 0, iSizeInBool  );
    9771236  memset( m_pbResPredFlag,      0, iSizeInBool  );
     1237#endif
     1238#if QC_ARP_D0177
     1239  memset( m_puhARPW,            0, iSizeInUchar  );
    9781240#endif
    9791241  memset( m_puhLumaIntraDir,    2, iSizeInUchar );
     
    10151277  memset( m_apSegmentDCOffset[1],     0, sizeof(Pel) * m_uiNumPartition);
    10161278#endif
    1017 
     1279#if QC_CU_NBDV_D0181
     1280  m_pDvInfo->bDV = false;
     1281#endif
    10181282  UChar uhWidth  = g_uiMaxCUWidth  >> uiDepth;
    10191283  UChar uhHeight = g_uiMaxCUHeight >> uiDepth;
     
    10581322#if MERL_VSP_C0152
    10591323      m_piVSPIndex[ui]=pcCU->m_piVSPIndex[uiPartOffset+ui];
     1324#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1325      m_piVSPDir  [ui]=pcCU->m_piVSPDir  [uiPartOffset+ui];
     1326#endif
    10601327#endif
    10611328      m_puhLumaIntraDir[ui]=pcCU->m_puhLumaIntraDir[uiPartOffset+ui];
     
    10901357      m_pbResPredAvailable[ui] = pcCU->m_pbResPredAvailable[ uiPartOffset + ui ];
    10911358      m_pbResPredFlag     [ui] = pcCU->m_pbResPredFlag     [ uiPartOffset + ui ];
     1359#endif
     1360#if QC_ARP_D0177
     1361      m_puhARPW           [ui] = pcCU->getARPW( uiPartOffset+ui );
    10921362#endif
    10931363#if RWTH_SDC_DLT_B0036
     
    12081478#if MERL_VSP_C0152
    12091479  m_piVSPIndex          = pcCU->getVSPIndex()         + uiPart;
     1480#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1481  m_piVSPDir            = pcCU->getVSPDir  ()         + uiPart;
     1482#endif
    12101483#endif
    12111484#if H3D_IVRP
    12121485  m_pbResPredAvailable  = pcCU->getResPredAvail()     + uiPart;
    12131486  m_pbResPredFlag       = pcCU->getResPredFlag ()     + uiPart;
     1487#endif
     1488#if QC_ARP_D0177
     1489  m_puhARPW             = pcCU->getARPW() + uiPart;
    12141490#endif
    12151491  m_puhLumaIntraDir     = pcCU->getLumaIntraDir()     + uiPart;
     
    13131589  m_apSegmentDCOffset[1]    = pcCU->getSDCSegmentDCOffset(1) + uiPart;
    13141590#endif
    1315 }
    1316 
     1591#if QC_CU_NBDV_D0181
     1592  m_pDvInfo                 = pcCU->getDvInfo()              + uiPart;
     1593#endif
     1594}
     1595#if QC_CU_NBDV_D0181
     1596Void TComDataCU::copyDVInfoFrom (TComDataCU* pcCU, UInt uiAbsPartIdx)
     1597{
     1598  m_pDvInfo            = pcCU->getDvInfo()                + uiAbsPartIdx;
     1599}
     1600#endif
    13171601// Copy inter prediction info from the biggest CU
    1318 Void TComDataCU::copyInterPredInfoFrom    ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList )
     1602Void TComDataCU::copyInterPredInfoFrom    ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList
     1603#if QC_CU_NBDV_D0181
     1604  , Bool bNBDV
     1605#endif
     1606  )
    13191607{
    13201608  m_pcPic              = pcCU->getPic();
     
    13361624 
    13371625  m_pePartSize         = pcCU->getPartitionSize ()        + uiAbsPartIdx;
     1626#if QC_CU_NBDV_D0181
     1627  if(bNBDV == true)
     1628  {
     1629    m_puhWidth           = pcCU->getWidth ()                + uiAbsPartIdx;
     1630    m_puhHeight          = pcCU->getHeight()                + uiAbsPartIdx;
     1631    m_puhDepth           = pcCU->getDepth ()                + uiAbsPartIdx;
     1632  }
     1633  else
     1634  {
     1635#endif
    13381636#if HHI_INTERVIEW_SKIP
    13391637  m_pbRenderable         = pcCU->getRenderable()        + uiAbsPartIdx;
     
    13541652#if MERL_VSP_C0152
    13551653  m_piVSPIndex         = pcCU->getVSPIndex()              + uiAbsPartIdx;
     1654#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1655  m_piVSPDir           = pcCU->getVSPDir  ()              + uiAbsPartIdx;
     1656#endif
    13561657#endif
    13571658#if H3D_IVRP
     
    13591660  m_pbResPredFlag      = pcCU->getResPredFlag ()          + uiAbsPartIdx;
    13601661#endif
     1662#if QC_ARP_D0177
     1663  m_puhARPW           = pcCU->getARPW()                 + uiAbsPartIdx;
     1664#endif
    13611665  m_apiMVPIdx[eRefPicList] = pcCU->getMVPIdx(eRefPicList) + uiAbsPartIdx;
    13621666  m_apiMVPNum[eRefPicList] = pcCU->getMVPNum(eRefPicList) + uiAbsPartIdx;
     
    13691673  memcpy(m_uiSliceStartCU,pcCU->m_uiSliceStartCU+uiAbsPartIdx,sizeof(UInt)*m_uiNumPartition);
    13701674  memcpy(m_uiEntropySliceStartCU,pcCU->m_uiEntropySliceStartCU+uiAbsPartIdx,sizeof(UInt)*m_uiNumPartition);
     1675#if QC_CU_NBDV_D0181
     1676  }
     1677#endif
    13711678}
    13721679
    13731680// Copy small CU to bigger CU.
    13741681// One of quarter parts overwritten by predicted sub part.
    1375 Void TComDataCU::copyPartFrom( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth )
     1682Void TComDataCU::copyPartFrom( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth
     1683#if QC_ARP_D0177
     1684     ,
     1685    Bool bRP
     1686#endif
     1687    )
    13761688{
    13771689  assert( uiPartUnitIdx<4 );
     
    14051717#if MERL_VSP_C0152
    14061718  memcpy( m_piVSPIndex          + uiOffset, pcCU->getVSPIndex(),          iSizeInChar );
     1719#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1720  memcpy( m_piVSPDir            + uiOffset, pcCU->getVSPDir  (),          iSizeInChar );
     1721#endif
    14071722#endif
    14081723#if H3D_IVRP
    14091724  memcpy( m_pbResPredAvailable  + uiOffset, pcCU->getResPredAvail(),      iSizeInBool  );
    14101725  memcpy( m_pbResPredFlag       + uiOffset, pcCU->getResPredFlag(),       iSizeInBool  );
     1726#endif
     1727#if QC_ARP_D0177
     1728  memcpy( m_puhARPW            + uiOffset,  pcCU->getARPW(),              iSizeInUchar );
    14111729#endif
    14121730  memcpy( m_puhLumaIntraDir     + uiOffset, pcCU->getLumaIntraDir(),      iSizeInUchar );
     
    14861804
    14871805#if LGE_EDGE_INTRA_A0070
     1806#if QC_ARP_D0177
     1807  if( !bRP && pcCU->getSlice()->getSPS()->isDepth() )
     1808#else
    14881809  if( getSlice()->getSPS()->isDepth() )
     1810#endif
    14891811  {
    14901812    memcpy( getEdgeCode( uiOffset ), pcCU->getEdgeCode(0), iSizeInUchar * LGE_EDGE_INTRA_MAX_EDGE_NUM_PER_4x4 );
     
    15411863  memcpy( rpcCU->getICFlag()            + m_uiAbsIdxInLCU, m_pbICFlag,            iSizeInBool );
    15421864#endif
     1865#if QC_CU_NBDV_D0181
     1866  memcpy( rpcCU->getDvInfo()            + m_uiAbsIdxInLCU, m_pDvInfo,             sizeof(* m_pDvInfo) * m_uiNumPartition );
     1867#endif
    15431868  memcpy( rpcCU->getMergeIndex()        + m_uiAbsIdxInLCU, m_puhMergeIndex,       iSizeInUchar );
    15441869#if MERL_VSP_C0152
    15451870  memcpy( rpcCU->getVSPIndex()          + m_uiAbsIdxInLCU, m_piVSPIndex,         iSizeInChar );
     1871#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1872  memcpy( rpcCU->getVSPDir  ()          + m_uiAbsIdxInLCU, m_piVSPDir  ,         iSizeInChar );
     1873#endif
    15461874#endif
    15471875#if H3D_IVRP
    15481876  memcpy( rpcCU->getResPredAvail()      + m_uiAbsIdxInLCU, m_pbResPredAvailable,  iSizeInBool  );
    15491877  memcpy( rpcCU->getResPredFlag()       + m_uiAbsIdxInLCU, m_pbResPredFlag,       iSizeInBool  );
     1878#endif
     1879#if QC_ARP_D0177
     1880  memcpy( rpcCU->getARPW()              + m_uiAbsIdxInLCU, m_puhARPW,             iSizeInUchar );
    15501881#endif
    15511882  memcpy( rpcCU->getLumaIntraDir()      + m_uiAbsIdxInLCU, m_puhLumaIntraDir,     iSizeInUchar );
     
    16742005  memcpy( rpcCU->getMergeIndex()        + uiPartOffset, m_puhMergeIndex,       iSizeInUchar );
    16752006#if MERL_VSP_C0152
    1676   memcpy( rpcCU->getVSPIndex()          + uiPartOffset, m_piVSPIndex,         iSizeInChar );
     2007  memcpy( rpcCU->getVSPIndex()          + uiPartOffset, m_piVSPIndex,          iSizeInChar );
     2008#if MERL_VSP_NBDV_RefVId_Fix_D0166
     2009  memcpy( rpcCU->getVSPDir  ()          + uiPartOffset, m_piVSPDir  ,          iSizeInChar );
     2010#endif
    16772011#endif
    16782012#if H3D_IVRP
    16792013  memcpy( rpcCU->getResPredAvail()      + uiPartOffset, m_pbResPredAvailable,  iSizeInBool  );
    16802014  memcpy( rpcCU->getResPredFlag()       + uiPartOffset, m_pbResPredFlag,       iSizeInBool  );
     2015#endif
     2016#if QC_ARP_D0177
     2017  memcpy( rpcCU->getARPW()              + uiPartOffset, m_puhARPW,            iSizeInUchar );
    16812018#endif
    16822019  memcpy( rpcCU->getLumaIntraDir()      + uiPartOffset, m_puhLumaIntraDir,     iSizeInUchar );
     
    26703007  return uiCtx;
    26713008}
    2672 
     3009#if QC_ARP_D0177
     3010UInt TComDataCU::getCTXARPWFlag( UInt uiAbsPartIdx )
     3011{
     3012  TComDataCU* pcTempCU;
     3013  UInt        uiTempPartIdx;
     3014  UInt        uiCtx = 0;
     3015 
     3016  pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx );
     3017  uiCtx    = ( pcTempCU ) ? ((pcTempCU->getARPW( uiTempPartIdx )==0)?0:1) : 0;
     3018 
     3019  pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx );
     3020  uiCtx   += ( pcTempCU ) ? ((pcTempCU->getARPW( uiTempPartIdx )==0)?0:1): 0;
     3021 
     3022  return uiCtx;
     3023}
     3024#endif
    26733025#if LGE_ILLUCOMP_B0045
    26743026UInt TComDataCU::getCtxICFlag( UInt uiAbsPartIdx )
     
    29073259}
    29083260
     3261#if !PKU_QC_DEPTH_INTRA_UNI_D0195
    29093262UInt TComDataCU::getCtxSDCFlag( UInt uiAbsPartIdx )
    29103263{
     
    29233276  return uiCtx;
    29243277}
     3278#endif
    29253279
    29263280Bool TComDataCU::getSDCAvailable( UInt uiAbsPartIdx )
     
    29543308  setSubPart<Char>( iVSPIdx, m_piVSPIndex, uiAbsPartIdx, uiDepth, uiPartIdx );
    29553309}
    2956 #endif
     3310
     3311#if MERL_VSP_NBDV_RefVId_Fix_D0166
     3312Void TComDataCU::setVSPDirSubParts ( Char iVSPDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
     3313{
     3314  setSubPart<Char>( iVSPDir, m_piVSPDir, uiAbsPartIdx, uiDepth, uiPartIdx );
     3315}
     3316#endif
     3317
     3318#endif // MERL_VSP_C0152
    29573319
    29583320#if H3D_IVRP
     
    29673329}
    29683330#endif
    2969 
     3331#if QC_CU_NBDV_D0181
     3332Void TComDataCU::setDvInfoSubParts( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiDepth )
     3333{
     3334  UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1);
     3335  for (UInt ui = 0; ui < uiCurrPartNumb; ui++ )
     3336  {
     3337    m_pDvInfo[uiAbsPartIdx + ui] = cDvInfo;
     3338  }
     3339}
     3340#endif
    29703341Void TComDataCU::setChromIntraDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiDepth )
    29713342{
     
    29933364  UInt iNumbPart;
    29943365
     3366#if SHARP_ILLUCOMP_PARSE_D0060
     3367  if (!(getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N))
     3368  {
     3369    return false;
     3370  }
     3371  if (getSlice()->getIcSkipParseFlag())
     3372  {
     3373    if (getMergeFlag(uiAbsPartIdx) && getMergeIndex(uiAbsPartIdx) == 0)
     3374    {
     3375      return false;
     3376    }
     3377  }
     3378  if (getMergeFlag(uiAbsPartIdx))
     3379  {
     3380    return true;
     3381  }
     3382#endif
     3383#if !SHARP_ILLUCOMP_PARSE_D0060
    29953384  if(!getSlice()->getIsDepth())
    29963385  {
     3386#endif
    29973387    Int iWidth, iHeight;
    29983388
     
    30153405      }
    30163406    }
     3407#if !SHARP_ILLUCOMP_PARSE_D0060
    30173408  }
    30183409  else
     
    30363427    }
    30373428  }
     3429#endif
    30383430
    30393431  return false;
     
    30463438  Int iWidth, iHeight;
    30473439
     3440#if SHARP_ILLUCOMP_PARSE_D0060
     3441  if (!(getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N))
     3442  {
     3443    return false;
     3444  }
     3445  if (getSlice()->getIcSkipParseFlag())
     3446  {
     3447    if (getMergeFlag(uiAbsPartIdx) && getMergeIndex(uiAbsPartIdx) == 0)
     3448    {
     3449      return false;
     3450    }
     3451  }
     3452  if (getMergeFlag(uiAbsPartIdx))
     3453  {
     3454    return true;
     3455  }
     3456#endif
    30483457  UInt uiPartMode = getPartitionSize(uiAbsPartIdx);
    30493458
     
    35273936 */
    35283937#if MERL_VSP_C0152
    3529 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int* iVSPIndexTrue, Int mrgCandIdx )
     3938Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int* iVSPIndexTrue
     3939#if MERL_VSP_NBDV_RefVId_Fix_D0166
     3940        , Int* iVSPDirTrue
     3941#endif
     3942        , Int mrgCandIdx )
    35303943#else
    35313944Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx )
     
    35603973  this->getPartPosition(uiPUIdx, xP, yP, nPSW, nPSH);
    35613974
    3562 #if MERL_VSP_C0152
     3975#if MERL_VSP_C0152 && !LGE_VSP_INHERIT_D0092
    35633976  Bool bVspMvZeroDone[3] = {false, false, false};
    35643977#endif
     
    35843997#endif //H3D_NBDV
    35853998
    3586 #if H3D_IVRP
     3999#if H3D_IVRP & !QC_ARP_D0177
    35874000  Bool bDVAvail = true;
    35884001#endif
     
    35904003#if H3D_NBDV
    35914004  DisInfo cDisInfo;
     4005#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4006  cDisInfo.bDV = false; // default setting
     4007  cDisInfo.iN  = 0;
     4008#endif
     4009
     4010#if !QC_CU_NBDV_D0181
    35924011  cDisInfo.iN = 0;
     4012#endif
    35934013  if(!bNoPdmMerge)
    35944014  {
     
    35964016    if( !getPic()->getDepthCoded() )
    35974017#endif
     4018#if QC_CU_NBDV_D0181
     4019    {
     4020      cDisInfo.iN = getDvInfo(uiAbsPartIdx).iN;
     4021      cDisInfo.bDV = getDvInfo(uiAbsPartIdx).bDV;
     4022      cDisInfo.m_acMvCand[0] = getDvInfo(uiAbsPartIdx).m_acMvCand[0];
     4023      cDisInfo.m_aVIdxCan[0] = getDvInfo(uiAbsPartIdx).m_aVIdxCan[0];
     4024#if MTK_VSP_USING_NBDV_D0105
     4025      cDisInfo.m_acMvCandNoRef[0] = getDvInfo(uiAbsPartIdx).m_acMvCandNoRef[0];
     4026#endif
     4027#if MERL_General_Fix
     4028#if MERL_VSP_C0152
     4029#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4030      cDisInfo.m_aListIdx[0] = getDvInfo(uiAbsPartIdx).m_aListIdx[0];
     4031      cDisInfo.m_aRefIdx[0]  = getDvInfo(uiAbsPartIdx).m_aRefIdx[0];
     4032#endif
     4033#endif
     4034#endif
     4035    }
     4036#else
    35984037    getDisMvpCandNBDV(uiPUIdx, uiAbsPartIdx, &cDisInfo , true
    35994038#if MERL_VSP_C0152
     
    36014040#endif     
    36024041);
    3603   }
     4042#endif
     4043  }
     4044 
    36044045#if FCO_DVP_REFINE_C0132_C0170
    36054046  if(getPic()->getDepthCoded() )
     
    36184059  }
    36194060#endif
     4061#if !QC_CU_NBDV_D0181
    36204062  if(cDisInfo.iN==0)
    3621   {
     4063#else
     4064  if(cDisInfo.bDV == false)
     4065#endif
     4066  {
     4067#if !QC_CU_NBDV_D0181
    36224068    cDisInfo.iN = 1;
    36234069    cDisInfo.m_acMvCand[0].setHor(0);
    36244070    cDisInfo.m_acMvCand[0].setVer(0);
    36254071    cDisInfo.m_aVIdxCan[0] = 0;
    3626 #if H3D_IVRP
     4072#endif
     4073#if H3D_IVRP & !QC_ARP_D0177
    36274074    bDVAvail = false;
    36284075#endif
    36294076  }
     4077
     4078#if MERL_VSP_NBDV_RefVId_Fix_D0166 && !MTK_LGE_VSP_DEPTH_OFF_D0105_D0139
     4079  if (bNoPdmMerge && cDisInfo.bDV == false)
     4080  { // purely for default setting
     4081    cDisInfo.iN = 1;
     4082    cDisInfo.m_acMvCand[0].setHor(0);
     4083    cDisInfo.m_acMvCand[0].setVer(0);
     4084    cDisInfo.m_acMvCandNoRef[0].setHor(0);
     4085    cDisInfo.m_acMvCandNoRef[0].setVer(0);
     4086    cDisInfo.m_aVIdxCan[0] = 0;
     4087
     4088    RefPicList eRefPicList = REF_PIC_LIST_0 ;
     4089    Int refFrmIdx = 0;
     4090    getRefListAndRefFrmIdx(0, eRefPicList, refFrmIdx);
     4091    cDisInfo.m_aListIdx[0] = eRefPicList;
     4092    cDisInfo.m_aRefIdx [0] = -1-refFrmIdx;
     4093   }
     4094#endif
    36304095
    36314096#if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137
     
    36524117        clipMv(cMvPred);
    36534118        pcMvFieldNeighbours[iCount<<1].setMvField(cMvPred,pcMvFieldNeighbours[iCount<<1].getRefIdx());
     4119#if MTK_LGE_VSP_DEPTH_OFF_D0105_D0139
     4120        if (pcMvFieldNeighbours[iCount<<1].getRefIdx()<0)
     4121        {
     4122          assert(pcTextureCU->getVSPIndex(uiPartIdxCenter)!=0); 
     4123          for (Int i=0; i<getSlice()->getNumRefIdx(REF_PIC_LIST_0); i++)
     4124          {
     4125            if (getSlice()->getRefPOC(REF_PIC_LIST_0, i) == getSlice()->getPOC())
     4126            {
     4127              pcMvFieldNeighbours[iCount<<1].setMvField(cMvPred,i);
     4128              break;
     4129            }
     4130          }
     4131        }
     4132#endif
    36544133      }
    36554134      if ( getSlice()->isInterB() )
     
    36644143          clipMv(cMvPred);
    36654144          pcMvFieldNeighbours[(iCount<<1)+1].setMvField(cMvPred,pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx());
     4145#if MTK_LGE_VSP_DEPTH_OFF_D0105_D0139
     4146          if (pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx()<0)
     4147          {
     4148            assert(pcTextureCU->getVSPIndex(uiPartIdxCenter)!=0); 
     4149            for (Int i=0; i<getSlice()->getNumRefIdx(REF_PIC_LIST_1); i++)
     4150            {
     4151              if (getSlice()->getRefPOC(REF_PIC_LIST_1, i) == getSlice()->getPOC())
     4152              {
     4153                pcMvFieldNeighbours[(iCount<<1)+1].setMvField(cMvPred,i);
     4154                break;
     4155              }
     4156            }
     4157          }
     4158#endif
    36664159        }
    36674160      }
    3668 #if MERL_VSP_C0152
    3669       xInheritVspMode( pcTextureCU, uiPartIdxCenter, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
    3670 #endif
    3671       if ( mrgCandIdx == iCount )
    3672       {
    3673         return;
    3674       }
    3675       iCount ++;
     4161#if MERL_VSP_C0152  && !QC_BVSP_CleanUP_D0191 && !LGE_VSP_INHERIT_D0092
     4162#if !MTK_LGE_VSP_DEPTH_OFF_D0105_D0139
     4163      xInheritVspMode( pcTextureCU, uiPartIdxCenter, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo
     4164#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4165         , iVSPDirTrue
     4166#endif
     4167        ) ;
     4168#endif
     4169#endif
     4170#if MTK_LGE_VSP_DEPTH_OFF_D0105_D0139
     4171      if (!((pcMvFieldNeighbours[iCount<<1].getRefIdx()<0 && !getSlice()->isInterB())
     4172        || (pcMvFieldNeighbours[iCount<<1].getRefIdx()<0 && pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx()<0 && getSlice()->isInterB())))
     4173      {
     4174#endif
     4175        if ( mrgCandIdx == iCount )
     4176        {
     4177          return;
     4178        }
     4179        iCount ++;
     4180#if MTK_LGE_VSP_DEPTH_OFF_D0105_D0139
     4181      }
     4182      else
     4183      {
     4184        assert(0);
     4185      }
     4186#endif
    36764187    }
    36774188  }
     
    36874198  iPdmDir[1] = iPdmInterDir;
    36884199#endif // H3D_NBDV
    3689 #if H3D_IVRP
     4200#if H3D_IVRP & !QC_ARP_D0177
    36904201  if (m_pcSlice->getSPS()->getMultiviewResPredMode()==1 && iPdmDir[0] && !bNoPdmMerge && cCurPS == SIZE_2Nx2N && bDVAvail)
    36914202  {
     
    37274238  } 
    37284239 
    3729 #endif //  H3D_IVMP
    3730 
     4240#endif //  H3D_IVMP
     4241
     4242#if !FIX_MERGE_D
    37314243#if MERL_VSP_COMPENSATION_C0152
    37324244  //===== vsp 0 =====
    37334245  if( iCount < 4 + extraMergeCand )
    3734     if ( !xAddVspMergeCand(0, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
     4246    if ( !xAddVspMergeCand(0, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo
     4247#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4248            , iVSPDirTrue
     4249#endif
     4250            )
     4251       )
    37354252      return;
     4253#endif
    37364254#endif
    37374255
     
    37514269  {
    37524270    if ( pcCULeft && !pcCULeft->isIntra( uiLeftPartIdx )
    3753 #if MERL_VSP_C0152
     4271#if MERL_VSP_C0152 && !LGE_VSP_INHERIT_D0092
    37544272      CHECK_ADD_YET(pcCULeft, uiLeftPartIdx, 1)
    37554273#endif
     
    38004318#endif
    38014319#if MERL_VSP_C0152
    3802         xInheritVspMode( pcCULeft, uiLeftPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     4320#if LGE_VSP_INHERIT_D0092
     4321        if (pcCULeft->getVSPIndex(uiLeftPartIdx)==1)
     4322        {
     4323            iVSPIndexTrue[iCount] = 1;
     4324        }
     4325#else
     4326        xInheritVspMode( pcCULeft, uiLeftPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo
     4327#if QC_BVSP_CleanUP_D0191
     4328        ,puhInterDirNeighbours
     4329#endif
     4330#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4331         , iVSPDirTrue
     4332#endif
     4333                );
     4334#endif
    38034335#endif
    38044336        if ( mrgCandIdx == iCount )
     
    38254357    }
    38264358  if ( pcCUAbove && !pcCUAbove->isIntra( uiAbovePartIdx )
    3827 #if MERL_VSP_C0152
     4359#if MERL_VSP_C0152 && !LGE_VSP_INHERIT_D0092
    38284360    CHECK_ADD_YET(pcCUAbove, uiAbovePartIdx, 1)
    38294361#endif
     
    38734405#endif
    38744406#if MERL_VSP_C0152
    3875      xInheritVspMode( pcCUAbove, uiAbovePartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     4407#if LGE_VSP_INHERIT_D0092
     4408    if (pcCUAbove->getVSPIndex(uiAbovePartIdx)==1)
     4409    {
     4410        iVSPIndexTrue[iCount] = 1;
     4411    }
     4412#else
     4413     xInheritVspMode( pcCUAbove, uiAbovePartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo
     4414#if QC_BVSP_CleanUP_D0191
     4415        ,puhInterDirNeighbours
     4416#endif
     4417#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4418       , iVSPDirTrue
     4419#endif
     4420             ) ;
     4421#endif
    38764422#endif
    38774423    if ( mrgCandIdx == iCount )
     
    38974443  }
    38984444  if ( pcCUAboveRight && !pcCUAboveRight->isIntra( uiAboveRightPartIdx )
    3899 #if MERL_VSP_C0152
     4445#if MERL_VSP_C0152 && !LGE_VSP_INHERIT_D0092
    39004446    CHECK_ADD_YET(pcCUAboveRight, uiAboveRightPartIdx, 1)
    39014447#endif
     
    39224468#endif
    39234469#if MERL_VSP_C0152
    3924     xInheritVspMode( pcCUAboveRight, uiAboveRightPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     4470#if LGE_VSP_INHERIT_D0092
     4471    if (pcCUAboveRight->getVSPIndex(uiAboveRightPartIdx)==1)
     4472    {
     4473        iVSPIndexTrue[iCount] = 1;
     4474    }
     4475#else
     4476    xInheritVspMode( pcCUAboveRight, uiAboveRightPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo
     4477#if QC_BVSP_CleanUP_D0191
     4478        ,puhInterDirNeighbours
     4479#endif
     4480#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4481       , iVSPDirTrue
     4482#endif
     4483            ) ;
     4484#endif
    39254485#endif
    39264486    if ( mrgCandIdx == iCount )
     
    39804540#endif // H3D_IVMP
    39814541
     4542#if MERL_VSP_COMPENSATION_C0152
     4543  //===== vsp 3 =====
     4544#if LGE_VSP_INHERIT_D0092
     4545    if ( !xAddVspMergeCand(3, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo
     4546#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4547      , iVSPDirTrue
     4548#endif
     4549      ) )
     4550#else
     4551    if( iCount < 4 + extraMergeCand )
     4552        if ( !xAddVspMergeCand(3, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo
     4553#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4554          , iVSPDirTrue
     4555#endif   
     4556          ) )
     4557#endif
     4558            return;
     4559#endif
     4560
     4561#if MERL_VSP_C0152
     4562#if VSP_MERGE_POS < 4
     4563#if H3D_IVMP
     4564    if( iCount < 4 + extraMergeCand )
     4565#else
     4566    if( iCount < 4 )
     4567#endif
     4568    {
     4569#endif
     4570#endif
    39824571
    39834572  //left bottom
     
    39934582  }
    39944583  if ( pcCULeftBottom && !pcCULeftBottom->isIntra( uiLeftBottomPartIdx )
    3995 #if MERL_VSP_C0152
     4584#if MERL_VSP_C0152 && !LGE_VSP_INHERIT_D0092
    39964585    CHECK_ADD_YET(pcCULeftBottom, uiLeftBottomPartIdx, 1)
    39974586#endif
     
    40184607#endif
    40194608#if MERL_VSP_C0152
    4020      xInheritVspMode( pcCULeftBottom, uiLeftBottomPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     4609#if LGE_VSP_INHERIT_D0092
     4610    if (pcCULeftBottom->getVSPIndex(uiLeftBottomPartIdx)==1)
     4611    {
     4612        iVSPIndexTrue[iCount] = 1;
     4613    }
     4614#else
     4615    xInheritVspMode( pcCULeftBottom, uiLeftBottomPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo
     4616#if QC_BVSP_CleanUP_D0191
     4617        ,puhInterDirNeighbours
     4618#endif
     4619#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4620       , iVSPDirTrue
     4621#endif
     4622             ) ;
     4623#endif
    40214624#endif
    40224625    if ( mrgCandIdx == iCount )
     
    40264629    iCount ++;
    40274630  }
    4028  
    4029  
     4631
     4632#if MERL_VSP_C0152  // Is this correct here?
     4633#if VSP_MERGE_POS < 4
     4634    }
     4635#endif
     4636#endif
     4637
    40304638  // above left
    40314639#if H3D_IVMP
     
    40464654    }
    40474655    if( pcCUAboveLeft && !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx )
    4048 #if MERL_VSP_C0152
     4656#if MERL_VSP_C0152 && !LGE_VSP_INHERIT_D0092
    40494657     CHECK_ADD_YET(pcCUAboveLeft, uiAboveLeftPartIdx, 1)
    40504658#endif
     
    40734681#endif
    40744682#if MERL_VSP_C0152
    4075      xInheritVspMode( pcCUAboveLeft, uiAboveLeftPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     4683#if LGE_VSP_INHERIT_D0092
     4684    if (pcCUAboveLeft->getVSPIndex(uiAboveLeftPartIdx)==1)
     4685    {
     4686        iVSPIndexTrue[iCount] = 1;
     4687    }
     4688#else
     4689      xInheritVspMode( pcCUAboveLeft, uiAboveLeftPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo
     4690#if QC_BVSP_CleanUP_D0191
     4691        ,puhInterDirNeighbours
     4692#endif
     4693#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4694       , iVSPDirTrue
     4695#endif
     4696             ) ;
     4697#endif
    40764698#endif
    40774699      if ( mrgCandIdx == iCount )
     
    40864708  //===== vsp 5 =====
    40874709  if( iCount < 4 + extraMergeCand )
    4088     if ( !xAddVspMergeCand(5, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
     4710#if LGE_VSP_INHERIT_D0092
     4711    if ( !xAddVspMergeCand(5, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo
     4712#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4713         , iVSPDirTrue
     4714#endif
     4715))
     4716#else
     4717    if ( !xAddVspMergeCand(5, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo
     4718#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4719         , iVSPDirTrue
     4720#endif
     4721            ))
     4722#endif
    40894723      return;
    40904724#endif
     
    42764910#if MERL_VSP_C0152
    42774911      Bool bValid = true;
     4912#if LGE_VSP_INHERIT_D0092
     4913      if (iVSPIndexTrue[i]==1 || iVSPIndexTrue[j]==1) // NOT_VALID
     4914#else
    42784915      if (pcMvFieldNeighbours[i<<1].getRefIdx() < 0 || pcMvFieldNeighbours[(j<<1)+1].getRefIdx() < 0) // NOT_VALID
     4916#endif
    42794917        bValid = false;
    42804918#endif
     4919
     4920#if MTK_D0156
     4921      if( !m_pcSlice->getSPS()->getUseVSPCompensation())
     4922      {
     4923          bValid = true;
     4924      }
     4925#endif
     4926
    42814927      if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2)
    42824928#if MERL_VSP_C0152
     
    44475093  {
    44485094    if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx )
    4449 #if MERL_VSP_C0152
     5095#if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191
    44505096     && !pcCorner->getVSPIndex( uiCornerPUIdx )
    44515097#endif
     
    45935239    pcTmpCU = getPULeft(uiIdx, uiPartIdxLB, true, false);
    45945240  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
    4595 #if MERL_VSP_C0152
     5241#if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191
    45965242  if(! pcTmpCU->getVSPIndex(uiIdx))
    45975243#endif
     
    46185264
    46195265  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
    4620 #if MERL_VSP_C0152
     5266#if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191
    46215267  if(! pcTmpCU->getVSPIndex(uiIdx))
    46225268#endif
     
    46435289      pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, false, true);
    46445290  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
    4645 #if MERL_VSP_C0152
     5291#if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191
    46465292  if(! pcTmpCU->getVSPIndex(uiIdx))
    46475293#endif
     
    46675313      pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true, false);
    46685314  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
    4669 #if MERL_VSP_C0152
     5315#if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191
    46705316  if(! pcTmpCU->getVSPIndex(uiIdx))
    46715317#endif
     
    46945340    assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr));
    46955341  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
    4696 #if MERL_VSP_C0152
     5342#if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191
    46975343  if(! pcTmpCU->getVSPIndex(uiIdx))
    46985344#endif
     
    49025548  Int iPictureWidth  = pcBaseViewDepthPicYuv->getWidth();
    49035549  Int iPictureHeight = pcBaseViewDepthPicYuv->getHeight();
    4904 
     5550#if !QC_BVSP_CleanUP_D0191
     5551#if LGE_ROUND_OFFSET_D0135
     5552  Int depthPosX = Clip3(0,   iPictureWidth - iBlkWidth,  iBlkX + ((mv->getHor()+2)>>2));
     5553  Int depthPosY = Clip3(0,   iPictureHeight- iBlkHeight,  iBlkY + ((mv->getVer()+2)>>2));
     5554#else
    49055555  Int depthPosX = Clip3(0,   iPictureWidth - iBlkWidth,  iBlkX + (mv->getHor()>>2));
    49065556  Int depthPosY = Clip3(0,   iPictureHeight- iBlkHeight,  iBlkY + (mv->getVer()>>2));
     5557#endif
    49075558
    49085559  Pel *pDepthPel   = pcBaseViewDepthPicYuv->getLumaAddr() + depthPosX + depthPosY * depStride;
     5560#endif
    49095561  Pel  maxDepthVal = 0;
    49105562
    49115563  if ( bSimpleDvpRefine )
    49125564  {
     5565#if LGE_ROUND_OFFSET_D0135
     5566    Int depthStartPosX = Clip3(0,   iPictureWidth - iBlkWidth,  iBlkX + ((mv->getHor()+2)>>2));
     5567    Int depthStartPosY = Clip3(0,   iPictureHeight- iBlkHeight,  iBlkY + ((mv->getVer()+2)>>2));
     5568    Int depthEndPosX   = Clip3(0,   iPictureWidth - 1,  iBlkX + iBlkWidth - 1 + ((mv->getHor()+2)>>2));
     5569    Int depthEndPosY   = Clip3(0,   iPictureHeight - 1,  iBlkY + iBlkHeight - 1 + ((mv->getVer()+2)>>2));
     5570#else
    49135571    Int depthStartPosX = Clip3(0,   iPictureWidth - iBlkWidth,  iBlkX + (mv->getHor()>>2));
    49145572    Int depthStartPosY = Clip3(0,   iPictureHeight- iBlkHeight,  iBlkY + (mv->getVer()>>2));
    49155573    Int depthEndPosX   = Clip3(0,   iPictureWidth - 1,  iBlkX + iBlkWidth - 1 + (mv->getHor()>>2));
    49165574    Int depthEndPosY   = Clip3(0,   iPictureHeight - 1,  iBlkY + iBlkHeight - 1 + (mv->getVer()>>2));
     5575#endif
     5576#if !MTK_DEPTH_TO_DISP_D0138
    49175577    Int iCenterX = (depthStartPosX + depthEndPosX) >> 1;
    49185578    Int iCenterY = (depthStartPosY + depthEndPosY) >> 1;
     5579#endif
    49195580
    49205581    Pel *depthTL  = pcBaseViewDepthPicYuv->getLumaAddr();
     
    49245585    aiDepth[2] = depthTL[ (depthStartPosY) * depStride + depthEndPosX   ];      // Right Top
    49255586    aiDepth[3] = depthTL[ (depthEndPosY)   * depStride + depthEndPosX   ];      // Right Bottom
     5587#if MTK_DEPTH_TO_DISP_D0138
     5588    for (Int i = 0; i < 4; i++)
     5589#else
    49265590    aiDepth[4] = depthTL[ (iCenterY)       * depStride + iCenterX       ];      // Center
    49275591    for (Int i = 0; i < 5; i++)
     5592#endif
    49285593    {
    49295594      if (maxDepthVal < aiDepth[i])
     
    49315596    }
    49325597  }
     5598#if !QC_BVSP_CleanUP_D0191
    49335599  else
    49345600  {
     
    49435609    }
    49445610  }
     5611#endif
    49455612
    49465613  Int iDisp = aiShiftLUT[ maxDepthVal ] << iShiftPrec;
     
    49485615  return iDisp;
    49495616}
    4950 Void TComDataCU::estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred, Bool bSimpleDvpRefine)
     5617
     5618Void TComDataCU::estimateDVFromDM(
     5619#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5620          Int refViewIdx,
     5621#endif
     5622          UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred, Bool bSimpleDvpRefine)
    49515623{
    49525624  if (picDepth)
     
    49625634    Int  iShiftPrec;
    49635635
    4964     getSlice()->getBWVSPLUTParam(aiShiftLUT, iShiftPrec);
     5636    getSlice()->getBWVSPLUTParam(aiShiftLUT, iShiftPrec
     5637#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5638            , refViewIdx
     5639#endif
     5640            );
    49655641
    49665642    Pel iDisp = getMcpFromDM( pcBaseViewDepthPicYuv, cMvPred, iBlkX, iBlkY, iWidth, iHeight, aiShiftLUT, iShiftPrec, bSimpleDvpRefine );
     
    49915667          clipMv(cMvPred);
    49925668
    4993           TComPic* picDepth = getSlice()->getRefPicBaseDepth();
    4994 
     5669          TComPic* picDepth = NULL;
     5670#if MERL_General_Fix
     5671#if MERL_VSP_C0152
     5672#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5673          Int refPOC = getSlice()->getRefPic(eRefPicList, refId)->getPOC();
     5674          picDepth = getSlice()->getDepthRefPic(refViewIdx, refPOC);
     5675          assert(refPOC == getSlice()->getPOC());
     5676          assert(picDepth != NULL);
     5677#else
     5678          picDepth = getSlice()->getRefPicBaseDepth();
     5679#endif
     5680#endif
     5681#else
     5682          picDepth = getSlice()->getRefPicBaseDepth();
     5683#endif
     5684
     5685#if QC_CU_NBDV_D0181 && MERL_VSP_C0152
     5686          pNbDvInfo->m_acMvCandNoRef[pNbDvInfo->iN] = cMvPred;
     5687#endif
    49955688          if (picDepth && bDepthRefine)
    4996             estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true);
    4997 
     5689            estimateDVFromDM(
     5690#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5691                    refViewIdx,
     5692#endif
     5693                    uiPartIdx, picDepth, uiPartAddr, &cMvPred, true);
     5694
     5695
     5696#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5697          pNbDvInfo->m_aListIdx[ pNbDvInfo->iN ] = eRefPicList;
     5698          pNbDvInfo->m_aRefIdx [ pNbDvInfo->iN ] = -1-refId;
     5699          assert(pNbDvInfo->m_aRefIdx [ pNbDvInfo->iN ] < 0);
     5700#endif
    49985701          pNbDvInfo->m_acMvCand[ pNbDvInfo->iN   ] = cMvPred;
    49995702          pNbDvInfo->m_aVIdxCan[ pNbDvInfo->iN++ ] = refViewIdx;
     
    50105713        }
    50115714      }
    5012 #if MERL_VSP_C0152
     5715#if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191
    50135716      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
    50145717      {
    5015         TComPic* picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
     5718        TComPic* picDepth = NULL;
     5719
     5720#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5721        RefPicList privateRefPicList = (RefPicList) pcTmpCU->getVSPDir( uiIdx );
     5722        assert(privateRefPicList == REF_PIC_LIST_0 || privateRefPicList == REF_PIC_LIST_1);
     5723        Int  refIdx = -1-pcTmpCU->getCUMvField( privateRefPicList )->getRefIdx( uiIdx ); // a trick when storing refIdx for temporal BVSP
     5724        assert(refIdx >= 0);
     5725        Int  refViewIdx = getSlice()->getRefViewId(privateRefPicList, refIdx);
     5726        Int  refPOC = getSlice()->getRefPOC(privateRefPicList, refIdx);
     5727
     5728        picDepth = getSlice()->getDepthRefPic(refViewIdx, refPOC);
     5729        assert(refPOC == getSlice()->getPOC());
     5730        assert(picDepth != NULL);
     5731#else
     5732        picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
     5733#endif
     5734
     5735#if QC_CU_NBDV_D0181 && MERL_VSP_C0152
     5736        pNbDvInfo->m_acMvCandNoRef[pNbDvInfo->iN] = cMvPred;
     5737#endif
    50165738        if (picDepth && bDepthRefine)
    5017           estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
     5739          estimateDVFromDM(
     5740#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5741                  refViewIdx,
     5742#endif
     5743                  uiPartIdx, picDepth, uiPartAddr, &cMvPred);
    50185744
    50195745        cMvPred.setVer(0);
    50205746
     5747#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5748        pNbDvInfo->m_aRefIdx [ pNbDvInfo->iN ] = -1-refIdx;
     5749        pNbDvInfo->m_aListIdx[ pNbDvInfo->iN ] = privateRefPicList;
     5750        pNbDvInfo->m_acMvCand[ pNbDvInfo->iN ] = cMvPred;
     5751        pNbDvInfo->m_aVIdxCan[ pNbDvInfo->iN ] = refViewIdx;
     5752        assert(pNbDvInfo->m_aRefIdx [ pNbDvInfo->iN ] < 0);
     5753        pNbDvInfo->iN++;
     5754#else
    50215755        pNbDvInfo->m_acMvCand[ pNbDvInfo->iN]   = cMvPred;
    50225756        pNbDvInfo->m_aVIdxCan[ pNbDvInfo->iN++] = 0; // refViewIdx;
     5757#endif
    50235758        return true;
    50245759      }
     
    50755810}
    50765811
    5077 
     5812#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5813Bool TComDataCU::getRefListAndRefFrmIdx(Int targetRefViewIdx, RefPicList& eRefPicList, Int& refFrmIdx)
     5814{
     5815  Bool isFound = false;
     5816  RefPicList privateRefPicList = REF_PIC_LIST_0;
     5817
     5818  refFrmIdx = 0;
     5819  for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1) && isFound == false; iList++)
     5820  {
     5821    privateRefPicList = RefPicList(iList);
     5822    for (Int refIdx = 0; refIdx < getSlice()->getNumRefIdx(privateRefPicList); refIdx++)
     5823    {
     5824      Int refViewIdx  = getSlice()->getRefViewId( privateRefPicList, refIdx);
     5825      if ( refViewIdx == targetRefViewIdx)
     5826      {
     5827        refFrmIdx = refIdx;
     5828        eRefPicList = privateRefPicList;
     5829        isFound = true;
     5830        break;
     5831      }
     5832    }
     5833  }
     5834
     5835  return isFound;
     5836}
     5837#endif
     5838
     5839#if QC_CU_NBDV_D0181
     5840Bool TComDataCU::getDisMvpCandNBDV( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo , Bool bParMerge
     5841#else
    50785842Void TComDataCU::getDisMvpCandNBDV( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo , Bool bParMerge
     5843#endif
    50795844#if MERL_VSP_C0152
    50805845                                , Bool bDepthRefine
     
    50995864  }
    51005865
     5866#if MTK_D0156
     5867  if( !m_pcSlice->getSPS()->getUseDVPRefine() )
     5868  {
     5869      bDepthRefine = false;
     5870  }
     5871#endif
     5872
    51015873  // Get Positions 
    51025874  PartSize eCUMode    = getPartitionSize( uiPartAddr );   
     5875#if QC_CU_NBDV_D0181
     5876  assert(eCUMode == SIZE_2Nx2N);
     5877#endif
    51035878  UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB; 
    51045879
     
    51685943          {
    51695944            clipMv(cColMv);
    5170             TComPic* picDepth = getSlice()->getRefPicBaseDepth();
     5945            TComPic* picDepth = NULL;
     5946#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5947            Int currPoc = getSlice()->getPOC();
     5948            picDepth = getSlice()->getDepthRefPic(iTargetViewIdx, currPoc);
     5949            assert(picDepth != NULL);
     5950#else
     5951            picDepth = getSlice()->getRefPicBaseDepth();
     5952#endif
     5953#if QC_CU_NBDV_D0181 && MERL_VSP_C0152
     5954            pDInfo->m_acMvCandNoRef[pDInfo->iN] = cColMv;
     5955#endif
    51715956            if (picDepth && bDepthRefine)
     5957#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5958              estimateDVFromDM(iTargetViewIdx, uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
     5959#else
    51725960              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
    5173 
    5174             pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5961#endif
     5962
     5963#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5964            Int refFrmIdx = 0;
     5965            RefPicList privateRefPicList = REF_PIC_LIST_0;
     5966            getRefListAndRefFrmIdx(iTargetViewIdx, privateRefPicList, refFrmIdx);
     5967           
     5968            pDInfo->m_aListIdx[ pDInfo->iN ]  = privateRefPicList;
     5969            pDInfo->m_aRefIdx [ pDInfo->iN ]  = -1-refFrmIdx;
     5970            assert(pDInfo->m_aRefIdx [ pDInfo->iN ] < 0);
     5971#endif
     5972            pDInfo->m_acMvCand[ pDInfo->iN ]  = cColMv;
    51755973            pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     5974#if QC_CU_NBDV_D0181
     5975            return true;
     5976#else
    51765977            return ;
     5978#endif
    51775979          }
    51785980        } // Loop positions
     
    52036005  bCheckMcpDv = true;
    52046006  if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_LEFT, bDepthRefine ) )
     6007#if !QC_CU_NBDV_D0181
    52056008    return;
    5206 
     6009#else
     6010    return true;
     6011#endif
    52076012
    52086013  //// ******* Get disparity from above block ******* /////
     
    52256030    bCheckMcpDv = ( ( getAddr() - pcTmpCU->getAddr() ) == 0);
    52266031    if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_ABOVE, bDepthRefine ) )
     6032#if !QC_CU_NBDV_D0181
    52276033      return;
     6034#else
     6035      return true;
     6036#endif
    52286037  }
    52296038
     
    52436052    bCheckMcpDv = ( ( getAddr() - pcTmpCU->getAddr() ) == 0);
    52446053    if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_ABOVERIGHT, bDepthRefine ) )
     6054#if !QC_CU_NBDV_D0181
    52456055      return;
     6056#else
     6057      return true;
     6058#endif
    52466059  }
    52476060
     
    52626075    bCheckMcpDv = true;
    52636076    if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_LEFTBELOW, bDepthRefine ) )
     6077#if !QC_CU_NBDV_D0181
    52646078      return;
     6079#else
     6080      return true;
     6081#endif
    52656082  }
    52666083
     
    52826099    bCheckMcpDv = (( getAddr() - pcTmpCU->getAddr() ) <= 1);
    52836100    if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_ABOVELEFT, bDepthRefine ) )
     6101#if !QC_CU_NBDV_D0181
    52846102      return;
     6103#else
     6104      return true;
     6105#endif
    52856106  }
    52866107
     
    52976118          clipMv( cDispVec );
    52986119
    5299           TComPic* picDepth = getSlice()->getRefPicBaseDepth();
     6120          TComPic* picDepth = NULL;
     6121#if MERL_VSP_NBDV_RefVId_Fix_D0166
     6122          Int refPOC = getSlice()->getPOC();
     6123          picDepth = getSlice()->getDepthRefPic(0, refPOC);
     6124          assert(picDepth!=NULL);
     6125#else
     6126          picDepth = getSlice()->getRefPicBaseDepth();
     6127#endif
     6128
     6129#if QC_CU_NBDV_D0181 && MERL_VSP_C0152
     6130          pDInfo->m_acMvCandNoRef[pDInfo->iN] = cDispVec;
     6131#endif
    53006132          if (picDepth && bDepthRefine)
     6133#if MERL_VSP_NBDV_RefVId_Fix_D0166
     6134            estimateDVFromDM(0, uiPartIdx, picDepth, uiPartAddr, &cDispVec, true); // from base view
     6135#else
    53016136            estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cDispVec, true);
    5302 
    5303           pDInfo->m_acMvCand[ pDInfo->iN]   = cDispVec;
     6137#endif
     6138
     6139#if MERL_VSP_NBDV_RefVId_Fix_D0166 //if DVMCP is used, do a local reference frame list and idx search
     6140          Int refFrmIdx = 0;
     6141          RefPicList privateRefPicList = REF_PIC_LIST_0 ;
     6142          getRefListAndRefFrmIdx(0, privateRefPicList, refFrmIdx); // find the reference picture from base view
     6143
     6144          pDInfo->m_aListIdx[ pDInfo->iN ]  = privateRefPicList;
     6145          pDInfo->m_aRefIdx [ pDInfo->iN ]  = -1-refFrmIdx;
     6146          assert(pDInfo->m_aRefIdx [ pDInfo->iN ] < 0);
     6147#endif
     6148
     6149          pDInfo->m_acMvCand[ pDInfo->iN ]  = cDispVec;
    53046150          pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0;
     6151#if !QC_CU_NBDV_D0181
    53056152          return;
     6153#else
     6154          return true;
     6155#endif
    53066156        }
    53076157      }
    53086158    }
    53096159  }
     6160
     6161#if SEC_DEFAULT_DV_D0112
     6162  {
     6163    TComPic* picDepth = NULL;
     6164    TComMv defaultDV(0, 0);
     6165
     6166#if MERL_VSP_NBDV_RefVId_Fix_D0166
     6167    Int refPOC = getSlice()->getPOC();
     6168    picDepth = getSlice()->getDepthRefPic(0, refPOC);
     6169    assert(picDepth!=NULL);
     6170#else
     6171    picDepth = getSlice()->getRefPicBaseDepth();
     6172#endif
     6173
     6174#if MERL_General_Fix
     6175#if QC_CU_NBDV_D0181 && MERL_VSP_C0152
     6176    pDInfo->m_acMvCandNoRef[pDInfo->iN] = defaultDV;
     6177#endif
     6178#endif
     6179
     6180    if (picDepth && bDepthRefine)
     6181    {
     6182#if MERL_VSP_NBDV_RefVId_Fix_D0166
     6183      estimateDVFromDM(0, uiPartIdx, picDepth, uiPartAddr, &defaultDV, true); // from base view
     6184#else
     6185      estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &defaultDV, true);
     6186#endif
     6187    }
     6188
     6189#if MERL_VSP_NBDV_RefVId_Fix_D0166
     6190    Int refFrmIdx = 0;
     6191    RefPicList privateRefPicList = REF_PIC_LIST_0 ;
     6192    getRefListAndRefFrmIdx(0, privateRefPicList, refFrmIdx); // find the reference picture from base view
     6193
     6194    pDInfo->m_aListIdx[ pDInfo->iN ]  = privateRefPicList;
     6195    pDInfo->m_aRefIdx [ pDInfo->iN ]  = -1-refFrmIdx;
     6196    assert(pDInfo->m_aRefIdx [ pDInfo->iN ] < 0);
     6197#endif
     6198    pDInfo->m_acMvCand[pDInfo->iN] = defaultDV;
     6199    pDInfo->m_aVIdxCan[pDInfo->iN] = 0;
     6200#if MERL_VSP_NBDV_RefVId_Fix_D0166  // Bug fix for Samsung code.
     6201    pDInfo->iN++;
     6202#endif
     6203  }
     6204#endif
     6205
     6206#if QC_CU_NBDV_D0181
     6207  return false;
     6208#else
    53106209  return;
     6210#endif
    53116211}
    53126212#endif
     
    53226222 */
    53236223#if H3D_IVMP
     6224#if SEC_TWO_CANDIDATES_FOR_AMVP_D0122
    53246225Void TComDataCU::fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo, Int iMVPIdx)
    53256226{
     6227    fillMvpCandBase(uiPartIdx, uiPartAddr, eRefPicList, iRefIdx, pInfo);
     6228}
     6229#else
     6230Void TComDataCU::fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo, Int iMVPIdx)
     6231{
     6232
    53266233  if (!m_pcSlice->getSPS()->getViewId() || !m_pcSlice->getSPS()->getMultiviewMvPredMode())
    53276234  {
     
    53506257      // Extension part
    53516258      DisInfo cDisInfo;
     6259#if QC_CU_NBDV_D0181
     6260      cDisInfo.iN = this->getDvInfo(0).iN;
     6261      cDisInfo.m_acMvCand[0]=this->getDvInfo(0).m_acMvCand[0];
     6262      cDisInfo.m_aVIdxCan[0] = this->getDvInfo(0).m_aVIdxCan[0];
     6263      cDisInfo.bDV = this->getDvInfo(0).bDV;
     6264#else
    53526265      cDisInfo.iN = 0;
    53536266#if FCO_DVP_REFINE_C0132_C0170
     
    53826295        cDisInfo.m_aVIdxCan[0] = 0;
    53836296      }
     6297#endif
    53846298      Int paiPdmRefIdx[4] = {-1, -1, -1, -1};
    53856299      Int iPdmDir[4]      = {-1, -1, -1, -1};
     
    54026316  }
    54036317}
     6318#endif
    54046319
    54056320
     
    57006615  }
    57016616 
    5702 #if MERL_VSP_C0152
     6617#if MERL_VSP_C0152&!QC_BVSP_CleanUP_D0191
    57036618  if(pcTmpCU != NULL && pcTmpCU->getVSPIndex(uiIdx))
    57046619  {
     
    58166731  }
    58176732
    5818 #if MERL_VSP_C0152
     6733#if MERL_VSP_C0152 &!QC_BVSP_CleanUP_D0191
    58196734  if(pcTmpCU->getVSPIndex(uiIdx))
    58206735  {
     
    59796894  TComDataCU *pColCU = pColPic->getCU( uiCUAddr );
    59806895  iColViewIdx = pColCU->getSlice()->getViewId();
    5981 #if MERL_VSP_C0152
     6896#if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191
    59826897  if( pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr) < 0)
    59836898  {
     
    70807995  memcpy( m_piVSPIndex + uiAbsPartIdxDst,  pcCU->getVSPIndex() + uiAbsPartIdxSrc, sizeof( m_piVSPIndex[0] ) * uiNumPartition );
    70817996#endif
     7997#if MERL_VSP_NBDV_RefVId_Fix_D0166
     7998  memcpy( m_piVSPDir   + uiAbsPartIdxDst,  pcCU->getVSPDir  () + uiAbsPartIdxSrc, sizeof( m_piVSPDir  [0] ) * uiNumPartition );
     7999#endif
    70828000
    70838001#if !MTK_UNCONSTRAINED_MVI_B0083
     
    71588076TComDataCU::getResidualSamples( UInt uiPartIdx, Bool bRecon, TComYuv* pcYuv )
    71598077{
     8078#if !QC_ARP_D0177
    71608079  TComResidualGenerator*  pcResidualGenerator = m_pcSlice->getSPS()->getResidualGenerator();
    71618080  ROFRS( pcResidualGenerator, false );
     8081#endif
     8082
    71628083#if H3D_NBDV
    71638084  DisInfo cDisInfo;
     8085#if !QC_CU_NBDV_D0181
    71648086  cDisInfo.iN = 0;
     8087#else
     8088  cDisInfo.bDV = false;
     8089#endif
    71658090  PartSize m_peSaved =  getPartitionSize( 0 );
    71668091  m_pePartSize[0] =  SIZE_2Nx2N;
     
    71828107  else
    71838108#endif
    7184 
     8109#if !QC_CU_NBDV_D0181
    71858110  getDisMvpCandNBDV( 0, 0,  &cDisInfo, false ); 
    7186 
    71878111  if( cDisInfo.iN == 0)
     8112#else
     8113  cDisInfo.bDV = getDvInfo(0).bDV;
     8114#if MERL_VSP_C0152
     8115  cDisInfo.m_acMvCand[0] = getDvInfo(0).m_acMvCandNoRef[0];
     8116#else
     8117  cDisInfo.m_acMvCand[0] = getDvInfo(0).m_acMvCand[0];
     8118#endif
     8119  cDisInfo.m_aVIdxCan[0] = 0;
     8120  cDisInfo.iN = getDvInfo(0).iN;
     8121  if( cDisInfo.bDV == false)
     8122#endif
    71888123  {
    71898124    m_pePartSize[0] = m_peSaved;
     
    71918126  }
    71928127  else
     8128#if QC_ARP_D0177
     8129  if(m_pcSlice->getSPS()->getUseAdvRP()) 
     8130  {
     8131     m_pePartSize[0] = m_peSaved;
     8132     return true;
     8133  }
     8134  else
     8135    return false;
     8136#else
    71938137  {
    71948138    Bool bAvailable = pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, cDisInfo.m_acMvCand[0], bRecon );       
     
    71968140    return bAvailable;
    71978141  }
     8142#endif
    71988143#else
    71998144  return pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, bRecon );
     
    72018146}
    72028147#endif
    7203 
     8148#if QC_ARP_D0177
     8149Void TComDataCU::setARPWSubParts ( UChar w, UInt uiAbsPartIdx, UInt uiDepth )
     8150{
     8151  assert( sizeof( *m_puhARPW) == 1 );
     8152  memset( m_puhARPW + uiAbsPartIdx, w, m_pcPic->getNumPartInCU() >> ( 2 * uiDepth ) );
     8153}
     8154#endif
    72048155#if LGE_EDGE_INTRA_A0070
    72058156Void TComDataCU::reconPartition( UInt uiAbsPartIdx, UInt uiDepth, Bool bLeft, UChar ucStartPos, UChar ucNumEdge, UChar* pucEdgeCode, Bool* pbRegion )
Note: See TracChangeset for help on using the changeset viewer.