Changeset 1313 in 3DVCSoftware for trunk/source/App/TAppDecoder/TAppDecTop.cpp


Ignore:
Timestamp:
13 Aug 2015, 17:38:13 (9 years ago)
Author:
tech
Message:

Merged 14.1-update-dev1@1312.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/App/TAppDecoder/TAppDecTop.cpp

    r1196 r1313  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license. 
     4 * granted under this license.
    55 *
    6 * Copyright (c) 2010-2015, ITU/ISO/IEC
     6 * Copyright (c) 2010-2015, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    4545#include "TLibDecoder/AnnexBread.h"
    4646#include "TLibDecoder/NALread.h"
     47#if RExt__DECODER_DEBUG_BIT_STATISTICS
     48#include "TLibCommon/TComCodingStatistics.h"
     49#endif
    4750
    4851//! \ingroup TAppDecoder
     
    5457
    5558TAppDecTop::TAppDecTop()
    56 #if !H_MV
     59#if !NH_MV
    5760: m_iPOCLastDisplay(-MAX_INT)
    5861#else
     
    6063#endif
    6164{
    62 #if H_MV
     65#if NH_MV
    6366  for (Int i = 0; i < MAX_NUM_LAYER_IDS; i++)
    6467  {
     
    6770  }
    6871#endif
    69 #if H_3D
     72#if NH_3D
    7073    m_pScaleOffsetFile  = 0;
    7174#endif
    7275
    73 #if H_MV
     76#if NH_MV
    7477    m_markedForOutput = false;
    7578#endif
     
    8386Void TAppDecTop::destroy()
    8487{
     88#if NH_MV
     89  // destroy internal classes
     90  xDestroyDecLib();
     91#endif
     92
    8593  if (m_pchBitstreamFile)
    8694  {
     
    8896    m_pchBitstreamFile = NULL;
    8997  }
    90 #if H_MV
     98#if NH_MV
    9199  for (Int decIdx = 0; decIdx < m_numDecoders; decIdx++)
    92100  {
     
    103111    m_pchReconFile = NULL;
    104112  }
    105 #if H_3D
     113#if NH_3D
    106114  if (m_pchScaleOffsetFile)
    107115  {
     
    127135{
    128136  Int                 poc;
    129 #if H_MV
     137#if NH_MV
    130138  poc = -1;
    131139#endif
     
    138146    exit(EXIT_FAILURE);
    139147  }
    140 
    141 #if H_3D
     148#if NH_3D
    142149  if( m_pchScaleOffsetFile )
    143150  {
     
    146153  }
    147154#endif
     155
    148156  InputByteStream bytestream(bitstreamFile);
     157
     158  if (!m_outputDecodedSEIMessagesFilename.empty() && m_outputDecodedSEIMessagesFilename!="-")
     159  {
     160    m_seiMessageFileStream.open(m_outputDecodedSEIMessagesFilename.c_str(), std::ios::out);
     161    if (!m_seiMessageFileStream.is_open() || !m_seiMessageFileStream.good())
     162    {
     163      fprintf(stderr, "\nUnable to open file `%s' for writing decoded SEI messages\n", m_outputDecodedSEIMessagesFilename.c_str());
     164      exit(EXIT_FAILURE);
     165    }
     166  }
    149167
    150168  // create & initialize internal classes
    151169  xCreateDecLib();
    152170  xInitDecLib  ();
    153 #if !H_MV
     171#if !NH_MV
    154172  m_iPOCLastDisplay += m_iSkipFrame;      // set the last displayed POC correctly for skip forward.
    155173
     
    169187  Bool firstSlice        = true;
    170188#endif
    171   Bool loopFiltered      = false;
     189  Bool loopFiltered = false;
    172190
    173191  while (!!bitstreamFile)
     
    177195     * requires the TDecTop::decode() method to be called again with the same
    178196     * nal unit. */
     197#if RExt__DECODER_DEBUG_BIT_STATISTICS
     198    TComCodingStatistics::TComCodingStatisticsData backupStats(TComCodingStatistics::GetStatistics());
     199    streampos location = bitstreamFile.tellg() - streampos(bytestream.GetNumBufferedBytes());
     200#else
    179201    streampos location = bitstreamFile.tellg();
    180 #if H_MV
     202#endif
     203#if NH_MV
    181204#if ENC_DEC_TRACE
    182205    Int64 symCount = g_nSymbolCounter;
     
    184207#endif
    185208    AnnexBStats stats = AnnexBStats();
    186     vector<uint8_t> nalUnit;
     209
    187210    InputNALUnit nalu;
    188     byteStreamNALUnit(bytestream, nalUnit, stats);
     211    byteStreamNALUnit(bytestream, nalu.getBitstream().getFifo(), stats);
    189212
    190213    // call actual decoding function
    191214    Bool bNewPicture = false;
    192 #if H_MV
     215#if NH_MV
    193216    Bool newSliceDiffPoc   = false;
    194217    Bool newSliceDiffLayer = false;
     
    196219    Bool allLayersDecoded  = false;     
    197220#endif
    198     if (nalUnit.empty())
     221    if (nalu.getBitstream().getFifo().empty())
    199222    {
    200223      /* this can happen if the following occur:
     
    207230    else
    208231    {
    209       read(nalu, nalUnit);
    210 #if H_MV     
     232      read(nalu);
     233#if NH_MV     
    211234      if( (m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer)
    212235          || !isNaluWithinTargetDecLayerIdSet(&nalu)
    213           || nalu.m_layerId > MAX_NUM_LAYER_IDS-1
    214           || (nalu.m_nalUnitType == NAL_UNIT_VPS && nalu.m_layerId > 0)           
    215           || (nalu.m_nalUnitType == NAL_UNIT_EOB && nalu.m_layerId > 0)   
    216           || (nalu.m_nalUnitType == NAL_UNIT_EOS && nalu.m_layerId > 0)   
     236          || nalu.m_nuhLayerId > MAX_NUM_LAYER_IDS-1
     237          || (nalu.m_nalUnitType == NAL_UNIT_VPS && nalu.m_nuhLayerId > 0)           
     238          || (nalu.m_nalUnitType == NAL_UNIT_EOB && nalu.m_nuhLayerId > 0)             
    217239         )
    218240      {
     
    225247      else
    226248      {
    227         Int decIdx     = xGetDecoderIdx( nalu.m_layerId , true );     
    228         newSliceDiffLayer = nalu.isSlice() && ( nalu.m_layerId != layerIdCurrPic ) && !firstSlice;
     249        Int decIdx     = xGetDecoderIdx( nalu.m_nuhLayerId , true );     
     250        newSliceDiffLayer = nalu.isSlice() && ( nalu.m_nuhLayerId != layerIdCurrPic ) && !firstSlice;
    229251        newSliceDiffPoc   = m_tDecTop[decIdx]->decode(nalu, m_iSkipFrame, m_pocLastDisplay[decIdx], newSliceDiffLayer, sliceSkippedFlag );
    230252        // decode function only returns true when all of the following conditions are true
     
    233255        // - nalu.isSlice() == true     
    234256
    235         if ( nalu.m_nalUnitType == NAL_UNIT_VPS )
    236         {
    237           m_vps = m_tDecTop[decIdx]->getPrefetchedVPS();
     257        bNewPicture       = ( newSliceDiffLayer || newSliceDiffPoc ) && !sliceSkippedFlag;
     258        if ( nalu.isSlice() && firstSlice && !sliceSkippedFlag )       
     259        {
     260          layerIdCurrPic = nalu.m_nuhLayerId;
     261          pocCurrPic     = m_tDecTop[decIdx]->getCurrPoc();
     262          decIdxCurrPic  = decIdx;
     263          firstSlice     = false;
     264
     265          /// Use VPS activated by the first slice to determine OLS
     266          m_vps = m_tDecTop[decIdx]->getActiveVPS( );
    238267          if ( m_targetDecLayerIdSetFileEmpty )
    239           {
    240             TComVPS* vps = m_vps;
     268          {           
    241269            if ( m_targetOptLayerSetIdx == -1 )
    242270            {
    243               // Not normative! Corresponds to specification by "External Means". (Should be set equal to 0, when no external means available. )
    244               m_targetOptLayerSetIdx = vps->getVpsNumLayerSetsMinus1();
     271              m_targetOptLayerSetIdx = m_tDecTop[decIdx]->getTargetOlsIdx();
    245272            }
    246 
    247             for (Int dI = 0; dI < m_numDecoders; dI++ )
     273            else
    248274            {
    249               m_tDecTop[decIdx]->setTargetOptLayerSetIdx( m_targetOptLayerSetIdx );
    250 #if H_3D
    251               m_tDecTop[decIdx]->setProfileIdc( );
    252 #endif
     275              assert( m_tDecTop[decIdx]->getTargetOlsIdx() == m_targetOptLayerSetIdx );
    253276            }
    254277
    255             if ( m_targetOptLayerSetIdx < 0 || m_targetOptLayerSetIdx >= vps->getNumOutputLayerSets() )
     278            if ( m_targetOptLayerSetIdx < 0 || m_targetOptLayerSetIdx >= m_vps->getNumOutputLayerSets() )
    256279            {
    257               fprintf(stderr, "\ntarget output layer set index must be in the range of 0 to %d, inclusive \n", vps->getNumOutputLayerSets() - 1 );           
     280              fprintf(stderr, "\ntarget output layer set index must be in the range of 0 to %d, inclusive \n", m_vps->getNumOutputLayerSets() - 1 );           
    258281              exit(EXIT_FAILURE);
    259282            }
    260             m_targetDecLayerIdSet = vps->getTargetDecLayerIdList( m_targetOptLayerSetIdx );
     283            m_targetDecLayerIdSet = m_vps->getTargetDecLayerIdList( m_targetOptLayerSetIdx );
    261284          }
     285
    262286          if (m_outputVpsInfo )
    263287          {
     
    267291            m_vps->printPTL();
    268292          }
    269         }
    270 #if H_3D
    271         if (nalu.m_nalUnitType == NAL_UNIT_VPS )
    272         {                 
    273           m_cCamParsCollector.init( m_pScaleOffsetFile, m_tDecTop[decIdx]->getPrefetchedVPS() );
    274         }       
    275 #endif
    276         bNewPicture       = ( newSliceDiffLayer || newSliceDiffPoc ) && !sliceSkippedFlag;
    277         if ( nalu.isSlice() && firstSlice && !sliceSkippedFlag )       
    278         {
    279           layerIdCurrPic = nalu.m_layerId;
    280           pocCurrPic     = m_tDecTop[decIdx]->getCurrPoc();
    281           decIdxCurrPic  = decIdx;
    282           firstSlice     = false;
    283         }
    284 
    285         if ( bNewPicture || !bitstreamFile )
     293        }       
     294
     295        if ( bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS )
    286296        {
    287297          layerIdLastPic    = layerIdCurrPic;
    288           layerIdCurrPic    = nalu.m_layerId;
     298          layerIdCurrPic    = nalu.m_nuhLayerId;
    289299          pocLastPic        = pocCurrPic;
    290300          pocCurrPic        = m_tDecTop[decIdx]->getCurrPoc();
    291301          decIdxLastPic     = decIdxCurrPic;
    292302          decIdxCurrPic     = decIdx;
    293           allLayersDecoded = ( pocCurrPic != pocLastPic );
     303          allLayersDecoded = ( pocCurrPic != pocLastPic ) && ( nalu.m_nalUnitType != NAL_UNIT_EOS );
    294304        }
    295305#else
     
    309319           * [1] except for the first NAL unit in the file
    310320           *     (but bNewPicture doesn't happen then) */
     321#if RExt__DECODER_DEBUG_BIT_STATISTICS
     322          bitstreamFile.seekg(location);
     323          bytestream.reset();
     324          TComCodingStatistics::SetStatistics(backupStats);
     325#else
    311326          bitstreamFile.seekg(location-streamoff(3));
    312327          bytestream.reset();
     328#endif
    313329#if H_MV_ENC_DEC_TRAC
    314330#if ENC_DEC_TRACE
     
    327343      }
    328344    }
    329     if (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS )
     345
     346    if ( (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS) &&
     347#if NH_MV     
     348      !m_tDecTop[decIdxLastPic]->getFirstSliceInSequence () )
     349#else
     350      !m_cTDecTop.getFirstSliceInSequence () )
     351#endif
     352
    330353    {
    331354      if (!loopFiltered || bitstreamFile)
    332355      {
    333 #if H_MV
     356#if NH_MV
    334357        assert( decIdxLastPic != -1 );
    335358        m_tDecTop[decIdxLastPic]->endPicDecoding(poc, pcListPic, m_targetDecLayerIdSet );
     
    340363      }
    341364      loopFiltered = (nalu.m_nalUnitType == NAL_UNIT_EOS);
    342     }
    343 #if !FIX_WRITING_OUTPUT
    344 #if SETTING_NO_OUT_PIC_PRIOR
    345     if (bNewPicture && m_cTDecTop.getIsNoOutputPriorPics())
    346     {
    347       m_cTDecTop.checkNoOutputPriorPics( pcListPic );
    348     }
    349 #endif
    350 #endif
    351 #if H_3D
     365      if (nalu.m_nalUnitType == NAL_UNIT_EOS)
     366      {
     367#if NH_MV     
     368        m_tDecTop[decIdxLastPic]->setFirstSliceInSequence(true);
     369#else
     370        m_cTDecTop.setFirstSliceInSequence(true);
     371#endif
     372      }
     373    }
     374    else if ( (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS ) &&
     375#if NH_MV     
     376              m_tDecTop[decIdxLastPic]->getFirstSliceInSequence () )
     377#else
     378              m_cTDecTop.getFirstSliceInSequence () )
     379#endif
     380    {
     381#if NH_MV     
     382      m_tDecTop[decIdxLastPic]->setFirstSliceInPicture (true);
     383#else
     384      m_cTDecTop.setFirstSliceInPicture (true);
     385#endif
     386    }
     387
     388#if NH_3D
    352389    if ( allLayersDecoded || !bitstreamFile )
    353390    {
     
    363400    if( pcListPic )
    364401    {
    365 #if H_MV
     402#if NH_MV
    366403      if ( m_pchReconFiles[decIdxLastPic] && !m_reconOpen[decIdxLastPic] )
    367404#else
    368       if ( m_pchReconFile && !openedReconFile  )
    369 #endif
    370       {
    371         if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; }
    372         if (!m_outputBitDepthC) { m_outputBitDepthC = g_bitDepthC; }
    373 
    374 #if H_MV
    375         m_tVideoIOYuvReconFile[decIdxLastPic]->open( m_pchReconFiles[decIdxLastPic], true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode
     405      if ( m_pchReconFile && !openedReconFile )
     406#endif
     407      {
     408        const BitDepths &bitDepths=pcListPic->front()->getPicSym()->getSPS().getBitDepths(); // use bit depths of first reconstructed picture.
     409        for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
     410        {
     411          if (m_outputBitDepth[channelType] == 0)
     412          {
     413            m_outputBitDepth[channelType] = bitDepths.recon[channelType];
     414          }
     415        }
     416#if NH_MV
     417        m_tVideoIOYuvReconFile[decIdxLastPic]->open( m_pchReconFiles[decIdxLastPic], true, m_outputBitDepth, m_outputBitDepth, bitDepths.recon ); // write mode
    376418        m_reconOpen[decIdxLastPic] = true;
    377419      }
    378 #if FIX_WRITING_OUTPUT
    379420      // write reconstruction to file
    380421      if( bNewPicture )
     
    388429        xWriteOutput( pcListPic, decIdxLastPic, nalu.m_temporalId );
    389430      }
    390 #if SETTING_NO_OUT_PIC_PRIOR
    391431      if ( (bNewPicture || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA) && m_tDecTop[decIdxLastPic]->getNoOutputPriorPicsFlag() )
    392432      {
     
    394434        m_tDecTop[decIdxLastPic]->setNoOutputPriorPicsFlag (false);
    395435      }
    396 #endif
    397 #endif
     436
    398437      if ( bNewPicture && newSliceDiffPoc &&
    399438#else
    400         m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode
    401         openedReconFile  = true;
    402       }
    403 #if FIX_WRITING_OUTPUT
     439        m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepth, m_outputBitDepth, bitDepths.recon ); // write mode
     440        openedReconFile = true;
     441      }
    404442      // write reconstruction to file
    405443      if( bNewPicture )
     
    407445        xWriteOutput( pcListPic, nalu.m_temporalId );
    408446      }
    409 #if SETTING_NO_OUT_PIC_PRIOR
    410447      if ( (bNewPicture || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA) && m_cTDecTop.getNoOutputPriorPicsFlag() )
    411448      {
     
    413450        m_cTDecTop.setNoOutputPriorPicsFlag (false);
    414451      }
    415 #endif
    416 #endif
    417       if ( bNewPicture &&
     452
     453      if ( bNewPicture &&
    418454#endif
    419455           (   nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL
     
    423459            || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP ) )
    424460      {
    425 #if H_MV
     461#if NH_MV
    426462        xFlushOutput( pcListPic, decIdxLastPic );
    427463#else
     
    431467      if (nalu.m_nalUnitType == NAL_UNIT_EOS)
    432468      {
    433 #if H_MV
    434 #if FIX_OUTPUT_EOS
    435         xWriteOutput( pcListPic, decIdxLastPic, nalu.m_temporalId );
    436 #else
    437         xFlushOutput( pcListPic, decIdxLastPic );
    438 #endif
    439 #else
    440 #if FIX_OUTPUT_EOS
     469#if NH_MV
     470        xWriteOutput( pcListPic, decIdxCurrPic, nalu.m_temporalId );
     471#else
    441472        xWriteOutput( pcListPic, nalu.m_temporalId );
    442 #else
    443         xFlushOutput( pcListPic );
    444 #endif
    445 
    446 #endif
    447       }
    448       // write reconstruction to file -- for additional bumping as defined in C.5.2.3
    449 #if H_MV
     473#endif
     474#if NH_MV
     475        m_tDecTop[decIdxCurrPic]->setFirstSliceInPicture (false);
     476#else
     477        m_cTDecTop.setFirstSliceInPicture (false);
     478#endif
     479      }
     480      // write reconstruction to file -- for additional bumping as defined in C.5.2.3
     481#if NH_MV
    450482      // Above comment seems to be wrong
    451483#endif
    452 #if FIX_WRITING_OUTPUT
    453484      if(!bNewPicture && nalu.m_nalUnitType >= NAL_UNIT_CODED_SLICE_TRAIL_N && nalu.m_nalUnitType <= NAL_UNIT_RESERVED_VCL31)
    454 #else
    455       if(bNewPicture)
    456 #endif
    457       {
    458 #if H_MV       
     485      {
     486#if NH_MV       
    459487        // Bumping after reference picture set has been applied (here after first vcl nalu.
    460488#if ENC_DEC_TRACE
     
    471499    }
    472500  }
    473 #if H_MV
    474 #if H_3D
     501#if NH_MV
     502#if NH_3D
    475503  if( m_cCamParsCollector.isInitialized() )
    476504  {
     
    486514  // delete buffers
    487515  m_cTDecTop.deletePicBuffer();
    488 #endif
    489      
    490516  // destroy internal classes
    491517  xDestroyDecLib();
     518#endif
    492519}
    493520
     
    498525Void TAppDecTop::xCreateDecLib()
    499526{
    500 #if H_MV
     527#if NH_MV
    501528  // initialize global variables
    502529  initROM(); 
    503 #if H_3D_DIM_DMM
     530#if NH_3D_DMM
    504531  initWedgeLists();
    505532#endif
     
    512539Void TAppDecTop::xDestroyDecLib()
    513540{
    514 #if H_MV
     541#if NH_MV
    515542  // destroy ROM
    516543  destroyROM();
     
    538565    m_cTVideoIOYuvReconFile. close();
    539566  }
    540  
     567
    541568  // destroy decoder class
    542569  m_cTDecTop.destroy();
    543570#endif
    544 #if H_3D
     571#if NH_3D
    545572  m_cCamParsCollector.uninit();
    546573  if( m_pScaleOffsetFile )
     
    553580Void TAppDecTop::xInitDecLib()
    554581{
    555 #if !H_MV
     582
     583#if NH_3D
     584  m_cCamParsCollector.setCodeScaleOffsetFile( m_pScaleOffsetFile );
     585#endif
     586#if !NH_MV
    556587  // initialize decoder class
    557588  m_cTDecTop.init();
    558589  m_cTDecTop.setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled);
     590#if O0043_BEST_EFFORT_DECODING
     591  m_cTDecTop.setForceDecodeBitDepth(m_forceDecodeBitDepth);
     592#endif
     593  if (!m_outputDecodedSEIMessagesFilename.empty())
     594  {
     595    std::ostream &os=m_seiMessageFileStream.is_open() ? m_seiMessageFileStream : std::cout;
     596    m_cTDecTop.setDecodedSEIMessageOutputStream(&os);
     597  }
    559598#endif
    560599}
    561600
    562601/** \param pcListPic list of pictures to be written to file
    563     \todo            DYN_REF_FREE should be revised
     602    \param tId       temporal sub-layer ID
    564603 */
    565 #if H_MV
     604#if NH_MV
    566605Void TAppDecTop::xWriteOutput( TComList<TComPic*>* pcListPic, Int decIdx, Int tId )
    567606#else
     
    569608#endif
    570609{
    571 
    572610  if (pcListPic->empty())
    573611  {
     
    578616  Int numPicsNotYetDisplayed = 0;
    579617  Int dpbFullness = 0;
    580 #if H_MV
    581   TComSPS* activeSPS = m_tDecTop[ decIdx ]->getActiveSPS();
    582 #else
    583   TComSPS* activeSPS = m_cTDecTop.getActiveSPS();
    584 #endif
     618  const TComSPS* activeSPS = &(pcListPic->front()->getPicSym()->getSPS());
     619
    585620  UInt numReorderPicsHighestTid;
    586621  UInt maxDecPicBufferingHighestTid;
     
    597632    maxDecPicBufferingHighestTid = activeSPS->getMaxDecPicBuffering(m_iMaxTemporalLayer);
    598633  }
    599  
     634
    600635  while (iterPic != pcListPic->end())
    601636  {
    602637    TComPic* pcPic = *(iterPic);
    603 #if H_MV
     638#if NH_MV
    604639    if(pcPic->getOutputMark() && pcPic->getPOC() > m_pocLastDisplay[decIdx])
    605640#else
     
    607642#endif
    608643    {
    609       numPicsNotYetDisplayed++;
     644       numPicsNotYetDisplayed++;
    610645      dpbFullness++;
    611646    }
     
    616651    iterPic++;
    617652  }
    618   iterPic   = pcListPic->begin();
     653
     654  iterPic = pcListPic->begin();
     655
    619656  if (numPicsNotYetDisplayed>2)
    620657  {
    621658    iterPic++;
    622659  }
    623  
     660
    624661  TComPic* pcPic = *(iterPic);
    625662  if (numPicsNotYetDisplayed>2 && pcPic->isField()) //Field Decoding
     
    633670      iterPic++;
    634671      TComPic* pcPicBottom = *(iterPic);
    635      
    636 #if H_MV
    637       if ( pcPicTop->getOutputMark() && (numPicsNotYetDisplayed >  pcPicTop->getNumReorderPics(tId) && !(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1)
    638           && pcPicBottom->getOutputMark() && (numPicsNotYetDisplayed >  pcPicBottom->getNumReorderPics(tId) && (pcPicTop->getPOC() == m_pocLastDisplay[decIdx]+1 || m_pocLastDisplay[decIdx]<0)))
     672
     673#if NH_MV
     674      if ( pcPicTop->getOutputMark() && pcPicBottom->getOutputMark() &&
     675        (numPicsNotYetDisplayed >  numReorderPicsHighestTid || dpbFullness > maxDecPicBufferingHighestTid) &&
     676        (!(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1) &&
     677        (pcPicTop->getPOC() == m_pocLastDisplay[decIdx]+1 || m_pocLastDisplay[decIdx] < 0))
    639678#else
    640679      if ( pcPicTop->getOutputMark() && pcPicBottom->getOutputMark() &&
     
    646685        // write to file
    647686        numPicsNotYetDisplayed = numPicsNotYetDisplayed-2;
    648 #if H_MV
     687#if NH_MV
    649688      if ( m_pchReconFiles[decIdx] )
    650689#else
     
    653692        {
    654693          const Window &conf = pcPicTop->getConformanceWindow();
    655           const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
    656 
     694          const Window  defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
    657695          const Bool isTff = pcPicTop->isTopField();
    658 #if H_MV
     696
     697          Bool display = true;
     698          if( m_decodedNoDisplaySEIEnabled )
     699          {
     700            SEIMessages noDisplay = getSeisByType(pcPic->getSEIs(), SEI::NO_DISPLAY );
     701            const SEINoDisplay *nd = ( noDisplay.size() > 0 ) ? (SEINoDisplay*) *(noDisplay.begin()) : NULL;
     702            if( (nd != NULL) && nd->m_noDisplay )
     703            {
     704              display = false;
     705            }
     706          }
     707
     708          if (display)
     709          {
     710#if NH_MV
    659711        assert( conf   .getScaledFlag() );
    660712        assert( defDisp.getScaledFlag() );
     
    667719        m_tVideoIOYuvReconFile[decIdx]->write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
    668720#else
    669           m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
    670 #endif
    671                                         conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    672                                         conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    673                                         conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    674                                         conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );
    675         }
    676        
     721        m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     722#endif
     723                                           m_outputColourSpaceConvert,
     724                                           conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     725                                           conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     726                                           conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     727#if NH_3D
     728                                           conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), m_depth420OutputFlag && pcPicTop->getIsDepth() ? CHROMA_420 : NUM_CHROMA_FORMAT, isTff );
     729#else
     730                                           conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), NUM_CHROMA_FORMAT, isTff );
     731#endif
     732          }
     733        }
     734
    677735        // update POC of display order
    678 #if H_MV
     736#if NH_MV
    679737        m_pocLastDisplay[decIdx] = pcPic->getPOC();
    680738#else
    681739        m_iPOCLastDisplay = pcPicBottom->getPOC();
    682740#endif
    683        
     741
    684742        // erase non-referenced picture in the reference picture list after display
    685743        if ( !pcPicTop->getSlice(0)->isReferenced() && pcPicTop->getReconMark() == true )
    686744        {
    687 #if !DYN_REF_FREE
    688745          pcPicTop->setReconMark(false);
    689          
     746
    690747          // mark it should be extended later
    691748          pcPicTop->getPicYuvRec()->setBorderExtension( false );
    692          
    693 #else
    694           pcPicTop->destroy();
    695           pcListPic->erase( iterPic );
    696           iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
    697           continue;
    698 #endif
    699749        }
    700750        if ( !pcPicBottom->getSlice(0)->isReferenced() && pcPicBottom->getReconMark() == true )
    701751        {
    702 #if !DYN_REF_FREE
    703752          pcPicBottom->setReconMark(false);
    704          
     753
    705754          // mark it should be extended later
    706755          pcPicBottom->getPicYuvRec()->setBorderExtension( false );
    707          
    708 #else
    709           pcPicBottom->destroy();
    710           pcListPic->erase( iterPic );
    711           iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
    712           continue;
    713 #endif
    714756        }
    715757        pcPicTop->setOutputMark(false);
     
    721763  {
    722764    iterPic = pcListPic->begin();
     765
    723766    while (iterPic != pcListPic->end())
    724767    {
    725768      pcPic = *(iterPic);
    726769
    727 #if H_MV
     770#if NH_MV
    728771      if(pcPic->getOutputMark() && pcPic->getPOC() > m_pocLastDisplay[decIdx] &&
    729772        (numPicsNotYetDisplayed >  numReorderPicsHighestTid || dpbFullness > maxDecPicBufferingHighestTid))
     
    734777      {
    735778        // write to file
    736         numPicsNotYetDisplayed--;
     779         numPicsNotYetDisplayed--;
    737780        if(pcPic->getSlice(0)->isReferenced() == false)
    738781        {
    739782          dpbFullness--;
    740783        }
    741 #if H_MV
     784#if NH_MV
    742785      if ( m_pchReconFiles[decIdx] )
    743786#else
     
    745788#endif
    746789        {
    747           const Window &conf = pcPic->getConformanceWindow();
    748           const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    749 #if H_MV
     790          const Window &conf    = pcPic->getConformanceWindow();
     791          const Window defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
     792#if NH_MV
    750793        assert( conf   .getScaledFlag() );
    751794        assert( defDisp.getScaledFlag() );
     
    760803          m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
    761804#endif
    762                                         conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    763                                         conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    764                                         conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    765                                         conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
    766         }
    767        
     805                                         m_outputColourSpaceConvert,
     806                                         conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     807                                         conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     808                                         conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     809                                         conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(),
     810#if NH_3D
     811                                          m_depth420OutputFlag && pcPic->getIsDepth() ? CHROMA_420 : NUM_CHROMA_FORMAT,
     812#else
     813                                          NUM_CHROMA_FORMAT,
     814#endif
     815           m_bClipOutputVideoToRec709Range   );
     816        }
     817
    768818        // update POC of display order
    769 #if H_MV
     819#if NH_MV
    770820        m_pocLastDisplay[decIdx] = pcPic->getPOC();
    771821#else
    772822        m_iPOCLastDisplay = pcPic->getPOC();
    773823#endif
    774        
     824
    775825        // erase non-referenced picture in the reference picture list after display
    776826        if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true )
    777827        {
    778 #if !DYN_REF_FREE
    779828          pcPic->setReconMark(false);
    780          
     829
    781830          // mark it should be extended later
    782831          pcPic->getPicYuvRec()->setBorderExtension( false );
    783          
    784 #else
    785           pcPic->destroy();
    786           pcListPic->erase( iterPic );
    787           iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
    788           continue;
    789 #endif
    790832        }
    791833        pcPic->setOutputMark(false);
    792 #if H_MV
     834#if NH_MV
    793835        pcPic->setPicOutputFlag(false);
    794836#endif
    795837      }
    796      
     838
    797839      iterPic++;
    798840    }
    799841  }
    800842}
     843
    801844/** \param pcListPic list of pictures to be written to file
    802     \todo            DYN_REF_FREE should be revised
    803845 */
    804 #if H_MV
     846#if NH_MV
    805847Void TAppDecTop::xFlushOutput( TComList<TComPic*>* pcListPic, Int decIdx )
    806848#else
     
    813855  }
    814856  TComList<TComPic*>::iterator iterPic   = pcListPic->begin();
    815  
     857
    816858  iterPic   = pcListPic->begin();
    817859  TComPic* pcPic = *(iterPic);
    818  
     860
    819861  if (pcPic->isField()) //Field Decoding
    820862  {
     
    827869      iterPic++;
    828870      pcPicBottom = *(iterPic);
    829      
     871
    830872      if ( pcPicTop->getOutputMark() && pcPicBottom->getOutputMark() && !(pcPicTop->getPOC()%2) && (pcPicBottom->getPOC() == pcPicTop->getPOC()+1) )
    831873      {
    832874        // write to file
    833 #if H_MV
     875#if NH_MV
    834876      if ( m_pchReconFiles[decIdx] )
    835877#else
     
    838880        {
    839881          const Window &conf = pcPicTop->getConformanceWindow();
    840           const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
     882          const Window  defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
    841883          const Bool isTff = pcPicTop->isTopField();
    842 #if H_MV
     884#if NH_MV
    843885        assert( conf   .getScaledFlag() );
    844886        assert( defDisp.getScaledFlag() );
     
    853895          m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
    854896#endif
    855                                         conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    856                                         conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    857                                         conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    858                                         conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );
    859         }
    860        
     897                                         m_outputColourSpaceConvert,
     898                                         conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     899                                         conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     900                                         conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     901#if NH_3D
     902                                         conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), m_depth420OutputFlag && pcPicTop->getIsDepth() ? CHROMA_420 : NUM_CHROMA_FORMAT, isTff );
     903#else
     904                                         conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), NUM_CHROMA_FORMAT, isTff );
     905#endif
     906        }
     907
    861908        // update POC of display order
    862 #if H_MV
     909#if NH_MV
    863910      m_pocLastDisplay[decIdx] = pcPic->getPOC();
    864911#else
    865       m_iPOCLastDisplay = pcPicBottom->getPOC();
     912        m_iPOCLastDisplay = pcPicBottom->getPOC();
    866913#endif       
    867914        // erase non-referenced picture in the reference picture list after display
    868915        if ( !pcPicTop->getSlice(0)->isReferenced() && pcPicTop->getReconMark() == true )
    869916        {
    870 #if !DYN_REF_FREE
    871917          pcPicTop->setReconMark(false);
    872          
     918
    873919          // mark it should be extended later
    874920          pcPicTop->getPicYuvRec()->setBorderExtension( false );
    875          
    876 #else
    877           pcPicTop->destroy();
    878           pcListPic->erase( iterPic );
    879           iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
    880           continue;
    881 #endif
    882921        }
    883922        if ( !pcPicBottom->getSlice(0)->isReferenced() && pcPicBottom->getReconMark() == true )
    884923        {
    885 #if !DYN_REF_FREE
    886924          pcPicBottom->setReconMark(false);
    887          
     925
    888926          // mark it should be extended later
    889927          pcPicBottom->getPicYuvRec()->setBorderExtension( false );
    890          
    891 #else
    892           pcPicBottom->destroy();
    893           pcListPic->erase( iterPic );
    894           iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
    895           continue;
    896 #endif
    897928        }
    898929        pcPicTop->setOutputMark(false);
    899930        pcPicBottom->setOutputMark(false);
    900        
    901 #if !DYN_REF_FREE
     931
    902932        if(pcPicTop)
    903933        {
     
    906936          pcPicTop = NULL;
    907937        }
    908 #endif
    909938      }
    910939    }
     
    921950    {
    922951      pcPic = *(iterPic);
    923      
     952
    924953      if ( pcPic->getOutputMark() )
    925954      {
    926955        // write to file
    927 #if H_MV
     956#if NH_MV
    928957      if ( m_pchReconFiles[decIdx] )
    929958#else
     
    931960#endif
    932961        {
    933           const Window &conf = pcPic->getConformanceWindow();
    934           const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    935 #if H_MV
     962          const Window &conf    = pcPic->getConformanceWindow();
     963          const Window  defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
     964#if NH_MV
    936965        assert( conf   .getScaledFlag() );
    937966        assert( defDisp.getScaledFlag() );
     
    946975          m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
    947976#endif
    948                                         conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    949                                         conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    950                                         conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    951                                         conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
    952         }
    953        
     977                                         m_outputColourSpaceConvert,
     978                                         conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     979                                         conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     980                                         conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     981                                         conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(),
     982#if NH_3D
     983                                         m_depth420OutputFlag && pcPic->getIsDepth() ? CHROMA_420 : NUM_CHROMA_FORMAT
     984#else
     985                                         NUM_CHROMA_FORMAT
     986#endif
     987                                         , m_bClipOutputVideoToRec709Range);
     988        }
     989
    954990        // update POC of display order
    955 #if H_MV
     991#if NH_MV
    956992      m_pocLastDisplay[decIdx] = pcPic->getPOC();
    957993#else
    958994        m_iPOCLastDisplay = pcPic->getPOC();
    959995#endif
    960        
     996
    961997        // erase non-referenced picture in the reference picture list after display
    962998        if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true )
    963999        {
    964 #if !DYN_REF_FREE
    9651000          pcPic->setReconMark(false);
    966          
     1001
    9671002          // mark it should be extended later
    9681003          pcPic->getPicYuvRec()->setBorderExtension( false );
    969          
    970 #else
    971           pcPic->destroy();
    972           pcListPic->erase( iterPic );
    973           iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
    974           continue;
    975 #endif
    9761004        }
    9771005        pcPic->setOutputMark(false);
    978 #if H_MV
     1006#if NH_MV
    9791007        pcPic->setPicOutputFlag(false);
    9801008#endif
    9811009      }
    982 #if !H_MV
    983 #if !DYN_REF_FREE
    984       if(pcPic)
     1010#if !NH_MV
     1011      if(pcPic != NULL)
    9851012      {
    9861013        pcPic->destroy();
     
    9881015        pcPic = NULL;
    9891016      }
    990 #endif   
    9911017#endif
    9921018      iterPic++;
    9931019    }
    9941020  }
    995 #if H_MV
     1021#if NH_MV
    9961022  m_pocLastDisplay[decIdx] = -MAX_INT;
    9971023#else
     
    10111037  for (std::vector<Int>::iterator it = m_targetDecLayerIdSet.begin(); it != m_targetDecLayerIdSet.end(); it++)
    10121038  {
    1013 #if H_MV
    1014     if ( nalu->m_layerId == (*it) )
    1015 #else
    1016     if ( nalu->m_reservedZero6Bits == (*it) )
     1039#if NH_MV
     1040    if ( nalu->m_nuhLayerId == (*it) )
     1041#else
     1042    if ( nalu->m_nuhLayerId == (*it) )
    10171043#endif
    10181044    {
     
    10231049}
    10241050
    1025 #if H_MV
     1051#if NH_MV
    10261052Int TAppDecTop::xGetDecoderIdx( Int layerId, Bool createFlag /*= false */ )
    10271053{
     
    10521078    m_tDecTop[ decIdx ]->setIvPicLists( &m_ivPicLists );
    10531079    m_tDecTop[ decIdx ]->setLayerInitilizedFlags( m_layerInitilizedFlags );
    1054     m_tDecTop[ decIdx ]->setTargetOptLayerSetIdx( m_targetOptLayerSetIdx );   
    1055 #if H_3D
    1056     m_tDecTop[ decIdx ]->setProfileIdc           ( );   
    1057 #endif
    1058 
    1059 #if H_3D
     1080    m_tDecTop[ decIdx ]->setTargetOlsIdx( m_targetOptLayerSetIdx );   
     1081#if O0043_BEST_EFFORT_DECODING
     1082    m_cTDecTop[ decIdx ]->setForceDecodeBitDepth(m_forceDecodeBitDepth);
     1083#endif
     1084    if (!m_outputDecodedSEIMessagesFilename.empty())
     1085    {
     1086      std::ostream &os=m_seiMessageFileStream.is_open() ? m_seiMessageFileStream : std::cout;
     1087      m_tDecTop[ decIdx ]->setDecodedSEIMessageOutputStream(&os);
     1088    }
     1089#if NH_3D
    10601090   m_tDecTop[ decIdx ]->setCamParsCollector( &m_cCamParsCollector );
    10611091#endif
Note: See TracChangeset for help on using the changeset viewer.