Changeset 245 in 3DVCSoftware


Ignore:
Timestamp:
31 Jan 2013, 07:07:01 (11 years ago)
Author:
mediatek-htm
Message:

Integration of JCT3V-C0141/C0097
The MACRO is MTK_SAIT_TEMPORAL_FIRST_ORDER

Location:
branches/HTM-5.1-dev3-Mediatek/source/Lib/TLibCommon
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-5.1-dev3-Mediatek/source/Lib/TLibCommon/TComDataCU.cpp

    r231 r245  
    56315631  deriveLeftBottomIdxGeneral( eCUMode, uiPartAddr, uiPartIdx, uiPartIdxLB );
    56325632
    5633   UInt uiIdx = 0;
    5634 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    5635   pcTmpCU = getPULeft(uiIdx, uiPartIdxLB, true, false);
    5636 #else
    5637   pcTmpCU = getPULeft(uiIdx, uiPartIdxLB);
    5638 #endif
    5639 #if DV_DERIVATION_PARALLEL_B0096
    5640   if ( uiPartIdx == 1 && (eCUMode == SIZE_Nx2N || eCUMode == SIZE_nLx2N || eCUMode == SIZE_nRx2N) )
    5641   {
    5642     pcTmpCU = NULL;
    5643   }
    5644 #endif
    5645 #if LGE_IVMP_PARALLEL_MERGE_B0136
    5646   if (pcTmpCU && bParMerge)
    5647   {
    5648     if (!pcTmpCU->isDiffMER(xP -1, yP+nPSH-1, xP, yP))
    5649     {
    5650       pcTmpCU = NULL;
    5651     }
    5652   }
    5653 #endif
    5654 
    5655 #if !QC_SIMPLE_NBDV_B0047
    5656   pcCULeft = pcTmpCU;
    5657   UInt uiLeftPartIdx = uiIdx;
    5658 #endif
    5659 
    5660   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
    5661   {
    5662     bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
    5663     for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
    5664     {
    5665       eRefPicList = RefPicList(iList);
    5666       Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
    5667       if( refId >= 0)
    5668       {
    5669         Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
    5670         if (refViewIdx != m_pcSlice->getViewId()) // DCP
    5671         {
    5672           TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5673           clipMv(cMvPred);
    5674 #if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
    5675           pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    5676           pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    5677 #else
    5678           {
    5679             TComPic* picDepth = NULL;
    5680             picDepth = getSlice()->getRefPicBaseDepth();
    5681             if (picDepth && bDepthRefine)
    5682               estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
    5683             pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    5684             pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    5685           }
    5686 #endif
    5687           return;
    5688         }
    5689         else // MCP
    5690         {
    5691           cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5692           if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
    5693           {
    5694             aiDvMcpDvCand[iList][DVFROM_LEFT] = cTmpMvPred.m_iDvMcpDispX;
    5695             abDvMcpFlag  [iList][DVFROM_LEFT] = 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 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    5719   pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT, true, false, true);
    5720 #else
    5721   pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT);
    5722 #endif
    5723 #if DV_DERIVATION_PARALLEL_B0096
    5724   if ( uiPartIdx == 1 && (eCUMode == SIZE_2NxN || eCUMode == SIZE_2NxnU || eCUMode == SIZE_2NxnD) )
    5725   {
    5726     pcTmpCU = NULL;
    5727   }
    5728 #endif
    5729 #if LGE_IVMP_PARALLEL_MERGE_B0136
    5730   if (pcTmpCU && bParMerge)
    5731   {
    5732     if (!pcTmpCU->isDiffMER(xP+nPSW-1, yP-1, xP, yP))
    5733     {
    5734       pcTmpCU = NULL;
    5735     }
    5736   }
    5737 #endif
    5738 
    5739   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
    5740   {
    5741 #if LGE_DVMCP_MEM_REDUCTION_B0135
    5742     iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
    5743 #endif
    5744     bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
    5745     for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
    5746     {
    5747       eRefPicList = RefPicList(iList);
    5748       Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
    5749       if( refId >= 0)
    5750       {
    5751         Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
    5752         if (refViewIdx!= m_pcSlice->getViewId())
    5753         {
    5754           TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5755           clipMv(cMvPred);
    5756 #if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
    5757           pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    5758           pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    5759 #else
    5760           {
    5761             TComPic* picDepth = NULL;
    5762             picDepth = getSlice()->getRefPicBaseDepth();
    5763             if (picDepth && bDepthRefine)
    5764               estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
    5765             pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    5766             pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    5767           }
    5768 #endif
    5769           return;
    5770         }
    5771 #if LGE_DVMCP_MEM_REDUCTION_B0135
    5772         else if(iLCUAddrDiff == 0) //MCP, within same LCU
    5773 #else
    5774         else // MCP
    5775 #endif
    5776         {
    5777           cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5778           if( cTmpMvPred.m_bDvMcp  && bTmpIsSkipped )
    5779           {
    5780             aiDvMcpDvCand[iList][DVFROM_ABOVE] = cTmpMvPred.m_iDvMcpDispX;
    5781             abDvMcpFlag  [iList][DVFROM_ABOVE] = true;
    5782             bDvMcpIsFound = true;
    5783           }
    5784         }
    5785       }
    5786 #if MERL_VSP_C0152
    5787       else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
    5788       {
    5789         TComPic* picDepth = NULL;
    5790         TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
    5791         picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
    5792         if (picDepth && bDepthRefine)
    5793           estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
    5794         myMv.setVer(0);
    5795 
    5796         pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
    5797         pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
    5798         return;
    5799       }
    5800 #endif
    5801     }
    5802   }
    5803 
    5804 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    5805   pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, false, true);
    5806 #else
    5807   pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, true, true);
    5808 #endif
    5809 #if LGE_IVMP_PARALLEL_MERGE_B0136
    5810   if (pcTmpCU && bParMerge)
    5811   {
    5812     if (!pcTmpCU->isDiffMER(xP+nPSW, yP-1, xP, yP))
    5813     {
    5814       pcTmpCU = NULL;
    5815     }
    5816   }
    5817 #endif
    5818 
    5819   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
    5820   {
    5821 #if LGE_DVMCP_MEM_REDUCTION_B0135
    5822     iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
    5823 #endif
    5824     bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
    5825     for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
    5826     {
    5827       eRefPicList = RefPicList(iList);
    5828       Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
    5829       if( refId >= 0)
    5830       {
    5831         Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
    5832         if (refViewIdx!= m_pcSlice->getViewId())
    5833         {
    5834           TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5835           clipMv(cMvPred);
    5836 #if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
    5837           pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    5838           pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    5839 #else
    5840           {
    5841             TComPic* picDepth = NULL;
    5842             picDepth = getSlice()->getRefPicBaseDepth();
    5843             if (picDepth && bDepthRefine)
    5844               estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
    5845             pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    5846             pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    5847           }
    5848 #endif
    5849           return;
    5850         }
    5851 #if LGE_DVMCP_MEM_REDUCTION_B0135
    5852         else if(iLCUAddrDiff == 0)
    5853 #else
    5854         else  // MCP
    5855 #endif
    5856         {
    5857           cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5858           if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
    5859           {
    5860             aiDvMcpDvCand[iList][DVFROM_ABOVERIGHT] = cTmpMvPred.m_iDvMcpDispX;
    5861             abDvMcpFlag  [iList][DVFROM_ABOVERIGHT] = true;
    5862             bDvMcpIsFound = true;
    5863           }
    5864         }
    5865       }
    5866 #if MERL_VSP_C0152
    5867       else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
    5868       {
    5869         TComPic* picDepth = NULL;
    5870         TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
    5871         picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
    5872         if (picDepth && bDepthRefine)
    5873           estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
    5874         myMv.setVer(0);
    5875 
    5876         pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
    5877         pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
    5878         return;
    5879       }
    5880 #endif
    5881     }
    5882   }
    5883 
    5884 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    5885   pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true, false);
    5886 #else
    5887   pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB);
    5888 #endif
    5889 #if LGE_IVMP_PARALLEL_MERGE_B0136
    5890   if (pcTmpCU && bParMerge)
    5891   {
    5892     if (!pcTmpCU->isDiffMER(xP-1, yP+nPSH, xP, yP))
    5893     {
    5894       pcTmpCU = NULL;
    5895     }
    5896   }
    5897 #endif
    5898   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
    5899   {
    5900     bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
    5901     for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
    5902     {
    5903       eRefPicList = RefPicList(iList);
    5904       Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
    5905       if( refId >= 0)
    5906       {
    5907         Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
    5908         if (refViewIdx!= m_pcSlice->getViewId())
    5909         {
    5910           TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5911           clipMv(cMvPred);
    5912 #if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
    5913           pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    5914           pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    5915 #else
    5916           {
    5917             TComPic* picDepth = NULL;
    5918             picDepth = getSlice()->getRefPicBaseDepth();
    5919             if (picDepth && bDepthRefine)
    5920               estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
    5921             pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    5922             pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    5923           }
    5924 #endif
    5925           return;
    5926         }
    5927         else // MCP
    5928         {
    5929           cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5930           if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
    5931           {
    5932             aiDvMcpDvCand[iList][DVFROM_LEFTBELOW] = cTmpMvPred.m_iDvMcpDispX;
    5933             abDvMcpFlag  [iList][DVFROM_LEFTBELOW] = true;
    5934             bDvMcpIsFound = true;
    5935           }
    5936         }
    5937       }
    5938 #if MERL_VSP_C0152
    5939       else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
    5940       {
    5941         TComPic* picDepth = NULL;
    5942         TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
    5943         picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
    5944         if (picDepth && bDepthRefine)
    5945           estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
    5946         myMv.setVer(0);
    5947 
    5948         pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
    5949         pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
    5950         return;
    5951       }
    5952 #endif
    5953     }
    5954   }
    5955 
    5956   // Above predictor search
    5957 #if MVP_AT_ENTROPYSLICE_BOUNDARY
    5958   pcTmpCU = getPUAboveLeft(uiIdx, (m_uiAbsIdxInLCU + uiPartAddr), true, false, true);
    5959   assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr));
    5960 #else
    5961   pcTmpCU = getPUAboveLeft(uiIdx, uiPartIdxLT, true, true, true);
    5962 #endif
    5963 #if LGE_IVMP_PARALLEL_MERGE_B0136
    5964   if (pcTmpCU && bParMerge)
    5965   {
    5966     if (!pcTmpCU->isDiffMER(xP-1, yP-1, xP, yP))
    5967     {
    5968       pcTmpCU = NULL;
    5969     }
    5970   }
    5971 #endif
    5972 
    5973   if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
    5974   {
    5975 #if LGE_DVMCP_MEM_REDUCTION_B0135
    5976     iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
    5977 #endif
    5978     bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
    5979     for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
    5980     {
    5981       eRefPicList = RefPicList(iList);
    5982       Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
    5983       if( refId >= 0)
    5984       {
    5985         Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
    5986         if (refViewIdx!= m_pcSlice->getViewId())
    5987         {
    5988           TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    5989           clipMv(cMvPred);
    5990 #if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
    5991           pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    5992           pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    5993 #else
    5994           {
    5995             TComPic* picDepth = NULL;
    5996             picDepth = getSlice()->getRefPicBaseDepth();
    5997             if (picDepth && bDepthRefine)
    5998               estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
    5999             pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    6000             pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
    6001           }
    6002 #endif
    6003           return;
    6004         }
    6005 #if LGE_DVMCP_MEM_REDUCTION_B0135
    6006         else if(iLCUAddrDiff <= 1)
    6007 #else
    6008         else // MCP
    6009 #endif
    6010         {
    6011           cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    6012           if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
    6013           {
    6014             aiDvMcpDvCand[iList][DVFROM_ABOVELEFT] = cTmpMvPred.m_iDvMcpDispX;
    6015             abDvMcpFlag  [iList][DVFROM_ABOVELEFT] = true;
    6016             bDvMcpIsFound = true;
    6017           }
    6018         }
    6019       }
    6020 #if MERL_VSP_C0152
    6021       else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
    6022       {
    6023         TComPic* picDepth = NULL;
    6024         TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
    6025         picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
    6026         if (picDepth && bDepthRefine)
    6027           estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
    6028         myMv.setVer(0);
    6029 
    6030         pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
    6031         pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
    6032         return;
    6033       }
    6034 #endif
    6035     }
    6036   }
    6037 
     5633#if MTK_SAIT_TEMPORAL_FIRST_ORDER
    60385634  // copied from getInterMergeCand()
    60395635  if ( getSlice()->getPPS()->getEnableTMVPFlag() )
     
    63245920#endif
    63255921  } // if TMVP Flag
     5922#endif
     5923  UInt uiIdx = 0;
     5924#if MVP_AT_ENTROPYSLICE_BOUNDARY
     5925  pcTmpCU = getPULeft(uiIdx, uiPartIdxLB, true, false);
     5926#else
     5927  pcTmpCU = getPULeft(uiIdx, uiPartIdxLB);
     5928#endif
     5929#if DV_DERIVATION_PARALLEL_B0096
     5930  if ( uiPartIdx == 1 && (eCUMode == SIZE_Nx2N || eCUMode == SIZE_nLx2N || eCUMode == SIZE_nRx2N) )
     5931  {
     5932    pcTmpCU = NULL;
     5933  }
     5934#endif
     5935#if LGE_IVMP_PARALLEL_MERGE_B0136
     5936  if (pcTmpCU && bParMerge)
     5937  {
     5938    if (!pcTmpCU->isDiffMER(xP -1, yP+nPSH-1, xP, yP))
     5939    {
     5940      pcTmpCU = NULL;
     5941    }
     5942  }
     5943#endif
     5944
     5945#if !QC_SIMPLE_NBDV_B0047
     5946  pcCULeft = pcTmpCU;
     5947  UInt uiLeftPartIdx = uiIdx;
     5948#endif
     5949
     5950  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
     5951  {
     5952    bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
     5953    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     5954    {
     5955      eRefPicList = RefPicList(iList);
     5956      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
     5957      if( refId >= 0)
     5958      {
     5959        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
     5960        if (refViewIdx != m_pcSlice->getViewId()) // DCP
     5961        {
     5962          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     5963          clipMv(cMvPred);
     5964#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     5965          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     5966          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5967#else
     5968          {
     5969            TComPic* picDepth = NULL;
     5970            picDepth = getSlice()->getRefPicBaseDepth();
     5971            if (picDepth && bDepthRefine)
     5972              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
     5973            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     5974            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5975          }
     5976#endif
     5977          return;
     5978        }
     5979        else // MCP
     5980        {
     5981          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     5982          if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
     5983          {
     5984            aiDvMcpDvCand[iList][DVFROM_LEFT] = cTmpMvPred.m_iDvMcpDispX;
     5985            abDvMcpFlag  [iList][DVFROM_LEFT] = true;
     5986            bDvMcpIsFound = true;
     5987          }
     5988        }
     5989      }
     5990#if MERL_VSP_C0152
     5991      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
     5992      {
     5993        TComPic* picDepth = NULL;
     5994        TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
     5995        picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
     5996        if (picDepth && bDepthRefine)
     5997          estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
     5998        myMv.setVer(0);
     5999
     6000        pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
     6001        pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
     6002        return;
     6003      }
     6004#endif
     6005    }
     6006  }
     6007
     6008#if MVP_AT_ENTROPYSLICE_BOUNDARY
     6009  pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT, true, false, true);
     6010#else
     6011  pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT);
     6012#endif
     6013#if DV_DERIVATION_PARALLEL_B0096
     6014  if ( uiPartIdx == 1 && (eCUMode == SIZE_2NxN || eCUMode == SIZE_2NxnU || eCUMode == SIZE_2NxnD) )
     6015  {
     6016    pcTmpCU = NULL;
     6017  }
     6018#endif
     6019#if LGE_IVMP_PARALLEL_MERGE_B0136
     6020  if (pcTmpCU && bParMerge)
     6021  {
     6022    if (!pcTmpCU->isDiffMER(xP+nPSW-1, yP-1, xP, yP))
     6023    {
     6024      pcTmpCU = NULL;
     6025    }
     6026  }
     6027#endif
     6028
     6029  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
     6030  {
     6031#if LGE_DVMCP_MEM_REDUCTION_B0135
     6032    iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
     6033#endif
     6034    bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
     6035    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     6036    {
     6037      eRefPicList = RefPicList(iList);
     6038      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
     6039      if( refId >= 0)
     6040      {
     6041        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
     6042        if (refViewIdx!= m_pcSlice->getViewId())
     6043        {
     6044          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     6045          clipMv(cMvPred);
     6046#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     6047          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     6048          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     6049#else
     6050          {
     6051            TComPic* picDepth = NULL;
     6052            picDepth = getSlice()->getRefPicBaseDepth();
     6053            if (picDepth && bDepthRefine)
     6054              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
     6055            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     6056            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     6057          }
     6058#endif
     6059          return;
     6060        }
     6061#if LGE_DVMCP_MEM_REDUCTION_B0135
     6062        else if(iLCUAddrDiff == 0) //MCP, within same LCU
     6063#else
     6064        else // MCP
     6065#endif
     6066        {
     6067          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     6068          if( cTmpMvPred.m_bDvMcp  && bTmpIsSkipped )
     6069          {
     6070            aiDvMcpDvCand[iList][DVFROM_ABOVE] = cTmpMvPred.m_iDvMcpDispX;
     6071            abDvMcpFlag  [iList][DVFROM_ABOVE] = true;
     6072            bDvMcpIsFound = true;
     6073          }
     6074        }
     6075      }
     6076#if MERL_VSP_C0152
     6077      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
     6078      {
     6079        TComPic* picDepth = NULL;
     6080        TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
     6081        picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
     6082        if (picDepth && bDepthRefine)
     6083          estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
     6084        myMv.setVer(0);
     6085
     6086        pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
     6087        pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
     6088        return;
     6089      }
     6090#endif
     6091    }
     6092  }
     6093
     6094#if MVP_AT_ENTROPYSLICE_BOUNDARY
     6095  pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, false, true);
     6096#else
     6097  pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, true, true);
     6098#endif
     6099#if LGE_IVMP_PARALLEL_MERGE_B0136
     6100  if (pcTmpCU && bParMerge)
     6101  {
     6102    if (!pcTmpCU->isDiffMER(xP+nPSW, yP-1, xP, yP))
     6103    {
     6104      pcTmpCU = NULL;
     6105    }
     6106  }
     6107#endif
     6108
     6109  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
     6110  {
     6111#if LGE_DVMCP_MEM_REDUCTION_B0135
     6112    iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
     6113#endif
     6114    bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
     6115    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     6116    {
     6117      eRefPicList = RefPicList(iList);
     6118      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
     6119      if( refId >= 0)
     6120      {
     6121        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
     6122        if (refViewIdx!= m_pcSlice->getViewId())
     6123        {
     6124          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     6125          clipMv(cMvPred);
     6126#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     6127          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     6128          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     6129#else
     6130          {
     6131            TComPic* picDepth = NULL;
     6132            picDepth = getSlice()->getRefPicBaseDepth();
     6133            if (picDepth && bDepthRefine)
     6134              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
     6135            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     6136            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     6137          }
     6138#endif
     6139          return;
     6140        }
     6141#if LGE_DVMCP_MEM_REDUCTION_B0135
     6142        else if(iLCUAddrDiff == 0)
     6143#else
     6144        else  // MCP
     6145#endif
     6146        {
     6147          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     6148          if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
     6149          {
     6150            aiDvMcpDvCand[iList][DVFROM_ABOVERIGHT] = cTmpMvPred.m_iDvMcpDispX;
     6151            abDvMcpFlag  [iList][DVFROM_ABOVERIGHT] = true;
     6152            bDvMcpIsFound = true;
     6153          }
     6154        }
     6155      }
     6156#if MERL_VSP_C0152
     6157      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
     6158      {
     6159        TComPic* picDepth = NULL;
     6160        TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
     6161        picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
     6162        if (picDepth && bDepthRefine)
     6163          estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
     6164        myMv.setVer(0);
     6165
     6166        pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
     6167        pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
     6168        return;
     6169      }
     6170#endif
     6171    }
     6172  }
     6173
     6174#if MVP_AT_ENTROPYSLICE_BOUNDARY
     6175  pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true, false);
     6176#else
     6177  pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB);
     6178#endif
     6179#if LGE_IVMP_PARALLEL_MERGE_B0136
     6180  if (pcTmpCU && bParMerge)
     6181  {
     6182    if (!pcTmpCU->isDiffMER(xP-1, yP+nPSH, xP, yP))
     6183    {
     6184      pcTmpCU = NULL;
     6185    }
     6186  }
     6187#endif
     6188  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
     6189  {
     6190    bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
     6191    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     6192    {
     6193      eRefPicList = RefPicList(iList);
     6194      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
     6195      if( refId >= 0)
     6196      {
     6197        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
     6198        if (refViewIdx!= m_pcSlice->getViewId())
     6199        {
     6200          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     6201          clipMv(cMvPred);
     6202#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     6203          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     6204          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     6205#else
     6206          {
     6207            TComPic* picDepth = NULL;
     6208            picDepth = getSlice()->getRefPicBaseDepth();
     6209            if (picDepth && bDepthRefine)
     6210              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
     6211            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     6212            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     6213          }
     6214#endif
     6215          return;
     6216        }
     6217        else // MCP
     6218        {
     6219          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     6220          if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
     6221          {
     6222            aiDvMcpDvCand[iList][DVFROM_LEFTBELOW] = cTmpMvPred.m_iDvMcpDispX;
     6223            abDvMcpFlag  [iList][DVFROM_LEFTBELOW] = true;
     6224            bDvMcpIsFound = true;
     6225          }
     6226        }
     6227      }
     6228#if MERL_VSP_C0152
     6229      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
     6230      {
     6231        TComPic* picDepth = NULL;
     6232        TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
     6233        picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
     6234        if (picDepth && bDepthRefine)
     6235          estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
     6236        myMv.setVer(0);
     6237
     6238        pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
     6239        pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
     6240        return;
     6241      }
     6242#endif
     6243    }
     6244  }
     6245
     6246  // Above predictor search
     6247#if MVP_AT_ENTROPYSLICE_BOUNDARY
     6248  pcTmpCU = getPUAboveLeft(uiIdx, (m_uiAbsIdxInLCU + uiPartAddr), true, false, true);
     6249  assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr));
     6250#else
     6251  pcTmpCU = getPUAboveLeft(uiIdx, uiPartIdxLT, true, true, true);
     6252#endif
     6253#if LGE_IVMP_PARALLEL_MERGE_B0136
     6254  if (pcTmpCU && bParMerge)
     6255  {
     6256    if (!pcTmpCU->isDiffMER(xP-1, yP-1, xP, yP))
     6257    {
     6258      pcTmpCU = NULL;
     6259    }
     6260  }
     6261#endif
     6262
     6263  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
     6264  {
     6265#if LGE_DVMCP_MEM_REDUCTION_B0135
     6266    iLCUAddrDiff = getAddr() - pcTmpCU->getAddr();
     6267#endif
     6268    bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
     6269    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     6270    {
     6271      eRefPicList = RefPicList(iList);
     6272      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
     6273      if( refId >= 0)
     6274      {
     6275        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
     6276        if (refViewIdx!= m_pcSlice->getViewId())
     6277        {
     6278          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     6279          clipMv(cMvPred);
     6280#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     6281          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     6282          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     6283#else
     6284          {
     6285            TComPic* picDepth = NULL;
     6286            picDepth = getSlice()->getRefPicBaseDepth();
     6287            if (picDepth && bDepthRefine)
     6288              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
     6289            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     6290            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     6291          }
     6292#endif
     6293          return;
     6294        }
     6295#if LGE_DVMCP_MEM_REDUCTION_B0135
     6296        else if(iLCUAddrDiff <= 1)
     6297#else
     6298        else // MCP
     6299#endif
     6300        {
     6301          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     6302          if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
     6303          {
     6304            aiDvMcpDvCand[iList][DVFROM_ABOVELEFT] = cTmpMvPred.m_iDvMcpDispX;
     6305            abDvMcpFlag  [iList][DVFROM_ABOVELEFT] = true;
     6306            bDvMcpIsFound = true;
     6307          }
     6308        }
     6309      }
     6310#if MERL_VSP_C0152
     6311      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
     6312      {
     6313        TComPic* picDepth = NULL;
     6314        TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
     6315        picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
     6316        if (picDepth && bDepthRefine)
     6317          estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
     6318        myMv.setVer(0);
     6319
     6320        pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
     6321        pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
     6322        return;
     6323      }
     6324#endif
     6325    }
     6326  }
     6327#if !MTK_SAIT_TEMPORAL_FIRST_ORDER
     6328  // copied from getInterMergeCand()
     6329  if ( getSlice()->getPPS()->getEnableTMVPFlag() )
     6330  {
     6331#if !QC_SIMPLE_NBDV_B0047
     6332    UInt uiPUIdx = uiPartIdx;
     6333    UInt uiAbsPartAddr = uiPartAddr;
     6334
     6335    // col [2]
     6336    Int iRefIdxSkip[2] = {-1, -1};
     6337    if( !bMerge )
     6338    {
     6339      iRefIdxSkip[ eRefPicList0 ] = iRefIdx0;
     6340    }
     6341    else
     6342    {
     6343      for (Int i=0; i<2; i++)
     6344      {
     6345        RefPicList  eRefPicList1 = ( i==1 ? REF_PIC_LIST_1 : REF_PIC_LIST_0 );
     6346#if SET_MERGE_TMVP_REFIDX
     6347        Int iRefIdxTmp;
     6348        if ( uiPUIdx != 0 )
     6349        {
     6350          iRefIdxTmp = 0;
     6351        }
     6352        else
     6353        {   
     6354          iRefIdxTmp = (pcCULeft != NULL) ? pcCULeft->getCUMvField(eRefPicList1)->getRefIdx(uiLeftPartIdx) : -1;
     6355        }
     6356#else     
     6357        Int iRefIdxTmp = (pcCULeft != NULL) ? pcCULeft->getCUMvField(eRefPicList1)->getRefIdx(uiLeftPartIdx) : -1;
     6358#endif
     6359        iRefIdxSkip[i] = (iRefIdxTmp != -1) ? iRefIdxTmp : 0;
     6360      }
     6361    }
     6362
     6363    //>> MTK colocated-RightBottom
     6364    UInt uiPartIdxRB;
     6365    Int uiLCUIdx = getAddr();
     6366    eCUMode = getPartitionSize( 0 );
     6367
     6368    deriveRightBottomIdx( eCUMode, uiPUIdx, uiPartIdxRB ); 
     6369
     6370    UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];
     6371    //UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();
     6372
     6373    TComMv cColMv;
     6374    Int iRefIdx;
     6375
     6376    if      ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )  // image boundary check
     6377    {
     6378      uiLCUIdx = -1;
     6379    }
     6380    else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
     6381    {
     6382      uiLCUIdx = -1;
     6383    }
     6384    else
     6385    {
     6386      if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) &&           // is not at the last column of LCU
     6387        ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row    of LCU
     6388      {
     6389        uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ];
     6390        uiLCUIdx = getAddr();
     6391      }
     6392      else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 )           // is not at the last column of LCU But is last row of LCU
     6393      {
     6394        uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ];
     6395        uiLCUIdx = -1 ;
     6396      }
     6397      else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
     6398      {
     6399        uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ];
     6400        uiLCUIdx = getAddr() + 1;
     6401      }
     6402      else //is the right bottom corner of LCU                       
     6403      {
     6404        uiAbsPartAddr = 0;
     6405        uiLCUIdx = -1 ;
     6406      }
     6407    }
     6408
     6409    Bool bExistMV = false;
     6410    UInt uiPartIdxCenter;
     6411    UInt uiCurLCUIdx = getAddr();
     6412    xDeriveCenterIdx( eCUMode, uiPUIdx, uiPartIdxCenter );
     6413
     6414    Int iTargetView, iStartView;
     6415    if( !bMerge ) // AMVP
     6416    {
     6417      bExistMV = uiLCUIdx >= 0 && xGetColDisMV( eRefPicList0, iRefIdx0, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetView, iStartView );
     6418      if( bExistMV == false )
     6419      {
     6420        bExistMV = xGetColDisMV( eRefPicList0, iRefIdx0, uiCurLCUIdx, uiPartIdxCenter, cColMv, iTargetView, iStartView );
     6421      }
     6422      if( bExistMV ) // DV is found
     6423      {
     6424        if( cColMv.m_bDvMcp == false ) //=> DCP, if true => DV-MCP
     6425        {
     6426          clipMv(cColMv);
     6427          pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     6428          pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetView;
     6429          return;
     6430        }
     6431        else // DV-MCP
     6432        {
     6433          aiDvMcpDvCand[eRefPicList0][DVFROM_COL] = cColMv.getHor();
     6434          abDvMcpFlag  [eRefPicList0][DVFROM_COL] = true;
     6435          bDvMcpIsFound = true;
     6436        }
     6437      }
     6438    }
     6439    else // MERGE
     6440    {
     6441      iRefIdx = iRefIdxSkip[0];
     6442      bExistMV = uiLCUIdx >= 0 && xGetColDisMV( REF_PIC_LIST_0, iRefIdx, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetView, iStartView );
     6443      if( bExistMV == false )
     6444      {
     6445        bExistMV = xGetColDisMV( REF_PIC_LIST_0, iRefIdx, uiCurLCUIdx, uiPartIdxCenter,  cColMv, iTargetView, iStartView );
     6446      }
     6447      if( bExistMV )
     6448      {
     6449        if( cColMv.m_bDvMcp == false ) // DCP
     6450        {
     6451          clipMv(cColMv);
     6452          pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     6453          pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetView;
     6454          return;
     6455        }
     6456        else { // // DV-MCP
     6457          aiDvMcpDvCand[0][DVFROM_COL] = cColMv.getHor();
     6458          abDvMcpFlag  [0][DVFROM_COL] = true;
     6459          bDvMcpIsFound = true;
     6460        };
     6461
     6462        if ( getSlice()->isInterB() )
     6463        {       
     6464          iRefIdx = iRefIdxSkip[1];
     6465          bExistMV = uiLCUIdx >= 0 && xGetColDisMV( REF_PIC_LIST_1, iRefIdx, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetView, iStartView );
     6466          if( bExistMV == false )
     6467          {
     6468            bExistMV = xGetColDisMV( REF_PIC_LIST_1, iRefIdx, uiCurLCUIdx, uiPartIdxCenter,  cColMv, iTargetView, iStartView );
     6469          }
     6470          if( bExistMV )
     6471          {
     6472            if( cColMv.m_bDvMcp == false ) // DCP
     6473            {
     6474              clipMv(cColMv);
     6475              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     6476              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetView;
     6477              return;
     6478            }
     6479            else // DV-MCP
     6480            {
     6481              aiDvMcpDvCand[1][DVFROM_COL] = cColMv.getHor();
     6482              abDvMcpFlag  [1][DVFROM_COL] = true;
     6483              bDvMcpIsFound = true;
     6484            };
     6485          }
     6486        }
     6487      }
     6488    }
     6489#else
     6490    TComMv cColMv;
     6491    Int iTargetViewIdx = 0;
     6492    Int iTStartViewIdx = 0;
     6493    UInt uiPartIdxRB, uiBRIdx;
     6494    Int uiViewIdxCurr= getSlice()->getViewId();
     6495    UInt uiPartIdxCenter;
     6496    xDeriveCenterIdx( eCUMode, uiPartIdx, uiPartIdxCenter );
     6497
     6498    Int uiLCUIdx = getAddr();
     6499    Int uiLCUnew = uiLCUIdx;
     6500    eCUMode = getPartitionSize( 0 );
     6501    deriveRightBottomIdx( eCUMode, uiPartIdx, uiPartIdxRB ); 
     6502    uiBRIdx = uiPartIdxLT;
     6503    UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];
     6504    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
     6505    {
     6506      if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) &&           // is not at the last column of LCU
     6507      ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row    of LCU
     6508      {
     6509        uiBRIdx = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ];
     6510      }
     6511      else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 )           // is not at the last column of LCU But is last row of LCU
     6512      {
     6513        uiBRIdx = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ];
     6514        uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU();
     6515      }
     6516      else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
     6517      {
     6518        uiBRIdx = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ];
     6519        uiLCUnew = uiLCUIdx + 1;
     6520      }
     6521      else //is the right bottom corner of LCU                       
     6522      {
     6523        uiBRIdx = 0;
     6524        uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU() + 1;
     6525      }
     6526    }
     6527    const Int iNumofCandPic = 2;
     6528    for(Int i =0; i < iNumofCandPic; i++)
     6529    {
     6530      Int lpRef=0;
     6531      if(i == 0)
     6532      {   //check the col-located picture
     6533        eRefPicList = RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0);
     6534#if COLLOCATED_REF_IDX
     6535        lpRef = getSlice()->getColRefIdx();
     6536#else
     6537        Int lpRef = 0;
     6538#endif
     6539      }
     6540      else
     6541      {
     6542        if(!(getPic()->getRapbCheck()))
     6543          break;
     6544        eRefPicList=getPic()->getRapRefList();
     6545        lpRef=getPic()->getRapRefIdx();
     6546      }
     6547
     6548      if( m_pcSlice->getViewId() == getSlice()->getRefPic( eRefPicList, lpRef)->getViewId() )
     6549      {
     6550        if (uiViewIdxCurr > 1) 
     6551        {
     6552          if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) )
     6553          {
     6554            clipMv(cColMv);
     6555#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     6556            pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     6557            pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     6558#else
     6559            {
     6560              TComPic* picDepth = NULL;
     6561              picDepth = getSlice()->getRefPicBaseDepth();
     6562              if (picDepth && bDepthRefine)
     6563                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
     6564
     6565              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     6566              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     6567            }
     6568#endif
     6569            return ;
     6570          }
     6571        }
     6572
     6573        if(xGetColDisMV( eRefPicList, lpRef, uiLCUIdx, uiPartIdxCenter,  cColMv, iTargetViewIdx, iTStartViewIdx ))
     6574        {
     6575          clipMv(cColMv);
     6576#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     6577            pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     6578            pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     6579#else
     6580            {
     6581              TComPic* picDepth = NULL;
     6582              picDepth = getSlice()->getRefPicBaseDepth();
     6583              if (picDepth && bDepthRefine)
     6584                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
     6585              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     6586              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     6587            }
     6588#endif
     6589          return ;
     6590        }
     6591        if(uiViewIdxCurr == 1) 
     6592        {
     6593          if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) )
     6594          {
     6595            clipMv(cColMv);
     6596#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     6597            pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     6598            pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     6599#else
     6600            {
     6601              TComPic* picDepth = NULL;
     6602              picDepth = getSlice()->getRefPicBaseDepth();
     6603              if (picDepth && bDepthRefine)
     6604                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
     6605              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     6606              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     6607            }
     6608#endif
     6609            return ;
     6610          }
     6611        }
     6612      }
     6613    }
     6614#endif
     6615  } // if TMVP Flag
     6616#endif
    63266617
    63276618  if( bDvMcpIsFound ) // skip dvmcp
  • branches/HTM-5.1-dev3-Mediatek/source/Lib/TLibCommon/TypeDef.h

    r233 r245  
    143143#define DV_DERIVATION_PARALLEL_B0096      1   // JCT3V-B0096, enable parallel derivation of disparity vector
    144144#define QC_SIMPLE_NBDV_B0047              1   // JCT3V-B0047
    145 
     145#define MTK_SAIT_TEMPORAL_FIRST_ORDER     1   // JCT3V-C00141/C0097
    146146///// ***** MOTION PARAMETER INHERITANCE  *********
    147147#define HHI_MPI                           1   // motion parameter inheritance from texture picture for depth map coding
Note: See TracChangeset for help on using the changeset viewer.