[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 | * |
---|
[595] | 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC |
---|
[313] | 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 |
---|
[906] | 69 | #if VPS_AVC_BL_FLAG_REMOVAL |
---|
| 70 | , m_nonHEVCBaseLayerFlag(0) |
---|
| 71 | #else |
---|
[313] | 72 | , m_avcBaseLayerFlag(0) |
---|
| 73 | #endif |
---|
[906] | 74 | #endif |
---|
[442] | 75 | , m_maxTidRefPresentFlag(1) |
---|
[906] | 76 | #if OUTPUT_LAYER_SETS_CONFIG |
---|
| 77 | , m_defaultTargetOutputLayerIdc (-1) |
---|
| 78 | , m_numOutputLayerSets (-1) |
---|
| 79 | #endif |
---|
[313] | 80 | , m_scalingListFile() |
---|
| 81 | , m_elRapSliceBEnabled(0) |
---|
| 82 | { |
---|
| 83 | for(UInt layer=0; layer<MAX_LAYERS; layer++) |
---|
| 84 | { |
---|
| 85 | m_acLayerCfg[layer].setAppEncCfg(this); |
---|
| 86 | } |
---|
| 87 | memset( m_scalabilityMask, 0, sizeof(m_scalabilityMask) ); |
---|
| 88 | } |
---|
| 89 | #else |
---|
| 90 | TAppEncCfg::TAppEncCfg() |
---|
| 91 | : m_pchInputFile() |
---|
| 92 | , m_pchBitstreamFile() |
---|
| 93 | , m_pchReconFile() |
---|
| 94 | , m_pchdQPFile() |
---|
| 95 | , m_scalingListFile() |
---|
| 96 | { |
---|
| 97 | m_aidQP = NULL; |
---|
| 98 | m_startOfCodedInterval = NULL; |
---|
| 99 | m_codedPivotValue = NULL; |
---|
| 100 | m_targetPivotValue = NULL; |
---|
[906] | 101 | #if Q0074_COLOUR_REMAPPING_SEI |
---|
| 102 | for( Int c=0 ; c<3 ; c++) |
---|
| 103 | { |
---|
| 104 | m_colourRemapSEIPreLutCodedValue[c] = NULL; |
---|
| 105 | m_colourRemapSEIPreLutTargetValue[c] = NULL; |
---|
| 106 | m_colourRemapSEIPostLutCodedValue[c] = NULL; |
---|
| 107 | m_colourRemapSEIPostLutTargetValue[c] = NULL; |
---|
| 108 | } |
---|
| 109 | #endif |
---|
[313] | 110 | } |
---|
| 111 | #endif |
---|
| 112 | |
---|
| 113 | TAppEncCfg::~TAppEncCfg() |
---|
| 114 | { |
---|
| 115 | #if SVC_EXTENSION |
---|
[906] | 116 | if( m_pBitstreamFile ) |
---|
| 117 | { |
---|
| 118 | free(m_pBitstreamFile); |
---|
| 119 | m_pBitstreamFile = NULL; |
---|
| 120 | } |
---|
[595] | 121 | #else |
---|
[313] | 122 | if ( m_aidQP ) |
---|
| 123 | { |
---|
| 124 | delete[] m_aidQP; |
---|
| 125 | } |
---|
| 126 | if ( m_startOfCodedInterval ) |
---|
| 127 | { |
---|
| 128 | delete[] m_startOfCodedInterval; |
---|
| 129 | m_startOfCodedInterval = NULL; |
---|
| 130 | } |
---|
| 131 | if ( m_codedPivotValue ) |
---|
| 132 | { |
---|
| 133 | delete[] m_codedPivotValue; |
---|
| 134 | m_codedPivotValue = NULL; |
---|
| 135 | } |
---|
| 136 | if ( m_targetPivotValue ) |
---|
| 137 | { |
---|
| 138 | delete[] m_targetPivotValue; |
---|
| 139 | m_targetPivotValue = NULL; |
---|
| 140 | } |
---|
| 141 | free(m_pchInputFile); |
---|
[595] | 142 | free(m_pchBitstreamFile); |
---|
[313] | 143 | #endif |
---|
| 144 | #if !SVC_EXTENSION |
---|
| 145 | free(m_pchReconFile); |
---|
| 146 | free(m_pchdQPFile); |
---|
[906] | 147 | #if Q0074_COLOUR_REMAPPING_SEI |
---|
| 148 | for( Int c=0 ; c<3 ; c++) |
---|
| 149 | { |
---|
| 150 | if ( m_colourRemapSEIPreLutCodedValue[c] ) |
---|
| 151 | { |
---|
| 152 | delete[] m_colourRemapSEIPreLutCodedValue[c]; |
---|
| 153 | } |
---|
| 154 | if ( m_colourRemapSEIPreLutTargetValue[c] ) |
---|
| 155 | { |
---|
| 156 | delete[] m_colourRemapSEIPreLutTargetValue[c]; |
---|
| 157 | } |
---|
| 158 | if ( m_colourRemapSEIPostLutCodedValue[c] ) |
---|
| 159 | { |
---|
| 160 | delete[] m_colourRemapSEIPostLutCodedValue[c]; |
---|
| 161 | } |
---|
| 162 | if ( m_colourRemapSEIPostLutTargetValue[c] ) |
---|
| 163 | { |
---|
| 164 | delete[] m_colourRemapSEIPostLutTargetValue[c]; |
---|
| 165 | } |
---|
| 166 | } |
---|
[313] | 167 | #endif |
---|
[906] | 168 | #endif |
---|
[313] | 169 | free(m_scalingListFile); |
---|
| 170 | } |
---|
| 171 | |
---|
| 172 | Void TAppEncCfg::create() |
---|
| 173 | { |
---|
| 174 | } |
---|
| 175 | |
---|
| 176 | Void TAppEncCfg::destroy() |
---|
| 177 | { |
---|
| 178 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
| 179 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 180 | { |
---|
| 181 | if( m_acLayerCfg[layer].m_numSamplePredRefLayers > 0 ) |
---|
| 182 | { |
---|
| 183 | delete [] m_acLayerCfg[layer].m_samplePredRefLayerIds; |
---|
[588] | 184 | m_acLayerCfg[layer].m_samplePredRefLayerIds = NULL; |
---|
[313] | 185 | } |
---|
| 186 | if( m_acLayerCfg[layer].m_numMotionPredRefLayers > 0 ) |
---|
| 187 | { |
---|
| 188 | delete [] m_acLayerCfg[layer].m_motionPredRefLayerIds; |
---|
[588] | 189 | m_acLayerCfg[layer].m_motionPredRefLayerIds = NULL; |
---|
[313] | 190 | } |
---|
| 191 | if( m_acLayerCfg[layer].m_numActiveRefLayers > 0 ) |
---|
| 192 | { |
---|
| 193 | delete [] m_acLayerCfg[layer].m_predLayerIds; |
---|
[588] | 194 | m_acLayerCfg[layer].m_predLayerIds = NULL; |
---|
[313] | 195 | } |
---|
| 196 | } |
---|
| 197 | #endif |
---|
| 198 | } |
---|
| 199 | |
---|
| 200 | std::istringstream &operator>>(std::istringstream &in, GOPEntry &entry) //input |
---|
| 201 | { |
---|
| 202 | in>>entry.m_sliceType; |
---|
| 203 | in>>entry.m_POC; |
---|
| 204 | in>>entry.m_QPOffset; |
---|
| 205 | in>>entry.m_QPFactor; |
---|
| 206 | in>>entry.m_tcOffsetDiv2; |
---|
| 207 | in>>entry.m_betaOffsetDiv2; |
---|
| 208 | in>>entry.m_temporalId; |
---|
| 209 | in>>entry.m_numRefPicsActive; |
---|
| 210 | in>>entry.m_numRefPics; |
---|
| 211 | for ( Int i = 0; i < entry.m_numRefPics; i++ ) |
---|
| 212 | { |
---|
| 213 | in>>entry.m_referencePics[i]; |
---|
| 214 | } |
---|
| 215 | in>>entry.m_interRPSPrediction; |
---|
| 216 | #if AUTO_INTER_RPS |
---|
| 217 | if (entry.m_interRPSPrediction==1) |
---|
| 218 | { |
---|
| 219 | in>>entry.m_deltaRPS; |
---|
| 220 | in>>entry.m_numRefIdc; |
---|
| 221 | for ( Int i = 0; i < entry.m_numRefIdc; i++ ) |
---|
| 222 | { |
---|
| 223 | in>>entry.m_refIdc[i]; |
---|
| 224 | } |
---|
| 225 | } |
---|
| 226 | else if (entry.m_interRPSPrediction==2) |
---|
| 227 | { |
---|
| 228 | in>>entry.m_deltaRPS; |
---|
| 229 | } |
---|
| 230 | #else |
---|
| 231 | if (entry.m_interRPSPrediction) |
---|
| 232 | { |
---|
| 233 | in>>entry.m_deltaRPS; |
---|
| 234 | in>>entry.m_numRefIdc; |
---|
| 235 | for ( Int i = 0; i < entry.m_numRefIdc; i++ ) |
---|
| 236 | { |
---|
| 237 | in>>entry.m_refIdc[i]; |
---|
| 238 | } |
---|
| 239 | } |
---|
| 240 | #endif |
---|
| 241 | return in; |
---|
| 242 | } |
---|
| 243 | |
---|
[494] | 244 | #if AUXILIARY_PICTURES |
---|
| 245 | static inline ChromaFormat numberToChromaFormat(const Int val) |
---|
| 246 | { |
---|
| 247 | switch (val) |
---|
| 248 | { |
---|
| 249 | case 400: return CHROMA_400; break; |
---|
| 250 | case 420: return CHROMA_420; break; |
---|
| 251 | case 422: return CHROMA_422; break; |
---|
| 252 | case 444: return CHROMA_444; break; |
---|
| 253 | default: return NUM_CHROMA_FORMAT; |
---|
| 254 | } |
---|
| 255 | } |
---|
| 256 | #endif |
---|
| 257 | |
---|
[313] | 258 | #if SVC_EXTENSION |
---|
| 259 | void TAppEncCfg::getDirFilename(string& filename, string& dir, const string path) |
---|
| 260 | { |
---|
| 261 | size_t pos = path.find_last_of("\\"); |
---|
| 262 | if(pos != std::string::npos) |
---|
| 263 | { |
---|
| 264 | filename.assign(path.begin() + pos + 1, path.end()); |
---|
| 265 | dir.assign(path.begin(), path.begin() + pos + 1); |
---|
| 266 | } |
---|
| 267 | else |
---|
| 268 | { |
---|
| 269 | pos = path.find_last_of("/"); |
---|
| 270 | if(pos != std::string::npos) |
---|
| 271 | { |
---|
| 272 | filename.assign(path.begin() + pos + 1, path.end()); |
---|
| 273 | dir.assign(path.begin(), path.begin() + pos + 1); |
---|
| 274 | } |
---|
| 275 | else |
---|
| 276 | { |
---|
| 277 | filename = path; |
---|
| 278 | dir.assign(""); |
---|
| 279 | } |
---|
| 280 | } |
---|
| 281 | } |
---|
| 282 | #endif |
---|
| 283 | |
---|
| 284 | static const struct MapStrToProfile { |
---|
| 285 | const Char* str; |
---|
| 286 | Profile::Name value; |
---|
| 287 | } strToProfile[] = { |
---|
| 288 | {"none", Profile::NONE}, |
---|
| 289 | {"main", Profile::MAIN}, |
---|
| 290 | {"main10", Profile::MAIN10}, |
---|
| 291 | {"main-still-picture", Profile::MAINSTILLPICTURE}, |
---|
| 292 | }; |
---|
| 293 | |
---|
| 294 | static const struct MapStrToTier { |
---|
| 295 | const Char* str; |
---|
| 296 | Level::Tier value; |
---|
| 297 | } strToTier[] = { |
---|
| 298 | {"main", Level::MAIN}, |
---|
| 299 | {"high", Level::HIGH}, |
---|
| 300 | }; |
---|
| 301 | |
---|
| 302 | static const struct MapStrToLevel { |
---|
| 303 | const Char* str; |
---|
| 304 | Level::Name value; |
---|
| 305 | } strToLevel[] = { |
---|
| 306 | {"none",Level::NONE}, |
---|
| 307 | {"1", Level::LEVEL1}, |
---|
| 308 | {"2", Level::LEVEL2}, |
---|
| 309 | {"2.1", Level::LEVEL2_1}, |
---|
| 310 | {"3", Level::LEVEL3}, |
---|
| 311 | {"3.1", Level::LEVEL3_1}, |
---|
| 312 | {"4", Level::LEVEL4}, |
---|
| 313 | {"4.1", Level::LEVEL4_1}, |
---|
| 314 | {"5", Level::LEVEL5}, |
---|
| 315 | {"5.1", Level::LEVEL5_1}, |
---|
| 316 | {"5.2", Level::LEVEL5_2}, |
---|
| 317 | {"6", Level::LEVEL6}, |
---|
| 318 | {"6.1", Level::LEVEL6_1}, |
---|
| 319 | {"6.2", Level::LEVEL6_2}, |
---|
| 320 | }; |
---|
| 321 | |
---|
| 322 | template<typename T, typename P> |
---|
| 323 | static istream& readStrToEnum(P map[], unsigned long mapLen, istream &in, T &val) |
---|
| 324 | { |
---|
| 325 | string str; |
---|
| 326 | in >> str; |
---|
| 327 | |
---|
| 328 | for (Int i = 0; i < mapLen; i++) |
---|
| 329 | { |
---|
| 330 | if (str == map[i].str) |
---|
| 331 | { |
---|
| 332 | val = map[i].value; |
---|
| 333 | goto found; |
---|
| 334 | } |
---|
| 335 | } |
---|
| 336 | /* not found */ |
---|
| 337 | in.setstate(ios::failbit); |
---|
| 338 | found: |
---|
| 339 | return in; |
---|
| 340 | } |
---|
| 341 | |
---|
| 342 | static istream& operator>>(istream &in, Profile::Name &profile) |
---|
| 343 | { |
---|
| 344 | return readStrToEnum(strToProfile, sizeof(strToProfile)/sizeof(*strToProfile), in, profile); |
---|
| 345 | } |
---|
| 346 | |
---|
| 347 | static istream& operator>>(istream &in, Level::Tier &tier) |
---|
| 348 | { |
---|
| 349 | return readStrToEnum(strToTier, sizeof(strToTier)/sizeof(*strToTier), in, tier); |
---|
| 350 | } |
---|
| 351 | |
---|
| 352 | static istream& operator>>(istream &in, Level::Name &level) |
---|
| 353 | { |
---|
| 354 | return readStrToEnum(strToLevel, sizeof(strToLevel)/sizeof(*strToLevel), in, level); |
---|
| 355 | } |
---|
| 356 | |
---|
| 357 | // ==================================================================================================================== |
---|
| 358 | // Public member functions |
---|
| 359 | // ==================================================================================================================== |
---|
| 360 | |
---|
| 361 | /** \param argc number of arguments |
---|
| 362 | \param argv array of arguments |
---|
| 363 | \retval true when success |
---|
| 364 | */ |
---|
| 365 | Bool TAppEncCfg::parseCfg( Int argc, Char* argv[] ) |
---|
| 366 | { |
---|
| 367 | Bool do_help = false; |
---|
| 368 | |
---|
| 369 | #if SVC_EXTENSION |
---|
[442] | 370 | string cfg_LayerCfgFile [MAX_LAYERS]; |
---|
[313] | 371 | string cfg_BitstreamFile; |
---|
[442] | 372 | string* cfg_InputFile [MAX_LAYERS]; |
---|
| 373 | string* cfg_ReconFile [MAX_LAYERS]; |
---|
| 374 | Double* cfg_fQP [MAX_LAYERS]; |
---|
| 375 | #if REPN_FORMAT_IN_VPS |
---|
| 376 | Int* cfg_repFormatIdx [MAX_LAYERS]; |
---|
| 377 | #endif |
---|
[313] | 378 | Int* cfg_SourceWidth [MAX_LAYERS]; |
---|
| 379 | Int* cfg_SourceHeight [MAX_LAYERS]; |
---|
| 380 | Int* cfg_FrameRate [MAX_LAYERS]; |
---|
| 381 | Int* cfg_IntraPeriod [MAX_LAYERS]; |
---|
| 382 | Int* cfg_conformanceMode [MAX_LAYERS]; |
---|
[494] | 383 | #if LAYER_CTB |
---|
| 384 | // coding unit (CU) definition |
---|
| 385 | UInt* cfg_uiMaxCUWidth[MAX_LAYERS]; ///< max. CU width in pixel |
---|
| 386 | UInt* cfg_uiMaxCUHeight[MAX_LAYERS]; ///< max. CU height in pixel |
---|
| 387 | UInt* cfg_uiMaxCUDepth[MAX_LAYERS]; ///< max. CU depth |
---|
| 388 | |
---|
| 389 | // transfom unit (TU) definition |
---|
| 390 | UInt* cfg_uiQuadtreeTULog2MaxSize[MAX_LAYERS]; |
---|
| 391 | UInt* cfg_uiQuadtreeTULog2MinSize[MAX_LAYERS]; |
---|
| 392 | |
---|
| 393 | UInt* cfg_uiQuadtreeTUMaxDepthInter[MAX_LAYERS]; |
---|
| 394 | UInt* cfg_uiQuadtreeTUMaxDepthIntra[MAX_LAYERS]; |
---|
| 395 | #endif |
---|
| 396 | #if AUXILIARY_PICTURES |
---|
| 397 | Int cfg_tmpChromaFormatIDC [MAX_LAYERS]; |
---|
| 398 | Int cfg_tmpInputChromaFormat[MAX_LAYERS]; |
---|
| 399 | Int* cfg_auxId [MAX_LAYERS]; |
---|
| 400 | #endif |
---|
[313] | 401 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
| 402 | Int* cfg_numSamplePredRefLayers [MAX_LAYERS]; |
---|
| 403 | string cfg_samplePredRefLayerIds [MAX_LAYERS]; |
---|
| 404 | string* cfg_samplePredRefLayerIdsPtr[MAX_LAYERS]; |
---|
| 405 | Int* cfg_numMotionPredRefLayers [MAX_LAYERS]; |
---|
| 406 | string cfg_motionPredRefLayerIds [MAX_LAYERS]; |
---|
| 407 | string* cfg_motionPredRefLayerIdsPtr[MAX_LAYERS]; |
---|
| 408 | Int* cfg_numActiveRefLayers [MAX_LAYERS]; |
---|
| 409 | string cfg_predLayerIds [MAX_LAYERS]; |
---|
| 410 | string* cfg_predLayerIdsPtr [MAX_LAYERS]; |
---|
| 411 | #endif |
---|
[540] | 412 | #if O0098_SCALED_REF_LAYER_ID |
---|
| 413 | string cfg_scaledRefLayerId [MAX_LAYERS]; |
---|
| 414 | #endif |
---|
[313] | 415 | string cfg_scaledRefLayerLeftOffset [MAX_LAYERS]; |
---|
| 416 | string cfg_scaledRefLayerTopOffset [MAX_LAYERS]; |
---|
| 417 | string cfg_scaledRefLayerRightOffset [MAX_LAYERS]; |
---|
| 418 | string cfg_scaledRefLayerBottomOffset [MAX_LAYERS]; |
---|
| 419 | Int* cfg_numScaledRefLayerOffsets[MAX_LAYERS]; |
---|
[906] | 420 | #if REF_REGION_OFFSET |
---|
| 421 | string cfg_scaledRefLayerOffsetPresentFlag [MAX_LAYERS]; |
---|
| 422 | string cfg_refRegionOffsetPresentFlag [MAX_LAYERS]; |
---|
| 423 | string cfg_refRegionLeftOffset [MAX_LAYERS]; |
---|
| 424 | string cfg_refRegionTopOffset [MAX_LAYERS]; |
---|
| 425 | string cfg_refRegionRightOffset [MAX_LAYERS]; |
---|
| 426 | string cfg_refRegionBottomOffset [MAX_LAYERS]; |
---|
| 427 | #endif |
---|
| 428 | #if R0209_GENERIC_PHASE |
---|
| 429 | string cfg_resamplePhaseSetPresentFlag [MAX_LAYERS]; |
---|
| 430 | string cfg_phaseHorLuma [MAX_LAYERS]; |
---|
| 431 | string cfg_phaseVerLuma [MAX_LAYERS]; |
---|
| 432 | string cfg_phaseHorChroma [MAX_LAYERS]; |
---|
| 433 | string cfg_phaseVerChroma [MAX_LAYERS]; |
---|
| 434 | #else |
---|
[644] | 435 | #if P0312_VERT_PHASE_ADJ |
---|
| 436 | string cfg_vertPhasePositionEnableFlag[MAX_LAYERS]; |
---|
| 437 | #endif |
---|
[906] | 438 | #endif |
---|
[313] | 439 | |
---|
[540] | 440 | #if O0098_SCALED_REF_LAYER_ID |
---|
| 441 | string* cfg_scaledRefLayerIdPtr [MAX_LAYERS]; |
---|
| 442 | #endif |
---|
[313] | 443 | string* cfg_scaledRefLayerLeftOffsetPtr [MAX_LAYERS]; |
---|
| 444 | string* cfg_scaledRefLayerTopOffsetPtr [MAX_LAYERS]; |
---|
| 445 | string* cfg_scaledRefLayerRightOffsetPtr [MAX_LAYERS]; |
---|
| 446 | string* cfg_scaledRefLayerBottomOffsetPtr [MAX_LAYERS]; |
---|
[906] | 447 | #if REF_REGION_OFFSET |
---|
| 448 | string* cfg_scaledRefLayerOffsetPresentFlagPtr [MAX_LAYERS]; |
---|
| 449 | string* cfg_refRegionOffsetPresentFlagPtr [MAX_LAYERS]; |
---|
| 450 | string* cfg_refRegionLeftOffsetPtr [MAX_LAYERS]; |
---|
| 451 | string* cfg_refRegionTopOffsetPtr [MAX_LAYERS]; |
---|
| 452 | string* cfg_refRegionRightOffsetPtr [MAX_LAYERS]; |
---|
| 453 | string* cfg_refRegionBottomOffsetPtr [MAX_LAYERS]; |
---|
| 454 | #endif |
---|
| 455 | #if R0209_GENERIC_PHASE |
---|
| 456 | string* cfg_resamplePhaseSetPresentFlagPtr [MAX_LAYERS]; |
---|
| 457 | string* cfg_phaseHorLumaPtr [MAX_LAYERS]; |
---|
| 458 | string* cfg_phaseVerLumaPtr [MAX_LAYERS]; |
---|
| 459 | string* cfg_phaseHorChromaPtr [MAX_LAYERS]; |
---|
| 460 | string* cfg_phaseVerChromaPtr [MAX_LAYERS]; |
---|
| 461 | #endif |
---|
[644] | 462 | #if P0312_VERT_PHASE_ADJ |
---|
| 463 | string* cfg_vertPhasePositionEnableFlagPtr[MAX_LAYERS]; |
---|
| 464 | #endif |
---|
| 465 | |
---|
[313] | 466 | #if RC_SHVC_HARMONIZATION |
---|
| 467 | Bool* cfg_RCEnableRateControl [MAX_LAYERS]; |
---|
| 468 | Int* cfg_RCTargetBitRate [MAX_LAYERS]; |
---|
| 469 | Bool* cfg_RCKeepHierarchicalBit[MAX_LAYERS]; |
---|
| 470 | Bool* cfg_RCLCULevelRC [MAX_LAYERS]; |
---|
| 471 | Bool* cfg_RCUseLCUSeparateModel[MAX_LAYERS]; |
---|
| 472 | Int* cfg_RCInitialQP [MAX_LAYERS]; |
---|
| 473 | Bool* cfg_RCForceIntraQP [MAX_LAYERS]; |
---|
| 474 | #endif |
---|
[494] | 475 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
| 476 | Int* cfg_InputBitDepthY [MAX_LAYERS]; |
---|
| 477 | Int* cfg_InternalBitDepthY [MAX_LAYERS]; |
---|
| 478 | Int* cfg_InputBitDepthC [MAX_LAYERS]; |
---|
| 479 | Int* cfg_InternalBitDepthC [MAX_LAYERS]; |
---|
| 480 | Int* cfg_OutputBitDepthY [MAX_LAYERS]; |
---|
| 481 | Int* cfg_OutputBitDepthC [MAX_LAYERS]; |
---|
| 482 | #endif |
---|
[442] | 483 | Int* cfg_maxTidIlRefPicsPlus1[MAX_LAYERS]; |
---|
[906] | 484 | #if Q0074_COLOUR_REMAPPING_SEI |
---|
| 485 | string* cfg_colourRemapSEIFile[MAX_LAYERS]; |
---|
| 486 | #endif |
---|
| 487 | Int* cfg_waveFrontSynchro[MAX_LAYERS]; |
---|
| 488 | |
---|
[313] | 489 | for(UInt layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 490 | { |
---|
| 491 | cfg_InputFile[layer] = &m_acLayerCfg[layer].m_cInputFile; |
---|
| 492 | cfg_ReconFile[layer] = &m_acLayerCfg[layer].m_cReconFile; |
---|
| 493 | cfg_fQP[layer] = &m_acLayerCfg[layer].m_fQP; |
---|
[906] | 494 | #if Q0074_COLOUR_REMAPPING_SEI |
---|
| 495 | cfg_colourRemapSEIFile[layer] = &m_acLayerCfg[layer].m_colourRemapSEIFile; |
---|
| 496 | #endif |
---|
[442] | 497 | #if REPN_FORMAT_IN_VPS |
---|
| 498 | cfg_repFormatIdx[layer] = &m_acLayerCfg[layer].m_repFormatIdx; |
---|
| 499 | #endif |
---|
[313] | 500 | cfg_SourceWidth[layer] = &m_acLayerCfg[layer].m_iSourceWidth; |
---|
| 501 | cfg_SourceHeight[layer] = &m_acLayerCfg[layer].m_iSourceHeight; |
---|
| 502 | cfg_FrameRate[layer] = &m_acLayerCfg[layer].m_iFrameRate; |
---|
| 503 | cfg_IntraPeriod[layer] = &m_acLayerCfg[layer].m_iIntraPeriod; |
---|
| 504 | cfg_conformanceMode[layer] = &m_acLayerCfg[layer].m_conformanceMode; |
---|
[494] | 505 | #if LAYER_CTB |
---|
| 506 | // coding unit (CU) definition |
---|
| 507 | cfg_uiMaxCUWidth[layer] = &m_acLayerCfg[layer].m_uiMaxCUWidth; |
---|
| 508 | cfg_uiMaxCUHeight[layer] = &m_acLayerCfg[layer].m_uiMaxCUHeight; |
---|
| 509 | cfg_uiMaxCUDepth[layer] = &m_acLayerCfg[layer].m_uiMaxCUDepth; |
---|
| 510 | |
---|
| 511 | // transfom unit (TU) definition. |
---|
| 512 | cfg_uiQuadtreeTULog2MaxSize[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTULog2MaxSize; |
---|
| 513 | cfg_uiQuadtreeTULog2MinSize[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTULog2MinSize; |
---|
| 514 | |
---|
| 515 | cfg_uiQuadtreeTUMaxDepthInter[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthInter; |
---|
| 516 | cfg_uiQuadtreeTUMaxDepthIntra[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthIntra; |
---|
| 517 | #endif |
---|
[313] | 518 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
| 519 | cfg_numSamplePredRefLayers [layer] = &m_acLayerCfg[layer].m_numSamplePredRefLayers; |
---|
| 520 | cfg_samplePredRefLayerIdsPtr[layer] = &cfg_samplePredRefLayerIds[layer]; |
---|
| 521 | cfg_numMotionPredRefLayers [layer] = &m_acLayerCfg[layer].m_numMotionPredRefLayers; |
---|
| 522 | cfg_motionPredRefLayerIdsPtr[layer] = &cfg_motionPredRefLayerIds[layer]; |
---|
| 523 | cfg_numActiveRefLayers [layer] = &m_acLayerCfg[layer].m_numActiveRefLayers; |
---|
| 524 | cfg_predLayerIdsPtr [layer] = &cfg_predLayerIds[layer]; |
---|
| 525 | #endif |
---|
| 526 | cfg_numScaledRefLayerOffsets [layer] = &m_acLayerCfg[layer].m_numScaledRefLayerOffsets; |
---|
[906] | 527 | cfg_waveFrontSynchro[layer] = &m_acLayerCfg[layer].m_waveFrontSynchro; |
---|
[313] | 528 | for(Int i = 0; i < MAX_LAYERS; i++) |
---|
| 529 | { |
---|
[540] | 530 | #if O0098_SCALED_REF_LAYER_ID |
---|
[644] | 531 | cfg_scaledRefLayerIdPtr [layer] = &cfg_scaledRefLayerId[layer]; |
---|
[540] | 532 | #endif |
---|
[644] | 533 | cfg_scaledRefLayerLeftOffsetPtr [layer] = &cfg_scaledRefLayerLeftOffset[layer]; |
---|
| 534 | cfg_scaledRefLayerTopOffsetPtr [layer] = &cfg_scaledRefLayerTopOffset[layer]; |
---|
| 535 | cfg_scaledRefLayerRightOffsetPtr [layer] = &cfg_scaledRefLayerRightOffset[layer]; |
---|
[313] | 536 | cfg_scaledRefLayerBottomOffsetPtr[layer] = &cfg_scaledRefLayerBottomOffset[layer]; |
---|
[644] | 537 | #if P0312_VERT_PHASE_ADJ |
---|
| 538 | cfg_vertPhasePositionEnableFlagPtr[layer] = &cfg_vertPhasePositionEnableFlag[layer]; |
---|
| 539 | #endif |
---|
[906] | 540 | #if REF_REGION_OFFSET |
---|
| 541 | cfg_scaledRefLayerOffsetPresentFlagPtr [layer] = &cfg_scaledRefLayerOffsetPresentFlag [layer]; |
---|
| 542 | cfg_refRegionOffsetPresentFlagPtr [layer] = &cfg_refRegionOffsetPresentFlag [layer]; |
---|
| 543 | cfg_refRegionLeftOffsetPtr [layer] = &cfg_refRegionLeftOffset [layer]; |
---|
| 544 | cfg_refRegionTopOffsetPtr [layer] = &cfg_refRegionTopOffset [layer]; |
---|
| 545 | cfg_refRegionRightOffsetPtr [layer] = &cfg_refRegionRightOffset [layer]; |
---|
| 546 | cfg_refRegionBottomOffsetPtr[layer] = &cfg_refRegionBottomOffset[layer]; |
---|
| 547 | #endif |
---|
| 548 | #if R0209_GENERIC_PHASE |
---|
| 549 | cfg_resamplePhaseSetPresentFlagPtr [layer] = &cfg_resamplePhaseSetPresentFlag [layer]; |
---|
| 550 | cfg_phaseHorLumaPtr [layer] = &cfg_phaseHorLuma [layer]; |
---|
| 551 | cfg_phaseVerLumaPtr [layer] = &cfg_phaseVerLuma [layer]; |
---|
| 552 | cfg_phaseHorChromaPtr [layer] = &cfg_phaseHorChroma [layer]; |
---|
| 553 | cfg_phaseVerChromaPtr [layer] = &cfg_phaseVerChroma [layer]; |
---|
| 554 | #endif |
---|
[313] | 555 | } |
---|
| 556 | #if RC_SHVC_HARMONIZATION |
---|
| 557 | cfg_RCEnableRateControl[layer] = &m_acLayerCfg[layer].m_RCEnableRateControl; |
---|
| 558 | cfg_RCTargetBitRate[layer] = &m_acLayerCfg[layer].m_RCTargetBitrate; |
---|
| 559 | cfg_RCKeepHierarchicalBit[layer] = &m_acLayerCfg[layer].m_RCKeepHierarchicalBit; |
---|
| 560 | cfg_RCLCULevelRC[layer] = &m_acLayerCfg[layer].m_RCLCULevelRC; |
---|
| 561 | cfg_RCUseLCUSeparateModel[layer] = &m_acLayerCfg[layer].m_RCUseLCUSeparateModel; |
---|
| 562 | cfg_RCInitialQP[layer] = &m_acLayerCfg[layer].m_RCInitialQP; |
---|
| 563 | cfg_RCForceIntraQP[layer] = &m_acLayerCfg[layer].m_RCForceIntraQP; |
---|
| 564 | #endif |
---|
[494] | 565 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
| 566 | cfg_InputBitDepthY [layer] = &m_acLayerCfg[layer].m_inputBitDepthY; |
---|
| 567 | cfg_InternalBitDepthY[layer] = &m_acLayerCfg[layer].m_internalBitDepthY; |
---|
| 568 | cfg_InputBitDepthC [layer] = &m_acLayerCfg[layer].m_inputBitDepthC; |
---|
| 569 | cfg_InternalBitDepthC[layer] = &m_acLayerCfg[layer].m_internalBitDepthC; |
---|
| 570 | cfg_OutputBitDepthY [layer] = &m_acLayerCfg[layer].m_outputBitDepthY; |
---|
| 571 | cfg_OutputBitDepthC [layer] = &m_acLayerCfg[layer].m_outputBitDepthC; |
---|
| 572 | #endif |
---|
[815] | 573 | cfg_maxTidIlRefPicsPlus1[layer] = &m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1; |
---|
[494] | 574 | #if AUXILIARY_PICTURES |
---|
| 575 | cfg_auxId[layer] = &m_acLayerCfg[layer].m_auxId; |
---|
| 576 | #endif |
---|
[313] | 577 | } |
---|
[815] | 578 | #if Q0078_ADD_LAYER_SETS |
---|
| 579 | Int* cfg_numLayerInIdList[MAX_VPS_LAYER_SETS_PLUS1]; |
---|
| 580 | string cfg_layerSetLayerIdList[MAX_VPS_LAYER_SETS_PLUS1]; |
---|
| 581 | string* cfg_layerSetLayerIdListPtr[MAX_VPS_LAYER_SETS_PLUS1]; |
---|
| 582 | Int* cfg_numHighestLayerIdx[MAX_VPS_LAYER_SETS_PLUS1]; |
---|
| 583 | string cfg_highestLayerIdx[MAX_VPS_LAYER_SETS_PLUS1]; |
---|
| 584 | string* cfg_highestLayerIdxPtr[MAX_VPS_LAYER_SETS_PLUS1]; |
---|
| 585 | for (UInt i = 0; i < MAX_VPS_LAYER_SETS_PLUS1; i++) |
---|
| 586 | { |
---|
| 587 | cfg_numLayerInIdList[i] = &m_numLayerInIdList[i]; |
---|
| 588 | cfg_layerSetLayerIdListPtr[i] = &cfg_layerSetLayerIdList[i]; |
---|
| 589 | cfg_highestLayerIdxPtr[i] = &cfg_highestLayerIdx[i]; |
---|
| 590 | cfg_numHighestLayerIdx[i] = &m_numHighestLayerIdx[i]; |
---|
| 591 | } |
---|
| 592 | #endif |
---|
[906] | 593 | #if OUTPUT_LAYER_SETS_CONFIG |
---|
| 594 | string* cfg_numLayersInOutputLayerSet = new string; |
---|
| 595 | string* cfg_listOfOutputLayers = new string[MAX_VPS_OUTPUT_LAYER_SETS_PLUS1]; |
---|
| 596 | string* cfg_outputLayerSetIdx = new string; |
---|
| 597 | #endif |
---|
[313] | 598 | #if AVC_BASE |
---|
| 599 | string cfg_BLInputFile; |
---|
| 600 | #endif |
---|
[442] | 601 | #if N0383_IL_CONSTRAINED_TILE_SETS_SEI |
---|
| 602 | string cfg_tileSets; |
---|
| 603 | #endif |
---|
[494] | 604 | #else //SVC_EXTENSION |
---|
[313] | 605 | string cfg_InputFile; |
---|
| 606 | string cfg_BitstreamFile; |
---|
| 607 | string cfg_ReconFile; |
---|
| 608 | string cfg_dQPFile; |
---|
[906] | 609 | #if Q0074_COLOUR_REMAPPING_SEI |
---|
| 610 | string cfg_colourRemapSEIFile; |
---|
| 611 | #endif |
---|
[494] | 612 | #endif //SVC_EXTENSION |
---|
[906] | 613 | string cfgColumnWidth; |
---|
| 614 | string cfgRowHeight; |
---|
[313] | 615 | string cfg_ScalingListFile; |
---|
| 616 | string cfg_startOfCodedInterval; |
---|
| 617 | string cfg_codedPivotValue; |
---|
| 618 | string cfg_targetPivotValue; |
---|
[815] | 619 | #if P0050_KNEE_FUNCTION_SEI |
---|
| 620 | string cfg_kneeSEIInputKneePointValue; |
---|
| 621 | string cfg_kneeSEIOutputKneePointValue; |
---|
| 622 | #endif |
---|
[906] | 623 | |
---|
[313] | 624 | po::Options opts; |
---|
| 625 | opts.addOptions() |
---|
| 626 | ("help", do_help, false, "this help text") |
---|
| 627 | ("c", po::parseConfigFile, "configuration file name") |
---|
| 628 | |
---|
| 629 | // File, I/O and source parameters |
---|
| 630 | #if SVC_EXTENSION |
---|
| 631 | ("InputFile%d,-i%d", cfg_InputFile, string(""), MAX_LAYERS, "original YUV input file name for layer %d") |
---|
| 632 | ("ReconFile%d,-o%d", cfg_ReconFile, string(""), MAX_LAYERS, "reconstruction YUV input file name for layer %d") |
---|
| 633 | ("LayerConfig%d,-lc%d", cfg_LayerCfgFile, string(""), MAX_LAYERS, "layer %d configuration file name") |
---|
| 634 | ("SourceWidth%d,-wdt%d", cfg_SourceWidth, 0, MAX_LAYERS, "Source picture width for layer %d") |
---|
| 635 | ("SourceHeight%d,-hgt%d", cfg_SourceHeight, 0, MAX_LAYERS, "Source picture height for layer %d") |
---|
| 636 | ("FrameRate%d,-fr%d", cfg_FrameRate, 0, MAX_LAYERS, "Frame rate for layer %d") |
---|
| 637 | ("LambdaModifier%d,-LM%d", m_adLambdaModifier, ( double )1.0, MAX_TLAYER, "Lambda modifier for temporal layer %d") |
---|
[494] | 638 | #if O0215_PHASE_ALIGNMENT |
---|
| 639 | ("PhaseAlignment", m_phaseAlignFlag, false, "indicate the sample location alignment between layers (0: zero position aligned, 1: central position aligned)") |
---|
| 640 | #endif |
---|
[442] | 641 | #if REPN_FORMAT_IN_VPS |
---|
| 642 | ("RepFormatIdx%d", cfg_repFormatIdx, -1, MAX_LAYERS, "Index to the representation format structure used from the VPS") |
---|
| 643 | #endif |
---|
[313] | 644 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
| 645 | ("NumSamplePredRefLayers%d",cfg_numSamplePredRefLayers, -1, MAX_LAYERS, "Number of sample prediction reference layers") |
---|
| 646 | ("SamplePredRefLayerIds%d", cfg_samplePredRefLayerIdsPtr, string(""), MAX_LAYERS, "sample pred reference layer IDs") |
---|
| 647 | ("NumMotionPredRefLayers%d",cfg_numMotionPredRefLayers, -1, MAX_LAYERS, "Number of motion prediction reference layers") |
---|
| 648 | ("MotionPredRefLayerIds%d", cfg_motionPredRefLayerIdsPtr, string(""), MAX_LAYERS, "motion pred reference layer IDs") |
---|
| 649 | ("NumActiveRefLayers%d", cfg_numActiveRefLayers, -1, MAX_LAYERS, "Number of active reference layers") |
---|
| 650 | ("PredLayerIds%d", cfg_predLayerIdsPtr, string(""), MAX_LAYERS, "inter-layer prediction layer IDs") |
---|
| 651 | #endif |
---|
| 652 | ("NumLayers", m_numLayers, 1, "Number of layers to code") |
---|
[815] | 653 | #if Q0078_ADD_LAYER_SETS |
---|
[906] | 654 | #if OUTPUT_LAYER_SETS_CONFIG |
---|
| 655 | ("NumLayerSets", m_numLayerSets, 1, "Number of layer sets") |
---|
| 656 | #else |
---|
[815] | 657 | ("NumLayerSets", m_numLayerSets, 0, "Number of layer sets") |
---|
[906] | 658 | #endif |
---|
[815] | 659 | ("NumLayerInIdList%d", cfg_numLayerInIdList, 0, MAX_VPS_LAYER_ID_PLUS1, "Number of layers in the set") |
---|
| 660 | ("LayerSetLayerIdList%d", cfg_layerSetLayerIdListPtr, string(""), MAX_VPS_LAYER_ID_PLUS1, "Layer IDs for the set") |
---|
| 661 | ("NumAddLayerSets", m_numAddLayerSets, 0, "Number of additional layer sets") |
---|
| 662 | ("NumHighestLayerIdx%d", cfg_numHighestLayerIdx, 0, MAX_VPS_LAYER_ID_PLUS1, "Number of highest layer idx") |
---|
| 663 | ("HighestLayerIdx%d", cfg_highestLayerIdxPtr, string(""), MAX_VPS_LAYER_ID_PLUS1, "Highest layer idx for an additional layer set") |
---|
| 664 | #endif |
---|
[906] | 665 | #if OUTPUT_LAYER_SETS_CONFIG |
---|
| 666 | ("DefaultTargetOutputLayerIdc", m_defaultTargetOutputLayerIdc, 1, "Default target output layers. 0: All layers are output layer, 1: Only highest layer is output layer, 2 or 3: No default output layers") |
---|
| 667 | ("NumOutputLayerSets", m_numOutputLayerSets, 1, "Number of output layer sets excluding the 0-th output layer set") |
---|
| 668 | ("NumLayersInOutputLayerSet", cfg_numLayersInOutputLayerSet, string(""), 1 , "List containing number of output layers in the output layer sets") |
---|
| 669 | ("ListOfOutputLayers%d", cfg_listOfOutputLayers, string(""), MAX_VPS_LAYER_ID_PLUS1, "Layer IDs for the set, in terms of layer ID in the output layer set Range: [0..NumLayersInOutputLayerSet-1]") |
---|
| 670 | ("OutputLayerSetIdx", cfg_outputLayerSetIdx, string(""), 1, "Corresponding layer set index, only for non-default output layer sets") |
---|
| 671 | #endif |
---|
[494] | 672 | #if AUXILIARY_PICTURES |
---|
| 673 | ("InputChromaFormat%d", cfg_tmpInputChromaFormat, 420, MAX_LAYERS, "InputChromaFormatIDC for layer %d") |
---|
| 674 | ("ChromaFormatIDC%d,-cf", cfg_tmpChromaFormatIDC, 420, MAX_LAYERS, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat) for layer %d") |
---|
| 675 | ("AuxId%d", cfg_auxId, 0, MAX_LAYERS, "Auxilary picture ID for layer %d (0: Not aux pic, 1: Alpha plane, 2: Depth picture, 3: Cb enh, 4: Cr enh") |
---|
| 676 | #endif |
---|
[313] | 677 | ("ConformanceMode%d", cfg_conformanceMode,0, MAX_LAYERS, "Window conformance mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping") |
---|
[442] | 678 | ("ScalabilityMask1", m_scalabilityMask[1], 0, "scalability_mask[1] (multiview)") |
---|
| 679 | ("ScalabilityMask2", m_scalabilityMask[2], 1, "scalability_mask[2] (scalable)" ) |
---|
[494] | 680 | #if AUXILIARY_PICTURES |
---|
| 681 | ("ScalabilityMask3", m_scalabilityMask[3], 0, "scalability_mask[3] (auxiliary pictures)" ) |
---|
| 682 | #endif |
---|
[313] | 683 | ("BitstreamFile,b", cfg_BitstreamFile, string(""), "Bitstream output file name") |
---|
[494] | 684 | #if !O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
[313] | 685 | ("InputBitDepth", m_inputBitDepthY, 8, "Bit-depth of input file") |
---|
| 686 | ("OutputBitDepth", m_outputBitDepthY, 0, "Bit-depth of output file (default:InternalBitDepth)") |
---|
| 687 | ("InternalBitDepth", m_internalBitDepthY, 0, "Bit-depth the codec operates at. (default:InputBitDepth)" |
---|
| 688 | "If different to InputBitDepth, source data will be converted") |
---|
| 689 | ("InputBitDepthC", m_inputBitDepthC, 0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)") |
---|
| 690 | ("OutputBitDepthC", m_outputBitDepthC, 0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)") |
---|
| 691 | ("InternalBitDepthC", m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)") |
---|
[494] | 692 | #endif |
---|
[313] | 693 | ("NumScaledRefLayerOffsets%d", cfg_numScaledRefLayerOffsets, 0, MAX_LAYERS, "Number of scaled offset layer sets ") |
---|
[540] | 694 | #if O0098_SCALED_REF_LAYER_ID |
---|
| 695 | ("ScaledRefLayerId%d", cfg_scaledRefLayerIdPtr, string(""), MAX_LAYERS, "Layer ID of scaled base layer picture") |
---|
| 696 | #endif |
---|
[313] | 697 | ("ScaledRefLayerLeftOffset%d", cfg_scaledRefLayerLeftOffsetPtr, string(""), MAX_LAYERS, "Horizontal offset of top-left luma sample of scaled base layer picture with respect to" |
---|
| 698 | " top-left luma sample of the EL picture, in units of two luma samples") |
---|
| 699 | ("ScaledRefLayerTopOffset%d", cfg_scaledRefLayerTopOffsetPtr, string(""), MAX_LAYERS, "Vertical offset of top-left luma sample of scaled base layer picture with respect to" |
---|
| 700 | " top-left luma sample of the EL picture, in units of two luma samples") |
---|
| 701 | ("ScaledRefLayerRightOffset%d", cfg_scaledRefLayerRightOffsetPtr, string(""), MAX_LAYERS, "Horizontal offset of bottom-right luma sample of scaled base layer picture with respect to" |
---|
| 702 | " bottom-right luma sample of the EL picture, in units of two luma samples") |
---|
| 703 | ("ScaledRefLayerBottomOffset%d", cfg_scaledRefLayerBottomOffsetPtr,string(""), MAX_LAYERS, "Vertical offset of bottom-right luma sample of scaled base layer picture with respect to" |
---|
[644] | 704 | " bottom-right luma sample of the EL picture, in units of two luma samples") |
---|
[906] | 705 | #if REF_REGION_OFFSET |
---|
| 706 | ("ScaledRefLayerOffsetPresentFlag%d", cfg_scaledRefLayerOffsetPresentFlagPtr, string(""), MAX_LAYERS, "presense flag of scaled reference layer offsets") |
---|
| 707 | ("RefRegionOffsetPresentFlag%d", cfg_refRegionOffsetPresentFlagPtr, string(""), MAX_LAYERS, "presense flag of reference region offsets") |
---|
| 708 | ("RefRegionLeftOffset%d", cfg_refRegionLeftOffsetPtr, string(""), MAX_LAYERS, "Horizontal offset of top-left luma sample of ref region with respect to" |
---|
| 709 | " top-left luma sample of the BL picture, in units of two luma samples") |
---|
| 710 | ("RefRegionTopOffset%d", cfg_refRegionTopOffsetPtr, string(""), MAX_LAYERS, "Vertical offset of top-left luma sample of ref region with respect to" |
---|
| 711 | " top-left luma sample of the BL picture, in units of two luma samples") |
---|
| 712 | ("RefRegionRightOffset%d", cfg_refRegionRightOffsetPtr, string(""), MAX_LAYERS, "Horizontal offset of bottom-right luma sample of ref region with respect to" |
---|
| 713 | " bottom-right luma sample of the BL picture, in units of two luma samples") |
---|
| 714 | ("RefRegionBottomOffset%d", cfg_refRegionBottomOffsetPtr,string(""), MAX_LAYERS, "Vertical offset of bottom-right luma sample of ref region with respect to" |
---|
| 715 | " bottom-right luma sample of the BL picture, in units of two luma samples") |
---|
| 716 | #endif |
---|
| 717 | #if R0209_GENERIC_PHASE |
---|
| 718 | ("ResamplePhaseSetPresentFlag%d", cfg_resamplePhaseSetPresentFlagPtr, string(""), MAX_LAYERS, "presense flag of resample phase set") |
---|
| 719 | ("PhaseHorLuma%d", cfg_phaseHorLumaPtr, string(""), MAX_LAYERS, "luma shift in the horizontal direction used in resampling proces") |
---|
| 720 | ("PhaseVerLuma%d", cfg_phaseVerLumaPtr, string(""), MAX_LAYERS, "luma shift in the vertical direction used in resampling proces") |
---|
| 721 | ("PhaseHorChroma%d", cfg_phaseHorChromaPtr, string(""), MAX_LAYERS, "chroma shift in the horizontal direction used in resampling proces") |
---|
| 722 | ("PhaseVerChroma%d", cfg_phaseVerChromaPtr, string(""), MAX_LAYERS, "chroma shift in the vertical direction used in resampling proces") |
---|
| 723 | #endif |
---|
[644] | 724 | #if P0312_VERT_PHASE_ADJ |
---|
| 725 | ("VertPhasePositionEnableFlag%d", cfg_vertPhasePositionEnableFlagPtr,string(""), MAX_LAYERS, "VertPhasePositionEnableFlag for layer %d") |
---|
| 726 | #endif |
---|
[906] | 727 | #if Q0074_COLOUR_REMAPPING_SEI |
---|
| 728 | ("SEIColourRemappingInfoFile%d", cfg_colourRemapSEIFile, string(""), MAX_LAYERS, "Colour Remapping Information SEI parameters file name for layer %d") |
---|
| 729 | #endif |
---|
[494] | 730 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
| 731 | ("InputBitDepth%d", cfg_InputBitDepthY, 8, MAX_LAYERS, "Bit-depth of input file for layer %d") |
---|
| 732 | ("InternalBitDepth%d", cfg_InternalBitDepthY, 0, MAX_LAYERS, "Bit-depth the codec operates at. (default:InputBitDepth) for layer %d ") |
---|
| 733 | // "If different to InputBitDepth, source data will be converted") |
---|
| 734 | ("InputBitDepthC%d", cfg_InputBitDepthC, 0, MAX_LAYERS, "As per InputBitDepth but for chroma component. (default:InputBitDepth) for layer %d") |
---|
| 735 | ("InternalBitDepthC%d", cfg_InternalBitDepthC, 0, MAX_LAYERS, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth) for layer %d") |
---|
| 736 | ("OutputBitDepth%d", cfg_OutputBitDepthY, 0, MAX_LAYERS, "Bit-depth of output file (default:InternalBitDepth)") |
---|
| 737 | ("OutputBitDepthC%d", cfg_OutputBitDepthC, 0, MAX_LAYERS, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)") |
---|
[313] | 738 | #endif |
---|
[442] | 739 | ("MaxTidRefPresentFlag", m_maxTidRefPresentFlag, true, "max_tid_ref_present_flag (0: not present, 1: present(default)) " ) |
---|
| 740 | ("MaxTidIlRefPicsPlus1%d", cfg_maxTidIlRefPicsPlus1, 1, MAX_LAYERS, "allowed maximum temporal_id for inter-layer prediction") |
---|
[540] | 741 | #if O0223_PICTURE_TYPES_ALIGN_FLAG |
---|
| 742 | ("CrossLayerPictureTypeAlignFlag", m_crossLayerPictureTypeAlignFlag, true, "align picture type across layers" ) |
---|
| 743 | #endif |
---|
[588] | 744 | ("CrossLayerIrapAlignFlag", m_crossLayerIrapAlignFlag, true, "align IRAP across layers" ) |
---|
[644] | 745 | #if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG |
---|
| 746 | ("CrossLayerAlignedIdrOnlyFlag", m_crossLayerAlignedIdrOnlyFlag, true, "only idr for IRAP across layers" ) |
---|
| 747 | #endif |
---|
[588] | 748 | #if O0194_WEIGHTED_PREDICTION_CGS |
---|
| 749 | ("InterLayerWeightedPred", m_useInterLayerWeightedPred, false, "enable IL WP parameters estimation at encoder" ) |
---|
| 750 | #endif |
---|
[313] | 751 | #if AVC_BASE |
---|
[906] | 752 | #if VPS_AVC_BL_FLAG_REMOVAL |
---|
| 753 | ("NonHEVCBase,-nonhevc", m_nonHEVCBaseLayerFlag, 0, "BL is available but not internal") |
---|
| 754 | #else |
---|
[313] | 755 | ("AvcBase,-avc", m_avcBaseLayerFlag, 0, "avc_base_layer_flag") |
---|
[906] | 756 | #endif |
---|
[313] | 757 | ("InputBLFile,-ibl", cfg_BLInputFile, string(""), "Base layer rec YUV input file name") |
---|
| 758 | #endif |
---|
| 759 | ("EnableElRapB,-use-rap-b", m_elRapSliceBEnabled, 0, "Set ILP over base-layer I picture to B picture (default is P picture)") |
---|
[494] | 760 | #else //SVC_EXTENSION |
---|
[313] | 761 | ("InputFile,i", cfg_InputFile, string(""), "Original YUV input file name") |
---|
| 762 | ("BitstreamFile,b", cfg_BitstreamFile, string(""), "Bitstream output file name") |
---|
| 763 | ("ReconFile,o", cfg_ReconFile, string(""), "Reconstructed YUV output file name") |
---|
| 764 | ("SourceWidth,-wdt", m_iSourceWidth, 0, "Source picture width") |
---|
| 765 | ("SourceHeight,-hgt", m_iSourceHeight, 0, "Source picture height") |
---|
| 766 | ("InputBitDepth", m_inputBitDepthY, 8, "Bit-depth of input file") |
---|
| 767 | ("OutputBitDepth", m_outputBitDepthY, 0, "Bit-depth of output file (default:InternalBitDepth)") |
---|
| 768 | ("InternalBitDepth", m_internalBitDepthY, 0, "Bit-depth the codec operates at. (default:InputBitDepth)" |
---|
| 769 | "If different to InputBitDepth, source data will be converted") |
---|
| 770 | ("InputBitDepthC", m_inputBitDepthC, 0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)") |
---|
| 771 | ("OutputBitDepthC", m_outputBitDepthC, 0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)") |
---|
| 772 | ("InternalBitDepthC", m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)") |
---|
[494] | 773 | #if AUXILIARY_PICTURES |
---|
| 774 | ("InputChromaFormat", tmpInputChromaFormat, 420, "InputChromaFormatIDC") |
---|
| 775 | ("ChromaFormatIDC,-cf", tmpChromaFormat, 0, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat)") |
---|
| 776 | #endif |
---|
[906] | 777 | ("ConformanceMode", m_conformanceWindowMode, 0, "Deprecated alias of ConformanceWindowMode") |
---|
| 778 | ("ConformanceWindowMode", m_conformanceWindowMode, 0, "Window conformance mode (0: no window, 1:automatic padding, 2:padding, 3:conformance") |
---|
| 779 | ("HorizontalPadding,-pdx",m_aiPad[0], 0, "Horizontal source padding for conformance window mode 2") |
---|
| 780 | ("VerticalPadding,-pdy", m_aiPad[1], 0, "Vertical source padding for conformance window mode 2") |
---|
| 781 | ("ConfLeft", m_confWinLeft, 0, "Deprecated alias of ConfWinLeft") |
---|
| 782 | ("ConfRight", m_confWinRight, 0, "Deprecated alias of ConfWinRight") |
---|
| 783 | ("ConfTop", m_confWinTop, 0, "Deprecated alias of ConfWinTop") |
---|
| 784 | ("ConfBottom", m_confWinBottom, 0, "Deprecated alias of ConfWinBottom") |
---|
| 785 | ("ConfWinLeft", m_confWinLeft, 0, "Left offset for window conformance mode 3") |
---|
| 786 | ("ConfWinRight", m_confWinRight, 0, "Right offset for window conformance mode 3") |
---|
| 787 | ("ConfWinTop", m_confWinTop, 0, "Top offset for window conformance mode 3") |
---|
| 788 | ("ConfWinBottom", m_confWinBottom, 0, "Bottom offset for window conformance mode 3") |
---|
[313] | 789 | ("FrameRate,-fr", m_iFrameRate, 0, "Frame rate") |
---|
[906] | 790 | #if Q0074_COLOUR_REMAPPING_SEI |
---|
| 791 | ("SEIColourRemappingInfoFile", cfg_colourRemapSEIFile, string(""), "Colour Remapping Information SEI parameters file name") |
---|
| 792 | #endif |
---|
[494] | 793 | #endif //SVC_EXTENSION |
---|
[595] | 794 | ("FrameSkip,-fs", m_FrameSkip, 0u, "Number of frames to skip at start of input YUV") |
---|
| 795 | ("FramesToBeEncoded,f", m_framesToBeEncoded, 0, "Number of frames to be encoded (default=all)") |
---|
[442] | 796 | |
---|
| 797 | //Field coding parameters |
---|
| 798 | ("FieldCoding", m_isField, false, "Signals if it's a field based coding") |
---|
| 799 | ("TopFieldFirst, Tff", m_isTopFieldFirst, false, "In case of field based coding, signals whether if it's a top field first or not") |
---|
[595] | 800 | |
---|
[313] | 801 | // Profile and level |
---|
| 802 | ("Profile", m_profile, Profile::NONE, "Profile to be used when encoding (Incomplete)") |
---|
| 803 | ("Level", m_level, Level::NONE, "Level limit to be used, eg 5.1 (Incomplete)") |
---|
| 804 | ("Tier", m_levelTier, Level::MAIN, "Tier to use for interpretation of --Level") |
---|
| 805 | |
---|
| 806 | ("ProgressiveSource", m_progressiveSourceFlag, false, "Indicate that source is progressive") |
---|
| 807 | ("InterlacedSource", m_interlacedSourceFlag, false, "Indicate that source is interlaced") |
---|
| 808 | ("NonPackedSource", m_nonPackedConstraintFlag, false, "Indicate that source does not contain frame packing") |
---|
| 809 | ("FrameOnly", m_frameOnlyConstraintFlag, false, "Indicate that the bitstream contains only frames") |
---|
| 810 | |
---|
[494] | 811 | #if LAYER_CTB |
---|
[313] | 812 | // Unit definition parameters |
---|
[494] | 813 | ("MaxCUWidth%d", cfg_uiMaxCUWidth, 64u, MAX_LAYERS, "Maximum CU width") |
---|
| 814 | ("MaxCUHeight%d", cfg_uiMaxCUHeight, 64u, MAX_LAYERS, "Maximum CU height") |
---|
| 815 | // todo: remove defaults from MaxCUSize |
---|
| 816 | ("MaxCUSize%d,s%d", cfg_uiMaxCUWidth, 64u, MAX_LAYERS, "Maximum CU size") |
---|
| 817 | ("MaxCUSize%d,s%d", cfg_uiMaxCUHeight, 64u, MAX_LAYERS, "Maximum CU size") |
---|
| 818 | ("MaxPartitionDepth%d,h%d", cfg_uiMaxCUDepth, 4u, MAX_LAYERS, "CU depth") |
---|
| 819 | |
---|
| 820 | ("QuadtreeTULog2MaxSize%d", cfg_uiQuadtreeTULog2MaxSize, 6u, MAX_LAYERS, "Maximum TU size in logarithm base 2") |
---|
| 821 | ("QuadtreeTULog2MinSize%d", cfg_uiQuadtreeTULog2MinSize, 2u, MAX_LAYERS, "Minimum TU size in logarithm base 2") |
---|
| 822 | |
---|
| 823 | ("QuadtreeTUMaxDepthIntra%d", cfg_uiQuadtreeTUMaxDepthIntra, 1u, MAX_LAYERS, "Depth of TU tree for intra CUs") |
---|
| 824 | ("QuadtreeTUMaxDepthInter%d", cfg_uiQuadtreeTUMaxDepthInter, 2u, MAX_LAYERS, "Depth of TU tree for inter CUs") |
---|
| 825 | |
---|
| 826 | |
---|
| 827 | // set the same CU realted settings across all the layers if config file parameters are not layer specific |
---|
| 828 | ("MaxCUWidth", cfg_uiMaxCUWidth, 64u, MAX_LAYERS, "Maximum CU width") |
---|
| 829 | ("MaxCUHeight", cfg_uiMaxCUHeight, 64u, MAX_LAYERS, "Maximum CU height") |
---|
| 830 | // todo: remove defaults from MaxCUSize |
---|
| 831 | ("MaxCUSize,s", cfg_uiMaxCUWidth, 64u, MAX_LAYERS, "Maximum CU size") |
---|
| 832 | ("MaxCUSize,s", cfg_uiMaxCUHeight, 64u, MAX_LAYERS, "Maximum CU size") |
---|
| 833 | ("MaxPartitionDepth,h", cfg_uiMaxCUDepth, 4u, MAX_LAYERS, "CU depth") |
---|
| 834 | |
---|
| 835 | ("QuadtreeTULog2MaxSize", cfg_uiQuadtreeTULog2MaxSize, 6u, MAX_LAYERS, "Maximum TU size in logarithm base 2") |
---|
| 836 | ("QuadtreeTULog2MinSize", cfg_uiQuadtreeTULog2MinSize, 2u, MAX_LAYERS, "Minimum TU size in logarithm base 2") |
---|
| 837 | |
---|
| 838 | ("QuadtreeTUMaxDepthIntra", cfg_uiQuadtreeTUMaxDepthIntra, 1u, MAX_LAYERS, "Depth of TU tree for intra CUs") |
---|
| 839 | ("QuadtreeTUMaxDepthInter", cfg_uiQuadtreeTUMaxDepthInter, 2u, MAX_LAYERS, "Depth of TU tree for inter CUs") |
---|
| 840 | #else |
---|
| 841 | // Unit definition parameters |
---|
[313] | 842 | ("MaxCUWidth", m_uiMaxCUWidth, 64u) |
---|
| 843 | ("MaxCUHeight", m_uiMaxCUHeight, 64u) |
---|
| 844 | // todo: remove defaults from MaxCUSize |
---|
| 845 | ("MaxCUSize,s", m_uiMaxCUWidth, 64u, "Maximum CU size") |
---|
| 846 | ("MaxCUSize,s", m_uiMaxCUHeight, 64u, "Maximum CU size") |
---|
| 847 | ("MaxPartitionDepth,h", m_uiMaxCUDepth, 4u, "CU depth") |
---|
| 848 | |
---|
| 849 | ("QuadtreeTULog2MaxSize", m_uiQuadtreeTULog2MaxSize, 6u, "Maximum TU size in logarithm base 2") |
---|
| 850 | ("QuadtreeTULog2MinSize", m_uiQuadtreeTULog2MinSize, 2u, "Minimum TU size in logarithm base 2") |
---|
| 851 | |
---|
| 852 | ("QuadtreeTUMaxDepthIntra", m_uiQuadtreeTUMaxDepthIntra, 1u, "Depth of TU tree for intra CUs") |
---|
| 853 | ("QuadtreeTUMaxDepthInter", m_uiQuadtreeTUMaxDepthInter, 2u, "Depth of TU tree for inter CUs") |
---|
[494] | 854 | #endif |
---|
[313] | 855 | |
---|
| 856 | // Coding structure paramters |
---|
| 857 | #if SVC_EXTENSION |
---|
| 858 | ("IntraPeriod%d,-ip%d", cfg_IntraPeriod, -1, MAX_LAYERS, "intra period in frames for layer %d, (-1: only first frame)") |
---|
| 859 | #else |
---|
| 860 | ("IntraPeriod,-ip", m_iIntraPeriod, -1, "Intra period in frames, (-1: only first frame)") |
---|
| 861 | #endif |
---|
[713] | 862 | #if ALLOW_RECOVERY_POINT_AS_RAP |
---|
| 863 | ("DecodingRefreshType,-dr", m_iDecodingRefreshType, 0, "Intra refresh type (0:none 1:CRA 2:IDR 3:RecPointSEI)") |
---|
| 864 | #else |
---|
[313] | 865 | ("DecodingRefreshType,-dr", m_iDecodingRefreshType, 0, "Intra refresh type (0:none 1:CRA 2:IDR)") |
---|
[713] | 866 | #endif |
---|
[313] | 867 | ("GOPSize,g", m_iGOPSize, 1, "GOP size of temporal structure") |
---|
| 868 | // motion options |
---|
| 869 | ("FastSearch", m_iFastSearch, 1, "0:Full search 1:Diamond 2:PMVFAST") |
---|
| 870 | ("SearchRange,-sr", m_iSearchRange, 96, "Motion search range") |
---|
| 871 | ("BipredSearchRange", m_bipredSearchRange, 4, "Motion search range for bipred refinement") |
---|
| 872 | ("HadamardME", m_bUseHADME, true, "Hadamard ME for fractional-pel") |
---|
| 873 | ("ASR", m_bUseASR, false, "Adaptive motion search range") |
---|
| 874 | |
---|
| 875 | #if SVC_EXTENSION |
---|
| 876 | ("LambdaModifier%d,-LM%d", m_adLambdaModifier, ( double )1.0, MAX_TLAYER, "Lambda modifier for temporal layer %d") |
---|
| 877 | #else |
---|
| 878 | // Mode decision parameters |
---|
| 879 | ("LambdaModifier0,-LM0", m_adLambdaModifier[ 0 ], ( Double )1.0, "Lambda modifier for temporal layer 0") |
---|
| 880 | ("LambdaModifier1,-LM1", m_adLambdaModifier[ 1 ], ( Double )1.0, "Lambda modifier for temporal layer 1") |
---|
| 881 | ("LambdaModifier2,-LM2", m_adLambdaModifier[ 2 ], ( Double )1.0, "Lambda modifier for temporal layer 2") |
---|
| 882 | ("LambdaModifier3,-LM3", m_adLambdaModifier[ 3 ], ( Double )1.0, "Lambda modifier for temporal layer 3") |
---|
| 883 | ("LambdaModifier4,-LM4", m_adLambdaModifier[ 4 ], ( Double )1.0, "Lambda modifier for temporal layer 4") |
---|
| 884 | ("LambdaModifier5,-LM5", m_adLambdaModifier[ 5 ], ( Double )1.0, "Lambda modifier for temporal layer 5") |
---|
| 885 | ("LambdaModifier6,-LM6", m_adLambdaModifier[ 6 ], ( Double )1.0, "Lambda modifier for temporal layer 6") |
---|
| 886 | #endif |
---|
| 887 | |
---|
| 888 | /* Quantization parameters */ |
---|
| 889 | #if SVC_EXTENSION |
---|
| 890 | ("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") |
---|
| 891 | #else |
---|
| 892 | ("QP,q", m_fQP, 30.0, "Qp value, if value is float, QP is switched once during encoding") |
---|
| 893 | #endif |
---|
| 894 | ("DeltaQpRD,-dqr",m_uiDeltaQpRD, 0u, "max dQp offset for slice") |
---|
| 895 | ("MaxDeltaQP,d", m_iMaxDeltaQP, 0, "max dQp offset for block") |
---|
| 896 | ("MaxCuDQPDepth,-dqd", m_iMaxCuDQPDepth, 0, "max depth for a minimum CuDQP") |
---|
| 897 | |
---|
| 898 | ("CbQpOffset,-cbqpofs", m_cbQpOffset, 0, "Chroma Cb QP Offset") |
---|
| 899 | ("CrQpOffset,-crqpofs", m_crQpOffset, 0, "Chroma Cr QP Offset") |
---|
| 900 | |
---|
| 901 | #if ADAPTIVE_QP_SELECTION |
---|
| 902 | ("AdaptiveQpSelection,-aqps", m_bUseAdaptQpSelect, false, "AdaptiveQpSelection") |
---|
| 903 | #endif |
---|
| 904 | |
---|
| 905 | ("AdaptiveQP,-aq", m_bUseAdaptiveQP, false, "QP adaptation based on a psycho-visual model") |
---|
| 906 | ("MaxQPAdaptationRange,-aqr", m_iQPAdaptationRange, 6, "QP adaptation range") |
---|
| 907 | #if !SVC_EXTENSION |
---|
| 908 | ("dQPFile,m", cfg_dQPFile, string(""), "dQP file name") |
---|
| 909 | #endif |
---|
| 910 | ("RDOQ", m_useRDOQ, true ) |
---|
| 911 | ("RDOQTS", m_useRDOQTS, true ) |
---|
| 912 | ("RDpenalty", m_rdPenalty, 0, "RD-penalty for 32x32 TU for intra in non-intra slices. 0:disbaled 1:RD-penalty 2:maximum RD-penalty") |
---|
| 913 | |
---|
| 914 | // Deblocking filter parameters |
---|
| 915 | ("LoopFilterDisable", m_bLoopFilterDisable, false ) |
---|
| 916 | ("LoopFilterOffsetInPPS", m_loopFilterOffsetInPPS, false ) |
---|
| 917 | ("LoopFilterBetaOffset_div2", m_loopFilterBetaOffsetDiv2, 0 ) |
---|
| 918 | ("LoopFilterTcOffset_div2", m_loopFilterTcOffsetDiv2, 0 ) |
---|
| 919 | ("DeblockingFilterControlPresent", m_DeblockingFilterControlPresent, false ) |
---|
| 920 | ("DeblockingFilterMetric", m_DeblockingFilterMetric, false ) |
---|
| 921 | |
---|
| 922 | // Coding tools |
---|
| 923 | ("AMP", m_enableAMP, true, "Enable asymmetric motion partitions") |
---|
| 924 | ("TransformSkip", m_useTransformSkip, false, "Intra transform skipping") |
---|
| 925 | ("TransformSkipFast", m_useTransformSkipFast, false, "Fast intra transform skipping") |
---|
| 926 | ("SAO", m_bUseSAO, true, "Enable Sample Adaptive Offset") |
---|
| 927 | ("MaxNumOffsetsPerPic", m_maxNumOffsetsPerPic, 2048, "Max number of SAO offset per picture (Default: 2048)") |
---|
| 928 | ("SAOLcuBoundary", m_saoLcuBoundary, false, "0: right/bottom LCU boundary areas skipped from SAO parameter estimation, 1: non-deblocked pixels are used for those areas") |
---|
| 929 | ("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") |
---|
| 930 | ("SliceArgument", m_sliceArgument, 0, "Depending on SliceMode being:" |
---|
| 931 | "\t1: max number of CTUs per slice" |
---|
| 932 | "\t2: max number of bytes per slice" |
---|
| 933 | "\t3: max number of tiles per slice") |
---|
| 934 | ("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") |
---|
| 935 | ("SliceSegmentArgument", m_sliceSegmentArgument, 0, "Depending on SliceSegmentMode being:" |
---|
| 936 | "\t1: max number of CTUs per slice segment" |
---|
| 937 | "\t2: max number of bytes per slice segment" |
---|
| 938 | "\t3: max number of tiles per slice segment") |
---|
| 939 | ("LFCrossSliceBoundaryFlag", m_bLFCrossSliceBoundaryFlag, true) |
---|
| 940 | |
---|
| 941 | ("ConstrainedIntraPred", m_bUseConstrainedIntraPred, false, "Constrained Intra Prediction") |
---|
| 942 | |
---|
| 943 | ("PCMEnabledFlag", m_usePCM, false) |
---|
| 944 | ("PCMLog2MaxSize", m_pcmLog2MaxSize, 5u) |
---|
| 945 | ("PCMLog2MinSize", m_uiPCMLog2MinSize, 3u) |
---|
| 946 | ("PCMInputBitDepthFlag", m_bPCMInputBitDepthFlag, true) |
---|
| 947 | ("PCMFilterDisableFlag", m_bPCMFilterDisableFlag, false) |
---|
| 948 | |
---|
| 949 | ("WeightedPredP,-wpP", m_useWeightedPred, false, "Use weighted prediction in P slices") |
---|
| 950 | ("WeightedPredB,-wpB", m_useWeightedBiPred, false, "Use weighted (bidirectional) prediction in B slices") |
---|
| 951 | ("Log2ParallelMergeLevel", m_log2ParallelMergeLevel, 2u, "Parallel merge estimation region") |
---|
[906] | 952 | |
---|
| 953 | //deprecated copies of renamed tile parameters |
---|
| 954 | ("UniformSpacingIdc", m_tileUniformSpacingFlag, false, "deprecated alias of TileUniformSpacing") |
---|
| 955 | ("ColumnWidthArray", cfgColumnWidth, string(""), "deprecated alias of TileColumnWidthArray") |
---|
| 956 | ("RowHeightArray", cfgRowHeight, string(""), "deprecated alias of TileRowHeightArray") |
---|
| 957 | |
---|
| 958 | ("TileUniformSpacing", m_tileUniformSpacingFlag, false, "Indicates that tile columns and rows are distributed uniformly") |
---|
| 959 | ("NumTileColumnsMinus1", m_numTileColumnsMinus1, 0, "Number of tile columns in a picture minus 1") |
---|
| 960 | ("NumTileRowsMinus1", m_numTileRowsMinus1, 0, "Number of rows in a picture minus 1") |
---|
| 961 | ("TileColumnWidthArray", cfgColumnWidth, string(""), "Array containing tile column width values in units of LCU") |
---|
| 962 | ("TileRowHeightArray", cfgRowHeight, string(""), "Array containing tile row height values in units of LCU") |
---|
[313] | 963 | ("LFCrossTileBoundaryFlag", m_bLFCrossTileBoundaryFlag, true, "1: cross-tile-boundary loop filtering. 0:non-cross-tile-boundary loop filtering") |
---|
[906] | 964 | #if SVC_EXTENSION |
---|
| 965 | ("WaveFrontSynchro%d", cfg_waveFrontSynchro, 0, MAX_LAYERS, "0: no synchro; 1 synchro with TR; 2 TRR etc") |
---|
| 966 | #else |
---|
[313] | 967 | ("WaveFrontSynchro", m_iWaveFrontSynchro, 0, "0: no synchro; 1 synchro with TR; 2 TRR etc") |
---|
[906] | 968 | #endif |
---|
[313] | 969 | ("ScalingList", m_useScalingListId, 0, "0: no scaling list, 1: default scaling lists, 2: scaling lists specified in ScalingListFile") |
---|
| 970 | ("ScalingListFile", cfg_ScalingListFile, string(""), "Scaling list file name") |
---|
| 971 | ("SignHideFlag,-SBH", m_signHideFlag, 1) |
---|
| 972 | ("MaxNumMergeCand", m_maxNumMergeCand, 5u, "Maximum number of merge candidates") |
---|
| 973 | |
---|
| 974 | /* Misc. */ |
---|
| 975 | ("SEIDecodedPictureHash", m_decodedPictureHashSEIEnabled, 0, "Control generation of decode picture hash SEI messages\n" |
---|
| 976 | "\t3: checksum\n" |
---|
| 977 | "\t2: CRC\n" |
---|
| 978 | "\t1: use MD5\n" |
---|
| 979 | "\t0: disable") |
---|
| 980 | ("SEIpictureDigest", m_decodedPictureHashSEIEnabled, 0, "deprecated alias for SEIDecodedPictureHash") |
---|
| 981 | ("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") |
---|
| 982 | ("FEN", m_bUseFastEnc, false, "fast encoder setting") |
---|
| 983 | ("ECU", m_bUseEarlyCU, false, "Early CU setting") |
---|
| 984 | ("FDM", m_useFastDecisionForMerge, true, "Fast decision for Merge RD Cost") |
---|
| 985 | ("CFM", m_bUseCbfFastMode, false, "Cbf fast mode setting") |
---|
| 986 | ("ESD", m_useEarlySkipDetection, false, "Early SKIP detection setting") |
---|
| 987 | #if FAST_INTRA_SHVC |
---|
| 988 | ("FIS", m_useFastIntraScalable, false, "Fast Intra Decision for Scalable HEVC") |
---|
| 989 | #endif |
---|
| 990 | #if RC_SHVC_HARMONIZATION |
---|
| 991 | ("RateControl%d", cfg_RCEnableRateControl, false, MAX_LAYERS, "Rate control: enable rate control for layer %d") |
---|
| 992 | ("TargetBitrate%d", cfg_RCTargetBitRate, 0, MAX_LAYERS, "Rate control: target bitrate for layer %d") |
---|
| 993 | ("KeepHierarchicalBit%d", cfg_RCKeepHierarchicalBit, false, MAX_LAYERS, "Rate control: keep hierarchical bit allocation for layer %d") |
---|
| 994 | ("LCULevelRateControl%d", cfg_RCLCULevelRC, true, MAX_LAYERS, "Rate control: LCU level RC") |
---|
| 995 | ("RCLCUSeparateModel%d", cfg_RCUseLCUSeparateModel, true, MAX_LAYERS, "Rate control: Use LCU level separate R-lambda model") |
---|
| 996 | ("InitialQP%d", cfg_RCInitialQP, 0, MAX_LAYERS, "Rate control: initial QP") |
---|
| 997 | ("RCForceIntraQP%d", cfg_RCForceIntraQP, false, MAX_LAYERS, "Rate control: force intra QP to be equal to initial QP") |
---|
| 998 | #else |
---|
| 999 | ( "RateControl", m_RCEnableRateControl, false, "Rate control: enable rate control" ) |
---|
| 1000 | ( "TargetBitrate", m_RCTargetBitrate, 0, "Rate control: target bitrate" ) |
---|
| 1001 | ( "KeepHierarchicalBit", m_RCKeepHierarchicalBit, 0, "Rate control: 0: equal bit allocation; 1: fixed ratio bit allocation; 2: adaptive ratio bit allocation" ) |
---|
| 1002 | ( "LCULevelRateControl", m_RCLCULevelRC, true, "Rate control: true: LCU level RC; false: picture level RC" ) |
---|
| 1003 | ( "RCLCUSeparateModel", m_RCUseLCUSeparateModel, true, "Rate control: use LCU level separate R-lambda model" ) |
---|
| 1004 | ( "InitialQP", m_RCInitialQP, 0, "Rate control: initial QP" ) |
---|
| 1005 | ( "RCForceIntraQP", m_RCForceIntraQP, false, "Rate control: force intra QP to be equal to initial QP" ) |
---|
| 1006 | #endif |
---|
| 1007 | |
---|
| 1008 | ("TransquantBypassEnableFlag", m_TransquantBypassEnableFlag, false, "transquant_bypass_enable_flag indicator in PPS") |
---|
[595] | 1009 | ("CUTransquantBypassFlagForce", m_CUTransquantBypassFlagForce, false, "Force transquant bypass mode, when transquant_bypass_enable_flag is enabled") |
---|
[313] | 1010 | ("RecalculateQPAccordingToLambda", m_recalculateQPAccordingToLambda, false, "Recalculate QP values according to lambda values. Do not suggest to be enabled in all intra case") |
---|
| 1011 | ("StrongIntraSmoothing,-sis", m_useStrongIntraSmoothing, true, "Enable strong intra smoothing for 32x32 blocks") |
---|
| 1012 | ("SEIActiveParameterSets", m_activeParameterSetsSEIEnabled, 0, "Enable generation of active parameter sets SEI messages") |
---|
| 1013 | ("VuiParametersPresent,-vui", m_vuiParametersPresentFlag, false, "Enable generation of vui_parameters()") |
---|
| 1014 | ("AspectRatioInfoPresent", m_aspectRatioInfoPresentFlag, false, "Signals whether aspect_ratio_idc is present") |
---|
| 1015 | ("AspectRatioIdc", m_aspectRatioIdc, 0, "aspect_ratio_idc") |
---|
| 1016 | ("SarWidth", m_sarWidth, 0, "horizontal size of the sample aspect ratio") |
---|
| 1017 | ("SarHeight", m_sarHeight, 0, "vertical size of the sample aspect ratio") |
---|
| 1018 | ("OverscanInfoPresent", m_overscanInfoPresentFlag, false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n") |
---|
| 1019 | ("OverscanAppropriate", m_overscanAppropriateFlag, false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n") |
---|
| 1020 | ("VideoSignalTypePresent", m_videoSignalTypePresentFlag, false, "Signals whether video_format, video_full_range_flag, and colour_description_present_flag are present") |
---|
| 1021 | ("VideoFormat", m_videoFormat, 5, "Indicates representation of pictures") |
---|
| 1022 | ("VideoFullRange", m_videoFullRangeFlag, false, "Indicates the black level and range of luma and chroma signals") |
---|
| 1023 | ("ColourDescriptionPresent", m_colourDescriptionPresentFlag, false, "Signals whether colour_primaries, transfer_characteristics and matrix_coefficients are present") |
---|
| 1024 | ("ColourPrimaries", m_colourPrimaries, 2, "Indicates chromaticity coordinates of the source primaries") |
---|
[906] | 1025 | ("TransferCharacteristics", m_transferCharacteristics, 2, "Indicates the opto-electronic transfer characteristics of the source") |
---|
[313] | 1026 | ("MatrixCoefficients", m_matrixCoefficients, 2, "Describes the matrix coefficients used in deriving luma and chroma from RGB primaries") |
---|
| 1027 | ("ChromaLocInfoPresent", m_chromaLocInfoPresentFlag, false, "Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present") |
---|
| 1028 | ("ChromaSampleLocTypeTopField", m_chromaSampleLocTypeTopField, 0, "Specifies the location of chroma samples for top field") |
---|
| 1029 | ("ChromaSampleLocTypeBottomField", m_chromaSampleLocTypeBottomField, 0, "Specifies the location of chroma samples for bottom field") |
---|
| 1030 | ("NeutralChromaIndication", m_neutralChromaIndicationFlag, false, "Indicates that the value of all decoded chroma samples is equal to 1<<(BitDepthCr-1)") |
---|
| 1031 | ("DefaultDisplayWindowFlag", m_defaultDisplayWindowFlag, false, "Indicates the presence of the Default Window parameters") |
---|
| 1032 | ("DefDispWinLeftOffset", m_defDispWinLeftOffset, 0, "Specifies the left offset of the default display window from the conformance window") |
---|
| 1033 | ("DefDispWinRightOffset", m_defDispWinRightOffset, 0, "Specifies the right offset of the default display window from the conformance window") |
---|
| 1034 | ("DefDispWinTopOffset", m_defDispWinTopOffset, 0, "Specifies the top offset of the default display window from the conformance window") |
---|
| 1035 | ("DefDispWinBottomOffset", m_defDispWinBottomOffset, 0, "Specifies the bottom offset of the default display window from the conformance window") |
---|
| 1036 | ("FrameFieldInfoPresentFlag", m_frameFieldInfoPresentFlag, false, "Indicates that pic_struct and field coding related values are present in picture timing SEI messages") |
---|
| 1037 | ("PocProportionalToTimingFlag", m_pocProportionalToTimingFlag, false, "Indicates that the POC value is proportional to the output time w.r.t. first picture in CVS") |
---|
| 1038 | ("NumTicksPocDiffOneMinus1", m_numTicksPocDiffOneMinus1, 0, "Number of ticks minus 1 that for a POC difference of one") |
---|
| 1039 | ("BitstreamRestriction", m_bitstreamRestrictionFlag, false, "Signals whether bitstream restriction parameters are present") |
---|
| 1040 | ("TilesFixedStructure", m_tilesFixedStructureFlag, false, "Indicates that each active picture parameter set has the same values of the syntax elements related to tiles") |
---|
| 1041 | ("MotionVectorsOverPicBoundaries", m_motionVectorsOverPicBoundariesFlag, false, "Indicates that no samples outside the picture boundaries are used for inter prediction") |
---|
| 1042 | ("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") |
---|
| 1043 | ("MaxBitsPerMinCuDenom", m_maxBitsPerMinCuDenom, 1, "Indicates an upper bound for the number of bits of coding_unit() data") |
---|
| 1044 | ("Log2MaxMvLengthHorizontal", m_log2MaxMvLengthHorizontal, 15, "Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units") |
---|
| 1045 | ("Log2MaxMvLengthVertical", m_log2MaxMvLengthVertical, 15, "Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units") |
---|
| 1046 | ("SEIRecoveryPoint", m_recoveryPointSEIEnabled, 0, "Control generation of recovery point SEI messages") |
---|
| 1047 | ("SEIBufferingPeriod", m_bufferingPeriodSEIEnabled, 0, "Control generation of buffering period SEI messages") |
---|
| 1048 | ("SEIPictureTiming", m_pictureTimingSEIEnabled, 0, "Control generation of picture timing SEI messages") |
---|
| 1049 | ("SEIToneMappingInfo", m_toneMappingInfoSEIEnabled, false, "Control generation of Tone Mapping SEI messages") |
---|
| 1050 | ("SEIToneMapId", m_toneMapId, 0, "Specifies Id of Tone Mapping SEI message for a given session") |
---|
| 1051 | ("SEIToneMapCancelFlag", m_toneMapCancelFlag, false, "Indicates that Tone Mapping SEI message cancels the persistance or follows") |
---|
| 1052 | ("SEIToneMapPersistenceFlag", m_toneMapPersistenceFlag, true, "Specifies the persistence of the Tone Mapping SEI message") |
---|
| 1053 | ("SEIToneMapCodedDataBitDepth", m_toneMapCodedDataBitDepth, 8, "Specifies Coded Data BitDepth of Tone Mapping SEI messages") |
---|
| 1054 | ("SEIToneMapTargetBitDepth", m_toneMapTargetBitDepth, 8, "Specifies Output BitDepth of Tome mapping function") |
---|
| 1055 | ("SEIToneMapModelId", m_toneMapModelId, 0, "Specifies Model utilized for mapping coded data into target_bit_depth range\n" |
---|
| 1056 | "\t0: linear mapping with clipping\n" |
---|
| 1057 | "\t1: sigmoidal mapping\n" |
---|
| 1058 | "\t2: user-defined table mapping\n" |
---|
| 1059 | "\t3: piece-wise linear mapping\n" |
---|
| 1060 | "\t4: luminance dynamic range information ") |
---|
| 1061 | ("SEIToneMapMinValue", m_toneMapMinValue, 0, "Specifies the minimum value in mode 0") |
---|
| 1062 | ("SEIToneMapMaxValue", m_toneMapMaxValue, 1023, "Specifies the maxmum value in mode 0") |
---|
| 1063 | ("SEIToneMapSigmoidMidpoint", m_sigmoidMidpoint, 512, "Specifies the centre point in mode 1") |
---|
| 1064 | ("SEIToneMapSigmoidWidth", m_sigmoidWidth, 960, "Specifies the distance between 5% and 95% values of the target_bit_depth in mode 1") |
---|
| 1065 | ("SEIToneMapStartOfCodedInterval", cfg_startOfCodedInterval, string(""), "Array of user-defined mapping table") |
---|
| 1066 | ("SEIToneMapNumPivots", m_numPivots, 0, "Specifies the number of pivot points in mode 3") |
---|
| 1067 | ("SEIToneMapCodedPivotValue", cfg_codedPivotValue, string(""), "Array of pivot point") |
---|
| 1068 | ("SEIToneMapTargetPivotValue", cfg_targetPivotValue, string(""), "Array of pivot point") |
---|
| 1069 | ("SEIToneMapCameraIsoSpeedIdc", m_cameraIsoSpeedIdc, 0, "Indicates the camera ISO speed for daylight illumination") |
---|
| 1070 | ("SEIToneMapCameraIsoSpeedValue", m_cameraIsoSpeedValue, 400, "Specifies the camera ISO speed for daylight illumination of Extended_ISO") |
---|
[713] | 1071 | ("SEIToneMapExposureIndexIdc", m_exposureIndexIdc, 0, "Indicates the exposure index setting of the camera") |
---|
| 1072 | ("SEIToneMapExposureIndexValue", m_exposureIndexValue, 400, "Specifies the exposure index setting of the cameran of Extended_ISO") |
---|
[313] | 1073 | ("SEIToneMapExposureCompensationValueSignFlag", m_exposureCompensationValueSignFlag, 0, "Specifies the sign of ExposureCompensationValue") |
---|
| 1074 | ("SEIToneMapExposureCompensationValueNumerator", m_exposureCompensationValueNumerator, 0, "Specifies the numerator of ExposureCompensationValue") |
---|
| 1075 | ("SEIToneMapExposureCompensationValueDenomIdc", m_exposureCompensationValueDenomIdc, 2, "Specifies the denominator of ExposureCompensationValue") |
---|
| 1076 | ("SEIToneMapRefScreenLuminanceWhite", m_refScreenLuminanceWhite, 350, "Specifies reference screen brightness setting in units of candela per square metre") |
---|
| 1077 | ("SEIToneMapExtendedRangeWhiteLevel", m_extendedRangeWhiteLevel, 800, "Indicates the luminance dynamic range") |
---|
| 1078 | ("SEIToneMapNominalBlackLevelLumaCodeValue", m_nominalBlackLevelLumaCodeValue, 16, "Specifies luma sample value of the nominal black level assigned decoded pictures") |
---|
| 1079 | ("SEIToneMapNominalWhiteLevelLumaCodeValue", m_nominalWhiteLevelLumaCodeValue, 235, "Specifies luma sample value of the nominal white level assigned decoded pictures") |
---|
| 1080 | ("SEIToneMapExtendedWhiteLevelLumaCodeValue", m_extendedWhiteLevelLumaCodeValue, 300, "Specifies luma sample value of the extended dynamic range assigned decoded pictures") |
---|
| 1081 | ("SEIFramePacking", m_framePackingSEIEnabled, 0, "Control generation of frame packing SEI messages") |
---|
| 1082 | ("SEIFramePackingType", m_framePackingSEIType, 0, "Define frame packing arrangement\n" |
---|
| 1083 | "\t0: checkerboard - pixels alternatively represent either frames\n" |
---|
| 1084 | "\t1: column alternation - frames are interlaced by column\n" |
---|
| 1085 | "\t2: row alternation - frames are interlaced by row\n" |
---|
| 1086 | "\t3: side by side - frames are displayed horizontally\n" |
---|
| 1087 | "\t4: top bottom - frames are displayed vertically\n" |
---|
| 1088 | "\t5: frame alternation - one frame is alternated with the other") |
---|
| 1089 | ("SEIFramePackingId", m_framePackingSEIId, 0, "Id of frame packing SEI message for a given session") |
---|
| 1090 | ("SEIFramePackingQuincunx", m_framePackingSEIQuincunx, 0, "Indicate the presence of a Quincunx type video frame") |
---|
| 1091 | ("SEIFramePackingInterpretation", m_framePackingSEIInterpretation, 0, "Indicate the interpretation of the frame pair\n" |
---|
| 1092 | "\t0: unspecified\n" |
---|
| 1093 | "\t1: stereo pair, frame0 represents left view\n" |
---|
| 1094 | "\t2: stereo pair, frame0 represents right view") |
---|
| 1095 | ("SEIDisplayOrientation", m_displayOrientationSEIAngle, 0, "Control generation of display orientation SEI messages\n" |
---|
| 1096 | "\tN: 0 < N < (2^16 - 1) enable display orientation SEI message with anticlockwise_rotation = N and display_orientation_repetition_period = 1\n" |
---|
| 1097 | "\t0: disable") |
---|
| 1098 | ("SEITemporalLevel0Index", m_temporalLevel0IndexSEIEnabled, 0, "Control generation of temporal level 0 index SEI messages") |
---|
| 1099 | ("SEIGradualDecodingRefreshInfo", m_gradualDecodingRefreshInfoEnabled, 0, "Control generation of gradual decoding refresh information SEI message") |
---|
| 1100 | ("SEIDecodingUnitInfo", m_decodingUnitInfoSEIEnabled, 0, "Control generation of decoding unit information SEI message.") |
---|
[588] | 1101 | #if LAYERS_NOT_PRESENT_SEI |
---|
| 1102 | ("SEILayersNotPresent", m_layersNotPresentSEIEnabled, 0, "Control generation of layers not present SEI message") |
---|
[313] | 1103 | #endif |
---|
| 1104 | ("SEISOPDescription", m_SOPDescriptionSEIEnabled, 0, "Control generation of SOP description SEI messages") |
---|
| 1105 | ("SEIScalableNesting", m_scalableNestingSEIEnabled, 0, "Control generation of scalable nesting SEI messages") |
---|
[815] | 1106 | #if P0050_KNEE_FUNCTION_SEI |
---|
| 1107 | ("SEIKneeFunctionInfo", m_kneeSEIEnabled, false, "Control generation of Knee function SEI messages") |
---|
| 1108 | ("SEIKneeFunctionId", m_kneeSEIId, 0, "Specifies Id of Knee function SEI message for a given session") |
---|
| 1109 | ("SEIKneeFunctionCancelFlag", m_kneeSEICancelFlag, false, "Indicates that Knee function SEI message cancels the persistance or follows") |
---|
| 1110 | ("SEIKneeFunctionPersistenceFlag", m_kneeSEIPersistenceFlag, true, "Specifies the persistence of the Knee function SEI message") |
---|
| 1111 | ("SEIKneeFunctionMappingFlag", m_kneeSEIMappingFlag, false, "Specifies the mapping mode of the Knee function SEI message") |
---|
| 1112 | ("SEIKneeFunctionInputDrange", m_kneeSEIInputDrange, 1000, "Specifies the peak luminance level for the input picture of Knee function SEI messages") |
---|
| 1113 | ("SEIKneeFunctionInputDispLuminance", m_kneeSEIInputDispLuminance, 100, "Specifies the expected display brightness for the input picture of Knee function SEI messages") |
---|
| 1114 | ("SEIKneeFunctionOutputDrange", m_kneeSEIOutputDrange, 4000, "Specifies the peak luminance level for the output picture of Knee function SEI messages") |
---|
| 1115 | ("SEIKneeFunctionOutputDispLuminance", m_kneeSEIOutputDispLuminance, 800, "Specifies the expected display brightness for the output picture of Knee function SEI messages") |
---|
| 1116 | ("SEIKneeFunctionNumKneePointsMinus1", m_kneeSEINumKneePointsMinus1, 2, "Specifies the number of knee points - 1") |
---|
| 1117 | ("SEIKneeFunctionInputKneePointValue", cfg_kneeSEIInputKneePointValue, string("600 800 900"), "Array of input knee point") |
---|
| 1118 | ("SEIKneeFunctionOutputKneePointValue", cfg_kneeSEIOutputKneePointValue, string("100 250 450"), "Array of output knee point") |
---|
| 1119 | #endif |
---|
| 1120 | #if Q0189_TMVP_CONSTRAINTS |
---|
| 1121 | ("SEITemporalMotionVectorPredictionConstraints", m_TMVPConstraintsSEIEnabled, 0, "Control generation of TMVP constrants SEI message") |
---|
| 1122 | #endif |
---|
[313] | 1123 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
| 1124 | ("AdaptiveResolutionChange", m_adaptiveResolutionChange, 0, "Adaptive resolution change frame number. Should coincide with EL RAP picture. (0: disable)") |
---|
| 1125 | #endif |
---|
[540] | 1126 | #if HIGHER_LAYER_IRAP_SKIP_FLAG |
---|
| 1127 | ("SkipPictureAtArcSwitch", m_skipPictureAtArcSwitch, false, "Code the higher layer picture in ARC up-switching as a skip picture. (0: disable)") |
---|
| 1128 | #endif |
---|
[442] | 1129 | #if N0383_IL_CONSTRAINED_TILE_SETS_SEI |
---|
| 1130 | ("SEIInterLayerConstrainedTileSets", m_interLayerConstrainedTileSetsSEIEnabled, false, "Control generation of inter layer constrained tile sets SEI message") |
---|
| 1131 | ("IlNumSetsInMessage", m_ilNumSetsInMessage, 0u, "Number of inter layer constrained tile sets") |
---|
| 1132 | ("TileSetsArray", cfg_tileSets, string(""), "Array containing tile sets params (TopLeftTileIndex, BottonRightTileIndex and ilcIdc for each set) ") |
---|
| 1133 | #endif |
---|
[540] | 1134 | #if O0153_ALT_OUTPUT_LAYER_FLAG |
---|
| 1135 | ("AltOutputLayerFlag", m_altOutputLayerFlag, false, "Specifies the value of alt_output_layer_flag in VPS extension") |
---|
| 1136 | #endif |
---|
| 1137 | #if O0149_CROSS_LAYER_BLA_FLAG |
---|
| 1138 | ("CrossLayerBLAFlag", m_crossLayerBLAFlag, false, "Specifies the value of cross_layer_bla_flag in VPS") |
---|
| 1139 | #endif |
---|
[713] | 1140 | #if Q0048_CGS_3D_ASYMLUT |
---|
| 1141 | ("CGS", m_nCGSFlag , 0, "whether CGS is enabled") |
---|
| 1142 | ("CGSMaxOctantDepth", m_nCGSMaxOctantDepth , 1, "max octant depth") |
---|
| 1143 | ("CGSMaxYPartNumLog", m_nCGSMaxYPartNumLog2 , 2, "max Y part number ") |
---|
| 1144 | ("CGSLUTBit", m_nCGSLUTBit , 12, "bit depth of CGS LUT") |
---|
[906] | 1145 | #if R0151_CGS_3D_ASYMLUT_IMPROVE |
---|
| 1146 | ("CGSAdaptC", m_nCGSAdaptiveChroma , 1, "adaptive chroma partition (only for the case of two chroma partitions)") |
---|
[713] | 1147 | #endif |
---|
[906] | 1148 | #if R0179_ENC_OPT_3DLUT_SIZE |
---|
| 1149 | ("CGSSizeRDO", m_nCGSLutSizeRDO , 0, "RDOpt selection of best table size (effective when large maximum table size such as 8x8x8 is used)") |
---|
| 1150 | #endif |
---|
| 1151 | #endif |
---|
[815] | 1152 | #if Q0108_TSA_STSA |
---|
| 1153 | ("InheritCodingStruct%d",m_inheritCodingStruct, 0, MAX_LAYERS, "Predicts the GOP structure of one layer for another layer") |
---|
| 1154 | #endif |
---|
[313] | 1155 | ; |
---|
| 1156 | |
---|
| 1157 | for(Int i=1; i<MAX_GOP+1; i++) { |
---|
| 1158 | std::ostringstream cOSS; |
---|
| 1159 | cOSS<<"Frame"<<i; |
---|
| 1160 | opts.addOptions()(cOSS.str(), m_GOPList[i-1], GOPEntry()); |
---|
| 1161 | } |
---|
[815] | 1162 | |
---|
| 1163 | #if Q0108_TSA_STSA |
---|
| 1164 | for (Int i=1; i<MAX_LAYERS; i++) |
---|
| 1165 | { |
---|
| 1166 | for(Int j=1; j<MAX_GOP+1; j++) |
---|
| 1167 | { |
---|
| 1168 | std::ostringstream cOSS; |
---|
| 1169 | cOSS<<"Layer"<<i<<"Frame"<<j; |
---|
| 1170 | opts.addOptions()(cOSS.str(), m_EhGOPList[i][j-1], GOPEntry()); |
---|
| 1171 | } |
---|
| 1172 | } |
---|
| 1173 | #endif |
---|
| 1174 | |
---|
[313] | 1175 | po::setDefaults(opts); |
---|
| 1176 | const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv); |
---|
| 1177 | |
---|
[815] | 1178 | #if Q0108_TSA_STSA |
---|
| 1179 | for (Int i=1; i<MAX_LAYERS; i++) |
---|
| 1180 | { |
---|
| 1181 | if(m_inheritCodingStruct[i] == 0) |
---|
| 1182 | { |
---|
| 1183 | for(Int j=1; j<MAX_GOP+1; j++) |
---|
| 1184 | { |
---|
| 1185 | m_EhGOPList[i][j-1] = m_GOPList[j-1]; |
---|
| 1186 | } |
---|
| 1187 | } |
---|
| 1188 | else if( m_inheritCodingStruct[i] > 0) |
---|
| 1189 | { |
---|
| 1190 | for(Int j=1; j<MAX_GOP+1; j++) |
---|
| 1191 | { |
---|
| 1192 | m_EhGOPList[i][j-1] = m_EhGOPList[m_inheritCodingStruct[i]][j-1]; |
---|
| 1193 | } |
---|
| 1194 | } |
---|
| 1195 | } |
---|
| 1196 | #endif |
---|
| 1197 | |
---|
[442] | 1198 | if(m_isField) |
---|
| 1199 | { |
---|
| 1200 | #if SVC_EXTENSION |
---|
| 1201 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 1202 | { |
---|
| 1203 | //Frame height |
---|
| 1204 | m_acLayerCfg[layer].m_iSourceHeightOrg = m_acLayerCfg[layer].m_iSourceHeight; |
---|
| 1205 | //Field height |
---|
| 1206 | m_acLayerCfg[layer].m_iSourceHeight = m_acLayerCfg[layer].m_iSourceHeight >> 1; |
---|
| 1207 | } |
---|
| 1208 | #else |
---|
| 1209 | //Frame height |
---|
| 1210 | m_iSourceHeightOrg = m_iSourceHeight; |
---|
| 1211 | //Field height |
---|
| 1212 | m_iSourceHeight = m_iSourceHeight >> 1; |
---|
| 1213 | #endif |
---|
| 1214 | //number of fields to encode |
---|
| 1215 | m_framesToBeEncoded *= 2; |
---|
| 1216 | } |
---|
| 1217 | |
---|
[313] | 1218 | for (list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++) |
---|
| 1219 | { |
---|
| 1220 | fprintf(stderr, "Unhandled argument ignored: `%s'\n", *it); |
---|
| 1221 | } |
---|
| 1222 | |
---|
| 1223 | if (argc == 1 || do_help) |
---|
| 1224 | { |
---|
| 1225 | /* argc == 1: no options have been specified */ |
---|
| 1226 | po::doHelp(cout, opts); |
---|
| 1227 | return false; |
---|
| 1228 | } |
---|
| 1229 | |
---|
| 1230 | /* |
---|
| 1231 | * Set any derived parameters |
---|
| 1232 | */ |
---|
| 1233 | /* convert std::string to c string for compatability */ |
---|
| 1234 | #if SVC_EXTENSION |
---|
| 1235 | #if AVC_BASE |
---|
[906] | 1236 | #if VPS_AVC_BL_FLAG_REMOVAL |
---|
| 1237 | if( m_nonHEVCBaseLayerFlag ) |
---|
| 1238 | #else |
---|
[313] | 1239 | if( m_avcBaseLayerFlag ) |
---|
[906] | 1240 | #endif |
---|
[313] | 1241 | { |
---|
| 1242 | *cfg_InputFile[0] = cfg_BLInputFile; |
---|
| 1243 | } |
---|
| 1244 | #endif |
---|
| 1245 | m_pBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str()); |
---|
[494] | 1246 | #else //SVC_EXTENSION |
---|
[313] | 1247 | m_pchInputFile = cfg_InputFile.empty() ? NULL : strdup(cfg_InputFile.c_str()); |
---|
| 1248 | m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str()); |
---|
| 1249 | m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str()); |
---|
| 1250 | m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str()); |
---|
[906] | 1251 | #if Q0074_COLOUR_REMAPPING_SEI |
---|
| 1252 | m_colourRemapSEIFile = cfg_colourRemapSEIFile.empty() ? NULL : strdup(cfg_colourRemapSEIFile.c_str()); |
---|
| 1253 | #endif |
---|
| 1254 | #endif //SVC_EXTENSION |
---|
[313] | 1255 | |
---|
[906] | 1256 | |
---|
| 1257 | Char* pColumnWidth = cfgColumnWidth.empty() ? NULL: strdup(cfgColumnWidth.c_str()); |
---|
| 1258 | Char* pRowHeight = cfgRowHeight.empty() ? NULL : strdup(cfgRowHeight.c_str()); |
---|
| 1259 | |
---|
| 1260 | if( !m_tileUniformSpacingFlag && m_numTileColumnsMinus1 > 0 ) |
---|
[313] | 1261 | { |
---|
[906] | 1262 | char *str; |
---|
[313] | 1263 | int i=0; |
---|
[906] | 1264 | m_tileColumnWidth.resize( m_numTileColumnsMinus1 ); |
---|
| 1265 | str = strtok(pColumnWidth, " ,-"); |
---|
| 1266 | while(str!=NULL) |
---|
[313] | 1267 | { |
---|
[906] | 1268 | if( i >= m_numTileColumnsMinus1 ) |
---|
[313] | 1269 | { |
---|
| 1270 | printf( "The number of columns whose width are defined is larger than the allowed number of columns.\n" ); |
---|
| 1271 | exit( EXIT_FAILURE ); |
---|
| 1272 | } |
---|
[906] | 1273 | m_tileColumnWidth[i] = atoi( str ); |
---|
| 1274 | str = strtok(NULL, " ,-"); |
---|
[313] | 1275 | i++; |
---|
| 1276 | } |
---|
[906] | 1277 | if( i < m_numTileColumnsMinus1 ) |
---|
[313] | 1278 | { |
---|
| 1279 | printf( "The width of some columns is not defined.\n" ); |
---|
| 1280 | exit( EXIT_FAILURE ); |
---|
| 1281 | } |
---|
| 1282 | } |
---|
| 1283 | else |
---|
| 1284 | { |
---|
[906] | 1285 | m_tileColumnWidth.clear(); |
---|
[313] | 1286 | } |
---|
| 1287 | |
---|
[906] | 1288 | if( !m_tileUniformSpacingFlag && m_numTileRowsMinus1 > 0 ) |
---|
[313] | 1289 | { |
---|
[906] | 1290 | char *str; |
---|
[313] | 1291 | int i=0; |
---|
[906] | 1292 | m_tileRowHeight.resize(m_numTileRowsMinus1); |
---|
| 1293 | str = strtok(pRowHeight, " ,-"); |
---|
| 1294 | while(str!=NULL) |
---|
[313] | 1295 | { |
---|
[906] | 1296 | if( i>=m_numTileRowsMinus1 ) |
---|
[313] | 1297 | { |
---|
| 1298 | printf( "The number of rows whose height are defined is larger than the allowed number of rows.\n" ); |
---|
| 1299 | exit( EXIT_FAILURE ); |
---|
| 1300 | } |
---|
[906] | 1301 | m_tileRowHeight[i] = atoi( str ); |
---|
| 1302 | str = strtok(NULL, " ,-"); |
---|
[313] | 1303 | i++; |
---|
| 1304 | } |
---|
[906] | 1305 | if( i < m_numTileRowsMinus1 ) |
---|
[313] | 1306 | { |
---|
| 1307 | printf( "The height of some rows is not defined.\n" ); |
---|
| 1308 | exit( EXIT_FAILURE ); |
---|
| 1309 | } |
---|
| 1310 | } |
---|
| 1311 | else |
---|
| 1312 | { |
---|
[906] | 1313 | m_tileRowHeight.clear(); |
---|
[313] | 1314 | } |
---|
[494] | 1315 | #if SVC_EXTENSION |
---|
[906] | 1316 | if( pColumnWidth ) |
---|
| 1317 | { |
---|
| 1318 | free( pColumnWidth ); |
---|
| 1319 | pColumnWidth = NULL; |
---|
| 1320 | } |
---|
| 1321 | |
---|
| 1322 | if( pRowHeight ) |
---|
| 1323 | { |
---|
| 1324 | free( pRowHeight ); |
---|
| 1325 | pRowHeight = NULL; |
---|
| 1326 | } |
---|
| 1327 | |
---|
[313] | 1328 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 1329 | { |
---|
| 1330 | // If number of scaled ref. layer offsets is non-zero, at least one of the offsets should be specified |
---|
| 1331 | if(m_acLayerCfg[layer].m_numScaledRefLayerOffsets) |
---|
| 1332 | { |
---|
[540] | 1333 | #if O0098_SCALED_REF_LAYER_ID |
---|
| 1334 | assert( strcmp(cfg_scaledRefLayerId[layer].c_str(), "")); |
---|
| 1335 | #endif |
---|
[906] | 1336 | #if REF_REGION_OFFSET |
---|
| 1337 | Bool srloFlag = |
---|
| 1338 | strcmp(cfg_scaledRefLayerLeftOffset [layer].c_str(), "") || |
---|
| 1339 | strcmp(cfg_scaledRefLayerRightOffset [layer].c_str(), "") || |
---|
| 1340 | strcmp(cfg_scaledRefLayerTopOffset [layer].c_str(), "") || |
---|
| 1341 | strcmp(cfg_scaledRefLayerBottomOffset [layer].c_str(), ""); |
---|
| 1342 | Bool rroFlag = |
---|
| 1343 | strcmp(cfg_refRegionLeftOffset [layer].c_str(), "") || |
---|
| 1344 | strcmp(cfg_refRegionRightOffset [layer].c_str(), "") || |
---|
| 1345 | strcmp(cfg_refRegionTopOffset [layer].c_str(), "") || |
---|
| 1346 | strcmp(cfg_refRegionBottomOffset [layer].c_str(), ""); |
---|
| 1347 | #if R0209_GENERIC_PHASE |
---|
| 1348 | Bool phaseSetFlag = |
---|
| 1349 | strcmp(cfg_phaseHorLuma [layer].c_str(), "") || |
---|
| 1350 | strcmp(cfg_phaseVerLuma [layer].c_str(), "") || |
---|
| 1351 | strcmp(cfg_phaseHorChroma [layer].c_str(), "") || |
---|
| 1352 | strcmp(cfg_phaseVerChroma [layer].c_str(), ""); |
---|
| 1353 | assert( srloFlag || rroFlag || phaseSetFlag); |
---|
| 1354 | #else |
---|
| 1355 | assert( srloFlag || rroFlag ); |
---|
| 1356 | #endif |
---|
| 1357 | #else |
---|
[644] | 1358 | #if P0312_VERT_PHASE_ADJ |
---|
[313] | 1359 | assert( strcmp(cfg_scaledRefLayerLeftOffset[layer].c_str(), "") || |
---|
| 1360 | strcmp(cfg_scaledRefLayerRightOffset[layer].c_str(), "") || |
---|
| 1361 | strcmp(cfg_scaledRefLayerTopOffset[layer].c_str(), "") || |
---|
[644] | 1362 | strcmp(cfg_scaledRefLayerBottomOffset[layer].c_str(),"") || |
---|
| 1363 | strcmp(cfg_vertPhasePositionEnableFlag[layer].c_str(),"") ); |
---|
| 1364 | #else |
---|
| 1365 | assert( strcmp(cfg_scaledRefLayerLeftOffset[layer].c_str(), "") || |
---|
| 1366 | strcmp(cfg_scaledRefLayerRightOffset[layer].c_str(), "") || |
---|
| 1367 | strcmp(cfg_scaledRefLayerTopOffset[layer].c_str(), "") || |
---|
| 1368 | strcmp(cfg_scaledRefLayerBottomOffset[layer].c_str(),"") ); |
---|
| 1369 | #endif |
---|
[906] | 1370 | #endif |
---|
[313] | 1371 | } |
---|
| 1372 | |
---|
| 1373 | Int *tempArray = NULL; // Contain the value |
---|
[540] | 1374 | |
---|
| 1375 | #if O0098_SCALED_REF_LAYER_ID |
---|
| 1376 | // ID // |
---|
| 1377 | if(strcmp(cfg_scaledRefLayerId[layer].c_str(), "")) |
---|
| 1378 | { |
---|
| 1379 | cfgStringToArray( &tempArray, cfg_scaledRefLayerId[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "ScaledRefLayerId"); |
---|
| 1380 | if(tempArray) |
---|
| 1381 | { |
---|
| 1382 | for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) |
---|
| 1383 | { |
---|
| 1384 | m_acLayerCfg[layer].m_scaledRefLayerId[i] = tempArray[i]; |
---|
| 1385 | } |
---|
| 1386 | delete [] tempArray; tempArray = NULL; |
---|
| 1387 | } |
---|
| 1388 | } |
---|
| 1389 | #endif |
---|
| 1390 | |
---|
[906] | 1391 | #if REF_REGION_OFFSET |
---|
| 1392 | // Presense Flag // |
---|
| 1393 | if(strcmp(cfg_scaledRefLayerOffsetPresentFlag[layer].c_str(), "")) |
---|
| 1394 | { |
---|
| 1395 | cfgStringToArray( &tempArray, cfg_scaledRefLayerOffsetPresentFlag[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "ScaledRefLayerOffsetPresentFlag"); |
---|
| 1396 | if(tempArray) |
---|
| 1397 | { |
---|
| 1398 | for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) |
---|
| 1399 | { |
---|
| 1400 | m_acLayerCfg[layer].m_scaledRefLayerOffsetPresentFlag[i] = tempArray[i]; |
---|
| 1401 | } |
---|
| 1402 | delete [] tempArray; tempArray = NULL; |
---|
| 1403 | } |
---|
| 1404 | } |
---|
| 1405 | #endif |
---|
| 1406 | |
---|
[313] | 1407 | // Left offset // |
---|
| 1408 | if(strcmp(cfg_scaledRefLayerLeftOffset[layer].c_str(), "")) |
---|
| 1409 | { |
---|
| 1410 | cfgStringToArray( &tempArray, cfg_scaledRefLayerLeftOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "LeftOffset"); |
---|
| 1411 | if(tempArray) |
---|
| 1412 | { |
---|
| 1413 | for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) |
---|
| 1414 | { |
---|
| 1415 | m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i] = tempArray[i]; |
---|
| 1416 | } |
---|
| 1417 | delete [] tempArray; tempArray = NULL; |
---|
| 1418 | } |
---|
| 1419 | } |
---|
| 1420 | |
---|
| 1421 | // Top offset // |
---|
| 1422 | if(strcmp(cfg_scaledRefLayerTopOffset[layer].c_str(), "")) |
---|
| 1423 | { |
---|
| 1424 | cfgStringToArray( &tempArray, cfg_scaledRefLayerTopOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "TopOffset"); |
---|
| 1425 | if(tempArray) |
---|
| 1426 | { |
---|
| 1427 | for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) |
---|
| 1428 | { |
---|
| 1429 | m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i] = tempArray[i]; |
---|
| 1430 | } |
---|
| 1431 | delete [] tempArray; tempArray = NULL; |
---|
| 1432 | } |
---|
| 1433 | } |
---|
| 1434 | |
---|
| 1435 | // Right offset // |
---|
| 1436 | if(strcmp(cfg_scaledRefLayerRightOffset[layer].c_str(), "")) |
---|
| 1437 | { |
---|
| 1438 | cfgStringToArray( &tempArray, cfg_scaledRefLayerRightOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "RightOffset"); |
---|
| 1439 | if(tempArray) |
---|
| 1440 | { |
---|
| 1441 | for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) |
---|
| 1442 | { |
---|
| 1443 | m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i] = tempArray[i]; |
---|
| 1444 | } |
---|
| 1445 | delete [] tempArray; tempArray = NULL; |
---|
| 1446 | } |
---|
| 1447 | } |
---|
| 1448 | |
---|
| 1449 | // Bottom offset // |
---|
| 1450 | if(strcmp(cfg_scaledRefLayerBottomOffset[layer].c_str(), "")) |
---|
| 1451 | { |
---|
| 1452 | cfgStringToArray( &tempArray, cfg_scaledRefLayerBottomOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "BottomOffset"); |
---|
| 1453 | if(tempArray) |
---|
| 1454 | { |
---|
| 1455 | for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) |
---|
| 1456 | { |
---|
| 1457 | m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i] = tempArray[i]; |
---|
| 1458 | } |
---|
| 1459 | delete [] tempArray; tempArray = NULL; |
---|
| 1460 | } |
---|
| 1461 | } |
---|
[644] | 1462 | #if P0312_VERT_PHASE_ADJ |
---|
| 1463 | // VertPhasePositionEnableFlag // |
---|
| 1464 | if(strcmp(cfg_vertPhasePositionEnableFlag[layer].c_str(), "")) |
---|
| 1465 | { |
---|
| 1466 | cfgStringToArray( &tempArray, cfg_vertPhasePositionEnableFlag[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "VertPhasePositionEnableFlag"); |
---|
| 1467 | if(tempArray) |
---|
| 1468 | { |
---|
| 1469 | for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) |
---|
| 1470 | { |
---|
| 1471 | m_acLayerCfg[layer].m_vertPhasePositionEnableFlag[i] = tempArray[i]; |
---|
| 1472 | } |
---|
| 1473 | delete [] tempArray; tempArray = NULL; |
---|
| 1474 | } |
---|
| 1475 | } |
---|
| 1476 | #endif |
---|
[906] | 1477 | #if REF_REGION_OFFSET |
---|
| 1478 | // Presense Flag // |
---|
| 1479 | if(strcmp(cfg_refRegionOffsetPresentFlag[layer].c_str(), "")) |
---|
| 1480 | { |
---|
| 1481 | cfgStringToArray( &tempArray, cfg_refRegionOffsetPresentFlag[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "RefRegionOffsetPresentFlag"); |
---|
| 1482 | if(tempArray) |
---|
| 1483 | { |
---|
| 1484 | for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) |
---|
| 1485 | { |
---|
| 1486 | m_acLayerCfg[layer].m_refRegionOffsetPresentFlag[i] = tempArray[i]; |
---|
| 1487 | } |
---|
| 1488 | delete [] tempArray; tempArray = NULL; |
---|
| 1489 | } |
---|
| 1490 | } |
---|
| 1491 | |
---|
| 1492 | // Left offset // |
---|
| 1493 | if(strcmp(cfg_refRegionLeftOffset[layer].c_str(), "")) |
---|
| 1494 | { |
---|
| 1495 | cfgStringToArray( &tempArray, cfg_refRegionLeftOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "RefRegionLeftOffset"); |
---|
| 1496 | if(tempArray) |
---|
| 1497 | { |
---|
| 1498 | for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) |
---|
| 1499 | { |
---|
| 1500 | m_acLayerCfg[layer].m_refRegionLeftOffset[i] = tempArray[i]; |
---|
| 1501 | } |
---|
| 1502 | delete [] tempArray; tempArray = NULL; |
---|
| 1503 | } |
---|
| 1504 | } |
---|
| 1505 | |
---|
| 1506 | // Top offset // |
---|
| 1507 | if(strcmp(cfg_refRegionTopOffset[layer].c_str(), "")) |
---|
| 1508 | { |
---|
| 1509 | cfgStringToArray( &tempArray, cfg_refRegionTopOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "RefRegionTopOffset"); |
---|
| 1510 | if(tempArray) |
---|
| 1511 | { |
---|
| 1512 | for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) |
---|
| 1513 | { |
---|
| 1514 | m_acLayerCfg[layer].m_refRegionTopOffset[i] = tempArray[i]; |
---|
| 1515 | } |
---|
| 1516 | delete [] tempArray; tempArray = NULL; |
---|
| 1517 | } |
---|
| 1518 | } |
---|
| 1519 | |
---|
| 1520 | // Right offset // |
---|
| 1521 | if(strcmp(cfg_refRegionRightOffset[layer].c_str(), "")) |
---|
| 1522 | { |
---|
| 1523 | cfgStringToArray( &tempArray, cfg_refRegionRightOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "RefRegionRightOffset"); |
---|
| 1524 | if(tempArray) |
---|
| 1525 | { |
---|
| 1526 | for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) |
---|
| 1527 | { |
---|
| 1528 | m_acLayerCfg[layer].m_refRegionRightOffset[i] = tempArray[i]; |
---|
| 1529 | } |
---|
| 1530 | delete [] tempArray; tempArray = NULL; |
---|
| 1531 | } |
---|
| 1532 | } |
---|
| 1533 | |
---|
| 1534 | // Bottom offset // |
---|
| 1535 | if(strcmp(cfg_refRegionBottomOffset[layer].c_str(), "")) |
---|
| 1536 | { |
---|
| 1537 | cfgStringToArray( &tempArray, cfg_refRegionBottomOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "RefRegionBottomOffset"); |
---|
| 1538 | if(tempArray) |
---|
| 1539 | { |
---|
| 1540 | for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) |
---|
| 1541 | { |
---|
| 1542 | m_acLayerCfg[layer].m_refRegionBottomOffset[i] = tempArray[i]; |
---|
| 1543 | } |
---|
| 1544 | delete [] tempArray; tempArray = NULL; |
---|
| 1545 | } |
---|
| 1546 | } |
---|
| 1547 | #endif |
---|
| 1548 | #if R0209_GENERIC_PHASE |
---|
| 1549 | Int numPhaseSet = m_acLayerCfg[layer].m_numScaledRefLayerOffsets; |
---|
| 1550 | |
---|
| 1551 | // Presense Flag // |
---|
| 1552 | if(strcmp(cfg_resamplePhaseSetPresentFlag[layer].c_str(), "")) |
---|
| 1553 | { |
---|
| 1554 | cfgStringToArray( &tempArray, cfg_resamplePhaseSetPresentFlag[layer], numPhaseSet, "resamplePhaseSetPresentFlag"); |
---|
| 1555 | if(tempArray) |
---|
| 1556 | { |
---|
| 1557 | for(Int i = 0; i < numPhaseSet; i++) |
---|
| 1558 | { |
---|
| 1559 | m_acLayerCfg[layer].m_resamplePhaseSetPresentFlag[i] = tempArray[i]; |
---|
| 1560 | } |
---|
| 1561 | delete [] tempArray; tempArray = NULL; |
---|
| 1562 | } |
---|
| 1563 | } |
---|
| 1564 | |
---|
| 1565 | // Luma horizontal phase // |
---|
| 1566 | if(strcmp(cfg_phaseHorLuma[layer].c_str(), "")) |
---|
| 1567 | { |
---|
| 1568 | cfgStringToArray( &tempArray, cfg_phaseHorLuma[layer], numPhaseSet, "phaseHorLuma"); |
---|
| 1569 | if(tempArray) |
---|
| 1570 | { |
---|
| 1571 | for(Int i = 0; i < numPhaseSet; i++) |
---|
| 1572 | { |
---|
| 1573 | m_acLayerCfg[layer].m_phaseHorLuma[i] = tempArray[i]; |
---|
| 1574 | } |
---|
| 1575 | delete [] tempArray; tempArray = NULL; |
---|
| 1576 | } |
---|
| 1577 | } |
---|
| 1578 | |
---|
| 1579 | // Luma vertical phase // |
---|
| 1580 | if(strcmp(cfg_phaseVerLuma[layer].c_str(), "")) |
---|
| 1581 | { |
---|
| 1582 | cfgStringToArray( &tempArray, cfg_phaseVerLuma[layer], numPhaseSet, "phaseVerLuma"); |
---|
| 1583 | if(tempArray) |
---|
| 1584 | { |
---|
| 1585 | for(Int i = 0; i < numPhaseSet; i++) |
---|
| 1586 | { |
---|
| 1587 | m_acLayerCfg[layer].m_phaseVerLuma[i] = tempArray[i]; |
---|
| 1588 | } |
---|
| 1589 | delete [] tempArray; tempArray = NULL; |
---|
| 1590 | } |
---|
| 1591 | } |
---|
| 1592 | |
---|
| 1593 | // Chroma horizontal phase // |
---|
| 1594 | if(strcmp(cfg_phaseHorChroma[layer].c_str(), "")) |
---|
| 1595 | { |
---|
| 1596 | cfgStringToArray( &tempArray, cfg_phaseHorChroma[layer], numPhaseSet, "phaseHorChroma"); |
---|
| 1597 | if(tempArray) |
---|
| 1598 | { |
---|
| 1599 | for(Int i = 0; i < numPhaseSet; i++) |
---|
| 1600 | { |
---|
| 1601 | m_acLayerCfg[layer].m_phaseHorChroma[i] = tempArray[i]; |
---|
| 1602 | } |
---|
| 1603 | delete [] tempArray; tempArray = NULL; |
---|
| 1604 | } |
---|
| 1605 | } |
---|
| 1606 | |
---|
| 1607 | // Chroma vertical phase // |
---|
| 1608 | if(strcmp(cfg_phaseVerChroma[layer].c_str(), "")) |
---|
| 1609 | { |
---|
| 1610 | cfgStringToArray( &tempArray, cfg_phaseVerChroma[layer], numPhaseSet, "phaseVerChroma"); |
---|
| 1611 | if(tempArray) |
---|
| 1612 | { |
---|
| 1613 | for(Int i = 0; i < numPhaseSet; i++) |
---|
| 1614 | { |
---|
| 1615 | m_acLayerCfg[layer].m_phaseVerChroma[i] = tempArray[i]; |
---|
| 1616 | } |
---|
| 1617 | delete [] tempArray; tempArray = NULL; |
---|
| 1618 | } |
---|
| 1619 | } |
---|
| 1620 | #endif |
---|
[313] | 1621 | } |
---|
[906] | 1622 | |
---|
[313] | 1623 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
| 1624 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 1625 | { |
---|
| 1626 | Char* pSamplePredRefLayerIds = cfg_samplePredRefLayerIds[layer].empty() ? NULL: strdup(cfg_samplePredRefLayerIds[layer].c_str()); |
---|
| 1627 | if( m_acLayerCfg[layer].m_numSamplePredRefLayers > 0 ) |
---|
| 1628 | { |
---|
| 1629 | char *samplePredRefLayerId; |
---|
| 1630 | int i=0; |
---|
| 1631 | m_acLayerCfg[layer].m_samplePredRefLayerIds = new Int[m_acLayerCfg[layer].m_numSamplePredRefLayers]; |
---|
| 1632 | samplePredRefLayerId = strtok(pSamplePredRefLayerIds, " ,-"); |
---|
| 1633 | while(samplePredRefLayerId != NULL) |
---|
| 1634 | { |
---|
| 1635 | if( i >= m_acLayerCfg[layer].m_numSamplePredRefLayers ) |
---|
| 1636 | { |
---|
[713] | 1637 | printf( "NumSamplePredRefLayers%d: The number of columns whose width are defined is larger than the allowed number of columns.\n", layer ); |
---|
[313] | 1638 | exit( EXIT_FAILURE ); |
---|
| 1639 | } |
---|
| 1640 | *( m_acLayerCfg[layer].m_samplePredRefLayerIds + i ) = atoi( samplePredRefLayerId ); |
---|
| 1641 | samplePredRefLayerId = strtok(NULL, " ,-"); |
---|
| 1642 | i++; |
---|
| 1643 | } |
---|
| 1644 | if( i < m_acLayerCfg[layer].m_numSamplePredRefLayers ) |
---|
| 1645 | { |
---|
[713] | 1646 | printf( "NumSamplePredRefLayers%d: The width of some columns is not defined.\n", layer ); |
---|
[313] | 1647 | exit( EXIT_FAILURE ); |
---|
| 1648 | } |
---|
| 1649 | } |
---|
| 1650 | else |
---|
| 1651 | { |
---|
| 1652 | m_acLayerCfg[layer].m_samplePredRefLayerIds = NULL; |
---|
| 1653 | } |
---|
[906] | 1654 | |
---|
| 1655 | if( pSamplePredRefLayerIds ) |
---|
| 1656 | { |
---|
| 1657 | free( pSamplePredRefLayerIds ); |
---|
| 1658 | pSamplePredRefLayerIds = NULL; |
---|
| 1659 | } |
---|
[313] | 1660 | } |
---|
| 1661 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 1662 | { |
---|
| 1663 | Char* pMotionPredRefLayerIds = cfg_motionPredRefLayerIds[layer].empty() ? NULL: strdup(cfg_motionPredRefLayerIds[layer].c_str()); |
---|
| 1664 | if( m_acLayerCfg[layer].m_numMotionPredRefLayers > 0 ) |
---|
| 1665 | { |
---|
| 1666 | char *motionPredRefLayerId; |
---|
| 1667 | int i=0; |
---|
| 1668 | m_acLayerCfg[layer].m_motionPredRefLayerIds = new Int[m_acLayerCfg[layer].m_numMotionPredRefLayers]; |
---|
| 1669 | motionPredRefLayerId = strtok(pMotionPredRefLayerIds, " ,-"); |
---|
| 1670 | while(motionPredRefLayerId != NULL) |
---|
| 1671 | { |
---|
| 1672 | if( i >= m_acLayerCfg[layer].m_numMotionPredRefLayers ) |
---|
| 1673 | { |
---|
[713] | 1674 | printf( "NumMotionPredRefLayers%d: The number of columns whose width are defined is larger than the allowed number of columns.\n", layer ); |
---|
[313] | 1675 | exit( EXIT_FAILURE ); |
---|
| 1676 | } |
---|
| 1677 | *( m_acLayerCfg[layer].m_motionPredRefLayerIds + i ) = atoi( motionPredRefLayerId ); |
---|
| 1678 | motionPredRefLayerId = strtok(NULL, " ,-"); |
---|
| 1679 | i++; |
---|
| 1680 | } |
---|
| 1681 | if( i < m_acLayerCfg[layer].m_numMotionPredRefLayers ) |
---|
| 1682 | { |
---|
[713] | 1683 | printf( "NumMotionPredRefLayers%d: The width of some columns is not defined.\n", layer ); |
---|
[313] | 1684 | exit( EXIT_FAILURE ); |
---|
| 1685 | } |
---|
| 1686 | } |
---|
| 1687 | else |
---|
| 1688 | { |
---|
| 1689 | m_acLayerCfg[layer].m_motionPredRefLayerIds = NULL; |
---|
| 1690 | } |
---|
[906] | 1691 | |
---|
| 1692 | if( pMotionPredRefLayerIds ) |
---|
| 1693 | { |
---|
| 1694 | free( pMotionPredRefLayerIds ); |
---|
| 1695 | pMotionPredRefLayerIds = NULL; |
---|
| 1696 | } |
---|
[313] | 1697 | } |
---|
[588] | 1698 | |
---|
[494] | 1699 | #if AUXILIARY_PICTURES |
---|
| 1700 | for(UInt layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 1701 | { |
---|
| 1702 | m_acLayerCfg[layer].m_InputChromaFormat = numberToChromaFormat(cfg_tmpChromaFormatIDC[layer]); |
---|
| 1703 | m_acLayerCfg[layer].m_chromaFormatIDC = ((cfg_tmpChromaFormatIDC[layer] == 0) ? (m_acLayerCfg[layer].m_InputChromaFormat ) : (numberToChromaFormat(cfg_tmpChromaFormatIDC[layer]))); |
---|
| 1704 | } |
---|
| 1705 | #endif |
---|
[313] | 1706 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 1707 | { |
---|
| 1708 | Char* pPredLayerIds = cfg_predLayerIds[layer].empty() ? NULL: strdup(cfg_predLayerIds[layer].c_str()); |
---|
| 1709 | if( m_acLayerCfg[layer].m_numActiveRefLayers > 0 ) |
---|
| 1710 | { |
---|
| 1711 | char *refLayerId; |
---|
| 1712 | int i=0; |
---|
| 1713 | m_acLayerCfg[layer].m_predLayerIds = new Int[m_acLayerCfg[layer].m_numActiveRefLayers]; |
---|
| 1714 | refLayerId = strtok(pPredLayerIds, " ,-"); |
---|
| 1715 | while(refLayerId != NULL) |
---|
| 1716 | { |
---|
| 1717 | if( i >= m_acLayerCfg[layer].m_numActiveRefLayers ) |
---|
| 1718 | { |
---|
[713] | 1719 | printf( "NumActiveRefLayers%d: The number of columns whose width are defined is larger than the allowed number of columns.\n", layer ); |
---|
[313] | 1720 | exit( EXIT_FAILURE ); |
---|
| 1721 | } |
---|
| 1722 | *( m_acLayerCfg[layer].m_predLayerIds + i ) = atoi( refLayerId ); |
---|
| 1723 | refLayerId = strtok(NULL, " ,-"); |
---|
| 1724 | i++; |
---|
| 1725 | } |
---|
| 1726 | if( i < m_acLayerCfg[layer].m_numActiveRefLayers ) |
---|
| 1727 | { |
---|
[713] | 1728 | printf( "NumActiveRefLayers%d: The width of some columns is not defined.\n", layer ); |
---|
[313] | 1729 | exit( EXIT_FAILURE ); |
---|
| 1730 | } |
---|
| 1731 | } |
---|
| 1732 | else |
---|
| 1733 | { |
---|
| 1734 | m_acLayerCfg[layer].m_predLayerIds = NULL; |
---|
| 1735 | } |
---|
[906] | 1736 | |
---|
| 1737 | if( pPredLayerIds ) |
---|
| 1738 | { |
---|
| 1739 | free( pPredLayerIds ); |
---|
| 1740 | pPredLayerIds = NULL; |
---|
| 1741 | } |
---|
[313] | 1742 | } |
---|
| 1743 | #endif |
---|
[815] | 1744 | #if Q0078_ADD_LAYER_SETS |
---|
[906] | 1745 | #if OUTPUT_LAYER_SETS_CONFIG |
---|
| 1746 | for (Int layerSet = 1; layerSet < m_numLayerSets; layerSet++) |
---|
| 1747 | { |
---|
| 1748 | // Simplifying the code in the #else section, and allowing 0-th layer set t |
---|
| 1749 | assert( scanStringToArray( cfg_layerSetLayerIdList[layerSet], m_numLayerInIdList[layerSet], "NumLayerInIdList", m_layerSetLayerIdList[layerSet] ) ); |
---|
| 1750 | #else |
---|
[815] | 1751 | for (Int layerSet = 0; layerSet < m_numLayerSets; layerSet++) |
---|
| 1752 | { |
---|
| 1753 | if (m_numLayerInIdList[layerSet] > 0) |
---|
| 1754 | { |
---|
| 1755 | Char* layerSetLayerIdListDup = cfg_layerSetLayerIdList[layerSet].empty() ? NULL : strdup(cfg_layerSetLayerIdList[layerSet].c_str()); |
---|
| 1756 | Int i = 0; |
---|
| 1757 | char *layerId = strtok(layerSetLayerIdListDup, " ,-"); |
---|
| 1758 | while (layerId != NULL) |
---|
| 1759 | { |
---|
| 1760 | if (i >= m_numLayerInIdList[layerSet]) |
---|
| 1761 | { |
---|
| 1762 | printf("NumLayerInIdList%d: The number of layers in the set is larger than the allowed number of layers.\n", layerSet); |
---|
| 1763 | exit(EXIT_FAILURE); |
---|
| 1764 | } |
---|
| 1765 | m_layerSetLayerIdList[layerSet][i] = atoi(layerId); |
---|
| 1766 | layerId = strtok(NULL, " ,-"); |
---|
| 1767 | i++; |
---|
| 1768 | } |
---|
[906] | 1769 | |
---|
| 1770 | if( layerSetLayerIdListDup ) |
---|
| 1771 | { |
---|
| 1772 | free( layerSetLayerIdListDup ); |
---|
| 1773 | layerSetLayerIdListDup = NULL; |
---|
| 1774 | } |
---|
[815] | 1775 | } |
---|
[906] | 1776 | #endif |
---|
[815] | 1777 | } |
---|
| 1778 | for (Int addLayerSet = 0; addLayerSet < m_numAddLayerSets; addLayerSet++) |
---|
| 1779 | { |
---|
[906] | 1780 | #if OUTPUT_LAYER_SETS_CONFIG |
---|
| 1781 | // Simplifying the code in the #else section |
---|
| 1782 | assert( scanStringToArray( cfg_layerSetLayerIdList[addLayerSet], m_numLayerInIdList[addLayerSet], "NumLayerInIdList", m_highestLayerIdx[addLayerSet] ) ); |
---|
| 1783 | #else |
---|
[815] | 1784 | if (m_numHighestLayerIdx[addLayerSet] > 0) |
---|
| 1785 | { |
---|
| 1786 | Char* highestLayrIdxListDup = cfg_highestLayerIdx[addLayerSet].empty() ? NULL : strdup(cfg_highestLayerIdx[addLayerSet].c_str()); |
---|
| 1787 | Int i = 0; |
---|
| 1788 | char *layerIdx = strtok(highestLayrIdxListDup, " ,-"); |
---|
| 1789 | while (layerIdx != NULL) |
---|
| 1790 | { |
---|
| 1791 | if (i >= m_numLayerInIdList[addLayerSet]) |
---|
| 1792 | { |
---|
| 1793 | printf("NumLayerInIdList%d: The number of layer idx's in the highest layer idx list is larger than the allowed number of idx's.\n", addLayerSet); |
---|
| 1794 | exit(EXIT_FAILURE); |
---|
| 1795 | } |
---|
| 1796 | m_highestLayerIdx[addLayerSet][i] = atoi(layerIdx); |
---|
| 1797 | layerIdx = strtok(NULL, " ,-"); |
---|
| 1798 | i++; |
---|
| 1799 | } |
---|
[906] | 1800 | |
---|
| 1801 | if( highestLayrIdxListDup ) |
---|
| 1802 | { |
---|
| 1803 | free( highestLayrIdxListDup ); |
---|
| 1804 | highestLayrIdxListDup = NULL; |
---|
| 1805 | } |
---|
[815] | 1806 | } |
---|
[906] | 1807 | #endif |
---|
[815] | 1808 | } |
---|
| 1809 | #endif |
---|
[906] | 1810 | #if OUTPUT_LAYER_SETS_CONFIG |
---|
| 1811 | if( m_defaultTargetOutputLayerIdc != -1 ) |
---|
| 1812 | { |
---|
| 1813 | assert( m_defaultTargetOutputLayerIdc >= 0 && m_defaultTargetOutputLayerIdc <= 3 ); |
---|
| 1814 | } |
---|
| 1815 | assert( m_numOutputLayerSets != 0 ); |
---|
| 1816 | assert( m_numOutputLayerSets >= m_numLayerSets + m_numAddLayerSets ); // Number of output layer sets must be at least as many as layer sets. |
---|
| 1817 | |
---|
| 1818 | // If output layer Set Idx is specified, only specify it for the non-default output layer sets |
---|
| 1819 | Int numNonDefaultOls = m_numOutputLayerSets - (m_numLayerSets + m_numAddLayerSets); |
---|
| 1820 | if( numNonDefaultOls ) |
---|
| 1821 | { |
---|
| 1822 | assert( scanStringToArray( *cfg_outputLayerSetIdx, numNonDefaultOls, "OutputLayerSetIdx", m_outputLayerSetIdx ) ); |
---|
| 1823 | for(Int i = 0; i < numNonDefaultOls; i++) |
---|
| 1824 | { |
---|
| 1825 | assert( m_outputLayerSetIdx[i] >= 0 && m_outputLayerSetIdx[i] < (m_numLayerSets + m_numAddLayerSets) ); |
---|
| 1826 | } |
---|
| 1827 | } |
---|
| 1828 | |
---|
| 1829 | // Number of output layers in output layer sets |
---|
| 1830 | scanStringToArray( *cfg_numLayersInOutputLayerSet, m_numOutputLayerSets - 1, "NumLayersInOutputLayerSets", m_numLayersInOutputLayerSet ); |
---|
| 1831 | m_numLayersInOutputLayerSet.insert(m_numLayersInOutputLayerSet.begin(), 1); |
---|
| 1832 | // Layers in the output layer set |
---|
| 1833 | m_listOfOutputLayers.resize(m_numOutputLayerSets); |
---|
| 1834 | Int startOlsCtr = 1; |
---|
| 1835 | if( m_defaultTargetOutputLayerIdc == 0 || m_defaultTargetOutputLayerIdc == 1 ) |
---|
| 1836 | { |
---|
| 1837 | // Default output layer sets defined |
---|
| 1838 | startOlsCtr = m_numLayerSets + m_numAddLayerSets; |
---|
| 1839 | } |
---|
| 1840 | for( Int olsCtr = 1; olsCtr < m_numOutputLayerSets; olsCtr++ ) |
---|
| 1841 | { |
---|
| 1842 | if( olsCtr < startOlsCtr ) |
---|
| 1843 | { |
---|
| 1844 | if(scanStringToArray( cfg_listOfOutputLayers[olsCtr], m_numLayersInOutputLayerSet[olsCtr], "ListOfOutputLayers", m_listOfOutputLayers[olsCtr] ) ) |
---|
| 1845 | { |
---|
| 1846 | std::cout << "Default OLS defined. Ignoring ListOfOutputLayers" << olsCtr << endl; |
---|
| 1847 | } |
---|
| 1848 | } |
---|
| 1849 | else |
---|
| 1850 | { |
---|
| 1851 | assert( scanStringToArray( cfg_listOfOutputLayers[olsCtr], m_numLayersInOutputLayerSet[olsCtr], "ListOfOutputLayers", m_listOfOutputLayers[olsCtr] ) ); |
---|
| 1852 | } |
---|
| 1853 | } |
---|
| 1854 | delete cfg_numLayersInOutputLayerSet; |
---|
| 1855 | delete [] cfg_listOfOutputLayers; |
---|
| 1856 | delete cfg_outputLayerSetIdx; |
---|
| 1857 | #endif |
---|
[494] | 1858 | #endif //SVC_EXTENSION |
---|
[313] | 1859 | m_scalingListFile = cfg_ScalingListFile.empty() ? NULL : strdup(cfg_ScalingListFile.c_str()); |
---|
[442] | 1860 | |
---|
[494] | 1861 | /* rules for input, output and internal bitdepths as per help text */ |
---|
| 1862 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
[442] | 1863 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 1864 | { |
---|
[494] | 1865 | if (!m_acLayerCfg[layer].m_internalBitDepthY) { m_acLayerCfg[layer].m_internalBitDepthY = m_acLayerCfg[layer].m_inputBitDepthY; } |
---|
| 1866 | if (!m_acLayerCfg[layer].m_internalBitDepthC) { m_acLayerCfg[layer].m_internalBitDepthC = m_acLayerCfg[layer].m_internalBitDepthY; } |
---|
| 1867 | if (!m_acLayerCfg[layer].m_inputBitDepthC) { m_acLayerCfg[layer].m_inputBitDepthC = m_acLayerCfg[layer].m_inputBitDepthY; } |
---|
| 1868 | if (!m_acLayerCfg[layer].m_outputBitDepthY) { m_acLayerCfg[layer].m_outputBitDepthY = m_acLayerCfg[layer].m_internalBitDepthY; } |
---|
| 1869 | if (!m_acLayerCfg[layer].m_outputBitDepthC) { m_acLayerCfg[layer].m_outputBitDepthC = m_acLayerCfg[layer].m_internalBitDepthC; } |
---|
[442] | 1870 | } |
---|
[494] | 1871 | #else |
---|
[313] | 1872 | if (!m_internalBitDepthY) { m_internalBitDepthY = m_inputBitDepthY; } |
---|
| 1873 | if (!m_internalBitDepthC) { m_internalBitDepthC = m_internalBitDepthY; } |
---|
| 1874 | if (!m_inputBitDepthC) { m_inputBitDepthC = m_inputBitDepthY; } |
---|
| 1875 | if (!m_outputBitDepthY) { m_outputBitDepthY = m_internalBitDepthY; } |
---|
| 1876 | if (!m_outputBitDepthC) { m_outputBitDepthC = m_internalBitDepthC; } |
---|
[494] | 1877 | #endif |
---|
[313] | 1878 | |
---|
| 1879 | #if !SVC_EXTENSION |
---|
| 1880 | // TODO:ChromaFmt assumes 4:2:0 below |
---|
[906] | 1881 | switch (m_conformanceWindowMode) |
---|
[313] | 1882 | { |
---|
| 1883 | case 0: |
---|
| 1884 | { |
---|
| 1885 | // no conformance or padding |
---|
[906] | 1886 | m_confWinLeft = m_confWinRight = m_confWinTop = m_confWinBottom = 0; |
---|
[313] | 1887 | m_aiPad[1] = m_aiPad[0] = 0; |
---|
| 1888 | break; |
---|
| 1889 | } |
---|
| 1890 | case 1: |
---|
| 1891 | { |
---|
| 1892 | // automatic padding to minimum CU size |
---|
| 1893 | Int minCuSize = m_uiMaxCUHeight >> (m_uiMaxCUDepth - 1); |
---|
| 1894 | if (m_iSourceWidth % minCuSize) |
---|
| 1895 | { |
---|
[906] | 1896 | m_aiPad[0] = m_confWinRight = ((m_iSourceWidth / minCuSize) + 1) * minCuSize - m_iSourceWidth; |
---|
| 1897 | m_iSourceWidth += m_confWinRight; |
---|
[313] | 1898 | } |
---|
| 1899 | if (m_iSourceHeight % minCuSize) |
---|
| 1900 | { |
---|
[906] | 1901 | m_aiPad[1] = m_confWinBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight; |
---|
| 1902 | m_iSourceHeight += m_confWinBottom; |
---|
[442] | 1903 | if ( m_isField ) |
---|
| 1904 | { |
---|
[906] | 1905 | m_iSourceHeightOrg += m_confWinBottom << 1; |
---|
| 1906 | m_aiPad[1] = m_confWinBottom << 1; |
---|
[442] | 1907 | } |
---|
[313] | 1908 | } |
---|
| 1909 | if (m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0) |
---|
| 1910 | { |
---|
| 1911 | fprintf(stderr, "Error: picture width is not an integer multiple of the specified chroma subsampling\n"); |
---|
| 1912 | exit(EXIT_FAILURE); |
---|
| 1913 | } |
---|
| 1914 | if (m_aiPad[1] % TComSPS::getWinUnitY(CHROMA_420) != 0) |
---|
| 1915 | { |
---|
| 1916 | fprintf(stderr, "Error: picture height is not an integer multiple of the specified chroma subsampling\n"); |
---|
| 1917 | exit(EXIT_FAILURE); |
---|
| 1918 | } |
---|
| 1919 | break; |
---|
| 1920 | } |
---|
| 1921 | case 2: |
---|
| 1922 | { |
---|
| 1923 | //padding |
---|
| 1924 | m_iSourceWidth += m_aiPad[0]; |
---|
| 1925 | m_iSourceHeight += m_aiPad[1]; |
---|
[906] | 1926 | m_confWinRight = m_aiPad[0]; |
---|
| 1927 | m_confWinBottom = m_aiPad[1]; |
---|
[313] | 1928 | break; |
---|
| 1929 | } |
---|
| 1930 | case 3: |
---|
| 1931 | { |
---|
| 1932 | // conformance |
---|
[906] | 1933 | if ((m_confWinLeft == 0) && (m_confWinRight == 0) && (m_confWinTop == 0) && (m_confWinBottom == 0)) |
---|
[313] | 1934 | { |
---|
| 1935 | fprintf(stderr, "Warning: Conformance window enabled, but all conformance window parameters set to zero\n"); |
---|
| 1936 | } |
---|
| 1937 | if ((m_aiPad[1] != 0) || (m_aiPad[0]!=0)) |
---|
| 1938 | { |
---|
| 1939 | fprintf(stderr, "Warning: Conformance window enabled, padding parameters will be ignored\n"); |
---|
| 1940 | } |
---|
| 1941 | m_aiPad[1] = m_aiPad[0] = 0; |
---|
| 1942 | break; |
---|
| 1943 | } |
---|
| 1944 | } |
---|
| 1945 | |
---|
| 1946 | // allocate slice-based dQP values |
---|
| 1947 | m_aidQP = new Int[ m_framesToBeEncoded + m_iGOPSize + 1 ]; |
---|
| 1948 | ::memset( m_aidQP, 0, sizeof(Int)*( m_framesToBeEncoded + m_iGOPSize + 1 ) ); |
---|
| 1949 | |
---|
| 1950 | // handling of floating-point QP values |
---|
| 1951 | // if QP is not integer, sequence is split into two sections having QP and QP+1 |
---|
| 1952 | m_iQP = (Int)( m_fQP ); |
---|
| 1953 | if ( m_iQP < m_fQP ) |
---|
| 1954 | { |
---|
| 1955 | Int iSwitchPOC = (Int)( m_framesToBeEncoded - (m_fQP - m_iQP)*m_framesToBeEncoded + 0.5 ); |
---|
| 1956 | |
---|
| 1957 | iSwitchPOC = (Int)( (Double)iSwitchPOC / m_iGOPSize + 0.5 )*m_iGOPSize; |
---|
| 1958 | for ( Int i=iSwitchPOC; i<m_framesToBeEncoded + m_iGOPSize + 1; i++ ) |
---|
| 1959 | { |
---|
| 1960 | m_aidQP[i] = 1; |
---|
| 1961 | } |
---|
| 1962 | } |
---|
| 1963 | |
---|
| 1964 | // reading external dQP description from file |
---|
| 1965 | if ( m_pchdQPFile ) |
---|
| 1966 | { |
---|
| 1967 | FILE* fpt=fopen( m_pchdQPFile, "r" ); |
---|
| 1968 | if ( fpt ) |
---|
| 1969 | { |
---|
| 1970 | Int iValue; |
---|
| 1971 | Int iPOC = 0; |
---|
| 1972 | while ( iPOC < m_framesToBeEncoded ) |
---|
| 1973 | { |
---|
| 1974 | if ( fscanf(fpt, "%d", &iValue ) == EOF ) break; |
---|
| 1975 | m_aidQP[ iPOC ] = iValue; |
---|
| 1976 | iPOC++; |
---|
| 1977 | } |
---|
| 1978 | fclose(fpt); |
---|
| 1979 | } |
---|
| 1980 | } |
---|
| 1981 | m_iWaveFrontSubstreams = m_iWaveFrontSynchro ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1; |
---|
| 1982 | #endif |
---|
| 1983 | if( m_toneMappingInfoSEIEnabled && !m_toneMapCancelFlag ) |
---|
| 1984 | { |
---|
| 1985 | Char* pcStartOfCodedInterval = cfg_startOfCodedInterval.empty() ? NULL: strdup(cfg_startOfCodedInterval.c_str()); |
---|
| 1986 | Char* pcCodedPivotValue = cfg_codedPivotValue.empty() ? NULL: strdup(cfg_codedPivotValue.c_str()); |
---|
| 1987 | Char* pcTargetPivotValue = cfg_targetPivotValue.empty() ? NULL: strdup(cfg_targetPivotValue.c_str()); |
---|
| 1988 | if( m_toneMapModelId == 2 && pcStartOfCodedInterval ) |
---|
| 1989 | { |
---|
| 1990 | char *startOfCodedInterval; |
---|
| 1991 | UInt num = 1u<< m_toneMapTargetBitDepth; |
---|
| 1992 | m_startOfCodedInterval = new Int[num]; |
---|
| 1993 | ::memset( m_startOfCodedInterval, 0, sizeof(Int)*num ); |
---|
| 1994 | startOfCodedInterval = strtok(pcStartOfCodedInterval, " ."); |
---|
| 1995 | int i = 0; |
---|
| 1996 | while( startOfCodedInterval && ( i < num ) ) |
---|
| 1997 | { |
---|
| 1998 | m_startOfCodedInterval[i] = atoi( startOfCodedInterval ); |
---|
| 1999 | startOfCodedInterval = strtok(NULL, " ."); |
---|
| 2000 | i++; |
---|
| 2001 | } |
---|
| 2002 | } |
---|
| 2003 | else |
---|
| 2004 | { |
---|
| 2005 | m_startOfCodedInterval = NULL; |
---|
| 2006 | } |
---|
| 2007 | if( ( m_toneMapModelId == 3 ) && ( m_numPivots > 0 ) ) |
---|
| 2008 | { |
---|
| 2009 | if( pcCodedPivotValue && pcTargetPivotValue ) |
---|
| 2010 | { |
---|
| 2011 | char *codedPivotValue; |
---|
| 2012 | char *targetPivotValue; |
---|
| 2013 | m_codedPivotValue = new Int[m_numPivots]; |
---|
| 2014 | m_targetPivotValue = new Int[m_numPivots]; |
---|
| 2015 | ::memset( m_codedPivotValue, 0, sizeof(Int)*( m_numPivots ) ); |
---|
| 2016 | ::memset( m_targetPivotValue, 0, sizeof(Int)*( m_numPivots ) ); |
---|
| 2017 | codedPivotValue = strtok(pcCodedPivotValue, " ."); |
---|
| 2018 | int i=0; |
---|
| 2019 | while(codedPivotValue&&i<m_numPivots) |
---|
| 2020 | { |
---|
| 2021 | m_codedPivotValue[i] = atoi( codedPivotValue ); |
---|
| 2022 | codedPivotValue = strtok(NULL, " ."); |
---|
| 2023 | i++; |
---|
| 2024 | } |
---|
| 2025 | i=0; |
---|
| 2026 | targetPivotValue = strtok(pcTargetPivotValue, " ."); |
---|
| 2027 | while(targetPivotValue&&i<m_numPivots) |
---|
| 2028 | { |
---|
| 2029 | m_targetPivotValue[i]= atoi( targetPivotValue ); |
---|
| 2030 | targetPivotValue = strtok(NULL, " ."); |
---|
| 2031 | i++; |
---|
| 2032 | } |
---|
| 2033 | } |
---|
| 2034 | } |
---|
| 2035 | else |
---|
| 2036 | { |
---|
| 2037 | m_codedPivotValue = NULL; |
---|
| 2038 | m_targetPivotValue = NULL; |
---|
| 2039 | } |
---|
[906] | 2040 | |
---|
| 2041 | if( pcStartOfCodedInterval ) |
---|
| 2042 | { |
---|
| 2043 | free( pcStartOfCodedInterval ); |
---|
| 2044 | pcStartOfCodedInterval = NULL; |
---|
| 2045 | } |
---|
| 2046 | |
---|
| 2047 | if( pcCodedPivotValue ) |
---|
| 2048 | { |
---|
| 2049 | free( pcCodedPivotValue ); |
---|
| 2050 | pcCodedPivotValue = NULL; |
---|
| 2051 | } |
---|
| 2052 | |
---|
| 2053 | if( pcTargetPivotValue ) |
---|
| 2054 | { |
---|
| 2055 | free( pcTargetPivotValue ); |
---|
| 2056 | pcTargetPivotValue = NULL; |
---|
| 2057 | } |
---|
[313] | 2058 | } |
---|
[815] | 2059 | #if P0050_KNEE_FUNCTION_SEI |
---|
| 2060 | if( m_kneeSEIEnabled && !m_kneeSEICancelFlag ) |
---|
| 2061 | { |
---|
| 2062 | Char* pcInputKneePointValue = cfg_kneeSEIInputKneePointValue.empty() ? NULL : strdup(cfg_kneeSEIInputKneePointValue.c_str()); |
---|
| 2063 | Char* pcOutputKneePointValue = cfg_kneeSEIOutputKneePointValue.empty() ? NULL : strdup(cfg_kneeSEIOutputKneePointValue.c_str()); |
---|
| 2064 | assert ( m_kneeSEINumKneePointsMinus1 >= 0 && m_kneeSEINumKneePointsMinus1 < 999 ); |
---|
| 2065 | m_kneeSEIInputKneePoint = new Int[m_kneeSEINumKneePointsMinus1+1]; |
---|
| 2066 | m_kneeSEIOutputKneePoint = new Int[m_kneeSEINumKneePointsMinus1+1]; |
---|
| 2067 | char *InputVal = strtok(pcInputKneePointValue, " .,"); |
---|
| 2068 | Int i=0; |
---|
| 2069 | while( InputVal && i<(m_kneeSEINumKneePointsMinus1+1) ) |
---|
| 2070 | { |
---|
| 2071 | m_kneeSEIInputKneePoint[i] = (UInt) atoi( InputVal ); |
---|
| 2072 | InputVal = strtok(NULL, " .,"); |
---|
| 2073 | i++; |
---|
| 2074 | } |
---|
| 2075 | char *OutputVal = strtok(pcOutputKneePointValue, " .,"); |
---|
| 2076 | i=0; |
---|
| 2077 | while( OutputVal && i<(m_kneeSEINumKneePointsMinus1+1) ) |
---|
| 2078 | { |
---|
| 2079 | m_kneeSEIOutputKneePoint[i] = (UInt) atoi( OutputVal ); |
---|
| 2080 | OutputVal = strtok(NULL, " .,"); |
---|
| 2081 | i++; |
---|
| 2082 | } |
---|
[906] | 2083 | |
---|
| 2084 | if( pcInputKneePointValue ) |
---|
| 2085 | { |
---|
| 2086 | free( pcInputKneePointValue ); |
---|
| 2087 | pcInputKneePointValue = NULL; |
---|
| 2088 | } |
---|
| 2089 | |
---|
| 2090 | if( pcOutputKneePointValue ) |
---|
| 2091 | { |
---|
| 2092 | free( pcOutputKneePointValue ); |
---|
| 2093 | pcOutputKneePointValue = NULL; |
---|
| 2094 | } |
---|
[815] | 2095 | } |
---|
| 2096 | #endif |
---|
[906] | 2097 | #if Q0074_COLOUR_REMAPPING_SEI |
---|
| 2098 | #if !SVC_EXTENSION |
---|
| 2099 | // reading external Colour Remapping Information SEI message parameters from file |
---|
| 2100 | if( m_colourRemapSEIFile.size() > 0 ) |
---|
| 2101 | { |
---|
| 2102 | FILE* fic; |
---|
| 2103 | Int retval; |
---|
| 2104 | if((fic = fopen(m_colourRemapSEIFile.c_str(),"r")) == (FILE*)NULL) |
---|
| 2105 | { |
---|
| 2106 | fprintf(stderr, "Can't open Colour Remapping Information SEI parameters file %s\n", m_colourRemapSEIFile.c_str()); |
---|
| 2107 | exit(EXIT_FAILURE); |
---|
| 2108 | } |
---|
[713] | 2109 | |
---|
[906] | 2110 | retval = fscanf( fic, "%d", &m_colourRemapSEIId ); |
---|
| 2111 | retval = fscanf( fic, "%d", &m_colourRemapSEICancelFlag ); |
---|
| 2112 | if( !m_colourRemapSEICancelFlag ) |
---|
| 2113 | { |
---|
| 2114 | retval = fscanf( fic, "%d", &m_colourRemapSEIPersistenceFlag ); |
---|
| 2115 | retval = fscanf( fic, "%d", &m_colourRemapSEIVideoSignalInfoPresentFlag); |
---|
| 2116 | if( m_colourRemapSEIVideoSignalInfoPresentFlag ) |
---|
| 2117 | { |
---|
| 2118 | retval = fscanf( fic, "%d", &m_colourRemapSEIFullRangeFlag ); |
---|
| 2119 | retval = fscanf( fic, "%d", &m_colourRemapSEIPrimaries ); |
---|
| 2120 | retval = fscanf( fic, "%d", &m_colourRemapSEITransferFunction ); |
---|
| 2121 | retval = fscanf( fic, "%d", &m_colourRemapSEIMatrixCoefficients ); |
---|
| 2122 | } |
---|
| 2123 | |
---|
| 2124 | retval = fscanf( fic, "%d", &m_colourRemapSEIInputBitDepth ); |
---|
| 2125 | retval = fscanf( fic, "%d", &m_colourRemapSEIBitDepth ); |
---|
| 2126 | |
---|
| 2127 | for( Int c=0 ; c<3 ; c++ ) |
---|
| 2128 | { |
---|
| 2129 | retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutNumValMinus1[c] ); |
---|
| 2130 | if( m_colourRemapSEIPreLutNumValMinus1[c]>0 ) |
---|
| 2131 | { |
---|
| 2132 | m_colourRemapSEIPreLutCodedValue[c] = new Int[m_colourRemapSEIPreLutNumValMinus1[c]+1]; |
---|
| 2133 | m_colourRemapSEIPreLutTargetValue[c] = new Int[m_colourRemapSEIPreLutNumValMinus1[c]+1]; |
---|
| 2134 | for( Int i=0 ; i<=m_colourRemapSEIPreLutNumValMinus1[c] ; i++ ) |
---|
| 2135 | { |
---|
| 2136 | retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutCodedValue[c][i] ); |
---|
| 2137 | retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutTargetValue[c][i] ); |
---|
| 2138 | } |
---|
| 2139 | } |
---|
| 2140 | } |
---|
| 2141 | |
---|
| 2142 | retval = fscanf( fic, "%d", &m_colourRemapSEIMatrixPresentFlag ); |
---|
| 2143 | if( m_colourRemapSEIMatrixPresentFlag ) |
---|
| 2144 | { |
---|
| 2145 | retval = fscanf( fic, "%d", &m_colourRemapSEILog2MatrixDenom ); |
---|
| 2146 | for( Int c=0 ; c<3 ; c++ ) |
---|
| 2147 | for( Int i=0 ; i<3 ; i++ ) |
---|
| 2148 | retval = fscanf( fic, "%d", &m_colourRemapSEICoeffs[c][i] ); |
---|
| 2149 | } |
---|
| 2150 | |
---|
| 2151 | for( Int c=0 ; c<3 ; c++ ) |
---|
| 2152 | { |
---|
| 2153 | retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutNumValMinus1[c] ); |
---|
| 2154 | if( m_colourRemapSEIPostLutNumValMinus1[c]>0 ) |
---|
| 2155 | { |
---|
| 2156 | m_colourRemapSEIPostLutCodedValue[c] = new Int[m_colourRemapSEIPostLutNumValMinus1[c]+1]; |
---|
| 2157 | m_colourRemapSEIPostLutTargetValue[c] = new Int[m_colourRemapSEIPostLutNumValMinus1[c]+1]; |
---|
| 2158 | for( Int i=0 ; i<=m_colourRemapSEIPostLutNumValMinus1[c] ; i++ ) |
---|
| 2159 | { |
---|
| 2160 | retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutCodedValue[c][i] ); |
---|
| 2161 | retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutTargetValue[c][i] ); |
---|
| 2162 | } |
---|
| 2163 | } |
---|
| 2164 | } |
---|
| 2165 | } |
---|
| 2166 | |
---|
| 2167 | fclose( fic ); |
---|
| 2168 | if( retval != 1 ) |
---|
| 2169 | { |
---|
| 2170 | fprintf(stderr, "Error while reading Colour Remapping Information SEI parameters file\n"); |
---|
| 2171 | exit(EXIT_FAILURE); |
---|
| 2172 | } |
---|
| 2173 | } |
---|
| 2174 | #else |
---|
| 2175 | // Reading external Colour Remapping Information SEI message parameters from file |
---|
| 2176 | // It seems that TAppEncLayerCfg::parseCfg is not used |
---|
| 2177 | for(UInt layer = 0; layer < m_numLayers; layer++) |
---|
| 2178 | { |
---|
| 2179 | if( cfg_colourRemapSEIFile[layer]->length() ) |
---|
| 2180 | { |
---|
| 2181 | FILE* fic; |
---|
| 2182 | Int retval; |
---|
| 2183 | if((fic = fopen(cfg_colourRemapSEIFile[layer]->c_str(),"r")) == (FILE*)NULL) |
---|
| 2184 | { |
---|
| 2185 | fprintf(stderr, "Can't open Colour Remapping Information SEI parameters file %s\n", cfg_colourRemapSEIFile[layer]->c_str()); |
---|
| 2186 | exit(EXIT_FAILURE); |
---|
| 2187 | } |
---|
| 2188 | Int tempCode; |
---|
| 2189 | retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIId ); |
---|
| 2190 | retval = fscanf( fic, "%d", &tempCode ); m_acLayerCfg[layer].m_colourRemapSEICancelFlag = tempCode ? 1 : 0; |
---|
| 2191 | if( !m_acLayerCfg[layer].m_colourRemapSEICancelFlag ) |
---|
| 2192 | { |
---|
| 2193 | retval = fscanf( fic, "%d", &tempCode ); m_acLayerCfg[layer].m_colourRemapSEIPersistenceFlag = tempCode ? 1 : 0; |
---|
| 2194 | retval = fscanf( fic, "%d", &tempCode ); m_acLayerCfg[layer].m_colourRemapSEIVideoSignalInfoPresentFlag = tempCode ? 1 : 0; |
---|
| 2195 | if( m_acLayerCfg[layer].m_colourRemapSEIVideoSignalInfoPresentFlag ) |
---|
| 2196 | { |
---|
| 2197 | retval = fscanf( fic, "%d", &tempCode ); m_acLayerCfg[layer].m_colourRemapSEIFullRangeFlag = tempCode ? 1 : 0; |
---|
| 2198 | retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPrimaries ); |
---|
| 2199 | retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEITransferFunction ); |
---|
| 2200 | retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIMatrixCoefficients ); |
---|
| 2201 | } |
---|
| 2202 | |
---|
| 2203 | retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIInputBitDepth ); |
---|
| 2204 | retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIBitDepth ); |
---|
| 2205 | |
---|
| 2206 | for( Int c=0 ; c<3 ; c++ ) |
---|
| 2207 | { |
---|
| 2208 | retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1[c] ); |
---|
| 2209 | if( m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1[c]>0 ) |
---|
| 2210 | { |
---|
| 2211 | m_acLayerCfg[layer].m_colourRemapSEIPreLutCodedValue[c] = new Int[m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1[c]+1]; |
---|
| 2212 | m_acLayerCfg[layer].m_colourRemapSEIPreLutTargetValue[c] = new Int[m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1[c]+1]; |
---|
| 2213 | for( Int i=0 ; i<=m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1[c] ; i++ ) |
---|
| 2214 | { |
---|
| 2215 | retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPreLutCodedValue[c][i] ); |
---|
| 2216 | retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPreLutTargetValue[c][i] ); |
---|
| 2217 | } |
---|
| 2218 | } |
---|
| 2219 | } |
---|
| 2220 | |
---|
| 2221 | retval = fscanf( fic, "%d", &tempCode ); m_acLayerCfg[layer].m_colourRemapSEIMatrixPresentFlag = tempCode ? 1 : 0; |
---|
| 2222 | if( m_acLayerCfg[layer].m_colourRemapSEIMatrixPresentFlag ) |
---|
| 2223 | { |
---|
| 2224 | retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEILog2MatrixDenom ); |
---|
| 2225 | for( Int c=0 ; c<3 ; c++ ) |
---|
| 2226 | for( Int i=0 ; i<3 ; i++ ) |
---|
| 2227 | retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEICoeffs[c][i] ); |
---|
| 2228 | } |
---|
| 2229 | |
---|
| 2230 | for( Int c=0 ; c<3 ; c++ ) |
---|
| 2231 | { |
---|
| 2232 | retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1[c] ); |
---|
| 2233 | if( m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1[c]>0 ) |
---|
| 2234 | { |
---|
| 2235 | m_acLayerCfg[layer].m_colourRemapSEIPostLutCodedValue[c] = new Int[m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1[c]+1]; |
---|
| 2236 | m_acLayerCfg[layer].m_colourRemapSEIPostLutTargetValue[c] = new Int[m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1[c]+1]; |
---|
| 2237 | for( Int i=0 ; i<=m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1[c] ; i++ ) |
---|
| 2238 | { |
---|
| 2239 | retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPostLutCodedValue[c][i] ); |
---|
| 2240 | retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPostLutTargetValue[c][i] ); |
---|
| 2241 | } |
---|
| 2242 | } |
---|
| 2243 | } |
---|
| 2244 | } |
---|
| 2245 | |
---|
| 2246 | fclose( fic ); |
---|
| 2247 | if( retval != 1 ) |
---|
| 2248 | { |
---|
| 2249 | fprintf(stderr, "Error while reading Colour Remapping Information SEI parameters file\n"); |
---|
| 2250 | exit(EXIT_FAILURE); |
---|
| 2251 | } |
---|
| 2252 | } |
---|
| 2253 | } |
---|
| 2254 | #endif |
---|
| 2255 | #endif |
---|
[442] | 2256 | #if N0383_IL_CONSTRAINED_TILE_SETS_SEI |
---|
| 2257 | if (m_interLayerConstrainedTileSetsSEIEnabled) |
---|
| 2258 | { |
---|
[906] | 2259 | if (m_numTileColumnsMinus1 == 0 && m_numTileRowsMinus1 == 0) |
---|
[442] | 2260 | { |
---|
| 2261 | printf( "Tiles are not defined (needed for inter-layer comnstrained tile sets SEI).\n" ); |
---|
| 2262 | exit( EXIT_FAILURE ); |
---|
| 2263 | } |
---|
| 2264 | Char* pTileSets = cfg_tileSets.empty() ? NULL : strdup(cfg_tileSets.c_str()); |
---|
| 2265 | int i = 0; |
---|
| 2266 | char *topLeftTileIndex = strtok(pTileSets, " ,"); |
---|
| 2267 | while(topLeftTileIndex != NULL) |
---|
| 2268 | { |
---|
| 2269 | if( i >= m_ilNumSetsInMessage ) |
---|
| 2270 | { |
---|
| 2271 | printf( "The number of tile sets is larger than defined by IlNumSetsInMessage.\n" ); |
---|
| 2272 | exit( EXIT_FAILURE ); |
---|
| 2273 | } |
---|
| 2274 | *( m_topLeftTileIndex + i ) = atoi( topLeftTileIndex ); |
---|
| 2275 | char *bottonRightTileIndex = strtok(NULL, " ,"); |
---|
| 2276 | if( bottonRightTileIndex == NULL ) |
---|
| 2277 | { |
---|
| 2278 | printf( "BottonRightTileIndex is missing in the tile sets.\n" ); |
---|
| 2279 | exit( EXIT_FAILURE ); |
---|
| 2280 | } |
---|
| 2281 | *( m_bottomRightTileIndex + i ) = atoi( bottonRightTileIndex ); |
---|
| 2282 | char *ilcIdc = strtok(NULL, " ,"); |
---|
| 2283 | if( ilcIdc == NULL ) |
---|
| 2284 | { |
---|
| 2285 | printf( "IlcIdc is missing in the tile sets.\n" ); |
---|
| 2286 | exit( EXIT_FAILURE ); |
---|
| 2287 | } |
---|
| 2288 | *( m_ilcIdc + i ) = atoi( ilcIdc ); |
---|
| 2289 | topLeftTileIndex = strtok(NULL, " ,"); |
---|
| 2290 | i++; |
---|
| 2291 | } |
---|
| 2292 | if( i < m_ilNumSetsInMessage ) |
---|
| 2293 | { |
---|
| 2294 | printf( "The number of tile sets is smaller than defined by IlNumSetsInMessage.\n" ); |
---|
| 2295 | exit( EXIT_FAILURE ); |
---|
| 2296 | } |
---|
| 2297 | m_skippedTileSetPresentFlag = false; |
---|
[906] | 2298 | |
---|
| 2299 | if( pTileSets ) |
---|
| 2300 | { |
---|
| 2301 | free( pTileSets ); |
---|
| 2302 | pTileSets = NULL; |
---|
| 2303 | } |
---|
[442] | 2304 | } |
---|
| 2305 | #endif |
---|
[313] | 2306 | // check validity of input parameters |
---|
| 2307 | xCheckParameter(); |
---|
| 2308 | |
---|
| 2309 | // set global varibles |
---|
[494] | 2310 | #if LAYER_CTB |
---|
| 2311 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 2312 | { |
---|
| 2313 | xSetGlobal(layer); |
---|
| 2314 | } |
---|
| 2315 | #else |
---|
[313] | 2316 | xSetGlobal(); |
---|
[494] | 2317 | #endif |
---|
[313] | 2318 | |
---|
| 2319 | // print-out parameters |
---|
| 2320 | xPrintParameter(); |
---|
| 2321 | |
---|
| 2322 | return true; |
---|
| 2323 | } |
---|
| 2324 | // ==================================================================================================================== |
---|
| 2325 | // Private member functions |
---|
| 2326 | // ==================================================================================================================== |
---|
| 2327 | |
---|
| 2328 | Bool confirmPara(Bool bflag, const Char* message); |
---|
| 2329 | |
---|
| 2330 | Void TAppEncCfg::xCheckParameter() |
---|
| 2331 | { |
---|
| 2332 | if (!m_decodedPictureHashSEIEnabled) |
---|
| 2333 | { |
---|
| 2334 | fprintf(stderr, "******************************************************************\n"); |
---|
| 2335 | fprintf(stderr, "** WARNING: --SEIDecodedPictureHash is now disabled by default. **\n"); |
---|
| 2336 | fprintf(stderr, "** Automatic verification of decoded pictures by a **\n"); |
---|
| 2337 | fprintf(stderr, "** decoder requires this option to be enabled. **\n"); |
---|
| 2338 | fprintf(stderr, "******************************************************************\n"); |
---|
| 2339 | } |
---|
| 2340 | if( m_profile==Profile::NONE ) |
---|
| 2341 | { |
---|
| 2342 | fprintf(stderr, "***************************************************************************\n"); |
---|
| 2343 | fprintf(stderr, "** WARNING: For conforming bitstreams a valid Profile value must be set! **\n"); |
---|
| 2344 | fprintf(stderr, "***************************************************************************\n"); |
---|
| 2345 | } |
---|
| 2346 | if( m_level==Level::NONE ) |
---|
| 2347 | { |
---|
| 2348 | fprintf(stderr, "***************************************************************************\n"); |
---|
| 2349 | fprintf(stderr, "** WARNING: For conforming bitstreams a valid Level value must be set! **\n"); |
---|
| 2350 | fprintf(stderr, "***************************************************************************\n"); |
---|
| 2351 | } |
---|
| 2352 | |
---|
| 2353 | Bool check_failed = false; /* abort if there is a fatal configuration problem */ |
---|
| 2354 | #define xConfirmPara(a,b) check_failed |= confirmPara(a,b) |
---|
| 2355 | // check range of parameters |
---|
[494] | 2356 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
| 2357 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
| 2358 | { |
---|
| 2359 | xConfirmPara( m_acLayerCfg[layer].m_inputBitDepthY < 8, "InputBitDepth must be at least 8" ); |
---|
| 2360 | xConfirmPara( m_acLayerCfg[layer].m_inputBitDepthC < 8, "InputBitDepthC must be at least 8" ); |
---|
| 2361 | } |
---|
| 2362 | #else |
---|
[313] | 2363 | xConfirmPara( m_inputBitDepthY < 8, "InputBitDepth must be at least 8" ); |
---|
| 2364 | xConfirmPara( m_inputBitDepthC < 8, "InputBitDepthC must be at least 8" ); |
---|
[494] | 2365 | #endif |
---|
[313] | 2366 | #if !SVC_EXTENSION |
---|
| 2367 | xConfirmPara( m_iFrameRate <= 0, "Frame rate must be more than 1" ); |
---|
| 2368 | #endif |
---|
| 2369 | xConfirmPara( m_framesToBeEncoded <= 0, "Total Number Of Frames encoded must be more than 0" ); |
---|
| 2370 | xConfirmPara( m_iGOPSize < 1 , "GOP Size must be greater or equal to 1" ); |
---|
| 2371 | xConfirmPara( m_iGOPSize > 1 && m_iGOPSize % 2, "GOP Size must be a multiple of 2, if GOP Size is greater than 1" ); |
---|
| 2372 | #if !SVC_EXTENSION |
---|
| 2373 | xConfirmPara( (m_iIntraPeriod > 0 && m_iIntraPeriod < m_iGOPSize) || m_iIntraPeriod == 0, "Intra period must be more than GOP size, or -1 , not 0" ); |
---|
| 2374 | #endif |
---|
[713] | 2375 | #if ALLOW_RECOVERY_POINT_AS_RAP |
---|
| 2376 | xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 3, "Decoding Refresh Type must be comprised between 0 and 3 included" ); |
---|
| 2377 | if(m_iDecodingRefreshType == 3) |
---|
| 2378 | { |
---|
| 2379 | xConfirmPara( !m_recoveryPointSEIEnabled, "When using RecoveryPointSEI messages as RA points, recoveryPointSEI must be enabled" ); |
---|
| 2380 | } |
---|
| 2381 | #else |
---|
[313] | 2382 | xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 2, "Decoding Refresh Type must be equal to 0, 1 or 2" ); |
---|
[713] | 2383 | #endif |
---|
[313] | 2384 | #if !SVC_EXTENSION |
---|
| 2385 | xConfirmPara( m_iQP < -6 * (m_internalBitDepthY - 8) || m_iQP > 51, "QP exceeds supported range (-QpBDOffsety to 51)" ); |
---|
| 2386 | #endif |
---|
| 2387 | xConfirmPara( m_loopFilterBetaOffsetDiv2 < -6 || m_loopFilterBetaOffsetDiv2 > 6, "Loop Filter Beta Offset div. 2 exceeds supported range (-6 to 6)"); |
---|
| 2388 | xConfirmPara( m_loopFilterTcOffsetDiv2 < -6 || m_loopFilterTcOffsetDiv2 > 6, "Loop Filter Tc Offset div. 2 exceeds supported range (-6 to 6)"); |
---|
| 2389 | xConfirmPara( m_iFastSearch < 0 || m_iFastSearch > 2, "Fast Search Mode is not supported value (0:Full search 1:Diamond 2:PMVFAST)" ); |
---|
| 2390 | xConfirmPara( m_iSearchRange < 0 , "Search Range must be more than 0" ); |
---|
| 2391 | xConfirmPara( m_bipredSearchRange < 0 , "Search Range must be more than 0" ); |
---|
| 2392 | xConfirmPara( m_iMaxDeltaQP > 7, "Absolute Delta QP exceeds supported range (0 to 7)" ); |
---|
[494] | 2393 | #if LAYER_CTB |
---|
| 2394 | for(UInt layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 2395 | { |
---|
| 2396 | xConfirmPara( m_iMaxCuDQPDepth > m_acLayerCfg[layer].m_uiMaxCUDepth - 1, "Absolute depth for a minimum CuDQP exceeds maximum coding unit depth" ); |
---|
| 2397 | } |
---|
| 2398 | #else |
---|
[313] | 2399 | xConfirmPara( m_iMaxCuDQPDepth > m_uiMaxCUDepth - 1, "Absolute depth for a minimum CuDQP exceeds maximum coding unit depth" ); |
---|
[494] | 2400 | #endif |
---|
[313] | 2401 | |
---|
| 2402 | xConfirmPara( m_cbQpOffset < -12, "Min. Chroma Cb QP Offset is -12" ); |
---|
| 2403 | xConfirmPara( m_cbQpOffset > 12, "Max. Chroma Cb QP Offset is 12" ); |
---|
| 2404 | xConfirmPara( m_crQpOffset < -12, "Min. Chroma Cr QP Offset is -12" ); |
---|
| 2405 | xConfirmPara( m_crQpOffset > 12, "Max. Chroma Cr QP Offset is 12" ); |
---|
| 2406 | |
---|
| 2407 | xConfirmPara( m_iQPAdaptationRange <= 0, "QP Adaptation Range must be more than 0" ); |
---|
| 2408 | #if !SVC_EXTENSION |
---|
| 2409 | if (m_iDecodingRefreshType == 2) |
---|
| 2410 | { |
---|
| 2411 | xConfirmPara( m_iIntraPeriod > 0 && m_iIntraPeriod <= m_iGOPSize , "Intra period must be larger than GOP size for periodic IDR pictures"); |
---|
| 2412 | } |
---|
| 2413 | #endif |
---|
[494] | 2414 | #if !LAYER_CTB |
---|
[313] | 2415 | xConfirmPara( (m_uiMaxCUWidth >> m_uiMaxCUDepth) < 4, "Minimum partition width size should be larger than or equal to 8"); |
---|
| 2416 | xConfirmPara( (m_uiMaxCUHeight >> m_uiMaxCUDepth) < 4, "Minimum partition height size should be larger than or equal to 8"); |
---|
| 2417 | xConfirmPara( m_uiMaxCUWidth < 16, "Maximum partition width size should be larger than or equal to 16"); |
---|
| 2418 | xConfirmPara( m_uiMaxCUHeight < 16, "Maximum partition height size should be larger than or equal to 16"); |
---|
[494] | 2419 | #endif |
---|
[313] | 2420 | #if !SVC_EXTENSION |
---|
| 2421 | xConfirmPara( (m_iSourceWidth % (m_uiMaxCUWidth >> (m_uiMaxCUDepth-1)))!=0, "Resulting coded frame width must be a multiple of the minimum CU size"); |
---|
| 2422 | xConfirmPara( (m_iSourceHeight % (m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)))!=0, "Resulting coded frame height must be a multiple of the minimum CU size"); |
---|
| 2423 | #endif |
---|
| 2424 | |
---|
[494] | 2425 | #if !LAYER_CTB |
---|
[313] | 2426 | xConfirmPara( m_uiQuadtreeTULog2MinSize < 2, "QuadtreeTULog2MinSize must be 2 or greater."); |
---|
| 2427 | xConfirmPara( m_uiQuadtreeTULog2MaxSize > 5, "QuadtreeTULog2MaxSize must be 5 or smaller."); |
---|
| 2428 | xConfirmPara( (1<<m_uiQuadtreeTULog2MaxSize) > m_uiMaxCUWidth, "QuadtreeTULog2MaxSize must be log2(maxCUSize) or smaller."); |
---|
| 2429 | |
---|
| 2430 | xConfirmPara( m_uiQuadtreeTULog2MaxSize < m_uiQuadtreeTULog2MinSize, "QuadtreeTULog2MaxSize must be greater than or equal to m_uiQuadtreeTULog2MinSize."); |
---|
| 2431 | xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUWidth >>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS |
---|
| 2432 | xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUHeight>>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS |
---|
| 2433 | xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUWidth >> m_uiMaxCUDepth ), "Minimum CU width must be greater than minimum transform size." ); |
---|
| 2434 | xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUHeight >> m_uiMaxCUDepth ), "Minimum CU height must be greater than minimum transform size." ); |
---|
| 2435 | xConfirmPara( m_uiQuadtreeTUMaxDepthInter < 1, "QuadtreeTUMaxDepthInter must be greater than or equal to 1" ); |
---|
| 2436 | 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" ); |
---|
| 2437 | xConfirmPara( m_uiQuadtreeTUMaxDepthIntra < 1, "QuadtreeTUMaxDepthIntra must be greater than or equal to 1" ); |
---|
| 2438 | 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" ); |
---|
[494] | 2439 | #endif |
---|
[313] | 2440 | |
---|
| 2441 | xConfirmPara( m_maxNumMergeCand < 1, "MaxNumMergeCand must be 1 or greater."); |
---|
| 2442 | xConfirmPara( m_maxNumMergeCand > 5, "MaxNumMergeCand must be 5 or smaller."); |
---|
| 2443 | |
---|
| 2444 | #if !SVC_EXTENSION |
---|
| 2445 | #if ADAPTIVE_QP_SELECTION |
---|
| 2446 | xConfirmPara( m_bUseAdaptQpSelect == true && m_iQP < 0, "AdaptiveQpSelection must be disabled when QP < 0."); |
---|
| 2447 | xConfirmPara( m_bUseAdaptQpSelect == true && (m_cbQpOffset !=0 || m_crQpOffset != 0 ), "AdaptiveQpSelection must be disabled when ChromaQpOffset is not equal to 0."); |
---|
| 2448 | #endif |
---|
| 2449 | #endif |
---|
| 2450 | |
---|
| 2451 | if( m_usePCM) |
---|
| 2452 | { |
---|
| 2453 | xConfirmPara( m_uiPCMLog2MinSize < 3, "PCMLog2MinSize must be 3 or greater."); |
---|
| 2454 | xConfirmPara( m_uiPCMLog2MinSize > 5, "PCMLog2MinSize must be 5 or smaller."); |
---|
| 2455 | xConfirmPara( m_pcmLog2MaxSize > 5, "PCMLog2MaxSize must be 5 or smaller."); |
---|
| 2456 | xConfirmPara( m_pcmLog2MaxSize < m_uiPCMLog2MinSize, "PCMLog2MaxSize must be equal to or greater than m_uiPCMLog2MinSize."); |
---|
| 2457 | } |
---|
| 2458 | |
---|
| 2459 | xConfirmPara( m_sliceMode < 0 || m_sliceMode > 3, "SliceMode exceeds supported range (0 to 3)" ); |
---|
| 2460 | if (m_sliceMode!=0) |
---|
| 2461 | { |
---|
| 2462 | xConfirmPara( m_sliceArgument < 1 , "SliceArgument should be larger than or equal to 1" ); |
---|
| 2463 | } |
---|
| 2464 | xConfirmPara( m_sliceSegmentMode < 0 || m_sliceSegmentMode > 3, "SliceSegmentMode exceeds supported range (0 to 3)" ); |
---|
| 2465 | if (m_sliceSegmentMode!=0) |
---|
| 2466 | { |
---|
| 2467 | xConfirmPara( m_sliceSegmentArgument < 1 , "SliceSegmentArgument should be larger than or equal to 1" ); |
---|
| 2468 | } |
---|
| 2469 | |
---|
[906] | 2470 | #if !SVC_EXTENSION |
---|
| 2471 | Bool tileFlag = (m_numTileColumnsMinus1 > 0 || m_numTileRowsMinus1 > 0 ); |
---|
[313] | 2472 | xConfirmPara( tileFlag && m_iWaveFrontSynchro, "Tile and Wavefront can not be applied together"); |
---|
| 2473 | |
---|
| 2474 | //TODO:ChromaFmt assumes 4:2:0 below |
---|
| 2475 | xConfirmPara( m_iSourceWidth % TComSPS::getWinUnitX(CHROMA_420) != 0, "Picture width must be an integer multiple of the specified chroma subsampling"); |
---|
| 2476 | xConfirmPara( m_iSourceHeight % TComSPS::getWinUnitY(CHROMA_420) != 0, "Picture height must be an integer multiple of the specified chroma subsampling"); |
---|
| 2477 | |
---|
| 2478 | xConfirmPara( m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0, "Horizontal padding must be an integer multiple of the specified chroma subsampling"); |
---|
| 2479 | xConfirmPara( m_aiPad[1] % TComSPS::getWinUnitY(CHROMA_420) != 0, "Vertical padding must be an integer multiple of the specified chroma subsampling"); |
---|
| 2480 | |
---|
[906] | 2481 | xConfirmPara( m_confWinLeft % TComSPS::getWinUnitX(CHROMA_420) != 0, "Left conformance window offset must be an integer multiple of the specified chroma subsampling"); |
---|
| 2482 | xConfirmPara( m_confWinRight % TComSPS::getWinUnitX(CHROMA_420) != 0, "Right conformance window offset must be an integer multiple of the specified chroma subsampling"); |
---|
| 2483 | xConfirmPara( m_confWinTop % TComSPS::getWinUnitY(CHROMA_420) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling"); |
---|
| 2484 | xConfirmPara( m_confWinBottom % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling"); |
---|
| 2485 | |
---|
| 2486 | xConfirmPara( m_defaultDisplayWindowFlag && !m_vuiParametersPresentFlag, "VUI needs to be enabled for default display window"); |
---|
| 2487 | |
---|
| 2488 | if (m_defaultDisplayWindowFlag) |
---|
| 2489 | { |
---|
| 2490 | xConfirmPara( m_defDispWinLeftOffset % TComSPS::getWinUnitX(CHROMA_420) != 0, "Left default display window offset must be an integer multiple of the specified chroma subsampling"); |
---|
| 2491 | xConfirmPara( m_defDispWinRightOffset % TComSPS::getWinUnitX(CHROMA_420) != 0, "Right default display window offset must be an integer multiple of the specified chroma subsampling"); |
---|
| 2492 | xConfirmPara( m_defDispWinTopOffset % TComSPS::getWinUnitY(CHROMA_420) != 0, "Top default display window offset must be an integer multiple of the specified chroma subsampling"); |
---|
| 2493 | xConfirmPara( m_defDispWinBottomOffset % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom default display window offset must be an integer multiple of the specified chroma subsampling"); |
---|
| 2494 | } |
---|
[313] | 2495 | #endif |
---|
| 2496 | |
---|
[494] | 2497 | #if !LAYER_CTB |
---|
[313] | 2498 | // max CU width and height should be power of 2 |
---|
| 2499 | UInt ui = m_uiMaxCUWidth; |
---|
| 2500 | while(ui) |
---|
| 2501 | { |
---|
| 2502 | ui >>= 1; |
---|
| 2503 | if( (ui & 1) == 1) |
---|
| 2504 | xConfirmPara( ui != 1 , "Width should be 2^n"); |
---|
| 2505 | } |
---|
| 2506 | ui = m_uiMaxCUHeight; |
---|
| 2507 | while(ui) |
---|
| 2508 | { |
---|
| 2509 | ui >>= 1; |
---|
| 2510 | if( (ui & 1) == 1) |
---|
| 2511 | xConfirmPara( ui != 1 , "Height should be 2^n"); |
---|
| 2512 | } |
---|
[494] | 2513 | #endif |
---|
[313] | 2514 | |
---|
| 2515 | /* if this is an intra-only sequence, ie IntraPeriod=1, don't verify the GOP structure |
---|
| 2516 | * This permits the ability to omit a GOP structure specification */ |
---|
| 2517 | #if SVC_EXTENSION |
---|
[815] | 2518 | #if Q0108_TSA_STSA |
---|
| 2519 | if( m_acLayerCfg[0].m_iIntraPeriod == 1 && m_GOPList[0].m_POC == -1 ) |
---|
| 2520 | { |
---|
| 2521 | m_GOPList[0] = GOPEntry(); |
---|
| 2522 | m_GOPList[0].m_QPFactor = 1; |
---|
| 2523 | m_GOPList[0].m_betaOffsetDiv2 = 0; |
---|
| 2524 | m_GOPList[0].m_tcOffsetDiv2 = 0; |
---|
| 2525 | m_GOPList[0].m_POC = 1; |
---|
| 2526 | m_GOPList[0].m_numRefPicsActive = 4; |
---|
| 2527 | } |
---|
| 2528 | |
---|
[313] | 2529 | for(UInt layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 2530 | { |
---|
[815] | 2531 | if (m_acLayerCfg[layer].m_iIntraPeriod == 1 && m_EhGOPList[layer][0].m_POC == -1) { |
---|
| 2532 | m_EhGOPList[layer][0] = GOPEntry(); |
---|
| 2533 | m_EhGOPList[layer][0].m_QPFactor = 1; |
---|
| 2534 | m_EhGOPList[layer][0].m_betaOffsetDiv2 = 0; |
---|
| 2535 | m_EhGOPList[layer][0].m_tcOffsetDiv2 = 0; |
---|
| 2536 | m_EhGOPList[layer][0].m_POC = 1; |
---|
| 2537 | m_EhGOPList[layer][0].m_numRefPicsActive = 4; |
---|
| 2538 | } |
---|
| 2539 | } |
---|
| 2540 | #else |
---|
| 2541 | for(UInt layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 2542 | { |
---|
[313] | 2543 | Int m_iIntraPeriod = m_acLayerCfg[layer].m_iIntraPeriod; |
---|
[815] | 2544 | if (m_iIntraPeriod == 1 && m_GOPList[0].m_POC == -1) { |
---|
| 2545 | m_GOPList[0] = GOPEntry(); |
---|
| 2546 | m_GOPList[0].m_QPFactor = 1; |
---|
| 2547 | m_GOPList[0].m_betaOffsetDiv2 = 0; |
---|
| 2548 | m_GOPList[0].m_tcOffsetDiv2 = 0; |
---|
| 2549 | m_GOPList[0].m_POC = 1; |
---|
| 2550 | m_GOPList[0].m_numRefPicsActive = 4; |
---|
| 2551 | } |
---|
| 2552 | } |
---|
[313] | 2553 | #endif |
---|
[815] | 2554 | #else |
---|
[313] | 2555 | if (m_iIntraPeriod == 1 && m_GOPList[0].m_POC == -1) { |
---|
| 2556 | m_GOPList[0] = GOPEntry(); |
---|
| 2557 | m_GOPList[0].m_QPFactor = 1; |
---|
| 2558 | m_GOPList[0].m_betaOffsetDiv2 = 0; |
---|
| 2559 | m_GOPList[0].m_tcOffsetDiv2 = 0; |
---|
| 2560 | m_GOPList[0].m_POC = 1; |
---|
| 2561 | m_GOPList[0].m_numRefPicsActive = 4; |
---|
| 2562 | } |
---|
| 2563 | #endif |
---|
[494] | 2564 | |
---|
[313] | 2565 | Bool verifiedGOP=false; |
---|
| 2566 | Bool errorGOP=false; |
---|
| 2567 | Int checkGOP=1; |
---|
[442] | 2568 | Int numRefs = m_isField ? 2 : 1; |
---|
[313] | 2569 | Int refList[MAX_NUM_REF_PICS+1]; |
---|
| 2570 | refList[0]=0; |
---|
[442] | 2571 | if(m_isField) |
---|
| 2572 | { |
---|
| 2573 | refList[1] = 1; |
---|
| 2574 | } |
---|
[313] | 2575 | Bool isOK[MAX_GOP]; |
---|
| 2576 | for(Int i=0; i<MAX_GOP; i++) |
---|
| 2577 | { |
---|
| 2578 | isOK[i]=false; |
---|
| 2579 | } |
---|
| 2580 | Int numOK=0; |
---|
| 2581 | #if !SVC_EXTENSION |
---|
| 2582 | xConfirmPara( m_iIntraPeriod >=0&&(m_iIntraPeriod%m_iGOPSize!=0), "Intra period must be a multiple of GOPSize, or -1" ); |
---|
| 2583 | #endif |
---|
| 2584 | |
---|
| 2585 | for(Int i=0; i<m_iGOPSize; i++) |
---|
| 2586 | { |
---|
| 2587 | if(m_GOPList[i].m_POC==m_iGOPSize) |
---|
| 2588 | { |
---|
| 2589 | xConfirmPara( m_GOPList[i].m_temporalId!=0 , "The last frame in each GOP must have temporal ID = 0 " ); |
---|
| 2590 | } |
---|
| 2591 | } |
---|
| 2592 | |
---|
| 2593 | #if SVC_EXTENSION |
---|
| 2594 | xConfirmPara( m_numLayers > MAX_LAYERS , "Number of layers in config file is greater than MAX_LAYERS" ); |
---|
| 2595 | m_numLayers = m_numLayers > MAX_LAYERS ? MAX_LAYERS : m_numLayers; |
---|
[649] | 2596 | |
---|
| 2597 | // it can be updated after AVC BL support will be added to the WD |
---|
[906] | 2598 | #if VPS_AVC_BL_FLAG_REMOVAL |
---|
| 2599 | if( m_nonHEVCBaseLayerFlag ) |
---|
| 2600 | #else |
---|
[649] | 2601 | if( m_avcBaseLayerFlag ) |
---|
[906] | 2602 | #endif |
---|
[649] | 2603 | { |
---|
| 2604 | m_crossLayerIrapAlignFlag = false; |
---|
| 2605 | m_crossLayerPictureTypeAlignFlag = false; |
---|
| 2606 | m_crossLayerAlignedIdrOnlyFlag = false; |
---|
| 2607 | } |
---|
| 2608 | |
---|
[313] | 2609 | // verify layer configuration parameters |
---|
| 2610 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
| 2611 | { |
---|
[442] | 2612 | if(m_acLayerCfg[layer].xCheckParameter(m_isField)) |
---|
[313] | 2613 | { |
---|
| 2614 | printf("\nError: invalid configuration parameter found in layer %d \n", layer); |
---|
| 2615 | check_failed = true; |
---|
| 2616 | } |
---|
| 2617 | } |
---|
| 2618 | |
---|
| 2619 | // verify layer configuration parameters |
---|
| 2620 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
| 2621 | { |
---|
| 2622 | Int m_iIntraPeriod = m_acLayerCfg[layer].m_iIntraPeriod; |
---|
| 2623 | #endif |
---|
| 2624 | if ( (m_iIntraPeriod != 1) && !m_loopFilterOffsetInPPS && m_DeblockingFilterControlPresent && (!m_bLoopFilterDisable) ) |
---|
| 2625 | { |
---|
| 2626 | for(Int i=0; i<m_iGOPSize; i++) |
---|
| 2627 | { |
---|
| 2628 | 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)" ); |
---|
| 2629 | 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)" ); |
---|
| 2630 | } |
---|
| 2631 | } |
---|
| 2632 | #if SVC_EXTENSION |
---|
| 2633 | } |
---|
| 2634 | #endif |
---|
[494] | 2635 | |
---|
[815] | 2636 | #if !Q0108_TSA_STSA |
---|
| 2637 | m_extraRPSs = 0; |
---|
| 2638 | #else |
---|
| 2639 | memset( m_extraRPSs, 0, sizeof( m_extraRPSs ) ); |
---|
| 2640 | #endif |
---|
[313] | 2641 | //start looping through frames in coding order until we can verify that the GOP structure is correct. |
---|
| 2642 | while(!verifiedGOP&&!errorGOP) |
---|
| 2643 | { |
---|
| 2644 | Int curGOP = (checkGOP-1)%m_iGOPSize; |
---|
| 2645 | Int curPOC = ((checkGOP-1)/m_iGOPSize)*m_iGOPSize + m_GOPList[curGOP].m_POC; |
---|
| 2646 | if(m_GOPList[curGOP].m_POC<0) |
---|
| 2647 | { |
---|
| 2648 | printf("\nError: found fewer Reference Picture Sets than GOPSize\n"); |
---|
| 2649 | errorGOP=true; |
---|
| 2650 | } |
---|
| 2651 | else |
---|
| 2652 | { |
---|
| 2653 | //check that all reference pictures are available, or have a POC < 0 meaning they might be available in the next GOP. |
---|
| 2654 | Bool beforeI = false; |
---|
| 2655 | for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) |
---|
| 2656 | { |
---|
| 2657 | Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i]; |
---|
| 2658 | if(absPOC < 0) |
---|
| 2659 | { |
---|
| 2660 | beforeI=true; |
---|
| 2661 | } |
---|
| 2662 | else |
---|
| 2663 | { |
---|
| 2664 | Bool found=false; |
---|
| 2665 | for(Int j=0; j<numRefs; j++) |
---|
| 2666 | { |
---|
| 2667 | if(refList[j]==absPOC) |
---|
| 2668 | { |
---|
| 2669 | found=true; |
---|
| 2670 | for(Int k=0; k<m_iGOPSize; k++) |
---|
| 2671 | { |
---|
| 2672 | if(absPOC%m_iGOPSize == m_GOPList[k].m_POC%m_iGOPSize) |
---|
| 2673 | { |
---|
| 2674 | if(m_GOPList[k].m_temporalId==m_GOPList[curGOP].m_temporalId) |
---|
| 2675 | { |
---|
| 2676 | m_GOPList[k].m_refPic = true; |
---|
| 2677 | } |
---|
| 2678 | m_GOPList[curGOP].m_usedByCurrPic[i]=m_GOPList[k].m_temporalId<=m_GOPList[curGOP].m_temporalId; |
---|
| 2679 | } |
---|
| 2680 | } |
---|
| 2681 | } |
---|
| 2682 | } |
---|
| 2683 | if(!found) |
---|
| 2684 | { |
---|
| 2685 | printf("\nError: ref pic %d is not available for GOP frame %d\n",m_GOPList[curGOP].m_referencePics[i],curGOP+1); |
---|
| 2686 | errorGOP=true; |
---|
| 2687 | } |
---|
| 2688 | } |
---|
| 2689 | } |
---|
| 2690 | if(!beforeI&&!errorGOP) |
---|
| 2691 | { |
---|
| 2692 | //all ref frames were present |
---|
| 2693 | if(!isOK[curGOP]) |
---|
| 2694 | { |
---|
| 2695 | numOK++; |
---|
| 2696 | isOK[curGOP]=true; |
---|
| 2697 | if(numOK==m_iGOPSize) |
---|
| 2698 | { |
---|
| 2699 | verifiedGOP=true; |
---|
| 2700 | } |
---|
| 2701 | } |
---|
| 2702 | } |
---|
| 2703 | else |
---|
| 2704 | { |
---|
| 2705 | //create a new GOPEntry for this frame containing all the reference pictures that were available (POC > 0) |
---|
[815] | 2706 | #if !Q0108_TSA_STSA |
---|
[313] | 2707 | m_GOPList[m_iGOPSize+m_extraRPSs]=m_GOPList[curGOP]; |
---|
[815] | 2708 | #else |
---|
| 2709 | m_GOPList[m_iGOPSize+m_extraRPSs[0]]=m_GOPList[curGOP]; |
---|
| 2710 | #endif |
---|
[313] | 2711 | Int newRefs=0; |
---|
| 2712 | for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) |
---|
| 2713 | { |
---|
| 2714 | Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i]; |
---|
| 2715 | if(absPOC>=0) |
---|
| 2716 | { |
---|
[815] | 2717 | #if !Q0108_TSA_STSA |
---|
[313] | 2718 | m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[newRefs]=m_GOPList[curGOP].m_referencePics[i]; |
---|
| 2719 | m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[newRefs]=m_GOPList[curGOP].m_usedByCurrPic[i]; |
---|
[815] | 2720 | #else |
---|
| 2721 | m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[newRefs]=m_GOPList[curGOP].m_referencePics[i]; |
---|
| 2722 | m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_usedByCurrPic[newRefs]=m_GOPList[curGOP].m_usedByCurrPic[i]; |
---|
| 2723 | #endif |
---|
[313] | 2724 | newRefs++; |
---|
| 2725 | } |
---|
| 2726 | } |
---|
| 2727 | Int numPrefRefs = m_GOPList[curGOP].m_numRefPicsActive; |
---|
| 2728 | |
---|
| 2729 | for(Int offset = -1; offset>-checkGOP; offset--) |
---|
| 2730 | { |
---|
| 2731 | //step backwards in coding order and include any extra available pictures we might find useful to replace the ones with POC < 0. |
---|
| 2732 | Int offGOP = (checkGOP-1+offset)%m_iGOPSize; |
---|
| 2733 | Int offPOC = ((checkGOP-1+offset)/m_iGOPSize)*m_iGOPSize + m_GOPList[offGOP].m_POC; |
---|
| 2734 | if(offPOC>=0&&m_GOPList[offGOP].m_temporalId<=m_GOPList[curGOP].m_temporalId) |
---|
| 2735 | { |
---|
| 2736 | Bool newRef=false; |
---|
| 2737 | for(Int i=0; i<numRefs; i++) |
---|
| 2738 | { |
---|
| 2739 | if(refList[i]==offPOC) |
---|
| 2740 | { |
---|
| 2741 | newRef=true; |
---|
| 2742 | } |
---|
| 2743 | } |
---|
| 2744 | for(Int i=0; i<newRefs; i++) |
---|
| 2745 | { |
---|
[815] | 2746 | #if !Q0108_TSA_STSA |
---|
[313] | 2747 | if(m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[i]==offPOC-curPOC) |
---|
[815] | 2748 | #else |
---|
| 2749 | if(m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[i]==offPOC-curPOC) |
---|
| 2750 | #endif |
---|
[313] | 2751 | { |
---|
| 2752 | newRef=false; |
---|
| 2753 | } |
---|
| 2754 | } |
---|
| 2755 | if(newRef) |
---|
| 2756 | { |
---|
| 2757 | Int insertPoint=newRefs; |
---|
| 2758 | //this picture can be added, find appropriate place in list and insert it. |
---|
| 2759 | if(m_GOPList[offGOP].m_temporalId==m_GOPList[curGOP].m_temporalId) |
---|
| 2760 | { |
---|
| 2761 | m_GOPList[offGOP].m_refPic = true; |
---|
| 2762 | } |
---|
| 2763 | for(Int j=0; j<newRefs; j++) |
---|
| 2764 | { |
---|
[815] | 2765 | #if !Q0108_TSA_STSA |
---|
[313] | 2766 | if(m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]<offPOC-curPOC||m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]>0) |
---|
[815] | 2767 | #else |
---|
| 2768 | if(m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[j]<offPOC-curPOC||m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[j]>0) |
---|
| 2769 | #endif |
---|
[313] | 2770 | { |
---|
| 2771 | insertPoint = j; |
---|
| 2772 | break; |
---|
| 2773 | } |
---|
| 2774 | } |
---|
| 2775 | Int prev = offPOC-curPOC; |
---|
| 2776 | Int prevUsed = m_GOPList[offGOP].m_temporalId<=m_GOPList[curGOP].m_temporalId; |
---|
| 2777 | for(Int j=insertPoint; j<newRefs+1; j++) |
---|
| 2778 | { |
---|
[815] | 2779 | #if !Q0108_TSA_STSA |
---|
[313] | 2780 | Int newPrev = m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]; |
---|
| 2781 | Int newUsed = m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j]; |
---|
| 2782 | m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]=prev; |
---|
| 2783 | m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j]=prevUsed; |
---|
[815] | 2784 | #else |
---|
| 2785 | Int newPrev = m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[j]; |
---|
| 2786 | Int newUsed = m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_usedByCurrPic[j]; |
---|
| 2787 | m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[j]=prev; |
---|
| 2788 | m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_usedByCurrPic[j]=prevUsed; |
---|
| 2789 | #endif |
---|
| 2790 | |
---|
[313] | 2791 | prevUsed=newUsed; |
---|
| 2792 | prev=newPrev; |
---|
| 2793 | } |
---|
| 2794 | newRefs++; |
---|
| 2795 | } |
---|
| 2796 | } |
---|
| 2797 | if(newRefs>=numPrefRefs) |
---|
| 2798 | { |
---|
| 2799 | break; |
---|
| 2800 | } |
---|
| 2801 | } |
---|
[815] | 2802 | #if !Q0108_TSA_STSA |
---|
[313] | 2803 | m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefPics=newRefs; |
---|
| 2804 | m_GOPList[m_iGOPSize+m_extraRPSs].m_POC = curPOC; |
---|
[815] | 2805 | #else |
---|
| 2806 | m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_numRefPics=newRefs; |
---|
| 2807 | m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_POC = curPOC; |
---|
| 2808 | #endif |
---|
| 2809 | #if !Q0108_TSA_STSA |
---|
[313] | 2810 | if (m_extraRPSs == 0) |
---|
[815] | 2811 | #else |
---|
| 2812 | if (m_extraRPSs[0] == 0) |
---|
| 2813 | #endif |
---|
[313] | 2814 | { |
---|
[815] | 2815 | #if !Q0108_TSA_STSA |
---|
[313] | 2816 | m_GOPList[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 0; |
---|
| 2817 | m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefIdc = 0; |
---|
[815] | 2818 | #else |
---|
| 2819 | m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_interRPSPrediction = 0; |
---|
| 2820 | m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_numRefIdc = 0; |
---|
| 2821 | #endif |
---|
[313] | 2822 | } |
---|
| 2823 | else |
---|
| 2824 | { |
---|
[815] | 2825 | #if !Q0108_TSA_STSA |
---|
[313] | 2826 | Int rIdx = m_iGOPSize + m_extraRPSs - 1; |
---|
[815] | 2827 | #else |
---|
| 2828 | Int rIdx = m_iGOPSize + m_extraRPSs[0] - 1; |
---|
| 2829 | #endif |
---|
[313] | 2830 | Int refPOC = m_GOPList[rIdx].m_POC; |
---|
| 2831 | Int refPics = m_GOPList[rIdx].m_numRefPics; |
---|
| 2832 | Int newIdc=0; |
---|
| 2833 | for(Int i = 0; i<= refPics; i++) |
---|
| 2834 | { |
---|
| 2835 | Int deltaPOC = ((i != refPics)? m_GOPList[rIdx].m_referencePics[i] : 0); // check if the reference abs POC is >= 0 |
---|
| 2836 | Int absPOCref = refPOC+deltaPOC; |
---|
| 2837 | Int refIdc = 0; |
---|
[815] | 2838 | #if !Q0108_TSA_STSA |
---|
[313] | 2839 | for (Int j = 0; j < m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefPics; j++) |
---|
| 2840 | { |
---|
| 2841 | if ( (absPOCref - curPOC) == m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]) |
---|
| 2842 | { |
---|
| 2843 | if (m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j]) |
---|
| 2844 | { |
---|
| 2845 | refIdc = 1; |
---|
| 2846 | } |
---|
| 2847 | else |
---|
| 2848 | { |
---|
| 2849 | refIdc = 2; |
---|
| 2850 | } |
---|
| 2851 | } |
---|
| 2852 | } |
---|
| 2853 | m_GOPList[m_iGOPSize+m_extraRPSs].m_refIdc[newIdc]=refIdc; |
---|
| 2854 | newIdc++; |
---|
| 2855 | } |
---|
| 2856 | m_GOPList[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 1; |
---|
| 2857 | m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefIdc = newIdc; |
---|
| 2858 | m_GOPList[m_iGOPSize+m_extraRPSs].m_deltaRPS = refPOC - m_GOPList[m_iGOPSize+m_extraRPSs].m_POC; |
---|
| 2859 | } |
---|
| 2860 | curGOP=m_iGOPSize+m_extraRPSs; |
---|
| 2861 | m_extraRPSs++; |
---|
| 2862 | } |
---|
[815] | 2863 | #else |
---|
| 2864 | for (Int j = 0; j < m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_numRefPics; j++) |
---|
| 2865 | { |
---|
| 2866 | if ( (absPOCref - curPOC) == m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[j]) |
---|
| 2867 | { |
---|
| 2868 | if (m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_usedByCurrPic[j]) |
---|
| 2869 | { |
---|
| 2870 | refIdc = 1; |
---|
| 2871 | } |
---|
| 2872 | else |
---|
| 2873 | { |
---|
| 2874 | refIdc = 2; |
---|
| 2875 | } |
---|
| 2876 | } |
---|
| 2877 | } |
---|
| 2878 | m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_refIdc[newIdc]=refIdc; |
---|
| 2879 | newIdc++; |
---|
| 2880 | } |
---|
| 2881 | m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_interRPSPrediction = 1; |
---|
| 2882 | m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_numRefIdc = newIdc; |
---|
| 2883 | m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_deltaRPS = refPOC - m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_POC; |
---|
| 2884 | } |
---|
| 2885 | curGOP=m_iGOPSize+m_extraRPSs[0]; |
---|
| 2886 | m_extraRPSs[0]++; |
---|
| 2887 | } |
---|
| 2888 | #endif |
---|
| 2889 | |
---|
[313] | 2890 | numRefs=0; |
---|
| 2891 | for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) |
---|
| 2892 | { |
---|
| 2893 | Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i]; |
---|
| 2894 | if(absPOC >= 0) |
---|
| 2895 | { |
---|
| 2896 | refList[numRefs]=absPOC; |
---|
| 2897 | numRefs++; |
---|
| 2898 | } |
---|
| 2899 | } |
---|
| 2900 | refList[numRefs]=curPOC; |
---|
| 2901 | numRefs++; |
---|
| 2902 | } |
---|
| 2903 | checkGOP++; |
---|
| 2904 | } |
---|
| 2905 | xConfirmPara(errorGOP,"Invalid GOP structure given"); |
---|
[815] | 2906 | |
---|
| 2907 | #if SVC_EXTENSION && Q0108_TSA_STSA |
---|
| 2908 | for ( Int layerId = 1; layerId < m_numLayers; layerId++ ) |
---|
| 2909 | { |
---|
| 2910 | verifiedGOP=false; |
---|
| 2911 | errorGOP=false; |
---|
| 2912 | checkGOP=1; |
---|
| 2913 | numRefs = m_isField ? 2 : 1; |
---|
| 2914 | refList[0]=0; |
---|
| 2915 | |
---|
| 2916 | if(m_isField) |
---|
| 2917 | { |
---|
| 2918 | refList[1] = 1; |
---|
| 2919 | } |
---|
| 2920 | |
---|
| 2921 | memset( isOK, 0, sizeof( isOK ) ); |
---|
| 2922 | numOK=0; |
---|
| 2923 | |
---|
| 2924 | for(Int i=0; i<m_iGOPSize; i++) |
---|
| 2925 | { |
---|
| 2926 | if(m_EhGOPList[layerId][i].m_POC==m_iGOPSize) |
---|
| 2927 | { |
---|
| 2928 | xConfirmPara( m_EhGOPList[layerId][i].m_temporalId!=0 , "The last frame in each GOP must have temporal ID = 0 " ); |
---|
| 2929 | } |
---|
| 2930 | } |
---|
| 2931 | |
---|
| 2932 | xConfirmPara( m_numLayers > MAX_LAYERS , "Number of layers in config file is greater than MAX_LAYERS" ); |
---|
| 2933 | m_numLayers = m_numLayers > MAX_LAYERS ? MAX_LAYERS : m_numLayers; |
---|
| 2934 | |
---|
| 2935 | // verify layer configuration parameters |
---|
| 2936 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
| 2937 | { |
---|
| 2938 | Int m_iIntraPeriod = m_acLayerCfg[layer].m_iIntraPeriod; |
---|
| 2939 | if ( (m_iIntraPeriod != 1) && !m_loopFilterOffsetInPPS && m_DeblockingFilterControlPresent && (!m_bLoopFilterDisable) ) |
---|
| 2940 | { |
---|
| 2941 | for(Int i=0; i<m_iGOPSize; i++) |
---|
| 2942 | { |
---|
| 2943 | xConfirmPara( (m_EhGOPList[layerId][i].m_betaOffsetDiv2 + m_loopFilterBetaOffsetDiv2) < -6 || (m_EhGOPList[layerId][i].m_betaOffsetDiv2 + m_loopFilterBetaOffsetDiv2) > 6, "Loop Filter Beta Offset div. 2 for one of the GOP entries exceeds supported range (-6 to 6)" ); |
---|
| 2944 | xConfirmPara( (m_EhGOPList[layerId][i].m_tcOffsetDiv2 + m_loopFilterTcOffsetDiv2) < -6 || (m_EhGOPList[layerId][i].m_tcOffsetDiv2 + m_loopFilterTcOffsetDiv2) > 6, "Loop Filter Tc Offset div. 2 for one of the GOP entries exceeds supported range (-6 to 6)" ); |
---|
| 2945 | } |
---|
| 2946 | } |
---|
| 2947 | } |
---|
| 2948 | |
---|
| 2949 | //start looping through frames in coding order until we can verify that the GOP structure is correct. |
---|
| 2950 | while(!verifiedGOP&&!errorGOP) |
---|
| 2951 | { |
---|
| 2952 | Int curGOP = (checkGOP-1)%m_iGOPSize; |
---|
| 2953 | Int curPOC = ((checkGOP-1)/m_iGOPSize)*m_iGOPSize + m_EhGOPList[layerId][curGOP].m_POC; |
---|
| 2954 | if(m_EhGOPList[layerId][curGOP].m_POC<0) |
---|
| 2955 | { |
---|
| 2956 | printf("\nError: found fewer Reference Picture Sets than GOPSize\n"); |
---|
| 2957 | errorGOP=true; |
---|
| 2958 | } |
---|
| 2959 | else |
---|
| 2960 | { |
---|
| 2961 | //check that all reference pictures are available, or have a POC < 0 meaning they might be available in the next GOP. |
---|
| 2962 | Bool beforeI = false; |
---|
| 2963 | for(Int i = 0; i< m_EhGOPList[layerId][curGOP].m_numRefPics; i++) |
---|
| 2964 | { |
---|
| 2965 | Int absPOC = curPOC+m_EhGOPList[layerId][curGOP].m_referencePics[i]; |
---|
| 2966 | if(absPOC < 0) |
---|
| 2967 | { |
---|
| 2968 | beforeI=true; |
---|
| 2969 | } |
---|
| 2970 | else |
---|
| 2971 | { |
---|
| 2972 | Bool found=false; |
---|
| 2973 | for(Int j=0; j<numRefs; j++) |
---|
| 2974 | { |
---|
| 2975 | if(refList[j]==absPOC) |
---|
| 2976 | { |
---|
| 2977 | found=true; |
---|
| 2978 | for(Int k=0; k<m_iGOPSize; k++) |
---|
| 2979 | { |
---|
| 2980 | if(absPOC%m_iGOPSize == m_EhGOPList[layerId][k].m_POC%m_iGOPSize) |
---|
| 2981 | { |
---|
| 2982 | if(m_EhGOPList[layerId][k].m_temporalId==m_EhGOPList[layerId][curGOP].m_temporalId) |
---|
| 2983 | { |
---|
| 2984 | m_EhGOPList[layerId][k].m_refPic = true; |
---|
| 2985 | } |
---|
| 2986 | m_EhGOPList[layerId][curGOP].m_usedByCurrPic[i]=m_EhGOPList[layerId][k].m_temporalId<=m_EhGOPList[layerId][curGOP].m_temporalId; |
---|
| 2987 | } |
---|
| 2988 | } |
---|
| 2989 | } |
---|
| 2990 | } |
---|
| 2991 | if(!found) |
---|
| 2992 | { |
---|
| 2993 | printf("\nError: ref pic %d is not available for GOP frame %d\n",m_EhGOPList[layerId][curGOP].m_referencePics[i],curGOP+1); |
---|
| 2994 | errorGOP=true; |
---|
| 2995 | } |
---|
| 2996 | } |
---|
| 2997 | } |
---|
| 2998 | if(!beforeI&&!errorGOP) |
---|
| 2999 | { |
---|
| 3000 | //all ref frames were present |
---|
| 3001 | if(!isOK[curGOP]) |
---|
| 3002 | { |
---|
| 3003 | numOK++; |
---|
| 3004 | isOK[curGOP]=true; |
---|
| 3005 | if(numOK==m_iGOPSize) |
---|
| 3006 | { |
---|
| 3007 | verifiedGOP=true; |
---|
| 3008 | } |
---|
| 3009 | } |
---|
| 3010 | } |
---|
| 3011 | else |
---|
| 3012 | { |
---|
| 3013 | //create a new GOPEntry for this frame containing all the reference pictures that were available (POC > 0) |
---|
| 3014 | |
---|
| 3015 | m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]]=m_EhGOPList[layerId][curGOP]; |
---|
| 3016 | Int newRefs=0; |
---|
| 3017 | for(Int i = 0; i< m_EhGOPList[layerId][curGOP].m_numRefPics; i++) |
---|
| 3018 | { |
---|
| 3019 | Int absPOC = curPOC+m_EhGOPList[layerId][curGOP].m_referencePics[i]; |
---|
| 3020 | if(absPOC>=0) |
---|
| 3021 | { |
---|
| 3022 | m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_referencePics[newRefs]=m_EhGOPList[layerId][curGOP].m_referencePics[i]; |
---|
| 3023 | m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_usedByCurrPic[newRefs]=m_EhGOPList[layerId][curGOP].m_usedByCurrPic[i]; |
---|
| 3024 | newRefs++; |
---|
| 3025 | } |
---|
| 3026 | } |
---|
| 3027 | Int numPrefRefs = m_EhGOPList[layerId][curGOP].m_numRefPicsActive; |
---|
| 3028 | |
---|
| 3029 | for(Int offset = -1; offset>-checkGOP; offset--) |
---|
| 3030 | { |
---|
| 3031 | //step backwards in coding order and include any extra available pictures we might find useful to replace the ones with POC < 0. |
---|
| 3032 | Int offGOP = (checkGOP-1+offset)%m_iGOPSize; |
---|
| 3033 | Int offPOC = ((checkGOP-1+offset)/m_iGOPSize)*m_iGOPSize + m_EhGOPList[layerId][offGOP].m_POC; |
---|
| 3034 | if(offPOC>=0&&m_EhGOPList[layerId][offGOP].m_temporalId<=m_EhGOPList[layerId][curGOP].m_temporalId) |
---|
| 3035 | { |
---|
| 3036 | Bool newRef=false; |
---|
| 3037 | for(Int i=0; i<numRefs; i++) |
---|
| 3038 | { |
---|
| 3039 | if(refList[i]==offPOC) |
---|
| 3040 | { |
---|
| 3041 | newRef=true; |
---|
| 3042 | } |
---|
| 3043 | } |
---|
| 3044 | for(Int i=0; i<newRefs; i++) |
---|
| 3045 | { |
---|
| 3046 | if(m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_referencePics[i]==offPOC-curPOC) |
---|
| 3047 | { |
---|
| 3048 | newRef=false; |
---|
| 3049 | } |
---|
| 3050 | } |
---|
| 3051 | if(newRef) |
---|
| 3052 | { |
---|
| 3053 | Int insertPoint=newRefs; |
---|
| 3054 | //this picture can be added, find appropriate place in list and insert it. |
---|
| 3055 | if(m_EhGOPList[layerId][offGOP].m_temporalId==m_EhGOPList[layerId][curGOP].m_temporalId) |
---|
| 3056 | { |
---|
| 3057 | m_EhGOPList[layerId][offGOP].m_refPic = true; |
---|
| 3058 | } |
---|
| 3059 | for(Int j=0; j<newRefs; j++) |
---|
| 3060 | { |
---|
| 3061 | if(m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_referencePics[j]<offPOC-curPOC||m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_referencePics[j]>0) |
---|
| 3062 | { |
---|
| 3063 | insertPoint = j; |
---|
| 3064 | break; |
---|
| 3065 | } |
---|
| 3066 | } |
---|
| 3067 | Int prev = offPOC-curPOC; |
---|
| 3068 | Int prevUsed = m_EhGOPList[layerId][offGOP].m_temporalId<=m_EhGOPList[layerId][curGOP].m_temporalId; |
---|
| 3069 | for(Int j=insertPoint; j<newRefs+1; j++) |
---|
| 3070 | { |
---|
| 3071 | Int newPrev = m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_referencePics[j]; |
---|
| 3072 | Int newUsed = m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_usedByCurrPic[j]; |
---|
| 3073 | m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_referencePics[j]=prev; |
---|
| 3074 | m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_usedByCurrPic[j]=prevUsed; |
---|
| 3075 | prevUsed=newUsed; |
---|
| 3076 | prev=newPrev; |
---|
| 3077 | } |
---|
| 3078 | newRefs++; |
---|
| 3079 | } |
---|
| 3080 | } |
---|
| 3081 | if(newRefs>=numPrefRefs) |
---|
| 3082 | { |
---|
| 3083 | break; |
---|
| 3084 | } |
---|
| 3085 | } |
---|
| 3086 | m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_numRefPics=newRefs; |
---|
| 3087 | m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_POC = curPOC; |
---|
| 3088 | if (m_extraRPSs[layerId] == 0) |
---|
| 3089 | { |
---|
| 3090 | m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_interRPSPrediction = 0; |
---|
| 3091 | m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_numRefIdc = 0; |
---|
| 3092 | } |
---|
| 3093 | else |
---|
| 3094 | { |
---|
| 3095 | Int rIdx = m_iGOPSize + m_extraRPSs[layerId] - 1; |
---|
| 3096 | Int refPOC = m_EhGOPList[layerId][rIdx].m_POC; |
---|
| 3097 | Int refPics = m_EhGOPList[layerId][rIdx].m_numRefPics; |
---|
| 3098 | Int newIdc=0; |
---|
| 3099 | for(Int i = 0; i<= refPics; i++) |
---|
| 3100 | { |
---|
| 3101 | Int deltaPOC = ((i != refPics)? m_EhGOPList[layerId][rIdx].m_referencePics[i] : 0); // check if the reference abs POC is >= 0 |
---|
| 3102 | Int absPOCref = refPOC+deltaPOC; |
---|
| 3103 | Int refIdc = 0; |
---|
| 3104 | for (Int j = 0; j < m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_numRefPics; j++) |
---|
| 3105 | { |
---|
| 3106 | if ( (absPOCref - curPOC) == m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_referencePics[j]) |
---|
| 3107 | { |
---|
| 3108 | if (m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_usedByCurrPic[j]) |
---|
| 3109 | { |
---|
| 3110 | refIdc = 1; |
---|
| 3111 | } |
---|
| 3112 | else |
---|
| 3113 | { |
---|
| 3114 | refIdc = 2; |
---|
| 3115 | } |
---|
| 3116 | } |
---|
| 3117 | } |
---|
| 3118 | m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_refIdc[newIdc]=refIdc; |
---|
| 3119 | newIdc++; |
---|
| 3120 | } |
---|
| 3121 | m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_interRPSPrediction = 1; |
---|
| 3122 | m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_numRefIdc = newIdc; |
---|
| 3123 | m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_deltaRPS = refPOC - m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_POC; |
---|
| 3124 | } |
---|
| 3125 | curGOP=m_iGOPSize+m_extraRPSs[layerId]; |
---|
| 3126 | m_extraRPSs[layerId]++; |
---|
| 3127 | } |
---|
| 3128 | numRefs=0; |
---|
| 3129 | for(Int i = 0; i< m_EhGOPList[layerId][curGOP].m_numRefPics; i++) |
---|
| 3130 | { |
---|
| 3131 | Int absPOC = curPOC+m_EhGOPList[layerId][curGOP].m_referencePics[i]; |
---|
| 3132 | if(absPOC >= 0) |
---|
| 3133 | { |
---|
| 3134 | refList[numRefs]=absPOC; |
---|
| 3135 | numRefs++; |
---|
| 3136 | } |
---|
| 3137 | } |
---|
| 3138 | refList[numRefs]=curPOC; |
---|
| 3139 | numRefs++; |
---|
| 3140 | } |
---|
| 3141 | checkGOP++; |
---|
| 3142 | } |
---|
| 3143 | xConfirmPara(errorGOP,"Invalid GOP structure given"); |
---|
| 3144 | } |
---|
| 3145 | #endif |
---|
| 3146 | |
---|
[313] | 3147 | m_maxTempLayer = 1; |
---|
| 3148 | for(Int i=0; i<m_iGOPSize; i++) |
---|
| 3149 | { |
---|
| 3150 | if(m_GOPList[i].m_temporalId >= m_maxTempLayer) |
---|
| 3151 | { |
---|
| 3152 | m_maxTempLayer = m_GOPList[i].m_temporalId+1; |
---|
| 3153 | } |
---|
[595] | 3154 | xConfirmPara(m_GOPList[i].m_sliceType!='B'&&m_GOPList[i].m_sliceType!='P'&&m_GOPList[i].m_sliceType!='I', "Slice type must be equal to B or P or I"); |
---|
[313] | 3155 | } |
---|
[815] | 3156 | |
---|
| 3157 | #if Q0108_TSA_STSA |
---|
| 3158 | for ( Int layerId = 1; layerId < m_numLayers; layerId++) |
---|
| 3159 | { |
---|
| 3160 | m_EhMaxTempLayer[layerId] = 1; |
---|
| 3161 | for(Int i=0; i<m_iGOPSize; i++) |
---|
| 3162 | { |
---|
| 3163 | if(m_EhGOPList[layerId][i].m_temporalId >= m_EhMaxTempLayer[layerId] ) |
---|
| 3164 | { |
---|
| 3165 | m_EhMaxTempLayer[layerId] = m_EhGOPList[layerId][i].m_temporalId; |
---|
| 3166 | } |
---|
| 3167 | xConfirmPara(m_GOPList[i].m_sliceType!='B'&&m_GOPList[i].m_sliceType!='P'&&m_GOPList[i].m_sliceType!='I', "Slice type must be equal to B or P or I"); |
---|
| 3168 | } |
---|
| 3169 | } |
---|
| 3170 | #endif |
---|
| 3171 | |
---|
[313] | 3172 | for(Int i=0; i<MAX_TLAYER; i++) |
---|
| 3173 | { |
---|
| 3174 | m_numReorderPics[i] = 0; |
---|
| 3175 | m_maxDecPicBuffering[i] = 1; |
---|
| 3176 | } |
---|
| 3177 | for(Int i=0; i<m_iGOPSize; i++) |
---|
| 3178 | { |
---|
| 3179 | if(m_GOPList[i].m_numRefPics+1 > m_maxDecPicBuffering[m_GOPList[i].m_temporalId]) |
---|
| 3180 | { |
---|
| 3181 | m_maxDecPicBuffering[m_GOPList[i].m_temporalId] = m_GOPList[i].m_numRefPics + 1; |
---|
| 3182 | } |
---|
| 3183 | Int highestDecodingNumberWithLowerPOC = 0; |
---|
| 3184 | for(Int j=0; j<m_iGOPSize; j++) |
---|
| 3185 | { |
---|
| 3186 | if(m_GOPList[j].m_POC <= m_GOPList[i].m_POC) |
---|
| 3187 | { |
---|
| 3188 | highestDecodingNumberWithLowerPOC = j; |
---|
| 3189 | } |
---|
| 3190 | } |
---|
| 3191 | Int numReorder = 0; |
---|
| 3192 | for(Int j=0; j<highestDecodingNumberWithLowerPOC; j++) |
---|
| 3193 | { |
---|
| 3194 | if(m_GOPList[j].m_temporalId <= m_GOPList[i].m_temporalId && |
---|
| 3195 | m_GOPList[j].m_POC > m_GOPList[i].m_POC) |
---|
| 3196 | { |
---|
| 3197 | numReorder++; |
---|
| 3198 | } |
---|
| 3199 | } |
---|
| 3200 | if(numReorder > m_numReorderPics[m_GOPList[i].m_temporalId]) |
---|
| 3201 | { |
---|
| 3202 | m_numReorderPics[m_GOPList[i].m_temporalId] = numReorder; |
---|
| 3203 | } |
---|
| 3204 | } |
---|
| 3205 | for(Int i=0; i<MAX_TLAYER-1; i++) |
---|
| 3206 | { |
---|
| 3207 | // a lower layer can not have higher value of m_numReorderPics than a higher layer |
---|
| 3208 | if(m_numReorderPics[i+1] < m_numReorderPics[i]) |
---|
| 3209 | { |
---|
| 3210 | m_numReorderPics[i+1] = m_numReorderPics[i]; |
---|
| 3211 | } |
---|
| 3212 | // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ] - 1, inclusive |
---|
| 3213 | if(m_numReorderPics[i] > m_maxDecPicBuffering[i] - 1) |
---|
| 3214 | { |
---|
| 3215 | m_maxDecPicBuffering[i] = m_numReorderPics[i] + 1; |
---|
| 3216 | } |
---|
| 3217 | // a lower layer can not have higher value of m_uiMaxDecPicBuffering than a higher layer |
---|
| 3218 | if(m_maxDecPicBuffering[i+1] < m_maxDecPicBuffering[i]) |
---|
| 3219 | { |
---|
| 3220 | m_maxDecPicBuffering[i+1] = m_maxDecPicBuffering[i]; |
---|
| 3221 | } |
---|
| 3222 | } |
---|
| 3223 | |
---|
| 3224 | |
---|
| 3225 | // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ] - 1, inclusive |
---|
| 3226 | if(m_numReorderPics[MAX_TLAYER-1] > m_maxDecPicBuffering[MAX_TLAYER-1] - 1) |
---|
| 3227 | { |
---|
| 3228 | m_maxDecPicBuffering[MAX_TLAYER-1] = m_numReorderPics[MAX_TLAYER-1] + 1; |
---|
| 3229 | } |
---|
| 3230 | |
---|
| 3231 | #if SVC_EXTENSION // ToDo: it should be checked for the case when parameters are different for the layers |
---|
| 3232 | for(UInt layer = 0; layer < MAX_LAYERS; layer++) |
---|
| 3233 | { |
---|
| 3234 | Int m_iSourceWidth = m_acLayerCfg[layer].m_iSourceWidth; |
---|
| 3235 | Int m_iSourceHeight = m_acLayerCfg[layer].m_iSourceHeight; |
---|
[494] | 3236 | #if LAYER_CTB |
---|
| 3237 | Int m_uiMaxCUWidth = m_acLayerCfg[layer].m_uiMaxCUWidth; |
---|
| 3238 | Int m_uiMaxCUHeight = m_acLayerCfg[layer].m_uiMaxCUHeight; |
---|
[313] | 3239 | #endif |
---|
[906] | 3240 | |
---|
| 3241 | Bool tileFlag = (m_numTileColumnsMinus1 > 0 || m_numTileRowsMinus1 > 0 ); |
---|
| 3242 | Int m_iWaveFrontSynchro = m_acLayerCfg[layer].m_waveFrontSynchro; |
---|
| 3243 | xConfirmPara( tileFlag && m_iWaveFrontSynchro, "Tile and Wavefront can not be applied together"); |
---|
[494] | 3244 | #endif |
---|
[906] | 3245 | |
---|
[313] | 3246 | if(m_vuiParametersPresentFlag && m_bitstreamRestrictionFlag) |
---|
| 3247 | { |
---|
| 3248 | Int PicSizeInSamplesY = m_iSourceWidth * m_iSourceHeight; |
---|
| 3249 | if(tileFlag) |
---|
| 3250 | { |
---|
| 3251 | Int maxTileWidth = 0; |
---|
| 3252 | Int maxTileHeight = 0; |
---|
| 3253 | Int widthInCU = (m_iSourceWidth % m_uiMaxCUWidth) ? m_iSourceWidth/m_uiMaxCUWidth + 1: m_iSourceWidth/m_uiMaxCUWidth; |
---|
| 3254 | Int heightInCU = (m_iSourceHeight % m_uiMaxCUHeight) ? m_iSourceHeight/m_uiMaxCUHeight + 1: m_iSourceHeight/m_uiMaxCUHeight; |
---|
[906] | 3255 | if(m_tileUniformSpacingFlag) |
---|
[313] | 3256 | { |
---|
[906] | 3257 | maxTileWidth = m_uiMaxCUWidth*((widthInCU+m_numTileColumnsMinus1)/(m_numTileColumnsMinus1+1)); |
---|
| 3258 | maxTileHeight = m_uiMaxCUHeight*((heightInCU+m_numTileRowsMinus1)/(m_numTileRowsMinus1+1)); |
---|
[313] | 3259 | // if only the last tile-row is one treeblock higher than the others |
---|
| 3260 | // the maxTileHeight becomes smaller if the last row of treeblocks has lower height than the others |
---|
[906] | 3261 | if(!((heightInCU-1)%(m_numTileRowsMinus1+1))) |
---|
[313] | 3262 | { |
---|
| 3263 | maxTileHeight = maxTileHeight - m_uiMaxCUHeight + (m_iSourceHeight % m_uiMaxCUHeight); |
---|
| 3264 | } |
---|
| 3265 | // if only the last tile-column is one treeblock wider than the others |
---|
| 3266 | // the maxTileWidth becomes smaller if the last column of treeblocks has lower width than the others |
---|
[906] | 3267 | if(!((widthInCU-1)%(m_numTileColumnsMinus1+1))) |
---|
[313] | 3268 | { |
---|
| 3269 | maxTileWidth = maxTileWidth - m_uiMaxCUWidth + (m_iSourceWidth % m_uiMaxCUWidth); |
---|
| 3270 | } |
---|
| 3271 | } |
---|
| 3272 | else // not uniform spacing |
---|
| 3273 | { |
---|
[906] | 3274 | if(m_numTileColumnsMinus1<1) |
---|
[313] | 3275 | { |
---|
| 3276 | maxTileWidth = m_iSourceWidth; |
---|
| 3277 | } |
---|
| 3278 | else |
---|
| 3279 | { |
---|
| 3280 | Int accColumnWidth = 0; |
---|
[906] | 3281 | for(Int col=0; col<(m_numTileColumnsMinus1); col++) |
---|
[313] | 3282 | { |
---|
[906] | 3283 | maxTileWidth = m_tileColumnWidth[col]>maxTileWidth ? m_tileColumnWidth[col]:maxTileWidth; |
---|
| 3284 | accColumnWidth += m_tileColumnWidth[col]; |
---|
[313] | 3285 | } |
---|
| 3286 | maxTileWidth = (widthInCU-accColumnWidth)>maxTileWidth ? m_uiMaxCUWidth*(widthInCU-accColumnWidth):m_uiMaxCUWidth*maxTileWidth; |
---|
| 3287 | } |
---|
[906] | 3288 | if(m_numTileRowsMinus1<1) |
---|
[313] | 3289 | { |
---|
| 3290 | maxTileHeight = m_iSourceHeight; |
---|
| 3291 | } |
---|
| 3292 | else |
---|
| 3293 | { |
---|
| 3294 | Int accRowHeight = 0; |
---|
[906] | 3295 | for(Int row=0; row<(m_numTileRowsMinus1); row++) |
---|
[313] | 3296 | { |
---|
[906] | 3297 | maxTileHeight = m_tileRowHeight[row]>maxTileHeight ? m_tileRowHeight[row]:maxTileHeight; |
---|
| 3298 | accRowHeight += m_tileRowHeight[row]; |
---|
[313] | 3299 | } |
---|
| 3300 | maxTileHeight = (heightInCU-accRowHeight)>maxTileHeight ? m_uiMaxCUHeight*(heightInCU-accRowHeight):m_uiMaxCUHeight*maxTileHeight; |
---|
| 3301 | } |
---|
| 3302 | } |
---|
| 3303 | Int maxSizeInSamplesY = maxTileWidth*maxTileHeight; |
---|
| 3304 | m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/maxSizeInSamplesY-4; |
---|
| 3305 | } |
---|
| 3306 | else if(m_iWaveFrontSynchro) |
---|
| 3307 | { |
---|
| 3308 | m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/((2*m_iSourceHeight+m_iSourceWidth)*m_uiMaxCUHeight)-4; |
---|
| 3309 | } |
---|
| 3310 | else if(m_sliceMode == 1) |
---|
| 3311 | { |
---|
| 3312 | m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/(m_sliceArgument*m_uiMaxCUWidth*m_uiMaxCUHeight)-4; |
---|
| 3313 | } |
---|
| 3314 | else |
---|
| 3315 | { |
---|
| 3316 | m_minSpatialSegmentationIdc = 0; |
---|
| 3317 | } |
---|
| 3318 | } |
---|
| 3319 | #if SVC_EXTENSION |
---|
| 3320 | } |
---|
| 3321 | #endif |
---|
[906] | 3322 | #if !SVC_EXTENSION |
---|
[313] | 3323 | xConfirmPara( m_iWaveFrontSynchro < 0, "WaveFrontSynchro cannot be negative" ); |
---|
| 3324 | xConfirmPara( m_iWaveFrontSubstreams <= 0, "WaveFrontSubstreams must be positive" ); |
---|
| 3325 | xConfirmPara( m_iWaveFrontSubstreams > 1 && !m_iWaveFrontSynchro, "Must have WaveFrontSynchro > 0 in order to have WaveFrontSubstreams > 1" ); |
---|
| 3326 | #endif |
---|
| 3327 | |
---|
| 3328 | xConfirmPara( m_decodedPictureHashSEIEnabled<0 || m_decodedPictureHashSEIEnabled>3, "this hash type is not correct!\n"); |
---|
| 3329 | |
---|
| 3330 | if (m_toneMappingInfoSEIEnabled) |
---|
| 3331 | { |
---|
| 3332 | xConfirmPara( m_toneMapCodedDataBitDepth < 8 || m_toneMapCodedDataBitDepth > 14 , "SEIToneMapCodedDataBitDepth must be in rage 8 to 14"); |
---|
| 3333 | xConfirmPara( m_toneMapTargetBitDepth < 1 || (m_toneMapTargetBitDepth > 16 && m_toneMapTargetBitDepth < 255) , "SEIToneMapTargetBitDepth must be in rage 1 to 16 or equal to 255"); |
---|
| 3334 | xConfirmPara( m_toneMapModelId < 0 || m_toneMapModelId > 4 , "SEIToneMapModelId must be in rage 0 to 4"); |
---|
| 3335 | xConfirmPara( m_cameraIsoSpeedValue == 0, "SEIToneMapCameraIsoSpeedValue shall not be equal to 0"); |
---|
[713] | 3336 | xConfirmPara( m_exposureIndexValue == 0, "SEIToneMapExposureIndexValue shall not be equal to 0"); |
---|
[313] | 3337 | xConfirmPara( m_extendedRangeWhiteLevel < 100, "SEIToneMapExtendedRangeWhiteLevel should be greater than or equal to 100"); |
---|
| 3338 | xConfirmPara( m_nominalBlackLevelLumaCodeValue >= m_nominalWhiteLevelLumaCodeValue, "SEIToneMapNominalWhiteLevelLumaCodeValue shall be greater than SEIToneMapNominalBlackLevelLumaCodeValue"); |
---|
| 3339 | xConfirmPara( m_extendedWhiteLevelLumaCodeValue < m_nominalWhiteLevelLumaCodeValue, "SEIToneMapExtendedWhiteLevelLumaCodeValue shall be greater than or equal to SEIToneMapNominalWhiteLevelLumaCodeValue"); |
---|
| 3340 | } |
---|
[815] | 3341 | #if P0050_KNEE_FUNCTION_SEI |
---|
| 3342 | if (m_kneeSEIEnabled && !m_kneeSEICancelFlag) |
---|
| 3343 | { |
---|
| 3344 | xConfirmPara( m_kneeSEINumKneePointsMinus1 < 0 || m_kneeSEINumKneePointsMinus1 > 998, "SEIKneeFunctionNumKneePointsMinus1 must be in the range of 0 to 998"); |
---|
| 3345 | for ( UInt i=0; i<=m_kneeSEINumKneePointsMinus1; i++ ){ |
---|
| 3346 | xConfirmPara( m_kneeSEIInputKneePoint[i] < 1 || m_kneeSEIInputKneePoint[i] > 999, "SEIKneeFunctionInputKneePointValue must be in the range of 1 to 999"); |
---|
| 3347 | xConfirmPara( m_kneeSEIOutputKneePoint[i] < 0 || m_kneeSEIOutputKneePoint[i] > 1000, "SEIKneeFunctionInputKneePointValue must be in the range of 0 to 1000"); |
---|
| 3348 | if ( i > 0 ) |
---|
| 3349 | { |
---|
| 3350 | xConfirmPara( m_kneeSEIInputKneePoint[i-1] >= m_kneeSEIInputKneePoint[i], "The i-th SEIKneeFunctionInputKneePointValue must be greather than the (i-1)-th value"); |
---|
| 3351 | } |
---|
| 3352 | } |
---|
| 3353 | } |
---|
| 3354 | #endif |
---|
[906] | 3355 | #if Q0074_COLOUR_REMAPPING_SEI |
---|
| 3356 | #if !SVC_EXTENSION |
---|
| 3357 | if ( ( m_colourRemapSEIFile.size() > 0 ) && !m_colourRemapSEICancelFlag ) |
---|
| 3358 | { |
---|
| 3359 | xConfirmPara( m_colourRemapSEIInputBitDepth < 8 || m_colourRemapSEIInputBitDepth > 16 , "colour_remap_input_bit_depth shall be in the range of 8 to 16, inclusive"); |
---|
| 3360 | xConfirmPara( m_colourRemapSEIBitDepth < 8 || m_colourRemapSEIBitDepth > 16, "colour_remap_bit_depth shall be in the range of 8 to 16, inclusive"); |
---|
| 3361 | for( Int c=0 ; c<3 ; c++) |
---|
| 3362 | { |
---|
| 3363 | xConfirmPara( m_colourRemapSEIPreLutNumValMinus1[c] < 0 || m_colourRemapSEIPreLutNumValMinus1[c] > 32, "pre_lut_num_val_minus1[c] shall be in the range of 0 to 32, inclusive"); |
---|
| 3364 | if( m_colourRemapSEIPreLutNumValMinus1[c]>0 ) |
---|
| 3365 | for( Int i=0 ; i<=m_colourRemapSEIPreLutNumValMinus1[c] ; i++) |
---|
| 3366 | { |
---|
| 3367 | xConfirmPara( m_colourRemapSEIPreLutCodedValue[c][i] < 0 || m_colourRemapSEIPreLutCodedValue[c][i] > ((1<<m_colourRemapSEIInputBitDepth)-1), "pre_lut_coded_value[c][i] shall be in the range of 0 to (1<<colour_remap_input_bit_depth)-1, inclusive"); |
---|
| 3368 | xConfirmPara( m_colourRemapSEIPreLutTargetValue[c][i] < 0 || m_colourRemapSEIPreLutTargetValue[c][i] > ((1<<m_colourRemapSEIBitDepth)-1), "pre_lut_target_value[c][i] shall be in the range of 0 to (1<<colour_remap_bit_depth)-1, inclusive"); |
---|
| 3369 | } |
---|
| 3370 | xConfirmPara( m_colourRemapSEIPostLutNumValMinus1[c] < 0 || m_colourRemapSEIPostLutNumValMinus1[c] > 32, "post_lut_num_val_minus1[c] shall be in the range of 0 to 32, inclusive"); |
---|
| 3371 | if( m_colourRemapSEIPostLutNumValMinus1[c]>0 ) |
---|
| 3372 | for( Int i=0 ; i<=m_colourRemapSEIPostLutNumValMinus1[c] ; i++) |
---|
| 3373 | { |
---|
| 3374 | xConfirmPara( m_colourRemapSEIPostLutCodedValue[c][i] < 0 || m_colourRemapSEIPostLutCodedValue[c][i] > ((1<<m_colourRemapSEIBitDepth)-1), "post_lut_coded_value[c][i] shall be in the range of 0 to (1<<colour_remap_bit_depth)-1, inclusive"); |
---|
| 3375 | xConfirmPara( m_colourRemapSEIPostLutTargetValue[c][i] < 0 || m_colourRemapSEIPostLutTargetValue[c][i] > ((1<<m_colourRemapSEIBitDepth)-1), "post_lut_target_value[c][i] shall be in the range of 0 to (1<<colour_remap_bit_depth)-1, inclusive"); |
---|
| 3376 | } |
---|
| 3377 | } |
---|
| 3378 | if ( m_colourRemapSEIMatrixPresentFlag ) |
---|
| 3379 | { |
---|
| 3380 | xConfirmPara( m_colourRemapSEILog2MatrixDenom < 0 || m_colourRemapSEILog2MatrixDenom > 15, "log2_matrix_denom shall be in the range of 0 to 15, inclusive"); |
---|
| 3381 | for( Int c=0 ; c<3 ; c++) |
---|
| 3382 | for( Int i=0 ; i<3 ; i++) |
---|
| 3383 | xConfirmPara( m_colourRemapSEICoeffs[c][i] < -32768 || m_colourRemapSEICoeffs[c][i] > 32767, "colour_remap_coeffs[c][i] shall be in the range of -32768 and 32767, inclusive"); |
---|
| 3384 | } |
---|
| 3385 | } |
---|
| 3386 | #endif |
---|
| 3387 | #endif |
---|
[313] | 3388 | |
---|
| 3389 | #if RC_SHVC_HARMONIZATION |
---|
| 3390 | for ( Int layer=0; layer<m_numLayers; layer++ ) |
---|
| 3391 | { |
---|
| 3392 | if ( m_acLayerCfg[layer].m_RCEnableRateControl ) |
---|
| 3393 | { |
---|
| 3394 | if ( m_acLayerCfg[layer].m_RCForceIntraQP ) |
---|
| 3395 | { |
---|
| 3396 | if ( m_acLayerCfg[layer].m_RCInitialQP == 0 ) |
---|
| 3397 | { |
---|
| 3398 | printf( "\nInitial QP for rate control is not specified. Reset not to use force intra QP!" ); |
---|
| 3399 | m_acLayerCfg[layer].m_RCForceIntraQP = false; |
---|
| 3400 | } |
---|
| 3401 | } |
---|
| 3402 | } |
---|
| 3403 | xConfirmPara( m_uiDeltaQpRD > 0, "Rate control cannot be used together with slice level multiple-QP optimization!\n" ); |
---|
| 3404 | } |
---|
| 3405 | #else |
---|
| 3406 | if ( m_RCEnableRateControl ) |
---|
| 3407 | { |
---|
| 3408 | if ( m_RCForceIntraQP ) |
---|
| 3409 | { |
---|
| 3410 | if ( m_RCInitialQP == 0 ) |
---|
| 3411 | { |
---|
| 3412 | printf( "\nInitial QP for rate control is not specified. Reset not to use force intra QP!" ); |
---|
| 3413 | m_RCForceIntraQP = false; |
---|
| 3414 | } |
---|
| 3415 | } |
---|
| 3416 | xConfirmPara( m_uiDeltaQpRD > 0, "Rate control cannot be used together with slice level multiple-QP optimization!\n" ); |
---|
| 3417 | } |
---|
| 3418 | #endif |
---|
| 3419 | |
---|
[595] | 3420 | xConfirmPara(!m_TransquantBypassEnableFlag && m_CUTransquantBypassFlagForce, "CUTransquantBypassFlagForce cannot be 1 when TransquantBypassEnableFlag is 0"); |
---|
[313] | 3421 | |
---|
| 3422 | xConfirmPara(m_log2ParallelMergeLevel < 2, "Log2ParallelMergeLevel should be larger than or equal to 2"); |
---|
| 3423 | if (m_framePackingSEIEnabled) |
---|
| 3424 | { |
---|
| 3425 | xConfirmPara(m_framePackingSEIType < 3 || m_framePackingSEIType > 5 , "SEIFramePackingType must be in rage 3 to 5"); |
---|
| 3426 | } |
---|
[815] | 3427 | |
---|
| 3428 | #if SVC_EXTENSION |
---|
[313] | 3429 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
| 3430 | xConfirmPara( (m_acLayerCfg[0].m_numSamplePredRefLayers != 0) && (m_acLayerCfg[0].m_numSamplePredRefLayers != -1), "Layer 0 cannot have any reference layers" ); |
---|
| 3431 | // 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 |
---|
| 3432 | for(Int layer = 1; layer < MAX_LAYERS; layer++) |
---|
| 3433 | { |
---|
| 3434 | xConfirmPara(m_acLayerCfg[layer].m_numSamplePredRefLayers > layer, "Cannot reference more layers than before current layer"); |
---|
| 3435 | for(Int i = 0; i < m_acLayerCfg[layer].m_numSamplePredRefLayers; i++) |
---|
| 3436 | { |
---|
| 3437 | xConfirmPara(m_acLayerCfg[layer].m_samplePredRefLayerIds[i] > layer, "Cannot reference higher layers"); |
---|
| 3438 | xConfirmPara(m_acLayerCfg[layer].m_samplePredRefLayerIds[i] == layer, "Cannot reference the current layer itself"); |
---|
| 3439 | } |
---|
| 3440 | } |
---|
| 3441 | xConfirmPara( (m_acLayerCfg[0].m_numMotionPredRefLayers != 0) && (m_acLayerCfg[0].m_numMotionPredRefLayers != -1), "Layer 0 cannot have any reference layers" ); |
---|
| 3442 | // 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 |
---|
| 3443 | for(Int layer = 1; layer < MAX_LAYERS; layer++) |
---|
| 3444 | { |
---|
| 3445 | xConfirmPara(m_acLayerCfg[layer].m_numMotionPredRefLayers > layer, "Cannot reference more layers than before current layer"); |
---|
| 3446 | for(Int i = 0; i < m_acLayerCfg[layer].m_numMotionPredRefLayers; i++) |
---|
| 3447 | { |
---|
| 3448 | xConfirmPara(m_acLayerCfg[layer].m_motionPredRefLayerIds[i] > layer, "Cannot reference higher layers"); |
---|
| 3449 | xConfirmPara(m_acLayerCfg[layer].m_motionPredRefLayerIds[i] == layer, "Cannot reference the current layer itself"); |
---|
| 3450 | } |
---|
| 3451 | } |
---|
[588] | 3452 | |
---|
[313] | 3453 | xConfirmPara( (m_acLayerCfg[0].m_numActiveRefLayers != 0) && (m_acLayerCfg[0].m_numActiveRefLayers != -1), "Layer 0 cannot have any active reference layers" ); |
---|
| 3454 | // 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 |
---|
| 3455 | for(Int layer = 1; layer < MAX_LAYERS; layer++) |
---|
| 3456 | { |
---|
| 3457 | Bool predEnabledFlag[MAX_LAYERS]; |
---|
| 3458 | for (Int refLayer = 0; refLayer < layer; refLayer++) |
---|
| 3459 | { |
---|
| 3460 | predEnabledFlag[refLayer] = false; |
---|
| 3461 | } |
---|
| 3462 | for(Int i = 0; i < m_acLayerCfg[layer].m_numSamplePredRefLayers; i++) |
---|
| 3463 | { |
---|
| 3464 | predEnabledFlag[m_acLayerCfg[layer].m_samplePredRefLayerIds[i]] = true; |
---|
| 3465 | } |
---|
| 3466 | for(Int i = 0; i < m_acLayerCfg[layer].m_numMotionPredRefLayers; i++) |
---|
| 3467 | { |
---|
| 3468 | predEnabledFlag[m_acLayerCfg[layer].m_motionPredRefLayerIds[i]] = true; |
---|
| 3469 | } |
---|
| 3470 | Int numDirectRefLayers = 0; |
---|
| 3471 | for (Int refLayer = 0; refLayer < layer; refLayer++) |
---|
| 3472 | { |
---|
| 3473 | if (predEnabledFlag[refLayer] == true) numDirectRefLayers++; |
---|
| 3474 | } |
---|
| 3475 | xConfirmPara(m_acLayerCfg[layer].m_numActiveRefLayers > numDirectRefLayers, "Cannot reference more layers than NumDirectRefLayers"); |
---|
| 3476 | for(Int i = 0; i < m_acLayerCfg[layer].m_numActiveRefLayers; i++) |
---|
| 3477 | { |
---|
| 3478 | xConfirmPara(m_acLayerCfg[layer].m_predLayerIds[i] >= numDirectRefLayers, "Cannot reference higher layers"); |
---|
| 3479 | } |
---|
| 3480 | } |
---|
[588] | 3481 | #endif //VPS_EXTN_DIRECT_REF_LAYERS |
---|
[313] | 3482 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
| 3483 | if (m_adaptiveResolutionChange > 0) |
---|
| 3484 | { |
---|
| 3485 | xConfirmPara(m_numLayers != 2, "Adaptive resolution change works with 2 layers only"); |
---|
| 3486 | 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"); |
---|
| 3487 | } |
---|
| 3488 | #endif |
---|
[540] | 3489 | #if HIGHER_LAYER_IRAP_SKIP_FLAG |
---|
| 3490 | if (m_adaptiveResolutionChange > 0) |
---|
| 3491 | { |
---|
| 3492 | xConfirmPara(m_crossLayerIrapAlignFlag != 0, "Cross layer IRAP alignment must be disabled when using adaptive resolution change."); |
---|
| 3493 | } |
---|
| 3494 | if (m_skipPictureAtArcSwitch) |
---|
| 3495 | { |
---|
| 3496 | xConfirmPara(m_adaptiveResolutionChange <= 0, "Skip picture at ARC switching only works when Adaptive Resolution Change is active (AdaptiveResolutionChange > 0)"); |
---|
| 3497 | } |
---|
| 3498 | #endif |
---|
[442] | 3499 | for (UInt layer=0; layer < MAX_LAYERS-1; layer++) |
---|
| 3500 | { |
---|
| 3501 | xConfirmPara(m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1 < 0 || m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1 > 7, "MaxTidIlRefPicsPlus1 must be in range 0 to 7"); |
---|
| 3502 | } |
---|
[494] | 3503 | #if AUXILIARY_PICTURES |
---|
| 3504 | for (UInt layer=0; layer < MAX_LAYERS-1; layer++) |
---|
| 3505 | { |
---|
| 3506 | xConfirmPara(m_acLayerCfg[layer].m_auxId < 0 || m_acLayerCfg[layer].m_auxId > 4, "AuxId must be in range 0 to 4"); |
---|
| 3507 | xConfirmPara(m_acLayerCfg[layer].m_auxId > 0 && m_acLayerCfg[layer].m_chromaFormatIDC != CHROMA_400, "Auxiliary picture must be monochrome picture"); |
---|
| 3508 | } |
---|
| 3509 | #endif |
---|
[713] | 3510 | #if Q0048_CGS_3D_ASYMLUT |
---|
| 3511 | xConfirmPara( m_nCGSFlag < 0 || m_nCGSFlag > 1 , "0<=CGS<=1" ); |
---|
| 3512 | #endif |
---|
[815] | 3513 | #endif //SVC_EXTENSION |
---|
[313] | 3514 | #undef xConfirmPara |
---|
| 3515 | if (check_failed) |
---|
| 3516 | { |
---|
| 3517 | exit(EXIT_FAILURE); |
---|
| 3518 | } |
---|
| 3519 | } |
---|
| 3520 | |
---|
| 3521 | /** \todo use of global variables should be removed later |
---|
| 3522 | */ |
---|
[494] | 3523 | #if LAYER_CTB |
---|
| 3524 | Void TAppEncCfg::xSetGlobal(UInt layerId) |
---|
| 3525 | { |
---|
| 3526 | // set max CU width & height |
---|
| 3527 | g_auiLayerMaxCUWidth[layerId] = m_acLayerCfg[layerId].m_uiMaxCUWidth; |
---|
| 3528 | g_auiLayerMaxCUHeight[layerId] = m_acLayerCfg[layerId].m_uiMaxCUHeight; |
---|
| 3529 | |
---|
| 3530 | // compute actual CU depth with respect to config depth and max transform size |
---|
| 3531 | g_auiLayerAddCUDepth[layerId] = 0; |
---|
| 3532 | while( (m_acLayerCfg[layerId].m_uiMaxCUWidth>>m_acLayerCfg[layerId].m_uiMaxCUDepth) > ( 1 << ( m_acLayerCfg[layerId].m_uiQuadtreeTULog2MinSize + g_auiLayerAddCUDepth[layerId] ) ) ) g_auiLayerAddCUDepth[layerId]++; |
---|
| 3533 | |
---|
| 3534 | m_acLayerCfg[layerId].m_uiMaxCUDepth += g_auiLayerAddCUDepth[layerId]; |
---|
| 3535 | g_auiLayerAddCUDepth[layerId]++; |
---|
| 3536 | g_auiLayerMaxCUDepth[layerId] = m_acLayerCfg[layerId].m_uiMaxCUDepth; |
---|
| 3537 | |
---|
| 3538 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
| 3539 | // set internal bit-depth to constant value to make sure to be updated later |
---|
| 3540 | g_bitDepthY = -1; |
---|
| 3541 | g_bitDepthC = -1; |
---|
| 3542 | |
---|
| 3543 | g_uiPCMBitDepthLuma = -1; |
---|
| 3544 | g_uiPCMBitDepthChroma = -1; |
---|
| 3545 | #else |
---|
| 3546 | // set internal bit-depth and constants |
---|
| 3547 | g_bitDepthY = m_internalBitDepthY; |
---|
| 3548 | g_bitDepthC = m_internalBitDepthC; |
---|
| 3549 | |
---|
| 3550 | g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_inputBitDepthY : m_internalBitDepthY; |
---|
| 3551 | g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_inputBitDepthC : m_internalBitDepthC; |
---|
| 3552 | #endif |
---|
| 3553 | } |
---|
| 3554 | #else |
---|
[313] | 3555 | Void TAppEncCfg::xSetGlobal() |
---|
| 3556 | { |
---|
| 3557 | // set max CU width & height |
---|
| 3558 | g_uiMaxCUWidth = m_uiMaxCUWidth; |
---|
| 3559 | g_uiMaxCUHeight = m_uiMaxCUHeight; |
---|
| 3560 | |
---|
| 3561 | // compute actual CU depth with respect to config depth and max transform size |
---|
| 3562 | g_uiAddCUDepth = 0; |
---|
| 3563 | while( (m_uiMaxCUWidth>>m_uiMaxCUDepth) > ( 1 << ( m_uiQuadtreeTULog2MinSize + g_uiAddCUDepth ) ) ) g_uiAddCUDepth++; |
---|
| 3564 | |
---|
| 3565 | m_uiMaxCUDepth += g_uiAddCUDepth; |
---|
| 3566 | g_uiAddCUDepth++; |
---|
| 3567 | g_uiMaxCUDepth = m_uiMaxCUDepth; |
---|
| 3568 | |
---|
[494] | 3569 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
| 3570 | // set internal bit-depth to constant value to make sure to be updated later |
---|
| 3571 | g_bitDepthY = -1; |
---|
| 3572 | g_bitDepthC = -1; |
---|
| 3573 | |
---|
| 3574 | g_uiPCMBitDepthLuma = -1; |
---|
| 3575 | g_uiPCMBitDepthChroma = -1; |
---|
| 3576 | #else |
---|
[313] | 3577 | g_bitDepthY = m_internalBitDepthY; |
---|
| 3578 | g_bitDepthC = m_internalBitDepthC; |
---|
| 3579 | |
---|
| 3580 | g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_inputBitDepthY : m_internalBitDepthY; |
---|
| 3581 | g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_inputBitDepthC : m_internalBitDepthC; |
---|
[494] | 3582 | #endif |
---|
[313] | 3583 | } |
---|
[494] | 3584 | #endif |
---|
[313] | 3585 | |
---|
| 3586 | Void TAppEncCfg::xPrintParameter() |
---|
| 3587 | { |
---|
| 3588 | printf("\n"); |
---|
| 3589 | #if SVC_EXTENSION |
---|
| 3590 | printf("Total number of layers : %d\n", m_numLayers ); |
---|
[815] | 3591 | printf("Multiview : %d\n", m_scalabilityMask[VIEW_ORDER_INDEX] ); |
---|
| 3592 | printf("Scalable : %d\n", m_scalabilityMask[SCALABILITY_ID] ); |
---|
[540] | 3593 | #if AVC_BASE |
---|
[906] | 3594 | #if VPS_AVC_BL_FLAG_REMOVAL |
---|
| 3595 | printf("Base layer : %s\n", m_nonHEVCBaseLayerFlag ? "Non-HEVC" : "HEVC"); |
---|
| 3596 | #else |
---|
[540] | 3597 | printf("Base layer : %s\n", m_avcBaseLayerFlag ? "AVC" : "HEVC"); |
---|
| 3598 | #endif |
---|
[906] | 3599 | #endif |
---|
[494] | 3600 | #if AUXILIARY_PICTURES |
---|
[815] | 3601 | printf("Auxiliary pictures : %d\n", m_scalabilityMask[AUX_ID] ); |
---|
[494] | 3602 | #endif |
---|
[313] | 3603 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
| 3604 | printf("Adaptive Resolution Change : %d\n", m_adaptiveResolutionChange ); |
---|
| 3605 | #endif |
---|
[540] | 3606 | #if HIGHER_LAYER_IRAP_SKIP_FLAG |
---|
| 3607 | printf("Skip picture at ARC switch : %d\n", m_skipPictureAtArcSwitch ); |
---|
| 3608 | #endif |
---|
| 3609 | #if O0223_PICTURE_TYPES_ALIGN_FLAG |
---|
| 3610 | printf("Align picture type : %d\n", m_crossLayerPictureTypeAlignFlag ); |
---|
| 3611 | #endif |
---|
| 3612 | printf("Cross layer IRAP alignment : %d\n", m_crossLayerIrapAlignFlag ); |
---|
[644] | 3613 | #if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG |
---|
| 3614 | printf("IDR only for IRAP : %d\n", m_crossLayerAlignedIdrOnlyFlag ); |
---|
| 3615 | #endif |
---|
[588] | 3616 | #if O0194_WEIGHTED_PREDICTION_CGS |
---|
| 3617 | printf("InterLayerWeightedPred : %d\n", m_useInterLayerWeightedPred ); |
---|
| 3618 | #endif |
---|
[313] | 3619 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
| 3620 | { |
---|
| 3621 | printf("=== Layer %d settings === \n", layer); |
---|
| 3622 | m_acLayerCfg[layer].xPrintParameter(); |
---|
| 3623 | printf("\n"); |
---|
| 3624 | } |
---|
| 3625 | printf("=== Common configuration settings === \n"); |
---|
| 3626 | printf("Bitstream File : %s\n", m_pBitstreamFile ); |
---|
[906] | 3627 | #else //SVC_EXTENSION |
---|
[313] | 3628 | printf("Input File : %s\n", m_pchInputFile ); |
---|
| 3629 | printf("Bitstream File : %s\n", m_pchBitstreamFile ); |
---|
| 3630 | printf("Reconstruction File : %s\n", m_pchReconFile ); |
---|
[906] | 3631 | printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_confWinLeft - m_confWinRight, m_iSourceHeight - m_confWinTop - m_confWinBottom, m_iFrameRate ); |
---|
[313] | 3632 | printf("Internal Format : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate ); |
---|
[906] | 3633 | #endif //SVC_EXTENSION |
---|
[442] | 3634 | if (m_isField) |
---|
| 3635 | { |
---|
| 3636 | printf("Frame/Field : Field based coding\n"); |
---|
| 3637 | printf("Field index : %u - %d (%d fields)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded ); |
---|
| 3638 | if (m_isTopFieldFirst) |
---|
| 3639 | { |
---|
| 3640 | printf("Field Order : Top field first\n"); |
---|
| 3641 | } |
---|
| 3642 | else |
---|
| 3643 | { |
---|
| 3644 | printf("Field Order : Bottom field first\n"); |
---|
| 3645 | } |
---|
| 3646 | } |
---|
| 3647 | else |
---|
| 3648 | { |
---|
| 3649 | printf("Frame/Field : Frame based coding\n"); |
---|
| 3650 | printf("Frame index : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded ); |
---|
| 3651 | } |
---|
[494] | 3652 | #if !LAYER_CTB |
---|
[313] | 3653 | printf("CU size / depth : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth ); |
---|
| 3654 | printf("RQT trans. size (min / max) : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize ); |
---|
| 3655 | printf("Max RQT depth inter : %d\n", m_uiQuadtreeTUMaxDepthInter); |
---|
| 3656 | printf("Max RQT depth intra : %d\n", m_uiQuadtreeTUMaxDepthIntra); |
---|
[494] | 3657 | #endif |
---|
[313] | 3658 | printf("Min PCM size : %d\n", 1 << m_uiPCMLog2MinSize); |
---|
| 3659 | printf("Motion search range : %d\n", m_iSearchRange ); |
---|
| 3660 | #if !SVC_EXTENSION |
---|
| 3661 | printf("Intra period : %d\n", m_iIntraPeriod ); |
---|
| 3662 | #endif |
---|
| 3663 | printf("Decoding refresh type : %d\n", m_iDecodingRefreshType ); |
---|
| 3664 | #if !SVC_EXTENSION |
---|
| 3665 | printf("QP : %5.2f\n", m_fQP ); |
---|
| 3666 | #endif |
---|
| 3667 | printf("Max dQP signaling depth : %d\n", m_iMaxCuDQPDepth); |
---|
| 3668 | |
---|
| 3669 | printf("Cb QP Offset : %d\n", m_cbQpOffset ); |
---|
| 3670 | printf("Cr QP Offset : %d\n", m_crQpOffset); |
---|
| 3671 | |
---|
| 3672 | printf("QP adaptation : %d (range=%d)\n", m_bUseAdaptiveQP, (m_bUseAdaptiveQP ? m_iQPAdaptationRange : 0) ); |
---|
| 3673 | printf("GOP size : %d\n", m_iGOPSize ); |
---|
[494] | 3674 | #if !O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
[313] | 3675 | printf("Internal bit depth : (Y:%d, C:%d)\n", m_internalBitDepthY, m_internalBitDepthC ); |
---|
| 3676 | printf("PCM sample bit depth : (Y:%d, C:%d)\n", g_uiPCMBitDepthLuma, g_uiPCMBitDepthChroma ); |
---|
[494] | 3677 | #endif |
---|
| 3678 | #if O0215_PHASE_ALIGNMENT |
---|
[540] | 3679 | printf("Cross-layer sample alignment : %d\n", m_phaseAlignFlag); |
---|
[494] | 3680 | #endif |
---|
[313] | 3681 | #if !RC_SHVC_HARMONIZATION |
---|
| 3682 | printf("RateControl : %d\n", m_RCEnableRateControl ); |
---|
| 3683 | if(m_RCEnableRateControl) |
---|
| 3684 | { |
---|
| 3685 | printf("TargetBitrate : %d\n", m_RCTargetBitrate ); |
---|
| 3686 | printf("KeepHierarchicalBit : %d\n", m_RCKeepHierarchicalBit ); |
---|
| 3687 | printf("LCULevelRC : %d\n", m_RCLCULevelRC ); |
---|
| 3688 | printf("UseLCUSeparateModel : %d\n", m_RCUseLCUSeparateModel ); |
---|
| 3689 | printf("InitialQP : %d\n", m_RCInitialQP ); |
---|
| 3690 | printf("ForceIntraQP : %d\n", m_RCForceIntraQP ); |
---|
| 3691 | } |
---|
| 3692 | #endif |
---|
[540] | 3693 | |
---|
[313] | 3694 | printf("Max Num Merge Candidates : %d\n", m_maxNumMergeCand); |
---|
| 3695 | printf("\n"); |
---|
| 3696 | |
---|
| 3697 | printf("TOOL CFG: "); |
---|
[494] | 3698 | #if !O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
[313] | 3699 | printf("IBD:%d ", g_bitDepthY > m_inputBitDepthY || g_bitDepthC > m_inputBitDepthC); |
---|
[494] | 3700 | #endif |
---|
[313] | 3701 | printf("HAD:%d ", m_bUseHADME ); |
---|
| 3702 | printf("RDQ:%d ", m_useRDOQ ); |
---|
| 3703 | printf("RDQTS:%d ", m_useRDOQTS ); |
---|
| 3704 | printf("RDpenalty:%d ", m_rdPenalty ); |
---|
| 3705 | printf("SQP:%d ", m_uiDeltaQpRD ); |
---|
| 3706 | printf("ASR:%d ", m_bUseASR ); |
---|
| 3707 | printf("FEN:%d ", m_bUseFastEnc ); |
---|
| 3708 | printf("ECU:%d ", m_bUseEarlyCU ); |
---|
| 3709 | printf("FDM:%d ", m_useFastDecisionForMerge ); |
---|
| 3710 | printf("CFM:%d ", m_bUseCbfFastMode ); |
---|
| 3711 | printf("ESD:%d ", m_useEarlySkipDetection ); |
---|
| 3712 | #if FAST_INTRA_SHVC |
---|
| 3713 | printf("FIS:%d ", m_useFastIntraScalable ); |
---|
| 3714 | #endif |
---|
| 3715 | printf("RQT:%d ", 1 ); |
---|
| 3716 | printf("TransformSkip:%d ", m_useTransformSkip ); |
---|
| 3717 | printf("TransformSkipFast:%d ", m_useTransformSkipFast ); |
---|
| 3718 | printf("Slice: M=%d ", m_sliceMode); |
---|
| 3719 | if (m_sliceMode!=0) |
---|
| 3720 | { |
---|
| 3721 | printf("A=%d ", m_sliceArgument); |
---|
| 3722 | } |
---|
| 3723 | printf("SliceSegment: M=%d ",m_sliceSegmentMode); |
---|
| 3724 | if (m_sliceSegmentMode!=0) |
---|
| 3725 | { |
---|
| 3726 | printf("A=%d ", m_sliceSegmentArgument); |
---|
| 3727 | } |
---|
| 3728 | printf("CIP:%d ", m_bUseConstrainedIntraPred); |
---|
| 3729 | printf("SAO:%d ", (m_bUseSAO)?(1):(0)); |
---|
[494] | 3730 | #if !LAYER_CTB |
---|
[313] | 3731 | printf("PCM:%d ", (m_usePCM && (1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0); |
---|
[494] | 3732 | #endif |
---|
[595] | 3733 | if (m_TransquantBypassEnableFlag && m_CUTransquantBypassFlagForce) |
---|
| 3734 | { |
---|
| 3735 | printf("TransQuantBypassEnabled: =1 "); |
---|
| 3736 | } |
---|
| 3737 | else |
---|
| 3738 | { |
---|
| 3739 | printf("TransQuantBypassEnabled:%d ", (m_TransquantBypassEnableFlag)? 1:0 ); |
---|
| 3740 | } |
---|
[313] | 3741 | printf("WPP:%d ", (Int)m_useWeightedPred); |
---|
| 3742 | printf("WPB:%d ", (Int)m_useWeightedBiPred); |
---|
| 3743 | printf("PME:%d ", m_log2ParallelMergeLevel); |
---|
| 3744 | #if !SVC_EXTENSION |
---|
| 3745 | printf(" WaveFrontSynchro:%d WaveFrontSubstreams:%d", |
---|
| 3746 | m_iWaveFrontSynchro, m_iWaveFrontSubstreams); |
---|
| 3747 | #endif |
---|
| 3748 | printf(" ScalingList:%d ", m_useScalingListId ); |
---|
| 3749 | printf("TMVPMode:%d ", m_TMVPModeId ); |
---|
| 3750 | #if ADAPTIVE_QP_SELECTION |
---|
| 3751 | printf("AQpS:%d", m_bUseAdaptQpSelect ); |
---|
| 3752 | #endif |
---|
| 3753 | |
---|
| 3754 | printf(" SignBitHidingFlag:%d ", m_signHideFlag); |
---|
| 3755 | #if SVC_EXTENSION |
---|
| 3756 | printf("RecalQP:%d ", m_recalculateQPAccordingToLambda ? 1 : 0 ); |
---|
| 3757 | printf("EL_RAP_SliceType: %d ", m_elRapSliceBEnabled); |
---|
| 3758 | printf("REF_IDX_ME_ZEROMV: %d ", REF_IDX_ME_ZEROMV); |
---|
| 3759 | printf("ENCODER_FAST_MODE: %d ", ENCODER_FAST_MODE); |
---|
| 3760 | printf("REF_IDX_MFM: %d ", REF_IDX_MFM); |
---|
[547] | 3761 | printf("O0194_DIFFERENT_BITDEPTH_EL_BL: %d ", O0194_DIFFERENT_BITDEPTH_EL_BL); |
---|
| 3762 | printf("O0194_JOINT_US_BITSHIFT: %d ", O0194_JOINT_US_BITSHIFT); |
---|
[313] | 3763 | #else |
---|
| 3764 | printf("RecalQP:%d", m_recalculateQPAccordingToLambda ? 1 : 0 ); |
---|
| 3765 | #endif |
---|
[713] | 3766 | #if Q0048_CGS_3D_ASYMLUT |
---|
| 3767 | printf("CGS: %d CGSMaxOctantDepth: %d CGSMaxYPartNumLog2: %d CGSLUTBit:%d " , m_nCGSFlag , m_nCGSMaxOctantDepth , m_nCGSMaxYPartNumLog2 , m_nCGSLUTBit ); |
---|
| 3768 | #endif |
---|
[906] | 3769 | #if R0151_CGS_3D_ASYMLUT_IMPROVE |
---|
| 3770 | printf("CGSAdaptC:%d " , m_nCGSAdaptiveChroma ); |
---|
| 3771 | #endif |
---|
| 3772 | #if R0179_ENC_OPT_3DLUT_SIZE |
---|
| 3773 | printf("CGSSizeRDO:%d " , m_nCGSLutSizeRDO ); |
---|
| 3774 | #endif |
---|
| 3775 | |
---|
[313] | 3776 | printf("\n\n"); |
---|
| 3777 | |
---|
| 3778 | fflush(stdout); |
---|
| 3779 | } |
---|
| 3780 | |
---|
| 3781 | Bool confirmPara(Bool bflag, const Char* message) |
---|
| 3782 | { |
---|
| 3783 | if (!bflag) |
---|
| 3784 | return false; |
---|
| 3785 | |
---|
| 3786 | printf("Error: %s\n",message); |
---|
| 3787 | return true; |
---|
| 3788 | } |
---|
| 3789 | |
---|
[494] | 3790 | #if SVC_EXTENSION |
---|
[906] | 3791 | #if OUTPUT_LAYER_SETS_CONFIG |
---|
| 3792 | Void TAppEncCfg::cfgStringToArray(Int **arr, string const cfgString, Int const numEntries, const char* logString) |
---|
| 3793 | #else |
---|
[313] | 3794 | Void TAppEncCfg::cfgStringToArray(Int **arr, string cfgString, Int numEntries, const char* logString) |
---|
[906] | 3795 | #endif |
---|
[313] | 3796 | { |
---|
| 3797 | Char *tempChar = cfgString.empty() ? NULL : strdup(cfgString.c_str()); |
---|
| 3798 | if( numEntries > 0 ) |
---|
| 3799 | { |
---|
| 3800 | Char *arrayEntry; |
---|
| 3801 | Int i = 0; |
---|
| 3802 | *arr = new Int[numEntries]; |
---|
| 3803 | |
---|
[906] | 3804 | #if OUTPUT_LAYER_SETS_CONFIG |
---|
| 3805 | if( tempChar == NULL ) |
---|
| 3806 | { |
---|
| 3807 | arrayEntry = NULL; |
---|
| 3808 | } |
---|
| 3809 | else |
---|
| 3810 | { |
---|
| 3811 | arrayEntry = strtok( tempChar, " ,"); |
---|
| 3812 | } |
---|
| 3813 | #else |
---|
[313] | 3814 | arrayEntry = strtok( tempChar, " ,"); |
---|
[906] | 3815 | #endif |
---|
[313] | 3816 | while(arrayEntry != NULL) |
---|
| 3817 | { |
---|
| 3818 | if( i >= numEntries ) |
---|
| 3819 | { |
---|
| 3820 | printf( "%s: The number of entries specified is larger than the allowed number.\n", logString ); |
---|
| 3821 | exit( EXIT_FAILURE ); |
---|
| 3822 | } |
---|
| 3823 | *( *arr + i ) = atoi( arrayEntry ); |
---|
| 3824 | arrayEntry = strtok(NULL, " ,"); |
---|
| 3825 | i++; |
---|
| 3826 | } |
---|
| 3827 | if( i < numEntries ) |
---|
| 3828 | { |
---|
| 3829 | printf( "%s: Some entries are not specified.\n", logString ); |
---|
| 3830 | exit( EXIT_FAILURE ); |
---|
| 3831 | } |
---|
| 3832 | } |
---|
| 3833 | else |
---|
| 3834 | { |
---|
| 3835 | *arr = NULL; |
---|
| 3836 | } |
---|
[906] | 3837 | |
---|
| 3838 | if( tempChar ) |
---|
| 3839 | { |
---|
| 3840 | free( tempChar ); |
---|
| 3841 | tempChar = NULL; |
---|
| 3842 | } |
---|
[313] | 3843 | } |
---|
[345] | 3844 | |
---|
[906] | 3845 | #if OUTPUT_LAYER_SETS_CONFIG |
---|
| 3846 | Bool TAppEncCfg::scanStringToArray(string const cfgString, Int const numEntries, const char* logString, Int * const returnArray) |
---|
| 3847 | { |
---|
| 3848 | Int *tempArray = NULL; |
---|
| 3849 | // For all layer sets |
---|
| 3850 | cfgStringToArray( &tempArray, cfgString, numEntries, logString ); |
---|
| 3851 | if(tempArray) |
---|
| 3852 | { |
---|
| 3853 | for(Int i = 0; i < numEntries; i++) |
---|
| 3854 | { |
---|
| 3855 | returnArray[i] = tempArray[i]; |
---|
| 3856 | } |
---|
| 3857 | delete [] tempArray; tempArray = NULL; |
---|
| 3858 | return true; |
---|
| 3859 | } |
---|
| 3860 | return false; |
---|
| 3861 | } |
---|
| 3862 | Bool TAppEncCfg::scanStringToArray(string const cfgString, Int const numEntries, const char* logString, std::vector<Int> & returnVector) |
---|
| 3863 | { |
---|
| 3864 | Int *tempArray = NULL; |
---|
| 3865 | // For all layer sets |
---|
| 3866 | cfgStringToArray( &tempArray, cfgString, numEntries, logString ); |
---|
| 3867 | if(tempArray) |
---|
| 3868 | { |
---|
| 3869 | returnVector.empty(); |
---|
| 3870 | for(Int i = 0; i < numEntries; i++) |
---|
| 3871 | { |
---|
| 3872 | returnVector.push_back(tempArray[i]); |
---|
| 3873 | } |
---|
| 3874 | delete [] tempArray; tempArray = NULL; |
---|
| 3875 | return true; |
---|
| 3876 | } |
---|
| 3877 | return false; |
---|
| 3878 | } |
---|
| 3879 | #endif |
---|
[494] | 3880 | #endif //SVC_EXTENSION |
---|
[313] | 3881 | //! \} |
---|