Changeset 916 in SHVCSoftware for branches/SHM-upgrade/source/App/TAppEncoder


Ignore:
Timestamp:
12 Nov 2014, 08:09:17 (10 years ago)
Author:
seregin
Message:

initial porting

Location:
branches/SHM-upgrade/source/App/TAppEncoder
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-upgrade/source/App/TAppEncoder/TAppEncCfg.cpp

    r912 r916  
    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  // The following are RExt profiles, which would map to the MAINREXT profile idc.
     68  // The enumeration indicates the bit-depth constraint in the bottom 2 digits
     69  //                           the chroma format in the next digit
     70  //                           the intra constraint in the top digit
     71  MONOCHROME_8      = 1008,
     72  MONOCHROME_12     = 1012,
     73  MONOCHROME_16     = 1016,
     74  MAIN_12           = 1112,
     75  MAIN_422_10       = 1210,
     76  MAIN_422_12       = 1212,
     77  MAIN_444          = 1308,
     78  MAIN_444_10       = 1310,
     79  MAIN_444_12       = 1312,
     80  MAIN_444_16       = 1316, // non-standard profile definition, used for development purposes
     81  MAIN_INTRA        = 2108,
     82  MAIN_10_INTRA     = 2110,
     83  MAIN_12_INTRA     = 2112,
     84  MAIN_422_10_INTRA = 2210,
     85  MAIN_422_12_INTRA = 2212,
     86  MAIN_444_INTRA    = 2308,
     87  MAIN_444_10_INTRA = 2310,
     88  MAIN_444_12_INTRA = 2312,
     89  MAIN_444_16_INTRA = 2316,
     90#if SVC_EXTENSION
     91  SCALABLE          = 6,
     92  SCALABLE10        = 7,
     93#endif
     94};
     95
    5796
    5897//! \ingroup TAppEncoder
     
    78117, m_numOutputLayerSets          (-1)
    79118#endif
     119, m_inputColourSpaceConvert(IPCOLOURSPACE_UNCHANGED)
     120, m_snrInternalColourSpace(false)
     121, m_outputInternalColourSpace(false)
    80122, m_scalingListFile()
    81123, m_elRapSliceBEnabled(0)
     
    92134, m_pchBitstreamFile()
    93135, m_pchReconFile()
     136, m_inputColourSpaceConvert(IPCOLOURSPACE_UNCHANGED)
     137, m_snrInternalColourSpace(false)
     138, m_outputInternalColourSpace(false)
    94139, m_pchdQPFile()
    95140, m_scalingListFile()
     
    139184    m_targetPivotValue = NULL;
    140185  }
     186
    141187  free(m_pchInputFile);
    142188  free(m_pchBitstreamFile);
     
    242288}
    243289
    244 #if AUXILIARY_PICTURES
     290Bool confirmPara(Bool bflag, const Char* message);
     291
    245292static inline ChromaFormat numberToChromaFormat(const Int val)
    246293{
     
    254301  }
    255302}
    256 #endif
    257303
    258304#if SVC_EXTENSION
     
    282328#endif
    283329
    284 static const struct MapStrToProfile {
     330static const struct MapStrToProfile
     331{
    285332  const Char* str;
    286333  Profile::Name value;
    287 } strToProfile[] = {
    288   {"none", Profile::NONE},
    289   {"main", Profile::MAIN},
    290   {"main10", Profile::MAIN10},
    291   {"main-still-picture", Profile::MAINSTILLPICTURE},
     334}
     335strToProfile[] =
     336{
     337  {"none",                 Profile::NONE               },
     338  {"main",                 Profile::MAIN               },
     339  {"main10",               Profile::MAIN10             },
     340  {"main-still-picture",   Profile::MAINSTILLPICTURE   },
     341  {"main-RExt",            Profile::MAINREXT           },
     342  {"high-throughput-RExt", Profile::HIGHTHROUGHPUTREXT },
     343#if SVC_EXTENSION
     344  {"scalable",             Profile::SCALABLE           },
     345  {"scalable10",           Profile::SCALABLE10         },
     346#endif
    292347};
    293348
    294 static const struct MapStrToTier {
     349static const struct MapStrToExtendedProfile
     350{
     351  const Char* str;
     352  ExtendedProfileName value;
     353}
     354strToExtendedProfile[] =
     355{
     356    {"none",               NONE             },
     357    {"main",               MAIN             },
     358    {"main10",             MAIN10           },
     359    {"main-still-picture", MAINSTILLPICTURE },
     360    {"main-RExt",          MAINREXT         },
     361    {"high-throughput-RExt", HIGHTHROUGHPUTREXT },
     362    {"monochrome",         MONOCHROME_8     },
     363    {"monochrome12",       MONOCHROME_12    },
     364    {"monochrome16",       MONOCHROME_16    },
     365    {"main12",             MAIN_12          },
     366    {"main_422_10",        MAIN_422_10      },
     367    {"main_422_12",        MAIN_422_12      },
     368    {"main_444",           MAIN_444         },
     369    {"main_444_10",        MAIN_444_10      },
     370    {"main_444_12",        MAIN_444_12      },
     371    {"main_444_16",        MAIN_444_16      },
     372    {"main_intra",         MAIN_INTRA       },
     373    {"main_10_intra",      MAIN_10_INTRA    },
     374    {"main_12_intra",      MAIN_12_INTRA    },
     375    {"main_422_10_intra",  MAIN_422_10_INTRA},
     376    {"main_422_12_intra",  MAIN_422_12_INTRA},
     377    {"main_444_intra",     MAIN_444_INTRA   },
     378    {"main_444_10_intra",  MAIN_444_10_INTRA},
     379    {"main_444_12_intra",  MAIN_444_12_INTRA},
     380    {"main_444_16_intra",  MAIN_444_16_INTRA},
     381#if SVC_EXTENSION
     382    {"scalable",           SCALABLE         },
     383    {"scalable10",         SCALABLE10       },
     384#endif
     385};
     386
     387static const ExtendedProfileName validRExtProfileNames[2/* intraConstraintFlag*/][4/* bit depth constraint 8=0, 10=1, 12=2, 16=3*/][4/*chroma format*/]=
     388{
     389    {
     390        { MONOCHROME_8,  NONE,          NONE,              MAIN_444          }, // 8-bit  inter for 400, 420, 422 and 444
     391        { NONE,          NONE,          MAIN_422_10,       MAIN_444_10       }, // 10-bit inter for 400, 420, 422 and 444
     392        { MONOCHROME_12, MAIN_12,       MAIN_422_12,       MAIN_444_12       }, // 12-bit inter for 400, 420, 422 and 444
     393        { MONOCHROME_16, NONE,          NONE,              MAIN_444_16       }  // 16-bit inter for 400, 420, 422 and 444 (the latter is non standard used for development)
     394    },
     395    {
     396        { NONE,          MAIN_INTRA,    NONE,              MAIN_444_INTRA    }, // 8-bit  intra for 400, 420, 422 and 444
     397        { NONE,          MAIN_10_INTRA, MAIN_422_10_INTRA, MAIN_444_10_INTRA }, // 10-bit intra for 400, 420, 422 and 444
     398        { NONE,          MAIN_12_INTRA, MAIN_422_12_INTRA, MAIN_444_12_INTRA }, // 12-bit intra for 400, 420, 422 and 444
     399        { NONE,          NONE,          NONE,              MAIN_444_16_INTRA }  // 16-bit intra for 400, 420, 422 and 444
     400    }
     401};
     402
     403static const struct MapStrToTier
     404{
    295405  const Char* str;
    296406  Level::Tier value;
    297 } strToTier[] = {
     407}
     408strToTier[] =
     409{
    298410  {"main", Level::MAIN},
    299411  {"high", Level::HIGH},
    300412};
    301413
    302 static const struct MapStrToLevel {
     414static const struct MapStrToLevel
     415{
    303416  const Char* str;
    304417  Level::Name value;
    305 } strToLevel[] = {
     418}
     419strToLevel[] =
     420{
    306421  {"none",Level::NONE},
    307422  {"1",   Level::LEVEL1},
     
    318433  {"6.1", Level::LEVEL6_1},
    319434  {"6.2", Level::LEVEL6_2},
     435  {"8.5", Level::LEVEL8_5},
    320436};
    321437
     438static const struct MapStrToCostMode
     439{
     440  const Char* str;
     441  CostMode    value;
     442}
     443strToCostMode[] =
     444{
     445  {"lossy",                     COST_STANDARD_LOSSY},
     446  {"sequence_level_lossless",   COST_SEQUENCE_LEVEL_LOSSLESS},
     447  {"lossless",                  COST_LOSSLESS_CODING},
     448  {"mixed_lossless_lossy",      COST_MIXED_LOSSLESS_LOSSY_CODING}
     449};
     450
     451static const struct MapStrToScalingListMode
     452{
     453  const Char* str;
     454  ScalingListMode value;
     455}
     456strToScalingListMode[] =
     457{
     458  {"0",       SCALING_LIST_OFF},
     459  {"1",       SCALING_LIST_DEFAULT},
     460  {"2",       SCALING_LIST_FILE_READ},
     461  {"off",     SCALING_LIST_OFF},
     462  {"default", SCALING_LIST_DEFAULT},
     463  {"file",    SCALING_LIST_FILE_READ}
     464};
     465
    322466template<typename T, typename P>
    323 static istream& readStrToEnum(P map[], unsigned long mapLen, istream &in, T &val)
     467static std::string enumToString(P map[], UInt mapLen, const T val)
     468{
     469  for (UInt i = 0; i < mapLen; i++)
     470  {
     471    if (val == map[i].value)
     472    {
     473      return map[i].str;
     474    }
     475  }
     476  return std::string();
     477}
     478
     479template<typename T, typename P>
     480static istream& readStrToEnum(P map[], UInt mapLen, istream &in, T &val)
    324481{
    325482  string str;
    326483  in >> str;
    327484
    328   for (Int i = 0; i < mapLen; i++)
     485  for (UInt i = 0; i < mapLen; i++)
    329486  {
    330487    if (str == map[i].str)
     
    340497}
    341498
    342 static istream& operator>>(istream &in, Profile::Name &profile)
     499//inline to prevent compiler warnings for "unused static function"
     500
     501static inline istream& operator >> (istream &in, ExtendedProfileName &profile)
    343502{
    344   return readStrToEnum(strToProfile, sizeof(strToProfile)/sizeof(*strToProfile), in, profile);
     503  return readStrToEnum(strToExtendedProfile, sizeof(strToExtendedProfile)/sizeof(*strToExtendedProfile), in, profile);
    345504}
    346505
    347 static istream& operator>>(istream &in, Level::Tier &tier)
     506namespace Level
    348507{
    349   return readStrToEnum(strToTier, sizeof(strToTier)/sizeof(*strToTier), in, tier);
     508  static inline istream& operator >> (istream &in, Tier &tier)
     509  {
     510    return readStrToEnum(strToTier, sizeof(strToTier)/sizeof(*strToTier), in, tier);
     511  }
     512
     513  static inline istream& operator >> (istream &in, Name &level)
     514  {
     515    return readStrToEnum(strToLevel, sizeof(strToLevel)/sizeof(*strToLevel), in, level);
     516  }
    350517}
    351518
    352 static istream& operator>>(istream &in, Level::Name &level)
     519static inline istream& operator >> (istream &in, CostMode &mode)
    353520{
    354   return readStrToEnum(strToLevel, sizeof(strToLevel)/sizeof(*strToLevel), in, level);
     521  return readStrToEnum(strToCostMode, sizeof(strToCostMode)/sizeof(*strToCostMode), in, mode);
    355522}
    356523
     524static inline istream& operator >> (istream &in, ScalingListMode &mode)
     525{
     526  return readStrToEnum(strToScalingListMode, sizeof(strToScalingListMode)/sizeof(*strToScalingListMode), in, mode);
     527}
     528
     529template <class T>
     530struct SMultiValueInput
     531{
     532  const T              minValIncl;
     533  const T              maxValIncl; // Use 0 for unlimited
     534  const std::size_t    minNumValuesIncl;
     535  const std::size_t    maxNumValuesIncl; // Use 0 for unlimited
     536        std::vector<T> values;
     537  SMultiValueInput() : minValIncl(0), maxValIncl(0), minNumValuesIncl(0), maxNumValuesIncl(0), values() { }
     538  SMultiValueInput(std::vector<T> &defaults) : minValIncl(0), maxValIncl(0), minNumValuesIncl(0), maxNumValuesIncl(0), values(defaults) { }
     539  SMultiValueInput(const T &minValue, const T &maxValue, std::size_t minNumberValues=0, std::size_t maxNumberValues=0)
     540    : minValIncl(minValue), maxValIncl(maxValue), minNumValuesIncl(minNumberValues), maxNumValuesIncl(maxNumberValues), values()  { }
     541  SMultiValueInput(const T &minValue, const T &maxValue, std::size_t minNumberValues, std::size_t maxNumberValues, const T* defValues, const UInt numDefValues)
     542    : minValIncl(minValue), maxValIncl(maxValue), minNumValuesIncl(minNumberValues), maxNumValuesIncl(maxNumberValues), values(defValues, defValues+numDefValues)  { }
     543  SMultiValueInput<T> &operator=(const std::vector<T> &userValues) { values=userValues; return *this; }
     544  SMultiValueInput<T> &operator=(const SMultiValueInput<T> &userValues) { values=userValues.values; return *this; }
     545};
     546
     547static inline istream& operator >> (istream &in, SMultiValueInput<UInt> &values)
     548{
     549  values.values.clear();
     550  string str;
     551  in >> str;
     552  if (!str.empty())
     553  {
     554    const Char *pStr=str.c_str();
     555    // soak up any whitespace
     556    for(;isspace(*pStr);pStr++);
     557
     558    while (*pStr != 0)
     559    {
     560      Char *eptr;
     561      UInt val=strtoul(pStr, &eptr, 0);
     562      if (*eptr!=0 && !isspace(*eptr) && *eptr!=',')
     563      {
     564        in.setstate(ios::failbit);
     565        break;
     566      }
     567      if (val<values.minValIncl || val>values.maxValIncl)
     568      {
     569        in.setstate(ios::failbit);
     570        break;
     571      }
     572
     573      if (values.maxNumValuesIncl != 0 && values.values.size() >= values.maxNumValuesIncl)
     574      {
     575        in.setstate(ios::failbit);
     576        break;
     577      }
     578      values.values.push_back(val);
     579      // soak up any whitespace and up to 1 comma.
     580      pStr=eptr;
     581      for(;isspace(*pStr);pStr++);
     582      if (*pStr == ',') pStr++;
     583      for(;isspace(*pStr);pStr++);
     584    }
     585  }
     586  if (values.values.size() < values.minNumValuesIncl)
     587  {
     588    in.setstate(ios::failbit);
     589  }
     590  return in;
     591}
     592
     593static inline istream& operator >> (istream &in, SMultiValueInput<Int> &values)
     594{
     595  values.values.clear();
     596  string str;
     597  in >> str;
     598  if (!str.empty())
     599  {
     600    const Char *pStr=str.c_str();
     601    // soak up any whitespace
     602    for(;isspace(*pStr);pStr++);
     603
     604    while (*pStr != 0)
     605    {
     606      Char *eptr;
     607      Int val=strtol(pStr, &eptr, 0);
     608      if (*eptr!=0 && !isspace(*eptr) && *eptr!=',')
     609      {
     610        in.setstate(ios::failbit);
     611        break;
     612      }
     613      if (val<values.minValIncl || val>values.maxValIncl)
     614      {
     615        in.setstate(ios::failbit);
     616        break;
     617      }
     618
     619      if (values.maxNumValuesIncl != 0 && values.values.size() >= values.maxNumValuesIncl)
     620      {
     621        in.setstate(ios::failbit);
     622        break;
     623      }
     624      values.values.push_back(val);
     625      // soak up any whitespace and up to 1 comma.
     626      pStr=eptr;
     627      for(;isspace(*pStr);pStr++);
     628      if (*pStr == ',') pStr++;
     629      for(;isspace(*pStr);pStr++);
     630    }
     631  }
     632  if (values.values.size() < values.minNumValuesIncl)
     633  {
     634    in.setstate(ios::failbit);
     635  }
     636  return in;
     637}
     638
     639static inline istream& operator >> (istream &in, SMultiValueInput<Bool> &values)
     640{
     641  values.values.clear();
     642  string str;
     643  in >> str;
     644  if (!str.empty())
     645  {
     646    const Char *pStr=str.c_str();
     647    // soak up any whitespace
     648    for(;isspace(*pStr);pStr++);
     649
     650    while (*pStr != 0)
     651    {
     652      Char *eptr;
     653      Int val=strtol(pStr, &eptr, 0);
     654      if (*eptr!=0 && !isspace(*eptr) && *eptr!=',')
     655      {
     656        in.setstate(ios::failbit);
     657        break;
     658      }
     659      if (val<Int(values.minValIncl) || val>Int(values.maxValIncl))
     660      {
     661        in.setstate(ios::failbit);
     662        break;
     663      }
     664
     665      if (values.maxNumValuesIncl != 0 && values.values.size() >= values.maxNumValuesIncl)
     666      {
     667        in.setstate(ios::failbit);
     668        break;
     669      }
     670      values.values.push_back(val!=0);
     671      // soak up any whitespace and up to 1 comma.
     672      pStr=eptr;
     673      for(;isspace(*pStr);pStr++);
     674      if (*pStr == ',') pStr++;
     675      for(;isspace(*pStr);pStr++);
     676    }
     677  }
     678  if (values.values.size() < values.minNumValuesIncl)
     679  {
     680    in.setstate(ios::failbit);
     681  }
     682  return in;
     683}
     684
     685static Void
     686automaticallySelectRExtProfile(const Bool bUsingGeneralRExtTools,
     687                               const Bool bUsingChromaQPAdjustment,
     688                               const Bool bUsingExtendedPrecision,
     689                               const Bool bIntraConstraintFlag,
     690                               UInt &bitDepthConstraint,
     691                               ChromaFormat &chromaFormatConstraint,
     692                               const Int  maxBitDepth,
     693                               const ChromaFormat chromaFormat)
     694{
     695  // Try to choose profile, according to table in Q1013.
     696  UInt trialBitDepthConstraint=maxBitDepth;
     697  if (trialBitDepthConstraint<8) trialBitDepthConstraint=8;
     698  else if (trialBitDepthConstraint==9 || trialBitDepthConstraint==11) trialBitDepthConstraint++;
     699  else if (trialBitDepthConstraint>12) trialBitDepthConstraint=16;
     700
     701  // both format and bit depth constraints are unspecified
     702  if (bUsingExtendedPrecision || trialBitDepthConstraint==16)
     703  {
     704    bitDepthConstraint = 16;
     705    chromaFormatConstraint = (!bIntraConstraintFlag && chromaFormat==CHROMA_400) ? CHROMA_400 : CHROMA_444;
     706  }
     707  else if (bUsingGeneralRExtTools)
     708  {
     709    if (chromaFormat == CHROMA_400 && !bIntraConstraintFlag)
     710    {
     711      bitDepthConstraint = 16;
     712      chromaFormatConstraint = CHROMA_400;
     713    }
     714    else
     715    {
     716      bitDepthConstraint = trialBitDepthConstraint;
     717      chromaFormatConstraint = CHROMA_444;
     718    }
     719  }
     720  else if (chromaFormat == CHROMA_400)
     721  {
     722    if (bIntraConstraintFlag)
     723    {
     724      chromaFormatConstraint = CHROMA_420; // there is no intra 4:0:0 profile.
     725      bitDepthConstraint     = trialBitDepthConstraint;
     726    }
     727    else
     728    {
     729      chromaFormatConstraint = CHROMA_400;
     730      bitDepthConstraint     = trialBitDepthConstraint == 8 ? 8 : 12;
     731    }
     732  }
     733  else
     734  {
     735    bitDepthConstraint = trialBitDepthConstraint;
     736    chromaFormatConstraint = chromaFormat;
     737    if (bUsingChromaQPAdjustment && chromaFormat == CHROMA_420) chromaFormatConstraint = CHROMA_422; // 4:2:0 cannot use the chroma qp tool.
     738    if (chromaFormatConstraint == CHROMA_422 && bitDepthConstraint == 8) bitDepthConstraint = 10; // there is no 8-bit 4:2:2 profile.
     739    if (chromaFormatConstraint == CHROMA_420 && !bIntraConstraintFlag) bitDepthConstraint = 12; // there is no 8 or 10-bit 4:2:0 inter RExt profile.
     740  }
     741}
    357742// ====================================================================================================================
    358743// Public member functions
     
    381766  Int*    cfg_IntraPeriod   [MAX_LAYERS];
    382767  Int*    cfg_conformanceMode  [MAX_LAYERS];
     768  Bool*   cfg_useExtendedPrecision [MAX_LAYERS];
    383769#if LAYER_CTB
    384770  // coding unit (CU) definition
     
    394780  UInt*      cfg_uiQuadtreeTUMaxDepthIntra[MAX_LAYERS];
    395781#endif
    396 #if AUXILIARY_PICTURES
    397782  Int      cfg_tmpChromaFormatIDC  [MAX_LAYERS];
    398783  Int      cfg_tmpInputChromaFormat[MAX_LAYERS];
     784#if AUXILIARY_PICTURES
    399785  Int*     cfg_auxId               [MAX_LAYERS];
    400786#endif
     
    474860#endif
    475861#if O0194_DIFFERENT_BITDEPTH_EL_BL
    476   Int*    cfg_InputBitDepthY    [MAX_LAYERS];
    477   Int*    cfg_InternalBitDepthY [MAX_LAYERS];
    478   Int*    cfg_InputBitDepthC    [MAX_LAYERS];
    479   Int*    cfg_InternalBitDepthC [MAX_LAYERS];
    480   Int*    cfg_OutputBitDepthY   [MAX_LAYERS];
    481   Int*    cfg_OutputBitDepthC   [MAX_LAYERS];
     862  Int*    cfg_InputBitDepth    [MAX_NUM_CHANNEL_TYPE][MAX_LAYERS];
     863  Int*    cfg_InternalBitDepth [MAX_NUM_CHANNEL_TYPE][MAX_LAYERS];
     864  Int*    cfg_OutputBitDepth   [MAX_NUM_CHANNEL_TYPE][MAX_LAYERS];
    482865#endif
    483866  Int*    cfg_maxTidIlRefPicsPlus1[MAX_LAYERS];
     
    503886    cfg_IntraPeriod[layer]  = &m_acLayerCfg[layer].m_iIntraPeriod;
    504887    cfg_conformanceMode[layer] = &m_acLayerCfg[layer].m_conformanceMode;
     888    cfg_useExtendedPrecision[layer] = &m_acLayerCfg[layer].m_useExtendedPrecision;
    505889#if LAYER_CTB
    506890    // coding unit (CU) definition
     
    564948#endif
    565949#if O0194_DIFFERENT_BITDEPTH_EL_BL
    566   cfg_InputBitDepthY   [layer] = &m_acLayerCfg[layer].m_inputBitDepthY;
    567   cfg_InternalBitDepthY[layer] = &m_acLayerCfg[layer].m_internalBitDepthY;
    568   cfg_InputBitDepthC   [layer] = &m_acLayerCfg[layer].m_inputBitDepthC;
    569   cfg_InternalBitDepthC[layer] = &m_acLayerCfg[layer].m_internalBitDepthC;
    570   cfg_OutputBitDepthY  [layer] = &m_acLayerCfg[layer].m_outputBitDepthY;
    571   cfg_OutputBitDepthC  [layer] = &m_acLayerCfg[layer].m_outputBitDepthC;
    572 #endif
    573   cfg_maxTidIlRefPicsPlus1[layer] = &m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1;
     950    cfg_InputBitDepth   [CHANNEL_TYPE_LUMA][layer] = &m_acLayerCfg[layer].m_inputBitDepth[CHANNEL_TYPE_LUMA];
     951    cfg_InternalBitDepth[CHANNEL_TYPE_LUMA][layer] = &m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA];
     952    cfg_OutputBitDepth  [CHANNEL_TYPE_LUMA][layer] = &m_acLayerCfg[layer].m_outputBitDepth[CHANNEL_TYPE_LUMA];
     953    cfg_InternalBitDepth[CHANNEL_TYPE_CHROMA][layer] = &m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
     954    cfg_InputBitDepth   [CHANNEL_TYPE_CHROMA][layer] = &m_acLayerCfg[layer].m_inputBitDepth[CHANNEL_TYPE_CHROMA];
     955    cfg_OutputBitDepth  [CHANNEL_TYPE_CHROMA][layer] = &m_acLayerCfg[layer].m_outputBitDepth[CHANNEL_TYPE_CHROMA];
     956#endif
     957    cfg_maxTidIlRefPicsPlus1[layer] = &m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1;
    574958#if AUXILIARY_PICTURES
    575959    cfg_auxId[layer]                = &m_acLayerCfg[layer].m_auxId;
     
    611995#endif
    612996#endif //SVC_EXTENSION
    613   string cfgColumnWidth;
    614   string cfgRowHeight;
    615997  string cfg_ScalingListFile;
    616   string cfg_startOfCodedInterval;
    617   string cfg_codedPivotValue;
    618   string cfg_targetPivotValue;
    619 #if P0050_KNEE_FUNCTION_SEI
    620   string cfg_kneeSEIInputKneePointValue;
    621   string cfg_kneeSEIOutputKneePointValue;
    622 #endif
     998
     999  Int tmpChromaFormat;
     1000  Int tmpInputChromaFormat;
     1001  Int tmpConstraintChromaFormat;
     1002  string inputColourSpaceConvert;
     1003  ExtendedProfileName extendedProfile;
     1004  Int saoOffsetBitShift[MAX_NUM_CHANNEL_TYPE];
     1005
     1006  // Multi-value input fields:                                // minval, maxval (incl), min_entries, max_entries (incl) [, default values, number of default values]
     1007  SMultiValueInput<UInt> cfg_ColumnWidth                     (0, std::numeric_limits<UInt>::max(), 0, std::numeric_limits<UInt>::max());
     1008  SMultiValueInput<UInt> cfg_RowHeight                       (0, std::numeric_limits<UInt>::max(), 0, std::numeric_limits<UInt>::max());
     1009  SMultiValueInput<Int>  cfg_startOfCodedInterval            (std::numeric_limits<Int>::min(), std::numeric_limits<Int>::max(), 0, 1<<16);
     1010  SMultiValueInput<Int>  cfg_codedPivotValue                 (std::numeric_limits<Int>::min(), std::numeric_limits<Int>::max(), 0, 1<<16);
     1011  SMultiValueInput<Int>  cfg_targetPivotValue                (std::numeric_limits<Int>::min(), std::numeric_limits<Int>::max(), 0, 1<<16);
     1012
     1013  const UInt defaultInputKneeCodes[3]  = { 600, 800, 900 };
     1014  const UInt defaultOutputKneeCodes[3] = { 100, 250, 450 };
     1015  SMultiValueInput<UInt> cfg_kneeSEIInputKneePointValue      (1,  999, 0, 999, defaultInputKneeCodes,  sizeof(defaultInputKneeCodes )/sizeof(UInt));
     1016  SMultiValueInput<UInt> cfg_kneeSEIOutputKneePointValue     (0, 1000, 0, 999, defaultOutputKneeCodes, sizeof(defaultOutputKneeCodes)/sizeof(UInt));
     1017  const Int defaultPrimaryCodes[6]     = { 0,50000, 0,0, 50000,0 };
     1018  const Int defaultWhitePointCode[2]   = { 16667, 16667 };
     1019  SMultiValueInput<Int>  cfg_DisplayPrimariesCode            (0, 50000, 3, 3, defaultPrimaryCodes,   sizeof(defaultPrimaryCodes  )/sizeof(Int));
     1020  SMultiValueInput<Int>  cfg_DisplayWhitePointCode           (0, 50000, 2, 2, defaultWhitePointCode, sizeof(defaultWhitePointCode)/sizeof(Int));
     1021
     1022  SMultiValueInput<Bool> cfg_timeCodeSeiTimeStampFlag        (0,  1, 0, MAX_TIMECODE_SEI_SETS);
     1023  SMultiValueInput<Bool> cfg_timeCodeSeiNumUnitFieldBasedFlag(0,  1, 0, MAX_TIMECODE_SEI_SETS);
     1024  SMultiValueInput<Int>  cfg_timeCodeSeiCountingType         (0,  6, 0, MAX_TIMECODE_SEI_SETS);
     1025  SMultiValueInput<Bool> cfg_timeCodeSeiFullTimeStampFlag    (0,  1, 0, MAX_TIMECODE_SEI_SETS);
     1026  SMultiValueInput<Bool> cfg_timeCodeSeiDiscontinuityFlag    (0,  1, 0, MAX_TIMECODE_SEI_SETS);
     1027  SMultiValueInput<Bool> cfg_timeCodeSeiCntDroppedFlag       (0,  1, 0, MAX_TIMECODE_SEI_SETS);
     1028  SMultiValueInput<Int>  cfg_timeCodeSeiNumberOfFrames       (0,511, 0, MAX_TIMECODE_SEI_SETS);
     1029  SMultiValueInput<Int>  cfg_timeCodeSeiSecondsValue         (0, 59, 0, MAX_TIMECODE_SEI_SETS);
     1030  SMultiValueInput<Int>  cfg_timeCodeSeiMinutesValue         (0, 59, 0, MAX_TIMECODE_SEI_SETS);
     1031  SMultiValueInput<Int>  cfg_timeCodeSeiHoursValue           (0, 23, 0, MAX_TIMECODE_SEI_SETS);
     1032  SMultiValueInput<Bool> cfg_timeCodeSeiSecondsFlag          (0,  1, 0, MAX_TIMECODE_SEI_SETS);
     1033  SMultiValueInput<Bool> cfg_timeCodeSeiMinutesFlag          (0,  1, 0, MAX_TIMECODE_SEI_SETS);
     1034  SMultiValueInput<Bool> cfg_timeCodeSeiHoursFlag            (0,  1, 0, MAX_TIMECODE_SEI_SETS);
     1035  SMultiValueInput<Int>  cfg_timeCodeSeiTimeOffsetLength     (0, 31, 0, MAX_TIMECODE_SEI_SETS);
     1036  SMultiValueInput<Int>  cfg_timeCodeSeiTimeOffsetValue      (std::numeric_limits<Int>::min(), std::numeric_limits<Int>::max(), 0, MAX_TIMECODE_SEI_SETS);
     1037
    6231038#if Q0096_OVERLAY_SEI
    6241039  const Int CFG_MAX_OVERLAYS = 3;
     
    6391054  po::Options opts;
    6401055  opts.addOptions()
    641   ("help", do_help, false, "this help text")
    642   ("c", po::parseConfigFile, "configuration file name")
    643  
     1056  ("help",                                            do_help,                                          false, "this help text")
     1057  ("c",    po::parseConfigFile, "configuration file name")
     1058
    6441059  // File, I/O and source parameters
    6451060#if SVC_EXTENSION
    646   ("InputFile%d,-i%d",        cfg_InputFile,  string(""), MAX_LAYERS, "original YUV input file name for layer %d")
    647   ("ReconFile%d,-o%d",        cfg_ReconFile,  string(""), MAX_LAYERS, "reconstruction YUV input file name for layer %d")
    648   ("LayerConfig%d,-lc%d",     cfg_LayerCfgFile, string(""), MAX_LAYERS, "layer %d configuration file name")
    649   ("SourceWidth%d,-wdt%d",    cfg_SourceWidth, 0, MAX_LAYERS, "Source picture width for layer %d")
    650   ("SourceHeight%d,-hgt%d",   cfg_SourceHeight, 0, MAX_LAYERS, "Source picture height for layer %d")
    651   ("FrameRate%d,-fr%d",       cfg_FrameRate,  0, MAX_LAYERS, "Frame rate for layer %d")
    652   ("LambdaModifier%d,-LM%d",  m_adLambdaModifier, ( double )1.0, MAX_TLAYER, "Lambda modifier for temporal layer %d")
     1061  ("InputFile%d,-i%d",                              cfg_InputFile,                      string(""), MAX_LAYERS, "original YUV input file name for layer %d")
     1062  ("ReconFile%d,-o%d",                              cfg_ReconFile,                      string(""), MAX_LAYERS, "reconstruction YUV input file name for layer %d")
     1063  ("LayerConfig%d,-lc%d",                           cfg_LayerCfgFile,                  string(""), MAX_LAYERS, "layer %d configuration file name")
     1064  ("SourceWidth%d,-wdt%d",                          cfg_SourceWidth,                            0, MAX_LAYERS, "Source picture width for layer %d")
     1065  ("SourceHeight%d,-hgt%d",                         cfg_SourceHeight,                            0, MAX_LAYERS, "Source picture height for layer %d")
     1066  ("FrameRate%d,-fr%d",                             cfg_FrameRate,                               0, MAX_LAYERS, "Frame rate for layer %d")
     1067  ("LambdaModifier%d,-LM%d",                        m_adLambdaModifier,                Double(1.0), MAX_TLAYER, "Lambda modifier for temporal layer %d")
    6531068#if O0215_PHASE_ALIGNMENT
    654   ("PhaseAlignment",          m_phaseAlignFlag, false, "indicate the sample location alignment between layers (0: zero position aligned, 1: central position aligned)")
     1069  ("PhaseAlignment",                                m_phaseAlignFlag,                                    false, "indicate the sample location alignment between layers (0: zero position aligned, 1: central position aligned)")
    6551070#endif
    6561071#if REPN_FORMAT_IN_VPS
    657   ("RepFormatIdx%d",          cfg_repFormatIdx, -1, MAX_LAYERS, "Index to the representation format structure used from the VPS")
     1072  ("RepFormatIdx%d",                                cfg_repFormatIdx,                          -1, MAX_LAYERS, "Index to the representation format structure used from the VPS")
    6581073#endif
    6591074#if VPS_EXTN_DIRECT_REF_LAYERS
    660   ("NumSamplePredRefLayers%d",cfg_numSamplePredRefLayers, -1, MAX_LAYERS, "Number of sample prediction reference layers")
    661   ("SamplePredRefLayerIds%d", cfg_samplePredRefLayerIdsPtr, string(""), MAX_LAYERS, "sample pred reference layer IDs")
    662   ("NumMotionPredRefLayers%d",cfg_numMotionPredRefLayers, -1, MAX_LAYERS, "Number of motion prediction reference layers")
    663   ("MotionPredRefLayerIds%d", cfg_motionPredRefLayerIdsPtr, string(""), MAX_LAYERS, "motion pred reference layer IDs")
    664   ("NumActiveRefLayers%d",    cfg_numActiveRefLayers, -1, MAX_LAYERS, "Number of active reference layers")
    665   ("PredLayerIds%d",          cfg_predLayerIdsPtr, string(""), MAX_LAYERS, "inter-layer prediction layer IDs")
    666 #endif
    667   ("NumLayers",               m_numLayers, 1, "Number of layers to code")
     1075  ("NumSamplePredRefLayers%d",                      cfg_numSamplePredRefLayers,                -1, MAX_LAYERS, "Number of sample prediction reference layers")
     1076  ("SamplePredRefLayerIds%d",                       cfg_samplePredRefLayerIdsPtr,      string(""), MAX_LAYERS, "sample pred reference layer IDs")
     1077  ("NumMotionPredRefLayers%d",                      cfg_numMotionPredRefLayers,                -1, MAX_LAYERS, "Number of motion prediction reference layers")
     1078  ("MotionPredRefLayerIds%d",                       cfg_motionPredRefLayerIdsPtr,      string(""), MAX_LAYERS, "motion pred reference layer IDs")
     1079  ("NumActiveRefLayers%d",                          cfg_numActiveRefLayers,                    -1, MAX_LAYERS, "Number of active reference layers")
     1080  ("PredLayerIds%d",                                cfg_predLayerIdsPtr,                string(""), MAX_LAYERS, "inter-layer prediction layer IDs")
     1081#endif
     1082  ("NumLayers",                                     m_numLayers,                                            1, "Number of layers to code")
    6681083#if Q0078_ADD_LAYER_SETS
    6691084#if OUTPUT_LAYER_SETS_CONFIG
    670   ("NumLayerSets",            m_numLayerSets, 1, "Number of layer sets")
    671 #else
    672   ("NumLayerSets",            m_numLayerSets, 0, "Number of layer sets")
    673 #endif
    674   ("NumLayerInIdList%d",      cfg_numLayerInIdList, 0, MAX_VPS_LAYER_ID_PLUS1, "Number of layers in the set")
    675   ("LayerSetLayerIdList%d",   cfg_layerSetLayerIdListPtr, string(""), MAX_VPS_LAYER_ID_PLUS1, "Layer IDs for the set")
    676   ("NumAddLayerSets",         m_numAddLayerSets, 0, "Number of additional layer sets")
    677   ("NumHighestLayerIdx%d",    cfg_numHighestLayerIdx, 0, MAX_VPS_LAYER_ID_PLUS1, "Number of highest layer idx")
    678   ("HighestLayerIdx%d",       cfg_highestLayerIdxPtr, string(""), MAX_VPS_LAYER_ID_PLUS1, "Highest layer idx for an additional layer set")
     1085  ("NumLayerSets",                                  m_numLayerSets,                                          1, "Number of layer sets")
     1086#else
     1087  ("NumLayerSets",                                  m_numLayerSets,                                          0, "Number of layer sets")
     1088#endif
     1089  ("NumLayerInIdList%d",                            cfg_numLayerInIdList,            0, MAX_VPS_LAYER_ID_PLUS1, "Number of layers in the set")
     1090  ("LayerSetLayerIdList%d",                         cfg_layerSetLayerIdListPtr, string(""), MAX_VPS_LAYER_ID_PLUS1, "Layer IDs for the set")
     1091  ("NumAddLayerSets",                               m_numAddLayerSets,                                      0, "Number of additional layer sets")
     1092  ("NumHighestLayerIdx%d",                          cfg_numHighestLayerIdx,          0, MAX_VPS_LAYER_ID_PLUS1, "Number of highest layer idx")
     1093  ("HighestLayerIdx%d",                             cfg_highestLayerIdxPtr, string(""), MAX_VPS_LAYER_ID_PLUS1, "Highest layer idx for an additional layer set")
    6791094#endif
    6801095#if OUTPUT_LAYER_SETS_CONFIG
    681   ("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")
    682   ("NumOutputLayerSets",            m_numOutputLayerSets, 1, "Number of output layer sets excluding the 0-th output layer set")
    683   ("NumLayersInOutputLayerSet",   cfg_numLayersInOutputLayerSet, string(""), 1 , "List containing number of output layers in the output layer sets")
    684   ("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]")
    685   ("OutputLayerSetIdx",            cfg_outputLayerSetIdx, string(""), 1, "Corresponding layer set index, only for non-default output layer sets")
    686 #endif
     1096  ("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")
     1097  ("NumOutputLayerSets",                            m_numOutputLayerSets,                                    1, "Number of output layer sets excluding the 0-th output layer set")
     1098  ("NumLayersInOutputLayerSet",                     cfg_numLayersInOutputLayerSet,               string(""), 1, "List containing number of output layers in the output layer sets")
     1099  ("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]")
     1100  ("OutputLayerSetIdx",                             cfg_outputLayerSetIdx,                       string(""), 1, "Corresponding layer set index, only for non-default output layer sets")
     1101#endif
     1102  ("InputChromaFormat%d",                           cfg_tmpInputChromaFormat,                  420, MAX_LAYERS, "InputChromaFormatIDC for layer %d")
     1103  ("ChromaFormatIDC%d,-cf",                         cfg_tmpChromaFormatIDC,                    420, MAX_LAYERS, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat) for layer %d")
    6871104#if AUXILIARY_PICTURES
    688   ("InputChromaFormat%d",     cfg_tmpInputChromaFormat,  420, MAX_LAYERS, "InputChromaFormatIDC for layer %d")
    689   ("ChromaFormatIDC%d,-cf",   cfg_tmpChromaFormatIDC,    420, MAX_LAYERS, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat) for layer %d")
    690   ("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")
    691 #endif
    692   ("ConformanceMode%d",       cfg_conformanceMode,0, MAX_LAYERS, "Window conformance mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping")
    693   ("ScalabilityMask1",        m_scalabilityMask[1], 0, "scalability_mask[1] (multiview)")
    694   ("ScalabilityMask2",        m_scalabilityMask[2], 1, "scalability_mask[2] (scalable)" )
     1105  ("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")
     1106#endif
     1107  ("ExtendedPrecision%d",                           cfg_useExtendedPrecision,                false, MAX_LAYERS, "Increased internal accuracies to support high bit depths (not valid in V1 profiles)")
     1108  ("ConformanceMode%d",                             cfg_conformanceMode,                         0, MAX_LAYERS, "Window conformance mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping")
     1109  ("ScalabilityMask1",                              m_scalabilityMask[VIEW_ORDER_INDEX],                     0, "scalability_mask[1] (multiview)")
     1110  ("ScalabilityMask2",                              m_scalabilityMask[SCALABILITY_ID],                       1, "scalability_mask[2] (scalable)" )
    6951111#if AUXILIARY_PICTURES
    696   ("ScalabilityMask3",        m_scalabilityMask[3], 0, "scalability_mask[3] (auxiliary pictures)" )
    697 #endif
    698   ("BitstreamFile,b",         cfg_BitstreamFile, string(""), "Bitstream output file name")
     1112  ("ScalabilityMask3",                              m_scalabilityMask[AUX_ID],                              0, "scalability_mask[3] (auxiliary pictures)" )
     1113#endif
     1114  ("BitstreamFile,b",                               cfg_BitstreamFile, string(""), "Bitstream output file name")
    6991115#if !O0194_DIFFERENT_BITDEPTH_EL_BL
    700   ("InputBitDepth",           m_inputBitDepthY,    8, "Bit-depth of input file")
    701   ("OutputBitDepth",          m_outputBitDepthY,   0, "Bit-depth of output file (default:InternalBitDepth)")
    702   ("InternalBitDepth",        m_internalBitDepthY, 0, "Bit-depth the codec operates at. (default:InputBitDepth)"
    703                                                        "If different to InputBitDepth, source data will be converted")
    704   ("InputBitDepthC",          m_inputBitDepthC,    0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)")
    705   ("OutputBitDepthC",         m_outputBitDepthC,   0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
    706   ("InternalBitDepthC",       m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)")
    707 #endif
    708   ("NumScaledRefLayerOffsets%d",    cfg_numScaledRefLayerOffsets,     0, MAX_LAYERS,  "Number of scaled offset layer sets ")
     1116  ("InputBitDepth",                                 m_inputBitDepthY,                                        8, "Bit-depth of input file")
     1117  ("OutputBitDepth",                                m_outputBitDepthY,                                       0, "Bit-depth of output file (default:InternalBitDepth)")
     1118  ("InternalBitDepth",                              m_internalBitDepthY,                                    0, "Bit-depth the codec operates at. (default:InputBitDepth)"
     1119                                                                                                                "If different to InputBitDepth, source data will be converted")
     1120  ("InputBitDepthC",                                m_inputBitDepthC,                                        0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)")
     1121  ("OutputBitDepthC",                               m_outputBitDepthC,                                       0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
     1122  ("InternalBitDepthC",                             m_internalBitDepthC,                                    0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)")
     1123#endif
     1124  ("NumScaledRefLayerOffsets%d",                    cfg_numScaledRefLayerOffsets,                0, MAX_LAYERS,  "Number of scaled offset layer sets ")
    7091125#if O0098_SCALED_REF_LAYER_ID
    710   ("ScaledRefLayerId%d",           cfg_scaledRefLayerIdPtr,          string(""), MAX_LAYERS, "Layer ID of scaled base layer picture")
    711 #endif
    712   ("ScaledRefLayerLeftOffset%d",   cfg_scaledRefLayerLeftOffsetPtr,  string(""), MAX_LAYERS, "Horizontal offset of top-left luma sample of scaled base layer picture with respect to"
    713                                                                  " top-left luma sample of the EL picture, in units of two luma samples")
    714   ("ScaledRefLayerTopOffset%d",    cfg_scaledRefLayerTopOffsetPtr,   string(""), MAX_LAYERS,  "Vertical offset of top-left luma sample of scaled base layer picture with respect to"
    715                                                                  " top-left luma sample of the EL picture, in units of two luma samples")
    716   ("ScaledRefLayerRightOffset%d",  cfg_scaledRefLayerRightOffsetPtr, string(""), MAX_LAYERS, "Horizontal offset of bottom-right luma sample of scaled base layer picture with respect to"
    717                                                                  " bottom-right luma sample of the EL picture, in units of two luma samples")
    718   ("ScaledRefLayerBottomOffset%d", cfg_scaledRefLayerBottomOffsetPtr,string(""), MAX_LAYERS, "Vertical offset of bottom-right luma sample of scaled base layer picture with respect to"
    719   " bottom-right luma sample of the EL picture, in units of two luma samples")
     1126  ("ScaledRefLayerId%d",                            cfg_scaledRefLayerIdPtr,            string(""), MAX_LAYERS, "Layer ID of scaled base layer picture")
     1127#endif                                             
     1128  ("ScaledRefLayerLeftOffset%d",                    cfg_scaledRefLayerLeftOffsetPtr,    string(""), MAX_LAYERS, "Horizontal offset of top-left luma sample of scaled base layer picture with respect to"
     1129                                                                                                                " top-left luma sample of the EL picture, in units of two luma samples")
     1130  ("ScaledRefLayerTopOffset%d",                     cfg_scaledRefLayerTopOffsetPtr,     string(""), MAX_LAYERS, "Vertical offset of top-left luma sample of scaled base layer picture with respect to"
     1131                                                                                                                " top-left luma sample of the EL picture, in units of two luma samples")
     1132  ("ScaledRefLayerRightOffset%d",                   cfg_scaledRefLayerRightOffsetPtr,  string(""), MAX_LAYERS, "Horizontal offset of bottom-right luma sample of scaled base layer picture with respect to"
     1133                                                                                                                " bottom-right luma sample of the EL picture, in units of two luma samples")
     1134  ("ScaledRefLayerBottomOffset%d",                  cfg_scaledRefLayerBottomOffsetPtr,  string(""), MAX_LAYERS, "Vertical offset of bottom-right luma sample of scaled base layer picture with respect to"
     1135                                                                                                                " bottom-right luma sample of the EL picture, in units of two luma samples")
    7201136#if REF_REGION_OFFSET
    721   ("ScaledRefLayerOffsetPresentFlag%d",      cfg_scaledRefLayerOffsetPresentFlagPtr,    string(""), MAX_LAYERS, "presense flag of scaled reference layer offsets")
    722   ("RefRegionOffsetPresentFlag%d",           cfg_refRegionOffsetPresentFlagPtr,          string(""), MAX_LAYERS, "presense flag of reference region offsets")
    723   ("RefRegionLeftOffset%d",   cfg_refRegionLeftOffsetPtr,  string(""), MAX_LAYERS, "Horizontal offset of top-left luma sample of ref region with respect to"
    724                                                                  " top-left luma sample of the BL picture, in units of two luma samples")
    725   ("RefRegionTopOffset%d",    cfg_refRegionTopOffsetPtr,   string(""), MAX_LAYERS,  "Vertical offset of top-left luma sample of ref region with respect to"
    726                                                                  " top-left luma sample of the BL picture, in units of two luma samples")
    727   ("RefRegionRightOffset%d",  cfg_refRegionRightOffsetPtr, string(""), MAX_LAYERS, "Horizontal offset of bottom-right luma sample of ref region with respect to"
    728                                                                  " bottom-right luma sample of the BL picture, in units of two luma samples")
    729   ("RefRegionBottomOffset%d", cfg_refRegionBottomOffsetPtr,string(""), MAX_LAYERS, "Vertical offset of bottom-right luma sample of ref region with respect to"
    730                                                                  " bottom-right luma sample of the BL picture, in units of two luma samples")
     1137  ("ScaledRefLayerOffsetPresentFlag%d",         cfg_scaledRefLayerOffsetPresentFlagPtr, string(""), MAX_LAYERS, "presense flag of scaled reference layer offsets")
     1138  ("RefRegionOffsetPresentFlag%d",                  cfg_refRegionOffsetPresentFlagPtr,  string(""), MAX_LAYERS, "presense flag of reference region offsets")
     1139  ("RefRegionLeftOffset%d",                         cfg_refRegionLeftOffsetPtr,         string(""), MAX_LAYERS, "Horizontal offset of top-left luma sample of ref region with respect to"
     1140                                                                                                                " top-left luma sample of the BL picture, in units of two luma samples")
     1141  ("RefRegionTopOffset%d",                          cfg_refRegionTopOffsetPtr,          string(""), MAX_LAYERS, "Vertical offset of top-left luma sample of ref region with respect to"
     1142                                                                                                                " top-left luma sample of the BL picture, in units of two luma samples")
     1143  ("RefRegionRightOffset%d",                        cfg_refRegionRightOffsetPtr,        string(""), MAX_LAYERS, "Horizontal offset of bottom-right luma sample of ref region with respect to"
     1144                                                                                                                " bottom-right luma sample of the BL picture, in units of two luma samples")
     1145  ("RefRegionBottomOffset%d",                       cfg_refRegionBottomOffsetPtr,       string(""), MAX_LAYERS, "Vertical offset of bottom-right luma sample of ref region with respect to"
     1146                                                                                                                " bottom-right luma sample of the BL picture, in units of two luma samples")
    7311147#endif
    7321148#if R0209_GENERIC_PHASE
    733   ("ResamplePhaseSetPresentFlag%d",  cfg_resamplePhaseSetPresentFlagPtr, string(""), MAX_LAYERS, "presense flag of resample phase set")
    734   ("PhaseHorLuma%d",   cfg_phaseHorLumaPtr,   string(""), MAX_LAYERS, "luma shift in the horizontal direction used in resampling proces")
    735   ("PhaseVerLuma%d",   cfg_phaseVerLumaPtr,   string(""), MAX_LAYERS, "luma shift in the vertical   direction used in resampling proces")
    736   ("PhaseHorChroma%d", cfg_phaseHorChromaPtr, string(""), MAX_LAYERS, "chroma shift in the horizontal direction used in resampling proces")
    737   ("PhaseVerChroma%d", cfg_phaseVerChromaPtr, string(""), MAX_LAYERS, "chroma shift in the vertical   direction used in resampling proces")
     1149  ("ResamplePhaseSetPresentFlag%d",                 cfg_resamplePhaseSetPresentFlagPtr, string(""), MAX_LAYERS, "presense flag of resample phase set")
     1150  ("PhaseHorLuma%d",                                cfg_phaseHorLumaPtr,                string(""), MAX_LAYERS, "luma shift in the horizontal direction used in resampling proces")
     1151  ("PhaseVerLuma%d",                                cfg_phaseVerLumaPtr,                string(""), MAX_LAYERS, "luma shift in the vertical   direction used in resampling proces")
     1152  ("PhaseHorChroma%d",                              cfg_phaseHorChromaPtr,              string(""), MAX_LAYERS, "chroma shift in the horizontal direction used in resampling proces")
     1153  ("PhaseVerChroma%d",                              cfg_phaseVerChromaPtr,              string(""), MAX_LAYERS, "chroma shift in the vertical   direction used in resampling proces")
    7381154#endif
    7391155#if P0312_VERT_PHASE_ADJ
    740   ("VertPhasePositionEnableFlag%d", cfg_vertPhasePositionEnableFlagPtr,string(""), MAX_LAYERS, "VertPhasePositionEnableFlag for layer %d")
     1156  ("VertPhasePositionEnableFlag%d",                 cfg _vertPhasePositionEnableFlagPtr,string(""), MAX_LAYERS, "VertPhasePositionEnableFlag for layer %d")
    7411157#endif
    7421158#if Q0074_COLOUR_REMAPPING_SEI
    743   ("SEIColourRemappingInfoFile%d", cfg_colourRemapSEIFile, string(""), MAX_LAYERS, "Colour Remapping Information SEI parameters file name for layer %d")
     1159  ("SEIColourRemappingInfoFile%d",                   cfg_colourRemapSEIFile,          string(""), MAX_LAYERS, "Colour Remapping Information SEI parameters file name for layer %d")
    7441160#endif
    7451161#if O0194_DIFFERENT_BITDEPTH_EL_BL
    746   ("InputBitDepth%d",       cfg_InputBitDepthY,    8, MAX_LAYERS, "Bit-depth of input file for layer %d")
    747   ("InternalBitDepth%d",    cfg_InternalBitDepthY, 0, MAX_LAYERS, "Bit-depth the codec operates at. (default:InputBitDepth) for layer %d ")
    748 //                                                       "If different to InputBitDepth, source data will be converted")
    749   ("InputBitDepthC%d",      cfg_InputBitDepthC,    0, MAX_LAYERS, "As per InputBitDepth but for chroma component. (default:InputBitDepth) for layer %d")
    750   ("InternalBitDepthC%d",   cfg_InternalBitDepthC, 0, MAX_LAYERS, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth) for layer %d")
    751   ("OutputBitDepth%d",      cfg_OutputBitDepthY,   0, MAX_LAYERS, "Bit-depth of output file (default:InternalBitDepth)")
    752   ("OutputBitDepthC%d",     cfg_OutputBitDepthC,   0, MAX_LAYERS, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
    753 #endif
    754   ("MaxTidRefPresentFlag", m_maxTidRefPresentFlag, true, "max_tid_ref_present_flag (0: not present, 1: present(default)) " )
    755   ("MaxTidIlRefPicsPlus1%d", cfg_maxTidIlRefPicsPlus1, 1, MAX_LAYERS, "allowed maximum temporal_id for inter-layer prediction")
     1162  ("InputBitDepth%d",                                cfg_InputBitDepth[CHANNEL_TYPE_LUMA],      8, MAX_LAYERS, "Bit-depth of input file for layer %d")
     1163  ("InternalBitDepth%d",                             cfg_InternalBitDepth[CHANNEL_TYPE_LUMA],   0, MAX_LAYERS, "Bit-depth the codec operates at. (default:InputBitDepth) for layer %d "
     1164                                                                                                               " If different to InputBitDepth, source data will be converted")
     1165  ("OutputBitDepth%d",                               cfg_OutputBitDepth[CHANNEL_TYPE_LUMA],     0, MAX_LAYERS, "Bit-depth of output file (default:InternalBitDepth)")
     1166  ("InputBitDepthC%d",                               cfg_InputBitDepth[CHANNEL_TYPE_CHROMA],    0, MAX_LAYERS, "As per InputBitDepth but for chroma component. (default:InputBitDepth) for layer %d")
     1167  ("InternalBitDepthC%d",                            cfg_InternalBitDepth[CHANNEL_TYPE_CHROMA], 0, MAX_LAYERS, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth) for layer %d")
     1168  ("OutputBitDepthC%d",                              cfg_OutputBitDepth[CHANNEL_TYPE_CHROMA],   0, MAX_LAYERS, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
     1169#endif
     1170  ("MaxTidRefPresentFlag",                           m_maxTidRefPresentFlag,                            true, "max_tid_ref_present_flag (0: not present, 1: present(default)) " )
     1171  ("MaxTidIlRefPicsPlus1%d",                         cfg_maxTidIlRefPicsPlus1,                  1, MAX_LAYERS, "allowed maximum temporal_id for inter-layer prediction")
    7561172#if O0223_PICTURE_TYPES_ALIGN_FLAG
    757   ("CrossLayerPictureTypeAlignFlag", m_crossLayerPictureTypeAlignFlag, true, "align picture type across layers" ) 
    758 #endif
    759   ("CrossLayerIrapAlignFlag", m_crossLayerIrapAlignFlag, true, "align IRAP across layers" ) 
     1173  ("CrossLayerPictureTypeAlignFlag",                 m_crossLayerPictureTypeAlignFlag,                  true, "align picture type across layers" ) 
     1174#endif
     1175  ("CrossLayerIrapAlignFlag",                        m_crossLayerIrapAlignFlag,                          true, "align IRAP across layers" ) 
    7601176#if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG
    761   ("CrossLayerAlignedIdrOnlyFlag", m_crossLayerAlignedIdrOnlyFlag, true, "only idr for IRAP across layers" ) 
     1177  ("CrossLayerAlignedIdrOnlyFlag",                   m_crossLayerAlignedIdrOnlyFlag,                    true, "only idr for IRAP across layers" ) 
    7621178#endif
    7631179#if O0194_WEIGHTED_PREDICTION_CGS
    764   ("InterLayerWeightedPred", m_useInterLayerWeightedPred, false, "enable IL WP parameters estimation at encoder" ) 
     1180  ("InterLayerWeightedPred",                          m_useInterLayerWeightedPred,                      false, "enable IL WP parameters estimation at encoder" ) 
    7651181#endif
    7661182#if AVC_BASE
    7671183#if VPS_AVC_BL_FLAG_REMOVAL
    768   ("NonHEVCBase,-nonhevc",            m_nonHEVCBaseLayerFlag,     0, "BL is available but not internal")
    769 #else
    770   ("AvcBase,-avc",            m_avcBaseLayerFlag,     0, "avc_base_layer_flag")
    771 #endif
    772   ("InputBLFile,-ibl",        cfg_BLInputFile,     string(""), "Base layer rec YUV input file name")
    773 #endif
    774   ("EnableElRapB,-use-rap-b",  m_elRapSliceBEnabled, 0, "Set ILP over base-layer I picture to B picture (default is P picture)")
     1184  ("NonHEVCBase,-nonhevc",                            m_nonHEVCBaseLayerFlag,                                0, "BL is available but not internal")
     1185#else
     1186  ("AvcBase,-avc",                                    m_avcBaseLayerFlag,                                    0, "avc_base_layer_flag")
     1187#endif
     1188  ("InputBLFile,-ibl",                                cfg_BLInputFile,                              string(""), "Base layer rec YUV input file name")
     1189#endif
     1190  ("EnableElRapB,-use-rap-b",                         m_elRapSliceBEnabled,                                 0, "Set ILP over base-layer I picture to B picture (default is P picture)")
     1191  ("InputChromaFormat",                               tmpInputChromaFormat,                               420, "InputChromaFormatIDC")
     1192  ("ChromaFormatIDC,-cf",                             tmpChromaFormat,                                      0, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat)")
    7751193#else //SVC_EXTENSION
    776   ("InputFile,i",           cfg_InputFile,     string(""), "Original YUV input file name")
    777   ("BitstreamFile,b",       cfg_BitstreamFile, string(""), "Bitstream output file name")
    778   ("ReconFile,o",           cfg_ReconFile,     string(""), "Reconstructed YUV output file name")
    779   ("SourceWidth,-wdt",      m_iSourceWidth,        0, "Source picture width")
    780   ("SourceHeight,-hgt",     m_iSourceHeight,       0, "Source picture height")
    781   ("InputBitDepth",         m_inputBitDepthY,    8, "Bit-depth of input file")
    782   ("OutputBitDepth",        m_outputBitDepthY,   0, "Bit-depth of output file (default:InternalBitDepth)")
    783   ("InternalBitDepth",      m_internalBitDepthY, 0, "Bit-depth the codec operates at. (default:InputBitDepth)"
    784                                                        "If different to InputBitDepth, source data will be converted")
    785   ("InputBitDepthC",        m_inputBitDepthC,    0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)")
    786   ("OutputBitDepthC",       m_outputBitDepthC,   0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
    787   ("InternalBitDepthC",     m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)")
    788 #if AUXILIARY_PICTURES
    789   ("InputChromaFormat",     tmpInputChromaFormat,                       420, "InputChromaFormatIDC")
    790   ("ChromaFormatIDC,-cf",   tmpChromaFormat,                             0, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat)")
    791 #endif
    792   ("ConformanceMode",       m_conformanceWindowMode,  0, "Deprecated alias of ConformanceWindowMode")
    793   ("ConformanceWindowMode", m_conformanceWindowMode,  0, "Window conformance mode (0: no window, 1:automatic padding, 2:padding, 3:conformance")
    794   ("HorizontalPadding,-pdx",m_aiPad[0],               0, "Horizontal source padding for conformance window mode 2")
    795   ("VerticalPadding,-pdy",  m_aiPad[1],               0, "Vertical source padding for conformance window mode 2")
    796   ("ConfLeft",              m_confWinLeft,            0, "Deprecated alias of ConfWinLeft")
    797   ("ConfRight",             m_confWinRight,           0, "Deprecated alias of ConfWinRight")
    798   ("ConfTop",               m_confWinTop,             0, "Deprecated alias of ConfWinTop")
    799   ("ConfBottom",            m_confWinBottom,          0, "Deprecated alias of ConfWinBottom")
    800   ("ConfWinLeft",           m_confWinLeft,            0, "Left offset for window conformance mode 3")
    801   ("ConfWinRight",          m_confWinRight,           0, "Right offset for window conformance mode 3")
    802   ("ConfWinTop",            m_confWinTop,             0, "Top offset for window conformance mode 3")
    803   ("ConfWinBottom",         m_confWinBottom,          0, "Bottom offset for window conformance mode 3")
    804   ("FrameRate,-fr",         m_iFrameRate,          0, "Frame rate")
     1194  ("InputFile,i",                                     cfg_InputFile,                               string(""), "Original YUV input file name")
     1195  ("BitstreamFile,b",                                 cfg_BitstreamFile,                           string(""), "Bitstream output file name")
     1196  ("ReconFile,o",                                     cfg_ReconFile,                               string(""), "Reconstructed YUV output file name")
     1197  ("SourceWidth,-wdt",                                m_iSourceWidth,                                       0, "Source picture width")
     1198  ("SourceHeight,-hgt",                               m_iSourceHeight,                                      0, "Source picture height")
     1199  ("InputBitDepth",                                   m_inputBitDepth[CHANNEL_TYPE_LUMA],                   8, "Bit-depth of input file")
     1200  ("OutputBitDepth",                                  m_outputBitDepth[CHANNEL_TYPE_LUMA],                  0, "Bit-depth of output file (default:InternalBitDepth)")
     1201  ("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)")
     1202  ("InternalBitDepth",                                m_internalBitDepth[CHANNEL_TYPE_LUMA],                0, "Bit-depth the codec operates at. (default:MSBExtendedBitDepth). If different to MSBExtendedBitDepth, source data will be converted")
     1203  ("InputBitDepthC",                                  m_inputBitDepth[CHANNEL_TYPE_CHROMA],                 0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)")
     1204  ("OutputBitDepthC",                                 m_outputBitDepth[CHANNEL_TYPE_CHROMA],                0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
     1205  ("MSBExtendedBitDepthC",                            m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA],           0, "As per MSBExtendedBitDepth but for chroma component. (default:MSBExtendedBitDepth)")
     1206  ("InternalBitDepthC",                               m_internalBitDepth[CHANNEL_TYPE_CHROMA],              0, "As per InternalBitDepth but for chroma component. (default:InternalBitDepth)")
     1207  ("ExtendedPrecision",                               m_useExtendedPrecision,                           false, "Increased internal accuracies to support high bit depths (not valid in V1 profiles)")
     1208  ("HighPrecisionPredictionWeighting",                m_useHighPrecisionPredictionWeighting,            false, "Use high precision option for weighted prediction (not valid in V1 profiles)")
     1209  ("InputColourSpaceConvert",                         inputColourSpaceConvert,                     string(""), "Colour space conversion to apply to input video. Permitted values are (empty string=UNCHANGED) " + getListOfColourSpaceConverts(true))
     1210  ("SNRInternalColourSpace",                          m_snrInternalColourSpace,                         false, "If true, then no colour space conversion is applied prior to SNR, otherwise inverse of input is applied.")
     1211  ("OutputInternalColourSpace",                       m_outputInternalColourSpace,                      false, "If true, then no colour space conversion is applied for reconstructed video, otherwise inverse of input is applied.")
     1212  ("InputChromaFormat",                               tmpInputChromaFormat,                               420, "InputChromaFormatIDC")
     1213  ("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")
     1214  ("PrintFrameMSE",                                   m_printFrameMSE,                                  false, "0 (default) emit only bit count and PSNRs for each frame, 1 = also emit MSE values")
     1215  ("PrintSequenceMSE",                                m_printSequenceMSE,                               false, "0 (default) emit only bit rate and PSNRs for the whole sequence, 1 = also emit MSE values")
     1216  ("CabacZeroWordPaddingEnabled",                     m_cabacZeroWordPaddingEnabled,                    false, "0 (default) do not add conforming cabac-zero-words to bit streams, 1 = add cabac-zero-words")
     1217  ("ChromaFormatIDC,-cf",                             tmpChromaFormat,                                      0, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat)")
     1218  ("ConformanceMode",                                 m_conformanceWindowMode,                              0, "Deprecated alias of ConformanceWindowMode")
     1219  ("ConformanceWindowMode",                           m_conformanceWindowMode,                              0, "Window conformance mode (0: no window, 1:automatic padding, 2:padding, 3:conformance")
     1220  ("HorizontalPadding,-pdx",                          m_aiPad[0],                                           0, "Horizontal source padding for conformance window mode 2")
     1221  ("VerticalPadding,-pdy",                            m_aiPad[1],                                           0, "Vertical source padding for conformance window mode 2")
     1222  ("ConfLeft",                                        m_confWinLeft,                                        0, "Deprecated alias of ConfWinLeft")
     1223  ("ConfRight",                                       m_confWinRight,                                       0, "Deprecated alias of ConfWinRight")
     1224  ("ConfTop",                                         m_confWinTop,                                         0, "Deprecated alias of ConfWinTop")
     1225  ("ConfBottom",                                      m_confWinBottom,                                      0, "Deprecated alias of ConfWinBottom")
     1226  ("ConfWinLeft",                                     m_confWinLeft,                                        0, "Left offset for window conformance mode 3")
     1227  ("ConfWinRight",                                    m_confWinRight,                                       0, "Right offset for window conformance mode 3")
     1228  ("ConfWinTop",                                      m_confWinTop,                                         0, "Top offset for window conformance mode 3")
     1229  ("ConfWinBottom",                                   m_confWinBottom,                                      0, "Bottom offset for window conformance mode 3")
     1230  ("FrameRate,-fr",                                   m_iFrameRate,                                         0, "Frame rate")
    8051231#if Q0074_COLOUR_REMAPPING_SEI
    806   ("SEIColourRemappingInfoFile", cfg_colourRemapSEIFile, string(""), "Colour Remapping Information SEI parameters file name")
     1232  ("SEIColourRemappingInfoFile",                      cfg_colourRemapSEIFile, string(""), "Colour Remapping Information SEI parameters file name")
    8071233#endif
    8081234#endif //SVC_EXTENSION
    809   ("FrameSkip,-fs",         m_FrameSkip,          0u, "Number of frames to skip at start of input YUV")
    810   ("FramesToBeEncoded,f",   m_framesToBeEncoded,   0, "Number of frames to be encoded (default=all)")
     1235  ("FrameSkip,-fs",                                   m_FrameSkip,                                         0u, "Number of frames to skip at start of input YUV")
     1236  ("FramesToBeEncoded,f",                             m_framesToBeEncoded,                                  0, "Number of frames to be encoded (default=all)")
    8111237
    8121238  //Field coding parameters
    813   ("FieldCoding", m_isField, false, "Signals if it's a field based coding")
    814   ("TopFieldFirst, Tff", m_isTopFieldFirst, false, "In case of field based coding, signals whether if it's a top field first or not")
    815  
     1239  ("FieldCoding",                                     m_isField,                                        false, "Signals if it's a field based coding")
     1240  ("TopFieldFirst, Tff",                              m_isTopFieldFirst,                                false, "In case of field based coding, signals whether if it's a top field first or not")
     1241
    8161242  // Profile and level
    817   ("Profile", m_profile,   Profile::NONE, "Profile to be used when encoding (Incomplete)")
    818   ("Level",   m_level,     Level::NONE,   "Level limit to be used, eg 5.1 (Incomplete)")
    819   ("Tier",    m_levelTier, Level::MAIN,   "Tier to use for interpretation of --Level")
    820 
    821   ("ProgressiveSource", m_progressiveSourceFlag, false, "Indicate that source is progressive")
    822   ("InterlacedSource",  m_interlacedSourceFlag,  false, "Indicate that source is interlaced")
    823   ("NonPackedSource",   m_nonPackedConstraintFlag, false, "Indicate that source does not contain frame packing")
    824   ("FrameOnly",         m_frameOnlyConstraintFlag, false, "Indicate that the bitstream contains only frames")
     1243  ("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")
     1244  ("Level",                                           m_level,                                    Level::NONE, "Level limit to be used, eg 5.1, or none")
     1245  ("Tier",                                            m_levelTier,                                Level::MAIN, "Tier to use for interpretation of --Level (main or high only)")
     1246  ("MaxBitDepthConstraint",                           m_bitDepthConstraint,                                0u, "Bit depth to use for profile-constraint for RExt profiles. 0=automatically choose based upon other parameters")
     1247  ("MaxChromaFormatConstraint",                       tmpConstraintChromaFormat,                            0, "Chroma-format to use for the profile-constraint for RExt profiles. 0=automatically choose based upon other parameters")
     1248  ("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)")
     1249  ("LowerBitRateConstraintFlag",                      m_lowerBitRateConstraintFlag,                      true, "Value of general_lower_bit_rate_constraint_flag to use for RExt profiles")
     1250
     1251  ("ProgressiveSource",                               m_progressiveSourceFlag,                          false, "Indicate that source is progressive")
     1252  ("InterlacedSource",                                m_interlacedSourceFlag,                           false, "Indicate that source is interlaced")
     1253  ("NonPackedSource",                                 m_nonPackedConstraintFlag,                        false, "Indicate that source does not contain frame packing")
     1254  ("FrameOnly",                                       m_frameOnlyConstraintFlag,                        false, "Indicate that the bitstream contains only frames")
    8251255
    8261256#if LAYER_CTB
    8271257  // Unit definition parameters
    828   ("MaxCUWidth%d",              cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU width")
    829   ("MaxCUHeight%d",             cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU height")
     1258  ("MaxCUWidth%d",                                    cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU width")
     1259  ("MaxCUHeight%d",                                   cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU height")
    8301260  // todo: remove defaults from MaxCUSize
    831   ("MaxCUSize%d,s%d",           cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU size")
    832   ("MaxCUSize%d,s%d",           cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU size")
    833   ("MaxPartitionDepth%d,h%d",   cfg_uiMaxCUDepth,              4u, MAX_LAYERS, "CU depth")
     1261  ("MaxCUSize%d,s%d",                                 cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU size")
     1262  ("MaxCUSize%d,s%d",                                 cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU size")
     1263  ("MaxPartitionDepth%d,h%d",                         cfg_uiMaxCUDepth,              4u, MAX_LAYERS, "CU depth")
    8341264 
    835   ("QuadtreeTULog2MaxSize%d",   cfg_uiQuadtreeTULog2MaxSize,   6u, MAX_LAYERS, "Maximum TU size in logarithm base 2")
    836   ("QuadtreeTULog2MinSize%d",   cfg_uiQuadtreeTULog2MinSize,   2u, MAX_LAYERS, "Minimum TU size in logarithm base 2")
     1265  ("QuadtreeTULog2MaxSize%d",                         cfg_uiQuadtreeTULog2MaxSize,   6u, MAX_LAYERS, "Maximum TU size in logarithm base 2")
     1266  ("QuadtreeTULog2MinSize%d",                         cfg_uiQuadtreeTULog2MinSize,   2u, MAX_LAYERS, "Minimum TU size in logarithm base 2")
    8371267 
    838   ("QuadtreeTUMaxDepthIntra%d", cfg_uiQuadtreeTUMaxDepthIntra, 1u, MAX_LAYERS, "Depth of TU tree for intra CUs")
    839   ("QuadtreeTUMaxDepthInter%d", cfg_uiQuadtreeTUMaxDepthInter, 2u, MAX_LAYERS, "Depth of TU tree for inter CUs")
     1268  ("QuadtreeTUMaxDepthIntra%d",                       cfg_uiQuadtreeTUMaxDepthIntra, 1u, MAX_LAYERS, "Depth of TU tree for intra CUs")
     1269  ("QuadtreeTUMaxDepthInter%d",                       cfg_uiQuadtreeTUMaxDepthInter, 2u, MAX_LAYERS, "Depth of TU tree for inter CUs")
    8401270
    8411271
    8421272  // set the same CU realted settings across all the layers if config file parameters are not layer specific
    843   ("MaxCUWidth",              cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU width")
    844   ("MaxCUHeight",             cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU height")
     1273  ("MaxCUWidth",                                      cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU width")
     1274  ("MaxCUHeight",                                     cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU height")
    8451275  // todo: remove defaults from MaxCUSize
    846   ("MaxCUSize,s",             cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU size")
    847   ("MaxCUSize,s",             cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU size")
    848   ("MaxPartitionDepth,h",     cfg_uiMaxCUDepth,              4u, MAX_LAYERS, "CU depth")
     1276  ("MaxCUSize,s",                                     cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU size")
     1277  ("MaxCUSize,s",                                     cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU size")
     1278  ("MaxPartitionDepth,h",                             cfg_uiMaxCUDepth,              4u, MAX_LAYERS, "CU depth")
    8491279 
    850   ("QuadtreeTULog2MaxSize",   cfg_uiQuadtreeTULog2MaxSize,   6u, MAX_LAYERS, "Maximum TU size in logarithm base 2")
    851   ("QuadtreeTULog2MinSize",   cfg_uiQuadtreeTULog2MinSize,   2u, MAX_LAYERS, "Minimum TU size in logarithm base 2")
     1280  ("QuadtreeTULog2MaxSize",                           cfg_uiQuadtreeTULog2MaxSize,   6u, MAX_LAYERS, "Maximum TU size in logarithm base 2")
     1281  ("QuadtreeTULog2MinSize",                           cfg_uiQuadtreeTULog2MinSize,   2u, MAX_LAYERS, "Minimum TU size in logarithm base 2")
    8521282 
    853   ("QuadtreeTUMaxDepthIntra", cfg_uiQuadtreeTUMaxDepthIntra, 1u, MAX_LAYERS, "Depth of TU tree for intra CUs")
    854   ("QuadtreeTUMaxDepthInter", cfg_uiQuadtreeTUMaxDepthInter, 2u, MAX_LAYERS, "Depth of TU tree for inter CUs")
     1283  ("QuadtreeTUMaxDepthIntra",                         cfg_uiQuadtreeTUMaxDepthIntra, 1u, MAX_LAYERS, "Depth of TU tree for intra CUs")
     1284  ("QuadtreeTUMaxDepthInter",                         cfg_uiQuadtreeTUMaxDepthInter, 2u, MAX_LAYERS, "Depth of TU tree for inter CUs")
    8551285#else
    8561286  // Unit definition parameters
    857   ("MaxCUWidth",              m_uiMaxCUWidth,             64u)
    858   ("MaxCUHeight",             m_uiMaxCUHeight,            64u)
     1287  ("MaxCUWidth",                                      m_uiMaxCUWidth,                                     64u)
     1288  ("MaxCUHeight",                                     m_uiMaxCUHeight,                                    64u)
    8591289  // todo: remove defaults from MaxCUSize
    860   ("MaxCUSize,s",             m_uiMaxCUWidth,             64u, "Maximum CU size")
    861   ("MaxCUSize,s",             m_uiMaxCUHeight,            64u, "Maximum CU size")
    862   ("MaxPartitionDepth,h",     m_uiMaxCUDepth,              4u, "CU depth")
    863  
    864   ("QuadtreeTULog2MaxSize",   m_uiQuadtreeTULog2MaxSize,   6u, "Maximum TU size in logarithm base 2")
    865   ("QuadtreeTULog2MinSize",   m_uiQuadtreeTULog2MinSize,   2u, "Minimum TU size in logarithm base 2")
    866  
    867   ("QuadtreeTUMaxDepthIntra", m_uiQuadtreeTUMaxDepthIntra, 1u, "Depth of TU tree for intra CUs")
    868   ("QuadtreeTUMaxDepthInter", m_uiQuadtreeTUMaxDepthInter, 2u, "Depth of TU tree for inter CUs")
     1290  ("MaxCUSize,s",                                     m_uiMaxCUWidth,                                     64u, "Maximum CU size")
     1291  ("MaxCUSize,s",                                     m_uiMaxCUHeight,                                    64u, "Maximum CU size")
     1292  ("MaxPartitionDepth,h",                             m_uiMaxCUDepth,                                      4u, "CU depth")
     1293
     1294  ("QuadtreeTULog2MaxSize",                           m_uiQuadtreeTULog2MaxSize,                           6u, "Maximum TU size in logarithm base 2")
     1295  ("QuadtreeTULog2MinSize",                           m_uiQuadtreeTULog2MinSize,                           2u, "Minimum TU size in logarithm base 2")
     1296
     1297  ("QuadtreeTUMaxDepthIntra",                         m_uiQuadtreeTUMaxDepthIntra,                        1u, "Depth of TU tree for intra CUs")
     1298  ("QuadtreeTUMaxDepthInter",                         m_uiQuadtreeTUMaxDepthInter,                        2u, "Depth of TU tree for inter CUs")
    8691299#endif
    8701300 
    8711301  // Coding structure paramters
    8721302#if SVC_EXTENSION
    873   ("IntraPeriod%d,-ip%d",  cfg_IntraPeriod, -1, MAX_LAYERS, "intra period in frames for layer %d, (-1: only first frame)")
    874 #else
    875   ("IntraPeriod,-ip",         m_iIntraPeriod,              -1, "Intra period in frames, (-1: only first frame)")
     1303  ("IntraPeriod%d,-ip%d",                             cfg_IntraPeriod, -1, MAX_LAYERS, "intra period in frames for layer %d, (-1: only first frame)")
     1304#else
     1305  ("IntraPeriod,-ip",                                 m_iIntraPeriod,                                      -1, "Intra period in frames, (-1: only first frame)")
    8761306#endif
    8771307#if ALLOW_RECOVERY_POINT_AS_RAP
    878   ("DecodingRefreshType,-dr", m_iDecodingRefreshType,       0, "Intra refresh type (0:none 1:CRA 2:IDR 3:RecPointSEI)")
    879 #else
    880   ("DecodingRefreshType,-dr", m_iDecodingRefreshType,       0, "Intra refresh type (0:none 1:CRA 2:IDR)")
    881 #endif
    882   ("GOPSize,g",               m_iGOPSize,                   1, "GOP size of temporal structure")
    883   // motion options
    884   ("FastSearch",              m_iFastSearch,                1, "0:Full search  1:Diamond  2:PMVFAST")
    885   ("SearchRange,-sr",         m_iSearchRange,              96, "Motion search range")
    886   ("BipredSearchRange",       m_bipredSearchRange,          4, "Motion search range for bipred refinement")
    887   ("HadamardME",              m_bUseHADME,               true, "Hadamard ME for fractional-pel")
    888   ("ASR",                     m_bUseASR,                false, "Adaptive motion search range")
     1308  ("DecodingRefreshType,-dr",                         m_iDecodingRefreshType,                               0, "Intra refresh type (0:none 1:CRA 2:IDR 3:RecPointSEI)")
     1309#else
     1310  ("DecodingRefreshType,-dr",                         m_iDecodingRefreshType,                               0, "Intra refresh type (0:none 1:CRA 2:IDR)")
     1311#endif
     1312  ("GOPSize,g",                                       m_iGOPSize,                                           1, "GOP size of temporal structure")
     1313
     1314  // motion search options
     1315  ("FastSearch",                                      m_iFastSearch,                                        1, "0:Full search  1:Diamond  2:PMVFAST")
     1316  ("SearchRange,-sr",                                 m_iSearchRange,                                      96, "Motion search range")
     1317  ("BipredSearchRange",                               m_bipredSearchRange,                                  4, "Motion search range for bipred refinement")
     1318  ("HadamardME",                                      m_bUseHADME,                                       true, "Hadamard ME for fractional-pel")
     1319  ("ASR",                                             m_bUseASR,                                        false, "Adaptive motion search range")
    8891320
    8901321#if SVC_EXTENSION
    891   ("LambdaModifier%d,-LM%d",  m_adLambdaModifier, ( double )1.0, MAX_TLAYER, "Lambda modifier for temporal layer %d")
     1322  ("LambdaModifier%d,-LM%d",                          m_adLambdaModifier, ( double )1.0, MAX_TLAYER, "Lambda modifier for temporal layer %d")
    8921323#else
    8931324  // Mode decision parameters
    894   ("LambdaModifier0,-LM0", m_adLambdaModifier[ 0 ], ( Double )1.0, "Lambda modifier for temporal layer 0")
    895   ("LambdaModifier1,-LM1", m_adLambdaModifier[ 1 ], ( Double )1.0, "Lambda modifier for temporal layer 1")
    896   ("LambdaModifier2,-LM2", m_adLambdaModifier[ 2 ], ( Double )1.0, "Lambda modifier for temporal layer 2")
    897   ("LambdaModifier3,-LM3", m_adLambdaModifier[ 3 ], ( Double )1.0, "Lambda modifier for temporal layer 3")
    898   ("LambdaModifier4,-LM4", m_adLambdaModifier[ 4 ], ( Double )1.0, "Lambda modifier for temporal layer 4")
    899   ("LambdaModifier5,-LM5", m_adLambdaModifier[ 5 ], ( Double )1.0, "Lambda modifier for temporal layer 5")
    900   ("LambdaModifier6,-LM6", m_adLambdaModifier[ 6 ], ( Double )1.0, "Lambda modifier for temporal layer 6")
     1325  // Mode decision parameters
     1326  ("LambdaModifier0,-LM0",                            m_adLambdaModifier[ 0 ],                  ( Double )1.0, "Lambda modifier for temporal layer 0")
     1327  ("LambdaModifier1,-LM1",                            m_adLambdaModifier[ 1 ],                  ( Double )1.0, "Lambda modifier for temporal layer 1")
     1328  ("LambdaModifier2,-LM2",                            m_adLambdaModifier[ 2 ],                  ( Double )1.0, "Lambda modifier for temporal layer 2")
     1329  ("LambdaModifier3,-LM3",                            m_adLambdaModifier[ 3 ],                  ( Double )1.0, "Lambda modifier for temporal layer 3")
     1330  ("LambdaModifier4,-LM4",                            m_adLambdaModifier[ 4 ],                  ( Double )1.0, "Lambda modifier for temporal layer 4")
     1331  ("LambdaModifier5,-LM5",                            m_adLambdaModifier[ 5 ],                  ( Double )1.0, "Lambda modifier for temporal layer 5")
     1332  ("LambdaModifier6,-LM6",                            m_adLambdaModifier[ 6 ],                  ( Double )1.0, "Lambda modifier for temporal layer 6")
    9011333#endif
    9021334
    9031335  /* Quantization parameters */
    9041336#if SVC_EXTENSION
    905   ("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")
    906 #else
    907   ("QP,q",          m_fQP,             30.0, "Qp value, if value is float, QP is switched once during encoding")
    908 #endif
    909   ("DeltaQpRD,-dqr",m_uiDeltaQpRD,       0u, "max dQp offset for slice")
    910   ("MaxDeltaQP,d",  m_iMaxDeltaQP,        0, "max dQp offset for block")
    911   ("MaxCuDQPDepth,-dqd",  m_iMaxCuDQPDepth,        0, "max depth for a minimum CuDQP")
    912 
    913   ("CbQpOffset,-cbqpofs",  m_cbQpOffset,        0, "Chroma Cb QP Offset")
    914   ("CrQpOffset,-crqpofs",  m_crQpOffset,        0, "Chroma Cr QP Offset")
     1337  ("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")
     1338#else
     1339  ("QP,q",                                            m_fQP,                                             30.0, "Qp value, if value is float, QP is switched once during encoding")
     1340#endif
     1341  ("DeltaQpRD,-dqr",                                  m_uiDeltaQpRD,                                       0u, "max dQp offset for slice")
     1342  ("MaxDeltaQP,d",                                    m_iMaxDeltaQP,                                        0, "max dQp offset for block")
     1343  ("MaxCuDQPDepth,-dqd",                              m_iMaxCuDQPDepth,                                     0, "max depth for a minimum CuDQP")
     1344  ("MaxCUChromaQpAdjustmentDepth",                    m_maxCUChromaQpAdjustmentDepth,                      -1, "Maximum depth for CU chroma Qp adjustment - set less than 0 to disable")
     1345
     1346  ("CbQpOffset,-cbqpofs",                             m_cbQpOffset,                                         0, "Chroma Cb QP Offset")
     1347  ("CrQpOffset,-crqpofs",                             m_crQpOffset,                                         0, "Chroma Cr QP Offset")
    9151348
    9161349#if ADAPTIVE_QP_SELECTION
    917   ("AdaptiveQpSelection,-aqps",   m_bUseAdaptQpSelect,           false, "AdaptiveQpSelection")
    918 #endif
    919 
    920   ("AdaptiveQP,-aq",                m_bUseAdaptiveQP,           false, "QP adaptation based on a psycho-visual model")
    921   ("MaxQPAdaptationRange,-aqr",     m_iQPAdaptationRange,           6, "QP adaptation range")
     1350  ("AdaptiveQpSelection,-aqps",                       m_bUseAdaptQpSelect,                              false, "AdaptiveQpSelection")
     1351#endif
     1352
     1353  ("AdaptiveQP,-aq",                                  m_bUseAdaptiveQP,                                 false, "QP adaptation based on a psycho-visual model")
     1354  ("MaxQPAdaptationRange,-aqr",                       m_iQPAdaptationRange,                                 6, "QP adaptation range")
    9221355#if !SVC_EXTENSION
    923   ("dQPFile,m",                     cfg_dQPFile,           string(""), "dQP file name")
    924 #endif
    925   ("RDOQ",                          m_useRDOQ,                  true )
    926   ("RDOQTS",                        m_useRDOQTS,                true )
    927   ("RDpenalty",                     m_rdPenalty,                0,  "RD-penalty for 32x32 TU for intra in non-intra slices. 0:disbaled  1:RD-penalty  2:maximum RD-penalty")
    928  
     1356  ("dQPFile,m",                                       cfg_dQPFile,                                 string(""), "dQP file name")
     1357#endif
     1358  ("RDOQ",                                            m_useRDOQ,                                         true)
     1359  ("RDOQTS",                                          m_useRDOQTS,                                       true)
     1360  ("RDpenalty",                                       m_rdPenalty,                                          0,  "RD-penalty for 32x32 TU for intra in non-intra slices. 0:disabled  1:RD-penalty  2:maximum RD-penalty")
     1361
    9291362  // Deblocking filter parameters
    930   ("LoopFilterDisable",              m_bLoopFilterDisable,             false )
    931   ("LoopFilterOffsetInPPS",          m_loopFilterOffsetInPPS,          false )
    932   ("LoopFilterBetaOffset_div2",      m_loopFilterBetaOffsetDiv2,           0 )
    933   ("LoopFilterTcOffset_div2",        m_loopFilterTcOffsetDiv2,             0 )
    934   ("DeblockingFilterControlPresent", m_DeblockingFilterControlPresent, false )
    935   ("DeblockingFilterMetric",         m_DeblockingFilterMetric,         false )
     1363  ("LoopFilterDisable",                               m_bLoopFilterDisable,                             false)
     1364  ("LoopFilterOffsetInPPS",                           m_loopFilterOffsetInPPS,                          false)
     1365  ("LoopFilterBetaOffset_div2",                       m_loopFilterBetaOffsetDiv2,                           0)
     1366  ("LoopFilterTcOffset_div2",                         m_loopFilterTcOffsetDiv2,                             0)
     1367  ("DeblockingFilterControlPresent",                  m_DeblockingFilterControlPresent,                 false)
     1368  ("DeblockingFilterMetric",                          m_DeblockingFilterMetric,                         false)
    9361369
    9371370  // Coding tools
    938   ("AMP",                      m_enableAMP,                 true,  "Enable asymmetric motion partitions")
    939   ("TransformSkip",            m_useTransformSkip,          false, "Intra transform skipping")
    940   ("TransformSkipFast",        m_useTransformSkipFast,      false, "Fast intra transform skipping")
    941   ("SAO",                      m_bUseSAO,                   true,  "Enable Sample Adaptive Offset")
    942   ("MaxNumOffsetsPerPic",      m_maxNumOffsetsPerPic,       2048,  "Max number of SAO offset per picture (Default: 2048)")   
    943   ("SAOLcuBoundary",           m_saoLcuBoundary,            false, "0: right/bottom LCU boundary areas skipped from SAO parameter estimation, 1: non-deblocked pixels are used for those areas")
    944   ("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")
    945   ("SliceArgument",            m_sliceArgument,            0,     "Depending on SliceMode being:"
    946                                                                    "\t1: max number of CTUs per slice"
    947                                                                    "\t2: max number of bytes per slice"
    948                                                                    "\t3: max number of tiles per slice")
    949   ("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")
    950   ("SliceSegmentArgument",     m_sliceSegmentArgument,   0,     "Depending on SliceSegmentMode being:"
    951                                                                    "\t1: max number of CTUs per slice segment"
    952                                                                    "\t2: max number of bytes per slice segment"
    953                                                                    "\t3: max number of tiles per slice segment")
    954   ("LFCrossSliceBoundaryFlag", m_bLFCrossSliceBoundaryFlag, true)
    955 
    956   ("ConstrainedIntraPred",     m_bUseConstrainedIntraPred,  false, "Constrained Intra Prediction")
    957 
    958   ("PCMEnabledFlag",           m_usePCM,                    false)
    959   ("PCMLog2MaxSize",           m_pcmLog2MaxSize,            5u)
    960   ("PCMLog2MinSize",           m_uiPCMLog2MinSize,          3u)
    961   ("PCMInputBitDepthFlag",     m_bPCMInputBitDepthFlag,     true)
    962   ("PCMFilterDisableFlag",     m_bPCMFilterDisableFlag,    false)
    963 
    964   ("WeightedPredP,-wpP",          m_useWeightedPred,               false,      "Use weighted prediction in P slices")
    965   ("WeightedPredB,-wpB",          m_useWeightedBiPred,             false,      "Use weighted (bidirectional) prediction in B slices")
    966   ("Log2ParallelMergeLevel",      m_log2ParallelMergeLevel,     2u,          "Parallel merge estimation region")
    967 
    968   //deprecated copies of renamed tile parameters
    969   ("UniformSpacingIdc",           m_tileUniformSpacingFlag,        false,      "deprecated alias of TileUniformSpacing")
    970   ("ColumnWidthArray",            cfgColumnWidth,                  string(""), "deprecated alias of TileColumnWidthArray")
    971   ("RowHeightArray",              cfgRowHeight,                    string(""), "deprecated alias of TileRowHeightArray")
    972 
    973   ("TileUniformSpacing",          m_tileUniformSpacingFlag,        false,      "Indicates that tile columns and rows are distributed uniformly")
    974   ("NumTileColumnsMinus1",        m_numTileColumnsMinus1,          0,          "Number of tile columns in a picture minus 1")
    975   ("NumTileRowsMinus1",           m_numTileRowsMinus1,             0,          "Number of rows in a picture minus 1")
    976   ("TileColumnWidthArray",        cfgColumnWidth,                  string(""), "Array containing tile column width values in units of LCU")
    977   ("TileRowHeightArray",          cfgRowHeight,                    string(""), "Array containing tile row height values in units of LCU")
    978   ("LFCrossTileBoundaryFlag",      m_bLFCrossTileBoundaryFlag,             true,          "1: cross-tile-boundary loop filtering. 0:non-cross-tile-boundary loop filtering")
     1371  ("AMP",                                             m_enableAMP,                                       true, "Enable asymmetric motion partitions")
     1372  ("CrossComponentPrediction",                        m_useCrossComponentPrediction,                    false, "Enable the use of cross-component prediction (not valid in V1 profiles)")
     1373  ("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")
     1374  ("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")
     1375  ("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")
     1376  ("TransformSkip",                                   m_useTransformSkip,                               false, "Intra transform skipping")
     1377  ("TransformSkipFast",                               m_useTransformSkipFast,                           false, "Fast intra transform skipping")
     1378  ("TransformSkipLog2MaxSize",                        m_transformSkipLog2MaxSize,                          2U, "Specify transform-skip maximum size. Minimum 2. (not valid in V1 profiles)")
     1379  ("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)")
     1380  ("ExplicitResidualDPCM",                            m_useResidualDPCM[RDPCM_SIGNAL_EXPLICIT],         false, "Enable explicitly signalled residual DPCM for inter (not valid in V1 profiles)")
     1381  ("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)")
     1382  ("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)")
     1383  ("GolombRiceParameterAdaptation",                   m_useGolombRiceParameterAdaptation,               false, "Enable the adaptation of the Golomb-Rice parameter over the course of each slice")
     1384  ("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" )
     1385  ("SAO",                                             m_bUseSAO,                                         true, "Enable Sample Adaptive Offset")
     1386  ("MaxNumOffsetsPerPic",                             m_maxNumOffsetsPerPic,                             2048, "Max number of SAO offset per picture (Default: 2048)")
     1387  ("SAOLcuBoundary",                                  m_saoCtuBoundary,                                 false, "0: right/bottom CTU boundary areas skipped from SAO parameter estimation, 1: non-deblocked pixels are used for those areas")
     1388  ("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")
     1389  ("SliceArgument",                                   m_sliceArgument,                                      0, "Depending on SliceMode being:"
     1390                                                                                                               "\t1: max number of CTUs per slice"
     1391                                                                                                               "\t2: max number of bytes per slice"
     1392                                                                                                               "\t3: max number of tiles per slice")
     1393  ("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")
     1394  ("SliceSegmentArgument",                            m_sliceSegmentArgument,                               0, "Depending on SliceSegmentMode being:"
     1395                                                                                                               "\t1: max number of CTUs per slice segment"
     1396                                                                                                               "\t2: max number of bytes per slice segment"
     1397                                                                                                               "\t3: max number of tiles per slice segment")
     1398  ("LFCrossSliceBoundaryFlag",                        m_bLFCrossSliceBoundaryFlag,                       true)
     1399
     1400  ("ConstrainedIntraPred",                            m_bUseConstrainedIntraPred,                       false, "Constrained Intra Prediction")
     1401  ("PCMEnabledFlag",                                  m_usePCM,                                         false)
     1402  ("PCMLog2MaxSize",                                  m_pcmLog2MaxSize,                                    5u)
     1403  ("PCMLog2MinSize",                                  m_uiPCMLog2MinSize,                                  3u)
     1404
     1405  ("PCMInputBitDepthFlag",                            m_bPCMInputBitDepthFlag,                           true)
     1406  ("PCMFilterDisableFlag",                            m_bPCMFilterDisableFlag,                          false)
     1407  ("IntraReferenceSmoothing",                         m_enableIntraReferenceSmoothing,                   true, "0: Disable use of intra reference smoothing. 1: Enable use of intra reference smoothing (not valid in V1 profiles)")
     1408  ("WeightedPredP,-wpP",                              m_useWeightedPred,                                false, "Use weighted prediction in P slices")
     1409  ("WeightedPredB,-wpB",                              m_useWeightedBiPred,                              false, "Use weighted (bidirectional) prediction in B slices")
     1410  ("Log2ParallelMergeLevel",                          m_log2ParallelMergeLevel,                            2u, "Parallel merge estimation region")
     1411    //deprecated copies of renamed tile parameters
     1412  ("UniformSpacingIdc",                               m_tileUniformSpacingFlag,                         false,      "deprecated alias of TileUniformSpacing")
     1413  ("ColumnWidthArray",                                cfg_ColumnWidth,                        cfg_ColumnWidth, "deprecated alias of TileColumnWidthArray")
     1414  ("RowHeightArray",                                  cfg_RowHeight,                            cfg_RowHeight, "deprecated alias of TileRowHeightArray")
     1415
     1416  ("TileUniformSpacing",                              m_tileUniformSpacingFlag,                         false,      "Indicates that tile columns and rows are distributed uniformly")
     1417  ("NumTileColumnsMinus1",                            m_numTileColumnsMinus1,                               0,          "Number of tile columns in a picture minus 1")
     1418  ("NumTileRowsMinus1",                               m_numTileRowsMinus1,                                  0,          "Number of rows in a picture minus 1")
     1419  ("TileColumnWidthArray",                            cfg_ColumnWidth,                        cfg_ColumnWidth, "Array containing tile column width values in units of CTU")
     1420  ("TileRowHeightArray",                              cfg_RowHeight,                            cfg_RowHeight, "Array containing tile row height values in units of CTU")
     1421  ("LFCrossTileBoundaryFlag",                         m_bLFCrossTileBoundaryFlag,                        true, "1: cross-tile-boundary loop filtering. 0:non-cross-tile-boundary loop filtering")
    9791422#if SVC_EXTENSION
    980   ("WaveFrontSynchro%d",          cfg_waveFrontSynchro,             0,  MAX_LAYERS,          "0: no synchro; 1 synchro with TR; 2 TRR etc")
    981 #else
    982   ("WaveFrontSynchro",            m_iWaveFrontSynchro,             0,          "0: no synchro; 1 synchro with TR; 2 TRR etc")
    983 #endif
    984   ("ScalingList",                 m_useScalingListId,              0,          "0: no scaling list, 1: default scaling lists, 2: scaling lists specified in ScalingListFile")
    985   ("ScalingListFile",             cfg_ScalingListFile,             string(""), "Scaling list file name")
    986   ("SignHideFlag,-SBH",                m_signHideFlag, 1)
    987   ("MaxNumMergeCand",             m_maxNumMergeCand,             5u,         "Maximum number of merge candidates")
    988 
     1423  ("WaveFrontSynchro%d",                              cfg_waveFrontSynchro,             0,  MAX_LAYERS,          "0: no synchro; 1 synchro with TR; 2 TRR etc")
     1424#else
     1425  ("WaveFrontSynchro",                                m_iWaveFrontSynchro,                                  0, "0: no synchro; 1 synchro with top-right-right")
     1426#endif
     1427  ("ScalingList",                                     m_useScalingListId,                    SCALING_LIST_OFF, "0/off: no scaling list, 1/default: default scaling lists, 2/file: scaling lists specified in ScalingListFile")
     1428  ("ScalingListFile",                                 cfg_ScalingListFile,                         string(""), "Scaling list file name. Use an empty string to produce help.")
     1429  ("SignHideFlag,-SBH",                               m_signHideFlag,                                       1)
     1430  ("MaxNumMergeCand",                                 m_maxNumMergeCand,                                   5u, "Maximum number of merge candidates")
    9891431  /* Misc. */
    990   ("SEIDecodedPictureHash",       m_decodedPictureHashSEIEnabled, 0, "Control generation of decode picture hash SEI messages\n"
    991                                                                     "\t3: checksum\n"
    992                                                                     "\t2: CRC\n"
    993                                                                     "\t1: use MD5\n"
    994                                                                     "\t0: disable")
    995   ("SEIpictureDigest",            m_decodedPictureHashSEIEnabled, 0, "deprecated alias for SEIDecodedPictureHash")
    996   ("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")
    997   ("FEN", m_bUseFastEnc, false, "fast encoder setting")
    998   ("ECU", m_bUseEarlyCU, false, "Early CU setting")
    999   ("FDM", m_useFastDecisionForMerge, true, "Fast decision for Merge RD Cost")
    1000   ("CFM", m_bUseCbfFastMode, false, "Cbf fast mode setting")
    1001   ("ESD", m_useEarlySkipDetection, false, "Early SKIP detection setting")
     1432  ("SEIDecodedPictureHash",                           m_decodedPictureHashSEIEnabled,                      0, "Control generation of decode picture hash SEI messages\n"
     1433                                                                                                               "\t3: checksum\n"
     1434                                                                                                               "\t2: CRC\n"
     1435                                                                                                               "\t1: use MD5\n"
     1436                                                                                                               "\t0: disable")
     1437  ("SEIpictureDigest",                                m_decodedPictureHashSEIEnabled,                      0, "deprecated alias for SEIDecodedPictureHash")
     1438  ("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")
     1439  ("FEN",                                             m_bUseFastEnc,                                    false, "fast encoder setting")
     1440  ("ECU",                                             m_bUseEarlyCU,                                    false, "Early CU setting")
     1441  ("FDM",                                             m_useFastDecisionForMerge,                         true, "Fast decision for Merge RD Cost")
     1442  ("CFM",                                             m_bUseCbfFastMode,                                false, "Cbf fast mode setting")
     1443  ("ESD",                                             m_useEarlySkipDetection,                          false, "Early SKIP detection setting")
    10021444#if FAST_INTRA_SHVC
    1003   ("FIS", m_useFastIntraScalable, false, "Fast Intra Decision for Scalable HEVC")
     1445  ("FIS",                                             m_useFastIntraScalable, false, "Fast Intra Decision for Scalable HEVC")
    10041446#endif
    10051447#if RC_SHVC_HARMONIZATION
    1006   ("RateControl%d", cfg_RCEnableRateControl, false, MAX_LAYERS, "Rate control: enable rate control for layer %d")
    1007   ("TargetBitrate%d", cfg_RCTargetBitRate, 0, MAX_LAYERS, "Rate control: target bitrate for layer %d")
    1008   ("KeepHierarchicalBit%d", cfg_RCKeepHierarchicalBit, false, MAX_LAYERS, "Rate control: keep hierarchical bit allocation for layer %d")
    1009   ("LCULevelRateControl%d", cfg_RCLCULevelRC, true, MAX_LAYERS, "Rate control: LCU level RC")
    1010   ("RCLCUSeparateModel%d", cfg_RCUseLCUSeparateModel, true, MAX_LAYERS, "Rate control: Use LCU level separate R-lambda model")
    1011   ("InitialQP%d", cfg_RCInitialQP, 0, MAX_LAYERS, "Rate control: initial QP")
    1012   ("RCForceIntraQP%d", cfg_RCForceIntraQP, false, MAX_LAYERS, "Rate control: force intra QP to be equal to initial QP")
    1013 #else
    1014   ( "RateControl",         m_RCEnableRateControl,   false, "Rate control: enable rate control" )
    1015   ( "TargetBitrate",       m_RCTargetBitrate,           0, "Rate control: target bitrate" )
    1016   ( "KeepHierarchicalBit", m_RCKeepHierarchicalBit,     0, "Rate control: 0: equal bit allocation; 1: fixed ratio bit allocation; 2: adaptive ratio bit allocation" )
    1017   ( "LCULevelRateControl", m_RCLCULevelRC,           true, "Rate control: true: LCU level RC; false: picture level RC" )
    1018   ( "RCLCUSeparateModel",  m_RCUseLCUSeparateModel,  true, "Rate control: use LCU level separate R-lambda model" )
    1019   ( "InitialQP",           m_RCInitialQP,               0, "Rate control: initial QP" )
    1020   ( "RCForceIntraQP",      m_RCForceIntraQP,        false, "Rate control: force intra QP to be equal to initial QP" )
    1021 #endif
    1022 
    1023   ("TransquantBypassEnableFlag", m_TransquantBypassEnableFlag, false, "transquant_bypass_enable_flag indicator in PPS")
    1024   ("CUTransquantBypassFlagForce", m_CUTransquantBypassFlagForce, false, "Force transquant bypass mode, when transquant_bypass_enable_flag is enabled")
    1025   ("RecalculateQPAccordingToLambda", m_recalculateQPAccordingToLambda, false, "Recalculate QP values according to lambda values. Do not suggest to be enabled in all intra case")
    1026   ("StrongIntraSmoothing,-sis",      m_useStrongIntraSmoothing,           true, "Enable strong intra smoothing for 32x32 blocks")
    1027   ("SEIActiveParameterSets",         m_activeParameterSetsSEIEnabled,          0, "Enable generation of active parameter sets SEI messages")
    1028   ("VuiParametersPresent,-vui",      m_vuiParametersPresentFlag,           false, "Enable generation of vui_parameters()")
    1029   ("AspectRatioInfoPresent",         m_aspectRatioInfoPresentFlag,         false, "Signals whether aspect_ratio_idc is present")
    1030   ("AspectRatioIdc",                 m_aspectRatioIdc,                         0, "aspect_ratio_idc")
    1031   ("SarWidth",                       m_sarWidth,                               0, "horizontal size of the sample aspect ratio")
    1032   ("SarHeight",                      m_sarHeight,                              0, "vertical size of the sample aspect ratio")
    1033   ("OverscanInfoPresent",            m_overscanInfoPresentFlag,            false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n")
    1034   ("OverscanAppropriate",            m_overscanAppropriateFlag,            false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n")
    1035   ("VideoSignalTypePresent",         m_videoSignalTypePresentFlag,         false, "Signals whether video_format, video_full_range_flag, and colour_description_present_flag are present")
    1036   ("VideoFormat",                    m_videoFormat,                            5, "Indicates representation of pictures")
    1037   ("VideoFullRange",                 m_videoFullRangeFlag,                 false, "Indicates the black level and range of luma and chroma signals")
    1038   ("ColourDescriptionPresent",       m_colourDescriptionPresentFlag,       false, "Signals whether colour_primaries, transfer_characteristics and matrix_coefficients are present")
    1039   ("ColourPrimaries",                m_colourPrimaries,                        2, "Indicates chromaticity coordinates of the source primaries")
    1040   ("TransferCharacteristics",        m_transferCharacteristics,                2, "Indicates the opto-electronic transfer characteristics of the source")
    1041   ("MatrixCoefficients",             m_matrixCoefficients,                     2, "Describes the matrix coefficients used in deriving luma and chroma from RGB primaries")
    1042   ("ChromaLocInfoPresent",           m_chromaLocInfoPresentFlag,           false, "Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present")
    1043   ("ChromaSampleLocTypeTopField",    m_chromaSampleLocTypeTopField,            0, "Specifies the location of chroma samples for top field")
    1044   ("ChromaSampleLocTypeBottomField", m_chromaSampleLocTypeBottomField,         0, "Specifies the location of chroma samples for bottom field")
    1045   ("NeutralChromaIndication",        m_neutralChromaIndicationFlag,        false, "Indicates that the value of all decoded chroma samples is equal to 1<<(BitDepthCr-1)")
    1046   ("DefaultDisplayWindowFlag",       m_defaultDisplayWindowFlag,           false, "Indicates the presence of the Default Window parameters")
    1047   ("DefDispWinLeftOffset",           m_defDispWinLeftOffset,                   0, "Specifies the left offset of the default display window from the conformance window")
    1048   ("DefDispWinRightOffset",          m_defDispWinRightOffset,                  0, "Specifies the right offset of the default display window from the conformance window")
    1049   ("DefDispWinTopOffset",            m_defDispWinTopOffset,                    0, "Specifies the top offset of the default display window from the conformance window")
    1050   ("DefDispWinBottomOffset",         m_defDispWinBottomOffset,                 0, "Specifies the bottom offset of the default display window from the conformance window")
    1051   ("FrameFieldInfoPresentFlag",      m_frameFieldInfoPresentFlag,               false, "Indicates that pic_struct and field coding related values are present in picture timing SEI messages")
    1052   ("PocProportionalToTimingFlag",   m_pocProportionalToTimingFlag,         false, "Indicates that the POC value is proportional to the output time w.r.t. first picture in CVS")
    1053   ("NumTicksPocDiffOneMinus1",      m_numTicksPocDiffOneMinus1,                0, "Number of ticks minus 1 that for a POC difference of one")
    1054   ("BitstreamRestriction",           m_bitstreamRestrictionFlag,           false, "Signals whether bitstream restriction parameters are present")
    1055   ("TilesFixedStructure",            m_tilesFixedStructureFlag,            false, "Indicates that each active picture parameter set has the same values of the syntax elements related to tiles")
    1056   ("MotionVectorsOverPicBoundaries", m_motionVectorsOverPicBoundariesFlag, false, "Indicates that no samples outside the picture boundaries are used for inter prediction")
    1057   ("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")
    1058   ("MaxBitsPerMinCuDenom",           m_maxBitsPerMinCuDenom,                   1, "Indicates an upper bound for the number of bits of coding_unit() data")
    1059   ("Log2MaxMvLengthHorizontal",      m_log2MaxMvLengthHorizontal,             15, "Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units")
    1060   ("Log2MaxMvLengthVertical",        m_log2MaxMvLengthVertical,               15, "Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units")
    1061   ("SEIRecoveryPoint",               m_recoveryPointSEIEnabled,                0, "Control generation of recovery point SEI messages")
    1062   ("SEIBufferingPeriod",             m_bufferingPeriodSEIEnabled,              0, "Control generation of buffering period SEI messages")
    1063   ("SEIPictureTiming",               m_pictureTimingSEIEnabled,                0, "Control generation of picture timing SEI messages")
    1064   ("SEIToneMappingInfo",                       m_toneMappingInfoSEIEnabled,    false, "Control generation of Tone Mapping SEI messages")
    1065   ("SEIToneMapId",                             m_toneMapId,                        0, "Specifies Id of Tone Mapping SEI message for a given session")
    1066   ("SEIToneMapCancelFlag",                     m_toneMapCancelFlag,            false, "Indicates that Tone Mapping SEI message cancels the persistance or follows")
    1067   ("SEIToneMapPersistenceFlag",                m_toneMapPersistenceFlag,        true, "Specifies the persistence of the Tone Mapping SEI message")
    1068   ("SEIToneMapCodedDataBitDepth",              m_toneMapCodedDataBitDepth,         8, "Specifies Coded Data BitDepth of Tone Mapping SEI messages")
    1069   ("SEIToneMapTargetBitDepth",                 m_toneMapTargetBitDepth,            8, "Specifies Output BitDepth of Tome mapping function")
    1070   ("SEIToneMapModelId",                        m_toneMapModelId,                   0, "Specifies Model utilized for mapping coded data into target_bit_depth range\n"
    1071                                                                                       "\t0:  linear mapping with clipping\n"
    1072                                                                                       "\t1:  sigmoidal mapping\n"
    1073                                                                                       "\t2:  user-defined table mapping\n"
    1074                                                                                       "\t3:  piece-wise linear mapping\n"
    1075                                                                                       "\t4:  luminance dynamic range information ")
    1076   ("SEIToneMapMinValue",                              m_toneMapMinValue,                          0, "Specifies the minimum value in mode 0")
    1077   ("SEIToneMapMaxValue",                              m_toneMapMaxValue,                       1023, "Specifies the maxmum value in mode 0")
    1078   ("SEIToneMapSigmoidMidpoint",                       m_sigmoidMidpoint,                        512, "Specifies the centre point in mode 1")
    1079   ("SEIToneMapSigmoidWidth",                          m_sigmoidWidth,                           960, "Specifies the distance between 5% and 95% values of the target_bit_depth in mode 1")
    1080   ("SEIToneMapStartOfCodedInterval",                  cfg_startOfCodedInterval,          string(""), "Array of user-defined mapping table")
    1081   ("SEIToneMapNumPivots",                             m_numPivots,                                0, "Specifies the number of pivot points in mode 3")
    1082   ("SEIToneMapCodedPivotValue",                       cfg_codedPivotValue,               string(""), "Array of pivot point")
    1083   ("SEIToneMapTargetPivotValue",                      cfg_targetPivotValue,              string(""), "Array of pivot point")
    1084   ("SEIToneMapCameraIsoSpeedIdc",                     m_cameraIsoSpeedIdc,                        0, "Indicates the camera ISO speed for daylight illumination")
    1085   ("SEIToneMapCameraIsoSpeedValue",                   m_cameraIsoSpeedValue,                    400, "Specifies the camera ISO speed for daylight illumination of Extended_ISO")
    1086   ("SEIToneMapExposureIndexIdc",                      m_exposureIndexIdc,                         0, "Indicates the exposure index setting of the camera")
    1087   ("SEIToneMapExposureIndexValue",                    m_exposureIndexValue,                     400, "Specifies the exposure index setting of the cameran of Extended_ISO")
    1088   ("SEIToneMapExposureCompensationValueSignFlag",     m_exposureCompensationValueSignFlag,        0, "Specifies the sign of ExposureCompensationValue")
    1089   ("SEIToneMapExposureCompensationValueNumerator",    m_exposureCompensationValueNumerator,       0, "Specifies the numerator of ExposureCompensationValue")
    1090   ("SEIToneMapExposureCompensationValueDenomIdc",     m_exposureCompensationValueDenomIdc,        2, "Specifies the denominator of ExposureCompensationValue")
    1091   ("SEIToneMapRefScreenLuminanceWhite",               m_refScreenLuminanceWhite,                350, "Specifies reference screen brightness setting in units of candela per square metre")
    1092   ("SEIToneMapExtendedRangeWhiteLevel",               m_extendedRangeWhiteLevel,                800, "Indicates the luminance dynamic range")
    1093   ("SEIToneMapNominalBlackLevelLumaCodeValue",        m_nominalBlackLevelLumaCodeValue,          16, "Specifies luma sample value of the nominal black level assigned decoded pictures")
    1094   ("SEIToneMapNominalWhiteLevelLumaCodeValue",        m_nominalWhiteLevelLumaCodeValue,         235, "Specifies luma sample value of the nominal white level assigned decoded pictures")
    1095   ("SEIToneMapExtendedWhiteLevelLumaCodeValue",       m_extendedWhiteLevelLumaCodeValue,        300, "Specifies luma sample value of the extended dynamic range assigned decoded pictures")
    1096   ("SEIFramePacking",                m_framePackingSEIEnabled,                 0, "Control generation of frame packing SEI messages")
    1097   ("SEIFramePackingType",            m_framePackingSEIType,                    0, "Define frame packing arrangement\n"
    1098                                                                                   "\t0: checkerboard - pixels alternatively represent either frames\n"
    1099                                                                                   "\t1: column alternation - frames are interlaced by column\n"
    1100                                                                                   "\t2: row alternation - frames are interlaced by row\n"
    1101                                                                                   "\t3: side by side - frames are displayed horizontally\n"
    1102                                                                                   "\t4: top bottom - frames are displayed vertically\n"
    1103                                                                                   "\t5: frame alternation - one frame is alternated with the other")
    1104   ("SEIFramePackingId",              m_framePackingSEIId,                      0, "Id of frame packing SEI message for a given session")
    1105   ("SEIFramePackingQuincunx",        m_framePackingSEIQuincunx,                0, "Indicate the presence of a Quincunx type video frame")
    1106   ("SEIFramePackingInterpretation",  m_framePackingSEIInterpretation,          0, "Indicate the interpretation of the frame pair\n"
    1107                                                                                   "\t0: unspecified\n"
    1108                                                                                   "\t1: stereo pair, frame0 represents left view\n"
    1109                                                                                   "\t2: stereo pair, frame0 represents right view")
    1110   ("SEIDisplayOrientation",          m_displayOrientationSEIAngle,             0, "Control generation of display orientation SEI messages\n"
    1111                                                               "\tN: 0 < N < (2^16 - 1) enable display orientation SEI message with anticlockwise_rotation = N and display_orientation_repetition_period = 1\n"
    1112                                                               "\t0: disable")
    1113   ("SEITemporalLevel0Index",         m_temporalLevel0IndexSEIEnabled,          0, "Control generation of temporal level 0 index SEI messages")
    1114   ("SEIGradualDecodingRefreshInfo",  m_gradualDecodingRefreshInfoEnabled,      0, "Control generation of gradual decoding refresh information SEI message")
    1115   ("SEIDecodingUnitInfo",             m_decodingUnitInfoSEIEnabled,                       0, "Control generation of decoding unit information SEI message.")
     1448  ("RateControl%d",                                   cfg_RCEnableRateControl, false, MAX_LAYERS, "Rate control: enable rate control for layer %d")
     1449  ("TargetBitrate%d",                                 cfg_RCTargetBitRate, 0, MAX_LAYERS, "Rate control: target bitrate for layer %d")
     1450  ("KeepHierarchicalBit%d",                           cfg_RCKeepHierarchicalBit, false, MAX_LAYERS, "Rate control: keep hierarchical bit allocation for layer %d")
     1451  ("LCULevelRateControl%d",                           cfg_RCLCULevelRC, true, MAX_LAYERS, "Rate control: LCU level RC")
     1452  ("RCLCUSeparateModel%d",                            cfg_RCUseLCUSeparateModel, true, MAX_LAYERS, "Rate control: Use LCU level separate R-lambda model")
     1453  ("InitialQP%d",                                     cfg_RCInitialQP, 0, MAX_LAYERS, "Rate control: initial QP")
     1454  ("RCForceIntraQP%d",                                cfg_RCForceIntraQP, false, MAX_LAYERS, "Rate control: force intra QP to be equal to initial QP")
     1455#else
     1456  ( "RateControl",                                    m_RCEnableRateControl,                            false, "Rate control: enable rate control" )
     1457  ( "TargetBitrate",                                  m_RCTargetBitrate,                                    0, "Rate control: target bit-rate" )
     1458  ( "KeepHierarchicalBit",                            m_RCKeepHierarchicalBit,                              0, "Rate control: 0: equal bit allocation; 1: fixed ratio bit allocation; 2: adaptive ratio bit allocation" )
     1459  ( "LCULevelRateControl",                            m_RCLCULevelRC,                                    true, "Rate control: true: CTU level RC; false: picture level RC" )
     1460  ( "RCLCUSeparateModel",                             m_RCUseLCUSeparateModel,                           true, "Rate control: use CTU level separate R-lambda model" )
     1461  ( "InitialQP",                                      m_RCInitialQP,                                        0, "Rate control: initial QP" )
     1462  ( "RCForceIntraQP",                                 m_RCForceIntraQP,                                 false, "Rate control: force intra QP to be equal to initial QP" )
     1463#endif
     1464
     1465  ("TransquantBypassEnableFlag",                      m_TransquantBypassEnableFlag,                     false, "transquant_bypass_enable_flag indicator in PPS")
     1466  ("CUTransquantBypassFlagForce",                     m_CUTransquantBypassFlagForce,                    false, "Force transquant bypass mode, when transquant_bypass_enable_flag is enabled")
     1467  ("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).")
     1468  ("RecalculateQPAccordingToLambda",                  m_recalculateQPAccordingToLambda,                 false, "Recalculate QP values according to lambda values. Do not suggest to be enabled in all intra case")
     1469  ("StrongIntraSmoothing,-sis",                       m_useStrongIntraSmoothing,                         true, "Enable strong intra smoothing for 32x32 blocks")
     1470  ("SEIActiveParameterSets",                          m_activeParameterSetsSEIEnabled,                      0, "Enable generation of active parameter sets SEI messages")
     1471  ("VuiParametersPresent,-vui",                       m_vuiParametersPresentFlag,                       false, "Enable generation of vui_parameters()")
     1472  ("AspectRatioInfoPresent",                          m_aspectRatioInfoPresentFlag,                     false, "Signals whether aspect_ratio_idc is present")
     1473  ("AspectRatioIdc",                                  m_aspectRatioIdc,                                     0, "aspect_ratio_idc")
     1474  ("SarWidth",                                        m_sarWidth,                                           0, "horizontal size of the sample aspect ratio")
     1475  ("SarHeight",                                       m_sarHeight,                                          0, "vertical size of the sample aspect ratio")
     1476  ("OverscanInfoPresent",                             m_overscanInfoPresentFlag,                        false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n")
     1477  ("OverscanAppropriate",                             m_overscanAppropriateFlag,                        false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n")
     1478  ("VideoSignalTypePresent",                          m_videoSignalTypePresentFlag,                     false, "Signals whether video_format, video_full_range_flag, and colour_description_present_flag are present")
     1479  ("VideoFormat",                                     m_videoFormat,                                        5, "Indicates representation of pictures")
     1480  ("VideoFullRange",                                  m_videoFullRangeFlag,                             false, "Indicates the black level and range of luma and chroma signals")
     1481  ("ColourDescriptionPresent",                        m_colourDescriptionPresentFlag,                   false, "Signals whether colour_primaries, transfer_characteristics and matrix_coefficients are present")
     1482  ("ColourPrimaries",                                 m_colourPrimaries,                                    2, "Indicates chromaticity coordinates of the source primaries")
     1483  ("TransferCharacteristics",                         m_transferCharacteristics,                            2, "Indicates the opto-electronic transfer characteristics of the source")
     1484  ("MatrixCoefficients",                              m_matrixCoefficients,                                 2, "Describes the matrix coefficients used in deriving luma and chroma from RGB primaries")
     1485  ("ChromaLocInfoPresent",                            m_chromaLocInfoPresentFlag,                       false, "Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present")
     1486  ("ChromaSampleLocTypeTopField",                     m_chromaSampleLocTypeTopField,                        0, "Specifies the location of chroma samples for top field")
     1487  ("ChromaSampleLocTypeBottomField",                  m_chromaSampleLocTypeBottomField,                     0, "Specifies the location of chroma samples for bottom field")
     1488  ("NeutralChromaIndication",                         m_neutralChromaIndicationFlag,                    false, "Indicates that the value of all decoded chroma samples is equal to 1<<(BitDepthCr-1)")
     1489  ("DefaultDisplayWindowFlag",                        m_defaultDisplayWindowFlag,                       false, "Indicates the presence of the Default Window parameters")
     1490  ("DefDispWinLeftOffset",                            m_defDispWinLeftOffset,                               0, "Specifies the left offset of the default display window from the conformance window")
     1491  ("DefDispWinRightOffset",                           m_defDispWinRightOffset,                              0, "Specifies the right offset of the default display window from the conformance window")
     1492  ("DefDispWinTopOffset",                             m_defDispWinTopOffset,                                0, "Specifies the top offset of the default display window from the conformance window")
     1493  ("DefDispWinBottomOffset",                          m_defDispWinBottomOffset,                             0, "Specifies the bottom offset of the default display window from the conformance window")
     1494  ("FrameFieldInfoPresentFlag",                       m_frameFieldInfoPresentFlag,                      false, "Indicates that pic_struct and field coding related values are present in picture timing SEI messages")
     1495  ("PocProportionalToTimingFlag",                     m_pocProportionalToTimingFlag,                    false, "Indicates that the POC value is proportional to the output time w.r.t. first picture in CVS")
     1496  ("NumTicksPocDiffOneMinus1",                        m_numTicksPocDiffOneMinus1,                           0, "Number of ticks minus 1 that for a POC difference of one")
     1497  ("BitstreamRestriction",                            m_bitstreamRestrictionFlag,                       false, "Signals whether bitstream restriction parameters are present")
     1498  ("TilesFixedStructure",                             m_tilesFixedStructureFlag,                        false, "Indicates that each active picture parameter set has the same values of the syntax elements related to tiles")
     1499  ("MotionVectorsOverPicBoundaries",                  m_motionVectorsOverPicBoundariesFlag,             false, "Indicates that no samples outside the picture boundaries are used for inter prediction")
     1500  ("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")
     1501  ("MaxBitsPerMinCuDenom",                            m_maxBitsPerMinCuDenom,                               1, "Indicates an upper bound for the number of bits of coding_unit() data")
     1502  ("Log2MaxMvLengthHorizontal",                       m_log2MaxMvLengthHorizontal,                         15, "Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units")
     1503  ("Log2MaxMvLengthVertical",                         m_log2MaxMvLengthVertical,                           15, "Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units")
     1504  ("SEIRecoveryPoint",                                m_recoveryPointSEIEnabled,                            0, "Control generation of recovery point SEI messages")
     1505  ("SEIBufferingPeriod",                              m_bufferingPeriodSEIEnabled,                          0, "Control generation of buffering period SEI messages")
     1506  ("SEIPictureTiming",                                m_pictureTimingSEIEnabled,                            0, "Control generation of picture timing SEI messages")
     1507  ("SEIToneMappingInfo",                              m_toneMappingInfoSEIEnabled,                      false, "Control generation of Tone Mapping SEI messages")
     1508  ("SEIToneMapId",                                    m_toneMapId,                                          0, "Specifies Id of Tone Mapping SEI message for a given session")
     1509  ("SEIToneMapCancelFlag",                            m_toneMapCancelFlag,                              false, "Indicates that Tone Mapping SEI message cancels the persistence or follows")
     1510  ("SEIToneMapPersistenceFlag",                       m_toneMapPersistenceFlag,                          true, "Specifies the persistence of the Tone Mapping SEI message")
     1511  ("SEIToneMapCodedDataBitDepth",                     m_toneMapCodedDataBitDepth,                           8, "Specifies Coded Data BitDepth of Tone Mapping SEI messages")
     1512  ("SEIToneMapTargetBitDepth",                        m_toneMapTargetBitDepth,                              8, "Specifies Output BitDepth of Tone mapping function")
     1513  ("SEIToneMapModelId",                               m_toneMapModelId,                                     0, "Specifies Model utilized for mapping coded data into target_bit_depth range\n"
     1514                                                                                                               "\t0:  linear mapping with clipping\n"
     1515                                                                                                               "\t1:  sigmoidal mapping\n"
     1516                                                                                                               "\t2:  user-defined table mapping\n"
     1517                                                                                                               "\t3:  piece-wise linear mapping\n"
     1518                                                                                                               "\t4:  luminance dynamic range information ")
     1519  ("SEIToneMapMinValue",                              m_toneMapMinValue,                                    0, "Specifies the minimum value in mode 0")
     1520  ("SEIToneMapMaxValue",                              m_toneMapMaxValue,                                 1023, "Specifies the maximum value in mode 0")
     1521  ("SEIToneMapSigmoidMidpoint",                       m_sigmoidMidpoint,                                  512, "Specifies the centre point in mode 1")
     1522  ("SEIToneMapSigmoidWidth",                          m_sigmoidWidth,                                     960, "Specifies the distance between 5% and 95% values of the target_bit_depth in mode 1")
     1523  ("SEIToneMapStartOfCodedInterval",                  cfg_startOfCodedInterval,      cfg_startOfCodedInterval, "Array of user-defined mapping table")
     1524  ("SEIToneMapNumPivots",                             m_numPivots,                                          0, "Specifies the number of pivot points in mode 3")
     1525  ("SEIToneMapCodedPivotValue",                       cfg_codedPivotValue,                cfg_codedPivotValue, "Array of pivot point")
     1526  ("SEIToneMapTargetPivotValue",                      cfg_targetPivotValue,              cfg_targetPivotValue, "Array of pivot point")
     1527  ("SEIToneMapCameraIsoSpeedIdc",                     m_cameraIsoSpeedIdc,                                  0, "Indicates the camera ISO speed for daylight illumination")
     1528  ("SEIToneMapCameraIsoSpeedValue",                   m_cameraIsoSpeedValue,                              400, "Specifies the camera ISO speed for daylight illumination of Extended_ISO")
     1529  ("SEIToneMapExposureIndexIdc",                      m_exposureIndexIdc,                                   0, "Indicates the exposure index setting of the camera")
     1530  ("SEIToneMapExposureIndexValue",                    m_exposureIndexValue,                               400, "Specifies the exposure index setting of the camera of Extended_ISO")
     1531  ("SEIToneMapExposureCompensationValueSignFlag",     m_exposureCompensationValueSignFlag,                  0, "Specifies the sign of ExposureCompensationValue")
     1532  ("SEIToneMapExposureCompensationValueNumerator",    m_exposureCompensationValueNumerator,                 0, "Specifies the numerator of ExposureCompensationValue")
     1533  ("SEIToneMapExposureCompensationValueDenomIdc",     m_exposureCompensationValueDenomIdc,                  2, "Specifies the denominator of ExposureCompensationValue")
     1534  ("SEIToneMapRefScreenLuminanceWhite",               m_refScreenLuminanceWhite,                          350, "Specifies reference screen brightness setting in units of candela per square metre")
     1535  ("SEIToneMapExtendedRangeWhiteLevel",               m_extendedRangeWhiteLevel,                          800, "Indicates the luminance dynamic range")
     1536  ("SEIToneMapNominalBlackLevelLumaCodeValue",        m_nominalBlackLevelLumaCodeValue,                    16, "Specifies luma sample value of the nominal black level assigned decoded pictures")
     1537  ("SEIToneMapNominalWhiteLevelLumaCodeValue",        m_nominalWhiteLevelLumaCodeValue,                   235, "Specifies luma sample value of the nominal white level assigned decoded pictures")
     1538  ("SEIToneMapExtendedWhiteLevelLumaCodeValue",       m_extendedWhiteLevelLumaCodeValue,                  300, "Specifies luma sample value of the extended dynamic range assigned decoded pictures")
     1539  ("SEIChromaSamplingFilterHint",                     m_chromaSamplingFilterSEIenabled,                 false, "Control generation of the chroma sampling filter hint SEI message")
     1540  ("SEIChromaSamplingHorizontalFilterType",           m_chromaSamplingHorFilterIdc,                         2, "Defines the Index of the chroma sampling horizontal filter\n"
     1541                                                                                                               "\t0: unspecified  - Chroma filter is unknown or is determined by the application"
     1542                                                                                                               "\t1: User-defined - Filter coefficients are specified in the chroma sampling filter hint SEI message"
     1543                                                                                                               "\t2: Standards-defined - ITU-T Rec. T.800 | ISO/IEC15444-1, 5/3 filter")
     1544  ("SEIChromaSamplingVerticalFilterType",             m_chromaSamplingVerFilterIdc,                         2, "Defines the Index of the chroma sampling vertical filter\n"
     1545                                                                                                               "\t0: unspecified  - Chroma filter is unknown or is determined by the application"
     1546                                                                                                               "\t1: User-defined - Filter coefficients are specified in the chroma sampling filter hint SEI message"
     1547                                                                                                               "\t2: Standards-defined - ITU-T Rec. T.800 | ISO/IEC15444-1, 5/3 filter")
     1548  ("SEIFramePacking",                                 m_framePackingSEIEnabled,                             0, "Control generation of frame packing SEI messages")
     1549  ("SEIFramePackingType",                             m_framePackingSEIType,                                0, "Define frame packing arrangement\n"
     1550                                                                                                               "\t3: side by side - frames are displayed horizontally\n"
     1551                                                                                                               "\t4: top bottom - frames are displayed vertically\n"
     1552                                                                                                               "\t5: frame alternation - one frame is alternated with the other")
     1553  ("SEIFramePackingId",                               m_framePackingSEIId,                                  0, "Id of frame packing SEI message for a given session")
     1554  ("SEIFramePackingQuincunx",                         m_framePackingSEIQuincunx,                            0, "Indicate the presence of a Quincunx type video frame")
     1555  ("SEIFramePackingInterpretation",                   m_framePackingSEIInterpretation,                      0, "Indicate the interpretation of the frame pair\n"
     1556                                                                                                               "\t0: unspecified\n"
     1557                                                                                                               "\t1: stereo pair, frame0 represents left view\n"
     1558                                                                                                               "\t2: stereo pair, frame0 represents right view")
     1559  ("SEISegmentedRectFramePacking",                    m_segmentedRectFramePackingSEIEnabled,                0, "Controls generation of segmented rectangular frame packing SEI messages")
     1560  ("SEISegmentedRectFramePackingCancel",              m_segmentedRectFramePackingSEICancel,             false, "If equal to 1, cancels the persistence of any previous SRFPA SEI message")
     1561  ("SEISegmentedRectFramePackingType",                m_segmentedRectFramePackingSEIType,                   0, "Specifies the arrangement of the frames in the reconstructed picture")
     1562  ("SEISegmentedRectFramePackingPersistence",         m_segmentedRectFramePackingSEIPersistence,        false, "If equal to 0, the SEI applies to the current frame only")
     1563  ("SEIDisplayOrientation",                           m_displayOrientationSEIAngle,                         0, "Control generation of display orientation SEI messages\n"
     1564                                                                                                               "\tN: 0 < N < (2^16 - 1) enable display orientation SEI message with anticlockwise_rotation = N and display_orientation_repetition_period = 1\n"
     1565                                                                                                               "\t0: disable")
     1566  ("SEITemporalLevel0Index",                          m_temporalLevel0IndexSEIEnabled,                      0, "Control generation of temporal level 0 index SEI messages")
     1567  ("SEIGradualDecodingRefreshInfo",                   m_gradualDecodingRefreshInfoEnabled,                  0, "Control generation of gradual decoding refresh information SEI message")
     1568  ("SEINoDisplay",                                    m_noDisplaySEITLayer,                                 0, "Control generation of no display SEI message\n"
     1569                                                                                                               "\tN: 0 < N enable no display SEI message for temporal layer N or higher\n"
     1570                                                                                                               "\t0: disable")
     1571  ("SEIDecodingUnitInfo",                             m_decodingUnitInfoSEIEnabled,                         0, "Control generation of decoding unit information SEI message.")
    11161572#if LAYERS_NOT_PRESENT_SEI
    1117   ("SEILayersNotPresent",            m_layersNotPresentSEIEnabled,             0, "Control generation of layers not present SEI message")
    1118 #endif
    1119   ("SEISOPDescription",              m_SOPDescriptionSEIEnabled,              0, "Control generation of SOP description SEI messages")
    1120   ("SEIScalableNesting",             m_scalableNestingSEIEnabled,              0, "Control generation of scalable nesting SEI messages")
    1121 #if P0050_KNEE_FUNCTION_SEI
    1122   ("SEIKneeFunctionInfo",                 m_kneeSEIEnabled,               false, "Control generation of Knee function SEI messages")
    1123   ("SEIKneeFunctionId",                   m_kneeSEIId,                        0, "Specifies Id of Knee function SEI message for a given session")
    1124   ("SEIKneeFunctionCancelFlag",           m_kneeSEICancelFlag,            false, "Indicates that Knee function SEI message cancels the persistance or follows")
    1125   ("SEIKneeFunctionPersistenceFlag",      m_kneeSEIPersistenceFlag,        true, "Specifies the persistence of the Knee function SEI message")
    1126   ("SEIKneeFunctionMappingFlag",          m_kneeSEIMappingFlag,           false, "Specifies the mapping mode of the Knee function SEI message")
    1127   ("SEIKneeFunctionInputDrange",          m_kneeSEIInputDrange,            1000, "Specifies the peak luminance level for the input picture of Knee function SEI messages")
    1128   ("SEIKneeFunctionInputDispLuminance",   m_kneeSEIInputDispLuminance,      100, "Specifies the expected display brightness for the input picture of Knee function SEI messages")
    1129   ("SEIKneeFunctionOutputDrange",         m_kneeSEIOutputDrange,           4000, "Specifies the peak luminance level for the output picture of Knee function SEI messages")
    1130   ("SEIKneeFunctionOutputDispLuminance",  m_kneeSEIOutputDispLuminance,     800, "Specifies the expected display brightness for the output picture of Knee function SEI messages")
    1131   ("SEIKneeFunctionNumKneePointsMinus1",  m_kneeSEINumKneePointsMinus1,       2, "Specifies the number of knee points - 1")
    1132   ("SEIKneeFunctionInputKneePointValue",  cfg_kneeSEIInputKneePointValue,     string("600 800 900"), "Array of input knee point")
    1133   ("SEIKneeFunctionOutputKneePointValue", cfg_kneeSEIOutputKneePointValue,    string("100 250 450"), "Array of output knee point")
    1134 #endif
     1573  ("SEILayersNotPresent",                             m_layersNotPresentSEIEnabled,             0, "Control generation of layers not present SEI message")
     1574#endif
     1575  ("SEISOPDescription",                               m_SOPDescriptionSEIEnabled,                           0, "Control generation of SOP description SEI messages")
     1576  ("SEIScalableNesting",                              m_scalableNestingSEIEnabled,                          0, "Control generation of scalable nesting SEI messages")
     1577  ("SEITempMotionConstrainedTileSets",                m_tmctsSEIEnabled,                                false, "Control generation of temporal motion constrained tile sets SEI message")
     1578  ("SEITimeCodeEnabled",                              m_timeCodeSEIEnabled,                             false, "Control generation of time code information SEI message")
     1579  ("SEITimeCodeNumClockTs",                           m_timeCodeSEINumTs,                                   0, "Number of clock time sets [0..3]")
     1580  ("SEITimeCodeTimeStampFlag",                        cfg_timeCodeSeiTimeStampFlag,          cfg_timeCodeSeiTimeStampFlag,         "Time stamp flag associated to each time set")
     1581  ("SEITimeCodeFieldBasedFlag",                       cfg_timeCodeSeiNumUnitFieldBasedFlag,  cfg_timeCodeSeiNumUnitFieldBasedFlag, "Field based flag associated to each time set")
     1582  ("SEITimeCodeCountingType",                         cfg_timeCodeSeiCountingType,           cfg_timeCodeSeiCountingType,          "Counting type associated to each time set")
     1583  ("SEITimeCodeFullTsFlag",                           cfg_timeCodeSeiFullTimeStampFlag,      cfg_timeCodeSeiFullTimeStampFlag,     "Full time stamp flag associated to each time set")
     1584  ("SEITimeCodeDiscontinuityFlag",                    cfg_timeCodeSeiDiscontinuityFlag,      cfg_timeCodeSeiDiscontinuityFlag,     "Discontinuity flag associated to each time set")
     1585  ("SEITimeCodeCntDroppedFlag",                       cfg_timeCodeSeiCntDroppedFlag,         cfg_timeCodeSeiCntDroppedFlag,        "Counter dropped flag associated to each time set")
     1586  ("SEITimeCodeNumFrames",                            cfg_timeCodeSeiNumberOfFrames,         cfg_timeCodeSeiNumberOfFrames,        "Number of frames associated to each time set")
     1587  ("SEITimeCodeSecondsValue",                         cfg_timeCodeSeiSecondsValue,           cfg_timeCodeSeiSecondsValue,          "Seconds value for each time set")
     1588  ("SEITimeCodeMinutesValue",                         cfg_timeCodeSeiMinutesValue,           cfg_timeCodeSeiMinutesValue,          "Minutes value for each time set")
     1589  ("SEITimeCodeHoursValue",                           cfg_timeCodeSeiHoursValue,             cfg_timeCodeSeiHoursValue,            "Hours value for each time set")
     1590  ("SEITimeCodeSecondsFlag",                          cfg_timeCodeSeiSecondsFlag,            cfg_timeCodeSeiSecondsFlag,           "Flag to signal seconds value presence in each time set")
     1591  ("SEITimeCodeMinutesFlag",                          cfg_timeCodeSeiMinutesFlag,            cfg_timeCodeSeiMinutesFlag,           "Flag to signal minutes value presence in each time set")
     1592  ("SEITimeCodeHoursFlag",                            cfg_timeCodeSeiHoursFlag,              cfg_timeCodeSeiHoursFlag,             "Flag to signal hours value presence in each time set")
     1593  ("SEITimeCodeOffsetLength",                         cfg_timeCodeSeiTimeOffsetLength,       cfg_timeCodeSeiTimeOffsetLength,      "Time offset length associated to each time set")
     1594  ("SEITimeCodeTimeOffset",                           cfg_timeCodeSeiTimeOffsetValue,        cfg_timeCodeSeiTimeOffsetValue,       "Time offset associated to each time set")
     1595  ("SEIKneeFunctionInfo",                             m_kneeSEIEnabled,                                 false, "Control generation of Knee function SEI messages")
     1596  ("SEIKneeFunctionId",                               m_kneeSEIId,                                          0, "Specifies Id of Knee function SEI message for a given session")
     1597  ("SEIKneeFunctionCancelFlag",                       m_kneeSEICancelFlag,                              false, "Indicates that Knee function SEI message cancels the persistence or follows")
     1598  ("SEIKneeFunctionPersistenceFlag",                  m_kneeSEIPersistenceFlag,                          true, "Specifies the persistence of the Knee function SEI message")
     1599  ("SEIKneeFunctionInputDrange",                      m_kneeSEIInputDrange,                              1000, "Specifies the peak luminance level for the input picture of Knee function SEI messages")
     1600  ("SEIKneeFunctionInputDispLuminance",               m_kneeSEIInputDispLuminance,                        100, "Specifies the expected display brightness for the input picture of Knee function SEI messages")
     1601  ("SEIKneeFunctionOutputDrange",                     m_kneeSEIOutputDrange,                             4000, "Specifies the peak luminance level for the output picture of Knee function SEI messages")
     1602  ("SEIKneeFunctionOutputDispLuminance",              m_kneeSEIOutputDispLuminance,                       800, "Specifies the expected display brightness for the output picture of Knee function SEI messages")
     1603  ("SEIKneeFunctionNumKneePointsMinus1",              m_kneeSEINumKneePointsMinus1,                         2, "Specifies the number of knee points - 1")
     1604  ("SEIKneeFunctionInputKneePointValue",              cfg_kneeSEIInputKneePointValue,   cfg_kneeSEIInputKneePointValue, "Array of input knee point")
     1605  ("SEIKneeFunctionOutputKneePointValue",             cfg_kneeSEIOutputKneePointValue, cfg_kneeSEIOutputKneePointValue, "Array of output knee point")
     1606  ("SEIMasteringDisplayColourVolume",                 m_masteringDisplay.colourVolumeSEIEnabled,         false, "Control generation of mastering display colour volume SEI messages")
     1607  ("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)")
     1608  ("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)")
     1609  ("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)")
     1610  ("SEIMasteringDisplayWhitePoint",                   cfg_DisplayWhitePointCode,     cfg_DisplayWhitePointCode, "Mastering display white point CIE xy coordinates in normalised increments of 1/50000 (e.g. 0.333 = 16667)")
     1611   
    11351612#if Q0096_OVERLAY_SEI
    11361613  ("SEIOverlayInfo",                          m_overlaySEIEnabled,                      false, "Control generation of Selectable Overlays SEI messages")
     
    12181695#endif
    12191696  ;
    1220  
     1697
    12211698  for(Int i=1; i<MAX_GOP+1; i++) {
    12221699    std::ostringstream cOSS;
     
    12591736  }
    12601737#endif
    1261 
    1262   if(m_isField)
    1263   {
    1264 #if SVC_EXTENSION
    1265     for(Int layer = 0; layer < MAX_LAYERS; layer++)
    1266     {
    1267       //Frame height
    1268       m_acLayerCfg[layer].m_iSourceHeightOrg = m_acLayerCfg[layer].m_iSourceHeight;
    1269       //Field height
    1270       m_acLayerCfg[layer].m_iSourceHeight = m_acLayerCfg[layer].m_iSourceHeight >> 1;
    1271     }
    1272 #else
    1273     //Frame height
    1274     m_iSourceHeightOrg = m_iSourceHeight;
    1275     //Field height
    1276     m_iSourceHeight = m_iSourceHeight >> 1;
    1277 #endif
    1278     //number of fields to encode
    1279     m_framesToBeEncoded *= 2;
    1280   }
    12811738 
    12821739  for (list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++)
     
    12841741    fprintf(stderr, "Unhandled argument ignored: `%s'\n", *it);
    12851742  }
    1286  
     1743
    12871744  if (argc == 1 || do_help)
    12881745  {
     
    12911748    return false;
    12921749  }
    1293  
     1750
    12941751  /*
    12951752   * Set any derived parameters
     
    13191776
    13201777
    1321   Char* pColumnWidth = cfgColumnWidth.empty() ? NULL: strdup(cfgColumnWidth.c_str());
    1322   Char* pRowHeight = cfgRowHeight.empty() ? NULL : strdup(cfgRowHeight.c_str());
     1778  if(m_isField)
     1779  {
     1780#if SVC_EXTENSION
     1781    for(Int layer = 0; layer < MAX_LAYERS; layer++)
     1782    {
     1783      //Frame height
     1784      m_acLayerCfg[layer].m_iSourceHeightOrg = m_acLayerCfg[layer].m_iSourceHeight;
     1785      //Field height
     1786      m_acLayerCfg[layer].m_iSourceHeight = m_acLayerCfg[layer].m_iSourceHeight >> 1;
     1787    }
     1788#else
     1789    //Frame height
     1790    m_iSourceHeightOrg = m_iSourceHeight;
     1791    //Field height
     1792    m_iSourceHeight = m_iSourceHeight >> 1;
     1793#endif
     1794    //number of fields to encode
     1795    m_framesToBeEncoded *= 2;
     1796  }
    13231797
    13241798  if( !m_tileUniformSpacingFlag && m_numTileColumnsMinus1 > 0 )
    13251799  {
    1326     char *str;
    1327     int  i=0;
    1328     m_tileColumnWidth.resize( m_numTileColumnsMinus1 );
    1329     str = strtok(pColumnWidth, " ,-");
    1330     while(str!=NULL)
    1331     {
    1332       if( i >= m_numTileColumnsMinus1 )
    1333       {
    1334         printf( "The number of columns whose width are defined is larger than the allowed number of columns.\n" );
    1335         exit( EXIT_FAILURE );
    1336       }
    1337       m_tileColumnWidth[i] = atoi( str );
    1338       str = strtok(NULL, " ,-");
    1339       i++;
    1340     }
    1341     if( i < m_numTileColumnsMinus1 )
     1800    if (cfg_ColumnWidth.values.size() > m_numTileColumnsMinus1)
     1801    {
     1802      printf( "The number of columns whose width are defined is larger than the allowed number of columns.\n" );
     1803      exit( EXIT_FAILURE );
     1804    }
     1805    else if (cfg_ColumnWidth.values.size() < m_numTileColumnsMinus1)
    13421806    {
    13431807      printf( "The width of some columns is not defined.\n" );
    13441808      exit( EXIT_FAILURE );
    13451809    }
     1810    else
     1811    {
     1812      m_tileColumnWidth.resize(m_numTileColumnsMinus1);
     1813      for(UInt i=0; i<cfg_ColumnWidth.values.size(); i++)
     1814        m_tileColumnWidth[i]=cfg_ColumnWidth.values[i];
     1815    }
    13461816  }
    13471817  else
     
    13521822  if( !m_tileUniformSpacingFlag && m_numTileRowsMinus1 > 0 )
    13531823  {
    1354     char *str;
    1355     int  i=0;
    1356     m_tileRowHeight.resize(m_numTileRowsMinus1);
    1357     str = strtok(pRowHeight, " ,-");
    1358     while(str!=NULL)
    1359     {
    1360       if( i>=m_numTileRowsMinus1 )
    1361       {
    1362         printf( "The number of rows whose height are defined is larger than the allowed number of rows.\n" );
    1363         exit( EXIT_FAILURE );
    1364       }
    1365       m_tileRowHeight[i] = atoi( str );
    1366       str = strtok(NULL, " ,-");
    1367       i++;
    1368     }
    1369     if( i < m_numTileRowsMinus1 )
     1824    if (cfg_RowHeight.values.size() > m_numTileRowsMinus1)
     1825    {
     1826      printf( "The number of rows whose height are defined is larger than the allowed number of rows.\n" );
     1827      exit( EXIT_FAILURE );
     1828    }
     1829    else if (cfg_RowHeight.values.size() < m_numTileRowsMinus1)
    13701830    {
    13711831      printf( "The height of some rows is not defined.\n" );
    13721832      exit( EXIT_FAILURE );
    1373    }
     1833    }
     1834    else
     1835    {
     1836      m_tileRowHeight.resize(m_numTileRowsMinus1);
     1837      for(UInt i=0; i<cfg_RowHeight.values.size(); i++)
     1838        m_tileRowHeight[i]=cfg_RowHeight.values[i];
     1839    }
    13741840  }
    13751841  else
     
    13771843    m_tileRowHeight.clear();
    13781844  }
     1845
     1846  m_scalingListFile = cfg_ScalingListFile.empty() ? NULL : strdup(cfg_ScalingListFile.c_str());
     1847
     1848
     1849 
     1850  /* rules for input, output and internal bitdepths as per help text */
     1851#if O0194_DIFFERENT_BITDEPTH_EL_BL
     1852  for(Int layer = 0; layer < MAX_LAYERS; layer++)
     1853  {
     1854    if (m_acLayerCfg[layer].m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ] == 0) { m_acLayerCfg[layer].m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ] = m_acLayerCfg[layer].m_inputBitDepth      [CHANNEL_TYPE_LUMA  ]; }
     1855    if (m_acLayerCfg[layer].m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] == 0) { m_acLayerCfg[layer].m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] = m_acLayerCfg[layer].m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ]; }
     1856    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  ]; }
     1857    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  ]; }
     1858    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  ]; }
     1859    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  ]; }
     1860    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]; }
     1861
     1862    m_acLayerCfg[layer].m_InputChromaFormatIDC = numberToChromaFormat(tmpInputChromaFormat);
     1863    m_acLayerCfg[layer].m_chromaFormatIDC      = ((tmpChromaFormat == 0) ? (m_InputChromaFormatIDC) : (numberToChromaFormat(tmpChromaFormat)));   
     1864  }
     1865#else
     1866  /* rules for input, output and internal bitdepths as per help text */
     1867  if (m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ] == 0) { m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ] = m_inputBitDepth      [CHANNEL_TYPE_LUMA  ]; }
     1868  if (m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] == 0) { m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] = m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ]; }
     1869  if (m_internalBitDepth   [CHANNEL_TYPE_LUMA  ] == 0) { m_internalBitDepth   [CHANNEL_TYPE_LUMA  ] = m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ]; }
     1870  if (m_internalBitDepth   [CHANNEL_TYPE_CHROMA] == 0) { m_internalBitDepth   [CHANNEL_TYPE_CHROMA] = m_internalBitDepth   [CHANNEL_TYPE_LUMA  ]; }
     1871  if (m_inputBitDepth      [CHANNEL_TYPE_CHROMA] == 0) { m_inputBitDepth      [CHANNEL_TYPE_CHROMA] = m_inputBitDepth      [CHANNEL_TYPE_LUMA  ]; }
     1872  if (m_outputBitDepth     [CHANNEL_TYPE_LUMA  ] == 0) { m_outputBitDepth     [CHANNEL_TYPE_LUMA  ] = m_internalBitDepth   [CHANNEL_TYPE_LUMA  ]; }
     1873  if (m_outputBitDepth     [CHANNEL_TYPE_CHROMA] == 0) { m_outputBitDepth     [CHANNEL_TYPE_CHROMA] = m_internalBitDepth   [CHANNEL_TYPE_CHROMA]; }
     1874
     1875  m_InputChromaFormatIDC = numberToChromaFormat(tmpInputChromaFormat);
     1876  m_chromaFormatIDC      = ((tmpChromaFormat == 0) ? (m_InputChromaFormatIDC) : (numberToChromaFormat(tmpChromaFormat)));
     1877#endif
     1878
     1879  if (extendedProfile >= 1000 && extendedProfile <= 2316)
     1880  {
     1881    m_profile = Profile::MAINREXT;
     1882    if (m_bitDepthConstraint != 0 || tmpConstraintChromaFormat != 0)
     1883    {
     1884      fprintf(stderr, "Error: The bit depth and chroma format constraints are not used when an explicit RExt profile is specified\n");
     1885      exit(EXIT_FAILURE);
     1886    }
     1887    m_bitDepthConstraint     = (extendedProfile%100);
     1888    m_intraConstraintFlag    = (extendedProfile>=2000);
     1889    switch ((extendedProfile/100)%10)
     1890    {
     1891      case 0:  tmpConstraintChromaFormat=400; break;
     1892      case 1:  tmpConstraintChromaFormat=420; break;
     1893      case 2:  tmpConstraintChromaFormat=422; break;
     1894      default: tmpConstraintChromaFormat=444; break;
     1895    }
     1896  }
     1897  else
     1898  {
     1899    m_profile = Profile::Name(extendedProfile);
     1900  }
     1901
     1902  if (m_profile == Profile::HIGHTHROUGHPUTREXT )
     1903  {
     1904    if (m_bitDepthConstraint == 0) m_bitDepthConstraint = 16;
     1905    m_chromaFormatConstraint = (tmpConstraintChromaFormat == 0) ? CHROMA_444 : numberToChromaFormat(tmpConstraintChromaFormat);
     1906  }
     1907  else if (m_profile == Profile::MAINREXT)
     1908  {
     1909    if (m_bitDepthConstraint == 0 && tmpConstraintChromaFormat == 0)
     1910    {
    13791911#if SVC_EXTENSION
    1380   if( pColumnWidth )
    1381   {
    1382     free( pColumnWidth );
    1383     pColumnWidth = NULL;
    1384   }
    1385 
    1386   if( pRowHeight )
    1387   {
    1388     free( pRowHeight );
    1389     pRowHeight = NULL;
    1390   }
    1391 
     1912      Bool m_useExtendedPrecision = m_acLayerCfg[0].m_useExtendedPrecision;
     1913      Int  m_internalBitDepth[]   = {m_acLayerCfg[0].m_internalBitDepth[CHANNEL_TYPE_LUMA], m_acLayerCfg[0].m_internalBitDepth[CHANNEL_TYPE_CHROMA]};
     1914#endif
     1915      // produce a valid combination, if possible.
     1916      const Bool bUsingGeneralRExtTools  = m_useResidualRotation                    ||
     1917                                           m_useSingleSignificanceMapContext        ||
     1918                                           m_useResidualDPCM[RDPCM_SIGNAL_IMPLICIT] ||
     1919                                           m_useResidualDPCM[RDPCM_SIGNAL_EXPLICIT] ||
     1920                                           !m_enableIntraReferenceSmoothing         ||
     1921                                           m_useGolombRiceParameterAdaptation       ||
     1922                                           m_transformSkipLog2MaxSize!=2;
     1923      const Bool bUsingChromaQPAdjustment= m_maxCUChromaQpAdjustmentDepth >= 0;
     1924      const Bool bUsingExtendedPrecision = m_useExtendedPrecision;
     1925      m_chromaFormatConstraint = NUM_CHROMA_FORMAT;
     1926      automaticallySelectRExtProfile(bUsingGeneralRExtTools,
     1927                                     bUsingChromaQPAdjustment,
     1928                                     bUsingExtendedPrecision,
     1929                                     m_intraConstraintFlag,
     1930                                     m_bitDepthConstraint,
     1931                                     m_chromaFormatConstraint,
     1932                                     m_chromaFormatIDC==CHROMA_400 ? m_internalBitDepth[CHANNEL_TYPE_LUMA] : std::max(m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA]),
     1933                                     m_chromaFormatIDC);
     1934    }
     1935    else if (m_bitDepthConstraint == 0 || tmpConstraintChromaFormat == 0)
     1936    {
     1937      fprintf(stderr, "Error: The bit depth and chroma format constraints must either both be specified or both be configured automatically\n");
     1938      exit(EXIT_FAILURE);
     1939    }
     1940    else
     1941    {
     1942      m_chromaFormatConstraint = numberToChromaFormat(tmpConstraintChromaFormat);
     1943    }
     1944  }
     1945#if SVC_EXTENSION
     1946  else if( m_profile == Profile::SCALABLE || m_profile == Profile::SCALABLE10 )
     1947  {
     1948    for(Int layer = 0; layer < m_numLayers; layer++)
     1949    {
     1950      m_acLayerCfg[layer].m_bitDepthConstraint     = (m_profile == Profile::SCALABLE10 ? 10 : 8);
     1951      m_acLayerCfg[layer].m_chromaFormatConstraint = (tmpConstraintChromaFormat == 0) ? CHROMA_420 : numberToChromaFormat(tmpConstraintChromaFormat);
     1952
     1953      for(UInt ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++)
     1954      {
     1955        m_acLayerCfg[layer].m_MSBExtendedBitDepth[ch] = m_acLayerCfg[layer].m_inputBitDepth[ch];
     1956
     1957        if (saoOffsetBitShift[ch]<0)
     1958        {
     1959          if (m_acLayerCfg[layer].m_internalBitDepth[ch]>10)
     1960          {
     1961            m_acLayerCfg[layer].m_saoOffsetBitShift[ch]=UInt(Clip3<Int>(0, m_acLayerCfg[layer].m_internalBitDepth[ch]-10, Int(m_acLayerCfg[layer].m_internalBitDepth[ch]-10 + 0.165*m_acLayerCfg[layer].m_iQP - 3.22 + 0.5) ) );
     1962          }
     1963          else
     1964          {
     1965            m_acLayerCfg[layer].m_saoOffsetBitShift[ch]=0;
     1966          }
     1967        }
     1968        else
     1969        {
     1970          m_acLayerCfg[layer].m_saoOffsetBitShift[ch]=UInt(saoOffsetBitShift[ch]);
     1971        }
     1972      }
     1973    }
     1974  }
     1975#endif
     1976  else
     1977  {
     1978    m_chromaFormatConstraint = (tmpConstraintChromaFormat == 0) ? m_chromaFormatIDC : numberToChromaFormat(tmpConstraintChromaFormat);
     1979    m_bitDepthConstraint = (m_profile == Profile::MAIN10?10:8);
     1980  }
     1981
     1982
     1983  m_inputColourSpaceConvert = stringToInputColourSpaceConvert(inputColourSpaceConvert, true);
     1984
     1985#if SVC_EXTENSION
    13921986  for(Int layer = 0; layer < MAX_LAYERS; layer++)
    13931987  {
     
    14122006      Bool phaseSetFlag =
    14132007        strcmp(cfg_phaseHorLuma   [layer].c_str(), "") ||
    1414         strcmp(cfg_phaseVerLuma  [layer].c_str(), "") ||
    1415         strcmp(cfg_phaseHorChroma    [layer].c_str(), "") ||
     2008        strcmp(cfg_phaseVerLuma   [layer].c_str(), "") ||
     2009        strcmp(cfg_phaseHorChroma [layer].c_str(), "") ||
    14162010        strcmp(cfg_phaseVerChroma [layer].c_str(), "");
    14172011      assert( srloFlag || rroFlag || phaseSetFlag);
     
    17642358  for(UInt layer = 0; layer < MAX_LAYERS; layer++)
    17652359  {
    1766     m_acLayerCfg[layer].m_InputChromaFormat =  numberToChromaFormat(cfg_tmpChromaFormatIDC[layer]);
    1767     m_acLayerCfg[layer].m_chromaFormatIDC = ((cfg_tmpChromaFormatIDC[layer] == 0) ? (m_acLayerCfg[layer].m_InputChromaFormat ) : (numberToChromaFormat(cfg_tmpChromaFormatIDC[layer])));
     2360    m_acLayerCfg[layer].m_InputChromaFormatIDC =  numberToChromaFormat(cfg_tmpChromaFormatIDC[layer]);
     2361    m_acLayerCfg[layer].m_chromaFormatIDC = ((cfg_tmpChromaFormatIDC[layer] == 0) ? (m_acLayerCfg[layer].m_InputChromaFormatIDC ) : (numberToChromaFormat(cfg_tmpChromaFormatIDC[layer])));
    17682362  }
    17692363#endif
     
    19242518  delete cfg_outputLayerSetIdx;
    19252519#endif
    1926 #endif //SVC_EXTENSION
    1927   m_scalingListFile = cfg_ScalingListFile.empty() ? NULL : strdup(cfg_ScalingListFile.c_str());
    1928 
    1929   /* rules for input, output and internal bitdepths as per help text */
    1930 #if O0194_DIFFERENT_BITDEPTH_EL_BL
    1931   for(Int layer = 0; layer < MAX_LAYERS; layer++)
    1932   {
    1933     if (!m_acLayerCfg[layer].m_internalBitDepthY) { m_acLayerCfg[layer].m_internalBitDepthY = m_acLayerCfg[layer].m_inputBitDepthY; }
    1934     if (!m_acLayerCfg[layer].m_internalBitDepthC) { m_acLayerCfg[layer].m_internalBitDepthC = m_acLayerCfg[layer].m_internalBitDepthY; }
    1935     if (!m_acLayerCfg[layer].m_inputBitDepthC) { m_acLayerCfg[layer].m_inputBitDepthC = m_acLayerCfg[layer].m_inputBitDepthY; }
    1936     if (!m_acLayerCfg[layer].m_outputBitDepthY) { m_acLayerCfg[layer].m_outputBitDepthY = m_acLayerCfg[layer].m_internalBitDepthY; }
    1937     if (!m_acLayerCfg[layer].m_outputBitDepthC) { m_acLayerCfg[layer].m_outputBitDepthC = m_acLayerCfg[layer].m_internalBitDepthC; }
    1938   }
    1939 #else
    1940   if (!m_internalBitDepthY) { m_internalBitDepthY = m_inputBitDepthY; }
    1941   if (!m_internalBitDepthC) { m_internalBitDepthC = m_internalBitDepthY; }
    1942   if (!m_inputBitDepthC) { m_inputBitDepthC = m_inputBitDepthY; }
    1943   if (!m_outputBitDepthY) { m_outputBitDepthY = m_internalBitDepthY; }
    1944   if (!m_outputBitDepthC) { m_outputBitDepthC = m_internalBitDepthC; }
    1945 #endif
    1946 
    1947 #if !SVC_EXTENSION
    1948   // TODO:ChromaFmt assumes 4:2:0 below
     2520#else //SVC_EXTENSION
    19492521  switch (m_conformanceWindowMode)
    19502522  {
     
    19752547        }
    19762548      }
    1977       if (m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0)
     2549      if (m_aiPad[0] % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0)
    19782550      {
    19792551        fprintf(stderr, "Error: picture width is not an integer multiple of the specified chroma subsampling\n");
    19802552        exit(EXIT_FAILURE);
    19812553      }
    1982       if (m_aiPad[1] % TComSPS::getWinUnitY(CHROMA_420) != 0)
     2554      if (m_aiPad[1] % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0)
    19832555      {
    19842556        fprintf(stderr, "Error: picture height is not an integer multiple of the specified chroma subsampling\n");
     
    20112583    }
    20122584  }
    2013  
     2585
    20142586  // allocate slice-based dQP values
    20152587  m_aidQP = new Int[ m_framesToBeEncoded + m_iGOPSize + 1 ];
    20162588  ::memset( m_aidQP, 0, sizeof(Int)*( m_framesToBeEncoded + m_iGOPSize + 1 ) );
    2017  
     2589
    20182590  // handling of floating-point QP values
    20192591  // if QP is not integer, sequence is split into two sections having QP and QP+1
     
    20222594  {
    20232595    Int iSwitchPOC = (Int)( m_framesToBeEncoded - (m_fQP - m_iQP)*m_framesToBeEncoded + 0.5 );
    2024    
     2596
    20252597    iSwitchPOC = (Int)( (Double)iSwitchPOC / m_iGOPSize + 0.5 )*m_iGOPSize;
    20262598    for ( Int i=iSwitchPOC; i<m_framesToBeEncoded + m_iGOPSize + 1; i++ )
     
    20292601    }
    20302602  }
    2031  
     2603
     2604  for(UInt ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++)
     2605  {
     2606    if (saoOffsetBitShift[ch]<0)
     2607    {
     2608      if (m_internalBitDepth[ch]>10)
     2609      {
     2610        m_saoOffsetBitShift[ch]=UInt(Clip3<Int>(0, m_internalBitDepth[ch]-10, Int(m_internalBitDepth[ch]-10 + 0.165*m_iQP - 3.22 + 0.5) ) );
     2611      }
     2612      else
     2613      {
     2614        m_saoOffsetBitShift[ch]=0;
     2615      }
     2616    }
     2617    else
     2618    {
     2619      m_saoOffsetBitShift[ch]=UInt(saoOffsetBitShift[ch]);
     2620    }
     2621  }
     2622
    20322623  // reading external dQP description from file
    20332624  if ( m_pchdQPFile )
     
    20492640  m_iWaveFrontSubstreams = m_iWaveFrontSynchro ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1;
    20502641#endif
     2642  if( m_masteringDisplay.colourVolumeSEIEnabled )
     2643  {
     2644    for(UInt idx=0; idx<6; idx++)
     2645    {
     2646      m_masteringDisplay.primaries[idx/2][idx%2] = UShort((cfg_DisplayPrimariesCode.values.size() > idx) ? cfg_DisplayPrimariesCode.values[idx] : 0);
     2647    }
     2648    for(UInt idx=0; idx<2; idx++)
     2649    {
     2650      m_masteringDisplay.whitePoint[idx] = UShort((cfg_DisplayWhitePointCode.values.size() > idx) ? cfg_DisplayWhitePointCode.values[idx] : 0);
     2651    }
     2652  }
     2653   
    20512654  if( m_toneMappingInfoSEIEnabled && !m_toneMapCancelFlag )
    20522655  {
    2053     Char* pcStartOfCodedInterval = cfg_startOfCodedInterval.empty() ? NULL: strdup(cfg_startOfCodedInterval.c_str());
    2054     Char* pcCodedPivotValue = cfg_codedPivotValue.empty() ? NULL: strdup(cfg_codedPivotValue.c_str());
    2055     Char* pcTargetPivotValue = cfg_targetPivotValue.empty() ? NULL: strdup(cfg_targetPivotValue.c_str());
    2056     if( m_toneMapModelId == 2 && pcStartOfCodedInterval )
    2057     {
    2058       char *startOfCodedInterval;
    2059       UInt num = 1u<< m_toneMapTargetBitDepth;
     2656    if( m_toneMapModelId == 2 && !cfg_startOfCodedInterval.values.empty() )
     2657    {
     2658      const UInt num = 1u<< m_toneMapTargetBitDepth;
    20602659      m_startOfCodedInterval = new Int[num];
    2061       ::memset( m_startOfCodedInterval, 0, sizeof(Int)*num );
    2062       startOfCodedInterval = strtok(pcStartOfCodedInterval, " .");
    2063       int i = 0;
    2064       while( startOfCodedInterval && ( i < num ) )
    2065       {
    2066         m_startOfCodedInterval[i] = atoi( startOfCodedInterval );
    2067         startOfCodedInterval = strtok(NULL, " .");
    2068         i++;
    2069       }
    2070     }
     2660      for(UInt i=0; i<num; i++)
     2661      {
     2662        m_startOfCodedInterval[i] = cfg_startOfCodedInterval.values.size() > i ? cfg_startOfCodedInterval.values[i] : 0;
     2663      }
     2664    }
    20712665    else
    20722666    {
     
    20752669    if( ( m_toneMapModelId == 3 ) && ( m_numPivots > 0 ) )
    20762670    {
    2077       if( pcCodedPivotValue && pcTargetPivotValue )
    2078       {
    2079         char *codedPivotValue;
    2080         char *targetPivotValue;
    2081         m_codedPivotValue = new Int[m_numPivots];
     2671      if( !cfg_codedPivotValue.values.empty() && !cfg_targetPivotValue.values.empty() )
     2672      {
     2673        m_codedPivotValue  = new Int[m_numPivots];
    20822674        m_targetPivotValue = new Int[m_numPivots];
    2083         ::memset( m_codedPivotValue, 0, sizeof(Int)*( m_numPivots ) );
    2084         ::memset( m_targetPivotValue, 0, sizeof(Int)*( m_numPivots ) );
    2085         codedPivotValue = strtok(pcCodedPivotValue, " .");
    2086         int i=0;
    2087         while(codedPivotValue&&i<m_numPivots)
    2088         {
    2089           m_codedPivotValue[i] = atoi( codedPivotValue );
    2090           codedPivotValue = strtok(NULL, " .");
    2091           i++;
    2092         }
    2093         i=0;
    2094         targetPivotValue = strtok(pcTargetPivotValue, " .");
    2095         while(targetPivotValue&&i<m_numPivots)
    2096         {
    2097           m_targetPivotValue[i]= atoi( targetPivotValue );
    2098           targetPivotValue = strtok(NULL, " .");
    2099           i++;
     2675        for(UInt i=0; i<m_numPivots; i++)
     2676        {
     2677          m_codedPivotValue[i]  = cfg_codedPivotValue.values.size()  > i ? cfg_codedPivotValue.values [i] : 0;
     2678          m_targetPivotValue[i] = cfg_targetPivotValue.values.size() > i ? cfg_targetPivotValue.values[i] : 0;
    21002679        }
    21012680      }
     
    21062685      m_targetPivotValue = NULL;
    21072686    }
    2108 
    2109     if( pcStartOfCodedInterval )
    2110     {
    2111       free( pcStartOfCodedInterval );
    2112       pcStartOfCodedInterval = NULL;
    2113     }
    2114 
    2115     if( pcCodedPivotValue )
    2116     {
    2117       free( pcCodedPivotValue );
    2118       pcCodedPivotValue = NULL;
    2119     }
    2120 
    2121     if( pcTargetPivotValue )
    2122     {
    2123       free( pcTargetPivotValue );
    2124       pcTargetPivotValue = NULL;
    2125     }
    2126   }
    2127 #if P0050_KNEE_FUNCTION_SEI
     2687  }
     2688
    21282689  if( m_kneeSEIEnabled && !m_kneeSEICancelFlag )
    21292690  {
    2130     Char* pcInputKneePointValue  = cfg_kneeSEIInputKneePointValue.empty()  ? NULL : strdup(cfg_kneeSEIInputKneePointValue.c_str());
    2131     Char* pcOutputKneePointValue = cfg_kneeSEIOutputKneePointValue.empty() ? NULL : strdup(cfg_kneeSEIOutputKneePointValue.c_str());
    21322691    assert ( m_kneeSEINumKneePointsMinus1 >= 0 && m_kneeSEINumKneePointsMinus1 < 999 );
    2133     m_kneeSEIInputKneePoint = new Int[m_kneeSEINumKneePointsMinus1+1];
     2692    m_kneeSEIInputKneePoint  = new Int[m_kneeSEINumKneePointsMinus1+1];
    21342693    m_kneeSEIOutputKneePoint = new Int[m_kneeSEINumKneePointsMinus1+1];
    2135     char *InputVal = strtok(pcInputKneePointValue, " .,");
    2136     Int i=0;
    2137     while( InputVal && i<(m_kneeSEINumKneePointsMinus1+1) )
    2138     {
    2139       m_kneeSEIInputKneePoint[i] = (UInt) atoi( InputVal );
    2140       InputVal = strtok(NULL, " .,");
    2141       i++;
    2142     }
    2143     char *OutputVal = strtok(pcOutputKneePointValue, " .,");
    2144     i=0;
    2145     while( OutputVal && i<(m_kneeSEINumKneePointsMinus1+1) )
    2146     {
    2147       m_kneeSEIOutputKneePoint[i] = (UInt) atoi( OutputVal );
    2148       OutputVal = strtok(NULL, " .,");
    2149       i++;
    2150     }
    2151 
    2152     if( pcInputKneePointValue )
    2153     {
    2154       free( pcInputKneePointValue );
    2155       pcInputKneePointValue = NULL;
    2156     }
    2157 
    2158     if( pcOutputKneePointValue )
    2159     {
    2160       free( pcOutputKneePointValue );
    2161       pcOutputKneePointValue = NULL;
    2162     }
    2163   }
    2164 #endif
     2694    for(Int i=0; i<(m_kneeSEINumKneePointsMinus1+1); i++)
     2695    {
     2696      m_kneeSEIInputKneePoint[i]  = cfg_kneeSEIInputKneePointValue.values.size()  > i ? cfg_kneeSEIInputKneePointValue.values[i]  : 1;
     2697      m_kneeSEIOutputKneePoint[i] = cfg_kneeSEIOutputKneePointValue.values.size() > i ? cfg_kneeSEIOutputKneePointValue.values[i] : 0;
     2698    }
     2699  }
     2700
     2701  if(m_timeCodeSEIEnabled)
     2702  {
     2703    for(Int i = 0; i < m_timeCodeSEINumTs && i < MAX_TIMECODE_SEI_SETS; i++)
     2704    {
     2705      m_timeSetArray[i].clockTimeStampFlag    = cfg_timeCodeSeiTimeStampFlag        .values.size()>i ? cfg_timeCodeSeiTimeStampFlag        .values [i] : false;
     2706      m_timeSetArray[i].numUnitFieldBasedFlag = cfg_timeCodeSeiNumUnitFieldBasedFlag.values.size()>i ? cfg_timeCodeSeiNumUnitFieldBasedFlag.values [i] : 0;
     2707      m_timeSetArray[i].countingType          = cfg_timeCodeSeiCountingType         .values.size()>i ? cfg_timeCodeSeiCountingType         .values [i] : 0;
     2708      m_timeSetArray[i].fullTimeStampFlag     = cfg_timeCodeSeiFullTimeStampFlag    .values.size()>i ? cfg_timeCodeSeiFullTimeStampFlag    .values [i] : 0;
     2709      m_timeSetArray[i].discontinuityFlag     = cfg_timeCodeSeiDiscontinuityFlag    .values.size()>i ? cfg_timeCodeSeiDiscontinuityFlag    .values [i] : 0;
     2710      m_timeSetArray[i].cntDroppedFlag        = cfg_timeCodeSeiCntDroppedFlag       .values.size()>i ? cfg_timeCodeSeiCntDroppedFlag       .values [i] : 0;
     2711      m_timeSetArray[i].numberOfFrames        = cfg_timeCodeSeiNumberOfFrames       .values.size()>i ? cfg_timeCodeSeiNumberOfFrames       .values [i] : 0;
     2712      m_timeSetArray[i].secondsValue          = cfg_timeCodeSeiSecondsValue         .values.size()>i ? cfg_timeCodeSeiSecondsValue         .values [i] : 0;
     2713      m_timeSetArray[i].minutesValue          = cfg_timeCodeSeiMinutesValue         .values.size()>i ? cfg_timeCodeSeiMinutesValue         .values [i] : 0;
     2714      m_timeSetArray[i].hoursValue            = cfg_timeCodeSeiHoursValue           .values.size()>i ? cfg_timeCodeSeiHoursValue           .values [i] : 0;
     2715      m_timeSetArray[i].secondsFlag           = cfg_timeCodeSeiSecondsFlag          .values.size()>i ? cfg_timeCodeSeiSecondsFlag          .values [i] : 0;
     2716      m_timeSetArray[i].minutesFlag           = cfg_timeCodeSeiMinutesFlag          .values.size()>i ? cfg_timeCodeSeiMinutesFlag          .values [i] : 0;
     2717      m_timeSetArray[i].hoursFlag             = cfg_timeCodeSeiHoursFlag            .values.size()>i ? cfg_timeCodeSeiHoursFlag            .values [i] : 0;
     2718      m_timeSetArray[i].timeOffsetLength      = cfg_timeCodeSeiTimeOffsetLength     .values.size()>i ? cfg_timeCodeSeiTimeOffsetLength     .values [i] : 0;
     2719      m_timeSetArray[i].timeOffsetValue       = cfg_timeCodeSeiTimeOffsetValue      .values.size()>i ? cfg_timeCodeSeiTimeOffsetValue      .values [i] : 0;
     2720    }
     2721  }
    21652722#if Q0096_OVERLAY_SEI
    21662723  if( m_overlaySEIEnabled && !m_overlayInfoCancelFlag )
     
    22412798#if !SVC_EXTENSION
    22422799  // reading external Colour Remapping Information SEI message parameters from file
    2243   if( m_colourRemapSEIFile.size() > 0 )
     2800  if( m_colourRemapSEIFile )
    22442801  {
    22452802    FILE* fic;
     
    22472804    if((fic = fopen(m_colourRemapSEIFile.c_str(),"r")) == (FILE*)NULL)
    22482805    {
    2249       fprintf(stderr, "Can't open Colour Remapping Information SEI parameters file %s\n", m_colourRemapSEIFile.c_str());
     2806      fprintf(stderr, "Can't open Colour Remapping Information SEI parameters file %s\n", m_colourRemapSEIFile);
    22502807      exit(EXIT_FAILURE);
    22512808    }
     
    24483005#endif
    24493006  // check validity of input parameters
     3007#if SVC_EXTENSION
     3008  for( UInt layerId = 0; layerId < m_numLayers; layerId++ )
     3009  {
     3010    xCheckParameter(layerId);
     3011  }
     3012#else
    24503013  xCheckParameter();
    2451  
     3014#endif
     3015
    24523016  // set global varibles
    24533017#if LAYER_CTB
     
    24623026  // print-out parameters
    24633027  xPrintParameter();
    2464  
     3028
    24653029  return true;
    24663030}
     3031
     3032
    24673033// ====================================================================================================================
    24683034// Private member functions
    24693035// ====================================================================================================================
    24703036
    2471 Bool confirmPara(Bool bflag, const Char* message);
    2472 
     3037#if SVC_EXTENSION
     3038Void TAppEncCfg::xCheckParameter(UInt layerId)
     3039{
     3040  Bool m_useExtendedPrecision                = m_acLayerCfg[layerId].m_useExtendedPrecision;
     3041  Bool m_useHighPrecisionPredictionWeighting = m_acLayerCfg[layerId].m_useHighPrecisionPredictionWeighting;
     3042  m_chromaFormatIDC             = m_acLayerCfg[layerId].m_chromaFormatIDC;
     3043  m_chromaFormatConstraint      = m_acLayerCfg[layerId].m_chromaFormatConstraint;
     3044  m_bitDepthConstraint                  = m_acLayerCfg[layerId].m_bitDepthConstraint;
     3045
     3046  Int m_inputBitDepth[]       = {m_acLayerCfg[layerId].m_inputBitDepth[CHANNEL_TYPE_LUMA],       m_acLayerCfg[layerId].m_inputBitDepth[CHANNEL_TYPE_CHROMA]};
     3047  Int m_internalBitDepth[]    = {m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_LUMA],    m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_CHROMA]};
     3048  Int m_MSBExtendedBitDepth[] = {m_acLayerCfg[layerId].m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA], m_acLayerCfg[layerId].m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA]}; 
     3049
     3050  m_saoOffsetBitShift[CHANNEL_TYPE_LUMA]   = m_acLayerCfg[layerId].m_saoOffsetBitShift[CHANNEL_TYPE_LUMA];
     3051  m_saoOffsetBitShift[CHANNEL_TYPE_CHROMA] = m_acLayerCfg[layerId].m_saoOffsetBitShift[CHANNEL_TYPE_CHROMA];
     3052#else
    24733053Void TAppEncCfg::xCheckParameter()
    24743054{
     3055#endif
     3056
    24753057  if (!m_decodedPictureHashSEIEnabled)
    24763058  {
     
    24963078  Bool check_failed = false; /* abort if there is a fatal configuration problem */
    24973079#define xConfirmPara(a,b) check_failed |= confirmPara(a,b)
     3080
     3081  const UInt maxBitDepth=(m_chromaFormatIDC==CHROMA_400) ? m_internalBitDepth[CHANNEL_TYPE_LUMA] : std::max(m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA]);
     3082  xConfirmPara(m_bitDepthConstraint<maxBitDepth, "The internalBitDepth must not be greater than the bitDepthConstraint value");
     3083  xConfirmPara(m_chromaFormatConstraint<m_chromaFormatIDC, "The chroma format used must not be greater than the chromaFormatConstraint value");
     3084
     3085  if (m_profile==Profile::MAINREXT || m_profile==Profile::HIGHTHROUGHPUTREXT)
     3086  {
     3087    xConfirmPara(m_lowerBitRateConstraintFlag==false && m_intraConstraintFlag==false, "The lowerBitRateConstraint flag cannot be false when intraConstraintFlag is false");
     3088    xConfirmPara(m_alignCABACBeforeBypass && m_profile!=Profile::HIGHTHROUGHPUTREXT, "AlignCABACBeforeBypass must not be enabled unless the high throughput profile is being used.");
     3089    if (m_profile == Profile::MAINREXT)
     3090    {
     3091      const UInt intraIdx = m_intraConstraintFlag ? 1:0;
     3092      const UInt bitDepthIdx = (m_bitDepthConstraint == 8 ? 0 : (m_bitDepthConstraint ==10 ? 1 : (m_bitDepthConstraint == 12 ? 2 : (m_bitDepthConstraint == 16 ? 3 : 4 ))));
     3093      const UInt chromaFormatIdx = UInt(m_chromaFormatConstraint);
     3094      const Bool bValidProfile = (bitDepthIdx > 3 || chromaFormatIdx>3) ? false : (validRExtProfileNames[intraIdx][bitDepthIdx][chromaFormatIdx] != NONE);
     3095      xConfirmPara(!bValidProfile, "Invalid intra constraint flag, bit depth constraint flag and chroma format constraint flag combination for a RExt profile");
     3096      const Bool bUsingGeneralRExtTools  = m_useResidualRotation                    ||
     3097                                           m_useSingleSignificanceMapContext        ||
     3098                                           m_useResidualDPCM[RDPCM_SIGNAL_IMPLICIT] ||
     3099                                           m_useResidualDPCM[RDPCM_SIGNAL_EXPLICIT] ||
     3100                                           !m_enableIntraReferenceSmoothing         ||
     3101                                           m_useGolombRiceParameterAdaptation       ||
     3102                                           m_transformSkipLog2MaxSize!=2;
     3103      const Bool bUsingChromaQPTool      = m_maxCUChromaQpAdjustmentDepth >= 0;
     3104      const Bool bUsingExtendedPrecision = m_useExtendedPrecision;
     3105
     3106      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");
     3107      xConfirmPara(m_bitDepthConstraint != 16 && bUsingExtendedPrecision, "Extended precision can only be used in 16-bit RExt profiles");
     3108      if (!(m_chromaFormatConstraint == CHROMA_400 && m_bitDepthConstraint == 16) && m_chromaFormatConstraint!=CHROMA_444)
     3109      {
     3110        xConfirmPara(bUsingGeneralRExtTools, "Combination of tools and profiles are not possible in the specified RExt profile.");
     3111      }
     3112      if (!m_intraConstraintFlag && m_bitDepthConstraint==16 && m_chromaFormatConstraint==CHROMA_444)
     3113      {
     3114        fprintf(stderr, "********************************************************************************************************\n");
     3115        fprintf(stderr, "** WARNING: The RExt constraint flags describe a non standard combination (used for development only) **\n");
     3116        fprintf(stderr, "********************************************************************************************************\n");
     3117      }
     3118    }
     3119    else
     3120    {
     3121      xConfirmPara( m_chromaFormatConstraint != CHROMA_444, "chroma format constraint must be 4:4:4 in the High Throughput 4:4:4 16-bit Intra profile.");
     3122      xConfirmPara( m_bitDepthConstraint     != 16,         "bit depth constraint must be 4:4:4 in the High Throughput 4:4:4 16-bit Intra profile.");
     3123      xConfirmPara( m_intraConstraintFlag    != 1,          "intra constraint flag must be 1 in the High Throughput 4:4:4 16-bit Intra profile.");
     3124    }
     3125  }
     3126#if SVC_EXTENSION
     3127  else if( m_profile==Profile::SCALABLE || m_profile==Profile::SCALABLE10 )
     3128  {
     3129    xConfirmPara(m_bitDepthConstraint!=((m_profile==Profile::SCALABLE10)?10:8), "BitDepthConstraint must be 8 for MAIN profile and 10 for MAIN10 profile.");
     3130    xConfirmPara(m_chromaFormatConstraint!=CHROMA_420, "ChromaFormatConstraint must be 420 for non main-RExt profiles.");
     3131    xConfirmPara(m_intraConstraintFlag==true, "IntraConstraintFlag must be false for non main_RExt profiles.");
     3132    xConfirmPara(m_lowerBitRateConstraintFlag==false, "LowerBitrateConstraintFlag must be true for non main-RExt profiles.");
     3133
     3134    xConfirmPara(m_useCrossComponentPrediction==true, "CrossComponentPrediction must not be used for non main-RExt profiles.");
     3135    xConfirmPara(m_transformSkipLog2MaxSize!=2, "Transform Skip Log2 Max Size must be 2 for V1 profiles.");
     3136    xConfirmPara(m_useResidualRotation==true, "UseResidualRotation must not be enabled for non main-RExt profiles.");
     3137    xConfirmPara(m_useSingleSignificanceMapContext==true, "UseSingleSignificanceMapContext must not be enabled for non main-RExt profiles.");
     3138    xConfirmPara(m_useResidualDPCM[RDPCM_SIGNAL_IMPLICIT]==true, "ImplicitResidualDPCM must not be enabled for non main-RExt profiles.");
     3139    xConfirmPara(m_useResidualDPCM[RDPCM_SIGNAL_EXPLICIT]==true, "ExplicitResidualDPCM must not be enabled for non main-RExt profiles.");
     3140    xConfirmPara(m_useGolombRiceParameterAdaptation==true, "GolombRiceParameterAdaption must not be enabled for non main-RExt profiles.");
     3141    xConfirmPara(m_useExtendedPrecision==true, "UseExtendedPrecision must not be enabled for non main-RExt profiles.");
     3142    xConfirmPara(m_useHighPrecisionPredictionWeighting==true, "UseHighPrecisionPredictionWeighting must not be enabled for non main-RExt profiles.");
     3143    xConfirmPara(m_enableIntraReferenceSmoothing==false, "EnableIntraReferenceSmoothing must be enabled for non main-RExt profiles.");
     3144    xConfirmPara(m_alignCABACBeforeBypass, "AlignCABACBeforeBypass cannot be enabled for non main-RExt profiles.");
     3145  }
     3146#endif
     3147  else
     3148  {
     3149    xConfirmPara(m_bitDepthConstraint!=((m_profile==Profile::MAIN10)?10:8), "BitDepthConstraint must be 8 for MAIN profile and 10 for MAIN10 profile.");
     3150    xConfirmPara(m_chromaFormatConstraint!=CHROMA_420, "ChromaFormatConstraint must be 420 for non main-RExt profiles.");
     3151    xConfirmPara(m_intraConstraintFlag==true, "IntraConstraintFlag must be false for non main_RExt profiles.");
     3152    xConfirmPara(m_lowerBitRateConstraintFlag==false, "LowerBitrateConstraintFlag must be true for non main-RExt profiles.");
     3153
     3154    xConfirmPara(m_useCrossComponentPrediction==true, "CrossComponentPrediction must not be used for non main-RExt profiles.");
     3155    xConfirmPara(m_transformSkipLog2MaxSize!=2, "Transform Skip Log2 Max Size must be 2 for V1 profiles.");
     3156    xConfirmPara(m_useResidualRotation==true, "UseResidualRotation must not be enabled for non main-RExt profiles.");
     3157    xConfirmPara(m_useSingleSignificanceMapContext==true, "UseSingleSignificanceMapContext must not be enabled for non main-RExt profiles.");
     3158    xConfirmPara(m_useResidualDPCM[RDPCM_SIGNAL_IMPLICIT]==true, "ImplicitResidualDPCM must not be enabled for non main-RExt profiles.");
     3159    xConfirmPara(m_useResidualDPCM[RDPCM_SIGNAL_EXPLICIT]==true, "ExplicitResidualDPCM must not be enabled for non main-RExt profiles.");
     3160    xConfirmPara(m_useGolombRiceParameterAdaptation==true, "GolombRiceParameterAdaption must not be enabled for non main-RExt profiles.");
     3161    xConfirmPara(m_useExtendedPrecision==true, "UseExtendedPrecision must not be enabled for non main-RExt profiles.");
     3162    xConfirmPara(m_useHighPrecisionPredictionWeighting==true, "UseHighPrecisionPredictionWeighting must not be enabled for non main-RExt profiles.");
     3163    xConfirmPara(m_enableIntraReferenceSmoothing==false, "EnableIntraReferenceSmoothing must be enabled for non main-RExt profiles.");
     3164    xConfirmPara(m_alignCABACBeforeBypass, "AlignCABACBeforeBypass cannot be enabled for non main-RExt profiles.");
     3165  }
     3166
    24983167  // check range of parameters
    2499 #if O0194_DIFFERENT_BITDEPTH_EL_BL
    2500   for(UInt layer=0; layer<m_numLayers; layer++)
    2501   {
    2502     xConfirmPara( m_acLayerCfg[layer].m_inputBitDepthY < 8,                                                     "InputBitDepth must be at least 8" );
    2503     xConfirmPara( m_acLayerCfg[layer].m_inputBitDepthC < 8,                                                     "InputBitDepthC must be at least 8" );
    2504   }
    2505 #else
    2506   xConfirmPara( m_inputBitDepthY < 8,                                                     "InputBitDepth must be at least 8" );
    2507   xConfirmPara( m_inputBitDepthC < 8,                                                     "InputBitDepthC must be at least 8" );
    2508 #endif
     3168  xConfirmPara( m_inputBitDepth[CHANNEL_TYPE_LUMA  ] < 8,                                   "InputBitDepth must be at least 8" );
     3169  xConfirmPara( m_inputBitDepth[CHANNEL_TYPE_CHROMA] < 8,                                   "InputBitDepthC must be at least 8" );
     3170
     3171#if !RExt__HIGH_BIT_DEPTH_SUPPORT
     3172  if (m_useExtendedPrecision)
     3173  {
     3174    for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
     3175    {
     3176      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...");
     3177    }
     3178  }
     3179  else
     3180  {
     3181    for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
     3182    {
     3183      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...");
     3184    }
     3185  }
     3186#endif
     3187
     3188  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)" );
     3189  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)" );
     3190
     3191  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");
     3192  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");
     3193
     3194  xConfirmPara( m_chromaFormatIDC >= NUM_CHROMA_FORMAT,                                     "ChromaFormatIDC must be either 400, 420, 422 or 444" );
     3195  std::string sTempIPCSC="InputColourSpaceConvert must be empty, "+getListOfColourSpaceConverts(true);
     3196  xConfirmPara( m_inputColourSpaceConvert >= NUMBER_INPUT_COLOUR_SPACE_CONVERSIONS,         sTempIPCSC.c_str() );
     3197  xConfirmPara( m_InputChromaFormatIDC >= NUM_CHROMA_FORMAT,                                "InputChromaFormatIDC must be either 400, 420, 422 or 444" );
     3198
    25093199#if !SVC_EXTENSION 
    25103200  xConfirmPara( m_iFrameRate <= 0,                                                          "Frame rate must be more than 1" );
     
    25253215  xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 2,                   "Decoding Refresh Type must be equal to 0, 1 or 2" );
    25263216#endif
     3217
     3218  if (m_isField)
     3219  {
     3220    if (!m_pictureTimingSEIEnabled)
     3221    {
     3222      fprintf(stderr, "****************************************************************************\n");
     3223      fprintf(stderr, "** WARNING: Picture Timing SEI should be enabled for field coding!        **\n");
     3224      fprintf(stderr, "****************************************************************************\n");
     3225    }
     3226  }
     3227  if ( m_bufferingPeriodSEIEnabled && !m_activeParameterSetsSEIEnabled)
     3228  {
     3229    fprintf(stderr, "****************************************************************************\n");
     3230    fprintf(stderr, "** WARNING: using buffering period SEI requires SPS activation with       **\n");
     3231    fprintf(stderr, "**          active parameter sets SEI. Enabling active parameter sets SEI **\n");
     3232    fprintf(stderr, "****************************************************************************\n");
     3233    m_activeParameterSetsSEIEnabled = 1;
     3234  }
     3235  if ( m_pictureTimingSEIEnabled && !m_activeParameterSetsSEIEnabled)
     3236  {
     3237    fprintf(stderr, "****************************************************************************\n");
     3238    fprintf(stderr, "** WARNING: using picture timing SEI requires SPS activation with active  **\n");
     3239    fprintf(stderr, "**          parameter sets SEI. Enabling active parameter sets SEI.       **\n");
     3240    fprintf(stderr, "****************************************************************************\n");
     3241    m_activeParameterSetsSEIEnabled = 1;
     3242  }
     3243
     3244  if(m_useCrossComponentPrediction && (m_chromaFormatIDC != CHROMA_444))
     3245  {
     3246    fprintf(stderr, "****************************************************************************\n");
     3247    fprintf(stderr, "** WARNING: Cross-component prediction is specified for 4:4:4 format only **\n");
     3248    fprintf(stderr, "****************************************************************************\n");
     3249
     3250    m_useCrossComponentPrediction = false;
     3251  }
     3252
     3253  if ( m_CUTransquantBypassFlagForce && m_bUseHADME )
     3254  {
     3255    fprintf(stderr, "****************************************************************************\n");
     3256    fprintf(stderr, "** WARNING: --HadamardME has been disabled due to the enabling of         **\n");
     3257    fprintf(stderr, "**          --CUTransquantBypassFlagForce                                 **\n");
     3258    fprintf(stderr, "****************************************************************************\n");
     3259
     3260    m_bUseHADME = false; // this has been disabled so that the lambda is calculated slightly differently for lossless modes (as a result of JCTVC-R0104).
     3261  }
     3262
     3263  xConfirmPara (m_transformSkipLog2MaxSize < 2, "Transform Skip Log2 Max Size must be at least 2 (4x4)");
     3264
     3265  if (m_transformSkipLog2MaxSize!=2 && m_useTransformSkipFast)
     3266  {
     3267    fprintf(stderr, "***************************************************************************\n");
     3268    fprintf(stderr, "** WARNING: Transform skip fast is enabled (which only tests NxN splits),**\n");
     3269    fprintf(stderr, "**          but transform skip log2 max size is not 2 (4x4)              **\n");
     3270    fprintf(stderr, "**          It may be better to disable transform skip fast mode         **\n");
     3271    fprintf(stderr, "***************************************************************************\n");
     3272  }
     3273
    25273274#if !SVC_EXTENSION
    2528   xConfirmPara( m_iQP <  -6 * (m_internalBitDepthY - 8) || m_iQP > 51,                    "QP exceeds supported range (-QpBDOffsety to 51)" );
    2529 #endif
    2530   xConfirmPara( m_loopFilterBetaOffsetDiv2 < -6 || m_loopFilterBetaOffsetDiv2 > 6,          "Loop Filter Beta Offset div. 2 exceeds supported range (-6 to 6)");
    2531   xConfirmPara( m_loopFilterTcOffsetDiv2 < -6 || m_loopFilterTcOffsetDiv2 > 6,              "Loop Filter Tc Offset div. 2 exceeds supported range (-6 to 6)");
     3275  xConfirmPara( m_iQP <  -6 * (m_internalBitDepth[CHANNEL_TYPE_LUMA] - 8) || m_iQP > 51,    "QP exceeds supported range (-QpBDOffsety to 51)" );
     3276#endif
     3277  xConfirmPara( m_loopFilterBetaOffsetDiv2 < -6 || m_loopFilterBetaOffsetDiv2 > 6,        "Loop Filter Beta Offset div. 2 exceeds supported range (-6 to 6)");
     3278  xConfirmPara( m_loopFilterTcOffsetDiv2 < -6 || m_loopFilterTcOffsetDiv2 > 6,            "Loop Filter Tc Offset div. 2 exceeds supported range (-6 to 6)");
    25323279  xConfirmPara( m_iFastSearch < 0 || m_iFastSearch > 2,                                     "Fast Search Mode is not supported value (0:Full search  1:Diamond  2:PMVFAST)" );
    25333280  xConfirmPara( m_iSearchRange < 0 ,                                                        "Search Range must be more than 0" );
     
    25693316  xConfirmPara( m_uiQuadtreeTULog2MinSize < 2,                                        "QuadtreeTULog2MinSize must be 2 or greater.");
    25703317  xConfirmPara( m_uiQuadtreeTULog2MaxSize > 5,                                        "QuadtreeTULog2MaxSize must be 5 or smaller.");
    2571   xConfirmPara( (1<<m_uiQuadtreeTULog2MaxSize) > m_uiMaxCUWidth,                                        "QuadtreeTULog2MaxSize must be log2(maxCUSize) or smaller.");
    2572  
    25733318  xConfirmPara( m_uiQuadtreeTULog2MaxSize < m_uiQuadtreeTULog2MinSize,                "QuadtreeTULog2MaxSize must be greater than or equal to m_uiQuadtreeTULog2MinSize.");
    2574   xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUWidth >>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS
    2575   xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUHeight>>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS
    2576   xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUWidth  >> m_uiMaxCUDepth ), "Minimum CU width must be greater than minimum transform size." );
    2577   xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUHeight >> m_uiMaxCUDepth ), "Minimum CU height must be greater than minimum transform size." );
     3319  xConfirmPara( (1<<m_uiQuadtreeTULog2MaxSize) > m_uiMaxCUWidth,                      "QuadtreeTULog2MaxSize must be log2(maxCUSize) or smaller.");
     3320  xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) >= ( m_uiMaxCUWidth  >> (m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than or equal to minimum CU size" );
     3321  xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) >= ( m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than or equal to minimum CU size" );
    25783322  xConfirmPara( m_uiQuadtreeTUMaxDepthInter < 1,                                                         "QuadtreeTUMaxDepthInter must be greater than or equal to 1" );
    25793323  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" );
     
    25943338  if( m_usePCM)
    25953339  {
     3340    for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
     3341    {
     3342      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)");
     3343    }
    25963344    xConfirmPara(  m_uiPCMLog2MinSize < 3,                                      "PCMLog2MinSize must be 3 or greater.");
    25973345    xConfirmPara(  m_uiPCMLog2MinSize > 5,                                      "PCMLog2MinSize must be 5 or smaller.");
     
    26133361#if !SVC_EXTENSION
    26143362  Bool tileFlag = (m_numTileColumnsMinus1 > 0 || m_numTileRowsMinus1 > 0 );
    2615   xConfirmPara( tileFlag && m_iWaveFrontSynchro,            "Tile and Wavefront can not be applied together");
    2616 
    2617   //TODO:ChromaFmt assumes 4:2:0 below
    2618   xConfirmPara( m_iSourceWidth  % TComSPS::getWinUnitX(CHROMA_420) != 0, "Picture width must be an integer multiple of the specified chroma subsampling");
    2619   xConfirmPara( m_iSourceHeight % TComSPS::getWinUnitY(CHROMA_420) != 0, "Picture height must be an integer multiple of the specified chroma subsampling");
    2620 
    2621   xConfirmPara( m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0, "Horizontal padding must be an integer multiple of the specified chroma subsampling");
    2622   xConfirmPara( m_aiPad[1] % TComSPS::getWinUnitY(CHROMA_420) != 0, "Vertical padding must be an integer multiple of the specified chroma subsampling");
    2623 
    2624   xConfirmPara( m_confWinLeft   % TComSPS::getWinUnitX(CHROMA_420) != 0, "Left conformance window offset must be an integer multiple of the specified chroma subsampling");
    2625   xConfirmPara( m_confWinRight  % TComSPS::getWinUnitX(CHROMA_420) != 0, "Right conformance window offset must be an integer multiple of the specified chroma subsampling");
    2626   xConfirmPara( m_confWinTop    % TComSPS::getWinUnitY(CHROMA_420) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling");
    2627   xConfirmPara( m_confWinBottom % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling");
     3363  if (m_profile!=Profile::HIGHTHROUGHPUTREXT)
     3364  {
     3365    xConfirmPara( tileFlag && m_iWaveFrontSynchro,            "Tile and Wavefront can not be applied together, except in the High Throughput Intra 4:4:4 16 profile");
     3366  }
     3367
     3368  xConfirmPara( m_iSourceWidth  % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Picture width must be an integer multiple of the specified chroma subsampling");
     3369  xConfirmPara( m_iSourceHeight % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Picture height must be an integer multiple of the specified chroma subsampling");
     3370
     3371  xConfirmPara( m_aiPad[0] % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Horizontal padding must be an integer multiple of the specified chroma subsampling");
     3372  xConfirmPara( m_aiPad[1] % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Vertical padding must be an integer multiple of the specified chroma subsampling");
     3373
     3374  xConfirmPara( m_confWinLeft   % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Left conformance window offset must be an integer multiple of the specified chroma subsampling");
     3375  xConfirmPara( m_confWinRight  % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Right conformance window offset must be an integer multiple of the specified chroma subsampling");
     3376  xConfirmPara( m_confWinTop    % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling");
     3377  xConfirmPara( m_confWinBottom % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling");
    26283378
    26293379  xConfirmPara( m_defaultDisplayWindowFlag && !m_vuiParametersPresentFlag, "VUI needs to be enabled for default display window");
     
    26313381  if (m_defaultDisplayWindowFlag)
    26323382  {
    2633     xConfirmPara( m_defDispWinLeftOffset   % TComSPS::getWinUnitX(CHROMA_420) != 0, "Left default display window offset must be an integer multiple of the specified chroma subsampling");
    2634     xConfirmPara( m_defDispWinRightOffset  % TComSPS::getWinUnitX(CHROMA_420) != 0, "Right default display window offset must be an integer multiple of the specified chroma subsampling");
    2635     xConfirmPara( m_defDispWinTopOffset    % TComSPS::getWinUnitY(CHROMA_420) != 0, "Top default display window offset must be an integer multiple of the specified chroma subsampling");
    2636     xConfirmPara( m_defDispWinBottomOffset % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom default display window offset must be an integer multiple of the specified chroma subsampling");
     3383    xConfirmPara( m_defDispWinLeftOffset   % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Left default display window offset must be an integer multiple of the specified chroma subsampling");
     3384    xConfirmPara( m_defDispWinRightOffset  % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Right default display window offset must be an integer multiple of the specified chroma subsampling");
     3385    xConfirmPara( m_defDispWinTopOffset    % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Top default display window offset must be an integer multiple of the specified chroma subsampling");
     3386    xConfirmPara( m_defDispWinBottomOffset % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Bottom default display window offset must be an integer multiple of the specified chroma subsampling");
    26373387  }
    26383388#endif
     
    26693419    m_GOPList[0].m_numRefPicsActive = 4;
    26703420  }
    2671 
    2672   for(UInt layer = 0; layer < MAX_LAYERS; layer++)
    2673   {
    2674     if (m_acLayerCfg[layer].m_iIntraPeriod == 1 && m_EhGOPList[layer][0].m_POC == -1) {
    2675       m_EhGOPList[layer][0] = GOPEntry();
    2676       m_EhGOPList[layer][0].m_QPFactor = 1;
    2677       m_EhGOPList[layer][0].m_betaOffsetDiv2 = 0;
    2678       m_EhGOPList[layer][0].m_tcOffsetDiv2 = 0;
    2679       m_EhGOPList[layer][0].m_POC = 1;
    2680       m_EhGOPList[layer][0].m_numRefPicsActive = 4;
    2681     }
     3421  else
     3422  {
     3423    xConfirmPara( m_intraConstraintFlag, "IntraConstraintFlag cannot be 1 for inter sequences");
     3424  }
     3425
     3426  if (m_acLayerCfg[layerId].m_iIntraPeriod == 1 && m_EhGOPList[layerId][0].m_POC == -1) {
     3427    m_EhGOPList[layerId][0] = GOPEntry();
     3428    m_EhGOPList[layerId][0].m_QPFactor = 1;
     3429    m_EhGOPList[layerId][0].m_betaOffsetDiv2 = 0;
     3430    m_EhGOPList[layerId][0].m_tcOffsetDiv2 = 0;
     3431    m_EhGOPList[layerId][0].m_POC = 1;
     3432    m_EhGOPList[layerId][0].m_numRefPicsActive = 4;
     3433  }
     3434  else
     3435  {
     3436    xConfirmPara( m_intraConstraintFlag, "IntraConstraintFlag cannot be 1 for inter sequences");
    26823437  }
    26833438#else
     
    26933448      m_GOPList[0].m_numRefPicsActive = 4;
    26943449    }
    2695   }
    2696 #endif
    2697 #else
    2698   if (m_iIntraPeriod == 1 && m_GOPList[0].m_POC == -1) {
     3450    else
     3451    {
     3452      xConfirmPara( m_intraConstraintFlag, "IntraConstraintFlag cannot be 1 for inter sequences");
     3453    }
     3454  }
     3455#endif
     3456#else
     3457  if (m_iIntraPeriod == 1 && m_GOPList[0].m_POC == -1)
     3458  {
    26993459    m_GOPList[0] = GOPEntry();
    27003460    m_GOPList[0].m_QPFactor = 1;
     
    27033463    m_GOPList[0].m_POC = 1;
    27043464    m_GOPList[0].m_numRefPicsActive = 4;
     3465  }
     3466  else
     3467  {
     3468    xConfirmPara( m_intraConstraintFlag, "IntraConstraintFlag cannot be 1 for inter sequences");
    27053469  }
    27063470#endif
     
    27173481  }
    27183482  Bool isOK[MAX_GOP];
    2719   for(Int i=0; i<MAX_GOP; i++) 
     3483  for(Int i=0; i<MAX_GOP; i++)
    27203484  {
    27213485    isOK[i]=false;
     
    27513515
    27523516  // verify layer configuration parameters
    2753   for(UInt layer=0; layer<m_numLayers; layer++)
    2754   {
    2755     if(m_acLayerCfg[layer].xCheckParameter(m_isField))
    2756     {
    2757       printf("\nError: invalid configuration parameter found in layer %d \n", layer);
    2758       check_failed = true;
    2759     }
     3517  if(m_acLayerCfg[layerId].xCheckParameter(m_isField))
     3518  {
     3519    printf("\nError: invalid configuration parameter found in layer %d \n", layerId);
     3520    check_failed = true;
    27603521  }
    27613522
    27623523  // verify layer configuration parameters
    2763   for(UInt layer=0; layer<m_numLayers; layer++)
    2764   {
    2765     Int m_iIntraPeriod = m_acLayerCfg[layer].m_iIntraPeriod;
     3524  Int m_iIntraPeriod = m_acLayerCfg[layerId].m_iIntraPeriod;
    27663525#endif
    27673526  if ( (m_iIntraPeriod != 1) && !m_loopFilterOffsetInPPS && m_DeblockingFilterControlPresent && (!m_bLoopFilterDisable) )
     
    27733532    }
    27743533  }
    2775 #if SVC_EXTENSION
    2776   }
    2777 #endif
    27783534
    27793535#if !Q0108_TSA_STSA
    2780    m_extraRPSs = 0;                                      
     3536  m_extraRPSs=0;                                     
    27813537#else
    27823538  memset( m_extraRPSs, 0, sizeof( m_extraRPSs ) );
    27833539#endif
    27843540  //start looping through frames in coding order until we can verify that the GOP structure is correct.
    2785   while(!verifiedGOP&&!errorGOP) 
     3541  while(!verifiedGOP&&!errorGOP)
    27863542  {
    27873543    Int curGOP = (checkGOP-1)%m_iGOPSize;
    2788     Int curPOC = ((checkGOP-1)/m_iGOPSize)*m_iGOPSize + m_GOPList[curGOP].m_POC;   
    2789     if(m_GOPList[curGOP].m_POC<0) 
     3544    Int curPOC = ((checkGOP-1)/m_iGOPSize)*m_iGOPSize + m_GOPList[curGOP].m_POC;
     3545    if(m_GOPList[curGOP].m_POC<0)
    27903546    {
    27913547      printf("\nError: found fewer Reference Picture Sets than GOPSize\n");
    27923548      errorGOP=true;
    27933549    }
    2794     else 
     3550    else
    27953551    {
    27963552      //check that all reference pictures are available, or have a POC < 0 meaning they might be available in the next GOP.
    27973553      Bool beforeI = false;
    2798       for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) 
     3554      for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++)
    27993555      {
    28003556        Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i];
     
    28033559          beforeI=true;
    28043560        }
    2805         else 
     3561        else
    28063562        {
    28073563          Bool found=false;
    2808           for(Int j=0; j<numRefs; j++) 
     3564          for(Int j=0; j<numRefs; j++)
    28093565          {
    2810             if(refList[j]==absPOC) 
     3566            if(refList[j]==absPOC)
    28113567            {
    28123568              found=true;
     
    28343590      {
    28353591        //all ref frames were present
    2836         if(!isOK[curGOP]) 
     3592        if(!isOK[curGOP])
    28373593        {
    28383594          numOK++;
     
    28443600        }
    28453601      }
    2846       else 
     3602      else
    28473603      {
    28483604        //create a new GOPEntry for this frame containing all the reference pictures that were available (POC > 0)
     
    28533609#endif
    28543610        Int newRefs=0;
    2855         for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) 
     3611        for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++)
    28563612        {
    28573613          Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i];
     
    28693625        }
    28703626        Int numPrefRefs = m_GOPList[curGOP].m_numRefPicsActive;
    2871        
     3627
    28723628        for(Int offset = -1; offset>-checkGOP; offset--)
    28733629        {
     
    28853641              }
    28863642            }
    2887             for(Int i=0; i<newRefs; i++) 
     3643            for(Int i=0; i<newRefs; i++)
    28883644            {
    28893645#if !Q0108_TSA_STSA
     
    28963652              }
    28973653            }
    2898             if(newRef) 
     3654            if(newRef)
    28993655            {
    29003656              Int insertPoint=newRefs;
     
    30493805
    30503806#if SVC_EXTENSION && Q0108_TSA_STSA
    3051   for ( Int layerId = 1; layerId < m_numLayers; layerId++ )
     3807  if( layerId > 0 )
    30523808  {
    30533809    verifiedGOP=false;
     
    32954051      m_maxTempLayer = m_GOPList[i].m_temporalId+1;
    32964052    }
    3297     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");
     4053    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");
    32984054  }
    32994055
    33004056#if Q0108_TSA_STSA
    3301   for ( Int layerId = 1; layerId < m_numLayers; layerId++)
     4057  if( layerId > 0 )
    33024058  {
    33034059    m_EhMaxTempLayer[layerId] = 1;
     
    33184074    m_maxDecPicBuffering[i] = 1;
    33194075  }
    3320   for(Int i=0; i<m_iGOPSize; i++) 
     4076  for(Int i=0; i<m_iGOPSize; i++)
    33214077  {
    33224078    if(m_GOPList[i].m_numRefPics+1 > m_maxDecPicBuffering[m_GOPList[i].m_temporalId])
     
    33244080      m_maxDecPicBuffering[m_GOPList[i].m_temporalId] = m_GOPList[i].m_numRefPics + 1;
    33254081    }
    3326     Int highestDecodingNumberWithLowerPOC = 0; 
     4082    Int highestDecodingNumberWithLowerPOC = 0;
    33274083    for(Int j=0; j<m_iGOPSize; j++)
    33284084    {
     
    33354091    for(Int j=0; j<highestDecodingNumberWithLowerPOC; j++)
    33364092    {
    3337       if(m_GOPList[j].m_temporalId <= m_GOPList[i].m_temporalId && 
     4093      if(m_GOPList[j].m_temporalId <= m_GOPList[i].m_temporalId &&
    33384094        m_GOPList[j].m_POC > m_GOPList[i].m_POC)
    33394095      {
    33404096        numReorder++;
    33414097      }
    3342     }   
     4098    }
    33434099    if(numReorder > m_numReorderPics[m_GOPList[i].m_temporalId])
    33444100    {
     
    33464102    }
    33474103  }
    3348   for(Int i=0; i<MAX_TLAYER-1; i++) 
     4104  for(Int i=0; i<MAX_TLAYER-1; i++)
    33494105  {
    33504106    // a lower layer can not have higher value of m_numReorderPics than a higher layer
     
    33654121  }
    33664122
    3367 
    33684123  // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ] -  1, inclusive
    33694124  if(m_numReorderPics[MAX_TLAYER-1] > m_maxDecPicBuffering[MAX_TLAYER-1] - 1)
     
    33734128
    33744129#if SVC_EXTENSION // ToDo: it should be checked for the case when parameters are different for the layers
    3375   for(UInt layer = 0; layer < MAX_LAYERS; layer++)
    3376   {
    3377     Int m_iSourceWidth = m_acLayerCfg[layer].m_iSourceWidth;
    3378     Int m_iSourceHeight = m_acLayerCfg[layer].m_iSourceHeight;
     4130  Int m_iSourceWidth = m_acLayerCfg[layerId].m_iSourceWidth;
     4131  Int m_iSourceHeight = m_acLayerCfg[layerId].m_iSourceHeight;
    33794132#if LAYER_CTB
    3380     Int m_uiMaxCUWidth = m_acLayerCfg[layer].m_uiMaxCUWidth;
    3381     Int m_uiMaxCUHeight = m_acLayerCfg[layer].m_uiMaxCUHeight;
    3382 #endif
    3383 
    3384     Bool tileFlag = (m_numTileColumnsMinus1 > 0 || m_numTileRowsMinus1 > 0 );
    3385     Int m_iWaveFrontSynchro = m_acLayerCfg[layer].m_waveFrontSynchro;
    3386     xConfirmPara( tileFlag && m_iWaveFrontSynchro,            "Tile and Wavefront can not be applied together");
     4133  Int m_uiMaxCUWidth = m_acLayerCfg[layerId].m_uiMaxCUWidth;
     4134  Int m_uiMaxCUHeight = m_acLayerCfg[layerId].m_uiMaxCUHeight;
     4135#endif
     4136
     4137  Bool tileFlag = (m_numTileColumnsMinus1 > 0 || m_numTileRowsMinus1 > 0 );
     4138  Int m_iWaveFrontSynchro = m_acLayerCfg[layerId].m_waveFrontSynchro;
     4139  xConfirmPara( tileFlag && m_iWaveFrontSynchro,            "Tile and Wavefront can not be applied together");
    33874140#endif
    33884141
    33894142  if(m_vuiParametersPresentFlag && m_bitstreamRestrictionFlag)
    3390   { 
     4143  {
    33914144    Int PicSizeInSamplesY =  m_iSourceWidth * m_iSourceHeight;
    33924145    if(tileFlag)
     
    34004153        maxTileWidth = m_uiMaxCUWidth*((widthInCU+m_numTileColumnsMinus1)/(m_numTileColumnsMinus1+1));
    34014154        maxTileHeight = m_uiMaxCUHeight*((heightInCU+m_numTileRowsMinus1)/(m_numTileRowsMinus1+1));
    3402         // if only the last tile-row is one treeblock higher than the others 
     4155        // if only the last tile-row is one treeblock higher than the others
    34034156        // the maxTileHeight becomes smaller if the last row of treeblocks has lower height than the others
    34044157        if(!((heightInCU-1)%(m_numTileRowsMinus1+1)))
    34054158        {
    34064159          maxTileHeight = maxTileHeight - m_uiMaxCUHeight + (m_iSourceHeight % m_uiMaxCUHeight);
    3407         }     
    3408         // if only the last tile-column is one treeblock wider than the others 
    3409         // the maxTileWidth becomes smaller if the last column of treeblocks has lower width than the others   
     4160        }
     4161        // if only the last tile-column is one treeblock wider than the others
     4162        // the maxTileWidth becomes smaller if the last column of treeblocks has lower width than the others
    34104163        if(!((widthInCU-1)%(m_numTileColumnsMinus1+1)))
    34114164        {
     
    34514204      m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/((2*m_iSourceHeight+m_iSourceWidth)*m_uiMaxCUHeight)-4;
    34524205    }
    3453     else if(m_sliceMode == 1)
     4206    else if(m_sliceMode == FIXED_NUMBER_OF_CTU)
    34544207    {
    34554208      m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/(m_sliceArgument*m_uiMaxCUWidth*m_uiMaxCUHeight)-4;
     
    34604213    }
    34614214  }
    3462 #if SVC_EXTENSION
    3463   }
    3464 #endif
    34654215#if !SVC_EXTENSION
    34664216  xConfirmPara( m_iWaveFrontSynchro < 0, "WaveFrontSynchro cannot be negative" );
     
    34824232    xConfirmPara( m_extendedWhiteLevelLumaCodeValue < m_nominalWhiteLevelLumaCodeValue, "SEIToneMapExtendedWhiteLevelLumaCodeValue shall be greater than or equal to SEIToneMapNominalWhiteLevelLumaCodeValue");
    34834233  }
    3484 #if P0050_KNEE_FUNCTION_SEI
     4234
    34854235  if (m_kneeSEIEnabled && !m_kneeSEICancelFlag)
    34864236  {
     
    34914241      if ( i > 0 )
    34924242      {
    3493         xConfirmPara( m_kneeSEIInputKneePoint[i-1] >= m_kneeSEIInputKneePoint[i],  "The i-th SEIKneeFunctionInputKneePointValue must be greather than the (i-1)-th value");
    3494       }
    3495     }
    3496   }
    3497 #endif
     4243        xConfirmPara( m_kneeSEIInputKneePoint[i-1] >= m_kneeSEIInputKneePoint[i],  "The i-th SEIKneeFunctionInputKneePointValue must be greater than the (i-1)-th value");
     4244        xConfirmPara( m_kneeSEIOutputKneePoint[i-1] > m_kneeSEIOutputKneePoint[i],  "The i-th SEIKneeFunctionOutputKneePointValue must be greater than or equal to the (i-1)-th value");
     4245      }
     4246    }
     4247  }
     4248
    34984249#if Q0096_OVERLAY_SEI
    34994250  if( m_overlaySEIEnabled && !m_overlayInfoCancelFlag )
     
    35124263#if Q0074_COLOUR_REMAPPING_SEI
    35134264#if !SVC_EXTENSION
    3514   if ( ( m_colourRemapSEIFile.size() > 0 ) && !m_colourRemapSEICancelFlag )
     4265  if ( m_colourRemapSEIFile && !m_colourRemapSEICancelFlag )
    35154266  {
    35164267    xConfirmPara( m_colourRemapSEIInputBitDepth < 8 || m_colourRemapSEIInputBitDepth > 16 , "colour_remap_input_bit_depth shall be in the range of 8 to 16, inclusive");
     
    35454296
    35464297#if RC_SHVC_HARMONIZATION
    3547   for ( Int layer=0; layer<m_numLayers; layer++ )
    3548   {
    3549     if ( m_acLayerCfg[layer].m_RCEnableRateControl )
    3550     {
    3551       if ( m_acLayerCfg[layer].m_RCForceIntraQP )
    3552       {
    3553         if ( m_acLayerCfg[layer].m_RCInitialQP == 0 )
    3554         {
    3555           printf( "\nInitial QP for rate control is not specified. Reset not to use force intra QP!" );
    3556           m_acLayerCfg[layer].m_RCForceIntraQP = false;
    3557         }
    3558       }
    3559     }
    3560     xConfirmPara( m_uiDeltaQpRD > 0, "Rate control cannot be used together with slice level multiple-QP optimization!\n" );
    3561   }
     4298  if ( m_acLayerCfg[layerId].m_RCEnableRateControl )
     4299  {
     4300    if ( m_acLayerCfg[layerId].m_RCForceIntraQP )
     4301    {
     4302      if ( m_acLayerCfg[layerId].m_RCInitialQP == 0 )
     4303      {
     4304        printf( "\nInitial QP for rate control is not specified. Reset not to use force intra QP!" );
     4305        m_acLayerCfg[layerId].m_RCForceIntraQP = false;
     4306      }
     4307    }
     4308  }
     4309  xConfirmPara( m_uiDeltaQpRD > 0, "Rate control cannot be used together with slice level multiple-QP optimization!\n" );
    35624310#else
    35634311  if ( m_RCEnableRateControl )
     
    35784326
    35794327  xConfirmPara(m_log2ParallelMergeLevel < 2, "Log2ParallelMergeLevel should be larger than or equal to 2");
     4328
    35804329  if (m_framePackingSEIEnabled)
    35814330  {
    35824331    xConfirmPara(m_framePackingSEIType < 3 || m_framePackingSEIType > 5 , "SEIFramePackingType must be in rage 3 to 5");
     4332  }
     4333
     4334  if (m_segmentedRectFramePackingSEIEnabled)
     4335  {
     4336    xConfirmPara(m_framePackingSEIEnabled > 0 , "SEISegmentedRectFramePacking must be 0 when SEIFramePacking is 1");
     4337  }
     4338
     4339  if((m_numTileColumnsMinus1 <= 0) && (m_numTileRowsMinus1 <= 0) && m_tmctsSEIEnabled)
     4340  {
     4341    printf("SEITempMotionConstrainedTileSets is set to false to disable 'temporal_motion_constrained_tile_sets' SEI because there are no tiles enabled\n");
     4342    m_tmctsSEIEnabled = false;
     4343  }
     4344
     4345  if(m_timeCodeSEIEnabled)
     4346  {
     4347    xConfirmPara(m_timeCodeSEINumTs > MAX_TIMECODE_SEI_SETS, "Number of time sets cannot exceed 3");
    35834348  }
    35844349
     
    35874352  xConfirmPara( (m_acLayerCfg[0].m_numSamplePredRefLayers != 0) && (m_acLayerCfg[0].m_numSamplePredRefLayers != -1), "Layer 0 cannot have any reference layers" );
    35884353  // 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
    3589   for(Int layer = 1; layer < MAX_LAYERS; layer++)
    3590   {
    3591     xConfirmPara(m_acLayerCfg[layer].m_numSamplePredRefLayers > layer, "Cannot reference more layers than before current layer");
    3592     for(Int i = 0; i < m_acLayerCfg[layer].m_numSamplePredRefLayers; i++)
    3593     {
    3594       xConfirmPara(m_acLayerCfg[layer].m_samplePredRefLayerIds[i] > layer, "Cannot reference higher layers");
    3595       xConfirmPara(m_acLayerCfg[layer].m_samplePredRefLayerIds[i] == layer, "Cannot reference the current layer itself");
     4354  if( layerId > 0 )
     4355  {
     4356    xConfirmPara(m_acLayerCfg[layerId].m_numSamplePredRefLayers > layerId, "Cannot reference more layers than before current layer");
     4357    for(Int i = 0; i < m_acLayerCfg[layerId].m_numSamplePredRefLayers; i++)
     4358    {
     4359      xConfirmPara(m_acLayerCfg[layerId].m_samplePredRefLayerIds[i] > layerId, "Cannot reference higher layers");
     4360      xConfirmPara(m_acLayerCfg[layerId].m_samplePredRefLayerIds[i] == layerId, "Cannot reference the current layer itself");
    35964361    }
    35974362  }
    35984363  xConfirmPara( (m_acLayerCfg[0].m_numMotionPredRefLayers != 0) && (m_acLayerCfg[0].m_numMotionPredRefLayers != -1), "Layer 0 cannot have any reference layers" );
    35994364  // 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
    3600   for(Int layer = 1; layer < MAX_LAYERS; layer++)
    3601   {
    3602     xConfirmPara(m_acLayerCfg[layer].m_numMotionPredRefLayers > layer, "Cannot reference more layers than before current layer");
    3603     for(Int i = 0; i < m_acLayerCfg[layer].m_numMotionPredRefLayers; i++)
    3604     {
    3605       xConfirmPara(m_acLayerCfg[layer].m_motionPredRefLayerIds[i] > layer, "Cannot reference higher layers");
    3606       xConfirmPara(m_acLayerCfg[layer].m_motionPredRefLayerIds[i] == layer, "Cannot reference the current layer itself");
     4365  if( layerId > 0 )
     4366  {
     4367    xConfirmPara(m_acLayerCfg[layerId].m_numMotionPredRefLayers > layerId, "Cannot reference more layers than before current layer");
     4368    for(Int i = 0; i < m_acLayerCfg[layerId].m_numMotionPredRefLayers; i++)
     4369    {
     4370      xConfirmPara(m_acLayerCfg[layerId].m_motionPredRefLayerIds[i] > layerId, "Cannot reference higher layers");
     4371      xConfirmPara(m_acLayerCfg[layerId].m_motionPredRefLayerIds[i] == layerId, "Cannot reference the current layer itself");
    36074372    }
    36084373  }
     
    36104375  xConfirmPara( (m_acLayerCfg[0].m_numActiveRefLayers != 0) && (m_acLayerCfg[0].m_numActiveRefLayers != -1), "Layer 0 cannot have any active reference layers" );
    36114376  // 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
    3612   for(Int layer = 1; layer < MAX_LAYERS; layer++)
     4377  if( layerId > 0 )
    36134378  {
    36144379    Bool predEnabledFlag[MAX_LAYERS];
    3615     for (Int refLayer = 0; refLayer < layer; refLayer++)
     4380    for (Int refLayer = 0; refLayer < layerId; refLayer++)
    36164381    {
    36174382      predEnabledFlag[refLayer] = false;
    36184383    }
    3619     for(Int i = 0; i < m_acLayerCfg[layer].m_numSamplePredRefLayers; i++)
    3620     {
    3621       predEnabledFlag[m_acLayerCfg[layer].m_samplePredRefLayerIds[i]] = true;
    3622     }
    3623     for(Int i = 0; i < m_acLayerCfg[layer].m_numMotionPredRefLayers; i++)
    3624     {
    3625       predEnabledFlag[m_acLayerCfg[layer].m_motionPredRefLayerIds[i]] = true;
     4384    for(Int i = 0; i < m_acLayerCfg[layerId].m_numSamplePredRefLayers; i++)
     4385    {
     4386      predEnabledFlag[m_acLayerCfg[layerId].m_samplePredRefLayerIds[i]] = true;
     4387    }
     4388    for(Int i = 0; i < m_acLayerCfg[layerId].m_numMotionPredRefLayers; i++)
     4389    {
     4390      predEnabledFlag[m_acLayerCfg[layerId].m_motionPredRefLayerIds[i]] = true;
    36264391    }
    36274392    Int numDirectRefLayers = 0;
    3628     for (Int refLayer = 0; refLayer < layer; refLayer++)
     4393    for (Int refLayer = 0; refLayer < layerId; refLayer++)
    36294394    {
    36304395      if (predEnabledFlag[refLayer] == true) numDirectRefLayers++;
    36314396    }
    3632     xConfirmPara(m_acLayerCfg[layer].m_numActiveRefLayers > numDirectRefLayers, "Cannot reference more layers than NumDirectRefLayers");
    3633     for(Int i = 0; i < m_acLayerCfg[layer].m_numActiveRefLayers; i++)
    3634     {
    3635       xConfirmPara(m_acLayerCfg[layer].m_predLayerIds[i] >= numDirectRefLayers, "Cannot reference higher layers");
     4397    xConfirmPara(m_acLayerCfg[layerId].m_numActiveRefLayers > numDirectRefLayers, "Cannot reference more layers than NumDirectRefLayers");
     4398    for(Int i = 0; i < m_acLayerCfg[layerId].m_numActiveRefLayers; i++)
     4399    {
     4400      xConfirmPara(m_acLayerCfg[layerId].m_predLayerIds[i] >= numDirectRefLayers, "Cannot reference higher layers");
    36364401    }
    36374402  }
     
    36544419  }
    36554420#endif
    3656   for (UInt layer=0; layer < MAX_LAYERS-1; layer++)
    3657   {
    3658     xConfirmPara(m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1 < 0 || m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1 > 7, "MaxTidIlRefPicsPlus1 must be in range 0 to 7");
     4421  if( layerId < MAX_LAYERS-1 )
     4422  {
     4423    xConfirmPara(m_acLayerCfg[layerId].m_maxTidIlRefPicsPlus1 < 0 || m_acLayerCfg[layerId].m_maxTidIlRefPicsPlus1 > 7, "MaxTidIlRefPicsPlus1 must be in range 0 to 7");
    36594424  }
    36604425#if AUXILIARY_PICTURES
    3661   for (UInt layer=0; layer < MAX_LAYERS-1; layer++)
     4426  if( layerId < MAX_LAYERS-1 )
    36624427  {
    36634428#if R0062_AUX_PSEUDO_MONOCHROME
    3664     xConfirmPara(m_acLayerCfg[layer].m_auxId < 0 || m_acLayerCfg[layer].m_auxId > 2, "AuxId must be in range 0 to 2");
    3665 #else
    3666     xConfirmPara(m_acLayerCfg[layer].m_auxId < 0 || m_acLayerCfg[layer].m_auxId > 4, "AuxId must be in range 0 to 4");
    3667     xConfirmPara(m_acLayerCfg[layer].m_auxId > 0 && m_acLayerCfg[layer].m_chromaFormatIDC != CHROMA_400, "Auxiliary picture must be monochrome picture");
     4429    xConfirmPara(m_acLayerCfg[layerId].m_auxId < 0 || m_acLayerCfg[layerId].m_auxId > 2, "AuxId must be in range 0 to 2");
     4430#else
     4431    xConfirmPara(m_acLayerCfg[layerId].m_auxId < 0 || m_acLayerCfg[layerId].m_auxId > 4, "AuxId must be in range 0 to 4");
     4432    xConfirmPara(m_acLayerCfg[layerId].m_auxId > 0 && m_acLayerCfg[layerId].m_chromaFormatIDC != CHROMA_400, "Auxiliary picture must be monochrome picture");
    36684433#endif
    36694434  }
     
    37164481Void TAppEncCfg::xSetGlobal()
    37174482{
     4483#if SVC_EXTENSION
     4484  // Check for layerId equal to 0, it has to pe extended to other layers.
     4485  UInt layerId = 0;
     4486  Bool m_useExtendedPrecision = m_acLayerCfg[layerId].m_useExtendedPrecision;
     4487  Int m_internalBitDepth[]    = {m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_LUMA], m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_CHROMA]};
     4488  Int m_MSBExtendedBitDepth[] = {m_acLayerCfg[layerId].m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA], m_acLayerCfg[layerId].m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA]};
     4489#endif
     4490
    37184491  // set max CU width & height
    37194492  g_uiMaxCUWidth  = m_uiMaxCUWidth;
    37204493  g_uiMaxCUHeight = m_uiMaxCUHeight;
    3721  
     4494
    37224495  // compute actual CU depth with respect to config depth and max transform size
    37234496  g_uiAddCUDepth  = 0;
    37244497  while( (m_uiMaxCUWidth>>m_uiMaxCUDepth) > ( 1 << ( m_uiQuadtreeTULog2MinSize + g_uiAddCUDepth )  ) ) g_uiAddCUDepth++;
    3725  
     4498
     4499  g_uiAddCUDepth+=getMaxCUDepthOffset(m_chromaFormatIDC, m_uiQuadtreeTULog2MinSize); // if minimum TU larger than 4x4, allow for additional part indices for 4:2:2 SubTUs.
     4500
    37264501  m_uiMaxCUDepth += g_uiAddCUDepth;
    37274502  g_uiAddCUDepth++;
    37284503  g_uiMaxCUDepth = m_uiMaxCUDepth;
    3729  
    3730 #if O0194_DIFFERENT_BITDEPTH_EL_BL
    3731   // set internal bit-depth to constant value to make sure to be updated later
    3732   g_bitDepthY = -1;
    3733   g_bitDepthC = -1;
    3734  
    3735   g_uiPCMBitDepthLuma = -1;
    3736   g_uiPCMBitDepthChroma = -1;
    3737 #else
    3738   g_bitDepthY = m_internalBitDepthY;
    3739   g_bitDepthC = m_internalBitDepthC;
    3740  
    3741   g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_inputBitDepthY : m_internalBitDepthY;
    3742   g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_inputBitDepthC : m_internalBitDepthC;
    3743 #endif
     4504
     4505  // set internal bit-depth and constants
     4506  for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
     4507  {
     4508#if O0043_BEST_EFFORT_DECODING
     4509    g_bitDepthInStream[channelType] = g_bitDepth[channelType] = m_internalBitDepth[channelType];
     4510#else
     4511    g_bitDepth   [channelType] = m_internalBitDepth[channelType];
     4512#endif
     4513    g_PCMBitDepth[channelType] = m_bPCMInputBitDepthFlag ? m_MSBExtendedBitDepth[channelType] : m_internalBitDepth[channelType];
     4514
     4515    if (m_useExtendedPrecision) g_maxTrDynamicRange[channelType] = std::max<Int>(15, (g_bitDepth[channelType] + 6));
     4516    else                        g_maxTrDynamicRange[channelType] = 15;
     4517  }
     4518
    37444519}
    37454520#endif
     4521
     4522const Char *profileToString(const Profile::Name profile)
     4523{
     4524  static const UInt numberOfProfiles = sizeof(strToProfile)/sizeof(*strToProfile);
     4525
     4526  for (UInt profileIndex = 0; profileIndex < numberOfProfiles; profileIndex++)
     4527  {
     4528    if (strToProfile[profileIndex].value == profile) return strToProfile[profileIndex].str;
     4529  }
     4530
     4531  //if we get here, we didn't find this profile in the list - so there is an error
     4532  std::cerr << "ERROR: Unknown profile \"" << profile << "\" in profileToString" << std::endl;
     4533  assert(false);
     4534  exit(1);
     4535  return "";
     4536}
    37464537
    37474538Void TAppEncCfg::xPrintParameter()
     
    37784569  printf("InterLayerWeightedPred        : %d\n", m_useInterLayerWeightedPred );
    37794570#endif
     4571#if O0215_PHASE_ALIGNMENT
     4572  printf("Cross-layer sample alignment : %d\n", m_phaseAlignFlag);
     4573#endif
    37804574  for(UInt layer=0; layer<m_numLayers; layer++)
    37814575  {
     
    37874581  printf("Bitstream      File          : %s\n", m_pBitstreamFile      );
    37884582#else //SVC_EXTENSION
    3789   printf("Input          File          : %s\n", m_pchInputFile          );
    3790   printf("Bitstream      File          : %s\n", m_pchBitstreamFile      );
    3791   printf("Reconstruction File          : %s\n", m_pchReconFile          );
    3792   printf("Real     Format              : %dx%d %dHz\n", m_iSourceWidth - m_confWinLeft - m_confWinRight, m_iSourceHeight - m_confWinTop - m_confWinBottom, m_iFrameRate );
    3793   printf("Internal Format              : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate );
     4583  printf("Input          File               : %s\n", m_pchInputFile          );
     4584  printf("Bitstream      File               : %s\n", m_pchBitstreamFile      );
     4585  printf("Reconstruction File               : %s\n", m_pchReconFile          );
     4586  printf("Real     Format                   : %dx%d %dHz\n", m_iSourceWidth - m_confWinLeft - m_confWinRight, m_iSourceHeight - m_confWinTop - m_confWinBottom, m_iFrameRate );
     4587  printf("Internal Format                   : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate );
    37944588#endif //SVC_EXTENSION
     4589
     4590  printf("Sequence PSNR output              : %s\n", (m_printMSEBasedSequencePSNR ? "Linear average, MSE-based" : "Linear average only") );
     4591  printf("Sequence MSE output               : %s\n", (m_printSequenceMSE ? "Enabled" : "Disabled") );
     4592  printf("Frame MSE output                  : %s\n", (m_printFrameMSE    ? "Enabled" : "Disabled") );
     4593  printf("Cabac-zero-word-padding           : %s\n", (m_cabacZeroWordPaddingEnabled? "Enabled" : "Disabled") );
    37954594  if (m_isField)
    37964595  {
    3797     printf("Frame/Field          : Field based coding\n");
    3798     printf("Field index          : %u - %d (%d fields)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
    3799     if (m_isTopFieldFirst)
    3800     {
    3801       printf("Field Order            : Top field first\n");
    3802     }
    3803     else
    3804     {
    3805       printf("Field Order            : Bottom field first\n");
    3806     }
     4596    printf("Frame/Field                       : Field based coding\n");
     4597    printf("Field index                       : %u - %d (%d fields)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
     4598    printf("Field Order                       : %s field first\n", m_isTopFieldFirst?"Top":"Bottom");
     4599
    38074600  }
    38084601  else
    38094602  {
    3810     printf("Frame/Field                  : Frame based coding\n");
    3811     printf("Frame index                  : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
     4603    printf("Frame/Field                       : Frame based coding\n");
     4604    printf("Frame index                       : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
     4605  }
     4606  if (m_profile == Profile::MAINREXT)
     4607  {
     4608    const UInt intraIdx = m_intraConstraintFlag ? 1:0;
     4609    const UInt bitDepthIdx = (m_bitDepthConstraint == 8 ? 0 : (m_bitDepthConstraint ==10 ? 1 : (m_bitDepthConstraint == 12 ? 2 : (m_bitDepthConstraint == 16 ? 3 : 4 ))));
     4610    const UInt chromaFormatIdx = UInt(m_chromaFormatConstraint);
     4611    const ExtendedProfileName validProfileName = (bitDepthIdx > 3 || chromaFormatIdx>3) ? NONE : validRExtProfileNames[intraIdx][bitDepthIdx][chromaFormatIdx];
     4612    std::string rextSubProfile;
     4613    if (validProfileName!=NONE) rextSubProfile=enumToString(strToExtendedProfile, sizeof(strToExtendedProfile)/sizeof(*strToExtendedProfile), validProfileName);
     4614    if (rextSubProfile == "main_444_16") rextSubProfile="main_444_16 [NON STANDARD]";
     4615    printf("Profile                           : %s (%s)\n", profileToString(m_profile), (rextSubProfile.empty())?"INVALID REXT PROFILE":rextSubProfile.c_str() );
     4616  }
     4617  else
     4618  {
     4619    printf("Profile                           : %s\n", profileToString(m_profile) );
    38124620  }
    38134621#if !LAYER_CTB
    3814   printf("CU size / depth              : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth );
    3815   printf("RQT trans. size (min / max)  : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize );
    3816   printf("Max RQT depth inter          : %d\n", m_uiQuadtreeTUMaxDepthInter);
    3817   printf("Max RQT depth intra          : %d\n", m_uiQuadtreeTUMaxDepthIntra);
    3818 #endif
    3819   printf("Min PCM size                 : %d\n", 1 << m_uiPCMLog2MinSize);
    3820   printf("Motion search range          : %d\n", m_iSearchRange );
     4622  printf("CU size / depth                   : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth );
     4623  printf("RQT trans. size (min / max)       : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize );
     4624  printf("Max RQT depth inter               : %d\n", m_uiQuadtreeTUMaxDepthInter);
     4625  printf("Max RQT depth intra               : %d\n", m_uiQuadtreeTUMaxDepthIntra);
     4626#endif
     4627  printf("Min PCM size                      : %d\n", 1 << m_uiPCMLog2MinSize);
     4628  printf("Motion search range               : %d\n", m_iSearchRange );
    38214629#if !SVC_EXTENSION
    3822   printf("Intra period                 : %d\n", m_iIntraPeriod );
    3823 #endif
    3824   printf("Decoding refresh type        : %d\n", m_iDecodingRefreshType );
     4630  printf("Intra period                      : %d\n", m_iIntraPeriod );
     4631#endif
     4632  printf("Decoding refresh type             : %d\n", m_iDecodingRefreshType );
    38254633#if !SVC_EXTENSION
    3826   printf("QP                           : %5.2f\n", m_fQP );
    3827 #endif
    3828   printf("Max dQP signaling depth      : %d\n", m_iMaxCuDQPDepth);
    3829 
    3830   printf("Cb QP Offset                 : %d\n", m_cbQpOffset   );
    3831   printf("Cr QP Offset                 : %d\n", m_crQpOffset);
    3832 
    3833   printf("QP adaptation                : %d (range=%d)\n", m_bUseAdaptiveQP, (m_bUseAdaptiveQP ? m_iQPAdaptationRange : 0) );
    3834   printf("GOP size                     : %d\n", m_iGOPSize );
     4634  printf("QP                                : %5.2f\n", m_fQP );
     4635#endif
     4636  printf("Max dQP signaling depth           : %d\n", m_iMaxCuDQPDepth);
     4637
     4638  printf("Cb QP Offset                      : %d\n", m_cbQpOffset   );
     4639  printf("Cr QP Offset                      : %d\n", m_crQpOffset);
     4640  printf("Max CU chroma QP adjustment depth : %d\n", m_maxCUChromaQpAdjustmentDepth);
     4641  printf("QP adaptation                     : %d (range=%d)\n", m_bUseAdaptiveQP, (m_bUseAdaptiveQP ? m_iQPAdaptationRange : 0) );
     4642  printf("GOP size                          : %d\n", m_iGOPSize );
    38354643#if !O0194_DIFFERENT_BITDEPTH_EL_BL
    3836   printf("Internal bit depth           : (Y:%d, C:%d)\n", m_internalBitDepthY, m_internalBitDepthC );
    3837   printf("PCM sample bit depth         : (Y:%d, C:%d)\n", g_uiPCMBitDepthLuma, g_uiPCMBitDepthChroma );
    3838 #endif
    3839 #if O0215_PHASE_ALIGNMENT
    3840   printf("Cross-layer sample alignment : %d\n", m_phaseAlignFlag);
    3841 #endif
     4644  printf("Input bit depth                   : (Y:%d, C:%d)\n", m_inputBitDepth[CHANNEL_TYPE_LUMA], m_inputBitDepth[CHANNEL_TYPE_CHROMA] );
     4645  printf("MSB-extended bit depth            : (Y:%d, C:%d)\n", m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA], m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] );
     4646  printf("Internal bit depth                : (Y:%d, C:%d)\n", m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA] );
     4647  printf("PCM sample bit depth              : (Y:%d, C:%d)\n", g_PCMBitDepth[CHANNEL_TYPE_LUMA],      g_PCMBitDepth[CHANNEL_TYPE_CHROMA] );
     4648  printf("Extended precision processing     : %s\n", (m_useExtendedPrecision                   ? "Enabled" : "Disabled") );
     4649#endif
     4650  printf("Intra reference smoothing         : %s\n", (m_enableIntraReferenceSmoothing          ? "Enabled" : "Disabled") );
     4651  printf("Implicit residual DPCM            : %s\n", (m_useResidualDPCM[RDPCM_SIGNAL_IMPLICIT] ? "Enabled" : "Disabled") );
     4652  printf("Explicit residual DPCM            : %s\n", (m_useResidualDPCM[RDPCM_SIGNAL_EXPLICIT] ? "Enabled" : "Disabled") );
     4653  printf("Residual rotation                 : %s\n", (m_useResidualRotation                    ? "Enabled" : "Disabled") );
     4654  printf("Single significance map context   : %s\n", (m_useSingleSignificanceMapContext        ? "Enabled" : "Disabled") );
     4655  printf("Cross-component prediction        : %s\n", (m_useCrossComponentPrediction            ? (m_reconBasedCrossCPredictionEstimate ? "Enabled (reconstructed-residual-based estimate)" : "Enabled (encoder-side-residual-based estimate)") : "Disabled") );
     4656#if !O0194_DIFFERENT_BITDEPTH_EL_BL
     4657  printf("High-precision prediction weight  : %s\n", (m_useHighPrecisionPredictionWeighting    ? "Enabled" : "Disabled") );
     4658#endif
     4659  printf("Golomb-Rice parameter adaptation  : %s\n", (m_useGolombRiceParameterAdaptation       ? "Enabled" : "Disabled") );
     4660  printf("CABAC bypass bit alignment        : %s\n", (m_alignCABACBeforeBypass                 ? "Enabled" : "Disabled") );
     4661  if (m_bUseSAO)
     4662  {
     4663    printf("Sao Luma Offset bit shifts        : %d\n", m_saoOffsetBitShift[CHANNEL_TYPE_LUMA]);
     4664    printf("Sao Chroma Offset bit shifts      : %d\n", m_saoOffsetBitShift[CHANNEL_TYPE_CHROMA]);
     4665  }
     4666
     4667  switch (m_costMode)
     4668  {
     4669    case COST_STANDARD_LOSSY:               printf("Cost function:                    : Lossy coding (default)\n"); break;
     4670    case COST_SEQUENCE_LEVEL_LOSSLESS:      printf("Cost function:                    : Sequence_level_lossless coding\n"); break;
     4671    case COST_LOSSLESS_CODING:              printf("Cost function:                    : Lossless coding with fixed QP of %d\n", LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP); break;
     4672    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;
     4673    default:                                printf("Cost function:                    : Unknown\n"); break;
     4674  }
     4675
    38424676#if !RC_SHVC_HARMONIZATION
    3843   printf("RateControl                  : %d\n", m_RCEnableRateControl );
     4677  printf("RateControl                       : %d\n", m_RCEnableRateControl );
     4678
    38444679  if(m_RCEnableRateControl)
    38454680  {
    3846     printf("TargetBitrate                : %d\n", m_RCTargetBitrate );
    3847     printf("KeepHierarchicalBit          : %d\n", m_RCKeepHierarchicalBit );
    3848     printf("LCULevelRC                   : %d\n", m_RCLCULevelRC );
    3849     printf("UseLCUSeparateModel          : %d\n", m_RCUseLCUSeparateModel );
    3850     printf("InitialQP                    : %d\n", m_RCInitialQP );
    3851     printf("ForceIntraQP                 : %d\n", m_RCForceIntraQP );
    3852   }
    3853 #endif
    3854 
    3855   printf("Max Num Merge Candidates     : %d\n", m_maxNumMergeCand);
     4681    printf("TargetBitrate                     : %d\n", m_RCTargetBitrate );
     4682    printf("KeepHierarchicalBit               : %d\n", m_RCKeepHierarchicalBit );
     4683    printf("LCULevelRC                        : %d\n", m_RCLCULevelRC );
     4684    printf("UseLCUSeparateModel               : %d\n", m_RCUseLCUSeparateModel );
     4685    printf("InitialQP                         : %d\n", m_RCInitialQP );
     4686    printf("ForceIntraQP                      : %d\n", m_RCForceIntraQP );
     4687  }
     4688#endif
     4689
     4690  printf("Max Num Merge Candidates          : %d\n", m_maxNumMergeCand);
    38564691  printf("\n");
    3857  
     4692
    38584693  printf("TOOL CFG: ");
    38594694#if !O0194_DIFFERENT_BITDEPTH_EL_BL
    3860   printf("IBD:%d ", g_bitDepthY > m_inputBitDepthY || g_bitDepthC > m_inputBitDepthC);
     4695  printf("IBD:%d ", ((g_bitDepth[CHANNEL_TYPE_LUMA] > m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA]) || (g_bitDepth[CHANNEL_TYPE_CHROMA] > m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA])));
    38614696#endif
    38624697  printf("HAD:%d ", m_bUseHADME           );
     
    38774712  printf("TransformSkip:%d ",     m_useTransformSkip              );
    38784713  printf("TransformSkipFast:%d ", m_useTransformSkipFast       );
     4714  printf("TransformSkipLog2MaxSize:%d ", m_transformSkipLog2MaxSize);
    38794715  printf("Slice: M=%d ", m_sliceMode);
    3880   if (m_sliceMode!=0)
     4716  if (m_sliceMode!=NO_SLICES)
    38814717  {
    38824718    printf("A=%d ", m_sliceArgument);
    38834719  }
    38844720  printf("SliceSegment: M=%d ",m_sliceSegmentMode);
    3885   if (m_sliceSegmentMode!=0)
     4721  if (m_sliceSegmentMode!=NO_SLICES)
    38864722  {
    38874723    printf("A=%d ", m_sliceSegmentArgument);
     
    38924728  printf("PCM:%d ", (m_usePCM && (1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0);
    38934729#endif
     4730
    38944731  if (m_TransquantBypassEnableFlag && m_CUTransquantBypassFlagForce)
    38954732  {
    3896     printf("TransQuantBypassEnabled: =1 ");
     4733    printf("TransQuantBypassEnabled: =1");
    38974734  }
    38984735  else
     
    39004737    printf("TransQuantBypassEnabled:%d ", (m_TransquantBypassEnableFlag)? 1:0 );
    39014738  }
     4739
    39024740  printf("WPP:%d ", (Int)m_useWeightedPred);
    39034741  printf("WPB:%d ", (Int)m_useWeightedBiPred);
     
    39364774
    39374775  printf("\n\n");
    3938  
     4776
    39394777  fflush(stdout);
    39404778}
     
    39444782  if (!bflag)
    39454783    return false;
    3946  
     4784
    39474785  printf("Error: %s\n",message);
    39484786  return true;
  • branches/SHM-upgrade/source/App/TAppEncoder/TAppEncCfg.h

    r912 r916  
    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.
    116122  ChromaFormat m_InputChromaFormatIDC;
    117 #endif
    118   Bool      m_isField;                                        ///< enable field coding
    119   Bool      m_isTopFieldFirst;
     123
     124  Bool      m_printMSEBasedSequencePSNR;
     125  Bool      m_printFrameMSE;
     126  Bool      m_printSequenceMSE;
     127  Bool      m_cabacZeroWordPaddingEnabled;
    120128
    121129  // profile/level
     
    123131  Level::Tier   m_levelTier;
    124132  Level::Name   m_level;
     133  UInt          m_bitDepthConstraint;
     134  ChromaFormat  m_chromaFormatConstraint;
     135  Bool          m_intraConstraintFlag;
     136  Bool          m_lowerBitRateConstraintFlag;
    125137  Bool m_progressiveSourceFlag;
    126138  Bool m_interlacedSourceFlag;
    127139  Bool m_nonPackedConstraintFlag;
    128140  Bool m_frameOnlyConstraintFlag;
    129  
     141
    130142  // coding structure
    131143#if !SVC_EXTENSION
     
    149161  Int       m_numReorderPics[MAX_TLAYER];                     ///< total number of reorder pictures
    150162  Int       m_maxDecPicBuffering[MAX_TLAYER];                 ///< total number of pictures in the decoded picture buffer
     163  Bool      m_useCrossComponentPrediction;                    ///< flag enabling the use of cross-component prediction
     164  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
     165  UInt      m_saoOffsetBitShift[MAX_NUM_CHANNEL_TYPE];        ///< number of bits for the upward bit shift operation on the decoded SAO offsets
    151166  Bool      m_useTransformSkip;                               ///< flag for enabling intra transform skipping
    152167  Bool      m_useTransformSkipFast;                           ///< flag for enabling fast intra transform skipping
     168  UInt      m_transformSkipLog2MaxSize;                       ///< transform-skip maximum size (minimum of 2)
     169  Bool      m_useResidualRotation;                            ///< control flag for transform-skip/transquant-bypass residual rotation
     170  Bool      m_useSingleSignificanceMapContext;                ///< control flag for transform-skip/transquant-bypass single significance map context
     171  Bool      m_useResidualDPCM[NUMBER_OF_RDPCM_SIGNALLING_MODES];///< control flags for residual DPCM
    153172  Bool      m_enableAMP;
     173  Bool      m_useGolombRiceParameterAdaptation;               ///< control flag for Golomb-Rice parameter adaptation over each slice
     174  Bool      m_alignCABACBeforeBypass;
     175
    154176  // coding quality
    155177#if !SVC_EXTENSION
     
    162184  UInt      m_uiDeltaQpRD;                                    ///< dQP range for multi-pass slice QP optimization
    163185  Int       m_iMaxCuDQPDepth;                                 ///< Max. depth for a minimum CuDQPSize (0:default)
    164 
    165   Int       m_cbQpOffset;                                     ///< Chroma Cb QP Offset (0:default)
     186  Int       m_maxCUChromaQpAdjustmentDepth;
     187
     188  Int       m_cbQpOffset;                                     ///< Chroma Cb QP Offset (0:default)
    166189  Int       m_crQpOffset;                                     ///< Chroma Cr QP Offset (0:default)
    167190
     
    169192  Bool      m_bUseAdaptQpSelect;
    170193#endif
     194  TComSEIMasteringDisplay m_masteringDisplay;
    171195
    172196  Bool      m_bUseAdaptiveQP;                                 ///< Flag for enabling QP adaptation based on a psycho-visual model
    173197  Int       m_iQPAdaptationRange;                             ///< dQP range by QP adaptation
    174  
     198
    175199  Int       m_maxTempLayer;                                  ///< Max temporal layer
    176200#if Q0108_TSA_STSA
     
    180204#if !LAYER_CTB
    181205  // coding unit (CU) definition
     206  // TODO: Remove MaxCUWidth/MaxCUHeight and replace with MaxCUSize.
    182207  UInt      m_uiMaxCUWidth;                                   ///< max. CU width in pixel
    183208  UInt      m_uiMaxCUHeight;                                  ///< max. CU height in pixel
    184209  UInt      m_uiMaxCUDepth;                                   ///< max. CU depth
    185  
     210
    186211  // transfom unit (TU) definition
    187212  UInt      m_uiQuadtreeTULog2MaxSize;
    188213  UInt      m_uiQuadtreeTULog2MinSize;
    189  
     214
    190215  UInt      m_uiQuadtreeTUMaxDepthInter;
    191216  UInt      m_uiQuadtreeTUMaxDepthIntra;
     
    194219  // coding tools (bit-depth)
    195220#if !O0194_DIFFERENT_BITDEPTH_EL_BL
    196   Int       m_inputBitDepthY;                               ///< bit-depth of input file (luma component)
    197   Int       m_inputBitDepthC;                               ///< bit-depth of input file (chroma component)
    198   Int       m_outputBitDepthY;                              ///< bit-depth of output file (luma component)
    199   Int       m_outputBitDepthC;                              ///< bit-depth of output file (chroma component)
    200   Int       m_internalBitDepthY;                            ///< bit-depth codec operates at in luma (input/output files will be converted)
    201   Int       m_internalBitDepthC;                            ///< bit-depth codec operates at in chroma (input/output files will be converted)
    202 #endif
    203 #if AUXILIARY_PICTURES
     221  Int       m_inputBitDepth   [MAX_NUM_CHANNEL_TYPE];         ///< bit-depth of input file
     222  Int       m_outputBitDepth  [MAX_NUM_CHANNEL_TYPE];         ///< bit-depth of output file
     223  Int       m_MSBExtendedBitDepth[MAX_NUM_CHANNEL_TYPE];      ///< bit-depth of input samples after MSB extension
     224  Int       m_internalBitDepth[MAX_NUM_CHANNEL_TYPE];         ///< bit-depth codec operates at (input/output files will be converted)
     225  Bool      m_useExtendedPrecision;
     226  Bool      m_useHighPrecisionPredictionWeighting;
     227#endif
     228  //coding tools (chroma format)
    204229  ChromaFormat m_chromaFormatIDC;
    205 #endif
    206230
    207231  // coding tools (PCM bit-depth)
     
    209233
    210234  // coding tool (SAO)
    211   Bool      m_bUseSAO; 
     235  Bool      m_bUseSAO;
    212236  Int       m_maxNumOffsetsPerPic;                            ///< SAO maximun number of offset per picture
    213   Bool      m_saoLcuBoundary;                                 ///< SAO parameter estimation using non-deblocked pixels for LCU bottom and right boundary areas
     237  Bool      m_saoCtuBoundary;                                 ///< SAO parameter estimation using non-deblocked pixels for CTU bottom and right boundary areas
    214238  // coding tools (loop filter)
    215239  Bool      m_bLoopFilterDisable;                             ///< flag for using deblocking filter
     
    219243  Bool      m_DeblockingFilterControlPresent;                 ///< deblocking filter control present flag in PPS
    220244  Bool      m_DeblockingFilterMetric;                         ///< blockiness metric in encoder
    221  
     245
    222246  // coding tools (PCM)
    223247  Bool      m_usePCM;                                         ///< flag for using IPCM
     
    225249  UInt      m_uiPCMLog2MinSize;                               ///< log2 of minimum PCM block size
    226250  Bool      m_bPCMFilterDisableFlag;                          ///< PCM filter disable flag
     251  Bool      m_enableIntraReferenceSmoothing;                  ///< flag for enabling(default)/disabling intra reference smoothing/filtering
    227252
    228253  // coding tools (encoder-only parameters)
     
    231256  Bool      m_useRDOQ;                                       ///< flag for using RD optimized quantization
    232257  Bool      m_useRDOQTS;                                     ///< flag for using RD optimized quantization for transform skip
    233   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) 
     258  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)
    234259  Int       m_iFastSearch;                                    ///< ME mode, 0 = full, 1 = diamond, 2 = PMVFAST
    235260  Int       m_iSearchRange;                                   ///< ME search range
     
    237262  Bool      m_bUseFastEnc;                                    ///< flag for using fast encoder setting
    238263  Bool      m_bUseEarlyCU;                                    ///< flag for using Early CU setting
    239   Bool      m_useFastDecisionForMerge;                        ///< flag for using Fast Decision Merge RD-Cost 
     264  Bool      m_useFastDecisionForMerge;                        ///< flag for using Fast Decision Merge RD-Cost
    240265  Bool      m_bUseCbfFastMode;                              ///< flag for using Cbf Fast PU Mode Decision
    241266  Bool      m_useEarlySkipDetection;                         ///< flag for using Early SKIP Detection
    242 #if FAST_INTRA_SHVC
    243   Bool      m_useFastIntraScalable;                          ///< flag for using Fast Intra Decision for Scalable HEVC
    244 #endif
    245   Int       m_sliceMode;                                     ///< 0: no slice limits, 1 : max number of CTBs per slice, 2: max number of bytes per slice,
     267  Int       m_sliceMode;                                     ///< 0: no slice limits, 1 : max number of CTBs per slice, 2: max number of bytes per slice,
    246268                                                             ///< 3: max number of tiles per slice
    247269  Int       m_sliceArgument;                                 ///< argument according to selected slice mode
    248   Int       m_sliceSegmentMode;                              ///< 0: no slice segment limits, 1 : max number of CTBs per slice segment, 2: max number of bytes per slice segment, 
     270  Int       m_sliceSegmentMode;                              ///< 0: no slice segment limits, 1 : max number of CTBs per slice segment, 2: max number of bytes per slice segment,
    249271                                                             ///< 3: max number of tiles per slice segment
    250272  Int       m_sliceSegmentArgument;                          ///< argument according to selected slice segment mode
     
    259281#if !SVC_EXTENSION
    260282  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.
     283  Int       m_iWaveFrontFlush; //< enable(1)/disable(0) the CABAC flush at the end of each line of LCUs.
    261284  Int       m_iWaveFrontSubstreams; //< If iWaveFrontSynchro, this is the number of substreams per frame (dependent tiles) or per tile (independent tiles).
    262285#endif
    263286  Bool      m_bUseConstrainedIntraPred;                       ///< flag for using constrained intra prediction
     287
    264288  Int       m_decodedPictureHashSEIEnabled;                    ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message
    265289  Int       m_recoveryPointSEIEnabled;
     
    267291  Int       m_pictureTimingSEIEnabled;
    268292  Bool      m_toneMappingInfoSEIEnabled;
     293  Bool      m_chromaSamplingFilterSEIenabled;
     294  Int       m_chromaSamplingHorFilterIdc;
     295  Int       m_chromaSamplingVerFilterIdc;
    269296  Int       m_toneMapId;
    270297  Bool      m_toneMapCancelFlag;
     
    272299  Int       m_toneMapCodedDataBitDepth;
    273300  Int       m_toneMapTargetBitDepth;
    274   Int       m_toneMapModelId; 
     301  Int       m_toneMapModelId;
    275302  Int       m_toneMapMinValue;
    276303  Int       m_toneMapMaxValue;
     
    298325  Int       m_framePackingSEIQuincunx;
    299326  Int       m_framePackingSEIInterpretation;
     327  Int       m_segmentedRectFramePackingSEIEnabled;
     328  Bool      m_segmentedRectFramePackingSEICancel;
     329  Int       m_segmentedRectFramePackingSEIType;
     330  Bool      m_segmentedRectFramePackingSEIPersistence;
    300331  Int       m_displayOrientationSEIAngle;
    301332  Int       m_temporalLevel0IndexSEIEnabled;
    302333  Int       m_gradualDecodingRefreshInfoEnabled;
     334  Int       m_noDisplaySEITLayer;
    303335  Int       m_decodingUnitInfoSEIEnabled;
    304 #if LAYERS_NOT_PRESENT_SEI
    305   Int       m_layersNotPresentSEIEnabled;
    306 #endif
    307336  Int       m_SOPDescriptionSEIEnabled;
    308337  Int       m_scalableNestingSEIEnabled;
    309 #if Q0189_TMVP_CONSTRAINTS
    310   Int       m_TMVPConstraintsSEIEnabled;
    311 #endif
     338  Bool      m_tmctsSEIEnabled;
     339  Bool      m_timeCodeSEIEnabled;
     340  Int       m_timeCodeSEINumTs;
     341  TComSEITimeSet m_timeSetArray[MAX_TIMECODE_SEI_SETS];
     342  Bool      m_kneeSEIEnabled;
     343  Int       m_kneeSEIId;
     344  Bool      m_kneeSEICancelFlag;
     345  Bool      m_kneeSEIPersistenceFlag;
     346  Int       m_kneeSEIInputDrange;
     347  Int       m_kneeSEIInputDispLuminance;
     348  Int       m_kneeSEIOutputDrange;
     349  Int       m_kneeSEIOutputDispLuminance;
     350  Int       m_kneeSEINumKneePointsMinus1;
     351  Int*      m_kneeSEIInputKneePoint;
     352  Int*      m_kneeSEIOutputKneePoint;
    312353  // weighted prediction
    313354  Bool      m_useWeightedPred;                    ///< Use of weighted prediction in P slices
    314355  Bool      m_useWeightedBiPred;                  ///< Use of bi-directional weighted prediction in B slices
    315  
     356
    316357  UInt      m_log2ParallelMergeLevel;                         ///< Parallel merge estimation region
    317358  UInt      m_maxNumMergeCand;                                ///< Max number of merge candidates
     
    323364  Int       m_RCTargetBitrate;                    ///< target bitrate when rate control is enabled
    324365  Int       m_RCKeepHierarchicalBit;              ///< 0: equal bit allocation; 1: fixed ratio bit allocation; 2: adaptive ratio bit allocation
    325   Bool      m_RCLCULevelRC;                       ///< true: LCU level rate control; false: picture level rate control
    326   Bool      m_RCUseLCUSeparateModel;              ///< use separate R-lambda model at LCU level
     366  Bool      m_RCLCULevelRC;                       ///< true: LCU level rate control; false: picture level rate control NOTE: code-tidy - rename to m_RCCtuLevelRC
     367  Bool      m_RCUseLCUSeparateModel;              ///< use separate R-lambda model at LCU level                        NOTE: code-tidy - rename to m_RCUseCtuSeparateModel
    327368  Int       m_RCInitialQP;                        ///< inital QP for rate control
    328369  Bool      m_RCForceIntraQP;                     ///< force all intra picture to use initial QP or not
    329370#endif
    330   Int       m_useScalingListId;                               ///< using quantization matrix
     371  ScalingListMode m_useScalingListId;                         ///< using quantization matrix
    331372  Char*     m_scalingListFile;                                ///< quantization matrix file name
    332373
    333374  Bool      m_TransquantBypassEnableFlag;                     ///< transquant_bypass_enable_flag setting in PPS.
    334375  Bool      m_CUTransquantBypassFlagForce;                    ///< if transquant_bypass_enable_flag, then, if true, all CU transquant bypass flags will be set to true.
     376  CostMode  m_costMode;                                       ///< Cost mode to use
    335377
    336378  Bool      m_recalculateQPAccordingToLambda;                 ///< recalculate QP value according to the lambda value
     
    372414  Int       m_log2MaxMvLengthHorizontal;                      ///< Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units
    373415  Int       m_log2MaxMvLengthVertical;                        ///< Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units
     416
     417#if LAYERS_NOT_PRESENT_SEI
     418  Int       m_layersNotPresentSEIEnabled;
     419#endif
     420
     421#if SVC_EXTENSION
     422#if FAST_INTRA_SHVC
     423  Bool      m_useFastIntraScalable;                          ///< flag for using Fast Intra Decision for Scalable HEVC
     424#endif
     425#if Q0189_TMVP_CONSTRAINTS
     426  Int       m_TMVPConstraintsSEIEnabled;
     427#endif
    374428#if O0153_ALT_OUTPUT_LAYER_FLAG
    375429  Bool      m_altOutputLayerFlag;                             ///< Specifies the value of alt_output_laye_flag in VPS extension
    376430#endif
    377 
    378 #if SVC_EXTENSION
    379431  Int       m_elRapSliceBEnabled;
    380432#endif
    381433#if Q0074_COLOUR_REMAPPING_SEI
    382434#if !SVC_EXTENSION
    383   string    m_colourRemapSEIFile;
     435  Char*     m_colourRemapSEIFile;
    384436  Int       m_colourRemapSEIId;
    385437  Bool      m_colourRemapSEICancelFlag;
     
    409461  Void  xSetGlobal      ();                                   ///< set global variables
    410462#endif
     463#if SVC_EXTENSION
     464  Void  xCheckParameter (UInt layerId);                       ///< check validity of configuration values per layer
     465#else
    411466  Void  xCheckParameter ();                                   ///< check validity of configuration values
     467#endif
    412468  Void  xPrintParameter ();                                   ///< print configuration values
    413469  Void  xPrintUsage     ();                                   ///< print usage
     
    437493#endif
    438494  Bool      m_crossLayerIrapAlignFlag;
    439 #if P0050_KNEE_FUNCTION_SEI
    440   Bool      m_kneeSEIEnabled;
    441   Int       m_kneeSEIId;
    442   Bool      m_kneeSEICancelFlag;
    443   Bool      m_kneeSEIPersistenceFlag;
    444   Bool      m_kneeSEIMappingFlag;
    445   Int       m_kneeSEIInputDrange;
    446   Int       m_kneeSEIInputDispLuminance;
    447   Int       m_kneeSEIOutputDrange;
    448   Int       m_kneeSEIOutputDispLuminance;
    449   Int       m_kneeSEINumKneePointsMinus1;
    450   Int*      m_kneeSEIInputKneePoint;
    451   Int*      m_kneeSEIOutputKneePoint;
    452 #endif
    453495#if Q0096_OVERLAY_SEI
    454496  Bool                                m_overlaySEIEnabled;
     
    499541  TAppEncCfg();
    500542  virtual ~TAppEncCfg();
    501  
     543
    502544public:
    503545  Void  create    ();                                         ///< create option handling class
     
    510552  Int  getGOPSize()                {return m_iGOPSize;          }
    511553#if O0194_DIFFERENT_BITDEPTH_EL_BL
    512   UInt getInternalBitDepthY(Int iLayer)      {return m_acLayerCfg[iLayer].m_internalBitDepthY; }
    513   UInt getInternalBitDepthC(Int iLayer)      {return m_acLayerCfg[iLayer].m_internalBitDepthC; }
     554  UInt getInternalBitDepth(Int iLayer, ChannelType type)      {return m_acLayerCfg[iLayer].m_internalBitDepth[type]; }
    514555  Bool getPCMInputBitDepthFlag()             {return m_bPCMInputBitDepthFlag;                  }
    515556#else
    516   UInt getInternalBitDepthY()      {return m_internalBitDepthY; }
    517   UInt getInternalBitDepthC()      {return m_internalBitDepthC; }
     557  UInt getInternalBitDepth( ChannelType type )      {return m_internalBitDepth[type]; } 
    518558#endif
    519559#if !LAYER_CTB
  • branches/SHM-upgrade/source/App/TAppEncoder/TAppEncLayerCfg.cpp

    r875 r916  
    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
     
    309309  printf("Internal Format               : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate );
    310310#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
     311  printf("Input bit depth               : (Y:%d, C:%d)\n", m_inputBitDepth[CHANNEL_TYPE_LUMA], m_inputBitDepth[CHANNEL_TYPE_CHROMA] );
     312  printf("Internal bit depth            : (Y:%d, C:%d)\n", m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA] );
     313  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] );
     314#endif
     315  std::cout << std::setw(43) << "Input ChromaFormatIDC = ";
     316  switch (m_InputChromaFormatIDC)
     317  {
     318  case CHROMA_400:  std::cout << "  4:0:0"; break;
     319  case CHROMA_420:  std::cout << "  4:2:0"; break;
     320  case CHROMA_422:  std::cout << "  4:2:2"; break;
     321  case CHROMA_444:  std::cout << "  4:4:4"; break;
     322  default:
     323    std::cerr << "Invalid";
     324    exit(1);
     325  }
     326  std::cout << std::endl;
     327
     328  std::cout << std::setw(43) << "Output (internal) ChromaFormatIDC = ";
     329  switch (m_chromaFormatIDC)
     330  {
     331  case CHROMA_400:  std::cout << "  4:0:0"; break;
     332  case CHROMA_420:  std::cout << "  4:2:0"; break;
     333  case CHROMA_422:  std::cout << "  4:2:2"; break;
     334  case CHROMA_444:  std::cout << "  4:4:4"; break;
     335  default:
     336    std::cerr << "Invalid";
     337    exit(1);
     338  }
     339  std::cout << "\n" << std::endl;
    315340#if LAYER_CTB
    316341  printf("CU size / depth               : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth );
     
    456481
    457482#if O0194_DIFFERENT_BITDEPTH_EL_BL
    458   for(UInt layer = 0; layer < MAX_LAYERS; layer++)
    459   {
    460     xConfirmPara( m_iQP <  -6 * ((Int)m_cAppEncCfg->getInternalBitDepthY(layer) - 8) || m_iQP > 51,                "QP exceeds supported range (-QpBDOffsety to 51)" );
    461   }
     483  xConfirmPara( m_iQP <  -6 * (m_internalBitDepth[CHANNEL_TYPE_LUMA] - 8) || m_iQP > 51,                "QP exceeds supported range (-QpBDOffsety to 51)" );
    462484#else
    463485  xConfirmPara( m_iQP <  -6 * ((Int)m_cAppEncCfg->getInternalBitDepthY() - 8) || m_iQP > 51,                "QP exceeds supported range (-QpBDOffsety to 51)" );
  • branches/SHM-upgrade/source/App/TAppEncoder/TAppEncLayerCfg.h

    r875 r916  
    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;
    4449#if AUXILIARY_PICTURES
    45   ChromaFormat m_chromaFormatIDC;
    46   ChromaFormat m_InputChromaFormat;
    47   Int          m_auxId;
     50  Int       m_auxId;
    4851#endif
    4952#if VPS_EXTN_DIRECT_REF_LAYERS
     
    8891  Int*      m_aidQP;                                          ///< array of slice QP values
    8992  TAppEncCfg* m_cAppEncCfg;                                   ///< pointer to app encoder config
    90   Int       m_numScaledRefLayerOffsets  ;
     93  Int       m_numScaledRefLayerOffsets;
    9194#if O0098_SCALED_REF_LAYER_ID
    9295  Int       m_scaledRefLayerId          [MAX_LAYERS];
     
    115118#endif
    116119
    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
     120  Int       m_inputBitDepth   [MAX_NUM_CHANNEL_TYPE];         ///< bit-depth of input file
     121  Int       m_outputBitDepth  [MAX_NUM_CHANNEL_TYPE];         ///< bit-depth of output file
     122  Int       m_MSBExtendedBitDepth[MAX_NUM_CHANNEL_TYPE];      ///< bit-depth of input samples after MSB extension
     123  Int       m_internalBitDepth[MAX_NUM_CHANNEL_TYPE];         ///< bit-depth codec operates at (input/output files will be converted)
     124  UInt      m_saoOffsetBitShift[MAX_NUM_CHANNEL_TYPE];
     125  Bool      m_useExtendedPrecision;
     126  Bool      m_useHighPrecisionPredictionWeighting;
     127
    125128#if REPN_FORMAT_IN_VPS
    126129  Int       m_repFormatIdx;
     
    177180  Int     getConfWinBottom()          {return m_confWinBottom;       }
    178181#if AUXILIARY_PICTURES
    179   ChromaFormat getInputChromaFormat()   {return m_InputChromaFormat;}
     182  ChromaFormat getInputChromaFormat()   {return m_InputChromaFormatIDC;}
    180183  ChromaFormat getChromaFormatIDC()     {return m_chromaFormatIDC;  }
    181184  Int          getAuxId()               {return m_auxId;            }
  • branches/SHM-upgrade/source/App/TAppEncoder/TAppEncTop.cpp

    r912 r916  
    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  }
     
    206208#if O0194_DIFFERENT_BITDEPTH_EL_BL
    207209    //1
    208     g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
    209     g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
    210 
    211     g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
    212     g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     210    g_bitDepth[CHANNEL_TYPE_LUMA]   = m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA];
     211    g_bitDepth[CHANNEL_TYPE_CHROMA] = m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
     212
     213    g_PCMBitDepth[CHANNEL_TYPE_LUMA]   = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepth[CHANNEL_TYPE_LUMA]   : m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA];
     214    g_PCMBitDepth[CHANNEL_TYPE_CHROMA] = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepth[CHANNEL_TYPE_CHROMA] : m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
    213215
    214216    // Set this to be used in Upsampling filter in function "TComUpsampleFilter::upsampleBasePic"
    215     g_bitDepthYLayer[layer] = g_bitDepthY;
    216     g_bitDepthCLayer[layer] = g_bitDepthC;
     217    g_bitDepthLayer[CHANNEL_TYPE_LUMA][layer]   = g_bitDepth[CHANNEL_TYPE_LUMA];
     218    g_bitDepthLayer[CHANNEL_TYPE_CHROMA][layer] = g_bitDepth[CHANNEL_TYPE_CHROMA];
    217219
    218220#if O0194_WEIGHTED_PREDICTION_CGS
    219     m_acTEncTop[layer].setInterLayerWeightedPredFlag( m_useInterLayerWeightedPred );
     221    m_acTEncTop[layer].setInterLayerWeightedPredFlag                      ( m_useInterLayerWeightedPred );
    220222#endif
    221223#endif
    222224    //m_acTEncTop[layer].setVPS(&vps);
    223     m_acTEncTop[layer].setFrameRate                    ( m_acLayerCfg[layer].getFrameRate() );
    224     m_acTEncTop[layer].setFrameSkip                    ( m_FrameSkip );
    225     m_acTEncTop[layer].setSourceWidth                  ( m_acLayerCfg[layer].getSourceWidth() );
    226     m_acTEncTop[layer].setSourceHeight                 ( m_acLayerCfg[layer].getSourceHeight() );
    227     m_acTEncTop[layer].setConformanceWindow            ( m_acLayerCfg[layer].m_confWinLeft, m_acLayerCfg[layer].m_confWinRight, m_acLayerCfg[layer].m_confWinTop, m_acLayerCfg[layer].m_confWinBottom );
    228     m_acTEncTop[layer].setFramesToBeEncoded            ( m_framesToBeEncoded );
    229 
    230     m_acTEncTop[layer].setProfile(m_profile);
    231     m_acTEncTop[layer].setLevel(m_levelTier, m_level);
    232     m_acTEncTop[layer].setProgressiveSourceFlag(m_progressiveSourceFlag);
    233     m_acTEncTop[layer].setInterlacedSourceFlag(m_interlacedSourceFlag);
    234     m_acTEncTop[layer].setNonPackedConstraintFlag(m_nonPackedConstraintFlag);
    235     m_acTEncTop[layer].setFrameOnlyConstraintFlag(m_frameOnlyConstraintFlag);
     225    m_acTEncTop[layer].setProfile                                         ( m_profile );
     226    m_acTEncTop[layer].setLevel                                           ( m_levelTier, m_level );
     227    m_acTEncTop[layer].setProgressiveSourceFlag                           ( m_progressiveSourceFlag );
     228    m_acTEncTop[layer].setInterlacedSourceFlag                            ( m_interlacedSourceFlag );
     229    m_acTEncTop[layer].setNonPackedConstraintFlag                         ( m_nonPackedConstraintFlag );
     230    m_acTEncTop[layer].setFrameOnlyConstraintFlag                         ( m_frameOnlyConstraintFlag );
     231    m_acTEncTop[layer].setBitDepthConstraintValue                         ( m_bitDepthConstraint );
     232    m_acTEncTop[layer].setChromaFormatConstraintValue                     ( m_acLayerCfg[layer].m_chromaFormatConstraint );
     233    m_acTEncTop[layer].setIntraConstraintFlag                             ( m_intraConstraintFlag );
     234    m_acTEncTop[layer].setLowerBitRateConstraintFlag                      ( m_lowerBitRateConstraintFlag );
     235
     236    m_acTEncTop[layer].setPrintMSEBasedSequencePSNR                       ( m_printMSEBasedSequencePSNR);
     237    m_acTEncTop[layer].setPrintFrameMSE                                   ( m_printFrameMSE);
     238    m_acTEncTop[layer].setPrintSequenceMSE                                ( m_printSequenceMSE);
     239    m_acTEncTop[layer].setCabacZeroWordPaddingEnabled                     ( m_cabacZeroWordPaddingEnabled );
     240
     241    m_acTEncTop[layer].setFrameRate                                       ( m_acLayerCfg[layer].getFrameRate() );
     242    m_acTEncTop[layer].setFrameSkip                                       ( m_FrameSkip );
     243    m_acTEncTop[layer].setSourceWidth                                     ( m_acLayerCfg[layer].getSourceWidth() );
     244    m_acTEncTop[layer].setSourceHeight                                    ( m_acLayerCfg[layer].getSourceHeight() );
     245    m_acTEncTop[layer].setConformanceWindow                               ( m_acLayerCfg[layer].m_confWinLeft, m_acLayerCfg[layer].m_confWinRight, m_acLayerCfg[layer].m_confWinTop, m_acLayerCfg[layer].m_confWinBottom );
     246    m_acTEncTop[layer].setFramesToBeEncoded                               ( m_framesToBeEncoded );
    236247
    237248#if REF_IDX_MFM
    238249#if AVC_BASE
    239250#if VPS_AVC_BL_FLAG_REMOVAL
    240     m_acTEncTop[layer].setMFMEnabledFlag(layer == 0 ? false : ( m_nonHEVCBaseLayerFlag ? false : true ) && m_acLayerCfg[layer].getNumMotionPredRefLayers());
    241 #else
    242     m_acTEncTop[layer].setMFMEnabledFlag(layer == 0 ? false : ( m_avcBaseLayerFlag ? false : true ) && m_acLayerCfg[layer].getNumMotionPredRefLayers());
    243 #endif
    244 #else
    245     m_acTEncTop[layer].setMFMEnabledFlag(layer == 0 ? false : ( m_acLayerCfg[layer].getNumMotionPredRefLayers() > 0 ) );
     251    m_acTEncTop[layer].setMFMEnabledFlag                                  (layer == 0 ? false : ( m_nonHEVCBaseLayerFlag ? false : true ) && m_acLayerCfg[layer].getNumMotionPredRefLayers());
     252#else
     253    m_acTEncTop[layer].setMFMEnabledFlag                                  (layer == 0 ? false : ( m_avcBaseLayerFlag ? false : true ) && m_acLayerCfg[layer].getNumMotionPredRefLayers());
     254#endif
     255#else
     256    m_acTEncTop[layer].setMFMEnabledFlag                                  (layer == 0 ? false : ( m_acLayerCfg[layer].getNumMotionPredRefLayers() > 0 ) );
    246257#endif
    247258#endif
     
    252263
    253264    //====== Coding Structure ========
    254     m_acTEncTop[layer].setIntraPeriod                  ( m_acLayerCfg[layer].m_iIntraPeriod );
    255     m_acTEncTop[layer].setDecodingRefreshType          ( m_iDecodingRefreshType );
    256     m_acTEncTop[layer].setGOPSize                      ( m_iGOPSize );
     265    m_acTEncTop[layer].setIntraPeriod                                     ( m_acLayerCfg[layer].m_iIntraPeriod );
     266    m_acTEncTop[layer].setDecodingRefreshType                             ( m_iDecodingRefreshType );
     267    m_acTEncTop[layer].setGOPSize                                         ( m_iGOPSize );
    257268#if Q0108_TSA_STSA
    258     m_acTEncTop[layer].setGopList                      ( layer ? m_EhGOPList[layer] : m_GOPList );
    259 #else
    260     m_acTEncTop[layer].setGopList                      ( m_GOPList );
     269    m_acTEncTop[layer].setGopList                                         ( layer ? m_EhGOPList[layer] : m_GOPList );
     270#else
     271    m_acTEncTop[layer].setGopList                                         ( m_GOPList );
    261272#endif
    262273
    263274#if !Q0108_TSA_STSA
    264     m_acTEncTop[layer].setExtraRPSs                    ( m_extraRPSs );
    265 #else
    266     m_acTEncTop[layer].setExtraRPSs                    ( m_extraRPSs[layer] );
     275    m_acTEncTop[layer].setExtraRPSs                                       ( m_extraRPSs );
     276#else
     277    m_acTEncTop[layer].setExtraRPSs                                       ( m_extraRPSs[layer] );
    267278#endif
    268279    for(Int i = 0; i < MAX_TLAYER; i++)
    269280    {
    270       m_acTEncTop[layer].setNumReorderPics             ( m_numReorderPics[i], i );
    271       m_acTEncTop[layer].setMaxDecPicBuffering         ( m_maxDecPicBuffering[i], i );
     281      m_acTEncTop[layer].setNumReorderPics                                ( m_numReorderPics[i], i );
     282      m_acTEncTop[layer].setMaxDecPicBuffering                            ( m_maxDecPicBuffering[i], i );
    272283    }
    273284    for( UInt uiLoop = 0; uiLoop < MAX_TLAYER; ++uiLoop )
    274285    {
    275       m_acTEncTop[layer].setLambdaModifier( uiLoop, m_adLambdaModifier[ uiLoop ] );
    276     }
    277     m_acTEncTop[layer].setQP                           ( m_acLayerCfg[layer].getIntQP() );
    278 
    279     m_acTEncTop[layer].setPad                          ( m_acLayerCfg[layer].getPad() );
     286      m_acTEncTop[layer].setLambdaModifier                                ( uiLoop, m_adLambdaModifier[ uiLoop ] );
     287    }
     288    m_acTEncTop[layer].setQP                                              ( m_acLayerCfg[layer].getIntQP() );
     289
     290    m_acTEncTop[layer].setPad                                             ( m_acLayerCfg[layer].getPad() );
    280291#if !Q0108_TSA_STSA
    281     m_acTEncTop[layer].setMaxTempLayer                 ( m_maxTempLayer );
     292    m_acTEncTop[layer].setMaxTempLayer                                    ( m_maxTempLayer );
    282293#else
    283294    if (layer== 0)
    284295    {
    285       m_acTEncTop[layer].setMaxTempLayer                 ( m_maxTempLayer );
     296      m_acTEncTop[layer].setMaxTempLayer                                  ( m_maxTempLayer );
    286297    }
    287298    else
    288299    {
    289       m_acTEncTop[layer].setMaxTempLayer                 ( m_EhMaxTempLayer[layer] );
     300      m_acTEncTop[layer].setMaxTempLayer                                  ( m_EhMaxTempLayer[layer] );
    290301    }
    291302#endif
     
    294305    if( layer < m_numLayers - 1 )
    295306    {
    296        m_acTEncTop[layer].setMaxTidIlRefPicsPlus1 ( m_acLayerCfg[layer].getMaxTidIlRefPicsPlus1());
     307       m_acTEncTop[layer].setMaxTidIlRefPicsPlus1                         ( m_acLayerCfg[layer].getMaxTidIlRefPicsPlus1());
    297308    }
    298309
     
    302313      for(Int i = 0; i < MAX_VPS_LAYER_ID_PLUS1; i++)
    303314      {
    304         m_acTEncTop[layer].setSamplePredEnabledFlag(i, false);
    305         m_acTEncTop[layer].setMotionPredEnabledFlag(i, false);
     315        m_acTEncTop[layer].setSamplePredEnabledFlag                       (i, false);
     316        m_acTEncTop[layer].setMotionPredEnabledFlag                       (i, false);
    306317      }
    307318      if(m_acLayerCfg[layer].getNumSamplePredRefLayers() == -1)
    308319      {
    309320        // Not included in the configuration file; assume that each layer depends on previous layer
    310         m_acTEncTop[layer].setNumSamplePredRefLayers   (1);      // One sample pred ref. layer
    311         m_acTEncTop[layer].setSamplePredRefLayerId     (0, layer - 1);   // Previous layer
    312         m_acTEncTop[layer].setSamplePredEnabledFlag    (layer - 1, true);
     321        m_acTEncTop[layer].setNumSamplePredRefLayers                      (1);      // One sample pred ref. layer
     322        m_acTEncTop[layer].setSamplePredRefLayerId                        (0, layer - 1);   // Previous layer
     323        m_acTEncTop[layer].setSamplePredEnabledFlag                       (layer - 1, true);
    313324      }
    314325      else
    315326      {
    316         m_acTEncTop[layer].setNumSamplePredRefLayers   ( m_acLayerCfg[layer].getNumSamplePredRefLayers() );
     327        m_acTEncTop[layer].setNumSamplePredRefLayers                      ( m_acLayerCfg[layer].getNumSamplePredRefLayers() );
    317328        for(Int i = 0; i < m_acTEncTop[layer].getNumSamplePredRefLayers(); i++)
    318329        {
    319           m_acTEncTop[layer].setSamplePredRefLayerId   ( i, m_acLayerCfg[layer].getSamplePredRefLayerId(i));
    320           m_acTEncTop[layer].setSamplePredEnabledFlag  (m_acLayerCfg[layer].getSamplePredRefLayerId(i), true);
     330          m_acTEncTop[layer].setSamplePredRefLayerId                      ( i, m_acLayerCfg[layer].getSamplePredRefLayerId(i));
     331          m_acTEncTop[layer].setSamplePredEnabledFlag                     (m_acLayerCfg[layer].getSamplePredRefLayerId(i), true);
    321332        }
    322333      }
     
    324335      {
    325336        // Not included in the configuration file; assume that each layer depends on previous layer
    326         m_acTEncTop[layer].setNumMotionPredRefLayers   (1);      // One motion pred ref. layer
    327         m_acTEncTop[layer].setMotionPredRefLayerId     (0, layer - 1);   // Previous layer
    328         m_acTEncTop[layer].setMotionPredEnabledFlag    (layer - 1, true);
     337        m_acTEncTop[layer].setNumMotionPredRefLayers                      (1);      // One motion pred ref. layer
     338        m_acTEncTop[layer].setMotionPredRefLayerId                        (0, layer - 1);   // Previous layer
     339        m_acTEncTop[layer].setMotionPredEnabledFlag                       (layer - 1, true);
    329340      }
    330341      else
    331342      {
    332         m_acTEncTop[layer].setNumMotionPredRefLayers   ( m_acLayerCfg[layer].getNumMotionPredRefLayers() );
     343        m_acTEncTop[layer].setNumMotionPredRefLayers                      ( m_acLayerCfg[layer].getNumMotionPredRefLayers() );
    333344        for(Int i = 0; i < m_acTEncTop[layer].getNumMotionPredRefLayers(); i++)
    334345        {
    335           m_acTEncTop[layer].setMotionPredRefLayerId   ( i, m_acLayerCfg[layer].getMotionPredRefLayerId(i));
    336           m_acTEncTop[layer].setMotionPredEnabledFlag  (m_acLayerCfg[layer].getMotionPredRefLayerId(i), true);
     346          m_acTEncTop[layer].setMotionPredRefLayerId                      ( i, m_acLayerCfg[layer].getMotionPredRefLayerId(i));
     347          m_acTEncTop[layer].setMotionPredEnabledFlag                     (m_acLayerCfg[layer].getMotionPredRefLayerId(i), true);
    337348        }
    338349      }
     
    345356        if (m_acTEncTop[layer].getSamplePredEnabledFlag(i) || m_acTEncTop[layer].getMotionPredEnabledFlag(i))
    346357        {
    347           m_acTEncTop[layer].setRefLayerId(numDirectRefLayers, i);
     358          m_acTEncTop[layer].setRefLayerId                                (numDirectRefLayers, i);
    348359          numDirectRefLayers++;
    349360        }
    350361      }
    351       m_acTEncTop[layer].setNumDirectRefLayers(numDirectRefLayers);
     362      m_acTEncTop[layer].setNumDirectRefLayers                            (numDirectRefLayers);
    352363
    353364      if(m_acLayerCfg[layer].getNumActiveRefLayers() == -1)
    354365      {
    355         m_acTEncTop[layer].setNumActiveRefLayers( m_acTEncTop[layer].getNumDirectRefLayers() );
     366        m_acTEncTop[layer].setNumActiveRefLayers                          ( m_acTEncTop[layer].getNumDirectRefLayers() );
    356367        for( Int i = 0; i < m_acTEncTop[layer].getNumActiveRefLayers(); i++ )
    357368        {
     
    361372      else
    362373      {
    363         m_acTEncTop[layer].setNumActiveRefLayers       ( m_acLayerCfg[layer].getNumActiveRefLayers() );
     374        m_acTEncTop[layer].setNumActiveRefLayers                          ( m_acLayerCfg[layer].getNumActiveRefLayers() );
    364375        for(Int i = 0; i < m_acTEncTop[layer].getNumActiveRefLayers(); i++)
    365376        {
    366           m_acTEncTop[layer].setPredLayerId             ( i, m_acLayerCfg[layer].getPredLayerId(i));
     377          m_acTEncTop[layer].setPredLayerId                               ( i, m_acLayerCfg[layer].getPredLayerId(i));
    367378        }
    368379      }
     
    378389        Int rlSubHeightC = 2;
    379390#endif
    380         m_acTEncTop[layer].setRefRegionOffsetPresentFlag( i, m_acLayerCfg[layer].m_refRegionOffsetPresentFlag );
    381         m_acTEncTop[layer].getRefLayerWindow(i).setWindow( rlSubWidthC  * m_acLayerCfg[layer].m_refRegionLeftOffset[i], rlSubWidthC  * m_acLayerCfg[layer].m_refRegionRightOffset[i],
    382                                                            rlSubHeightC * m_acLayerCfg[layer].m_refRegionTopOffset[i],  rlSubHeightC * m_acLayerCfg[layer].m_refRegionBottomOffset[i]);
     391        m_acTEncTop[layer].setRefRegionOffsetPresentFlag                  ( i, m_acLayerCfg[layer].m_refRegionOffsetPresentFlag );
     392        m_acTEncTop[layer].getRefLayerWindow(i).setWindow                 ( rlSubWidthC  * m_acLayerCfg[layer].m_refRegionLeftOffset[i], rlSubWidthC  * m_acLayerCfg[layer].m_refRegionRightOffset[i],
     393                                                                            rlSubHeightC * m_acLayerCfg[layer].m_refRegionTopOffset[i],  rlSubHeightC * m_acLayerCfg[layer].m_refRegionBottomOffset[i]);
    383394      }
    384395#endif
     
    393404
    394405    //====== Loop/Deblock Filter ========
    395     m_acTEncTop[layer].setLoopFilterDisable            ( m_bLoopFilterDisable       );
    396     m_acTEncTop[layer].setLoopFilterOffsetInPPS        ( m_loopFilterOffsetInPPS );
    397     m_acTEncTop[layer].setLoopFilterBetaOffset         ( m_loopFilterBetaOffsetDiv2  );
    398     m_acTEncTop[layer].setLoopFilterTcOffset           ( m_loopFilterTcOffsetDiv2    );
    399     m_acTEncTop[layer].setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent);
    400     m_acTEncTop[layer].setDeblockingFilterMetric       ( m_DeblockingFilterMetric );
     406    m_acTEncTop[layer].setLoopFilterDisable                                ( m_bLoopFilterDisable       );
     407    m_acTEncTop[layer].setLoopFilterOffsetInPPS                            ( m_loopFilterOffsetInPPS );
     408    m_acTEncTop[layer].setLoopFilterBetaOffset                             ( m_loopFilterBetaOffsetDiv2  );
     409    m_acTEncTop[layer].setLoopFilterTcOffset                               ( m_loopFilterTcOffsetDiv2    );
     410    m_acTEncTop[layer].setDeblockingFilterControlPresent                   ( m_DeblockingFilterControlPresent);
     411    m_acTEncTop[layer].setDeblockingFilterMetric                           ( m_DeblockingFilterMetric );
    401412
    402413    //====== Motion search ========
    403     m_acTEncTop[layer].setFastSearch                   ( m_iFastSearch  );
    404     m_acTEncTop[layer].setSearchRange                  ( m_iSearchRange );
    405     m_acTEncTop[layer].setBipredSearchRange            ( m_bipredSearchRange );
     414    m_acTEncTop[layer].setFastSearch                                       ( m_iFastSearch  );
     415    m_acTEncTop[layer].setSearchRange                                      ( m_iSearchRange );
     416    m_acTEncTop[layer].setBipredSearchRange                                ( m_bipredSearchRange );
    406417
    407418    //====== Quality control ========
    408     m_acTEncTop[layer].setMaxDeltaQP                   ( m_iMaxDeltaQP  );
    409     m_acTEncTop[layer].setMaxCuDQPDepth                ( m_iMaxCuDQPDepth  );
    410 
    411     m_acTEncTop[layer].setChromaCbQpOffset             ( m_cbQpOffset     );
    412     m_acTEncTop[layer].setChromaCrQpOffset             ( m_crQpOffset  );
     419    m_acTEncTop[layer].setMaxDeltaQP                                       ( m_iMaxDeltaQP  );
     420    m_acTEncTop[layer].setMaxCuDQPDepth                                    ( m_iMaxCuDQPDepth  );
     421    m_acTEncTop[layer].setMaxCUChromaQpAdjustmentDepth                     ( m_maxCUChromaQpAdjustmentDepth );
     422    m_acTEncTop[layer].setChromaCbQpOffset                                 ( m_cbQpOffset     );
     423    m_acTEncTop[layer].setChromaCrQpOffset                                 ( m_crQpOffset  );
     424
     425    m_acTEncTop[layer].setChromaFormatIdc                                  ( m_chromaFormatIDC  );
    413426
    414427#if ADAPTIVE_QP_SELECTION
    415     m_acTEncTop[layer].setUseAdaptQpSelect             ( m_bUseAdaptQpSelect   );
     428    m_acTEncTop[layer].setUseAdaptQpSelect                                 ( m_bUseAdaptQpSelect   );
    416429#endif
    417430   
    418     m_acTEncTop[layer].setUseAdaptiveQP                ( m_bUseAdaptiveQP  );
    419     m_acTEncTop[layer].setQPAdaptationRange            ( m_iQPAdaptationRange );
     431    m_acTEncTop[layer].setUseAdaptiveQP                                    ( m_bUseAdaptiveQP  );
     432    m_acTEncTop[layer].setQPAdaptationRange                                ( m_iQPAdaptationRange );
     433    m_acTEncTop[layer].setUseExtendedPrecision                             ( m_acLayerCfg[layer].m_useExtendedPrecision );
     434    m_acTEncTop[layer].setUseHighPrecisionPredictionWeighting              ( m_acLayerCfg[layer].m_useHighPrecisionPredictionWeighting );
    420435
    421436    //====== Tool list ========   
    422     m_acTEncTop[layer].setDeltaQpRD                    ( m_uiDeltaQpRD  );
    423     m_acTEncTop[layer].setUseASR                       ( m_bUseASR      );
    424     m_acTEncTop[layer].setUseHADME                     ( m_bUseHADME    );   
    425     m_acTEncTop[layer].setdQPs                         ( m_acLayerCfg[layer].getdQPs() );
    426     m_acTEncTop[layer].setUseRDOQ                      ( m_useRDOQ     );
    427     m_acTEncTop[layer].setUseRDOQTS                    ( m_useRDOQTS   );
    428     m_acTEncTop[layer].setRDpenalty                    ( m_rdPenalty );
     437    m_acTEncTop[layer].setDeltaQpRD                                        ( m_uiDeltaQpRD  );
     438    m_acTEncTop[layer].setUseASR                                           ( m_bUseASR      );
     439    m_acTEncTop[layer].setUseHADME                                         ( m_bUseHADME    );   
     440    m_acTEncTop[layer].setdQPs                                             ( m_acLayerCfg[layer].getdQPs() );
     441    m_acTEncTop[layer].setUseRDOQ                                          ( m_useRDOQ     );
     442    m_acTEncTop[layer].setUseRDOQTS                                        ( m_useRDOQTS   );
     443    m_acTEncTop[layer].setRDpenalty                                        ( m_rdPenalty );
    429444#if LAYER_CTB
    430     m_acTEncTop[layer].setQuadtreeTULog2MaxSize        ( m_acLayerCfg[layer].m_uiQuadtreeTULog2MaxSize );
    431     m_acTEncTop[layer].setQuadtreeTULog2MinSize        ( m_acLayerCfg[layer].m_uiQuadtreeTULog2MinSize );
    432     m_acTEncTop[layer].setQuadtreeTUMaxDepthInter      ( m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthInter );
    433     m_acTEncTop[layer].setQuadtreeTUMaxDepthIntra      ( m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthIntra );
    434 #else
    435     m_acTEncTop[layer].setQuadtreeTULog2MaxSize        ( m_uiQuadtreeTULog2MaxSize );
    436     m_acTEncTop[layer].setQuadtreeTULog2MinSize        ( m_uiQuadtreeTULog2MinSize );
    437     m_acTEncTop[layer].setQuadtreeTUMaxDepthInter      ( m_uiQuadtreeTUMaxDepthInter );
    438     m_acTEncTop[layer].setQuadtreeTUMaxDepthIntra      ( m_uiQuadtreeTUMaxDepthIntra );
    439 #endif
    440     m_acTEncTop[layer].setUseFastEnc                   ( m_bUseFastEnc  );
    441     m_acTEncTop[layer].setUseEarlyCU                   ( m_bUseEarlyCU  );
    442     m_acTEncTop[layer].setUseFastDecisionForMerge      ( m_useFastDecisionForMerge  );
    443     m_acTEncTop[layer].setUseCbfFastMode               ( m_bUseCbfFastMode  );
    444     m_acTEncTop[layer].setUseEarlySkipDetection        ( m_useEarlySkipDetection );
     445    m_acTEncTop[layer].setQuadtreeTULog2MaxSize                            ( m_acLayerCfg[layer].m_uiQuadtreeTULog2MaxSize );
     446    m_acTEncTop[layer].setQuadtreeTULog2MinSize                            ( m_acLayerCfg[layer].m_uiQuadtreeTULog2MinSize );
     447    m_acTEncTop[layer].setQuadtreeTUMaxDepthInter                          ( m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthInter );
     448    m_acTEncTop[layer].setQuadtreeTUMaxDepthIntra                          ( m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthIntra );
     449#else
     450    m_acTEncTop[layer].setQuadtreeTULog2MaxSize                            ( m_uiQuadtreeTULog2MaxSize );
     451    m_acTEncTop[layer].setQuadtreeTULog2MinSize                            ( m_uiQuadtreeTULog2MinSize );
     452    m_acTEncTop[layer].setQuadtreeTUMaxDepthInter                          ( m_uiQuadtreeTUMaxDepthInter );
     453    m_acTEncTop[layer].setQuadtreeTUMaxDepthIntra                          ( m_uiQuadtreeTUMaxDepthIntra );
     454#endif
     455    m_acTEncTop[layer].setUseFastEnc                                       ( m_bUseFastEnc  );
     456    m_acTEncTop[layer].setUseEarlyCU                                       ( m_bUseEarlyCU  );
     457    m_acTEncTop[layer].setUseFastDecisionForMerge                          ( m_useFastDecisionForMerge  );
     458    m_acTEncTop[layer].setUseCbfFastMode                                   ( m_bUseCbfFastMode  );
     459    m_acTEncTop[layer].setUseEarlySkipDetection                            ( m_useEarlySkipDetection );
     460    m_acTEncTop[layer].setUseCrossComponentPrediction                      ( m_useCrossComponentPrediction );
     461    m_acTEncTop[layer].setUseReconBasedCrossCPredictionEstimate            ( m_reconBasedCrossCPredictionEstimate );
     462    m_acTEncTop[layer].setSaoOffsetBitShift                                ( CHANNEL_TYPE_LUMA  , m_saoOffsetBitShift[CHANNEL_TYPE_LUMA]   );
     463    m_acTEncTop[layer].setSaoOffsetBitShift                                ( CHANNEL_TYPE_CHROMA, m_saoOffsetBitShift[CHANNEL_TYPE_CHROMA] );
     464    m_acTEncTop[layer].setUseTransformSkip                                 ( m_useTransformSkip      );
     465    m_acTEncTop[layer].setUseTransformSkipFast                             ( m_useTransformSkipFast  );
     466    m_acTEncTop[layer].setUseResidualRotation                              ( m_useResidualRotation   );
     467    m_acTEncTop[layer].setUseSingleSignificanceMapContext                  ( m_useSingleSignificanceMapContext   );
     468    m_acTEncTop[layer].setUseGolombRiceParameterAdaptation                 ( m_useGolombRiceParameterAdaptation );
     469    m_acTEncTop[layer].setAlignCABACBeforeBypass                           ( m_alignCABACBeforeBypass );
     470    m_acTEncTop[layer].setTransformSkipLog2MaxSize                         ( m_transformSkipLog2MaxSize  );
     471    for (UInt signallingModeIndex = 0; signallingModeIndex < NUMBER_OF_RDPCM_SIGNALLING_MODES; signallingModeIndex++)
     472    {
     473      m_acTEncTop[layer].setUseResidualDPCM                                ( RDPCMSignallingMode(signallingModeIndex), m_useResidualDPCM[signallingModeIndex]);
     474    }
     475    m_acTEncTop[layer].setUseConstrainedIntraPred                          ( m_bUseConstrainedIntraPred );
     476    m_acTEncTop[layer].setPCMLog2MinSize                                   ( m_uiPCMLog2MinSize);
     477    m_acTEncTop[layer].setUsePCM                                           ( m_usePCM );
     478    m_acTEncTop[layer].setPCMLog2MaxSize                                   ( m_pcmLog2MaxSize);
     479    m_acTEncTop[layer].setMaxNumMergeCand                                  ( m_maxNumMergeCand );
     480
     481
     482    //====== Weighted Prediction ========
     483    m_acTEncTop[layer].setUseWP                                            ( m_useWeightedPred      );
     484    m_acTEncTop[layer].setWPBiPred                                         ( m_useWeightedBiPred   );
    445485#if FAST_INTRA_SHVC
    446     m_acTEncTop[layer].setUseFastIntraScalable         ( m_useFastIntraScalable );
    447 #endif
    448 
    449     m_acTEncTop[layer].setUseTransformSkip             ( m_useTransformSkip      );
    450     m_acTEncTop[layer].setUseTransformSkipFast         ( m_useTransformSkipFast  );
    451     m_acTEncTop[layer].setUseConstrainedIntraPred      ( m_bUseConstrainedIntraPred );
    452     m_acTEncTop[layer].setPCMLog2MinSize               ( m_uiPCMLog2MinSize);
    453     m_acTEncTop[layer].setUsePCM                       ( m_usePCM );
    454     m_acTEncTop[layer].setPCMLog2MaxSize               ( m_pcmLog2MaxSize);
    455     m_acTEncTop[layer].setMaxNumMergeCand              ( m_maxNumMergeCand );
    456 
    457 
    458     //====== Weighted Prediction ========
    459     m_acTEncTop[layer].setUseWP                   ( m_useWeightedPred      );
    460     m_acTEncTop[layer].setWPBiPred                ( m_useWeightedBiPred   );
     486    m_acTEncTop[layer].setUseFastIntraScalable                             ( m_useFastIntraScalable );
     487#endif
    461488#if O0194_WEIGHTED_PREDICTION_CGS
    462489    if( layer != 0 && m_useInterLayerWeightedPred )
    463490    {
    464491      // Enable weighted prediction for enhancement layer
    465       m_acTEncTop[layer].setUseWP                 ( true   );
    466       m_acTEncTop[layer].setWPBiPred              ( true   );
     492      m_acTEncTop[layer].setUseWP                                           ( true   );
     493      m_acTEncTop[layer].setWPBiPred                                        ( true   );
    467494    }
    468495#endif
    469496    //====== Parallel Merge Estimation ========
    470     m_acTEncTop[layer].setLog2ParallelMergeLevelMinus2 ( m_log2ParallelMergeLevel - 2 );
     497    m_acTEncTop[layer].setLog2ParallelMergeLevelMinus2                      ( m_log2ParallelMergeLevel - 2 );
    471498
    472499    //====== Slice ========
    473     m_acTEncTop[layer].setSliceMode               ( m_sliceMode                );
    474     m_acTEncTop[layer].setSliceArgument           ( m_sliceArgument            );
     500    m_acTEncTop[layer].setSliceMode                                         ( (SliceConstraint) m_sliceMode );
     501    m_acTEncTop[layer].setSliceArgument                                     ( m_sliceArgument            );
    475502
    476503    //====== Dependent Slice ========
    477     m_acTEncTop[layer].setSliceSegmentMode        ( m_sliceSegmentMode         );
    478     m_acTEncTop[layer].setSliceSegmentArgument    ( m_sliceSegmentArgument     );
    479 #if LAYER_CTB
    480     Int iNumPartInCU = 1<<(m_acLayerCfg[layer].m_uiMaxCUDepth<<1);
    481 #else
    482     Int iNumPartInCU = 1<<(m_uiMaxCUDepth<<1);
    483 #endif
    484     if(m_sliceSegmentMode==FIXED_NUMBER_OF_LCU)
    485     {
    486       m_acTEncTop[layer].setSliceSegmentArgument ( m_sliceSegmentArgument * iNumPartInCU );
    487     }
    488     if(m_sliceMode==FIXED_NUMBER_OF_LCU)
    489     {
    490       m_acTEncTop[layer].setSliceArgument ( m_sliceArgument * iNumPartInCU );
    491     }
    492     if(m_sliceMode==FIXED_NUMBER_OF_TILES)
    493     {
    494       m_acTEncTop[layer].setSliceArgument ( m_sliceArgument );
    495     }
    496 
    497     if(m_sliceMode == 0 )
     504    m_acTEncTop[layer].setSliceSegmentMode                                  ( (SliceConstraint) m_sliceSegmentMode );
     505    m_acTEncTop[layer].setSliceSegmentArgument                              ( m_sliceSegmentArgument     );
     506
     507    if(m_sliceMode == NO_SLICES )
    498508    {
    499509      m_bLFCrossSliceBoundaryFlag = true;
    500510    }
    501     m_acTEncTop[layer].setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag );
    502     m_acTEncTop[layer].setUseSAO ( m_bUseSAO );
    503     m_acTEncTop[layer].setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic);
    504 
    505     m_acTEncTop[layer].setSaoLcuBoundary (m_saoLcuBoundary);
    506     m_acTEncTop[layer].setPCMInputBitDepthFlag  ( m_bPCMInputBitDepthFlag);
    507     m_acTEncTop[layer].setPCMFilterDisableFlag  ( m_bPCMFilterDisableFlag);
    508 
    509     m_acTEncTop[layer].setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled);
    510     m_acTEncTop[layer].setRecoveryPointSEIEnabled( m_recoveryPointSEIEnabled );
    511     m_acTEncTop[layer].setBufferingPeriodSEIEnabled( m_bufferingPeriodSEIEnabled );
    512     m_acTEncTop[layer].setPictureTimingSEIEnabled( m_pictureTimingSEIEnabled );
    513     m_acTEncTop[layer].setToneMappingInfoSEIEnabled                 ( m_toneMappingInfoSEIEnabled );
    514     m_acTEncTop[layer].setTMISEIToneMapId                           ( m_toneMapId );
    515     m_acTEncTop[layer].setTMISEIToneMapCancelFlag                   ( m_toneMapCancelFlag );
    516     m_acTEncTop[layer].setTMISEIToneMapPersistenceFlag              ( m_toneMapPersistenceFlag );
    517     m_acTEncTop[layer].setTMISEICodedDataBitDepth                   ( m_toneMapCodedDataBitDepth );
    518     m_acTEncTop[layer].setTMISEITargetBitDepth                      ( m_toneMapTargetBitDepth );
    519     m_acTEncTop[layer].setTMISEIModelID                             ( m_toneMapModelId );
    520     m_acTEncTop[layer].setTMISEIMinValue                            ( m_toneMapMinValue );
    521     m_acTEncTop[layer].setTMISEIMaxValue                            ( m_toneMapMaxValue );
    522     m_acTEncTop[layer].setTMISEISigmoidMidpoint                     ( m_sigmoidMidpoint );
    523     m_acTEncTop[layer].setTMISEISigmoidWidth                        ( m_sigmoidWidth );
    524     m_acTEncTop[layer].setTMISEIStartOfCodedInterva                 ( m_startOfCodedInterval );
    525     m_acTEncTop[layer].setTMISEINumPivots                           ( m_numPivots );
    526     m_acTEncTop[layer].setTMISEICodedPivotValue                     ( m_codedPivotValue );
    527     m_acTEncTop[layer].setTMISEITargetPivotValue                    ( m_targetPivotValue );
    528     m_acTEncTop[layer].setTMISEICameraIsoSpeedIdc                   ( m_cameraIsoSpeedIdc );
    529     m_acTEncTop[layer].setTMISEICameraIsoSpeedValue                 ( m_cameraIsoSpeedValue );
    530     m_acTEncTop[layer].setTMISEIExposureCompensationValueSignFlag   ( m_exposureCompensationValueSignFlag );
    531     m_acTEncTop[layer].setTMISEIExposureCompensationValueNumerator  ( m_exposureCompensationValueNumerator );
    532     m_acTEncTop[layer].setTMISEIExposureCompensationValueDenomIdc   ( m_exposureCompensationValueDenomIdc );
    533     m_acTEncTop[layer].setTMISEIRefScreenLuminanceWhite             ( m_refScreenLuminanceWhite );
    534     m_acTEncTop[layer].setTMISEIExtendedRangeWhiteLevel             ( m_extendedRangeWhiteLevel );
    535     m_acTEncTop[layer].setTMISEINominalBlackLevelLumaCodeValue      ( m_nominalBlackLevelLumaCodeValue );
    536     m_acTEncTop[layer].setTMISEINominalWhiteLevelLumaCodeValue      ( m_nominalWhiteLevelLumaCodeValue );
    537     m_acTEncTop[layer].setTMISEIExtendedWhiteLevelLumaCodeValue     ( m_extendedWhiteLevelLumaCodeValue );
    538 #if P0050_KNEE_FUNCTION_SEI
    539     m_acTEncTop[layer].setKneeSEIEnabled                            ( m_kneeSEIEnabled );
    540     m_acTEncTop[layer].setKneeSEIId                                 ( m_kneeSEIId );
    541     m_acTEncTop[layer].setKneeSEICancelFlag                         ( m_kneeSEICancelFlag );
    542     m_acTEncTop[layer].setKneeSEIPersistenceFlag                    ( m_kneeSEIPersistenceFlag );
    543     m_acTEncTop[layer].setKneeSEIMappingFlag                        ( m_kneeSEIMappingFlag );
    544     m_acTEncTop[layer].setKneeSEIInputDrange                        ( m_kneeSEIInputDrange );
    545     m_acTEncTop[layer].setKneeSEIInputDispLuminance                 ( m_kneeSEIInputDispLuminance );
    546     m_acTEncTop[layer].setKneeSEIOutputDrange                       ( m_kneeSEIOutputDrange );
    547     m_acTEncTop[layer].setKneeSEIOutputDispLuminance                ( m_kneeSEIOutputDispLuminance );
    548     m_acTEncTop[layer].setKneeSEINumKneePointsMinus1                ( m_kneeSEINumKneePointsMinus1 );
    549     m_acTEncTop[layer].setKneeSEIInputKneePoint                     ( m_kneeSEIInputKneePoint );
    550     m_acTEncTop[layer].setKneeSEIOutputKneePoint                    ( m_kneeSEIOutputKneePoint );
    551 #endif
     511
     512    m_acTEncTop[layer].setLFCrossSliceBoundaryFlag                          ( m_bLFCrossSliceBoundaryFlag );
     513    m_acTEncTop[layer].setUseSAO                                            ( m_bUseSAO );
     514    m_acTEncTop[layer].setMaxNumOffsetsPerPic                               ( m_maxNumOffsetsPerPic );
     515
     516    m_acTEncTop[layer].setSaoCtuBoundary                                    ( m_saoCtuBoundary );
     517    m_acTEncTop[layer].setPCMInputBitDepthFlag                              ( m_bPCMInputBitDepthFlag);
     518    m_acTEncTop[layer].setPCMFilterDisableFlag                              ( m_bPCMFilterDisableFlag);
     519
     520    m_acTEncTop[layer].setDisableIntraReferenceSmoothing                    (!m_enableIntraReferenceSmoothing );
     521    m_acTEncTop[layer].setDecodedPictureHashSEIEnabled                      ( m_decodedPictureHashSEIEnabled );
     522    m_acTEncTop[layer].setRecoveryPointSEIEnabled                           ( m_recoveryPointSEIEnabled );
     523    m_acTEncTop[layer].setBufferingPeriodSEIEnabled                         ( m_bufferingPeriodSEIEnabled );
     524    m_acTEncTop[layer].setPictureTimingSEIEnabled                           ( m_pictureTimingSEIEnabled );
     525    m_acTEncTop[layer].setToneMappingInfoSEIEnabled                         ( m_toneMappingInfoSEIEnabled );
     526    m_acTEncTop[layer].setTMISEIToneMapId                                   ( m_toneMapId );
     527    m_acTEncTop[layer].setTMISEIToneMapCancelFlag                           ( m_toneMapCancelFlag );
     528    m_acTEncTop[layer].setTMISEIToneMapPersistenceFlag                      ( m_toneMapPersistenceFlag );
     529    m_acTEncTop[layer].setTMISEICodedDataBitDepth                           ( m_toneMapCodedDataBitDepth );
     530    m_acTEncTop[layer].setTMISEITargetBitDepth                              ( m_toneMapTargetBitDepth );
     531    m_acTEncTop[layer].setTMISEIModelID                                     ( m_toneMapModelId );
     532    m_acTEncTop[layer].setTMISEIMinValue                                    ( m_toneMapMinValue );
     533    m_acTEncTop[layer].setTMISEIMaxValue                                    ( m_toneMapMaxValue );
     534    m_acTEncTop[layer].setTMISEISigmoidMidpoint                             ( m_sigmoidMidpoint );
     535    m_acTEncTop[layer].setTMISEISigmoidWidth                                ( m_sigmoidWidth );
     536    m_acTEncTop[layer].setTMISEIStartOfCodedInterva                         ( m_startOfCodedInterval );
     537    m_acTEncTop[layer].setTMISEINumPivots                                   ( m_numPivots );
     538    m_acTEncTop[layer].setTMISEICodedPivotValue                             ( m_codedPivotValue );
     539    m_acTEncTop[layer].setTMISEITargetPivotValue                            ( m_targetPivotValue );
     540    m_acTEncTop[layer].setTMISEICameraIsoSpeedIdc                           ( m_cameraIsoSpeedIdc );
     541    m_acTEncTop[layer].setTMISEICameraIsoSpeedValue                         ( m_cameraIsoSpeedValue );
     542    m_acTEncTop[layer].setTMISEIExposureIndexIdc                            ( m_exposureIndexIdc );
     543    m_acTEncTop[layer].setTMISEIExposureIndexValue                          ( m_exposureIndexValue );
     544    m_acTEncTop[layer].setTMISEIExposureCompensationValueSignFlag           ( m_exposureCompensationValueSignFlag );
     545    m_acTEncTop[layer].setTMISEIExposureCompensationValueNumerator          ( m_exposureCompensationValueNumerator );
     546    m_acTEncTop[layer].setTMISEIExposureCompensationValueDenomIdc           ( m_exposureCompensationValueDenomIdc );
     547    m_acTEncTop[layer].setTMISEIRefScreenLuminanceWhite                     ( m_refScreenLuminanceWhite );
     548    m_acTEncTop[layer].setTMISEIExtendedRangeWhiteLevel                     ( m_extendedRangeWhiteLevel );
     549    m_acTEncTop[layer].setTMISEINominalBlackLevelLumaCodeValue              ( m_nominalBlackLevelLumaCodeValue );
     550    m_acTEncTop[layer].setTMISEINominalWhiteLevelLumaCodeValue              ( m_nominalWhiteLevelLumaCodeValue );
     551    m_acTEncTop[layer].setTMISEIExtendedWhiteLevelLumaCodeValue             ( m_extendedWhiteLevelLumaCodeValue );
     552    m_acTEncTop[layer].setChromaSamplingFilterHintEnabled                   ( m_chromaSamplingFilterSEIenabled );
     553    m_acTEncTop[layer].setChromaSamplingHorFilterIdc                        ( m_chromaSamplingHorFilterIdc );
     554    m_acTEncTop[layer].setChromaSamplingVerFilterIdc                        ( m_chromaSamplingVerFilterIdc );
     555    m_acTEncTop[layer].setFramePackingArrangementSEIEnabled                 ( m_framePackingSEIEnabled );
     556    m_acTEncTop[layer].setFramePackingArrangementSEIType                    ( m_framePackingSEIType );
     557    m_acTEncTop[layer].setFramePackingArrangementSEIId                      ( m_framePackingSEIId );
     558    m_acTEncTop[layer].setFramePackingArrangementSEIQuincunx                ( m_framePackingSEIQuincunx );
     559    m_acTEncTop[layer].setFramePackingArrangementSEIInterpretation          ( m_framePackingSEIInterpretation );
     560    m_acTEncTop[layer].setSegmentedRectFramePackingArrangementSEIEnabled    ( m_segmentedRectFramePackingSEIEnabled );
     561    m_acTEncTop[layer].setSegmentedRectFramePackingArrangementSEICancel     ( m_segmentedRectFramePackingSEICancel );
     562    m_acTEncTop[layer].setSegmentedRectFramePackingArrangementSEIType       ( m_segmentedRectFramePackingSEIType );
     563    m_acTEncTop[layer].setSegmentedRectFramePackingArrangementSEIPersistence( m_segmentedRectFramePackingSEIPersistence );
     564    m_acTEncTop[layer].setDisplayOrientationSEIAngle                        ( m_displayOrientationSEIAngle );
     565    m_acTEncTop[layer].setTemporalLevel0IndexSEIEnabled                     ( m_temporalLevel0IndexSEIEnabled );
     566    m_acTEncTop[layer].setGradualDecodingRefreshInfoEnabled                 ( m_gradualDecodingRefreshInfoEnabled );
     567    m_acTEncTop[layer].setNoDisplaySEITLayer                                ( m_noDisplaySEITLayer );
     568    m_acTEncTop[layer].setDecodingUnitInfoSEIEnabled                        ( m_decodingUnitInfoSEIEnabled );
     569    m_acTEncTop[layer].setSOPDescriptionSEIEnabled                          ( m_SOPDescriptionSEIEnabled );
     570    m_acTEncTop[layer].setScalableNestingSEIEnabled                         ( m_scalableNestingSEIEnabled );
     571    m_acTEncTop[layer].setTMCTSSEIEnabled                                   ( m_tmctsSEIEnabled );
     572    m_acTEncTop[layer].setTimeCodeSEIEnabled                                ( m_timeCodeSEIEnabled );
     573    m_acTEncTop[layer].setNumberOfTimeSets                                  ( m_timeCodeSEINumTs );
     574    for(Int i = 0; i < m_timeCodeSEINumTs; i++) { m_acTEncTop[layer].setTimeSet(m_timeSetArray[i], i); }
     575    m_acTEncTop[layer].setKneeSEIEnabled                                    ( m_kneeSEIEnabled );
     576    m_acTEncTop[layer].setKneeSEIId                                         ( m_kneeSEIId );
     577    m_acTEncTop[layer].setKneeSEICancelFlag                                 ( m_kneeSEICancelFlag );
     578    m_acTEncTop[layer].setKneeSEIPersistenceFlag                            ( m_kneeSEIPersistenceFlag );   
     579    m_acTEncTop[layer].setKneeSEIInputDrange                                ( m_kneeSEIInputDrange );
     580    m_acTEncTop[layer].setKneeSEIInputDispLuminance                         ( m_kneeSEIInputDispLuminance );
     581    m_acTEncTop[layer].setKneeSEIOutputDrange                               ( m_kneeSEIOutputDrange );
     582    m_acTEncTop[layer].setKneeSEIOutputDispLuminance                        ( m_kneeSEIOutputDispLuminance );
     583    m_acTEncTop[layer].setKneeSEINumKneePointsMinus1                        ( m_kneeSEINumKneePointsMinus1 );
     584    m_acTEncTop[layer].setKneeSEIInputKneePoint                             ( m_kneeSEIInputKneePoint );
     585    m_acTEncTop[layer].setKneeSEIOutputKneePoint                            ( m_kneeSEIOutputKneePoint );
     586    m_acTEncTop[layer].setMasteringDisplaySEI                               ( m_masteringDisplay );
    552587#if Q0096_OVERLAY_SEI
    553     m_acTEncTop[layer].setOverlaySEIEnabled                         ( m_overlaySEIEnabled );
    554     m_acTEncTop[layer].setOverlaySEICancelFlag                      ( m_overlayInfoCancelFlag );
    555     m_acTEncTop[layer].setOverlaySEIContentAuxIdMinus128            ( m_overlayContentAuxIdMinus128 );
    556     m_acTEncTop[layer].setOverlaySEILabelAuxIdMinus128              ( m_overlayLabelAuxIdMinus128 );
    557     m_acTEncTop[layer].setOverlaySEIAlphaAuxIdMinus128              ( m_overlayAlphaAuxIdMinus128 );
    558     m_acTEncTop[layer].setOverlaySEIElementLabelValueLengthMinus8   ( m_overlayElementLabelValueLengthMinus8 );
    559     m_acTEncTop[layer].setOverlaySEINumOverlaysMinus1               ( m_numOverlaysMinus1 );
    560     m_acTEncTop[layer].setOverlaySEIIdx                             ( m_overlayIdx );
    561     m_acTEncTop[layer].setOverlaySEILanguagePresentFlag             ( m_overlayLanguagePresentFlag );
    562     m_acTEncTop[layer].setOverlaySEIContentLayerId                  ( m_overlayContentLayerId );
    563     m_acTEncTop[layer].setOverlaySEILabelPresentFlag                ( m_overlayLabelPresentFlag );
    564     m_acTEncTop[layer].setOverlaySEILabelLayerId                    ( m_overlayLabelLayerId );
    565     m_acTEncTop[layer].setOverlaySEIAlphaPresentFlag                ( m_overlayAlphaPresentFlag );
    566     m_acTEncTop[layer].setOverlaySEIAlphaLayerId                    ( m_overlayAlphaLayerId );
    567     m_acTEncTop[layer].setOverlaySEINumElementsMinus1               ( m_numOverlayElementsMinus1 );
    568     m_acTEncTop[layer].setOverlaySEIElementLabelMin                 ( m_overlayElementLabelMin );
    569     m_acTEncTop[layer].setOverlaySEIElementLabelMax                 ( m_overlayElementLabelMax );
    570     m_acTEncTop[layer].setOverlaySEILanguage                        ( m_overlayLanguage );
    571     m_acTEncTop[layer].setOverlaySEIName                            ( m_overlayName );
    572     m_acTEncTop[layer].setOverlaySEIElementName                     ( m_overlayElementName );
    573     m_acTEncTop[layer].setOverlaySEIPersistenceFlag                 ( m_overlayInfoPersistenceFlag );
     588    m_acTEncTop[layer].setOverlaySEIEnabled                                 ( m_overlaySEIEnabled );
     589    m_acTEncTop[layer].setOverlaySEICancelFlag                              ( m_overlayInfoCancelFlag );
     590    m_acTEncTop[layer].setOverlaySEIContentAuxIdMinus128                    ( m_overlayContentAuxIdMinus128 );
     591    m_acTEncTop[layer].setOverlaySEILabelAuxIdMinus128                      ( m_overlayLabelAuxIdMinus128 );
     592    m_acTEncTop[layer].setOverlaySEIAlphaAuxIdMinus128                      ( m_overlayAlphaAuxIdMinus128 );
     593    m_acTEncTop[layer].setOverlaySEIElementLabelValueLengthMinus8           ( m_overlayElementLabelValueLengthMinus8 );
     594    m_acTEncTop[layer].setOverlaySEINumOverlaysMinus1                       ( m_numOverlaysMinus1 );
     595    m_acTEncTop[layer].setOverlaySEIIdx                                     ( m_overlayIdx );
     596    m_acTEncTop[layer].setOverlaySEILanguagePresentFlag                     ( m_overlayLanguagePresentFlag );
     597    m_acTEncTop[layer].setOverlaySEIContentLayerId                          ( m_overlayContentLayerId );
     598    m_acTEncTop[layer].setOverlaySEILabelPresentFlag                        ( m_overlayLabelPresentFlag );
     599    m_acTEncTop[layer].setOverlaySEILabelLayerId                            ( m_overlayLabelLayerId );
     600    m_acTEncTop[layer].setOverlaySEIAlphaPresentFlag                        ( m_overlayAlphaPresentFlag );
     601    m_acTEncTop[layer].setOverlaySEIAlphaLayerId                            ( m_overlayAlphaLayerId );
     602    m_acTEncTop[layer].setOverlaySEINumElementsMinus1                       ( m_numOverlayElementsMinus1 );
     603    m_acTEncTop[layer].setOverlaySEIElementLabelMin                         ( m_overlayElementLabelMin );
     604    m_acTEncTop[layer].setOverlaySEIElementLabelMax                         ( m_overlayElementLabelMax );
     605    m_acTEncTop[layer].setOverlaySEILanguage                                ( m_overlayLanguage );
     606    m_acTEncTop[layer].setOverlaySEIName                                    ( m_overlayName );
     607    m_acTEncTop[layer].setOverlaySEIElementName                             ( m_overlayElementName );
     608    m_acTEncTop[layer].setOverlaySEIPersistenceFlag                         ( m_overlayInfoPersistenceFlag );
    574609#endif
    575610#if Q0074_COLOUR_REMAPPING_SEI
    576     m_acTEncTop[layer].setCRISEIFile                                ( const_cast<Char*>(m_acLayerCfg[layer].m_colourRemapSEIFile.c_str()) );
    577     m_acTEncTop[layer].setCRISEIId                                  ( m_acLayerCfg[layer].m_colourRemapSEIId );
    578     m_acTEncTop[layer].setCRISEICancelFlag                          ( m_acLayerCfg[layer].m_colourRemapSEICancelFlag );
    579     m_acTEncTop[layer].setCRISEIPersistenceFlag                     ( m_acLayerCfg[layer].m_colourRemapSEIPersistenceFlag );
    580     m_acTEncTop[layer].setCRISEIVideoSignalInfoPresentFlag          ( m_acLayerCfg[layer].m_colourRemapSEIVideoSignalInfoPresentFlag );
    581     m_acTEncTop[layer].setCRISEIFullRangeFlag                       ( m_acLayerCfg[layer].m_colourRemapSEIFullRangeFlag );
    582     m_acTEncTop[layer].setCRISEIPrimaries                           ( m_acLayerCfg[layer].m_colourRemapSEIPrimaries );
    583     m_acTEncTop[layer].setCRISEITransferFunction                    ( m_acLayerCfg[layer].m_colourRemapSEITransferFunction );
    584     m_acTEncTop[layer].setCRISEIMatrixCoefficients                  ( m_acLayerCfg[layer].m_colourRemapSEIMatrixCoefficients );
    585     m_acTEncTop[layer].setCRISEIInputBitDepth                       ( m_acLayerCfg[layer].m_colourRemapSEIInputBitDepth );
    586     m_acTEncTop[layer].setCRISEIBitDepth                            ( m_acLayerCfg[layer].m_colourRemapSEIBitDepth );
    587     m_acTEncTop[layer].setCRISEIPreLutNumValMinus1                  ( m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1 );
    588     m_acTEncTop[layer].setCRISEIPreLutCodedValue                    ( m_acLayerCfg[layer].m_colourRemapSEIPreLutCodedValue );
    589     m_acTEncTop[layer].setCRISEIPreLutTargetValue                   ( m_acLayerCfg[layer].m_colourRemapSEIPreLutTargetValue );
    590     m_acTEncTop[layer].setCRISEIMatrixPresentFlag                   ( m_acLayerCfg[layer].m_colourRemapSEIMatrixPresentFlag );
    591     m_acTEncTop[layer].setCRISEILog2MatrixDenom                     ( m_acLayerCfg[layer].m_colourRemapSEILog2MatrixDenom );
    592     m_acTEncTop[layer].setCRISEICoeffs                              ( m_acLayerCfg[layer].m_colourRemapSEICoeffs );
    593     m_acTEncTop[layer].setCRISEIPostLutNumValMinus1                 ( m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1 );
    594     m_acTEncTop[layer].setCRISEIPostLutCodedValue                   ( m_acLayerCfg[layer]. m_colourRemapSEIPostLutCodedValue );
    595     m_acTEncTop[layer].setCRISEIPostLutTargetValue                  ( m_acLayerCfg[layer].m_colourRemapSEIPostLutTargetValue );
    596 #endif
    597     m_acTEncTop[layer].setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled );
    598     m_acTEncTop[layer].setFramePackingArrangementSEIType( m_framePackingSEIType );
    599     m_acTEncTop[layer].setFramePackingArrangementSEIId( m_framePackingSEIId );
    600     m_acTEncTop[layer].setFramePackingArrangementSEIQuincunx( m_framePackingSEIQuincunx );
    601     m_acTEncTop[layer].setFramePackingArrangementSEIInterpretation( m_framePackingSEIInterpretation );
    602     m_acTEncTop[layer].setDisplayOrientationSEIAngle( m_displayOrientationSEIAngle );
    603     m_acTEncTop[layer].setTemporalLevel0IndexSEIEnabled( m_temporalLevel0IndexSEIEnabled );
    604     m_acTEncTop[layer].setGradualDecodingRefreshInfoEnabled( m_gradualDecodingRefreshInfoEnabled );
    605     m_acTEncTop[layer].setDecodingUnitInfoSEIEnabled( m_decodingUnitInfoSEIEnabled );
     611    m_acTEncTop[layer].setCRISEIFile                            ( const_cast<Char*>(m_acLayerCfg[layer].m_colourRemapSEIFile.c_str()) );
     612    m_acTEncTop[layer].setCRISEIId                              ( m_acLayerCfg[layer].m_colourRemapSEIId );
     613    m_acTEncTop[layer].setCRISEICancelFlag                      ( m_acLayerCfg[layer].m_colourRemapSEICancelFlag );
     614    m_acTEncTop[layer].setCRISEIPersistenceFlag                 ( m_acLayerCfg[layer].m_colourRemapSEIPersistenceFlag );
     615    m_acTEncTop[layer].setCRISEIVideoSignalInfoPresentFlag      ( m_acLayerCfg[layer].m_colourRemapSEIVideoSignalInfoPresentFlag );
     616    m_acTEncTop[layer].setCRISEIFullRangeFlag                   ( m_acLayerCfg[layer].m_colourRemapSEIFullRangeFlag );
     617    m_acTEncTop[layer].setCRISEIPrimaries                       ( m_acLayerCfg[layer].m_colourRemapSEIPrimaries );
     618    m_acTEncTop[layer].setCRISEITransferFunction                ( m_acLayerCfg[layer].m_colourRemapSEITransferFunction );
     619    m_acTEncTop[layer].setCRISEIMatrixCoefficients              ( m_acLayerCfg[layer].m_colourRemapSEIMatrixCoefficients );
     620    m_acTEncTop[layer].setCRISEIInputBitDepth                   ( m_acLayerCfg[layer].m_colourRemapSEIInputBitDepth );
     621    m_acTEncTop[layer].setCRISEIBitDepth                        ( m_acLayerCfg[layer].m_colourRemapSEIBitDepth );
     622    m_acTEncTop[layer].setCRISEIPreLutNumValMinus1              ( m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1 );
     623    m_acTEncTop[layer].setCRISEIPreLutCodedValue                ( m_acLayerCfg[layer].m_colourRemapSEIPreLutCodedValue );
     624    m_acTEncTop[layer].setCRISEIPreLutTargetValue               ( m_acLayerCfg[layer].m_colourRemapSEIPreLutTargetValue );
     625    m_acTEncTop[layer].setCRISEIMatrixPresentFlag               ( m_acLayerCfg[layer].m_colourRemapSEIMatrixPresentFlag );
     626    m_acTEncTop[layer].setCRISEILog2MatrixDenom                 ( m_acLayerCfg[layer].m_colourRemapSEILog2MatrixDenom );
     627    m_acTEncTop[layer].setCRISEICoeffs                          ( m_acLayerCfg[layer].m_colourRemapSEICoeffs );
     628    m_acTEncTop[layer].setCRISEIPostLutNumValMinus1             ( m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1 );
     629    m_acTEncTop[layer].setCRISEIPostLutCodedValue               ( m_acLayerCfg[layer]. m_colourRemapSEIPostLutCodedValue );
     630    m_acTEncTop[layer].setCRISEIPostLutTargetValue              ( m_acLayerCfg[layer].m_colourRemapSEIPostLutTargetValue );
     631#endif   
    606632#if LAYERS_NOT_PRESENT_SEI
    607     m_acTEncTop[layer].setLayersNotPresentSEIEnabled( m_layersNotPresentSEIEnabled );
    608 #endif
    609     m_acTEncTop[layer].setSOPDescriptionSEIEnabled( m_SOPDescriptionSEIEnabled );
    610     m_acTEncTop[layer].setScalableNestingSEIEnabled( m_scalableNestingSEIEnabled );
     633    m_acTEncTop[layer].setLayersNotPresentSEIEnabled            ( m_layersNotPresentSEIEnabled );
     634#endif   
    611635#if Q0189_TMVP_CONSTRAINTS
    612     m_acTEncTop[layer].setTMVPConstraintsSEIEnabled( m_TMVPConstraintsSEIEnabled);           
     636    m_acTEncTop[layer].setTMVPConstraintsSEIEnabled             ( m_TMVPConstraintsSEIEnabled);           
    613637#endif
    614638#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
    615639    m_acTEncTop[layer].setInterLayerConstrainedTileSetsSEIEnabled( m_interLayerConstrainedTileSetsSEIEnabled );
    616     m_acTEncTop[layer].setIlNumSetsInMessage( m_ilNumSetsInMessage );
    617     m_acTEncTop[layer].setSkippedTileSetPresentFlag( m_skippedTileSetPresentFlag );
    618     m_acTEncTop[layer].setTopLeftTileIndex( m_topLeftTileIndex );
    619     m_acTEncTop[layer].setBottomRightTileIndex( m_bottomRightTileIndex );
    620     m_acTEncTop[layer].setIlcIdc( m_ilcIdc );
    621 #endif
    622     m_acTEncTop[layer].setTileUniformSpacingFlag     ( m_tileUniformSpacingFlag );
    623     m_acTEncTop[layer].setNumColumnsMinus1           ( m_numTileColumnsMinus1 );
    624     m_acTEncTop[layer].setNumRowsMinus1              ( m_numTileRowsMinus1 );
     640    m_acTEncTop[layer].setIlNumSetsInMessage                    ( m_ilNumSetsInMessage );
     641    m_acTEncTop[layer].setSkippedTileSetPresentFlag             ( m_skippedTileSetPresentFlag );
     642    m_acTEncTop[layer].setTopLeftTileIndex                      ( m_topLeftTileIndex );
     643    m_acTEncTop[layer].setBottomRightTileIndex                  ( m_bottomRightTileIndex );
     644    m_acTEncTop[layer].setIlcIdc                                ( m_ilcIdc );
     645#endif
     646    m_acTEncTop[layer].setTileUniformSpacingFlag                ( m_tileUniformSpacingFlag );
     647    m_acTEncTop[layer].setNumColumnsMinus1                      ( m_numTileColumnsMinus1 );
     648    m_acTEncTop[layer].setNumRowsMinus1                         ( m_numTileRowsMinus1 );
    625649    if(!m_tileUniformSpacingFlag)
    626650    {
    627       m_acTEncTop[layer].setColumnWidth              ( m_tileColumnWidth );
    628       m_acTEncTop[layer].setRowHeight                ( m_tileRowHeight );
     651      m_acTEncTop[layer].setColumnWidth                         ( m_tileColumnWidth );
     652      m_acTEncTop[layer].setRowHeight                           ( m_tileRowHeight );
    629653    }
    630654    m_acTEncTop[layer].xCheckGSParameters();
     
    634658      m_bLFCrossTileBoundaryFlag = true;
    635659    }
    636     m_acTEncTop[layer].setLFCrossTileBoundaryFlag( m_bLFCrossTileBoundaryFlag );
    637     m_acTEncTop[layer].setWaveFrontSynchro           ( m_acLayerCfg[layer].m_waveFrontSynchro );
    638     m_acTEncTop[layer].setWaveFrontSubstreams        ( m_acLayerCfg[layer].m_iWaveFrontSubstreams );
    639     m_acTEncTop[layer].setTMVPModeId ( m_TMVPModeId );
    640     m_acTEncTop[layer].setUseScalingListId           ( m_useScalingListId  );
    641     m_acTEncTop[layer].setScalingListFile            ( m_scalingListFile   );
    642     m_acTEncTop[layer].setSignHideFlag(m_signHideFlag);
     660    m_acTEncTop[layer].setLFCrossTileBoundaryFlag               ( m_bLFCrossTileBoundaryFlag );
     661    m_acTEncTop[layer].setWaveFrontSynchro                      ( m_acLayerCfg[layer].m_waveFrontSynchro );
     662    m_acTEncTop[layer].setWaveFrontSubstreams                   ( m_acLayerCfg[layer].m_iWaveFrontSubstreams );
     663    m_acTEncTop[layer].setTMVPModeId                            ( m_TMVPModeId );
     664    m_acTEncTop[layer].setUseScalingListId                      ( m_useScalingListId  );
     665    m_acTEncTop[layer].setScalingListFile                       ( m_scalingListFile   );
     666    m_acTEncTop[layer].setSignHideFlag                          ( m_signHideFlag );
    643667#if RC_SHVC_HARMONIZATION
    644     m_acTEncTop[layer].setUseRateCtrl     (m_acLayerCfg[layer].getRCEnableRateControl());
    645     m_acTEncTop[layer].setTargetBitrate   (m_acLayerCfg[layer].getRCTargetBitrate());
    646     m_acTEncTop[layer].setKeepHierBit     (m_acLayerCfg[layer].getRCKeepHierarchicalBit());
    647     m_acTEncTop[layer].setLCULevelRC      (m_acLayerCfg[layer].getRCLCULevelRC());
    648     m_acTEncTop[layer].setUseLCUSeparateModel (m_acLayerCfg[layer].getRCUseLCUSeparateModel());
    649     m_acTEncTop[layer].setInitialQP           (m_acLayerCfg[layer].getRCInitialQP());
    650     m_acTEncTop[layer].setForceIntraQP        (m_acLayerCfg[layer].getRCForceIntraQP());
    651 #else
    652     m_acTEncTop[layer].setUseRateCtrl         ( m_RCEnableRateControl );
    653     m_acTEncTop[layer].setTargetBitrate       ( m_RCTargetBitrate );
    654     m_acTEncTop[layer].setKeepHierBit         ( m_RCKeepHierarchicalBit );
    655     m_acTEncTop[layer].setLCULevelRC          ( m_RCLCULevelRC );
    656     m_acTEncTop[layer].setUseLCUSeparateModel ( m_RCUseLCUSeparateModel );
    657     m_acTEncTop[layer].setInitialQP           ( m_RCInitialQP );
    658     m_acTEncTop[layer].setForceIntraQP        ( m_RCForceIntraQP );
    659 #endif
    660     m_acTEncTop[layer].setTransquantBypassEnableFlag(m_TransquantBypassEnableFlag);
    661     m_acTEncTop[layer].setCUTransquantBypassFlagForceValue(m_CUTransquantBypassFlagForce);
    662     m_acTEncTop[layer].setUseRecalculateQPAccordingToLambda( m_recalculateQPAccordingToLambda );
    663     m_acTEncTop[layer].setUseStrongIntraSmoothing( m_useStrongIntraSmoothing );
    664     m_acTEncTop[layer].setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled );
    665     m_acTEncTop[layer].setVuiParametersPresentFlag( m_vuiParametersPresentFlag );
    666     m_acTEncTop[layer].setAspectRatioInfoPresentFlag( m_aspectRatioInfoPresentFlag);
    667     m_acTEncTop[layer].setAspectRatioIdc( m_aspectRatioIdc );
    668     m_acTEncTop[layer].setSarWidth( m_sarWidth );
    669     m_acTEncTop[layer].setSarHeight( m_sarHeight );
    670     m_acTEncTop[layer].setOverscanInfoPresentFlag( m_overscanInfoPresentFlag );
    671     m_acTEncTop[layer].setOverscanAppropriateFlag( m_overscanAppropriateFlag );
    672     m_acTEncTop[layer].setVideoSignalTypePresentFlag( m_videoSignalTypePresentFlag );
    673     m_acTEncTop[layer].setVideoFormat( m_videoFormat );
    674     m_acTEncTop[layer].setVideoFullRangeFlag( m_videoFullRangeFlag );
    675     m_acTEncTop[layer].setColourDescriptionPresentFlag( m_colourDescriptionPresentFlag );
    676     m_acTEncTop[layer].setColourPrimaries( m_colourPrimaries );
    677     m_acTEncTop[layer].setTransferCharacteristics( m_transferCharacteristics );
    678     m_acTEncTop[layer].setMatrixCoefficients( m_matrixCoefficients );
    679     m_acTEncTop[layer].setChromaLocInfoPresentFlag( m_chromaLocInfoPresentFlag );
    680     m_acTEncTop[layer].setChromaSampleLocTypeTopField( m_chromaSampleLocTypeTopField );
    681     m_acTEncTop[layer].setChromaSampleLocTypeBottomField( m_chromaSampleLocTypeBottomField );
    682     m_acTEncTop[layer].setNeutralChromaIndicationFlag( m_neutralChromaIndicationFlag );
    683     m_acTEncTop[layer].setDefaultDisplayWindow( m_defDispWinLeftOffset, m_defDispWinRightOffset, m_defDispWinTopOffset, m_defDispWinBottomOffset );
    684     m_acTEncTop[layer].setFrameFieldInfoPresentFlag( m_frameFieldInfoPresentFlag );
    685     m_acTEncTop[layer].setPocProportionalToTimingFlag( m_pocProportionalToTimingFlag );
    686     m_acTEncTop[layer].setNumTicksPocDiffOneMinus1   ( m_numTicksPocDiffOneMinus1    );
    687     m_acTEncTop[layer].setBitstreamRestrictionFlag( m_bitstreamRestrictionFlag );
    688     m_acTEncTop[layer].setTilesFixedStructureFlag( m_tilesFixedStructureFlag );
    689     m_acTEncTop[layer].setMotionVectorsOverPicBoundariesFlag( m_motionVectorsOverPicBoundariesFlag );
    690     m_acTEncTop[layer].setMinSpatialSegmentationIdc( m_minSpatialSegmentationIdc );
    691     m_acTEncTop[layer].setMaxBytesPerPicDenom( m_maxBytesPerPicDenom );
    692     m_acTEncTop[layer].setMaxBitsPerMinCuDenom( m_maxBitsPerMinCuDenom );
    693     m_acTEncTop[layer].setLog2MaxMvLengthHorizontal( m_log2MaxMvLengthHorizontal );
    694     m_acTEncTop[layer].setLog2MaxMvLengthVertical( m_log2MaxMvLengthVertical );
    695     m_acTEncTop[layer].setElRapSliceTypeB(layer == 0? 0 : m_elRapSliceBEnabled);
     668    m_acTEncTop[layer].setUseRateCtrl                           ( m_acLayerCfg[layer].getRCEnableRateControl() );
     669    m_acTEncTop[layer].setTargetBitrate                         ( m_acLayerCfg[layer].getRCTargetBitrate() );
     670    m_acTEncTop[layer].setKeepHierBit                           ( m_acLayerCfg[layer].getRCKeepHierarchicalBit() );
     671    m_acTEncTop[layer].setLCULevelRC                            ( m_acLayerCfg[layer].getRCLCULevelRC() );
     672    m_acTEncTop[layer].setUseLCUSeparateModel                   ( m_acLayerCfg[layer].getRCUseLCUSeparateModel() );
     673    m_acTEncTop[layer].setInitialQP                             ( m_acLayerCfg[layer].getRCInitialQP() );
     674    m_acTEncTop[layer].setForceIntraQP                          ( m_acLayerCfg[layer].getRCForceIntraQP() );
     675#else
     676    m_acTEncTop[layer].setUseRateCtrl                           ( m_RCEnableRateControl );
     677    m_acTEncTop[layer].setTargetBitrate                         ( m_RCTargetBitrate );
     678    m_acTEncTop[layer].setKeepHierBit                           ( m_RCKeepHierarchicalBit );
     679    m_acTEncTop[layer].setLCULevelRC                            ( m_RCLCULevelRC );
     680    m_acTEncTop[layer].setUseLCUSeparateModel                   ( m_RCUseLCUSeparateModel );
     681    m_acTEncTop[layer].setInitialQP                             ( m_RCInitialQP );
     682    m_acTEncTop[layer].setForceIntraQP                          ( m_RCForceIntraQP );
     683#endif
     684    m_acTEncTop[layer].setTransquantBypassEnableFlag            ( m_TransquantBypassEnableFlag );
     685    m_acTEncTop[layer].setCUTransquantBypassFlagForceValue      ( m_CUTransquantBypassFlagForce );
     686    m_acTEncTop[layer].setCostMode                              ( m_costMode );
     687    m_acTEncTop[layer].setUseRecalculateQPAccordingToLambda     ( m_recalculateQPAccordingToLambda );
     688    m_acTEncTop[layer].setUseStrongIntraSmoothing               ( m_useStrongIntraSmoothing );
     689    m_acTEncTop[layer].setActiveParameterSetsSEIEnabled         ( m_activeParameterSetsSEIEnabled );
     690    m_acTEncTop[layer].setVuiParametersPresentFlag              ( m_vuiParametersPresentFlag );
     691    m_acTEncTop[layer].setAspectRatioInfoPresentFlag            ( m_aspectRatioInfoPresentFlag);
     692    m_acTEncTop[layer].setAspectRatioIdc                        ( m_aspectRatioIdc );
     693    m_acTEncTop[layer].setSarWidth                              ( m_sarWidth );
     694    m_acTEncTop[layer].setSarHeight                             ( m_sarHeight );
     695    m_acTEncTop[layer].setOverscanInfoPresentFlag               ( m_overscanInfoPresentFlag );
     696    m_acTEncTop[layer].setOverscanAppropriateFlag               ( m_overscanAppropriateFlag );
     697    m_acTEncTop[layer].setVideoSignalTypePresentFlag            ( m_videoSignalTypePresentFlag );
     698    m_acTEncTop[layer].setVideoFormat                           ( m_videoFormat );
     699    m_acTEncTop[layer].setVideoFullRangeFlag                    ( m_videoFullRangeFlag );
     700    m_acTEncTop[layer].setColourDescriptionPresentFlag          ( m_colourDescriptionPresentFlag );
     701    m_acTEncTop[layer].setColourPrimaries                       ( m_colourPrimaries );
     702    m_acTEncTop[layer].setTransferCharacteristics               ( m_transferCharacteristics );
     703    m_acTEncTop[layer].setMatrixCoefficients                    ( m_matrixCoefficients );
     704    m_acTEncTop[layer].setChromaLocInfoPresentFlag              ( m_chromaLocInfoPresentFlag );
     705    m_acTEncTop[layer].setChromaSampleLocTypeTopField           ( m_chromaSampleLocTypeTopField );
     706    m_acTEncTop[layer].setChromaSampleLocTypeBottomField        ( m_chromaSampleLocTypeBottomField );
     707    m_acTEncTop[layer].setNeutralChromaIndicationFlag           ( m_neutralChromaIndicationFlag );
     708    m_acTEncTop[layer].setDefaultDisplayWindow                  ( m_defDispWinLeftOffset, m_defDispWinRightOffset, m_defDispWinTopOffset, m_defDispWinBottomOffset );
     709    m_acTEncTop[layer].setFrameFieldInfoPresentFlag             ( m_frameFieldInfoPresentFlag );
     710    m_acTEncTop[layer].setPocProportionalToTimingFlag           ( m_pocProportionalToTimingFlag );
     711    m_acTEncTop[layer].setNumTicksPocDiffOneMinus1              ( m_numTicksPocDiffOneMinus1    );
     712    m_acTEncTop[layer].setBitstreamRestrictionFlag              ( m_bitstreamRestrictionFlag );
     713    m_acTEncTop[layer].setTilesFixedStructureFlag               ( m_tilesFixedStructureFlag );
     714    m_acTEncTop[layer].setMotionVectorsOverPicBoundariesFlag    ( m_motionVectorsOverPicBoundariesFlag );
     715    m_acTEncTop[layer].setMinSpatialSegmentationIdc             ( m_minSpatialSegmentationIdc );
     716    m_acTEncTop[layer].setMaxBytesPerPicDenom                   ( m_maxBytesPerPicDenom );
     717    m_acTEncTop[layer].setMaxBitsPerMinCuDenom                  ( m_maxBitsPerMinCuDenom );
     718    m_acTEncTop[layer].setLog2MaxMvLengthHorizontal             ( m_log2MaxMvLengthHorizontal );
     719    m_acTEncTop[layer].setLog2MaxMvLengthVertical               ( m_log2MaxMvLengthVertical );
     720    m_acTEncTop[layer].setElRapSliceTypeB                       (layer == 0? 0 : m_elRapSliceBEnabled);
    696721    if( layer > 0 )
    697722    {
     
    706731#endif
    707732#endif
    708       m_acTEncTop[layer].setNumScaledRefLayerOffsets( m_acLayerCfg[layer].m_numScaledRefLayerOffsets );
     733      m_acTEncTop[layer].setNumScaledRefLayerOffsets            ( m_acLayerCfg[layer].m_numScaledRefLayerOffsets );
    709734      for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++)
    710735      {
    711736#if O0098_SCALED_REF_LAYER_ID
    712         m_acTEncTop[layer].setScaledRefLayerId(i, m_acLayerCfg[layer].m_scaledRefLayerId[i]);
     737        m_acTEncTop[layer].setScaledRefLayerId                  (i, m_acLayerCfg[layer].m_scaledRefLayerId[i]);
    713738#endif
    714739#if REF_REGION_OFFSET
    715         m_acTEncTop[layer].setScaledRefLayerOffsetPresentFlag( i, m_acLayerCfg[layer].m_scaledRefLayerOffsetPresentFlag[i] );
    716         m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow( subWidthC  * m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], subWidthC  * m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
    717                                                                  subHeightC * m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i],  subHeightC * m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i]);
     740        m_acTEncTop[layer].setScaledRefLayerOffsetPresentFlag   ( i, m_acLayerCfg[layer].m_scaledRefLayerOffsetPresentFlag[i] );
     741        m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow ( subWidthC  * m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], subWidthC  * m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
     742                                                                  subHeightC * m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i],  subHeightC * m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i]);
    718743#else
    719744#if P0312_VERT_PHASE_ADJ
    720         m_acTEncTop[layer].setVertPhasePositionEnableFlag( i, m_acLayerCfg[layer].m_vertPhasePositionEnableFlag[i] );
    721         m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
    722                                                   2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i], m_acLayerCfg[layer].m_vertPhasePositionEnableFlag[i] );
    723 #else
    724         m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
    725                                                   2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i]);
     745        m_acTEncTop[layer].setVertPhasePositionEnableFlag       ( i, m_acLayerCfg[layer].m_vertPhasePositionEnableFlag[i] );
     746        m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow ( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
     747                                                                  2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i], m_acLayerCfg[layer].m_vertPhasePositionEnableFlag[i] );
     748#else
     749        m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow ( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
     750                                                                  2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i]);
    726751#endif
    727752#endif
    728753#if R0209_GENERIC_PHASE
    729         m_acTEncTop[layer].setResamplePhaseSetPresentFlag( i, m_acLayerCfg[layer].m_resamplePhaseSetPresentFlag[i] );
    730         m_acTEncTop[layer].setPhaseHorLuma( i, m_acLayerCfg[layer].m_phaseHorLuma[i] );
    731         m_acTEncTop[layer].setPhaseVerLuma( i, m_acLayerCfg[layer].m_phaseVerLuma[i] );
    732         m_acTEncTop[layer].setPhaseHorChroma( i, m_acLayerCfg[layer].m_phaseHorChroma[i] );
    733         m_acTEncTop[layer].setPhaseVerChroma( i, m_acLayerCfg[layer].m_phaseVerChroma[i] );
     754        m_acTEncTop[layer].setResamplePhaseSetPresentFlag       ( i, m_acLayerCfg[layer].m_resamplePhaseSetPresentFlag[i] );
     755        m_acTEncTop[layer].setPhaseHorLuma                      ( i, m_acLayerCfg[layer].m_phaseHorLuma[i] );
     756        m_acTEncTop[layer].setPhaseVerLuma                      ( i, m_acLayerCfg[layer].m_phaseVerLuma[i] );
     757        m_acTEncTop[layer].setPhaseHorChroma                    ( i, m_acLayerCfg[layer].m_phaseHorChroma[i] );
     758        m_acTEncTop[layer].setPhaseVerChroma                    ( i, m_acLayerCfg[layer].m_phaseVerChroma[i] );
    734759#endif
    735760      }
    736761    }
    737762#if M0040_ADAPTIVE_RESOLUTION_CHANGE
    738     m_acTEncTop[layer].setAdaptiveResolutionChange( m_adaptiveResolutionChange );
     763    m_acTEncTop[layer].setAdaptiveResolutionChange               ( m_adaptiveResolutionChange );
    739764#endif
    740765#if AUXILIARY_PICTURES
    741     m_acTEncTop[layer].setChromaFormatIDC( m_acLayerCfg[layer].m_chromaFormatIDC );
     766    m_acTEncTop[layer].setChromaFormatIDC                        ( m_acLayerCfg[layer].m_chromaFormatIDC );
    742767#endif
    743768#if O0153_ALT_OUTPUT_LAYER_FLAG
    744     m_acTEncTop[layer].setAltOuputLayerFlag( m_altOutputLayerFlag );
     769    m_acTEncTop[layer].setAltOuputLayerFlag                      ( m_altOutputLayerFlag );
    745770#endif
    746771#if O0149_CROSS_LAYER_BLA_FLAG
    747     m_acTEncTop[layer].setCrossLayerBLAFlag( m_crossLayerBLAFlag );
     772    m_acTEncTop[layer].setCrossLayerBLAFlag                      ( m_crossLayerBLAFlag );
    748773#endif
    749774#if Q0048_CGS_3D_ASYMLUT
    750     m_acTEncTop[layer].setCGSFlag( layer == 0 ? 0 : m_nCGSFlag );
    751     m_acTEncTop[layer].setCGSMaxOctantDepth( m_nCGSMaxOctantDepth );
    752     m_acTEncTop[layer].setCGSMaxYPartNumLog2( m_nCGSMaxYPartNumLog2 );
    753     m_acTEncTop[layer].setCGSLUTBit( m_nCGSLUTBit );
     775    m_acTEncTop[layer].setCGSFlag                                ( layer == 0 ? 0 : m_nCGSFlag );
     776    m_acTEncTop[layer].setCGSMaxOctantDepth                      ( m_nCGSMaxOctantDepth );
     777    m_acTEncTop[layer].setCGSMaxYPartNumLog2                     ( m_nCGSMaxYPartNumLog2 );
     778    m_acTEncTop[layer].setCGSLUTBit                              ( m_nCGSLUTBit );
    754779#if R0151_CGS_3D_ASYMLUT_IMPROVE
    755     m_acTEncTop[layer].setCGSAdaptChroma( m_nCGSAdaptiveChroma );
     780    m_acTEncTop[layer].setCGSAdaptChroma                         ( m_nCGSAdaptiveChroma );
    756781#endif
    757782#if R0179_ENC_OPT_3DLUT_SIZE
    758     m_acTEncTop[layer].setCGSLutSizeRDO( m_nCGSLutSizeRDO );
     783    m_acTEncTop[layer].setCGSLutSizeRDO                          ( m_nCGSLutSizeRDO );
    759784#endif
    760785#endif
    761786#if Q0078_ADD_LAYER_SETS
    762     m_acTEncTop[layer].setNumAddLayerSets( m_numAddLayerSets );
     787    m_acTEncTop[layer].setNumAddLayerSets                        ( m_numAddLayerSets );
    763788#endif
    764789  }
     
    769794  TComVPS vps;
    770795
    771   vps.setMaxTLayers                       ( m_maxTempLayer );
     796  vps.setMaxTLayers                                               ( m_maxTempLayer );
    772797  if (m_maxTempLayer == 1)
    773798  {
    774799    vps.setTemporalNestingFlag(true);
    775800  }
    776   vps.setMaxLayers                        ( 1 );
     801  vps.setMaxLayers                                                ( 1 );
    777802  for(Int i = 0; i < MAX_TLAYER; i++)
    778803  {
    779     vps.setNumReorderPics                 ( m_numReorderPics[i], i );
    780     vps.setMaxDecPicBuffering             ( m_maxDecPicBuffering[i], i );
     804    vps.setNumReorderPics                                         ( m_numReorderPics[i], i );
     805    vps.setMaxDecPicBuffering                                     ( m_maxDecPicBuffering[i], i );
    781806  }
    782807  m_cTEncTop.setVPS(&vps);
    783808
    784   m_cTEncTop.setProfile(m_profile);
    785   m_cTEncTop.setLevel(m_levelTier, m_level);
    786   m_cTEncTop.setProgressiveSourceFlag(m_progressiveSourceFlag);
    787   m_cTEncTop.setInterlacedSourceFlag(m_interlacedSourceFlag);
    788   m_cTEncTop.setNonPackedConstraintFlag(m_nonPackedConstraintFlag);
    789   m_cTEncTop.setFrameOnlyConstraintFlag(m_frameOnlyConstraintFlag);
    790 
    791   m_cTEncTop.setFrameRate                    ( m_iFrameRate );
    792   m_cTEncTop.setFrameSkip                    ( m_FrameSkip );
    793   m_cTEncTop.setSourceWidth                  ( m_iSourceWidth );
    794   m_cTEncTop.setSourceHeight                 ( m_iSourceHeight );
    795   m_cTEncTop.setConformanceWindow            ( m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom );
    796   m_cTEncTop.setFramesToBeEncoded            ( m_framesToBeEncoded );
     809  m_cTEncTop.setProfile                                           ( m_profile);
     810  m_cTEncTop.setLevel                                             ( m_levelTier, m_level);
     811  m_cTEncTop.setProgressiveSourceFlag                             ( m_progressiveSourceFlag);
     812  m_cTEncTop.setInterlacedSourceFlag                              ( m_interlacedSourceFlag);
     813  m_cTEncTop.setNonPackedConstraintFlag                           ( m_nonPackedConstraintFlag);
     814  m_cTEncTop.setFrameOnlyConstraintFlag                           ( m_frameOnlyConstraintFlag);
     815  m_cTEncTop.setBitDepthConstraintValue                           ( m_bitDepthConstraint );
     816  m_cTEncTop.setChromaFormatConstraintValue                       ( m_chromaFormatConstraint );
     817  m_cTEncTop.setIntraConstraintFlag                               ( m_intraConstraintFlag );
     818  m_cTEncTop.setLowerBitRateConstraintFlag                        ( m_lowerBitRateConstraintFlag );
     819
     820  m_cTEncTop.setPrintMSEBasedSequencePSNR                         ( m_printMSEBasedSequencePSNR);
     821  m_cTEncTop.setPrintFrameMSE                                     ( m_printFrameMSE);
     822  m_cTEncTop.setPrintSequenceMSE                                  ( m_printSequenceMSE);
     823  m_cTEncTop.setCabacZeroWordPaddingEnabled                       ( m_cabacZeroWordPaddingEnabled );
     824
     825  m_cTEncTop.setFrameRate                                         ( m_iFrameRate );
     826  m_cTEncTop.setFrameSkip                                         ( m_FrameSkip );
     827  m_cTEncTop.setSourceWidth                                       ( m_iSourceWidth );
     828  m_cTEncTop.setSourceHeight                                      ( m_iSourceHeight );
     829  m_cTEncTop.setConformanceWindow                                 ( m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom );
     830  m_cTEncTop.setFramesToBeEncoded                                 ( m_framesToBeEncoded );
    797831
    798832  //====== Coding Structure ========
    799   m_cTEncTop.setIntraPeriod                  ( m_iIntraPeriod );
    800   m_cTEncTop.setDecodingRefreshType          ( m_iDecodingRefreshType );
    801   m_cTEncTop.setGOPSize                      ( m_iGOPSize );
    802   m_cTEncTop.setGopList                      ( m_GOPList );
    803   m_cTEncTop.setExtraRPSs                    ( m_extraRPSs );
     833  m_cTEncTop.setIntraPeriod                                       ( m_iIntraPeriod );
     834  m_cTEncTop.setDecodingRefreshType                               ( m_iDecodingRefreshType );
     835  m_cTEncTop.setGOPSize                                           ( m_iGOPSize );
     836  m_cTEncTop.setGopList                                           ( m_GOPList );
     837  m_cTEncTop.setExtraRPSs                                         ( m_extraRPSs );
    804838  for(Int i = 0; i < MAX_TLAYER; i++)
    805839  {
    806     m_cTEncTop.setNumReorderPics             ( m_numReorderPics[i], i );
    807     m_cTEncTop.setMaxDecPicBuffering         ( m_maxDecPicBuffering[i], i );
     840    m_cTEncTop.setNumReorderPics                                  ( m_numReorderPics[i], i );
     841    m_cTEncTop.setMaxDecPicBuffering                              ( m_maxDecPicBuffering[i], i );
    808842  }
    809843  for( UInt uiLoop = 0; uiLoop < MAX_TLAYER; ++uiLoop )
    810844  {
    811     m_cTEncTop.setLambdaModifier( uiLoop, m_adLambdaModifier[ uiLoop ] );
    812   }
    813   m_cTEncTop.setQP                           ( m_iQP );
    814 
    815   m_cTEncTop.setPad                          ( m_aiPad );
    816 
    817   m_cTEncTop.setMaxTempLayer                 ( m_maxTempLayer );
     845    m_cTEncTop.setLambdaModifier                                  ( uiLoop, m_adLambdaModifier[ uiLoop ] );
     846  }
     847  m_cTEncTop.setQP                                                ( m_iQP );
     848
     849  m_cTEncTop.setPad                                               ( m_aiPad );
     850
     851  m_cTEncTop.setMaxTempLayer                                      ( m_maxTempLayer );
    818852  m_cTEncTop.setUseAMP( m_enableAMP );
    819853
     
    821855
    822856  //====== Loop/Deblock Filter ========
    823   m_cTEncTop.setLoopFilterDisable            ( m_bLoopFilterDisable       );
    824   m_cTEncTop.setLoopFilterOffsetInPPS        ( m_loopFilterOffsetInPPS );
    825   m_cTEncTop.setLoopFilterBetaOffset         ( m_loopFilterBetaOffsetDiv2  );
    826   m_cTEncTop.setLoopFilterTcOffset           ( m_loopFilterTcOffsetDiv2    );
    827   m_cTEncTop.setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent);
    828   m_cTEncTop.setDeblockingFilterMetric       ( m_DeblockingFilterMetric );
     857  m_cTEncTop.setLoopFilterDisable                                 ( m_bLoopFilterDisable       );
     858  m_cTEncTop.setLoopFilterOffsetInPPS                             ( m_loopFilterOffsetInPPS );
     859  m_cTEncTop.setLoopFilterBetaOffset                              ( m_loopFilterBetaOffsetDiv2  );
     860  m_cTEncTop.setLoopFilterTcOffset                                ( m_loopFilterTcOffsetDiv2    );
     861  m_cTEncTop.setDeblockingFilterControlPresent                    ( m_DeblockingFilterControlPresent);
     862  m_cTEncTop.setDeblockingFilterMetric                            ( m_DeblockingFilterMetric );
    829863
    830864  //====== Motion search ========
    831   m_cTEncTop.setFastSearch                   ( m_iFastSearch  );
    832   m_cTEncTop.setSearchRange                  ( m_iSearchRange );
    833   m_cTEncTop.setBipredSearchRange            ( m_bipredSearchRange );
     865  m_cTEncTop.setFastSearch                                        ( m_iFastSearch  );
     866  m_cTEncTop.setSearchRange                                       ( m_iSearchRange );
     867  m_cTEncTop.setBipredSearchRange                                 ( m_bipredSearchRange );
    834868
    835869  //====== Quality control ========
    836   m_cTEncTop.setMaxDeltaQP                   ( m_iMaxDeltaQP  );
    837   m_cTEncTop.setMaxCuDQPDepth                ( m_iMaxCuDQPDepth  );
    838 
    839   m_cTEncTop.setChromaCbQpOffset               ( m_cbQpOffset     );
    840   m_cTEncTop.setChromaCrQpOffset            ( m_crQpOffset  );
     870  m_cTEncTop.setMaxDeltaQP                                        ( m_iMaxDeltaQP  );
     871  m_cTEncTop.setMaxCuDQPDepth                                     ( m_iMaxCuDQPDepth  );
     872  m_cTEncTop.setMaxCUChromaQpAdjustmentDepth                      ( m_maxCUChromaQpAdjustmentDepth );
     873  m_cTEncTop.setChromaCbQpOffset                                  ( m_cbQpOffset     );
     874  m_cTEncTop.setChromaCrQpOffset                                  ( m_crQpOffset  );
     875
     876  m_cTEncTop.setChromaFormatIdc                                   ( m_chromaFormatIDC  );
    841877
    842878#if ADAPTIVE_QP_SELECTION
    843   m_cTEncTop.setUseAdaptQpSelect             ( m_bUseAdaptQpSelect   );
    844 #endif
    845 
    846   m_cTEncTop.setUseAdaptiveQP                ( m_bUseAdaptiveQP  );
    847   m_cTEncTop.setQPAdaptationRange            ( m_iQPAdaptationRange );
    848 
     879  m_cTEncTop.setUseAdaptQpSelect                                  ( m_bUseAdaptQpSelect   );
     880#endif
     881
     882  m_cTEncTop.setUseAdaptiveQP                                     ( m_bUseAdaptiveQP  );
     883  m_cTEncTop.setQPAdaptationRange                                 ( m_iQPAdaptationRange );
     884  m_cTEncTop.setUseExtendedPrecision                              ( m_useExtendedPrecision );
     885  m_cTEncTop.setUseHighPrecisionPredictionWeighting               ( m_useHighPrecisionPredictionWeighting );
    849886  //====== Tool list ========
    850   m_cTEncTop.setDeltaQpRD                    ( m_uiDeltaQpRD  );
    851   m_cTEncTop.setUseASR                       ( m_bUseASR      );
    852   m_cTEncTop.setUseHADME                     ( m_bUseHADME    );
    853   m_cTEncTop.setdQPs                         ( m_aidQP        );
    854   m_cTEncTop.setUseRDOQ                      ( m_useRDOQ     );
    855   m_cTEncTop.setUseRDOQTS                    ( m_useRDOQTS   );
    856   m_cTEncTop.setRDpenalty                 ( m_rdPenalty );
    857   m_cTEncTop.setQuadtreeTULog2MaxSize        ( m_uiQuadtreeTULog2MaxSize );
    858   m_cTEncTop.setQuadtreeTULog2MinSize        ( m_uiQuadtreeTULog2MinSize );
    859   m_cTEncTop.setQuadtreeTUMaxDepthInter      ( m_uiQuadtreeTUMaxDepthInter );
    860   m_cTEncTop.setQuadtreeTUMaxDepthIntra      ( m_uiQuadtreeTUMaxDepthIntra );
    861   m_cTEncTop.setUseFastEnc                   ( m_bUseFastEnc  );
    862   m_cTEncTop.setUseEarlyCU                   ( m_bUseEarlyCU  );
    863   m_cTEncTop.setUseFastDecisionForMerge      ( m_useFastDecisionForMerge  );
    864   m_cTEncTop.setUseCbfFastMode            ( m_bUseCbfFastMode  );
    865   m_cTEncTop.setUseEarlySkipDetection            ( m_useEarlySkipDetection );
     887  m_cTEncTop.setDeltaQpRD                                         ( m_uiDeltaQpRD  );
     888  m_cTEncTop.setUseASR                                            ( m_bUseASR      );
     889  m_cTEncTop.setUseHADME                                          ( m_bUseHADME    );
     890  m_cTEncTop.setdQPs                                              ( m_aidQP        );
     891  m_cTEncTop.setUseRDOQ                                           ( m_useRDOQ     );
     892  m_cTEncTop.setUseRDOQTS                                         ( m_useRDOQTS   );
     893  m_cTEncTop.setRDpenalty                                         ( m_rdPenalty );
     894  m_cTEncTop.setQuadtreeTULog2MaxSize                             ( m_uiQuadtreeTULog2MaxSize );
     895  m_cTEncTop.setQuadtreeTULog2MinSize                             ( m_uiQuadtreeTULog2MinSize );
     896  m_cTEncTop.setQuadtreeTUMaxDepthInter                           ( m_uiQuadtreeTUMaxDepthInter );
     897  m_cTEncTop.setQuadtreeTUMaxDepthIntra                           ( m_uiQuadtreeTUMaxDepthIntra );
     898  m_cTEncTop.setUseFastEnc                                        ( m_bUseFastEnc  );
     899  m_cTEncTop.setUseEarlyCU                                        ( m_bUseEarlyCU  );
     900  m_cTEncTop.setUseFastDecisionForMerge                           ( m_useFastDecisionForMerge  );
     901  m_cTEncTop.setUseCbfFastMode                                    ( m_bUseCbfFastMode  );
     902  m_cTEncTop.setUseEarlySkipDetection                             ( m_useEarlySkipDetection );
    866903#if FAST_INTRA_SHVC
    867   m_cTEncTop.setUseFastIntraScalable            ( m_useFastIntraScalable );
    868 #endif
    869 
    870   m_cTEncTop.setUseTransformSkip             ( m_useTransformSkip      );
    871   m_cTEncTop.setUseTransformSkipFast         ( m_useTransformSkipFast  );
    872   m_cTEncTop.setUseConstrainedIntraPred      ( m_bUseConstrainedIntraPred );
    873   m_cTEncTop.setPCMLog2MinSize          ( m_uiPCMLog2MinSize);
    874   m_cTEncTop.setUsePCM                       ( m_usePCM );
    875   m_cTEncTop.setPCMLog2MaxSize               ( m_pcmLog2MaxSize);
    876   m_cTEncTop.setMaxNumMergeCand              ( m_maxNumMergeCand );
     904  m_cTEncTop.setUseFastIntraScalable                              ( m_useFastIntraScalable );
     905#endif
     906  m_cTEncTop.setUseCrossComponentPrediction                       ( m_useCrossComponentPrediction );
     907  m_cTEncTop.setUseReconBasedCrossCPredictionEstimate             ( m_reconBasedCrossCPredictionEstimate );
     908  m_cTEncTop.setSaoOffsetBitShift                                 ( CHANNEL_TYPE_LUMA  , m_saoOffsetBitShift[CHANNEL_TYPE_LUMA]   );
     909  m_cTEncTop.setSaoOffsetBitShift                                 ( CHANNEL_TYPE_CHROMA, m_saoOffsetBitShift[CHANNEL_TYPE_CHROMA] );
     910  m_cTEncTop.setUseTransformSkip                                  ( m_useTransformSkip      );
     911  m_cTEncTop.setUseTransformSkipFast                              ( m_useTransformSkipFast  );
     912  m_cTEncTop.setUseResidualRotation                               ( m_useResidualRotation   );
     913  m_cTEncTop.setUseSingleSignificanceMapContext                   ( m_useSingleSignificanceMapContext   );
     914  m_cTEncTop.setUseGolombRiceParameterAdaptation                  ( m_useGolombRiceParameterAdaptation );
     915  m_cTEncTop.setAlignCABACBeforeBypass                            ( m_alignCABACBeforeBypass );
     916  m_cTEncTop.setTransformSkipLog2MaxSize                          ( m_transformSkipLog2MaxSize  );
     917  for (UInt signallingModeIndex = 0; signallingModeIndex < NUMBER_OF_RDPCM_SIGNALLING_MODES; signallingModeIndex++)
     918  {
     919    m_cTEncTop.setUseResidualDPCM                                 ( RDPCMSignallingMode(signallingModeIndex), m_useResidualDPCM[signallingModeIndex]);
     920  }
     921  m_cTEncTop.setUseConstrainedIntraPred                           ( m_bUseConstrainedIntraPred );
     922  m_cTEncTop.setPCMLog2MinSize                                    ( m_uiPCMLog2MinSize);
     923  m_cTEncTop.setUsePCM                                            ( m_usePCM );
     924  m_cTEncTop.setPCMLog2MaxSize                                    ( m_pcmLog2MaxSize);
     925  m_cTEncTop.setMaxNumMergeCand                                   ( m_maxNumMergeCand );
    877926
    878927
    879928  //====== Weighted Prediction ========
    880   m_cTEncTop.setUseWP                   ( m_useWeightedPred      );
    881   m_cTEncTop.setWPBiPred                ( m_useWeightedBiPred   );
     929  m_cTEncTop.setUseWP                                             ( m_useWeightedPred      );
     930  m_cTEncTop.setWPBiPred                                          ( m_useWeightedBiPred   );
    882931  //====== Parallel Merge Estimation ========
    883   m_cTEncTop.setLog2ParallelMergeLevelMinus2 ( m_log2ParallelMergeLevel - 2 );
     932  m_cTEncTop.setLog2ParallelMergeLevelMinus2                      ( m_log2ParallelMergeLevel - 2 );
    884933
    885934  //====== Slice ========
    886   m_cTEncTop.setSliceMode               ( m_sliceMode                );
    887   m_cTEncTop.setSliceArgument           ( m_sliceArgument            );
     935  m_cTEncTop.setSliceMode                                         ( (SliceConstraint) m_sliceMode );
     936  m_cTEncTop.setSliceArgument                                     ( m_sliceArgument            );
    888937
    889938  //====== Dependent Slice ========
    890   m_cTEncTop.setSliceSegmentMode        ( m_sliceSegmentMode         );
    891   m_cTEncTop.setSliceSegmentArgument    ( m_sliceSegmentArgument     );
    892   Int iNumPartInCU = 1<<(m_uiMaxCUDepth<<1);
    893   if(m_sliceSegmentMode==FIXED_NUMBER_OF_LCU)
    894   {
    895     m_cTEncTop.setSliceSegmentArgument ( m_sliceSegmentArgument * iNumPartInCU );
    896   }
    897   if(m_sliceMode==FIXED_NUMBER_OF_LCU)
    898   {
    899     m_cTEncTop.setSliceArgument ( m_sliceArgument * iNumPartInCU );
    900   }
    901   if(m_sliceMode==FIXED_NUMBER_OF_TILES)
    902   {
    903     m_cTEncTop.setSliceArgument ( m_sliceArgument );
    904   }
    905 
    906   if(m_sliceMode == 0 )
     939  m_cTEncTop.setSliceSegmentMode                                  (  (SliceConstraint) m_sliceSegmentMode );
     940  m_cTEncTop.setSliceSegmentArgument                              ( m_sliceSegmentArgument     );
     941
     942  if(m_sliceMode == NO_SLICES )
    907943  {
    908944    m_bLFCrossSliceBoundaryFlag = true;
    909945  }
    910   m_cTEncTop.setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag );
    911   m_cTEncTop.setUseSAO ( m_bUseSAO );
    912   m_cTEncTop.setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic);
    913 
    914   m_cTEncTop.setSaoLcuBoundary (m_saoLcuBoundary);
    915   m_cTEncTop.setPCMInputBitDepthFlag  ( m_bPCMInputBitDepthFlag);
    916   m_cTEncTop.setPCMFilterDisableFlag  ( m_bPCMFilterDisableFlag);
    917 
    918   m_cTEncTop.setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled);
    919   m_cTEncTop.setRecoveryPointSEIEnabled( m_recoveryPointSEIEnabled );
    920   m_cTEncTop.setBufferingPeriodSEIEnabled( m_bufferingPeriodSEIEnabled );
    921   m_cTEncTop.setPictureTimingSEIEnabled( m_pictureTimingSEIEnabled );
    922   m_cTEncTop.setToneMappingInfoSEIEnabled                 ( m_toneMappingInfoSEIEnabled );
    923   m_cTEncTop.setTMISEIToneMapId                           ( m_toneMapId );
    924   m_cTEncTop.setTMISEIToneMapCancelFlag                   ( m_toneMapCancelFlag );
    925   m_cTEncTop.setTMISEIToneMapPersistenceFlag              ( m_toneMapPersistenceFlag );
    926   m_cTEncTop.setTMISEICodedDataBitDepth                   ( m_toneMapCodedDataBitDepth );
    927   m_cTEncTop.setTMISEITargetBitDepth                      ( m_toneMapTargetBitDepth );
    928   m_cTEncTop.setTMISEIModelID                             ( m_toneMapModelId );
    929   m_cTEncTop.setTMISEIMinValue                            ( m_toneMapMinValue );
    930   m_cTEncTop.setTMISEIMaxValue                            ( m_toneMapMaxValue );
    931   m_cTEncTop.setTMISEISigmoidMidpoint                     ( m_sigmoidMidpoint );
    932   m_cTEncTop.setTMISEISigmoidWidth                        ( m_sigmoidWidth );
    933   m_cTEncTop.setTMISEIStartOfCodedInterva                 ( m_startOfCodedInterval );
    934   m_cTEncTop.setTMISEINumPivots                           ( m_numPivots );
    935   m_cTEncTop.setTMISEICodedPivotValue                     ( m_codedPivotValue );
    936   m_cTEncTop.setTMISEITargetPivotValue                    ( m_targetPivotValue );
    937   m_cTEncTop.setTMISEICameraIsoSpeedIdc                   ( m_cameraIsoSpeedIdc );
    938   m_cTEncTop.setTMISEICameraIsoSpeedValue                 ( m_cameraIsoSpeedValue );
    939   m_cTEncTop.setTMISEIExposureIndexIdc                    ( m_exposureIndexIdc );
    940   m_cTEncTop.setTMISEIExposureIndexValue                  ( m_exposureIndexValue );
    941   m_cTEncTop.setTMISEIExposureCompensationValueSignFlag   ( m_exposureCompensationValueSignFlag );
    942   m_cTEncTop.setTMISEIExposureCompensationValueNumerator  ( m_exposureCompensationValueNumerator );
    943   m_cTEncTop.setTMISEIExposureCompensationValueDenomIdc   ( m_exposureCompensationValueDenomIdc );
    944   m_cTEncTop.setTMISEIRefScreenLuminanceWhite             ( m_refScreenLuminanceWhite );
    945   m_cTEncTop.setTMISEIExtendedRangeWhiteLevel             ( m_extendedRangeWhiteLevel );
    946   m_cTEncTop.setTMISEINominalBlackLevelLumaCodeValue      ( m_nominalBlackLevelLumaCodeValue );
    947   m_cTEncTop.setTMISEINominalWhiteLevelLumaCodeValue      ( m_nominalWhiteLevelLumaCodeValue );
    948   m_cTEncTop.setTMISEIExtendedWhiteLevelLumaCodeValue     ( m_extendedWhiteLevelLumaCodeValue );
    949 #if P0050_KNEE_FUNCTION_SEI
    950   m_cTEncTop.setKneeSEIEnabled              ( m_kneeSEIEnabled );
    951   m_cTEncTop.setKneeSEIId                   ( m_kneeSEIId );
    952   m_cTEncTop.setKneeSEICancelFlag           ( m_kneeSEICancelFlag );
    953   m_cTEncTop.setKneeSEIPersistenceFlag      ( m_kneeSEIPersistenceFlag );
    954   m_cTEncTop.setKneeSEIMappingFlag          ( m_kneeSEIMappingFlag );
    955   m_cTEncTop.setKneeSEIInputDrange          ( m_kneeSEIInputDrange );
    956   m_cTEncTop.setKneeSEIInputDispLuminance   ( m_kneeSEIInputDispLuminance );
    957   m_cTEncTop.setKneeSEIOutputDrange         ( m_kneeSEIOutputDrange );
    958   m_cTEncTop.setKneeSEIOutputDispLuminance  ( m_kneeSEIOutputDispLuminance );
    959   m_cTEncTop.setKneeSEINumKneePointsMinus1  ( m_kneeSEINumKneePointsMinus1 );
    960   m_cTEncTop.setKneeSEIInputKneePoint       ( m_kneeSEIInputKneePoint );
    961   m_cTEncTop.setKneeSEIOutputKneePoint      ( m_kneeSEIOutputKneePoint );
    962 #endif
     946  m_cTEncTop.setLFCrossSliceBoundaryFlag                          ( m_bLFCrossSliceBoundaryFlag );
     947  m_cTEncTop.setUseSAO                                            ( m_bUseSAO );
     948  m_cTEncTop.setMaxNumOffsetsPerPic                               ( m_maxNumOffsetsPerPic);
     949
     950  m_cTEncTop.setSaoCtuBoundary                                    ( m_saoCtuBoundary);
     951  m_cTEncTop.setPCMInputBitDepthFlag                              ( m_bPCMInputBitDepthFlag);
     952  m_cTEncTop.setPCMFilterDisableFlag                              ( m_bPCMFilterDisableFlag);
     953
     954  m_cTEncTop.setDisableIntraReferenceSmoothing                    (!m_enableIntraReferenceSmoothing );
     955  m_cTEncTop.setDecodedPictureHashSEIEnabled                      ( m_decodedPictureHashSEIEnabled );
     956  m_cTEncTop.setRecoveryPointSEIEnabled                           ( m_recoveryPointSEIEnabled );
     957  m_cTEncTop.setBufferingPeriodSEIEnabled                         ( m_bufferingPeriodSEIEnabled );
     958  m_cTEncTop.setPictureTimingSEIEnabled                           ( m_pictureTimingSEIEnabled );
     959  m_cTEncTop.setToneMappingInfoSEIEnabled                         ( m_toneMappingInfoSEIEnabled );
     960  m_cTEncTop.setTMISEIToneMapId                                   ( m_toneMapId );
     961  m_cTEncTop.setTMISEIToneMapCancelFlag                           ( m_toneMapCancelFlag );
     962  m_cTEncTop.setTMISEIToneMapPersistenceFlag                      ( m_toneMapPersistenceFlag );
     963  m_cTEncTop.setTMISEICodedDataBitDepth                           ( m_toneMapCodedDataBitDepth );
     964  m_cTEncTop.setTMISEITargetBitDepth                              ( m_toneMapTargetBitDepth );
     965  m_cTEncTop.setTMISEIModelID                                     ( m_toneMapModelId );
     966  m_cTEncTop.setTMISEIMinValue                                    ( m_toneMapMinValue );
     967  m_cTEncTop.setTMISEIMaxValue                                    ( m_toneMapMaxValue );
     968  m_cTEncTop.setTMISEISigmoidMidpoint                             ( m_sigmoidMidpoint );
     969  m_cTEncTop.setTMISEISigmoidWidth                                ( m_sigmoidWidth );
     970  m_cTEncTop.setTMISEIStartOfCodedInterva                         ( m_startOfCodedInterval );
     971  m_cTEncTop.setTMISEINumPivots                                   ( m_numPivots );
     972  m_cTEncTop.setTMISEICodedPivotValue                             ( m_codedPivotValue );
     973  m_cTEncTop.setTMISEITargetPivotValue                            ( m_targetPivotValue );
     974  m_cTEncTop.setTMISEICameraIsoSpeedIdc                           ( m_cameraIsoSpeedIdc );
     975  m_cTEncTop.setTMISEICameraIsoSpeedValue                         ( m_cameraIsoSpeedValue );
     976  m_cTEncTop.setTMISEIExposureIndexIdc                            ( m_exposureIndexIdc );
     977  m_cTEncTop.setTMISEIExposureIndexValue                          ( m_exposureIndexValue );
     978  m_cTEncTop.setTMISEIExposureCompensationValueSignFlag           ( m_exposureCompensationValueSignFlag );
     979  m_cTEncTop.setTMISEIExposureCompensationValueNumerator          ( m_exposureCompensationValueNumerator );
     980  m_cTEncTop.setTMISEIExposureCompensationValueDenomIdc           ( m_exposureCompensationValueDenomIdc );
     981  m_cTEncTop.setTMISEIRefScreenLuminanceWhite                     ( m_refScreenLuminanceWhite );
     982  m_cTEncTop.setTMISEIExtendedRangeWhiteLevel                     ( m_extendedRangeWhiteLevel );
     983  m_cTEncTop.setTMISEINominalBlackLevelLumaCodeValue              ( m_nominalBlackLevelLumaCodeValue );
     984  m_cTEncTop.setTMISEINominalWhiteLevelLumaCodeValue              ( m_nominalWhiteLevelLumaCodeValue );
     985  m_cTEncTop.setTMISEIExtendedWhiteLevelLumaCodeValue             ( m_extendedWhiteLevelLumaCodeValue );
     986  m_cTEncTop.setChromaSamplingFilterHintEnabled                   ( m_chromaSamplingFilterSEIenabled );
     987  m_cTEncTop.setChromaSamplingHorFilterIdc                        ( m_chromaSamplingHorFilterIdc );
     988  m_cTEncTop.setChromaSamplingVerFilterIdc                        ( m_chromaSamplingVerFilterIdc );
     989  m_cTEncTop.setFramePackingArrangementSEIEnabled                 ( m_framePackingSEIEnabled );
     990  m_cTEncTop.setFramePackingArrangementSEIType                    ( m_framePackingSEIType );
     991  m_cTEncTop.setFramePackingArrangementSEIId                      ( m_framePackingSEIId );
     992  m_cTEncTop.setFramePackingArrangementSEIQuincunx                ( m_framePackingSEIQuincunx );
     993  m_cTEncTop.setFramePackingArrangementSEIInterpretation          ( m_framePackingSEIInterpretation );
     994  m_cTEncTop.setSegmentedRectFramePackingArrangementSEIEnabled    ( m_segmentedRectFramePackingSEIEnabled );
     995  m_cTEncTop.setSegmentedRectFramePackingArrangementSEICancel     ( m_segmentedRectFramePackingSEICancel );
     996  m_cTEncTop.setSegmentedRectFramePackingArrangementSEIType       ( m_segmentedRectFramePackingSEIType );
     997  m_cTEncTop.setSegmentedRectFramePackingArrangementSEIPersistence( m_segmentedRectFramePackingSEIPersistence );
     998  m_cTEncTop.setDisplayOrientationSEIAngle                        ( m_displayOrientationSEIAngle );
     999  m_cTEncTop.setTemporalLevel0IndexSEIEnabled                     ( m_temporalLevel0IndexSEIEnabled );
     1000  m_cTEncTop.setGradualDecodingRefreshInfoEnabled                 ( m_gradualDecodingRefreshInfoEnabled );
     1001  m_cTEncTop.setNoDisplaySEITLayer                                ( m_noDisplaySEITLayer );
     1002  m_cTEncTop.setDecodingUnitInfoSEIEnabled                        ( m_decodingUnitInfoSEIEnabled );
     1003  m_cTEncTop.setSOPDescriptionSEIEnabled                          ( m_SOPDescriptionSEIEnabled );
     1004  m_cTEncTop.setScalableNestingSEIEnabled                         ( m_scalableNestingSEIEnabled );
     1005  m_cTEncTop.setTMCTSSEIEnabled                                   ( m_tmctsSEIEnabled );
     1006  m_cTEncTop.setTimeCodeSEIEnabled                                ( m_timeCodeSEIEnabled );
     1007  m_cTEncTop.setNumberOfTimeSets                                  ( m_timeCodeSEINumTs );
     1008  for(Int i = 0; i < m_timeCodeSEINumTs; i++) { m_cTEncTop.setTimeSet(m_timeSetArray[i], i); }
     1009  m_cTEncTop.setKneeSEIEnabled                                    ( m_kneeSEIEnabled );
     1010  m_cTEncTop.setKneeSEIId                                         ( m_kneeSEIId );
     1011  m_cTEncTop.setKneeSEICancelFlag                                 ( m_kneeSEICancelFlag );
     1012  m_cTEncTop.setKneeSEIPersistenceFlag                            ( m_kneeSEIPersistenceFlag );
     1013  m_cTEncTop.setKneeSEIInputDrange                                ( m_kneeSEIInputDrange );
     1014  m_cTEncTop.setKneeSEIInputDispLuminance                         ( m_kneeSEIInputDispLuminance );
     1015  m_cTEncTop.setKneeSEIOutputDrange                               ( m_kneeSEIOutputDrange );
     1016  m_cTEncTop.setKneeSEIOutputDispLuminance                        ( m_kneeSEIOutputDispLuminance );
     1017  m_cTEncTop.setKneeSEINumKneePointsMinus1                        ( m_kneeSEINumKneePointsMinus1 );
     1018  m_cTEncTop.setKneeSEIInputKneePoint                             ( m_kneeSEIInputKneePoint );
     1019  m_cTEncTop.setKneeSEIOutputKneePoint                            ( m_kneeSEIOutputKneePoint );
     1020  m_cTEncTop.setMasteringDisplaySEI                               ( m_masteringDisplay );
    9631021#if Q0074_COLOUR_REMAPPING_SEI
    964   m_cTEncTop.setCRISEIFile                       ( const_cast<Char*>(m_colourRemapSEIFile.c_str()) );
     1022  m_cTEncTop.setCRISEIFile                       ( m_colourRemapSEIFile );
    9651023  m_cTEncTop.setCRISEIId                         ( m_colourRemapSEIId );
    9661024  m_cTEncTop.setCRISEICancelFlag                 ( m_colourRemapSEICancelFlag );
     
    9831041  m_cTEncTop.setCRISEIPostLutTargetValue         ( m_colourRemapSEIPostLutTargetValue );
    9841042#endif
    985   m_cTEncTop.setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled );
    986   m_cTEncTop.setFramePackingArrangementSEIType( m_framePackingSEIType );
    987   m_cTEncTop.setFramePackingArrangementSEIId( m_framePackingSEIId );
    988   m_cTEncTop.setFramePackingArrangementSEIQuincunx( m_framePackingSEIQuincunx );
    989   m_cTEncTop.setFramePackingArrangementSEIInterpretation( m_framePackingSEIInterpretation );
    990   m_cTEncTop.setDisplayOrientationSEIAngle( m_displayOrientationSEIAngle );
    991   m_cTEncTop.setTemporalLevel0IndexSEIEnabled( m_temporalLevel0IndexSEIEnabled );
    992   m_cTEncTop.setGradualDecodingRefreshInfoEnabled( m_gradualDecodingRefreshInfoEnabled );
    993   m_cTEncTop.setDecodingUnitInfoSEIEnabled( m_decodingUnitInfoSEIEnabled );
    9941043#if LAYERS_NOT_PRESENT_SEI
    9951044  m_cTEncTop.setLayersNotPresentSEIEnabled( m_layersNotPresentSEIEnabled );
    9961045#endif
    997   m_cTEncTop.setSOPDescriptionSEIEnabled( m_SOPDescriptionSEIEnabled );
    998   m_cTEncTop.setScalableNestingSEIEnabled( m_scalableNestingSEIEnabled );
    999   m_cTEncTop.setTileUniformSpacingFlag     ( m_tileUniformSpacingFlag );
    1000   m_cTEncTop.setNumColumnsMinus1           ( m_numTileColumnsMinus1 );
    1001   m_cTEncTop.setNumRowsMinus1              ( m_numTileRowsMinus1 );
     1046  m_cTEncTop.setTileUniformSpacingFlag                            ( m_tileUniformSpacingFlag );
     1047  m_cTEncTop.setNumColumnsMinus1                                  ( m_numTileColumnsMinus1 );
     1048  m_cTEncTop.setNumRowsMinus1                                     ( m_numTileRowsMinus1 );
    10021049  if(!m_tileUniformSpacingFlag)
    10031050  {
    1004     m_cTEncTop.setColumnWidth              ( m_tileColumnWidth );
    1005     m_cTEncTop.setRowHeight                ( m_tileRowHeight );
     1051    m_cTEncTop.setColumnWidth                                     ( m_tileColumnWidth );
     1052    m_cTEncTop.setRowHeight                                       ( m_tileRowHeight );
    10061053  }
    10071054  m_cTEncTop.xCheckGSParameters();
    1008   Int uiTilesCount          = (m_numTileRowsMinus1+1) * (m_numTileColumnsMinus1+1);
     1055  Int uiTilesCount = (m_numTileRowsMinus1+1) * (m_numTileColumnsMinus1+1);
    10091056  if(uiTilesCount == 1)
    10101057  {
    10111058    m_bLFCrossTileBoundaryFlag = true;
    10121059  }
    1013   m_cTEncTop.setLFCrossTileBoundaryFlag( m_bLFCrossTileBoundaryFlag );
    1014   m_cTEncTop.setWaveFrontSynchro           ( m_iWaveFrontSynchro );
    1015   m_cTEncTop.setWaveFrontSubstreams        ( m_iWaveFrontSubstreams );
    1016   m_cTEncTop.setTMVPModeId ( m_TMVPModeId );
    1017   m_cTEncTop.setUseScalingListId           ( m_useScalingListId  );
    1018   m_cTEncTop.setScalingListFile            ( m_scalingListFile   );
    1019   m_cTEncTop.setSignHideFlag(m_signHideFlag);
    1020   m_cTEncTop.setUseRateCtrl         ( m_RCEnableRateControl );
    1021   m_cTEncTop.setTargetBitrate       ( m_RCTargetBitrate );
    1022   m_cTEncTop.setKeepHierBit         ( m_RCKeepHierarchicalBit );
    1023   m_cTEncTop.setLCULevelRC          ( m_RCLCULevelRC );
    1024   m_cTEncTop.setUseLCUSeparateModel ( m_RCUseLCUSeparateModel );
    1025   m_cTEncTop.setInitialQP           ( m_RCInitialQP );
    1026   m_cTEncTop.setForceIntraQP        ( m_RCForceIntraQP );
    1027   m_cTEncTop.setTransquantBypassEnableFlag(m_TransquantBypassEnableFlag);
    1028   m_cTEncTop.setCUTransquantBypassFlagForceValue(m_CUTransquantBypassFlagForce);
    1029   m_cTEncTop.setUseRecalculateQPAccordingToLambda( m_recalculateQPAccordingToLambda );
    1030   m_cTEncTop.setUseStrongIntraSmoothing( m_useStrongIntraSmoothing );
    1031   m_cTEncTop.setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled );
    1032   m_cTEncTop.setVuiParametersPresentFlag( m_vuiParametersPresentFlag );
    1033   m_cTEncTop.setAspectRatioInfoPresentFlag( m_aspectRatioInfoPresentFlag);
    1034   m_cTEncTop.setAspectRatioIdc( m_aspectRatioIdc );
    1035   m_cTEncTop.setSarWidth( m_sarWidth );
    1036   m_cTEncTop.setSarHeight( m_sarHeight );
    1037   m_cTEncTop.setOverscanInfoPresentFlag( m_overscanInfoPresentFlag );
    1038   m_cTEncTop.setOverscanAppropriateFlag( m_overscanAppropriateFlag );
    1039   m_cTEncTop.setVideoSignalTypePresentFlag( m_videoSignalTypePresentFlag );
    1040   m_cTEncTop.setVideoFormat( m_videoFormat );
    1041   m_cTEncTop.setVideoFullRangeFlag( m_videoFullRangeFlag );
    1042   m_cTEncTop.setColourDescriptionPresentFlag( m_colourDescriptionPresentFlag );
    1043   m_cTEncTop.setColourPrimaries( m_colourPrimaries );
    1044   m_cTEncTop.setTransferCharacteristics( m_transferCharacteristics );
    1045   m_cTEncTop.setMatrixCoefficients( m_matrixCoefficients );
    1046   m_cTEncTop.setChromaLocInfoPresentFlag( m_chromaLocInfoPresentFlag );
    1047   m_cTEncTop.setChromaSampleLocTypeTopField( m_chromaSampleLocTypeTopField );
    1048   m_cTEncTop.setChromaSampleLocTypeBottomField( m_chromaSampleLocTypeBottomField );
    1049   m_cTEncTop.setNeutralChromaIndicationFlag( m_neutralChromaIndicationFlag );
    1050   m_cTEncTop.setDefaultDisplayWindow( m_defDispWinLeftOffset, m_defDispWinRightOffset, m_defDispWinTopOffset, m_defDispWinBottomOffset );
    1051   m_cTEncTop.setFrameFieldInfoPresentFlag( m_frameFieldInfoPresentFlag );
    1052   m_cTEncTop.setPocProportionalToTimingFlag( m_pocProportionalToTimingFlag );
    1053   m_cTEncTop.setNumTicksPocDiffOneMinus1   ( m_numTicksPocDiffOneMinus1    );
    1054   m_cTEncTop.setBitstreamRestrictionFlag( m_bitstreamRestrictionFlag );
    1055   m_cTEncTop.setTilesFixedStructureFlag( m_tilesFixedStructureFlag );
    1056   m_cTEncTop.setMotionVectorsOverPicBoundariesFlag( m_motionVectorsOverPicBoundariesFlag );
    1057   m_cTEncTop.setMinSpatialSegmentationIdc( m_minSpatialSegmentationIdc );
    1058   m_cTEncTop.setMaxBytesPerPicDenom( m_maxBytesPerPicDenom );
    1059   m_cTEncTop.setMaxBitsPerMinCuDenom( m_maxBitsPerMinCuDenom );
    1060   m_cTEncTop.setLog2MaxMvLengthHorizontal( m_log2MaxMvLengthHorizontal );
    1061   m_cTEncTop.setLog2MaxMvLengthVertical( m_log2MaxMvLengthVertical );
     1060  m_cTEncTop.setLFCrossTileBoundaryFlag                           ( m_bLFCrossTileBoundaryFlag );
     1061  m_cTEncTop.setWaveFrontSynchro                                  ( m_iWaveFrontSynchro );
     1062  m_cTEncTop.setWaveFrontSubstreams                               ( m_iWaveFrontSubstreams );
     1063  m_cTEncTop.setTMVPModeId                                        ( m_TMVPModeId );
     1064  m_cTEncTop.setUseScalingListId                                  ( m_useScalingListId  );
     1065  m_cTEncTop.setScalingListFile                                   ( m_scalingListFile   );
     1066  m_cTEncTop.setSignHideFlag                                      ( m_signHideFlag);
     1067  m_cTEncTop.setUseRateCtrl                                       ( m_RCEnableRateControl );
     1068  m_cTEncTop.setTargetBitrate                                     ( m_RCTargetBitrate );
     1069  m_cTEncTop.setKeepHierBit                                       ( m_RCKeepHierarchicalBit );
     1070  m_cTEncTop.setLCULevelRC                                        ( m_RCLCULevelRC );
     1071  m_cTEncTop.setUseLCUSeparateModel                               ( m_RCUseLCUSeparateModel );
     1072  m_cTEncTop.setInitialQP                                         ( m_RCInitialQP );
     1073  m_cTEncTop.setForceIntraQP                                      ( m_RCForceIntraQP );
     1074  m_cTEncTop.setTransquantBypassEnableFlag                        ( m_TransquantBypassEnableFlag );
     1075  m_cTEncTop.setCUTransquantBypassFlagForceValue                  ( m_CUTransquantBypassFlagForce );
     1076  m_cTEncTop.setCostMode                                          ( m_costMode );
     1077  m_cTEncTop.setUseRecalculateQPAccordingToLambda                 ( m_recalculateQPAccordingToLambda );
     1078  m_cTEncTop.setUseStrongIntraSmoothing                           ( m_useStrongIntraSmoothing );
     1079  m_cTEncTop.setActiveParameterSetsSEIEnabled                     ( m_activeParameterSetsSEIEnabled );
     1080  m_cTEncTop.setVuiParametersPresentFlag                          ( m_vuiParametersPresentFlag );
     1081  m_cTEncTop.setAspectRatioInfoPresentFlag                        ( m_aspectRatioInfoPresentFlag);
     1082  m_cTEncTop.setAspectRatioIdc                                    ( m_aspectRatioIdc );
     1083  m_cTEncTop.setSarWidth                                          ( m_sarWidth );
     1084  m_cTEncTop.setSarHeight                                         ( m_sarHeight );
     1085  m_cTEncTop.setOverscanInfoPresentFlag                           ( m_overscanInfoPresentFlag );
     1086  m_cTEncTop.setOverscanAppropriateFlag                           ( m_overscanAppropriateFlag );
     1087  m_cTEncTop.setVideoSignalTypePresentFlag                        ( m_videoSignalTypePresentFlag );
     1088  m_cTEncTop.setVideoFormat                                       ( m_videoFormat );
     1089  m_cTEncTop.setVideoFullRangeFlag                                ( m_videoFullRangeFlag );
     1090  m_cTEncTop.setColourDescriptionPresentFlag                      ( m_colourDescriptionPresentFlag );
     1091  m_cTEncTop.setColourPrimaries                                   ( m_colourPrimaries );
     1092  m_cTEncTop.setTransferCharacteristics                           ( m_transferCharacteristics );
     1093  m_cTEncTop.setMatrixCoefficients                                ( m_matrixCoefficients );
     1094  m_cTEncTop.setChromaLocInfoPresentFlag                          ( m_chromaLocInfoPresentFlag );
     1095  m_cTEncTop.setChromaSampleLocTypeTopField                       ( m_chromaSampleLocTypeTopField );
     1096  m_cTEncTop.setChromaSampleLocTypeBottomField                    ( m_chromaSampleLocTypeBottomField );
     1097  m_cTEncTop.setNeutralChromaIndicationFlag                       ( m_neutralChromaIndicationFlag );
     1098  m_cTEncTop.setDefaultDisplayWindow                              ( m_defDispWinLeftOffset, m_defDispWinRightOffset, m_defDispWinTopOffset, m_defDispWinBottomOffset );
     1099  m_cTEncTop.setFrameFieldInfoPresentFlag                         ( m_frameFieldInfoPresentFlag );
     1100  m_cTEncTop.setPocProportionalToTimingFlag                       ( m_pocProportionalToTimingFlag );
     1101  m_cTEncTop.setNumTicksPocDiffOneMinus1                          ( m_numTicksPocDiffOneMinus1    );
     1102  m_cTEncTop.setBitstreamRestrictionFlag                          ( m_bitstreamRestrictionFlag );
     1103  m_cTEncTop.setTilesFixedStructureFlag                           ( m_tilesFixedStructureFlag );
     1104  m_cTEncTop.setMotionVectorsOverPicBoundariesFlag                ( m_motionVectorsOverPicBoundariesFlag );
     1105  m_cTEncTop.setMinSpatialSegmentationIdc                         ( m_minSpatialSegmentationIdc );
     1106  m_cTEncTop.setMaxBytesPerPicDenom                               ( m_maxBytesPerPicDenom );
     1107  m_cTEncTop.setMaxBitsPerMinCuDenom                              ( m_maxBitsPerMinCuDenom );
     1108  m_cTEncTop.setLog2MaxMvLengthHorizontal                         ( m_log2MaxMvLengthHorizontal );
     1109  m_cTEncTop.setLog2MaxMvLengthVertical                           ( m_log2MaxMvLengthVertical );
    10621110}
    10631111#endif //SVC_EXTENSION
     
    10741122#if O0194_DIFFERENT_BITDEPTH_EL_BL
    10751123    //2
    1076     g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
    1077     g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
    1078 
    1079     g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
    1080     g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     1124    for (UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)for (UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)
     1125    {
     1126      g_bitDepth[channelTypeIndex]    = m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     1127      g_PCMBitDepth[channelTypeIndex] = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepth[channelTypeIndex] : m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     1128    }
    10811129#endif
    10821130#if LAYER_CTB
     
    10861134    g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
    10871135#endif
     1136    // Video I/O
    10881137#if O0194_DIFFERENT_BITDEPTH_EL_BL
    1089     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
    1090 #else
    1091     m_acTVideoIOYuvInputFile[layer].open( (Char *)m_acLayerCfg[layer].getInputFile().c_str(),  false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC );  // read  mode
    1092 #endif
    1093     m_acTVideoIOYuvInputFile[layer].skipFrames(m_FrameSkip, m_acLayerCfg[layer].getSourceWidth() - m_acLayerCfg[layer].getPad()[0], m_acLayerCfg[layer].getSourceHeight() - m_acLayerCfg[layer].getPad()[1]);
     1138    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
     1139#else
     1140    m_acTVideoIOYuvInputFile[layer].open( (Char *)m_acLayerCfg[layer].getInputFile().c_str(),  false, m_inputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth );  // read  mode
     1141#endif
     1142    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);
    10941143
    10951144    if (!m_acLayerCfg[layer].getReconFile().empty())
    10961145    {
    10971146#if O0194_DIFFERENT_BITDEPTH_EL_BL
    1098       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
    1099 #else
    1100       m_acTVideoIOYuvReconFile[layer].open((Char *)m_acLayerCfg[layer].getReconFile().c_str(), true, m_outputBitDepthY, m_outputBitDepthC, m_internalBitDepthY, m_internalBitDepthC );  // write mode
    1101 #endif
    1102     }
    1103 
     1147      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
     1148#else
     1149      m_acTVideoIOYuvReconFile[layer].open((Char *)m_acLayerCfg[layer].getReconFile().c_str(), true, m_outputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth );  // write mode
     1150#endif
     1151    }
     1152
     1153    // Neo Decoder
    11041154    m_acTEncTop[layer].create();
    11051155  }
    11061156#else //SVC_EXTENSION
    1107   m_cTVideoIOYuvInputFile.open( m_pchInputFile,     false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC );  // read  mode
    1108   m_cTVideoIOYuvInputFile.skipFrames(m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1]);
     1157  // Video I/O
     1158  m_cTVideoIOYuvInputFile.open( m_pchInputFile,     false, m_inputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth );  // read  mode
     1159  m_cTVideoIOYuvInputFile.skipFrames(m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1], m_InputChromaFormatIDC);
    11091160
    11101161  if (m_pchReconFile)
    1111     m_cTVideoIOYuvReconFile.open(m_pchReconFile, true, m_outputBitDepthY, m_outputBitDepthC, m_internalBitDepthY, m_internalBitDepthC);  // write mode
     1162  {
     1163    m_cTVideoIOYuvReconFile.open(m_pchReconFile, true, m_outputBitDepth, m_outputBitDepth, m_internalBitDepth);  // write mode
     1164  }
    11121165
    11131166  // Neo Decoder
     
    11531206#if O0194_DIFFERENT_BITDEPTH_EL_BL
    11541207    //3
    1155     g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
    1156     g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
    1157 
    1158     g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
    1159     g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     1208    for (UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)for (UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)
     1209    {
     1210      g_bitDepth[channelTypeIndex]    = m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     1211      g_PCMBitDepth[channelTypeIndex] = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepth[channelTypeIndex] : m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     1212    }
    11601213#endif
    11611214#if LAYER_CTB
     
    12131266#if O0194_DIFFERENT_BITDEPTH_EL_BL
    12141267        //4
    1215         g_bitDepthY = m_acLayerCfg[layerId].m_internalBitDepthY;
    1216         g_bitDepthC = m_acLayerCfg[layerId].m_internalBitDepthC;
    1217 
    1218         g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepthY : m_acLayerCfg[layerId].m_internalBitDepthY;
    1219         g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepthC : m_acLayerCfg[layerId].m_internalBitDepthC;
     1268        g_bitDepth[CHANNEL_TYPE_LUMA]   = m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_LUMA];
     1269        g_bitDepth[CHANNEL_TYPE_CHROMA] = m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
     1270
     1271        g_PCMBitDepth[CHANNEL_TYPE_LUMA]   = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepth[CHANNEL_TYPE_LUMA]   : m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_LUMA];
     1272        g_PCMBitDepth[CHANNEL_TYPE_CHROMA] = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepth[CHANNEL_TYPE_CHROMA] : m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
    12201273#endif
    12211274
     
    12351288#if O0194_DIFFERENT_BITDEPTH_EL_BL
    12361289        //4
    1237         g_bitDepthY = m_acLayerCfg[layerId].m_internalBitDepthY;
    1238         g_bitDepthC = m_acLayerCfg[layerId].m_internalBitDepthC;
    1239 
    1240         g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepthY : m_acLayerCfg[layerId].m_internalBitDepthY;
    1241         g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepthC : m_acLayerCfg[layerId].m_internalBitDepthC;
     1290        g_bitDepth[CHANNEL_TYPE_LUMA]   = m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_LUMA];
     1291        g_bitDepth[CHANNEL_TYPE_CHROMA] = m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
     1292
     1293        g_PCMBitDepth[CHANNEL_TYPE_LUMA]   = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepth[CHANNEL_TYPE_LUMA]   : m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_LUMA];
     1294        g_PCMBitDepth[CHANNEL_TYPE_CHROMA] = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepth[CHANNEL_TYPE_CHROMA] : m_acLayerCfg[layerId].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
    12421295#endif
    12431296        if (layerId <= setId)
     
    19652018  Bool  bEos = false;
    19662019
     2020  const InputColourSpaceConversion ipCSC  =  m_inputColourSpaceConvert;
     2021  const InputColourSpaceConversion snrCSC = (!m_snrInternalColourSpace) ? m_inputColourSpaceConvert : IPCOLOURSPACE_UNCHANGED;
     2022
    19672023  list<AccessUnit> outputAccessUnits; ///< list of access units to write out.  is populated by the encoding process
     2024
     2025  TComPicYuv acPicYuvTrueOrg[MAX_LAYERS];
    19682026
    19692027  for(UInt layer=0; layer<m_numLayers; layer++)
     
    19712029#if O0194_DIFFERENT_BITDEPTH_EL_BL
    19722030    //5
    1973     g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
    1974     g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
    1975 
    1976     g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
    1977     g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     2031    g_bitDepth[CHANNEL_TYPE_LUMA]   = m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA];
     2032    g_bitDepth[CHANNEL_TYPE_CHROMA] = m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
     2033
     2034    g_PCMBitDepth[CHANNEL_TYPE_LUMA]   = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepth[CHANNEL_TYPE_LUMA] : m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_LUMA];
     2035    g_PCMBitDepth[CHANNEL_TYPE_CHROMA] = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepth[CHANNEL_TYPE_CHROMA] : m_acLayerCfg[layer].m_internalBitDepth[CHANNEL_TYPE_CHROMA];
    19782036#endif
    19792037    // allocate original YUV buffer
     
    19812039    if( m_isField )
    19822040    {
    1983 #if SVC_EXTENSION
    19842041#if LAYER_CTB
    1985 #if AUXILIARY_PICTURES
    19862042      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 );
    1987 #else
    1988       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 );
    1989 #endif
    1990 #else
    1991 #if AUXILIARY_PICTURES
     2043      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 );
     2044#else
    19922045      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    1993 #else
    1994       pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    1995 #endif
    1996 #endif
    1997 #else
    1998       pcPicYuvOrg->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     2046      acPicYuvTrueOrg[layer].create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    19992047#endif
    20002048    }
    20012049    else
    20022050    {
    2003 #if SVC_EXTENSION
    20042051#if LAYER_CTB
    2005 #if AUXILIARY_PICTURES
    20062052      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 );
    2007 #else
    2008       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 );
    2009 #endif
    2010 #else
    2011 #if AUXILIARY_PICTURES
     2053      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 );
     2054#else
    20122055      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    2013 #else
    2014       pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    2015 #endif
    2016 #endif
    2017 #else
    2018       pcPicYuvOrg->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     2056      acPicYuvTrueOrg[layer].create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    20192057#endif
    20202058    }
     
    20322070#if O0194_DIFFERENT_BITDEPTH_EL_BL
    20332071        //6
    2034         g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
    2035         g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
    2036 
    2037         g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
    2038         g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     2072        for (UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)for (UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)
     2073        {
     2074          g_bitDepth[channelTypeIndex]    = m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     2075          g_PCMBitDepth[channelTypeIndex] = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepth[channelTypeIndex] : m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     2076        }
    20392077#endif
    20402078#if LAYER_CTB
     
    20492087
    20502088        // read input YUV file
    2051         m_acTVideoIOYuvInputFile[layer].read( pcPicYuvOrg[layer], m_acLayerCfg[layer].getPad() );
     2089        m_acTVideoIOYuvInputFile[layer].read( pcPicYuvOrg[layer], &acPicYuvTrueOrg[layer], ipCSC, m_acLayerCfg[layer].getPad(), m_acLayerCfg[layer].getInputChromaFormat() );
    20522090
    20532091#if AUXILIARY_PICTURES
     
    20732111        if ( m_isField )
    20742112        {
    2075           m_acTEncTop[layer].encodePrep( pcPicYuvOrg[layer], m_isTopFieldFirst );
     2113          m_acTEncTop[layer].encodePrep( pcPicYuvOrg[layer], &acPicYuvTrueOrg[layer], m_isTopFieldFirst );
    20762114        }
    20772115        else
    20782116        {
    2079           m_acTEncTop[layer].encodePrep( pcPicYuvOrg[layer] );
     2117          m_acTEncTop[layer].encodePrep( pcPicYuvOrg[layer], &acPicYuvTrueOrg[layer] );
    20802118        }
    20812119      }
     
    21262164#if O0194_DIFFERENT_BITDEPTH_EL_BL
    21272165        //7
    2128         g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
    2129         g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
    2130 
    2131         g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
    2132         g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     2166        for (UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)for (UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)
     2167        {
     2168          g_bitDepth[channelTypeIndex]    = m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     2169          g_PCMBitDepth[channelTypeIndex] = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepth[channelTypeIndex] : m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     2170        }
    21332171#endif
    21342172#if LAYER_CTB
     
    21442182#endif
    21452183        // call encoding function for one frame
    2146         if ( m_isField )
    2147         {
    2148           m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP, m_isTopFieldFirst );
    2149         }
    2150         else
    2151         {
    2152           m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP );
    2153         }
     2184        if ( m_isField ) m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], snrCSC, m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP, m_isTopFieldFirst );
     2185        else             m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], snrCSC, m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP );
    21542186      }
    21552187    }
     
    21972229#if O0194_DIFFERENT_BITDEPTH_EL_BL
    21982230      //8
    2199       g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
    2200       g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
    2201 
    2202       g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
    2203       g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     2231      for (UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)for (UInt channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)
     2232      {
     2233        g_bitDepth[channelTypeIndex]      = m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     2234        g_PCMBitDepth[channelTypeIndex] = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepth[channelTypeIndex] : m_acLayerCfg[layer].m_internalBitDepth[channelTypeIndex];
     2235      }
    22042236#endif
    22052237      // write bistream to file if necessary
     
    22382270    if (bEos)
    22392271    {
    2240       printOutSummary(m_isTopFieldFirst);
     2272      printOutSummary(m_isTopFieldFirst, m_printMSEBasedSequencePSNR, m_printSequenceMSE);
    22412273    }
    22422274
     
    22522284    // delete used buffers in encoder class
    22532285    m_acTEncTop[layer].deletePicBuffer();
     2286    acPicYuvTrueOrg[layer].destroy();
    22542287  }
    22552288
     
    22632296}
    22642297
    2265 Void TAppEncTop::printOutSummary(Bool isField)
     2298Void TAppEncTop::printOutSummary(Bool isField, const Bool printMSEBasedSNR, const Bool printSequenceMSE)
    22662299{
    22672300  UInt layer;
     
    22912324  for(layer = 0; layer < m_numLayers; layer++)
    22922325  {
    2293     m_gcAnalyzeAll[layer].printOut('a', layer);
     2326    m_gcAnalyzeAll[layer].printOut('a', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, layer);
    22942327  }
    22952328
     
    22982331  for(layer = 0; layer < m_numLayers; layer++)
    22992332  {
    2300     m_gcAnalyzeI[layer].printOut('i', layer);
     2333    m_gcAnalyzeI[layer].printOut('i', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, layer);
    23012334  }
    23022335
     
    23052338  for(layer = 0; layer < m_numLayers; layer++)
    23062339  {
    2307     m_gcAnalyzeP[layer].printOut('p', layer);
     2340    m_gcAnalyzeP[layer].printOut('p', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, layer);
    23082341  }
    23092342
     
    23122345  for(layer = 0; layer < m_numLayers; layer++)
    23132346  {
    2314     m_gcAnalyzeB[layer].printOut('b', layer);
     2347    m_gcAnalyzeB[layer].printOut('b', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, layer);
    23152348  }
    23162349
     
    23212354      //-- interlaced summary
    23222355      m_gcAnalyzeAll_in.setFrmRate( m_acLayerCfg[layer].getFrameRate());
     2356      m_gcAnalyzeAll_in.setBits(m_gcAnalyzeB[layer].getBits());
     2357      // prior to the above statement, the interlace analyser does not contain the correct total number of bits.
     2358
    23232359      printf( "\n\nSUMMARY INTERLACED ---------------------------------------------\n" );
    2324       m_gcAnalyzeAll_in.printOutInterlaced('a',  m_gcAnalyzeAll[layer].getBits());
     2360      m_gcAnalyzeAll_in.printOut('a', m_acLayerCfg[layer].getChromaFormatIDC(), printMSEBasedSNR, printSequenceMSE, layer);
    23252361
    23262362#if _SUMMARY_OUT_
     
    23322368
    23332369#else
     2370// ====================================================================================================================
     2371// Public member functions
     2372// ====================================================================================================================
     2373
     2374/**
     2375 - create internal class
     2376 - initialize internal variable
     2377 - until the end of input YUV file, call encoding function in TEncTop class
     2378 - delete allocated buffers
     2379 - destroy internal class
     2380 .
     2381 */
    23342382Void TAppEncTop::encode()
    23352383{
     
    23492397  xInitLib(m_isField);
    23502398
     2399  printChromaFormat();
     2400
    23512401  // main encoder loop
    23522402  Int   iNumEncoded = 0;
    23532403  Bool  bEos = false;
    23542404
     2405  const InputColourSpaceConversion ipCSC  =  m_inputColourSpaceConvert;
     2406  const InputColourSpaceConversion snrCSC = (!m_snrInternalColourSpace) ? m_inputColourSpaceConvert : IPCOLOURSPACE_UNCHANGED;
     2407
    23552408  list<AccessUnit> outputAccessUnits; ///< list of access units to write out.  is populated by the encoding process
     2409
     2410  TComPicYuv cPicYuvTrueOrg;
    23562411
    23572412  // allocate original YUV buffer
    23582413  if( m_isField )
    23592414  {
    2360     pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeightOrg, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     2415    pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeightOrg, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     2416  cPicYuvTrueOrg.create(m_iSourceWidth, m_iSourceHeightOrg, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth);
    23612417  }
    23622418  else
    23632419  {
    2364     pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     2420    pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     2421  cPicYuvTrueOrg.create(m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth);
    23652422  }
    23662423
     
    23712428
    23722429    // read input YUV file
    2373     m_cTVideoIOYuvInputFile.read( pcPicYuvOrg, m_aiPad );
     2430    m_cTVideoIOYuvInputFile.read( pcPicYuvOrg, &cPicYuvTrueOrg, ipCSC, m_aiPad, m_InputChromaFormatIDC );
    23742431
    23752432    // increase number of received frames
     
    23772434
    23782435    bEos = (m_isField && (m_iFrameRcvd == (m_framesToBeEncoded >> 1) )) || ( !m_isField && (m_iFrameRcvd == m_framesToBeEncoded) );
     2436
    23792437    Bool flush = 0;
    23802438    // if end of file (which is only detected on a read failure) flush the encoder of any queued pictures
     
    23882446
    23892447    // call encoding function for one frame
    2390     if ( m_isField )
    2391     {
    2392       m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, m_cListPicYuvRec, outputAccessUnits, iNumEncoded, m_isTopFieldFirst);
    2393     }
    2394     else
    2395     {
    2396     m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, m_cListPicYuvRec, outputAccessUnits, iNumEncoded );
    2397     }
     2448    if ( m_isField ) m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, flush ? 0 : &cPicYuvTrueOrg, snrCSC, m_cListPicYuvRec, outputAccessUnits, iNumEncoded, m_isTopFieldFirst );
     2449    else             m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, flush ? 0 : &cPicYuvTrueOrg, snrCSC, m_cListPicYuvRec, outputAccessUnits, iNumEncoded );
    23982450
    23992451    // write bistream to file if necessary
     
    24142466  // delete used buffers in encoder class
    24152467  m_cTEncTop.deletePicBuffer();
     2468  cPicYuvTrueOrg.destroy();
    24162469
    24172470  // delete buffers & classes
     
    24412494
    24422495  // org. buffer
    2443   if ( m_acListPicYuvRec[layer].size() == (UInt)m_iGOPSize )
     2496  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.
    24442497  {
    24452498    rpcPicYuvRec = m_acListPicYuvRec[layer].popFront();
     
    24512504
    24522505#if LAYER_CTB
    2453 #if AUXILIARY_PICTURES
    24542506    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 );
    24552507#else
    2456     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 );
    2457 #endif
    2458 #else
    2459 #if AUXILIARY_PICTURES
    24602508    rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    2461 #else
    2462     rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    2463 #endif
    24642509#endif
    24652510
     
    24932538#endif
    24942539
     2540  const InputColourSpaceConversion ipCSC = (!m_outputInternalColourSpace) ? m_inputColourSpaceConvert : IPCOLOURSPACE_UNCHANGED;
     2541
    24952542  if (m_isField)
    24962543  {
     
    25162563      {
    25172564#if REPN_FORMAT_IN_VPS
    2518         m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRecTop, pcPicYuvRecBottom, m_acLayerCfg[layer].getConfWinLeft() * xScal, m_acLayerCfg[layer].getConfWinRight() * xScal,
    2519           m_acLayerCfg[layer].getConfWinTop() * yScal, m_acLayerCfg[layer].getConfWinBottom() * yScal, m_isTopFieldFirst );
    2520 #else
    2521         m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRecTop, pcPicYuvRecBottom, m_acLayerCfg[layer].getConfWinLeft(), m_acLayerCfg[layer].getConfWinRight(), m_acLayerCfg[layer].getConfWinTop(), m_acLayerCfg[layer].getConfWinBottom(), m_isTopFieldFirst );
     2565        m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRecTop, pcPicYuvRecBottom, ipCSC, m_acLayerCfg[layer].getConfWinLeft() * xScal, m_acLayerCfg[layer].getConfWinRight() * xScal,
     2566          m_acLayerCfg[layer].getConfWinTop() * yScal, m_acLayerCfg[layer].getConfWinBottom() * yScal, NUM_CHROMA_FORMAT, m_isTopFieldFirst );
     2567#else
     2568        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 );
    25222569#endif
    25232570      }
     
    25452592      {
    25462593#if REPN_FORMAT_IN_VPS
    2547         m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConfWinLeft() * xScal, m_acLayerCfg[layer].getConfWinRight() * xScal,
     2594        m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, ipCSC, m_acLayerCfg[layer].getConfWinLeft() * xScal, m_acLayerCfg[layer].getConfWinRight() * xScal,
    25482595          m_acLayerCfg[layer].getConfWinTop() * yScal, m_acLayerCfg[layer].getConfWinBottom() * yScal );
    25492596#else
    2550         m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConfWinLeft(), m_acLayerCfg[layer].getConfWinRight(),
     2597        m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, ipCSC, m_acLayerCfg[layer].getConfWinLeft(), m_acLayerCfg[layer].getConfWinRight(),
    25512598          m_acLayerCfg[layer].getConfWinTop(), m_acLayerCfg[layer].getConfWinBottom() );
    25522599#endif
     
    26042651
    26052652  // org. buffer
    2606   if ( m_cListPicYuvRec.size() == (UInt)m_iGOPSize )
     2653  if ( m_cListPicYuvRec.size() >= (UInt)m_iGOPSize ) // buffer will be 1 element longer when using field coding, to maintain first field whilst processing second.
    26072654  {
    26082655    rpcPicYuvRec = m_cListPicYuvRec.popFront();
     
    26132660    rpcPicYuvRec = new TComPicYuv;
    26142661
    2615     rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     2662    rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
    26162663
    26172664  }
     
    26382685Void TAppEncTop::xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, const std::list<AccessUnit>& accessUnits)
    26392686{
     2687  const InputColourSpaceConversion ipCSC = (!m_outputInternalColourSpace) ? m_inputColourSpaceConvert : IPCOLOURSPACE_UNCHANGED;
     2688
    26402689  if (m_isField)
    26412690  {
     
    26572706      if (m_pchReconFile)
    26582707      {
    2659         m_cTVideoIOYuvReconFile.write( pcPicYuvRecTop, pcPicYuvRecBottom, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, m_isTopFieldFirst );
     2708        m_cTVideoIOYuvReconFile.write( pcPicYuvRecTop, pcPicYuvRecBottom, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, NUM_CHROMA_FORMAT, m_isTopFieldFirst );
    26602709      }
    26612710
     
    26722721  {
    26732722    Int i;
     2723
    26742724    TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.end();
    26752725    list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin();
     
    26852735      if (m_pchReconFile)
    26862736      {
    2687         m_cTVideoIOYuvReconFile.write( pcPicYuvRec, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom );
     2737        m_cTVideoIOYuvReconFile.write( pcPicYuvRec, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom );
    26882738      }
    26892739
     
    26992749 *
    27002750 */
    2701 void TAppEncTop::rateStatsAccum(const AccessUnit& au, const std::vector<UInt>& annexBsizes)
     2751Void TAppEncTop::rateStatsAccum(const AccessUnit& au, const std::vector<UInt>& annexBsizes)
    27022752{
    27032753  AccessUnit::const_iterator it_au = au.begin();
     
    27372787}
    27382788
    2739 void TAppEncTop::printRateSummary()
     2789Void TAppEncTop::printRateSummary()
    27402790{
    27412791#if SVC_EXTENSION
     
    27502800}
    27512801
     2802#if !SVC_EXTENSION
     2803Void TAppEncTop::printChromaFormat()
     2804{
     2805  std::cout << std::setw(43) << "Input ChromaFormatIDC = ";
     2806  switch (m_InputChromaFormatIDC)
     2807  {
     2808  case CHROMA_400:  std::cout << "  4:0:0"; break;
     2809  case CHROMA_420:  std::cout << "  4:2:0"; break;
     2810  case CHROMA_422:  std::cout << "  4:2:2"; break;
     2811  case CHROMA_444:  std::cout << "  4:4:4"; break;
     2812  default:
     2813    std::cerr << "Invalid";
     2814    exit(1);
     2815  }
     2816  std::cout << std::endl;
     2817
     2818  std::cout << std::setw(43) << "Output (internal) ChromaFormatIDC = ";
     2819  switch (m_cTEncTop.getChromaFormatIdc())
     2820  {
     2821  case CHROMA_400:  std::cout << "  4:0:0"; break;
     2822  case CHROMA_420:  std::cout << "  4:2:0"; break;
     2823  case CHROMA_422:  std::cout << "  4:2:2"; break;
     2824  case CHROMA_444:  std::cout << "  4:4:4"; break;
     2825  default:
     2826    std::cerr << "Invalid";
     2827    exit(1);
     2828  }
     2829  std::cout << "\n" << std::endl;
     2830}
     2831#endif
     2832
    27522833//! \}
  • branches/SHM-upgrade/source/App/TAppEncoder/TAppEncTop.h

    r595 r916  
    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-upgrade/source/App/TAppEncoder/encmain.cpp

    r595 r916  
    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.