Changeset 1233 in 3DVCSoftware


Ignore:
Timestamp:
26 May 2015, 07:13:47 (10 years ago)
Author:
etri-htm
Message:

Reactive_MLC (the MACRO is "NH_3D_MLC")

Location:
branches/HTM-14.1-update-dev3-ETRI
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-14.1-update-dev3-ETRI/source/Lib/TLibCommon/CommonDef.h

    r1200 r1233  
    363363#endif
    364364
    365 #if H_3D_IV_MERGE
     365#if NH_3D_MLC
    366366#define MRG_MAX_NUM_CANDS_MEM       (MRG_MAX_NUM_CANDS+1) // one extra for inter-view motion prediction
    367367#endif
  • branches/HTM-14.1-update-dev3-ETRI/source/Lib/TLibCommon/TComDataCU.cpp

    r1217 r1233  
    31933193
    31943194#endif
    3195 #if H_3D
     3195#if NH_3D_MLC
     3196/** Construct a extended list of merging candidates
     3197 * \param pcMvFieldNeighbours
     3198 * \param puhInterDirNeighbours
     3199 * \param vspFlag
     3200 * \param pbSPIVMPFlag
     3201 * \param numValidMergeCand
     3202 */
    31963203Void TComDataCU::buildMCL(TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours
    31973204#if H_3D_VSP
     
    32043211  )
    32053212{
    3206   if (!( getSlice()->getIsDepth() || getSlice()->getViewIndex()>0))  // for only dependent texture
     3213  if (!( getSlice()->getIsDepth() || getSlice()->getViewIndex()>0))
    32073214  {
    32083215    return;
     
    32203227    extMergeCandList[ui<<1].setMvField(cZeroMv, NOT_VALID);
    32213228    extMergeCandList[(ui<<1)+1].setMvField(cZeroMv, NOT_VALID);
     3229#if H_3D_VSP
    32223230    vspFlag[ui] = 0;
    3223   }
    3224 
    3225   // add candidates to temporal list
    3226   // insert MPI ... IvShift candidate
     3231#endif
     3232  }
     3233
     3234  // insert MPI ... IvShift candidate to extMergeCandList
    32273235  for (Int i=0; i<=MRG_IVSHIFT; i++)
    32283236  {
    32293237    if (m_mergCands[i].m_bAvailable)
    32303238    {
    3231       m_mergCands[i].getCand(iCount, extMergeCandList, uhInterDirNeighboursExt, vspFlag, pbSPIVMPFlag);
     3239      m_mergCands[i].getCand(iCount, extMergeCandList, uhInterDirNeighboursExt
     3240#if H_3D_VSP
     3241        , vspFlag
     3242#endif
     3243#if H_3D_SPIVMP
     3244        , pbSPIVMPFlag
     3245#endif
     3246        );
    32323247      iCount++;
    32333248      if (iCount >= getSlice()->getMaxNumMergeCand())
     
    32363251  }
    32373252
    3238   // insert remaining base candidates
    3239   while (iCount < getSlice()->getMaxNumMergeCand() && m_baseListidc < getSlice()->getMaxNumMergeCand())
    3240   {
    3241     uhInterDirNeighboursExt[iCount] = puhInterDirNeighbours[m_baseListidc];
    3242     extMergeCandList[iCount<<1].setMvField(pcMvFieldNeighbours[m_baseListidc<<1].getMv(), pcMvFieldNeighbours[m_baseListidc<<1].getRefIdx());
     3253  Int iCountBase = m_numSpatialCands;
     3254  // insert remaining base candidates to extMergeCandList
     3255  while (iCount < getSlice()->getMaxNumMergeCand() && iCountBase < getSlice()->getMaxNumMergeCand())
     3256  {
     3257    uhInterDirNeighboursExt[iCount] = puhInterDirNeighbours[iCountBase];
     3258    extMergeCandList[iCount<<1].setMvField(pcMvFieldNeighbours[iCountBase<<1].getMv(), pcMvFieldNeighbours[iCountBase<<1].getRefIdx());
    32433259    if ( getSlice()->isInterB() )
    32443260    {
    3245       extMergeCandList[(iCount<<1)+1].setMvField(pcMvFieldNeighbours[(m_baseListidc<<1)+1].getMv(), pcMvFieldNeighbours[(m_baseListidc<<1)+1].getRefIdx());
    3246     }
    3247     m_baseListidc++;
     3261      extMergeCandList[(iCount<<1)+1].setMvField(pcMvFieldNeighbours[(iCountBase<<1)+1].getMv(), pcMvFieldNeighbours[(iCountBase<<1)+1].getRefIdx());
     3262    }
     3263    iCountBase++;
    32483264    iCount++;
    32493265  }
     
    32673283}
    32683284
    3269 /** Constructs a list of merging candidates
     3285
     3286
     3287/** Derive 3D merge candidates
    32703288 * \param uiAbsPartIdx
    32713289 * \param uiPUIdx
    3272  * \param uiDepth
    32733290 * \param pcMvFieldNeighbours
     3291 * \param puhInterDirNeighbours
     3292 * \param pcMvFieldSP
    32743293 * \param puhInterDirNeighbours
    32753294 * \param numValidMergeCand
    32763295 */
    3277 // HM 12.0 based merge candidate list construction
    3278 
    3279 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx )
    3280 {
    3281 
    3282   UInt uiAbsPartAddr = m_uiAbsIdxInLCU + uiAbsPartIdx;
    3283   Bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ];
     3296Void TComDataCU::xGetInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours
     3297#if H_3D_SPIVMP
     3298      , TComMvField* pcMvFieldSP, UChar* puhInterDirSP
     3299#endif
     3300      , Int& numValidMergeCand, Int mrgCandIdx
     3301)
     3302{
     3303#if H_3D_IV_MERGE
    32843304  TComMv cZeroMv;
    3285   for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ++ui )
    3286   {
    3287     abCandIsInter[ui] = false;
    3288     pcMvFieldNeighbours[ ( ui << 1 )     ].setMvField(cZeroMv, NOT_VALID);
    3289     pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setMvField(cZeroMv, NOT_VALID);
     3305#endif
     3306  TComMvField tmpMV[2];
     3307  UChar tmpDir;
     3308
     3309  //////////////////////////////////
     3310  //////// GET DISPARITIES  ////////
     3311  //////////////////////////////////
     3312#if H_3D_IV_MERGE
     3313  DisInfo cDisInfo = getDvInfo(uiAbsPartIdx);
     3314  m_cDefaultDisInfo = cDisInfo;
     3315#endif
     3316
     3317  if (!( getSlice()->getIsDepth() || getSlice()->getViewIndex()>0))
     3318  {
     3319    return;
    32903320  }
    32913321  numValidMergeCand = getSlice()->getMaxNumMergeCand();
     3322  //////////////////////////////////
     3323  //////// DERIVE LOCATIONS ////////
     3324  //////////////////////////////////
    32923325  // compute the location of the current PU
    32933326  Int xP, yP, nPSW, nPSH;
     
    32953328
    32963329  Int iCount = 0;
    3297 
    32983330  UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB;
    3299   PartSize cCurPS = getPartitionSize( uiAbsPartIdx );
    3300   deriveLeftRightTopIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT );
    3301   deriveLeftBottomIdxGeneral  ( uiAbsPartIdx, uiPUIdx, uiPartIdxLB );
    3302 
    3303   //left
    3304   UInt uiLeftPartIdx = 0;
    3305   TComDataCU* pcCULeft = 0;
    3306   pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB );
    3307   Bool isAvailableA1 = pcCULeft &&
    3308     pcCULeft->isDiffMER(xP -1, yP+nPSH-1, xP, yP) &&
    3309     !( uiPUIdx == 1 && (cCurPS == SIZE_Nx2N || cCurPS == SIZE_nLx2N || cCurPS == SIZE_nRx2N) ) &&
    3310     !pcCULeft->isIntra( uiLeftPartIdx ) ;
    3311   if ( isAvailableA1 )
    3312   {
    3313     m_bAvailableFlagA1 = 1;
    3314     abCandIsInter[iCount] = true;
    3315     // get Inter Dir
    3316     puhInterDirNeighbours[iCount] = pcCULeft->getInterDir( uiLeftPartIdx );
    3317     // get Mv from Left
    3318     pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    3319     if ( getSlice()->isInterB() )
    3320     {
    3321       pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    3322     }
    3323 
    3324     iCount ++;
    3325   }
    3326  
    3327   // early termination
    3328   if (iCount == getSlice()->getMaxNumMergeCand())
    3329   {
    3330     return;
    3331   }
    3332   // above
    3333   UInt uiAbovePartIdx = 0;
    3334   TComDataCU* pcCUAbove = 0;
    3335   pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT );
    3336   Bool isAvailableB1 = pcCUAbove &&
    3337   pcCUAbove->isDiffMER(xP+nPSW-1, yP-1, xP, yP) &&
    3338   !( uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD) ) &&
    3339   !pcCUAbove->isIntra( uiAbovePartIdx );
    3340   if ( isAvailableB1 && (!isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAbove, uiAbovePartIdx ) ) )
    3341   {
    3342     m_bAvailableFlagB1 = 1;
    3343     abCandIsInter[iCount] = true;
    3344     // get Inter Dir
    3345     puhInterDirNeighbours[iCount] = pcCUAbove->getInterDir( uiAbovePartIdx );
    3346     // get Mv from Left
    3347     pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    3348     if ( getSlice()->isInterB() )
    3349     {
    3350       pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    3351     }
    3352     if ( mrgCandIdx == iCount )
    3353     {
    3354       return;
    3355     }
    3356     iCount ++;
    3357   }
    3358   // early termination
    3359   if (iCount == getSlice()->getMaxNumMergeCand())
    3360   {
    3361     return;
    3362   }
    3363 
    3364   // above right
    3365   UInt uiAboveRightPartIdx = 0;
    3366   TComDataCU* pcCUAboveRight = 0;
    3367   pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT );
    3368   Bool isAvailableB0 = pcCUAboveRight &&
    3369   pcCUAboveRight->isDiffMER(xP+nPSW, yP-1, xP, yP) &&
    3370   !pcCUAboveRight->isIntra( uiAboveRightPartIdx );
    3371   if ( isAvailableB0 && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) )
    3372   {
    3373     m_bAvailableFlagB0 = 1;
    3374     abCandIsInter[iCount] = true;
    3375     // get Inter Dir
    3376     puhInterDirNeighbours[iCount] = pcCUAboveRight->getInterDir( uiAboveRightPartIdx );
    3377     // get Mv from Left
    3378     pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    3379     if ( getSlice()->isInterB() )
    3380     {
    3381       pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    3382     }
    3383     if ( mrgCandIdx == iCount )
    3384     {
    3385       return;
    3386     }
    3387     iCount ++;
    3388   }
    3389   // early termination
    3390   if (iCount == getSlice()->getMaxNumMergeCand())
    3391   {
    3392     return;
    3393   }
    3394 
    3395   //left bottom
    3396   UInt uiLeftBottomPartIdx = 0;
    3397   TComDataCU* pcCULeftBottom = 0;
    3398   pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB );
    3399   Bool isAvailableA0 = pcCULeftBottom &&
    3400   pcCULeftBottom->isDiffMER(xP-1, yP+nPSH, xP, yP) &&
    3401   !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) ;
    3402   if ( isAvailableA0 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) )
    3403   {
    3404     m_bAvailableFlagA0 = 1;
    3405     abCandIsInter[iCount] = true;
    3406     // get Inter Dir
    3407     puhInterDirNeighbours[iCount] = pcCULeftBottom->getInterDir( uiLeftBottomPartIdx );
    3408     // get Mv from Left
    3409     pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    3410     if ( getSlice()->isInterB() )
    3411     {
    3412       pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    3413     }
    3414     if ( mrgCandIdx == iCount )
    3415     {
    3416       return;
    3417     }
    3418     iCount ++;
    3419   }
    3420   // early termination
    3421   if (iCount == getSlice()->getMaxNumMergeCand())
    3422   {
    3423     return;
    3424   }
    3425   // above left
    3426   if( iCount < 4 )
    3427   {
    3428     UInt uiAboveLeftPartIdx = 0;
    3429     TComDataCU* pcCUAboveLeft = 0;
    3430     pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr );
    3431     Bool isAvailableB2 = pcCUAboveLeft &&
    3432     pcCUAboveLeft->isDiffMER(xP-1, yP-1, xP, yP) &&
    3433     !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx );
    3434     if ( isAvailableB2 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) )
    3435         && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) )
    3436     {
    3437       m_bAvailableFlagB2 = 1;
    3438       abCandIsInter[iCount] = true;
    3439       // get Inter Dir
    3440       puhInterDirNeighbours[iCount] = pcCUAboveLeft->getInterDir( uiAboveLeftPartIdx );
    3441       // get Mv from Left
    3442       pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    3443       if ( getSlice()->isInterB() )
    3444       {
    3445         pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    3446       }
    3447       if ( mrgCandIdx == iCount )
    3448       {
    3449         return;
    3450       }
    3451       iCount ++;
    3452     }
    3453   }
    3454   // early termination
    3455   if (iCount == getSlice()->getMaxNumMergeCand())
    3456   {
    3457     return;
    3458   }
    3459   if ( getSlice()->getEnableTMVPFlag())
    3460   {
    3461     //>> MTK colocated-RightBottom
    3462     UInt uiPartIdxRB;
    3463 
    3464     deriveRightBottomIdx( uiPUIdx, uiPartIdxRB ); 
    3465 
    3466     UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];
    3467     UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();
    3468 
    3469     TComMv cColMv;
    3470     Int iRefIdx;
    3471     Int uiLCUIdx = -1;
    3472 
    3473     if      ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )  // image boundary check
    3474     {
    3475     }
    3476     else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
    3477     {
    3478     }
    3479     else
    3480     {
    3481       if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) &&           // is not at the last column of LCU
    3482         ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row    of LCU
    3483       {
    3484         uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ];
    3485         uiLCUIdx = getAddr();
    3486       }
    3487       else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 )           // is not at the last column of LCU But is last row of LCU
    3488       {
    3489         uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ];
    3490       }
    3491       else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
    3492       {
    3493         uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ];
    3494         uiLCUIdx = getAddr() + 1;
    3495       }
    3496       else //is the right bottom corner of LCU                       
    3497       {
    3498         uiAbsPartAddr = 0;
    3499       }
    3500     }
    3501 
    3502     iRefIdx = 0;
    3503     Bool bExistMV = false;
    3504     UInt uiPartIdxCenter;
    3505     UInt uiCurLCUIdx = getAddr();
    3506     Int dir = 0;
    3507     UInt uiArrayAddr = iCount;
    3508     xDeriveCenterIdx( uiPUIdx, uiPartIdxCenter );
    3509     bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_0, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx );
    3510     if( bExistMV == false )
    3511     {
    3512       bExistMV = xGetColMVP( REF_PIC_LIST_0, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx );
    3513     }
    3514     if( bExistMV )
    3515     {
    3516       dir |= 1;
    3517       pcMvFieldNeighbours[ 2 * uiArrayAddr ].setMvField( cColMv, iRefIdx );
    3518     }
    3519 
    3520     if ( getSlice()->isInterB() )
    3521     {
    3522 #if H_3D_TMVP
    3523       iRefIdx = 0;
    3524 #endif
    3525       bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_1, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx);
    3526       if( bExistMV == false )
    3527       {
    3528         bExistMV = xGetColMVP( REF_PIC_LIST_1, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx );
    3529       }
    3530       if( bExistMV )
    3531       {
    3532         dir |= 2;
    3533         pcMvFieldNeighbours[ 2 * uiArrayAddr + 1 ].setMvField( cColMv, iRefIdx );
    3534       }
    3535     }
    3536 
    3537     if (dir != 0)
    3538     {
    3539       puhInterDirNeighbours[uiArrayAddr] = dir;
    3540       abCandIsInter[uiArrayAddr] = true;
    3541 #if NH_3D_NBDV
    3542       pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
    3543       pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
    3544 #endif
    3545       if ( mrgCandIdx == iCount )
    3546       {
    3547         return;
    3548       }
    3549       iCount++;
    3550     }
    3551   }
    3552   // early termination
    3553   if (iCount == getSlice()->getMaxNumMergeCand())
    3554   {
    3555     return;
    3556   }
    3557   UInt uiArrayAddr = iCount;
    3558   UInt uiCutoff = uiArrayAddr;
    3559  
    3560   if ( getSlice()->isInterB() && iCount<5)  // JCT3V-F0129 by Qualcomm
    3561   {
    3562     UInt uiPriorityList0[12] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3};
    3563     UInt uiPriorityList1[12] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2};
    3564 
    3565     for (Int idx=0; idx<uiCutoff*(uiCutoff-1) && uiArrayAddr!= getSlice()->getMaxNumMergeCand(); idx++)
    3566     {
    3567       Int i = uiPriorityList0[idx]; Int j = uiPriorityList1[idx];
    3568       if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2))
    3569       {
    3570         abCandIsInter[uiArrayAddr] = true;
    3571         puhInterDirNeighbours[uiArrayAddr] = 3;
    3572 
    3573         // get Mv from cand[i] and cand[j]
    3574         pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(pcMvFieldNeighbours[i<<1].getMv(), pcMvFieldNeighbours[i<<1].getRefIdx());
    3575         pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(pcMvFieldNeighbours[(j<<1)+1].getMv(), pcMvFieldNeighbours[(j<<1)+1].getRefIdx());
    3576 
    3577         Int iRefPOCL0 = m_pcSlice->getRefPOC( REF_PIC_LIST_0, pcMvFieldNeighbours[(uiArrayAddr<<1)].getRefIdx() );
    3578         Int iRefPOCL1 = m_pcSlice->getRefPOC( REF_PIC_LIST_1, pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getRefIdx() );
    3579         if (iRefPOCL0 == iRefPOCL1 && pcMvFieldNeighbours[(uiArrayAddr<<1)].getMv() == pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getMv())
    3580         {
    3581           abCandIsInter[uiArrayAddr] = false;
    3582         }
    3583         else
    3584         {
    3585           uiArrayAddr++;
    3586         }
    3587       }
    3588     }
    3589   }
    3590   // early termination
    3591   if (uiArrayAddr == getSlice()->getMaxNumMergeCand())
    3592   {
    3593     return;
    3594   }
    3595  
    3596   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);
    3597   Int r = 0;
    3598   Int refcnt = 0;
    3599   while (uiArrayAddr < getSlice()->getMaxNumMergeCand())
    3600   {
    3601     abCandIsInter[uiArrayAddr] = true;
    3602     puhInterDirNeighbours[uiArrayAddr] = 1;
    3603     pcMvFieldNeighbours[uiArrayAddr << 1].setMvField( TComMv(0, 0), r);
    3604 
    3605     if ( getSlice()->isInterB() )
    3606     {
    3607       puhInterDirNeighbours[uiArrayAddr] = 3;
    3608       pcMvFieldNeighbours[(uiArrayAddr << 1) + 1].setMvField(TComMv(0, 0), r);
    3609     }
    3610     uiArrayAddr++;
    3611     if ( refcnt == iNumRefIdx - 1 )
    3612     {
    3613       r = 0;
    3614     }
    3615     else
    3616     {
    3617       ++r;
    3618       ++refcnt;
    3619     }
    3620   }
    3621  
    3622   numValidMergeCand = uiArrayAddr;
    3623 }
    3624 
    3625 
    3626 
    3627 /** Constructs a list of merging candidates
    3628  * \param uiAbsPartIdx
    3629  * \param uiPUIdx
    3630  * \param uiDepth
    3631  * \param pcMvFieldNeighbours
    3632  * \param puhInterDirNeighbours
    3633  * \param numValidMergeCand
    3634  */
    3635 #if H_3D
    3636 Void TComDataCU::xGetInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours
    3637 #else
    3638 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours
    3639 #endif
    3640 #if H_3D_SPIVMP
    3641       , TComMvField* pcMvFieldSP, UChar* puhInterDirSP
    3642 #endif
    3643       , Int& numValidMergeCand, Int mrgCandIdx
    3644 )
    3645 {
    3646 #if H_3D_IV_MERGE
    3647   ////////////////////////////
    3648   //////// INIT LISTS ////////
    3649   ////////////////////////////
    3650   TComMv cZeroMv;
    3651 #else
    3652   Bool abCandIsInter[ MRG_MAX_NUM_CANDS ];
    3653 #endif
    3654 #if H_3D
    3655   TComMvField tmpMV[2];
    3656   UChar tmpDir;
    3657 
    3658 
    3659   //////////////////////////////////
    3660   //////// GET DISPARITIES  ////////
    3661   //////////////////////////////////
    3662   DisInfo cDisInfo = getDvInfo(uiAbsPartIdx);
    3663   m_cDefaultDisInfo = cDisInfo;
    3664 
    3665   if (!( getSlice()->getIsDepth() || getSlice()->getViewIndex()>0))  // current slice is not both dependent view or depth
    3666   {
    3667     return;
    3668   }
    3669 #else
    3670   for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ++ui )
    3671   {
    3672     abCandIsInter[ui] = false;
    3673     pcMvFieldNeighbours[ ( ui << 1 )     ].setRefIdx(NOT_VALID);
    3674     pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setRefIdx(NOT_VALID);
    3675   }
    3676 #endif
    3677 
    3678   numValidMergeCand = getSlice()->getMaxNumMergeCand();
    3679 #if H_3D
    3680   //////////////////////////////////
    3681   //////// DERIVE LOCATIONS ////////
    3682   //////////////////////////////////
    3683 #endif
    3684   // compute the location of the current PU
    3685   Int xP, yP, nPSW, nPSH;
    3686   this->getPartPosition(uiPUIdx, xP, yP, nPSW, nPSH);
    3687 
    3688   Int iCount = 0;
    3689 
    3690   UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB;
    3691 #if !H_3D
    3692   PartSize cCurPS = getPartitionSize( uiAbsPartIdx );
    3693 #endif
    36943331  deriveLeftRightTopIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT );
    36953332  deriveLeftBottomIdxGeneral  ( uiAbsPartIdx, uiPUIdx, uiPartIdxLB );
     
    37103347#endif
    37113348
    3712 #if H_3D
    37133349#if NH_3D_NBDV
    37143350  for(Int i = 0; i < MRG_MAX_NUM_CANDS_MEM; i++) 
    37153351  {
    3716     pcMvFieldNeighbours[i<<1    ].getMv().setIDVFlag (false);
    3717     pcMvFieldNeighbours[(i<<1)+1].getMv().setIDVFlag (false);
    3718   }
    3719 #endif
    3720   // Clean version for MCL construction align with WD
    3721   // init mergCands list
     3352    pcMFieldNeighbours[i<<1    ].getMv().setIDVFlag (false);
     3353    pcMFieldNeighbours[(i<<1)+1].getMv().setIDVFlag (false);
     3354  }
     3355#endif
     3356  // init containers
    37223357  for (Int i = 0; i<MRG_IVSHIFT+1; i++)
    3723   {
    37243358    m_mergCands[i].init();
    3725   }
    3726 
    3727   m_baseListidc = 0;
    3728 
     3359
     3360  m_numSpatialCands = 0;
     3361
     3362  //////////////////////////////////
     3363  ///////// GET VSP FLAGS //////////
     3364  //////////////////////////////////
    37293365  //left
    37303366  UInt uiLeftPartIdx = 0;
     
    37343370  if (getAvailableFlagA1())
    37353371  {
    3736     m_mergCands[MRG_A1].setCand( &pcMvFieldNeighbours[m_baseListidc<<1], puhInterDirNeighbours[m_baseListidc]
     3372    m_mergCands[MRG_A1].setCand( &pcMFieldNeighbours[m_numSpatialCands<<1], puhInterDirNeighbours[m_numSpatialCands]
    37373373#if H_3D_VSP
    37383374    , (pcCULeft->getVSPFlag(uiLeftPartIdx) != 0
     
    37483384      )
    37493385#endif
     3386#if H_3D_SPIVMP
    37503387      , false
     3388#endif
    37513389      );
    3752     m_baseListidc++;
     3390    m_numSpatialCands++;
    37533391  }
    37543392
    37553393  // above
    3756 
    37573394  if (getAvailableFlagB1())
    37583395  {
    3759     m_mergCands[MRG_B1].setCand( &pcMvFieldNeighbours[m_baseListidc<<1], puhInterDirNeighbours[m_baseListidc]
     3396    m_mergCands[MRG_B1].setCand( &pcMFieldNeighbours[m_numSpatialCands<<1], puhInterDirNeighbours[m_numSpatialCands]
    37603397#if H_3D_VSP
    37613398    , false
    37623399#endif
     3400#if H_3D_SPIVMP
    37633401      , false
     3402#endif
    37643403      );
    3765     m_baseListidc++;
     3404    m_numSpatialCands++;
    37663405  }
    37673406
    37683407  // above right
    3769 
    37703408  if (getAvailableFlagB0())
    37713409  {
    3772     m_mergCands[MRG_B0].setCand( &pcMvFieldNeighbours[m_baseListidc<<1], puhInterDirNeighbours[m_baseListidc]
     3410    m_mergCands[MRG_B0].setCand( &pcMFieldNeighbours[m_numSpatialCands<<1], puhInterDirNeighbours[m_numSpatialCands]
    37733411#if H_3D_VSP
    37743412    ,
    37753413      false
    37763414#endif
     3415#if H_3D_SPIVMP
    37773416      , false
     3417#endif
    37783418      );
    3779     m_baseListidc++;
     3419    m_numSpatialCands++;
    37803420  }
    37813421
    37823422  // left bottom
    3783 
    37843423  if (getAvailableFlagA0())
    37853424  {
    3786     m_mergCands[MRG_A0].setCand( &pcMvFieldNeighbours[m_baseListidc<<1], puhInterDirNeighbours[m_baseListidc]
     3425    m_mergCands[MRG_A0].setCand( &pcMFieldNeighbours[m_numSpatialCands<<1], puhInterDirNeighbours[m_numSpatialCands]
    37873426#if H_3D_VSP
    37883427    , false
    37893428#endif
     3429#if H_3D_SPIVMP
    37903430      , false
     3431#endif
    37913432      );
    3792     m_baseListidc++;
     3433    m_numSpatialCands++;
    37933434  }
    37943435
    37953436  // above left
    3796 
    37973437  if (getAvailableFlagB2())
    37983438  {
    3799     m_mergCands[MRG_B2].setCand( &pcMvFieldNeighbours[m_baseListidc<<1], puhInterDirNeighbours[m_baseListidc]
     3439    m_mergCands[MRG_B2].setCand( &pcMFieldNeighbours[m_numSpatialCands<<1], puhInterDirNeighbours[m_numSpatialCands]
    38003440#if H_3D_VSP
    38013441    , false
    38023442#endif
     3443#if H_3D_SPIVMP
    38033444      , false
     3445#endif
    38043446      );
    3805     m_baseListidc++;
    3806   }
    3807 
    3808 #endif
     3447    m_numSpatialCands++;
     3448  }
    38093449
    38103450
     
    40763716#endif
    40773717
     3718  iCount += m_mergCands[MRG_A1].m_bAvailable + m_mergCands[MRG_B1].m_bAvailable;
     3719
     3720#if H_3D_VSP
     3721  /////////////////////////////////////////////////
     3722  //////// VIEW SYNTHESIS PREDICTION (VSP) ////////
     3723  /////////////////////////////////////////////////
     3724  if (iCount<getSlice()->getMaxNumMergeCand())
     3725  {
     3726    if (
     3727      (!getAvailableFlagA1() || !(pcCULeft->getVSPFlag(uiLeftPartIdx) != 0)) &&
     3728#if H_3D_IC
     3729      !bICFlag &&
     3730#endif
     3731#if H_3D_ARP
     3732      !bARPFlag &&
     3733#endif
    40783734#if H_3D
    4079   iCount += m_mergCands[MRG_A1].m_bAvailable + m_mergCands[MRG_B1].m_bAvailable;
     3735      (nPSW + nPSH > 12) &&
     3736#endif
     3737#if H_3D_DBBP
     3738      !bDBBPFlag &&
     3739#endif
     3740      xAddVspCand( mrgCandIdx, &cDisInfo, iCount ) )
     3741    {
     3742      return;
     3743    }
     3744
     3745    // early termination
     3746    if (iCount == getSlice()->getMaxNumMergeCand())
     3747    {
     3748      return;
     3749    }
     3750#endif
     3751#if H_3D_VSP
     3752  }
     3753#endif
     3754
     3755  iCount += m_mergCands[MRG_B0].m_bAvailable;
     3756
     3757#if H_3D_IV_MERGE
     3758  /////////////////////////////////////////////
     3759  //////// INTER VIEW DISP COMP (IvDC) ////////
     3760  /////////////////////////////////////////////
     3761  if( ivCandDir[1] && iCount < getSlice()->getMaxNumMergeCand() && !getSlice()->getIsDepth() )
     3762  {
     3763    assert(iCount < getSlice()->getMaxNumMergeCand());
     3764
     3765    tmpMV[0].setMvField( cZeroMv, NOT_VALID );
     3766    tmpMV[1].setMvField( cZeroMv, NOT_VALID );
     3767    if( ( ivCandDir[1] & 1 ) == 1 )
     3768    {
     3769      tmpMV[0].setMvField( ivCandMv[ 2 ], ivCandRefIdx[ 2 ] );
     3770    }
     3771    if( ( ivCandDir[1] & 2 ) == 2 )
     3772    {
     3773      tmpMV[1].setMvField( ivCandMv[ 3 ], ivCandRefIdx[ 3 ] );
     3774    }
     3775
     3776    Bool bRemoveSpa = false; //pruning to A1, B1
     3777    for(Int i = 0; i < 2; i ++)
     3778    {
     3779      if ( !m_mergCands[MRG_A1+i].m_bAvailable )
     3780      {
     3781        continue;
     3782      }
     3783      if (ivCandDir[1] == m_mergCands[MRG_A1+i].m_uDir && tmpMV[0]==m_mergCands[MRG_A1+i].m_cMvField[0] && tmpMV[1]==m_mergCands[MRG_A1+i].m_cMvField[1])
     3784      {
     3785        bRemoveSpa                      = true;
     3786        break;
     3787      }     
     3788    }
     3789    if(!bRemoveSpa)
     3790    {
     3791#if NH_3D_NBDV
     3792      tmpMV[0].getMv().setIDVFlag (false);
     3793      tmpMV[1].getMv().setIDVFlag (false);
     3794#endif
     3795      m_mergCands[MRG_IVDC].setCand( tmpMV, ivCandDir[1], false, false);
     3796
     3797      if ( mrgCandIdx == iCount )
     3798        return;
     3799      iCount ++;
     3800
     3801      // early termination
     3802      if (iCount == getSlice()->getMaxNumMergeCand())
     3803      {
     3804        return;
     3805      }
     3806    }
     3807  }
     3808#endif // H_3D_IV_MERGE
     3809
     3810  iCount += m_mergCands[MRG_A0].m_bAvailable + m_mergCands[MRG_B2].m_bAvailable;
     3811
     3812#if H_3D_IV_MERGE
     3813  ////////////////////////////////////////////////////
     3814  //////// SHIFTED IV (IvMCShift + IvDCShift) ////////
     3815  ////////////////////////////////////////////////////
     3816  if(  ivMvPredFlag && iCount < getSlice()->getMaxNumMergeCand() && !getSlice()->getIsDepth() )
     3817  {
     3818    if(xAddIvMRGCand( mrgCandIdx,  iCount, ivCandDir, ivCandMv, ivCandRefIdx ) )
     3819    {
     3820      return;
     3821    }
     3822    //early termination
     3823    if (iCount == getSlice()->getMaxNumMergeCand())
     3824    {
     3825      return;
     3826    }
     3827  }
     3828#endif
     3829}
     3830#endif
     3831
     3832//! Construct a list of merging candidates
     3833Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx )
     3834{
     3835  UInt uiAbsPartAddr = m_absZIdxInCtu + uiAbsPartIdx;
     3836#if NH_3D_MLC
     3837  Bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ];
    40803838#else
     3839  Bool abCandIsInter[ MRG_MAX_NUM_CANDS ];
     3840#endif
     3841  for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ++ui )
     3842  {
     3843    abCandIsInter[ui] = false;
     3844    pcMvFieldNeighbours[ ( ui << 1 )     ].setRefIdx(NOT_VALID);
     3845    pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setRefIdx(NOT_VALID);
     3846  }
     3847  numValidMergeCand = getSlice()->getMaxNumMergeCand();
     3848  // compute the location of the current PU
     3849  Int xP, yP, nPSW, nPSH;
     3850  this->getPartPosition(uiPUIdx, xP, yP, nPSW, nPSH);
     3851
     3852  Int iCount = 0;
     3853
     3854  UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB;
     3855  PartSize cCurPS = getPartitionSize( uiAbsPartIdx );
     3856  deriveLeftRightTopIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT );
     3857  deriveLeftBottomIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLB );
     3858
    40813859  //left
    40823860  UInt uiLeftPartIdx = 0;
    40833861  TComDataCU* pcCULeft = 0;
    40843862  pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB );
     3863
    40853864  Bool isAvailableA1 = pcCULeft &&
    4086     pcCULeft->isDiffMER(xP -1, yP+nPSH-1, xP, yP) &&
    4087     !( uiPUIdx == 1 && (cCurPS == SIZE_Nx2N || cCurPS == SIZE_nLx2N || cCurPS == SIZE_nRx2N) ) &&
    4088     !pcCULeft->isIntra( uiLeftPartIdx ) ;
     3865                       pcCULeft->isDiffMER(xP -1, yP+nPSH-1, xP, yP) &&
     3866                       !( uiPUIdx == 1 && (cCurPS == SIZE_Nx2N || cCurPS == SIZE_nLx2N || cCurPS == SIZE_nRx2N) ) &&
     3867                       pcCULeft->isInter( uiLeftPartIdx ) ;
     3868
    40893869  if ( isAvailableA1 )
    40903870  {
     3871#if NH_3D_MLC
     3872    m_bAvailableFlagA1 = 1;
     3873#endif
    40913874    abCandIsInter[iCount] = true;
    40923875    // get Inter Dir
     
    40983881      pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    40993882    }
    4100 
    41013883    if ( mrgCandIdx == iCount )
    41023884    {
     
    41073889
    41083890  // early termination
    4109   if (iCount == getSlice()->getMaxNumMergeCand()) 
     3891  if (iCount == getSlice()->getMaxNumMergeCand())
    41103892  {
    41113893    return;
    41123894  }
    4113 
    41143895  // above
    41153896  UInt uiAbovePartIdx = 0;
    41163897  TComDataCU* pcCUAbove = 0;
    41173898  pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT );
     3899
    41183900  Bool isAvailableB1 = pcCUAbove &&
    4119     pcCUAbove->isDiffMER(xP+nPSW-1, yP-1, xP, yP) &&
    4120     !( uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD) ) &&
    4121     !pcCUAbove->isIntra( uiAbovePartIdx );
     3901                       pcCUAbove->isDiffMER(xP+nPSW-1, yP-1, xP, yP) &&
     3902                       !( uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD) ) &&
     3903                       pcCUAbove->isInter( uiAbovePartIdx );
     3904
    41223905  if ( isAvailableB1 && (!isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAbove, uiAbovePartIdx ) ) )
    41233906  {
     3907#if NH_3D_MLC
     3908    m_bAvailableFlagB1 = 1;
     3909#endif
    41243910    abCandIsInter[iCount] = true;
    41253911    // get Inter Dir
     
    41313917      pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    41323918    }
    4133 
    41343919    if ( mrgCandIdx == iCount )
    41353920    {
     
    41393924  }
    41403925  // early termination
    4141   if (iCount == getSlice()->getMaxNumMergeCand()) 
     3926  if (iCount == getSlice()->getMaxNumMergeCand())
    41423927  {
    41433928    return;
     
    41483933  TComDataCU* pcCUAboveRight = 0;
    41493934  pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT );
     3935
    41503936  Bool isAvailableB0 = pcCUAboveRight &&
    4151     pcCUAboveRight->isDiffMER(xP+nPSW, yP-1, xP, yP) &&
    4152     !pcCUAboveRight->isIntra( uiAboveRightPartIdx );
     3937                       pcCUAboveRight->isDiffMER(xP+nPSW, yP-1, xP, yP) &&
     3938                       pcCUAboveRight->isInter( uiAboveRightPartIdx );
     3939
    41533940  if ( isAvailableB0 && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) )
    41543941  {
     3942#if NH_3D_MLC
     3943    m_bAvailableFlagB0 = 1;
     3944#endif
    41553945    abCandIsInter[iCount] = true;
    41563946    // get Inter Dir
     
    41623952      pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    41633953    }
    4164 
    41653954    if ( mrgCandIdx == iCount )
    41663955    {
     
    41703959  }
    41713960  // early termination
    4172   if (iCount == getSlice()->getMaxNumMergeCand()) 
     3961  if (iCount == getSlice()->getMaxNumMergeCand())
    41733962  {
    41743963    return;
    41753964  }
    4176 #endif
    4177 
    4178 
    4179 #if H_3D_VSP
    4180   /////////////////////////////////////////////////
    4181   //////// VIEW SYNTHESIS PREDICTION (VSP) ////////
    4182   /////////////////////////////////////////////////
    4183   if (iCount<getSlice()->getMaxNumMergeCand())
    4184   {
    4185     if (
    4186       (!getAvailableFlagA1() || !(pcCULeft->getVSPFlag(uiLeftPartIdx) != 0)) &&
    4187 #if H_3D_IC
    4188       !bICFlag &&
    4189 #endif
    4190 #if H_3D_ARP
    4191       !bARPFlag &&
    4192 #endif
    4193 #if H_3D
    4194       (nPSW + nPSH > 12) &&
    4195 #endif
    4196 #if H_3D_DBBP
    4197       !bDBBPFlag &&
    4198 #endif
    4199       xAddVspCand( mrgCandIdx, &cDisInfo, iCount ) )
    4200     {
    4201       return;
    4202     }
    4203 
    4204     // early termination
    4205     if (iCount == getSlice()->getMaxNumMergeCand())
    4206     {
    4207       return;
    4208     }
    4209 #endif
    4210 #if H_3D_VSP
    4211   }
    4212 #endif
    4213 
    4214 #if H_3D
    4215   iCount += m_mergCands[MRG_B0].m_bAvailable;
    4216 #endif
    4217 
    4218 
    4219 #if H_3D_IV_MERGE
    4220   /////////////////////////////////////////////
    4221   //////// INTER VIEW DISP COMP (IvDC) ////////
    4222   /////////////////////////////////////////////
    4223   if( ivCandDir[1] && iCount < getSlice()->getMaxNumMergeCand() && !getSlice()->getIsDepth() )
    4224   {
    4225     assert(iCount < getSlice()->getMaxNumMergeCand());
    4226 
    4227     tmpMV[0].setMvField( cZeroMv, NOT_VALID );
    4228     tmpMV[1].setMvField( cZeroMv, NOT_VALID );
    4229     if( ( ivCandDir[1] & 1 ) == 1 )
    4230     {
    4231       tmpMV[0].setMvField( ivCandMv[ 2 ], ivCandRefIdx[ 2 ] );
    4232     }
    4233     if( ( ivCandDir[1] & 2 ) == 2 )
    4234     {
    4235       tmpMV[1].setMvField( ivCandMv[ 3 ], ivCandRefIdx[ 3 ] );
    4236     }
    4237 
    4238     Bool bRemoveSpa = false; //pruning to A1, B1
    4239     for(Int i = 0; i < 2; i ++)
    4240     {
    4241       if ( !m_mergCands[MRG_A1+i].m_bAvailable )
    4242       {
    4243         continue;
    4244       }
    4245       if (ivCandDir[1] == m_mergCands[MRG_A1+i].m_uDir && tmpMV[0]==m_mergCands[MRG_A1+i].m_cMvField[0] && tmpMV[1]==m_mergCands[MRG_A1+i].m_cMvField[1])
    4246       {
    4247         bRemoveSpa                      = true;
    4248         break;
    4249       }     
    4250     }
    4251     if(!bRemoveSpa)
    4252     {
    4253 #if NH_3D_NBDV
    4254       tmpMV[0].getMv().setIDVFlag (false);
    4255       tmpMV[1].getMv().setIDVFlag (false);
    4256 #endif
    4257       m_mergCands[MRG_IVDC].setCand( tmpMV, ivCandDir[1], false, false);
    4258 
    4259       if ( mrgCandIdx == iCount )
    4260         return;
    4261       iCount ++;
    4262 
    4263       // early termination
    4264       if (iCount == getSlice()->getMaxNumMergeCand())
    4265       {
    4266         return;
    4267       }
    4268     }
    4269   }
    4270 #endif // H_3D_IV_MERGE
    4271 
    4272 
    4273 #if H_3D
    4274   iCount += m_mergCands[MRG_A0].m_bAvailable + m_mergCands[MRG_B2].m_bAvailable;
    4275 #else
     3965
    42763966  //left bottom
    42773967  UInt uiLeftBottomPartIdx = 0;
    42783968  TComDataCU* pcCULeftBottom = 0;
    42793969  pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB );
     3970
    42803971  Bool isAvailableA0 = pcCULeftBottom &&
    4281   pcCULeftBottom->isDiffMER(xP-1, yP+nPSH, xP, yP) &&
    4282   !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) ;
     3972                       pcCULeftBottom->isDiffMER(xP-1, yP+nPSH, xP, yP) &&
     3973                       pcCULeftBottom->isInter( uiLeftBottomPartIdx ) ;
     3974
    42833975  if ( isAvailableA0 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) )
    42843976  {
     3977#if NH_3D_MLC
     3978    m_bAvailableFlagA0 = 1;
     3979#endif
    42853980    abCandIsInter[iCount] = true;
    42863981    // get Inter Dir
     
    42993994  }
    43003995  // early termination
    4301   if (iCount == getSlice()->getMaxNumMergeCand()) 
     3996  if (iCount == getSlice()->getMaxNumMergeCand())
    43023997  {
    43033998    return;
    43043999  }
    43054000
    4306   // above left 
     4001  // above left
    43074002  if( iCount < 4 )
    43084003  {
     
    43104005    TComDataCU* pcCUAboveLeft = 0;
    43114006    pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr );
     4007
    43124008    Bool isAvailableB2 = pcCUAboveLeft &&
    4313     pcCUAboveLeft->isDiffMER(xP-1, yP-1, xP, yP) &&
    4314     !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx );
     4009                         pcCUAboveLeft->isDiffMER(xP-1, yP-1, xP, yP) &&
     4010                         pcCUAboveLeft->isInter( uiAboveLeftPartIdx );
     4011
    43154012    if ( isAvailableB2 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) )
    43164013        && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) )
    43174014    {
     4015#if NH_3D_MLC
     4016      m_bAvailableFlagB2 = 1;
     4017#endif
    43184018      abCandIsInter[iCount] = true;
    43194019      // get Inter Dir
     
    43334033  }
    43344034  // early termination
    4335   if (iCount == getSlice()->getMaxNumMergeCand()) 
     4035  if (iCount == getSlice()->getMaxNumMergeCand())
    43364036  {
    43374037    return;
    43384038  }
    4339 #endif
    4340 
    4341 
    4342 #if H_3D_IV_MERGE
    4343   ////////////////////////////////////////////////////
    4344   //////// SHIFTED IV (IvMCShift + IvDCShift) ////////
    4345   ////////////////////////////////////////////////////
    4346   if(  ivMvPredFlag && iCount < getSlice()->getMaxNumMergeCand() && !getSlice()->getIsDepth() )
    4347   {
    4348     if(xAddIvMRGCand( mrgCandIdx,  iCount, ivCandDir, ivCandMv, ivCandRefIdx ) )
    4349     {
    4350       return;
    4351     }
    4352     //early termination
    4353     if (iCount == getSlice()->getMaxNumMergeCand())
    4354     {
    4355       return;
    4356     }
    4357   }
    4358 #endif
    4359 #if !H_3D
    4360   if ( getSlice()->getEnableTMVPFlag())
     4039
     4040  if ( getSlice()->getEnableTMVPFlag() )
    43614041  {
    43624042    //>> MTK colocated-RightBottom
    43634043    UInt uiPartIdxRB;
    43644044
    4365     deriveRightBottomIdx( uiPUIdx, uiPartIdxRB ); 
     4045    deriveRightBottomIdx( uiPUIdx, uiPartIdxRB );
    43664046
    43674047    UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];
    4368     UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();
     4048    const UInt numPartInCtuWidth  = m_pcPic->getNumPartInCtuWidth();
     4049    const UInt numPartInCtuHeight = m_pcPic->getNumPartInCtuHeight();
    43694050
    43704051    TComMv cColMv;
    43714052    Int iRefIdx;
    4372     Int uiLCUIdx = -1;
    4373 
    4374     if      ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )  // image boundary check
    4375     {
    4376     }
    4377     else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
    4378     {
    4379     }
    4380     else
    4381     {
    4382       if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) &&           // is not at the last column of LCU
    4383         ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row    of LCU
    4384       {
    4385         uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ];
    4386         uiLCUIdx = getAddr();
    4387       }
    4388       else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 )           // is not at the last column of LCU But is last row of LCU
    4389       {
    4390         uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ];
    4391       }
    4392       else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
     4053    Int ctuRsAddr = -1;
     4054
     4055    if (   ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth () ) < m_pcSlice->getSPS()->getPicWidthInLumaSamples () )  // image boundary check
     4056        && ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
     4057    {
     4058      if ( ( uiAbsPartIdxTmp % numPartInCtuWidth < numPartInCtuWidth - 1 ) &&           // is not at the last column of CTU
     4059        ( uiAbsPartIdxTmp / numPartInCtuWidth < numPartInCtuHeight - 1 ) )              // is not at the last row    of CTU
     4060      {
     4061        uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + numPartInCtuWidth + 1 ];
     4062        ctuRsAddr = getCtuRsAddr();
     4063      }
     4064      else if ( uiAbsPartIdxTmp % numPartInCtuWidth < numPartInCtuWidth - 1 )           // is not at the last column of CTU But is last row of CTU
     4065      {
     4066        uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + numPartInCtuWidth + 1) % m_pcPic->getNumPartitionsInCtu() ];
     4067      }
     4068      else if ( uiAbsPartIdxTmp / numPartInCtuWidth < numPartInCtuHeight - 1 )          // is not at the last row of CTU But is last column of CTU
    43934069      {
    43944070        uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ];
    4395         uiLCUIdx = getAddr() + 1;
    4396       }
    4397       else //is the right bottom corner of LCU                       
     4071        ctuRsAddr = getCtuRsAddr() + 1;
     4072      }
     4073      else //is the right bottom corner of CTU
    43984074      {
    43994075        uiAbsPartAddr = 0;
    44004076      }
    44014077    }
    4402    
    4403    
     4078
    44044079    iRefIdx = 0;
     4080
    44054081    Bool bExistMV = false;
    44064082    UInt uiPartIdxCenter;
    4407     UInt uiCurLCUIdx = getAddr();
    44084083    Int dir = 0;
    44094084    UInt uiArrayAddr = iCount;
    44104085    xDeriveCenterIdx( uiPUIdx, uiPartIdxCenter );
    4411     bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_0, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx );
     4086    bExistMV = ctuRsAddr >= 0 && xGetColMVP( REF_PIC_LIST_0, ctuRsAddr, uiAbsPartAddr, cColMv, iRefIdx );
    44124087    if( bExistMV == false )
    44134088    {
    4414       bExistMV = xGetColMVP( REF_PIC_LIST_0, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx );
     4089      bExistMV = xGetColMVP( REF_PIC_LIST_0, getCtuRsAddr(), uiPartIdxCenter, cColMv, iRefIdx );
    44154090    }
    44164091    if( bExistMV )
     
    44224097    if ( getSlice()->isInterB() )
    44234098    {
    4424       bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_1, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx);
     4099#if H_3D_TMVP
     4100      iRefIdx = 0;
     4101#endif
     4102      bExistMV = ctuRsAddr >= 0 && xGetColMVP( REF_PIC_LIST_1, ctuRsAddr, uiAbsPartAddr, cColMv, iRefIdx);
    44254103      if( bExistMV == false )
    44264104      {
    4427         bExistMV = xGetColMVP( REF_PIC_LIST_1, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx );
     4105        bExistMV = xGetColMVP( REF_PIC_LIST_1, getCtuRsAddr(), uiPartIdxCenter, cColMv, iRefIdx );
    44284106      }
    44294107      if( bExistMV )
     
    44334111      }
    44344112    }
    4435    
     4113
    44364114    if (dir != 0)
    44374115    {
    44384116      puhInterDirNeighbours[uiArrayAddr] = dir;
    44394117      abCandIsInter[uiArrayAddr] = true;
     4118#if NH_3D_NBDV
     4119      pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
     4120      pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
     4121#endif
     4122
    44404123      if ( mrgCandIdx == iCount )
    44414124      {
     
    44454128    }
    44464129  }
    4447   // early termination 
    4448   if (iCount == getSlice()->getMaxNumMergeCand()) 
     4130  // early termination
     4131  if (iCount == getSlice()->getMaxNumMergeCand())
    44494132  {
    44504133    return;
    44514134  }
     4135
    44524136  UInt uiArrayAddr = iCount;
    44534137  UInt uiCutoff = uiArrayAddr;
    4454    
    4455   if ( getSlice()->isInterB())
    4456   {
    4457     UInt uiPriorityList0[12] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3};
    4458     UInt uiPriorityList1[12] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2};
     4138
     4139#if NH_3D_MLC
     4140  if ( getSlice()->isInterB() && iCount<5)
     4141#else
     4142  if ( getSlice()->isInterB() )
     4143#endif
     4144  {
     4145    static const UInt NUM_PRIORITY_LIST=12;
     4146    static const UInt uiPriorityList0[NUM_PRIORITY_LIST] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3};
     4147    static const UInt uiPriorityList1[NUM_PRIORITY_LIST] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2};
    44594148
    44604149    for (Int idx=0; idx<uiCutoff*(uiCutoff-1) && uiArrayAddr!= getSlice()->getMaxNumMergeCand(); idx++)
    44614150    {
    4462       Int i = uiPriorityList0[idx]; Int j = uiPriorityList1[idx];
     4151      assert(idx<NUM_PRIORITY_LIST);
     4152      Int i = uiPriorityList0[idx];
     4153      Int j = uiPriorityList1[idx];
    44634154      if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2))
    44644155      {
     
    44844175  }
    44854176  // early termination
    4486   if (uiArrayAddr == getSlice()->getMaxNumMergeCand()) 
     4177  if (uiArrayAddr == getSlice()->getMaxNumMergeCand())
    44874178  {
    44884179    return;
    44894180  }
     4181
    44904182  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);
     4183
    44914184  Int r = 0;
    44924185  Int refcnt = 0;
     
    45034196    }
    45044197    uiArrayAddr++;
     4198
    45054199    if ( refcnt == iNumRefIdx - 1 )
    45064200    {
     
    45134207    }
    45144208  }
    4515 
    45164209  numValidMergeCand = uiArrayAddr;
    4517 #endif
    4518 }
    4519 #else
    4520 
    4521 //! Construct a list of merging candidates
    4522 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx )
    4523 {
    4524   UInt uiAbsPartAddr = m_absZIdxInCtu + uiAbsPartIdx;
    4525   Bool abCandIsInter[ MRG_MAX_NUM_CANDS ];
    4526   for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ++ui )
    4527   {
    4528     abCandIsInter[ui] = false;
    4529     pcMvFieldNeighbours[ ( ui << 1 )     ].setRefIdx(NOT_VALID);
    4530     pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setRefIdx(NOT_VALID);
    4531   }
    4532   numValidMergeCand = getSlice()->getMaxNumMergeCand();
    4533   // compute the location of the current PU
    4534   Int xP, yP, nPSW, nPSH;
    4535   this->getPartPosition(uiPUIdx, xP, yP, nPSW, nPSH);
    4536 
    4537   Int iCount = 0;
    4538 
    4539   UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB;
    4540   PartSize cCurPS = getPartitionSize( uiAbsPartIdx );
    4541   deriveLeftRightTopIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT );
    4542   deriveLeftBottomIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLB );
    4543 
    4544   //left
    4545   UInt uiLeftPartIdx = 0;
    4546   TComDataCU* pcCULeft = 0;
    4547   pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB );
    4548 
    4549   Bool isAvailableA1 = pcCULeft &&
    4550                        pcCULeft->isDiffMER(xP -1, yP+nPSH-1, xP, yP) &&
    4551                        !( uiPUIdx == 1 && (cCurPS == SIZE_Nx2N || cCurPS == SIZE_nLx2N || cCurPS == SIZE_nRx2N) ) &&
    4552                        pcCULeft->isInter( uiLeftPartIdx ) ;
    4553 
    4554   if ( isAvailableA1 )
    4555   {
    4556     abCandIsInter[iCount] = true;
    4557     // get Inter Dir
    4558     puhInterDirNeighbours[iCount] = pcCULeft->getInterDir( uiLeftPartIdx );
    4559     // get Mv from Left
    4560     pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    4561     if ( getSlice()->isInterB() )
    4562     {
    4563       pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    4564     }
    4565     if ( mrgCandIdx == iCount )
    4566     {
    4567       return;
    4568     }
    4569     iCount ++;
    4570   }
    4571 
    4572   // early termination
    4573   if (iCount == getSlice()->getMaxNumMergeCand())
    4574   {
    4575     return;
    4576   }
    4577   // above
    4578   UInt uiAbovePartIdx = 0;
    4579   TComDataCU* pcCUAbove = 0;
    4580   pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT );
    4581 
    4582   Bool isAvailableB1 = pcCUAbove &&
    4583                        pcCUAbove->isDiffMER(xP+nPSW-1, yP-1, xP, yP) &&
    4584                        !( uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD) ) &&
    4585                        pcCUAbove->isInter( uiAbovePartIdx );
    4586 
    4587   if ( isAvailableB1 && (!isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAbove, uiAbovePartIdx ) ) )
    4588   {
    4589     abCandIsInter[iCount] = true;
    4590     // get Inter Dir
    4591     puhInterDirNeighbours[iCount] = pcCUAbove->getInterDir( uiAbovePartIdx );
    4592     // get Mv from Left
    4593     pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    4594     if ( getSlice()->isInterB() )
    4595     {
    4596       pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    4597     }
    4598     if ( mrgCandIdx == iCount )
    4599     {
    4600       return;
    4601     }
    4602     iCount ++;
    4603   }
    4604   // early termination
    4605   if (iCount == getSlice()->getMaxNumMergeCand())
    4606   {
    4607     return;
    4608   }
    4609 
    4610   // above right
    4611   UInt uiAboveRightPartIdx = 0;
    4612   TComDataCU* pcCUAboveRight = 0;
    4613   pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT );
    4614 
    4615   Bool isAvailableB0 = pcCUAboveRight &&
    4616                        pcCUAboveRight->isDiffMER(xP+nPSW, yP-1, xP, yP) &&
    4617                        pcCUAboveRight->isInter( uiAboveRightPartIdx );
    4618 
    4619   if ( isAvailableB0 && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) )
    4620   {
    4621     abCandIsInter[iCount] = true;
    4622     // get Inter Dir
    4623     puhInterDirNeighbours[iCount] = pcCUAboveRight->getInterDir( uiAboveRightPartIdx );
    4624     // get Mv from Left
    4625     pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    4626     if ( getSlice()->isInterB() )
    4627     {
    4628       pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    4629     }
    4630     if ( mrgCandIdx == iCount )
    4631     {
    4632       return;
    4633     }
    4634     iCount ++;
    4635   }
    4636   // early termination
    4637   if (iCount == getSlice()->getMaxNumMergeCand())
    4638   {
    4639     return;
    4640   }
    4641 
    4642   //left bottom
    4643   UInt uiLeftBottomPartIdx = 0;
    4644   TComDataCU* pcCULeftBottom = 0;
    4645   pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB );
    4646 
    4647   Bool isAvailableA0 = pcCULeftBottom &&
    4648                        pcCULeftBottom->isDiffMER(xP-1, yP+nPSH, xP, yP) &&
    4649                        pcCULeftBottom->isInter( uiLeftBottomPartIdx ) ;
    4650 
    4651   if ( isAvailableA0 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) )
    4652   {
    4653     abCandIsInter[iCount] = true;
    4654     // get Inter Dir
    4655     puhInterDirNeighbours[iCount] = pcCULeftBottom->getInterDir( uiLeftBottomPartIdx );
    4656     // get Mv from Left
    4657     pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    4658     if ( getSlice()->isInterB() )
    4659     {
    4660       pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    4661     }
    4662     if ( mrgCandIdx == iCount )
    4663     {
    4664       return;
    4665     }
    4666     iCount ++;
    4667   }
    4668   // early termination
    4669   if (iCount == getSlice()->getMaxNumMergeCand())
    4670   {
    4671     return;
    4672   }
    4673 
    4674   // above left
    4675   if( iCount < 4 )
    4676   {
    4677     UInt uiAboveLeftPartIdx = 0;
    4678     TComDataCU* pcCUAboveLeft = 0;
    4679     pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr );
    4680 
    4681     Bool isAvailableB2 = pcCUAboveLeft &&
    4682                          pcCUAboveLeft->isDiffMER(xP-1, yP-1, xP, yP) &&
    4683                          pcCUAboveLeft->isInter( uiAboveLeftPartIdx );
    4684 
    4685     if ( isAvailableB2 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) )
    4686         && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) )
    4687     {
    4688       abCandIsInter[iCount] = true;
    4689       // get Inter Dir
    4690       puhInterDirNeighbours[iCount] = pcCUAboveLeft->getInterDir( uiAboveLeftPartIdx );
    4691       // get Mv from Left
    4692       pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    4693       if ( getSlice()->isInterB() )
    4694       {
    4695         pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    4696       }
    4697       if ( mrgCandIdx == iCount )
    4698       {
    4699         return;
    4700       }
    4701       iCount ++;
    4702     }
    4703   }
    4704   // early termination
    4705   if (iCount == getSlice()->getMaxNumMergeCand())
    4706   {
    4707     return;
    4708   }
    4709 
    4710   if ( getSlice()->getEnableTMVPFlag() )
    4711   {
    4712     //>> MTK colocated-RightBottom
    4713     UInt uiPartIdxRB;
    4714 
    4715     deriveRightBottomIdx( uiPUIdx, uiPartIdxRB );
    4716 
    4717     UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];
    4718     const UInt numPartInCtuWidth  = m_pcPic->getNumPartInCtuWidth();
    4719     const UInt numPartInCtuHeight = m_pcPic->getNumPartInCtuHeight();
    4720 
    4721     TComMv cColMv;
    4722     Int iRefIdx;
    4723     Int ctuRsAddr = -1;
    4724 
    4725     if (   ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth () ) < m_pcSlice->getSPS()->getPicWidthInLumaSamples () )  // image boundary check
    4726         && ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
    4727     {
    4728       if ( ( uiAbsPartIdxTmp % numPartInCtuWidth < numPartInCtuWidth - 1 ) &&           // is not at the last column of CTU
    4729         ( uiAbsPartIdxTmp / numPartInCtuWidth < numPartInCtuHeight - 1 ) )              // is not at the last row    of CTU
    4730       {
    4731         uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + numPartInCtuWidth + 1 ];
    4732         ctuRsAddr = getCtuRsAddr();
    4733       }
    4734       else if ( uiAbsPartIdxTmp % numPartInCtuWidth < numPartInCtuWidth - 1 )           // is not at the last column of CTU But is last row of CTU
    4735       {
    4736         uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + numPartInCtuWidth + 1) % m_pcPic->getNumPartitionsInCtu() ];
    4737       }
    4738       else if ( uiAbsPartIdxTmp / numPartInCtuWidth < numPartInCtuHeight - 1 )          // is not at the last row of CTU But is last column of CTU
    4739       {
    4740         uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ];
    4741         ctuRsAddr = getCtuRsAddr() + 1;
    4742       }
    4743       else //is the right bottom corner of CTU
    4744       {
    4745         uiAbsPartAddr = 0;
    4746       }
    4747     }
    4748 
    4749     iRefIdx = 0;
    4750 
    4751     Bool bExistMV = false;
    4752     UInt uiPartIdxCenter;
    4753     Int dir = 0;
    4754     UInt uiArrayAddr = iCount;
    4755     xDeriveCenterIdx( uiPUIdx, uiPartIdxCenter );
    4756     bExistMV = ctuRsAddr >= 0 && xGetColMVP( REF_PIC_LIST_0, ctuRsAddr, uiAbsPartAddr, cColMv, iRefIdx );
    4757     if( bExistMV == false )
    4758     {
    4759       bExistMV = xGetColMVP( REF_PIC_LIST_0, getCtuRsAddr(), uiPartIdxCenter,  cColMv, iRefIdx );
    4760     }
    4761     if( bExistMV )
    4762     {
    4763       dir |= 1;
    4764       pcMvFieldNeighbours[ 2 * uiArrayAddr ].setMvField( cColMv, iRefIdx );
    4765     }
    4766 
    4767     if ( getSlice()->isInterB() )
    4768     {
    4769       bExistMV = ctuRsAddr >= 0 && xGetColMVP( REF_PIC_LIST_1, ctuRsAddr, uiAbsPartAddr, cColMv, iRefIdx);
    4770       if( bExistMV == false )
    4771       {
    4772         bExistMV = xGetColMVP( REF_PIC_LIST_1, getCtuRsAddr(), uiPartIdxCenter, cColMv, iRefIdx );
    4773       }
    4774       if( bExistMV )
    4775       {
    4776         dir |= 2;
    4777         pcMvFieldNeighbours[ 2 * uiArrayAddr + 1 ].setMvField( cColMv, iRefIdx );
    4778       }
    4779     }
    4780 
    4781     if (dir != 0)
    4782     {
    4783       puhInterDirNeighbours[uiArrayAddr] = dir;
    4784       abCandIsInter[uiArrayAddr] = true;
    4785 
    4786       if ( mrgCandIdx == iCount )
    4787       {
    4788         return;
    4789       }
    4790       iCount++;
    4791     }
    4792   }
    4793   // early termination
    4794   if (iCount == getSlice()->getMaxNumMergeCand())
    4795   {
    4796     return;
    4797   }
    4798 
    4799   UInt uiArrayAddr = iCount;
    4800   UInt uiCutoff = uiArrayAddr;
    4801 
    4802   if ( getSlice()->isInterB() )
    4803   {
    4804     static const UInt NUM_PRIORITY_LIST=12;
    4805     static const UInt uiPriorityList0[NUM_PRIORITY_LIST] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3};
    4806     static const UInt uiPriorityList1[NUM_PRIORITY_LIST] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2};
    4807 
    4808     for (Int idx=0; idx<uiCutoff*(uiCutoff-1) && uiArrayAddr!= getSlice()->getMaxNumMergeCand(); idx++)
    4809     {
    4810       assert(idx<NUM_PRIORITY_LIST);
    4811       Int i = uiPriorityList0[idx];
    4812       Int j = uiPriorityList1[idx];
    4813       if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2))
    4814       {
    4815         abCandIsInter[uiArrayAddr] = true;
    4816         puhInterDirNeighbours[uiArrayAddr] = 3;
    4817 
    4818         // get Mv from cand[i] and cand[j]
    4819         pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(pcMvFieldNeighbours[i<<1].getMv(), pcMvFieldNeighbours[i<<1].getRefIdx());
    4820         pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(pcMvFieldNeighbours[(j<<1)+1].getMv(), pcMvFieldNeighbours[(j<<1)+1].getRefIdx());
    4821 
    4822         Int iRefPOCL0 = m_pcSlice->getRefPOC( REF_PIC_LIST_0, pcMvFieldNeighbours[(uiArrayAddr<<1)].getRefIdx() );
    4823         Int iRefPOCL1 = m_pcSlice->getRefPOC( REF_PIC_LIST_1, pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getRefIdx() );
    4824         if (iRefPOCL0 == iRefPOCL1 && pcMvFieldNeighbours[(uiArrayAddr<<1)].getMv() == pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getMv())
    4825         {
    4826           abCandIsInter[uiArrayAddr] = false;
    4827         }
    4828         else
    4829         {
    4830           uiArrayAddr++;
    4831         }
    4832       }
    4833     }
    4834   }
    4835   // early termination
    4836   if (uiArrayAddr == getSlice()->getMaxNumMergeCand())
    4837   {
    4838     return;
    4839   }
    4840 
    4841   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);
    4842 
    4843   Int r = 0;
    4844   Int refcnt = 0;
    4845   while (uiArrayAddr < getSlice()->getMaxNumMergeCand())
    4846   {
    4847     abCandIsInter[uiArrayAddr] = true;
    4848     puhInterDirNeighbours[uiArrayAddr] = 1;
    4849     pcMvFieldNeighbours[uiArrayAddr << 1].setMvField( TComMv(0, 0), r);
    4850 
    4851     if ( getSlice()->isInterB() )
    4852     {
    4853       puhInterDirNeighbours[uiArrayAddr] = 3;
    4854       pcMvFieldNeighbours[(uiArrayAddr << 1) + 1].setMvField(TComMv(0, 0), r);
    4855     }
    4856     uiArrayAddr++;
    4857 
    4858     if ( refcnt == iNumRefIdx - 1 )
    4859     {
    4860       r = 0;
    4861     }
    4862     else
    4863     {
    4864       ++r;
    4865       ++refcnt;
    4866     }
    4867   }
    4868   numValidMergeCand = uiArrayAddr;
    4869 }
    4870 #endif
     4210}
    48714211
    48724212/** Check whether the current PU and a spatial neighboring PU are in a same ME region.
  • branches/HTM-14.1-update-dev3-ETRI/source/Lib/TLibCommon/TComDataCU.h

    r1217 r1233  
    197197  DbbpTmpData   m_sDBBPTmpData;
    198198#endif
    199 #if H_3D
     199#if NH_3D_MLC
    200200  Bool          m_bAvailableFlagA1;    ///< A1 available flag
    201201  Bool          m_bAvailableFlagB1;    ///< B1 available flag
     
    220220  UInt          m_uiTotalBins;        ///< sum of partition bins
    221221  Char          m_codedQP;
    222 #if H_3D
    223   DisInfo       m_cDefaultDisInfo;    ///< Default disparity information for initializing
    224 #endif
    225 #if H_3D_IV_MERGE
    226   TComMotionCand  m_mergCands[MRG_IVSHIFT+1];
    227   Int           m_baseListidc;
     222#if NH_3D_MLC
     223  DisInfo         m_cDefaultDisInfo;    ///< Default disparity information for initializing
     224  TComMotionCand  m_mergCands[MRG_IVSHIFT+1];   ///< Motion candidates for merge mode
     225  Int             m_numSpatialCands;
    228226#endif
    229227
     
    654652  Bool          hasEqualMotion              ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx );
    655653
    656 #if H_3D
    657   Bool          getAvailableFlagA1() { return m_bAvailableFlagA1;}
    658   Bool          getAvailableFlagB1() { return m_bAvailableFlagB1;}
    659   Bool          getAvailableFlagB0() { return m_bAvailableFlagB0;}
    660   Bool          getAvailableFlagA0() { return m_bAvailableFlagA0;}
    661   Bool          getAvailableFlagB2() { return m_bAvailableFlagB2;}
     654#if NH_3D_MLC
     655  Bool          getAvailableFlagA1() { return m_bAvailableFlagA1;   }
     656  Bool          getAvailableFlagB1() { return m_bAvailableFlagB1;   }
     657  Bool          getAvailableFlagB0() { return m_bAvailableFlagB0;   }
     658  Bool          getAvailableFlagA0() { return m_bAvailableFlagA0;   }
     659  Bool          getAvailableFlagB2() { return m_bAvailableFlagB2;   }
    662660  Void          initAvailableFlags() { m_bAvailableFlagA1 = m_bAvailableFlagB1 = m_bAvailableFlagB0 = m_bAvailableFlagA0 = m_bAvailableFlagB2 = 0;  }
    663661  Void          buildMCL(TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours
     
    670668    , Int& numValidMergeCand
    671669    );
    672   Void          getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1);
    673   Void          xGetInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours
    674 #else
     670  Void          xGetInterMergeCandidates      ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours
     671#if H_3D_SPIVMP
     672  , TComMvField* pcMvFieldSP, UChar* puhInterDirSP
     673#endif
     674  , Int& numValidMergeCand, Int mrgCandIdx = -1 );
     675#endif
    675676  Void          getInterMergeCandidates       ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 );
    676 #endif
    677 #if H_3D_SPIVMP
    678                                             , TComMvField* pcMvFieldSP, UChar* puhInterDirSP
    679 #endif
    680677
    681678#if H_3D_VSP
  • branches/HTM-14.1-update-dev3-ETRI/source/Lib/TLibCommon/TComMotionInfo.h

    r1217 r1233  
    192192//! \}
    193193
    194 #if H_3D_IV_MERGE
     194#if NH_3D_MLC
     195/// class for container of merge candidate
    195196class TComMotionCand
    196197{
     
    202203  Int                   m_iVspFlag;
    203204#endif 
     205#if H_3D_SPIVMP
    204206  Bool                  m_bSPIVMPFlag;
     207#endif
    205208
    206209public:
     
    212215    m_iVspFlag = 0;
    213216#endif
     217#if H_3D_SPIVMP
    214218    m_bSPIVMPFlag = false;
     219#endif
    215220  }
    216221
     
    229234    m_iVspFlag = 0;
    230235#endif
     236#if H_3D_SPIVMP
    231237    m_bSPIVMPFlag = false;
     238#endif
    232239    m_cMvField[0].setMvField(cZeroMv, NOT_VALID);
    233240    m_cMvField[1].setMvField(cZeroMv, NOT_VALID);
     
    238245    , Int vspFlag
    239246#endif
     247#if H_3D_SPIVMP
    240248    , Bool bSPIVMPFlag
     249#endif
    241250    )
    242251  {
     
    248257    m_iVspFlag = vspFlag;
    249258#endif
     259#if H_3D_SPIVMP
    250260    m_bSPIVMPFlag = bSPIVMPFlag;
    251   }
    252 
    253 
     261#endif
     262  }
     263 
    254264  Void getCand(Int iCount, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours
    255265#if H_3D_VSP
    256266    , Int* vspFlag
    257267#endif
     268#if H_3D_SPIVMP
    258269    , Bool* pbSPIVMPFlag
     270#endif
    259271    )
    260272  {
     
    265277    vspFlag[iCount] = m_iVspFlag;
    266278#endif
     279#if H_3D_SPIVMP
    267280    pbSPIVMPFlag[iCount] = m_bSPIVMPFlag;
     281#endif
    268282  }
    269283};
  • branches/HTM-14.1-update-dev3-ETRI/source/Lib/TLibCommon/TypeDef.h

    r1217 r1233  
    7171#define NH_3D_NBDV                        1
    7272#define NH_3D_NBDV_REF                    1
     73#define NH_3D_MLC                         1
    7374#endif
    7475
     
    712713  MD_ABOVE_LEFT         ///< MVP of above left block
    713714};
    714 #if H_3D
     715#if NH_3D_MLC
    715716enum DefaultMergCandOrder
    716717{
     
    725726  MRG_A0,               ///< Left bottom
    726727  MRG_B2,               ///< Above left
    727   MRG_IVSHIFT,          ///< Shifted IVMC of Shifted IVDC. (These are mutually exclusive)
     728  MRG_IVSHIFT,          ///< Shifted IVMC or Shifted IVDC. (These are mutually exclusive)
    728729  MRG_COL               ///< Temporal co-located
    729730};
  • branches/HTM-14.1-update-dev3-ETRI/source/Lib/TLibDecoder/TDecCu.cpp

    r1217 r1233  
    385385    UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];
    386386#else
     387#if NH_3D_MLC
     388    TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists
     389    UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];
     390#else
    387391    TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists
    388392    UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS];
     393#endif
    389394#endif
    390395    Int numValidMergeCand = 0;
     
    402407#endif
    403408
     409
    404410#if H_3D_VSP
    405411    Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
    406412    memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
     413#endif
    407414#if H_3D_SPIVMP
    408415    Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM];
     
    413420    puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartition()];
    414421#endif
     422
     423#if NH_3D_MLC
    415424    m_ppcCU[uiDepth]->initAvailableFlags();
     425#endif
    416426    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
     427#if NH_3D_MLC
    417428    m_ppcCU[uiDepth]->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours
    418429#if H_3D_SPIVMP
     
    421432      , numValidMergeCand, uiMergeIndex );
    422433
    423     m_ppcCU[uiDepth]->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours, vspFlag
     434    m_ppcCU[uiDepth]->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours
     435#if H_3D_VSP
     436      , vspFlag
     437#endif
    424438#if H_3D_SPIVMP
    425439      , bSPIVMPFlag
    426440#endif
    427441      , numValidMergeCand );
     442#endif
     443#if H_3D_VSP
    428444    pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
    429 #else
    430 #if H_3D
    431     m_ppcCU[uiDepth]->initAvailableFlags();
    432     m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
    433     m_ppcCU[uiDepth]->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
    434 #else
    435     m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
    436 #endif
    437 #endif
     445#endif
     446
    438447    pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
    439448
  • branches/HTM-14.1-update-dev3-ETRI/source/Lib/TLibDecoder/TDecEntropy.cpp

    r1200 r1233  
    236236  UInt uiNumPU = ( ePartSize == SIZE_2Nx2N ? 1 : ( ePartSize == SIZE_NxN ? 4 : 2 ) );
    237237  UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxTotalCUDepth() - uiDepth ) << 1 ) ) >> 4;
    238 #if H_3D_IV_MERGE
     238//#if H_3D_IV_MERGE
     239#if NH_3D_MLC
    239240  TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists
    240241  UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];
     
    483484        {
    484485          pcSubCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); // temporarily set.
     486
     487#if NH_3D_MLC
     488#if H_3D_VSP
     489          Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
     490          memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
     491#endif
     492#if H_3D_SPIVMP
     493          memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
     494#endif
     495          pcSubCU->initAvailableFlags();
     496#endif
    485497          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
     498#if NH_3D_MLC
     499          pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours
     500#if H_3D_SPIVMP
     501            , pcMvFieldSP, puhInterDirSP
     502#endif
     503            , numValidMergeCand );
     504          pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours
     505#if H_3D_VSP
     506            , vspFlag
     507#endif
     508#if H_3D_SPIVMP
     509            , bSPIVMPFlag
     510#endif
     511            , numValidMergeCand );
     512#if H_3D_VSP
     513          pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
     514#endif
     515#endif
    486516          pcSubCU->setPartSizeSubParts( ePartSize, 0, uiDepth ); // restore.
    487517          hasMergedCandList = true;
     
    491521      {
    492522        uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
     523
     524#if NH_3D_MLC
     525#if H_3D_VSP
     526        Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
     527        memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
     528#endif
     529#if H_3D_SPIVMP
     530        memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
     531#endif
     532        pcSubCU->initAvailableFlags();
     533#endif
    493534        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
     535#if NH_3D_MLC
     536        pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours
     537#if H_3D_SPIVMP
     538          , pcMvFieldSP, puhInterDirSP
     539#endif
     540          ,numValidMergeCand, uiMergeIndex );
     541        pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours
     542#if H_3D_VSP
     543          , vspFlag
     544#endif
     545#if H_3D_SPIVMP
     546          , bSPIVMPFlag
     547#endif
     548          ,numValidMergeCand );
     549#if H_3D_VSP
     550        pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
     551#endif
     552#endif
    494553      }
    495554
  • branches/HTM-14.1-update-dev3-ETRI/source/Lib/TLibEncoder/TEncCu.cpp

    r1217 r1233  
    17621762{
    17631763  assert( rpcTempCU->getSlice()->getSliceType() != I_SLICE );
    1764 #if H_3D_IV_MERGE
     1764#if NH_3D_MLC
    17651765  TComMvField  cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists
    17661766  UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];
     
    17971797
    17981798  rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to CTU level
     1799
    17991800#if H_3D_VSP
    18001801#if !H_3D_ARP
     
    18021803  memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
    18031804  InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
    1804   rpcTempCU->m_bAvailableFlagA1 = 0;
    1805   rpcTempCU->m_bAvailableFlagB1 = 0;
    1806   rpcTempCU->m_bAvailableFlagB0 = 0;
    1807   rpcTempCU->m_bAvailableFlagA0 = 0;
    1808   rpcTempCU->m_bAvailableFlagB2 = 0;
     1805#if NH_3D_MLC
     1806  rpcTempCU->initAvailableFlags();
     1807#endif
    18091808  rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
    1810   rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, vspFlag,inheritedVSPDisInfo, numValidMergeCand );
    1811 #endif
    1812 #else
    1813 #if H_3D
    1814   rpcTempCU->m_bAvailableFlagA1 = 0;
    1815   rpcTempCU->m_bAvailableFlagB1 = 0;
    1816   rpcTempCU->m_bAvailableFlagB0 = 0;
    1817   rpcTempCU->m_bAvailableFlagA0 = 0;
    1818   rpcTempCU->m_bAvailableFlagB2 = 0;
    1819   rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
    1820   rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand );
    1821 #else
     1809#if NH_3D_MLC
     1810  rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours
     1811#if H_3D_SPIVMP
     1812    , pcMvFieldSP, puhInterDirSP
     1813#endif
     1814    , numValidMergeCand
     1815    );
     1816
     1817  rpcTempCU->buildMCL( cMvFieldNeighbours,uhInterDirNeighbours, vspFlag
     1818#if H_3D_SPIVMP
     1819    , bSPIVMPFlag
     1820#endif
     1821    , numValidMergeCand
     1822    );
     1823#endif
     1824#endif
     1825#else
     1826#if NH_3D_MLC
     1827  rpcTempCU->initAvailableFlags();
     1828#endif
    18221829  rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand );
    1823 #endif
    1824 #endif
    1825 #if H_3D_IV_MERGE
     1830#if NH_3D_MLC
     1831  rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours
     1832#if H_3D_SPIVMP
     1833    , pcMvFieldSP, puhInterDirSP
     1834#endif
     1835    , numValidMergeCand
     1836    );
     1837#if NH_3D_MLC
     1838  rpcTempCU->buildMCL( cMvFieldNeighbours,uhInterDirNeighbours
     1839#if H_3D_SPIVMP
     1840    , bSPIVMPFlag
     1841#endif
     1842    , numValidMergeCand
     1843    );
     1844#endif
     1845#endif
     1846#endif
     1847
     1848
     1849
     1850
     1851
     1852
     1853
     1854
     1855#if NH_3D_MLC
    18261856  Int mergeCandBuffer[MRG_MAX_NUM_CANDS_MEM];
    18271857#else
     
    18311861for( UInt ui = 0; ui < rpcTempCU->getSlice()->getMaxNumMergeCand(); ++ui )
    18321862#else
     1863#if NH_3D_MLC
     1864  for( UInt ui = 0; ui < rpcTempCU->getSlice()->getMaxNumMergeCand(); ++ui )
     1865#else
    18331866  for( UInt ui = 0; ui < numValidMergeCand; ++ui )
    18341867#endif
    1835 
     1868#endif
    18361869  {
    18371870    mergeCandBuffer[ui] = 0;
     
    18871920      );
    18881921
    1889     rpcTempCU->buildMCL( cMvFieldNeighbours,uhInterDirNeighbours, vspFlag
     1922    rpcTempCU->buildMCL( cMvFieldNeighbours,uhInterDirNeighbours
     1923#if H_3D_VSP
     1924      , vspFlag
     1925#endif
    18901926#if H_3D_SPIVMP
    18911927      , bSPIVMPFlag
  • branches/HTM-14.1-update-dev3-ETRI/source/Lib/TLibEncoder/TEncSearch.cpp

    r1200 r1233  
    39253925    {
    39263926      pcCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); // temporarily set
    3927 #if H_3D
     3927#if NH_3D_MLC
    39283928      pcCU->initAvailableFlags();
    3929       pcCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand);
     3929      pcCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand );
    39303930      pcCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours
    39313931#if H_3D_SPIVMP
     
    39423942        , pbSPIVMPFlag
    39433943#endif
    3944                                         , numValidMergeCand
     3944        , numValidMergeCand
    39453945        );
    39463946#else
     
    39523952  else
    39533953  {
    3954 #if H_3D
     3954#if NH_3D_MLC
    39553955    pcCU->initAvailableFlags();
    3956     pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand);
     3956    pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
    39573957    pcCU->xGetInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours
    39583958#if H_3D_SPIVMP
     
    39693969      , pbSPIVMPFlag
    39703970#endif
    3971                                       , numValidMergeCand
     3971      , numValidMergeCand
    39723972      );
    39733973#else
Note: See TracChangeset for help on using the changeset viewer.