Changeset 442 in SHVCSoftware for trunk/source/App/TAppDecoder


Ignore:
Timestamp:
21 Oct 2013, 13:41:29 (11 years ago)
Author:
seregin
Message:

reintegrate SHM-3.1-dev branch

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/source

  • trunk/source/App/TAppDecoder/TAppDecTop.cpp

    r313 r442  
    5656TAppDecTop::TAppDecTop()
    5757{
    58   ::memset (m_abDecFlag, 0, sizeof (m_abDecFlag));
    5958  for(UInt layer=0; layer < MAX_LAYERS; layer++)
    6059  {
     
    6766: m_iPOCLastDisplay(-MAX_INT)
    6867{
    69   ::memset (m_abDecFlag, 0, sizeof (m_abDecFlag));
    7068}
    7169#endif
     
    146144
    147145  // main decoder loop
    148   Bool recon_opened[MAX_LAYERS]; // reconstruction file not yet opened. (must be performed after SPS is seen)
     146  Bool openedReconFile[MAX_LAYERS]; // reconstruction file not yet opened. (must be performed after SPS is seen)
    149147  for(UInt layer=0; layer<=m_tgtLayerId; layer++)
    150148  {
    151     recon_opened[layer] = false;
     149    openedReconFile[layer] = false;
    152150    m_aiPOCLastDisplay[layer] += m_iSkipFrame;      // set the last displayed POC correctly for skip forward.
    153151  }
     
    228226    {
    229227      m_acTDecTop[curLayerId].executeLoopFilters(poc, pcListPic);
     228#if EARLY_REF_PIC_MARKING
     229      m_acTDecTop[curLayerId].earlyPicMarking(m_iMaxTemporalLayer, m_targetDecLayerIdSet);
     230#endif
    230231    }
    231232
    232233    if( pcListPic )
    233234    {
    234       if ( m_pchReconFile[curLayerId] && !recon_opened[curLayerId] )
     235      if ( m_pchReconFile[curLayerId] && !openedReconFile[curLayerId] )
    235236      {
    236237        if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; }       
     
    239240        m_acTVideoIOYuvReconFile[curLayerId].open( m_pchReconFile[curLayerId], true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode
    240241
    241         recon_opened[curLayerId] = true;
     242        openedReconFile[curLayerId] = true;
    242243      }
    243244      if ( bNewPicture && bNewPOC &&
     
    263264  // delete buffers
    264265#if AVC_BASE
     266  UInt layerIdmin = m_acTDecTop[0].getBLReconFile()->is_open() ? 1 : 0;
     267
    265268  if( streamYUV.is_open() )
    266269  {
     
    273276  }
    274277#endif
    275   pcBLPic.destroy();
    276 
    277   for(UInt layer = 1; layer <= m_tgtLayerId; layer++)
     278  pcBLPic.destroy(); 
     279
     280  for(UInt layer = layerIdmin; layer <= m_tgtLayerId; layer++)
    278281#else
    279282  for(UInt layer = 0; layer <= m_tgtLayerId; layer++)
     
    307310
    308311  // main decoder loop
    309   Bool recon_opened = false; // reconstruction file not yet opened. (must be performed after SPS is seen)
     312  Bool openedReconFile = false; // reconstruction file not yet opened. (must be performed after SPS is seen)
    310313
    311314#if SYNTAX_OUTPUT
     
    338341    streampos location = bitstreamFile.tellg();
    339342    AnnexBStats stats = AnnexBStats();
    340     Bool bPreviousPictureDecoded = false;
    341343
    342344    vector<uint8_t> nalUnit;
     
    360362      if( (m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) || !isNaluWithinTargetDecLayerIdSet(&nalu)  )
    361363      {
    362         if(bPreviousPictureDecoded)
    363         {
    364           bNewPicture = true;
    365           bPreviousPictureDecoded = false;
    366         }
    367         else
    368         {
    369364          bNewPicture = false;
    370365        }
    371       }
    372366      else
    373367      {
     
    383377          bytestream.reset();
    384378        }
    385         bPreviousPictureDecoded = true;
    386379      }
    387380    }
     
    393386    if( pcListPic )
    394387    {
    395       if ( m_pchReconFile && !recon_opened )
     388      if ( m_pchReconFile && !openedReconFile )
    396389      {
    397390        if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; }
     
    399392
    400393        m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode
    401         recon_opened = true;
     394        openedReconFile = true;
    402395      }
    403396      if ( bNewPicture &&
     
    470463    if ( m_pchReconFile[layer] )
    471464    {
    472       m_acTVideoIOYuvReconFile[layer]. close();
     465      m_acTVideoIOYuvReconFile[layer].close();
    473466    }
    474467
     
    505498
    506499/** \param pcListPic list of pictures to be written to file
    507     \todo            DYN_REF_FREE should be revised
    508  */
     500\todo            DYN_REF_FREE should be revised
     501*/
    509502#if SVC_EXTENSION
    510503Void TAppDecTop::xWriteOutput( TComList<TComPic*>* pcListPic, UInt layerId, UInt tId )
     
    514507{
    515508  TComList<TComPic*>::iterator iterPic   = pcListPic->begin();
    516   Int not_displayed = 0;
     509  Int numPicsNotYetDisplayed = 0;
    517510
    518511  while (iterPic != pcListPic->end())
     
    525518#endif
    526519    {
    527        not_displayed++;
     520      numPicsNotYetDisplayed++;
    528521    }
    529522    iterPic++;
    530523  }
    531524  iterPic   = pcListPic->begin();
    532  
    533   while (iterPic != pcListPic->end())
    534   {
    535     TComPic* pcPic = *(iterPic);
    536    
    537 #if SVC_EXTENSION
    538     if ( pcPic->getOutputMark() && (not_displayed >  pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_aiPOCLastDisplay[layerId]))
    539 #else
    540     if ( pcPic->getOutputMark() && (not_displayed >  pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_iPOCLastDisplay))
    541 #endif
    542     {
    543       // write to file
    544        not_displayed--;
    545 #if SVC_EXTENSION
    546       if ( m_pchReconFile[layerId] )
    547       {
    548         const Window &conf = pcPic->getConformanceWindow();
    549         const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    550         m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(),
    551                                        conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    552                                        conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    553                                        conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    554                                        conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
    555       }
    556      
    557       // update POC of display order
    558       m_aiPOCLastDisplay[layerId] = pcPic->getPOC();
    559 #else
    560       if ( m_pchReconFile )
    561       {
    562 #if SYNTAX_OUTPUT && ILP_DECODED_PICTURE
    563         m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec() );
    564 #else
    565         const Window &conf = pcPic->getConformanceWindow();
    566         const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    567         m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
    568                                        conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    569                                        conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    570                                        conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    571                                        conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
    572 #endif
    573       }
    574      
    575       // update POC of display order
    576       m_iPOCLastDisplay = pcPic->getPOC();
    577 #endif
    578      
    579       // erase non-referenced picture in the reference picture list after display
    580       if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true )
    581       {
     525  if (numPicsNotYetDisplayed>2)
     526  {
     527    iterPic++;
     528  }
     529
     530  TComPic* pcPic = *(iterPic);
     531  if (numPicsNotYetDisplayed>2 && pcPic->isField()) //Field Decoding
     532  {
     533    TComList<TComPic*>::iterator endPic   = pcListPic->end();
     534    endPic--;
     535    iterPic   = pcListPic->begin();
     536    while (iterPic != endPic)
     537    {
     538      TComPic* pcPicTop = *(iterPic);
     539      iterPic++;
     540      TComPic* pcPicBottom = *(iterPic);
     541
     542#if SVC_EXTENSION
     543      if ( pcPicTop->getOutputMark() && (numPicsNotYetDisplayed >  pcPicTop->getNumReorderPics(tId) && !(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1)
     544        && pcPicBottom->getOutputMark() && (numPicsNotYetDisplayed >  pcPicBottom->getNumReorderPics(tId) && (pcPicTop->getPOC() == m_aiPOCLastDisplay[layerId]+1 || m_aiPOCLastDisplay[layerId]<0)))
     545#else
     546      if ( pcPicTop->getOutputMark() && (numPicsNotYetDisplayed >  pcPicTop->getNumReorderPics(tId) && !(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1)
     547        && pcPicBottom->getOutputMark() && (numPicsNotYetDisplayed >  pcPicBottom->getNumReorderPics(tId) && (pcPicTop->getPOC() == m_iPOCLastDisplay+1 || m_iPOCLastDisplay<0)))
     548#endif
     549      {
     550        // write to file
     551        numPicsNotYetDisplayed = numPicsNotYetDisplayed-2;
     552#if SVC_EXTENSION
     553        if ( m_pchReconFile[layerId] )
     554        {
     555          const Window &conf = pcPicTop->getConformanceWindow();
     556          const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
     557          const Bool isTff = pcPicTop->isTopField();
     558#if REPN_FORMAT_IN_VPS
     559          UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
     560          Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
     561          m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     562            conf.getWindowLeftOffset()  * xScal + defDisp.getWindowLeftOffset(),
     563            conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(),
     564            conf.getWindowTopOffset()   * yScal + defDisp.getWindowTopOffset(),
     565            conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset(), isTff );
     566
     567#else
     568          m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     569            conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     570            conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     571            conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     572            conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );
     573#endif
     574        }
     575
     576        // update POC of display order
     577        m_aiPOCLastDisplay[layerId] = pcPicBottom->getPOC();
     578#else
     579        if ( m_pchReconFile )
     580        {
     581          const Window &conf = pcPicTop->getConformanceWindow();
     582          const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
     583          const Bool isTff = pcPicTop->isTopField();
     584          m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     585            conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     586            conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     587            conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     588            conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );
     589        }
     590
     591        // update POC of display order
     592        m_iPOCLastDisplay = pcPicBottom->getPOC();
     593#endif
     594
     595        // erase non-referenced picture in the reference picture list after display
     596        if ( !pcPicTop->getSlice(0)->isReferenced() && pcPicTop->getReconMark() == true )
     597        {
    582598#if !DYN_REF_FREE
    583         pcPic->setReconMark(false);
    584        
    585         // mark it should be extended later
    586         pcPic->getPicYuvRec()->setBorderExtension( false );
    587        
    588 #else
    589         pcPic->destroy();
    590         pcListPic->erase( iterPic );
    591         iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
    592         continue;
    593 #endif
    594       }
    595       pcPic->setOutputMark(false);
    596     }
    597    
    598     iterPic++;
     599          pcPicTop->setReconMark(false);
     600
     601          // mark it should be extended later
     602          pcPicTop->getPicYuvRec()->setBorderExtension( false );
     603
     604#else
     605          pcPicTop->destroy();
     606          pcListPic->erase( iterPic );
     607          iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
     608          continue;
     609#endif
     610        }
     611        if ( !pcPicBottom->getSlice(0)->isReferenced() && pcPicBottom->getReconMark() == true )
     612        {
     613#if !DYN_REF_FREE
     614          pcPicBottom->setReconMark(false);
     615
     616          // mark it should be extended later
     617          pcPicBottom->getPicYuvRec()->setBorderExtension( false );
     618
     619#else
     620          pcPicBottom->destroy();
     621          pcListPic->erase( iterPic );
     622          iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
     623          continue;
     624#endif
     625        }
     626        pcPicTop->setOutputMark(false);
     627        pcPicBottom->setOutputMark(false);
     628      }
     629    }
     630  }
     631  else if (!pcPic->isField()) //Frame Decoding
     632  {
     633    iterPic = pcListPic->begin();
     634    while (iterPic != pcListPic->end())
     635    {
     636      pcPic = *(iterPic);
     637
     638#if SVC_EXTENSION
     639      if ( pcPic->getOutputMark() && (numPicsNotYetDisplayed >  pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_aiPOCLastDisplay[layerId]))
     640#else
     641      if ( pcPic->getOutputMark() && (numPicsNotYetDisplayed >  pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_iPOCLastDisplay))
     642#endif
     643      {
     644        // write to file
     645        numPicsNotYetDisplayed--;
     646#if SVC_EXTENSION
     647        if ( m_pchReconFile[layerId] )
     648        {
     649          const Window &conf = pcPic->getConformanceWindow();
     650          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
     651#if REPN_FORMAT_IN_VPS
     652          UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
     653          Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
     654          m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(),
     655            conf.getWindowLeftOffset()  * xScal + defDisp.getWindowLeftOffset(),
     656            conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(),
     657            conf.getWindowTopOffset()   * yScal + defDisp.getWindowTopOffset(),
     658            conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset() );
     659
     660#else
     661          m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(),
     662            conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     663            conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     664            conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     665            conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
     666#endif
     667        }
     668
     669        // update POC of display order
     670        m_aiPOCLastDisplay[layerId] = pcPic->getPOC();
     671#else
     672        if ( m_pchReconFile )
     673        {
     674#if SYNTAX_OUTPUT
     675          const Window &conf = pcPic->getConformanceWindow();
     676          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
     677          m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
     678            conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     679            conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     680            conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     681            conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
     682#endif
     683        }
     684
     685        // update POC of display order
     686        m_iPOCLastDisplay = pcPic->getPOC();
     687#endif
     688
     689        // erase non-referenced picture in the reference picture list after display
     690        if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true )
     691        {
     692#if !DYN_REF_FREE
     693          pcPic->setReconMark(false);
     694
     695          // mark it should be extended later
     696          pcPic->getPicYuvRec()->setBorderExtension( false );
     697
     698#else
     699          pcPic->destroy();
     700          pcListPic->erase( iterPic );
     701          iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
     702          continue;
     703#endif
     704        }
     705        pcPic->setOutputMark(false);
     706      }
     707
     708      iterPic++;
     709    }
    599710  }
    600711}
     
    616727
    617728  iterPic   = pcListPic->begin();
    618  
    619   while (iterPic != pcListPic->end())
    620   {
    621     TComPic* pcPic = *(iterPic);
    622 
    623     if ( pcPic->getOutputMark() )
    624     {
    625       // write to file
    626 #if SVC_EXTENSION
    627       if ( m_pchReconFile[layerId] )
    628       {
    629         const Window &conf = pcPic->getConformanceWindow();
    630         const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    631         m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(),
    632                                        conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    633                                        conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    634                                        conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    635                                        conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
    636       }
    637      
    638       // update POC of display order
    639       m_aiPOCLastDisplay[layerId] = pcPic->getPOC();
    640 #else
    641       if ( m_pchReconFile )
    642       {
    643         const Window &conf = pcPic->getConformanceWindow();
    644         const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    645         m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
    646                                        conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    647                                        conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    648                                        conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    649                                        conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
    650       }
    651      
    652       // update POC of display order
    653       m_iPOCLastDisplay = pcPic->getPOC();
    654 #endif
    655      
    656       // erase non-referenced picture in the reference picture list after display
    657       if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true )
    658       {
     729  TComPic* pcPic = *(iterPic);
     730
     731  if (pcPic->isField()) //Field Decoding
     732  {
     733    TComList<TComPic*>::iterator endPic   = pcListPic->end();
     734    endPic--;
     735    TComPic *pcPicTop, *pcPicBottom = NULL;
     736    while (iterPic != endPic)
     737    {
     738      pcPicTop = *(iterPic);
     739      iterPic++;
     740      pcPicBottom = *(iterPic);
     741
     742      if ( pcPicTop->getOutputMark() && pcPicBottom->getOutputMark() && !(pcPicTop->getPOC()%2) && (pcPicBottom->getPOC() == pcPicTop->getPOC()+1) )
     743      {
     744        // write to file
     745#if SVC_EXTENSION
     746        if ( m_pchReconFile[layerId] )
     747        {
     748          const Window &conf = pcPicTop->getConformanceWindow();
     749          const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
     750          const Bool isTff = pcPicTop->isTopField();
     751#if REPN_FORMAT_IN_VPS
     752          UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
     753          Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
     754          m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     755            conf.getWindowLeftOffset()  *xScal + defDisp.getWindowLeftOffset(),
     756            conf.getWindowRightOffset() *xScal + defDisp.getWindowRightOffset(),
     757            conf.getWindowTopOffset()   *yScal + defDisp.getWindowTopOffset(),
     758            conf.getWindowBottomOffset()*yScal + defDisp.getWindowBottomOffset(), isTff );
     759
     760#else
     761          m_cTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     762            conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     763            conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     764            conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     765            conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );
     766#endif
     767        }
     768
     769        // update POC of display order
     770        m_aiPOCLastDisplay[layerId] = pcPicBottom->getPOC();
     771#else
     772        if ( m_pchReconFile )
     773        {
     774          const Window &conf = pcPicTop->getConformanceWindow();
     775          const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
     776          const Bool isTff = pcPicTop->isTopField();
     777          m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     778            conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     779            conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     780            conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     781            conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );
     782        }
     783
     784        // update POC of display order
     785        m_iPOCLastDisplay = pcPicBottom->getPOC();
     786#endif
     787
     788        // erase non-referenced picture in the reference picture list after display
     789        if ( !pcPicTop->getSlice(0)->isReferenced() && pcPicTop->getReconMark() == true )
     790        {
    659791#if !DYN_REF_FREE
    660         pcPic->setReconMark(false);
    661        
    662         // mark it should be extended later
    663         pcPic->getPicYuvRec()->setBorderExtension( false );
    664        
    665 #else
    666         pcPic->destroy();
    667         pcListPic->erase( iterPic );
    668         iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
    669         continue;
    670 #endif
    671       }
    672       pcPic->setOutputMark(false);
    673     }
     792          pcPicTop->setReconMark(false);
     793
     794          // mark it should be extended later
     795          pcPicTop->getPicYuvRec()->setBorderExtension( false );
     796
     797#else
     798          pcPicTop->destroy();
     799          pcListPic->erase( iterPic );
     800          iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
     801          continue;
     802#endif
     803        }
     804        if ( !pcPicBottom->getSlice(0)->isReferenced() && pcPicBottom->getReconMark() == true )
     805        {
     806#if !DYN_REF_FREE
     807          pcPicBottom->setReconMark(false);
     808
     809          // mark it should be extended later
     810          pcPicBottom->getPicYuvRec()->setBorderExtension( false );
     811
     812#else
     813          pcPicBottom->destroy();
     814          pcListPic->erase( iterPic );
     815          iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
     816          continue;
     817#endif
     818        }
     819        pcPicTop->setOutputMark(false);
     820        pcPicBottom->setOutputMark(false);
     821
     822#if !DYN_REF_FREE
     823        if(pcPicTop)
     824        {
     825          pcPicTop->destroy();
     826          delete pcPicTop;
     827          pcPicTop = NULL;
     828        }
     829#endif
     830      }
     831    }
     832    if(pcPicBottom)
     833    {
     834      pcPicBottom->destroy();
     835      delete pcPicBottom;
     836      pcPicBottom = NULL;
     837    }
     838  }
     839  else //Frame decoding
     840  {
     841    while (iterPic != pcListPic->end())
     842    {
     843      pcPic = *(iterPic);
     844
     845      if ( pcPic->getOutputMark() )
     846      {
     847        // write to file
     848#if SVC_EXTENSION
     849        if ( m_pchReconFile[layerId] )
     850        {
     851          const Window &conf = pcPic->getConformanceWindow();
     852          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
     853#if REPN_FORMAT_IN_VPS
     854          UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
     855          Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
     856          m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(),
     857            conf.getWindowLeftOffset()  *xScal + defDisp.getWindowLeftOffset(),
     858            conf.getWindowRightOffset() *xScal + defDisp.getWindowRightOffset(),
     859            conf.getWindowTopOffset()   *yScal + defDisp.getWindowTopOffset(),
     860            conf.getWindowBottomOffset()*yScal + defDisp.getWindowBottomOffset() );
     861
     862#else
     863          m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(),
     864            conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     865            conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     866            conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     867            conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
     868#endif
     869        }
     870
     871        // update POC of display order
     872        m_aiPOCLastDisplay[layerId] = pcPic->getPOC();
     873#else
     874        if ( m_pchReconFile )
     875        {
     876          const Window &conf = pcPic->getConformanceWindow();
     877          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
     878          m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
     879            conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     880            conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     881            conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     882            conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
     883        }
     884
     885        // update POC of display order
     886        m_iPOCLastDisplay = pcPic->getPOC();
     887#endif
     888
     889        // erase non-referenced picture in the reference picture list after display
     890        if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true )
     891        {
     892#if !DYN_REF_FREE
     893          pcPic->setReconMark(false);
     894
     895          // mark it should be extended later
     896          pcPic->getPicYuvRec()->setBorderExtension( false );
     897
     898#else
     899          pcPic->destroy();
     900          pcListPic->erase( iterPic );
     901          iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
     902          continue;
     903#endif
     904        }
     905        pcPic->setOutputMark(false);
     906      }
    674907#if !SVC_EXTENSION
    675908#if !DYN_REF_FREE
    676     if(pcPic)
    677     {
    678       pcPic->destroy();
    679       delete pcPic;
    680       pcPic = NULL;
    681     }
     909      if(pcPic)
     910      {
     911        pcPic->destroy();
     912        delete pcPic;
     913        pcPic = NULL;
     914      }
    682915#endif   
    683916#endif
    684     iterPic++;
     917      iterPic++;
     918    }
    685919  }
    686920#if SVC_EXTENSION
  • trunk/source/App/TAppDecoder/TAppDecTop.h

    r313 r442  
    7070#endif
    7171 
    72   // for output control
    73   Bool                            m_abDecFlag[ MAX_GOP ];         ///< decoded flag in one GOP
     72  // for output control 
    7473#if SVC_EXTENSION
    7574  Int                             m_aiPOCLastDisplay [MAX_LAYERS]; ///< last POC in display order
Note: See TracChangeset for help on using the changeset viewer.