Changeset 1442 in SHVCSoftware for branches/SHM-dev/source/App/TAppDecoder


Ignore:
Timestamp:
13 Aug 2015, 19:11:53 (9 years ago)
Author:
seregin
Message:

port rev 4590

Location:
branches/SHM-dev/source/App/TAppDecoder
Files:
4 edited

Legend:

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

    r1377 r1442  
    6363    \param argv array of arguments
    6464 */
    65 Bool TAppDecCfg::parseCfg( Int argc, Char* argv[] )
     65Bool TAppDecCfg::parseCfg( Int argc, TChar* argv[] )
    6666{
    6767  Bool do_help = false;
    68   string cfg_BitstreamFile;
    69 #if SVC_EXTENSION
    70   string cfg_ReconFile [MAX_LAYERS];
     68#if SVC_EXTENSION 
    7169  Int layerNum, targetLayerId;
    7270  Int olsIdx;
     
    7472  string cfg_confPrefix;
    7573#endif
    76 #if AVC_BASE
    77   string cfg_BLReconFile;
    78 #endif
    79 #else
    80   string cfg_ReconFile;
    8174#endif
    8275
     
    9083
    9184  ("help",                      do_help,                               false,      "this help text")
    92   ("BitstreamFile,b",           cfg_BitstreamFile,                     string(""), "bitstream input file name")
    93 #if SVC_EXTENSION
    94   ("ReconFileL%d,-o%d",                   cfg_ReconFile,   string(""), MAX_LAYERS, "Layer %d reconstructed YUV output file name\n"
     85  ("BitstreamFile,b",           m_bitstreamFileName,                   string(""), "bitstream input file name")
     86#if SVC_EXTENSION
     87  ("ReconFileL%d,-o%d",                 m_reconFileName,   string(""), MAX_LAYERS, "Layer %d reconstructed YUV output file name\n"
    9588                                                                                   "YUV writing is skipped if omitted")
    9689#if AVC_BASE
    97   ("BLReconFile,-ibl",                               cfg_BLReconFile, string(""), "BL reconstructed YUV input file name")
     90  ("BLReconFile,-ibl",                              m_reconFileNameBL, string(""), "BL reconstructed YUV input file name")
    9891#endif
    9992  ("TargetLayerId,-lid",                                        targetLayerId, -1, "Target layer id")
     
    10598#endif
    10699#else
    107   ("ReconFile,o",               cfg_ReconFile,                         string(""), "reconstructed YUV output file name\n"
     100  ("ReconFile,o",               m_reconFileName,                       string(""), "reconstructed YUV output file name\n"
    108101                                                                                   "YUV writing is skipped if omitted")
    109102#endif
     
    134127  po::setDefaults(opts);
    135128  po::ErrorReporter err;
    136   const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv, err);
    137 
    138   for (list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++)
     129  const list<const TChar*>& argv_unhandled = po::scanArgv(opts, argc, (const TChar**) argv, err);
     130
     131  for (list<const TChar*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++)
    139132  {
    140133    fprintf(stderr, "Unhandled argument ignored: `%s'\n", *it);
     
    163156  }
    164157
    165   /* convert std::string to c string for compatability */
    166   m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str());
    167158#if SVC_EXTENSION
    168159  if( targetLayerId < 0 )
     
    204195  m_commonDecoderParams.setTargetOutputLayerSetIdx( olsIdx );
    205196  m_commonDecoderParams.setTargetLayerId( targetLayerId );
    206 
    207 #if CONFORMANCE_BITSTREAM_MODE
    208   for(Int layer = 0; layer < MAX_VPS_LAYER_IDX_PLUS1; layer++ )
    209   {
    210 #else
    211   for(UInt layer=0; layer<= m_tgtLayerId; layer++)
    212   {
    213     assert( layer < MAX_LAYERS );
    214 #endif
    215     m_pchReconFile[layer] = cfg_ReconFile[layer].empty() ? NULL : strdup(cfg_ReconFile[layer].c_str());
    216   }
    217 #if AVC_BASE
    218   m_pchBLReconFile = cfg_BLReconFile.empty() ? NULL : strdup(cfg_BLReconFile.c_str());
    219 #endif
    220 #else
    221   m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str());
    222 #endif
    223 
    224   if (!m_pchBitstreamFile)
     197#endif
     198
     199  if (m_bitstreamFileName.empty())
    225200  {
    226201    fprintf(stderr, "No input file specified, aborting\n");
  • branches/SHM-dev/source/App/TAppDecoder/TAppDecCfg.h

    r1323 r1442  
    5757{
    5858protected:
    59   Char*         m_pchBitstreamFile;                     ///< input bitstream file name
     59  std::string   m_bitstreamFileName;                    ///< input bitstream file name
    6060#if SVC_EXTENSION
    61   Char*         m_pchReconFile [MAX_LAYERS];          ///< output reconstruction file name
     61  std::string   m_reconFileName[MAX_LAYERS];            ///< output reconstruction file name
    6262#else
    63   Char*         m_pchReconFile;                         ///< output reconstruction file name
     63  std::string   m_reconFileName;                        ///< output reconstruction file name
    6464#endif
    6565  Int           m_iSkipFrame;                           ///< counter for frames prior to the random access point to skip
     
    8484#if SVC_EXTENSION
    8585#if AVC_BASE
    86   Char*         m_pchBLReconFile;                     ///< input BL reconstruction file name
     86  std::string   m_reconFileNameBL;                     ///< input BL reconstruction file name
    8787#endif
    8888  CommonDecoderParams             m_commonDecoderParams;
     
    9999public:
    100100  TAppDecCfg()
    101   : m_pchBitstreamFile(NULL)
     101  : m_bitstreamFileName()
    102102#if !SVC_EXTENSION
    103   , m_pchReconFile(NULL)
     103  , m_reconFileName()
    104104#endif
    105105  , m_iSkipFrame(0)
     106  // m_outputBitDepth array initialised below
    106107  , m_outputColourSpaceConvert(IPCOLOURSPACE_UNCHANGED)
    107108  , m_iMaxTemporalLayer(-1)
    108109  , m_decodedPictureHashSEIEnabled(0)
    109110  , m_decodedNoDisplaySEIEnabled(false)
     111  , m_targetDecLayerIdSet()
    110112#if Q0074_COLOUR_REMAPPING_SEI
    111113  , m_colourRemapSEIEnabled(0)
     
    115117  , m_forceDecodeBitDepth(0)
    116118#endif
     119  , m_outputDecodedSEIMessagesFilename()
     120  , m_bClipOutputVideoToRec709Range(false)
    117121  {
    118122    for (UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)
     
    124128  virtual ~TAppDecCfg() {}
    125129
    126   Bool  parseCfg        ( Int argc, Char* argv[] );   ///< initialize option class from configuration
     130  Bool  parseCfg        ( Int argc, TChar* argv[] );   ///< initialize option class from configuration
    127131
    128132#if SVC_EXTENSION
  • branches/SHM-dev/source/App/TAppDecoder/TAppDecTop.cpp

    r1420 r1442  
    9090Void TAppDecTop::destroy()
    9191{
    92   if (m_pchBitstreamFile)
    93   {
    94     free (m_pchBitstreamFile);
    95     m_pchBitstreamFile = NULL;
    96   }
     92  m_bitstreamFileName.clear();
    9793#if SVC_EXTENSION
    9894#if CONFORMANCE_BITSTREAM_MODE
     
    10298#endif
    10399  {
    104     if( m_pchReconFile[i] )
    105     {
    106       free ( m_pchReconFile[i] );
    107       m_pchReconFile[i] = NULL;
    108     }
     100    m_reconFileName[i].clear();
    109101
    110102    if( m_apcTDecTop[i] )
     
    121113  }
    122114#if AVC_BASE
    123   if( m_pchBLReconFile )
    124   {
    125     free ( m_pchBLReconFile );
    126     m_pchBLReconFile = NULL;
    127   }
    128 #endif
    129 #else
    130   if (m_pchReconFile)
    131   {
    132     free (m_pchReconFile);
    133     m_pchReconFile = NULL;
    134   }
     115  m_reconFileNameBL.clear();
     116#endif
     117#else
     118  m_reconFileName.clear();
    135119#endif
    136120#if Q0074_COLOUR_REMAPPING_SEI
     
    160144  TComList<TComPic*>* pcListPic = NULL;
    161145
    162   ifstream bitstreamFile(m_pchBitstreamFile, ifstream::in | ifstream::binary);
     146  ifstream bitstreamFile(m_bitstreamFileName.c_str(), ifstream::in | ifstream::binary);
    163147  if (!bitstreamFile)
    164148  {
    165     fprintf(stderr, "\nfailed to open bitstream file `%s' for reading\n", m_pchBitstreamFile);
     149    fprintf(stderr, "\nfailed to open bitstream file `%s' for reading\n", m_bitstreamFileName.c_str());
    166150    exit(EXIT_FAILURE);
    167151  }
     
    203187  TComPic pcBLPic;
    204188  fstream streamYUV;
    205   if( m_pchBLReconFile )
    206   {
    207     streamYUV.open( m_pchBLReconFile, fstream::in | fstream::binary );
     189  if( !m_reconFileNameBL.empty() )
     190  {
     191    streamYUV.open( m_reconFileNameBL, fstream::in | fstream::binary );
    208192  }
    209193  TComList<TComPic*> *cListPic = m_apcTDecTop[0]->getListPic();
     
    329313    if( pcListPic )
    330314    {
    331       if ( m_pchReconFile[curLayerId] && !openedReconFile[curLayerId] )
     315      if ( !m_reconFileName[curLayerId].empty() && !openedReconFile[curLayerId] )
    332316      {
    333317        const BitDepths &bitDepths=pcListPic->front()->getSlice(0)->getBitDepths(); // use bit depths of first reconstructed picture.
     
    339323          }
    340324        }
    341         m_apcTVideoIOYuvReconFile[curLayerId]->open( m_pchReconFile[curLayerId], true, m_outputBitDepth, m_outputBitDepth, bitDepths.recon ); // write mode
     325        m_apcTVideoIOYuvReconFile[curLayerId]->open( m_reconFileName[curLayerId], true, m_outputBitDepth, m_outputBitDepth, bitDepths.recon ); // write mode
    342326
    343327        openedReconFile[curLayerId] = true;
     
    442426  TComList<TComPic*>* pcListPic = NULL;
    443427
    444   ifstream bitstreamFile(m_pchBitstreamFile, ifstream::in | ifstream::binary);
     428  ifstream bitstreamFile(m_bitstreamFileName.c_str(), ifstream::in | ifstream::binary);
    445429  if (!bitstreamFile)
    446430  {
    447     fprintf(stderr, "\nfailed to open bitstream file `%s' for reading\n", m_pchBitstreamFile);
     431    fprintf(stderr, "\nfailed to open bitstream file `%s' for reading\n", m_bitstreamFileName.c_str());
    448432    exit(EXIT_FAILURE);
    449433  }
     
    548532    if( pcListPic )
    549533    {
    550       if ( m_pchReconFile && !openedReconFile )
     534      if ( (!m_reconFileName.empty()) && (!openedReconFile) )
    551535      {
    552536        const BitDepths &bitDepths=pcListPic->front()->getPicSym()->getSPS().getBitDepths(); // use bit depths of first reconstructed picture.
     
    559543        }
    560544
    561         m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepth, m_outputBitDepth, bitDepths.recon ); // write mode
     545        m_cTVideoIOYuvReconFile.open( m_reconFileName, true, m_outputBitDepth, m_outputBitDepth, bitDepths.recon ); // write mode
    562546        openedReconFile = true;
    563547      }
     
    648632#endif
    649633  {
    650     if ( m_pchReconFile[layer] )
     634    if ( !m_reconFileName[layer].empty() )
    651635    {
    652636      m_apcTVideoIOYuvReconFile[layer]->close();
     
    657641  }
    658642#else
    659   if ( m_pchReconFile )
    660   {
    661     m_cTVideoIOYuvReconFile. close();
     643  if ( !m_reconFileName.empty() )
     644  {
     645    m_cTVideoIOYuvReconFile.close();
    662646  }
    663647
     
    792776        numPicsNotYetDisplayed = numPicsNotYetDisplayed-2;
    793777#if SVC_EXTENSION
    794         if ( m_pchReconFile[layerId] )
     778        if ( !m_reconFileName[layerId].empty() )
    795779        {
    796780          const Window &conf = pcPicTop->getConformanceWindow();
     
    826810        m_aiPOCLastDisplay[layerId] = pcPicBottom->getPOC();
    827811#else
    828         if ( m_pchReconFile )
     812        if ( !m_reconFileName.empty() )
    829813        {
    830814          const Window &conf = pcPicTop->getConformanceWindow();
     
    901885        }
    902886#if SVC_EXTENSION
    903         if( m_pchReconFile[layerId] )
     887        if ( !m_reconFileName[layerId].empty() )
    904888        {
    905889          const Window &conf = pcPic->getConformanceWindow();
     
    920904        m_aiPOCLastDisplay[layerId] = pcPic->getPOC();
    921905#else
    922         if ( m_pchReconFile )
     906        if ( !m_reconFileName.empty() )
    923907        {
    924908          const Window &conf    = pcPic->getConformanceWindow();
     
    10241008        // write to file
    10251009#if SVC_EXTENSION
    1026         if ( m_pchReconFile[layerId] )
     1010        if ( !m_reconFileName[layerId].empty() )
    10271011        {
    10281012          const Window &conf = pcPicTop->getConformanceWindow();
     
    10431027        m_aiPOCLastDisplay[layerId] = pcPicBottom->getPOC();
    10441028#else
    1045         if ( m_pchReconFile )
     1029        if ( !m_reconFileName.empty() )
    10461030        {
    10471031          const Window &conf = pcPicTop->getConformanceWindow();
     
    11031087        // write to file
    11041088#if SVC_EXTENSION
    1105         if ( m_pchReconFile[layerId] )
     1089        if ( !m_reconFileName[layerId].empty() )
    11061090        {
    11071091          const Window &conf = pcPic->getConformanceWindow();
     
    11231107        m_aiPOCLastDisplay[layerId] = pcPic->getPOC();
    11241108#else
    1125         if ( m_pchReconFile )
     1109        if ( !m_reconFileName.empty() )
    11261110        {
    11271111          const Window &conf    = pcPic->getConformanceWindow();
     
    12341218#if ALIGNED_BUMPING
    12351219// Function outputs a picture, and marks it as not needed for output.
    1236 Void TAppDecTop::xOutputAndMarkPic( TComPic *pic, const Char *reconFile, const Int layerId, Int &pocLastDisplay, DpbStatus &dpbStatus )
    1237 {
    1238   if ( reconFile )
     1220Void TAppDecTop::xOutputAndMarkPic( TComPic *pic, std::string& reconFileName, const Int layerId, Int &pocLastDisplay, DpbStatus &dpbStatus )
     1221{
     1222  if( !reconFileName.empty() )
    12391223  {
    12401224    const Window &conf = pic->getConformanceWindow();
     
    14881472      TComPic *pic = *iterPic;
    14891473
    1490       xOutputAndMarkPic( pic, m_pchReconFile[layerId], layerId, m_aiPOCLastDisplay[layerId], dpbStatus );
     1474      xOutputAndMarkPic( pic, m_reconFileName[layerId], layerId, m_aiPOCLastDisplay[layerId], dpbStatus );
    14911475
    14921476#if CONFORMANCE_BITSTREAM_MODE
     
    19611945
    19621946    //Write remapped picture in decoding order
    1963     Char  cTemp[255];
     1947    TChar  cTemp[255];
    19641948    sprintf(cTemp, "seiColourRemappedPic_L%d_%dx%d_%dbits.yuv", layerId, iWidth, iHeight, storeCriSEI[layerId].m_colourRemapBitDepth );
    19651949    picColourRemapped.dump( cTemp, true, storeCriSEI[layerId].m_colourRemapBitDepth );
     
    19741958    if (storeCriSEI[layerId].m_colourRemapBitDepth == 8 || storeCriSEI[layerId].m_colourRemapBitDepth == 10)
    19751959    {
    1976       Char  cTemp[255];
     1960      TChar  cTemp[255];
    19771961      sprintf(cTemp, "seiColourRemappedPic_L%d_%dx%d_%dbits.yuv", layerId, pic.getWidth(COMPONENT_Y), pic.getHeight(COMPONENT_Y), storeCriSEI[layerId].m_colourRemapBitDepth );
    19781962      pic.dump( cTemp, true, storeCriSEI[layerId].m_colourRemapBitDepth );
  • branches/SHM-dev/source/App/TAppDecoder/TAppDecTop.h

    r1378 r1442  
    136136  Void flushAllPictures(Int layerId, Bool outputPictures);
    137137
    138   Void xOutputAndMarkPic( TComPic *pic, const Char *reconFile, const Int layerId, Int &pocLastDisplay, DpbStatus &dpbStatus);
     138  Void xOutputAndMarkPic( TComPic *pic, std::string& reconFileName, const Int layerId, Int &pocLastDisplay, DpbStatus &dpbStatus);
    139139  Void outputAllPictures(Int layerId, Bool notOutputCurrAu);
    140140  Void xFindDPBStatus( std::vector<Int> &listOfPocs
Note: See TracChangeset for help on using the changeset viewer.