Ignore:
Timestamp:
16 May 2013, 16:05:31 (11 years ago)
Author:
mitsubishi-htm
Message:

-D0166 part 1, set refView selection for NBDV.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-6.2-dev2-MERL/source/Lib/TLibCommon/TComDataCU.cpp

    r399 r412  
    5555#define CHECK_ADD_YET(pcCURef,uiIdx,vspIdx) && !( (pcCURef)->getVSPIndex(uiIdx) == vspIdx && bVspMvZeroDone[vspIdx-1] )
    5656
    57 inline Void TComDataCU::xInheritVspMode( TComDataCU* pcCURef, UInt uiIdx, Bool* bVspMvZeroDone, Int iCount, Int* iVSPIndexTrue, TComMvField* pcMvFieldNeighbours, DisInfo* pDInfo )
     57inline Void TComDataCU::xInheritVspMode( TComDataCU* pcCURef, UInt uiIdx, Bool* bVspMvZeroDone, Int iCount, Int* iVSPIndexTrue, TComMvField* pcMvFieldNeighbours, DisInfo* pDInfo
     58#if MERL_VSP_NBDV_RefVId_Fix_D0166
     59    , Int*     iVSPDirTrue
     60#endif
     61    )
    5862{
    5963  Int vspIdx = (Int) pcCURef->getVSPIndex(uiIdx);
     
    6973    if (vspIdx < 4)
    7074    {
     75#if MERL_VSP_NBDV_RefVId_Fix_D0166
     76      if(pDInfo->iN > 0 )
     77      { // using derived disparity and store corresponding used reference list and ref idx
     78        iVSPDirTrue[idx] = pDInfo->m_aListIdx[0];
     79        assert(pDInfo->m_aRefIdx[0] < 0);
     80#if MTK_VSP_USING_NBDV_D0105
     81        pcMvFieldNeighbours[iCount<<1].setMvField( pDInfo->m_acMvCandNoRef[0], pDInfo->m_aRefIdx[0] );
     82#else
     83        pcMvFieldNeighbours[iCount<<1].setMvField( pDInfo->m_acMvCand[0], pDInfo->m_aRefIdx[0] );
     84#endif
     85        if ( pcCURef->getSlice()->isInterB() )
     86        {
     87#if MTK_VSP_USING_NBDV_D0105
     88          pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCandNoRef[0], pDInfo->m_aRefIdx[0] );
     89#else
     90          pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCand[0], pDInfo->m_aRefIdx[0] );
     91#endif
     92        }
     93      }
     94      else
     95      { // using the original neighboring block vsp reference list
     96        TComMv cMvPred = pcCURef->getCUMvField(REF_PIC_LIST_0)->getMv(uiIdx);
     97        Int    refId   = pcCURef->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiIdx);
     98
     99        assert(refId < 0);
     100        iVSPDirTrue[idx] = pcCURef->getVSPDir(uiIdx);
     101        pcMvFieldNeighbours[iCount<<1].setMvField( cMvPred, refId );
     102        if ( pcCURef->getSlice()->isInterB() )
     103        {
     104          pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cMvPred, refId );
     105        }
     106      }
     107
     108#else // !MERL_VSP_NBDV_RefVId_Fix_D0166
     109
    71110#if MTK_VSP_USING_NBDV_D0105
    72111      pcMvFieldNeighbours[ iCount<<1].setMvField ( pDInfo->m_acMvCandNoRef[0],  NOT_VALID );
     
    82121#endif
    83122      }
     123#endif
    84124    }
    85125  }
     
    87127
    88128inline Bool TComDataCU::xAddVspMergeCand( UChar ucVspMergePos, Int vspIdx, Bool* bVspMvZeroDone, UInt uiDepth, Bool* abCandIsInter, Int& iCount,
    89                                           UChar* puhInterDirNeighbours, TComMvField* pcMvFieldNeighbours, Int* iVSPIndexTrue, Int mrgCandIdx, DisInfo* pDInfo )
     129                                          UChar* puhInterDirNeighbours, TComMvField* pcMvFieldNeighbours, Int* iVSPIndexTrue, Int mrgCandIdx, DisInfo* pDInfo
     130#if MERL_VSP_NBDV_RefVId_Fix_D0166
     131                                        , Int*  iVspDirTrue
     132#endif
     133                                          )
    90134{
    91135#if MTK_LGE_VSP_DEPTH_OFF_D0105_D0139
     
    99143  TComPic* pRefPicBaseDepth = NULL;
    100144  pRefPicBaseDepth = getSlice()->getRefPicBaseDepth();
    101   if(ucVspMergePos == VSP_MERGE_POS && pRefPicBaseDepth) //VSP can be used only when depth is used as input
     145  if(ucVspMergePos == VSP_MERGE_POS && pRefPicBaseDepth) // VSP can be used only when depth is used as input
    102146#else
    103147  if( ucVspMergePos == VSP_MERGE_POS )
     
    120164          if (vspIdx < 4) // spatial
    121165          {
     166#if MERL_VSP_NBDV_RefVId_Fix_D0166
     167            assert(pDInfo->m_aRefIdx[0] < 0);
     168            iVspDirTrue[idx] = pDInfo->m_aListIdx[0];
     169
     170#if MTK_VSP_USING_NBDV_D0105
     171            pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCandNoRef[0], pDInfo->m_aRefIdx[0] );
     172#else
     173            pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCand[0], pDInfo->m_aRefIdx[0] );
     174#endif
     175            if ( getSlice()->isInterB() )
     176            {
     177#if MTK_VSP_USING_NBDV_D0105
     178              pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCandNoRef[0], pDInfo->m_aRefIdx[0] );
     179#else
     180              pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCand[0], pDInfo->m_aRefIdx[0] );
     181#endif
     182            }
     183
     184#else
     185
    122186#if MTK_VSP_USING_NBDV_D0105
    123187            pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCandNoRef[0], NOT_VALID );
     
    133197#endif
    134198            }
     199#endif
    135200          }
    136201          iVSPIndexTrue[idx] = iCount;
     
    178243#if MERL_VSP_C0152
    179244  m_piVSPIndex         = NULL;
     245#if MERL_VSP_NBDV_RefVId_Fix_D0166
     246  m_piVSPDir           = NULL;
     247#endif
    180248#endif
    181249  m_puhLumaIntraDir    = NULL;
     
    323391#if MERL_VSP_C0152
    324392    m_piVSPIndex         = (Char*  )xMalloc(Char,   uiNumPartition);
     393#if MERL_VSP_NBDV_RefVId_Fix_D0166
     394    m_piVSPDir           = (Char*  )xMalloc(Char,   uiNumPartition);
     395#endif
    325396#endif
    326397#if H3D_IVRP
     
    483554#if MERL_VSP_C0152
    484555    if ( m_piVSPIndex         ) { xFree(m_piVSPIndex);          m_piVSPIndex        = NULL; }
     556#if MERL_VSP_NBDV_RefVId_Fix_D0166
     557    if ( m_piVSPDir           ) { xFree(m_piVSPDir  );          m_piVSPDir          = NULL; }
     558#endif
    485559#endif
    486560    if ( m_puhMergeIndex      ) { xFree(m_puhMergeIndex);       m_puhMergeIndex     = NULL; }
     
    688762#if MERL_VSP_C0152
    689763    m_piVSPIndex[ui] = pcFrom->m_piVSPIndex[ui];
     764#if MERL_VSP_NBDV_RefVId_Fix_D0166
     765    m_piVSPDir  [ui] = pcFrom->m_piVSPDir  [ui];
     766#endif
    690767#endif
    691768    m_puhLumaIntraDir[ui]=pcFrom->m_puhLumaIntraDir[ui];
     
    731808#if MERL_VSP_C0152
    732809    memset( m_piVSPIndex        + firstElement, 0,                        numElements * sizeof( *m_piVSPIndex ) );
     810#if MERL_VSP_NBDV_RefVId_Fix_D0166
     811    memset( m_piVSPDir          + firstElement, 0,                        numElements * sizeof( *m_piVSPDir   ) );
     812#endif
    733813#endif
    734814    memset( m_puhLumaIntraDir   + firstElement, 2,                        numElements * sizeof( *m_puhLumaIntraDir ) );
     
    908988#if MERL_VSP_C0152
    909989      m_piVSPIndex[ui] = 0;
     990#if MERL_VSP_NBDV_RefVId_Fix_D0166
     991      m_piVSPDir  [ui] = 0;
     992#endif
    910993#endif
    911994#if H3D_IVRP
     
    10221105#if MERL_VSP_C0152
    10231106  memset( m_piVSPIndex,         0, iSizeInChar );
     1107#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1108  memset( m_piVSPDir  ,         0, iSizeInChar );
     1109#endif
    10241110#endif
    10251111#if H3D_IVRP
     
    11131199#if MERL_VSP_C0152
    11141200      m_piVSPIndex[ui]=pcCU->m_piVSPIndex[uiPartOffset+ui];
     1201#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1202      m_piVSPDir  [ui]=pcCU->m_piVSPDir  [uiPartOffset+ui];
     1203#endif
    11151204#endif
    11161205      m_puhLumaIntraDir[ui]=pcCU->m_puhLumaIntraDir[uiPartOffset+ui];
     
    12661355#if MERL_VSP_C0152
    12671356  m_piVSPIndex          = pcCU->getVSPIndex()         + uiPart;
     1357#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1358  m_piVSPDir            = pcCU->getVSPDir  ()         + uiPart;
     1359#endif
    12681360#endif
    12691361#if H3D_IVRP
     
    14371529#if MERL_VSP_C0152
    14381530  m_piVSPIndex         = pcCU->getVSPIndex()              + uiAbsPartIdx;
     1531#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1532  m_piVSPDir           = pcCU->getVSPDir  ()              + uiAbsPartIdx;
     1533#endif
    14391534#endif
    14401535#if H3D_IVRP
     
    14991594#if MERL_VSP_C0152
    15001595  memcpy( m_piVSPIndex          + uiOffset, pcCU->getVSPIndex(),          iSizeInChar );
     1596#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1597  memcpy( m_piVSPDir            + uiOffset, pcCU->getVSPDir  (),          iSizeInChar );
     1598#endif
    15011599#endif
    15021600#if H3D_IVRP
     
    16481746#if MERL_VSP_C0152
    16491747  memcpy( rpcCU->getVSPIndex()          + m_uiAbsIdxInLCU, m_piVSPIndex,         iSizeInChar );
     1748#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1749  memcpy( rpcCU->getVSPDir  ()           + m_uiAbsIdxInLCU, m_piVSPDir  ,         iSizeInChar );
     1750#endif
    16501751#endif
    16511752#if H3D_IVRP
     
    17811882  memcpy( rpcCU->getMergeIndex()        + uiPartOffset, m_puhMergeIndex,       iSizeInUchar );
    17821883#if MERL_VSP_C0152
    1783   memcpy( rpcCU->getVSPIndex()          + uiPartOffset, m_piVSPIndex,         iSizeInChar );
     1884  memcpy( rpcCU->getVSPIndex()          + uiPartOffset, m_piVSPIndex,          iSizeInChar );
     1885#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1886  memcpy( rpcCU->getVSPDir  ()           + uiPartOffset, m_piVSPDir  ,         iSizeInChar );
     1887#endif
    17841888#endif
    17851889#if H3D_IVRP
     
    30793183  setSubPart<Char>( iVSPIdx, m_piVSPIndex, uiAbsPartIdx, uiDepth, uiPartIdx );
    30803184}
    3081 #endif
     3185
     3186#if MERL_VSP_NBDV_RefVId_Fix_D0166
     3187Void TComDataCU::setVSPDirSubParts ( Char iVSPDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
     3188{
     3189  setSubPart<Char>( iVSPDir, m_piVSPDir, uiAbsPartIdx, uiDepth, uiPartIdx );
     3190}
     3191#endif
     3192
     3193#endif // MERL_VSP_C0152
    30823194
    30833195#if H3D_IVRP
     
    36613773 */
    36623774#if MERL_VSP_C0152
    3663 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int* iVSPIndexTrue, Int mrgCandIdx )
     3775Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int* iVSPIndexTrue
     3776#if MERL_VSP_NBDV_RefVId_Fix_D0166
     3777        , Int* iVSPDirTrue
     3778#endif
     3779        , Int mrgCandIdx )
    36643780#else
    36653781Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx )
     
    37243840#if H3D_NBDV
    37253841  DisInfo cDisInfo;
     3842#if MERL_VSP_NBDV_RefVId_Fix_D0166
     3843  cDisInfo.bDV = false; // default setting
     3844  cDisInfo.iN  = 0;
     3845#endif
     3846
    37263847#if !QC_CU_NBDV_D0181
    37273848  cDisInfo.iN = 0;
     
    37413862      cDisInfo.m_acMvCandNoRef[0] = getDvInfo(uiAbsPartIdx).m_acMvCandNoRef[0];
    37423863#endif
     3864#if MERL_VSP_C0152
     3865#if MERL_VSP_NBDV_RefVId_Fix_D0166
     3866      cDisInfo.m_aListIdx[0] = getDvInfo(uiAbsPartIdx).m_aListIdx[0];
     3867      cDisInfo.m_aRefIdx[0] = getDvInfo(uiAbsPartIdx).m_aRefIdx[0];
     3868#endif
     3869#endif
    37433870    }
    37443871#else
     
    37503877#endif
    37513878  }
     3879 
    37523880#if FCO_DVP_REFINE_C0132_C0170
    37533881  if(getPic()->getDepthCoded() )
     
    37823910#endif
    37833911  }
     3912
     3913#if MERL_VSP_NBDV_RefVId_Fix_D0166 && !MTK_LGE_VSP_DEPTH_OFF_D0105_D0139
     3914  if (bNoPdmMerge && cDisInfo.bDV == false)
     3915  { // purely for default setting
     3916    cDisInfo.iN = 1;
     3917    cDisInfo.m_acMvCand[0].setHor(0);
     3918    cDisInfo.m_acMvCand[0].setVer(0);
     3919    cDisInfo.m_acMvCandNoRef[0].setHor(0);
     3920    cDisInfo.m_acMvCandNoRef[0].setVer(0);
     3921    cDisInfo.m_aVIdxCan[0] = 0;
     3922
     3923    RefPicList eRefPicList = REF_PIC_LIST_0 ;
     3924    Int refFrmIdx = 0;
     3925    getRefListAndRefFrmIdx(0, eRefPicList, refFrmIdx);
     3926    cDisInfo.m_aListIdx[0] = eRefPicList;
     3927    cDisInfo.m_aRefIdx [0] = -1-refFrmIdx;
     3928   }
     3929#endif
    37843930
    37853931#if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137
     
    38503996#if MERL_VSP_C0152
    38513997#if !MTK_LGE_VSP_DEPTH_OFF_D0105_D0139
    3852       xInheritVspMode( pcTextureCU, uiPartIdxCenter, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     3998      xInheritVspMode( pcTextureCU, uiPartIdxCenter, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo
     3999#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4000         , iVSPDirTrue
     4001#endif
     4002        ) ;
    38534003#endif
    38544004#endif
     
    39234073  } 
    39244074 
    3925 #endif //  H3D_IVMP 
     4075#endif //  H3D_IVMP
    39264076
    39274077#if MERL_VSP_COMPENSATION_C0152
    39284078  //===== vsp 0 =====
    39294079  if( iCount < 4 + extraMergeCand )
    3930     if ( !xAddVspMergeCand(0, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
     4080    if ( !xAddVspMergeCand(0, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo
     4081#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4082            , iVSPDirTrue
     4083#endif
     4084            )
     4085       )
    39314086      return;
    39324087#endif
     
    39964151#endif
    39974152#if MERL_VSP_C0152
    3998         xInheritVspMode( pcCULeft, uiLeftPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     4153        xInheritVspMode( pcCULeft, uiLeftPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo
     4154#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4155         , iVSPDirTrue
     4156#endif
     4157                );
    39994158#endif
    40004159        if ( mrgCandIdx == iCount )
     
    40694228#endif
    40704229#if MERL_VSP_C0152
    4071      xInheritVspMode( pcCUAbove, uiAbovePartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     4230     xInheritVspMode( pcCUAbove, uiAbovePartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo
     4231#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4232       , iVSPDirTrue
     4233#endif
     4234             ) ;
    40724235#endif
    40734236    if ( mrgCandIdx == iCount )
     
    41184281#endif
    41194282#if MERL_VSP_C0152
    4120     xInheritVspMode( pcCUAboveRight, uiAboveRightPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     4283    xInheritVspMode( pcCUAboveRight, uiAboveRightPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo
     4284#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4285       , iVSPDirTrue
     4286#endif
     4287            ) ;
    41214288#endif
    41224289    if ( mrgCandIdx == iCount )
     
    41764343#endif // H3D_IVMP
    41774344
    4178 
    41794345  //left bottom
    41804346  UInt uiLeftBottomPartIdx = 0;
     
    42144380#endif
    42154381#if MERL_VSP_C0152
    4216      xInheritVspMode( pcCULeftBottom, uiLeftBottomPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     4382     xInheritVspMode( pcCULeftBottom, uiLeftBottomPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo
     4383#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4384       , iVSPDirTrue
     4385#endif
     4386             ) ;
    42174387#endif
    42184388    if ( mrgCandIdx == iCount )
     
    42224392    iCount ++;
    42234393  }
    4224  
    4225  
     4394
    42264395  // above left
    42274396#if H3D_IVMP
     
    42694438#endif
    42704439#if MERL_VSP_C0152
    4271      xInheritVspMode( pcCUAboveLeft, uiAboveLeftPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     4440     xInheritVspMode( pcCUAboveLeft, uiAboveLeftPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo
     4441#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4442       , iVSPDirTrue
     4443#endif
     4444             ) ;
    42724445#endif
    42734446      if ( mrgCandIdx == iCount )
     
    42824455  //===== vsp 5 =====
    42834456  if( iCount < 4 + extraMergeCand )
    4284     if ( !xAddVspMergeCand(5, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
     4457    if ( !xAddVspMergeCand(5, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo
     4458#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4459         , iVSPDirTrue
     4460#endif
     4461            ) )
    42854462      return;
    42864463#endif
     
    51505327  return iDisp;
    51515328}
    5152 Void TComDataCU::estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred, Bool bSimpleDvpRefine)
     5329
     5330Void TComDataCU::estimateDVFromDM(
     5331#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5332          Int refViewIdx,
     5333#endif
     5334          UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred, Bool bSimpleDvpRefine)
    51535335{
    51545336  if (picDepth)
     
    51645346    Int  iShiftPrec;
    51655347
    5166     getSlice()->getBWVSPLUTParam(aiShiftLUT, iShiftPrec);
     5348    getSlice()->getBWVSPLUTParam(aiShiftLUT, iShiftPrec
     5349#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5350            , refViewIdx
     5351#endif
     5352            );
    51675353
    51685354    Pel iDisp = getMcpFromDM( pcBaseViewDepthPicYuv, cMvPred, iBlkX, iBlkY, iWidth, iHeight, aiShiftLUT, iShiftPrec, bSimpleDvpRefine );
     
    51935379          clipMv(cMvPred);
    51945380
    5195           TComPic* picDepth = getSlice()->getRefPicBaseDepth();
     5381          TComPic* picDepth = NULL;
     5382#if MERL_VSP_C0152
     5383#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5384          Int refPOC = getSlice()->getRefPic(eRefPicList, refId)->getPOC();
     5385          picDepth = getSlice()->getDepthRefPic(refViewIdx, refPOC);
     5386          assert(refPOC == getSlice()->getPOC());
     5387          assert(picDepth != NULL);
     5388#else
     5389          picDepth = getSlice()->getRefPicBaseDepth();
     5390#endif
     5391#endif
     5392
    51965393#if QC_CU_NBDV_D0181 && MERL_VSP_C0152
    51975394          pNbDvInfo->m_acMvCandNoRef[pNbDvInfo->iN] = cMvPred;
    51985395#endif
    51995396          if (picDepth && bDepthRefine)
    5200             estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true);
    5201 
     5397            estimateDVFromDM(
     5398#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5399                    refViewIdx,
     5400#endif
     5401                    uiPartIdx, picDepth, uiPartAddr, &cMvPred, true);
     5402
     5403
     5404#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5405          pNbDvInfo->m_aListIdx[ pNbDvInfo->iN ] = eRefPicList;
     5406          pNbDvInfo->m_aRefIdx [ pNbDvInfo->iN ] = -1-refId;
     5407          assert(pNbDvInfo->m_aRefIdx [ pNbDvInfo->iN ] < 0);
     5408#endif
    52025409          pNbDvInfo->m_acMvCand[ pNbDvInfo->iN   ] = cMvPred;
    52035410          pNbDvInfo->m_aVIdxCan[ pNbDvInfo->iN++ ] = refViewIdx;
     
    52175424      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
    52185425      {
    5219         TComPic* picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
     5426        TComPic* picDepth = NULL;
     5427
     5428#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5429        RefPicList privateRefPicList = (RefPicList) pcTmpCU->getVSPDir( uiIdx );
     5430        assert(privateRefPicList == REF_PIC_LIST_0 || privateRefPicList == REF_PIC_LIST_1);
     5431        Int  refIdx = -1-pcTmpCU->getCUMvField( privateRefPicList )->getRefIdx( uiIdx ); // a trick when storing refIdx for temporal BVSP
     5432        assert(refIdx >= 0);
     5433        Int  refViewIdx = getSlice()->getRefViewId(privateRefPicList, refIdx);
     5434        Int  refPOC = getSlice()->getRefPOC(privateRefPicList, refIdx);
     5435
     5436        picDepth = getSlice()->getDepthRefPic(refViewIdx, refPOC);
     5437        assert(refPOC == getSlice()->getPOC());
     5438        assert(picDepth != NULL);
     5439#else
     5440        picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
     5441#endif
     5442
    52205443#if QC_CU_NBDV_D0181 && MERL_VSP_C0152
    52215444        pNbDvInfo->m_acMvCandNoRef[pNbDvInfo->iN] = cMvPred;
    52225445#endif
    52235446        if (picDepth && bDepthRefine)
    5224           estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
     5447          estimateDVFromDM(
     5448#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5449                  refViewIdx,
     5450#endif
     5451                  uiPartIdx, picDepth, uiPartAddr, &cMvPred);
    52255452
    52265453        cMvPred.setVer(0);
    52275454
     5455#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5456        pNbDvInfo->m_aRefIdx [ pNbDvInfo->iN ] = -1-refIdx;
     5457        pNbDvInfo->m_aListIdx[ pNbDvInfo->iN ] = privateRefPicList;
     5458        pNbDvInfo->m_acMvCand[ pNbDvInfo->iN ] = cMvPred;
     5459        pNbDvInfo->m_aVIdxCan[ pNbDvInfo->iN ] = refViewIdx;
     5460        assert(pNbDvInfo->m_aRefIdx [ pNbDvInfo->iN ] < 0);
     5461        pNbDvInfo->iN++;
     5462#else
    52285463        pNbDvInfo->m_acMvCand[ pNbDvInfo->iN]   = cMvPred;
    52295464        pNbDvInfo->m_aVIdxCan[ pNbDvInfo->iN++] = 0; // refViewIdx;
     5465#endif
    52305466        return true;
    52315467      }
     
    52815517  }
    52825518}
     5519
     5520#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5521Bool TComDataCU::getRefListAndRefFrmIdx(Int targetRefViewIdx, RefPicList& eRefPicList, Int& refFrmIdx)
     5522{
     5523  Bool isFound  = false;
     5524  RefPicList privateRefPicList = REF_PIC_LIST_0 ;
     5525
     5526  refFrmIdx = 0;
     5527  for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1) && isFound == false; iList++)
     5528  {
     5529    privateRefPicList = RefPicList(iList);
     5530    for (Int refIdx = 0; refIdx < getSlice()->getNumRefIdx(privateRefPicList); refIdx++)
     5531    {
     5532      Int refViewIdx  = getSlice()->getRefViewId( privateRefPicList, refIdx);
     5533      if ( refViewIdx == targetRefViewIdx)
     5534      {
     5535        refFrmIdx = refIdx;
     5536        eRefPicList = privateRefPicList;
     5537        isFound = true;
     5538        break;
     5539      }
     5540    }
     5541  }
     5542
     5543  return isFound;
     5544}
     5545#endif
    52835546
    52845547#if QC_CU_NBDV_D0181
     
    53815644          {
    53825645            clipMv(cColMv);
    5383             TComPic* picDepth = getSlice()->getRefPicBaseDepth();
     5646            TComPic* picDepth = NULL;
     5647#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5648            Int currPoc = getSlice()->getPOC();
     5649            picDepth = getSlice()->getDepthRefPic(iTargetViewIdx, currPoc);
     5650            assert(picDepth!=NULL);
     5651#else
     5652            picDepth = getSlice()->getRefPicBaseDepth();
     5653#endif
    53845654#if QC_CU_NBDV_D0181 && MERL_VSP_C0152
    53855655            pDInfo->m_acMvCandNoRef[pDInfo->iN] = cColMv;
    53865656#endif
    53875657            if (picDepth && bDepthRefine)
     5658#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5659              estimateDVFromDM(iTargetViewIdx, uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
     5660#else
    53885661              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
    5389 
    5390             pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5662#endif
     5663
     5664#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5665            Int refFrmIdx = 0;
     5666            RefPicList privateRefPicList = REF_PIC_LIST_0;
     5667            getRefListAndRefFrmIdx(iTargetViewIdx, privateRefPicList, refFrmIdx);
     5668           
     5669            pDInfo->m_aListIdx[ pDInfo->iN ]  = privateRefPicList;
     5670            pDInfo->m_aRefIdx [ pDInfo->iN ]  = -1-refFrmIdx;
     5671            assert(pDInfo->m_aRefIdx [ pDInfo->iN ] < 0);
     5672#endif
     5673            pDInfo->m_acMvCand[ pDInfo->iN ]  = cColMv;
    53915674            pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
    53925675#if QC_CU_NBDV_D0181
     
    55365819          clipMv( cDispVec );
    55375820
    5538           TComPic* picDepth = getSlice()->getRefPicBaseDepth();
     5821          TComPic* picDepth = NULL;
     5822#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5823          Int refPOC = getSlice()->getPOC();
     5824          picDepth = getSlice()->getDepthRefPic(0, refPOC);
     5825          assert(picDepth!=NULL);
     5826#else
     5827          picDepth = getSlice()->getRefPicBaseDepth();
     5828#endif
     5829
    55395830#if QC_CU_NBDV_D0181 && MERL_VSP_C0152
    55405831          pDInfo->m_acMvCandNoRef[pDInfo->iN] = cDispVec;
    55415832#endif
    55425833          if (picDepth && bDepthRefine)
     5834#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5835            estimateDVFromDM(0, uiPartIdx, picDepth, uiPartAddr, &cDispVec, true); // from base view
     5836#else
    55435837            estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cDispVec, true);
    5544 
    5545           pDInfo->m_acMvCand[ pDInfo->iN]   = cDispVec;
     5838#endif
     5839
     5840#if MERL_VSP_NBDV_RefVId_Fix_D0166 //if DVMCP is used, do a local reference frame list and idx search
     5841          Int refFrmIdx = 0;
     5842          RefPicList privateRefPicList = REF_PIC_LIST_0 ;
     5843          getRefListAndRefFrmIdx(0, privateRefPicList, refFrmIdx); // find the reference picture from base view
     5844
     5845          pDInfo->m_aListIdx[ pDInfo->iN ]  = privateRefPicList;
     5846          pDInfo->m_aRefIdx [ pDInfo->iN ]  = -1-refFrmIdx;
     5847          assert(pDInfo->m_aRefIdx [ pDInfo->iN ] < 0);
     5848#endif
     5849
     5850          pDInfo->m_acMvCand[ pDInfo->iN ]  = cDispVec;
    55465851          pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0;
    55475852#if !QC_CU_NBDV_D0181
     
    55605865    TComMv defaultDV(0, 0);
    55615866
     5867#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5868    Int refPOC = getSlice()->getPOC();
     5869    picDepth = getSlice()->getDepthRefPic(0, refPOC);
     5870    assert(picDepth!=NULL);
     5871#else
    55625872    picDepth = getSlice()->getRefPicBaseDepth();
     5873#endif
     5874
     5875#if QC_CU_NBDV_D0181 && MERL_VSP_C0152 // TODO: CHECK if the macro is right
     5876    pDInfo->m_acMvCandNoRef[pDInfo->iN] = defaultDV;
     5877#endif
    55635878
    55645879    if (picDepth && bDepthRefine)
    55655880    {
     5881#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5882      estimateDVFromDM(0, uiPartIdx, picDepth, uiPartAddr, &defaultDV, true); // from base view
     5883#else
    55665884      estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &defaultDV, true);
    5567     }
    5568 
     5885#endif
     5886    }
     5887
     5888#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5889    Int refFrmIdx = 0;
     5890    RefPicList privateRefPicList = REF_PIC_LIST_0 ;
     5891    getRefListAndRefFrmIdx(0, privateRefPicList, refFrmIdx); // find the reference picture from base view
     5892
     5893    pDInfo->m_aListIdx[ pDInfo->iN ]  = privateRefPicList;
     5894    pDInfo->m_aRefIdx [ pDInfo->iN ]  = -1-refFrmIdx;
     5895    assert(pDInfo->m_aRefIdx [ pDInfo->iN ] < 0);
     5896
     5897#endif
    55695898    pDInfo->m_acMvCand[pDInfo->iN] = defaultDV;
    55705899    pDInfo->m_aVIdxCan[pDInfo->iN] = 0;
     5900#if MERL_VSP_NBDV_RefVId_Fix_D0166  // Bug fix for Samsung code.
     5901    pDInfo->iN++;
     5902#endif
    55715903  }
    55725904#endif
     
    73547686#if MERL_VSP_C0152 && MTK_UNCONSTRAINED_MVI_B0083
    73557687  memcpy( m_piVSPIndex + uiAbsPartIdxDst,  pcCU->getVSPIndex() + uiAbsPartIdxSrc, sizeof( m_piVSPIndex[0] ) * uiNumPartition );
     7688#endif
     7689#if MERL_VSP_NBDV_RefVId_Fix_D0166
     7690  memcpy( m_piVSPDir   + uiAbsPartIdxDst,  pcCU->getVSPDir  () + uiAbsPartIdxSrc, sizeof( m_piVSPDir  [0] ) * uiNumPartition );
    73567691#endif
    73577692
Note: See TracChangeset for help on using the changeset viewer.