Ignore:
Timestamp:
26 Feb 2015, 00:21:54 (10 years ago)
Author:
seregin
Message:

merge with SHM-upgrade branch

Location:
branches/SHM-dev
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev

  • branches/SHM-dev/source

  • branches/SHM-dev/source/App/TAppDecoder/TAppDecTop.cpp

    r1005 r1029  
    4141#include <fcntl.h>
    4242#include <assert.h>
    43 #include <iostream>
     43
    4444#include "TAppDecTop.h"
    4545#include "TLibDecoder/AnnexBread.h"
    4646#include "TLibDecoder/NALread.h"
     47#if RExt__DECODER_DEBUG_BIT_STATISTICS
     48#include "TLibCommon/TComCodingStatistics.h"
     49#endif
     50#if CONFORMANCE_BITSTREAM_MODE
    4751#include "TLibCommon/TComPicYuv.h"
    4852#include "libmd5/MD5.h"
     53#endif
     54
    4955//! \ingroup TAppDecoder
    5056//! \{
     
    8389#if SVC_EXTENSION
    8490#if FIX_CONF_MODE
    85   for(Int i = 0; i <= MAX_VPS_LAYER_ID_PLUS1-1; i++ )
     91  for(Int i = 0; i < MAX_VPS_LAYER_ID_PLUS1; i++ )
    8692#else
    8793  for( Int i = 0; i <= m_tgtLayerId; i++ )
     
    137143  InputByteStream bytestream(bitstreamFile);
    138144
     145  if (!m_outputDecodedSEIMessagesFilename.empty() && m_outputDecodedSEIMessagesFilename!="-")
     146  {
     147    m_seiMessageFileStream.open(m_outputDecodedSEIMessagesFilename.c_str(), std::ios::out);
     148    if (!m_seiMessageFileStream.is_open() || !m_seiMessageFileStream.good())
     149    {
     150      fprintf(stderr, "\nUnable to open file `%s' for writing decoded SEI messages\n", m_outputDecodedSEIMessagesFilename.c_str());
     151      exit(EXIT_FAILURE);
     152    }
     153  }
     154
    139155  // create & initialize internal classes
    140156  xCreateDecLib();
    141   xInitDecLib  ();
     157  xInitDecLib  (); 
    142158
    143159  // main decoder loop
     
    147163
    148164#if FIX_CONF_MODE
    149   for(UInt layer = 0; layer <= MAX_VPS_LAYER_ID_PLUS1-1; layer++)
     165  for(UInt layer = 0; layer < MAX_VPS_LAYER_ID_PLUS1; layer++)
    150166#else
    151167  for(UInt layer=0; layer<=m_tgtLayerId; layer++)
     
    177193     * requires the TDecTop::decode() method to be called again with the same
    178194     * nal unit. */
     195#if RExt__DECODER_DEBUG_BIT_STATISTICS
     196    TComCodingStatistics::TComCodingStatisticsData backupStats(TComCodingStatistics::GetStatistics());
     197    streampos location = bitstreamFile.tellg() - streampos(bytestream.GetNumBufferedBytes());
     198#else
    179199    streampos location = bitstreamFile.tellg();
     200#endif
    180201    AnnexBStats stats = AnnexBStats();
    181202
     
    183204    InputNALUnit nalu;
    184205    byteStreamNALUnit(bytestream, nalUnit, stats);
     206
    185207    // call actual decoding function
    186208    Bool bNewPicture = false;
    187209    Bool bNewPOC = false;
     210
    188211    if (nalUnit.empty())
    189212    {
     
    221244           * [1] except for the first NAL unit in the file
    222245           *     (but bNewPicture doesn't happen then) */
     246#if RExt__DECODER_DEBUG_BIT_STATISTICS
     247          bitstreamFile.seekg(location);
     248          bytestream.reset();
     249          TComCodingStatistics::SetStatistics(backupStats);
     250#else
    223251          bitstreamFile.seekg(location-streamoff(3));
    224252          bytestream.reset();
     253#endif
    225254        }
    226255#if POC_RESET_IDC_DECODER
     
    232261          bitstreamFile.seekg(location);
    233262          bytestream.reset();
     263#if RExt__DECODER_DEBUG_BIT_STATISTICS
     264          TComCodingStatistics::SetStatistics(backupStats);
     265#endif
    234266        }
    235267#endif
     
    238270
    239271#if POC_RESET_IDC_DECODER
    240     if ((bNewPicture && m_acTDecTop[nalu.m_layerId].getParseIdc() == 3) || (m_acTDecTop[nalu.m_layerId].getParseIdc() == 0) || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS)
    241 #else
    242     if (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS)
     272    if ( ( (bNewPicture && m_acTDecTop[nalu.m_layerId].getParseIdc() == 3) || m_acTDecTop[nalu.m_layerId].getParseIdc() == 0 || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS ) &&
     273        !m_acTDecTop[nalu.m_layerId].getFirstSliceInSequence() )
     274#else
     275    if ( (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS) &&
     276        !m_acTDecTop[nalu.m_layerId].getFirstSliceInSequence() )
    243277#endif
    244278    {
    245279#if O0194_DIFFERENT_BITDEPTH_EL_BL
    246280      //Bug fix: The bit depth was not set correctly for each layer when doing DBF
    247       g_bitDepthY = g_bitDepthYLayer[curLayerId];
    248       g_bitDepthC = g_bitDepthCLayer[curLayerId];
     281      g_bitDepth[CHANNEL_TYPE_LUMA]   = g_bitDepthLayer[CHANNEL_TYPE_LUMA][curLayerId];
     282      g_bitDepth[CHANNEL_TYPE_CHROMA] = g_bitDepthLayer[CHANNEL_TYPE_CHROMA][curLayerId];
    249283#endif
    250284      if (!loopFiltered[curLayerId] || bitstreamFile)
     
    256290      m_acTDecTop[curLayerId].earlyPicMarking(m_iMaxTemporalLayer, m_targetDecLayerIdSet);
    257291#endif
     292      if (nalu.m_nalUnitType == NAL_UNIT_EOS)
     293      {
     294        m_acTDecTop[nalu.m_layerId].setFirstSliceInSequence(true);
     295      }
     296    }
     297    else if ( (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS ) &&
     298              m_acTDecTop[nalu.m_layerId].getFirstSliceInSequence () )
     299    {
     300      m_acTDecTop[nalu.m_layerId].setFirstSliceInPicture (true);
    258301    }
    259302
     
    269312      if ( m_pchReconFile[curLayerId] && !openedReconFile[curLayerId] )
    270313      {
    271         if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; }
    272         if (!m_outputBitDepthC) { m_outputBitDepthC = g_bitDepthC; }
    273 
    274         m_acTVideoIOYuvReconFile[curLayerId].open( m_pchReconFile[curLayerId], true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode
     314        for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
     315        {
     316          if (m_outputBitDepth[channelType] == 0) m_outputBitDepth[channelType] = g_bitDepth[channelType];
     317        }
     318        m_acTVideoIOYuvReconFile[curLayerId].open( m_pchReconFile[curLayerId], true, m_outputBitDepth, m_outputBitDepth, g_bitDepth ); // write mode
    275319
    276320        openedReconFile[curLayerId] = true;
     
    362406
    363407#if FIX_CONF_MODE
    364   for(UInt layer = layerIdmin; layer <= MAX_VPS_LAYER_ID_PLUS1-1; layer++)
     408  for(UInt layer = layerIdmin; layer < MAX_VPS_LAYER_ID_PLUS1; layer++)
    365409#else
    366410  for(UInt layer = layerIdmin; layer <= m_tgtLayerId; layer++)
     
    390434
    391435  InputByteStream bytestream(bitstreamFile);
     436
     437  if (!m_outputDecodedSEIMessagesFilename.empty() && m_outputDecodedSEIMessagesFilename!="-")
     438  {
     439    m_seiMessageFileStream.open(m_outputDecodedSEIMessagesFilename.c_str(), std::ios::out);
     440    if (!m_seiMessageFileStream.is_open() || !m_seiMessageFileStream.good())
     441    {
     442      fprintf(stderr, "\nUnable to open file `%s' for writing decoded SEI messages\n", m_outputDecodedSEIMessagesFilename.c_str());
     443      exit(EXIT_FAILURE);
     444    }
     445  }
    392446
    393447  // create & initialize internal classes
     
    406460     * requires the TDecTop::decode() method to be called again with the same
    407461     * nal unit. */
     462#if RExt__DECODER_DEBUG_BIT_STATISTICS
     463    TComCodingStatistics::TComCodingStatisticsData backupStats(TComCodingStatistics::GetStatistics());
     464    streampos location = bitstreamFile.tellg() - streampos(bytestream.GetNumBufferedBytes());
     465#else
    408466    streampos location = bitstreamFile.tellg();
     467#endif
    409468    AnnexBStats stats = AnnexBStats();
    410469
     
    429488      if( (m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) || !isNaluWithinTargetDecLayerIdSet(&nalu)  )
    430489      {
    431           bNewPicture = false;
    432         }
     490        bNewPicture = false;
     491      }
    433492      else
    434493      {
     
    441500           * [1] except for the first NAL unit in the file
    442501           *     (but bNewPicture doesn't happen then) */
     502#if RExt__DECODER_DEBUG_BIT_STATISTICS
     503          bitstreamFile.seekg(location);
     504          bytestream.reset();
     505          TComCodingStatistics::SetStatistics(backupStats);
     506#else
    443507          bitstreamFile.seekg(location-streamoff(3));
    444508          bytestream.reset();
    445         }
    446       }
    447     }
    448     if (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS)
     509#endif
     510        }
     511      }
     512    }
     513
     514    if ( (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS) &&
     515        !m_cTDecTop.getFirstSliceInSequence () )
    449516    {
    450517      if (!loopFiltered || bitstreamFile)
     
    453520      }
    454521      loopFiltered = (nalu.m_nalUnitType == NAL_UNIT_EOS);
    455     }
    456 #if !FIX_WRITING_OUTPUT
    457 #if SETTING_NO_OUT_PIC_PRIOR
    458     if (bNewPicture && m_cTDecTop.getNoOutputPriorPicsFlag())
    459     {
    460       m_cTDecTop.checkNoOutputPriorPics( pcListPic );
    461     }
    462 #endif
    463 #endif
     522      if (nalu.m_nalUnitType == NAL_UNIT_EOS)
     523      {
     524        m_cTDecTop.setFirstSliceInSequence(true);
     525      }
     526    }
     527    else if ( (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS ) &&
     528              m_cTDecTop.getFirstSliceInSequence () )
     529    {
     530      m_cTDecTop.setFirstSliceInPicture (true);
     531    }
    464532
    465533    if( pcListPic )
     
    467535      if ( m_pchReconFile && !openedReconFile )
    468536      {
    469         if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; }
    470         if (!m_outputBitDepthC) { m_outputBitDepthC = g_bitDepthC; }
    471 
    472         m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode
     537        for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
     538        {
     539          if (m_outputBitDepth[channelType] == 0) m_outputBitDepth[channelType] = g_bitDepth[channelType];
     540        }
     541
     542        m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepth, m_outputBitDepth, g_bitDepth ); // write mode
    473543        openedReconFile = true;
    474544      }
    475 #if FIX_WRITING_OUTPUT
    476545      // write reconstruction to file
    477546      if( bNewPicture )
     
    479548        xWriteOutput( pcListPic, nalu.m_temporalId );
    480549      }
    481 #if SETTING_NO_OUT_PIC_PRIOR
    482550      if ( (bNewPicture || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA) && m_cTDecTop.getNoOutputPriorPicsFlag() )
    483551      {
     
    485553        m_cTDecTop.setNoOutputPriorPicsFlag (false);
    486554      }
    487 #endif
    488 #endif
    489555      if ( bNewPicture &&
    490556           (   nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL
     
    498564      if (nalu.m_nalUnitType == NAL_UNIT_EOS)
    499565      {
    500 #if FIX_OUTPUT_EOS
    501566        xWriteOutput( pcListPic, nalu.m_temporalId );
    502 #else
    503         xFlushOutput( pcListPic );       
    504 #endif
     567        m_cTDecTop.setFirstSliceInPicture (false);
    505568      }
    506569      // write reconstruction to file -- for additional bumping as defined in C.5.2.3
    507 #if FIX_WRITING_OUTPUT
    508570      if(!bNewPicture && nalu.m_nalUnitType >= NAL_UNIT_CODED_SLICE_TRAIL_N && nalu.m_nalUnitType <= NAL_UNIT_RESERVED_VCL31)
    509 #else
    510       if(bNewPicture)
    511 #endif
    512571      {
    513572        xWriteOutput( pcListPic, nalu.m_temporalId );
     
    534593  // initialize global variables
    535594  initROM();
     595
    536596#if FIX_CONF_MODE
    537   for(UInt layer = 0; layer <= MAX_VPS_LAYER_ID_PLUS1-1; layer++)
     597  for(UInt layer = 0; layer < MAX_VPS_LAYER_ID_PLUS1; layer++)
    538598#else
    539599  for(UInt layer = 0; layer <= m_tgtLayerId; layer++)
     
    559619  // destroy ROM
    560620  destroyROM();
     621
    561622#if FIX_CONF_MODE
    562   for(UInt layer = 0; layer <= MAX_VPS_LAYER_ID_PLUS1-1; layer++)
     623  for(UInt layer = 0; layer < MAX_VPS_LAYER_ID_PLUS1; layer++)
    563624#else
    564625  for(UInt layer = 0; layer <= m_tgtLayerId; layer++)
     
    589650#if SVC_EXTENSION
    590651#if FIX_CONF_MODE
    591   for(UInt layer = 0; layer <= MAX_VPS_LAYER_ID_PLUS1-1; layer++)
     652  for(UInt layer = 0; layer < MAX_VPS_LAYER_ID_PLUS1; layer++)
    592653#else
    593654  for(UInt layer = 0; layer <= m_tgtLayerId; layer++)
     
    605666#endif
    606667#if OUTPUT_LAYER_SET_INDEX
    607     m_acTDecTop[layer].setCommonDecoderParams( this->getCommonDecoderParams() );
     668    m_acTDecTop[layer].setCommonDecoderParams( &m_commonDecoderParams );
    608669#endif
    609670  }
     
    615676#endif
    616677  {
    617     m_acTDecTop[layer].setConfModeFlag ( this->getConfModeFlag() );
     678    m_acTDecTop[layer].setConfModeFlag( m_confModeFlag );
    618679  }
    619680#endif
     
    621682  m_cTDecTop.init();
    622683  m_cTDecTop.setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled);
     684#if O0043_BEST_EFFORT_DECODING
     685  m_cTDecTop.setForceDecodeBitDepth(m_forceDecodeBitDepth);
     686#endif
     687  if (!m_outputDecodedSEIMessagesFilename.empty())
     688  {
     689    std::ostream &os=m_seiMessageFileStream.is_open() ? m_seiMessageFileStream : std::cout;
     690    m_cTDecTop.setDecodedSEIMessageOutputStream(&os);
     691  }
    623692#if Q0074_COLOUR_REMAPPING_SEI
    624693  m_cTDecTop.setColourRemappingInfoSEIEnabled(m_colourRemapSEIEnabled);
     
    673742#endif
    674743    {
    675       numPicsNotYetDisplayed++;
     744       numPicsNotYetDisplayed++;
    676745      dpbFullness++;
    677746    }
     
    682751    iterPic++;
    683752  }
    684   iterPic   = pcListPic->begin();
     753
     754  iterPic = pcListPic->begin();
     755
    685756  if (numPicsNotYetDisplayed>2)
    686757  {
     
    720791          const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
    721792          const Bool isTff = pcPicTop->isTopField();
    722           TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec();
    723           TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec();
     793
     794          Bool display = true;
     795          if( m_decodedNoDisplaySEIEnabled )
     796          {
     797            SEIMessages noDisplay = getSeisByType(pcPic->getSEIs(), SEI::NO_DISPLAY );
     798            const SEINoDisplay *nd = ( noDisplay.size() > 0 ) ? (SEINoDisplay*) *(noDisplay.begin()) : NULL;
     799            if( (nd != NULL) && nd->m_noDisplay )
     800            {
     801              display = false;
     802            }
     803          }
     804
     805          if (display)
     806          {           
    724807#if REPN_FORMAT_IN_VPS
    725           UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
    726           Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
    727 
    728           m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRecTop, pPicCYuvRecBot,
    729             conf.getWindowLeftOffset()  * xScal + defDisp.getWindowLeftOffset(),
    730             conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(),
    731             conf.getWindowTopOffset()   * yScal + defDisp.getWindowTopOffset(),
    732             conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset(), isTff );
    733 #else
    734           m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRecTop, pPicCYuvRecBot,
    735             conf.getWindowLeftOffset()   + defDisp.getWindowLeftOffset(),
    736             conf.getWindowRightOffset()  + defDisp.getWindowRightOffset(),
    737             conf.getWindowTopOffset()    + defDisp.getWindowTopOffset(),
    738             conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );
    739 #endif
     808            UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
     809            Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
     810
     811            m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     812              m_outputColourSpaceConvert,
     813              conf.getWindowLeftOffset()  * xScal + defDisp.getWindowLeftOffset(),
     814              conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(),
     815              conf.getWindowTopOffset()   * yScal + defDisp.getWindowTopOffset(),
     816              conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset(), NUM_CHROMA_FORMAT, isTff );
     817#else
     818            m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     819              m_outputColourSpaceConvert,
     820              conf.getWindowLeftOffset()   + defDisp.getWindowLeftOffset(),
     821              conf.getWindowRightOffset()  + defDisp.getWindowRightOffset(),
     822              conf.getWindowTopOffset()    + defDisp.getWindowTopOffset(),
     823              conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), NUM_CHROMA_FORMAT, isTff );
     824#endif
     825          }
    740826        }
    741827
     
    748834          const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
    749835          const Bool isTff = pcPicTop->isTopField();
    750           TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec();
    751           TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec();
    752           m_cTVideoIOYuvReconFile.write( pPicCYuvRecTop, pPicCYuvRecBot,
    753             conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    754             conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    755             conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    756             conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );
     836
     837          Bool display = true;
     838          if( m_decodedNoDisplaySEIEnabled )
     839          {
     840            SEIMessages noDisplay = getSeisByType(pcPic->getSEIs(), SEI::NO_DISPLAY );
     841            const SEINoDisplay *nd = ( noDisplay.size() > 0 ) ? (SEINoDisplay*) *(noDisplay.begin()) : NULL;
     842            if( (nd != NULL) && nd->m_noDisplay )
     843            {
     844              display = false;
     845            }
     846          }
     847
     848          if (display)
     849          {
     850            m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     851                                           m_outputColourSpaceConvert,
     852                                           conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     853                                           conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     854                                           conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     855                                           conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), NUM_CHROMA_FORMAT, isTff );
     856          }
    757857        }
    758858
     
    800900  {
    801901    iterPic = pcListPic->begin();
     902
    802903    while (iterPic != pcListPic->end())
    803904    {
     
    813914      {
    814915        // write to file
    815         numPicsNotYetDisplayed--;
     916         numPicsNotYetDisplayed--;
    816917        if(pcPic->getSlice(0)->isReferenced() == false)
    817918        {
     
    822923        {
    823924          const Window &conf = pcPic->getConformanceWindow();
    824           const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    825           TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec();
     925          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();         
    826926#if REPN_FORMAT_IN_VPS
    827927          UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
    828928          Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
    829929
    830           m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRec,
     930          m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(), m_outputColourSpaceConvert,
    831931            conf.getWindowLeftOffset()  * xScal + defDisp.getWindowLeftOffset(),
    832932            conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(),
     
    834934            conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset() );
    835935#else
    836           m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRec,
     936          m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(), m_outputColourSpaceConvert,
    837937            conf.getWindowLeftOffset()   + defDisp.getWindowLeftOffset(),
    838938            conf.getWindowRightOffset()  + defDisp.getWindowRightOffset(),
     
    847947        if ( m_pchReconFile )
    848948        {
    849           const Window &conf = pcPic->getConformanceWindow();
     949          const Window &conf    = pcPic->getConformanceWindow();
    850950          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
     951
    851952          m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
    852                                         conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    853                                         conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    854                                         conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    855                                         conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
     953                                         m_outputColourSpaceConvert,
     954                                         conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     955                                         conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     956                                         conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     957                                         conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
    856958        }
    857959
     
    9211023          const Window &conf = pcPicTop->getConformanceWindow();
    9221024          const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
    923           const Bool isTff = pcPicTop->isTopField();
    924           TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec();
    925           TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec();
     1025          const Bool isTff = pcPicTop->isTopField();         
    9261026#if REPN_FORMAT_IN_VPS
    9271027          UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
    9281028          Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
    9291029
    930           m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRecTop, pPicCYuvRecBot,
     1030          m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), m_outputColourSpaceConvert,
    9311031            conf.getWindowLeftOffset()  *xScal + defDisp.getWindowLeftOffset(),
    9321032            conf.getWindowRightOffset() *xScal + defDisp.getWindowRightOffset(),
    9331033            conf.getWindowTopOffset()   *yScal + defDisp.getWindowTopOffset(),
    934             conf.getWindowBottomOffset()*yScal + defDisp.getWindowBottomOffset(), isTff );
    935 #else
    936           m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRecTop, pPicCYuvRecBot,
     1034            conf.getWindowBottomOffset()*yScal + defDisp.getWindowBottomOffset(), NUM_CHROMA_FORMAT, isTff );
     1035#else
     1036          m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), m_outputColourSpaceConvert,
    9371037            conf.getWindowLeftOffset()   + defDisp.getWindowLeftOffset(),
    9381038            conf.getWindowRightOffset()  + defDisp.getWindowRightOffset(),
    9391039            conf.getWindowTopOffset()    + defDisp.getWindowTopOffset(),
    940             conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );
     1040            conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), NUM_CHROMA_FORMAT, isTff );
    9411041#endif
    9421042        }
     
    9501050          const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
    9511051          const Bool isTff = pcPicTop->isTopField();
    952           TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec();
    953           TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec();
    954           m_cTVideoIOYuvReconFile.write( pPicCYuvRecTop, pPicCYuvRecBot,
    955             conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    956             conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    957             conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    958             conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );
     1052          m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     1053                                         m_outputColourSpaceConvert,
     1054                                         conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     1055                                         conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     1056                                         conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     1057                                         conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), NUM_CHROMA_FORMAT, isTff );
    9591058        }
    9601059
     
    10271126        {
    10281127          const Window &conf = pcPic->getConformanceWindow();
    1029           const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    1030           TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec();
     1128          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();         
    10311129#if REPN_FORMAT_IN_VPS
    10321130          UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
    10331131          Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
    10341132
    1035           m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRec,
     1133          m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(), m_outputColourSpaceConvert,
    10361134            conf.getWindowLeftOffset()  *xScal + defDisp.getWindowLeftOffset(),
    10371135            conf.getWindowRightOffset() *xScal + defDisp.getWindowRightOffset(),
     
    10391137            conf.getWindowBottomOffset()*yScal + defDisp.getWindowBottomOffset() );
    10401138#else
    1041           m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRec,
     1139          m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(), m_outputColourSpaceConvert,
    10421140            conf.getWindowLeftOffset()   + defDisp.getWindowLeftOffset(),
    10431141            conf.getWindowRightOffset()  + defDisp.getWindowRightOffset(),
     
    10521150        if ( m_pchReconFile )
    10531151        {
    1054           const Window &conf = pcPic->getConformanceWindow();
     1152          const Window &conf    = pcPic->getConformanceWindow();
    10551153          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    1056           TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec();
    1057           m_cTVideoIOYuvReconFile.write( pPicCYuvRec,
    1058             conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    1059             conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    1060             conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    1061             conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
     1154
     1155          m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
     1156                                         m_outputColourSpaceConvert,
     1157                                         conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     1158                                         conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     1159                                         conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     1160                                         conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
    10621161        }
    10631162
     
    11431242#endif
    11441243    TComPicYuv* pPicCYuvRec = pic->getPicYuvRec();
    1145     m_acTVideoIOYuvReconFile[layerIdx].write( pPicCYuvRec,
     1244    m_acTVideoIOYuvReconFile[layerIdx].write( pPicCYuvRec, m_outputColourSpaceConvert,
    11461245      conf.getWindowLeftOffset()  * xScal + defDisp.getWindowLeftOffset(),
    11471246      conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(),
     
    11491248      conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset() );
    11501249  }
    1151 
    11521250  // update POC of display order
    11531251  pocLastDisplay = pic->getPOC();
     
    14051503#if CONFORMANCE_BITSTREAM_MODE
    14061504      FILE *fptr;
    1407       if( this->getConfModeFlag() )
    1408       {
    1409         if( this->getMetadataFileRefresh() )
     1505      if( m_confModeFlag )
     1506      {
     1507        if( m_metadataFileRefresh )
    14101508        {
    14111509          fptr = fopen( this->getMetadataFileName().c_str(), "w" );
     
    14181516        }
    14191517        this->setMetadataFileRefresh(false);
    1420         UChar recon_digest[3][16];
    1421         calcMD5(*pic->getPicYuvRec(), recon_digest);
    1422         fprintf(fptr, "%8d%9d    MD5:%s\n", pic->getLayerId(), pic->getSlice(0)->getPOC(), digestToString(recon_digest, 16));
     1518
     1519        TComDigest recon_digest;
     1520        Int numChar = calcMD5(*pic->getPicYuvRec(), recon_digest);
     1521        fprintf(fptr, "%8d%9d    MD5:%s\n", pic->getLayerId(), pic->getSlice(0)->getPOC(), digestToString(recon_digest, numChar).c_str());
    14231522        fclose(fptr);
    14241523      }
    14251524#endif
    1426 
    14271525
    14281526      listOfPocsInEachLayer[layerIdx].erase( it );
     
    14341532  }
    14351533#if !FIX_ALIGN_BUMPING
    1436 #  // Update sub-DPB status
     1534  // Update sub-DPB status
    14371535  for( Int subDpbIdx = 0; subDpbIdx < dpbStatus.m_numSubDpbs; subDpbIdx++)
    14381536  {
     
    14401538  }
    14411539#endif
    1442   dpbStatus.m_numAUsNotDisplayed--;   
     1540  dpbStatus.m_numAUsNotDisplayed--;
    14431541
    14441542#if CONFORMANCE_BITSTREAM_MODE
    1445   if( this->getConfModeFlag() )
     1543  if( m_confModeFlag )
    14461544  {
    14471545    for( Int dpbLayerCtr = 0; dpbLayerCtr < dpbStatus.m_numLayers; dpbLayerCtr++)
     
    14531551      if( this->getDecodedYuvLayerRefresh(layerIdx) )
    14541552      {
    1455         if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; }
    1456         if (!m_outputBitDepthC) { m_outputBitDepthC = g_bitDepthC; }
     1553        if (!m_outputBitDepth[CHANNEL_TYPE_LUMA]) { m_outputBitDepth[CHANNEL_TYPE_LUMA] = g_bitDepth[CHANNEL_TYPE_LUMA]; }
     1554        if (!m_outputBitDepth[CHANNEL_TYPE_CHROMA]) { m_outputBitDepth[CHANNEL_TYPE_CHROMA] = g_bitDepth[CHANNEL_TYPE_CHROMA]; }
    14571555
    14581556        char tempFileName[256];
    14591557        strcpy(tempFileName, this->getDecodedYuvLayerFileName( layerIdx ).c_str());
    1460         m_confReconFile[layerIdx].open(tempFileName, true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode
     1558        m_confReconFile[layerIdx].open(tempFileName, true, m_outputBitDepth, m_outputBitDepth, g_bitDepth ); // write mode
    14611559        this->setDecodedYuvLayerRefresh( layerIdx, false );
    14621560      }
     
    14681566        const Window &conf = checkPic.getConformanceWindow();
    14691567        const Window &defDisp = m_respectDefDispWindow ? checkPic.getDefDisplayWindow() : Window();
    1470         Int xScal =  1, yScal = 1;
     1568        Int xScal = 1, yScal = 1;
    14711569  #if REPN_FORMAT_IN_VPS
    14721570        UInt chromaFormatIdc = checkPic.getSlice(0)->getChromaFormatIdc();
     
    14771575        {
    14781576          TComPicYuv* pPicCYuvRec = checkPic.getPicYuvRec();
    1479           m_confReconFile[layerIdx].write( pPicCYuvRec,
     1577          m_confReconFile[layerIdx].write( pPicCYuvRec, m_outputColourSpaceConvert,
    14801578            conf.getWindowLeftOffset()  * xScal + defDisp.getWindowLeftOffset(),
    14811579            conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(),
     
    14931591  }
    14941592#endif
     1593
    14951594  // Remove the picture from the listOfPocs
    14961595  listOfPocs.erase( listOfPocs.begin() );
    14971596}
    1498 
    14991597
    15001598TComVPS *TAppDecTop::findDpbParametersFromVps(std::vector<Int> const &listOfPocs, std::vector<Int> const *listOfPocsInEachLayer, std::vector<Int> const *listOfPocsPositionInEachLayer, DpbStatus &maxDpbLimit)
Note: See TracChangeset for help on using the changeset viewer.