Changeset 510 in 3DVCSoftware


Ignore:
Timestamp:
2 Jul 2013, 21:49:16 (11 years ago)
Author:
mitsubishi-htm
Message:

-VSP compensation part migration, not fully tested, intermediate version

Location:
branches/HTM-DEV-0.3-dev2
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-DEV-0.3-dev2/build

    • Property svn:ignore set to
      HTM-DEV-0.3-dev2
      HTM-DEV-0.3-dev2-Dec
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComDataCU.cpp

    r504 r510  
    116116#endif
    117117
     118#if H_3D_VSP
     119  m_piVSPFlag            = NULL;
     120#endif
     121
    118122#if H_3D_ARP
    119123  m_puhARPW              = NULL;
     
    157161    m_pbMergeFlag        = (Bool*  )xMalloc(Bool,   uiNumPartition);
    158162    m_puhMergeIndex      = (UChar* )xMalloc(UChar,  uiNumPartition);
     163#if H_3D_VSP
     164    m_piVSPFlag          = (Char*  )xMalloc(Char,   uiNumPartition);
     165#endif
    159166    m_puhLumaIntraDir    = (UChar* )xMalloc(UChar,  uiNumPartition);
    160167    m_puhChromaIntraDir  = (UChar* )xMalloc(UChar,  uiNumPartition);
     
    276283    if ( m_pbMergeFlag        ) { xFree(m_pbMergeFlag);         m_pbMergeFlag       = NULL; }
    277284    if ( m_puhMergeIndex      ) { xFree(m_puhMergeIndex);       m_puhMergeIndex     = NULL; }
     285#if H_3D_VSP
     286    if ( m_piVSPFlag          ) { xFree(m_piVSPFlag);           m_piVSPFlag         = NULL; }
     287#endif
    278288    if ( m_puhLumaIntraDir    ) { xFree(m_puhLumaIntraDir);     m_puhLumaIntraDir   = NULL; }
    279289    if ( m_puhChromaIntraDir  ) { xFree(m_puhChromaIntraDir);   m_puhChromaIntraDir = NULL; }
     
    442452    m_pbMergeFlag[ui]=pcFrom->m_pbMergeFlag[ui];
    443453    m_puhMergeIndex[ui]=pcFrom->m_puhMergeIndex[ui];
     454#if H_3D_VSP
     455    m_piVSPFlag[ui] = pcFrom->m_piVSPFlag[ui];
     456#endif
    444457    m_puhLumaIntraDir[ui]=pcFrom->m_puhLumaIntraDir[ui];
    445458    m_puhChromaIntraDir[ui]=pcFrom->m_puhChromaIntraDir[ui];
     
    475488    memset( m_pbMergeFlag       + firstElement, false,                    numElements * sizeof( *m_pbMergeFlag ) );
    476489    memset( m_puhMergeIndex     + firstElement, 0,                        numElements * sizeof( *m_puhMergeIndex ) );
     490#if H_3D_VSP
     491    memset( m_piVSPFlag         + firstElement, 0,                        numElements * sizeof( *m_piVSPFlag ) );
     492#endif
    477493    memset( m_puhLumaIntraDir   + firstElement, DC_IDX,                   numElements * sizeof( *m_puhLumaIntraDir ) );
    478494    memset( m_puhChromaIntraDir + firstElement, 0,                        numElements * sizeof( *m_puhChromaIntraDir ) );
     
    617633      m_pbMergeFlag[ui] = 0;
    618634      m_puhMergeIndex[ui] = 0;
     635#if H_3D_VSP
     636      m_piVSPFlag[ui] = 0;
     637#endif
    619638      m_puhLumaIntraDir[ui] = DC_IDX;
    620639      m_puhChromaIntraDir[ui] = 0;
     
    688707  memset( m_pbMergeFlag,        0, iSizeInBool  );
    689708  memset( m_puhMergeIndex,      0, iSizeInUchar );
     709#if H_3D_VSP
     710  memset( m_piVSPFlag,          0, sizeof( Char  ) * m_uiNumPartition );
     711#endif
    690712  memset( m_puhLumaIntraDir,    DC_IDX, iSizeInUchar );
    691713  memset( m_puhChromaIntraDir,  0, iSizeInUchar );
     
    744766      m_pbMergeFlag[ui]=pcCU->m_pbMergeFlag[uiPartOffset+ui];
    745767      m_puhMergeIndex[ui]=pcCU->m_puhMergeIndex[uiPartOffset+ui];
     768#if H_3D_VSP
     769      m_piVSPFlag[ui]=pcCU->m_piVSPFlag[uiPartOffset+ui];
     770#endif
    746771      m_puhLumaIntraDir[ui]=pcCU->m_puhLumaIntraDir[uiPartOffset+ui];
    747772      m_puhChromaIntraDir[ui]=pcCU->m_puhChromaIntraDir[uiPartOffset+ui];
     
    866891  m_pbMergeFlag         = pcCU->getMergeFlag()        + uiPart;
    867892  m_puhMergeIndex       = pcCU->getMergeIndex()       + uiPart;
     893#if H_3D_VSP
     894  m_piVSPFlag           = pcCU->getVSPFlag()          + uiPart;
     895#endif
    868896
    869897#if H_3D_ARP
     
    9861014  m_pbMergeFlag        = pcCU->getMergeFlag()             + uiAbsPartIdx;
    9871015  m_puhMergeIndex      = pcCU->getMergeIndex()            + uiAbsPartIdx;
     1016#if H_3D_VSP
     1017  m_piVSPFlag          = pcCU->getVSPFlag()               + uiAbsPartIdx;
     1018#endif
    9881019
    9891020  m_apiMVPIdx[eRefPicList] = pcCU->getMVPIdx(eRefPicList) + uiAbsPartIdx;
     
    10301061  memcpy( m_pbMergeFlag         + uiOffset, pcCU->getMergeFlag(),         iSizeInBool  );
    10311062  memcpy( m_puhMergeIndex       + uiOffset, pcCU->getMergeIndex(),        iSizeInUchar );
     1063#if H_3D_VSP
     1064  memcpy( m_piVSPFlag           + uiOffset, pcCU->getVSPFlag(),           sizeof( Char ) * uiNumPartition );
     1065#endif
    10321066  memcpy( m_puhLumaIntraDir     + uiOffset, pcCU->getLumaIntraDir(),      iSizeInUchar );
    10331067  memcpy( m_puhChromaIntraDir   + uiOffset, pcCU->getChromaIntraDir(),    iSizeInUchar );
     
    11201154  memcpy( rpcCU->getMergeFlag()         + m_uiAbsIdxInLCU, m_pbMergeFlag,         iSizeInBool  );
    11211155  memcpy( rpcCU->getMergeIndex()        + m_uiAbsIdxInLCU, m_puhMergeIndex,       iSizeInUchar );
     1156#if H_3D_VSP
     1157  memcpy( rpcCU->getVSPFlag()           + m_uiAbsIdxInLCU, m_piVSPFlag,           sizeof( Char ) * m_uiNumPartition );
     1158#endif
    11221159  memcpy( rpcCU->getLumaIntraDir()      + m_uiAbsIdxInLCU, m_puhLumaIntraDir,     iSizeInUchar );
    11231160  memcpy( rpcCU->getChromaIntraDir()    + m_uiAbsIdxInLCU, m_puhChromaIntraDir,   iSizeInUchar );
     
    11991236  memcpy( rpcCU->getMergeFlag()         + uiPartOffset, m_pbMergeFlag,         iSizeInBool  );
    12001237  memcpy( rpcCU->getMergeIndex()        + uiPartOffset, m_puhMergeIndex,       iSizeInUchar );
     1238#if H_3D_VSP
     1239  memcpy( rpcCU->getVSPFlag()           + uiPartOffset, m_piVSPFlag,           sizeof(Char) * uiQNumPart );
     1240#endif
    12011241  memcpy( rpcCU->getLumaIntraDir()      + uiPartOffset, m_puhLumaIntraDir,     iSizeInUchar );
    12021242  memcpy( rpcCU->getChromaIntraDir()    + uiPartOffset, m_puhChromaIntraDir,   iSizeInUchar );
     
    21432183  setSubPart<UChar>( uiMergeIndex, m_puhMergeIndex, uiAbsPartIdx, uiDepth, uiPartIdx );
    21442184}
     2185
     2186#if H_3D_VSP
     2187Void TComDataCU::setVSPFlagSubParts( Char iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
     2188{
     2189  setSubPart<Char>( iVSPFlag, m_piVSPFlag, uiAbsPartIdx, uiDepth, uiPartIdx );
     2190}
     2191#endif
    21452192
    21462193Void TComDataCU::setChromIntraDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiDepth )
     
    25722619}
    25732620
     2621#if H_3D_VSP
     2622
     2623/** Add a VSP merging candidate
     2624 * \Inputs
     2625 * \param uiPUIdx: PU index within a CU
     2626 * \param ucVspMergePos: Specify the VSP merge candidate position
     2627 * \param mrgCandIdx: Target merge candidate index. At encoder, it is set equal to -1, such that the whole merge candidate list will be constructed.
     2628 * \param pDinfo: The "disparity information" derived from neighboring blocks. Type 1 MV.
     2629 * \param uiCount: The next position to add VSP merge candidate
     2630 *
     2631 * \Outputs
     2632 * \param uiCount: The next position to add merge candidate. Will be updated if VSP is successfully added
     2633 * \param abCandIsInter: abCandIsInter[iCount] tells that VSP candidate is an Inter candidate, if VSP is successfully added
     2634 * \param pcMvFieldNeighbours:   Return the "disparity vector". Type 1 MV. To be used to fetch a depth block. A "global" variable
     2635 * \param puhInterDirNeighbours: Tells the VSP prediction direction. TODO: The value does NOT matter for VSP, as the direction will be determined based on availability later
     2636 *                                Having it as output is mainly for coding beauty
     2637 * \param vspFlag: vspFlag[iCount] will be set (equal to 1), if VSP is successfully added. To be used to indicate the actual position of the VSP candidate
     2638 *
     2639 * \Return
     2640 *   true:  if the VSP candidate is added at the target position
     2641 *   false: otherwise
     2642 */
     2643inline Bool TComDataCU::xAddVspCand( UChar ucVspMergePos, Int mrgCandIdx, DisInfo* pDInfo, Int& iCount,
     2644                                     Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag )
     2645{
     2646  if( !m_pcSlice->getVPS()->getViewSynthesisPredFlag( m_pcSlice->getLayerIdInVps() ) ) // Not to add the candidate if VSP is turned off
     2647    return false;
     2648  if( m_pcSlice->getIsDepth() ) // VSP is turned off for depth layers
     2649    return false;
     2650
     2651  Int refViewIdx = pDInfo->m_aVIdxCan;
     2652  TComPic* picDepth = NULL;
     2653  //assert(getSlice()->getRefPic(eRefPicList, refId)->getPOC() == getSlice()->getPOC());
     2654  picDepth = getSlice()->getIvPic( true, refViewIdx );
     2655
     2656  /*
     2657  // Code if simply re-writing
     2658  if(ucVspMergePos == H_3D_VSPPOSITION && picDepth != NULL && 0 != m_pcSlice->getViewIndex() ) // VSP can be used only when depth is used as input
     2659  {
     2660    abCandIsInter[iCount] = true;
     2661    puhInterDirNeighbours[iCount] = 1;
     2662    vspFlag[iCount] = 1;
     2663    vspDirTrue[iCount] = 0; // TODO: Check if this is really useful!!!!
     2664
     2665    Int iRefIdxList0 = getSlice()->getRefPic(REF_PIC_LIST_0, 0)->getPOC() == getSlice()->getPOC() ? 0 :
     2666                      (getSlice()->getAlterRefIdx(REF_PIC_LIST_0) == -1 ? NOT_VALID : getSlice()->getAlterRefIdx(REF_PIC_LIST_0));
     2667    pcMvFieldNeighbours[iCount<<1].setMvField( pDInfo->m_acDoNBDV, iRefIdxList0 );
     2668    if (getSlice()->isInterB())
     2669    {
     2670      puhInterDirNeighbours[iCount] = xGetVspDirection(uiPUIdx);
     2671      Int iRefIdxList1 = getSlice()->getRefPic(REF_PIC_LIST_1, 0)->getPOC() == getSlice()->getPOC() ? 0 :
     2672                        (getSlice()->getAlterRefIdx(REF_PIC_LIST_1) == -1 ? NOT_VALID : getSlice()->getAlterRefIdx(REF_PIC_LIST_1));
     2673      pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acDoNBDV, iRefIdxList1 );
     2674    }
     2675
     2676    if ( mrgCandIdx == iCount )
     2677      return true;
     2678
     2679    iCount++;
     2680  }
     2681  */
     2682  if(ucVspMergePos == H_3D_VSP_POSITION && picDepth != NULL && 0 != m_pcSlice->getViewIndex() ) // VSP can be used only when depth is used as input
     2683  {
     2684    abCandIsInter[iCount] = true;
     2685    puhInterDirNeighbours[iCount] = 0;
     2686    vspFlag[iCount] = 1;
     2687
     2688    Bool refViewAvailFlag = false;
     2689    UChar predFlag[2] = {0, 0};
     2690    Int  iRefListIdX = 0;
     2691    Int  iRefListIdY = 0;
     2692
     2693    for( iRefListIdX = 0; iRefListIdX < 2 && !refViewAvailFlag; iRefListIdX++ )
     2694    {
     2695      RefPicList eRefPicList = RefPicList( iRefListIdX );
     2696      for (Int i = 0; i < m_pcSlice->getNumRefIdx(eRefPicList) && !refViewAvailFlag; i++)
     2697      {
     2698        Int viewIdxRefInList = m_pcSlice->getRefPic(eRefPicList, i)->getViewIndex();
     2699        if (refViewIdx == viewIdxRefInList)
     2700        {
     2701          refViewAvailFlag = true;
     2702          predFlag[iRefListIdX] = 1;
     2703          iRefListIdY = 1 - iRefListIdX;
     2704          pcMvFieldNeighbours[(iCount<<1)+iRefListIdX].setMvField( pDInfo->m_acDoNBDV, i );
     2705        }
     2706      }
     2707    }
     2708
     2709    if (m_pcSlice->isInterB() && refViewAvailFlag)
     2710    {
     2711      RefPicList eRefPicList = RefPicList( iRefListIdY );
     2712      refViewAvailFlag = false;
     2713      for (Int i = 0; i < m_pcSlice->getNumRefIdx(eRefPicList) && !refViewAvailFlag; i++)
     2714      {
     2715        Int viewIdxRefInList = m_pcSlice->getRefPic(eRefPicList, i)->getViewIndex();
     2716        if (refViewIdx != viewIdxRefInList)
     2717        {
     2718          refViewAvailFlag = true;
     2719          predFlag[iRefListIdY] = 1;
     2720          pcMvFieldNeighbours[(iCount<<1)+iRefListIdY].setMvField( pDInfo->m_acDoNBDV, i );
     2721        }
     2722      }
     2723    }
     2724
     2725    puhInterDirNeighbours[iCount] = (predFlag[0] | (predFlag[1] << 1));
     2726
     2727    if ( mrgCandIdx == iCount )
     2728      return true;
     2729
     2730    iCount++;
     2731  }
     2732
     2733  return false;
     2734}
     2735#endif
     2736
    25742737/** Constructs a list of merging candidates
    25752738 * \param uiAbsPartIdx
     
    25802743 * \param numValidMergeCand
    25812744 */
    2582 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx )
     2745Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours
     2746#if H_3D_VSP
     2747      , Int* vspFlag
     2748#endif
     2749      , Int& numValidMergeCand
     2750      , Int mrgCandIdx
     2751)
    25832752{
    25842753  UInt uiAbsPartAddr = m_uiAbsIdxInLCU + uiAbsPartIdx;
     
    28302999      pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
    28313000#endif
     3001#if H_3D_VSP
     3002      if (pcCULeft->getVSPFlag(uiLeftPartIdx) == 1)
     3003        vspFlag[iCount] = 1;
     3004#endif
    28323005      if ( mrgCandIdx == iCount )
    28333006      {
     
    28943067      pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
    28953068#endif
     3069#if H_3D_VSP
     3070      if (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1)
     3071        vspFlag[iCount] = 1;
     3072#endif
    28963073      if ( mrgCandIdx == iCount )
    28973074      {
     
    29363113    pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
    29373114#endif
     3115#if H_3D_VSP
     3116    if (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1)
     3117      vspFlag[iCount] = 1;
     3118#endif
    29383119    if ( mrgCandIdx == iCount )
    29393120    {
     
    30033184#endif
    30043185
     3186#if H_3D_VSP
     3187  if ( xAddVspCand( 3, mrgCandIdx, &cDisInfo, iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag ) )
     3188    return;
     3189  // early termination
     3190  if (iCount == getSlice()->getMaxNumMergeCand())
     3191    return;
     3192#endif
     3193
    30053194  //left bottom
    30063195  UInt uiLeftBottomPartIdx = 0;
     
    30253214    pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
    30263215#endif
     3216#if H_3D_VSP
     3217    if (pcCULeftBottom->getVSPFlag(uiLeftBottomPartIdx) == 1)
     3218      vspFlag[iCount] = 1;
     3219#endif
    30273220    if ( mrgCandIdx == iCount )
    30283221    {
     
    30603253      pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
    30613254      pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
     3255#endif
     3256#if H_3D_VSP
     3257      if (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1)
     3258        vspFlag[iCount] = 1;
    30623259#endif
    30633260      if ( mrgCandIdx == iCount )
     
    31923389    {
    31933390      Int i = uiPriorityList0[idx]; Int j = uiPriorityList1[idx];
     3391#if H_3D_VSP
     3392      Bool bValid = true;
     3393      if ( vspFlag[i] == 1 || vspFlag[j] == 1 )
     3394        bValid = false;
     3395      if( !m_pcSlice->getVPS()->getViewSynthesisPredFlag( m_pcSlice->getLayerIdInVps() ) )
     3396        assert(bValid == true);
     3397#endif
     3398#if H_3D_VSP
     3399      if (abCandIsInter[i] && abCandIsInter[j] && (puhInterDirNeighbours[i]&0x1) && (puhInterDirNeighbours[j]&0x2) && bValid)
     3400#else
    31943401      if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2))
     3402#endif
    31953403      {
    31963404        abCandIsInter[uiArrayAddr] = true;
     
    45154723            estimateDVFromDM(iTargetViewIdx, uiPartIdx, picDepth, uiPartAddr, &cColMv );
    45164724
    4517           //Notes from MTK: Please uncomment the following parts while integrating VSP
    4518 #if H_3D_VSP
     4725#if 0 // H_3D_VSP
    45194726          Int refFrmIdx = 0;
    45204727          RefPicList privateRefPicList = REF_PIC_LIST_0;
     
    46354842          pDInfo->m_acDoNBDV = cDispVec;
    46364843         
    4637 #if H_3D_VSP
     4844#if 0 // H_3D_VSP
    46384845          Int refFrmIdx = 0;
    46394846          RefPicList privateRefPicList = REF_PIC_LIST_0 ;
     
    46664873  pDInfo->m_acDoNBDV = defaultDV;
    46674874
    4668 #if H_3D_VSP
     4875#if 0 // H_3D_VSP
    46694876  Int refFrmIdx = 0;
    46704877  RefPicList privateRefPicList = REF_PIC_LIST_0 ;
     
    46844891  Int iPictureWidth  = pcBaseViewDepthPicYuv->getWidth();
    46854892  Int iPictureHeight = pcBaseViewDepthPicYuv->getHeight();
    4686  
    46874893
    46884894  Int depthStartPosX = Clip3(0,   iPictureWidth - iBlkWidth,  iBlkX + ((mv->getHor()+2)>>2));
     
    47494955          pNbDvInfo->m_aVIdxCan = refViewIdx;
    47504956#if H_3D_NBDV_REF
    4751           TComPic* picDepth = NULL;         
     4957          TComPic* picDepth = NULL;
    47524958          assert(getSlice()->getRefPic(eRefPicList, refId)->getPOC() == getSlice()->getPOC());         
    4753           picDepth   = getSlice()->getIvPic (true, refViewIdx );         
     4959          picDepth   = getSlice()->getIvPic (true, refViewIdx );
    47544960          assert(picDepth != NULL);
    47554961
     
    47604966            estimateDVFromDM(refViewIdx, uiPartIdx, picDepth, uiPartAddr, &cMvPred );
    47614967
    4762          
     4968#if 0 // H_3D_VSP
     4969          pNbDvInfo->m_aListIdx[ pNbDvInfo->iN ] = eRefPicList;
     4970          pNbDvInfo->m_aRefIdx [ pNbDvInfo->iN ] = -1-refId;
     4971          assert(pNbDvInfo->m_aRefIdx [ pNbDvInfo->iN ] < 0);
     4972#endif
     4973
    47634974          pNbDvInfo->m_acDoNBDV = cMvPred;
    47644975#endif
     
    47694980          assert( uiMvpDvPos < IDV_CANDS );
    47704981          paIDVInfo->m_acMvCand[iList][ uiMvpDvPos ] = TComMv( cMvPred.getIDVHor(), cMvPred.getIDVVer() );
    4771           //Notes from QC: DvMCP is implemented in a way that doesn’t carry the reference view identifier as NBDV. It only works for CTC and needs to be fixed to be aligned with other part of the NBDV design.
     4982          //Notes from QC: DvMCP is implemented in a way that doesnt carry the reference view identifier as NBDV. It only works for CTC and needs to be fixed to be aligned with other part of the NBDV design.
    47724983          paIDVInfo->m_aVIdxCan[iList][ uiMvpDvPos ] = 0;
    47734984          paIDVInfo->m_bAvailab[iList][ uiMvpDvPos ] = true;
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComDataCU.h

    r504 r510  
    194194  DisInfo*      m_pDvInfo;
    195195#endif
     196#if H_3D_VSP
     197  Char*         m_piVSPFlag;          ///< array of VSP flags to indicate whehter a block uses VSP or not
     198                                      ///< 0: non-VSP; 1: VSP
     199#endif
    196200#if H_3D_ARP
    197201  UChar*        m_puhARPW;
     
    221225  Bool          xAddMVPCand           ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );
    222226  Bool          xAddMVPCandOrder      ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );
     227#if H_3D_VSP
     228  Bool          xAddVspCand( UChar ucVspMergePos, Int mrgCandIdx, DisInfo* pDInfo, Int& iCount,
     229                             Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspIdxTrue );
     230#endif
    223231
    224232  Void          deriveRightBottomIdx        ( UInt uiPartIdx, UInt& ruiPartIdxRB );
     
    549557 
    550558  Bool          hasEqualMotion              ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx );
    551   Void          getInterMergeCandidates       ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 );
     559  Void          getInterMergeCandidates     ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours
     560#if H_3D_VSP
     561                                            , Int* vspFlag
     562#endif
     563                                            , Int& numValidMergeCand
     564                                            , Int mrgCandIdx = -1 );
     565#if H_3D_VSP
     566  Char*         getVSPFlag        ()                        { return m_piVSPFlag;        }
     567  Char          getVSPFlag        ( UInt uiIdx )            { return m_piVSPFlag[uiIdx]; }
     568  Void          setVSPFlag        ( UInt uiIdx, Int n )     { m_piVSPFlag[uiIdx] = n;    }
     569  Void          setVSPFlagSubParts( Char iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
     570#endif
    552571  Void          deriveLeftRightTopIdxGeneral  ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT );
    553572  Void          deriveLeftBottomIdxGeneral    ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB );
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComPrediction.cpp

    r504 r510  
    5151{
    5252  m_piYuvExt = NULL;
     53#if H_3D_VSP
     54  m_pDepthBlock = (Int*) malloc(MAX_NUM_SPU_W*MAX_NUM_SPU_W*sizeof(Int));
     55  if (m_pDepthBlock == NULL)
     56      printf("ERROR: UKTGHU, No memory allocated.\n");
     57#endif
    5358}
    5459
    5560TComPrediction::~TComPrediction()
    5661{
    57  
     62#if H_3D_VSP
     63  if (m_pDepthBlock != NULL)
     64      free(m_pDepthBlock);
     65#endif
     66
    5867  delete[] m_piYuvExt;
    5968
     
    428437  Int         iHeight;
    429438  UInt        uiPartAddr;
     439#if H_3D_VSP
     440  UInt        uiAbsPartIdx = pcCU->getZorderIdxInCU();
     441#endif
    430442
    431443  if ( iPartIdx >= 0 )
    432444  {
    433445    pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight );
    434     if ( eRefPicList != REF_PIC_LIST_X )
    435     {
    436       if( pcCU->getSlice()->getPPS()->getUseWP())
    437       {
    438         xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, true );
     446#if H_3D_VSP
     447    if ( 0 == pcCU->getVSPFlag(uiPartAddr) )
     448    {
     449#endif
     450      if ( eRefPicList != REF_PIC_LIST_X )
     451      {
     452        if( pcCU->getSlice()->getPPS()->getUseWP())
     453        {
     454          xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, true );
     455        }
     456        else
     457        {
     458          xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred );
     459        }
     460        if ( pcCU->getSlice()->getPPS()->getUseWP() )
     461        {
     462          xWeightedPredictionUni( pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred );
     463        }
    439464      }
    440465      else
    441466      {
    442         xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred );
    443       }
    444       if ( pcCU->getSlice()->getPPS()->getUseWP() )
    445       {
    446         xWeightedPredictionUni( pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred );
    447       }
     467        if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) )
     468        {
     469          xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred );
     470        }
     471        else
     472        {
     473          xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred );
     474        }
     475      }
     476#if H_3D_VSP
    448477    }
    449478    else
    450479    {
    451480      if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) )
    452       {
    453         xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred );
    454       }
     481        xPredInterUniVSP( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred );
    455482      else
    456       {
    457         xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred );
    458       }
    459     }
     483        xPredInterBiVSP ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, pcYuvPred );
     484    }
     485#endif
    460486    return;
    461487  }
     
    465491    pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight );
    466492
    467     if ( eRefPicList != REF_PIC_LIST_X )
    468     {
    469       if( pcCU->getSlice()->getPPS()->getUseWP())
    470       {
    471         xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, true );
     493#if H_3D_VSP
     494    if ( 0 == pcCU->getVSPFlag(uiPartAddr) )
     495    {
     496#endif
     497      if ( eRefPicList != REF_PIC_LIST_X )
     498      {
     499        if( pcCU->getSlice()->getPPS()->getUseWP())
     500        {
     501          xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, true );
     502        }
     503        else
     504        {
     505          xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred );
     506        }
     507        if ( pcCU->getSlice()->getPPS()->getUseWP() )
     508        {
     509          xWeightedPredictionUni( pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred );
     510        }
    472511      }
    473512      else
    474513      {
    475         xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred );
    476       }
    477       if ( pcCU->getSlice()->getPPS()->getUseWP() )
    478       {
    479         xWeightedPredictionUni( pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred );
    480       }
     514        if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) )
     515        {
     516          xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred );
     517        }
     518        else
     519        {
     520          xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred );
     521        }
     522      }
     523#if H_3D_VSP
    481524    }
    482525    else
    483526    {
    484527      if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) )
    485       {
    486         xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred );
    487       }
     528        xPredInterUniVSP( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred );
    488529      else
    489       {
    490         xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred );
    491       }
    492     }
     530        xPredInterBiVSP ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, pcYuvPred );
     531    }
     532#endif
    493533  }
    494534  return;
     
    531571#endif
    532572}
     573
     574#if H_3D_VSP
     575Void TComPrediction::xPredInterUniVSP( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi )
     576{
     577  // Step 1: get depth reference
     578  Int depthRefViewIdx = pcCU->getDvInfo(uiPartAddr).m_aVIdxCan;
     579  TComPic* pRefPicBaseDepth = pcCU->getSlice()->getIvPic (true, depthRefViewIdx );
     580  assert(pRefPicBaseDepth != NULL);
     581  TComPicYuv* pcBaseViewDepthPicYuv = pRefPicBaseDepth->getPicYuvRec();
     582  assert(pcBaseViewDepthPicYuv != NULL);
     583
     584  // Step 2: get texture reference
     585  Int iRefIdx = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );
     586  assert(iRefIdx >= 0);
     587  TComPic* pRefPicBaseTxt = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx );
     588  TComPicYuv* pcBaseViewTxtPicYuv = pRefPicBaseTxt->getPicYuvRec();
     589  assert(pcBaseViewTxtPicYuv != NULL);
     590
     591  // Step 3: initialize the LUT according to the reference viewIdx
     592  Int txtRefViewIdx = pRefPicBaseTxt->getViewIndex();
     593  Int* pShiftLUT    = pcCU->getSlice()->getDepthToDisparityB( txtRefViewIdx );
     594
     595  // Step 4: Do compensation
     596  TComMv cMv  = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr );
     597  pcCU->clipMv(cMv);
     598  Int iBlkX = ( pcCU->getAddr() % pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
     599  Int iBlkY = ( pcCU->getAddr() / pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
     600  xPredInterLumaBlkFromDM  ( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, &cMv, uiPartAddr, iBlkX,    iBlkY,    iWidth,    iHeight,    pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi );
     601  xPredInterChromaBlkFromDM( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, &cMv, uiPartAddr, iBlkX>>1, iBlkY>>1, iWidth>>1, iHeight>>1, pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi );
     602}
     603#endif
    533604
    534605#if H_3D_ARP
     
    674745  }
    675746}
     747
     748#if H_3D_VSP
     749
     750Void TComPrediction::xPredInterBiVSP( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, TComYuv*& rpcYuvPred )
     751{
     752  TComYuv* pcMbYuv;
     753  Int      iRefIdx[2] = {-1, -1};
     754
     755  for ( Int iRefList = 0; iRefList < 2; iRefList++ )
     756  {
     757    RefPicList eRefPicList = RefPicList(iRefList);
     758    iRefIdx[iRefList] = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );
     759
     760    if ( iRefIdx[iRefList] < 0 )
     761      continue;
     762
     763    assert( iRefIdx[iRefList] < pcCU->getSlice()->getNumRefIdx(eRefPicList) );
     764
     765    pcMbYuv = &m_acYuvPred[iRefList];
     766    if( pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiPartAddr ) >= 0 && pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiPartAddr ) >= 0 )
     767      xPredInterUniVSP ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, true );
     768    else
     769      xPredInterUniVSP ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv );
     770  }
     771
     772  xWeightedAverage( &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred );
     773}
     774
     775#endif
    676776
    677777/**
     
    12831383}
    12841384#endif
     1385
     1386#if H_3D_VSP
     1387// Input:
     1388// refPic: Ref picture. Full picture, with padding
     1389// posX, posY:     PU position, texture
     1390// sizeX, sizeY: PU size
     1391// partAddr: z-order index
     1392// mv: disparity vector. derived from neighboring blocks
     1393//
     1394// Output: dstPic, PU predictor 64x64
     1395Void TComPrediction::xPredInterLumaBlkFromDM( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, TComMv* mv, UInt partAddr,Int posX, Int posY
     1396                                            , Int sizeX, Int sizeY, Bool isDepth, TComYuv *&dstPic, Bool bi )
     1397{
     1398  Int widthLuma;
     1399  Int heightLuma;
     1400
     1401  if (isDepth)
     1402  {
     1403    widthLuma   =  pPicBaseDepth->getWidth();
     1404    heightLuma  =  pPicBaseDepth->getHeight();
     1405  }
     1406  else
     1407  {
     1408    widthLuma   =  refPic->getWidth();
     1409    heightLuma  =  refPic->getHeight();
     1410  }
     1411
     1412#if H_3D_VSP_BLOCKSIZE != 1
     1413  Int widthDepth  = pPicBaseDepth->getWidth();
     1414  Int heightDepth = pPicBaseDepth->getHeight();
     1415#endif
     1416
     1417#if H_3D_VSP_CONSTRAINED
     1418  Int widthDepth  = pPicBaseDepth->getWidth();
     1419  Int heightDepth = pPicBaseDepth->getHeight();
     1420#endif
     1421
     1422  Int nTxtPerDepthX = widthLuma  / ( pPicBaseDepth->getWidth() );  // texture pixel # per depth pixel
     1423  Int nTxtPerDepthY = heightLuma / ( pPicBaseDepth->getHeight() );
     1424
     1425  Int refStride = refPic->getStride();
     1426  Int dstStride = dstPic->getStride();
     1427  Int depStride =  pPicBaseDepth->getStride();
     1428  Int depthPosX = Clip3(0,   widthLuma - sizeX,  (posX/nTxtPerDepthX) + ((mv->getHor()+2)>>2));
     1429  Int depthPosY = Clip3(0,   heightLuma- sizeY,  (posY/nTxtPerDepthY) + ((mv->getVer()+2)>>2));
     1430  Pel *ref    = refPic->getLumaAddr() + posX + posY * refStride;
     1431  Pel *dst    = dstPic->getLumaAddr(partAddr);
     1432  Pel *depth  = pPicBaseDepth->getLumaAddr() + depthPosX + depthPosY * depStride;
     1433
     1434#if H_3D_VSP_BLOCKSIZE != 1
     1435#if H_3D_VSP_BLOCKSIZE == 2
     1436  Int  dW = sizeX>>1;
     1437  Int  dH = sizeY>>1;
     1438#endif
     1439#if H_3D_VSP_BLOCKSIZE == 4
     1440  Int  dW = sizeX>>2;
     1441  Int  dH = sizeY>>2;
     1442#endif
     1443  {
     1444    Pel* depthi = depth;
     1445    for (Int j = 0; j < dH; j++)
     1446    {
     1447      for (Int i = 0; i < dW; i++)
     1448      {
     1449        Pel* depthTmp;
     1450#if H_3D_VSP_BLOCKSIZE == 2
     1451        if (depthPosX + (i<<1) < widthDepth)
     1452          depthTmp = depthi + (i << 1);
     1453        else
     1454          depthTmp = depthi + (widthDepth - depthPosX - 1);
     1455#endif
     1456#if H_3D_VSP_BLOCKSIZE == 4
     1457        if (depthPosX + (i<<2) < widthDepth)
     1458          depthTmp = depthi + (i << 2);
     1459        else
     1460          depthTmp = depthi + (widthDepth - depthPosX - 1);
     1461#endif
     1462        Int maxV = 0;
     1463        for (Int blockj = 0; blockj < H_3D_VSP_BLOCKSIZE; blockj+=(H_3D_VSP_BLOCKSIZE-1))
     1464        {
     1465          Int iX = 0;
     1466          for (Int blocki = 0; blocki < H_3D_VSP_BLOCKSIZE; blocki+=(H_3D_VSP_BLOCKSIZE-1))
     1467          {
     1468            if (maxV < depthTmp[iX])
     1469              maxV = depthTmp[iX];
     1470#if H_3D_VSP_BLOCKSIZE == 2
     1471            if (depthPosX + (i<<1) + blocki < widthDepth - 1)
     1472#else // H_3D_VSP_BLOCKSIZE == 4
     1473            if (depthPosX + (i<<2) + blocki < widthDepth - 1)
     1474#endif
     1475              iX = (H_3D_VSP_BLOCKSIZE-1);
     1476          }
     1477#if H_3D_VSP_BLOCKSIZE == 2
     1478          if (depthPosY + (j<<1) + blockj < heightDepth - 1)
     1479#else // H_3D_VSP_BLOCKSIZE == 4
     1480          if (depthPosY + (j<<2) + blockj < heightDepth - 1)
     1481#endif
     1482            depthTmp += depStride * (H_3D_VSP_BLOCKSIZE-1);
     1483        }
     1484        m_pDepthBlock[i+j*dW] = maxV;
     1485      } // end of i < dW
     1486#if H_3D_VSP_BLOCKSIZE == 2
     1487      if (depthPosY + ((j+1)<<1) < heightDepth)
     1488        depthi += (depStride << 1);
     1489      else
     1490        depthi  = depth + (heightDepth-depthPosY-1)*depStride;
     1491#endif
     1492#if H_3D_VSP_BLOCKSIZE == 4
     1493      if (depthPosY + ((j+1)<<2) < heightDepth) // heightDepth-1
     1494        depthi += (depStride << 2);
     1495      else
     1496        depthi  = depth + (heightDepth-depthPosY-1)*depStride; // the last line
     1497#endif
     1498    }
     1499  }
     1500#endif // H_3D_VSP_BLOCKSIZE != 1
     1501
     1502#if H_3D_VSP_BLOCKSIZE == 1
     1503#if H_3D_VSP_CONSTRAINED
     1504  //get LUT based horizontal reference range
     1505  Int range = xGetConstrainedSize(sizeX, sizeY);
     1506
     1507  // The minimum depth value
     1508  Int minRelativePos = MAX_INT;
     1509  Int maxRelativePos = MIN_INT;
     1510
     1511  Pel* depthTemp, *depthInitial=depth;
     1512  for (Int yTxt =0; yTxt<sizeY; yTxt++)
     1513  {
     1514    for (Int xTxt =0; xTxt<sizeX; xTxt++)
     1515    {
     1516      if (depthPosX+xTxt < widthDepth)
     1517        depthTemp = depthInitial + xTxt;
     1518      else
     1519        depthTemp = depthInitial + (widthDepth - depthPosX - 1);
     1520
     1521      Int disparity = pShiftLUT[ *depthTemp ]; // << iShiftPrec;
     1522      Int disparityInt = disparity >> 2;
     1523
     1524      if( disparity <= 0)
     1525      {
     1526        if (minRelativePos > disparityInt+xTxt)
     1527            minRelativePos = disparityInt+xTxt;
     1528      }
     1529      else
     1530      {
     1531        if (maxRelativePos < disparityInt+xTxt)
     1532            maxRelativePos = disparityInt+xTxt;
     1533      }
     1534    }
     1535    if (depthPosY+yTxt < heightDepth)
     1536      depthInitial = depthInitial + depStride;
     1537  }
     1538
     1539  Int disparity_tmp = pShiftLUT[ *depth ]; // << iShiftPrec;
     1540  if (disparity_tmp <= 0)
     1541    maxRelativePos = minRelativePos + range -1 ;
     1542  else
     1543    minRelativePos = maxRelativePos - range +1 ;
     1544#endif
     1545#endif // H_3D_VSP_BLOCKSIZE == 1
     1546
     1547#if H_3D_VSP_BLOCKSIZE != 1
     1548  Int yDepth = 0;
     1549#endif
     1550  for ( Int yTxt = 0; yTxt < sizeY; yTxt += nTxtPerDepthY )
     1551  {
     1552    for ( Int xTxt = 0, xDepth = 0; xTxt < sizeX; xTxt += nTxtPerDepthX, xDepth++ )
     1553    {
     1554      Pel repDepth = 0; // to store the depth value used for warping
     1555#if H_3D_VSP_BLOCKSIZE == 1
     1556      repDepth = depth[xDepth];
     1557#endif
     1558#if H_3D_VSP_BLOCKSIZE == 2
     1559      repDepth = m_pDepthBlock[(xTxt>>1) + (yTxt>>1)*dW];
     1560#endif
     1561#if H_3D_VSP_BLOCKSIZE == 4
     1562      repDepth = m_pDepthBlock[(xTxt>>2) + (yTxt>>2)*dW];
     1563#endif
     1564
     1565      assert( repDepth >= 0 && repDepth <= 255 );
     1566      Int disparity = pShiftLUT[ repDepth ]; // remove << iShiftPrec ??
     1567      Int refOffset = xTxt + (disparity >> 2);
     1568      Int xFrac = disparity & 0x3;
     1569#if H_3D_VSP_CONSTRAINED
     1570      if(refOffset<minRelativePos || refOffset>maxRelativePos)
     1571        xFrac = 0;
     1572      refOffset = Clip3(minRelativePos, maxRelativePos, refOffset);
     1573#endif
     1574      Int absX  = posX + refOffset;
     1575
     1576      if (xFrac == 0)
     1577        absX = Clip3(0, widthLuma-1, absX);
     1578      else
     1579        absX = Clip3(4, widthLuma-5, absX);
     1580
     1581      refOffset = absX - posX;
     1582
     1583      assert( ref[refOffset] >= 0 && ref[refOffset]<= 255 );
     1584      m_if.filterHorLuma( &ref[refOffset], refStride, &dst[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !bi );
     1585
     1586    }
     1587    ref   += refStride*nTxtPerDepthY;
     1588    dst   += dstStride*nTxtPerDepthY;
     1589    depth += depStride;
     1590#if H_3D_VSP_BLOCKSIZE != 1
     1591    yDepth++;
     1592#endif
     1593
     1594  }
     1595}
     1596
     1597Void TComPrediction::xPredInterChromaBlkFromDM ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, TComMv*mv, UInt partAddr, Int posX, Int posY
     1598                                               , Int sizeX, Int sizeY, Bool isDepth, TComYuv *&dstPic, Bool bi)
     1599{
     1600  Int refStride = refPic->getCStride();
     1601  Int dstStride = dstPic->getCStride();
     1602  Int depStride = pPicBaseDepth->getStride();
     1603
     1604  Int widthChroma, heightChroma;
     1605  if( isDepth)
     1606  {
     1607     widthChroma   = pPicBaseDepth->getWidth()>>1;
     1608     heightChroma  = pPicBaseDepth->getHeight()>>1;
     1609  }
     1610  else
     1611  {
     1612     widthChroma   = refPic->getWidth()>>1;
     1613     heightChroma  = refPic->getHeight()>>1;
     1614  }
     1615
     1616  // Below is only for Texture chroma component
     1617
     1618  Int widthDepth  = pPicBaseDepth->getWidth();
     1619  Int heightDepth = pPicBaseDepth->getHeight();
     1620
     1621  Int nTxtPerDepthX, nTxtPerDepthY;  // Number of texture samples per one depth sample
     1622  Int nDepthPerTxtX, nDepthPerTxtY;  // Number of depth samples per one texture sample
     1623
     1624  Int depthPosX;  // Starting position in depth image
     1625  Int depthPosY;
     1626
     1627  if ( widthChroma > widthDepth )
     1628  {
     1629    nTxtPerDepthX = widthChroma / widthDepth;
     1630    nDepthPerTxtX = 1;
     1631    depthPosX = posX / nTxtPerDepthX + ((mv->getHor()+2)>>2);
     1632  }
     1633  else
     1634  {
     1635    nTxtPerDepthX = 1;
     1636    nDepthPerTxtX = widthDepth / widthChroma;
     1637    depthPosX = posX * nDepthPerTxtX + ((mv->getHor()+2)>>2);
     1638  }
     1639  depthPosX = Clip3(0, widthDepth - (sizeX<<1), depthPosX);
     1640  if ( heightChroma > heightDepth )
     1641  {
     1642    nTxtPerDepthY = heightChroma / heightDepth;
     1643    nDepthPerTxtY = 1;
     1644    depthPosY = posY / nTxtPerDepthY + ((mv->getVer()+2)>>2);
     1645  }
     1646  else
     1647  {
     1648    nTxtPerDepthY = 1;
     1649    nDepthPerTxtY = heightDepth / heightChroma;
     1650    depthPosY = posY * nDepthPerTxtY + ((mv->getVer()+2)>>2);
     1651  }
     1652  depthPosY = Clip3(0, heightDepth - (sizeY<<1), depthPosY);
     1653
     1654  Pel *refCb  = refPic->getCbAddr() + posX + posY * refStride;
     1655  Pel *refCr  = refPic->getCrAddr() + posX + posY * refStride;
     1656  Pel *dstCb  = dstPic->getCbAddr(partAddr);
     1657  Pel *dstCr  = dstPic->getCrAddr(partAddr);
     1658  Pel *depth  = pPicBaseDepth->getLumaAddr() + depthPosX + depthPosY * depStride;  // move the pointer to the current depth pixel position
     1659
     1660  Int refStrideBlock = refStride * nTxtPerDepthY;
     1661  Int dstStrideBlock = dstStride * nTxtPerDepthY;
     1662  Int depStrideBlock = depStride * nDepthPerTxtY;
     1663
     1664  if ( widthChroma > widthDepth ) // We assume
     1665  {
     1666    assert( heightChroma > heightDepth );
     1667    printf("This branch should never been reached.\n");
     1668    exit(0);
     1669  }
     1670  else
     1671  {
     1672#if H_3D_VSP_BLOCKSIZE == 1
     1673  Int  dW = sizeX;
     1674  Int  dH = sizeY;
     1675  Int  sW = 2; // search window size
     1676  Int  sH = 2;
     1677#endif
     1678#if H_3D_VSP_BLOCKSIZE == 2
     1679  Int  dW = sizeX;
     1680  Int  dH = sizeY;
     1681  Int  sW = 2; // search window size
     1682  Int  sH = 2;
     1683#endif
     1684#if H_3D_VSP_BLOCKSIZE == 4
     1685  Int  dW = sizeX>>1;
     1686  Int  dH = sizeY>>1;
     1687  Int  sW = 4; // search window size
     1688  Int  sH = 4;
     1689#endif
     1690
     1691  {
     1692    Pel* depthi = depth;
     1693    for (Int j = 0; j < dH; j++)
     1694    {
     1695      for (Int i = 0; i < dW; i++)
     1696      {
     1697        Pel* depthTmp;
     1698#if H_3D_VSP_BLOCKSIZE == 1
     1699        depthTmp = depthi + (i << 1);
     1700#endif
     1701#if H_3D_VSP_BLOCKSIZE == 2
     1702        if (depthPosX + (i<<1) < widthDepth)
     1703          depthTmp = depthi + (i << 1);
     1704        else
     1705          depthTmp = depthi + (widthDepth - depthPosX - 1);
     1706#endif
     1707#if H_3D_VSP_BLOCKSIZE == 4
     1708        if (depthPosX + (i<<2) < widthDepth)
     1709          depthTmp = depthi + (i << 2);
     1710        else
     1711          depthTmp = depthi + (widthDepth - depthPosX - 1);
     1712#endif
     1713        Int maxV = 0;
     1714        for (Int blockj = 0; blockj < sH; blockj+=(sH-1))
     1715        {
     1716          Int iX = 0;
     1717          for (Int blocki = 0; blocki < sW; blocki+=(sW-1))
     1718          {
     1719            if (maxV < depthTmp[iX])
     1720              maxV = depthTmp[iX];
     1721            if (depthPosX + i*sW + blocki < widthDepth - 1)
     1722                iX = (sW-1);
     1723          }
     1724          if (depthPosY + j*sH + blockj < heightDepth - 1)
     1725                depthTmp += depStride * (sH-1);
     1726        }
     1727        m_pDepthBlock[i+j*dW] = maxV;
     1728      } // end of i < dW
     1729#if H_3D_VSP_BLOCKSIZE == 1
     1730      if (depthPosY + ((j+1)<<1) < heightDepth)
     1731        depthi += (depStride << 1);
     1732      else
     1733        depthi  = depth + (heightDepth-1)*depStride;
     1734#endif
     1735#if H_3D_VSP_BLOCKSIZE == 2
     1736      if (depthPosY + ((j+1)<<1) < heightDepth)
     1737        depthi += (depStride << 1);
     1738      else
     1739        depthi  = depth + (heightDepth-depthPosY-1)*depStride;
     1740#endif
     1741#if H_3D_VSP_BLOCKSIZE == 4
     1742      if (depthPosY + ((j+1)<<2) < heightDepth) // heightDepth-1
     1743        depthi += (depStride << 2);
     1744      else
     1745        depthi  = depth + (heightDepth-depthPosY-1)*depStride; // the last line
     1746#endif
     1747    }
     1748  }
     1749
     1750
     1751#if H_3D_VSP_BLOCKSIZE == 1
     1752#if H_3D_VSP_CONSTRAINED
     1753  //get LUT based horizontal reference range
     1754  Int range = xGetConstrainedSize(sizeX, sizeY, false);
     1755
     1756  // The minimum depth value
     1757  Int minRelativePos = MAX_INT;
     1758  Int maxRelativePos = MIN_INT;
     1759
     1760  Int depthTmp;
     1761  for (Int yTxt=0; yTxt<sizeY; yTxt++)
     1762  {
     1763    for (Int xTxt=0; xTxt<sizeX; xTxt++)
     1764    {
     1765      depthTmp = m_pDepthBlock[xTxt+yTxt*dW];
     1766      Int disparity = pShiftLUT[ depthTmp ]; // << iShiftPrec;
     1767      Int disparityInt = disparity >> 3;//in chroma resolution
     1768
     1769      if (disparityInt < 0)
     1770      {
     1771        if (minRelativePos > disparityInt+xTxt)
     1772            minRelativePos = disparityInt+xTxt;
     1773      }
     1774      else
     1775      {
     1776        if (maxRelativePos < disparityInt+xTxt)
     1777            maxRelativePos = disparityInt+xTxt;
     1778      }
     1779    }
     1780  }
     1781
     1782  depthTmp = m_pDepthBlock[0];
     1783  Int disparity_tmp = pShiftLUT[ depthTmp ]; // << iShiftPrec;
     1784  if ( disparity_tmp < 0 )
     1785    maxRelativePos = minRelativePos + range - 1;
     1786  else
     1787    minRelativePos = maxRelativePos - range + 1;
     1788
     1789#endif // H_3D_VSP_CONSTRAINED
     1790#endif // H_3D_VSP_BLOCKSIZE == 1
     1791
     1792    // (sizeX, sizeY) is Chroma block size
     1793    for ( Int yTxt = 0, yDepth = 0; yTxt < sizeY; yTxt += nTxtPerDepthY, yDepth += nDepthPerTxtY )
     1794    {
     1795      for ( Int xTxt = 0, xDepth = 0; xTxt < sizeX; xTxt += nTxtPerDepthX, xDepth += nDepthPerTxtX )
     1796      {
     1797        Pel repDepth = 0; // to store the depth value used for warping
     1798#if H_3D_VSP_BLOCKSIZE == 1
     1799        repDepth = m_pDepthBlock[(xTxt) + (yTxt)*dW];
     1800#endif
     1801#if H_3D_VSP_BLOCKSIZE == 2
     1802        repDepth = m_pDepthBlock[(xTxt) + (yTxt)*dW];
     1803#endif
     1804#if H_3D_VSP_BLOCKSIZE == 4
     1805        repDepth = m_pDepthBlock[(xTxt>>1) + (yTxt>>1)*dW];
     1806#endif
     1807
     1808      // calculate the offset in the reference picture
     1809        Int disparity = pShiftLUT[ repDepth ]; // Remove << iShiftPrec;
     1810        Int refOffset = xTxt + (disparity >> 3); // in integer pixel in chroma image
     1811        Int xFrac = disparity & 0x7;
     1812#if H_3D_VSP_CONSTRAINED
     1813        if(refOffset < minRelativePos || refOffset > maxRelativePos)
     1814          xFrac = 0;
     1815        refOffset = Clip3(minRelativePos, maxRelativePos, refOffset);
     1816#endif
     1817        Int absX  = posX + refOffset;
     1818
     1819        if (xFrac == 0)
     1820          absX = Clip3(0, widthChroma-1, absX);
     1821        else
     1822          absX = Clip3(4, widthChroma-5, absX);
     1823
     1824        refOffset = absX - posX;
     1825
     1826        assert( refCb[refOffset] >= 0 && refCb[refOffset]<= 255 );
     1827        assert( refCr[refOffset] >= 0 && refCr[refOffset]<= 255 );
     1828        m_if.filterHorChroma(&refCb[refOffset], refStride, &dstCb[xTxt],  dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !bi);
     1829        m_if.filterHorChroma(&refCr[refOffset], refStride, &dstCr[xTxt],  dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !bi);
     1830      }
     1831      refCb += refStrideBlock;
     1832      refCr += refStrideBlock;
     1833      dstCb += dstStrideBlock;
     1834      dstCr += dstStrideBlock;
     1835      depth += depStrideBlock;
     1836    }
     1837  }
     1838
     1839}
     1840
     1841#if H_3D_VSP_CONSTRAINED
     1842
     1843Int TComPrediction::xGetConstrainedSize(Int nPbW, Int nPbH, Bool bLuma)
     1844{
     1845  Int iSize = 0;
     1846  if (bLuma)
     1847  {
     1848    Int iArea = (nPbW+7) * (nPbH+7);
     1849    Int iAlpha = iArea / nPbH - nPbW - 7;
     1850    iSize = iAlpha + nPbW;
     1851  }
     1852  else // chroma
     1853  {
     1854    Int iArea = (nPbW+2) * (nPbH+2);
     1855    Int iAlpha = iArea / nPbH - nPbW - 4;
     1856    iSize = iAlpha + nPbW;
     1857  }
     1858  return iSize;
     1859}
     1860
     1861#endif
     1862
     1863
     1864#endif
     1865
     1866
    12851867//! \}
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComPrediction.h

    r504 r510  
    7878  UInt   m_uiaShift[ 63 ];       // Table for multiplication to substitue of division operation
    7979#endif
     80
     81#if H_3D_VSP
     82  Int*   m_pDepthBlock; ///< Local variable, to store a depth block, just to prevent allocate memory every time
     83#if H_3D_VSP_CONSTRAINED
     84  Int  xGetConstrainedSize(Int nPbW, Int nPbH, Bool bLuma = true);
     85#endif
     86#endif
     87
    8088  Void xPredIntraAng            (Int bitDepth, Int* pSrc, Int srcStride, Pel*& rpDst, Int dstStride, UInt width, UInt height, UInt dirMode, Bool blkAboveAvailable, Bool blkLeftAvailable, Bool bFilter );
    8189  Void xPredIntraPlanar         ( Int* pSrc, Int srcStride, Pel* rpDst, Int dstStride, UInt width, UInt height );
     
    8391  // motion compensation functions
    8492#if H_3D_ARP
    85   Void xPredInterUniARP         ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false, TComMvField * pNewMvFiled = NULL );
     93  Void xPredInterUniARP         ( TComDataCU* pcCU,                          UInt uiPartAddr,                    Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false, TComMvField * pNewMvFiled = NULL );
    8694#endif
    87   Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false          );
    88   Void xPredInterBi             ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight,                         TComYuv*& rpcYuvPred );
    89   Void xPredInterLumaBlk  ( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi
     95  Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,                    Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false          );
     96  Void xPredInterBi             ( TComDataCU* pcCU,                          UInt uiPartAddr,                    Int iWidth, Int iHeight,                         TComYuv*& rpcYuvPred );
     97#if H_3D_VSP
     98  Void xPredInterUniVSP         ( TComDataCU* pcCU,                          UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false          );
     99  Void xPredInterBiVSP          ( TComDataCU* pcCU,                          UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight,                         TComYuv*& rpcYuvPred );
     100#endif
     101
     102  Void xPredInterLumaBlk  ( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi
    90103#if H_3D_ARP
    91104    , Bool filterType = false
     
    95108#endif
    96109    );
    97   Void xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi
     110  Void xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi
     111
    98112#if H_3D_ARP
    99113    , Bool filterType = false
     
    103117#endif
    104118    );
     119
     120#if H_3D_VSP
     121  Void xPredInterLumaBlkFromDM  ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, TComMv* mv, UInt partAddr,Int posX, Int posY, Int sizeX, Int sizeY, Bool isDepth
     122                                , TComYuv *&dstPic
     123                                , Bool bi );
     124  Void xPredInterChromaBlkFromDM( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, TComMv*mv, UInt partAddr, Int posX, Int posY, Int sizeX, Int sizeY, Bool isDepth
     125                                , TComYuv *&dstPic
     126                                , Bool bi );
     127#endif
     128
    105129  Void xWeightedAverage         ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst );
    106130 
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComSlice.h

    r504 r510  
    532532#endif
    533533#if H_3D_VSP
    534   Bool        m_viewSynthesisPredFlag    [ MAX_NUM_LAYERS ]; 
     534  Bool        m_viewSynthesisPredFlag    [ MAX_NUM_LAYERS ];
    535535#endif
    536536#if H_3D_NBDV_REF
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TypeDef.h

    r504 r510  
    9696                                              // MTK_D0156
    9797                                              // MERL_VSP_NBDV_RefVId_Fix_D0166
    98 #endif
    99 #define H_3D_VSP                          0   // Depth oriented neighboring block disparity derivation
     98                                              // MERL_C0152
     99#endif
     100#define H_3D_VSP                          1   // View syntheis prediction, C0152, D0166, D0092,
     101                                              // MTK_D0105, LG_D0139: No VSP for depth
     102                                              // MTK_D0156,
     103                                              // MERL_C0152: Basic VSP
     104                                              // QC_D0191: Clean up
     105                                              // LG_D0092: Multiple VSP candidate allowed
     106                                              // MTK_D0105: No VSP for depth. Single depth fetching for DoNBDV and VSP
     107                                              //
     108                                              //
     109
     110#if H_3D_VSP
     111#define H_3D_VSP_POSITION                 3   // The only supported position
     112#define H_3D_VSP_BLOCKSIZE                1   // Supported values: 1, 2, and 4
     113#if H_3D_VSP_BLOCKSIZE == 1
     114#define H_3D_VSP_CONSTRAINED              1   // Constrained VSP @ 1x1
     115#else
     116#define H_3D_VSP_CONSTRAINED              0
     117#endif
     118#endif
    100119
    101120#define H_3D_IV_MERGE                     1   // Inter-view motion merge candidate
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecCu.cpp

    r504 r510  
    347347    m_pcEntropyDecoder->decodeMergeIndex( pcCU, 0, uiAbsPartIdx, uiDepth );
    348348    UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx);
     349
     350#if H_3D_VSP
     351    Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
     352    memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
     353
     354    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, numValidMergeCand, uiMergeIndex );
     355    pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
     356#else
    349357    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
     358#endif
     359
    350360    pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
    351361
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecEntropy.cpp

    r504 r510  
    225225        if ( !isMerged )
    226226        {
     227#if H_3D_VSP
     228          Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
     229          memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
     230          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, numValidMergeCand );
     231          pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
     232#else
    227233          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
     234#endif
    228235          isMerged = true;
    229236        }
     
    232239      else
    233240      {
    234         uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
     241        uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); // Redundant line
     242#if H_3D_VSP
     243        Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
     244        memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
     245        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, numValidMergeCand, uiMergeIndex );
     246        pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
     247#else
    235248        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
     249#endif
    236250      }
    237251      pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncCu.cpp

    r504 r510  
    13541354  rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level
    13551355  rpcTempCU->setCUTransquantBypassSubParts( m_pcEncCfg->getCUTransquantBypassFlagValue(), 0, uhDepth );
     1356
     1357#if H_3D_VSP
     1358  Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
     1359  memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
     1360  rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, vspFlag, numValidMergeCand );
     1361#else
    13561362  rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand );
     1363#endif
    13571364
    13581365#if H_3D_IV_MERGE
     
    14191426          rpcTempCU->setMergeFlagSubParts( true, 0, 0, uhDepth ); // interprets depth relative to LCU level
    14201427          rpcTempCU->setMergeIndexSubParts( uiMergeCand, 0, 0, uhDepth ); // interprets depth relative to LCU level
     1428#if H_3D_VSP
     1429          rpcTempCU->setVSPFlagSubParts( vspFlag[uiMergeCand], 0, 0, uhDepth );
     1430#endif
    14211431          rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level
    14221432          rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncGOP.cpp

    r504 r510  
    821821    }
    822822
     823    // A bug fix provided by Gerhard to deal with IBP configuration. NEED futher study
     824#if H_MV
     825    if( pcSlice->getIdrPicFlag() )
     826    {
     827      pcSlice->setEnableTMVPFlag(0);
     828    }
     829#endif
     830
    823831#if H_3D_VSO
    824832  // Should be moved to TEncTop !!!
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncSearch.cpp

    r504 r510  
    31713171 * \returns Void
    31723172 */
    3173 Void TEncSearch::xMergeEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPUIdx, UInt& uiInterDir, TComMvField* pacMvField, UInt& uiMergeIndex, UInt& ruiCost, TComMvField* cMvFieldNeighbours, UChar* uhInterDirNeighbours, Int& numValidMergeCand )
     3173Void TEncSearch::xMergeEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPUIdx, UInt& uiInterDir, TComMvField* pacMvField, UInt& uiMergeIndex, UInt& ruiCost, TComMvField* cMvFieldNeighbours, UChar* uhInterDirNeighbours
     3174#if H_3D_VSP
     3175                                 , Int* vspFlag
     3176#endif
     3177                                 , Int& numValidMergeCand
     3178                                 )
    31743179{
    31753180  UInt uiAbsPartIdx = 0;
     
    31853190    if ( iPUIdx == 0 )
    31863191    {
    3187       pcCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand );
     3192      pcCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours
     3193#if H_3D_VSP
     3194                                   , vspFlag
     3195#endif
     3196                                   , numValidMergeCand
     3197                                   );
    31883198    }
    31893199    pcCU->setPartSizeSubParts( partSize, 0, uiDepth );
     
    31913201  else
    31923202  {
    3193     pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
     3203    pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours
     3204#if H_3D_VSP
     3205                                 , vspFlag
     3206#endif
     3207                                 , numValidMergeCand
     3208                                 );
    31943209  }
    31953210  xRestrictBipredMergeCand( pcCU, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
     
    32063221      pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx );
    32073222      pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx );
     3223
     3224#if H_3D_VSP
     3225      pcCU->setVSPFlagSubParts( vspFlag[uiMergeCand], uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx ) );
     3226#endif
    32083227
    32093228      xGetInterPredictionError( pcCU, pcYuvOrg, iPUIdx, uiCostCand, m_pcEncCfg->getUseHADME() );
     
    33623381   
    33633382    pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRoiWidth, iRoiHeight );
     3383
     3384#if H_3D_VSP
     3385    pcCU->setVSPFlagSubParts( 0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr) );
     3386#endif
    33643387   
    33653388#if AMP_MRG
     
    39653988      // find Merge result
    39663989      UInt uiMRGCost = MAX_UINT;
    3967       xMergeEstimation( pcCU, pcOrgYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand);
     3990#if H_3D_VSP
     3991      Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
     3992      memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
     3993#endif
     3994
     3995      xMergeEstimation( pcCU, pcOrgYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost, cMvFieldNeighbours, uhInterDirNeighbours
     3996#if H_3D_VSP
     3997                      , vspFlag
     3998#endif
     3999                      , numValidMergeCand
     4000                      );
    39684001      if ( uiMRGCost < uiMECost )
    39694002      {
     
    39714004        pcCU->setMergeFlagSubParts ( true,          uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
    39724005        pcCU->setMergeIndexSubParts( uiMRGIndex,    uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
     4006#if H_3D_VSP
     4007        pcCU->setVSPFlagSubParts( vspFlag[uiMRGIndex], uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
     4008#endif
    39734009        pcCU->setInterDirSubParts  ( uiMRGInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
    39744010        {
     
    39904026        pcCU->setMergeFlagSubParts( false,        uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
    39914027        pcCU->setInterDirSubParts ( uiMEInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
     4028#if H_3D_VSP
     4029        pcCU->setVSPFlagSubParts ( 0,             uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
     4030#endif
    39924031        {
    39934032          pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMEMvField[0], ePartSize, uiPartAddr, 0, iPartIdx );
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncSearch.h

    r446 r510  
    380380                                    UInt&           ruiCost
    381381                                  , TComMvField* cMvFieldNeighbours, 
    382                                     UChar* uhInterDirNeighbours,
    383                                     Int& numValidMergeCand
     382                                    UChar* uhInterDirNeighbours
     383#if H_3D_VSP
     384                                  , Int* vspFlag
     385#endif
     386                                  , Int& numValidMergeCand
    384387                                   );
    385388
Note: See TracChangeset for help on using the changeset viewer.