Changeset 916 in SHVCSoftware for branches/SHM-upgrade/source/App/TAppDecoder


Ignore:
Timestamp:
12 Nov 2014, 08:09:17 (10 years ago)
Author:
seregin
Message:

initial porting

Location:
branches/SHM-upgrade/source/App/TAppDecoder
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-upgrade/source/App/TAppDecoder/TAppDecCfg.cpp

    r856 r916  
    4141#include "TAppDecCfg.h"
    4242#include "TAppCommon/program_options_lite.h"
     43#include "TLibCommon/TComChromaFormat.h"
    4344#if SVC_EXTENSION
    4445#include <cassert>
     
    8081
    8182  string cfg_TargetDecLayerIdSetFile;
     83  string outputColourSpaceConvert;
    8284
    8385  po::Options opts;
    8486  opts.addOptions()
    85   ("help", do_help, false, "this help text")
    86   ("BitstreamFile,b", cfg_BitstreamFile, string(""), "bitstream input file name")
     87
     88
     89  ("help",                      do_help,                               false,      "this help text")
     90  ("BitstreamFile,b",           cfg_BitstreamFile,                     string(""), "bitstream input file name")
    8791#if SVC_EXTENSION
    8892  ("ReconFileL%d,-o%d",   cfg_ReconFile,   string(""), MAX_LAYERS, "Layer %d reconstructed YUV output file name\n"
     
    9599#endif
    96100#endif
    97 #else
    98   ("ReconFile,o",     cfg_ReconFile,     string(""), "reconstructed YUV output file name\n"
    99                                                      "YUV writing is skipped if omitted")
    100 #endif
    101   ("SkipFrames,s", m_iSkipFrame, 0, "number of frames to skip before random access")
    102   ("OutputBitDepth,d", m_outputBitDepthY, 0, "bit depth of YUV output luma component (default: use 0 for native depth)")
    103   ("OutputBitDepthC,d", m_outputBitDepthC, 0, "bit depth of YUV output chroma component (default: use 0 for native depth)")
    104 #if SVC_EXTENSION
    105101  ("LayerNum,-ls", nLayerNum, 1, "Number of layers to be decoded.")
    106102#if OUTPUT_LAYER_SET_INDEX
    107103  ("OutpuLayerSetIdx,-olsidx", olsIdx, -1, "Index of output layer set to be decoded.")
    108104#endif
    109 #endif
    110   ("MaxTemporalLayer,t", m_iMaxTemporalLayer, -1, "Maximum Temporal Layer to be decoded. -1 to decode all layers")
    111   ("SEIDecodedPictureHash", m_decodedPictureHashSEIEnabled, 1, "Control handling of decoded picture hash SEI messages\n"
    112                                               "\t1: check hash in SEI messages if available in the bitstream\n"
    113                                               "\t0: ignore SEI message")
    114   ("SEIpictureDigest", m_decodedPictureHashSEIEnabled, 1, "deprecated alias for SEIDecodedPictureHash")
    115   ("TarDecLayerIdSetFile,l", cfg_TargetDecLayerIdSetFile, string(""), "targetDecLayerIdSet file name. The file should include white space separated LayerId values to be decoded. Omitting the option or a value of -1 in the file decodes all layers.")
    116   ("RespectDefDispWindow,w", m_respectDefDispWindow, 0, "Only output content inside the default display window\n")
     105#else
     106  ("ReconFile,o",               cfg_ReconFile,                         string(""), "reconstructed YUV output file name\n"
     107                                                                                   "YUV writing is skipped if omitted")
     108#endif
     109
     110  ("SkipFrames,s",              m_iSkipFrame,                          0,          "number of frames to skip before random access")
     111  ("OutputBitDepth,d",          m_outputBitDepth[CHANNEL_TYPE_LUMA],   0,          "bit depth of YUV output luma component (default: use 0 for native depth)")
     112  ("OutputBitDepthC,d",         m_outputBitDepth[CHANNEL_TYPE_CHROMA], 0,          "bit depth of YUV output chroma component (default: use 0 for native depth)")
     113  ("OutputColourSpaceConvert",  outputColourSpaceConvert,              string(""), "Colour space conversion to apply to input 444 video. Permitted values are (empty string=UNCHANGED) " + getListOfColourSpaceConverts(false))
     114  ("MaxTemporalLayer,t",        m_iMaxTemporalLayer,                   -1,         "Maximum Temporal Layer to be decoded. -1 to decode all layers")
     115  ("SEIDecodedPictureHash",     m_decodedPictureHashSEIEnabled,        1,          "Control handling of decoded picture hash SEI messages\n"
     116                                                                                   "\t1: check hash in SEI messages if available in the bitstream\n"
     117                                                                                   "\t0: ignore SEI message")
     118  ("SEIpictureDigest",          m_decodedPictureHashSEIEnabled,        1,          "deprecated alias for SEIDecodedPictureHash")
     119  ("SEINoDisplay",              m_decodedNoDisplaySEIEnabled,          true,       "Control handling of decoded no display SEI messages")
     120  ("TarDecLayerIdSetFile,l",    cfg_TargetDecLayerIdSetFile,           string(""), "targetDecLayerIdSet file name. The file should include white space separated LayerId values to be decoded. Omitting the option or a value of -1 in the file decodes all layers.")
     121  ("RespectDefDispWindow,w",    m_respectDefDispWindow,                0,          "Only output content inside the default display window\n")
     122#if O0043_BEST_EFFORT_DECODING
     123  ("ForceDecodeBitDepth",       m_forceDecodeBitDepth,                 0U,         "Force the decoder to operate at a particular bit-depth (best effort decoding)")
     124#endif
    117125#if Q0074_COLOUR_REMAPPING_SEI
    118126  ("SEIColourRemappingInfo", m_colourRemapSEIEnabled, false, "Control handling of Colour Remapping Information SEI messages\n"
     
    121129#endif
    122130  ;
     131
    123132  po::setDefaults(opts);
    124133  const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv);
     
    132141  {
    133142    po::doHelp(cout, opts);
     143    return false;
     144  }
     145
     146  m_outputColourSpaceConvert = stringToInputColourSpaceConvert(outputColourSpaceConvert, false);
     147  if (m_outputColourSpaceConvert>=NUMBER_INPUT_COLOUR_SPACE_CONVERSIONS)
     148  {
     149    fprintf(stderr, "Bad output colour space conversion string\n");
    134150    return false;
    135151  }
     
    161177  if (!m_pchBitstreamFile)
    162178  {
    163     fprintf(stderr, "No input file specifed, aborting\n");
     179    fprintf(stderr, "No input file specified, aborting\n");
    164180    return false;
    165181  }
     
    189205        if ( layerIdParsed < 0 || layerIdParsed >= MAX_NUM_LAYER_IDS )
    190206        {
    191           fprintf(stderr, "Warning! Parsed LayerId %d is not withing allowed range [0,%d]. Ignoring this value.\n", layerIdParsed, MAX_NUM_LAYER_IDS-1 );
     207          fprintf(stderr, "Warning! Parsed LayerId %d is not within allowed range [0,%d]. Ignoring this value.\n", layerIdParsed, MAX_NUM_LAYER_IDS-1 );
    192208        }
    193209        else
  • branches/SHM-upgrade/source/App/TAppDecoder/TAppDecCfg.h

    r856 r916  
    5757{
    5858protected:
    59   Char*         m_pchBitstreamFile;                   ///< input bitstream file name
     59  Char*         m_pchBitstreamFile;                     ///< input bitstream file name
    6060#if SVC_EXTENSION
    6161  Char*         m_pchReconFile [MAX_LAYERS];          ///< output reconstruction file name
    6262#else
    63   Char*         m_pchReconFile;                       ///< output reconstruction file name
     63  Char*         m_pchReconFile;                         ///< output reconstruction file name
    6464#endif
    65   Int           m_iSkipFrame;                         ///< counter for frames prior to the random access point to skip
    66   Int           m_outputBitDepthY;                     ///< bit depth used for writing output (luma)
    67   Int           m_outputBitDepthC;                     ///< bit depth used for writing output (chroma)t
     65  Int           m_iSkipFrame;                           ///< counter for frames prior to the random access point to skip
     66  Int           m_outputBitDepth[MAX_NUM_CHANNEL_TYPE]; ///< bit depth used for writing output
     67  InputColourSpaceConversion m_outputColourSpaceConvert;
    6868
    6969  Int           m_iMaxTemporalLayer;                  ///< maximum temporal layer to be decoded
    7070  Int           m_decodedPictureHashSEIEnabled;       ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message
     71  Bool          m_decodedNoDisplaySEIEnabled;         ///< Enable(true)/disable(false) writing only pictures that get displayed based on the no display SEI message
    7172#if Q0074_COLOUR_REMAPPING_SEI
    7273  Bool          m_colourRemapSEIEnabled;              ///< Enable the Colour Remapping Information SEI message if available (remapping decoded pictures)
     
    8586
    8687  std::vector<Int> m_targetDecLayerIdSet;             ///< set of LayerIds to be included in the sub-bitstream extraction process.
    87   Int           m_respectDefDispWindow;               ///< Only output content inside the default display window
     88  Int           m_respectDefDispWindow;               ///< Only output content inside the default display window
     89#if O0043_BEST_EFFORT_DECODING
     90  UInt          m_forceDecodeBitDepth;                ///< if non-zero, force the bit depth at the decoder (best effort decoding)
     91#endif
     92  std::string   m_outputDecodedSEIMessagesFilename;   ///< filename to output decoded SEI messages to. If '-', then use stdout. If empty, do not output details.
    8893#if OUTPUT_LAYER_SET_INDEX
    8994  CommonDecoderParams             m_commonDecoderParams;
     
    9499  : m_pchBitstreamFile(NULL)
    95100#if !SVC_EXTENSION
    96   , m_pchReconFile(NULL) 
     101  , m_pchReconFile(NULL)
    97102#endif
    98103  , m_iSkipFrame(0)
    99   , m_outputBitDepthY(0)
    100   , m_outputBitDepthC(0)
     104  , m_outputColourSpaceConvert(IPCOLOURSPACE_UNCHANGED)
    101105  , m_iMaxTemporalLayer(-1)
    102106  , m_decodedPictureHashSEIEnabled(0)
     107  , m_decodedNoDisplaySEIEnabled(false)
    103108#if Q0074_COLOUR_REMAPPING_SEI
    104109  , m_colourRemapSEIEnabled(0)
     
    112117#endif
    113118  , m_respectDefDispWindow(0)
    114   {}
     119#if O0043_BEST_EFFORT_DECODING
     120  , m_forceDecodeBitDepth(0)
     121#endif
     122  {
     123    for (UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)
     124      m_outputBitDepth[channelTypeIndex] = 0;
     125  }
     126
    115127  virtual ~TAppDecCfg() {}
    116  
     128
    117129  Bool  parseCfg        ( Int argc, Char* argv[] );   ///< initialize option class from configuration
    118130#if OUTPUT_LAYER_SET_INDEX
  • branches/SHM-upgrade/source/App/TAppDecoder/TAppDecTop.cpp

    r874 r916  
    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
    4751//! \ingroup TAppDecoder
    4852//! \{
     
    131135  InputByteStream bytestream(bitstreamFile);
    132136
     137  if (!m_outputDecodedSEIMessagesFilename.empty() && m_outputDecodedSEIMessagesFilename!="-")
     138  {
     139    m_seiMessageFileStream.open(m_outputDecodedSEIMessagesFilename.c_str(), std::ios::out);
     140    if (!m_seiMessageFileStream.is_open() || !m_seiMessageFileStream.good())
     141    {
     142      fprintf(stderr, "\nUnable to open file `%s' for writing decoded SEI messages\n", m_outputDecodedSEIMessagesFilename.c_str());
     143      exit(EXIT_FAILURE);
     144    }
     145  }
     146
    133147  // create & initialize internal classes
    134148  xCreateDecLib();
    135   xInitDecLib  ();
     149  xInitDecLib  (); 
    136150
    137151  // main decoder loop
     
    167181     * requires the TDecTop::decode() method to be called again with the same
    168182     * nal unit. */
     183#if RExt__DECODER_DEBUG_BIT_STATISTICS
     184    TComCodingStatistics::TComCodingStatisticsData backupStats(TComCodingStatistics::GetStatistics());
     185    streampos location = bitstreamFile.tellg() - streampos(bytestream.GetNumBufferedBytes());
     186#else
    169187    streampos location = bitstreamFile.tellg();
     188#endif
    170189    AnnexBStats stats = AnnexBStats();
    171190
     
    173192    InputNALUnit nalu;
    174193    byteStreamNALUnit(bytestream, nalUnit, stats);
     194
    175195    // call actual decoding function
    176196    Bool bNewPicture = false;
    177197    Bool bNewPOC = false;
     198
    178199    if (nalUnit.empty())
    179200    {
     
    207228           * [1] except for the first NAL unit in the file
    208229           *     (but bNewPicture doesn't happen then) */
     230#if RExt__DECODER_DEBUG_BIT_STATISTICS
     231          bitstreamFile.seekg(location);
     232          bytestream.reset();
     233          TComCodingStatistics::SetStatistics(backupStats);
     234#else
    209235          bitstreamFile.seekg(location-streamoff(3));
    210236          bytestream.reset();
     237#endif
    211238        }
    212239#if POC_RESET_IDC_DECODER
     
    218245          bitstreamFile.seekg(location);
    219246          bytestream.reset();
     247#if RExt__DECODER_DEBUG_BIT_STATISTICS
     248          TComCodingStatistics::SetStatistics(backupStats);
     249#endif
    220250        }
    221251#endif
     
    224254
    225255#if POC_RESET_IDC_DECODER
    226     if ((bNewPicture && m_acTDecTop[nalu.m_layerId].getParseIdc() == 3) || (m_acTDecTop[nalu.m_layerId].getParseIdc() == 0) || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS)
    227 #else
    228     if (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS)
     256    if ( (bNewPicture && m_acTDecTop[nalu.m_layerId].getParseIdc() == 3) || (m_acTDecTop[nalu.m_layerId].getParseIdc() == 0) || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS &&
     257        !m_acTDecTop[nalu.m_layerId].getFirstSliceInSequence() )
     258#else
     259    if (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS &&
     260        !m_acTDecTop[nalu.m_layerId].getFirstSliceInSequence() )
    229261#endif
    230262    {
    231263#if O0194_DIFFERENT_BITDEPTH_EL_BL
    232264      //Bug fix: The bit depth was not set correctly for each layer when doing DBF
    233       g_bitDepthY = g_bitDepthYLayer[curLayerId];
    234       g_bitDepthC = g_bitDepthCLayer[curLayerId];
     265      g_bitDepth[CHANNEL_TYPE_LUMA]   = g_bitDepthLayer[CHANNEL_TYPE_LUMA][curLayerId];
     266      g_bitDepth[CHANNEL_TYPE_CHROMA] = g_bitDepthLayer[CHANNEL_TYPE_CHROMA][curLayerId];
    235267#endif
    236268      if (!loopFiltered[curLayerId] || bitstreamFile)
     
    242274      m_acTDecTop[curLayerId].earlyPicMarking(m_iMaxTemporalLayer, m_targetDecLayerIdSet);
    243275#endif
     276      if (nalu.m_nalUnitType == NAL_UNIT_EOS)
     277      {
     278        m_acTDecTop[nalu.m_layerId].setFirstSliceInSequence(true);
     279      }
     280    }
     281    else if ( (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS ) &&
     282              m_acTDecTop[nalu.m_layerId].getFirstSliceInSequence () )
     283    {
     284      m_acTDecTop[nalu.m_layerId].setFirstSliceInPicture (true);
    244285    }
    245286
     
    255296      if ( m_pchReconFile[curLayerId] && !openedReconFile[curLayerId] )
    256297      {
    257         if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; }
    258         if (!m_outputBitDepthC) { m_outputBitDepthC = g_bitDepthC; }
    259 
    260         m_acTVideoIOYuvReconFile[curLayerId].open( m_pchReconFile[curLayerId], true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode
     298        for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
     299        {
     300          if (m_outputBitDepth[channelType] == 0) m_outputBitDepth[channelType] = g_bitDepth[channelType];
     301        }
     302        m_acTVideoIOYuvReconFile[curLayerId].open( m_pchReconFile[curLayerId], true, m_outputBitDepth, m_outputBitDepth, g_bitDepth ); // write mode
    261303
    262304        openedReconFile[curLayerId] = true;
     
    373415  InputByteStream bytestream(bitstreamFile);
    374416
     417  if (!m_outputDecodedSEIMessagesFilename.empty() && m_outputDecodedSEIMessagesFilename!="-")
     418  {
     419    m_seiMessageFileStream.open(m_outputDecodedSEIMessagesFilename.c_str(), std::ios::out);
     420    if (!m_seiMessageFileStream.is_open() || !m_seiMessageFileStream.good())
     421    {
     422      fprintf(stderr, "\nUnable to open file `%s' for writing decoded SEI messages\n", m_outputDecodedSEIMessagesFilename.c_str());
     423      exit(EXIT_FAILURE);
     424    }
     425  }
     426
    375427  // create & initialize internal classes
    376428  xCreateDecLib();
     
    388440     * requires the TDecTop::decode() method to be called again with the same
    389441     * nal unit. */
     442#if RExt__DECODER_DEBUG_BIT_STATISTICS
     443    TComCodingStatistics::TComCodingStatisticsData backupStats(TComCodingStatistics::GetStatistics());
     444    streampos location = bitstreamFile.tellg() - streampos(bytestream.GetNumBufferedBytes());
     445#else
    390446    streampos location = bitstreamFile.tellg();
     447#endif
    391448    AnnexBStats stats = AnnexBStats();
    392449
     
    411468      if( (m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) || !isNaluWithinTargetDecLayerIdSet(&nalu)  )
    412469      {
    413           bNewPicture = false;
    414         }
     470        bNewPicture = false;
     471      }
    415472      else
    416473      {
     
    423480           * [1] except for the first NAL unit in the file
    424481           *     (but bNewPicture doesn't happen then) */
     482#if RExt__DECODER_DEBUG_BIT_STATISTICS
     483          bitstreamFile.seekg(location);
     484          bytestream.reset();
     485          TComCodingStatistics::SetStatistics(backupStats);
     486#else
    425487          bitstreamFile.seekg(location-streamoff(3));
    426488          bytestream.reset();
    427         }
    428       }
    429     }
    430     if (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS)
     489#endif
     490        }
     491      }
     492    }
     493
     494    if ( (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS) &&
     495        !m_cTDecTop.getFirstSliceInSequence () )
    431496    {
    432497      if (!loopFiltered || bitstreamFile)
     
    435500      }
    436501      loopFiltered = (nalu.m_nalUnitType == NAL_UNIT_EOS);
    437     }
    438 #if !FIX_WRITING_OUTPUT
    439 #if SETTING_NO_OUT_PIC_PRIOR
    440     if (bNewPicture && m_cTDecTop.getNoOutputPriorPicsFlag())
    441     {
    442       m_cTDecTop.checkNoOutputPriorPics( pcListPic );
    443     }
    444 #endif
    445 #endif
     502      if (nalu.m_nalUnitType == NAL_UNIT_EOS)
     503      {
     504        m_cTDecTop.setFirstSliceInSequence(true);
     505      }
     506    }
     507    else if ( (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS ) &&
     508              m_cTDecTop.getFirstSliceInSequence () )
     509    {
     510      m_cTDecTop.setFirstSliceInPicture (true);
     511    }
    446512
    447513    if( pcListPic )
     
    449515      if ( m_pchReconFile && !openedReconFile )
    450516      {
    451         if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; }
    452         if (!m_outputBitDepthC) { m_outputBitDepthC = g_bitDepthC; }
    453 
    454         m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode
     517        for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
     518        {
     519          if (m_outputBitDepth[channelType] == 0) m_outputBitDepth[channelType] = g_bitDepth[channelType];
     520        }
     521
     522        m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepth, m_outputBitDepth, g_bitDepth ); // write mode
    455523        openedReconFile = true;
    456524      }
    457 #if FIX_WRITING_OUTPUT
    458525      // write reconstruction to file
    459526      if( bNewPicture )
     
    461528        xWriteOutput( pcListPic, nalu.m_temporalId );
    462529      }
    463 #if SETTING_NO_OUT_PIC_PRIOR
    464530      if ( (bNewPicture || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA) && m_cTDecTop.getNoOutputPriorPicsFlag() )
    465531      {
     
    467533        m_cTDecTop.setNoOutputPriorPicsFlag (false);
    468534      }
    469 #endif
    470 #endif
    471535      if ( bNewPicture &&
    472536           (   nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL
     
    480544      if (nalu.m_nalUnitType == NAL_UNIT_EOS)
    481545      {
    482 #if FIX_OUTPUT_EOS
    483546        xWriteOutput( pcListPic, nalu.m_temporalId );
    484 #else
    485         xFlushOutput( pcListPic );       
    486 #endif
     547        m_cTDecTop.setFirstSliceInPicture (false);
    487548      }
    488549      // write reconstruction to file -- for additional bumping as defined in C.5.2.3
    489 #if FIX_WRITING_OUTPUT
    490550      if(!bNewPicture && nalu.m_nalUnitType >= NAL_UNIT_CODED_SLICE_TRAIL_N && nalu.m_nalUnitType <= NAL_UNIT_RESERVED_VCL31)
    491 #else
    492       if(bNewPicture)
    493 #endif
    494551      {
    495552        xWriteOutput( pcListPic, nalu.m_temporalId );
     
    579636  m_cTDecTop.init();
    580637  m_cTDecTop.setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled);
     638#if O0043_BEST_EFFORT_DECODING
     639  m_cTDecTop.setForceDecodeBitDepth(m_forceDecodeBitDepth);
     640#endif
     641  if (!m_outputDecodedSEIMessagesFilename.empty())
     642  {
     643    std::ostream &os=m_seiMessageFileStream.is_open() ? m_seiMessageFileStream : std::cout;
     644    m_cTDecTop.setDecodedSEIMessageOutputStream(&os);
     645  }
    581646#if Q0074_COLOUR_REMAPPING_SEI
    582647  m_cTDecTop.setColourRemappingInfoSEIEnabled(m_colourRemapSEIEnabled);
     
    631696#endif
    632697    {
    633       numPicsNotYetDisplayed++;
     698       numPicsNotYetDisplayed++;
    634699      dpbFullness++;
    635700    }
     
    640705    iterPic++;
    641706  }
    642   iterPic   = pcListPic->begin();
     707
     708  iterPic = pcListPic->begin();
     709
    643710  if (numPicsNotYetDisplayed>2)
    644711  {
     
    678745          const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
    679746          const Bool isTff = pcPicTop->isTopField();
    680           TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec();
    681           TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec();
     747
     748          Bool display = true;
     749          if( m_decodedNoDisplaySEIEnabled )
     750          {
     751            SEIMessages noDisplay = getSeisByType(pcPic->getSEIs(), SEI::NO_DISPLAY );
     752            const SEINoDisplay *nd = ( noDisplay.size() > 0 ) ? (SEINoDisplay*) *(noDisplay.begin()) : NULL;
     753            if( (nd != NULL) && nd->m_noDisplay )
     754            {
     755              display = false;
     756            }
     757          }
     758
     759          if (display)
     760          {           
    682761#if REPN_FORMAT_IN_VPS
    683           UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
    684           Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
    685 
    686           m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRecTop, pPicCYuvRecBot,
    687             conf.getWindowLeftOffset()  * xScal + defDisp.getWindowLeftOffset(),
    688             conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(),
    689             conf.getWindowTopOffset()   * yScal + defDisp.getWindowTopOffset(),
    690             conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset(), isTff );
    691 #else
    692           m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRecTop, pPicCYuvRecBot,
    693             conf.getWindowLeftOffset()   + defDisp.getWindowLeftOffset(),
    694             conf.getWindowRightOffset()  + defDisp.getWindowRightOffset(),
    695             conf.getWindowTopOffset()    + defDisp.getWindowTopOffset(),
    696             conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );
    697 #endif
     762            UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
     763            Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
     764
     765            m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     766              m_outputColourSpaceConvert,
     767              conf.getWindowLeftOffset()  * xScal + defDisp.getWindowLeftOffset(),
     768              conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(),
     769              conf.getWindowTopOffset()   * yScal + defDisp.getWindowTopOffset(),
     770              conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset(), NUM_CHROMA_FORMAT, isTff );
     771#else
     772            m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     773              m_outputColourSpaceConvert,
     774              conf.getWindowLeftOffset()   + defDisp.getWindowLeftOffset(),
     775              conf.getWindowRightOffset()  + defDisp.getWindowRightOffset(),
     776              conf.getWindowTopOffset()    + defDisp.getWindowTopOffset(),
     777              conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), NUM_CHROMA_FORMAT, isTff );
     778#endif
     779          }
    698780        }
    699781
     
    706788          const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
    707789          const Bool isTff = pcPicTop->isTopField();
    708           TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec();
    709           TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec();
    710           m_cTVideoIOYuvReconFile.write( pPicCYuvRecTop, pPicCYuvRecBot,
    711             conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    712             conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    713             conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    714             conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );
     790
     791          Bool display = true;
     792          if( m_decodedNoDisplaySEIEnabled )
     793          {
     794            SEIMessages noDisplay = getSeisByType(pcPic->getSEIs(), SEI::NO_DISPLAY );
     795            const SEINoDisplay *nd = ( noDisplay.size() > 0 ) ? (SEINoDisplay*) *(noDisplay.begin()) : NULL;
     796            if( (nd != NULL) && nd->m_noDisplay )
     797            {
     798              display = false;
     799            }
     800          }
     801
     802          if (display)
     803          {
     804            m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     805                                           m_outputColourSpaceConvert,
     806                                           conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     807                                           conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     808                                           conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     809                                           conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), NUM_CHROMA_FORMAT, isTff );
     810          }
    715811        }
    716812
     
    758854  {
    759855    iterPic = pcListPic->begin();
     856
    760857    while (iterPic != pcListPic->end())
    761858    {
     
    771868      {
    772869        // write to file
    773         numPicsNotYetDisplayed--;
     870         numPicsNotYetDisplayed--;
    774871        if(pcPic->getSlice(0)->isReferenced() == false)
    775872        {
     
    780877        {
    781878          const Window &conf = pcPic->getConformanceWindow();
    782           const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    783           TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec();
     879          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();         
    784880#if REPN_FORMAT_IN_VPS
    785881          UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
    786882          Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
    787883
    788           m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRec,
     884          m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(), m_outputColourSpaceConvert,
    789885            conf.getWindowLeftOffset()  * xScal + defDisp.getWindowLeftOffset(),
    790886            conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(),
     
    792888            conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset() );
    793889#else
    794           m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRec,
     890          m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(), m_outputColourSpaceConvert,
    795891            conf.getWindowLeftOffset()   + defDisp.getWindowLeftOffset(),
    796892            conf.getWindowRightOffset()  + defDisp.getWindowRightOffset(),
     
    805901        if ( m_pchReconFile )
    806902        {
    807           const Window &conf = pcPic->getConformanceWindow();
     903          const Window &conf    = pcPic->getConformanceWindow();
    808904          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
     905
    809906          m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
    810                                         conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    811                                         conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    812                                         conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    813                                         conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
     907                                         m_outputColourSpaceConvert,
     908                                         conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     909                                         conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     910                                         conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     911                                         conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
    814912        }
    815913
     
    879977          const Window &conf = pcPicTop->getConformanceWindow();
    880978          const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
    881           const Bool isTff = pcPicTop->isTopField();
    882           TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec();
    883           TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec();
     979          const Bool isTff = pcPicTop->isTopField();         
    884980#if REPN_FORMAT_IN_VPS
    885981          UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
    886982          Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
    887983
    888           m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRecTop, pPicCYuvRecBot,
     984          m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), m_outputColourSpaceConvert,
    889985            conf.getWindowLeftOffset()  *xScal + defDisp.getWindowLeftOffset(),
    890986            conf.getWindowRightOffset() *xScal + defDisp.getWindowRightOffset(),
    891987            conf.getWindowTopOffset()   *yScal + defDisp.getWindowTopOffset(),
    892             conf.getWindowBottomOffset()*yScal + defDisp.getWindowBottomOffset(), isTff );
    893 #else
    894           m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRecTop, pPicCYuvRecBot,
     988            conf.getWindowBottomOffset()*yScal + defDisp.getWindowBottomOffset(), NUM_CHROMA_FORMAT, isTff );
     989#else
     990          m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), m_outputColourSpaceConvert,
    895991            conf.getWindowLeftOffset()   + defDisp.getWindowLeftOffset(),
    896992            conf.getWindowRightOffset()  + defDisp.getWindowRightOffset(),
    897993            conf.getWindowTopOffset()    + defDisp.getWindowTopOffset(),
    898             conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );
     994            conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), NUM_CHROMA_FORMAT, isTff );
    899995#endif
    900996        }
     
    9081004          const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
    9091005          const Bool isTff = pcPicTop->isTopField();
    910           TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec();
    911           TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec();
    912           m_cTVideoIOYuvReconFile.write( pPicCYuvRecTop, pPicCYuvRecBot,
    913             conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    914             conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    915             conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    916             conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );
     1006          m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     1007                                         m_outputColourSpaceConvert,
     1008                                         conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     1009                                         conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     1010                                         conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     1011                                         conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), NUM_CHROMA_FORMAT, isTff );
    9171012        }
    9181013
     
    9851080        {
    9861081          const Window &conf = pcPic->getConformanceWindow();
    987           const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    988           TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec();
     1082          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();         
    9891083#if REPN_FORMAT_IN_VPS
    9901084          UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
    9911085          Int xScal =  TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );
    9921086
    993           m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRec,
     1087          m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(), m_outputColourSpaceConvert,
    9941088            conf.getWindowLeftOffset()  *xScal + defDisp.getWindowLeftOffset(),
    9951089            conf.getWindowRightOffset() *xScal + defDisp.getWindowRightOffset(),
     
    9971091            conf.getWindowBottomOffset()*yScal + defDisp.getWindowBottomOffset() );
    9981092#else
    999           m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRec,
     1093          m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(), m_outputColourSpaceConvert,
    10001094            conf.getWindowLeftOffset()   + defDisp.getWindowLeftOffset(),
    10011095            conf.getWindowRightOffset()  + defDisp.getWindowRightOffset(),
     
    10101104        if ( m_pchReconFile )
    10111105        {
    1012           const Window &conf = pcPic->getConformanceWindow();
     1106          const Window &conf    = pcPic->getConformanceWindow();
    10131107          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    1014           TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec();
    1015           m_cTVideoIOYuvReconFile.write( pPicCYuvRec,
    1016             conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    1017             conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    1018             conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    1019             conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
     1108
     1109          m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
     1110                                         m_outputColourSpaceConvert,
     1111                                         conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     1112                                         conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     1113                                         conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     1114                                         conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
    10201115        }
    10211116
     
    10951190#endif
    10961191    TComPicYuv* pPicCYuvRec = pic->getPicYuvRec();
    1097     m_acTVideoIOYuvReconFile[layerIdx].write( pPicCYuvRec,
     1192    m_acTVideoIOYuvReconFile[layerIdx].write( pPicCYuvRec, m_outputColourSpaceConvert,
    10981193      conf.getWindowLeftOffset()  * xScal + defDisp.getWindowLeftOffset(),
    10991194      conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(),
  • branches/SHM-upgrade/source/App/TAppDecoder/TAppDecTop.h

    r845 r916  
    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 *
    66 * Copyright (c) 2010-2014, ITU/ISO/IEC
     
    7878  Int                             m_iPOCLastDisplay;              ///< last POC in display order
    7979#endif
    80  
     80  std::ofstream                   m_seiMessageFileStream;         ///< Used for outputing SEI messages. 
     81
    8182public:
    8283  TAppDecTop();
    8384  virtual ~TAppDecTop() {}
    84  
     85
    8586  Void  create            (); ///< create internal members
    8687  Void  destroy           (); ///< destroy internal members
    8788  Void  decode            (); ///< main decoding function
    88  
     89
    8990protected:
    9091  Void  xCreateDecLib     (); ///< create internal classes
  • branches/SHM-upgrade/source/App/TAppDecoder/decmain.cpp

    r595 r916  
    4444//! \{
    4545
    46 bool g_md5_mismatch = false; ///< top level flag that indicates if there has been a decoding mismatch
     46Bool g_md5_mismatch = false; ///< top level flag that indicates if there has been a decoding mismatch
    4747
    4848// ====================================================================================================================
     
    5959  fprintf( stdout, "SHM software: Decoder Version [%s]", NV_VERSION );
    6060#else
    61   fprintf( stdout, "HM software: Decoder Version [%s]", NV_VERSION );
     61  fprintf( stdout, "HM software: Decoder Version [%s] (including RExt)", NV_VERSION );
    6262#endif
    6363  fprintf( stdout, NVM_ONOS );
     
    7777
    7878  // starting time
    79   double dResult;
    80   long lBefore = clock();
     79  Double dResult;
     80  clock_t lBefore = clock();
    8181
    8282  // call decoding function
     
    8989
    9090  // ending time
    91   dResult = (double)(clock()-lBefore) / CLOCKS_PER_SEC;
     91  dResult = (Double)(clock()-lBefore) / CLOCKS_PER_SEC;
    9292  printf("\n Total Time: %12.3f sec.\n", dResult);
    9393
Note: See TracChangeset for help on using the changeset viewer.