Changeset 322 in 3DVCSoftware


Ignore:
Timestamp:
14 Apr 2013, 18:28:30 (12 years ago)
Author:
tech
Message:

Merged cleanup of NBDV and getMCPFromDM.

Location:
branches/HTM-6.1-Cleanup/source/Lib/TLibCommon
Files:
8 edited

Legend:

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

    r313 r322  
    51645164
    51655165#if MERL_VSP_C0152
    5166 #if LGE_SIMP_DVP_REFINE_C0112
    5167 Pel TComDataCU::getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT, Int iShiftPrec, Bool bSimpleDvpRefine)
    5168 #else
    5169 Pel TComDataCU::getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT, Int iShiftPrec)
    5170 #endif
     5166Pel TComDataCU::getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iBlkWidth, Int iBlkHeight, Int* aiShiftLUT, Int iShiftPrec, Bool bSimpleDvpRefine)
    51715167{
    51725168  Int depStride =  pcBaseViewDepthPicYuv->getStride();
    51735169
    5174   Int width  = pcBaseViewDepthPicYuv->getWidth();
    5175   Int height = pcBaseViewDepthPicYuv->getHeight();
    5176 #if MTK_DVPREFINE_BVSP_BUG_FIX
    5177   Int depthPosX = Clip3(0,   width - iWidth,  iBlkX + (mv->getHor()>>2));
    5178   Int depthPosY = Clip3(0,   height - iHeight,  iBlkY + (mv->getVer()>>2));
    5179 #else
    5180   Int depthPosX = Clip3(0,   width - iWidth  - 1,  iBlkX + (mv->getHor()>>2));
    5181   Int depthPosY = Clip3(0,   height- iHeight - 1,  iBlkY + (mv->getVer()>>2));
    5182 #endif
    5183   Pel *depth  = pcBaseViewDepthPicYuv->getLumaAddr() + depthPosX + depthPosY * depStride;
    5184   Pel  maxDepth = 0;
    5185 #if LGE_SIMP_DVP_REFINE_C0112
     5170  Int iPictureWidth  = pcBaseViewDepthPicYuv->getWidth();
     5171  Int iPictureHeight = pcBaseViewDepthPicYuv->getHeight();
     5172
     5173  Int depthPosX = Clip3(0,   iPictureWidth - iBlkWidth,  iBlkX + (mv->getHor()>>2));
     5174  Int depthPosY = Clip3(0,   iPictureHeight- iBlkHeight,  iBlkY + (mv->getVer()>>2));
     5175
     5176  Pel *pDepthPel   = pcBaseViewDepthPicYuv->getLumaAddr() + depthPosX + depthPosY * depStride;
     5177  Pel  maxDepthVal = 0;
     5178
    51865179  if ( bSimpleDvpRefine )
    51875180  {
    5188 #if MTK_DVPREFINE_BVSP_BUG_FIX
    5189     Int depthStartPosX = Clip3(0,   width - iWidth,  iBlkX + (mv->getHor()>>2));
    5190     Int depthStartPosY = Clip3(0,   height - iHeight,  iBlkY + (mv->getVer()>>2));
    5191     Int depthEndPosX = Clip3(0,   width - 1,  iBlkX + iWidth - 1  + (mv->getHor()>>2));
    5192     Int depthEndPosY = Clip3(0,   height - 1,  iBlkY + iHeight - 1 + (mv->getVer()>>2));
    5193 #else
    5194     Int depthStartPosX = Clip3(0,   width - iWidth  - 1,  iBlkX + (mv->getHor()>>2));
    5195     Int depthStartPosY = Clip3(0,   height- iHeight - 1,  iBlkY + (mv->getVer()>>2));
    5196     Int depthEndPosX = Clip3(0,   width - iWidth  - 1,  iBlkX + iWidth  + (mv->getHor()>>2));
    5197     Int depthEndPosY = Clip3(0,   height- iHeight - 1,  iBlkY + iHeight + (mv->getVer()>>2));
    5198 #endif
     5181    Int depthStartPosX = Clip3(0,   iPictureWidth - iBlkWidth,  iBlkX + (mv->getHor()>>2));
     5182    Int depthStartPosY = Clip3(0,   iPictureHeight- iBlkHeight,  iBlkY + (mv->getVer()>>2));
     5183    Int depthEndPosX   = Clip3(0,   iPictureWidth - 1,  iBlkX + iBlkWidth - 1 + (mv->getHor()>>2));
     5184    Int depthEndPosY   = Clip3(0,   iPictureHeight - 1,  iBlkY + iBlkHeight - 1 + (mv->getVer()>>2));
    51995185    Int iCenterX = (depthStartPosX + depthEndPosX) >> 1;
    52005186    Int iCenterY = (depthStartPosY + depthEndPosY) >> 1;
     
    52095195    for (Int i = 0; i < 5; i++)
    52105196    {
    5211       if (maxDepth < aiDepth[i])
    5212         maxDepth = aiDepth[i];
     5197      if (maxDepthVal < aiDepth[i])
     5198        maxDepthVal = aiDepth[i];
    52135199    }
    52145200  }
    52155201  else
    52165202  {
    5217     for (Int j = 0; j < iHeight; j++)
    5218     {
    5219       for (Int i = 0; i < iWidth; i++)
    5220       {
    5221         if (maxDepth < depth[i])
    5222           maxDepth = depth[i];
    5223       }
    5224       depth += depStride;
    5225     }
    5226   }
    5227 #else
    5228   for (Int j = 0; j < iHeight; j++)
    5229   {
    5230     for (Int i = 0; i < iWidth; i++)
    5231     {
    5232       if (maxDepth < depth[i])
    5233         maxDepth = depth[i];
    5234     }
    5235     depth += depStride;
    5236   }
    5237 #endif
    5238   Int disparity = aiShiftLUT[ maxDepth ] << iShiftPrec;
    5239 
    5240   return disparity;
    5241 }
    5242 #if LGE_SIMP_DVP_REFINE_C0112
     5203    for (Int j = 0; j < iBlkHeight; j++)
     5204    {
     5205      for (Int i = 0; i < iBlkWidth; i++)
     5206      {
     5207        if (maxDepthVal < pDepthPel[i])
     5208          maxDepthVal = pDepthPel[i];
     5209  }
     5210      pDepthPel += depStride;
     5211    }
     5212  }
     5213
     5214  Int iDisp = aiShiftLUT[ maxDepthVal ] << iShiftPrec;
     5215
     5216  return iDisp;
     5217}
    52435218Void TComDataCU::estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred, Bool bSimpleDvpRefine)
    5244 #else
    5245 Void TComDataCU::estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred)
    5246 #endif
    52475219{
    52485220  if (picDepth)
     
    52575229    Int* aiShiftLUT;
    52585230    Int  iShiftPrec;
     5231
    52595232    getSlice()->getBWVSPLUTParam(aiShiftLUT, iShiftPrec);
    5260 #if LGE_SIMP_DVP_REFINE_C0112
    5261     Pel x = getMcpFromDM( pcBaseViewDepthPicYuv, cMvPred, iBlkX, iBlkY, iWidth, iHeight, aiShiftLUT, iShiftPrec, bSimpleDvpRefine );
    5262 #else
    5263     Pel x = getMcpFromDM( pcBaseViewDepthPicYuv, cMvPred, iBlkX, iBlkY, iWidth, iHeight, aiShiftLUT, iShiftPrec);
    5264 #endif
    5265     cMvPred->setHor(x);
     5233
     5234    Pel iDisp = getMcpFromDM( pcBaseViewDepthPicYuv, cMvPred, iBlkX, iBlkY, iWidth, iHeight, aiShiftLUT, iShiftPrec, bSimpleDvpRefine );
     5235    cMvPred->setHor( iDisp );
    52665236    clipMv(*cMvPred);
    52675237  }
     
    52705240
    52715241#if H3D_NBDV
    5272 Void TComDataCU::getDisMvpCandNBDV( UInt uiPartIdx, UInt uiPartAddr,DisInfo* pDInfo , Bool bParMerge
     5242
     5243Bool TComDataCU::xCheckSpatialNBDV( TComDataCU* pcTmpCU, UInt uiIdx, UInt uiPartIdx, UInt uiPartAddr, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, McpDisInfo* paMvpDvInfo, UInt uiMvpDvPos )
     5244{
     5245  Bool bDepthRefine = true;
     5246
     5247  if( pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
     5248  {
     5249    Bool bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
     5250    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     5251    {
     5252      RefPicList eRefPicList = RefPicList(iList);
     5253      Int      refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
     5254      TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     5255
     5256      if( refId >= 0)
     5257      {
     5258        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId );
     5259        if (refViewIdx != m_pcSlice->getViewId()) // DCP
     5260        {         
     5261          clipMv(cMvPred);
     5262
     5263          TComPic* picDepth = getSlice()->getRefPicBaseDepth();
     5264
     5265          if (picDepth && bDepthRefine)
     5266            estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true);
     5267
     5268          pNbDvInfo->m_acMvCand[ pNbDvInfo->iN   ] = cMvPred;
     5269          pNbDvInfo->m_aVIdxCan[ pNbDvInfo->iN++ ] = refViewIdx;
     5270
     5271          return true;
     5272        }
     5273        else if ( bSearchForMvpDv && cMvPred.m_bDvMcp && bTmpIsSkipped )
     5274  {
     5275          paMvpDvInfo->m_acMvCand[iList][ uiMvpDvPos ] = cMvPred;
     5276          paMvpDvInfo->m_aVIdxCan[iList][ uiMvpDvPos ] = refViewIdx;
     5277          paMvpDvInfo->m_bAvailab[iList][ uiMvpDvPos ] = true;
     5278          paMvpDvInfo->m_bFound                        = true;
     5279        }
     5280      }
     5281#if MERL_VSP_C0152
     5282      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
     5283      {
     5284        TComPic* picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
     5285        if (picDepth && bDepthRefine)
     5286          estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
     5287       
     5288        cMvPred.setVer(0);
     5289
     5290        pNbDvInfo->m_acMvCand[ pNbDvInfo->iN]   = cMvPred;
     5291        pNbDvInfo->m_aVIdxCan[ pNbDvInfo->iN++] = 0; // refViewIdx;
     5292        return true;
     5293      }
     5294#endif
     5295    }
     5296  }
     5297  return false;
     5298}
     5299
     5300
     5301Void TComDataCU::xDeriveRightBottomNbIdx( PartSize eCUMode, UInt uiPartIdx, Int &riLCUIdxRBNb, Int &riPartIdxRBNb )
     5302{
     5303  UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); 
     5304    Int uiLCUIdx = getAddr();
     5305 
     5306  UInt uiPartIdxRB;
     5307    deriveRightBottomIdx( eCUMode, uiPartIdx, uiPartIdxRB ); 
     5308    UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];
     5309
     5310    if (( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() )>= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )
     5311    {
     5312    riLCUIdxRBNb  = -1;
     5313    riPartIdxRBNb = -1;
     5314    }
     5315    else if(( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() )>= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
     5316    {
     5317    riLCUIdxRBNb  = -1;
     5318    riPartIdxRBNb = -1;
     5319    }
     5320    else
     5321    {
     5322      if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) &&           // is not at the last column of LCU
     5323      ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row    of LCU
     5324      {
     5325      riPartIdxRBNb = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ];
     5326      }
     5327      else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 )           // is not at the last column of LCU But is last row of LCU
     5328      {
     5329      riPartIdxRBNb = -1;
     5330      riLCUIdxRBNb  = -1;
     5331      }
     5332      else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
     5333      {
     5334      riPartIdxRBNb = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ];
     5335      riLCUIdxRBNb = uiLCUIdx + 1;
     5336      }
     5337      else //is the right bottom corner of LCU                       
     5338      {
     5339      riPartIdxRBNb = -1;
     5340      riLCUIdxRBNb  = -1;
     5341      }
     5342    }
     5343      }
     5344
     5345
     5346Void TComDataCU::getDisMvpCandNBDV( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo , Bool bParMerge
    52735347#if MERL_VSP_C0152
    52745348                                , Bool bDepthRefine
    52755349#endif
    52765350                                )
    5277 {
    5278   PartSize eCUMode = getPartitionSize( uiPartAddr );
    5279   TComDataCU* pcTmpCU = NULL;
    5280   pDInfo->iN = 0;
    5281 
    5282   RefPicList eRefPicList = REF_PIC_LIST_0 ;
    5283   //-- Get Spatial MV
    5284   UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB;
    5285   UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();
    5286 
    5287   const Int iNumofDvMCP = 7;
    5288 #if MTK_RELEASE_DV_CONSTRAINT_C0129
    5289   Int   aiDvMcpDvCandX[2][iNumofDvMCP] = {{0,},    {0,}}; // dummy, 5 spatial + 1 temporal
    5290   Int   aiDvMcpDvCandY[2][iNumofDvMCP] = {{0,},    {0,}}; // dummy, 5 spatial + 1 temporal
    5291 #else
    5292   Int   aiDvMcpDvCand[2][iNumofDvMCP] = {{0,},    {0,}}; // dummy, 5 spatial + 1 temporal
    5293 #endif
    5294   Bool  abDvMcpFlag  [2][iNumofDvMCP] = {{false,},{false,}};
    5295   TComMv cTmpMvPred, cMv;
    5296   Bool  bTmpIsSkipped = false;
    5297   Bool  bDvMcpIsFound = false;
    5298   Int   iLCUAddrDiff = 0;
    5299 
     5351            {
     5352  //// ******* Init variables ******* /////
     5353  // Init disparity struct for results
     5354  pDInfo->iN = 0; 
     5355
     5356  // Init struct for disparities from MCP neighboring blocks
     5357  McpDisInfo cMvpDvInfo;
     5358  cMvpDvInfo.m_bFound = false;
     5359  for (UInt iCurDvMcpCand = 0; iCurDvMcpCand < MCP_DIS_CANS; iCurDvMcpCand++)
     5360  {
     5361    for (UInt iList = 0; iList < 2; iList++)
     5362    {
     5363      cMvpDvInfo.m_acMvCand[iList][iCurDvMcpCand].setZero();
     5364      cMvpDvInfo.m_aVIdxCan[iList][iCurDvMcpCand] = 0;
     5365      cMvpDvInfo.m_bAvailab[iList][iCurDvMcpCand] = false;
     5366          }
     5367        }
     5368 
     5369  // Get Positions 
     5370  PartSize eCUMode    = getPartitionSize( uiPartAddr );   
     5371  UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB; 
     5372
     5373  deriveLeftRightTopIdxGeneral( eCUMode, uiPartAddr, uiPartIdx, uiPartIdxLT, uiPartIdxRT );
     5374  deriveLeftBottomIdxGeneral  ( eCUMode, uiPartAddr, uiPartIdx, uiPartIdxLB );
     5375
     5376  // Get parameters for parallel merge
    53005377  Int xP, yP, nPSW, nPSH;
    53015378  if( bParMerge)
    53025379    this->getPartPosition(uiPartIdx, xP, yP, nPSW, nPSH);
    53035380
    5304   deriveLeftRightTopIdxGeneral( eCUMode, uiPartAddr, uiPartIdx, uiPartIdxLT, uiPartIdxRT );
    5305   deriveLeftBottomIdxGeneral( eCUMode, uiPartAddr, uiPartIdx, uiPartIdxLB );
    5306 
    5307 #if MTK_SAIT_TEMPORAL_FIRST_ORDER_C0141_C0097
    5308   // copied from getInterMergeCand()
     5381  //// ******* Get disparity from temporal neighboring blocks ******* /////
    53095382  if ( getSlice()->getPPS()->getEnableTMVPFlag() )
    5310   {
     5383        {
    53115384    TComMv cColMv;
    53125385    Int iTargetViewIdx = 0;
    5313     Int iTStartViewIdx = 0;
    5314     UInt uiPartIdxRB, uiBRIdx;
    5315 #if !MTK_SIMPLIFY_DVTC_C0135
    5316     Int uiViewIdxCurr= getSlice()->getViewId();
    5317 #endif
     5386    Int iTStartViewIdx = 0;   
     5387   
     5388    ///*** Derive center position ***
    53185389    UInt uiPartIdxCenter;
     5390    Int  uiLCUIdx   = getAddr();
     5391
    53195392    xDeriveCenterIdx( eCUMode, uiPartIdx, uiPartIdxCenter );
    53205393
    5321     Int uiLCUIdx = getAddr();
    5322     Int uiLCUnew = uiLCUIdx;
    5323     eCUMode = getPartitionSize( 0 );
    5324     deriveRightBottomIdx( eCUMode, uiPartIdx, uiPartIdxRB ); 
    5325     uiBRIdx = uiPartIdxLT;
    5326     UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];
    5327 #if MTK_SIMPLIFY_DVTC_C0135
    5328     if (( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() )>= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )
    5329     {
    5330       uiLCUnew = -1;
    5331     }
    5332     else if(( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() )>= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
    5333     {
    5334       uiLCUnew = -1;
    5335     }
    5336     else
    5337 #else
    5338     if ( (( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) < m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) &&(( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getSPS()->getPicHeightInLumaSamples() ))  // image boundary check
    5339 #endif
    5340     {
    5341       if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) &&           // is not at the last column of LCU
    5342       ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row    of LCU
    5343       {
    5344         uiBRIdx = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ];
    5345       }
    5346       else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 )           // is not at the last column of LCU But is last row of LCU
    5347       {
    5348         uiBRIdx = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ];
    5349 #if MTK_SIMPLIFY_DVTC_C0135
    5350         uiLCUnew = -1;
    5351 #else
    5352         uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU();
    5353 #endif
    5354       }
    5355       else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
    5356       {
    5357         uiBRIdx = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ];
    5358         uiLCUnew = uiLCUIdx + 1;
    5359       }
    5360       else //is the right bottom corner of LCU                       
    5361       {
    5362         uiBRIdx = 0;
    5363 #if MTK_SIMPLIFY_DVTC_C0135
    5364         uiLCUnew = -1;
    5365 #else
    5366         uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU() + 1;
    5367 #endif
    5368       }
    5369     }
    5370     const Int iNumofCandPic = 2;
    5371     for(Int i =0; i < iNumofCandPic; i++)
    5372     {
    5373       Int lpRef=0;
    5374       if(i == 0)
    5375       {   //check the col-located picture
    5376         eRefPicList = RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0);
    5377 #if COLLOCATED_REF_IDX
    5378         lpRef = getSlice()->getColRefIdx();
    5379 #else
    5380         Int lpRef = 0;
    5381 #endif
    5382       }
    5383       else
    5384       {
    5385         if(!(getPic()->getRapbCheck()))
     5394    ///*** Derive bottom right neighbour position ***
     5395    eCUMode          = getPartitionSize( 0 ); // Necessary?   
     5396    Int iLCUIdxRBNb  = -1;   
     5397    Int iPartIdxRBNb = -1;
     5398
     5399    xDeriveRightBottomNbIdx( eCUMode, uiPartIdx, iLCUIdxRBNb, iPartIdxRBNb );
     5400
     5401    ///*** Search temporal candidate pictures for disparity vector ***
     5402    const Int iNumCandPics = 2;
     5403    for(Int curCandPic = 0; curCandPic < iNumCandPics; curCandPic++)
     5404            {
     5405      // Get candidate picture
     5406      RefPicList eCurRefPicList   = REF_PIC_LIST_0 ;
     5407      Int        curCandPicRefIdx = 0;
     5408     
     5409      if( curCandPic == 0 ) // check the co-located picture
     5410      {
     5411        eCurRefPicList   = RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0);
     5412        curCandPicRefIdx = getSlice()->getColRefIdx();
     5413            }
     5414      else                  // check RAP
     5415      {
     5416        if( !(getPic()->getRapbCheck()) )
    53865417          break;
    5387         eRefPicList=getPic()->getRapRefList();
    5388         lpRef=getPic()->getRapRefIdx();
    5389       }
    5390 
    5391       if( m_pcSlice->getViewId() == getSlice()->getRefPic( eRefPicList, lpRef)->getViewId() )
    5392       {
    5393 #if !MTK_SIMPLIFY_DVTC_C0135
    5394         if (uiViewIdxCurr > 1) 
     5418
     5419        eCurRefPicList   = getPic()->getRapRefList();
     5420        curCandPicRefIdx = getPic()->getRapRefIdx();
     5421        }
     5422     
     5423       // Check BR and Center       
     5424      if( m_pcSlice->getViewId() == getSlice()->getRefPic( eCurRefPicList, curCandPicRefIdx)->getViewId() )
    53955425        {
    5396 #endif
    5397           if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) )
     5426        for(Int curPosition = 0; curPosition < 2; curPosition++)
    53985427          {
     5428          Bool bCheck = false;
     5429          if ( curPosition == 0 && iLCUIdxRBNb >= 0 )
     5430            bCheck = xGetColDisMV( eCurRefPicList, curCandPicRefIdx, iLCUIdxRBNb, iPartIdxRBNb,  cColMv, iTargetViewIdx, iTStartViewIdx);
     5431
     5432          if (curPosition == 1 )
     5433            bCheck = xGetColDisMV( eCurRefPicList, curCandPicRefIdx, uiLCUIdx,   uiPartIdxCenter,  cColMv, iTargetViewIdx, iTStartViewIdx );
     5434
     5435          if( bCheck )
     5436            {
    53995437            clipMv(cColMv);
    5400 #if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
    5401             pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
    5402             pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
    5403 #else
    5404             {
    5405               TComPic* picDepth = NULL;
    5406               picDepth = getSlice()->getRefPicBaseDepth();
     5438            TComPic* picDepth = getSlice()->getRefPicBaseDepth();
    54075439              if (picDepth && bDepthRefine)
    5408 #if LGE_SIMP_DVP_REFINE_C0112
    54095440                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
    5410 #else
    5411                 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
    5412 #endif
    54135441
    54145442              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
    54155443              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
    5416             }
    5417 #endif
    54185444            return ;
    54195445          }
    5420 #if !MTK_SIMPLIFY_DVTC_C0135
     5446        } // Loop positions
    54215447        }
    5422 #endif
    5423         if(xGetColDisMV( eRefPicList, lpRef, uiLCUIdx, uiPartIdxCenter,  cColMv, iTargetViewIdx, iTStartViewIdx ))
    5424         {
    5425           clipMv(cColMv);
    5426 #if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
    5427             pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
    5428             pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
    5429 #else
    5430             {
    5431               TComPic* picDepth = NULL;
    5432               picDepth = getSlice()->getRefPicBaseDepth();
    5433               if (picDepth && bDepthRefine)
    5434 #if LGE_SIMP_DVP_REFINE_C0112
    5435                 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
    5436 #else
    5437                 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
    5438 #endif
    5439               pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
    5440               pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
    5441             }
    5442 #endif
    5443           return ;
    5444         }
    5445 #if !MTK_SIMPLIFY_DVTC_C0135
    5446         if(uiViewIdxCurr == 1) 
    5447         {
    5448           if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) )
    5449           {
    5450             clipMv(cColMv);
    5451 #if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
    5452             pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
    5453             pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
    5454 #else
    5455             {
    5456               TComPic* picDepth = NULL;
    5457               picDepth = getSlice()->getRefPicBaseDepth();
    5458               if (picDepth && bDepthRefine)
    5459 #if LGE_SIMP_DVP_REFINE_C0112
    5460                 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
    5461 #else
    5462                 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
    5463 #endif
    5464               pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
    5465               pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
    5466             }
    5467 #endif
    5468             return ;
    5469           }
    5470         }
    5471 #endif
    5472       }
    5473     }
     5448    } // Loop candidate views
    54745449  } // if TMVP Flag
    5475 #endif
     5450
    54765451  UInt uiIdx = 0;
     5452  Bool        bCheckMcpDv = false;   
     5453  TComDataCU* pcTmpCU     = NULL;
     5454 
     5455
     5456  //// ******* Get disparity from left block ******* /////
    54775457  pcTmpCU = getPULeft(uiIdx, uiPartIdxLB, true, false);
    54785458  if ( uiPartIdx == 1 && (eCUMode == SIZE_Nx2N || eCUMode == SIZE_nLx2N || eCUMode == SIZE_nRx2N) )
     
    54895469  }
    54905470
    5491   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
    5492   {
    5493     bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
    5494     for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
    5495     {
    5496       eRefPicList = RefPicList(iList);
    5497       Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
    5498       if( refId >= 0)
    5499       {
    5500         Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
    5501         if (refViewIdx != m_pcSlice->getViewId()) // DCP
    5502         {
    5503           TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5504           clipMv(cMvPred);
    5505 #if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
    5506           pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    5507           pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    5508 #else
    5509           {
    5510             TComPic* picDepth = NULL;
    5511             picDepth = getSlice()->getRefPicBaseDepth();
    5512             if (picDepth && bDepthRefine)
    5513 #if LGE_SIMP_DVP_REFINE_C0112
    5514               estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true);
    5515 #else
    5516               estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
    5517 #endif
    5518             pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    5519             pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    5520           }
    5521 #endif
     5471  bCheckMcpDv = true;
     5472  if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_LEFT ) )
     5473          return;
     5474
     5475
     5476  //// ******* Get disparity from above block ******* /////
     5477  pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT, true, false, true);
     5478  if ( uiPartIdx == 1 && (eCUMode == SIZE_2NxN || eCUMode == SIZE_2NxnU || eCUMode == SIZE_2NxnD) )
     5479  {
     5480    pcTmpCU = NULL;
     5481  }
     5482
     5483  if (pcTmpCU && bParMerge)
     5484  {
     5485    if (!pcTmpCU->isDiffMER(xP+nPSW-1, yP-1, xP, yP))
     5486    {
     5487      pcTmpCU = NULL;
     5488    }
     5489  }
     5490
     5491  if(pcTmpCU != NULL )
     5492      {
     5493    bCheckMcpDv = ( ( getAddr() - pcTmpCU->getAddr() ) == 0);
     5494    if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_ABOVE ) )
     5495        return;
     5496      }
     5497
     5498//// ******* Get disparity from above right block ******* /////
     5499  pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, false, true);
     5500
     5501  if (pcTmpCU && bParMerge)
     5502  {
     5503    if (!pcTmpCU->isDiffMER(xP+nPSW, yP-1, xP, yP))
     5504    {
     5505      pcTmpCU = NULL;
     5506    }
     5507  }
     5508
     5509  if(pcTmpCU != NULL )
     5510    {
     5511    bCheckMcpDv = ( ( getAddr() - pcTmpCU->getAddr() ) == 0);
     5512    if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_ABOVERIGHT ) )
    55225513          return;
    55235514        }
    5524         else // MCP
    5525         {
    5526           cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5527           if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
    5528           {
    5529 #if MTK_RELEASE_DV_CONSTRAINT_C0129
    5530             aiDvMcpDvCandX[iList][DVFROM_LEFT] = cTmpMvPred.m_iDvMcpDispX;
    5531             aiDvMcpDvCandY[iList][DVFROM_LEFT] = cTmpMvPred.m_iDvMcpDispY;
    5532 #else
    5533             aiDvMcpDvCand[iList][DVFROM_LEFT] = cTmpMvPred.m_iDvMcpDispX;
    5534 #endif
    5535             abDvMcpFlag  [iList][DVFROM_LEFT] = true;
    5536             bDvMcpIsFound = true;
    5537           }
    5538         }
    5539       }
    5540 #if MERL_VSP_C0152
    5541       else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
    5542       {
    5543         TComPic* picDepth = NULL;
    5544         TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
    5545         picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
    5546         if (picDepth && bDepthRefine)
    5547           estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
    5548         myMv.setVer(0);
    5549 
    5550         pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
    5551         pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
    5552         return;
    5553       }
    5554 #endif
    5555     }
    5556   }
    5557 
    5558   pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT, true, false, true);
    5559   if ( uiPartIdx == 1 && (eCUMode == SIZE_2NxN || eCUMode == SIZE_2NxnU || eCUMode == SIZE_2NxnD) )
    5560   {
    5561     pcTmpCU = NULL;
    5562   }
    5563 
    5564   if (pcTmpCU && bParMerge)
    5565   {
    5566     if (!pcTmpCU->isDiffMER(xP+nPSW-1, yP-1, xP, yP))
     5515
     5516
     5517//// ******* Get disparity from below left block ******* /////
     5518  pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true, false);
     5519
     5520  if (pcTmpCU && bParMerge)
     5521  {
     5522    if (!pcTmpCU->isDiffMER(xP-1, yP+nPSH, xP, yP))
    55675523    {
    55685524      pcTmpCU = NULL;
     
    55705526  }
    55715527
    5572   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
    5573   {
    5574     iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
    5575     bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
    5576     for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
    5577     {
    5578       eRefPicList = RefPicList(iList);
    5579       Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
    5580       if( refId >= 0)
    5581       {
    5582         Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
    5583         if (refViewIdx!= m_pcSlice->getViewId())
    5584         {
    5585           TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5586           clipMv(cMvPred);
    5587 #if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
    5588           pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    5589           pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    5590 #else
    5591           {
    5592             TComPic* picDepth = NULL;
    5593             picDepth = getSlice()->getRefPicBaseDepth();
    5594             if (picDepth && bDepthRefine)
    5595 #if LGE_SIMP_DVP_REFINE_C0112
    5596               estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true);
    5597 #else
    5598               estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
    5599 #endif
    5600             pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    5601             pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    5602           }
    5603 #endif
     5528  if( pcTmpCU != NULL )
     5529      {
     5530    bCheckMcpDv = true;
     5531    if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_LEFTBELOW ) )
    56045532          return;
    56055533        }
    5606         else if(iLCUAddrDiff == 0) //MCP, within same LCU
    5607         {
    5608           cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5609           if( cTmpMvPred.m_bDvMcp  && bTmpIsSkipped )
    5610           {
    5611 #if MTK_RELEASE_DV_CONSTRAINT_C0129
    5612             aiDvMcpDvCandX[iList][DVFROM_ABOVE] = cTmpMvPred.m_iDvMcpDispX;
    5613             aiDvMcpDvCandY[iList][DVFROM_ABOVE] = cTmpMvPred.m_iDvMcpDispY;
    5614 #else
    5615             aiDvMcpDvCand[iList][DVFROM_ABOVE] = cTmpMvPred.m_iDvMcpDispX;
    5616 #endif
    5617             abDvMcpFlag  [iList][DVFROM_ABOVE] = true;
    5618             bDvMcpIsFound = true;
    5619           }
    5620         }
    5621       }
    5622 #if MERL_VSP_C0152
    5623       else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
    5624       {
    5625         TComPic* picDepth = NULL;
    5626         TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
    5627         picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
    5628         if (picDepth && bDepthRefine)
    5629           estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
    5630         myMv.setVer(0);
    5631 
    5632         pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
    5633         pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
    5634         return;
    5635       }
    5636 #endif
    5637     }
    5638   }
    5639 
    5640   pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, false, true);
     5534
     5535
     5536//// ******* Get disparity from above left block ******* /////
     5537 
     5538  pcTmpCU = getPUAboveLeft(uiIdx, (m_uiAbsIdxInLCU + uiPartAddr), true, false, true);
     5539  assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr));
    56415540
    56425541  if (pcTmpCU && bParMerge)
    56435542  {
    5644     if (!pcTmpCU->isDiffMER(xP+nPSW, yP-1, xP, yP))
     5543    if (!pcTmpCU->isDiffMER(xP-1, yP-1, xP, yP))
    56455544    {
    56465545      pcTmpCU = NULL;
     
    56485547  }
    56495548
    5650   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
    5651   {
    5652     iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
    5653     bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
    5654     for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
    5655     {
    5656       eRefPicList = RefPicList(iList);
    5657       Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
    5658       if( refId >= 0)
    5659       {
    5660         Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
    5661         if (refViewIdx!= m_pcSlice->getViewId())
    5662         {
    5663           TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5664           clipMv(cMvPred);
    5665 #if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
    5666           pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    5667           pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    5668 #else
    5669           {
    5670             TComPic* picDepth = NULL;
    5671             picDepth = getSlice()->getRefPicBaseDepth();
    5672             if (picDepth && bDepthRefine)
    5673 #if LGE_SIMP_DVP_REFINE_C0112
    5674               estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true);
    5675 #else
    5676               estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
    5677 #endif
    5678             pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    5679             pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    5680           }
    5681 #endif
     5549  if( pcTmpCU != NULL )
     5550  {
     5551    bCheckMcpDv = (( getAddr() - pcTmpCU->getAddr() ) <= 1);
     5552    if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_ABOVELEFT ) )
    56825553          return;
    56835554        }
    5684         else if(iLCUAddrDiff == 0)
     5555
     5556  //// ******* Search MCP blocks ******* /////
     5557  if( cMvpDvInfo.m_bFound )
     5558      {
     5559    for( Int curPos = 1 ; curPos < MCP_DIS_CANS - 1 ; curPos++ )
    56855560        {
    5686           cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5687           if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
     5561      for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
    56885562          {
    5689 #if MTK_RELEASE_DV_CONSTRAINT_C0129
    5690             aiDvMcpDvCandX[iList][DVFROM_ABOVERIGHT] = cTmpMvPred.m_iDvMcpDispX;
    5691             aiDvMcpDvCandY[iList][DVFROM_ABOVERIGHT] = cTmpMvPred.m_iDvMcpDispY;
    5692 #else
    5693             aiDvMcpDvCand[iList][DVFROM_ABOVERIGHT] = cTmpMvPred.m_iDvMcpDispX;
    5694 #endif
    5695             abDvMcpFlag  [iList][DVFROM_ABOVERIGHT] = true;
    5696             bDvMcpIsFound = true;
    5697           }
    5698         }
    5699       }
    5700 #if MERL_VSP_C0152
    5701       else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
    5702       {
    5703         TComPic* picDepth = NULL;
    5704         TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
    5705         picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
    5706         if (picDepth && bDepthRefine)
    5707           estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
    5708         myMv.setVer(0);
    5709 
    5710         pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
    5711         pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
    5712         return;
    5713       }
    5714 #endif
    5715     }
    5716   }
    5717 
    5718   pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true, false);
    5719 
    5720   if (pcTmpCU && bParMerge)
    5721   {
    5722     if (!pcTmpCU->isDiffMER(xP-1, yP+nPSH, xP, yP))
    5723     {
    5724       pcTmpCU = NULL;
    5725     }
    5726   }
    5727 
    5728   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
    5729   {
    5730     bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
    5731     for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
    5732     {
    5733       eRefPicList = RefPicList(iList);
    5734       Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
    5735       if( refId >= 0)
    5736       {
    5737         Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
    5738         if (refViewIdx!= m_pcSlice->getViewId())
    5739         {
    5740           TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5741           clipMv(cMvPred);
    5742 #if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
    5743           pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    5744           pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    5745 #else
    5746           {
    5747             TComPic* picDepth = NULL;
    5748             picDepth = getSlice()->getRefPicBaseDepth();
    5749             if (picDepth && bDepthRefine)
    5750 #if LGE_SIMP_DVP_REFINE_C0112
    5751               estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true);
    5752 #else
    5753               estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
    5754 #endif
    5755             pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    5756             pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    5757           }
    5758 #endif
     5563        if( cMvpDvInfo.m_bAvailab[iList][curPos] )
     5564            {
     5565          TComMv cDispVec = cMvpDvInfo.m_acMvCand[iList][ curPos ];
     5566          clipMv( cDispVec );
     5567
     5568          TComPic* picDepth = getSlice()->getRefPicBaseDepth();
     5569              if (picDepth && bDepthRefine)
     5570            estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cDispVec, true);
     5571
     5572          pDInfo->m_acMvCand[ pDInfo->iN]   = cDispVec;
     5573            pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0;
    57595574          return;
    57605575        }
    5761         else // MCP
    5762         {
    5763           cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5764           if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
    5765           {
    5766 #if MTK_RELEASE_DV_CONSTRAINT_C0129
    5767             aiDvMcpDvCandX[iList][DVFROM_LEFTBELOW] = cTmpMvPred.m_iDvMcpDispX;
    5768             aiDvMcpDvCandY[iList][DVFROM_LEFTBELOW] = cTmpMvPred.m_iDvMcpDispY;
    5769 #else
    5770             aiDvMcpDvCand[iList][DVFROM_LEFTBELOW] = cTmpMvPred.m_iDvMcpDispX;
    5771 #endif
    5772             abDvMcpFlag  [iList][DVFROM_LEFTBELOW] = true;
    5773             bDvMcpIsFound = true;
    5774           }
    5775         }
    5776       }
    5777 #if MERL_VSP_C0152
    5778       else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
    5779       {
    5780         TComPic* picDepth = NULL;
    5781         TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
    5782         picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
    5783         if (picDepth && bDepthRefine)
    5784           estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
    5785         myMv.setVer(0);
    5786 
    5787         pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
    5788         pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
    5789         return;
    5790       }
    5791 #endif
    5792     }
    5793   }
    5794 
    5795   // Above predictor search
    5796   pcTmpCU = getPUAboveLeft(uiIdx, (m_uiAbsIdxInLCU + uiPartAddr), true, false, true);
    5797   assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr));
    5798 
    5799   if (pcTmpCU && bParMerge)
    5800   {
    5801     if (!pcTmpCU->isDiffMER(xP-1, yP-1, xP, yP))
    5802     {
    5803       pcTmpCU = NULL;
    5804     }
    5805   }
    5806 
    5807   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
    5808   {
    5809     iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
    5810 
    5811     bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
    5812     for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
    5813     {
    5814       eRefPicList = RefPicList(iList);
    5815       Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
    5816       if( refId >= 0)
    5817       {
    5818         Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
    5819         if (refViewIdx!= m_pcSlice->getViewId())
    5820         {
    5821           TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5822           clipMv(cMvPred);
    5823 #if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
    5824           pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    5825           pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    5826 #else
    5827           {
    5828             TComPic* picDepth = NULL;
    5829             picDepth = getSlice()->getRefPicBaseDepth();
    5830             if (picDepth && bDepthRefine)
    5831 #if LGE_SIMP_DVP_REFINE_C0112
    5832               estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true);
    5833 #else
    5834               estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
    5835 #endif
    5836             pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    5837             pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    5838           }
    5839 #endif
    5840           return;
    5841         }
    5842         else if(iLCUAddrDiff <= 1)
    5843         {
    5844           cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5845           if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
    5846           {
    5847 #if MTK_RELEASE_DV_CONSTRAINT_C0129
    5848             aiDvMcpDvCandX[iList][DVFROM_ABOVELEFT] = cTmpMvPred.m_iDvMcpDispX;
    5849             aiDvMcpDvCandY[iList][DVFROM_ABOVELEFT] = cTmpMvPred.m_iDvMcpDispY;
    5850 #else
    5851             aiDvMcpDvCand[iList][DVFROM_ABOVELEFT] = cTmpMvPred.m_iDvMcpDispX;
    5852 #endif
    5853             abDvMcpFlag  [iList][DVFROM_ABOVELEFT] = true;
    5854             bDvMcpIsFound = true;
    5855           }
    5856         }
    5857       }
    5858 #if MERL_VSP_C0152
    5859       else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
    5860       {
    5861         TComPic* picDepth = NULL;
    5862         TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
    5863         picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
    5864         if (picDepth && bDepthRefine)
    5865           estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
    5866         myMv.setVer(0);
    5867 
    5868         pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
    5869         pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
    5870         return;
    5871       }
    5872 #endif
    5873     }
    5874   }
    5875 #if !MTK_SAIT_TEMPORAL_FIRST_ORDER_C0141_C0097
    5876   // copied from getInterMergeCand()
    5877   if ( getSlice()->getPPS()->getEnableTMVPFlag() )
    5878   {
    5879     TComMv cColMv;
    5880     Int iTargetViewIdx = 0;
    5881     Int iTStartViewIdx = 0;
    5882     UInt uiPartIdxRB, uiBRIdx;
    5883 #if !MTK_SIMPLIFY_DVTC_C0135
    5884     Int uiViewIdxCurr= getSlice()->getViewId();
    5885 #endif
    5886     UInt uiPartIdxCenter;
    5887     xDeriveCenterIdx( eCUMode, uiPartIdx, uiPartIdxCenter );
    5888 
    5889     Int uiLCUIdx = getAddr();
    5890     Int uiLCUnew = uiLCUIdx;
    5891     eCUMode = getPartitionSize( 0 );
    5892     deriveRightBottomIdx( eCUMode, uiPartIdx, uiPartIdxRB ); 
    5893     uiBRIdx = uiPartIdxLT;
    5894     UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];
    5895 #if MTK_SIMPLIFY_DVTC_C0135
    5896     if (( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() )>= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )
    5897     {
    5898       uiLCUnew = -1;
    5899     }
    5900     else if(( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() )>= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
    5901     {
    5902       uiLCUnew = -1;
    5903     }
    5904     else
    5905 #else
    5906     if ( (( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) < m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) &&(( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getSPS()->getPicHeightInLumaSamples() ))  // image boundary check
    5907 #endif
    5908     {
    5909       if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) &&           // is not at the last column of LCU
    5910       ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row    of LCU
    5911       {
    5912         uiBRIdx = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ];
    5913       }
    5914       else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 )           // is not at the last column of LCU But is last row of LCU
    5915       {
    5916         uiBRIdx = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ];
    5917 #if MTK_SIMPLIFY_DVTC_C0135
    5918         uiLCUnew = -1;
    5919 #else
    5920         uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU();
    5921 #endif
    5922       }
    5923       else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
    5924       {
    5925         uiBRIdx = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ];
    5926         uiLCUnew = uiLCUIdx + 1;
    5927       }
    5928       else //is the right bottom corner of LCU                       
    5929       {
    5930         uiBRIdx = 0;
    5931 #if MTK_SIMPLIFY_DVTC_C0135
    5932         uiLCUnew = -1;
    5933 #else
    5934         uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU() + 1;
    5935 #endif
    5936       }
    5937     }
    5938     const Int iNumofCandPic = 2;
    5939     for(Int i =0; i < iNumofCandPic; i++)
    5940     {
    5941       Int lpRef=0;
    5942       if(i == 0)
    5943       {   //check the col-located picture
    5944         eRefPicList = RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0);
    5945 #if COLLOCATED_REF_IDX
    5946         lpRef = getSlice()->getColRefIdx();
    5947 #else
    5948         Int lpRef = 0;
    5949 #endif
    5950       }
    5951       else
    5952       {
    5953         if(!(getPic()->getRapbCheck()))
    5954           break;
    5955         eRefPicList=getPic()->getRapRefList();
    5956         lpRef=getPic()->getRapRefIdx();
    5957       }
    5958 
    5959       if( m_pcSlice->getViewId() == getSlice()->getRefPic( eRefPicList, lpRef)->getViewId() )
    5960       {
    5961 #if !MTK_SIMPLIFY_DVTC_C0135
    5962         if (uiViewIdxCurr > 1) 
    5963         {
    5964 #endif
    5965           if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) )
    5966           {
    5967             clipMv(cColMv);
    5968 #if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
    5969             pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
    5970             pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
    5971 #else
    5972             {
    5973               TComPic* picDepth = NULL;
    5974               picDepth = getSlice()->getRefPicBaseDepth();
    5975               if (picDepth && bDepthRefine)
    5976 #if LGE_SIMP_DVP_REFINE_C0112
    5977                 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
    5978 #else
    5979                 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
    5980 #endif
    5981 
    5982               pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
    5983               pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
    5984             }
    5985 #endif
    5986             return ;
    5987           }
    5988 #if !MTK_SIMPLIFY_DVTC_C0135
    5989         }
    5990 #endif
    5991         if(xGetColDisMV( eRefPicList, lpRef, uiLCUIdx, uiPartIdxCenter,  cColMv, iTargetViewIdx, iTStartViewIdx ))
    5992         {
    5993           clipMv(cColMv);
    5994 #if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
    5995             pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
    5996             pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
    5997 #else
    5998             {
    5999               TComPic* picDepth = NULL;
    6000               picDepth = getSlice()->getRefPicBaseDepth();
    6001               if (picDepth && bDepthRefine)
    6002 #if LGE_SIMP_DVP_REFINE_C0112
    6003                 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
    6004 #else
    6005                 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
    6006 #endif
    6007               pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
    6008               pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
    6009             }
    6010 #endif
    6011           return ;
    6012         }
    6013 #if !MTK_SIMPLIFY_DVTC_C0135
    6014         if(uiViewIdxCurr == 1) 
    6015         {
    6016           if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) )
    6017           {
    6018             clipMv(cColMv);
    6019 #if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
    6020             pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
    6021             pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
    6022 #else
    6023             {
    6024               TComPic* picDepth = NULL;
    6025               picDepth = getSlice()->getRefPicBaseDepth();
    6026               if (picDepth && bDepthRefine)
    6027 #if LGE_SIMP_DVP_REFINE_C0112
    6028                 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
    6029 #else
    6030                 estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
    6031 #endif
    6032               pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
    6033               pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
    6034             }
    6035 #endif
    6036             return ;
    6037           }
    6038         }
    6039 #endif
    6040       }
    6041     }
    6042   } // if TMVP Flag
    6043 #endif
    6044 
    6045   if( bDvMcpIsFound ) // skip dvmcp
    6046   {
    6047     for( Int i=1 ; i<iNumofDvMCP-1 ; i++ ) // 5 spatial
    6048     {
    6049       for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
    6050       {
    6051         if( abDvMcpFlag[iList][i]==true )
    6052         {
    6053 #if MTK_RELEASE_DV_CONSTRAINT_C0129
    6054           TComMv dv( aiDvMcpDvCandX[iList][ i ], aiDvMcpDvCandY[iList][ i ] );
    6055 #else
    6056           TComMv dv( aiDvMcpDvCand[iList][ i ], 0 );
    6057 #endif
    6058           clipMv( dv );
    6059 #if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
    6060           pDInfo->m_acMvCand[ pDInfo->iN] = dv;
    6061           pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0;
    6062 #else
    6063           {
    6064             TComPic* picDepth = NULL;
    6065             picDepth = getSlice()->getRefPicBaseDepth();
    6066             if (picDepth && bDepthRefine)
    6067 #if LGE_SIMP_DVP_REFINE_C0112
    6068               estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &dv, true);
    6069 #else
    6070               estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &dv);
    6071 #endif
    6072             pDInfo->m_acMvCand[ pDInfo->iN] = dv;
    6073             pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0;
    6074           }
    6075 #endif
    6076           return;
    6077         }
    6078 
    60795576      }
    60805577    }
     
    67716268  iColViewIdx = pColCU->getSlice()->getViewId();
    67726269#if MERL_VSP_C0152
    6773   //TComDataCU *pColCU = pColPic->getCU( uiCUAddr );
    67746270  if( pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr) < 0)
    67756271  {
     
    67866282    if(pColCU->getSlice()->isInterB())
    67876283    {
    6788 #if !QC_NBDV_LDB_FIX_C0055
    6789       if(ilist == 0 )
    6790         eColRefPicList = getSlice()->getCheckLDC() ? eRefPicList : RefPicList(1-getSlice()->getColDir());
    6791       else
    6792         eColRefPicList = getSlice()->getCheckLDC() ? (eRefPicList== REF_PIC_LIST_0? REF_PIC_LIST_1:REF_PIC_LIST_0 ): RefPicList(getSlice()->getColDir());
    6793 #else
    67946284        eColRefPicList = RefPicList(ilist);
    6795 #endif
    67966285    }
    67976286
     
    80087497  else
    80097498  {
    8010 #if MTK_RELEASE_DV_CONSTRAINT_C0129
    80117499    Bool bAvailable = pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, cDisInfo.m_acMvCand[0], bRecon );       
    8012 #else
    8013     Bool bAvailable = pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, cDisInfo.m_acMvCand[0].getHor(), bRecon );
    8014 #endif
    80157500    m_pePartSize[0] = m_peSaved;
    80167501    return bAvailable;
  • branches/HTM-6.1-Cleanup/source/Lib/TLibCommon/TComDataCU.h

    r299 r322  
    287287  );
    288288#if H3D_NBDV
     289  Void          xDeriveRightBottomNbIdx( PartSize eCUMode, UInt uiPartIdx, Int &uiLCUIdxRBNb, Int &uiPartIdxRBNb );
     290  Bool          xCheckSpatialNBDV( TComDataCU* pcTmpCU, UInt uiIdx, UInt uiPartIdx, UInt uiPartAddr, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, McpDisInfo* paMvpDvInfo, UInt uiMvpDvPos );
    289291  Bool          xGetColDisMV( RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int & iTargetViewIdx, Int & iStartViewIdx );
    290292#endif
     
    550552
    551553#if MERL_VSP_C0152
    552 #if LGE_SIMP_DVP_REFINE_C0112
    553554  Pel           getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT, Int iShiftPrec, Bool bSimpleDvpRefine = false);
    554555  Void          estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred, Bool bSimpleDvpRefine = false);
    555 #else
    556   Pel           getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT, Int iShiftPrec);
    557   Void          estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred);
    558 #endif
    559556#endif
    560557  Bool          getIViewOrgDepthMvPred( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv );
     
    601598  Void          fillMvpCandBase       ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo );
    602599  Void          fillMvpCand           ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo , Int iMVPIdx=-1);
    603 #else
    604   Void          fillMvpCand           ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo );
    605600#endif
    606601  Bool          isDiffMER             ( Int xN, Int yN, Int xP, Int yP);
     
    831826  Pel           getSDCSegmentDCOffset( UInt uiSeg, UInt uiPartIdx ) { return m_apSegmentDCOffset[uiSeg][uiPartIdx]; }
    832827  Void          setSDCSegmentDCOffset( Pel pOffset, UInt uiSeg, UInt uiPartIdx) { m_apSegmentDCOffset[uiSeg][uiPartIdx] = pOffset; }
     828 
     829
    833830#endif
    834831};
  • branches/HTM-6.1-Cleanup/source/Lib/TLibCommon/TComDepthMapGenerator.cpp

    r296 r322  
    894894              cMv.m_bDvMcp = true;
    895895              cMv.m_iDvMcpDispX = pDInfo->m_acMvCand[0].getHor();
    896 #if MTK_RELEASE_DV_CONSTRAINT_C0129
    897896              cMv.m_iDvMcpDispY = pDInfo->m_acMvCand[0].getVer();
    898 #endif
    899897#endif //H3D_NBDV
    900898              pcCU->clipMv( cMv );
     
    10121010          rcMv.m_bDvMcp = true;
    10131011          rcMv.m_iDvMcpDispX = pDInfo->m_acMvCand[0].getHor();
    1014 #if MTK_RELEASE_DV_CONSTRAINT_C0129
    10151012          rcMv.m_iDvMcpDispY = pDInfo->m_acMvCand[0].getVer();
    1016 #endif
    10171013        }
    10181014        else { // AMVP ?
  • branches/HTM-6.1-Cleanup/source/Lib/TLibCommon/TComMotionInfo.h

    r296 r322  
    6666  Int    iN;                                ///< number of motion vector predictor candidates
    6767} DisInfo;
     68
     69typedef struct _McpDisCand
     70{
     71  TComMv m_acMvCand[2][ MCP_DIS_CANS ];            ///< array of motion vector predictor candidates
     72  Int    m_aVIdxCan[2][ MCP_DIS_CANS ];            ///< array of motion vector predictor candidates
     73  Bool   m_bAvailab[2][ MCP_DIS_CANS ];
     74  Bool   m_bFound;                                 ///< number of motion vector predictor candidates
     75} McpDisInfo;
     76
    6877#endif
    6978// Class definition
  • branches/HTM-6.1-Cleanup/source/Lib/TLibCommon/TComMv.h

    r296 r322  
    6060  Bool  m_bDvMcp;       // is dv-mcp ?
    6161  Int   m_iDvMcpDispX;  // disparity for dv-mcp
    62 #if MTK_RELEASE_DV_CONSTRAINT_C0129
    6362  Int   m_iDvMcpDispY;  // disparity for dv-mcp
    64 #endif
    6563#endif
    6664
     
    7573  , m_bDvMcp(false)
    7674  , m_iDvMcpDispX(0)
    77 #if MTK_RELEASE_DV_CONSTRAINT_C0129
    7875  , m_iDvMcpDispY(0)
    79 #endif
    8076#endif
    8177  {
     
    8884  , m_bDvMcp(false)
    8985  , m_iDvMcpDispX(0)
    90 #if MTK_RELEASE_DV_CONSTRAINT_C0129
    9186  , m_iDvMcpDispY(0)
    92 #endif
    9387#endif
    9488  {
  • branches/HTM-6.1-Cleanup/source/Lib/TLibCommon/TComResidualGenerator.cpp

    r313 r322  
    227227
    228228#if H3D_NBDV
    229 #if MTK_RELEASE_DV_CONSTRAINT_C0129
    230229Bool
    231230TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, TComMv iDisp, Bool bRecon  )
    232 #else
    233 Bool
    234 TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, Int iDisp, Bool bRecon  )
    235 #endif
    236231#else
    237232Bool
     
    248243  pcCU->getPic()->getPicYuvRec()->getTopLeftSamplePos( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr, iXPos, iYPos );
    249244#if H3D_NBDV
    250 #if MTK_RELEASE_DV_CONSTRAINT_C0129
    251   return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, iDisp, bRecon);   
    252 #else
    253245  return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, iDisp, bRecon);
    254 #endif
    255246#else
    256247  return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, bRecon);
     
    259250 
    260251#if H3D_NBDV
    261 #if MTK_RELEASE_DV_CONSTRAINT_C0129
    262252Bool
    263253TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, TComMv iDisp, Bool bRecon) 
    264254#else
    265255Bool
    266 TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp, Bool bRecon)
    267 #endif
    268 #else
    269 Bool
    270256TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Bool bRecon)
    271257#endif
     
    282268  UInt uiXPosInRefView = uiXPos , uiYPosInRefView = uiYPos;
    283269#if H3D_NBDV
    284 #if MTK_RELEASE_DV_CONSTRAINT_C0129
    285270  xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, iDisp, &uiXPosInRefView , &uiYPosInRefView , bRecon  );
    286 #else
    287   xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, iDisp, &uiXPosInRefView , &uiYPosInRefView , bRecon  );
    288 #endif
    289271#else
    290272  xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, &uiXPosInRefView , &uiYPosInRefView , bRecon    );
     
    500482
    501483#if H3D_NBDV
    502 #if MTK_RELEASE_DV_CONSTRAINT_C0129
    503484Void 
    504485TComResidualGenerator::xSetPredResidualBlock( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, TComMv iDisp
    505486                                             ,UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon )
    506 #else // MTK_RELEASE_DV_CONSTRAINT_C0129
    507 Void 
    508 TComResidualGenerator::xSetPredResidualBlock( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp
    509                                              ,UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon)
    510 #endif // MTK_RELEASE_DV_CONSTRAINT_C0129
    511487#else // H3D_NBDV
    512488Void 
     
    531507  //===== get disparity =====
    532508#if H3D_NBDV
    533 #if MTK_RELEASE_DV_CONSTRAINT_C0129
    534509  Int iDisparity_y = iDisp.getVer();
    535510  Int iDisparity   = iDisp.getHor();
    536 #else
    537   Int iDisparity = iDisp;
    538 #endif
    539511#else //H3D_NBDV
    540512  Int           iMidPosX    = Int( uiXPos + ( ( uiBlkWidth  - 1 ) >> 1 ) ) >> m_pcDepthMapGenerator->getSubSampExpX();
     
    549521  Int           iYRefPosX0  = Int( uiXPos )     + ( iDisparity >> 2 );
    550522  Int           iYRefPosX1  = iYRefPosX0        + 1;
    551 #if MTK_RELEASE_DV_CONSTRAINT_C0129
    552523  Int           iYMaxPosY   = Int( uiPicHeight ) - 1;
    553524  Int           iYWeight3   = ( iDisparity_y & 3 );
     
    555526  Int           iYRefPosY0  = Max( 0, Min( iYMaxPosY, Int( uiYPos )     + ( iDisparity_y >> 2 )) );
    556527  Int           iYRefPosY1  = Max( 0, Min( iYMaxPosY, iYRefPosY0 + 1 ));
    557 #endif
    558528  Int           iYMaxPosX   = Int( uiPicWidth ) - 1;
    559529  Int           iSrcStrideY = pcBaseRes->getStride   ();
    560530  Int           iDesStrideY = pcYuv    ->getStride   ();
    561 #if MTK_RELEASE_DV_CONSTRAINT_C0129
    562531  Pel*          pSrcSamplesY0= pcBaseRes->getLumaAddr ( 0 ) + iYRefPosY0 * iSrcStrideY;
    563532  Pel*          pSrcSamplesY1= pcBaseRes->getLumaAddr ( 0 ) + iYRefPosY1 * iSrcStrideY;
    564 #else
    565   Pel*          pSrcSamplesY= pcBaseRes->getLumaAddr ( 0 ) + uiYPos * iSrcStrideY;
    566 #endif
    567533  Pel*          pDesSamplesY= pcYuv    ->getLumaAddr ();
    568534
     
    575541    return;
    576542
    577 #if MTK_RELEASE_DV_CONSTRAINT_C0129
    578543  for(   Int iY = 0; iY < iYHeight; iY++, pSrcSamplesY0 += iSrcStrideY, pSrcSamplesY1 += iSrcStrideY, pDesSamplesY += iDesStrideY )
    579 #else
    580   for(   Int iY = 0; iY < iYHeight; iY++, pSrcSamplesY += iSrcStrideY, pDesSamplesY += iDesStrideY )
    581 #endif
    582544  {
    583545    for( Int iX = 0; iX < iYWidth; iX++ )
     
    585547      Int iXPic0        = Max( 0, Min( iYMaxPosX, iYRefPosX0 + iX ) );
    586548      Int iXPic1        = Max( 0, Min( iYMaxPosX, iYRefPosX1 + iX ) );
    587 #if MTK_RELEASE_DV_CONSTRAINT_C0129
    588549      Pel Temp1,Temp2;
    589550      Temp1 =( iYWeight0 * pSrcSamplesY0[iXPic0] + iYWeight1 * pSrcSamplesY0[iXPic1] + 2 ) >> 2;
    590551      Temp2 =( iYWeight0 * pSrcSamplesY1[iXPic0] + iYWeight1 * pSrcSamplesY1[iXPic1] + 2 ) >> 2;
    591552      pDesSamplesY[iX]  = ( iYWeight2 * Temp1 + iYWeight3 * Temp2 + 2 ) >> 2;
    592 #else
    593       pDesSamplesY[iX]  = ( iYWeight0 * pSrcSamplesY[iXPic0] + iYWeight1 * pSrcSamplesY[iXPic1] + 2 ) >> 2;
    594 #endif
    595553    }
    596554  }
     
    603561  Int           iCRefPosX0  = Int( uiXPos     >> 1 ) + ( iDisparity >> 3 );
    604562  Int           iCRefPosX1  = iCRefPosX0             + 1;
    605 #if MTK_RELEASE_DV_CONSTRAINT_C0129
    606563  Int           iCMaxPosY   = Int( uiPicHeight >> 1 ) - 1;
    607564  Int           iCWeight3   = ( iDisparity_y & 7 );
     
    609566  Int           iCRefPosY0  = Max( 0, Min( iCMaxPosY, Int( uiYPos >> 1 )     + ( iDisparity_y >> 3 )) );
    610567  Int           iCRefPosY1  = Max( 0, Min( iCMaxPosY, iCRefPosY0 + 1 ));
    611 #endif
    612568  Int           iCMaxPosX   = Int( uiPicWidth >> 1 ) - 1;
    613569  Int           iSrcStrideC = pcBaseRes->getCStride();
    614570  Int           iDesStrideC = pcYuv    ->getCStride();
    615 #if MTK_RELEASE_DV_CONSTRAINT_C0129
     571
    616572#if FIX_CHROMA_RESIDUAL_C0129
    617573  Pel*          pSrcSamplesU0= pcBaseRes->getCbAddr ( 0 ) + iCRefPosY0 * iSrcStrideC;
     
    625581  Pel*          pSrcSamplesV1= pcBaseRes->getCrAddr ( 0 ) + ( iCRefPosY1 >> 1 ) * iSrcStrideC;
    626582#endif
    627 #else
    628   Pel*          pSrcSamplesU= pcBaseRes->getCbAddr ( 0 ) + ( uiYPos >> 1 ) * iSrcStrideC;
    629   Pel*          pSrcSamplesV= pcBaseRes->getCrAddr ( 0 ) + ( uiYPos >> 1 ) * iSrcStrideC;
    630 #endif
    631583  Pel*          pDesSamplesU= pcYuv    ->getCbAddr ();
    632584  Pel*          pDesSamplesV= pcYuv    ->getCrAddr ();
    633 #if MTK_RELEASE_DV_CONSTRAINT_C0129
    634585  for(   Int iY = 0; iY < iCHeight; iY++, pSrcSamplesU0 += iSrcStrideC, pSrcSamplesU1 += iSrcStrideC, pDesSamplesU += iDesStrideC,
    635586                                          pSrcSamplesV0 += iSrcStrideC, pSrcSamplesV1 += iSrcStrideC, pDesSamplesV += iDesStrideC )
    636 #else
    637   for(   Int iY = 0; iY < iCHeight; iY++, pSrcSamplesU += iSrcStrideC, pDesSamplesU += iDesStrideC,
    638                                           pSrcSamplesV += iSrcStrideC, pDesSamplesV += iDesStrideC )
    639 #endif
    640587  {
    641588    for( Int iX = 0; iX < iCWidth; iX++ )
     
    643590      Int iXPic0        = Max( 0, Min( iCMaxPosX, iCRefPosX0 + iX ) );
    644591      Int iXPic1        = Max( 0, Min( iCMaxPosX, iCRefPosX1 + iX ) );
    645 #if MTK_RELEASE_DV_CONSTRAINT_C0129
    646592      Pel Temp1,Temp2;
    647593      Temp1 =( iCWeight0 * pSrcSamplesU0[iXPic0] + iCWeight1 * pSrcSamplesU0[iXPic1] + 4 ) >> 3;
     
    651597      Temp2 =( iCWeight0 * pSrcSamplesV1[iXPic0] + iCWeight1 * pSrcSamplesV1[iXPic1] + 4 ) >> 3;
    652598      pDesSamplesV[iX]  = ( iCWeight2 * Temp1 + iCWeight3 * Temp2 + 4 ) >> 3;
    653 #else
    654       pDesSamplesU[iX]  = ( iCWeight0 * pSrcSamplesU[iXPic0] + iCWeight1 * pSrcSamplesU[iXPic1] + 4 ) >> 3;
    655       pDesSamplesV[iX]  = ( iCWeight0 * pSrcSamplesV[iXPic0] + iCWeight1 * pSrcSamplesV[iXPic1] + 4 ) >> 3;
    656 #endif
    657599    }
    658600  }
  • branches/HTM-6.1-Cleanup/source/Lib/TLibCommon/TComResidualGenerator.h

    r296 r322  
    7070
    7171#if H3D_NBDV
    72 #if MTK_RELEASE_DV_CONSTRAINT_C0129
    7372  Bool  getResidualSamples    ( TComDataCU*   pcCU,  UInt uiPUIdx, TComYuv* pcYuv, TComMv iDisp_x, Bool bRecon );
    7473  Bool  getResidualSamples    ( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv , TComMv iDisp_x, Bool bRecon );
    75 #else
    76   Bool  getResidualSamples    ( TComDataCU*   pcCU,  UInt uiPUIdx, TComYuv* pcYuv, Int iDisp, Bool bRecon );
    77   Bool  getResidualSamples    ( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv , Int iDisp, Bool bRecon );
    78 #endif
    7974#else // H3D_NBDV
    8075  Bool  getResidualSamples    ( TComDataCU*   pcCU,  UInt uiPUIdx, TComYuv* pcYuv, Bool bRecon );
     
    9085  Void  xClearResidual        (                      TComYuv* pcCUResidual, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight );
    9186#if H3D_NBDV
    92 #if MTK_RELEASE_DV_CONSTRAINT_C0129
    9387  Void  xSetPredResidualBlock ( TComPic*      pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, TComMv iDisp, UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon  );   
    94 #else
    95   Void  xSetPredResidualBlock ( TComPic*      pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp, UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon  );
    96 #endif
    9788#else
    9889  Void  xSetPredResidualBlock ( TComPic*      pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon  );
  • branches/HTM-6.1-Cleanup/source/Lib/TLibCommon/TypeDef.h

    r313 r322  
    117117                                              // FIX_LGE_IVMP_PARALLEL_MERGE_B0136
    118118
    119 #define QC_NBDV_LDB_FIX_C0055             1   // JCT3V-C0055
    120 #define MTK_SAIT_TEMPORAL_FIRST_ORDER_C0141_C0097     1   // JCT3V-C0141/C0097
    121 #define MTK_RELEASE_DV_CONSTRAINT_C0129   1   // JCT3V-C0129
    122 #define MTK_SIMPLIFY_DVTC_C0135           1   // JCT3V-C0135
     119                                              // QC_NBDV_LDB_FIX_C0055
     120                                              // MTK_SAIT_TEMPORAL_FIRST_ORDER_C0141_C0097
     121                                              // MTK_RELEASE_DV_CONSTRAINT_C0129   
     122                                              // MTK_SIMPLIFY_DVTC_C0135           
    123123#define FIX_CHROMA_RESIDUAL_C0129         1
    124124
     
    186186///// ***** VSP *********
    187187#define MERL_VSP_C0152                    1 // JCT3V-C0152: 1: enable VSP-related tools; 0: disable VSP-related tools
     188                                            // LGE_SIMP_DVP_REFINE_C0112           
     189                                            // MERL_MTK_VSP_DVP_REFINE_C0152_C0131
    188190#if MERL_VSP_C0152
    189191#define MERL_VSP_C0152_BugFix_ForNoDepthCase     1// MERL bugfix for test condition of no depth
     
    205207
    206208#define MERL_VSP_COMPENSATION_C0152          1 // JCT3V-C0152: 1: add VSP merge candidate to merging candidate list; 0: not to add   (nocand).
    207 #define MERL_MTK_VSP_DVP_REFINE_C0152_C0131  1 // JCT3V-C0152 && JCT3V-C0131: 1: refine disparity vector using a warped depth block; 0: not to refine  (mvp2off).
     209
    208210
    209211#define MERL_VSP_BLOCKSIZE_C0152             4 // JCT3V-C0152: VSP block size, supported values: 1, 2 and 4.
    210212#define VSP_MERGE_POS                        5 // JCT3V-C0152: fixed position of VSP candidate in merge list, supported values: 5.
    211 #define LGE_SIMP_DVP_REFINE_C0112            1 // JCT3V-C0112: 1: simplification of refining disparity vector using a warped depth block
    212213#define MTK_DVPREFINE_BVSP_BUG_FIX               1
    213214
    214215#else // !MERL_VSP_C0152
    215216#define MERL_VSP_COMPENSATION_C0152          0 // JCT3V-C0152: 1: add VSP merge candidate to merging candidate list; 0: not to add
    216 #define MERL_MTK_VSP_DVP_REFINE_C0152_C0131  0 // JCT3V-C0152 && JCT3V-C0131: 1: refine disparity vector using a warped depth block; 0: not to refine
    217217#define MERL_VSP_BLOCKSIZE_C0152             4 // JCT3V-C0152: VSP block size, supported values: 1, 2 and 4.
    218 #define LGE_SIMP_DVP_REFINE_C0112            0 // JCT3V-C0112: 1: simplification of refining disparity vector using a warped depth block
    219218#endif
    220219
     
    223222#if H3D_NBDV                   
    224223#define DIS_CANS                          1
     224#define MCP_DIS_CANS                      1
    225225#endif                                 
    226226
Note: See TracChangeset for help on using the changeset viewer.