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


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

Merged 14.1-update-dev1@1312.

File:
1 edited

Legend:

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

    r1179 r1313  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license. 
    5  *
    6 * Copyright (c) 2010-2015, ITU/ISO/IEC
     4 * granted under this license.
     5 *
     6 * Copyright (c) 2010-2015, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    4141#include "TAppDecCfg.h"
    4242#include "TAppCommon/program_options_lite.h"
    43 
    44 #if H_MV
    45 #include <cassert>
    46 #endif
     43#include "TLibCommon/TComChromaFormat.h"
    4744#ifdef WIN32
    4845#define strdup _strdup
     46#endif
     47#if NH_MV
     48#include <cassert>
    4949#endif
    5050
     
    6868  string cfg_ReconFile;
    6969  string cfg_TargetDecLayerIdSetFile;
    70 #if H_3D
     70#if NH_3D
    7171  string cfg_ScaleOffsetFile;
    7272#endif
     73  string outputColourSpaceConvert;
     74  Int warnUnknowParameter = 0;
    7375
    7476  po::Options opts;
    7577  opts.addOptions()
    76   ("help", do_help, false, "this help text")
    77   ("BitstreamFile,b", cfg_BitstreamFile, string(""), "bitstream input file name")
    78   ("ReconFile,o",     cfg_ReconFile,     string(""), "reconstructed YUV output file name\n"
    79                                                      "YUV writing is skipped if omitted")
    80 #if H_3D
    81   ("ScaleOffsetFile,p", cfg_ScaleOffsetFile, string(""), "file with coded scales and offsets")
    82 #endif
    83   ("SkipFrames,s", m_iSkipFrame, 0, "number of frames to skip before random access")
    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   ("TargetOptLayerSetIdx,x", m_targetOptLayerSetIdx, -1, "Target output layer set index. (default: -1, determine automatically to be equal to highest layer set index") // Should actually equal to 0 as default. However, this would cause only the base layer to be decoded. 
    88 #endif
    89   ("MaxTemporalLayer,t", m_iMaxTemporalLayer, -1, "Maximum Temporal Layer to be decoded. -1 to decode all layers")
    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")
    96 #if H_MV
    97   ("OutputVpsInfo,v", m_outputVpsInfo, false, "Output information about the layer dependencies and layer sets")
    98 #endif
     78
     79
     80  ("help",                      do_help,                               false,      "this help text")
     81  ("BitstreamFile,b",           cfg_BitstreamFile,                     string(""), "bitstream input file name")
     82  ("ReconFile,o",               cfg_ReconFile,                         string(""), "reconstructed YUV output file name\n"
     83                                                                                   "YUV writing is skipped if omitted")
     84#if NH_3D
     85  ("ScaleOffsetFile,p",         cfg_ScaleOffsetFile,                   string(""), "file with coded scales and offsets")
     86  ("Depth420OutputFlag",        m_depth420OutputFlag,                  true      , "Output depth layers in 4:2:0 ")
     87#endif
     88  ("WarnUnknowParameter,w",     warnUnknowParameter,                                  0, "warn for unknown configuration parameters instead of failing")
     89  ("SkipFrames,s",              m_iSkipFrame,                          0,          "number of frames to skip before random access")
     90  ("OutputBitDepth,d",          m_outputBitDepth[CHANNEL_TYPE_LUMA],   0,          "bit depth of YUV output luma component (default: use 0 for native depth)")
     91  ("OutputBitDepthC,d",         m_outputBitDepth[CHANNEL_TYPE_CHROMA], 0,          "bit depth of YUV output chroma component (default: use 0 for native depth)")
     92  ("OutputColourSpaceConvert",  outputColourSpaceConvert,              string(""), "Colour space conversion to apply to input 444 video. Permitted values are (empty string=UNCHANGED) " + getListOfColourSpaceConverts(false))
     93#if NH_MV
     94  ("TargetOptLayerSetIdx,x",    m_targetOptLayerSetIdx,                -1,         "Target output layer set index. (default: -1, determine automatically to be equal to highest layer set index") // Should actually equal to 0 as default. However, this would cause only the base layer to be decoded. 
     95#endif
     96  ("MaxTemporalLayer,t",        m_iMaxTemporalLayer,                   -1,         "Maximum Temporal Layer to be decoded. -1 to decode all layers")
     97  ("SEIDecodedPictureHash",     m_decodedPictureHashSEIEnabled,        1,          "Control handling of decoded picture hash SEI messages\n"
     98                                                                                   "\t1: check hash in SEI messages if available in the bitstream\n"
     99                                                                                   "\t0: ignore SEI message")
     100  ("SEINoDisplay",              m_decodedNoDisplaySEIEnabled,          true,       "Control handling of decoded no display SEI messages")
     101  ("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.")
     102  ("RespectDefDispWindow,w",    m_respectDefDispWindow,                0,          "Only output content inside the default display window\n")
     103#if NH_MV
     104  ("OutputVpsInfo,v",           m_outputVpsInfo,                       false,       "Output information about the layer dependencies and layer sets")
     105#endif
     106#if O0043_BEST_EFFORT_DECODING
     107  ("ForceDecodeBitDepth",       m_forceDecodeBitDepth,                 0U,         "Force the decoder to operate at a particular bit-depth (best effort decoding)")
     108#endif
     109  ("OutputDecodedSEIMessagesFilename",  m_outputDecodedSEIMessagesFilename,    string(""), "When non empty, output decoded SEI messages to the indicated file. If file is '-', then output to stdout\n")
     110  ("ClipOutputVideoToRec709Range",      m_bClipOutputVideoToRec709Range,  false, "If true then clip output video to the Rec. 709 Range on saving")
    99111  ;
     112
    100113  po::setDefaults(opts);
    101   const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv);
     114  po::ErrorReporter err;
     115  const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv, err);
    102116
    103117  for (list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++)
     
    109123  {
    110124    po::doHelp(cout, opts);
     125    return false;
     126  }
     127
     128  if (err.is_errored)
     129  {
     130    if (!warnUnknowParameter)
     131    {
     132      /* errors have already been reported to stderr */
     133      return false;
     134    }
     135  }
     136
     137  m_outputColourSpaceConvert = stringToInputColourSpaceConvert(outputColourSpaceConvert, false);
     138  if (m_outputColourSpaceConvert>=NUMBER_INPUT_COLOUR_SPACE_CONVERSIONS)
     139  {
     140    fprintf(stderr, "Bad output colour space conversion string\n");
    111141    return false;
    112142  }
     
    116146  m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str());
    117147
    118 #if H_3D
     148#if NH_3D
    119149  m_pchScaleOffsetFile = cfg_ScaleOffsetFile.empty() ? NULL : strdup(cfg_ScaleOffsetFile.c_str());
    120150#endif
     151
    121152  if (!m_pchBitstreamFile)
    122153  {
    123     fprintf(stderr, "No input file specifed, aborting\n");
     154    fprintf(stderr, "No input file specified, aborting\n");
    124155    return false;
    125156  }
     
    127158  if ( !cfg_TargetDecLayerIdSetFile.empty() )
    128159  {
    129 #if H_MV
     160#if NH_MV
    130161    m_targetDecLayerIdSetFileEmpty = false;     
    131162#endif
     
    152183        if ( layerIdParsed < 0 || layerIdParsed >= MAX_NUM_LAYER_IDS )
    153184        {
    154           fprintf(stderr, "Warning! Parsed LayerId %d is not withing allowed range [0,%d]. Ignoring this value.\n", layerIdParsed, MAX_NUM_LAYER_IDS-1 );
     185          fprintf(stderr, "Warning! Parsed LayerId %d is not within allowed range [0,%d]. Ignoring this value.\n", layerIdParsed, MAX_NUM_LAYER_IDS-1 );
    155186        }
    156187        else
     
    172203    }
    173204  }
    174 #if H_MV
    175   m_targetDecLayerIdSet.push_back( 0 );         // Only base layer at startup
    176 #endif
    177 
     205
     206#if NH_MV
     207  //m_targetDecLayerIdSet.push_back( 0 );         // Only base layer at startup
     208#endif
    178209  return true;
    179210}
    180211
    181 #if H_MV
     212#if NH_MV
    182213Void TAppDecCfg::xAppendToFileNameEnd( Char* pchInputFileName, const Char* pchStringToAppend, Char*& rpchOutputFileName)
    183214{
Note: See TracChangeset for help on using the changeset viewer.