Changeset 724 in 3DVCSoftware for trunk/source/Lib/TLibCommon
- Timestamp:
- 30 Nov 2013, 12:29:49 (11 years ago)
- Location:
- trunk/source/Lib/TLibCommon
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibCommon/ContextTables.h
r655 r724 109 109 #define NUM_DEPTH_INTRA_MODE_CTX 8 ///< number of context models for depth intra modes 110 110 #define NUM_DDC_FLAG_CTX 2 ///< number of context models for deltaDC flag (DMM or RBC) 111 #if QC_DIM_DELTADC_UNIFY_F0132 112 #define NUM_DDC_DATA_CTX 1 ///< number of context models for deltaDC data (DMM or RBC) 113 #else 111 114 #define NUM_DDC_DATA_CTX 2 ///< number of context models for deltaDC data (DMM or RBC) 115 #endif 112 116 #if H_3D_DIM_DMM 113 117 #define NUM_DMM1_DATA_CTX 1 ///< number of context models for DMM1 data 118 #if !SEC_DMM3_RBC_F0147 114 119 #define NUM_DMM3_DATA_CTX 1 ///< number of context models for DMM3 data 120 #endif 115 121 #endif 116 122 #if H_3D_DIM_RBC … … 371 377 INIT_ARPW[3][NUM_ARPW_CTX] = 372 378 { 379 #if LGE_ARP_CTX_F0161 380 { 162, 153, 154, 162 }, 381 { 162, 153, 154, 162 }, 382 { 162, 153, 154, 162 }, 383 #else 373 384 { 154, 154, 154, 154 }, 374 385 { 154, 154, 154, 154 }, 375 386 { 154, 154, 154, 154 }, 387 #endif 376 388 }; 377 389 #endif … … 381 393 INIT_IC_FLAG[3][NUM_IC_FLAG_CTX] = 382 394 { 395 #if LGE_IC_CTX_F0160 396 { 154, 154, 154, }, 397 { 154, 154, 154, }, 398 { 154, 154, 154, }, 399 #else 383 400 { CNU, CNU, CNU, }, 384 401 { 197, 185, 201, }, 385 402 { 197, 185, 201, }, 403 #endif 386 404 }; 387 405 #endif … … 405 423 INIT_DDC_DATA[3][NUM_DDC_DATA_CTX] = 406 424 { 425 #if QC_DIM_DELTADC_UNIFY_F0132 426 { 154 }, 427 { 154 }, 428 { 154 }, 429 #else 407 430 { CNU, CNU }, 408 431 { CNU, CNU }, 409 432 { CNU, CNU }, 433 #endif 410 434 }; 411 435 #if H_3D_DIM_DMM … … 417 441 { CNU }, 418 442 }; 443 #if !SEC_DMM3_RBC_F0147 419 444 static const UChar 420 445 INIT_DMM3_DATA[3][NUM_DMM3_DATA_CTX] = … … 424 449 { CNU }, 425 450 }; 451 #endif 426 452 #endif 427 453 #if H_3D_DIM_RBC -
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 -
trunk/source/Lib/TLibCommon/TComDataCU.h
r655 r724 198 198 ///< 0: non-VSP; 1: VSP 199 199 #endif 200 #if MTK_SPIVMP_F0110 201 Bool* m_pbSPIVMPFlag; ///< array of sub-PU IVMP flags to indicate whehter a block uses sub-PU IVMP 202 ///< 0: non-SPIVMP; 1: SPIVMP 203 #endif 200 204 #if H_3D_ARP 201 205 UChar* m_puhARPW; … … 208 212 #if H_3D_DIM_DMM 209 213 UInt* m_dmmWedgeTabIdx[DMM_NUM_TYPE]; 214 #if !SEC_DMM3_RBC_F0147 210 215 UInt* m_dmm3IntraTabIdx; 216 #endif 211 217 #endif 212 218 #if H_3D_DIM_RBC … … 227 233 UChar* m_pucInterSDCMask; 228 234 #endif 229 235 #if ETRIKHU_MERGE_REUSE_F0093 236 Bool m_bAvailableFlagA1; ///< A1 available flag 237 Bool m_bAvailableFlagB1; ///< B1 available flag 238 Bool m_bAvailableFlagB0; ///< B0 available flag 239 Bool m_bAvailableFlagA0; ///< A0 available flag 240 Bool m_bAvailableFlagB2; ///< B2 available flag 241 #endif 230 242 // ------------------------------------------------------------------------------------------------------------------- 231 243 // misc. variables … … 244 256 UInt* m_sliceSegmentStartCU; ///< Start CU address of current slice 245 257 Char m_codedQP; 258 #if ETRIKHU_MERGE_REUSE_F0093 259 DisInfo m_cDefaultDisInfo; ///< Default disparity information for initializing 260 #endif 261 246 262 protected: 247 263 … … 250 266 Bool xAddMVPCandOrder ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir ); 251 267 #if H_3D_VSP 268 #if ETRIKHU_MERGE_REUSE_F0093 269 Bool xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount, 270 Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag, Int& iCount3DV, InheritedVSPDisInfo* inheritedVSPDisInfo); 271 #else 252 272 Bool xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount, 253 273 Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag ); 254 274 #endif 275 #endif 255 276 #if H_3D_IV_MERGE 277 #if ETRIKHU_MERGE_REUSE_F0093 278 Bool xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* ivCandDir, TComMv* ivCandMv, 279 Int* ivCandRefIdx, Int posIvDC, Int* vspFlag, Int &iCount3DV, InheritedVSPDisInfo* inheritedVSPDisInfo ); 280 #else 256 281 Bool xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* ivCandDir, TComMv* ivCandMv, 257 282 Int* ivCandRefIdx, Int posIvDC, Int* vspFlag ); 283 #endif 258 284 Bool xGetPosFirstAvailDmvCand( Int iCount, TComMvField* pcMvFieldNeighbours, Int* ivCandDir, Int posIvDC, Int* vspFlag, Int& iFirDispCand ); 259 285 #endif … … 493 519 ); 494 520 521 #if ETRIKHU_MERGE_REUSE_F0093 522 Void rightShiftMergeCandList( TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* iVSPIndexTrue, InheritedVSPDisInfo* inheritedVSPDisInfo, UInt start, UInt num, Int &iCount3DV); 523 #endif 524 #if QC_DEPTH_IV_MRG_F0125 525 Bool getDispNeighBlocks ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* cDisp); 526 Bool getDispMvPredCan(UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDis, Int* iPdm ); 527 #endif 528 495 529 #if H_3D_NBDV_REF 496 530 Pel getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT ); … … 501 535 Void getIVNStatus ( UInt uiPartIdx, DisInfo* pDInfo, Bool& bIVFMerge, Int& iIVFMaxD); 502 536 #endif 537 #if MTK_SPIVMP_F0110 538 Void getSPPara(Int iPUWidth, Int iPUHeight, Int& iNumSP, Int& iNumSPInOneLine, Int& iSPWidth, Int& iSPHeight); 539 Void getSPAbsPartIdx(UInt uiBaseAbsPartIdx, Int iWidth, Int iHeight, Int iPartIdx, Int iNumPartLine, UInt& ruiPartAddr ); 540 Void setInterDirSP( UInt uiDir, UInt uiAbsPartIdx, Int iWidth, Int iHeight ); 541 #endif 503 542 #if H_3D_IV_MERGE 504 Bool getInterViewMergeCands ( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc ); 543 Bool getInterViewMergeCands ( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc 544 #if QC_DEPTH_IV_MRG_F0125 545 , Bool bIsDepth 546 #endif 547 #if MTK_SPIVMP_F0110 548 , TComMvField* pcMFieldSP, UChar* puhInterDirSP 549 #endif 550 ); 505 551 #endif 506 552 #if H_3D_ARP … … 538 584 Void setDmmWedgeTabIdxSubParts ( UInt tabIdx, UInt dmmType, UInt uiAbsPartIdx, UInt uiDepth ); 539 585 586 #if !SEC_DMM3_RBC_F0147 540 587 UInt* getDmm3IntraTabIdx () { return m_dmm3IntraTabIdx; } 541 588 UInt getDmm3IntraTabIdx ( UInt uiIdx ) { return m_dmm3IntraTabIdx[uiIdx]; } 542 589 Void setDmm3IntraTabIdx ( UInt uiIdx, UInt uh ) { m_dmm3IntraTabIdx[uiIdx] = uh; } 543 590 Void setDmm3IntraTabIdxSubParts ( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth ); 591 #endif 544 592 #endif 545 593 #if H_3D_DIM_RBC … … 655 703 656 704 Bool hasEqualMotion ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx ); 657 Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours 705 706 #if ETRIKHU_MERGE_REUSE_F0093 707 Bool getAvailableFlagA1() { return m_bAvailableFlagA1;} 708 Bool getAvailableFlagB1() { return m_bAvailableFlagB1;} 709 Bool getAvailableFlagB0() { return m_bAvailableFlagB0;} 710 Bool getAvailableFlagA0() { return m_bAvailableFlagA0;} 711 Bool getAvailableFlagB2() { return m_bAvailableFlagB2;} 712 Void initAvailableFlags() { m_bAvailableFlagA1 = m_bAvailableFlagB1 = m_bAvailableFlagB0 = m_bAvailableFlagA0 = m_bAvailableFlagB2 = 0; } 713 Void getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1); 714 Void xGetInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours 715 #else 716 Void getInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours 717 #endif 658 718 #if H_3D_VSP 659 719 , Int* vspFlag 660 720 , InheritedVSPDisInfo* inheritedVSPDisInfo 661 721 #endif 662 , Int& numValidMergeCand, Int mrgCandIdx = -1 ); 722 #if MTK_SPIVMP_F0110 723 , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP 724 #endif 725 , Int& numValidMergeCand, Int mrgCandIdx = -1 726 ); 663 727 664 728 #if H_3D_VSP 665 729 inline Void xInheritVSPDisInfo(TComDataCU* pcCURef, UInt uiAbsPartIdx, Int iCount, InheritedVSPDisInfo* inheritedVSPDisInfo); 730 731 #if MTK_SPIVMP_F0110 732 Bool* getSPIVMPFlag () { return m_pbSPIVMPFlag; } 733 Bool getSPIVMPFlag ( UInt uiIdx ) { return m_pbSPIVMPFlag[uiIdx]; } 734 Void setSPIVMPFlag ( UInt uiIdx, Bool n ) { m_pbSPIVMPFlag[uiIdx] = n; } 735 Void setSPIVMPFlagSubParts( Bool bSPIVMPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); 736 #endif 666 737 667 738 Char* getVSPFlag () { return m_piVSPFlag; } … … 681 752 Bool isSkipped ( UInt uiPartIdx ); ///< SKIP (no residual) 682 753 Bool isBipredRestriction( UInt puIdx ); 754 755 #if LGE_IC_CTX_F0160 756 Bool isIC ( UInt uiPartIdx ); 757 #endif 683 758 684 759 // ------------------------------------------------------------------------------------------------------------------- -
trunk/source/Lib/TLibCommon/TComMotionInfo.cpp
r608 r724 40 40 #include "assert.h" 41 41 #include <stdlib.h> 42 #if MTK_SPIVMP_F0110 43 #include "TComDataCU.h" 44 #include "TComPic.h" 45 #endif 42 46 43 47 //! \ingroup TLibCommon … … 323 327 setAllRefIdx( mvField.getRefIdx(), eCUMode, iPartAddr, uiDepth, iPartIdx ); 324 328 } 329 330 #if MTK_SPIVMP_F0110 331 Void TComCUMvField::setMvFieldSP( TComDataCU* pcCU, UInt uiAbsPartIdx, TComMvField cMvField, Int iWidth, Int iHeight ) 332 { 333 uiAbsPartIdx += pcCU->getZorderIdxInCU(); 334 Int iStartPelX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIdx]]; 335 Int iStartPelY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIdx]]; 336 Int iEndPelX = iStartPelX + iWidth; 337 Int iEndPelY = iStartPelY + iHeight; 338 339 Int iCurrRaster, uiPartAddr; 340 341 for (Int i=iStartPelY; i<iEndPelY; i+=pcCU->getPic()->getMinCUHeight()) 342 { 343 for (Int j=iStartPelX; j < iEndPelX; j += pcCU->getPic()->getMinCUWidth()) 344 { 345 iCurrRaster = i / pcCU->getPic()->getMinCUHeight() * pcCU->getPic()->getNumPartInWidth() + j/pcCU->getPic()->getMinCUWidth(); 346 uiPartAddr = g_auiRasterToZscan[iCurrRaster]; 347 uiPartAddr -= pcCU->getZorderIdxInCU(); 348 349 m_pcMv[uiPartAddr] = cMvField.getMv(); 350 m_piRefIdx[uiPartAddr] = cMvField.getRefIdx(); 351 } 352 } 353 } 354 #endif 325 355 326 356 /**Subsampling of the stored prediction mode, reference index and motion vector -
trunk/source/Lib/TLibCommon/TComMotionInfo.h
r622 r724 43 43 #include "CommonDef.h" 44 44 #include "TComMv.h" 45 46 45 //! \ingroup TLibCommon 47 46 //! \{ … … 51 50 // ==================================================================================================================== 52 51 52 #if MTK_SPIVMP_F0110 53 class TComDataCU; 54 #endif 53 55 /// parameters for AMVP 54 56 typedef struct _AMVPInfo … … 171 173 Void setAllRefIdx ( Int iRefIdx, PartSize eMbMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 ); 172 174 Void setAllMvField( TComMvField const & mvField, PartSize eMbMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 ); 175 #if MTK_SPIVMP_F0110 176 Void setMvFieldSP ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComMvField cMvField, Int iWidth, Int iHeight ); 177 #endif 173 178 174 179 Void setNumPartition( Int iNumPart ) -
trunk/source/Lib/TLibCommon/TComPrediction.cpp
r655 r724 425 425 Bool dimDeltaDC = isDimDeltaDC( uiIntraMode ); 426 426 Bool isDmmMode = (dimType < DMM_NUM_TYPE); 427 #if !SEC_DMM3_RBC_F0147 427 428 Bool isRbcMode = (dimType == RBC_IDX); 429 #endif 428 430 429 431 Bool* biSegPattern = NULL; … … 441 443 dmmSegmentation = &(g_dmmWedgeLists[ g_aucConvertToBit[iWidth] ][ pcCU->getDmmWedgeTabIdx( dimType, uiAbsPartIdx ) ]); 442 444 } break; 445 #if !SEC_DMM3_RBC_F0147 443 446 case( DMM3_IDX ): 444 447 { … … 452 455 dmmSegmentation = &(g_dmmWedgeLists[ g_aucConvertToBit[iWidth] ][ uiTabIdx ]); 453 456 } break; 457 #endif 454 458 case( DMM4_IDX ): 455 459 { … … 475 479 assert( biSegPattern ); 476 480 Int* piMask = NULL; 481 #if QC_DIM_DELTADC_UNIFY_F0132 || HHI_DIM_PREDSAMP_FIX_F0171 482 piMask = pcCU->getPattern()->getAdiOrgBuf( iWidth, iHeight, m_piYuvExt ); // no filtering 483 #else 477 484 if( isDmmMode ) piMask = pcCU->getPattern()->getAdiOrgBuf( iWidth, iHeight, m_piYuvExt ); // no filtering for DMM 478 485 else piMask = pcCU->getPattern()->getPredictorPtr( 0, g_aucConvertToBit[ iWidth ] + 2, m_piYuvExt ); 486 #endif 479 487 assert( piMask ); 480 488 Int maskStride = 2*iWidth + 1; … … 491 499 Pel deltaDC2 = pcCU->getDimDeltaDC( dimType, 1, uiAbsPartIdx ); 492 500 #if H_3D_DIM_DMM 501 #if QC_DIM_DELTADC_UNIFY_F0132 && !SEC_DMM3_RBC_F0147 502 if( isDmmMode || isRbcMode) 503 #else 493 504 if( isDmmMode ) 505 #endif 494 506 { 495 507 #if H_3D_DIM_DLT … … 502 514 } 503 515 #endif 504 #if H_3D_DIM_RBC 516 #if H_3D_DIM_RBC && !QC_DIM_DELTADC_UNIFY_F0132 505 517 if( isRbcMode ) 506 518 { … … 549 561 } 550 562 563 #if MTK_SPIVMP_F0110 564 Void TComPrediction::xGetSubPUAddrAndMerge(TComDataCU* pcCU, UInt uiPartAddr, Int iSPWidth, Int iSPHeight, Int iNumSPInOneLine, Int iNumSP, UInt* uiMergedSPW, UInt* uiMergedSPH, UInt* uiSPAddr ) 565 { 566 for (Int i = 0; i < iNumSP; i++) 567 { 568 uiMergedSPW[i] = iSPWidth; 569 uiMergedSPH[i] = iSPHeight; 570 pcCU->getSPAbsPartIdx(uiPartAddr, iSPWidth, iSPHeight, i, iNumSPInOneLine, uiSPAddr[i]); 571 } 572 // horizontal sub-PU merge 573 for (Int i=0; i<iNumSP; i++) 574 { 575 if (i % iNumSPInOneLine == iNumSPInOneLine - 1 || uiMergedSPW[i]==0 || uiMergedSPH[i]==0) 576 { 577 continue; 578 } 579 for (Int j=i+1; j<i+iNumSPInOneLine-i%iNumSPInOneLine; j++) 580 { 581 if (xCheckTwoSPMotion(pcCU, uiSPAddr[i], uiSPAddr[j])) 582 { 583 uiMergedSPW[i] += iSPWidth; 584 uiMergedSPW[j] = uiMergedSPH[j] = 0; 585 } 586 else 587 { 588 break; 589 } 590 } 591 } 592 //vertical sub-PU merge 593 for (Int i=0; i<iNumSP-iNumSPInOneLine; i++) 594 { 595 if (uiMergedSPW[i]==0 || uiMergedSPH[i]==0) 596 { 597 continue; 598 } 599 for (Int j=i+iNumSPInOneLine; j<iNumSP; j+=iNumSPInOneLine) 600 { 601 if (xCheckTwoSPMotion(pcCU, uiSPAddr[i], uiSPAddr[j]) && uiMergedSPW[i]==uiMergedSPW[j]) 602 { 603 uiMergedSPH[i] += iSPHeight; 604 uiMergedSPH[j] = uiMergedSPW[j] = 0; 605 } 606 else 607 { 608 break; 609 } 610 } 611 } 612 } 613 614 Bool TComPrediction::xCheckTwoSPMotion ( TComDataCU* pcCU, UInt PartAddr0, UInt PartAddr1 ) 615 { 616 if( pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr0) != pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr1)) 617 { 618 return false; 619 } 620 if( pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr0) != pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr1)) 621 { 622 return false; 623 } 624 625 if (pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr0) >= 0) 626 { 627 if (pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(PartAddr0) != pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(PartAddr1)) 628 { 629 return false; 630 } 631 } 632 633 if (pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr0) >= 0) 634 { 635 if (pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(PartAddr0) != pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(PartAddr1)) 636 { 637 return false; 638 } 639 } 640 return true; 641 } 642 #endif 551 643 552 644 Void TComPrediction::motionCompensation ( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList, Int iPartIdx ) … … 580 672 else 581 673 { 582 if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) ) 583 { 584 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred ); 674 #if MTK_SPIVMP_F0110 675 if ( pcCU->getSPIVMPFlag(uiPartAddr)!=0) 676 { 677 Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight; 678 679 pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight); 680 681 UInt uiW[256], uiH[256]; 682 UInt uiSPAddr[256]; 683 684 xGetSubPUAddrAndMerge(pcCU, uiPartAddr, iSPWidth, iSPHeight, iNumSPInOneLine, iNumSP, uiW, uiH, uiSPAddr); 685 686 //MC 687 for (Int i = 0; i < iNumSP; i++) 688 { 689 if (uiW[i]==0 || uiH[i]==0) 690 { 691 continue; 692 } 693 if( xCheckIdenticalMotion( pcCU, uiSPAddr[i] )) 694 { 695 xPredInterUni (pcCU, uiSPAddr[i], uiW[i], uiH[i], REF_PIC_LIST_0, pcYuvPred ); 696 } 697 else 698 { 699 xPredInterBi (pcCU, uiSPAddr[i], uiW[i], uiH[i], pcYuvPred); 700 } 701 } 585 702 } 586 703 else 587 704 { 588 xPredInterBi (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred ); 589 } 705 #endif 706 if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) ) 707 { 708 xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred ); 709 } 710 else 711 { 712 xPredInterBi (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred ); 713 } 714 #if MTK_SPIVMP_F0110 715 } 716 #endif 590 717 } 591 718 #if H_3D_VSP … … 631 758 else 632 759 { 760 #if MTK_SPIVMP_F0110 761 if (pcCU->getSPIVMPFlag(uiPartAddr)!=0) 762 { 763 Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight; 764 765 pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight); 766 767 UInt uiW[256], uiH[256]; 768 UInt uiSPAddr[256]; 769 770 xGetSubPUAddrAndMerge(pcCU, uiPartAddr, iSPWidth, iSPHeight, iNumSPInOneLine, iNumSP, uiW, uiH, uiSPAddr); 771 //MC 772 for (Int i = 0; i < iNumSP; i++) 773 { 774 if (uiW[i]==0 || uiH[i]==0) 775 { 776 continue; 777 } 778 if( xCheckIdenticalMotion( pcCU, uiSPAddr[i] )) 779 { 780 xPredInterUni (pcCU, uiSPAddr[i], uiW[i], uiH[i], REF_PIC_LIST_0, pcYuvPred ); 781 } 782 else 783 { 784 xPredInterBi (pcCU, uiSPAddr[i], uiW[i], uiH[i], pcYuvPred); 785 } 786 } 787 } 788 else 789 { 790 #endif 633 791 if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) ) 634 792 { … … 639 797 xPredInterBi (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred ); 640 798 } 799 #if MTK_SPIVMP_F0110 800 } 801 #endif 641 802 } 642 803 #if H_3D_VSP … … 664 825 pcCU->clipMv(cMv); 665 826 #if H_3D_ARP 827 #if QC_MTK_INTERVIEW_ARP_F0123_F0108 828 if(pcCU->getARPW( uiPartAddr ) > 0 && pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPOC()== pcCU->getSlice()->getPOC()) 829 { 830 xPredInterUniARPviewRef( pcCU , uiPartAddr , iWidth , iHeight , eRefPicList , rpcYuvPred , bi ); 831 } 832 else 833 #endif 666 834 if( pcCU->getARPW( uiPartAddr ) > 0 667 835 && pcCU->getPartitionSize(uiPartAddr)==SIZE_2Nx2N … … 744 912 // fetch virtual depth map 745 913 pcBaseViewDepthPicYuv->extendPicBorder(); 914 915 #if MTK_F0109_LG_F0120_VSP_BLOCK 916 Int vspSize=0; 917 xGetVirtualDepth( pcCU, pcBaseViewDepthPicYuv, &cDv, uiPartAddr, iWidth, iHeight, &m_cYuvDepthOnVsp,vspSize ); 918 // sub-PU based compensation 919 xPredInterLumaBlkFromDM ( pcCU, pcBaseViewTxtPicYuv, &m_cYuvDepthOnVsp, pShiftLUT, &cDv, uiPartAddr, iWidth, iHeight, pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi, vspSize); 920 xPredInterChromaBlkFromDM ( pcCU, pcBaseViewTxtPicYuv, &m_cYuvDepthOnVsp, pShiftLUT, &cDv, uiPartAddr, iWidth, iHeight, pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi, vspSize); 921 #else 746 922 xGetVirtualDepth( pcCU, pcBaseViewDepthPicYuv, &cDv, uiPartAddr, iWidth, iHeight, &m_cYuvDepthOnVsp ); 747 923 // sub-PU based compensation 748 924 xPredInterLumaBlkFromDM ( pcCU, pcBaseViewTxtPicYuv, &m_cYuvDepthOnVsp, pShiftLUT, &cDv, uiPartAddr, iWidth, iHeight, pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi ); 749 925 xPredInterChromaBlkFromDM ( pcCU, pcBaseViewTxtPicYuv, &m_cYuvDepthOnVsp, pShiftLUT, &cDv, uiPartAddr, iWidth, iHeight, pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi ); 926 #endif 750 927 } 751 928 #endif … … 777 954 if( cDistparity.bDV ) 778 955 { 956 #if SHARP_ARP_REF_CHECK_F0105 957 Int arpRefIdx = pcCU->getSlice()->getFirstTRefIdx(eRefPicList); 958 if( dW > 0 && pcCU->getSlice()->getRefPic( eRefPicList, arpRefIdx )->getPOC()!= pcCU->getSlice()->getPOC() ) 959 #else 779 960 if( dW > 0 && pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC()!= pcCU->getSlice()->getPOC() ) 961 #endif 780 962 { 781 963 bTobeScaled = true; … … 783 965 784 966 pcPicYuvBaseCol = pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getPOC(), cDistparity.m_aVIdxCan ); 967 968 #if SHARP_ARP_REF_CHECK_F0105 969 pcPicYuvBaseRef = pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getRefPic( eRefPicList, arpRefIdx )->getPOC(), cDistparity.m_aVIdxCan ); 970 971 if (!pcCU->getSlice()->getArpRefPicAvailable( eRefPicList, cDistparity.m_aVIdxCan)) 972 #else 785 973 pcPicYuvBaseRef = pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC(), cDistparity.m_aVIdxCan ); 786 974 787 975 if( ( !pcPicYuvBaseCol || pcPicYuvBaseCol->getPOC() != pcCU->getSlice()->getPOC() ) || ( !pcPicYuvBaseRef || pcPicYuvBaseRef->getPOC() != pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC() ) ) 976 #endif 788 977 { 789 978 dW = 0; … … 792 981 else 793 982 { 983 #if SHARP_ARP_REF_CHECK_F0105 984 assert( pcPicYuvBaseCol->getPOC() == pcCU->getSlice()->getPOC() && pcPicYuvBaseRef->getPOC() == pcCU->getSlice()->getRefPic( eRefPicList, arpRefIdx )->getPOC() ); 985 #else 794 986 assert( pcPicYuvBaseCol->getPOC() == pcCU->getSlice()->getPOC() && pcPicYuvBaseRef->getPOC() == pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC() ); 987 #endif 795 988 } 796 989 … … 841 1034 } 842 1035 } 1036 #if QC_MTK_INTERVIEW_ARP_F0123_F0108 1037 Void TComPrediction::xPredInterUniARPviewRef( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, TComMvField * pNewMvFiled ) 1038 { 1039 Int iRefIdx = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr ); 1040 TComMv cDMv = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr ); 1041 TComMv cTempDMv = cDMv; 1042 UChar dW = pcCU->getARPW ( uiPartAddr ); 1043 1044 TComPic* pcPicYuvBaseTRef = NULL; 1045 TComPic* pcPicYuvCurrTRef = NULL; 1046 TComPic* pcPicYuvBaseCol = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx ); 1047 TComPicYuv* pcYuvBaseCol = pcPicYuvBaseCol->getPicYuvRec(); 1048 Bool bTMVAvai = false; 1049 TComMv cBaseTMV; 1050 if( pNewMvFiled ) 1051 { 1052 iRefIdx = pNewMvFiled->getRefIdx(); 1053 cDMv = pNewMvFiled->getMv(); 1054 } 1055 pcCU->clipMv(cTempDMv); 1056 1057 assert(dW > 0); 1058 #if SHARP_ARP_REF_CHECK_F0105 1059 if (!pcCU->getSlice()->getArpRefPicAvailable( eRefPicList, pcPicYuvBaseCol->getViewIndex())) 1060 { 1061 dW = 0; 1062 } 1063 #endif 1064 Int uiLCUAddr,uiAbsPartAddr; 1065 Int irefPUX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[uiPartAddr]] + iWidth/2 + ((cDMv.getHor() + 2)>>2); 1066 Int irefPUY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[uiPartAddr]] + iHeight/2 + ((cDMv.getVer() + 2)>>2); 1067 1068 irefPUX = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()-> getPicWidthInLumaSamples()-1, irefPUX); 1069 irefPUY = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples()-1, irefPUY); 1070 pcYuvBaseCol->getCUAddrAndPartIdx( irefPUX, irefPUY, uiLCUAddr, uiAbsPartAddr); 1071 TComDataCU *pColCU = pcPicYuvBaseCol->getCU( uiLCUAddr ); 1072 1073 if(!pColCU->isIntra(uiAbsPartAddr)) 1074 { 1075 TComMvField puMVField; 1076 for(Int iList = 0; iList < (pColCU->getSlice()->isInterB() ? 2: 1) && !bTMVAvai; iList ++) 1077 { 1078 RefPicList eRefPicListCurr = RefPicList(iList); 1079 Int iRef = pColCU->getCUMvField(eRefPicListCurr)->getRefIdx(uiAbsPartAddr); 1080 if( iRef != -1) 1081 { 1082 pcPicYuvBaseTRef = pColCU->getSlice()->getRefPic(eRefPicListCurr, iRef); 1083 Int iCurrPOC = pColCU->getSlice()->getPOC(); 1084 Int iCurrRefPOC = pcPicYuvBaseTRef->getPOC(); 1085 Int iCurrRef = pcCU->getSlice()->getFirstTRefIdx(eRefPicListCurr); 1086 if( iCurrRef >= 0) 1087 { 1088 pcPicYuvCurrTRef = pcCU->getSlice()->getRefPic(eRefPicListCurr,iCurrRef); 1089 Int iTargetPOC = pcPicYuvCurrTRef->getPOC(); 1090 { 1091 pcPicYuvBaseTRef = pcCU->getSlice()->getBaseViewRefPic(iTargetPOC, pcPicYuvBaseCol->getViewIndex() ); 1092 if(pcPicYuvBaseTRef) 1093 { 1094 cBaseTMV = pColCU->getCUMvField(eRefPicListCurr)->getMv(uiAbsPartAddr); 1095 Int iScale = pcCU-> xGetDistScaleFactor(iCurrPOC, iTargetPOC, iCurrPOC, iCurrRefPOC); 1096 if ( iScale != 4096 ) 1097 cBaseTMV = cBaseTMV.scaleMv( iScale ); 1098 bTMVAvai = true; 1099 break; 1100 } 1101 } 1102 } 1103 } 1104 } 1105 } 1106 if (bTMVAvai == false) 1107 { 1108 bTMVAvai = true; 1109 cBaseTMV.set(0, 0); 1110 pcPicYuvBaseTRef = pColCU->getSlice()->getRefPic(eRefPicList, pcCU->getSlice()->getFirstTRefIdx(eRefPicList)); 1111 pcPicYuvCurrTRef = pcCU->getSlice()->getRefPic (eRefPicList, pcCU->getSlice()->getFirstTRefIdx(eRefPicList)); 1112 } 1113 1114 xPredInterLumaBlk ( pcCU, pcYuvBaseCol, uiPartAddr, &cTempDMv, iWidth, iHeight, rpcYuvPred, bi, bTMVAvai); 1115 xPredInterChromaBlk( pcCU, pcYuvBaseCol, uiPartAddr, &cTempDMv, iWidth, iHeight, rpcYuvPred, bi, bTMVAvai); 1116 1117 if( dW > 0 && bTMVAvai ) 1118 { 1119 TComYuv* pYuvCurrTRef = &m_acYuvPredBase[0]; 1120 TComYuv* pYuvBaseTRef = &m_acYuvPredBase[1]; 1121 TComPicYuv* pcYuvCurrTref = pcPicYuvCurrTRef->getPicYuvRec(); 1122 TComPicYuv* pcYuvBaseTref = pcPicYuvBaseTRef->getPicYuvRec(); 1123 TComMv cTempMv = cDMv + cBaseTMV; 1124 1125 pcCU->clipMv(cBaseTMV); 1126 pcCU->clipMv(cTempMv); 1127 1128 xPredInterLumaBlk ( pcCU, pcYuvCurrTref, uiPartAddr, &cBaseTMV, iWidth, iHeight, pYuvCurrTRef, bi, true); 1129 xPredInterChromaBlk( pcCU, pcYuvCurrTref, uiPartAddr, &cBaseTMV, iWidth, iHeight, pYuvCurrTRef, bi, true); 1130 xPredInterLumaBlk ( pcCU, pcYuvBaseTref, uiPartAddr, &cTempMv, iWidth, iHeight, pYuvBaseTRef, bi, true); 1131 xPredInterChromaBlk( pcCU, pcYuvBaseTref, uiPartAddr, &cTempMv, iWidth, iHeight, pYuvBaseTRef, bi, true); 1132 1133 pYuvCurrTRef->subtractARP( pYuvCurrTRef , pYuvBaseTRef , uiPartAddr , iWidth , iHeight ); 1134 if(dW == 2) 1135 { 1136 pYuvCurrTRef->multiplyARP( uiPartAddr , iWidth , iHeight , dW ); 1137 } 1138 rpcYuvPred->addARP( rpcYuvPred , pYuvCurrTRef , uiPartAddr , iWidth , iHeight , !bi ); 1139 } 1140 } 1141 #endif 1142 843 1143 #endif 844 1144 … … 1499 1799 #if H_3D_VSP 1500 1800 // not fully support iRatioTxtPerDepth* != 1 1801 #if MTK_F0109_LG_F0120_VSP_BLOCK 1802 Void TComPrediction::xGetVirtualDepth( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *mv, UInt partAddr, Int width, Int height, TComYuv *yuvDepth, Int &vspSize, Int ratioTxtPerDepthX, Int ratioTxtPerDepthY ) 1803 #else 1501 1804 Void TComPrediction::xGetVirtualDepth( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *mv, UInt partAddr, Int width, Int height, TComYuv *yuvDepth, Int ratioTxtPerDepthX, Int ratioTxtPerDepthY ) 1805 #endif 1502 1806 { 1503 1807 Int nTxtPerDepthX = H_3D_VSP_BLOCKSIZE; … … 1527 1831 Pel *depth = yuvDepth->getLumaAddr(); 1528 1832 1833 #if !SHARP_VSP_BLOCK_IN_AMP_F0102 1529 1834 if( width<8 || height<8 ) 1530 1835 { // no split … … 1546 1851 depth += depStrideBlock; 1547 1852 } 1853 #if MTK_F0109_LG_F0120_VSP_BLOCK 1854 if(width==4) 1855 vspSize=0; 1856 else 1857 vspSize=1; 1858 #endif 1548 1859 } 1549 1860 else … … 1558 1869 Pel repDepth4x8[2] = {0, 0}; 1559 1870 Pel repDepth8x4[2] = {0, 0}; 1560 1871 #endif 1872 1873 #if !MTK_F0109_LG_F0120_VSP_BLOCK 1874 #if SHARP_VSP_BLOCK_IN_AMP_F0102 1875 Int blocksize = 8; 1876 Int subblocksize = 4; 1877 Int depStrideBlock = depStride * blocksize; 1878 Pel *depthTmp = NULL; 1879 Int depStrideTmp = depStride * nTxtPerDepthY; 1880 Int offset[4] = { 0, subblocksize-1, subblocksize, blocksize-1 }; 1881 Pel *refDepthTmp[4] = { NULL, NULL, NULL, NULL }; 1882 #endif 1561 1883 Int refDepStrideBlock = refDepStride * blocksize; 1562 1884 Int refDepStrideSubBlock = refDepStride * subblocksize; … … 1567 1889 refDepthTmp[3] = refDepthTmp[1] + refDepStrideSubBlock; 1568 1890 1891 #if SHARP_VSP_BLOCK_IN_AMP_F0102 1892 Int subBlockW, subBlockH; 1893 Int blockW, blockH; 1894 subBlockW = subBlockH = 8; 1895 if (height % 8) 1896 { 1897 subBlockW = 8; 1898 subBlockH = 4; 1899 blockW = width; // no further split 1900 blockH = height; // no further split 1901 } 1902 else if (width % 8) 1903 { 1904 subBlockW = 4; 1905 subBlockH = 8; 1906 blockW = width; // no further split 1907 blockH = height; // no further split 1908 } 1909 else 1910 { 1911 blockW = blockH = 8; 1912 } 1913 for( Int y=0; y<height; y+=blockH ) 1914 { 1915 for( Int x=0; x<width; x+=blockW ) 1916 { 1917 if (blockW == 8 && blockH == 8) 1918 { 1919 Bool ULvsBR = false, URvsBL = false; 1920 ULvsBR = refDepthTmp[0][x+offset[0]] < refDepthTmp[3][x+offset[3]]; 1921 URvsBL = refDepthTmp[0][x+offset[3]] < refDepthTmp[3][x+offset[0]]; 1922 if( ULvsBR ^ URvsBL ) 1923 { // 4x8 1924 subBlockW = 4; 1925 subBlockH = 8; 1926 } 1927 else 1928 { 1929 subBlockW = 8; 1930 subBlockH = 4; 1931 } 1932 } 1933 for( Int yy=0; yy<blockH; yy+=subBlockH ) 1934 { 1935 for( Int xx=0; xx<blockW; xx+=subBlockW ) 1936 { 1937 Pel maxDepthVal = 0; 1938 Int xP0, xP1, yP0, yP1; 1939 xP0 = x+xx; 1940 xP1 = x+xx+subBlockW-1; 1941 yP0 = yy; 1942 yP1 = yy+subBlockH-1; 1943 maxDepthVal = std::max( maxDepthVal, refDepthTmp[0][xP0+yP0*refDepStride]); 1944 maxDepthVal = std::max( maxDepthVal, refDepthTmp[0][xP1+yP0*refDepStride]); 1945 maxDepthVal = std::max( maxDepthVal, refDepthTmp[0][xP0+yP1*refDepStride]); 1946 maxDepthVal = std::max( maxDepthVal, refDepthTmp[0][xP1+yP1*refDepStride]); 1947 depthTmp = &depth[x+xx+yy*depStride]; 1948 for( Int sY=0; sY<subBlockH; sY+=nTxtPerDepthY ) 1949 { 1950 for( Int sX=0; sX<subBlockW; sX+=nTxtPerDepthX ) 1951 { 1952 depthTmp[sX] = maxDepthVal; 1953 } 1954 depthTmp += depStrideTmp; 1955 } 1956 } 1957 } 1958 } 1959 refDepthTmp[0] += refDepStrideBlock; 1960 depth += depStrideBlock; 1961 } 1962 #else // SHARP_VSP_BLOCK_IN_AMP_F0102 1569 1963 for( Int y=0; y<height; y+=blocksize ) 1570 1964 { … … 1662 2056 depth += depStrideBlock; 1663 2057 } 1664 } 1665 1666 1667 } 1668 2058 #endif // SHARP_VSP_BLOCK_IN_AMP_F0102 2059 #else 2060 #if SHARP_VSP_BLOCK_IN_AMP_F0102 2061 if ((height % 8)) 2062 { 2063 vspSize = 1; // 8x4 2064 } 2065 else if ((width % 8)) 2066 { 2067 vspSize = 0; // 4x8 2068 } 2069 else 2070 { 2071 Bool ULvsBR, URvsBL; 2072 ULvsBR = refDepth[0] < refDepth[refDepStride * (height-1) + width-1]; 2073 URvsBL = refDepth[width-1] < refDepth[refDepStride * (height-1)]; 2074 vspSize = ( ULvsBR ^ URvsBL ) ? 0 : 1; 2075 } 2076 Int subBlockW, subBlockH; 2077 Int depStrideTmp = depStride * nTxtPerDepthY; 2078 if (vspSize) 2079 { 2080 subBlockW = 8; 2081 subBlockH = 4; 2082 } 2083 else 2084 { 2085 subBlockW = 4; 2086 subBlockH = 8; 2087 } 2088 for( Int y=0; y<height; y+=subBlockH ) 2089 { 2090 Pel *refDepthTmp[4]; 2091 refDepthTmp[0] = refDepth + refDepStride * y; 2092 refDepthTmp[1] = refDepthTmp[0] + subBlockW - 1; 2093 refDepthTmp[2] = refDepthTmp[0] + refDepStride * (subBlockH - 1); 2094 refDepthTmp[3] = refDepthTmp[2] + subBlockW - 1; 2095 for( Int x=0; x<width; x+=subBlockW ) 2096 { 2097 Pel maxDepthVal; 2098 maxDepthVal = refDepthTmp[0][x]; 2099 maxDepthVal = std::max( maxDepthVal, refDepthTmp[1][x]); 2100 maxDepthVal = std::max( maxDepthVal, refDepthTmp[2][x]); 2101 maxDepthVal = std::max( maxDepthVal, refDepthTmp[3][x]); 2102 Pel *depthTmp = &depth[x+y*depStride]; 2103 for( Int sY=0; sY<subBlockH; sY+=nTxtPerDepthY ) 2104 { 2105 for( Int sX=0; sX<subBlockW; sX+=nTxtPerDepthX ) 2106 { 2107 depthTmp[sX] = maxDepthVal; 2108 } 2109 depthTmp += depStrideTmp; 2110 } 2111 } 2112 } 2113 #else // SHARP_VSP_BLOCK_IN_AMP_F0102 2114 Int refDepStrideBlock = refDepStride * height; 2115 Int refDepStrideSubBlock = refDepStride * height/2; 2116 refDepthTmp[0] = refDepth; 2117 refDepthTmp[2] = refDepthTmp[0] + refDepStrideSubBlock; 2118 refDepthTmp[1] = refDepthTmp[2] - refDepStride; 2119 refDepthTmp[3] = refDepthTmp[1] + refDepStrideSubBlock; 2120 offset[3] = width-1; 2121 Bool ULvsBR = false, URvsBL = false; 2122 ULvsBR = refDepthTmp[0][0+offset[0]] < refDepthTmp[3][0+offset[3]]; 2123 URvsBL = refDepthTmp[0][0+offset[3]] < refDepthTmp[3][0+offset[0]]; 2124 refDepStrideBlock = refDepStride * blocksize; 2125 refDepStrideSubBlock = refDepStride * subblocksize; 2126 refDepthTmp[0] = refDepth; 2127 refDepthTmp[2] = refDepthTmp[0] + refDepStrideSubBlock; 2128 refDepthTmp[1] = refDepthTmp[2] - refDepStride; 2129 refDepthTmp[3] = refDepthTmp[1] + refDepStrideSubBlock; 2130 offset[3] = blocksize-1; 2131 if( ULvsBR ^ URvsBL ) 2132 { 2133 vspSize = 0;//4x8 2134 for( Int y=0; y<height; y+=blocksize ) 2135 { 2136 for( Int x=0; x<width; x+=blocksize ) 2137 { 2138 { // 4x8 2139 repDepth4x8[0] = refDepthTmp[0][x+offset[0]] > refDepthTmp[0][x+offset[1]] ? refDepthTmp[0][x+offset[0]] : refDepthTmp[0][x+offset[1]]; 2140 if( repDepth4x8[0] < refDepthTmp[3][x+offset[0]] ) 2141 { 2142 repDepth4x8[0] = refDepthTmp[3][x+offset[0]]; 2143 } 2144 if( repDepth4x8[0] < refDepthTmp[3][x+offset[1]] ) 2145 { 2146 repDepth4x8[0] = refDepthTmp[3][x+offset[1]]; 2147 } 2148 repDepth4x8[1] = refDepthTmp[0][x+offset[2]] > refDepthTmp[0][x+offset[3]] ? refDepthTmp[0][x+offset[2]] : refDepthTmp[0][x+offset[3]]; 2149 if( repDepth4x8[1] < refDepthTmp[3][x+offset[2]] ) 2150 { 2151 repDepth4x8[1] = refDepthTmp[3][x+offset[2]]; 2152 } 2153 if( repDepth4x8[1] < refDepthTmp[3][x+offset[3]] ) 2154 { 2155 repDepth4x8[1] = refDepthTmp[3][x+offset[3]]; 2156 } 2157 2158 depthTmp = &depth[x]; 2159 for( Int sY=0; sY<blocksize; sY+=nTxtPerDepthY ) 2160 { 2161 for( Int sX=0; sX<subblocksize; sX+=nTxtPerDepthX ) 2162 { 2163 depthTmp[sX] = repDepth4x8[0]; 2164 } 2165 depthTmp += depStrideTmp; 2166 } 2167 depthTmp = &depth[x+subblocksize]; 2168 for( Int sY=0; sY<blocksize; sY+=nTxtPerDepthY ) 2169 { 2170 for( Int sX=0; sX<subblocksize; sX+=nTxtPerDepthX ) 2171 { 2172 depthTmp[sX] = repDepth4x8[1]; 2173 } 2174 depthTmp += depStrideTmp; 2175 } 2176 } 2177 } 2178 refDepthTmp[0] += refDepStrideBlock; 2179 refDepthTmp[1] += refDepStrideBlock; 2180 refDepthTmp[2] += refDepStrideBlock; 2181 refDepthTmp[3] += refDepStrideBlock; 2182 depth += depStrideBlock; 2183 } 2184 } 2185 else 2186 { // 8x4 2187 vspSize = 1; 2188 for( Int y=0; y<height; y+=blocksize ) 2189 { 2190 for( Int x=0; x<width; x+=blocksize ) 2191 { 2192 repDepth8x4[0] = refDepthTmp[0][x+offset[0]] > refDepthTmp[0][x+offset[3]] ? refDepthTmp[0][x+offset[0]] : refDepthTmp[0][x+offset[3]]; 2193 if( repDepth8x4[0] < refDepthTmp[1][x+offset[0]] ) 2194 { 2195 repDepth8x4[0] = refDepthTmp[1][x+offset[0]]; 2196 } 2197 if( repDepth8x4[0] < refDepthTmp[1][x+offset[3]] ) 2198 { 2199 repDepth8x4[0] = refDepthTmp[1][x+offset[3]]; 2200 } 2201 repDepth8x4[1] = refDepthTmp[2][x+offset[0]] > refDepthTmp[2][x+offset[3]] ? refDepthTmp[2][x+offset[0]] : refDepthTmp[2][x+offset[3]]; 2202 if( repDepth8x4[1] < refDepthTmp[3][x+offset[0]] ) 2203 { 2204 repDepth8x4[1] = refDepthTmp[3][x+offset[0]]; 2205 } 2206 if( repDepth8x4[1] < refDepthTmp[3][x+offset[3]] ) 2207 { 2208 repDepth8x4[1] = refDepthTmp[3][x+offset[3]]; 2209 } 2210 2211 depthTmp = &depth[x]; 2212 for( Int sY=0; sY<subblocksize; sY+=nTxtPerDepthY ) 2213 { 2214 for( Int sX=0; sX<blocksize; sX+=nTxtPerDepthX ) 2215 { 2216 depthTmp[sX] = repDepth8x4[0]; 2217 } 2218 depthTmp += depStrideTmp; 2219 } 2220 for( Int sY=0; sY<subblocksize; sY+=nTxtPerDepthY ) 2221 { 2222 for( Int sX=0; sX<blocksize; sX+=nTxtPerDepthX ) 2223 { 2224 depthTmp[sX] = repDepth8x4[1]; 2225 } 2226 depthTmp += depStrideTmp; 2227 } 2228 } 2229 refDepthTmp[0] += refDepStrideBlock; 2230 refDepthTmp[1] += refDepStrideBlock; 2231 refDepthTmp[2] += refDepStrideBlock; 2232 refDepthTmp[3] += refDepStrideBlock; 2233 depth += depStrideBlock; 2234 } 2235 } 2236 #endif 2237 #endif 2238 #if !SHARP_VSP_BLOCK_IN_AMP_F0102 2239 } 2240 #endif 2241 2242 2243 } 2244 #if MTK_F0109_LG_F0120_VSP_BLOCK 2245 Void TComPrediction::xPredInterLumaBlkFromDM( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&yuvDst, Bool isBi, Int vspSize) 2246 #else 1669 2247 Void TComPrediction::xPredInterLumaBlkFromDM( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&yuvDst, Bool isBi ) 2248 #endif 1670 2249 { 1671 2250 Int nTxtPerDepthX = H_3D_VSP_BLOCKSIZE; 1672 2251 Int nTxtPerDepthY = H_3D_VSP_BLOCKSIZE; 1673 2252 2253 #if MTK_F0109_LG_F0120_VSP_BLOCK 2254 nTxtPerDepthX = nTxtPerDepthX << vspSize; 2255 nTxtPerDepthY = nTxtPerDepthY << (1-vspSize); 2256 #endif 1674 2257 Int refStride = picRef->getStride(); 1675 2258 Int dstStride = yuvDst->getStride(); … … 1777 2360 } 1778 2361 2362 #if MTK_F0109_LG_F0120_VSP_BLOCK 2363 Void TComPrediction::xPredInterChromaBlkFromDM ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&yuvDst, Bool isBi, Int vspSize) 2364 #else 1779 2365 Void TComPrediction::xPredInterChromaBlkFromDM ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&yuvDst, Bool isBi ) 2366 #endif 1780 2367 { 1781 2368 #if (H_3D_VSP_BLOCKSIZE==1) … … 1787 2374 #endif 1788 2375 2376 #if MTK_F0109_LG_F0120_VSP_BLOCK 2377 nTxtPerDepthX = nTxtPerDepthX << vspSize; 2378 nTxtPerDepthY = nTxtPerDepthY << (1-vspSize); 2379 #endif 1789 2380 Int refStride = picRef->getCStride(); 1790 2381 Int dstStride = yuvDst->getCStride(); … … 1968 2559 1969 2560 #if H_3D_DIM_DMM 2561 #if !SEC_DMM3_RBC_F0147 1970 2562 UInt TComPrediction::xPredWedgeFromTex( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt intraTabIdx ) 1971 2563 { … … 1979 2571 return g_aauiWdgLstM3[g_aucConvertToBit[uiWidth]][uiColTexIntraDir-2].at(intraTabIdx); 1980 2572 } 2573 #endif 1981 2574 1982 2575 Void TComPrediction::xPredContourFromTex( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, TComWedgelet* pcContourWedge ) -
trunk/source/Lib/TLibCommon/TComPrediction.h
r655 r724 93 93 #if H_3D_ARP 94 94 Void xPredInterUniARP ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false, TComMvField * pNewMvFiled = NULL ); 95 #if QC_MTK_INTERVIEW_ARP_F0123_F0108 96 Void xPredInterUniARPviewRef( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, TComMvField * pNewMvFiled = NULL ); 97 #endif 95 98 #endif 96 99 Void xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false ); … … 120 123 121 124 #if H_3D_VSP 125 #if MTK_F0109_LG_F0120_VSP_BLOCK 126 Void xGetVirtualDepth ( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *dv, UInt partAddr, Int width, Int height, TComYuv *yuvDepth, Int &vspSize, Int txtPerDepthX=1, Int txtPerDepthY=1 ); 127 Void xPredInterLumaBlkFromDM ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&pcYuvDst, Bool isBi, Int vspSize); 128 Void xPredInterChromaBlkFromDM ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&pcYuvDst, Bool isBi, Int vspSize); 129 #else 122 130 Void xGetVirtualDepth ( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *dv, UInt partAddr, Int width, Int height, TComYuv *yuvDepth, Int txtPerDepthX=1, Int txtPerDepthY=1 ); 123 131 Void xPredInterLumaBlkFromDM ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&pcYuvDst, Bool isBi ); 124 132 Void xPredInterChromaBlkFromDM ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&pcYuvDst, Bool isBi ); 125 133 #endif 134 #endif 126 135 127 136 Void xWeightedAverage ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst ); … … 133 142 Void xDCPredFiltering( Int* pSrc, Int iSrcStride, Pel*& rpDst, Int iDstStride, Int iWidth, Int iHeight ); 134 143 Bool xCheckIdenticalMotion ( TComDataCU* pcCU, UInt PartAddr); 135 144 #if MTK_SPIVMP_F0110 145 Bool xCheckTwoSPMotion ( TComDataCU* pcCU, UInt PartAddr0, UInt PartAddr1 ); 146 Void xGetSubPUAddrAndMerge(TComDataCU* pcCU, UInt uiPartAddr, Int iSPWidth, Int iSPHeight, Int iNumSPInOneLine, Int iNumSP, UInt* uiMergedSPW, UInt* uiMergedSPH, UInt* uiSPAddr ); 147 #endif 136 148 #if H_3D_DIM 137 149 // depth intra functions -
trunk/source/Lib/TLibCommon/TComRom.cpp
r655 r724 604 604 std::vector< std::vector<TComWedgeRef> > g_dmmWedgeRefLists; 605 605 std::vector< std::vector<TComWedgeNode> > g_dmmWedgeNodeLists; 606 #if !SEC_DMM3_RBC_F0147 606 607 std::vector< std::vector< std::vector<UInt> > > g_aauiWdgLstM3; 608 #endif 607 609 608 610 Void initWedgeLists( Bool initNodeList ) … … 723 725 } 724 726 727 #if !SEC_DMM3_RBC_F0147 725 728 UInt uiThrSz = DMM3_SIMPLIFY_TR; 726 729 std::vector< std::vector<UInt> > auiWdgListSz; … … 739 742 } 740 743 g_aauiWdgLstM3.push_back(auiWdgListSz); 744 #endif 741 745 } 742 746 -
trunk/source/Lib/TLibCommon/TComRom.h
r655 r724 172 172 extern std::vector< std::vector<TComWedgeRef> > g_dmmWedgeRefLists; 173 173 extern std::vector< std::vector<TComWedgeNode> > g_dmmWedgeNodeLists; 174 #if !SEC_DMM3_RBC_F0147 174 175 extern std::vector< std::vector< std::vector<UInt> > > g_aauiWdgLstM3; 176 #endif 175 177 176 178 Void initWedgeLists( Bool initNodeList = false ); -
trunk/source/Lib/TLibCommon/TComSlice.cpp
r655 r724 751 751 if ( this->getNumRefIdx( RefPicList( uiRefListIdx ) ) == 0) 752 752 continue; 753 753 #if !SHARP_ARP_REF_CHECK_F0105 754 // move the following to setARPStepNum() to define ARP related thing in ARP function. 755 #if QC_MTK_INTERVIEW_ARP_F0123_F0108 756 for(Int i = 0; i < this->getNumRefIdx(RefPicList(uiRefListIdx)); i++ ) 757 { 758 if ( this->getRefPic(RefPicList(uiRefListIdx), i)->getPOC() != getPOC() ) 759 { 760 this->setFirstTRefIdx (RefPicList(uiRefListIdx), i); 761 break; 762 } 763 } 764 #endif 765 #endif 754 766 Bool bZeroIdxLtFlag = this->getRefPic(RefPicList(uiRefListIdx), 0)->getIsLongTerm(); 755 767 for(Int i = 1; i < this->getNumRefIdx(RefPicList(uiRefListIdx)); i++ ) … … 1826 1838 #if H_3D_IV_MERGE 1827 1839 m_ivMvPredFlag [ i ] = false; 1840 #if MTK_SPIVMP_F0110 1841 m_iSubPULog2Size [ i ] = 0; 1842 #endif 1828 1843 #endif 1829 1844 #if H_3D_VSP … … 1835 1850 #if H_3D_INTER_SDC 1836 1851 m_bInterSDCFlag [ i ] = false; 1852 #endif 1853 #if SEC_MPI_ENABLING_MERGE_F0150 1854 m_bMPIFlag [ i ] = false; 1837 1855 #endif 1838 1856 } … … 2831 2849 2832 2850 #if H_3D_ARP 2851 #if SHARP_ARP_REF_CHECK_F0105 2852 Void TComSlice::setARPStepNum( TComPicLists*ivPicLists ) 2853 #else 2833 2854 Void TComSlice::setARPStepNum() 2834 { 2855 #endif 2856 { 2857 #if SHARP_ARP_REF_CHECK_F0105 2858 Bool tempRefPicInListsFlag = false; 2859 #else 2835 2860 Bool bAllIvRef = true; 2836 2861 #endif 2862 #if QC_MTK_INTERVIEW_ARP_F0123_F0108 2863 if(!getVPS()->getUseAdvRP(getLayerId()) || this->isIRAP()) 2864 #else 2837 2865 if(!getVPS()->getUseAdvRP(getLayerId())) 2866 #endif 2838 2867 { 2839 2868 m_nARPStepNum = 0; … … 2841 2870 else 2842 2871 { 2872 #if SHARP_ARP_REF_CHECK_F0105 2873 setFirstTRefIdx (REF_PIC_LIST_0, -1); 2874 setFirstTRefIdx (REF_PIC_LIST_1, -1); 2875 for ( Int refListIdx = 0; refListIdx < ((m_eSliceType==B_SLICE) ? 2 : 1); refListIdx++ ) 2876 { 2877 for(Int i = 0; i < getNumRefIdx(RefPicList(refListIdx)); i++ ) 2878 { 2879 if ( getRefPic(RefPicList(refListIdx), i)->getPOC() != getPOC() ) 2880 { 2881 setFirstTRefIdx (RefPicList(refListIdx), i); 2882 break; 2883 } 2884 } 2885 } 2886 tempRefPicInListsFlag = getFirstTRefIdx(REF_PIC_LIST_0) >= 0 || getFirstTRefIdx(REF_PIC_LIST_1) >= 0; 2887 m_nARPStepNum = tempRefPicInListsFlag ? getVPS()->getARPStepNum(getLayerId()) : 0; 2888 #else 2843 2889 for( Int iRefListId = 0; iRefListId < 2; iRefListId++ ) 2844 2890 { … … 2863 2909 } 2864 2910 m_nARPStepNum = !bAllIvRef ? getVPS()->getARPStepNum(getLayerId()) : 0; 2865 } 2911 #endif 2912 } 2913 #if SHARP_ARP_REF_CHECK_F0105 2914 if (tempRefPicInListsFlag) 2915 { 2916 for ( Int refListIdx = 0; refListIdx < ((m_eSliceType==B_SLICE) ? 2 : 1); refListIdx++ ) 2917 { 2918 RefPicList eRefPicList = RefPicList( refListIdx ); 2919 Int prevPOC = getRefPic(eRefPicList, getFirstTRefIdx(eRefPicList) )->getPOC(); 2920 for( Int i = 0; i < getNumActiveRefLayerPics(); i++ ) 2921 { 2922 Int layerIdInNuh = getRefPicLayerId( i ); 2923 Int viewIdx = getVPS()->getViewId( layerIdInNuh ); 2924 TComPic*pcPicPrev = ivPicLists->getPic(viewIdx, 0, prevPOC); 2925 if (getFirstTRefIdx(eRefPicList) >= 0 && pcPicPrev && pcPicPrev->getSlice( 0 )->isReferenced()) 2926 { 2927 m_arpRefPicAvailable[eRefPicList][layerIdInNuh] = true; 2928 } 2929 else 2930 { 2931 m_arpRefPicAvailable[eRefPicList][layerIdInNuh] = false; 2932 } 2933 } 2934 } 2935 } 2936 #endif 2866 2937 } 2867 2938 #endif … … 2967 3038 setupLUT = setupLUT || getVPS()->getDepthRefinementFlag( layerIdInVPS ); 2968 3039 #endif 3040 3041 #if QC_DEPTH_IV_MRG_F0125 3042 setupLUT = setupLUT || ( getVPS()->getIvMvPredFlag(layerIdInVPS ) && getIsDepth() ); 3043 #endif 2969 3044 2970 3045 if( !setupLUT ) -
trunk/source/Lib/TLibCommon/TComSlice.h
r655 r724 597 597 #if H_3D_IV_MERGE 598 598 Bool m_ivMvPredFlag [ MAX_NUM_LAYERS ]; 599 #if MTK_SPIVMP_F0110 600 Int m_iSubPULog2Size [MAX_NUM_LAYERS ]; 601 #endif 599 602 #endif 600 603 #if H_3D_VSP … … 618 621 #if H_3D_INTER_SDC 619 622 Bool m_bInterSDCFlag[MAX_NUM_LAYERS ]; 623 #endif 624 #if SEC_MPI_ENABLING_MERGE_F0150 625 Bool m_bMPIFlag[MAX_NUM_LAYERS ]; 620 626 #endif 621 627 … … 826 832 Void setIvMvPredFlag ( Int layerIdInVps, Bool val ) { m_ivMvPredFlag[ layerIdInVps ] = val; } 827 833 Bool getIvMvPredFlag ( Int layerIdInVps ) { return m_ivMvPredFlag[ layerIdInVps ]; }; 834 #if MTK_SPIVMP_F0110 835 Int getSubPULog2Size(Int layerIdInVps) { return m_iSubPULog2Size[layerIdInVps]; } 836 Void setSubPULog2Size(Int layerIdInVps, Int u) { m_iSubPULog2Size[layerIdInVps] = u;} 837 #endif 828 838 #endif 829 839 #if H_3D_VSP … … 854 864 Void setInterSDCFlag ( Int layerIdInVps, Bool bval ){ m_bInterSDCFlag[layerIdInVps] = bval; } 855 865 #endif 856 866 #if SEC_MPI_ENABLING_MERGE_F0150 867 Bool getMPIFlag ( Int layerIdInVps ) { return m_bMPIFlag[layerIdInVps]; } 868 Void setMPIFlag ( Int layerIdInVps, Bool bval ){ m_bMPIFlag[layerIdInVps] = bval; } 869 #endif 857 870 #endif 858 871 #endif … … 1338 1351 UInt getCamParPrecision () { return m_uiCamParPrecision; } 1339 1352 Bool hasCamParInSliceHeader() { return m_bCamParInSliceHeader; } 1353 #if QC_DEPTH_IV_MRG_F0125 1354 Void setHasCamParInSliceHeader( Bool b ) { m_bCamParInSliceHeader = b; } 1355 #endif 1340 1356 Int* getCodedScale () { return m_aaiCodedScale [0]; } 1341 1357 Int* getCodedOffset () { return m_aaiCodedOffset[0]; } … … 1730 1746 #endif 1731 1747 #if H_3D_ARP 1748 #if SHARP_ARP_REF_CHECK_F0105 1749 Bool m_arpRefPicAvailable[2][MAX_NUM_LAYERS]; 1750 #endif 1732 1751 TComList<TComPic*> * m_pBaseViewRefPicList[MAX_NUM_LAYERS]; 1733 1752 UInt m_nARPStepNum; 1753 #if QC_MTK_INTERVIEW_ARP_F0123_F0108 1754 Int m_aiFirstTRefIdx [2]; 1755 #endif 1734 1756 #endif 1735 1757 #if H_3D_IC … … 1818 1840 #if H_3D_ARP 1819 1841 Void setBaseViewRefPicList( TComList<TComPic*> *pListPic, Int iViewIdx ) { m_pBaseViewRefPicList[iViewIdx] = pListPic; } 1842 #if SHARP_ARP_REF_CHECK_F0105 1843 Void setARPStepNum( TComPicLists*ivPicLists ); 1844 #else 1820 1845 Void setARPStepNum(); 1846 #endif 1821 1847 TComPic* getBaseViewRefPic ( UInt uiPOC , Int iViewIdx ) { return xGetRefPic( *m_pBaseViewRefPicList[iViewIdx], uiPOC ); } 1822 1848 UInt getARPStepNum( ) { return m_nARPStepNum; } … … 2019 2045 Int getAlterRefIdx ( RefPicList e ) { return m_aiAlterRefIdx[e]; } 2020 2046 #endif 2047 #if QC_MTK_INTERVIEW_ARP_F0123_F0108 2048 Int getFirstTRefIdx ( RefPicList e ) { return m_aiFirstTRefIdx[e]; } 2049 Void setFirstTRefIdx ( RefPicList e, Int i ) { m_aiFirstTRefIdx[e] = i; } 2050 #endif 2051 #if SHARP_ARP_REF_CHECK_F0105 2052 Bool getArpRefPicAvailable( RefPicList e, Int viewIdx) {return m_arpRefPicAvailable[e][getVPS()->getLayerIdInNuh(viewIdx, 0)]; } 2053 #endif 2021 2054 Void setIsDepth ( Bool isDepth ) { m_isDepth = isDepth; } 2022 2055 Bool getIsDepth () { return m_isDepth; } -
trunk/source/Lib/TLibCommon/TComWedgelet.h
r655 r724 50 50 enum DIM_IDX 51 51 { 52 #if SEC_DMM3_RBC_F0147 53 DMM1_IDX = 0, 54 DMM4_IDX = 1, 55 #else 52 56 DMM1_IDX = 0, 53 57 DMM3_IDX = 1, 54 58 DMM4_IDX = 2, 55 59 RBC_IDX = 3 60 #endif 56 61 }; 57 62 63 #if SEC_DMM3_RBC_F0147 64 #define DMM_NUM_TYPE 2 65 #define DIM_NUM_TYPE (DMM_NUM_TYPE) 66 #else 58 67 #define DMM_NUM_TYPE 3 59 68 #define RBC_NUM_TYPE 1 60 69 #define DIM_NUM_TYPE (DMM_NUM_TYPE+RBC_NUM_TYPE) 70 #endif 61 71 #define DIM_NO_IDX MAX_UINT 62 72 … … 75 85 #define DMM_NO_WEDGEINDEX MAX_UINT 76 86 #define DMM_NUM_WEDGE_REFINES 8 87 #if !SEC_DMM3_RBC_F0147 77 88 #define DMM3_SIMPLIFY_TR 1 89 #endif 78 90 79 91 enum WedgeResolution -
trunk/source/Lib/TLibCommon/TypeDef.h
r655 r724 65 65 #define H_3D ( HEVC_EXT == 2) 66 66 67 67 68 ///////////////////////////////////////////////////////////////////////////////////////// 68 69 /////////////////////////////////// MAJOR DEFINES /////////////////////////////////// … … 131 132 // QC_AMVP_MRG_UNIFY_IVCAN_C0051 132 133 // TEXTURE MERGING CANDIDATE , JCT3V-C0137 133 // QC_INRIA_MTK_MRG_E0126 134 // QC_INRIA_MTK_MRG_E0126 135 136 134 137 #define H_3D_TMVP 1 // QC_TMVP_C0047 135 138 // Sony_M23639 … … 162 165 163 166 164 165 167 // OTHERS 166 168 // MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170 // Progressive MV Compression, JCT3V-E0170 … … 173 175 #endif 174 176 175 176 177 // Rate Control 177 178 #define KWU_FIX_URQ 1 … … 212 213 #if H_3D_DIM 213 214 #define H_3D_DIM_DMM 1 // Depth Modeling Modes 214 #define H_3D_DIM_RBC 1 // Region Boundary Chain mode215 215 #define H_3D_DIM_SDC 1 // Simplified Depth Coding method 216 216 #define H_3D_DIM_DLT 1 // Depth Lookup Table … … 227 227 #define H_3D_VSP_CONSTRAINED 0 228 228 #endif 229 230 229 #endif 231 230 … … 243 242 #define H_3D_FCO_VSP_DONBDV_E0163 0 // Adaptive depth reference for flexible coding order 244 243 #endif 244 245 246 ///////////////////////////////////////////////////////////////////////////////////////// 247 /////////////////////////////////// HTM-9.0 Integrations ////////////////////////////// 248 ///////////////////////////////////////////////////////////////////////////////////////// 249 250 #if H_3D 251 252 #define FIX_MISSING_MACRO_R690 1 // Missing macro in integration to revision 690 253 254 #define SEC_MPI_ENABLING_MERGE_F0150 1 // MPI flag in VPS and enabling in Merge mode 255 #define ETRIKHU_MERGE_REUSE_F0093 1 // Reuse HEVC merge candidate list construction for base candidates, JCT3V-F0093 256 257 #if H_3D_ARP 258 #define QC_MTK_INTERVIEW_ARP_F0123_F0108 1 //JCT3V-F0123; JCT3V-F0108 259 #define SHARP_ARP_REF_CHECK_F0105 1 // ARP reference picture selection and DPB check 260 #define LGE_ARP_CTX_F0161 1 //JCT3V-F0161 261 #endif 262 263 #if H_3D_IV_MERGE 264 #define QC_DEPTH_IV_MRG_F0125 1 // JCT3V-F0125: Depth oriented Inter-view MV candidate 265 #define MTK_SPIVMP_F0110 1 // JCT3V-F0110: Sub-PU level inter-view motion prediction 266 #define BUGFIX_F0093 1 // bug fix for F0093 for depth IvMC pruning 267 #define BUGFIX_2_F0093 1 // bug fix for VSP inheritance 268 #endif 269 270 #if H_3D_VSP 271 #define MTK_F0109_LG_F0120_VSP_BLOCK 1 // MTK_LG_SIMPLIFY_VSP_BLOCK_PARTITION_F0109_F0120 272 #define SHARP_VSP_BLOCK_IN_AMP_F0102 1 // VSP partitioning for AMP 273 #define MTK_VSP_SIMPLIFICATION_F0111 1 // 1. Inherited VSP also use NBDV of current CU, 2. VSP cannot be inherited from above LCU rowss 274 #define LGE_SHARP_VSP_INHERIT_F0104 1 275 #endif 276 277 #define LGE_BUGFIX_F0158 1 //JCT3V-F0158 278 #define LGE_IC_CTX_F0160 1 //JCT3V-F0160 279 #define SEC_ONLY_TEXTURE_IC_F0151 1 280 281 #if H_3D_DIM 282 #define SEC_DMM3_RBC_F0147 1 // Removal of DMM3 and RBC from DMMs 283 #if !SEC_DMM3_RBC_F0147 284 #define H_3D_DIM_RBC 1 // Region Boundary Chain mode 285 #endif 286 #define QC_DIM_DELTADC_UNIFY_F0132 1 // Unify delta DC coding in depth intra modes 287 #define HHI_DIM_PREDSAMP_FIX_F0171 1 288 #define LGE_PRED_RES_CODING_DLT_DOMAIN_F0159 1 //JCT3V-F0159 289 #endif 290 #endif 291 245 292 246 293 /////////////////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.