Src_HM/source/App/TAppDecoder/TAppDecTop.cpp
/** \param pcListPic list of pictures to be written to file
    \todo            DYN_REF_FREE should be revised
 */
\param pcListPic list of pictures to be written to file
\todo            DYN_REF_FREE should be revised
\ param pcListPic list of pictures to be written to file \ todo DYN_REF_FREE should be revised
Void TAppDecTop::xFlushOutput( TComList<TComPic*>* pcListPic )
{
  if(!pcListPic || pcListPic->empty())
  {
    return;
  }
  TComList<TComPic*>::iterator iterPic   = pcListPic->begin();
  iterPic   = pcListPic->begin();
  TComPic* pcPic = *(iterPic);
  if (pcPic->isField()) 
  {
    TComList<TComPic*>::iterator endPic   = pcListPic->end();
    endPic--;
    TComPic *pcPicTop, *pcPicBottom = NULL;
    while (iterPic != endPic)
    {
      pcPicTop = *(iterPic);
      iterPic++;
      pcPicBottom = *(iterPic);
      if ( pcPicTop->getOutputMark() && pcPicBottom->getOutputMark() && !(pcPicTop->getPOC()%2) && (pcPicBottom->getPOC() == pcPicTop->getPOC()+1) )
      {
        if ( m_pchReconFile )
        {
          const Window &conf = pcPicTop->getConformanceWindow();
          const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
          const Bool isTff = pcPicTop->isTopField();
          m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
                                        conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
                                        conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
                                        conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
                                        conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );
        }
        m_iPOCLastDisplay = pcPicBottom->getPOC();
        if ( !pcPicTop->getSlice(0)->isReferenced() && pcPicTop->getReconMark() == true )
        {
#if !DYN_REF_FREE
          pcPicTop->setReconMark(false);
          pcPicTop->getPicYuvRec()->setBorderExtension( false );
#else
          pcPicTop->destroy();
          pcListPic->erase( iterPic );
          iterPic = pcListPic->begin(); 
          continue;
#endif
        }
        if ( !pcPicBottom->getSlice(0)->isReferenced() && pcPicBottom->getReconMark() == true )
        {
#if !DYN_REF_FREE
          pcPicBottom->setReconMark(false);
          pcPicBottom->getPicYuvRec()->setBorderExtension( false );
#else
          pcPicBottom->destroy();
          pcListPic->erase( iterPic );
          iterPic = pcListPic->begin(); 
          continue;
#endif
        }
        pcPicTop->setOutputMark(false);
        pcPicBottom->setOutputMark(false);
#if !DYN_REF_FREE
        if(pcPicTop)
        {
          pcPicTop->destroy();
          delete pcPicTop;
          pcPicTop = NULL;
        }
#endif
      }
    }
    if(pcPicBottom)
    {
      pcPicBottom->destroy();
      delete pcPicBottom;
      pcPicBottom = NULL;
    }
  }
  else 
  {
    while (iterPic != pcListPic->end())
    {
      pcPic = *(iterPic);
      if ( pcPic->getOutputMark() )
      {
        if ( m_pchReconFile )
        {
          const Window &conf = pcPic->getConformanceWindow();
          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
          m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
                                        conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
                                        conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
                                        conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
                                        conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
        }
        m_iPOCLastDisplay = pcPic->getPOC();
        if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true )
        {
#if !DYN_REF_FREE
          pcPic->setReconMark(false);
          pcPic->getPicYuvRec()->setBorderExtension( false );
#else
          pcPic->destroy();
          pcListPic->erase( iterPic );
          iterPic = pcListPic->begin(); 
          continue;
#endif
        }
        pcPic->setOutputMark(false);
      }
#if !DYN_REF_FREE
      if(pcPic)
      {
        pcPic->destroy();
        delete pcPic;
        pcPic = NULL;
      }
#endif    
      iterPic++;
    }
  }
  pcListPic->clear();
  m_iPOCLastDisplay = -MAX_INT;
}
Void TAppDecTop :: xFlushOutput ( TComList < TComPic * > * pcListPic ) { if ( ! pcListPic || pcListPic -> empty ( ) ) { return ; } TComList < TComPic * > :: iterator iterPic = pcListPic -> begin ( ) ; iterPic = pcListPic -> begin ( ) ; TComPic * pcPic = * ( iterPic ) ; if ( pcPic -> isField ( ) ) { TComList < TComPic * > :: iterator endPic = pcListPic -> end ( ) ; endPic -- ; TComPic * pcPicTop , * pcPicBottom = NULL ; while ( iterPic != endPic ) { pcPicTop = * ( iterPic ) ; iterPic ++ ; pcPicBottom = * ( iterPic ) ; if ( pcPicTop -> getOutputMark ( ) && pcPicBottom -> getOutputMark ( ) && ! ( pcPicTop -> getPOC ( ) % 2 ) && ( pcPicBottom -> getPOC ( ) == pcPicTop -> getPOC ( ) + 1 ) ) { if ( m_pchReconFile ) { const Window & conf = pcPicTop -> getConformanceWindow ( ) ; const Window & defDisp = m_respectDefDispWindow ? pcPicTop -> getDefDisplayWindow ( ) : Window ( ) ; const Bool isTff = pcPicTop -> isTopField ( ) ; m_cTVideoIOYuvReconFile . write ( pcPicTop -> getPicYuvRec ( ) , pcPicBottom -> getPicYuvRec ( ) , conf . getWindowLeftOffset ( ) + defDisp . getWindowLeftOffset ( ) , conf . getWindowRightOffset ( ) + defDisp . getWindowRightOffset ( ) , conf . getWindowTopOffset ( ) + defDisp . getWindowTopOffset ( ) , conf . getWindowBottomOffset ( ) + defDisp . getWindowBottomOffset ( ) , isTff ) ; } m_iPOCLastDisplay = pcPicBottom -> getPOC ( ) ; if ( ! pcPicTop -> getSlice ( 0 ) -> isReferenced ( ) && pcPicTop -> getReconMark ( ) == true ) { #if ! DYN_REF_FREE pcPicTop -> setReconMark ( false ) ; pcPicTop -> getPicYuvRec ( ) -> setBorderExtension ( false ) ; #else pcPicTop -> destroy ( ) ; pcListPic -> erase ( iterPic ) ; iterPic = pcListPic -> begin ( ) ; continue ; #endif } if ( ! pcPicBottom -> getSlice ( 0 ) -> isReferenced ( ) && pcPicBottom -> getReconMark ( ) == true ) { #if ! DYN_REF_FREE pcPicBottom -> setReconMark ( false ) ; pcPicBottom -> getPicYuvRec ( ) -> setBorderExtension ( false ) ; #else pcPicBottom -> destroy ( ) ; pcListPic -> erase ( iterPic ) ; iterPic = pcListPic -> begin ( ) ; continue ; #endif } pcPicTop -> setOutputMark ( false ) ; pcPicBottom -> setOutputMark ( false ) ; #if ! DYN_REF_FREE if ( pcPicTop ) { pcPicTop -> destroy ( ) ; delete pcPicTop ; pcPicTop = NULL ; } #endif } } if ( pcPicBottom ) { pcPicBottom -> destroy ( ) ; delete pcPicBottom ; pcPicBottom = NULL ; } } else { while ( iterPic != pcListPic -> end ( ) ) { pcPic = * ( iterPic ) ; if ( pcPic -> getOutputMark ( ) ) { if ( m_pchReconFile ) { const Window & conf = pcPic -> getConformanceWindow ( ) ; const Window & defDisp = m_respectDefDispWindow ? pcPic -> getDefDisplayWindow ( ) : Window ( ) ; m_cTVideoIOYuvReconFile . write ( pcPic -> getPicYuvRec ( ) , conf . getWindowLeftOffset ( ) + defDisp . getWindowLeftOffset ( ) , conf . getWindowRightOffset ( ) + defDisp . getWindowRightOffset ( ) , conf . getWindowTopOffset ( ) + defDisp . getWindowTopOffset ( ) , conf . getWindowBottomOffset ( ) + defDisp . getWindowBottomOffset ( ) ) ; } m_iPOCLastDisplay = pcPic -> getPOC ( ) ; if ( ! pcPic -> getSlice ( 0 ) -> isReferenced ( ) && pcPic -> getReconMark ( ) == true ) { #if ! DYN_REF_FREE pcPic -> setReconMark ( false ) ; pcPic -> getPicYuvRec ( ) -> setBorderExtension ( false ) ; #else pcPic -> destroy ( ) ; pcListPic -> erase ( iterPic ) ; iterPic = pcListPic -> begin ( ) ; continue ; #endif } pcPic -> setOutputMark ( false ) ; } #if ! DYN_REF_FREE if ( pcPic ) { pcPic -> destroy ( ) ; delete pcPic ; pcPic = NULL ; } #endif iterPic ++ ; } } pcListPic -> clear ( ) ; m_iPOCLastDisplay = - MAX_INT ; }
\param pcListPic list of pictures to be written to file
\todo            DYN_REF_FREE should be revised
\ param pcListPic list of pictures to be written to file \ todo DYN_REF_FREE should be revised
//Field Decoding // write to file // update POC of display order // erase non-referenced picture in the reference picture list after display // mark it should be extended later // to the beginning, non-efficient way, have to be revised! // mark it should be extended later // to the beginning, non-efficient way, have to be revised! //Frame decoding // write to file // update POC of display order // erase non-referenced picture in the reference picture list after display // mark it should be extended later // to the beginning, non-efficient way, have to be revised!