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


Ignore:
Timestamp:
20 Feb 2013, 22:07:43 (12 years ago)
Author:
tech
Message:

Reintegrated branch 5.1-dev0 rev. 295.

File:
1 edited

Legend:

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

    r210 r296  
    5151#endif
    5252
     53#if MERL_VSP_C0152
     54
     55#define CHECK_ADD_YET(pcCURef,uiIdx,vspIdx) && !( (pcCURef)->getVSPIndex(uiIdx) == vspIdx && bVspMvZeroDone[vspIdx-1] )
     56
     57inline Void TComDataCU::xInheritVspMode( TComDataCU* pcCURef, UInt uiIdx, Bool* bVspMvZeroDone, Int iCount, Int* iVSPIndexTrue, TComMvField* pcMvFieldNeighbours, DisInfo* pDInfo )
     58{
     59  Int vspIdx = (Int) pcCURef->getVSPIndex(uiIdx);
     60  if( vspIdx != 0 )
     61  {
     62    Int idx = vspIdx - 1;
     63    bVspMvZeroDone[idx] = true;
     64    iVSPIndexTrue [idx] = iCount;
     65
     66    // no need to reset Inter Dir
     67
     68    // set MV using checked disparity
     69    if (vspIdx < 4)
     70    {
     71      pcMvFieldNeighbours[ iCount<<1].setMvField ( pDInfo->m_acMvCand[0],  NOT_VALID );
     72      if ( pcCURef->getSlice()->isInterB() )
     73      {
     74         pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField ( pDInfo->m_acMvCand[0],  NOT_VALID );
     75      }
     76    }
     77  }
     78}
     79
     80inline 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{
     83  if( ucVspMergePos == VSP_MERGE_POS )
     84  {
     85    Int idx = vspIdx - 1;
     86    {
     87      if( getSlice()->getSPS()->getViewId() != 0 && bVspMvZeroDone[idx] == false )
     88      {
     89        {
     90          abCandIsInter [iCount] = true;
     91          bVspMvZeroDone[idx] = true;
     92
     93          // get Inter Dir
     94          Int iInterDir = ((getSlice()->getNumRefIdx(REF_PIC_LIST_0) > 0 && getSlice()->getNumRefIdx(REF_PIC_LIST_1) > 0) ? 3 :
     95            (getSlice()->getNumRefIdx(REF_PIC_LIST_0) > 0 ? 1 : 2));
     96          puhInterDirNeighbours[iCount] = iInterDir; // The direction information does not matter
     97          // get Mv using checked disparity vector
     98          if (vspIdx < 4) // spatial
     99          {
     100            pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCand[0], NOT_VALID );
     101            if ( getSlice()->isInterB() )
     102            {
     103              pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCand[0], NOT_VALID );
     104            }
     105          }
     106          iVSPIndexTrue[idx] = iCount;
     107          if ( mrgCandIdx == iCount )
     108          {
     109            return false;
     110          }
     111          iCount ++;
     112        }
     113      }
     114    }
     115  }
     116  return true;
     117}
     118#endif
     119
    53120// ====================================================================================================================
    54121// Constructor / destructor / create / destroy
     
    79146#endif
    80147  m_puhMergeIndex      = NULL;
     148#if MERL_VSP_C0152
     149  m_piVSPIndex         = NULL;
     150#endif
    81151  m_puhLumaIntraDir    = NULL;
    82152  m_puhChromaIntraDir  = NULL;
     
    135205#if HHI_DMM_PRED_TEX
    136206  m_puiWedgePredTexTabIdx    = NULL;
     207#if LGE_DMM3_SIMP_C0044
     208  m_puiWedgePredTexIntraTabIdx = NULL;
     209#endif
    137210  m_piWedgePredTexDeltaDC1   = NULL;
    138211  m_piWedgePredTexDeltaDC2   = NULL;
     
    141214  m_piContourPredTexDeltaDC2 = NULL;
    142215#endif
    143 #if HHI_INTER_VIEW_RESIDUAL_PRED
     216#if H3D_IVRP
    144217  m_pbResPredAvailable = NULL;
    145218  m_pbResPredFlag      = NULL;
     
    182255  if ( !bDecSubCu )
    183256  {
    184 #if H0736_AVC_STYLE_QP_RANGE
    185257    m_phQP               = (Char*     )xMalloc(Char,     uiNumPartition);
    186 #else
    187     m_phQP               = (UChar*    )xMalloc(UChar,    uiNumPartition);
    188 #endif
    189258    m_puhDepth           = (UChar*    )xMalloc(UChar,    uiNumPartition);
    190259#if HHI_MPI
     
    213282#endif
    214283    m_puhMergeIndex      = (UChar* )xMalloc(UChar,  uiNumPartition);
    215 #if HHI_INTER_VIEW_RESIDUAL_PRED
     284#if MERL_VSP_C0152
     285    m_piVSPIndex         = (Char*  )xMalloc(Char,   uiNumPartition);
     286#endif
     287#if H3D_IVRP
    216288    m_pbResPredAvailable = (Bool*  )xMalloc(Bool,   uiNumPartition);
    217289    m_pbResPredFlag      = (Bool*  )xMalloc(Bool,   uiNumPartition);
     
    283355#if HHI_DMM_PRED_TEX
    284356    m_puiWedgePredTexTabIdx    = (UInt*)xMalloc(UInt, uiNumPartition);
     357#if LGE_DMM3_SIMP_C0044
     358    m_puiWedgePredTexIntraTabIdx    = (UInt*)xMalloc(UInt, uiNumPartition);
     359#endif
    285360    m_piWedgePredTexDeltaDC1   = (Int* )xMalloc(Int,  uiNumPartition);
    286361    m_piWedgePredTexDeltaDC2   = (Int* )xMalloc(Int,  uiNumPartition);
     
    364439    if ( m_pbICFlag           ) { xFree(m_pbICFlag);            m_pbICFlag          = NULL; }
    365440#endif
     441#if MERL_VSP_C0152
     442    if ( m_piVSPIndex         ) { xFree(m_piVSPIndex);          m_piVSPIndex        = NULL; }
     443#endif
    366444    if ( m_puhMergeIndex      ) { xFree(m_puhMergeIndex);       m_puhMergeIndex     = NULL; }
    367 #if HHI_INTER_VIEW_RESIDUAL_PRED
     445#if H3D_IVRP
    368446    if ( m_pbResPredAvailable ) { xFree(m_pbResPredAvailable);  m_pbResPredAvailable= NULL; }
    369447    if ( m_pbResPredFlag      ) { xFree(m_pbResPredFlag);       m_pbResPredFlag     = NULL; }
     
    408486#if HHI_DMM_PRED_TEX
    409487    if ( m_puiWedgePredTexTabIdx    ) { xFree(m_puiWedgePredTexTabIdx   ); m_puiWedgePredTexTabIdx    = NULL; }
     488#if LGE_DMM3_SIMP_C0044
     489    if ( m_puiWedgePredTexIntraTabIdx ) { xFree(m_puiWedgePredTexIntraTabIdx); m_puiWedgePredTexIntraTabIdx    = NULL; }
     490#endif
    410491    if ( m_piWedgePredTexDeltaDC1   ) { xFree(m_piWedgePredTexDeltaDC1  ); m_piWedgePredTexDeltaDC1   = NULL; }
    411492    if ( m_piWedgePredTexDeltaDC2   ) { xFree(m_piWedgePredTexDeltaDC2  ); m_piWedgePredTexDeltaDC2   = NULL; }
     
    463544  this->height = src.height;
    464545  ::memcpy(this->isBorderAvailable, src.isBorderAvailable, sizeof(Bool)*((Int)NUM_SGU_BORDER));
    465 #if LCU_SYNTAX_ALF
    466546  this->allBordersAvailable = src.allBordersAvailable;
    467 #endif
    468547
    469548  return *this;
     
    500579  m_uiTotalBins        = 0;
    501580  m_uiNumPartition     = pcPic->getNumPartInCU();
    502 #if BURST_IPCM
    503581  m_numSucIPCM       = 0;
    504582  m_lastCUSucIPCMFlag   = false;
    505 #endif
    506583
    507584  for(int i=0; i<pcPic->getNumPartInCU(); i++)
     
    558635#endif
    559636    m_puhMergeIndex[ui]=pcFrom->m_puhMergeIndex[ui];
     637#if MERL_VSP_C0152
     638    m_piVSPIndex[ui] = pcFrom->m_piVSPIndex[ui];
     639#endif
    560640    m_puhLumaIntraDir[ui]=pcFrom->m_puhLumaIntraDir[ui];
    561641    m_puhChromaIntraDir[ui]=pcFrom->m_puhChromaIntraDir[ui];
     
    598678#endif
    599679    memset( m_puhMergeIndex     + firstElement, 0,                        numElements * sizeof( *m_puhMergeIndex ) );
     680#if MERL_VSP_C0152
     681    memset( m_piVSPIndex        + firstElement, 0,                        numElements * sizeof( *m_piVSPIndex ) );
     682#endif
    600683    memset( m_puhLumaIntraDir   + firstElement, 2,                        numElements * sizeof( *m_puhLumaIntraDir ) );
    601684    memset( m_puhChromaIntraDir + firstElement, 0,                        numElements * sizeof( *m_puhChromaIntraDir ) );
     
    618701#if HHI_DMM_PRED_TEX
    619702    memset( m_puiWedgePredTexTabIdx    + firstElement, 0, sizeof( UInt ) * numElements );
     703#if LGE_DMM3_SIMP_C0044
     704    memset( m_puiWedgePredTexIntraTabIdx + firstElement, 0, sizeof( UInt ) * numElements );
     705#endif
    620706    memset( m_piWedgePredTexDeltaDC1   + firstElement, 0, sizeof( Int  ) * numElements );
    621707    memset( m_piWedgePredTexDeltaDC2   + firstElement, 0, sizeof( Int  ) * numElements );
     
    627713    memset (m_pbRenderable             + firstElement, false, sizeof( Bool ) * numElements) ;
    628714#endif
    629 #if HHI_INTER_VIEW_RESIDUAL_PRED
     715#if H3D_IVRP
    630716    memset( m_pbResPredAvailable       + firstElement, 0    , sizeof( Bool ) * numElements );
    631717    memset( m_pbResPredFlag            + firstElement, 0    , sizeof( Bool ) * numElements );
     
    720806}
    721807
    722 #if H0736_AVC_STYLE_QP_RANGE
    723808/** initialize prediction data with enabling sub-LCU-level delta QP
    724809*\param  uiDepth  depth of the current CU
     
    729814*/
    730815Void TComDataCU::initEstData( UInt uiDepth, Int qp )
    731 #else
    732 /** initialize prediction data with enabling sub-LCU-level delta QP
    733 *\param  uiDepth  depth of the current CU
    734 *\param  uiQP     QP for the current CU
    735 *- set CU width and CU height according to depth
    736 *- set QP value according to input QP
    737 *- set last-coded QP value according to input last-coded QP
    738 */
    739 Void TComDataCU::initEstData( UInt uiDepth, UInt uiQP )
    740 #endif
    741816{
    742817  m_dTotalCost         = MAX_DOUBLE;
     
    770845      m_pePredMode[ui] = MODE_NONE;
    771846      m_pbIPCMFlag[ui] = 0;
    772 #if H0736_AVC_STYLE_QP_RANGE
    773847      m_phQP[ui] = qp;
    774 #else
    775       m_phQP[ui] = uiQP;
    776 #endif
    777848      m_puiAlfCtrlFlag[ui]= false;
    778849      m_pbMergeFlag[ui] = 0;
     
    781852#endif
    782853      m_puhMergeIndex[ui] = 0;
    783 #if HHI_INTER_VIEW_RESIDUAL_PRED
     854#if MERL_VSP_C0152
     855      m_piVSPIndex[ui] = 0;
     856#endif
     857#if H3D_IVRP
    784858      m_pbResPredAvailable[ui] = 0;
    785859      m_pbResPredFlag[ui]      = 0;
     
    803877#if HHI_DMM_PRED_TEX
    804878    m_puiWedgePredTexTabIdx   [ui] = 0;
     879#if LGE_DMM3_SIMP_C0044
     880    m_puiWedgePredTexIntraTabIdx [ui] = 0;
     881#endif
    805882    m_piWedgePredTexDeltaDC1  [ui] = 0;
    806883    m_piWedgePredTexDeltaDC2  [ui] = 0;
     
    845922
    846923// initialize Sub partition
    847 #if H0736_AVC_STYLE_QP_RANGE
    848924Void TComDataCU::initSubCU( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp )
    849 #else
    850 Void TComDataCU::initSubCU( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, UInt uiQP )
    851 #endif
    852925{
    853926  assert( uiPartUnitIdx<4 );
     
    869942  m_uiNumPartition     = pcCU->getTotalNumPart() >> 2;
    870943
    871 #if BURST_IPCM
    872944  m_numSucIPCM       = 0;
    873945  m_lastCUSucIPCMFlag   = false;
    874 #endif
    875946
    876947  Int iSizeInUchar = sizeof( UChar  ) * m_uiNumPartition;
    877948  Int iSizeInBool  = sizeof( Bool   ) * m_uiNumPartition;
    878 
    879 #if H0736_AVC_STYLE_QP_RANGE
     949#if MERL_VSP_C0152
     950  Int iSizeInChar  = sizeof( Char   ) * m_uiNumPartition;
     951#endif
     952
    880953  Int sizeInChar = sizeof( Char  ) * m_uiNumPartition;
    881954  memset( m_phQP,              qp,  sizeInChar );
    882 #else
    883   memset( m_phQP,              uiQP, iSizeInUchar );
    884 #endif
    885955
    886956  memset( m_puiAlfCtrlFlag,     0, iSizeInBool );
     
    893963#endif
    894964  memset( m_puhMergeIndex,      0, iSizeInUchar );
    895 #if HHI_INTER_VIEW_RESIDUAL_PRED
     965#if MERL_VSP_C0152
     966  memset( m_piVSPIndex,         0, iSizeInChar );
     967#endif
     968#if H3D_IVRP
    896969  memset( m_pbResPredAvailable, 0, iSizeInBool  );
    897970  memset( m_pbResPredFlag,      0, iSizeInBool  );
     
    921994#if HHI_DMM_PRED_TEX
    922995  memset( m_puiWedgePredTexTabIdx,    0, sizeof( UInt ) * m_uiNumPartition );
     996#if LGE_DMM3_SIMP_C0044
     997  memset( m_puiWedgePredTexIntraTabIdx, 0, sizeof( UInt ) * m_uiNumPartition );
     998#endif
    923999  memset( m_piWedgePredTexDeltaDC1,   0, sizeof( Int  ) * m_uiNumPartition );
    9241000  memset( m_piWedgePredTexDeltaDC2,   0, sizeof( Int  ) * m_uiNumPartition );
     
    9731049#endif
    9741050      m_puhMergeIndex[ui]=pcCU->m_puhMergeIndex[uiPartOffset+ui];
     1051#if MERL_VSP_C0152
     1052      m_piVSPIndex[ui]=pcCU->m_piVSPIndex[uiPartOffset+ui];
     1053#endif
    9751054      m_puhLumaIntraDir[ui]=pcCU->m_puhLumaIntraDir[uiPartOffset+ui];
    9761055      m_puhChromaIntraDir[ui]=pcCU->m_puhChromaIntraDir[uiPartOffset+ui];
     
    9921071#if HHI_DMM_PRED_TEX
    9931072      m_puiWedgePredTexTabIdx   [ui]=pcCU->getWedgePredTexTabIdx    (uiPartOffset+ui);
     1073#if LGE_DMM3_SIMP_C0044
     1074      m_puiWedgePredTexIntraTabIdx [ui]=pcCU->getWedgePredTexIntraTabIdx (uiPartOffset+ui);
     1075#endif
    9941076      m_piWedgePredTexDeltaDC1  [ui]=pcCU->getWedgePredTexDeltaDC1  (uiPartOffset+ui);
    9951077      m_piWedgePredTexDeltaDC2  [ui]=pcCU->getWedgePredTexDeltaDC2  (uiPartOffset+ui);
     
    9981080      m_piContourPredTexDeltaDC2[ui]=pcCU->getContourPredTexDeltaDC2(uiPartOffset+ui);
    9991081#endif   
    1000 #if HHI_INTER_VIEW_RESIDUAL_PRED
     1082#if H3D_IVRP
    10011083      m_pbResPredAvailable[ui] = pcCU->m_pbResPredAvailable[ uiPartOffset + ui ];
    10021084      m_pbResPredFlag     [ui] = pcCU->m_pbResPredFlag     [ uiPartOffset + ui ];
     
    11171199#endif
    11181200  m_puhMergeIndex       = pcCU->getMergeIndex()       + uiPart;
    1119 #if HHI_INTER_VIEW_RESIDUAL_PRED
     1201#if MERL_VSP_C0152
     1202  m_piVSPIndex          = pcCU->getVSPIndex()         + uiPart;
     1203#endif
     1204#if H3D_IVRP
    11201205  m_pbResPredAvailable  = pcCU->getResPredAvail()     + uiPart;
    11211206  m_pbResPredFlag       = pcCU->getResPredFlag ()     + uiPart;
     
    11931278#if HHI_DMM_PRED_TEX
    11941279  m_puiWedgePredTexTabIdx    = pcCU->getWedgePredTexTabIdx()     + uiPart;   
     1280#if LGE_DMM3_SIMP_C0044
     1281  m_puiWedgePredTexIntraTabIdx = pcCU->getWedgePredTexIntraTabIdx() + uiPart;   
     1282#endif
    11951283  m_piWedgePredTexDeltaDC1   = pcCU->getWedgePredTexDeltaDC1()   + uiPart;   
    11961284  m_piWedgePredTexDeltaDC2   = pcCU->getWedgePredTexDeltaDC2()   + uiPart;   
     
    12271315  m_uiCUAddr           = pcCU->getAddr();
    12281316  m_uiAbsIdxInLCU      = uiAbsPartIdx;
    1229  
     1317
    12301318  Int iRastPartIdx     = g_auiZscanToRaster[uiAbsPartIdx];
    12311319  m_uiCUPelX           = pcCU->getCUPelX() + m_pcPic->getMinCUWidth ()*( iRastPartIdx % m_pcPic->getNumPartInWidth() );
     
    12571345#endif
    12581346  m_puhMergeIndex      = pcCU->getMergeIndex()            + uiAbsPartIdx;
    1259 #if HHI_INTER_VIEW_RESIDUAL_PRED
     1347#if MERL_VSP_C0152
     1348  m_piVSPIndex         = pcCU->getVSPIndex()              + uiAbsPartIdx;
     1349#endif
     1350#if H3D_IVRP
    12601351  m_pbResPredAvailable = pcCU->getResPredAvail()          + uiAbsPartIdx;
    12611352  m_pbResPredFlag      = pcCU->getResPredFlag ()          + uiAbsPartIdx;
     
    12881379  Int iSizeInUchar  = sizeof( UChar ) * uiNumPartition;
    12891380  Int iSizeInBool   = sizeof( Bool  ) * uiNumPartition;
    1290  
    1291 #if H0736_AVC_STYLE_QP_RANGE
     1381#if MERL_VSP_C0152
     1382  Int iSizeInChar   = sizeof( Char )  * uiNumPartition;
     1383#endif
     1384 
    12921385  Int sizeInChar  = sizeof( Char ) * uiNumPartition;
    12931386  memcpy( m_phQP       + uiOffset, pcCU->getQP(),             sizeInChar                        );
    1294 #else
    1295   memcpy( m_phQP       + uiOffset, pcCU->getQP(),             iSizeInUchar                        );
    1296 #endif
    12971387  memcpy( m_pePartSize + uiOffset, pcCU->getPartitionSize(),  sizeof( *m_pePartSize ) * uiNumPartition );
    12981388  memcpy( m_pePredMode + uiOffset, pcCU->getPredictionMode(), sizeof( *m_pePredMode ) * uiNumPartition );
     
    13061396#endif
    13071397  memcpy( m_puhMergeIndex       + uiOffset, pcCU->getMergeIndex(),        iSizeInUchar );
    1308 #if HHI_INTER_VIEW_RESIDUAL_PRED
     1398#if MERL_VSP_C0152
     1399  memcpy( m_piVSPIndex          + uiOffset, pcCU->getVSPIndex(),          iSizeInChar );
     1400#endif
     1401#if H3D_IVRP
    13091402  memcpy( m_pbResPredAvailable  + uiOffset, pcCU->getResPredAvail(),      iSizeInBool  );
    13101403  memcpy( m_pbResPredFlag       + uiOffset, pcCU->getResPredFlag(),       iSizeInBool  );
     
    13751468#if HHI_DMM_PRED_TEX
    13761469  memcpy( m_puiWedgePredTexTabIdx    + uiOffset, pcCU->getWedgePredTexTabIdx(),     sizeof( UInt ) * uiNumPartition );
     1470#if LGE_DMM3_SIMP_C0044
     1471  memcpy( m_puiWedgePredTexIntraTabIdx + uiOffset, pcCU->getWedgePredTexIntraTabIdx(), sizeof( UInt ) * uiNumPartition );
     1472#endif
    13771473  memcpy( m_piWedgePredTexDeltaDC1   + uiOffset, pcCU->getWedgePredTexDeltaDC1(),   sizeof( Int  ) * uiNumPartition );
    13781474  memcpy( m_piWedgePredTexDeltaDC2   + uiOffset, pcCU->getWedgePredTexDeltaDC2(),   sizeof( Int  ) * uiNumPartition );
     
    14191515  Int iSizeInUchar  = sizeof( UChar ) * m_uiNumPartition;
    14201516  Int iSizeInBool   = sizeof( Bool  ) * m_uiNumPartition;
    1421  
    1422 #if H0736_AVC_STYLE_QP_RANGE
     1517#if MERL_VSP_C0152
     1518  Int iSizeInChar   = sizeof( Char  ) * m_uiNumPartition;
     1519#endif
     1520 
    14231521  Int sizeInChar  = sizeof( Char ) * m_uiNumPartition;
    14241522  memcpy( rpcCU->getQP() + m_uiAbsIdxInLCU, m_phQP, sizeInChar  );
    1425 #else
    1426   memcpy( rpcCU->getQP() + m_uiAbsIdxInLCU, m_phQP, iSizeInUchar );
    1427 #endif
    14281523
    14291524  memcpy( rpcCU->getPartitionSize()  + m_uiAbsIdxInLCU, m_pePartSize, sizeof( *m_pePartSize ) * m_uiNumPartition );
     
    14401535#endif
    14411536  memcpy( rpcCU->getMergeIndex()        + m_uiAbsIdxInLCU, m_puhMergeIndex,       iSizeInUchar );
    1442 #if HHI_INTER_VIEW_RESIDUAL_PRED
     1537#if MERL_VSP_C0152
     1538  memcpy( rpcCU->getVSPIndex()          + m_uiAbsIdxInLCU, m_piVSPIndex,         iSizeInChar );
     1539#endif
     1540#if H3D_IVRP
    14431541  memcpy( rpcCU->getResPredAvail()      + m_uiAbsIdxInLCU, m_pbResPredAvailable,  iSizeInBool  );
    14441542  memcpy( rpcCU->getResPredFlag()       + m_uiAbsIdxInLCU, m_pbResPredFlag,       iSizeInBool  );
     
    15011599#if HHI_DMM_PRED_TEX
    15021600  memcpy( rpcCU->getWedgePredTexTabIdx()     + m_uiAbsIdxInLCU, m_puiWedgePredTexTabIdx,    sizeof( UInt ) * m_uiNumPartition );
     1601#if LGE_DMM3_SIMP_C0044
     1602  memcpy( rpcCU->getWedgePredTexIntraTabIdx() + m_uiAbsIdxInLCU, m_puiWedgePredTexIntraTabIdx,    sizeof( UInt ) * m_uiNumPartition );
     1603#endif
    15031604  memcpy( rpcCU->getWedgePredTexDeltaDC1()   + m_uiAbsIdxInLCU, m_piWedgePredTexDeltaDC1,   sizeof( Int  ) * m_uiNumPartition );
    15041605  memcpy( rpcCU->getWedgePredTexDeltaDC2()   + m_uiAbsIdxInLCU, m_piWedgePredTexDeltaDC2,   sizeof( Int  ) * m_uiNumPartition );
     
    15471648  Int iSizeInUchar  = sizeof( UChar  ) * uiQNumPart;
    15481649  Int iSizeInBool   = sizeof( Bool   ) * uiQNumPart;
    1549  
    1550 #if H0736_AVC_STYLE_QP_RANGE
     1650#if MERL_VSP_C0152
     1651  Int iSizeInChar   = sizeof( Char   ) * uiQNumPart;
     1652#endif
     1653 
    15511654  Int sizeInChar  = sizeof( Char ) * uiQNumPart;
    15521655  memcpy( rpcCU->getQP() + uiPartOffset, m_phQP, sizeInChar );
    1553 #else
    1554   memcpy( rpcCU->getQP() + uiPartOffset, m_phQP, iSizeInUchar );
    1555 #endif 
    15561656  memcpy( rpcCU->getPartitionSize()  + uiPartOffset, m_pePartSize, sizeof( *m_pePartSize ) * uiQNumPart );
    15571657#if HHI_INTERVIEW_SKIP
     
    15661666#endif
    15671667  memcpy( rpcCU->getMergeIndex()        + uiPartOffset, m_puhMergeIndex,       iSizeInUchar );
    1568 #if HHI_INTER_VIEW_RESIDUAL_PRED
     1668#if MERL_VSP_C0152
     1669  memcpy( rpcCU->getVSPIndex()          + uiPartOffset, m_piVSPIndex,         iSizeInChar );
     1670#endif
     1671#if H3D_IVRP
    15691672  memcpy( rpcCU->getResPredAvail()      + uiPartOffset, m_pbResPredAvailable,  iSizeInBool  );
    15701673  memcpy( rpcCU->getResPredFlag()       + uiPartOffset, m_pbResPredFlag,       iSizeInBool  );
     
    16281731#if HHI_DMM_PRED_TEX
    16291732  memcpy( rpcCU->getWedgePredTexTabIdx()     + uiPartOffset, m_puiWedgePredTexTabIdx,    sizeof( UInt ) * uiQNumPart );
     1733#if LGE_DMM3_SIMP_C0044
     1734  memcpy( rpcCU->getWedgePredTexIntraTabIdx() + uiPartOffset, m_puiWedgePredTexIntraTabIdx, sizeof( UInt ) * uiQNumPart );
     1735#endif
    16301736  memcpy( rpcCU->getWedgePredTexDeltaDC1()   + uiPartOffset, m_piWedgePredTexDeltaDC1,   sizeof( Int  ) * uiQNumPart );
    16311737  memcpy( rpcCU->getWedgePredTexDeltaDC2()   + uiPartOffset, m_piWedgePredTexDeltaDC2,   sizeof( Int  ) * uiQNumPart );
     
    17041810       (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || m_pcCULeft->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)))
    17051811      ||
    1706 #if !REMOVE_TILE_DEPENDENCE
    1707        (bEnforceTileRestriction && ( m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))  )  )
    1708 #else
    17091812       (bEnforceTileRestriction && ( m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL || (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))  )  )
    1710 #endif
    17111813      )
    17121814  {
     
    17661868       (bEnforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || m_pcCUAbove->getSCUAddr()+uiAPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)))
    17671869      ||
    1768 #if !REMOVE_TILE_DEPENDENCE
    1769        (bEnforceTileRestriction &&(m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))))
    1770 #else
    17711870       (bEnforceTileRestriction &&(m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL || (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))))
    1772 #endif
    17731871      )
    17741872  {
     
    18171915  if ( (bEnforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    18181916       m_pcCUAbove->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    1819 #if !REMOVE_TILE_DEPENDENCE
    1820        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1821 #else
    18221917       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1823 #endif
    18241918       ))||
    18251919       (bEnforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    18261920       m_pcCUAbove->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    1827 #if !REMOVE_TILE_DEPENDENCE
    1828        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1829 #else
    18301921       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1831 #endif
    18321922       ))
    18331923     )
     
    18431933  if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    18441934       m_pcCULeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    1845 #if !REMOVE_TILE_DEPENDENCE
    1846        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1847 #else
    18481935       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1849 #endif
    18501936       ))||
    18511937       (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    18521938       m_pcCULeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    1853 #if !REMOVE_TILE_DEPENDENCE
    1854        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1855 #else
    18561939       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1857 #endif
    18581940       ))
    18591941     )
     
    18711953  if ( (bEnforceSliceRestriction && (m_pcCUAboveLeft==NULL || m_pcCUAboveLeft->getSlice()==NULL ||
    18721954       m_pcCUAboveLeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    1873 #if !REMOVE_TILE_DEPENDENCE
    1874        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveLeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1875 #else
    18761955       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveLeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1877 #endif
    18781956       ))||
    18791957       (bEnforceEntropySliceRestriction && (m_pcCUAboveLeft==NULL || m_pcCUAboveLeft->getSlice()==NULL ||
    18801958       m_pcCUAboveLeft->getSCUAddr()+uiALPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    1881 #if !REMOVE_TILE_DEPENDENCE
    1882        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveLeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1883 #else
    18841959       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveLeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1885 #endif
    18861960       ))
    18871961     )
     
    19432017  if ( (bEnforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    19442018       m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    1945 #if !REMOVE_TILE_DEPENDENCE
    1946        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1947 #else
    19482019       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1949 #endif
    19502020       ))||
    19512021       (bEnforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    19522022       m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    1953 #if !REMOVE_TILE_DEPENDENCE
    1954        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1955 #else
    19562023       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1957 #endif
    19582024       ))
    19592025     )
     
    19782044       m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) ||
    19792045       m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    1980 #if !REMOVE_TILE_DEPENDENCE
    1981        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1982 #else
    19832046       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1984 #endif
    19852047       ))||
    19862048       (bEnforceEntropySliceRestriction && (m_pcCUAboveRight==NULL || m_pcCUAboveRight->getSlice()==NULL ||
    19872049       m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) ||
    19882050       m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    1989 #if !REMOVE_TILE_DEPENDENCE
    1990        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1991 #else
    19922051       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    1993 #endif
    19942052       ))
    19952053     )
     
    20462104  if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    20472105       m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    2048 #if !REMOVE_TILE_DEPENDENCE
    2049        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2050 #else
    20512106       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2052 #endif
    20532107       ))||
    20542108       (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    20552109       m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    2056 #if !REMOVE_TILE_DEPENDENCE
    2057        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2058 #else
    20592110       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2060 #endif
    20612111       ))
    20622112     )
     
    21172167  if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    21182168       m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    2119 #if !REMOVE_TILE_DEPENDENCE
    2120        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2121 #else
    21222169       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2123 #endif
    21242170       ))||
    21252171       (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    21262172       m_pcCULeft->getSCUAddr()+uiBLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    2127 #if !REMOVE_TILE_DEPENDENCE
    2128        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2129 #else
    21302173       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2131 #endif
    21322174       ))
    21332175     )
     
    21892231  if ( (bEnforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    21902232       m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    2191 #if !REMOVE_TILE_DEPENDENCE
    2192        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2193 #else
    21942233       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2195 #endif
    21962234       ))||
    21972235       (bEnforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    21982236       m_pcCUAbove->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    2199 #if !REMOVE_TILE_DEPENDENCE
    2200        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2201 #else
    22022237       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2203 #endif
    22042238       ))
    22052239     )
     
    22202254       m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) ||
    22212255       m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiCurrPartUnitIdx)||
    2222 #if !REMOVE_TILE_DEPENDENCE
    2223        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2224 #else
    22252256       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2226 #endif
    22272257       ))||
    22282258       (bEnforceEntropySliceRestriction && (m_pcCUAboveRight==NULL || m_pcCUAboveRight->getSlice()==NULL ||
    22292259       m_pcPic->getPicSym()->getInverseCUOrderMap( m_pcCUAboveRight->getAddr()) > m_pcPic->getPicSym()->getInverseCUOrderMap( getAddr()) ||
    22302260       m_pcCUAboveRight->getSCUAddr()+uiARPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiCurrPartUnitIdx)||
    2231 #if !REMOVE_TILE_DEPENDENCE
    2232        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2233 #else
    22342261       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAboveRight->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2235 #endif
    22362262       ))
    22372263     )
     
    22802306  if ( (bEnforceSliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    22812307       m_pcCULeft->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(uiAbsZorderQpMinCUIdx)||
    2282 #if !REMOVE_TILE_DEPENDENCE
    2283        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2284 #else
    22852308       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2286 #endif
    22872309       ))||
    22882310       (bEnforceEntropySliceRestriction && (m_pcCULeft==NULL || m_pcCULeft->getSlice()==NULL ||
    22892311       m_pcCULeft->getSCUAddr()+uiLPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiAbsZorderQpMinCUIdx)||
    2290 #if !REMOVE_TILE_DEPENDENCE
    2291        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2292 #else
    22932312       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCULeft->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2294 #endif
    22952313       ))
    22962314     )
     
    22992317  }
    23002318
    2301 #if H0204_QP_PREDICTION
    23022319  if ( m_pcCULeft && m_pcCULeft->getAddr() != getAddr() )
    23032320  {
    23042321    return NULL;
    23052322  }
    2306 #endif
    23072323
    23082324  return m_pcCULeft;
    23092325}
    23102326
    2311 #if H0204_QP_PREDICTION
    23122327/** Get Above QpMinCu
    23132328*\param   aPartUnitIdx
     
    23472362  if ( (enforceSliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    23482363       m_pcCUAbove->getSCUAddr()+aPartUnitIdx < m_pcPic->getCU( getAddr() )->getSliceStartCU(absZorderQpMinCUIdx)||
    2349 #if !REMOVE_TILE_DEPENDENCE
    2350        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2351 #else
    23522364       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2353 #endif
    23542365       ))||
    23552366       (enforceEntropySliceRestriction && (m_pcCUAbove==NULL || m_pcCUAbove->getSlice()==NULL ||
    23562367       m_pcCUAbove->getSCUAddr()+aPartUnitIdx < m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(absZorderQpMinCUIdx)||
    2357 #if !REMOVE_TILE_DEPENDENCE
    2358        (m_pcPic->getPicSym()->getTileBoundaryIndependenceIdr() && m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2359 #else
    23602368       (m_pcPic->getPicSym()->getTileIdxMap( m_pcCUAbove->getAddr() ) != m_pcPic->getPicSym()->getTileIdxMap(getAddr()))
    2361 #endif
    23622369       ))
    23632370     )
     
    23732380  return m_pcCUAbove;
    23742381}
    2375 #endif
    2376 
    2377 #if H0736_AVC_STYLE_QP_RANGE
     2382
    23782383/** Get reference QP from left QpMinCu or latest coded QP
    23792384*\param   uiCurrAbsIdxInLCU
     
    23812386*/
    23822387Char TComDataCU::getRefQP( UInt uiCurrAbsIdxInLCU )
    2383 #else
    2384 /** Get reference QP from left QpMinCu or latest coded QP
    2385 *\param   uiCurrAbsIdxInLCU
    2386 *\returns UChar   reference QP value
    2387 */
    2388 UChar TComDataCU::getRefQP( UInt uiCurrAbsIdxInLCU )
    2389 #endif
    2390 {
    2391 #if H0204_QP_PREDICTION
     2388{
    23922389  UInt        lPartIdx, aPartIdx;
    23932390  lPartIdx = 0;
     
    23962393  TComDataCU* cUAbove = getQpMinCuAbove( aPartIdx, m_uiAbsIdxInLCU + uiCurrAbsIdxInLCU );
    23972394  return (((cULeft? cULeft->getQP( lPartIdx ): getLastCodedQP( uiCurrAbsIdxInLCU )) + (cUAbove? cUAbove->getQP( aPartIdx ): getLastCodedQP( uiCurrAbsIdxInLCU )) + 1) >> 1);
    2398 #else
    2399   // Left CU
    2400   TComDataCU* pcCULeft;
    2401   UInt        uiLPartIdx;
    2402   pcCULeft = getQpMinCuLeft( uiLPartIdx, m_uiAbsIdxInLCU + uiCurrAbsIdxInLCU );
    2403   if ( pcCULeft )
    2404   {
    2405     return pcCULeft->getQP(uiLPartIdx);
    2406   }
    2407   // Last QP
    2408   return getLastCodedQP( uiCurrAbsIdxInLCU );
    2409 #endif
    24102395}
    24112396
     
    24222407}
    24232408
    2424 #if H0736_AVC_STYLE_QP_RANGE
    24252409Char TComDataCU::getLastCodedQP( UInt uiAbsPartIdx )
    2426 #else
    2427 UChar TComDataCU::getLastCodedQP( UInt uiAbsPartIdx )
    2428 #endif
    24292410{
    24302411  UInt uiQUPartIdxMask = ~((1<<(8-(getSlice()->getPPS()->getMaxCuDQPDepth()<<1)))-1);
     
    24632444Bool TComDataCU::isLosslessCoded(UInt absPartIdx)
    24642445{
    2465 #if H0736_AVC_STYLE_QP_RANGE
    24662446  return ( getSlice()->getSPS()->getUseLossless() && ((getQP(absPartIdx) + getSlice()->getSPS()->getQpBDOffsetY()) == 0) );
    2467 #else
    2468   return ( getSlice()->getSPS()->getUseLossless() && (getQP(absPartPIdx)  == 0) );
    2469 #endif
    24702447}
    24712448#endif
     
    24802457{
    24812458  uiModeList[0] = PLANAR_IDX;
    2482 #if LOGI_INTRA_NAME_3MPM
    24832459  uiModeList[1] = VER_IDX;
    24842460  uiModeList[2] = HOR_IDX;
    2485 #else
    2486   uiModeList[1] = 1;
    2487   uiModeList[2] = 2;
    2488 #endif
    24892461  uiModeList[3] = DC_IDX;
    24902462  uiModeList[4] = LM_CHROMA_IDX;
     
    25002472    if( uiLumaMode == uiModeList[i] )
    25012473    {
    2502 #if LOGI_INTRA_NAME_3MPM
    25032474      uiModeList[i] = 34; // VER+8 mode
    2504 #else
    2505       uiModeList[i] = 7; // VER+8 mode
    2506 #endif
    25072475      break;
    25082476    }
     
    25262494  pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx );
    25272495 
    2528 #if DEFAULT_DC
    25292496  iLeftIntraDir  = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : DC_IDX ) : DC_IDX;
    2530 #else
    2531   iLeftIntraDir  = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : PLANAR_IDX ) : PLANAR_IDX;
    2532 #endif
    25332497#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    25342498  mapDMMtoIntraMode( iLeftIntraDir );
     
    25412505  pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx, true, true, false, true );
    25422506 
    2543 #if DEFAULT_DC
    25442507  iAboveIntraDir = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : DC_IDX ) : DC_IDX;
    2545 #else
    2546   iAboveIntraDir = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : PLANAR_IDX ) : PLANAR_IDX;
    2547 #endif
    25482508#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    25492509  mapDMMtoIntraMode( iAboveIntraDir );
     
    25532513#endif
    25542514 
    2555 #if LOGI_INTRA_NAME_3MPM
    25562515  uiPredNum = 3;
    25572516  if(iLeftIntraDir == iAboveIntraDir)
     
    25932552    }
    25942553  }
    2595 #else
    2596   Int iIdx  = getIntraSizeIdx(uiAbsPartIdx);
    2597  
    2598  
    2599   if ( iLeftIntraDir >= g_aucIntraModeNumAng[iIdx] )
    2600   {
    2601     iLeftIntraDir = PLANAR_IDX;
    2602   }
    2603  
    2604  
    2605   if ( iAboveIntraDir >= g_aucIntraModeNumAng[iIdx] )
    2606   {
    2607     iAboveIntraDir = PLANAR_IDX;
    2608   }
    2609  
    2610   if(iLeftIntraDir == iAboveIntraDir)
    2611   {
    2612     uiPredNum = 2;
    2613    
    2614     if( piMode )
    2615     {
    2616       *piMode = iLeftIntraDir;
    2617     }
    2618    
    2619     iAboveIntraDir = iLeftIntraDir == PLANAR_IDX ? DC_IDX : PLANAR_IDX; // DC or Planar
    2620    
    2621     assert( iLeftIntraDir != iAboveIntraDir );
    2622    
    2623     uiIntraDirPred[0] = min(iLeftIntraDir, iAboveIntraDir);
    2624     uiIntraDirPred[1] = max(iLeftIntraDir, iAboveIntraDir);
    2625   }
    2626   else
    2627   {
    2628     uiPredNum = 2;
    2629     uiIntraDirPred[0] = min(iLeftIntraDir, iAboveIntraDir);
    2630     uiIntraDirPred[1] = max(iLeftIntraDir, iAboveIntraDir);
    2631   }
    2632 #endif
    26332554 
    26342555  return uiPredNum;
     
    26802601  UInt quadtreeTUMaxDepth = getPredictionMode( absPartIdx ) == MODE_INTRA ? m_pcSlice->getSPS()->getQuadtreeTUMaxDepthIntra() : m_pcSlice->getSPS()->getQuadtreeTUMaxDepthInter();
    26812602  Int intraSplitFlag = ( getPredictionMode( absPartIdx ) == MODE_INTRA && partSize == SIZE_NxN ) ? 1 : 0;
    2682 #if G519_TU_AMP_NSQT_HARMONIZATION
    26832603  Int interSplitFlag = ((quadtreeTUMaxDepth == 1) && (getPredictionMode( absPartIdx ) == MODE_INTER) && (partSize != SIZE_2Nx2N) );
    2684 #else
    2685   Int interSplitFlag = ((quadtreeTUMaxDepth == 1) && (getPredictionMode( absPartIdx ) == MODE_INTER) && (partSize == SIZE_Nx2N || partSize == SIZE_2NxN) );
    2686 #endif
    26872604 
    26882605  UInt log2MinTUSizeInCU = 0;
     
    27062623
    27072624
    2708 #if HHI_INTER_VIEW_RESIDUAL_PRED
     2625#if H3D_IVRP
    27092626UInt
    27102627TComDataCU::getCtxResPredFlag( UInt uiAbsPartIdx )
     
    28532770}
    28542771
    2855 #if H0736_AVC_STYLE_QP_RANGE
    28562772Void TComDataCU::setQPSubParts( Int qp, UInt uiAbsPartIdx, UInt uiDepth )
    2857 #else
    2858 Void TComDataCU::setQPSubParts( UInt uiQP, UInt uiAbsPartIdx, UInt uiDepth )
    2859 #endif
    28602773{
    28612774  UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1);
     
    28662779    if( m_pcPic->getCU( getAddr() )->getEntropySliceStartCU(uiSCUIdx+getZorderIdxInCU()) == pcSlice->getEntropySliceCurStartCUAddr() )
    28672780    {
    2868 #if H0736_AVC_STYLE_QP_RANGE
    28692781      m_phQP[uiSCUIdx] = qp;
    2870 #else
    2871       m_phQP[uiSCUIdx] = uiQP;
    2872 #endif
    28732782    }
    28742783  }
     
    30332942}
    30342943
    3035 #if HHI_INTER_VIEW_RESIDUAL_PRED
     2944#if MERL_VSP_C0152
     2945Void TComDataCU::setVSPIndexSubParts ( Char iVSPIdx, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
     2946{
     2947  setSubPart<Char>( iVSPIdx, m_piVSPIndex, uiAbsPartIdx, uiDepth, uiPartIdx );
     2948}
     2949#endif
     2950
     2951#if H3D_IVRP
    30362952Void TComDataCU::setResPredAvailSubParts( Bool bResPredAvailable, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
    30372953{
     
    30632979}
    30642980
     2981#if LGE_ILLUCOMP_DEPTH_C0046
     2982//This modification is not needed after integrating JCT3V-C0137
     2983Bool TComDataCU::isICFlagRequired(UInt uiAbsPartIdx, UInt uiDepth)
     2984{
     2985  UInt uiPartAddr;
     2986  UInt iNumbPart;
     2987
     2988  if(!getSlice()->getIsDepth())
     2989  {
     2990    Int iWidth, iHeight;
     2991
     2992    iNumbPart = ( getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ? 1 : (getPartitionSize(uiAbsPartIdx) == SIZE_NxN ? 4 : 2) );
     2993
     2994    for(UInt i = 0; i < iNumbPart; i++)
     2995    {
     2996      getPartIndexAndSize(i, uiPartAddr, iWidth, iHeight, uiAbsPartIdx, true);
     2997      uiPartAddr += uiAbsPartIdx;
     2998
     2999      for(UInt uiRefIdx = 0; uiRefIdx < 2; uiRefIdx++)
     3000      {
     3001        RefPicList eRefList = uiRefIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
     3002        Int iBestRefIdx = getCUMvField(eRefList)->getRefIdx(uiPartAddr);
     3003
     3004        if((getInterDir(uiPartAddr) & (uiRefIdx+1)) && iBestRefIdx >= 0 && getSlice()->getViewId() != getSlice()->getRefViewId(eRefList, iBestRefIdx))
     3005        {
     3006          return true;
     3007        }
     3008      }
     3009    }
     3010  }
     3011  else
     3012  {
     3013    iNumbPart = getPic()->getNumPartInCU() >> (uiDepth << 1);
     3014
     3015    for(UInt i = 0; i < iNumbPart; i++)
     3016    {
     3017      uiPartAddr = uiAbsPartIdx + i;
     3018
     3019      for(UInt uiRefIdx = 0; uiRefIdx < 2; uiRefIdx++)
     3020      {
     3021        RefPicList eRefList = uiRefIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
     3022        Int iBestRefIdx = getCUMvField(eRefList)->getRefIdx(uiPartAddr);
     3023
     3024        if((getInterDir(uiPartAddr) & (uiRefIdx+1)) && iBestRefIdx >= 0 && getSlice()->getViewId() != getSlice()->getRefViewId(eRefList, iBestRefIdx))
     3025        {
     3026          return true;
     3027        }
     3028      }
     3029    }
     3030  }
     3031
     3032  return false;
     3033}
     3034#else
    30653035Bool TComDataCU::isICFlagRequired(UInt uiAbsPartIdx)
    30663036{
     
    30863056      {
    30873057        return true;
    3088       }
    3089     }
     3058    }
     3059  }
    30903060  }
    30913061  return false;
    30923062}
     3063#endif
    30933064#endif
    30943065
     
    32723243#endif
    32733244
    3274 #if LG_RESTRICTEDRESPRED_M24766
     3245#if LG_RESTRICTEDRESPRED_M24766 && !MTK_MDIVRP_C0138
    32753246Int TComDataCU::getResiPredMode(UInt uiPartAddr)
    32763247{
     
    36173588 * \param numValidMergeCand
    36183589 */
    3619 #if SIMP_MRG_PRUN
     3590#if MERL_VSP_C0152
     3591Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int* iVSPIndexTrue, Int mrgCandIdx )
     3592#else
    36203593Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx )
     3594#endif
     3595{
     3596#if H3D_IVMP
     3597#if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137
     3598  const Int extraMergeCand = ( ( getSlice()->getIsDepth() || getSlice()->getSPS()->getMultiviewMvPredMode() )? 1 : 0 );
    36213599#else
    3622 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand )
    3623 #endif
    3624 {
    3625 #if HHI_INTER_VIEW_MOTION_PRED
    36263600  const Int extraMergeCand = ( getSlice()->getSPS()->getMultiviewMvPredMode() ? 1 : 0 );
     3601#endif
    36273602#endif
    36283603
    36293604  UInt uiAbsPartAddr = m_uiAbsIdxInLCU + uiAbsPartIdx;
    36303605  UInt uiIdx = 1;
    3631 #if HHI_INTER_VIEW_MOTION_PRED
    3632   bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ];
     3606#if H3D_IVMP
     3607  Bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ];
    36333608  for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS_MEM; ++ui )
    36343609#else
    3635   bool abCandIsInter[ MRG_MAX_NUM_CANDS ];
     3610  Bool abCandIsInter[ MRG_MAX_NUM_CANDS ];
    36363611  for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS; ++ui )
    36373612#endif
     
    36403615  }
    36413616  // compute the location of the current PU
    3642 #if PARALLEL_MERGE
    36433617  Int xP, yP, nPSW, nPSH;
    36443618  this->getPartPosition(uiPUIdx, xP, yP, nPSW, nPSH);
    3645 #endif
    3646 
     3619
     3620#if MERL_VSP_C0152
     3621  Bool bVspMvZeroDone[3] = {false, false, false};
     3622#endif
     3623 
    36473624  Int iCount = 0;
    36483625
     
    36523629  deriveLeftBottomIdxGeneral( cCurPS, uiAbsPartIdx, uiPUIdx, uiPartIdxLB );
    36533630
    3654 #if HHI_INTER_VIEW_MOTION_PRED
     3631#if H3D_IVMP
    36553632  Bool bNoPdmMerge   = ( m_pcSlice->getSPS()->getViewId() == 0 || ( m_pcSlice->getSPS()->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) != PDM_USE_FOR_MERGE );
    36563633
    36573634  //===== add merge with predicted depth maps =====
    3658 #if QC_MRG_CANS_B0048
    36593635  TComMv  acPdmMv       [4];
    36603636  Int     aiPdmRefIdx   [4] = {-1, -1, -1, -1};
    36613637  Bool    bLeftAvai         = false;
    3662 #if OL_DISMV_POS_B0069
    36633638  Int     iPosLeftAbove[2]  = {-1, -1};
    3664 #endif
    3665 #else
    3666   TComMv  acPdmMv       [2];
    3667   Int     aiPdmRefIdx   [2] = {-1, -1};
    3668 #endif
    3669 
    3670 #if LGE_DVMCP_A0126
    3671 #if QC_MRG_CANS_B0048
     3639
     3640#if H3D_NBDV
    36723641  acPdmMv[0].m_bDvMcp = acPdmMv[1].m_bDvMcp = acPdmMv[2].m_bDvMcp = acPdmMv[3].m_bDvMcp = false;
    3673 #else
    3674   acPdmMv[0].m_bDvMcp = acPdmMv[1].m_bDvMcp = false;
    3675 #endif
    3676 #endif
    3677 
    3678 #if QC_MULTI_DIS_CAN_A0097
     3642#endif //H3D_NBDV
     3643
     3644#if MTK_MDIVRP_C0138
     3645  Bool bDVAvail = true;
     3646#endif
     3647
     3648#if H3D_NBDV
    36793649  DisInfo cDisInfo;
    36803650  cDisInfo.iN = 0;
    36813651  if(!bNoPdmMerge)
    36823652  {
    3683 #if LGE_DVMCP_A0126
    3684 #if LGE_IVMP_PARALLEL_MERGE_B0136 && !QC_SIMPLE_NBDV_B0047
    3685     getDisMvpCand2(uiPUIdx, uiAbsPartIdx, &cDisInfo, true, REF_PIC_LIST_X, -1, true );
    3686 #else
    3687     getDisMvpCand2(uiPUIdx, uiAbsPartIdx, &cDisInfo
    3688 #if LGE_IVMP_PARALLEL_MERGE_B0136==QC_SIMPLE_NBDV_B0047
    3689 ,
    3690 true
     3653    getDisMvpCandNBDV(uiPUIdx, uiAbsPartIdx, &cDisInfo , true
     3654#if MERL_VSP_C0152
     3655            , true
    36913656#endif
    36923657);
    3693 #endif
    3694 #else
    3695     getDisMvpCand (uiPUIdx, uiAbsPartIdx, &cDisInfo );
    3696 #endif
    36973658  }
    36983659  if(cDisInfo.iN==0)
     
    37023663    cDisInfo.m_acMvCand[0].setVer(0);
    37033664    cDisInfo.m_aVIdxCan[0] = 0;
    3704   }
    3705 #if QC_MRG_CANS_B0048
     3665#if MTK_MDIVRP_C0138
     3666    bDVAvail = false;
     3667#endif
     3668  }
     3669
     3670#if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137
     3671  if( m_pcSlice->getIsDepth())
     3672  {
     3673    UInt uiPartIdxCenter;
     3674    xDeriveCenterIdx( cCurPS, uiPUIdx, uiPartIdxCenter );   
     3675    TComDataCU *pcTextureCU = m_pcSlice->getTexturePic()->getCU( getAddr() );
     3676    if ( pcTextureCU && !pcTextureCU->isIntra( uiPartIdxCenter ) )
     3677    {
     3678      abCandIsInter[iCount] = true;     
     3679      puhInterDirNeighbours[iCount] = pcTextureCU->getInterDir( uiPartIdxCenter );
     3680      if( ( puhInterDirNeighbours[iCount] & 1 ) == 1 )
     3681      {
     3682        pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
     3683        TComMv cMvPred = pcMvFieldNeighbours[iCount<<1].getMv();
     3684        const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) );
     3685        cMvPred+=cAdd;
     3686        cMvPred>>=2;
     3687        clipMv(cMvPred);
     3688        pcMvFieldNeighbours[iCount<<1].setMvField(cMvPred,pcMvFieldNeighbours[iCount<<1].getRefIdx());
     3689      }
     3690      if ( getSlice()->isInterB() )
     3691      {
     3692        if( ( puhInterDirNeighbours[iCount] & 2 ) == 2 )
     3693        {
     3694          pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     3695          TComMv cMvPred = pcMvFieldNeighbours[(iCount<<1)+1].getMv();
     3696          const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) );
     3697          cMvPred+=cAdd;
     3698          cMvPred>>=2;
     3699          clipMv(cMvPred);
     3700          pcMvFieldNeighbours[(iCount<<1)+1].setMvField(cMvPred,pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx());
     3701        }
     3702      }
     3703#if MERL_VSP_C0152
     3704      xInheritVspMode( pcTextureCU, uiPartIdxCenter, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     3705#endif
     3706      if ( mrgCandIdx == iCount )
     3707      {
     3708        return;
     3709      }
     3710      iCount ++;
     3711    }
     3712  }
     3713#endif
     3714
    37063715  Int iPdmDir[2] = {0, 0};
    3707 #endif
    3708   Int     iPdmInterDir      = cDisInfo.iN==0? 0:getPdmMergeCandidateDisCan ( uiPUIdx, aiPdmRefIdx, acPdmMv, &cDisInfo 
    3709 #if QC_MRG_CANS_B0048
    3710     , iPdmDir
    3711 #endif
    3712     );
     3716#if QC_AMVP_MRG_UNIFY_IVCAN_C0051
     3717  getUnifiedMvPredCan(uiPUIdx, REF_PIC_LIST_0, 0, aiPdmRefIdx, acPdmMv, &cDisInfo, iPdmDir, true);
     3718  Int iPdmInterDir;
    37133719#else
     3720  Int     iPdmInterDir      = cDisInfo.iN==0? 0:getPdmMergeCandidateDisCan ( uiPUIdx, aiPdmRefIdx, acPdmMv, &cDisInfo, iPdmDir );
     3721#endif
     3722#else // H3D_NBDV
     3723  Int iPdmDir[2] = {0, 0};
    37143724  Int     iPdmInterDir      = getPdmMergeCandidate( uiPUIdx, aiPdmRefIdx, acPdmMv );
    3715 #endif
    3716 #if QC_MRG_CANS_B0048
     3725  iPdmDir[0] = iPdmInterDir;
     3726  iPdmDir[1] = iPdmInterDir;
     3727#endif // H3D_NBDV
     3728#if MTK_MDIVRP_C0138
     3729  if (m_pcSlice->getSPS()->getMultiviewResPredMode()==1 && iPdmDir[0] && !bNoPdmMerge && cCurPS == SIZE_2Nx2N && bDVAvail)
     3730  {
     3731    setResPredAvailSubParts(true, 0, 0, uiDepth);
     3732  }
     3733#endif
     3734
    37173735  if( iPdmDir[0] && !bNoPdmMerge && PDM_MERGE_POS == 0 )
    3718 #else
    3719   if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 0 )
    3720 #endif
    37213736  {
    37223737    abCandIsInter        [ iCount ] = true;
    3723 #if QC_MRG_CANS_B0048
    37243738    puhInterDirNeighbours[ iCount ] = iPdmDir[0];
    37253739    iPdmInterDir                    = iPdmDir[0];
    3726 #else
    3727     puhInterDirNeighbours[ iCount ] = iPdmInterDir;
    3728 #endif
     3740
    37293741    if( ( iPdmInterDir & 1 ) == 1 )
    37303742    {
     
    37473759    }
    37483760#endif
    3749 #if SIMP_MRG_PRUN
    37503761    if ( mrgCandIdx == iCount )
    37513762    {
    37523763      return;
    37533764    }
    3754 #endif
    37553765    iCount ++;
    37563766  }
    3757 #endif
    3758 
    3759 #if QC_MRG_CANS_B0048
     3767
    37603768  if(extraMergeCand)
    37613769  {
     
    37733781        pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 3 ], aiPdmRefIdx[ 3 ] );
    37743782      }
    3775 #if LGE_DVMCP_A0126
     3783#if H3D_NBDV
    37763784      pcMvFieldNeighbours[iCount<<1    ].getMv().m_bDvMcp = false;
    37773785      pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
    37783786#endif
    3779 #if SIMP_MRG_PRUN
    37803787      if ( mrgCandIdx == iCount )
    37813788          return;
    3782 #endif
    37833789      iCount ++;
    37843790    }   
    37853791  }
    3786 #endif
     3792#endif //  H3D_IVMP
     3793
     3794#if MERL_VSP_COMPENSATION_C0152
     3795  //===== vsp 0 =====
     3796  if( iCount < 4 + extraMergeCand )
     3797    if ( !xAddVspMergeCand(0, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
     3798      return;
     3799#endif
     3800
    37873801  //left
    37883802  UInt uiLeftPartIdx = 0;
    37893803  TComDataCU* pcCULeft = 0;
    3790 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    37913804  pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB, true, false );
    3792 #else
    3793   pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB );
    3794 #endif
    3795 #if PARALLEL_MERGE
    37963805  if (pcCULeft)
    37973806  {
     
    38013810    }
    38023811  }
    3803 #endif
    38043812  PartSize partSize = getPartitionSize( uiAbsPartIdx );
    38053813  if (!(uiPUIdx == 1 && (partSize == SIZE_Nx2N || partSize == SIZE_nLx2N || partSize == SIZE_nRx2N)))
    38063814  {
    3807   if ( pcCULeft && !pcCULeft->isIntra( uiLeftPartIdx ) )
     3815    if ( pcCULeft && !pcCULeft->isIntra( uiLeftPartIdx )
     3816#if MERL_VSP_C0152
     3817      CHECK_ADD_YET(pcCULeft, uiLeftPartIdx, 1)
     3818#endif
     3819      )
     3820    {
     3821      abCandIsInter[iCount] = true;
     3822      // get Inter Dir
     3823      puhInterDirNeighbours[iCount] = pcCULeft->getInterDir( uiLeftPartIdx );
     3824      // get Mv from Left
     3825      pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
     3826      if ( getSlice()->isInterB() )
     3827      {
     3828        pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     3829      }
     3830#if FIX_CU_BASED_MRG_CAND_LIST_B0136
     3831      else
     3832      {
     3833        pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( TComMv(0,0), NOT_VALID );
     3834      }
     3835#endif
     3836
     3837#if H3D_IVMP
     3838      Bool bRemoveSpa = false; //pruning to inter-view candidates
     3839      Int  iCnloop    = iCount - 1;
     3840      for(; iCnloop >= 0; iCnloop --)
     3841      {
     3842        if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
     3843        {
     3844          bRemoveSpa                      = true;
     3845          abCandIsInter        [ iCount ] = false;
     3846
     3847          //reset to the default value for IC, MC
     3848          puhInterDirNeighbours[iCount]   = 0;
     3849          TComMv  cZeroMv;
     3850          pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID );
     3851          pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
     3852          break;
     3853        }
     3854      }
     3855      if(!bRemoveSpa)
     3856      {
     3857        bLeftAvai = true;
     3858        iPosLeftAbove[0] = iCount;
     3859#endif  // H3D_IVMP
     3860#if H3D_NBDV
     3861        pcMvFieldNeighbours[iCount<<1    ].getMv().m_bDvMcp = false;
     3862        pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
     3863#endif
     3864#if MERL_VSP_C0152
     3865        xInheritVspMode( pcCULeft, uiLeftPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     3866#endif
     3867        if ( mrgCandIdx == iCount )
     3868        {
     3869          return;
     3870        }
     3871        iCount ++;
     3872#if H3D_IVMP
     3873      }
     3874#endif
     3875    }
     3876  }
     3877
     3878#if H3D_IVMP
     3879  if( iPdmDir[0]   && !bNoPdmMerge && PDM_MERGE_POS == 1 )
     3880  {
     3881    abCandIsInter        [ iCount ] = true;
     3882    puhInterDirNeighbours[ iCount ] = iPdmInterDir;
     3883    if( ( iPdmInterDir & 1 ) == 1 )
     3884    {
     3885      pcMvFieldNeighbours[ iCount<<1    ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] );
     3886    }
     3887#if FIX_CU_BASED_MRG_CAND_LIST_B0136
     3888    else
     3889    {
     3890      pcMvFieldNeighbours[ iCount<<1 ].setMvField( TComMv(0,0), NOT_VALID );
     3891    }
     3892#endif
     3893    if( ( iPdmInterDir & 2 ) == 2 )
     3894    {
     3895      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] );
     3896    }
     3897#if FIX_CU_BASED_MRG_CAND_LIST_B0136
     3898    else
     3899    {
     3900      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( TComMv(0,0), NOT_VALID );
     3901    }
     3902#endif
     3903    if ( mrgCandIdx == iCount )
     3904    {
     3905      return;
     3906    }
     3907    iCount ++;
     3908  }
     3909#endif //  H3D_IVMP
     3910
     3911#if MERL_VSP_COMPENSATION_C0152
     3912  //===== vsp 1 =====
     3913  if( iCount < 4 + extraMergeCand )
     3914    if ( !xAddVspMergeCand(1, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
     3915      return;
     3916#endif
     3917
     3918  // above
     3919  UInt uiAbovePartIdx = 0;
     3920  TComDataCU* pcCUAbove = 0;
     3921  pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT, true, false, true );
     3922    if (pcCUAbove)
     3923    {
     3924      if (!pcCUAbove->isDiffMER(xP+nPSW-1, yP-1, xP, yP))
     3925      {
     3926        pcCUAbove = NULL;
     3927      }
     3928    }
     3929  if ( pcCUAbove && !pcCUAbove->isIntra( uiAbovePartIdx )
     3930#if MERL_VSP_C0152
     3931    CHECK_ADD_YET(pcCUAbove, uiAbovePartIdx, 1)
     3932#endif
     3933    && !(uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD))
     3934    && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAbove, uiAbovePartIdx ) ) )
    38083935  {
    38093936    abCandIsInter[iCount] = true;
    38103937    // get Inter Dir
    3811     puhInterDirNeighbours[iCount] = pcCULeft->getInterDir( uiLeftPartIdx );
     3938    puhInterDirNeighbours[iCount] = pcCUAbove->getInterDir( uiAbovePartIdx );
    38123939    // get Mv from Left
    3813     pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
     3940    pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    38143941    if ( getSlice()->isInterB() )
    38153942    {
    3816       pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     3943      pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    38173944    }
    38183945#if FIX_CU_BASED_MRG_CAND_LIST_B0136
     
    38223949    }
    38233950#endif
    3824 #if QC_MRG_CANS_B0048
    3825     Bool bRemoveSpa = false; //prunign to inter-view candidates
    3826     Int  iCnloop    = iCount - 1;
     3951#if H3D_IVMP
     3952    Bool bRemoveSpa = false; //pruning to inter-view candidates
     3953    Int  iCnloop    = bLeftAvai? (iCount-2): (iCount-1);
    38273954    for(; iCnloop >= 0; iCnloop --)
    38283955    {
     
    38313958        bRemoveSpa                      = true;
    38323959        abCandIsInter        [ iCount ] = false;
    3833 #if FIX_MISUSE_REFINDEX
     3960
    38343961        //reset to the default value for IC, MC
    38353962        puhInterDirNeighbours[iCount]   = 0;
     
    38383965        pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
    38393966        break;
    3840 #endif
    38413967      }
    38423968    }
    38433969    if(!bRemoveSpa)
    38443970    {
    3845       bLeftAvai = true;
    3846 #if OL_DISMV_POS_B0069
    3847       iPosLeftAbove[0] = iCount;
    3848 #endif
    3849 #endif
    3850 #if LGE_DVMCP_A0126
     3971      iPosLeftAbove[1] = iCount;
     3972#endif //  H3D_IVMP
     3973#if H3D_NBDV
    38513974    pcMvFieldNeighbours[iCount<<1    ].getMv().m_bDvMcp = false;
    38523975    pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
    38533976#endif
    3854 #if SIMP_MRG_PRUN
     3977#if MERL_VSP_C0152
     3978     xInheritVspMode( pcCUAbove, uiAbovePartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     3979#endif
    38553980    if ( mrgCandIdx == iCount )
    38563981    {
    38573982      return;
    38583983    }
    3859 #endif
    38603984    iCount ++;
    3861 #if QC_MRG_CANS_B0048
    3862       }
    3863 #endif
    3864   }
    3865   }
    3866 
    3867 #if HHI_INTER_VIEW_MOTION_PRED
    3868 #if QC_MRG_CANS_B0048
    3869   if( iPdmDir[0]   && !bNoPdmMerge && PDM_MERGE_POS == 1 )
    3870 #else
    3871   if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 1 )
    3872 #endif
     3985#if H3D_IVMP
     3986    }
     3987#endif
     3988  }
     3989
     3990#if H3D_IVMP
     3991  if( iPdmDir[0]   && !bNoPdmMerge && PDM_MERGE_POS == 2 )
    38733992  {
    38743993    abCandIsInter        [ iCount ] = true;
     
    38944013    }
    38954014#endif
    3896 #if SIMP_MRG_PRUN
    38974015    if ( mrgCandIdx == iCount )
    38984016    {
    38994017      return;
    39004018    }
    3901 #endif
    39024019    iCount ++;
    39034020  }
    3904 #endif
    3905 
    3906   // above
    3907 #if !SIMP_MRG_PRUN
    3908   partSize = getPartitionSize( uiAbsPartIdx );
    3909   if (!(uiPUIdx == 1 && (partSize == SIZE_2NxN || partSize == SIZE_2NxnU || partSize == SIZE_2NxnD)))
    3910   {
    3911 #endif
    3912   UInt uiAbovePartIdx = 0;
    3913   TComDataCU* pcCUAbove = 0;
    3914 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    3915   pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT, true, false, true );
    3916 #else
    3917   pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT, true, true, true );
    3918 #endif
    3919 #if PARALLEL_MERGE
    3920     if (pcCUAbove)
    3921     {
    3922       if (!pcCUAbove->isDiffMER(xP+nPSW-1, yP-1, xP, yP))
    3923       {
    3924         pcCUAbove = NULL;
    3925       }
    3926     }
    3927 #endif
    3928 #if SIMP_MRG_PRUN
    3929   if ( pcCUAbove && !pcCUAbove->isIntra( uiAbovePartIdx )
    3930     && !(uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD))
    3931     && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAbove, uiAbovePartIdx ) ) )
    3932 #else
    3933   if ( pcCUAbove && !pcCUAbove->isIntra( uiAbovePartIdx ) )
    3934 #endif
    3935   {
    3936     abCandIsInter[iCount] = true;
    3937     // get Inter Dir
    3938     puhInterDirNeighbours[iCount] = pcCUAbove->getInterDir( uiAbovePartIdx );
    3939     // get Mv from Left
    3940     pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    3941     if ( getSlice()->isInterB() )
    3942     {
    3943       pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    3944     }
    3945 #if FIX_CU_BASED_MRG_CAND_LIST_B0136
    3946     else
    3947     {
    3948       pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( TComMv(0,0), NOT_VALID );
    3949     }
    3950 #endif
    3951 #if QC_MRG_CANS_B0048
    3952     Bool bRemoveSpa = false; //prunign to inter-view candidates
    3953     Int  iCnloop    = bLeftAvai? (iCount-2): (iCount-1);
    3954     for(; iCnloop >= 0; iCnloop --)
    3955     {
    3956       if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
    3957       {
    3958         bRemoveSpa                      = true;
    3959         abCandIsInter        [ iCount ] = false;
    3960 #if FIX_MISUSE_REFINDEX
    3961         //reset to the default value for IC, MC
    3962         puhInterDirNeighbours[iCount]   = 0;
    3963         TComMv  cZeroMv;
    3964         pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID );
    3965         pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
    3966         break;
    3967 #endif
    3968       }
    3969     }
    3970     if(!bRemoveSpa)
    3971     {
    3972 #if OL_DISMV_POS_B0069
    3973       iPosLeftAbove[1] = iCount;
    3974 #endif
    3975 #endif
    3976 #if LGE_DVMCP_A0126
    3977     pcMvFieldNeighbours[iCount<<1    ].getMv().m_bDvMcp = false;
    3978     pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
    3979 #endif
    3980 #if SIMP_MRG_PRUN
    3981     if ( mrgCandIdx == iCount )
    3982     {
     4021#endif //  H3D_IVMP
     4022
     4023#if MERL_VSP_COMPENSATION_C0152
     4024  //===== vsp 2 =====
     4025  if( iCount < 4 + extraMergeCand )
     4026    if ( !xAddVspMergeCand(2, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
    39834027      return;
    3984     }
    3985 #endif
    3986     iCount ++;
    3987 #if QC_MRG_CANS_B0048
    3988     }
    3989 #endif
    3990   }
    3991 #if !SIMP_MRG_PRUN
    3992   }
    3993 #endif
    3994 
    3995 #if HHI_INTER_VIEW_MOTION_PRED
    3996 #if QC_MRG_CANS_B0048
    3997   if( iPdmDir[0]   && !bNoPdmMerge && PDM_MERGE_POS == 2 )
    3998 #else
    3999   if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 2 )
    4000 #endif
    4001   {
    4002     abCandIsInter        [ iCount ] = true;
    4003     puhInterDirNeighbours[ iCount ] = iPdmInterDir;
    4004     if( ( iPdmInterDir & 1 ) == 1 )
    4005     {
    4006       pcMvFieldNeighbours[ iCount<<1    ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] );
    4007     }
    4008 #if FIX_CU_BASED_MRG_CAND_LIST_B0136
    4009     else
    4010     {
    4011       pcMvFieldNeighbours[ iCount<<1 ].setMvField( TComMv(0,0), NOT_VALID );
    4012     }
    4013 #endif
    4014     if( ( iPdmInterDir & 2 ) == 2 )
    4015     {
    4016       pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] );
    4017     }
    4018 #if FIX_CU_BASED_MRG_CAND_LIST_B0136
    4019     else
    4020     {
    4021       pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( TComMv(0,0), NOT_VALID );
    4022     }
    4023 #endif
    4024 #if SIMP_MRG_PRUN
    4025     if ( mrgCandIdx == iCount )
    4026     {
    4027       return;
    4028     }
    4029 #endif
    4030     iCount ++;
    4031   }
    40324028#endif
    40334029
     
    40354031  UInt uiAboveRightPartIdx = 0;
    40364032  TComDataCU* pcCUAboveRight = 0;
    4037 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    40384033  pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT, true, false, true );
    4039 #else
    4040   pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT, true, true, true);
    4041 #endif
    4042 #if PARALLEL_MERGE
    40434034  if (pcCUAboveRight)
    40444035  {
     
    40484039    }
    40494040  }
    4050 #endif
    4051 #if SIMP_MRG_PRUN
    4052   if ( pcCUAboveRight && !pcCUAboveRight->isIntra( uiAboveRightPartIdx ) && ( !pcCUAbove || pcCUAbove->isIntra( uiAbovePartIdx ) || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) )
    4053 #else
    4054   if ( pcCUAboveRight && !pcCUAboveRight->isIntra( uiAboveRightPartIdx ) )
    4055 #endif
     4041  if ( pcCUAboveRight && !pcCUAboveRight->isIntra( uiAboveRightPartIdx )
     4042#if MERL_VSP_C0152
     4043    CHECK_ADD_YET(pcCUAboveRight, uiAboveRightPartIdx, 1)
     4044#endif
     4045    && ( !pcCUAbove || pcCUAbove->isIntra( uiAbovePartIdx ) || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) )
    40564046  {
    40574047    abCandIsInter[iCount] = true;
     
    40704060    }
    40714061#endif
    4072 #if LGE_DVMCP_A0126
     4062#if H3D_NBDV
    40734063    pcMvFieldNeighbours[iCount<<1    ].getMv().m_bDvMcp = false;
    40744064    pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
    40754065#endif
    4076 #if SIMP_MRG_PRUN
     4066#if MERL_VSP_C0152
     4067    xInheritVspMode( pcCUAboveRight, uiAboveRightPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     4068#endif
    40774069    if ( mrgCandIdx == iCount )
    40784070    {
    40794071      return;
    40804072    }
    4081 #endif
    40824073    iCount ++;
    40834074  }
    40844075
    4085 #if HHI_INTER_VIEW_MOTION_PRED
    4086 #if QC_MRG_CANS_B0048
     4076#if H3D_IVMP
    40874077  if( iPdmDir[0]   && !bNoPdmMerge && PDM_MERGE_POS == 3 )
    4088 #else
    4089   if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 3 )
    4090 #endif
    40914078  {
    40924079    abCandIsInter        [ iCount ] = true;
     
    41124099    }
    41134100#endif
    4114 #if SIMP_MRG_PRUN
    41154101    if ( mrgCandIdx == iCount )
    41164102    {
    41174103      return;
    41184104    }
    4119 #endif
    41204105    iCount ++;
    41214106  }
    4122 #endif
    4123 
    4124 #if OL_DISMV_POS_B0069
     4107
    41254108  if(extraMergeCand)
    41264109  {
     
    41284111    {
    41294112      assert(iCount < MRG_MAX_NUM_CANDS_MEM);
    4130       Bool bRemoveSpa = false; //prunign to A1, B1
     4113      Bool bRemoveSpa = false; //pruning to A1, B1
    41314114      abCandIsInter        [ iCount ] = true;
    41324115      puhInterDirNeighbours[ iCount ] = iPdmDir[1];
     
    41484131          bRemoveSpa                      = true;
    41494132          abCandIsInter        [ iCount ] = false;
    4150 #if FIX_MISUSE_REFINDEX
    41514133          //reset to the default value for IC, MC
    41524134          puhInterDirNeighbours[iCount]   = 0;
     
    41554137          pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
    41564138          break;
    4157 #endif
    41584139        }
    41594140      }
    41604141      if(!bRemoveSpa)
    41614142      {
    4162 #if LGE_DVMCP_A0126
     4143#if H3D_NBDV
    41634144        pcMvFieldNeighbours[iCount<<1    ].getMv().m_bDvMcp = false;
    41644145        pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
    41654146#endif
    4166 #if SIMP_MRG_PRUN
    41674147        if ( mrgCandIdx == iCount )
    41684148          return;
    4169 #endif
    41704149        iCount ++;
    41714150      }
    41724151    }   
    41734152  }
    4174 #endif
     4153#endif // H3D_IVMP
     4154
     4155#if MERL_VSP_COMPENSATION_C0152
     4156  //===== vsp 3 =====
     4157  if( iCount < 4 + extraMergeCand )
     4158    if ( !xAddVspMergeCand(3, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
     4159      return;
     4160#endif
     4161
     4162#if MERL_VSP_C0152
     4163#if VSP_MERGE_POS < 4
     4164#if H3D_IVMP
     4165  if( iCount < 4 + extraMergeCand )
     4166#else
     4167  if( iCount < 4 )
     4168#endif
     4169  {
     4170#endif
     4171#endif
     4172
    41754173  //left bottom
    41764174  UInt uiLeftBottomPartIdx = 0;
    41774175  TComDataCU* pcCULeftBottom = 0;
    4178 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    41794176  pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB, true, false );
    4180 #else
    4181   pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB );
    4182 #endif
    4183 #if PARALLEL_MERGE
    41844177  if (pcCULeftBottom)
    41854178  {
     
    41894182    }
    41904183  }
    4191 #endif
    4192 #if SIMP_MRG_PRUN
    4193   if ( pcCULeftBottom && !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) )
    4194 #else
    4195   if ( pcCULeftBottom && !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) )
    4196 #endif
     4184  if ( pcCULeftBottom && !pcCULeftBottom->isIntra( uiLeftBottomPartIdx )
     4185#if MERL_VSP_C0152
     4186    CHECK_ADD_YET(pcCULeftBottom, uiLeftBottomPartIdx, 1)
     4187#endif
     4188    && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) )
    41974189  {
    41984190    abCandIsInter[iCount] = true;
     
    42114203    }
    42124204#endif
    4213 #if LGE_DVMCP_A0126
     4205#if H3D_NBDV
    42144206    pcMvFieldNeighbours[iCount<<1    ].getMv().m_bDvMcp = false;
    42154207    pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
    42164208#endif
    4217 #if SIMP_MRG_PRUN
     4209#if MERL_VSP_C0152
     4210     xInheritVspMode( pcCULeftBottom, uiLeftBottomPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     4211#endif
    42184212    if ( mrgCandIdx == iCount )
    42194213    {
    42204214      return;
    42214215    }
    4222 #endif
    42234216    iCount ++;
    42244217  }
    4225 
    4226 #if HHI_INTER_VIEW_MOTION_PRED
    4227 #if QC_MRG_CANS_B0048
     4218#if MERL_VSP_C0152
     4219#if VSP_MERGE_POS < 4
     4220  }
     4221#endif
     4222#endif
     4223 
     4224#if H3D_IVMP
    42284225  if( iPdmDir[0]   && !bNoPdmMerge && PDM_MERGE_POS == 4 )
    4229 #else
    4230   if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 4 )
    4231 #endif
    42324226  {
    42334227    abCandIsInter        [ iCount ] = true;
     
    42534247    }
    42544248#endif
    4255 #if SIMP_MRG_PRUN
    42564249    if ( mrgCandIdx == iCount )
    42574250    {
    42584251      return;
    42594252    }
    4260 #endif
    42614253    iCount ++;
    42624254  }
    4263 #endif
    4264 
    4265   // above left
    4266 #if HHI_INTER_VIEW_MOTION_PRED
     4255#endif //  H3D_IVMP
     4256
     4257#if MERL_VSP_COMPENSATION_C0152
     4258  //===== vsp 4 =====
     4259  if( iCount < 4 + extraMergeCand )
     4260    if ( !xAddVspMergeCand(4, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
     4261      return;
     4262#endif
     4263 
     4264  // above left
     4265#if H3D_IVMP
    42674266  if( iCount < 4 + extraMergeCand )
    42684267#else
     
    42724271    UInt uiAboveLeftPartIdx = 0;
    42734272    TComDataCU* pcCUAboveLeft = 0;
    4274 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    42754273    pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr, true, false, true );
    4276 #else
    4277     pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr, true, true, true );
    4278 #endif
    4279 #if PARALLEL_MERGE
    42804274    if (pcCUAboveLeft)
    42814275    {
     
    42854279      }
    42864280    }
    4287 #endif
    4288 #if SIMP_MRG_PRUN
    42894281    if( pcCUAboveLeft && !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx )
     4282#if MERL_VSP_C0152
     4283     CHECK_ADD_YET(pcCUAboveLeft, uiAboveLeftPartIdx, 1)
     4284#endif
    42904285     && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) )
    42914286     && ( !pcCUAbove || pcCUAbove->isIntra( uiAbovePartIdx ) || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) )
    42924287     )
    4293 #else
    4294     if( pcCUAboveLeft && !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx ) )
    4295 #endif
    42964288    {
    42974289      abCandIsInter[iCount] = true;
     
    43104302      }
    43114303#endif
    4312 #if LGE_DVMCP_A0126
     4304#if H3D_NBDV
    43134305      pcMvFieldNeighbours[iCount<<1    ].getMv().m_bDvMcp = false;
    43144306      pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
    43154307#endif
    4316 #if SIMP_MRG_PRUN
     4308#if MERL_VSP_C0152
     4309     xInheritVspMode( pcCUAboveLeft, uiAboveLeftPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     4310#endif
    43174311      if ( mrgCandIdx == iCount )
    43184312      {
    43194313        return;
    43204314      }
    4321 #endif
    43224315      iCount ++;
    43234316    }
    43244317  }
    43254318
     4319#if MERL_VSP_COMPENSATION_C0152
     4320  //===== vsp 5 =====
     4321  if( iCount < 4 + extraMergeCand )
     4322    if ( !xAddVspMergeCand(5, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
     4323      return;
     4324#endif
     4325
    43264326  if ( getSlice()->getPPS()->getEnableTMVPFlag()
    4327 #if QC_MRG_CANS_B0048
     4327#if H3D_IVMP
    43284328       && iCount < (MRG_MAX_NUM_CANDS_SIGNALED + extraMergeCand)
    43294329#endif
     
    43364336    {
    43374337      RefPicList  eRefPicList = ( i==1 ? REF_PIC_LIST_1 : REF_PIC_LIST_0 );
    4338 #if SET_MERGE_TMVP_REFIDX
    43394338      Int iRefIdxTmp;
    43404339      if ( uiPUIdx != 0 )
     
    43464345        iRefIdxTmp = (pcCULeft != NULL) ? pcCULeft->getCUMvField(eRefPicList)->getRefIdx(uiLeftPartIdx) : -1;
    43474346      }
    4348 #else     
    4349       Int iRefIdxTmp = (pcCULeft != NULL) ? pcCULeft->getCUMvField(eRefPicList)->getRefIdx(uiLeftPartIdx) : -1;
    4350 #endif
    43514347      iRefIdxSkip[i] = (iRefIdxTmp != -1) ? iRefIdxTmp : 0;
    43524348    }
     
    43564352    Int uiLCUIdx = getAddr();
    43574353    PartSize eCUMode = getPartitionSize( 0 );
     4354
     4355#if MERL_VSP_C0152 // Potential bug, not related to BW_VSP
     4356    if (eCUMode==SIZE_NxN)
     4357    {
     4358      printf("Size NxN ???");
     4359      assert(0);
     4360    }
     4361#endif
    43584362
    43594363    deriveRightBottomIdx( eCUMode, uiPUIdx, uiPartIdxRB ); 
     
    44094413    UInt uiCurLCUIdx = getAddr();
    44104414    xDeriveCenterIdx( eCUMode, uiPUIdx, uiPartIdxCenter );
    4411     bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_0, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx );
     4415    bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_0, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx
     4416#if QC_TMVP_MRG_REFIDX_C0047
     4417    , 1
     4418#endif
     4419    );
    44124420    if( bExistMV == false )
    44134421    {
    4414       bExistMV = xGetColMVP( REF_PIC_LIST_0, uiCurLCUIdx, uiPartIdxCenter,  cColMv, iRefIdx );
     4422      bExistMV = xGetColMVP( REF_PIC_LIST_0, uiCurLCUIdx, uiPartIdxCenter,  cColMv, iRefIdx
     4423#if QC_TMVP_MRG_REFIDX_C0047
     4424    , 1
     4425#endif
     4426    );
    44154427    }
    44164428    if( bExistMV )
     
    44274439        iRefIdx = 0;
    44284440#endif
    4429         bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_1, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx);
     4441        bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_1, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx
     4442#if QC_TMVP_MRG_REFIDX_C0047
     4443        , 1
     4444#endif
     4445        );
    44304446        if( bExistMV == false )
    44314447        {
    4432           bExistMV = xGetColMVP( REF_PIC_LIST_1, uiCurLCUIdx, uiPartIdxCenter,  cColMv, iRefIdx );
     4448          bExistMV = xGetColMVP( REF_PIC_LIST_1, uiCurLCUIdx, uiPartIdxCenter,  cColMv, iRefIdx
     4449#if QC_TMVP_MRG_REFIDX_C0047
     4450        , 1
     4451#endif 
     4452        );
    44334453        }
    44344454        if( bExistMV )
     
    44524472#endif
    44534473      }
    4454 #if LGE_DVMCP_A0126
     4474#if H3D_NBDV
    44554475      pcMvFieldNeighbours[uiArrayAddr<<1    ].getMv().m_bDvMcp = false;
    44564476      pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getMv().m_bDvMcp = false;
    44574477#endif
    4458 #if SIMP_MRG_PRUN
    44594478      if ( mrgCandIdx == iCount )
    44604479      {
     
    44624481      }
    44634482      iCount++;
    4464 #endif
    44654483    }
    44664484    uiIdx++;
     
    44684486  }
    44694487
    4470 #if SIMP_MRG_PRUN
    44714488  UInt uiArrayAddr = iCount;
    4472 #else
    4473 #if HHI_INTER_VIEW_MOTION_PRED
    4474   for( UInt uiOuter = 0; uiOuter < MRG_MAX_NUM_CANDS_MEM; uiOuter++ )
    4475 #else
    4476   for( UInt uiOuter = 0; uiOuter < MRG_MAX_NUM_CANDS; uiOuter++ )
    4477 #endif
    4478   {
    4479     if( abCandIsInter[ uiOuter ] )
    4480     {
    4481 #if HHI_INTER_VIEW_MOTION_PRED
    4482       for( UInt uiIter = uiOuter + 1; uiIter < MRG_MAX_NUM_CANDS_MEM; uiIter++ )
    4483 #else
    4484       for( UInt uiIter = uiOuter + 1; uiIter < MRG_MAX_NUM_CANDS; uiIter++ )
    4485 #endif
    4486       {
    4487         UInt uiMvFieldNeighIdxCurr = uiOuter << 1;
    4488         UInt uiMvFieldNeighIdxComp = uiIter << 1;
    4489         if( getSlice()->isInterB() )
    4490         {
    4491           if( puhInterDirNeighbours[ uiOuter ] == 3 )
    4492           {
    4493             if( pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getRefIdx() && pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getRefIdx() &&
    4494               pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getMv() && pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getMv() &&
    4495               puhInterDirNeighbours[ uiOuter ] == puhInterDirNeighbours[ uiIter ] )
    4496             {
    4497               abCandIsInter[ uiIter ] = false;
    4498             }
    4499           }
    4500           else if( puhInterDirNeighbours[ uiOuter ] == 2 )
    4501           {
    4502             if( pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getRefIdx() &&
    4503               pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr + 1 ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp + 1 ].getMv() &&
    4504               puhInterDirNeighbours[ uiOuter ] == puhInterDirNeighbours[ uiIter ] )
    4505             {
    4506               abCandIsInter[ uiIter ] = false;
    4507             }
    4508           }
    4509           else
    4510           {
    4511             if( pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getRefIdx() &&
    4512               pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getMv() &&
    4513               puhInterDirNeighbours[ uiOuter ] == puhInterDirNeighbours[ uiIter ] )
    4514             {
    4515               abCandIsInter[ uiIter ] = false;
    4516             }
    4517           }
    4518         }
    4519         else
    4520         {
    4521           if( pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getRefIdx() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getRefIdx() &&
    4522               pcMvFieldNeighbours[ uiMvFieldNeighIdxCurr ].getMv() == pcMvFieldNeighbours[ uiMvFieldNeighIdxComp ].getMv() )
    4523           {
    4524             assert( puhInterDirNeighbours[ uiOuter ] == puhInterDirNeighbours[ uiIter ] );
    4525             abCandIsInter[ uiIter ] = false;
    4526           }
    4527         }
    4528       }
    4529     }
    4530   }
    4531 
    4532 #if HHI_INTER_VIEW_MOTION_PRED
    4533   bool abCandIsInterFlag[MRG_MAX_NUM_CANDS_MEM];
    4534   for (int i=0; i<MRG_MAX_NUM_CANDS_MEM; i++)
    4535 #else
    4536   bool abCandIsInterFlag[MRG_MAX_NUM_CANDS];
    4537   for (int i=0; i<MRG_MAX_NUM_CANDS; i++)
    4538 #endif
    4539   {
    4540     abCandIsInterFlag[i] = abCandIsInter[ i ];
    4541     abCandIsInter[ i ] = false;
    4542   }
    4543 
    4544   UInt uiArrayAddr = 0;
    4545    
    4546 #if HHI_INTER_VIEW_MOTION_PRED
    4547   for (int i=0; i<MRG_MAX_NUM_CANDS_MEM; i++)
    4548 #else
    4549   for (int i=0; i<MRG_MAX_NUM_CANDS; i++)
    4550 #endif
    4551   {
    4552     if (abCandIsInterFlag[i])
    4553     {
    4554       abCandIsInter[uiArrayAddr] = true;
    4555       puhInterDirNeighbours[uiArrayAddr] = puhInterDirNeighbours[i];
    4556       pcMvFieldNeighbours[uiArrayAddr<<1].setMvField(pcMvFieldNeighbours[i<<1].getMv(), pcMvFieldNeighbours[i<<1].getRefIdx());
    4557       pcMvFieldNeighbours[(uiArrayAddr<<1)+1].setMvField(pcMvFieldNeighbours[(i<<1)+1].getMv(), pcMvFieldNeighbours[(i<<1)+1].getRefIdx());
    4558       ++uiArrayAddr;
    4559     }
    4560   }
    4561 
    4562 #if HHI_INTER_VIEW_MOTION_PRED
    4563   for (int i=uiArrayAddr; i<MRG_MAX_NUM_CANDS_MEM; i++)
    4564 #else
    4565   for (int i=uiArrayAddr; i<MRG_MAX_NUM_CANDS; i++)
    4566 #endif
    4567   {
    4568     puhInterDirNeighbours[i] = (getSlice()->isInterB()) ? 3 : 1;
    4569     abCandIsInter[i] = false;
    4570     TComMv tmpMv;
    4571     tmpMv.set(0,0);
    4572     pcMvFieldNeighbours[i<<1].setMvField(tmpMv, 0);
    4573     if ( getSlice()->isInterB() )
    4574     {
    4575       pcMvFieldNeighbours[(i<<1)+1].setMvField(tmpMv, 0);
    4576     }
    4577   }
    4578 #endif
    45794489  UInt uiCutoff = uiArrayAddr;
    45804490   
    45814491  if ( getSlice()->isInterB() )
    45824492  {
    4583 #if HHI_INTER_VIEW_MOTION_PRED
     4493#if H3D_IVMP
    45844494    Int iCombinedCount = 0;
    45854495    Int iMaxCombCount  = ( extraMergeCand ?  6 :  5 );
     
    45984508    {
    45994509      Int i = uiPriorityList0[idx]; Int j = uiPriorityList1[idx];
    4600       if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2))
     4510#if MERL_VSP_C0152
     4511      Bool bValid = true;
     4512      if (pcMvFieldNeighbours[i<<1].getRefIdx() < 0 || pcMvFieldNeighbours[(j<<1)+1].getRefIdx() < 0) // NOT_VALID
     4513        bValid = false;
     4514#endif
     4515      if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2)
     4516#if MERL_VSP_C0152
     4517       && bValid
     4518#endif
     4519         )
    46014520      {
    46024521        abCandIsInter[uiArrayAddr] = true;
     
    46224541      }
    46234542    }
    4624 #if !REMOVE_NON_SCALED 
    4625     Int iScaledCount = 0;
    4626 #if HHI_INTER_VIEW_MOTION_PRED
    4627     for (int i=0; i<uiCutoff && uiArrayAddr!=MRG_MAX_NUM_CANDS_MEM && iScaledCount<1; i++)
    4628 #else
    4629     for (int i=0; i<uiCutoff && uiArrayAddr!=MRG_MAX_NUM_CANDS && iScaledCount<1; i++)
    4630 #endif
    4631     {
    4632 #if HHI_INTER_VIEW_MOTION_PRED
    4633       for (int j=0; j<2 && uiArrayAddr!=MRG_MAX_NUM_CANDS_MEM && iScaledCount<1; j++)
    4634 #else
    4635       for (int j=0; j<2 && uiArrayAddr!=MRG_MAX_NUM_CANDS && iScaledCount<1; j++)
    4636 #endif
    4637       {
    4638         if (abCandIsInter[i] && pcMvFieldNeighbours[(i<<1)+j].getRefIdx()>=0 && pcMvFieldNeighbours[(i<<1)+j].getRefIdx() < m_pcSlice->getNumRefIdx((j==0)?REF_PIC_LIST_1:REF_PIC_LIST_0))
    4639         {
    4640           Int iCurrPOC = m_pcSlice->getPOC();
    4641           Int iCurrRefPOC1 = m_pcSlice->getRefPOC( (j==0)?REF_PIC_LIST_1:REF_PIC_LIST_0, pcMvFieldNeighbours[(i<<1)+j].getRefIdx() );
    4642           Int iCurrRefPOC2 = m_pcSlice->getRefPOC( (j==0)?REF_PIC_LIST_0:REF_PIC_LIST_1, pcMvFieldNeighbours[(i<<1)+j].getRefIdx() );
    4643 
    4644           if (iCurrRefPOC1 != iCurrRefPOC2 && abs(iCurrPOC-iCurrRefPOC1) == abs(iCurrPOC-iCurrRefPOC2))
    4645           {
    4646             abCandIsInter[uiArrayAddr] = true;
    4647             puhInterDirNeighbours[uiArrayAddr] = 3;
    4648            
    4649             TComMv cMvPred = pcMvFieldNeighbours[(i<<1)+j].getMv();
    4650             TComMv rcMv;
    4651 
    4652             rcMv.set(-1*cMvPred.getHor(), -1*cMvPred.getVer());
    4653 
    4654             if (j==0)
    4655             {
    4656               pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(pcMvFieldNeighbours[(i<<1)].getMv(), pcMvFieldNeighbours[(i<<1)].getRefIdx());
    4657               pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(rcMv, pcMvFieldNeighbours[(i<<1)].getRefIdx());
    4658             }
    4659             else
    4660             {
    4661               pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(rcMv, pcMvFieldNeighbours[(i<<1)+1].getRefIdx());
    4662               pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(pcMvFieldNeighbours[(i<<1)+1].getMv(), pcMvFieldNeighbours[(i<<1)+1].getRefIdx());
    4663             }
    4664 
    4665             uiArrayAddr++;
    4666             iScaledCount++;
    4667           }
    4668         }
    4669       }
    4670     }
    4671 #endif
    46724543  }
    46734544
    46744545  Int iNumRefIdx = (getSlice()->isInterB()) ? min(m_pcSlice->getNumRefIdx(REF_PIC_LIST_0), m_pcSlice->getNumRefIdx(REF_PIC_LIST_1)) : m_pcSlice->getNumRefIdx(REF_PIC_LIST_0);
    4675 #if HHI_INTER_VIEW_MOTION_PRED
     4546#if H3D_IVMP
    46764547  for (int r=0; r<iNumRefIdx && uiArrayAddr!=MRG_MAX_NUM_CANDS_MEM; r++)
    46774548#else
     
    46964567    uiArrayAddr++;
    46974568  }
    4698 #if HHI_INTER_VIEW_MOTION_PRED
     4569#if H3D_IVMP
    46994570  if (uiArrayAddr > MRG_MAX_NUM_CANDS_SIGNALED + extraMergeCand )
    47004571  {
     
    47704641  if( uiIter == 0 )
    47714642  {
    4772     if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx ) )
     4643    if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx )
     4644#if MERL_VSP_C0152
     4645     && !pcCorner->getVSPIndex( uiCornerPUIdx )
     4646#endif
     4647    )
    47734648    {
    47744649      rbValidCand = true;
     
    48054680  else
    48064681  {
    4807     if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx ) )
     4682    if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx )
     4683#if MERL_VSP_C0152
     4684     && !pcCorner->getVSPIndex( uiCornerPUIdx )
     4685#endif
     4686    )
    48084687    {
    48094688      rbValidCand = true;
     
    48394718  }
    48404719}
    4841 #if PARALLEL_MERGE
    48424720/** Check whether the current PU and a spatial neighboring PU are in a same ME region.
    48434721 * \param xN, xN   location of the upper-left corner pixel of a neighboring PU
     
    49264804}
    49274805
    4928 #endif
    49294806AMVP_MODE TComDataCU::getAMVPMode(UInt uiIdx)
    49304807{
    49314808  return m_pcSlice->getSPS()->getAMVPMode(m_puhDepth[uiIdx]);
    49324809}
    4933 #if QC_MULTI_DIS_CAN_A0097
     4810#if H3D_NBDV
    49344811/** construct a list of disparity motion vectors from the neighbouring PUs **/
    49354812Void TComDataCU::getDisMvpCand ( UInt uiPartIdx, UInt uiPartAddr,DisInfo* pDInfo )
     
    49484825
    49494826  UInt uiIdx = 0;
    4950 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    49514827    pcTmpCU = getPULeft(uiIdx, uiPartIdxLB, true, false);
    4952 #else
    4953     pcTmpCU = getPULeft(uiIdx, uiPartIdxLB);
    4954 #endif
    49554828  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
     4829#if MERL_VSP_C0152
     4830  if(! pcTmpCU->getVSPIndex(uiIdx))
     4831#endif
    49564832  {
    49574833    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     
    49734849    }
    49744850  }
    4975 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    49764851      pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT, true, false, true);
    4977 #else
    4978     pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT);
    4979 #endif
    49804852
    49814853  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
     4854#if MERL_VSP_C0152
     4855  if(! pcTmpCU->getVSPIndex(uiIdx))
     4856#endif
    49824857  {
    49834858    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     
    50004875  }
    50014876
    5002 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    50034877      pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, false, true);
    5004 #else
    5005       pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, true, true);
    5006 #endif
    50074878  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
     4879#if MERL_VSP_C0152
     4880  if(! pcTmpCU->getVSPIndex(uiIdx))
     4881#endif
    50084882  {
    50094883    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     
    50254899    }
    50264900  }
    5027 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    50284901      pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true, false);
    5029 #else
    5030       pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB);
    5031 #endif
    50324902  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
     4903#if MERL_VSP_C0152
     4904  if(! pcTmpCU->getVSPIndex(uiIdx))
     4905#endif
    50334906  {
    50344907    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     
    50524925
    50534926  // Above predictor search
    5054 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    50554927      pcTmpCU = getPUAboveLeft(uiIdx, (m_uiAbsIdxInLCU + uiPartAddr), true, false, true);
    50564928    assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr));
    5057 #else
    5058       pcTmpCU = getPUAboveLeft(uiIdx, uiPartIdxLT, true, true, true);
    5059 #endif
    50604929  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
     4930#if MERL_VSP_C0152
     4931  if(! pcTmpCU->getVSPIndex(uiIdx))
     4932#endif
    50614933  {
    50624934    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     
    52575129}
    52585130
    5259 #if LGE_DVMCP_A0126
    5260 #if QC_SIMPLE_NBDV_B0047
    5261 Void TComDataCU::getDisMvpCand2( UInt uiPartIdx, UInt uiPartAddr,DisInfo* pDInfo
    5262 #if LGE_IVMP_PARALLEL_MERGE_B0136
    5263                                 , Bool bParMerge
    5264 #endif
     5131#if MERL_VSP_C0152
     5132#if LGE_SIMP_DVP_REFINE_C0112
     5133Pel TComDataCU::getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT, Int iShiftPrec, Bool bSimpleDvpRefine)
    52655134#else
    5266 Void TComDataCU::getDisMvpCand2( UInt uiPartIdx, UInt uiPartAddr,DisInfo* pDInfo, Bool bMerge, RefPicList eRefPicList0, Int iRefIdx0
    5267 #if LGE_IVMP_PARALLEL_MERGE_B0136
    5268                                 , Bool bParMerge
    5269 #endif
     5135Pel TComDataCU::getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT, Int iShiftPrec)
     5136#endif
     5137{
     5138  Int depStride =  pcBaseViewDepthPicYuv->getStride();
     5139
     5140  Int width  = pcBaseViewDepthPicYuv->getWidth();
     5141  Int height = pcBaseViewDepthPicYuv->getHeight();
     5142
     5143  Int depthPosX = Clip3(0,   width - iWidth  - 1,  iBlkX + (mv->getHor()>>2));
     5144  Int depthPosY = Clip3(0,   height- iHeight - 1,  iBlkY + (mv->getVer()>>2));
     5145
     5146  Pel *depth  = pcBaseViewDepthPicYuv->getLumaAddr() + depthPosX + depthPosY * depStride;
     5147  Pel  maxDepth = 0;
     5148#if LGE_SIMP_DVP_REFINE_C0112
     5149  if ( bSimpleDvpRefine )
     5150  {
     5151    Int depthStartPosX = Clip3(0,   width - iWidth  - 1,  iBlkX + (mv->getHor()>>2));
     5152    Int depthStartPosY = Clip3(0,   height- iHeight - 1,  iBlkY + (mv->getVer()>>2));
     5153    Int depthEndPosX = Clip3(0,   width - iWidth  - 1,  iBlkX + iWidth  + (mv->getHor()>>2));
     5154    Int depthEndPosY = Clip3(0,   height- iHeight - 1,  iBlkY + iHeight + (mv->getVer()>>2));
     5155    Int iCenterX = (depthStartPosX + depthEndPosX) >> 1;
     5156    Int iCenterY = (depthStartPosY + depthEndPosY) >> 1;
     5157
     5158    Pel *depthTL  = pcBaseViewDepthPicYuv->getLumaAddr();
     5159    Int aiDepth[5];
     5160    aiDepth[0] = depthTL[ (depthStartPosY) * depStride + depthStartPosX ];      // Left Top
     5161    aiDepth[1] = depthTL[ (depthEndPosY)   * depStride + depthStartPosX ];      // Left Bottom
     5162    aiDepth[2] = depthTL[ (depthStartPosY) * depStride + depthEndPosX   ];      // Right Top
     5163    aiDepth[3] = depthTL[ (depthEndPosY)   * depStride + depthEndPosX   ];      // Right Bottom
     5164    aiDepth[4] = depthTL[ (iCenterY)       * depStride + iCenterX       ];      // Center
     5165    for (Int i = 0; i < 5; i++)
     5166    {
     5167      if (maxDepth < aiDepth[i])
     5168        maxDepth = aiDepth[i];
     5169    }
     5170  }
     5171  else
     5172  {
     5173    for (Int j = 0; j < iHeight; j++)
     5174    {
     5175      for (Int i = 0; i < iWidth; i++)
     5176      {
     5177        if (maxDepth < depth[i])
     5178          maxDepth = depth[i];
     5179      }
     5180      depth += depStride;
     5181    }
     5182  }
     5183#else
     5184  for (Int j = 0; j < iHeight; j++)
     5185  {
     5186    for (Int i = 0; i < iWidth; i++)
     5187    {
     5188      if (maxDepth < depth[i])
     5189        maxDepth = depth[i];
     5190    }
     5191    depth += depStride;
     5192  }
     5193#endif
     5194  Int disparity = aiShiftLUT[ maxDepth ] << iShiftPrec;
     5195
     5196  return disparity;
     5197}
     5198#if LGE_SIMP_DVP_REFINE_C0112
     5199Void TComDataCU::estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred, Bool bSimpleDvpRefine)
     5200#else
     5201Void TComDataCU::estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred)
     5202#endif
     5203{
     5204  if (picDepth)
     5205  {
     5206    UInt uiAbsPartAddrCurrCU = m_uiAbsIdxInLCU + uiPartAddr;
     5207    Int iWidth, iHeight;
     5208    getPartIndexAndSize( uiPartIdx, uiPartAddr, iWidth, iHeight ); // The modified value of uiPartAddr won't be used any more
     5209   
     5210    TComPicYuv* pcBaseViewDepthPicYuv = picDepth->getPicYuvRec();
     5211    Int iBlkX = ( getAddr() % picDepth->getFrameWidthInCU() ) * g_uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartAddrCurrCU ] ];
     5212    Int iBlkY = ( getAddr() / picDepth->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartAddrCurrCU ] ];
     5213    Int* aiShiftLUT;
     5214    Int  iShiftPrec;
     5215    getSlice()->getBWVSPLUTParam(aiShiftLUT, iShiftPrec);
     5216#if LGE_SIMP_DVP_REFINE_C0112
     5217    Pel x = getMcpFromDM( pcBaseViewDepthPicYuv, cMvPred, iBlkX, iBlkY, iWidth, iHeight, aiShiftLUT, iShiftPrec, bSimpleDvpRefine );
     5218#else
     5219    Pel x = getMcpFromDM( pcBaseViewDepthPicYuv, cMvPred, iBlkX, iBlkY, iWidth, iHeight, aiShiftLUT, iShiftPrec);
     5220#endif
     5221    cMvPred->setHor(x);
     5222    clipMv(*cMvPred);
     5223  }
     5224}
     5225#endif
     5226
     5227#if H3D_NBDV
     5228Void TComDataCU::getDisMvpCandNBDV( UInt uiPartIdx, UInt uiPartAddr,DisInfo* pDInfo , Bool bParMerge
     5229#if MERL_VSP_C0152
     5230                                , Bool bDepthRefine
    52705231#endif
    52715232                                )
     
    52735234  PartSize eCUMode = getPartitionSize( uiPartAddr );
    52745235  TComDataCU* pcTmpCU = NULL;
    5275 #if !QC_SIMPLE_NBDV_B0047
    5276   TComDataCU* pcCULeft = NULL;
    5277 #endif
    52785236  pDInfo->iN = 0;
    52795237
     
    52835241  UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();
    52845242
    5285 #if QC_SIMPLE_NBDV_B0047
    52865243  const Int iNumofDvMCP = 7;
     5244#if MTK_RELEASE_DV_CONSTRAINT_C0129
     5245  Int   aiDvMcpDvCandX[2][iNumofDvMCP] = {{0,},    {0,}}; // dummy, 5 spatial + 1 temporal
     5246  Int   aiDvMcpDvCandY[2][iNumofDvMCP] = {{0,},    {0,}}; // dummy, 5 spatial + 1 temporal
     5247#else
    52875248  Int   aiDvMcpDvCand[2][iNumofDvMCP] = {{0,},    {0,}}; // dummy, 5 spatial + 1 temporal
     5249#endif
    52885250  Bool  abDvMcpFlag  [2][iNumofDvMCP] = {{false,},{false,}};
    5289 #else
    5290   Int   aiDvMcpDvCand[2][7] = {{0,},    {0,}}; // dummy, 5 spatial + 1 temporal
    5291   Bool  abDvMcpFlag  [2][7] = {{false,},{false,}};
    5292   //Int   aiRefPOC     [2][7] = {{-1,},{-1}}; // debug
    5293 #endif
    52945251  TComMv cTmpMvPred, cMv;
    52955252  Bool  bTmpIsSkipped = false;
    52965253  Bool  bDvMcpIsFound = false;
    5297 #if LGE_DVMCP_MEM_REDUCTION_B0135
    5298   Int iLCUAddrDiff = 0;
    5299 #endif
    5300 
    5301 #if LGE_IVMP_PARALLEL_MERGE_B0136
     5254  Int   iLCUAddrDiff = 0;
     5255
    53025256  Int xP, yP, nPSW, nPSH;
    53035257  if( bParMerge)
    53045258    this->getPartPosition(uiPartIdx, xP, yP, nPSW, nPSH);
    5305 #endif
    53065259
    53075260  deriveLeftRightTopIdxGeneral( eCUMode, uiPartAddr, uiPartIdx, uiPartIdxLT, uiPartIdxRT );
    53085261  deriveLeftBottomIdxGeneral( eCUMode, uiPartAddr, uiPartIdx, uiPartIdxLB );
    53095262
    5310   UInt uiIdx = 0;
    5311 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    5312   pcTmpCU = getPULeft(uiIdx, uiPartIdxLB, true, false);
    5313 #else
    5314   pcTmpCU = getPULeft(uiIdx, uiPartIdxLB);
    5315 #endif
    5316 #if DV_DERIVATION_PARALLEL_B0096
    5317   if ( uiPartIdx == 1 && (eCUMode == SIZE_Nx2N || eCUMode == SIZE_nLx2N || eCUMode == SIZE_nRx2N) )
    5318   {
    5319     pcTmpCU = NULL;
    5320   }
    5321 #endif
    5322 #if LGE_IVMP_PARALLEL_MERGE_B0136
    5323   if (pcTmpCU && bParMerge)
    5324   {
    5325     if (!pcTmpCU->isDiffMER(xP -1, yP+nPSH-1, xP, yP))
    5326     {
    5327       pcTmpCU = NULL;
    5328     }
    5329   }
    5330 #endif
    5331 
    5332 #if !QC_SIMPLE_NBDV_B0047
    5333   pcCULeft = pcTmpCU;
    5334   UInt uiLeftPartIdx = uiIdx;
    5335 #endif
    5336 
    5337   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
    5338   {
    5339     bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
    5340     for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
    5341     {
    5342       eRefPicList = RefPicList(iList);
    5343       Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
    5344       if( refId >= 0)
    5345       {
    5346         Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
    5347         if (refViewIdx!= m_pcSlice->getViewId()) // DCP
    5348         {
    5349           TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5350           clipMv(cMvPred);
    5351           pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    5352           pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    5353           return;
    5354         }
    5355         else // MCP
    5356         {
    5357           cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5358           if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
    5359           {
    5360             aiDvMcpDvCand[iList][DVFROM_LEFT] = cTmpMvPred.m_iDvMcpDispX;
    5361             abDvMcpFlag  [iList][DVFROM_LEFT] = true;
    5362             bDvMcpIsFound = true;
    5363           }
    5364         }
    5365       }
    5366     }
    5367   }
    5368 
    5369 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    5370   pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT, true, false, true);
    5371 #else
    5372   pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT);
    5373 #endif
    5374 #if DV_DERIVATION_PARALLEL_B0096
    5375   if ( uiPartIdx == 1 && (eCUMode == SIZE_2NxN || eCUMode == SIZE_2NxnU || eCUMode == SIZE_2NxnD) )
    5376   {
    5377     pcTmpCU = NULL;
    5378   }
    5379 #endif
    5380 #if LGE_IVMP_PARALLEL_MERGE_B0136
    5381   if (pcTmpCU && bParMerge)
    5382   {
    5383     if (!pcTmpCU->isDiffMER(xP+nPSW-1, yP-1, xP, yP))
    5384     {
    5385       pcTmpCU = NULL;
    5386     }
    5387   }
    5388 #endif
    5389 
    5390   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
    5391   {
    5392 #if LGE_DVMCP_MEM_REDUCTION_B0135
    5393     iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
    5394 #endif
    5395     bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
    5396     for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
    5397     {
    5398       eRefPicList = RefPicList(iList);
    5399       Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
    5400       if( refId >= 0)
    5401       {
    5402         Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
    5403         if (refViewIdx!= m_pcSlice->getViewId())
    5404         {
    5405           TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5406           clipMv(cMvPred);
    5407           pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    5408           pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    5409           return;
    5410         }
    5411 #if LGE_DVMCP_MEM_REDUCTION_B0135
    5412         else if(iLCUAddrDiff == 0) //MCP, within same LCU
    5413 #else
    5414         else // MCP
    5415 #endif
    5416         {
    5417           cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5418           if( cTmpMvPred.m_bDvMcp  && bTmpIsSkipped )
    5419           {
    5420             aiDvMcpDvCand[iList][DVFROM_ABOVE] = cTmpMvPred.m_iDvMcpDispX;
    5421             abDvMcpFlag  [iList][DVFROM_ABOVE] = true;
    5422             bDvMcpIsFound = true;
    5423           }
    5424         }
    5425       }
    5426     }
    5427   }
    5428 
    5429 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    5430   pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, false, true);
    5431 #else
    5432   pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, true, true);
    5433 #endif
    5434 #if LGE_IVMP_PARALLEL_MERGE_B0136
    5435   if (pcTmpCU && bParMerge)
    5436   {
    5437     if (!pcTmpCU->isDiffMER(xP+nPSW, yP-1, xP, yP))
    5438     {
    5439       pcTmpCU = NULL;
    5440     }
    5441   }
    5442 #endif
    5443 
    5444   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
    5445   {
    5446 #if LGE_DVMCP_MEM_REDUCTION_B0135
    5447     iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
    5448 #endif
    5449     bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
    5450     for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
    5451     {
    5452       eRefPicList = RefPicList(iList);
    5453       Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
    5454       if( refId >= 0)
    5455       {
    5456         Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
    5457         if (refViewIdx!= m_pcSlice->getViewId())
    5458         {
    5459           TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5460           clipMv(cMvPred);
    5461           pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    5462           pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    5463           return;
    5464         }
    5465 #if LGE_DVMCP_MEM_REDUCTION_B0135
    5466         else if(iLCUAddrDiff == 0)
    5467 #else
    5468         else  // MCP
    5469 #endif
    5470         {
    5471           cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5472           if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
    5473           {
    5474             aiDvMcpDvCand[iList][DVFROM_ABOVERIGHT] = cTmpMvPred.m_iDvMcpDispX;
    5475             abDvMcpFlag  [iList][DVFROM_ABOVERIGHT] = true;
    5476             bDvMcpIsFound = true;
    5477           }
    5478         }
    5479       }
    5480     }
    5481   }
    5482 
    5483 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    5484   pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true, false);
    5485 #else
    5486   pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB);
    5487 #endif
    5488 #if LGE_IVMP_PARALLEL_MERGE_B0136
    5489   if (pcTmpCU && bParMerge)
    5490   {
    5491     if (!pcTmpCU->isDiffMER(xP-1, yP+nPSH, xP, yP))
    5492     {
    5493       pcTmpCU = NULL;
    5494     }
    5495   }
    5496 #endif
    5497   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
    5498   {
    5499     bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
    5500     for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
    5501     {
    5502       eRefPicList = RefPicList(iList);
    5503       Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
    5504       if( refId >= 0)
    5505       {
    5506         Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
    5507         if (refViewIdx!= m_pcSlice->getViewId())
    5508         {
    5509           TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5510           clipMv(cMvPred);
    5511           pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    5512           pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    5513           return;
    5514         }
    5515         else // MCP
    5516         {
    5517           cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5518           if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
    5519           {
    5520             aiDvMcpDvCand[iList][DVFROM_LEFTBELOW] = cTmpMvPred.m_iDvMcpDispX;
    5521             abDvMcpFlag  [iList][DVFROM_LEFTBELOW] = true;
    5522             bDvMcpIsFound = true;
    5523           }
    5524         }
    5525       }
    5526     }
    5527   }
    5528 
    5529   // Above predictor search
    5530 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    5531   pcTmpCU = getPUAboveLeft(uiIdx, (m_uiAbsIdxInLCU + uiPartAddr), true, false, true);
    5532   assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr));
    5533 #else
    5534   pcTmpCU = getPUAboveLeft(uiIdx, uiPartIdxLT, true, true, true);
    5535 #endif
    5536 #if LGE_IVMP_PARALLEL_MERGE_B0136
    5537   if (pcTmpCU && bParMerge)
    5538   {
    5539     if (!pcTmpCU->isDiffMER(xP-1, yP-1, xP, yP))
    5540     {
    5541       pcTmpCU = NULL;
    5542     }
    5543   }
    5544 #endif
    5545 
    5546   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
    5547   {
    5548 #if LGE_DVMCP_MEM_REDUCTION_B0135
    5549     iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
    5550 #endif
    5551     bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
    5552     for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
    5553     {
    5554       eRefPicList = RefPicList(iList);
    5555       Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
    5556       if( refId >= 0)
    5557       {
    5558         Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
    5559         if (refViewIdx!= m_pcSlice->getViewId())
    5560         {
    5561           TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5562           clipMv(cMvPred);
    5563           pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    5564           pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    5565           return;
    5566         }
    5567 #if LGE_DVMCP_MEM_REDUCTION_B0135
    5568         else if(iLCUAddrDiff <= 1)
    5569 #else
    5570         else // MCP
    5571 #endif
    5572         {
    5573           cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5574           if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
    5575           {
    5576             aiDvMcpDvCand[iList][DVFROM_ABOVELEFT] = cTmpMvPred.m_iDvMcpDispX;
    5577             abDvMcpFlag  [iList][DVFROM_ABOVELEFT] = true;
    5578             bDvMcpIsFound = true;
    5579           }
    5580         }
    5581       }
    5582     }
    5583   }
    5584 
     5263#if MTK_SAIT_TEMPORAL_FIRST_ORDER_C0141_C0097
    55855264  // copied from getInterMergeCand()
    55865265  if ( getSlice()->getPPS()->getEnableTMVPFlag() )
    55875266  {
    5588 #if !QC_SIMPLE_NBDV_B0047
    5589     UInt uiPUIdx = uiPartIdx;
    5590     UInt uiAbsPartAddr = uiPartAddr;
    5591 
    5592     // col [2]
    5593     Int iRefIdxSkip[2] = {-1, -1};
    5594     if( !bMerge )
    5595     {
    5596       iRefIdxSkip[ eRefPicList0 ] = iRefIdx0;
    5597     }
    5598     else
    5599     {
    5600       for (Int i=0; i<2; i++)
    5601       {
    5602         RefPicList  eRefPicList1 = ( i==1 ? REF_PIC_LIST_1 : REF_PIC_LIST_0 );
    5603 #if SET_MERGE_TMVP_REFIDX
    5604         Int iRefIdxTmp;
    5605         if ( uiPUIdx != 0 )
    5606         {
    5607           iRefIdxTmp = 0;
    5608         }
    5609         else
    5610         {   
    5611           iRefIdxTmp = (pcCULeft != NULL) ? pcCULeft->getCUMvField(eRefPicList1)->getRefIdx(uiLeftPartIdx) : -1;
    5612         }
    5613 #else     
    5614         Int iRefIdxTmp = (pcCULeft != NULL) ? pcCULeft->getCUMvField(eRefPicList1)->getRefIdx(uiLeftPartIdx) : -1;
    5615 #endif
    5616         iRefIdxSkip[i] = (iRefIdxTmp != -1) ? iRefIdxTmp : 0;
    5617       }
    5618     }
    5619 
    5620     //>> MTK colocated-RightBottom
    5621     UInt uiPartIdxRB;
    5622     Int uiLCUIdx = getAddr();
    5623     eCUMode = getPartitionSize( 0 );
    5624 
    5625     deriveRightBottomIdx( eCUMode, uiPUIdx, uiPartIdxRB ); 
    5626 
    5627     UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];
    5628     //UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();
    5629 
    5630     TComMv cColMv;
    5631     Int iRefIdx;
    5632 
    5633     if      ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )  // image boundary check
    5634     {
    5635       uiLCUIdx = -1;
    5636     }
    5637     else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
    5638     {
    5639       uiLCUIdx = -1;
    5640     }
    5641     else
    5642     {
    5643       if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) &&           // is not at the last column of LCU
    5644         ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row    of LCU
    5645       {
    5646         uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ];
    5647         uiLCUIdx = getAddr();
    5648       }
    5649       else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 )           // is not at the last column of LCU But is last row of LCU
    5650       {
    5651         uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ];
    5652         uiLCUIdx = -1 ;
    5653       }
    5654       else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
    5655       {
    5656         uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ];
    5657         uiLCUIdx = getAddr() + 1;
    5658       }
    5659       else //is the right bottom corner of LCU                       
    5660       {
    5661         uiAbsPartAddr = 0;
    5662         uiLCUIdx = -1 ;
    5663       }
    5664     }
    5665 
    5666     Bool bExistMV = false;
    5667     UInt uiPartIdxCenter;
    5668     UInt uiCurLCUIdx = getAddr();
    5669     xDeriveCenterIdx( eCUMode, uiPUIdx, uiPartIdxCenter );
    5670 
    5671     Int iTargetView, iStartView;
    5672     if( !bMerge ) // AMVP
    5673     {
    5674       bExistMV = uiLCUIdx >= 0 && xGetColDisMV( eRefPicList0, iRefIdx0, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetView, iStartView );
    5675       if( bExistMV == false )
    5676       {
    5677         bExistMV = xGetColDisMV( eRefPicList0, iRefIdx0, uiCurLCUIdx, uiPartIdxCenter, cColMv, iTargetView, iStartView );
    5678       }
    5679       if( bExistMV ) // DV is found
    5680       {
    5681         if( cColMv.m_bDvMcp == false ) //=> DCP, if true => DV-MCP
    5682         {
    5683           clipMv(cColMv);
    5684           pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
    5685           pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetView;
    5686           return;
    5687         }
    5688         else // DV-MCP
    5689         {
    5690           aiDvMcpDvCand[eRefPicList0][DVFROM_COL] = cColMv.getHor();
    5691           abDvMcpFlag  [eRefPicList0][DVFROM_COL] = true;
    5692           bDvMcpIsFound = true;
    5693         }
    5694       }
    5695     }
    5696     else // MERGE
    5697     {
    5698       iRefIdx = iRefIdxSkip[0];
    5699       bExistMV = uiLCUIdx >= 0 && xGetColDisMV( REF_PIC_LIST_0, iRefIdx, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetView, iStartView );
    5700       if( bExistMV == false )
    5701       {
    5702         bExistMV = xGetColDisMV( REF_PIC_LIST_0, iRefIdx, uiCurLCUIdx, uiPartIdxCenter,  cColMv, iTargetView, iStartView );
    5703       }
    5704       if( bExistMV )
    5705       {
    5706         if( cColMv.m_bDvMcp == false ) // DCP
    5707         {
    5708           clipMv(cColMv);
    5709           pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
    5710           pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetView;
    5711           return;
    5712         }
    5713         else { // // DV-MCP
    5714           aiDvMcpDvCand[0][DVFROM_COL] = cColMv.getHor();
    5715           abDvMcpFlag  [0][DVFROM_COL] = true;
    5716           bDvMcpIsFound = true;
    5717         };
    5718 
    5719         if ( getSlice()->isInterB() )
    5720         {       
    5721           iRefIdx = iRefIdxSkip[1];
    5722           bExistMV = uiLCUIdx >= 0 && xGetColDisMV( REF_PIC_LIST_1, iRefIdx, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetView, iStartView );
    5723           if( bExistMV == false )
    5724           {
    5725             bExistMV = xGetColDisMV( REF_PIC_LIST_1, iRefIdx, uiCurLCUIdx, uiPartIdxCenter,  cColMv, iTargetView, iStartView );
    5726           }
    5727           if( bExistMV )
    5728           {
    5729             if( cColMv.m_bDvMcp == false ) // DCP
    5730             {
    5731               clipMv(cColMv);
    5732               pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
    5733               pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetView;
    5734               return;
    5735             }
    5736             else // DV-MCP
    5737             {
    5738               aiDvMcpDvCand[1][DVFROM_COL] = cColMv.getHor();
    5739               abDvMcpFlag  [1][DVFROM_COL] = true;
    5740               bDvMcpIsFound = true;
    5741             };
    5742           }
    5743         }
    5744       }
    5745     }
    5746 #else
    57475267    TComMv cColMv;
    57485268    Int iTargetViewIdx = 0;
    57495269    Int iTStartViewIdx = 0;
    57505270    UInt uiPartIdxRB, uiBRIdx;
     5271#if !MTK_SIMPLIFY_DVTC_C0135
    57515272    Int uiViewIdxCurr= getSlice()->getViewId();
     5273#endif
    57525274    UInt uiPartIdxCenter;
    57535275    xDeriveCenterIdx( eCUMode, uiPartIdx, uiPartIdxCenter );
     
    57595281    uiBRIdx = uiPartIdxLT;
    57605282    UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];
     5283#if MTK_SIMPLIFY_DVTC_C0135
     5284    if (( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() )>= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )
     5285    {
     5286      uiLCUnew = -1;
     5287    }
     5288    else if(( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() )>= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
     5289    {
     5290      uiLCUnew = -1;
     5291    }
     5292    else
     5293#else
    57615294    if ( (( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) < m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) &&(( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getSPS()->getPicHeightInLumaSamples() ))  // image boundary check
     5295#endif
    57625296    {
    57635297      if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) &&           // is not at the last column of LCU
     
    57695303      {
    57705304        uiBRIdx = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ];
     5305#if MTK_SIMPLIFY_DVTC_C0135
     5306        uiLCUnew = -1;
     5307#else
    57715308        uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU();
     5309#endif
    57725310      }
    57735311      else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
     
    57795317      {
    57805318        uiBRIdx = 0;
     5319#if MTK_SIMPLIFY_DVTC_C0135
     5320        uiLCUnew = -1;
     5321#else
    57815322        uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU() + 1;
     5323#endif
    57825324      }
    57835325    }
     
    58055347      if( m_pcSlice->getViewId() == getSlice()->getRefPic( eRefPicList, lpRef)->getViewId() )
    58065348      {
     5349#if !MTK_SIMPLIFY_DVTC_C0135
    58075350        if (uiViewIdxCurr > 1) 
    58085351        {
     5352#endif
    58095353          if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) )
    58105354          {
    58115355            clipMv(cColMv);
    5812             pDInfo->m_acMvCand[pDInfo->iN] = cColMv;
    5813             pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx;
     5356#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     5357            pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5358            pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     5359#else
     5360            {
     5361              TComPic* picDepth = NULL;
     5362              picDepth = getSlice()->getRefPicBaseDepth();
     5363              if (picDepth && bDepthRefine)
     5364#if LGE_SIMP_DVP_REFINE_C0112
     5365                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
     5366#else
     5367                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
     5368#endif
     5369
     5370              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5371              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     5372            }
     5373#endif
    58145374            return ;
    58155375          }
     5376#if !MTK_SIMPLIFY_DVTC_C0135
    58165377        }
    5817 
     5378#endif
    58185379        if(xGetColDisMV( eRefPicList, lpRef, uiLCUIdx, uiPartIdxCenter,  cColMv, iTargetViewIdx, iTStartViewIdx ))
    58195380        {
    58205381          clipMv(cColMv);
    5821           pDInfo->m_acMvCand[pDInfo->iN] = cColMv;
    5822           pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx;
     5382#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     5383            pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5384            pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     5385#else
     5386            {
     5387              TComPic* picDepth = NULL;
     5388              picDepth = getSlice()->getRefPicBaseDepth();
     5389              if (picDepth && bDepthRefine)
     5390#if LGE_SIMP_DVP_REFINE_C0112
     5391                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
     5392#else
     5393                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
     5394#endif
     5395              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5396              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     5397            }
     5398#endif
    58235399          return ;
    58245400        }
     5401#if !MTK_SIMPLIFY_DVTC_C0135
    58255402        if(uiViewIdxCurr == 1) 
    58265403        {
     
    58285405          {
    58295406            clipMv(cColMv);
    5830             pDInfo->m_acMvCand[pDInfo->iN] = cColMv;
    5831             pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx;
     5407#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     5408            pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5409            pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     5410#else
     5411            {
     5412              TComPic* picDepth = NULL;
     5413              picDepth = getSlice()->getRefPicBaseDepth();
     5414              if (picDepth && bDepthRefine)
     5415#if LGE_SIMP_DVP_REFINE_C0112
     5416                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
     5417#else
     5418                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
     5419#endif
     5420              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5421              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     5422            }
     5423#endif
    58325424            return ;
    58335425          }
    58345426        }
    5835       }
    5836     }
    5837 #endif
     5427#endif
     5428      }
     5429    }
    58385430  } // if TMVP Flag
     5431#endif
     5432  UInt uiIdx = 0;
     5433  pcTmpCU = getPULeft(uiIdx, uiPartIdxLB, true, false);
     5434  if ( uiPartIdx == 1 && (eCUMode == SIZE_Nx2N || eCUMode == SIZE_nLx2N || eCUMode == SIZE_nRx2N) )
     5435  {
     5436    pcTmpCU = NULL;
     5437  }
     5438
     5439  if (pcTmpCU && bParMerge)
     5440  {
     5441    if (!pcTmpCU->isDiffMER(xP -1, yP+nPSH-1, xP, yP))
     5442    {
     5443      pcTmpCU = NULL;
     5444    }
     5445  }
     5446
     5447  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
     5448  {
     5449    bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
     5450    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     5451    {
     5452      eRefPicList = RefPicList(iList);
     5453      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
     5454      if( refId >= 0)
     5455      {
     5456        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
     5457        if (refViewIdx != m_pcSlice->getViewId()) // DCP
     5458        {
     5459          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     5460          clipMv(cMvPred);
     5461#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     5462          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     5463          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5464#else
     5465          {
     5466            TComPic* picDepth = NULL;
     5467            picDepth = getSlice()->getRefPicBaseDepth();
     5468            if (picDepth && bDepthRefine)
     5469#if LGE_SIMP_DVP_REFINE_C0112
     5470              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true);
     5471#else
     5472              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
     5473#endif
     5474            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     5475            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5476          }
     5477#endif
     5478          return;
     5479        }
     5480        else // MCP
     5481        {
     5482          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     5483          if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
     5484          {
     5485#if MTK_RELEASE_DV_CONSTRAINT_C0129
     5486            aiDvMcpDvCandX[iList][DVFROM_LEFT] = cTmpMvPred.m_iDvMcpDispX;
     5487            aiDvMcpDvCandY[iList][DVFROM_LEFT] = cTmpMvPred.m_iDvMcpDispY;
     5488#else
     5489            aiDvMcpDvCand[iList][DVFROM_LEFT] = cTmpMvPred.m_iDvMcpDispX;
     5490#endif
     5491            abDvMcpFlag  [iList][DVFROM_LEFT] = true;
     5492            bDvMcpIsFound = true;
     5493          }
     5494        }
     5495      }
     5496#if MERL_VSP_C0152
     5497      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
     5498      {
     5499        TComPic* picDepth = NULL;
     5500        TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
     5501        picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
     5502        if (picDepth && bDepthRefine)
     5503          estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
     5504        myMv.setVer(0);
     5505
     5506        pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
     5507        pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
     5508        return;
     5509      }
     5510#endif
     5511    }
     5512  }
     5513
     5514  pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT, true, false, true);
     5515  if ( uiPartIdx == 1 && (eCUMode == SIZE_2NxN || eCUMode == SIZE_2NxnU || eCUMode == SIZE_2NxnD) )
     5516  {
     5517    pcTmpCU = NULL;
     5518  }
     5519
     5520  if (pcTmpCU && bParMerge)
     5521  {
     5522    if (!pcTmpCU->isDiffMER(xP+nPSW-1, yP-1, xP, yP))
     5523    {
     5524      pcTmpCU = NULL;
     5525    }
     5526  }
     5527
     5528  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
     5529  {
     5530    iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
     5531    bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
     5532    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     5533    {
     5534      eRefPicList = RefPicList(iList);
     5535      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
     5536      if( refId >= 0)
     5537      {
     5538        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
     5539        if (refViewIdx!= m_pcSlice->getViewId())
     5540        {
     5541          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     5542          clipMv(cMvPred);
     5543#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     5544          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     5545          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5546#else
     5547          {
     5548            TComPic* picDepth = NULL;
     5549            picDepth = getSlice()->getRefPicBaseDepth();
     5550            if (picDepth && bDepthRefine)
     5551#if LGE_SIMP_DVP_REFINE_C0112
     5552              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true);
     5553#else
     5554              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
     5555#endif
     5556            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     5557            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5558          }
     5559#endif
     5560          return;
     5561        }
     5562        else if(iLCUAddrDiff == 0) //MCP, within same LCU
     5563        {
     5564          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     5565          if( cTmpMvPred.m_bDvMcp  && bTmpIsSkipped )
     5566          {
     5567#if MTK_RELEASE_DV_CONSTRAINT_C0129
     5568            aiDvMcpDvCandX[iList][DVFROM_ABOVE] = cTmpMvPred.m_iDvMcpDispX;
     5569            aiDvMcpDvCandY[iList][DVFROM_ABOVE] = cTmpMvPred.m_iDvMcpDispY;
     5570#else
     5571            aiDvMcpDvCand[iList][DVFROM_ABOVE] = cTmpMvPred.m_iDvMcpDispX;
     5572#endif
     5573            abDvMcpFlag  [iList][DVFROM_ABOVE] = true;
     5574            bDvMcpIsFound = true;
     5575          }
     5576        }
     5577      }
     5578#if MERL_VSP_C0152
     5579      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
     5580      {
     5581        TComPic* picDepth = NULL;
     5582        TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
     5583        picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
     5584        if (picDepth && bDepthRefine)
     5585          estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
     5586        myMv.setVer(0);
     5587
     5588        pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
     5589        pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
     5590        return;
     5591      }
     5592#endif
     5593    }
     5594  }
     5595
     5596  pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, false, true);
     5597
     5598  if (pcTmpCU && bParMerge)
     5599  {
     5600    if (!pcTmpCU->isDiffMER(xP+nPSW, yP-1, xP, yP))
     5601    {
     5602      pcTmpCU = NULL;
     5603    }
     5604  }
     5605
     5606  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
     5607  {
     5608    iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
     5609    bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
     5610    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     5611    {
     5612      eRefPicList = RefPicList(iList);
     5613      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
     5614      if( refId >= 0)
     5615      {
     5616        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
     5617        if (refViewIdx!= m_pcSlice->getViewId())
     5618        {
     5619          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     5620          clipMv(cMvPred);
     5621#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     5622          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     5623          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5624#else
     5625          {
     5626            TComPic* picDepth = NULL;
     5627            picDepth = getSlice()->getRefPicBaseDepth();
     5628            if (picDepth && bDepthRefine)
     5629#if LGE_SIMP_DVP_REFINE_C0112
     5630              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true);
     5631#else
     5632              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
     5633#endif
     5634            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     5635            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5636          }
     5637#endif
     5638          return;
     5639        }
     5640        else if(iLCUAddrDiff == 0)
     5641        {
     5642          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     5643          if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
     5644          {
     5645#if MTK_RELEASE_DV_CONSTRAINT_C0129
     5646            aiDvMcpDvCandX[iList][DVFROM_ABOVERIGHT] = cTmpMvPred.m_iDvMcpDispX;
     5647            aiDvMcpDvCandY[iList][DVFROM_ABOVERIGHT] = cTmpMvPred.m_iDvMcpDispY;
     5648#else
     5649            aiDvMcpDvCand[iList][DVFROM_ABOVERIGHT] = cTmpMvPred.m_iDvMcpDispX;
     5650#endif
     5651            abDvMcpFlag  [iList][DVFROM_ABOVERIGHT] = true;
     5652            bDvMcpIsFound = true;
     5653          }
     5654        }
     5655      }
     5656#if MERL_VSP_C0152
     5657      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
     5658      {
     5659        TComPic* picDepth = NULL;
     5660        TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
     5661        picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
     5662        if (picDepth && bDepthRefine)
     5663          estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
     5664        myMv.setVer(0);
     5665
     5666        pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
     5667        pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
     5668        return;
     5669      }
     5670#endif
     5671    }
     5672  }
     5673
     5674  pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true, false);
     5675
     5676  if (pcTmpCU && bParMerge)
     5677  {
     5678    if (!pcTmpCU->isDiffMER(xP-1, yP+nPSH, xP, yP))
     5679    {
     5680      pcTmpCU = NULL;
     5681    }
     5682  }
     5683
     5684  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
     5685  {
     5686    bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
     5687    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     5688    {
     5689      eRefPicList = RefPicList(iList);
     5690      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
     5691      if( refId >= 0)
     5692      {
     5693        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
     5694        if (refViewIdx!= m_pcSlice->getViewId())
     5695        {
     5696          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     5697          clipMv(cMvPred);
     5698#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     5699          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     5700          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5701#else
     5702          {
     5703            TComPic* picDepth = NULL;
     5704            picDepth = getSlice()->getRefPicBaseDepth();
     5705            if (picDepth && bDepthRefine)
     5706#if LGE_SIMP_DVP_REFINE_C0112
     5707              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true);
     5708#else
     5709              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
     5710#endif
     5711            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     5712            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5713          }
     5714#endif
     5715          return;
     5716        }
     5717        else // MCP
     5718        {
     5719          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     5720          if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
     5721          {
     5722#if MTK_RELEASE_DV_CONSTRAINT_C0129
     5723            aiDvMcpDvCandX[iList][DVFROM_LEFTBELOW] = cTmpMvPred.m_iDvMcpDispX;
     5724            aiDvMcpDvCandY[iList][DVFROM_LEFTBELOW] = cTmpMvPred.m_iDvMcpDispY;
     5725#else
     5726            aiDvMcpDvCand[iList][DVFROM_LEFTBELOW] = cTmpMvPred.m_iDvMcpDispX;
     5727#endif
     5728            abDvMcpFlag  [iList][DVFROM_LEFTBELOW] = true;
     5729            bDvMcpIsFound = true;
     5730          }
     5731        }
     5732      }
     5733#if MERL_VSP_C0152
     5734      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
     5735      {
     5736        TComPic* picDepth = NULL;
     5737        TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
     5738        picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
     5739        if (picDepth && bDepthRefine)
     5740          estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
     5741        myMv.setVer(0);
     5742
     5743        pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
     5744        pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
     5745        return;
     5746      }
     5747#endif
     5748    }
     5749  }
     5750
     5751  // Above predictor search
     5752  pcTmpCU = getPUAboveLeft(uiIdx, (m_uiAbsIdxInLCU + uiPartAddr), true, false, true);
     5753  assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr));
     5754
     5755  if (pcTmpCU && bParMerge)
     5756  {
     5757    if (!pcTmpCU->isDiffMER(xP-1, yP-1, xP, yP))
     5758    {
     5759      pcTmpCU = NULL;
     5760    }
     5761  }
     5762
     5763  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
     5764  {
     5765    iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
     5766
     5767    bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
     5768    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     5769    {
     5770      eRefPicList = RefPicList(iList);
     5771      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
     5772      if( refId >= 0)
     5773      {
     5774        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
     5775        if (refViewIdx!= m_pcSlice->getViewId())
     5776        {
     5777          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     5778          clipMv(cMvPred);
     5779#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     5780          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     5781          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5782#else
     5783          {
     5784            TComPic* picDepth = NULL;
     5785            picDepth = getSlice()->getRefPicBaseDepth();
     5786            if (picDepth && bDepthRefine)
     5787#if LGE_SIMP_DVP_REFINE_C0112
     5788              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true);
     5789#else
     5790              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
     5791#endif
     5792            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     5793            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5794          }
     5795#endif
     5796          return;
     5797        }
     5798        else if(iLCUAddrDiff <= 1)
     5799        {
     5800          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     5801          if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
     5802          {
     5803#if MTK_RELEASE_DV_CONSTRAINT_C0129
     5804            aiDvMcpDvCandX[iList][DVFROM_ABOVELEFT] = cTmpMvPred.m_iDvMcpDispX;
     5805            aiDvMcpDvCandY[iList][DVFROM_ABOVELEFT] = cTmpMvPred.m_iDvMcpDispY;
     5806#else
     5807            aiDvMcpDvCand[iList][DVFROM_ABOVELEFT] = cTmpMvPred.m_iDvMcpDispX;
     5808#endif
     5809            abDvMcpFlag  [iList][DVFROM_ABOVELEFT] = true;
     5810            bDvMcpIsFound = true;
     5811          }
     5812        }
     5813      }
     5814#if MERL_VSP_C0152
     5815      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
     5816      {
     5817        TComPic* picDepth = NULL;
     5818        TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
     5819        picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
     5820        if (picDepth && bDepthRefine)
     5821          estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
     5822        myMv.setVer(0);
     5823
     5824        pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
     5825        pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
     5826        return;
     5827      }
     5828#endif
     5829    }
     5830  }
     5831#if !MTK_SAIT_TEMPORAL_FIRST_ORDER_C0141_C0097
     5832  // copied from getInterMergeCand()
     5833  if ( getSlice()->getPPS()->getEnableTMVPFlag() )
     5834  {
     5835    TComMv cColMv;
     5836    Int iTargetViewIdx = 0;
     5837    Int iTStartViewIdx = 0;
     5838    UInt uiPartIdxRB, uiBRIdx;
     5839#if !MTK_SIMPLIFY_DVTC_C0135
     5840    Int uiViewIdxCurr= getSlice()->getViewId();
     5841#endif
     5842    UInt uiPartIdxCenter;
     5843    xDeriveCenterIdx( eCUMode, uiPartIdx, uiPartIdxCenter );
     5844
     5845    Int uiLCUIdx = getAddr();
     5846    Int uiLCUnew = uiLCUIdx;
     5847    eCUMode = getPartitionSize( 0 );
     5848    deriveRightBottomIdx( eCUMode, uiPartIdx, uiPartIdxRB ); 
     5849    uiBRIdx = uiPartIdxLT;
     5850    UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];
     5851#if MTK_SIMPLIFY_DVTC_C0135
     5852    if (( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() )>= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )
     5853    {
     5854      uiLCUnew = -1;
     5855    }
     5856    else if(( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() )>= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
     5857    {
     5858      uiLCUnew = -1;
     5859    }
     5860    else
     5861#else
     5862    if ( (( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) < m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) &&(( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getSPS()->getPicHeightInLumaSamples() ))  // image boundary check
     5863#endif
     5864    {
     5865      if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) &&           // is not at the last column of LCU
     5866      ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row    of LCU
     5867      {
     5868        uiBRIdx = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ];
     5869      }
     5870      else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 )           // is not at the last column of LCU But is last row of LCU
     5871      {
     5872        uiBRIdx = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ];
     5873#if MTK_SIMPLIFY_DVTC_C0135
     5874        uiLCUnew = -1;
     5875#else
     5876        uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU();
     5877#endif
     5878      }
     5879      else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
     5880      {
     5881        uiBRIdx = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ];
     5882        uiLCUnew = uiLCUIdx + 1;
     5883      }
     5884      else //is the right bottom corner of LCU                       
     5885      {
     5886        uiBRIdx = 0;
     5887#if MTK_SIMPLIFY_DVTC_C0135
     5888        uiLCUnew = -1;
     5889#else
     5890        uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU() + 1;
     5891#endif
     5892      }
     5893    }
     5894    const Int iNumofCandPic = 2;
     5895    for(Int i =0; i < iNumofCandPic; i++)
     5896    {
     5897      Int lpRef=0;
     5898      if(i == 0)
     5899      {   //check the col-located picture
     5900        eRefPicList = RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0);
     5901#if COLLOCATED_REF_IDX
     5902        lpRef = getSlice()->getColRefIdx();
     5903#else
     5904        Int lpRef = 0;
     5905#endif
     5906      }
     5907      else
     5908      {
     5909        if(!(getPic()->getRapbCheck()))
     5910          break;
     5911        eRefPicList=getPic()->getRapRefList();
     5912        lpRef=getPic()->getRapRefIdx();
     5913      }
     5914
     5915      if( m_pcSlice->getViewId() == getSlice()->getRefPic( eRefPicList, lpRef)->getViewId() )
     5916      {
     5917#if !MTK_SIMPLIFY_DVTC_C0135
     5918        if (uiViewIdxCurr > 1) 
     5919        {
     5920#endif
     5921          if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) )
     5922          {
     5923            clipMv(cColMv);
     5924#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     5925            pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5926            pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     5927#else
     5928            {
     5929              TComPic* picDepth = NULL;
     5930              picDepth = getSlice()->getRefPicBaseDepth();
     5931              if (picDepth && bDepthRefine)
     5932#if LGE_SIMP_DVP_REFINE_C0112
     5933                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
     5934#else
     5935                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
     5936#endif
     5937
     5938              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5939              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     5940            }
     5941#endif
     5942            return ;
     5943          }
     5944#if !MTK_SIMPLIFY_DVTC_C0135
     5945        }
     5946#endif
     5947        if(xGetColDisMV( eRefPicList, lpRef, uiLCUIdx, uiPartIdxCenter,  cColMv, iTargetViewIdx, iTStartViewIdx ))
     5948        {
     5949          clipMv(cColMv);
     5950#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     5951            pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5952            pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     5953#else
     5954            {
     5955              TComPic* picDepth = NULL;
     5956              picDepth = getSlice()->getRefPicBaseDepth();
     5957              if (picDepth && bDepthRefine)
     5958#if LGE_SIMP_DVP_REFINE_C0112
     5959                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
     5960#else
     5961                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
     5962#endif
     5963              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5964              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     5965            }
     5966#endif
     5967          return ;
     5968        }
     5969#if !MTK_SIMPLIFY_DVTC_C0135
     5970        if(uiViewIdxCurr == 1) 
     5971        {
     5972          if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) )
     5973          {
     5974            clipMv(cColMv);
     5975#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     5976            pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5977            pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     5978#else
     5979            {
     5980              TComPic* picDepth = NULL;
     5981              picDepth = getSlice()->getRefPicBaseDepth();
     5982              if (picDepth && bDepthRefine)
     5983#if LGE_SIMP_DVP_REFINE_C0112
     5984                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
     5985#else
     5986                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
     5987#endif
     5988              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5989              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     5990            }
     5991#endif
     5992            return ;
     5993          }
     5994        }
     5995#endif
     5996      }
     5997    }
     5998  } // if TMVP Flag
     5999#endif
    58396000
    58406001  if( bDvMcpIsFound ) // skip dvmcp
    58416002  {
    5842 #if QC_SIMPLE_NBDV_B0047
    58436003    for( Int i=1 ; i<iNumofDvMCP-1 ; i++ ) // 5 spatial
    5844 #else
    5845     for( Int i=1 ; i<7 ; i++ ) // 5 spatial + 1 temporal
    5846 #endif
    58476004    {
    58486005      for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     
    58506007        if( abDvMcpFlag[iList][i]==true )
    58516008        {
     6009#if MTK_RELEASE_DV_CONSTRAINT_C0129
     6010          TComMv dv( aiDvMcpDvCandX[iList][ i ], aiDvMcpDvCandY[iList][ i ] );
     6011#else
    58526012          TComMv dv( aiDvMcpDvCand[iList][ i ], 0 );
     6013#endif
    58536014          clipMv( dv );
    5854           pDInfo->m_acMvCand[ pDInfo->iN  ] = dv;
    5855           pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0;
     6015#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     6016          pDInfo->m_acMvCand[ pDInfo->iN] = dv;
     6017          pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0;
     6018#else
     6019          {
     6020            TComPic* picDepth = NULL;
     6021            picDepth = getSlice()->getRefPicBaseDepth();
     6022            if (picDepth && bDepthRefine)
     6023#if LGE_SIMP_DVP_REFINE_C0112
     6024              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &dv, true);
     6025#else
     6026              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &dv);
     6027#endif
     6028            pDInfo->m_acMvCand[ pDInfo->iN] = dv;
     6029            pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0;
     6030          }
     6031#endif
    58566032          return;
    58576033        }
     
    58636039}
    58646040#endif
     6041
    58656042#endif
    58666043
     
    58726049 * \param pInfo
    58736050 */
    5874 #if SHARP_INTERVIEW_DECOUPLE_B0111
     6051#if H3D_IVMP
    58756052Void TComDataCU::fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo, Int iMVPIdx)
    58766053{
     
    58986075    if (iMVPIdx<=0)
    58996076    {
    5900       // extention part
     6077#if H3D_NBDV
     6078      // Extension part
    59016079      DisInfo cDisInfo;
    59026080      cDisInfo.iN = 0;
    5903 #if LGE_DVMCP_A0126
    5904 #if QC_SIMPLE_NBDV_B0047
    5905 #if FIX_LGE_IVMP_PARALLEL_MERGE_B0136
    5906       getDisMvpCand2(uiPartIdx, uiPartAddr, &cDisInfo, false);
    5907 #else
    5908       getDisMvpCand2(uiPartIdx, uiPartAddr, &cDisInfo);
    5909 #endif
    5910 #else
    5911       getDisMvpCand2(uiPartIdx, uiPartAddr, &cDisInfo, false, eRefPicList, iRefIdx );
    5912 #endif
    5913 #else
    5914       getDisMvpCand (uiPartIdx, uiPartAddr, &cDisInfo );
    5915 #endif
     6081      getDisMvpCandNBDV(uiPartIdx, uiPartAddr, &cDisInfo, false
     6082#if MERL_VSP_C0152
     6083            , true
     6084#endif
     6085              );
    59166086      if(cDisInfo.iN==0)
    59176087      {
     
    59216091        cDisInfo.m_aVIdxCan[0] = 0;
    59226092      }
     6093#if QC_AMVP_MRG_UNIFY_IVCAN_C0051
     6094      Int paiPdmRefIdx[4] = {-1, -1, -1, -1};
     6095      Int iPdmDir[4]      = {-1, -1, -1, -1};
     6096#if QC_C0051_FIXED_BY_MTK
     6097      TComMv cPdmMvPred[4];
     6098#else
     6099      TComMv cPdmMvPred[2];
     6100#endif
     6101      cPdmMvPred[0].m_bDvMcp = cPdmMvPred[1].m_bDvMcp = false;
     6102      if(getUnifiedMvPredCan(uiPartIdx, eRefPicList, iRefIdx, paiPdmRefIdx, cPdmMvPred, &cDisInfo, iPdmDir, false))
     6103#else // QC_AMVP_MRG_UNIFY_IVCAN_C0051
    59236104      TComMv  cPdmMvPred;
    5924 #if QC_MULTI_DIS_CAN_A0097
    59256105      if( getPdmMvPredDisCan( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred, &cDisInfo ) )
     6106#endif // QC_AMVP_MRG_UNIFY_IVCAN_C0051
     6107#else // H3D_NBDV
     6108      if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) )
     6109#endif
     6110
     6111#if QC_AMVP_MRG_UNIFY_IVCAN_C0051
     6112      {
     6113        clipMv( cPdmMvPred[0] );
     6114        pInfo->m_acMvCand[0] = cPdmMvPred[0];
     6115      }
     6116      else
     6117      {
     6118        pInfo->m_acMvCand[0].set(0,0);
     6119      }
    59266120#else
    5927       if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) )
    5928 #endif
    59296121      {
    59306122        clipMv( cPdmMvPred );
     
    59356127        pInfo->m_acMvCand[0].set(0,0);
    59366128      }
     6129#endif
    59376130    }
    59386131  }
     
    59416134
    59426135Void TComDataCU::fillMvpCandBase( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo )
    5943 #else
     6136#else //  H3D_IVMP 
    59446137Void TComDataCU::fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo )
    5945 #endif
     6138#endif //  H3D_IVMP
    59466139{
    59476140  PartSize eCUMode = getPartitionSize( 0 );
     
    59556148    return;
    59566149  }
    5957  
    5958 #if QC_MULTI_DIS_CAN_A0097 && !SHARP_INTERVIEW_DECOUPLE_B0111
    5959   DisInfo cDisInfo;
    5960   cDisInfo.iN = 0;
    5961   if(m_pcSlice->getSPS()->getViewId() && m_pcSlice->getSPS()->getMultiviewMvPredMode())
    5962   {
    5963 #if LGE_DVMCP_A0126
    5964 #if QC_SIMPLE_NBDV_B0047
    5965 #if FIX_LGE_IVMP_PARALLEL_MERGE_B0136
    5966     getDisMvpCand2(uiPartIdx, uiPartAddr, &cDisInfo, false);
    5967 #else
    5968     getDisMvpCand2(uiPartIdx, uiPartAddr, &cDisInfo);
    5969 #endif
    5970 #else
    5971     getDisMvpCand2(uiPartIdx, uiPartAddr, &cDisInfo, false, eRefPicList, iRefIdx );
    5972 #endif
    5973 #else
    5974     getDisMvpCand (uiPartIdx, uiPartAddr, &cDisInfo );
    5975 #endif
    5976   }
    5977   if(cDisInfo.iN==0)
    5978   {
    5979     cDisInfo.iN = 1;
    5980     cDisInfo.m_acMvCand[0].setHor(0);
    5981     cDisInfo.m_acMvCand[0].setVer(0);
    5982     cDisInfo.m_aVIdxCan[0] = 0;
    5983   }
    5984 #endif
    5985 #if HHI_INTER_VIEW_MOTION_PRED && !SHARP_INTERVIEW_DECOUPLE_B0111
    5986 #if ( PDM_AMVP_POS == 0 )
    5987   // get inter-view mv predictor (at position 0)
    5988   TComMv  cPdmMvPred;
    5989 #if QC_MULTI_DIS_CAN_A0097
    5990   if( getPdmMvPredDisCan( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred, &cDisInfo ) )
    5991 #else
    5992   if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) )
    5993 #endif
    5994   {
    5995     clipMv( cPdmMvPred );
    5996     pInfo->m_acMvCand[ pInfo->iN++ ] = cPdmMvPred;
    5997   }
    5998 #endif
    5999 #endif
    60006150
    60016151  //-- Get Spatial MV
     
    60096159  TComDataCU* tmpCU = NULL;
    60106160  UInt idx;
    6011 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    60126161  tmpCU = getPUBelowLeft(idx, uiPartIdxLB, true, false);
    6013 #else
    6014   tmpCU = getPUBelowLeft(idx, uiPartIdxLB);
    6015 #endif
    60166162  bAddedSmvp = (tmpCU != NULL) && (tmpCU->getPredictionMode(idx) != MODE_INTRA);
    60176163
    60186164  if (!bAddedSmvp)
    60196165  {
    6020 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    60216166    tmpCU = getPULeft(idx, uiPartIdxLB, true, false);
    6022 #else
    6023     tmpCU = getPULeft(idx, uiPartIdxLB);
    6024 #endif
    60256167    bAddedSmvp = (tmpCU != NULL) && (tmpCU->getPredictionMode(idx) != MODE_INTRA);
    60266168  }
     
    60426184  }
    60436185
    6044 #if HHI_INTER_VIEW_MOTION_PRED && !SHARP_INTERVIEW_DECOUPLE_B0111
    6045 #if ( PDM_AMVP_POS == 1 )
    6046   // get inter-view mv predictor (at position 1)
    6047   TComMv  cPdmMvPred;
    6048 #if QC_MULTI_DIS_CAN_A0097
    6049   if( getPdmMvPredDisCan( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred, &cDisInfo ) )
    6050 #else
    6051   if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) )
    6052 #endif
    6053   {
    6054     clipMv( cPdmMvPred );
    6055     pInfo->m_acMvCand[ pInfo->iN++ ] = cPdmMvPred;
    6056   }
    6057 #endif
    6058 #endif
    6059 
    60606186  // Above predictor search
    60616187  bAdded = xAddMVPCand( pInfo, eRefPicList, iRefIdx, uiPartIdxRT, MD_ABOVE_RIGHT);
     
    60946220  }
    60956221
    6096 #if HHI_INTER_VIEW_MOTION_PRED && !SHARP_INTERVIEW_DECOUPLE_B0111
    6097 #if ( PDM_AMVP_POS == 2 )
    6098   // get inter-view mv predictor (at position 2)
    6099   TComMv  cPdmMvPred;
    6100 #if QC_MULTI_DIS_CAN_A0097
    6101   if( getPdmMvPredDisCan( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred, &cDisInfo ) )
    6102 #else
    6103   if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) )
    6104 #endif
    6105   {
    6106     clipMv( cPdmMvPred );
    6107     pInfo->m_acMvCand[ pInfo->iN++ ] = cPdmMvPred;
    6108   }
    6109 #endif
    6110 #endif
    6111 
    6112 #if AMVP_PRUNING_SIMPLIFICATION
     6222
    61136223  if ( pInfo->iN == 2 )
    61146224  {
     
    61166226    {
    61176227      pInfo->iN = 1;
    6118 #if FIX_MISUSE_REFINDEX
     6228#if QC_MRG_CANS_B0048
    61196229      pInfo->m_acMvCand[ 1 ].set(0, 0);
    61206230#endif
    61216231    }
    61226232  }
    6123 #if QC_MULTI_DIS_CAN_A0097 && !SHARP_INTERVIEW_DECOUPLE_B0111
    6124   if ( getSlice()->getViewId()!=0 && pInfo->iN == 3 )
    6125   {
    6126     if ( pInfo->m_acMvCand[ 1 ] == pInfo->m_acMvCand[ 2 ] )
    6127     {
    6128       pInfo->iN = 2;
    6129       if( pInfo->m_acMvCand[ 0 ] == pInfo->m_acMvCand[ 1 ] )
    6130         pInfo->iN = 1;
    6131     }
    6132     else
    6133     {
    6134       if( pInfo->m_acMvCand[ 0 ] == pInfo->m_acMvCand[ 1 ] )
    6135       {
    6136         pInfo->m_acMvCand[1 ] = pInfo->m_acMvCand[ 2 ];
    6137         pInfo->iN = 2;
    6138       }
    6139       else if (pInfo->m_acMvCand[ 0 ] == pInfo->m_acMvCand[ 2 ])
    6140       {
    6141          pInfo->iN = 2;
    6142       }
    6143     }
    6144   }
    6145 #endif
    6146 #endif
    61476233
    61486234  if ( getSlice()->getPPS()->getEnableTMVPFlag() )
     
    61956281    if ( uiLCUIdx >= 0 && xGetColMVP( eRefPicList, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx_Col ) )
    61966282    {
    6197 #if FIX_LGE_DVMCP_B0133
     6283#if H3D_NBDV
    61986284      cColMv.m_bDvMcp = false;
    61996285#endif
     
    62076293      if (xGetColMVP( eRefPicList, uiCurLCUIdx, uiPartIdxCenter,  cColMv, iRefIdx_Col ))
    62086294      {
    6209 #if FIX_LGE_DVMCP_B0133
     6295#if H3D_NBDV
    62106296        cColMv.m_bDvMcp = false;
    62116297#endif
     
    62166302  }
    62176303
    6218 #if HHI_INTER_VIEW_MOTION_PRED && !SHARP_INTERVIEW_DECOUPLE_B0111
    6219 #if ( PDM_AMVP_POS == 3 )
    6220   // get inter-view mv predictor (at position 3)
    6221   TComMv  cPdmMvPred;
    6222 #if QC_MULTI_DIS_CAN_A0097
    6223   if( getPdmMvPredDisCan( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred, &cDisInfo ) )
    6224 #else
    6225   if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) )
    6226 #endif
    6227   {
    6228     clipMv( cPdmMvPred );
    6229     pInfo->m_acMvCand[ pInfo->iN++ ] = cPdmMvPred;
    6230   }
    6231 #endif
    6232 #endif
    6233 
    6234 #if !AMVP_PRUNING_SIMPLIFICATION
    6235   // Check No MV Candidate
    6236   xUniqueMVPCand( pInfo );
    6237 #endif
    6238 
    6239 #if HHI_INTER_VIEW_MOTION_PRED && !SHARP_INTERVIEW_DECOUPLE_B0111
    6240   const Int iNumAMVPCands = AMVP_MAX_NUM_CANDS + ( getSlice()->getSPS()->getMultiviewMvPredMode() ? 1 : 0 );
    6241   if (pInfo->iN > iNumAMVPCands)
    6242   {
    6243     pInfo->iN = iNumAMVPCands;
    6244   }
    6245   else if (pInfo->iN < iNumAMVPCands)
    6246 #else
     6304
    62476305  if (pInfo->iN > AMVP_MAX_NUM_CANDS)
    62486306  {
     
    62506308  }
    62516309  else if (pInfo->iN < AMVP_MAX_NUM_CANDS)
    6252 #endif
    6253   {
    6254 #if !AMVP_ZERO_CHECKING_REMOVAL
    6255     int j;
    6256     for (j=0; j<pInfo->iN; j++)
    6257     {
    6258       if (pInfo->m_acMvCand[j].getHor() == 0 && pInfo->m_acMvCand[j].getVer() == 0)
    6259       {
    6260         break;
    6261       }
    6262     }
    6263     if (j == pInfo->iN)
    6264     {
    6265 #endif
     6310  {
    62666311      pInfo->m_acMvCand[pInfo->iN].set(0,0);
    62676312      pInfo->iN++;
    6268 #if !AMVP_ZERO_CHECKING_REMOVAL
    6269     }
    6270 #endif
    62716313  }
    62726314  return ;
     
    63586400    case MD_LEFT:
    63596401    {
    6360 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    63616402      pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx, true, false);
    6362 #else
    6363       pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx);
    6364 #endif
    63656403      break;
    63666404    }
    63676405    case MD_ABOVE:
    63686406    {
    6369 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    63706407      pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx, true, false, true);
    6371 #else
    6372       pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx, true, true, true);
    6373 #endif
    63746408      break;
    63756409    }
    63766410    case MD_ABOVE_RIGHT:
    63776411    {
    6378 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    63796412      pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx, true, false, true);
    6380 #else
    6381       pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx, true, true, true);
    6382 #endif
    63836413      break;
    63846414    }
    63856415    case MD_BELOW_LEFT:
    63866416    {
    6387 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    63886417      pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx, true, false);
    6389 #else
    6390       pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx);
    6391 #endif
    63926418      break;
    63936419    }
    63946420    case MD_ABOVE_LEFT:
    63956421    {
    6396 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    63976422      pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx, true, false, true);
    6398 #else
    6399       pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx, true, true, true);
    6400 #endif
    64016423      break;
    64026424    }
     
    64076429  }
    64086430 
     6431#if MERL_VSP_C0152
     6432  if(pcTmpCU != NULL && pcTmpCU->getVSPIndex(uiIdx))
     6433  {
     6434    return false;
     6435  }
     6436#endif
     6437
    64096438  if ( pcTmpCU != NULL && m_pcSlice->isEqualRef(eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx), iRefIdx) )
    64106439  {
    64116440    TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    6412 #if LGE_DVMCP_A0126
     6441#if H3D_NBDV
    64136442    cMvPred.m_bDvMcp = false;
    64146443#endif
     
    64546483    {
    64556484      TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList2nd)->getMv(uiIdx);
    6456 #if LGE_DVMCP_A0126
     6485#if H3D_NBDV
    64576486      cMvPred.m_bDvMcp = false;
    64586487#endif
     
    64646493}
    64656494
    6466 #if !AMVP_PRUNING_SIMPLIFICATION
    6467 /**
    6468  * Reduce list of motion vector predictors to a set of unique predictors
    6469  * \param pInfo list of motion vector predictors
    6470  */
    6471 Void TComDataCU::xUniqueMVPCand(AMVPInfo* pInfo)
    6472 {
    6473   Int n = 1;
    6474   if ( pInfo->iN == 0 )
    6475   {
    6476 #if AMVP_ZERO_CHECKING_REMOVAL
    6477     return;
    6478 #else
    6479     // Add a zero candidate is none is available
    6480     pInfo->m_acMvCand[ 0 ].setZero();
    6481 #endif
    6482   }
    6483   else
    6484   {
    6485     for (Int i = 1; i < pInfo->iN; i++)
    6486     {
    6487       Int j;
    6488       for (j = n - 1; j >= 0; j--)
    6489       {
    6490         if ( pInfo->m_acMvCand[ i ] == pInfo->m_acMvCand[ j ] )
    6491         {
    6492           break;
    6493         }
    6494       }
    6495       if ( j < 0 )
    6496       {
    6497         pInfo->m_acMvCand[ n++ ] = pInfo->m_acMvCand[ i ];
    6498       }
    6499     }
    6500   }
    6501   pInfo->iN = n;
    6502 }
    6503 #endif
    65046495
    65056496/**
     
    65156506  TComDataCU* pcTmpCU = NULL;
    65166507  UInt uiIdx;
     6508
    65176509  switch( eDir )
    65186510  {
    65196511  case MD_LEFT:
    65206512    {
    6521 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    65226513      pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx, true, false);
    6523 #else
    6524       pcTmpCU = getPULeft(uiIdx, uiPartUnitIdx);
    6525 #endif
    65266514      break;
    65276515    }
    65286516  case MD_ABOVE:
    65296517    {
    6530 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    65316518      pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx, true, false, true);
    6532 #else
    6533       pcTmpCU = getPUAbove(uiIdx, uiPartUnitIdx, true, true, true);
    6534 #endif
    65356519      break;
    65366520    }
    65376521  case MD_ABOVE_RIGHT:
    65386522    {
    6539 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    65406523      pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx, true, false, true);
    6541 #else
    6542       pcTmpCU = getPUAboveRight(uiIdx, uiPartUnitIdx, true, true, true);
    6543 #endif
    65446524      break;
    65456525    }
    65466526  case MD_BELOW_LEFT:
    65476527    {
    6548 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    65496528      pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx, true, false);
    6550 #else
    6551       pcTmpCU = getPUBelowLeft(uiIdx, uiPartUnitIdx);
    6552 #endif
    65536529      break;
    65546530    }
    65556531  case MD_ABOVE_LEFT:
    65566532    {
    6557 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    65586533      pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx, true, false, true);
    6559 #else
    6560       pcTmpCU = getPUAboveLeft(uiIdx, uiPartUnitIdx, true, true, true);
    6561 #endif
    65626534      break;
    65636535    }
     
    65726544    return false;
    65736545  }
    6574  
     6546
     6547#if MERL_VSP_C0152
     6548  if(pcTmpCU->getVSPIndex(uiIdx))
     6549  {
     6550    return false;
     6551  }
     6552#endif
    65756553  RefPicList eRefPicList2nd = REF_PIC_LIST_0;
    65766554  if(       eRefPicList == REF_PIC_LIST_0 )
     
    65876565  Int iNeibPOC = iCurrPOC;
    65886566  Int iNeibRefPOC;
    6589 
     6567#if INTER_VIEW_VECTOR_SCALING_C0116
     6568  Int iCurrViewId = m_pcSlice->getViewOrderIdx(); // will be changed to view_id
     6569  Int iCurrRefViewId = m_pcSlice->getRefPic(eRefPicList, iRefIdx)->getViewOrderIdx(); // will be changed to view_id
     6570  Int iNeibViewId = iCurrViewId;
     6571  Int iNeibRefViewId;
     6572#endif
    65906573#if QC_IV_AS_LT_B0046
    65916574  Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getIsLongTerm();
     
    65956578  {
    65966579    iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) );
     6580#if INTER_VIEW_VECTOR_SCALING_C0116
     6581    iNeibRefViewId = pcTmpCU->getSlice()->getRefPic(eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx))->getViewOrderIdx(); // will be changed to view_id
     6582#endif
    65976583#if QC_IV_AS_LT_B0046
    65986584    bIsNeibRefLongTerm = m_pcSlice->getRefPic( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx))->getIsLongTerm() ;
     6585#if INTER_VIEW_VECTOR_SCALING_C0116
     6586    if ( (bIsCurrRefLongTerm == bIsNeibRefLongTerm) && ((iNeibRefPOC == iCurrRefPOC) && (iNeibRefViewId == iCurrRefViewId)))
     6587#else
    65996588    if ( (bIsCurrRefLongTerm == bIsNeibRefLongTerm) && (iNeibRefPOC == iCurrRefPOC) )
     6589#endif
    66006590#else
    66016591    if( pcTmpCU->getSlice()->getRefViewId( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) ) != m_pcSlice->getRefViewId( eRefPicList, iRefIdx ) )
     
    66056595    {
    66066596      TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList2nd)->getMv(uiIdx);
    6607 #if LGE_DVMCP_A0126
     6597#if H3D_NBDV
    66086598      cMvPred.m_bDvMcp = false;
    66096599#endif
     
    66186608  {
    66196609    iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) );
     6610#if INTER_VIEW_VECTOR_SCALING_C0116
     6611    iNeibRefViewId = pcTmpCU->getSlice()->getRefPic(eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx))->getViewOrderIdx(); // will be changed to view_id
     6612#endif
    66206613    TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    66216614    TComMv rcMv;
     
    66306623    }
    66316624#endif
     6625#if INTER_VIEW_VECTOR_SCALING_C0116
     6626    Int iScale = 4096;
     6627    if((iCurrRefPOC != iNeibRefPOC)  )    // inter & inter
     6628        iScale = xGetDistScaleFactor( iCurrPOC, iCurrRefPOC, iNeibPOC, iNeibRefPOC );
     6629    else if(m_pcSlice->getIVScalingFlag())    // inter-view & inter-view
     6630        iScale = xGetDistScaleFactor( iCurrViewId, iCurrRefViewId, iNeibViewId, iNeibRefViewId );
     6631#else
    66326632    Int iScale = xGetDistScaleFactor( iCurrPOC, iCurrRefPOC, iNeibPOC, iNeibRefPOC );
     6633#endif
    66336634    if ( iScale == 4096 )
    66346635    {
     
    66396640      rcMv = cMvPred.scaleMv( iScale );
    66406641    }
    6641 #if LGE_DVMCP_A0126
     6642#if H3D_NBDV
    66426643    rcMv.m_bDvMcp = false;
    66436644#endif
     
    66526653  {
    66536654    iNeibRefPOC = pcTmpCU->getSlice()->getRefPOC( eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) );
     6655#if INTER_VIEW_VECTOR_SCALING_C0116
     6656    iNeibRefViewId = pcTmpCU->getSlice()->getRefPic(eRefPicList2nd, pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx))->getViewOrderIdx(); // will be changed to view_id
     6657#endif
    66546658    TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList2nd)->getMv(uiIdx);
    66556659    TComMv rcMv;
     
    66646668    }
    66656669#endif
     6670#if INTER_VIEW_VECTOR_SCALING_C0116
     6671    Int iScale = 4096;
     6672    if((iCurrRefPOC != iNeibRefPOC))    // inter & inter
     6673        iScale = xGetDistScaleFactor( iCurrPOC, iCurrRefPOC, iNeibPOC, iNeibRefPOC );
     6674    else if(m_pcSlice->getIVScalingFlag())    // inter-view & inter-view
     6675        iScale = xGetDistScaleFactor( iCurrViewId, iCurrRefViewId, iNeibViewId, iNeibRefViewId );
     6676#else
    66666677    Int iScale = xGetDistScaleFactor( iCurrPOC, iCurrRefPOC, iNeibPOC, iNeibRefPOC );
     6678#endif
    66676679    if ( iScale == 4096 )
    66686680    {
     
    66736685      rcMv = cMvPred.scaleMv( iScale );
    66746686    }
    6675 #if LGE_DVMCP_A0126
     6687#if H3D_NBDV
    66766688    rcMv.m_bDvMcp = false;
    66776689#endif
     
    66866698}
    66876699
    6688 #if QC_MULTI_DIS_CAN_A0097
     6700#if H3D_NBDV
    66896701Bool TComDataCU::xGetColDisMV( RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv , Int & iTargetViewIdx, Int & iStartViewIdx )
    66906702{
    6691 #if LGE_DVMCP_A0126 && !QC_SIMPLE_NBDV_B0047
    6692   Int  iDvMcpDispX[2] = {-1,};
    6693   Bool bDvMcpFlag [2] = { false, };
    6694   Int iCurrViewIdx = m_pcSlice->getViewId();
    6695 #endif
    6696 
    66976703  UInt uiAbsPartAddr = uiPartUnitIdx;
    66986704
     
    67026708  TComDataCU *pColCU = pColPic->getCU( uiCUAddr );
    67036709  iColViewIdx = pColCU->getSlice()->getViewId();
    6704 
     6710#if MERL_VSP_C0152
     6711  //TComDataCU *pColCU = pColPic->getCU( uiCUAddr );
     6712  if( pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr) < 0)
     6713  {
     6714    return false;
     6715  }
     6716#endif
    67056717
    67066718  if (pColCU->getPic()==0||pColCU->getPartitionSize(uiPartUnitIdx)==SIZE_NONE||pColCU->isIntra(uiAbsPartAddr))
     
    67086720    return false;
    67096721  }
    6710 #if LGE_DVMCP_A0126 && !QC_SIMPLE_NBDV_B0047
    6711   Bool bColIsSkipped = pColCU->isSkipped( uiAbsPartAddr );
    6712 #endif
    67136722  for (Int ilist = 0; ilist < (pColCU->getSlice()->isInterB()? 2:1); ilist++)
    67146723  {
    67156724    if(pColCU->getSlice()->isInterB())
    67166725    {
     6726#if !QC_NBDV_LDB_FIX_C0055
    67176727      if(ilist == 0 )
    67186728        eColRefPicList = getSlice()->getCheckLDC() ? eRefPicList : RefPicList(1-getSlice()->getColDir());
    67196729      else
    67206730        eColRefPicList = getSlice()->getCheckLDC() ? (eRefPicList== REF_PIC_LIST_0? REF_PIC_LIST_1:REF_PIC_LIST_0 ): RefPicList(getSlice()->getColDir());
     6731#else
     6732        eColRefPicList = RefPicList(ilist);
     6733#endif
    67216734    }
    67226735
     
    67326745    if ( iColViewIdx    == iColRefViewIdx ) // temporal vector
    67336746    {
    6734 #if LGE_DVMCP_A0126 && !QC_SIMPLE_NBDV_B0047
    6735       if( iColViewIdx >0 )
    6736       {
    6737         TComMv tmpMv = pColCU->getCUMvField(eColRefPicList)->getMv(uiAbsPartAddr);
    6738         if( tmpMv.m_bDvMcp && bColIsSkipped ) // DV-MCP SKIP
    6739         {
    6740           iDvMcpDispX[ilist] = tmpMv.m_iDvMcpDispX;
    6741           bDvMcpFlag [ilist] = true;
    6742           iTargetViewIdx  = 0; //iColRefViewIdx ;
    6743           iStartViewIdx   = 0; //iCurrViewIdx; //iColViewIdx   ;
    6744         }
    6745       }
    6746 #endif
    67476747      continue;
    67486748    }
     
    67506750    {
    67516751      rcMv = pColCU->getCUMvField(eColRefPicList)->getMv(uiAbsPartAddr);
    6752 #if LGE_DVMCP_A0126
    67536752      rcMv.m_bDvMcp = false;
    6754 #endif
    67556753      iTargetViewIdx  = iColRefViewIdx ;
    67566754      iStartViewIdx   = iColViewIdx   ;
     
    67586756    }
    67596757  }
    6760 
    6761 #if LGE_DVMCP_A0126 && !QC_SIMPLE_NBDV_B0047
    6762   for( Int ilist=0 ; ilist<2 ; ilist++ )
    6763   {
    6764     if( bDvMcpFlag[ilist] )
    6765     {
    6766       rcMv.setHor( iDvMcpDispX[ilist] );
    6767       rcMv.setVer( 0 );
    6768       rcMv.m_bDvMcp = true;
    6769       iTargetViewIdx  = 0; //iColRefViewIdx ;
    6770       iStartViewIdx   = iCurrViewIdx; //iColViewIdx   ;
    6771       return true;
    6772     }
    6773   }
    6774 #endif
    67756758
    67766759  return false;
     
    67846767 * \returns Bool
    67856768 */
    6786 Bool TComDataCU::xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx )
     6769Bool TComDataCU::xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx
     6770#if QC_TMVP_MRG_REFIDX_C0047
     6771  ,
     6772  Bool bMRG
     6773#endif
     6774)
    67876775{
    67886776  UInt uiAbsPartAddr = uiPartUnitIdx;
     
    67906778  RefPicList  eColRefPicList;
    67916779  Int iColPOC, iColRefPOC, iCurrPOC, iCurrRefPOC, iScale;
    6792 #if SONY_COLPIC_AVAILABILITY
    6793 #if QC_IV_AS_LT_B0046
    6794   Int iColViewOrderIdx, iCurrViewOrderIdx, iCurrRefViewOrderIdx;
    6795 #else
    6796   Int iColViewOrderIdx, iColRefViewOrderIdx, iCurrViewOrderIdx, iCurrRefViewOrderIdx;
    6797 #endif
    6798 #endif
    67996780  TComMv cColMv;
    6800 
    6801 #if SONY_COLPIC_AVAILABILITY
    6802   iCurrViewOrderIdx    = m_pcSlice->getViewOrderIdx();
    6803   iCurrRefViewOrderIdx = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewOrderIdx();
    6804 #endif
     6781#if INTER_VIEW_VECTOR_SCALING_C0115
     6782  Int iColViewId, iColRefViewId, iCurrViewId, iCurrRefViewId;
     6783#endif
     6784
    68056785  // use coldir.
    68066786#if COLLOCATED_REF_IDX
     
    68176797  iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC();
    68186798  iColPOC = pColCU->getSlice()->getPOC(); 
    6819 #if SONY_COLPIC_AVAILABILITY
    6820   iColViewOrderIdx = pColCU->getSlice()->getViewOrderIdx();
     6799#if INTER_VIEW_VECTOR_SCALING_C0115
     6800  iCurrViewId = m_pcSlice->getViewOrderIdx(); // will be changed to view_id   
     6801  iCurrRefViewId = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewOrderIdx(); // will be changed to view_id
     6802  iColViewId = pColCU->getSlice()->getViewOrderIdx(); // will be changed to view_id
    68216803#endif
    68226804
     
    68266808  }
    68276809
    6828 #if !SONY_COLPIC_AVAILABILITY&!QC_IV_AS_LT_B0046
     6810#if !INTER_VIEW_VECTOR_SCALING_C0115&!QC_IV_AS_LT_B0046
    68296811  if( m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewId() != m_pcSlice->getViewId() )
    68306812    return false;
     
    68536835  // Scale the vector.
    68546836  iColRefPOC = pColCU->getSlice()->getRefPOC(eColRefPicList, iColRefIdx);
    6855 
     6837#if INTER_VIEW_VECTOR_SCALING_C0115
     6838  iColRefViewId = pColCU->getSlice()->getRefPic( eColRefPicList, pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr))->getViewOrderIdx(); // will be changed to view_id
     6839#endif
    68566840#if !QC_IV_AS_LT_B0046
    6857 #if SONY_COLPIC_AVAILABILITY
    6858   iColRefViewOrderIdx = pColCU->getSlice()->getRefPic( eColRefPicList, pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr))->getViewOrderIdx();
    6859 #else
    68606841  if( pColCU->getSlice()->getRefViewId( eColRefPicList, iColRefIdx ) != pColCU->getSlice()->getViewId() )
    68616842  {
    68626843    return false;
    68636844  }
    6864 #endif
    68656845#else
    68666846  Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getIsLongTerm();
     
    68686848  if(bIsCurrRefLongTerm != bIsColRefLongTerm)
    68696849  {
     6850#if QC_TMVP_MRG_REFIDX_C0047
     6851    cColMv = pColCU->getCUMvField(eColRefPicList)->getMv(uiAbsPartAddr);
     6852    iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC();
     6853    if(bMRG )
     6854    {
     6855      Int iUpdRefIdx  = m_pcSlice->getNewRefIdx(eRefPicList);
     6856      if(iUpdRefIdx > 0 )
     6857      {
     6858        riRefIdx = iUpdRefIdx;
     6859        bIsCurrRefLongTerm = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getIsLongTerm();
     6860        iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC();
     6861#if INTER_VIEW_VECTOR_SCALING_C0115
     6862        iCurrRefViewId = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewOrderIdx(); // will be changed to view_id
     6863#endif
     6864      }
     6865      else
     6866        return false;
     6867    }else
     6868    {
     6869#endif
    68706870    assert( ((iColPOC == iColRefPOC)&&(iCurrPOC != iCurrRefPOC))||((iColPOC != iColRefPOC)&&(iCurrPOC == iCurrRefPOC)));
    68716871    return false;
     6872#if QC_TMVP_MRG_REFIDX_C0047
     6873    }
     6874#endif
    68726875  }
    68736876#endif
     
    68906893      }
    68916894    }else
    6892 #if QC_MVHEVC_B0046
    6893       rcMv = cColMv; //inter-view
     6895#if INTER_VIEW_VECTOR_SCALING_C0115
     6896    {
     6897        if((iCurrPOC == iCurrRefPOC) && m_pcSlice->getIVScalingFlag())    // inter-view & inter-view
     6898            iScale = xGetDistScaleFactor( iCurrViewId, iCurrRefViewId, iColViewId, iColRefViewId );
     6899        else
     6900            iScale = 4096;            // inter & inter
     6901      if ( iScale == 4096 )
     6902      {
     6903        rcMv = cColMv;
     6904      }
     6905      else
     6906      {
     6907        rcMv = cColMv.scaleMv( iScale );
     6908      }
     6909  }
    68946910#else
    6895     {
    6896 #if SONY_COLPIC_AVAILABILITY
    6897       Int iColRefViewOrderIdx = pColCU->getSlice()->getRefPic( eColRefPicList, pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr))->getViewOrderIdx();
    6898       iScale = xGetDistScaleFactor(iCurrViewOrderIdx, iCurrRefViewOrderIdx, iColViewOrderIdx, iColRefViewOrderIdx);
    6899       if ( iScale == 4096 )
    6900       {
    6901         rcMv = cColMv;
    6902       }
    6903       else
    6904       {
    6905         rcMv = cColMv.scaleMv( iScale );
    6906       }
    6907 #else
    6908       return false;
    6909 #endif
    6910     }
    6911 #endif
    6912   }
    6913 #else
    6914 #if SONY_COLPIC_AVAILABILITY
    6915   iScale = 0;
    6916   iCurrRefViewOrderIdx = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewOrderIdx();
    6917   if((iColPOC != iColRefPOC)&&(iCurrPOC != iCurrRefPOC))
    6918     iScale = xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iColPOC, iColRefPOC);
    6919   else if((iColPOC == iColRefPOC)&&(iCurrPOC == iCurrRefPOC))
    6920     iScale = xGetDistScaleFactor(iCurrViewOrderIdx, iCurrRefViewOrderIdx, iColViewOrderIdx, iColRefViewOrderIdx);
    6921   else
    6922     return false;
    6923 
    6924 #else
    6925   iScale = xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iColPOC, iColRefPOC);
    6926 #endif
    6927   if ( iScale == 4096 )
    6928   {
    6929     rcMv = cColMv;
    6930   }
    6931   else
    6932   {
    6933     rcMv = cColMv.scaleMv( iScale );
    6934   }
    6935 #endif
     6911    rcMv = cColMv; //inter-view
     6912#endif
     6913  }
     6914#endif
     6915
    69366916  return true;
    69376917}
     
    70267006    return false;
    70277007  }
    7028  
     7008
    70297009  if( m_pcSlice->getRefPic( eRefPicList, iRefIdx )->getViewId() != m_pcSlice->getViewId() )
    70307010  {
     
    70717051    }
    70727052  }
     7053
     7054#if MERL_VSP_C0152 // Preventive
     7055  if (pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiPartIdxCenter) < 0) // NOT_VALID
     7056    return false;
     7057#endif
    70737058 
    70747059  // Scale the vector.
     
    71077092UInt TComDataCU::getCoefScanIdx(UInt uiAbsPartIdx, UInt uiWidth, Bool bIsLuma, Bool bIsIntra)
    71087093{
    7109 #if !LOGI_INTRA_NAME_3MPM 
    7110   static const UChar aucIntraDirToScanIdx[MAX_CU_DEPTH][NUM_INTRA_MODE] =
    7111   {
    7112     {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    7113     },
    7114     {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    7115     },
    7116     {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    7117     },
    7118     {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    7119     },
    7120     {0, 1, 2, 0, 0, 1, 1, 0, 2, 2, 0, 0, 1, 1, 0, 0, 2, 2, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0
    7121     },
    7122     {0, 1, 2, 0, 0, 1, 1, 0, 2, 2, 0, 0, 1, 1, 0, 0, 2, 2, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0
    7123     },
    7124     {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    7125     },
    7126   };
    7127 #endif
    71287094 
    71297095  UInt uiCTXIdx;
     
    71557121#endif
    71567122
    7157 #if LOGI_INTRA_NAME_3MPM
    71587123    uiScanIdx = SCAN_ZIGZAG;
    71597124    if (uiCTXIdx >3 && uiCTXIdx < 6) //if multiple scans supported for PU size
     
    71617126      uiScanIdx = abs((Int) uiDirMode - VER_IDX) < 5 ? 1 : (abs((Int)uiDirMode - HOR_IDX) < 5 ? 2 : 0);
    71627127    }
    7163 #else
    7164     uiScanIdx = aucIntraDirToScanIdx[uiCTXIdx][uiDirMode];
    7165 #endif
    71667128  }
    71677129  else
     
    71807142#endif
    71817143    }
    7182 #if LOGI_INTRA_NAME_3MPM
    71837144    uiScanIdx = SCAN_ZIGZAG;
    71847145    if (uiCTXIdx >4 && uiCTXIdx < 7) //if multiple scans supported for PU size
     
    71867147      uiScanIdx = abs((Int) uiDirMode - VER_IDX) < 5 ? 1 : (abs((Int)uiDirMode - HOR_IDX) < 5 ? 2 : 0);
    71877148    }
    7188 #else
    7189     uiScanIdx = aucIntraDirToScanIdx[max<Int>(uiCTXIdx-1,0)][uiDirMode];
    7190 #endif
    71917149  }
    71927150
     
    76807638      }
    76817639    }
    7682 #if LCU_SYNTAX_ALF
    76837640    rSGU.allBordersAvailable = true;
    76847641    for(Int b=0; b< NUM_SGU_BORDER; b++)
     
    76907647      }
    76917648    }
    7692 #endif
    76937649
    76947650  }
     
    77867742}
    77877743
     7744#if LGE_DMM3_SIMP_C0044
     7745Void TComDataCU::setWedgePredTexIntraTabIdxSubParts( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth )
     7746{
     7747  UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1);
     7748
     7749  for ( UInt ui = 0; ui < uiCurrPartNumb; ui++ )
     7750  {
     7751    m_puiWedgePredTexIntraTabIdx[uiAbsPartIdx+ui] = uiTIdx;
     7752  }
     7753}
     7754#endif
     7755
    77887756Void TComDataCU::setWedgePredTexDeltaDC1SubParts( Int iDC1, UInt uiAbsPartIdx, UInt uiDepth )
    77897757{
     
    78457813  memcpy( m_pePredMode + uiAbsPartIdxDst,  pcCU->getPredictionMode() + uiAbsPartIdxSrc, sizeof( m_pePredMode[0] ) * uiNumPartition );
    78467814  memcpy( m_puhInterDir + uiAbsPartIdxDst, pcCU->getInterDir() + uiAbsPartIdxSrc,       sizeof( m_puhInterDir[0] ) * uiNumPartition );
     7815
     7816#if MERL_VSP_C0152 && MTK_UNCONSTRAINED_MVI_B0083
     7817  memcpy( m_piVSPIndex + uiAbsPartIdxDst,  pcCU->getVSPIndex() + uiAbsPartIdxSrc, sizeof( m_piVSPIndex[0] ) * uiNumPartition );
     7818#endif
    78477819
    78487820#if !MTK_UNCONSTRAINED_MVI_B0083
     
    78807852// public functions for Multi-view tools
    78817853// -------------------------------------------------------------------------------------------------------------------
    7882 #if HHI_INTER_VIEW_MOTION_PRED
    7883 #if !QC_MULTI_DIS_CAN_A0097
     7854#if H3D_IVMP
     7855#if !H3D_NBDV
    78847856Int
    78857857TComDataCU::getPdmMergeCandidate( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv )
     
    78987870  return pcDepthMapGenerator->getPdmMvPred( this, uiPartIdx, eRefPicList, iRefIdx, rcMv, bMerge );
    78997871}
     7872#else //H3D_NBDV
     7873#if QC_AMVP_MRG_UNIFY_IVCAN_C0051
     7874Bool
     7875TComDataCU::getUnifiedMvPredCan(UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm, Bool bMerge )
     7876{
     7877  TComDepthMapGenerator* pcDepthMapGenerator = m_pcSlice->getSPS()->getDepthMapGenerator();
     7878  ROFRS( pcDepthMapGenerator, false );
     7879  if (pDInfo->iN > 0 && pcDepthMapGenerator->getPdmCandidate(this, uiPartIdx, eRefPicList, iRefIdx, paiPdmRefIdx, pacPdmMv, pDInfo, iPdm, bMerge))
     7880    return true;
     7881  return false;
     7882}
    79007883#else
    79017884Int
    7902 TComDataCU::getPdmMergeCandidateDisCan( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo
    7903 #if QC_MRG_CANS_B0048
    7904   , Int* iPdm
    7905 #endif
    7906 )
     7885TComDataCU::getPdmMergeCandidateDisCan( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm )
    79077886{
    79087887  TComDepthMapGenerator* pcDepthMapGenerator = m_pcSlice->getSPS()->getDepthMapGenerator();
    79097888  ROFRS( pcDepthMapGenerator, 0 );
    7910   return pcDepthMapGenerator->getPdmMergeCandidate( this, uiPartIdx, paiPdmRefIdx, pacPdmMv, pDInfo
    7911 #if QC_MRG_CANS_B0048
    7912     , iPdm
    7913 #endif
    7914     );
     7889  return pcDepthMapGenerator->getPdmMergeCandidate( this, uiPartIdx, paiPdmRefIdx, pacPdmMv, pDInfo, iPdm );
    79157890}
    79167891Bool
     
    79247899}
    79257900#endif
    7926 
     7901#endif //H3D_NBDV
    79277902
    79287903Bool     
     
    79357910#endif
    79367911
    7937 #if HHI_INTER_VIEW_RESIDUAL_PRED
     7912#if H3D_IVRP
    79387913Bool
    7939 TComDataCU::getResidualSamples( UInt uiPartIdx,
    7940 #if QC_SIMPLIFIEDIVRP_M24938
    7941   Bool bRecon ,
    7942 #endif
    7943   TComYuv* pcYuv )
     7914TComDataCU::getResidualSamples( UInt uiPartIdx, Bool bRecon, TComYuv* pcYuv )
    79447915{
    79457916  TComResidualGenerator*  pcResidualGenerator = m_pcSlice->getSPS()->getResidualGenerator();
    79467917  ROFRS( pcResidualGenerator, false );
    7947 #if QC_MULTI_DIS_CAN_A0097
     7918#if H3D_NBDV
    79487919  DisInfo cDisInfo;
    79497920  cDisInfo.iN = 0;
    79507921  PartSize m_peSaved =  getPartitionSize( 0 );
    79517922  m_pePartSize[0] =  SIZE_2Nx2N;
    7952 #if LGE_DVMCP_A0126
    7953 #if QC_SIMPLE_NBDV_B0047
    7954 #if FIX_LGE_IVMP_PARALLEL_MERGE_B0136
    7955   getDisMvpCand2( 0, 0,  &cDisInfo, false);
    7956 #else
    7957   getDisMvpCand2( 0, 0,  &cDisInfo);
    7958 #endif
    7959 #else
    7960   getDisMvpCand2( 0, 0,  &cDisInfo, true );
    7961 #endif
    7962 #else
    7963   getDisMvpCand        ( 0, 0,  &cDisInfo );
    7964 #endif
     7923  getDisMvpCandNBDV( 0, 0,  &cDisInfo, false );
    79657924  if( cDisInfo.iN == 0)
    79667925  {
     
    79707929  else
    79717930  {
    7972     Bool bAvailable = pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, cDisInfo.m_acMvCand[0].getHor()
    7973 #if QC_SIMPLIFIEDIVRP_M24938
    7974       , bRecon
    7975 #endif
    7976       );
     7931#if MTK_RELEASE_DV_CONSTRAINT_C0129
     7932    Bool bAvailable = pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, cDisInfo.m_acMvCand[0], bRecon );       
     7933#else
     7934    Bool bAvailable = pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, cDisInfo.m_acMvCand[0].getHor(), bRecon );
     7935#endif
    79777936    m_pePartSize[0] = m_peSaved;
    79787937    return bAvailable;
    79797938  }
    79807939#else
    7981   return pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv
    7982 #if QC_SIMPLIFIEDIVRP_M24938
    7983     , bRecon
    7984 #endif
    7985     );
     7940  return pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, bRecon );
    79867941#endif
    79877942}
Note: See TracChangeset for help on using the changeset viewer.