[125] | 1 | /* The copyright in this software is being made available under the BSD |
---|
| 2 | * License, included below. This software may be subject to other third party |
---|
| 3 | * and contributor rights, including patent rights, and no such rights are |
---|
| 4 | * granted under this license. |
---|
| 5 | * |
---|
| 6 | * Copyright (c) 2010-2013, ITU/ISO/IEC |
---|
| 7 | * All rights reserved. |
---|
| 8 | * |
---|
| 9 | * Redistribution and use in source and binary forms, with or without |
---|
| 10 | * modification, are permitted provided that the following conditions are met: |
---|
| 11 | * |
---|
| 12 | * * Redistributions of source code must retain the above copyright notice, |
---|
| 13 | * this list of conditions and the following disclaimer. |
---|
| 14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
| 15 | * this list of conditions and the following disclaimer in the documentation |
---|
| 16 | * and/or other materials provided with the distribution. |
---|
| 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
| 18 | * be used to endorse or promote products derived from this software without |
---|
| 19 | * specific prior written permission. |
---|
| 20 | * |
---|
| 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
| 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
| 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
| 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
| 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
| 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
| 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
| 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
| 31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 32 | */ |
---|
| 33 | |
---|
| 34 | /** \file TAppEncCfg.cpp |
---|
| 35 | \brief Handle encoder configuration parameters |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | #include <stdlib.h> |
---|
| 39 | #include <cassert> |
---|
| 40 | #include <cstring> |
---|
| 41 | #include <string> |
---|
| 42 | #include "TLibCommon/TComRom.h" |
---|
| 43 | #include "TAppEncCfg.h" |
---|
| 44 | |
---|
| 45 | static istream& operator>>(istream &, Level::Name &); |
---|
| 46 | static istream& operator>>(istream &, Level::Tier &); |
---|
| 47 | static istream& operator>>(istream &, Profile::Name &); |
---|
| 48 | |
---|
| 49 | #include "TAppCommon/program_options_lite.h" |
---|
| 50 | #include "TLibEncoder/TEncRateCtrl.h" |
---|
| 51 | #ifdef WIN32 |
---|
| 52 | #define strdup _strdup |
---|
| 53 | #endif |
---|
| 54 | |
---|
| 55 | using namespace std; |
---|
| 56 | namespace po = df::program_options_lite; |
---|
| 57 | |
---|
| 58 | //! \ingroup TAppEncoder |
---|
| 59 | //! \{ |
---|
| 60 | |
---|
| 61 | // ==================================================================================================================== |
---|
| 62 | // Constructor / destructor / initialization / destroy |
---|
| 63 | // ==================================================================================================================== |
---|
| 64 | |
---|
| 65 | #if SVC_EXTENSION |
---|
| 66 | TAppEncCfg::TAppEncCfg() |
---|
| 67 | : m_pBitstreamFile() |
---|
| 68 | , m_pColumnWidth() |
---|
| 69 | , m_pRowHeight() |
---|
| 70 | , m_scalingListFile() |
---|
| 71 | #if REF_IDX_FRAMEWORK |
---|
| 72 | , m_elRapSliceBEnabled(0) |
---|
| 73 | #endif |
---|
| 74 | { |
---|
| 75 | for(UInt layer=0; layer<MAX_LAYERS; layer++) |
---|
| 76 | { |
---|
| 77 | m_acLayerCfg[layer].setAppEncCfg(this); |
---|
| 78 | } |
---|
| 79 | } |
---|
| 80 | #else |
---|
| 81 | TAppEncCfg::TAppEncCfg() |
---|
| 82 | : m_pchInputFile() |
---|
| 83 | , m_pchBitstreamFile() |
---|
| 84 | , m_pchReconFile() |
---|
| 85 | , m_pchdQPFile() |
---|
| 86 | , m_pColumnWidth() |
---|
| 87 | , m_pRowHeight() |
---|
| 88 | , m_scalingListFile() |
---|
| 89 | { |
---|
| 90 | m_aidQP = NULL; |
---|
| 91 | } |
---|
| 92 | #endif |
---|
| 93 | |
---|
| 94 | TAppEncCfg::~TAppEncCfg() |
---|
| 95 | { |
---|
| 96 | #if SVC_EXTENSION |
---|
| 97 | free(m_pBitstreamFile); |
---|
| 98 | #else |
---|
| 99 | free(m_pchBitstreamFile); |
---|
| 100 | if ( m_aidQP ) |
---|
| 101 | { |
---|
| 102 | delete[] m_aidQP; |
---|
| 103 | } |
---|
| 104 | free(m_pchInputFile); |
---|
| 105 | #endif |
---|
| 106 | #if !SVC_EXTENSION |
---|
| 107 | free(m_pchReconFile); |
---|
| 108 | free(m_pchdQPFile); |
---|
| 109 | #endif |
---|
| 110 | free(m_pColumnWidth); |
---|
| 111 | free(m_pRowHeight); |
---|
| 112 | free(m_scalingListFile); |
---|
| 113 | } |
---|
| 114 | |
---|
| 115 | Void TAppEncCfg::create() |
---|
| 116 | { |
---|
| 117 | } |
---|
| 118 | |
---|
| 119 | Void TAppEncCfg::destroy() |
---|
| 120 | { |
---|
| 121 | } |
---|
| 122 | |
---|
| 123 | std::istringstream &operator>>(std::istringstream &in, GOPEntry &entry) //input |
---|
| 124 | { |
---|
| 125 | in>>entry.m_sliceType; |
---|
| 126 | in>>entry.m_POC; |
---|
| 127 | in>>entry.m_QPOffset; |
---|
| 128 | in>>entry.m_QPFactor; |
---|
| 129 | in>>entry.m_tcOffsetDiv2; |
---|
| 130 | in>>entry.m_betaOffsetDiv2; |
---|
| 131 | in>>entry.m_temporalId; |
---|
| 132 | in>>entry.m_numRefPicsActive; |
---|
| 133 | in>>entry.m_numRefPics; |
---|
| 134 | for ( Int i = 0; i < entry.m_numRefPics; i++ ) |
---|
| 135 | { |
---|
| 136 | in>>entry.m_referencePics[i]; |
---|
| 137 | } |
---|
| 138 | in>>entry.m_interRPSPrediction; |
---|
| 139 | #if AUTO_INTER_RPS |
---|
| 140 | if (entry.m_interRPSPrediction==1) |
---|
| 141 | { |
---|
| 142 | in>>entry.m_deltaRPS; |
---|
| 143 | in>>entry.m_numRefIdc; |
---|
| 144 | for ( Int i = 0; i < entry.m_numRefIdc; i++ ) |
---|
| 145 | { |
---|
| 146 | in>>entry.m_refIdc[i]; |
---|
| 147 | } |
---|
| 148 | } |
---|
| 149 | else if (entry.m_interRPSPrediction==2) |
---|
| 150 | { |
---|
| 151 | in>>entry.m_deltaRPS; |
---|
| 152 | } |
---|
| 153 | #else |
---|
| 154 | if (entry.m_interRPSPrediction) |
---|
| 155 | { |
---|
| 156 | in>>entry.m_deltaRPS; |
---|
| 157 | in>>entry.m_numRefIdc; |
---|
| 158 | for ( Int i = 0; i < entry.m_numRefIdc; i++ ) |
---|
| 159 | { |
---|
| 160 | in>>entry.m_refIdc[i]; |
---|
| 161 | } |
---|
| 162 | } |
---|
| 163 | #endif |
---|
| 164 | return in; |
---|
| 165 | } |
---|
| 166 | |
---|
| 167 | #if SVC_EXTENSION |
---|
| 168 | void TAppEncCfg::getDirFilename(string& filename, string& dir, const string path) |
---|
| 169 | { |
---|
| 170 | size_t pos = path.find_last_of("\\"); |
---|
| 171 | if(pos != std::string::npos) |
---|
| 172 | { |
---|
| 173 | filename.assign(path.begin() + pos + 1, path.end()); |
---|
| 174 | dir.assign(path.begin(), path.begin() + pos + 1); |
---|
| 175 | } |
---|
| 176 | else |
---|
| 177 | { |
---|
| 178 | pos = path.find_last_of("/"); |
---|
| 179 | if(pos != std::string::npos) |
---|
| 180 | { |
---|
| 181 | filename.assign(path.begin() + pos + 1, path.end()); |
---|
| 182 | dir.assign(path.begin(), path.begin() + pos + 1); |
---|
| 183 | } |
---|
| 184 | else |
---|
| 185 | { |
---|
| 186 | filename = path; |
---|
| 187 | dir.assign(""); |
---|
| 188 | } |
---|
| 189 | } |
---|
| 190 | } |
---|
| 191 | #endif |
---|
| 192 | |
---|
| 193 | static const struct MapStrToProfile { |
---|
| 194 | const Char* str; |
---|
| 195 | Profile::Name value; |
---|
| 196 | } strToProfile[] = { |
---|
| 197 | {"none", Profile::NONE}, |
---|
| 198 | {"main", Profile::MAIN}, |
---|
| 199 | {"main10", Profile::MAIN10}, |
---|
| 200 | {"main-still-picture", Profile::MAINSTILLPICTURE}, |
---|
| 201 | }; |
---|
| 202 | |
---|
| 203 | static const struct MapStrToTier { |
---|
| 204 | const Char* str; |
---|
| 205 | Level::Tier value; |
---|
| 206 | } strToTier[] = { |
---|
| 207 | {"main", Level::MAIN}, |
---|
| 208 | {"high", Level::HIGH}, |
---|
| 209 | }; |
---|
| 210 | |
---|
| 211 | static const struct MapStrToLevel { |
---|
| 212 | const Char* str; |
---|
| 213 | Level::Name value; |
---|
| 214 | } strToLevel[] = { |
---|
| 215 | {"none",Level::NONE}, |
---|
| 216 | {"1", Level::LEVEL1}, |
---|
| 217 | {"2", Level::LEVEL2}, |
---|
| 218 | {"2.1", Level::LEVEL2_1}, |
---|
| 219 | {"3", Level::LEVEL3}, |
---|
| 220 | {"3.1", Level::LEVEL3_1}, |
---|
| 221 | {"4", Level::LEVEL4}, |
---|
| 222 | {"4.1", Level::LEVEL4_1}, |
---|
| 223 | {"5", Level::LEVEL5}, |
---|
| 224 | {"5.1", Level::LEVEL5_1}, |
---|
| 225 | {"5.2", Level::LEVEL5_2}, |
---|
| 226 | {"6", Level::LEVEL6}, |
---|
| 227 | {"6.1", Level::LEVEL6_1}, |
---|
| 228 | {"6.2", Level::LEVEL6_2}, |
---|
| 229 | }; |
---|
| 230 | |
---|
| 231 | template<typename T, typename P> |
---|
| 232 | static istream& readStrToEnum(P map[], unsigned long mapLen, istream &in, T &val) |
---|
| 233 | { |
---|
| 234 | string str; |
---|
| 235 | in >> str; |
---|
| 236 | |
---|
| 237 | for (Int i = 0; i < mapLen; i++) |
---|
| 238 | { |
---|
| 239 | if (str == map[i].str) |
---|
| 240 | { |
---|
| 241 | val = map[i].value; |
---|
| 242 | goto found; |
---|
| 243 | } |
---|
| 244 | } |
---|
| 245 | /* not found */ |
---|
| 246 | in.setstate(ios::failbit); |
---|
| 247 | found: |
---|
| 248 | return in; |
---|
| 249 | } |
---|
| 250 | |
---|
| 251 | static istream& operator>>(istream &in, Profile::Name &profile) |
---|
| 252 | { |
---|
| 253 | return readStrToEnum(strToProfile, sizeof(strToProfile)/sizeof(*strToProfile), in, profile); |
---|
| 254 | } |
---|
| 255 | |
---|
| 256 | static istream& operator>>(istream &in, Level::Tier &tier) |
---|
| 257 | { |
---|
| 258 | return readStrToEnum(strToTier, sizeof(strToTier)/sizeof(*strToTier), in, tier); |
---|
| 259 | } |
---|
| 260 | |
---|
| 261 | static istream& operator>>(istream &in, Level::Name &level) |
---|
| 262 | { |
---|
| 263 | return readStrToEnum(strToLevel, sizeof(strToLevel)/sizeof(*strToLevel), in, level); |
---|
| 264 | } |
---|
| 265 | |
---|
| 266 | #if SIGNAL_BITRATE_PICRATE_IN_VPS |
---|
| 267 | Void readBoolString(const string inpString, const Int numEntries, Bool* &memberArray, const char *elementName); |
---|
| 268 | Void readIntString(const string inpString, const Int numEntries, Int* &memberArray, const char *elementName); |
---|
| 269 | #endif |
---|
| 270 | // ==================================================================================================================== |
---|
| 271 | // Public member functions |
---|
| 272 | // ==================================================================================================================== |
---|
| 273 | |
---|
| 274 | /** \param argc number of arguments |
---|
| 275 | \param argv array of arguments |
---|
| 276 | \retval true when success |
---|
| 277 | */ |
---|
| 278 | Bool TAppEncCfg::parseCfg( Int argc, Char* argv[] ) |
---|
| 279 | { |
---|
| 280 | Bool do_help = false; |
---|
| 281 | |
---|
| 282 | #if SVC_EXTENSION |
---|
| 283 | string cfg_LayerCfgFile [MAX_LAYERS]; |
---|
| 284 | string cfg_BitstreamFile; |
---|
| 285 | string* cfg_InputFile [MAX_LAYERS]; |
---|
| 286 | string* cfg_ReconFile [MAX_LAYERS]; |
---|
| 287 | Double* cfg_fQP [MAX_LAYERS]; |
---|
| 288 | |
---|
| 289 | Int* cfg_SourceWidth [MAX_LAYERS]; |
---|
| 290 | Int* cfg_SourceHeight [MAX_LAYERS]; |
---|
| 291 | Int* cfg_FrameRate [MAX_LAYERS]; |
---|
| 292 | Int* cfg_IntraPeriod [MAX_LAYERS]; |
---|
| 293 | Int* cfg_conformanceMode [MAX_LAYERS]; |
---|
| 294 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
| 295 | Int* cfg_numDirectRefLayers [MAX_LAYERS]; |
---|
| 296 | string cfg_refLayerIds [MAX_LAYERS]; |
---|
| 297 | string* cfg_refLayerIdsPtr [MAX_LAYERS]; |
---|
| 298 | #endif |
---|
| 299 | for(UInt layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 300 | { |
---|
| 301 | cfg_InputFile[layer] = &m_acLayerCfg[layer].m_cInputFile; |
---|
| 302 | cfg_ReconFile[layer] = &m_acLayerCfg[layer].m_cReconFile; |
---|
| 303 | cfg_fQP[layer] = &m_acLayerCfg[layer].m_fQP; |
---|
| 304 | cfg_SourceWidth[layer] = &m_acLayerCfg[layer].m_iSourceWidth; |
---|
| 305 | cfg_SourceHeight[layer] = &m_acLayerCfg[layer].m_iSourceHeight; |
---|
| 306 | cfg_FrameRate[layer] = &m_acLayerCfg[layer].m_iFrameRate; |
---|
| 307 | cfg_IntraPeriod[layer] = &m_acLayerCfg[layer].m_iIntraPeriod; |
---|
| 308 | cfg_conformanceMode[layer] = &m_acLayerCfg[layer].m_conformanceMode; |
---|
| 309 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
| 310 | cfg_numDirectRefLayers [layer] = &m_acLayerCfg[layer].m_numDirectRefLayers; |
---|
| 311 | cfg_refLayerIdsPtr [layer] = &cfg_refLayerIds[layer]; |
---|
| 312 | #endif |
---|
| 313 | } |
---|
| 314 | #if AVC_SYNTAX |
---|
| 315 | string cfg_BLSyntaxFile; |
---|
| 316 | #endif |
---|
| 317 | #else |
---|
| 318 | string cfg_InputFile; |
---|
| 319 | string cfg_BitstreamFile; |
---|
| 320 | string cfg_ReconFile; |
---|
| 321 | string cfg_dQPFile; |
---|
| 322 | #endif |
---|
| 323 | string cfg_ColumnWidth; |
---|
| 324 | string cfg_RowHeight; |
---|
| 325 | string cfg_ScalingListFile; |
---|
| 326 | #if SIGNAL_BITRATE_PICRATE_IN_VPS |
---|
| 327 | string cfg_bitRateInfoPresentFlag; |
---|
| 328 | string cfg_picRateInfoPresentFlag; |
---|
| 329 | string cfg_avgBitRate; |
---|
| 330 | string cfg_maxBitRate; |
---|
| 331 | string cfg_avgPicRate; |
---|
| 332 | string cfg_constantPicRateIdc; |
---|
| 333 | #endif |
---|
| 334 | po::Options opts; |
---|
| 335 | opts.addOptions() |
---|
| 336 | ("help", do_help, false, "this help text") |
---|
| 337 | ("c", po::parseConfigFile, "configuration file name") |
---|
| 338 | |
---|
| 339 | // File, I/O and source parameters |
---|
| 340 | #if SVC_EXTENSION |
---|
| 341 | ("InputFile%d,-i%d", cfg_InputFile, string(""), MAX_LAYERS, "original YUV input file name for layer %d") |
---|
| 342 | ("ReconFile%d,-o%d", cfg_ReconFile, string(""), MAX_LAYERS, "reconstruction YUV input file name for layer %d") |
---|
| 343 | ("LayerConfig%d,-lc%d", cfg_LayerCfgFile, string(""), MAX_LAYERS, "layer %d configuration file name") |
---|
| 344 | ("SourceWidth%d,-wdt%d", cfg_SourceWidth, 0, MAX_LAYERS, "Source picture width for layer %d") |
---|
| 345 | ("SourceHeight%d,-hgt%d", cfg_SourceHeight, 0, MAX_LAYERS, "Source picture height for layer %d") |
---|
| 346 | ("FrameRate%d,-fr%d", cfg_FrameRate, 0, MAX_LAYERS, "Frame rate for layer %d") |
---|
| 347 | ("LambdaModifier%d,-LM%d", m_adLambdaModifier, ( double )1.0, MAX_TLAYER, "Lambda modifier for temporal layer %d") |
---|
| 348 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
| 349 | ("NumDirectRefLayers%d", cfg_numDirectRefLayers, -1, MAX_LAYERS, "Number of direct reference layers") |
---|
| 350 | ("RefLayerIds%d", cfg_refLayerIdsPtr, string(""), MAX_LAYERS, "direct reference layer IDs") |
---|
| 351 | #endif |
---|
| 352 | ("NumLayers", m_numLayers, 1, "Number of layers to code") |
---|
| 353 | ("ConformanceMode%d", cfg_conformanceMode,0, MAX_LAYERS, "Window conformance mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping") |
---|
| 354 | |
---|
| 355 | ("BitstreamFile,b", cfg_BitstreamFile, string(""), "Bitstream output file name") |
---|
| 356 | ("InputBitDepth", m_inputBitDepthY, 8, "Bit-depth of input file") |
---|
| 357 | ("OutputBitDepth", m_outputBitDepthY, 0, "Bit-depth of output file (default:InternalBitDepth)") |
---|
| 358 | ("InternalBitDepth", m_internalBitDepthY, 0, "Bit-depth the codec operates at. (default:InputBitDepth)" |
---|
| 359 | "If different to InputBitDepth, source data will be converted") |
---|
| 360 | ("InputBitDepthC", m_inputBitDepthC, 0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)") |
---|
| 361 | ("OutputBitDepthC", m_outputBitDepthC, 0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)") |
---|
| 362 | ("InternalBitDepthC", m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)") |
---|
| 363 | |
---|
| 364 | #if AVC_BASE |
---|
| 365 | ("InputBLFile,-ibl", *cfg_InputFile[0], string(""), "Base layer rec YUV input file name") |
---|
| 366 | #if AVC_SYNTAX |
---|
| 367 | ("InputBLSyntaxFile,-ibs", cfg_BLSyntaxFile, string(""), "Base layer syntax input file name") |
---|
| 368 | #endif |
---|
| 369 | #endif |
---|
| 370 | #if REF_IDX_FRAMEWORK |
---|
| 371 | ("EnableElRapB,-use-rap-b", m_elRapSliceBEnabled, 0, "Set ILP over base-layer I picture to B picture (default is P picture_") |
---|
| 372 | #endif |
---|
| 373 | #else |
---|
| 374 | ("InputFile,i", cfg_InputFile, string(""), "Original YUV input file name") |
---|
| 375 | ("BitstreamFile,b", cfg_BitstreamFile, string(""), "Bitstream output file name") |
---|
| 376 | ("ReconFile,o", cfg_ReconFile, string(""), "Reconstructed YUV output file name") |
---|
| 377 | ("SourceWidth,-wdt", m_iSourceWidth, 0, "Source picture width") |
---|
| 378 | ("SourceHeight,-hgt", m_iSourceHeight, 0, "Source picture height") |
---|
| 379 | ("InputBitDepth", m_inputBitDepthY, 8, "Bit-depth of input file") |
---|
| 380 | ("OutputBitDepth", m_outputBitDepthY, 0, "Bit-depth of output file (default:InternalBitDepth)") |
---|
| 381 | ("InternalBitDepth", m_internalBitDepthY, 0, "Bit-depth the codec operates at. (default:InputBitDepth)" |
---|
| 382 | "If different to InputBitDepth, source data will be converted") |
---|
| 383 | ("InputBitDepthC", m_inputBitDepthC, 0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)") |
---|
| 384 | ("OutputBitDepthC", m_outputBitDepthC, 0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)") |
---|
| 385 | ("InternalBitDepthC", m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)") |
---|
| 386 | ("ConformanceMode", m_conformanceMode, 0, "Window conformance mode (0: no window, 1:automatic padding, 2:padding, 3:conformance") |
---|
| 387 | ("HorizontalPadding,-pdx",m_aiPad[0], 0, "Horizontal source padding for conformance window mode 2") |
---|
| 388 | ("VerticalPadding,-pdy", m_aiPad[1], 0, "Vertical source padding for conformance window mode 2") |
---|
| 389 | ("ConfLeft", m_confLeft, 0, "Left offset for window conformance mode 3") |
---|
| 390 | ("ConfRight", m_confRight, 0, "Right offset for window conformance mode 3") |
---|
| 391 | ("ConfTop", m_confTop, 0, "Top offset for window conformance mode 3") |
---|
| 392 | ("ConfBottom", m_confBottom, 0, "Bottom offset for window conformance mode 3") |
---|
| 393 | ("FrameRate,-fr", m_iFrameRate, 0, "Frame rate") |
---|
| 394 | #endif |
---|
| 395 | ("FrameSkip,-fs", m_FrameSkip, 0u, "Number of frames to skip at start of input YUV") |
---|
| 396 | ("FramesToBeEncoded,f", m_framesToBeEncoded, 0, "Number of frames to be encoded (default=all)") |
---|
| 397 | |
---|
| 398 | // Profile and level |
---|
| 399 | ("Profile", m_profile, Profile::NONE, "Profile to be used when encoding (Incomplete)") |
---|
| 400 | ("Level", m_level, Level::NONE, "Level limit to be used, eg 5.1 (Incomplete)") |
---|
| 401 | ("Tier", m_levelTier, Level::MAIN, "Tier to use for interpretation of --Level") |
---|
| 402 | |
---|
| 403 | #if L0046_CONSTRAINT_FLAGS |
---|
| 404 | ("ProgressiveSource", m_progressiveSourceFlag, false, "Indicate that source is progressive") |
---|
| 405 | ("InterlacedSource", m_interlacedSourceFlag, false, "Indicate that source is interlaced") |
---|
| 406 | ("NonPackedSource", m_nonPackedConstraintFlag, false, "Indicate that source does not contain frame packing") |
---|
| 407 | ("FrameOnly", m_frameOnlyConstraintFlag, false, "Indicate that the bitstream contains only frames") |
---|
| 408 | #endif |
---|
| 409 | |
---|
| 410 | // Unit definition parameters |
---|
| 411 | ("MaxCUWidth", m_uiMaxCUWidth, 64u) |
---|
| 412 | ("MaxCUHeight", m_uiMaxCUHeight, 64u) |
---|
| 413 | // todo: remove defaults from MaxCUSize |
---|
| 414 | ("MaxCUSize,s", m_uiMaxCUWidth, 64u, "Maximum CU size") |
---|
| 415 | ("MaxCUSize,s", m_uiMaxCUHeight, 64u, "Maximum CU size") |
---|
| 416 | ("MaxPartitionDepth,h", m_uiMaxCUDepth, 4u, "CU depth") |
---|
| 417 | |
---|
| 418 | ("QuadtreeTULog2MaxSize", m_uiQuadtreeTULog2MaxSize, 6u, "Maximum TU size in logarithm base 2") |
---|
| 419 | ("QuadtreeTULog2MinSize", m_uiQuadtreeTULog2MinSize, 2u, "Minimum TU size in logarithm base 2") |
---|
| 420 | |
---|
| 421 | ("QuadtreeTUMaxDepthIntra", m_uiQuadtreeTUMaxDepthIntra, 1u, "Depth of TU tree for intra CUs") |
---|
| 422 | ("QuadtreeTUMaxDepthInter", m_uiQuadtreeTUMaxDepthInter, 2u, "Depth of TU tree for inter CUs") |
---|
| 423 | |
---|
| 424 | // Coding structure paramters |
---|
| 425 | #if SVC_EXTENSION |
---|
| 426 | ("IntraPeriod%d,-ip%d", cfg_IntraPeriod, -1, MAX_LAYERS, "intra period in frames for layer %d, (-1: only first frame)") |
---|
| 427 | #else |
---|
| 428 | ("IntraPeriod,-ip", m_iIntraPeriod, -1, "Intra period in frames, (-1: only first frame)") |
---|
| 429 | #endif |
---|
| 430 | ("DecodingRefreshType,-dr", m_iDecodingRefreshType, 0, "Intra refresh type (0:none 1:CRA 2:IDR)") |
---|
| 431 | ("GOPSize,g", m_iGOPSize, 1, "GOP size of temporal structure") |
---|
| 432 | ("ListCombination,-lc", m_bUseLComb, true, "Combined reference list for uni-prediction estimation in B-slices") |
---|
| 433 | // motion options |
---|
| 434 | ("FastSearch", m_iFastSearch, 1, "0:Full search 1:Diamond 2:PMVFAST") |
---|
| 435 | ("SearchRange,-sr", m_iSearchRange, 96, "Motion search range") |
---|
| 436 | ("BipredSearchRange", m_bipredSearchRange, 4, "Motion search range for bipred refinement") |
---|
| 437 | ("HadamardME", m_bUseHADME, true, "Hadamard ME for fractional-pel") |
---|
| 438 | ("ASR", m_bUseASR, false, "Adaptive motion search range") |
---|
| 439 | |
---|
| 440 | #if SVC_EXTENSION |
---|
| 441 | ("LambdaModifier%d,-LM%d", m_adLambdaModifier, ( double )1.0, MAX_TLAYER, "Lambda modifier for temporal layer %d") |
---|
| 442 | #else |
---|
| 443 | // Mode decision parameters |
---|
| 444 | ("LambdaModifier0,-LM0", m_adLambdaModifier[ 0 ], ( Double )1.0, "Lambda modifier for temporal layer 0") |
---|
| 445 | ("LambdaModifier1,-LM1", m_adLambdaModifier[ 1 ], ( Double )1.0, "Lambda modifier for temporal layer 1") |
---|
| 446 | ("LambdaModifier2,-LM2", m_adLambdaModifier[ 2 ], ( Double )1.0, "Lambda modifier for temporal layer 2") |
---|
| 447 | ("LambdaModifier3,-LM3", m_adLambdaModifier[ 3 ], ( Double )1.0, "Lambda modifier for temporal layer 3") |
---|
| 448 | ("LambdaModifier4,-LM4", m_adLambdaModifier[ 4 ], ( Double )1.0, "Lambda modifier for temporal layer 4") |
---|
| 449 | ("LambdaModifier5,-LM5", m_adLambdaModifier[ 5 ], ( Double )1.0, "Lambda modifier for temporal layer 5") |
---|
| 450 | ("LambdaModifier6,-LM6", m_adLambdaModifier[ 6 ], ( Double )1.0, "Lambda modifier for temporal layer 6") |
---|
| 451 | ("LambdaModifier7,-LM7", m_adLambdaModifier[ 7 ], ( Double )1.0, "Lambda modifier for temporal layer 7") |
---|
| 452 | #endif |
---|
| 453 | |
---|
| 454 | /* Quantization parameters */ |
---|
| 455 | #if SVC_EXTENSION |
---|
| 456 | ("QP%d,-q%d", cfg_fQP, 30.0, MAX_LAYERS, "Qp value for layer %d, if value is float, QP is switched once during encoding") |
---|
| 457 | #else |
---|
| 458 | ("QP,q", m_fQP, 30.0, "Qp value, if value is float, QP is switched once during encoding") |
---|
| 459 | #endif |
---|
| 460 | ("DeltaQpRD,-dqr",m_uiDeltaQpRD, 0u, "max dQp offset for slice") |
---|
| 461 | ("MaxDeltaQP,d", m_iMaxDeltaQP, 0, "max dQp offset for block") |
---|
| 462 | ("MaxCuDQPDepth,-dqd", m_iMaxCuDQPDepth, 0, "max depth for a minimum CuDQP") |
---|
| 463 | |
---|
| 464 | ("CbQpOffset,-cbqpofs", m_cbQpOffset, 0, "Chroma Cb QP Offset") |
---|
| 465 | ("CrQpOffset,-crqpofs", m_crQpOffset, 0, "Chroma Cr QP Offset") |
---|
| 466 | |
---|
| 467 | #if ADAPTIVE_QP_SELECTION |
---|
| 468 | ("AdaptiveQpSelection,-aqps", m_bUseAdaptQpSelect, false, "AdaptiveQpSelection") |
---|
| 469 | #endif |
---|
| 470 | |
---|
| 471 | ("AdaptiveQP,-aq", m_bUseAdaptiveQP, false, "QP adaptation based on a psycho-visual model") |
---|
| 472 | ("MaxQPAdaptationRange,-aqr", m_iQPAdaptationRange, 6, "QP adaptation range") |
---|
| 473 | #if !SVC_EXTENSION |
---|
| 474 | ("dQPFile,m", cfg_dQPFile, string(""), "dQP file name") |
---|
| 475 | #endif |
---|
| 476 | ("RDOQ", m_useRDOQ, true ) |
---|
| 477 | ("RDOQTS", m_useRDOQTS, true ) |
---|
| 478 | #if L0232_RD_PENALTY |
---|
| 479 | ("RDpenalty", m_rdPenalty, 0, "RD-penalty for 32x32 TU for intra in non-intra slices. 0:disbaled 1:RD-penalty 2:maximum RD-penalty") |
---|
| 480 | #endif |
---|
| 481 | // Entropy coding parameters |
---|
| 482 | ("SBACRD", m_bUseSBACRD, true, "SBAC based RD estimation") |
---|
| 483 | |
---|
| 484 | // Deblocking filter parameters |
---|
| 485 | ("LoopFilterDisable", m_bLoopFilterDisable, false ) |
---|
| 486 | ("LoopFilterOffsetInPPS", m_loopFilterOffsetInPPS, false ) |
---|
| 487 | ("LoopFilterBetaOffset_div2", m_loopFilterBetaOffsetDiv2, 0 ) |
---|
| 488 | ("LoopFilterTcOffset_div2", m_loopFilterTcOffsetDiv2, 0 ) |
---|
| 489 | ("DeblockingFilterControlPresent", m_DeblockingFilterControlPresent, false ) |
---|
| 490 | |
---|
| 491 | // Coding tools |
---|
| 492 | ("AMP", m_enableAMP, true, "Enable asymmetric motion partitions") |
---|
| 493 | ("TransformSkip", m_useTransformSkip, false, "Intra transform skipping") |
---|
| 494 | ("TransformSkipFast", m_useTransformSkipFast, false, "Fast intra transform skipping") |
---|
| 495 | ("SAO", m_bUseSAO, true, "Enable Sample Adaptive Offset") |
---|
| 496 | ("MaxNumOffsetsPerPic", m_maxNumOffsetsPerPic, 2048, "Max number of SAO offset per picture (Default: 2048)") |
---|
| 497 | ("SAOLcuBoundary", m_saoLcuBoundary, false, "0: right/bottom LCU boundary areas skipped from SAO parameter estimation, 1: non-deblocked pixels are used for those areas") |
---|
| 498 | ("SAOLcuBasedOptimization", m_saoLcuBasedOptimization, true, "0: SAO picture-based optimization, 1: SAO LCU-based optimization ") |
---|
| 499 | ("SliceMode", m_sliceMode, 0, "0: Disable all Recon slice limits, 1: Enforce max # of LCUs, 2: Enforce max # of bytes, 3:specify tiles per dependent slice") |
---|
| 500 | ("SliceArgument", m_sliceArgument, 0, "Depending on SliceMode being:" |
---|
| 501 | "\t1: max number of CTUs per slice" |
---|
| 502 | "\t2: max number of bytes per slice" |
---|
| 503 | "\t3: max number of tiles per slice") |
---|
| 504 | ("SliceSegmentMode", m_sliceSegmentMode, 0, "0: Disable all slice segment limits, 1: Enforce max # of LCUs, 2: Enforce max # of bytes, 3:specify tiles per dependent slice") |
---|
| 505 | ("SliceSegmentArgument", m_sliceSegmentArgument, 0, "Depending on SliceSegmentMode being:" |
---|
| 506 | "\t1: max number of CTUs per slice segment" |
---|
| 507 | "\t2: max number of bytes per slice segment" |
---|
| 508 | "\t3: max number of tiles per slice segment") |
---|
| 509 | ("LFCrossSliceBoundaryFlag", m_bLFCrossSliceBoundaryFlag, true) |
---|
| 510 | |
---|
| 511 | ("ConstrainedIntraPred", m_bUseConstrainedIntraPred, false, "Constrained Intra Prediction") |
---|
| 512 | |
---|
| 513 | ("PCMEnabledFlag", m_usePCM, false) |
---|
| 514 | ("PCMLog2MaxSize", m_pcmLog2MaxSize, 5u) |
---|
| 515 | ("PCMLog2MinSize", m_uiPCMLog2MinSize, 3u) |
---|
| 516 | ("PCMInputBitDepthFlag", m_bPCMInputBitDepthFlag, true) |
---|
| 517 | ("PCMFilterDisableFlag", m_bPCMFilterDisableFlag, false) |
---|
| 518 | |
---|
| 519 | ("LosslessCuEnabled", m_useLossless, false) |
---|
| 520 | |
---|
| 521 | ("WeightedPredP,-wpP", m_useWeightedPred, false, "Use weighted prediction in P slices") |
---|
| 522 | ("WeightedPredB,-wpB", m_useWeightedBiPred, false, "Use weighted (bidirectional) prediction in B slices") |
---|
| 523 | ("Log2ParallelMergeLevel", m_log2ParallelMergeLevel, 2u, "Parallel merge estimation region") |
---|
| 524 | ("UniformSpacingIdc", m_iUniformSpacingIdr, 0, "Indicates if the column and row boundaries are distributed uniformly") |
---|
| 525 | ("NumTileColumnsMinus1", m_iNumColumnsMinus1, 0, "Number of columns in a picture minus 1") |
---|
| 526 | ("ColumnWidthArray", cfg_ColumnWidth, string(""), "Array containing ColumnWidth values in units of LCU") |
---|
| 527 | ("NumTileRowsMinus1", m_iNumRowsMinus1, 0, "Number of rows in a picture minus 1") |
---|
| 528 | ("RowHeightArray", cfg_RowHeight, string(""), "Array containing RowHeight values in units of LCU") |
---|
| 529 | ("LFCrossTileBoundaryFlag", m_bLFCrossTileBoundaryFlag, true, "1: cross-tile-boundary loop filtering. 0:non-cross-tile-boundary loop filtering") |
---|
| 530 | ("WaveFrontSynchro", m_iWaveFrontSynchro, 0, "0: no synchro; 1 synchro with TR; 2 TRR etc") |
---|
| 531 | ("ScalingList", m_useScalingListId, 0, "0: no scaling list, 1: default scaling lists, 2: scaling lists specified in ScalingListFile") |
---|
| 532 | ("ScalingListFile", cfg_ScalingListFile, string(""), "Scaling list file name") |
---|
| 533 | ("SignHideFlag,-SBH", m_signHideFlag, 1) |
---|
| 534 | ("MaxNumMergeCand", m_maxNumMergeCand, 5u, "Maximum number of merge candidates") |
---|
| 535 | |
---|
| 536 | /* Misc. */ |
---|
| 537 | ("SEIDecodedPictureHash", m_decodedPictureHashSEIEnabled, 0, "Control generation of decode picture hash SEI messages\n" |
---|
| 538 | "\t3: checksum\n" |
---|
| 539 | "\t2: CRC\n" |
---|
| 540 | "\t1: use MD5\n" |
---|
| 541 | "\t0: disable") |
---|
| 542 | ("SEIpictureDigest", m_decodedPictureHashSEIEnabled, 0, "deprecated alias for SEIDecodedPictureHash") |
---|
| 543 | ("TMVPMode", m_TMVPModeId, 1, "TMVP mode 0: TMVP disable for all slices. 1: TMVP enable for all slices (default) 2: TMVP enable for certain slices only") |
---|
| 544 | ("FEN", m_bUseFastEnc, false, "fast encoder setting") |
---|
| 545 | ("ECU", m_bUseEarlyCU, false, "Early CU setting") |
---|
| 546 | ("FDM", m_useFastDecisionForMerge, true, "Fast decision for Merge RD Cost") |
---|
| 547 | ("CFM", m_bUseCbfFastMode, false, "Cbf fast mode setting") |
---|
| 548 | ("ESD", m_useEarlySkipDetection, false, "Early SKIP detection setting") |
---|
| 549 | #if RATE_CONTROL_LAMBDA_DOMAIN |
---|
| 550 | ( "RateControl", m_RCEnableRateControl, false, "Rate control: enable rate control" ) |
---|
| 551 | ( "TargetBitrate", m_RCTargetBitrate, 0, "Rate control: target bitrate" ) |
---|
| 552 | ( "KeepHierarchicalBit", m_RCKeepHierarchicalBit, false, "Rate control: keep hierarchical bit allocation in rate control algorithm" ) |
---|
| 553 | ( "LCULevelRateControl", m_RCLCULevelRC, true, "Rate control: true: LCU level RC; false: picture level RC" ) |
---|
| 554 | ( "RCLCUSeparateModel", m_RCUseLCUSeparateModel, true, "Rate control: use LCU level separate R-lambda model" ) |
---|
| 555 | ( "InitialQP", m_RCInitialQP, 0, "Rate control: initial QP" ) |
---|
| 556 | ( "RCForceIntraQP", m_RCForceIntraQP, false, "Rate control: force intra QP to be equal to initial QP" ) |
---|
| 557 | #else |
---|
| 558 | ("RateCtrl,-rc", m_enableRateCtrl, false, "Rate control on/off") |
---|
| 559 | ("TargetBitrate,-tbr", m_targetBitrate, 0, "Input target bitrate") |
---|
| 560 | ("NumLCUInUnit,-nu", m_numLCUInUnit, 0, "Number of LCUs in an Unit") |
---|
| 561 | #endif |
---|
| 562 | |
---|
| 563 | ("TransquantBypassEnableFlag", m_TransquantBypassEnableFlag, false, "transquant_bypass_enable_flag indicator in PPS") |
---|
| 564 | ("CUTransquantBypassFlagValue", m_CUTransquantBypassFlagValue, false, "Fixed cu_transquant_bypass_flag value, when transquant_bypass_enable_flag is enabled") |
---|
| 565 | ("RecalculateQPAccordingToLambda", m_recalculateQPAccordingToLambda, false, "Recalculate QP values according to lambda values. Do not suggest to be enabled in all intra case") |
---|
| 566 | ("StrongIntraSmoothing,-sis", m_useStrongIntraSmoothing, true, "Enable strong intra smoothing for 32x32 blocks") |
---|
| 567 | ("SEIActiveParameterSets", m_activeParameterSetsSEIEnabled, 0, "Enable generation of active parameter sets SEI messages") |
---|
| 568 | ("VuiParametersPresent,-vui", m_vuiParametersPresentFlag, false, "Enable generation of vui_parameters()") |
---|
| 569 | ("AspectRatioInfoPresent", m_aspectRatioInfoPresentFlag, false, "Signals whether aspect_ratio_idc is present") |
---|
| 570 | ("AspectRatioIdc", m_aspectRatioIdc, 0, "aspect_ratio_idc") |
---|
| 571 | ("SarWidth", m_sarWidth, 0, "horizontal size of the sample aspect ratio") |
---|
| 572 | ("SarHeight", m_sarHeight, 0, "vertical size of the sample aspect ratio") |
---|
| 573 | ("OverscanInfoPresent", m_overscanInfoPresentFlag, false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n") |
---|
| 574 | ("OverscanAppropriate", m_overscanAppropriateFlag, false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n") |
---|
| 575 | ("VideoSignalTypePresent", m_videoSignalTypePresentFlag, false, "Signals whether video_format, video_full_range_flag, and colour_description_present_flag are present") |
---|
| 576 | ("VideoFormat", m_videoFormat, 5, "Indicates representation of pictures") |
---|
| 577 | ("VideoFullRange", m_videoFullRangeFlag, false, "Indicates the black level and range of luma and chroma signals") |
---|
| 578 | ("ColourDescriptionPresent", m_colourDescriptionPresentFlag, false, "Signals whether colour_primaries, transfer_characteristics and matrix_coefficients are present") |
---|
| 579 | ("ColourPrimaries", m_colourPrimaries, 2, "Indicates chromaticity coordinates of the source primaries") |
---|
| 580 | ("TransferCharateristics", m_transferCharacteristics, 2, "Indicates the opto-electronic transfer characteristics of the source") |
---|
| 581 | ("MatrixCoefficients", m_matrixCoefficients, 2, "Describes the matrix coefficients used in deriving luma and chroma from RGB primaries") |
---|
| 582 | ("ChromaLocInfoPresent", m_chromaLocInfoPresentFlag, false, "Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present") |
---|
| 583 | ("ChromaSampleLocTypeTopField", m_chromaSampleLocTypeTopField, 0, "Specifies the location of chroma samples for top field") |
---|
| 584 | ("ChromaSampleLocTypeBottomField", m_chromaSampleLocTypeBottomField, 0, "Specifies the location of chroma samples for bottom field") |
---|
| 585 | ("NeutralChromaIndication", m_neutralChromaIndicationFlag, false, "Indicates that the value of all decoded chroma samples is equal to 1<<(BitDepthCr-1)") |
---|
| 586 | ("DefaultDisplayWindowFlag", m_defaultDisplayWindowFlag, false, "Indicates the presence of the Default Window parameters") |
---|
| 587 | ("DefDispWinLeftOffset", m_defDispWinLeftOffset, 0, "Specifies the left offset of the default display window from the conformance window") |
---|
| 588 | ("DefDispWinRightOffset", m_defDispWinRightOffset, 0, "Specifies the right offset of the default display window from the conformance window") |
---|
| 589 | ("DefDispWinTopOffset", m_defDispWinTopOffset, 0, "Specifies the top offset of the default display window from the conformance window") |
---|
| 590 | ("DefDispWinBottomOffset", m_defDispWinBottomOffset, 0, "Specifies the bottom offset of the default display window from the conformance window") |
---|
| 591 | ("FrameFieldInfoPresentFlag", m_frameFieldInfoPresentFlag, false, "Indicates that pic_struct and field coding related values are present in picture timing SEI messages") |
---|
| 592 | ("PocProportionalToTimingFlag", m_pocProportionalToTimingFlag, false, "Indicates that the POC value is proportional to the output time w.r.t. first picture in CVS") |
---|
| 593 | ("NumTicksPocDiffOneMinus1", m_numTicksPocDiffOneMinus1, 0, "Number of ticks minus 1 that for a POC difference of one") |
---|
| 594 | ("BitstreamRestriction", m_bitstreamRestrictionFlag, false, "Signals whether bitstream restriction parameters are present") |
---|
| 595 | ("TilesFixedStructure", m_tilesFixedStructureFlag, false, "Indicates that each active picture parameter set has the same values of the syntax elements related to tiles") |
---|
| 596 | ("MotionVectorsOverPicBoundaries", m_motionVectorsOverPicBoundariesFlag, false, "Indicates that no samples outside the picture boundaries are used for inter prediction") |
---|
| 597 | ("MaxBytesPerPicDenom", m_maxBytesPerPicDenom, 2, "Indicates a number of bytes not exceeded by the sum of the sizes of the VCL NAL units associated with any coded picture") |
---|
| 598 | ("MaxBitsPerMinCuDenom", m_maxBitsPerMinCuDenom, 1, "Indicates an upper bound for the number of bits of coding_unit() data") |
---|
| 599 | ("Log2MaxMvLengthHorizontal", m_log2MaxMvLengthHorizontal, 15, "Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units") |
---|
| 600 | ("Log2MaxMvLengthVertical", m_log2MaxMvLengthVertical, 15, "Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units") |
---|
| 601 | ("SEIRecoveryPoint", m_recoveryPointSEIEnabled, 0, "Control generation of recovery point SEI messages") |
---|
| 602 | ("SEIBufferingPeriod", m_bufferingPeriodSEIEnabled, 0, "Control generation of buffering period SEI messages") |
---|
| 603 | ("SEIPictureTiming", m_pictureTimingSEIEnabled, 0, "Control generation of picture timing SEI messages") |
---|
| 604 | ("SEIFramePacking", m_framePackingSEIEnabled, 0, "Control generation of frame packing SEI messages") |
---|
| 605 | ("SEIFramePackingType", m_framePackingSEIType, 0, "Define frame packing arrangement\n" |
---|
| 606 | "\t0: checkerboard - pixels alternatively represent either frames\n" |
---|
| 607 | "\t1: column alternation - frames are interlaced by column\n" |
---|
| 608 | "\t2: row alternation - frames are interlaced by row\n" |
---|
| 609 | "\t3: side by side - frames are displayed horizontally\n" |
---|
| 610 | "\t4: top bottom - frames are displayed vertically\n" |
---|
| 611 | "\t5: frame alternation - one frame is alternated with the other") |
---|
| 612 | ("SEIFramePackingId", m_framePackingSEIId, 0, "Id of frame packing SEI message for a given session") |
---|
| 613 | ("SEIFramePackingQuincunx", m_framePackingSEIQuincunx, 0, "Indicate the presence of a Quincunx type video frame") |
---|
| 614 | ("SEIFramePackingInterpretation", m_framePackingSEIInterpretation, 0, "Indicate the interpretation of the frame pair\n" |
---|
| 615 | "\t0: unspecified\n" |
---|
| 616 | "\t1: stereo pair, frame0 represents left view\n" |
---|
| 617 | "\t2: stereo pair, frame0 represents right view") |
---|
| 618 | ("SEIDisplayOrientation", m_displayOrientationSEIAngle, 0, "Control generation of display orientation SEI messages\n" |
---|
| 619 | "\tN: 0 < N < (2^16 - 1) enable display orientation SEI message with anticlockwise_rotation = N and display_orientation_repetition_period = 1\n" |
---|
| 620 | "\t0: disable") |
---|
| 621 | ("SEITemporalLevel0Index", m_temporalLevel0IndexSEIEnabled, 0, "Control generation of temporal level 0 index SEI messages") |
---|
| 622 | ("SEIGradualDecodingRefreshInfo", m_gradualDecodingRefreshInfoEnabled, 0, "Control generation of gradual decoding refresh information SEI message") |
---|
| 623 | ("SEIDecodingUnitInfo", m_decodingUnitInfoSEIEnabled, 0, "Control generation of decoding unit information SEI message.") |
---|
| 624 | #if SIGNAL_BITRATE_PICRATE_IN_VPS |
---|
| 625 | ("BitRatePicRateMaxTLayers", m_bitRatePicRateMaxTLayers, 0, "Maximum number of sub-layers signalled; can be inferred otherwise; here for easy parsing of config. file") |
---|
| 626 | ("BitRateInfoPresent", cfg_bitRateInfoPresentFlag, string(""), "Control signalling of bit rate information of avg. bit rate and max. bit rate in VPS\n" |
---|
| 627 | "\t0: Do not sent bit rate info\n" |
---|
| 628 | "\tN (N > 0): Send bit rate info for N sub-layers. N should equal maxTempLayers.") |
---|
| 629 | ("PicRateInfoPresent", cfg_picRateInfoPresentFlag, string(""), "Control signalling of picture rate information of avg. bit rate and max. bit rate in VPS\n" |
---|
| 630 | "\t0: Do not sent picture rate info\n" |
---|
| 631 | "\tN (N > 0): Send picture rate info for N sub-layers. N should equal maxTempLayers.") |
---|
| 632 | ("AvgBitRate", cfg_avgBitRate, string(""), "List of avg. bit rates for the different sub-layers; include non-negative number even if corresponding flag is 0") |
---|
| 633 | ("MaxBitRate", cfg_maxBitRate, string(""), "List of max. bit rates for the different sub-layers; include non-negative number even if corresponding flag is 0") |
---|
| 634 | ("AvgPicRate", cfg_avgPicRate, string(""), "List of avg. picture rates for the different sub-layers; include non-negative number even if corresponding flag is 0") |
---|
| 635 | ("ConstantPicRateIdc", cfg_constantPicRateIdc, string(""), "List of constant picture rate IDCs; include non-negative number even if corresponding flag is 0") |
---|
| 636 | #endif |
---|
| 637 | ; |
---|
| 638 | |
---|
| 639 | for(Int i=1; i<MAX_GOP+1; i++) { |
---|
| 640 | std::ostringstream cOSS; |
---|
| 641 | cOSS<<"Frame"<<i; |
---|
| 642 | opts.addOptions()(cOSS.str(), m_GOPList[i-1], GOPEntry()); |
---|
| 643 | } |
---|
| 644 | po::setDefaults(opts); |
---|
| 645 | const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv); |
---|
| 646 | |
---|
| 647 | for (list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++) |
---|
| 648 | { |
---|
| 649 | fprintf(stderr, "Unhandled argument ignored: `%s'\n", *it); |
---|
| 650 | } |
---|
| 651 | |
---|
| 652 | if (argc == 1 || do_help) |
---|
| 653 | { |
---|
| 654 | /* argc == 1: no options have been specified */ |
---|
| 655 | po::doHelp(cout, opts); |
---|
| 656 | return false; |
---|
| 657 | } |
---|
| 658 | |
---|
| 659 | /* |
---|
| 660 | * Set any derived parameters |
---|
| 661 | */ |
---|
| 662 | /* convert std::string to c string for compatability */ |
---|
| 663 | #if SVC_EXTENSION |
---|
| 664 | m_pBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str()); |
---|
| 665 | #if AVC_SYNTAX |
---|
| 666 | m_BLSyntaxFile = cfg_BLSyntaxFile.empty() ? NULL : strdup(cfg_BLSyntaxFile.c_str()); |
---|
| 667 | #endif |
---|
| 668 | #else |
---|
| 669 | m_pchInputFile = cfg_InputFile.empty() ? NULL : strdup(cfg_InputFile.c_str()); |
---|
| 670 | m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str()); |
---|
| 671 | m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str()); |
---|
| 672 | m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str()); |
---|
| 673 | #endif |
---|
| 674 | |
---|
| 675 | Char* pColumnWidth = cfg_ColumnWidth.empty() ? NULL: strdup(cfg_ColumnWidth.c_str()); |
---|
| 676 | Char* pRowHeight = cfg_RowHeight.empty() ? NULL : strdup(cfg_RowHeight.c_str()); |
---|
| 677 | if( m_iUniformSpacingIdr == 0 && m_iNumColumnsMinus1 > 0 ) |
---|
| 678 | { |
---|
| 679 | char *columnWidth; |
---|
| 680 | int i=0; |
---|
| 681 | m_pColumnWidth = new UInt[m_iNumColumnsMinus1]; |
---|
| 682 | columnWidth = strtok(pColumnWidth, " ,-"); |
---|
| 683 | while(columnWidth!=NULL) |
---|
| 684 | { |
---|
| 685 | if( i>=m_iNumColumnsMinus1 ) |
---|
| 686 | { |
---|
| 687 | printf( "The number of columns whose width are defined is larger than the allowed number of columns.\n" ); |
---|
| 688 | exit( EXIT_FAILURE ); |
---|
| 689 | } |
---|
| 690 | *( m_pColumnWidth + i ) = atoi( columnWidth ); |
---|
| 691 | columnWidth = strtok(NULL, " ,-"); |
---|
| 692 | i++; |
---|
| 693 | } |
---|
| 694 | if( i<m_iNumColumnsMinus1 ) |
---|
| 695 | { |
---|
| 696 | printf( "The width of some columns is not defined.\n" ); |
---|
| 697 | exit( EXIT_FAILURE ); |
---|
| 698 | } |
---|
| 699 | } |
---|
| 700 | else |
---|
| 701 | { |
---|
| 702 | m_pColumnWidth = NULL; |
---|
| 703 | } |
---|
| 704 | |
---|
| 705 | if( m_iUniformSpacingIdr == 0 && m_iNumRowsMinus1 > 0 ) |
---|
| 706 | { |
---|
| 707 | char *rowHeight; |
---|
| 708 | int i=0; |
---|
| 709 | m_pRowHeight = new UInt[m_iNumRowsMinus1]; |
---|
| 710 | rowHeight = strtok(pRowHeight, " ,-"); |
---|
| 711 | while(rowHeight!=NULL) |
---|
| 712 | { |
---|
| 713 | if( i>=m_iNumRowsMinus1 ) |
---|
| 714 | { |
---|
| 715 | printf( "The number of rows whose height are defined is larger than the allowed number of rows.\n" ); |
---|
| 716 | exit( EXIT_FAILURE ); |
---|
| 717 | } |
---|
| 718 | *( m_pRowHeight + i ) = atoi( rowHeight ); |
---|
| 719 | rowHeight = strtok(NULL, " ,-"); |
---|
| 720 | i++; |
---|
| 721 | } |
---|
| 722 | if( i<m_iNumRowsMinus1 ) |
---|
| 723 | { |
---|
| 724 | printf( "The height of some rows is not defined.\n" ); |
---|
| 725 | exit( EXIT_FAILURE ); |
---|
| 726 | } |
---|
| 727 | } |
---|
| 728 | else |
---|
| 729 | { |
---|
| 730 | m_pRowHeight = NULL; |
---|
| 731 | } |
---|
| 732 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
| 733 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
[2] | 734 | { |
---|
[125] | 735 | Char* pRefLayerIds = cfg_refLayerIds[layer].empty() ? NULL: strdup(cfg_refLayerIds[layer].c_str()); |
---|
| 736 | if( m_acLayerCfg[layer].m_numDirectRefLayers > 0 ) |
---|
| 737 | { |
---|
| 738 | char *refLayerId; |
---|
| 739 | int i=0; |
---|
| 740 | m_acLayerCfg[layer].m_refLayerIds = new Int[m_acLayerCfg[layer].m_numDirectRefLayers]; |
---|
| 741 | refLayerId = strtok(pRefLayerIds, " ,-"); |
---|
| 742 | while(refLayerId != NULL) |
---|
| 743 | { |
---|
| 744 | if( i >= m_acLayerCfg[layer].m_numDirectRefLayers ) |
---|
| 745 | { |
---|
| 746 | printf( "The number of columns whose width are defined is larger than the allowed number of columns.\n" ); |
---|
| 747 | exit( EXIT_FAILURE ); |
---|
| 748 | } |
---|
| 749 | *( m_acLayerCfg[layer].m_refLayerIds + i ) = atoi( refLayerId ); |
---|
| 750 | refLayerId = strtok(NULL, " ,-"); |
---|
| 751 | i++; |
---|
| 752 | } |
---|
| 753 | if( i < m_acLayerCfg[layer].m_numDirectRefLayers ) |
---|
| 754 | { |
---|
| 755 | printf( "The width of some columns is not defined.\n" ); |
---|
| 756 | exit( EXIT_FAILURE ); |
---|
| 757 | } |
---|
| 758 | } |
---|
| 759 | else |
---|
| 760 | { |
---|
| 761 | m_acLayerCfg[layer].m_refLayerIds = NULL; |
---|
| 762 | } |
---|
[2] | 763 | } |
---|
[125] | 764 | #endif |
---|
| 765 | #if SIGNAL_BITRATE_PICRATE_IN_VPS |
---|
| 766 | readBoolString(cfg_bitRateInfoPresentFlag, m_bitRatePicRateMaxTLayers, m_bitRateInfoPresentFlag, "bit rate info. present flag" ); |
---|
| 767 | readIntString (cfg_avgBitRate, m_bitRatePicRateMaxTLayers, m_avgBitRate, "avg. bit rate" ); |
---|
| 768 | readIntString (cfg_maxBitRate, m_bitRatePicRateMaxTLayers, m_maxBitRate, "max. bit rate" ); |
---|
| 769 | readBoolString(cfg_picRateInfoPresentFlag, m_bitRatePicRateMaxTLayers, m_picRateInfoPresentFlag, "bit rate info. present flag" ); |
---|
| 770 | readIntString (cfg_avgPicRate, m_bitRatePicRateMaxTLayers, m_avgPicRate, "avg. pic rate" ); |
---|
| 771 | readIntString (cfg_constantPicRateIdc, m_bitRatePicRateMaxTLayers, m_constantPicRateIdc, "constant pic rate Idc" ); |
---|
| 772 | #endif |
---|
| 773 | m_scalingListFile = cfg_ScalingListFile.empty() ? NULL : strdup(cfg_ScalingListFile.c_str()); |
---|
| 774 | |
---|
| 775 | /* rules for input, output and internal bitdepths as per help text */ |
---|
| 776 | if (!m_internalBitDepthY) { m_internalBitDepthY = m_inputBitDepthY; } |
---|
| 777 | if (!m_internalBitDepthC) { m_internalBitDepthC = m_internalBitDepthY; } |
---|
| 778 | if (!m_inputBitDepthC) { m_inputBitDepthC = m_inputBitDepthY; } |
---|
| 779 | if (!m_outputBitDepthY) { m_outputBitDepthY = m_internalBitDepthY; } |
---|
| 780 | if (!m_outputBitDepthC) { m_outputBitDepthC = m_internalBitDepthC; } |
---|
| 781 | |
---|
| 782 | #if !SVC_EXTENSION |
---|
| 783 | // TODO:ChromaFmt assumes 4:2:0 below |
---|
| 784 | switch (m_conformanceMode) |
---|
| 785 | { |
---|
| 786 | case 0: |
---|
| 787 | { |
---|
| 788 | // no conformance or padding |
---|
| 789 | m_confLeft = m_confRight = m_confTop = m_confBottom = 0; |
---|
| 790 | m_aiPad[1] = m_aiPad[0] = 0; |
---|
| 791 | break; |
---|
| 792 | } |
---|
| 793 | case 1: |
---|
| 794 | { |
---|
| 795 | // automatic padding to minimum CU size |
---|
| 796 | Int minCuSize = m_uiMaxCUHeight >> (m_uiMaxCUDepth - 1); |
---|
| 797 | if (m_iSourceWidth % minCuSize) |
---|
| 798 | { |
---|
| 799 | m_aiPad[0] = m_confRight = ((m_iSourceWidth / minCuSize) + 1) * minCuSize - m_iSourceWidth; |
---|
| 800 | m_iSourceWidth += m_confRight; |
---|
| 801 | } |
---|
| 802 | if (m_iSourceHeight % minCuSize) |
---|
| 803 | { |
---|
| 804 | m_aiPad[1] = m_confBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight; |
---|
| 805 | m_iSourceHeight += m_confBottom; |
---|
| 806 | } |
---|
| 807 | if (m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0) |
---|
| 808 | { |
---|
| 809 | fprintf(stderr, "Error: picture width is not an integer multiple of the specified chroma subsampling\n"); |
---|
| 810 | exit(EXIT_FAILURE); |
---|
| 811 | } |
---|
| 812 | if (m_aiPad[1] % TComSPS::getWinUnitY(CHROMA_420) != 0) |
---|
| 813 | { |
---|
| 814 | fprintf(stderr, "Error: picture height is not an integer multiple of the specified chroma subsampling\n"); |
---|
| 815 | exit(EXIT_FAILURE); |
---|
| 816 | } |
---|
| 817 | break; |
---|
| 818 | } |
---|
| 819 | case 2: |
---|
| 820 | { |
---|
| 821 | //padding |
---|
| 822 | m_iSourceWidth += m_aiPad[0]; |
---|
| 823 | m_iSourceHeight += m_aiPad[1]; |
---|
| 824 | m_confRight = m_aiPad[0]; |
---|
| 825 | m_confBottom = m_aiPad[1]; |
---|
| 826 | break; |
---|
| 827 | } |
---|
| 828 | case 3: |
---|
| 829 | { |
---|
| 830 | // conformance |
---|
| 831 | if ((m_confLeft == 0) && (m_confRight == 0) && (m_confTop == 0) && (m_confBottom == 0)) |
---|
| 832 | { |
---|
| 833 | fprintf(stderr, "Warning: Conformance window enabled, but all conformance window parameters set to zero\n"); |
---|
| 834 | } |
---|
| 835 | if ((m_aiPad[1] != 0) || (m_aiPad[0]!=0)) |
---|
| 836 | { |
---|
| 837 | fprintf(stderr, "Warning: Conformance window enabled, padding parameters will be ignored\n"); |
---|
| 838 | } |
---|
| 839 | m_aiPad[1] = m_aiPad[0] = 0; |
---|
| 840 | break; |
---|
| 841 | } |
---|
| 842 | } |
---|
| 843 | |
---|
| 844 | // allocate slice-based dQP values |
---|
| 845 | m_aidQP = new Int[ m_framesToBeEncoded + m_iGOPSize + 1 ]; |
---|
| 846 | ::memset( m_aidQP, 0, sizeof(Int)*( m_framesToBeEncoded + m_iGOPSize + 1 ) ); |
---|
| 847 | |
---|
| 848 | // handling of floating-point QP values |
---|
| 849 | // if QP is not integer, sequence is split into two sections having QP and QP+1 |
---|
| 850 | m_iQP = (Int)( m_fQP ); |
---|
| 851 | if ( m_iQP < m_fQP ) |
---|
| 852 | { |
---|
| 853 | Int iSwitchPOC = (Int)( m_framesToBeEncoded - (m_fQP - m_iQP)*m_framesToBeEncoded + 0.5 ); |
---|
| 854 | |
---|
| 855 | iSwitchPOC = (Int)( (Double)iSwitchPOC / m_iGOPSize + 0.5 )*m_iGOPSize; |
---|
| 856 | for ( Int i=iSwitchPOC; i<m_framesToBeEncoded + m_iGOPSize + 1; i++ ) |
---|
| 857 | { |
---|
| 858 | m_aidQP[i] = 1; |
---|
| 859 | } |
---|
| 860 | } |
---|
| 861 | |
---|
| 862 | // reading external dQP description from file |
---|
| 863 | if ( m_pchdQPFile ) |
---|
| 864 | { |
---|
| 865 | FILE* fpt=fopen( m_pchdQPFile, "r" ); |
---|
| 866 | if ( fpt ) |
---|
| 867 | { |
---|
| 868 | Int iValue; |
---|
| 869 | Int iPOC = 0; |
---|
| 870 | while ( iPOC < m_framesToBeEncoded ) |
---|
| 871 | { |
---|
| 872 | if ( fscanf(fpt, "%d", &iValue ) == EOF ) break; |
---|
| 873 | m_aidQP[ iPOC ] = iValue; |
---|
| 874 | iPOC++; |
---|
| 875 | } |
---|
| 876 | fclose(fpt); |
---|
| 877 | } |
---|
| 878 | } |
---|
| 879 | m_iWaveFrontSubstreams = m_iWaveFrontSynchro ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1; |
---|
| 880 | #endif |
---|
| 881 | // check validity of input parameters |
---|
| 882 | xCheckParameter(); |
---|
| 883 | |
---|
| 884 | // set global varibles |
---|
| 885 | xSetGlobal(); |
---|
| 886 | |
---|
| 887 | // print-out parameters |
---|
| 888 | xPrintParameter(); |
---|
| 889 | |
---|
| 890 | return true; |
---|
| 891 | } |
---|
| 892 | #if SIGNAL_BITRATE_PICRATE_IN_VPS |
---|
| 893 | Void readBoolString(const string inpString, const Int numEntries, Bool* &memberArray, const char *elementName) |
---|
| 894 | { |
---|
| 895 | Char* inpArray = inpString.empty() ? NULL : strdup(inpString.c_str()); |
---|
| 896 | Int i = 0; |
---|
| 897 | if(numEntries) |
---|
| 898 | { |
---|
| 899 | Char* tempArray = strtok(inpArray, " ,-"); |
---|
| 900 | memberArray = new Bool[numEntries]; |
---|
| 901 | while( tempArray != NULL ) |
---|
| 902 | { |
---|
| 903 | if( i >= numEntries ) |
---|
| 904 | { |
---|
| 905 | printf( "The number of %s defined is larger than the allowed number\n", elementName ); |
---|
| 906 | exit( EXIT_FAILURE ); |
---|
| 907 | } |
---|
| 908 | assert( (atoi(tempArray) == 0) || (atoi(tempArray) == 1) ); |
---|
| 909 | *( memberArray + i ) = atoi(tempArray); |
---|
| 910 | tempArray = strtok(NULL, " ,-"); |
---|
| 911 | i++; |
---|
| 912 | } |
---|
| 913 | if( i < numEntries ) |
---|
| 914 | { |
---|
| 915 | printf( "Some %s are not defined\n", elementName ); |
---|
| 916 | exit( EXIT_FAILURE ); |
---|
| 917 | } |
---|
| 918 | } |
---|
| 919 | else |
---|
| 920 | { |
---|
| 921 | memberArray = NULL; |
---|
| 922 | } |
---|
| 923 | } |
---|
| 924 | |
---|
| 925 | Void readIntString(const string inpString, const Int numEntries, Int* &memberArray, const char *elementName) |
---|
| 926 | { |
---|
| 927 | Char* inpArray = inpString.empty() ? NULL : strdup(inpString.c_str()); |
---|
| 928 | Int i = 0; |
---|
| 929 | if(numEntries) |
---|
| 930 | { |
---|
| 931 | Char* tempArray = strtok(inpArray, " ,-"); |
---|
| 932 | memberArray = new Int[numEntries]; |
---|
| 933 | while( tempArray != NULL ) |
---|
| 934 | { |
---|
| 935 | if( i >= numEntries ) |
---|
| 936 | { |
---|
| 937 | printf( "The number of %s defined is larger than the allowed number\n", elementName ); |
---|
| 938 | exit( EXIT_FAILURE ); |
---|
| 939 | } |
---|
| 940 | *( memberArray + i ) = atoi(tempArray); |
---|
| 941 | tempArray = strtok(NULL, " ,-"); |
---|
| 942 | i++; |
---|
| 943 | } |
---|
| 944 | if( i < numEntries ) |
---|
| 945 | { |
---|
| 946 | printf( "Some %s are not defined\n", elementName ); |
---|
| 947 | exit( EXIT_FAILURE ); |
---|
| 948 | } |
---|
| 949 | } |
---|
| 950 | else |
---|
| 951 | { |
---|
| 952 | memberArray = NULL; |
---|
| 953 | } |
---|
| 954 | } |
---|
| 955 | #endif |
---|
| 956 | // ==================================================================================================================== |
---|
| 957 | // Private member functions |
---|
| 958 | // ==================================================================================================================== |
---|
| 959 | |
---|
| 960 | Bool confirmPara(Bool bflag, const Char* message); |
---|
| 961 | |
---|
| 962 | Void TAppEncCfg::xCheckParameter() |
---|
| 963 | { |
---|
| 964 | if (!m_decodedPictureHashSEIEnabled) |
---|
| 965 | { |
---|
| 966 | fprintf(stderr, "******************************************************************\n"); |
---|
| 967 | fprintf(stderr, "** WARNING: --SEIDecodedPictureHash is now disabled by default. **\n"); |
---|
| 968 | fprintf(stderr, "** Automatic verification of decoded pictures by a **\n"); |
---|
| 969 | fprintf(stderr, "** decoder requires this option to be enabled. **\n"); |
---|
| 970 | fprintf(stderr, "******************************************************************\n"); |
---|
| 971 | } |
---|
| 972 | |
---|
| 973 | Bool check_failed = false; /* abort if there is a fatal configuration problem */ |
---|
| 974 | #define xConfirmPara(a,b) check_failed |= confirmPara(a,b) |
---|
| 975 | // check range of parameters |
---|
| 976 | xConfirmPara( m_inputBitDepthY < 8, "InputBitDepth must be at least 8" ); |
---|
| 977 | xConfirmPara( m_inputBitDepthC < 8, "InputBitDepthC must be at least 8" ); |
---|
| 978 | #if !SVC_EXTENSION |
---|
| 979 | xConfirmPara( m_iFrameRate <= 0, "Frame rate must be more than 1" ); |
---|
| 980 | #endif |
---|
| 981 | xConfirmPara( m_framesToBeEncoded <= 0, "Total Number Of Frames encoded must be more than 0" ); |
---|
| 982 | xConfirmPara( m_iGOPSize < 1 , "GOP Size must be greater or equal to 1" ); |
---|
| 983 | xConfirmPara( m_iGOPSize > 1 && m_iGOPSize % 2, "GOP Size must be a multiple of 2, if GOP Size is greater than 1" ); |
---|
| 984 | #if !SVC_EXTENSION |
---|
| 985 | xConfirmPara( (m_iIntraPeriod > 0 && m_iIntraPeriod < m_iGOPSize) || m_iIntraPeriod == 0, "Intra period must be more than GOP size, or -1 , not 0" ); |
---|
| 986 | #endif |
---|
| 987 | xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 2, "Decoding Refresh Type must be equal to 0, 1 or 2" ); |
---|
| 988 | #if !SVC_EXTENSION |
---|
| 989 | xConfirmPara( m_iQP < -6 * (m_internalBitDepthY - 8) || m_iQP > 51, "QP exceeds supported range (-QpBDOffsety to 51)" ); |
---|
| 990 | #endif |
---|
| 991 | xConfirmPara( m_loopFilterBetaOffsetDiv2 < -13 || m_loopFilterBetaOffsetDiv2 > 13, "Loop Filter Beta Offset div. 2 exceeds supported range (-13 to 13)"); |
---|
| 992 | xConfirmPara( m_loopFilterTcOffsetDiv2 < -13 || m_loopFilterTcOffsetDiv2 > 13, "Loop Filter Tc Offset div. 2 exceeds supported range (-13 to 13)"); |
---|
| 993 | xConfirmPara( m_iFastSearch < 0 || m_iFastSearch > 2, "Fast Search Mode is not supported value (0:Full search 1:Diamond 2:PMVFAST)" ); |
---|
| 994 | xConfirmPara( m_iSearchRange < 0 , "Search Range must be more than 0" ); |
---|
| 995 | xConfirmPara( m_bipredSearchRange < 0 , "Search Range must be more than 0" ); |
---|
| 996 | xConfirmPara( m_iMaxDeltaQP > 7, "Absolute Delta QP exceeds supported range (0 to 7)" ); |
---|
| 997 | xConfirmPara( m_iMaxCuDQPDepth > m_uiMaxCUDepth - 1, "Absolute depth for a minimum CuDQP exceeds maximum coding unit depth" ); |
---|
| 998 | |
---|
| 999 | xConfirmPara( m_cbQpOffset < -12, "Min. Chroma Cb QP Offset is -12" ); |
---|
| 1000 | xConfirmPara( m_cbQpOffset > 12, "Max. Chroma Cb QP Offset is 12" ); |
---|
| 1001 | xConfirmPara( m_crQpOffset < -12, "Min. Chroma Cr QP Offset is -12" ); |
---|
| 1002 | xConfirmPara( m_crQpOffset > 12, "Max. Chroma Cr QP Offset is 12" ); |
---|
| 1003 | |
---|
| 1004 | xConfirmPara( m_iQPAdaptationRange <= 0, "QP Adaptation Range must be more than 0" ); |
---|
| 1005 | #if !SVC_EXTENSION |
---|
| 1006 | if (m_iDecodingRefreshType == 2) |
---|
| 1007 | { |
---|
| 1008 | xConfirmPara( m_iIntraPeriod > 0 && m_iIntraPeriod <= m_iGOPSize , "Intra period must be larger than GOP size for periodic IDR pictures"); |
---|
| 1009 | } |
---|
| 1010 | #endif |
---|
| 1011 | xConfirmPara( (m_uiMaxCUWidth >> m_uiMaxCUDepth) < 4, "Minimum partition width size should be larger than or equal to 8"); |
---|
| 1012 | xConfirmPara( (m_uiMaxCUHeight >> m_uiMaxCUDepth) < 4, "Minimum partition height size should be larger than or equal to 8"); |
---|
| 1013 | xConfirmPara( m_uiMaxCUWidth < 16, "Maximum partition width size should be larger than or equal to 16"); |
---|
| 1014 | xConfirmPara( m_uiMaxCUHeight < 16, "Maximum partition height size should be larger than or equal to 16"); |
---|
| 1015 | #if !SVC_EXTENSION |
---|
| 1016 | xConfirmPara( (m_iSourceWidth % (m_uiMaxCUWidth >> (m_uiMaxCUDepth-1)))!=0, "Resulting coded frame width must be a multiple of the minimum CU size"); |
---|
| 1017 | xConfirmPara( (m_iSourceHeight % (m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)))!=0, "Resulting coded frame height must be a multiple of the minimum CU size"); |
---|
| 1018 | #endif |
---|
| 1019 | |
---|
| 1020 | xConfirmPara( m_uiQuadtreeTULog2MinSize < 2, "QuadtreeTULog2MinSize must be 2 or greater."); |
---|
| 1021 | xConfirmPara( m_uiQuadtreeTULog2MaxSize > 5, "QuadtreeTULog2MaxSize must be 5 or smaller."); |
---|
| 1022 | xConfirmPara( (1<<m_uiQuadtreeTULog2MaxSize) > m_uiMaxCUWidth, "QuadtreeTULog2MaxSize must be log2(maxCUSize) or smaller."); |
---|
| 1023 | |
---|
| 1024 | xConfirmPara( m_uiQuadtreeTULog2MaxSize < m_uiQuadtreeTULog2MinSize, "QuadtreeTULog2MaxSize must be greater than or equal to m_uiQuadtreeTULog2MinSize."); |
---|
| 1025 | xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUWidth >>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS |
---|
| 1026 | xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUHeight>>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS |
---|
| 1027 | xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUWidth >> m_uiMaxCUDepth ), "Minimum CU width must be greater than minimum transform size." ); |
---|
| 1028 | xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUHeight >> m_uiMaxCUDepth ), "Minimum CU height must be greater than minimum transform size." ); |
---|
| 1029 | xConfirmPara( m_uiQuadtreeTUMaxDepthInter < 1, "QuadtreeTUMaxDepthInter must be greater than or equal to 1" ); |
---|
| 1030 | xConfirmPara( m_uiMaxCUWidth < ( 1 << (m_uiQuadtreeTULog2MinSize + m_uiQuadtreeTUMaxDepthInter - 1) ), "QuadtreeTUMaxDepthInter must be less than or equal to the difference between log2(maxCUSize) and QuadtreeTULog2MinSize plus 1" ); |
---|
| 1031 | xConfirmPara( m_uiQuadtreeTUMaxDepthIntra < 1, "QuadtreeTUMaxDepthIntra must be greater than or equal to 1" ); |
---|
| 1032 | xConfirmPara( m_uiMaxCUWidth < ( 1 << (m_uiQuadtreeTULog2MinSize + m_uiQuadtreeTUMaxDepthIntra - 1) ), "QuadtreeTUMaxDepthInter must be less than or equal to the difference between log2(maxCUSize) and QuadtreeTULog2MinSize plus 1" ); |
---|
| 1033 | |
---|
| 1034 | xConfirmPara( m_maxNumMergeCand < 1, "MaxNumMergeCand must be 1 or greater."); |
---|
| 1035 | xConfirmPara( m_maxNumMergeCand > 5, "MaxNumMergeCand must be 5 or smaller."); |
---|
| 1036 | |
---|
| 1037 | #if !SVC_EXTENSION |
---|
| 1038 | #if ADAPTIVE_QP_SELECTION |
---|
| 1039 | xConfirmPara( m_bUseAdaptQpSelect == true && m_iQP < 0, "AdaptiveQpSelection must be disabled when QP < 0."); |
---|
| 1040 | xConfirmPara( m_bUseAdaptQpSelect == true && (m_cbQpOffset !=0 || m_crQpOffset != 0 ), "AdaptiveQpSelection must be disabled when ChromaQpOffset is not equal to 0."); |
---|
| 1041 | #endif |
---|
| 1042 | #endif |
---|
| 1043 | |
---|
| 1044 | if( m_usePCM) |
---|
| 1045 | { |
---|
| 1046 | xConfirmPara( m_uiPCMLog2MinSize < 3, "PCMLog2MinSize must be 3 or greater."); |
---|
| 1047 | xConfirmPara( m_uiPCMLog2MinSize > 5, "PCMLog2MinSize must be 5 or smaller."); |
---|
| 1048 | xConfirmPara( m_pcmLog2MaxSize > 5, "PCMLog2MaxSize must be 5 or smaller."); |
---|
| 1049 | xConfirmPara( m_pcmLog2MaxSize < m_uiPCMLog2MinSize, "PCMLog2MaxSize must be equal to or greater than m_uiPCMLog2MinSize."); |
---|
| 1050 | } |
---|
| 1051 | |
---|
| 1052 | xConfirmPara( m_sliceMode < 0 || m_sliceMode > 3, "SliceMode exceeds supported range (0 to 3)" ); |
---|
| 1053 | if (m_sliceMode!=0) |
---|
| 1054 | { |
---|
| 1055 | xConfirmPara( m_sliceArgument < 1 , "SliceArgument should be larger than or equal to 1" ); |
---|
| 1056 | } |
---|
| 1057 | xConfirmPara( m_sliceSegmentMode < 0 || m_sliceSegmentMode > 3, "SliceSegmentMode exceeds supported range (0 to 3)" ); |
---|
| 1058 | if (m_sliceSegmentMode!=0) |
---|
| 1059 | { |
---|
| 1060 | xConfirmPara( m_sliceSegmentArgument < 1 , "SliceSegmentArgument should be larger than or equal to 1" ); |
---|
| 1061 | } |
---|
| 1062 | |
---|
| 1063 | Bool tileFlag = (m_iNumColumnsMinus1 > 0 || m_iNumRowsMinus1 > 0 ); |
---|
| 1064 | xConfirmPara( tileFlag && m_iWaveFrontSynchro, "Tile and Wavefront can not be applied together"); |
---|
| 1065 | |
---|
| 1066 | //TODO:ChromaFmt assumes 4:2:0 below |
---|
| 1067 | #if !SVC_EXTENSION |
---|
| 1068 | xConfirmPara( m_iSourceWidth % TComSPS::getWinUnitX(CHROMA_420) != 0, "Picture width must be an integer multiple of the specified chroma subsampling"); |
---|
| 1069 | xConfirmPara( m_iSourceHeight % TComSPS::getWinUnitY(CHROMA_420) != 0, "Picture height must be an integer multiple of the specified chroma subsampling"); |
---|
| 1070 | |
---|
| 1071 | xConfirmPara( m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0, "Horizontal padding must be an integer multiple of the specified chroma subsampling"); |
---|
| 1072 | xConfirmPara( m_aiPad[1] % TComSPS::getWinUnitY(CHROMA_420) != 0, "Vertical padding must be an integer multiple of the specified chroma subsampling"); |
---|
| 1073 | |
---|
| 1074 | xConfirmPara( m_confLeft % TComSPS::getWinUnitX(CHROMA_420) != 0, "Left conformance window offset must be an integer multiple of the specified chroma subsampling"); |
---|
| 1075 | xConfirmPara( m_confRight % TComSPS::getWinUnitX(CHROMA_420) != 0, "Right conformance window offset must be an integer multiple of the specified chroma subsampling"); |
---|
| 1076 | xConfirmPara( m_confTop % TComSPS::getWinUnitY(CHROMA_420) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling"); |
---|
| 1077 | xConfirmPara( m_confBottom % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling"); |
---|
| 1078 | #endif |
---|
| 1079 | |
---|
| 1080 | // max CU width and height should be power of 2 |
---|
| 1081 | UInt ui = m_uiMaxCUWidth; |
---|
| 1082 | while(ui) |
---|
| 1083 | { |
---|
| 1084 | ui >>= 1; |
---|
| 1085 | if( (ui & 1) == 1) |
---|
| 1086 | xConfirmPara( ui != 1 , "Width should be 2^n"); |
---|
| 1087 | } |
---|
| 1088 | ui = m_uiMaxCUHeight; |
---|
| 1089 | while(ui) |
---|
| 1090 | { |
---|
| 1091 | ui >>= 1; |
---|
| 1092 | if( (ui & 1) == 1) |
---|
| 1093 | xConfirmPara( ui != 1 , "Height should be 2^n"); |
---|
| 1094 | } |
---|
| 1095 | |
---|
| 1096 | |
---|
| 1097 | /* if this is an intra-only sequence, ie IntraPeriod=1, don't verify the GOP structure |
---|
| 1098 | * This permits the ability to omit a GOP structure specification */ |
---|
| 1099 | #if SVC_EXTENSION |
---|
| 1100 | for(UInt layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 1101 | { |
---|
| 1102 | Int m_iIntraPeriod = m_acLayerCfg[layer].m_iIntraPeriod; |
---|
| 1103 | #endif |
---|
| 1104 | if (m_iIntraPeriod == 1 && m_GOPList[0].m_POC == -1) { |
---|
| 1105 | m_GOPList[0] = GOPEntry(); |
---|
| 1106 | m_GOPList[0].m_QPFactor = 1; |
---|
| 1107 | m_GOPList[0].m_betaOffsetDiv2 = 0; |
---|
| 1108 | m_GOPList[0].m_tcOffsetDiv2 = 0; |
---|
| 1109 | m_GOPList[0].m_POC = 1; |
---|
| 1110 | m_GOPList[0].m_numRefPicsActive = 4; |
---|
| 1111 | } |
---|
| 1112 | #if SVC_EXTENSION |
---|
| 1113 | } |
---|
| 1114 | #endif |
---|
| 1115 | |
---|
| 1116 | Bool verifiedGOP=false; |
---|
| 1117 | Bool errorGOP=false; |
---|
| 1118 | Int checkGOP=1; |
---|
| 1119 | Int numRefs = 1; |
---|
| 1120 | Int refList[MAX_NUM_REF_PICS+1]; |
---|
| 1121 | refList[0]=0; |
---|
| 1122 | Bool isOK[MAX_GOP]; |
---|
| 1123 | for(Int i=0; i<MAX_GOP; i++) |
---|
| 1124 | { |
---|
| 1125 | isOK[i]=false; |
---|
| 1126 | } |
---|
| 1127 | Int numOK=0; |
---|
| 1128 | #if !SVC_EXTENSION |
---|
| 1129 | xConfirmPara( m_iIntraPeriod >=0&&(m_iIntraPeriod%m_iGOPSize!=0), "Intra period must be a multiple of GOPSize, or -1" ); |
---|
| 1130 | #endif |
---|
| 1131 | |
---|
| 1132 | for(Int i=0; i<m_iGOPSize; i++) |
---|
| 1133 | { |
---|
| 1134 | if(m_GOPList[i].m_POC==m_iGOPSize) |
---|
| 1135 | { |
---|
| 1136 | xConfirmPara( m_GOPList[i].m_temporalId!=0 , "The last frame in each GOP must have temporal ID = 0 " ); |
---|
| 1137 | } |
---|
| 1138 | } |
---|
| 1139 | |
---|
| 1140 | #if SVC_EXTENSION |
---|
| 1141 | // verify layer configuration parameters |
---|
| 1142 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
| 1143 | { |
---|
| 1144 | if(m_acLayerCfg[layer].xCheckParameter()) |
---|
| 1145 | { |
---|
| 1146 | printf("\nError: invalid configuration parameter found in layer %d \n", layer); |
---|
| 1147 | check_failed = true; |
---|
| 1148 | } |
---|
| 1149 | } |
---|
| 1150 | #endif |
---|
| 1151 | |
---|
| 1152 | #if SVC_EXTENSION |
---|
| 1153 | // verify layer configuration parameters |
---|
| 1154 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
| 1155 | { |
---|
| 1156 | Int m_iIntraPeriod = m_acLayerCfg[layer].m_iIntraPeriod; |
---|
| 1157 | #endif |
---|
| 1158 | if ( (m_iIntraPeriod != 1) && !m_loopFilterOffsetInPPS && m_DeblockingFilterControlPresent && (!m_bLoopFilterDisable) ) |
---|
| 1159 | { |
---|
| 1160 | for(Int i=0; i<m_iGOPSize; i++) |
---|
| 1161 | { |
---|
| 1162 | xConfirmPara( (m_GOPList[i].m_betaOffsetDiv2 + m_loopFilterBetaOffsetDiv2) < -6 || (m_GOPList[i].m_betaOffsetDiv2 + m_loopFilterBetaOffsetDiv2) > 6, "Loop Filter Beta Offset div. 2 for one of the GOP entries exceeds supported range (-6 to 6)" ); |
---|
| 1163 | xConfirmPara( (m_GOPList[i].m_tcOffsetDiv2 + m_loopFilterTcOffsetDiv2) < -6 || (m_GOPList[i].m_tcOffsetDiv2 + m_loopFilterTcOffsetDiv2) > 6, "Loop Filter Tc Offset div. 2 for one of the GOP entries exceeds supported range (-6 to 6)" ); |
---|
| 1164 | } |
---|
| 1165 | } |
---|
| 1166 | #if SVC_EXTENSION |
---|
| 1167 | } |
---|
| 1168 | #endif |
---|
| 1169 | |
---|
| 1170 | m_extraRPSs=0; |
---|
| 1171 | //start looping through frames in coding order until we can verify that the GOP structure is correct. |
---|
| 1172 | while(!verifiedGOP&&!errorGOP) |
---|
| 1173 | { |
---|
| 1174 | Int curGOP = (checkGOP-1)%m_iGOPSize; |
---|
| 1175 | Int curPOC = ((checkGOP-1)/m_iGOPSize)*m_iGOPSize + m_GOPList[curGOP].m_POC; |
---|
| 1176 | if(m_GOPList[curGOP].m_POC<0) |
---|
| 1177 | { |
---|
| 1178 | printf("\nError: found fewer Reference Picture Sets than GOPSize\n"); |
---|
| 1179 | errorGOP=true; |
---|
| 1180 | } |
---|
| 1181 | else |
---|
| 1182 | { |
---|
| 1183 | //check that all reference pictures are available, or have a POC < 0 meaning they might be available in the next GOP. |
---|
| 1184 | Bool beforeI = false; |
---|
| 1185 | for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) |
---|
| 1186 | { |
---|
| 1187 | Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i]; |
---|
| 1188 | if(absPOC < 0) |
---|
| 1189 | { |
---|
| 1190 | beforeI=true; |
---|
| 1191 | } |
---|
| 1192 | else |
---|
| 1193 | { |
---|
| 1194 | Bool found=false; |
---|
| 1195 | for(Int j=0; j<numRefs; j++) |
---|
| 1196 | { |
---|
| 1197 | if(refList[j]==absPOC) |
---|
| 1198 | { |
---|
| 1199 | found=true; |
---|
| 1200 | for(Int k=0; k<m_iGOPSize; k++) |
---|
| 1201 | { |
---|
| 1202 | if(absPOC%m_iGOPSize == m_GOPList[k].m_POC%m_iGOPSize) |
---|
| 1203 | { |
---|
| 1204 | if(m_GOPList[k].m_temporalId==m_GOPList[curGOP].m_temporalId) |
---|
| 1205 | { |
---|
| 1206 | m_GOPList[k].m_refPic = true; |
---|
| 1207 | } |
---|
| 1208 | m_GOPList[curGOP].m_usedByCurrPic[i]=m_GOPList[k].m_temporalId<=m_GOPList[curGOP].m_temporalId; |
---|
| 1209 | } |
---|
| 1210 | } |
---|
| 1211 | } |
---|
| 1212 | } |
---|
| 1213 | if(!found) |
---|
| 1214 | { |
---|
| 1215 | printf("\nError: ref pic %d is not available for GOP frame %d\n",m_GOPList[curGOP].m_referencePics[i],curGOP+1); |
---|
| 1216 | errorGOP=true; |
---|
| 1217 | } |
---|
| 1218 | } |
---|
| 1219 | } |
---|
| 1220 | if(!beforeI&&!errorGOP) |
---|
| 1221 | { |
---|
| 1222 | //all ref frames were present |
---|
| 1223 | if(!isOK[curGOP]) |
---|
| 1224 | { |
---|
| 1225 | numOK++; |
---|
| 1226 | isOK[curGOP]=true; |
---|
| 1227 | if(numOK==m_iGOPSize) |
---|
| 1228 | { |
---|
| 1229 | verifiedGOP=true; |
---|
| 1230 | } |
---|
| 1231 | } |
---|
| 1232 | } |
---|
| 1233 | else |
---|
| 1234 | { |
---|
| 1235 | //create a new GOPEntry for this frame containing all the reference pictures that were available (POC > 0) |
---|
| 1236 | m_GOPList[m_iGOPSize+m_extraRPSs]=m_GOPList[curGOP]; |
---|
| 1237 | Int newRefs=0; |
---|
| 1238 | for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) |
---|
| 1239 | { |
---|
| 1240 | Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i]; |
---|
| 1241 | if(absPOC>=0) |
---|
| 1242 | { |
---|
| 1243 | m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[newRefs]=m_GOPList[curGOP].m_referencePics[i]; |
---|
| 1244 | m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[newRefs]=m_GOPList[curGOP].m_usedByCurrPic[i]; |
---|
| 1245 | newRefs++; |
---|
| 1246 | } |
---|
| 1247 | } |
---|
| 1248 | Int numPrefRefs = m_GOPList[curGOP].m_numRefPicsActive; |
---|
| 1249 | |
---|
| 1250 | for(Int offset = -1; offset>-checkGOP; offset--) |
---|
| 1251 | { |
---|
| 1252 | //step backwards in coding order and include any extra available pictures we might find useful to replace the ones with POC < 0. |
---|
| 1253 | Int offGOP = (checkGOP-1+offset)%m_iGOPSize; |
---|
| 1254 | Int offPOC = ((checkGOP-1+offset)/m_iGOPSize)*m_iGOPSize + m_GOPList[offGOP].m_POC; |
---|
| 1255 | if(offPOC>=0&&m_GOPList[offGOP].m_temporalId<=m_GOPList[curGOP].m_temporalId) |
---|
| 1256 | { |
---|
| 1257 | Bool newRef=false; |
---|
| 1258 | for(Int i=0; i<numRefs; i++) |
---|
| 1259 | { |
---|
| 1260 | if(refList[i]==offPOC) |
---|
| 1261 | { |
---|
| 1262 | newRef=true; |
---|
| 1263 | } |
---|
| 1264 | } |
---|
| 1265 | for(Int i=0; i<newRefs; i++) |
---|
| 1266 | { |
---|
| 1267 | if(m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[i]==offPOC-curPOC) |
---|
| 1268 | { |
---|
| 1269 | newRef=false; |
---|
| 1270 | } |
---|
| 1271 | } |
---|
| 1272 | if(newRef) |
---|
| 1273 | { |
---|
| 1274 | Int insertPoint=newRefs; |
---|
| 1275 | //this picture can be added, find appropriate place in list and insert it. |
---|
| 1276 | if(m_GOPList[offGOP].m_temporalId==m_GOPList[curGOP].m_temporalId) |
---|
| 1277 | { |
---|
| 1278 | m_GOPList[offGOP].m_refPic = true; |
---|
| 1279 | } |
---|
| 1280 | for(Int j=0; j<newRefs; j++) |
---|
| 1281 | { |
---|
| 1282 | if(m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]<offPOC-curPOC||m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]>0) |
---|
| 1283 | { |
---|
| 1284 | insertPoint = j; |
---|
| 1285 | break; |
---|
| 1286 | } |
---|
| 1287 | } |
---|
| 1288 | Int prev = offPOC-curPOC; |
---|
| 1289 | Int prevUsed = m_GOPList[offGOP].m_temporalId<=m_GOPList[curGOP].m_temporalId; |
---|
| 1290 | for(Int j=insertPoint; j<newRefs+1; j++) |
---|
| 1291 | { |
---|
| 1292 | Int newPrev = m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]; |
---|
| 1293 | Int newUsed = m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j]; |
---|
| 1294 | m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]=prev; |
---|
| 1295 | m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j]=prevUsed; |
---|
| 1296 | prevUsed=newUsed; |
---|
| 1297 | prev=newPrev; |
---|
| 1298 | } |
---|
| 1299 | newRefs++; |
---|
| 1300 | } |
---|
| 1301 | } |
---|
| 1302 | if(newRefs>=numPrefRefs) |
---|
| 1303 | { |
---|
| 1304 | break; |
---|
| 1305 | } |
---|
| 1306 | } |
---|
| 1307 | m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefPics=newRefs; |
---|
| 1308 | m_GOPList[m_iGOPSize+m_extraRPSs].m_POC = curPOC; |
---|
| 1309 | if (m_extraRPSs == 0) |
---|
| 1310 | { |
---|
| 1311 | m_GOPList[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 0; |
---|
| 1312 | m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefIdc = 0; |
---|
| 1313 | } |
---|
| 1314 | else |
---|
| 1315 | { |
---|
| 1316 | Int rIdx = m_iGOPSize + m_extraRPSs - 1; |
---|
| 1317 | Int refPOC = m_GOPList[rIdx].m_POC; |
---|
| 1318 | Int refPics = m_GOPList[rIdx].m_numRefPics; |
---|
| 1319 | Int newIdc=0; |
---|
| 1320 | for(Int i = 0; i<= refPics; i++) |
---|
| 1321 | { |
---|
| 1322 | Int deltaPOC = ((i != refPics)? m_GOPList[rIdx].m_referencePics[i] : 0); // check if the reference abs POC is >= 0 |
---|
| 1323 | Int absPOCref = refPOC+deltaPOC; |
---|
| 1324 | Int refIdc = 0; |
---|
| 1325 | for (Int j = 0; j < m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefPics; j++) |
---|
| 1326 | { |
---|
| 1327 | if ( (absPOCref - curPOC) == m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]) |
---|
| 1328 | { |
---|
| 1329 | if (m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j]) |
---|
| 1330 | { |
---|
| 1331 | refIdc = 1; |
---|
| 1332 | } |
---|
| 1333 | else |
---|
| 1334 | { |
---|
| 1335 | refIdc = 2; |
---|
| 1336 | } |
---|
| 1337 | } |
---|
| 1338 | } |
---|
| 1339 | m_GOPList[m_iGOPSize+m_extraRPSs].m_refIdc[newIdc]=refIdc; |
---|
| 1340 | newIdc++; |
---|
| 1341 | } |
---|
| 1342 | m_GOPList[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 1; |
---|
| 1343 | m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefIdc = newIdc; |
---|
| 1344 | m_GOPList[m_iGOPSize+m_extraRPSs].m_deltaRPS = refPOC - m_GOPList[m_iGOPSize+m_extraRPSs].m_POC; |
---|
| 1345 | } |
---|
| 1346 | curGOP=m_iGOPSize+m_extraRPSs; |
---|
| 1347 | m_extraRPSs++; |
---|
| 1348 | } |
---|
| 1349 | numRefs=0; |
---|
| 1350 | for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) |
---|
| 1351 | { |
---|
| 1352 | Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i]; |
---|
| 1353 | if(absPOC >= 0) |
---|
| 1354 | { |
---|
| 1355 | refList[numRefs]=absPOC; |
---|
| 1356 | numRefs++; |
---|
| 1357 | } |
---|
| 1358 | } |
---|
| 1359 | refList[numRefs]=curPOC; |
---|
| 1360 | numRefs++; |
---|
| 1361 | } |
---|
| 1362 | checkGOP++; |
---|
| 1363 | } |
---|
| 1364 | xConfirmPara(errorGOP,"Invalid GOP structure given"); |
---|
| 1365 | m_maxTempLayer = 1; |
---|
| 1366 | for(Int i=0; i<m_iGOPSize; i++) |
---|
| 1367 | { |
---|
| 1368 | if(m_GOPList[i].m_temporalId >= m_maxTempLayer) |
---|
| 1369 | { |
---|
| 1370 | m_maxTempLayer = m_GOPList[i].m_temporalId+1; |
---|
| 1371 | } |
---|
| 1372 | xConfirmPara(m_GOPList[i].m_sliceType!='B'&&m_GOPList[i].m_sliceType!='P', "Slice type must be equal to B or P"); |
---|
| 1373 | } |
---|
| 1374 | for(Int i=0; i<MAX_TLAYER; i++) |
---|
| 1375 | { |
---|
| 1376 | m_numReorderPics[i] = 0; |
---|
| 1377 | m_maxDecPicBuffering[i] = 0; |
---|
| 1378 | } |
---|
| 1379 | for(Int i=0; i<m_iGOPSize; i++) |
---|
| 1380 | { |
---|
| 1381 | if(m_GOPList[i].m_numRefPics > m_maxDecPicBuffering[m_GOPList[i].m_temporalId]) |
---|
| 1382 | { |
---|
| 1383 | m_maxDecPicBuffering[m_GOPList[i].m_temporalId] = m_GOPList[i].m_numRefPics; |
---|
| 1384 | } |
---|
| 1385 | Int highestDecodingNumberWithLowerPOC = 0; |
---|
| 1386 | for(Int j=0; j<m_iGOPSize; j++) |
---|
| 1387 | { |
---|
| 1388 | if(m_GOPList[j].m_POC <= m_GOPList[i].m_POC) |
---|
| 1389 | { |
---|
| 1390 | highestDecodingNumberWithLowerPOC = j; |
---|
| 1391 | } |
---|
| 1392 | } |
---|
| 1393 | Int numReorder = 0; |
---|
| 1394 | for(Int j=0; j<highestDecodingNumberWithLowerPOC; j++) |
---|
| 1395 | { |
---|
| 1396 | if(m_GOPList[j].m_temporalId <= m_GOPList[i].m_temporalId && |
---|
| 1397 | m_GOPList[j].m_POC > m_GOPList[i].m_POC) |
---|
| 1398 | { |
---|
| 1399 | numReorder++; |
---|
| 1400 | } |
---|
| 1401 | } |
---|
| 1402 | if(numReorder > m_numReorderPics[m_GOPList[i].m_temporalId]) |
---|
| 1403 | { |
---|
| 1404 | m_numReorderPics[m_GOPList[i].m_temporalId] = numReorder; |
---|
| 1405 | } |
---|
| 1406 | } |
---|
| 1407 | for(Int i=0; i<MAX_TLAYER-1; i++) |
---|
| 1408 | { |
---|
| 1409 | // a lower layer can not have higher value of m_numReorderPics than a higher layer |
---|
| 1410 | if(m_numReorderPics[i+1] < m_numReorderPics[i]) |
---|
| 1411 | { |
---|
| 1412 | m_numReorderPics[i+1] = m_numReorderPics[i]; |
---|
| 1413 | } |
---|
| 1414 | // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ], inclusive |
---|
| 1415 | if(m_numReorderPics[i] > m_maxDecPicBuffering[i]) |
---|
| 1416 | { |
---|
| 1417 | m_maxDecPicBuffering[i] = m_numReorderPics[i]; |
---|
| 1418 | } |
---|
| 1419 | // a lower layer can not have higher value of m_uiMaxDecPicBuffering than a higher layer |
---|
| 1420 | if(m_maxDecPicBuffering[i+1] < m_maxDecPicBuffering[i]) |
---|
| 1421 | { |
---|
| 1422 | m_maxDecPicBuffering[i+1] = m_maxDecPicBuffering[i]; |
---|
| 1423 | } |
---|
| 1424 | } |
---|
| 1425 | // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ], inclusive |
---|
| 1426 | if(m_numReorderPics[MAX_TLAYER-1] > m_maxDecPicBuffering[MAX_TLAYER-1]) |
---|
| 1427 | { |
---|
| 1428 | m_maxDecPicBuffering[MAX_TLAYER-1] = m_numReorderPics[MAX_TLAYER-1]; |
---|
| 1429 | } |
---|
| 1430 | |
---|
| 1431 | #if SVC_EXTENSION // ToDo: it should be checked for the case when parameters are different for the layers |
---|
| 1432 | for(UInt layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 1433 | { |
---|
| 1434 | Int m_iSourceWidth = m_acLayerCfg[layer].m_iSourceWidth; |
---|
| 1435 | Int m_iSourceHeight = m_acLayerCfg[layer].m_iSourceHeight; |
---|
| 1436 | #endif |
---|
| 1437 | if(m_vuiParametersPresentFlag && m_bitstreamRestrictionFlag) |
---|
| 1438 | { |
---|
| 1439 | Int PicSizeInSamplesY = m_iSourceWidth * m_iSourceHeight; |
---|
| 1440 | if(tileFlag) |
---|
| 1441 | { |
---|
| 1442 | Int maxTileWidth = 0; |
---|
| 1443 | Int maxTileHeight = 0; |
---|
| 1444 | Int widthInCU = (m_iSourceWidth % m_uiMaxCUWidth) ? m_iSourceWidth/m_uiMaxCUWidth + 1: m_iSourceWidth/m_uiMaxCUWidth; |
---|
| 1445 | Int heightInCU = (m_iSourceHeight % m_uiMaxCUHeight) ? m_iSourceHeight/m_uiMaxCUHeight + 1: m_iSourceHeight/m_uiMaxCUHeight; |
---|
| 1446 | if(m_iUniformSpacingIdr) |
---|
| 1447 | { |
---|
| 1448 | maxTileWidth = m_uiMaxCUWidth*((widthInCU+m_iNumColumnsMinus1)/(m_iNumColumnsMinus1+1)); |
---|
| 1449 | maxTileHeight = m_uiMaxCUHeight*((heightInCU+m_iNumRowsMinus1)/(m_iNumRowsMinus1+1)); |
---|
| 1450 | // if only the last tile-row is one treeblock higher than the others |
---|
| 1451 | // the maxTileHeight becomes smaller if the last row of treeblocks has lower height than the others |
---|
| 1452 | if(!((heightInCU-1)%(m_iNumRowsMinus1+1))) |
---|
| 1453 | { |
---|
| 1454 | maxTileHeight = maxTileHeight - m_uiMaxCUHeight + (m_iSourceHeight % m_uiMaxCUHeight); |
---|
| 1455 | } |
---|
| 1456 | // if only the last tile-column is one treeblock wider than the others |
---|
| 1457 | // the maxTileWidth becomes smaller if the last column of treeblocks has lower width than the others |
---|
| 1458 | if(!((widthInCU-1)%(m_iNumColumnsMinus1+1))) |
---|
| 1459 | { |
---|
| 1460 | maxTileWidth = maxTileWidth - m_uiMaxCUWidth + (m_iSourceWidth % m_uiMaxCUWidth); |
---|
| 1461 | } |
---|
| 1462 | } |
---|
| 1463 | else // not uniform spacing |
---|
| 1464 | { |
---|
| 1465 | if(m_iNumColumnsMinus1<1) |
---|
| 1466 | { |
---|
| 1467 | maxTileWidth = m_iSourceWidth; |
---|
| 1468 | } |
---|
| 1469 | else |
---|
| 1470 | { |
---|
| 1471 | Int accColumnWidth = 0; |
---|
| 1472 | for(Int col=0; col<(m_iNumColumnsMinus1); col++) |
---|
| 1473 | { |
---|
| 1474 | maxTileWidth = m_pColumnWidth[col]>maxTileWidth ? m_pColumnWidth[col]:maxTileWidth; |
---|
| 1475 | accColumnWidth += m_pColumnWidth[col]; |
---|
| 1476 | } |
---|
| 1477 | maxTileWidth = (widthInCU-accColumnWidth)>maxTileWidth ? m_uiMaxCUWidth*(widthInCU-accColumnWidth):m_uiMaxCUWidth*maxTileWidth; |
---|
| 1478 | } |
---|
| 1479 | if(m_iNumRowsMinus1<1) |
---|
| 1480 | { |
---|
| 1481 | maxTileHeight = m_iSourceHeight; |
---|
| 1482 | } |
---|
| 1483 | else |
---|
| 1484 | { |
---|
| 1485 | Int accRowHeight = 0; |
---|
| 1486 | for(Int row=0; row<(m_iNumRowsMinus1); row++) |
---|
| 1487 | { |
---|
| 1488 | maxTileHeight = m_pRowHeight[row]>maxTileHeight ? m_pRowHeight[row]:maxTileHeight; |
---|
| 1489 | accRowHeight += m_pRowHeight[row]; |
---|
| 1490 | } |
---|
| 1491 | maxTileHeight = (heightInCU-accRowHeight)>maxTileHeight ? m_uiMaxCUHeight*(heightInCU-accRowHeight):m_uiMaxCUHeight*maxTileHeight; |
---|
| 1492 | } |
---|
| 1493 | } |
---|
| 1494 | Int maxSizeInSamplesY = maxTileWidth*maxTileHeight; |
---|
| 1495 | m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/maxSizeInSamplesY-4; |
---|
| 1496 | } |
---|
| 1497 | else if(m_iWaveFrontSynchro) |
---|
| 1498 | { |
---|
| 1499 | m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/((2*m_iSourceHeight+m_iSourceWidth)*m_uiMaxCUHeight)-4; |
---|
| 1500 | } |
---|
| 1501 | else if(m_sliceMode == 1) |
---|
| 1502 | { |
---|
| 1503 | m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/(m_sliceArgument*m_uiMaxCUWidth*m_uiMaxCUHeight)-4; |
---|
| 1504 | } |
---|
| 1505 | else |
---|
| 1506 | { |
---|
| 1507 | m_minSpatialSegmentationIdc = 0; |
---|
| 1508 | } |
---|
| 1509 | } |
---|
| 1510 | #if SVC_EXTENSION |
---|
| 1511 | } |
---|
| 1512 | #endif |
---|
| 1513 | |
---|
| 1514 | xConfirmPara( m_bUseLComb==false && m_numReorderPics[MAX_TLAYER-1]!=0, "ListCombination can only be 0 in low delay coding (more precisely when L0 and L1 are identical)" ); // Note however this is not the full necessary condition as ref_pic_list_combination_flag can only be 0 if L0 == L1. |
---|
| 1515 | xConfirmPara( m_iWaveFrontSynchro < 0, "WaveFrontSynchro cannot be negative" ); |
---|
| 1516 | #if !SVC_EXTENSION |
---|
| 1517 | xConfirmPara( m_iWaveFrontSubstreams <= 0, "WaveFrontSubstreams must be positive" ); |
---|
| 1518 | xConfirmPara( m_iWaveFrontSubstreams > 1 && !m_iWaveFrontSynchro, "Must have WaveFrontSynchro > 0 in order to have WaveFrontSubstreams > 1" ); |
---|
| 1519 | #endif |
---|
| 1520 | |
---|
| 1521 | xConfirmPara( m_decodedPictureHashSEIEnabled<0 || m_decodedPictureHashSEIEnabled>3, "this hash type is not correct!\n"); |
---|
| 1522 | |
---|
| 1523 | #if RATE_CONTROL_LAMBDA_DOMAIN |
---|
| 1524 | if ( m_RCEnableRateControl ) |
---|
| 1525 | { |
---|
| 1526 | if ( m_RCForceIntraQP ) |
---|
| 1527 | { |
---|
| 1528 | if ( m_RCInitialQP == 0 ) |
---|
| 1529 | { |
---|
| 1530 | printf( "\nInitial QP for rate control is not specified. Reset not to use force intra QP!" ); |
---|
| 1531 | m_RCForceIntraQP = false; |
---|
| 1532 | } |
---|
| 1533 | } |
---|
| 1534 | xConfirmPara( m_uiDeltaQpRD > 0, "Rate control cannot be used together with slice level multiple-QP optimization!\n" ); |
---|
| 1535 | } |
---|
| 1536 | #else |
---|
| 1537 | if(m_enableRateCtrl) |
---|
| 1538 | { |
---|
| 1539 | Int numLCUInWidth = (m_iSourceWidth / m_uiMaxCUWidth) + (( m_iSourceWidth % m_uiMaxCUWidth ) ? 1 : 0); |
---|
| 1540 | Int numLCUInHeight = (m_iSourceHeight / m_uiMaxCUHeight)+ (( m_iSourceHeight % m_uiMaxCUHeight) ? 1 : 0); |
---|
| 1541 | Int numLCUInPic = numLCUInWidth * numLCUInHeight; |
---|
| 1542 | |
---|
| 1543 | xConfirmPara( (numLCUInPic % m_numLCUInUnit) != 0, "total number of LCUs in a frame should be completely divided by NumLCUInUnit" ); |
---|
| 1544 | |
---|
| 1545 | m_iMaxDeltaQP = MAX_DELTA_QP; |
---|
| 1546 | m_iMaxCuDQPDepth = MAX_CUDQP_DEPTH; |
---|
| 1547 | } |
---|
| 1548 | #endif |
---|
| 1549 | |
---|
| 1550 | xConfirmPara(!m_TransquantBypassEnableFlag && m_CUTransquantBypassFlagValue, "CUTransquantBypassFlagValue cannot be 1 when TransquantBypassEnableFlag is 0"); |
---|
| 1551 | |
---|
| 1552 | xConfirmPara(m_log2ParallelMergeLevel < 2, "Log2ParallelMergeLevel should be larger than or equal to 2"); |
---|
| 1553 | #if L0444_FPA_TYPE |
---|
| 1554 | if (m_framePackingSEIEnabled) |
---|
| 1555 | { |
---|
| 1556 | xConfirmPara(m_framePackingSEIType < 3 || m_framePackingSEIType > 5 , "SEIFramePackingType must be in rage 3 to 5"); |
---|
| 1557 | } |
---|
| 1558 | #endif |
---|
| 1559 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
| 1560 | xConfirmPara( (m_acLayerCfg[0].m_numDirectRefLayers != 0) && (m_acLayerCfg[0].m_numDirectRefLayers != -1), "Layer 0 cannot have any reference layers" ); |
---|
| 1561 | // NOTE: m_numDirectRefLayers (for any layer) could be -1 (not signalled in cfg), in which case only the "previous layer" would be taken for reference |
---|
| 1562 | for(Int layer = 1; layer < MAX_LAYERS; layer++) |
---|
[2] | 1563 | { |
---|
[125] | 1564 | xConfirmPara(m_acLayerCfg[layer].m_numDirectRefLayers > layer, "Cannot reference more layers than before current layer"); |
---|
| 1565 | for(Int i = 0; i < m_acLayerCfg[layer].m_numDirectRefLayers; i++) |
---|
[2] | 1566 | { |
---|
[125] | 1567 | xConfirmPara(m_acLayerCfg[layer].m_refLayerIds[i] > layer, "Cannot reference higher layers"); |
---|
| 1568 | xConfirmPara(m_acLayerCfg[layer].m_refLayerIds[i] == layer, "Cannot reference the current layer itself"); |
---|
[2] | 1569 | } |
---|
| 1570 | } |
---|
[125] | 1571 | #endif |
---|
| 1572 | #undef xConfirmPara |
---|
| 1573 | if (check_failed) |
---|
| 1574 | { |
---|
| 1575 | exit(EXIT_FAILURE); |
---|
| 1576 | } |
---|
| 1577 | } |
---|
| 1578 | |
---|
| 1579 | /** \todo use of global variables should be removed later |
---|
| 1580 | */ |
---|
| 1581 | Void TAppEncCfg::xSetGlobal() |
---|
| 1582 | { |
---|
| 1583 | // set max CU width & height |
---|
| 1584 | g_uiMaxCUWidth = m_uiMaxCUWidth; |
---|
| 1585 | g_uiMaxCUHeight = m_uiMaxCUHeight; |
---|
| 1586 | |
---|
| 1587 | // compute actual CU depth with respect to config depth and max transform size |
---|
| 1588 | g_uiAddCUDepth = 0; |
---|
| 1589 | while( (m_uiMaxCUWidth>>m_uiMaxCUDepth) > ( 1 << ( m_uiQuadtreeTULog2MinSize + g_uiAddCUDepth ) ) ) g_uiAddCUDepth++; |
---|
| 1590 | |
---|
| 1591 | m_uiMaxCUDepth += g_uiAddCUDepth; |
---|
| 1592 | g_uiAddCUDepth++; |
---|
| 1593 | g_uiMaxCUDepth = m_uiMaxCUDepth; |
---|
| 1594 | |
---|
| 1595 | // set internal bit-depth and constants |
---|
| 1596 | g_bitDepthY = m_internalBitDepthY; |
---|
| 1597 | g_bitDepthC = m_internalBitDepthC; |
---|
| 1598 | |
---|
| 1599 | g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_inputBitDepthY : m_internalBitDepthY; |
---|
| 1600 | g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_inputBitDepthC : m_internalBitDepthC; |
---|
| 1601 | } |
---|
| 1602 | |
---|
| 1603 | Void TAppEncCfg::xPrintParameter() |
---|
| 1604 | { |
---|
| 1605 | printf("\n"); |
---|
| 1606 | #if SVC_EXTENSION |
---|
| 1607 | printf("Total number of layers : %d\n", m_numLayers ); |
---|
| 1608 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
| 1609 | { |
---|
| 1610 | printf("=== Layer %d settings === \n", layer); |
---|
| 1611 | m_acLayerCfg[layer].xPrintParameter(); |
---|
| 1612 | printf("\n"); |
---|
| 1613 | } |
---|
| 1614 | printf("=== Common configuration settings === \n"); |
---|
| 1615 | printf("Bitstream File : %s\n", m_pBitstreamFile ); |
---|
| 1616 | #else |
---|
| 1617 | printf("Input File : %s\n", m_pchInputFile ); |
---|
| 1618 | printf("Bitstream File : %s\n", m_pchBitstreamFile ); |
---|
| 1619 | printf("Reconstruction File : %s\n", m_pchReconFile ); |
---|
| 1620 | printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_confLeft - m_confRight, m_iSourceHeight - m_confTop - m_confBottom, m_iFrameRate ); |
---|
| 1621 | printf("Internal Format : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate ); |
---|
| 1622 | #endif |
---|
| 1623 | printf("Frame index : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded ); |
---|
| 1624 | printf("CU size / depth : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth ); |
---|
| 1625 | printf("RQT trans. size (min / max) : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize ); |
---|
| 1626 | printf("Max RQT depth inter : %d\n", m_uiQuadtreeTUMaxDepthInter); |
---|
| 1627 | printf("Max RQT depth intra : %d\n", m_uiQuadtreeTUMaxDepthIntra); |
---|
| 1628 | printf("Min PCM size : %d\n", 1 << m_uiPCMLog2MinSize); |
---|
| 1629 | printf("Motion search range : %d\n", m_iSearchRange ); |
---|
| 1630 | #if !SVC_EXTENSION |
---|
| 1631 | printf("Intra period : %d\n", m_iIntraPeriod ); |
---|
| 1632 | #endif |
---|
| 1633 | printf("Decoding refresh type : %d\n", m_iDecodingRefreshType ); |
---|
| 1634 | #if !SVC_EXTENSION |
---|
| 1635 | printf("QP : %5.2f\n", m_fQP ); |
---|
| 1636 | #endif |
---|
| 1637 | printf("Max dQP signaling depth : %d\n", m_iMaxCuDQPDepth); |
---|
| 1638 | |
---|
| 1639 | printf("Cb QP Offset : %d\n", m_cbQpOffset ); |
---|
| 1640 | printf("Cr QP Offset : %d\n", m_crQpOffset); |
---|
| 1641 | |
---|
| 1642 | printf("QP adaptation : %d (range=%d)\n", m_bUseAdaptiveQP, (m_bUseAdaptiveQP ? m_iQPAdaptationRange : 0) ); |
---|
| 1643 | printf("GOP size : %d\n", m_iGOPSize ); |
---|
| 1644 | printf("Internal bit depth : (Y:%d, C:%d)\n", m_internalBitDepthY, m_internalBitDepthC ); |
---|
| 1645 | printf("PCM sample bit depth : (Y:%d, C:%d)\n", g_uiPCMBitDepthLuma, g_uiPCMBitDepthChroma ); |
---|
| 1646 | #if RATE_CONTROL_LAMBDA_DOMAIN |
---|
| 1647 | printf("RateControl : %d\n", m_RCEnableRateControl ); |
---|
| 1648 | if(m_RCEnableRateControl) |
---|
| 1649 | { |
---|
| 1650 | printf("TargetBitrate : %d\n", m_RCTargetBitrate ); |
---|
| 1651 | printf("KeepHierarchicalBit : %d\n", m_RCKeepHierarchicalBit ); |
---|
| 1652 | printf("LCULevelRC : %d\n", m_RCLCULevelRC ); |
---|
| 1653 | printf("UseLCUSeparateModel : %d\n", m_RCUseLCUSeparateModel ); |
---|
| 1654 | printf("InitialQP : %d\n", m_RCInitialQP ); |
---|
| 1655 | printf("ForceIntraQP : %d\n", m_RCForceIntraQP ); |
---|
| 1656 | } |
---|
| 1657 | #else |
---|
| 1658 | printf("RateControl : %d\n", m_enableRateCtrl); |
---|
| 1659 | if(m_enableRateCtrl) |
---|
| 1660 | { |
---|
| 1661 | printf("TargetBitrate : %d\n", m_targetBitrate); |
---|
| 1662 | printf("NumLCUInUnit : %d\n", m_numLCUInUnit); |
---|
| 1663 | } |
---|
| 1664 | #endif |
---|
| 1665 | printf("Max Num Merge Candidates : %d\n", m_maxNumMergeCand); |
---|
| 1666 | printf("\n"); |
---|
| 1667 | |
---|
| 1668 | printf("TOOL CFG: "); |
---|
| 1669 | printf("IBD:%d ", g_bitDepthY > m_inputBitDepthY || g_bitDepthC > m_inputBitDepthC); |
---|
| 1670 | printf("HAD:%d ", m_bUseHADME ); |
---|
| 1671 | printf("SRD:%d ", m_bUseSBACRD ); |
---|
| 1672 | printf("RDQ:%d ", m_useRDOQ ); |
---|
| 1673 | printf("RDQTS:%d ", m_useRDOQTS ); |
---|
| 1674 | #if L0232_RD_PENALTY |
---|
| 1675 | printf("RDpenalty:%d ", m_rdPenalty ); |
---|
| 1676 | #endif |
---|
| 1677 | printf("SQP:%d ", m_uiDeltaQpRD ); |
---|
| 1678 | printf("ASR:%d ", m_bUseASR ); |
---|
| 1679 | printf("LComb:%d ", m_bUseLComb ); |
---|
| 1680 | printf("FEN:%d ", m_bUseFastEnc ); |
---|
| 1681 | printf("ECU:%d ", m_bUseEarlyCU ); |
---|
| 1682 | printf("FDM:%d ", m_useFastDecisionForMerge ); |
---|
| 1683 | printf("CFM:%d ", m_bUseCbfFastMode ); |
---|
| 1684 | printf("ESD:%d ", m_useEarlySkipDetection ); |
---|
| 1685 | printf("RQT:%d ", 1 ); |
---|
| 1686 | printf("TransformSkip:%d ", m_useTransformSkip ); |
---|
| 1687 | printf("TransformSkipFast:%d ", m_useTransformSkipFast ); |
---|
| 1688 | printf("Slice: M=%d ", m_sliceMode); |
---|
| 1689 | if (m_sliceMode!=0) |
---|
| 1690 | { |
---|
| 1691 | printf("A=%d ", m_sliceArgument); |
---|
| 1692 | } |
---|
| 1693 | printf("SliceSegment: M=%d ",m_sliceSegmentMode); |
---|
| 1694 | if (m_sliceSegmentMode!=0) |
---|
| 1695 | { |
---|
| 1696 | printf("A=%d ", m_sliceSegmentArgument); |
---|
| 1697 | } |
---|
| 1698 | printf("CIP:%d ", m_bUseConstrainedIntraPred); |
---|
| 1699 | printf("SAO:%d ", (m_bUseSAO)?(1):(0)); |
---|
| 1700 | printf("PCM:%d ", (m_usePCM && (1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0); |
---|
| 1701 | printf("SAOLcuBasedOptimization:%d ", (m_saoLcuBasedOptimization)?(1):(0)); |
---|
| 1702 | |
---|
| 1703 | printf("LosslessCuEnabled:%d ", (m_useLossless)? 1:0 ); |
---|
| 1704 | printf("WPP:%d ", (Int)m_useWeightedPred); |
---|
| 1705 | printf("WPB:%d ", (Int)m_useWeightedBiPred); |
---|
| 1706 | printf("PME:%d ", m_log2ParallelMergeLevel); |
---|
| 1707 | #if !SVC_EXTENSION |
---|
| 1708 | printf(" WaveFrontSynchro:%d WaveFrontSubstreams:%d", |
---|
| 1709 | m_iWaveFrontSynchro, m_iWaveFrontSubstreams); |
---|
| 1710 | #endif |
---|
| 1711 | printf(" ScalingList:%d ", m_useScalingListId ); |
---|
| 1712 | printf("TMVPMode:%d ", m_TMVPModeId ); |
---|
| 1713 | #if ADAPTIVE_QP_SELECTION |
---|
| 1714 | printf("AQpS:%d", m_bUseAdaptQpSelect ); |
---|
| 1715 | #endif |
---|
| 1716 | |
---|
| 1717 | printf(" SignBitHidingFlag:%d ", m_signHideFlag); |
---|
| 1718 | #if SVC_EXTENSION |
---|
| 1719 | printf("RecalQP:%d ", m_recalculateQPAccordingToLambda ? 1 : 0 ); |
---|
| 1720 | printf("AVC_BASE:%d ", AVC_BASE); |
---|
| 1721 | #if REF_IDX_FRAMEWORK |
---|
| 1722 | printf("REF_IDX_FRAMEWORK:%d ", REF_IDX_FRAMEWORK); |
---|
| 1723 | printf("EL_RAP_SliceType: %d ", m_elRapSliceBEnabled); |
---|
| 1724 | printf("REF_IDX_ME_ZEROMV: %d", REF_IDX_ME_ZEROMV); |
---|
| 1725 | #elif INTRA_BL |
---|
| 1726 | printf("INTRA_BL:%d ", INTRA_BL); |
---|
| 1727 | #if !AVC_BASE |
---|
| 1728 | printf("SVC_MVP:%d ", SVC_MVP ); |
---|
| 1729 | printf("SVC_BL_CAND_INTRA:%d", SVC_BL_CAND_INTRA ); |
---|
| 1730 | #endif |
---|
| 1731 | #endif |
---|
| 1732 | #else |
---|
| 1733 | printf("RecalQP:%d", m_recalculateQPAccordingToLambda ? 1 : 0 ); |
---|
| 1734 | #endif |
---|
| 1735 | printf("\n\n"); |
---|
| 1736 | |
---|
| 1737 | fflush(stdout); |
---|
| 1738 | } |
---|
| 1739 | |
---|
| 1740 | Bool confirmPara(Bool bflag, const Char* message) |
---|
| 1741 | { |
---|
| 1742 | if (!bflag) |
---|
| 1743 | return false; |
---|
| 1744 | |
---|
| 1745 | printf("Error: %s\n",message); |
---|
| 1746 | return true; |
---|
| 1747 | } |
---|
| 1748 | |
---|
| 1749 | //! \} |
---|