Ignore:
Timestamp:
18 Jun 2013, 05:16:27 (12 years ago)
Author:
mediatek-htm
Message:

Integration of 3D-HEVC merge related coding tools:
Inter-view motion merge candidate
HHI_INTER_VIEW_MOTION_PRED
SAIT_IMPROV_MOTION_PRED_M24829, improved inter-view motion vector prediction
QC_MRG_CANS_B0048 , JCT3V-B0048, B0086, B0069
OL_DISMV_POS_B0069 , different pos for disparity MV candidate, B0069
MTK_INTERVIEW_MERGE_A0049 , second part
QC_AMVP_MRG_UNIFY_IVCAN_C0051
TEXTURE MERGING CANDIDATE , JCT3V-C0137

Notes: Two configurations are added:
PredDepthMapGen : 1
MultiviewMvPred : 7

From: yiwen.chen@… (MediaTek)

Location:
branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon
Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/CommonDef.h

    r447 r476  
    178178}
    179179
     180#if H_3D_IV_MERGE
     181#define ROFVS( exp )          \
     182{                             \
     183  if( !( exp ) )              \
     184{                           \
     185  return;                   \
     186}                           \
     187}
     188
     189#define ROTVS( exp )          \
     190{                             \
     191  if( ( exp ) )               \
     192{                           \
     193  return;                   \
     194}                           \
     195}
     196
     197#define ROTRS( exp, retVal )  \
     198{                             \
     199  if( ( exp ) )               \
     200{                           \
     201  return retVal;            \
     202}                           \
     203}
     204
     205#define ROFRS( exp, retVal )  \
     206{                             \
     207  if( !( exp ) )              \
     208{                           \
     209  return retVal;            \
     210}                           \
     211}
     212#endif
     213
    180214template <typename T>
    181215__inline T gSign(const T& t)
     
    200234// MERGE
    201235#define MRG_MAX_NUM_CANDS           5
    202 
     236#if H_3D_IV_MERGE
     237#define MRG_MAX_NUM_CANDS_MEM       (MRG_MAX_NUM_CANDS+1) // one extra for inter-view motion prediction
     238#endif
    203239// Reference memory management
    204240#define DYN_REF_FREE                0           ///< dynamic free of reference memories
     
    325361#define STD_CAM_PARAMETERS_PRECISION 5        ///< quarter luma sample accuarcy for derived disparities (as default)
    326362
     363#if H_3D_IV_MERGE
     364#define PDM_USE_FOR_IVIEW                 1
     365#define PDM_USE_FOR_INTER                 2
     366#define PDM_USE_FOR_MERGE                 4
     367
     368#define MAX_VIEW_NUM                      10
     369#define PDM_SUBSAMPLING_EXP               2         // subsampling factor is 2^PDM_SUBSAMPLING_EXP
     370#define PDM_SUB_SAMP_EXP_X(Pdm)           ((Pdm)==1?PDM_SUBSAMPLING_EXP:0)
     371#define PDM_SUB_SAMP_EXP_Y(Pdm)           ((Pdm)==1?PDM_SUBSAMPLING_EXP:0)
     372
     373#define PDM_INTERNAL_CALC_BIT_DEPTH       31        // bit depth for internal calculations (32 - 1 for signed values)
     374#define PDM_BITDEPTH_VIRT_DEPTH           15        // bit depth for virtual depth storage (16 - 1 for signed values)
     375#define PDM_LOG2_MAX_ABS_NORMAL_DISPARITY 8         // maximum absolute normal disparity = 256 (for setting accuracy)
     376#define PDM_VIRT_DEPTH_PRECISION          4         // must be greater than or equal to 2 (since MVs are given in quarter-pel units)
     377
     378#define PDM_INTER_CALC_SHIFT              ( PDM_INTERNAL_CALC_BIT_DEPTH - PDM_BITDEPTH_VIRT_DEPTH )         // avoids overflow
     379#define PDM_LOG4_SCALE_DENOMINATOR        ( PDM_LOG2_MAX_ABS_NORMAL_DISPARITY + PDM_VIRT_DEPTH_PRECISION )  // accuracy of scaling factor
     380#define PDM_OFFSET_SHIFT                  ( PDM_LOG2_MAX_ABS_NORMAL_DISPARITY )                             // accuracy of offset
     381
     382#endif
     383
    327384#endif // end of H_3D
    328385//! \}
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComDataCU.cpp

    r456 r476  
    4040#include "TComPic.h"
    4141
     42#if H_3D_IV_MERGE
     43#include "TComDepthMapGenerator.h"
     44#endif
    4245//! \ingroup TLibCommon
    4346//! \{
     
    24262429{
    24272430  UInt uiAbsPartAddr = m_uiAbsIdxInLCU + uiAbsPartIdx;
     2431#if H_3D_IV_MERGE
     2432  TComMv cZeroMv;
     2433  Bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ];
     2434#else
    24282435  Bool abCandIsInter[ MRG_MAX_NUM_CANDS ];
     2436#endif
    24292437  for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ++ui )
    24302438  {
    24312439    abCandIsInter[ui] = false;
     2440#if H_3D_IV_MERGE
     2441    pcMvFieldNeighbours[ ( ui << 1 )     ].setMvField(cZeroMv, NOT_VALID);
     2442    pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setMvField(cZeroMv, NOT_VALID);
     2443#else
    24322444    pcMvFieldNeighbours[ ( ui << 1 )     ].setRefIdx(NOT_VALID);
    24332445    pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setRefIdx(NOT_VALID);
     2446#endif
    24342447  }
    24352448  numValidMergeCand = getSlice()->getMaxNumMergeCand();
     
    24442457  deriveLeftRightTopIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT );
    24452458  deriveLeftBottomIdxGeneral  ( uiAbsPartIdx, uiPUIdx, uiPartIdxLB );
     2459
     2460#if H_3D_IV_MERGE
     2461  Bool bNoPdmMerge   = ( m_pcSlice->getSPS()->getViewIndex() == 0 || ( m_pcSlice->getSPS()->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) != PDM_USE_FOR_MERGE );
     2462
     2463  //===== add merge with predicted depth maps =====
     2464  TComMv  acPdmMv       [4];
     2465  Int     aiPdmRefIdx   [4] = {-1, -1, -1, -1};
     2466  Bool    bLeftAvai         = false;
     2467  Int     iPosLeftAbove[2]  = {-1, -1};
     2468
     2469  //Notes from QC: DvMCP related variables. 
     2470  //acPdmMv[0].m_bDvMcp = acPdmMv[1].m_bDvMcp = acPdmMv[2].m_bDvMcp = acPdmMv[3].m_bDvMcp = false;
     2471
     2472  DisInfo cDisInfo;
     2473
     2474  cDisInfo.bDV = getDvInfo(uiAbsPartIdx).bDV;
     2475  cDisInfo.m_acNBDV = getDvInfo(uiAbsPartIdx).m_acNBDV;
     2476  cDisInfo.m_aVIdxCan = getDvInfo(uiAbsPartIdx).m_aVIdxCan;
     2477
     2478  if( m_pcSlice->getIsDepth())
     2479  {
     2480    UInt uiPartIdxCenter;
     2481    xDeriveCenterIdx( uiPUIdx, uiPartIdxCenter );   
     2482    TComDataCU *pcTextureCU = m_pcSlice->getTexturePic()->getCU( getAddr() );
     2483 
     2484    if ( pcTextureCU && !pcTextureCU->isIntra( uiPartIdxCenter ) )
     2485    {
     2486      abCandIsInter[iCount] = true;     
     2487      puhInterDirNeighbours[iCount] = pcTextureCU->getInterDir( uiPartIdxCenter );
     2488      if( ( puhInterDirNeighbours[iCount] & 1 ) == 1 )
     2489      {
     2490        pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
     2491       
     2492        TComMv cMvPred = pcMvFieldNeighbours[iCount<<1].getMv();
     2493
     2494        //Notes from MTK: shoud be aligned with " full-pel mv accuracy for depth maps", currently not supported
     2495        //const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) );
     2496        //cMvPred+=cAdd;
     2497        //cMvPred>>=2;
     2498        //clipMv(cMvPred);
     2499        //pcMvFieldNeighbours[iCount<<1].setMvField(cMvPred,pcMvFieldNeighbours[iCount<<1].getRefIdx());
     2500        if (pcMvFieldNeighbours[iCount<<1].getRefIdx()<0)
     2501        {
     2502          for (Int i=0; i<getSlice()->getNumRefIdx(REF_PIC_LIST_0); i++)
     2503          {
     2504            if (getSlice()->getRefPOC(REF_PIC_LIST_0, i) == getSlice()->getPOC())
     2505            {
     2506              pcMvFieldNeighbours[iCount<<1].setMvField(cMvPred,i);
     2507              break;
     2508            }
     2509          }
     2510        }
     2511
     2512      }
     2513     
     2514      if ( getSlice()->isInterB() )
     2515      {
     2516        if( ( puhInterDirNeighbours[iCount] & 2 ) == 2 )
     2517        {
     2518          pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
     2519          TComMv cMvPred = pcMvFieldNeighbours[(iCount<<1)+1].getMv();
     2520
     2521          //Notes from MTK: shoud be aligned with " full-pel mv accuracy for depth maps", currently not supported
     2522          //const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) );
     2523          //cMvPred+=cAdd;
     2524          //cMvPred>>=2;
     2525          //clipMv(cMvPred);
     2526          //pcMvFieldNeighbours[(iCount<<1)+1].setMvField(cMvPred,pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx());
     2527          if (pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx()<0)
     2528          {
     2529            for (Int i=0; i<getSlice()->getNumRefIdx(REF_PIC_LIST_1); i++)
     2530            {
     2531              if (getSlice()->getRefPOC(REF_PIC_LIST_1, i) == getSlice()->getPOC())
     2532              {
     2533                pcMvFieldNeighbours[(iCount<<1)+1].setMvField(cMvPred,i);
     2534                break;
     2535              }
     2536            }
     2537          }
     2538
     2539        }
     2540      }
     2541
     2542      if (!((pcMvFieldNeighbours[iCount<<1].getRefIdx()<0 && !getSlice()->isInterB())
     2543        || (pcMvFieldNeighbours[iCount<<1].getRefIdx()<0 && pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx()<0 && getSlice()->isInterB())))
     2544      {
     2545        if ( mrgCandIdx == iCount )
     2546        {
     2547          return;
     2548        }
     2549        iCount ++;
     2550      }
     2551      else
     2552      {
     2553        assert(0);
     2554      }
     2555    }
     2556  }
     2557
     2558  Int iPdmDir[2] = {0, 0};
     2559  getUnifiedMvPredCan(uiPUIdx, REF_PIC_LIST_0, 0, aiPdmRefIdx, acPdmMv, &cDisInfo, iPdmDir, true);
     2560  Int iPdmInterDir;
     2561
     2562  if( iPdmDir[0] && !bNoPdmMerge )
     2563  {
     2564    abCandIsInter        [ iCount ] = true;
     2565    puhInterDirNeighbours[ iCount ] = iPdmDir[0];
     2566    iPdmInterDir                    = iPdmDir[0];
     2567
     2568    if( ( iPdmInterDir & 1 ) == 1 )
     2569    {
     2570      pcMvFieldNeighbours[ iCount<<1    ].setMvField( acPdmMv[ 0 ], aiPdmRefIdx[ 0 ] );
     2571    }
     2572
     2573    if( ( iPdmInterDir & 2 ) == 2 )
     2574    {
     2575      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 1 ], aiPdmRefIdx[ 1 ] );
     2576    }
     2577
     2578    if ( mrgCandIdx == iCount )
     2579    {
     2580      return;
     2581    }
     2582    iCount ++;
     2583  } 
     2584#endif
     2585
     2586#if !H_3D_IV_MERGE
    24462587#if H_3D_NBDV //Notes from QC: DvMCP related variables. 
    24472588  //acPdmMv[0].m_bDvMcp = acPdmMv[1].m_bDvMcp = acPdmMv[2].m_bDvMcp = acPdmMv[3].m_bDvMcp = false;
     
    24612602  //}
    24622603#endif
     2604#endif
     2605
    24632606  //left
    24642607  UInt uiLeftPartIdx = 0;
     
    24802623      pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    24812624    }
     2625
     2626#if H_3D_IV_MERGE
     2627    Bool bRemoveSpa = false; //pruning to inter-view candidates
     2628    Int  iCnloop    = iCount - 1;
     2629    for(; iCnloop >= 0; iCnloop --)
     2630    {
     2631      if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
     2632      {
     2633        bRemoveSpa                      = true;
     2634        abCandIsInter        [ iCount ] = false;
     2635
     2636        //reset to the default value for MC
     2637        puhInterDirNeighbours[iCount]   = 0;
     2638        pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID );
     2639        pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
     2640        break;
     2641      }
     2642    }
     2643    if(!bRemoveSpa)
     2644    {
     2645      bLeftAvai = true;
     2646      iPosLeftAbove[0] = iCount;
     2647
     2648      if ( mrgCandIdx == iCount )
     2649      {
     2650        return;
     2651      }
     2652      iCount ++;
     2653    }
     2654#else
    24822655    if ( mrgCandIdx == iCount )
    24832656    {
     
    24852658    }
    24862659    iCount ++;
     2660#endif
    24872661  }
    24882662 
     
    25112685      pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    25122686    }
     2687#if H_3D_IV_MERGE
     2688    Bool bRemoveSpa = false; //pruning to inter-view candidates
     2689    Int  iCnloop    = bLeftAvai? (iCount-2): (iCount-1);
     2690    for(; iCnloop >= 0; iCnloop --)
     2691    {
     2692      if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
     2693      {
     2694        bRemoveSpa                      = true;
     2695        abCandIsInter        [ iCount ] = false;
     2696
     2697        //reset to the default value for MC
     2698        puhInterDirNeighbours[iCount]   = 0;
     2699
     2700        pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID );
     2701        pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
     2702        break;
     2703      }
     2704    }
     2705    if(!bRemoveSpa)
     2706    {
     2707      iPosLeftAbove[1] = iCount;
     2708
     2709      if ( mrgCandIdx == iCount )
     2710      {
     2711        return;
     2712      }
     2713      iCount ++;
     2714    }
     2715#else
    25132716    if ( mrgCandIdx == iCount )
    25142717    {
     
    25162719    }
    25172720    iCount ++;
     2721#endif
    25182722  }
    25192723  // early termination
     
    25522756    return;
    25532757  }
     2758
     2759#if H_3D_IV_MERGE
     2760  if(!bNoPdmMerge && iPdmDir[1] )
     2761  {
     2762    assert(iCount < getSlice()->getMaxNumMergeCand());
     2763    abCandIsInter        [ iCount ] = true;
     2764    puhInterDirNeighbours[ iCount ] = iPdmDir[1];
     2765    if( ( iPdmDir[1] & 1 ) == 1 )
     2766    {
     2767      pcMvFieldNeighbours[ iCount<<1    ].setMvField( acPdmMv[ 2 ], aiPdmRefIdx[ 2 ] );
     2768    }
     2769    if( ( iPdmDir[1] & 2 ) == 2 )
     2770    {
     2771      pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( acPdmMv[ 3 ], aiPdmRefIdx[ 3 ] );
     2772    }
     2773
     2774    Bool bRemoveSpa = false; //pruning to A1, B1
     2775    for(Int i = 0; i < 2; i ++)
     2776    {
     2777      Int iCnloop = iPosLeftAbove[i];
     2778      if(iCnloop == -1)
     2779        continue;
     2780      if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
     2781      {
     2782        bRemoveSpa                      = true;
     2783        abCandIsInter        [ iCount ] = false;
     2784        //reset to the default value for MC
     2785        puhInterDirNeighbours[iCount]   = 0;
     2786        pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID );
     2787        pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
     2788        break;
     2789      }     
     2790    }
     2791    if(!bRemoveSpa)
     2792    {
     2793      if ( mrgCandIdx == iCount )
     2794        return;
     2795      iCount ++;
     2796
     2797      // early termination
     2798      if (iCount == getSlice()->getMaxNumMergeCand())
     2799      {
     2800        return;
     2801      }
     2802    }
     2803  }
     2804#endif
    25542805
    25552806  //left bottom
     
    27172968  if ( getSlice()->isInterB())
    27182969  {
     2970#if H_3D_IV_MERGE
     2971    UInt uiPriorityList0[20] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3,    0, 4, 1, 4, 2, 4, 3, 4 };
     2972    UInt uiPriorityList1[20] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2,    4, 0, 4, 1, 4, 2, 4, 3 };
     2973#else
    27192974    UInt uiPriorityList0[12] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3};
    27202975    UInt uiPriorityList1[12] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2};
     2976#endif
    27212977
    27222978    for (Int idx=0; idx<uiCutoff*(uiCutoff-1) && uiArrayAddr!= getSlice()->getMaxNumMergeCand(); idx++)
     
    42464502}
    42474503#endif
     4504
     4505#if H_3D_IV_MERGE
     4506Bool TComDataCU::getUnifiedMvPredCan(UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm, Bool bMerge )
     4507{
     4508  TComDepthMapGenerator* pcDepthMapGenerator = m_pcSlice->getSPS()->getDepthMapGenerator();
     4509  ROFRS( pcDepthMapGenerator, false );
     4510  if (pcDepthMapGenerator->getPdmCandidate(this, uiPartIdx, eRefPicList, iRefIdx, paiPdmRefIdx, pacPdmMv, pDInfo, iPdm, bMerge))
     4511    return true;
     4512  return false;
     4513}
     4514#endif
    42484515//! \}
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComDataCU.h

    r455 r476  
    434434   
    435435#endif
     436
     437#if H_3D_IV_MERGE
     438  Bool          getUnifiedMvPredCan       ( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm, Bool bMerge );
     439#endif
    436440  // -------------------------------------------------------------------------------------------------------------------
    437441  // member functions for accessing partition information
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComMotionInfo.h

    r455 r476  
    105105  Int getHor   () const { return  m_acMv.getHor(); }
    106106  Int getVer   () const { return  m_acMv.getVer(); }
     107
     108#if H_3D_IV_MERGE
     109  Bool operator== ( const TComMvField& rcMv ) const
     110  {
     111    return (m_acMv.getHor()==rcMv.getHor() && m_acMv.getVer()==rcMv.getVer() && m_iRefIdx == rcMv.getRefIdx());
     112  }
     113#endif
    107114};
    108115
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComPic.h

    r455 r476  
    141141  Int           getPOC()              { return  m_apcPicSym->getSlice(m_uiCurrSliceIdx)->getPOC();  }
    142142  TComDataCU*&  getCU( UInt uiCUAddr )  { return  m_apcPicSym->getCU( uiCUAddr ); }
     143#if H_3D_IV_MERGE
     144  TComSlice*    getCurrSlice()        { return  m_apcPicSym->getSlice(m_uiCurrSliceIdx);  }
     145  TComSPS*      getSPS()              { return  m_apcPicSym->getSlice(m_uiCurrSliceIdx)->getSPS();  }
     146  TComVPS*      getVPS()              { return  m_apcPicSym->getSlice(m_uiCurrSliceIdx)->getVPS();  }
     147#endif
    143148 
    144149  TComPicYuv*   getPicYuvOrg()        { return  m_apcPicYuv[0]; }
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComPicYuv.cpp

    r446 r476  
    7777  m_iCuHeight       = uiMaxCUHeight;
    7878
     79#if H_3D_IV_MERGE
     80  m_iNumCuInWidth   = m_iPicWidth / m_iCuWidth;
     81  m_iNumCuInWidth  += ( m_iPicWidth % m_iCuWidth ) ? 1 : 0;
     82
     83  m_iBaseUnitWidth  = uiMaxCUWidth  >> uiMaxCUDepth;
     84  m_iBaseUnitHeight = uiMaxCUHeight >> uiMaxCUDepth;
     85#endif
     86
    7987  Int numCuInWidth  = m_iPicWidth  / m_iCuWidth  + (m_iPicWidth  % m_iCuWidth  != 0);
    8088  Int numCuInHeight = m_iPicHeight / m_iCuHeight + (m_iPicHeight % m_iCuHeight != 0);
     
    325333
    326334#if H_3D
     335#if H_3D_IV_MERGE
     336Void
     337TComPicYuv::getTopLeftSamplePos( Int iCuAddr, Int iAbsZorderIdx, Int& riX, Int& riY )
     338{
     339  Int iRastPartIdx    = g_auiZscanToRaster[iAbsZorderIdx];
     340  Int iCuSizeInBases  = m_iCuWidth   / m_iBaseUnitWidth;
     341  Int iCuX            = iCuAddr      % m_iNumCuInWidth;
     342  Int iCuY            = iCuAddr      / m_iNumCuInWidth;
     343  Int iBaseX          = iRastPartIdx % iCuSizeInBases;
     344  Int iBaseY          = iRastPartIdx / iCuSizeInBases;
     345  riX                 = iCuX * m_iCuWidth  + iBaseX * m_iBaseUnitWidth;
     346  riY                 = iCuY * m_iCuHeight + iBaseY * m_iBaseUnitHeight;
     347}
     348
     349Void
     350TComPicYuv::getCUAddrAndPartIdx( Int iX, Int iY, Int& riCuAddr, Int& riAbsZorderIdx )
     351{
     352  Int iCuX            = iX / m_iCuWidth;
     353  Int iCuY            = iY / m_iCuHeight;
     354  Int iBaseX          = ( iX - iCuX * m_iCuWidth  ) / m_iBaseUnitWidth;
     355  Int iBaseY          = ( iY - iCuY * m_iCuHeight ) / m_iBaseUnitHeight;
     356  Int iCuSizeInBases  = m_iCuWidth                  / m_iBaseUnitWidth;
     357  riCuAddr            = iCuY   * m_iNumCuInWidth + iCuX;
     358  Int iRastPartIdx    = iBaseY * iCuSizeInBases  + iBaseX;
     359  riAbsZorderIdx      = g_auiRasterToZscan[ iRastPartIdx ];
     360}
     361#endif
    327362Void TComPicYuv::setLumaTo( Pel pVal )
    328363{
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComPicYuv.h

    r446 r476  
    8888  Bool  m_bIsBorderExtended;
    8989 
     90#if H_3D_IV_MERGE
     91  Int   m_iBaseUnitWidth;       ///< Width of Base Unit (with maximum depth or minimum size, m_iCuWidth >> Max. Depth)
     92  Int   m_iBaseUnitHeight;      ///< Height of Base Unit (with maximum depth or minimum size, m_iCuHeight >> Max. Depth)
     93  Int   m_iNumCuInWidth;
     94#endif
    9095protected:
    9196  Void  xExtendPicCompBorder (Pel* piTxt, Int iStride, Int iWidth, Int iHeight, Int iMarginX, Int iMarginY);
     
    165170  Void  setLumaTo    ( Pel pVal ); 
    166171  Void  setChromaTo  ( Pel pVal ); 
     172#if H_3D_IV_MERGE
     173  // sample to block and block to sample conversion
     174  Void  getTopLeftSamplePos( Int iCuAddr, Int iAbsZorderIdx, Int& riX, Int& riY );
     175  Void  getCUAddrAndPartIdx( Int iX, Int iY, Int& riCuAddr, Int& riAbsZorderIdx );
     176#endif
    167177#endif
    168178};// END CLASS DEFINITION TComPicYuv
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComSlice.cpp

    r446 r476  
    6868, m_iSliceQpDeltaCb               ( 0 )
    6969, m_iSliceQpDeltaCr               ( 0 )
     70#if H_3D_IV_MERGE
     71, m_pcTexturePic                  ( NULL )
     72#endif
    7073, m_iDepth                        ( 0 )
    7174, m_bRefenced                     ( false )
     
    171174 
    172175  m_colRefIdx = 0;
     176#if H_3D_IV_MERGE
     177  m_pcTexturePic = NULL;
     178#endif
    173179  initEqualRef();
    174180#if !L0034_COMBINED_LIST_CLEANUP
     
    185191#endif
    186192
     193#if H_3D_IV_MERGE
     194  m_maxNumMergeCand = MRG_MAX_NUM_CANDS_MEM;
     195#else
    187196  m_maxNumMergeCand = MRG_MAX_NUM_CANDS;
     197#endif
    188198
    189199  m_bFinalized=false;
     
    18471857  }
    18481858}
     1859
     1860#if H_3D_IV_MERGE
     1861Void
     1862TComSPS::setPredDepthMapGeneration( UInt uiViewIndex, Bool bIsDepth, UInt uiPdmGenMode, UInt uiPdmMvPredMode)
     1863{
     1864  AOF( m_uiViewIndex == uiViewIndex );
     1865  AOF( m_bDepth   == bIsDepth );
     1866  AOT( ( uiViewIndex == 0 || bIsDepth ) && uiPdmGenMode );
     1867  AOT( uiPdmMvPredMode && uiPdmGenMode == 0 );
     1868
     1869  m_uiPredDepthMapGeneration = uiPdmGenMode;
     1870  m_uiMultiviewMvPredMode    = uiPdmMvPredMode;
     1871}
     1872#endif
     1873
    18491874const Int TComSPS::m_winUnitX[]={1,2,2,1};
    18501875const Int TComSPS::m_winUnitY[]={1,2,1,1};
     
    19131938  ::memset( m_aaiCodedOffset, 0x00, sizeof( m_aaiCodedOffset ) );
    19141939
     1940#if H_3D_IV_MERGE 
     1941  m_uiViewIndex           = uiViewIndex;
     1942  m_bDepth                = false;
     1943#endif
     1944
    19151945  if( !m_bCamParInSliceHeader )
    19161946  {
     
    19241954  }
    19251955}
     1956
     1957#if H_3D_IV_MERGE
     1958Void
     1959TComSPS::initCamParaSPSDepth( UInt uiViewIndex)
     1960
     1961  m_uiCamParPrecision     = 0;
     1962  m_bCamParInSliceHeader  = false;
     1963
     1964  ::memset( m_aaiCodedScale,  0x00, sizeof( m_aaiCodedScale  ) );
     1965  ::memset( m_aaiCodedOffset, 0x00, sizeof( m_aaiCodedOffset ) );
     1966
     1967  m_uiViewIndex           = uiViewIndex;
     1968  m_bDepth                = true;
     1969}
     1970#endif
    19261971#endif
    19271972
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComSlice.h

    r446 r476  
    5353#if H_MV
    5454class TComPicLists;
     55#endif
     56
     57#if H_3D_IV_MERGE
     58class TComDepthMapGenerator;
    5559#endif
    5660// ====================================================================================================================
     
    981985  Int         m_aaiCodedScale [2][MAX_NUM_LAYERS];
    982986  Int         m_aaiCodedOffset[2][MAX_NUM_LAYERS];
     987#if H_3D_IV_MERGE
     988  UInt        m_uiMultiviewMvPredMode;
     989  UInt        m_uiPredDepthMapGeneration;
     990
     991  UInt        m_uiViewIndex;
     992  Bool        m_bDepth;
     993  TComDepthMapGenerator* m_pcDepthMapGenerator;
     994#endif
    983995#endif
    984996public:
     
    11241136  Int* getInvCodedScale      ()  { return m_aaiCodedScale [1]; }
    11251137  Int* getInvCodedOffset     ()  { return m_aaiCodedOffset[1]; }
     1138#if H_3D_IV_MERGE
     1139  Void  initCamParaSPSDepth      ( UInt uiViewIndex);
     1140  UInt  getMultiviewMvPredMode   ()          { return m_uiMultiviewMvPredMode;    }
     1141  UInt  getPredDepthMapGeneration()          { return m_uiPredDepthMapGeneration; }
     1142
     1143  UInt  getViewIndex             ()  { return m_uiViewIndex; }
     1144  Bool  isDepth               ()  { return m_bDepth; }
     1145  Void  setDepthMapGenerator( TComDepthMapGenerator* pcDepthMapGenerator )  { m_pcDepthMapGenerator = pcDepthMapGenerator; }
     1146  TComDepthMapGenerator*  getDepthMapGenerator()                                              { return m_pcDepthMapGenerator; }
     1147  Void setPredDepthMapGeneration( UInt uiViewIndex, Bool bIsDepth, UInt uiPdmGenMode = 0, UInt uiPdmMvPredMode = 0);
     1148#endif
    11261149#endif
    11271150};
     
    14141437#endif
    14151438  Bool        m_bIsUsedAsLongTerm[2][MAX_NUM_REF+1];
     1439#if H_3D_IV_MERGE
     1440  TComPic*    m_pcTexturePic;
     1441#endif
    14161442  Int         m_iDepth;
    14171443 
     
    15441570  TComPic*  getRefPic           ( RefPicList e, Int iRefIdx)    { return  m_apcRefPicList[e][iRefIdx];  }
    15451571  Int       getRefPOC           ( RefPicList e, Int iRefIdx)    { return  m_aiRefPOCList[e][iRefIdx];   }
     1572#if H_3D_IV_MERGE
     1573  TComPic*  getTexturePic       () const                        { return  m_pcTexturePic; }
     1574#endif
    15461575  Int       getDepth            ()                              { return  m_iDepth;                     }
    15471576  UInt      getColFromL0Flag    ()                              { return  m_colFromL0Flag;              }
     
    15941623  Void      setRefPic           ( TComPic* p, RefPicList e, Int iRefIdx ) { m_apcRefPicList[e][iRefIdx] = p; }
    15951624  Void      setRefPOC           ( Int i, RefPicList e, Int iRefIdx ) { m_aiRefPOCList[e][iRefIdx] = i; }
     1625#if H_3D_IV_MERGE
     1626  Void      setTexturePic       ( TComPic *pcTexturePic )       { m_pcTexturePic = pcTexturePic; }
     1627#endif
    15961628  Void      setNumRefIdx        ( RefPicList e, Int i )         { m_aiNumRefIdx[e]    = i;      }
    15971629  Void      setPic              ( TComPic* p )                  { m_pcPic             = p;      }
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TypeDef.h

    r456 r476  
    4242//! \{
    4343
    44 
    4544/////////////////////////////////////////////////////////////////////////////////////////
    4645///////////////////////////////// EXTENSION SELECTION /////////////////////////////////// 
     
    8988                                              // QC_CU_NBDV_D0181
    9089                                              // SEC_DEFAULT_DV_D0112
     90
     91#define H_3D_IV_MERGE                     1   // Inter-view motion merge candidate
     92                                              // HHI_INTER_VIEW_MOTION_PRED
     93                                              // SAIT_IMPROV_MOTION_PRED_M24829, improved inter-view motion vector prediction
     94                                              // QC_MRG_CANS_B0048             , JCT3V-B0048, B0086, B0069
     95                                              // OL_DISMV_POS_B0069            , different pos for disparity MV candidate, B0069
     96                                              // MTK_INTERVIEW_MERGE_A0049     , second part
     97                                              // QC_AMVP_MRG_UNIFY_IVCAN_C0051     
     98                                              // TEXTURE MERGING CANDIDATE     , JCT3V-C0137
     99
    91100#endif
    92101
Note: See TracChangeset for help on using the changeset viewer.