Changeset 41 in 3DVCSoftware for branches/0.3-poznan-univ/source/App/TAppDecoder


Ignore:
Timestamp:
26 Mar 2012, 09:03:21 (13 years ago)
Author:
poznan-univ
Message:

Adjustment for FlexCO, and high-level syntax improvement.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/0.3-poznan-univ/source/App/TAppDecoder/TAppDecTop.cpp

    r30 r41  
    138138  NalUnitType eNalUnitType;
    139139
     140#if FLEX_CODING_ORDER
     141  Int iDepthViewIdx = 0;
     142  Bool bCountDepthViewIdx = false;              // a flag which avoid repeating assign a value to iDepthViewIdx   
     143  Bool bNewPictureType =true;
     144  Bool bFirstDepth = false;
     145#endif
    140146 
    141147  while ( !bEos )
     
    148154      if( bIsDepth )
    149155      {
     156#if FLEX_CODING_ORDER
     157        if (!bFirstSliceDecoded) m_acTDecDepthTopList[iDepthViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iDepthViewIdx] ,bNewPictureType);
     158        m_acTDecDepthTopList[iDepthViewIdx]->executeDeblockAndAlf( bEos, pcBitstream, uiPOC, pcListPic, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iDepthViewIdx]);
     159#else
    150160        if (!bFirstSliceDecoded) m_acTDecDepthTopList[iViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iViewIdx] );
    151161        m_acTDecDepthTopList[iViewIdx]->executeDeblockAndAlf( bEos, pcBitstream, uiPOC, pcListPic, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iViewIdx]);
     162#endif
    152163      }
    153164      else
    154165      {
     166#if FLEX_CODING_ORDER
     167        if (!bFirstSliceDecoded) m_acTDecTopList[iViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiPOCLastDisplayList[iViewIdx], bNewPictureType);
     168#else
    155169        if (!bFirstSliceDecoded) m_acTDecTopList[iViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiPOCLastDisplayList[iViewIdx] );
     170#endif
    156171        m_acTDecTopList[iViewIdx]->executeDeblockAndAlf( bEos, pcBitstream, uiPOC, pcListPic, m_iSkipFrame, m_aiPOCLastDisplayList[iViewIdx]);
    157172      }
     
    168183    Bool bNewPicture;
    169184    if( bIsDepth )
     185#if FLEX_CODING_ORDER
     186      bNewPicture = m_acTDecDepthTopList[iDepthViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iDepthViewIdx], bNewPictureType);
     187#else
    170188      bNewPicture = m_acTDecDepthTopList[iViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iViewIdx] );
     189#endif
    171190    else
     191#if FLEX_CODING_ORDER
     192      bNewPicture = m_acTDecTopList[iViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiPOCLastDisplayList[iViewIdx], bNewPictureType );
     193#else
    172194      bNewPicture = m_acTDecTopList[iViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiPOCLastDisplayList[iViewIdx] );
     195#endif
    173196    bFirstSliceDecoded   = true;
     197
     198#if FLEX_CODING_ORDER
     199    if (eNalUnitType == NAL_UNIT_SPS)
     200    {
     201#if POZNAN_SYNTH
     202      if(cComSPS.getViewId()==0 && !cComSPS.isDepth()) // it should be called at first view at the begining of the stream
     203        initRenderer(cComSPS);
     204#endif
     205      if( cComSPS.isDepth() && (m_bUsingDepth==false) )  // expected not using depth, but bitstream are using depth
     206      {                                                     // know from sps
     207        assert( cComSPS.getViewId() == 0 && iDepthViewIdx == 0 && !bIsDepth );
     208        startUsingDepth() ;
     209      }
     210      if (cComSPS.isDepth())
     211      {
     212        if (cComSPS.getViewId() >= m_acTVideoIOYuvDepthReconFileList.size())
     213        {
     214          assert( cComSPS.getViewId() == m_acTVideoIOYuvReconFileList.size() );
     215          increaseNumberOfViews(cComSPS.getViewId()+1);
     216        }
     217                       
     218        m_acTDecDepthTopList[cComSPS.getViewId()]->setSPS(cComSPS);
     219      }
     220      else
     221      {
     222        if (cComSPS.getViewId() >= m_acTVideoIOYuvReconFileList.size())
     223        {
     224          assert( cComSPS.getViewId() == m_acTVideoIOYuvReconFileList.size() );
     225          increaseNumberOfViews(cComSPS.getViewId()+1);
     226        }
     227        m_acTDecTopList[cComSPS.getViewId()]->setSPS(cComSPS);
     228      }
     229      bEos = m_cTVideoIOBitstreamFile.readBits( pcBitstream );
     230      assert( !bEos);
     231      if( cComSPS.isDepth() )
     232        m_acTDecDepthTopList[cComSPS.getViewId()]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiDepthPOCLastDisplayList[cComSPS.getViewId()], bNewPictureType); // decode PPS
     233      else
     234        m_acTDecTopList[cComSPS.getViewId()]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiPOCLastDisplayList[cComSPS.getViewId()], bNewPictureType); // decode PPS
     235      assert( eNalUnitType == NAL_UNIT_PPS );
     236    }
     237#else
    174238
    175239    if( eNalUnitType == NAL_UNIT_SPS )
     
    204268      assert( eNalUnitType == NAL_UNIT_PPS );
    205269    }
     270#endif
    206271    assert( eNalUnitType != NAL_UNIT_SEI ); // not yet supported for MVC
    207272    if (bNewPicture)
    208273    {
    209274      if( bIsDepth )
     275#if FLEX_CODING_ORDER
     276        m_acTDecDepthTopList[iDepthViewIdx]->executeDeblockAndAlf( bEos, pcBitstream, uiPOC, pcListPic, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iDepthViewIdx]);
     277#else
    210278        m_acTDecDepthTopList[iViewIdx]->executeDeblockAndAlf( bEos, pcBitstream, uiPOC, pcListPic, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iViewIdx]);
     279#endif
    211280      else
    212281        m_acTDecTopList[iViewIdx]->executeDeblockAndAlf( bEos, pcBitstream, uiPOC, pcListPic, m_iSkipFrame, m_aiPOCLastDisplayList[iViewIdx]);
     
    214283      m_cTVideoIOBitstreamFile.setFileLocation( lLocation );
    215284      bFirstSliceDecoded = false;
    216 
    217       if( m_bUsingDepth && !bIsDepth )
    218       {
    219         bIsDepth = true;
     285#if FLEX_CODING_ORDER
     286      if (m_bUsingDepth)
     287      {
     288        bIsDepth = bNewPictureType;       
     289
     290      }
     291      if (bCountDepthViewIdx == false )
     292      {
     293        bCountDepthViewIdx = true;
     294        if (bIsDepth == true)
     295        {
     296          bFirstDepth = true;
     297          bCountDepthViewIdx = true;
     298        }
     299        if (!bFirstDepth && !bIsDepth)
     300        {
     301          iViewIdx++;
     302          bCountDepthViewIdx = false;
     303        }
     304
    220305      }
    221306      else
    222307      {
    223         bIsDepth = false;
    224         if( iViewIdx<m_acTDecTopList.size()-1)
    225         {
    226           iViewIdx++ ;
     308        if (bIsDepth)
     309        {
     310          iDepthViewIdx++;
    227311        }
    228312        else
    229313        {
     314          iViewIdx ++;
     315        }
     316
     317        if (iViewIdx >= m_acTDecTopList.size() || iDepthViewIdx >= m_acTDecDepthTopList.size())
     318        {
     319          bFirstDepth = false;
    230320          iViewIdx = 0;
    231 
     321          iDepthViewIdx = 0;
     322          bCountDepthViewIdx = false;
    232323          // end of access unit: delete extra pic buffers
    233324          Int iNumViews = (Int)m_acTVideoIOYuvReconFileList.size();
     
    260351        }
    261352      }
     353         
     354#else
     355
     356      if( m_bUsingDepth && !bIsDepth )
     357      {
     358        bIsDepth = true;
     359      }
     360      else
     361      {
     362        bIsDepth = false;
     363        if( iViewIdx<m_acTDecTopList.size()-1)
     364        {
     365          iViewIdx++ ;
     366        }
     367        else
     368        {
     369          iViewIdx = 0;
     370
     371          // end of access unit: delete extra pic buffers
     372          Int iNumViews = (Int)m_acTVideoIOYuvReconFileList.size();
     373          for( Int iVId = 0; iVId < iNumViews; iVId++ )
     374          {
     375            if( iVId < (Int)m_acTDecTopList.size() &&  m_acTDecTopList[iVId] )
     376            {
     377              m_acTDecTopList[iVId]->deleteExtraPicBuffers( (Int)uiPOC );
     378            }
     379            if( iVId < (Int)m_acTDecDepthTopList.size() && m_acTDecDepthTopList[iVId] )
     380            {
     381              m_acTDecDepthTopList[iVId]->deleteExtraPicBuffers( (Int)uiPOC );
     382            }
     383          }
     384
     385#if AMVP_BUFFERCOMPRESS
     386          // compress motion for entire access unit
     387          for( Int iVId = 0; iVId < iNumViews; iVId++ )
     388          {
     389            if( iVId < (Int)m_acTDecTopList.size() &&  m_acTDecTopList[iVId] )
     390            {
     391              m_acTDecTopList[iVId]->compressMotion( (Int)uiPOC );
     392            }
     393            if( iVId < (Int)m_acTDecDepthTopList.size() && m_acTDecDepthTopList[iVId] )
     394            {
     395              m_acTDecDepthTopList[iVId]->compressMotion( (Int)uiPOC );
     396            }
     397          }
     398#endif
     399        }
     400      }
     401#endif
    262402    }
    263403#else
     
    434574#if POZNAN_NONLINEAR_DEPTH
    435575          TComSPS* pcSPS = pcPic->getSlice(0)->getSPS();
    436           TComPicYuv cPicPower;
    437 
    438           //pcPic->getPicYuvRec()
    439           cPicPower.create(pcSPS->getWidth(), pcSPS->getHeight(), pcSPS->getMaxCUWidth(), pcSPS->getMaxCUHeight(), pcSPS->getMaxCUDepth() );
    440 
    441           pcPic->getPicYuvRec()->nonlinearDepthBackward(&cPicPower, pcSPS->getDepthPower());
    442 
    443           m_acTVideoIOYuvDepthReconFileList[iViewIdx]->write(&cPicPower, pcSPS->getPad());
    444           cPicPower.destroy();           
    445 #else
     576          if( pcSPS->getUseNonlinearDepth() )
     577          {
     578            TComPicYuv cPicNonlinearDepth;
     579
     580            //pcPic->getPicYuvRec()
     581            cPicNonlinearDepth.create(pcSPS->getWidth(), pcSPS->getHeight(), pcSPS->getMaxCUWidth(), pcSPS->getMaxCUHeight(), pcSPS->getMaxCUDepth() );
     582
     583            pcPic->getPicYuvRec()->nonlinearDepthBackward(&cPicNonlinearDepth, pcSPS->getNonlinearDepthModel());
     584
     585            m_acTVideoIOYuvDepthReconFileList[iViewIdx]->write(&cPicNonlinearDepth, pcSPS->getPad());
     586            cPicNonlinearDepth.destroy();                 
     587          }
     588          else
     589#endif
    446590          m_acTVideoIOYuvDepthReconFileList[iViewIdx]->write( pcPic->getPicYuvRec(), pcPic->getSlice(0)->getSPS()->getPad() );
    447 #endif
    448591        }
    449592
     
    536679      m_acTDecDepthTopList.back()->create() ;
    537680      m_acTDecDepthTopList.back()->init( this, false );
     681#if FLEX_CODING_ORDER
     682      Int iNumofgen = (Int)m_acTDecDepthTopList.size();
     683      m_acTDecDepthTopList.back()->setViewIdx(iNumofgen-1); //Oweczka ??
     684#else
    538685      m_acTDecDepthTopList.back()->setViewIdx((Int)m_acTDecTopList.size()-1);
     686#endif
    539687      m_acTDecDepthTopList.back()->setPictureDigestEnabled(m_pictureDigestEnabled);
    540688      m_acTDecDepthTopList.back()->setToDepth( true );
     
    560708TComPic* TAppDecTop::getPicFromView( Int iViewIdx, Int iPoc, bool bIsDepth )
    561709{
     710#if FLEX_CODING_ORDER //Owieczka ?? flaga Jakuba
     711  if( bIsDepth && ((Int)(m_acTDecDepthTopList.size() - 1) < iViewIdx))
     712  {
     713    return NULL;
     714  }
     715  if(!bIsDepth && ((Int)(     m_acTDecTopList.size() - 1) < iViewIdx))
     716  {
     717    return NULL;
     718  }
     719#endif
    562720  TComList<TComPic*>* apcListPic = (bIsDepth ? m_acTDecDepthTopList[iViewIdx] : m_acTDecTopList[iViewIdx])->getListPic();
    563721  TComPic* pcRefPic = NULL;
Note: See TracChangeset for help on using the changeset viewer.