Changeset 1029 in SHVCSoftware for branches/SHM-dev/source/App/TAppEncoder


Ignore:
Timestamp:
26 Feb 2015, 00:21:54 (10 years ago)
Author:
seregin
Message:

merge with SHM-upgrade branch

Location:
branches/SHM-dev
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev

  • branches/SHM-dev/source

  • branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.cpp

    r1005 r1029  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license. 
     4 * granted under this license.
    55 *
    66 * Copyright (c) 2010-2014, ITU/ISO/IEC
     
    4040#include <cstring>
    4141#include <string>
     42#include <limits>
    4243#include "TLibCommon/TComRom.h"
    4344#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 
    4945#include "TAppCommon/program_options_lite.h"
    5046#include "TLibEncoder/TEncRateCtrl.h"
     
    5349#endif
    5450
     51#define MACRO_TO_STRING_HELPER(val) #val
     52#define MACRO_TO_STRING(val) MACRO_TO_STRING_HELPER(val)
     53
    5554using namespace std;
    5655namespace po = df::program_options_lite;
     56
     57
     58
     59enum ExtendedProfileName // this is used for determining profile strings, where multiple profiles map to a single profile idc with various constraint flag combinations
     60{
     61  NONE = 0,
     62  MAIN = 1,
     63  MAIN10 = 2,
     64  MAINSTILLPICTURE = 3,
     65  MAINREXT = 4,
     66  HIGHTHROUGHPUTREXT = 5, // Placeholder profile for development
     67#if MULTIPLE_PTL_SUPPORT
     68  MULTIVIEWMAIN = 6,
     69  SCALABLEMAIN = 7,
     70  SCALABLEMAIN10 = 8,
     71#endif
     72  // The following are RExt profiles, which would map to the MAINREXT profile idc.
     73  // The enumeration indicates the bit-depth constraint in the bottom 2 digits
     74  //                           the chroma format in the next digit
     75  //                           the intra constraint in the top digit
     76  MONOCHROME_8      = 1008,
     77  MONOCHROME_12     = 1012,
     78  MONOCHROME_16     = 1016,
     79  MAIN_12           = 1112,
     80  MAIN_422_10       = 1210,
     81  MAIN_422_12       = 1212,
     82  MAIN_444          = 1308,
     83  MAIN_444_10       = 1310,
     84  MAIN_444_12       = 1312,
     85  MAIN_444_16       = 1316, // non-standard profile definition, used for development purposes
     86  MAIN_INTRA        = 2108,
     87  MAIN_10_INTRA     = 2110,
     88  MAIN_12_INTRA     = 2112,
     89  MAIN_422_10_INTRA = 2210,
     90  MAIN_422_12_INTRA = 2212,
     91  MAIN_444_INTRA    = 2308,
     92  MAIN_444_10_INTRA = 2310,
     93  MAIN_444_12_INTRA = 2312,
     94  MAIN_444_16_INTRA = 2316,
     95
     96};
     97
    5798
    5899//! \ingroup TAppEncoder
     
    78119, m_numOutputLayerSets          (-1)
    79120#endif
     121, m_inputColourSpaceConvert(IPCOLOURSPACE_UNCHANGED)
     122, m_snrInternalColourSpace(false)
     123, m_outputInternalColourSpace(false)
    80124, m_scalingListFile()
    81125, m_elRapSliceBEnabled(0)
     
    92136, m_pchBitstreamFile()
    93137, m_pchReconFile()
     138, m_inputColourSpaceConvert(IPCOLOURSPACE_UNCHANGED)
     139, m_snrInternalColourSpace(false)
     140, m_outputInternalColourSpace(false)
    94141, m_pchdQPFile()
    95142, m_scalingListFile()
     
    139186    m_targetPivotValue = NULL;
    140187  }
     188
    141189  free(m_pchInputFile);
    142190  free(m_pchBitstreamFile);
     
    242290}
    243291
    244 #if AUXILIARY_PICTURES
     292Bool confirmPara(Bool bflag, const Char* message);
     293
    245294static inline ChromaFormat numberToChromaFormat(const Int val)
    246295{
     
    254303  }
    255304}
    256 #endif
    257305
    258306#if SVC_EXTENSION
     
    282330#endif
    283331
    284 static const struct MapStrToProfile {
     332static const struct MapStrToProfile
     333{
    285334  const Char* str;
    286335  Profile::Name value;
    287 } strToProfile[] = {
    288   {"none", Profile::NONE},
    289   {"main", Profile::MAIN},
    290   {"main10", Profile::MAIN10},
    291   {"main-still-picture", Profile::MAINSTILLPICTURE},
     336}
     337strToProfile[] =
     338{
     339  {"none",                 Profile::NONE               },
     340  {"main",                 Profile::MAIN               },
     341  {"main10",               Profile::MAIN10             },
     342  {"main-still-picture",   Profile::MAINSTILLPICTURE   },
     343  {"main-RExt",            Profile::MAINREXT           },
     344  {"high-throughput-RExt", Profile::HIGHTHROUGHPUTREXT },
    292345#if MULTIPLE_PTL_SUPPORT
    293   {"range-extension", Profile::RANGEEXTENSION},       //This is not used in this software
    294   {"range-extension-high", Profile::RANGEEXTENSIONHIGH},       //This is not used in this software
    295   {"multiview-main", Profile::MULTIVIEWMAIN},       //This is not used in this software
    296   {"scalable-main", Profile::SCALABLEMAIN},
    297   {"scalable-main10", Profile::SCALABLEMAIN10},
     346  {"multiview-main",       Profile::MULTIVIEWMAIN      },       //This is not used in this software
     347  {"scalable-main",        Profile::SCALABLEMAIN       },
     348  {"scalable-main10",      Profile::SCALABLEMAIN10     },
    298349#endif
    299350};
    300351
    301 static const struct MapStrToTier {
     352static const struct MapStrToExtendedProfile
     353{
     354  const Char* str;
     355  ExtendedProfileName value;
     356}
     357strToExtendedProfile[] =
     358{
     359    {"none",               NONE             },
     360    {"main",               MAIN             },
     361    {"main10",             MAIN10           },
     362    {"main-still-picture", MAINSTILLPICTURE },
     363    {"main-RExt",          MAINREXT         },
     364    {"high-throughput-RExt", HIGHTHROUGHPUTREXT },
     365    {"monochrome",         MONOCHROME_8     },
     366    {"monochrome12",       MONOCHROME_12    },
     367    {"monochrome16",       MONOCHROME_16    },
     368    {"main12",             MAIN_12          },
     369    {"main_422_10",        MAIN_422_10      },
     370    {"main_422_12",        MAIN_422_12      },
     371    {"main_444",           MAIN_444         },
     372    {"main_444_10",        MAIN_444_10      },
     373    {"main_444_12",        MAIN_444_12      },
     374    {"main_444_16",        MAIN_444_16      },
     375    {"main_intra",         MAIN_INTRA       },
     376    {"main_10_intra",      MAIN_10_INTRA    },
     377    {"main_12_intra",      MAIN_12_INTRA    },
     378    {"main_422_10_intra",  MAIN_422_10_INTRA},
     379    {"main_422_12_intra",  MAIN_422_12_INTRA},
     380    {"main_444_intra",     MAIN_444_INTRA   },
     381    {"main_444_10_intra",  MAIN_444_10_INTRA},
     382    {"main_444_12_intra",  MAIN_444_12_INTRA},
     383    {"main_444_16_intra",  MAIN_444_16_INTRA},
     384#if MULTIPLE_PTL_SUPPORT
     385    {"multiview-main",     MULTIVIEWMAIN    },
     386    {"scalable-main",      SCALABLEMAIN     },
     387    {"scalable-main10",    SCALABLEMAIN10   },
     388#endif
     389};
     390
     391static const ExtendedProfileName validRExtProfileNames[2/* intraConstraintFlag*/][4/* bit depth constraint 8=0, 10=1, 12=2, 16=3*/][4/*chroma format*/]=
     392{
     393    {
     394        { MONOCHROME_8,  NONE,          NONE,              MAIN_444          }, // 8-bit  inter for 400, 420, 422 and 444
     395        { NONE,          NONE,          MAIN_422_10,       MAIN_444_10       }, // 10-bit inter for 400, 420, 422 and 444
     396        { MONOCHROME_12, MAIN_12,       MAIN_422_12,       MAIN_444_12       }, // 12-bit inter for 400, 420, 422 and 444
     397        { MONOCHROME_16, NONE,          NONE,              MAIN_444_16       }  // 16-bit inter for 400, 420, 422 and 444 (the latter is non standard used for development)
     398    },
     399    {
     400        { NONE,          MAIN_INTRA,    NONE,              MAIN_444_INTRA    }, // 8-bit  intra for 400, 420, 422 and 444
     401        { NONE,          MAIN_10_INTRA, MAIN_422_10_INTRA, MAIN_444_10_INTRA }, // 10-bit intra for 400, 420, 422 and 444
     402        { NONE,          MAIN_12_INTRA, MAIN_422_12_INTRA, MAIN_444_12_INTRA }, // 12-bit intra for 400, 420, 422 and 444
     403        { NONE,          NONE,          NONE,              MAIN_444_16_INTRA }  // 16-bit intra for 400, 420, 422 and 444
     404    }
     405};
     406
     407static const struct MapStrToTier
     408{
    302409  const Char* str;
    303410  Level::Tier value;
    304 } strToTier[] = {
     411}
     412strToTier[] =
     413{
    305414  {"main", Level::MAIN},
    306415  {"high", Level::HIGH},
    307416};
    308417
    309 static const struct MapStrToLevel {
     418static const struct MapStrToLevel
     419{
    310420  const Char* str;
    311421  Level::Name value;
    312 } strToLevel[] = {
     422}
     423strToLevel[] =
     424{
    313425  {"none",Level::NONE},
    314426  {"1",   Level::LEVEL1},
     
    325437  {"6.1", Level::LEVEL6_1},
    326438  {"6.2", Level::LEVEL6_2},
     439  {"8.5", Level::LEVEL8_5},
    327440};
    328441
     442static const struct MapStrToCostMode
     443{
     444  const Char* str;
     445  CostMode    value;
     446}
     447strToCostMode[] =
     448{
     449  {"lossy",                     COST_STANDARD_LOSSY},
     450  {"sequence_level_lossless",   COST_SEQUENCE_LEVEL_LOSSLESS},
     451  {"lossless",                  COST_LOSSLESS_CODING},
     452  {"mixed_lossless_lossy",      COST_MIXED_LOSSLESS_LOSSY_CODING}
     453};
     454
     455static const struct MapStrToScalingListMode
     456{
     457  const Char* str;
     458  ScalingListMode value;
     459}
     460strToScalingListMode[] =
     461{
     462  {"0",       SCALING_LIST_OFF},
     463  {"1",       SCALING_LIST_DEFAULT},
     464  {"2",       SCALING_LIST_FILE_READ},
     465  {"off",     SCALING_LIST_OFF},
     466  {"default", SCALING_LIST_DEFAULT},
     467  {"file",    SCALING_LIST_FILE_READ}
     468};
     469
    329470template<typename T, typename P>
    330 static istream& readStrToEnum(P map[], unsigned long mapLen, istream &in, T &val)
     471static std::string enumToString(P map[], UInt mapLen, const T val)
     472{
     473  for (UInt i = 0; i < mapLen; i++)
     474  {
     475    if (val == map[i].value)
     476    {
     477      return map[i].str;
     478    }
     479  }
     480  return std::string();
     481}
     482
     483template<typename T, typename P>
     484static istream& readStrToEnum(P map[], UInt mapLen, istream &in, T &val)
    331485{
    332486  string str;
    333487  in >> str;
    334488
    335   for (Int i = 0; i < mapLen; i++)
     489  for (UInt i = 0; i < mapLen; i++)
    336490  {
    337491    if (str == map[i].str)
     
    347501}
    348502
    349 static istream& operator>>(istream &in, Profile::Name &profile)
     503//inline to prevent compiler warnings for "unused static function"
     504
     505static inline istream& operator >> (istream &in, ExtendedProfileName &profile)
    350506{
    351   return readStrToEnum(strToProfile, sizeof(strToProfile)/sizeof(*strToProfile), in, profile);
     507  return readStrToEnum(strToExtendedProfile, sizeof(strToExtendedProfile)/sizeof(*strToExtendedProfile), in, profile);
    352508}
    353509
    354 static istream& operator>>(istream &in, Level::Tier &tier)
     510namespace Level
    355511{
    356   return readStrToEnum(strToTier, sizeof(strToTier)/sizeof(*strToTier), in, tier);
     512  static inline istream& operator >> (istream &in, Tier &tier)
     513  {
     514    return readStrToEnum(strToTier, sizeof(strToTier)/sizeof(*strToTier), in, tier);
     515  }
     516
     517  static inline istream& operator >> (istream &in, Name &level)
     518  {
     519    return readStrToEnum(strToLevel, sizeof(strToLevel)/sizeof(*strToLevel), in, level);
     520  }
    357521}
    358522
    359 static istream& operator>>(istream &in, Level::Name &level)
     523static inline istream& operator >> (istream &in, CostMode &mode)
    360524{
    361   return readStrToEnum(strToLevel, sizeof(strToLevel)/sizeof(*strToLevel), in, level);
     525  return readStrToEnum(strToCostMode, sizeof(strToCostMode)/sizeof(*strToCostMode), in, mode);
    362526}
    363527
     528static inline istream& operator >> (istream &in, ScalingListMode &mode)
     529{
     530  return readStrToEnum(strToScalingListMode, sizeof(strToScalingListMode)/sizeof(*strToScalingListMode), in, mode);
     531}
     532
     533#if MULTIPLE_PTL_SUPPORT
     534namespace Profile
     535{
     536  static inline istream& operator >> (istream &in, Name &profile)
     537  {
     538    return readStrToEnum(strToProfile, sizeof(strToProfile)/sizeof(*strToProfile), in, profile);
     539  }
     540}
     541#endif
     542
     543template <class T>
     544struct SMultiValueInput
     545{
     546  const T              minValIncl;
     547  const T              maxValIncl; // Use 0 for unlimited
     548  const std::size_t    minNumValuesIncl;
     549  const std::size_t    maxNumValuesIncl; // Use 0 for unlimited
     550        std::vector<T> values;
     551  SMultiValueInput() : minValIncl(0), maxValIncl(0), minNumValuesIncl(0), maxNumValuesIncl(0), values() { }
     552  SMultiValueInput(std::vector<T> &defaults) : minValIncl(0), maxValIncl(0), minNumValuesIncl(0), maxNumValuesIncl(0), values(defaults) { }
     553  SMultiValueInput(const T &minValue, const T &maxValue, std::size_t minNumberValues=0, std::size_t maxNumberValues=0)
     554    : minValIncl(minValue), maxValIncl(maxValue), minNumValuesIncl(minNumberValues), maxNumValuesIncl(maxNumberValues), values()  { }
     555  SMultiValueInput(const T &minValue, const T &maxValue, std::size_t minNumberValues, std::size_t maxNumberValues, const T* defValues, const UInt numDefValues)
     556    : minValIncl(minValue), maxValIncl(maxValue), minNumValuesIncl(minNumberValues), maxNumValuesIncl(maxNumberValues), values(defValues, defValues+numDefValues)  { }
     557  SMultiValueInput<T> &operator=(const std::vector<T> &userValues) { values=userValues; return *this; }
     558  SMultiValueInput<T> &operator=(const SMultiValueInput<T> &userValues) { values=userValues.values; return *this; }
     559};
     560
     561static inline istream& operator >> (istream &in, SMultiValueInput<UInt> &values)
     562{
     563  values.values.clear();
     564  string str;
     565  in >> str;
     566  if (!str.empty())
     567  {
     568    const Char *pStr=str.c_str();
     569    // soak up any whitespace
     570    for(;isspace(*pStr);pStr++);
     571
     572    while (*pStr != 0)
     573    {
     574      Char *eptr;
     575      UInt val=strtoul(pStr, &eptr, 0);
     576      if (*eptr!=0 && !isspace(*eptr) && *eptr!=',')
     577      {
     578        in.setstate(ios::failbit);
     579        break;
     580      }
     581      if (val<values.minValIncl || val>values.maxValIncl)
     582      {
     583        in.setstate(ios::failbit);
     584        break;
     585      }
     586
     587      if (values.maxNumValuesIncl != 0 && values.values.size() >= values.maxNumValuesIncl)
     588      {
     589        in.setstate(ios::failbit);
     590        break;
     591      }
     592      values.values.push_back(val);
     593      // soak up any whitespace and up to 1 comma.
     594      pStr=eptr;
     595      for(;isspace(*pStr);pStr++);
     596      if (*pStr == ',') pStr++;
     597      for(;isspace(*pStr);pStr++);
     598    }
     599  }
     600  if (values.values.size() < values.minNumValuesIncl)
     601  {
     602    in.setstate(ios::failbit);
     603  }
     604  return in;
     605}
     606
     607static inline istream& operator >> (istream &in, SMultiValueInput<Int> &values)
     608{
     609  values.values.clear();
     610  string str;
     611  in >> str;
     612  if (!str.empty())
     613  {
     614    const Char *pStr=str.c_str();
     615    // soak up any whitespace
     616    for(;isspace(*pStr);pStr++);
     617
     618    while (*pStr != 0)
     619    {
     620      Char *eptr;
     621      Int val=strtol(pStr, &eptr, 0);
     622      if (*eptr!=0 && !isspace(*eptr) && *eptr!=',')
     623      {
     624        in.setstate(ios::failbit);
     625        break;
     626      }
     627      if (val<values.minValIncl || val>values.maxValIncl)
     628      {
     629        in.setstate(ios::failbit);
     630        break;
     631      }
     632
     633      if (values.maxNumValuesIncl != 0 && values.values.size() >= values.maxNumValuesIncl)
     634      {
     635        in.setstate(ios::failbit);
     636        break;
     637      }
     638      values.values.push_back(val);
     639      // soak up any whitespace and up to 1 comma.
     640      pStr=eptr;
     641      for(;isspace(*pStr);pStr++);
     642      if (*pStr == ',') pStr++;
     643      for(;isspace(*pStr);pStr++);
     644    }
     645  }
     646  if (values.values.size() < values.minNumValuesIncl)
     647  {
     648    in.setstate(ios::failbit);
     649  }
     650  return in;
     651}
     652
     653static inline istream& operator >> (istream &in, SMultiValueInput<Bool> &values)
     654{
     655  values.values.clear();
     656  string str;
     657  in >> str;
     658  if (!str.empty())
     659  {
     660    const Char *pStr=str.c_str();
     661    // soak up any whitespace
     662    for(;isspace(*pStr);pStr++);
     663
     664    while (*pStr != 0)
     665    {
     666      Char *eptr;
     667      Int val=strtol(pStr, &eptr, 0);
     668      if (*eptr!=0 && !isspace(*eptr) && *eptr!=',')
     669      {
     670        in.setstate(ios::failbit);
     671        break;
     672      }
     673      if (val<Int(values.minValIncl) || val>Int(values.maxValIncl))
     674      {
     675        in.setstate(ios::failbit);
     676        break;
     677      }
     678
     679      if (values.maxNumValuesIncl != 0 && values.values.size() >= values.maxNumValuesIncl)
     680      {
     681        in.setstate(ios::failbit);
     682        break;
     683      }
     684      values.values.push_back(val!=0);
     685      // soak up any whitespace and up to 1 comma.
     686      pStr=eptr;
     687      for(;isspace(*pStr);pStr++);
     688      if (*pStr == ',') pStr++;
     689      for(;isspace(*pStr);pStr++);
     690    }
     691  }
     692  if (values.values.size() < values.minNumValuesIncl)
     693  {
     694    in.setstate(ios::failbit);
     695  }
     696  return in;
     697}
     698
     699static Void
     700automaticallySelectRExtProfile(const Bool bUsingGeneralRExtTools,
     701                               const Bool bUsingChromaQPAdjustment,
     702                               const Bool bUsingExtendedPrecision,
     703                               const Bool bIntraConstraintFlag,
     704                               UInt &bitDepthConstraint,
     705                               ChromaFormat &chromaFormatConstraint,
     706                               const Int  maxBitDepth,
     707                               const ChromaFormat chromaFormat)
     708{
     709  // Try to choose profile, according to table in Q1013.
     710  UInt trialBitDepthConstraint=maxBitDepth;
     711  if (trialBitDepthConstraint<8) trialBitDepthConstraint=8;
     712  else if (trialBitDepthConstraint==9 || trialBitDepthConstraint==11) trialBitDepthConstraint++;
     713  else if (trialBitDepthConstraint>12) trialBitDepthConstraint=16;
     714
     715  // both format and bit depth constraints are unspecified
     716  if (bUsingExtendedPrecision || trialBitDepthConstraint==16)
     717  {
     718    bitDepthConstraint = 16;
     719    chromaFormatConstraint = (!bIntraConstraintFlag && chromaFormat==CHROMA_400) ? CHROMA_400 : CHROMA_444;
     720  }
     721  else if (bUsingGeneralRExtTools)
     722  {
     723    if (chromaFormat == CHROMA_400 && !bIntraConstraintFlag)
     724    {
     725      bitDepthConstraint = 16;
     726      chromaFormatConstraint = CHROMA_400;
     727    }
     728    else
     729    {
     730      bitDepthConstraint = trialBitDepthConstraint;
     731      chromaFormatConstraint = CHROMA_444;
     732    }
     733  }
     734  else if (chromaFormat == CHROMA_400)
     735  {
     736    if (bIntraConstraintFlag)
     737    {
     738      chromaFormatConstraint = CHROMA_420; // there is no intra 4:0:0 profile.
     739      bitDepthConstraint     = trialBitDepthConstraint;
     740    }
     741    else
     742    {
     743      chromaFormatConstraint = CHROMA_400;
     744      bitDepthConstraint     = trialBitDepthConstraint == 8 ? 8 : 12;
     745    }
     746  }
     747  else
     748  {
     749    bitDepthConstraint = trialBitDepthConstraint;
     750    chromaFormatConstraint = chromaFormat;
     751    if (bUsingChromaQPAdjustment && chromaFormat == CHROMA_420) chromaFormatConstraint = CHROMA_422; // 4:2:0 cannot use the chroma qp tool.
     752    if (chromaFormatConstraint == CHROMA_422 && bitDepthConstraint == 8) bitDepthConstraint = 10; // there is no 8-bit 4:2:2 profile.
     753    if (chromaFormatConstraint == CHROMA_420 && !bIntraConstraintFlag) bitDepthConstraint = 12; // there is no 8 or 10-bit 4:2:0 inter RExt profile.
     754  }
     755}
    364756// ====================================================================================================================
    365757// Public member functions
     
    387779  Int*    cfg_FrameRate     [MAX_LAYERS];
    388780  Int*    cfg_IntraPeriod   [MAX_LAYERS];
    389   Int*    cfg_conformanceMode[MAX_LAYERS];
    390781  Int*    cfg_confWinLeft   [MAX_LAYERS];
    391782  Int*    cfg_confWinRight  [MAX_LAYERS];
     
    394785  Int*    cfg_aiPadX        [MAX_LAYERS];
    395786  Int*    cfg_aiPadY        [MAX_LAYERS];
     787  Int*    cfg_conformanceMode  [MAX_LAYERS];
     788  Bool*   cfg_useExtendedPrecision [MAX_LAYERS];
    396789#if LAYER_CTB
    397790  // coding unit (CU) definition
     
    408801#endif
    409802#if AUXILIARY_PICTURES
    410   Int      cfg_tmpChromaFormatIDC  [MAX_LAYERS];
    411   Int      cfg_tmpInputChromaFormat[MAX_LAYERS];
    412803  Int*     cfg_auxId               [MAX_LAYERS];
    413804#endif
     
    487878#endif
    488879#if O0194_DIFFERENT_BITDEPTH_EL_BL
    489   Int*    cfg_InputBitDepthY    [MAX_LAYERS];
    490   Int*    cfg_InternalBitDepthY [MAX_LAYERS];
    491   Int*    cfg_InputBitDepthC    [MAX_LAYERS];
    492   Int*    cfg_InternalBitDepthC [MAX_LAYERS];
    493   Int*    cfg_OutputBitDepthY   [MAX_LAYERS];
    494   Int*    cfg_OutputBitDepthC   [MAX_LAYERS];
     880  Int*    cfg_InputBitDepth    [MAX_NUM_CHANNEL_TYPE][MAX_LAYERS];
     881  Int*    cfg_InternalBitDepth [MAX_NUM_CHANNEL_TYPE][MAX_LAYERS];
     882  Int*    cfg_OutputBitDepth   [MAX_NUM_CHANNEL_TYPE][MAX_LAYERS];
    495883#endif
    496884  Int*    cfg_maxTidIlRefPicsPlus1[MAX_LAYERS];
     
    499887#endif
    500888  Int*    cfg_waveFrontSynchro[MAX_LAYERS];
     889
    501890#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
    502891  Int*    cfg_layerSwitchOffBegin[MAX_LAYERS];
    503892  Int*    cfg_layerSwitchOffEnd[MAX_LAYERS];
     893#endif
     894
     895#if MULTIPLE_PTL_SUPPORT
     896  Bool    tmpIntraConstraintFlag;
     897  Bool    tmpLowerBitRateConstraintFlag;
     898  UInt    tmpBitDepthConstraint;
     899  Int*    cfg_layerPTLIdx[MAX_VPS_LAYER_ID_PLUS1];
    504900#endif
    505901
     
    515911    cfg_repFormatIdx[layer] = &m_acLayerCfg[layer].m_repFormatIdx;
    516912#endif
    517     cfg_SourceWidth[layer]  = &m_acLayerCfg[layer].m_iSourceWidth;
    518     cfg_SourceHeight[layer] = &m_acLayerCfg[layer].m_iSourceHeight;
    519     cfg_FrameRate[layer]    = &m_acLayerCfg[layer].m_iFrameRate;
    520     cfg_IntraPeriod[layer]  = &m_acLayerCfg[layer].m_iIntraPeriod;
    521     cfg_conformanceMode[layer] = &m_acLayerCfg[layer].m_conformanceMode;
    522     cfg_confWinLeft[layer]  = &m_acLayerCfg[layer].m_confWinLeft;
    523     cfg_confWinRight[layer] = &m_acLayerCfg[layer].m_confWinRight;
    524     cfg_confWinTop[layer]   = &m_acLayerCfg[layer].m_confWinTop;
    525     cfg_confWinBottom[layer]= &m_acLayerCfg[layer].m_confWinBottom;
    526     cfg_aiPadX[layer] = &m_acLayerCfg[layer].m_aiPad[0];
    527     cfg_aiPadY[layer] = &m_acLayerCfg[layer].m_aiPad[1];
     913    cfg_SourceWidth[layer]          = &m_acLayerCfg[layer].m_iSourceWidth;
     914    cfg_SourceHeight[layer]         = &m_acLayerCfg[layer].m_iSourceHeight;
     915    cfg_FrameRate[layer]            = &m_acLayerCfg[layer].m_iFrameRate;
     916    cfg_IntraPeriod[layer]          = &m_acLayerCfg[layer].m_iIntraPeriod;
     917    cfg_conformanceMode[layer]      = &m_acLayerCfg[layer].m_conformanceMode;
     918    cfg_confWinLeft[layer]          = &m_acLayerCfg[layer].m_confWinLeft;
     919    cfg_confWinRight[layer]         = &m_acLayerCfg[layer].m_confWinRight;
     920    cfg_confWinTop[layer]           = &m_acLayerCfg[layer].m_confWinTop;
     921    cfg_confWinBottom[layer]        = &m_acLayerCfg[layer].m_confWinBottom;
     922    cfg_aiPadX[layer]               = &m_acLayerCfg[layer].m_aiPad[0];
     923    cfg_aiPadY[layer]               = &m_acLayerCfg[layer].m_aiPad[1];
     924    cfg_useExtendedPrecision[layer] = &m_acLayerCfg[layer].m_useExtendedPrecision;
    528925#if LAYER_CTB
    529926    // coding unit (CU) definition
     
    587984#endif
    588985#if O0194_DIFFERENT_BITDEPTH_EL_BL
    589   cfg_InputBitDepthY   [layer] = &m_acLayerCfg[layer].m_inputBitDepthY;
    590   cfg_InternalBitDepthY[layer] = &m_acLayerCfg[layer].m_internalBitDepthY;
    591   cfg_InputBitDepthC   [layer] = &m_acLayerCfg[layer].m_inputBitDepthC;
    592   cfg_InternalBitDepthC[layer] = &m_acLayerCfg[layer].m_internalBitDepthC;
    593   cfg_OutputBitDepthY  [layer] = &m_acLayerCfg[layer].m_outputBitDepthY;
    594   cfg_OutputBitDepthC  [layer] = &m_acLayerCfg[layer].m_outputBitDepthC;
    595 #endif
    596   cfg_maxTidIlRefPicsPlus1[layer] = &m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1;
     986    cfg_InputBitDepth   [CHANNEL_TYPE_LUMA][layer] = &m_acLayerCfg[layer].m_inputBitDepth[CHANNEL_TYPE_LUMA];
     987    cfg_InternalBitDepth[CHANNEL_TYPE_LUMA][layer] = &m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA];
     988    cfg_OutputBitDepth  [CHANNEL_TYPE_LUMA][layer] = &m_acLayerCfg[layer].m_outputBitDepth[CHANNEL_TYPE_LUMA];
     989    cfg_InternalBitDepth[CHANNEL_TYPE_CHROMA][layer] = &m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
     990    cfg_InputBitDepth   [CHANNEL_TYPE_CHROMA][layer] = &m_acLayerCfg[layer].m_inputBitDepth[CHANNEL_TYPE_CHROMA];
     991    cfg_OutputBitDepth  [CHANNEL_TYPE_CHROMA][layer] = &m_acLayerCfg[layer].m_outputBitDepth[CHANNEL_TYPE_CHROMA];
     992#endif
     993    cfg_maxTidIlRefPicsPlus1[layer] = &m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1;
    597994#if AUXILIARY_PICTURES
    598995    cfg_auxId[layer]                = &m_acLayerCfg[layer].m_auxId;
     
    601998    cfg_layerSwitchOffBegin[layer] = &m_acLayerCfg[layer].m_layerSwitchOffBegin;
    602999    cfg_layerSwitchOffEnd[layer]   = &m_acLayerCfg[layer].m_layerSwitchOffEnd;
     1000#endif
     1001#if MULTIPLE_PTL_SUPPORT
     1002    cfg_layerPTLIdx[layer]          = &m_acLayerCfg[layer].m_layerPTLIdx;
    6031003#endif
    6041004  }
     
    6411041#endif
    6421042#endif //SVC_EXTENSION
    643   string cfgColumnWidth;
    644   string cfgRowHeight;
    6451043  string cfg_ScalingListFile;
    646   string cfg_startOfCodedInterval;
    647   string cfg_codedPivotValue;
    648   string cfg_targetPivotValue;
    649 #if P0050_KNEE_FUNCTION_SEI
    650   string cfg_kneeSEIInputKneePointValue;
    651   string cfg_kneeSEIOutputKneePointValue;
    652 #endif
     1044
     1045  Int tmpChromaFormat;
     1046  Int tmpInputChromaFormat;
     1047  Int tmpConstraintChromaFormat;
     1048  string inputColourSpaceConvert;
     1049#if MULTIPLE_PTL_SUPPORT
     1050  ExtendedProfileName extendedProfile[MAX_NUM_LAYER_IDS + 1];
     1051#else
     1052  ExtendedProfileName extendedProfile;
     1053#endif
     1054  Int saoOffsetBitShift[MAX_NUM_CHANNEL_TYPE];
     1055
     1056  // Multi-value input fields:                                // minval, maxval (incl), min_entries, max_entries (incl) [, default values, number of default values]
     1057  SMultiValueInput<UInt> cfg_ColumnWidth                     (0, std::numeric_limits<UInt>::max(), 0, std::numeric_limits<UInt>::max());
     1058  SMultiValueInput<UInt> cfg_RowHeight                       (0, std::numeric_limits<UInt>::max(), 0, std::numeric_limits<UInt>::max());
     1059  SMultiValueInput<Int>  cfg_startOfCodedInterval            (std::numeric_limits<Int>::min(), std::numeric_limits<Int>::max(), 0, 1<<16);
     1060  SMultiValueInput<Int>  cfg_codedPivotValue                 (std::numeric_limits<Int>::min(), std::numeric_limits<Int>::max(), 0, 1<<16);
     1061  SMultiValueInput<Int>  cfg_targetPivotValue                (std::numeric_limits<Int>::min(), std::numeric_limits<Int>::max(), 0, 1<<16);
     1062
     1063  const UInt defaultInputKneeCodes[3]  = { 600, 800, 900 };
     1064  const UInt defaultOutputKneeCodes[3] = { 100, 250, 450 };
     1065  SMultiValueInput<UInt> cfg_kneeSEIInputKneePointValue      (1,  999, 0, 999, defaultInputKneeCodes,  sizeof(defaultInputKneeCodes )/sizeof(UInt));
     1066  SMultiValueInput<UInt> cfg_kneeSEIOutputKneePointValue     (0, 1000, 0, 999, defaultOutputKneeCodes, sizeof(defaultOutputKneeCodes)/sizeof(UInt));
     1067  const Int defaultPrimaryCodes[6]     = { 0,50000, 0,0, 50000,0 };
     1068  const Int defaultWhitePointCode[2]   = { 16667, 16667 };
     1069  SMultiValueInput<Int>  cfg_DisplayPrimariesCode            (0, 50000, 3, 3, defaultPrimaryCodes,   sizeof(defaultPrimaryCodes  )/sizeof(Int));
     1070  SMultiValueInput<Int>  cfg_DisplayWhitePointCode           (0, 50000, 2, 2, defaultWhitePointCode, sizeof(defaultWhitePointCode)/sizeof(Int));
     1071
     1072  SMultiValueInput<Bool> cfg_timeCodeSeiTimeStampFlag        (0,  1, 0, MAX_TIMECODE_SEI_SETS);
     1073  SMultiValueInput<Bool> cfg_timeCodeSeiNumUnitFieldBasedFlag(0,  1, 0, MAX_TIMECODE_SEI_SETS);
     1074  SMultiValueInput<Int>  cfg_timeCodeSeiCountingType         (0,  6, 0, MAX_TIMECODE_SEI_SETS);
     1075  SMultiValueInput<Bool> cfg_timeCodeSeiFullTimeStampFlag    (0,  1, 0, MAX_TIMECODE_SEI_SETS);
     1076  SMultiValueInput<Bool> cfg_timeCodeSeiDiscontinuityFlag    (0,  1, 0, MAX_TIMECODE_SEI_SETS);
     1077  SMultiValueInput<Bool> cfg_timeCodeSeiCntDroppedFlag       (0,  1, 0, MAX_TIMECODE_SEI_SETS);
     1078  SMultiValueInput<Int>  cfg_timeCodeSeiNumberOfFrames       (0,511, 0, MAX_TIMECODE_SEI_SETS);
     1079  SMultiValueInput<Int>  cfg_timeCodeSeiSecondsValue         (0, 59, 0, MAX_TIMECODE_SEI_SETS);
     1080  SMultiValueInput<Int>  cfg_timeCodeSeiMinutesValue         (0, 59, 0, MAX_TIMECODE_SEI_SETS);
     1081  SMultiValueInput<Int>  cfg_timeCodeSeiHoursValue           (0, 23, 0, MAX_TIMECODE_SEI_SETS);
     1082  SMultiValueInput<Bool> cfg_timeCodeSeiSecondsFlag          (0,  1, 0, MAX_TIMECODE_SEI_SETS);
     1083  SMultiValueInput<Bool> cfg_timeCodeSeiMinutesFlag          (0,  1, 0, MAX_TIMECODE_SEI_SETS);
     1084  SMultiValueInput<Bool> cfg_timeCodeSeiHoursFlag            (0,  1, 0, MAX_TIMECODE_SEI_SETS);
     1085  SMultiValueInput<Int>  cfg_timeCodeSeiTimeOffsetLength     (0, 31, 0, MAX_TIMECODE_SEI_SETS);
     1086  SMultiValueInput<Int>  cfg_timeCodeSeiTimeOffsetValue      (std::numeric_limits<Int>::min(), std::numeric_limits<Int>::max(), 0, MAX_TIMECODE_SEI_SETS);
     1087
    6531088#if Q0096_OVERLAY_SEI
    6541089  const Int CFG_MAX_OVERLAYS = 3;
     
    6691104  po::Options opts;
    6701105  opts.addOptions()
    671   ("help", do_help, false, "this help text")
    672   ("c", po::parseConfigFile, "configuration file name")
    673  
     1106  ("help",                                            do_help,                                          false, "this help text")
     1107  ("c",    po::parseConfigFile, "configuration file name")
     1108
    6741109  // File, I/O and source parameters
    6751110#if SVC_EXTENSION
    676   ("InputFile%d,-i%d",        cfg_InputFile,  string(""), MAX_LAYERS, "original YUV input file name for layer %d")
    677   ("ReconFile%d,-o%d",        cfg_ReconFile,  string(""), MAX_LAYERS, "reconstruction YUV input file name for layer %d")
    678   ("LayerConfig%d,-lc%d",     cfg_LayerCfgFile, string(""), MAX_LAYERS, "layer %d configuration file name")
    679   ("SourceWidth%d,-wdt%d",    cfg_SourceWidth, 0, MAX_LAYERS, "Source picture width for layer %d")
    680   ("SourceHeight%d,-hgt%d",   cfg_SourceHeight, 0, MAX_LAYERS, "Source picture height for layer %d")
    681   ("FrameRate%d,-fr%d",       cfg_FrameRate,  0, MAX_LAYERS, "Frame rate for layer %d")
    682   ("LambdaModifier%d,-LM%d",  m_adLambdaModifier, ( double )1.0, MAX_TLAYER, "Lambda modifier for temporal layer %d")
     1111  ("InputFile%d,-i%d",                              cfg_InputFile,                      string(""), MAX_LAYERS, "original YUV input file name for layer %d")
     1112  ("ReconFile%d,-o%d",                              cfg_ReconFile,                      string(""), MAX_LAYERS, "reconstruction YUV input file name for layer %d")
     1113  ("LayerConfig%d,-lc%d",                           cfg_LayerCfgFile,                  string(""), MAX_LAYERS, "layer %d configuration file name")
     1114  ("SourceWidth%d,-wdt%d",                          cfg_SourceWidth,                            0, MAX_LAYERS, "Source picture width for layer %d")
     1115  ("SourceHeight%d,-hgt%d",                         cfg_SourceHeight,                            0, MAX_LAYERS, "Source picture height for layer %d")
     1116  ("FrameRate%d,-fr%d",                             cfg_FrameRate,                               0, MAX_LAYERS, "Frame rate for layer %d")
     1117  ("LambdaModifier%d,-LM%d",                        m_adLambdaModifier,                Double(1.0), MAX_TLAYER, "Lambda modifier for temporal layer %d")
    6831118#if O0215_PHASE_ALIGNMENT
    684   ("PhaseAlignment",          m_phaseAlignFlag, false, "indicate the sample location alignment between layers (0: zero position aligned, 1: central position aligned)")
     1119  ("PhaseAlignment",                                m_phaseAlignFlag,                                    false, "indicate the sample location alignment between layers (0: zero position aligned, 1: central position aligned)")
    6851120#endif
    6861121#if REPN_FORMAT_IN_VPS
    687   ("RepFormatIdx%d",          cfg_repFormatIdx, -1, MAX_LAYERS, "Index to the representation format structure used from the VPS")
     1122  ("RepFormatIdx%d",                                cfg_repFormatIdx,                          -1, MAX_LAYERS, "Index to the representation format structure used from the VPS")
    6881123#endif
    6891124#if VPS_EXTN_DIRECT_REF_LAYERS
    690   ("NumSamplePredRefLayers%d",cfg_numSamplePredRefLayers, -1, MAX_LAYERS, "Number of sample prediction reference layers")
    691   ("SamplePredRefLayerIds%d", cfg_samplePredRefLayerIdsPtr, string(""), MAX_LAYERS, "sample pred reference layer IDs")
    692   ("NumMotionPredRefLayers%d",cfg_numMotionPredRefLayers, -1, MAX_LAYERS, "Number of motion prediction reference layers")
    693   ("MotionPredRefLayerIds%d", cfg_motionPredRefLayerIdsPtr, string(""), MAX_LAYERS, "motion pred reference layer IDs")
    694   ("NumActiveRefLayers%d",    cfg_numActiveRefLayers, -1, MAX_LAYERS, "Number of active reference layers")
    695   ("PredLayerIds%d",          cfg_predLayerIdsPtr, string(""), MAX_LAYERS, "inter-layer prediction layer IDs")
    696 #endif
    697   ("NumLayers",               m_numLayers, 1, "Number of layers to code")
     1125  ("NumSamplePredRefLayers%d",                      cfg_numSamplePredRefLayers,                -1, MAX_LAYERS, "Number of sample prediction reference layers")
     1126  ("SamplePredRefLayerIds%d",                       cfg_samplePredRefLayerIdsPtr,      string(""), MAX_LAYERS, "sample pred reference layer IDs")
     1127  ("NumMotionPredRefLayers%d",                      cfg_numMotionPredRefLayers,                -1, MAX_LAYERS, "Number of motion prediction reference layers")
     1128  ("MotionPredRefLayerIds%d",                       cfg_motionPredRefLayerIdsPtr,      string(""), MAX_LAYERS, "motion pred reference layer IDs")
     1129  ("NumActiveRefLayers%d",                          cfg_numActiveRefLayers,                    -1, MAX_LAYERS, "Number of active reference layers")
     1130  ("PredLayerIds%d",                                cfg_predLayerIdsPtr,                string(""), MAX_LAYERS, "inter-layer prediction layer IDs")
     1131#endif
     1132  ("NumLayers",                                     m_numLayers,                                            1, "Number of layers to code")
    6981133#if Q0078_ADD_LAYER_SETS
    6991134#if OUTPUT_LAYER_SETS_CONFIG
    700   ("NumLayerSets",            m_numLayerSets, 1, "Number of layer sets")
    701 #else
    702   ("NumLayerSets",            m_numLayerSets, 0, "Number of layer sets")
    703 #endif
    704   ("NumLayerInIdList%d",      cfg_numLayerInIdList, 0, MAX_VPS_LAYER_ID_PLUS1, "Number of layers in the set")
    705   ("LayerSetLayerIdList%d",   cfg_layerSetLayerIdListPtr, string(""), MAX_VPS_LAYER_ID_PLUS1, "Layer IDs for the set")
    706   ("NumAddLayerSets",         m_numAddLayerSets, 0, "Number of additional layer sets")
    707   ("NumHighestLayerIdx%d",    cfg_numHighestLayerIdx, 0, MAX_VPS_LAYER_ID_PLUS1, "Number of highest layer idx")
    708   ("HighestLayerIdx%d",       cfg_highestLayerIdxPtr, string(""), MAX_VPS_LAYER_ID_PLUS1, "Highest layer idx for an additional layer set")
     1135  ("NumLayerSets",                                  m_numLayerSets,                                          1, "Number of layer sets")
     1136#else
     1137  ("NumLayerSets",                                  m_numLayerSets,                                          0, "Number of layer sets")
     1138#endif
     1139  ("NumLayerInIdList%d",                            cfg_numLayerInIdList,            0, MAX_VPS_LAYER_ID_PLUS1, "Number of layers in the set")
     1140  ("LayerSetLayerIdList%d",                         cfg_layerSetLayerIdListPtr, string(""), MAX_VPS_LAYER_ID_PLUS1, "Layer IDs for the set")
     1141  ("NumAddLayerSets",                               m_numAddLayerSets,                                      0, "Number of additional layer sets")
     1142  ("NumHighestLayerIdx%d",                          cfg_numHighestLayerIdx,          0, MAX_VPS_LAYER_ID_PLUS1, "Number of highest layer idx")
     1143  ("HighestLayerIdx%d",                             cfg_highestLayerIdxPtr, string(""), MAX_VPS_LAYER_ID_PLUS1, "Highest layer idx for an additional layer set")
    7091144#endif
    7101145#if OUTPUT_LAYER_SETS_CONFIG
    711   ("DefaultTargetOutputLayerIdc",    m_defaultTargetOutputLayerIdc, 1, "Default target output layers. 0: All layers are output layer, 1: Only highest layer is output layer, 2 or 3: No default output layers")
    712   ("NumOutputLayerSets",            m_numOutputLayerSets, 1, "Number of output layer sets excluding the 0-th output layer set")
    713   ("NumOutputLayersInOutputLayerSet",   cfg_numOutputLayersInOutputLayerSet, string(""), 1 , "List containing number of output layers in the output layer sets")
    714   ("ListOfOutputLayers%d",          cfg_listOfOutputLayers, string(""), MAX_VPS_LAYER_ID_PLUS1, "Layer IDs for the set, in terms of layer ID in the output layer set Range: [0..NumLayersInOutputLayerSet-1]")
    715   ("OutputLayerSetIdx",            cfg_outputLayerSetIdx, string(""), 1, "Corresponding layer set index, only for non-default output layer sets")
     1146  ("DefaultTargetOutputLayerIdc",                   m_defaultTargetOutputLayerIdc,                          1, "Default target output layers. 0: All layers are output layer, 1: Only highest layer is output layer, 2 or 3: No default output layers")
     1147  ("NumOutputLayerSets",                            m_numOutputLayerSets,                                    1, "Number of output layer sets excluding the 0-th output layer set")
     1148  ("NumOutputLayersInOutputLayerSet",               cfg_numOutputLayersInOutputLayerSet,         string(""), 1, "List containing number of output layers in the output layer sets")
     1149  ("ListOfOutputLayers%d",                          cfg_listOfOutputLayers, string(""), MAX_VPS_LAYER_ID_PLUS1, "Layer IDs for the set, in terms of layer ID in the output layer set Range: [0..NumLayersInOutputLayerSet-1]")
     1150  ("OutputLayerSetIdx",                             cfg_outputLayerSetIdx,                      string(""), 1, "Corresponding layer set index, only for non-default output layer sets")
    7161151#endif
    7171152#if AUXILIARY_PICTURES
    718   ("InputChromaFormat%d",     cfg_tmpInputChromaFormat,  420, MAX_LAYERS, "InputChromaFormatIDC for layer %d")
    719   ("ChromaFormatIDC%d,-cf",   cfg_tmpChromaFormatIDC,    420, MAX_LAYERS, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat) for layer %d")
    720   ("AuxId%d",                 cfg_auxId,                 0,   MAX_LAYERS, "Auxilary picture ID for layer %d (0: Not aux pic, 1: Alpha plane, 2: Depth picture, 3: Cb enh, 4: Cr enh")
    721 #endif
    722   ("ConformanceMode%d",      cfg_conformanceMode,        0, MAX_LAYERS, "Window conformance mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping")
    723   ("ConfLeft%d",             cfg_confWinLeft,            0, MAX_LAYERS, "Deprecated alias of ConfWinLeft")
    724   ("ConfRight%d",            cfg_confWinRight,           0, MAX_LAYERS, "Deprecated alias of ConfWinRight")
    725   ("ConfTop%d",              cfg_confWinTop,             0, MAX_LAYERS, "Deprecated alias of ConfWinTop")
    726   ("ConfBottom%d",           cfg_confWinBottom,          0, MAX_LAYERS, "Deprecated alias of ConfWinBottom")
    727   ("ConfWinLeft%d",          cfg_confWinLeft,            0, MAX_LAYERS, "Left offset for window conformance mode 3")
    728   ("ConfWinRight%d",         cfg_confWinRight,           0, MAX_LAYERS, "Right offset for window conformance mode 3")
    729   ("ConfWinTop%d",           cfg_confWinTop,             0, MAX_LAYERS, "Top offset for window conformance mode 3")
    730   ("ConfWinBottom%d",        cfg_confWinBottom,          0, MAX_LAYERS, "Bottom offset for window conformance mode 3")
    731   ("HorizontalPadding%d,-pdx%d", cfg_aiPadX,             0, MAX_LAYERS, "Horizontal source padding for conformance window mode 2")
    732   ("VerticalPadding%d,-pdy%d",   cfg_aiPadY,             0, MAX_LAYERS, "Vertical source padding for conformance window mode 2")
    733   ("ScalabilityMask1",        m_scalabilityMask[1], 0, "scalability_mask[1] (multiview)")
    734   ("ScalabilityMask2",        m_scalabilityMask[2], 1, "scalability_mask[2] (scalable)" )
     1153  ("AuxId%d",                                       cfg_auxId,                                   0, MAX_LAYERS, "Auxilary picture ID for layer %d (0: Not aux pic, 1: Alpha plane, 2: Depth picture, 3: Cb enh, 4: Cr enh")
     1154#endif
     1155  ("ExtendedPrecision%d",                           cfg_useExtendedPrecision,                false, MAX_LAYERS, "Increased internal accuracies to support high bit depths (not valid in V1 profiles)")
     1156  ("ConformanceMode%d",                             cfg_conformanceMode,                         0, MAX_LAYERS, "Window conformance mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping")
     1157  ("ConfLeft%d",                                    cfg_confWinLeft,                             0, MAX_LAYERS, "Deprecated alias of ConfWinLeft")
     1158  ("ConfRight%d",                                   cfg_confWinRight,                            0, MAX_LAYERS, "Deprecated alias of ConfWinRight")
     1159  ("ConfTop%d",                                     cfg_confWinTop,                              0, MAX_LAYERS, "Deprecated alias of ConfWinTop")
     1160  ("ConfBottom%d",                                  cfg_confWinBottom,                           0, MAX_LAYERS, "Deprecated alias of ConfWinBottom")
     1161  ("ConfWinLeft%d",                                 cfg_confWinLeft,                             0, MAX_LAYERS, "Left offset for window conformance mode 3")
     1162  ("ConfWinRight%d",                                cfg_confWinRight,                            0, MAX_LAYERS, "Right offset for window conformance mode 3")
     1163  ("ConfWinTop%d",                                  cfg_confWinTop,                              0, MAX_LAYERS, "Top offset for window conformance mode 3")
     1164  ("ConfWinBottom%d",                               cfg_confWinBottom,                           0, MAX_LAYERS, "Bottom offset for window conformance mode 3")
     1165  ("HorizontalPadding%d,-pdx%d",                    cfg_aiPadX,                                  0, MAX_LAYERS, "Horizontal source padding for conformance window mode 2")
     1166  ("VerticalPadding%d,-pdy%d",                      cfg_aiPadY,                                  0, MAX_LAYERS, "Vertical source padding for conformance window mode 2")
     1167  ("ScalabilityMask1",                              m_scalabilityMask[VIEW_ORDER_INDEX],                     0, "scalability_mask[1] (multiview)")
     1168  ("ScalabilityMask2",                              m_scalabilityMask[SCALABILITY_ID],                       1, "scalability_mask[2] (scalable)" )
    7351169#if AUXILIARY_PICTURES
    736   ("ScalabilityMask3",        m_scalabilityMask[3], 0, "scalability_mask[3] (auxiliary pictures)" )
    737 #endif
    738   ("BitstreamFile,b",         cfg_BitstreamFile, string(""), "Bitstream output file name")
     1170  ("ScalabilityMask3",                              m_scalabilityMask[AUX_ID],                              0, "scalability_mask[3] (auxiliary pictures)" )
     1171#endif
     1172  ("BitstreamFile,b",                               cfg_BitstreamFile, string(""), "Bitstream output file name")
    7391173#if !O0194_DIFFERENT_BITDEPTH_EL_BL
    740   ("InputBitDepth",           m_inputBitDepthY,    8, "Bit-depth of input file")
    741   ("OutputBitDepth",          m_outputBitDepthY,   0, "Bit-depth of output file (default:InternalBitDepth)")
    742   ("InternalBitDepth",        m_internalBitDepthY, 0, "Bit-depth the codec operates at. (default:InputBitDepth)"
    743                                                        "If different to InputBitDepth, source data will be converted")
    744   ("InputBitDepthC",          m_inputBitDepthC,    0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)")
    745   ("OutputBitDepthC",         m_outputBitDepthC,   0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
    746   ("InternalBitDepthC",       m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)")
    747 #endif
    748   ("NumScaledRefLayerOffsets%d",    cfg_numScaledRefLayerOffsets,     0, MAX_LAYERS,  "Number of scaled offset layer sets ")
     1174  ("InputBitDepth",                                 m_inputBitDepthY,                                        8, "Bit-depth of input file")
     1175  ("OutputBitDepth",                                m_outputBitDepthY,                                       0, "Bit-depth of output file (default:InternalBitDepth)")
     1176  ("InternalBitDepth",                              m_internalBitDepthY,                                    0, "Bit-depth the codec operates at. (default:InputBitDepth)"
     1177                                                                                                                "If different to InputBitDepth, source data will be converted")
     1178  ("InputBitDepthC",                                m_inputBitDepthC,                                        0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)")
     1179  ("OutputBitDepthC",                               m_outputBitDepthC,                                       0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
     1180  ("InternalBitDepthC",                             m_internalBitDepthC,                                    0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)")
     1181#endif
     1182  ("NumScaledRefLayerOffsets%d",                    cfg_numScaledRefLayerOffsets,                0, MAX_LAYERS,  "Number of scaled offset layer sets ")
    7491183#if O0098_SCALED_REF_LAYER_ID
    750   ("ScaledRefLayerId%d",           cfg_scaledRefLayerIdPtr,          string(""), MAX_LAYERS, "Layer ID of scaled base layer picture")
    751 #endif
    752   ("ScaledRefLayerLeftOffset%d",   cfg_scaledRefLayerLeftOffsetPtr,  string(""), MAX_LAYERS, "Horizontal offset of top-left luma sample of scaled base layer picture with respect to"
    753                                                                  " top-left luma sample of the EL picture, in units of two luma samples")
    754   ("ScaledRefLayerTopOffset%d",    cfg_scaledRefLayerTopOffsetPtr,   string(""), MAX_LAYERS,  "Vertical offset of top-left luma sample of scaled base layer picture with respect to"
    755                                                                  " top-left luma sample of the EL picture, in units of two luma samples")
    756   ("ScaledRefLayerRightOffset%d",  cfg_scaledRefLayerRightOffsetPtr, string(""), MAX_LAYERS, "Horizontal offset of bottom-right luma sample of scaled base layer picture with respect to"
    757                                                                  " bottom-right luma sample of the EL picture, in units of two luma samples")
    758   ("ScaledRefLayerBottomOffset%d", cfg_scaledRefLayerBottomOffsetPtr,string(""), MAX_LAYERS, "Vertical offset of bottom-right luma sample of scaled base layer picture with respect to"
    759   " bottom-right luma sample of the EL picture, in units of two luma samples")
     1184  ("ScaledRefLayerId%d",                            cfg_scaledRefLayerIdPtr,            string(""), MAX_LAYERS, "Layer ID of scaled base layer picture")
     1185#endif                                             
     1186  ("ScaledRefLayerLeftOffset%d",                    cfg_scaledRefLayerLeftOffsetPtr,    string(""), MAX_LAYERS, "Horizontal offset of top-left luma sample of scaled base layer picture with respect to"
     1187                                                                                                                " top-left luma sample of the EL picture, in units of two luma samples")
     1188  ("ScaledRefLayerTopOffset%d",                     cfg_scaledRefLayerTopOffsetPtr,     string(""), MAX_LAYERS, "Vertical offset of top-left luma sample of scaled base layer picture with respect to"
     1189                                                                                                                " top-left luma sample of the EL picture, in units of two luma samples")
     1190  ("ScaledRefLayerRightOffset%d",                   cfg_scaledRefLayerRightOffsetPtr,  string(""), MAX_LAYERS, "Horizontal offset of bottom-right luma sample of scaled base layer picture with respect to"
     1191                                                                                                                " bottom-right luma sample of the EL picture, in units of two luma samples")
     1192  ("ScaledRefLayerBottomOffset%d",                  cfg_scaledRefLayerBottomOffsetPtr,  string(""), MAX_LAYERS, "Vertical offset of bottom-right luma sample of scaled base layer picture with respect to"
     1193                                                                                                                " bottom-right luma sample of the EL picture, in units of two luma samples")
    7601194#if REF_REGION_OFFSET
    761   ("ScaledRefLayerOffsetPresentFlag%d",      cfg_scaledRefLayerOffsetPresentFlagPtr,    string(""), MAX_LAYERS, "presense flag of scaled reference layer offsets")
    762   ("RefRegionOffsetPresentFlag%d",           cfg_refRegionOffsetPresentFlagPtr,          string(""), MAX_LAYERS, "presense flag of reference region offsets")
    763   ("RefRegionLeftOffset%d",   cfg_refRegionLeftOffsetPtr,  string(""), MAX_LAYERS, "Horizontal offset of top-left luma sample of ref region with respect to"
    764                                                                  " top-left luma sample of the BL picture, in units of two luma samples")
    765   ("RefRegionTopOffset%d",    cfg_refRegionTopOffsetPtr,   string(""), MAX_LAYERS,  "Vertical offset of top-left luma sample of ref region with respect to"
    766                                                                  " top-left luma sample of the BL picture, in units of two luma samples")
    767   ("RefRegionRightOffset%d",  cfg_refRegionRightOffsetPtr, string(""), MAX_LAYERS, "Horizontal offset of bottom-right luma sample of ref region with respect to"
    768                                                                  " bottom-right luma sample of the BL picture, in units of two luma samples")
    769   ("RefRegionBottomOffset%d", cfg_refRegionBottomOffsetPtr,string(""), MAX_LAYERS, "Vertical offset of bottom-right luma sample of ref region with respect to"
    770                                                                  " bottom-right luma sample of the BL picture, in units of two luma samples")
     1195  ("ScaledRefLayerOffsetPresentFlag%d",         cfg_scaledRefLayerOffsetPresentFlagPtr, string(""), MAX_LAYERS, "presense flag of scaled reference layer offsets")
     1196  ("RefRegionOffsetPresentFlag%d",                  cfg_refRegionOffsetPresentFlagPtr,  string(""), MAX_LAYERS, "presense flag of reference region offsets")
     1197  ("RefRegionLeftOffset%d",                         cfg_refRegionLeftOffsetPtr,         string(""), MAX_LAYERS, "Horizontal offset of top-left luma sample of ref region with respect to"
     1198                                                                                                                " top-left luma sample of the BL picture, in units of two luma samples")
     1199  ("RefRegionTopOffset%d",                          cfg_refRegionTopOffsetPtr,          string(""), MAX_LAYERS, "Vertical offset of top-left luma sample of ref region with respect to"
     1200                                                                                                                " top-left luma sample of the BL picture, in units of two luma samples")
     1201  ("RefRegionRightOffset%d",                        cfg_refRegionRightOffsetPtr,        string(""), MAX_LAYERS, "Horizontal offset of bottom-right luma sample of ref region with respect to"
     1202                                                                                                                " bottom-right luma sample of the BL picture, in units of two luma samples")
     1203  ("RefRegionBottomOffset%d",                       cfg_refRegionBottomOffsetPtr,       string(""), MAX_LAYERS, "Vertical offset of bottom-right luma sample of ref region with respect to"
     1204                                                                                                                " bottom-right luma sample of the BL picture, in units of two luma samples")
    7711205#endif
    7721206#if R0209_GENERIC_PHASE
    773   ("ResamplePhaseSetPresentFlag%d",  cfg_resamplePhaseSetPresentFlagPtr, string(""), MAX_LAYERS, "presense flag of resample phase set")
    774   ("PhaseHorLuma%d",   cfg_phaseHorLumaPtr,   string(""), MAX_LAYERS, "luma shift in the horizontal direction used in resampling proces")
    775   ("PhaseVerLuma%d",   cfg_phaseVerLumaPtr,   string(""), MAX_LAYERS, "luma shift in the vertical   direction used in resampling proces")
    776   ("PhaseHorChroma%d", cfg_phaseHorChromaPtr, string(""), MAX_LAYERS, "chroma shift in the horizontal direction used in resampling proces")
    777   ("PhaseVerChroma%d", cfg_phaseVerChromaPtr, string(""), MAX_LAYERS, "chroma shift in the vertical   direction used in resampling proces")
     1207  ("ResamplePhaseSetPresentFlag%d",                 cfg_resamplePhaseSetPresentFlagPtr, string(""), MAX_LAYERS, "presense flag of resample phase set")
     1208  ("PhaseHorLuma%d",                                cfg_phaseHorLumaPtr,                string(""), MAX_LAYERS, "luma shift in the horizontal direction used in resampling proces")
     1209  ("PhaseVerLuma%d",                                cfg_phaseVerLumaPtr,                string(""), MAX_LAYERS, "luma shift in the vertical   direction used in resampling proces")
     1210  ("PhaseHorChroma%d",                              cfg_phaseHorChromaPtr,              string(""), MAX_LAYERS, "chroma shift in the horizontal direction used in resampling proces")
     1211  ("PhaseVerChroma%d",                              cfg_phaseVerChromaPtr,              string(""), MAX_LAYERS, "chroma shift in the vertical   direction used in resampling proces")
    7781212#endif
    7791213#if P0312_VERT_PHASE_ADJ
    780   ("VertPhasePositionEnableFlag%d", cfg_vertPhasePositionEnableFlagPtr,string(""), MAX_LAYERS, "VertPhasePositionEnableFlag for layer %d")
     1214  ("VertPhasePositionEnableFlag%d",                 cfg _vertPhasePositionEnableFlagPtr,string(""), MAX_LAYERS, "VertPhasePositionEnableFlag for layer %d")
    7811215#endif
    7821216#if Q0074_COLOUR_REMAPPING_SEI
    783   ("SEIColourRemappingInfoFile%d", cfg_colourRemapSEIFile, string(""), MAX_LAYERS, "Colour Remapping Information SEI parameters file name for layer %d")
     1217  ("SEIColourRemappingInfoFile%d",                   cfg_colourRemapSEIFile,          string(""), MAX_LAYERS, "Colour Remapping Information SEI parameters file name for layer %d")
    7841218#endif
    7851219#if O0194_DIFFERENT_BITDEPTH_EL_BL
    786   ("InputBitDepth%d",       cfg_InputBitDepthY,    8, MAX_LAYERS, "Bit-depth of input file for layer %d")
    787   ("InternalBitDepth%d",    cfg_InternalBitDepthY, 0, MAX_LAYERS, "Bit-depth the codec operates at. (default:InputBitDepth) for layer %d ")
    788 //                                                       "If different to InputBitDepth, source data will be converted")
    789   ("InputBitDepthC%d",      cfg_InputBitDepthC,    0, MAX_LAYERS, "As per InputBitDepth but for chroma component. (default:InputBitDepth) for layer %d")
    790   ("InternalBitDepthC%d",   cfg_InternalBitDepthC, 0, MAX_LAYERS, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth) for layer %d")
    791   ("OutputBitDepth%d",      cfg_OutputBitDepthY,   0, MAX_LAYERS, "Bit-depth of output file (default:InternalBitDepth)")
    792   ("OutputBitDepthC%d",     cfg_OutputBitDepthC,   0, MAX_LAYERS, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
    793 #endif
    794   ("MaxTidRefPresentFlag", m_maxTidRefPresentFlag, true, "max_tid_ref_present_flag (0: not present, 1: present(default)) " )
    795   ("MaxTidIlRefPicsPlus1%d", cfg_maxTidIlRefPicsPlus1, 1, MAX_LAYERS, "allowed maximum temporal_id for inter-layer prediction")
     1220  ("InputBitDepth%d",                                cfg_InputBitDepth[CHANNEL_TYPE_LUMA],      8, MAX_LAYERS, "Bit-depth of input file for layer %d")
     1221  ("InternalBitDepth%d",                             cfg_InternalBitDepth[CHANNEL_TYPE_LUMA],   0, MAX_LAYERS, "Bit-depth the codec operates at. (default:InputBitDepth) for layer %d "
     1222                                                                                                               " If different to InputBitDepth, source data will be converted")
     1223  ("OutputBitDepth%d",                               cfg_OutputBitDepth[CHANNEL_TYPE_LUMA],     0, MAX_LAYERS, "Bit-depth of output file (default:InternalBitDepth)")
     1224  ("InputBitDepthC%d",                               cfg_InputBitDepth[CHANNEL_TYPE_CHROMA],    0, MAX_LAYERS, "As per InputBitDepth but for chroma component. (default:InputBitDepth) for layer %d")
     1225  ("InternalBitDepthC%d",                            cfg_InternalBitDepth[CHANNEL_TYPE_CHROMA], 0, MAX_LAYERS, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth) for layer %d")
     1226  ("OutputBitDepthC%d",                              cfg_OutputBitDepth[CHANNEL_TYPE_CHROMA],   0, MAX_LAYERS, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
     1227#endif
     1228  ("MaxTidRefPresentFlag",                           m_maxTidRefPresentFlag,                            false, "max_tid_ref_present_flag (0: not present, 1: present) " )
     1229  ("MaxTidIlRefPicsPlus1%d",                         cfg_maxTidIlRefPicsPlus1,                  7, MAX_LAYERS, "allowed maximum temporal_id for inter-layer prediction")
    7961230#if O0223_PICTURE_TYPES_ALIGN_FLAG
    797   ("CrossLayerPictureTypeAlignFlag", m_crossLayerPictureTypeAlignFlag, true, "align picture type across layers" ) 
    798 #endif
    799   ("CrossLayerIrapAlignFlag", m_crossLayerIrapAlignFlag, true, "align IRAP across layers" ) 
     1231  ("CrossLayerPictureTypeAlignFlag",                 m_crossLayerPictureTypeAlignFlag,                  true, "align picture type across layers" ) 
     1232#endif
     1233  ("CrossLayerIrapAlignFlag",                        m_crossLayerIrapAlignFlag,                          true, "align IRAP across layers" ) 
    8001234#if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG
    801   ("CrossLayerAlignedIdrOnlyFlag", m_crossLayerAlignedIdrOnlyFlag, true, "only idr for IRAP across layers" ) 
     1235  ("CrossLayerAlignedIdrOnlyFlag",                   m_crossLayerAlignedIdrOnlyFlag,                    true, "only idr for IRAP across layers" ) 
    8021236#endif
    8031237#if O0194_WEIGHTED_PREDICTION_CGS
    804   ("InterLayerWeightedPred", m_useInterLayerWeightedPred, false, "enable IL WP parameters estimation at encoder" ) 
     1238  ("InterLayerWeightedPred",                          m_useInterLayerWeightedPred,                      false, "enable IL WP parameters estimation at encoder" ) 
    8051239#endif
    8061240#if AVC_BASE
    8071241#if VPS_AVC_BL_FLAG_REMOVAL
    808   ("NonHEVCBase,-nonhevc",            m_nonHEVCBaseLayerFlag,     0, "BL is available but not internal")
    809 #else
    810   ("AvcBase,-avc",            m_avcBaseLayerFlag,     0, "avc_base_layer_flag")
    811 #endif
    812   ("InputBLFile,-ibl",        cfg_BLInputFile,     string(""), "Base layer rec YUV input file name")
    813 #endif
    814   ("EnableElRapB,-use-rap-b",  m_elRapSliceBEnabled, 0, "Set ILP over base-layer I picture to B picture (default is P picture)")
     1242  ("NonHEVCBase,-nonhevc",                            m_nonHEVCBaseLayerFlag,                                0, "BL is available but not internal")
     1243#else
     1244  ("AvcBase,-avc",                                    m_avcBaseLayerFlag,                                    0, "avc_base_layer_flag")
     1245#endif
     1246  ("InputBLFile,-ibl",                                cfg_BLInputFile,                              string(""), "Base layer rec YUV input file name")
     1247#endif
     1248  ("EnableElRapB,-use-rap-b",                         m_elRapSliceBEnabled,                                 0, "Set ILP over base-layer I picture to B picture (default is P picture)")
     1249  ("InputChromaFormat",                               tmpInputChromaFormat,                               420, "InputChromaFormatIDC")
     1250  ("ChromaFormatIDC,-cf",                             tmpChromaFormat,                                      0, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat)")
    8151251#else //SVC_EXTENSION
    816   ("InputFile,i",           cfg_InputFile,     string(""), "Original YUV input file name")
    817   ("BitstreamFile,b",       cfg_BitstreamFile, string(""), "Bitstream output file name")
    818   ("ReconFile,o",           cfg_ReconFile,     string(""), "Reconstructed YUV output file name")
    819   ("SourceWidth,-wdt",      m_iSourceWidth,        0, "Source picture width")
    820   ("SourceHeight,-hgt",     m_iSourceHeight,       0, "Source picture height")
    821   ("InputBitDepth",         m_inputBitDepthY,    8, "Bit-depth of input file")
    822   ("OutputBitDepth",        m_outputBitDepthY,   0, "Bit-depth of output file (default:InternalBitDepth)")
    823   ("InternalBitDepth",      m_internalBitDepthY, 0, "Bit-depth the codec operates at. (default:InputBitDepth)"
    824                                                        "If different to InputBitDepth, source data will be converted")
    825   ("InputBitDepthC",        m_inputBitDepthC,    0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)")
    826   ("OutputBitDepthC",       m_outputBitDepthC,   0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
    827   ("InternalBitDepthC",     m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)")
    828 #if AUXILIARY_PICTURES
    829   ("InputChromaFormat",     tmpInputChromaFormat,                       420, "InputChromaFormatIDC")
    830   ("ChromaFormatIDC,-cf",   tmpChromaFormat,                             0, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat)")
    831 #endif
    832   ("ConformanceMode",       m_conformanceWindowMode,  0, "Deprecated alias of ConformanceWindowMode")
    833   ("ConformanceWindowMode", m_conformanceWindowMode,  0, "Window conformance mode (0: no window, 1:automatic padding, 2:padding, 3:conformance")
    834   ("HorizontalPadding,-pdx",m_aiPad[0],               0, "Horizontal source padding for conformance window mode 2")
    835   ("VerticalPadding,-pdy",  m_aiPad[1],               0, "Vertical source padding for conformance window mode 2")
    836   ("ConfLeft",              m_confWinLeft,            0, "Deprecated alias of ConfWinLeft")
    837   ("ConfRight",             m_confWinRight,           0, "Deprecated alias of ConfWinRight")
    838   ("ConfTop",               m_confWinTop,             0, "Deprecated alias of ConfWinTop")
    839   ("ConfBottom",            m_confWinBottom,          0, "Deprecated alias of ConfWinBottom")
    840   ("ConfWinLeft",           m_confWinLeft,            0, "Left offset for window conformance mode 3")
    841   ("ConfWinRight",          m_confWinRight,           0, "Right offset for window conformance mode 3")
    842   ("ConfWinTop",            m_confWinTop,             0, "Top offset for window conformance mode 3")
    843   ("ConfWinBottom",         m_confWinBottom,          0, "Bottom offset for window conformance mode 3")
    844   ("FrameRate,-fr",         m_iFrameRate,          0, "Frame rate")
     1252  ("InputFile,i",                                     cfg_InputFile,                               string(""), "Original YUV input file name")
     1253  ("BitstreamFile,b",                                 cfg_BitstreamFile,                           string(""), "Bitstream output file name")
     1254  ("ReconFile,o",                                     cfg_ReconFile,                               string(""), "Reconstructed YUV output file name")
     1255  ("SourceWidth,-wdt",                                m_iSourceWidth,                                       0, "Source picture width")
     1256  ("SourceHeight,-hgt",                               m_iSourceHeight,                                      0, "Source picture height")
     1257  ("InputBitDepth",                                   m_inputBitDepth[CHANNEL_TYPE_LUMA],                   8, "Bit-depth of input file")
     1258  ("OutputBitDepth",                                  m_outputBitDepth[CHANNEL_TYPE_LUMA],                  0, "Bit-depth of output file (default:InternalBitDepth)")
     1259  ("MSBExtendedBitDepth",                             m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA],             0, "bit depth of luma component after addition of MSBs of value 0 (used for synthesising High Dynamic Range source material). (default:InputBitDepth)")
     1260  ("InternalBitDepth",                                m_internalBitDepth[CHANNEL_TYPE_LUMA],                0, "Bit-depth the codec operates at. (default:MSBExtendedBitDepth). If different to MSBExtendedBitDepth, source data will be converted")
     1261  ("InputBitDepthC",                                  m_inputBitDepth[CHANNEL_TYPE_CHROMA],                 0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)")
     1262  ("OutputBitDepthC",                                 m_outputBitDepth[CHANNEL_TYPE_CHROMA],                0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
     1263  ("MSBExtendedBitDepthC",                            m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA],           0, "As per MSBExtendedBitDepth but for chroma component. (default:MSBExtendedBitDepth)")
     1264  ("InternalBitDepthC",                               m_internalBitDepth[CHANNEL_TYPE_CHROMA],              0, "As per InternalBitDepth but for chroma component. (default:InternalBitDepth)")
     1265  ("ExtendedPrecision",                               m_useExtendedPrecision,                           false, "Increased internal accuracies to support high bit depths (not valid in V1 profiles)")
     1266  ("HighPrecisionPredictionWeighting",                m_useHighPrecisionPredictionWeighting,            false, "Use high precision option for weighted prediction (not valid in V1 profiles)")
     1267  ("InputColourSpaceConvert",                         inputColourSpaceConvert,                     string(""), "Colour space conversion to apply to input video. Permitted values are (empty string=UNCHANGED) " + getListOfColourSpaceConverts(true))
     1268  ("SNRInternalColourSpace",                          m_snrInternalColourSpace,                         false, "If true, then no colour space conversion is applied prior to SNR, otherwise inverse of input is applied.")
     1269  ("OutputInternalColourSpace",                       m_outputInternalColourSpace,                      false, "If true, then no colour space conversion is applied for reconstructed video, otherwise inverse of input is applied.")
     1270  ("InputChromaFormat",                               tmpInputChromaFormat,                               420, "InputChromaFormatIDC")
     1271  ("MSEBasedSequencePSNR",                            m_printMSEBasedSequencePSNR,                      false, "0 (default) emit sequence PSNR only as a linear average of the frame PSNRs, 1 = also emit a sequence PSNR based on an average of the frame MSEs")
     1272  ("PrintFrameMSE",                                   m_printFrameMSE,                                  false, "0 (default) emit only bit count and PSNRs for each frame, 1 = also emit MSE values")
     1273  ("PrintSequenceMSE",                                m_printSequenceMSE,                               false, "0 (default) emit only bit rate and PSNRs for the whole sequence, 1 = also emit MSE values")
     1274  ("CabacZeroWordPaddingEnabled",                     m_cabacZeroWordPaddingEnabled,                    false, "0 (default) do not add conforming cabac-zero-words to bit streams, 1 = add cabac-zero-words")
     1275  ("ChromaFormatIDC,-cf",                             tmpChromaFormat,                                      0, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat)")
     1276  ("ConformanceMode",                                 m_conformanceWindowMode,                              0, "Deprecated alias of ConformanceWindowMode")
     1277  ("ConformanceWindowMode",                           m_conformanceWindowMode,                              0, "Window conformance mode (0: no window, 1:automatic padding, 2:padding, 3:conformance")
     1278  ("HorizontalPadding,-pdx",                          m_aiPad[0],                                           0, "Horizontal source padding for conformance window mode 2")
     1279  ("VerticalPadding,-pdy",                            m_aiPad[1],                                           0, "Vertical source padding for conformance window mode 2")
     1280  ("ConfLeft",                                        m_confWinLeft,                                        0, "Deprecated alias of ConfWinLeft")
     1281  ("ConfRight",                                       m_confWinRight,                                       0, "Deprecated alias of ConfWinRight")
     1282  ("ConfTop",                                         m_confWinTop,                                         0, "Deprecated alias of ConfWinTop")
     1283  ("ConfBottom",                                      m_confWinBottom,                                      0, "Deprecated alias of ConfWinBottom")
     1284  ("ConfWinLeft",                                     m_confWinLeft,                                        0, "Left offset for window conformance mode 3")
     1285  ("ConfWinRight",                                    m_confWinRight,                                       0, "Right offset for window conformance mode 3")
     1286  ("ConfWinTop",                                      m_confWinTop,                                         0, "Top offset for window conformance mode 3")
     1287  ("ConfWinBottom",                                   m_confWinBottom,                                      0, "Bottom offset for window conformance mode 3")
     1288  ("FrameRate,-fr",                                   m_iFrameRate,                                         0, "Frame rate")
    8451289#if Q0074_COLOUR_REMAPPING_SEI
    846   ("SEIColourRemappingInfoFile", cfg_colourRemapSEIFile, string(""), "Colour Remapping Information SEI parameters file name")
     1290  ("SEIColourRemappingInfoFile",                      cfg_colourRemapSEIFile, string(""), "Colour Remapping Information SEI parameters file name")
    8471291#endif
    8481292#endif //SVC_EXTENSION
    849   ("FrameSkip,-fs",         m_FrameSkip,          0u, "Number of frames to skip at start of input YUV")
    850   ("FramesToBeEncoded,f",   m_framesToBeEncoded,   0, "Number of frames to be encoded (default=all)")
     1293  ("FrameSkip,-fs",                                   m_FrameSkip,                                         0u, "Number of frames to skip at start of input YUV")
     1294  ("FramesToBeEncoded,f",                             m_framesToBeEncoded,                                  0, "Number of frames to be encoded (default=all)")
    8511295
    8521296  //Field coding parameters
    853   ("FieldCoding", m_isField, false, "Signals if it's a field based coding")
    854   ("TopFieldFirst, Tff", m_isTopFieldFirst, false, "In case of field based coding, signals whether if it's a top field first or not")
     1297  ("FieldCoding",                                     m_isField,                                        false, "Signals if it's a field based coding")
     1298  ("TopFieldFirst, Tff",                              m_isTopFieldFirst,                                false, "In case of field based coding, signals whether if it's a top field first or not")
     1299
     1300  // Profile and level
     1301#if MULTIPLE_PTL_SUPPORT
     1302  ("NumProfileTierLevel",                             m_numPTLInfo,                                         1, "Number of Profile, Tier and Level information")
     1303  ("Profile%d",                                       extendedProfile,          NONE, (MAX_NUM_LAYER_IDS + 1),  "Profile name to use for encoding. Use main (for main), main10 (for main10), main-still-picture, main-RExt (for Range Extensions profile), any of the RExt specific profile names, or none")
     1304  ("Level%d",                                         m_levelList,       Level::NONE, (MAX_NUM_LAYER_IDS + 1), "Level limit to be used, eg 5.1, or none")
     1305  ("Tier%d",                                          m_levelTierList,   Level::MAIN, (MAX_NUM_LAYER_IDS + 1), "Tier to use for interpretation of --Level (main or high only)")
     1306  ("MaxBitDepthConstraint",                           tmpBitDepthConstraint,                               0u, "Bit depth to use for profile-constraint for RExt profiles. 0=automatically choose based upon other parameters")
     1307  ("MaxChromaFormatConstraint",                       tmpConstraintChromaFormat,                            0, "Chroma-format to use for the profile-constraint for RExt profiles. 0=automatically choose based upon other parameters")
     1308  ("IntraConstraintFlag",                             tmpIntraConstraintFlag,                           false, "Value of general_intra_constraint_flag to use for RExt profiles (not used if an explicit RExt sub-profile is specified)")
     1309  ("LowerBitRateConstraintFlag",                      tmpLowerBitRateConstraintFlag,                     true, "Value of general_lower_bit_rate_constraint_flag to use for RExt profiles")
     1310
     1311  ("ProfileCompatibility%d",                          m_profileCompatibility, Profile::NONE, (MAX_NUM_LAYER_IDS + 1), "Compatible profile to be used when encoding")
     1312  ("ProgressiveSource%d",                             m_progressiveSourceFlagList,   false, (MAX_NUM_LAYER_IDS + 1), "Indicate that source is progressive")
     1313  ("InterlacedSource%d",                              m_interlacedSourceFlagList,    false, (MAX_NUM_LAYER_IDS + 1), "Indicate that source is interlaced")
     1314  ("NonPackedSource%d",                               m_nonPackedConstraintFlagList, false, (MAX_NUM_LAYER_IDS + 1), "Indicate that source does not contain frame packing")
     1315  ("FrameOnly%d",                                     m_frameOnlyConstraintFlagList, false, (MAX_NUM_LAYER_IDS + 1), "Indicate that the bitstream contains only frames")
    8551316 
    856   // Profile and level
    857 #if SVC_EXTENSION && MULTIPLE_PTL_SUPPORT
    858   ("NumProfileTierLevel", m_numPTLInfo, 1, "Number of Profile, Tier and Level information")
    859   ("Profile%d", m_profileList,   Profile::NONE, MAX_NUM_LAYER_IDS + 1, "Profile to be used when encoding (Incomplete)")
    860   ("Level%d",   m_levelList,     Level::NONE, MAX_NUM_LAYER_IDS + 1, "Level limit to be used, eg 5.1 (Incomplete)")
    861   ("Tier%d",    m_levelTierList, Level::MAIN, MAX_NUM_LAYER_IDS + 1, "Tier to use for interpretation of --Level")
    862   ("ProfileCompatibility%d", m_profileCompatibility,   Profile::NONE, MAX_NUM_LAYER_IDS + 1, "Compatible profile to be used when encoding")
    863   ("ProgressiveSource%d", m_progressiveSourceFlagList, false, MAX_NUM_LAYER_IDS + 1, "Indicate that source is progressive")
    864   ("InterlacedSource%d",  m_interlacedSourceFlagList,  false, MAX_NUM_LAYER_IDS + 1, "Indicate that source is interlaced")
    865   ("NonPackedSource%d",   m_nonPackedConstraintFlagList, false, MAX_NUM_LAYER_IDS + 1, "Indicate that source does not contain frame packing")
    866   ("FrameOnly%d",         m_frameOnlyConstraintFlagList, false, MAX_NUM_LAYER_IDS + 1, "Indicate that the bitstream contains only frames")
    867    
    868   ("LayerPTLIndex%d", m_layerPTLIdx, 0, MAX_VPS_LAYER_ID_PLUS1, "Index of PTL for each layer")
    869   ("ListOfProfileTierLevelOls%d", cfg_listOfLayerPTLOfOlss, string(""), MAX_VPS_OUTPUT_LAYER_SETS_PLUS1, "PTL Index for each layer in each OLS except the first OLS. The PTL index for layer in the first OLS is set to 1")
    870 #else
    871   ("Profile", m_profile,   Profile::NONE, "Profile to be used when encoding (Incomplete)")
    872   ("Level",   m_level,     Level::NONE,   "Level limit to be used, eg 5.1 (Incomplete)")
    873   ("Tier",    m_levelTier, Level::MAIN,   "Tier to use for interpretation of --Level")
    874 
    875   ("ProgressiveSource", m_progressiveSourceFlag, false, "Indicate that source is progressive")
    876   ("InterlacedSource",  m_interlacedSourceFlag,  false, "Indicate that source is interlaced")
    877   ("NonPackedSource",   m_nonPackedConstraintFlag, false, "Indicate that source does not contain frame packing")
    878   ("FrameOnly",         m_frameOnlyConstraintFlag, false, "Indicate that the bitstream contains only frames")
     1317  ("LayerPTLIndex%d",                                 cfg_layerPTLIdx,               0, MAX_VPS_LAYER_ID_PLUS1, "Index of PTL for each layer")
     1318  ("ListOfProfileTierLevelOls%d",                     cfg_listOfLayerPTLOfOlss, string(""), MAX_VPS_OUTPUT_LAYER_SETS_PLUS1, "PTL Index for each layer in each OLS except the first OLS. The PTL index for layer in the first OLS is set to 1")
     1319#else
     1320  ("Profile",                                         extendedProfile,                                   NONE, "Profile name to use for encoding. Use main (for main), main10 (for main10), main-still-picture, main-RExt (for Range Extensions profile), any of the RExt specific profile names, or none")
     1321  ("Level",                                           m_level,                                    Level::NONE, "Level limit to be used, eg 5.1, or none")
     1322  ("Tier",                                            m_levelTier,                                Level::MAIN, "Tier to use for interpretation of --Level (main or high only)")
     1323  ("MaxBitDepthConstraint",                           m_bitDepthConstraint,                                0u, "Bit depth to use for profile-constraint for RExt profiles. 0=automatically choose based upon other parameters")
     1324  ("MaxChromaFormatConstraint",                       tmpConstraintChromaFormat,                            0, "Chroma-format to use for the profile-constraint for RExt profiles. 0=automatically choose based upon other parameters")
     1325  ("IntraConstraintFlag",                             m_intraConstraintFlag,                            false, "Value of general_intra_constraint_flag to use for RExt profiles (not used if an explicit RExt sub-profile is specified)")
     1326  ("LowerBitRateConstraintFlag",                      m_lowerBitRateConstraintFlag,                      true, "Value of general_lower_bit_rate_constraint_flag to use for RExt profiles")
     1327
     1328  ("ProgressiveSource",                               m_progressiveSourceFlag,                          false, "Indicate that source is progressive")
     1329  ("InterlacedSource",                                m_interlacedSourceFlag,                           false, "Indicate that source is interlaced")
     1330  ("NonPackedSource",                                 m_nonPackedConstraintFlag,                        false, "Indicate that source does not contain frame packing")
     1331  ("FrameOnly",                                       m_frameOnlyConstraintFlag,                        false, "Indicate that the bitstream contains only frames")
    8791332#endif
    8801333
    8811334#if LAYER_CTB
    8821335  // Unit definition parameters
    883   ("MaxCUWidth%d",              cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU width")
    884   ("MaxCUHeight%d",             cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU height")
     1336  ("MaxCUWidth%d",                                    cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU width")
     1337  ("MaxCUHeight%d",                                   cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU height")
    8851338  // todo: remove defaults from MaxCUSize
    886   ("MaxCUSize%d,s%d",           cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU size")
    887   ("MaxCUSize%d,s%d",           cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU size")
    888   ("MaxPartitionDepth%d,h%d",   cfg_uiMaxCUDepth,              4u, MAX_LAYERS, "CU depth")
     1339  ("MaxCUSize%d,s%d",                                 cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU size")
     1340  ("MaxCUSize%d,s%d",                                 cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU size")
     1341  ("MaxPartitionDepth%d,h%d",                         cfg_uiMaxCUDepth,              4u, MAX_LAYERS, "CU depth")
    8891342 
    890   ("QuadtreeTULog2MaxSize%d",   cfg_uiQuadtreeTULog2MaxSize,   6u, MAX_LAYERS, "Maximum TU size in logarithm base 2")
    891   ("QuadtreeTULog2MinSize%d",   cfg_uiQuadtreeTULog2MinSize,   2u, MAX_LAYERS, "Minimum TU size in logarithm base 2")
     1343  ("QuadtreeTULog2MaxSize%d",                         cfg_uiQuadtreeTULog2MaxSize,   6u, MAX_LAYERS, "Maximum TU size in logarithm base 2")
     1344  ("QuadtreeTULog2MinSize%d",                         cfg_uiQuadtreeTULog2MinSize,   2u, MAX_LAYERS, "Minimum TU size in logarithm base 2")
    8921345 
    893   ("QuadtreeTUMaxDepthIntra%d", cfg_uiQuadtreeTUMaxDepthIntra, 1u, MAX_LAYERS, "Depth of TU tree for intra CUs")
    894   ("QuadtreeTUMaxDepthInter%d", cfg_uiQuadtreeTUMaxDepthInter, 2u, MAX_LAYERS, "Depth of TU tree for inter CUs")
     1346  ("QuadtreeTUMaxDepthIntra%d",                       cfg_uiQuadtreeTUMaxDepthIntra, 1u, MAX_LAYERS, "Depth of TU tree for intra CUs")
     1347  ("QuadtreeTUMaxDepthInter%d",                       cfg_uiQuadtreeTUMaxDepthInter, 2u, MAX_LAYERS, "Depth of TU tree for inter CUs")
    8951348
    8961349
    8971350  // set the same CU realted settings across all the layers if config file parameters are not layer specific
    898   ("MaxCUWidth",              cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU width")
    899   ("MaxCUHeight",             cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU height")
     1351  ("MaxCUWidth",                                      cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU width")
     1352  ("MaxCUHeight",                                     cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU height")
    9001353  // todo: remove defaults from MaxCUSize
    901   ("MaxCUSize,s",             cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU size")
    902   ("MaxCUSize,s",             cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU size")
    903   ("MaxPartitionDepth,h",     cfg_uiMaxCUDepth,              4u, MAX_LAYERS, "CU depth")
     1354  ("MaxCUSize,s",                                     cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU size")
     1355  ("MaxCUSize,s",                                     cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU size")
     1356  ("MaxPartitionDepth,h",                             cfg_uiMaxCUDepth,              4u, MAX_LAYERS, "CU depth")
    9041357 
    905   ("QuadtreeTULog2MaxSize",   cfg_uiQuadtreeTULog2MaxSize,   6u, MAX_LAYERS, "Maximum TU size in logarithm base 2")
    906   ("QuadtreeTULog2MinSize",   cfg_uiQuadtreeTULog2MinSize,   2u, MAX_LAYERS, "Minimum TU size in logarithm base 2")
     1358  ("QuadtreeTULog2MaxSize",                           cfg_uiQuadtreeTULog2MaxSize,   6u, MAX_LAYERS, "Maximum TU size in logarithm base 2")
     1359  ("QuadtreeTULog2MinSize",                           cfg_uiQuadtreeTULog2MinSize,   2u, MAX_LAYERS, "Minimum TU size in logarithm base 2")
    9071360 
    908   ("QuadtreeTUMaxDepthIntra", cfg_uiQuadtreeTUMaxDepthIntra, 1u, MAX_LAYERS, "Depth of TU tree for intra CUs")
    909   ("QuadtreeTUMaxDepthInter", cfg_uiQuadtreeTUMaxDepthInter, 2u, MAX_LAYERS, "Depth of TU tree for inter CUs")
     1361  ("QuadtreeTUMaxDepthIntra",                         cfg_uiQuadtreeTUMaxDepthIntra, 1u, MAX_LAYERS, "Depth of TU tree for intra CUs")
     1362  ("QuadtreeTUMaxDepthInter",                         cfg_uiQuadtreeTUMaxDepthInter, 2u, MAX_LAYERS, "Depth of TU tree for inter CUs")
    9101363#else
    9111364  // Unit definition parameters
    912   ("MaxCUWidth",              m_uiMaxCUWidth,             64u)
    913   ("MaxCUHeight",             m_uiMaxCUHeight,            64u)
     1365  ("MaxCUWidth",                                      m_uiMaxCUWidth,                                     64u)
     1366  ("MaxCUHeight",                                     m_uiMaxCUHeight,                                    64u)
    9141367  // todo: remove defaults from MaxCUSize
    915   ("MaxCUSize,s",             m_uiMaxCUWidth,             64u, "Maximum CU size")
    916   ("MaxCUSize,s",             m_uiMaxCUHeight,            64u, "Maximum CU size")
    917   ("MaxPartitionDepth,h",     m_uiMaxCUDepth,              4u, "CU depth")
    918  
    919   ("QuadtreeTULog2MaxSize",   m_uiQuadtreeTULog2MaxSize,   6u, "Maximum TU size in logarithm base 2")
    920   ("QuadtreeTULog2MinSize",   m_uiQuadtreeTULog2MinSize,   2u, "Minimum TU size in logarithm base 2")
    921  
    922   ("QuadtreeTUMaxDepthIntra", m_uiQuadtreeTUMaxDepthIntra, 1u, "Depth of TU tree for intra CUs")
    923   ("QuadtreeTUMaxDepthInter", m_uiQuadtreeTUMaxDepthInter, 2u, "Depth of TU tree for inter CUs")
     1368  ("MaxCUSize,s",                                     m_uiMaxCUWidth,                                     64u, "Maximum CU size")
     1369  ("MaxCUSize,s",                                     m_uiMaxCUHeight,                                    64u, "Maximum CU size")
     1370  ("MaxPartitionDepth,h",                             m_uiMaxCUDepth,                                      4u, "CU depth")
     1371
     1372  ("QuadtreeTULog2MaxSize",                           m_uiQuadtreeTULog2MaxSize,                           6u, "Maximum TU size in logarithm base 2")
     1373  ("QuadtreeTULog2MinSize",                           m_uiQuadtreeTULog2MinSize,                           2u, "Minimum TU size in logarithm base 2")
     1374
     1375  ("QuadtreeTUMaxDepthIntra",                         m_uiQuadtreeTUMaxDepthIntra,                        1u, "Depth of TU tree for intra CUs")
     1376  ("QuadtreeTUMaxDepthInter",                         m_uiQuadtreeTUMaxDepthInter,                        2u, "Depth of TU tree for inter CUs")
    9241377#endif
    9251378 
    9261379  // Coding structure paramters
    9271380#if SVC_EXTENSION
    928   ("IntraPeriod%d,-ip%d",  cfg_IntraPeriod, -1, MAX_LAYERS, "intra period in frames for layer %d, (-1: only first frame)")
    929 #else
    930   ("IntraPeriod,-ip",         m_iIntraPeriod,              -1, "Intra period in frames, (-1: only first frame)")
     1381  ("IntraPeriod%d,-ip%d",                             cfg_IntraPeriod, -1, MAX_LAYERS, "intra period in frames for layer %d, (-1: only first frame)")
     1382#else
     1383  ("IntraPeriod,-ip",                                 m_iIntraPeriod,                                      -1, "Intra period in frames, (-1: only first frame)")
    9311384#endif
    9321385#if ALLOW_RECOVERY_POINT_AS_RAP
    933   ("DecodingRefreshType,-dr", m_iDecodingRefreshType,       0, "Intra refresh type (0:none 1:CRA 2:IDR 3:RecPointSEI)")
    934 #else
    935   ("DecodingRefreshType,-dr", m_iDecodingRefreshType,       0, "Intra refresh type (0:none 1:CRA 2:IDR)")
    936 #endif
    937   ("GOPSize,g",               m_iGOPSize,                   1, "GOP size of temporal structure")
    938   // motion options
    939   ("FastSearch",              m_iFastSearch,                1, "0:Full search  1:Diamond  2:PMVFAST")
    940   ("SearchRange,-sr",         m_iSearchRange,              96, "Motion search range")
    941   ("BipredSearchRange",       m_bipredSearchRange,          4, "Motion search range for bipred refinement")
    942   ("HadamardME",              m_bUseHADME,               true, "Hadamard ME for fractional-pel")
    943   ("ASR",                     m_bUseASR,                false, "Adaptive motion search range")
     1386  ("DecodingRefreshType,-dr",                         m_iDecodingRefreshType,                               0, "Intra refresh type (0:none 1:CRA 2:IDR 3:RecPointSEI)")
     1387#else
     1388  ("DecodingRefreshType,-dr",                         m_iDecodingRefreshType,                               0, "Intra refresh type (0:none 1:CRA 2:IDR)")
     1389#endif
     1390  ("GOPSize,g",                                       m_iGOPSize,                                           1, "GOP size of temporal structure")
     1391
     1392  // motion search options
     1393  ("FastSearch",                                      m_iFastSearch,                                        1, "0:Full search  1:Diamond  2:PMVFAST")
     1394  ("SearchRange,-sr",                                 m_iSearchRange,                                      96, "Motion search range")
     1395  ("BipredSearchRange",                               m_bipredSearchRange,                                  4, "Motion search range for bipred refinement")
     1396  ("HadamardME",                                      m_bUseHADME,                                       true, "Hadamard ME for fractional-pel")
     1397  ("ASR",                                             m_bUseASR,                                        false, "Adaptive motion search range")
    9441398
    9451399#if SVC_EXTENSION
    946   ("LambdaModifier%d,-LM%d",  m_adLambdaModifier, ( double )1.0, MAX_TLAYER, "Lambda modifier for temporal layer %d")
     1400  ("LambdaModifier%d,-LM%d",                          m_adLambdaModifier, ( double )1.0, MAX_TLAYER, "Lambda modifier for temporal layer %d")
    9471401#else
    9481402  // Mode decision parameters
    949   ("LambdaModifier0,-LM0", m_adLambdaModifier[ 0 ], ( Double )1.0, "Lambda modifier for temporal layer 0")
    950   ("LambdaModifier1,-LM1", m_adLambdaModifier[ 1 ], ( Double )1.0, "Lambda modifier for temporal layer 1")
    951   ("LambdaModifier2,-LM2", m_adLambdaModifier[ 2 ], ( Double )1.0, "Lambda modifier for temporal layer 2")
    952   ("LambdaModifier3,-LM3", m_adLambdaModifier[ 3 ], ( Double )1.0, "Lambda modifier for temporal layer 3")
    953   ("LambdaModifier4,-LM4", m_adLambdaModifier[ 4 ], ( Double )1.0, "Lambda modifier for temporal layer 4")
    954   ("LambdaModifier5,-LM5", m_adLambdaModifier[ 5 ], ( Double )1.0, "Lambda modifier for temporal layer 5")
    955   ("LambdaModifier6,-LM6", m_adLambdaModifier[ 6 ], ( Double )1.0, "Lambda modifier for temporal layer 6")
     1403  // Mode decision parameters
     1404  ("LambdaModifier0,-LM0",                            m_adLambdaModifier[ 0 ],                  ( Double )1.0, "Lambda modifier for temporal layer 0")
     1405  ("LambdaModifier1,-LM1",                            m_adLambdaModifier[ 1 ],                  ( Double )1.0, "Lambda modifier for temporal layer 1")
     1406  ("LambdaModifier2,-LM2",                            m_adLambdaModifier[ 2 ],                  ( Double )1.0, "Lambda modifier for temporal layer 2")
     1407  ("LambdaModifier3,-LM3",                            m_adLambdaModifier[ 3 ],                  ( Double )1.0, "Lambda modifier for temporal layer 3")
     1408  ("LambdaModifier4,-LM4",                            m_adLambdaModifier[ 4 ],                  ( Double )1.0, "Lambda modifier for temporal layer 4")
     1409  ("LambdaModifier5,-LM5",                            m_adLambdaModifier[ 5 ],                  ( Double )1.0, "Lambda modifier for temporal layer 5")
     1410  ("LambdaModifier6,-LM6",                            m_adLambdaModifier[ 6 ],                  ( Double )1.0, "Lambda modifier for temporal layer 6")
    9561411#endif
    9571412
    9581413  /* Quantization parameters */
    9591414#if SVC_EXTENSION
    960   ("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")
    961 #else
    962   ("QP,q",          m_fQP,             30.0, "Qp value, if value is float, QP is switched once during encoding")
    963 #endif
    964   ("DeltaQpRD,-dqr",m_uiDeltaQpRD,       0u, "max dQp offset for slice")
    965   ("MaxDeltaQP,d",  m_iMaxDeltaQP,        0, "max dQp offset for block")
    966   ("MaxCuDQPDepth,-dqd",  m_iMaxCuDQPDepth,        0, "max depth for a minimum CuDQP")
    967 
    968   ("CbQpOffset,-cbqpofs",  m_cbQpOffset,        0, "Chroma Cb QP Offset")
    969   ("CrQpOffset,-crqpofs",  m_crQpOffset,        0, "Chroma Cr QP Offset")
     1415  ("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")
     1416#else
     1417  ("QP,q",                                            m_fQP,                                             30.0, "Qp value, if value is float, QP is switched once during encoding")
     1418#endif
     1419  ("DeltaQpRD,-dqr",                                  m_uiDeltaQpRD,                                       0u, "max dQp offset for slice")
     1420  ("MaxDeltaQP,d",                                    m_iMaxDeltaQP,                                        0, "max dQp offset for block")
     1421  ("MaxCuDQPDepth,-dqd",                              m_iMaxCuDQPDepth,                                     0, "max depth for a minimum CuDQP")
     1422  ("MaxCUChromaQpAdjustmentDepth",                    m_maxCUChromaQpAdjustmentDepth,                      -1, "Maximum depth for CU chroma Qp adjustment - set less than 0 to disable")
     1423
     1424  ("CbQpOffset,-cbqpofs",                             m_cbQpOffset,                                         0, "Chroma Cb QP Offset")
     1425  ("CrQpOffset,-crqpofs",                             m_crQpOffset,                                         0, "Chroma Cr QP Offset")
    9701426
    9711427#if ADAPTIVE_QP_SELECTION
    972   ("AdaptiveQpSelection,-aqps",   m_bUseAdaptQpSelect,           false, "AdaptiveQpSelection")
    973 #endif
    974 
    975   ("AdaptiveQP,-aq",                m_bUseAdaptiveQP,           false, "QP adaptation based on a psycho-visual model")
    976   ("MaxQPAdaptationRange,-aqr",     m_iQPAdaptationRange,           6, "QP adaptation range")
     1428  ("AdaptiveQpSelection,-aqps",                       m_bUseAdaptQpSelect,                              false, "AdaptiveQpSelection")
     1429#endif
     1430
     1431  ("AdaptiveQP,-aq",                                  m_bUseAdaptiveQP,                                 false, "QP adaptation based on a psycho-visual model")
     1432  ("MaxQPAdaptationRange,-aqr",                       m_iQPAdaptationRange,                                 6, "QP adaptation range")
    9771433#if !SVC_EXTENSION
    978   ("dQPFile,m",                     cfg_dQPFile,           string(""), "dQP file name")
    979 #endif
    980   ("RDOQ",                          m_useRDOQ,                  true )
    981   ("RDOQTS",                        m_useRDOQTS,                true )
    982   ("RDpenalty",                     m_rdPenalty,                0,  "RD-penalty for 32x32 TU for intra in non-intra slices. 0:disbaled  1:RD-penalty  2:maximum RD-penalty")
    983  
     1434  ("dQPFile,m",                                       cfg_dQPFile,                                 string(""), "dQP file name")
     1435#endif
     1436  ("RDOQ",                                            m_useRDOQ,                                         true)
     1437  ("RDOQTS",                                          m_useRDOQTS,                                       true)
     1438  ("RDpenalty",                                       m_rdPenalty,                                          0,  "RD-penalty for 32x32 TU for intra in non-intra slices. 0:disabled  1:RD-penalty  2:maximum RD-penalty")
     1439
    9841440  // Deblocking filter parameters
    985   ("LoopFilterDisable",              m_bLoopFilterDisable,             false )
    986   ("LoopFilterOffsetInPPS",          m_loopFilterOffsetInPPS,          false )
    987   ("LoopFilterBetaOffset_div2",      m_loopFilterBetaOffsetDiv2,           0 )
    988   ("LoopFilterTcOffset_div2",        m_loopFilterTcOffsetDiv2,             0 )
    989   ("DeblockingFilterControlPresent", m_DeblockingFilterControlPresent, false )
    990   ("DeblockingFilterMetric",         m_DeblockingFilterMetric,         false )
     1441  ("LoopFilterDisable",                               m_bLoopFilterDisable,                             false)
     1442  ("LoopFilterOffsetInPPS",                           m_loopFilterOffsetInPPS,                          false)
     1443  ("LoopFilterBetaOffset_div2",                       m_loopFilterBetaOffsetDiv2,                           0)
     1444  ("LoopFilterTcOffset_div2",                         m_loopFilterTcOffsetDiv2,                             0)
     1445  ("DeblockingFilterControlPresent",                  m_DeblockingFilterControlPresent,                 false)
     1446  ("DeblockingFilterMetric",                          m_DeblockingFilterMetric,                         false)
    9911447
    9921448  // Coding tools
    993   ("AMP",                      m_enableAMP,                 true,  "Enable asymmetric motion partitions")
    994   ("TransformSkip",            m_useTransformSkip,          false, "Intra transform skipping")
    995   ("TransformSkipFast",        m_useTransformSkipFast,      false, "Fast intra transform skipping")
    996   ("SAO",                      m_bUseSAO,                   true,  "Enable Sample Adaptive Offset")
    997   ("MaxNumOffsetsPerPic",      m_maxNumOffsetsPerPic,       2048,  "Max number of SAO offset per picture (Default: 2048)")   
    998   ("SAOLcuBoundary",           m_saoLcuBoundary,            false, "0: right/bottom LCU boundary areas skipped from SAO parameter estimation, 1: non-deblocked pixels are used for those areas")
    999   ("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")
    1000   ("SliceArgument",            m_sliceArgument,            0,     "Depending on SliceMode being:"
    1001                                                                    "\t1: max number of CTUs per slice"
    1002                                                                    "\t2: max number of bytes per slice"
    1003                                                                    "\t3: max number of tiles per slice")
    1004   ("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")
    1005   ("SliceSegmentArgument",     m_sliceSegmentArgument,   0,     "Depending on SliceSegmentMode being:"
    1006                                                                    "\t1: max number of CTUs per slice segment"
    1007                                                                    "\t2: max number of bytes per slice segment"
    1008                                                                    "\t3: max number of tiles per slice segment")
    1009   ("LFCrossSliceBoundaryFlag", m_bLFCrossSliceBoundaryFlag, true)
    1010 
    1011   ("ConstrainedIntraPred",     m_bUseConstrainedIntraPred,  false, "Constrained Intra Prediction")
    1012 
    1013   ("PCMEnabledFlag",           m_usePCM,                    false)
    1014   ("PCMLog2MaxSize",           m_pcmLog2MaxSize,            5u)
    1015   ("PCMLog2MinSize",           m_uiPCMLog2MinSize,          3u)
    1016   ("PCMInputBitDepthFlag",     m_bPCMInputBitDepthFlag,     true)
    1017   ("PCMFilterDisableFlag",     m_bPCMFilterDisableFlag,    false)
    1018 
    1019   ("WeightedPredP,-wpP",          m_useWeightedPred,               false,      "Use weighted prediction in P slices")
    1020   ("WeightedPredB,-wpB",          m_useWeightedBiPred,             false,      "Use weighted (bidirectional) prediction in B slices")
    1021   ("Log2ParallelMergeLevel",      m_log2ParallelMergeLevel,     2u,          "Parallel merge estimation region")
    1022 
    1023   //deprecated copies of renamed tile parameters
    1024   ("UniformSpacingIdc",           m_tileUniformSpacingFlag,        false,      "deprecated alias of TileUniformSpacing")
    1025   ("ColumnWidthArray",            cfgColumnWidth,                  string(""), "deprecated alias of TileColumnWidthArray")
    1026   ("RowHeightArray",              cfgRowHeight,                    string(""), "deprecated alias of TileRowHeightArray")
    1027 
    1028   ("TileUniformSpacing",          m_tileUniformSpacingFlag,        false,      "Indicates that tile columns and rows are distributed uniformly")
    1029   ("NumTileColumnsMinus1",        m_numTileColumnsMinus1,          0,          "Number of tile columns in a picture minus 1")
    1030   ("NumTileRowsMinus1",           m_numTileRowsMinus1,             0,          "Number of rows in a picture minus 1")
    1031   ("TileColumnWidthArray",        cfgColumnWidth,                  string(""), "Array containing tile column width values in units of LCU")
    1032   ("TileRowHeightArray",          cfgRowHeight,                    string(""), "Array containing tile row height values in units of LCU")
    1033   ("LFCrossTileBoundaryFlag",      m_bLFCrossTileBoundaryFlag,             true,          "1: cross-tile-boundary loop filtering. 0:non-cross-tile-boundary loop filtering")
     1449  ("AMP",                                             m_enableAMP,                                       true, "Enable asymmetric motion partitions")
     1450  ("CrossComponentPrediction",                        m_useCrossComponentPrediction,                    false, "Enable the use of cross-component prediction (not valid in V1 profiles)")
     1451  ("ReconBasedCrossCPredictionEstimate",              m_reconBasedCrossCPredictionEstimate,             false, "When determining the alpha value for cross-component prediction, use the decoded residual rather than the pre-transform encoder-side residual")
     1452  ("SaoLumaOffsetBitShift",                           saoOffsetBitShift[CHANNEL_TYPE_LUMA],                 0, "Specify the luma SAO bit-shift. If negative, automatically calculate a suitable value based upon bit depth and initial QP")
     1453  ("SaoChromaOffsetBitShift",                         saoOffsetBitShift[CHANNEL_TYPE_CHROMA],               0, "Specify the chroma SAO bit-shift. If negative, automatically calculate a suitable value based upon bit depth and initial QP")
     1454  ("TransformSkip",                                   m_useTransformSkip,                               false, "Intra transform skipping")
     1455  ("TransformSkipFast",                               m_useTransformSkipFast,                           false, "Fast intra transform skipping")
     1456  ("TransformSkipLog2MaxSize",                        m_transformSkipLog2MaxSize,                          2U, "Specify transform-skip maximum size. Minimum 2. (not valid in V1 profiles)")
     1457  ("ImplicitResidualDPCM",                            m_useResidualDPCM[RDPCM_SIGNAL_IMPLICIT],         false, "Enable implicitly signalled residual DPCM for intra (also known as sample-adaptive intra predict) (not valid in V1 profiles)")
     1458  ("ExplicitResidualDPCM",                            m_useResidualDPCM[RDPCM_SIGNAL_EXPLICIT],         false, "Enable explicitly signalled residual DPCM for inter (not valid in V1 profiles)")
     1459  ("ResidualRotation",                                m_useResidualRotation,                            false, "Enable rotation of transform-skipped and transquant-bypassed TUs through 180 degrees prior to entropy coding (not valid in V1 profiles)")
     1460  ("SingleSignificanceMapContext",                    m_useSingleSignificanceMapContext,                false, "Enable, for transform-skipped and transquant-bypassed TUs, the selection of a single significance map context variable for all coefficients (not valid in V1 profiles)")
     1461  ("GolombRiceParameterAdaptation",                   m_useGolombRiceParameterAdaptation,               false, "Enable the adaptation of the Golomb-Rice parameter over the course of each slice")
     1462  ("AlignCABACBeforeBypass",                          m_alignCABACBeforeBypass,                         false, "Align the CABAC engine to a defined fraction of a bit prior to coding bypass data. Must be 1 in high bit rate profile, 0 otherwise" )
     1463  ("SAO",                                             m_bUseSAO,                                         true, "Enable Sample Adaptive Offset")
     1464  ("MaxNumOffsetsPerPic",                             m_maxNumOffsetsPerPic,                             2048, "Max number of SAO offset per picture (Default: 2048)")
     1465  ("SAOLcuBoundary",                                  m_saoCtuBoundary,                                 false, "0: right/bottom CTU boundary areas skipped from SAO parameter estimation, 1: non-deblocked pixels are used for those areas")
     1466  ("SliceMode",                                       m_sliceMode,                                          0, "0: Disable all Recon slice limits, 1: Enforce max # of CTUs, 2: Enforce max # of bytes, 3:specify tiles per dependent slice")
     1467  ("SliceArgument",                                   m_sliceArgument,                                      0, "Depending on SliceMode being:"
     1468                                                                                                               "\t1: max number of CTUs per slice"
     1469                                                                                                               "\t2: max number of bytes per slice"
     1470                                                                                                               "\t3: max number of tiles per slice")
     1471  ("SliceSegmentMode",                                m_sliceSegmentMode,                                   0, "0: Disable all slice segment limits, 1: Enforce max # of CTUs, 2: Enforce max # of bytes, 3:specify tiles per dependent slice")
     1472  ("SliceSegmentArgument",                            m_sliceSegmentArgument,                               0, "Depending on SliceSegmentMode being:"
     1473                                                                                                               "\t1: max number of CTUs per slice segment"
     1474                                                                                                               "\t2: max number of bytes per slice segment"
     1475                                                                                                               "\t3: max number of tiles per slice segment")
     1476  ("LFCrossSliceBoundaryFlag",                        m_bLFCrossSliceBoundaryFlag,                       true)
     1477
     1478  ("ConstrainedIntraPred",                            m_bUseConstrainedIntraPred,                       false, "Constrained Intra Prediction")
     1479  ("PCMEnabledFlag",                                  m_usePCM,                                         false)
     1480  ("PCMLog2MaxSize",                                  m_pcmLog2MaxSize,                                    5u)
     1481  ("PCMLog2MinSize",                                  m_uiPCMLog2MinSize,                                  3u)
     1482
     1483  ("PCMInputBitDepthFlag",                            m_bPCMInputBitDepthFlag,                           true)
     1484  ("PCMFilterDisableFlag",                            m_bPCMFilterDisableFlag,                          false)
     1485  ("IntraReferenceSmoothing",                         m_enableIntraReferenceSmoothing,                   true, "0: Disable use of intra reference smoothing. 1: Enable use of intra reference smoothing (not valid in V1 profiles)")
     1486  ("WeightedPredP,-wpP",                              m_useWeightedPred,                                false, "Use weighted prediction in P slices")
     1487  ("WeightedPredB,-wpB",                              m_useWeightedBiPred,                              false, "Use weighted (bidirectional) prediction in B slices")
     1488  ("Log2ParallelMergeLevel",                          m_log2ParallelMergeLevel,                            2u, "Parallel merge estimation region")
     1489    //deprecated copies of renamed tile parameters
     1490  ("UniformSpacingIdc",                               m_tileUniformSpacingFlag,                         false,      "deprecated alias of TileUniformSpacing")
     1491  ("ColumnWidthArray",                                cfg_ColumnWidth,                        cfg_ColumnWidth, "deprecated alias of TileColumnWidthArray")
     1492  ("RowHeightArray",                                  cfg_RowHeight,                            cfg_RowHeight, "deprecated alias of TileRowHeightArray")
     1493
     1494  ("TileUniformSpacing",                              m_tileUniformSpacingFlag,                         false,      "Indicates that tile columns and rows are distributed uniformly")
     1495  ("NumTileColumnsMinus1",                            m_numTileColumnsMinus1,                               0,          "Number of tile columns in a picture minus 1")
     1496  ("NumTileRowsMinus1",                               m_numTileRowsMinus1,                                  0,          "Number of rows in a picture minus 1")
     1497  ("TileColumnWidthArray",                            cfg_ColumnWidth,                        cfg_ColumnWidth, "Array containing tile column width values in units of CTU")
     1498  ("TileRowHeightArray",                              cfg_RowHeight,                            cfg_RowHeight, "Array containing tile row height values in units of CTU")
     1499  ("LFCrossTileBoundaryFlag",                         m_bLFCrossTileBoundaryFlag,                        true, "1: cross-tile-boundary loop filtering. 0:non-cross-tile-boundary loop filtering")
    10341500#if SVC_EXTENSION
    1035   ("WaveFrontSynchro%d",          cfg_waveFrontSynchro,             0,  MAX_LAYERS,          "0: no synchro; 1 synchro with TR; 2 TRR etc")
    1036 #else
    1037   ("WaveFrontSynchro",            m_iWaveFrontSynchro,             0,          "0: no synchro; 1 synchro with TR; 2 TRR etc")
    1038 #endif
    1039   ("ScalingList",                 m_useScalingListId,              0,          "0: no scaling list, 1: default scaling lists, 2: scaling lists specified in ScalingListFile")
    1040   ("ScalingListFile",             cfg_ScalingListFile,             string(""), "Scaling list file name")
    1041   ("SignHideFlag,-SBH",                m_signHideFlag, 1)
    1042   ("MaxNumMergeCand",             m_maxNumMergeCand,             5u,         "Maximum number of merge candidates")
    1043 
     1501  ("WaveFrontSynchro%d",                              cfg_waveFrontSynchro,             0,  MAX_LAYERS,          "0: no synchro; 1 synchro with TR; 2 TRR etc")
     1502#else
     1503  ("WaveFrontSynchro",                                m_iWaveFrontSynchro,                                  0, "0: no synchro; 1 synchro with top-right-right")
     1504#endif
     1505  ("ScalingList",                                     m_useScalingListId,                    SCALING_LIST_OFF, "0/off: no scaling list, 1/default: default scaling lists, 2/file: scaling lists specified in ScalingListFile")
     1506  ("ScalingListFile",                                 cfg_ScalingListFile,                         string(""), "Scaling list file name. Use an empty string to produce help.")
     1507  ("SignHideFlag,-SBH",                               m_signHideFlag,                                       1)
     1508  ("MaxNumMergeCand",                                 m_maxNumMergeCand,                                   5u, "Maximum number of merge candidates")
    10441509  /* Misc. */
    1045   ("SEIDecodedPictureHash",       m_decodedPictureHashSEIEnabled, 0, "Control generation of decode picture hash SEI messages\n"
    1046                                                                     "\t3: checksum\n"
    1047                                                                     "\t2: CRC\n"
    1048                                                                     "\t1: use MD5\n"
    1049                                                                     "\t0: disable")
    1050   ("SEIpictureDigest",            m_decodedPictureHashSEIEnabled, 0, "deprecated alias for SEIDecodedPictureHash")
    1051   ("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")
    1052   ("FEN", m_bUseFastEnc, false, "fast encoder setting")
    1053   ("ECU", m_bUseEarlyCU, false, "Early CU setting")
    1054   ("FDM", m_useFastDecisionForMerge, true, "Fast decision for Merge RD Cost")
    1055   ("CFM", m_bUseCbfFastMode, false, "Cbf fast mode setting")
    1056   ("ESD", m_useEarlySkipDetection, false, "Early SKIP detection setting")
     1510  ("SEIDecodedPictureHash",                           m_decodedPictureHashSEIEnabled,                      0, "Control generation of decode picture hash SEI messages\n"
     1511                                                                                                               "\t3: checksum\n"
     1512                                                                                                               "\t2: CRC\n"
     1513                                                                                                               "\t1: use MD5\n"
     1514                                                                                                               "\t0: disable")
     1515  ("SEIpictureDigest",                                m_decodedPictureHashSEIEnabled,                      0, "deprecated alias for SEIDecodedPictureHash")
     1516  ("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")
     1517  ("FEN",                                             m_bUseFastEnc,                                    false, "fast encoder setting")
     1518  ("ECU",                                             m_bUseEarlyCU,                                    false, "Early CU setting")
     1519  ("FDM",                                             m_useFastDecisionForMerge,                         true, "Fast decision for Merge RD Cost")
     1520  ("CFM",                                             m_bUseCbfFastMode,                                false, "Cbf fast mode setting")
     1521  ("ESD",                                             m_useEarlySkipDetection,                          false, "Early SKIP detection setting")
    10571522#if FAST_INTRA_SHVC
    1058   ("FIS", m_useFastIntraScalable, false, "Fast Intra Decision for Scalable HEVC")
     1523  ("FIS",                                             m_useFastIntraScalable, false, "Fast Intra Decision for Scalable HEVC")
    10591524#endif
    10601525#if RC_SHVC_HARMONIZATION
    1061   ("RateControl%d", cfg_RCEnableRateControl, false, MAX_LAYERS, "Rate control: enable rate control for layer %d")
    1062   ("TargetBitrate%d", cfg_RCTargetBitRate, 0, MAX_LAYERS, "Rate control: target bitrate for layer %d")
    1063   ("KeepHierarchicalBit%d", cfg_RCKeepHierarchicalBit, false, MAX_LAYERS, "Rate control: keep hierarchical bit allocation for layer %d")
    1064   ("LCULevelRateControl%d", cfg_RCLCULevelRC, true, MAX_LAYERS, "Rate control: LCU level RC")
    1065   ("RCLCUSeparateModel%d", cfg_RCUseLCUSeparateModel, true, MAX_LAYERS, "Rate control: Use LCU level separate R-lambda model")
    1066   ("InitialQP%d", cfg_RCInitialQP, 0, MAX_LAYERS, "Rate control: initial QP")
    1067   ("RCForceIntraQP%d", cfg_RCForceIntraQP, false, MAX_LAYERS, "Rate control: force intra QP to be equal to initial QP")
    1068 #else
    1069   ( "RateControl",         m_RCEnableRateControl,   false, "Rate control: enable rate control" )
    1070   ( "TargetBitrate",       m_RCTargetBitrate,           0, "Rate control: target bitrate" )
    1071   ( "KeepHierarchicalBit", m_RCKeepHierarchicalBit,     0, "Rate control: 0: equal bit allocation; 1: fixed ratio bit allocation; 2: adaptive ratio bit allocation" )
    1072   ( "LCULevelRateControl", m_RCLCULevelRC,           true, "Rate control: true: LCU level RC; false: picture level RC" )
    1073   ( "RCLCUSeparateModel",  m_RCUseLCUSeparateModel,  true, "Rate control: use LCU level separate R-lambda model" )
    1074   ( "InitialQP",           m_RCInitialQP,               0, "Rate control: initial QP" )
    1075   ( "RCForceIntraQP",      m_RCForceIntraQP,        false, "Rate control: force intra QP to be equal to initial QP" )
    1076 #endif
    1077 
    1078   ("TransquantBypassEnableFlag", m_TransquantBypassEnableFlag, false, "transquant_bypass_enable_flag indicator in PPS")
    1079   ("CUTransquantBypassFlagForce", m_CUTransquantBypassFlagForce, false, "Force transquant bypass mode, when transquant_bypass_enable_flag is enabled")
    1080   ("RecalculateQPAccordingToLambda", m_recalculateQPAccordingToLambda, false, "Recalculate QP values according to lambda values. Do not suggest to be enabled in all intra case")
    1081   ("StrongIntraSmoothing,-sis",      m_useStrongIntraSmoothing,           true, "Enable strong intra smoothing for 32x32 blocks")
    1082   ("SEIActiveParameterSets",         m_activeParameterSetsSEIEnabled,          0, "Enable generation of active parameter sets SEI messages")
    1083   ("VuiParametersPresent,-vui",      m_vuiParametersPresentFlag,           false, "Enable generation of vui_parameters()")
    1084   ("AspectRatioInfoPresent",         m_aspectRatioInfoPresentFlag,         false, "Signals whether aspect_ratio_idc is present")
    1085   ("AspectRatioIdc",                 m_aspectRatioIdc,                         0, "aspect_ratio_idc")
    1086   ("SarWidth",                       m_sarWidth,                               0, "horizontal size of the sample aspect ratio")
    1087   ("SarHeight",                      m_sarHeight,                              0, "vertical size of the sample aspect ratio")
    1088   ("OverscanInfoPresent",            m_overscanInfoPresentFlag,            false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n")
    1089   ("OverscanAppropriate",            m_overscanAppropriateFlag,            false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n")
    1090   ("VideoSignalTypePresent",         m_videoSignalTypePresentFlag,         false, "Signals whether video_format, video_full_range_flag, and colour_description_present_flag are present")
    1091   ("VideoFormat",                    m_videoFormat,                            5, "Indicates representation of pictures")
    1092   ("VideoFullRange",                 m_videoFullRangeFlag,                 false, "Indicates the black level and range of luma and chroma signals")
    1093   ("ColourDescriptionPresent",       m_colourDescriptionPresentFlag,       false, "Signals whether colour_primaries, transfer_characteristics and matrix_coefficients are present")
    1094   ("ColourPrimaries",                m_colourPrimaries,                        2, "Indicates chromaticity coordinates of the source primaries")
    1095   ("TransferCharacteristics",        m_transferCharacteristics,                2, "Indicates the opto-electronic transfer characteristics of the source")
    1096   ("MatrixCoefficients",             m_matrixCoefficients,                     2, "Describes the matrix coefficients used in deriving luma and chroma from RGB primaries")
    1097   ("ChromaLocInfoPresent",           m_chromaLocInfoPresentFlag,           false, "Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present")
    1098   ("ChromaSampleLocTypeTopField",    m_chromaSampleLocTypeTopField,            0, "Specifies the location of chroma samples for top field")
    1099   ("ChromaSampleLocTypeBottomField", m_chromaSampleLocTypeBottomField,         0, "Specifies the location of chroma samples for bottom field")
    1100   ("NeutralChromaIndication",        m_neutralChromaIndicationFlag,        false, "Indicates that the value of all decoded chroma samples is equal to 1<<(BitDepthCr-1)")
    1101   ("DefaultDisplayWindowFlag",       m_defaultDisplayWindowFlag,           false, "Indicates the presence of the Default Window parameters")
    1102   ("DefDispWinLeftOffset",           m_defDispWinLeftOffset,                   0, "Specifies the left offset of the default display window from the conformance window")
    1103   ("DefDispWinRightOffset",          m_defDispWinRightOffset,                  0, "Specifies the right offset of the default display window from the conformance window")
    1104   ("DefDispWinTopOffset",            m_defDispWinTopOffset,                    0, "Specifies the top offset of the default display window from the conformance window")
    1105   ("DefDispWinBottomOffset",         m_defDispWinBottomOffset,                 0, "Specifies the bottom offset of the default display window from the conformance window")
    1106   ("FrameFieldInfoPresentFlag",      m_frameFieldInfoPresentFlag,               false, "Indicates that pic_struct and field coding related values are present in picture timing SEI messages")
    1107   ("PocProportionalToTimingFlag",   m_pocProportionalToTimingFlag,         false, "Indicates that the POC value is proportional to the output time w.r.t. first picture in CVS")
    1108   ("NumTicksPocDiffOneMinus1",      m_numTicksPocDiffOneMinus1,                0, "Number of ticks minus 1 that for a POC difference of one")
    1109   ("BitstreamRestriction",           m_bitstreamRestrictionFlag,           false, "Signals whether bitstream restriction parameters are present")
    1110   ("TilesFixedStructure",            m_tilesFixedStructureFlag,            false, "Indicates that each active picture parameter set has the same values of the syntax elements related to tiles")
    1111   ("MotionVectorsOverPicBoundaries", m_motionVectorsOverPicBoundariesFlag, false, "Indicates that no samples outside the picture boundaries are used for inter prediction")
    1112   ("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")
    1113   ("MaxBitsPerMinCuDenom",           m_maxBitsPerMinCuDenom,                   1, "Indicates an upper bound for the number of bits of coding_unit() data")
    1114   ("Log2MaxMvLengthHorizontal",      m_log2MaxMvLengthHorizontal,             15, "Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units")
    1115   ("Log2MaxMvLengthVertical",        m_log2MaxMvLengthVertical,               15, "Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units")
    1116   ("SEIRecoveryPoint",               m_recoveryPointSEIEnabled,                0, "Control generation of recovery point SEI messages")
    1117   ("SEIBufferingPeriod",             m_bufferingPeriodSEIEnabled,              0, "Control generation of buffering period SEI messages")
    1118   ("SEIPictureTiming",               m_pictureTimingSEIEnabled,                0, "Control generation of picture timing SEI messages")
    1119   ("SEIToneMappingInfo",                       m_toneMappingInfoSEIEnabled,    false, "Control generation of Tone Mapping SEI messages")
    1120   ("SEIToneMapId",                             m_toneMapId,                        0, "Specifies Id of Tone Mapping SEI message for a given session")
    1121   ("SEIToneMapCancelFlag",                     m_toneMapCancelFlag,            false, "Indicates that Tone Mapping SEI message cancels the persistance or follows")
    1122   ("SEIToneMapPersistenceFlag",                m_toneMapPersistenceFlag,        true, "Specifies the persistence of the Tone Mapping SEI message")
    1123   ("SEIToneMapCodedDataBitDepth",              m_toneMapCodedDataBitDepth,         8, "Specifies Coded Data BitDepth of Tone Mapping SEI messages")
    1124   ("SEIToneMapTargetBitDepth",                 m_toneMapTargetBitDepth,            8, "Specifies Output BitDepth of Tome mapping function")
    1125   ("SEIToneMapModelId",                        m_toneMapModelId,                   0, "Specifies Model utilized for mapping coded data into target_bit_depth range\n"
    1126                                                                                       "\t0:  linear mapping with clipping\n"
    1127                                                                                       "\t1:  sigmoidal mapping\n"
    1128                                                                                       "\t2:  user-defined table mapping\n"
    1129                                                                                       "\t3:  piece-wise linear mapping\n"
    1130                                                                                       "\t4:  luminance dynamic range information ")
    1131   ("SEIToneMapMinValue",                              m_toneMapMinValue,                          0, "Specifies the minimum value in mode 0")
    1132   ("SEIToneMapMaxValue",                              m_toneMapMaxValue,                       1023, "Specifies the maxmum value in mode 0")
    1133   ("SEIToneMapSigmoidMidpoint",                       m_sigmoidMidpoint,                        512, "Specifies the centre point in mode 1")
    1134   ("SEIToneMapSigmoidWidth",                          m_sigmoidWidth,                           960, "Specifies the distance between 5% and 95% values of the target_bit_depth in mode 1")
    1135   ("SEIToneMapStartOfCodedInterval",                  cfg_startOfCodedInterval,          string(""), "Array of user-defined mapping table")
    1136   ("SEIToneMapNumPivots",                             m_numPivots,                                0, "Specifies the number of pivot points in mode 3")
    1137   ("SEIToneMapCodedPivotValue",                       cfg_codedPivotValue,               string(""), "Array of pivot point")
    1138   ("SEIToneMapTargetPivotValue",                      cfg_targetPivotValue,              string(""), "Array of pivot point")
    1139   ("SEIToneMapCameraIsoSpeedIdc",                     m_cameraIsoSpeedIdc,                        0, "Indicates the camera ISO speed for daylight illumination")
    1140   ("SEIToneMapCameraIsoSpeedValue",                   m_cameraIsoSpeedValue,                    400, "Specifies the camera ISO speed for daylight illumination of Extended_ISO")
    1141   ("SEIToneMapExposureIndexIdc",                      m_exposureIndexIdc,                         0, "Indicates the exposure index setting of the camera")
    1142   ("SEIToneMapExposureIndexValue",                    m_exposureIndexValue,                     400, "Specifies the exposure index setting of the cameran of Extended_ISO")
    1143   ("SEIToneMapExposureCompensationValueSignFlag",     m_exposureCompensationValueSignFlag,        0, "Specifies the sign of ExposureCompensationValue")
    1144   ("SEIToneMapExposureCompensationValueNumerator",    m_exposureCompensationValueNumerator,       0, "Specifies the numerator of ExposureCompensationValue")
    1145   ("SEIToneMapExposureCompensationValueDenomIdc",     m_exposureCompensationValueDenomIdc,        2, "Specifies the denominator of ExposureCompensationValue")
    1146   ("SEIToneMapRefScreenLuminanceWhite",               m_refScreenLuminanceWhite,                350, "Specifies reference screen brightness setting in units of candela per square metre")
    1147   ("SEIToneMapExtendedRangeWhiteLevel",               m_extendedRangeWhiteLevel,                800, "Indicates the luminance dynamic range")
    1148   ("SEIToneMapNominalBlackLevelLumaCodeValue",        m_nominalBlackLevelLumaCodeValue,          16, "Specifies luma sample value of the nominal black level assigned decoded pictures")
    1149   ("SEIToneMapNominalWhiteLevelLumaCodeValue",        m_nominalWhiteLevelLumaCodeValue,         235, "Specifies luma sample value of the nominal white level assigned decoded pictures")
    1150   ("SEIToneMapExtendedWhiteLevelLumaCodeValue",       m_extendedWhiteLevelLumaCodeValue,        300, "Specifies luma sample value of the extended dynamic range assigned decoded pictures")
    1151   ("SEIFramePacking",                m_framePackingSEIEnabled,                 0, "Control generation of frame packing SEI messages")
    1152   ("SEIFramePackingType",            m_framePackingSEIType,                    0, "Define frame packing arrangement\n"
    1153                                                                                   "\t0: checkerboard - pixels alternatively represent either frames\n"
    1154                                                                                   "\t1: column alternation - frames are interlaced by column\n"
    1155                                                                                   "\t2: row alternation - frames are interlaced by row\n"
    1156                                                                                   "\t3: side by side - frames are displayed horizontally\n"
    1157                                                                                   "\t4: top bottom - frames are displayed vertically\n"
    1158                                                                                   "\t5: frame alternation - one frame is alternated with the other")
    1159   ("SEIFramePackingId",              m_framePackingSEIId,                      0, "Id of frame packing SEI message for a given session")
    1160   ("SEIFramePackingQuincunx",        m_framePackingSEIQuincunx,                0, "Indicate the presence of a Quincunx type video frame")
    1161   ("SEIFramePackingInterpretation",  m_framePackingSEIInterpretation,          0, "Indicate the interpretation of the frame pair\n"
    1162                                                                                   "\t0: unspecified\n"
    1163                                                                                   "\t1: stereo pair, frame0 represents left view\n"
    1164                                                                                   "\t2: stereo pair, frame0 represents right view")
    1165   ("SEIDisplayOrientation",          m_displayOrientationSEIAngle,             0, "Control generation of display orientation SEI messages\n"
    1166                                                               "\tN: 0 < N < (2^16 - 1) enable display orientation SEI message with anticlockwise_rotation = N and display_orientation_repetition_period = 1\n"
    1167                                                               "\t0: disable")
    1168   ("SEITemporalLevel0Index",         m_temporalLevel0IndexSEIEnabled,          0, "Control generation of temporal level 0 index SEI messages")
    1169   ("SEIGradualDecodingRefreshInfo",  m_gradualDecodingRefreshInfoEnabled,      0, "Control generation of gradual decoding refresh information SEI message")
    1170   ("SEIDecodingUnitInfo",             m_decodingUnitInfoSEIEnabled,                       0, "Control generation of decoding unit information SEI message.")
     1526  ("RateControl%d",                                   cfg_RCEnableRateControl, false, MAX_LAYERS, "Rate control: enable rate control for layer %d")
     1527  ("TargetBitrate%d",                                 cfg_RCTargetBitRate, 0, MAX_LAYERS, "Rate control: target bitrate for layer %d")
     1528  ("KeepHierarchicalBit%d",                           cfg_RCKeepHierarchicalBit, false, MAX_LAYERS, "Rate control: keep hierarchical bit allocation for layer %d")
     1529  ("LCULevelRateControl%d",                           cfg_RCLCULevelRC, true, MAX_LAYERS, "Rate control: LCU level RC")
     1530  ("RCLCUSeparateModel%d",                            cfg_RCUseLCUSeparateModel, true, MAX_LAYERS, "Rate control: Use LCU level separate R-lambda model")
     1531  ("InitialQP%d",                                     cfg_RCInitialQP, 0, MAX_LAYERS, "Rate control: initial QP")
     1532  ("RCForceIntraQP%d",                                cfg_RCForceIntraQP, false, MAX_LAYERS, "Rate control: force intra QP to be equal to initial QP")
     1533#else
     1534  ( "RateControl",                                    m_RCEnableRateControl,                            false, "Rate control: enable rate control" )
     1535  ( "TargetBitrate",                                  m_RCTargetBitrate,                                    0, "Rate control: target bit-rate" )
     1536  ( "KeepHierarchicalBit",                            m_RCKeepHierarchicalBit,                              0, "Rate control: 0: equal bit allocation; 1: fixed ratio bit allocation; 2: adaptive ratio bit allocation" )
     1537  ( "LCULevelRateControl",                            m_RCLCULevelRC,                                    true, "Rate control: true: CTU level RC; false: picture level RC" )
     1538  ( "RCLCUSeparateModel",                             m_RCUseLCUSeparateModel,                           true, "Rate control: use CTU level separate R-lambda model" )
     1539  ( "InitialQP",                                      m_RCInitialQP,                                        0, "Rate control: initial QP" )
     1540  ( "RCForceIntraQP",                                 m_RCForceIntraQP,                                 false, "Rate control: force intra QP to be equal to initial QP" )
     1541#endif
     1542
     1543  ("TransquantBypassEnableFlag",                      m_TransquantBypassEnableFlag,                     false, "transquant_bypass_enable_flag indicator in PPS")
     1544  ("CUTransquantBypassFlagForce",                     m_CUTransquantBypassFlagForce,                    false, "Force transquant bypass mode, when transquant_bypass_enable_flag is enabled")
     1545  ("CostMode",                                        m_costMode,                         COST_STANDARD_LOSSY, "Use alternative cost functions: choose between 'lossy', 'sequence_level_lossless', 'lossless' (which forces QP to " MACRO_TO_STRING(LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP) ") and 'mixed_lossless_lossy' (which used QP'=" MACRO_TO_STRING(LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME) " for pre-estimates of transquant-bypass blocks).")
     1546  ("RecalculateQPAccordingToLambda",                  m_recalculateQPAccordingToLambda,                 false, "Recalculate QP values according to lambda values. Do not suggest to be enabled in all intra case")
     1547  ("StrongIntraSmoothing,-sis",                       m_useStrongIntraSmoothing,                         true, "Enable strong intra smoothing for 32x32 blocks")
     1548  ("SEIActiveParameterSets",                          m_activeParameterSetsSEIEnabled,                      0, "Enable generation of active parameter sets SEI messages")
     1549  ("VuiParametersPresent,-vui",                       m_vuiParametersPresentFlag,                       false, "Enable generation of vui_parameters()")
     1550  ("AspectRatioInfoPresent",                          m_aspectRatioInfoPresentFlag,                     false, "Signals whether aspect_ratio_idc is present")
     1551  ("AspectRatioIdc",                                  m_aspectRatioIdc,                                     0, "aspect_ratio_idc")
     1552  ("SarWidth",                                        m_sarWidth,                                           0, "horizontal size of the sample aspect ratio")
     1553  ("SarHeight",                                       m_sarHeight,                                          0, "vertical size of the sample aspect ratio")
     1554  ("OverscanInfoPresent",                             m_overscanInfoPresentFlag,                        false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n")
     1555  ("OverscanAppropriate",                             m_overscanAppropriateFlag,                        false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n")
     1556  ("VideoSignalTypePresent",                          m_videoSignalTypePresentFlag,                     false, "Signals whether video_format, video_full_range_flag, and colour_description_present_flag are present")
     1557  ("VideoFormat",                                     m_videoFormat,                                        5, "Indicates representation of pictures")
     1558  ("VideoFullRange",                                  m_videoFullRangeFlag,                             false, "Indicates the black level and range of luma and chroma signals")
     1559  ("ColourDescriptionPresent",                        m_colourDescriptionPresentFlag,                   false, "Signals whether colour_primaries, transfer_characteristics and matrix_coefficients are present")
     1560  ("ColourPrimaries",                                 m_colourPrimaries,                                    2, "Indicates chromaticity coordinates of the source primaries")
     1561  ("TransferCharacteristics",                         m_transferCharacteristics,                            2, "Indicates the opto-electronic transfer characteristics of the source")
     1562  ("MatrixCoefficients",                              m_matrixCoefficients,                                 2, "Describes the matrix coefficients used in deriving luma and chroma from RGB primaries")
     1563  ("ChromaLocInfoPresent",                            m_chromaLocInfoPresentFlag,                       false, "Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present")
     1564  ("ChromaSampleLocTypeTopField",                     m_chromaSampleLocTypeTopField,                        0, "Specifies the location of chroma samples for top field")
     1565  ("ChromaSampleLocTypeBottomField",                  m_chromaSampleLocTypeBottomField,                     0, "Specifies the location of chroma samples for bottom field")
     1566  ("NeutralChromaIndication",                         m_neutralChromaIndicationFlag,                    false, "Indicates that the value of all decoded chroma samples is equal to 1<<(BitDepthCr-1)")
     1567  ("DefaultDisplayWindowFlag",                        m_defaultDisplayWindowFlag,                       false, "Indicates the presence of the Default Window parameters")
     1568  ("DefDispWinLeftOffset",                            m_defDispWinLeftOffset,                               0, "Specifies the left offset of the default display window from the conformance window")
     1569  ("DefDispWinRightOffset",                           m_defDispWinRightOffset,                              0, "Specifies the right offset of the default display window from the conformance window")
     1570  ("DefDispWinTopOffset",                             m_defDispWinTopOffset,                                0, "Specifies the top offset of the default display window from the conformance window")
     1571  ("DefDispWinBottomOffset",                          m_defDispWinBottomOffset,                             0, "Specifies the bottom offset of the default display window from the conformance window")
     1572  ("FrameFieldInfoPresentFlag",                       m_frameFieldInfoPresentFlag,                      false, "Indicates that pic_struct and field coding related values are present in picture timing SEI messages")
     1573  ("PocProportionalToTimingFlag",                     m_pocProportionalToTimingFlag,                    false, "Indicates that the POC value is proportional to the output time w.r.t. first picture in CVS")
     1574  ("NumTicksPocDiffOneMinus1",                        m_numTicksPocDiffOneMinus1,                           0, "Number of ticks minus 1 that for a POC difference of one")
     1575  ("BitstreamRestriction",                            m_bitstreamRestrictionFlag,                       false, "Signals whether bitstream restriction parameters are present")
     1576  ("TilesFixedStructure",                             m_tilesFixedStructureFlag,                        false, "Indicates that each active picture parameter set has the same values of the syntax elements related to tiles")
     1577  ("MotionVectorsOverPicBoundaries",                  m_motionVectorsOverPicBoundariesFlag,             false, "Indicates that no samples outside the picture boundaries are used for inter prediction")
     1578  ("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")
     1579  ("MaxBitsPerMinCuDenom",                            m_maxBitsPerMinCuDenom,                               1, "Indicates an upper bound for the number of bits of coding_unit() data")
     1580  ("Log2MaxMvLengthHorizontal",                       m_log2MaxMvLengthHorizontal,                         15, "Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units")
     1581  ("Log2MaxMvLengthVertical",                         m_log2MaxMvLengthVertical,                           15, "Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units")
     1582  ("SEIRecoveryPoint",                                m_recoveryPointSEIEnabled,                            0, "Control generation of recovery point SEI messages")
     1583  ("SEIBufferingPeriod",                              m_bufferingPeriodSEIEnabled,                          0, "Control generation of buffering period SEI messages")
     1584  ("SEIPictureTiming",                                m_pictureTimingSEIEnabled,                            0, "Control generation of picture timing SEI messages")
     1585  ("SEIToneMappingInfo",                              m_toneMappingInfoSEIEnabled,                      false, "Control generation of Tone Mapping SEI messages")
     1586  ("SEIToneMapId",                                    m_toneMapId,                                          0, "Specifies Id of Tone Mapping SEI message for a given session")
     1587  ("SEIToneMapCancelFlag",                            m_toneMapCancelFlag,                              false, "Indicates that Tone Mapping SEI message cancels the persistence or follows")
     1588  ("SEIToneMapPersistenceFlag",                       m_toneMapPersistenceFlag,                          true, "Specifies the persistence of the Tone Mapping SEI message")
     1589  ("SEIToneMapCodedDataBitDepth",                     m_toneMapCodedDataBitDepth,                           8, "Specifies Coded Data BitDepth of Tone Mapping SEI messages")
     1590  ("SEIToneMapTargetBitDepth",                        m_toneMapTargetBitDepth,                              8, "Specifies Output BitDepth of Tone mapping function")
     1591  ("SEIToneMapModelId",                               m_toneMapModelId,                                     0, "Specifies Model utilized for mapping coded data into target_bit_depth range\n"
     1592                                                                                                               "\t0:  linear mapping with clipping\n"
     1593                                                                                                               "\t1:  sigmoidal mapping\n"
     1594                                                                                                               "\t2:  user-defined table mapping\n"
     1595                                                                                                               "\t3:  piece-wise linear mapping\n"
     1596                                                                                                               "\t4:  luminance dynamic range information ")
     1597  ("SEIToneMapMinValue",                              m_toneMapMinValue,                                    0, "Specifies the minimum value in mode 0")
     1598  ("SEIToneMapMaxValue",                              m_toneMapMaxValue,                                 1023, "Specifies the maximum value in mode 0")
     1599  ("SEIToneMapSigmoidMidpoint",                       m_sigmoidMidpoint,                                  512, "Specifies the centre point in mode 1")
     1600  ("SEIToneMapSigmoidWidth",                          m_sigmoidWidth,                                     960, "Specifies the distance between 5% and 95% values of the target_bit_depth in mode 1")
     1601  ("SEIToneMapStartOfCodedInterval",                  cfg_startOfCodedInterval,      cfg_startOfCodedInterval, "Array of user-defined mapping table")
     1602  ("SEIToneMapNumPivots",                             m_numPivots,                                          0, "Specifies the number of pivot points in mode 3")
     1603  ("SEIToneMapCodedPivotValue",                       cfg_codedPivotValue,                cfg_codedPivotValue, "Array of pivot point")
     1604  ("SEIToneMapTargetPivotValue",                      cfg_targetPivotValue,              cfg_targetPivotValue, "Array of pivot point")
     1605  ("SEIToneMapCameraIsoSpeedIdc",                     m_cameraIsoSpeedIdc,                                  0, "Indicates the camera ISO speed for daylight illumination")
     1606  ("SEIToneMapCameraIsoSpeedValue",                   m_cameraIsoSpeedValue,                              400, "Specifies the camera ISO speed for daylight illumination of Extended_ISO")
     1607  ("SEIToneMapExposureIndexIdc",                      m_exposureIndexIdc,                                   0, "Indicates the exposure index setting of the camera")
     1608  ("SEIToneMapExposureIndexValue",                    m_exposureIndexValue,                               400, "Specifies the exposure index setting of the camera of Extended_ISO")
     1609  ("SEIToneMapExposureCompensationValueSignFlag",     m_exposureCompensationValueSignFlag,                  0, "Specifies the sign of ExposureCompensationValue")
     1610  ("SEIToneMapExposureCompensationValueNumerator",    m_exposureCompensationValueNumerator,                 0, "Specifies the numerator of ExposureCompensationValue")
     1611  ("SEIToneMapExposureCompensationValueDenomIdc",     m_exposureCompensationValueDenomIdc,                  2, "Specifies the denominator of ExposureCompensationValue")
     1612  ("SEIToneMapRefScreenLuminanceWhite",               m_refScreenLuminanceWhite,                          350, "Specifies reference screen brightness setting in units of candela per square metre")
     1613  ("SEIToneMapExtendedRangeWhiteLevel",               m_extendedRangeWhiteLevel,                          800, "Indicates the luminance dynamic range")
     1614  ("SEIToneMapNominalBlackLevelLumaCodeValue",        m_nominalBlackLevelLumaCodeValue,                    16, "Specifies luma sample value of the nominal black level assigned decoded pictures")
     1615  ("SEIToneMapNominalWhiteLevelLumaCodeValue",        m_nominalWhiteLevelLumaCodeValue,                   235, "Specifies luma sample value of the nominal white level assigned decoded pictures")
     1616  ("SEIToneMapExtendedWhiteLevelLumaCodeValue",       m_extendedWhiteLevelLumaCodeValue,                  300, "Specifies luma sample value of the extended dynamic range assigned decoded pictures")
     1617  ("SEIChromaSamplingFilterHint",                     m_chromaSamplingFilterSEIenabled,                 false, "Control generation of the chroma sampling filter hint SEI message")
     1618  ("SEIChromaSamplingHorizontalFilterType",           m_chromaSamplingHorFilterIdc,                         2, "Defines the Index of the chroma sampling horizontal filter\n"
     1619                                                                                                               "\t0: unspecified  - Chroma filter is unknown or is determined by the application"
     1620                                                                                                               "\t1: User-defined - Filter coefficients are specified in the chroma sampling filter hint SEI message"
     1621                                                                                                               "\t2: Standards-defined - ITU-T Rec. T.800 | ISO/IEC15444-1, 5/3 filter")
     1622  ("SEIChromaSamplingVerticalFilterType",             m_chromaSamplingVerFilterIdc,                         2, "Defines the Index of the chroma sampling vertical filter\n"
     1623                                                                                                               "\t0: unspecified  - Chroma filter is unknown or is determined by the application"
     1624                                                                                                               "\t1: User-defined - Filter coefficients are specified in the chroma sampling filter hint SEI message"
     1625                                                                                                               "\t2: Standards-defined - ITU-T Rec. T.800 | ISO/IEC15444-1, 5/3 filter")
     1626  ("SEIFramePacking",                                 m_framePackingSEIEnabled,                             0, "Control generation of frame packing SEI messages")
     1627  ("SEIFramePackingType",                             m_framePackingSEIType,                                0, "Define frame packing arrangement\n"
     1628                                                                                                               "\t3: side by side - frames are displayed horizontally\n"
     1629                                                                                                               "\t4: top bottom - frames are displayed vertically\n"
     1630                                                                                                               "\t5: frame alternation - one frame is alternated with the other")
     1631  ("SEIFramePackingId",                               m_framePackingSEIId,                                  0, "Id of frame packing SEI message for a given session")
     1632  ("SEIFramePackingQuincunx",                         m_framePackingSEIQuincunx,                            0, "Indicate the presence of a Quincunx type video frame")
     1633  ("SEIFramePackingInterpretation",                   m_framePackingSEIInterpretation,                      0, "Indicate the interpretation of the frame pair\n"
     1634                                                                                                               "\t0: unspecified\n"
     1635                                                                                                               "\t1: stereo pair, frame0 represents left view\n"
     1636                                                                                                               "\t2: stereo pair, frame0 represents right view")
     1637  ("SEISegmentedRectFramePacking",                    m_segmentedRectFramePackingSEIEnabled,                0, "Controls generation of segmented rectangular frame packing SEI messages")
     1638  ("SEISegmentedRectFramePackingCancel",              m_segmentedRectFramePackingSEICancel,             false, "If equal to 1, cancels the persistence of any previous SRFPA SEI message")
     1639  ("SEISegmentedRectFramePackingType",                m_segmentedRectFramePackingSEIType,                   0, "Specifies the arrangement of the frames in the reconstructed picture")
     1640  ("SEISegmentedRectFramePackingPersistence",         m_segmentedRectFramePackingSEIPersistence,        false, "If equal to 0, the SEI applies to the current frame only")
     1641  ("SEIDisplayOrientation",                           m_displayOrientationSEIAngle,                         0, "Control generation of display orientation SEI messages\n"
     1642                                                                                                               "\tN: 0 < N < (2^16 - 1) enable display orientation SEI message with anticlockwise_rotation = N and display_orientation_repetition_period = 1\n"
     1643                                                                                                               "\t0: disable")
     1644  ("SEITemporalLevel0Index",                          m_temporalLevel0IndexSEIEnabled,                      0, "Control generation of temporal level 0 index SEI messages")
     1645  ("SEIGradualDecodingRefreshInfo",                   m_gradualDecodingRefreshInfoEnabled,                  0, "Control generation of gradual decoding refresh information SEI message")
     1646  ("SEINoDisplay",                                    m_noDisplaySEITLayer,                                 0, "Control generation of no display SEI message\n"
     1647                                                                                                               "\tN: 0 < N enable no display SEI message for temporal layer N or higher\n"
     1648                                                                                                               "\t0: disable")
     1649  ("SEIDecodingUnitInfo",                             m_decodingUnitInfoSEIEnabled,                         0, "Control generation of decoding unit information SEI message.")
    11711650#if LAYERS_NOT_PRESENT_SEI
    1172   ("SEILayersNotPresent",            m_layersNotPresentSEIEnabled,             0, "Control generation of layers not present SEI message")
    1173 #endif
    1174   ("SEISOPDescription",              m_SOPDescriptionSEIEnabled,              0, "Control generation of SOP description SEI messages")
    1175   ("SEIScalableNesting",             m_scalableNestingSEIEnabled,              0, "Control generation of scalable nesting SEI messages")
    1176 #if P0050_KNEE_FUNCTION_SEI
    1177   ("SEIKneeFunctionInfo",                 m_kneeSEIEnabled,               false, "Control generation of Knee function SEI messages")
    1178   ("SEIKneeFunctionId",                   m_kneeSEIId,                        0, "Specifies Id of Knee function SEI message for a given session")
    1179   ("SEIKneeFunctionCancelFlag",           m_kneeSEICancelFlag,            false, "Indicates that Knee function SEI message cancels the persistance or follows")
    1180   ("SEIKneeFunctionPersistenceFlag",      m_kneeSEIPersistenceFlag,        true, "Specifies the persistence of the Knee function SEI message")
    1181   ("SEIKneeFunctionMappingFlag",          m_kneeSEIMappingFlag,           false, "Specifies the mapping mode of the Knee function SEI message")
    1182   ("SEIKneeFunctionInputDrange",          m_kneeSEIInputDrange,            1000, "Specifies the peak luminance level for the input picture of Knee function SEI messages")
    1183   ("SEIKneeFunctionInputDispLuminance",   m_kneeSEIInputDispLuminance,      100, "Specifies the expected display brightness for the input picture of Knee function SEI messages")
    1184   ("SEIKneeFunctionOutputDrange",         m_kneeSEIOutputDrange,           4000, "Specifies the peak luminance level for the output picture of Knee function SEI messages")
    1185   ("SEIKneeFunctionOutputDispLuminance",  m_kneeSEIOutputDispLuminance,     800, "Specifies the expected display brightness for the output picture of Knee function SEI messages")
    1186   ("SEIKneeFunctionNumKneePointsMinus1",  m_kneeSEINumKneePointsMinus1,       2, "Specifies the number of knee points - 1")
    1187   ("SEIKneeFunctionInputKneePointValue",  cfg_kneeSEIInputKneePointValue,     string("600 800 900"), "Array of input knee point")
    1188   ("SEIKneeFunctionOutputKneePointValue", cfg_kneeSEIOutputKneePointValue,    string("100 250 450"), "Array of output knee point")
    1189 #endif
     1651  ("SEILayersNotPresent",                             m_layersNotPresentSEIEnabled,             0, "Control generation of layers not present SEI message")
     1652#endif
     1653  ("SEISOPDescription",                               m_SOPDescriptionSEIEnabled,                           0, "Control generation of SOP description SEI messages")
     1654  ("SEIScalableNesting",                              m_scalableNestingSEIEnabled,                          0, "Control generation of scalable nesting SEI messages")
     1655  ("SEITempMotionConstrainedTileSets",                m_tmctsSEIEnabled,                                false, "Control generation of temporal motion constrained tile sets SEI message")
     1656  ("SEITimeCodeEnabled",                              m_timeCodeSEIEnabled,                             false, "Control generation of time code information SEI message")
     1657  ("SEITimeCodeNumClockTs",                           m_timeCodeSEINumTs,                                   0, "Number of clock time sets [0..3]")
     1658  ("SEITimeCodeTimeStampFlag",                        cfg_timeCodeSeiTimeStampFlag,          cfg_timeCodeSeiTimeStampFlag,         "Time stamp flag associated to each time set")
     1659  ("SEITimeCodeFieldBasedFlag",                       cfg_timeCodeSeiNumUnitFieldBasedFlag,  cfg_timeCodeSeiNumUnitFieldBasedFlag, "Field based flag associated to each time set")
     1660  ("SEITimeCodeCountingType",                         cfg_timeCodeSeiCountingType,           cfg_timeCodeSeiCountingType,          "Counting type associated to each time set")
     1661  ("SEITimeCodeFullTsFlag",                           cfg_timeCodeSeiFullTimeStampFlag,      cfg_timeCodeSeiFullTimeStampFlag,     "Full time stamp flag associated to each time set")
     1662  ("SEITimeCodeDiscontinuityFlag",                    cfg_timeCodeSeiDiscontinuityFlag,      cfg_timeCodeSeiDiscontinuityFlag,     "Discontinuity flag associated to each time set")
     1663  ("SEITimeCodeCntDroppedFlag",                       cfg_timeCodeSeiCntDroppedFlag,         cfg_timeCodeSeiCntDroppedFlag,        "Counter dropped flag associated to each time set")
     1664  ("SEITimeCodeNumFrames",                            cfg_timeCodeSeiNumberOfFrames,         cfg_timeCodeSeiNumberOfFrames,        "Number of frames associated to each time set")
     1665  ("SEITimeCodeSecondsValue",                         cfg_timeCodeSeiSecondsValue,           cfg_timeCodeSeiSecondsValue,          "Seconds value for each time set")
     1666  ("SEITimeCodeMinutesValue",                         cfg_timeCodeSeiMinutesValue,           cfg_timeCodeSeiMinutesValue,          "Minutes value for each time set")
     1667  ("SEITimeCodeHoursValue",                           cfg_timeCodeSeiHoursValue,             cfg_timeCodeSeiHoursValue,            "Hours value for each time set")
     1668  ("SEITimeCodeSecondsFlag",                          cfg_timeCodeSeiSecondsFlag,            cfg_timeCodeSeiSecondsFlag,           "Flag to signal seconds value presence in each time set")
     1669  ("SEITimeCodeMinutesFlag",                          cfg_timeCodeSeiMinutesFlag,            cfg_timeCodeSeiMinutesFlag,           "Flag to signal minutes value presence in each time set")
     1670  ("SEITimeCodeHoursFlag",                            cfg_timeCodeSeiHoursFlag,              cfg_timeCodeSeiHoursFlag,             "Flag to signal hours value presence in each time set")
     1671  ("SEITimeCodeOffsetLength",                         cfg_timeCodeSeiTimeOffsetLength,       cfg_timeCodeSeiTimeOffsetLength,      "Time offset length associated to each time set")
     1672  ("SEITimeCodeTimeOffset",                           cfg_timeCodeSeiTimeOffsetValue,        cfg_timeCodeSeiTimeOffsetValue,       "Time offset associated to each time set")
     1673  ("SEIKneeFunctionInfo",                             m_kneeSEIEnabled,                                 false, "Control generation of Knee function SEI messages")
     1674  ("SEIKneeFunctionId",                               m_kneeSEIId,                                          0, "Specifies Id of Knee function SEI message for a given session")
     1675  ("SEIKneeFunctionCancelFlag",                       m_kneeSEICancelFlag,                              false, "Indicates that Knee function SEI message cancels the persistence or follows")
     1676  ("SEIKneeFunctionPersistenceFlag",                  m_kneeSEIPersistenceFlag,                          true, "Specifies the persistence of the Knee function SEI message")
     1677  ("SEIKneeFunctionInputDrange",                      m_kneeSEIInputDrange,                              1000, "Specifies the peak luminance level for the input picture of Knee function SEI messages")
     1678  ("SEIKneeFunctionInputDispLuminance",               m_kneeSEIInputDispLuminance,                        100, "Specifies the expected display brightness for the input picture of Knee function SEI messages")
     1679  ("SEIKneeFunctionOutputDrange",                     m_kneeSEIOutputDrange,                             4000, "Specifies the peak luminance level for the output picture of Knee function SEI messages")
     1680  ("SEIKneeFunctionOutputDispLuminance",              m_kneeSEIOutputDispLuminance,                       800, "Specifies the expected display brightness for the output picture of Knee function SEI messages")
     1681  ("SEIKneeFunctionNumKneePointsMinus1",              m_kneeSEINumKneePointsMinus1,                         2, "Specifies the number of knee points - 1")
     1682  ("SEIKneeFunctionInputKneePointValue",              cfg_kneeSEIInputKneePointValue,   cfg_kneeSEIInputKneePointValue, "Array of input knee point")
     1683  ("SEIKneeFunctionOutputKneePointValue",             cfg_kneeSEIOutputKneePointValue, cfg_kneeSEIOutputKneePointValue, "Array of output knee point")
     1684  ("SEIMasteringDisplayColourVolume",                 m_masteringDisplay.colourVolumeSEIEnabled,         false, "Control generation of mastering display colour volume SEI messages")
     1685  ("SEIMasteringDisplayMaxLuminance",                 m_masteringDisplay.maxLuminance,                  10000u, "Specifies the mastering display maximum luminance value in units of 1/10000 candela per square metre (32-bit code value)")
     1686  ("SEIMasteringDisplayMinLuminance",                 m_masteringDisplay.minLuminance,                      0u, "Specifies the mastering display minimum luminance value in units of 1/10000 candela per square metre (32-bit code value)")
     1687  ("SEIMasteringDisplayPrimaries",                    cfg_DisplayPrimariesCode,       cfg_DisplayPrimariesCode, "Mastering display primaries for all three colour planes in CIE xy coordinates in increments of 1/50000 (results in the ranges 0 to 50000 inclusive)")
     1688  ("SEIMasteringDisplayWhitePoint",                   cfg_DisplayWhitePointCode,     cfg_DisplayWhitePointCode, "Mastering display white point CIE xy coordinates in normalised increments of 1/50000 (e.g. 0.333 = 16667)")
     1689   
    11901690#if Q0096_OVERLAY_SEI
    11911691  ("SEIOverlayInfo",                          m_overlaySEIEnabled,                      false, "Control generation of Selectable Overlays SEI messages")
     
    12771777#endif
    12781778  ;
    1279  
     1779
    12801780  for(Int i=1; i<MAX_GOP+1; i++) {
    12811781    std::ostringstream cOSS;
     
    13181818  }
    13191819#endif
    1320 
    1321   if(m_isField)
    1322   {
    1323 #if SVC_EXTENSION
    1324     for(Int layer = 0; layer < MAX_LAYERS; layer++)
    1325     {
    1326       //Frame height
    1327       m_acLayerCfg[layer].m_iSourceHeightOrg = m_acLayerCfg[layer].m_iSourceHeight;
    1328       //Field height
    1329       m_acLayerCfg[layer].m_iSourceHeight = m_acLayerCfg[layer].m_iSourceHeight >> 1;
    1330     }
    1331 #else
    1332     //Frame height
    1333     m_iSourceHeightOrg = m_iSourceHeight;
    1334     //Field height
    1335     m_iSourceHeight = m_iSourceHeight >> 1;
    1336 #endif
    1337     //number of fields to encode
    1338     m_framesToBeEncoded *= 2;
    1339   }
    13401820 
    13411821  for (list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++)
     
    13431823    fprintf(stderr, "Unhandled argument ignored: `%s'\n", *it);
    13441824  }
    1345  
     1825
    13461826  if (argc == 1 || do_help)
    13471827  {
     
    13501830    return false;
    13511831  }
    1352  
     1832
    13531833  /*
    13541834   * Set any derived parameters
     
    13781858
    13791859
    1380   Char* pColumnWidth = cfgColumnWidth.empty() ? NULL: strdup(cfgColumnWidth.c_str());
    1381   Char* pRowHeight = cfgRowHeight.empty() ? NULL : strdup(cfgRowHeight.c_str());
     1860  if(m_isField)
     1861  {
     1862#if SVC_EXTENSION
     1863    for(Int layer = 0; layer < MAX_LAYERS; layer++)
     1864    {
     1865      //Frame height
     1866      m_acLayerCfg[layer].m_iSourceHeightOrg = m_acLayerCfg[layer].m_iSourceHeight;
     1867      //Field height
     1868      m_acLayerCfg[layer].m_iSourceHeight = m_acLayerCfg[layer].m_iSourceHeight >> 1;
     1869    }
     1870#else
     1871    //Frame height
     1872    m_iSourceHeightOrg = m_iSourceHeight;
     1873    //Field height
     1874    m_iSourceHeight = m_iSourceHeight >> 1;
     1875#endif
     1876    //number of fields to encode
     1877    m_framesToBeEncoded *= 2;
     1878  }
    13821879
    13831880  if( !m_tileUniformSpacingFlag && m_numTileColumnsMinus1 > 0 )
    13841881  {
    1385     char *str;
    1386     int  i=0;
    1387     m_tileColumnWidth.resize( m_numTileColumnsMinus1 );
    1388     str = strtok(pColumnWidth, " ,-");
    1389     while(str!=NULL)
    1390     {
    1391       if( i >= m_numTileColumnsMinus1 )
    1392       {
    1393         printf( "The number of columns whose width are defined is larger than the allowed number of columns.\n" );
    1394         exit( EXIT_FAILURE );
    1395       }
    1396       m_tileColumnWidth[i] = atoi( str );
    1397       str = strtok(NULL, " ,-");
    1398       i++;
    1399     }
    1400     if( i < m_numTileColumnsMinus1 )
     1882    if (cfg_ColumnWidth.values.size() > m_numTileColumnsMinus1)
     1883    {
     1884      printf( "The number of columns whose width are defined is larger than the allowed number of columns.\n" );
     1885      exit( EXIT_FAILURE );
     1886    }
     1887    else if (cfg_ColumnWidth.values.size() < m_numTileColumnsMinus1)
    14011888    {
    14021889      printf( "The width of some columns is not defined.\n" );
    14031890      exit( EXIT_FAILURE );
    14041891    }
     1892    else
     1893    {
     1894      m_tileColumnWidth.resize(m_numTileColumnsMinus1);
     1895      for(UInt i=0; i<cfg_ColumnWidth.values.size(); i++)
     1896        m_tileColumnWidth[i]=cfg_ColumnWidth.values[i];
     1897    }
    14051898  }
    14061899  else
     
    14111904  if( !m_tileUniformSpacingFlag && m_numTileRowsMinus1 > 0 )
    14121905  {
    1413     char *str;
    1414     int  i=0;
    1415     m_tileRowHeight.resize(m_numTileRowsMinus1);
    1416     str = strtok(pRowHeight, " ,-");
    1417     while(str!=NULL)
    1418     {
    1419       if( i>=m_numTileRowsMinus1 )
    1420       {
    1421         printf( "The number of rows whose height are defined is larger than the allowed number of rows.\n" );
    1422         exit( EXIT_FAILURE );
    1423       }
    1424       m_tileRowHeight[i] = atoi( str );
    1425       str = strtok(NULL, " ,-");
    1426       i++;
    1427     }
    1428     if( i < m_numTileRowsMinus1 )
     1906    if (cfg_RowHeight.values.size() > m_numTileRowsMinus1)
     1907    {
     1908      printf( "The number of rows whose height are defined is larger than the allowed number of rows.\n" );
     1909      exit( EXIT_FAILURE );
     1910    }
     1911    else if (cfg_RowHeight.values.size() < m_numTileRowsMinus1)
    14291912    {
    14301913      printf( "The height of some rows is not defined.\n" );
    14311914      exit( EXIT_FAILURE );
    1432    }
     1915    }
     1916    else
     1917    {
     1918      m_tileRowHeight.resize(m_numTileRowsMinus1);
     1919      for(UInt i=0; i<cfg_RowHeight.values.size(); i++)
     1920        m_tileRowHeight[i]=cfg_RowHeight.values[i];
     1921    }
    14331922  }
    14341923  else
     
    14361925    m_tileRowHeight.clear();
    14371926  }
     1927
     1928  m_scalingListFile = cfg_ScalingListFile.empty() ? NULL : strdup(cfg_ScalingListFile.c_str());
     1929
     1930
     1931 
     1932  /* rules for input, output and internal bitdepths as per help text */
     1933#if O0194_DIFFERENT_BITDEPTH_EL_BL
     1934  for(Int layer = 0; layer < MAX_LAYERS; layer++)
     1935  {
     1936    m_acLayerCfg[layer].m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ] = m_acLayerCfg[layer].m_inputBitDepth      [CHANNEL_TYPE_LUMA  ];
     1937    m_acLayerCfg[layer].m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] = m_acLayerCfg[layer].m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ];
     1938
     1939    if (m_acLayerCfg[layer].m_internalBitDepth   [CHANNEL_TYPE_LUMA  ] == 0) { m_acLayerCfg[layer].m_internalBitDepth   [CHANNEL_TYPE_LUMA  ] = m_acLayerCfg[layer].m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ]; }
     1940    if (m_acLayerCfg[layer].m_internalBitDepth   [CHANNEL_TYPE_CHROMA] == 0) { m_acLayerCfg[layer].m_internalBitDepth   [CHANNEL_TYPE_CHROMA] = m_acLayerCfg[layer].m_internalBitDepth   [CHANNEL_TYPE_LUMA  ]; }
     1941    if (m_acLayerCfg[layer].m_inputBitDepth      [CHANNEL_TYPE_CHROMA] == 0) { m_acLayerCfg[layer].m_inputBitDepth      [CHANNEL_TYPE_CHROMA] = m_acLayerCfg[layer].m_inputBitDepth      [CHANNEL_TYPE_LUMA  ]; }
     1942    if (m_acLayerCfg[layer].m_outputBitDepth     [CHANNEL_TYPE_LUMA  ] == 0) { m_acLayerCfg[layer].m_outputBitDepth     [CHANNEL_TYPE_LUMA  ] = m_acLayerCfg[layer].m_internalBitDepth   [CHANNEL_TYPE_LUMA  ]; }
     1943    if (m_acLayerCfg[layer].m_outputBitDepth     [CHANNEL_TYPE_CHROMA] == 0) { m_acLayerCfg[layer].m_outputBitDepth     [CHANNEL_TYPE_CHROMA] = m_acLayerCfg[layer].m_internalBitDepth   [CHANNEL_TYPE_CHROMA]; }
     1944
     1945    m_acLayerCfg[layer].m_InputChromaFormatIDC = numberToChromaFormat(tmpInputChromaFormat);
     1946    m_acLayerCfg[layer].m_chromaFormatIDC      = ((tmpChromaFormat == 0) ? (m_acLayerCfg[layer].m_InputChromaFormatIDC) : (numberToChromaFormat(tmpChromaFormat)));
     1947
     1948    m_acLayerCfg[layer].m_useHighPrecisionPredictionWeighting = false;
     1949    m_acLayerCfg[layer].m_useExtendedPrecision = false;
     1950  }
     1951#else
     1952  /* rules for input, output and internal bitdepths as per help text */
     1953  if (m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ] == 0) { m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ] = m_inputBitDepth      [CHANNEL_TYPE_LUMA  ]; }
     1954  if (m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] == 0) { m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] = m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ]; }
     1955  if (m_internalBitDepth   [CHANNEL_TYPE_LUMA  ] == 0) { m_internalBitDepth   [CHANNEL_TYPE_LUMA  ] = m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ]; }
     1956  if (m_internalBitDepth   [CHANNEL_TYPE_CHROMA] == 0) { m_internalBitDepth   [CHANNEL_TYPE_CHROMA] = m_internalBitDepth   [CHANNEL_TYPE_LUMA  ]; }
     1957  if (m_inputBitDepth      [CHANNEL_TYPE_CHROMA] == 0) { m_inputBitDepth      [CHANNEL_TYPE_CHROMA] = m_inputBitDepth      [CHANNEL_TYPE_LUMA  ]; }
     1958  if (m_outputBitDepth     [CHANNEL_TYPE_LUMA  ] == 0) { m_outputBitDepth     [CHANNEL_TYPE_LUMA  ] = m_internalBitDepth   [CHANNEL_TYPE_LUMA  ]; }
     1959  if (m_outputBitDepth     [CHANNEL_TYPE_CHROMA] == 0) { m_outputBitDepth     [CHANNEL_TYPE_CHROMA] = m_internalBitDepth   [CHANNEL_TYPE_CHROMA]; }
     1960
     1961  m_InputChromaFormatIDC = numberToChromaFormat(tmpInputChromaFormat);
     1962  m_chromaFormatIDC      = ((tmpChromaFormat == 0) ? (m_InputChromaFormatIDC) : (numberToChromaFormat(tmpChromaFormat)));
     1963#endif
     1964
     1965#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
     1966  for (Int layer = 0; layer < MAX_LAYERS; layer++)
     1967  {
     1968    if (m_acLayerCfg[layer].m_layerSwitchOffBegin < m_acLayerCfg[layer].m_layerSwitchOffEnd)
     1969    {
     1970      if (m_iGOPSize > 0 && (m_acLayerCfg[layer].m_layerSwitchOffBegin % m_iGOPSize) != 0)
     1971      {
     1972        printf("LayerSwitchOffBegin%d: Must be multiple of GOP size.\n", layer);
     1973        exit(EXIT_FAILURE);
     1974      }
     1975      if (m_acLayerCfg[layer].m_iIntraPeriod > 0 && (m_acLayerCfg[layer].m_layerSwitchOffEnd % m_acLayerCfg[layer].m_iIntraPeriod) != 0)
     1976      {
     1977        printf("LayerSwitchOffEnd%d: Must be IRAP picture.\n", layer);
     1978        exit(EXIT_FAILURE);
     1979      }
     1980    }
     1981  }
     1982#endif
     1983
     1984#if MULTIPLE_PTL_SUPPORT
     1985  for( Int layer = 0; layer < MAX_LAYERS; layer++ )
     1986  {
     1987    m_acLayerCfg[layer].m_bitDepthConstraint = tmpBitDepthConstraint;
     1988    m_acLayerCfg[layer].m_intraConstraintFlag = tmpIntraConstraintFlag;
     1989    m_acLayerCfg[layer].m_lowerBitRateConstraintFlag = tmpLowerBitRateConstraintFlag;   
     1990
     1991    for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
     1992    {
     1993      m_acLayerCfg[layer].m_saoOffsetBitShift[channelType] = 0;
     1994    }
     1995       
     1996    Int layerPTLIdx = m_acLayerCfg[layer].m_layerPTLIdx;
     1997
     1998    if( extendedProfile[layerPTLIdx] >= 1000 && extendedProfile[layerPTLIdx] <= 2316 )
     1999    {
     2000      m_profileList[layerPTLIdx] = Profile::MAINREXT;           
     2001
     2002      if( m_acLayerCfg[layer].m_bitDepthConstraint != 0 || tmpConstraintChromaFormat != 0)
     2003      {
     2004        fprintf(stderr, "Error: The bit depth and chroma format constraints are not used when an explicit RExt profile is specified\n");
     2005        exit(EXIT_FAILURE);
     2006      }
     2007      m_acLayerCfg[layer].m_bitDepthConstraint  = (extendedProfile[layerPTLIdx]%100);
     2008      m_acLayerCfg[layer].m_intraConstraintFlag = (extendedProfile[layerPTLIdx]>=2000);
     2009      switch ((extendedProfile[layerPTLIdx]/100)%10)
     2010      {
     2011      case 0:  tmpConstraintChromaFormat=400; break;
     2012      case 1:  tmpConstraintChromaFormat=420; break;
     2013      case 2:  tmpConstraintChromaFormat=422; break;
     2014      default: tmpConstraintChromaFormat=444; break;
     2015      }
     2016    }
     2017    else
     2018    {
     2019      m_profileList[layerPTLIdx] = Profile::Name(extendedProfile[layerPTLIdx]);
     2020    }
     2021
     2022    if( m_profileList[layerPTLIdx] == Profile::HIGHTHROUGHPUTREXT )
     2023    {
     2024      if( m_acLayerCfg[layer].m_bitDepthConstraint == 0 ) m_acLayerCfg[layer].m_bitDepthConstraint = 16;
     2025      m_acLayerCfg[layer].m_chromaFormatConstraint = (tmpConstraintChromaFormat == 0) ? CHROMA_444 : numberToChromaFormat(tmpConstraintChromaFormat);
     2026    }
     2027    else if( m_profileList[layerPTLIdx] == Profile::MAINREXT )
     2028    {
     2029      if( m_acLayerCfg[layer].m_bitDepthConstraint == 0 && tmpConstraintChromaFormat == 0 )
     2030      {
     2031        // produce a valid combination, if possible.
     2032        const Bool bUsingGeneralRExtTools  = m_useResidualRotation                    ||
     2033          m_useSingleSignificanceMapContext        ||
     2034          m_useResidualDPCM[RDPCM_SIGNAL_IMPLICIT] ||
     2035          m_useResidualDPCM[RDPCM_SIGNAL_EXPLICIT] ||
     2036          !m_enableIntraReferenceSmoothing         ||
     2037          m_useGolombRiceParameterAdaptation       ||
     2038          m_transformSkipLog2MaxSize!=2;
     2039        const Bool bUsingChromaQPAdjustment= m_maxCUChromaQpAdjustmentDepth >= 0;
     2040        const Bool bUsingExtendedPrecision = m_acLayerCfg[layer].m_useExtendedPrecision;
     2041        m_acLayerCfg[layer].m_chromaFormatConstraint = NUM_CHROMA_FORMAT;
     2042        automaticallySelectRExtProfile(bUsingGeneralRExtTools,
     2043          bUsingChromaQPAdjustment,
     2044          bUsingExtendedPrecision,
     2045          m_acLayerCfg[layer].m_intraConstraintFlag,
     2046          m_acLayerCfg[layer].m_bitDepthConstraint,
     2047          m_acLayerCfg[layer].m_chromaFormatConstraint,
     2048          m_acLayerCfg[layer].m_chromaFormatIDC==CHROMA_400 ? m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA] : std::max(m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA], m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA]),
     2049          m_acLayerCfg[layer].m_chromaFormatIDC);
     2050      }
     2051      else if( m_acLayerCfg[layer].m_bitDepthConstraint == 0 || tmpConstraintChromaFormat == 0)
     2052      {
     2053        fprintf(stderr, "Error: The bit depth and chroma format constraints must either both be specified or both be configured automatically\n");
     2054        exit(EXIT_FAILURE);
     2055      }
     2056      else
     2057      {
     2058        m_acLayerCfg[layer].m_chromaFormatConstraint = numberToChromaFormat(tmpConstraintChromaFormat);
     2059      }
     2060    }
     2061    else
     2062    {
     2063      m_acLayerCfg[layer].m_chromaFormatConstraint = (tmpConstraintChromaFormat == 0) ? m_acLayerCfg[layer].m_chromaFormatIDC : numberToChromaFormat(tmpConstraintChromaFormat);
     2064      m_acLayerCfg[layer].m_bitDepthConstraint = (m_profileList[layerPTLIdx] == Profile::MAIN10 || m_profileList[layerPTLIdx] == Profile::SCALABLEMAIN10) ? 10 : 8;
     2065    }
     2066  }
     2067#else
     2068  if (extendedProfile >= 1000 && extendedProfile <= 2316)
     2069  {
     2070    m_profile = Profile::MAINREXT;
     2071    if (m_bitDepthConstraint != 0 || tmpConstraintChromaFormat != 0)
     2072    {
     2073      fprintf(stderr, "Error: The bit depth and chroma format constraints are not used when an explicit RExt profile is specified\n");
     2074      exit(EXIT_FAILURE);
     2075    }
     2076    m_bitDepthConstraint     = (extendedProfile%100);
     2077    m_intraConstraintFlag    = (extendedProfile>=2000);
     2078    switch ((extendedProfile/100)%10)
     2079    {
     2080      case 0:  tmpConstraintChromaFormat=400; break;
     2081      case 1:  tmpConstraintChromaFormat=420; break;
     2082      case 2:  tmpConstraintChromaFormat=422; break;
     2083      default: tmpConstraintChromaFormat=444; break;
     2084    }
     2085  }
     2086  else
     2087  {
     2088    m_profile = Profile::Name(extendedProfile);
     2089  }
     2090
    14382091#if SVC_EXTENSION
    1439   if( pColumnWidth )
    1440   {
    1441     free( pColumnWidth );
    1442     pColumnWidth = NULL;
    1443   }
    1444 
    1445   if( pRowHeight )
    1446   {
    1447     free( pRowHeight );
    1448     pRowHeight = NULL;
    1449   }
    1450 
     2092  ChromaFormat m_chromaFormatIDC = m_acLayerCfg[0].m_chromaFormatIDC;
     2093#endif
     2094
     2095  if (m_profile == Profile::HIGHTHROUGHPUTREXT )
     2096  {
     2097    if (m_bitDepthConstraint == 0) m_bitDepthConstraint = 16;
     2098    m_chromaFormatConstraint = (tmpConstraintChromaFormat == 0) ? CHROMA_444 : numberToChromaFormat(tmpConstraintChromaFormat);
     2099  }
     2100  else if (m_profile == Profile::MAINREXT)
     2101  {
     2102    if (m_bitDepthConstraint == 0 && tmpConstraintChromaFormat == 0)
     2103    {
     2104#if SVC_EXTENSION
     2105      Bool m_useExtendedPrecision    = m_acLayerCfg[0].m_useExtendedPrecision;
     2106      Int  m_internalBitDepth[]      = {m_acLayerCfg[0].m_internalBitDepth[CHANNEL_TYPE_LUMA], m_acLayerCfg[0].m_internalBitDepth[CHANNEL_TYPE_CHROMA]};
     2107      ChromaFormat m_chromaFormatIDC = m_acLayerCfg[0].m_chromaFormatIDC;
     2108#endif
     2109      // produce a valid combination, if possible.
     2110      const Bool bUsingGeneralRExtTools  = m_useResidualRotation                    ||
     2111                                           m_useSingleSignificanceMapContext        ||
     2112                                           m_useResidualDPCM[RDPCM_SIGNAL_IMPLICIT] ||
     2113                                           m_useResidualDPCM[RDPCM_SIGNAL_EXPLICIT] ||
     2114                                           !m_enableIntraReferenceSmoothing         ||
     2115                                           m_useGolombRiceParameterAdaptation       ||
     2116                                           m_transformSkipLog2MaxSize!=2;
     2117      const Bool bUsingChromaQPAdjustment= m_maxCUChromaQpAdjustmentDepth >= 0;
     2118      const Bool bUsingExtendedPrecision = m_useExtendedPrecision;
     2119      m_chromaFormatConstraint = NUM_CHROMA_FORMAT;
     2120      automaticallySelectRExtProfile(bUsingGeneralRExtTools,
     2121                                     bUsingChromaQPAdjustment,
     2122                                     bUsingExtendedPrecision,
     2123                                     m_intraConstraintFlag,
     2124                                     m_bitDepthConstraint,
     2125                                     m_chromaFormatConstraint,
     2126                                     m_chromaFormatIDC==CHROMA_400 ? m_internalBitDepth[CHANNEL_TYPE_LUMA] : std::max(m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA]),
     2127                                     m_chromaFormatIDC);
     2128    }
     2129    else if (m_bitDepthConstraint == 0 || tmpConstraintChromaFormat == 0)
     2130    {
     2131      fprintf(stderr, "Error: The bit depth and chroma format constraints must either both be specified or both be configured automatically\n");
     2132      exit(EXIT_FAILURE);
     2133    }
     2134    else
     2135    {
     2136      m_chromaFormatConstraint = numberToChromaFormat(tmpConstraintChromaFormat);
     2137    }
     2138  }
     2139  else
     2140  {
     2141    m_chromaFormatConstraint = (tmpConstraintChromaFormat == 0) ? m_chromaFormatIDC : numberToChromaFormat(tmpConstraintChromaFormat);
     2142    m_bitDepthConstraint = (m_profile == Profile::MAIN10?10:8);
     2143  }
     2144#endif
     2145
     2146  m_inputColourSpaceConvert = stringToInputColourSpaceConvert(inputColourSpaceConvert, true);
     2147
     2148#if SVC_EXTENSION
    14512149  for(Int layer = 0; layer < MAX_LAYERS; layer++)
    14522150  {
     2151#if !MULTIPLE_PTL_SUPPORT
     2152    m_acLayerCfg[layer].m_chromaFormatConstraint = m_chromaFormatConstraint;
     2153    m_acLayerCfg[layer].m_bitDepthConstraint = m_bitDepthConstraint;
     2154#endif
     2155
    14532156    // If number of scaled ref. layer offsets is non-zero, at least one of the offsets should be specified
    14542157    if(m_acLayerCfg[layer].m_numScaledRefLayerOffsets)
     
    14712174      Bool phaseSetFlag =
    14722175        strcmp(cfg_phaseHorLuma   [layer].c_str(), "") ||
    1473         strcmp(cfg_phaseVerLuma  [layer].c_str(), "") ||
    1474         strcmp(cfg_phaseHorChroma    [layer].c_str(), "") ||
     2176        strcmp(cfg_phaseVerLuma   [layer].c_str(), "") ||
     2177        strcmp(cfg_phaseHorChroma [layer].c_str(), "") ||
    14752178        strcmp(cfg_phaseVerChroma [layer].c_str(), "");
    14762179      assert( srloFlag || rroFlag || phaseSetFlag);
     
    18202523  }
    18212524
    1822 #if AUXILIARY_PICTURES
    1823   for(UInt layer = 0; layer < MAX_LAYERS; layer++)
    1824   {
    1825     m_acLayerCfg[layer].m_InputChromaFormat =  numberToChromaFormat(cfg_tmpChromaFormatIDC[layer]);
    1826     m_acLayerCfg[layer].m_chromaFormatIDC = ((cfg_tmpChromaFormatIDC[layer] == 0) ? (m_acLayerCfg[layer].m_InputChromaFormat ) : (numberToChromaFormat(cfg_tmpChromaFormatIDC[layer])));
    1827   }
    1828 #endif
    18292525  for(Int layer = 0; layer < MAX_LAYERS; layer++)
    18302526  {
     
    19962692    }
    19972693#else
    1998     Int olsToLsIndex = (olsCtr >= (m_numLayerSets + m_numAddLayerSets)) ? m_outputLayerSetIdx[olsCtr - (m_numLayerSets + m_numAddLayerSets)] : olsCtr;
    19992694    scanStringToArray( cfg_listOfLayerPTLOfOlss[olsCtr], m_numLayerInIdList[olsToLsIndex], "List of PTL for each layers in OLS", m_listOfLayerPTLofOlss[olsCtr] );
    20002695#endif
     
    20172712                (m_profileCompatibility[m_listOfLayerPTLofOlss[olsCtr][ii]] == m_profileList[m_listOfLayerPTLofOlss[olsCtr][ii - 1]]) );
    20182713      }
    2019     }   
     2714    }
    20202715#if R0235_SMALLEST_LAYER_ID
    20212716    }
     
    20242719  }
    20252720#if MULTIPLE_PTL_SUPPORT
    2026   m_listOfLayerPTLofOlss[0].push_back(m_layerPTLIdx[0]);
     2721  m_listOfLayerPTLofOlss[0].push_back(*cfg_layerPTLIdx[0]);
    20272722  delete [] cfg_listOfLayerPTLOfOlss;
    20282723#endif
     
    20312726  delete cfg_outputLayerSetIdx;
    20322727#endif
    2033 #endif //SVC_EXTENSION
    2034   m_scalingListFile = cfg_ScalingListFile.empty() ? NULL : strdup(cfg_ScalingListFile.c_str());
    2035 
    2036   /* rules for input, output and internal bitdepths as per help text */
    2037 #if O0194_DIFFERENT_BITDEPTH_EL_BL
    2038   for(Int layer = 0; layer < MAX_LAYERS; layer++)
    2039   {
    2040     if (!m_acLayerCfg[layer].m_internalBitDepthY) { m_acLayerCfg[layer].m_internalBitDepthY = m_acLayerCfg[layer].m_inputBitDepthY; }
    2041     if (!m_acLayerCfg[layer].m_internalBitDepthC) { m_acLayerCfg[layer].m_internalBitDepthC = m_acLayerCfg[layer].m_internalBitDepthY; }
    2042     if (!m_acLayerCfg[layer].m_inputBitDepthC) { m_acLayerCfg[layer].m_inputBitDepthC = m_acLayerCfg[layer].m_inputBitDepthY; }
    2043     if (!m_acLayerCfg[layer].m_outputBitDepthY) { m_acLayerCfg[layer].m_outputBitDepthY = m_acLayerCfg[layer].m_internalBitDepthY; }
    2044     if (!m_acLayerCfg[layer].m_outputBitDepthC) { m_acLayerCfg[layer].m_outputBitDepthC = m_acLayerCfg[layer].m_internalBitDepthC; }
    2045   }
    2046 #else
    2047   if (!m_internalBitDepthY) { m_internalBitDepthY = m_inputBitDepthY; }
    2048   if (!m_internalBitDepthC) { m_internalBitDepthC = m_internalBitDepthY; }
    2049   if (!m_inputBitDepthC) { m_inputBitDepthC = m_inputBitDepthY; }
    2050   if (!m_outputBitDepthY) { m_outputBitDepthY = m_internalBitDepthY; }
    2051   if (!m_outputBitDepthC) { m_outputBitDepthC = m_internalBitDepthC; }
    2052 #endif
    2053 
    2054 #if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
    2055   for (Int layer = 0; layer < MAX_LAYERS; layer++)
    2056   {
    2057     if (m_acLayerCfg[layer].m_layerSwitchOffBegin < m_acLayerCfg[layer].m_layerSwitchOffEnd)
    2058     {
    2059       if (m_iGOPSize > 0 && (m_acLayerCfg[layer].m_layerSwitchOffBegin % m_iGOPSize) != 0)
    2060       {
    2061         printf("LayerSwitchOffBegin%d: Must be multiple of GOP size.\n", layer);
    2062         exit(EXIT_FAILURE);
    2063       }
    2064       if (m_acLayerCfg[layer].m_iIntraPeriod > 0 && (m_acLayerCfg[layer].m_layerSwitchOffEnd % m_acLayerCfg[layer].m_iIntraPeriod) != 0)
    2065       {
    2066         printf("LayerSwitchOffEnd%d: Must be IRAP picture.\n", layer);
    2067         exit(EXIT_FAILURE);
    2068       }
    2069     }
    2070   }
    2071 #endif
    2072 
    2073 #if !SVC_EXTENSION
    2074   // TODO:ChromaFmt assumes 4:2:0 below
     2728#else //SVC_EXTENSION
    20752729  switch (m_conformanceWindowMode)
    20762730  {
     
    21012755        }
    21022756      }
    2103       if (m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0)
     2757      if (m_aiPad[0] % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0)
    21042758      {
    21052759        fprintf(stderr, "Error: picture width is not an integer multiple of the specified chroma subsampling\n");
    21062760        exit(EXIT_FAILURE);
    21072761      }
    2108       if (m_aiPad[1] % TComSPS::getWinUnitY(CHROMA_420) != 0)
     2762      if (m_aiPad[1] % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0)
    21092763      {
    21102764        fprintf(stderr, "Error: picture height is not an integer multiple of the specified chroma subsampling\n");
     
    21372791    }
    21382792  }
    2139  
     2793
    21402794  // allocate slice-based dQP values
    21412795  m_aidQP = new Int[ m_framesToBeEncoded + m_iGOPSize + 1 ];
    21422796  ::memset( m_aidQP, 0, sizeof(Int)*( m_framesToBeEncoded + m_iGOPSize + 1 ) );
    2143  
     2797
    21442798  // handling of floating-point QP values
    21452799  // if QP is not integer, sequence is split into two sections having QP and QP+1
     
    21482802  {
    21492803    Int iSwitchPOC = (Int)( m_framesToBeEncoded - (m_fQP - m_iQP)*m_framesToBeEncoded + 0.5 );
    2150    
     2804
    21512805    iSwitchPOC = (Int)( (Double)iSwitchPOC / m_iGOPSize + 0.5 )*m_iGOPSize;
    21522806    for ( Int i=iSwitchPOC; i<m_framesToBeEncoded + m_iGOPSize + 1; i++ )
     
    21552809    }
    21562810  }
    2157  
     2811
     2812  for(UInt ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++)
     2813  {
     2814    if (saoOffsetBitShift[ch]<0)
     2815    {
     2816      if (m_internalBitDepth[ch]>10)
     2817      {
     2818        m_saoOffsetBitShift[ch]=UInt(Clip3<Int>(0, m_internalBitDepth[ch]-10, Int(m_internalBitDepth[ch]-10 + 0.165*m_iQP - 3.22 + 0.5) ) );
     2819      }
     2820      else
     2821      {
     2822        m_saoOffsetBitShift[ch]=0;
     2823      }
     2824    }
     2825    else
     2826    {
     2827      m_saoOffsetBitShift[ch]=UInt(saoOffsetBitShift[ch]);
     2828    }
     2829  }
     2830
    21582831  // reading external dQP description from file
    21592832  if ( m_pchdQPFile )
     
    21752848  m_iWaveFrontSubstreams = m_iWaveFrontSynchro ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1;
    21762849#endif
     2850  if( m_masteringDisplay.colourVolumeSEIEnabled )
     2851  {
     2852    for(UInt idx=0; idx<6; idx++)
     2853    {
     2854      m_masteringDisplay.primaries[idx/2][idx%2] = UShort((cfg_DisplayPrimariesCode.values.size() > idx) ? cfg_DisplayPrimariesCode.values[idx] : 0);
     2855    }
     2856    for(UInt idx=0; idx<2; idx++)
     2857    {
     2858      m_masteringDisplay.whitePoint[idx] = UShort((cfg_DisplayWhitePointCode.values.size() > idx) ? cfg_DisplayWhitePointCode.values[idx] : 0);
     2859    }
     2860  }
     2861   
    21772862  if( m_toneMappingInfoSEIEnabled && !m_toneMapCancelFlag )
    21782863  {
    2179     Char* pcStartOfCodedInterval = cfg_startOfCodedInterval.empty() ? NULL: strdup(cfg_startOfCodedInterval.c_str());
    2180     Char* pcCodedPivotValue = cfg_codedPivotValue.empty() ? NULL: strdup(cfg_codedPivotValue.c_str());
    2181     Char* pcTargetPivotValue = cfg_targetPivotValue.empty() ? NULL: strdup(cfg_targetPivotValue.c_str());
    2182     if( m_toneMapModelId == 2 && pcStartOfCodedInterval )
    2183     {
    2184       char *startOfCodedInterval;
    2185       UInt num = 1u<< m_toneMapTargetBitDepth;
     2864    if( m_toneMapModelId == 2 && !cfg_startOfCodedInterval.values.empty() )
     2865    {
     2866      const UInt num = 1u<< m_toneMapTargetBitDepth;
    21862867      m_startOfCodedInterval = new Int[num];
    2187       ::memset( m_startOfCodedInterval, 0, sizeof(Int)*num );
    2188       startOfCodedInterval = strtok(pcStartOfCodedInterval, " .");
    2189       int i = 0;
    2190       while( startOfCodedInterval && ( i < num ) )
    2191       {
    2192         m_startOfCodedInterval[i] = atoi( startOfCodedInterval );
    2193         startOfCodedInterval = strtok(NULL, " .");
    2194         i++;
    2195       }
    2196     }
     2868      for(UInt i=0; i<num; i++)
     2869      {
     2870        m_startOfCodedInterval[i] = cfg_startOfCodedInterval.values.size() > i ? cfg_startOfCodedInterval.values[i] : 0;
     2871      }
     2872    }
    21972873    else
    21982874    {
     
    22012877    if( ( m_toneMapModelId == 3 ) && ( m_numPivots > 0 ) )
    22022878    {
    2203       if( pcCodedPivotValue && pcTargetPivotValue )
    2204       {
    2205         char *codedPivotValue;
    2206         char *targetPivotValue;
    2207         m_codedPivotValue = new Int[m_numPivots];
     2879      if( !cfg_codedPivotValue.values.empty() && !cfg_targetPivotValue.values.empty() )
     2880      {
     2881        m_codedPivotValue  = new Int[m_numPivots];
    22082882        m_targetPivotValue = new Int[m_numPivots];
    2209         ::memset( m_codedPivotValue, 0, sizeof(Int)*( m_numPivots ) );
    2210         ::memset( m_targetPivotValue, 0, sizeof(Int)*( m_numPivots ) );
    2211         codedPivotValue = strtok(pcCodedPivotValue, " .");
    2212         int i=0;
    2213         while(codedPivotValue&&i<m_numPivots)
     2883        for(UInt i=0; i<m_numPivots; i++)
    22142884        {
    2215           m_codedPivotValue[i] = atoi( codedPivotValue );
    2216           codedPivotValue = strtok(NULL, " .");
    2217           i++;
    2218         }
    2219         i=0;
    2220         targetPivotValue = strtok(pcTargetPivotValue, " .");
    2221         while(targetPivotValue&&i<m_numPivots)
    2222         {
    2223           m_targetPivotValue[i]= atoi( targetPivotValue );
    2224           targetPivotValue = strtok(NULL, " .");
    2225           i++;
     2885          m_codedPivotValue[i]  = cfg_codedPivotValue.values.size()  > i ? cfg_codedPivotValue.values [i] : 0;
     2886          m_targetPivotValue[i] = cfg_targetPivotValue.values.size() > i ? cfg_targetPivotValue.values[i] : 0;
    22262887        }
    22272888      }
     
    22322893      m_targetPivotValue = NULL;
    22332894    }
    2234 
    2235     if( pcStartOfCodedInterval )
    2236     {
    2237       free( pcStartOfCodedInterval );
    2238       pcStartOfCodedInterval = NULL;
    2239     }
    2240 
    2241     if( pcCodedPivotValue )
    2242     {
    2243       free( pcCodedPivotValue );
    2244       pcCodedPivotValue = NULL;
    2245     }
    2246 
    2247     if( pcTargetPivotValue )
    2248     {
    2249       free( pcTargetPivotValue );
    2250       pcTargetPivotValue = NULL;
    2251     }
    2252   }
    2253 #if P0050_KNEE_FUNCTION_SEI
     2895  }
     2896
    22542897  if( m_kneeSEIEnabled && !m_kneeSEICancelFlag )
    22552898  {
    2256     Char* pcInputKneePointValue  = cfg_kneeSEIInputKneePointValue.empty()  ? NULL : strdup(cfg_kneeSEIInputKneePointValue.c_str());
    2257     Char* pcOutputKneePointValue = cfg_kneeSEIOutputKneePointValue.empty() ? NULL : strdup(cfg_kneeSEIOutputKneePointValue.c_str());
    22582899    assert ( m_kneeSEINumKneePointsMinus1 >= 0 && m_kneeSEINumKneePointsMinus1 < 999 );
    2259     m_kneeSEIInputKneePoint = new Int[m_kneeSEINumKneePointsMinus1+1];
     2900    m_kneeSEIInputKneePoint  = new Int[m_kneeSEINumKneePointsMinus1+1];
    22602901    m_kneeSEIOutputKneePoint = new Int[m_kneeSEINumKneePointsMinus1+1];
    2261     char *InputVal = strtok(pcInputKneePointValue, " .,");
    2262     Int i=0;
    2263     while( InputVal && i<(m_kneeSEINumKneePointsMinus1+1) )
    2264     {
    2265       m_kneeSEIInputKneePoint[i] = (UInt) atoi( InputVal );
    2266       InputVal = strtok(NULL, " .,");
    2267       i++;
    2268     }
    2269     char *OutputVal = strtok(pcOutputKneePointValue, " .,");
    2270     i=0;
    2271     while( OutputVal && i<(m_kneeSEINumKneePointsMinus1+1) )
    2272     {
    2273       m_kneeSEIOutputKneePoint[i] = (UInt) atoi( OutputVal );
    2274       OutputVal = strtok(NULL, " .,");
    2275       i++;
    2276     }
    2277 
    2278     if( pcInputKneePointValue )
    2279     {
    2280       free( pcInputKneePointValue );
    2281       pcInputKneePointValue = NULL;
    2282     }
    2283 
    2284     if( pcOutputKneePointValue )
    2285     {
    2286       free( pcOutputKneePointValue );
    2287       pcOutputKneePointValue = NULL;
    2288     }
    2289   }
    2290 #endif
     2902    for(Int i=0; i<(m_kneeSEINumKneePointsMinus1+1); i++)
     2903    {
     2904      m_kneeSEIInputKneePoint[i]  = cfg_kneeSEIInputKneePointValue.values.size()  > i ? cfg_kneeSEIInputKneePointValue.values[i]  : 1;
     2905      m_kneeSEIOutputKneePoint[i] = cfg_kneeSEIOutputKneePointValue.values.size() > i ? cfg_kneeSEIOutputKneePointValue.values[i] : 0;
     2906    }
     2907  }
     2908
     2909  if(m_timeCodeSEIEnabled)
     2910  {
     2911    for(Int i = 0; i < m_timeCodeSEINumTs && i < MAX_TIMECODE_SEI_SETS; i++)
     2912    {
     2913      m_timeSetArray[i].clockTimeStampFlag    = cfg_timeCodeSeiTimeStampFlag        .values.size()>i ? cfg_timeCodeSeiTimeStampFlag        .values [i] : false;
     2914      m_timeSetArray[i].numUnitFieldBasedFlag = cfg_timeCodeSeiNumUnitFieldBasedFlag.values.size()>i ? cfg_timeCodeSeiNumUnitFieldBasedFlag.values [i] : 0;
     2915      m_timeSetArray[i].countingType          = cfg_timeCodeSeiCountingType         .values.size()>i ? cfg_timeCodeSeiCountingType         .values [i] : 0;
     2916      m_timeSetArray[i].fullTimeStampFlag     = cfg_timeCodeSeiFullTimeStampFlag    .values.size()>i ? cfg_timeCodeSeiFullTimeStampFlag    .values [i] : 0;
     2917      m_timeSetArray[i].discontinuityFlag     = cfg_timeCodeSeiDiscontinuityFlag    .values.size()>i ? cfg_timeCodeSeiDiscontinuityFlag    .values [i] : 0;
     2918      m_timeSetArray[i].cntDroppedFlag        = cfg_timeCodeSeiCntDroppedFlag       .values.size()>i ? cfg_timeCodeSeiCntDroppedFlag       .values [i] : 0;
     2919      m_timeSetArray[i].numberOfFrames        = cfg_timeCodeSeiNumberOfFrames       .values.size()>i ? cfg_timeCodeSeiNumberOfFrames       .values [i] : 0;
     2920      m_timeSetArray[i].secondsValue          = cfg_timeCodeSeiSecondsValue         .values.size()>i ? cfg_timeCodeSeiSecondsValue         .values [i] : 0;
     2921      m_timeSetArray[i].minutesValue          = cfg_timeCodeSeiMinutesValue         .values.size()>i ? cfg_timeCodeSeiMinutesValue         .values [i] : 0;
     2922      m_timeSetArray[i].hoursValue            = cfg_timeCodeSeiHoursValue           .values.size()>i ? cfg_timeCodeSeiHoursValue           .values [i] : 0;
     2923      m_timeSetArray[i].secondsFlag           = cfg_timeCodeSeiSecondsFlag          .values.size()>i ? cfg_timeCodeSeiSecondsFlag          .values [i] : 0;
     2924      m_timeSetArray[i].minutesFlag           = cfg_timeCodeSeiMinutesFlag          .values.size()>i ? cfg_timeCodeSeiMinutesFlag          .values [i] : 0;
     2925      m_timeSetArray[i].hoursFlag             = cfg_timeCodeSeiHoursFlag            .values.size()>i ? cfg_timeCodeSeiHoursFlag            .values [i] : 0;
     2926      m_timeSetArray[i].timeOffsetLength      = cfg_timeCodeSeiTimeOffsetLength     .values.size()>i ? cfg_timeCodeSeiTimeOffsetLength     .values [i] : 0;
     2927      m_timeSetArray[i].timeOffsetValue       = cfg_timeCodeSeiTimeOffsetValue      .values.size()>i ? cfg_timeCodeSeiTimeOffsetValue      .values [i] : 0;
     2928    }
     2929  }
    22912930#if Q0096_OVERLAY_SEI
    22922931  if( m_overlaySEIEnabled && !m_overlayInfoCancelFlag )
     
    23673006#if !SVC_EXTENSION
    23683007  // reading external Colour Remapping Information SEI message parameters from file
    2369   if( m_colourRemapSEIFile.size() > 0 )
     3008  if( m_colourRemapSEIFile )
    23703009  {
    23713010    FILE* fic;
     
    23733012    if((fic = fopen(m_colourRemapSEIFile.c_str(),"r")) == (FILE*)NULL)
    23743013    {
    2375       fprintf(stderr, "Can't open Colour Remapping Information SEI parameters file %s\n", m_colourRemapSEIFile.c_str());
     3014      fprintf(stderr, "Can't open Colour Remapping Information SEI parameters file %s\n", m_colourRemapSEIFile);
    23763015      exit(EXIT_FAILURE);
    23773016    }
     
    25743213#endif
    25753214  // check validity of input parameters
     3215#if SVC_EXTENSION
     3216  for( UInt layerId = 0; layerId < m_numLayers; layerId++ )
     3217  {
     3218    xCheckParameter(layerId);
     3219  }
     3220#else
    25763221  xCheckParameter();
    2577  
     3222#endif
     3223
    25783224  // set global varibles
    25793225#if LAYER_CTB
     
    25883234  // print-out parameters
    25893235  xPrintParameter();
    2590  
     3236
    25913237  return true;
    25923238}
     3239
     3240
    25933241// ====================================================================================================================
    25943242// Private member functions
    25953243// ====================================================================================================================
    25963244
    2597 Bool confirmPara(Bool bflag, const Char* message);
    2598 
     3245#if SVC_EXTENSION
     3246Void TAppEncCfg::xCheckParameter(UInt layerId)
     3247{
     3248  Bool m_useExtendedPrecision                = m_acLayerCfg[layerId].m_useExtendedPrecision;
     3249  Bool m_useHighPrecisionPredictionWeighting = m_acLayerCfg[layerId].m_useHighPrecisionPredictionWeighting;
     3250  ChromaFormat m_chromaFormatIDC             = m_acLayerCfg[layerId].m_chromaFormatIDC;
     3251  ChromaFormat m_chromaFormatConstraint      = m_acLayerCfg[layerId].m_chromaFormatConstraint;
     3252  ChromaFormat m_InputChromaFormatIDC        = m_acLayerCfg[layerId].m_InputChromaFormatIDC;
     3253
     3254  Int m_inputBitDepth[]       = {m_acLayerCfg[layerId].m_inputBitDepth[CHANNEL_TYPE_LUMA],       m_acLayerCfg[layerId].m_inputBitDepth[CHANNEL_TYPE_CHROMA]};
     3255  Int m_internalBitDepth[]    = {m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_LUMA],    m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_CHROMA]};
     3256  Int m_MSBExtendedBitDepth[] = {m_acLayerCfg[layerId].m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA], m_acLayerCfg[layerId].m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA]}; 
     3257
     3258  m_saoOffsetBitShift[CHANNEL_TYPE_LUMA]   = m_acLayerCfg[layerId].m_saoOffsetBitShift[CHANNEL_TYPE_LUMA];
     3259  m_saoOffsetBitShift[CHANNEL_TYPE_CHROMA] = m_acLayerCfg[layerId].m_saoOffsetBitShift[CHANNEL_TYPE_CHROMA];
     3260
     3261#if MULTIPLE_PTL_SUPPORT
     3262  Int layerPTLIdx = m_acLayerCfg[layerId].m_layerPTLIdx;
     3263  Profile::Name m_profile           = m_profileList[layerPTLIdx];
     3264  UInt m_bitDepthConstraint         = m_acLayerCfg[layerId].m_bitDepthConstraint;
     3265  Bool m_intraConstraintFlag        = m_acLayerCfg[layerId].m_intraConstraintFlag;
     3266  Bool m_lowerBitRateConstraintFlag = m_acLayerCfg[layerId].m_lowerBitRateConstraintFlag;
     3267#endif
     3268#else
    25993269Void TAppEncCfg::xCheckParameter()
    26003270{
     3271#endif
     3272
    26013273  if (!m_decodedPictureHashSEIEnabled)
    26023274  {
     
    26073279    fprintf(stderr, "******************************************************************\n");
    26083280  }
    2609  
    26103281#if SVC_EXTENSION && MULTIPLE_PTL_SUPPORT
    26113282  Int ii = 0;
    2612   while ( ii < m_numPTLInfo )
     3283  while( ii < m_numPTLInfo )
    26133284  {
    26143285    if( m_profileList[ii] == Profile::NONE )
     
    26263297    ii++;
    26273298  }
    2628   if (m_numLayers > 1 && m_numPTLInfo > 1 && !m_nonHEVCBaseLayerFlag)
     3299  if( m_numLayers > 1 && m_numPTLInfo > 1 && !m_nonHEVCBaseLayerFlag )
    26293300  {
    26303301    assert(m_profileList[0] <= Profile::MULTIVIEWMAIN);  //Profile IDC of PTL in VPS shall be one of single-layer profile IDCs
     
    26513322  Bool check_failed = false; /* abort if there is a fatal configuration problem */
    26523323#define xConfirmPara(a,b) check_failed |= confirmPara(a,b)
     3324
     3325  const UInt maxBitDepth=(m_chromaFormatIDC==CHROMA_400) ? m_internalBitDepth[CHANNEL_TYPE_LUMA] : std::max(m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA]);
     3326  xConfirmPara(m_bitDepthConstraint<maxBitDepth, "The internalBitDepth must not be greater than the bitDepthConstraint value");
     3327  xConfirmPara(m_chromaFormatConstraint<m_chromaFormatIDC, "The chroma format used must not be greater than the chromaFormatConstraint value");
     3328
     3329  if (m_profile==Profile::MAINREXT || m_profile==Profile::HIGHTHROUGHPUTREXT)
     3330  {
     3331    xConfirmPara(m_lowerBitRateConstraintFlag==false && m_intraConstraintFlag==false, "The lowerBitRateConstraint flag cannot be false when intraConstraintFlag is false");
     3332    xConfirmPara(m_alignCABACBeforeBypass && m_profile!=Profile::HIGHTHROUGHPUTREXT, "AlignCABACBeforeBypass must not be enabled unless the high throughput profile is being used.");
     3333    if (m_profile == Profile::MAINREXT)
     3334    {
     3335      const UInt intraIdx = m_intraConstraintFlag ? 1:0;
     3336      const UInt bitDepthIdx = (m_bitDepthConstraint == 8 ? 0 : (m_bitDepthConstraint ==10 ? 1 : (m_bitDepthConstraint == 12 ? 2 : (m_bitDepthConstraint == 16 ? 3 : 4 ))));
     3337      const UInt chromaFormatIdx = UInt(m_chromaFormatConstraint);
     3338      const Bool bValidProfile = (bitDepthIdx > 3 || chromaFormatIdx>3) ? false : (validRExtProfileNames[intraIdx][bitDepthIdx][chromaFormatIdx] != NONE);
     3339      xConfirmPara(!bValidProfile, "Invalid intra constraint flag, bit depth constraint flag and chroma format constraint flag combination for a RExt profile");
     3340      const Bool bUsingGeneralRExtTools  = m_useResidualRotation                    ||
     3341                                           m_useSingleSignificanceMapContext        ||
     3342                                           m_useResidualDPCM[RDPCM_SIGNAL_IMPLICIT] ||
     3343                                           m_useResidualDPCM[RDPCM_SIGNAL_EXPLICIT] ||
     3344                                           !m_enableIntraReferenceSmoothing         ||
     3345                                           m_useGolombRiceParameterAdaptation       ||
     3346                                           m_transformSkipLog2MaxSize!=2;
     3347      const Bool bUsingChromaQPTool      = m_maxCUChromaQpAdjustmentDepth >= 0;
     3348      const Bool bUsingExtendedPrecision = m_useExtendedPrecision;
     3349
     3350      xConfirmPara((m_chromaFormatConstraint==CHROMA_420 || m_chromaFormatConstraint==CHROMA_400) && bUsingChromaQPTool, "CU Chroma QP adjustment cannot be used for 4:0:0 or 4:2:0 RExt profiles");
     3351      xConfirmPara(m_bitDepthConstraint != 16 && bUsingExtendedPrecision, "Extended precision can only be used in 16-bit RExt profiles");
     3352      if (!(m_chromaFormatConstraint == CHROMA_400 && m_bitDepthConstraint == 16) && m_chromaFormatConstraint!=CHROMA_444)
     3353      {
     3354        xConfirmPara(bUsingGeneralRExtTools, "Combination of tools and profiles are not possible in the specified RExt profile.");
     3355      }
     3356      if (!m_intraConstraintFlag && m_bitDepthConstraint==16 && m_chromaFormatConstraint==CHROMA_444)
     3357      {
     3358        fprintf(stderr, "********************************************************************************************************\n");
     3359        fprintf(stderr, "** WARNING: The RExt constraint flags describe a non standard combination (used for development only) **\n");
     3360        fprintf(stderr, "********************************************************************************************************\n");
     3361      }
     3362    }
     3363    else
     3364    {
     3365      xConfirmPara( m_chromaFormatConstraint != CHROMA_444, "chroma format constraint must be 4:4:4 in the High Throughput 4:4:4 16-bit Intra profile.");
     3366      xConfirmPara( m_bitDepthConstraint     != 16,         "bit depth constraint must be 4:4:4 in the High Throughput 4:4:4 16-bit Intra profile.");
     3367      xConfirmPara( m_intraConstraintFlag    != 1,          "intra constraint flag must be 1 in the High Throughput 4:4:4 16-bit Intra profile.");
     3368    }
     3369  }
     3370  else
     3371  {
     3372#if MULTIPLE_PTL_SUPPORT
     3373    xConfirmPara(m_bitDepthConstraint!=((m_profile==Profile::MAIN10 || m_profile==Profile::SCALABLEMAIN10)?10:8), "BitDepthConstraint must be 8 for MAIN profile and 10 for MAIN10 or Scalable-main10 profile.");
     3374#else
     3375    xConfirmPara(m_bitDepthConstraint!=((m_profile==Profile::MAIN10)?10:8), "BitDepthConstraint must be 8 for MAIN profile and 10 for MAIN10 profile.");
     3376#endif
     3377    xConfirmPara(m_chromaFormatConstraint!=CHROMA_420, "ChromaFormatConstraint must be 420 for non main-RExt profiles.");
     3378    xConfirmPara(m_intraConstraintFlag==true, "IntraConstraintFlag must be false for non main_RExt profiles.");
     3379    xConfirmPara(m_lowerBitRateConstraintFlag==false, "LowerBitrateConstraintFlag must be true for non main-RExt profiles.");
     3380
     3381    xConfirmPara(m_useCrossComponentPrediction==true, "CrossComponentPrediction must not be used for non main-RExt profiles.");
     3382    xConfirmPara(m_transformSkipLog2MaxSize!=2, "Transform Skip Log2 Max Size must be 2 for V1 profiles.");
     3383    xConfirmPara(m_useResidualRotation==true, "UseResidualRotation must not be enabled for non main-RExt profiles.");
     3384    xConfirmPara(m_useSingleSignificanceMapContext==true, "UseSingleSignificanceMapContext must not be enabled for non main-RExt profiles.");
     3385    xConfirmPara(m_useResidualDPCM[RDPCM_SIGNAL_IMPLICIT]==true, "ImplicitResidualDPCM must not be enabled for non main-RExt profiles.");
     3386    xConfirmPara(m_useResidualDPCM[RDPCM_SIGNAL_EXPLICIT]==true, "ExplicitResidualDPCM must not be enabled for non main-RExt profiles.");
     3387    xConfirmPara(m_useGolombRiceParameterAdaptation==true, "GolombRiceParameterAdaption must not be enabled for non main-RExt profiles.");
     3388    xConfirmPara(m_useExtendedPrecision==true, "UseExtendedPrecision must not be enabled for non main-RExt profiles.");
     3389    xConfirmPara(m_useHighPrecisionPredictionWeighting==true, "UseHighPrecisionPredictionWeighting must not be enabled for non main-RExt profiles.");
     3390    xConfirmPara(m_enableIntraReferenceSmoothing==false, "EnableIntraReferenceSmoothing must be enabled for non main-RExt profiles.");
     3391    xConfirmPara(m_alignCABACBeforeBypass, "AlignCABACBeforeBypass cannot be enabled for non main-RExt profiles.");
     3392  }
     3393
    26533394  // check range of parameters
    2654 #if O0194_DIFFERENT_BITDEPTH_EL_BL
    2655   for(UInt layer=0; layer<m_numLayers; layer++)
    2656   {
    2657     xConfirmPara( m_acLayerCfg[layer].m_inputBitDepthY < 8,                                                     "InputBitDepth must be at least 8" );
    2658     xConfirmPara( m_acLayerCfg[layer].m_inputBitDepthC < 8,                                                     "InputBitDepthC must be at least 8" );
    2659   }
    2660 #else
    2661   xConfirmPara( m_inputBitDepthY < 8,                                                     "InputBitDepth must be at least 8" );
    2662   xConfirmPara( m_inputBitDepthC < 8,                                                     "InputBitDepthC must be at least 8" );
    2663 #endif
     3395  xConfirmPara( m_inputBitDepth[CHANNEL_TYPE_LUMA  ] < 8,                                   "InputBitDepth must be at least 8" );
     3396  xConfirmPara( m_inputBitDepth[CHANNEL_TYPE_CHROMA] < 8,                                   "InputBitDepthC must be at least 8" );
     3397
     3398#if !RExt__HIGH_BIT_DEPTH_SUPPORT
     3399  if (m_useExtendedPrecision)
     3400  {
     3401    for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
     3402    {
     3403      xConfirmPara((m_internalBitDepth[channelType] > 8) , "Model is not configured to support high enough internal accuracies - enable RExt__HIGH_BIT_DEPTH_SUPPORT to use increased precision internal data types etc...");
     3404    }
     3405  }
     3406  else
     3407  {
     3408    for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
     3409    {
     3410      xConfirmPara((m_internalBitDepth[channelType] > 12) , "Model is not configured to support high enough internal accuracies - enable RExt__HIGH_BIT_DEPTH_SUPPORT to use increased precision internal data types etc...");
     3411    }
     3412  }
     3413#endif
     3414
     3415  xConfirmPara( (m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ] < m_inputBitDepth[CHANNEL_TYPE_LUMA  ]), "MSB-extended bit depth for luma channel (--MSBExtendedBitDepth) must be greater than or equal to input bit depth for luma channel (--InputBitDepth)" );
     3416  xConfirmPara( (m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] < m_inputBitDepth[CHANNEL_TYPE_CHROMA]), "MSB-extended bit depth for chroma channel (--MSBExtendedBitDepthC) must be greater than or equal to input bit depth for chroma channel (--InputBitDepthC)" );
     3417
     3418  xConfirmPara( m_saoOffsetBitShift[CHANNEL_TYPE_LUMA]   > (m_internalBitDepth[CHANNEL_TYPE_LUMA  ]<10?0:(m_internalBitDepth[CHANNEL_TYPE_LUMA  ]-10)), "SaoLumaOffsetBitShift must be in the range of 0 to InternalBitDepth-10, inclusive");
     3419  xConfirmPara( m_saoOffsetBitShift[CHANNEL_TYPE_CHROMA] > (m_internalBitDepth[CHANNEL_TYPE_CHROMA]<10?0:(m_internalBitDepth[CHANNEL_TYPE_CHROMA]-10)), "SaoChromaOffsetBitShift must be in the range of 0 to InternalBitDepthC-10, inclusive");
     3420
     3421  xConfirmPara( m_chromaFormatIDC >= NUM_CHROMA_FORMAT,                                     "ChromaFormatIDC must be either 400, 420, 422 or 444" );
     3422  std::string sTempIPCSC="InputColourSpaceConvert must be empty, "+getListOfColourSpaceConverts(true);
     3423  xConfirmPara( m_inputColourSpaceConvert >= NUMBER_INPUT_COLOUR_SPACE_CONVERSIONS,         sTempIPCSC.c_str() );
     3424  xConfirmPara( m_InputChromaFormatIDC >= NUM_CHROMA_FORMAT,                                "InputChromaFormatIDC must be either 400, 420, 422 or 444" );
     3425
    26643426#if !SVC_EXTENSION 
    26653427  xConfirmPara( m_iFrameRate <= 0,                                                          "Frame rate must be more than 1" );
     
    26803442  xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 2,                   "Decoding Refresh Type must be equal to 0, 1 or 2" );
    26813443#endif
     3444
     3445  if (m_isField)
     3446  {
     3447    if (!m_pictureTimingSEIEnabled)
     3448    {
     3449      fprintf(stderr, "****************************************************************************\n");
     3450      fprintf(stderr, "** WARNING: Picture Timing SEI should be enabled for field coding!        **\n");
     3451      fprintf(stderr, "****************************************************************************\n");
     3452    }
     3453  }
     3454  if ( m_bufferingPeriodSEIEnabled && !m_activeParameterSetsSEIEnabled)
     3455  {
     3456    fprintf(stderr, "****************************************************************************\n");
     3457    fprintf(stderr, "** WARNING: using buffering period SEI requires SPS activation with       **\n");
     3458    fprintf(stderr, "**          active parameter sets SEI. Enabling active parameter sets SEI **\n");
     3459    fprintf(stderr, "****************************************************************************\n");
     3460    m_activeParameterSetsSEIEnabled = 1;
     3461  }
     3462  if ( m_pictureTimingSEIEnabled && !m_activeParameterSetsSEIEnabled)
     3463  {
     3464    fprintf(stderr, "****************************************************************************\n");
     3465    fprintf(stderr, "** WARNING: using picture timing SEI requires SPS activation with active  **\n");
     3466    fprintf(stderr, "**          parameter sets SEI. Enabling active parameter sets SEI.       **\n");
     3467    fprintf(stderr, "****************************************************************************\n");
     3468    m_activeParameterSetsSEIEnabled = 1;
     3469  }
     3470
     3471  if(m_useCrossComponentPrediction && (m_chromaFormatIDC != CHROMA_444))
     3472  {
     3473    fprintf(stderr, "****************************************************************************\n");
     3474    fprintf(stderr, "** WARNING: Cross-component prediction is specified for 4:4:4 format only **\n");
     3475    fprintf(stderr, "****************************************************************************\n");
     3476
     3477    m_useCrossComponentPrediction = false;
     3478  }
     3479
     3480  if ( m_CUTransquantBypassFlagForce && m_bUseHADME )
     3481  {
     3482    fprintf(stderr, "****************************************************************************\n");
     3483    fprintf(stderr, "** WARNING: --HadamardME has been disabled due to the enabling of         **\n");
     3484    fprintf(stderr, "**          --CUTransquantBypassFlagForce                                 **\n");
     3485    fprintf(stderr, "****************************************************************************\n");
     3486
     3487    m_bUseHADME = false; // this has been disabled so that the lambda is calculated slightly differently for lossless modes (as a result of JCTVC-R0104).
     3488  }
     3489
     3490  xConfirmPara (m_transformSkipLog2MaxSize < 2, "Transform Skip Log2 Max Size must be at least 2 (4x4)");
     3491
     3492  if (m_transformSkipLog2MaxSize!=2 && m_useTransformSkipFast)
     3493  {
     3494    fprintf(stderr, "***************************************************************************\n");
     3495    fprintf(stderr, "** WARNING: Transform skip fast is enabled (which only tests NxN splits),**\n");
     3496    fprintf(stderr, "**          but transform skip log2 max size is not 2 (4x4)              **\n");
     3497    fprintf(stderr, "**          It may be better to disable transform skip fast mode         **\n");
     3498    fprintf(stderr, "***************************************************************************\n");
     3499  }
     3500
    26823501#if !SVC_EXTENSION
    2683   xConfirmPara( m_iQP <  -6 * (m_internalBitDepthY - 8) || m_iQP > 51,                    "QP exceeds supported range (-QpBDOffsety to 51)" );
    2684 #endif
    2685   xConfirmPara( m_loopFilterBetaOffsetDiv2 < -6 || m_loopFilterBetaOffsetDiv2 > 6,          "Loop Filter Beta Offset div. 2 exceeds supported range (-6 to 6)");
    2686   xConfirmPara( m_loopFilterTcOffsetDiv2 < -6 || m_loopFilterTcOffsetDiv2 > 6,              "Loop Filter Tc Offset div. 2 exceeds supported range (-6 to 6)");
     3502  xConfirmPara( m_iQP <  -6 * (m_internalBitDepth[CHANNEL_TYPE_LUMA] - 8) || m_iQP > 51,    "QP exceeds supported range (-QpBDOffsety to 51)" );
     3503#endif
     3504  xConfirmPara( m_loopFilterBetaOffsetDiv2 < -6 || m_loopFilterBetaOffsetDiv2 > 6,        "Loop Filter Beta Offset div. 2 exceeds supported range (-6 to 6)");
     3505  xConfirmPara( m_loopFilterTcOffsetDiv2 < -6 || m_loopFilterTcOffsetDiv2 > 6,            "Loop Filter Tc Offset div. 2 exceeds supported range (-6 to 6)");
    26873506  xConfirmPara( m_iFastSearch < 0 || m_iFastSearch > 2,                                     "Fast Search Mode is not supported value (0:Full search  1:Diamond  2:PMVFAST)" );
    26883507  xConfirmPara( m_iSearchRange < 0 ,                                                        "Search Range must be more than 0" );
     
    27243543  xConfirmPara( m_uiQuadtreeTULog2MinSize < 2,                                        "QuadtreeTULog2MinSize must be 2 or greater.");
    27253544  xConfirmPara( m_uiQuadtreeTULog2MaxSize > 5,                                        "QuadtreeTULog2MaxSize must be 5 or smaller.");
    2726   xConfirmPara( (1<<m_uiQuadtreeTULog2MaxSize) > m_uiMaxCUWidth,                                        "QuadtreeTULog2MaxSize must be log2(maxCUSize) or smaller.");
    2727  
    27283545  xConfirmPara( m_uiQuadtreeTULog2MaxSize < m_uiQuadtreeTULog2MinSize,                "QuadtreeTULog2MaxSize must be greater than or equal to m_uiQuadtreeTULog2MinSize.");
    2729   xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUWidth >>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS
    2730   xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUHeight>>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS
    2731   xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUWidth  >> m_uiMaxCUDepth ), "Minimum CU width must be greater than minimum transform size." );
    2732   xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUHeight >> m_uiMaxCUDepth ), "Minimum CU height must be greater than minimum transform size." );
     3546  xConfirmPara( (1<<m_uiQuadtreeTULog2MaxSize) > m_uiMaxCUWidth,                      "QuadtreeTULog2MaxSize must be log2(maxCUSize) or smaller.");
     3547  xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) >= ( m_uiMaxCUWidth  >> (m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than or equal to minimum CU size" );
     3548  xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) >= ( m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than or equal to minimum CU size" );
    27333549  xConfirmPara( m_uiQuadtreeTUMaxDepthInter < 1,                                                         "QuadtreeTUMaxDepthInter must be greater than or equal to 1" );
    27343550  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" );
     
    27493565  if( m_usePCM)
    27503566  {
     3567    for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
     3568    {
     3569      xConfirmPara(((m_MSBExtendedBitDepth[channelType] > m_internalBitDepth[channelType]) && m_bPCMInputBitDepthFlag), "PCM bit depth cannot be greater than internal bit depth (PCMInputBitDepthFlag cannot be used when InputBitDepth or MSBExtendedBitDepth > InternalBitDepth)");
     3570    }
    27513571    xConfirmPara(  m_uiPCMLog2MinSize < 3,                                      "PCMLog2MinSize must be 3 or greater.");
    27523572    xConfirmPara(  m_uiPCMLog2MinSize > 5,                                      "PCMLog2MinSize must be 5 or smaller.");
     
    27683588#if !SVC_EXTENSION
    27693589  Bool tileFlag = (m_numTileColumnsMinus1 > 0 || m_numTileRowsMinus1 > 0 );
    2770   xConfirmPara( tileFlag && m_iWaveFrontSynchro,            "Tile and Wavefront can not be applied together");
    2771 
    2772   //TODO:ChromaFmt assumes 4:2:0 below
    2773   xConfirmPara( m_iSourceWidth  % TComSPS::getWinUnitX(CHROMA_420) != 0, "Picture width must be an integer multiple of the specified chroma subsampling");
    2774   xConfirmPara( m_iSourceHeight % TComSPS::getWinUnitY(CHROMA_420) != 0, "Picture height must be an integer multiple of the specified chroma subsampling");
    2775 
    2776   xConfirmPara( m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0, "Horizontal padding must be an integer multiple of the specified chroma subsampling");
    2777   xConfirmPara( m_aiPad[1] % TComSPS::getWinUnitY(CHROMA_420) != 0, "Vertical padding must be an integer multiple of the specified chroma subsampling");
    2778 
    2779   xConfirmPara( m_confWinLeft   % TComSPS::getWinUnitX(CHROMA_420) != 0, "Left conformance window offset must be an integer multiple of the specified chroma subsampling");
    2780   xConfirmPara( m_confWinRight  % TComSPS::getWinUnitX(CHROMA_420) != 0, "Right conformance window offset must be an integer multiple of the specified chroma subsampling");
    2781   xConfirmPara( m_confWinTop    % TComSPS::getWinUnitY(CHROMA_420) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling");
    2782   xConfirmPara( m_confWinBottom % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling");
     3590  if (m_profile!=Profile::HIGHTHROUGHPUTREXT)
     3591  {
     3592    xConfirmPara( tileFlag && m_iWaveFrontSynchro,            "Tile and Wavefront can not be applied together, except in the High Throughput Intra 4:4:4 16 profile");
     3593  }
     3594
     3595  xConfirmPara( m_iSourceWidth  % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Picture width must be an integer multiple of the specified chroma subsampling");
     3596  xConfirmPara( m_iSourceHeight % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Picture height must be an integer multiple of the specified chroma subsampling");
     3597
     3598  xConfirmPara( m_aiPad[0] % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Horizontal padding must be an integer multiple of the specified chroma subsampling");
     3599  xConfirmPara( m_aiPad[1] % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Vertical padding must be an integer multiple of the specified chroma subsampling");
     3600
     3601  xConfirmPara( m_confWinLeft   % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Left conformance window offset must be an integer multiple of the specified chroma subsampling");
     3602  xConfirmPara( m_confWinRight  % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Right conformance window offset must be an integer multiple of the specified chroma subsampling");
     3603  xConfirmPara( m_confWinTop    % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling");
     3604  xConfirmPara( m_confWinBottom % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling");
    27833605
    27843606  xConfirmPara( m_defaultDisplayWindowFlag && !m_vuiParametersPresentFlag, "VUI needs to be enabled for default display window");
     
    27863608  if (m_defaultDisplayWindowFlag)
    27873609  {
    2788     xConfirmPara( m_defDispWinLeftOffset   % TComSPS::getWinUnitX(CHROMA_420) != 0, "Left default display window offset must be an integer multiple of the specified chroma subsampling");
    2789     xConfirmPara( m_defDispWinRightOffset  % TComSPS::getWinUnitX(CHROMA_420) != 0, "Right default display window offset must be an integer multiple of the specified chroma subsampling");
    2790     xConfirmPara( m_defDispWinTopOffset    % TComSPS::getWinUnitY(CHROMA_420) != 0, "Top default display window offset must be an integer multiple of the specified chroma subsampling");
    2791     xConfirmPara( m_defDispWinBottomOffset % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom default display window offset must be an integer multiple of the specified chroma subsampling");
     3610    xConfirmPara( m_defDispWinLeftOffset   % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Left default display window offset must be an integer multiple of the specified chroma subsampling");
     3611    xConfirmPara( m_defDispWinRightOffset  % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Right default display window offset must be an integer multiple of the specified chroma subsampling");
     3612    xConfirmPara( m_defDispWinTopOffset    % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Top default display window offset must be an integer multiple of the specified chroma subsampling");
     3613    xConfirmPara( m_defDispWinBottomOffset % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Bottom default display window offset must be an integer multiple of the specified chroma subsampling");
    27923614  }
    27933615#endif
     
    28243646    m_GOPList[0].m_numRefPicsActive = 4;
    28253647  }
    2826 
    2827   for(UInt layer = 0; layer < MAX_LAYERS; layer++)
    2828   {
    2829     if (m_acLayerCfg[layer].m_iIntraPeriod == 1 && m_EhGOPList[layer][0].m_POC == -1) {
    2830       m_EhGOPList[layer][0] = GOPEntry();
    2831       m_EhGOPList[layer][0].m_QPFactor = 1;
    2832       m_EhGOPList[layer][0].m_betaOffsetDiv2 = 0;
    2833       m_EhGOPList[layer][0].m_tcOffsetDiv2 = 0;
    2834       m_EhGOPList[layer][0].m_POC = 1;
    2835       m_EhGOPList[layer][0].m_numRefPicsActive = 4;
    2836     }
     3648  else
     3649  {
     3650    xConfirmPara( m_intraConstraintFlag, "IntraConstraintFlag cannot be 1 for inter sequences");
     3651  }
     3652
     3653  if (m_acLayerCfg[layerId].m_iIntraPeriod == 1 && m_EhGOPList[layerId][0].m_POC == -1) {
     3654    m_EhGOPList[layerId][0] = GOPEntry();
     3655    m_EhGOPList[layerId][0].m_QPFactor = 1;
     3656    m_EhGOPList[layerId][0].m_betaOffsetDiv2 = 0;
     3657    m_EhGOPList[layerId][0].m_tcOffsetDiv2 = 0;
     3658    m_EhGOPList[layerId][0].m_POC = 1;
     3659    m_EhGOPList[layerId][0].m_numRefPicsActive = 4;
     3660  }
     3661  else
     3662  {
     3663    xConfirmPara( m_intraConstraintFlag, "IntraConstraintFlag cannot be 1 for inter sequences");
    28373664  }
    28383665#else
     
    28483675      m_GOPList[0].m_numRefPicsActive = 4;
    28493676    }
    2850   }
    2851 #endif
    2852 #else
    2853   if (m_iIntraPeriod == 1 && m_GOPList[0].m_POC == -1) {
     3677    else
     3678    {
     3679      xConfirmPara( m_intraConstraintFlag, "IntraConstraintFlag cannot be 1 for inter sequences");
     3680    }
     3681  }
     3682#endif
     3683#else
     3684  if (m_iIntraPeriod == 1 && m_GOPList[0].m_POC == -1)
     3685  {
    28543686    m_GOPList[0] = GOPEntry();
    28553687    m_GOPList[0].m_QPFactor = 1;
     
    28583690    m_GOPList[0].m_POC = 1;
    28593691    m_GOPList[0].m_numRefPicsActive = 4;
     3692  }
     3693  else
     3694  {
     3695    xConfirmPara( m_intraConstraintFlag, "IntraConstraintFlag cannot be 1 for inter sequences");
    28603696  }
    28613697#endif
     
    28723708  }
    28733709  Bool isOK[MAX_GOP];
    2874   for(Int i=0; i<MAX_GOP; i++) 
     3710  for(Int i=0; i<MAX_GOP; i++)
    28753711  {
    28763712    isOK[i]=false;
     
    29063742
    29073743  // verify layer configuration parameters
    2908   for(UInt layer=0; layer<m_numLayers; layer++)
    2909   {
    2910     if(m_acLayerCfg[layer].xCheckParameter(m_isField))
    2911     {
    2912       printf("\nError: invalid configuration parameter found in layer %d \n", layer);
    2913       check_failed = true;
    2914     }
     3744  if(m_acLayerCfg[layerId].xCheckParameter(m_isField))
     3745  {
     3746    printf("\nError: invalid configuration parameter found in layer %d \n", layerId);
     3747    check_failed = true;
    29153748  }
    29163749
    29173750  // verify layer configuration parameters
    2918   for(UInt layer=0; layer<m_numLayers; layer++)
    2919   {
    2920     Int m_iIntraPeriod = m_acLayerCfg[layer].m_iIntraPeriod;
     3751  Int m_iIntraPeriod = m_acLayerCfg[layerId].m_iIntraPeriod;
    29213752#endif
    29223753  if ( (m_iIntraPeriod != 1) && !m_loopFilterOffsetInPPS && m_DeblockingFilterControlPresent && (!m_bLoopFilterDisable) )
     
    29283759    }
    29293760  }
    2930 #if SVC_EXTENSION
    2931   }
    2932 #endif
    29333761
    29343762#if !Q0108_TSA_STSA
    2935    m_extraRPSs = 0;                                      
     3763  m_extraRPSs=0;                                     
    29363764#else
    29373765  memset( m_extraRPSs, 0, sizeof( m_extraRPSs ) );
    29383766#endif
    29393767  //start looping through frames in coding order until we can verify that the GOP structure is correct.
    2940   while(!verifiedGOP&&!errorGOP) 
     3768  while(!verifiedGOP&&!errorGOP)
    29413769  {
    29423770    Int curGOP = (checkGOP-1)%m_iGOPSize;
    2943     Int curPOC = ((checkGOP-1)/m_iGOPSize)*m_iGOPSize + m_GOPList[curGOP].m_POC;   
    2944     if(m_GOPList[curGOP].m_POC<0) 
     3771    Int curPOC = ((checkGOP-1)/m_iGOPSize)*m_iGOPSize + m_GOPList[curGOP].m_POC;
     3772    if(m_GOPList[curGOP].m_POC<0)
    29453773    {
    29463774      printf("\nError: found fewer Reference Picture Sets than GOPSize\n");
    29473775      errorGOP=true;
    29483776    }
    2949     else 
     3777    else
    29503778    {
    29513779      //check that all reference pictures are available, or have a POC < 0 meaning they might be available in the next GOP.
    29523780      Bool beforeI = false;
    2953       for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) 
     3781      for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++)
    29543782      {
    29553783        Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i];
     
    29583786          beforeI=true;
    29593787        }
    2960         else 
     3788        else
    29613789        {
    29623790          Bool found=false;
    2963           for(Int j=0; j<numRefs; j++) 
     3791          for(Int j=0; j<numRefs; j++)
    29643792          {
    2965             if(refList[j]==absPOC) 
     3793            if(refList[j]==absPOC)
    29663794            {
    29673795              found=true;
     
    29893817      {
    29903818        //all ref frames were present
    2991         if(!isOK[curGOP]) 
     3819        if(!isOK[curGOP])
    29923820        {
    29933821          numOK++;
     
    29993827        }
    30003828      }
    3001       else 
     3829      else
    30023830      {
    30033831        //create a new GOPEntry for this frame containing all the reference pictures that were available (POC > 0)
     
    30083836#endif
    30093837        Int newRefs=0;
    3010         for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) 
     3838        for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++)
    30113839        {
    30123840          Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i];
     
    30243852        }
    30253853        Int numPrefRefs = m_GOPList[curGOP].m_numRefPicsActive;
    3026        
     3854
    30273855        for(Int offset = -1; offset>-checkGOP; offset--)
    30283856        {
     
    30403868              }
    30413869            }
    3042             for(Int i=0; i<newRefs; i++) 
     3870            for(Int i=0; i<newRefs; i++)
    30433871            {
    30443872#if !Q0108_TSA_STSA
     
    30513879              }
    30523880            }
    3053             if(newRef) 
     3881            if(newRef)
    30543882            {
    30553883              Int insertPoint=newRefs;
     
    32044032
    32054033#if SVC_EXTENSION && Q0108_TSA_STSA
    3206   for ( Int layerId = 1; layerId < m_numLayers; layerId++ )
     4034  if( layerId > 0 )
    32074035  {
    32084036    verifiedGOP=false;
     
    32344062    for(UInt layer=0; layer<m_numLayers; layer++)
    32354063    {
    3236       Int m_iIntraPeriod = m_acLayerCfg[layer].m_iIntraPeriod;
    3237       if ( (m_iIntraPeriod != 1) && !m_loopFilterOffsetInPPS && m_DeblockingFilterControlPresent && (!m_bLoopFilterDisable) )
     4064      if ( (m_acLayerCfg[layer].m_iIntraPeriod != 1) && !m_loopFilterOffsetInPPS && m_DeblockingFilterControlPresent && (!m_bLoopFilterDisable) )
    32384065      {
    32394066        for(Int i=0; i<m_iGOPSize; i++)
     
    34504277      m_maxTempLayer = m_GOPList[i].m_temporalId+1;
    34514278    }
    3452     xConfirmPara(m_GOPList[i].m_sliceType!='B'&&m_GOPList[i].m_sliceType!='P'&&m_GOPList[i].m_sliceType!='I', "Slice type must be equal to B or P or I");
     4279    xConfirmPara(m_GOPList[i].m_sliceType!='B' && m_GOPList[i].m_sliceType!='P' && m_GOPList[i].m_sliceType!='I', "Slice type must be equal to B or P or I");
    34534280  }
    34544281
    34554282#if Q0108_TSA_STSA
    3456   for ( Int layerId = 1; layerId < m_numLayers; layerId++)
     4283  if( layerId > 0 )
    34574284  {
    34584285    m_EhMaxTempLayer[layerId] = 1;
     
    34734300    m_maxDecPicBuffering[i] = 1;
    34744301  }
    3475   for(Int i=0; i<m_iGOPSize; i++) 
     4302  for(Int i=0; i<m_iGOPSize; i++)
    34764303  {
    34774304    if(m_GOPList[i].m_numRefPics+1 > m_maxDecPicBuffering[m_GOPList[i].m_temporalId])
     
    34794306      m_maxDecPicBuffering[m_GOPList[i].m_temporalId] = m_GOPList[i].m_numRefPics + 1;
    34804307    }
    3481     Int highestDecodingNumberWithLowerPOC = 0; 
     4308    Int highestDecodingNumberWithLowerPOC = 0;
    34824309    for(Int j=0; j<m_iGOPSize; j++)
    34834310    {
     
    34904317    for(Int j=0; j<highestDecodingNumberWithLowerPOC; j++)
    34914318    {
    3492       if(m_GOPList[j].m_temporalId <= m_GOPList[i].m_temporalId && 
     4319      if(m_GOPList[j].m_temporalId <= m_GOPList[i].m_temporalId &&
    34934320        m_GOPList[j].m_POC > m_GOPList[i].m_POC)
    34944321      {
    34954322        numReorder++;
    34964323      }
    3497     }   
     4324    }
    34984325    if(numReorder > m_numReorderPics[m_GOPList[i].m_temporalId])
    34994326    {
     
    35014328    }
    35024329  }
    3503   for(Int i=0; i<MAX_TLAYER-1; i++) 
     4330  for(Int i=0; i<MAX_TLAYER-1; i++)
    35044331  {
    35054332    // a lower layer can not have higher value of m_numReorderPics than a higher layer
     
    35204347  }
    35214348
    3522 
    35234349  // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ] -  1, inclusive
    35244350  if(m_numReorderPics[MAX_TLAYER-1] > m_maxDecPicBuffering[MAX_TLAYER-1] - 1)
     
    35284354
    35294355#if SVC_EXTENSION // ToDo: it should be checked for the case when parameters are different for the layers
    3530   for(UInt layer = 0; layer < MAX_LAYERS; layer++)
    3531   {
    3532     Int m_iSourceWidth = m_acLayerCfg[layer].m_iSourceWidth;
    3533     Int m_iSourceHeight = m_acLayerCfg[layer].m_iSourceHeight;
     4356  Int m_iSourceWidth = m_acLayerCfg[layerId].m_iSourceWidth;
     4357  Int m_iSourceHeight = m_acLayerCfg[layerId].m_iSourceHeight;
    35344358#if LAYER_CTB
    3535     Int m_uiMaxCUWidth = m_acLayerCfg[layer].m_uiMaxCUWidth;
    3536     Int m_uiMaxCUHeight = m_acLayerCfg[layer].m_uiMaxCUHeight;
    3537 #endif
    3538 
    3539     Bool tileFlag = (m_numTileColumnsMinus1 > 0 || m_numTileRowsMinus1 > 0 );
    3540     Int m_iWaveFrontSynchro = m_acLayerCfg[layer].m_waveFrontSynchro;
    3541     xConfirmPara( tileFlag && m_iWaveFrontSynchro,            "Tile and Wavefront can not be applied together");
     4359  Int m_uiMaxCUWidth = m_acLayerCfg[layerId].m_uiMaxCUWidth;
     4360  Int m_uiMaxCUHeight = m_acLayerCfg[layerId].m_uiMaxCUHeight;
     4361#endif
     4362
     4363  Bool tileFlag = (m_numTileColumnsMinus1 > 0 || m_numTileRowsMinus1 > 0 );
     4364  Int m_iWaveFrontSynchro = m_acLayerCfg[layerId].m_waveFrontSynchro;
     4365  xConfirmPara( tileFlag && m_iWaveFrontSynchro,            "Tile and Wavefront can not be applied together");
    35424366#endif
    35434367
    35444368  if(m_vuiParametersPresentFlag && m_bitstreamRestrictionFlag)
    3545   { 
     4369  {
    35464370    Int PicSizeInSamplesY =  m_iSourceWidth * m_iSourceHeight;
    35474371    if(tileFlag)
     
    35554379        maxTileWidth = m_uiMaxCUWidth*((widthInCU+m_numTileColumnsMinus1)/(m_numTileColumnsMinus1+1));
    35564380        maxTileHeight = m_uiMaxCUHeight*((heightInCU+m_numTileRowsMinus1)/(m_numTileRowsMinus1+1));
    3557         // if only the last tile-row is one treeblock higher than the others 
     4381        // if only the last tile-row is one treeblock higher than the others
    35584382        // the maxTileHeight becomes smaller if the last row of treeblocks has lower height than the others
    35594383        if(!((heightInCU-1)%(m_numTileRowsMinus1+1)))
    35604384        {
    35614385          maxTileHeight = maxTileHeight - m_uiMaxCUHeight + (m_iSourceHeight % m_uiMaxCUHeight);
    3562         }     
    3563         // if only the last tile-column is one treeblock wider than the others 
    3564         // the maxTileWidth becomes smaller if the last column of treeblocks has lower width than the others   
     4386        }
     4387        // if only the last tile-column is one treeblock wider than the others
     4388        // the maxTileWidth becomes smaller if the last column of treeblocks has lower width than the others
    35654389        if(!((widthInCU-1)%(m_numTileColumnsMinus1+1)))
    35664390        {
     
    36064430      m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/((2*m_iSourceHeight+m_iSourceWidth)*m_uiMaxCUHeight)-4;
    36074431    }
    3608     else if(m_sliceMode == 1)
     4432    else if(m_sliceMode == FIXED_NUMBER_OF_CTU)
    36094433    {
    36104434      m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/(m_sliceArgument*m_uiMaxCUWidth*m_uiMaxCUHeight)-4;
     
    36154439    }
    36164440  }
    3617 #if SVC_EXTENSION
    3618   }
    3619 #endif
    36204441#if !SVC_EXTENSION
    36214442  xConfirmPara( m_iWaveFrontSynchro < 0, "WaveFrontSynchro cannot be negative" );
     
    36374458    xConfirmPara( m_extendedWhiteLevelLumaCodeValue < m_nominalWhiteLevelLumaCodeValue, "SEIToneMapExtendedWhiteLevelLumaCodeValue shall be greater than or equal to SEIToneMapNominalWhiteLevelLumaCodeValue");
    36384459  }
    3639 #if P0050_KNEE_FUNCTION_SEI
     4460
    36404461  if (m_kneeSEIEnabled && !m_kneeSEICancelFlag)
    36414462  {
     
    36464467      if ( i > 0 )
    36474468      {
    3648         xConfirmPara( m_kneeSEIInputKneePoint[i-1] >= m_kneeSEIInputKneePoint[i],  "The i-th SEIKneeFunctionInputKneePointValue must be greather than the (i-1)-th value");
    3649       }
    3650     }
    3651   }
    3652 #endif
     4469        xConfirmPara( m_kneeSEIInputKneePoint[i-1] >= m_kneeSEIInputKneePoint[i],  "The i-th SEIKneeFunctionInputKneePointValue must be greater than the (i-1)-th value");
     4470        xConfirmPara( m_kneeSEIOutputKneePoint[i-1] > m_kneeSEIOutputKneePoint[i],  "The i-th SEIKneeFunctionOutputKneePointValue must be greater than or equal to the (i-1)-th value");
     4471      }
     4472    }
     4473  }
     4474
    36534475#if Q0096_OVERLAY_SEI
    36544476  if( m_overlaySEIEnabled && !m_overlayInfoCancelFlag )
     
    36674489#if Q0074_COLOUR_REMAPPING_SEI
    36684490#if !SVC_EXTENSION
    3669   if ( ( m_colourRemapSEIFile.size() > 0 ) && !m_colourRemapSEICancelFlag )
     4491  if ( m_colourRemapSEIFile && !m_colourRemapSEICancelFlag )
    36704492  {
    36714493    xConfirmPara( m_colourRemapSEIInputBitDepth < 8 || m_colourRemapSEIInputBitDepth > 16 , "colour_remap_input_bit_depth shall be in the range of 8 to 16, inclusive");
     
    37004522
    37014523#if RC_SHVC_HARMONIZATION
    3702   for ( Int layer=0; layer<m_numLayers; layer++ )
    3703   {
    3704     if ( m_acLayerCfg[layer].m_RCEnableRateControl )
    3705     {
    3706       if ( m_acLayerCfg[layer].m_RCForceIntraQP )
    3707       {
    3708         if ( m_acLayerCfg[layer].m_RCInitialQP == 0 )
    3709         {
    3710           printf( "\nInitial QP for rate control is not specified. Reset not to use force intra QP!" );
    3711           m_acLayerCfg[layer].m_RCForceIntraQP = false;
    3712         }
    3713       }
    3714     }
    3715     xConfirmPara( m_uiDeltaQpRD > 0, "Rate control cannot be used together with slice level multiple-QP optimization!\n" );
    3716   }
     4524  if ( m_acLayerCfg[layerId].m_RCEnableRateControl )
     4525  {
     4526    if ( m_acLayerCfg[layerId].m_RCForceIntraQP )
     4527    {
     4528      if ( m_acLayerCfg[layerId].m_RCInitialQP == 0 )
     4529      {
     4530        printf( "\nInitial QP for rate control is not specified. Reset not to use force intra QP!" );
     4531        m_acLayerCfg[layerId].m_RCForceIntraQP = false;
     4532      }
     4533    }
     4534  }
     4535  xConfirmPara( m_uiDeltaQpRD > 0, "Rate control cannot be used together with slice level multiple-QP optimization!\n" );
    37174536#else
    37184537  if ( m_RCEnableRateControl )
     
    37334552
    37344553  xConfirmPara(m_log2ParallelMergeLevel < 2, "Log2ParallelMergeLevel should be larger than or equal to 2");
     4554
    37354555  if (m_framePackingSEIEnabled)
    37364556  {
    37374557    xConfirmPara(m_framePackingSEIType < 3 || m_framePackingSEIType > 5 , "SEIFramePackingType must be in rage 3 to 5");
     4558  }
     4559
     4560  if (m_segmentedRectFramePackingSEIEnabled)
     4561  {
     4562    xConfirmPara(m_framePackingSEIEnabled > 0 , "SEISegmentedRectFramePacking must be 0 when SEIFramePacking is 1");
     4563  }
     4564
     4565  if((m_numTileColumnsMinus1 <= 0) && (m_numTileRowsMinus1 <= 0) && m_tmctsSEIEnabled)
     4566  {
     4567    printf("SEITempMotionConstrainedTileSets is set to false to disable 'temporal_motion_constrained_tile_sets' SEI because there are no tiles enabled\n");
     4568    m_tmctsSEIEnabled = false;
     4569  }
     4570
     4571  if(m_timeCodeSEIEnabled)
     4572  {
     4573    xConfirmPara(m_timeCodeSEINumTs > MAX_TIMECODE_SEI_SETS, "Number of time sets cannot exceed 3");
    37384574  }
    37394575
     
    37424578  xConfirmPara( (m_acLayerCfg[0].m_numSamplePredRefLayers != 0) && (m_acLayerCfg[0].m_numSamplePredRefLayers != -1), "Layer 0 cannot have any reference layers" );
    37434579  // 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
    3744   for(Int layer = 1; layer < MAX_LAYERS; layer++)
    3745   {
    3746     xConfirmPara(m_acLayerCfg[layer].m_numSamplePredRefLayers > layer, "Cannot reference more layers than before current layer");
    3747     for(Int i = 0; i < m_acLayerCfg[layer].m_numSamplePredRefLayers; i++)
    3748     {
    3749       xConfirmPara(m_acLayerCfg[layer].m_samplePredRefLayerIds[i] > layer, "Cannot reference higher layers");
    3750       xConfirmPara(m_acLayerCfg[layer].m_samplePredRefLayerIds[i] == layer, "Cannot reference the current layer itself");
     4580  if( layerId > 0 )
     4581  {
     4582    xConfirmPara(m_acLayerCfg[layerId].m_numSamplePredRefLayers > layerId, "Cannot reference more layers than before current layer");
     4583    for(Int i = 0; i < m_acLayerCfg[layerId].m_numSamplePredRefLayers; i++)
     4584    {
     4585      xConfirmPara(m_acLayerCfg[layerId].m_samplePredRefLayerIds[i] > layerId, "Cannot reference higher layers");
     4586      xConfirmPara(m_acLayerCfg[layerId].m_samplePredRefLayerIds[i] == layerId, "Cannot reference the current layer itself");
    37514587    }
    37524588  }
    37534589  xConfirmPara( (m_acLayerCfg[0].m_numMotionPredRefLayers != 0) && (m_acLayerCfg[0].m_numMotionPredRefLayers != -1), "Layer 0 cannot have any reference layers" );
    37544590  // 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
    3755   for(Int layer = 1; layer < MAX_LAYERS; layer++)
    3756   {
    3757     xConfirmPara(m_acLayerCfg[layer].m_numMotionPredRefLayers > layer, "Cannot reference more layers than before current layer");
    3758     for(Int i = 0; i < m_acLayerCfg[layer].m_numMotionPredRefLayers; i++)
    3759     {
    3760       xConfirmPara(m_acLayerCfg[layer].m_motionPredRefLayerIds[i] > layer, "Cannot reference higher layers");
    3761       xConfirmPara(m_acLayerCfg[layer].m_motionPredRefLayerIds[i] == layer, "Cannot reference the current layer itself");
     4591  if( layerId > 0 )
     4592  {
     4593    xConfirmPara(m_acLayerCfg[layerId].m_numMotionPredRefLayers > layerId, "Cannot reference more layers than before current layer");
     4594    for(Int i = 0; i < m_acLayerCfg[layerId].m_numMotionPredRefLayers; i++)
     4595    {
     4596      xConfirmPara(m_acLayerCfg[layerId].m_motionPredRefLayerIds[i] > layerId, "Cannot reference higher layers");
     4597      xConfirmPara(m_acLayerCfg[layerId].m_motionPredRefLayerIds[i] == layerId, "Cannot reference the current layer itself");
    37624598    }
    37634599  }
     
    37654601  xConfirmPara( (m_acLayerCfg[0].m_numActiveRefLayers != 0) && (m_acLayerCfg[0].m_numActiveRefLayers != -1), "Layer 0 cannot have any active reference layers" );
    37664602  // 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
    3767   for(Int layer = 1; layer < MAX_LAYERS; layer++)
     4603  if( layerId > 0 )
    37684604  {
    37694605    Bool predEnabledFlag[MAX_LAYERS];
    3770     for (Int refLayer = 0; refLayer < layer; refLayer++)
     4606    for (Int refLayer = 0; refLayer < layerId; refLayer++)
    37714607    {
    37724608      predEnabledFlag[refLayer] = false;
    37734609    }
    3774     for(Int i = 0; i < m_acLayerCfg[layer].m_numSamplePredRefLayers; i++)
    3775     {
    3776       predEnabledFlag[m_acLayerCfg[layer].m_samplePredRefLayerIds[i]] = true;
    3777     }
    3778     for(Int i = 0; i < m_acLayerCfg[layer].m_numMotionPredRefLayers; i++)
    3779     {
    3780       predEnabledFlag[m_acLayerCfg[layer].m_motionPredRefLayerIds[i]] = true;
     4610    for(Int i = 0; i < m_acLayerCfg[layerId].m_numSamplePredRefLayers; i++)
     4611    {
     4612      predEnabledFlag[m_acLayerCfg[layerId].m_samplePredRefLayerIds[i]] = true;
     4613    }
     4614    for(Int i = 0; i < m_acLayerCfg[layerId].m_numMotionPredRefLayers; i++)
     4615    {
     4616      predEnabledFlag[m_acLayerCfg[layerId].m_motionPredRefLayerIds[i]] = true;
    37814617    }
    37824618    Int numDirectRefLayers = 0;
    3783     for (Int refLayer = 0; refLayer < layer; refLayer++)
     4619    for (Int refLayer = 0; refLayer < layerId; refLayer++)
    37844620    {
    37854621      if (predEnabledFlag[refLayer] == true) numDirectRefLayers++;
    37864622    }
    3787     xConfirmPara(m_acLayerCfg[layer].m_numActiveRefLayers > numDirectRefLayers, "Cannot reference more layers than NumDirectRefLayers");
    3788     for(Int i = 0; i < m_acLayerCfg[layer].m_numActiveRefLayers; i++)
    3789     {
    3790       xConfirmPara(m_acLayerCfg[layer].m_predLayerIds[i] >= numDirectRefLayers, "Cannot reference higher layers");
     4623    xConfirmPara(m_acLayerCfg[layerId].m_numActiveRefLayers > numDirectRefLayers, "Cannot reference more layers than NumDirectRefLayers");
     4624    for(Int i = 0; i < m_acLayerCfg[layerId].m_numActiveRefLayers; i++)
     4625    {
     4626      xConfirmPara(m_acLayerCfg[layerId].m_predLayerIds[i] >= numDirectRefLayers, "Cannot reference higher layers");
    37914627    }
    37924628  }
     
    38094645  }
    38104646#endif
    3811   for (UInt layer=0; layer < MAX_LAYERS-1; layer++)
    3812   {
    3813     xConfirmPara(m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1 < 0 || m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1 > 7, "MaxTidIlRefPicsPlus1 must be in range 0 to 7");
     4647  if( layerId < MAX_LAYERS-1 )
     4648  {
     4649    xConfirmPara(m_acLayerCfg[layerId].m_maxTidIlRefPicsPlus1 < 0 || m_acLayerCfg[layerId].m_maxTidIlRefPicsPlus1 > 7, "MaxTidIlRefPicsPlus1 must be in range 0 to 7");
    38144650  }
    38154651#if AUXILIARY_PICTURES
    3816   for (UInt layer=0; layer < MAX_LAYERS-1; layer++)
     4652  if( layerId < MAX_LAYERS-1 )
    38174653  {
    38184654#if R0062_AUX_PSEUDO_MONOCHROME
    3819     xConfirmPara(m_acLayerCfg[layer].m_auxId < 0 || m_acLayerCfg[layer].m_auxId > 2, "AuxId must be in range 0 to 2");
    3820 #else
    3821     xConfirmPara(m_acLayerCfg[layer].m_auxId < 0 || m_acLayerCfg[layer].m_auxId > 4, "AuxId must be in range 0 to 4");
    3822     xConfirmPara(m_acLayerCfg[layer].m_auxId > 0 && m_acLayerCfg[layer].m_chromaFormatIDC != CHROMA_400, "Auxiliary picture must be monochrome picture");
     4655    xConfirmPara(m_acLayerCfg[layerId].m_auxId < 0 || m_acLayerCfg[layerId].m_auxId > 2, "AuxId must be in range 0 to 2");
     4656#else
     4657    xConfirmPara(m_acLayerCfg[layerId].m_auxId < 0 || m_acLayerCfg[layerId].m_auxId > 4, "AuxId must be in range 0 to 4");
     4658    xConfirmPara(m_acLayerCfg[layerId].m_auxId > 0 && m_acLayerCfg[layerId].m_chromaFormatIDC != CHROMA_400, "Auxiliary picture must be monochrome picture");
    38234659#endif
    38244660  }
     
    38714707Void TAppEncCfg::xSetGlobal()
    38724708{
     4709#if SVC_EXTENSION
     4710  // Check for layerId equal to 0, it has to pe extended to other layers.
     4711  UInt layerId = 0;
     4712  Bool m_useExtendedPrecision = m_acLayerCfg[layerId].m_useExtendedPrecision;
     4713  Int m_internalBitDepth[]    = {m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_LUMA], m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_CHROMA]};
     4714  Int m_MSBExtendedBitDepth[] = {m_acLayerCfg[layerId].m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA], m_acLayerCfg[layerId].m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA]};
     4715  ChromaFormat m_chromaFormatIDC = m_acLayerCfg[layerId].m_chromaFormatIDC;
     4716#endif
     4717
    38734718  // set max CU width & height
    38744719  g_uiMaxCUWidth  = m_uiMaxCUWidth;
    38754720  g_uiMaxCUHeight = m_uiMaxCUHeight;
    3876  
     4721
    38774722  // compute actual CU depth with respect to config depth and max transform size
    38784723  g_uiAddCUDepth  = 0;
    38794724  while( (m_uiMaxCUWidth>>m_uiMaxCUDepth) > ( 1 << ( m_uiQuadtreeTULog2MinSize + g_uiAddCUDepth )  ) ) g_uiAddCUDepth++;
    3880  
     4725
     4726  g_uiAddCUDepth+=getMaxCUDepthOffset(m_chromaFormatIDC, m_uiQuadtreeTULog2MinSize); // if minimum TU larger than 4x4, allow for additional part indices for 4:2:2 SubTUs.
     4727
    38814728  m_uiMaxCUDepth += g_uiAddCUDepth;
    38824729  g_uiAddCUDepth++;
    38834730  g_uiMaxCUDepth = m_uiMaxCUDepth;
    3884  
    3885 #if O0194_DIFFERENT_BITDEPTH_EL_BL
    3886   // set internal bit-depth to constant value to make sure to be updated later
    3887   g_bitDepthY = -1;
    3888   g_bitDepthC = -1;
    3889  
    3890   g_uiPCMBitDepthLuma = -1;
    3891   g_uiPCMBitDepthChroma = -1;
    3892 #else
    3893   g_bitDepthY = m_internalBitDepthY;
    3894   g_bitDepthC = m_internalBitDepthC;
    3895  
    3896   g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_inputBitDepthY : m_internalBitDepthY;
    3897   g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_inputBitDepthC : m_internalBitDepthC;
    3898 #endif
     4731
     4732  // set internal bit-depth and constants
     4733  for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
     4734  {
     4735#if O0043_BEST_EFFORT_DECODING
     4736    g_bitDepthInStream[channelType] = g_bitDepth[channelType] = m_internalBitDepth[channelType];
     4737#else
     4738    g_bitDepth   [channelType] = m_internalBitDepth[channelType];
     4739#endif
     4740    g_PCMBitDepth[channelType] = m_bPCMInputBitDepthFlag ? m_MSBExtendedBitDepth[channelType] : m_internalBitDepth[channelType];
     4741
     4742    if (m_useExtendedPrecision) g_maxTrDynamicRange[channelType] = std::max<Int>(15, (g_bitDepth[channelType] + 6));
     4743    else                        g_maxTrDynamicRange[channelType] = 15;
     4744  }
     4745
    38994746}
    39004747#endif
     4748
     4749const Char *profileToString(const Profile::Name profile)
     4750{
     4751  static const UInt numberOfProfiles = sizeof(strToProfile)/sizeof(*strToProfile);
     4752
     4753  for (UInt profileIndex = 0; profileIndex < numberOfProfiles; profileIndex++)
     4754  {
     4755    if (strToProfile[profileIndex].value == profile) return strToProfile[profileIndex].str;
     4756  }
     4757
     4758  //if we get here, we didn't find this profile in the list - so there is an error
     4759  std::cerr << "ERROR: Unknown profile \"" << profile << "\" in profileToString" << std::endl;
     4760  assert(false);
     4761  exit(1);
     4762  return "";
     4763}
    39014764
    39024765Void TAppEncCfg::xPrintParameter()
     
    39044767  printf("\n");
    39054768#if SVC_EXTENSION 
    3906   printf("Total number of layers        : %d\n", m_numLayers       );
    3907   printf("Multiview                     : %d\n", m_scalabilityMask[VIEW_ORDER_INDEX] );
    3908   printf("Scalable                      : %d\n", m_scalabilityMask[SCALABILITY_ID] );
     4769  printf("Total number of layers            : %d\n", m_numLayers       );
     4770  printf("Multiview                         : %d\n", m_scalabilityMask[VIEW_ORDER_INDEX] );
     4771  printf("Scalable                          : %d\n", m_scalabilityMask[SCALABILITY_ID] );
    39094772#if AVC_BASE
    39104773#if VPS_AVC_BL_FLAG_REMOVAL
    3911   printf("Base layer                    : %s\n", m_nonHEVCBaseLayerFlag ? "Non-HEVC" : "HEVC");
    3912 #else
    3913   printf("Base layer                    : %s\n", m_avcBaseLayerFlag ? "AVC" : "HEVC");
     4774  printf("Base layer                        : %s\n", m_nonHEVCBaseLayerFlag ? "Non-HEVC" : "HEVC");
     4775#else
     4776  printf("Base layer                        : %s\n", m_avcBaseLayerFlag ? "AVC" : "HEVC");
    39144777#endif
    39154778#endif
    39164779#if AUXILIARY_PICTURES
    3917   printf("Auxiliary pictures            : %d\n", m_scalabilityMask[AUX_ID] );
     4780  printf("Auxiliary pictures                : %d\n", m_scalabilityMask[AUX_ID] );
    39184781#endif
    39194782#if M0040_ADAPTIVE_RESOLUTION_CHANGE
    3920   printf("Adaptive Resolution Change    : %d\n", m_adaptiveResolutionChange );
     4783  printf("Adaptive Resolution Change        : %d\n", m_adaptiveResolutionChange );
    39214784#endif
    39224785#if HIGHER_LAYER_IRAP_SKIP_FLAG
    3923   printf("Skip picture at ARC switch    : %d\n", m_skipPictureAtArcSwitch );
     4786  printf("Skip picture at ARC switch        : %d\n", m_skipPictureAtArcSwitch );
    39244787#endif
    39254788#if O0223_PICTURE_TYPES_ALIGN_FLAG
    3926   printf("Align picture type            : %d\n", m_crossLayerPictureTypeAlignFlag );
    3927 #endif
    3928   printf("Cross layer IRAP alignment    : %d\n", m_crossLayerIrapAlignFlag );
     4789  printf("Align picture type                : %d\n", m_crossLayerPictureTypeAlignFlag );
     4790#endif
     4791  printf("Cross layer IRAP alignment        : %d\n", m_crossLayerIrapAlignFlag );
    39294792#if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG
    3930   printf("IDR only for IRAP             : %d\n", m_crossLayerAlignedIdrOnlyFlag );
     4793  printf("IDR only for IRAP                 : %d\n", m_crossLayerAlignedIdrOnlyFlag );
    39314794#endif
    39324795#if O0194_WEIGHTED_PREDICTION_CGS
    3933   printf("InterLayerWeightedPred        : %d\n", m_useInterLayerWeightedPred );
    3934 #endif
     4796  printf("InterLayerWeightedPred            : %d\n", m_useInterLayerWeightedPred );
     4797#endif
     4798#if O0215_PHASE_ALIGNMENT 
     4799  printf("Cross-layer sample alignment      : %d\n", m_phaseAlignFlag);
     4800#endif
     4801  printf("\n");
    39354802  for(UInt layer=0; layer<m_numLayers; layer++)
    39364803  {
     
    39404807  }
    39414808  printf("=== Common configuration settings === \n");
    3942   printf("Bitstream      File          : %s\n", m_pBitstreamFile      );
     4809  printf("Bitstream      File               : %s\n", m_pBitstreamFile      );
    39434810#else //SVC_EXTENSION
    3944   printf("Input          File          : %s\n", m_pchInputFile          );
    3945   printf("Bitstream      File          : %s\n", m_pchBitstreamFile      );
    3946   printf("Reconstruction File          : %s\n", m_pchReconFile          );
    3947   printf("Real     Format              : %dx%d %dHz\n", m_iSourceWidth - m_confWinLeft - m_confWinRight, m_iSourceHeight - m_confWinTop - m_confWinBottom, m_iFrameRate );
    3948   printf("Internal Format              : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate );
     4811  printf("Input          File               : %s\n", m_pchInputFile          );
     4812  printf("Bitstream      File               : %s\n", m_pchBitstreamFile      );
     4813  printf("Reconstruction File               : %s\n", m_pchReconFile          );
     4814  printf("Real     Format                   : %dx%d %dHz\n", m_iSourceWidth - m_confWinLeft - m_confWinRight, m_iSourceHeight - m_confWinTop - m_confWinBottom, m_iFrameRate );
     4815  printf("Internal Format                   : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate );
    39494816#endif //SVC_EXTENSION
     4817
     4818  printf("Sequence PSNR output              : %s\n", (m_printMSEBasedSequencePSNR ? "Linear average, MSE-based" : "Linear average only") );
     4819  printf("Sequence MSE output               : %s\n", (m_printSequenceMSE ? "Enabled" : "Disabled") );
     4820  printf("Frame MSE output                  : %s\n", (m_printFrameMSE    ? "Enabled" : "Disabled") );
     4821  printf("Cabac-zero-word-padding           : %s\n", (m_cabacZeroWordPaddingEnabled? "Enabled" : "Disabled") );
    39504822  if (m_isField)
    39514823  {
    3952     printf("Frame/Field          : Field based coding\n");
    3953     printf("Field index          : %u - %d (%d fields)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
    3954     if (m_isTopFieldFirst)
    3955     {
    3956       printf("Field Order            : Top field first\n");
    3957     }
    3958     else
    3959     {
    3960       printf("Field Order            : Bottom field first\n");
    3961     }
     4824    printf("Frame/Field                       : Field based coding\n");
     4825    printf("Field index                       : %u - %d (%d fields)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
     4826    printf("Field Order                       : %s field first\n", m_isTopFieldFirst?"Top":"Bottom");
     4827
    39624828  }
    39634829  else
    39644830  {
    3965     printf("Frame/Field                  : Frame based coding\n");
    3966     printf("Frame index                  : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
    3967   }
     4831    printf("Frame/Field                       : Frame based coding\n");
     4832    printf("Frame index                       : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
     4833  }
     4834#if !MULTIPLE_PTL_SUPPORT
     4835  if (m_profile == Profile::MAINREXT)
     4836  {
     4837    const UInt intraIdx = m_intraConstraintFlag ? 1:0;
     4838    const UInt bitDepthIdx = (m_bitDepthConstraint == 8 ? 0 : (m_bitDepthConstraint ==10 ? 1 : (m_bitDepthConstraint == 12 ? 2 : (m_bitDepthConstraint == 16 ? 3 : 4 ))));
     4839    const UInt chromaFormatIdx = UInt(m_chromaFormatConstraint);
     4840    const ExtendedProfileName validProfileName = (bitDepthIdx > 3 || chromaFormatIdx>3) ? NONE : validRExtProfileNames[intraIdx][bitDepthIdx][chromaFormatIdx];
     4841    std::string rextSubProfile;
     4842    if (validProfileName!=NONE) rextSubProfile=enumToString(strToExtendedProfile, sizeof(strToExtendedProfile)/sizeof(*strToExtendedProfile), validProfileName);
     4843    if (rextSubProfile == "main_444_16") rextSubProfile="main_444_16 [NON STANDARD]";
     4844    printf("Profile                           : %s (%s)\n", profileToString(m_profile), (rextSubProfile.empty())?"INVALID REXT PROFILE":rextSubProfile.c_str() );
     4845  }
     4846  else
     4847  {
     4848    printf("Profile                           : %s\n", profileToString(m_profile) );
     4849  }
     4850#endif
    39684851#if !LAYER_CTB
    3969   printf("CU size / depth              : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth );
    3970   printf("RQT trans. size (min / max)  : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize );
    3971   printf("Max RQT depth inter          : %d\n", m_uiQuadtreeTUMaxDepthInter);
    3972   printf("Max RQT depth intra          : %d\n", m_uiQuadtreeTUMaxDepthIntra);
    3973 #endif
    3974   printf("Min PCM size                 : %d\n", 1 << m_uiPCMLog2MinSize);
    3975   printf("Motion search range          : %d\n", m_iSearchRange );
     4852  printf("CU size / depth                   : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth );
     4853  printf("RQT trans. size (min / max)       : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize );
     4854  printf("Max RQT depth inter               : %d\n", m_uiQuadtreeTUMaxDepthInter);
     4855  printf("Max RQT depth intra               : %d\n", m_uiQuadtreeTUMaxDepthIntra);
     4856#endif
     4857  printf("Min PCM size                      : %d\n", 1 << m_uiPCMLog2MinSize);
     4858  printf("Motion search range               : %d\n", m_iSearchRange );
    39764859#if !SVC_EXTENSION
    3977   printf("Intra period                 : %d\n", m_iIntraPeriod );
    3978 #endif
    3979   printf("Decoding refresh type        : %d\n", m_iDecodingRefreshType );
     4860  printf("Intra period                      : %d\n", m_iIntraPeriod );
     4861#endif
     4862  printf("Decoding refresh type             : %d\n", m_iDecodingRefreshType );
    39804863#if !SVC_EXTENSION
    3981   printf("QP                           : %5.2f\n", m_fQP );
    3982 #endif
    3983   printf("Max dQP signaling depth      : %d\n", m_iMaxCuDQPDepth);
    3984 
    3985   printf("Cb QP Offset                 : %d\n", m_cbQpOffset   );
    3986   printf("Cr QP Offset                 : %d\n", m_crQpOffset);
    3987 
    3988   printf("QP adaptation                : %d (range=%d)\n", m_bUseAdaptiveQP, (m_bUseAdaptiveQP ? m_iQPAdaptationRange : 0) );
    3989   printf("GOP size                     : %d\n", m_iGOPSize );
     4864  printf("QP                                : %5.2f\n", m_fQP );
     4865#endif
     4866  printf("Max dQP signaling depth           : %d\n", m_iMaxCuDQPDepth);
     4867
     4868  printf("Cb QP Offset                      : %d\n", m_cbQpOffset   );
     4869  printf("Cr QP Offset                      : %d\n", m_crQpOffset);
     4870  printf("Max CU chroma QP adjustment depth : %d\n", m_maxCUChromaQpAdjustmentDepth);
     4871  printf("QP adaptation                     : %d (range=%d)\n", m_bUseAdaptiveQP, (m_bUseAdaptiveQP ? m_iQPAdaptationRange : 0) );
     4872  printf("GOP size                          : %d\n", m_iGOPSize );
    39904873#if !O0194_DIFFERENT_BITDEPTH_EL_BL
    3991   printf("Internal bit depth           : (Y:%d, C:%d)\n", m_internalBitDepthY, m_internalBitDepthC );
    3992   printf("PCM sample bit depth         : (Y:%d, C:%d)\n", g_uiPCMBitDepthLuma, g_uiPCMBitDepthChroma );
    3993 #endif
    3994 #if O0215_PHASE_ALIGNMENT
    3995   printf("Cross-layer sample alignment : %d\n", m_phaseAlignFlag);
    3996 #endif
     4874  printf("Input bit depth                   : (Y:%d, C:%d)\n", m_inputBitDepth[CHANNEL_TYPE_LUMA], m_inputBitDepth[CHANNEL_TYPE_CHROMA] );
     4875  printf("MSB-extended bit depth            : (Y:%d, C:%d)\n", m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA], m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] );
     4876  printf("Internal bit depth                : (Y:%d, C:%d)\n", m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA] );
     4877  printf("PCM sample bit depth              : (Y:%d, C:%d)\n", g_PCMBitDepth[CHANNEL_TYPE_LUMA],      g_PCMBitDepth[CHANNEL_TYPE_CHROMA] );
     4878  printf("Extended precision processing     : %s\n", (m_useExtendedPrecision                   ? "Enabled" : "Disabled") );
     4879#endif
     4880  printf("Intra reference smoothing         : %s\n", (m_enableIntraReferenceSmoothing          ? "Enabled" : "Disabled") );
     4881  printf("Implicit residual DPCM            : %s\n", (m_useResidualDPCM[RDPCM_SIGNAL_IMPLICIT] ? "Enabled" : "Disabled") );
     4882  printf("Explicit residual DPCM            : %s\n", (m_useResidualDPCM[RDPCM_SIGNAL_EXPLICIT] ? "Enabled" : "Disabled") );
     4883  printf("Residual rotation                 : %s\n", (m_useResidualRotation                    ? "Enabled" : "Disabled") );
     4884  printf("Single significance map context   : %s\n", (m_useSingleSignificanceMapContext        ? "Enabled" : "Disabled") );
     4885  printf("Cross-component prediction        : %s\n", (m_useCrossComponentPrediction            ? (m_reconBasedCrossCPredictionEstimate ? "Enabled (reconstructed-residual-based estimate)" : "Enabled (encoder-side-residual-based estimate)") : "Disabled") );
     4886#if !O0194_DIFFERENT_BITDEPTH_EL_BL
     4887  printf("High-precision prediction weight  : %s\n", (m_useHighPrecisionPredictionWeighting    ? "Enabled" : "Disabled") );
     4888#endif
     4889  printf("Golomb-Rice parameter adaptation  : %s\n", (m_useGolombRiceParameterAdaptation       ? "Enabled" : "Disabled") );
     4890  printf("CABAC bypass bit alignment        : %s\n", (m_alignCABACBeforeBypass                 ? "Enabled" : "Disabled") );
     4891  if (m_bUseSAO)
     4892  {
     4893    printf("Sao Luma Offset bit shifts        : %d\n", m_saoOffsetBitShift[CHANNEL_TYPE_LUMA]);
     4894    printf("Sao Chroma Offset bit shifts      : %d\n", m_saoOffsetBitShift[CHANNEL_TYPE_CHROMA]);
     4895  }
     4896
     4897  switch (m_costMode)
     4898  {
     4899    case COST_STANDARD_LOSSY:               printf("Cost function:                    : Lossy coding (default)\n"); break;
     4900    case COST_SEQUENCE_LEVEL_LOSSLESS:      printf("Cost function:                    : Sequence_level_lossless coding\n"); break;
     4901    case COST_LOSSLESS_CODING:              printf("Cost function:                    : Lossless coding with fixed QP of %d\n", LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP); break;
     4902    case COST_MIXED_LOSSLESS_LOSSY_CODING:  printf("Cost function:                    : Mixed_lossless_lossy coding with QP'=%d for lossless evaluation\n", LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME); break;
     4903    default:                                printf("Cost function:                    : Unknown\n"); break;
     4904  }
     4905
    39974906#if !RC_SHVC_HARMONIZATION
    3998   printf("RateControl                  : %d\n", m_RCEnableRateControl );
     4907  printf("RateControl                       : %d\n", m_RCEnableRateControl );
     4908
    39994909  if(m_RCEnableRateControl)
    40004910  {
    4001     printf("TargetBitrate                : %d\n", m_RCTargetBitrate );
    4002     printf("KeepHierarchicalBit          : %d\n", m_RCKeepHierarchicalBit );
    4003     printf("LCULevelRC                   : %d\n", m_RCLCULevelRC );
    4004     printf("UseLCUSeparateModel          : %d\n", m_RCUseLCUSeparateModel );
    4005     printf("InitialQP                    : %d\n", m_RCInitialQP );
    4006     printf("ForceIntraQP                 : %d\n", m_RCForceIntraQP );
    4007   }
    4008 #endif
    4009 
    4010   printf("Max Num Merge Candidates     : %d\n", m_maxNumMergeCand);
     4911    printf("TargetBitrate                     : %d\n", m_RCTargetBitrate );
     4912    printf("KeepHierarchicalBit               : %d\n", m_RCKeepHierarchicalBit );
     4913    printf("LCULevelRC                        : %d\n", m_RCLCULevelRC );
     4914    printf("UseLCUSeparateModel               : %d\n", m_RCUseLCUSeparateModel );
     4915    printf("InitialQP                         : %d\n", m_RCInitialQP );
     4916    printf("ForceIntraQP                      : %d\n", m_RCForceIntraQP );
     4917  }
     4918#endif
     4919
     4920  printf("Max Num Merge Candidates          : %d\n", m_maxNumMergeCand);
    40114921  printf("\n");
    4012  
     4922
    40134923  printf("TOOL CFG: ");
    40144924#if !O0194_DIFFERENT_BITDEPTH_EL_BL
    4015   printf("IBD:%d ", g_bitDepthY > m_inputBitDepthY || g_bitDepthC > m_inputBitDepthC);
     4925  printf("IBD:%d ", ((g_bitDepth[CHANNEL_TYPE_LUMA] > m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA]) || (g_bitDepth[CHANNEL_TYPE_CHROMA] > m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA])));
    40164926#endif
    40174927  printf("HAD:%d ", m_bUseHADME           );
     
    40324942  printf("TransformSkip:%d ",     m_useTransformSkip              );
    40334943  printf("TransformSkipFast:%d ", m_useTransformSkipFast       );
     4944  printf("TransformSkipLog2MaxSize:%d ", m_transformSkipLog2MaxSize);
    40344945  printf("Slice: M=%d ", m_sliceMode);
    4035   if (m_sliceMode!=0)
     4946  if (m_sliceMode!=NO_SLICES)
    40364947  {
    40374948    printf("A=%d ", m_sliceArgument);
    40384949  }
    40394950  printf("SliceSegment: M=%d ",m_sliceSegmentMode);
    4040   if (m_sliceSegmentMode!=0)
     4951  if (m_sliceSegmentMode!=NO_SLICES)
    40414952  {
    40424953    printf("A=%d ", m_sliceSegmentArgument);
     
    40474958  printf("PCM:%d ", (m_usePCM && (1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0);
    40484959#endif
     4960
    40494961  if (m_TransquantBypassEnableFlag && m_CUTransquantBypassFlagForce)
    40504962  {
    4051     printf("TransQuantBypassEnabled: =1 ");
     4963    printf("TransQuantBypassEnabled: =1");
    40524964  }
    40534965  else
     
    40554967    printf("TransQuantBypassEnabled:%d ", (m_TransquantBypassEnableFlag)? 1:0 );
    40564968  }
     4969
    40574970  printf("WPP:%d ", (Int)m_useWeightedPred);
    40584971  printf("WPB:%d ", (Int)m_useWeightedBiPred);
     
    40915004
    40925005  printf("\n\n");
    4093  
     5006
    40945007  fflush(stdout);
    40955008}
     
    40995012  if (!bflag)
    41005013    return false;
    4101  
     5014
    41025015  printf("Error: %s\n",message);
    41035016  return true;
     
    41945107}
    41955108#endif
    4196 #endif //SVC_EXTENSION
    4197 
    4198 #if SVC_EXTENSION
     5109
    41995110#if R0235_SMALLEST_LAYER_ID
    42005111#if OUTPUT_LAYER_SETS_CONFIG
     
    42695180#endif // R0235
    42705181#endif //SVC_EXTENSION
    4271 
    4272 
    42735182//! \}
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.h

    r1005 r1029  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license. 
     4 * granted under this license.
    55 *
    66 * Copyright (c) 2010-2014, ITU/ISO/IEC
     
    9191  std::vector< std::vector<Int> > m_listOfOutputLayers;
    9292#endif
     93  Bool      m_isField;                                        ///< enable field coding
     94  Bool      m_isTopFieldFirst;
    9395#else
    9496  Char*     m_pchInputFile;                                   ///< source file name
     
    98100  // source specification
    99101  Int       m_iFrameRate;                                     ///< source frame-rates (Hz)
    100   UInt      m_FrameSkip;                                      ///< number of skipped frames from the beginning
     102  UInt      m_FrameSkip;                                   ///< number of skipped frames from the beginning
    101103  Int       m_iSourceWidth;                                   ///< source width in pixel
    102104  Int       m_iSourceHeight;                                  ///< source height in pixel (when interlaced = field height)
    103  
     105
    104106  Int       m_iSourceHeightOrg;                               ///< original source height in pixel (when interlaced = frame height)
    105  
    106  
     107
     108  Bool      m_isField;                                        ///< enable field coding
     109  Bool      m_isTopFieldFirst;
     110
    107111  Int       m_conformanceWindowMode;
    108112  Int       m_confWinLeft;
     
    113117  Int       m_aiPad[2];                                       ///< number of padded pixels for width and height
    114118#endif 
    115 #if AUXILIARY_PICTURES
     119  InputColourSpaceConversion m_inputColourSpaceConvert;       ///< colour space conversion to apply to input video
     120  Bool      m_snrInternalColourSpace;                       ///< if true, then no colour space conversion is applied for snr calculation, otherwise inverse of input is applied.
     121  Bool      m_outputInternalColourSpace;                    ///< if true, then no colour space conversion is applied for reconstructed video, otherwise inverse of input is applied.
     122#if !SVC_EXTENSION
    116123  ChromaFormat m_InputChromaFormatIDC;
    117124#endif
    118   Bool      m_isField;                                        ///< enable field coding
    119   Bool      m_isTopFieldFirst;
    120 
    121   // profile/level
    122 #if SVC_EXTENSION && MULTIPLE_PTL_SUPPORT
     125
     126  Bool      m_printMSEBasedSequencePSNR;
     127  Bool      m_printFrameMSE;
     128  Bool      m_printSequenceMSE;
     129  Bool      m_cabacZeroWordPaddingEnabled;
     130
     131#if MULTIPLE_PTL_SUPPORT
    123132  Int           m_numPTLInfo;
    124   Int           m_layerPTLIdx[MAX_VPS_LAYER_ID_PLUS1]; ///< scalability_mask
    125133  Profile::Name m_profileList[MAX_NUM_LAYER_IDS + 1];
    126134  Level::Tier   m_levelTierList[MAX_NUM_LAYER_IDS + 1];
     
    134142  std::vector< std::vector<Int> > m_listOfLayerPTLofOlss;
    135143#else
     144  // profile/level
    136145  Profile::Name m_profile;
    137146  Level::Tier   m_levelTier;
    138147  Level::Name   m_level;
     148  UInt          m_bitDepthConstraint;
     149  ChromaFormat  m_chromaFormatConstraint;
     150  Bool          m_intraConstraintFlag;
     151  Bool          m_lowerBitRateConstraintFlag;
    139152  Bool m_progressiveSourceFlag;
    140153  Bool m_interlacedSourceFlag;
     
    164177  Int       m_numReorderPics[MAX_TLAYER];                     ///< total number of reorder pictures
    165178  Int       m_maxDecPicBuffering[MAX_TLAYER];                 ///< total number of pictures in the decoded picture buffer
     179  Bool      m_useCrossComponentPrediction;                    ///< flag enabling the use of cross-component prediction
     180  Bool      m_reconBasedCrossCPredictionEstimate;             ///< causes the alpha calculation in encoder search to be based on the decoded residual rather than the pre-transform encoder-side residual
     181  UInt      m_saoOffsetBitShift[MAX_NUM_CHANNEL_TYPE];        ///< number of bits for the upward bit shift operation on the decoded SAO offsets
    166182  Bool      m_useTransformSkip;                               ///< flag for enabling intra transform skipping
    167183  Bool      m_useTransformSkipFast;                           ///< flag for enabling fast intra transform skipping
     184  UInt      m_transformSkipLog2MaxSize;                       ///< transform-skip maximum size (minimum of 2)
     185  Bool      m_useResidualRotation;                            ///< control flag for transform-skip/transquant-bypass residual rotation
     186  Bool      m_useSingleSignificanceMapContext;                ///< control flag for transform-skip/transquant-bypass single significance map context
     187  Bool      m_useResidualDPCM[NUMBER_OF_RDPCM_SIGNALLING_MODES];///< control flags for residual DPCM
    168188  Bool      m_enableAMP;
     189  Bool      m_useGolombRiceParameterAdaptation;               ///< control flag for Golomb-Rice parameter adaptation over each slice
     190  Bool      m_alignCABACBeforeBypass;
     191
    169192  // coding quality
    170193#if !SVC_EXTENSION
     
    177200  UInt      m_uiDeltaQpRD;                                    ///< dQP range for multi-pass slice QP optimization
    178201  Int       m_iMaxCuDQPDepth;                                 ///< Max. depth for a minimum CuDQPSize (0:default)
    179 
    180   Int       m_cbQpOffset;                                     ///< Chroma Cb QP Offset (0:default)
     202  Int       m_maxCUChromaQpAdjustmentDepth;
     203
     204  Int       m_cbQpOffset;                                     ///< Chroma Cb QP Offset (0:default)
    181205  Int       m_crQpOffset;                                     ///< Chroma Cr QP Offset (0:default)
    182206
     
    184208  Bool      m_bUseAdaptQpSelect;
    185209#endif
     210  TComSEIMasteringDisplay m_masteringDisplay;
    186211
    187212  Bool      m_bUseAdaptiveQP;                                 ///< Flag for enabling QP adaptation based on a psycho-visual model
    188213  Int       m_iQPAdaptationRange;                             ///< dQP range by QP adaptation
    189  
     214
    190215  Int       m_maxTempLayer;                                  ///< Max temporal layer
    191216#if Q0108_TSA_STSA
     
    195220#if !LAYER_CTB
    196221  // coding unit (CU) definition
     222  // TODO: Remove MaxCUWidth/MaxCUHeight and replace with MaxCUSize.
    197223  UInt      m_uiMaxCUWidth;                                   ///< max. CU width in pixel
    198224  UInt      m_uiMaxCUHeight;                                  ///< max. CU height in pixel
    199225  UInt      m_uiMaxCUDepth;                                   ///< max. CU depth
    200  
     226
    201227  // transfom unit (TU) definition
    202228  UInt      m_uiQuadtreeTULog2MaxSize;
    203229  UInt      m_uiQuadtreeTULog2MinSize;
    204  
     230
    205231  UInt      m_uiQuadtreeTUMaxDepthInter;
    206232  UInt      m_uiQuadtreeTUMaxDepthIntra;
     
    209235  // coding tools (bit-depth)
    210236#if !O0194_DIFFERENT_BITDEPTH_EL_BL
    211   Int       m_inputBitDepthY;                               ///< bit-depth of input file (luma component)
    212   Int       m_inputBitDepthC;                               ///< bit-depth of input file (chroma component)
    213   Int       m_outputBitDepthY;                              ///< bit-depth of output file (luma component)
    214   Int       m_outputBitDepthC;                              ///< bit-depth of output file (chroma component)
    215   Int       m_internalBitDepthY;                            ///< bit-depth codec operates at in luma (input/output files will be converted)
    216   Int       m_internalBitDepthC;                            ///< bit-depth codec operates at in chroma (input/output files will be converted)
    217 #endif
    218 #if AUXILIARY_PICTURES
     237  Int       m_inputBitDepth   [MAX_NUM_CHANNEL_TYPE];         ///< bit-depth of input file
     238  Int       m_outputBitDepth  [MAX_NUM_CHANNEL_TYPE];         ///< bit-depth of output file
     239  Int       m_MSBExtendedBitDepth[MAX_NUM_CHANNEL_TYPE];      ///< bit-depth of input samples after MSB extension
     240  Int       m_internalBitDepth[MAX_NUM_CHANNEL_TYPE];         ///< bit-depth codec operates at (input/output files will be converted)
     241  Bool      m_useExtendedPrecision;
     242  Bool      m_useHighPrecisionPredictionWeighting;
     243#endif
     244  //coding tools (chroma format)
     245#if !SVC_EXTENSION
    219246  ChromaFormat m_chromaFormatIDC;
    220247#endif
     
    224251
    225252  // coding tool (SAO)
    226   Bool      m_bUseSAO; 
     253  Bool      m_bUseSAO;
    227254  Int       m_maxNumOffsetsPerPic;                            ///< SAO maximun number of offset per picture
    228   Bool      m_saoLcuBoundary;                                 ///< SAO parameter estimation using non-deblocked pixels for LCU bottom and right boundary areas
     255  Bool      m_saoCtuBoundary;                                 ///< SAO parameter estimation using non-deblocked pixels for CTU bottom and right boundary areas
    229256  // coding tools (loop filter)
    230257  Bool      m_bLoopFilterDisable;                             ///< flag for using deblocking filter
     
    234261  Bool      m_DeblockingFilterControlPresent;                 ///< deblocking filter control present flag in PPS
    235262  Bool      m_DeblockingFilterMetric;                         ///< blockiness metric in encoder
    236  
     263
    237264  // coding tools (PCM)
    238265  Bool      m_usePCM;                                         ///< flag for using IPCM
     
    240267  UInt      m_uiPCMLog2MinSize;                               ///< log2 of minimum PCM block size
    241268  Bool      m_bPCMFilterDisableFlag;                          ///< PCM filter disable flag
     269  Bool      m_enableIntraReferenceSmoothing;                  ///< flag for enabling(default)/disabling intra reference smoothing/filtering
    242270
    243271  // coding tools (encoder-only parameters)
     
    246274  Bool      m_useRDOQ;                                       ///< flag for using RD optimized quantization
    247275  Bool      m_useRDOQTS;                                     ///< flag for using RD optimized quantization for transform skip
    248   Int       m_rdPenalty;                                      ///< RD-penalty for 32x32 TU for intra in non-intra slices (0: no RD-penalty, 1: RD-penalty, 2: maximum RD-penalty) 
     276  Int       m_rdPenalty;                                      ///< RD-penalty for 32x32 TU for intra in non-intra slices (0: no RD-penalty, 1: RD-penalty, 2: maximum RD-penalty)
    249277  Int       m_iFastSearch;                                    ///< ME mode, 0 = full, 1 = diamond, 2 = PMVFAST
    250278  Int       m_iSearchRange;                                   ///< ME search range
     
    252280  Bool      m_bUseFastEnc;                                    ///< flag for using fast encoder setting
    253281  Bool      m_bUseEarlyCU;                                    ///< flag for using Early CU setting
    254   Bool      m_useFastDecisionForMerge;                        ///< flag for using Fast Decision Merge RD-Cost 
     282  Bool      m_useFastDecisionForMerge;                        ///< flag for using Fast Decision Merge RD-Cost
    255283  Bool      m_bUseCbfFastMode;                              ///< flag for using Cbf Fast PU Mode Decision
    256284  Bool      m_useEarlySkipDetection;                         ///< flag for using Early SKIP Detection
    257 #if FAST_INTRA_SHVC
    258   Bool      m_useFastIntraScalable;                          ///< flag for using Fast Intra Decision for Scalable HEVC
    259 #endif
    260   Int       m_sliceMode;                                     ///< 0: no slice limits, 1 : max number of CTBs per slice, 2: max number of bytes per slice,
     285  Int       m_sliceMode;                                     ///< 0: no slice limits, 1 : max number of CTBs per slice, 2: max number of bytes per slice,
    261286                                                             ///< 3: max number of tiles per slice
    262287  Int       m_sliceArgument;                                 ///< argument according to selected slice mode
    263   Int       m_sliceSegmentMode;                              ///< 0: no slice segment limits, 1 : max number of CTBs per slice segment, 2: max number of bytes per slice segment, 
     288  Int       m_sliceSegmentMode;                              ///< 0: no slice segment limits, 1 : max number of CTBs per slice segment, 2: max number of bytes per slice segment,
    264289                                                             ///< 3: max number of tiles per slice segment
    265290  Int       m_sliceSegmentArgument;                          ///< argument according to selected slice segment mode
     
    274299#if !SVC_EXTENSION
    275300  Int       m_iWaveFrontSynchro; //< 0: no WPP. >= 1: WPP is enabled, the "Top right" from which inheritance occurs is this LCU offset in the line above the current.
     301  Int       m_iWaveFrontFlush; //< enable(1)/disable(0) the CABAC flush at the end of each line of LCUs.
    276302  Int       m_iWaveFrontSubstreams; //< If iWaveFrontSynchro, this is the number of substreams per frame (dependent tiles) or per tile (independent tiles).
    277303#endif
    278304  Bool      m_bUseConstrainedIntraPred;                       ///< flag for using constrained intra prediction
     305
    279306  Int       m_decodedPictureHashSEIEnabled;                    ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message
    280307  Int       m_recoveryPointSEIEnabled;
     
    282309  Int       m_pictureTimingSEIEnabled;
    283310  Bool      m_toneMappingInfoSEIEnabled;
     311  Bool      m_chromaSamplingFilterSEIenabled;
     312  Int       m_chromaSamplingHorFilterIdc;
     313  Int       m_chromaSamplingVerFilterIdc;
    284314  Int       m_toneMapId;
    285315  Bool      m_toneMapCancelFlag;
     
    287317  Int       m_toneMapCodedDataBitDepth;
    288318  Int       m_toneMapTargetBitDepth;
    289   Int       m_toneMapModelId; 
     319  Int       m_toneMapModelId;
    290320  Int       m_toneMapMinValue;
    291321  Int       m_toneMapMaxValue;
     
    313343  Int       m_framePackingSEIQuincunx;
    314344  Int       m_framePackingSEIInterpretation;
     345  Int       m_segmentedRectFramePackingSEIEnabled;
     346  Bool      m_segmentedRectFramePackingSEICancel;
     347  Int       m_segmentedRectFramePackingSEIType;
     348  Bool      m_segmentedRectFramePackingSEIPersistence;
    315349  Int       m_displayOrientationSEIAngle;
    316350  Int       m_temporalLevel0IndexSEIEnabled;
    317351  Int       m_gradualDecodingRefreshInfoEnabled;
     352  Int       m_noDisplaySEITLayer;
    318353  Int       m_decodingUnitInfoSEIEnabled;
    319 #if LAYERS_NOT_PRESENT_SEI
    320   Int       m_layersNotPresentSEIEnabled;
    321 #endif
    322354  Int       m_SOPDescriptionSEIEnabled;
    323355  Int       m_scalableNestingSEIEnabled;
    324 #if Q0189_TMVP_CONSTRAINTS
    325   Int       m_TMVPConstraintsSEIEnabled;
    326 #endif
     356  Bool      m_tmctsSEIEnabled;
     357  Bool      m_timeCodeSEIEnabled;
     358  Int       m_timeCodeSEINumTs;
     359  TComSEITimeSet m_timeSetArray[MAX_TIMECODE_SEI_SETS];
     360  Bool      m_kneeSEIEnabled;
     361  Int       m_kneeSEIId;
     362  Bool      m_kneeSEICancelFlag;
     363  Bool      m_kneeSEIPersistenceFlag;
     364  Int       m_kneeSEIInputDrange;
     365  Int       m_kneeSEIInputDispLuminance;
     366  Int       m_kneeSEIOutputDrange;
     367  Int       m_kneeSEIOutputDispLuminance;
     368  Int       m_kneeSEINumKneePointsMinus1;
     369  Int*      m_kneeSEIInputKneePoint;
     370  Int*      m_kneeSEIOutputKneePoint;
    327371  // weighted prediction
    328372  Bool      m_useWeightedPred;                    ///< Use of weighted prediction in P slices
    329373  Bool      m_useWeightedBiPred;                  ///< Use of bi-directional weighted prediction in B slices
    330  
     374
    331375  UInt      m_log2ParallelMergeLevel;                         ///< Parallel merge estimation region
    332376  UInt      m_maxNumMergeCand;                                ///< Max number of merge candidates
     
    338382  Int       m_RCTargetBitrate;                    ///< target bitrate when rate control is enabled
    339383  Int       m_RCKeepHierarchicalBit;              ///< 0: equal bit allocation; 1: fixed ratio bit allocation; 2: adaptive ratio bit allocation
    340   Bool      m_RCLCULevelRC;                       ///< true: LCU level rate control; false: picture level rate control
    341   Bool      m_RCUseLCUSeparateModel;              ///< use separate R-lambda model at LCU level
     384  Bool      m_RCLCULevelRC;                       ///< true: LCU level rate control; false: picture level rate control NOTE: code-tidy - rename to m_RCCtuLevelRC
     385  Bool      m_RCUseLCUSeparateModel;              ///< use separate R-lambda model at LCU level                        NOTE: code-tidy - rename to m_RCUseCtuSeparateModel
    342386  Int       m_RCInitialQP;                        ///< inital QP for rate control
    343387  Bool      m_RCForceIntraQP;                     ///< force all intra picture to use initial QP or not
    344388#endif
    345   Int       m_useScalingListId;                               ///< using quantization matrix
     389  ScalingListMode m_useScalingListId;                         ///< using quantization matrix
    346390  Char*     m_scalingListFile;                                ///< quantization matrix file name
    347391
    348392  Bool      m_TransquantBypassEnableFlag;                     ///< transquant_bypass_enable_flag setting in PPS.
    349393  Bool      m_CUTransquantBypassFlagForce;                    ///< if transquant_bypass_enable_flag, then, if true, all CU transquant bypass flags will be set to true.
     394  CostMode  m_costMode;                                       ///< Cost mode to use
    350395
    351396  Bool      m_recalculateQPAccordingToLambda;                 ///< recalculate QP value according to the lambda value
     
    387432  Int       m_log2MaxMvLengthHorizontal;                      ///< Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units
    388433  Int       m_log2MaxMvLengthVertical;                        ///< Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units
     434
     435#if LAYERS_NOT_PRESENT_SEI
     436  Int       m_layersNotPresentSEIEnabled;
     437#endif
     438
     439#if SVC_EXTENSION
     440#if FAST_INTRA_SHVC
     441  Bool      m_useFastIntraScalable;                          ///< flag for using Fast Intra Decision for Scalable HEVC
     442#endif
     443#if Q0189_TMVP_CONSTRAINTS
     444  Int       m_TMVPConstraintsSEIEnabled;
     445#endif
    389446#if O0153_ALT_OUTPUT_LAYER_FLAG
    390447  Bool      m_altOutputLayerFlag;                             ///< Specifies the value of alt_output_laye_flag in VPS extension
    391448#endif
    392 
    393 #if SVC_EXTENSION
    394449  Int       m_elRapSliceBEnabled;
    395450#endif
    396451#if Q0074_COLOUR_REMAPPING_SEI
    397452#if !SVC_EXTENSION
    398   string    m_colourRemapSEIFile;
     453  Char*     m_colourRemapSEIFile;
    399454  Int       m_colourRemapSEIId;
    400455  Bool      m_colourRemapSEICancelFlag;
     
    424479  Void  xSetGlobal      ();                                   ///< set global variables
    425480#endif
     481#if SVC_EXTENSION
     482  Void  xCheckParameter (UInt layerId);                       ///< check validity of configuration values per layer
     483#else
    426484  Void  xCheckParameter ();                                   ///< check validity of configuration values
     485#endif
    427486  Void  xPrintParameter ();                                   ///< print configuration values
    428487  Void  xPrintUsage     ();                                   ///< print usage
     
    452511#endif
    453512  Bool      m_crossLayerIrapAlignFlag;
    454 #if P0050_KNEE_FUNCTION_SEI
    455   Bool      m_kneeSEIEnabled;
    456   Int       m_kneeSEIId;
    457   Bool      m_kneeSEICancelFlag;
    458   Bool      m_kneeSEIPersistenceFlag;
    459   Bool      m_kneeSEIMappingFlag;
    460   Int       m_kneeSEIInputDrange;
    461   Int       m_kneeSEIInputDispLuminance;
    462   Int       m_kneeSEIOutputDrange;
    463   Int       m_kneeSEIOutputDispLuminance;
    464   Int       m_kneeSEINumKneePointsMinus1;
    465   Int*      m_kneeSEIInputKneePoint;
    466   Int*      m_kneeSEIOutputKneePoint;
    467 #endif
    468513#if Q0096_OVERLAY_SEI
    469514  Bool                                m_overlaySEIEnabled;
     
    514559  TAppEncCfg();
    515560  virtual ~TAppEncCfg();
    516  
     561
    517562public:
    518563  Void  create    ();                                         ///< create option handling class
     
    525570  Int  getGOPSize()                {return m_iGOPSize;          }
    526571#if O0194_DIFFERENT_BITDEPTH_EL_BL
    527   UInt getInternalBitDepthY(Int iLayer)      {return m_acLayerCfg[iLayer].m_internalBitDepthY; }
    528   UInt getInternalBitDepthC(Int iLayer)      {return m_acLayerCfg[iLayer].m_internalBitDepthC; }
     572  UInt getInternalBitDepth(Int iLayer, ChannelType type)      {return m_acLayerCfg[iLayer].m_internalBitDepth[type]; }
    529573  Bool getPCMInputBitDepthFlag()             {return m_bPCMInputBitDepthFlag;                  }
    530574#else
    531   UInt getInternalBitDepthY()      {return m_internalBitDepthY; }
    532   UInt getInternalBitDepthC()      {return m_internalBitDepthC; }
     575  UInt getInternalBitDepth( ChannelType type )      {return m_internalBitDepth[type]; } 
    533576#endif
    534577#if !LAYER_CTB
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncLayerCfg.cpp

    r925 r1029  
    192192  m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str());
    193193#if AUXILIARY_PICTURES
    194   m_InputChromaFormat = numberToChromaFormat(tmpInputChromaFormat);
    195   m_chromaFormatIDC   = ((tmpChromaFormat == 0) ? (m_InputChromaFormat) : (numberToChromaFormat(tmpChromaFormat)));
     194  m_InputChromaFormatIDC = numberToChromaFormat(tmpInputChromaFormat);
     195  m_chromaFormatIDC   = ((tmpChromaFormat == 0) ? (m_InputChromaFormatIDC) : (numberToChromaFormat(tmpChromaFormat)));
    196196#endif
    197197#if Q0074_COLOUR_REMAPPING_SEI
     
    300300Void TAppEncLayerCfg::xPrintParameter()
    301301{
    302   printf("Input File                    : %s\n", m_cInputFile.c_str()  );
    303   printf("Reconstruction File           : %s\n", m_cReconFile.c_str()  );
     302  printf("Input File                        : %s\n", m_cInputFile.c_str()  );
     303  printf("Reconstruction File               : %s\n", m_cReconFile.c_str()  );
    304304#if REPN_FORMAT_IN_VPS
    305   printf("Real     Format               : %dx%d %dHz\n", m_iSourceWidth - ( m_confWinLeft + m_confWinRight ) * TComSPS::getWinUnitX( m_chromaFormatIDC ), m_iSourceHeight - ( m_confWinTop + m_confWinBottom ) * TComSPS::getWinUnitY( m_chromaFormatIDC ), m_iFrameRate );
     305  printf("Real     Format                   : %dx%d %dHz\n", m_iSourceWidth - ( m_confWinLeft + m_confWinRight ) * TComSPS::getWinUnitX( m_chromaFormatIDC ), m_iSourceHeight - ( m_confWinTop + m_confWinBottom ) * TComSPS::getWinUnitY( m_chromaFormatIDC ), m_iFrameRate );
    306306#else
    307   printf("Real     Format               : %dx%d %dHz\n", m_iSourceWidth - m_confWinLeft - m_confWinRight, m_iSourceHeight - m_confWinTop - m_confWinBottom, m_iFrameRate );
    308 #endif
    309   printf("Internal Format               : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate );
     307  printf("Real     Format                   : %dx%d %dHz\n", m_iSourceWidth - m_confWinLeft - m_confWinRight, m_iSourceHeight - m_confWinTop - m_confWinBottom, m_iFrameRate );
     308#endif
     309  printf("Internal Format                   : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate );
     310#if MULTIPLE_PTL_SUPPORT
     311  printf("PTL index                         : %d\n", m_layerPTLIdx );
     312#endif
    310313#if O0194_DIFFERENT_BITDEPTH_EL_BL
    311   printf("Input bit depth               : (Y:%d, C:%d)\n", m_inputBitDepthY   , m_inputBitDepthC    );
    312   printf("Internal bit depth            : (Y:%d, C:%d)\n", m_internalBitDepthY, m_internalBitDepthC );
    313   printf("PCM sample bit depth          : (Y:%d, C:%d)\n", m_cAppEncCfg->getPCMInputBitDepthFlag() ? m_inputBitDepthY : m_internalBitDepthY, m_cAppEncCfg->getPCMInputBitDepthFlag() ? m_inputBitDepthC : m_internalBitDepthC );
    314 #endif
     314  printf("Input bit depth                   : (Y:%d, C:%d)\n", m_inputBitDepth[CHANNEL_TYPE_LUMA], m_inputBitDepth[CHANNEL_TYPE_CHROMA] );
     315  printf("Internal bit depth                : (Y:%d, C:%d)\n", m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA] );
     316  printf("PCM sample bit depth              : (Y:%d, C:%d)\n", m_cAppEncCfg->getPCMInputBitDepthFlag() ? m_inputBitDepth[CHANNEL_TYPE_LUMA] : m_internalBitDepth[CHANNEL_TYPE_LUMA], m_cAppEncCfg->getPCMInputBitDepthFlag() ? m_inputBitDepth[CHANNEL_TYPE_CHROMA] : m_internalBitDepth[CHANNEL_TYPE_CHROMA] );
     317#endif
     318  std::cout << "Input ChromaFormatIDC             :";
     319
     320  switch (m_InputChromaFormatIDC)
     321  {
     322  case CHROMA_400:  std::cout << " 4:0:0"; break;
     323  case CHROMA_420:  std::cout << " 4:2:0"; break;
     324  case CHROMA_422:  std::cout << " 4:2:2"; break;
     325  case CHROMA_444:  std::cout << " 4:4:4"; break;
     326  default:
     327    std::cerr << "Invalid";
     328    exit(1);
     329  }
     330  std::cout << std::endl;
     331
     332  std::cout << "Output (internal) ChromaFormatIDC :";
     333  switch (m_chromaFormatIDC)
     334  {
     335  case CHROMA_400:  std::cout << " 4:0:0"; break;
     336  case CHROMA_420:  std::cout << " 4:2:0"; break;
     337  case CHROMA_422:  std::cout << " 4:2:2"; break;
     338  case CHROMA_444:  std::cout << " 4:4:4"; break;
     339  default:
     340    std::cerr << "Invalid";
     341    exit(1);
     342  }
     343  printf("\n");
    315344#if LAYER_CTB
    316   printf("CU size / depth               : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth );
    317   printf("RQT trans. size (min / max)   : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize );
    318   printf("Max RQT depth inter           : %d\n", m_uiQuadtreeTUMaxDepthInter);
    319   printf("Max RQT depth intra           : %d\n", m_uiQuadtreeTUMaxDepthIntra);
    320 #endif
    321   printf("QP                            : %5.2f\n", m_fQP );
    322   printf("Intra period                  : %d\n", m_iIntraPeriod );
    323 #if RC_SHVC_HARMONIZATION
    324   printf("RateControl                   : %d\n", m_RCEnableRateControl );
     345  printf("CU size / depth                   : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth );
     346  printf("RQT trans. size (min / max)       : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize );
     347  printf("Max RQT depth inter               : %d\n", m_uiQuadtreeTUMaxDepthInter);
     348  printf("Max RQT depth intra               : %d\n", m_uiQuadtreeTUMaxDepthIntra);
     349#endif
     350  printf("QP                                : %5.2f\n", m_fQP );
     351  printf("Intra period                      : %d\n", m_iIntraPeriod );
     352#if RC_SHVC_HARMONIZATION                   
     353  printf("RateControl                       : %d\n", m_RCEnableRateControl );
    325354  if(m_RCEnableRateControl)
    326355  {
    327     printf("TargetBitrate                 : %d\n", m_RCTargetBitrate );
    328     printf("KeepHierarchicalBit           : %d\n", m_RCKeepHierarchicalBit );
    329     printf("LCULevelRC                    : %d\n", m_RCLCULevelRC );
    330     printf("UseLCUSeparateModel           : %d\n", m_RCUseLCUSeparateModel );
    331     printf("InitialQP                     : %d\n", m_RCInitialQP );
    332     printf("ForceIntraQP                  : %d\n", m_RCForceIntraQP );
    333   }
    334 #endif
    335   printf("WaveFrontSynchro:%d WaveFrontSubstreams:%d", m_waveFrontSynchro, m_iWaveFrontSubstreams);
     356    printf("TargetBitrate                     : %d\n", m_RCTargetBitrate );
     357    printf("KeepHierarchicalBit               : %d\n", m_RCKeepHierarchicalBit );
     358    printf("LCULevelRC                        : %d\n", m_RCLCULevelRC );
     359    printf("UseLCUSeparateModel               : %d\n", m_RCUseLCUSeparateModel );
     360    printf("InitialQP                         : %d\n", m_RCInitialQP );
     361    printf("ForceIntraQP                      : %d\n", m_RCForceIntraQP );
     362  }
     363#endif
     364  printf("WaveFrontSynchro                  : %d\n", m_waveFrontSynchro);
     365  printf("WaveFrontSubstreams               : %d\n", m_iWaveFrontSubstreams);
    336366#if LAYER_CTB
    337   printf("PCM:%d ", (m_cAppEncCfg->getUsePCM() && (1<<m_cAppEncCfg->getPCMLog2MinSize()) <= m_uiMaxCUWidth)? 1 : 0);
     367  printf("PCM                               : %d ", (m_cAppEncCfg->getUsePCM() && (1<<m_cAppEncCfg->getPCMLog2MinSize()) <= m_uiMaxCUWidth)? 1 : 0);
    338368#endif
    339369}
     
    363393        fprintf(stderr, "Warning: Automatic padding enabled, but padding parameters are also set\n");
    364394      }
     395
    365396      // automatic padding to minimum CU size
    366397#if LAYER_CTB
     
    399430        fprintf(stderr, "Warning: Automatic padding enabled, but cropping parameters are set. Undesired size possible.\n");
    400431      }
     432
    401433      //padding
    402434      m_iSourceWidth  += m_aiPad[0];
     
    470502
    471503#if O0194_DIFFERENT_BITDEPTH_EL_BL
    472   for(UInt layer = 0; layer < MAX_LAYERS; layer++)
    473   {
    474     xConfirmPara( m_iQP <  -6 * ((Int)m_cAppEncCfg->getInternalBitDepthY(layer) - 8) || m_iQP > 51,                "QP exceeds supported range (-QpBDOffsety to 51)" );
    475   }
     504  xConfirmPara( m_iQP <  -6 * (m_internalBitDepth[CHANNEL_TYPE_LUMA] - 8) || m_iQP > 51,                "QP exceeds supported range (-QpBDOffsety to 51)" );
    476505#else
    477506  xConfirmPara( m_iQP <  -6 * ((Int)m_cAppEncCfg->getInternalBitDepthY() - 8) || m_iQP > 51,                "QP exceeds supported range (-QpBDOffsety to 51)" );
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncLayerCfg.h

    r978 r1029  
    1010#include "TLibEncoder/TEncCfg.h"
    1111#include <sstream>
     12#include <iomanip>
    1213
    1314using namespace std;
     
    4243  Int       m_iIntraPeriod;                                   ///< period of I-slice (random access period)
    4344  Double    m_fQP;                                            ///< QP value of key-picture (floating point)
     45  ChromaFormat m_chromaFormatIDC;
     46  ChromaFormat m_InputChromaFormatIDC;
     47  ChromaFormat m_chromaFormatConstraint;
     48  UInt      m_bitDepthConstraint;
     49  Bool      m_intraConstraintFlag;
     50  Bool      m_lowerBitRateConstraintFlag;
    4451#if AUXILIARY_PICTURES
    45   ChromaFormat m_chromaFormatIDC;
    46   ChromaFormat m_InputChromaFormat;
    47   Int          m_auxId;
     52  Int       m_auxId;
    4853#endif
    4954#if VPS_EXTN_DIRECT_REF_LAYERS
     
    8893  Int*      m_aidQP;                                          ///< array of slice QP values
    8994  TAppEncCfg* m_cAppEncCfg;                                   ///< pointer to app encoder config
    90   Int       m_numScaledRefLayerOffsets  ;
     95  Int       m_numScaledRefLayerOffsets;
    9196#if O0098_SCALED_REF_LAYER_ID
    9297  Int       m_scaledRefLayerId          [MAX_LAYERS];
     
    115120#endif
    116121
    117 #if O0194_DIFFERENT_BITDEPTH_EL_BL
    118   Int       m_inputBitDepthY;                               ///< bit-depth of input file (luma component)
    119   Int       m_inputBitDepthC;                               ///< bit-depth of input file (chroma component)
    120   Int       m_internalBitDepthY;                            ///< bit-depth codec operates at in luma (input/output files will be converted)
    121   Int       m_internalBitDepthC;                            ///< bit-depth codec operates at in chroma (input/output files will be converted)
    122   Int       m_outputBitDepthY;                              ///< bit-depth of output file (luma component)
    123   Int       m_outputBitDepthC;                              ///< bit-depth of output file (chroma component)
    124 #endif
     122  Int       m_inputBitDepth   [MAX_NUM_CHANNEL_TYPE];         ///< bit-depth of input file
     123  Int       m_outputBitDepth  [MAX_NUM_CHANNEL_TYPE];         ///< bit-depth of output file
     124  Int       m_MSBExtendedBitDepth[MAX_NUM_CHANNEL_TYPE];      ///< bit-depth of input samples after MSB extension
     125  Int       m_internalBitDepth[MAX_NUM_CHANNEL_TYPE];         ///< bit-depth codec operates at (input/output files will be converted)
     126  UInt      m_saoOffsetBitShift[MAX_NUM_CHANNEL_TYPE];
     127  Bool      m_useExtendedPrecision;
     128  Bool      m_useHighPrecisionPredictionWeighting;
     129
    125130#if REPN_FORMAT_IN_VPS
    126131  Int       m_repFormatIdx;
     
    154159#endif
    155160
     161#if MULTIPLE_PTL_SUPPORT
     162  // profile/level
     163  Int       m_layerPTLIdx;
     164#endif
     165
    156166public:
    157167  TAppEncLayerCfg();
     
    182192  Int     getConfWinBottom()          {return m_confWinBottom;       }
    183193#if AUXILIARY_PICTURES
    184   ChromaFormat getInputChromaFormat()   {return m_InputChromaFormat;}
     194  ChromaFormat getInputChromaFormat()   {return m_InputChromaFormatIDC;}
    185195  ChromaFormat getChromaFormatIDC()     {return m_chromaFormatIDC;  }
    186196  Int          getAuxId()               {return m_auxId;            }
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r1011 r1029  
    4242#include <fcntl.h>
    4343#include <assert.h>
     44#if !SVC_EXTENSION
     45#include <iomanip>
     46#endif
    4447
    4548#include "TAppEncTop.h"
     
    8083  vps->setVpsPocLsbAlignedFlag(false);
    8184#endif
    82   vps->setMaxTLayers                       ( m_maxTempLayer );
     85  vps->setMaxTLayers                                                      ( m_maxTempLayer );
    8386  if (m_maxTempLayer == 1)
    8487  {
     
    8790  for(Int i = 0; i < MAX_TLAYER; i++)
    8891  {
    89     vps->setNumReorderPics                 ( m_numReorderPics[i], i );
    90     vps->setMaxDecPicBuffering             ( m_maxDecPicBuffering[i], i );
     92    vps->setNumReorderPics                                                ( m_numReorderPics[i], i );
     93    vps->setMaxDecPicBuffering                                            ( m_maxDecPicBuffering[i], i );
    9194  }
    9295
     
    107110#endif
    108111#if O0194_DIFFERENT_BITDEPTH_EL_BL
    109           && m_acLayerCfg[layer].m_internalBitDepthY == m_acLayerCfg[idx].m_internalBitDepthY && m_acLayerCfg[layer].m_internalBitDepthC == m_acLayerCfg[idx].m_internalBitDepthC
     112          && m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA] == m_acLayerCfg[idx].m_internalBitDepth[CHANNEL_TYPE_LUMA] && m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA] == m_acLayerCfg[idx].m_internalBitDepth[CHANNEL_TYPE_CHROMA]
    110113#endif
    111114          )
     
    150153  }
    151154
    152   vps->setVpsNumRepFormats( maxRepFormatIdx + 1 );
     155  vps->setVpsNumRepFormats                                                ( maxRepFormatIdx + 1 );
    153156
    154157#if Q0195_REP_FORMAT_CLEANUP
    155158  // When not present, the value of rep_format_idx_present_flag is inferred to be equal to 0
    156   vps->setRepFormatIdxPresentFlag( vps->getVpsNumRepFormats() > 1 ? true : false );
    157 #else
    158   vps->setRepFormatIdxPresentFlag( true );
     159  vps->setRepFormatIdxPresentFlag                                         ( vps->getVpsNumRepFormats() > 1 ? true : false );
     160#else
     161  vps->setRepFormatIdxPresentFlag                                         ( true );
    159162#endif
    160163
     
    163166    RepFormat *repFormat = vps->getVpsRepFormat( idx );
    164167#if REPN_FORMAT_CONTROL_FLAG
    165     repFormat->setChromaAndBitDepthVpsPresentFlag( true );
     168    repFormat->setChromaAndBitDepthVpsPresentFlag                         ( true );
    166169    if (idx==0)
    167170    {
     
    169172    }
    170173#endif
    171     repFormat->setPicWidthVpsInLumaSamples  ( m_acLayerCfg[mapIdxToLayer[idx]].getSourceWidth()   );
    172     repFormat->setPicHeightVpsInLumaSamples ( m_acLayerCfg[mapIdxToLayer[idx]].getSourceHeight()  );
     174    repFormat->setPicWidthVpsInLumaSamples                                ( m_acLayerCfg[mapIdxToLayer[idx]].getSourceWidth()   );
     175    repFormat->setPicHeightVpsInLumaSamples                               ( m_acLayerCfg[mapIdxToLayer[idx]].getSourceHeight()  );
    173176#if AUXILIARY_PICTURES
    174     repFormat->setChromaFormatVpsIdc        ( m_acLayerCfg[mapIdxToLayer[idx]].getChromaFormatIDC() );
    175 #else
    176     repFormat->setChromaFormatVpsIdc        ( 1                                            );  // Need modification to change for each layer - corresponds to 420
    177 #endif
    178     repFormat->setSeparateColourPlaneVpsFlag( 0                                            );  // Need modification to change for each layer
     177    repFormat->setChromaFormatVpsIdc                                      ( m_acLayerCfg[mapIdxToLayer[idx]].getChromaFormatIDC() );
     178#else
     179    repFormat->setChromaFormatVpsIdc                                      ( 1 );  // Need modification to change for each layer - corresponds to 420
     180#endif
     181    repFormat->setSeparateColourPlaneVpsFlag                              ( 0 );  // Need modification to change for each layer
    179182#if O0194_DIFFERENT_BITDEPTH_EL_BL
    180     repFormat->setBitDepthVpsLuma           ( getInternalBitDepthY(mapIdxToLayer[idx])      );  // Need modification to change for each layer
    181     repFormat->setBitDepthVpsChroma         ( getInternalBitDepthC(mapIdxToLayer[idx])      );  // Need modification to change for each layer
    182 #else
    183     repFormat->setBitDepthVpsLuma           ( getInternalBitDepthY()                        );  // Need modification to change for each layer
    184     repFormat->setBitDepthVpsChroma         ( getInternalBitDepthC()                        );  // Need modification to change for each layer
     183    repFormat->setBitDepthVpsLuma                                         ( getInternalBitDepth(mapIdxToLayer[idx], CHANNEL_TYPE_LUMA)      );  // Need modification to change for each layer
     184    repFormat->setBitDepthVpsChroma                                       ( getInternalBitDepth(mapIdxToLayer[idx], CHANNEL_TYPE_CHROMA)    );  // Need modification to change for each layer
     185#else
     186    repFormat->setBitDepthVpsLuma                                         ( getInternalBitDepth(CHANNEL_TYPE_LUMA)                        );  // Need modification to change for each layer
     187    repFormat->setBitDepthVpsChroma                                       ( getInternalBitDepth(CHANNEL_TYPE_CHROMA)                      );  // Need modification to change for each layer
    185188#endif
    186189
    187190#if R0156_CONF_WINDOW_IN_REP_FORMAT
    188     repFormat->getConformanceWindowVps().setWindow(
    189       m_acLayerCfg[mapIdxToLayer[idx]].m_confWinLeft,
    190       m_acLayerCfg[mapIdxToLayer[idx]].m_confWinRight,
    191       m_acLayerCfg[mapIdxToLayer[idx]].m_confWinTop,
    192       m_acLayerCfg[mapIdxToLayer[idx]].m_confWinBottom );
     191    repFormat->getConformanceWindowVps().setWindow                        ( m_acLayerCfg[mapIdxToLayer[idx]].m_confWinLeft,                                                                             
     192                                                                            m_acLayerCfg[mapIdxToLayer[idx]].m_confWinRight,
     193                                                                            m_acLayerCfg[mapIdxToLayer[idx]].m_confWinTop,
     194                                                                            m_acLayerCfg[mapIdxToLayer[idx]].m_confWinBottom );
    193195#endif
    194196
    195197#if HIGHER_LAYER_IRAP_SKIP_FLAG
    196     m_acTEncTop[mapIdxToLayer[idx]].setSkipPictureAtArcSwitch( m_skipPictureAtArcSwitch );
     198    m_acTEncTop[mapIdxToLayer[idx]].setSkipPictureAtArcSwitch             ( m_skipPictureAtArcSwitch );
    197199#endif
    198200  }
     
    203205  //Populate PTL in VPS
    204206  TComVPS *pVPS = m_acTEncTop[0].getVPS();
    205   for (int ii = 0; ii < m_numPTLInfo; ii++)
     207  for( Int ii = 0; ii < m_numPTLInfo; ii++ )
    206208  {
    207209    pVPS->getPTL(ii)->getGeneralPTL()->setLevelIdc(m_levelList[ii]);
     
    221223  {
    222224    myvector =  m_listOfLayerPTLofOlss[ii];
     225
    223226    for (std::vector<int>::iterator it = myvector.begin() ; it != myvector.end(); ++it)
    224227    {
     
    226229    }
    227230  }
    228 
    229   //pVPS->setProfileLevelTierIdx(
    230231#endif
    231232
     
    236237#if O0194_DIFFERENT_BITDEPTH_EL_BL
    237238    //1
    238     g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
    239     g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
    240 
    241     g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
    242     g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     239    g_bitDepth[CHANNEL_TYPE_LUMA]   = m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA];
     240    g_bitDepth[CHANNEL_TYPE_CHROMA] = m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
     241
     242    g_PCMBitDepth[CHANNEL_TYPE_LUMA]   = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepth[CHANNEL_TYPE_LUMA]   : m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA];
     243    g_PCMBitDepth[CHANNEL_TYPE_CHROMA] = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepth[CHANNEL_TYPE_CHROMA] : m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
    243244
    244245    // Set this to be used in Upsampling filter in function "TComUpsampleFilter::upsampleBasePic"
    245     g_bitDepthYLayer[layer] = g_bitDepthY;
    246     g_bitDepthCLayer[layer] = g_bitDepthC;
     246    g_bitDepthLayer[CHANNEL_TYPE_LUMA][layer]   = g_bitDepth[CHANNEL_TYPE_LUMA];
     247    g_bitDepthLayer[CHANNEL_TYPE_CHROMA][layer] = g_bitDepth[CHANNEL_TYPE_CHROMA];
    247248
    248249#if O0194_WEIGHTED_PREDICTION_CGS
    249     m_acTEncTop[layer].setInterLayerWeightedPredFlag( m_useInterLayerWeightedPred );
    250 #endif
    251 #endif
    252     //m_acTEncTop[layer].setVPS(&vps);
    253     m_acTEncTop[layer].setFrameRate                    ( m_acLayerCfg[layer].getFrameRate() );
    254     m_acTEncTop[layer].setFrameSkip                    ( m_FrameSkip );
    255     m_acTEncTop[layer].setSourceWidth                  ( m_acLayerCfg[layer].getSourceWidth() );
    256     m_acTEncTop[layer].setSourceHeight                 ( m_acLayerCfg[layer].getSourceHeight() );
    257     m_acTEncTop[layer].setConformanceWindow            ( m_acLayerCfg[layer].m_confWinLeft, m_acLayerCfg[layer].m_confWinRight, m_acLayerCfg[layer].m_confWinTop, m_acLayerCfg[layer].m_confWinBottom );
    258     m_acTEncTop[layer].setFramesToBeEncoded            ( m_framesToBeEncoded );
    259 
    260 #if SVC_EXTENSION && MULTIPLE_PTL_SUPPORT
    261     m_acTEncTop[layer].setProfile(m_profileList[m_layerPTLIdx[layer]]);
    262     m_acTEncTop[layer].setLevel(m_levelTierList[m_layerPTLIdx[layer]], m_levelList[m_layerPTLIdx[layer]]);
    263     m_acTEncTop[layer].setProgressiveSourceFlag(m_progressiveSourceFlagList[m_layerPTLIdx[layer]]);
    264     m_acTEncTop[layer].setInterlacedSourceFlag(m_interlacedSourceFlagList[m_layerPTLIdx[layer]]);
    265     m_acTEncTop[layer].setNonPackedConstraintFlag(m_nonPackedConstraintFlagList[m_layerPTLIdx[layer]]);
    266     m_acTEncTop[layer].setFrameOnlyConstraintFlag(m_frameOnlyConstraintFlagList[m_layerPTLIdx[layer]]);
    267 #else
    268     m_acTEncTop[layer].setProfile(m_profile);
    269     m_acTEncTop[layer].setLevel(m_levelTier, m_level);
    270     m_acTEncTop[layer].setProgressiveSourceFlag(m_progressiveSourceFlag);
    271     m_acTEncTop[layer].setInterlacedSourceFlag(m_interlacedSourceFlag);
    272     m_acTEncTop[layer].setNonPackedConstraintFlag(m_nonPackedConstraintFlag);
    273     m_acTEncTop[layer].setFrameOnlyConstraintFlag(m_frameOnlyConstraintFlag);
    274 #endif
     250    m_acTEncTop[layer].setInterLayerWeightedPredFlag                      ( m_useInterLayerWeightedPred );
     251#endif
     252#endif
     253   
     254#if MULTIPLE_PTL_SUPPORT
     255    Int layerPTLIdx = m_acLayerCfg[layer].m_layerPTLIdx;
     256    m_acTEncTop[layer].setProfile                                         ( m_profileList[layerPTLIdx] );
     257    m_acTEncTop[layer].setLevel                                           ( m_levelTierList[layerPTLIdx], m_levelList[layerPTLIdx] );
     258    m_acTEncTop[layer].setProgressiveSourceFlag                           ( m_progressiveSourceFlagList[layerPTLIdx] );
     259    m_acTEncTop[layer].setInterlacedSourceFlag                            ( m_interlacedSourceFlagList[layerPTLIdx] );
     260    m_acTEncTop[layer].setNonPackedConstraintFlag                         ( m_nonPackedConstraintFlagList[layerPTLIdx] );
     261    m_acTEncTop[layer].setFrameOnlyConstraintFlag                         ( m_frameOnlyConstraintFlagList[layerPTLIdx] );
     262    m_acTEncTop[layer].setBitDepthConstraintValue                         ( m_acLayerCfg[layer].m_bitDepthConstraint );
     263    m_acTEncTop[layer].setChromaFormatConstraintValue                     ( m_acLayerCfg[layer].m_chromaFormatConstraint );
     264    m_acTEncTop[layer].setIntraConstraintFlag                             ( m_acLayerCfg[layer].m_intraConstraintFlag );
     265    m_acTEncTop[layer].setLowerBitRateConstraintFlag                      ( m_acLayerCfg[layer].m_lowerBitRateConstraintFlag );
     266#else
     267    m_acTEncTop[layer].setProfile                                         ( m_profile );
     268    m_acTEncTop[layer].setLevel                                           ( m_levelTier, m_level );
     269    m_acTEncTop[layer].setProgressiveSourceFlag                           ( m_progressiveSourceFlag );
     270    m_acTEncTop[layer].setInterlacedSourceFlag                            ( m_interlacedSourceFlag );
     271    m_acTEncTop[layer].setNonPackedConstraintFlag                         ( m_nonPackedConstraintFlag );
     272    m_acTEncTop[layer].setFrameOnlyConstraintFlag                         ( m_frameOnlyConstraintFlag );
     273    m_acTEncTop[layer].setBitDepthConstraintValue                         ( m_bitDepthConstraint );
     274    m_acTEncTop[layer].setChromaFormatConstraintValue                     ( m_acLayerCfg[layer].m_chromaFormatConstraint );
     275    m_acTEncTop[layer].setIntraConstraintFlag                             ( m_intraConstraintFlag );
     276    m_acTEncTop[layer].setLowerBitRateConstraintFlag                      ( m_lowerBitRateConstraintFlag );
     277#endif
     278
     279    m_acTEncTop[layer].setPrintMSEBasedSequencePSNR                       ( m_printMSEBasedSequencePSNR);
     280    m_acTEncTop[layer].setPrintFrameMSE                                   ( m_printFrameMSE);
     281    m_acTEncTop[layer].setPrintSequenceMSE                                ( m_printSequenceMSE);
     282    m_acTEncTop[layer].setCabacZeroWordPaddingEnabled                     ( m_cabacZeroWordPaddingEnabled );
     283
     284    m_acTEncTop[layer].setFrameRate                                       ( m_acLayerCfg[layer].getFrameRate() );
     285    m_acTEncTop[layer].setFrameSkip                                       ( m_FrameSkip );
     286    m_acTEncTop[layer].setSourceWidth                                     ( m_acLayerCfg[layer].getSourceWidth() );
     287    m_acTEncTop[layer].setSourceHeight                                    ( m_acLayerCfg[layer].getSourceHeight() );
     288    m_acTEncTop[layer].setConformanceWindow                               ( m_acLayerCfg[layer].m_confWinLeft, m_acLayerCfg[layer].m_confWinRight, m_acLayerCfg[layer].m_confWinTop, m_acLayerCfg[layer].m_confWinBottom );
     289    m_acTEncTop[layer].setFramesToBeEncoded                               ( m_framesToBeEncoded );
    275290
    276291#if REF_IDX_MFM
    277292#if AVC_BASE
    278293#if VPS_AVC_BL_FLAG_REMOVAL
    279     m_acTEncTop[layer].setMFMEnabledFlag(layer == 0 ? false : ( m_nonHEVCBaseLayerFlag ? false : true ) && m_acLayerCfg[layer].getNumMotionPredRefLayers());
    280 #else
    281     m_acTEncTop[layer].setMFMEnabledFlag(layer == 0 ? false : ( m_avcBaseLayerFlag ? false : true ) && m_acLayerCfg[layer].getNumMotionPredRefLayers());
    282 #endif
    283 #else
    284     m_acTEncTop[layer].setMFMEnabledFlag(layer == 0 ? false : ( m_acLayerCfg[layer].getNumMotionPredRefLayers() > 0 ) );
     294    m_acTEncTop[layer].setMFMEnabledFlag                                  (layer == 0 ? false : ( m_nonHEVCBaseLayerFlag ? false : true ) && m_acLayerCfg[layer].getNumMotionPredRefLayers());
     295#else
     296    m_acTEncTop[layer].setMFMEnabledFlag                                  (layer == 0 ? false : ( m_avcBaseLayerFlag ? false : true ) && m_acLayerCfg[layer].getNumMotionPredRefLayers());
     297#endif
     298#else
     299    m_acTEncTop[layer].setMFMEnabledFlag                                  (layer == 0 ? false : ( m_acLayerCfg[layer].getNumMotionPredRefLayers() > 0 ) );
    285300#endif
    286301#endif
     
    291306
    292307    //====== Coding Structure ========
    293     m_acTEncTop[layer].setIntraPeriod                  ( m_acLayerCfg[layer].m_iIntraPeriod );
    294     m_acTEncTop[layer].setDecodingRefreshType          ( m_iDecodingRefreshType );
    295     m_acTEncTop[layer].setGOPSize                      ( m_iGOPSize );
     308    m_acTEncTop[layer].setIntraPeriod                                     ( m_acLayerCfg[layer].m_iIntraPeriod );
     309    m_acTEncTop[layer].setDecodingRefreshType                             ( m_iDecodingRefreshType );
     310    m_acTEncTop[layer].setGOPSize                                         ( m_iGOPSize );
    296311#if Q0108_TSA_STSA
    297     m_acTEncTop[layer].setGopList                      ( layer ? m_EhGOPList[layer] : m_GOPList );
    298 #else
    299     m_acTEncTop[layer].setGopList                      ( m_GOPList );
     312    m_acTEncTop[layer].setGopList                                         ( layer ? m_EhGOPList[layer] : m_GOPList );
     313#else
     314    m_acTEncTop[layer].setGopList                                         ( m_GOPList );
    300315#endif
    301316
    302317#if !Q0108_TSA_STSA
    303     m_acTEncTop[layer].setExtraRPSs                    ( m_extraRPSs );
    304 #else
    305     m_acTEncTop[layer].setExtraRPSs                    ( m_extraRPSs[layer] );
     318    m_acTEncTop[layer].setExtraRPSs                                       ( m_extraRPSs );
     319#else
     320    m_acTEncTop[layer].setExtraRPSs                                       ( m_extraRPSs[layer] );
    306321#endif
    307322    for(Int i = 0; i < MAX_TLAYER; i++)
    308323    {
    309       m_acTEncTop[layer].setNumReorderPics             ( m_numReorderPics[i], i );
    310       m_acTEncTop[layer].setMaxDecPicBuffering         ( m_maxDecPicBuffering[i], i );
     324      m_acTEncTop[layer].setNumReorderPics                                ( m_numReorderPics[i], i );
     325      m_acTEncTop[layer].setMaxDecPicBuffering                            ( m_maxDecPicBuffering[i], i );
    311326    }
    312327    for( UInt uiLoop = 0; uiLoop < MAX_TLAYER; ++uiLoop )
    313328    {
    314       m_acTEncTop[layer].setLambdaModifier( uiLoop, m_adLambdaModifier[ uiLoop ] );
    315     }
    316     m_acTEncTop[layer].setQP                           ( m_acLayerCfg[layer].getIntQP() );
    317 
    318     m_acTEncTop[layer].setPad                          ( m_acLayerCfg[layer].getPad() );
     329      m_acTEncTop[layer].setLambdaModifier                                ( uiLoop, m_adLambdaModifier[ uiLoop ] );
     330    }
     331    m_acTEncTop[layer].setQP                                              ( m_acLayerCfg[layer].getIntQP() );
     332
     333    m_acTEncTop[layer].setPad                                             ( m_acLayerCfg[layer].getPad() );
    319334#if !Q0108_TSA_STSA
    320     m_acTEncTop[layer].setMaxTempLayer                 ( m_maxTempLayer );
     335    m_acTEncTop[layer].setMaxTempLayer                                    ( m_maxTempLayer );
    321336#else
    322337    if (layer== 0)
    323338    {
    324       m_acTEncTop[layer].setMaxTempLayer                 ( m_maxTempLayer );
     339      m_acTEncTop[layer].setMaxTempLayer                                  ( m_maxTempLayer );
    325340    }
    326341    else
    327342    {
    328       m_acTEncTop[layer].setMaxTempLayer                 ( m_EhMaxTempLayer[layer] );
     343      m_acTEncTop[layer].setMaxTempLayer                                  ( m_EhMaxTempLayer[layer] );
    329344    }
    330345#endif
     
    333348    if( layer < m_numLayers - 1 )
    334349    {
    335        m_acTEncTop[layer].setMaxTidIlRefPicsPlus1 ( m_acLayerCfg[layer].getMaxTidIlRefPicsPlus1());
     350       m_acTEncTop[layer].setMaxTidIlRefPicsPlus1                         ( m_acLayerCfg[layer].getMaxTidIlRefPicsPlus1());
    336351    }
    337352
     
    341356      for(Int i = 0; i < MAX_VPS_LAYER_ID_PLUS1; i++)
    342357      {
    343         m_acTEncTop[layer].setSamplePredEnabledFlag(i, false);
    344         m_acTEncTop[layer].setMotionPredEnabledFlag(i, false);
     358        m_acTEncTop[layer].setSamplePredEnabledFlag                       (i, false);
     359        m_acTEncTop[layer].setMotionPredEnabledFlag                       (i, false);
    345360      }
    346361      if(m_acLayerCfg[layer].getNumSamplePredRefLayers() == -1)
    347362      {
    348363        // Not included in the configuration file; assume that each layer depends on previous layer
    349         m_acTEncTop[layer].setNumSamplePredRefLayers   (1);      // One sample pred ref. layer
    350         m_acTEncTop[layer].setSamplePredRefLayerId     (0, layer - 1);   // Previous layer
    351         m_acTEncTop[layer].setSamplePredEnabledFlag    (layer - 1, true);
     364        m_acTEncTop[layer].setNumSamplePredRefLayers                      (1);      // One sample pred ref. layer
     365        m_acTEncTop[layer].setSamplePredRefLayerId                        (0, layer - 1);   // Previous layer
     366        m_acTEncTop[layer].setSamplePredEnabledFlag                       (layer - 1, true);
    352367      }
    353368      else
    354369      {
    355         m_acTEncTop[layer].setNumSamplePredRefLayers   ( m_acLayerCfg[layer].getNumSamplePredRefLayers() );
     370        m_acTEncTop[layer].setNumSamplePredRefLayers                      ( m_acLayerCfg[layer].getNumSamplePredRefLayers() );
    356371        for(Int i = 0; i < m_acTEncTop[layer].getNumSamplePredRefLayers(); i++)
    357372        {
    358           m_acTEncTop[layer].setSamplePredRefLayerId   ( i, m_acLayerCfg[layer].getSamplePredRefLayerId(i));
    359           m_acTEncTop[layer].setSamplePredEnabledFlag  (m_acLayerCfg[layer].getSamplePredRefLayerId(i), true);
     373          m_acTEncTop[layer].setSamplePredRefLayerId                      ( i, m_acLayerCfg[layer].getSamplePredRefLayerId(i));
     374          m_acTEncTop[layer].setSamplePredEnabledFlag                     (m_acLayerCfg[layer].getSamplePredRefLayerId(i), true);
    360375        }
    361376      }
     
    363378      {
    364379        // Not included in the configuration file; assume that each layer depends on previous layer
    365         m_acTEncTop[layer].setNumMotionPredRefLayers   (1);      // One motion pred ref. layer
    366         m_acTEncTop[layer].setMotionPredRefLayerId     (0, layer - 1);   // Previous layer
    367         m_acTEncTop[layer].setMotionPredEnabledFlag    (layer - 1, true);
     380        m_acTEncTop[layer].setNumMotionPredRefLayers                      (1);      // One motion pred ref. layer
     381        m_acTEncTop[layer].setMotionPredRefLayerId                        (0, layer - 1);   // Previous layer
     382        m_acTEncTop[layer].setMotionPredEnabledFlag                       (layer - 1, true);
    368383      }
    369384      else
    370385      {
    371         m_acTEncTop[layer].setNumMotionPredRefLayers   ( m_acLayerCfg[layer].getNumMotionPredRefLayers() );
     386        m_acTEncTop[layer].setNumMotionPredRefLayers                      ( m_acLayerCfg[layer].getNumMotionPredRefLayers() );
    372387        for(Int i = 0; i < m_acTEncTop[layer].getNumMotionPredRefLayers(); i++)
    373388        {
    374           m_acTEncTop[layer].setMotionPredRefLayerId   ( i, m_acLayerCfg[layer].getMotionPredRefLayerId(i));
    375           m_acTEncTop[layer].setMotionPredEnabledFlag  (m_acLayerCfg[layer].getMotionPredRefLayerId(i), true);
     389          m_acTEncTop[layer].setMotionPredRefLayerId                      ( i, m_acLayerCfg[layer].getMotionPredRefLayerId(i));
     390          m_acTEncTop[layer].setMotionPredEnabledFlag                     (m_acLayerCfg[layer].getMotionPredRefLayerId(i), true);
    376391        }
    377392      }
     
    384399        if (m_acTEncTop[layer].getSamplePredEnabledFlag(i) || m_acTEncTop[layer].getMotionPredEnabledFlag(i))
    385400        {
    386           m_acTEncTop[layer].setRefLayerId(numDirectRefLayers, i);
     401          m_acTEncTop[layer].setRefLayerId                                (numDirectRefLayers, i);
    387402          numDirectRefLayers++;
    388403        }
    389404      }
    390       m_acTEncTop[layer].setNumDirectRefLayers(numDirectRefLayers);
     405      m_acTEncTop[layer].setNumDirectRefLayers                            (numDirectRefLayers);
    391406
    392407      if(m_acLayerCfg[layer].getNumActiveRefLayers() == -1)
    393408      {
    394         m_acTEncTop[layer].setNumActiveRefLayers( m_acTEncTop[layer].getNumDirectRefLayers() );
     409        m_acTEncTop[layer].setNumActiveRefLayers                          ( m_acTEncTop[layer].getNumDirectRefLayers() );
    395410        for( Int i = 0; i < m_acTEncTop[layer].getNumActiveRefLayers(); i++ )
    396411        {
     
    400415      else
    401416      {
    402         m_acTEncTop[layer].setNumActiveRefLayers       ( m_acLayerCfg[layer].getNumActiveRefLayers() );
     417        m_acTEncTop[layer].setNumActiveRefLayers                          ( m_acLayerCfg[layer].getNumActiveRefLayers() );
    403418        for(Int i = 0; i < m_acTEncTop[layer].getNumActiveRefLayers(); i++)
    404419        {
    405           m_acTEncTop[layer].setPredLayerId             ( i, m_acLayerCfg[layer].getPredLayerId(i));
     420          m_acTEncTop[layer].setPredLayerId                               ( i, m_acLayerCfg[layer].getPredLayerId(i));
    406421        }
    407422      }
     
    417432        Int rlSubHeightC = 2;
    418433#endif
    419         m_acTEncTop[layer].setRefRegionOffsetPresentFlag( i, m_acLayerCfg[layer].m_refRegionOffsetPresentFlag[i] );
    420         m_acTEncTop[layer].getRefLayerWindow(i).setWindow( rlSubWidthC  * m_acLayerCfg[layer].m_refRegionLeftOffset[i], rlSubWidthC  * m_acLayerCfg[layer].m_refRegionRightOffset[i],
    421                                                            rlSubHeightC * m_acLayerCfg[layer].m_refRegionTopOffset[i],  rlSubHeightC * m_acLayerCfg[layer].m_refRegionBottomOffset[i]);
     434        m_acTEncTop[layer].setRefRegionOffsetPresentFlag                  ( i, m_acLayerCfg[layer].m_refRegionOffsetPresentFlag[i] );
     435        m_acTEncTop[layer].getRefLayerWindow(i).setWindow                 ( rlSubWidthC  * m_acLayerCfg[layer].m_refRegionLeftOffset[i], rlSubWidthC  * m_acLayerCfg[layer].m_refRegionRightOffset[i],
     436                                                                            rlSubHeightC * m_acLayerCfg[layer].m_refRegionTopOffset[i],  rlSubHeightC * m_acLayerCfg[layer].m_refRegionBottomOffset[i]);
    422437      }
    423438#endif
     
    432447
    433448    //====== Loop/Deblock Filter ========
    434     m_acTEncTop[layer].setLoopFilterDisable            ( m_bLoopFilterDisable       );
    435     m_acTEncTop[layer].setLoopFilterOffsetInPPS        ( m_loopFilterOffsetInPPS );
    436     m_acTEncTop[layer].setLoopFilterBetaOffset         ( m_loopFilterBetaOffsetDiv2  );
    437     m_acTEncTop[layer].setLoopFilterTcOffset           ( m_loopFilterTcOffsetDiv2    );
    438     m_acTEncTop[layer].setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent);
    439     m_acTEncTop[layer].setDeblockingFilterMetric       ( m_DeblockingFilterMetric );
     449    m_acTEncTop[layer].setLoopFilterDisable                                ( m_bLoopFilterDisable       );
     450    m_acTEncTop[layer].setLoopFilterOffsetInPPS                            ( m_loopFilterOffsetInPPS );
     451    m_acTEncTop[layer].setLoopFilterBetaOffset                             ( m_loopFilterBetaOffsetDiv2  );
     452    m_acTEncTop[layer].setLoopFilterTcOffset                               ( m_loopFilterTcOffsetDiv2    );
     453    m_acTEncTop[layer].setDeblockingFilterControlPresent                   ( m_DeblockingFilterControlPresent);
     454    m_acTEncTop[layer].setDeblockingFilterMetric                           ( m_DeblockingFilterMetric );
    440455
    441456    //====== Motion search ========
    442     m_acTEncTop[layer].setFastSearch                   ( m_iFastSearch  );
    443     m_acTEncTop[layer].setSearchRange                  ( m_iSearchRange );
    444     m_acTEncTop[layer].setBipredSearchRange            ( m_bipredSearchRange );
     457    m_acTEncTop[layer].setFastSearch                                       ( m_iFastSearch  );
     458    m_acTEncTop[layer].setSearchRange                                      ( m_iSearchRange );
     459    m_acTEncTop[layer].setBipredSearchRange                                ( m_bipredSearchRange );
    445460
    446461    //====== Quality control ========
    447     m_acTEncTop[layer].setMaxDeltaQP                   ( m_iMaxDeltaQP  );
    448     m_acTEncTop[layer].setMaxCuDQPDepth                ( m_iMaxCuDQPDepth  );
    449 
    450     m_acTEncTop[layer].setChromaCbQpOffset             ( m_cbQpOffset     );
    451     m_acTEncTop[layer].setChromaCrQpOffset             ( m_crQpOffset  );
     462    m_acTEncTop[layer].setMaxDeltaQP                                       ( m_iMaxDeltaQP  );
     463    m_acTEncTop[layer].setMaxCuDQPDepth                                    ( m_iMaxCuDQPDepth  );
     464    m_acTEncTop[layer].setMaxCUChromaQpAdjustmentDepth                     ( m_maxCUChromaQpAdjustmentDepth );
     465    m_acTEncTop[layer].setChromaCbQpOffset                                 ( m_cbQpOffset     );
     466    m_acTEncTop[layer].setChromaCrQpOffset                                 ( m_crQpOffset  );
     467
     468    m_acTEncTop[layer].setChromaFormatIdc                                  ( m_acLayerCfg[layer].m_chromaFormatIDC  );
    452469
    453470#if ADAPTIVE_QP_SELECTION
    454     m_acTEncTop[layer].setUseAdaptQpSelect             ( m_bUseAdaptQpSelect   );
     471    m_acTEncTop[layer].setUseAdaptQpSelect                                 ( m_bUseAdaptQpSelect   );
    455472#endif
    456473   
    457     m_acTEncTop[layer].setUseAdaptiveQP                ( m_bUseAdaptiveQP  );
    458     m_acTEncTop[layer].setQPAdaptationRange            ( m_iQPAdaptationRange );
     474    m_acTEncTop[layer].setUseAdaptiveQP                                    ( m_bUseAdaptiveQP  );
     475    m_acTEncTop[layer].setQPAdaptationRange                                ( m_iQPAdaptationRange );
     476    m_acTEncTop[layer].setUseExtendedPrecision                             ( m_acLayerCfg[layer].m_useExtendedPrecision );
     477    m_acTEncTop[layer].setUseHighPrecisionPredictionWeighting              ( m_acLayerCfg[layer].m_useHighPrecisionPredictionWeighting );
    459478
    460479    //====== Tool list ========   
    461     m_acTEncTop[layer].setDeltaQpRD                    ( m_uiDeltaQpRD  );
    462     m_acTEncTop[layer].setUseASR                       ( m_bUseASR      );
    463     m_acTEncTop[layer].setUseHADME                     ( m_bUseHADME    );   
    464     m_acTEncTop[layer].setdQPs                         ( m_acLayerCfg[layer].getdQPs() );
    465     m_acTEncTop[layer].setUseRDOQ                      ( m_useRDOQ     );
    466     m_acTEncTop[layer].setUseRDOQTS                    ( m_useRDOQTS   );
    467     m_acTEncTop[layer].setRDpenalty                    ( m_rdPenalty );
     480    m_acTEncTop[layer].setDeltaQpRD                                        ( m_uiDeltaQpRD  );
     481    m_acTEncTop[layer].setUseASR                                           ( m_bUseASR      );
     482    m_acTEncTop[layer].setUseHADME                                         ( m_bUseHADME    );   
     483    m_acTEncTop[layer].setdQPs                                             ( m_acLayerCfg[layer].getdQPs() );
     484    m_acTEncTop[layer].setUseRDOQ                                          ( m_useRDOQ     );
     485    m_acTEncTop[layer].setUseRDOQTS                                        ( m_useRDOQTS   );
     486    m_acTEncTop[layer].setRDpenalty                                        ( m_rdPenalty );
    468487#if LAYER_CTB
    469     m_acTEncTop[layer].setQuadtreeTULog2MaxSize        ( m_acLayerCfg[layer].m_uiQuadtreeTULog2MaxSize );
    470     m_acTEncTop[layer].setQuadtreeTULog2MinSize        ( m_acLayerCfg[layer].m_uiQuadtreeTULog2MinSize );
    471     m_acTEncTop[layer].setQuadtreeTUMaxDepthInter      ( m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthInter );
    472     m_acTEncTop[layer].setQuadtreeTUMaxDepthIntra      ( m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthIntra );
    473 #else
    474     m_acTEncTop[layer].setQuadtreeTULog2MaxSize        ( m_uiQuadtreeTULog2MaxSize );
    475     m_acTEncTop[layer].setQuadtreeTULog2MinSize        ( m_uiQuadtreeTULog2MinSize );
    476     m_acTEncTop[layer].setQuadtreeTUMaxDepthInter      ( m_uiQuadtreeTUMaxDepthInter );
    477     m_acTEncTop[layer].setQuadtreeTUMaxDepthIntra      ( m_uiQuadtreeTUMaxDepthIntra );
    478 #endif
    479     m_acTEncTop[layer].setUseFastEnc                   ( m_bUseFastEnc  );
    480     m_acTEncTop[layer].setUseEarlyCU                   ( m_bUseEarlyCU  );
    481     m_acTEncTop[layer].setUseFastDecisionForMerge      ( m_useFastDecisionForMerge  );
    482     m_acTEncTop[layer].setUseCbfFastMode               ( m_bUseCbfFastMode  );
    483     m_acTEncTop[layer].setUseEarlySkipDetection        ( m_useEarlySkipDetection );
     488    m_acTEncTop[layer].setQuadtreeTULog2MaxSize                            ( m_acLayerCfg[layer].m_uiQuadtreeTULog2MaxSize );
     489    m_acTEncTop[layer].setQuadtreeTULog2MinSize                            ( m_acLayerCfg[layer].m_uiQuadtreeTULog2MinSize );
     490    m_acTEncTop[layer].setQuadtreeTUMaxDepthInter                          ( m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthInter );
     491    m_acTEncTop[layer].setQuadtreeTUMaxDepthIntra                          ( m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthIntra );
     492#else
     493    m_acTEncTop[layer].setQuadtreeTULog2MaxSize                            ( m_uiQuadtreeTULog2MaxSize );
     494    m_acTEncTop[layer].setQuadtreeTULog2MinSize                            ( m_uiQuadtreeTULog2MinSize );
     495    m_acTEncTop[layer].setQuadtreeTUMaxDepthInter                          ( m_uiQuadtreeTUMaxDepthInter );
     496    m_acTEncTop[layer].setQuadtreeTUMaxDepthIntra                          ( m_uiQuadtreeTUMaxDepthIntra );
     497#endif
     498    m_acTEncTop[layer].setUseFastEnc                                       ( m_bUseFastEnc  );
     499    m_acTEncTop[layer].setUseEarlyCU                                       ( m_bUseEarlyCU  );
     500    m_acTEncTop[layer].setUseFastDecisionForMerge                          ( m_useFastDecisionForMerge  );
     501    m_acTEncTop[layer].setUseCbfFastMode                                   ( m_bUseCbfFastMode  );
     502    m_acTEncTop[layer].setUseEarlySkipDetection                            ( m_useEarlySkipDetection );
     503    m_acTEncTop[layer].setUseCrossComponentPrediction                      ( m_useCrossComponentPrediction );
     504    m_acTEncTop[layer].setUseReconBasedCrossCPredictionEstimate            ( m_reconBasedCrossCPredictionEstimate );
     505    m_acTEncTop[layer].setSaoOffsetBitShift                                ( CHANNEL_TYPE_LUMA  , m_saoOffsetBitShift[CHANNEL_TYPE_LUMA]   );
     506    m_acTEncTop[layer].setSaoOffsetBitShift                                ( CHANNEL_TYPE_CHROMA, m_saoOffsetBitShift[CHANNEL_TYPE_CHROMA] );
     507    m_acTEncTop[layer].setUseTransformSkip                                 ( m_useTransformSkip      );
     508    m_acTEncTop[layer].setUseTransformSkipFast                             ( m_useTransformSkipFast  );
     509    m_acTEncTop[layer].setUseResidualRotation                              ( m_useResidualRotation   );
     510    m_acTEncTop[layer].setUseSingleSignificanceMapContext                  ( m_useSingleSignificanceMapContext   );
     511    m_acTEncTop[layer].setUseGolombRiceParameterAdaptation                 ( m_useGolombRiceParameterAdaptation );
     512    m_acTEncTop[layer].setAlignCABACBeforeBypass                           ( m_alignCABACBeforeBypass );
     513    m_acTEncTop[layer].setTransformSkipLog2MaxSize                         ( m_transformSkipLog2MaxSize  );
     514    for (UInt signallingModeIndex = 0; signallingModeIndex < NUMBER_OF_RDPCM_SIGNALLING_MODES; signallingModeIndex++)
     515    {
     516      m_acTEncTop[layer].setUseResidualDPCM                                ( RDPCMSignallingMode(signallingModeIndex), m_useResidualDPCM[signallingModeIndex]);
     517    }
     518    m_acTEncTop[layer].setUseConstrainedIntraPred                          ( m_bUseConstrainedIntraPred );
     519    m_acTEncTop[layer].setPCMLog2MinSize                                   ( m_uiPCMLog2MinSize);
     520    m_acTEncTop[layer].setUsePCM                                           ( m_usePCM );
     521    m_acTEncTop[layer].setPCMLog2MaxSize                                   ( m_pcmLog2MaxSize);
     522    m_acTEncTop[layer].setMaxNumMergeCand                                  ( m_maxNumMergeCand );
     523
     524
     525    //====== Weighted Prediction ========
     526    m_acTEncTop[layer].setUseWP                                            ( m_useWeightedPred      );
     527    m_acTEncTop[layer].setWPBiPred                                         ( m_useWeightedBiPred   );
    484528#if FAST_INTRA_SHVC
    485     m_acTEncTop[layer].setUseFastIntraScalable         ( m_useFastIntraScalable );
    486 #endif
    487 
    488     m_acTEncTop[layer].setUseTransformSkip             ( m_useTransformSkip      );
    489     m_acTEncTop[layer].setUseTransformSkipFast         ( m_useTransformSkipFast  );
    490     m_acTEncTop[layer].setUseConstrainedIntraPred      ( m_bUseConstrainedIntraPred );
    491     m_acTEncTop[layer].setPCMLog2MinSize               ( m_uiPCMLog2MinSize);
    492     m_acTEncTop[layer].setUsePCM                       ( m_usePCM );
    493     m_acTEncTop[layer].setPCMLog2MaxSize               ( m_pcmLog2MaxSize);
    494     m_acTEncTop[layer].setMaxNumMergeCand              ( m_maxNumMergeCand );
    495 
    496 
    497     //====== Weighted Prediction ========
    498     m_acTEncTop[layer].setUseWP                   ( m_useWeightedPred      );
    499     m_acTEncTop[layer].setWPBiPred                ( m_useWeightedBiPred   );
     529    m_acTEncTop[layer].setUseFastIntraScalable                             ( m_useFastIntraScalable );
     530#endif
    500531#if O0194_WEIGHTED_PREDICTION_CGS
    501532    if( layer != 0 && m_useInterLayerWeightedPred )
    502533    {
    503534      // Enable weighted prediction for enhancement layer
    504       m_acTEncTop[layer].setUseWP                 ( true   );
    505       m_acTEncTop[layer].setWPBiPred              ( true   );
     535      m_acTEncTop[layer].setUseWP                                           ( true   );
     536      m_acTEncTop[layer].setWPBiPred                                        ( true   );
    506537    }
    507538#endif
    508539    //====== Parallel Merge Estimation ========
    509     m_acTEncTop[layer].setLog2ParallelMergeLevelMinus2 ( m_log2ParallelMergeLevel - 2 );
     540    m_acTEncTop[layer].setLog2ParallelMergeLevelMinus2                      ( m_log2ParallelMergeLevel - 2 );
    510541
    511542    //====== Slice ========
    512     m_acTEncTop[layer].setSliceMode               ( m_sliceMode                );
    513     m_acTEncTop[layer].setSliceArgument           ( m_sliceArgument            );
     543    m_acTEncTop[layer].setSliceMode                                         ( (SliceConstraint) m_sliceMode );
     544    m_acTEncTop[layer].setSliceArgument                                     ( m_sliceArgument            );
    514545
    515546    //====== Dependent Slice ========
    516     m_acTEncTop[layer].setSliceSegmentMode        ( m_sliceSegmentMode         );
    517     m_acTEncTop[layer].setSliceSegmentArgument    ( m_sliceSegmentArgument     );
    518 #if LAYER_CTB
    519     Int iNumPartInCU = 1<<(m_acLayerCfg[layer].m_uiMaxCUDepth<<1);
    520 #else
    521     Int iNumPartInCU = 1<<(m_uiMaxCUDepth<<1);
    522 #endif
    523     if(m_sliceSegmentMode==FIXED_NUMBER_OF_LCU)
    524     {
    525       m_acTEncTop[layer].setSliceSegmentArgument ( m_sliceSegmentArgument * iNumPartInCU );
    526     }
    527     if(m_sliceMode==FIXED_NUMBER_OF_LCU)
    528     {
    529       m_acTEncTop[layer].setSliceArgument ( m_sliceArgument * iNumPartInCU );
    530     }
    531     if(m_sliceMode==FIXED_NUMBER_OF_TILES)
    532     {
    533       m_acTEncTop[layer].setSliceArgument ( m_sliceArgument );
    534     }
    535 
    536     if(m_sliceMode == 0 )
     547    m_acTEncTop[layer].setSliceSegmentMode                                  ( (SliceConstraint) m_sliceSegmentMode );
     548    m_acTEncTop[layer].setSliceSegmentArgument                              ( m_sliceSegmentArgument     );
     549
     550    if(m_sliceMode == NO_SLICES )
    537551    {
    538552      m_bLFCrossSliceBoundaryFlag = true;
    539553    }
    540     m_acTEncTop[layer].setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag );
    541     m_acTEncTop[layer].setUseSAO ( m_bUseSAO );
    542     m_acTEncTop[layer].setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic);
    543 
    544     m_acTEncTop[layer].setSaoLcuBoundary (m_saoLcuBoundary);
    545     m_acTEncTop[layer].setPCMInputBitDepthFlag  ( m_bPCMInputBitDepthFlag);
    546     m_acTEncTop[layer].setPCMFilterDisableFlag  ( m_bPCMFilterDisableFlag);
    547 
    548     m_acTEncTop[layer].setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled);
    549     m_acTEncTop[layer].setRecoveryPointSEIEnabled( m_recoveryPointSEIEnabled );
    550     m_acTEncTop[layer].setBufferingPeriodSEIEnabled( m_bufferingPeriodSEIEnabled );
    551     m_acTEncTop[layer].setPictureTimingSEIEnabled( m_pictureTimingSEIEnabled );
    552     m_acTEncTop[layer].setToneMappingInfoSEIEnabled                 ( m_toneMappingInfoSEIEnabled );
    553     m_acTEncTop[layer].setTMISEIToneMapId                           ( m_toneMapId );
    554     m_acTEncTop[layer].setTMISEIToneMapCancelFlag                   ( m_toneMapCancelFlag );
    555     m_acTEncTop[layer].setTMISEIToneMapPersistenceFlag              ( m_toneMapPersistenceFlag );
    556     m_acTEncTop[layer].setTMISEICodedDataBitDepth                   ( m_toneMapCodedDataBitDepth );
    557     m_acTEncTop[layer].setTMISEITargetBitDepth                      ( m_toneMapTargetBitDepth );
    558     m_acTEncTop[layer].setTMISEIModelID                             ( m_toneMapModelId );
    559     m_acTEncTop[layer].setTMISEIMinValue                            ( m_toneMapMinValue );
    560     m_acTEncTop[layer].setTMISEIMaxValue                            ( m_toneMapMaxValue );
    561     m_acTEncTop[layer].setTMISEISigmoidMidpoint                     ( m_sigmoidMidpoint );
    562     m_acTEncTop[layer].setTMISEISigmoidWidth                        ( m_sigmoidWidth );
    563     m_acTEncTop[layer].setTMISEIStartOfCodedInterva                 ( m_startOfCodedInterval );
    564     m_acTEncTop[layer].setTMISEINumPivots                           ( m_numPivots );
    565     m_acTEncTop[layer].setTMISEICodedPivotValue                     ( m_codedPivotValue );
    566     m_acTEncTop[layer].setTMISEITargetPivotValue                    ( m_targetPivotValue );
    567     m_acTEncTop[layer].setTMISEICameraIsoSpeedIdc                   ( m_cameraIsoSpeedIdc );
    568     m_acTEncTop[layer].setTMISEICameraIsoSpeedValue                 ( m_cameraIsoSpeedValue );
    569     m_acTEncTop[layer].setTMISEIExposureCompensationValueSignFlag   ( m_exposureCompensationValueSignFlag );
    570     m_acTEncTop[layer].setTMISEIExposureCompensationValueNumerator  ( m_exposureCompensationValueNumerator );
    571     m_acTEncTop[layer].setTMISEIExposureCompensationValueDenomIdc   ( m_exposureCompensationValueDenomIdc );
    572     m_acTEncTop[layer].setTMISEIRefScreenLuminanceWhite             ( m_refScreenLuminanceWhite );
    573     m_acTEncTop[layer].setTMISEIExtendedRangeWhiteLevel             ( m_extendedRangeWhiteLevel );
    574     m_acTEncTop[layer].setTMISEINominalBlackLevelLumaCodeValue      ( m_nominalBlackLevelLumaCodeValue );
    575     m_acTEncTop[layer].setTMISEINominalWhiteLevelLumaCodeValue      ( m_nominalWhiteLevelLumaCodeValue );
    576     m_acTEncTop[layer].setTMISEIExtendedWhiteLevelLumaCodeValue     ( m_extendedWhiteLevelLumaCodeValue );
    577 #if P0050_KNEE_FUNCTION_SEI
    578     m_acTEncTop[layer].setKneeSEIEnabled                            ( m_kneeSEIEnabled );
    579     m_acTEncTop[layer].setKneeSEIId                                 ( m_kneeSEIId );
    580     m_acTEncTop[layer].setKneeSEICancelFlag                         ( m_kneeSEICancelFlag );
    581     m_acTEncTop[layer].setKneeSEIPersistenceFlag                    ( m_kneeSEIPersistenceFlag );
    582     m_acTEncTop[layer].setKneeSEIMappingFlag                        ( m_kneeSEIMappingFlag );
    583     m_acTEncTop[layer].setKneeSEIInputDrange                        ( m_kneeSEIInputDrange );
    584     m_acTEncTop[layer].setKneeSEIInputDispLuminance                 ( m_kneeSEIInputDispLuminance );
    585     m_acTEncTop[layer].setKneeSEIOutputDrange                       ( m_kneeSEIOutputDrange );
    586     m_acTEncTop[layer].setKneeSEIOutputDispLuminance                ( m_kneeSEIOutputDispLuminance );
    587     m_acTEncTop[layer].setKneeSEINumKneePointsMinus1                ( m_kneeSEINumKneePointsMinus1 );
    588     m_acTEncTop[layer].setKneeSEIInputKneePoint                     ( m_kneeSEIInputKneePoint );
    589     m_acTEncTop[layer].setKneeSEIOutputKneePoint                    ( m_kneeSEIOutputKneePoint );
    590 #endif
     554
     555    m_acTEncTop[layer].setLFCrossSliceBoundaryFlag                          ( m_bLFCrossSliceBoundaryFlag );
     556    m_acTEncTop[layer].setUseSAO                                            ( m_bUseSAO );
     557    m_acTEncTop[layer].setMaxNumOffsetsPerPic                               ( m_maxNumOffsetsPerPic );
     558
     559    m_acTEncTop[layer].setSaoCtuBoundary                                    ( m_saoCtuBoundary );
     560    m_acTEncTop[layer].setPCMInputBitDepthFlag                              ( m_bPCMInputBitDepthFlag);
     561    m_acTEncTop[layer].setPCMFilterDisableFlag                              ( m_bPCMFilterDisableFlag);
     562
     563    m_acTEncTop[layer].setDisableIntraReferenceSmoothing                    (!m_enableIntraReferenceSmoothing );
     564    m_acTEncTop[layer].setDecodedPictureHashSEIEnabled                      ( m_decodedPictureHashSEIEnabled );
     565    m_acTEncTop[layer].setRecoveryPointSEIEnabled                           ( m_recoveryPointSEIEnabled );
     566    m_acTEncTop[layer].setBufferingPeriodSEIEnabled                         ( m_bufferingPeriodSEIEnabled );
     567    m_acTEncTop[layer].setPictureTimingSEIEnabled                           ( m_pictureTimingSEIEnabled );
     568    m_acTEncTop[layer].setToneMappingInfoSEIEnabled                         ( m_toneMappingInfoSEIEnabled );
     569    m_acTEncTop[layer].setTMISEIToneMapId                                   ( m_toneMapId );
     570    m_acTEncTop[layer].setTMISEIToneMapCancelFlag                           ( m_toneMapCancelFlag );
     571    m_acTEncTop[layer].setTMISEIToneMapPersistenceFlag                      ( m_toneMapPersistenceFlag );
     572    m_acTEncTop[layer].setTMISEICodedDataBitDepth                           ( m_toneMapCodedDataBitDepth );
     573    m_acTEncTop[layer].setTMISEITargetBitDepth                              ( m_toneMapTargetBitDepth );
     574    m_acTEncTop[layer].setTMISEIModelID                                     ( m_toneMapModelId );
     575    m_acTEncTop[layer].setTMISEIMinValue                                    ( m_toneMapMinValue );
     576    m_acTEncTop[layer].setTMISEIMaxValue                                    ( m_toneMapMaxValue );
     577    m_acTEncTop[layer].setTMISEISigmoidMidpoint                             ( m_sigmoidMidpoint );
     578    m_acTEncTop[layer].setTMISEISigmoidWidth                                ( m_sigmoidWidth );
     579    m_acTEncTop[layer].setTMISEIStartOfCodedInterva                         ( m_startOfCodedInterval );
     580    m_acTEncTop[layer].setTMISEINumPivots                                   ( m_numPivots );
     581    m_acTEncTop[layer].setTMISEICodedPivotValue                             ( m_codedPivotValue );
     582    m_acTEncTop[layer].setTMISEITargetPivotValue                            ( m_targetPivotValue );
     583    m_acTEncTop[layer].setTMISEICameraIsoSpeedIdc                           ( m_cameraIsoSpeedIdc );
     584    m_acTEncTop[layer].setTMISEICameraIsoSpeedValue                         ( m_cameraIsoSpeedValue );
     585    m_acTEncTop[layer].setTMISEIExposureIndexIdc                            ( m_exposureIndexIdc );
     586    m_acTEncTop[layer].setTMISEIExposureIndexValue                          ( m_exposureIndexValue );
     587    m_acTEncTop[layer].setTMISEIExposureCompensationValueSignFlag           ( m_exposureCompensationValueSignFlag );
     588    m_acTEncTop[layer].setTMISEIExposureCompensationValueNumerator          ( m_exposureCompensationValueNumerator );
     589    m_acTEncTop[layer].setTMISEIExposureCompensationValueDenomIdc           ( m_exposureCompensationValueDenomIdc );
     590    m_acTEncTop[layer].setTMISEIRefScreenLuminanceWhite                     ( m_refScreenLuminanceWhite );
     591    m_acTEncTop[layer].setTMISEIExtendedRangeWhiteLevel                     ( m_extendedRangeWhiteLevel );
     592    m_acTEncTop[layer].setTMISEINominalBlackLevelLumaCodeValue              ( m_nominalBlackLevelLumaCodeValue );
     593    m_acTEncTop[layer].setTMISEINominalWhiteLevelLumaCodeValue              ( m_nominalWhiteLevelLumaCodeValue );
     594    m_acTEncTop[layer].setTMISEIExtendedWhiteLevelLumaCodeValue             ( m_extendedWhiteLevelLumaCodeValue );
     595    m_acTEncTop[layer].setChromaSamplingFilterHintEnabled                   ( m_chromaSamplingFilterSEIenabled );
     596    m_acTEncTop[layer].setChromaSamplingHorFilterIdc                        ( m_chromaSamplingHorFilterIdc );
     597    m_acTEncTop[layer].setChromaSamplingVerFilterIdc                        ( m_chromaSamplingVerFilterIdc );
     598    m_acTEncTop[layer].setFramePackingArrangementSEIEnabled                 ( m_framePackingSEIEnabled );
     599    m_acTEncTop[layer].setFramePackingArrangementSEIType                    ( m_framePackingSEIType );
     600    m_acTEncTop[layer].setFramePackingArrangementSEIId                      ( m_framePackingSEIId );
     601    m_acTEncTop[layer].setFramePackingArrangementSEIQuincunx                ( m_framePackingSEIQuincunx );
     602    m_acTEncTop[layer].setFramePackingArrangementSEIInterpretation          ( m_framePackingSEIInterpretation );
     603    m_acTEncTop[layer].setSegmentedRectFramePackingArrangementSEIEnabled    ( m_segmentedRectFramePackingSEIEnabled );
     604    m_acTEncTop[layer].setSegmentedRectFramePackingArrangementSEICancel     ( m_segmentedRectFramePackingSEICancel );
     605    m_acTEncTop[layer].setSegmentedRectFramePackingArrangementSEIType       ( m_segmentedRectFramePackingSEIType );
     606    m_acTEncTop[layer].setSegmentedRectFramePackingArrangementSEIPersistence( m_segmentedRectFramePackingSEIPersistence );
     607    m_acTEncTop[layer].setDisplayOrientationSEIAngle                        ( m_displayOrientationSEIAngle );
     608    m_acTEncTop[layer].setTemporalLevel0IndexSEIEnabled                     ( m_temporalLevel0IndexSEIEnabled );
     609    m_acTEncTop[layer].setGradualDecodingRefreshInfoEnabled                 ( m_gradualDecodingRefreshInfoEnabled );
     610    m_acTEncTop[layer].setNoDisplaySEITLayer                                ( m_noDisplaySEITLayer );
     611    m_acTEncTop[layer].setDecodingUnitInfoSEIEnabled                        ( m_decodingUnitInfoSEIEnabled );
     612    m_acTEncTop[layer].setSOPDescriptionSEIEnabled                          ( m_SOPDescriptionSEIEnabled );
     613    m_acTEncTop[layer].setScalableNestingSEIEnabled                         ( m_scalableNestingSEIEnabled );
     614    m_acTEncTop[layer].setTMCTSSEIEnabled                                   ( m_tmctsSEIEnabled );
     615    m_acTEncTop[layer].setTimeCodeSEIEnabled                                ( m_timeCodeSEIEnabled );
     616    m_acTEncTop[layer].setNumberOfTimeSets                                  ( m_timeCodeSEINumTs );
     617    for(Int i = 0; i < m_timeCodeSEINumTs; i++) { m_acTEncTop[layer].setTimeSet(m_timeSetArray[i], i); }
     618    m_acTEncTop[layer].setKneeSEIEnabled                                    ( m_kneeSEIEnabled );
     619    m_acTEncTop[layer].setKneeSEIId                                         ( m_kneeSEIId );
     620    m_acTEncTop[layer].setKneeSEICancelFlag                                 ( m_kneeSEICancelFlag );
     621    m_acTEncTop[layer].setKneeSEIPersistenceFlag                            ( m_kneeSEIPersistenceFlag );   
     622    m_acTEncTop[layer].setKneeSEIInputDrange                                ( m_kneeSEIInputDrange );
     623    m_acTEncTop[layer].setKneeSEIInputDispLuminance                         ( m_kneeSEIInputDispLuminance );
     624    m_acTEncTop[layer].setKneeSEIOutputDrange                               ( m_kneeSEIOutputDrange );
     625    m_acTEncTop[layer].setKneeSEIOutputDispLuminance                        ( m_kneeSEIOutputDispLuminance );
     626    m_acTEncTop[layer].setKneeSEINumKneePointsMinus1                        ( m_kneeSEINumKneePointsMinus1 );
     627    m_acTEncTop[layer].setKneeSEIInputKneePoint                             ( m_kneeSEIInputKneePoint );
     628    m_acTEncTop[layer].setKneeSEIOutputKneePoint                            ( m_kneeSEIOutputKneePoint );
     629    m_acTEncTop[layer].setMasteringDisplaySEI                               ( m_masteringDisplay );
    591630#if Q0096_OVERLAY_SEI
    592     m_acTEncTop[layer].setOverlaySEIEnabled                         ( m_overlaySEIEnabled );
    593     m_acTEncTop[layer].setOverlaySEICancelFlag                      ( m_overlayInfoCancelFlag );
    594     m_acTEncTop[layer].setOverlaySEIContentAuxIdMinus128            ( m_overlayContentAuxIdMinus128 );
    595     m_acTEncTop[layer].setOverlaySEILabelAuxIdMinus128              ( m_overlayLabelAuxIdMinus128 );
    596     m_acTEncTop[layer].setOverlaySEIAlphaAuxIdMinus128              ( m_overlayAlphaAuxIdMinus128 );
    597     m_acTEncTop[layer].setOverlaySEIElementLabelValueLengthMinus8   ( m_overlayElementLabelValueLengthMinus8 );
    598     m_acTEncTop[layer].setOverlaySEINumOverlaysMinus1               ( m_numOverlaysMinus1 );
    599     m_acTEncTop[layer].setOverlaySEIIdx                             ( m_overlayIdx );
    600     m_acTEncTop[layer].setOverlaySEILanguagePresentFlag             ( m_overlayLanguagePresentFlag );
    601     m_acTEncTop[layer].setOverlaySEIContentLayerId                  ( m_overlayContentLayerId );
    602     m_acTEncTop[layer].setOverlaySEILabelPresentFlag                ( m_overlayLabelPresentFlag );
    603     m_acTEncTop[layer].setOverlaySEILabelLayerId                    ( m_overlayLabelLayerId );
    604     m_acTEncTop[layer].setOverlaySEIAlphaPresentFlag                ( m_overlayAlphaPresentFlag );
    605     m_acTEncTop[layer].setOverlaySEIAlphaLayerId                    ( m_overlayAlphaLayerId );
    606     m_acTEncTop[layer].setOverlaySEINumElementsMinus1               ( m_numOverlayElementsMinus1 );
    607     m_acTEncTop[layer].setOverlaySEIElementLabelMin                 ( m_overlayElementLabelMin );
    608     m_acTEncTop[layer].setOverlaySEIElementLabelMax                 ( m_overlayElementLabelMax );
    609     m_acTEncTop[layer].setOverlaySEILanguage                        ( m_overlayLanguage );
    610     m_acTEncTop[layer].setOverlaySEIName                            ( m_overlayName );
    611     m_acTEncTop[layer].setOverlaySEIElementName                     ( m_overlayElementName );
    612     m_acTEncTop[layer].setOverlaySEIPersistenceFlag                 ( m_overlayInfoPersistenceFlag );
     631    m_acTEncTop[layer].setOverlaySEIEnabled                                 ( m_overlaySEIEnabled );
     632    m_acTEncTop[layer].setOverlaySEICancelFlag                              ( m_overlayInfoCancelFlag );
     633    m_acTEncTop[layer].setOverlaySEIContentAuxIdMinus128                    ( m_overlayContentAuxIdMinus128 );
     634    m_acTEncTop[layer].setOverlaySEILabelAuxIdMinus128                      ( m_overlayLabelAuxIdMinus128 );
     635    m_acTEncTop[layer].setOverlaySEIAlphaAuxIdMinus128                      ( m_overlayAlphaAuxIdMinus128 );
     636    m_acTEncTop[layer].setOverlaySEIElementLabelValueLengthMinus8           ( m_overlayElementLabelValueLengthMinus8 );
     637    m_acTEncTop[layer].setOverlaySEINumOverlaysMinus1                       ( m_numOverlaysMinus1 );
     638    m_acTEncTop[layer].setOverlaySEIIdx                                     ( m_overlayIdx );
     639    m_acTEncTop[layer].setOverlaySEILanguagePresentFlag                     ( m_overlayLanguagePresentFlag );
     640    m_acTEncTop[layer].setOverlaySEIContentLayerId                          ( m_overlayContentLayerId );
     641    m_acTEncTop[layer].setOverlaySEILabelPresentFlag                        ( m_overlayLabelPresentFlag );
     642    m_acTEncTop[layer].setOverlaySEILabelLayerId                            ( m_overlayLabelLayerId );
     643    m_acTEncTop[layer].setOverlaySEIAlphaPresentFlag                        ( m_overlayAlphaPresentFlag );
     644    m_acTEncTop[layer].setOverlaySEIAlphaLayerId                            ( m_overlayAlphaLayerId );
     645    m_acTEncTop[layer].setOverlaySEINumElementsMinus1                       ( m_numOverlayElementsMinus1 );
     646    m_acTEncTop[layer].setOverlaySEIElementLabelMin                         ( m_overlayElementLabelMin );
     647    m_acTEncTop[layer].setOverlaySEIElementLabelMax                         ( m_overlayElementLabelMax );
     648    m_acTEncTop[layer].setOverlaySEILanguage                                ( m_overlayLanguage );
     649    m_acTEncTop[layer].setOverlaySEIName                                    ( m_overlayName );
     650    m_acTEncTop[layer].setOverlaySEIElementName                             ( m_overlayElementName );
     651    m_acTEncTop[layer].setOverlaySEIPersistenceFlag                         ( m_overlayInfoPersistenceFlag );
    613652#endif
    614653#if Q0074_COLOUR_REMAPPING_SEI
    615     m_acTEncTop[layer].setCRISEIFile                                ( const_cast<Char*>(m_acLayerCfg[layer].m_colourRemapSEIFile.c_str()) );
    616     m_acTEncTop[layer].setCRISEIId                                  ( m_acLayerCfg[layer].m_colourRemapSEIId );
    617     m_acTEncTop[layer].setCRISEICancelFlag                          ( m_acLayerCfg[layer].m_colourRemapSEICancelFlag );
    618     m_acTEncTop[layer].setCRISEIPersistenceFlag                     ( m_acLayerCfg[layer].m_colourRemapSEIPersistenceFlag );
    619     m_acTEncTop[layer].setCRISEIVideoSignalInfoPresentFlag          ( m_acLayerCfg[layer].m_colourRemapSEIVideoSignalInfoPresentFlag );
    620     m_acTEncTop[layer].setCRISEIFullRangeFlag                       ( m_acLayerCfg[layer].m_colourRemapSEIFullRangeFlag );
    621     m_acTEncTop[layer].setCRISEIPrimaries                           ( m_acLayerCfg[layer].m_colourRemapSEIPrimaries );
    622     m_acTEncTop[layer].setCRISEITransferFunction                    ( m_acLayerCfg[layer].m_colourRemapSEITransferFunction );
    623     m_acTEncTop[layer].setCRISEIMatrixCoefficients                  ( m_acLayerCfg[layer].m_colourRemapSEIMatrixCoefficients );
    624     m_acTEncTop[layer].setCRISEIInputBitDepth                       ( m_acLayerCfg[layer].m_colourRemapSEIInputBitDepth );
    625     m_acTEncTop[layer].setCRISEIBitDepth                            ( m_acLayerCfg[layer].m_colourRemapSEIBitDepth );
    626     m_acTEncTop[layer].setCRISEIPreLutNumValMinus1                  ( m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1 );
    627     m_acTEncTop[layer].setCRISEIPreLutCodedValue                    ( m_acLayerCfg[layer].m_colourRemapSEIPreLutCodedValue );
    628     m_acTEncTop[layer].setCRISEIPreLutTargetValue                   ( m_acLayerCfg[layer].m_colourRemapSEIPreLutTargetValue );
    629     m_acTEncTop[layer].setCRISEIMatrixPresentFlag                   ( m_acLayerCfg[layer].m_colourRemapSEIMatrixPresentFlag );
    630     m_acTEncTop[layer].setCRISEILog2MatrixDenom                     ( m_acLayerCfg[layer].m_colourRemapSEILog2MatrixDenom );
    631     m_acTEncTop[layer].setCRISEICoeffs                              ( m_acLayerCfg[layer].m_colourRemapSEICoeffs );
    632     m_acTEncTop[layer].setCRISEIPostLutNumValMinus1                 ( m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1 );
    633     m_acTEncTop[layer].setCRISEIPostLutCodedValue                   ( m_acLayerCfg[layer]. m_colourRemapSEIPostLutCodedValue );
    634     m_acTEncTop[layer].setCRISEIPostLutTargetValue                  ( m_acLayerCfg[layer].m_colourRemapSEIPostLutTargetValue );
    635 #endif
    636     m_acTEncTop[layer].setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled );
    637     m_acTEncTop[layer].setFramePackingArrangementSEIType( m_framePackingSEIType );
    638     m_acTEncTop[layer].setFramePackingArrangementSEIId( m_framePackingSEIId );
    639     m_acTEncTop[layer].setFramePackingArrangementSEIQuincunx( m_framePackingSEIQuincunx );
    640     m_acTEncTop[layer].setFramePackingArrangementSEIInterpretation( m_framePackingSEIInterpretation );
    641     m_acTEncTop[layer].setDisplayOrientationSEIAngle( m_displayOrientationSEIAngle );
    642     m_acTEncTop[layer].setTemporalLevel0IndexSEIEnabled( m_temporalLevel0IndexSEIEnabled );
    643     m_acTEncTop[layer].setGradualDecodingRefreshInfoEnabled( m_gradualDecodingRefreshInfoEnabled );
    644     m_acTEncTop[layer].setDecodingUnitInfoSEIEnabled( m_decodingUnitInfoSEIEnabled );
     654    m_acTEncTop[layer].setCRISEIFile                            ( const_cast<Char*>(m_acLayerCfg[layer].m_colourRemapSEIFile.c_str()) );
     655    m_acTEncTop[layer].setCRISEIId                              ( m_acLayerCfg[layer].m_colourRemapSEIId );
     656    m_acTEncTop[layer].setCRISEICancelFlag                      ( m_acLayerCfg[layer].m_colourRemapSEICancelFlag );
     657    m_acTEncTop[layer].setCRISEIPersistenceFlag                 ( m_acLayerCfg[layer].m_colourRemapSEIPersistenceFlag );
     658    m_acTEncTop[layer].setCRISEIVideoSignalInfoPresentFlag      ( m_acLayerCfg[layer].m_colourRemapSEIVideoSignalInfoPresentFlag );
     659    m_acTEncTop[layer].setCRISEIFullRangeFlag                   ( m_acLayerCfg[layer].m_colourRemapSEIFullRangeFlag );
     660    m_acTEncTop[layer].setCRISEIPrimaries                       ( m_acLayerCfg[layer].m_colourRemapSEIPrimaries );
     661    m_acTEncTop[layer].setCRISEITransferFunction                ( m_acLayerCfg[layer].m_colourRemapSEITransferFunction );
     662    m_acTEncTop[layer].setCRISEIMatrixCoefficients              ( m_acLayerCfg[layer].m_colourRemapSEIMatrixCoefficients );
     663    m_acTEncTop[layer].setCRISEIInputBitDepth                   ( m_acLayerCfg[layer].m_colourRemapSEIInputBitDepth );
     664    m_acTEncTop[layer].setCRISEIBitDepth                        ( m_acLayerCfg[layer].m_colourRemapSEIBitDepth );
     665    m_acTEncTop[layer].setCRISEIPreLutNumValMinus1              ( m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1 );
     666    m_acTEncTop[layer].setCRISEIPreLutCodedValue                ( m_acLayerCfg[layer].m_colourRemapSEIPreLutCodedValue );
     667    m_acTEncTop[layer].setCRISEIPreLutTargetValue               ( m_acLayerCfg[layer].m_colourRemapSEIPreLutTargetValue );
     668    m_acTEncTop[layer].setCRISEIMatrixPresentFlag               ( m_acLayerCfg[layer].m_colourRemapSEIMatrixPresentFlag );
     669    m_acTEncTop[layer].setCRISEILog2MatrixDenom                 ( m_acLayerCfg[layer].m_colourRemapSEILog2MatrixDenom );
     670    m_acTEncTop[layer].setCRISEICoeffs                          ( m_acLayerCfg[layer].m_colourRemapSEICoeffs );
     671    m_acTEncTop[layer].setCRISEIPostLutNumValMinus1             ( m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1 );
     672    m_acTEncTop[layer].setCRISEIPostLutCodedValue               ( m_acLayerCfg[layer]. m_colourRemapSEIPostLutCodedValue );
     673    m_acTEncTop[layer].setCRISEIPostLutTargetValue              ( m_acLayerCfg[layer].m_colourRemapSEIPostLutTargetValue );
     674#endif   
    645675#if LAYERS_NOT_PRESENT_SEI
    646     m_acTEncTop[layer].setLayersNotPresentSEIEnabled( m_layersNotPresentSEIEnabled );
    647 #endif
    648     m_acTEncTop[layer].setSOPDescriptionSEIEnabled( m_SOPDescriptionSEIEnabled );
    649     m_acTEncTop[layer].setScalableNestingSEIEnabled( m_scalableNestingSEIEnabled );
     676    m_acTEncTop[layer].setLayersNotPresentSEIEnabled            ( m_layersNotPresentSEIEnabled );
     677#endif   
    650678#if Q0189_TMVP_CONSTRAINTS
    651     m_acTEncTop[layer].setTMVPConstraintsSEIEnabled( m_TMVPConstraintsSEIEnabled);           
     679    m_acTEncTop[layer].setTMVPConstraintsSEIEnabled             ( m_TMVPConstraintsSEIEnabled);           
    652680#endif
    653681#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
    654682    m_acTEncTop[layer].setInterLayerConstrainedTileSetsSEIEnabled( m_interLayerConstrainedTileSetsSEIEnabled );
    655     m_acTEncTop[layer].setIlNumSetsInMessage( m_ilNumSetsInMessage );
    656     m_acTEncTop[layer].setSkippedTileSetPresentFlag( m_skippedTileSetPresentFlag );
    657     m_acTEncTop[layer].setTopLeftTileIndex( m_topLeftTileIndex );
    658     m_acTEncTop[layer].setBottomRightTileIndex( m_bottomRightTileIndex );
    659     m_acTEncTop[layer].setIlcIdc( m_ilcIdc );
    660 #endif
    661     m_acTEncTop[layer].setTileUniformSpacingFlag     ( m_tileUniformSpacingFlag );
    662     m_acTEncTop[layer].setNumColumnsMinus1           ( m_numTileColumnsMinus1 );
    663     m_acTEncTop[layer].setNumRowsMinus1              ( m_numTileRowsMinus1 );
     683    m_acTEncTop[layer].setIlNumSetsInMessage                    ( m_ilNumSetsInMessage );
     684    m_acTEncTop[layer].setSkippedTileSetPresentFlag             ( m_skippedTileSetPresentFlag );
     685    m_acTEncTop[layer].setTopLeftTileIndex                      ( m_topLeftTileIndex );
     686    m_acTEncTop[layer].setBottomRightTileIndex                  ( m_bottomRightTileIndex );
     687    m_acTEncTop[layer].setIlcIdc                                ( m_ilcIdc );
     688#endif
     689    m_acTEncTop[layer].setTileUniformSpacingFlag                ( m_tileUniformSpacingFlag );
     690    m_acTEncTop[layer].setNumColumnsMinus1                      ( m_numTileColumnsMinus1 );
     691    m_acTEncTop[layer].setNumRowsMinus1                         ( m_numTileRowsMinus1 );
    664692    if(!m_tileUniformSpacingFlag)
    665693    {
    666       m_acTEncTop[layer].setColumnWidth              ( m_tileColumnWidth );
    667       m_acTEncTop[layer].setRowHeight                ( m_tileRowHeight );
     694      m_acTEncTop[layer].setColumnWidth                         ( m_tileColumnWidth );
     695      m_acTEncTop[layer].setRowHeight                           ( m_tileRowHeight );
    668696    }
    669697    m_acTEncTop[layer].xCheckGSParameters();
     
    673701      m_bLFCrossTileBoundaryFlag = true;
    674702    }
    675     m_acTEncTop[layer].setLFCrossTileBoundaryFlag( m_bLFCrossTileBoundaryFlag );
    676     m_acTEncTop[layer].setWaveFrontSynchro           ( m_acLayerCfg[layer].m_waveFrontSynchro );
    677     m_acTEncTop[layer].setWaveFrontSubstreams        ( m_acLayerCfg[layer].m_iWaveFrontSubstreams );
    678     m_acTEncTop[layer].setTMVPModeId ( m_TMVPModeId );
    679     m_acTEncTop[layer].setUseScalingListId           ( m_useScalingListId  );
    680     m_acTEncTop[layer].setScalingListFile            ( m_scalingListFile   );
    681     m_acTEncTop[layer].setSignHideFlag(m_signHideFlag);
     703    m_acTEncTop[layer].setLFCrossTileBoundaryFlag               ( m_bLFCrossTileBoundaryFlag );
     704    m_acTEncTop[layer].setWaveFrontSynchro                      ( m_acLayerCfg[layer].m_waveFrontSynchro );
     705    m_acTEncTop[layer].setWaveFrontSubstreams                   ( m_acLayerCfg[layer].m_iWaveFrontSubstreams );
     706    m_acTEncTop[layer].setTMVPModeId                            ( m_TMVPModeId );
     707    m_acTEncTop[layer].setUseScalingListId                      ( m_useScalingListId  );
     708    m_acTEncTop[layer].setScalingListFile                       ( m_scalingListFile   );
     709    m_acTEncTop[layer].setSignHideFlag                          ( m_signHideFlag );
    682710#if RC_SHVC_HARMONIZATION
    683     m_acTEncTop[layer].setUseRateCtrl     (m_acLayerCfg[layer].getRCEnableRateControl());
    684     m_acTEncTop[layer].setTargetBitrate   (m_acLayerCfg[layer].getRCTargetBitrate());
    685     m_acTEncTop[layer].setKeepHierBit     (m_acLayerCfg[layer].getRCKeepHierarchicalBit());
    686     m_acTEncTop[layer].setLCULevelRC      (m_acLayerCfg[layer].getRCLCULevelRC());
    687     m_acTEncTop[layer].setUseLCUSeparateModel (m_acLayerCfg[layer].getRCUseLCUSeparateModel());
    688     m_acTEncTop[layer].setInitialQP           (m_acLayerCfg[layer].getRCInitialQP());
    689     m_acTEncTop[layer].setForceIntraQP        (m_acLayerCfg[layer].getRCForceIntraQP());
    690 #else
    691     m_acTEncTop[layer].setUseRateCtrl         ( m_RCEnableRateControl );
    692     m_acTEncTop[layer].setTargetBitrate       ( m_RCTargetBitrate );
    693     m_acTEncTop[layer].setKeepHierBit         ( m_RCKeepHierarchicalBit );
    694     m_acTEncTop[layer].setLCULevelRC          ( m_RCLCULevelRC );
    695     m_acTEncTop[layer].setUseLCUSeparateModel ( m_RCUseLCUSeparateModel );
    696     m_acTEncTop[layer].setInitialQP           ( m_RCInitialQP );
    697     m_acTEncTop[layer].setForceIntraQP        ( m_RCForceIntraQP );
    698 #endif
    699     m_acTEncTop[layer].setTransquantBypassEnableFlag(m_TransquantBypassEnableFlag);
    700     m_acTEncTop[layer].setCUTransquantBypassFlagForceValue(m_CUTransquantBypassFlagForce);
    701     m_acTEncTop[layer].setUseRecalculateQPAccordingToLambda( m_recalculateQPAccordingToLambda );
    702     m_acTEncTop[layer].setUseStrongIntraSmoothing( m_useStrongIntraSmoothing );
    703     m_acTEncTop[layer].setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled );
    704     m_acTEncTop[layer].setVuiParametersPresentFlag( m_vuiParametersPresentFlag );
    705     m_acTEncTop[layer].setAspectRatioInfoPresentFlag( m_aspectRatioInfoPresentFlag);
    706     m_acTEncTop[layer].setAspectRatioIdc( m_aspectRatioIdc );
    707     m_acTEncTop[layer].setSarWidth( m_sarWidth );
    708     m_acTEncTop[layer].setSarHeight( m_sarHeight );
    709     m_acTEncTop[layer].setOverscanInfoPresentFlag( m_overscanInfoPresentFlag );
    710     m_acTEncTop[layer].setOverscanAppropriateFlag( m_overscanAppropriateFlag );
    711     m_acTEncTop[layer].setVideoSignalTypePresentFlag( m_videoSignalTypePresentFlag );
    712     m_acTEncTop[layer].setVideoFormat( m_videoFormat );
    713     m_acTEncTop[layer].setVideoFullRangeFlag( m_videoFullRangeFlag );
    714     m_acTEncTop[layer].setColourDescriptionPresentFlag( m_colourDescriptionPresentFlag );
    715     m_acTEncTop[layer].setColourPrimaries( m_colourPrimaries );
    716     m_acTEncTop[layer].setTransferCharacteristics( m_transferCharacteristics );
    717     m_acTEncTop[layer].setMatrixCoefficients( m_matrixCoefficients );
    718     m_acTEncTop[layer].setChromaLocInfoPresentFlag( m_chromaLocInfoPresentFlag );
    719     m_acTEncTop[layer].setChromaSampleLocTypeTopField( m_chromaSampleLocTypeTopField );
    720     m_acTEncTop[layer].setChromaSampleLocTypeBottomField( m_chromaSampleLocTypeBottomField );
    721     m_acTEncTop[layer].setNeutralChromaIndicationFlag( m_neutralChromaIndicationFlag );
    722     m_acTEncTop[layer].setDefaultDisplayWindow( m_defDispWinLeftOffset, m_defDispWinRightOffset, m_defDispWinTopOffset, m_defDispWinBottomOffset );
    723     m_acTEncTop[layer].setFrameFieldInfoPresentFlag( m_frameFieldInfoPresentFlag );
    724     m_acTEncTop[layer].setPocProportionalToTimingFlag( m_pocProportionalToTimingFlag );
    725     m_acTEncTop[layer].setNumTicksPocDiffOneMinus1   ( m_numTicksPocDiffOneMinus1    );
    726     m_acTEncTop[layer].setBitstreamRestrictionFlag( m_bitstreamRestrictionFlag );
    727     m_acTEncTop[layer].setTilesFixedStructureFlag( m_tilesFixedStructureFlag );
    728     m_acTEncTop[layer].setMotionVectorsOverPicBoundariesFlag( m_motionVectorsOverPicBoundariesFlag );
    729     m_acTEncTop[layer].setMinSpatialSegmentationIdc( m_minSpatialSegmentationIdc );
    730     m_acTEncTop[layer].setMaxBytesPerPicDenom( m_maxBytesPerPicDenom );
    731     m_acTEncTop[layer].setMaxBitsPerMinCuDenom( m_maxBitsPerMinCuDenom );
    732     m_acTEncTop[layer].setLog2MaxMvLengthHorizontal( m_log2MaxMvLengthHorizontal );
    733     m_acTEncTop[layer].setLog2MaxMvLengthVertical( m_log2MaxMvLengthVertical );
    734     m_acTEncTop[layer].setElRapSliceTypeB(layer == 0? 0 : m_elRapSliceBEnabled);
     711    m_acTEncTop[layer].setUseRateCtrl                           ( m_acLayerCfg[layer].getRCEnableRateControl() );
     712    m_acTEncTop[layer].setTargetBitrate                         ( m_acLayerCfg[layer].getRCTargetBitrate() );
     713    m_acTEncTop[layer].setKeepHierBit                           ( m_acLayerCfg[layer].getRCKeepHierarchicalBit() );
     714    m_acTEncTop[layer].setLCULevelRC                            ( m_acLayerCfg[layer].getRCLCULevelRC() );
     715    m_acTEncTop[layer].setUseLCUSeparateModel                   ( m_acLayerCfg[layer].getRCUseLCUSeparateModel() );
     716    m_acTEncTop[layer].setInitialQP                             ( m_acLayerCfg[layer].getRCInitialQP() );
     717    m_acTEncTop[layer].setForceIntraQP                          ( m_acLayerCfg[layer].getRCForceIntraQP() );
     718#else
     719    m_acTEncTop[layer].setUseRateCtrl                           ( m_RCEnableRateControl );
     720    m_acTEncTop[layer].setTargetBitrate                         ( m_RCTargetBitrate );
     721    m_acTEncTop[layer].setKeepHierBit                           ( m_RCKeepHierarchicalBit );
     722    m_acTEncTop[layer].setLCULevelRC                            ( m_RCLCULevelRC );
     723    m_acTEncTop[layer].setUseLCUSeparateModel                   ( m_RCUseLCUSeparateModel );
     724    m_acTEncTop[layer].setInitialQP                             ( m_RCInitialQP );
     725    m_acTEncTop[layer].setForceIntraQP                          ( m_RCForceIntraQP );
     726#endif
     727    m_acTEncTop[layer].setTransquantBypassEnableFlag            ( m_TransquantBypassEnableFlag );
     728    m_acTEncTop[layer].setCUTransquantBypassFlagForceValue      ( m_CUTransquantBypassFlagForce );
     729    m_acTEncTop[layer].setCostMode                              ( m_costMode );
     730    m_acTEncTop[layer].setUseRecalculateQPAccordingToLambda     ( m_recalculateQPAccordingToLambda );
     731    m_acTEncTop[layer].setUseStrongIntraSmoothing               ( m_useStrongIntraSmoothing );
     732    m_acTEncTop[layer].setActiveParameterSetsSEIEnabled         ( m_activeParameterSetsSEIEnabled );
     733    m_acTEncTop[layer].setVuiParametersPresentFlag              ( m_vuiParametersPresentFlag );
     734    m_acTEncTop[layer].setAspectRatioInfoPresentFlag            ( m_aspectRatioInfoPresentFlag);
     735    m_acTEncTop[layer].setAspectRatioIdc                        ( m_aspectRatioIdc );
     736    m_acTEncTop[layer].setSarWidth                              ( m_sarWidth );
     737    m_acTEncTop[layer].setSarHeight                             ( m_sarHeight );
     738    m_acTEncTop[layer].setOverscanInfoPresentFlag               ( m_overscanInfoPresentFlag );
     739    m_acTEncTop[layer].setOverscanAppropriateFlag               ( m_overscanAppropriateFlag );
     740    m_acTEncTop[layer].setVideoSignalTypePresentFlag            ( m_videoSignalTypePresentFlag );
     741    m_acTEncTop[layer].setVideoFormat                           ( m_videoFormat );
     742    m_acTEncTop[layer].setVideoFullRangeFlag                    ( m_videoFullRangeFlag );
     743    m_acTEncTop[layer].setColourDescriptionPresentFlag          ( m_colourDescriptionPresentFlag );
     744    m_acTEncTop[layer].setColourPrimaries                       ( m_colourPrimaries );
     745    m_acTEncTop[layer].setTransferCharacteristics               ( m_transferCharacteristics );
     746    m_acTEncTop[layer].setMatrixCoefficients                    ( m_matrixCoefficients );
     747    m_acTEncTop[layer].setChromaLocInfoPresentFlag              ( m_chromaLocInfoPresentFlag );
     748    m_acTEncTop[layer].setChromaSampleLocTypeTopField           ( m_chromaSampleLocTypeTopField );
     749    m_acTEncTop[layer].setChromaSampleLocTypeBottomField        ( m_chromaSampleLocTypeBottomField );
     750    m_acTEncTop[layer].setNeutralChromaIndicationFlag           ( m_neutralChromaIndicationFlag );
     751    m_acTEncTop[layer].setDefaultDisplayWindow                  ( m_defDispWinLeftOffset, m_defDispWinRightOffset, m_defDispWinTopOffset, m_defDispWinBottomOffset );
     752    m_acTEncTop[layer].setFrameFieldInfoPresentFlag             ( m_frameFieldInfoPresentFlag );
     753    m_acTEncTop[layer].setPocProportionalToTimingFlag           ( m_pocProportionalToTimingFlag );
     754    m_acTEncTop[layer].setNumTicksPocDiffOneMinus1              ( m_numTicksPocDiffOneMinus1    );
     755    m_acTEncTop[layer].setBitstreamRestrictionFlag              ( m_bitstreamRestrictionFlag );
     756    m_acTEncTop[layer].setTilesFixedStructureFlag               ( m_tilesFixedStructureFlag );
     757    m_acTEncTop[layer].setMotionVectorsOverPicBoundariesFlag    ( m_motionVectorsOverPicBoundariesFlag );
     758    m_acTEncTop[layer].setMinSpatialSegmentationIdc             ( m_minSpatialSegmentationIdc );
     759    m_acTEncTop[layer].setMaxBytesPerPicDenom                   ( m_maxBytesPerPicDenom );
     760    m_acTEncTop[layer].setMaxBitsPerMinCuDenom                  ( m_maxBitsPerMinCuDenom );
     761    m_acTEncTop[layer].setLog2MaxMvLengthHorizontal             ( m_log2MaxMvLengthHorizontal );
     762    m_acTEncTop[layer].setLog2MaxMvLengthVertical               ( m_log2MaxMvLengthVertical );
     763    m_acTEncTop[layer].setElRapSliceTypeB                       (layer == 0? 0 : m_elRapSliceBEnabled);
    735764    if( layer > 0 )
    736765    {
     
    745774#endif
    746775#endif
    747       m_acTEncTop[layer].setNumScaledRefLayerOffsets( m_acLayerCfg[layer].m_numScaledRefLayerOffsets );
     776      m_acTEncTop[layer].setNumScaledRefLayerOffsets            ( m_acLayerCfg[layer].m_numScaledRefLayerOffsets );
    748777      for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++)
    749778      {
    750779#if O0098_SCALED_REF_LAYER_ID
    751         m_acTEncTop[layer].setScaledRefLayerId(i, m_acLayerCfg[layer].m_scaledRefLayerId[i]);
     780        m_acTEncTop[layer].setScaledRefLayerId                  (i, m_acLayerCfg[layer].m_scaledRefLayerId[i]);
    752781#endif
    753782#if REF_REGION_OFFSET
    754         m_acTEncTop[layer].setScaledRefLayerOffsetPresentFlag( i, m_acLayerCfg[layer].m_scaledRefLayerOffsetPresentFlag[i] );
    755         m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow( subWidthC  * m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], subWidthC  * m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
    756                                                                  subHeightC * m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i],  subHeightC * m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i]);
     783        m_acTEncTop[layer].setScaledRefLayerOffsetPresentFlag   ( i, m_acLayerCfg[layer].m_scaledRefLayerOffsetPresentFlag[i] );
     784        m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow ( subWidthC  * m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], subWidthC  * m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
     785                                                                  subHeightC * m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i],  subHeightC * m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i]);
    757786#else
    758787#if P0312_VERT_PHASE_ADJ
    759         m_acTEncTop[layer].setVertPhasePositionEnableFlag( i, m_acLayerCfg[layer].m_vertPhasePositionEnableFlag[i] );
    760         m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
    761                                                   2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i], m_acLayerCfg[layer].m_vertPhasePositionEnableFlag[i] );
    762 #else
    763         m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
    764                                                   2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i]);
     788        m_acTEncTop[layer].setVertPhasePositionEnableFlag       ( i, m_acLayerCfg[layer].m_vertPhasePositionEnableFlag[i] );
     789        m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow ( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
     790                                                                  2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i], m_acLayerCfg[layer].m_vertPhasePositionEnableFlag[i] );
     791#else
     792        m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow ( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
     793                                                                  2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i]);
    765794#endif
    766795#endif
    767796#if R0209_GENERIC_PHASE
    768         m_acTEncTop[layer].setResamplePhaseSetPresentFlag( i, m_acLayerCfg[layer].m_resamplePhaseSetPresentFlag[i] );
    769         m_acTEncTop[layer].setPhaseHorLuma( i, m_acLayerCfg[layer].m_phaseHorLuma[i] );
    770         m_acTEncTop[layer].setPhaseVerLuma( i, m_acLayerCfg[layer].m_phaseVerLuma[i] );
    771         m_acTEncTop[layer].setPhaseHorChroma( i, m_acLayerCfg[layer].m_phaseHorChroma[i] );
    772         m_acTEncTop[layer].setPhaseVerChroma( i, m_acLayerCfg[layer].m_phaseVerChroma[i] );
     797        m_acTEncTop[layer].setResamplePhaseSetPresentFlag       ( i, m_acLayerCfg[layer].m_resamplePhaseSetPresentFlag[i] );
     798        m_acTEncTop[layer].setPhaseHorLuma                      ( i, m_acLayerCfg[layer].m_phaseHorLuma[i] );
     799        m_acTEncTop[layer].setPhaseVerLuma                      ( i, m_acLayerCfg[layer].m_phaseVerLuma[i] );
     800        m_acTEncTop[layer].setPhaseHorChroma                    ( i, m_acLayerCfg[layer].m_phaseHorChroma[i] );
     801        m_acTEncTop[layer].setPhaseVerChroma                    ( i, m_acLayerCfg[layer].m_phaseVerChroma[i] );
    773802#endif
    774803      }
    775804    }
    776805#if M0040_ADAPTIVE_RESOLUTION_CHANGE
    777     m_acTEncTop[layer].setAdaptiveResolutionChange( m_adaptiveResolutionChange );
     806    m_acTEncTop[layer].setAdaptiveResolutionChange               ( m_adaptiveResolutionChange );
    778807#endif
    779808#if R0071_IRAP_EOS_CROSS_LAYER_IMPACTS
    780     m_acTEncTop[layer].setLayerSwitchOffBegin(m_acLayerCfg[layer].m_layerSwitchOffBegin);
    781     m_acTEncTop[layer].setLayerSwitchOffEnd(m_acLayerCfg[layer].m_layerSwitchOffEnd);
     809    m_acTEncTop[layer].setLayerSwitchOffBegin                    (m_acLayerCfg[layer].m_layerSwitchOffBegin);
     810    m_acTEncTop[layer].setLayerSwitchOffEnd                      (m_acLayerCfg[layer].m_layerSwitchOffEnd);
    782811#endif
    783812#if AUXILIARY_PICTURES
    784     m_acTEncTop[layer].setChromaFormatIDC( m_acLayerCfg[layer].m_chromaFormatIDC );
     813    m_acTEncTop[layer].setChromaFormatIDC                        ( m_acLayerCfg[layer].m_chromaFormatIDC );
    785814#endif
    786815#if O0153_ALT_OUTPUT_LAYER_FLAG
    787     m_acTEncTop[layer].setAltOuputLayerFlag( m_altOutputLayerFlag );
     816    m_acTEncTop[layer].setAltOuputLayerFlag                      ( m_altOutputLayerFlag );
    788817#endif
    789818#if O0149_CROSS_LAYER_BLA_FLAG
    790     m_acTEncTop[layer].setCrossLayerBLAFlag( m_crossLayerBLAFlag );
     819    m_acTEncTop[layer].setCrossLayerBLAFlag                      ( m_crossLayerBLAFlag );
    791820#endif
    792821#if Q0048_CGS_3D_ASYMLUT
    793     m_acTEncTop[layer].setCGSFlag( layer == 0 ? 0 : m_nCGSFlag );
    794     m_acTEncTop[layer].setCGSMaxOctantDepth( m_nCGSMaxOctantDepth );
    795     m_acTEncTop[layer].setCGSMaxYPartNumLog2( m_nCGSMaxYPartNumLog2 );
    796     m_acTEncTop[layer].setCGSLUTBit( m_nCGSLUTBit );
     822    m_acTEncTop[layer].setCGSFlag                                ( layer == 0 ? 0 : m_nCGSFlag );
     823    m_acTEncTop[layer].setCGSMaxOctantDepth                      ( m_nCGSMaxOctantDepth );
     824    m_acTEncTop[layer].setCGSMaxYPartNumLog2                     ( m_nCGSMaxYPartNumLog2 );
     825    m_acTEncTop[layer].setCGSLUTBit                              ( m_nCGSLUTBit );
    797826#if R0151_CGS_3D_ASYMLUT_IMPROVE
    798     m_acTEncTop[layer].setCGSAdaptChroma( m_nCGSAdaptiveChroma );
     827    m_acTEncTop[layer].setCGSAdaptChroma                         ( m_nCGSAdaptiveChroma );
    799828#endif
    800829#if R0179_ENC_OPT_3DLUT_SIZE
    801     m_acTEncTop[layer].setCGSLutSizeRDO( m_nCGSLutSizeRDO );
     830    m_acTEncTop[layer].setCGSLutSizeRDO                          ( m_nCGSLutSizeRDO );
    802831#endif
    803832#endif
    804833#if Q0078_ADD_LAYER_SETS
    805     m_acTEncTop[layer].setNumAddLayerSets( m_numAddLayerSets );
     834    m_acTEncTop[layer].setNumAddLayerSets                        ( m_numAddLayerSets );
    806835#endif
    807836  }
     
    812841  TComVPS vps;
    813842
    814   vps.setMaxTLayers                       ( m_maxTempLayer );
     843  vps.setMaxTLayers                                               ( m_maxTempLayer );
    815844  if (m_maxTempLayer == 1)
    816845  {
    817846    vps.setTemporalNestingFlag(true);
    818847  }
    819   vps.setMaxLayers                        ( 1 );
     848  vps.setMaxLayers                                                ( 1 );
    820849  for(Int i = 0; i < MAX_TLAYER; i++)
    821850  {
    822     vps.setNumReorderPics                 ( m_numReorderPics[i], i );
    823     vps.setMaxDecPicBuffering             ( m_maxDecPicBuffering[i], i );
     851    vps.setNumReorderPics                                         ( m_numReorderPics[i], i );
     852    vps.setMaxDecPicBuffering                                     ( m_maxDecPicBuffering[i], i );
    824853  }
    825854  m_cTEncTop.setVPS(&vps);
    826855
    827   m_cTEncTop.setProfile(m_profile);
    828   m_cTEncTop.setLevel(m_levelTier, m_level);
    829   m_cTEncTop.setProgressiveSourceFlag(m_progressiveSourceFlag);
    830   m_cTEncTop.setInterlacedSourceFlag(m_interlacedSourceFlag);
    831   m_cTEncTop.setNonPackedConstraintFlag(m_nonPackedConstraintFlag);
    832   m_cTEncTop.setFrameOnlyConstraintFlag(m_frameOnlyConstraintFlag);
    833 
    834   m_cTEncTop.setFrameRate                    ( m_iFrameRate );
    835   m_cTEncTop.setFrameSkip                    ( m_FrameSkip );
    836   m_cTEncTop.setSourceWidth                  ( m_iSourceWidth );
    837   m_cTEncTop.setSourceHeight                 ( m_iSourceHeight );
    838   m_cTEncTop.setConformanceWindow            ( m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom );
    839   m_cTEncTop.setFramesToBeEncoded            ( m_framesToBeEncoded );
     856  m_cTEncTop.setProfile                                           ( m_profile);
     857  m_cTEncTop.setLevel                                             ( m_levelTier, m_level);
     858  m_cTEncTop.setProgressiveSourceFlag                             ( m_progressiveSourceFlag);
     859  m_cTEncTop.setInterlacedSourceFlag                              ( m_interlacedSourceFlag);
     860  m_cTEncTop.setNonPackedConstraintFlag                           ( m_nonPackedConstraintFlag);
     861  m_cTEncTop.setFrameOnlyConstraintFlag                           ( m_frameOnlyConstraintFlag);
     862  m_cTEncTop.setBitDepthConstraintValue                           ( m_bitDepthConstraint );
     863  m_cTEncTop.setChromaFormatConstraintValue                       ( m_chromaFormatConstraint );
     864  m_cTEncTop.setIntraConstraintFlag                               ( m_intraConstraintFlag );
     865  m_cTEncTop.setLowerBitRateConstraintFlag                        ( m_lowerBitRateConstraintFlag );
     866
     867  m_cTEncTop.setPrintMSEBasedSequencePSNR                         ( m_printMSEBasedSequencePSNR);
     868  m_cTEncTop.setPrintFrameMSE                                     ( m_printFrameMSE);
     869  m_cTEncTop.setPrintSequenceMSE                                  ( m_printSequenceMSE);
     870  m_cTEncTop.setCabacZeroWordPaddingEnabled                       ( m_cabacZeroWordPaddingEnabled );
     871
     872  m_cTEncTop.setFrameRate                                         ( m_iFrameRate );
     873  m_cTEncTop.setFrameSkip                                         ( m_FrameSkip );
     874  m_cTEncTop.setSourceWidth                                       ( m_iSourceWidth );
     875  m_cTEncTop.setSourceHeight                                      ( m_iSourceHeight );
     876  m_cTEncTop.setConformanceWindow                                 ( m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom );
     877  m_cTEncTop.setFramesToBeEncoded                                 ( m_framesToBeEncoded );
    840878
    841879  //====== Coding Structure ========
    842   m_cTEncTop.setIntraPeriod                  ( m_iIntraPeriod );
    843   m_cTEncTop.setDecodingRefreshType          ( m_iDecodingRefreshType );
    844   m_cTEncTop.setGOPSize                      ( m_iGOPSize );
    845   m_cTEncTop.setGopList                      ( m_GOPList );
    846   m_cTEncTop.setExtraRPSs                    ( m_extraRPSs );
     880  m_cTEncTop.setIntraPeriod                                       ( m_iIntraPeriod );
     881  m_cTEncTop.setDecodingRefreshType                               ( m_iDecodingRefreshType );
     882  m_cTEncTop.setGOPSize                                           ( m_iGOPSize );
     883  m_cTEncTop.setGopList                                           ( m_GOPList );
     884  m_cTEncTop.setExtraRPSs                                         ( m_extraRPSs );
    847885  for(Int i = 0; i < MAX_TLAYER; i++)
    848886  {
    849     m_cTEncTop.setNumReorderPics             ( m_numReorderPics[i], i );
    850     m_cTEncTop.setMaxDecPicBuffering         ( m_maxDecPicBuffering[i], i );
     887    m_cTEncTop.setNumReorderPics                                  ( m_numReorderPics[i], i );
     888    m_cTEncTop.setMaxDecPicBuffering                              ( m_maxDecPicBuffering[i], i );
    851889  }
    852890  for( UInt uiLoop = 0; uiLoop < MAX_TLAYER; ++uiLoop )
    853891  {
    854     m_cTEncTop.setLambdaModifier( uiLoop, m_adLambdaModifier[ uiLoop ] );
    855   }
    856   m_cTEncTop.setQP                           ( m_iQP );
    857 
    858   m_cTEncTop.setPad                          ( m_aiPad );
    859 
    860   m_cTEncTop.setMaxTempLayer                 ( m_maxTempLayer );
     892    m_cTEncTop.setLambdaModifier                                  ( uiLoop, m_adLambdaModifier[ uiLoop ] );
     893  }
     894  m_cTEncTop.setQP                                                ( m_iQP );
     895
     896  m_cTEncTop.setPad                                               ( m_aiPad );
     897
     898  m_cTEncTop.setMaxTempLayer                                      ( m_maxTempLayer );
    861899  m_cTEncTop.setUseAMP( m_enableAMP );
    862900
     
    864902
    865903  //====== Loop/Deblock Filter ========
    866   m_cTEncTop.setLoopFilterDisable            ( m_bLoopFilterDisable       );
    867   m_cTEncTop.setLoopFilterOffsetInPPS        ( m_loopFilterOffsetInPPS );
    868   m_cTEncTop.setLoopFilterBetaOffset         ( m_loopFilterBetaOffsetDiv2  );
    869   m_cTEncTop.setLoopFilterTcOffset           ( m_loopFilterTcOffsetDiv2    );
    870   m_cTEncTop.setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent);
    871   m_cTEncTop.setDeblockingFilterMetric       ( m_DeblockingFilterMetric );
     904  m_cTEncTop.setLoopFilterDisable                                 ( m_bLoopFilterDisable       );
     905  m_cTEncTop.setLoopFilterOffsetInPPS                             ( m_loopFilterOffsetInPPS );
     906  m_cTEncTop.setLoopFilterBetaOffset                              ( m_loopFilterBetaOffsetDiv2  );
     907  m_cTEncTop.setLoopFilterTcOffset                                ( m_loopFilterTcOffsetDiv2    );
     908  m_cTEncTop.setDeblockingFilterControlPresent                    ( m_DeblockingFilterControlPresent);
     909  m_cTEncTop.setDeblockingFilterMetric                            ( m_DeblockingFilterMetric );
    872910
    873911  //====== Motion search ========
    874   m_cTEncTop.setFastSearch                   ( m_iFastSearch  );
    875   m_cTEncTop.setSearchRange                  ( m_iSearchRange );
    876   m_cTEncTop.setBipredSearchRange            ( m_bipredSearchRange );
     912  m_cTEncTop.setFastSearch                                        ( m_iFastSearch  );
     913  m_cTEncTop.setSearchRange                                       ( m_iSearchRange );
     914  m_cTEncTop.setBipredSearchRange                                 ( m_bipredSearchRange );
    877915
    878916  //====== Quality control ========
    879   m_cTEncTop.setMaxDeltaQP                   ( m_iMaxDeltaQP  );
    880   m_cTEncTop.setMaxCuDQPDepth                ( m_iMaxCuDQPDepth  );
    881 
    882   m_cTEncTop.setChromaCbQpOffset               ( m_cbQpOffset     );
    883   m_cTEncTop.setChromaCrQpOffset            ( m_crQpOffset  );
     917  m_cTEncTop.setMaxDeltaQP                                        ( m_iMaxDeltaQP  );
     918  m_cTEncTop.setMaxCuDQPDepth                                     ( m_iMaxCuDQPDepth  );
     919  m_cTEncTop.setMaxCUChromaQpAdjustmentDepth                      ( m_maxCUChromaQpAdjustmentDepth );
     920  m_cTEncTop.setChromaCbQpOffset                                  ( m_cbQpOffset     );
     921  m_cTEncTop.setChromaCrQpOffset                                  ( m_crQpOffset  );
     922
     923  m_cTEncTop.setChromaFormatIdc                                   ( m_chromaFormatIDC  );
    884924
    885925#if ADAPTIVE_QP_SELECTION
    886   m_cTEncTop.setUseAdaptQpSelect             ( m_bUseAdaptQpSelect   );
    887 #endif
    888 
    889   m_cTEncTop.setUseAdaptiveQP                ( m_bUseAdaptiveQP  );
    890   m_cTEncTop.setQPAdaptationRange            ( m_iQPAdaptationRange );
    891 
     926  m_cTEncTop.setUseAdaptQpSelect                                  ( m_bUseAdaptQpSelect   );
     927#endif
     928
     929  m_cTEncTop.setUseAdaptiveQP                                     ( m_bUseAdaptiveQP  );
     930  m_cTEncTop.setQPAdaptationRange                                 ( m_iQPAdaptationRange );
     931  m_cTEncTop.setUseExtendedPrecision                              ( m_useExtendedPrecision );
     932  m_cTEncTop.setUseHighPrecisionPredictionWeighting               ( m_useHighPrecisionPredictionWeighting );
    892933  //====== Tool list ========
    893   m_cTEncTop.setDeltaQpRD                    ( m_uiDeltaQpRD  );
    894   m_cTEncTop.setUseASR                       ( m_bUseASR      );
    895   m_cTEncTop.setUseHADME                     ( m_bUseHADME    );
    896   m_cTEncTop.setdQPs                         ( m_aidQP        );
    897   m_cTEncTop.setUseRDOQ                      ( m_useRDOQ     );
    898   m_cTEncTop.setUseRDOQTS                    ( m_useRDOQTS   );
    899   m_cTEncTop.setRDpenalty                 ( m_rdPenalty );
    900   m_cTEncTop.setQuadtreeTULog2MaxSize        ( m_uiQuadtreeTULog2MaxSize );
    901   m_cTEncTop.setQuadtreeTULog2MinSize        ( m_uiQuadtreeTULog2MinSize );
    902   m_cTEncTop.setQuadtreeTUMaxDepthInter      ( m_uiQuadtreeTUMaxDepthInter );
    903   m_cTEncTop.setQuadtreeTUMaxDepthIntra      ( m_uiQuadtreeTUMaxDepthIntra );
    904   m_cTEncTop.setUseFastEnc                   ( m_bUseFastEnc  );
    905   m_cTEncTop.setUseEarlyCU                   ( m_bUseEarlyCU  );
    906   m_cTEncTop.setUseFastDecisionForMerge      ( m_useFastDecisionForMerge  );
    907   m_cTEncTop.setUseCbfFastMode            ( m_bUseCbfFastMode  );
    908   m_cTEncTop.setUseEarlySkipDetection            ( m_useEarlySkipDetection );
     934  m_cTEncTop.setDeltaQpRD                                         ( m_uiDeltaQpRD  );
     935  m_cTEncTop.setUseASR                                            ( m_bUseASR      );
     936  m_cTEncTop.setUseHADME                                          ( m_bUseHADME    );
     937  m_cTEncTop.setdQPs                                              ( m_aidQP        );
     938  m_cTEncTop.setUseRDOQ                                           ( m_useRDOQ     );
     939  m_cTEncTop.setUseRDOQTS                                         ( m_useRDOQTS   );
     940  m_cTEncTop.setRDpenalty                                         ( m_rdPenalty );
     941  m_cTEncTop.setQuadtreeTULog2MaxSize                             ( m_uiQuadtreeTULog2MaxSize );
     942  m_cTEncTop.setQuadtreeTULog2MinSize                             ( m_uiQuadtreeTULog2MinSize );
     943  m_cTEncTop.setQuadtreeTUMaxDepthInter                           ( m_uiQuadtreeTUMaxDepthInter );
     944  m_cTEncTop.setQuadtreeTUMaxDepthIntra                           ( m_uiQuadtreeTUMaxDepthIntra );
     945  m_cTEncTop.setUseFastEnc                                        ( m_bUseFastEnc  );
     946  m_cTEncTop.setUseEarlyCU                                        ( m_bUseEarlyCU  );
     947  m_cTEncTop.setUseFastDecisionForMerge                           ( m_useFastDecisionForMerge  );
     948  m_cTEncTop.setUseCbfFastMode                                    ( m_bUseCbfFastMode  );
     949  m_cTEncTop.setUseEarlySkipDetection                             ( m_useEarlySkipDetection );
    909950#if FAST_INTRA_SHVC
    910   m_cTEncTop.setUseFastIntraScalable            ( m_useFastIntraScalable );
    911 #endif
    912 
    913   m_cTEncTop.setUseTransformSkip             ( m_useTransformSkip      );
    914   m_cTEncTop.setUseTransformSkipFast         ( m_useTransformSkipFast  );
    915   m_cTEncTop.setUseConstrainedIntraPred      ( m_bUseConstrainedIntraPred );
    916   m_cTEncTop.setPCMLog2MinSize          ( m_uiPCMLog2MinSize);
    917   m_cTEncTop.setUsePCM                       ( m_usePCM );
    918   m_cTEncTop.setPCMLog2MaxSize               ( m_pcmLog2MaxSize);
    919   m_cTEncTop.setMaxNumMergeCand              ( m_maxNumMergeCand );
     951  m_cTEncTop.setUseFastIntraScalable                              ( m_useFastIntraScalable );
     952#endif
     953  m_cTEncTop.setUseCrossComponentPrediction                       ( m_useCrossComponentPrediction );
     954  m_cTEncTop.setUseReconBasedCrossCPredictionEstimate             ( m_reconBasedCrossCPredictionEstimate );
     955  m_cTEncTop.setSaoOffsetBitShift                                 ( CHANNEL_TYPE_LUMA  , m_saoOffsetBitShift[CHANNEL_TYPE_LUMA]   );
     956  m_cTEncTop.setSaoOffsetBitShift                                 ( CHANNEL_TYPE_CHROMA, m_saoOffsetBitShift[CHANNEL_TYPE_CHROMA] );
     957  m_cTEncTop.setUseTransformSkip                                  ( m_useTransformSkip      );
     958  m_cTEncTop.setUseTransformSkipFast                              ( m_useTransformSkipFast  );
     959  m_cTEncTop.setUseResidualRotation                               ( m_useResidualRotation   );
     960  m_cTEncTop.setUseSingleSignificanceMapContext                   ( m_useSingleSignificanceMapContext   );
     961  m_cTEncTop.setUseGolombRiceParameterAdaptation                  ( m_useGolombRiceParameterAdaptation );
     962  m_cTEncTop.setAlignCABACBeforeBypass                            ( m_alignCABACBeforeBypass );
     963  m_cTEncTop.setTransformSkipLog2MaxSize                          ( m_transformSkipLog2MaxSize  );
     964  for (UInt signallingModeIndex = 0; signallingModeIndex < NUMBER_OF_RDPCM_SIGNALLING_MODES; signallingModeIndex++)
     965  {
     966    m_cTEncTop.setUseResidualDPCM                                 ( RDPCMSignallingMode(signallingModeIndex), m_useResidualDPCM[signallingModeIndex]);
     967  }
     968  m_cTEncTop.setUseConstrainedIntraPred                           ( m_bUseConstrainedIntraPred );
     969  m_cTEncTop.setPCMLog2MinSize                                    ( m_uiPCMLog2MinSize);
     970  m_cTEncTop.setUsePCM                                            ( m_usePCM );
     971  m_cTEncTop.setPCMLog2MaxSize                                    ( m_pcmLog2MaxSize);
     972  m_cTEncTop.setMaxNumMergeCand                                   ( m_maxNumMergeCand );
    920973
    921974
    922975  //====== Weighted Prediction ========
    923   m_cTEncTop.setUseWP                   ( m_useWeightedPred      );
    924   m_cTEncTop.setWPBiPred                ( m_useWeightedBiPred   );
     976  m_cTEncTop.setUseWP                                             ( m_useWeightedPred      );
     977  m_cTEncTop.setWPBiPred                                          ( m_useWeightedBiPred   );
    925978  //====== Parallel Merge Estimation ========
    926   m_cTEncTop.setLog2ParallelMergeLevelMinus2 ( m_log2ParallelMergeLevel - 2 );
     979  m_cTEncTop.setLog2ParallelMergeLevelMinus2                      ( m_log2ParallelMergeLevel - 2 );
    927980
    928981  //====== Slice ========
    929   m_cTEncTop.setSliceMode               ( m_sliceMode                );
    930   m_cTEncTop.setSliceArgument           ( m_sliceArgument            );
     982  m_cTEncTop.setSliceMode                                         ( (SliceConstraint) m_sliceMode );
     983  m_cTEncTop.setSliceArgument                                     ( m_sliceArgument            );
    931984
    932985  //====== Dependent Slice ========
    933   m_cTEncTop.setSliceSegmentMode        ( m_sliceSegmentMode         );
    934   m_cTEncTop.setSliceSegmentArgument    ( m_sliceSegmentArgument     );
    935   Int iNumPartInCU = 1<<(m_uiMaxCUDepth<<1);
    936   if(m_sliceSegmentMode==FIXED_NUMBER_OF_LCU)
    937   {
    938     m_cTEncTop.setSliceSegmentArgument ( m_sliceSegmentArgument * iNumPartInCU );
    939   }
    940   if(m_sliceMode==FIXED_NUMBER_OF_LCU)
    941   {
    942     m_cTEncTop.setSliceArgument ( m_sliceArgument * iNumPartInCU );
    943   }
    944   if(m_sliceMode==FIXED_NUMBER_OF_TILES)
    945   {
    946     m_cTEncTop.setSliceArgument ( m_sliceArgument );
    947   }
    948 
    949   if(m_sliceMode == 0 )
     986  m_cTEncTop.setSliceSegmentMode                                  (  (SliceConstraint) m_sliceSegmentMode );
     987  m_cTEncTop.setSliceSegmentArgument                              ( m_sliceSegmentArgument     );
     988
     989  if(m_sliceMode == NO_SLICES )
    950990  {
    951991    m_bLFCrossSliceBoundaryFlag = true;
    952992  }
    953   m_cTEncTop.setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag );
    954   m_cTEncTop.setUseSAO ( m_bUseSAO );
    955   m_cTEncTop.setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic);
    956 
    957   m_cTEncTop.setSaoLcuBoundary (m_saoLcuBoundary);
    958   m_cTEncTop.setPCMInputBitDepthFlag  ( m_bPCMInputBitDepthFlag);
    959   m_cTEncTop.setPCMFilterDisableFlag  ( m_bPCMFilterDisableFlag);
    960 
    961   m_cTEncTop.setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled);
    962   m_cTEncTop.setRecoveryPointSEIEnabled( m_recoveryPointSEIEnabled );
    963   m_cTEncTop.setBufferingPeriodSEIEnabled( m_bufferingPeriodSEIEnabled );
    964   m_cTEncTop.setPictureTimingSEIEnabled( m_pictureTimingSEIEnabled );
    965   m_cTEncTop.setToneMappingInfoSEIEnabled                 ( m_toneMappingInfoSEIEnabled );
    966   m_cTEncTop.setTMISEIToneMapId                           ( m_toneMapId );
    967   m_cTEncTop.setTMISEIToneMapCancelFlag                   ( m_toneMapCancelFlag );
    968   m_cTEncTop.setTMISEIToneMapPersistenceFlag              ( m_toneMapPersistenceFlag );
    969   m_cTEncTop.setTMISEICodedDataBitDepth                   ( m_toneMapCodedDataBitDepth );
    970   m_cTEncTop.setTMISEITargetBitDepth                      ( m_toneMapTargetBitDepth );
    971   m_cTEncTop.setTMISEIModelID                             ( m_toneMapModelId );
    972   m_cTEncTop.setTMISEIMinValue                            ( m_toneMapMinValue );
    973   m_cTEncTop.setTMISEIMaxValue                            ( m_toneMapMaxValue );
    974   m_cTEncTop.setTMISEISigmoidMidpoint                     ( m_sigmoidMidpoint );
    975   m_cTEncTop.setTMISEISigmoidWidth                        ( m_sigmoidWidth );
    976   m_cTEncTop.setTMISEIStartOfCodedInterva                 ( m_startOfCodedInterval );
    977   m_cTEncTop.setTMISEINumPivots                           ( m_numPivots );
    978   m_cTEncTop.setTMISEICodedPivotValue                     ( m_codedPivotValue );
    979   m_cTEncTop.setTMISEITargetPivotValue                    ( m_targetPivotValue );
    980   m_cTEncTop.setTMISEICameraIsoSpeedIdc                   ( m_cameraIsoSpeedIdc );
    981   m_cTEncTop.setTMISEICameraIsoSpeedValue                 ( m_cameraIsoSpeedValue );
    982   m_cTEncTop.setTMISEIExposureIndexIdc                    ( m_exposureIndexIdc );
    983   m_cTEncTop.setTMISEIExposureIndexValue                  ( m_exposureIndexValue );
    984   m_cTEncTop.setTMISEIExposureCompensationValueSignFlag   ( m_exposureCompensationValueSignFlag );
    985   m_cTEncTop.setTMISEIExposureCompensationValueNumerator  ( m_exposureCompensationValueNumerator );
    986   m_cTEncTop.setTMISEIExposureCompensationValueDenomIdc   ( m_exposureCompensationValueDenomIdc );
    987   m_cTEncTop.setTMISEIRefScreenLuminanceWhite             ( m_refScreenLuminanceWhite );
    988   m_cTEncTop.setTMISEIExtendedRangeWhiteLevel             ( m_extendedRangeWhiteLevel );
    989   m_cTEncTop.setTMISEINominalBlackLevelLumaCodeValue      ( m_nominalBlackLevelLumaCodeValue );
    990   m_cTEncTop.setTMISEINominalWhiteLevelLumaCodeValue      ( m_nominalWhiteLevelLumaCodeValue );
    991   m_cTEncTop.setTMISEIExtendedWhiteLevelLumaCodeValue     ( m_extendedWhiteLevelLumaCodeValue );
    992 #if P0050_KNEE_FUNCTION_SEI
    993   m_cTEncTop.setKneeSEIEnabled              ( m_kneeSEIEnabled );
    994   m_cTEncTop.setKneeSEIId                   ( m_kneeSEIId );
    995   m_cTEncTop.setKneeSEICancelFlag           ( m_kneeSEICancelFlag );
    996   m_cTEncTop.setKneeSEIPersistenceFlag      ( m_kneeSEIPersistenceFlag );
    997   m_cTEncTop.setKneeSEIMappingFlag          ( m_kneeSEIMappingFlag );
    998   m_cTEncTop.setKneeSEIInputDrange          ( m_kneeSEIInputDrange );
    999   m_cTEncTop.setKneeSEIInputDispLuminance   ( m_kneeSEIInputDispLuminance );
    1000   m_cTEncTop.setKneeSEIOutputDrange         ( m_kneeSEIOutputDrange );
    1001   m_cTEncTop.setKneeSEIOutputDispLuminance  ( m_kneeSEIOutputDispLuminance );
    1002   m_cTEncTop.setKneeSEINumKneePointsMinus1  ( m_kneeSEINumKneePointsMinus1 );
    1003   m_cTEncTop.setKneeSEIInputKneePoint       ( m_kneeSEIInputKneePoint );
    1004   m_cTEncTop.setKneeSEIOutputKneePoint      ( m_kneeSEIOutputKneePoint );
    1005 #endif
     993  m_cTEncTop.setLFCrossSliceBoundaryFlag                          ( m_bLFCrossSliceBoundaryFlag );
     994  m_cTEncTop.setUseSAO                                            ( m_bUseSAO );
     995  m_cTEncTop.setMaxNumOffsetsPerPic                               ( m_maxNumOffsetsPerPic);
     996
     997  m_cTEncTop.setSaoCtuBoundary                                    ( m_saoCtuBoundary);
     998  m_cTEncTop.setPCMInputBitDepthFlag                              ( m_bPCMInputBitDepthFlag);
     999  m_cTEncTop.setPCMFilterDisableFlag                              ( m_bPCMFilterDisableFlag);
     1000
     1001  m_cTEncTop.setDisableIntraReferenceSmoothing                    (!m_enableIntraReferenceSmoothing );
     1002  m_cTEncTop.setDecodedPictureHashSEIEnabled                      ( m_decodedPictureHashSEIEnabled );
     1003  m_cTEncTop.setRecoveryPointSEIEnabled                           ( m_recoveryPointSEIEnabled );
     1004  m_cTEncTop.setBufferingPeriodSEIEnabled                         ( m_bufferingPeriodSEIEnabled );
     1005  m_cTEncTop.setPictureTimingSEIEnabled                           ( m_pictureTimingSEIEnabled );
     1006  m_cTEncTop.setToneMappingInfoSEIEnabled                         ( m_toneMappingInfoSEIEnabled );
     1007  m_cTEncTop.setTMISEIToneMapId                                   ( m_toneMapId );
     1008  m_cTEncTop.setTMISEIToneMapCancelFlag                           ( m_toneMapCancelFlag );
     1009  m_cTEncTop.setTMISEIToneMapPersistenceFlag                      ( m_toneMapPersistenceFlag );
     1010  m_cTEncTop.setTMISEICodedDataBitDepth                           ( m_toneMapCodedDataBitDepth );
     1011  m_cTEncTop.setTMISEITargetBitDepth                              ( m_toneMapTargetBitDepth );
     1012  m_cTEncTop.setTMISEIModelID                                     ( m_toneMapModelId );
     1013  m_cTEncTop.setTMISEIMinValue                                    ( m_toneMapMinValue );
     1014  m_cTEncTop.setTMISEIMaxValue                                    ( m_toneMapMaxValue );
     1015  m_cTEncTop.setTMISEISigmoidMidpoint                             ( m_sigmoidMidpoint );
     1016  m_cTEncTop.setTMISEISigmoidWidth                                ( m_sigmoidWidth );
     1017  m_cTEncTop.setTMISEIStartOfCodedInterva                         ( m_startOfCodedInterval );
     1018  m_cTEncTop.setTMISEINumPivots                                   ( m_numPivots );
     1019  m_cTEncTop.setTMISEICodedPivotValue                             ( m_codedPivotValue );
     1020  m_cTEncTop.setTMISEITargetPivotValue                            ( m_targetPivotValue );
     1021  m_cTEncTop.setTMISEICameraIsoSpeedIdc                           ( m_cameraIsoSpeedIdc );
     1022  m_cTEncTop.setTMISEICameraIsoSpeedValue                         ( m_cameraIsoSpeedValue );
     1023  m_cTEncTop.setTMISEIExposureIndexIdc                            ( m_exposureIndexIdc );
     1024  m_cTEncTop.setTMISEIExposureIndexValue                          ( m_exposureIndexValue );
     1025  m_cTEncTop.setTMISEIExposureCompensationValueSignFlag           ( m_exposureCompensationValueSignFlag );
     1026  m_cTEncTop.setTMISEIExposureCompensationValueNumerator          ( m_exposureCompensationValueNumerator );
     1027  m_cTEncTop.setTMISEIExposureCompensationValueDenomIdc           ( m_exposureCompensationValueDenomIdc );
     1028  m_cTEncTop.setTMISEIRefScreenLuminanceWhite                     ( m_refScreenLuminanceWhite );
     1029  m_cTEncTop.setTMISEIExtendedRangeWhiteLevel                     ( m_extendedRangeWhiteLevel );
     1030  m_cTEncTop.setTMISEINominalBlackLevelLumaCodeValue              ( m_nominalBlackLevelLumaCodeValue );
     1031  m_cTEncTop.setTMISEINominalWhiteLevelLumaCodeValue              ( m_nominalWhiteLevelLumaCodeValue );
     1032  m_cTEncTop.setTMISEIExtendedWhiteLevelLumaCodeValue             ( m_extendedWhiteLevelLumaCodeValue );
     1033  m_cTEncTop.setChromaSamplingFilterHintEnabled                   ( m_chromaSamplingFilterSEIenabled );
     1034  m_cTEncTop.setChromaSamplingHorFilterIdc                        ( m_chromaSamplingHorFilterIdc );
     1035  m_cTEncTop.setChromaSamplingVerFilterIdc                        ( m_chromaSamplingVerFilterIdc );
     1036  m_cTEncTop.setFramePackingArrangementSEIEnabled                 ( m_framePackingSEIEnabled );
     1037  m_cTEncTop.setFramePackingArrangementSEIType                    ( m_framePackingSEIType );
     1038  m_cTEncTop.setFramePackingArrangementSEIId                      ( m_framePackingSEIId );
     1039  m_cTEncTop.setFramePackingArrangementSEIQuincunx                ( m_framePackingSEIQuincunx );
     1040  m_cTEncTop.setFramePackingArrangementSEIInterpretation          ( m_framePackingSEIInterpretation );
     1041  m_cTEncTop.setSegmentedRectFramePackingArrangementSEIEnabled    ( m_segmentedRectFramePackingSEIEnabled );
     1042  m_cTEncTop.setSegmentedRectFramePackingArrangementSEICancel     ( m_segmentedRectFramePackingSEICancel );
     1043  m_cTEncTop.setSegmentedRectFramePackingArrangementSEIType       ( m_segmentedRectFramePackingSEIType );
     1044  m_cTEncTop.setSegmentedRectFramePackingArrangementSEIPersistence( m_segmentedRectFramePackingSEIPersistence );
     1045  m_cTEncTop.setDisplayOrientationSEIAngle                        ( m_displayOrientationSEIAngle );
     1046  m_cTEncTop.setTemporalLevel0IndexSEIEnabled                     ( m_temporalLevel0IndexSEIEnabled );
     1047  m_cTEncTop.setGradualDecodingRefreshInfoEnabled                 ( m_gradualDecodingRefreshInfoEnabled );
     1048  m_cTEncTop.setNoDisplaySEITLayer                                ( m_noDisplaySEITLayer );
     1049  m_cTEncTop.setDecodingUnitInfoSEIEnabled                        ( m_decodingUnitInfoSEIEnabled );
     1050  m_cTEncTop.setSOPDescriptionSEIEnabled                          ( m_SOPDescriptionSEIEnabled );
     1051  m_cTEncTop.setScalableNestingSEIEnabled                         ( m_scalableNestingSEIEnabled );
     1052  m_cTEncTop.setTMCTSSEIEnabled                                   ( m_tmctsSEIEnabled );
     1053  m_cTEncTop.setTimeCodeSEIEnabled                                ( m_timeCodeSEIEnabled );
     1054  m_cTEncTop.setNumberOfTimeSets                                  ( m_timeCodeSEINumTs );
     1055  for(Int i = 0; i < m_timeCodeSEINumTs; i++) { m_cTEncTop.setTimeSet(m_timeSetArray[i], i); }
     1056  m_cTEncTop.setKneeSEIEnabled                                    ( m_kneeSEIEnabled );
     1057  m_cTEncTop.setKneeSEIId                                         ( m_kneeSEIId );
     1058  m_cTEncTop.setKneeSEICancelFlag                                 ( m_kneeSEICancelFlag );
     1059  m_cTEncTop.setKneeSEIPersistenceFlag                            ( m_kneeSEIPersistenceFlag );
     1060  m_cTEncTop.setKneeSEIInputDrange                                ( m_kneeSEIInputDrange );
     1061  m_cTEncTop.setKneeSEIInputDispLuminance                         ( m_kneeSEIInputDispLuminance );
     1062  m_cTEncTop.setKneeSEIOutputDrange                               ( m_kneeSEIOutputDrange );
     1063  m_cTEncTop.setKneeSEIOutputDispLuminance                        ( m_kneeSEIOutputDispLuminance );
     1064  m_cTEncTop.setKneeSEINumKneePointsMinus1                        ( m_kneeSEINumKneePointsMinus1 );
     1065  m_cTEncTop.setKneeSEIInputKneePoint                             ( m_kneeSEIInputKneePoint );
     1066  m_cTEncTop.setKneeSEIOutputKneePoint                            ( m_kneeSEIOutputKneePoint );
     1067  m_cTEncTop.setMasteringDisplaySEI                               ( m_masteringDisplay );
    10061068#if Q0074_COLOUR_REMAPPING_SEI
    1007   m_cTEncTop.setCRISEIFile                       ( const_cast<Char*>(m_colourRemapSEIFile.c_str()) );
     1069  m_cTEncTop.setCRISEIFile                       ( m_colourRemapSEIFile );
    10081070  m_cTEncTop.setCRISEIId                         ( m_colourRemapSEIId );
    10091071  m_cTEncTop.setCRISEICancelFlag                 ( m_colourRemapSEICancelFlag );
     
    10261088  m_cTEncTop.setCRISEIPostLutTargetValue         ( m_colourRemapSEIPostLutTargetValue );
    10271089#endif
    1028   m_cTEncTop.setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled );
    1029   m_cTEncTop.setFramePackingArrangementSEIType( m_framePackingSEIType );
    1030   m_cTEncTop.setFramePackingArrangementSEIId( m_framePackingSEIId );
    1031   m_cTEncTop.setFramePackingArrangementSEIQuincunx( m_framePackingSEIQuincunx );
    1032   m_cTEncTop.setFramePackingArrangementSEIInterpretation( m_framePackingSEIInterpretation );
    1033   m_cTEncTop.setDisplayOrientationSEIAngle( m_displayOrientationSEIAngle );
    1034   m_cTEncTop.setTemporalLevel0IndexSEIEnabled( m_temporalLevel0IndexSEIEnabled );
    1035   m_cTEncTop.setGradualDecodingRefreshInfoEnabled( m_gradualDecodingRefreshInfoEnabled );
    1036   m_cTEncTop.setDecodingUnitInfoSEIEnabled( m_decodingUnitInfoSEIEnabled );
    10371090#if LAYERS_NOT_PRESENT_SEI
    10381091  m_cTEncTop.setLayersNotPresentSEIEnabled( m_layersNotPresentSEIEnabled );
    10391092#endif
    1040   m_cTEncTop.setSOPDescriptionSEIEnabled( m_SOPDescriptionSEIEnabled );
    1041   m_cTEncTop.setScalableNestingSEIEnabled( m_scalableNestingSEIEnabled );
    1042   m_cTEncTop.setTileUniformSpacingFlag     ( m_tileUniformSpacingFlag );
    1043   m_cTEncTop.setNumColumnsMinus1           ( m_numTileColumnsMinus1 );
    1044   m_cTEncTop.setNumRowsMinus1              ( m_numTileRowsMinus1 );
     1093  m_cTEncTop.setTileUniformSpacingFlag                            ( m_tileUniformSpacingFlag );
     1094  m_cTEncTop.setNumColumnsMinus1                                  ( m_numTileColumnsMinus1 );
     1095  m_cTEncTop.setNumRowsMinus1                                     ( m_numTileRowsMinus1 );
    10451096  if(!m_tileUniformSpacingFlag)
    10461097  {
    1047     m_cTEncTop.setColumnWidth              ( m_tileColumnWidth );
    1048     m_cTEncTop.setRowHeight                ( m_tileRowHeight );
     1098    m_cTEncTop.setColumnWidth                                     ( m_tileColumnWidth );
     1099    m_cTEncTop.setRowHeight                                       ( m_tileRowHeight );
    10491100  }
    10501101  m_cTEncTop.xCheckGSParameters();
    1051   Int uiTilesCount          = (m_numTileRowsMinus1+1) * (m_numTileColumnsMinus1+1);
     1102  Int uiTilesCount = (m_numTileRowsMinus1+1) * (m_numTileColumnsMinus1+1);
    10521103  if(uiTilesCount == 1)
    10531104  {
    10541105    m_bLFCrossTileBoundaryFlag = true;
    10551106  }
    1056   m_cTEncTop.setLFCrossTileBoundaryFlag( m_bLFCrossTileBoundaryFlag );
    1057   m_cTEncTop.setWaveFrontSynchro           ( m_iWaveFrontSynchro );
    1058   m_cTEncTop.setWaveFrontSubstreams        ( m_iWaveFrontSubstreams );
    1059   m_cTEncTop.setTMVPModeId ( m_TMVPModeId );
    1060   m_cTEncTop.setUseScalingListId           ( m_useScalingListId  );
    1061   m_cTEncTop.setScalingListFile            ( m_scalingListFile   );
    1062   m_cTEncTop.setSignHideFlag(m_signHideFlag);
    1063   m_cTEncTop.setUseRateCtrl         ( m_RCEnableRateControl );
    1064   m_cTEncTop.setTargetBitrate       ( m_RCTargetBitrate );
    1065   m_cTEncTop.setKeepHierBit         ( m_RCKeepHierarchicalBit );
    1066   m_cTEncTop.setLCULevelRC          ( m_RCLCULevelRC );
    1067   m_cTEncTop.setUseLCUSeparateModel ( m_RCUseLCUSeparateModel );
    1068   m_cTEncTop.setInitialQP           ( m_RCInitialQP );
    1069   m_cTEncTop.setForceIntraQP        ( m_RCForceIntraQP );
    1070   m_cTEncTop.setTransquantBypassEnableFlag(m_TransquantBypassEnableFlag);
    1071   m_cTEncTop.setCUTransquantBypassFlagForceValue(m_CUTransquantBypassFlagForce);
    1072   m_cTEncTop.setUseRecalculateQPAccordingToLambda( m_recalculateQPAccordingToLambda );
    1073   m_cTEncTop.setUseStrongIntraSmoothing( m_useStrongIntraSmoothing );
    1074   m_cTEncTop.setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled );
    1075   m_cTEncTop.setVuiParametersPresentFlag( m_vuiParametersPresentFlag );
    1076   m_cTEncTop.setAspectRatioInfoPresentFlag( m_aspectRatioInfoPresentFlag);
    1077   m_cTEncTop.setAspectRatioIdc( m_aspectRatioIdc );
    1078   m_cTEncTop.setSarWidth( m_sarWidth );
    1079   m_cTEncTop.setSarHeight( m_sarHeight );
    1080   m_cTEncTop.setOverscanInfoPresentFlag( m_overscanInfoPresentFlag );
    1081   m_cTEncTop.setOverscanAppropriateFlag( m_overscanAppropriateFlag );
    1082   m_cTEncTop.setVideoSignalTypePresentFlag( m_videoSignalTypePresentFlag );
    1083   m_cTEncTop.setVideoFormat( m_videoFormat );
    1084   m_cTEncTop.setVideoFullRangeFlag( m_videoFullRangeFlag );
    1085   m_cTEncTop.setColourDescriptionPresentFlag( m_colourDescriptionPresentFlag );
    1086   m_cTEncTop.setColourPrimaries( m_colourPrimaries );
    1087   m_cTEncTop.setTransferCharacteristics( m_transferCharacteristics );
    1088   m_cTEncTop.setMatrixCoefficients( m_matrixCoefficients );
    1089   m_cTEncTop.setChromaLocInfoPresentFlag( m_chromaLocInfoPresentFlag );
    1090   m_cTEncTop.setChromaSampleLocTypeTopField( m_chromaSampleLocTypeTopField );
    1091   m_cTEncTop.setChromaSampleLocTypeBottomField( m_chromaSampleLocTypeBottomField );
    1092   m_cTEncTop.setNeutralChromaIndicationFlag( m_neutralChromaIndicationFlag );
    1093   m_cTEncTop.setDefaultDisplayWindow( m_defDispWinLeftOffset, m_defDispWinRightOffset, m_defDispWinTopOffset, m_defDispWinBottomOffset );
    1094   m_cTEncTop.setFrameFieldInfoPresentFlag( m_frameFieldInfoPresentFlag );
    1095   m_cTEncTop.setPocProportionalToTimingFlag( m_pocProportionalToTimingFlag );
    1096   m_cTEncTop.setNumTicksPocDiffOneMinus1   ( m_numTicksPocDiffOneMinus1    );
    1097   m_cTEncTop.setBitstreamRestrictionFlag( m_bitstreamRestrictionFlag );
    1098   m_cTEncTop.setTilesFixedStructureFlag( m_tilesFixedStructureFlag );
    1099   m_cTEncTop.setMotionVectorsOverPicBoundariesFlag( m_motionVectorsOverPicBoundariesFlag );
    1100   m_cTEncTop.setMinSpatialSegmentationIdc( m_minSpatialSegmentationIdc );
    1101   m_cTEncTop.setMaxBytesPerPicDenom( m_maxBytesPerPicDenom );
    1102   m_cTEncTop.setMaxBitsPerMinCuDenom( m_maxBitsPerMinCuDenom );
    1103   m_cTEncTop.setLog2MaxMvLengthHorizontal( m_log2MaxMvLengthHorizontal );
    1104   m_cTEncTop.setLog2MaxMvLengthVertical( m_log2MaxMvLengthVertical );
     1107  m_cTEncTop.setLFCrossTileBoundaryFlag                           ( m_bLFCrossTileBoundaryFlag );
     1108  m_cTEncTop.setWaveFrontSynchro                                  ( m_iWaveFrontSynchro );
     1109  m_cTEncTop.setWaveFrontSubstreams                               ( m_iWaveFrontSubstreams );
     1110  m_cTEncTop.setTMVPModeId                                        ( m_TMVPModeId );
     1111  m_cTEncTop.setUseScalingListId                                  ( m_useScalingListId  );
     1112  m_cTEncTop.setScalingListFile                                   ( m_scalingListFile   );
     1113  m_cTEncTop.setSignHideFlag                                      ( m_signHideFlag);
     1114  m_cTEncTop.setUseRateCtrl                                       ( m_RCEnableRateControl );
     1115  m_cTEncTop.setTargetBitrate                                     ( m_RCTargetBitrate );
     1116  m_cTEncTop.setKeepHierBit                                       ( m_RCKeepHierarchicalBit );
     1117  m_cTEncTop.setLCULevelRC                                        ( m_RCLCULevelRC );
     1118  m_cTEncTop.setUseLCUSeparateModel                               ( m_RCUseLCUSeparateModel );
     1119  m_cTEncTop.setInitialQP                                         ( m_RCInitialQP );
     1120  m_cTEncTop.setForceIntraQP                                      ( m_RCForceIntraQP );
     1121  m_cTEncTop.setTransquantBypassEnableFlag                        ( m_TransquantBypassEnableFlag );
     1122  m_cTEncTop.setCUTransquantBypassFlagForceValue                  ( m_CUTransquantBypassFlagForce );
     1123  m_cTEncTop.setCostMode                                          ( m_costMode );
     1124  m_cTEncTop.setUseRecalculateQPAccordingToLambda                 ( m_recalculateQPAccordingToLambda );
     1125  m_cTEncTop.setUseStrongIntraSmoothing                           ( m_useStrongIntraSmoothing );
     1126  m_cTEncTop.setActiveParameterSetsSEIEnabled                     ( m_activeParameterSetsSEIEnabled );
     1127  m_cTEncTop.setVuiParametersPresentFlag                          ( m_vuiParametersPresentFlag );
     1128  m_cTEncTop.setAspectRatioInfoPresentFlag                        ( m_aspectRatioInfoPresentFlag);
     1129  m_cTEncTop.setAspectRatioIdc                                    ( m_aspectRatioIdc );
     1130  m_cTEncTop.setSarWidth                                          ( m_sarWidth );
     1131  m_cTEncTop.setSarHeight                                         ( m_sarHeight );
     1132  m_cTEncTop.setOverscanInfoPresentFlag                           ( m_overscanInfoPresentFlag );
     1133  m_cTEncTop.setOverscanAppropriateFlag                           ( m_overscanAppropriateFlag );
     1134  m_cTEncTop.setVideoSignalTypePresentFlag                        ( m_videoSignalTypePresentFlag );
     1135  m_cTEncTop.setVideoFormat                                       ( m_videoFormat );
     1136  m_cTEncTop.setVideoFullRangeFlag                                ( m_videoFullRangeFlag );
     1137  m_cTEncTop.setColourDescriptionPresentFlag                      ( m_colourDescriptionPresentFlag );
     1138  m_cTEncTop.setColourPrimaries                                   ( m_colourPrimaries );
     1139  m_cTEncTop.setTransferCharacteristics                           ( m_transferCharacteristics );
     1140  m_cTEncTop.setMatrixCoefficients                                ( m_matrixCoefficients );
     1141  m_cTEncTop.setChromaLocInfoPresentFlag                          ( m_chromaLocInfoPresentFlag );
     1142  m_cTEncTop.setChromaSampleLocTypeTopField                       ( m_chromaSampleLocTypeTopField );
     1143  m_cTEncTop.setChromaSampleLocTypeBottomField                    ( m_chromaSampleLocTypeBottomField );
     1144  m_cTEncTop.setNeutralChromaIndicationFlag                       ( m_neutralChromaIndicationFlag );
     1145  m_cTEncTop.setDefaultDisplayWindow                              ( m_defDispWinLeftOffset, m_defDispWinRightOffset, m_defDispWinTopOffset, m_defDispWinBottomOffset );
     1146  m_cTEncTop.setFrameFieldInfoPresentFlag                         ( m_frameFieldInfoPresentFlag );
     1147  m_cTEncTop.setPocProportionalToTimingFlag                       ( m_pocProportionalToTimingFlag );
     1148  m_cTEncTop.setNumTicksPocDiffOneMinus1                          ( m_numTicksPocDiffOneMinus1    );
     1149  m_cTEncTop.setBitstreamRestrictionFlag                          ( m_bitstreamRestrictionFlag );
     1150  m_cTEncTop.setTilesFixedStructureFlag                           ( m_tilesFixedStructureFlag );
     1151  m_cTEncTop.setMotionVectorsOverPicBoundariesFlag                ( m_motionVectorsOverPicBoundariesFlag );
     1152  m_cTEncTop.setMinSpatialSegmentationIdc                         ( m_minSpatialSegmentationIdc );
     1153  m_cTEncTop.setMaxBytesPerPicDenom                               ( m_maxBytesPerPicDenom );
     1154  m_cTEncTop.setMaxBitsPerMinCuDenom                              ( m_maxBitsPerMinCuDenom );
     1155  m_cTEncTop.setLog2MaxMvLengthHorizontal                         ( m_log2MaxMvLengthHorizontal );
     1156  m_cTEncTop.setLog2MaxMvLengthVertical                           ( m_log2MaxMvLengthVertical );
    11051157}
    11061158#endif //SVC_EXTENSION
     
    11171169#if O0194_DIFFERENT_BITDEPTH_EL_BL
    11181170    //2
    1119     g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
    1120     g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
    1121 
    1122     g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
    1123     g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     1171    for( UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)
     1172    {
     1173      g_bitDepth[channelTypeIndex]    = m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     1174      g_PCMBitDepth[channelTypeIndex] = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepth[channelTypeIndex] : m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     1175    }
    11241176#endif
    11251177#if LAYER_CTB
     
    11291181    g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
    11301182#endif
     1183    // Video I/O
    11311184#if O0194_DIFFERENT_BITDEPTH_EL_BL
    1132     m_acTVideoIOYuvInputFile[layer].open( (Char *)m_acLayerCfg[layer].getInputFile().c_str(),  false, m_acLayerCfg[layer].m_inputBitDepthY, m_acLayerCfg[layer].m_inputBitDepthC, m_acLayerCfg[layer].m_internalBitDepthY, m_acLayerCfg[layer].m_internalBitDepthC );  // read  mode
    1133 #else
    1134     m_acTVideoIOYuvInputFile[layer].open( (Char *)m_acLayerCfg[layer].getInputFile().c_str(),  false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC );  // read  mode
    1135 #endif
    1136     m_acTVideoIOYuvInputFile[layer].skipFrames(m_FrameSkip, m_acLayerCfg[layer].getSourceWidth() - m_acLayerCfg[layer].getPad()[0], m_acLayerCfg[layer].getSourceHeight() - m_acLayerCfg[layer].getPad()[1]);
     1185    m_acTVideoIOYuvInputFile[layer].open( (Char *)m_acLayerCfg[layer].getInputFile().c_str(),  false, m_acLayerCfg[layer].m_inputBitDepth, m_acLayerCfg[layer].m_MSBExtendedBitDepth, m_acLayerCfg[layer].m_internalBitDepth );  // read  mode
     1186#else
     1187    m_acTVideoIOYuvInputFile[layer].open( (Char *)m_acLayerCfg[layer].getInputFile().c_str(),  false, m_inputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth );  // read  mode
     1188#endif
     1189    m_acTVideoIOYuvInputFile[layer].skipFrames(m_FrameSkip, m_acLayerCfg[layer].getSourceWidth() - m_acLayerCfg[layer].getPad()[0], m_acLayerCfg[layer].getSourceHeight() - m_acLayerCfg[layer].getPad()[1], m_acLayerCfg[layer].m_InputChromaFormatIDC);
    11371190
    11381191    if (!m_acLayerCfg[layer].getReconFile().empty())
    11391192    {
    11401193#if O0194_DIFFERENT_BITDEPTH_EL_BL
    1141       m_acTVideoIOYuvReconFile[layer].open((Char *)m_acLayerCfg[layer].getReconFile().c_str(), true, m_acLayerCfg[layer].m_outputBitDepthY, m_acLayerCfg[layer].m_outputBitDepthC, m_acLayerCfg[layer].m_internalBitDepthY, m_acLayerCfg[layer].m_internalBitDepthC );  // write mode
    1142 #else
    1143       m_acTVideoIOYuvReconFile[layer].open((Char *)m_acLayerCfg[layer].getReconFile().c_str(), true, m_outputBitDepthY, m_outputBitDepthC, m_internalBitDepthY, m_internalBitDepthC );  // write mode
    1144 #endif
    1145     }
    1146 
     1194      m_acTVideoIOYuvReconFile[layer].open((Char *)m_acLayerCfg[layer].getReconFile().c_str(), true, m_acLayerCfg[layer].m_outputBitDepth, m_acLayerCfg[layer].m_MSBExtendedBitDepth, m_acLayerCfg[layer].m_internalBitDepth );  // write mode
     1195#else
     1196      m_acTVideoIOYuvReconFile[layer].open((Char *)m_acLayerCfg[layer].getReconFile().c_str(), true, m_outputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth );  // write mode
     1197#endif
     1198    }
     1199
     1200    // Neo Decoder
    11471201    m_acTEncTop[layer].create();
    11481202  }
    11491203#else //SVC_EXTENSION
    1150   m_cTVideoIOYuvInputFile.open( m_pchInputFile,     false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC );  // read  mode
    1151   m_cTVideoIOYuvInputFile.skipFrames(m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1]);
     1204  // Video I/O
     1205  m_cTVideoIOYuvInputFile.open( m_pchInputFile,     false, m_inputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth );  // read  mode
     1206  m_cTVideoIOYuvInputFile.skipFrames(m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1], m_InputChromaFormatIDC);
    11521207
    11531208  if (m_pchReconFile)
    1154     m_cTVideoIOYuvReconFile.open(m_pchReconFile, true, m_outputBitDepthY, m_outputBitDepthC, m_internalBitDepthY, m_internalBitDepthC);  // write mode
     1209  {
     1210    m_cTVideoIOYuvReconFile.open(m_pchReconFile, true, m_outputBitDepth, m_outputBitDepth, m_internalBitDepth);  // write mode
     1211  }
    11551212
    11561213  // Neo Decoder
     
    12161273#if O0194_DIFFERENT_BITDEPTH_EL_BL
    12171274    //3
    1218     g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
    1219     g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
    1220 
    1221     g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
    1222     g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     1275    for (UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)
     1276    {
     1277      g_bitDepth[channelTypeIndex]    = m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     1278      g_PCMBitDepth[channelTypeIndex] = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepth[channelTypeIndex] : m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     1279    }
    12231280#endif
    12241281#if LAYER_CTB
     
    12581315      }
    12591316    }
    1260     for( Int setId = 1; setId < vps->getNumLayerSets(); setId++ )
     1317    for (Int setId = 1; setId < vps->getNumLayerSets(); setId++)
    12611318    {
    12621319#if OUTPUT_LAYER_SETS_CONFIG
     
    12711328#if O0194_DIFFERENT_BITDEPTH_EL_BL
    12721329        //4
    1273         g_bitDepthY = m_acLayerCfg[layerId].m_internalBitDepthY;
    1274         g_bitDepthC = m_acLayerCfg[layerId].m_internalBitDepthC;
    1275 
    1276         g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepthY : m_acLayerCfg[layerId].m_internalBitDepthY;
    1277         g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepthC : m_acLayerCfg[layerId].m_internalBitDepthC;
     1330        g_bitDepth[CHANNEL_TYPE_LUMA]   = m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_LUMA];
     1331        g_bitDepth[CHANNEL_TYPE_CHROMA] = m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
     1332
     1333        g_PCMBitDepth[CHANNEL_TYPE_LUMA]   = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepth[CHANNEL_TYPE_LUMA]   : m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_LUMA];
     1334        g_PCMBitDepth[CHANNEL_TYPE_CHROMA] = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepth[CHANNEL_TYPE_CHROMA] : m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
    12781335#endif
    12791336
     
    12931350#if O0194_DIFFERENT_BITDEPTH_EL_BL
    12941351        //4
    1295         g_bitDepthY = m_acLayerCfg[layerId].m_internalBitDepthY;
    1296         g_bitDepthC = m_acLayerCfg[layerId].m_internalBitDepthC;
    1297 
    1298         g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepthY : m_acLayerCfg[layerId].m_internalBitDepthY;
    1299         g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepthC : m_acLayerCfg[layerId].m_internalBitDepthC;
     1352        g_bitDepth[CHANNEL_TYPE_LUMA]   = m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_LUMA];
     1353        g_bitDepth[CHANNEL_TYPE_CHROMA] = m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
     1354
     1355        g_PCMBitDepth[CHANNEL_TYPE_LUMA]   = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepth[CHANNEL_TYPE_LUMA]   : m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_LUMA];
     1356        g_PCMBitDepth[CHANNEL_TYPE_CHROMA] = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepth[CHANNEL_TYPE_CHROMA] : m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
    13001357#endif
    13011358        if (layerId <= setId)
     
    16111668#endif
    16121669  vps->setOutputLayerFlag( 0, 0, 1 );
     1670
    16131671  // derive OutputLayerFlag[i][j]
    16141672#if !OUTPUT_LAYER_SETS_CONFIG
     
    20162074  Bool  bEos = false;
    20172075
     2076  const InputColourSpaceConversion ipCSC  =  m_inputColourSpaceConvert;
     2077  const InputColourSpaceConversion snrCSC = (!m_snrInternalColourSpace) ? m_inputColourSpaceConvert : IPCOLOURSPACE_UNCHANGED;
     2078
    20182079  list<AccessUnit> outputAccessUnits; ///< list of access units to write out.  is populated by the encoding process
     2080
     2081  TComPicYuv acPicYuvTrueOrg[MAX_LAYERS];
    20192082
    20202083  for(UInt layer=0; layer<m_numLayers; layer++)
     
    20222085#if O0194_DIFFERENT_BITDEPTH_EL_BL
    20232086    //5
    2024     g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
    2025     g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
    2026 
    2027     g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
    2028     g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     2087    g_bitDepth[CHANNEL_TYPE_LUMA]   = m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA];
     2088    g_bitDepth[CHANNEL_TYPE_CHROMA] = m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
     2089
     2090    g_PCMBitDepth[CHANNEL_TYPE_LUMA]   = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepth[CHANNEL_TYPE_LUMA] : m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA];
     2091    g_PCMBitDepth[CHANNEL_TYPE_CHROMA] = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepth[CHANNEL_TYPE_CHROMA] : m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
    20292092#endif
    20302093    // allocate original YUV buffer
     
    20322095    if( m_isField )
    20332096    {
    2034 #if SVC_EXTENSION
    20352097#if LAYER_CTB
    2036 #if AUXILIARY_PICTURES
    20372098      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_acLayerCfg[layer].getChromaFormatIDC(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
    2038 #else
    2039       pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
    2040 #endif
    2041 #else
    2042 #if AUXILIARY_PICTURES
     2099      acPicYuvTrueOrg[layer].create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_acLayerCfg[layer].getChromaFormatIDC(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
     2100#else
    20432101      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    2044 #else
    2045       pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    2046 #endif
    2047 #endif
    2048 #else
    2049       pcPicYuvOrg->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     2102      acPicYuvTrueOrg[layer].create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    20502103#endif
    20512104    }
    20522105    else
    20532106    {
    2054 #if SVC_EXTENSION
    20552107#if LAYER_CTB
    2056 #if AUXILIARY_PICTURES
    20572108      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
    2058 #else
    2059       pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
    2060 #endif
    2061 #else
    2062 #if AUXILIARY_PICTURES
     2109      acPicYuvTrueOrg[layer].create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
     2110#else
    20632111      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    2064 #else
    2065       pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    2066 #endif
    2067 #endif
    2068 #else
    2069       pcPicYuvOrg->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     2112      acPicYuvTrueOrg[layer].create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    20702113#endif
    20712114    }
     
    20832126#if O0194_DIFFERENT_BITDEPTH_EL_BL
    20842127        //6
    2085         g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
    2086         g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
    2087 
    2088         g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
    2089         g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     2128        for (UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)
     2129        {
     2130          g_bitDepth[channelTypeIndex]    = m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     2131          g_PCMBitDepth[channelTypeIndex] = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepth[channelTypeIndex] : m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     2132        }
    20902133#endif
    20912134#if LAYER_CTB
     
    21002143
    21012144        // read input YUV file
    2102         m_acTVideoIOYuvInputFile[layer].read( pcPicYuvOrg[layer], m_acLayerCfg[layer].getPad() );
     2145        m_acTVideoIOYuvInputFile[layer].read( pcPicYuvOrg[layer], &acPicYuvTrueOrg[layer], ipCSC, m_acLayerCfg[layer].getPad(), m_acLayerCfg[layer].getInputChromaFormat() );
    21032146
    21042147#if AUXILIARY_PICTURES
     
    21242167        if ( m_isField )
    21252168        {
    2126           m_acTEncTop[layer].encodePrep( pcPicYuvOrg[layer], m_isTopFieldFirst );
     2169          m_acTEncTop[layer].encodePrep( pcPicYuvOrg[layer], &acPicYuvTrueOrg[layer], m_isTopFieldFirst );
    21272170        }
    21282171        else
    21292172        {
    2130           m_acTEncTop[layer].encodePrep( pcPicYuvOrg[layer] );
     2173          m_acTEncTop[layer].encodePrep( pcPicYuvOrg[layer], &acPicYuvTrueOrg[layer] );
    21312174        }
    21322175      }
     
    21772220#if O0194_DIFFERENT_BITDEPTH_EL_BL
    21782221        //7
    2179         g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
    2180         g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
    2181 
    2182         g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
    2183         g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     2222        for (UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)
     2223        {
     2224          g_bitDepth[channelTypeIndex]    = m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     2225          g_PCMBitDepth[channelTypeIndex] = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepth[channelTypeIndex] : m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     2226        }
    21842227#endif
    21852228#if LAYER_CTB
     
    21952238#endif
    21962239        // call encoding function for one frame
    2197         if ( m_isField )
    2198         {
    2199           m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP, m_isTopFieldFirst );
    2200         }
    2201         else
    2202         {
    2203           m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP );
    2204         }
     2240        if ( m_isField ) m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], snrCSC, m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP, m_isTopFieldFirst );
     2241        else             m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], snrCSC, m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP );
    22052242      }
    22062243    }
     
    22092246    {
    22102247      list<AccessUnit>::iterator first_au = outputAccessUnits.begin();
     2248      if( m_nonHEVCBaseLayerFlag )
     2249      {
     2250        first_au++;
     2251      }
    22112252      AccessUnit::iterator it_sps;
    22122253      for (it_sps = first_au->begin(); it_sps != first_au->end(); it_sps++)
     
    22482289#if O0194_DIFFERENT_BITDEPTH_EL_BL
    22492290      //8
    2250       g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
    2251       g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
    2252 
    2253       g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
    2254       g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     2291      for (UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)
     2292      {
     2293        g_bitDepth[channelTypeIndex]    = m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     2294        g_PCMBitDepth[channelTypeIndex] = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepth[channelTypeIndex] : m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     2295      }
    22552296#endif
    22562297      // write bistream to file if necessary
     
    22892330    if (bEos)
    22902331    {
    2291       printOutSummary(m_isTopFieldFirst);
     2332      printOutSummary(m_isTopFieldFirst, m_printMSEBasedSequencePSNR, m_printSequenceMSE);
    22922333    }
    22932334
     
    23032344    // delete used buffers in encoder class
    23042345    m_acTEncTop[layer].deletePicBuffer();
     2346    acPicYuvTrueOrg[layer].destroy();
    23052347  }
    23062348
     
    23142356}
    23152357
    2316 Void TAppEncTop::printOutSummary(Bool isField)
     2358Void TAppEncTop::printOutSummary(Bool isField, const Bool printMSEBasedSNR, const Bool printSequenceMSE)
    23172359{
    23182360  UInt layer;
     
    23392381  //-- all
    23402382  printf( "\n\nSUMMARY --------------------------------------------------------\n" );
    2341   printf( "\tTotal Frames |  "   "Bitrate    "  "Y-PSNR    "  "U-PSNR    "  "V-PSNR \n" );
    23422383  for(layer = 0; layer < m_numLayers; layer++)
    23432384  {
    2344     m_gcAnalyzeAll[layer].printOut('a', layer);
     2385    m_gcAnalyzeAll[layer].printOut('a', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, layer);
    23452386  }
    23462387
    23472388  printf( "\n\nI Slices--------------------------------------------------------\n" );
    2348   printf( "\tTotal Frames |  "   "Bitrate    "  "Y-PSNR    "  "U-PSNR    "  "V-PSNR \n" );
    23492389  for(layer = 0; layer < m_numLayers; layer++)
    23502390  {
    2351     m_gcAnalyzeI[layer].printOut('i', layer);
     2391    m_gcAnalyzeI[layer].printOut('i', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, layer);
    23522392  }
    23532393
    23542394  printf( "\n\nP Slices--------------------------------------------------------\n" );
    2355   printf( "\tTotal Frames |  "   "Bitrate    "  "Y-PSNR    "  "U-PSNR    "  "V-PSNR \n" );
    23562395  for(layer = 0; layer < m_numLayers; layer++)
    23572396  {
    2358     m_gcAnalyzeP[layer].printOut('p', layer);
     2397    m_gcAnalyzeP[layer].printOut('p', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, layer);
    23592398  }
    23602399
    23612400  printf( "\n\nB Slices--------------------------------------------------------\n" );
    2362   printf( "\tTotal Frames |  "   "Bitrate    "  "Y-PSNR    "  "U-PSNR    "  "V-PSNR \n" );
    23632401  for(layer = 0; layer < m_numLayers; layer++)
    23642402  {
    2365     m_gcAnalyzeB[layer].printOut('b', layer);
     2403    m_gcAnalyzeB[layer].printOut('b', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, layer);
    23662404  }
    23672405
     
    23722410      //-- interlaced summary
    23732411      m_gcAnalyzeAll_in.setFrmRate( m_acLayerCfg[layer].getFrameRate());
     2412      m_gcAnalyzeAll_in.setBits(m_gcAnalyzeB[layer].getBits());
     2413      // prior to the above statement, the interlace analyser does not contain the correct total number of bits.
     2414
    23742415      printf( "\n\nSUMMARY INTERLACED ---------------------------------------------\n" );
    2375       m_gcAnalyzeAll_in.printOutInterlaced('a',  m_gcAnalyzeAll[layer].getBits());
     2416      m_gcAnalyzeAll_in.printOut('a', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, layer);
    23762417
    23772418#if _SUMMARY_OUT_
     
    23802421    }
    23812422  }
     2423
     2424  printf("\n");
     2425  //printf("\nRVM: %.3lf\n" , xCalculateRVM());
    23822426}
    23832427
    23842428#else
     2429// ====================================================================================================================
     2430// Public member functions
     2431// ====================================================================================================================
     2432
     2433/**
     2434 - create internal class
     2435 - initialize internal variable
     2436 - until the end of input YUV file, call encoding function in TEncTop class
     2437 - delete allocated buffers
     2438 - destroy internal class
     2439 .
     2440 */
    23852441Void TAppEncTop::encode()
    23862442{
     
    24002456  xInitLib(m_isField);
    24012457
     2458  printChromaFormat();
     2459
    24022460  // main encoder loop
    24032461  Int   iNumEncoded = 0;
    24042462  Bool  bEos = false;
    24052463
     2464  const InputColourSpaceConversion ipCSC  =  m_inputColourSpaceConvert;
     2465  const InputColourSpaceConversion snrCSC = (!m_snrInternalColourSpace) ? m_inputColourSpaceConvert : IPCOLOURSPACE_UNCHANGED;
     2466
    24062467  list<AccessUnit> outputAccessUnits; ///< list of access units to write out.  is populated by the encoding process
     2468
     2469  TComPicYuv cPicYuvTrueOrg;
    24072470
    24082471  // allocate original YUV buffer
    24092472  if( m_isField )
    24102473  {
    2411     pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeightOrg, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     2474    pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeightOrg, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     2475  cPicYuvTrueOrg.create(m_iSourceWidth, m_iSourceHeightOrg, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth);
    24122476  }
    24132477  else
    24142478  {
    2415     pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     2479    pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     2480  cPicYuvTrueOrg.create(m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth);
    24162481  }
    24172482
     
    24222487
    24232488    // read input YUV file
    2424     m_cTVideoIOYuvInputFile.read( pcPicYuvOrg, m_aiPad );
     2489    m_cTVideoIOYuvInputFile.read( pcPicYuvOrg, &cPicYuvTrueOrg, ipCSC, m_aiPad, m_InputChromaFormatIDC );
    24252490
    24262491    // increase number of received frames
     
    24282493
    24292494    bEos = (m_isField && (m_iFrameRcvd == (m_framesToBeEncoded >> 1) )) || ( !m_isField && (m_iFrameRcvd == m_framesToBeEncoded) );
     2495
    24302496    Bool flush = 0;
    24312497    // if end of file (which is only detected on a read failure) flush the encoder of any queued pictures
     
    24392505
    24402506    // call encoding function for one frame
    2441     if ( m_isField )
    2442     {
    2443       m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, m_cListPicYuvRec, outputAccessUnits, iNumEncoded, m_isTopFieldFirst);
    2444     }
    2445     else
    2446     {
    2447     m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, m_cListPicYuvRec, outputAccessUnits, iNumEncoded );
    2448     }
     2507    if ( m_isField ) m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, flush ? 0 : &cPicYuvTrueOrg, snrCSC, m_cListPicYuvRec, outputAccessUnits, iNumEncoded, m_isTopFieldFirst );
     2508    else             m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, flush ? 0 : &cPicYuvTrueOrg, snrCSC, m_cListPicYuvRec, outputAccessUnits, iNumEncoded );
    24492509
    24502510    // write bistream to file if necessary
     
    24652525  // delete used buffers in encoder class
    24662526  m_cTEncTop.deletePicBuffer();
     2527  cPicYuvTrueOrg.destroy();
    24672528
    24682529  // delete buffers & classes
     
    24922553
    24932554  // org. buffer
    2494   if ( m_acListPicYuvRec[layer].size() == (UInt)m_iGOPSize )
     2555  if ( m_acListPicYuvRec[layer].size() >= (UInt)m_iGOPSize ) // buffer will be 1 element longer when using field coding, to maintain first field whilst processing second.
    24952556  {
    24962557    rpcPicYuvRec = m_acListPicYuvRec[layer].popFront();
     
    25022563
    25032564#if LAYER_CTB
    2504 #if AUXILIARY_PICTURES
    25052565    rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
    25062566#else
    2507     rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
    2508 #endif
    2509 #else
    2510 #if AUXILIARY_PICTURES
    25112567    rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    2512 #else
    2513     rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    2514 #endif
    25152568#endif
    25162569
     
    25442597#endif
    25452598
     2599  const InputColourSpaceConversion ipCSC = (!m_outputInternalColourSpace) ? m_inputColourSpaceConvert : IPCOLOURSPACE_UNCHANGED;
     2600
    25462601  if (m_isField)
    25472602  {
     
    25672622      {
    25682623#if REPN_FORMAT_IN_VPS
    2569         m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRecTop, pcPicYuvRecBottom, m_acLayerCfg[layer].getConfWinLeft() * xScal, m_acLayerCfg[layer].getConfWinRight() * xScal,
    2570           m_acLayerCfg[layer].getConfWinTop() * yScal, m_acLayerCfg[layer].getConfWinBottom() * yScal, m_isTopFieldFirst );
    2571 #else
    2572         m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRecTop, pcPicYuvRecBottom, m_acLayerCfg[layer].getConfWinLeft(), m_acLayerCfg[layer].getConfWinRight(), m_acLayerCfg[layer].getConfWinTop(), m_acLayerCfg[layer].getConfWinBottom(), m_isTopFieldFirst );
     2624        m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRecTop, pcPicYuvRecBottom, ipCSC, m_acLayerCfg[layer].getConfWinLeft() * xScal, m_acLayerCfg[layer].getConfWinRight() * xScal,
     2625          m_acLayerCfg[layer].getConfWinTop() * yScal, m_acLayerCfg[layer].getConfWinBottom() * yScal, NUM_CHROMA_FORMAT, m_isTopFieldFirst );
     2626#else
     2627        m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRecTop, pcPicYuvRecBottom, ipCSC, m_acLayerCfg[layer].getConfWinLeft(), m_acLayerCfg[layer].getConfWinRight(), m_acLayerCfg[layer].getConfWinTop(), m_acLayerCfg[layer].getConfWinBottom(), NUM_CHROMA_FORMAT, m_isTopFieldFirst );
    25732628#endif
    25742629      }
     
    25962651      {
    25972652#if REPN_FORMAT_IN_VPS
    2598         m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConfWinLeft() * xScal, m_acLayerCfg[layer].getConfWinRight() * xScal,
     2653        m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, ipCSC, m_acLayerCfg[layer].getConfWinLeft() * xScal, m_acLayerCfg[layer].getConfWinRight() * xScal,
    25992654          m_acLayerCfg[layer].getConfWinTop() * yScal, m_acLayerCfg[layer].getConfWinBottom() * yScal );
    26002655#else
    2601         m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConfWinLeft(), m_acLayerCfg[layer].getConfWinRight(),
     2656        m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, ipCSC, m_acLayerCfg[layer].getConfWinLeft(), m_acLayerCfg[layer].getConfWinRight(),
    26022657          m_acLayerCfg[layer].getConfWinTop(), m_acLayerCfg[layer].getConfWinBottom() );
    26032658#endif
     
    26552710
    26562711  // org. buffer
    2657   if ( m_cListPicYuvRec.size() == (UInt)m_iGOPSize )
     2712  if ( m_cListPicYuvRec.size() >= (UInt)m_iGOPSize ) // buffer will be 1 element longer when using field coding, to maintain first field whilst processing second.
    26582713  {
    26592714    rpcPicYuvRec = m_cListPicYuvRec.popFront();
     
    26642719    rpcPicYuvRec = new TComPicYuv;
    26652720
    2666     rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     2721    rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
    26672722
    26682723  }
     
    26892744Void TAppEncTop::xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, const std::list<AccessUnit>& accessUnits)
    26902745{
     2746  const InputColourSpaceConversion ipCSC = (!m_outputInternalColourSpace) ? m_inputColourSpaceConvert : IPCOLOURSPACE_UNCHANGED;
     2747
    26912748  if (m_isField)
    26922749  {
     
    27082765      if (m_pchReconFile)
    27092766      {
    2710         m_cTVideoIOYuvReconFile.write( pcPicYuvRecTop, pcPicYuvRecBottom, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, m_isTopFieldFirst );
     2767        m_cTVideoIOYuvReconFile.write( pcPicYuvRecTop, pcPicYuvRecBottom, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, NUM_CHROMA_FORMAT, m_isTopFieldFirst );
    27112768      }
    27122769
     
    27232780  {
    27242781    Int i;
     2782
    27252783    TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.end();
    27262784    list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin();
     
    27362794      if (m_pchReconFile)
    27372795      {
    2738         m_cTVideoIOYuvReconFile.write( pcPicYuvRec, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom );
     2796        m_cTVideoIOYuvReconFile.write( pcPicYuvRec, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom );
    27392797      }
    27402798
     
    27502808 *
    27512809 */
    2752 void TAppEncTop::rateStatsAccum(const AccessUnit& au, const std::vector<UInt>& annexBsizes)
     2810Void TAppEncTop::rateStatsAccum(const AccessUnit& au, const std::vector<UInt>& annexBsizes)
    27532811{
    27542812  AccessUnit::const_iterator it_au = au.begin();
     
    27882846}
    27892847
    2790 void TAppEncTop::printRateSummary()
     2848Void TAppEncTop::printRateSummary()
    27912849{
    27922850#if SVC_EXTENSION
     
    28012859}
    28022860
     2861#if !SVC_EXTENSION
     2862Void TAppEncTop::printChromaFormat()
     2863{
     2864  std::cout << std::setw(43) << "Input ChromaFormatIDC = ";
     2865  switch (m_InputChromaFormatIDC)
     2866  {
     2867  case CHROMA_400:  std::cout << "  4:0:0"; break;
     2868  case CHROMA_420:  std::cout << "  4:2:0"; break;
     2869  case CHROMA_422:  std::cout << "  4:2:2"; break;
     2870  case CHROMA_444:  std::cout << "  4:4:4"; break;
     2871  default:
     2872    std::cerr << "Invalid";
     2873    exit(1);
     2874  }
     2875  std::cout << std::endl;
     2876
     2877  std::cout << std::setw(43) << "Output (internal) ChromaFormatIDC = ";
     2878  switch (m_cTEncTop.getChromaFormatIdc())
     2879  {
     2880  case CHROMA_400:  std::cout << "  4:0:0"; break;
     2881  case CHROMA_420:  std::cout << "  4:2:0"; break;
     2882  case CHROMA_422:  std::cout << "  4:2:2"; break;
     2883  case CHROMA_444:  std::cout << "  4:4:4"; break;
     2884  default:
     2885    std::cerr << "Invalid";
     2886    exit(1);
     2887  }
     2888  std::cout << "\n" << std::endl;
     2889}
     2890#endif
     2891
    28032892//! \}
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.h

    r595 r1029  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license. 
     4 * granted under this license.
    55 *
    66 * Copyright (c) 2010-2014, ITU/ISO/IEC
     
    7070  TVideoIOYuv                m_cTVideoIOYuvInputFile;       ///< input YUV file
    7171  TVideoIOYuv                m_cTVideoIOYuvReconFile;       ///< output reconstruction file
    72  
     72
    7373  TComList<TComPicYuv*>      m_cListPicYuvRec;              ///< list of reconstruction YUV files
    7474#endif
    7575 
    7676  Int                        m_iFrameRcvd;                  ///< number of received frames
    77  
     77
    7878  UInt m_essentialBytes;
    7979  UInt m_totalBytes;
     80
    8081protected:
    8182  // initialization
     
    8485  Void  xInitLib          (Bool isFieldCoding);             ///< initialize encoder class
    8586  Void  xDestroyLib       ();                               ///< destroy encoder class
    86  
     87
    8788  /// obtain required buffers
    8889#if SVC_EXTENSION
     
    9495  /// delete allocated buffers
    9596  Void  xDeleteBuffer     ();
    96  
     97
    9798  // file I/O
    9899#if SVC_EXTENSION
    99100  Void xWriteRecon(UInt layer, Int iNumEncoded);
    100101  Void xWriteStream(std::ostream& bitstreamFile, Int iNumEncoded, const std::list<AccessUnit>& accessUnits);
    101   Void printOutSummary(Bool isField);
     102  Void printOutSummary(Bool isField, const Bool printMSEBasedSNR, const Bool printSequenceMSE);
    102103#else
    103104  Void xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, const std::list<AccessUnit>& accessUnits); ///< write bitstream to file
     105  Void printChromaFormat();
    104106#endif
    105   void rateStatsAccum(const AccessUnit& au, const std::vector<UInt>& stats);
    106   void printRateSummary();
     107  Void rateStatsAccum(const AccessUnit& au, const std::vector<UInt>& stats);
     108  Void printRateSummary();
    107109 
    108110public:
    109111  TAppEncTop();
    110112  virtual ~TAppEncTop();
    111  
     113
    112114  Void        encode      ();                               ///< main encoding function
    113115#if SVC_EXTENSION
  • branches/SHM-dev/source/App/TAppEncoder/encmain.cpp

    r595 r1029  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license. 
     4 * granted under this license.
    55 *
    66 * Copyright (c) 2010-2014, ITU/ISO/IEC
     
    4141#include "TAppCommon/program_options_lite.h"
    4242
    43 using namespace std;
    44 namespace po = df::program_options_lite;
    45 
    4643//! \ingroup TAppEncoder
    4744//! \{
     45
     46#include "../Lib/TLibCommon/Debug.h"
    4847
    4948// ====================================================================================================================
     
    6059  fprintf( stdout, "SHM software: Encoder Version [%s]", NV_VERSION );
    6160#else
    62   fprintf( stdout, "HM software: Encoder Version [%s]", NV_VERSION );
     61  fprintf( stdout, "HM software: Encoder Version [%s] (including RExt)", NV_VERSION );
    6362#endif
    6463  fprintf( stdout, NVM_ONOS );
    6564  fprintf( stdout, NVM_COMPILEDBY );
    6665  fprintf( stdout, NVM_BITS );
    67   fprintf( stdout, "\n" );
     66  fprintf( stdout, "\n\n" );
    6867
    6968  // create application encoder class
     
    7675    {
    7776      cTAppEncTop.destroy();
     77#if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST
     78      EnvVar::printEnvVar();
     79#endif
    7880      return 1;
    7981    }
    8082  }
    81   catch (po::ParseFailure& e)
     83  catch (df::program_options_lite::ParseFailure &e)
    8284  {
    83     cerr << "Error parsing option \""<< e.arg <<"\" with argument \""<< e.val <<"\"." << endl;
     85    std::cerr << "Error parsing option \""<< e.arg <<"\" with argument \""<< e.val <<"\"." << std::endl;
    8486    return 1;
    8587  }
    8688
     89#if PRINT_MACRO_VALUES
     90  printMacroSettings();
     91#endif
     92
     93#if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST
     94  EnvVar::printEnvVarInUse();
     95#endif
     96
    8797  // starting time
    88   double dResult;
    89   long lBefore = clock();
     98  Double dResult;
     99  clock_t lBefore = clock();
    90100
    91101  // call encoding function
     
    93103
    94104  // ending time
    95   dResult = (double)(clock()-lBefore) / CLOCKS_PER_SEC;
     105  dResult = (Double)(clock()-lBefore) / CLOCKS_PER_SEC;
    96106  printf("\n Total Time: %12.3f sec.\n", dResult);
    97107
Note: See TracChangeset for help on using the changeset viewer.