Changeset 708 in 3DVCSoftware
- Timestamp:
- 20 Nov 2013, 08:13:30 (11 years ago)
- Location:
- branches/HTM-8.2-dev2-ETRI
- Files:
-
- 3 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-8.2-dev2-ETRI/source/Lib/TLibCommon/TComDataCU.cpp
r696 r708 3266 3266 * false: otherwise 3267 3267 */ 3268 #if ETRIKHU_MERGE_REUSE_F0093 3269 inline Bool TComDataCU::xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount, 3270 Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag, Int& iCount3DV, InheritedVSPDisInfo* inheritedVSPDisInfo ) 3271 #else 3268 3272 inline Bool TComDataCU::xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount, 3269 3273 Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag ) 3274 #endif 3270 3275 { 3271 3276 if ( m_pcSlice->getViewIndex() == 0 || !m_pcSlice->getVPS()->getViewSynthesisPredFlag( m_pcSlice->getLayerIdInVps() ) || m_pcSlice->getIsDepth() ) … … 3282 3287 return false; 3283 3288 } 3289 3290 #if ETRIKHU_MERGE_REUSE_F0093 3291 rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV); 3292 #endif 3284 3293 3285 3294 Bool refViewAvailFlag = false; … … 3366 3375 3367 3376 #if H_3D_IV_MERGE 3377 #if ETRIKHU_MERGE_REUSE_F0093 3378 inline Bool TComDataCU::xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* ivCandDir, TComMv* ivCandMv, 3379 Int* ivCandRefIdx, Int iPosIvDC, Int* vspFlag, Int &iCount3DV, InheritedVSPDisInfo* inheritedVSPDisInfo ) 3380 #else 3368 3381 inline Bool TComDataCU::xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* ivCandDir, TComMv* ivCandMv, 3369 3382 Int* ivCandRefIdx, Int iPosIvDC, Int* vspFlag ) 3383 #endif 3370 3384 { 3371 3385 for(Int iLoop = 0; iLoop < 2; iLoop ++ ) … … 3385 3399 } 3386 3400 clipMv( cMv ); 3401 3402 #if ETRIKHU_MERGE_REUSE_F0093 3403 rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV); 3404 #endif 3405 3387 3406 abCandIsInter [ iCount ] = true; 3388 3407 puhInterDirNeighbours[ iCount ] = puhInterDirNeighbours[iFirDispCand]; … … 3404 3423 if(ivCandDir[iLoop + 2]) 3405 3424 { 3425 #if ETRIKHU_MERGE_REUSE_F0093 3426 TComMvField tmpMV[2]; 3427 UChar tmpDir = ivCandDir[iLoop + 2]; 3428 #else 3406 3429 abCandIsInter [ iCount ] = true; 3407 3430 puhInterDirNeighbours[ iCount ] = ivCandDir[iLoop + 2]; 3431 #endif 3408 3432 if( ( ivCandDir[iLoop + 2] & 1 ) == 1 ) 3409 3433 { 3434 #if ETRIKHU_MERGE_REUSE_F0093 3435 tmpMV[0].setMvField( ivCandMv[ (iLoop<<1) + 4 ], ivCandRefIdx[ (iLoop<<1) + 4 ] ); 3436 #else 3410 3437 pcMvFieldNeighbours[ iCount<<1 ].setMvField( ivCandMv[ (iLoop<<1) + 4 ], ivCandRefIdx[ (iLoop<<1) + 4 ] ); 3438 #endif 3411 3439 } 3412 3440 if( ( ivCandDir[iLoop + 2] & 2 ) == 2 ) 3413 3441 { 3442 #if ETRIKHU_MERGE_REUSE_F0093 3443 tmpMV[1].setMvField( ivCandMv[ (iLoop<<1) + 5 ], ivCandRefIdx[ (iLoop<<1) + 5 ] ); 3444 #else 3414 3445 pcMvFieldNeighbours[ (iCount<<1)+1 ].setMvField( ivCandMv[ (iLoop<<1) + 5 ], ivCandRefIdx[ (iLoop<<1) + 5 ] ); 3446 #endif 3415 3447 } 3416 3448 … … 3419 3451 if( !iLoop && ivCandDir[0] > 0) 3420 3452 { 3453 #if ETRIKHU_MERGE_REUSE_F0093 3454 if(tmpDir == puhInterDirNeighbours[0] && pcMvFieldNeighbours[0]==tmpMV[0] && pcMvFieldNeighbours[1]==tmpMV[1]) 3455 #else 3421 3456 if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[0] && pcMvFieldNeighbours[0 ]== pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[1]==pcMvFieldNeighbours[(iCount<<1)+1]) 3457 #endif 3422 3458 { 3423 3459 bRemove = true; 3460 #if !ETRIKHU_MERGE_REUSE_F0093 3424 3461 abCandIsInter [ iCount ] = false; 3425 3462 puhInterDirNeighbours[ iCount ] = 0; … … 3427 3464 pcMvFieldNeighbours [ iCount<<1 ].setMvField( cZeroMv, NOT_VALID ); 3428 3465 pcMvFieldNeighbours [(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID ); 3466 #endif 3429 3467 } 3430 3468 } 3431 3469 if(!bRemove) 3432 3470 { 3471 3472 #if ETRIKHU_MERGE_REUSE_F0093 3473 rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV); 3474 3475 abCandIsInter[ iCount ] = true; 3476 puhInterDirNeighbours[ iCount ] = ivCandDir[iLoop + 2]; 3477 if( ( ivCandDir[iLoop + 2] & 1 ) == 1 ) 3478 { 3479 pcMvFieldNeighbours[ iCount<<1 ].setMvField( ivCandMv[ (iLoop<<1) + 4 ], ivCandRefIdx[ (iLoop<<1) + 4 ] ); 3480 } 3481 if( ( ivCandDir[iLoop + 2] & 2 ) == 2 ) 3482 { 3483 pcMvFieldNeighbours[ (iCount<<1)+1 ].setMvField( ivCandMv[ (iLoop<<1) + 5 ], ivCandRefIdx[ (iLoop<<1) + 5 ] ); 3484 } 3485 #endif 3486 3433 3487 #if H_3D_NBDV 3434 3488 if(iLoop) // For IvMcShift candidate … … 3469 3523 3470 3524 #endif 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 #if ETRIKHU_MERGE_REUSE_F0093 3535 Void TComDataCU::rightShiftMergeCandList( TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* iVSPIndexTrue, InheritedVSPDisInfo* inheritedVSPDisInfo, UInt start, UInt num, Int &iCount3DV) 3536 { 3537 iCount3DV++; 3538 for (int i=num; i>0; i--) 3539 { 3540 pcMvFieldNeighbours[(start+i)<<1].setMvField(pcMvFieldNeighbours[(start+i-1)<<1].getMv(), pcMvFieldNeighbours[(start+i-1)<<1].getRefIdx()); 3541 pcMvFieldNeighbours[((start+i)<<1)+1].setMvField(pcMvFieldNeighbours[((start+i-1)<<1)+1].getMv(), pcMvFieldNeighbours[((start+i-1)<<1)+1].getRefIdx()); 3542 puhInterDirNeighbours[start+i] = puhInterDirNeighbours[start+i-1]; 3543 iVSPIndexTrue[start+i] = iVSPIndexTrue[start+i-1]; 3544 inheritedVSPDisInfo[start+i].m_acDvInfo = inheritedVSPDisInfo[start+i-1].m_acDvInfo; 3545 } 3546 TComMv cZeroMv; 3547 pcMvFieldNeighbours[start<<1].setMvField( cZeroMv, NOT_VALID ); 3548 pcMvFieldNeighbours[(start<<1)+1].setMvField( cZeroMv, NOT_VALID ); 3549 puhInterDirNeighbours[start] = 0; 3550 iVSPIndexTrue[start] = 0; 3551 inheritedVSPDisInfo[start].m_acDvInfo = m_cDefaultDisInfo; 3552 3553 return; 3554 } 3555 3556 /** Constructs a list of merging candidates 3557 * \param uiAbsPartIdx 3558 * \param uiPUIdx 3559 * \param uiDepth 3560 * \param pcMvFieldNeighbours 3561 * \param puhInterDirNeighbours 3562 * \param numValidMergeCand 3563 */ 3564 // HM 12.0 based merge candidate list construction 3565 3566 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx ) 3567 { 3568 3569 UInt uiAbsPartAddr = m_uiAbsIdxInLCU + uiAbsPartIdx; 3570 Bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ]; 3571 TComMv cZeroMv; 3572 for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ++ui ) 3573 { 3574 abCandIsInter[ui] = false; 3575 pcMvFieldNeighbours[ ( ui << 1 ) ].setMvField(cZeroMv, NOT_VALID); 3576 pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setMvField(cZeroMv, NOT_VALID); 3577 } 3578 numValidMergeCand = getSlice()->getMaxNumMergeCand(); 3579 // compute the location of the current PU 3580 Int xP, yP, nPSW, nPSH; 3581 this->getPartPosition(uiPUIdx, xP, yP, nPSW, nPSH); 3582 3583 Int iCount = 0; 3584 3585 UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB; 3586 PartSize cCurPS = getPartitionSize( uiAbsPartIdx ); 3587 deriveLeftRightTopIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT ); 3588 deriveLeftBottomIdxGeneral ( uiAbsPartIdx, uiPUIdx, uiPartIdxLB ); 3589 3590 //left 3591 UInt uiLeftPartIdx = 0; 3592 TComDataCU* pcCULeft = 0; 3593 pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB ); 3594 Bool isAvailableA1 = pcCULeft && 3595 pcCULeft->isDiffMER(xP -1, yP+nPSH-1, xP, yP) && 3596 !( uiPUIdx == 1 && (cCurPS == SIZE_Nx2N || cCurPS == SIZE_nLx2N || cCurPS == SIZE_nRx2N) ) && 3597 !pcCULeft->isIntra( uiLeftPartIdx ) ; 3598 if ( isAvailableA1 ) 3599 { 3600 m_bAvailableFlagA1 = 1; 3601 abCandIsInter[iCount] = true; 3602 // get Inter Dir 3603 puhInterDirNeighbours[iCount] = pcCULeft->getInterDir( uiLeftPartIdx ); 3604 // get Mv from Left 3605 pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 3606 if ( getSlice()->isInterB() ) 3607 { 3608 pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 3609 } 3610 3611 iCount ++; 3612 } 3613 3614 // early termination 3615 if (iCount == getSlice()->getMaxNumMergeCand()) 3616 { 3617 return; 3618 } 3619 // above 3620 UInt uiAbovePartIdx = 0; 3621 TComDataCU* pcCUAbove = 0; 3622 pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT ); 3623 Bool isAvailableB1 = pcCUAbove && 3624 pcCUAbove->isDiffMER(xP+nPSW-1, yP-1, xP, yP) && 3625 !( uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD) ) && 3626 !pcCUAbove->isIntra( uiAbovePartIdx ); 3627 if ( isAvailableB1 && (!isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAbove, uiAbovePartIdx ) ) ) 3628 { 3629 m_bAvailableFlagB1 = 1; 3630 abCandIsInter[iCount] = true; 3631 // get Inter Dir 3632 puhInterDirNeighbours[iCount] = pcCUAbove->getInterDir( uiAbovePartIdx ); 3633 // get Mv from Left 3634 pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 3635 if ( getSlice()->isInterB() ) 3636 { 3637 pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 3638 } 3639 if ( mrgCandIdx == iCount ) 3640 { 3641 return; 3642 } 3643 iCount ++; 3644 } 3645 // early termination 3646 if (iCount == getSlice()->getMaxNumMergeCand()) 3647 { 3648 return; 3649 } 3650 3651 // above right 3652 UInt uiAboveRightPartIdx = 0; 3653 TComDataCU* pcCUAboveRight = 0; 3654 pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT ); 3655 Bool isAvailableB0 = pcCUAboveRight && 3656 pcCUAboveRight->isDiffMER(xP+nPSW, yP-1, xP, yP) && 3657 !pcCUAboveRight->isIntra( uiAboveRightPartIdx ); 3658 if ( isAvailableB0 && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) ) 3659 { 3660 m_bAvailableFlagB0 = 1; 3661 abCandIsInter[iCount] = true; 3662 // get Inter Dir 3663 puhInterDirNeighbours[iCount] = pcCUAboveRight->getInterDir( uiAboveRightPartIdx ); 3664 // get Mv from Left 3665 pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 3666 if ( getSlice()->isInterB() ) 3667 { 3668 pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 3669 } 3670 if ( mrgCandIdx == iCount ) 3671 { 3672 return; 3673 } 3674 iCount ++; 3675 } 3676 // early termination 3677 if (iCount == getSlice()->getMaxNumMergeCand()) 3678 { 3679 return; 3680 } 3681 3682 //left bottom 3683 UInt uiLeftBottomPartIdx = 0; 3684 TComDataCU* pcCULeftBottom = 0; 3685 pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB ); 3686 Bool isAvailableA0 = pcCULeftBottom && 3687 pcCULeftBottom->isDiffMER(xP-1, yP+nPSH, xP, yP) && 3688 !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) ; 3689 if ( isAvailableA0 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) ) 3690 { 3691 m_bAvailableFlagA0 = 1; 3692 abCandIsInter[iCount] = true; 3693 // get Inter Dir 3694 puhInterDirNeighbours[iCount] = pcCULeftBottom->getInterDir( uiLeftBottomPartIdx ); 3695 // get Mv from Left 3696 pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 3697 if ( getSlice()->isInterB() ) 3698 { 3699 pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 3700 } 3701 if ( mrgCandIdx == iCount ) 3702 { 3703 return; 3704 } 3705 iCount ++; 3706 } 3707 // early termination 3708 if (iCount == getSlice()->getMaxNumMergeCand()) 3709 { 3710 return; 3711 } 3712 // above left 3713 if( iCount < 4 ) 3714 { 3715 UInt uiAboveLeftPartIdx = 0; 3716 TComDataCU* pcCUAboveLeft = 0; 3717 pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr ); 3718 Bool isAvailableB2 = pcCUAboveLeft && 3719 pcCUAboveLeft->isDiffMER(xP-1, yP-1, xP, yP) && 3720 !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx ); 3721 if ( isAvailableB2 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) 3722 && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) ) 3723 { 3724 m_bAvailableFlagB2 = 1; 3725 abCandIsInter[iCount] = true; 3726 // get Inter Dir 3727 puhInterDirNeighbours[iCount] = pcCUAboveLeft->getInterDir( uiAboveLeftPartIdx ); 3728 // get Mv from Left 3729 pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 3730 if ( getSlice()->isInterB() ) 3731 { 3732 pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 3733 } 3734 if ( mrgCandIdx == iCount ) 3735 { 3736 return; 3737 } 3738 iCount ++; 3739 } 3740 } 3741 // early termination 3742 if (iCount == getSlice()->getMaxNumMergeCand()) 3743 { 3744 return; 3745 } 3746 if ( getSlice()->getEnableTMVPFlag()) 3747 { 3748 //>> MTK colocated-RightBottom 3749 UInt uiPartIdxRB; 3750 3751 deriveRightBottomIdx( uiPUIdx, uiPartIdxRB ); 3752 3753 UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB]; 3754 UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); 3755 3756 TComMv cColMv; 3757 Int iRefIdx; 3758 Int uiLCUIdx = -1; 3759 3760 if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) // image boundary check 3761 { 3762 } 3763 else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) 3764 { 3765 } 3766 else 3767 { 3768 if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) && // is not at the last column of LCU 3769 ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row of LCU 3770 { 3771 uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ]; 3772 uiLCUIdx = getAddr(); 3773 } 3774 else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) // is not at the last column of LCU But is last row of LCU 3775 { 3776 uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ]; 3777 } 3778 else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU 3779 { 3780 uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ]; 3781 uiLCUIdx = getAddr() + 1; 3782 } 3783 else //is the right bottom corner of LCU 3784 { 3785 uiAbsPartAddr = 0; 3786 } 3787 } 3788 3789 iRefIdx = 0; 3790 Bool bExistMV = false; 3791 UInt uiPartIdxCenter; 3792 UInt uiCurLCUIdx = getAddr(); 3793 Int dir = 0; 3794 UInt uiArrayAddr = iCount; 3795 xDeriveCenterIdx( uiPUIdx, uiPartIdxCenter ); 3796 bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_0, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx ); 3797 if( bExistMV == false ) 3798 { 3799 bExistMV = xGetColMVP( REF_PIC_LIST_0, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx ); 3800 } 3801 if( bExistMV ) 3802 { 3803 dir |= 1; 3804 pcMvFieldNeighbours[ 2 * uiArrayAddr ].setMvField( cColMv, iRefIdx ); 3805 } 3806 3807 if ( getSlice()->isInterB() ) 3808 { 3809 #if H_3D_TMVP 3810 iRefIdx = 0; 3811 #endif 3812 bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_1, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx); 3813 if( bExistMV == false ) 3814 { 3815 bExistMV = xGetColMVP( REF_PIC_LIST_1, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx ); 3816 } 3817 if( bExistMV ) 3818 { 3819 dir |= 2; 3820 pcMvFieldNeighbours[ 2 * uiArrayAddr + 1 ].setMvField( cColMv, iRefIdx ); 3821 } 3822 } 3823 3824 if (dir != 0) 3825 { 3826 puhInterDirNeighbours[uiArrayAddr] = dir; 3827 abCandIsInter[uiArrayAddr] = true; 3828 #if H_3D_NBDV 3829 pcMvFieldNeighbours[iCount<<1 ].getMv().setIDVFlag (false); 3830 pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false); 3831 #endif 3832 if ( mrgCandIdx == iCount ) 3833 { 3834 return; 3835 } 3836 iCount++; 3837 } 3838 } 3839 // early termination 3840 if (iCount == getSlice()->getMaxNumMergeCand()) 3841 { 3842 return; 3843 } 3844 UInt uiArrayAddr = iCount; 3845 UInt uiCutoff = uiArrayAddr; 3846 3847 if ( getSlice()->isInterB() && iCount<5) // JCT3V-F0129 by Qualcomm 3848 { 3849 UInt uiPriorityList0[12] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3}; 3850 UInt uiPriorityList1[12] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2}; 3851 3852 for (Int idx=0; idx<uiCutoff*(uiCutoff-1) && uiArrayAddr!= getSlice()->getMaxNumMergeCand(); idx++) 3853 { 3854 Int i = uiPriorityList0[idx]; Int j = uiPriorityList1[idx]; 3855 if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2)) 3856 { 3857 abCandIsInter[uiArrayAddr] = true; 3858 puhInterDirNeighbours[uiArrayAddr] = 3; 3859 3860 // get Mv from cand[i] and cand[j] 3861 pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(pcMvFieldNeighbours[i<<1].getMv(), pcMvFieldNeighbours[i<<1].getRefIdx()); 3862 pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(pcMvFieldNeighbours[(j<<1)+1].getMv(), pcMvFieldNeighbours[(j<<1)+1].getRefIdx()); 3863 3864 Int iRefPOCL0 = m_pcSlice->getRefPOC( REF_PIC_LIST_0, pcMvFieldNeighbours[(uiArrayAddr<<1)].getRefIdx() ); 3865 Int iRefPOCL1 = m_pcSlice->getRefPOC( REF_PIC_LIST_1, pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getRefIdx() ); 3866 if (iRefPOCL0 == iRefPOCL1 && pcMvFieldNeighbours[(uiArrayAddr<<1)].getMv() == pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getMv()) 3867 { 3868 abCandIsInter[uiArrayAddr] = false; 3869 } 3870 else 3871 { 3872 uiArrayAddr++; 3873 } 3874 } 3875 } 3876 } 3877 // early termination 3878 if (uiArrayAddr == getSlice()->getMaxNumMergeCand()) 3879 { 3880 return; 3881 } 3882 3883 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); 3884 Int r = 0; 3885 Int refcnt = 0; 3886 while (uiArrayAddr < getSlice()->getMaxNumMergeCand()) 3887 { 3888 abCandIsInter[uiArrayAddr] = true; 3889 puhInterDirNeighbours[uiArrayAddr] = 1; 3890 pcMvFieldNeighbours[uiArrayAddr << 1].setMvField( TComMv(0, 0), r); 3891 3892 if ( getSlice()->isInterB() ) 3893 { 3894 puhInterDirNeighbours[uiArrayAddr] = 3; 3895 pcMvFieldNeighbours[(uiArrayAddr << 1) + 1].setMvField(TComMv(0, 0), r); 3896 } 3897 uiArrayAddr++; 3898 if ( refcnt == iNumRefIdx - 1 ) 3899 { 3900 r = 0; 3901 } 3902 else 3903 { 3904 ++r; 3905 ++refcnt; 3906 } 3907 } 3908 3909 numValidMergeCand = uiArrayAddr; 3910 } 3911 3912 3913 3914 /** Constructs a list of merging candidates 3915 * \param uiAbsPartIdx 3916 * \param uiPUIdx 3917 * \param uiDepth 3918 * \param pcMvFieldNeighbours 3919 * \param puhInterDirNeighbours 3920 * \param numValidMergeCand 3921 */ 3922 #if ETRIKHU_MERGE_REUSE_F0093 3923 Void TComDataCU::xGetInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours 3924 #else 3925 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours 3926 #endif 3927 #if H_3D_VSP 3928 , Int* vspFlag 3929 , InheritedVSPDisInfo* inheritedVSPDisInfo 3930 #endif 3931 , Int& numValidMergeCand, Int mrgCandIdx 3932 ) 3933 { 3934 UInt uiAbsPartAddr = m_uiAbsIdxInLCU + uiAbsPartIdx; 3935 #if H_3D_IV_MERGE 3936 //////////////////////////// 3937 //////// INIT LISTS //////// 3938 //////////////////////////// 3939 TComMv cZeroMv; 3940 Bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ]; 3941 #else 3942 Bool abCandIsInter[ MRG_MAX_NUM_CANDS ]; 3943 #endif 3944 #if ETRIKHU_MERGE_REUSE_F0093 3945 TComMvField tmpMV[2]; 3946 UChar tmpDir; 3947 3948 ////////////////////////////////// 3949 //////// GET DISPARITIES //////// 3950 ////////////////////////////////// 3951 DisInfo cDisInfo = getDvInfo(uiAbsPartIdx); 3952 for(Int i = 0; i < MRG_MAX_NUM_CANDS_MEM; i++) 3953 { 3954 inheritedVSPDisInfo[i].m_acDvInfo = cDisInfo; // To prevent run-time error, this code must be executed always for merging process. 3955 } 3956 m_cDefaultDisInfo = cDisInfo; 3957 3958 if (!( getSlice()->getIsDepth() || getSlice()->getViewIndex()>0)) // current slice is not both dependent view or depth 3959 { 3960 return; 3961 } 3962 #else 3963 for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ++ui ) 3964 { 3965 abCandIsInter[ui] = false; 3966 #if H_3D_IV_MERGE 3967 pcMvFieldNeighbours[ ( ui << 1 ) ].setMvField(cZeroMv, NOT_VALID); 3968 pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setMvField(cZeroMv, NOT_VALID); 3969 #else 3970 pcMvFieldNeighbours[ ( ui << 1 ) ].setRefIdx(NOT_VALID); 3971 pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setRefIdx(NOT_VALID); 3972 #endif 3973 } 3974 #endif 3975 3976 numValidMergeCand = getSlice()->getMaxNumMergeCand(); 3977 #if H_3D 3978 ////////////////////////////////// 3979 //////// DERIVE LOCATIONS //////// 3980 ////////////////////////////////// 3981 #endif 3982 // compute the location of the current PU 3983 Int xP, yP, nPSW, nPSH; 3984 this->getPartPosition(uiPUIdx, xP, yP, nPSW, nPSH); 3985 3986 Int iCount = 0; 3987 3988 UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB; 3989 #if !ETRIKHU_MERGE_REUSE_F0093 3990 PartSize cCurPS = getPartitionSize( uiAbsPartIdx ); 3991 #endif 3992 deriveLeftRightTopIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT ); 3993 deriveLeftBottomIdxGeneral ( uiAbsPartIdx, uiPUIdx, uiPartIdxLB ); 3994 #if SEC_MPI_ENABLING_MERGE_F0150 3995 Bool bMPIFlag = getSlice()->getVPS()->getMPIFlag( getSlice()->getLayerIdInVps() ); 3996 #endif 3997 #if QC_DEPTH_IV_MRG_F0125 3998 Bool bIsDepth = getSlice()->getIsDepth(); 3999 Bool bDepthIPMCAvai = false; 4000 #endif 4001 4002 #if LGE_SHARP_VSP_INHERIT_F0104 4003 #if H_3D_IC 4004 Bool bICFlag = getICFlag(uiAbsPartIdx); 4005 #endif 4006 #if H_3D_ARP 4007 Bool bARPFlag = getARPW(uiAbsPartIdx)>0 ? true : false; 4008 #endif 4009 #endif 4010 4011 #if ETRIKHU_MERGE_REUSE_F0093 4012 Int iPosLeftAbove[2] = {-1, -1}; 4013 4014 Int iCountHEVC = 0; 4015 Int iCount3DV = 0; 4016 Int numA1B1B0 = 0; 4017 Int numA0B2 = 0; 4018 4019 #if H_3D_NBDV 4020 for(Int i = 0; i < MRG_MAX_NUM_CANDS_MEM; i++) 4021 { 4022 pcMvFieldNeighbours[i<<1 ].getMv().setIDVFlag (false); 4023 pcMvFieldNeighbours[(i<<1)+1].getMv().setIDVFlag (false); 4024 } 4025 #endif 4026 4027 //left 4028 UInt uiLeftPartIdx = 0; 4029 TComDataCU* pcCULeft = 0; 4030 pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB ); 4031 if (getAvailableFlagA1()) 4032 { 4033 iPosLeftAbove[0] = numA1B1B0; 4034 #if H_3D_VSP 4035 if (pcCULeft->getVSPFlag(uiLeftPartIdx) == 1 4036 #if LGE_SHARP_VSP_INHERIT_F0104 4037 #if H_3D_IC 4038 && !bICFlag 4039 #endif 4040 #if H_3D_ARP 4041 && !bARPFlag 4042 #endif 4043 #endif 4044 ) 4045 { 4046 vspFlag[numA1B1B0] = 1; 4047 #if !MTK_VSP_SIMPLIFICATION_F0111 4048 xInheritVSPDisInfo(pcCULeft,uiLeftPartIdx,iCount,inheritedVSPDisInfo); 4049 #endif 4050 } 4051 #endif 4052 numA1B1B0++; 4053 } 4054 4055 // above 4056 UInt uiAbovePartIdx = 0; 4057 TComDataCU* pcCUAbove = 0; 4058 pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT ); 4059 if ( getAvailableFlagB1()) 4060 { 4061 iPosLeftAbove[1] = numA1B1B0; 4062 #if H_3D_VSP 4063 if (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1 4064 #if LGE_SHARP_VSP_INHERIT_F0104 4065 #if H_3D_IC 4066 && !bICFlag 4067 #endif 4068 #if H_3D_ARP 4069 && !bARPFlag 4070 #endif 4071 #endif 4072 ) 4073 { 4074 vspFlag[numA1B1B0] = 1; 4075 #if !MTK_VSP_SIMPLIFICATION_F0111 4076 xInheritVSPDisInfo(pcCUAbove,uiAbovePartIdx,iCount,inheritedVSPDisInfo); 4077 #endif 4078 } 4079 #endif 4080 4081 numA1B1B0++; 4082 } 4083 4084 // above right 4085 UInt uiAboveRightPartIdx = 0; 4086 TComDataCU* pcCUAboveRight = 0; 4087 pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT ); 4088 if ( getAvailableFlagB0()) 4089 { 4090 #if H_3D_VSP 4091 if (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1 4092 #if LGE_SHARP_VSP_INHERIT_F0104 4093 #if H_3D_IC 4094 && !bICFlag 4095 #endif 4096 #if H_3D_ARP 4097 && !bARPFlag 4098 #endif 4099 #endif 4100 ) 4101 { 4102 vspFlag[numA1B1B0] = 1; 4103 #if !MTK_VSP_SIMPLIFICATION_F0111 4104 xInheritVSPDisInfo(pcCUAboveRight,uiAboveRightPartIdx,iCount,inheritedVSPDisInfo); 4105 #endif 4106 } 4107 #endif 4108 numA1B1B0++; 4109 } 4110 4111 // left bottom 4112 UInt uiLeftBottomPartIdx = 0; 4113 TComDataCU* pcCULeftBottom = getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB ); 4114 if ( getAvailableFlagA0()) 4115 { 4116 #if H_3D_VSP 4117 if (pcCULeftBottom->getVSPFlag(uiLeftBottomPartIdx) == 1 4118 #if LGE_SHARP_VSP_INHERIT_F0104 4119 #if H_3D_IC 4120 && !bICFlag 4121 #endif 4122 #if H_3D_ARP 4123 && !bARPFlag 4124 #endif 4125 #endif 4126 ) 4127 { 4128 vspFlag[numA1B1B0] = 1; 4129 #if !MTK_VSP_SIMPLIFICATION_F0111 4130 xInheritVSPDisInfo(pcCULeftBottom,uiLeftBottomPartIdx,iCount,inheritedVSPDisInfo); 4131 #endif 4132 } 4133 #endif 4134 iCountHEVC++; 4135 numA0B2++; 4136 } 4137 4138 // above left 4139 UInt uiAboveLeftPartIdx = 0; 4140 TComDataCU* pcCUAboveLeft = 0; 4141 pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr ); 4142 if (getAvailableFlagB2()) 4143 { 4144 #if H_3D_VSP 4145 if (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1 4146 #if LGE_SHARP_VSP_INHERIT_F0104 4147 #if H_3D_IC 4148 && !bICFlag 4149 #endif 4150 #if H_3D_ARP 4151 && !bARPFlag 4152 #endif 4153 #endif 4154 ) 4155 { 4156 vspFlag[numA1B1B0+iCountHEVC] = 1; 4157 #if !MTK_VSP_SIMPLIFICATION_F0111 4158 xInheritVSPDisInfo(pcCUAboveLeft,uiAboveLeftPartIdx,iCount,inheritedVSPDisInfo); 4159 #endif 4160 } 4161 #endif 4162 iCountHEVC++; 4163 numA0B2++; 4164 } 4165 4166 iCountHEVC = numValidMergeCand; 4167 #endif 4168 4169 4170 #if H_3D_IV_MERGE 4171 4172 ///////////////////////////////////////////// 4173 //////// TEXTURE MERGE CANDIDATE (T) //////// 4174 ///////////////////////////////////////////// 4175 4176 #if SEC_MPI_ENABLING_MERGE_F0150 4177 if( bMPIFlag) 4178 #else 4179 if( m_pcSlice->getIsDepth()) 4180 #endif 4181 { 4182 UInt uiPartIdxCenter; 4183 xDeriveCenterIdx( uiPUIdx, uiPartIdxCenter ); 4184 4185 #if ETRIKHU_MERGE_REUSE_F0093 4186 tmpMV[0].setMvField( cZeroMv, NOT_VALID ); 4187 tmpMV[1].setMvField( cZeroMv, NOT_VALID ); 4188 Int tRef[2]={-1, -1}; 4189 #endif 4190 4191 #if H_3D_FCO 4192 TComPic * pcTexturePic = m_pcSlice->getTexturePic(); 4193 TComDataCU *pcTextureCU = 0; 4194 if ( pcTexturePic ) 4195 pcTextureCU = pcTexturePic->getCU( getAddr() ); 4196 #else 4197 TComDataCU *pcTextureCU = m_pcSlice->getTexturePic()->getCU( getAddr() ); 4198 #endif 4199 4200 #if H_3D_FCO 4201 if ( pcTextureCU && pcTexturePic->getReconMark() && !pcTextureCU->isIntra( uiPartIdxCenter ) ) 4202 #else 4203 if ( pcTextureCU && !pcTextureCU->isIntra( uiPartIdxCenter ) ) 4204 #endif 4205 { 4206 #if ETRIKHU_MERGE_REUSE_F0093 4207 pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_0, tmpMV[0] ); 4208 tRef[0] = getPic()->isTextRefValid( REF_PIC_LIST_0, tmpMV[0].getRefIdx() ); 4209 if( (tmpMV[0].getRefIdx()>=0) && ( tRef[0] >= 0 ) ) 4210 { 4211 TComMv cMvPred = tmpMV[0].getMv(); 4212 const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) ); 4213 cMvPred+=cAdd; 4214 cMvPred>>=2; 4215 clipMv(cMvPred); 4216 tmpMV[0].setMvField(cMvPred,tRef[0]); 4217 } 4218 if ( getSlice()->isInterB() ) 4219 { 4220 pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_1, tmpMV[1] ); 4221 tRef[1] = getPic()->isTextRefValid( REF_PIC_LIST_1, tmpMV[1].getRefIdx() ); 4222 if( (tmpMV[1].getRefIdx()>=0) && ( tRef[1] >= 0) ) 4223 { 4224 TComMv cMvPred = tmpMV[1].getMv(); 4225 const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) ); 4226 cMvPred+=cAdd; 4227 cMvPred>>=2; 4228 clipMv(cMvPred); 4229 tmpMV[1].setMvField(cMvPred,tRef[1]); 4230 } 4231 } 4232 4233 tmpDir = 0; 4234 if( (tmpMV[0].getRefIdx()>=0) && ( tRef[0] >= 0 ) ) 4235 { 4236 tmpDir += ((tmpMV[0].getRefIdx()>=0)?1:0); 4237 } 4238 if( (tmpMV[1].getRefIdx()>=0) && ( tRef[1] >= 0) ) 4239 { 4240 tmpDir += ((tmpMV[1].getRefIdx()>=0)?2:0); 4241 } 4242 4243 if( tmpDir != 0 ) 4244 { 4245 Int iCnloop = 0; 4246 Bool bRemoveSpa = false; //pruning 4247 4248 for(Int i = 0; i < 2; i ++) 4249 { 4250 iCnloop = iPosLeftAbove[i]; 4251 if ( iCnloop == -1 ) 4252 { 4253 continue; 4254 } 4255 if(tmpDir == puhInterDirNeighbours[iCnloop] && tmpMV[0]==pcMvFieldNeighbours[(iCnloop<<1)] && tmpMV[1]==pcMvFieldNeighbours[(iCnloop<<1)+1]) 4256 { 4257 bRemoveSpa = true; 4258 break; 4259 } 4260 } 4261 4262 if (!bRemoveSpa) 4263 { 4264 rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, 5-iCount, iCount3DV); 4265 } 4266 else 4267 { 4268 rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (iCnloop-iCount), iCount3DV); 4269 if (iCnloop<numA1B1B0) 4270 { 4271 numA1B1B0--; 4272 } 4273 iCountHEVC--; 4274 4275 if (iPosLeftAbove[0] != -1) 4276 { 4277 if (iCnloop == iPosLeftAbove[0]) 4278 { 4279 iPosLeftAbove[0] = -1; 4280 } 4281 else 4282 { 4283 iPosLeftAbove[0]++; 4284 } 4285 } 4286 if (iPosLeftAbove[1] != -1) 4287 { 4288 if (iCnloop == iPosLeftAbove[1]) 4289 { 4290 iPosLeftAbove[1] = -1; 4291 } 4292 else 4293 { 4294 if (iCnloop > iPosLeftAbove[1]) 4295 { 4296 iPosLeftAbove[1]++; 4297 } 4298 } 4299 } 4300 } 4301 4302 if( (tmpMV[0].getRefIdx()>=0) && ( tRef[0] >= 0 ) ) 4303 { 4304 pcMvFieldNeighbours[iCount<<1].setMvField(tmpMV[0].getMv(), tRef[0]); 4305 } 4306 if ( getSlice()->isInterB()) 4307 { 4308 if( (tmpMV[1].getRefIdx()>=0) && ( tRef[1] >= 0) ) 4309 { 4310 pcMvFieldNeighbours[(iCount<<1)+1].setMvField(tmpMV[1].getMv(), tRef[1]); 4311 } 4312 } 4313 puhInterDirNeighbours[iCount] = tmpDir; 4314 4315 if ( mrgCandIdx == iCount ) 4316 { 4317 return; 4318 } 4319 iCount ++; 4320 4321 #else 4322 pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 4323 Int iValidDepRef = getPic()->isTextRefValid( REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1].getRefIdx() ); 4324 if( (pcMvFieldNeighbours[iCount<<1].getRefIdx()>=0) && ( iValidDepRef >= 0 ) ) 4325 { 4326 TComMv cMvPred = pcMvFieldNeighbours[iCount<<1].getMv(); 4327 const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) ); 4328 cMvPred+=cAdd; 4329 cMvPred>>=2; 4330 clipMv(cMvPred); 4331 pcMvFieldNeighbours[iCount<<1].setMvField(cMvPred,iValidDepRef); 4332 } 4333 if ( getSlice()->isInterB() ) 4334 { 4335 pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 4336 iValidDepRef = getPic()->isTextRefValid( REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx() ); 4337 if( (pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx()>=0) && ( iValidDepRef >= 0) ) 4338 { 4339 TComMv cMvPred = pcMvFieldNeighbours[(iCount<<1)+1].getMv(); 4340 const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) ); 4341 cMvPred+=cAdd; 4342 cMvPred>>=2; 4343 clipMv(cMvPred); 4344 pcMvFieldNeighbours[(iCount<<1)+1].setMvField(cMvPred,iValidDepRef); 4345 } 4346 } 4347 puhInterDirNeighbours[iCount] = (pcMvFieldNeighbours[iCount<<1].getRefIdx()>=0)?1:0; 4348 puhInterDirNeighbours[iCount] += (pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx()>=0)?2:0; 4349 if( puhInterDirNeighbours[iCount] != 0 ) 4350 { 4351 abCandIsInter[iCount] = true; 4352 if ( mrgCandIdx == iCount ) 4353 { 4354 return; 4355 } 4356 iCount ++; 4357 } 4358 #endif 4359 } 4360 } 4361 } 4362 4363 4364 #if !ETRIKHU_MERGE_REUSE_F0093 4365 ////////////////////////////////// 4366 //////// GET DISPARITIES //////// 4367 ////////////////////////////////// 4368 4369 DisInfo cDisInfo = getDvInfo(uiAbsPartIdx); 4370 for(Int i = 0; i < MRG_MAX_NUM_CANDS_MEM; i++) 4371 { 4372 inheritedVSPDisInfo[i].m_acDvInfo = cDisInfo; 4373 } 4374 #endif 4375 4376 ///////////////////////////////////////////////////////////////// 4377 //////// DERIVE IvMC, IvMCShift,IvDCShift, IvDC Candidates ///// 4378 ///////////////////////////////////////////////////////////////// 4379 4380 Int posIvDC = -1; 4381 #if !ETRIKHU_MERGE_REUSE_F0093 4382 Bool bLeftAvai = false; 4383 Int iPosLeftAbove[2] = {-1, -1}; 4384 #endif 4385 4386 // { IvMCL0, IvMCL1, IvDCL0, IvDCL1, IvMCL0Shift, IvMCL1Shift, IvDCL0Shift, IvDCL1Shift }; 4387 // An enumerator would be appropriate here! 4388 TComMv ivCandMv [8]; 4389 Int ivCandRefIdx[8] = {-1, -1, -1, -1, -1, -1, -1, -1}; 4390 4391 // { IvMC, IvDC, IvMCShift, IvDCShift }; 4392 Int ivCandDir [4] = {0, 0, 0, 0}; 4393 4394 Bool ivMvPredFlag = getSlice()->getVPS()->getIvMvPredFlag( getSlice()->getLayerIdInVps() ); 4395 4396 if ( ivMvPredFlag ) 4397 { 4398 getInterViewMergeCands(uiPUIdx, ivCandRefIdx, ivCandMv, &cDisInfo, ivCandDir 4399 #if QC_DEPTH_IV_MRG_F0125 4400 , bIsDepth 4401 #endif 4402 ); 4403 } 4404 4405 /////////////////////////////////////////////// 4406 //////// INTER VIEW MOTION COMP(IvMC) ///////// 4407 /////////////////////////////////////////////// 4408 4409 if( ivCandDir[0] ) 4410 { 4411 #if ETRIKHU_MERGE_REUSE_F0093 4412 tmpMV[0].setMvField( cZeroMv, NOT_VALID ); 4413 tmpMV[1].setMvField( cZeroMv, NOT_VALID ); 4414 4415 if( ( ivCandDir[0] & 1 ) == 1 ) 4416 { 4417 tmpMV[0].setMvField( ivCandMv[ 0 ], ivCandRefIdx[ 0 ] ); 4418 } 4419 if( ( ivCandDir[0] & 2 ) == 2 ) 4420 { 4421 tmpMV[1].setMvField( ivCandMv[ 1 ], ivCandRefIdx[ 1 ] ); 4422 } 4423 4424 Bool bRemoveSpa = false; //pruning 4425 Bool bIvMC = false; 4426 Int iCnloop=0; 4427 4428 for(Int i = 0; i < 2; i ++) 4429 { 4430 iCnloop = iPosLeftAbove[i]; 4431 if ( iCnloop == -1 ) 4432 { 4433 continue; 4434 } 4435 if(ivCandDir[0] == puhInterDirNeighbours[iCnloop] && tmpMV[0]==pcMvFieldNeighbours[(iCnloop<<1)] && tmpMV[1]==pcMvFieldNeighbours[(iCnloop<<1)+1]) 4436 { 4437 bRemoveSpa = true; 4438 break; 4439 } 4440 } 4441 #if QC_DEPTH_IV_MRG_F0125 4442 if ( bIsDepth && !bRemoveSpa) 4443 { 4444 iCnloop = iCount-1; 4445 for(; iCnloop >= 0; iCnloop --) 4446 { 4447 if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1]) 4448 { 4449 bRemoveSpa = true; 4450 break; 4451 } 4452 } 4453 if(!bRemoveSpa) 4454 { 4455 bDepthIPMCAvai = true; 4456 } 4457 } 4458 #endif 4459 4460 if (!bRemoveSpa) 4461 { 4462 bIvMC = true; 4463 rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV); 4464 4465 if (iPosLeftAbove[0] != -1) 4466 { 4467 iPosLeftAbove[0]++; 4468 } 4469 if (iPosLeftAbove[1] != -1) 4470 { 4471 iPosLeftAbove[1]++; 4472 } 4473 } 4474 else if (bRemoveSpa && !bIsDepth) 4475 { 4476 bIvMC = true; 4477 rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (iCnloop-iCount), iCount3DV); 4478 4479 if (iCnloop<numA1B1B0) 4480 { 4481 numA1B1B0--; 4482 } 4483 iCountHEVC--; 4484 4485 if (iPosLeftAbove[0] != -1) 4486 { 4487 if (iCnloop == iPosLeftAbove[0]) 4488 { 4489 iPosLeftAbove[0] = -1; 4490 } 4491 else 4492 { 4493 iPosLeftAbove[0]++; 4494 } 4495 } 4496 if (iPosLeftAbove[1] != -1) 4497 { 4498 if (iCnloop == iPosLeftAbove[1]) 4499 { 4500 iPosLeftAbove[1] = -1; 4501 } 4502 else 4503 { 4504 if (iCnloop > iPosLeftAbove[1]) 4505 { 4506 iPosLeftAbove[1]++; 4507 } 4508 } 4509 } 4510 } 4511 4512 if (bIvMC) 4513 { 4514 if( ( ivCandDir[0] & 1 ) == 1 ) 4515 { 4516 pcMvFieldNeighbours[iCount<<1].setMvField( ivCandMv[ 0 ], ivCandRefIdx[ 0 ] ); 4517 } 4518 if( ( ivCandDir[0] & 2 ) == 2 ) 4519 { 4520 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( ivCandMv[ 1 ], ivCandRefIdx[ 1 ] ); 4521 } 4522 4523 puhInterDirNeighbours[ iCount ] = ivCandDir[0]; 4524 4525 #if QC_DEPTH_IV_MRG_F0125 4526 if ( bDepthIPMCAvai || !bIsDepth ) 4527 { 4528 #endif 4529 if ( mrgCandIdx == iCount ) 4530 { 4531 return; 4532 } 4533 iCount ++; 4534 #if QC_DEPTH_IV_MRG_F0125 4535 } 4536 #endif 4537 } 4538 #else 4539 abCandIsInter [ iCount ] = true; 4540 puhInterDirNeighbours[ iCount ] = ivCandDir[0]; 4541 4542 if( ( ivCandDir[0] & 1 ) == 1 ) 4543 { 4544 pcMvFieldNeighbours[ iCount<<1 ].setMvField( ivCandMv[ 0 ], ivCandRefIdx[ 0 ] ); 4545 } 4546 if( ( ivCandDir[0] & 2 ) == 2 ) 4547 { 4548 pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( ivCandMv[ 1 ], ivCandRefIdx[ 1 ] ); 4549 } 4550 #if QC_DEPTH_IV_MRG_F0125 4551 if ( bIsDepth ) 4552 { 4553 Bool bRemoveSpa = false; 4554 Int iCnloop = iCount-1; 4555 for(; iCnloop >= 0; iCnloop --) 4556 { 4557 if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1]) 4558 { 4559 bRemoveSpa = true; 4560 abCandIsInter [ iCount ] = false; 4561 4562 puhInterDirNeighbours[iCount] = 0; 4563 pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID ); 4564 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID ); 4565 break; 4566 } 4567 } 4568 if(!bRemoveSpa) 4569 { 4570 bDepthIPMCAvai = true; 4571 } 4572 } 4573 if ( bDepthIPMCAvai || !bIsDepth ) 4574 { 4575 #endif 4576 if ( mrgCandIdx == iCount ) 4577 { 4578 return; 4579 } 4580 iCount ++; 4581 #if QC_DEPTH_IV_MRG_F0125 4582 } 4583 #endif 4584 4585 #endif 4586 4587 } 4588 4589 // early termination 4590 if (iCount == getSlice()->getMaxNumMergeCand()) 4591 { 4592 return; 4593 } 4594 #endif 4595 4596 4597 4598 4599 4600 #if ETRIKHU_MERGE_REUSE_F0093 4601 iCount += numA1B1B0; 4602 #else 4603 #if H_3D 4604 //////////////////////////// 4605 //////// LEFT (A1) ///////// 4606 //////////////////////////// 4607 #endif 4608 //left 4609 UInt uiLeftPartIdx = 0; 4610 TComDataCU* pcCULeft = 0; 4611 pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB ); 4612 Bool isAvailableA1 = pcCULeft && 4613 pcCULeft->isDiffMER(xP -1, yP+nPSH-1, xP, yP) && 4614 !( uiPUIdx == 1 && (cCurPS == SIZE_Nx2N || cCurPS == SIZE_nLx2N || cCurPS == SIZE_nRx2N) ) && 4615 !pcCULeft->isIntra( uiLeftPartIdx ) ; 4616 if ( isAvailableA1 ) 4617 { 4618 abCandIsInter[iCount] = true; 4619 // get Inter Dir 4620 puhInterDirNeighbours[iCount] = pcCULeft->getInterDir( uiLeftPartIdx ); 4621 // get Mv from Left 4622 pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 4623 if ( getSlice()->isInterB() ) 4624 { 4625 pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 4626 } 4627 #if H_3D_IV_MERGE 4628 Bool bRemoveSpa = false; //pruning to inter-view candidates 4629 #if QC_DEPTH_IV_MRG_F0125 4630 Int iCnloop = bDepthIPMCAvai ? (iCount-2): (iCount-1); 4631 #else 4632 Int iCnloop = iCount - 1; 4633 #endif 4634 for(; iCnloop >= 0; iCnloop --) 4635 { 4636 if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1]) 4637 { 4638 bRemoveSpa = true; 4639 abCandIsInter [ iCount ] = false; 4640 4641 //reset to the default value for MC 4642 puhInterDirNeighbours[iCount] = 0; 4643 pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID ); 4644 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID ); 4645 break; 4646 } 4647 } 4648 if(!bRemoveSpa) 4649 { 4650 bLeftAvai = true; 4651 iPosLeftAbove[0] = iCount; 4652 #if H_3D_NBDV 4653 pcMvFieldNeighbours[iCount<<1 ].getMv().setIDVFlag (false); 4654 pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false); 4655 #endif 4656 #if H_3D_VSP 4657 if (pcCULeft->getVSPFlag(uiLeftPartIdx) == 1 4658 #if LGE_SHARP_VSP_INHERIT_F0104 4659 #if H_3D_IC 4660 && !bICFlag 4661 #endif 4662 #if H_3D_ARP 4663 && !bARPFlag 4664 #endif 4665 #endif 4666 ) 4667 { 4668 vspFlag[iCount] = 1; 4669 #if !MTK_VSP_SIMPLIFICATION_F0111 4670 xInheritVSPDisInfo(pcCULeft,uiLeftPartIdx,iCount,inheritedVSPDisInfo); 4671 #endif 4672 } 4673 #endif 4674 if ( mrgCandIdx == iCount ) 4675 { 4676 return; 4677 } 4678 iCount ++; 4679 } 4680 #else // H_3D_IV_MERGE 4681 if ( mrgCandIdx == iCount ) 4682 { 4683 return; 4684 } 4685 iCount ++; 4686 #endif // H_3D_IV_MERGE 4687 } 4688 4689 // early termination 4690 if (iCount == getSlice()->getMaxNumMergeCand()) 4691 { 4692 return; 4693 } 4694 #if H_3D 4695 //////////////////////////// 4696 //////// ABOVE (B1) //////// 4697 //////////////////////////// 4698 #endif 4699 // above 4700 UInt uiAbovePartIdx = 0; 4701 TComDataCU* pcCUAbove = 0; 4702 pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT ); 4703 Bool isAvailableB1 = pcCUAbove && 4704 pcCUAbove->isDiffMER(xP+nPSW-1, yP-1, xP, yP) && 4705 !( uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD) ) && 4706 !pcCUAbove->isIntra( uiAbovePartIdx ); 4707 if ( isAvailableB1 && (!isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAbove, uiAbovePartIdx ) ) ) 4708 { 4709 abCandIsInter[iCount] = true; 4710 // get Inter Dir 4711 puhInterDirNeighbours[iCount] = pcCUAbove->getInterDir( uiAbovePartIdx ); 4712 // get Mv from Left 4713 pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 4714 if ( getSlice()->isInterB() ) 4715 { 4716 pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 4717 } 4718 #if H_3D_IV_MERGE 4719 Bool bRemoveSpa = false; //pruning to inter-view candidates 4720 #if QC_DEPTH_IV_MRG_F0125 4721 Int iCnloop; 4722 if( bIsDepth ) 4723 iCnloop = (bLeftAvai && bDepthIPMCAvai) ? (iCount-3) : ((bLeftAvai || bDepthIPMCAvai) ? (iCount-2): (iCount-1)); 4724 else 4725 iCnloop = bLeftAvai? (iCount-2): (iCount-1); 4726 #else 4727 Int iCnloop = bLeftAvai? (iCount-2): (iCount-1); 4728 #endif 4729 for(; iCnloop >= 0; iCnloop --) 4730 { 4731 if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1]) 4732 { 4733 bRemoveSpa = true; 4734 abCandIsInter [ iCount ] = false; 4735 4736 //reset to the default value for MC 4737 puhInterDirNeighbours[iCount] = 0; 4738 4739 pcMvFieldNeighbours[iCount<<1] .setMvField( cZeroMv, NOT_VALID ); 4740 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID ); 4741 break; 4742 } 4743 } 4744 4745 if(!bRemoveSpa) 4746 { 4747 iPosLeftAbove[1] = iCount; 4748 #if H_3D_NBDV 4749 pcMvFieldNeighbours[iCount<<1 ].getMv().setIDVFlag (false); 4750 pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false); 4751 #endif 4752 #if H_3D_VSP 4753 #if MTK_VSP_SIMPLIFICATION_F0111 4754 if ( ( ( getAddr() - pcCUAbove->getAddr() ) == 0) && (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1) 4755 #if LGE_SHARP_VSP_INHERIT_F0104 4756 #if H_3D_IC 4757 && !bICFlag 4758 #endif 4759 #if H_3D_ARP 4760 && !bARPFlag 4761 #endif 4762 #endif 4763 ) 4764 #else 4765 if (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1 4766 #if LGE_SHARP_VSP_INHERIT_F0104 4767 #if H_3D_IC 4768 && !bICFlag 4769 #endif 4770 #if H_3D_ARP 4771 && !bARPFlag 4772 #endif 4773 #endif 4774 ) 4775 #endif 4776 { 4777 4778 vspFlag[iCount] = 1; 4779 #if !MTK_VSP_SIMPLIFICATION_F0111 4780 xInheritVSPDisInfo(pcCUAbove,uiAbovePartIdx,iCount,inheritedVSPDisInfo); 4781 #endif 4782 } 4783 #endif 4784 if ( mrgCandIdx == iCount ) 4785 { 4786 return; 4787 } 4788 iCount ++; 4789 } 4790 #else // H_3D_IV_MERGE 4791 if ( mrgCandIdx == iCount ) 4792 { 4793 return; 4794 } 4795 iCount ++; 4796 #endif // H_3D_IV_MERGE 4797 } 4798 // early termination 4799 if (iCount == getSlice()->getMaxNumMergeCand()) 4800 { 4801 return; 4802 } 4803 4804 #if H_3D 4805 ////////////////////////////////// 4806 //////// ABOVE RIGHT (B0) //////// 4807 ////////////////////////////////// 4808 #endif 4809 4810 // above right 4811 UInt uiAboveRightPartIdx = 0; 4812 TComDataCU* pcCUAboveRight = 0; 4813 pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT ); 4814 Bool isAvailableB0 = pcCUAboveRight && 4815 pcCUAboveRight->isDiffMER(xP+nPSW, yP-1, xP, yP) && 4816 !pcCUAboveRight->isIntra( uiAboveRightPartIdx ); 4817 if ( isAvailableB0 && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) ) 4818 { 4819 abCandIsInter[iCount] = true; 4820 // get Inter Dir 4821 puhInterDirNeighbours[iCount] = pcCUAboveRight->getInterDir( uiAboveRightPartIdx ); 4822 // get Mv from Left 4823 pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 4824 if ( getSlice()->isInterB() ) 4825 { 4826 pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 4827 } 4828 #if H_3D_NBDV 4829 pcMvFieldNeighbours[iCount<<1 ].getMv().setIDVFlag (false); 4830 pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false); 4831 #endif 4832 #if H_3D_VSP 4833 #if MTK_VSP_SIMPLIFICATION_F0111 4834 if ( ( ( getAddr() - pcCUAboveRight->getAddr() ) == 0) && (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1) 4835 #if LGE_SHARP_VSP_INHERIT_F0104 4836 #if H_3D_IC 4837 && !bICFlag 4838 #endif 4839 #if H_3D_ARP 4840 && !bARPFlag 4841 #endif 4842 #endif 4843 ) 4844 #else 4845 if (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1 4846 #if LGE_SHARP_VSP_INHERIT_F0104 4847 #if H_3D_IC 4848 && !bICFlag 4849 #endif 4850 #if H_3D_ARP 4851 && !bARPFlag 4852 #endif 4853 #endif 4854 ) 4855 #endif 4856 { 4857 vspFlag[iCount] = 1; 4858 #if !MTK_VSP_SIMPLIFICATION_F0111 4859 xInheritVSPDisInfo(pcCUAboveRight,uiAboveRightPartIdx,iCount,inheritedVSPDisInfo); 4860 #endif 4861 } 4862 #endif 4863 if ( mrgCandIdx == iCount ) 4864 { 4865 return; 4866 } 4867 iCount ++; 4868 } 4869 // early termination 4870 if (iCount == getSlice()->getMaxNumMergeCand()) 4871 { 4872 return; 4873 } 4874 #endif 4875 4876 4877 #if H_3D_IV_MERGE 4878 ///////////////////////////////////////////// 4879 //////// INTER VIEW DISP COMP (IvDC) //////// 4880 ///////////////////////////////////////////// 4881 4882 #if ETRIKHU_MERGE_REUSE_F0093 4883 if( ivCandDir[1] && iCount < getSlice()->getMaxNumMergeCand()) 4884 #else 4885 if( ivCandDir[1] ) 4886 #endif 4887 { 4888 assert(iCount < getSlice()->getMaxNumMergeCand()); 4889 4890 #if ETRIKHU_MERGE_REUSE_F0093 4891 tmpMV[0].setMvField( cZeroMv, NOT_VALID ); 4892 tmpMV[1].setMvField( cZeroMv, NOT_VALID ); 4893 if( ( ivCandDir[1] & 1 ) == 1 ) 4894 { 4895 tmpMV[0].setMvField( ivCandMv[ 2 ], ivCandRefIdx[ 2 ] ); 4896 } 4897 if( ( ivCandDir[1] & 2 ) == 2 ) 4898 { 4899 tmpMV[1].setMvField( ivCandMv[ 3 ], ivCandRefIdx[ 3 ] ); 4900 } 4901 #else 4902 abCandIsInter [ iCount ] = true; 4903 puhInterDirNeighbours[ iCount ] = ivCandDir[1]; 4904 if( ( ivCandDir[1] & 1 ) == 1 ) 4905 { 4906 pcMvFieldNeighbours[ iCount<<1 ].setMvField( ivCandMv[ 2 ], ivCandRefIdx[ 2 ] ); 4907 } 4908 if( ( ivCandDir[1] & 2 ) == 2 ) 4909 { 4910 pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( ivCandMv[ 3 ], ivCandRefIdx[ 3 ] ); 4911 } 4912 #endif 4913 4914 Bool bRemoveSpa = false; //pruning to A1, B1 4915 for(Int i = 0; i < 2; i ++) 4916 { 4917 Int iCnloop = iPosLeftAbove[i]; 4918 if ( iCnloop == -1 ) 4919 { 4920 continue; 4921 } 4922 if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1]) 4923 { 4924 bRemoveSpa = true; 4925 #if !ETRIKHU_MERGE_REUSE_F0093 4926 abCandIsInter [ iCount ] = false; 4927 //reset to the default value for MC 4928 puhInterDirNeighbours[iCount] = 0; 4929 pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID ); 4930 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID ); 4931 #endif 4932 break; 4933 } 4934 } 4935 if(!bRemoveSpa) 4936 { 4937 #if ETRIKHU_MERGE_REUSE_F0093 4938 rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV); 4939 puhInterDirNeighbours[ iCount ] = ivCandDir[1]; 4940 if( ( ivCandDir[1] & 1 ) == 1 ) 4941 { 4942 pcMvFieldNeighbours[ iCount<<1 ].setMvField( ivCandMv[ 2 ], ivCandRefIdx[ 2 ] ); 4943 } 4944 if( ( ivCandDir[1] & 2 ) == 2 ) 4945 { 4946 pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( ivCandMv[ 3 ], ivCandRefIdx[ 3 ] ); 4947 } 4948 #endif 4949 #if H_3D_NBDV 4950 pcMvFieldNeighbours[iCount<<1 ].getMv().setIDVFlag (false); 4951 pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false); 4952 #endif 4953 posIvDC = iCount; 4954 if ( mrgCandIdx == iCount ) 4955 return; 4956 iCount ++; 4957 4958 // early termination 4959 if (iCount == getSlice()->getMaxNumMergeCand()) 4960 { 4961 return; 4962 } 4963 } 4964 } 4965 #endif // H_3D_IV_MERGE 4966 4967 #if H_3D_VSP 4968 ///////////////////////////////////////////////// 4969 //////// VIEW SYNTHESIS PREDICTION (VSP) //////// 4970 ///////////////////////////////////////////////// 4971 #if ETRIKHU_MERGE_REUSE_F0093 4972 if (iCount<getSlice()->getMaxNumMergeCand()) 4973 { 4974 #endif 4975 4976 if ( 4977 #if LGE_SHARP_VSP_INHERIT_F0104 4978 #if H_3D_IC 4979 !bICFlag && 4980 #endif 4981 #if H_3D_ARP 4982 !bARPFlag && 4983 #endif 4984 #endif 4985 #if ETRIKHU_MERGE_REUSE_F0093 4986 xAddVspCand( mrgCandIdx, &cDisInfo, iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, iCount3DV, inheritedVSPDisInfo ) ) 4987 #else 4988 xAddVspCand( mrgCandIdx, &cDisInfo, iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag ) ) 4989 #endif 4990 { 4991 return; 4992 } 4993 4994 // early termination 4995 if (iCount == getSlice()->getMaxNumMergeCand()) 4996 { 4997 return; 4998 } 4999 #endif 5000 #if ETRIKHU_MERGE_REUSE_F0093 5001 } 5002 #endif 5003 5004 #if ETRIKHU_MERGE_REUSE_F0093 5005 iCount += numA0B2; 5006 #else 5007 #if H_3D 5008 /////////////////////////////////// 5009 //////// LEFT BOTTOM (A0) //////// 5010 /////////////////////////////////// 5011 #endif 5012 5013 //left bottom 5014 UInt uiLeftBottomPartIdx = 0; 5015 TComDataCU* pcCULeftBottom = 0; 5016 pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB ); 5017 Bool isAvailableA0 = pcCULeftBottom && 5018 pcCULeftBottom->isDiffMER(xP-1, yP+nPSH, xP, yP) && 5019 !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) ; 5020 if ( isAvailableA0 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) ) 5021 { 5022 abCandIsInter[iCount] = true; 5023 // get Inter Dir 5024 puhInterDirNeighbours[iCount] = pcCULeftBottom->getInterDir( uiLeftBottomPartIdx ); 5025 // get Mv from Left 5026 pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 5027 if ( getSlice()->isInterB() ) 5028 { 5029 pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 5030 } 5031 #if H_3D_NBDV 5032 pcMvFieldNeighbours[iCount<<1 ].getMv().setIDVFlag (false); 5033 pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false); 5034 #endif 5035 #if H_3D_VSP 5036 if (pcCULeftBottom->getVSPFlag(uiLeftBottomPartIdx) == 1 5037 #if LGE_SHARP_VSP_INHERIT_F0104 5038 #if H_3D_IC 5039 && !bICFlag 5040 #endif 5041 #if H_3D_ARP 5042 && !bARPFlag 5043 #endif 5044 #endif 5045 ) 5046 { 5047 vspFlag[iCount] = 1; 5048 #if !MTK_VSP_SIMPLIFICATION_F0111 5049 xInheritVSPDisInfo(pcCULeftBottom,uiLeftBottomPartIdx,iCount,inheritedVSPDisInfo); 5050 #endif 5051 } 5052 #endif 5053 if ( mrgCandIdx == iCount ) 5054 { 5055 return; 5056 } 5057 iCount ++; 5058 } 5059 // early termination 5060 if (iCount == getSlice()->getMaxNumMergeCand()) 5061 { 5062 return; 5063 } 5064 #if H_3D 5065 /////////////////////////////////// 5066 //////// LEFT ABOVE (B2) //////// 5067 /////////////////////////////////// 5068 #endif 5069 5070 // above left 5071 if( iCount < 4 ) 5072 { 5073 UInt uiAboveLeftPartIdx = 0; 5074 TComDataCU* pcCUAboveLeft = 0; 5075 pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr ); 5076 Bool isAvailableB2 = pcCUAboveLeft && 5077 pcCUAboveLeft->isDiffMER(xP-1, yP-1, xP, yP) && 5078 !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx ); 5079 if ( isAvailableB2 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) 5080 && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) ) 5081 { 5082 abCandIsInter[iCount] = true; 5083 // get Inter Dir 5084 puhInterDirNeighbours[iCount] = pcCUAboveLeft->getInterDir( uiAboveLeftPartIdx ); 5085 // get Mv from Left 5086 pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 5087 if ( getSlice()->isInterB() ) 5088 { 5089 pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 5090 } 5091 #if H_3D_NBDV 5092 pcMvFieldNeighbours[iCount<<1 ].getMv().setIDVFlag (false); 5093 pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false); 5094 #endif 5095 #if H_3D_VSP 5096 #if MTK_VSP_SIMPLIFICATION_F0111 5097 if ( ( ( getAddr() - pcCUAboveLeft->getAddr() ) == 0) && (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1) 5098 #if LGE_SHARP_VSP_INHERIT_F0104 5099 #if H_3D_IC 5100 && !bICFlag 5101 #endif 5102 #if H_3D_ARP 5103 && !bARPFlag 5104 #endif 5105 #endif 5106 ) 5107 #else 5108 if (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1 5109 #if LGE_SHARP_VSP_INHERIT_F0104 5110 #if H_3D_IC 5111 && !bICFlag 5112 #endif 5113 #if H_3D_ARP 5114 && !bARPFlag 5115 #endif 5116 #endif 5117 ) 5118 #endif 5119 { 5120 vspFlag[iCount] = 1; 5121 #if !MTK_VSP_SIMPLIFICATION_F0111 5122 xInheritVSPDisInfo(pcCUAboveLeft,uiAboveLeftPartIdx,iCount,inheritedVSPDisInfo); 5123 #endif 5124 } 5125 #endif 5126 if ( mrgCandIdx == iCount ) 5127 { 5128 return; 5129 } 5130 iCount ++; 5131 } 5132 } 5133 // early termination 5134 if (iCount == getSlice()->getMaxNumMergeCand()) 5135 { 5136 return; 5137 } 5138 #endif 5139 5140 5141 #if H_3D_IV_MERGE 5142 //////////////////////////////////////////////////// 5143 //////// SHIFTED IV (IvMCShift + IvDCShift) //////// 5144 //////////////////////////////////////////////////// 5145 #if ETRIKHU_MERGE_REUSE_F0093 5146 if( ivMvPredFlag && iCount < getSlice()->getMaxNumMergeCand() ) 5147 { 5148 if(xAddIvMRGCand( mrgCandIdx, iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, ivCandDir, ivCandMv, ivCandRefIdx, posIvDC, vspFlag, iCount3DV, inheritedVSPDisInfo ) ) 5149 #else 5150 if( ivMvPredFlag ) 5151 { 5152 if(xAddIvMRGCand( mrgCandIdx, iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, ivCandDir, ivCandMv, ivCandRefIdx, posIvDC, vspFlag)) 5153 #endif 5154 { 5155 return; 5156 } 5157 //early termination 5158 if (iCount == getSlice()->getMaxNumMergeCand()) 5159 { 5160 return; 5161 } 5162 } 5163 #endif 5164 5165 #if ETRIKHU_MERGE_REUSE_F0093 5166 if (iCountHEVC + iCount3DV > getSlice()->getMaxNumMergeCand()) 5167 { 5168 iCount = getSlice()->getMaxNumMergeCand(); 5169 } 5170 else 5171 { 5172 iCount = iCountHEVC + iCount3DV; 5173 } 5174 numValidMergeCand = iCount; 5175 #else 5176 #if H_3D 5177 ///////////////////////////////// 5178 //////// Collocate (COL) //////// 5179 ///////////////////////////////// 5180 #endif 5181 if ( getSlice()->getEnableTMVPFlag()) 5182 { 5183 //>> MTK colocated-RightBottom 5184 UInt uiPartIdxRB; 5185 5186 deriveRightBottomIdx( uiPUIdx, uiPartIdxRB ); 5187 5188 UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB]; 5189 UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); 5190 5191 TComMv cColMv; 5192 Int iRefIdx; 5193 Int uiLCUIdx = -1; 5194 5195 if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) // image boundary check 5196 { 5197 } 5198 else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) 5199 { 5200 } 5201 else 5202 { 5203 if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) && // is not at the last column of LCU 5204 ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row of LCU 5205 { 5206 uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ]; 5207 uiLCUIdx = getAddr(); 5208 } 5209 else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) // is not at the last column of LCU But is last row of LCU 5210 { 5211 uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ]; 5212 } 5213 else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU 5214 { 5215 uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ]; 5216 uiLCUIdx = getAddr() + 1; 5217 } 5218 else //is the right bottom corner of LCU 5219 { 5220 uiAbsPartAddr = 0; 5221 } 5222 } 5223 5224 5225 iRefIdx = 0; 5226 Bool bExistMV = false; 5227 UInt uiPartIdxCenter; 5228 UInt uiCurLCUIdx = getAddr(); 5229 Int dir = 0; 5230 UInt uiArrayAddr = iCount; 5231 xDeriveCenterIdx( uiPUIdx, uiPartIdxCenter ); 5232 bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_0, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx ); 5233 if( bExistMV == false ) 5234 { 5235 bExistMV = xGetColMVP( REF_PIC_LIST_0, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx ); 5236 } 5237 if( bExistMV ) 5238 { 5239 dir |= 1; 5240 pcMvFieldNeighbours[ 2 * uiArrayAddr ].setMvField( cColMv, iRefIdx ); 5241 } 5242 5243 if ( getSlice()->isInterB() ) 5244 { 5245 #if H_3D_TMVP 5246 iRefIdx = 0; 5247 #endif 5248 bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_1, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx); 5249 if( bExistMV == false ) 5250 { 5251 bExistMV = xGetColMVP( REF_PIC_LIST_1, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx ); 5252 } 5253 if( bExistMV ) 5254 { 5255 dir |= 2; 5256 pcMvFieldNeighbours[ 2 * uiArrayAddr + 1 ].setMvField( cColMv, iRefIdx ); 5257 } 5258 } 5259 5260 if (dir != 0) 5261 { 5262 puhInterDirNeighbours[uiArrayAddr] = dir; 5263 abCandIsInter[uiArrayAddr] = true; 5264 #if H_3D_NBDV 5265 pcMvFieldNeighbours[iCount<<1 ].getMv().setIDVFlag (false); 5266 pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false); 5267 #endif 5268 if ( mrgCandIdx == iCount ) 5269 { 5270 return; 5271 } 5272 iCount++; 5273 } 5274 } 5275 // early termination 5276 if (iCount == getSlice()->getMaxNumMergeCand()) 5277 { 5278 return; 5279 } 5280 UInt uiArrayAddr = iCount; 5281 UInt uiCutoff = uiArrayAddr; 5282 5283 if ( getSlice()->isInterB()) 5284 { 5285 #if H_3D_IV_MERGE 5286 UInt uiPriorityList0[20] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3, 0, 4, 1, 4, 2, 4, 3, 4 }; 5287 UInt uiPriorityList1[20] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2, 4, 0, 4, 1, 4, 2, 4, 3 }; 5288 #else 5289 UInt uiPriorityList0[12] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3}; 5290 UInt uiPriorityList1[12] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2}; 5291 #endif 5292 5293 for (Int idx=0; idx<uiCutoff*(uiCutoff-1) && uiArrayAddr!= getSlice()->getMaxNumMergeCand(); idx++) 5294 { 5295 Int i = uiPriorityList0[idx]; Int j = uiPriorityList1[idx]; 5296 #if H_3D_VSP 5297 Bool bValid = true; 5298 if ( vspFlag[i] == 1 || vspFlag[j] == 1 ) 5299 { 5300 bValid = false; 5301 } 5302 if( !m_pcSlice->getVPS()->getViewSynthesisPredFlag( m_pcSlice->getLayerIdInVps() ) ) 5303 { 5304 assert(bValid == true); 5305 } 5306 #endif 5307 #if H_3D_VSP 5308 if (abCandIsInter[i] && abCandIsInter[j] && (puhInterDirNeighbours[i]&0x1) && (puhInterDirNeighbours[j]&0x2) && bValid) 5309 #else 5310 if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2)) 5311 #endif 5312 { 5313 abCandIsInter[uiArrayAddr] = true; 5314 puhInterDirNeighbours[uiArrayAddr] = 3; 5315 5316 // get Mv from cand[i] and cand[j] 5317 pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(pcMvFieldNeighbours[i<<1].getMv(), pcMvFieldNeighbours[i<<1].getRefIdx()); 5318 pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(pcMvFieldNeighbours[(j<<1)+1].getMv(), pcMvFieldNeighbours[(j<<1)+1].getRefIdx()); 5319 5320 Int iRefPOCL0 = m_pcSlice->getRefPOC( REF_PIC_LIST_0, pcMvFieldNeighbours[(uiArrayAddr<<1)].getRefIdx() ); 5321 Int iRefPOCL1 = m_pcSlice->getRefPOC( REF_PIC_LIST_1, pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getRefIdx() ); 5322 if (iRefPOCL0 == iRefPOCL1 && pcMvFieldNeighbours[(uiArrayAddr<<1)].getMv() == pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getMv()) 5323 { 5324 abCandIsInter[uiArrayAddr] = false; 5325 } 5326 else 5327 { 5328 uiArrayAddr++; 5329 } 5330 } 5331 } 5332 } 5333 // early termination 5334 if (uiArrayAddr == getSlice()->getMaxNumMergeCand()) 5335 { 5336 return; 5337 } 5338 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); 5339 Int r = 0; 5340 Int refcnt = 0; 5341 while (uiArrayAddr < getSlice()->getMaxNumMergeCand()) 5342 { 5343 abCandIsInter[uiArrayAddr] = true; 5344 puhInterDirNeighbours[uiArrayAddr] = 1; 5345 pcMvFieldNeighbours[uiArrayAddr << 1].setMvField( TComMv(0, 0), r); 5346 5347 if ( getSlice()->isInterB() ) 5348 { 5349 puhInterDirNeighbours[uiArrayAddr] = 3; 5350 pcMvFieldNeighbours[(uiArrayAddr << 1) + 1].setMvField(TComMv(0, 0), r); 5351 } 5352 uiArrayAddr++; 5353 if ( refcnt == iNumRefIdx - 1 ) 5354 { 5355 r = 0; 5356 } 5357 else 5358 { 5359 ++r; 5360 ++refcnt; 5361 } 5362 } 5363 5364 numValidMergeCand = uiArrayAddr; 5365 #endif 5366 } 5367 5368 5369 5370 5371 #else 5372 3471 5373 /** Constructs a list of merging candidates 3472 5374 * \param uiAbsPartIdx … … 4404 6306 numValidMergeCand = uiArrayAddr; 4405 6307 } 6308 6309 6310 #endif 6311 6312 4406 6313 #if H_3D_VSP 4407 6314 inline Void TComDataCU::xInheritVSPDisInfo(TComDataCU* pcCURef, UInt uiAbsPartIdx, Int iCount, InheritedVSPDisInfo* inheritedVSPDisInfo) -
branches/HTM-8.2-dev2-ETRI/source/Lib/TLibCommon/TComDataCU.h
r669 r708 227 227 UChar* m_pucInterSDCMask; 228 228 #endif 229 229 #if ETRIKHU_MERGE_REUSE_F0093 230 Bool m_bAvailableFlagA1; ///< A1 available flag 231 Bool m_bAvailableFlagB1; ///< B1 available flag 232 Bool m_bAvailableFlagB0; ///< B0 available flag 233 Bool m_bAvailableFlagA0; ///< A0 available flag 234 Bool m_bAvailableFlagB2; ///< B2 available flag 235 #endif 230 236 // ------------------------------------------------------------------------------------------------------------------- 231 237 // misc. variables … … 244 250 UInt* m_sliceSegmentStartCU; ///< Start CU address of current slice 245 251 Char m_codedQP; 252 #if ETRIKHU_MERGE_REUSE_F0093 253 DisInfo m_cDefaultDisInfo; ///< Default disparity information for initializing 254 #endif 255 246 256 protected: 247 257 … … 250 260 Bool xAddMVPCandOrder ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ); 251 261 #if H_3D_VSP 262 #if ETRIKHU_MERGE_REUSE_F0093 263 Bool xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount, 264 Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag, Int& iCount3DV, InheritedVSPDisInfo* inheritedVSPDisInfo); 265 #else 252 266 Bool xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount, 253 267 Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag ); 254 268 #endif 269 #endif 255 270 #if H_3D_IV_MERGE 271 #if ETRIKHU_MERGE_REUSE_F0093 272 Bool xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* ivCandDir, TComMv* ivCandMv, 273 Int* ivCandRefIdx, Int posIvDC, Int* vspFlag, Int &iCount3DV, InheritedVSPDisInfo* inheritedVSPDisInfo ); 274 #else 256 275 Bool xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* ivCandDir, TComMv* ivCandMv, 257 276 Int* ivCandRefIdx, Int posIvDC, Int* vspFlag ); 277 #endif 258 278 Bool xGetPosFirstAvailDmvCand( Int iCount, TComMvField* pcMvFieldNeighbours, Int* ivCandDir, Int posIvDC, Int* vspFlag, Int& iFirDispCand ); 259 279 #endif … … 493 513 ); 494 514 515 #if ETRIKHU_MERGE_REUSE_F0093 516 Void rightShiftMergeCandList( TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* iVSPIndexTrue, InheritedVSPDisInfo* inheritedVSPDisInfo, UInt start, UInt num, Int &iCount3DV); 517 #endif 495 518 #if QC_DEPTH_IV_MRG_F0125 496 519 Bool getDispNeighBlocks ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* cDisp); … … 664 687 665 688 Bool hasEqualMotion ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ); 666 Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours 689 690 #if ETRIKHU_MERGE_REUSE_F0093 691 Bool getAvailableFlagA1() { return m_bAvailableFlagA1;} 692 Bool getAvailableFlagB1() { return m_bAvailableFlagB1;} 693 Bool getAvailableFlagB0() { return m_bAvailableFlagB0;} 694 Bool getAvailableFlagA0() { return m_bAvailableFlagA0;} 695 Bool getAvailableFlagB2() { return m_bAvailableFlagB2;} 696 Void initAvailableFlags() { m_bAvailableFlagA1 = m_bAvailableFlagB1 = m_bAvailableFlagB0 = m_bAvailableFlagA0 = m_bAvailableFlagB2 = 0; } 697 Void getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1); 698 Void xGetInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours 699 #else 700 Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours 701 #endif 667 702 #if H_3D_VSP 668 703 , Int* vspFlag -
branches/HTM-8.2-dev2-ETRI/source/Lib/TLibCommon/TypeDef.h
r696 r708 174 174 // SCU_HS_FAST_DEPTH_INTRA_E0238_HHIFIX 175 175 #endif 176 177 #define ETRIKHU_MERGE_REUSE_F0093 1 // Reuse HEVC merge candidate list construction for base candidates, JCT3V-F0093 178 176 179 177 180 -
branches/HTM-8.2-dev2-ETRI/source/Lib/TLibDecoder/TDecCu.cpp
r690 r708 403 403 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); 404 404 InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM]; 405 406 #if ETRIKHU_MERGE_REUSE_F0093 407 m_ppcCU[uiDepth]->initAvailableFlags(); 408 m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); 409 m_ppcCU[uiDepth]->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand, uiMergeIndex ); 410 #else 405 411 m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand, uiMergeIndex ); 412 #endif 406 413 pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth ); 407 414 #else 415 #if ETRIKHU_MERGE_REUSE_F0093 416 m_ppcCU[uiDepth]->initAvailableFlags(); 408 417 m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); 418 m_ppcCU[uiDepth]->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); 419 #else 420 m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); 421 #endif 409 422 #endif 410 423 #if H_3D_VSP -
branches/HTM-8.2-dev2-ETRI/source/Lib/TLibDecoder/TDecEntropy.cpp
r690 r708 252 252 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); 253 253 InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM]; 254 #if ETRIKHU_MERGE_REUSE_F0093 255 pcSubCU->initAvailableFlags(); 256 pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand); 257 pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand ); 258 #else 254 259 pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand ); 260 #endif 255 261 pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); 256 262 … … 260 266 } 261 267 #else 268 #if ETRIKHU_MERGE_REUSE_F0093 269 pcSubCU->initAvailableFlags(); 270 pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand); 271 pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); 272 273 #else 262 274 pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); 275 #endif 263 276 #endif 264 277 isMerged = true; … … 273 286 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); 274 287 InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM]; 288 #if ETRIKHU_MERGE_REUSE_F0093 289 pcSubCU->initAvailableFlags(); 290 pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); 291 pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo,numValidMergeCand, uiMergeIndex ); 292 #else 275 293 pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo,numValidMergeCand, uiMergeIndex ); 294 #endif 276 295 pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); 277 296 if(vspFlag[uiMergeIndex]) … … 280 299 } 281 300 #else 301 #if ETRIKHU_MERGE_REUSE_F0093 302 pcSubCU->initAvailableFlags(); 282 303 pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); 304 pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); 305 #else 306 pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); 307 #endif 283 308 #endif 284 309 } -
branches/HTM-8.2-dev2-ETRI/source/Lib/TLibEncoder/TEncCu.cpp
r690 r708 1787 1787 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); 1788 1788 InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM]; 1789 #if ETRIKHU_MERGE_REUSE_F0093 1790 rpcTempCU->m_bAvailableFlagA1 = 0; 1791 rpcTempCU->m_bAvailableFlagB1 = 0; 1792 rpcTempCU->m_bAvailableFlagB0 = 0; 1793 rpcTempCU->m_bAvailableFlagA0 = 0; 1794 rpcTempCU->m_bAvailableFlagB2 = 0; 1795 rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); 1796 rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, vspFlag,inheritedVSPDisInfo, numValidMergeCand ); 1797 #else 1789 1798 rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand ); 1790 1799 #endif 1800 #endif 1801 #else 1802 #if ETRIKHU_MERGE_REUSE_F0093 1803 rpcTempCU->m_bAvailableFlagA1 = 0; 1804 rpcTempCU->m_bAvailableFlagB1 = 0; 1805 rpcTempCU->m_bAvailableFlagB0 = 0; 1806 rpcTempCU->m_bAvailableFlagA0 = 0; 1807 rpcTempCU->m_bAvailableFlagB2 = 0; 1808 rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); 1809 rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand ); 1791 1810 #else 1792 1811 rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand ); 1812 #endif 1793 1813 #endif 1794 1814 … … 1840 1860 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); 1841 1861 InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM]; 1862 #if ETRIKHU_MERGE_REUSE_F0093 1863 rpcTempCU->initAvailableFlags(); 1864 rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); 1865 rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, vspFlag,inheritedVSPDisInfo, numValidMergeCand ); 1866 #else 1842 1867 rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand ); 1868 #endif 1843 1869 #endif 1844 1870 #endif -
branches/HTM-8.2-dev2-ETRI/source/Lib/TLibEncoder/TEncSearch.cpp
r655 r708 3599 3599 if ( iPUIdx == 0 ) 3600 3600 { 3601 #if ETRIKHU_MERGE_REUSE_F0093 3602 pcCU->initAvailableFlags(); 3603 pcCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand); 3604 pcCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours 3605 #if H_3D_VSP 3606 , vspFlag 3607 , inheritedVSPDisInfo 3608 #endif 3609 , numValidMergeCand 3610 ); 3611 #else 3601 3612 pcCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours 3602 3613 #if H_3D_VSP … … 3606 3617 , numValidMergeCand 3607 3618 ); 3619 #endif 3608 3620 } 3609 3621 pcCU->setPartSizeSubParts( partSize, 0, uiDepth ); … … 3611 3623 else 3612 3624 { 3625 #if ETRIKHU_MERGE_REUSE_F0093 3626 pcCU->initAvailableFlags(); 3627 pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand); 3628 pcCU->xGetInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours 3629 #if H_3D_VSP 3630 , vspFlag 3631 , inheritedVSPDisInfo 3632 #endif 3633 , numValidMergeCand 3634 ); 3635 #else 3613 3636 pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours 3614 3637 #if H_3D_VSP … … 3618 3641 , numValidMergeCand 3619 3642 ); 3643 #endif 3620 3644 } 3621 3645 #if H_3D_VSP
Note: See TracChangeset for help on using the changeset viewer.