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/TLibDecoder
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r100 r166  
    23482348#endif
    23492349
     2350#if VSP_SLICE_HEADER
     2351  if( rpcSlice->getSPS()->getViewId()!=0
     2352#if VSP_TEXT_ONLY
     2353      && !(rpcSlice->getSPS()->isDepth())
     2354#endif
     2355    )
     2356  {
     2357    READ_FLAG( uiCode, "vsp_flag" );
     2358    rpcSlice->setVspFlag( uiCode ? true : false );
     2359  }
     2360#endif
     2361
    23502362  if (!bEntropySlice)
    23512363  {
     
    26012613}
    26022614
     2615#if FORCE_REF_VSP==1
     2616Void TDecCavlc::parseVspFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     2617{
     2618  assert(0);
     2619}
     2620#endif
     2621
    26032622#if HHI_INTER_VIEW_MOTION_PRED
    26042623Void TDecCavlc::parseMVPIdx( Int& riMVPIdx, Int iAMVPCands )
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecCAVLC.h

    r77 r166  
    142142 
    143143  Void  parseSkipFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     144#if FORCE_REF_VSP==1
     145  Void  parseVspFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     146#endif
    144147  Void parseMergeFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx );
    145148  Void parseMergeIndex      ( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth );
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecCu.cpp

    r100 r166  
    5252  m_ppcYuvResPred = NULL;
    5353#endif
     54#if FORCE_REF_VSP
     55  m_ppcYuvAvail   = NULL;
     56  m_ppcYuvSynth   = NULL;
     57#endif
    5458  m_ppcCU      = NULL;
    5559}
     
    7983#if HHI_INTER_VIEW_RESIDUAL_PRED
    8084  m_ppcYuvResPred = new TComYuv*   [m_uiMaxDepth-1];
     85#endif
     86#if FORCE_REF_VSP
     87  m_ppcYuvAvail   = new TComYuv*    [m_uiMaxDepth-1];
     88  m_ppcYuvSynth   = new TComYuv*    [m_uiMaxDepth-1];
    8189#endif
    8290  m_ppcCU      = new TComDataCU*[m_uiMaxDepth-1];
     
    94102    m_ppcYuvResPred[ui] = new TComYuv;    m_ppcYuvResPred[ui]->create( uiWidth, uiHeight );
    95103#endif
     104#if FORCE_REF_VSP
     105    m_ppcYuvAvail  [ui] = new TComYuv;    m_ppcYuvAvail  [ui]->create( uiWidth, uiHeight );
     106    m_ppcYuvSynth  [ui] = new TComYuv;    m_ppcYuvSynth  [ui]->create( uiWidth, uiHeight );
     107#endif
    96108    m_ppcCU     [ui] = new TComDataCU; m_ppcCU     [ui]->create( uiNumPartitions, uiWidth, uiHeight, true, uiMaxWidth >> (m_uiMaxDepth - 1) );
    97109  }
     
    118130    m_ppcYuvResPred[ui]->destroy(); delete m_ppcYuvResPred[ui]; m_ppcYuvResPred[ui] = NULL;
    119131#endif
     132#if FORCE_REF_VSP
     133    m_ppcYuvAvail  [ui]->destroy(); delete m_ppcYuvAvail  [ui]; m_ppcYuvAvail  [ui] = NULL;
     134    m_ppcYuvSynth  [ui]->destroy(); delete m_ppcYuvSynth  [ui]; m_ppcYuvSynth  [ui] = NULL;
     135#endif
    120136    m_ppcCU     [ui]->destroy(); delete m_ppcCU     [ui]; m_ppcCU     [ui] = NULL;
    121137  }
     
    125141#if HHI_INTER_VIEW_RESIDUAL_PRED
    126142  delete [] m_ppcYuvResPred; m_ppcYuvResPred = NULL;
     143#endif
     144#if FORCE_REF_VSP
     145  delete [] m_ppcYuvAvail;   m_ppcYuvAvail   = NULL;
     146  delete [] m_ppcYuvSynth;   m_ppcYuvSynth   = NULL;
    127147#endif
    128148  delete [] m_ppcCU     ; m_ppcCU      = NULL;
     
    328348  {
    329349    m_pcEntropyDecoder->decodeSkipFlag( pcCU, uiAbsPartIdx, uiDepth );
     350
     351#if FORCE_REF_VSP==1
     352    if( pcCU->isSkipped(uiAbsPartIdx) && pcCU->getSlice()->getViewId() != 0 )
     353#if VSP_TEXT_ONLY
     354    if( !pcCU->getSlice()->getSPS()->isDepth() )
     355#endif
     356    {
     357      m_pcEntropyDecoder->decodeVspFlag( pcCU, uiAbsPartIdx, uiDepth );
     358    }
     359#endif
    330360  }
    331361 
    332362  if( pcCU->isSkipped(uiAbsPartIdx) )
     363#if FORCE_REF_VSP==1
     364  if( !pcCU->isVspMode(uiAbsPartIdx) )
     365#endif
    333366  {
    334367    m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 );
     
    352385    if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == uiDepth )
    353386    {
     387#if DEBUGLOGOUT
     388      PredMode   eOrgPred = pcCU->getPredictionMode( uiAbsPartIdx );
     389#endif
    354390      TComDataCU *pcTextureCU = pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() );
    355391      pcCU->copyTextureMotionDataFrom( pcTextureCU, uiDepth, pcCU->getZorderIdxInCU() + uiAbsPartIdx, uiAbsPartIdx );
     392#if DEBUGLOGOUT
     393      if( eOrgPred == MODE_SKIP )
     394        pcCU->setPredModeSubParts( MODE_SKIP, uiAbsPartIdx, uiDepth );
     395      m_cDebug.DebugLogOut( pcCU, uiAbsPartIdx, uiDepth );
     396#endif
    356397
    357398      UInt uiCurrPartNumb = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);
     
    396437#endif
    397438    xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
     439#if DEBUGLOGOUT
     440#if HHI_MPI
     441    if( pcCU->getTextureModeDepth( uiAbsPartIdx ) != uiDepth )
     442#endif
     443      m_cDebug.DebugLogOut( pcCU, uiAbsPartIdx, uiDepth );
     444#endif
    398445    return;
    399446  }
     447
     448#if FORCE_REF_VSP==1
     449  if( pcCU->isVspMode( uiAbsPartIdx ) )
     450  {
     451    TComMv cMvZero;
     452
     453    pcCU->setPartSizeSubParts( SIZE_2Nx2N, uiAbsPartIdx, uiDepth );
     454    pcCU->setSizeSubParts( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth );
     455
     456    pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( TComMvField(), SIZE_2Nx2N, uiAbsPartIdx, uiDepth, 0 );
     457    pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( TComMvField(), SIZE_2Nx2N, uiAbsPartIdx, uiDepth, 0 );
     458    pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd    ( cMvZero,       SIZE_2Nx2N, uiAbsPartIdx, uiDepth, 0 );
     459    pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd    ( cMvZero,       SIZE_2Nx2N, uiAbsPartIdx, uiDepth, 0 );
     460
     461    //pcCU->getCUMvField(REF_PIC_LIST_0)->setAllRefIdx ( pcCU->getSlice()->getRefIdxVsp(REF_PIC_LIST_0), SIZE_2Nx2N, 0, pcCU->getDepth(0), 0 );
     462    //pcCU->getCUMvField(REF_PIC_LIST_1)->setAllRefIdx ( pcCU->getSlice()->getRefIdxVsp(REF_PIC_LIST_1), SIZE_2Nx2N, 0, pcCU->getDepth(0), 0 );
     463
     464    pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_0, uiAbsPartIdx, 0, uiDepth );
     465    pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_0, uiAbsPartIdx, 0, uiDepth );
     466    pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_1, uiAbsPartIdx, 0, uiDepth );
     467    pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_1, uiAbsPartIdx, 0, uiDepth );
     468
     469    pcCU->setCbfSubParts( 0, 0, 0, uiAbsPartIdx, uiDepth );
     470    pcCU->setTrIdxSubParts( 0 , uiAbsPartIdx, uiDepth );
     471    pcCU->setNSQTIdxSubParts( uiAbsPartIdx, uiDepth );
     472
     473    xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
     474#if DEBUGLOGOUT
     475    m_cDebug.DebugLogOut( pcCU, uiAbsPartIdx, uiDepth );
     476#endif
     477    return;
     478  }
     479#endif
    400480
    401481#if HHI_MPI
     
    428508    {
    429509      xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
     510#if DEBUGLOGOUT
     511      m_cDebug.DebugLogOut( pcCU, uiAbsPartIdx, uiDepth );
     512#endif
    430513      return;
    431514    }
     
    527610  setdQPFlag( bCodeDQP );
    528611  xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
     612#if DEBUGLOGOUT
     613  m_cDebug.DebugLogOut( pcCU, uiAbsPartIdx, uiDepth );
     614#endif
    529615}
    530616
     
    553639{
    554640  TComPic* pcPic = pcCU->getPic();
     641#if FORCE_REF_VSP
     642  if(pcPic->getPicYuvSynth())  m_ppcYuvSynth[uiDepth]->copyFromPicYuv( pcPic->getPicYuvSynth(), pcCU->getAddr(), uiAbsPartIdx );
     643  if(pcPic->getPicYuvAvail())  m_ppcYuvAvail[uiDepth]->copyFromPicYuv( pcPic->getPicYuvAvail(), pcCU->getAddr(), uiAbsPartIdx );
     644#endif
    555645 
    556646  Bool bBoundary = false;
     
    603693      xReconIntraQT( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth );
    604694      break;
     695#if FORCE_REF_VSP==1
     696    case MODE_SYNTH:
     697      m_ppcYuvReco[uiDepth]->copyFromPicYuv(pcPic->getPicYuvSynth(), pcCU->getAddr(), uiAbsPartIdx);
     698      break;
     699#endif
    605700    default:
    606701      assert(0);
     
    615710 
    616711  xCopyToPic( m_ppcCU[uiDepth], pcPic, uiAbsPartIdx, uiDepth );
     712#if DEBUGIMGOUT
     713  xColsetToPicMerge( m_ppcCU[uiDepth], pcPic->getPicYuvRecDbg(), uiAbsPartIdx, uiDepth );
     714#endif
    617715}
    618716
     
    626724  // inter prediction
    627725  m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] );
    628  
    629726#if HHI_MPI
    630727  if( pcCU->getTextureModeDepth( 0 ) != -1 )
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecCu.h

    r56 r166  
    4646#include "TLibCommon/TComPrediction.h"
    4747#include "TDecEntropy.h"
     48#if DEBUGIMGOUT || DEBUGLOGOUT
     49#include "TLibCommon/DebugLog.h"
     50#endif
    4851
    4952//! \ingroup TLibDecoder
     
    6467  TComYuv**           m_ppcYuvResPred;    ///< residual prediction buffer
    6568#endif
     69#if VSP_N
     70  TComYuv**           m_ppcYuvAvail;      ///< array of available map buffer
     71  TComYuv**           m_ppcYuvSynth;      ///< array of synth buffer
     72#endif
    6673  TComDataCU**        m_ppcCU;            ///< CU data array
    6774 
     
    7784  virtual ~TDecCu();
    7885 
     86#if DEBUGLOGOUT
     87  DebugLog            m_cDebug;
     88#endif
     89
    7990  /// initialize access channels
    8091  Void  init                    ( TDecEntropy* pcEntropyDecoder, TComTrQuant* pcTrQuant, TComPrediction* pcPrediction );
     
    121132  Void xFillPCMBuffer           (TComDataCU* pCU, UInt absPartIdx, UInt depth);
    122133#endif
     134#if DEBUGIMGOUT
     135  Void xColsetToPic             ( TComDataCU* pcCU, TComPicYuv* pcPicYuv, UInt uiZorderIdx, UInt uiDepth );
     136  Void xColsetToPicMerge        ( TComDataCU* pcCU, TComPicYuv* pcPicYuv, UInt uiZorderIdx, UInt uiDepth );
     137#endif
    123138};
    124139
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecEntropy.cpp

    r100 r166  
    5454}
    5555
     56#if FORCE_REF_VSP==1
     57Void TDecEntropy::decodeVspFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     58{
     59  m_pcEntropyDecoderIf->parseVspFlag( pcCU, uiAbsPartIdx, uiDepth );
     60}
     61#endif
     62
    5663/** decode merge flag
    5764 * \param pcSubCU
     
    301308        {
    302309          decodeRefFrmIdxPU( pcCU,    uiSubPartIdx,              uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) );
     310#if VSP_MV_ZERO
     311          Int iRefIdx = pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->getRefIdx(uiSubPartIdx);
     312          if( pcCU->getSlice()->getViewId() && iRefIdx >= 0 && (pcCU->getSlice()->getRefViewId( RefPicList( uiRefListIdx ), iRefIdx ) == NUM_VIEW_VSP) )
     313          {
     314            pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( TComMv(0, 0), pcCU->getPartitionSize( uiSubPartIdx ), uiSubPartIdx, uiDepth, uiPartIdx );
     315            pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMv ( TComMv(0, 0), pcCU->getPartitionSize( uiSubPartIdx ), uiSubPartIdx, uiDepth, uiPartIdx );
     316            pcCU->setMVPIdxSubParts( -1, RefPicList( uiRefListIdx ), uiSubPartIdx, uiPartIdx, pcCU->getDepth(uiSubPartIdx));
     317            pcCU->setMVPNumSubParts( -1, RefPicList( uiRefListIdx ), uiSubPartIdx, uiPartIdx, pcCU->getDepth(uiSubPartIdx));
     318          }
     319          else
     320          {
     321#endif
    303322          decodeMvdPU      ( pcCU,    uiSubPartIdx,              uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) );
    304323          decodeMVPIdxPU   ( pcSubCU, uiSubPartIdx-uiAbsPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) );
     324#if VSP_MV_ZERO
     325          }
     326#endif
    305327        }
    306328      }
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecEntropy.h

    r77 r166  
    103103public:
    104104  virtual Void parseSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
     105#if FORCE_REF_VSP==1
     106  virtual Void parseVspFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
     107#endif
    105108  virtual Void parseSplitFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
    106109  virtual Void parseMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ) = 0;
     
    196199  Void decodeSplitFlag         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    197200  Void decodeSkipFlag          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     201#if FORCE_REF_VSP==1
     202  Void decodeVspFlag           ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     203#endif
    198204  Void decodeMergeFlag         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx );
    199205  Void decodeMergeIndex        ( TComDataCU* pcSubCU, UInt uiPartIdx, UInt uiPartAddr, PartSize eCUMode, UChar* puhInterDirNeighbours, TComMvField* pcMvFieldNeighbours, UInt uiDepth );
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecSbac.cpp

    r100 r166  
    578578}
    579579
     580#if FORCE_REF_VSP==1
     581Void TDecSbac::parseVspFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     582{
     583  if( pcCU->getSlice()->isIntra() || pcCU->getSlice()->getViewId()==0 )
     584  {
     585    return;
     586  }
     587 
     588  UInt uiSymbol = 0;
     589  UInt uiCtxSkip = pcCU->getCtxSkipFlag( uiAbsPartIdx );
     590  m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUSkipFlagSCModel.get( 0, 0, uiCtxSkip ) );
     591  DTRACE_CABAC_VL( g_nSymbolCounter++ );
     592  DTRACE_CABAC_T( "\tVspFlag" );
     593  DTRACE_CABAC_T( "\tuiCtxSkip: ");
     594  DTRACE_CABAC_V( uiCtxSkip );
     595  DTRACE_CABAC_T( "\tuiSymbol: ");
     596  DTRACE_CABAC_V( uiSymbol );
     597  DTRACE_CABAC_T( "\n");
     598 
     599  if( uiSymbol )
     600  {
     601    pcCU->setPredModeSubParts( MODE_SYNTH, uiAbsPartIdx, uiDepth );
     602  }
     603}
     604#endif
     605
    580606/** parse merge flag
    581607 * \param pcCU
     
    610636  uiNumCand = pcCU->getSlice()->getMaxNumMergeCand();
    611637#if HHI_MPI
     638#if VSP_TEXT_ONLY
     639  TComDataCU* pcTextCU = pcCU->getSlice()->getSPS()->getUseMVI() ? pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() ) : NULL;
     640  Int aiRefIdxVsp[2] = { pcTextCU ? pcTextCU->getCUMvField( RefPicList(0) )->getRefIdx( uiAbsPartIdx ) : -1,
     641                         pcTextCU ? pcTextCU->getCUMvField( RefPicList(1) )->getRefIdx( uiAbsPartIdx ) : -1 };
     642  const Bool bMVIAvailable = pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE
     643    && !( aiRefIdxVsp[0] >= 0 && pcTextCU->getSlice()->getRefViewId( RefPicList(0), aiRefIdxVsp[0] ) == NUM_VIEW_VSP )
     644    && !( aiRefIdxVsp[1] >= 0 && pcTextCU->getSlice()->getRefViewId( RefPicList(1), aiRefIdxVsp[1] ) == NUM_VIEW_VSP );
     645#else
    612646  const Bool bMVIAvailable = pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE;
     647#endif
    613648  const UInt uiMviMergePos = bMVIAvailable ? HHI_MPI_MERGE_POS : uiNumCand;
    614649#endif
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecSbac.h

    r100 r166  
    166166
    167167  Void parseSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     168#if FORCE_REF_VSP==1
     169  Void parseVspFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     170#endif
    168171  Void parseSplitFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    169172  Void parseMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx );
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecSlice.cpp

    r77 r166  
    102102  rpcPic->setPicYuvResi( 0 );
    103103 
     104#if DEBUGLOGOUT
     105  char fname[128];
     106  sprintf(fname, "%sV%02d_%05d%s.csv", "DecLog", rpcPic->getSlice(0)->getViewId(), rpcPic->getPOC(), rpcPic->getSlice(0)->getIsDepth() ? "depth":"text");
     107  m_pcCuDecoder->m_cDebug.DebugLogFileOpen( fname );
     108#endif
    104109#if ENC_DEC_TRACE
    105110  g_bJustDoIt = g_bEncDecTraceEnable;
     
    439444#endif
    440445  }
     446#if DEBUGLOGOUT
     447  m_pcCuDecoder->m_cDebug.DebugLogFileClose();
     448#endif
    441449
    442450}
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecTop.cpp

    r77 r166  
    5656    m_aaiCodedScale       [ uiId ] = new Int [ MAX_VIEW_NUM ];
    5757  }
     58
     59#if VSP_N
     60  xCreateLUTs( (UInt)MAX_VIEW_NUM, (UInt)MAX_VIEW_NUM, m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );
     61  m_iLog2Precision   = LOG2_DISP_PREC_LUT;
     62  m_uiBitDepthForLUT = 8; //fixed
     63#if NTT_SUBPEL
     64  xCreateLUTs_Subpel( (UInt)MAX_VIEW_NUM, (UInt)MAX_VIEW_NUM,  m_aiBaseViewShiftLUT_ipel,  m_aiBaseViewShiftLUT_fpos);
     65#endif
     66#endif
    5867}
    5968
     
    6978  delete [] m_aiViewOrderIndex;
    7079  delete [] m_aiViewReceived;
     80
     81#if VSP_N
     82  xDeleteArray( m_adBaseViewShiftLUT, MAX_VIEW_NUM, MAX_VIEW_NUM, 2 );
     83  xDeleteArray( m_aiBaseViewShiftLUT, MAX_VIEW_NUM, MAX_VIEW_NUM, 2 );
     84#if NTT_SUBPEL
     85  xDeleteArray( m_aiBaseViewShiftLUT_ipel, MAX_VIEW_NUM, MAX_VIEW_NUM, 2 );
     86  xDeleteArray( m_aiBaseViewShiftLUT_fpos, MAX_VIEW_NUM, MAX_VIEW_NUM, 2 );
     87#endif
     88#endif
    7189}
    7290
     
    82100  m_uiMaxViewId             = 0;
    83101}
     102
     103#if VSP_N
     104Void
     105CamParsCollector::xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT)
     106{
     107  //AOF( m_uiBitDepthForLUT == 8 );
     108  //AOF(radLUT == NULL && raiLUT == NULL );
     109
     110  uiNumberSourceViews = Max( 1, uiNumberSourceViews );
     111  uiNumberTargetViews = Max( 1, uiNumberTargetViews );
     112
     113  radLUT         = new Double***[ uiNumberSourceViews ];
     114  raiLUT         = new Int   ***[ uiNumberSourceViews ];
     115
     116  for( UInt uiSourceView = 0; uiSourceView < uiNumberSourceViews; uiSourceView++ )
     117  {
     118    radLUT        [ uiSourceView ] = new Double**[ uiNumberTargetViews ];
     119    raiLUT        [ uiSourceView ] = new Int   **[ uiNumberTargetViews ];
     120
     121    for( UInt uiTargetView = 0; uiTargetView < uiNumberTargetViews; uiTargetView++ )
     122    {
     123      radLUT        [ uiSourceView ][ uiTargetView ]      = new Double*[ 2 ];
     124      radLUT        [ uiSourceView ][ uiTargetView ][ 0 ] = new Double [ 257 ];
     125      radLUT        [ uiSourceView ][ uiTargetView ][ 1 ] = new Double [ 257 ];
     126
     127      raiLUT        [ uiSourceView ][ uiTargetView ]      = new Int*   [ 2 ];
     128      raiLUT        [ uiSourceView ][ uiTargetView ][ 0 ] = new Int    [ 257 ];
     129      raiLUT        [ uiSourceView ][ uiTargetView ][ 1 ] = new Int    [ 257 ];
     130    }
     131  }
     132}
     133
     134Void
     135CamParsCollector::xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT)
     136{
     137  Int     iLog2DivLuma   = m_uiBitDepthForLUT + m_uiCamParsCodedPrecision + 1 - m_iLog2Precision;   AOF( iLog2DivLuma > 0 );
     138  Int     iLog2DivChroma = iLog2DivLuma + 1;
     139
     140  iOffset <<= m_uiBitDepthForLUT;
     141
     142  Double dScale  = (Double) iScale  / (( Double ) ( 1 << iLog2DivLuma ));
     143  Double dOffset = (Double) iOffset / (( Double ) ( 1 << iLog2DivLuma ));
     144
     145  // offsets including rounding offsets
     146  Int64 iOffsetLuma   = iOffset + ( ( 1 << iLog2DivLuma   ) >> 1 );
     147  Int64 iOffsetChroma = iOffset + ( ( 1 << iLog2DivChroma ) >> 1 );
     148
     149
     150  for( UInt uiDepthValue = 0; uiDepthValue < 256; uiDepthValue++ )
     151  {
     152
     153    // real-valued look-up tables
     154#if POZNAN_NONLINEAR_DEPTH
     155    Double  dShiftLuma;
     156    if( m_bUseNonlinearDepth )
     157      dShiftLuma      = ( m_cNonlinearDepthModel.BackwardD( (Double)uiDepthValue, dScale) + dOffset ) * Double( 1 << m_iLog2Precision );
     158    else
     159      dShiftLuma      = ( (Double)uiDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision );
     160#else
     161    Double  dShiftLuma      = ( (Double)uiDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision );
     162#endif
     163    Double  dShiftChroma    = dShiftLuma / 2;
     164    radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = dShiftLuma;
     165    radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = dShiftChroma;
     166
     167    // integer-valued look-up tables
     168#if POZNAN_NONLINEAR_DEPTH
     169    Int64   iTempScale;
     170    if( m_bUseNonlinearDepth )
     171      iTempScale      = (Int64)m_cNonlinearDepthModel.BackwardI(uiDepthValue, iScale);
     172    else
     173      iTempScale      = (Int64)uiDepthValue * iScale;
     174#else
     175    Int64   iTempScale      = (Int64)uiDepthValue * iScale;
     176#endif
     177    Int64   iShiftLuma      = ( iTempScale + iOffsetLuma   ) >> iLog2DivLuma;
     178    Int64   iShiftChroma    = ( iTempScale + iOffsetChroma ) >> iLog2DivChroma;
     179    raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = (Int)iShiftLuma;
     180    raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = (Int)iShiftChroma;
     181
     182    // maximum deviation
     183    //dMaxDispDev     = Max( dMaxDispDev,    fabs( Double( (Int) iTestScale   ) - dShiftLuma * Double( 1 << iLog2DivLuma ) ) / Double( 1 << iLog2DivLuma ) );
     184    //dMaxRndDispDvL  = Max( dMaxRndDispDvL, fabs( Double( (Int) iShiftLuma   ) - dShiftLuma   ) );
     185    //dMaxRndDispDvC  = Max( dMaxRndDispDvC, fabs( Double( (Int) iShiftChroma ) - dShiftChroma ) );
     186  }
     187
     188  radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ];
     189  radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ];
     190  raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ];
     191  raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ];
     192}
     193
     194Bool
     195CamParsCollector::getNearestBaseView( Int iSynthViewIdx, Int &riNearestViewIdx, Int &riRelDistToLeft, Bool& rbRenderFromLeft)
     196{
     197  /*
     198  riNearestViewIdx = 0;
     199
     200  Bool bDecencdingVN = ( m_aiSortedBaseViews.size() >= 2 && m_aiSortedBaseViews[ 0 ] > m_aiSortedBaseViews[ 1 ] );
     201  Int  iFactor       = ( bDecencdingVN ? -1 : 1 );
     202
     203  if( ( m_aiBaseId2SortedId[iSynthViewIdx] - m_aiBaseId2SortedId[riNearestViewIdx] ) * iFactor  <= 0 )
     204  {
     205    rbRenderFromLeft = true;
     206  }
     207  else
     208  {
     209    rbRenderFromLeft = false;
     210  }
     211
     212  riRelDistToLeft = 128; //Not used for now;
     213//*/
     214  return true;
     215}
     216
     217#if NTT_SUBPEL
     218Void
     219CamParsCollector::xCreateLUTs_Subpel( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Int****& raiLUT0, Int****& raiLUT1 )
     220{
     221  uiNumberSourceViews = Max( 1, uiNumberSourceViews );
     222  uiNumberTargetViews = Max( 1, uiNumberTargetViews );
     223
     224  raiLUT0         = new Int   ***[ uiNumberSourceViews ];
     225  raiLUT1         = new Int   ***[ uiNumberSourceViews ];
     226
     227  for( UInt uiSourceView = 0; uiSourceView < uiNumberSourceViews; uiSourceView++ )
     228  {
     229    raiLUT0        [ uiSourceView ] = new Int   **[ uiNumberTargetViews ];
     230    raiLUT1        [ uiSourceView ] = new Int   **[ uiNumberTargetViews ];
     231
     232    for( UInt uiTargetView = 0; uiTargetView < uiNumberTargetViews; uiTargetView++ )
     233    {
     234      raiLUT0        [ uiSourceView ][ uiTargetView ]      = new Int*   [ 2 ];
     235      raiLUT0        [ uiSourceView ][ uiTargetView ][ 0 ] = new Int    [ 257 ];
     236      raiLUT0        [ uiSourceView ][ uiTargetView ][ 1 ] = new Int    [ 257 ];
     237      raiLUT1        [ uiSourceView ][ uiTargetView ]      = new Int*   [ 2 ];
     238      raiLUT1        [ uiSourceView ][ uiTargetView ][ 0 ] = new Int    [ 257 ];
     239      raiLUT1        [ uiSourceView ][ uiTargetView ][ 1 ] = new Int    [ 257 ];
     240    }
     241  }
     242}
     243Void
     244CamParsCollector::xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Int****& raiLUT_ipel, Int****& raiLUT_fpos)
     245{
     246  Int   iLog2Div = m_uiBitDepthForLUT + m_uiCamParsCodedPrecision + 1 - m_iLog2Precision;   AOF( iLog2Div > 0 );
     247  Int64 iOffset64   = ( Int64(iOffset) << m_uiBitDepthForLUT ) + ( ( 1 << iLog2Div ) >> 1 );
     248
     249  for( UInt uiDepthValue = 0; uiDepthValue < 256; uiDepthValue++ )
     250  {
     251    Int64   iTempScale      = (Int64)uiDepthValue * iScale;
     252    Int     iShiftSubpel    = (Int) (( iTempScale + iOffset64 ) >> iLog2Div);
     253    Int     iShiftPelLuma   = iShiftSubpel >> m_iLog2Precision; // better to have rounding ?
     254    Int     iShiftPelChroma = iShiftPelLuma >> 1;
     255
     256    raiLUT_ipel[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = iShiftPelLuma;
     257    raiLUT_ipel[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = iShiftPelChroma;
     258    raiLUT_fpos[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = iShiftSubpel - ( iShiftPelLuma << m_iLog2Precision );
     259    raiLUT_fpos[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = iShiftSubpel - ( iShiftPelChroma << (m_iLog2Precision+1) );
     260
     261#if 0 // NTT bugfix
     262    if ( raiLUT_fpos[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] < 0 )
     263      raiLUT_fpos[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = -4 - raiLUT_fpos[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ];
     264    if ( raiLUT_fpos[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] < 0 )
     265      raiLUT_fpos[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = -8 - raiLUT_fpos[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ];
     266#endif
     267
     268#if _DEBUG
     269    AOF( (raiLUT_fpos[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ]>> m_iLog2Precision   ) == 0 );
     270    AOF( (raiLUT_fpos[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ]>>(m_iLog2Precision+1)) == 0 );
     271#endif
     272  }
     273
     274  raiLUT_ipel[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = raiLUT_ipel[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ];
     275  raiLUT_ipel[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = raiLUT_ipel[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ];
     276  raiLUT_fpos[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = raiLUT_fpos[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ];
     277  raiLUT_fpos[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = raiLUT_fpos[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ];
     278}
     279#endif
     280
     281#endif
    84282
    85283Void
     
    164362        m_aaiCodedScale [ uiViewId ][ uiBaseId ]  = pcSlice->getInvCodedScale () [ uiBaseId ];
    165363        m_aaiCodedOffset[ uiViewId ][ uiBaseId ]  = pcSlice->getInvCodedOffset() [ uiBaseId ];
     364#if VSP_N
     365        xInitLUTs( uiBaseId, uiViewId, m_aaiCodedScale[ uiBaseId ][ uiViewId ], m_aaiCodedOffset[ uiBaseId ][ uiViewId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT);
     366        xInitLUTs( uiViewId, uiBaseId, m_aaiCodedScale[ uiViewId ][ uiBaseId ], m_aaiCodedOffset[ uiViewId ][ uiBaseId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT);
     367#if NTT_SUBPEL
     368        xInitLUTs( uiBaseId, uiViewId, m_aaiCodedScale[ uiBaseId ][ uiViewId ], m_aaiCodedOffset[ uiBaseId ][ uiViewId ], m_aiBaseViewShiftLUT_ipel, m_aiBaseViewShiftLUT_fpos );
     369        xInitLUTs( uiViewId, uiBaseId, m_aaiCodedScale[ uiViewId ][ uiBaseId ], m_aaiCodedOffset[ uiViewId ][ uiBaseId ], m_aiBaseViewShiftLUT_ipel, m_aiBaseViewShiftLUT_fpos );
     370#endif
     371#endif 
    166372      }
    167373      else
     
    171377        m_aaiCodedScale [ uiViewId ][ uiBaseId ]  = pcSlice->getSPS()->getInvCodedScale () [ uiBaseId ];
    172378        m_aaiCodedOffset[ uiViewId ][ uiBaseId ]  = pcSlice->getSPS()->getInvCodedOffset() [ uiBaseId ];
     379#if VSP_N
     380        xInitLUTs( uiBaseId, uiViewId, m_aaiCodedScale[ uiBaseId ][ uiViewId ], m_aaiCodedOffset[ uiBaseId ][ uiViewId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );
     381        xInitLUTs( uiViewId, uiBaseId, m_aaiCodedScale[ uiViewId ][ uiBaseId ], m_aaiCodedOffset[ uiViewId ][ uiBaseId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );
     382#if NTT_SUBPEL
     383        xInitLUTs( uiBaseId, uiViewId, m_aaiCodedScale[ uiBaseId ][ uiViewId ], m_aaiCodedOffset[ uiBaseId ][ uiViewId ], m_aiBaseViewShiftLUT_ipel, m_aiBaseViewShiftLUT_fpos );
     384        xInitLUTs( uiViewId, uiBaseId, m_aaiCodedScale[ uiViewId ][ uiBaseId ], m_aaiCodedOffset[ uiViewId ][ uiBaseId ], m_aiBaseViewShiftLUT_ipel, m_aiBaseViewShiftLUT_fpos );
     385#endif
     386#endif
    173387      }
    174388    }
     
    185399        m_aaiCodedScale [ uiViewId ][ uiBaseId ]  = pcSlice->getInvCodedScale () [ uiBaseId ];
    186400        m_aaiCodedOffset[ uiViewId ][ uiBaseId ]  = pcSlice->getInvCodedOffset() [ uiBaseId ];
     401#if VSP_N
     402        xInitLUTs( uiBaseId, uiViewId, m_aaiCodedScale[ uiBaseId ][ uiViewId ], m_aaiCodedOffset[ uiBaseId ][ uiViewId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );
     403        xInitLUTs( uiViewId, uiBaseId, m_aaiCodedScale[ uiViewId ][ uiBaseId ], m_aaiCodedOffset[ uiViewId ][ uiBaseId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );
     404#if NTT_SUBPEL
     405        xInitLUTs( uiBaseId, uiViewId, m_aaiCodedScale[ uiBaseId ][ uiViewId ], m_aaiCodedOffset[ uiBaseId ][ uiViewId ], m_aiBaseViewShiftLUT_ipel, m_aiBaseViewShiftLUT_fpos );
     406        xInitLUTs( uiViewId, uiBaseId, m_aaiCodedScale[ uiViewId ][ uiBaseId ], m_aaiCodedOffset[ uiViewId ][ uiBaseId ], m_aiBaseViewShiftLUT_ipel, m_aiBaseViewShiftLUT_fpos );
     407#endif
     408#endif
    187409      }
    188410    }
     
    255477#endif
    256478#if ENC_DEC_TRACE
    257   g_hTrace = fopen( "TraceDec.txt", "wb" );
     479  if(!g_hTrace) g_hTrace = fopen( "TraceDec.txt", "wb" );
    258480  g_bJustDoIt = g_bEncDecTraceDisable;
    259481  g_nSymbolCounter = 0;
     
    266488  m_bFirstSliceInSequence   = true;
    267489  m_pcCamParsCollector = 0;
     490
     491#if VSP_N
     492  m_pcPicVSP = NULL;
     493  m_pcPicAvail = NULL;
     494#endif
    268495}
    269496
     
    271498{
    272499#if ENC_DEC_TRACE
    273   fclose( g_hTrace );
     500  if(g_hTrace) fclose( g_hTrace );
     501  g_hTrace=NULL;
    274502#endif
    275503}
     
    298526  m_cResidualGenerator.destroy();
    299527#endif
     528
     529#if VSP_N
     530  if( m_pcPicVSP )
     531  {
     532    m_pcPicVSP->destroy();
     533    delete m_pcPicVSP;
     534    m_pcPicVSP = NULL;
     535  }
     536  if( m_pcPicAvail )
     537  {
     538    m_pcPicAvail->destroy();
     539    delete m_pcPicAvail;
     540    m_pcPicAvail = NULL;
     541  }
     542#endif
     543
    300544}
    301545
     
    732976    //  Get a new picture buffer
    733977    xGetNewPicBuffer (m_apcSlicePilot, pcPic);
     978#if VSP_N
     979#if VSP_SLICE_HEADER
     980    if( m_apcSlicePilot->getVspFlag() )
     981#endif
     982    {
     983      if( m_pcPicVSP == NULL )
     984      {
     985        m_pcPicVSP = new TComPic;
     986        m_pcPicVSP->create( m_apcSlicePilot->getSPS()->getPicWidthInLumaSamples(), m_apcSlicePilot->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
     987        m_pcPicVSP->setCurrSliceIdx(0);
     988        m_pcPicVSP->getCurrSlice()->setViewId( NUM_VIEW_VSP );
     989        m_pcPicVSP->getCurrSlice()->setViewOrderIdx( m_apcSlicePilot->getSPS()->getViewOrderIdx() );
     990        m_pcPicVSP->getCurrSlice()->setSPS( m_apcSlicePilot->getSPS() );
     991        m_pcPicVSP->getCurrSlice()->setPPS( m_apcSlicePilot->getPPS() );
     992        m_pcPicVSP->getCurrSlice()->setPPSId( m_apcSlicePilot->getPPS()->getPPSId() );
     993        m_pcPicVSP->getPicSym()->setNumColumnsMinus1( m_apcSlicePilot->getSPS()->getNumColumnsMinus1() );
     994        m_pcPicVSP->getPicSym()->setNumRowsMinus1( m_apcSlicePilot->getSPS()->getNumRowsMinus1() );
     995        m_pcPicVSP->getPicSym()->xCreateTComTileArray();
     996        for (int i=0;i<m_pcPicVSP->getPicSym()->getNumberOfCUsInFrame();i++)
     997        {
     998          m_pcPicVSP->getPicSym()->getCU(i)->getCUMvField(RefPicList(0))->clearMvField();
     999          m_pcPicVSP->getPicSym()->getCU(i)->getCUMvField(RefPicList(1))->clearMvField();
     1000        }
     1001#if DEPTH_MAP_GENERATION
     1002        UInt uiPdm                  = ( m_viewId ? m_apcSlicePilot->getSPS()->getPredDepthMapGeneration() : m_tAppDecTop->getSPSAccess()->getPdm() );
     1003        Bool bNeedPrdDepthMapBuffer = ( !m_isDepth && uiPdm > 0 );
     1004        if( bNeedPrdDepthMapBuffer )
     1005        {
     1006          m_pcPicVSP->addPrdDepthMapBuffer( PDM_SUB_SAMP_EXP_X(uiPdm), PDM_SUB_SAMP_EXP_Y(uiPdm) );
     1007        }
     1008#endif
     1009      }
     1010      if( m_pcPicAvail == NULL )
     1011      {
     1012        m_pcPicAvail = new TComPic;
     1013        m_pcPicAvail->create( m_apcSlicePilot->getSPS()->getPicWidthInLumaSamples(), m_apcSlicePilot->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
     1014        m_pcPicAvail->setCurrSliceIdx(0);
     1015        m_pcPicAvail->getCurrSlice()->setViewId( 99 );
     1016        m_pcPicAvail->getCurrSlice()->setViewOrderIdx( m_apcSlicePilot->getSPS()->getViewOrderIdx() );
     1017        m_pcPicAvail->getCurrSlice()->setSPS( m_apcSlicePilot->getSPS() );
     1018        m_pcPicAvail->getCurrSlice()->setPPS( m_apcSlicePilot->getPPS() );
     1019        m_pcPicAvail->getCurrSlice()->setPPSId( m_apcSlicePilot->getPPS()->getPPSId() );
     1020        m_pcPicAvail->getPicSym()->setNumColumnsMinus1( m_apcSlicePilot->getSPS()->getNumColumnsMinus1() );
     1021        m_pcPicAvail->getPicSym()->setNumRowsMinus1( m_apcSlicePilot->getSPS()->getNumRowsMinus1() );
     1022        m_pcPicAvail->getPicSym()->xCreateTComTileArray();
     1023        for (int i=0;i<m_pcPicAvail->getPicSym()->getNumberOfCUsInFrame();i++)
     1024        {
     1025          m_pcPicAvail->getPicSym()->getCU(i)->getCUMvField(RefPicList(0))->clearMvField();
     1026          m_pcPicAvail->getPicSym()->getCU(i)->getCUMvField(RefPicList(1))->clearMvField();
     1027        }
     1028#if DEPTH_MAP_GENERATION
     1029        UInt uiPdm                  = ( m_viewId ? m_apcSlicePilot->getSPS()->getPredDepthMapGeneration() : m_tAppDecTop->getSPSAccess()->getPdm() );
     1030        Bool bNeedPrdDepthMapBuffer = ( !m_isDepth && uiPdm > 0 );
     1031        if( bNeedPrdDepthMapBuffer )
     1032        {
     1033          m_pcPicAvail->addPrdDepthMapBuffer( PDM_SUB_SAMP_EXP_X(uiPdm), PDM_SUB_SAMP_EXP_Y(uiPdm) );
     1034        }
     1035#endif
     1036      }
     1037    }
     1038#endif
    7341039
    7351040#if SONY_COLPIC_AVAILABILITY
     
    7591064    m_cResidualGenerator.create( true, m_apcSlicePilot->getSPS()->getPicWidthInLumaSamples(), m_apcSlicePilot->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUDepth, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiBitDepth + g_uiBitIncrement );
    7601065#endif
     1066#if !QC_MULTI_DIS_CAN
     1067#if VSP_N
     1068#if VSP_SLICE_HEADER
     1069    if( m_apcSlicePilot->getVspFlag() )
     1070#endif
     1071    {
     1072      UInt uiPdm                  = ( m_viewId ? m_apcSlicePilot->getSPS()->getPredDepthMapGeneration() : m_tAppDecTop->getSPSAccess()->getPdm() );
     1073      Bool bNeedPrdDepthMapBuffer = ( !m_isDepth && uiPdm > 0 );
     1074      if( bNeedPrdDepthMapBuffer )
     1075      {
     1076        if( m_pcPicVSP && m_pcPicVSP->getPredDepthMap() )
     1077        {
     1078          m_cDepthMapGenerator.clearDepthMap( m_pcPicVSP );
     1079        }
     1080        if( m_pcPicAvail && m_pcPicAvail->getPredDepthMap() )
     1081        {
     1082          m_cDepthMapGenerator.clearDepthMap( m_pcPicAvail );
     1083        }
     1084      }
     1085    }
     1086#endif
     1087#endif
    7611088  }
    7621089
     
    9731300
    9741301    std::vector<TComPic*> apcInterViewRefPics = m_tAppDecTop->getInterViewRefPics( m_viewId, pcSlice->getPOC(), m_isDepth, pcSlice->getSPS() );
     1302#if VSP_N
     1303    Bool bUseVsp = (m_viewId!=0);
     1304#if VSP_TEXT_ONLY
     1305    if( m_isDepth ) bUseVsp = false;
     1306#endif
     1307#if VSP_SLICE_HEADER
     1308    if( !pcSlice->getVspFlag() ) bUseVsp = false;
     1309#endif
     1310
     1311#if VSP_SLICE_HEADER
     1312    if( bUseVsp )
     1313#endif
     1314      m_pcPicVSP->getCurrSlice()->setPOC( pcPic->getPOC() );
     1315
     1316    pcSlice->setRefPicListMvc( m_cListPic, apcInterViewRefPics, bUseVsp ? m_pcPicVSP : NULL );
     1317
     1318#else
    9751319    pcSlice->setRefPicListMvc( m_cListPic, apcInterViewRefPics );
     1320#endif
    9761321
    9771322    // For generalized B
     
    10681413#endif
    10691414
     1415#if VSP_N
     1416  if( m_pcCamParsCollector )
     1417  {
     1418    m_pcCamParsCollector->setSlice( pcSlice );
     1419  }
     1420#if VSP_SLICE_HEADER
     1421  if( pcSlice->getVspFlag() )
     1422#endif
     1423  if( getTAppDecTop()->getUseDepth() )
     1424  {
     1425    getTAppDecTop()->storeVSPInBuffer( m_pcPicVSP, m_pcPicAvail, pcSlice->getViewId(), pcSlice->getSPS()->getViewOrderIdx(), pcSlice->getPOC(), m_isDepth );
     1426  }
     1427#endif
     1428
    10701429  //  Decode a picture
    10711430  m_cGopDecoder.decompressGop(nalu.m_Bitstream, pcPic, false);
     
    11081467#if LCU_SYNTAX_ALF
    11091468  m_cAdaptiveLoopFilter.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
     1469#endif
     1470
     1471#if VSP_N
     1472  if( !sps->isDepth() && sps->getViewId() == 0 && getTAppDecTop()->getVSPRendererTop() )
     1473  {
     1474#if NTT_SUBPEL
     1475    getTAppDecTop()->getVSPRendererTop()->init( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), true, 0, LOG2_DISP_PREC_LUT, true, 0, 0, 0, 0, 0, 6, 5, 1, 0, 6 );
     1476#else
     1477    getTAppDecTop()->getVSPRendererTop()->init( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), true, 0, LOG2_DISP_PREC_LUT, true, 0, 0, 0, 0, 0, 6, 4, 1, 0, 6 );
     1478#endif
     1479  }
    11101480#endif
    11111481}
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibDecoder/TDecTop.h

    r100 r166  
    7777  Bool  isInitialized() const { return m_bInitialized; }
    7878
     79#if VSP_N
     80  Double****          getBaseViewShiftLUTD      ()  { return m_adBaseViewShiftLUT;   }
     81  Int****             getBaseViewShiftLUTI      ()  { return m_aiBaseViewShiftLUT;   }
     82  Int**               getBaseViewOffsetI        ()  { return m_aaiCodedOffset;   }
     83  Int**               getBaseViewScaleI         ()  { return m_aaiCodedScale;   }
     84  Bool                getNearestBaseView        ( Int iSynthViewIdx, Int &riNearestViewIdx, Int &riRelDistToLeft, Bool& rbRenderFromLeft);
     85#if NTT_SUBPEL
     86  Int****             getBaseViewIPelLUT        ()  { return m_aiBaseViewShiftLUT_ipel;   }
     87  Int****             getBaseViewFPosLUT        ()  { return m_aiBaseViewShiftLUT_fpos;   }
     88#endif
     89#endif
     90
    7991private:
    8092  Bool  xIsComplete ();
     
    94106  Int     m_iLastPOC;
    95107  UInt    m_uiMaxViewId;
     108
     109#if VSP_N
     110  UInt    m_uiBitDepthForLUT;
     111  UInt    m_iLog2Precision;
     112  UInt    m_uiInputBitDepth;
     113  // look-up tables
     114  Double****          m_adBaseViewShiftLUT;                    ///< Disparity LUT
     115  Int****             m_aiBaseViewShiftLUT;                    ///< Disparity LUT
     116  Void xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT);
     117  Void xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT);
     118  template<class T> Void  xDeleteArray  ( T*& rpt, UInt uiSize1, UInt uiSize2, UInt uiSize3 );
     119  template<class T> Void  xDeleteArray  ( T*& rpt, UInt uiSize1, UInt uiSize2 );
     120  template<class T> Void  xDeleteArray  ( T*& rpt, UInt uiSize );
     121
     122#if NTT_SUBPEL
     123  Int****             m_aiBaseViewShiftLUT_ipel;              ///< Disparity LUT
     124  Int****             m_aiBaseViewShiftLUT_fpos;              ///< Disparity LUT
     125  Void xCreateLUTs_Subpel ( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Int****& raiLUT0, Int****& raiLUT1 );
     126  Void xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Int****& raiLUT_ipel, Int****& raiLUT_fpos);
     127#endif
     128#endif
    96129};
     130
     131#if VSP_N
     132template <class T>
     133Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize1, UInt uiSize2, UInt uiSize3 )
     134{
     135  if( rpt )
     136  {
     137    for( UInt uiK = 0; uiK < uiSize1; uiK++ )
     138    {
     139      for( UInt uiL = 0; uiL < uiSize2; uiL++ )
     140      {
     141        for( UInt uiM = 0; uiM < uiSize3; uiM++ )
     142        {
     143          delete[] rpt[ uiK ][ uiL ][ uiM ];
     144        }
     145        delete[] rpt[ uiK ][ uiL ];
     146      }
     147      delete[] rpt[ uiK ];
     148    }
     149    delete[] rpt;
     150  }
     151  rpt = NULL;
     152};
     153
     154
     155template <class T>
     156Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize1, UInt uiSize2 )
     157{
     158  if( rpt )
     159  {
     160    for( UInt uiK = 0; uiK < uiSize1; uiK++ )
     161    {
     162      for( UInt uiL = 0; uiL < uiSize2; uiL++ )
     163      {
     164        delete[] rpt[ uiK ][ uiL ];
     165      }
     166      delete[] rpt[ uiK ];
     167    }
     168    delete[] rpt;
     169  }
     170  rpt = NULL;
     171};
     172
     173
     174template <class T>
     175Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize )
     176{
     177  if( rpt )
     178  {
     179    for( UInt uiK = 0; uiK < uiSize; uiK++ )
     180    {
     181      delete[] rpt[ uiK ];
     182    }
     183    delete[] rpt;
     184  }
     185  rpt = NULL;
     186};
     187#endif
    97188
    98189/// decoder class
     
    155246  NalUnitType             m_nalUnitTypeBaseView; 
    156247
     248#if VSP_N
     249  TComPic*                m_pcPicVSP; //view synthesis prediction buffer for current POC to be coded
     250  TComPic*                m_pcPicAvail;
     251#endif
     252
    157253public:
    158254  TDecTop();
     
    195291  TAppDecTop*         getTAppDecTop()                           { return  m_tAppDecTop; }
    196292  NalUnitType         getNalUnitTypeBaseView()                  { return m_nalUnitTypeBaseView; }
     293
     294#if VSP_N
     295  TComPic*            getVSPBuf()                               { return m_pcPicVSP; }
     296#endif
    197297
    198298protected:
Note: See TracChangeset for help on using the changeset viewer.