[313] | 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 | #if AVC_BASE |
---|
| 69 | , m_avcBaseLayerFlag(0) |
---|
| 70 | #endif |
---|
[442] | 71 | #if N0120_MAX_TID_REF_CFG |
---|
| 72 | , m_maxTidRefPresentFlag(1) |
---|
| 73 | #endif |
---|
[313] | 74 | , m_pColumnWidth() |
---|
| 75 | , m_pRowHeight() |
---|
| 76 | , m_scalingListFile() |
---|
| 77 | , m_elRapSliceBEnabled(0) |
---|
| 78 | { |
---|
| 79 | for(UInt layer=0; layer<MAX_LAYERS; layer++) |
---|
| 80 | { |
---|
| 81 | m_acLayerCfg[layer].setAppEncCfg(this); |
---|
| 82 | #if M0457_IL_SAMPLE_PRED_ONLY_FLAG |
---|
| 83 | m_ilSampleOnlyPred[layer] = 0; |
---|
| 84 | #endif |
---|
| 85 | } |
---|
| 86 | memset( m_scalabilityMask, 0, sizeof(m_scalabilityMask) ); |
---|
| 87 | } |
---|
| 88 | #else |
---|
| 89 | TAppEncCfg::TAppEncCfg() |
---|
| 90 | : m_pchInputFile() |
---|
| 91 | , m_pchBitstreamFile() |
---|
| 92 | , m_pchReconFile() |
---|
| 93 | , m_pchdQPFile() |
---|
| 94 | , m_pColumnWidth() |
---|
| 95 | , m_pRowHeight() |
---|
| 96 | , m_scalingListFile() |
---|
| 97 | { |
---|
| 98 | m_aidQP = NULL; |
---|
| 99 | m_startOfCodedInterval = NULL; |
---|
| 100 | m_codedPivotValue = NULL; |
---|
| 101 | m_targetPivotValue = NULL; |
---|
| 102 | } |
---|
| 103 | #endif |
---|
| 104 | |
---|
| 105 | TAppEncCfg::~TAppEncCfg() |
---|
| 106 | { |
---|
| 107 | #if SVC_EXTENSION |
---|
| 108 | free(m_pBitstreamFile); |
---|
| 109 | #else |
---|
| 110 | free(m_pchBitstreamFile); |
---|
| 111 | if ( m_aidQP ) |
---|
| 112 | { |
---|
| 113 | delete[] m_aidQP; |
---|
| 114 | } |
---|
| 115 | if ( m_startOfCodedInterval ) |
---|
| 116 | { |
---|
| 117 | delete[] m_startOfCodedInterval; |
---|
| 118 | m_startOfCodedInterval = NULL; |
---|
| 119 | } |
---|
| 120 | if ( m_codedPivotValue ) |
---|
| 121 | { |
---|
| 122 | delete[] m_codedPivotValue; |
---|
| 123 | m_codedPivotValue = NULL; |
---|
| 124 | } |
---|
| 125 | if ( m_targetPivotValue ) |
---|
| 126 | { |
---|
| 127 | delete[] m_targetPivotValue; |
---|
| 128 | m_targetPivotValue = NULL; |
---|
| 129 | } |
---|
| 130 | free(m_pchInputFile); |
---|
| 131 | #endif |
---|
| 132 | #if !SVC_EXTENSION |
---|
| 133 | free(m_pchReconFile); |
---|
| 134 | free(m_pchdQPFile); |
---|
| 135 | #endif |
---|
| 136 | free(m_pColumnWidth); |
---|
| 137 | free(m_pRowHeight); |
---|
| 138 | free(m_scalingListFile); |
---|
| 139 | } |
---|
| 140 | |
---|
| 141 | Void TAppEncCfg::create() |
---|
| 142 | { |
---|
| 143 | } |
---|
| 144 | |
---|
| 145 | Void TAppEncCfg::destroy() |
---|
| 146 | { |
---|
| 147 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
| 148 | #if M0457_PREDICTION_INDICATIONS |
---|
| 149 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 150 | { |
---|
| 151 | if( m_acLayerCfg[layer].m_numSamplePredRefLayers > 0 ) |
---|
| 152 | { |
---|
| 153 | delete [] m_acLayerCfg[layer].m_samplePredRefLayerIds; |
---|
| 154 | } |
---|
| 155 | } |
---|
| 156 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 157 | { |
---|
| 158 | if( m_acLayerCfg[layer].m_numMotionPredRefLayers > 0 ) |
---|
| 159 | { |
---|
| 160 | delete [] m_acLayerCfg[layer].m_motionPredRefLayerIds; |
---|
| 161 | } |
---|
| 162 | } |
---|
| 163 | #else |
---|
| 164 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 165 | { |
---|
| 166 | if( m_acLayerCfg[layer].m_numDirectRefLayers > 0 ) |
---|
| 167 | { |
---|
| 168 | delete [] m_acLayerCfg[layer].m_refLayerIds; |
---|
| 169 | } |
---|
| 170 | } |
---|
| 171 | #endif |
---|
| 172 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 173 | { |
---|
| 174 | if( m_acLayerCfg[layer].m_numActiveRefLayers > 0 ) |
---|
| 175 | { |
---|
| 176 | delete [] m_acLayerCfg[layer].m_predLayerIds; |
---|
| 177 | } |
---|
| 178 | } |
---|
| 179 | #endif |
---|
| 180 | } |
---|
| 181 | |
---|
| 182 | std::istringstream &operator>>(std::istringstream &in, GOPEntry &entry) //input |
---|
| 183 | { |
---|
| 184 | in>>entry.m_sliceType; |
---|
| 185 | in>>entry.m_POC; |
---|
| 186 | in>>entry.m_QPOffset; |
---|
| 187 | in>>entry.m_QPFactor; |
---|
| 188 | in>>entry.m_tcOffsetDiv2; |
---|
| 189 | in>>entry.m_betaOffsetDiv2; |
---|
| 190 | in>>entry.m_temporalId; |
---|
| 191 | in>>entry.m_numRefPicsActive; |
---|
| 192 | in>>entry.m_numRefPics; |
---|
| 193 | for ( Int i = 0; i < entry.m_numRefPics; i++ ) |
---|
| 194 | { |
---|
| 195 | in>>entry.m_referencePics[i]; |
---|
| 196 | } |
---|
| 197 | in>>entry.m_interRPSPrediction; |
---|
| 198 | #if AUTO_INTER_RPS |
---|
| 199 | if (entry.m_interRPSPrediction==1) |
---|
| 200 | { |
---|
| 201 | in>>entry.m_deltaRPS; |
---|
| 202 | in>>entry.m_numRefIdc; |
---|
| 203 | for ( Int i = 0; i < entry.m_numRefIdc; i++ ) |
---|
| 204 | { |
---|
| 205 | in>>entry.m_refIdc[i]; |
---|
| 206 | } |
---|
| 207 | } |
---|
| 208 | else if (entry.m_interRPSPrediction==2) |
---|
| 209 | { |
---|
| 210 | in>>entry.m_deltaRPS; |
---|
| 211 | } |
---|
| 212 | #else |
---|
| 213 | if (entry.m_interRPSPrediction) |
---|
| 214 | { |
---|
| 215 | in>>entry.m_deltaRPS; |
---|
| 216 | in>>entry.m_numRefIdc; |
---|
| 217 | for ( Int i = 0; i < entry.m_numRefIdc; i++ ) |
---|
| 218 | { |
---|
| 219 | in>>entry.m_refIdc[i]; |
---|
| 220 | } |
---|
| 221 | } |
---|
| 222 | #endif |
---|
| 223 | return in; |
---|
| 224 | } |
---|
| 225 | |
---|
| 226 | #if SVC_EXTENSION |
---|
| 227 | void TAppEncCfg::getDirFilename(string& filename, string& dir, const string path) |
---|
| 228 | { |
---|
| 229 | size_t pos = path.find_last_of("\\"); |
---|
| 230 | if(pos != std::string::npos) |
---|
| 231 | { |
---|
| 232 | filename.assign(path.begin() + pos + 1, path.end()); |
---|
| 233 | dir.assign(path.begin(), path.begin() + pos + 1); |
---|
| 234 | } |
---|
| 235 | else |
---|
| 236 | { |
---|
| 237 | pos = path.find_last_of("/"); |
---|
| 238 | if(pos != std::string::npos) |
---|
| 239 | { |
---|
| 240 | filename.assign(path.begin() + pos + 1, path.end()); |
---|
| 241 | dir.assign(path.begin(), path.begin() + pos + 1); |
---|
| 242 | } |
---|
| 243 | else |
---|
| 244 | { |
---|
| 245 | filename = path; |
---|
| 246 | dir.assign(""); |
---|
| 247 | } |
---|
| 248 | } |
---|
| 249 | } |
---|
| 250 | #endif |
---|
| 251 | |
---|
| 252 | static const struct MapStrToProfile { |
---|
| 253 | const Char* str; |
---|
| 254 | Profile::Name value; |
---|
| 255 | } strToProfile[] = { |
---|
| 256 | {"none", Profile::NONE}, |
---|
| 257 | {"main", Profile::MAIN}, |
---|
| 258 | {"main10", Profile::MAIN10}, |
---|
| 259 | {"main-still-picture", Profile::MAINSTILLPICTURE}, |
---|
| 260 | }; |
---|
| 261 | |
---|
| 262 | static const struct MapStrToTier { |
---|
| 263 | const Char* str; |
---|
| 264 | Level::Tier value; |
---|
| 265 | } strToTier[] = { |
---|
| 266 | {"main", Level::MAIN}, |
---|
| 267 | {"high", Level::HIGH}, |
---|
| 268 | }; |
---|
| 269 | |
---|
| 270 | static const struct MapStrToLevel { |
---|
| 271 | const Char* str; |
---|
| 272 | Level::Name value; |
---|
| 273 | } strToLevel[] = { |
---|
| 274 | {"none",Level::NONE}, |
---|
| 275 | {"1", Level::LEVEL1}, |
---|
| 276 | {"2", Level::LEVEL2}, |
---|
| 277 | {"2.1", Level::LEVEL2_1}, |
---|
| 278 | {"3", Level::LEVEL3}, |
---|
| 279 | {"3.1", Level::LEVEL3_1}, |
---|
| 280 | {"4", Level::LEVEL4}, |
---|
| 281 | {"4.1", Level::LEVEL4_1}, |
---|
| 282 | {"5", Level::LEVEL5}, |
---|
| 283 | {"5.1", Level::LEVEL5_1}, |
---|
| 284 | {"5.2", Level::LEVEL5_2}, |
---|
| 285 | {"6", Level::LEVEL6}, |
---|
| 286 | {"6.1", Level::LEVEL6_1}, |
---|
| 287 | {"6.2", Level::LEVEL6_2}, |
---|
| 288 | }; |
---|
| 289 | |
---|
| 290 | template<typename T, typename P> |
---|
| 291 | static istream& readStrToEnum(P map[], unsigned long mapLen, istream &in, T &val) |
---|
| 292 | { |
---|
| 293 | string str; |
---|
| 294 | in >> str; |
---|
| 295 | |
---|
| 296 | for (Int i = 0; i < mapLen; i++) |
---|
| 297 | { |
---|
| 298 | if (str == map[i].str) |
---|
| 299 | { |
---|
| 300 | val = map[i].value; |
---|
| 301 | goto found; |
---|
| 302 | } |
---|
| 303 | } |
---|
| 304 | /* not found */ |
---|
| 305 | in.setstate(ios::failbit); |
---|
| 306 | found: |
---|
| 307 | return in; |
---|
| 308 | } |
---|
| 309 | |
---|
| 310 | static istream& operator>>(istream &in, Profile::Name &profile) |
---|
| 311 | { |
---|
| 312 | return readStrToEnum(strToProfile, sizeof(strToProfile)/sizeof(*strToProfile), in, profile); |
---|
| 313 | } |
---|
| 314 | |
---|
| 315 | static istream& operator>>(istream &in, Level::Tier &tier) |
---|
| 316 | { |
---|
| 317 | return readStrToEnum(strToTier, sizeof(strToTier)/sizeof(*strToTier), in, tier); |
---|
| 318 | } |
---|
| 319 | |
---|
| 320 | static istream& operator>>(istream &in, Level::Name &level) |
---|
| 321 | { |
---|
| 322 | return readStrToEnum(strToLevel, sizeof(strToLevel)/sizeof(*strToLevel), in, level); |
---|
| 323 | } |
---|
| 324 | |
---|
| 325 | // ==================================================================================================================== |
---|
| 326 | // Public member functions |
---|
| 327 | // ==================================================================================================================== |
---|
| 328 | |
---|
| 329 | /** \param argc number of arguments |
---|
| 330 | \param argv array of arguments |
---|
| 331 | \retval true when success |
---|
| 332 | */ |
---|
| 333 | Bool TAppEncCfg::parseCfg( Int argc, Char* argv[] ) |
---|
| 334 | { |
---|
| 335 | Bool do_help = false; |
---|
| 336 | |
---|
| 337 | #if SVC_EXTENSION |
---|
[442] | 338 | string cfg_LayerCfgFile [MAX_LAYERS]; |
---|
[313] | 339 | string cfg_BitstreamFile; |
---|
[442] | 340 | string* cfg_InputFile [MAX_LAYERS]; |
---|
| 341 | string* cfg_ReconFile [MAX_LAYERS]; |
---|
| 342 | Double* cfg_fQP [MAX_LAYERS]; |
---|
[313] | 343 | |
---|
[442] | 344 | #if REPN_FORMAT_IN_VPS |
---|
| 345 | Int* cfg_repFormatIdx [MAX_LAYERS]; |
---|
| 346 | #endif |
---|
[313] | 347 | Int* cfg_SourceWidth [MAX_LAYERS]; |
---|
| 348 | Int* cfg_SourceHeight [MAX_LAYERS]; |
---|
| 349 | Int* cfg_FrameRate [MAX_LAYERS]; |
---|
| 350 | Int* cfg_IntraPeriod [MAX_LAYERS]; |
---|
| 351 | Int* cfg_conformanceMode [MAX_LAYERS]; |
---|
[467] | 352 | #if LAYER_CTB |
---|
| 353 | // coding unit (CU) definition |
---|
| 354 | UInt* cfg_uiMaxCUWidth[MAX_LAYERS]; ///< max. CU width in pixel |
---|
| 355 | UInt* cfg_uiMaxCUHeight[MAX_LAYERS]; ///< max. CU height in pixel |
---|
| 356 | UInt* cfg_uiMaxCUDepth[MAX_LAYERS]; ///< max. CU depth |
---|
| 357 | |
---|
| 358 | // transfom unit (TU) definition |
---|
| 359 | UInt* cfg_uiQuadtreeTULog2MaxSize[MAX_LAYERS]; |
---|
| 360 | UInt* cfg_uiQuadtreeTULog2MinSize[MAX_LAYERS]; |
---|
| 361 | |
---|
| 362 | UInt* cfg_uiQuadtreeTUMaxDepthInter[MAX_LAYERS]; |
---|
| 363 | UInt* cfg_uiQuadtreeTUMaxDepthIntra[MAX_LAYERS]; |
---|
| 364 | #endif |
---|
[313] | 365 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
| 366 | #if M0457_PREDICTION_INDICATIONS |
---|
| 367 | Int* cfg_numSamplePredRefLayers [MAX_LAYERS]; |
---|
| 368 | string cfg_samplePredRefLayerIds [MAX_LAYERS]; |
---|
| 369 | string* cfg_samplePredRefLayerIdsPtr[MAX_LAYERS]; |
---|
| 370 | Int* cfg_numMotionPredRefLayers [MAX_LAYERS]; |
---|
| 371 | string cfg_motionPredRefLayerIds [MAX_LAYERS]; |
---|
| 372 | string* cfg_motionPredRefLayerIdsPtr[MAX_LAYERS]; |
---|
| 373 | #else |
---|
| 374 | Int* cfg_numDirectRefLayers [MAX_LAYERS]; |
---|
| 375 | string cfg_refLayerIds [MAX_LAYERS]; |
---|
| 376 | string* cfg_refLayerIdsPtr [MAX_LAYERS]; |
---|
| 377 | #endif |
---|
| 378 | Int* cfg_numActiveRefLayers [MAX_LAYERS]; |
---|
| 379 | string cfg_predLayerIds [MAX_LAYERS]; |
---|
| 380 | string* cfg_predLayerIdsPtr [MAX_LAYERS]; |
---|
| 381 | #endif |
---|
| 382 | string cfg_scaledRefLayerLeftOffset [MAX_LAYERS]; |
---|
| 383 | string cfg_scaledRefLayerTopOffset [MAX_LAYERS]; |
---|
| 384 | string cfg_scaledRefLayerRightOffset [MAX_LAYERS]; |
---|
| 385 | string cfg_scaledRefLayerBottomOffset [MAX_LAYERS]; |
---|
| 386 | Int* cfg_numScaledRefLayerOffsets[MAX_LAYERS]; |
---|
| 387 | |
---|
| 388 | string* cfg_scaledRefLayerLeftOffsetPtr [MAX_LAYERS]; |
---|
| 389 | string* cfg_scaledRefLayerTopOffsetPtr [MAX_LAYERS]; |
---|
| 390 | string* cfg_scaledRefLayerRightOffsetPtr [MAX_LAYERS]; |
---|
| 391 | string* cfg_scaledRefLayerBottomOffsetPtr [MAX_LAYERS]; |
---|
| 392 | #if RC_SHVC_HARMONIZATION |
---|
| 393 | Bool* cfg_RCEnableRateControl [MAX_LAYERS]; |
---|
| 394 | Int* cfg_RCTargetBitRate [MAX_LAYERS]; |
---|
| 395 | Bool* cfg_RCKeepHierarchicalBit[MAX_LAYERS]; |
---|
| 396 | Bool* cfg_RCLCULevelRC [MAX_LAYERS]; |
---|
| 397 | Bool* cfg_RCUseLCUSeparateModel[MAX_LAYERS]; |
---|
| 398 | Int* cfg_RCInitialQP [MAX_LAYERS]; |
---|
| 399 | Bool* cfg_RCForceIntraQP [MAX_LAYERS]; |
---|
| 400 | #endif |
---|
[466] | 401 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
| 402 | Int* cfg_InputBitDepthY [MAX_LAYERS]; |
---|
| 403 | Int* cfg_InternalBitDepthY [MAX_LAYERS]; |
---|
| 404 | Int* cfg_InputBitDepthC [MAX_LAYERS]; |
---|
| 405 | Int* cfg_InternalBitDepthC [MAX_LAYERS]; |
---|
| 406 | Int* cfg_OutputBitDepthY [MAX_LAYERS]; |
---|
| 407 | Int* cfg_OutputBitDepthC [MAX_LAYERS]; |
---|
| 408 | #endif |
---|
[442] | 409 | #if N0120_MAX_TID_REF_CFG |
---|
| 410 | Int* cfg_maxTidIlRefPicsPlus1[MAX_LAYERS]; |
---|
| 411 | #endif |
---|
[313] | 412 | for(UInt layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 413 | { |
---|
| 414 | cfg_InputFile[layer] = &m_acLayerCfg[layer].m_cInputFile; |
---|
| 415 | cfg_ReconFile[layer] = &m_acLayerCfg[layer].m_cReconFile; |
---|
| 416 | cfg_fQP[layer] = &m_acLayerCfg[layer].m_fQP; |
---|
[442] | 417 | #if REPN_FORMAT_IN_VPS |
---|
| 418 | cfg_repFormatIdx[layer] = &m_acLayerCfg[layer].m_repFormatIdx; |
---|
| 419 | #endif |
---|
[313] | 420 | cfg_SourceWidth[layer] = &m_acLayerCfg[layer].m_iSourceWidth; |
---|
| 421 | cfg_SourceHeight[layer] = &m_acLayerCfg[layer].m_iSourceHeight; |
---|
| 422 | cfg_FrameRate[layer] = &m_acLayerCfg[layer].m_iFrameRate; |
---|
| 423 | cfg_IntraPeriod[layer] = &m_acLayerCfg[layer].m_iIntraPeriod; |
---|
| 424 | cfg_conformanceMode[layer] = &m_acLayerCfg[layer].m_conformanceMode; |
---|
[467] | 425 | #if LAYER_CTB |
---|
| 426 | // coding unit (CU) definition |
---|
| 427 | cfg_uiMaxCUWidth[layer] = &m_acLayerCfg[layer].m_uiMaxCUWidth; |
---|
| 428 | cfg_uiMaxCUHeight[layer] = &m_acLayerCfg[layer].m_uiMaxCUHeight; |
---|
| 429 | cfg_uiMaxCUDepth[layer] = &m_acLayerCfg[layer].m_uiMaxCUDepth; |
---|
| 430 | |
---|
| 431 | // transfom unit (TU) definition. |
---|
| 432 | cfg_uiQuadtreeTULog2MaxSize[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTULog2MaxSize; |
---|
| 433 | cfg_uiQuadtreeTULog2MinSize[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTULog2MinSize; |
---|
| 434 | |
---|
| 435 | cfg_uiQuadtreeTUMaxDepthInter[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthInter; |
---|
| 436 | cfg_uiQuadtreeTUMaxDepthIntra[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthIntra; |
---|
| 437 | #endif |
---|
[313] | 438 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
| 439 | #if M0457_PREDICTION_INDICATIONS |
---|
| 440 | cfg_numSamplePredRefLayers [layer] = &m_acLayerCfg[layer].m_numSamplePredRefLayers; |
---|
| 441 | cfg_samplePredRefLayerIdsPtr[layer] = &cfg_samplePredRefLayerIds[layer]; |
---|
| 442 | cfg_numMotionPredRefLayers [layer] = &m_acLayerCfg[layer].m_numMotionPredRefLayers; |
---|
| 443 | cfg_motionPredRefLayerIdsPtr[layer] = &cfg_motionPredRefLayerIds[layer]; |
---|
| 444 | #else |
---|
| 445 | cfg_numDirectRefLayers [layer] = &m_acLayerCfg[layer].m_numDirectRefLayers; |
---|
| 446 | cfg_refLayerIdsPtr [layer] = &cfg_refLayerIds[layer]; |
---|
| 447 | #endif |
---|
| 448 | cfg_numActiveRefLayers [layer] = &m_acLayerCfg[layer].m_numActiveRefLayers; |
---|
| 449 | cfg_predLayerIdsPtr [layer] = &cfg_predLayerIds[layer]; |
---|
| 450 | #endif |
---|
| 451 | cfg_numScaledRefLayerOffsets [layer] = &m_acLayerCfg[layer].m_numScaledRefLayerOffsets; |
---|
| 452 | for(Int i = 0; i < MAX_LAYERS; i++) |
---|
| 453 | { |
---|
| 454 | cfg_scaledRefLayerLeftOffsetPtr [layer] = &cfg_scaledRefLayerLeftOffset[layer] ; |
---|
| 455 | cfg_scaledRefLayerTopOffsetPtr [layer] = &cfg_scaledRefLayerTopOffset[layer] ; |
---|
| 456 | cfg_scaledRefLayerRightOffsetPtr [layer] = &cfg_scaledRefLayerRightOffset[layer] ; |
---|
| 457 | cfg_scaledRefLayerBottomOffsetPtr[layer] = &cfg_scaledRefLayerBottomOffset[layer]; |
---|
| 458 | } |
---|
| 459 | #if RC_SHVC_HARMONIZATION |
---|
| 460 | cfg_RCEnableRateControl[layer] = &m_acLayerCfg[layer].m_RCEnableRateControl; |
---|
| 461 | cfg_RCTargetBitRate[layer] = &m_acLayerCfg[layer].m_RCTargetBitrate; |
---|
| 462 | cfg_RCKeepHierarchicalBit[layer] = &m_acLayerCfg[layer].m_RCKeepHierarchicalBit; |
---|
| 463 | cfg_RCLCULevelRC[layer] = &m_acLayerCfg[layer].m_RCLCULevelRC; |
---|
| 464 | cfg_RCUseLCUSeparateModel[layer] = &m_acLayerCfg[layer].m_RCUseLCUSeparateModel; |
---|
| 465 | cfg_RCInitialQP[layer] = &m_acLayerCfg[layer].m_RCInitialQP; |
---|
| 466 | cfg_RCForceIntraQP[layer] = &m_acLayerCfg[layer].m_RCForceIntraQP; |
---|
| 467 | #endif |
---|
[466] | 468 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
| 469 | cfg_InputBitDepthY [layer] = &m_acLayerCfg[layer].m_inputBitDepthY; |
---|
| 470 | cfg_InternalBitDepthY[layer] = &m_acLayerCfg[layer].m_internalBitDepthY; |
---|
| 471 | cfg_InputBitDepthC [layer] = &m_acLayerCfg[layer].m_inputBitDepthC; |
---|
| 472 | cfg_InternalBitDepthC[layer] = &m_acLayerCfg[layer].m_internalBitDepthC; |
---|
| 473 | cfg_OutputBitDepthY [layer] = &m_acLayerCfg[layer].m_outputBitDepthY; |
---|
| 474 | cfg_OutputBitDepthC [layer] = &m_acLayerCfg[layer].m_outputBitDepthC; |
---|
| 475 | #endif |
---|
[442] | 476 | #if N0120_MAX_TID_REF_CFG |
---|
| 477 | cfg_maxTidIlRefPicsPlus1[layer] = &m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1; |
---|
| 478 | #endif |
---|
[313] | 479 | } |
---|
| 480 | #if AVC_BASE |
---|
| 481 | string cfg_BLInputFile; |
---|
| 482 | #endif |
---|
| 483 | #if AVC_SYNTAX |
---|
| 484 | string cfg_BLSyntaxFile; |
---|
| 485 | #endif |
---|
[442] | 486 | #if N0383_IL_CONSTRAINED_TILE_SETS_SEI |
---|
| 487 | string cfg_tileSets; |
---|
| 488 | #endif |
---|
[467] | 489 | #else //SVC_EXTENSION |
---|
[313] | 490 | string cfg_InputFile; |
---|
| 491 | string cfg_BitstreamFile; |
---|
| 492 | string cfg_ReconFile; |
---|
| 493 | string cfg_dQPFile; |
---|
[467] | 494 | #endif //SVC_EXTENSION |
---|
[313] | 495 | string cfg_ColumnWidth; |
---|
| 496 | string cfg_RowHeight; |
---|
| 497 | string cfg_ScalingListFile; |
---|
| 498 | string cfg_startOfCodedInterval; |
---|
| 499 | string cfg_codedPivotValue; |
---|
| 500 | string cfg_targetPivotValue; |
---|
| 501 | po::Options opts; |
---|
| 502 | opts.addOptions() |
---|
| 503 | ("help", do_help, false, "this help text") |
---|
| 504 | ("c", po::parseConfigFile, "configuration file name") |
---|
| 505 | |
---|
| 506 | // File, I/O and source parameters |
---|
| 507 | #if SVC_EXTENSION |
---|
| 508 | ("InputFile%d,-i%d", cfg_InputFile, string(""), MAX_LAYERS, "original YUV input file name for layer %d") |
---|
| 509 | ("ReconFile%d,-o%d", cfg_ReconFile, string(""), MAX_LAYERS, "reconstruction YUV input file name for layer %d") |
---|
| 510 | ("LayerConfig%d,-lc%d", cfg_LayerCfgFile, string(""), MAX_LAYERS, "layer %d configuration file name") |
---|
| 511 | ("SourceWidth%d,-wdt%d", cfg_SourceWidth, 0, MAX_LAYERS, "Source picture width for layer %d") |
---|
| 512 | ("SourceHeight%d,-hgt%d", cfg_SourceHeight, 0, MAX_LAYERS, "Source picture height for layer %d") |
---|
| 513 | ("FrameRate%d,-fr%d", cfg_FrameRate, 0, MAX_LAYERS, "Frame rate for layer %d") |
---|
| 514 | ("LambdaModifier%d,-LM%d", m_adLambdaModifier, ( double )1.0, MAX_TLAYER, "Lambda modifier for temporal layer %d") |
---|
[464] | 515 | #if O0215_PHASE_ALIGNMENT |
---|
| 516 | ("PhaseAlignment", m_phaseAlignFlag, false, "indicate the sample location alignment between layers (0: zero position aligned, 1: central position aligned)") |
---|
| 517 | #endif |
---|
[442] | 518 | #if REPN_FORMAT_IN_VPS |
---|
| 519 | ("RepFormatIdx%d", cfg_repFormatIdx, -1, MAX_LAYERS, "Index to the representation format structure used from the VPS") |
---|
| 520 | #endif |
---|
[313] | 521 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
| 522 | #if M0457_PREDICTION_INDICATIONS |
---|
| 523 | ("NumSamplePredRefLayers%d",cfg_numSamplePredRefLayers, -1, MAX_LAYERS, "Number of sample prediction reference layers") |
---|
| 524 | ("SamplePredRefLayerIds%d", cfg_samplePredRefLayerIdsPtr, string(""), MAX_LAYERS, "sample pred reference layer IDs") |
---|
| 525 | ("NumMotionPredRefLayers%d",cfg_numMotionPredRefLayers, -1, MAX_LAYERS, "Number of motion prediction reference layers") |
---|
| 526 | ("MotionPredRefLayerIds%d", cfg_motionPredRefLayerIdsPtr, string(""), MAX_LAYERS, "motion pred reference layer IDs") |
---|
| 527 | #else |
---|
| 528 | ("NumDirectRefLayers%d", cfg_numDirectRefLayers, -1, MAX_LAYERS, "Number of direct reference layers") |
---|
| 529 | ("RefLayerIds%d", cfg_refLayerIdsPtr, string(""), MAX_LAYERS, "direct reference layer IDs") |
---|
| 530 | #endif |
---|
| 531 | ("NumActiveRefLayers%d", cfg_numActiveRefLayers, -1, MAX_LAYERS, "Number of active reference layers") |
---|
| 532 | ("PredLayerIds%d", cfg_predLayerIdsPtr, string(""), MAX_LAYERS, "inter-layer prediction layer IDs") |
---|
| 533 | #endif |
---|
| 534 | ("NumLayers", m_numLayers, 1, "Number of layers to code") |
---|
| 535 | ("ConformanceMode%d", cfg_conformanceMode,0, MAX_LAYERS, "Window conformance mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping") |
---|
[442] | 536 | #if SCALABILITY_MASK_E0104 |
---|
| 537 | ("ScalabilityMask1", m_scalabilityMask[1], 0, "scalability_mask[1] (multiview)") |
---|
| 538 | ("ScalabilityMask2", m_scalabilityMask[2], 1, "scalability_mask[2] (scalable)" ) |
---|
| 539 | #else |
---|
[313] | 540 | ("ScalabilityMask0", m_scalabilityMask[0], 0, "scalability_mask[0] (multiview)") |
---|
| 541 | ("ScalabilityMask1", m_scalabilityMask[1], 1, "scalability_mask[1] (scalable)" ) |
---|
[442] | 542 | #endif |
---|
[313] | 543 | ("BitstreamFile,b", cfg_BitstreamFile, string(""), "Bitstream output file name") |
---|
[466] | 544 | #if !O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
[313] | 545 | ("InputBitDepth", m_inputBitDepthY, 8, "Bit-depth of input file") |
---|
| 546 | ("OutputBitDepth", m_outputBitDepthY, 0, "Bit-depth of output file (default:InternalBitDepth)") |
---|
| 547 | ("InternalBitDepth", m_internalBitDepthY, 0, "Bit-depth the codec operates at. (default:InputBitDepth)" |
---|
| 548 | "If different to InputBitDepth, source data will be converted") |
---|
| 549 | ("InputBitDepthC", m_inputBitDepthC, 0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)") |
---|
| 550 | ("OutputBitDepthC", m_outputBitDepthC, 0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)") |
---|
| 551 | ("InternalBitDepthC", m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)") |
---|
[466] | 552 | #endif |
---|
[313] | 553 | ("NumScaledRefLayerOffsets%d", cfg_numScaledRefLayerOffsets, 0, MAX_LAYERS, "Number of scaled offset layer sets ") |
---|
| 554 | ("ScaledRefLayerLeftOffset%d", cfg_scaledRefLayerLeftOffsetPtr, string(""), MAX_LAYERS, "Horizontal offset of top-left luma sample of scaled base layer picture with respect to" |
---|
| 555 | " top-left luma sample of the EL picture, in units of two luma samples") |
---|
| 556 | ("ScaledRefLayerTopOffset%d", cfg_scaledRefLayerTopOffsetPtr, string(""), MAX_LAYERS, "Vertical offset of top-left luma sample of scaled base layer picture with respect to" |
---|
| 557 | " top-left luma sample of the EL picture, in units of two luma samples") |
---|
| 558 | ("ScaledRefLayerRightOffset%d", cfg_scaledRefLayerRightOffsetPtr, string(""), MAX_LAYERS, "Horizontal offset of bottom-right luma sample of scaled base layer picture with respect to" |
---|
| 559 | " bottom-right luma sample of the EL picture, in units of two luma samples") |
---|
| 560 | ("ScaledRefLayerBottomOffset%d", cfg_scaledRefLayerBottomOffsetPtr,string(""), MAX_LAYERS, "Vertical offset of bottom-right luma sample of scaled base layer picture with respect to" |
---|
| 561 | " bottom-right luma sample of the EL picture, in units of two luma samples") |
---|
[466] | 562 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
| 563 | ("InputBitDepth%d", cfg_InputBitDepthY, 8, MAX_LAYERS, "Bit-depth of input file for layer %d") |
---|
| 564 | ("InternalBitDepth%d", cfg_InternalBitDepthY, 0, MAX_LAYERS, "Bit-depth the codec operates at. (default:InputBitDepth) for layer %d ") |
---|
| 565 | // "If different to InputBitDepth, source data will be converted") |
---|
| 566 | ("InputBitDepthC%d", cfg_InputBitDepthC, 0, MAX_LAYERS, "As per InputBitDepth but for chroma component. (default:InputBitDepth) for layer %d") |
---|
| 567 | ("InternalBitDepthC%d", cfg_InternalBitDepthC, 0, MAX_LAYERS, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth) for layer %d") |
---|
| 568 | ("OutputBitDepth%d", cfg_OutputBitDepthY, 0, MAX_LAYERS, "Bit-depth of output file (default:InternalBitDepth)") |
---|
| 569 | ("OutputBitDepthC%d", cfg_OutputBitDepthC, 0, MAX_LAYERS, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)") |
---|
| 570 | #endif |
---|
[442] | 571 | #if N0120_MAX_TID_REF_CFG |
---|
| 572 | ("MaxTidRefPresentFlag", m_maxTidRefPresentFlag, true, "max_tid_ref_present_flag (0: not present, 1: present(default)) " ) |
---|
| 573 | ("MaxTidIlRefPicsPlus1%d", cfg_maxTidIlRefPicsPlus1, 1, MAX_LAYERS, "allowed maximum temporal_id for inter-layer prediction") |
---|
| 574 | #endif |
---|
[313] | 575 | #if AVC_BASE |
---|
| 576 | ("AvcBase,-avc", m_avcBaseLayerFlag, 0, "avc_base_layer_flag") |
---|
| 577 | ("InputBLFile,-ibl", cfg_BLInputFile, string(""), "Base layer rec YUV input file name") |
---|
| 578 | #if AVC_SYNTAX |
---|
| 579 | ("InputBLSyntaxFile,-ibs", cfg_BLSyntaxFile, string(""), "Base layer syntax input file name") |
---|
| 580 | #endif |
---|
| 581 | #endif |
---|
| 582 | ("EnableElRapB,-use-rap-b", m_elRapSliceBEnabled, 0, "Set ILP over base-layer I picture to B picture (default is P picture)") |
---|
| 583 | #if M0457_IL_SAMPLE_PRED_ONLY_FLAG |
---|
| 584 | ("IlSampleOnlyPred%d", m_ilSampleOnlyPred, 0, MAX_LAYERS, "Set inter_layer_sample_pred_only_flag for all slices") |
---|
| 585 | #endif |
---|
[467] | 586 | #else //SVC_EXTENSION |
---|
[313] | 587 | ("InputFile,i", cfg_InputFile, string(""), "Original YUV input file name") |
---|
| 588 | ("BitstreamFile,b", cfg_BitstreamFile, string(""), "Bitstream output file name") |
---|
| 589 | ("ReconFile,o", cfg_ReconFile, string(""), "Reconstructed YUV output file name") |
---|
| 590 | ("SourceWidth,-wdt", m_iSourceWidth, 0, "Source picture width") |
---|
| 591 | ("SourceHeight,-hgt", m_iSourceHeight, 0, "Source picture height") |
---|
| 592 | ("InputBitDepth", m_inputBitDepthY, 8, "Bit-depth of input file") |
---|
| 593 | ("OutputBitDepth", m_outputBitDepthY, 0, "Bit-depth of output file (default:InternalBitDepth)") |
---|
| 594 | ("InternalBitDepth", m_internalBitDepthY, 0, "Bit-depth the codec operates at. (default:InputBitDepth)" |
---|
| 595 | "If different to InputBitDepth, source data will be converted") |
---|
| 596 | ("InputBitDepthC", m_inputBitDepthC, 0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)") |
---|
| 597 | ("OutputBitDepthC", m_outputBitDepthC, 0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)") |
---|
| 598 | ("InternalBitDepthC", m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)") |
---|
| 599 | ("ConformanceMode", m_conformanceMode, 0, "Window conformance mode (0: no window, 1:automatic padding, 2:padding, 3:conformance") |
---|
| 600 | ("HorizontalPadding,-pdx",m_aiPad[0], 0, "Horizontal source padding for conformance window mode 2") |
---|
| 601 | ("VerticalPadding,-pdy", m_aiPad[1], 0, "Vertical source padding for conformance window mode 2") |
---|
| 602 | ("ConfLeft", m_confLeft, 0, "Left offset for window conformance mode 3") |
---|
| 603 | ("ConfRight", m_confRight, 0, "Right offset for window conformance mode 3") |
---|
| 604 | ("ConfTop", m_confTop, 0, "Top offset for window conformance mode 3") |
---|
| 605 | ("ConfBottom", m_confBottom, 0, "Bottom offset for window conformance mode 3") |
---|
| 606 | ("FrameRate,-fr", m_iFrameRate, 0, "Frame rate") |
---|
[467] | 607 | #endif //SVC_EXTENSION |
---|
[442] | 608 | |
---|
| 609 | //Field coding parameters |
---|
| 610 | ("FieldCoding", m_isField, false, "Signals if it's a field based coding") |
---|
| 611 | ("TopFieldFirst, Tff", m_isTopFieldFirst, false, "In case of field based coding, signals whether if it's a top field first or not") |
---|
[313] | 612 | ("FrameSkip,-fs", m_FrameSkip, 0u, "Number of frames to skip at start of input YUV") |
---|
| 613 | ("FramesToBeEncoded,f", m_framesToBeEncoded, 0, "Number of frames to be encoded (default=all)") |
---|
| 614 | // Profile and level |
---|
| 615 | ("Profile", m_profile, Profile::NONE, "Profile to be used when encoding (Incomplete)") |
---|
| 616 | ("Level", m_level, Level::NONE, "Level limit to be used, eg 5.1 (Incomplete)") |
---|
| 617 | ("Tier", m_levelTier, Level::MAIN, "Tier to use for interpretation of --Level") |
---|
| 618 | |
---|
| 619 | ("ProgressiveSource", m_progressiveSourceFlag, false, "Indicate that source is progressive") |
---|
| 620 | ("InterlacedSource", m_interlacedSourceFlag, false, "Indicate that source is interlaced") |
---|
| 621 | ("NonPackedSource", m_nonPackedConstraintFlag, false, "Indicate that source does not contain frame packing") |
---|
| 622 | ("FrameOnly", m_frameOnlyConstraintFlag, false, "Indicate that the bitstream contains only frames") |
---|
| 623 | |
---|
[467] | 624 | #if LAYER_CTB |
---|
[313] | 625 | // Unit definition parameters |
---|
[467] | 626 | ("MaxCUWidth%d", cfg_uiMaxCUWidth, 64u, MAX_LAYERS, "Maximum CU width") |
---|
| 627 | ("MaxCUHeight%d", cfg_uiMaxCUHeight, 64u, MAX_LAYERS, "Maximum CU height") |
---|
| 628 | // todo: remove defaults from MaxCUSize |
---|
| 629 | ("MaxCUSize%d,s%d", cfg_uiMaxCUWidth, 64u, MAX_LAYERS, "Maximum CU size") |
---|
| 630 | ("MaxCUSize%d,s%d", cfg_uiMaxCUHeight, 64u, MAX_LAYERS, "Maximum CU size") |
---|
| 631 | ("MaxPartitionDepth%d,h%d", cfg_uiMaxCUDepth, 4u, MAX_LAYERS, "CU depth") |
---|
| 632 | |
---|
| 633 | ("QuadtreeTULog2MaxSize%d", cfg_uiQuadtreeTULog2MaxSize, 6u, MAX_LAYERS, "Maximum TU size in logarithm base 2") |
---|
| 634 | ("QuadtreeTULog2MinSize%d", cfg_uiQuadtreeTULog2MinSize, 2u, MAX_LAYERS, "Minimum TU size in logarithm base 2") |
---|
| 635 | |
---|
| 636 | ("QuadtreeTUMaxDepthIntra%d", cfg_uiQuadtreeTUMaxDepthIntra, 1u, MAX_LAYERS, "Depth of TU tree for intra CUs") |
---|
| 637 | ("QuadtreeTUMaxDepthInter%d", cfg_uiQuadtreeTUMaxDepthInter, 2u, MAX_LAYERS, "Depth of TU tree for inter CUs") |
---|
| 638 | |
---|
| 639 | |
---|
| 640 | // set the same CU realted settings across all the layers if config file parameters are not layer specific |
---|
| 641 | ("MaxCUWidth", cfg_uiMaxCUWidth, 64u, MAX_LAYERS, "Maximum CU width") |
---|
| 642 | ("MaxCUHeight", cfg_uiMaxCUHeight, 64u, MAX_LAYERS, "Maximum CU height") |
---|
| 643 | // todo: remove defaults from MaxCUSize |
---|
| 644 | ("MaxCUSize,s", cfg_uiMaxCUWidth, 64u, MAX_LAYERS, "Maximum CU size") |
---|
| 645 | ("MaxCUSize,s", cfg_uiMaxCUHeight, 64u, MAX_LAYERS, "Maximum CU size") |
---|
| 646 | ("MaxPartitionDepth,h", cfg_uiMaxCUDepth, 4u, MAX_LAYERS, "CU depth") |
---|
| 647 | |
---|
| 648 | ("QuadtreeTULog2MaxSize", cfg_uiQuadtreeTULog2MaxSize, 6u, MAX_LAYERS, "Maximum TU size in logarithm base 2") |
---|
| 649 | ("QuadtreeTULog2MinSize", cfg_uiQuadtreeTULog2MinSize, 2u, MAX_LAYERS, "Minimum TU size in logarithm base 2") |
---|
| 650 | |
---|
| 651 | ("QuadtreeTUMaxDepthIntra", cfg_uiQuadtreeTUMaxDepthIntra, 1u, MAX_LAYERS, "Depth of TU tree for intra CUs") |
---|
| 652 | ("QuadtreeTUMaxDepthInter", cfg_uiQuadtreeTUMaxDepthInter, 2u, MAX_LAYERS, "Depth of TU tree for inter CUs") |
---|
| 653 | #else |
---|
| 654 | // Unit definition parameters |
---|
[313] | 655 | ("MaxCUWidth", m_uiMaxCUWidth, 64u) |
---|
| 656 | ("MaxCUHeight", m_uiMaxCUHeight, 64u) |
---|
| 657 | // todo: remove defaults from MaxCUSize |
---|
| 658 | ("MaxCUSize,s", m_uiMaxCUWidth, 64u, "Maximum CU size") |
---|
| 659 | ("MaxCUSize,s", m_uiMaxCUHeight, 64u, "Maximum CU size") |
---|
| 660 | ("MaxPartitionDepth,h", m_uiMaxCUDepth, 4u, "CU depth") |
---|
| 661 | |
---|
| 662 | ("QuadtreeTULog2MaxSize", m_uiQuadtreeTULog2MaxSize, 6u, "Maximum TU size in logarithm base 2") |
---|
| 663 | ("QuadtreeTULog2MinSize", m_uiQuadtreeTULog2MinSize, 2u, "Minimum TU size in logarithm base 2") |
---|
| 664 | |
---|
| 665 | ("QuadtreeTUMaxDepthIntra", m_uiQuadtreeTUMaxDepthIntra, 1u, "Depth of TU tree for intra CUs") |
---|
| 666 | ("QuadtreeTUMaxDepthInter", m_uiQuadtreeTUMaxDepthInter, 2u, "Depth of TU tree for inter CUs") |
---|
[467] | 667 | #endif |
---|
[313] | 668 | |
---|
| 669 | // Coding structure paramters |
---|
| 670 | #if SVC_EXTENSION |
---|
| 671 | ("IntraPeriod%d,-ip%d", cfg_IntraPeriod, -1, MAX_LAYERS, "intra period in frames for layer %d, (-1: only first frame)") |
---|
| 672 | #else |
---|
| 673 | ("IntraPeriod,-ip", m_iIntraPeriod, -1, "Intra period in frames, (-1: only first frame)") |
---|
| 674 | #endif |
---|
| 675 | ("DecodingRefreshType,-dr", m_iDecodingRefreshType, 0, "Intra refresh type (0:none 1:CRA 2:IDR)") |
---|
| 676 | ("GOPSize,g", m_iGOPSize, 1, "GOP size of temporal structure") |
---|
| 677 | // motion options |
---|
| 678 | ("FastSearch", m_iFastSearch, 1, "0:Full search 1:Diamond 2:PMVFAST") |
---|
| 679 | ("SearchRange,-sr", m_iSearchRange, 96, "Motion search range") |
---|
| 680 | ("BipredSearchRange", m_bipredSearchRange, 4, "Motion search range for bipred refinement") |
---|
| 681 | ("HadamardME", m_bUseHADME, true, "Hadamard ME for fractional-pel") |
---|
| 682 | ("ASR", m_bUseASR, false, "Adaptive motion search range") |
---|
| 683 | |
---|
| 684 | #if SVC_EXTENSION |
---|
| 685 | ("LambdaModifier%d,-LM%d", m_adLambdaModifier, ( double )1.0, MAX_TLAYER, "Lambda modifier for temporal layer %d") |
---|
| 686 | #else |
---|
| 687 | // Mode decision parameters |
---|
| 688 | ("LambdaModifier0,-LM0", m_adLambdaModifier[ 0 ], ( Double )1.0, "Lambda modifier for temporal layer 0") |
---|
| 689 | ("LambdaModifier1,-LM1", m_adLambdaModifier[ 1 ], ( Double )1.0, "Lambda modifier for temporal layer 1") |
---|
| 690 | ("LambdaModifier2,-LM2", m_adLambdaModifier[ 2 ], ( Double )1.0, "Lambda modifier for temporal layer 2") |
---|
| 691 | ("LambdaModifier3,-LM3", m_adLambdaModifier[ 3 ], ( Double )1.0, "Lambda modifier for temporal layer 3") |
---|
| 692 | ("LambdaModifier4,-LM4", m_adLambdaModifier[ 4 ], ( Double )1.0, "Lambda modifier for temporal layer 4") |
---|
| 693 | ("LambdaModifier5,-LM5", m_adLambdaModifier[ 5 ], ( Double )1.0, "Lambda modifier for temporal layer 5") |
---|
| 694 | ("LambdaModifier6,-LM6", m_adLambdaModifier[ 6 ], ( Double )1.0, "Lambda modifier for temporal layer 6") |
---|
| 695 | ("LambdaModifier7,-LM7", m_adLambdaModifier[ 7 ], ( Double )1.0, "Lambda modifier for temporal layer 7") |
---|
| 696 | #endif |
---|
| 697 | |
---|
| 698 | /* Quantization parameters */ |
---|
| 699 | #if SVC_EXTENSION |
---|
| 700 | ("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") |
---|
| 701 | #else |
---|
| 702 | ("QP,q", m_fQP, 30.0, "Qp value, if value is float, QP is switched once during encoding") |
---|
| 703 | #endif |
---|
| 704 | ("DeltaQpRD,-dqr",m_uiDeltaQpRD, 0u, "max dQp offset for slice") |
---|
| 705 | ("MaxDeltaQP,d", m_iMaxDeltaQP, 0, "max dQp offset for block") |
---|
| 706 | ("MaxCuDQPDepth,-dqd", m_iMaxCuDQPDepth, 0, "max depth for a minimum CuDQP") |
---|
| 707 | |
---|
| 708 | ("CbQpOffset,-cbqpofs", m_cbQpOffset, 0, "Chroma Cb QP Offset") |
---|
| 709 | ("CrQpOffset,-crqpofs", m_crQpOffset, 0, "Chroma Cr QP Offset") |
---|
| 710 | |
---|
| 711 | #if ADAPTIVE_QP_SELECTION |
---|
| 712 | ("AdaptiveQpSelection,-aqps", m_bUseAdaptQpSelect, false, "AdaptiveQpSelection") |
---|
| 713 | #endif |
---|
| 714 | |
---|
| 715 | ("AdaptiveQP,-aq", m_bUseAdaptiveQP, false, "QP adaptation based on a psycho-visual model") |
---|
| 716 | ("MaxQPAdaptationRange,-aqr", m_iQPAdaptationRange, 6, "QP adaptation range") |
---|
| 717 | #if !SVC_EXTENSION |
---|
| 718 | ("dQPFile,m", cfg_dQPFile, string(""), "dQP file name") |
---|
| 719 | #endif |
---|
| 720 | ("RDOQ", m_useRDOQ, true ) |
---|
| 721 | ("RDOQTS", m_useRDOQTS, true ) |
---|
| 722 | ("RDpenalty", m_rdPenalty, 0, "RD-penalty for 32x32 TU for intra in non-intra slices. 0:disbaled 1:RD-penalty 2:maximum RD-penalty") |
---|
| 723 | // Entropy coding parameters |
---|
| 724 | ("SBACRD", m_bUseSBACRD, true, "SBAC based RD estimation") |
---|
| 725 | |
---|
| 726 | // Deblocking filter parameters |
---|
| 727 | ("LoopFilterDisable", m_bLoopFilterDisable, false ) |
---|
| 728 | ("LoopFilterOffsetInPPS", m_loopFilterOffsetInPPS, false ) |
---|
| 729 | ("LoopFilterBetaOffset_div2", m_loopFilterBetaOffsetDiv2, 0 ) |
---|
| 730 | ("LoopFilterTcOffset_div2", m_loopFilterTcOffsetDiv2, 0 ) |
---|
| 731 | ("DeblockingFilterControlPresent", m_DeblockingFilterControlPresent, false ) |
---|
| 732 | ("DeblockingFilterMetric", m_DeblockingFilterMetric, false ) |
---|
| 733 | |
---|
| 734 | // Coding tools |
---|
| 735 | ("AMP", m_enableAMP, true, "Enable asymmetric motion partitions") |
---|
| 736 | ("TransformSkip", m_useTransformSkip, false, "Intra transform skipping") |
---|
| 737 | ("TransformSkipFast", m_useTransformSkipFast, false, "Fast intra transform skipping") |
---|
| 738 | ("SAO", m_bUseSAO, true, "Enable Sample Adaptive Offset") |
---|
| 739 | ("MaxNumOffsetsPerPic", m_maxNumOffsetsPerPic, 2048, "Max number of SAO offset per picture (Default: 2048)") |
---|
| 740 | ("SAOLcuBoundary", m_saoLcuBoundary, false, "0: right/bottom LCU boundary areas skipped from SAO parameter estimation, 1: non-deblocked pixels are used for those areas") |
---|
| 741 | ("SAOLcuBasedOptimization", m_saoLcuBasedOptimization, true, "0: SAO picture-based optimization, 1: SAO LCU-based optimization ") |
---|
| 742 | ("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") |
---|
| 743 | ("SliceArgument", m_sliceArgument, 0, "Depending on SliceMode being:" |
---|
| 744 | "\t1: max number of CTUs per slice" |
---|
| 745 | "\t2: max number of bytes per slice" |
---|
| 746 | "\t3: max number of tiles per slice") |
---|
| 747 | ("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") |
---|
| 748 | ("SliceSegmentArgument", m_sliceSegmentArgument, 0, "Depending on SliceSegmentMode being:" |
---|
| 749 | "\t1: max number of CTUs per slice segment" |
---|
| 750 | "\t2: max number of bytes per slice segment" |
---|
| 751 | "\t3: max number of tiles per slice segment") |
---|
| 752 | ("LFCrossSliceBoundaryFlag", m_bLFCrossSliceBoundaryFlag, true) |
---|
| 753 | |
---|
| 754 | ("ConstrainedIntraPred", m_bUseConstrainedIntraPred, false, "Constrained Intra Prediction") |
---|
| 755 | |
---|
| 756 | ("PCMEnabledFlag", m_usePCM, false) |
---|
| 757 | ("PCMLog2MaxSize", m_pcmLog2MaxSize, 5u) |
---|
| 758 | ("PCMLog2MinSize", m_uiPCMLog2MinSize, 3u) |
---|
| 759 | ("PCMInputBitDepthFlag", m_bPCMInputBitDepthFlag, true) |
---|
| 760 | ("PCMFilterDisableFlag", m_bPCMFilterDisableFlag, false) |
---|
| 761 | |
---|
| 762 | ("LosslessCuEnabled", m_useLossless, false) |
---|
| 763 | |
---|
| 764 | ("WeightedPredP,-wpP", m_useWeightedPred, false, "Use weighted prediction in P slices") |
---|
| 765 | ("WeightedPredB,-wpB", m_useWeightedBiPred, false, "Use weighted (bidirectional) prediction in B slices") |
---|
| 766 | ("Log2ParallelMergeLevel", m_log2ParallelMergeLevel, 2u, "Parallel merge estimation region") |
---|
| 767 | ("UniformSpacingIdc", m_iUniformSpacingIdr, 0, "Indicates if the column and row boundaries are distributed uniformly") |
---|
| 768 | ("NumTileColumnsMinus1", m_iNumColumnsMinus1, 0, "Number of columns in a picture minus 1") |
---|
| 769 | ("ColumnWidthArray", cfg_ColumnWidth, string(""), "Array containing ColumnWidth values in units of LCU") |
---|
| 770 | ("NumTileRowsMinus1", m_iNumRowsMinus1, 0, "Number of rows in a picture minus 1") |
---|
| 771 | ("RowHeightArray", cfg_RowHeight, string(""), "Array containing RowHeight values in units of LCU") |
---|
| 772 | ("LFCrossTileBoundaryFlag", m_bLFCrossTileBoundaryFlag, true, "1: cross-tile-boundary loop filtering. 0:non-cross-tile-boundary loop filtering") |
---|
| 773 | ("WaveFrontSynchro", m_iWaveFrontSynchro, 0, "0: no synchro; 1 synchro with TR; 2 TRR etc") |
---|
| 774 | ("ScalingList", m_useScalingListId, 0, "0: no scaling list, 1: default scaling lists, 2: scaling lists specified in ScalingListFile") |
---|
| 775 | ("ScalingListFile", cfg_ScalingListFile, string(""), "Scaling list file name") |
---|
| 776 | ("SignHideFlag,-SBH", m_signHideFlag, 1) |
---|
| 777 | ("MaxNumMergeCand", m_maxNumMergeCand, 5u, "Maximum number of merge candidates") |
---|
| 778 | |
---|
| 779 | /* Misc. */ |
---|
| 780 | ("SEIDecodedPictureHash", m_decodedPictureHashSEIEnabled, 0, "Control generation of decode picture hash SEI messages\n" |
---|
| 781 | "\t3: checksum\n" |
---|
| 782 | "\t2: CRC\n" |
---|
| 783 | "\t1: use MD5\n" |
---|
| 784 | "\t0: disable") |
---|
| 785 | ("SEIpictureDigest", m_decodedPictureHashSEIEnabled, 0, "deprecated alias for SEIDecodedPictureHash") |
---|
| 786 | ("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") |
---|
| 787 | ("FEN", m_bUseFastEnc, false, "fast encoder setting") |
---|
| 788 | ("ECU", m_bUseEarlyCU, false, "Early CU setting") |
---|
| 789 | ("FDM", m_useFastDecisionForMerge, true, "Fast decision for Merge RD Cost") |
---|
| 790 | ("CFM", m_bUseCbfFastMode, false, "Cbf fast mode setting") |
---|
| 791 | ("ESD", m_useEarlySkipDetection, false, "Early SKIP detection setting") |
---|
| 792 | #if FAST_INTRA_SHVC |
---|
| 793 | ("FIS", m_useFastIntraScalable, false, "Fast Intra Decision for Scalable HEVC") |
---|
| 794 | #endif |
---|
| 795 | #if RATE_CONTROL_LAMBDA_DOMAIN |
---|
| 796 | #if RC_SHVC_HARMONIZATION |
---|
| 797 | ("RateControl%d", cfg_RCEnableRateControl, false, MAX_LAYERS, "Rate control: enable rate control for layer %d") |
---|
| 798 | ("TargetBitrate%d", cfg_RCTargetBitRate, 0, MAX_LAYERS, "Rate control: target bitrate for layer %d") |
---|
| 799 | ("KeepHierarchicalBit%d", cfg_RCKeepHierarchicalBit, false, MAX_LAYERS, "Rate control: keep hierarchical bit allocation for layer %d") |
---|
| 800 | ("LCULevelRateControl%d", cfg_RCLCULevelRC, true, MAX_LAYERS, "Rate control: LCU level RC") |
---|
| 801 | ("RCLCUSeparateModel%d", cfg_RCUseLCUSeparateModel, true, MAX_LAYERS, "Rate control: Use LCU level separate R-lambda model") |
---|
| 802 | ("InitialQP%d", cfg_RCInitialQP, 0, MAX_LAYERS, "Rate control: initial QP") |
---|
| 803 | ("RCForceIntraQP%d", cfg_RCForceIntraQP, false, MAX_LAYERS, "Rate control: force intra QP to be equal to initial QP") |
---|
| 804 | #else |
---|
| 805 | ( "RateControl", m_RCEnableRateControl, false, "Rate control: enable rate control" ) |
---|
| 806 | ( "TargetBitrate", m_RCTargetBitrate, 0, "Rate control: target bitrate" ) |
---|
| 807 | #if M0036_RC_IMPROVEMENT |
---|
| 808 | ( "KeepHierarchicalBit", m_RCKeepHierarchicalBit, 0, "Rate control: 0: equal bit allocation; 1: fixed ratio bit allocation; 2: adaptive ratio bit allocation" ) |
---|
| 809 | #else |
---|
| 810 | ( "KeepHierarchicalBit", m_RCKeepHierarchicalBit, false, "Rate control: keep hierarchical bit allocation in rate control algorithm" ) |
---|
| 811 | #endif |
---|
| 812 | ( "LCULevelRateControl", m_RCLCULevelRC, true, "Rate control: true: LCU level RC; false: picture level RC" ) |
---|
| 813 | ( "RCLCUSeparateModel", m_RCUseLCUSeparateModel, true, "Rate control: use LCU level separate R-lambda model" ) |
---|
| 814 | ( "InitialQP", m_RCInitialQP, 0, "Rate control: initial QP" ) |
---|
| 815 | ( "RCForceIntraQP", m_RCForceIntraQP, false, "Rate control: force intra QP to be equal to initial QP" ) |
---|
| 816 | #endif |
---|
| 817 | #else |
---|
| 818 | ("RateCtrl,-rc", m_enableRateCtrl, false, "Rate control on/off") |
---|
| 819 | ("TargetBitrate,-tbr", m_targetBitrate, 0, "Input target bitrate") |
---|
| 820 | ("NumLCUInUnit,-nu", m_numLCUInUnit, 0, "Number of LCUs in an Unit") |
---|
| 821 | #endif |
---|
| 822 | |
---|
| 823 | ("TransquantBypassEnableFlag", m_TransquantBypassEnableFlag, false, "transquant_bypass_enable_flag indicator in PPS") |
---|
| 824 | ("CUTransquantBypassFlagValue", m_CUTransquantBypassFlagValue, false, "Fixed cu_transquant_bypass_flag value, when transquant_bypass_enable_flag is enabled") |
---|
| 825 | ("RecalculateQPAccordingToLambda", m_recalculateQPAccordingToLambda, false, "Recalculate QP values according to lambda values. Do not suggest to be enabled in all intra case") |
---|
| 826 | ("StrongIntraSmoothing,-sis", m_useStrongIntraSmoothing, true, "Enable strong intra smoothing for 32x32 blocks") |
---|
| 827 | ("SEIActiveParameterSets", m_activeParameterSetsSEIEnabled, 0, "Enable generation of active parameter sets SEI messages") |
---|
| 828 | ("VuiParametersPresent,-vui", m_vuiParametersPresentFlag, false, "Enable generation of vui_parameters()") |
---|
| 829 | ("AspectRatioInfoPresent", m_aspectRatioInfoPresentFlag, false, "Signals whether aspect_ratio_idc is present") |
---|
| 830 | ("AspectRatioIdc", m_aspectRatioIdc, 0, "aspect_ratio_idc") |
---|
| 831 | ("SarWidth", m_sarWidth, 0, "horizontal size of the sample aspect ratio") |
---|
| 832 | ("SarHeight", m_sarHeight, 0, "vertical size of the sample aspect ratio") |
---|
| 833 | ("OverscanInfoPresent", m_overscanInfoPresentFlag, false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n") |
---|
| 834 | ("OverscanAppropriate", m_overscanAppropriateFlag, false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n") |
---|
| 835 | ("VideoSignalTypePresent", m_videoSignalTypePresentFlag, false, "Signals whether video_format, video_full_range_flag, and colour_description_present_flag are present") |
---|
| 836 | ("VideoFormat", m_videoFormat, 5, "Indicates representation of pictures") |
---|
| 837 | ("VideoFullRange", m_videoFullRangeFlag, false, "Indicates the black level and range of luma and chroma signals") |
---|
| 838 | ("ColourDescriptionPresent", m_colourDescriptionPresentFlag, false, "Signals whether colour_primaries, transfer_characteristics and matrix_coefficients are present") |
---|
| 839 | ("ColourPrimaries", m_colourPrimaries, 2, "Indicates chromaticity coordinates of the source primaries") |
---|
| 840 | ("TransferCharateristics", m_transferCharacteristics, 2, "Indicates the opto-electronic transfer characteristics of the source") |
---|
| 841 | ("MatrixCoefficients", m_matrixCoefficients, 2, "Describes the matrix coefficients used in deriving luma and chroma from RGB primaries") |
---|
| 842 | ("ChromaLocInfoPresent", m_chromaLocInfoPresentFlag, false, "Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present") |
---|
| 843 | ("ChromaSampleLocTypeTopField", m_chromaSampleLocTypeTopField, 0, "Specifies the location of chroma samples for top field") |
---|
| 844 | ("ChromaSampleLocTypeBottomField", m_chromaSampleLocTypeBottomField, 0, "Specifies the location of chroma samples for bottom field") |
---|
| 845 | ("NeutralChromaIndication", m_neutralChromaIndicationFlag, false, "Indicates that the value of all decoded chroma samples is equal to 1<<(BitDepthCr-1)") |
---|
| 846 | ("DefaultDisplayWindowFlag", m_defaultDisplayWindowFlag, false, "Indicates the presence of the Default Window parameters") |
---|
| 847 | ("DefDispWinLeftOffset", m_defDispWinLeftOffset, 0, "Specifies the left offset of the default display window from the conformance window") |
---|
| 848 | ("DefDispWinRightOffset", m_defDispWinRightOffset, 0, "Specifies the right offset of the default display window from the conformance window") |
---|
| 849 | ("DefDispWinTopOffset", m_defDispWinTopOffset, 0, "Specifies the top offset of the default display window from the conformance window") |
---|
| 850 | ("DefDispWinBottomOffset", m_defDispWinBottomOffset, 0, "Specifies the bottom offset of the default display window from the conformance window") |
---|
| 851 | ("FrameFieldInfoPresentFlag", m_frameFieldInfoPresentFlag, false, "Indicates that pic_struct and field coding related values are present in picture timing SEI messages") |
---|
| 852 | ("PocProportionalToTimingFlag", m_pocProportionalToTimingFlag, false, "Indicates that the POC value is proportional to the output time w.r.t. first picture in CVS") |
---|
| 853 | ("NumTicksPocDiffOneMinus1", m_numTicksPocDiffOneMinus1, 0, "Number of ticks minus 1 that for a POC difference of one") |
---|
| 854 | ("BitstreamRestriction", m_bitstreamRestrictionFlag, false, "Signals whether bitstream restriction parameters are present") |
---|
| 855 | ("TilesFixedStructure", m_tilesFixedStructureFlag, false, "Indicates that each active picture parameter set has the same values of the syntax elements related to tiles") |
---|
| 856 | ("MotionVectorsOverPicBoundaries", m_motionVectorsOverPicBoundariesFlag, false, "Indicates that no samples outside the picture boundaries are used for inter prediction") |
---|
| 857 | ("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") |
---|
| 858 | ("MaxBitsPerMinCuDenom", m_maxBitsPerMinCuDenom, 1, "Indicates an upper bound for the number of bits of coding_unit() data") |
---|
| 859 | ("Log2MaxMvLengthHorizontal", m_log2MaxMvLengthHorizontal, 15, "Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units") |
---|
| 860 | ("Log2MaxMvLengthVertical", m_log2MaxMvLengthVertical, 15, "Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units") |
---|
| 861 | ("SEIRecoveryPoint", m_recoveryPointSEIEnabled, 0, "Control generation of recovery point SEI messages") |
---|
| 862 | ("SEIBufferingPeriod", m_bufferingPeriodSEIEnabled, 0, "Control generation of buffering period SEI messages") |
---|
| 863 | ("SEIPictureTiming", m_pictureTimingSEIEnabled, 0, "Control generation of picture timing SEI messages") |
---|
| 864 | ("SEIToneMappingInfo", m_toneMappingInfoSEIEnabled, false, "Control generation of Tone Mapping SEI messages") |
---|
| 865 | ("SEIToneMapId", m_toneMapId, 0, "Specifies Id of Tone Mapping SEI message for a given session") |
---|
| 866 | ("SEIToneMapCancelFlag", m_toneMapCancelFlag, false, "Indicates that Tone Mapping SEI message cancels the persistance or follows") |
---|
| 867 | ("SEIToneMapPersistenceFlag", m_toneMapPersistenceFlag, true, "Specifies the persistence of the Tone Mapping SEI message") |
---|
| 868 | ("SEIToneMapCodedDataBitDepth", m_toneMapCodedDataBitDepth, 8, "Specifies Coded Data BitDepth of Tone Mapping SEI messages") |
---|
| 869 | ("SEIToneMapTargetBitDepth", m_toneMapTargetBitDepth, 8, "Specifies Output BitDepth of Tome mapping function") |
---|
| 870 | ("SEIToneMapModelId", m_toneMapModelId, 0, "Specifies Model utilized for mapping coded data into target_bit_depth range\n" |
---|
| 871 | "\t0: linear mapping with clipping\n" |
---|
| 872 | "\t1: sigmoidal mapping\n" |
---|
| 873 | "\t2: user-defined table mapping\n" |
---|
| 874 | "\t3: piece-wise linear mapping\n" |
---|
| 875 | "\t4: luminance dynamic range information ") |
---|
| 876 | ("SEIToneMapMinValue", m_toneMapMinValue, 0, "Specifies the minimum value in mode 0") |
---|
| 877 | ("SEIToneMapMaxValue", m_toneMapMaxValue, 1023, "Specifies the maxmum value in mode 0") |
---|
| 878 | ("SEIToneMapSigmoidMidpoint", m_sigmoidMidpoint, 512, "Specifies the centre point in mode 1") |
---|
| 879 | ("SEIToneMapSigmoidWidth", m_sigmoidWidth, 960, "Specifies the distance between 5% and 95% values of the target_bit_depth in mode 1") |
---|
| 880 | ("SEIToneMapStartOfCodedInterval", cfg_startOfCodedInterval, string(""), "Array of user-defined mapping table") |
---|
| 881 | ("SEIToneMapNumPivots", m_numPivots, 0, "Specifies the number of pivot points in mode 3") |
---|
| 882 | ("SEIToneMapCodedPivotValue", cfg_codedPivotValue, string(""), "Array of pivot point") |
---|
| 883 | ("SEIToneMapTargetPivotValue", cfg_targetPivotValue, string(""), "Array of pivot point") |
---|
| 884 | ("SEIToneMapCameraIsoSpeedIdc", m_cameraIsoSpeedIdc, 0, "Indicates the camera ISO speed for daylight illumination") |
---|
| 885 | ("SEIToneMapCameraIsoSpeedValue", m_cameraIsoSpeedValue, 400, "Specifies the camera ISO speed for daylight illumination of Extended_ISO") |
---|
| 886 | ("SEIToneMapExposureCompensationValueSignFlag", m_exposureCompensationValueSignFlag, 0, "Specifies the sign of ExposureCompensationValue") |
---|
| 887 | ("SEIToneMapExposureCompensationValueNumerator", m_exposureCompensationValueNumerator, 0, "Specifies the numerator of ExposureCompensationValue") |
---|
| 888 | ("SEIToneMapExposureCompensationValueDenomIdc", m_exposureCompensationValueDenomIdc, 2, "Specifies the denominator of ExposureCompensationValue") |
---|
| 889 | ("SEIToneMapRefScreenLuminanceWhite", m_refScreenLuminanceWhite, 350, "Specifies reference screen brightness setting in units of candela per square metre") |
---|
| 890 | ("SEIToneMapExtendedRangeWhiteLevel", m_extendedRangeWhiteLevel, 800, "Indicates the luminance dynamic range") |
---|
| 891 | ("SEIToneMapNominalBlackLevelLumaCodeValue", m_nominalBlackLevelLumaCodeValue, 16, "Specifies luma sample value of the nominal black level assigned decoded pictures") |
---|
| 892 | ("SEIToneMapNominalWhiteLevelLumaCodeValue", m_nominalWhiteLevelLumaCodeValue, 235, "Specifies luma sample value of the nominal white level assigned decoded pictures") |
---|
| 893 | ("SEIToneMapExtendedWhiteLevelLumaCodeValue", m_extendedWhiteLevelLumaCodeValue, 300, "Specifies luma sample value of the extended dynamic range assigned decoded pictures") |
---|
| 894 | ("SEIFramePacking", m_framePackingSEIEnabled, 0, "Control generation of frame packing SEI messages") |
---|
| 895 | ("SEIFramePackingType", m_framePackingSEIType, 0, "Define frame packing arrangement\n" |
---|
| 896 | "\t0: checkerboard - pixels alternatively represent either frames\n" |
---|
| 897 | "\t1: column alternation - frames are interlaced by column\n" |
---|
| 898 | "\t2: row alternation - frames are interlaced by row\n" |
---|
| 899 | "\t3: side by side - frames are displayed horizontally\n" |
---|
| 900 | "\t4: top bottom - frames are displayed vertically\n" |
---|
| 901 | "\t5: frame alternation - one frame is alternated with the other") |
---|
| 902 | ("SEIFramePackingId", m_framePackingSEIId, 0, "Id of frame packing SEI message for a given session") |
---|
| 903 | ("SEIFramePackingQuincunx", m_framePackingSEIQuincunx, 0, "Indicate the presence of a Quincunx type video frame") |
---|
| 904 | ("SEIFramePackingInterpretation", m_framePackingSEIInterpretation, 0, "Indicate the interpretation of the frame pair\n" |
---|
| 905 | "\t0: unspecified\n" |
---|
| 906 | "\t1: stereo pair, frame0 represents left view\n" |
---|
| 907 | "\t2: stereo pair, frame0 represents right view") |
---|
| 908 | ("SEIDisplayOrientation", m_displayOrientationSEIAngle, 0, "Control generation of display orientation SEI messages\n" |
---|
| 909 | "\tN: 0 < N < (2^16 - 1) enable display orientation SEI message with anticlockwise_rotation = N and display_orientation_repetition_period = 1\n" |
---|
| 910 | "\t0: disable") |
---|
| 911 | ("SEITemporalLevel0Index", m_temporalLevel0IndexSEIEnabled, 0, "Control generation of temporal level 0 index SEI messages") |
---|
| 912 | ("SEIGradualDecodingRefreshInfo", m_gradualDecodingRefreshInfoEnabled, 0, "Control generation of gradual decoding refresh information SEI message") |
---|
| 913 | ("SEIDecodingUnitInfo", m_decodingUnitInfoSEIEnabled, 0, "Control generation of decoding unit information SEI message.") |
---|
| 914 | #if M0043_LAYERS_PRESENT_SEI |
---|
| 915 | ("SEILayersPresent", m_layersPresentSEIEnabled, 0, "Control generation of layers present SEI message") |
---|
| 916 | #endif |
---|
| 917 | ("SEISOPDescription", m_SOPDescriptionSEIEnabled, 0, "Control generation of SOP description SEI messages") |
---|
| 918 | ("SEIScalableNesting", m_scalableNestingSEIEnabled, 0, "Control generation of scalable nesting SEI messages") |
---|
| 919 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
| 920 | ("AdaptiveResolutionChange", m_adaptiveResolutionChange, 0, "Adaptive resolution change frame number. Should coincide with EL RAP picture. (0: disable)") |
---|
| 921 | #endif |
---|
[442] | 922 | #if N0383_IL_CONSTRAINED_TILE_SETS_SEI |
---|
| 923 | ("SEIInterLayerConstrainedTileSets", m_interLayerConstrainedTileSetsSEIEnabled, false, "Control generation of inter layer constrained tile sets SEI message") |
---|
| 924 | ("IlNumSetsInMessage", m_ilNumSetsInMessage, 0u, "Number of inter layer constrained tile sets") |
---|
| 925 | ("TileSetsArray", cfg_tileSets, string(""), "Array containing tile sets params (TopLeftTileIndex, BottonRightTileIndex and ilcIdc for each set) ") |
---|
| 926 | #endif |
---|
[313] | 927 | ; |
---|
| 928 | |
---|
| 929 | for(Int i=1; i<MAX_GOP+1; i++) { |
---|
| 930 | std::ostringstream cOSS; |
---|
| 931 | cOSS<<"Frame"<<i; |
---|
| 932 | opts.addOptions()(cOSS.str(), m_GOPList[i-1], GOPEntry()); |
---|
| 933 | } |
---|
| 934 | po::setDefaults(opts); |
---|
| 935 | const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv); |
---|
| 936 | |
---|
[442] | 937 | if(m_isField) |
---|
| 938 | { |
---|
| 939 | #if SVC_EXTENSION |
---|
| 940 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 941 | { |
---|
| 942 | //Frame height |
---|
| 943 | m_acLayerCfg[layer].m_iSourceHeightOrg = m_acLayerCfg[layer].m_iSourceHeight; |
---|
| 944 | //Field height |
---|
| 945 | m_acLayerCfg[layer].m_iSourceHeight = m_acLayerCfg[layer].m_iSourceHeight >> 1; |
---|
| 946 | } |
---|
| 947 | #else |
---|
| 948 | //Frame height |
---|
| 949 | m_iSourceHeightOrg = m_iSourceHeight; |
---|
| 950 | //Field height |
---|
| 951 | m_iSourceHeight = m_iSourceHeight >> 1; |
---|
| 952 | #endif |
---|
| 953 | //number of fields to encode |
---|
| 954 | m_framesToBeEncoded *= 2; |
---|
| 955 | } |
---|
| 956 | |
---|
[313] | 957 | for (list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++) |
---|
| 958 | { |
---|
| 959 | fprintf(stderr, "Unhandled argument ignored: `%s'\n", *it); |
---|
| 960 | } |
---|
| 961 | |
---|
| 962 | if (argc == 1 || do_help) |
---|
| 963 | { |
---|
| 964 | /* argc == 1: no options have been specified */ |
---|
| 965 | po::doHelp(cout, opts); |
---|
| 966 | return false; |
---|
| 967 | } |
---|
| 968 | |
---|
| 969 | /* |
---|
| 970 | * Set any derived parameters |
---|
| 971 | */ |
---|
| 972 | /* convert std::string to c string for compatability */ |
---|
| 973 | #if SVC_EXTENSION |
---|
| 974 | #if AVC_BASE |
---|
| 975 | if( m_avcBaseLayerFlag ) |
---|
| 976 | { |
---|
| 977 | *cfg_InputFile[0] = cfg_BLInputFile; |
---|
| 978 | } |
---|
| 979 | #endif |
---|
| 980 | m_pBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str()); |
---|
| 981 | #if AVC_SYNTAX |
---|
| 982 | m_BLSyntaxFile = cfg_BLSyntaxFile.empty() ? NULL : strdup(cfg_BLSyntaxFile.c_str()); |
---|
| 983 | #endif |
---|
[467] | 984 | #else //SVC_EXTENSION |
---|
[313] | 985 | m_pchInputFile = cfg_InputFile.empty() ? NULL : strdup(cfg_InputFile.c_str()); |
---|
| 986 | m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str()); |
---|
| 987 | m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str()); |
---|
| 988 | m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str()); |
---|
[467] | 989 | #endif //SVC_EXTENSION |
---|
[313] | 990 | |
---|
| 991 | Char* pColumnWidth = cfg_ColumnWidth.empty() ? NULL: strdup(cfg_ColumnWidth.c_str()); |
---|
| 992 | Char* pRowHeight = cfg_RowHeight.empty() ? NULL : strdup(cfg_RowHeight.c_str()); |
---|
| 993 | if( m_iUniformSpacingIdr == 0 && m_iNumColumnsMinus1 > 0 ) |
---|
| 994 | { |
---|
| 995 | char *columnWidth; |
---|
| 996 | int i=0; |
---|
| 997 | m_pColumnWidth = new UInt[m_iNumColumnsMinus1]; |
---|
| 998 | columnWidth = strtok(pColumnWidth, " ,-"); |
---|
| 999 | while(columnWidth!=NULL) |
---|
| 1000 | { |
---|
| 1001 | if( i>=m_iNumColumnsMinus1 ) |
---|
| 1002 | { |
---|
| 1003 | printf( "The number of columns whose width are defined is larger than the allowed number of columns.\n" ); |
---|
| 1004 | exit( EXIT_FAILURE ); |
---|
| 1005 | } |
---|
| 1006 | *( m_pColumnWidth + i ) = atoi( columnWidth ); |
---|
| 1007 | columnWidth = strtok(NULL, " ,-"); |
---|
| 1008 | i++; |
---|
| 1009 | } |
---|
| 1010 | if( i<m_iNumColumnsMinus1 ) |
---|
| 1011 | { |
---|
| 1012 | printf( "The width of some columns is not defined.\n" ); |
---|
| 1013 | exit( EXIT_FAILURE ); |
---|
| 1014 | } |
---|
| 1015 | } |
---|
| 1016 | else |
---|
| 1017 | { |
---|
| 1018 | m_pColumnWidth = NULL; |
---|
| 1019 | } |
---|
| 1020 | |
---|
| 1021 | if( m_iUniformSpacingIdr == 0 && m_iNumRowsMinus1 > 0 ) |
---|
| 1022 | { |
---|
| 1023 | char *rowHeight; |
---|
| 1024 | int i=0; |
---|
| 1025 | m_pRowHeight = new UInt[m_iNumRowsMinus1]; |
---|
| 1026 | rowHeight = strtok(pRowHeight, " ,-"); |
---|
| 1027 | while(rowHeight!=NULL) |
---|
| 1028 | { |
---|
| 1029 | if( i>=m_iNumRowsMinus1 ) |
---|
| 1030 | { |
---|
| 1031 | printf( "The number of rows whose height are defined is larger than the allowed number of rows.\n" ); |
---|
| 1032 | exit( EXIT_FAILURE ); |
---|
| 1033 | } |
---|
| 1034 | *( m_pRowHeight + i ) = atoi( rowHeight ); |
---|
| 1035 | rowHeight = strtok(NULL, " ,-"); |
---|
| 1036 | i++; |
---|
| 1037 | } |
---|
| 1038 | if( i<m_iNumRowsMinus1 ) |
---|
| 1039 | { |
---|
| 1040 | printf( "The height of some rows is not defined.\n" ); |
---|
| 1041 | exit( EXIT_FAILURE ); |
---|
| 1042 | } |
---|
| 1043 | } |
---|
| 1044 | else |
---|
| 1045 | { |
---|
| 1046 | m_pRowHeight = NULL; |
---|
| 1047 | } |
---|
[467] | 1048 | #if SVC_EXTENSION |
---|
[313] | 1049 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 1050 | { |
---|
| 1051 | // If number of scaled ref. layer offsets is non-zero, at least one of the offsets should be specified |
---|
| 1052 | if(m_acLayerCfg[layer].m_numScaledRefLayerOffsets) |
---|
| 1053 | { |
---|
| 1054 | assert( strcmp(cfg_scaledRefLayerLeftOffset[layer].c_str(), "") || |
---|
| 1055 | strcmp(cfg_scaledRefLayerRightOffset[layer].c_str(), "") || |
---|
| 1056 | strcmp(cfg_scaledRefLayerTopOffset[layer].c_str(), "") || |
---|
| 1057 | strcmp(cfg_scaledRefLayerBottomOffset[layer].c_str(),"") |
---|
| 1058 | ); |
---|
| 1059 | } |
---|
| 1060 | |
---|
| 1061 | Int *tempArray = NULL; // Contain the value |
---|
| 1062 | // Left offset // |
---|
| 1063 | if(strcmp(cfg_scaledRefLayerLeftOffset[layer].c_str(), "")) |
---|
| 1064 | { |
---|
| 1065 | cfgStringToArray( &tempArray, cfg_scaledRefLayerLeftOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "LeftOffset"); |
---|
| 1066 | if(tempArray) |
---|
| 1067 | { |
---|
| 1068 | for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) |
---|
| 1069 | { |
---|
| 1070 | m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i] = tempArray[i]; |
---|
| 1071 | } |
---|
| 1072 | delete [] tempArray; tempArray = NULL; |
---|
| 1073 | } |
---|
| 1074 | } |
---|
| 1075 | |
---|
| 1076 | // Top offset // |
---|
| 1077 | if(strcmp(cfg_scaledRefLayerTopOffset[layer].c_str(), "")) |
---|
| 1078 | { |
---|
| 1079 | cfgStringToArray( &tempArray, cfg_scaledRefLayerTopOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "TopOffset"); |
---|
| 1080 | if(tempArray) |
---|
| 1081 | { |
---|
| 1082 | for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) |
---|
| 1083 | { |
---|
| 1084 | m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i] = tempArray[i]; |
---|
| 1085 | } |
---|
| 1086 | delete [] tempArray; tempArray = NULL; |
---|
| 1087 | } |
---|
| 1088 | } |
---|
| 1089 | |
---|
| 1090 | // Right offset // |
---|
| 1091 | if(strcmp(cfg_scaledRefLayerRightOffset[layer].c_str(), "")) |
---|
| 1092 | { |
---|
| 1093 | cfgStringToArray( &tempArray, cfg_scaledRefLayerRightOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "RightOffset"); |
---|
| 1094 | if(tempArray) |
---|
| 1095 | { |
---|
| 1096 | for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) |
---|
| 1097 | { |
---|
| 1098 | m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i] = tempArray[i]; |
---|
| 1099 | } |
---|
| 1100 | delete [] tempArray; tempArray = NULL; |
---|
| 1101 | } |
---|
| 1102 | } |
---|
| 1103 | |
---|
| 1104 | // Bottom offset // |
---|
| 1105 | if(strcmp(cfg_scaledRefLayerBottomOffset[layer].c_str(), "")) |
---|
| 1106 | { |
---|
| 1107 | cfgStringToArray( &tempArray, cfg_scaledRefLayerBottomOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "BottomOffset"); |
---|
| 1108 | if(tempArray) |
---|
| 1109 | { |
---|
| 1110 | for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) |
---|
| 1111 | { |
---|
| 1112 | m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i] = tempArray[i]; |
---|
| 1113 | } |
---|
| 1114 | delete [] tempArray; tempArray = NULL; |
---|
| 1115 | } |
---|
| 1116 | } |
---|
| 1117 | } |
---|
| 1118 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
| 1119 | #if M0457_PREDICTION_INDICATIONS |
---|
| 1120 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 1121 | { |
---|
| 1122 | Char* pSamplePredRefLayerIds = cfg_samplePredRefLayerIds[layer].empty() ? NULL: strdup(cfg_samplePredRefLayerIds[layer].c_str()); |
---|
| 1123 | if( m_acLayerCfg[layer].m_numSamplePredRefLayers > 0 ) |
---|
| 1124 | { |
---|
| 1125 | char *samplePredRefLayerId; |
---|
| 1126 | int i=0; |
---|
| 1127 | m_acLayerCfg[layer].m_samplePredRefLayerIds = new Int[m_acLayerCfg[layer].m_numSamplePredRefLayers]; |
---|
| 1128 | samplePredRefLayerId = strtok(pSamplePredRefLayerIds, " ,-"); |
---|
| 1129 | while(samplePredRefLayerId != NULL) |
---|
| 1130 | { |
---|
| 1131 | if( i >= m_acLayerCfg[layer].m_numSamplePredRefLayers ) |
---|
| 1132 | { |
---|
| 1133 | printf( "NumSamplePredRefLayers: The number of columns whose width are defined is larger than the allowed number of columns.\n" ); |
---|
| 1134 | exit( EXIT_FAILURE ); |
---|
| 1135 | } |
---|
| 1136 | *( m_acLayerCfg[layer].m_samplePredRefLayerIds + i ) = atoi( samplePredRefLayerId ); |
---|
| 1137 | samplePredRefLayerId = strtok(NULL, " ,-"); |
---|
| 1138 | i++; |
---|
| 1139 | } |
---|
| 1140 | if( i < m_acLayerCfg[layer].m_numSamplePredRefLayers ) |
---|
| 1141 | { |
---|
| 1142 | printf( "NumSamplePredRefLayers: The width of some columns is not defined.\n" ); |
---|
| 1143 | exit( EXIT_FAILURE ); |
---|
| 1144 | } |
---|
| 1145 | } |
---|
| 1146 | else |
---|
| 1147 | { |
---|
| 1148 | m_acLayerCfg[layer].m_samplePredRefLayerIds = NULL; |
---|
| 1149 | } |
---|
| 1150 | } |
---|
| 1151 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 1152 | { |
---|
| 1153 | Char* pMotionPredRefLayerIds = cfg_motionPredRefLayerIds[layer].empty() ? NULL: strdup(cfg_motionPredRefLayerIds[layer].c_str()); |
---|
| 1154 | if( m_acLayerCfg[layer].m_numMotionPredRefLayers > 0 ) |
---|
| 1155 | { |
---|
| 1156 | char *motionPredRefLayerId; |
---|
| 1157 | int i=0; |
---|
| 1158 | m_acLayerCfg[layer].m_motionPredRefLayerIds = new Int[m_acLayerCfg[layer].m_numMotionPredRefLayers]; |
---|
| 1159 | motionPredRefLayerId = strtok(pMotionPredRefLayerIds, " ,-"); |
---|
| 1160 | while(motionPredRefLayerId != NULL) |
---|
| 1161 | { |
---|
| 1162 | if( i >= m_acLayerCfg[layer].m_numMotionPredRefLayers ) |
---|
| 1163 | { |
---|
| 1164 | printf( "NumMotionPredRefLayers: The number of columns whose width are defined is larger than the allowed number of columns.\n" ); |
---|
| 1165 | exit( EXIT_FAILURE ); |
---|
| 1166 | } |
---|
| 1167 | *( m_acLayerCfg[layer].m_motionPredRefLayerIds + i ) = atoi( motionPredRefLayerId ); |
---|
| 1168 | motionPredRefLayerId = strtok(NULL, " ,-"); |
---|
| 1169 | i++; |
---|
| 1170 | } |
---|
| 1171 | if( i < m_acLayerCfg[layer].m_numMotionPredRefLayers ) |
---|
| 1172 | { |
---|
| 1173 | printf( "NumMotionPredRefLayers: The width of some columns is not defined.\n" ); |
---|
| 1174 | exit( EXIT_FAILURE ); |
---|
| 1175 | } |
---|
| 1176 | } |
---|
| 1177 | else |
---|
| 1178 | { |
---|
| 1179 | m_acLayerCfg[layer].m_motionPredRefLayerIds = NULL; |
---|
| 1180 | } |
---|
| 1181 | } |
---|
| 1182 | #else |
---|
| 1183 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 1184 | { |
---|
| 1185 | Char* pRefLayerIds = cfg_refLayerIds[layer].empty() ? NULL: strdup(cfg_refLayerIds[layer].c_str()); |
---|
| 1186 | if( m_acLayerCfg[layer].m_numDirectRefLayers > 0 ) |
---|
| 1187 | { |
---|
| 1188 | char *refLayerId; |
---|
| 1189 | int i=0; |
---|
| 1190 | m_acLayerCfg[layer].m_refLayerIds = new Int[m_acLayerCfg[layer].m_numDirectRefLayers]; |
---|
| 1191 | refLayerId = strtok(pRefLayerIds, " ,-"); |
---|
| 1192 | while(refLayerId != NULL) |
---|
| 1193 | { |
---|
| 1194 | if( i >= m_acLayerCfg[layer].m_numDirectRefLayers ) |
---|
| 1195 | { |
---|
| 1196 | printf( "NumDirectRefLayers: The number of columns whose width are defined is larger than the allowed number of columns.\n" ); |
---|
| 1197 | exit( EXIT_FAILURE ); |
---|
| 1198 | } |
---|
| 1199 | *( m_acLayerCfg[layer].m_refLayerIds + i ) = atoi( refLayerId ); |
---|
| 1200 | refLayerId = strtok(NULL, " ,-"); |
---|
| 1201 | i++; |
---|
| 1202 | } |
---|
| 1203 | if( i < m_acLayerCfg[layer].m_numDirectRefLayers ) |
---|
| 1204 | { |
---|
| 1205 | printf( "NumDirectRefLayers: The width of some columns is not defined.\n" ); |
---|
| 1206 | exit( EXIT_FAILURE ); |
---|
| 1207 | } |
---|
| 1208 | } |
---|
| 1209 | else |
---|
| 1210 | { |
---|
| 1211 | m_acLayerCfg[layer].m_refLayerIds = NULL; |
---|
| 1212 | } |
---|
| 1213 | } |
---|
| 1214 | #endif |
---|
| 1215 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 1216 | { |
---|
| 1217 | Char* pPredLayerIds = cfg_predLayerIds[layer].empty() ? NULL: strdup(cfg_predLayerIds[layer].c_str()); |
---|
| 1218 | if( m_acLayerCfg[layer].m_numActiveRefLayers > 0 ) |
---|
| 1219 | { |
---|
| 1220 | char *refLayerId; |
---|
| 1221 | int i=0; |
---|
| 1222 | m_acLayerCfg[layer].m_predLayerIds = new Int[m_acLayerCfg[layer].m_numActiveRefLayers]; |
---|
| 1223 | refLayerId = strtok(pPredLayerIds, " ,-"); |
---|
| 1224 | while(refLayerId != NULL) |
---|
| 1225 | { |
---|
| 1226 | if( i >= m_acLayerCfg[layer].m_numActiveRefLayers ) |
---|
| 1227 | { |
---|
| 1228 | printf( "NumActiveRefLayers: The number of columns whose width are defined is larger than the allowed number of columns.\n" ); |
---|
| 1229 | exit( EXIT_FAILURE ); |
---|
| 1230 | } |
---|
| 1231 | *( m_acLayerCfg[layer].m_predLayerIds + i ) = atoi( refLayerId ); |
---|
| 1232 | refLayerId = strtok(NULL, " ,-"); |
---|
| 1233 | i++; |
---|
| 1234 | } |
---|
| 1235 | if( i < m_acLayerCfg[layer].m_numActiveRefLayers ) |
---|
| 1236 | { |
---|
| 1237 | printf( "NumActiveRefLayers: The width of some columns is not defined.\n" ); |
---|
| 1238 | exit( EXIT_FAILURE ); |
---|
| 1239 | } |
---|
| 1240 | } |
---|
| 1241 | else |
---|
| 1242 | { |
---|
| 1243 | m_acLayerCfg[layer].m_predLayerIds = NULL; |
---|
| 1244 | } |
---|
| 1245 | } |
---|
| 1246 | #endif |
---|
[467] | 1247 | #endif //SVC_EXTENSION |
---|
[313] | 1248 | m_scalingListFile = cfg_ScalingListFile.empty() ? NULL : strdup(cfg_ScalingListFile.c_str()); |
---|
[442] | 1249 | |
---|
[313] | 1250 | /* rules for input, output and internal bitdepths as per help text */ |
---|
[466] | 1251 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
[468] | 1252 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 1253 | { |
---|
[466] | 1254 | if (!m_acLayerCfg[layer].m_internalBitDepthY) { m_acLayerCfg[layer].m_internalBitDepthY = m_acLayerCfg[layer].m_inputBitDepthY; } |
---|
| 1255 | if (!m_acLayerCfg[layer].m_internalBitDepthC) { m_acLayerCfg[layer].m_internalBitDepthC = m_acLayerCfg[layer].m_internalBitDepthY; } |
---|
| 1256 | if (!m_acLayerCfg[layer].m_inputBitDepthC) { m_acLayerCfg[layer].m_inputBitDepthC = m_acLayerCfg[layer].m_inputBitDepthY; } |
---|
| 1257 | if (!m_acLayerCfg[layer].m_outputBitDepthY) { m_acLayerCfg[layer].m_outputBitDepthY = m_acLayerCfg[layer].m_internalBitDepthY; } |
---|
| 1258 | if (!m_acLayerCfg[layer].m_outputBitDepthC) { m_acLayerCfg[layer].m_outputBitDepthC = m_acLayerCfg[layer].m_internalBitDepthC; } |
---|
| 1259 | } |
---|
| 1260 | #else |
---|
[313] | 1261 | if (!m_internalBitDepthY) { m_internalBitDepthY = m_inputBitDepthY; } |
---|
| 1262 | if (!m_internalBitDepthC) { m_internalBitDepthC = m_internalBitDepthY; } |
---|
| 1263 | if (!m_inputBitDepthC) { m_inputBitDepthC = m_inputBitDepthY; } |
---|
| 1264 | if (!m_outputBitDepthY) { m_outputBitDepthY = m_internalBitDepthY; } |
---|
| 1265 | if (!m_outputBitDepthC) { m_outputBitDepthC = m_internalBitDepthC; } |
---|
[466] | 1266 | #endif |
---|
[313] | 1267 | |
---|
| 1268 | #if !SVC_EXTENSION |
---|
| 1269 | // TODO:ChromaFmt assumes 4:2:0 below |
---|
| 1270 | switch (m_conformanceMode) |
---|
| 1271 | { |
---|
| 1272 | case 0: |
---|
| 1273 | { |
---|
| 1274 | // no conformance or padding |
---|
| 1275 | m_confLeft = m_confRight = m_confTop = m_confBottom = 0; |
---|
| 1276 | m_aiPad[1] = m_aiPad[0] = 0; |
---|
| 1277 | break; |
---|
| 1278 | } |
---|
| 1279 | case 1: |
---|
| 1280 | { |
---|
| 1281 | // automatic padding to minimum CU size |
---|
| 1282 | Int minCuSize = m_uiMaxCUHeight >> (m_uiMaxCUDepth - 1); |
---|
| 1283 | if (m_iSourceWidth % minCuSize) |
---|
| 1284 | { |
---|
| 1285 | m_aiPad[0] = m_confRight = ((m_iSourceWidth / minCuSize) + 1) * minCuSize - m_iSourceWidth; |
---|
| 1286 | m_iSourceWidth += m_confRight; |
---|
| 1287 | } |
---|
| 1288 | if (m_iSourceHeight % minCuSize) |
---|
| 1289 | { |
---|
| 1290 | m_aiPad[1] = m_confBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight; |
---|
| 1291 | m_iSourceHeight += m_confBottom; |
---|
[442] | 1292 | if ( m_isField ) |
---|
| 1293 | { |
---|
| 1294 | m_iSourceHeightOrg += m_confBottom << 1; |
---|
| 1295 | m_aiPad[1] = m_confBottom << 1; |
---|
| 1296 | } |
---|
[313] | 1297 | } |
---|
| 1298 | if (m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0) |
---|
| 1299 | { |
---|
| 1300 | fprintf(stderr, "Error: picture width is not an integer multiple of the specified chroma subsampling\n"); |
---|
| 1301 | exit(EXIT_FAILURE); |
---|
| 1302 | } |
---|
| 1303 | if (m_aiPad[1] % TComSPS::getWinUnitY(CHROMA_420) != 0) |
---|
| 1304 | { |
---|
| 1305 | fprintf(stderr, "Error: picture height is not an integer multiple of the specified chroma subsampling\n"); |
---|
| 1306 | exit(EXIT_FAILURE); |
---|
| 1307 | } |
---|
| 1308 | break; |
---|
| 1309 | } |
---|
| 1310 | case 2: |
---|
| 1311 | { |
---|
| 1312 | //padding |
---|
| 1313 | m_iSourceWidth += m_aiPad[0]; |
---|
| 1314 | m_iSourceHeight += m_aiPad[1]; |
---|
| 1315 | m_confRight = m_aiPad[0]; |
---|
| 1316 | m_confBottom = m_aiPad[1]; |
---|
| 1317 | break; |
---|
| 1318 | } |
---|
| 1319 | case 3: |
---|
| 1320 | { |
---|
| 1321 | // conformance |
---|
| 1322 | if ((m_confLeft == 0) && (m_confRight == 0) && (m_confTop == 0) && (m_confBottom == 0)) |
---|
| 1323 | { |
---|
| 1324 | fprintf(stderr, "Warning: Conformance window enabled, but all conformance window parameters set to zero\n"); |
---|
| 1325 | } |
---|
| 1326 | if ((m_aiPad[1] != 0) || (m_aiPad[0]!=0)) |
---|
| 1327 | { |
---|
| 1328 | fprintf(stderr, "Warning: Conformance window enabled, padding parameters will be ignored\n"); |
---|
| 1329 | } |
---|
| 1330 | m_aiPad[1] = m_aiPad[0] = 0; |
---|
| 1331 | break; |
---|
| 1332 | } |
---|
| 1333 | } |
---|
| 1334 | |
---|
| 1335 | // allocate slice-based dQP values |
---|
| 1336 | m_aidQP = new Int[ m_framesToBeEncoded + m_iGOPSize + 1 ]; |
---|
| 1337 | ::memset( m_aidQP, 0, sizeof(Int)*( m_framesToBeEncoded + m_iGOPSize + 1 ) ); |
---|
| 1338 | |
---|
| 1339 | // handling of floating-point QP values |
---|
| 1340 | // if QP is not integer, sequence is split into two sections having QP and QP+1 |
---|
| 1341 | m_iQP = (Int)( m_fQP ); |
---|
| 1342 | if ( m_iQP < m_fQP ) |
---|
| 1343 | { |
---|
| 1344 | Int iSwitchPOC = (Int)( m_framesToBeEncoded - (m_fQP - m_iQP)*m_framesToBeEncoded + 0.5 ); |
---|
| 1345 | |
---|
| 1346 | iSwitchPOC = (Int)( (Double)iSwitchPOC / m_iGOPSize + 0.5 )*m_iGOPSize; |
---|
| 1347 | for ( Int i=iSwitchPOC; i<m_framesToBeEncoded + m_iGOPSize + 1; i++ ) |
---|
| 1348 | { |
---|
| 1349 | m_aidQP[i] = 1; |
---|
| 1350 | } |
---|
| 1351 | } |
---|
| 1352 | |
---|
| 1353 | // reading external dQP description from file |
---|
| 1354 | if ( m_pchdQPFile ) |
---|
| 1355 | { |
---|
| 1356 | FILE* fpt=fopen( m_pchdQPFile, "r" ); |
---|
| 1357 | if ( fpt ) |
---|
| 1358 | { |
---|
| 1359 | Int iValue; |
---|
| 1360 | Int iPOC = 0; |
---|
| 1361 | while ( iPOC < m_framesToBeEncoded ) |
---|
| 1362 | { |
---|
| 1363 | if ( fscanf(fpt, "%d", &iValue ) == EOF ) break; |
---|
| 1364 | m_aidQP[ iPOC ] = iValue; |
---|
| 1365 | iPOC++; |
---|
| 1366 | } |
---|
| 1367 | fclose(fpt); |
---|
| 1368 | } |
---|
| 1369 | } |
---|
| 1370 | m_iWaveFrontSubstreams = m_iWaveFrontSynchro ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1; |
---|
| 1371 | #endif |
---|
| 1372 | if( m_toneMappingInfoSEIEnabled && !m_toneMapCancelFlag ) |
---|
| 1373 | { |
---|
| 1374 | Char* pcStartOfCodedInterval = cfg_startOfCodedInterval.empty() ? NULL: strdup(cfg_startOfCodedInterval.c_str()); |
---|
| 1375 | Char* pcCodedPivotValue = cfg_codedPivotValue.empty() ? NULL: strdup(cfg_codedPivotValue.c_str()); |
---|
| 1376 | Char* pcTargetPivotValue = cfg_targetPivotValue.empty() ? NULL: strdup(cfg_targetPivotValue.c_str()); |
---|
| 1377 | if( m_toneMapModelId == 2 && pcStartOfCodedInterval ) |
---|
| 1378 | { |
---|
| 1379 | char *startOfCodedInterval; |
---|
| 1380 | UInt num = 1u<< m_toneMapTargetBitDepth; |
---|
| 1381 | m_startOfCodedInterval = new Int[num]; |
---|
| 1382 | ::memset( m_startOfCodedInterval, 0, sizeof(Int)*num ); |
---|
| 1383 | startOfCodedInterval = strtok(pcStartOfCodedInterval, " ."); |
---|
| 1384 | int i = 0; |
---|
| 1385 | while( startOfCodedInterval && ( i < num ) ) |
---|
| 1386 | { |
---|
| 1387 | m_startOfCodedInterval[i] = atoi( startOfCodedInterval ); |
---|
| 1388 | startOfCodedInterval = strtok(NULL, " ."); |
---|
| 1389 | i++; |
---|
| 1390 | } |
---|
| 1391 | } |
---|
| 1392 | else |
---|
| 1393 | { |
---|
| 1394 | m_startOfCodedInterval = NULL; |
---|
| 1395 | } |
---|
| 1396 | if( ( m_toneMapModelId == 3 ) && ( m_numPivots > 0 ) ) |
---|
| 1397 | { |
---|
| 1398 | if( pcCodedPivotValue && pcTargetPivotValue ) |
---|
| 1399 | { |
---|
| 1400 | char *codedPivotValue; |
---|
| 1401 | char *targetPivotValue; |
---|
| 1402 | m_codedPivotValue = new Int[m_numPivots]; |
---|
| 1403 | m_targetPivotValue = new Int[m_numPivots]; |
---|
| 1404 | ::memset( m_codedPivotValue, 0, sizeof(Int)*( m_numPivots ) ); |
---|
| 1405 | ::memset( m_targetPivotValue, 0, sizeof(Int)*( m_numPivots ) ); |
---|
| 1406 | codedPivotValue = strtok(pcCodedPivotValue, " ."); |
---|
| 1407 | int i=0; |
---|
| 1408 | while(codedPivotValue&&i<m_numPivots) |
---|
| 1409 | { |
---|
| 1410 | m_codedPivotValue[i] = atoi( codedPivotValue ); |
---|
| 1411 | codedPivotValue = strtok(NULL, " ."); |
---|
| 1412 | i++; |
---|
| 1413 | } |
---|
| 1414 | i=0; |
---|
| 1415 | targetPivotValue = strtok(pcTargetPivotValue, " ."); |
---|
| 1416 | while(targetPivotValue&&i<m_numPivots) |
---|
| 1417 | { |
---|
| 1418 | m_targetPivotValue[i]= atoi( targetPivotValue ); |
---|
| 1419 | targetPivotValue = strtok(NULL, " ."); |
---|
| 1420 | i++; |
---|
| 1421 | } |
---|
| 1422 | } |
---|
| 1423 | } |
---|
| 1424 | else |
---|
| 1425 | { |
---|
| 1426 | m_codedPivotValue = NULL; |
---|
| 1427 | m_targetPivotValue = NULL; |
---|
| 1428 | } |
---|
| 1429 | } |
---|
[442] | 1430 | #if N0383_IL_CONSTRAINED_TILE_SETS_SEI |
---|
| 1431 | if (m_interLayerConstrainedTileSetsSEIEnabled) |
---|
| 1432 | { |
---|
| 1433 | if (m_iNumColumnsMinus1 == 0 && m_iNumRowsMinus1 == 0) |
---|
| 1434 | { |
---|
| 1435 | printf( "Tiles are not defined (needed for inter-layer comnstrained tile sets SEI).\n" ); |
---|
| 1436 | exit( EXIT_FAILURE ); |
---|
| 1437 | } |
---|
| 1438 | Char* pTileSets = cfg_tileSets.empty() ? NULL : strdup(cfg_tileSets.c_str()); |
---|
| 1439 | int i = 0; |
---|
| 1440 | char *topLeftTileIndex = strtok(pTileSets, " ,"); |
---|
| 1441 | while(topLeftTileIndex != NULL) |
---|
| 1442 | { |
---|
| 1443 | if( i >= m_ilNumSetsInMessage ) |
---|
| 1444 | { |
---|
| 1445 | printf( "The number of tile sets is larger than defined by IlNumSetsInMessage.\n" ); |
---|
| 1446 | exit( EXIT_FAILURE ); |
---|
| 1447 | } |
---|
| 1448 | *( m_topLeftTileIndex + i ) = atoi( topLeftTileIndex ); |
---|
| 1449 | char *bottonRightTileIndex = strtok(NULL, " ,"); |
---|
| 1450 | if( bottonRightTileIndex == NULL ) |
---|
| 1451 | { |
---|
| 1452 | printf( "BottonRightTileIndex is missing in the tile sets.\n" ); |
---|
| 1453 | exit( EXIT_FAILURE ); |
---|
| 1454 | } |
---|
| 1455 | *( m_bottomRightTileIndex + i ) = atoi( bottonRightTileIndex ); |
---|
| 1456 | char *ilcIdc = strtok(NULL, " ,"); |
---|
| 1457 | if( ilcIdc == NULL ) |
---|
| 1458 | { |
---|
| 1459 | printf( "IlcIdc is missing in the tile sets.\n" ); |
---|
| 1460 | exit( EXIT_FAILURE ); |
---|
| 1461 | } |
---|
| 1462 | *( m_ilcIdc + i ) = atoi( ilcIdc ); |
---|
| 1463 | topLeftTileIndex = strtok(NULL, " ,"); |
---|
| 1464 | i++; |
---|
| 1465 | } |
---|
| 1466 | if( i < m_ilNumSetsInMessage ) |
---|
| 1467 | { |
---|
| 1468 | printf( "The number of tile sets is smaller than defined by IlNumSetsInMessage.\n" ); |
---|
| 1469 | exit( EXIT_FAILURE ); |
---|
| 1470 | } |
---|
| 1471 | m_skippedTileSetPresentFlag = false; |
---|
| 1472 | } |
---|
| 1473 | #endif |
---|
[313] | 1474 | // check validity of input parameters |
---|
| 1475 | xCheckParameter(); |
---|
| 1476 | |
---|
| 1477 | // set global varibles |
---|
[467] | 1478 | #if LAYER_CTB |
---|
| 1479 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 1480 | { |
---|
| 1481 | xSetGlobal(layer); |
---|
| 1482 | } |
---|
| 1483 | #else |
---|
[313] | 1484 | xSetGlobal(); |
---|
[467] | 1485 | #endif |
---|
[313] | 1486 | |
---|
| 1487 | // print-out parameters |
---|
| 1488 | xPrintParameter(); |
---|
| 1489 | |
---|
| 1490 | return true; |
---|
| 1491 | } |
---|
| 1492 | // ==================================================================================================================== |
---|
| 1493 | // Private member functions |
---|
| 1494 | // ==================================================================================================================== |
---|
| 1495 | |
---|
| 1496 | Bool confirmPara(Bool bflag, const Char* message); |
---|
| 1497 | |
---|
| 1498 | Void TAppEncCfg::xCheckParameter() |
---|
| 1499 | { |
---|
| 1500 | if (!m_decodedPictureHashSEIEnabled) |
---|
| 1501 | { |
---|
| 1502 | fprintf(stderr, "******************************************************************\n"); |
---|
| 1503 | fprintf(stderr, "** WARNING: --SEIDecodedPictureHash is now disabled by default. **\n"); |
---|
| 1504 | fprintf(stderr, "** Automatic verification of decoded pictures by a **\n"); |
---|
| 1505 | fprintf(stderr, "** decoder requires this option to be enabled. **\n"); |
---|
| 1506 | fprintf(stderr, "******************************************************************\n"); |
---|
| 1507 | } |
---|
| 1508 | if( m_profile==Profile::NONE ) |
---|
| 1509 | { |
---|
| 1510 | fprintf(stderr, "***************************************************************************\n"); |
---|
| 1511 | fprintf(stderr, "** WARNING: For conforming bitstreams a valid Profile value must be set! **\n"); |
---|
| 1512 | fprintf(stderr, "***************************************************************************\n"); |
---|
| 1513 | } |
---|
| 1514 | if( m_level==Level::NONE ) |
---|
| 1515 | { |
---|
| 1516 | fprintf(stderr, "***************************************************************************\n"); |
---|
| 1517 | fprintf(stderr, "** WARNING: For conforming bitstreams a valid Level value must be set! **\n"); |
---|
| 1518 | fprintf(stderr, "***************************************************************************\n"); |
---|
| 1519 | } |
---|
| 1520 | |
---|
| 1521 | Bool check_failed = false; /* abort if there is a fatal configuration problem */ |
---|
| 1522 | #define xConfirmPara(a,b) check_failed |= confirmPara(a,b) |
---|
| 1523 | // check range of parameters |
---|
[466] | 1524 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
[468] | 1525 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
| 1526 | { |
---|
[466] | 1527 | xConfirmPara( m_acLayerCfg[layer].m_inputBitDepthY < 8, "InputBitDepth must be at least 8" ); |
---|
| 1528 | xConfirmPara( m_acLayerCfg[layer].m_inputBitDepthC < 8, "InputBitDepthC must be at least 8" ); |
---|
| 1529 | } |
---|
| 1530 | #else |
---|
[313] | 1531 | xConfirmPara( m_inputBitDepthY < 8, "InputBitDepth must be at least 8" ); |
---|
| 1532 | xConfirmPara( m_inputBitDepthC < 8, "InputBitDepthC must be at least 8" ); |
---|
[466] | 1533 | #endif |
---|
[313] | 1534 | #if !SVC_EXTENSION |
---|
| 1535 | xConfirmPara( m_iFrameRate <= 0, "Frame rate must be more than 1" ); |
---|
| 1536 | #endif |
---|
| 1537 | xConfirmPara( m_framesToBeEncoded <= 0, "Total Number Of Frames encoded must be more than 0" ); |
---|
| 1538 | xConfirmPara( m_iGOPSize < 1 , "GOP Size must be greater or equal to 1" ); |
---|
| 1539 | xConfirmPara( m_iGOPSize > 1 && m_iGOPSize % 2, "GOP Size must be a multiple of 2, if GOP Size is greater than 1" ); |
---|
| 1540 | #if !SVC_EXTENSION |
---|
| 1541 | xConfirmPara( (m_iIntraPeriod > 0 && m_iIntraPeriod < m_iGOPSize) || m_iIntraPeriod == 0, "Intra period must be more than GOP size, or -1 , not 0" ); |
---|
| 1542 | #endif |
---|
| 1543 | xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 2, "Decoding Refresh Type must be equal to 0, 1 or 2" ); |
---|
| 1544 | #if !SVC_EXTENSION |
---|
| 1545 | xConfirmPara( m_iQP < -6 * (m_internalBitDepthY - 8) || m_iQP > 51, "QP exceeds supported range (-QpBDOffsety to 51)" ); |
---|
| 1546 | #endif |
---|
| 1547 | xConfirmPara( m_loopFilterBetaOffsetDiv2 < -6 || m_loopFilterBetaOffsetDiv2 > 6, "Loop Filter Beta Offset div. 2 exceeds supported range (-6 to 6)"); |
---|
| 1548 | xConfirmPara( m_loopFilterTcOffsetDiv2 < -6 || m_loopFilterTcOffsetDiv2 > 6, "Loop Filter Tc Offset div. 2 exceeds supported range (-6 to 6)"); |
---|
| 1549 | xConfirmPara( m_iFastSearch < 0 || m_iFastSearch > 2, "Fast Search Mode is not supported value (0:Full search 1:Diamond 2:PMVFAST)" ); |
---|
| 1550 | xConfirmPara( m_iSearchRange < 0 , "Search Range must be more than 0" ); |
---|
| 1551 | xConfirmPara( m_bipredSearchRange < 0 , "Search Range must be more than 0" ); |
---|
| 1552 | xConfirmPara( m_iMaxDeltaQP > 7, "Absolute Delta QP exceeds supported range (0 to 7)" ); |
---|
[467] | 1553 | #if LAYER_CTB |
---|
| 1554 | for(UInt layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 1555 | { |
---|
| 1556 | xConfirmPara( m_iMaxCuDQPDepth > m_acLayerCfg[layer].m_uiMaxCUDepth - 1, "Absolute depth for a minimum CuDQP exceeds maximum coding unit depth" ); |
---|
| 1557 | } |
---|
| 1558 | #else |
---|
[313] | 1559 | xConfirmPara( m_iMaxCuDQPDepth > m_uiMaxCUDepth - 1, "Absolute depth for a minimum CuDQP exceeds maximum coding unit depth" ); |
---|
[467] | 1560 | #endif |
---|
[313] | 1561 | |
---|
| 1562 | xConfirmPara( m_cbQpOffset < -12, "Min. Chroma Cb QP Offset is -12" ); |
---|
| 1563 | xConfirmPara( m_cbQpOffset > 12, "Max. Chroma Cb QP Offset is 12" ); |
---|
| 1564 | xConfirmPara( m_crQpOffset < -12, "Min. Chroma Cr QP Offset is -12" ); |
---|
| 1565 | xConfirmPara( m_crQpOffset > 12, "Max. Chroma Cr QP Offset is 12" ); |
---|
| 1566 | |
---|
| 1567 | xConfirmPara( m_iQPAdaptationRange <= 0, "QP Adaptation Range must be more than 0" ); |
---|
| 1568 | #if !SVC_EXTENSION |
---|
| 1569 | if (m_iDecodingRefreshType == 2) |
---|
| 1570 | { |
---|
| 1571 | xConfirmPara( m_iIntraPeriod > 0 && m_iIntraPeriod <= m_iGOPSize , "Intra period must be larger than GOP size for periodic IDR pictures"); |
---|
| 1572 | } |
---|
| 1573 | #endif |
---|
[467] | 1574 | #if !LAYER_CTB |
---|
[313] | 1575 | xConfirmPara( (m_uiMaxCUWidth >> m_uiMaxCUDepth) < 4, "Minimum partition width size should be larger than or equal to 8"); |
---|
| 1576 | xConfirmPara( (m_uiMaxCUHeight >> m_uiMaxCUDepth) < 4, "Minimum partition height size should be larger than or equal to 8"); |
---|
| 1577 | xConfirmPara( m_uiMaxCUWidth < 16, "Maximum partition width size should be larger than or equal to 16"); |
---|
| 1578 | xConfirmPara( m_uiMaxCUHeight < 16, "Maximum partition height size should be larger than or equal to 16"); |
---|
[467] | 1579 | #endif |
---|
[313] | 1580 | #if !SVC_EXTENSION |
---|
| 1581 | xConfirmPara( (m_iSourceWidth % (m_uiMaxCUWidth >> (m_uiMaxCUDepth-1)))!=0, "Resulting coded frame width must be a multiple of the minimum CU size"); |
---|
| 1582 | xConfirmPara( (m_iSourceHeight % (m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)))!=0, "Resulting coded frame height must be a multiple of the minimum CU size"); |
---|
| 1583 | #endif |
---|
| 1584 | |
---|
[467] | 1585 | #if !LAYER_CTB |
---|
[313] | 1586 | xConfirmPara( m_uiQuadtreeTULog2MinSize < 2, "QuadtreeTULog2MinSize must be 2 or greater."); |
---|
| 1587 | xConfirmPara( m_uiQuadtreeTULog2MaxSize > 5, "QuadtreeTULog2MaxSize must be 5 or smaller."); |
---|
| 1588 | xConfirmPara( (1<<m_uiQuadtreeTULog2MaxSize) > m_uiMaxCUWidth, "QuadtreeTULog2MaxSize must be log2(maxCUSize) or smaller."); |
---|
| 1589 | |
---|
| 1590 | xConfirmPara( m_uiQuadtreeTULog2MaxSize < m_uiQuadtreeTULog2MinSize, "QuadtreeTULog2MaxSize must be greater than or equal to m_uiQuadtreeTULog2MinSize."); |
---|
| 1591 | xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUWidth >>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS |
---|
| 1592 | xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUHeight>>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS |
---|
| 1593 | xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUWidth >> m_uiMaxCUDepth ), "Minimum CU width must be greater than minimum transform size." ); |
---|
| 1594 | xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUHeight >> m_uiMaxCUDepth ), "Minimum CU height must be greater than minimum transform size." ); |
---|
| 1595 | xConfirmPara( m_uiQuadtreeTUMaxDepthInter < 1, "QuadtreeTUMaxDepthInter must be greater than or equal to 1" ); |
---|
| 1596 | 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" ); |
---|
| 1597 | xConfirmPara( m_uiQuadtreeTUMaxDepthIntra < 1, "QuadtreeTUMaxDepthIntra must be greater than or equal to 1" ); |
---|
| 1598 | 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" ); |
---|
[467] | 1599 | #endif |
---|
[313] | 1600 | |
---|
| 1601 | xConfirmPara( m_maxNumMergeCand < 1, "MaxNumMergeCand must be 1 or greater."); |
---|
| 1602 | xConfirmPara( m_maxNumMergeCand > 5, "MaxNumMergeCand must be 5 or smaller."); |
---|
| 1603 | |
---|
| 1604 | #if !SVC_EXTENSION |
---|
| 1605 | #if ADAPTIVE_QP_SELECTION |
---|
| 1606 | xConfirmPara( m_bUseAdaptQpSelect == true && m_iQP < 0, "AdaptiveQpSelection must be disabled when QP < 0."); |
---|
| 1607 | xConfirmPara( m_bUseAdaptQpSelect == true && (m_cbQpOffset !=0 || m_crQpOffset != 0 ), "AdaptiveQpSelection must be disabled when ChromaQpOffset is not equal to 0."); |
---|
| 1608 | #endif |
---|
| 1609 | #endif |
---|
| 1610 | |
---|
| 1611 | if( m_usePCM) |
---|
| 1612 | { |
---|
| 1613 | xConfirmPara( m_uiPCMLog2MinSize < 3, "PCMLog2MinSize must be 3 or greater."); |
---|
| 1614 | xConfirmPara( m_uiPCMLog2MinSize > 5, "PCMLog2MinSize must be 5 or smaller."); |
---|
| 1615 | xConfirmPara( m_pcmLog2MaxSize > 5, "PCMLog2MaxSize must be 5 or smaller."); |
---|
| 1616 | xConfirmPara( m_pcmLog2MaxSize < m_uiPCMLog2MinSize, "PCMLog2MaxSize must be equal to or greater than m_uiPCMLog2MinSize."); |
---|
| 1617 | } |
---|
| 1618 | |
---|
| 1619 | xConfirmPara( m_sliceMode < 0 || m_sliceMode > 3, "SliceMode exceeds supported range (0 to 3)" ); |
---|
| 1620 | if (m_sliceMode!=0) |
---|
| 1621 | { |
---|
| 1622 | xConfirmPara( m_sliceArgument < 1 , "SliceArgument should be larger than or equal to 1" ); |
---|
| 1623 | } |
---|
| 1624 | xConfirmPara( m_sliceSegmentMode < 0 || m_sliceSegmentMode > 3, "SliceSegmentMode exceeds supported range (0 to 3)" ); |
---|
| 1625 | if (m_sliceSegmentMode!=0) |
---|
| 1626 | { |
---|
| 1627 | xConfirmPara( m_sliceSegmentArgument < 1 , "SliceSegmentArgument should be larger than or equal to 1" ); |
---|
| 1628 | } |
---|
| 1629 | |
---|
| 1630 | Bool tileFlag = (m_iNumColumnsMinus1 > 0 || m_iNumRowsMinus1 > 0 ); |
---|
| 1631 | xConfirmPara( tileFlag && m_iWaveFrontSynchro, "Tile and Wavefront can not be applied together"); |
---|
| 1632 | |
---|
| 1633 | //TODO:ChromaFmt assumes 4:2:0 below |
---|
| 1634 | #if !SVC_EXTENSION |
---|
| 1635 | xConfirmPara( m_iSourceWidth % TComSPS::getWinUnitX(CHROMA_420) != 0, "Picture width must be an integer multiple of the specified chroma subsampling"); |
---|
| 1636 | xConfirmPara( m_iSourceHeight % TComSPS::getWinUnitY(CHROMA_420) != 0, "Picture height must be an integer multiple of the specified chroma subsampling"); |
---|
| 1637 | |
---|
| 1638 | xConfirmPara( m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0, "Horizontal padding must be an integer multiple of the specified chroma subsampling"); |
---|
| 1639 | xConfirmPara( m_aiPad[1] % TComSPS::getWinUnitY(CHROMA_420) != 0, "Vertical padding must be an integer multiple of the specified chroma subsampling"); |
---|
| 1640 | |
---|
| 1641 | xConfirmPara( m_confLeft % TComSPS::getWinUnitX(CHROMA_420) != 0, "Left conformance window offset must be an integer multiple of the specified chroma subsampling"); |
---|
| 1642 | xConfirmPara( m_confRight % TComSPS::getWinUnitX(CHROMA_420) != 0, "Right conformance window offset must be an integer multiple of the specified chroma subsampling"); |
---|
| 1643 | xConfirmPara( m_confTop % TComSPS::getWinUnitY(CHROMA_420) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling"); |
---|
| 1644 | xConfirmPara( m_confBottom % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling"); |
---|
| 1645 | #endif |
---|
| 1646 | |
---|
[467] | 1647 | #if !LAYER_CTB |
---|
[313] | 1648 | // max CU width and height should be power of 2 |
---|
| 1649 | UInt ui = m_uiMaxCUWidth; |
---|
| 1650 | while(ui) |
---|
| 1651 | { |
---|
| 1652 | ui >>= 1; |
---|
| 1653 | if( (ui & 1) == 1) |
---|
| 1654 | xConfirmPara( ui != 1 , "Width should be 2^n"); |
---|
| 1655 | } |
---|
| 1656 | ui = m_uiMaxCUHeight; |
---|
| 1657 | while(ui) |
---|
| 1658 | { |
---|
| 1659 | ui >>= 1; |
---|
| 1660 | if( (ui & 1) == 1) |
---|
| 1661 | xConfirmPara( ui != 1 , "Height should be 2^n"); |
---|
| 1662 | } |
---|
[467] | 1663 | #endif |
---|
[313] | 1664 | |
---|
| 1665 | /* if this is an intra-only sequence, ie IntraPeriod=1, don't verify the GOP structure |
---|
| 1666 | * This permits the ability to omit a GOP structure specification */ |
---|
| 1667 | #if SVC_EXTENSION |
---|
| 1668 | for(UInt layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 1669 | { |
---|
| 1670 | Int m_iIntraPeriod = m_acLayerCfg[layer].m_iIntraPeriod; |
---|
| 1671 | #endif |
---|
| 1672 | if (m_iIntraPeriod == 1 && m_GOPList[0].m_POC == -1) { |
---|
| 1673 | m_GOPList[0] = GOPEntry(); |
---|
| 1674 | m_GOPList[0].m_QPFactor = 1; |
---|
| 1675 | m_GOPList[0].m_betaOffsetDiv2 = 0; |
---|
| 1676 | m_GOPList[0].m_tcOffsetDiv2 = 0; |
---|
| 1677 | m_GOPList[0].m_POC = 1; |
---|
| 1678 | m_GOPList[0].m_numRefPicsActive = 4; |
---|
| 1679 | } |
---|
| 1680 | #if SVC_EXTENSION |
---|
| 1681 | } |
---|
| 1682 | #endif |
---|
| 1683 | |
---|
[471] | 1684 | |
---|
[313] | 1685 | Bool verifiedGOP=false; |
---|
| 1686 | Bool errorGOP=false; |
---|
| 1687 | Int checkGOP=1; |
---|
[442] | 1688 | Int numRefs = m_isField ? 2 : 1; |
---|
[313] | 1689 | Int refList[MAX_NUM_REF_PICS+1]; |
---|
| 1690 | refList[0]=0; |
---|
[442] | 1691 | if(m_isField) |
---|
| 1692 | { |
---|
| 1693 | refList[1] = 1; |
---|
| 1694 | } |
---|
[313] | 1695 | Bool isOK[MAX_GOP]; |
---|
| 1696 | for(Int i=0; i<MAX_GOP; i++) |
---|
| 1697 | { |
---|
| 1698 | isOK[i]=false; |
---|
| 1699 | } |
---|
| 1700 | Int numOK=0; |
---|
| 1701 | #if !SVC_EXTENSION |
---|
| 1702 | xConfirmPara( m_iIntraPeriod >=0&&(m_iIntraPeriod%m_iGOPSize!=0), "Intra period must be a multiple of GOPSize, or -1" ); |
---|
| 1703 | #endif |
---|
| 1704 | |
---|
| 1705 | for(Int i=0; i<m_iGOPSize; i++) |
---|
| 1706 | { |
---|
| 1707 | if(m_GOPList[i].m_POC==m_iGOPSize) |
---|
| 1708 | { |
---|
| 1709 | xConfirmPara( m_GOPList[i].m_temporalId!=0 , "The last frame in each GOP must have temporal ID = 0 " ); |
---|
| 1710 | } |
---|
| 1711 | } |
---|
| 1712 | |
---|
| 1713 | #if SVC_EXTENSION |
---|
| 1714 | xConfirmPara( m_numLayers > MAX_LAYERS , "Number of layers in config file is greater than MAX_LAYERS" ); |
---|
| 1715 | m_numLayers = m_numLayers > MAX_LAYERS ? MAX_LAYERS : m_numLayers; |
---|
| 1716 | |
---|
| 1717 | // verify layer configuration parameters |
---|
| 1718 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
| 1719 | { |
---|
[442] | 1720 | if(m_acLayerCfg[layer].xCheckParameter(m_isField)) |
---|
[313] | 1721 | { |
---|
| 1722 | printf("\nError: invalid configuration parameter found in layer %d \n", layer); |
---|
| 1723 | check_failed = true; |
---|
| 1724 | } |
---|
| 1725 | } |
---|
| 1726 | |
---|
| 1727 | // verify layer configuration parameters |
---|
| 1728 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
| 1729 | { |
---|
| 1730 | Int m_iIntraPeriod = m_acLayerCfg[layer].m_iIntraPeriod; |
---|
| 1731 | #endif |
---|
| 1732 | if ( (m_iIntraPeriod != 1) && !m_loopFilterOffsetInPPS && m_DeblockingFilterControlPresent && (!m_bLoopFilterDisable) ) |
---|
| 1733 | { |
---|
| 1734 | for(Int i=0; i<m_iGOPSize; i++) |
---|
| 1735 | { |
---|
| 1736 | 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)" ); |
---|
| 1737 | 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)" ); |
---|
| 1738 | } |
---|
| 1739 | } |
---|
| 1740 | #if SVC_EXTENSION |
---|
| 1741 | } |
---|
| 1742 | #endif |
---|
[471] | 1743 | |
---|
[313] | 1744 | m_extraRPSs=0; |
---|
| 1745 | //start looping through frames in coding order until we can verify that the GOP structure is correct. |
---|
| 1746 | while(!verifiedGOP&&!errorGOP) |
---|
| 1747 | { |
---|
| 1748 | Int curGOP = (checkGOP-1)%m_iGOPSize; |
---|
| 1749 | Int curPOC = ((checkGOP-1)/m_iGOPSize)*m_iGOPSize + m_GOPList[curGOP].m_POC; |
---|
| 1750 | if(m_GOPList[curGOP].m_POC<0) |
---|
| 1751 | { |
---|
| 1752 | printf("\nError: found fewer Reference Picture Sets than GOPSize\n"); |
---|
| 1753 | errorGOP=true; |
---|
| 1754 | } |
---|
| 1755 | else |
---|
| 1756 | { |
---|
| 1757 | //check that all reference pictures are available, or have a POC < 0 meaning they might be available in the next GOP. |
---|
| 1758 | Bool beforeI = false; |
---|
| 1759 | for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) |
---|
| 1760 | { |
---|
| 1761 | Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i]; |
---|
| 1762 | if(absPOC < 0) |
---|
| 1763 | { |
---|
| 1764 | beforeI=true; |
---|
| 1765 | } |
---|
| 1766 | else |
---|
| 1767 | { |
---|
| 1768 | Bool found=false; |
---|
| 1769 | for(Int j=0; j<numRefs; j++) |
---|
| 1770 | { |
---|
| 1771 | if(refList[j]==absPOC) |
---|
| 1772 | { |
---|
| 1773 | found=true; |
---|
| 1774 | for(Int k=0; k<m_iGOPSize; k++) |
---|
| 1775 | { |
---|
| 1776 | if(absPOC%m_iGOPSize == m_GOPList[k].m_POC%m_iGOPSize) |
---|
| 1777 | { |
---|
| 1778 | if(m_GOPList[k].m_temporalId==m_GOPList[curGOP].m_temporalId) |
---|
| 1779 | { |
---|
| 1780 | m_GOPList[k].m_refPic = true; |
---|
| 1781 | } |
---|
| 1782 | m_GOPList[curGOP].m_usedByCurrPic[i]=m_GOPList[k].m_temporalId<=m_GOPList[curGOP].m_temporalId; |
---|
| 1783 | } |
---|
| 1784 | } |
---|
| 1785 | } |
---|
| 1786 | } |
---|
| 1787 | if(!found) |
---|
| 1788 | { |
---|
| 1789 | printf("\nError: ref pic %d is not available for GOP frame %d\n",m_GOPList[curGOP].m_referencePics[i],curGOP+1); |
---|
| 1790 | errorGOP=true; |
---|
| 1791 | } |
---|
| 1792 | } |
---|
| 1793 | } |
---|
| 1794 | if(!beforeI&&!errorGOP) |
---|
| 1795 | { |
---|
| 1796 | //all ref frames were present |
---|
| 1797 | if(!isOK[curGOP]) |
---|
| 1798 | { |
---|
| 1799 | numOK++; |
---|
| 1800 | isOK[curGOP]=true; |
---|
| 1801 | if(numOK==m_iGOPSize) |
---|
| 1802 | { |
---|
| 1803 | verifiedGOP=true; |
---|
| 1804 | } |
---|
| 1805 | } |
---|
| 1806 | } |
---|
| 1807 | else |
---|
| 1808 | { |
---|
| 1809 | //create a new GOPEntry for this frame containing all the reference pictures that were available (POC > 0) |
---|
| 1810 | m_GOPList[m_iGOPSize+m_extraRPSs]=m_GOPList[curGOP]; |
---|
| 1811 | Int newRefs=0; |
---|
| 1812 | for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) |
---|
| 1813 | { |
---|
| 1814 | Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i]; |
---|
| 1815 | if(absPOC>=0) |
---|
| 1816 | { |
---|
| 1817 | m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[newRefs]=m_GOPList[curGOP].m_referencePics[i]; |
---|
| 1818 | m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[newRefs]=m_GOPList[curGOP].m_usedByCurrPic[i]; |
---|
| 1819 | newRefs++; |
---|
| 1820 | } |
---|
| 1821 | } |
---|
| 1822 | Int numPrefRefs = m_GOPList[curGOP].m_numRefPicsActive; |
---|
| 1823 | |
---|
| 1824 | for(Int offset = -1; offset>-checkGOP; offset--) |
---|
| 1825 | { |
---|
| 1826 | //step backwards in coding order and include any extra available pictures we might find useful to replace the ones with POC < 0. |
---|
| 1827 | Int offGOP = (checkGOP-1+offset)%m_iGOPSize; |
---|
| 1828 | Int offPOC = ((checkGOP-1+offset)/m_iGOPSize)*m_iGOPSize + m_GOPList[offGOP].m_POC; |
---|
| 1829 | if(offPOC>=0&&m_GOPList[offGOP].m_temporalId<=m_GOPList[curGOP].m_temporalId) |
---|
| 1830 | { |
---|
| 1831 | Bool newRef=false; |
---|
| 1832 | for(Int i=0; i<numRefs; i++) |
---|
| 1833 | { |
---|
| 1834 | if(refList[i]==offPOC) |
---|
| 1835 | { |
---|
| 1836 | newRef=true; |
---|
| 1837 | } |
---|
| 1838 | } |
---|
| 1839 | for(Int i=0; i<newRefs; i++) |
---|
| 1840 | { |
---|
| 1841 | if(m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[i]==offPOC-curPOC) |
---|
| 1842 | { |
---|
| 1843 | newRef=false; |
---|
| 1844 | } |
---|
| 1845 | } |
---|
| 1846 | if(newRef) |
---|
| 1847 | { |
---|
| 1848 | Int insertPoint=newRefs; |
---|
| 1849 | //this picture can be added, find appropriate place in list and insert it. |
---|
| 1850 | if(m_GOPList[offGOP].m_temporalId==m_GOPList[curGOP].m_temporalId) |
---|
| 1851 | { |
---|
| 1852 | m_GOPList[offGOP].m_refPic = true; |
---|
| 1853 | } |
---|
| 1854 | for(Int j=0; j<newRefs; j++) |
---|
| 1855 | { |
---|
| 1856 | if(m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]<offPOC-curPOC||m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]>0) |
---|
| 1857 | { |
---|
| 1858 | insertPoint = j; |
---|
| 1859 | break; |
---|
| 1860 | } |
---|
| 1861 | } |
---|
| 1862 | Int prev = offPOC-curPOC; |
---|
| 1863 | Int prevUsed = m_GOPList[offGOP].m_temporalId<=m_GOPList[curGOP].m_temporalId; |
---|
| 1864 | for(Int j=insertPoint; j<newRefs+1; j++) |
---|
| 1865 | { |
---|
| 1866 | Int newPrev = m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]; |
---|
| 1867 | Int newUsed = m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j]; |
---|
| 1868 | m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]=prev; |
---|
| 1869 | m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j]=prevUsed; |
---|
| 1870 | prevUsed=newUsed; |
---|
| 1871 | prev=newPrev; |
---|
| 1872 | } |
---|
| 1873 | newRefs++; |
---|
| 1874 | } |
---|
| 1875 | } |
---|
| 1876 | if(newRefs>=numPrefRefs) |
---|
| 1877 | { |
---|
| 1878 | break; |
---|
| 1879 | } |
---|
| 1880 | } |
---|
| 1881 | m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefPics=newRefs; |
---|
| 1882 | m_GOPList[m_iGOPSize+m_extraRPSs].m_POC = curPOC; |
---|
| 1883 | if (m_extraRPSs == 0) |
---|
| 1884 | { |
---|
| 1885 | m_GOPList[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 0; |
---|
| 1886 | m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefIdc = 0; |
---|
| 1887 | } |
---|
| 1888 | else |
---|
| 1889 | { |
---|
| 1890 | Int rIdx = m_iGOPSize + m_extraRPSs - 1; |
---|
| 1891 | Int refPOC = m_GOPList[rIdx].m_POC; |
---|
| 1892 | Int refPics = m_GOPList[rIdx].m_numRefPics; |
---|
| 1893 | Int newIdc=0; |
---|
| 1894 | for(Int i = 0; i<= refPics; i++) |
---|
| 1895 | { |
---|
| 1896 | Int deltaPOC = ((i != refPics)? m_GOPList[rIdx].m_referencePics[i] : 0); // check if the reference abs POC is >= 0 |
---|
| 1897 | Int absPOCref = refPOC+deltaPOC; |
---|
| 1898 | Int refIdc = 0; |
---|
| 1899 | for (Int j = 0; j < m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefPics; j++) |
---|
| 1900 | { |
---|
| 1901 | if ( (absPOCref - curPOC) == m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]) |
---|
| 1902 | { |
---|
| 1903 | if (m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j]) |
---|
| 1904 | { |
---|
| 1905 | refIdc = 1; |
---|
| 1906 | } |
---|
| 1907 | else |
---|
| 1908 | { |
---|
| 1909 | refIdc = 2; |
---|
| 1910 | } |
---|
| 1911 | } |
---|
| 1912 | } |
---|
| 1913 | m_GOPList[m_iGOPSize+m_extraRPSs].m_refIdc[newIdc]=refIdc; |
---|
| 1914 | newIdc++; |
---|
| 1915 | } |
---|
| 1916 | m_GOPList[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 1; |
---|
| 1917 | m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefIdc = newIdc; |
---|
| 1918 | m_GOPList[m_iGOPSize+m_extraRPSs].m_deltaRPS = refPOC - m_GOPList[m_iGOPSize+m_extraRPSs].m_POC; |
---|
| 1919 | } |
---|
| 1920 | curGOP=m_iGOPSize+m_extraRPSs; |
---|
| 1921 | m_extraRPSs++; |
---|
| 1922 | } |
---|
| 1923 | numRefs=0; |
---|
| 1924 | for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) |
---|
| 1925 | { |
---|
| 1926 | Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i]; |
---|
| 1927 | if(absPOC >= 0) |
---|
| 1928 | { |
---|
| 1929 | refList[numRefs]=absPOC; |
---|
| 1930 | numRefs++; |
---|
| 1931 | } |
---|
| 1932 | } |
---|
| 1933 | refList[numRefs]=curPOC; |
---|
| 1934 | numRefs++; |
---|
| 1935 | } |
---|
| 1936 | checkGOP++; |
---|
| 1937 | } |
---|
| 1938 | xConfirmPara(errorGOP,"Invalid GOP structure given"); |
---|
[471] | 1939 | |
---|
[313] | 1940 | m_maxTempLayer = 1; |
---|
| 1941 | for(Int i=0; i<m_iGOPSize; i++) |
---|
| 1942 | { |
---|
| 1943 | if(m_GOPList[i].m_temporalId >= m_maxTempLayer) |
---|
| 1944 | { |
---|
| 1945 | m_maxTempLayer = m_GOPList[i].m_temporalId+1; |
---|
| 1946 | } |
---|
| 1947 | xConfirmPara(m_GOPList[i].m_sliceType!='B'&&m_GOPList[i].m_sliceType!='P', "Slice type must be equal to B or P"); |
---|
| 1948 | } |
---|
| 1949 | for(Int i=0; i<MAX_TLAYER; i++) |
---|
| 1950 | { |
---|
| 1951 | m_numReorderPics[i] = 0; |
---|
| 1952 | m_maxDecPicBuffering[i] = 1; |
---|
| 1953 | } |
---|
| 1954 | for(Int i=0; i<m_iGOPSize; i++) |
---|
| 1955 | { |
---|
| 1956 | if(m_GOPList[i].m_numRefPics+1 > m_maxDecPicBuffering[m_GOPList[i].m_temporalId]) |
---|
| 1957 | { |
---|
| 1958 | m_maxDecPicBuffering[m_GOPList[i].m_temporalId] = m_GOPList[i].m_numRefPics + 1; |
---|
| 1959 | } |
---|
| 1960 | |
---|
| 1961 | Int highestDecodingNumberWithLowerPOC = 0; |
---|
| 1962 | for(Int j=0; j<m_iGOPSize; j++) |
---|
| 1963 | { |
---|
| 1964 | if(m_GOPList[j].m_POC <= m_GOPList[i].m_POC) |
---|
| 1965 | { |
---|
| 1966 | highestDecodingNumberWithLowerPOC = j; |
---|
| 1967 | } |
---|
| 1968 | } |
---|
| 1969 | Int numReorder = 0; |
---|
| 1970 | for(Int j=0; j<highestDecodingNumberWithLowerPOC; j++) |
---|
| 1971 | { |
---|
| 1972 | if(m_GOPList[j].m_temporalId <= m_GOPList[i].m_temporalId && |
---|
| 1973 | m_GOPList[j].m_POC > m_GOPList[i].m_POC) |
---|
| 1974 | { |
---|
| 1975 | numReorder++; |
---|
| 1976 | } |
---|
| 1977 | } |
---|
| 1978 | if(numReorder > m_numReorderPics[m_GOPList[i].m_temporalId]) |
---|
| 1979 | { |
---|
| 1980 | m_numReorderPics[m_GOPList[i].m_temporalId] = numReorder; |
---|
| 1981 | } |
---|
| 1982 | } |
---|
| 1983 | for(Int i=0; i<MAX_TLAYER-1; i++) |
---|
| 1984 | { |
---|
| 1985 | // a lower layer can not have higher value of m_numReorderPics than a higher layer |
---|
| 1986 | if(m_numReorderPics[i+1] < m_numReorderPics[i]) |
---|
| 1987 | { |
---|
| 1988 | m_numReorderPics[i+1] = m_numReorderPics[i]; |
---|
| 1989 | } |
---|
| 1990 | // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ] - 1, inclusive |
---|
| 1991 | if(m_numReorderPics[i] > m_maxDecPicBuffering[i] - 1) |
---|
| 1992 | { |
---|
| 1993 | m_maxDecPicBuffering[i] = m_numReorderPics[i] + 1; |
---|
| 1994 | } |
---|
| 1995 | // a lower layer can not have higher value of m_uiMaxDecPicBuffering than a higher layer |
---|
| 1996 | if(m_maxDecPicBuffering[i+1] < m_maxDecPicBuffering[i]) |
---|
| 1997 | { |
---|
| 1998 | m_maxDecPicBuffering[i+1] = m_maxDecPicBuffering[i]; |
---|
| 1999 | } |
---|
| 2000 | } |
---|
| 2001 | |
---|
| 2002 | |
---|
| 2003 | // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ] - 1, inclusive |
---|
| 2004 | if(m_numReorderPics[MAX_TLAYER-1] > m_maxDecPicBuffering[MAX_TLAYER-1] - 1) |
---|
| 2005 | { |
---|
| 2006 | m_maxDecPicBuffering[MAX_TLAYER-1] = m_numReorderPics[MAX_TLAYER-1] + 1; |
---|
| 2007 | } |
---|
| 2008 | |
---|
| 2009 | #if SVC_EXTENSION // ToDo: it should be checked for the case when parameters are different for the layers |
---|
| 2010 | for(UInt layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 2011 | { |
---|
| 2012 | Int m_iSourceWidth = m_acLayerCfg[layer].m_iSourceWidth; |
---|
| 2013 | Int m_iSourceHeight = m_acLayerCfg[layer].m_iSourceHeight; |
---|
[467] | 2014 | #if LAYER_CTB |
---|
| 2015 | Int m_uiMaxCUWidth = m_acLayerCfg[layer].m_uiMaxCUWidth; |
---|
| 2016 | Int m_uiMaxCUHeight = m_acLayerCfg[layer].m_uiMaxCUHeight; |
---|
[313] | 2017 | #endif |
---|
[467] | 2018 | #endif |
---|
[313] | 2019 | if(m_vuiParametersPresentFlag && m_bitstreamRestrictionFlag) |
---|
| 2020 | { |
---|
| 2021 | Int PicSizeInSamplesY = m_iSourceWidth * m_iSourceHeight; |
---|
| 2022 | if(tileFlag) |
---|
| 2023 | { |
---|
| 2024 | Int maxTileWidth = 0; |
---|
| 2025 | Int maxTileHeight = 0; |
---|
| 2026 | Int widthInCU = (m_iSourceWidth % m_uiMaxCUWidth) ? m_iSourceWidth/m_uiMaxCUWidth + 1: m_iSourceWidth/m_uiMaxCUWidth; |
---|
| 2027 | Int heightInCU = (m_iSourceHeight % m_uiMaxCUHeight) ? m_iSourceHeight/m_uiMaxCUHeight + 1: m_iSourceHeight/m_uiMaxCUHeight; |
---|
| 2028 | if(m_iUniformSpacingIdr) |
---|
| 2029 | { |
---|
| 2030 | maxTileWidth = m_uiMaxCUWidth*((widthInCU+m_iNumColumnsMinus1)/(m_iNumColumnsMinus1+1)); |
---|
| 2031 | maxTileHeight = m_uiMaxCUHeight*((heightInCU+m_iNumRowsMinus1)/(m_iNumRowsMinus1+1)); |
---|
| 2032 | // if only the last tile-row is one treeblock higher than the others |
---|
| 2033 | // the maxTileHeight becomes smaller if the last row of treeblocks has lower height than the others |
---|
| 2034 | if(!((heightInCU-1)%(m_iNumRowsMinus1+1))) |
---|
| 2035 | { |
---|
| 2036 | maxTileHeight = maxTileHeight - m_uiMaxCUHeight + (m_iSourceHeight % m_uiMaxCUHeight); |
---|
| 2037 | } |
---|
| 2038 | // if only the last tile-column is one treeblock wider than the others |
---|
| 2039 | // the maxTileWidth becomes smaller if the last column of treeblocks has lower width than the others |
---|
| 2040 | if(!((widthInCU-1)%(m_iNumColumnsMinus1+1))) |
---|
| 2041 | { |
---|
| 2042 | maxTileWidth = maxTileWidth - m_uiMaxCUWidth + (m_iSourceWidth % m_uiMaxCUWidth); |
---|
| 2043 | } |
---|
| 2044 | } |
---|
| 2045 | else // not uniform spacing |
---|
| 2046 | { |
---|
| 2047 | if(m_iNumColumnsMinus1<1) |
---|
| 2048 | { |
---|
| 2049 | maxTileWidth = m_iSourceWidth; |
---|
| 2050 | } |
---|
| 2051 | else |
---|
| 2052 | { |
---|
| 2053 | Int accColumnWidth = 0; |
---|
| 2054 | for(Int col=0; col<(m_iNumColumnsMinus1); col++) |
---|
| 2055 | { |
---|
| 2056 | maxTileWidth = m_pColumnWidth[col]>maxTileWidth ? m_pColumnWidth[col]:maxTileWidth; |
---|
| 2057 | accColumnWidth += m_pColumnWidth[col]; |
---|
| 2058 | } |
---|
| 2059 | maxTileWidth = (widthInCU-accColumnWidth)>maxTileWidth ? m_uiMaxCUWidth*(widthInCU-accColumnWidth):m_uiMaxCUWidth*maxTileWidth; |
---|
| 2060 | } |
---|
| 2061 | if(m_iNumRowsMinus1<1) |
---|
| 2062 | { |
---|
| 2063 | maxTileHeight = m_iSourceHeight; |
---|
| 2064 | } |
---|
| 2065 | else |
---|
| 2066 | { |
---|
| 2067 | Int accRowHeight = 0; |
---|
| 2068 | for(Int row=0; row<(m_iNumRowsMinus1); row++) |
---|
| 2069 | { |
---|
| 2070 | maxTileHeight = m_pRowHeight[row]>maxTileHeight ? m_pRowHeight[row]:maxTileHeight; |
---|
| 2071 | accRowHeight += m_pRowHeight[row]; |
---|
| 2072 | } |
---|
| 2073 | maxTileHeight = (heightInCU-accRowHeight)>maxTileHeight ? m_uiMaxCUHeight*(heightInCU-accRowHeight):m_uiMaxCUHeight*maxTileHeight; |
---|
| 2074 | } |
---|
| 2075 | } |
---|
| 2076 | Int maxSizeInSamplesY = maxTileWidth*maxTileHeight; |
---|
| 2077 | m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/maxSizeInSamplesY-4; |
---|
| 2078 | } |
---|
| 2079 | else if(m_iWaveFrontSynchro) |
---|
| 2080 | { |
---|
| 2081 | m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/((2*m_iSourceHeight+m_iSourceWidth)*m_uiMaxCUHeight)-4; |
---|
| 2082 | } |
---|
| 2083 | else if(m_sliceMode == 1) |
---|
| 2084 | { |
---|
| 2085 | m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/(m_sliceArgument*m_uiMaxCUWidth*m_uiMaxCUHeight)-4; |
---|
| 2086 | } |
---|
| 2087 | else |
---|
| 2088 | { |
---|
| 2089 | m_minSpatialSegmentationIdc = 0; |
---|
| 2090 | } |
---|
| 2091 | } |
---|
| 2092 | #if SVC_EXTENSION |
---|
| 2093 | } |
---|
| 2094 | #endif |
---|
| 2095 | xConfirmPara( m_iWaveFrontSynchro < 0, "WaveFrontSynchro cannot be negative" ); |
---|
| 2096 | #if !SVC_EXTENSION |
---|
| 2097 | xConfirmPara( m_iWaveFrontSubstreams <= 0, "WaveFrontSubstreams must be positive" ); |
---|
| 2098 | xConfirmPara( m_iWaveFrontSubstreams > 1 && !m_iWaveFrontSynchro, "Must have WaveFrontSynchro > 0 in order to have WaveFrontSubstreams > 1" ); |
---|
| 2099 | #endif |
---|
| 2100 | |
---|
| 2101 | xConfirmPara( m_decodedPictureHashSEIEnabled<0 || m_decodedPictureHashSEIEnabled>3, "this hash type is not correct!\n"); |
---|
| 2102 | |
---|
| 2103 | if (m_toneMappingInfoSEIEnabled) |
---|
| 2104 | { |
---|
| 2105 | xConfirmPara( m_toneMapCodedDataBitDepth < 8 || m_toneMapCodedDataBitDepth > 14 , "SEIToneMapCodedDataBitDepth must be in rage 8 to 14"); |
---|
| 2106 | xConfirmPara( m_toneMapTargetBitDepth < 1 || (m_toneMapTargetBitDepth > 16 && m_toneMapTargetBitDepth < 255) , "SEIToneMapTargetBitDepth must be in rage 1 to 16 or equal to 255"); |
---|
| 2107 | xConfirmPara( m_toneMapModelId < 0 || m_toneMapModelId > 4 , "SEIToneMapModelId must be in rage 0 to 4"); |
---|
| 2108 | xConfirmPara( m_cameraIsoSpeedValue == 0, "SEIToneMapCameraIsoSpeedValue shall not be equal to 0"); |
---|
| 2109 | xConfirmPara( m_extendedRangeWhiteLevel < 100, "SEIToneMapExtendedRangeWhiteLevel should be greater than or equal to 100"); |
---|
| 2110 | xConfirmPara( m_nominalBlackLevelLumaCodeValue >= m_nominalWhiteLevelLumaCodeValue, "SEIToneMapNominalWhiteLevelLumaCodeValue shall be greater than SEIToneMapNominalBlackLevelLumaCodeValue"); |
---|
| 2111 | xConfirmPara( m_extendedWhiteLevelLumaCodeValue < m_nominalWhiteLevelLumaCodeValue, "SEIToneMapExtendedWhiteLevelLumaCodeValue shall be greater than or equal to SEIToneMapNominalWhiteLevelLumaCodeValue"); |
---|
| 2112 | } |
---|
| 2113 | |
---|
| 2114 | #if RATE_CONTROL_LAMBDA_DOMAIN |
---|
| 2115 | #if RC_SHVC_HARMONIZATION |
---|
| 2116 | for ( Int layer=0; layer<m_numLayers; layer++ ) |
---|
| 2117 | { |
---|
| 2118 | if ( m_acLayerCfg[layer].m_RCEnableRateControl ) |
---|
| 2119 | { |
---|
| 2120 | if ( m_acLayerCfg[layer].m_RCForceIntraQP ) |
---|
| 2121 | { |
---|
| 2122 | if ( m_acLayerCfg[layer].m_RCInitialQP == 0 ) |
---|
| 2123 | { |
---|
| 2124 | printf( "\nInitial QP for rate control is not specified. Reset not to use force intra QP!" ); |
---|
| 2125 | m_acLayerCfg[layer].m_RCForceIntraQP = false; |
---|
| 2126 | } |
---|
| 2127 | } |
---|
| 2128 | } |
---|
| 2129 | xConfirmPara( m_uiDeltaQpRD > 0, "Rate control cannot be used together with slice level multiple-QP optimization!\n" ); |
---|
| 2130 | } |
---|
| 2131 | #else |
---|
| 2132 | if ( m_RCEnableRateControl ) |
---|
| 2133 | { |
---|
| 2134 | if ( m_RCForceIntraQP ) |
---|
| 2135 | { |
---|
| 2136 | if ( m_RCInitialQP == 0 ) |
---|
| 2137 | { |
---|
| 2138 | printf( "\nInitial QP for rate control is not specified. Reset not to use force intra QP!" ); |
---|
| 2139 | m_RCForceIntraQP = false; |
---|
| 2140 | } |
---|
| 2141 | } |
---|
| 2142 | xConfirmPara( m_uiDeltaQpRD > 0, "Rate control cannot be used together with slice level multiple-QP optimization!\n" ); |
---|
| 2143 | } |
---|
| 2144 | #endif |
---|
| 2145 | #else |
---|
| 2146 | if(m_enableRateCtrl) |
---|
| 2147 | { |
---|
| 2148 | Int numLCUInWidth = (m_iSourceWidth / m_uiMaxCUWidth) + (( m_iSourceWidth % m_uiMaxCUWidth ) ? 1 : 0); |
---|
| 2149 | Int numLCUInHeight = (m_iSourceHeight / m_uiMaxCUHeight)+ (( m_iSourceHeight % m_uiMaxCUHeight) ? 1 : 0); |
---|
| 2150 | Int numLCUInPic = numLCUInWidth * numLCUInHeight; |
---|
| 2151 | |
---|
| 2152 | xConfirmPara( (numLCUInPic % m_numLCUInUnit) != 0, "total number of LCUs in a frame should be completely divided by NumLCUInUnit" ); |
---|
| 2153 | |
---|
| 2154 | m_iMaxDeltaQP = MAX_DELTA_QP; |
---|
| 2155 | m_iMaxCuDQPDepth = MAX_CUDQP_DEPTH; |
---|
| 2156 | } |
---|
| 2157 | #endif |
---|
| 2158 | |
---|
| 2159 | xConfirmPara(!m_TransquantBypassEnableFlag && m_CUTransquantBypassFlagValue, "CUTransquantBypassFlagValue cannot be 1 when TransquantBypassEnableFlag is 0"); |
---|
| 2160 | |
---|
| 2161 | xConfirmPara(m_log2ParallelMergeLevel < 2, "Log2ParallelMergeLevel should be larger than or equal to 2"); |
---|
| 2162 | if (m_framePackingSEIEnabled) |
---|
| 2163 | { |
---|
| 2164 | xConfirmPara(m_framePackingSEIType < 3 || m_framePackingSEIType > 5 , "SEIFramePackingType must be in rage 3 to 5"); |
---|
| 2165 | } |
---|
| 2166 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
| 2167 | #if M0457_PREDICTION_INDICATIONS |
---|
| 2168 | xConfirmPara( (m_acLayerCfg[0].m_numSamplePredRefLayers != 0) && (m_acLayerCfg[0].m_numSamplePredRefLayers != -1), "Layer 0 cannot have any reference layers" ); |
---|
| 2169 | // NOTE: m_numSamplePredRefLayers (for any layer) could be -1 (not signalled in cfg), in which case only the "previous layer" would be taken for reference |
---|
| 2170 | for(Int layer = 1; layer < MAX_LAYERS; layer++) |
---|
| 2171 | { |
---|
| 2172 | xConfirmPara(m_acLayerCfg[layer].m_numSamplePredRefLayers > layer, "Cannot reference more layers than before current layer"); |
---|
| 2173 | for(Int i = 0; i < m_acLayerCfg[layer].m_numSamplePredRefLayers; i++) |
---|
| 2174 | { |
---|
| 2175 | xConfirmPara(m_acLayerCfg[layer].m_samplePredRefLayerIds[i] > layer, "Cannot reference higher layers"); |
---|
| 2176 | xConfirmPara(m_acLayerCfg[layer].m_samplePredRefLayerIds[i] == layer, "Cannot reference the current layer itself"); |
---|
| 2177 | } |
---|
| 2178 | } |
---|
| 2179 | xConfirmPara( (m_acLayerCfg[0].m_numMotionPredRefLayers != 0) && (m_acLayerCfg[0].m_numMotionPredRefLayers != -1), "Layer 0 cannot have any reference layers" ); |
---|
| 2180 | // NOTE: m_numMotionPredRefLayers (for any layer) could be -1 (not signalled in cfg), in which case only the "previous layer" would be taken for reference |
---|
| 2181 | for(Int layer = 1; layer < MAX_LAYERS; layer++) |
---|
| 2182 | { |
---|
| 2183 | xConfirmPara(m_acLayerCfg[layer].m_numMotionPredRefLayers > layer, "Cannot reference more layers than before current layer"); |
---|
| 2184 | for(Int i = 0; i < m_acLayerCfg[layer].m_numMotionPredRefLayers; i++) |
---|
| 2185 | { |
---|
| 2186 | xConfirmPara(m_acLayerCfg[layer].m_motionPredRefLayerIds[i] > layer, "Cannot reference higher layers"); |
---|
| 2187 | xConfirmPara(m_acLayerCfg[layer].m_motionPredRefLayerIds[i] == layer, "Cannot reference the current layer itself"); |
---|
| 2188 | } |
---|
| 2189 | } |
---|
| 2190 | #else |
---|
| 2191 | xConfirmPara( (m_acLayerCfg[0].m_numDirectRefLayers != 0) && (m_acLayerCfg[0].m_numDirectRefLayers != -1), "Layer 0 cannot have any reference layers" ); |
---|
| 2192 | // 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 |
---|
| 2193 | for(Int layer = 1; layer < MAX_LAYERS; layer++) |
---|
| 2194 | { |
---|
| 2195 | xConfirmPara(m_acLayerCfg[layer].m_numDirectRefLayers > layer, "Cannot reference more layers than before current layer"); |
---|
| 2196 | for(Int i = 0; i < m_acLayerCfg[layer].m_numDirectRefLayers; i++) |
---|
| 2197 | { |
---|
| 2198 | xConfirmPara(m_acLayerCfg[layer].m_refLayerIds[i] > layer, "Cannot reference higher layers"); |
---|
| 2199 | xConfirmPara(m_acLayerCfg[layer].m_refLayerIds[i] == layer, "Cannot reference the current layer itself"); |
---|
| 2200 | } |
---|
| 2201 | } |
---|
| 2202 | #endif |
---|
| 2203 | xConfirmPara( (m_acLayerCfg[0].m_numActiveRefLayers != 0) && (m_acLayerCfg[0].m_numActiveRefLayers != -1), "Layer 0 cannot have any active reference layers" ); |
---|
| 2204 | // NOTE: m_numActiveRefLayers (for any layer) could be -1 (not signalled in cfg), in which case only the "previous layer" would be taken for reference |
---|
| 2205 | for(Int layer = 1; layer < MAX_LAYERS; layer++) |
---|
| 2206 | { |
---|
| 2207 | #if M0457_PREDICTION_INDICATIONS |
---|
| 2208 | Bool predEnabledFlag[MAX_LAYERS]; |
---|
| 2209 | for (Int refLayer = 0; refLayer < layer; refLayer++) |
---|
| 2210 | { |
---|
| 2211 | predEnabledFlag[refLayer] = false; |
---|
| 2212 | } |
---|
| 2213 | for(Int i = 0; i < m_acLayerCfg[layer].m_numSamplePredRefLayers; i++) |
---|
| 2214 | { |
---|
| 2215 | predEnabledFlag[m_acLayerCfg[layer].m_samplePredRefLayerIds[i]] = true; |
---|
| 2216 | } |
---|
| 2217 | for(Int i = 0; i < m_acLayerCfg[layer].m_numMotionPredRefLayers; i++) |
---|
| 2218 | { |
---|
| 2219 | predEnabledFlag[m_acLayerCfg[layer].m_motionPredRefLayerIds[i]] = true; |
---|
| 2220 | } |
---|
| 2221 | Int numDirectRefLayers = 0; |
---|
| 2222 | for (Int refLayer = 0; refLayer < layer; refLayer++) |
---|
| 2223 | { |
---|
| 2224 | if (predEnabledFlag[refLayer] == true) numDirectRefLayers++; |
---|
| 2225 | } |
---|
| 2226 | xConfirmPara(m_acLayerCfg[layer].m_numActiveRefLayers > numDirectRefLayers, "Cannot reference more layers than NumDirectRefLayers"); |
---|
| 2227 | for(Int i = 0; i < m_acLayerCfg[layer].m_numActiveRefLayers; i++) |
---|
| 2228 | { |
---|
| 2229 | xConfirmPara(m_acLayerCfg[layer].m_predLayerIds[i] >= numDirectRefLayers, "Cannot reference higher layers"); |
---|
| 2230 | } |
---|
| 2231 | #else |
---|
| 2232 | xConfirmPara(m_acLayerCfg[layer].m_numActiveRefLayers > m_acLayerCfg[layer].m_numDirectRefLayers, "Cannot reference more layers than NumDirectRefLayers"); |
---|
| 2233 | for(Int i = 0; i < m_acLayerCfg[layer].m_numActiveRefLayers; i++) |
---|
| 2234 | { |
---|
| 2235 | xConfirmPara(m_acLayerCfg[layer].m_predLayerIds[i] >= m_acLayerCfg[layer].m_numDirectRefLayers, "Cannot reference higher layers"); |
---|
| 2236 | } |
---|
| 2237 | #endif |
---|
| 2238 | } |
---|
| 2239 | #endif |
---|
| 2240 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
| 2241 | if (m_adaptiveResolutionChange > 0) |
---|
| 2242 | { |
---|
| 2243 | xConfirmPara(m_numLayers != 2, "Adaptive resolution change works with 2 layers only"); |
---|
| 2244 | xConfirmPara(m_acLayerCfg[1].m_iIntraPeriod == 0 || (m_adaptiveResolutionChange % m_acLayerCfg[1].m_iIntraPeriod) != 0, "Adaptive resolution change must happen at enhancement layer RAP picture"); |
---|
| 2245 | } |
---|
| 2246 | #endif |
---|
[442] | 2247 | #if N0120_MAX_TID_REF_CFG |
---|
| 2248 | for (UInt layer=0; layer < MAX_LAYERS-1; layer++) |
---|
| 2249 | { |
---|
| 2250 | xConfirmPara(m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1 < 0 || m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1 > 7, "MaxTidIlRefPicsPlus1 must be in range 0 to 7"); |
---|
| 2251 | } |
---|
| 2252 | #endif |
---|
[313] | 2253 | #undef xConfirmPara |
---|
| 2254 | if (check_failed) |
---|
| 2255 | { |
---|
| 2256 | exit(EXIT_FAILURE); |
---|
| 2257 | } |
---|
| 2258 | } |
---|
| 2259 | |
---|
| 2260 | /** \todo use of global variables should be removed later |
---|
| 2261 | */ |
---|
[467] | 2262 | #if LAYER_CTB |
---|
| 2263 | Void TAppEncCfg::xSetGlobal(UInt layerId) |
---|
| 2264 | { |
---|
| 2265 | // set max CU width & height |
---|
| 2266 | g_auiLayerMaxCUWidth[layerId] = m_acLayerCfg[layerId].m_uiMaxCUWidth; |
---|
| 2267 | g_auiLayerMaxCUHeight[layerId] = m_acLayerCfg[layerId].m_uiMaxCUHeight; |
---|
| 2268 | |
---|
| 2269 | // compute actual CU depth with respect to config depth and max transform size |
---|
| 2270 | g_auiLayerAddCUDepth[layerId] = 0; |
---|
| 2271 | while( (m_acLayerCfg[layerId].m_uiMaxCUWidth>>m_acLayerCfg[layerId].m_uiMaxCUDepth) > ( 1 << ( m_acLayerCfg[layerId].m_uiQuadtreeTULog2MinSize + g_auiLayerAddCUDepth[layerId] ) ) ) g_auiLayerAddCUDepth[layerId]++; |
---|
| 2272 | |
---|
| 2273 | m_acLayerCfg[layerId].m_uiMaxCUDepth += g_auiLayerAddCUDepth[layerId]; |
---|
| 2274 | g_auiLayerAddCUDepth[layerId]++; |
---|
| 2275 | g_auiLayerMaxCUDepth[layerId] = m_acLayerCfg[layerId].m_uiMaxCUDepth; |
---|
| 2276 | |
---|
| 2277 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
| 2278 | // set internal bit-depth to constant value to make sure to be updated later |
---|
| 2279 | g_bitDepthY = -1; |
---|
| 2280 | g_bitDepthC = -1; |
---|
| 2281 | |
---|
| 2282 | g_uiPCMBitDepthLuma = -1; |
---|
| 2283 | g_uiPCMBitDepthChroma = -1; |
---|
| 2284 | #else |
---|
| 2285 | // set internal bit-depth and constants |
---|
| 2286 | g_bitDepthY = m_internalBitDepthY; |
---|
| 2287 | g_bitDepthC = m_internalBitDepthC; |
---|
| 2288 | |
---|
| 2289 | g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_inputBitDepthY : m_internalBitDepthY; |
---|
| 2290 | g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_inputBitDepthC : m_internalBitDepthC; |
---|
| 2291 | #endif |
---|
| 2292 | } |
---|
| 2293 | #else |
---|
[313] | 2294 | Void TAppEncCfg::xSetGlobal() |
---|
| 2295 | { |
---|
| 2296 | // set max CU width & height |
---|
| 2297 | g_uiMaxCUWidth = m_uiMaxCUWidth; |
---|
| 2298 | g_uiMaxCUHeight = m_uiMaxCUHeight; |
---|
| 2299 | |
---|
| 2300 | // compute actual CU depth with respect to config depth and max transform size |
---|
| 2301 | g_uiAddCUDepth = 0; |
---|
| 2302 | while( (m_uiMaxCUWidth>>m_uiMaxCUDepth) > ( 1 << ( m_uiQuadtreeTULog2MinSize + g_uiAddCUDepth ) ) ) g_uiAddCUDepth++; |
---|
| 2303 | |
---|
| 2304 | m_uiMaxCUDepth += g_uiAddCUDepth; |
---|
| 2305 | g_uiAddCUDepth++; |
---|
| 2306 | g_uiMaxCUDepth = m_uiMaxCUDepth; |
---|
| 2307 | |
---|
[466] | 2308 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
| 2309 | // set internal bit-depth to constant value to make sure to be updated later |
---|
| 2310 | g_bitDepthY = -1; |
---|
| 2311 | g_bitDepthC = -1; |
---|
| 2312 | |
---|
| 2313 | g_uiPCMBitDepthLuma = -1; |
---|
| 2314 | g_uiPCMBitDepthChroma = -1; |
---|
| 2315 | #else |
---|
[313] | 2316 | g_bitDepthY = m_internalBitDepthY; |
---|
| 2317 | g_bitDepthC = m_internalBitDepthC; |
---|
| 2318 | |
---|
| 2319 | g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_inputBitDepthY : m_internalBitDepthY; |
---|
| 2320 | g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_inputBitDepthC : m_internalBitDepthC; |
---|
[466] | 2321 | #endif |
---|
[313] | 2322 | } |
---|
[467] | 2323 | #endif |
---|
[313] | 2324 | |
---|
| 2325 | Void TAppEncCfg::xPrintParameter() |
---|
| 2326 | { |
---|
| 2327 | printf("\n"); |
---|
| 2328 | #if SVC_EXTENSION |
---|
| 2329 | printf("Total number of layers : %d\n", m_numLayers ); |
---|
[442] | 2330 | #if SCALABILITY_MASK_E0104 |
---|
| 2331 | printf("Multiview : %d\n", m_scalabilityMask[1] ); |
---|
| 2332 | printf("Scalable : %d\n", m_scalabilityMask[2] ); |
---|
| 2333 | #else |
---|
[313] | 2334 | printf("Multiview : %d\n", m_scalabilityMask[0] ); |
---|
| 2335 | printf("Scalable : %d\n", m_scalabilityMask[1] ); |
---|
[442] | 2336 | #endif |
---|
[313] | 2337 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
| 2338 | printf("Adaptive Resolution Change : %d\n", m_adaptiveResolutionChange ); |
---|
| 2339 | #endif |
---|
| 2340 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
| 2341 | { |
---|
| 2342 | printf("=== Layer %d settings === \n", layer); |
---|
| 2343 | #if AVC_SYNTAX |
---|
| 2344 | m_acLayerCfg[layer].xPrintParameter( layer ); |
---|
| 2345 | #else |
---|
| 2346 | m_acLayerCfg[layer].xPrintParameter(); |
---|
| 2347 | #endif |
---|
| 2348 | printf("\n"); |
---|
| 2349 | } |
---|
| 2350 | printf("=== Common configuration settings === \n"); |
---|
| 2351 | printf("Bitstream File : %s\n", m_pBitstreamFile ); |
---|
| 2352 | #else |
---|
| 2353 | printf("Input File : %s\n", m_pchInputFile ); |
---|
| 2354 | printf("Bitstream File : %s\n", m_pchBitstreamFile ); |
---|
| 2355 | printf("Reconstruction File : %s\n", m_pchReconFile ); |
---|
| 2356 | printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_confLeft - m_confRight, m_iSourceHeight - m_confTop - m_confBottom, m_iFrameRate ); |
---|
| 2357 | printf("Internal Format : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate ); |
---|
| 2358 | #endif |
---|
[442] | 2359 | if (m_isField) |
---|
| 2360 | { |
---|
| 2361 | printf("Frame/Field : Field based coding\n"); |
---|
| 2362 | printf("Field index : %u - %d (%d fields)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded ); |
---|
| 2363 | if (m_isTopFieldFirst) |
---|
| 2364 | { |
---|
| 2365 | printf("Field Order : Top field first\n"); |
---|
| 2366 | } |
---|
| 2367 | else |
---|
| 2368 | { |
---|
| 2369 | printf("Field Order : Bottom field first\n"); |
---|
| 2370 | } |
---|
| 2371 | } |
---|
| 2372 | else |
---|
| 2373 | { |
---|
| 2374 | printf("Frame/Field : Frame based coding\n"); |
---|
| 2375 | printf("Frame index : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded ); |
---|
| 2376 | } |
---|
[467] | 2377 | #if !LAYER_CTB |
---|
[313] | 2378 | printf("CU size / depth : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth ); |
---|
| 2379 | printf("RQT trans. size (min / max) : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize ); |
---|
| 2380 | printf("Max RQT depth inter : %d\n", m_uiQuadtreeTUMaxDepthInter); |
---|
| 2381 | printf("Max RQT depth intra : %d\n", m_uiQuadtreeTUMaxDepthIntra); |
---|
[467] | 2382 | #endif |
---|
[313] | 2383 | printf("Min PCM size : %d\n", 1 << m_uiPCMLog2MinSize); |
---|
| 2384 | printf("Motion search range : %d\n", m_iSearchRange ); |
---|
| 2385 | #if !SVC_EXTENSION |
---|
| 2386 | printf("Intra period : %d\n", m_iIntraPeriod ); |
---|
| 2387 | #endif |
---|
| 2388 | printf("Decoding refresh type : %d\n", m_iDecodingRefreshType ); |
---|
| 2389 | #if !SVC_EXTENSION |
---|
| 2390 | printf("QP : %5.2f\n", m_fQP ); |
---|
| 2391 | #endif |
---|
| 2392 | printf("Max dQP signaling depth : %d\n", m_iMaxCuDQPDepth); |
---|
| 2393 | |
---|
| 2394 | printf("Cb QP Offset : %d\n", m_cbQpOffset ); |
---|
| 2395 | printf("Cr QP Offset : %d\n", m_crQpOffset); |
---|
| 2396 | |
---|
| 2397 | printf("QP adaptation : %d (range=%d)\n", m_bUseAdaptiveQP, (m_bUseAdaptiveQP ? m_iQPAdaptationRange : 0) ); |
---|
| 2398 | printf("GOP size : %d\n", m_iGOPSize ); |
---|
[466] | 2399 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
[468] | 2400 | printf("Input bit depth Layer0 : (Y:%d, C:%d)\n", m_acLayerCfg[0].m_inputBitDepthY , m_acLayerCfg[0].m_inputBitDepthC ); |
---|
| 2401 | printf("Input bit depth Layer1 : (Y:%d, C:%d)\n", m_acLayerCfg[1].m_internalBitDepthY, m_acLayerCfg[1].m_internalBitDepthC ); |
---|
[466] | 2402 | printf("Internal bit depth Layer0 : (Y:%d, C:%d)\n", m_acLayerCfg[0].m_internalBitDepthY, m_acLayerCfg[0].m_internalBitDepthC ); |
---|
| 2403 | printf("Internal bit depth Layer1 : (Y:%d, C:%d)\n", m_acLayerCfg[1].m_internalBitDepthY, m_acLayerCfg[1].m_internalBitDepthC ); |
---|
| 2404 | #else |
---|
[313] | 2405 | printf("Internal bit depth : (Y:%d, C:%d)\n", m_internalBitDepthY, m_internalBitDepthC ); |
---|
[466] | 2406 | #endif |
---|
[313] | 2407 | printf("PCM sample bit depth : (Y:%d, C:%d)\n", g_uiPCMBitDepthLuma, g_uiPCMBitDepthChroma ); |
---|
[464] | 2408 | #if O0215_PHASE_ALIGNMENT |
---|
| 2409 | printf("cross-layer sample alignment : %d\n", m_phaseAlignFlag); |
---|
| 2410 | #endif |
---|
[313] | 2411 | #if RATE_CONTROL_LAMBDA_DOMAIN |
---|
| 2412 | #if !RC_SHVC_HARMONIZATION |
---|
| 2413 | printf("RateControl : %d\n", m_RCEnableRateControl ); |
---|
| 2414 | if(m_RCEnableRateControl) |
---|
| 2415 | { |
---|
| 2416 | printf("TargetBitrate : %d\n", m_RCTargetBitrate ); |
---|
| 2417 | printf("KeepHierarchicalBit : %d\n", m_RCKeepHierarchicalBit ); |
---|
| 2418 | printf("LCULevelRC : %d\n", m_RCLCULevelRC ); |
---|
| 2419 | printf("UseLCUSeparateModel : %d\n", m_RCUseLCUSeparateModel ); |
---|
| 2420 | printf("InitialQP : %d\n", m_RCInitialQP ); |
---|
| 2421 | printf("ForceIntraQP : %d\n", m_RCForceIntraQP ); |
---|
| 2422 | } |
---|
| 2423 | #endif |
---|
| 2424 | #else |
---|
| 2425 | printf("RateControl : %d\n", m_enableRateCtrl); |
---|
| 2426 | if(m_enableRateCtrl) |
---|
| 2427 | { |
---|
| 2428 | printf("TargetBitrate : %d\n", m_targetBitrate); |
---|
| 2429 | printf("NumLCUInUnit : %d\n", m_numLCUInUnit); |
---|
| 2430 | } |
---|
| 2431 | #endif |
---|
| 2432 | printf("Max Num Merge Candidates : %d\n", m_maxNumMergeCand); |
---|
| 2433 | printf("\n"); |
---|
| 2434 | |
---|
| 2435 | printf("TOOL CFG: "); |
---|
[466] | 2436 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
| 2437 | printf("IBD0:%d ", g_bitDepthY > m_acLayerCfg[0].m_inputBitDepthY || g_bitDepthC > m_acLayerCfg[0].m_inputBitDepthC); |
---|
| 2438 | printf("IBD1:%d ", g_bitDepthY > m_acLayerCfg[1].m_inputBitDepthY || g_bitDepthC > m_acLayerCfg[1].m_inputBitDepthC); |
---|
| 2439 | #else |
---|
[313] | 2440 | printf("IBD:%d ", g_bitDepthY > m_inputBitDepthY || g_bitDepthC > m_inputBitDepthC); |
---|
[466] | 2441 | #endif |
---|
[313] | 2442 | printf("HAD:%d ", m_bUseHADME ); |
---|
| 2443 | printf("SRD:%d ", m_bUseSBACRD ); |
---|
| 2444 | printf("RDQ:%d ", m_useRDOQ ); |
---|
| 2445 | printf("RDQTS:%d ", m_useRDOQTS ); |
---|
| 2446 | printf("RDpenalty:%d ", m_rdPenalty ); |
---|
| 2447 | printf("SQP:%d ", m_uiDeltaQpRD ); |
---|
| 2448 | printf("ASR:%d ", m_bUseASR ); |
---|
| 2449 | printf("FEN:%d ", m_bUseFastEnc ); |
---|
| 2450 | printf("ECU:%d ", m_bUseEarlyCU ); |
---|
| 2451 | printf("FDM:%d ", m_useFastDecisionForMerge ); |
---|
| 2452 | printf("CFM:%d ", m_bUseCbfFastMode ); |
---|
| 2453 | printf("ESD:%d ", m_useEarlySkipDetection ); |
---|
| 2454 | #if FAST_INTRA_SHVC |
---|
| 2455 | printf("FIS:%d ", m_useFastIntraScalable ); |
---|
| 2456 | #endif |
---|
| 2457 | printf("RQT:%d ", 1 ); |
---|
| 2458 | printf("TransformSkip:%d ", m_useTransformSkip ); |
---|
| 2459 | printf("TransformSkipFast:%d ", m_useTransformSkipFast ); |
---|
| 2460 | printf("Slice: M=%d ", m_sliceMode); |
---|
| 2461 | if (m_sliceMode!=0) |
---|
| 2462 | { |
---|
| 2463 | printf("A=%d ", m_sliceArgument); |
---|
| 2464 | } |
---|
| 2465 | printf("SliceSegment: M=%d ",m_sliceSegmentMode); |
---|
| 2466 | if (m_sliceSegmentMode!=0) |
---|
| 2467 | { |
---|
| 2468 | printf("A=%d ", m_sliceSegmentArgument); |
---|
| 2469 | } |
---|
| 2470 | printf("CIP:%d ", m_bUseConstrainedIntraPred); |
---|
| 2471 | printf("SAO:%d ", (m_bUseSAO)?(1):(0)); |
---|
[467] | 2472 | #if !LAYER_CTB |
---|
[313] | 2473 | printf("PCM:%d ", (m_usePCM && (1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0); |
---|
[467] | 2474 | #endif |
---|
[313] | 2475 | printf("SAOLcuBasedOptimization:%d ", (m_saoLcuBasedOptimization)?(1):(0)); |
---|
| 2476 | |
---|
| 2477 | printf("LosslessCuEnabled:%d ", (m_useLossless)? 1:0 ); |
---|
| 2478 | printf("WPP:%d ", (Int)m_useWeightedPred); |
---|
| 2479 | printf("WPB:%d ", (Int)m_useWeightedBiPred); |
---|
| 2480 | printf("PME:%d ", m_log2ParallelMergeLevel); |
---|
| 2481 | #if !SVC_EXTENSION |
---|
| 2482 | printf(" WaveFrontSynchro:%d WaveFrontSubstreams:%d", |
---|
| 2483 | m_iWaveFrontSynchro, m_iWaveFrontSubstreams); |
---|
| 2484 | #endif |
---|
| 2485 | printf(" ScalingList:%d ", m_useScalingListId ); |
---|
| 2486 | printf("TMVPMode:%d ", m_TMVPModeId ); |
---|
| 2487 | #if ADAPTIVE_QP_SELECTION |
---|
| 2488 | printf("AQpS:%d", m_bUseAdaptQpSelect ); |
---|
| 2489 | #endif |
---|
| 2490 | |
---|
| 2491 | printf(" SignBitHidingFlag:%d ", m_signHideFlag); |
---|
| 2492 | #if SVC_EXTENSION |
---|
| 2493 | printf("RecalQP:%d ", m_recalculateQPAccordingToLambda ? 1 : 0 ); |
---|
| 2494 | #if AVC_BASE |
---|
| 2495 | printf("AvcBase:%d ", m_avcBaseLayerFlag ? 1 : 0); |
---|
| 2496 | #else |
---|
| 2497 | printf("AvcBase:%d ", 0); |
---|
| 2498 | #endif |
---|
| 2499 | printf("EL_RAP_SliceType: %d ", m_elRapSliceBEnabled); |
---|
| 2500 | printf("REF_IDX_ME_ZEROMV: %d ", REF_IDX_ME_ZEROMV); |
---|
| 2501 | printf("ENCODER_FAST_MODE: %d ", ENCODER_FAST_MODE); |
---|
| 2502 | printf("REF_IDX_MFM: %d ", REF_IDX_MFM); |
---|
| 2503 | #else |
---|
| 2504 | printf("RecalQP:%d", m_recalculateQPAccordingToLambda ? 1 : 0 ); |
---|
| 2505 | #endif |
---|
[466] | 2506 | printf("O0194_DIFFERENT_BITDEPTH_EL_BL: %d ", O0194_DIFFERENT_BITDEPTH_EL_BL); |
---|
| 2507 | printf("O0194_JOINT_US_BITSHIFT: %d ", O0194_JOINT_US_BITSHIFT); |
---|
| 2508 | printf("O0194_WEIGHTED_PREDICTION_CGS: %d ",O0194_WEIGHTED_PREDICTION_CGS); |
---|
[313] | 2509 | printf("\n\n"); |
---|
| 2510 | |
---|
| 2511 | fflush(stdout); |
---|
| 2512 | } |
---|
| 2513 | |
---|
| 2514 | Bool confirmPara(Bool bflag, const Char* message) |
---|
| 2515 | { |
---|
| 2516 | if (!bflag) |
---|
| 2517 | return false; |
---|
| 2518 | |
---|
| 2519 | printf("Error: %s\n",message); |
---|
| 2520 | return true; |
---|
| 2521 | } |
---|
| 2522 | |
---|
[467] | 2523 | #if SVC_EXTENSION |
---|
[313] | 2524 | Void TAppEncCfg::cfgStringToArray(Int **arr, string cfgString, Int numEntries, const char* logString) |
---|
| 2525 | { |
---|
| 2526 | Char *tempChar = cfgString.empty() ? NULL : strdup(cfgString.c_str()); |
---|
| 2527 | if( numEntries > 0 ) |
---|
| 2528 | { |
---|
| 2529 | Char *arrayEntry; |
---|
| 2530 | Int i = 0; |
---|
| 2531 | *arr = new Int[numEntries]; |
---|
| 2532 | |
---|
| 2533 | arrayEntry = strtok( tempChar, " ,"); |
---|
| 2534 | while(arrayEntry != NULL) |
---|
| 2535 | { |
---|
| 2536 | if( i >= numEntries ) |
---|
| 2537 | { |
---|
| 2538 | printf( "%s: The number of entries specified is larger than the allowed number.\n", logString ); |
---|
| 2539 | exit( EXIT_FAILURE ); |
---|
| 2540 | } |
---|
| 2541 | *( *arr + i ) = atoi( arrayEntry ); |
---|
| 2542 | arrayEntry = strtok(NULL, " ,"); |
---|
| 2543 | i++; |
---|
| 2544 | } |
---|
| 2545 | if( i < numEntries ) |
---|
| 2546 | { |
---|
| 2547 | printf( "%s: Some entries are not specified.\n", logString ); |
---|
| 2548 | exit( EXIT_FAILURE ); |
---|
| 2549 | } |
---|
| 2550 | } |
---|
| 2551 | else |
---|
| 2552 | { |
---|
| 2553 | *arr = NULL; |
---|
| 2554 | } |
---|
| 2555 | } |
---|
[345] | 2556 | |
---|
[467] | 2557 | #endif //SVC_EXTENSION |
---|
[313] | 2558 | //! \} |
---|