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