Changeset 608 in 3DVCSoftware for trunk/source/App/TAppDecoder/TAppDecCfg.cpp
- Timestamp:
- 1 Sep 2013, 22:47:26 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/App/TAppDecoder/TAppDecCfg.cpp
r121 r608 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 42 42 #include "TAppCommon/program_options_lite.h" 43 43 44 #if H_MV 45 #include <cassert> 46 #endif 44 47 #ifdef WIN32 45 48 #define strdup _strdup … … 61 64 Bool TAppDecCfg::parseCfg( Int argc, Char* argv[] ) 62 65 { 63 bool do_help = false;66 Bool do_help = false; 64 67 string cfg_BitstreamFile; 65 68 string cfg_ReconFile; 69 string cfg_TargetDecLayerIdSetFile; 70 #if H_3D 66 71 string cfg_ScaleOffsetFile; 72 #endif 67 73 68 74 po::Options opts; … … 72 78 ("ReconFile,o", cfg_ReconFile, string(""), "reconstructed YUV output file name\n" 73 79 "YUV writing is skipped if omitted") 80 #if H_3D 74 81 ("ScaleOffsetFile,p", cfg_ScaleOffsetFile, string(""), "file with coded scales and offsets") 82 #endif 75 83 ("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 77 89 ("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") 81 96 ; 97 po::setDefaults(opts); 98 const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv); 82 99 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++) 87 101 { 88 102 fprintf(stderr, "Unhandled argument ignored: `%s'\n", *it); … … 98 112 m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str()); 99 113 m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str()); 114 115 #if H_3D 100 116 m_pchScaleOffsetFile = cfg_ScaleOffsetFile.empty() ? NULL : strdup(cfg_ScaleOffsetFile.c_str()); 101 102 117 #endif 103 118 if (!m_pchBitstreamFile) 104 119 { 105 fprintf(stderr, "No input file specif ied, aborting\n");120 fprintf(stderr, "No input file specifed, aborting\n"); 106 121 return false; 107 122 } 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 108 177 109 178 return true; 110 179 } 111 180 181 #if H_MV 112 182 Void TAppDecCfg::xAppendToFileNameEnd( Char* pchInputFileName, const Char* pchStringToAppend, Char*& rpchOutputFileName) 113 183 { … … 125 195 rpchOutputFileName[iInLength+iAppendLength] = '\0'; 126 196 } 127 197 #endif 128 198 //! \}
Note: See TracChangeset for help on using the changeset viewer.