Ignore:
Timestamp:
3 Feb 2014, 11:35:43 (10 years ago)
Author:
rwth
Message:
  • first version of DBBP (requires some cleanup)
File:
1 edited

Legend:

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