Ignore:
Timestamp:
3 Feb 2014, 11:35:43 (11 years ago)
Author:
rwth
Message:
  • first version of DBBP (requires some cleanup)
Location:
branches/HTM-9.3-dev1-RWTH/source/Lib/TLibEncoder
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibEncoder/TEncCavlc.cpp

    r786 r816  
    15161516        WRITE_FLAG( pcVPS->getViewSynthesisPredFlag( i ) ? 1 : 0 , "view_synthesis_pred_flag[i]");
    15171517#endif
     1518#if H_3D_DBBP
     1519        WRITE_FLAG( pcVPS->getUseDBBP( i ) ? 1 : 0, "use_dbbp_flag[i]" );
     1520#endif
    15181521      }         
    15191522      else
     
    25342537}
    25352538#endif
     2539   
     2540#if H_3D_DBBP
     2541Void TEncCavlc::codeDBBPFlag    ( TComDataCU* pcCU, UInt uiAbsPartIdx )
     2542{
     2543  assert(0);
     2544}
     2545#endif
    25362546//! \}
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibEncoder/TEncCavlc.h

    r773 r816  
    141141  Void codeInterSDCResidualData  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment );
    142142#endif
     143#if H_3D_DBBP
     144  Void codeDBBPFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx );
     145#endif
    143146
    144147  Void codeInterModeFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiEncMode );
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibEncoder/TEncCfg.h

    r779 r816  
    420420  bool      m_bInterSDC;
    421421#endif
     422#if H_3D_DBBP
     423  Bool      m_bUseDBBP;
     424#endif
    422425  //====== Depth Intra Modes ======
    423426#if H_3D_DIM
     
    529532  Void       setInterSDCEnable              ( Bool bVal )    { m_bInterSDC = bVal; }
    530533  Bool       getInterSDCEnable              ()               { return m_bInterSDC; }
     534#endif
     535#if H_3D_DBBP
     536  Void       setUseDBBP                     ( Bool  b )      { m_bUseDBBP   = b; }
     537  Bool       getUseDBBP()                                    { return m_bUseDBBP;     }
    531538#endif
    532539  //======== Transform =============
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibEncoder/TEncCu.cpp

    r809 r816  
    7676  m_ppcRecoYuvTemp = new TComYuv*[m_uhTotalDepth-1];
    7777  m_ppcOrigYuv     = new TComYuv*[m_uhTotalDepth-1];
     78#if H_3D_DBBP
     79  m_ppcOrigYuvDBBP = new TComYuv*[m_uhTotalDepth-1];
     80#endif
    7881 
    7982  UInt uiNumPartitions;
     
    100103   
    101104    m_ppcOrigYuv    [i] = new TComYuv; m_ppcOrigYuv    [i]->create(uiWidth, uiHeight);
     105#if H_3D_DBBP
     106    m_ppcOrigYuvDBBP[i] = new TComYuv; m_ppcOrigYuvDBBP[i]->create(uiWidth, uiHeight);
     107#endif
    102108  }
    103109 
     
    180186      m_ppcOrigYuv[i]->destroy();     delete m_ppcOrigYuv[i];     m_ppcOrigYuv[i] = NULL;
    181187    }
     188#if H_3D_DBBP
     189    if(m_ppcOrigYuvDBBP[i])
     190    {
     191      m_ppcOrigYuvDBBP[i]->destroy(); delete m_ppcOrigYuvDBBP[i]; m_ppcOrigYuvDBBP[i] = NULL;
     192    }
     193#endif
    182194  }
    183195  if(m_ppcBestCU)
     
    234246    m_ppcOrigYuv = NULL;
    235247  }
     248#if H_3D_DBBP
     249  if(m_ppcOrigYuvDBBP)
     250  {
     251    delete [] m_ppcOrigYuvDBBP;
     252    m_ppcOrigYuvDBBP = NULL;
     253  }
     254#endif
    236255}
    237256
     
    654673            rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
    655674#endif
     675         
     676#if H_3D_DBBP
     677          if( m_pcEncCfg->getUseDBBP() )
     678          {
     679            xCheckRDCostInterDBBP( rpcBestCU, rpcTempCU, false );
     680            rpcTempCU->initEstData( uiDepth, iQP );
     681#if H_3D_VSP
     682            rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
     683#endif
     684          }
     685#endif
     686         
    656687            if(m_pcEncCfg->getUseCbfFastMode())
    657688            {
     
    23102341}
    23112342
     2343#if H_3D_DBBP
     2344Void TEncCu::xInvalidateOriginalSegments( TComYuv* pOrigYuv, TComYuv* pOrigYuvTemp, Bool* pMask, UInt uiValidSegment )
     2345{
     2346  UInt  uiWidth     = pOrigYuv->getWidth ( );
     2347  UInt  uiHeight    = pOrigYuv->getHeight( );
     2348  Pel*  piSrc       = pOrigYuv->getLumaAddr( );
     2349  UInt  uiSrcStride = pOrigYuv->getStride();
     2350  Pel*  piDst       = pOrigYuvTemp->getLumaAddr( );
     2351  UInt  uiDstStride = pOrigYuvTemp->getStride();
     2352 
     2353  UInt  uiMaskStride= MAX_CU_SIZE;
     2354 
     2355  AOF( uiWidth == uiHeight );
     2356 
     2357  // backup pointer
     2358  Bool* pMaskStart = pMask;
     2359 
     2360  for (Int y=0; y<uiHeight; y++)
     2361  {
     2362    for (Int x=0; x<uiWidth; x++)
     2363    {
     2364      UChar ucSegment = (UChar)pMask[x];
     2365      assert( ucSegment < 2 );
     2366     
     2367      piDst[x] = (ucSegment==uiValidSegment)?piSrc[x]:DBBP_INVALID_SHORT;
     2368    }
     2369   
     2370    piSrc  += uiSrcStride;
     2371    piDst  += uiDstStride;
     2372    pMask  += uiMaskStride;
     2373  }
     2374 
     2375  // now invalidate chroma
     2376  Pel*  piSrcU       = pOrigYuv->getCbAddr();
     2377  Pel*  piSrcV       = pOrigYuv->getCrAddr();
     2378  UInt  uiSrcStrideC = pOrigYuv->getCStride();
     2379  Pel*  piDstU       = pOrigYuvTemp->getCbAddr( );
     2380  Pel*  piDstV       = pOrigYuvTemp->getCrAddr( );
     2381  UInt  uiDstStrideC = pOrigYuvTemp->getCStride();
     2382  pMask = pMaskStart;
     2383 
     2384  for (Int y=0; y<uiHeight/2; y++)
     2385  {
     2386    for (Int x=0; x<uiWidth/2; x++)
     2387    {
     2388      UChar ucSegment = (UChar)pMask[x*2];
     2389      assert( ucSegment < 2 );
     2390     
     2391      piDstU[x] = (ucSegment==uiValidSegment)?piSrcU[x]:DBBP_INVALID_SHORT;
     2392      piDstV[x] = (ucSegment==uiValidSegment)?piSrcV[x]:DBBP_INVALID_SHORT;
     2393    }
     2394   
     2395    piSrcU  += uiSrcStrideC;
     2396    piSrcV  += uiSrcStrideC;
     2397    piDstU  += uiDstStrideC;
     2398    piDstV  += uiDstStrideC;
     2399    pMask   += 2*uiMaskStride;
     2400  }
     2401}
     2402
     2403Void TEncCu::xCheckRDCostInterDBBP( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bUseMRG )
     2404{
     2405  AOF( !rpcTempCU->getSlice()->getIsDepth() );
     2406 
     2407 
     2408  UChar uhDepth = rpcTempCU->getDepth( 0 );
     2409 
     2410#if H_3D_VSO
     2411  if( m_pcRdCost->getUseRenModel() )
     2412  {
     2413    UInt  uiWidth     = m_ppcOrigYuv[uhDepth]->getWidth ( );
     2414    UInt  uiHeight    = m_ppcOrigYuv[uhDepth]->getHeight( );
     2415    Pel*  piSrc       = m_ppcOrigYuv[uhDepth]->getLumaAddr( );
     2416    UInt  uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride();
     2417    m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     2418  }
     2419#endif
     2420 
     2421  UInt uiWidth  = rpcTempCU->getWidth(0);
     2422  UInt uiHeight = rpcTempCU->getHeight(0);
     2423  AOF( uiWidth == uiHeight );
     2424 
     2425  rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N,  0, uhDepth );
     2426 
     2427  // get coded and reconstructed depth view
     2428  UInt uiDepthStride = 0;
     2429  Pel* pDepthPels = rpcTempCU->getVirtualDepthBlock(0, uiWidth, uiHeight, uiDepthStride);
     2430  AOF( pDepthPels != NULL );
     2431  AOF( uiDepthStride != 0 );
     2432 
     2433  // derive partitioning from depth
     2434  PartSize eVirtualPartSize = m_pcPredSearch->getPartitionSizeFromDepth(pDepthPels, uiDepthStride, uiWidth);
     2435 
     2436  // derive segmentation mask from depth
     2437  Bool pMask[MAX_CU_SIZE*MAX_CU_SIZE];
     2438  Bool bValidMask = m_pcPredSearch->getSegmentMaskFromDepth(pDepthPels, uiDepthStride, uiWidth, uiHeight, pMask);
     2439 
     2440  if( !bValidMask )
     2441    return;
     2442 
     2443  // find optimal motion/disparity vector for each segment
     2444  DisInfo originalDvInfo = rpcTempCU->getDvInfo(0);
     2445  DBBPTmpData* pDBBPTmpData = rpcTempCU->getDBBPTmpData();
     2446  TComYuv* apPredYuv[2] = { m_ppcRecoYuvTemp[uhDepth], m_ppcPredYuvTemp[uhDepth] };
     2447 
     2448  // find optimal motion vector fields for both segments (as 2Nx2N)
     2449  rpcTempCU->setDepthSubParts( uhDepth, 0 );
     2450  rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N,  0, uhDepth );
     2451  rpcTempCU->setPredModeSubParts( MODE_INTER, 0, uhDepth );
     2452  for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ )
     2453  {
     2454    rpcTempCU->setDBBPFlagSubParts(true, 0, 0, uhDepth);
     2455    rpcTempCU->setDvInfoSubParts(originalDvInfo, 0, uhDepth);
     2456   
     2457    // invalidate all other segments in original YUV
     2458    xInvalidateOriginalSegments(m_ppcOrigYuv[uhDepth], m_ppcOrigYuvDBBP[uhDepth], pMask, uiSegment);
     2459   
     2460    // do motion estimation for this segment
     2461    g_bTestVirtualParts = true;
     2462    rpcTempCU->getDBBPTmpData()->eVirtualPartSize = eVirtualPartSize;
     2463    rpcTempCU->getDBBPTmpData()->uiVirtualPartIndex = uiSegment;
     2464    m_pcPredSearch->predInterSearch( rpcTempCU, m_ppcOrigYuvDBBP[uhDepth], apPredYuv[uiSegment], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], false, false, bUseMRG );
     2465    g_bTestVirtualParts = false;
     2466   
     2467    // extract motion parameters of full block for this segment
     2468    pDBBPTmpData->auhInterDir[uiSegment] = rpcTempCU->getInterDir(0);
     2469   
     2470    pDBBPTmpData->abMergeFlag[uiSegment] = rpcTempCU->getMergeFlag(0);
     2471    pDBBPTmpData->auhMergeIndex[uiSegment] = rpcTempCU->getMergeIndex(0);
     2472   
     2473    pDBBPTmpData->ahVSPFlag[uiSegment] = rpcTempCU->getVSPFlag(0);
     2474    pDBBPTmpData->acDvInfo[uiSegment] = rpcTempCU->getDvInfo(0);
     2475   
     2476    for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
     2477    {
     2478      RefPicList eRefList = (RefPicList)uiRefListIdx;
     2479     
     2480      pDBBPTmpData->acMvd[uiSegment][eRefList] = rpcTempCU->getCUMvField(eRefList)->getMvd(0);
     2481      pDBBPTmpData->aiMvpNum[uiSegment][eRefList] = rpcTempCU->getMVPNum(eRefList, 0);
     2482      pDBBPTmpData->aiMvpIdx[uiSegment][eRefList] = rpcTempCU->getMVPIdx(eRefList, 0);
     2483     
     2484      rpcTempCU->getMvField(rpcTempCU, 0, eRefList, pDBBPTmpData->acMvField[uiSegment][eRefList]);
     2485    }
     2486  }
     2487 
     2488  rpcTempCU->setDepthSubParts( uhDepth, 0 );
     2489  rpcTempCU->setPartSizeSubParts  ( eVirtualPartSize,  0, uhDepth );
     2490  rpcTempCU->setPredModeSubParts  ( MODE_INTER, 0, uhDepth );
     2491 
     2492  UInt uiPUOffset = ( g_auiPUOffset[UInt( eVirtualPartSize )] << ( ( rpcTempCU->getSlice()->getSPS()->getMaxCUDepth() - uhDepth ) << 1 ) ) >> 4;
     2493  for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ )
     2494  {
     2495    UInt uiPartAddr = uiSegment*uiPUOffset;
     2496   
     2497    rpcTempCU->setDBBPFlagSubParts(true, uiPartAddr, uiSegment, uhDepth);
     2498   
     2499    // now set stored information from 2Nx2N motion search to each partition
     2500    rpcTempCU->setInterDirSubParts(pDBBPTmpData->auhInterDir[uiSegment], uiPartAddr, uiSegment, uhDepth); // interprets depth relative to LCU level
     2501   
     2502    rpcTempCU->setMergeFlagSubParts(pDBBPTmpData->abMergeFlag[uiSegment], uiPartAddr, uiSegment, uhDepth);
     2503    rpcTempCU->setMergeIndexSubParts(pDBBPTmpData->auhMergeIndex[uiSegment], uiPartAddr, uiSegment, uhDepth);
     2504   
     2505    rpcTempCU->setVSPFlagSubParts(pDBBPTmpData->ahVSPFlag[uiSegment], uiPartAddr, uiSegment, uhDepth);
     2506    rpcTempCU->setDvInfoSubParts(pDBBPTmpData->acDvInfo[uiSegment], uiPartAddr, uiSegment, uhDepth);
     2507   
     2508    for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
     2509    {
     2510      RefPicList eRefList = (RefPicList)uiRefListIdx;
     2511     
     2512      rpcTempCU->getCUMvField( eRefList )->setAllMvd(pDBBPTmpData->acMvd[uiSegment][eRefList], eVirtualPartSize, uiPartAddr, 0, uiSegment);
     2513      rpcTempCU->setMVPNum(eRefList, uiPartAddr, pDBBPTmpData->aiMvpNum[uiSegment][eRefList]);
     2514      rpcTempCU->setMVPIdx(eRefList, uiPartAddr, pDBBPTmpData->aiMvpIdx[uiSegment][eRefList]);
     2515     
     2516#if NTT_STORE_SPDV_VSP_G0148
     2517      if( rpcTempCU->getVSPFlag( uiPartAddr ) != 0 )
     2518      {
     2519        if ( rpcTempCU->getInterDir(uiPartAddr) & (1<<uiRefListIdx) )
     2520        {
     2521          UInt dummy;
     2522          Int vspSize;
     2523          Int width, height;
     2524          rpcTempCU->getPartIndexAndSize( uiSegment, dummy, width, height, uiPartAddr, rpcTempCU->getTotalNumPart()==256 );
     2525          AOF( dummy == uiPartAddr );
     2526          rpcTempCU->setMvFieldPUForVSP( rpcTempCU, uiPartAddr, width, height, eRefList, pDBBPTmpData->acMvField[uiSegment][eRefList].getRefIdx(), vspSize );
     2527          rpcTempCU->setVSPFlag( uiPartAddr, vspSize );
     2528        }
     2529      }
     2530      else
     2531#endif
     2532      rpcTempCU->getCUMvField( eRefList )->setAllMvField( pDBBPTmpData->acMvField[uiSegment][eRefList], eVirtualPartSize, uiPartAddr, 0, uiSegment ); // interprets depth relative to rpcTempCU level
     2533    }
     2534  }
     2535 
     2536  // reconstruct final prediction signal by combining both segments
     2537  m_pcPredSearch->combineSegmentsWithMask(apPredYuv, m_ppcPredYuvTemp[uhDepth], pMask, uiWidth, uiHeight);
     2538 
     2539  m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], false );
     2540 
     2541  xCheckDQP( rpcTempCU );
     2542  xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
     2543}
     2544#endif
     2545
    23122546Void TEncCu::xCheckRDCostIntra( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize eSize )
    23132547{
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibEncoder/TEncCu.h

    r655 r816  
    8282  TComYuv**               m_ppcOrigYuv;     ///< Original Yuv for each depth
    8383 
     84#if H_3D_DBBP
     85  TComYuv**               m_ppcOrigYuvDBBP;
     86#endif
     87 
    8488  //  Data : encoder control
    8589  Bool                    m_bEncodeDQP;
     
    168172  Void  xCheckRDCostInter   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize  );
    169173#endif
     174#if H_3D_DBBP
     175  Void  xInvalidateOriginalSegments( TComYuv* pOrigYuv, TComYuv* pOrigYuvTemp, Bool* pMask, UInt uiValidSegment );
     176  Void  xCheckRDCostInterDBBP( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bUseMRG = false );
     177#endif
    170178  Void  xCheckRDCostIntra   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize  );
    171179  Void  xCheckDQP           ( TComDataCU*  pcCU );
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibEncoder/TEncEntropy.cpp

    r773 r816  
    240240    uiAbsPartIdx = 0;
    241241  }
     242 
     243#if H_3D_DBBP
     244  PartSize eVirtualPartSize = pcCU->getPartitionSize(uiAbsPartIdx);
     245  if( pcCU->getDBBPFlag(uiAbsPartIdx) )
     246  {
     247    // temporarily change partition size for DBBP blocks
     248    pcCU->setPartSizeSubParts(RWTH_DBBP_PACK_MODE, uiAbsPartIdx, uiDepth);
     249  }
     250#endif
     251 
    242252  m_pcEntropyCoderIf->codePartSize( pcCU, uiAbsPartIdx, uiDepth );
     253 
     254#if H_3D_DBBP
     255  if( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) && pcCU->getPartitionSize(uiAbsPartIdx) == RWTH_DBBP_PACK_MODE )
     256  {
     257    encodeDBBPFlag(pcCU, uiAbsPartIdx, bRD);
     258   
     259    if( pcCU->getDBBPFlag(uiAbsPartIdx) )
     260    {
     261      AOF( pcCU->getPartitionSize(uiAbsPartIdx) == RWTH_DBBP_PACK_MODE );
     262      // restore virtual partition size for DBBP blocks
     263      pcCU->setPartSizeSubParts(eVirtualPartSize, uiAbsPartIdx, uiDepth);
     264    }
     265  }
     266#endif
    243267}
    244268
     
    873897#endif
    874898
     899#if H_3D_DBBP
     900Void TEncEntropy::encodeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
     901{
     902  if( bRD )
     903  {
     904    uiAbsPartIdx = 0;
     905  }
     906  m_pcEntropyCoderIf->codeDBBPFlag( pcCU, uiAbsPartIdx );
     907}
     908#endif
     909
    875910//! \}
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibEncoder/TEncEntropy.h

    r655 r816  
    9797  virtual Void codeInterSDCFlag  ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    9898  virtual Void codeInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment ) = 0;
     99#endif
     100#if H_3D_DBBP
     101  virtual Void codeDBBPFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    99102#endif
    100103  virtual Void codeSplitFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
     
    189192  Void encodeInterSDCResidualData( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD );
    190193#endif
     194#if H_3D_DBBP
     195  Void encodeDBBPFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
     196#endif
    191197  Void encodePredMode          ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
    192198  Void encodePartSize          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool bRD = false );
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibEncoder/TEncSbac.cpp

    r773 r816  
    106106, m_cInterSDCResidualSignFlagSCModel ( 1,             1,  NUM_INTER_SDC_SIGN_FLAG_CTX      , m_contextModels + m_numContextModels, m_numContextModels)
    107107#endif
     108#if H_3D_DBBP
     109, m_cDBBPFlagSCModel             ( 1,             1,                 DBBP_NUM_FLAG_CTX           , m_contextModels + m_numContextModels, m_numContextModels)
     110#endif
    108111{
    109112  assert( m_numContextModels <= MAX_NUM_CTX_MOD );
     
    181184  m_cInterSDCResidualSignFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_SIGN_FLAG );
    182185#endif
     186#if H_3D_DBBP
     187  m_cDBBPFlagSCModel.initBuffer              ( eSliceType, iQp, (UChar*)INIT_DBBP_FLAG );
     188#endif
    183189  // new structure
    184190  m_uiLastQp = iQp;
     
    222228      curCost += m_cInterSDCResidualSCModel.calcCost  ( curSliceType, qp, (UChar*)INIT_INTER_SDC_RESIDUAL );
    223229      curCost += m_cInterSDCResidualSignFlagSCModel.calcCost( curSliceType, qp, (UChar*)INIT_INTER_SDC_SIGN_FLAG );
     230#endif
     231#if H_3D_DBBP
     232      curCost += m_cDBBPFlagSCModel.calcCost          ( curSliceType, qp, (UChar*)INIT_DBBP_FLAG );
    224233#endif
    225234      curCost += m_cCUPartSizeSCModel.calcCost        ( curSliceType, qp, (UChar*)INIT_PART_SIZE );
     
    330339  m_cInterSDCResidualSignFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_SIGN_FLAG );
    331340#endif
     341#if H_3D_DBBP
     342  m_cDBBPFlagSCModel.initBuffer              ( eSliceType, iQp, (UChar*)INIT_DBBP_FLAG );
     343#endif
    332344  m_pcBinIf->start();
    333345}
     
    12281240    m_pcBinIf->encodeBin( uiInterDir == 2 ? 1 : 0, *( pCtx + uiCtx ) );
    12291241  }
     1242#if H_3D_DBBP
     1243  else
     1244  {
     1245    // only uni-prediction is allowed for DBBP
     1246    AOF( uiInterDir == 0 || uiInterDir == 1 );
     1247  }
     1248#endif
    12301249  if (uiInterDir < 2)
    12311250  {
     
    21582177}
    21592178#endif
     2179
     2180#if H_3D_DBBP
     2181Void TEncSbac::codeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx )
     2182{
     2183  PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx );
     2184  AOF( ePartSize == RWTH_DBBP_PACK_MODE );
     2185  AOF( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) );
     2186  AOF( !pcCU->getSlice()->getIsDepth() );
     2187 
     2188  UInt uiSymbol = pcCU->getDBBPFlag( uiAbsPartIdx ) ? 1 : 0;
     2189  m_pcBinIf->encodeBin( uiSymbol, m_cDBBPFlagSCModel.get( 0, 0, 0 ) );
     2190}
     2191#endif
     2192
    21602193//! \}
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibEncoder/TEncSbac.h

    r773 r816  
    157157  Void codeInterSDCResidualData  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment );
    158158#endif
     159#if H_3D_DBBP
     160  Void codeDBBPFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
     161#endif
    159162  Void codeSplitFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    160163  Void codeMVPIdx        ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList );
     
    260263  ContextModel3DBuffer m_cInterSDCResidualSignFlagSCModel;
    261264#endif
     265#if H_3D_DBBP
     266  ContextModel3DBuffer m_cDBBPFlagSCModel;
     267#endif
    262268};
    263269
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibEncoder/TEncSearch.cpp

    r809 r816  
    35833583  pcCU->getPartIndexAndSize( iPUIdx, uiAbsPartIdx, iWidth, iHeight );
    35843584  UInt uiDepth = pcCU->getDepth( uiAbsPartIdx );
     3585 
     3586#if H_3D_DBBP
     3587  DBBPTmpData* pDBBPTmpData = pcCU->getDBBPTmpData();
     3588  if( pcCU->getDBBPFlag(0) )
     3589  {
     3590    AOF( uiAbsPartIdx == 0 );
     3591    AOF( iPUIdx == 0 );
     3592    AOF( pcCU->getPartitionSize(0) == SIZE_2Nx2N );
     3593    AOF( pDBBPTmpData->eVirtualPartSize != SIZE_NONE );
     3594   
     3595    // temporary change of partition size for candidate derivation
     3596    pcCU->setPartSizeSubParts( pDBBPTmpData->eVirtualPartSize, 0, pcCU->getDepth(0));
     3597    iPUIdx = pcCU->getDBBPTmpData()->uiVirtualPartIndex;
     3598   
     3599    // if this is handling the second segment, make sure that motion info of first segment is available
     3600    if( iPUIdx == 1 )
     3601    {
     3602      pcCU->setInterDirSubParts(pDBBPTmpData->auhInterDir[0], 0, 0, pcCU->getDepth(0)); // interprets depth relative to LCU level
     3603     
     3604      pcCU->setVSPFlagSubParts(pDBBPTmpData->ahVSPFlag[0], 0, 0, pcCU->getDepth(0));
     3605      pcCU->setDvInfoSubParts(pDBBPTmpData->acDvInfo[0], 0, 0, pcCU->getDepth(0));
     3606     
     3607      for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
     3608      {
     3609        RefPicList eRefList = (RefPicList)uiRefListIdx;
     3610       
     3611#if NTT_STORE_SPDV_VSP_G0148
     3612        if( pcCU->getVSPFlag( 0 ) != 0 )
     3613        {
     3614          if ( pcCU->getInterDir(0) & (1<<uiRefListIdx) )
     3615          {
     3616            UInt dummy;
     3617            Int vspSize;
     3618            Int width, height;
     3619            pcCU->getPartIndexAndSize( 0, dummy, width, height, 0, pcCU->getTotalNumPart()==256 );
     3620            AOF( dummy == 0 );
     3621            pcCU->setMvFieldPUForVSP( pcCU, 0, width, height, eRefList, pDBBPTmpData->acMvField[0][eRefList].getRefIdx(), vspSize );
     3622            pcCU->setVSPFlag( 0, vspSize );
     3623          }
     3624        }
     3625        else
     3626#endif
     3627        pcCU->getCUMvField( eRefList )->setAllMvField( pDBBPTmpData->acMvField[0][eRefList], pDBBPTmpData->eVirtualPartSize, 0, 0, 0 ); // interprets depth relative to rpcTempCU level
     3628      }
     3629    }
     3630   
     3631    // update these values to virtual partition size
     3632    pcCU->getPartIndexAndSize( iPUIdx, uiAbsPartIdx, iWidth, iHeight );
     3633  }
     3634#endif
     3635 
    35853636  PartSize partSize = pcCU->getPartitionSize( 0 );
     3637#if H_3D_DBBP
     3638  if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && partSize != SIZE_2Nx2N && pcCU->getWidth( 0 ) <= 8 && pcCU->getDBBPFlag(0) == false )
     3639#else
    35863640  if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && partSize != SIZE_2Nx2N && pcCU->getWidth( 0 ) <= 8 )
     3641#endif
    35873642  {
    35883643    pcCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );
     
    36343689#endif
    36353690
     3691#if H_3D_DBBP
     3692  if( pcCU->getDBBPFlag(0) )
     3693  {
     3694    // reset to 2Nx2N for actual motion search
     3695    iPUIdx = 0;
     3696    AOF( pcCU->getPartitionSize(0) == pDBBPTmpData->eVirtualPartSize );
     3697    pcCU->setPartSizeSubParts( SIZE_2Nx2N, 0, pcCU->getDepth(0));
     3698   
     3699    // restore values for 2Nx2N partition size
     3700    pcCU->getPartIndexAndSize( iPUIdx, uiAbsPartIdx, iWidth, iHeight );
     3701   
     3702    AOF( uiAbsPartIdx == 0 );
     3703    AOF( iWidth == iHeight );
     3704  }
     3705#endif
    36363706
    36373707  ruiCost = MAX_UINT;
     
    43464416#endif
    43474417
     4418#if H_3D_DBBP
     4419    // test merge mode for DBBP (2Nx2N)
     4420    if ( pcCU->getPartitionSize( uiPartAddr ) != SIZE_2Nx2N || pcCU->getDBBPFlag(0) )
     4421#else
    43484422    if ( pcCU->getPartitionSize( uiPartAddr ) != SIZE_2Nx2N )
     4423#endif
    43494424    {
    43504425      UInt uiMRGInterDir = 0;     
     
    45644639  if (!bFilled)
    45654640  {
     4641#if H_3D_DBBP
     4642    DBBPTmpData* pDBBPTmpData = pcCU->getDBBPTmpData();
     4643    if( pcCU->getDBBPFlag(0) )
     4644    {
     4645      AOF( uiPartAddr == 0 );
     4646      AOF( uiPartIdx == 0 );
     4647      AOF( pcCU->getPartitionSize(0) == SIZE_2Nx2N );
     4648      AOF( pDBBPTmpData->eVirtualPartSize != SIZE_NONE );
     4649      AOF( iRoiWidth == iRoiHeight );
     4650     
     4651      // temporary change of partition size for candidate derivation
     4652      pcCU->setPartSizeSubParts( pDBBPTmpData->eVirtualPartSize, 0, pcCU->getDepth(0));
     4653      uiPartIdx = pcCU->getDBBPTmpData()->uiVirtualPartIndex;
     4654     
     4655      // if this is handling the second segment, make sure that motion info of first segment is set to first segment
     4656      if( uiPartIdx == 1 )
     4657      {
     4658        pcCU->setInterDirSubParts(pDBBPTmpData->auhInterDir[0], 0, 0, pcCU->getDepth(0)); // interprets depth relative to LCU level
     4659       
     4660        for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
     4661        {
     4662          RefPicList eRefList = (RefPicList)uiRefListIdx;
     4663          pcCU->getCUMvField( eRefList )->setAllMvField( pDBBPTmpData->acMvField[0][eRefList], pDBBPTmpData->eVirtualPartSize, 0, 0, 0 ); // interprets depth relative to rpcTempCU level
     4664        }
     4665      }
     4666     
     4667      // update these values to virtual partition size
     4668      pcCU->getPartIndexAndSize( uiPartIdx, uiPartAddr, iRoiWidth, iRoiHeight );
     4669    }
     4670#endif
     4671   
    45664672    pcCU->fillMvpCand( uiPartIdx, uiPartAddr, eRefPicList, iRefIdx, pcAMVPInfo );
     4673   
     4674#if H_3D_DBBP
     4675    if( pcCU->getDBBPFlag(0) )
     4676    {
     4677      // reset to 2Nx2N for motion search
     4678      uiPartIdx = 0;
     4679      AOF( pcCU->getPartitionSize(0) == pDBBPTmpData->eVirtualPartSize );
     4680      pcCU->setPartSizeSubParts( SIZE_2Nx2N, 0, pcCU->getDepth(0));
     4681     
     4682      // restore values for 2Nx2N partition size
     4683      pcCU->getPartIndexAndSize( uiPartIdx, uiPartAddr, iRoiWidth, iRoiHeight );
     4684      AOF(uiPartAddr==0);
     4685    }
     4686#endif
    45674687  }
    45684688 
Note: See TracChangeset for help on using the changeset viewer.