Changeset 816 in 3DVCSoftware


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
Files:
1 added
33 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-9.3-dev1-RWTH/source/App/TAppEncoder/TAppEncCfg.cpp

    r786 r816  
    521521#if H_3D_INTER_SDC
    522522  ("InterSDC",                 m_bDepthInterSDCFlag,        true, "Enable depth inter SDC")
     523#endif
     524#if H_3D_DBBP
     525  ("DBBP",                     m_bUseDBBP,   true, "Enable depth-based block partitioning" )
    523526#endif
    524527#if H_3D_IV_MERGE
     
    24922495#endif
    24932496#if H_3D_IC
    2494   printf( "IlluCompEnable: %d ", m_abUseIC);
     2497  printf( "IlluCompEnable:%d ", m_abUseIC);
    24952498#endif
    24962499#if H_3D_NBDV_REF
     
    25092512#endif
    25102513#if H_3D_INTER_SDC
    2511   printf( "interSDC: %d ", m_bDepthInterSDCFlag ? 1 : 0 );
     2514  printf( "interSDC:%d ", m_bDepthInterSDCFlag ? 1 : 0 );
     2515#endif
     2516#if H_3D_DBBP
     2517  printf("DBBP:%d ", m_bUseDBBP ? 1 : 0);
    25122518#endif
    25132519#if H_3D_IV_MERGE
    2514   printf( "MPI: %d ", m_bMPIFlag ? 1 : 0 );
     2520  printf( "MPI:%d ", m_bMPIFlag ? 1 : 0 );
    25152521#endif
    25162522  printf("\n\n"); 
  • branches/HTM-9.3-dev1-RWTH/source/App/TAppEncoder/TAppEncCfg.h

    r779 r816  
    492492  Bool m_bDepthInterSDCFlag;                                ///< flag for inter SDC of depth map coding
    493493#endif
     494#if H_3D_DBBP
     495  Bool      m_bUseDBBP;                                     ///< flag for depth-based block partitioning
     496#endif
    494497#if H_3D_IV_MERGE
    495498  Bool m_bMPIFlag;                                           ///< flag for MPI of depth map coding
  • branches/HTM-9.3-dev1-RWTH/source/App/TAppEncoder/TAppEncTop.cpp

    r795 r816  
    204204#if H_3D_INTER_SDC
    205205    m_cTEncTop.setInterSDCEnable               ( isDepth ? m_bDepthInterSDCFlag    : false );
     206#endif
     207#if H_3D_DBBP
     208    m_cTEncTop.setUseDBBP                      ( vps.getViewIndex( layerId ) == 0 || isDepth ? false : m_bUseDBBP );
    206209#endif
    207210#if H_3D_IV_MERGE
     
    19121915#if H_3D_VSP
    19131916    vps.setViewSynthesisPredFlag( layer, !isLayerZero && !isDepth && m_viewSynthesisPredFlag );         
    1914 #endif     
     1917#endif
     1918#if H_3D_DBBP
     1919    vps.setUseDBBP              ( layer, !isLayerZero && !isDepth && m_bUseDBBP );
     1920#endif
    19151921#if H_3D_INTER_SDC
    19161922    vps.setInterSDCFlag( layer, !isLayerZero && isDepth && m_bDepthInterSDCFlag );
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/ContextTables.h

    r773 r816  
    125125#define NUM_INTER_SDC_RESIDUAL_CTX    1      ///< number of context models for abs of inter SDC residual
    126126#endif
     127
     128#if H_3D_DBBP
     129#define DBBP_NUM_FLAG_CTX                 1
     130#endif
    127131// ====================================================================================================================
    128132// Tables
     
    459463//! \}
    460464
    461 
    462 #endif
     465#if H_3D_DBBP
     466static const UChar INIT_DBBP_FLAG[3][DBBP_NUM_FLAG_CTX] =
     467{
     468  { CNU },
     469  { CNU },
     470  { CNU },
     471};
     472#endif
     473
     474#endif
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComDataCU.cpp

    r809 r816  
    153153  m_pucInterSDCMask       = NULL;
    154154#endif
     155#if H_3D_DBBP
     156  m_pbDBBPFlag         = NULL;
     157#endif
    155158
    156159#if MTK_DDD_G0063
     
    288291    }
    289292#endif
     293#if H_3D_DBBP
     294    m_pbDBBPFlag         = (Bool*  )xMalloc(Bool,   uiNumPartition);
     295#endif
    290296  }
    291297  else
     
    425431      if ( m_apSegmentInterDCOffset[i] ) { xFree( m_apSegmentInterDCOffset[i] ); m_apSegmentInterDCOffset[i] = NULL; }
    426432  }
     433#endif
     434#if H_3D_DBBP
     435    if ( m_pbDBBPFlag         ) { xFree(m_pbDBBPFlag);          m_pbDBBPFlag        = NULL; }
    427436#endif
    428437  }
     
    577586#if H_3D_INTER_SDC
    578587    m_pbInterSDCFlag[ui] = pcFrom->m_pbInterSDCFlag[ui];
     588#endif
     589#if H_3D_DBBP
     590    m_pbDBBPFlag[ui] = pcFrom->m_pbDBBPFlag[ui];
    579591#endif
    580592  }
     
    653665      memset( m_apSegmentInterDCOffset[i] + firstElement,     0,         numElements * sizeof( *m_apSegmentInterDCOffset[i] ) );
    654666    }
     667#endif
     668#if H_3D_DBBP
     669    memset( m_pbDBBPFlag        + firstElement, false,                    numElements * sizeof( *m_pbDBBPFlag ) );
    655670#endif
    656671  }
     
    832847      }
    833848#endif
     849#if H_3D_DBBP
     850      m_pbDBBPFlag[ui] = false;
     851#endif
    834852    }
    835853  }
     
    950968    memset( m_apSegmentInterDCOffset[i], 0, sizeof( Int ) * m_uiNumPartition );
    951969  }
     970#endif
     971#if H_3D_DBBP
     972  memset( m_pbDBBPFlag,         0, iSizeInBool  );
    952973#endif
    953974
     
    10341055      }
    10351056#endif
     1057#if H_3D_DBBP
     1058      m_pbDBBPFlag[ui]=pcCU->m_pbDBBPFlag[uiPartOffset+ui];
     1059#endif
    10361060    }
    10371061  }
     
    11951219  }
    11961220#endif
     1221#if H_3D_DBBP
     1222  m_pbDBBPFlag              = pcCU->getDBBPFlag()         + uiPart;
     1223#endif
    11971224  m_puhDepth=pcCU->getDepth()                     + uiPart;
    11981225  m_puhWidth=pcCU->getWidth()                     + uiPart;
     
    13111338  m_pucDisparityDerivedDepth         = pcCU->getDDDepth()              + uiAbsPartIdx;
    13121339  m_pbUseDDD                         = pcCU->getUseDDD()              + uiAbsPartIdx;
     1340#endif
     1341   
     1342#if H_3D_DBBP
     1343  m_pbDBBPFlag       = pcCU->getDBBPFlag()              + uiAbsPartIdx;
    13131344#endif
    13141345
     
    14001431  }
    14011432#endif
     1433#if H_3D_DBBP
     1434  memcpy( m_pbDBBPFlag          + uiOffset, pcCU->getDBBPFlag(),          iSizeInBool  );
     1435#endif
    14021436
    14031437  memcpy( m_puhDepth  + uiOffset, pcCU->getDepth(),  iSizeInUchar );
     
    15271561  }
    15281562#endif
     1563#if H_3D_DBBP
     1564  memcpy( rpcCU->getDBBPFlag()          + m_uiAbsIdxInLCU, m_pbDBBPFlag,          iSizeInBool  );
     1565#endif
     1566 
    15291567  memcpy( rpcCU->getDepth()  + m_uiAbsIdxInLCU, m_puhDepth,  iSizeInUchar );
    15301568  memcpy( rpcCU->getWidth()  + m_uiAbsIdxInLCU, m_puhWidth,  iSizeInUchar );
     
    16401678  }
    16411679#endif
     1680#if H_3D_DBBP
     1681  memcpy( rpcCU->getDBBPFlag()          + uiPartOffset, m_pbDBBPFlag,          iSizeInBool  );
     1682#endif
     1683 
    16421684  memcpy( rpcCU->getDepth()  + uiPartOffset, m_puhDepth,  iSizeInUchar );
    16431685  memcpy( rpcCU->getWidth()  + uiPartOffset, m_puhWidth,  iSizeInUchar );
     
    23782420
    23792421  return uiCtx;
     2422}
     2423#endif
     2424
     2425#if H_3D_DBBP
     2426Pel* TComDataCU::getVirtualDepthBlock(UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt& uiDepthStride)
     2427{
     2428  // get coded and reconstructed depth view
     2429  TComPicYuv* depthPicYuv = NULL;
     2430  Pel* pDepthPels = NULL;
     2431 
     2432  // DBBP is a texture coding tool
     2433  if( getSlice()->getIsDepth() )
     2434    return NULL;
     2435 
     2436#if H_3D_FCO
     2437  TComPic* depthPic = getSlice()->getIvPic(true, getSlice()->getViewIndex() );
     2438 
     2439  if( depthPic && depthPic->getPicYuvRec() != NULL && depthPic->getIsDepth() )  // depth first
     2440  {
     2441    depthPicYuv = depthPic->getPicYuvRec();
     2442    depthPicYuv->extendPicBorder();
     2443   
     2444    // get collocated depth block for current CU
     2445    uiDepthStride = depthPicYuv->getStride();
     2446    pDepthPels    = depthPicYuv->getLumaAddr( getAddr(), uiAbsPartIdx );
     2447  }
     2448  else  // texture first
     2449#else
     2450  {
     2451    DisInfo DvInfo = getDvInfo(uiAbsPartIdx);
     2452   
     2453    TComPic* baseDepthPic = getSlice()->getIvPic (true, DvInfo.m_aVIdxCan);
     2454   
     2455    if( baseDepthPic == NULL || baseDepthPic->getPicYuvRec() == NULL )
     2456      return NULL;
     2457   
     2458    depthPicYuv   = baseDepthPic->getPicYuvRec();
     2459    depthPicYuv->extendPicBorder();
     2460    uiDepthStride = depthPicYuv->getStride();
     2461   
     2462    Int iBlkX = ( getAddr() % baseDepthPic->getFrameWidthInCU() ) * g_uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ getZorderIdxInCU()+uiAbsPartIdx ] ];
     2463    Int iBlkY = ( getAddr() / baseDepthPic->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ getZorderIdxInCU()+uiAbsPartIdx ] ];
     2464   
     2465    Int iPictureWidth  = depthPicYuv->getWidth();
     2466    Int iPictureHeight = depthPicYuv->getHeight();
     2467   
     2468    Int iWidth  = uiWidth;
     2469    Int iHeight = uiHeight;
     2470   
     2471    Bool depthRefineFlag = false;
     2472#if H_3D_NBDV_REF
     2473    depthRefineFlag = m_pcSlice->getVPS()->getDepthRefinementFlag( m_pcSlice->getLayerIdInVps() );
     2474#endif // H_3D_NBDV_REF
     2475   
     2476    TComMv cDv = depthRefineFlag ? DvInfo.m_acDoNBDV : DvInfo.m_acNBDV;
     2477   
     2478    Int depthPosX = Clip3(0,   iPictureWidth - iWidth,  iBlkX + ((cDv.getHor()+2)>>2));
     2479    Int depthPosY = Clip3(0,   iPictureHeight- iHeight, iBlkY + ((cDv.getVer()+2)>>2));
     2480   
     2481    pDepthPels = depthPicYuv->getLumaAddr() + depthPosX + depthPosY * uiDepthStride;
     2482  }
     2483#endif
     2484 
     2485  AOF( depthPicYuv != NULL );
     2486  AOF( pDepthPels != NULL );
     2487  AOF( uiDepthStride != 0 );
     2488 
     2489  return pDepthPels;
     2490}
     2491#endif
     2492
     2493#if H_3D_DBBP
     2494Void TComDataCU::setDBBPFlagSubParts ( Bool bDBBPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
     2495{
     2496  setSubPart( bDBBPFlag, m_pbDBBPFlag, uiAbsPartIdx, uiDepth, uiPartIdx );
    23802497}
    23812498#endif
     
    40304147#if H_3D_ARP
    40314148  Bool bARPFlag = getARPW(uiAbsPartIdx)>0 ? true : false;
     4149#endif
     4150#if H_3D_DBBP
     4151  Bool bDBBPFlag = getDBBPFlag(uiAbsPartIdx);
    40324152#endif
    40334153
     
    46964816      pbSPIVMPFlag[iCount] = true;
    46974817#endif
     4818#if H_3D_DBBP
     4819      pbSPIVMPFlag[iCount] &= !bDBBPFlag;
     4820#endif
    46984821      if( ( ivCandDir[0] & 1 ) == 1 )
    46994822      {
     
    58095932  Int height = 0;
    58105933  UInt partAddr;
     5934 
     5935#if H_3D_DBBP
     5936  if( getDBBPFlag(0) )
     5937    return true;
     5938#endif
    58115939
    58125940  getPartIndexAndSize( puIdx, partAddr, width, height );
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComDataCU.h

    r809 r816  
    9797};
    9898
     99#if H_3D_DBBP
     100typedef struct _DBBPTmpData
     101{
     102  TComMv      acMvd[2][2];          // for two segments and two lists
     103  TComMvField acMvField[2][2];      // for two segments and two lists
     104  Int         aiMvpNum[2][2];       // for two segments and two lists
     105  Int         aiMvpIdx[2][2];       // for two segments and two lists
     106  UChar       auhInterDir[2];       // for two segments
     107  Bool        abMergeFlag[2];       // for two segments
     108  UChar       auhMergeIndex[2];     // for two segments
     109  Char        ahVSPFlag[2];         // for two segments
     110  DisInfo     acDvInfo[2];          // for two segments
     111 
     112  PartSize    eVirtualPartSize;
     113  UInt        uiVirtualPartIndex;
     114} DBBPTmpData;
     115#endif
    99116
    100117// ====================================================================================================================
     
    223240  UChar*        m_pucInterSDCMask;
    224241#endif
     242#if H_3D_DBBP
     243  Bool*         m_pbDBBPFlag;        ///< array of DBBP flags
     244  DBBPTmpData   m_sDBBPTmpData;
     245#endif
    225246#if H_3D
    226247  Bool          m_bAvailableFlagA1;    ///< A1 available flag
     
    362383  Void          setCUTransquantBypassSubParts( Bool flag, UInt uiAbsPartIdx, UInt uiDepth );
    363384 
     385#if H_3D_DBBP
     386  Pel*          getVirtualDepthBlock(UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt& uiDepthStride);
     387#endif
     388 
    364389  Bool*        getSkipFlag            ()                        { return m_skipFlag;          }
    365390  Bool         getSkipFlag            (UInt idx)                { return m_skipFlag[idx];     }
     
    373398  Void          setPredictionMode     ( UInt uiIdx, PredMode uh){ m_pePredMode[uiIdx] = uh;   }
    374399  Void          setPredModeSubParts   ( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth );
     400 
     401#if H_3D_DBBP
     402  Bool*         getDBBPFlag           ()                        { return m_pbDBBPFlag;               }
     403  Bool          getDBBPFlag           ( UInt uiIdx )            { return m_pbDBBPFlag[uiIdx];        }
     404  Void          setDBBPFlag           ( UInt uiIdx, Bool b )    { m_pbDBBPFlag[uiIdx] = b;           }
     405  Void          setDBBPFlagSubParts   ( Bool bDBBPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
     406  DBBPTmpData*  getDBBPTmpData        () { return &m_sDBBPTmpData; }
     407#endif
    375408 
    376409  UChar*        getWidth              ()                        { return m_puhWidth;          }
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComPrediction.cpp

    r809 r816  
    601601#endif
    602602
     603#if H_3D_DBBP
     604PartSize TComPrediction::getPartitionSizeFromDepth(Pel* pDepthPels, UInt uiDepthStride, UInt uiSize)
     605{
     606  // find virtual partitioning for this CU based on depth block
     607  // segmentation of texture block --> mask IDs
     608  Pel*  pDepthBlockStart      = pDepthPels;
     609 
     610  // first compute average of depth block for thresholding
     611  Int iSumDepth = 0;
     612  Int iSubSample = 4;
     613  for (Int y=0; y<uiSize; y+=iSubSample)
     614  {
     615    for (Int x=0; x<uiSize; x+=iSubSample)
     616    {
     617      Int depthPel = pDepthPels[x];
     618     
     619      iSumDepth += depthPel;
     620    }
     621   
     622    // next row
     623    pDepthPels += uiDepthStride*iSubSample;
     624  }
     625 
     626  Int iSizeInBits = g_aucConvertToBit[uiSize] - g_aucConvertToBit[iSubSample];  // respect sub-sampling factor
     627  Int iMean = iSumDepth >> iSizeInBits*2;       // iMean /= (uiWidth*uiHeight);
     628  AOF( iMean == iSumDepth/((uiSize/iSubSample)*(uiSize/iSubSample) ) );
     629  AOF( iMean >= 0 && iMean < 256);
     630 
     631  // start again for segmentation
     632  pDepthPels = pDepthBlockStart;
     633 
     634  // start mapping process
     635  Bool bAMPAvail = uiSize > 8;
     636  Int matchedPartSum[6][2] = {{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}}; // counter for each part size and boolean option
     637  PartSize virtualPartSizes[6] = { SIZE_Nx2N, SIZE_2NxN, SIZE_2NxnU, SIZE_2NxnD, SIZE_nLx2N, SIZE_nRx2N };
     638 
     639  UInt uiHalfSize = uiSize>>1;
     640  UInt uiQuarterSize = uiSize>>2;
     641 
     642  for (Int y=0; y<uiSize; y+=iSubSample)
     643  {
     644    for (Int x=0; x<uiSize; x+=iSubSample)
     645    {
     646      Int depthPel = pDepthPels[x];
     647     
     648      // decide which segment this pixel belongs to
     649      Int ucSegment = (Int)(depthPel>iMean);
     650      AOF( ucSegment == 0 || ucSegment == 1 );
     651     
     652      // Matched Filter to find optimal (conventional) partitioning
     653     
     654      // SIZE_Nx2N
     655      if(x<uiHalfSize)  // left
     656        matchedPartSum[0][ucSegment]++;
     657      else  // right
     658        matchedPartSum[0][1-ucSegment]++;
     659     
     660      // SIZE_2NxN
     661      if(y<uiHalfSize)  // top
     662        matchedPartSum[1][ucSegment]++;
     663      else  // bottom
     664        matchedPartSum[1][1-ucSegment]++;
     665     
     666      if( bAMPAvail )
     667      {
     668        // SIZE_2NxnU
     669        if(y<uiQuarterSize)  // top (1/4)
     670          matchedPartSum[2][ucSegment]++;
     671        else  // bottom (3/4)
     672          matchedPartSum[2][1-ucSegment]++;
     673       
     674        // SIZE_2NxnD
     675        if(y<(uiQuarterSize*3))  // top (3/4)
     676          matchedPartSum[3][ucSegment]++;
     677        else  // bottom (1/4)
     678          matchedPartSum[3][1-ucSegment]++;
     679       
     680        // SIZE_nLx2N
     681        if(x<uiQuarterSize)  // left (1/4)
     682          matchedPartSum[4][ucSegment]++;
     683        else  // right (3/4)
     684          matchedPartSum[4][1-ucSegment]++;
     685       
     686        // SIZE_nRx2N
     687        if(x<(uiQuarterSize*3))  // left (3/4)
     688          matchedPartSum[5][ucSegment]++;
     689        else  // right (1/4)
     690          matchedPartSum[5][1-ucSegment]++;
     691      }
     692    }
     693   
     694    // next row
     695    pDepthPels += uiDepthStride*iSubSample;
     696  }
     697 
     698  PartSize matchedPartSize = SIZE_NONE;
     699 
     700  Int iMaxMatchSum = 0;
     701  for(Int p=0; p<6; p++)  // loop over partition sizes
     702  {
     703    for( Int b=0; b<=1; b++ ) // loop over boolean options
     704    {
     705      if(matchedPartSum[p][b] > iMaxMatchSum)
     706      {
     707        iMaxMatchSum = matchedPartSum[p][b];
     708        matchedPartSize = virtualPartSizes[p];
     709      }
     710    }
     711  }
     712 
     713  AOF( matchedPartSize != SIZE_NONE );
     714 
     715  return matchedPartSize;
     716}
     717
     718Bool TComPrediction::getSegmentMaskFromDepth( Pel* pDepthPels, UInt uiDepthStride, UInt uiWidth, UInt uiHeight, Bool* pMask )
     719{
     720  AOF( uiWidth == uiHeight );
     721 
     722  // segmentation of texture block --> mask IDs
     723  Pel*  pDepthBlockStart      = pDepthPels;
     724 
     725  // first compute average of depth block for thresholding
     726  Int iSumDepth = 0;
     727  Int uiMinDepth = MAX_INT;
     728  Int uiMaxDepth = 0;
     729  for (Int y=0; y<uiHeight; y++)
     730  {
     731    for (Int x=0; x<uiWidth; x++)
     732    {
     733      Int depthPel = pDepthPels[x];
     734      iSumDepth += depthPel;
     735     
     736      if( depthPel > uiMaxDepth )
     737        uiMaxDepth = depthPel;
     738      if( depthPel < uiMinDepth )
     739        uiMinDepth = depthPel;
     740    }
     741   
     742    // next row
     743    pDepthPels += uiDepthStride;
     744  }
     745 
     746  // don't generate mask for blocks with small depth range (encoder decision)
     747  if( uiMaxDepth - uiMinDepth < 10 )
     748    return false;
     749 
     750  Int iSizeInBits = g_aucConvertToBit[uiWidth]+2;
     751  Int iMean = iSumDepth >> iSizeInBits*2;       // iMean /= (uiWidth*uiHeight);
     752  AOF( iMean == iSumDepth/(uiWidth*uiHeight) );
     753  AOF( iMean >= 0 && iMean < 256);
     754 
     755  // start again for segmentation
     756  pDepthPels = pDepthBlockStart;
     757 
     758  Bool bInvertMask = pDepthPels[0]>iMean; // top-left segment needs to be mapped to partIdx 0
     759 
     760  // generate mask
     761  UInt uiSumPix[2] = {0,0};
     762  for (Int y=0; y<uiHeight; y++)
     763  {
     764    for (Int x=0; x<uiHeight; x++)
     765    {
     766      Int depthPel = pDepthPels[x];
     767     
     768      // decide which segment this pixel belongs to
     769      Int ucSegment = (Int)(depthPel>iMean);
     770      AOF( ucSegment == 0 || ucSegment == 1 );
     771     
     772      if( bInvertMask )
     773        ucSegment = 1-ucSegment;
     774     
     775      // count pixels for each segment
     776      uiSumPix[ucSegment]++;
     777     
     778      // set mask value
     779      pMask[x] = (Bool)ucSegment;
     780    }
     781   
     782    // next row
     783    pDepthPels += uiDepthStride;
     784    pMask += MAX_CU_SIZE;
     785  }
     786 
     787  // don't generate valid mask for tiny segments (encoder decision)
     788  // each segment needs to cover at least 1/8th of block
     789  UInt uiMinPixPerSegment = (uiWidth*uiHeight) >> 3;
     790  if( !( uiSumPix[0] > uiMinPixPerSegment && uiSumPix[1] > uiMinPixPerSegment ) )
     791    return false;
     792 
     793  // all good
     794  return true;
     795}
     796
     797Void TComPrediction::combineSegmentsWithMask( TComYuv* pInYuv[2], TComYuv* pOutYuv, Bool* pMask, UInt uiWidth, UInt uiHeight, UInt uiPartAddr )
     798{
     799  Pel*  piSrc[2]    = {pInYuv[0]->getLumaAddr(uiPartAddr), pInYuv[1]->getLumaAddr(uiPartAddr)};
     800  UInt  uiSrcStride = pInYuv[0]->getStride();
     801  Pel*  piDst       = pOutYuv->getLumaAddr(uiPartAddr);
     802  UInt  uiDstStride = pOutYuv->getStride();
     803 
     804  UInt  uiMaskStride= MAX_CU_SIZE;
     805 
     806  // backup pointer
     807  Bool* pMaskStart = pMask;
     808 
     809  // combine luma first
     810  for (Int y=0; y<uiHeight; y++)
     811  {
     812    for (Int x=0; x<uiWidth; x++)
     813    {
     814      UChar ucSegment = (UChar)pMask[x];
     815      AOF( ucSegment < 2 );
     816     
     817      // filtering
     818      Bool t = (y==0)?pMaskStart[(y+1)*uiMaskStride+x]:pMaskStart[(y-1)*uiMaskStride+x];
     819      Bool l = (x==0)?pMaskStart[y*uiMaskStride+x+1]:pMaskStart[y*uiMaskStride+x-1];
     820      Bool b = (y==uiHeight-1)?pMaskStart[(y-1)*uiMaskStride+x]:pMaskStart[(y+1)*uiMaskStride+x];
     821      Bool r = (x==uiWidth-1)?pMaskStart[y*uiMaskStride+x-1]:pMaskStart[y*uiMaskStride+x+1];
     822     
     823      Bool bBlend = !((t&&l&&b&&r) || (!t&&!l&&!b&&!r));
     824      piDst[x] = bBlend?((piSrc[0][x]+piSrc[1][x]+1)>>1):piSrc[ucSegment][x];
     825    }
     826   
     827    piSrc[0]  += uiSrcStride;
     828    piSrc[1]  += uiSrcStride;
     829    piDst     += uiDstStride;
     830    pMask     += uiMaskStride;
     831  }
     832 
     833  // now combine chroma
     834  Pel*  piSrcU[2]       = { pInYuv[0]->getCbAddr(uiPartAddr), pInYuv[1]->getCbAddr(uiPartAddr) };
     835  Pel*  piSrcV[2]       = { pInYuv[0]->getCrAddr(uiPartAddr), pInYuv[1]->getCrAddr(uiPartAddr) };
     836  UInt  uiSrcStrideC    = pInYuv[0]->getCStride();
     837  Pel*  piDstU          = pOutYuv->getCbAddr(uiPartAddr);
     838  Pel*  piDstV          = pOutYuv->getCrAddr(uiPartAddr);
     839  UInt  uiDstStrideC    = pOutYuv->getCStride();
     840  UInt  uiWidthC        = uiWidth >> 1;
     841  UInt  uiHeightC       = uiHeight >> 1;
     842  pMask = pMaskStart;
     843 
     844  for (Int y=0; y<uiHeightC; y++)
     845  {
     846    for (Int x=0; x<uiWidthC; x++)
     847    {
     848      UChar ucSegment = (UChar)pMask[x*2];
     849      AOF( ucSegment < 2 );
     850     
     851      // filtering
     852      Bool t = (y==0)?pMaskStart[(y+1)*2*uiMaskStride+x*2]:pMaskStart[(y-1)*2*uiMaskStride+x*2];
     853      Bool l = (x==0)?pMaskStart[y*2*uiMaskStride+(x+1)*2]:pMaskStart[y*2*uiMaskStride+(x-1)*2];
     854      Bool b = (y==uiHeightC-1)?pMaskStart[(y-1)*2*uiMaskStride+x*2]:pMaskStart[(y+1)*2*uiMaskStride+x*2];
     855      Bool r = (x==uiWidthC-1)?pMaskStart[y*2*uiMaskStride+(x-1)*2]:pMaskStart[y*2*uiMaskStride+(x+1)*2];
     856     
     857      Bool bBlend = !((t&&l&&b&&r) || (!t&&!l&&!b&&!r));
     858     
     859      piDstU[x] = bBlend?((piSrcU[0][x]+piSrcU[1][x]+1)>>1):piSrcU[ucSegment][x];
     860      piDstV[x] = bBlend?((piSrcV[0][x]+piSrcV[1][x]+1)>>1):piSrcV[ucSegment][x];
     861    }
     862   
     863    piSrcU[0]   += uiSrcStrideC;
     864    piSrcU[1]   += uiSrcStrideC;
     865    piSrcV[0]   += uiSrcStrideC;
     866    piSrcV[1]   += uiSrcStrideC;
     867    piDstU      += uiDstStrideC;
     868    piDstV      += uiDstStrideC;
     869    pMask       += 2*uiMaskStride;
     870  }
     871}
     872#endif
     873
    603874Void TComPrediction::motionCompensation ( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList, Int iPartIdx )
    604875{
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComPrediction.h

    r809 r816  
    179179#endif
    180180#endif
     181 
     182#if H_3D_DBBP
     183  PartSize      getPartitionSizeFromDepth(Pel* pDepthPels, UInt uiDepthStride, UInt uiSize);
     184  Bool          getSegmentMaskFromDepth( Pel* pDepthPels, UInt uiDepthStride, UInt uiWidth, UInt uiHeight, Bool* pMask );
     185  Void          combineSegmentsWithMask( TComYuv* pInYuv[2], TComYuv* pOutYuv, Bool* pMask, UInt uiWidth, UInt uiHeight, UInt uiPartAddr = 0 );
     186#endif
    181187
    182188  Pel  predIntraGetPredValDC      ( Int* pSrc, Int iSrcStride, UInt iWidth, UInt iHeight, Bool bAbove, Bool bLeft );
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComRdCost.cpp

    r655 r816  
    326326  rcDistParam.DistFunc = m_afpDistortFunc[eDFunc + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ];
    327327 
     328#if H_3D_DBBP
     329  if( g_bTestVirtualParts )
     330  {
     331    if( eDFunc >= DF_SSE && eDFunc <= DF_SSE16N )
     332      rcDistParam.DistFunc = TComRdCost::xGetMaskedSSE;
     333    else if( eDFunc >= DF_SAD && eDFunc <= DF_SADS16N )
     334      rcDistParam.DistFunc = TComRdCost::xGetMaskedSAD;
     335    else if( eDFunc >= DF_HADS && eDFunc <= DF_HADS16N )
     336      rcDistParam.DistFunc = TComRdCost::xGetMaskedHADs;
     337    else if( eDFunc >= DF_VSD && eDFunc <= DF_VSD16N )
     338      rcDistParam.DistFunc = TComRdCost::xGetMaskedVSD;
     339    else if( eDFunc >= DF_SAD12 && eDFunc <= DF_SADS48 )
     340      rcDistParam.DistFunc = TComRdCost::xGetMaskedSAD;
     341  }
     342#endif
     343 
    328344  // initialize
    329345  rcDistParam.iSubShift  = 0;
     
    357373  {
    358374    rcDistParam.DistFunc = m_afpDistortFunc[45 ];
     375  }
     376#endif
     377 
     378#if H_3D_DBBP
     379  if( g_bTestVirtualParts )
     380  {
     381    rcDistParam.DistFunc = TComRdCost::xGetMaskedSAD;
    359382  }
    360383#endif
     
    411434    rcDistParam.DistFunc = m_afpDistortFunc[DF_HADS + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ];
    412435  }
     436 
     437#if H_3D_DBBP
     438  if( g_bTestVirtualParts )
     439  {
     440    if( !bHADME )
     441      rcDistParam.DistFunc = TComRdCost::xGetMaskedSAD;
     442    else
     443      rcDistParam.DistFunc = TComRdCost::xGetMaskedHADs;
     444  }
     445#endif
    413446 
    414447  // initialize
     
    433466  rcDP.bitDepth   = bitDepth;
    434467  rcDP.DistFunc   = m_afpDistortFunc[ ( bHadamard ? DF_HADS : DF_SADS ) + g_aucConvertToBit[ iWidth ] + 1 ];
     468 
     469#if H_3D_DBBP
     470  if( g_bTestVirtualParts )
     471  {
     472    if( !bHadamard )
     473      rcDP.DistFunc = TComRdCost::xGetMaskedSAD;
     474    else
     475      rcDP.DistFunc = TComRdCost::xGetMaskedHADs;
     476  }
     477#endif
     478 
    435479#if NS_HAD
    436480  rcDP.bUseNSHAD  = bUseNSHAD;
     
    631675// Distortion functions
    632676// ====================================================================================================================
     677
     678#if H_3D_DBBP
     679// --------------------------------------------------------------------------------------------------------------------
     680// Masked distortion functions
     681// --------------------------------------------------------------------------------------------------------------------
     682
     683UInt TComRdCost::xGetMaskedSSE( DistParam* pcDtParam )
     684{
     685  Pel* piOrg   = pcDtParam->pOrg;
     686  Pel* piCur   = pcDtParam->pCur;
     687  Int  iRows   = pcDtParam->iRows;
     688  Int  iCols   = pcDtParam->iCols;
     689  Int  iStrideOrg = pcDtParam->iStrideOrg;
     690  Int  iStrideCur = pcDtParam->iStrideCur;
     691 
     692  UInt uiSum = 0;
     693 
     694  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1);
     695 
     696  Int iTemp;
     697 
     698  for( ; iRows != 0; iRows-- )
     699  {
     700    for (Int n = 0; n < iCols; n++ )
     701    {
     702      if( piOrg[n] != DBBP_INVALID_SHORT )
     703      {
     704        iTemp = piOrg[n  ] - piCur[n  ];
     705        uiSum += ( iTemp * iTemp ) >> uiShift;
     706      }
     707    }
     708    piOrg += iStrideOrg;
     709    piCur += iStrideCur;
     710  }
     711 
     712  return ( uiSum );
     713}
     714
     715UInt TComRdCost::xGetMaskedSAD( DistParam* pcDtParam )
     716{
     717 
     718  AOF(!pcDtParam->bApplyWeight);
     719#if H_3D_IC
     720  AOF(!pcDtParam->bUseIC);
     721#endif
     722 
     723  Pel* piOrg   = pcDtParam->pOrg;
     724  Pel* piCur   = pcDtParam->pCur;
     725  Int  iRows   = pcDtParam->iRows;
     726  Int  iCols   = pcDtParam->iCols;
     727  Int  iStrideCur = pcDtParam->iStrideCur;
     728  Int  iStrideOrg = pcDtParam->iStrideOrg;
     729 
     730  UInt uiSum = 0;
     731 
     732  for( ; iRows != 0; iRows-- )
     733  {
     734    for (Int n = 0; n < iCols; n++ )
     735    {
     736      if( piOrg[n] != DBBP_INVALID_SHORT )
     737        uiSum += abs( piOrg[n] - piCur[n] );
     738    }
     739    piOrg += iStrideOrg;
     740    piCur += iStrideCur;
     741  }
     742 
     743  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     744}
     745
     746UInt TComRdCost::xGetMaskedHADs( DistParam* pcDtParam )
     747{
     748  AOF(!pcDtParam->bApplyWeight);
     749#if H_3D_IC
     750  AOF(!pcDtParam->bUseIC);
     751#endif
     752  Pel* piOrg   = pcDtParam->pOrg;
     753  Pel* piCur   = pcDtParam->pCur;
     754  Int  iRows   = pcDtParam->iRows;
     755  Int  iCols   = pcDtParam->iCols;
     756  Int  iStrideCur = pcDtParam->iStrideCur;
     757  Int  iStrideOrg = pcDtParam->iStrideOrg;
     758  Int  iStep  = pcDtParam->iStep;
     759 
     760  Int  x, y;
     761 
     762  UInt uiSum = 0;
     763 
     764#if NS_HAD
     765  if( ( ( iRows % 8 == 0) && (iCols % 8 == 0) && ( iRows == iCols ) ) || ( ( iRows % 8 == 0 ) && (iCols % 8 == 0) && !pcDtParam->bUseNSHAD ) )
     766#else
     767    if( ( iRows % 8 == 0) && (iCols % 8 == 0) )
     768#endif
     769    {
     770      Int  iOffsetOrg = iStrideOrg<<3;
     771      Int  iOffsetCur = iStrideCur<<3;
     772      for ( y=0; y<iRows; y+= 8 )
     773      {
     774        for ( x=0; x<iCols; x+= 8 )
     775        {
     776          if( piOrg[x] != DBBP_INVALID_SHORT )
     777            uiSum += xCalcHADs8x8( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
     778        }
     779        piOrg += iOffsetOrg;
     780        piCur += iOffsetCur;
     781      }
     782    }
     783#if NS_HAD
     784    else if ( ( iCols > 8 ) && ( iCols > iRows ) && pcDtParam->bUseNSHAD )
     785    {
     786      Int  iOffsetOrg = iStrideOrg<<2;
     787      Int  iOffsetCur = iStrideCur<<2;
     788      for ( y=0; y<iRows; y+= 4 )
     789      {
     790        for ( x=0; x<iCols; x+= 16 )
     791        {
     792          if( piOrg[x] != DBBP_INVALID_SHORT )
     793            uiSum += xCalcHADs16x4( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
     794        }
     795        piOrg += iOffsetOrg;
     796        piCur += iOffsetCur;
     797      }
     798    }
     799    else if ( ( iRows > 8 ) && ( iCols < iRows ) && pcDtParam->bUseNSHAD )
     800    {
     801      Int  iOffsetOrg = iStrideOrg<<4;
     802      Int  iOffsetCur = iStrideCur<<4;
     803      for ( y=0; y<iRows; y+= 16 )
     804      {
     805        for ( x=0; x<iCols; x+= 4 )
     806        {
     807          if( piOrg[x] != DBBP_INVALID_SHORT )
     808            uiSum += xCalcHADs4x16( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
     809        }
     810        piOrg += iOffsetOrg;
     811        piCur += iOffsetCur;
     812      }
     813    }
     814#endif
     815    else if( ( iRows % 4 == 0) && (iCols % 4 == 0) )
     816    {
     817      Int  iOffsetOrg = iStrideOrg<<2;
     818      Int  iOffsetCur = iStrideCur<<2;
     819     
     820      for ( y=0; y<iRows; y+= 4 )
     821      {
     822        for ( x=0; x<iCols; x+= 4 )
     823        {
     824          if( piOrg[x] != DBBP_INVALID_SHORT )
     825            uiSum += xCalcHADs4x4( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
     826        }
     827        piOrg += iOffsetOrg;
     828        piCur += iOffsetCur;
     829      }
     830    }
     831    else if( ( iRows % 2 == 0) && (iCols % 2 == 0) )
     832    {
     833      Int  iOffsetOrg = iStrideOrg<<1;
     834      Int  iOffsetCur = iStrideCur<<1;
     835      for ( y=0; y<iRows; y+=2 )
     836      {
     837        for ( x=0; x<iCols; x+=2 )
     838        {
     839          if( piOrg[x] != DBBP_INVALID_SHORT )
     840            uiSum += xCalcHADs2x2( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
     841        }
     842        piOrg += iOffsetOrg;
     843        piCur += iOffsetCur;
     844      }
     845    }
     846    else
     847    {
     848      assert(false);
     849    }
     850 
     851  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     852}
     853
     854UInt TComRdCost::xGetMaskedVSD( DistParam* pcDtParam )
     855{
     856  Pel* piOrg    = pcDtParam->pOrg;
     857  Pel* piCur    = pcDtParam->pCur;
     858  Pel* piVirRec = pcDtParam->pVirRec;
     859  Pel* piVirOrg = pcDtParam->pVirOrg;
     860  Int  iRows    = pcDtParam->iRows;
     861  Int  iCols    = pcDtParam->iCols;
     862  Int  iStrideOrg = pcDtParam->iStrideOrg;
     863  Int  iStrideCur = pcDtParam->iStrideCur;
     864  Int  iStrideVir = pcDtParam->iStrideVir;
     865 
     866  UInt uiSum = 0;
     867  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1;
     868 
     869  Int dDM;
     870 
     871  for ( Int y = 0 ; y < iRows ; y++ )
     872  {
     873    for (Int x = 0; x < iCols; x++ )
     874    {
     875      if( piOrg[x] != DBBP_INVALID_SHORT )
     876      {
     877        dDM = (Int) ( piOrg[x  ] - piCur[x  ] );
     878        uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift;
     879      }
     880    }
     881    piOrg += iStrideOrg;
     882    piCur += iStrideCur;
     883  }
     884 
     885  return ( uiSum );
     886}
     887#endif
    633888
    634889// --------------------------------------------------------------------------------------------------------------------
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComRdCost.h

    r655 r816  
    334334#endif
    335335 
     336#if H_3D_DBBP
     337  static UInt xGetMaskedSSE     ( DistParam* pcDtParam );
     338  static UInt xGetMaskedSAD     ( DistParam* pcDtParam );
     339  static UInt xGetMaskedHADs    ( DistParam* pcDtParam );
     340  static UInt xGetMaskedVSD     ( DistParam* pcDtParam );
     341#endif
     342 
    336343public:
    337344#if WEIGHTED_CHROMA_DISTORTION
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComRom.cpp

    r773 r816  
    106106// ====================================================================================================================
    107107
     108#if H_3D_DBBP
     109Bool g_bTestVirtualParts;
     110#endif
     111
    108112UInt g_uiMaxCUWidth  = MAX_CU_SIZE;
    109113UInt g_uiMaxCUHeight = MAX_CU_SIZE;
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComRom.h

    r773 r816  
    7272// ====================================================================================================================
    7373
     74#if H_3D_DBBP
     75extern       Bool   g_bTestVirtualParts;
     76#endif
     77
    7478// flexible conversion from relative to absolute index
    7579extern       UInt   g_auiZscanToRaster[ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComSlice.cpp

    r795 r816  
    18271827#if H_3D_INTER_SDC
    18281828    m_bInterSDCFlag        [ i ] = false;
     1829#endif
     1830#if H_3D_DBBP
     1831    m_dbbpFlag             [ i ] = false;
    18291832#endif
    18301833#if H_3D_IV_MERGE
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComSlice.h

    r795 r816  
    805805  Bool        m_bInterSDCFlag[MAX_NUM_LAYERS   ];
    806806#endif
     807#if H_3D_DBBP
     808  Bool        m_dbbpFlag[MAX_NUM_LAYERS];
     809#endif
    807810#if H_3D_IV_MERGE
    808811  Bool        m_bMPIFlag[MAX_NUM_LAYERS   ];
     
    955958  Bool    inferOutputLayerFlag( Int layerSetIdx, Int i )                   { return ( getDefaultOneTargetOutputLayerIdc( ) == 0 || ( ( getDefaultOneTargetOutputLayerIdc( ) == 1 ) && ( i == m_layerSetLayerIdList[layerSetIdx].size() - 1  ) ));  }
    956959
    957   Void    setProfileLevelTierIdx( Int outLayerSetIdx, Int val )            { m_profileLevelTierIdx[ outLayerSetIdx  = val ]; }
     960  Void    setProfileLevelTierIdx( Int outLayerSetIdx, Int val )            { m_profileLevelTierIdx[ outLayerSetIdx ] = val; }
    958961  Int     getProfileLevelTierIdx( Int outLayerSetIdx )                     { return m_profileLevelTierIdx[ outLayerSetIdx ]; }
    959962  Void    setAltOutputLayerFlag( Bool flag )                               { m_altOutputLayerFlag = flag; }
     
    10811084  Bool    getInterSDCFlag      ( Int layerIdInVps )           { return m_bInterSDCFlag[layerIdInVps]; }
    10821085  Void    setInterSDCFlag      ( Int layerIdInVps, Bool bval ){ m_bInterSDCFlag[layerIdInVps] = bval; }
     1086#endif
     1087#if H_3D_DBBP
     1088  Bool getUseDBBP              ( Int layerIdInVps )         { return m_dbbpFlag[layerIdInVps]; }
     1089  Void setUseDBBP              ( Int layerIdInVps, Bool bval ){ m_dbbpFlag[layerIdInVps] = bval; }
    10831090#endif
    10841091#if H_3D_IV_MERGE
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TypeDef.h

    r809 r816  
    179179#define H_3D_FCO                          0   // Flexible coding order for 3D
    180180
     181#define H_3D_DBBP                         1   // DBBP: Depth-based Block Partitioning and Merging
     182
     183
    181184
    182185
     
    269272#define IC_CONST_SHIFT                    5
    270273#define IC_SHIFT_DIFF                     12
     274#endif
     275
     276///// ***** DEPTH-BASED BLOCK PARTITIONING *********
     277#if H_3D_DBBP
     278#define DBBP_INVALID_SHORT                (-4)
     279#define RWTH_DBBP_PACK_MODE               SIZE_2NxN
    271280#endif
    272281
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r786 r816  
    17141714        READ_FLAG( uiCode, "view_synthesis_pred_flag[i]"); pcVPS->setViewSynthesisPredFlag( i, uiCode == 1 ? true : false );
    17151715#endif
     1716#if H_3D_DBBP
     1717          READ_FLAG( uiCode, "use_dbbp_flag[i]" ); pcVPS->setUseDBBP( i, uiCode == 1 ? true : false );
     1718#endif
    17161719      }
    17171720      else
     
    27942797}
    27952798#endif
     2799#if H_3D_DBBP
     2800  Void TDecCavlc::parseDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     2801  {
     2802    assert(0);
     2803  }
     2804#endif
    27962805// ====================================================================================================================
    27972806// Protected member functions
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibDecoder/TDecCAVLC.h

    r773 r816  
    127127  Void  parseInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart );
    128128#endif
     129#if H_3D_DBBP
     130  Void  parseDBBPFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     131#endif
    129132  Void parseSplitFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    130133  Void parsePartSize        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibDecoder/TDecCu.cpp

    r809 r816  
    5050  m_ppcYuvReco = NULL;
    5151  m_ppcCU      = NULL;
     52#if H_3D_DBBP
     53  m_ppcYuvRecoDBBP = NULL;
     54#endif
    5255}
    5356
     
    7578  m_ppcYuvReco = new TComYuv*[m_uiMaxDepth-1];
    7679  m_ppcCU      = new TComDataCU*[m_uiMaxDepth-1];
     80#if H_3D_DBBP
     81  m_ppcYuvRecoDBBP = new TComYuv*[m_uiMaxDepth-1];
     82#endif
    7783 
    7884  UInt uiNumPartitions;
     
    8692    m_ppcYuvReco[ui] = new TComYuv;    m_ppcYuvReco[ui]->create( uiWidth, uiHeight );
    8793    m_ppcCU     [ui] = new TComDataCU; m_ppcCU     [ui]->create( uiNumPartitions, uiWidth, uiHeight, true, uiMaxWidth >> (m_uiMaxDepth - 1) );
     94#if H_3D_DBBP
     95    m_ppcYuvRecoDBBP[ui] = new TComYuv;    m_ppcYuvRecoDBBP[ui]->create( uiWidth, uiHeight );
     96#endif
    8897  }
    8998 
     
    106115    m_ppcYuvReco[ui]->destroy(); delete m_ppcYuvReco[ui]; m_ppcYuvReco[ui] = NULL;
    107116    m_ppcCU     [ui]->destroy(); delete m_ppcCU     [ui]; m_ppcCU     [ui] = NULL;
     117#if H_3D_DBBP
     118    m_ppcYuvRecoDBBP[ui]->destroy(); delete m_ppcYuvRecoDBBP[ui]; m_ppcYuvRecoDBBP[ui] = NULL;
     119#endif
    108120  }
    109121 
     
    111123  delete [] m_ppcYuvReco; m_ppcYuvReco = NULL;
    112124  delete [] m_ppcCU     ; m_ppcCU      = NULL;
     125#if H_3D_DBBP
     126  delete [] m_ppcYuvRecoDBBP; m_ppcYuvRecoDBBP = NULL;
     127#endif
    113128}
    114129
     
    618633  {
    619634    case MODE_INTER:
     635#if H_3D_DBBP
     636      if( m_ppcCU[uiDepth]->getDBBPFlag(0) )
     637      {
     638        xReconInterDBBP( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth );
     639      }
     640      else
     641      {
     642#endif
    620643#if H_3D_INTER_SDC
    621644      if( m_ppcCU[uiDepth]->getInterSDCFlag( 0 ) )
     
    628651      xReconInter( m_ppcCU[uiDepth], uiDepth );
    629652#if H_3D_INTER_SDC
     653      }
     654#endif
     655#if H_3D_DBBP
    630656      }
    631657#endif
     
    717743    pRecCb += uiStrideC;
    718744    pRecCr += uiStrideC;
     745  }
     746}
     747#endif
     748
     749#if H_3D_DBBP
     750Void TDecCu::xReconInterDBBP( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     751{
     752  AOF(!pcCU->getSlice()->getIsDepth());
     753  AOF(!pcCU->getSlice()->isIntra());
     754  PartSize ePartSize = pcCU->getPartitionSize( 0 );
     755  AOF( uiAbsPartIdx == pcCU->getZorderIdxInCU() );
     756 
     757  // get collocated depth block
     758  UInt uiDepthStride = 0;
     759  Pel* pDepthPels = pcCU->getVirtualDepthBlock(0, pcCU->getWidth(0), pcCU->getHeight(0), uiDepthStride);
     760  AOF( pDepthPels != NULL );
     761  AOF( uiDepthStride != 0 );
     762 
     763  // compute mask by segmenting depth block
     764  AOF( pcCU->getWidth(0) == m_ppcYuvReco[uiDepth]->getWidth() );
     765  Bool pMask[MAX_CU_SIZE*MAX_CU_SIZE];
     766  Bool bValidMask = m_pcPrediction->getSegmentMaskFromDepth(pDepthPels, uiDepthStride, pcCU->getWidth(0), pcCU->getHeight(0), pMask);
     767  AOF(bValidMask);
     768 
     769  DBBPTmpData* pDBBPTmpData = pcCU->getDBBPTmpData();
     770  TComYuv* apSegPredYuv[2] = { m_ppcYuvReco[uiDepth], m_ppcYuvRecoDBBP[uiDepth] };
     771 
     772  // first, extract the two sets of motion parameters
     773  UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxCUDepth() - uiDepth ) << 1 ) ) >> 4;
     774  for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ )
     775  {
     776    UInt uiPartAddr = uiSegment*uiPUOffset;
     777   
     778    pDBBPTmpData->auhInterDir[uiSegment] = pcCU->getInterDir(uiPartAddr);
     779   
     780    for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
     781    {
     782      RefPicList eRefList = (RefPicList)uiRefListIdx;
     783      pcCU->getMvField(pcCU, uiPartAddr, eRefList, pDBBPTmpData->acMvField[uiSegment][eRefList]);
     784    }
     785   
     786    pDBBPTmpData->ahVSPFlag[uiSegment] = pcCU->getVSPFlag( uiPartAddr );
     787    pDBBPTmpData->acDvInfo[uiSegment] = pcCU->getDvInfo( uiPartAddr );
     788  }
     789 
     790  // do motion compensation for each segment as 2Nx2N
     791  pcCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );
     792  pcCU->setPredModeSubParts( MODE_INTER, 0, uiDepth );
     793  for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ )
     794  {
     795    pcCU->setInterDirSubParts( pDBBPTmpData->auhInterDir[uiSegment], 0, 0, uiDepth );
     796   
     797    pcCU->setVSPFlagSubParts( pDBBPTmpData->ahVSPFlag[uiSegment], 0, 0, uiDepth );
     798    pcCU->setDvInfoSubParts( pDBBPTmpData->acDvInfo[uiSegment], 0, 0, uiDepth );
     799   
     800    for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
     801    {
     802      RefPicList eRefList = (RefPicList)uiRefListIdx;
     803#if NTT_STORE_SPDV_VSP_G0148
     804      if( pcCU->getVSPFlag( 0 ) != 0 )
     805      {
     806        if ( pcCU->getInterDir(0) & (1<<uiRefListIdx) )
     807        {
     808          UInt dummy;
     809          Int vspSize;
     810          Int width, height;
     811          pcCU->getPartIndexAndSize( 0, dummy, width, height, 0, pcCU->getTotalNumPart()==256 );
     812          AOF( dummy == 0 );
     813          AOF( width == height );
     814          pcCU->setMvFieldPUForVSP( pcCU, 0, width, height, eRefList, pDBBPTmpData->acMvField[uiSegment][eRefList].getRefIdx(), vspSize );
     815          pcCU->setVSPFlag( 0, vspSize );
     816        }
     817      }
     818      else
     819#endif
     820      pcCU->getCUMvField( eRefList )->setAllMvField( pDBBPTmpData->acMvField[uiSegment][eRefList], SIZE_2Nx2N, 0, 0 );
     821    }
     822   
     823    // inter prediction
     824    m_pcPrediction->motionCompensation( pcCU, apSegPredYuv[uiSegment] );
     825  }
     826 
     827  // restore motion information in both segments again
     828  pcCU->setPartSizeSubParts( ePartSize,  0, uiDepth );
     829  pcCU->setPredModeSubParts( MODE_INTER, 0, uiDepth );
     830  for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ )
     831  {
     832    UInt uiPartAddr = uiSegment*uiPUOffset;
     833   
     834    pcCU->setDBBPFlagSubParts(true, uiPartAddr, uiSegment, uiDepth);
     835   
     836    pcCU->setVSPFlagSubParts( pDBBPTmpData->ahVSPFlag[uiSegment], uiPartAddr, uiSegment, uiDepth );
     837    pcCU->setDvInfoSubParts( pDBBPTmpData->acDvInfo[uiSegment], uiPartAddr, uiSegment, uiDepth );
     838   
     839    pcCU->setInterDirSubParts(pDBBPTmpData->auhInterDir[uiSegment], uiPartAddr, uiSegment, uiDepth); // interprets depth relative to LCU level
     840   
     841    for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
     842    {
     843      RefPicList eRefList = (RefPicList)uiRefListIdx;
     844#if NTT_STORE_SPDV_VSP_G0148
     845      if( pcCU->getVSPFlag( uiPartAddr ) != 0 )
     846      {
     847        if ( pcCU->getInterDir(uiPartAddr) & (1<<uiRefListIdx) )
     848        {
     849          UInt dummy;
     850          Int vspSize;
     851          Int width, height;
     852          pcCU->getPartIndexAndSize( uiSegment, dummy, width, height, 0, pcCU->getTotalNumPart()==256 );
     853          AOF( dummy == uiPartAddr );
     854          pcCU->setMvFieldPUForVSP( pcCU, uiPartAddr, width, height, RefPicList( uiRefListIdx ), pcCU->getMVPIdx(eRefList, uiPartAddr), vspSize );
     855          pcCU->setVSPFlag( uiPartAddr, vspSize );
     856        }
     857      }
     858      else
     859#endif
     860      pcCU->getCUMvField( eRefList )->setAllMvField( pDBBPTmpData->acMvField[uiSegment][eRefList], ePartSize, uiPartAddr, 0, uiSegment ); // interprets depth relative to rpcTempCU level
     861    }
     862  }
     863 
     864  // reconstruct final prediction signal by combining both segments
     865  m_pcPrediction->combineSegmentsWithMask(apSegPredYuv, m_ppcYuvReco[uiDepth], pMask, pcCU->getWidth(0), pcCU->getHeight(0));
     866 
     867  // inter recon
     868  xDecodeInterTexture( pcCU, 0, uiDepth );
     869 
     870  // clip for only non-zero cbp case
     871  if  ( ( pcCU->getCbf( 0, TEXT_LUMA ) ) || ( pcCU->getCbf( 0, TEXT_CHROMA_U ) ) || ( pcCU->getCbf(0, TEXT_CHROMA_V ) ) )
     872  {
     873    m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ) );
     874  }
     875  else
     876  {
     877    m_ppcYuvReco[uiDepth]->copyPartToPartYuv( m_ppcYuvReco[uiDepth],0, pcCU->getWidth( 0 ),pcCU->getHeight( 0 ));
    719878  }
    720879}
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibDecoder/TDecCu.h

    r655 r816  
    6363  TComDataCU**        m_ppcCU;            ///< CU data array
    6464 
     65#if H_3D_DBBP
     66  TComYuv**           m_ppcYuvRecoDBBP;
     67#endif
     68 
    6569  // access channel
    6670  TComTrQuant*        m_pcTrQuant;
     
    98102  Void xReconInter              ( TComDataCU* pcCU, UInt uiDepth );
    99103 
     104#if H_3D_DBBP
     105  Void xReconInterDBBP          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     106#endif
     107 
    100108  Void  xReconIntraQT           ( TComDataCU* pcCU, UInt uiDepth );
    101109  Void  xIntraRecLumaBlk        ( TComDataCU* pcCU, UInt uiTrDepth, UInt uiAbsPartIdx, TComYuv* pcRecoYuv, TComYuv* pcPredYuv, TComYuv* pcResiYuv );
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibDecoder/TDecEntropy.cpp

    r809 r816  
    137137{
    138138  m_pcEntropyDecoderIf->parsePartSize( pcCU, uiAbsPartIdx, uiDepth );
     139 
     140#if H_3D_DBBP
     141  if( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) && pcCU->getPartitionSize(uiAbsPartIdx) == RWTH_DBBP_PACK_MODE )
     142  {
     143    decodeDBBPFlag(pcCU, uiAbsPartIdx, uiDepth);
     144   
     145    if( pcCU->getDBBPFlag(uiAbsPartIdx) )
     146    {
     147      AOF( pcCU->getPartitionSize(uiAbsPartIdx) == RWTH_DBBP_PACK_MODE );
     148     
     149      // get collocated depth block
     150      UInt uiDepthStride = 0;
     151      Pel* pDepthPels = NULL;
     152      pDepthPels = pcCU->getVirtualDepthBlock(uiAbsPartIdx, pcCU->getWidth(uiAbsPartIdx), pcCU->getHeight(uiAbsPartIdx), uiDepthStride);
     153     
     154      AOF( pDepthPels != NULL );
     155      AOF( uiDepthStride != 0 );
     156     
     157      // derive true partitioning for this CU based on depth
     158      // (needs to be done in parsing process as motion vector predictors are also derived during parsing)
     159      PartSize eVirtualPartSize = m_pcPrediction->getPartitionSizeFromDepth(pDepthPels, uiDepthStride, pcCU->getWidth(uiAbsPartIdx));
     160      AOF( eVirtualPartSize != SIZE_NONE );
     161     
     162      pcCU->setPartSizeSubParts(eVirtualPartSize, uiAbsPartIdx, uiDepth);
     163      AOF( pcCU->getPartitionSize(uiAbsPartIdx) == eVirtualPartSize );
     164    }
     165  }
     166#endif
    139167}
    140168
     
    247275      decodeARPW  ( pcCU, uiAbsPartIdx, uiDepth );
    248276#endif
     277#if H_3D_DBBP
     278      if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 && pcCU->getDBBPFlag(uiAbsPartIdx) == false )
     279#else
    249280      if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 )
     281#endif
    250282      {
    251283        pcSubCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );
     
    830862#endif
    831863
     864#if H_3D_DBBP
     865Void TDecEntropy::decodeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     866{
     867  m_pcEntropyDecoderIf->parseDBBPFlag( pcCU, uiAbsPartIdx, uiDepth );
     868}
     869#endif
     870
    832871//! \}
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibDecoder/TDecEntropy.h

    r773 r816  
    9999  virtual Void parseInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart ) = 0;
    100100#endif
     101#if H_3D_DBBP
     102  virtual Void parseDBBPFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
     103#endif
    101104  virtual Void parsePartSize      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
    102105  virtual Void parsePredMode      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
     
    182185  Void decodeInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    183186#endif
     187#if H_3D_DBBP
     188  Void decodeDBBPFlag          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     189#endif
    184190  Void decodeIPCMInfo          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    185191
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibDecoder/TDecSbac.cpp

    r773 r816  
    100100, m_cInterSDCResidualSignFlagSCModel ( 1,             1,  NUM_INTER_SDC_SIGN_FLAG_CTX      , m_contextModels + m_numContextModels, m_numContextModels)
    101101#endif
     102#if H_3D_DBBP
     103, m_cDBBPFlagSCModel             ( 1,             1,                 DBBP_NUM_FLAG_CTX           , m_contextModels + m_numContextModels, m_numContextModels)
     104#endif
    102105{
    103106  assert( m_numContextModels <= MAX_NUM_CTX_MOD );
     
    182185  m_cInterSDCResidualSCModel.initBuffer   ( sliceType, qp, (UChar*)INIT_INTER_SDC_RESIDUAL );
    183186  m_cInterSDCResidualSignFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_INTER_SDC_SIGN_FLAG );
     187#endif
     188#if H_3D_DBBP
     189  m_cDBBPFlagSCModel.initBuffer              ( sliceType, qp, (UChar*)INIT_DBBP_FLAG );
    184190#endif
    185191  m_uiLastDQpNonZero  = 0;
     
    251257  m_cInterSDCResidualSCModel.initBuffer   ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_RESIDUAL );
    252258  m_cInterSDCResidualSignFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_SIGN_FLAG );
     259#endif
     260#if H_3D_DBBP
     261  m_cDBBPFlagSCModel.initBuffer              ( eSliceType, iQp, (UChar*)INIT_DBBP_FLAG );
    253262#endif
    254263  m_pcTDecBinIf->start();
     
    21322141#endif
    21332142
     2143#if H_3D_DBBP
     2144Void TDecSbac::parseDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     2145{
     2146  PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx );
     2147  AOF( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) );
     2148  AOF( !pcCU->getSlice()->getIsDepth() );
     2149  AOF( ePartSize == RWTH_DBBP_PACK_MODE );
     2150 
     2151  UInt uiSymbol = 0;
     2152 
     2153  m_pcTDecBinIf->decodeBin( uiSymbol, m_cDBBPFlagSCModel.get( 0, 0, 0 ) );
     2154 
     2155  DTRACE_CABAC_VL( g_nSymbolCounter++ );
     2156  DTRACE_CABAC_T( "\tDBBPFlag" );
     2157  DTRACE_CABAC_T( "\tuiCtxDBBP: ");
     2158  DTRACE_CABAC_V( uiCtxDBBPFlag );
     2159  DTRACE_CABAC_T( "\tuiSymbol: ");
     2160  DTRACE_CABAC_V( uiSymbol );
     2161  DTRACE_CABAC_T( "\n");
     2162 
     2163  if( uiSymbol )
     2164  {
     2165    pcCU->setDBBPFlagSubParts(true, uiAbsPartIdx, 0, uiDepth);
     2166  }
     2167}
     2168#endif
     2169
    21342170//! \}
  • branches/HTM-9.3-dev1-RWTH/source/Lib/TLibDecoder/TDecSbac.h

    r773 r816  
    115115  Void  parseInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart );
    116116#endif
     117#if H_3D_DBBP
     118  Void parseDBBPFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     119#endif
    117120private:
    118121  TComInputBitstream* m_pcBitstream;
     
    224227  ContextModel3DBuffer m_cInterSDCResidualSignFlagSCModel;
    225228#endif
     229#if H_3D_DBBP
     230  ContextModel3DBuffer m_cDBBPFlagSCModel;
     231#endif
    226232};
    227233
  • 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.