Ignore:
Timestamp:
11 Oct 2013, 05:54:02 (11 years ago)
Author:
seregin
Message:

initial porting of HM12

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-3.1-dev/source/App/TAppDecoder/TAppDecTop.cpp

    r389 r431  
    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  }
     
    235233    if( pcListPic )
    236234    {
    237       if ( m_pchReconFile[curLayerId] && !recon_opened[curLayerId] )
     235      if ( m_pchReconFile[curLayerId] && !openedReconFile[curLayerId] )
    238236      {
    239237        if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; }       
     
    242240        m_acTVideoIOYuvReconFile[curLayerId].open( m_pchReconFile[curLayerId], true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode
    243241
    244         recon_opened[curLayerId] = true;
     242        openedReconFile[curLayerId] = true;
    245243      }
    246244      if ( bNewPicture && bNewPOC &&
     
    278276  pcBLPic.destroy();
    279277
    280   for(UInt layer = 1; layer <= m_tgtLayerId; layer++)
     278  UInt layerIdmin = m_acTDecTop[0].getBLReconFile() == NULL ? 0 : 1;
     279
     280  for(UInt layer = layerIdmin; layer <= m_tgtLayerId; layer++)
    281281#else
    282282  for(UInt layer = 0; layer <= m_tgtLayerId; layer++)
     
    310310
    311311  // main decoder loop
    312   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)
    313313
    314314#if SYNTAX_OUTPUT
     
    341341    streampos location = bitstreamFile.tellg();
    342342    AnnexBStats stats = AnnexBStats();
    343     Bool bPreviousPictureDecoded = false;
    344343
    345344    vector<uint8_t> nalUnit;
     
    363362      if( (m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) || !isNaluWithinTargetDecLayerIdSet(&nalu)  )
    364363      {
    365         if(bPreviousPictureDecoded)
    366         {
    367           bNewPicture = true;
    368           bPreviousPictureDecoded = false;
    369         }
    370         else
    371         {
    372364          bNewPicture = false;
    373365        }
    374       }
    375366      else
    376367      {
     
    386377          bytestream.reset();
    387378        }
    388         bPreviousPictureDecoded = true;
    389379      }
    390380    }
     
    396386    if( pcListPic )
    397387    {
    398       if ( m_pchReconFile && !recon_opened )
     388      if ( m_pchReconFile && !openedReconFile )
    399389      {
    400390        if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; }
     
    402392
    403393        m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode
    404         recon_opened = true;
     394        openedReconFile = true;
    405395      }
    406396      if ( bNewPicture &&
     
    508498
    509499/** \param pcListPic list of pictures to be written to file
    510     \todo            DYN_REF_FREE should be revised
    511  */
     500\todo            DYN_REF_FREE should be revised
     501*/
    512502#if SVC_EXTENSION
    513503Void TAppDecTop::xWriteOutput( TComList<TComPic*>* pcListPic, UInt layerId, UInt tId )
     
    517507{
    518508  TComList<TComPic*>::iterator iterPic   = pcListPic->begin();
    519   Int not_displayed = 0;
     509  Int numPicsNotYetDisplayed = 0;
    520510
    521511  while (iterPic != pcListPic->end())
     
    528518#endif
    529519    {
    530        not_displayed++;
     520      numPicsNotYetDisplayed++;
    531521    }
    532522    iterPic++;
    533523  }
    534524  iterPic   = pcListPic->begin();
    535  
    536   while (iterPic != pcListPic->end())
    537   {
    538     TComPic* pcPic = *(iterPic);
    539    
    540 #if SVC_EXTENSION
    541     if ( pcPic->getOutputMark() && (not_displayed >  pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_aiPOCLastDisplay[layerId]))
    542 #else
    543     if ( pcPic->getOutputMark() && (not_displayed >  pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_iPOCLastDisplay))
    544 #endif
    545     {
    546       // write to file
    547        not_displayed--;
    548 #if SVC_EXTENSION
    549       if ( m_pchReconFile[layerId] )
    550       {
    551         const Window &conf = pcPic->getConformanceWindow();
    552         const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
     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();
    553558#if REPN_FORMAT_IN_VPS
    554         UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
    555         Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
    556         m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(),
    557                                        conf.getWindowLeftOffset()  * xScal + defDisp.getWindowLeftOffset(),
    558                                        conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(),
    559                                        conf.getWindowTopOffset()   * yScal + defDisp.getWindowTopOffset(),
    560                                        conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset() );
    561 
    562 #else
    563         m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(),
    564                                        conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    565                                        conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    566                                        conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    567                                        conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
    568 #endif
    569       }
    570      
    571       // update POC of display order
    572       m_aiPOCLastDisplay[layerId] = pcPic->getPOC();
    573 #else
    574       if ( m_pchReconFile )
    575       {
     559          UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
     560          Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
     561          m_acTVideoIOYuvReconFile[layerId].write( pcPic->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() );
     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        {
     598#if !DYN_REF_FREE
     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        {
    576674#if SYNTAX_OUTPUT
    577         const Window &conf = pcPic->getConformanceWindow();
    578         const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    579         m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
    580                                        conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    581                                        conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    582                                        conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    583                                        conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
    584 #endif
    585       }
    586      
    587       // update POC of display order
    588       m_iPOCLastDisplay = pcPic->getPOC();
    589 #endif
    590      
    591       // erase non-referenced picture in the reference picture list after display
    592       if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true )
    593       {
     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        {
    594692#if !DYN_REF_FREE
    595         pcPic->setReconMark(false);
    596        
    597         // mark it should be extended later
    598         pcPic->getPicYuvRec()->setBorderExtension( false );
    599        
    600 #else
    601         pcPic->destroy();
    602         pcListPic->erase( iterPic );
    603         iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
    604         continue;
    605 #endif
    606       }
    607       pcPic->setOutputMark(false);
    608     }
    609    
    610     iterPic++;
     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    }
    611710  }
    612711}
     
    628727
    629728  iterPic   = pcListPic->begin();
    630  
    631   while (iterPic != pcListPic->end())
    632   {
    633     TComPic* pcPic = *(iterPic);
    634 
    635     if ( pcPic->getOutputMark() )
    636     {
    637       // write to file
    638 #if SVC_EXTENSION
    639       if ( m_pchReconFile[layerId] )
    640       {
    641         const Window &conf = pcPic->getConformanceWindow();
    642         const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
     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();
    643751#if REPN_FORMAT_IN_VPS
    644         UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
    645         Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
    646         m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(),
    647                                        conf.getWindowLeftOffset()  *xScal + defDisp.getWindowLeftOffset(),
    648                                        conf.getWindowRightOffset() *xScal + defDisp.getWindowRightOffset(),
    649                                        conf.getWindowTopOffset()   *yScal + defDisp.getWindowTopOffset(),
    650                                        conf.getWindowBottomOffset()*yScal + defDisp.getWindowBottomOffset() );
    651 
    652 #else
    653         m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(),
    654                                        conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    655                                        conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    656                                        conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    657                                        conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
    658 #endif
    659       }
    660      
    661       // update POC of display order
    662       m_aiPOCLastDisplay[layerId] = pcPic->getPOC();
    663 #else
    664       if ( m_pchReconFile )
    665       {
    666         const Window &conf = pcPic->getConformanceWindow();
    667         const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    668         m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
    669                                        conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    670                                        conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    671                                        conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    672                                        conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
    673       }
    674      
    675       // update POC of display order
    676       m_iPOCLastDisplay = pcPic->getPOC();
    677 #endif
    678      
    679       // erase non-referenced picture in the reference picture list after display
    680       if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true )
    681       {
     752          UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
     753          Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
     754          m_acTVideoIOYuvReconFile[layerId].write( pcPic->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() );
     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        {
    682791#if !DYN_REF_FREE
    683         pcPic->setReconMark(false);
    684        
    685         // mark it should be extended later
    686         pcPic->getPicYuvRec()->setBorderExtension( false );
    687        
    688 #else
    689         pcPic->destroy();
    690         pcListPic->erase( iterPic );
    691         iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
    692         continue;
    693 #endif
    694       }
    695       pcPic->setOutputMark(false);
    696     }
     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      }
    697907#if !SVC_EXTENSION
    698908#if !DYN_REF_FREE
    699     if(pcPic)
    700     {
    701       pcPic->destroy();
    702       delete pcPic;
    703       pcPic = NULL;
    704     }
     909      if(pcPic)
     910      {
     911        pcPic->destroy();
     912        delete pcPic;
     913        pcPic = NULL;
     914      }
    705915#endif   
    706916#endif
    707     iterPic++;
     917      iterPic++;
     918    }
    708919  }
    709920#if SVC_EXTENSION
Note: See TracChangeset for help on using the changeset viewer.