Ignore:
Timestamp:
1 Nov 2012, 19:22:41 (12 years ago)
Author:
mitsubishi-htm
Message:

Initial integration of VSP into HTM 4.0.1. The version used for JCT3V-B0102 at Shanghai meeting.

  • VC9 project/solution files updated. Other Visual C++ project/solution files are not updated.
  • Linux make file updated.

TODO

  • A second release is expected to include some bug fix and improvements on the interface, e.g. to move switches from macro definition to the configuration file.
  • A third release is expected after being integrated within HTM 5.x, which is to be used for CE1.h anchor.
Location:
branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncCavlc.cpp

    r100 r166  
    11791179  WRITE_UVLC(MRG_MAX_NUM_CANDS - pcSlice->getMaxNumMergeCand(), "maxNumMergeCand");
    11801180#endif
     1181
     1182#if VSP_SLICE_HEADER
     1183  if( pcSlice->getSPS()->getViewId()!=0
     1184#if VSP_TEXT_ONLY
     1185      && !(pcSlice->getSPS()->isDepth())
     1186#endif
     1187    )
     1188  {
     1189    WRITE_FLAG( pcSlice->getVspFlag()?1:0, "vsp_flag" );
     1190//    printf("[VSP: %d] ", pcSlice->getVspFlag()?1:0);
     1191  }
     1192#endif
     1193
    11811194}
    11821195
     
    14261439  assert(0);
    14271440}
     1441
     1442#if FORCE_REF_VSP==1
     1443Void TEncCavlc::codeVspFlag( TComDataCU* pcCU, UInt uiAbsPartIdx )
     1444{
     1445  assert(0);
     1446}
     1447#endif
    14281448
    14291449Void TEncCavlc::codeSplitFlag   ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncCavlc.h

    r77 r166  
    164164
    165165  Void codeSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
     166#if FORCE_REF_VSP==1
     167  Void codeVspFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx );
     168#endif
    166169  Void codeMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    167170  Void codeMergeIndex    ( TComDataCU* pcCU, UInt uiAbsPartIdx );
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncCu.cpp

    r100 r166  
    453453  // get Original YUV data from picture
    454454  m_ppcOrigYuv[uiDepth]->copyFromPicYuv( pcPic->getPicYuvOrg(), rpcBestCU->getAddr(), rpcBestCU->getZorderIdxInCU() );
     455#if FORCE_REF_VSP
     456  //Bool bWholeCUCanBeSynthesized = false;
     457  //Bool bOneSubCUCanNotBeSynthesied = false;
     458  Bool bSubCUCanBeSynthesized[4];
     459  if( rpcBestCU->getSlice()->getViewId() )
     460  {
     461    Bool * pbSubCUCanBeSynthesized = bSubCUCanBeSynthesized;
     462    pcPic->checkSynthesisAvailability(/*rpcBestCU, */rpcBestCU->getAddr(), rpcBestCU->getZorderIdxInCU(), uiDepth, pbSubCUCanBeSynthesized); //KUBA SYNTH
     463    //Int  iSubCUCanNotBeSynthesized = 0;  // Dong: Compiling error, set but not used. DONG_CHECK
     464    Int  iSubCUCanBeSynthesizedCnt = 0;
     465    for(Int i = 0; i < 4; i++)
     466    {
     467      if (!bSubCUCanBeSynthesized[i])
     468      {
     469        //iSubCUCanNotBeSynthesized = i;
     470      }
     471      else
     472      {
     473        iSubCUCanBeSynthesizedCnt ++;
     474      }
     475    }
     476    if(iSubCUCanBeSynthesizedCnt == 4)
     477    {
     478      //bWholeCUCanBeSynthesized = true;
     479    }
     480    //else if(iSubCUCanBeSynthesizedCnt == 3)
     481    //{
     482    //  bOneSubCUCanNotBeSynthesied = true;
     483    //}
     484    //bWholeCUCanBeSynthesized = true;
     485  }
     486#endif
    455487
    456488  // variables for fast encoder decision
     
    654686            doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0;
    655687          }
     688
     689#if FORCE_REF_VSP==1
     690#if VSP_TEXT_ONLY
     691          if( !rpcBestCU->getSlice()->getSPS()->isDepth() )
     692#endif
     693#if HHI_INTER_VIEW_RESIDUAL_PRED
     694            rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
     695#endif
     696#if HHI_INTERVIEW_SKIP
     697            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N, bFullyRenderedSec, false, true ); // VSP
     698#else
     699            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N );
     700#endif
     701            rpcTempCU->initEstData( uiDepth, iQP );
     702#endif
    656703        }
    657704#if HHI_INTER_VIEW_RESIDUAL_PRED
     
    15811628    {
    15821629      m_pcEntropyCoder->encodeSkipFlag( pcCU, uiAbsPartIdx );
     1630
     1631#if FORCE_REF_VSP==1
     1632      if( (pcCU->isSkipped( uiAbsPartIdx ) || pcCU->isVspMode( uiAbsPartIdx )) && pcCU->getSlice()->getViewId() != 0 )
     1633#if VSP_TEXT_ONLY
     1634      if( !pcCU->getSlice()->getSPS()->isDepth() )
     1635#endif
     1636      {
     1637        m_pcEntropyCoder->encodeVspFlag( pcCU, uiAbsPartIdx );
     1638      }
     1639#endif
    15831640    }
    15841641
    15851642    if( pcCU->isSkipped( uiAbsPartIdx ) )
     1643#if FORCE_REF_VSP==1
     1644    if( !pcCU->isVspMode( uiAbsPartIdx ) )
     1645#endif
    15861646    {
    15871647      m_pcEntropyCoder->encodeMergeIndex( pcCU, uiAbsPartIdx, 0 );
    15881648      finishCU(pcCU,uiAbsPartIdx,uiDepth);
     1649#if DEBUGLOGOUT
     1650      m_cDebug.DebugLogOut( pcCU, uiAbsPartIdx, uiDepth );
     1651#endif
    15891652      xRestoreDepthWidthHeight( pcCU );
    15901653      return;
     
    16351698  {
    16361699    m_pcEntropyCoder->encodeSkipFlag( pcCU, uiAbsPartIdx );
     1700
     1701#if FORCE_REF_VSP==1
     1702    if( (pcCU->isSkipped( uiAbsPartIdx ) || pcCU->isVspMode( uiAbsPartIdx )) && pcCU->getSlice()->getViewId() != 0 )
     1703#if VSP_TEXT_ONLY
     1704    if( !pcCU->getSlice()->getSPS()->isDepth() )
     1705#endif
     1706    {
     1707      m_pcEntropyCoder->encodeVspFlag( pcCU, uiAbsPartIdx );
     1708    }
     1709#endif
    16371710  }
    16381711 
    16391712  if( pcCU->isSkipped( uiAbsPartIdx ) )
     1713#if FORCE_REF_VSP==1
     1714  if( !pcCU->isVspMode( uiAbsPartIdx ) )
     1715#endif
    16401716  {
    16411717    m_pcEntropyCoder->encodeMergeIndex( pcCU, uiAbsPartIdx, 0 );
     
    16441720#endif
    16451721    finishCU(pcCU,uiAbsPartIdx,uiDepth);
     1722#if DEBUGLOGOUT
     1723    m_cDebug.DebugLogOut( pcCU, uiAbsPartIdx, uiDepth );
     1724#endif
    16461725    return;
    16471726  }
     1727
     1728#if FORCE_REF_VSP==1
     1729  if( pcCU->isVspMode( uiAbsPartIdx ) )
     1730  {
     1731    finishCU(pcCU,uiAbsPartIdx,uiDepth);
     1732#if DEBUGLOGOUT
     1733    m_cDebug.DebugLogOut( pcCU, uiAbsPartIdx, uiDepth );
     1734#endif
     1735    return;
     1736  }
     1737#endif
     1738
    16481739#if HHI_MPI
    16491740  if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 )
     
    16621753      // Encode slice finish
    16631754      finishCU(pcCU,uiAbsPartIdx,uiDepth);
     1755#if DEBUGLOGOUT
     1756      m_cDebug.DebugLogOut( pcCU, uiAbsPartIdx, uiDepth );
     1757#endif
    16641758      return;
    16651759    }
     
    16851779  // --- write terminating bit ---
    16861780  finishCU(pcCU,uiAbsPartIdx,uiDepth);
     1781#if DEBUGLOGOUT
     1782  m_cDebug.DebugLogOut( pcCU, uiAbsPartIdx, uiDepth );
     1783#endif
    16871784}
    16881785
     
    18731970#if AMP_MRG
    18741971#if HHI_INTERVIEW_SKIP
    1875 Void TEncCu::xCheckRDCostInter( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bSkipRes, Bool bUseMRG)
     1972Void TEncCu::xCheckRDCostInter( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bSkipRes, Bool bUseMRG
     1973#if FORCE_REF_VSP==1
     1974                               , Bool bForceRefVsp
     1975#endif
     1976                               )
    18761977#else
    18771978Void TEncCu::xCheckRDCostInter( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bUseMRG)
     
    19102011  rpcTempCU->setResPredFlagSubParts ( bResPrdFlag,  0, 0, uhDepth );
    19112012#endif
     2013#if FORCE_REF_VSP==1
     2014  if( bForceRefVsp )
     2015    rpcTempCU->setPredModeSubParts  ( MODE_SYNTH, 0, uhDepth );
     2016  else
     2017#endif
    19122018  rpcTempCU->setPredModeSubParts  ( MODE_INTER, 0, uhDepth );
    19132019 
     
    19252031  #if HHI_INTERVIEW_SKIP
    19262032#if LG_RESTRICTEDRESPRED_M24766
    1927   m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcResPredTmp[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], bSkipRes, bUseMRG  );
     2033  m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcResPredTmp[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], bSkipRes, bUseMRG
     2034#if FORCE_REF_VSP==1
     2035    , bForceRefVsp
     2036#endif
     2037    );
    19282038#else
    19292039  m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], bSkipRes, bUseMRG  );
     
    24942604    for( UInt ui = 0; ui < rpcTempCU->getTotalNumPart(); ui++ )
    24952605    {
    2496       if( pcTextureCU->isIntra( rpcTempCU->getZorderIdxInCU() + ui ) )
     2606      if( pcTextureCU->isIntra( rpcTempCU->getZorderIdxInCU() + ui )
     2607#if FORCE_REF_VSP==1
     2608       || pcTextureCU->isVspMode( rpcTempCU->getZorderIdxInCU() + ui )
     2609#endif
     2610      )
    24972611      {
    24982612        return;
    24992613      }
     2614#if VSP_N
     2615#if !(!VSP_TEXT_ONLY && FORCE_REF_VSP==2)
     2616      else // inter
     2617      {
     2618        Int aiRefIdx[2] = {NOT_VALID, NOT_VALID};
     2619        for( Int iList = 0; iList < 2; iList++ )
     2620        {
     2621          aiRefIdx[iList] = pcTextureCU->getCUMvField( RefPicList(iList) )->getRefIdx( rpcTempCU->getZorderIdxInCU() + ui );
     2622          if( aiRefIdx[iList] >= 0 && pcTextureCU->getSlice()->getRefViewId( RefPicList(iList), aiRefIdx[iList] ) == NUM_VIEW_VSP )
     2623          {
     2624            return;
     2625          }
     2626        }
     2627        //if( aiRefIdx[0] == NOT_VALID && aiRefIdx[1] == NOT_VALID )
     2628        //{
     2629        //  return;
     2630        //}
     2631      }
     2632#endif
     2633#endif
    25002634    }
    25012635  }
     
    26942828  m_pcEntropyCoder->encodeSplitFlag( pcCU, 0, uhDepth, true );
    26952829  m_pcEntropyCoder->encodeSkipFlag( pcCU, 0, true );
     2830#if FORCE_REF_VSP==1
     2831  if( (pcCU->isSkipped( 0 ) || pcCU->isVspMode( 0 )) && pcCU->getSlice()->getViewId() != 0 )
     2832#if VSP_TEXT_ONLY
     2833  if( !pcCU->getSlice()->getSPS()->isDepth() )
     2834#endif
     2835    m_pcEntropyCoder->encodeVspFlag ( pcCU, 0, true );
     2836#endif
    26962837
    26972838  if( pcCU->isSkipped( 0 ) )
     2839#if FORCE_REF_VSP==1
     2840  if( !pcCU->isVspMode( 0 ) )
     2841#endif
    26982842  {
    26992843    m_pcEntropyCoder->encodeMergeIndex( pcCU, 0, 0, true );
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncCu.h

    r56 r166  
    4646#include "TLibCommon/TComBitCounter.h"
    4747#include "TLibCommon/TComDataCU.h"
     48#if DEBUGLOGOUT
     49#include "TLibCommon/DebugLog.h"
     50#endif
    4851
    4952#include "TEncEntropy.h"
     
    113116
    114117public:
     118#if DEBUGLOGOUT
     119  DebugLog                m_cDebug;
     120#endif
     121
    115122  /// copy parameters from encoder class
    116123  Void  init                ( TEncTop* pcEncTop );
     
    148155#if AMP_MRG
    149156#if HHI_INTERVIEW_SKIP
    150   Void xCheckRDCostInter( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bFullyRendered, Bool bUseMRG = false  ) ;
     157  Void xCheckRDCostInter( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bFullyRendered, Bool bUseMRG = false
     158#if FORCE_REF_VSP==1
     159    , Bool bForceRefVsp = false
     160#endif
     161    ) ;
    151162#else
    152163  Void  xCheckRDCostInter   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bUseMRG = false  );
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncEntropy.cpp

    r77 r166  
    169169}
    170170
     171
     172#if FORCE_REF_VSP==1
     173Void TEncEntropy::encodeVspFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
     174{
     175  if ( pcCU->getSlice()->isIntra() || pcCU->getSlice()->getViewId() == 0 )
     176  {
     177    return;
     178  }
     179  if( bRD )
     180  {
     181    uiAbsPartIdx = 0;
     182  }
     183  m_pcEntropyCoderIf->codeVspFlag( pcCU, uiAbsPartIdx );
     184}
     185#endif
     186
    171187Void TEncEntropy::codeFiltCountBit(ALFParam* pAlfParam, Int64* ruiRate)
    172188{
     
    12851301    uiAbsPartIdx = 0;
    12861302  }
     1303
     1304#if FORCE_REF_VSP==1
     1305  if( pcCU->isVspMode( uiAbsPartIdx ) )
     1306  {
     1307    return;
     1308  }
     1309#endif
    12871310 
    12881311  PartSize eSize = pcCU->getPartitionSize( uiAbsPartIdx );
     
    13451368        {
    13461369          encodeRefFrmIdxPU ( pcCU, uiSubPartIdx, RefPicList( uiRefListIdx ) );
     1370#if VSP_MV_ZERO
     1371          Int iRefIdx = pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->getRefIdx(uiSubPartIdx);
     1372          if( !(pcCU->getSlice()->getViewId() && iRefIdx >= 0 && pcCU->getSlice()->getRefViewId( RefPicList( uiRefListIdx ), iRefIdx ) == NUM_VIEW_VSP) )
     1373          {
     1374#endif
    13471375          encodeMvdPU       ( pcCU, uiSubPartIdx, RefPicList( uiRefListIdx ) );
    13481376          encodeMVPIdxPU    ( pcCU, uiSubPartIdx, RefPicList( uiRefListIdx ) );
     1377#if VSP_MV_ZERO
     1378          }
     1379#endif
    13491380        }
    13501381      }
     
    16321663  {
    16331664    {
     1665#if FORCE_REF_VSP==1
     1666      if( !pcCU->isVspMode( uiAbsPartIdx ) )
     1667#endif
    16341668#if HHI_MPI
    16351669      if( !(pcCU->getMergeFlag( uiAbsPartIdx ) && pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N &&
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncEntropy.h

    r100 r166  
    115115 
    116116  virtual Void codeSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
     117#if FORCE_REF_VSP==1
     118  virtual Void codeVspFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
     119#endif
    117120  virtual Void codeMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    118121  virtual Void codeMergeIndex    ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
     
    251254  Void encodeSplitFlag         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool bRD = false );
    252255  Void encodeSkipFlag          ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
     256#if FORCE_REF_VSP==1
     257  Void encodeVspFlag           ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
     258#endif
    253259  Void encodePUWise       ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
    254260  Void encodeInterDirPU   ( TComDataCU* pcSubCU, UInt uiAbsPartIdx  );
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncGOP.cpp

    r102 r166  
    332332#endif
    333333
     334#if VSP_N
     335      Int NumberOfVspRefs = ( ( pcPic->getViewId()==0
     336#if VSP_TEXT_ONLY
     337                                || m_pcEncTop->getIsDepth()
     338#endif
     339#if VSP_SLICE_HEADER
     340                                || !m_pcEncTop->getUseVSP()
     341#endif
     342                              ) ? 0 : 1 );
     343      pcSlice->setNumRefIdx( REF_PIC_LIST_0, min( m_pcCfg->getGOPEntry( (getNalUnitType(uiPOCCurr) == NAL_UNIT_CODED_SLICE_IDV) ? MAX_GOP : iGOPid ).m_numRefPicsActive + NumberOfVspRefs, (pcSlice->getRPS()->getNumberOfPictures() + pcSlice->getSPS()->getNumberOfUsableInterViewRefs() + NumberOfVspRefs) ) );
     344      pcSlice->setNumRefIdx( REF_PIC_LIST_1, min( m_pcCfg->getGOPEntry( (getNalUnitType(uiPOCCurr) == NAL_UNIT_CODED_SLICE_IDV) ? MAX_GOP : iGOPid ).m_numRefPicsActive + NumberOfVspRefs, (pcSlice->getRPS()->getNumberOfPictures() + pcSlice->getSPS()->getNumberOfUsableInterViewRefs() + NumberOfVspRefs) ) );
     345#else
    334346      pcSlice->setNumRefIdx( REF_PIC_LIST_0, min( m_pcCfg->getGOPEntry( (getNalUnitType(uiPOCCurr) == NAL_UNIT_CODED_SLICE_IDV) ? MAX_GOP : iGOPid ).m_numRefPicsActive, (pcSlice->getRPS()->getNumberOfPictures() + pcSlice->getSPS()->getNumberOfUsableInterViewRefs()) ) );
    335347      pcSlice->setNumRefIdx( REF_PIC_LIST_1, min( m_pcCfg->getGOPEntry( (getNalUnitType(uiPOCCurr) == NAL_UNIT_CODED_SLICE_IDV) ? MAX_GOP : iGOPid ).m_numRefPicsActive, (pcSlice->getRPS()->getNumberOfPictures() + pcSlice->getSPS()->getNumberOfUsableInterViewRefs()) ) );
     348#endif
    336349
    337350      TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification();
     
    358371
    359372      std::vector<TComPic*> apcInterViewRefPics = tAppEncTop->getInterViewRefPics( m_pcEncTop->getViewId(), pcSlice->getPOC(), m_pcEncTop->getIsDepth(), pcSlice->getSPS() );
     373#if VSP_N
     374      Bool bUseVsp = (pcPic->getViewId()!=0);
     375#if VSP_TEXT_ONLY
     376      if( m_pcEncTop->getIsDepth() ) bUseVsp = false;
     377#endif
     378#if VSP_SLICE_HEADER
     379      if( !m_pcEncTop->getUseVSP() ) bUseVsp = false;
     380#endif
     381      pcSlice->setRefPicListMvc( rcListPic, apcInterViewRefPics, bUseVsp ? m_pcEncTop->getVSPBuf() : NULL );
     382#else
    360383      pcSlice->setRefPicListMvc( rcListPic, apcInterViewRefPics );
     384#endif
     385#if VSP_SLICE_HEADER
     386      pcSlice->setVspFlag( bUseVsp );
     387#endif
    361388
    362389      //  Slice info. refinement
     
    11301157          m_pcSbacCoder->load( &pcSbacCoders[0] );
    11311158
     1159#if DEBUGLOGOUT
     1160        char fname[128];
     1161        sprintf(fname, "%sV%02d_%05d%s.csv", "Log", pcSlice->getViewId(), uiPOCCurr, pcSlice->getIsDepth() ? "depth":"text");
     1162        getSliceEncoder()->getCUEncoder()->m_cDebug.DebugLogFileOpen( fname );
     1163#endif
     1164
    11321165        pcSlice->setTileOffstForMultES( uiOneBitstreamPerSliceLength );
    11331166        if (!bEntropySlice)
     
    11401173          m_pcSliceEncoder->encodeSlice(pcPic, &nalu.m_Bitstream, pcSubstreamsOut); // nalu.m_Bitstream is only used for CAVLC tile position info.
    11411174        }
     1175
     1176#if DEBUGLOGOUT
     1177        getSliceEncoder()->getCUEncoder()->m_cDebug.DebugLogFileClose();
     1178#endif
    11421179
    11431180        {
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncGOP.h

    r101 r166  
    146146  Void freeAPS     (TComAPS* pAPS, TComSPS* pSPS);
    147147  Void allocAPS    (TComAPS* pAPS, TComSPS* pSPS);
     148
    148149protected:
    149150  Void encodeAPS   (TComAPS* pcAPS, TComOutputBitstream& APSbs, TComSlice* pcSlice);            //!< encode APS syntax elements
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncSbac.cpp

    r101 r166  
    718718{
    719719  // get context function is here
     720#if FORCE_REF_VSP==1
     721  UInt uiSymbol = (pcCU->isSkipped( uiAbsPartIdx ) || pcCU->isVspMode( uiAbsPartIdx )) ? 1 : 0;
     722#else
    720723  UInt uiSymbol = pcCU->isSkipped( uiAbsPartIdx ) ? 1 : 0;
     724#endif
    721725  UInt uiCtxSkip = pcCU->getCtxSkipFlag( uiAbsPartIdx ) ;
    722726  m_pcBinIf->encodeBin( uiSymbol, m_cCUSkipFlagSCModel.get( 0, 0, uiCtxSkip ) );
     
    730734}
    731735
     736#if FORCE_REF_VSP==1
     737Void TEncSbac::codeVspFlag( TComDataCU* pcCU, UInt uiAbsPartIdx )
     738{
     739  // get context function is here
     740  UInt uiSymbol = (UInt)pcCU->isVspMode( uiAbsPartIdx );
     741  UInt uiCtxSkip = pcCU->getCtxSkipFlag( uiAbsPartIdx ) ;
     742  m_pcBinIf->encodeBin( uiSymbol, m_cCUSkipFlagSCModel.get( 0, 0, uiCtxSkip ) );
     743  DTRACE_CABAC_VL( g_nSymbolCounter++ );
     744  DTRACE_CABAC_T( "\tVspFlag" );
     745  DTRACE_CABAC_T( "\tuiCtxSkip: ");
     746  DTRACE_CABAC_V( uiCtxSkip );
     747  DTRACE_CABAC_T( "\tuiSymbol: ");
     748  DTRACE_CABAC_V( uiSymbol );
     749  DTRACE_CABAC_T( "\n");
     750}
     751#endif
     752
    732753/** code merge flag
    733754 * \param pcCU
     
    764785  uiNumCand = pcCU->getSlice()->getMaxNumMergeCand();
    765786#if HHI_MPI
     787#if VSP_TEXT_ONLY
     788  TComDataCU* pcTextCU = pcCU->getSlice()->getSPS()->getUseMVI() ? pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() ) : NULL;
     789  Int aiRefIdxVsp[2] = { pcTextCU ? pcTextCU->getCUMvField( RefPicList(0) )->getRefIdx( uiAbsPartIdx ) : -1,
     790                         pcTextCU ? pcTextCU->getCUMvField( RefPicList(1) )->getRefIdx( uiAbsPartIdx ) : -1 };
     791  const Bool bMVIAvailable = pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE
     792    && !( aiRefIdxVsp[0] >= 0 && pcTextCU->getSlice()->getRefViewId( RefPicList(0), aiRefIdxVsp[0] ) == NUM_VIEW_VSP )
     793    && !( aiRefIdxVsp[1] >= 0 && pcTextCU->getSlice()->getRefViewId( RefPicList(1), aiRefIdxVsp[1] ) == NUM_VIEW_VSP );
     794#else
    766795  const Bool bMVIAvailable = pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE;
     796#endif
    767797  if( bMVIAvailable )
    768798  {
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncSbac.h

    r100 r166  
    202202  Void codeAlfCtrlFlag   ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    203203  Void codeSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
     204#if FORCE_REF_VSP==1
     205  Void codeVspFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx );
     206#endif
    204207  Void codeMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    205208  Void codeMergeIndex    ( TComDataCU* pcCU, UInt uiAbsPartIdx );
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncSearch.cpp

    r133 r166  
    683683UInt TEncSearch::xPatternRefinement( TComPattern* pcPatternKey,
    684684                                    TComMv baseRefMv,
    685                                     Int iFrac, TComMv& rcMvFrac )
     685                                    Int iFrac, TComMv& rcMvFrac
     686#if VSP_MV_ZERO
     687                                   ,Bool bIsVsp
     688#endif
     689                                   )
    686690{
    687691  UInt  uiDist;
     
    699703  TComMv* pcMvRefine = (iFrac == 2 ? s_acMvRefineH : s_acMvRefineQ);
    700704 
     705#if VSP_MV_ZERO
     706  UInt iAround = ( bIsVsp )? 1:9;
     707  for (UInt i = 0; i < iAround; i++)
     708#else
    701709  for (UInt i = 0; i < 9; i++)
     710#endif
    702711  {
    703712    TComMv cMvTest = pcMvRefine[i];
     
    871880      {
    872881        m_pcEntropyCoder->encodeSkipFlag( pcCU, 0, true );
     882#if FORCE_REF_VSP==1
     883        if( pcCU->getSlice()->getViewId() != 0 )
     884#if VSP_TEXT_ONLY
     885        if( !pcCU->getSlice()->getSPS()->isDepth() )
     886#endif
     887          m_pcEntropyCoder->encodeVspFlag ( pcCU, 0, true );
     888#endif
    873889        m_pcEntropyCoder->encodePredMode( pcCU, 0, true );
    874890      }
     
    27512767#if AMP_MRG
    27522768#if LG_RESTRICTEDRESPRED_M24766
    2753 Void TEncSearch::predInterSearch( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv* rpcResiPredYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv, Bool bUseRes, Bool bUseMRG )
    2754 #else
    2755 Void TEncSearch::predInterSearch( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv, Bool bUseRes, Bool bUseMRG )
     2769Void TEncSearch::predInterSearch( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv* rpcResiPredYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv, Bool bUseRes, Bool bUseMRG
     2770#if FORCE_REF_VSP==1
     2771                                 , Bool bForceRefVsp
     2772#endif
     2773                                 )
     2774#else
     2775Void TEncSearch::predInterSearch( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv, Bool bUseRes, Bool bUseMRG
     2776#if FORCE_REF_VSP==1
     2777                                 , Bool bForceRefVsp
     2778#endif
     2779                                 )
    27562780#endif
    27572781#else
     
    28132837#endif
    28142838
     2839#if FORCE_REF_VSP==1
     2840  if( bForceRefVsp )
     2841  {
     2842    assert( ePartSize == SIZE_2Nx2N );
     2843
     2844    //  Clear Motion Field
     2845    pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( TComMvField(), ePartSize, 0, pcCU->getDepth(0), 0 );
     2846    pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( TComMvField(), ePartSize, 0, pcCU->getDepth(0), 0 );
     2847    pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd    ( cMvZero,       ePartSize, 0, pcCU->getDepth(0), 0 );
     2848    pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd    ( cMvZero,       ePartSize, 0, pcCU->getDepth(0), 0 );
     2849
     2850    //pcCU->getCUMvField(REF_PIC_LIST_0)->setAllRefIdx ( pcCU->getSlice()->getRefIdxVsp(REF_PIC_LIST_0), ePartSize, 0, pcCU->getDepth(0), 0 );
     2851    //pcCU->getCUMvField(REF_PIC_LIST_1)->setAllRefIdx ( pcCU->getSlice()->getRefIdxVsp(REF_PIC_LIST_1), ePartSize, 0, pcCU->getDepth(0), 0 );
     2852
     2853    pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_0, 0, 0, pcCU->getDepth(0));
     2854    pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_0, 0, 0, pcCU->getDepth(0));
     2855    pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_1, 0, 0, pcCU->getDepth(0));
     2856    pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_1, 0, 0, pcCU->getDepth(0));
     2857
     2858    rpcPredYuv->copyFromPicYuv( pcCU->getPic()->getPicYuvSynth(), pcCU->getAddr(), pcCU->getZorderIdxInCU() );
     2859    setWpScalingDistParam( pcCU, -1, REF_PIC_LIST_X );
     2860
     2861    return;
     2862  }
     2863#endif
     2864
    28152865#if ZERO_MVD_EST
    28162866  Int           aiZeroMvdMvpIdx[2] = {-1, -1};
     
    28332883#if HHI_INTER_VIEW_MOTION_PRED
    28342884  Int iNumAMVPCands = AMVP_MAX_NUM_CANDS + ( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() ? 1 : 0 );
     2885#endif
     2886
     2887#if VSP_MV_ZERO
     2888  bool bIsVsp = false;
     2889  //Bool bWholeCUCanBeSynthesized = false;
     2890  //Bool bSubCUCanBeSynthesized[4];
     2891  //if( pcCU->getSlice()->getViewId() )
     2892  //{
     2893  //  Bool * pbSubCUCanBeSynthesized = bSubCUCanBeSynthesized;
     2894  //  pcCU->getPic()->checkSynthesisAvailability(/*rpcBestCU, */pcCU->getAddr(), pcCU->getZorderIdxInCU(), pcCU->getDepth(0), pbSubCUCanBeSynthesized); //KUBA SYNTH
     2895  //  Int  iSubCUCanBeSynthesizedCnt = 0;
     2896  //  for(Int i = 0; i < 4; i++)
     2897  //  {
     2898  //    if (bSubCUCanBeSynthesized[i])
     2899  //    {
     2900  //      iSubCUCanBeSynthesizedCnt ++;
     2901  //    }
     2902  //  }
     2903  //  if(iSubCUCanBeSynthesizedCnt == 4)
     2904  //  {
     2905  //    bWholeCUCanBeSynthesized = true;
     2906  //  }
     2907  //}
    28352908#endif
    28362909
     
    28572930    for (Int iNumRef=0; iNumRef < MAX_NUM_REF; iNumRef++) uiCostTempL0[iNumRef] = MAX_UINT;
    28582931    UInt          uiBitsTempL0[MAX_NUM_REF];
     2932
    28592933#if LG_RESTRICTEDRESPRED_M24766
    28602934    Int iPUResiPredShift[4] = {0, 0, 0, 0};
     
    28852959      for ( Int iRefIdxTemp = 0; iRefIdxTemp < pcCU->getSlice()->getNumRefIdx(eRefPicList); iRefIdxTemp++ )
    28862960      {
     2961#if VSP_MV_ZERO
     2962        bIsVsp = (pcCU->getSlice()->getViewId() && pcCU->getSlice()->getRefViewId(eRefPicList, iRefIdxTemp) == NUM_VIEW_VSP);
     2963        //if( bIsVsp && !bWholeCUCanBeSynthesized )
     2964        //{
     2965        //  continue;
     2966        //}
     2967#endif
    28872968#if LG_RESTRICTEDRESPRED_M24766
    28882969        if( pcCU->getResPredFlag( 0 ))
     
    29082989          if ( iRefIdxTemp == pcCU->getSlice()->getNumRefIdx(eRefPicList)-1 ) uiBitsTemp--;
    29092990        }
     2991#if VSP_MV_ZERO
     2992        if( bIsVsp )
     2993        {
     2994          aaiMvpIdx[iRefList][iRefIdxTemp] = -1;
     2995          aaiMvpNum[iRefList][iRefIdxTemp] = -1;
     2996          cMvPred[iRefList][iRefIdxTemp].setZero();
     2997        }
     2998        else
     2999        {
     3000#endif
    29103001#if H0111_MVD_L1_ZERO
    29113002#if ZERO_MVD_EST
     
    29373028#else
    29383029        uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdx[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS];
     3030#endif
     3031#if VSP_MV_ZERO
     3032        } // if( bIsVsp )
    29393033#endif
    29403034#if ZERO_MVD_EST
     
    29733067              else
    29743068              {
     3069#if VSP_MV_ZERO
     3070                if( pcCU->getSlice()->getViewId() && pcCU->getSlice()->getRefViewId(eRefPicList, iRefIdxTemp) == NUM_VIEW_VSP )
     3071                {
     3072                  cMvTemp[1][iRefIdxTemp].setZero();
     3073                  uiCostTemp = 0;
     3074                }
     3075                else
     3076                {
     3077#endif
    29753078                cMvTemp[1][iRefIdxTemp] = cMvTemp[0][pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(iRefIdxTemp)];
    29763079                uiCostTemp = uiCostTempL0[pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(iRefIdxTemp)];
    29773080                /*first subtract the bit-rate part of the cost of the other list*/
    29783081                uiCostTemp -= m_pcRdCost->getCost( uiBitsTempL0[pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(iRefIdxTemp)] );
     3082#if VSP_MV_ZERO
     3083                }
     3084#endif
    29793085              }
    29803086              /*correct the bit-rate part of the current ref*/
     
    29863092            else
    29873093            {
     3094#if VSP_MV_ZERO
     3095              xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], bIsVsp, uiBitsTemp, uiCostTemp );
     3096#else
    29883097              xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp );
     3098#endif
    29893099            }
    29903100        }
     
    29983108          else
    29993109          {
     3110#if VSP_MV_ZERO
     3111            xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], bIsVsp, uiBitsTemp, uiCostTemp );
     3112#else
    30003113            xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp );
     3114#endif
    30013115          }       
    30023116        }
    30033117#else
    30043118        xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp );
     3119#endif
     3120#if VSP_MV_ZERO
     3121        if( bIsVsp )
     3122        {
     3123          cMvPred[iRefList][iRefIdxTemp].setZero();
     3124        }
     3125        else
     3126        {
    30053127#endif
    30063128        xCopyAMVPInfo(pcCU->getCUMvField(eRefPicList)->getAMVPInfo(), &aacAMVPInfo[iRefList][iRefIdxTemp]); // must always be done ( also when AMVP_MODE = AM_NONE )
     
    30093131          xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp);
    30103132        }
     3133#if VSP_MV_ZERO
     3134        }
     3135#endif
    30113136
    30123137        if(pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && !pcCU->getSlice()->getNoBackPredFlag())
     
    30883213      if(pcCU->getSlice()->getMvdL1ZeroFlag())
    30893214      {
     3215#if VSP_MV_ZERO
     3216        bIsVsp = (pcCU->getSlice()->getViewId() && pcCU->getSlice()->getRefViewId(REF_PIC_LIST_1, bestBiPRefIdxL1) == NUM_VIEW_VSP);
     3217
     3218        if( bIsVsp )
     3219        {
     3220          cMvPredBi[1][bestBiPRefIdxL1].setZero();
     3221        }
     3222        else
     3223        {
     3224#endif
    30903225        xCopyAMVPInfo(&aacAMVPInfo[1][bestBiPRefIdxL1], pcCU->getCUMvField(REF_PIC_LIST_1)->getAMVPInfo());
    30913226        pcCU->setMVPIdxSubParts( bestBiPMvpL1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr));
    30923227        aaiMvpIdxBi[1][bestBiPRefIdxL1] = bestBiPMvpL1;
    30933228        cMvPredBi[1][bestBiPRefIdxL1]   = pcCU->getCUMvField(REF_PIC_LIST_1)->getAMVPInfo()->m_acMvCand[bestBiPMvpL1];
     3229#if VSP_MV_ZERO
     3230        }
     3231#endif
    30943232
    30953233        cMvBi[1] = cMvPredBi[1][bestBiPRefIdxL1];
     
    31093247        }
    31103248
     3249#if VSP_MV_ZERO
     3250        if( !bIsVsp )
     3251        {
     3252#endif
    31113253#if HHI_INTER_VIEW_MOTION_PRED
    31123254        uiMotBits[1] += m_auiMVPIdxCost[aaiMvpIdxBi[1][bestBiPRefIdxL1]][iNumAMVPCands];
    31133255#else
    31143256        uiMotBits[1] += m_auiMVPIdxCost[aaiMvpIdxBi[1][bestBiPRefIdxL1]][AMVP_MAX_NUM_CANDS];
     3257#endif
     3258#if VSP_MV_ZERO
     3259        }
    31153260#endif
    31163261
     
    31683313        for ( Int iRefIdxTemp = iRefStart; iRefIdxTemp <= iRefEnd; iRefIdxTemp++ )
    31693314        {
     3315#if VSP_MV_ZERO
     3316          bIsVsp = (pcCU->getSlice()->getViewId() && pcCU->getSlice()->getRefViewId(eRefPicList, iRefIdxTemp) == NUM_VIEW_VSP);
     3317          //if( bIsVsp && !bWholeCUCanBeSynthesized )
     3318          //{
     3319          //  continue;
     3320          //}
     3321#endif
    31703322          uiBitsTemp = uiMbBits[2] + uiMotBits[1-iRefList];
    31713323          if ( pcCU->getSlice()->getNumRefIdx(eRefPicList) > 1 )
     
    31743326            if ( iRefIdxTemp == pcCU->getSlice()->getNumRefIdx(eRefPicList)-1 ) uiBitsTemp--;
    31753327          }
     3328#if VSP_MV_ZERO
     3329          if( !bIsVsp )
     3330          {
     3331#endif
    31763332#if HHI_INTER_VIEW_MOTION_PRED
    31773333          uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdxBi[iRefList][iRefIdxTemp]][iNumAMVPCands];
    31783334#else
    31793335          uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdxBi[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS];
     3336#endif
     3337#if VSP_MV_ZERO
     3338          }
    31803339#endif
    31813340#if LG_RESTRICTEDRESPRED_M24766
     
    32113370#endif
    32123371          // call ME
     3372#if VSP_MV_ZERO
     3373          xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPredBi[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], bIsVsp, uiBitsTemp, uiCostTemp, true );
     3374#else
    32133375          xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPredBi[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp, true );
     3376#endif
     3377#if VSP_MV_ZERO
     3378          if( !bIsVsp )
     3379          {
     3380#endif
    32143381          if ( pcCU->getAMVPMode(uiPartAddr) == AM_EXPL )
    32153382          {
     
    32173384            xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPredBi[iRefList][iRefIdxTemp], aaiMvpIdxBi[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp);
    32183385          }
    3219          
     3386#if VSP_MV_ZERO
     3387          }
     3388#endif
     3389
    32203390          if ( uiCostTemp < uiCostBi )
    32213391          {
     
    32493419          if ( uiCostBi <= uiCost[0] && uiCostBi <= uiCost[1] && pcCU->getAMVPMode(uiPartAddr) == AM_EXPL )
    32503420          {
     3421#if VSP_MV_ZERO
     3422            bIsVsp = (pcCU->getSlice()->getViewId() && pcCU->getSlice()->getRefViewId(REF_PIC_LIST_0, iRefIdxBi[0]) == NUM_VIEW_VSP);
     3423
     3424            if( !bIsVsp )
     3425            {
     3426#endif
    32513427            xCopyAMVPInfo(&aacAMVPInfo[0][iRefIdxBi[0]], pcCU->getCUMvField(REF_PIC_LIST_0)->getAMVPInfo());
    32523428            xCheckBestMVP(pcCU, REF_PIC_LIST_0, cMvBi[0], cMvPredBi[0][iRefIdxBi[0]], aaiMvpIdxBi[0][iRefIdxBi[0]], uiBits[2], uiCostBi);
     3429#if VSP_MV_ZERO
     3430            }
     3431#endif
    32533432#if H0111_MVD_L1_ZERO
    32543433            if(!pcCU->getSlice()->getMvdL1ZeroFlag())
    32553434            {
    32563435#endif
     3436#if VSP_MV_ZERO
     3437              bIsVsp = (pcCU->getSlice()->getViewId() && pcCU->getSlice()->getRefViewId(REF_PIC_LIST_1, iRefIdxBi[1]) == NUM_VIEW_VSP);
     3438
     3439              if( !bIsVsp )
     3440              {
     3441#endif
    32573442              xCopyAMVPInfo(&aacAMVPInfo[1][iRefIdxBi[1]], pcCU->getCUMvField(REF_PIC_LIST_1)->getAMVPInfo());
    32583443              xCheckBestMVP(pcCU, REF_PIC_LIST_1, cMvBi[1], cMvPredBi[1][iRefIdxBi[1]], aaiMvpIdxBi[1][iRefIdxBi[1]], uiBits[2], uiCostBi);
     3444#if VSP_MV_ZERO
     3445              }
     3446#endif
    32593447#if H0111_MVD_L1_ZERO
    32603448            }
     
    34173605      pcCU->setInterDirSubParts( 3, uiPartAddr, iPartIdx, pcCU->getDepth(0) );
    34183606     
     3607#if VSP_MV_ZERO
     3608      bIsVsp = (pcCU->getSlice()->getViewId() && pcCU->getSlice()->getRefViewId(REF_PIC_LIST_0, iRefIdxBi[0]) == NUM_VIEW_VSP);
     3609      if( !bIsVsp )
     3610      {
     3611#endif
    34193612      pcCU->setMVPIdxSubParts( aaiMvpIdxBi[0][iRefIdxBi[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr));
    34203613      pcCU->setMVPNumSubParts( aaiMvpNum[0][iRefIdxBi[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr));
     3614#if VSP_MV_ZERO
     3615      }
     3616      bIsVsp = (pcCU->getSlice()->getViewId() && pcCU->getSlice()->getRefViewId(REF_PIC_LIST_1, iRefIdxBi[1]) == NUM_VIEW_VSP);
     3617      if( !bIsVsp )
     3618      {
     3619#endif
    34213620      pcCU->setMVPIdxSubParts( aaiMvpIdxBi[1][iRefIdxBi[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr));
    34223621      pcCU->setMVPNumSubParts( aaiMvpNum[1][iRefIdxBi[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr));
     3622#if VSP_MV_ZERO
     3623      }
     3624#endif
    34233625
    34243626      uiMEBits = uiBits[2];
     
    34353637      pcCU->setInterDirSubParts( 1, uiPartAddr, iPartIdx, pcCU->getDepth(0) );
    34363638     
     3639#if VSP_MV_ZERO
     3640      bIsVsp = (pcCU->getSlice()->getViewId() && pcCU->getSlice()->getRefViewId(REF_PIC_LIST_0, iRefIdx[0]) == NUM_VIEW_VSP);
     3641      if( !bIsVsp )
     3642      {
     3643#endif
    34373644      pcCU->setMVPIdxSubParts( aaiMvpIdx[0][iRefIdx[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr));
    34383645      pcCU->setMVPNumSubParts( aaiMvpNum[0][iRefIdx[0]], REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr));
     3646#if VSP_MV_ZERO
     3647      }
     3648#endif
    34393649
    34403650      uiMEBits = uiBits[0];
     
    34513661      pcCU->setInterDirSubParts( 2, uiPartAddr, iPartIdx, pcCU->getDepth(0) );
    34523662     
     3663#if VSP_MV_ZERO
     3664      bIsVsp = (pcCU->getSlice()->getViewId() && pcCU->getSlice()->getRefViewId(REF_PIC_LIST_1, iRefIdx[1]) == NUM_VIEW_VSP);
     3665      if( !bIsVsp )
     3666      {
     3667#endif
    34533668      pcCU->setMVPIdxSubParts( aaiMvpIdx[1][iRefIdx[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr));
    34543669      pcCU->setMVPNumSubParts( aaiMvpNum[1][iRefIdx[1]], REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr));
     3670#if VSP_MV_ZERO
     3671      }
     3672#endif
    34553673
    34563674      uiMEBits = uiBits[1];
     
    38884106}
    38894107
     4108#if VSP_MV_ZERO
     4109Void TEncSearch::xMotionEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPartIdx, RefPicList eRefPicList, TComMv* pcMvPred, Int iRefIdxPred, TComMv& rcMv, Bool bIsVsp, UInt& ruiBits, UInt& ruiCost, Bool bBi  )
     4110#else
    38904111Void TEncSearch::xMotionEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPartIdx, RefPicList eRefPicList, TComMv* pcMvPred, Int iRefIdxPred, TComMv& rcMv, UInt& ruiBits, UInt& ruiCost, Bool bBi  )
     4112#endif
    38914113{
    38924114  UInt          uiPartAddr;
     
    39014123  m_iSearchRange = m_aaiAdaptSR[eRefPicList][iRefIdxPred];
    39024124 
     4125#if VSP_MV_ZERO
     4126  Int           iSrchRng      = ( bIsVsp ? 0 : ( bBi ? m_bipredSearchRange : m_iSearchRange ) );
     4127#else
    39034128  Int           iSrchRng      = ( bBi ? m_bipredSearchRange : m_iSearchRange );
     4129#endif
    39044130  TComPattern*  pcPatternKey  = pcCU->getPattern        ();
    39054131 
     
    39474173  m_pcRdCost->setCostScale  ( 2 );
    39484174
     4175#if VSP_MV_ZERO
     4176  if( !bIsVsp )
     4177#endif
    39494178#if HHI_INTER_VIEW_MOTION_PRED
    39504179  { // init inter-view regularization
     
    39654194  }
    39664195#endif
     4196#if VSP_MV_ZERO
     4197  else { // bIsVsp
     4198    m_pcRdCost->setMultiviewReg( 0 );
     4199  }
     4200#endif
    39674201
    39684202  setWpScalingDistParam( pcCU, iRefIdxPred, eRefPicList );
    39694203  //  Do integer search
     4204#if VSP_MV_ZERO
     4205  if ( !m_iFastSearch || bBi || bIsVsp )
     4206#else
    39704207  if ( !m_iFastSearch || bBi )
     4208#endif
    39714209  {
    39724210    xPatternSearch      ( pcPatternKey, piRefY, iRefStride, &cMvSrchRngLT, &cMvSrchRngRB, rcMv, ruiCost );
     
    39794217 
    39804218  m_pcRdCost->getMotionCost( 1, 0 );
     4219
    39814220#if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
    39824221  if( ! pcCU->getSlice()->getIsDepth() )
     
    39884227    xPatternSearchFracDIF( pcCU, pcPatternKey, piRefY, iRefStride, &rcMv, cMvHalf, cMvQter, ruiCost
    39894228                          ,bBi
     4229#if VSP_MV_ZERO
     4230                          ,bIsVsp
     4231#endif
    39904232                          );
    39914233  }
     
    40064248    ruiCost += m_pcRdCost->getCost( uiMvBits );
    40074249#endif
    4008  
     4250
     4251#if VSP_MV_ZERO
     4252  if( bIsVsp ) {
     4253    uiMvBits = 0; // vector zero & not output
     4254    assert( rcMv.getHor()==0 && rcMv.getVer()==0 );
     4255  }
     4256#endif
     4257
    40094258  ruiBits      += uiMvBits;
    40104259  ruiCost       = (UInt)( floor( fWeight * ( (Double)ruiCost - (Double)m_pcRdCost->getCost( uiMvBits ) ) ) + (Double)m_pcRdCost->getCost( ruiBits ) );
     
    43044553                                       UInt& ruiCost
    43054554                                       ,Bool biPred
     4555#if VSP_MV_ZERO
     4556                                       ,Bool bIsVsp
     4557#endif
    43064558                                       )
    43074559{
     
    43224574  rcMvHalf = *pcMvInt;   rcMvHalf <<= 1;    // for mv-cost
    43234575  TComMv baseRefMv(0, 0);
    4324   ruiCost = xPatternRefinement( pcPatternKey, baseRefMv, 2, rcMvHalf   );
     4576  ruiCost = xPatternRefinement( pcPatternKey, baseRefMv, 2, rcMvHalf
     4577#if VSP_MV_ZERO
     4578                                   ,bIsVsp
     4579#endif
     4580    );
    43254581 
    43264582  m_pcRdCost->setCostScale( 0 );
     
    43324588  rcMvQter = *pcMvInt;   rcMvQter <<= 1;    // for mv-cost
    43334589  rcMvQter += rcMvHalf;  rcMvQter <<= 1;
    4334   ruiCost = xPatternRefinement( pcPatternKey, baseRefMv, 1, rcMvQter );
     4590  ruiCost = xPatternRefinement( pcPatternKey, baseRefMv, 1, rcMvQter
     4591#if VSP_MV_ZERO
     4592                                   ,bIsVsp
     4593#endif
     4594    );
    43354595}
    43364596
     
    43674627#endif
    43684628  //  No residual coding : SKIP mode
    4369   if ( ePredMode == MODE_SKIP && bSkipRes )
     4629  if ( (ePredMode == MODE_SKIP && bSkipRes)
     4630#if FORCE_REF_VSP==1
     4631    || ePredMode == MODE_SYNTH
     4632#endif
     4633    )
    43704634  {
    43714635    rpcYuvResi->clear();
     
    57376001    m_pcEntropyCoder->resetBits();
    57386002    m_pcEntropyCoder->encodeSkipFlag(pcCU, 0, true);
     6003#if FORCE_REF_VSP==1
     6004    if( pcCU->getSlice()->getViewId() != 0 )
     6005#if VSP_TEXT_ONLY
     6006    if( !pcCU->getSlice()->getSPS()->isDepth() )
     6007#endif
     6008      m_pcEntropyCoder->encodeVspFlag ( pcCU, 0, true );
     6009#endif
    57396010    m_pcEntropyCoder->encodeMergeIndex(pcCU, 0, 0, true);
    57406011#if HHI_INTER_VIEW_RESIDUAL_PRED
     
    57436014    ruiBits += m_pcEntropyCoder->getNumberOfWrittenBits();
    57446015  }
     6016#if FORCE_REF_VSP==1
     6017  else if( pcCU->isVspMode( 0 ) )
     6018  {
     6019    m_pcEntropyCoder->resetBits();
     6020    m_pcEntropyCoder->encodeSkipFlag( pcCU, 0, true );
     6021    m_pcEntropyCoder->encodeVspFlag ( pcCU, 0, true );
     6022    ruiBits += m_pcEntropyCoder->getNumberOfWrittenBits();
     6023  }
     6024#endif
    57456025  else
    57466026  {
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncSearch.h

    r100 r166  
    144144  UInt  xPatternRefinement( TComPattern* pcPatternKey,
    145145                           TComMv baseRefMv,
    146                            Int iFrac, TComMv& rcMvFrac );
     146                           Int iFrac, TComMv& rcMvFrac
     147#if VSP_MV_ZERO
     148                          ,Bool bIsVsp
     149#endif
     150                          );
    147151 
    148152  typedef struct
     
    197201#if AMP_MRG
    198202                                 ,Bool        bUseMRG = false
     203#endif
     204#if FORCE_REF_VSP==1
     205                                 ,Bool        bForceRefVsp = false
    199206#endif
    200207                                );
     
    486493                                    Int           iRefIdxPred,
    487494                                    TComMv&       rcMv,
     495#if VSP_MV_ZERO
     496                                    Bool          bIsVsp,
     497#endif
    488498                                    UInt&         ruiBits,
    489499                                    UInt&         ruiCost,
     
    531541                                    UInt&         ruiCost
    532542                                   ,Bool biPred
     543#if VSP_MV_ZERO
     544                                   ,Bool bIsVsp
     545#endif
    533546                                   );
    534547 
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncTop.cpp

    r105 r166  
    7979  m_pcBitCounters          = NULL;
    8080  m_pcRdCosts              = NULL;
     81
     82#if VSP_N
     83  m_pcPicVSP = NULL;
     84  m_pcPicAvail = NULL;
     85#endif
     86
     87#if VSP_SLICE_HEADER
     88  m_bUseVSP = false;
     89#endif
     90
    8191}
    8292
     
    184194  }
    185195#endif
     196
     197#if VSP_N
     198  m_pcPicVSP = new TComPic;
     199  m_pcPicVSP->create( getSourceWidth(), getSourceHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
     200  //m_pcPicVSP->getCurrSlice()->setViewId( this->getViewId() );
     201  m_pcPicVSP->getCurrSlice()->setViewId( NUM_VIEW_VSP );
     202  m_pcPicVSP->getCurrSlice()->setViewOrderIdx( m_iViewOrderIdx );
     203
     204  m_pcPicAvail = new TComPic;
     205  m_pcPicAvail->create( getSourceWidth(), getSourceHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
     206  m_pcPicAvail->getCurrSlice()->setViewId( 99 );
     207  m_pcPicAvail->getCurrSlice()->setViewOrderIdx( m_iViewOrderIdx );
     208#endif
     209
    186210}
    187211
     
    325349  }
    326350 
     351#if VSP_N
     352  if( m_pcPicVSP )
     353  {
     354    m_pcPicVSP->destroy();
     355    delete m_pcPicVSP;
     356    m_pcPicVSP = NULL;
     357  }
     358  if( m_pcPicAvail )
     359  {
     360    m_pcPicAvail->destroy();
     361    delete m_pcPicAvail;
     362    m_pcPicAvail = NULL;
     363  }
     364#endif
     365
    327366  return;
    328367}
     
    391430
    392431  m_iMaxRefPicNum = 0;
     432
     433#if VSP_N
     434  m_pcPicVSP->setCurrSliceIdx( 0 );
     435  m_pcPicVSP->getCurrSlice()->setSPS( this->getSPS() );
     436  m_pcPicVSP->getCurrSlice()->setPPS( this->getPPS() );
     437  m_pcPicVSP->getCurrSlice()->setPPSId( this->getPPS()->getPPSId() );
     438  //initialize the motion vector field with zeros - How about the RefIdx ????
     439  //IS THIS REALLY NECESSARY ????
     440  for ( int i=0; i<m_pcPicVSP->getPicSym()->getNumberOfCUsInFrame(); i++ )
     441  {
     442    m_pcPicVSP->getPicSym()->getCU(i)->getCUMvField(RefPicList(0))->clearMvField();
     443    m_pcPicVSP->getPicSym()->getCU(i)->getCUMvField(RefPicList(1))->clearMvField();
     444  }
     445#if DEPTH_MAP_GENERATION
     446#if !QC_MULTI_DIS_CAN
     447  // add extra pic buffers
     448  Bool  bNeedPrdDepthMapBuf = ( m_uiPredDepthMapGeneration > 0 );
     449  if( bNeedPrdDepthMapBuf && !m_pcPicVSP->getPredDepthMap() )
     450  {
     451    m_pcPicVSP->addPrdDepthMapBuffer( PDM_SUB_SAMP_EXP_X(m_uiPredDepthMapGeneration), PDM_SUB_SAMP_EXP_Y(m_uiPredDepthMapGeneration) );
     452    m_cDepthMapGenerator.clearDepthMap( m_pcPicVSP );
     453  }
     454#endif
     455#endif
     456  m_pcPicAvail->setCurrSliceIdx( 0 );
     457  m_pcPicAvail->getCurrSlice()->setSPS( this->getSPS() );
     458  m_pcPicAvail->getCurrSlice()->setPPS( this->getPPS() );
     459  m_pcPicAvail->getCurrSlice()->setPPSId( this->getPPS()->getPPSId() );
     460  //initialize the motion vector field with zeros - How about the RefIdx ????
     461  //IS THIS REALLY NECESSARY ????
     462  for ( int i=0; i<m_pcPicAvail->getPicSym()->getNumberOfCUsInFrame(); i++ )
     463  {
     464    m_pcPicAvail->getPicSym()->getCU(i)->getCUMvField(RefPicList(0))->clearMvField();
     465    m_pcPicAvail->getPicSym()->getCU(i)->getCUMvField(RefPicList(1))->clearMvField();
     466  }
     467#if DEPTH_MAP_GENERATION
     468#if !QC_MULTI_DIS_CAN
     469  // add extra pic buffers
     470  bNeedPrdDepthMapBuf = ( m_uiPredDepthMapGeneration > 0 );
     471  if( bNeedPrdDepthMapBuf && !m_pcPicVSP->getPredDepthMap() )
     472  {
     473    m_pcPicAvail->addPrdDepthMapBuffer( PDM_SUB_SAMP_EXP_X(m_uiPredDepthMapGeneration), PDM_SUB_SAMP_EXP_Y(m_uiPredDepthMapGeneration) );
     474    m_cDepthMapGenerator.clearDepthMap( m_pcPicAvail );
     475  }
     476#endif
     477#endif
     478#endif
    393479}
    394480
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncTop.h

    r56 r166  
    145145  TEncAnalyze             m_cAnalyzeB;
    146146
     147#if VSP_N
     148  TComPic*                m_pcPicVSP;                     ///< view synthesis prediction buffer for current POC to be coded
     149  TComPic*                m_pcPicAvail;
     150#endif
     151
     152#if VSP_SLICE_HEADER
     153  Bool                    m_bUseVSP;
     154#endif
     155
    147156protected:
    148157  Void  xGetNewPicBuffer  ( TComPic*& rpcPic );           ///< get picture buffer which will be processed
     
    237246  TComResidualGenerator*  getResidualGenerator  () { return  &m_cResidualGenerator;   }
    238247#endif
     248#if VSP_N
     249  TComPic*                getVSPBuf             () { return m_pcPicVSP; }
     250  TComPic*                getVSPAvailBuf        () { return m_pcPicAvail; }
     251#endif
     252
     253#if VSP_SLICE_HEADER
     254  Void                    setUseVSP   ( Bool val ) { m_bUseVSP = val; }
     255  Bool                    getUseVSP             () { return m_bUseVSP; }
     256#endif
    239257
    240258  // -------------------------------------------------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.