45 #define strdup _strdup
49 namespace po = df::program_options_lite;
64 string cfg_TargetDecLayerIdSetFile;
65 string outputColourSpaceConvert;
66 Int warnUnknowParameter = 0;
72 (
"help", do_help,
false,
"this help text")
73 (
"BitstreamFile,b", m_bitstreamFileName,
string(
""),
"bitstream input file name")
74 (
"ReconFile,o", m_reconFileName,
string(
""),
"reconstructed YUV output file name\n"
75 "YUV writing is skipped if omitted")
76 (
"WarnUnknowParameter,w", warnUnknowParameter, 0,
"warn for unknown configuration parameters instead of failing")
77 (
"SkipFrames,s", m_iSkipFrame, 0,
"number of frames to skip before random access")
78 (
"OutputBitDepth,d", m_outputBitDepth[
CHANNEL_TYPE_LUMA], 0,
"bit depth of YUV output luma component (default: use 0 for native depth)")
79 (
"OutputBitDepthC,d", m_outputBitDepth[
CHANNEL_TYPE_CHROMA], 0,
"bit depth of YUV output chroma component (default: use 0 for native depth)")
80 (
"OutputColourSpaceConvert", outputColourSpaceConvert,
string(
""),
"Colour space conversion to apply to input 444 video. Permitted values are (empty string=UNCHANGED) " +
getListOfColourSpaceConverts(
false))
81 (
"MaxTemporalLayer,t", m_iMaxTemporalLayer, -1,
"Maximum Temporal Layer to be decoded. -1 to decode all layers")
82 (
"SEIDecodedPictureHash", m_decodedPictureHashSEIEnabled, 1,
"Control handling of decoded picture hash SEI messages\n"
83 "\t1: check hash in SEI messages if available in the bitstream\n"
84 "\t0: ignore SEI message")
85 (
"SEINoDisplay", m_decodedNoDisplaySEIEnabled,
true,
"Control handling of decoded no display SEI messages")
86 (
"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.")
87 (
"RespectDefDispWindow,w", m_respectDefDispWindow, 0,
"Only output content inside the default display window\n")
88 (
"SEIColourRemappingInfoFilename", m_colourRemapSEIFileName, string(
""),
"Colour Remapping YUV output file name. If empty, no remapping is applied (ignore SEI message)\n")
90 (
"ForceDecodeBitDepth", m_forceDecodeBitDepth, 0U,
"Force the decoder to operate at a particular bit-depth (best effort decoding)")
92 (
"OutputDecodedSEIMessagesFilename", m_outputDecodedSEIMessagesFilename, string(
""),
"When non empty, output decoded SEI messages to the indicated file. If file is '-', then output to stdout\n")
93 (
"ClipOutputVideoToRec709Range", m_bClipOutputVideoToRec709Range,
false,
"If true then clip output video to the Rec. 709 Range on saving")
95 (
"TMCTSCheck", m_tmctsCheck,
false,
"If enabled, the decoder checks for violations of mc_exact_sample_value_match_flag in Temporal MCTS ")
101 const list<const TChar*>& argv_unhandled =
po::scanArgv(opts, argc, (
const TChar**) argv, err);
103 for (list<const TChar*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++)
105 fprintf(stderr,
"Unhandled argument ignored: `%s'\n", *it);
108 if (argc == 1 || do_help)
116 if (!warnUnknowParameter)
126 fprintf(stderr,
"Bad output colour space conversion string\n");
130 if (m_bitstreamFileName.empty())
132 fprintf(stderr,
"No input file specified, aborting\n");
136 if ( !cfg_TargetDecLayerIdSetFile.empty() )
138 FILE* targetDecLayerIdSetFile = fopen ( cfg_TargetDecLayerIdSetFile.c_str(),
"r" );
139 if ( targetDecLayerIdSetFile )
141 Bool isLayerIdZeroIncluded =
false;
142 while ( !feof(targetDecLayerIdSetFile) )
144 Int layerIdParsed = 0;
145 if ( fscanf( targetDecLayerIdSetFile,
"%d ", &layerIdParsed ) != 1 )
147 if ( m_targetDecLayerIdSet.size() == 0 )
149 fprintf(stderr,
"No LayerId could be parsed in file %s. Decoding all LayerIds as default.\n", cfg_TargetDecLayerIdSetFile.c_str() );
153 if ( layerIdParsed == -1 )
155 m_targetDecLayerIdSet.clear();
160 fprintf(stderr,
"Warning! Parsed LayerId %d is not within allowed range [0,%d]. Ignoring this value.\n", layerIdParsed,
MAX_NUM_LAYER_IDS-1 );
164 isLayerIdZeroIncluded = layerIdParsed == 0 ?
true : isLayerIdZeroIncluded;
165 m_targetDecLayerIdSet.push_back ( layerIdParsed );
168 fclose (targetDecLayerIdSetFile);
169 if ( m_targetDecLayerIdSet.size() > 0 && !isLayerIdZeroIncluded )
171 fprintf(stderr,
"TargetDecLayerIdSet must contain LayerId=0, aborting" );
177 fprintf(stderr,
"File %s could not be opened. Using all LayerIds as default.\n", cfg_TargetDecLayerIdSetFile.c_str() );
void doHelp(ostream &out, Options &opts, unsigned columns)
static const Int MAX_NUM_LAYER_IDS
void setDefaults(Options &opts)
Bool parseCfg(Int argc, TChar *argv[])
initialize option class from configuration
list< const char * > scanArgv(Options &opts, unsigned argc, const char *argv[], ErrorReporter &error_reporter)
#define O0043_BEST_EFFORT_DECODING
0 (default) = disable code related to best effort decoding, 1 = enable code relating to best effort d...
OptionSpecific addOptions()
Decoder configuration class (header)