Changeset 724 in 3DVCSoftware for trunk/source/Lib/TLibCommon/TComDataCU.cpp
- Timestamp:
- 30 Nov 2013, 12:29:49 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibCommon/TComDataCU.cpp
r655 r724 120 120 m_dmmWedgeTabIdx[i] = NULL; 121 121 } 122 #if !SEC_DMM3_RBC_F0147 122 123 m_dmm3IntraTabIdx = NULL; 124 #endif 123 125 #endif 124 126 #if H_3D_DIM_RBC … … 143 145 #if H_3D_VSP 144 146 m_piVSPFlag = NULL; 147 #endif 148 #if MTK_SPIVMP_F0110 149 m_pbSPIVMPFlag = NULL; 145 150 #endif 146 151 #if H_3D_ARP … … 194 199 #if H_3D_VSP 195 200 m_piVSPFlag = (Char* )xMalloc(Char, uiNumPartition); 201 #endif 202 #if MTK_SPIVMP_F0110 203 m_pbSPIVMPFlag = (Bool* )xMalloc(Bool, uiNumPartition); 196 204 #endif 197 205 m_puhLumaIntraDir = (UChar* )xMalloc(UChar, uiNumPartition); … … 271 279 m_dmmWedgeTabIdx[i] = (UInt*)xMalloc(UInt, uiNumPartition); 272 280 } 281 #if !SEC_DMM3_RBC_F0147 273 282 m_dmm3IntraTabIdx = (UInt*)xMalloc(UInt, uiNumPartition); 283 #endif 274 284 #endif 275 285 #if H_3D_DIM_RBC … … 352 362 if ( m_piVSPFlag ) { xFree(m_piVSPFlag); m_piVSPFlag = NULL; } 353 363 #endif 364 #if MTK_SPIVMP_F0110 365 if ( m_pbSPIVMPFlag ) { xFree(m_pbSPIVMPFlag); m_pbSPIVMPFlag = NULL; } 366 #endif 354 367 if ( m_puhLumaIntraDir ) { xFree(m_puhLumaIntraDir); m_puhLumaIntraDir = NULL; } 355 368 if ( m_puhChromaIntraDir ) { xFree(m_puhChromaIntraDir); m_puhChromaIntraDir = NULL; } … … 404 417 if ( m_dmmWedgeTabIdx[i] ) { xFree( m_dmmWedgeTabIdx[i] ); m_dmmWedgeTabIdx[i] = NULL; } 405 418 } 419 #if !SEC_DMM3_RBC_F0147 406 420 if ( m_dmm3IntraTabIdx ) { xFree( m_dmm3IntraTabIdx ); m_dmm3IntraTabIdx = NULL; } 421 #endif 407 422 #endif 408 423 #if H_3D_DIM_RBC … … 555 570 #if H_3D_VSP 556 571 m_piVSPFlag[ui] = pcFrom->m_piVSPFlag[ui]; 572 #endif 573 #if MTK_SPIVMP_F0110 574 m_pbSPIVMPFlag[ui] = pcFrom->m_pbSPIVMPFlag[ui]; 557 575 #endif 558 576 m_puhLumaIntraDir[ui]=pcFrom->m_puhLumaIntraDir[ui]; … … 598 616 memset( m_piVSPFlag + firstElement, 0, numElements * sizeof( *m_piVSPFlag ) ); 599 617 #endif 618 #if MTK_SPIVMP_F0110 619 memset( m_pbSPIVMPFlag + firstElement, 0, numElements * sizeof( *m_pbSPIVMPFlag ) ); 620 #endif 600 621 memset( m_puhLumaIntraDir + firstElement, DC_IDX, numElements * sizeof( *m_puhLumaIntraDir ) ); 601 622 memset( m_puhChromaIntraDir + firstElement, 0, numElements * sizeof( *m_puhChromaIntraDir ) ); … … 622 643 memset( m_dmmWedgeTabIdx[i] + firstElement, 0, numElements * sizeof( *m_dmmWedgeTabIdx[i] ) ); 623 644 } 645 #if !SEC_DMM3_RBC_F0147 624 646 memset( m_dmm3IntraTabIdx + firstElement, 0, numElements * sizeof( *m_dmm3IntraTabIdx ) ); 647 #endif 625 648 #endif 626 649 #if H_3D_DIM_RBC … … 776 799 m_piVSPFlag[ui] = 0; 777 800 #endif 801 #if MTK_SPIVMP_F0110 802 m_pbSPIVMPFlag[ui] = 0; 803 #endif 778 804 m_puhLumaIntraDir[ui] = DC_IDX; 779 805 m_puhChromaIntraDir[ui] = 0; … … 799 825 m_dmmWedgeTabIdx[i] [ui] = 0; 800 826 } 827 #if !SEC_DMM3_RBC_F0147 801 828 m_dmm3IntraTabIdx [ui] = 0; 829 #endif 802 830 #endif 803 831 #if H_3D_DIM_SDC … … 873 901 #if H_3D_VSP 874 902 memset( m_piVSPFlag, 0, sizeof( Char ) * m_uiNumPartition ); 903 #endif 904 #if MTK_SPIVMP_F0110 905 memset( m_pbSPIVMPFlag, 0, sizeof( Bool ) * m_uiNumPartition ); 875 906 #endif 876 907 memset( m_puhLumaIntraDir, DC_IDX, iSizeInUchar ); … … 910 941 memset( m_dmmWedgeTabIdx[i], 0, sizeof(UInt) * m_uiNumPartition ); 911 942 } 943 #if !SEC_DMM3_RBC_F0147 912 944 memset( m_dmm3IntraTabIdx, 0, sizeof(UInt) * m_uiNumPartition ); 945 #endif 913 946 #endif 914 947 #if H_3D_DIM_RBC … … 968 1001 m_pDvInfo[ ui ] = pcCU->m_pDvInfo[uiPartOffset+ui]; 969 1002 #endif 1003 #if MTK_SPIVMP_F0110 1004 m_pbSPIVMPFlag[ui]=pcCU->m_pbSPIVMPFlag[uiPartOffset+ui]; 1005 #endif 970 1006 m_puhLumaIntraDir[ui]=pcCU->m_puhLumaIntraDir[uiPartOffset+ui]; 971 1007 m_puhChromaIntraDir[ui]=pcCU->m_puhChromaIntraDir[uiPartOffset+ui]; … … 992 1028 m_dmmWedgeTabIdx[i] [ui] = pcCU->m_dmmWedgeTabIdx[i] [uiPartOffset+ui]; 993 1029 } 1030 #if !SEC_DMM3_RBC_F0147 994 1031 m_dmm3IntraTabIdx [ui] = pcCU->m_dmm3IntraTabIdx[uiPartOffset+ui]; 1032 #endif 995 1033 #endif 996 1034 #if H_3D_DIM_SDC … … 1116 1154 m_piVSPFlag = pcCU->getVSPFlag() + uiPart; 1117 1155 #endif 1156 #if MTK_SPIVMP_F0110 1157 m_pbSPIVMPFlag = pcCU->getSPIVMPFlag() + uiPart; 1158 #endif 1118 1159 1119 1160 #if H_3D_ARP … … 1146 1187 m_dmmWedgeTabIdx[i] = pcCU->getDmmWedgeTabIdx( i ) + uiPart; 1147 1188 } 1189 #if !SEC_DMM3_RBC_F0147 1148 1190 m_dmm3IntraTabIdx = pcCU->getDmm3IntraTabIdx() + uiPart; 1191 #endif 1149 1192 #endif 1150 1193 #if H_3D_DIM_RBC … … 1269 1312 m_piVSPFlag = pcCU->getVSPFlag() + uiAbsPartIdx; 1270 1313 m_pDvInfo = pcCU->getDvInfo() + uiAbsPartIdx; 1314 #endif 1315 #if MTK_SPIVMP_F0110 1316 m_pbSPIVMPFlag = pcCU->getSPIVMPFlag() + uiAbsPartIdx; 1271 1317 #endif 1272 1318 … … 1319 1365 1320 1366 #endif 1367 #if MTK_SPIVMP_F0110 1368 memcpy( m_pbSPIVMPFlag + uiOffset, pcCU->getSPIVMPFlag(), sizeof( Bool ) * uiNumPartition ); 1369 #endif 1321 1370 memcpy( m_puhLumaIntraDir + uiOffset, pcCU->getLumaIntraDir(), iSizeInUchar ); 1322 1371 memcpy( m_puhChromaIntraDir + uiOffset, pcCU->getChromaIntraDir(), iSizeInUchar ); … … 1342 1391 memcpy( m_dmmWedgeTabIdx[i] + uiOffset, pcCU->getDmmWedgeTabIdx( i ), sizeof(UInt) * uiNumPartition ); 1343 1392 } 1393 #if !SEC_DMM3_RBC_F0147 1344 1394 memcpy( m_dmm3IntraTabIdx + uiOffset, pcCU->getDmm3IntraTabIdx(), sizeof(UInt) * uiNumPartition ); 1395 #endif 1345 1396 #endif 1346 1397 #if H_3D_DIM_RBC … … 1446 1497 memcpy( rpcCU->getDvInfo() + m_uiAbsIdxInLCU, m_pDvInfo, sizeof( *m_pDvInfo ) * m_uiNumPartition ); 1447 1498 #endif 1499 #if MTK_SPIVMP_F0110 1500 memcpy( rpcCU->getSPIVMPFlag() + m_uiAbsIdxInLCU, m_pbSPIVMPFlag, sizeof( Bool ) * m_uiNumPartition ); 1501 #endif 1448 1502 memcpy( rpcCU->getLumaIntraDir() + m_uiAbsIdxInLCU, m_puhLumaIntraDir, iSizeInUchar ); 1449 1503 memcpy( rpcCU->getChromaIntraDir() + m_uiAbsIdxInLCU, m_puhChromaIntraDir, iSizeInUchar ); … … 1469 1523 memcpy( rpcCU->getDmmWedgeTabIdx( i ) + m_uiAbsIdxInLCU, m_dmmWedgeTabIdx[i], sizeof(UInt) * m_uiNumPartition ); 1470 1524 } 1525 #if !SEC_DMM3_RBC_F0147 1471 1526 memcpy( rpcCU->getDmm3IntraTabIdx() + m_uiAbsIdxInLCU, m_dmm3IntraTabIdx, sizeof(UInt) * m_uiNumPartition ); 1527 #endif 1472 1528 #endif 1473 1529 #if H_3D_DIM_RBC … … 1559 1615 #if H_3D_VSP 1560 1616 memcpy( rpcCU->getVSPFlag() + uiPartOffset, m_piVSPFlag, sizeof(Char) * uiQNumPart ); 1617 #endif 1618 #if MTK_SPIVMP_F0110 1619 memcpy( rpcCU->getSPIVMPFlag() + uiPartOffset, m_pbSPIVMPFlag, sizeof(Bool) * uiQNumPart ); 1561 1620 #endif 1562 1621 memcpy( rpcCU->getLumaIntraDir() + uiPartOffset, m_puhLumaIntraDir, iSizeInUchar ); … … 1582 1641 memcpy( rpcCU->getDmmWedgeTabIdx( i ) + uiPartOffset, m_dmmWedgeTabIdx[i], sizeof(UInt) * uiQNumPart ); 1583 1642 } 1643 #if !SEC_DMM3_RBC_F0147 1584 1644 memcpy( rpcCU->getDmm3IntraTabIdx() + uiPartOffset, m_dmm3IntraTabIdx, sizeof(UInt) * uiQNumPart ); 1645 #endif 1585 1646 #endif 1586 1647 #if H_3D_DIM_RBC … … 2313 2374 { 2314 2375 UInt uiCtx = 0; 2376 2377 #if LGE_IC_CTX_F0160 2378 TComDataCU* pcTempCU = NULL; 2379 UInt uiTempPartIdx = 0; 2380 2381 pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx ); 2382 uiCtx = ( pcTempCU ) ? pcTempCU->isIC( uiTempPartIdx ) : 0; 2383 2384 pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx ); 2385 uiCtx += ( pcTempCU ) ? pcTempCU->isIC( uiTempPartIdx ) : 0; 2386 #endif 2315 2387 2316 2388 return uiCtx; … … 2672 2744 setSubPart<UChar>( uiMergeIndex, m_puhMergeIndex, uiAbsPartIdx, uiDepth, uiPartIdx ); 2673 2745 } 2746 2747 #if MTK_SPIVMP_F0110 2748 Void TComDataCU::setSPIVMPFlagSubParts( Bool bSPIVMPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) 2749 { 2750 setSubPart<Bool>( bSPIVMPFlag, m_pbSPIVMPFlag, uiAbsPartIdx, uiDepth, uiPartIdx ); 2751 } 2752 #endif 2674 2753 2675 2754 #if H_3D_VSP … … 3266 3345 * false: otherwise 3267 3346 */ 3347 #if ETRIKHU_MERGE_REUSE_F0093 3348 inline Bool TComDataCU::xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount, 3349 Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag, Int& iCount3DV, InheritedVSPDisInfo* inheritedVSPDisInfo ) 3350 #else 3268 3351 inline Bool TComDataCU::xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount, 3269 3352 Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag ) 3353 #endif 3270 3354 { 3271 3355 if ( m_pcSlice->getViewIndex() == 0 || !m_pcSlice->getVPS()->getViewSynthesisPredFlag( m_pcSlice->getLayerIdInVps() ) || m_pcSlice->getIsDepth() ) … … 3282 3366 return false; 3283 3367 } 3368 3369 #if ETRIKHU_MERGE_REUSE_F0093 3370 rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV); 3371 #endif 3284 3372 3285 3373 Bool refViewAvailFlag = false; … … 3366 3454 3367 3455 #if H_3D_IV_MERGE 3456 #if ETRIKHU_MERGE_REUSE_F0093 3457 inline Bool TComDataCU::xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* ivCandDir, TComMv* ivCandMv, 3458 Int* ivCandRefIdx, Int iPosIvDC, Int* vspFlag, Int &iCount3DV, InheritedVSPDisInfo* inheritedVSPDisInfo ) 3459 #else 3368 3460 inline Bool TComDataCU::xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* ivCandDir, TComMv* ivCandMv, 3369 3461 Int* ivCandRefIdx, Int iPosIvDC, Int* vspFlag ) 3462 #endif 3370 3463 { 3371 3464 for(Int iLoop = 0; iLoop < 2; iLoop ++ ) … … 3385 3478 } 3386 3479 clipMv( cMv ); 3480 3481 #if ETRIKHU_MERGE_REUSE_F0093 3482 rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV); 3483 #endif 3484 3387 3485 abCandIsInter [ iCount ] = true; 3388 3486 puhInterDirNeighbours[ iCount ] = puhInterDirNeighbours[iFirDispCand]; … … 3404 3502 if(ivCandDir[iLoop + 2]) 3405 3503 { 3504 #if ETRIKHU_MERGE_REUSE_F0093 3505 TComMvField tmpMV[2]; 3506 UChar tmpDir = ivCandDir[iLoop + 2]; 3507 #else 3406 3508 abCandIsInter [ iCount ] = true; 3407 3509 puhInterDirNeighbours[ iCount ] = ivCandDir[iLoop + 2]; 3510 #endif 3408 3511 if( ( ivCandDir[iLoop + 2] & 1 ) == 1 ) 3409 3512 { 3513 #if ETRIKHU_MERGE_REUSE_F0093 3514 tmpMV[0].setMvField( ivCandMv[ (iLoop<<1) + 4 ], ivCandRefIdx[ (iLoop<<1) + 4 ] ); 3515 #else 3410 3516 pcMvFieldNeighbours[ iCount<<1 ].setMvField( ivCandMv[ (iLoop<<1) + 4 ], ivCandRefIdx[ (iLoop<<1) + 4 ] ); 3517 #endif 3411 3518 } 3412 3519 if( ( ivCandDir[iLoop + 2] & 2 ) == 2 ) 3413 3520 { 3521 #if ETRIKHU_MERGE_REUSE_F0093 3522 tmpMV[1].setMvField( ivCandMv[ (iLoop<<1) + 5 ], ivCandRefIdx[ (iLoop<<1) + 5 ] ); 3523 #else 3414 3524 pcMvFieldNeighbours[ (iCount<<1)+1 ].setMvField( ivCandMv[ (iLoop<<1) + 5 ], ivCandRefIdx[ (iLoop<<1) + 5 ] ); 3525 #endif 3415 3526 } 3416 3527 … … 3419 3530 if( !iLoop && ivCandDir[0] > 0) 3420 3531 { 3532 #if ETRIKHU_MERGE_REUSE_F0093 3533 if(tmpDir == puhInterDirNeighbours[0] && pcMvFieldNeighbours[0]==tmpMV[0] && pcMvFieldNeighbours[1]==tmpMV[1]) 3534 #else 3421 3535 if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[0] && pcMvFieldNeighbours[0 ]== pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[1]==pcMvFieldNeighbours[(iCount<<1)+1]) 3536 #endif 3422 3537 { 3423 3538 bRemove = true; 3539 #if !ETRIKHU_MERGE_REUSE_F0093 3424 3540 abCandIsInter [ iCount ] = false; 3425 3541 puhInterDirNeighbours[ iCount ] = 0; … … 3427 3543 pcMvFieldNeighbours [ iCount<<1 ].setMvField( cZeroMv, NOT_VALID ); 3428 3544 pcMvFieldNeighbours [(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID ); 3545 #endif 3429 3546 } 3430 3547 } 3431 3548 if(!bRemove) 3432 3549 { 3550 3551 #if ETRIKHU_MERGE_REUSE_F0093 3552 rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV); 3553 3554 abCandIsInter[ iCount ] = true; 3555 puhInterDirNeighbours[ iCount ] = ivCandDir[iLoop + 2]; 3556 if( ( ivCandDir[iLoop + 2] & 1 ) == 1 ) 3557 { 3558 pcMvFieldNeighbours[ iCount<<1 ].setMvField( ivCandMv[ (iLoop<<1) + 4 ], ivCandRefIdx[ (iLoop<<1) + 4 ] ); 3559 } 3560 if( ( ivCandDir[iLoop + 2] & 2 ) == 2 ) 3561 { 3562 pcMvFieldNeighbours[ (iCount<<1)+1 ].setMvField( ivCandMv[ (iLoop<<1) + 5 ], ivCandRefIdx[ (iLoop<<1) + 5 ] ); 3563 } 3564 #endif 3565 3433 3566 #if H_3D_NBDV 3434 3567 if(iLoop) // For IvMcShift candidate … … 3469 3602 3470 3603 #endif 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 #if ETRIKHU_MERGE_REUSE_F0093 3614 Void TComDataCU::rightShiftMergeCandList( TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* iVSPIndexTrue, InheritedVSPDisInfo* inheritedVSPDisInfo, UInt start, UInt num, Int &iCount3DV) 3615 { 3616 iCount3DV++; 3617 for (int i=num; i>0; i--) 3618 { 3619 pcMvFieldNeighbours[(start+i)<<1].setMvField(pcMvFieldNeighbours[(start+i-1)<<1].getMv(), pcMvFieldNeighbours[(start+i-1)<<1].getRefIdx()); 3620 pcMvFieldNeighbours[((start+i)<<1)+1].setMvField(pcMvFieldNeighbours[((start+i-1)<<1)+1].getMv(), pcMvFieldNeighbours[((start+i-1)<<1)+1].getRefIdx()); 3621 puhInterDirNeighbours[start+i] = puhInterDirNeighbours[start+i-1]; 3622 iVSPIndexTrue[start+i] = iVSPIndexTrue[start+i-1]; 3623 inheritedVSPDisInfo[start+i].m_acDvInfo = inheritedVSPDisInfo[start+i-1].m_acDvInfo; 3624 } 3625 TComMv cZeroMv; 3626 pcMvFieldNeighbours[start<<1].setMvField( cZeroMv, NOT_VALID ); 3627 pcMvFieldNeighbours[(start<<1)+1].setMvField( cZeroMv, NOT_VALID ); 3628 puhInterDirNeighbours[start] = 0; 3629 iVSPIndexTrue[start] = 0; 3630 inheritedVSPDisInfo[start].m_acDvInfo = m_cDefaultDisInfo; 3631 3632 return; 3633 } 3634 3635 /** Constructs a list of merging candidates 3636 * \param uiAbsPartIdx 3637 * \param uiPUIdx 3638 * \param uiDepth 3639 * \param pcMvFieldNeighbours 3640 * \param puhInterDirNeighbours 3641 * \param numValidMergeCand 3642 */ 3643 // HM 12.0 based merge candidate list construction 3644 3645 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx ) 3646 { 3647 3648 UInt uiAbsPartAddr = m_uiAbsIdxInLCU + uiAbsPartIdx; 3649 Bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ]; 3650 TComMv cZeroMv; 3651 for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ++ui ) 3652 { 3653 abCandIsInter[ui] = false; 3654 pcMvFieldNeighbours[ ( ui << 1 ) ].setMvField(cZeroMv, NOT_VALID); 3655 pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setMvField(cZeroMv, NOT_VALID); 3656 } 3657 numValidMergeCand = getSlice()->getMaxNumMergeCand(); 3658 // compute the location of the current PU 3659 Int xP, yP, nPSW, nPSH; 3660 this->getPartPosition(uiPUIdx, xP, yP, nPSW, nPSH); 3661 3662 Int iCount = 0; 3663 3664 UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB; 3665 PartSize cCurPS = getPartitionSize( uiAbsPartIdx ); 3666 deriveLeftRightTopIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT ); 3667 deriveLeftBottomIdxGeneral ( uiAbsPartIdx, uiPUIdx, uiPartIdxLB ); 3668 3669 //left 3670 UInt uiLeftPartIdx = 0; 3671 TComDataCU* pcCULeft = 0; 3672 pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB ); 3673 Bool isAvailableA1 = pcCULeft && 3674 pcCULeft->isDiffMER(xP -1, yP+nPSH-1, xP, yP) && 3675 !( uiPUIdx == 1 && (cCurPS == SIZE_Nx2N || cCurPS == SIZE_nLx2N || cCurPS == SIZE_nRx2N) ) && 3676 !pcCULeft->isIntra( uiLeftPartIdx ) ; 3677 if ( isAvailableA1 ) 3678 { 3679 m_bAvailableFlagA1 = 1; 3680 abCandIsInter[iCount] = true; 3681 // get Inter Dir 3682 puhInterDirNeighbours[iCount] = pcCULeft->getInterDir( uiLeftPartIdx ); 3683 // get Mv from Left 3684 pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 3685 if ( getSlice()->isInterB() ) 3686 { 3687 pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 3688 } 3689 3690 iCount ++; 3691 } 3692 3693 // early termination 3694 if (iCount == getSlice()->getMaxNumMergeCand()) 3695 { 3696 return; 3697 } 3698 // above 3699 UInt uiAbovePartIdx = 0; 3700 TComDataCU* pcCUAbove = 0; 3701 pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT ); 3702 Bool isAvailableB1 = pcCUAbove && 3703 pcCUAbove->isDiffMER(xP+nPSW-1, yP-1, xP, yP) && 3704 !( uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD) ) && 3705 !pcCUAbove->isIntra( uiAbovePartIdx ); 3706 if ( isAvailableB1 && (!isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAbove, uiAbovePartIdx ) ) ) 3707 { 3708 m_bAvailableFlagB1 = 1; 3709 abCandIsInter[iCount] = true; 3710 // get Inter Dir 3711 puhInterDirNeighbours[iCount] = pcCUAbove->getInterDir( uiAbovePartIdx ); 3712 // get Mv from Left 3713 pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 3714 if ( getSlice()->isInterB() ) 3715 { 3716 pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 3717 } 3718 if ( mrgCandIdx == iCount ) 3719 { 3720 return; 3721 } 3722 iCount ++; 3723 } 3724 // early termination 3725 if (iCount == getSlice()->getMaxNumMergeCand()) 3726 { 3727 return; 3728 } 3729 3730 // above right 3731 UInt uiAboveRightPartIdx = 0; 3732 TComDataCU* pcCUAboveRight = 0; 3733 pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT ); 3734 Bool isAvailableB0 = pcCUAboveRight && 3735 pcCUAboveRight->isDiffMER(xP+nPSW, yP-1, xP, yP) && 3736 !pcCUAboveRight->isIntra( uiAboveRightPartIdx ); 3737 if ( isAvailableB0 && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) ) 3738 { 3739 m_bAvailableFlagB0 = 1; 3740 abCandIsInter[iCount] = true; 3741 // get Inter Dir 3742 puhInterDirNeighbours[iCount] = pcCUAboveRight->getInterDir( uiAboveRightPartIdx ); 3743 // get Mv from Left 3744 pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 3745 if ( getSlice()->isInterB() ) 3746 { 3747 pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 3748 } 3749 if ( mrgCandIdx == iCount ) 3750 { 3751 return; 3752 } 3753 iCount ++; 3754 } 3755 // early termination 3756 if (iCount == getSlice()->getMaxNumMergeCand()) 3757 { 3758 return; 3759 } 3760 3761 //left bottom 3762 UInt uiLeftBottomPartIdx = 0; 3763 TComDataCU* pcCULeftBottom = 0; 3764 pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB ); 3765 Bool isAvailableA0 = pcCULeftBottom && 3766 pcCULeftBottom->isDiffMER(xP-1, yP+nPSH, xP, yP) && 3767 !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) ; 3768 if ( isAvailableA0 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) ) 3769 { 3770 m_bAvailableFlagA0 = 1; 3771 abCandIsInter[iCount] = true; 3772 // get Inter Dir 3773 puhInterDirNeighbours[iCount] = pcCULeftBottom->getInterDir( uiLeftBottomPartIdx ); 3774 // get Mv from Left 3775 pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 3776 if ( getSlice()->isInterB() ) 3777 { 3778 pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 3779 } 3780 if ( mrgCandIdx == iCount ) 3781 { 3782 return; 3783 } 3784 iCount ++; 3785 } 3786 // early termination 3787 if (iCount == getSlice()->getMaxNumMergeCand()) 3788 { 3789 return; 3790 } 3791 // above left 3792 if( iCount < 4 ) 3793 { 3794 UInt uiAboveLeftPartIdx = 0; 3795 TComDataCU* pcCUAboveLeft = 0; 3796 pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr ); 3797 Bool isAvailableB2 = pcCUAboveLeft && 3798 pcCUAboveLeft->isDiffMER(xP-1, yP-1, xP, yP) && 3799 !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx ); 3800 if ( isAvailableB2 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) 3801 && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) ) 3802 { 3803 m_bAvailableFlagB2 = 1; 3804 abCandIsInter[iCount] = true; 3805 // get Inter Dir 3806 puhInterDirNeighbours[iCount] = pcCUAboveLeft->getInterDir( uiAboveLeftPartIdx ); 3807 // get Mv from Left 3808 pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 3809 if ( getSlice()->isInterB() ) 3810 { 3811 pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 3812 } 3813 if ( mrgCandIdx == iCount ) 3814 { 3815 return; 3816 } 3817 iCount ++; 3818 } 3819 } 3820 // early termination 3821 if (iCount == getSlice()->getMaxNumMergeCand()) 3822 { 3823 return; 3824 } 3825 if ( getSlice()->getEnableTMVPFlag()) 3826 { 3827 //>> MTK colocated-RightBottom 3828 UInt uiPartIdxRB; 3829 3830 deriveRightBottomIdx( uiPUIdx, uiPartIdxRB ); 3831 3832 UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB]; 3833 UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); 3834 3835 TComMv cColMv; 3836 Int iRefIdx; 3837 Int uiLCUIdx = -1; 3838 3839 if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) // image boundary check 3840 { 3841 } 3842 else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) 3843 { 3844 } 3845 else 3846 { 3847 if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) && // is not at the last column of LCU 3848 ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row of LCU 3849 { 3850 uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ]; 3851 uiLCUIdx = getAddr(); 3852 } 3853 else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) // is not at the last column of LCU But is last row of LCU 3854 { 3855 uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ]; 3856 } 3857 else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU 3858 { 3859 uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ]; 3860 uiLCUIdx = getAddr() + 1; 3861 } 3862 else //is the right bottom corner of LCU 3863 { 3864 uiAbsPartAddr = 0; 3865 } 3866 } 3867 3868 iRefIdx = 0; 3869 Bool bExistMV = false; 3870 UInt uiPartIdxCenter; 3871 UInt uiCurLCUIdx = getAddr(); 3872 Int dir = 0; 3873 UInt uiArrayAddr = iCount; 3874 xDeriveCenterIdx( uiPUIdx, uiPartIdxCenter ); 3875 bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_0, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx ); 3876 if( bExistMV == false ) 3877 { 3878 bExistMV = xGetColMVP( REF_PIC_LIST_0, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx ); 3879 } 3880 if( bExistMV ) 3881 { 3882 dir |= 1; 3883 pcMvFieldNeighbours[ 2 * uiArrayAddr ].setMvField( cColMv, iRefIdx ); 3884 } 3885 3886 if ( getSlice()->isInterB() ) 3887 { 3888 #if H_3D_TMVP 3889 iRefIdx = 0; 3890 #endif 3891 bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_1, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx); 3892 if( bExistMV == false ) 3893 { 3894 bExistMV = xGetColMVP( REF_PIC_LIST_1, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx ); 3895 } 3896 if( bExistMV ) 3897 { 3898 dir |= 2; 3899 pcMvFieldNeighbours[ 2 * uiArrayAddr + 1 ].setMvField( cColMv, iRefIdx ); 3900 } 3901 } 3902 3903 if (dir != 0) 3904 { 3905 puhInterDirNeighbours[uiArrayAddr] = dir; 3906 abCandIsInter[uiArrayAddr] = true; 3907 #if H_3D_NBDV 3908 pcMvFieldNeighbours[iCount<<1 ].getMv().setIDVFlag (false); 3909 pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false); 3910 #endif 3911 if ( mrgCandIdx == iCount ) 3912 { 3913 return; 3914 } 3915 iCount++; 3916 } 3917 } 3918 // early termination 3919 if (iCount == getSlice()->getMaxNumMergeCand()) 3920 { 3921 return; 3922 } 3923 UInt uiArrayAddr = iCount; 3924 UInt uiCutoff = uiArrayAddr; 3925 3926 if ( getSlice()->isInterB() && iCount<5) // JCT3V-F0129 by Qualcomm 3927 { 3928 UInt uiPriorityList0[12] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3}; 3929 UInt uiPriorityList1[12] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2}; 3930 3931 for (Int idx=0; idx<uiCutoff*(uiCutoff-1) && uiArrayAddr!= getSlice()->getMaxNumMergeCand(); idx++) 3932 { 3933 Int i = uiPriorityList0[idx]; Int j = uiPriorityList1[idx]; 3934 if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2)) 3935 { 3936 abCandIsInter[uiArrayAddr] = true; 3937 puhInterDirNeighbours[uiArrayAddr] = 3; 3938 3939 // get Mv from cand[i] and cand[j] 3940 pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(pcMvFieldNeighbours[i<<1].getMv(), pcMvFieldNeighbours[i<<1].getRefIdx()); 3941 pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(pcMvFieldNeighbours[(j<<1)+1].getMv(), pcMvFieldNeighbours[(j<<1)+1].getRefIdx()); 3942 3943 Int iRefPOCL0 = m_pcSlice->getRefPOC( REF_PIC_LIST_0, pcMvFieldNeighbours[(uiArrayAddr<<1)].getRefIdx() ); 3944 Int iRefPOCL1 = m_pcSlice->getRefPOC( REF_PIC_LIST_1, pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getRefIdx() ); 3945 if (iRefPOCL0 == iRefPOCL1 && pcMvFieldNeighbours[(uiArrayAddr<<1)].getMv() == pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getMv()) 3946 { 3947 abCandIsInter[uiArrayAddr] = false; 3948 } 3949 else 3950 { 3951 uiArrayAddr++; 3952 } 3953 } 3954 } 3955 } 3956 // early termination 3957 if (uiArrayAddr == getSlice()->getMaxNumMergeCand()) 3958 { 3959 return; 3960 } 3961 3962 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); 3963 Int r = 0; 3964 Int refcnt = 0; 3965 while (uiArrayAddr < getSlice()->getMaxNumMergeCand()) 3966 { 3967 abCandIsInter[uiArrayAddr] = true; 3968 puhInterDirNeighbours[uiArrayAddr] = 1; 3969 pcMvFieldNeighbours[uiArrayAddr << 1].setMvField( TComMv(0, 0), r); 3970 3971 if ( getSlice()->isInterB() ) 3972 { 3973 puhInterDirNeighbours[uiArrayAddr] = 3; 3974 pcMvFieldNeighbours[(uiArrayAddr << 1) + 1].setMvField(TComMv(0, 0), r); 3975 } 3976 uiArrayAddr++; 3977 if ( refcnt == iNumRefIdx - 1 ) 3978 { 3979 r = 0; 3980 } 3981 else 3982 { 3983 ++r; 3984 ++refcnt; 3985 } 3986 } 3987 3988 numValidMergeCand = uiArrayAddr; 3989 } 3990 3991 3992 3993 /** Constructs a list of merging candidates 3994 * \param uiAbsPartIdx 3995 * \param uiPUIdx 3996 * \param uiDepth 3997 * \param pcMvFieldNeighbours 3998 * \param puhInterDirNeighbours 3999 * \param numValidMergeCand 4000 */ 4001 #if ETRIKHU_MERGE_REUSE_F0093 4002 Void TComDataCU::xGetInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours 4003 #else 4004 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours 4005 #endif 4006 #if H_3D_VSP 4007 , Int* vspFlag 4008 , InheritedVSPDisInfo* inheritedVSPDisInfo 4009 #endif 4010 #if MTK_SPIVMP_F0110 4011 , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP 4012 #endif 4013 , Int& numValidMergeCand, Int mrgCandIdx 4014 ) 4015 { 4016 UInt uiAbsPartAddr = m_uiAbsIdxInLCU + uiAbsPartIdx; 4017 #if H_3D_IV_MERGE 4018 //////////////////////////// 4019 //////// INIT LISTS //////// 4020 //////////////////////////// 4021 TComMv cZeroMv; 4022 Bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ]; 4023 #else 4024 Bool abCandIsInter[ MRG_MAX_NUM_CANDS ]; 4025 #endif 4026 #if ETRIKHU_MERGE_REUSE_F0093 4027 TComMvField tmpMV[2]; 4028 UChar tmpDir; 4029 4030 ////////////////////////////////// 4031 //////// GET DISPARITIES //////// 4032 ////////////////////////////////// 4033 DisInfo cDisInfo = getDvInfo(uiAbsPartIdx); 4034 for(Int i = 0; i < MRG_MAX_NUM_CANDS_MEM; i++) 4035 { 4036 inheritedVSPDisInfo[i].m_acDvInfo = cDisInfo; // To prevent run-time error, this code must be executed always for merging process. 4037 } 4038 m_cDefaultDisInfo = cDisInfo; 4039 4040 if (!( getSlice()->getIsDepth() || getSlice()->getViewIndex()>0)) // current slice is not both dependent view or depth 4041 { 4042 return; 4043 } 4044 #else 4045 for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ++ui ) 4046 { 4047 abCandIsInter[ui] = false; 4048 #if H_3D_IV_MERGE 4049 pcMvFieldNeighbours[ ( ui << 1 ) ].setMvField(cZeroMv, NOT_VALID); 4050 pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setMvField(cZeroMv, NOT_VALID); 4051 #else 4052 pcMvFieldNeighbours[ ( ui << 1 ) ].setRefIdx(NOT_VALID); 4053 pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setRefIdx(NOT_VALID); 4054 #endif 4055 } 4056 #endif 4057 4058 numValidMergeCand = getSlice()->getMaxNumMergeCand(); 4059 #if H_3D 4060 ////////////////////////////////// 4061 //////// DERIVE LOCATIONS //////// 4062 ////////////////////////////////// 4063 #endif 4064 // compute the location of the current PU 4065 Int xP, yP, nPSW, nPSH; 4066 this->getPartPosition(uiPUIdx, xP, yP, nPSW, nPSH); 4067 4068 Int iCount = 0; 4069 4070 UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB; 4071 #if !ETRIKHU_MERGE_REUSE_F0093 4072 PartSize cCurPS = getPartitionSize( uiAbsPartIdx ); 4073 #endif 4074 deriveLeftRightTopIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT ); 4075 deriveLeftBottomIdxGeneral ( uiAbsPartIdx, uiPUIdx, uiPartIdxLB ); 4076 #if SEC_MPI_ENABLING_MERGE_F0150 4077 Bool bMPIFlag = getSlice()->getVPS()->getMPIFlag( getSlice()->getLayerIdInVps() ); 4078 #endif 4079 #if QC_DEPTH_IV_MRG_F0125 4080 Bool bIsDepth = getSlice()->getIsDepth(); 4081 #if !BUGFIX_F0093 4082 Bool bDepthIPMCAvai = false; 4083 #endif 4084 #endif 4085 4086 #if LGE_SHARP_VSP_INHERIT_F0104 4087 #if H_3D_IC 4088 Bool bICFlag = getICFlag(uiAbsPartIdx); 4089 #endif 4090 #if H_3D_ARP 4091 Bool bARPFlag = getARPW(uiAbsPartIdx)>0 ? true : false; 4092 #endif 4093 #endif 4094 4095 #if ETRIKHU_MERGE_REUSE_F0093 4096 Int iPosLeftAbove[2] = {-1, -1}; 4097 4098 Int iCountHEVC = 0; 4099 Int iCount3DV = 0; 4100 Int numA1B1B0 = 0; 4101 Int numA0B2 = 0; 4102 4103 #if H_3D_NBDV 4104 for(Int i = 0; i < MRG_MAX_NUM_CANDS_MEM; i++) 4105 { 4106 pcMvFieldNeighbours[i<<1 ].getMv().setIDVFlag (false); 4107 pcMvFieldNeighbours[(i<<1)+1].getMv().setIDVFlag (false); 4108 } 4109 #endif 4110 4111 //left 4112 UInt uiLeftPartIdx = 0; 4113 TComDataCU* pcCULeft = 0; 4114 pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB ); 4115 if (getAvailableFlagA1()) 4116 { 4117 iPosLeftAbove[0] = numA1B1B0; 4118 #if H_3D_VSP 4119 if (pcCULeft->getVSPFlag(uiLeftPartIdx) == 1 4120 #if LGE_SHARP_VSP_INHERIT_F0104 4121 #if H_3D_IC 4122 && !bICFlag 4123 #endif 4124 #if H_3D_ARP 4125 && !bARPFlag 4126 #endif 4127 #endif 4128 ) 4129 { 4130 vspFlag[numA1B1B0] = 1; 4131 #if !MTK_VSP_SIMPLIFICATION_F0111 4132 xInheritVSPDisInfo(pcCULeft,uiLeftPartIdx,iCount,inheritedVSPDisInfo); 4133 #endif 4134 } 4135 #endif 4136 numA1B1B0++; 4137 } 4138 4139 // above 4140 UInt uiAbovePartIdx = 0; 4141 TComDataCU* pcCUAbove = 0; 4142 pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT ); 4143 if ( getAvailableFlagB1()) 4144 { 4145 iPosLeftAbove[1] = numA1B1B0; 4146 #if H_3D_VSP 4147 #if BUGFIX_2_F0093 && MTK_VSP_SIMPLIFICATION_F0111 4148 if ( ( ( getAddr() - pcCUAbove->getAddr() ) == 0) && (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1) 4149 #else 4150 if (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1 4151 #endif 4152 #if LGE_SHARP_VSP_INHERIT_F0104 4153 #if H_3D_IC 4154 && !bICFlag 4155 #endif 4156 #if H_3D_ARP 4157 && !bARPFlag 4158 #endif 4159 #endif 4160 ) 4161 { 4162 vspFlag[numA1B1B0] = 1; 4163 #if !MTK_VSP_SIMPLIFICATION_F0111 4164 xInheritVSPDisInfo(pcCUAbove,uiAbovePartIdx,iCount,inheritedVSPDisInfo); 4165 #endif 4166 } 4167 #endif 4168 4169 numA1B1B0++; 4170 } 4171 4172 // above right 4173 UInt uiAboveRightPartIdx = 0; 4174 TComDataCU* pcCUAboveRight = 0; 4175 pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT ); 4176 if ( getAvailableFlagB0()) 4177 { 4178 #if H_3D_VSP 4179 #if BUGFIX_2_F0093 && MTK_VSP_SIMPLIFICATION_F0111 4180 if ( ( ( getAddr() - pcCUAboveRight->getAddr() ) == 0) && (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1) 4181 #else 4182 if (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1 4183 #endif 4184 #if LGE_SHARP_VSP_INHERIT_F0104 4185 #if H_3D_IC 4186 && !bICFlag 4187 #endif 4188 #if H_3D_ARP 4189 && !bARPFlag 4190 #endif 4191 #endif 4192 ) 4193 { 4194 vspFlag[numA1B1B0] = 1; 4195 #if !MTK_VSP_SIMPLIFICATION_F0111 4196 xInheritVSPDisInfo(pcCUAboveRight,uiAboveRightPartIdx,iCount,inheritedVSPDisInfo); 4197 #endif 4198 } 4199 #endif 4200 numA1B1B0++; 4201 } 4202 4203 // left bottom 4204 UInt uiLeftBottomPartIdx = 0; 4205 TComDataCU* pcCULeftBottom = getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB ); 4206 if ( getAvailableFlagA0()) 4207 { 4208 #if H_3D_VSP 4209 if (pcCULeftBottom->getVSPFlag(uiLeftBottomPartIdx) == 1 4210 #if LGE_SHARP_VSP_INHERIT_F0104 4211 #if H_3D_IC 4212 && !bICFlag 4213 #endif 4214 #if H_3D_ARP 4215 && !bARPFlag 4216 #endif 4217 #endif 4218 ) 4219 { 4220 vspFlag[numA1B1B0] = 1; 4221 #if !MTK_VSP_SIMPLIFICATION_F0111 4222 xInheritVSPDisInfo(pcCULeftBottom,uiLeftBottomPartIdx,iCount,inheritedVSPDisInfo); 4223 #endif 4224 } 4225 #endif 4226 iCountHEVC++; 4227 numA0B2++; 4228 } 4229 4230 // above left 4231 UInt uiAboveLeftPartIdx = 0; 4232 TComDataCU* pcCUAboveLeft = 0; 4233 pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr ); 4234 if (getAvailableFlagB2()) 4235 { 4236 #if H_3D_VSP 4237 #if BUGFIX_2_F0093 && MTK_VSP_SIMPLIFICATION_F0111 4238 if ( ( ( getAddr() - pcCUAboveLeft->getAddr() ) == 0) && (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1) 4239 #else 4240 if (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1 4241 #endif 4242 #if LGE_SHARP_VSP_INHERIT_F0104 4243 #if H_3D_IC 4244 && !bICFlag 4245 #endif 4246 #if H_3D_ARP 4247 && !bARPFlag 4248 #endif 4249 #endif 4250 ) 4251 { 4252 vspFlag[numA1B1B0+iCountHEVC] = 1; 4253 #if !MTK_VSP_SIMPLIFICATION_F0111 4254 xInheritVSPDisInfo(pcCUAboveLeft,uiAboveLeftPartIdx,iCount,inheritedVSPDisInfo); 4255 #endif 4256 } 4257 #endif 4258 iCountHEVC++; 4259 numA0B2++; 4260 } 4261 4262 iCountHEVC = numValidMergeCand; 4263 #endif 4264 4265 4266 #if H_3D_IV_MERGE 4267 4268 ///////////////////////////////////////////// 4269 //////// TEXTURE MERGE CANDIDATE (T) //////// 4270 ///////////////////////////////////////////// 4271 4272 #if SEC_MPI_ENABLING_MERGE_F0150 4273 if( bMPIFlag) 4274 #else 4275 if( m_pcSlice->getIsDepth()) 4276 #endif 4277 { 4278 UInt uiPartIdxCenter; 4279 xDeriveCenterIdx( uiPUIdx, uiPartIdxCenter ); 4280 4281 #if ETRIKHU_MERGE_REUSE_F0093 4282 tmpMV[0].setMvField( cZeroMv, NOT_VALID ); 4283 tmpMV[1].setMvField( cZeroMv, NOT_VALID ); 4284 Int tRef[2]={-1, -1}; 4285 #endif 4286 4287 #if H_3D_FCO 4288 TComPic * pcTexturePic = m_pcSlice->getTexturePic(); 4289 TComDataCU *pcTextureCU = 0; 4290 if ( pcTexturePic ) 4291 pcTextureCU = pcTexturePic->getCU( getAddr() ); 4292 #else 4293 TComDataCU *pcTextureCU = m_pcSlice->getTexturePic()->getCU( getAddr() ); 4294 #endif 4295 4296 #if H_3D_FCO 4297 if ( pcTextureCU && pcTexturePic->getReconMark() && !pcTextureCU->isIntra( uiPartIdxCenter ) ) 4298 #else 4299 if ( pcTextureCU && !pcTextureCU->isIntra( uiPartIdxCenter ) ) 4300 #endif 4301 { 4302 #if ETRIKHU_MERGE_REUSE_F0093 4303 pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_0, tmpMV[0] ); 4304 tRef[0] = getPic()->isTextRefValid( REF_PIC_LIST_0, tmpMV[0].getRefIdx() ); 4305 if( (tmpMV[0].getRefIdx()>=0) && ( tRef[0] >= 0 ) ) 4306 { 4307 TComMv cMvPred = tmpMV[0].getMv(); 4308 const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) ); 4309 cMvPred+=cAdd; 4310 cMvPred>>=2; 4311 clipMv(cMvPred); 4312 tmpMV[0].setMvField(cMvPred,tRef[0]); 4313 } 4314 if ( getSlice()->isInterB() ) 4315 { 4316 pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_1, tmpMV[1] ); 4317 tRef[1] = getPic()->isTextRefValid( REF_PIC_LIST_1, tmpMV[1].getRefIdx() ); 4318 if( (tmpMV[1].getRefIdx()>=0) && ( tRef[1] >= 0) ) 4319 { 4320 TComMv cMvPred = tmpMV[1].getMv(); 4321 const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) ); 4322 cMvPred+=cAdd; 4323 cMvPred>>=2; 4324 clipMv(cMvPred); 4325 tmpMV[1].setMvField(cMvPred,tRef[1]); 4326 } 4327 } 4328 4329 tmpDir = 0; 4330 if( (tmpMV[0].getRefIdx()>=0) && ( tRef[0] >= 0 ) ) 4331 { 4332 tmpDir += ((tmpMV[0].getRefIdx()>=0)?1:0); 4333 } 4334 if( (tmpMV[1].getRefIdx()>=0) && ( tRef[1] >= 0) ) 4335 { 4336 tmpDir += ((tmpMV[1].getRefIdx()>=0)?2:0); 4337 } 4338 4339 if( tmpDir != 0 ) 4340 { 4341 Int iCnloop = 0; 4342 Bool bRemoveSpa = false; //pruning 4343 4344 for(Int i = 0; i < 2; i ++) 4345 { 4346 iCnloop = iPosLeftAbove[i]; 4347 if ( iCnloop == -1 ) 4348 { 4349 continue; 4350 } 4351 if(tmpDir == puhInterDirNeighbours[iCnloop] && tmpMV[0]==pcMvFieldNeighbours[(iCnloop<<1)] && tmpMV[1]==pcMvFieldNeighbours[(iCnloop<<1)+1]) 4352 { 4353 bRemoveSpa = true; 4354 break; 4355 } 4356 } 4357 4358 if (!bRemoveSpa) 4359 { 4360 rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, 5-iCount, iCount3DV); 4361 } 4362 else 4363 { 4364 rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (iCnloop-iCount), iCount3DV); 4365 if (iCnloop<numA1B1B0) 4366 { 4367 numA1B1B0--; 4368 } 4369 iCountHEVC--; 4370 4371 if (iPosLeftAbove[0] != -1) 4372 { 4373 if (iCnloop == iPosLeftAbove[0]) 4374 { 4375 iPosLeftAbove[0] = -1; 4376 } 4377 else 4378 { 4379 iPosLeftAbove[0]++; 4380 } 4381 } 4382 if (iPosLeftAbove[1] != -1) 4383 { 4384 if (iCnloop == iPosLeftAbove[1]) 4385 { 4386 iPosLeftAbove[1] = -1; 4387 } 4388 else 4389 { 4390 if (iCnloop > iPosLeftAbove[1]) 4391 { 4392 iPosLeftAbove[1]++; 4393 } 4394 } 4395 } 4396 } 4397 4398 if( (tmpMV[0].getRefIdx()>=0) && ( tRef[0] >= 0 ) ) 4399 { 4400 pcMvFieldNeighbours[iCount<<1].setMvField(tmpMV[0].getMv(), tRef[0]); 4401 } 4402 if ( getSlice()->isInterB()) 4403 { 4404 if( (tmpMV[1].getRefIdx()>=0) && ( tRef[1] >= 0) ) 4405 { 4406 pcMvFieldNeighbours[(iCount<<1)+1].setMvField(tmpMV[1].getMv(), tRef[1]); 4407 } 4408 } 4409 puhInterDirNeighbours[iCount] = tmpDir; 4410 4411 if ( mrgCandIdx == iCount ) 4412 { 4413 return; 4414 } 4415 iCount ++; 4416 4417 #else 4418 pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 4419 Int iValidDepRef = getPic()->isTextRefValid( REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1].getRefIdx() ); 4420 if( (pcMvFieldNeighbours[iCount<<1].getRefIdx()>=0) && ( iValidDepRef >= 0 ) ) 4421 { 4422 TComMv cMvPred = pcMvFieldNeighbours[iCount<<1].getMv(); 4423 const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) ); 4424 cMvPred+=cAdd; 4425 cMvPred>>=2; 4426 clipMv(cMvPred); 4427 pcMvFieldNeighbours[iCount<<1].setMvField(cMvPred,iValidDepRef); 4428 } 4429 if ( getSlice()->isInterB() ) 4430 { 4431 pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 4432 iValidDepRef = getPic()->isTextRefValid( REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx() ); 4433 if( (pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx()>=0) && ( iValidDepRef >= 0) ) 4434 { 4435 TComMv cMvPred = pcMvFieldNeighbours[(iCount<<1)+1].getMv(); 4436 const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) ); 4437 cMvPred+=cAdd; 4438 cMvPred>>=2; 4439 clipMv(cMvPred); 4440 pcMvFieldNeighbours[(iCount<<1)+1].setMvField(cMvPred,iValidDepRef); 4441 } 4442 } 4443 puhInterDirNeighbours[iCount] = (pcMvFieldNeighbours[iCount<<1].getRefIdx()>=0)?1:0; 4444 puhInterDirNeighbours[iCount] += (pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx()>=0)?2:0; 4445 if( puhInterDirNeighbours[iCount] != 0 ) 4446 { 4447 abCandIsInter[iCount] = true; 4448 if ( mrgCandIdx == iCount ) 4449 { 4450 return; 4451 } 4452 iCount ++; 4453 } 4454 #endif 4455 } 4456 } 4457 } 4458 4459 4460 #if !ETRIKHU_MERGE_REUSE_F0093 4461 ////////////////////////////////// 4462 //////// GET DISPARITIES //////// 4463 ////////////////////////////////// 4464 4465 DisInfo cDisInfo = getDvInfo(uiAbsPartIdx); 4466 for(Int i = 0; i < MRG_MAX_NUM_CANDS_MEM; i++) 4467 { 4468 inheritedVSPDisInfo[i].m_acDvInfo = cDisInfo; 4469 } 4470 #endif 4471 4472 ///////////////////////////////////////////////////////////////// 4473 //////// DERIVE IvMC, IvMCShift,IvDCShift, IvDC Candidates ///// 4474 ///////////////////////////////////////////////////////////////// 4475 4476 Int posIvDC = -1; 4477 #if !ETRIKHU_MERGE_REUSE_F0093 4478 Bool bLeftAvai = false; 4479 Int iPosLeftAbove[2] = {-1, -1}; 4480 #endif 4481 4482 // { IvMCL0, IvMCL1, IvDCL0, IvDCL1, IvMCL0Shift, IvMCL1Shift, IvDCL0Shift, IvDCL1Shift }; 4483 // An enumerator would be appropriate here! 4484 TComMv ivCandMv [8]; 4485 Int ivCandRefIdx[8] = {-1, -1, -1, -1, -1, -1, -1, -1}; 4486 4487 // { IvMC, IvDC, IvMCShift, IvDCShift }; 4488 Int ivCandDir [4] = {0, 0, 0, 0}; 4489 4490 Bool ivMvPredFlag = getSlice()->getVPS()->getIvMvPredFlag( getSlice()->getLayerIdInVps() ); 4491 4492 if ( ivMvPredFlag ) 4493 { 4494 getInterViewMergeCands(uiPUIdx, ivCandRefIdx, ivCandMv, &cDisInfo, ivCandDir 4495 #if QC_DEPTH_IV_MRG_F0125 4496 , bIsDepth 4497 #endif 4498 #if MTK_SPIVMP_F0110 4499 , pcMvFieldSP, puhInterDirSP 4500 #endif 4501 ); 4502 } 4503 4504 /////////////////////////////////////////////// 4505 //////// INTER VIEW MOTION COMP(IvMC) ///////// 4506 /////////////////////////////////////////////// 4507 4508 if( ivCandDir[0] ) 4509 { 4510 #if ETRIKHU_MERGE_REUSE_F0093 4511 tmpMV[0].setMvField( cZeroMv, NOT_VALID ); 4512 tmpMV[1].setMvField( cZeroMv, NOT_VALID ); 4513 4514 if( ( ivCandDir[0] & 1 ) == 1 ) 4515 { 4516 tmpMV[0].setMvField( ivCandMv[ 0 ], ivCandRefIdx[ 0 ] ); 4517 } 4518 if( ( ivCandDir[0] & 2 ) == 2 ) 4519 { 4520 tmpMV[1].setMvField( ivCandMv[ 1 ], ivCandRefIdx[ 1 ] ); 4521 } 4522 4523 Bool bRemoveSpa = false; //pruning 4524 Bool bIvMC = false; 4525 Int iCnloop=0; 4526 4527 #if BUGFIX_F0093 4528 if (!bIsDepth) 4529 { 4530 #endif 4531 for(Int i = 0; i < 2; i ++) 4532 { 4533 iCnloop = iPosLeftAbove[i]; 4534 if ( iCnloop == -1 ) 4535 { 4536 continue; 4537 } 4538 if(ivCandDir[0] == puhInterDirNeighbours[iCnloop] && tmpMV[0]==pcMvFieldNeighbours[(iCnloop<<1)] && tmpMV[1]==pcMvFieldNeighbours[(iCnloop<<1)+1]) 4539 { 4540 bRemoveSpa = true; 4541 break; 4542 } 4543 } 4544 #if BUGFIX_F0093 4545 } 4546 #endif 4547 #if QC_DEPTH_IV_MRG_F0125 4548 #if BUGFIX_F0093 4549 if (bIsDepth) 4550 #else 4551 if ( bIsDepth && !bRemoveSpa) 4552 #endif 4553 { 4554 iCnloop = iCount-1; 4555 for(; iCnloop >= 0; iCnloop --) 4556 { 4557 #if BUGFIX_F0093 4558 if(ivCandDir[0] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==tmpMV[0] && pcMvFieldNeighbours[(iCnloop<<1)+1]==tmpMV[1]) // F0125 compatible with F0093 4559 #else 4560 if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1]) 4561 #endif 4562 { 4563 bRemoveSpa = true; 4564 break; 4565 } 4566 } 4567 #if !BUGFIX_F0093 4568 if(!bRemoveSpa) 4569 { 4570 bDepthIPMCAvai = true; 4571 } 4572 #endif 4573 } 4574 #endif 4575 4576 if (!bRemoveSpa) 4577 { 4578 bIvMC = true; 4579 rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV); 4580 4581 if (iPosLeftAbove[0] != -1) 4582 { 4583 iPosLeftAbove[0]++; 4584 } 4585 if (iPosLeftAbove[1] != -1) 4586 { 4587 iPosLeftAbove[1]++; 4588 } 4589 } 4590 else if (bRemoveSpa && !bIsDepth) 4591 { 4592 bIvMC = true; 4593 rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (iCnloop-iCount), iCount3DV); 4594 4595 if (iCnloop<numA1B1B0) 4596 { 4597 numA1B1B0--; 4598 } 4599 iCountHEVC--; 4600 4601 if (iPosLeftAbove[0] != -1) 4602 { 4603 if (iCnloop == iPosLeftAbove[0]) 4604 { 4605 iPosLeftAbove[0] = -1; 4606 } 4607 else 4608 { 4609 iPosLeftAbove[0]++; 4610 } 4611 } 4612 if (iPosLeftAbove[1] != -1) 4613 { 4614 if (iCnloop == iPosLeftAbove[1]) 4615 { 4616 iPosLeftAbove[1] = -1; 4617 } 4618 else 4619 { 4620 if (iCnloop > iPosLeftAbove[1]) 4621 { 4622 iPosLeftAbove[1]++; 4623 } 4624 } 4625 } 4626 } 4627 4628 if (bIvMC) 4629 { 4630 #if MTK_SPIVMP_F0110 4631 pbSPIVMPFlag[iCount] = true; 4632 #endif 4633 if( ( ivCandDir[0] & 1 ) == 1 ) 4634 { 4635 pcMvFieldNeighbours[iCount<<1].setMvField( ivCandMv[ 0 ], ivCandRefIdx[ 0 ] ); 4636 } 4637 if( ( ivCandDir[0] & 2 ) == 2 ) 4638 { 4639 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( ivCandMv[ 1 ], ivCandRefIdx[ 1 ] ); 4640 } 4641 4642 puhInterDirNeighbours[ iCount ] = ivCandDir[0]; 4643 4644 #if !BUGFIX_F0093 4645 #if QC_DEPTH_IV_MRG_F0125 4646 if ( bDepthIPMCAvai || !bIsDepth ) 4647 { 4648 #endif 4649 #endif 4650 if ( mrgCandIdx == iCount ) 4651 { 4652 return; 4653 } 4654 iCount ++; 4655 #if !BUGFIX_F0093 4656 #if QC_DEPTH_IV_MRG_F0125 4657 } 4658 #endif 4659 #endif 4660 } 4661 #else 4662 abCandIsInter [ iCount ] = true; 4663 puhInterDirNeighbours[ iCount ] = ivCandDir[0]; 4664 4665 if( ( ivCandDir[0] & 1 ) == 1 ) 4666 { 4667 pcMvFieldNeighbours[ iCount<<1 ].setMvField( ivCandMv[ 0 ], ivCandRefIdx[ 0 ] ); 4668 } 4669 if( ( ivCandDir[0] & 2 ) == 2 ) 4670 { 4671 pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( ivCandMv[ 1 ], ivCandRefIdx[ 1 ] ); 4672 } 4673 #if QC_DEPTH_IV_MRG_F0125 4674 if ( bIsDepth ) 4675 { 4676 Bool bRemoveSpa = false; 4677 Int iCnloop = iCount-1; 4678 for(; iCnloop >= 0; iCnloop --) 4679 { 4680 if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1]) 4681 { 4682 bRemoveSpa = true; 4683 abCandIsInter [ iCount ] = false; 4684 4685 puhInterDirNeighbours[iCount] = 0; 4686 pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID ); 4687 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID ); 4688 break; 4689 } 4690 } 4691 if(!bRemoveSpa) 4692 { 4693 bDepthIPMCAvai = true; 4694 } 4695 } 4696 if ( bDepthIPMCAvai || !bIsDepth ) 4697 { 4698 #endif 4699 if ( mrgCandIdx == iCount ) 4700 { 4701 return; 4702 } 4703 iCount ++; 4704 #if QC_DEPTH_IV_MRG_F0125 4705 } 4706 #endif 4707 4708 #endif 4709 4710 } 4711 4712 // early termination 4713 if (iCount == getSlice()->getMaxNumMergeCand()) 4714 { 4715 return; 4716 } 4717 #endif 4718 4719 4720 4721 4722 4723 #if ETRIKHU_MERGE_REUSE_F0093 4724 iCount += numA1B1B0; 4725 #else 4726 #if H_3D 4727 //////////////////////////// 4728 //////// LEFT (A1) ///////// 4729 //////////////////////////// 4730 #endif 4731 //left 4732 UInt uiLeftPartIdx = 0; 4733 TComDataCU* pcCULeft = 0; 4734 pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB ); 4735 Bool isAvailableA1 = pcCULeft && 4736 pcCULeft->isDiffMER(xP -1, yP+nPSH-1, xP, yP) && 4737 !( uiPUIdx == 1 && (cCurPS == SIZE_Nx2N || cCurPS == SIZE_nLx2N || cCurPS == SIZE_nRx2N) ) && 4738 !pcCULeft->isIntra( uiLeftPartIdx ) ; 4739 if ( isAvailableA1 ) 4740 { 4741 abCandIsInter[iCount] = true; 4742 // get Inter Dir 4743 puhInterDirNeighbours[iCount] = pcCULeft->getInterDir( uiLeftPartIdx ); 4744 // get Mv from Left 4745 pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 4746 if ( getSlice()->isInterB() ) 4747 { 4748 pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 4749 } 4750 #if H_3D_IV_MERGE 4751 Bool bRemoveSpa = false; //pruning to inter-view candidates 4752 #if QC_DEPTH_IV_MRG_F0125 4753 Int iCnloop = bDepthIPMCAvai ? (iCount-2): (iCount-1); 4754 #else 4755 Int iCnloop = iCount - 1; 4756 #endif 4757 for(; iCnloop >= 0; iCnloop --) 4758 { 4759 if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1]) 4760 { 4761 bRemoveSpa = true; 4762 abCandIsInter [ iCount ] = false; 4763 4764 //reset to the default value for MC 4765 puhInterDirNeighbours[iCount] = 0; 4766 pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID ); 4767 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID ); 4768 break; 4769 } 4770 } 4771 if(!bRemoveSpa) 4772 { 4773 bLeftAvai = true; 4774 iPosLeftAbove[0] = iCount; 4775 #if H_3D_NBDV 4776 pcMvFieldNeighbours[iCount<<1 ].getMv().setIDVFlag (false); 4777 pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false); 4778 #endif 4779 #if H_3D_VSP 4780 if (pcCULeft->getVSPFlag(uiLeftPartIdx) == 1 4781 #if LGE_SHARP_VSP_INHERIT_F0104 4782 #if H_3D_IC 4783 && !bICFlag 4784 #endif 4785 #if H_3D_ARP 4786 && !bARPFlag 4787 #endif 4788 #endif 4789 ) 4790 { 4791 vspFlag[iCount] = 1; 4792 #if !MTK_VSP_SIMPLIFICATION_F0111 4793 xInheritVSPDisInfo(pcCULeft,uiLeftPartIdx,iCount,inheritedVSPDisInfo); 4794 #endif 4795 } 4796 #endif 4797 if ( mrgCandIdx == iCount ) 4798 { 4799 return; 4800 } 4801 iCount ++; 4802 } 4803 #else // H_3D_IV_MERGE 4804 if ( mrgCandIdx == iCount ) 4805 { 4806 return; 4807 } 4808 iCount ++; 4809 #endif // H_3D_IV_MERGE 4810 } 4811 4812 // early termination 4813 if (iCount == getSlice()->getMaxNumMergeCand()) 4814 { 4815 return; 4816 } 4817 #if H_3D 4818 //////////////////////////// 4819 //////// ABOVE (B1) //////// 4820 //////////////////////////// 4821 #endif 4822 // above 4823 UInt uiAbovePartIdx = 0; 4824 TComDataCU* pcCUAbove = 0; 4825 pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT ); 4826 Bool isAvailableB1 = pcCUAbove && 4827 pcCUAbove->isDiffMER(xP+nPSW-1, yP-1, xP, yP) && 4828 !( uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD) ) && 4829 !pcCUAbove->isIntra( uiAbovePartIdx ); 4830 if ( isAvailableB1 && (!isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAbove, uiAbovePartIdx ) ) ) 4831 { 4832 abCandIsInter[iCount] = true; 4833 // get Inter Dir 4834 puhInterDirNeighbours[iCount] = pcCUAbove->getInterDir( uiAbovePartIdx ); 4835 // get Mv from Left 4836 pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 4837 if ( getSlice()->isInterB() ) 4838 { 4839 pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 4840 } 4841 #if H_3D_IV_MERGE 4842 Bool bRemoveSpa = false; //pruning to inter-view candidates 4843 #if QC_DEPTH_IV_MRG_F0125 4844 Int iCnloop; 4845 if( bIsDepth ) 4846 iCnloop = (bLeftAvai && bDepthIPMCAvai) ? (iCount-3) : ((bLeftAvai || bDepthIPMCAvai) ? (iCount-2): (iCount-1)); 4847 else 4848 iCnloop = bLeftAvai? (iCount-2): (iCount-1); 4849 #else 4850 Int iCnloop = bLeftAvai? (iCount-2): (iCount-1); 4851 #endif 4852 for(; iCnloop >= 0; iCnloop --) 4853 { 4854 if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1]) 4855 { 4856 bRemoveSpa = true; 4857 abCandIsInter [ iCount ] = false; 4858 4859 //reset to the default value for MC 4860 puhInterDirNeighbours[iCount] = 0; 4861 4862 pcMvFieldNeighbours[iCount<<1] .setMvField( cZeroMv, NOT_VALID ); 4863 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID ); 4864 break; 4865 } 4866 } 4867 4868 if(!bRemoveSpa) 4869 { 4870 iPosLeftAbove[1] = iCount; 4871 #if H_3D_NBDV 4872 pcMvFieldNeighbours[iCount<<1 ].getMv().setIDVFlag (false); 4873 pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false); 4874 #endif 4875 #if H_3D_VSP 4876 #if MTK_VSP_SIMPLIFICATION_F0111 4877 if ( ( ( getAddr() - pcCUAbove->getAddr() ) == 0) && (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1) 4878 #if LGE_SHARP_VSP_INHERIT_F0104 4879 #if H_3D_IC 4880 && !bICFlag 4881 #endif 4882 #if H_3D_ARP 4883 && !bARPFlag 4884 #endif 4885 #endif 4886 ) 4887 #else 4888 if (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1 4889 #if LGE_SHARP_VSP_INHERIT_F0104 4890 #if H_3D_IC 4891 && !bICFlag 4892 #endif 4893 #if H_3D_ARP 4894 && !bARPFlag 4895 #endif 4896 #endif 4897 ) 4898 #endif 4899 { 4900 4901 vspFlag[iCount] = 1; 4902 #if !MTK_VSP_SIMPLIFICATION_F0111 4903 xInheritVSPDisInfo(pcCUAbove,uiAbovePartIdx,iCount,inheritedVSPDisInfo); 4904 #endif 4905 } 4906 #endif 4907 if ( mrgCandIdx == iCount ) 4908 { 4909 return; 4910 } 4911 iCount ++; 4912 } 4913 #else // H_3D_IV_MERGE 4914 if ( mrgCandIdx == iCount ) 4915 { 4916 return; 4917 } 4918 iCount ++; 4919 #endif // H_3D_IV_MERGE 4920 } 4921 // early termination 4922 if (iCount == getSlice()->getMaxNumMergeCand()) 4923 { 4924 return; 4925 } 4926 4927 #if H_3D 4928 ////////////////////////////////// 4929 //////// ABOVE RIGHT (B0) //////// 4930 ////////////////////////////////// 4931 #endif 4932 4933 // above right 4934 UInt uiAboveRightPartIdx = 0; 4935 TComDataCU* pcCUAboveRight = 0; 4936 pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT ); 4937 Bool isAvailableB0 = pcCUAboveRight && 4938 pcCUAboveRight->isDiffMER(xP+nPSW, yP-1, xP, yP) && 4939 !pcCUAboveRight->isIntra( uiAboveRightPartIdx ); 4940 if ( isAvailableB0 && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) ) 4941 { 4942 abCandIsInter[iCount] = true; 4943 // get Inter Dir 4944 puhInterDirNeighbours[iCount] = pcCUAboveRight->getInterDir( uiAboveRightPartIdx ); 4945 // get Mv from Left 4946 pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 4947 if ( getSlice()->isInterB() ) 4948 { 4949 pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 4950 } 4951 #if H_3D_NBDV 4952 pcMvFieldNeighbours[iCount<<1 ].getMv().setIDVFlag (false); 4953 pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false); 4954 #endif 4955 #if H_3D_VSP 4956 #if MTK_VSP_SIMPLIFICATION_F0111 4957 if ( ( ( getAddr() - pcCUAboveRight->getAddr() ) == 0) && (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1) 4958 #if LGE_SHARP_VSP_INHERIT_F0104 4959 #if H_3D_IC 4960 && !bICFlag 4961 #endif 4962 #if H_3D_ARP 4963 && !bARPFlag 4964 #endif 4965 #endif 4966 ) 4967 #else 4968 if (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1 4969 #if LGE_SHARP_VSP_INHERIT_F0104 4970 #if H_3D_IC 4971 && !bICFlag 4972 #endif 4973 #if H_3D_ARP 4974 && !bARPFlag 4975 #endif 4976 #endif 4977 ) 4978 #endif 4979 { 4980 vspFlag[iCount] = 1; 4981 #if !MTK_VSP_SIMPLIFICATION_F0111 4982 xInheritVSPDisInfo(pcCUAboveRight,uiAboveRightPartIdx,iCount,inheritedVSPDisInfo); 4983 #endif 4984 } 4985 #endif 4986 if ( mrgCandIdx == iCount ) 4987 { 4988 return; 4989 } 4990 iCount ++; 4991 } 4992 // early termination 4993 if (iCount == getSlice()->getMaxNumMergeCand()) 4994 { 4995 return; 4996 } 4997 #endif 4998 4999 5000 #if H_3D_IV_MERGE 5001 ///////////////////////////////////////////// 5002 //////// INTER VIEW DISP COMP (IvDC) //////// 5003 ///////////////////////////////////////////// 5004 5005 #if ETRIKHU_MERGE_REUSE_F0093 5006 if( ivCandDir[1] && iCount < getSlice()->getMaxNumMergeCand()) 5007 #else 5008 if( ivCandDir[1] ) 5009 #endif 5010 { 5011 assert(iCount < getSlice()->getMaxNumMergeCand()); 5012 5013 #if ETRIKHU_MERGE_REUSE_F0093 5014 tmpMV[0].setMvField( cZeroMv, NOT_VALID ); 5015 tmpMV[1].setMvField( cZeroMv, NOT_VALID ); 5016 if( ( ivCandDir[1] & 1 ) == 1 ) 5017 { 5018 tmpMV[0].setMvField( ivCandMv[ 2 ], ivCandRefIdx[ 2 ] ); 5019 } 5020 if( ( ivCandDir[1] & 2 ) == 2 ) 5021 { 5022 tmpMV[1].setMvField( ivCandMv[ 3 ], ivCandRefIdx[ 3 ] ); 5023 } 5024 #else 5025 abCandIsInter [ iCount ] = true; 5026 puhInterDirNeighbours[ iCount ] = ivCandDir[1]; 5027 if( ( ivCandDir[1] & 1 ) == 1 ) 5028 { 5029 pcMvFieldNeighbours[ iCount<<1 ].setMvField( ivCandMv[ 2 ], ivCandRefIdx[ 2 ] ); 5030 } 5031 if( ( ivCandDir[1] & 2 ) == 2 ) 5032 { 5033 pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( ivCandMv[ 3 ], ivCandRefIdx[ 3 ] ); 5034 } 5035 #endif 5036 5037 Bool bRemoveSpa = false; //pruning to A1, B1 5038 for(Int i = 0; i < 2; i ++) 5039 { 5040 Int iCnloop = iPosLeftAbove[i]; 5041 if ( iCnloop == -1 ) 5042 { 5043 continue; 5044 } 5045 if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1]) 5046 { 5047 bRemoveSpa = true; 5048 #if !ETRIKHU_MERGE_REUSE_F0093 5049 abCandIsInter [ iCount ] = false; 5050 //reset to the default value for MC 5051 puhInterDirNeighbours[iCount] = 0; 5052 pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID ); 5053 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID ); 5054 #endif 5055 break; 5056 } 5057 } 5058 if(!bRemoveSpa) 5059 { 5060 #if ETRIKHU_MERGE_REUSE_F0093 5061 rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV); 5062 puhInterDirNeighbours[ iCount ] = ivCandDir[1]; 5063 if( ( ivCandDir[1] & 1 ) == 1 ) 5064 { 5065 pcMvFieldNeighbours[ iCount<<1 ].setMvField( ivCandMv[ 2 ], ivCandRefIdx[ 2 ] ); 5066 } 5067 if( ( ivCandDir[1] & 2 ) == 2 ) 5068 { 5069 pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( ivCandMv[ 3 ], ivCandRefIdx[ 3 ] ); 5070 } 5071 #endif 5072 #if H_3D_NBDV 5073 pcMvFieldNeighbours[iCount<<1 ].getMv().setIDVFlag (false); 5074 pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false); 5075 #endif 5076 posIvDC = iCount; 5077 if ( mrgCandIdx == iCount ) 5078 return; 5079 iCount ++; 5080 5081 // early termination 5082 if (iCount == getSlice()->getMaxNumMergeCand()) 5083 { 5084 return; 5085 } 5086 } 5087 } 5088 #endif // H_3D_IV_MERGE 5089 5090 #if H_3D_VSP 5091 ///////////////////////////////////////////////// 5092 //////// VIEW SYNTHESIS PREDICTION (VSP) //////// 5093 ///////////////////////////////////////////////// 5094 #if ETRIKHU_MERGE_REUSE_F0093 5095 if (iCount<getSlice()->getMaxNumMergeCand()) 5096 { 5097 #endif 5098 5099 if ( 5100 #if LGE_SHARP_VSP_INHERIT_F0104 5101 #if H_3D_IC 5102 !bICFlag && 5103 #endif 5104 #if H_3D_ARP 5105 !bARPFlag && 5106 #endif 5107 #endif 5108 #if ETRIKHU_MERGE_REUSE_F0093 5109 xAddVspCand( mrgCandIdx, &cDisInfo, iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, iCount3DV, inheritedVSPDisInfo ) ) 5110 #else 5111 xAddVspCand( mrgCandIdx, &cDisInfo, iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag ) ) 5112 #endif 5113 { 5114 return; 5115 } 5116 5117 // early termination 5118 if (iCount == getSlice()->getMaxNumMergeCand()) 5119 { 5120 return; 5121 } 5122 #endif 5123 #if ETRIKHU_MERGE_REUSE_F0093 5124 } 5125 #endif 5126 5127 #if ETRIKHU_MERGE_REUSE_F0093 5128 iCount += numA0B2; 5129 #else 5130 #if H_3D 5131 /////////////////////////////////// 5132 //////// LEFT BOTTOM (A0) //////// 5133 /////////////////////////////////// 5134 #endif 5135 5136 //left bottom 5137 UInt uiLeftBottomPartIdx = 0; 5138 TComDataCU* pcCULeftBottom = 0; 5139 pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB ); 5140 Bool isAvailableA0 = pcCULeftBottom && 5141 pcCULeftBottom->isDiffMER(xP-1, yP+nPSH, xP, yP) && 5142 !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) ; 5143 if ( isAvailableA0 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) ) 5144 { 5145 abCandIsInter[iCount] = true; 5146 // get Inter Dir 5147 puhInterDirNeighbours[iCount] = pcCULeftBottom->getInterDir( uiLeftBottomPartIdx ); 5148 // get Mv from Left 5149 pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 5150 if ( getSlice()->isInterB() ) 5151 { 5152 pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 5153 } 5154 #if H_3D_NBDV 5155 pcMvFieldNeighbours[iCount<<1 ].getMv().setIDVFlag (false); 5156 pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false); 5157 #endif 5158 #if H_3D_VSP 5159 if (pcCULeftBottom->getVSPFlag(uiLeftBottomPartIdx) == 1 5160 #if LGE_SHARP_VSP_INHERIT_F0104 5161 #if H_3D_IC 5162 && !bICFlag 5163 #endif 5164 #if H_3D_ARP 5165 && !bARPFlag 5166 #endif 5167 #endif 5168 ) 5169 { 5170 vspFlag[iCount] = 1; 5171 #if !MTK_VSP_SIMPLIFICATION_F0111 5172 xInheritVSPDisInfo(pcCULeftBottom,uiLeftBottomPartIdx,iCount,inheritedVSPDisInfo); 5173 #endif 5174 } 5175 #endif 5176 if ( mrgCandIdx == iCount ) 5177 { 5178 return; 5179 } 5180 iCount ++; 5181 } 5182 // early termination 5183 if (iCount == getSlice()->getMaxNumMergeCand()) 5184 { 5185 return; 5186 } 5187 #if H_3D 5188 /////////////////////////////////// 5189 //////// LEFT ABOVE (B2) //////// 5190 /////////////////////////////////// 5191 #endif 5192 5193 // above left 5194 if( iCount < 4 ) 5195 { 5196 UInt uiAboveLeftPartIdx = 0; 5197 TComDataCU* pcCUAboveLeft = 0; 5198 pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr ); 5199 Bool isAvailableB2 = pcCUAboveLeft && 5200 pcCUAboveLeft->isDiffMER(xP-1, yP-1, xP, yP) && 5201 !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx ); 5202 if ( isAvailableB2 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) 5203 && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) ) 5204 { 5205 abCandIsInter[iCount] = true; 5206 // get Inter Dir 5207 puhInterDirNeighbours[iCount] = pcCUAboveLeft->getInterDir( uiAboveLeftPartIdx ); 5208 // get Mv from Left 5209 pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 5210 if ( getSlice()->isInterB() ) 5211 { 5212 pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 5213 } 5214 #if H_3D_NBDV 5215 pcMvFieldNeighbours[iCount<<1 ].getMv().setIDVFlag (false); 5216 pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false); 5217 #endif 5218 #if H_3D_VSP 5219 #if MTK_VSP_SIMPLIFICATION_F0111 5220 if ( ( ( getAddr() - pcCUAboveLeft->getAddr() ) == 0) && (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1) 5221 #if LGE_SHARP_VSP_INHERIT_F0104 5222 #if H_3D_IC 5223 && !bICFlag 5224 #endif 5225 #if H_3D_ARP 5226 && !bARPFlag 5227 #endif 5228 #endif 5229 ) 5230 #else 5231 if (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1 5232 #if LGE_SHARP_VSP_INHERIT_F0104 5233 #if H_3D_IC 5234 && !bICFlag 5235 #endif 5236 #if H_3D_ARP 5237 && !bARPFlag 5238 #endif 5239 #endif 5240 ) 5241 #endif 5242 { 5243 vspFlag[iCount] = 1; 5244 #if !MTK_VSP_SIMPLIFICATION_F0111 5245 xInheritVSPDisInfo(pcCUAboveLeft,uiAboveLeftPartIdx,iCount,inheritedVSPDisInfo); 5246 #endif 5247 } 5248 #endif 5249 if ( mrgCandIdx == iCount ) 5250 { 5251 return; 5252 } 5253 iCount ++; 5254 } 5255 } 5256 // early termination 5257 if (iCount == getSlice()->getMaxNumMergeCand()) 5258 { 5259 return; 5260 } 5261 #endif 5262 5263 5264 #if H_3D_IV_MERGE 5265 //////////////////////////////////////////////////// 5266 //////// SHIFTED IV (IvMCShift + IvDCShift) //////// 5267 //////////////////////////////////////////////////// 5268 #if ETRIKHU_MERGE_REUSE_F0093 5269 if( ivMvPredFlag && iCount < getSlice()->getMaxNumMergeCand() ) 5270 { 5271 if(xAddIvMRGCand( mrgCandIdx, iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, ivCandDir, ivCandMv, ivCandRefIdx, posIvDC, vspFlag, iCount3DV, inheritedVSPDisInfo ) ) 5272 #else 5273 if( ivMvPredFlag ) 5274 { 5275 if(xAddIvMRGCand( mrgCandIdx, iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, ivCandDir, ivCandMv, ivCandRefIdx, posIvDC, vspFlag)) 5276 #endif 5277 { 5278 return; 5279 } 5280 //early termination 5281 if (iCount == getSlice()->getMaxNumMergeCand()) 5282 { 5283 return; 5284 } 5285 } 5286 #endif 5287 5288 #if ETRIKHU_MERGE_REUSE_F0093 5289 if (iCountHEVC + iCount3DV > getSlice()->getMaxNumMergeCand()) 5290 { 5291 iCount = getSlice()->getMaxNumMergeCand(); 5292 } 5293 else 5294 { 5295 iCount = iCountHEVC + iCount3DV; 5296 } 5297 numValidMergeCand = iCount; 5298 #else 5299 #if H_3D 5300 ///////////////////////////////// 5301 //////// Collocate (COL) //////// 5302 ///////////////////////////////// 5303 #endif 5304 if ( getSlice()->getEnableTMVPFlag()) 5305 { 5306 //>> MTK colocated-RightBottom 5307 UInt uiPartIdxRB; 5308 5309 deriveRightBottomIdx( uiPUIdx, uiPartIdxRB ); 5310 5311 UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB]; 5312 UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); 5313 5314 TComMv cColMv; 5315 Int iRefIdx; 5316 Int uiLCUIdx = -1; 5317 5318 if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) // image boundary check 5319 { 5320 } 5321 else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) 5322 { 5323 } 5324 else 5325 { 5326 if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) && // is not at the last column of LCU 5327 ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row of LCU 5328 { 5329 uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ]; 5330 uiLCUIdx = getAddr(); 5331 } 5332 else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) // is not at the last column of LCU But is last row of LCU 5333 { 5334 uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ]; 5335 } 5336 else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU 5337 { 5338 uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ]; 5339 uiLCUIdx = getAddr() + 1; 5340 } 5341 else //is the right bottom corner of LCU 5342 { 5343 uiAbsPartAddr = 0; 5344 } 5345 } 5346 5347 5348 iRefIdx = 0; 5349 Bool bExistMV = false; 5350 UInt uiPartIdxCenter; 5351 UInt uiCurLCUIdx = getAddr(); 5352 Int dir = 0; 5353 UInt uiArrayAddr = iCount; 5354 xDeriveCenterIdx( uiPUIdx, uiPartIdxCenter ); 5355 bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_0, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx ); 5356 if( bExistMV == false ) 5357 { 5358 bExistMV = xGetColMVP( REF_PIC_LIST_0, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx ); 5359 } 5360 if( bExistMV ) 5361 { 5362 dir |= 1; 5363 pcMvFieldNeighbours[ 2 * uiArrayAddr ].setMvField( cColMv, iRefIdx ); 5364 } 5365 5366 if ( getSlice()->isInterB() ) 5367 { 5368 #if H_3D_TMVP 5369 iRefIdx = 0; 5370 #endif 5371 bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_1, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx); 5372 if( bExistMV == false ) 5373 { 5374 bExistMV = xGetColMVP( REF_PIC_LIST_1, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx ); 5375 } 5376 if( bExistMV ) 5377 { 5378 dir |= 2; 5379 pcMvFieldNeighbours[ 2 * uiArrayAddr + 1 ].setMvField( cColMv, iRefIdx ); 5380 } 5381 } 5382 5383 if (dir != 0) 5384 { 5385 puhInterDirNeighbours[uiArrayAddr] = dir; 5386 abCandIsInter[uiArrayAddr] = true; 5387 #if H_3D_NBDV 5388 pcMvFieldNeighbours[iCount<<1 ].getMv().setIDVFlag (false); 5389 pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false); 5390 #endif 5391 if ( mrgCandIdx == iCount ) 5392 { 5393 return; 5394 } 5395 iCount++; 5396 } 5397 } 5398 // early termination 5399 if (iCount == getSlice()->getMaxNumMergeCand()) 5400 { 5401 return; 5402 } 5403 UInt uiArrayAddr = iCount; 5404 UInt uiCutoff = uiArrayAddr; 5405 5406 if ( getSlice()->isInterB()) 5407 { 5408 #if H_3D_IV_MERGE 5409 UInt uiPriorityList0[20] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3, 0, 4, 1, 4, 2, 4, 3, 4 }; 5410 UInt uiPriorityList1[20] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2, 4, 0, 4, 1, 4, 2, 4, 3 }; 5411 #else 5412 UInt uiPriorityList0[12] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3}; 5413 UInt uiPriorityList1[12] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2}; 5414 #endif 5415 5416 for (Int idx=0; idx<uiCutoff*(uiCutoff-1) && uiArrayAddr!= getSlice()->getMaxNumMergeCand(); idx++) 5417 { 5418 Int i = uiPriorityList0[idx]; Int j = uiPriorityList1[idx]; 5419 #if H_3D_VSP 5420 Bool bValid = true; 5421 if ( vspFlag[i] == 1 || vspFlag[j] == 1 ) 5422 { 5423 bValid = false; 5424 } 5425 if( !m_pcSlice->getVPS()->getViewSynthesisPredFlag( m_pcSlice->getLayerIdInVps() ) ) 5426 { 5427 assert(bValid == true); 5428 } 5429 #endif 5430 #if H_3D_VSP 5431 if (abCandIsInter[i] && abCandIsInter[j] && (puhInterDirNeighbours[i]&0x1) && (puhInterDirNeighbours[j]&0x2) && bValid) 5432 #else 5433 if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2)) 5434 #endif 5435 { 5436 abCandIsInter[uiArrayAddr] = true; 5437 puhInterDirNeighbours[uiArrayAddr] = 3; 5438 5439 // get Mv from cand[i] and cand[j] 5440 pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(pcMvFieldNeighbours[i<<1].getMv(), pcMvFieldNeighbours[i<<1].getRefIdx()); 5441 pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(pcMvFieldNeighbours[(j<<1)+1].getMv(), pcMvFieldNeighbours[(j<<1)+1].getRefIdx()); 5442 5443 Int iRefPOCL0 = m_pcSlice->getRefPOC( REF_PIC_LIST_0, pcMvFieldNeighbours[(uiArrayAddr<<1)].getRefIdx() ); 5444 Int iRefPOCL1 = m_pcSlice->getRefPOC( REF_PIC_LIST_1, pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getRefIdx() ); 5445 if (iRefPOCL0 == iRefPOCL1 && pcMvFieldNeighbours[(uiArrayAddr<<1)].getMv() == pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getMv()) 5446 { 5447 abCandIsInter[uiArrayAddr] = false; 5448 } 5449 else 5450 { 5451 uiArrayAddr++; 5452 } 5453 } 5454 } 5455 } 5456 // early termination 5457 if (uiArrayAddr == getSlice()->getMaxNumMergeCand()) 5458 { 5459 return; 5460 } 5461 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); 5462 Int r = 0; 5463 Int refcnt = 0; 5464 while (uiArrayAddr < getSlice()->getMaxNumMergeCand()) 5465 { 5466 abCandIsInter[uiArrayAddr] = true; 5467 puhInterDirNeighbours[uiArrayAddr] = 1; 5468 pcMvFieldNeighbours[uiArrayAddr << 1].setMvField( TComMv(0, 0), r); 5469 5470 if ( getSlice()->isInterB() ) 5471 { 5472 puhInterDirNeighbours[uiArrayAddr] = 3; 5473 pcMvFieldNeighbours[(uiArrayAddr << 1) + 1].setMvField(TComMv(0, 0), r); 5474 } 5475 uiArrayAddr++; 5476 if ( refcnt == iNumRefIdx - 1 ) 5477 { 5478 r = 0; 5479 } 5480 else 5481 { 5482 ++r; 5483 ++refcnt; 5484 } 5485 } 5486 5487 numValidMergeCand = uiArrayAddr; 5488 #endif 5489 } 5490 5491 5492 5493 5494 #else 5495 3471 5496 /** Constructs a list of merging candidates 3472 5497 * \param uiAbsPartIdx … … 3522 5547 deriveLeftRightTopIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT ); 3523 5548 deriveLeftBottomIdxGeneral ( uiAbsPartIdx, uiPUIdx, uiPartIdxLB ); 5549 #if SEC_MPI_ENABLING_MERGE_F0150 5550 Bool bMPIFlag = getSlice()->getVPS()->getMPIFlag( getSlice()->getLayerIdInVps() ); 5551 #endif 5552 #if QC_DEPTH_IV_MRG_F0125 5553 Bool bIsDepth = getSlice()->getIsDepth(); 5554 Bool bDepthIPMCAvai = false; 5555 #endif 5556 5557 #if LGE_SHARP_VSP_INHERIT_F0104 5558 #if H_3D_IC 5559 Bool bICFlag = getICFlag(uiAbsPartIdx); 5560 #endif 5561 #if H_3D_ARP 5562 Bool bARPFlag = getARPW(uiAbsPartIdx)>0 ? true : false; 5563 #endif 5564 #endif 5565 3524 5566 #if H_3D_IV_MERGE 3525 5567 … … 3528 5570 ///////////////////////////////////////////// 3529 5571 5572 #if SEC_MPI_ENABLING_MERGE_F0150 5573 if( bMPIFlag) 5574 #else 3530 5575 if( m_pcSlice->getIsDepth()) 5576 #endif 3531 5577 { 3532 5578 UInt uiPartIdxCenter; … … 3621 5667 if ( ivMvPredFlag ) 3622 5668 { 3623 getInterViewMergeCands(uiPUIdx, ivCandRefIdx, ivCandMv, &cDisInfo, ivCandDir ); 5669 getInterViewMergeCands(uiPUIdx, ivCandRefIdx, ivCandMv, &cDisInfo, ivCandDir 5670 #if QC_DEPTH_IV_MRG_F0125 5671 , bIsDepth 5672 #endif 5673 ); 3624 5674 } 3625 5675 … … 3642 5692 } 3643 5693 5694 #if QC_DEPTH_IV_MRG_F0125 5695 if ( bIsDepth ) 5696 { 5697 Bool bRemoveSpa = false; 5698 Int iCnloop = iCount-1; 5699 for(; iCnloop >= 0; iCnloop --) 5700 { 5701 if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1]) 5702 { 5703 bRemoveSpa = true; 5704 abCandIsInter [ iCount ] = false; 5705 5706 puhInterDirNeighbours[iCount] = 0; 5707 pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID ); 5708 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID ); 5709 break; 5710 } 5711 } 5712 if(!bRemoveSpa) 5713 { 5714 bDepthIPMCAvai = true; 5715 } 5716 } 5717 if ( bDepthIPMCAvai || !bIsDepth ) 5718 { 5719 #endif 3644 5720 if ( mrgCandIdx == iCount ) 3645 5721 { … … 3647 5723 } 3648 5724 iCount ++; 5725 #if QC_DEPTH_IV_MRG_F0125 5726 } 5727 #endif 3649 5728 } 3650 5729 … … 3682 5761 #if H_3D_IV_MERGE 3683 5762 Bool bRemoveSpa = false; //pruning to inter-view candidates 5763 #if QC_DEPTH_IV_MRG_F0125 5764 Int iCnloop = bDepthIPMCAvai ? (iCount-2): (iCount-1); 5765 #else 3684 5766 Int iCnloop = iCount - 1; 5767 #endif 3685 5768 for(; iCnloop >= 0; iCnloop --) 3686 5769 { … … 3706 5789 #endif 3707 5790 #if H_3D_VSP 3708 if (pcCULeft->getVSPFlag(uiLeftPartIdx) == 1) 5791 if (pcCULeft->getVSPFlag(uiLeftPartIdx) == 1 5792 #if LGE_SHARP_VSP_INHERIT_F0104 5793 #if H_3D_IC 5794 && !bICFlag 5795 #endif 5796 #if H_3D_ARP 5797 && !bARPFlag 5798 #endif 5799 #endif 5800 ) 3709 5801 { 3710 5802 vspFlag[iCount] = 1; 5803 #if !MTK_VSP_SIMPLIFICATION_F0111 3711 5804 xInheritVSPDisInfo(pcCULeft,uiLeftPartIdx,iCount,inheritedVSPDisInfo); 5805 #endif 3712 5806 } 3713 5807 #endif … … 3758 5852 #if H_3D_IV_MERGE 3759 5853 Bool bRemoveSpa = false; //pruning to inter-view candidates 5854 #if QC_DEPTH_IV_MRG_F0125 5855 Int iCnloop; 5856 if( bIsDepth ) 5857 iCnloop = (bLeftAvai && bDepthIPMCAvai) ? (iCount-3) : ((bLeftAvai || bDepthIPMCAvai) ? (iCount-2): (iCount-1)); 5858 else 5859 iCnloop = bLeftAvai? (iCount-2): (iCount-1); 5860 #else 3760 5861 Int iCnloop = bLeftAvai? (iCount-2): (iCount-1); 5862 #endif 3761 5863 for(; iCnloop >= 0; iCnloop --) 3762 5864 { … … 3783 5885 #endif 3784 5886 #if H_3D_VSP 3785 if (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1) 5887 #if MTK_VSP_SIMPLIFICATION_F0111 5888 if ( ( ( getAddr() - pcCUAbove->getAddr() ) == 0) && (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1) 5889 #if LGE_SHARP_VSP_INHERIT_F0104 5890 #if H_3D_IC 5891 && !bICFlag 5892 #endif 5893 #if H_3D_ARP 5894 && !bARPFlag 5895 #endif 5896 #endif 5897 ) 5898 #else 5899 if (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1 5900 #if LGE_SHARP_VSP_INHERIT_F0104 5901 #if H_3D_IC 5902 && !bICFlag 5903 #endif 5904 #if H_3D_ARP 5905 && !bARPFlag 5906 #endif 5907 #endif 5908 ) 5909 #endif 3786 5910 { 3787 5911 3788 5912 vspFlag[iCount] = 1; 5913 #if !MTK_VSP_SIMPLIFICATION_F0111 3789 5914 xInheritVSPDisInfo(pcCUAbove,uiAbovePartIdx,iCount,inheritedVSPDisInfo); 5915 #endif 3790 5916 } 3791 5917 #endif … … 3839 5965 #endif 3840 5966 #if H_3D_VSP 3841 if (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1) 5967 #if MTK_VSP_SIMPLIFICATION_F0111 5968 if ( ( ( getAddr() - pcCUAboveRight->getAddr() ) == 0) && (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1) 5969 #if LGE_SHARP_VSP_INHERIT_F0104 5970 #if H_3D_IC 5971 && !bICFlag 5972 #endif 5973 #if H_3D_ARP 5974 && !bARPFlag 5975 #endif 5976 #endif 5977 ) 5978 #else 5979 if (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1 5980 #if LGE_SHARP_VSP_INHERIT_F0104 5981 #if H_3D_IC 5982 && !bICFlag 5983 #endif 5984 #if H_3D_ARP 5985 && !bARPFlag 5986 #endif 5987 #endif 5988 ) 5989 #endif 3842 5990 { 3843 5991 vspFlag[iCount] = 1; 5992 #if !MTK_VSP_SIMPLIFICATION_F0111 3844 5993 xInheritVSPDisInfo(pcCUAboveRight,uiAboveRightPartIdx,iCount,inheritedVSPDisInfo); 5994 #endif 3845 5995 } 3846 5996 #endif … … 3920 6070 ///////////////////////////////////////////////// 3921 6071 3922 if ( xAddVspCand( mrgCandIdx, &cDisInfo, iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag ) ) 6072 if ( 6073 #if LGE_SHARP_VSP_INHERIT_F0104 6074 #if H_3D_IC 6075 !bICFlag && 6076 #endif 6077 #if H_3D_ARP 6078 !bARPFlag && 6079 #endif 6080 #endif 6081 xAddVspCand( mrgCandIdx, &cDisInfo, iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag ) ) 3923 6082 { 3924 6083 return; … … 3960 6119 #endif 3961 6120 #if H_3D_VSP 3962 if (pcCULeftBottom->getVSPFlag(uiLeftBottomPartIdx) == 1) 6121 if (pcCULeftBottom->getVSPFlag(uiLeftBottomPartIdx) == 1 6122 #if LGE_SHARP_VSP_INHERIT_F0104 6123 #if H_3D_IC 6124 && !bICFlag 6125 #endif 6126 #if H_3D_ARP 6127 && !bARPFlag 6128 #endif 6129 #endif 6130 ) 3963 6131 { 3964 6132 vspFlag[iCount] = 1; 6133 #if !MTK_VSP_SIMPLIFICATION_F0111 3965 6134 xInheritVSPDisInfo(pcCULeftBottom,uiLeftBottomPartIdx,iCount,inheritedVSPDisInfo); 6135 #endif 3966 6136 } 3967 6137 #endif … … 4009 6179 #endif 4010 6180 #if H_3D_VSP 4011 if (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1) 6181 #if MTK_VSP_SIMPLIFICATION_F0111 6182 if ( ( ( getAddr() - pcCUAboveLeft->getAddr() ) == 0) && (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1) 6183 #if LGE_SHARP_VSP_INHERIT_F0104 6184 #if H_3D_IC 6185 && !bICFlag 6186 #endif 6187 #if H_3D_ARP 6188 && !bARPFlag 6189 #endif 6190 #endif 6191 ) 6192 #else 6193 if (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1 6194 #if LGE_SHARP_VSP_INHERIT_F0104 6195 #if H_3D_IC 6196 && !bICFlag 6197 #endif 6198 #if H_3D_ARP 6199 && !bARPFlag 6200 #endif 6201 #endif 6202 ) 6203 #endif 4012 6204 { 4013 6205 vspFlag[iCount] = 1; 6206 #if !MTK_VSP_SIMPLIFICATION_F0111 4014 6207 xInheritVSPDisInfo(pcCUAboveLeft,uiAboveLeftPartIdx,iCount,inheritedVSPDisInfo); 6208 #endif 4015 6209 } 4016 6210 #endif … … 4235 6429 numValidMergeCand = uiArrayAddr; 4236 6430 } 6431 6432 6433 #endif 6434 6435 4237 6436 #if H_3D_VSP 4238 6437 inline Void TComDataCU::xInheritVSPDisInfo(TComDataCU* pcCURef, UInt uiAbsPartIdx, Int iCount, InheritedVSPDisInfo* inheritedVSPDisInfo) … … 4571 6770 } 4572 6771 6772 #if LGE_IC_CTX_F0160 6773 Bool TComDataCU::isIC( UInt uiPartIdx ) 6774 { 6775 if ( m_pcSlice->isIntra () ) 6776 { 6777 return false; 6778 } 6779 return ( ( getSkipFlag(uiPartIdx) || getPredictionMode(uiPartIdx) == MODE_INTER) && getICFlag( uiPartIdx ) && isICFlagRequired( uiPartIdx ) ); 6780 } 6781 #endif 6782 4573 6783 // ==================================================================================================================== 4574 6784 // Protected member functions … … 5411 7621 riPosX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIndex]] + getCUPelX(); 5412 7622 riPosY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIndex]] + getCUPelY(); 7623 } 7624 #endif 7625 #if QC_DEPTH_IV_MRG_F0125 7626 Bool TComDataCU::getDispNeighBlocks (UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDisp) 7627 { 7628 Pel pDepPos[3] = {0, 0, 0}; 7629 assert(getPartitionSize( uiPartAddr ) == SIZE_2Nx2N); 7630 Bool bDepAvail = false; 7631 Pel *pDepth = this->getPic()->getPicYuvRec()->getLumaAddr(); 7632 Int iDepStride = this->getPic()->getPicYuvRec()->getStride(); 7633 TComMv cMv; 7634 7635 Int xP, yP, nPSW, nPSH; 7636 this->getPartPosition(uiPartIdx, xP, yP, nPSW, nPSH); 7637 7638 if(xP != 0 && yP != 0) 7639 { 7640 pDepPos[0] = pDepth[ (yP-1) * iDepStride + (xP-1) ]; 7641 bDepAvail = true; 7642 } 7643 7644 if(xP != 0) 7645 { 7646 pDepPos[1] = pDepth[ (yP+nPSH-1) * iDepStride + (xP-1) ]; 7647 bDepAvail = true; 7648 } 7649 7650 if(yP != 0) 7651 { 7652 pDepPos[2] = pDepth[ (yP-1) * iDepStride + (xP+nPSW-1) ]; 7653 bDepAvail = true; 7654 } 7655 7656 if (bDepAvail) 7657 { 7658 Pel pAvgDepth = (xP != 0 && yP != 0) ? ((5*pDepPos[0] + 5*pDepPos[1] + 6*pDepPos[2] + 8)>>4) : (xP == 0) ? pDepPos[2] : pDepPos[1]; 7659 Int iDisp = getSlice()->getDepthToDisparityB( 0 )[ pAvgDepth ]; 7660 cMv.setHor(iDisp); 7661 cMv.setVer(0); 7662 pDisp->m_acNBDV = cMv; 7663 pDisp->m_aVIdxCan = 0; 7664 return true; 7665 } 7666 else 7667 { 7668 cMv.setZero(); 7669 pDisp->m_acNBDV = cMv; 7670 pDisp->m_aVIdxCan = 0; 7671 return false; 7672 } 5413 7673 } 5414 7674 #endif … … 5942 8202 } 5943 8203 #endif 8204 8205 #if MTK_SPIVMP_F0110 8206 Void TComDataCU::getSPPara(Int iPUWidth, Int iPUHeight, Int& iNumSP, Int& iNumSPInOneLine, Int& iSPWidth, Int& iSPHeight) 8207 { 8208 Int iSubPUSize = 1<<getSlice()->getVPS()->getSubPULog2Size(getSlice()->getLayerId()); 8209 iNumSPInOneLine = iPUWidth/iSubPUSize; 8210 iNumSPInOneLine = iNumSPInOneLine < 1 ? 1: iNumSPInOneLine; 8211 Int iNumSPInOneColumn = iPUHeight/iSubPUSize; 8212 iNumSPInOneColumn = iNumSPInOneColumn < 1 ? 1: iNumSPInOneColumn; 8213 iNumSP = iNumSPInOneLine * iNumSPInOneColumn; 8214 8215 iSPWidth = iNumSPInOneLine == 1 ? iPUWidth: iSubPUSize; 8216 iSPHeight = iNumSPInOneColumn == 1 ? iPUHeight: iSubPUSize; 8217 } 8218 8219 Void TComDataCU::getSPAbsPartIdx(UInt uiBaseAbsPartIdx, Int iWidth, Int iHeight, Int iPartIdx, Int iNumPartLine, UInt& ruiPartAddr ) 8220 { 8221 uiBaseAbsPartIdx += m_uiAbsIdxInLCU; 8222 Int iBasePelX = g_auiRasterToPelX[g_auiZscanToRaster[uiBaseAbsPartIdx]]; 8223 Int iBasePelY = g_auiRasterToPelY[g_auiZscanToRaster[uiBaseAbsPartIdx]]; 8224 Int iCurrPelX = iBasePelX + iPartIdx%iNumPartLine * iWidth; 8225 Int iCurrPelY = iBasePelY + iPartIdx/iNumPartLine * iHeight; 8226 Int iCurrRaster = iCurrPelY / getPic()->getMinCUHeight() * getPic()->getNumPartInWidth() + iCurrPelX/getPic()->getMinCUWidth(); 8227 ruiPartAddr = g_auiRasterToZscan[iCurrRaster]; 8228 ruiPartAddr -= m_uiAbsIdxInLCU; 8229 } 8230 8231 Void TComDataCU::setInterDirSP( UInt uiDir, UInt uiAbsPartIdx, Int iWidth, Int iHeight ) 8232 { 8233 uiAbsPartIdx += getZorderIdxInCU(); 8234 Int iStartPelX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIdx]]; 8235 Int iStartPelY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIdx]]; 8236 Int iEndPelX = iStartPelX + iWidth; 8237 Int iEndPelY = iStartPelY + iHeight; 8238 8239 Int iCurrRaster, uiPartAddr; 8240 8241 for (Int i=iStartPelY; i<iEndPelY; i+=getPic()->getMinCUHeight()) 8242 { 8243 for (Int j=iStartPelX; j < iEndPelX; j += getPic()->getMinCUWidth()) 8244 { 8245 iCurrRaster = i / getPic()->getMinCUHeight() * getPic()->getNumPartInWidth() + j/getPic()->getMinCUWidth(); 8246 uiPartAddr = g_auiRasterToZscan[iCurrRaster]; 8247 uiPartAddr -= getZorderIdxInCU(); 8248 8249 m_puhInterDir[uiPartAddr] = uiDir; 8250 } 8251 } 8252 } 8253 #endif 8254 5944 8255 #if H_3D_IV_MERGE 5945 8256 Bool 5946 TComDataCU::getInterViewMergeCands(UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc ) 8257 TComDataCU::getInterViewMergeCands(UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc 8258 #if QC_DEPTH_IV_MRG_F0125 8259 , Bool bIsDepth 8260 #endif 8261 #if MTK_SPIVMP_F0110 8262 , TComMvField* pcMvFieldSP, UChar* puhInterDirSP 8263 #endif 8264 ) 5947 8265 { 5948 8266 TComSlice* pcSlice = getSlice (); … … 5950 8268 5951 8269 //--- get base CU/PU and check prediction mode --- 8270 #if QC_DEPTH_IV_MRG_F0125 8271 TComPic* pcBasePic = pcSlice->getIvPic( bIsDepth, iViewIndex ); 8272 #else 5952 8273 TComPic* pcBasePic = pcSlice->getIvPic( false, iViewIndex ); 8274 #endif 5953 8275 TComPicYuv* pcBaseRec = pcBasePic->getPicYuvRec (); 5954 8276 … … 5961 8283 pcBaseRec->getTopLeftSamplePos( getAddr(), getZorderIdxInCU() + uiPartAddr, iCurrPosX, iCurrPosY ); 5962 8284 8285 #if !MTK_SPIVMP_F0110 8286 #if QC_DEPTH_IV_MRG_F0125 8287 iCurrPosX += ( iWidth >> 1 ); 8288 iCurrPosY += ( iHeight >> 1 ); 8289 #else 5963 8290 iCurrPosX += ( ( iWidth - 1 ) >> 1 ); 5964 8291 iCurrPosY += ( ( iHeight - 1 ) >> 1 ); 8292 #endif 8293 #endif 5965 8294 5966 8295 Bool depthRefineFlag = false; … … 5979 8308 #endif 5980 8309 8310 #if MTK_SPIVMP_F0110 8311 //////////////////////////////// 8312 //////////sub-PU IvMC/////////// 8313 //////////////////////////////// 8314 8315 Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight; 8316 getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight); 8317 8318 for (Int i=0; i<iNumSP; i++) 8319 { 8320 puhInterDirSP[i] = 0; 8321 pcMvFieldSP[2*i].getMv().set(0, 0); 8322 pcMvFieldSP[2*i+1].getMv().set(0,0); 8323 pcMvFieldSP[2*i].setRefIdx(-1); 8324 pcMvFieldSP[2*i+1].setRefIdx(-1); 8325 } 8326 8327 Int iBaseCUAddr; 8328 Int iBaseAbsPartIdx; 8329 TComDataCU* pcBaseCU; 8330 Int iPartition = 0; 8331 Int iInterDirLast = 0; 8332 TComMvField cMvFieldLast[2]; 8333 8334 Int iDelX = iSPWidth/2; 8335 Int iDelY = iSPHeight/2; 8336 8337 Int iBasePosX, iBasePosY; 8338 for (Int i=iCurrPosY; i < iCurrPosY + iHeight; i += iSPHeight) 8339 { 8340 for (Int j = iCurrPosX; j < iCurrPosX + iWidth; j += iSPWidth) 8341 { 8342 iBasePosX = Clip3( 0, pcBaseRec->getWidth () - 1, j + iDelX + ( (cDv.getHor() + 2 ) >> 2 )); 8343 iBasePosY = Clip3( 0, pcBaseRec->getHeight() - 1, i + iDelY + ( (cDv.getVer() + 2 ) >> 2 )); 8344 8345 pcBaseRec->getCUAddrAndPartIdx( iBasePosX , iBasePosY, iBaseCUAddr, iBaseAbsPartIdx ); 8346 pcBaseCU = pcBasePic->getCU( iBaseCUAddr ); 8347 if(!( pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) == MODE_INTRA )) 8348 { 8349 for( UInt uiCurrRefListId = 0; uiCurrRefListId < 2; uiCurrRefListId++ ) 8350 { 8351 RefPicList eCurrRefPicList = RefPicList( uiCurrRefListId ); 8352 Bool bLoop_stop = false; 8353 for(Int iLoop = 0; iLoop < 2 && !bLoop_stop; ++iLoop) 8354 { 8355 RefPicList eBaseRefPicList = (iLoop ==1)? RefPicList( 1 - uiCurrRefListId ) : RefPicList( uiCurrRefListId ); 8356 TComMvField cBaseMvField; 8357 pcBaseCU->getMvField( pcBaseCU, iBaseAbsPartIdx, eBaseRefPicList, cBaseMvField ); 8358 Int iBaseRefIdx = cBaseMvField.getRefIdx(); 8359 if (iBaseRefIdx >= 0) 8360 { 8361 Int iBaseRefPOC = pcBaseCU->getSlice()->getRefPOC(eBaseRefPicList, iBaseRefIdx); 8362 if (iBaseRefPOC != pcSlice->getPOC()) 8363 { 8364 for (Int iPdmRefIdx = 0; iPdmRefIdx < pcSlice->getNumRefIdx( eCurrRefPicList ); iPdmRefIdx++) 8365 { 8366 if (iBaseRefPOC == pcSlice->getRefPOC(eCurrRefPicList, iPdmRefIdx)) 8367 { 8368 abPdmAvailable[ uiCurrRefListId ] = true; 8369 TComMv cMv(cBaseMvField.getHor(), cBaseMvField.getVer()); 8370 8371 if( !bIsDepth ) 8372 { 8373 cMv.setIDVFlag (true); 8374 cMv.setIDVHor (cDv.getHor()); 8375 cMv.setIDVVer (cDv.getVer()); 8376 cMv.setIDVVId (iViewIndex); 8377 } 8378 8379 clipMv( cMv ); 8380 bLoop_stop = true; 8381 8382 pcMvFieldSP[2*iPartition + uiCurrRefListId].setMvField(cMv, iPdmRefIdx); 8383 break; 8384 } 8385 } 8386 } 8387 } 8388 } 8389 } 8390 } 8391 8392 puhInterDirSP[iPartition] = (pcMvFieldSP[2*iPartition].getRefIdx()!=-1 ? 1: 0) + (pcMvFieldSP[2*iPartition+1].getRefIdx()!=-1 ? 2: 0); 8393 if (puhInterDirSP[iPartition] == 0) 8394 { 8395 if (iInterDirLast != 0) 8396 { 8397 puhInterDirSP[iPartition] = iInterDirLast; 8398 pcMvFieldSP[2*iPartition] = cMvFieldLast[0]; 8399 pcMvFieldSP[2*iPartition + 1] = cMvFieldLast[1]; 8400 } 8401 } 8402 else 8403 { 8404 if (iInterDirLast ==0) 8405 { 8406 availableMcDc[0] = puhInterDirSP[iPartition]; 8407 paiPdmRefIdx [ 0 ] = pcMvFieldSP[2*iPartition].getRefIdx(); 8408 pacPdmMv [ 0 ] = pcMvFieldSP[2*iPartition].getMv(); 8409 paiPdmRefIdx [ 1 ] = pcMvFieldSP[2*iPartition+1].getRefIdx(); 8410 pacPdmMv [ 1 ] = pcMvFieldSP[2*iPartition+1].getMv(); 8411 8412 if (iPartition != 0) 8413 { 8414 for (Int iPart = iPartition-1; iPart >= 0; iPart--) 8415 { 8416 puhInterDirSP[iPart] = puhInterDirSP[iPartition]; 8417 pcMvFieldSP[2*iPart] = pcMvFieldSP[2*iPartition]; 8418 pcMvFieldSP[2*iPart + 1] = pcMvFieldSP[2*iPartition + 1]; 8419 } 8420 } 8421 } 8422 iInterDirLast = puhInterDirSP[iPartition]; 8423 cMvFieldLast[0] = pcMvFieldSP[2*iPartition]; 8424 cMvFieldLast[1] = pcMvFieldSP[2*iPartition + 1]; 8425 } 8426 8427 iPartition ++; 8428 8429 } 8430 } 8431 8432 iCurrPosX += ( iWidth >> 1 ); 8433 iCurrPosY += ( iHeight >> 1 ); 8434 #endif 8435 5981 8436 //////////////////////////////// 5982 8437 /////// IvMC + IvMCShift /////// 5983 8438 //////////////////////////////// 5984 8439 5985 for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++) 8440 #if MTK_SPIVMP_F0110 8441 for(Int iLoopCan = 1; iLoopCan < 2; iLoopCan ++) 8442 #else 8443 for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++) 8444 #endif 5986 8445 { 5987 8446 // iLoopCan == 0 --> IvMC 5988 8447 // iLoopCan == 1 --> IvMCShift 5989 8448 8449 #if !MTK_SPIVMP_F0110 5990 8450 Int iBaseCUAddr; 5991 8451 Int iBaseAbsPartIdx; 8452 #endif 5992 8453 5993 8454 Int offsetW = (iLoopCan == 0) ? 0 : ( ((iWidth /2)*4) + 4 ); 5994 8455 Int offsetH = (iLoopCan == 0) ? 0 : ( ((iHeight/2)*4) + 4 ); 5995 8456 8457 #if MTK_SPIVMP_F0110 8458 iBasePosX = Clip3( 0, pcBaseRec->getWidth () - 1, iCurrPosX + ( (cDv.getHor() + offsetW + 2 ) >> 2 ) ); 8459 iBasePosY = Clip3( 0, pcBaseRec->getHeight() - 1, iCurrPosY + ( (cDv.getVer() + offsetH + 2 ) >> 2 ) ); 8460 #else 5996 8461 Int iBasePosX = Clip3( 0, pcBaseRec->getWidth () - 1, iCurrPosX + ( (cDv.getHor() + offsetW + 2 ) >> 2 ) ); 5997 8462 Int iBasePosY = Clip3( 0, pcBaseRec->getHeight() - 1, iCurrPosY + ( (cDv.getVer() + offsetH + 2 ) >> 2 ) ); 8463 #endif 5998 8464 pcBaseRec->getCUAddrAndPartIdx( iBasePosX , iBasePosY , iBaseCUAddr, iBaseAbsPartIdx ); 5999 8465 8466 #if MTK_SPIVMP_F0110 8467 pcBaseCU = pcBasePic->getCU( iBaseCUAddr ); 8468 #else 6000 8469 TComDataCU* pcBaseCU = pcBasePic->getCU( iBaseCUAddr ); 8470 #endif 6001 8471 if(!( pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) == MODE_INTRA )) 6002 8472 { … … 6026 8496 TComMv cMv(cBaseMvField.getHor(), cBaseMvField.getVer()); 6027 8497 #if H_3D_NBDV 6028 cMv.setIDVFlag (true); 6029 cMv.setIDVHor (cDv.getHor()); 6030 cMv.setIDVVer (cDv.getVer()); 6031 cMv.setIDVVId (iViewIndex); 8498 #if QC_DEPTH_IV_MRG_F0125 8499 if( !bIsDepth ) 8500 { 8501 #endif 8502 cMv.setIDVFlag (true); 8503 cMv.setIDVHor (cDv.getHor()); 8504 cMv.setIDVVer (cDv.getVer()); 8505 cMv.setIDVVId (iViewIndex); 8506 #if QC_DEPTH_IV_MRG_F0125 8507 } 8508 #endif 6032 8509 #endif 6033 8510 clipMv( cMv ); … … 6044 8521 } 6045 8522 } 8523 #if MTK_SPIVMP_F0110 8524 for(Int iLoopCan = 1; iLoopCan < 2; iLoopCan ++) 8525 #else 6046 8526 for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++) 8527 #endif 6047 8528 { 6048 8529 availableMcDc[(iLoopCan << 1)] = ( abPdmAvailable[(iLoopCan<<2)] ? 1 : 0 ) + ( abPdmAvailable[1 + (iLoopCan<<2)] ? 2 : 0); … … 6071 8552 #endif 6072 8553 cMv.setHor( cMv.getHor() + ioffsetDV ); 8554 #if QC_DEPTH_IV_MRG_F0125 8555 if( bIsDepth ) 8556 cMv.setHor((cMv.getHor()+2)>>2); 8557 #endif 6073 8558 cMv.setVer( 0 ); 6074 8559 clipMv( cMv ); … … 6154 8639 for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) { m_dmmWedgeTabIdx[dmmType][uiAbsPartIdx+ui] = tabIdx; } 6155 8640 } 8641 #if !SEC_DMM3_RBC_F0147 6156 8642 Void TComDataCU::setDmm3IntraTabIdxSubParts( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth ) 6157 8643 { … … 6159 8645 for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) { m_dmm3IntraTabIdx[uiAbsPartIdx+ui] = uiTIdx; } 6160 8646 } 8647 #endif 6161 8648 #endif 6162 8649 #if H_3D_DIM_RBC
Note: See TracChangeset for help on using the changeset viewer.