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

-D0166 part 1, set refView selection for NBDV.

Location:
branches/HTM-6.2-dev2-MERL/source/Lib/TLibCommon
Files:
8 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
  • branches/HTM-6.2-dev2-MERL/source/Lib/TLibCommon/TComDataCU.h

    r373 r412  
    195195                                      ///< value 0: non-VSP, value 1: VSP
    196196#endif
     197#if MERL_VSP_NBDV_RefVId_Fix_D0166
     198  Char*         m_piVSPDir;           ///< 0: LIST0; 1: LIST1
     199#endif
    197200#if AMP_MRG
    198201  Bool          m_bIsMergeAMP;
     
    280283#if MERL_VSP_C0152
    281284  inline Bool   xAddVspMergeCand      ( UChar ucVspMergePos, Int vspIdx, Bool* bVspMvZeroDone, UInt uiDepth, Bool* abCandIsInter, Int& iCount,
    282                                         UChar* puhInterDirNeighbours, TComMvField* pcMvFieldNeighbours, Int* iVSPIndexTrue, Int mrgCandIdx, DisInfo* pDisInfo );
    283   inline Void   xInheritVspMode       ( TComDataCU* pcCURef, UInt uiIdx, Bool* bVspMvZeroDone, Int iCount, Int* iVSPIndexTrue, TComMvField* pcMvFieldNeighbours, DisInfo* pDInfo ) ;
     285                                        UChar* puhInterDirNeighbours, TComMvField* pcMvFieldNeighbours, Int* iVSPIndexTrue, Int mrgCandIdx, DisInfo* pDisInfo
     286#if MERL_VSP_NBDV_RefVId_Fix_D0166
     287                                      , Int*   iVspDirTrue = NULL
     288#endif
     289                                        );
     290  inline Void   xInheritVspMode       ( TComDataCU* pcCURef, UInt uiIdx, Bool* bVspMvZeroDone, Int iCount, Int* iVSPIndexTrue, TComMvField* pcMvFieldNeighbours, DisInfo* pDInfo
     291#if MERL_VSP_NBDV_RefVId_Fix_D0166
     292    ,Int *iVSPDirTrue
     293#endif
     294    ) ;
    284295#endif
    285296  Void          deriveRightBottomIdx        ( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxRB );
     
    477488  Void          setVSPIndex        ( UInt uiIdx, Int n )     { m_piVSPIndex[uiIdx] = n;    }
    478489  Void          setVSPIndexSubParts( Char bVSPIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
     490#endif
     491#if MERL_VSP_NBDV_RefVId_Fix_D0166
     492  Char*         getVSPDir          ()                        { return m_piVSPDir;                           }
     493  Char          getVSPDir          ( UInt uiIdx )            { return m_piVSPDir[uiIdx];                  }
     494  Void          setVSPDir          ( UInt uiIdx, Int n )     { m_piVSPDir[uiIdx] = n;  }
     495  Void          setVSPDirSubParts  ( Char bVSPDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
     496  Bool          getRefListAndRefFrmIdx(Int targetRefViewIdx, RefPicList& eRefPicList, Int& refFrmIdx);
    479497#endif
    480498
     
    576594#if MERL_VSP_C0152
    577595  Pel           getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT, Int iShiftPrec, Bool bSimpleDvpRefine = false);
    578   Void          estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred, Bool bSimpleDvpRefine = false);
     596  Void          estimateDVFromDM(
     597#if MERL_VSP_NBDV_RefVId_Fix_D0166
     598                Int refViewIdx,
     599#endif
     600                UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred, Bool bSimpleDvpRefine = false);
    579601#endif
    580602  Bool          getIViewOrgDepthMvPred( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv );
     
    682704  Bool          hasEqualMotion              ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx );
    683705#if MERL_VSP_C0152
    684   Void          getInterMergeCandidates     ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int* uiVSPIndexTrue, Int mrgCandIdx = -1 );
     706  Void          getInterMergeCandidates     ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int* uiVSPIndexTrue,
     707#if MERL_VSP_NBDV_RefVId_Fix_D0166
     708                Int* iVSPDir,
     709#endif
     710                Int mrgCandIdx = -1 );
    685711#else
    686712  Void          getInterMergeCandidates     ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 );
  • branches/HTM-6.2-dev2-MERL/source/Lib/TLibCommon/TComMotionInfo.h

    r351 r412  
    7171#endif
    7272  Int    iN;                                ///< number of motion vector predictor candidates
     73#if MERL_VSP_NBDV_RefVId_Fix_D0166
     74  Int    m_aListIdx[ DIS_CANS ];            ///< array of reference list of derived NBDV
     75  Int    m_aRefIdx [ DIS_CANS ];            ///< array of reference frame index corresponding to either RefList0/1
     76#endif
    7377} DisInfo;
    7478
  • branches/HTM-6.2-dev2-MERL/source/Lib/TLibCommon/TComPrediction.cpp

    r402 r412  
    789789
    790790#if MERL_VSP_C0152
     791// Function to perform VSP block compensation
     792Void  TComPrediction::xPredInterVSPBlk(TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, TComMv cMv, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi )
     793{
     794  TComPic*    pRefPicBaseTxt        = NULL;
     795  TComPicYuv* pcBaseViewTxtPicYuv   = NULL;
     796  TComPicYuv* pcBaseViewDepthPicYuv = NULL;
     797  Int iBlkX = 0;
     798  Int iBlkY = 0;
     799  Int* pShiftLUT;
     800  Int  iShiftPrec;
     801
     802#if !MERL_VSP_NBDV_RefVId_Fix_D0166
     803  pRefPicBaseTxt        = pcCU->getSlice()->getRefPicBaseTxt();
     804  pcBaseViewTxtPicYuv   = pRefPicBaseTxt->getPicYuvRec();
     805  TComPic* pRefPicBaseDepth = pcCU->getSlice()->getRefPicBaseDepth();
     806  pcBaseViewDepthPicYuv     = pRefPicBaseDepth->getPicYuvRec();
     807
     808  Int iBlkX = ( pcCU->getAddr() % pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
     809  Int iBlkY = ( pcCU->getAddr() / pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
     810  pcCU->getSlice()->getBWVSPLUTParam(pShiftLUT, iShiftPrec);
     811  xPredInterLumaBlkFromDM  ( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX,    iBlkY,    iWidth,    iHeight,    pcCU->getSlice()->getSPS()->isDepth(), rpcYuvPred );
     812  xPredInterChromaBlkFromDM( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX>>1, iBlkY>>1, iWidth>>1, iHeight>>1, pcCU->getSlice()->getSPS()->isDepth(), rpcYuvPred );
     813
     814#else // MERL_VSP_NBDV_RefVId_Fix_D0166
     815
     816  //recover VSP reference frame according to negative refIdx number
     817  RefPicList privateRefPicList = (RefPicList) pcCU->getVSPDir( uiPartAddr );
     818  assert(privateRefPicList == REF_PIC_LIST_0 || privateRefPicList == REF_PIC_LIST_1);
     819
     820  // Step 1: get depth reference
     821  Int  refIdx = -1-pcCU->getCUMvField( privateRefPicList )->getRefIdx( uiPartAddr ); // texture ref index, a trick when storing refIdx
     822  Int  viewId = pcCU->getSlice()->getRefViewId(privateRefPicList, refIdx);  // texture view id
     823  Int  refPoc = pcCU->getSlice()->getRefPOC(privateRefPicList, refIdx);     // texture POC
     824  TComPic* pRefPicBaseDepth = pcCU->getSlice()->getDepthRefPic(viewId, refPoc);
     825
     826  pcBaseViewDepthPicYuv = pRefPicBaseDepth->getPicYuvRec();
     827  assert(refPoc == pcCU->getSlice()->getPOC());
     828  assert(pRefPicBaseDepth != NULL);
     829  assert(pcBaseViewDepthPicYuv != NULL);
     830
     831  iBlkX = ( pcCU->getAddr() % pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
     832  iBlkY = ( pcCU->getAddr() / pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
     833#if MERL_Bi_VSP_D0166
     834  // Step 2: get texture reference
     835  pRefPicBaseTxt = xGetVspRefTxt( pcCU, uiPartAddr, eRefPicList);
     836  pcBaseViewTxtPicYuv = pRefPicBaseTxt->getPicYuvRec();
     837  assert(pcBaseViewTxtPicYuv != NULL);
     838
     839  //initialize the LUT according to the reference view idx
     840  pcCU->getSlice()->getBWVSPLUTParam(pShiftLUT, iShiftPrec, pRefPicBaseTxt->getViewId());
     841
     842  // Step 3: Do compensation
     843  xPredInterLumaBlkFromDM  ( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX,    iBlkY,    iWidth,    iHeight,    pcCU->getSlice()->getSPS()->isDepth(), rpcYuvPred, bi );
     844  xPredInterChromaBlkFromDM( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX>>1, iBlkY>>1, iWidth>>1, iHeight>>1, pcCU->getSlice()->getSPS()->isDepth(), rpcYuvPred, bi );
     845#else
     846  // Step 2: get texture reference
     847  pRefPicBaseTxt = pcCU->getSlice()->getRefPic(privateRefPicList, refIdx);
     848  pcBaseViewTxtPicYuv = pRefPicBaseTxt->getPicYuvRec();
     849  assert(pcBaseViewTxtPicYuv != NULL);
     850
     851  //initialize the LUT according to the reference view idx
     852  pcCU->getSlice()->getBWVSPLUTParam(pShiftLUT, iShiftPrec, pRefPicBaseTxt->getViewId());
     853
     854  // Step 3: Do compensation
     855  xPredInterLumaBlkFromDM  ( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX,    iBlkY,    iWidth,    iHeight,    pcCU->getSlice()->getSPS()->isDepth(), rpcYuvPred );
     856  xPredInterChromaBlkFromDM( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX>>1, iBlkY>>1, iWidth>>1, iHeight>>1, pcCU->getSlice()->getSPS()->isDepth(), rpcYuvPred );
     857#endif
     858
     859#endif
     860}
     861
     862
     863
     864#if MERL_Bi_VSP_D0166
     865TComPic*  TComPrediction::xGetVspRefTxt(TComDataCU* pcCU, UInt uiPartAddr, RefPicList eRefPicList)
     866{
     867  RefPicList  privateRefPicList = (RefPicList) pcCU->getVSPDir( uiPartAddr );
     868  Int         refIdx = -1-pcCU->getCUMvField( privateRefPicList )->getRefIdx( uiPartAddr ); // texture ref index, a trick when storing refIdx
     869  Int         viewId = pcCU->getSlice()->getRefViewId(privateRefPicList, refIdx);  // texture view id
     870  TComPic*    refPic = NULL;
     871
     872  assert(privateRefPicList == REF_PIC_LIST_0 || privateRefPicList == REF_PIC_LIST_1);
     873
     874  if (privateRefPicList == eRefPicList)
     875  {
     876    Int  refIdxt = -1-pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );
     877    assert(refIdxt>= 0);
     878    refPic = pcCU->getSlice()->getRefPic(eRefPicList, refIdxt);
     879  }
     880  else
     881  {
     882    // Find the other interview reference in order to do VSP
     883    RefPicList otherRefPicList = privateRefPicList == REF_PIC_LIST_0 ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
     884    Bool IsFound = false;
     885    for (Int irefIdx = 0; irefIdx <pcCU->getSlice()->getNumRefIdx(otherRefPicList); irefIdx ++ )
     886    {
     887      Int refViewIdx  = pcCU->getSlice()->getRefViewId( otherRefPicList, irefIdx);
     888      if ( (refViewIdx != pcCU->getSlice()->getViewId()) && (refViewIdx != viewId ) )
     889      {
     890        refPic = pcCU->getSlice()->getRefPic(otherRefPicList, irefIdx);
     891        IsFound = true;
     892        break;
     893      }
     894    }
     895
     896    if (IsFound == false)
     897    {
     898      Int  refIdxtxt = -1-pcCU->getCUMvField( privateRefPicList )->getRefIdx( uiPartAddr );
     899      assert(refIdxtxt >= 0);
     900      refPic = pcCU->getSlice()->getRefPic(privateRefPicList, refIdxtxt);
     901    }
     902    assert(IsFound);
     903  }
     904  assert(refPic != NULL);
     905  return refPic;
     906}
     907#endif
     908#endif
     909
     910#if MERL_VSP_C0152
    791911Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY, Bool bi )
    792912#else
     
    829949#endif
    830950#if QC_ARP_D0177
    831   if( pcCU->getSlice()->getSPS()->isDepth() == false
     951  if(
     952#if MERL_VSP_C0152       
     953       vspIdx == 0 &&   // TODO: Maybe logically redundant, but easier to read
     954#endif
     955       pcCU->getSlice()->getSPS()->isDepth() == false
    832956    && pcCU->getSlice()->getSPS()->getViewId() > 0
    833957    && pcCU->getSlice()->getSPS()->getUseAdvRP() > 0
     
    847971#if MERL_VSP_C0152
    848972    if (vspIdx != 0)
    849     { // depth, vsp
    850       // get depth estimator here
    851       TComPic* pRefPicBaseDepth = pcCU->getSlice()->getRefPicBaseDepth();
    852       TComPicYuv* pcBaseViewDepthPicYuv = NULL;
    853       if (vspIdx < 4) // spatial
    854       {
    855         pcBaseViewDepthPicYuv = pRefPicBaseDepth->getPicYuvRec();
    856       }
    857       Int iBlkX = ( pcCU->getAddr() % pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
    858       Int iBlkY = ( pcCU->getAddr() / pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
    859       Int* pShiftLUT;
    860       Int iShiftPrec;
    861       pcCU->getSlice()->getBWVSPLUTParam(pShiftLUT, iShiftPrec);
    862       //using disparity to find the depth block of the base view as the depth block estimator of the current block
    863       //using depth block estimator and base view texture to get Backward warping
    864       xPredInterLumaBlkFromDM  ( pcBaseViewDepthPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX,    iBlkY,    iWidth,    iHeight,     pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred );
    865       xPredInterChromaBlkFromDM( pcBaseViewDepthPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX>>1, iBlkY>>1, iWidth>>1, iHeight>>1,  pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred );
     973    { // depth, vsp compensation
     974      xPredInterVSPBlk(pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, cMv, eRefPicList, rpcYuvPred, bi );
    866975    }
    867976    else
     
    886995#endif// MERL_VSP_C0152 //else
    887996  }
    888   else
     997  else  // texture
    889998  {
    890999#endif
    8911000#if MERL_VSP_C0152
    8921001    if ( vspIdx != 0 )
    893     { // texture, vsp
    894       TComPic*    pRefPicBaseTxt        = pcCU->getSlice()->getRefPicBaseTxt();
    895       TComPicYuv* pcBaseViewTxtPicYuv   = pRefPicBaseTxt->getPicYuvRec();
    896       TComPicYuv* pcBaseViewDepthPicYuv = NULL;
    897       if (vspIdx < 4) // spatial
    898       {
    899         TComPic* pRefPicBaseDepth = pcCU->getSlice()->getRefPicBaseDepth();
    900         pcBaseViewDepthPicYuv     = pRefPicBaseDepth->getPicYuvRec();
    901       }
    902       Int iBlkX = ( pcCU->getAddr() % pRefPicBaseTxt->getFrameWidthInCU() ) * g_uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
    903       Int iBlkY = ( pcCU->getAddr() / pRefPicBaseTxt->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
    904       Int* pShiftLUT;
    905       Int iShiftPrec;
    906       pcCU->getSlice()->getBWVSPLUTParam(pShiftLUT, iShiftPrec);
    907 
    908       //using disparity to find the depth block of the base view as the depth block estimator of the current block
    909       //using depth block estimator and base view texture to get Backward warping
    910       xPredInterLumaBlkFromDM  ( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX,    iBlkY,    iWidth,    iHeight,    pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred );
    911       xPredInterChromaBlkFromDM( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX>>1, iBlkY>>1, iWidth>>1, iHeight>>1, pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred );
     1002    { // texture, vsp compensation
     1003      xPredInterVSPBlk(pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, cMv, eRefPicList, rpcYuvPred, bi );
    9121004    }
    9131005    else//texture not VSP
     
    10721164  Int      iRefIdx[2] = {-1, -1};
    10731165
     1166#if MERL_Bi_VSP_D0166
     1167  Bool biDecision = 0;
     1168  Int  predDirVSP = 0;
     1169  if (pcCU->getVSPIndex(uiPartAddr) != 0) // is VSP
     1170  {
     1171    Int Bi_VSP_Avail = 0;
     1172    //test whether VSP is Bi or Uni
     1173    //Step1. Get derived DV view id
     1174    RefPicList privateRefPicList = (RefPicList) pcCU->getVSPDir( uiPartAddr );
     1175    RefPicList otherRefPicList = privateRefPicList == REF_PIC_LIST_0 ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
     1176    assert(privateRefPicList == REF_PIC_LIST_0 || privateRefPicList == REF_PIC_LIST_1);
     1177    Int  refIdx = -1-pcCU->getCUMvField( privateRefPicList )->getRefIdx( uiPartAddr );
     1178    assert(refIdx >= 0);
     1179    Int  viewId = pcCU->getSlice()->getRefViewId(privateRefPicList, refIdx);
     1180    Int  refPoc = pcCU->getSlice()->getRefPOC(privateRefPicList, refIdx);
     1181
     1182    assert(refPoc == pcCU->getSlice()->getPOC());
     1183//    if(refPoc != pcCU->getSlice()->getPOC() )
     1184//    {
     1185//      printf("refPOC= %d, and current POC=%d\n", refPoc, pcCU->getSlice()->getPOC() );
     1186//    }
     1187    //Step 2. Get initial prediction direction value according to reference picture list availability
     1188    Int iInterDir = ((pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_0) > 0 && pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_1) > 0) ? 3 :
     1189      (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_0) > 0 ? 1 : 2));
     1190    //Step 3.  Check the availability of Bi VSP by checking the interview reference availability in the other reference list
     1191    if(iInterDir==3)
     1192    {
     1193      for (Int irefIdx = 0; irefIdx <pcCU->getSlice()->getNumRefIdx(otherRefPicList); irefIdx ++ )
     1194      {
     1195        Int refViewIdx  = pcCU->getSlice()->getRefViewId( otherRefPicList, irefIdx);
     1196        if ( (refViewIdx != pcCU->getSlice()->getViewId()) && (refViewIdx != viewId ) )
     1197        {
     1198          Bi_VSP_Avail = 1;
     1199          break;
     1200        }
     1201      }
     1202    }
     1203    //Step 4. Update the Bi VSP prediction direction
     1204    if ( iInterDir == 3 && Bi_VSP_Avail == 1)
     1205    {
     1206      biDecision   = 1;
     1207      predDirVSP = 3;
     1208    }
     1209    else
     1210    {
     1211      biDecision = 0;
     1212      if ( privateRefPicList == REF_PIC_LIST_0 )
     1213        predDirVSP = 1;
     1214      else
     1215        predDirVSP = 2;
     1216    }
     1217  }
     1218  else
     1219  {//not VSP
     1220    if( ( pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiPartAddr ) >= 0 && pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiPartAddr ) >= 0 ) )
     1221      biDecision = 1;
     1222    else
     1223      biDecision = 0;
     1224  }
     1225#endif
     1226
    10741227  for ( Int iRefList = 0; iRefList < 2; iRefList++ )
    10751228  {
     
    10871240    else
    10881241    {
     1242
     1243#if !MERL_Bi_VSP_D0166 //both lists should go
    10891244      if ( iRefList== REF_PIC_LIST_1 && iRefIdx[iRefList] < 0 ) // iRefIdx[iRefList] ==NOT_VALID
    10901245      {
    10911246        continue;
    10921247      }
     1248#else
     1249      //Reference list loop termination
     1250      RefPicList privateVSPRefPicList = (RefPicList) pcCU->getVSPDir( uiPartAddr );
     1251      if( (pcCU->getVSPIndex(uiPartAddr)!=0) &&  iRefList != privateVSPRefPicList && !biDecision  )
     1252      {//when VSP mode, if it is uni prediction, the other reference list should skip
     1253        continue;
     1254      }
     1255#endif
     1256
    10931257    }
    10941258#else
     
    11021266
    11031267    pcMbYuv = &m_acYuvPred[iRefList];
     1268
     1269#if MERL_Bi_VSP_D0166
     1270    if(biDecision==1)
     1271#else
    11041272    if( pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiPartAddr ) >= 0 && pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiPartAddr ) >= 0 )
     1273#endif
    11051274    {
    11061275#if MERL_VSP_C0152
     
    11421311  {
    11431312#if MERL_VSP_C0152
     1313#if !MERL_Bi_VSP_D0166
    11441314    if(pcCU->getVSPIndex(uiPartAddr))
    11451315      m_acYuvPred[0].copyPartToPartYuv( rpcYuvPred, uiPartAddr, iWidth, iHeight );
    11461316    else
    11471317#endif
     1318#endif
    11481319    xWeightedPredictionBi( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred );
    11491320  }
     
    11531324  {
    11541325#if MERL_VSP_C0152
     1326#if !MERL_Bi_VSP_D0166
    11551327    if(pcCU->getVSPIndex(uiPartAddr))
    11561328      m_acYuvPred[0].copyPartToPartYuv( rpcYuvPred, uiPartAddr, iWidth, iHeight );
    11571329    else
    11581330#endif
     1331#endif
    11591332      xWeightedPredictionUni( pcCU, &m_acYuvPred[0], uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, rpcYuvPred, iPartIdx );
    11601333  }
     
    11691342    {
    11701343#if MERL_VSP_C0152
     1344#if !MERL_Bi_VSP_D0166
    11711345      if(pcCU->getVSPIndex(uiPartAddr))
    11721346        m_acYuvPred[0].copyPartToPartYuv( rpcYuvPred, uiPartAddr, iWidth, iHeight );
    11731347      else
    1174 #endif
     1348        xWeightedAverage( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred );
     1349#else
     1350      xWeightedAverage( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred, predDirVSP );
     1351#endif
     1352#else
    11751353      xWeightedAverage( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred );
     1354#endif
    11761355    }
    11771356  }
     
    15071686//
    15081687// Output: dstPic, PU predictor 64x64
    1509 Void TComPrediction::xPredInterLumaBlkFromDM( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv* mv, UInt partAddr,Int posX, Int posY, Int size_x, Int size_y, Bool isDepth, Int vspIdx
    1510                                             , TComYuv *&dstPic )
     1688Void TComPrediction::xPredInterLumaBlkFromDM( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv* mv, UInt partAddr,Int posX, Int posY, Int size_x, Int size_y, Bool isDepth, TComYuv *&dstPic
     1689#if MERL_Bi_VSP_D0166
     1690                                            , Bool bi
     1691#endif         
     1692                                            )
    15111693{
    15121694  Int widthLuma;
     
    17301912
    17311913      assert( ref[refOffset] >= 0 && ref[refOffset]<= 255 );
     1914#if MERL_Bi_VSP_D0166
     1915      m_if.filterHorLuma( &ref[refOffset], refStride, &dst[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !bi );
     1916#else
    17321917      m_if.filterHorLuma( &ref[refOffset], refStride, &dst[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, true );
     1918#endif
     1919
    17331920    }
    17341921    ref   += refStride*nTxtPerDepthY;
     
    17381925    yDepth++;
    17391926#endif
    1740   }
    1741 }
    1742 
    1743 Void TComPrediction::xPredInterChromaBlkFromDM ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv*mv, UInt partAddr, Int posX, Int posY, Int size_x, Int size_y, Bool isDepth, Int vspIdx
    1744                                                , TComYuv *&dstPic )
     1927
     1928  }
     1929}
     1930
     1931Void TComPrediction::xPredInterChromaBlkFromDM ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv*mv, UInt partAddr, Int posX, Int posY, Int size_x, Int size_y, Bool isDepth, TComYuv *&dstPic
     1932#if MERL_Bi_VSP_D0166
     1933                                               , Bool bi
     1934#endif
     1935                                               )
    17451936{
    17461937  Int refStride = refPic->getCStride();
     
    18081999  Int depStrideBlock = depStride * nDepthPerTxtY;
    18092000
    1810   if (isDepth)
    1811   {
    1812      // DT: Since the call for this function is redundant, ..
    1813      for (Int y = 0; y < size_y; y++)
    1814      {
    1815        for (Int x = 0; x < size_x; x++)
    1816        {
    1817          dstCb[x] = 128;
    1818          dstCr[x] = 128;
    1819        }
    1820        dstCb += dstStride;
    1821        dstCr += dstStride;
    1822      }
    1823      return;
    1824   }
    1825  
    18262001  if ( widthChroma > widthDepth ) // We assume
    18272002  {
     
    20142189        assert( refCb[refOffset] >= 0 && refCb[refOffset]<= 255 );
    20152190        assert( refCr[refOffset] >= 0 && refCr[refOffset]<= 255 );
     2191#if MERL_Bi_VSP_D0166
     2192        m_if.filterHorChroma(&refCb[refOffset], refStride, &dstCb[xTxt],  dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !bi);
     2193        m_if.filterHorChroma(&refCr[refOffset], refStride, &dstCr[xTxt],  dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !bi);
     2194#else
    20162195        m_if.filterHorChroma(&refCb[refOffset], refStride, &dstCb[xTxt],  dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, true);
    20172196        m_if.filterHorChroma(&refCr[refOffset], refStride, &dstCr[xTxt],  dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, true);
     2197#endif
     2198
    20182199      }
    20192200      refCb += refStrideBlock;
     
    20242205    }
    20252206  }
     2207
    20262208}
    20272209
     
    20312213Void TComPrediction::xWeightedAveragePdm( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst, UInt uiSubSampExpX, UInt uiSubSampExpY )
    20322214{
     2215
    20332216  if( iRefIdx0 >= 0 && iRefIdx1 >= 0 )
    20342217  {
     
    20502233#endif
    20512234
    2052 Void TComPrediction::xWeightedAverage( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst )
    2053 {
     2235Void TComPrediction::xWeightedAverage( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst
     2236#if MERL_Bi_VSP_D0166
     2237                                 , Int predDirVSP
     2238#endif
     2239  )
     2240{
     2241#if MERL_Bi_VSP_D0166
     2242  Bool isVSP = 0;
     2243  if (pcCU->getVSPIndex(uiPartIdx)!=0)//is VSP
     2244  {
     2245    isVSP = 1;
     2246  }
     2247
     2248  if(( !isVSP && iRefIdx0 >= 0 && iRefIdx1 >= 0 ) || ( isVSP && predDirVSP == 3 ))
     2249#else
    20542250  if( iRefIdx0 >= 0 && iRefIdx1 >= 0 )
     2251#endif
    20552252  {
    20562253    rpcYuvDst->addAvg( pcYuvSrc0, pcYuvSrc1, uiPartIdx, iWidth, iHeight );
    20572254  }
     2255#if MERL_Bi_VSP_D0166
     2256  else if ( ( !isVSP && iRefIdx0 >= 0 && iRefIdx1 <  0 ) || ( isVSP && predDirVSP == 1))
     2257#else
    20582258  else if ( iRefIdx0 >= 0 && iRefIdx1 <  0 )
     2259#endif
    20592260  {
    20602261    pcYuvSrc0->copyPartToPartYuv( rpcYuvDst, uiPartIdx, iWidth, iHeight );
    20612262  }
     2263#if MERL_Bi_VSP_D0166
     2264  else if (( !isVSP && iRefIdx0 <  0 && iRefIdx1 >= 0 ) || ( isVSP && predDirVSP == 2))
     2265#else
    20622266  else if ( iRefIdx0 <  0 && iRefIdx1 >= 0 )
     2267#endif
    20632268  {
    20642269    pcYuvSrc1->copyPartToPartYuv( rpcYuvDst, uiPartIdx, iWidth, iHeight );
    20652270  }
     2271#if MERL_Bi_VSP_D0166
     2272  else
     2273  {//for debug test only
     2274    assert(0);
     2275  }
     2276#endif
    20662277}
    20672278
  • branches/HTM-6.2-dev2-MERL/source/Lib/TLibCommon/TComPrediction.h

    r402 r412  
    115115      );
    116116
    117 #if MERL_VSP_C0152
    118   Void xPredInterUniBWVSP         ( TComDataCU* pcCU,                          UInt uiPartAddr, UInt uiAbsPartIdx,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY, Bool bi=false );
    119   Void xPredInterBiBWVSP          ( TComDataCU* pcCU,                          UInt uiPartAddr, UInt uiAbsPartIdx,               Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap );
    120 #endif
    121 
    122117#if DEPTH_MAP_GENERATION
    123118  Void xWeightedAveragePdm      ( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst, UInt uiSubSampExpX, UInt uiSubSampExpY );
     
    151146    );
    152147#endif
     148
     149#if MERL_Bi_VSP_D0166
     150  Void xWeightedAverage         ( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst,  Int predDir);
     151#else
    153152  Void xWeightedAverage         ( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst );
    154 
    155 #if MERL_VSP_C0152
    156   Void xPredInterLumaBlkFromDM    ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv *mv, UInt partAddr,Int posX, Int posY, Int size_x, Int size_y, Bool isDepth, Int vspIdx
    157                                   , TComYuv *&dstPic );
    158   Void xPredInterChromaBlkFromDM  ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv *mv, UInt partAddr,Int posX, Int posY, Int size_x, Int size_y, Bool isDepth, Int vspIdx
    159                                   , TComYuv *&dstPic );
     153#endif
     154#if MERL_VSP_C0152
     155  Void xPredInterVSPBlk(TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, TComMv cMv, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi );
     156#if MERL_Bi_VSP_D0166
     157  TComPic*  xGetVspRefTxt(TComDataCU* pcCU, UInt uiPartAddr, RefPicList eRefPicList);
     158  Void xPredInterLumaBlkFromDM    ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv *mv, UInt partAddr,Int posX, Int posY, Int size_x, Int size_y, Bool isDepth,
     159    TComYuv *&dstPic, Bool bi);
     160  Void xPredInterChromaBlkFromDM  ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv *mv, UInt partAddr,Int posX, Int posY, Int size_x, Int size_y, Bool isDepth,
     161    TComYuv *&dstPic, Bool bi);
     162#else
     163  Void xPredInterLumaBlkFromDM    ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv *mv, UInt partAddr,Int posX, Int posY, Int size_x, Int size_y, Bool isDepth,
     164                                  TComYuv *&dstPic );
     165  Void xPredInterChromaBlkFromDM  ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv *mv, UInt partAddr,Int posX, Int posY, Int size_x, Int size_y, Bool isDepth,
     166                                  TComYuv *&dstPic );
     167#endif
    160168#endif
    161169  Void xGetLLSPrediction ( TComPattern* pcPattern, Int* pSrc0, Int iSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt uiExt0 );
  • branches/HTM-6.2-dev2-MERL/source/Lib/TLibCommon/TComSlice.cpp

    r373 r412  
    119119#endif
    120120{
     121#if MERL_VSP_NBDV_RefVId_Fix_D0166
     122  for(Int iNumCount = 0; iNumCount < MAX_VIEW_NUM; iNumCount++)
     123    m_pcListDepthPic[iNumCount] =NULL;
     124#endif
    121125  m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = m_aiNumRefIdx[2] = 0;
    122126
     
    13861390}
    13871391#endif
     1392
     1393#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1394TComPic* TComSlice::getDepthRefPic(Int viewId, Int poc)
     1395{
     1396  TComPic* pPic = NULL;
     1397
     1398  if (m_pcListDepthPic[viewId] == NULL)
     1399    return NULL;
     1400
     1401  for( TComList<TComPic*>::iterator it = m_pcListDepthPic[viewId]->begin(); it != m_pcListDepthPic[viewId]->end(); it++ )
     1402  {
     1403    TComPic* currPic = *it;
     1404    TComSlice* currSlice = currPic->getCurrSlice();
     1405    Bool isDepth = currSlice->getIsDepth();
     1406    //assert(isDepth);
     1407    if( isDepth && currPic->getPOC() == poc && currPic->getViewId() == viewId ) // (*it)->getSPS()->isDepth()
     1408    {
     1409      pPic = *it;
     1410      break;
     1411    }
     1412  }
     1413
     1414  return pPic;
     1415}
     1416#endif
     1417
     1418
    13881419#if QC_ARP_D0177
    13891420Void TComSlice::setARPStepNum()                                 
  • branches/HTM-6.2-dev2-MERL/source/Lib/TLibCommon/TComSlice.h

    r373 r412  
    11191119  Bool        m_bApplyIC;
    11201120#endif
     1121#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1122  TComList<TComPic*>*  m_pcListDepthPic[MAX_VIEW_NUM]; // For encoder, the list may also include texture pictures. Three views with ViewIdx = 0, 1, 2
     1123#endif
    11211124#if QC_ARP_D0177
    11221125  TComList<TComPic*> * m_pBaseViewRefPicList[MAX_VIEW_NUM];
     
    11311134  TComPic*     m_apcRefPicBaseTxt;
    11321135  TComPic*     m_apcRefPicBaseDepth;
     1136#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1137  Int*         m_aiShiftLUT[2]; // For reference views
     1138#else
    11331139  Int*         m_aiShiftLUT;
     1140#endif
    11341141  Int          m_iShiftPrec;
    11351142#endif
     
    14391446  TComPic*     getRefPicBaseDepth        ()                        { return  m_apcRefPicBaseDepth; }
    14401447  Void         setRefPicBaseDepth        ( TComPic* RefPic)        { m_apcRefPicBaseDepth = RefPic; }
    1441 
     1448#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1449  Void setBWVSPLUTParam( Int *pShiftLUT, Int iLoG2LUTPrec, Int iNeighborViewId) { m_aiShiftLUT[iNeighborViewId] = pShiftLUT; m_iShiftPrec = iLoG2LUTPrec; }
     1450  Void getBWVSPLUTParam( Int*&pShiftLUT, Int&iLoG2LUTPrec, Int iNeighborViewId) { pShiftLUT = m_aiShiftLUT[iNeighborViewId]; iLoG2LUTPrec = m_iShiftPrec; }
     1451#else
    14421452  Void setBWVSPLUTParam( Int *pShiftLUT, Int iLoG2LUTPrec) { m_aiShiftLUT = pShiftLUT; m_iShiftPrec = iLoG2LUTPrec; }
    14431453  Void getBWVSPLUTParam( Int*&pShiftLUT, Int&iLoG2LUTPrec) { pShiftLUT = m_aiShiftLUT; iLoG2LUTPrec = m_iShiftPrec; }
     1454#endif
     1455#endif
     1456
     1457#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1458  Void setListDepthPic( TComList<TComPic*>* pListDepthPic, Int viewId) { m_pcListDepthPic[viewId] = pListDepthPic; }
     1459  TComList<TComPic*>* getListDepthPic(Int viewId) { return m_pcListDepthPic[viewId]; }
     1460  TComPic*            getDepthRefPic(Int viewId, Int poc);
     1461  TComPic*            getDepthRefPic(Int refIdx);
    14441462#endif
    14451463
  • branches/HTM-6.2-dev2-MERL/source/Lib/TLibCommon/TypeDef.h

    r402 r412  
    182182
    183183///// ***** VSP *********
    184 #define MERL_VSP_C0152                    1 // JCT3V-C0152: 1: enable VSP-related tools; 0: disable VSP-related tools
    185                                             // LGE_SIMP_DVP_REFINE_C0112           
    186                                             // MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     184#define MERL_VSP_C0152                       1 // JCT3V-C0152: 1: enable VSP-related tools; 0: disable VSP-related tools
     185                                               // LGE_SIMP_DVP_REFINE_C0112
     186                                               // MERL_MTK_VSP_DVP_REFINE_C0152_C0131
    187187#if MERL_VSP_C0152
    188 #define MERL_VSP_C0152_BugFix_ForNoDepthCase     1// MERL bugfix for test condition of no depth
    189 /*
    190  * Two macros are used to configure combinations of JCT3V-C0152 and JCT3V-C0131
    191  *
    192  *   a) (full) A full JCT3V-C0152 implementation, including JCT3V-C0131
    193  *      #define MERL_VSP_COMPENSATION_C0152          1
    194  *      #define MERL_MTK_VSP_DVP_REFINE_C0152_C0131  1
    195  *
    196  *   b) (mvp2off) For partial JCT3V-C0152 excluding overlaps from JCT3V-C0131
    197  *      #define MERL_VSP_COMPENSATION_C0152          1
    198  *      #define MERL_MTK_VSP_DVP_REFINE_C0152_C0131  0
    199  *
    200  *   c) (nocand) For JCT3V-C0131 only
    201  *      #define MERL_VSP_COMPENSATION_C0152          0
    202  *      #define MERL_MTK_VSP_DVP_REFINE_C0152_C0131  1
    203  */
    204 
    205 #define MERL_VSP_COMPENSATION_C0152          1 // JCT3V-C0152: 1: add VSP merge candidate to merging candidate list; 0: not to add   (nocand).
    206 
    207 
    208 #define MERL_VSP_BLOCKSIZE_C0152             1 // JCT3V-C0152: VSP block size, supported values: 1, 2 and 4.
     188
     189#define MERL_VSP_C0152_BugFix_ForNoDepthCase 1 // MERL bugfix for test condition of no depth
     190#define MERL_VSP_COMPENSATION_C0152          1 // JCT3V-C0152: 1: add VSP merge candidate to merging candidate list; 0: not to add (nocand).
     191
     192#define MERL_VSP_BLOCKSIZE_C0152             4 // JCT3V-C0152: VSP block size, supported values: 1, 2 and 4.
    209193#if MERL_VSP_BLOCKSIZE_C0152 == 1
    210 #define MERL_CVSP_D0165                      1 // JCT3V-D0165: 1:enable CVSP; 0: disable CVSP.
     194#define MERL_CVSP_D0165                      1 // JCT3V-D0165: 1: enable CVSP; 0: disable CVSP.
     195#else
     196#define MERL_CVSP_D0165                      0 // JCT3V-D0165: 1: enable CVSP; 0: disable CVSP.
    211197#endif
    212198
    213199#define VSP_MERGE_POS                        5 // JCT3V-C0152: fixed position of VSP candidate in merge list, supported values: 5.
    214                                                //MTK_DVPREFINE_BVSP_BUG_FIX               1
     200                                               // MTK_DVPREFINE_BVSP_BUG_FIX               1
    215201#define MTK_DEPTH_TO_DISP_D0138              1 // JCT3V-D0138: Use max among four corners for DoNBDV and BVSP
     202
     203#define MTK_LGE_VSP_DEPTH_OFF_D0105_D0139    1 // JCT3V-D0105/JCT3V-D0139: disable VSP for depth map
     204#define MTK_VSP_USING_NBDV_D0105             1 // JCT3V-D0105: use NBDV instead of DoNBDV for BVSP
     205
     206#define MERL_VSP_NBDV_RefVId_Fix_D0166       1 // JCT3V-D0166: 1: fix the NBDV with ref view selectioin; 0: always use base view with refViewIdx=0
     207#if MERL_VSP_NBDV_RefVId_Fix_D0166
     208#define MERL_Bi_VSP_D0166                    0 // JCT3V-D0166: 1: add supporting for Bi-VSP, the code under the macro can also handle uni-direction VSP
     209#endif
    216210
    217211#else // !MERL_VSP_C0152
    218212#define MERL_VSP_COMPENSATION_C0152          0 // JCT3V-C0152: 1: add VSP merge candidate to merging candidate list; 0: not to add
    219213#define MERL_VSP_BLOCKSIZE_C0152             4 // JCT3V-C0152: VSP block size, supported values: 1, 2 and 4.
    220 #endif
    221 
    222 #define MTK_LGE_VSP_DEPTH_OFF_D0105_D0139             1  // JCT3V-D0105/JCT3V-D0139: disable VSP for depth map
    223 #define MTK_VSP_USING_NBDV_D0105                      1  // JCT3V-D0105: use NBDV instead of DoNBDV for BVSP
     214#define MERL_VSP_C0152_BugFix_ForNoDepthCase 0 // MERL bugfix for test condition of no depth
     215define MERL_CVSP_D0165                       0 // JCT3V-D0165: 1: enable CVSP; 0: disable CVSP.
     216#define MERL_VSP_NBDV_RefVId_Fix_D0166       0 // JCT3V-D0166: 1: fix the NBDV with ref view selectioin; 0: always use base view with refViewIdx=0
     217#define MERL_Bi_VSP_D0166                    0 // JCT3V-D0166: 1: add supporting for Bi-VSP, the code under the macro can also handle uni-direction VSP
     218#define MTK_VSP_USING_NBDV_D0105             0
     219#endif
    224220
    225221///// ***** DERIVED PARAMETERS *********
Note: See TracChangeset for help on using the changeset viewer.