Ignore:
Timestamp:
16 Apr 2013, 15:04:31 (11 years ago)
Author:
tech
Message:

Cleanup of getInterMergeCandidates.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-6.1-Cleanup/source/Lib/TLibCommon/TComDataCU.cpp

    r325 r326  
    36943694#endif
    36953695
    3696   if( iPdmDir[0] && !bNoPdmMerge && PDM_MERGE_POS == 0 )
     3696  if( iPdmDir[0] && !bNoPdmMerge )
    36973697  {
    36983698    abCandIsInter        [ iCount ] = true;
     
    37253725    }
    37263726    iCount ++;
    3727   }
    3728 
    3729   if(extraMergeCand)
    3730   {
    3731     if(!bNoPdmMerge && iPdmDir[1] && DMV_MERGE_POS == 1)
    3732     {
    3733       assert(iCount < MRG_MAX_NUM_CANDS_MEM);
    3734       abCandIsInter        [ iCount ] = true;
    3735       puhInterDirNeighbours[ iCount ] = iPdmDir[1];
    3736       if( ( iPdmDir[1] & 1 ) == 1 )
    3737       {
    3738         pcMvFieldNeighbours[ iCount<<1    ].setMvField( acPdmMv[ 2 ], aiPdmRefIdx[ 2 ] );
    3739       }
    3740       if( ( iPdmDir[1] & 2 ) == 2 )
    3741       {
    3742         pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 3 ], aiPdmRefIdx[ 3 ] );
    3743       }
    3744 #if H3D_NBDV
    3745       pcMvFieldNeighbours[iCount<<1    ].getMv().m_bDvMcp = false;
    3746       pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
    3747 #endif
    3748       if ( mrgCandIdx == iCount )
    3749           return;
    3750       iCount ++;
    3751     }   
    3752   }
     3727  } 
     3728 
    37533729#endif //  H3D_IVMP
    37543730
     
    38373813  }
    38383814
    3839 #if H3D_IVMP
    3840   if( iPdmDir[0]   && !bNoPdmMerge && PDM_MERGE_POS == 1 )
    3841   {
    3842     abCandIsInter        [ iCount ] = true;
    3843     puhInterDirNeighbours[ iCount ] = iPdmInterDir;
    3844     if( ( iPdmInterDir & 1 ) == 1 )
    3845     {
    3846       pcMvFieldNeighbours[ iCount<<1    ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] );
    3847     }
    3848 #if FIX_CU_BASED_MRG_CAND_LIST_B0136
    3849     else
    3850     {
    3851       pcMvFieldNeighbours[ iCount<<1 ].setMvField( TComMv(0,0), NOT_VALID );
    3852     }
    3853 #endif
    3854     if( ( iPdmInterDir & 2 ) == 2 )
    3855     {
    3856       pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] );
    3857     }
    3858 #if FIX_CU_BASED_MRG_CAND_LIST_B0136
    3859     else
    3860     {
    3861       pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( TComMv(0,0), NOT_VALID );
    3862     }
    3863 #endif
    3864     if ( mrgCandIdx == iCount )
    3865     {
    3866       return;
    3867     }
    3868     iCount ++;
    3869   }
    3870 #endif //  H3D_IVMP
    3871 
    3872 #if MERL_VSP_COMPENSATION_C0152
    3873   //===== vsp 1 =====
    3874   if( iCount < 4 + extraMergeCand )
    3875     if ( !xAddVspMergeCand(1, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
    3876       return;
    3877 #endif
    3878 
    38793815  // above
    38803816  UInt uiAbovePartIdx = 0;
     
    39493885  }
    39503886
    3951 #if H3D_IVMP
    3952   if( iPdmDir[0]   && !bNoPdmMerge && PDM_MERGE_POS == 2 )
    3953   {
    3954     abCandIsInter        [ iCount ] = true;
    3955     puhInterDirNeighbours[ iCount ] = iPdmInterDir;
    3956     if( ( iPdmInterDir & 1 ) == 1 )
    3957     {
    3958       pcMvFieldNeighbours[ iCount<<1    ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] );
    3959     }
    3960 #if FIX_CU_BASED_MRG_CAND_LIST_B0136
    3961     else
    3962     {
    3963       pcMvFieldNeighbours[ iCount<<1 ].setMvField( TComMv(0,0), NOT_VALID );
    3964     }
    3965 #endif
    3966     if( ( iPdmInterDir & 2 ) == 2 )
    3967     {
    3968       pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] );
    3969     }
    3970 #if FIX_CU_BASED_MRG_CAND_LIST_B0136
    3971     else
    3972     {
    3973       pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( TComMv(0,0), NOT_VALID );
    3974     }
    3975 #endif
    3976     if ( mrgCandIdx == iCount )
    3977     {
    3978       return;
    3979     }
    3980     iCount ++;
    3981   }
    3982 #endif //  H3D_IVMP
    3983 
    3984 #if MERL_VSP_COMPENSATION_C0152
    3985   //===== vsp 2 =====
    3986   if( iCount < 4 + extraMergeCand )
    3987     if ( !xAddVspMergeCand(2, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
    3988       return;
    3989 #endif
    3990 
    39913887  // above right
    39923888  UInt uiAboveRightPartIdx = 0;
     
    40363932
    40373933#if H3D_IVMP
    4038   if( iPdmDir[0]   && !bNoPdmMerge && PDM_MERGE_POS == 3 )
    4039   {
    4040     abCandIsInter        [ iCount ] = true;
    4041     puhInterDirNeighbours[ iCount ] = iPdmInterDir;
    4042     if( ( iPdmInterDir & 1 ) == 1 )
    4043     {
    4044       pcMvFieldNeighbours[ iCount<<1    ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] );
    4045     }
    4046 #if FIX_CU_BASED_MRG_CAND_LIST_B0136
    4047     else
    4048     {
    4049       pcMvFieldNeighbours[ iCount<<1 ].setMvField( TComMv(0,0), NOT_VALID );
    4050     }
    4051 #endif
    4052     if( ( iPdmInterDir & 2 ) == 2 )
    4053     {
    4054       pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] );
    4055     }
    4056 #if FIX_CU_BASED_MRG_CAND_LIST_B0136
    4057     else
    4058     {
    4059       pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( TComMv(0,0), NOT_VALID );
    4060     }
    4061 #endif
    4062     if ( mrgCandIdx == iCount )
    4063     {
    4064       return;
    4065     }
    4066     iCount ++;
    4067   }
    40683934
    40693935  if(extraMergeCand)
    40703936  {
    4071     if(!bNoPdmMerge && iPdmDir[1] && DMV_MERGE_POS == 4)
     3937    if(!bNoPdmMerge && iPdmDir[1] )
    40723938    {
    40733939      assert(iCount < MRG_MAX_NUM_CANDS_MEM);
     
    41143980#endif // H3D_IVMP
    41153981
    4116 #if MERL_VSP_COMPENSATION_C0152
    4117   //===== vsp 3 =====
    4118   if( iCount < 4 + extraMergeCand )
    4119     if ( !xAddVspMergeCand(3, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
    4120       return;
    4121 #endif
    4122 
    4123 #if MERL_VSP_C0152
    4124 #if VSP_MERGE_POS < 4
    4125 #if H3D_IVMP
    4126   if( iCount < 4 + extraMergeCand )
    4127 #else
    4128   if( iCount < 4 )
    4129 #endif
    4130   {
    4131 #endif
    4132 #endif
    41333982
    41343983  //left bottom
     
    41774026    iCount ++;
    41784027  }
    4179 #if MERL_VSP_C0152
    4180 #if VSP_MERGE_POS < 4
    4181   }
    4182 #endif
    4183 #endif
    4184  
    4185 #if H3D_IVMP
    4186   if( iPdmDir[0]   && !bNoPdmMerge && PDM_MERGE_POS == 4 )
    4187   {
    4188     abCandIsInter        [ iCount ] = true;
    4189     puhInterDirNeighbours[ iCount ] = iPdmInterDir;
    4190     if( ( iPdmInterDir & 1 ) == 1 )
    4191     {
    4192       pcMvFieldNeighbours[ iCount<<1    ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] );
    4193     }
    4194 #if FIX_CU_BASED_MRG_CAND_LIST_B0136
    4195     else
    4196     {
    4197       pcMvFieldNeighbours[ iCount<<1 ].setMvField( TComMv(0,0), NOT_VALID );
    4198     }
    4199 #endif
    4200     if( ( iPdmInterDir & 2 ) == 2 )
    4201     {
    4202       pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] );
    4203     }
    4204 #if FIX_CU_BASED_MRG_CAND_LIST_B0136
    4205     else
    4206     {
    4207       pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( TComMv(0,0), NOT_VALID );
    4208     }
    4209 #endif
    4210     if ( mrgCandIdx == iCount )
    4211     {
    4212       return;
    4213     }
    4214     iCount ++;
    4215   }
    4216 #endif //  H3D_IVMP
    4217 
    4218 #if MERL_VSP_COMPENSATION_C0152
    4219   //===== vsp 4 =====
    4220   if( iCount < 4 + extraMergeCand )
    4221     if ( !xAddVspMergeCand(4, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
    4222       return;
    4223 #endif
     4028 
    42244029 
    42254030  // above left
     
    51995004        }
    52005005        else if ( bSearchForMvpDv && cMvPred.m_bDvMcp && bTmpIsSkipped )
    5201   {
     5006        {
    52025007          paMvpDvInfo->m_acMvCand[iList][ uiMvpDvPos ] = cMvPred;
    52035008          paMvpDvInfo->m_aVIdxCan[iList][ uiMvpDvPos ] = refViewIdx;
     
    52125017        if (picDepth && bDepthRefine)
    52135018          estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
    5214        
     5019
    52155020        cMvPred.setVer(0);
    52165021
     
    52765081#endif
    52775082                                )
    5278             {
     5083{
    52795084  //// ******* Init variables ******* /////
    52805085  // Init disparity struct for results
     
    52915096      cMvpDvInfo.m_aVIdxCan[iList][iCurDvMcpCand] = 0;
    52925097      cMvpDvInfo.m_bAvailab[iList][iCurDvMcpCand] = false;
    5293           }
    5294         }
    5295  
     5098    }
     5099  }
     5100
    52965101  // Get Positions 
    52975102  PartSize eCUMode    = getPartitionSize( uiPartAddr );   
     
    53085113  //// ******* Get disparity from temporal neighboring blocks ******* /////
    53095114  if ( getSlice()->getPPS()->getEnableTMVPFlag() )
    5310         {
     5115  {
    53115116    TComMv cColMv;
    53125117    Int iTargetViewIdx = 0;
    53135118    Int iTStartViewIdx = 0;   
    5314    
     5119
    53155120    ///*** Derive center position ***
    53165121    UInt uiPartIdxCenter;
     
    53295134    const Int iNumCandPics = 2;
    53305135    for(Int curCandPic = 0; curCandPic < iNumCandPics; curCandPic++)
    5331             {
     5136    {
    53325137      // Get candidate picture
    53335138      RefPicList eCurRefPicList   = REF_PIC_LIST_0 ;
    53345139      Int        curCandPicRefIdx = 0;
    5335      
     5140
    53365141      if( curCandPic == 0 ) // check the co-located picture
    53375142      {
    53385143        eCurRefPicList   = RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0);
    53395144        curCandPicRefIdx = getSlice()->getColRefIdx();
    5340             }
     5145      }
    53415146      else                  // check RAP
    53425147      {
     
    53465151        eCurRefPicList   = getPic()->getRapRefList();
    53475152        curCandPicRefIdx = getPic()->getRapRefIdx();
    5348         }
    5349      
    5350        // Check BR and Center       
     5153      }
     5154
     5155      // Check BR and Center       
    53515156      if( m_pcSlice->getViewId() == getSlice()->getRefPic( eCurRefPicList, curCandPicRefIdx)->getViewId() )
     5157      {
     5158        for(Int curPosition = 0; curPosition < 2; curPosition++)
    53525159        {
    5353         for(Int curPosition = 0; curPosition < 2; curPosition++)
    5354           {
    53555160          Bool bCheck = false;
    53565161          if ( curPosition == 0 && iLCUIdxRBNb >= 0 )
     
    53615166
    53625167          if( bCheck )
    5363             {
     5168          {
    53645169            clipMv(cColMv);
    53655170            TComPic* picDepth = getSlice()->getRefPicBaseDepth();
    5366               if (picDepth && bDepthRefine)
    5367                 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
    5368 
    5369               pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
    5370               pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     5171            if (picDepth && bDepthRefine)
     5172              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
     5173
     5174            pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5175            pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
    53715176            return ;
    53725177          }
    53735178        } // Loop positions
    5374         }
     5179      }
    53755180    } // Loop candidate views
    53765181  } // if TMVP Flag
     
    53795184  Bool        bCheckMcpDv = false;   
    53805185  TComDataCU* pcTmpCU     = NULL;
    5381  
     5186
    53825187
    53835188  //// ******* Get disparity from left block ******* /////
     
    53985203  bCheckMcpDv = true;
    53995204  if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_LEFT ) )
    5400           return;
     5205    return;
    54015206
    54025207
     
    54175222
    54185223  if(pcTmpCU != NULL )
    5419       {
     5224  {
    54205225    bCheckMcpDv = ( ( getAddr() - pcTmpCU->getAddr() ) == 0);
    54215226    if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_ABOVE ) )
    5422         return;
    5423       }
    5424 
    5425 //// ******* Get disparity from above right block ******* /////
     5227      return;
     5228  }
     5229
     5230  //// ******* Get disparity from above right block ******* /////
    54265231  pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, false, true);
    54275232
     
    54355240
    54365241  if(pcTmpCU != NULL )
    5437     {
     5242  {
    54385243    bCheckMcpDv = ( ( getAddr() - pcTmpCU->getAddr() ) == 0);
    54395244    if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_ABOVERIGHT ) )
    5440           return;
    5441         }
    5442 
    5443 
    5444 //// ******* Get disparity from below left block ******* /////
     5245      return;
     5246  }
     5247
     5248
     5249  //// ******* Get disparity from below left block ******* /////
    54455250  pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true, false);
    54465251
     
    54545259
    54555260  if( pcTmpCU != NULL )
    5456       {
     5261  {
    54575262    bCheckMcpDv = true;
    54585263    if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_LEFTBELOW ) )
    5459           return;
    5460         }
    5461 
    5462 
    5463 //// ******* Get disparity from above left block ******* /////
    5464  
     5264      return;
     5265  }
     5266
     5267
     5268  //// ******* Get disparity from above left block ******* /////
    54655269  pcTmpCU = getPUAboveLeft(uiIdx, (m_uiAbsIdxInLCU + uiPartAddr), true, false, true);
    54665270  assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr));
     
    54785282    bCheckMcpDv = (( getAddr() - pcTmpCU->getAddr() ) <= 1);
    54795283    if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_ABOVELEFT ) )
    5480           return;
    5481         }
     5284      return;
     5285  }
    54825286
    54835287  //// ******* Search MCP blocks ******* /////
    54845288  if( cMvpDvInfo.m_bFound )
    5485       {
     5289  {
    54865290    for( Int curPos = 1 ; curPos < MCP_DIS_CANS - 1 ; curPos++ )
     5291    {
     5292      for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     5293      {
     5294        if( cMvpDvInfo.m_bAvailab[iList][curPos] )
    54875295        {
    5488       for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
    5489           {
    5490         if( cMvpDvInfo.m_bAvailab[iList][curPos] )
    5491             {
    54925296          TComMv cDispVec = cMvpDvInfo.m_acMvCand[iList][ curPos ];
    54935297          clipMv( cDispVec );
    54945298
    54955299          TComPic* picDepth = getSlice()->getRefPicBaseDepth();
    5496               if (picDepth && bDepthRefine)
     5300          if (picDepth && bDepthRefine)
    54975301            estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cDispVec, true);
    54985302
    54995303          pDInfo->m_acMvCand[ pDInfo->iN]   = cDispVec;
    5500             pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0;
     5304          pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0;
    55015305          return;
    55025306        }
Note: See TracChangeset for help on using the changeset viewer.