Changeset 713 in SHVCSoftware for trunk/source/App/TAppDecoder/TAppDecTop.cpp


Ignore:
Timestamp:
21 Apr 2014, 04:44:16 (11 years ago)
Author:
seregin
Message:

merge with SHM-6-dev

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/source

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

    r644 r713  
    163163  }
    164164  TComList<TComPic*> *cListPic = m_acTDecTop[0].getListPic();
     165#if AVC_SYNTAX || !REPN_FORMAT_IN_VPS
    165166  m_acTDecTop[0].setBLsize( m_iBLSourceWidth, m_iBLSourceHeight );
     167#endif
    166168  m_acTDecTop[0].setBLReconFile( &streamYUV );
    167169  pcBLPic.setLayerId( 0 );
     
    257259      Bool outputPicturesFlag = true; 
    258260#if NO_OUTPUT_OF_PRIOR_PICS
    259       if( m_acTDecTop[nalu.m_layerId].getNoOutputOfPriorPicsFlags() )
     261      if( m_acTDecTop[nalu.m_layerId].getNoOutputPriorPicsFlag() )
    260262      {
    261263        outputPicturesFlag = false;
     
    449451      loopFiltered = (nalu.m_nalUnitType == NAL_UNIT_EOS);
    450452    }
     453#if !FIX_WRITING_OUTPUT
     454#if SETTING_NO_OUT_PIC_PRIOR
     455    if (bNewPicture && m_cTDecTop.getNoOutputPriorPicsFlag())
     456    {
     457      m_cTDecTop.checkNoOutputPriorPics( pcListPic );
     458    }
     459#endif
     460#endif
    451461
    452462    if( pcListPic )
     
    460470        openedReconFile = true;
    461471      }
     472#if FIX_WRITING_OUTPUT
     473      // write reconstruction to file
     474      if( bNewPicture )
     475      {
     476        xWriteOutput( pcListPic, nalu.m_temporalId );
     477      }
     478#if SETTING_NO_OUT_PIC_PRIOR
     479      if ( (bNewPicture || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA) && m_cTDecTop.getNoOutputPriorPicsFlag() )
     480      {
     481        m_cTDecTop.checkNoOutputPriorPics( pcListPic );
     482        m_cTDecTop.setNoOutputPriorPicsFlag (false);
     483      }
     484#endif
     485#endif
    462486      if ( bNewPicture &&
    463487           (   nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL
     
    471495      if (nalu.m_nalUnitType == NAL_UNIT_EOS)
    472496      {
     497#if FIX_OUTPUT_EOS
     498        xWriteOutput( pcListPic, nalu.m_temporalId );
     499#else
    473500        xFlushOutput( pcListPic );       
    474       }
    475       // write reconstruction to file
     501#endif
     502      }
     503      // write reconstruction to file -- for additional bumping as defined in C.5.2.3
     504#if FIX_WRITING_OUTPUT
     505      if(!bNewPicture && nalu.m_nalUnitType >= NAL_UNIT_CODED_SLICE_TRAIL_N && nalu.m_nalUnitType <= NAL_UNIT_RESERVED_VCL31)
     506#else
    476507      if(bNewPicture)
     508#endif
    477509      {
    478510        xWriteOutput( pcListPic, nalu.m_temporalId );
     
    586618  TComList<TComPic*>::iterator iterPic   = pcListPic->begin();
    587619  Int numPicsNotYetDisplayed = 0;
     620  Int dpbFullness = 0;
     621#if SVC_EXTENSION
     622TComSPS* activeSPS = m_acTDecTop[layerId].getActiveSPS();
     623#else
     624  TComSPS* activeSPS = m_cTDecTop.getActiveSPS();
     625#endif
     626  UInt numReorderPicsHighestTid;
     627  UInt maxDecPicBufferingHighestTid;
     628  UInt maxNrSublayers = activeSPS->getMaxTLayers();
     629
     630  if(m_iMaxTemporalLayer == -1 || m_iMaxTemporalLayer >= maxNrSublayers)
     631  {
     632    numReorderPicsHighestTid = activeSPS->getNumReorderPics(maxNrSublayers-1);
     633    maxDecPicBufferingHighestTid =  activeSPS->getMaxDecPicBuffering(maxNrSublayers-1);
     634  }
     635  else
     636  {
     637    numReorderPicsHighestTid = activeSPS->getNumReorderPics(m_iMaxTemporalLayer);
     638    maxDecPicBufferingHighestTid = activeSPS->getMaxDecPicBuffering(m_iMaxTemporalLayer);
     639  }
    588640
    589641  while (iterPic != pcListPic->end())
     
    597649    {
    598650      numPicsNotYetDisplayed++;
     651      dpbFullness++;
     652    }
     653    else if(pcPic->getSlice( 0 )->isReferenced())
     654    {
     655      dpbFullness++;
    599656    }
    600657    iterPic++;
     
    619676
    620677#if SVC_EXTENSION
    621       if ( pcPicTop->getOutputMark() && (numPicsNotYetDisplayed >  pcPicTop->getNumReorderPics(tId) && !(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1)
    622         && pcPicBottom->getOutputMark() && (numPicsNotYetDisplayed >  pcPicBottom->getNumReorderPics(tId) && (pcPicTop->getPOC() == m_aiPOCLastDisplay[layerId]+1 || m_aiPOCLastDisplay[layerId]<0)))
    623 #else
    624       if ( pcPicTop->getOutputMark() && (numPicsNotYetDisplayed >  pcPicTop->getNumReorderPics(tId) && !(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1)
    625         && pcPicBottom->getOutputMark() && (numPicsNotYetDisplayed >  pcPicBottom->getNumReorderPics(tId) && (pcPicTop->getPOC() == m_iPOCLastDisplay+1 || m_iPOCLastDisplay<0)))
     678      if( pcPicTop->getOutputMark() && pcPicBottom->getOutputMark() &&
     679        (numPicsNotYetDisplayed >  numReorderPicsHighestTid || dpbFullness > maxDecPicBufferingHighestTid) &&
     680        (!(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1) &&       
     681        (pcPicTop->getPOC() == m_aiPOCLastDisplay[layerId]+1 || m_aiPOCLastDisplay[layerId]<0) )
     682#else
     683      if ( pcPicTop->getOutputMark() && pcPicBottom->getOutputMark() &&
     684          (numPicsNotYetDisplayed >  numReorderPicsHighestTid || dpbFullness > maxDecPicBufferingHighestTid) &&
     685          (!(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1) &&
     686          (pcPicTop->getPOC() == m_iPOCLastDisplay+1 || m_iPOCLastDisplay < 0))
    626687#endif
    627688      {
     
    634695          const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
    635696          const Bool isTff = pcPicTop->isTopField();
     697          TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec();
     698          TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec();
     699#if Q0074_SEI_COLOR_MAPPING
     700          if( m_acTDecTop[layerId].m_ColorMapping->getColorMappingFlag() )
     701          {
     702            pPicCYuvRecTop = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRecTop, 0, layerId );
     703            pPicCYuvRecBot = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRecBot, 1, layerId );
     704          }
     705#endif
    636706#if REPN_FORMAT_IN_VPS
    637707          UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
    638708          Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
    639           m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     709
     710          m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRecTop, pPicCYuvRecBot,
    640711            conf.getWindowLeftOffset()  * xScal + defDisp.getWindowLeftOffset(),
    641712            conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(),
    642713            conf.getWindowTopOffset()   * yScal + defDisp.getWindowTopOffset(),
    643714            conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset(), isTff );
    644 
    645 #else
    646 #if O0194_DIFFERENT_BITDEPTH_EL_BL
    647           // Compile time bug-fix
    648           m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
    649 #else
    650           m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
    651 #endif
     715#else
     716          m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRecTop, pPicCYuvRecBot,
     717            conf.getWindowLeftOffset()   + defDisp.getWindowLeftOffset(),
     718            conf.getWindowRightOffset()  + defDisp.getWindowRightOffset(),
     719            conf.getWindowTopOffset()    + defDisp.getWindowTopOffset(),
     720            conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );
     721#endif
     722        }
     723
     724        // update POC of display order
     725        m_aiPOCLastDisplay[layerId] = pcPicBottom->getPOC();
     726#else
     727        if ( m_pchReconFile )
     728        {
     729          const Window &conf = pcPicTop->getConformanceWindow();
     730          const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
     731          const Bool isTff = pcPicTop->isTopField();
     732          TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec();
     733          TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec();
     734#if Q0074_SEI_COLOR_MAPPING
     735          if ( m_cTDecTop.m_ColorMapping->getColorMappingFlag() )
     736          {
     737            pPicCYuvRecTop = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRecTop, 0 );
     738            pPicCYuvRecBot = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRecBot, 1 );
     739          }
     740#endif
     741          m_cTVideoIOYuvReconFile.write( pPicCYuvRecTop, pPicCYuvRecBot,
    652742            conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    653743            conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    654744            conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    655745            conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );
    656 #endif
    657746        }
    658747
    659748        // update POC of display order
    660         m_aiPOCLastDisplay[layerId] = pcPicBottom->getPOC();
     749        m_iPOCLastDisplay = pcPicBottom->getPOC();
     750#endif
     751
     752        // erase non-referenced picture in the reference picture list after display
     753        if ( !pcPicTop->getSlice(0)->isReferenced() && pcPicTop->getReconMark() == true )
     754        {
     755#if !DYN_REF_FREE
     756          pcPicTop->setReconMark(false);
     757
     758          // mark it should be extended later
     759          pcPicTop->getPicYuvRec()->setBorderExtension( false );
     760
     761#else
     762          pcPicTop->destroy();
     763          pcListPic->erase( iterPic );
     764          iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
     765          continue;
     766#endif
     767        }
     768        if ( !pcPicBottom->getSlice(0)->isReferenced() && pcPicBottom->getReconMark() == true )
     769        {
     770#if !DYN_REF_FREE
     771          pcPicBottom->setReconMark(false);
     772
     773          // mark it should be extended later
     774          pcPicBottom->getPicYuvRec()->setBorderExtension( false );
     775
     776#else
     777          pcPicBottom->destroy();
     778          pcListPic->erase( iterPic );
     779          iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
     780          continue;
     781#endif
     782        }
     783        pcPicTop->setOutputMark(false);
     784        pcPicBottom->setOutputMark(false);
     785      }
     786    }
     787  }
     788  else if (!pcPic->isField()) //Frame Decoding
     789  {
     790    iterPic = pcListPic->begin();
     791    while (iterPic != pcListPic->end())
     792    {
     793      pcPic = *(iterPic);
     794
     795#if SVC_EXTENSION
     796      if( pcPic->getOutputMark() && pcPic->getPOC() > m_aiPOCLastDisplay[layerId] &&
     797        (numPicsNotYetDisplayed >  numReorderPicsHighestTid || dpbFullness > maxDecPicBufferingHighestTid) )
     798#else
     799      if(pcPic->getOutputMark() && pcPic->getPOC() > m_iPOCLastDisplay &&
     800        (numPicsNotYetDisplayed >  numReorderPicsHighestTid || dpbFullness > maxDecPicBufferingHighestTid))
     801#endif
     802      {
     803        // write to file
     804        numPicsNotYetDisplayed--;
     805        if(pcPic->getSlice(0)->isReferenced() == false)
     806        {
     807          dpbFullness--;
     808        }
     809#if SVC_EXTENSION
     810        if( m_pchReconFile[layerId] )
     811        {
     812          const Window &conf = pcPic->getConformanceWindow();
     813          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
     814          TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec();
     815#if Q0074_SEI_COLOR_MAPPING
     816          if ( m_acTDecTop[layerId].m_ColorMapping->getColorMappingFlag() )
     817          {
     818            pPicCYuvRec = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRec, 0, layerId );
     819          }
     820#endif
     821
     822#if REPN_FORMAT_IN_VPS
     823          UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
     824          Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
     825
     826          m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRec,
     827            conf.getWindowLeftOffset()  * xScal + defDisp.getWindowLeftOffset(),
     828            conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(),
     829            conf.getWindowTopOffset()   * yScal + defDisp.getWindowTopOffset(),
     830            conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset() );
     831#else
     832          m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRec,
     833            conf.getWindowLeftOffset()   + defDisp.getWindowLeftOffset(),
     834            conf.getWindowRightOffset()  + defDisp.getWindowRightOffset(),
     835            conf.getWindowTopOffset()    + defDisp.getWindowTopOffset(),
     836            conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
     837#endif
     838        }
     839
     840        // update POC of display order
     841        m_aiPOCLastDisplay[layerId] = pcPic->getPOC();
    661842#else
    662843        if ( m_pchReconFile )
     844        {
     845#if SYNTAX_OUTPUT
     846          TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec();
     847#if Q0074_SEI_COLOR_MAPPING
     848          if( m_acTDecTop[layerIdx].m_ColorMapping->getColorMappingFlag() )
     849          {
     850            pPicCYuvRec = m_acTDecTop[layerIdx].m_ColorMapping->getColorMapping( pPicCYuvRec, 0, layerIdx );
     851          }
     852#endif
     853          const Window &conf = pcPic->getConformanceWindow();
     854          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
     855          m_cTVideoIOYuvReconFile.write( pPicCYuvRec,
     856            conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     857            conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     858            conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     859            conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
     860#endif
     861        }
     862
     863        // update POC of display order
     864        m_iPOCLastDisplay = pcPic->getPOC();
     865#endif
     866
     867        // erase non-referenced picture in the reference picture list after display
     868        if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true )
     869        {
     870#if !DYN_REF_FREE
     871          pcPic->setReconMark(false);
     872
     873          // mark it should be extended later
     874          pcPic->getPicYuvRec()->setBorderExtension( false );
     875
     876#else
     877          pcPic->destroy();
     878          pcListPic->erase( iterPic );
     879          iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
     880          continue;
     881#endif
     882        }
     883        pcPic->setOutputMark(false);
     884      }
     885
     886      iterPic++;
     887    }
     888  }
     889}
     890
     891/** \param pcListPic list of pictures to be written to file
     892    \todo            DYN_REF_FREE should be revised
     893 */
     894#if SVC_EXTENSION
     895Void TAppDecTop::xFlushOutput( TComList<TComPic*>* pcListPic, UInt layerId )
     896#else
     897Void TAppDecTop::xFlushOutput( TComList<TComPic*>* pcListPic )
     898#endif
     899{
     900  if(!pcListPic || pcListPic->empty())
     901  {
     902    return;
     903  }
     904  TComList<TComPic*>::iterator iterPic   = pcListPic->begin();
     905
     906  iterPic   = pcListPic->begin();
     907  TComPic* pcPic = *(iterPic);
     908
     909  if (pcPic->isField()) //Field Decoding
     910  {
     911    TComList<TComPic*>::iterator endPic   = pcListPic->end();
     912    endPic--;
     913    TComPic *pcPicTop, *pcPicBottom = NULL;
     914    while (iterPic != endPic)
     915    {
     916      pcPicTop = *(iterPic);
     917      iterPic++;
     918      pcPicBottom = *(iterPic);
     919
     920      if ( pcPicTop->getOutputMark() && pcPicBottom->getOutputMark() && !(pcPicTop->getPOC()%2) && (pcPicBottom->getPOC() == pcPicTop->getPOC()+1) )
     921      {
     922        // write to file
     923#if SVC_EXTENSION
     924        if ( m_pchReconFile[layerId] )
    663925        {
    664926          const Window &conf = pcPicTop->getConformanceWindow();
    665927          const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
    666928          const Bool isTff = pcPicTop->isTopField();
    667           m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     929          TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec();
     930          TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec();
     931#if Q0074_SEI_COLOR_MAPPING
     932          if( m_acTDecTop[layerId].m_ColorMapping->getColorMappingFlag() )
     933          {
     934            pPicCYuvRecTop = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRecTop, 0, layerId );
     935            pPicCYuvRecBot = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRecBot, 1, layerId );
     936          }
     937#endif
     938#if REPN_FORMAT_IN_VPS
     939          UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
     940          Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
     941
     942          m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRecTop, pPicCYuvRecBot,
     943            conf.getWindowLeftOffset()  *xScal + defDisp.getWindowLeftOffset(),
     944            conf.getWindowRightOffset() *xScal + defDisp.getWindowRightOffset(),
     945            conf.getWindowTopOffset()   *yScal + defDisp.getWindowTopOffset(),
     946            conf.getWindowBottomOffset()*yScal + defDisp.getWindowBottomOffset(), isTff );
     947#else
     948          m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRecTop, pPicCYuvRecBot,
     949            conf.getWindowLeftOffset()   + defDisp.getWindowLeftOffset(),
     950            conf.getWindowRightOffset()  + defDisp.getWindowRightOffset(),
     951            conf.getWindowTopOffset()    + defDisp.getWindowTopOffset(),
     952            conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );
     953#endif
     954        }
     955
     956        // update POC of display order
     957        m_aiPOCLastDisplay[layerId] = pcPicBottom->getPOC();
     958#else
     959        if ( m_pchReconFile )
     960        {
     961          const Window &conf = pcPicTop->getConformanceWindow();
     962          const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
     963          const Bool isTff = pcPicTop->isTopField();
     964          TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec();
     965          TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec();
     966#if Q0074_SEI_COLOR_MAPPING
     967          if( m_cTDecTop.m_ColorMapping->getColorMappingFlag() )
     968          {
     969            pPicCYuvRecTop = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRecTop, 0 );
     970            pPicCYuvRecBot = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRecBot, 1 );
     971          }
     972#endif
     973          m_cTVideoIOYuvReconFile.write( pPicCYuvRecTop, pPicCYuvRecBot,
    668974            conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    669975            conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     
    7091015        pcPicTop->setOutputMark(false);
    7101016        pcPicBottom->setOutputMark(false);
    711       }
    712     }
    713   }
    714   else if (!pcPic->isField()) //Frame Decoding
    715   {
    716     iterPic = pcListPic->begin();
     1017
     1018#if !DYN_REF_FREE
     1019        if(pcPicTop)
     1020        {
     1021          pcPicTop->destroy();
     1022          delete pcPicTop;
     1023          pcPicTop = NULL;
     1024        }
     1025#endif
     1026      }
     1027    }
     1028    if(pcPicBottom)
     1029    {
     1030      pcPicBottom->destroy();
     1031      delete pcPicBottom;
     1032      pcPicBottom = NULL;
     1033    }
     1034  }
     1035  else //Frame decoding
     1036  {
    7171037    while (iterPic != pcListPic->end())
    7181038    {
    7191039      pcPic = *(iterPic);
    7201040
    721 #if SVC_EXTENSION
    722       if ( pcPic->getOutputMark() && (numPicsNotYetDisplayed >  pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_aiPOCLastDisplay[layerId]))
    723 #else
    724       if ( pcPic->getOutputMark() && (numPicsNotYetDisplayed >  pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_iPOCLastDisplay))
    725 #endif
     1041      if ( pcPic->getOutputMark() )
    7261042      {
    7271043        // write to file
    728         numPicsNotYetDisplayed--;
    7291044#if SVC_EXTENSION
    7301045        if ( m_pchReconFile[layerId] )
     
    7321047          const Window &conf = pcPic->getConformanceWindow();
    7331048          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
     1049          TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec();
     1050#if Q0074_SEI_COLOR_MAPPING
     1051          if( m_acTDecTop[layerId].m_ColorMapping->getColorMappingFlag() )
     1052          {
     1053            pPicCYuvRec = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRec, 0, layerId );
     1054          }
     1055#endif
    7341056#if REPN_FORMAT_IN_VPS
    7351057          UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
    7361058          Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
    737           m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(),
    738             conf.getWindowLeftOffset()  * xScal + defDisp.getWindowLeftOffset(),
    739             conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(),
    740             conf.getWindowTopOffset()   * yScal + defDisp.getWindowTopOffset(),
    741             conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset() );
    742 
    743 #else
    744           m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(),
    745             conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    746             conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    747             conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    748             conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
    749 #endif
    750         }
    751 
    752         // update POC of display order
    753         m_aiPOCLastDisplay[layerId] = pcPic->getPOC();
    754 #else
    755         if ( m_pchReconFile )
    756         {
    757 #if SYNTAX_OUTPUT
    758           const Window &conf = pcPic->getConformanceWindow();
    759           const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    760           m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
    761             conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    762             conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    763             conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    764             conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
    765 #endif
    766         }
    767 
    768         // update POC of display order
    769         m_iPOCLastDisplay = pcPic->getPOC();
    770 #endif
    771 
    772         // erase non-referenced picture in the reference picture list after display
    773         if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true )
    774         {
    775 #if !DYN_REF_FREE
    776           pcPic->setReconMark(false);
    777 
    778           // mark it should be extended later
    779           pcPic->getPicYuvRec()->setBorderExtension( false );
    780 
    781 #else
    782           pcPic->destroy();
    783           pcListPic->erase( iterPic );
    784           iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
    785           continue;
    786 #endif
    787         }
    788         pcPic->setOutputMark(false);
    789       }
    790 
    791       iterPic++;
    792     }
    793   }
    794 }
    795 
    796 /** \param pcListPic list of pictures to be written to file
    797     \todo            DYN_REF_FREE should be revised
    798  */
    799 #if SVC_EXTENSION
    800 Void TAppDecTop::xFlushOutput( TComList<TComPic*>* pcListPic, UInt layerId )
    801 #else
    802 Void TAppDecTop::xFlushOutput( TComList<TComPic*>* pcListPic )
    803 #endif
    804 {
    805   if(!pcListPic || pcListPic->empty())
    806   {
    807     return;
    808   }
    809   TComList<TComPic*>::iterator iterPic   = pcListPic->begin();
    810 
    811   iterPic   = pcListPic->begin();
    812   TComPic* pcPic = *(iterPic);
    813 
    814   if (pcPic->isField()) //Field Decoding
    815   {
    816     TComList<TComPic*>::iterator endPic   = pcListPic->end();
    817     endPic--;
    818     TComPic *pcPicTop, *pcPicBottom = NULL;
    819     while (iterPic != endPic)
    820     {
    821       pcPicTop = *(iterPic);
    822       iterPic++;
    823       pcPicBottom = *(iterPic);
    824 
    825       if ( pcPicTop->getOutputMark() && pcPicBottom->getOutputMark() && !(pcPicTop->getPOC()%2) && (pcPicBottom->getPOC() == pcPicTop->getPOC()+1) )
    826       {
    827         // write to file
    828 #if SVC_EXTENSION
    829         if ( m_pchReconFile[layerId] )
    830         {
    831           const Window &conf = pcPicTop->getConformanceWindow();
    832           const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
    833           const Bool isTff = pcPicTop->isTopField();
    834 #if REPN_FORMAT_IN_VPS
    835           UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
    836           Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
    837           m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
    838             conf.getWindowLeftOffset()  *xScal + defDisp.getWindowLeftOffset(),
    839             conf.getWindowRightOffset() *xScal + defDisp.getWindowRightOffset(),
    840             conf.getWindowTopOffset()   *yScal + defDisp.getWindowTopOffset(),
    841             conf.getWindowBottomOffset()*yScal + defDisp.getWindowBottomOffset(), isTff );
    842 
    843 #else
    844 #if O0194_DIFFERENT_BITDEPTH_EL_BL
    845           // Compile time bug-fix
    846           m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
    847 #else
    848           m_cTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
    849 #endif
    850             conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    851             conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    852             conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    853             conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );
    854 #endif
    855         }
    856 
    857         // update POC of display order
    858         m_aiPOCLastDisplay[layerId] = pcPicBottom->getPOC();
    859 #else
    860         if ( m_pchReconFile )
    861         {
    862           const Window &conf = pcPicTop->getConformanceWindow();
    863           const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
    864           const Bool isTff = pcPicTop->isTopField();
    865           m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
    866             conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    867             conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    868             conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    869             conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );
    870         }
    871 
    872         // update POC of display order
    873         m_iPOCLastDisplay = pcPicBottom->getPOC();
    874 #endif
    875 
    876         // erase non-referenced picture in the reference picture list after display
    877         if ( !pcPicTop->getSlice(0)->isReferenced() && pcPicTop->getReconMark() == true )
    878         {
    879 #if !DYN_REF_FREE
    880           pcPicTop->setReconMark(false);
    881 
    882           // mark it should be extended later
    883           pcPicTop->getPicYuvRec()->setBorderExtension( false );
    884 
    885 #else
    886           pcPicTop->destroy();
    887           pcListPic->erase( iterPic );
    888           iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
    889           continue;
    890 #endif
    891         }
    892         if ( !pcPicBottom->getSlice(0)->isReferenced() && pcPicBottom->getReconMark() == true )
    893         {
    894 #if !DYN_REF_FREE
    895           pcPicBottom->setReconMark(false);
    896 
    897           // mark it should be extended later
    898           pcPicBottom->getPicYuvRec()->setBorderExtension( false );
    899 
    900 #else
    901           pcPicBottom->destroy();
    902           pcListPic->erase( iterPic );
    903           iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
    904           continue;
    905 #endif
    906         }
    907         pcPicTop->setOutputMark(false);
    908         pcPicBottom->setOutputMark(false);
    909 
    910 #if !DYN_REF_FREE
    911         if(pcPicTop)
    912         {
    913           pcPicTop->destroy();
    914           delete pcPicTop;
    915           pcPicTop = NULL;
    916         }
    917 #endif
    918       }
    919     }
    920     if(pcPicBottom)
    921     {
    922       pcPicBottom->destroy();
    923       delete pcPicBottom;
    924       pcPicBottom = NULL;
    925     }
    926   }
    927   else //Frame decoding
    928   {
    929     while (iterPic != pcListPic->end())
    930     {
    931       pcPic = *(iterPic);
    932 
    933       if ( pcPic->getOutputMark() )
    934       {
    935         // write to file
    936 #if SVC_EXTENSION
    937         if ( m_pchReconFile[layerId] )
    938         {
    939           const Window &conf = pcPic->getConformanceWindow();
    940           const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    941 #if REPN_FORMAT_IN_VPS
    942           UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
    943           Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
    944           m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(),
     1059
     1060          m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRec,
    9451061            conf.getWindowLeftOffset()  *xScal + defDisp.getWindowLeftOffset(),
    9461062            conf.getWindowRightOffset() *xScal + defDisp.getWindowRightOffset(),
    9471063            conf.getWindowTopOffset()   *yScal + defDisp.getWindowTopOffset(),
    9481064            conf.getWindowBottomOffset()*yScal + defDisp.getWindowBottomOffset() );
    949 
    950 #else
    951           m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(),
    952             conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    953             conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    954             conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     1065#else
     1066          m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRec,
     1067            conf.getWindowLeftOffset()   + defDisp.getWindowLeftOffset(),
     1068            conf.getWindowRightOffset()  + defDisp.getWindowRightOffset(),
     1069            conf.getWindowTopOffset()    + defDisp.getWindowTopOffset(),
    9551070            conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
    9561071#endif
     
    9641079          const Window &conf = pcPic->getConformanceWindow();
    9651080          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    966           m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
     1081          TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec();
     1082#if Q0074_SEI_COLOR_MAPPING
     1083          if( m_cTDecTop.m_ColorMapping->getColorMappingFlag() )
     1084          {
     1085            pPicCYuvRec = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRec );
     1086          }
     1087#endif
     1088          m_cTVideoIOYuvReconFile.write( pPicCYuvRec,
    9671089            conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    9681090            conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     
    10451167    yScal = TComSPS::getWinUnitY( chromaFormatIdc );
    10461168#endif
    1047     m_acTVideoIOYuvReconFile[layerIdx].write( pic->getPicYuvRec(),
     1169    TComPicYuv* pPicCYuvRec = pic->getPicYuvRec();
     1170#if Q0074_SEI_COLOR_MAPPING
     1171    pPicCYuvRec = m_acTDecTop[layerIdx].m_ColorMapping->getColorMapping( pPicCYuvRec, 0, layerIdx );
     1172#endif
     1173    m_acTVideoIOYuvReconFile[layerIdx].write( pPicCYuvRec,
    10481174      conf.getWindowLeftOffset()  * xScal + defDisp.getWindowLeftOffset(),
    10491175      conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(),
Note: See TracChangeset for help on using the changeset viewer.