Changeset 476 in 3DVCSoftware for branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComDataCU.cpp
- Timestamp:
- 18 Jun 2013, 05:16:27 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComDataCU.cpp
r456 r476 40 40 #include "TComPic.h" 41 41 42 #if H_3D_IV_MERGE 43 #include "TComDepthMapGenerator.h" 44 #endif 42 45 //! \ingroup TLibCommon 43 46 //! \{ … … 2426 2429 { 2427 2430 UInt uiAbsPartAddr = m_uiAbsIdxInLCU + uiAbsPartIdx; 2431 #if H_3D_IV_MERGE 2432 TComMv cZeroMv; 2433 Bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ]; 2434 #else 2428 2435 Bool abCandIsInter[ MRG_MAX_NUM_CANDS ]; 2436 #endif 2429 2437 for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ++ui ) 2430 2438 { 2431 2439 abCandIsInter[ui] = false; 2440 #if H_3D_IV_MERGE 2441 pcMvFieldNeighbours[ ( ui << 1 ) ].setMvField(cZeroMv, NOT_VALID); 2442 pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setMvField(cZeroMv, NOT_VALID); 2443 #else 2432 2444 pcMvFieldNeighbours[ ( ui << 1 ) ].setRefIdx(NOT_VALID); 2433 2445 pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setRefIdx(NOT_VALID); 2446 #endif 2434 2447 } 2435 2448 numValidMergeCand = getSlice()->getMaxNumMergeCand(); … … 2444 2457 deriveLeftRightTopIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT ); 2445 2458 deriveLeftBottomIdxGeneral ( uiAbsPartIdx, uiPUIdx, uiPartIdxLB ); 2459 2460 #if H_3D_IV_MERGE 2461 Bool bNoPdmMerge = ( m_pcSlice->getSPS()->getViewIndex() == 0 || ( m_pcSlice->getSPS()->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) != PDM_USE_FOR_MERGE ); 2462 2463 //===== add merge with predicted depth maps ===== 2464 TComMv acPdmMv [4]; 2465 Int aiPdmRefIdx [4] = {-1, -1, -1, -1}; 2466 Bool bLeftAvai = false; 2467 Int iPosLeftAbove[2] = {-1, -1}; 2468 2469 //Notes from QC: DvMCP related variables. 2470 //acPdmMv[0].m_bDvMcp = acPdmMv[1].m_bDvMcp = acPdmMv[2].m_bDvMcp = acPdmMv[3].m_bDvMcp = false; 2471 2472 DisInfo cDisInfo; 2473 2474 cDisInfo.bDV = getDvInfo(uiAbsPartIdx).bDV; 2475 cDisInfo.m_acNBDV = getDvInfo(uiAbsPartIdx).m_acNBDV; 2476 cDisInfo.m_aVIdxCan = getDvInfo(uiAbsPartIdx).m_aVIdxCan; 2477 2478 if( m_pcSlice->getIsDepth()) 2479 { 2480 UInt uiPartIdxCenter; 2481 xDeriveCenterIdx( uiPUIdx, uiPartIdxCenter ); 2482 TComDataCU *pcTextureCU = m_pcSlice->getTexturePic()->getCU( getAddr() ); 2483 2484 if ( pcTextureCU && !pcTextureCU->isIntra( uiPartIdxCenter ) ) 2485 { 2486 abCandIsInter[iCount] = true; 2487 puhInterDirNeighbours[iCount] = pcTextureCU->getInterDir( uiPartIdxCenter ); 2488 if( ( puhInterDirNeighbours[iCount] & 1 ) == 1 ) 2489 { 2490 pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] ); 2491 2492 TComMv cMvPred = pcMvFieldNeighbours[iCount<<1].getMv(); 2493 2494 //Notes from MTK: shoud be aligned with " full-pel mv accuracy for depth maps", currently not supported 2495 //const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) ); 2496 //cMvPred+=cAdd; 2497 //cMvPred>>=2; 2498 //clipMv(cMvPred); 2499 //pcMvFieldNeighbours[iCount<<1].setMvField(cMvPred,pcMvFieldNeighbours[iCount<<1].getRefIdx()); 2500 if (pcMvFieldNeighbours[iCount<<1].getRefIdx()<0) 2501 { 2502 for (Int i=0; i<getSlice()->getNumRefIdx(REF_PIC_LIST_0); i++) 2503 { 2504 if (getSlice()->getRefPOC(REF_PIC_LIST_0, i) == getSlice()->getPOC()) 2505 { 2506 pcMvFieldNeighbours[iCount<<1].setMvField(cMvPred,i); 2507 break; 2508 } 2509 } 2510 } 2511 2512 } 2513 2514 if ( getSlice()->isInterB() ) 2515 { 2516 if( ( puhInterDirNeighbours[iCount] & 2 ) == 2 ) 2517 { 2518 pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 2519 TComMv cMvPred = pcMvFieldNeighbours[(iCount<<1)+1].getMv(); 2520 2521 //Notes from MTK: shoud be aligned with " full-pel mv accuracy for depth maps", currently not supported 2522 //const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) ); 2523 //cMvPred+=cAdd; 2524 //cMvPred>>=2; 2525 //clipMv(cMvPred); 2526 //pcMvFieldNeighbours[(iCount<<1)+1].setMvField(cMvPred,pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx()); 2527 if (pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx()<0) 2528 { 2529 for (Int i=0; i<getSlice()->getNumRefIdx(REF_PIC_LIST_1); i++) 2530 { 2531 if (getSlice()->getRefPOC(REF_PIC_LIST_1, i) == getSlice()->getPOC()) 2532 { 2533 pcMvFieldNeighbours[(iCount<<1)+1].setMvField(cMvPred,i); 2534 break; 2535 } 2536 } 2537 } 2538 2539 } 2540 } 2541 2542 if (!((pcMvFieldNeighbours[iCount<<1].getRefIdx()<0 && !getSlice()->isInterB()) 2543 || (pcMvFieldNeighbours[iCount<<1].getRefIdx()<0 && pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx()<0 && getSlice()->isInterB()))) 2544 { 2545 if ( mrgCandIdx == iCount ) 2546 { 2547 return; 2548 } 2549 iCount ++; 2550 } 2551 else 2552 { 2553 assert(0); 2554 } 2555 } 2556 } 2557 2558 Int iPdmDir[2] = {0, 0}; 2559 getUnifiedMvPredCan(uiPUIdx, REF_PIC_LIST_0, 0, aiPdmRefIdx, acPdmMv, &cDisInfo, iPdmDir, true); 2560 Int iPdmInterDir; 2561 2562 if( iPdmDir[0] && !bNoPdmMerge ) 2563 { 2564 abCandIsInter [ iCount ] = true; 2565 puhInterDirNeighbours[ iCount ] = iPdmDir[0]; 2566 iPdmInterDir = iPdmDir[0]; 2567 2568 if( ( iPdmInterDir & 1 ) == 1 ) 2569 { 2570 pcMvFieldNeighbours[ iCount<<1 ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] ); 2571 } 2572 2573 if( ( iPdmInterDir & 2 ) == 2 ) 2574 { 2575 pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] ); 2576 } 2577 2578 if ( mrgCandIdx == iCount ) 2579 { 2580 return; 2581 } 2582 iCount ++; 2583 } 2584 #endif 2585 2586 #if !H_3D_IV_MERGE 2446 2587 #if H_3D_NBDV //Notes from QC: DvMCP related variables. 2447 2588 //acPdmMv[0].m_bDvMcp = acPdmMv[1].m_bDvMcp = acPdmMv[2].m_bDvMcp = acPdmMv[3].m_bDvMcp = false; … … 2461 2602 //} 2462 2603 #endif 2604 #endif 2605 2463 2606 //left 2464 2607 UInt uiLeftPartIdx = 0; … … 2480 2623 pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 2481 2624 } 2625 2626 #if H_3D_IV_MERGE 2627 Bool bRemoveSpa = false; //pruning to inter-view candidates 2628 Int iCnloop = iCount - 1; 2629 for(; iCnloop >= 0; iCnloop --) 2630 { 2631 if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1]) 2632 { 2633 bRemoveSpa = true; 2634 abCandIsInter [ iCount ] = false; 2635 2636 //reset to the default value for MC 2637 puhInterDirNeighbours[iCount] = 0; 2638 pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID ); 2639 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID ); 2640 break; 2641 } 2642 } 2643 if(!bRemoveSpa) 2644 { 2645 bLeftAvai = true; 2646 iPosLeftAbove[0] = iCount; 2647 2648 if ( mrgCandIdx == iCount ) 2649 { 2650 return; 2651 } 2652 iCount ++; 2653 } 2654 #else 2482 2655 if ( mrgCandIdx == iCount ) 2483 2656 { … … 2485 2658 } 2486 2659 iCount ++; 2660 #endif 2487 2661 } 2488 2662 … … 2511 2685 pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] ); 2512 2686 } 2687 #if H_3D_IV_MERGE 2688 Bool bRemoveSpa = false; //pruning to inter-view candidates 2689 Int iCnloop = bLeftAvai? (iCount-2): (iCount-1); 2690 for(; iCnloop >= 0; iCnloop --) 2691 { 2692 if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1]) 2693 { 2694 bRemoveSpa = true; 2695 abCandIsInter [ iCount ] = false; 2696 2697 //reset to the default value for MC 2698 puhInterDirNeighbours[iCount] = 0; 2699 2700 pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID ); 2701 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID ); 2702 break; 2703 } 2704 } 2705 if(!bRemoveSpa) 2706 { 2707 iPosLeftAbove[1] = iCount; 2708 2709 if ( mrgCandIdx == iCount ) 2710 { 2711 return; 2712 } 2713 iCount ++; 2714 } 2715 #else 2513 2716 if ( mrgCandIdx == iCount ) 2514 2717 { … … 2516 2719 } 2517 2720 iCount ++; 2721 #endif 2518 2722 } 2519 2723 // early termination … … 2552 2756 return; 2553 2757 } 2758 2759 #if H_3D_IV_MERGE 2760 if(!bNoPdmMerge && iPdmDir[1] ) 2761 { 2762 assert(iCount < getSlice()->getMaxNumMergeCand()); 2763 abCandIsInter [ iCount ] = true; 2764 puhInterDirNeighbours[ iCount ] = iPdmDir[1]; 2765 if( ( iPdmDir[1] & 1 ) == 1 ) 2766 { 2767 pcMvFieldNeighbours[ iCount<<1 ].setMvField( acPdmMv[ 2 ], aiPdmRefIdx[ 2 ] ); 2768 } 2769 if( ( iPdmDir[1] & 2 ) == 2 ) 2770 { 2771 pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 3 ], aiPdmRefIdx[ 3 ] ); 2772 } 2773 2774 Bool bRemoveSpa = false; //pruning to A1, B1 2775 for(Int i = 0; i < 2; i ++) 2776 { 2777 Int iCnloop = iPosLeftAbove[i]; 2778 if(iCnloop == -1) 2779 continue; 2780 if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1]) 2781 { 2782 bRemoveSpa = true; 2783 abCandIsInter [ iCount ] = false; 2784 //reset to the default value for MC 2785 puhInterDirNeighbours[iCount] = 0; 2786 pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID ); 2787 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID ); 2788 break; 2789 } 2790 } 2791 if(!bRemoveSpa) 2792 { 2793 if ( mrgCandIdx == iCount ) 2794 return; 2795 iCount ++; 2796 2797 // early termination 2798 if (iCount == getSlice()->getMaxNumMergeCand()) 2799 { 2800 return; 2801 } 2802 } 2803 } 2804 #endif 2554 2805 2555 2806 //left bottom … … 2717 2968 if ( getSlice()->isInterB()) 2718 2969 { 2970 #if H_3D_IV_MERGE 2971 UInt uiPriorityList0[20] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3, 0, 4, 1, 4, 2, 4, 3, 4 }; 2972 UInt uiPriorityList1[20] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2, 4, 0, 4, 1, 4, 2, 4, 3 }; 2973 #else 2719 2974 UInt uiPriorityList0[12] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3}; 2720 2975 UInt uiPriorityList1[12] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2}; 2976 #endif 2721 2977 2722 2978 for (Int idx=0; idx<uiCutoff*(uiCutoff-1) && uiArrayAddr!= getSlice()->getMaxNumMergeCand(); idx++) … … 4246 4502 } 4247 4503 #endif 4504 4505 #if H_3D_IV_MERGE 4506 Bool TComDataCU::getUnifiedMvPredCan(UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm, Bool bMerge ) 4507 { 4508 TComDepthMapGenerator* pcDepthMapGenerator = m_pcSlice->getSPS()->getDepthMapGenerator(); 4509 ROFRS( pcDepthMapGenerator, false ); 4510 if (pcDepthMapGenerator->getPdmCandidate(this, uiPartIdx, eRefPicList, iRefIdx, paiPdmRefIdx, pacPdmMv, pDInfo, iPdm, bMerge)) 4511 return true; 4512 return false; 4513 } 4514 #endif 4248 4515 //! \}
Note: See TracChangeset for help on using the changeset viewer.