Changeset 510 in 3DVCSoftware for branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComDataCU.cpp
- Timestamp:
- 2 Jul 2013, 21:49:16 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComDataCU.cpp
r504 r510 116 116 #endif 117 117 118 #if H_3D_VSP 119 m_piVSPFlag = NULL; 120 #endif 121 118 122 #if H_3D_ARP 119 123 m_puhARPW = NULL; … … 157 161 m_pbMergeFlag = (Bool* )xMalloc(Bool, uiNumPartition); 158 162 m_puhMergeIndex = (UChar* )xMalloc(UChar, uiNumPartition); 163 #if H_3D_VSP 164 m_piVSPFlag = (Char* )xMalloc(Char, uiNumPartition); 165 #endif 159 166 m_puhLumaIntraDir = (UChar* )xMalloc(UChar, uiNumPartition); 160 167 m_puhChromaIntraDir = (UChar* )xMalloc(UChar, uiNumPartition); … … 276 283 if ( m_pbMergeFlag ) { xFree(m_pbMergeFlag); m_pbMergeFlag = NULL; } 277 284 if ( m_puhMergeIndex ) { xFree(m_puhMergeIndex); m_puhMergeIndex = NULL; } 285 #if H_3D_VSP 286 if ( m_piVSPFlag ) { xFree(m_piVSPFlag); m_piVSPFlag = NULL; } 287 #endif 278 288 if ( m_puhLumaIntraDir ) { xFree(m_puhLumaIntraDir); m_puhLumaIntraDir = NULL; } 279 289 if ( m_puhChromaIntraDir ) { xFree(m_puhChromaIntraDir); m_puhChromaIntraDir = NULL; } … … 442 452 m_pbMergeFlag[ui]=pcFrom->m_pbMergeFlag[ui]; 443 453 m_puhMergeIndex[ui]=pcFrom->m_puhMergeIndex[ui]; 454 #if H_3D_VSP 455 m_piVSPFlag[ui] = pcFrom->m_piVSPFlag[ui]; 456 #endif 444 457 m_puhLumaIntraDir[ui]=pcFrom->m_puhLumaIntraDir[ui]; 445 458 m_puhChromaIntraDir[ui]=pcFrom->m_puhChromaIntraDir[ui]; … … 475 488 memset( m_pbMergeFlag + firstElement, false, numElements * sizeof( *m_pbMergeFlag ) ); 476 489 memset( m_puhMergeIndex + firstElement, 0, numElements * sizeof( *m_puhMergeIndex ) ); 490 #if H_3D_VSP 491 memset( m_piVSPFlag + firstElement, 0, numElements * sizeof( *m_piVSPFlag ) ); 492 #endif 477 493 memset( m_puhLumaIntraDir + firstElement, DC_IDX, numElements * sizeof( *m_puhLumaIntraDir ) ); 478 494 memset( m_puhChromaIntraDir + firstElement, 0, numElements * sizeof( *m_puhChromaIntraDir ) ); … … 617 633 m_pbMergeFlag[ui] = 0; 618 634 m_puhMergeIndex[ui] = 0; 635 #if H_3D_VSP 636 m_piVSPFlag[ui] = 0; 637 #endif 619 638 m_puhLumaIntraDir[ui] = DC_IDX; 620 639 m_puhChromaIntraDir[ui] = 0; … … 688 707 memset( m_pbMergeFlag, 0, iSizeInBool ); 689 708 memset( m_puhMergeIndex, 0, iSizeInUchar ); 709 #if H_3D_VSP 710 memset( m_piVSPFlag, 0, sizeof( Char ) * m_uiNumPartition ); 711 #endif 690 712 memset( m_puhLumaIntraDir, DC_IDX, iSizeInUchar ); 691 713 memset( m_puhChromaIntraDir, 0, iSizeInUchar ); … … 744 766 m_pbMergeFlag[ui]=pcCU->m_pbMergeFlag[uiPartOffset+ui]; 745 767 m_puhMergeIndex[ui]=pcCU->m_puhMergeIndex[uiPartOffset+ui]; 768 #if H_3D_VSP 769 m_piVSPFlag[ui]=pcCU->m_piVSPFlag[uiPartOffset+ui]; 770 #endif 746 771 m_puhLumaIntraDir[ui]=pcCU->m_puhLumaIntraDir[uiPartOffset+ui]; 747 772 m_puhChromaIntraDir[ui]=pcCU->m_puhChromaIntraDir[uiPartOffset+ui]; … … 866 891 m_pbMergeFlag = pcCU->getMergeFlag() + uiPart; 867 892 m_puhMergeIndex = pcCU->getMergeIndex() + uiPart; 893 #if H_3D_VSP 894 m_piVSPFlag = pcCU->getVSPFlag() + uiPart; 895 #endif 868 896 869 897 #if H_3D_ARP … … 986 1014 m_pbMergeFlag = pcCU->getMergeFlag() + uiAbsPartIdx; 987 1015 m_puhMergeIndex = pcCU->getMergeIndex() + uiAbsPartIdx; 1016 #if H_3D_VSP 1017 m_piVSPFlag = pcCU->getVSPFlag() + uiAbsPartIdx; 1018 #endif 988 1019 989 1020 m_apiMVPIdx[eRefPicList] = pcCU->getMVPIdx(eRefPicList) + uiAbsPartIdx; … … 1030 1061 memcpy( m_pbMergeFlag + uiOffset, pcCU->getMergeFlag(), iSizeInBool ); 1031 1062 memcpy( m_puhMergeIndex + uiOffset, pcCU->getMergeIndex(), iSizeInUchar ); 1063 #if H_3D_VSP 1064 memcpy( m_piVSPFlag + uiOffset, pcCU->getVSPFlag(), sizeof( Char ) * uiNumPartition ); 1065 #endif 1032 1066 memcpy( m_puhLumaIntraDir + uiOffset, pcCU->getLumaIntraDir(), iSizeInUchar ); 1033 1067 memcpy( m_puhChromaIntraDir + uiOffset, pcCU->getChromaIntraDir(), iSizeInUchar ); … … 1120 1154 memcpy( rpcCU->getMergeFlag() + m_uiAbsIdxInLCU, m_pbMergeFlag, iSizeInBool ); 1121 1155 memcpy( rpcCU->getMergeIndex() + m_uiAbsIdxInLCU, m_puhMergeIndex, iSizeInUchar ); 1156 #if H_3D_VSP 1157 memcpy( rpcCU->getVSPFlag() + m_uiAbsIdxInLCU, m_piVSPFlag, sizeof( Char ) * m_uiNumPartition ); 1158 #endif 1122 1159 memcpy( rpcCU->getLumaIntraDir() + m_uiAbsIdxInLCU, m_puhLumaIntraDir, iSizeInUchar ); 1123 1160 memcpy( rpcCU->getChromaIntraDir() + m_uiAbsIdxInLCU, m_puhChromaIntraDir, iSizeInUchar ); … … 1199 1236 memcpy( rpcCU->getMergeFlag() + uiPartOffset, m_pbMergeFlag, iSizeInBool ); 1200 1237 memcpy( rpcCU->getMergeIndex() + uiPartOffset, m_puhMergeIndex, iSizeInUchar ); 1238 #if H_3D_VSP 1239 memcpy( rpcCU->getVSPFlag() + uiPartOffset, m_piVSPFlag, sizeof(Char) * uiQNumPart ); 1240 #endif 1201 1241 memcpy( rpcCU->getLumaIntraDir() + uiPartOffset, m_puhLumaIntraDir, iSizeInUchar ); 1202 1242 memcpy( rpcCU->getChromaIntraDir() + uiPartOffset, m_puhChromaIntraDir, iSizeInUchar ); … … 2143 2183 setSubPart<UChar>( uiMergeIndex, m_puhMergeIndex, uiAbsPartIdx, uiDepth, uiPartIdx ); 2144 2184 } 2185 2186 #if H_3D_VSP 2187 Void TComDataCU::setVSPFlagSubParts( Char iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) 2188 { 2189 setSubPart<Char>( iVSPFlag, m_piVSPFlag, uiAbsPartIdx, uiDepth, uiPartIdx ); 2190 } 2191 #endif 2145 2192 2146 2193 Void TComDataCU::setChromIntraDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiDepth ) … … 2572 2619 } 2573 2620 2621 #if H_3D_VSP 2622 2623 /** Add a VSP merging candidate 2624 * \Inputs 2625 * \param uiPUIdx: PU index within a CU 2626 * \param ucVspMergePos: Specify the VSP merge candidate position 2627 * \param mrgCandIdx: Target merge candidate index. At encoder, it is set equal to -1, such that the whole merge candidate list will be constructed. 2628 * \param pDinfo: The "disparity information" derived from neighboring blocks. Type 1 MV. 2629 * \param uiCount: The next position to add VSP merge candidate 2630 * 2631 * \Outputs 2632 * \param uiCount: The next position to add merge candidate. Will be updated if VSP is successfully added 2633 * \param abCandIsInter: abCandIsInter[iCount] tells that VSP candidate is an Inter candidate, if VSP is successfully added 2634 * \param pcMvFieldNeighbours: Return the "disparity vector". Type 1 MV. To be used to fetch a depth block. A "global" variable 2635 * \param puhInterDirNeighbours: Tells the VSP prediction direction. TODO: The value does NOT matter for VSP, as the direction will be determined based on availability later 2636 * Having it as output is mainly for coding beauty 2637 * \param vspFlag: vspFlag[iCount] will be set (equal to 1), if VSP is successfully added. To be used to indicate the actual position of the VSP candidate 2638 * 2639 * \Return 2640 * true: if the VSP candidate is added at the target position 2641 * false: otherwise 2642 */ 2643 inline Bool TComDataCU::xAddVspCand( UChar ucVspMergePos, Int mrgCandIdx, DisInfo* pDInfo, Int& iCount, 2644 Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag ) 2645 { 2646 if( !m_pcSlice->getVPS()->getViewSynthesisPredFlag( m_pcSlice->getLayerIdInVps() ) ) // Not to add the candidate if VSP is turned off 2647 return false; 2648 if( m_pcSlice->getIsDepth() ) // VSP is turned off for depth layers 2649 return false; 2650 2651 Int refViewIdx = pDInfo->m_aVIdxCan; 2652 TComPic* picDepth = NULL; 2653 //assert(getSlice()->getRefPic(eRefPicList, refId)->getPOC() == getSlice()->getPOC()); 2654 picDepth = getSlice()->getIvPic( true, refViewIdx ); 2655 2656 /* 2657 // Code if simply re-writing 2658 if(ucVspMergePos == H_3D_VSPPOSITION && picDepth != NULL && 0 != m_pcSlice->getViewIndex() ) // VSP can be used only when depth is used as input 2659 { 2660 abCandIsInter[iCount] = true; 2661 puhInterDirNeighbours[iCount] = 1; 2662 vspFlag[iCount] = 1; 2663 vspDirTrue[iCount] = 0; // TODO: Check if this is really useful!!!! 2664 2665 Int iRefIdxList0 = getSlice()->getRefPic(REF_PIC_LIST_0, 0)->getPOC() == getSlice()->getPOC() ? 0 : 2666 (getSlice()->getAlterRefIdx(REF_PIC_LIST_0) == -1 ? NOT_VALID : getSlice()->getAlterRefIdx(REF_PIC_LIST_0)); 2667 pcMvFieldNeighbours[iCount<<1].setMvField( pDInfo->m_acDoNBDV, iRefIdxList0 ); 2668 if (getSlice()->isInterB()) 2669 { 2670 puhInterDirNeighbours[iCount] = xGetVspDirection(uiPUIdx); 2671 Int iRefIdxList1 = getSlice()->getRefPic(REF_PIC_LIST_1, 0)->getPOC() == getSlice()->getPOC() ? 0 : 2672 (getSlice()->getAlterRefIdx(REF_PIC_LIST_1) == -1 ? NOT_VALID : getSlice()->getAlterRefIdx(REF_PIC_LIST_1)); 2673 pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acDoNBDV, iRefIdxList1 ); 2674 } 2675 2676 if ( mrgCandIdx == iCount ) 2677 return true; 2678 2679 iCount++; 2680 } 2681 */ 2682 if(ucVspMergePos == H_3D_VSP_POSITION && picDepth != NULL && 0 != m_pcSlice->getViewIndex() ) // VSP can be used only when depth is used as input 2683 { 2684 abCandIsInter[iCount] = true; 2685 puhInterDirNeighbours[iCount] = 0; 2686 vspFlag[iCount] = 1; 2687 2688 Bool refViewAvailFlag = false; 2689 UChar predFlag[2] = {0, 0}; 2690 Int iRefListIdX = 0; 2691 Int iRefListIdY = 0; 2692 2693 for( iRefListIdX = 0; iRefListIdX < 2 && !refViewAvailFlag; iRefListIdX++ ) 2694 { 2695 RefPicList eRefPicList = RefPicList( iRefListIdX ); 2696 for (Int i = 0; i < m_pcSlice->getNumRefIdx(eRefPicList) && !refViewAvailFlag; i++) 2697 { 2698 Int viewIdxRefInList = m_pcSlice->getRefPic(eRefPicList, i)->getViewIndex(); 2699 if (refViewIdx == viewIdxRefInList) 2700 { 2701 refViewAvailFlag = true; 2702 predFlag[iRefListIdX] = 1; 2703 iRefListIdY = 1 - iRefListIdX; 2704 pcMvFieldNeighbours[(iCount<<1)+iRefListIdX].setMvField( pDInfo->m_acDoNBDV, i ); 2705 } 2706 } 2707 } 2708 2709 if (m_pcSlice->isInterB() && refViewAvailFlag) 2710 { 2711 RefPicList eRefPicList = RefPicList( iRefListIdY ); 2712 refViewAvailFlag = false; 2713 for (Int i = 0; i < m_pcSlice->getNumRefIdx(eRefPicList) && !refViewAvailFlag; i++) 2714 { 2715 Int viewIdxRefInList = m_pcSlice->getRefPic(eRefPicList, i)->getViewIndex(); 2716 if (refViewIdx != viewIdxRefInList) 2717 { 2718 refViewAvailFlag = true; 2719 predFlag[iRefListIdY] = 1; 2720 pcMvFieldNeighbours[(iCount<<1)+iRefListIdY].setMvField( pDInfo->m_acDoNBDV, i ); 2721 } 2722 } 2723 } 2724 2725 puhInterDirNeighbours[iCount] = (predFlag[0] | (predFlag[1] << 1)); 2726 2727 if ( mrgCandIdx == iCount ) 2728 return true; 2729 2730 iCount++; 2731 } 2732 2733 return false; 2734 } 2735 #endif 2736 2574 2737 /** Constructs a list of merging candidates 2575 2738 * \param uiAbsPartIdx … … 2580 2743 * \param numValidMergeCand 2581 2744 */ 2582 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx ) 2745 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours 2746 #if H_3D_VSP 2747 , Int* vspFlag 2748 #endif 2749 , Int& numValidMergeCand 2750 , Int mrgCandIdx 2751 ) 2583 2752 { 2584 2753 UInt uiAbsPartAddr = m_uiAbsIdxInLCU + uiAbsPartIdx; … … 2830 2999 pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false); 2831 3000 #endif 3001 #if H_3D_VSP 3002 if (pcCULeft->getVSPFlag(uiLeftPartIdx) == 1) 3003 vspFlag[iCount] = 1; 3004 #endif 2832 3005 if ( mrgCandIdx == iCount ) 2833 3006 { … … 2894 3067 pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false); 2895 3068 #endif 3069 #if H_3D_VSP 3070 if (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1) 3071 vspFlag[iCount] = 1; 3072 #endif 2896 3073 if ( mrgCandIdx == iCount ) 2897 3074 { … … 2936 3113 pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false); 2937 3114 #endif 3115 #if H_3D_VSP 3116 if (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1) 3117 vspFlag[iCount] = 1; 3118 #endif 2938 3119 if ( mrgCandIdx == iCount ) 2939 3120 { … … 3003 3184 #endif 3004 3185 3186 #if H_3D_VSP 3187 if ( xAddVspCand( 3, mrgCandIdx, &cDisInfo, iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag ) ) 3188 return; 3189 // early termination 3190 if (iCount == getSlice()->getMaxNumMergeCand()) 3191 return; 3192 #endif 3193 3005 3194 //left bottom 3006 3195 UInt uiLeftBottomPartIdx = 0; … … 3025 3214 pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false); 3026 3215 #endif 3216 #if H_3D_VSP 3217 if (pcCULeftBottom->getVSPFlag(uiLeftBottomPartIdx) == 1) 3218 vspFlag[iCount] = 1; 3219 #endif 3027 3220 if ( mrgCandIdx == iCount ) 3028 3221 { … … 3060 3253 pcMvFieldNeighbours[iCount<<1 ].getMv().setIDVFlag (false); 3061 3254 pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false); 3255 #endif 3256 #if H_3D_VSP 3257 if (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1) 3258 vspFlag[iCount] = 1; 3062 3259 #endif 3063 3260 if ( mrgCandIdx == iCount ) … … 3192 3389 { 3193 3390 Int i = uiPriorityList0[idx]; Int j = uiPriorityList1[idx]; 3391 #if H_3D_VSP 3392 Bool bValid = true; 3393 if ( vspFlag[i] == 1 || vspFlag[j] == 1 ) 3394 bValid = false; 3395 if( !m_pcSlice->getVPS()->getViewSynthesisPredFlag( m_pcSlice->getLayerIdInVps() ) ) 3396 assert(bValid == true); 3397 #endif 3398 #if H_3D_VSP 3399 if (abCandIsInter[i] && abCandIsInter[j] && (puhInterDirNeighbours[i]&0x1) && (puhInterDirNeighbours[j]&0x2) && bValid) 3400 #else 3194 3401 if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2)) 3402 #endif 3195 3403 { 3196 3404 abCandIsInter[uiArrayAddr] = true; … … 4515 4723 estimateDVFromDM(iTargetViewIdx, uiPartIdx, picDepth, uiPartAddr, &cColMv ); 4516 4724 4517 //Notes from MTK: Please uncomment the following parts while integrating VSP 4518 #if H_3D_VSP 4725 #if 0 // H_3D_VSP 4519 4726 Int refFrmIdx = 0; 4520 4727 RefPicList privateRefPicList = REF_PIC_LIST_0; … … 4635 4842 pDInfo->m_acDoNBDV = cDispVec; 4636 4843 4637 #if H_3D_VSP4844 #if 0 // H_3D_VSP 4638 4845 Int refFrmIdx = 0; 4639 4846 RefPicList privateRefPicList = REF_PIC_LIST_0 ; … … 4666 4873 pDInfo->m_acDoNBDV = defaultDV; 4667 4874 4668 #if H_3D_VSP4875 #if 0 // H_3D_VSP 4669 4876 Int refFrmIdx = 0; 4670 4877 RefPicList privateRefPicList = REF_PIC_LIST_0 ; … … 4684 4891 Int iPictureWidth = pcBaseViewDepthPicYuv->getWidth(); 4685 4892 Int iPictureHeight = pcBaseViewDepthPicYuv->getHeight(); 4686 4687 4893 4688 4894 Int depthStartPosX = Clip3(0, iPictureWidth - iBlkWidth, iBlkX + ((mv->getHor()+2)>>2)); … … 4749 4955 pNbDvInfo->m_aVIdxCan = refViewIdx; 4750 4956 #if H_3D_NBDV_REF 4751 TComPic* picDepth = NULL; 4957 TComPic* picDepth = NULL; 4752 4958 assert(getSlice()->getRefPic(eRefPicList, refId)->getPOC() == getSlice()->getPOC()); 4753 picDepth = getSlice()->getIvPic (true, refViewIdx ); 4959 picDepth = getSlice()->getIvPic (true, refViewIdx ); 4754 4960 assert(picDepth != NULL); 4755 4961 … … 4760 4966 estimateDVFromDM(refViewIdx, uiPartIdx, picDepth, uiPartAddr, &cMvPred ); 4761 4967 4762 4968 #if 0 // H_3D_VSP 4969 pNbDvInfo->m_aListIdx[ pNbDvInfo->iN ] = eRefPicList; 4970 pNbDvInfo->m_aRefIdx [ pNbDvInfo->iN ] = -1-refId; 4971 assert(pNbDvInfo->m_aRefIdx [ pNbDvInfo->iN ] < 0); 4972 #endif 4973 4763 4974 pNbDvInfo->m_acDoNBDV = cMvPred; 4764 4975 #endif … … 4769 4980 assert( uiMvpDvPos < IDV_CANDS ); 4770 4981 paIDVInfo->m_acMvCand[iList][ uiMvpDvPos ] = TComMv( cMvPred.getIDVHor(), cMvPred.getIDVVer() ); 4771 //Notes from QC: DvMCP is implemented in a way that doesn t carry the reference view identifier as NBDV. It only works for CTC and needs to be fixed to be aligned with other part of the NBDV design.4982 //Notes from QC: DvMCP is implemented in a way that doesn�t carry the reference view identifier as NBDV. It only works for CTC and needs to be fixed to be aligned with other part of the NBDV design. 4772 4983 paIDVInfo->m_aVIdxCan[iList][ uiMvpDvPos ] = 0; 4773 4984 paIDVInfo->m_bAvailab[iList][ uiMvpDvPos ] = true;
Note: See TracChangeset for help on using the changeset viewer.