Ignore:
Timestamp:
18 Jun 2013, 05:16:27 (11 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)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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//! \}
Note: See TracChangeset for help on using the changeset viewer.