Changeset 608 in 3DVCSoftware for trunk/source/App/TAppDecoder/TAppDecCfg.cpp


Ignore:
Timestamp:
1 Sep 2013, 22:47:26 (11 years ago)
Author:
tech
Message:

Merged DEV-2.0-dev0@604.

File:
1 edited

Legend:

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

    r121 r608  
    44 * granted under this license. 
    55 *
    6  * Copyright (c) 2010-2012, ITU/ISO/IEC
     6 * Copyright (c) 2010-2013, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    4242#include "TAppCommon/program_options_lite.h"
    4343
     44#if H_MV
     45#include <cassert>
     46#endif
    4447#ifdef WIN32
    4548#define strdup _strdup
     
    6164Bool TAppDecCfg::parseCfg( Int argc, Char* argv[] )
    6265{
    63   bool do_help = false;
     66  Bool do_help = false;
    6467  string cfg_BitstreamFile;
    6568  string cfg_ReconFile;
     69  string cfg_TargetDecLayerIdSetFile;
     70#if H_3D
    6671  string cfg_ScaleOffsetFile;
     72#endif
    6773
    6874  po::Options opts;
     
    7278  ("ReconFile,o",     cfg_ReconFile,     string(""), "reconstructed YUV output file name\n"
    7379                                                     "YUV writing is skipped if omitted")
     80#if H_3D
    7481  ("ScaleOffsetFile,p", cfg_ScaleOffsetFile, string(""), "file with coded scales and offsets")
     82#endif
    7583  ("SkipFrames,s", m_iSkipFrame, 0, "number of frames to skip before random access")
    76   ("OutputBitDepth,d", m_outputBitDepth, 0u, "bit depth of YUV output file (use 0 for native depth)")
     84  ("OutputBitDepth,d", m_outputBitDepthY, 0, "bit depth of YUV output luma component (default: use 0 for native depth)")
     85  ("OutputBitDepthC,d", m_outputBitDepthC, 0, "bit depth of YUV output chroma component (default: use 0 for native depth)")
     86#if H_MV
     87  ("MaxLayerId,-ls", m_maxLayerId, MAX_NUM_LAYER_IDS-1, "Maximum LayerId to be decoded.")
     88#endif
    7789  ("MaxTemporalLayer,t", m_iMaxTemporalLayer, -1, "Maximum Temporal Layer to be decoded. -1 to decode all layers")
    78   ("SEIpictureDigest", m_pictureDigestEnabled, true, "Control handling of picture_digest SEI messages\n"
    79                                               "\t1: check\n"
    80                                               "\t0: ignore")
     90  ("SEIDecodedPictureHash", m_decodedPictureHashSEIEnabled, 1, "Control handling of decoded picture hash SEI messages\n"
     91                                              "\t1: check hash in SEI messages if available in the bitstream\n"
     92                                              "\t0: ignore SEI message")
     93  ("SEIpictureDigest", m_decodedPictureHashSEIEnabled, 1, "deprecated alias for SEIDecodedPictureHash")
     94  ("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.")
     95  ("RespectDefDispWindow,w", m_respectDefDispWindow, 0, "Only output content inside the default display window\n")
    8196  ;
     97  po::setDefaults(opts);
     98  const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv);
    8299
    83   po::setDefaults(opts);
    84   const list<const char*>& argv_unhandled = po::scanArgv(opts, argc, (const char**) argv);
    85 
    86   for (list<const char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++)
     100  for (list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++)
    87101  {
    88102    fprintf(stderr, "Unhandled argument ignored: `%s'\n", *it);
     
    98112  m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str());
    99113  m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str());
     114
     115#if H_3D
    100116  m_pchScaleOffsetFile = cfg_ScaleOffsetFile.empty() ? NULL : strdup(cfg_ScaleOffsetFile.c_str());
    101 
    102 
     117#endif
    103118  if (!m_pchBitstreamFile)
    104119  {
    105     fprintf(stderr, "No input file specified, aborting\n");
     120    fprintf(stderr, "No input file specifed, aborting\n");
    106121    return false;
    107122  }
     123
     124  if ( !cfg_TargetDecLayerIdSetFile.empty() )
     125  {
     126    FILE* targetDecLayerIdSetFile = fopen ( cfg_TargetDecLayerIdSetFile.c_str(), "r" );
     127    if ( targetDecLayerIdSetFile )
     128    {
     129      Bool isLayerIdZeroIncluded = false;
     130      while ( !feof(targetDecLayerIdSetFile) )
     131      {
     132        Int layerIdParsed = 0;
     133        if ( fscanf( targetDecLayerIdSetFile, "%d ", &layerIdParsed ) != 1 )
     134        {
     135          if ( m_targetDecLayerIdSet.size() == 0 )
     136          {
     137            fprintf(stderr, "No LayerId could be parsed in file %s. Decoding all LayerIds as default.\n", cfg_TargetDecLayerIdSetFile.c_str() );
     138          }
     139          break;
     140        }
     141        if ( layerIdParsed  == -1 ) // The file includes a -1, which means all LayerIds are to be decoded.
     142        {
     143          m_targetDecLayerIdSet.clear(); // Empty set means decoding all layers.
     144          break;
     145        }
     146        if ( layerIdParsed < 0 || layerIdParsed >= MAX_NUM_LAYER_IDS )
     147        {
     148          fprintf(stderr, "Warning! Parsed LayerId %d is not withing allowed range [0,%d]. Ignoring this value.\n", layerIdParsed, MAX_NUM_LAYER_IDS-1 );
     149        }
     150        else
     151        {
     152          isLayerIdZeroIncluded = layerIdParsed == 0 ? true : isLayerIdZeroIncluded;
     153          m_targetDecLayerIdSet.push_back ( layerIdParsed );
     154        }
     155      }
     156      fclose (targetDecLayerIdSetFile);
     157      if ( m_targetDecLayerIdSet.size() > 0 && !isLayerIdZeroIncluded )
     158      {
     159        fprintf(stderr, "TargetDecLayerIdSet must contain LayerId=0, aborting" );
     160        return false;
     161      }
     162    }
     163    else
     164    {
     165      fprintf(stderr, "File %s could not be opened. Using all LayerIds as default.\n", cfg_TargetDecLayerIdSetFile.c_str() );
     166    }
     167  }
     168#if H_MV
     169  else
     170  {
     171    for ( Int curLayerId = 0; curLayerId <= m_maxLayerId; curLayerId++ )
     172    {
     173      m_targetDecLayerIdSet.push_back( curLayerId );
     174    }
     175  }
     176#endif
    108177
    109178  return true;
    110179}
    111180
     181#if H_MV
    112182Void TAppDecCfg::xAppendToFileNameEnd( Char* pchInputFileName, const Char* pchStringToAppend, Char*& rpchOutputFileName)
    113183{
     
    125195  rpchOutputFileName[iInLength+iAppendLength] = '\0';         
    126196}
    127 
     197#endif
    128198//! \}
Note: See TracChangeset for help on using the changeset viewer.