Changeset 1313 in 3DVCSoftware for trunk/source/App/TAppEncoder/TAppEncCfg.cpp


Ignore:
Timestamp:
13 Aug 2015, 17:38:13 (9 years ago)
Author:
tech
Message:

Merged 14.1-update-dev1@1312.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/App/TAppEncoder/TAppEncCfg.cpp

    r1196 r1313  
    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 *
    6 * Copyright (c) 2010-2015, ITU/ISO/IEC
     6 * Copyright (c) 2010-2015, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    3636*/
    3737
     38#include <stdio.h>
    3839#include <stdlib.h>
    3940#include <cassert>
    4041#include <cstring>
    4142#include <string>
     43#include <limits>
    4244#include "TLibCommon/TComRom.h"
    4345#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 
    4946#include "TAppCommon/program_options_lite.h"
    5047#include "TLibEncoder/TEncRateCtrl.h"
     
    5350#endif
    5451
     52#define MACRO_TO_STRING_HELPER(val) #val
     53#define MACRO_TO_STRING(val) MACRO_TO_STRING_HELPER(val)
     54
    5555using namespace std;
    5656namespace po = df::program_options_lite;
     57
     58
     59
     60enum ExtendedProfileName // this is used for determining profile strings, where multiple profiles map to a single profile idc with various constraint flag combinations
     61{
     62  NONE = 0,
     63  MAIN = 1,
     64  MAIN10 = 2,
     65  MAINSTILLPICTURE = 3,
     66  MAINREXT = 4,
     67  HIGHTHROUGHPUTREXT = 5, // Placeholder profile for development
     68  // The following are RExt profiles, which would map to the MAINREXT profile idc.
     69  // The enumeration indicates the bit-depth constraint in the bottom 2 digits
     70  //                           the chroma format in the next digit
     71    //                           the intra constraint in the next digit
     72//                           If it is a RExt still picture, there is a '1' for the top digit.
     73#if NH_MV
     74  MULTIVIEWMAIN = 6,
     75#if NH_3D
     76  MAIN3D = 8,
     77#endif
     78#endif
     79  MONOCHROME_8      = 1008,
     80  MONOCHROME_12     = 1012,
     81  MONOCHROME_16     = 1016,
     82  MAIN_12           = 1112,
     83  MAIN_422_10       = 1210,
     84  MAIN_422_12       = 1212,
     85  MAIN_444          = 1308,
     86  MAIN_444_10       = 1310,
     87  MAIN_444_12       = 1312,
     88  MAIN_444_16       = 1316, // non-standard profile definition, used for development purposes
     89  MAIN_INTRA        = 2108,
     90  MAIN_10_INTRA     = 2110,
     91  MAIN_12_INTRA     = 2112,
     92  MAIN_422_10_INTRA = 2210,
     93  MAIN_422_12_INTRA = 2212,
     94  MAIN_444_INTRA    = 2308,
     95  MAIN_444_10_INTRA = 2310,
     96  MAIN_444_12_INTRA = 2312,
     97  MAIN_444_16_INTRA = 2316,
     98  MAIN_444_STILL_PICTURE = 11308,
     99  MAIN_444_16_STILL_PICTURE = 12316
     100};
     101
    57102
    58103//! \ingroup TAppEncoder
     
    64109
    65110TAppEncCfg::TAppEncCfg()
    66 #if H_MV
     111#if NH_MV
    67112: m_pchBitstreamFile()
    68113#else
     
    71116, m_pchReconFile()
    72117#endif
     118, m_inputColourSpaceConvert(IPCOLOURSPACE_UNCHANGED)
     119, m_snrInternalColourSpace(false)
     120, m_outputInternalColourSpace(false)
    73121, m_pchdQPFile()
    74122, m_scalingListFile()
    75123{
    76 #if !H_MV
     124#if !NH_MV
    77125  m_aidQP = NULL;
    78126#endif
     
    88136TAppEncCfg::~TAppEncCfg()
    89137{
    90 #if H_MV
     138#if NH_MV
    91139  for( Int layer = 0; layer < m_aidQP.size(); layer++ )
    92140  {
     
    123171    m_targetPivotValue = NULL;
    124172  }
    125 #if !H_MV
     173#if !NH_MV
    126174  free(m_pchInputFile);
    127175#endif
    128176  free(m_pchBitstreamFile);
    129 #if H_MV
     177#if NH_MV
    130178  for(Int i = 0; i< m_pchReconFileList.size(); i++ )
    131179  {
     
    138186  free(m_pchdQPFile);
    139187  free(m_scalingListFile);
    140 #if H_MV
     188#if NH_MV
    141189  for( Int i = 0; i < m_GOPListMvc.size(); i++ )
    142190  {
     
    148196  }
    149197#endif
    150 #if H_3D
    151 #if H_3D_VSO
     198#if NH_3D
     199#if NH_3D_VSO
    152200  if (  m_pchVSOConfig != NULL)
     201  {
    153202    free (  m_pchVSOConfig );
     203  }
    154204#endif
    155205  if ( m_pchCameraParameterFile != NULL )
     206  {
    156207    free ( m_pchCameraParameterFile );
     208  }
    157209
    158210  if ( m_pchBaseViewCameraNumbers != NULL )
     211  {
    159212    free ( m_pchBaseViewCameraNumbers );
     213  }
    160214#endif
    161215}
     
    185239  }
    186240  in>>entry.m_interRPSPrediction;
    187 #if AUTO_INTER_RPS
    188241  if (entry.m_interRPSPrediction==1)
    189242  {
     
    199252    in>>entry.m_deltaRPS;
    200253  }
    201 #else
    202   if (entry.m_interRPSPrediction)
    203   {
    204     in>>entry.m_deltaRPS;
    205     in>>entry.m_numRefIdc;
    206     for ( Int i = 0; i < entry.m_numRefIdc; i++ )
    207     {
    208       in>>entry.m_refIdc[i];
    209     }
    210   }
    211 #endif
    212 #if H_MV
     254#if NH_MV
    213255  in>>entry.m_numActiveRefLayerPics;
    214256  for( Int i = 0; i < entry.m_numActiveRefLayerPics; i++ )
     
    225267  }
    226268#endif
    227 #if H_3D
     269#if NH_3D
    228270  in>>entry.m_interCompPredFlag;
    229271#endif
     272
    230273  return in;
    231274}
    232275
    233 static const struct MapStrToProfile {
     276Bool confirmPara(Bool bflag, const Char* message);
     277
     278static inline ChromaFormat numberToChromaFormat(const Int val)
     279{
     280  switch (val)
     281  {
     282    case 400: return CHROMA_400; break;
     283    case 420: return CHROMA_420; break;
     284    case 422: return CHROMA_422; break;
     285    case 444: return CHROMA_444; break;
     286    default:  return NUM_CHROMA_FORMAT;
     287  }
     288}
     289
     290static const struct MapStrToProfile
     291{
    234292  const Char* str;
    235293  Profile::Name value;
    236 } strToProfile[] = {
    237   {"none", Profile::NONE},
    238   {"main", Profile::MAIN},
    239   {"main10", Profile::MAIN10},
    240   {"main-still-picture", Profile::MAINSTILLPICTURE},
    241 #if H_MV
    242   {"multiview-main", Profile::MULTIVIEWMAIN},
    243 #if H_3D
    244   {"3d-main"       , Profile::MAIN3D},
    245 #endif
    246 
    247 #endif
     294}
     295strToProfile[] =
     296{
     297  {"none",                 Profile::NONE               },
     298  {"main",                 Profile::MAIN               },
     299  {"main10",               Profile::MAIN10             },
     300  {"main-still-picture",   Profile::MAINSTILLPICTURE   },
     301  {"main-RExt",            Profile::MAINREXT           },
     302  {"high-throughput-RExt", Profile::HIGHTHROUGHPUTREXT }
     303#if NH_MV
     304  ,{"multiview-main"     , Profile::MULTIVIEWMAIN      },
     305#if NH_3D
     306   {"3d-main"            , Profile::MAIN3D             }
     307#endif
     308#endif
     309
    248310};
    249311
    250 static const struct MapStrToTier {
     312static const struct MapStrToExtendedProfile
     313{
     314  const Char* str;
     315  ExtendedProfileName value;
     316}
     317strToExtendedProfile[] =
     318{
     319    {"none",               NONE             },
     320    {"main",               MAIN             },
     321    {"main10",             MAIN10           },
     322    {"main_still_picture",        MAINSTILLPICTURE },
     323    {"main-still-picture",        MAINSTILLPICTURE },
     324    {"main_RExt",                 MAINREXT         },
     325    {"main-RExt",                 MAINREXT         },
     326    {"main_rext",                 MAINREXT         },
     327    {"main-rext",                 MAINREXT         },
     328    {"high_throughput_RExt",      HIGHTHROUGHPUTREXT },
     329    {"high-throughput-RExt",      HIGHTHROUGHPUTREXT },
     330    {"high_throughput_rext",      HIGHTHROUGHPUTREXT },
     331    {"high-throughput-rext",      HIGHTHROUGHPUTREXT },
     332#if NH_MV
     333    {"multiview-main"     , MULTIVIEWMAIN   },
     334#if NH_3D
     335    {"3d-main"            , MAIN3D          },
     336#endif
     337#endif
     338    {"monochrome",         MONOCHROME_8     },
     339    {"monochrome12",       MONOCHROME_12    },
     340    {"monochrome16",       MONOCHROME_16    },
     341    {"main12",             MAIN_12          },
     342    {"main_422_10",        MAIN_422_10      },
     343    {"main_422_12",        MAIN_422_12      },
     344    {"main_444",           MAIN_444         },
     345    {"main_444_10",        MAIN_444_10      },
     346    {"main_444_12",        MAIN_444_12      },
     347    {"main_444_16",        MAIN_444_16      },
     348    {"main_intra",         MAIN_INTRA       },
     349    {"main_10_intra",      MAIN_10_INTRA    },
     350    {"main_12_intra",      MAIN_12_INTRA    },
     351    {"main_422_10_intra",  MAIN_422_10_INTRA},
     352    {"main_422_12_intra",  MAIN_422_12_INTRA},
     353    {"main_444_intra",     MAIN_444_INTRA   },
     354    {"main_444_still_picture",    MAIN_444_STILL_PICTURE },
     355    {"main_444_10_intra",  MAIN_444_10_INTRA},
     356    {"main_444_12_intra",  MAIN_444_12_INTRA},
     357    {"main_444_16_intra",         MAIN_444_16_INTRA},
     358    {"main_444_16_still_picture", MAIN_444_16_STILL_PICTURE }
     359};
     360
     361static const ExtendedProfileName validRExtProfileNames[2/* intraConstraintFlag*/][4/* bit depth constraint 8=0, 10=1, 12=2, 16=3*/][4/*chroma format*/]=
     362{
     363    {
     364        { MONOCHROME_8,  NONE,          NONE,              MAIN_444          }, // 8-bit  inter for 400, 420, 422 and 444
     365        { NONE,          NONE,          MAIN_422_10,       MAIN_444_10       }, // 10-bit inter for 400, 420, 422 and 444
     366        { MONOCHROME_12, MAIN_12,       MAIN_422_12,       MAIN_444_12       }, // 12-bit inter for 400, 420, 422 and 444
     367        { MONOCHROME_16, NONE,          NONE,              MAIN_444_16       }  // 16-bit inter for 400, 420, 422 and 444 (the latter is non standard used for development)
     368    },
     369    {
     370        { NONE,          MAIN_INTRA,    NONE,              MAIN_444_INTRA    }, // 8-bit  intra for 400, 420, 422 and 444
     371        { NONE,          MAIN_10_INTRA, MAIN_422_10_INTRA, MAIN_444_10_INTRA }, // 10-bit intra for 400, 420, 422 and 444
     372        { NONE,          MAIN_12_INTRA, MAIN_422_12_INTRA, MAIN_444_12_INTRA }, // 12-bit intra for 400, 420, 422 and 444
     373        { NONE,          NONE,          NONE,              MAIN_444_16_INTRA }  // 16-bit intra for 400, 420, 422 and 444
     374    }
     375};
     376
     377static const struct MapStrToTier
     378{
    251379  const Char* str;
    252380  Level::Tier value;
    253 } strToTier[] = {
     381}
     382strToTier[] =
     383{
    254384  {"main", Level::MAIN},
    255385  {"high", Level::HIGH},
    256386};
    257387
    258 static const struct MapStrToLevel {
     388static const struct MapStrToLevel
     389{
    259390  const Char* str;
    260391  Level::Name value;
    261 } strToLevel[] = {
     392}
     393strToLevel[] =
     394{
    262395  {"none",Level::NONE},
    263396  {"1",   Level::LEVEL1},
     
    274407  {"6.1", Level::LEVEL6_1},
    275408  {"6.2", Level::LEVEL6_2},
     409  {"8.5", Level::LEVEL8_5},
    276410};
    277411
     412static const struct MapStrToCostMode
     413{
     414  const Char* str;
     415  CostMode    value;
     416}
     417strToCostMode[] =
     418{
     419  {"lossy",                     COST_STANDARD_LOSSY},
     420  {"sequence_level_lossless",   COST_SEQUENCE_LEVEL_LOSSLESS},
     421  {"lossless",                  COST_LOSSLESS_CODING},
     422  {"mixed_lossless_lossy",      COST_MIXED_LOSSLESS_LOSSY_CODING}
     423};
     424
     425static const struct MapStrToScalingListMode
     426{
     427  const Char* str;
     428  ScalingListMode value;
     429}
     430strToScalingListMode[] =
     431{
     432  {"0",       SCALING_LIST_OFF},
     433  {"1",       SCALING_LIST_DEFAULT},
     434  {"2",       SCALING_LIST_FILE_READ},
     435  {"off",     SCALING_LIST_OFF},
     436  {"default", SCALING_LIST_DEFAULT},
     437  {"file",    SCALING_LIST_FILE_READ}
     438};
     439
    278440template<typename T, typename P>
    279 static istream& readStrToEnum(P map[], unsigned long mapLen, istream &in, T &val)
     441static std::string enumToString(P map[], UInt mapLen, const T val)
     442{
     443  for (UInt i = 0; i < mapLen; i++)
     444  {
     445    if (val == map[i].value)
     446    {
     447      return map[i].str;
     448    }
     449  }
     450  return std::string();
     451}
     452
     453template<typename T, typename P>
     454static istream& readStrToEnum(P map[], UInt mapLen, istream &in, T &val)
    280455{
    281456  string str;
    282457  in >> str;
    283458
    284   for (Int i = 0; i < mapLen; i++)
     459  for (UInt i = 0; i < mapLen; i++)
    285460  {
    286461    if (str == map[i].str)
     
    296471}
    297472
    298 static istream& operator>>(istream &in, Profile::Name &profile)
     473//inline to prevent compiler warnings for "unused static function"
     474
     475static inline istream& operator >> (istream &in, ExtendedProfileName &profile)
    299476{
    300   return readStrToEnum(strToProfile, sizeof(strToProfile)/sizeof(*strToProfile), in, profile);
     477  return readStrToEnum(strToExtendedProfile, sizeof(strToExtendedProfile)/sizeof(*strToExtendedProfile), in, profile);
    301478}
    302479
    303 static istream& operator>>(istream &in, Level::Tier &tier)
     480namespace Level
    304481{
    305   return readStrToEnum(strToTier, sizeof(strToTier)/sizeof(*strToTier), in, tier);
     482  static inline istream& operator >> (istream &in, Tier &tier)
     483  {
     484    return readStrToEnum(strToTier, sizeof(strToTier)/sizeof(*strToTier), in, tier);
     485  }
     486
     487  static inline istream& operator >> (istream &in, Name &level)
     488  {
     489    return readStrToEnum(strToLevel, sizeof(strToLevel)/sizeof(*strToLevel), in, level);
     490  }
    306491}
    307492
    308 static istream& operator>>(istream &in, Level::Name &level)
     493static inline istream& operator >> (istream &in, CostMode &mode)
    309494{
    310   return readStrToEnum(strToLevel, sizeof(strToLevel)/sizeof(*strToLevel), in, level);
     495  return readStrToEnum(strToCostMode, sizeof(strToCostMode)/sizeof(*strToCostMode), in, mode);
    311496}
    312497
     498static inline istream& operator >> (istream &in, ScalingListMode &mode)
     499{
     500  return readStrToEnum(strToScalingListMode, sizeof(strToScalingListMode)/sizeof(*strToScalingListMode), in, mode);
     501}
     502
     503template <class T>
     504struct SMultiValueInput
     505{
     506  const T              minValIncl;
     507  const T              maxValIncl; // Use 0 for unlimited
     508  const std::size_t    minNumValuesIncl;
     509  const std::size_t    maxNumValuesIncl; // Use 0 for unlimited
     510        std::vector<T> values;
     511  SMultiValueInput() : minValIncl(0), maxValIncl(0), minNumValuesIncl(0), maxNumValuesIncl(0), values() { }
     512  SMultiValueInput(std::vector<T> &defaults) : minValIncl(0), maxValIncl(0), minNumValuesIncl(0), maxNumValuesIncl(0), values(defaults) { }
     513  SMultiValueInput(const T &minValue, const T &maxValue, std::size_t minNumberValues=0, std::size_t maxNumberValues=0)
     514    : minValIncl(minValue), maxValIncl(maxValue), minNumValuesIncl(minNumberValues), maxNumValuesIncl(maxNumberValues), values()  { }
     515  SMultiValueInput(const T &minValue, const T &maxValue, std::size_t minNumberValues, std::size_t maxNumberValues, const T* defValues, const UInt numDefValues)
     516    : minValIncl(minValue), maxValIncl(maxValue), minNumValuesIncl(minNumberValues), maxNumValuesIncl(maxNumberValues), values(defValues, defValues+numDefValues)  { }
     517  SMultiValueInput<T> &operator=(const std::vector<T> &userValues) { values=userValues; return *this; }
     518  SMultiValueInput<T> &operator=(const SMultiValueInput<T> &userValues) { values=userValues.values; return *this; }
     519};
     520
     521static inline istream& operator >> (istream &in, SMultiValueInput<UInt> &values)
     522{
     523  values.values.clear();
     524  string str;
     525  while (!in.eof())
     526  {
     527    string tmp; in >> tmp; str+=" " + tmp;
     528  }
     529  if (!str.empty())
     530  {
     531    const Char *pStr=str.c_str();
     532    // soak up any whitespace
     533    for(;isspace(*pStr);pStr++);
     534
     535    while (*pStr != 0)
     536    {
     537      Char *eptr;
     538      UInt val=strtoul(pStr, &eptr, 0);
     539      if (*eptr!=0 && !isspace(*eptr) && *eptr!=',')
     540      {
     541        in.setstate(ios::failbit);
     542        break;
     543      }
     544      if (val<values.minValIncl || val>values.maxValIncl)
     545      {
     546        in.setstate(ios::failbit);
     547        break;
     548      }
     549
     550      if (values.maxNumValuesIncl != 0 && values.values.size() >= values.maxNumValuesIncl)
     551      {
     552        in.setstate(ios::failbit);
     553        break;
     554      }
     555      values.values.push_back(val);
     556      // soak up any whitespace and up to 1 comma.
     557      pStr=eptr;
     558      for(;isspace(*pStr);pStr++);
     559      if (*pStr == ',')
     560      {
     561        pStr++;
     562      }
     563      for(;isspace(*pStr);pStr++);
     564    }
     565  }
     566  if (values.values.size() < values.minNumValuesIncl)
     567  {
     568    in.setstate(ios::failbit);
     569  }
     570  return in;
     571}
     572
     573static inline istream& operator >> (istream &in, SMultiValueInput<Int> &values)
     574{
     575  values.values.clear();
     576  string str;
     577  while (!in.eof())
     578  {
     579    string tmp; in >> tmp; str+=" " + tmp;
     580  }
     581  if (!str.empty())
     582  {
     583    const Char *pStr=str.c_str();
     584    // soak up any whitespace
     585    for(;isspace(*pStr);pStr++);
     586
     587    while (*pStr != 0)
     588    {
     589      Char *eptr;
     590      Int val=strtol(pStr, &eptr, 0);
     591      if (*eptr!=0 && !isspace(*eptr) && *eptr!=',')
     592      {
     593        in.setstate(ios::failbit);
     594        break;
     595      }
     596      if (val<values.minValIncl || val>values.maxValIncl)
     597      {
     598        in.setstate(ios::failbit);
     599        break;
     600      }
     601
     602      if (values.maxNumValuesIncl != 0 && values.values.size() >= values.maxNumValuesIncl)
     603      {
     604        in.setstate(ios::failbit);
     605        break;
     606      }
     607      values.values.push_back(val);
     608      // soak up any whitespace and up to 1 comma.
     609      pStr=eptr;
     610      for(;isspace(*pStr);pStr++);
     611      if (*pStr == ',')
     612      {
     613        pStr++;
     614      }
     615      for(;isspace(*pStr);pStr++);
     616    }
     617  }
     618  if (values.values.size() < values.minNumValuesIncl)
     619  {
     620    in.setstate(ios::failbit);
     621  }
     622  return in;
     623}
     624
     625static inline istream& operator >> (istream &in, SMultiValueInput<Bool> &values)
     626{
     627  values.values.clear();
     628  string str;
     629  while (!in.eof())
     630  {
     631    string tmp; in >> tmp; str+=" " + tmp;
     632  }
     633  if (!str.empty())
     634  {
     635    const Char *pStr=str.c_str();
     636    // soak up any whitespace
     637    for(;isspace(*pStr);pStr++);
     638
     639    while (*pStr != 0)
     640    {
     641      Char *eptr;
     642      Int val=strtol(pStr, &eptr, 0);
     643      if (*eptr!=0 && !isspace(*eptr) && *eptr!=',')
     644      {
     645        in.setstate(ios::failbit);
     646        break;
     647      }
     648      if (val<Int(values.minValIncl) || val>Int(values.maxValIncl))
     649      {
     650        in.setstate(ios::failbit);
     651        break;
     652      }
     653
     654      if (values.maxNumValuesIncl != 0 && values.values.size() >= values.maxNumValuesIncl)
     655      {
     656        in.setstate(ios::failbit);
     657        break;
     658      }
     659      values.values.push_back(val!=0);
     660      // soak up any whitespace and up to 1 comma.
     661      pStr=eptr;
     662      for(;isspace(*pStr);pStr++);
     663      if (*pStr == ',')
     664      {
     665        pStr++;
     666      }
     667      for(;isspace(*pStr);pStr++);
     668    }
     669  }
     670  if (values.values.size() < values.minNumValuesIncl)
     671  {
     672    in.setstate(ios::failbit);
     673  }
     674  return in;
     675}
     676
     677static Void
     678automaticallySelectRExtProfile(const Bool bUsingGeneralRExtTools,
     679                               const Bool bUsingChromaQPAdjustment,
     680                               const Bool bUsingExtendedPrecision,
     681                               const Bool bIntraConstraintFlag,
     682                               UInt &bitDepthConstraint,
     683                               ChromaFormat &chromaFormatConstraint,
     684                               const Int  maxBitDepth,
     685                               const ChromaFormat chromaFormat)
     686{
     687  // Try to choose profile, according to table in Q1013.
     688  UInt trialBitDepthConstraint=maxBitDepth;
     689  if (trialBitDepthConstraint<8)
     690  {
     691    trialBitDepthConstraint=8;
     692  }
     693  else if (trialBitDepthConstraint==9 || trialBitDepthConstraint==11)
     694  {
     695    trialBitDepthConstraint++;
     696  }
     697  else if (trialBitDepthConstraint>12)
     698  {
     699    trialBitDepthConstraint=16;
     700  }
     701
     702  // both format and bit depth constraints are unspecified
     703  if (bUsingExtendedPrecision || trialBitDepthConstraint==16)
     704  {
     705    bitDepthConstraint = 16;
     706    chromaFormatConstraint = (!bIntraConstraintFlag && chromaFormat==CHROMA_400) ? CHROMA_400 : CHROMA_444;
     707  }
     708  else if (bUsingGeneralRExtTools)
     709  {
     710    if (chromaFormat == CHROMA_400 && !bIntraConstraintFlag)
     711    {
     712      bitDepthConstraint = 16;
     713      chromaFormatConstraint = CHROMA_400;
     714    }
     715    else
     716    {
     717      bitDepthConstraint = trialBitDepthConstraint;
     718      chromaFormatConstraint = CHROMA_444;
     719    }
     720  }
     721  else if (chromaFormat == CHROMA_400)
     722  {
     723    if (bIntraConstraintFlag)
     724    {
     725      chromaFormatConstraint = CHROMA_420; // there is no intra 4:0:0 profile.
     726      bitDepthConstraint     = trialBitDepthConstraint;
     727    }
     728    else
     729    {
     730      chromaFormatConstraint = CHROMA_400;
     731      bitDepthConstraint     = trialBitDepthConstraint == 8 ? 8 : 12;
     732    }
     733  }
     734  else
     735  {
     736    bitDepthConstraint = trialBitDepthConstraint;
     737    chromaFormatConstraint = chromaFormat;
     738    if (bUsingChromaQPAdjustment && chromaFormat == CHROMA_420)
     739    {
     740      chromaFormatConstraint = CHROMA_422; // 4:2:0 cannot use the chroma qp tool.
     741    }
     742    if (chromaFormatConstraint == CHROMA_422 && bitDepthConstraint == 8)
     743    {
     744      bitDepthConstraint = 10; // there is no 8-bit 4:2:2 profile.
     745    }
     746    if (chromaFormatConstraint == CHROMA_420 && !bIntraConstraintFlag)
     747    {
     748      bitDepthConstraint = 12; // there is no 8 or 10-bit 4:2:0 inter RExt profile.
     749    }
     750  }
     751}
    313752// ====================================================================================================================
    314753// Public member functions
     
    322761{
    323762  Bool do_help = false;
    324  
    325 #if !H_MV
     763
     764#if !NH_MV
    326765  string cfg_InputFile;
    327766#endif
    328767  string cfg_BitstreamFile;
    329 #if !H_MV
     768#if !NH_MV
    330769  string cfg_ReconFile;
    331770#endif
    332 #if H_MV
     771#if NH_MV
    333772  vector<Int>   cfg_dimensionLength;
    334773  string        cfg_profiles;
    335774  string        cfg_levels;
    336775  string        cfg_tiers;
    337 #if H_3D
     776#if NH_3D
    338777  cfg_dimensionLength.push_back( 2  );  // depth
    339778  cfg_dimensionLength.push_back( 32 );  // texture
     
    343782#endif
    344783  string cfg_dQPFile;
    345   string cfgColumnWidth;
    346   string cfgRowHeight;
    347784  string cfg_ScalingListFile;
    348   string cfg_startOfCodedInterval;
    349   string cfg_codedPivotValue;
    350   string cfg_targetPivotValue;
     785
     786  Int tmpChromaFormat;
     787  Int tmpInputChromaFormat;
     788  Int tmpConstraintChromaFormat;
     789  string inputColourSpaceConvert;
     790#if NH_MV
     791  std::vector<ExtendedProfileName> extendedProfiles;
     792#else
     793  ExtendedProfileName extendedProfile;
     794#endif
     795  Int saoOffsetBitShift[MAX_NUM_CHANNEL_TYPE];
     796
     797  // Multi-value input fields:                                // minval, maxval (incl), min_entries, max_entries (incl) [, default values, number of default values]
     798  SMultiValueInput<UInt> cfg_ColumnWidth                     (0, std::numeric_limits<UInt>::max(), 0, std::numeric_limits<UInt>::max());
     799  SMultiValueInput<UInt> cfg_RowHeight                       (0, std::numeric_limits<UInt>::max(), 0, std::numeric_limits<UInt>::max());
     800  SMultiValueInput<Int>  cfg_startOfCodedInterval            (std::numeric_limits<Int>::min(), std::numeric_limits<Int>::max(), 0, 1<<16);
     801  SMultiValueInput<Int>  cfg_codedPivotValue                 (std::numeric_limits<Int>::min(), std::numeric_limits<Int>::max(), 0, 1<<16);
     802  SMultiValueInput<Int>  cfg_targetPivotValue                (std::numeric_limits<Int>::min(), std::numeric_limits<Int>::max(), 0, 1<<16);
     803
     804  const UInt defaultInputKneeCodes[3]  = { 600, 800, 900 };
     805  const UInt defaultOutputKneeCodes[3] = { 100, 250, 450 };
     806  SMultiValueInput<UInt> cfg_kneeSEIInputKneePointValue      (1,  999, 0, 999, defaultInputKneeCodes,  sizeof(defaultInputKneeCodes )/sizeof(UInt));
     807  SMultiValueInput<UInt> cfg_kneeSEIOutputKneePointValue     (0, 1000, 0, 999, defaultOutputKneeCodes, sizeof(defaultOutputKneeCodes)/sizeof(UInt));
     808  const Int defaultPrimaryCodes[6]     = { 0,50000, 0,0, 50000,0 };
     809  const Int defaultWhitePointCode[2]   = { 16667, 16667 };
     810  SMultiValueInput<Int>  cfg_DisplayPrimariesCode            (0, 50000, 3, 3, defaultPrimaryCodes,   sizeof(defaultPrimaryCodes  )/sizeof(Int));
     811  SMultiValueInput<Int>  cfg_DisplayWhitePointCode           (0, 50000, 2, 2, defaultWhitePointCode, sizeof(defaultWhitePointCode)/sizeof(Int));
     812
     813  SMultiValueInput<Bool> cfg_timeCodeSeiTimeStampFlag        (0,  1, 0, MAX_TIMECODE_SEI_SETS);
     814  SMultiValueInput<Bool> cfg_timeCodeSeiNumUnitFieldBasedFlag(0,  1, 0, MAX_TIMECODE_SEI_SETS);
     815  SMultiValueInput<Int>  cfg_timeCodeSeiCountingType         (0,  6, 0, MAX_TIMECODE_SEI_SETS);
     816  SMultiValueInput<Bool> cfg_timeCodeSeiFullTimeStampFlag    (0,  1, 0, MAX_TIMECODE_SEI_SETS);
     817  SMultiValueInput<Bool> cfg_timeCodeSeiDiscontinuityFlag    (0,  1, 0, MAX_TIMECODE_SEI_SETS);
     818  SMultiValueInput<Bool> cfg_timeCodeSeiCntDroppedFlag       (0,  1, 0, MAX_TIMECODE_SEI_SETS);
     819  SMultiValueInput<Int>  cfg_timeCodeSeiNumberOfFrames       (0,511, 0, MAX_TIMECODE_SEI_SETS);
     820  SMultiValueInput<Int>  cfg_timeCodeSeiSecondsValue         (0, 59, 0, MAX_TIMECODE_SEI_SETS);
     821  SMultiValueInput<Int>  cfg_timeCodeSeiMinutesValue         (0, 59, 0, MAX_TIMECODE_SEI_SETS);
     822  SMultiValueInput<Int>  cfg_timeCodeSeiHoursValue           (0, 23, 0, MAX_TIMECODE_SEI_SETS);
     823  SMultiValueInput<Bool> cfg_timeCodeSeiSecondsFlag          (0,  1, 0, MAX_TIMECODE_SEI_SETS);
     824  SMultiValueInput<Bool> cfg_timeCodeSeiMinutesFlag          (0,  1, 0, MAX_TIMECODE_SEI_SETS);
     825  SMultiValueInput<Bool> cfg_timeCodeSeiHoursFlag            (0,  1, 0, MAX_TIMECODE_SEI_SETS);
     826  SMultiValueInput<Int>  cfg_timeCodeSeiTimeOffsetLength     (0, 31, 0, MAX_TIMECODE_SEI_SETS);
     827  SMultiValueInput<Int>  cfg_timeCodeSeiTimeOffsetValue      (std::numeric_limits<Int>::min(), std::numeric_limits<Int>::max(), 0, MAX_TIMECODE_SEI_SETS);
     828  Int warnUnknowParameter = 0;
     829
    351830  po::Options opts;
    352831  opts.addOptions()
    353   ("help", do_help, false, "this help text")
    354   ("c", po::parseConfigFile, "configuration file name")
    355  
     832  ("help",                                            do_help,                                          false, "this help text")
     833  ("c",    po::parseConfigFile, "configuration file name")
     834  ("WarnUnknowParameter,w",                           warnUnknowParameter,                                  0, "warn for unknown configuration parameters instead of failing")
     835
    356836  // File, I/O and source parameters
    357 #if H_MV
     837#if NH_MV
    358838  ("InputFile_%d,i_%d",       m_pchInputFileList,       (char *) 0 , MAX_NUM_LAYER_IDS , "original Yuv input file name %d")
    359839#else
    360   ("InputFile,i",           cfg_InputFile,     string(""), "Original YUV input file name")
    361 #endif
    362   ("BitstreamFile,b",       cfg_BitstreamFile, string(""), "Bitstream output file name")
    363 #if H_MV
     840  ("InputFile,i",                                     cfg_InputFile,                               string(""), "Original YUV input file name")
     841#endif
     842  ("BitstreamFile,b",                                 cfg_BitstreamFile,                          string(""), "Bitstream output file name")
     843#if NH_MV
    364844  ("ReconFile_%d,o_%d",       m_pchReconFileList,       (char *) 0 , MAX_NUM_LAYER_IDS , "reconstructed Yuv output file name %d")
    365845#else
    366   ("ReconFile,o",           cfg_ReconFile,     string(""), "Reconstructed YUV output file name")
    367 #endif
    368 #if H_MV
     846  ("ReconFile,o",                                     cfg_ReconFile,                               string(""), "Reconstructed YUV output file name")
     847#endif
     848#if NH_MV
    369849  ("NumberOfLayers",        m_numberOfLayers     , 1,                     "Number of layers")
    370 #if !H_3D
     850#if !NH_3D
    371851  ("ScalabilityMask",       m_scalabilityMask    , 2                    , "Scalability Mask: 2: Multiview, 8: Auxiliary, 10: Multiview + Auxiliary")   
    372852#else
     
    377857  ("ViewId",                m_viewId             , std::vector<Int>(1,0), "View Id per View Order Index")
    378858  ("AuxId",                 m_auxId              , std::vector<Int>(1,0), "AuxId per layer")
    379 #if H_3D
     859#if NH_3D
    380860  ("DepthFlag",             m_depthFlag          , std::vector<Int>(1,0), "Depth Flag")
    381 #if H_3D_DIM
    382   ("DLT",                   m_useDLT,           true,  "Depth lookup table")
    383 #endif
    384 #if H_3D
    385 #endif
    386861#endif
    387862  ("TargetEncLayerIdList",  m_targetEncLayerIdList, std::vector<Int>(0,0), "LayerIds in Nuh to be encoded") 
    388   ("LayerIdInNuh",          m_layerIdInNuh       , std::vector<Int>(1,0), "LayerId in Nuh") 
    389   ("SplittingFlag",         m_splittingFlag      , false                , "Splitting Flag")   
     863  ("LayerIdInNuh",          m_layerIdInNuh        , std::vector<Int>(1,0), "LayerId in Nuh") 
     864  ("SplittingFlag",         m_splittingFlag       , false                , "Splitting Flag")   
    390865
    391866  // Layer Sets + Output Layer Sets + Profile Tier Level
     
    406881  ("DependencyTypes_%d",    m_dependencyTypes    , std::vector<Int>(0,0), MAX_NUM_LAYERS, "Dependency types of direct reference layers, 0: Sample 1: Motion 2: Sample+Motion")
    407882#endif
    408   ("SourceWidth,-wdt",      m_iSourceWidth,        0, "Source picture width")
    409   ("SourceHeight,-hgt",     m_iSourceHeight,       0, "Source picture height")
    410   ("InputBitDepth",         m_inputBitDepthY,    8, "Bit-depth of input file")
    411   ("OutputBitDepth",        m_outputBitDepthY,   0, "Bit-depth of output file (default:InternalBitDepth)")
    412   ("InternalBitDepth",      m_internalBitDepthY, 0, "Bit-depth the codec operates at. (default:InputBitDepth)"
    413                                                        "If different to InputBitDepth, source data will be converted")
    414   ("InputBitDepthC",        m_inputBitDepthC,    0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)")
    415   ("OutputBitDepthC",       m_outputBitDepthC,   0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
    416   ("InternalBitDepthC",     m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)")
    417   ("ConformanceMode",       m_conformanceWindowMode,  0, "Deprecated alias of ConformanceWindowMode")
    418   ("ConformanceWindowMode", m_conformanceWindowMode,  0, "Window conformance mode (0: no window, 1:automatic padding, 2:padding, 3:conformance")
    419   ("HorizontalPadding,-pdx",m_aiPad[0],            0, "Horizontal source padding for conformance window mode 2")
    420   ("VerticalPadding,-pdy",  m_aiPad[1],            0, "Vertical source padding for conformance window mode 2")
    421   ("ConfLeft",              m_confWinLeft,            0, "Deprecated alias of ConfWinLeft")
    422   ("ConfRight",             m_confWinRight,           0, "Deprecated alias of ConfWinRight")
    423   ("ConfTop",               m_confWinTop,             0, "Deprecated alias of ConfWinTop")
    424   ("ConfBottom",            m_confWinBottom,          0, "Deprecated alias of ConfWinBottom")
    425   ("ConfWinLeft",           m_confWinLeft,            0, "Left offset for window conformance mode 3")
    426   ("ConfWinRight",          m_confWinRight,           0, "Right offset for window conformance mode 3")
    427   ("ConfWinTop",            m_confWinTop,             0, "Top offset for window conformance mode 3")
    428   ("ConfWinBottom",         m_confWinBottom,          0, "Bottom offset for window conformance mode 3")
    429   ("FrameRate,-fr",         m_iFrameRate,          0, "Frame rate")
    430   ("FrameSkip,-fs",         m_FrameSkip,          0u, "Number of frames to skip at start of input YUV")
    431   ("FramesToBeEncoded,f",   m_framesToBeEncoded,   0, "Number of frames to be encoded (default=all)")
     883  ("SourceWidth,-wdt",                                m_iSourceWidth,                                       0, "Source picture width")
     884  ("SourceHeight,-hgt",                               m_iSourceHeight,                                      0, "Source picture height")
     885  ("InputBitDepth",                                   m_inputBitDepth[CHANNEL_TYPE_LUMA],                   8, "Bit-depth of input file")
     886  ("OutputBitDepth",                                  m_outputBitDepth[CHANNEL_TYPE_LUMA],                  0, "Bit-depth of output file (default:InternalBitDepth)")
     887  ("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)")
     888  ("InternalBitDepth",                                m_internalBitDepth[CHANNEL_TYPE_LUMA],                0, "Bit-depth the codec operates at. (default:MSBExtendedBitDepth). If different to MSBExtendedBitDepth, source data will be converted")
     889  ("InputBitDepthC",                                  m_inputBitDepth[CHANNEL_TYPE_CHROMA],                 0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)")
     890  ("OutputBitDepthC",                                 m_outputBitDepth[CHANNEL_TYPE_CHROMA],                0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
     891  ("MSBExtendedBitDepthC",                            m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA],           0, "As per MSBExtendedBitDepth but for chroma component. (default:MSBExtendedBitDepth)")
     892  ("InternalBitDepthC",                               m_internalBitDepth[CHANNEL_TYPE_CHROMA],              0, "As per InternalBitDepth but for chroma component. (default:InternalBitDepth)")
     893  ("ExtendedPrecision",                               m_extendedPrecisionProcessingFlag,                false, "Increased internal accuracies to support high bit depths (not valid in V1 profiles)")
     894  ("HighPrecisionPredictionWeighting",                m_highPrecisionOffsetsEnabledFlag,                false, "Use high precision option for weighted prediction (not valid in V1 profiles)")
     895  ("InputColourSpaceConvert",                         inputColourSpaceConvert,                     string(""), "Colour space conversion to apply to input video. Permitted values are (empty string=UNCHANGED) " + getListOfColourSpaceConverts(true))
     896  ("SNRInternalColourSpace",                          m_snrInternalColourSpace,                         false, "If true, then no colour space conversion is applied prior to SNR, otherwise inverse of input is applied.")
     897  ("OutputInternalColourSpace",                       m_outputInternalColourSpace,                      false, "If true, then no colour space conversion is applied for reconstructed video, otherwise inverse of input is applied.")
     898  ("InputChromaFormat",                               tmpInputChromaFormat,                               420, "InputChromaFormatIDC")
     899  ("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")
     900  ("PrintFrameMSE",                                   m_printFrameMSE,                                  false, "0 (default) emit only bit count and PSNRs for each frame, 1 = also emit MSE values")
     901  ("PrintSequenceMSE",                                m_printSequenceMSE,                               false, "0 (default) emit only bit rate and PSNRs for the whole sequence, 1 = also emit MSE values")
     902  ("CabacZeroWordPaddingEnabled",                     m_cabacZeroWordPaddingEnabled,                     true, "0 do not add conforming cabac-zero-words to bit streams, 1 (default) = add cabac-zero-words as required")
     903  ("ChromaFormatIDC,-cf",                             tmpChromaFormat,                                      0, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat)")
     904  ("ConformanceMode",                                 m_conformanceWindowMode,                              0, "Deprecated alias of ConformanceWindowMode")
     905  ("ConformanceWindowMode",                           m_conformanceWindowMode,                              0, "Window conformance mode (0: no window, 1:automatic padding, 2:padding, 3:conformance")
     906  ("HorizontalPadding,-pdx",                          m_aiPad[0],                                           0, "Horizontal source padding for conformance window mode 2")
     907  ("VerticalPadding,-pdy",                            m_aiPad[1],                                           0, "Vertical source padding for conformance window mode 2")
     908  ("ConfLeft",                                        m_confWinLeft,                                        0, "Deprecated alias of ConfWinLeft")
     909  ("ConfRight",                                       m_confWinRight,                                       0, "Deprecated alias of ConfWinRight")
     910  ("ConfTop",                                         m_confWinTop,                                         0, "Deprecated alias of ConfWinTop")
     911  ("ConfBottom",                                      m_confWinBottom,                                      0, "Deprecated alias of ConfWinBottom")
     912  ("ConfWinLeft",                                     m_confWinLeft,                                        0, "Left offset for window conformance mode 3")
     913  ("ConfWinRight",                                    m_confWinRight,                                       0, "Right offset for window conformance mode 3")
     914  ("ConfWinTop",                                      m_confWinTop,                                         0, "Top offset for window conformance mode 3")
     915  ("ConfWinBottom",                                   m_confWinBottom,                                      0, "Bottom offset for window conformance mode 3")
     916  ("FrameRate,-fr",                                   m_iFrameRate,                                         0, "Frame rate")
     917  ("FrameSkip,-fs",                                   m_FrameSkip,                                         0u, "Number of frames to skip at start of input YUV")
     918  ("FramesToBeEncoded,f",                             m_framesToBeEncoded,                                  0, "Number of frames to be encoded (default=all)")
     919  ("ClipInputVideoToRec709Range",                     m_bClipInputVideoToRec709Range,                   false, "If true then clip input video to the Rec. 709 Range on loading when InternalBitDepth is less than MSBExtendedBitDepth")
     920  ("ClipOutputVideoToRec709Range",                    m_bClipOutputVideoToRec709Range,                  false, "If true then clip output video to the Rec. 709 Range on saving when OutputBitDepth is less than InternalBitDepth")
     921  ("SummaryOutFilename",                              m_summaryOutFilename,                          string(), "Filename to use for producing summary output file. If empty, do not produce a file.")
     922  ("SummaryPicFilenameBase",                          m_summaryPicFilenameBase,                      string(), "Base filename to use for producing summary picture output files. The actual filenames used will have I.txt, P.txt and B.txt appended. If empty, do not produce a file.")
     923  ("SummaryVerboseness",                              m_summaryVerboseness,                                0u, "Specifies the level of the verboseness of the text output")
    432924
    433925  //Field coding parameters
    434   ("FieldCoding", m_isField, false, "Signals if it's a field based coding")
    435   ("TopFieldFirst, Tff", m_isTopFieldFirst, false, "In case of field based coding, signals whether if it's a top field first or not")
    436  
     926  ("FieldCoding",                                     m_isField,                                        false, "Signals if it's a field based coding")
     927  ("TopFieldFirst, Tff",                              m_isTopFieldFirst,                                false, "In case of field based coding, signals whether if it's a top field first or not")
     928  ("EfficientFieldIRAPEnabled",                       m_bEfficientFieldIRAPEnabled,                      true, "Enable to code fields in a specific, potentially more efficient, order.")
     929  ("HarmonizeGopFirstFieldCoupleEnabled",             m_bHarmonizeGopFirstFieldCoupleEnabled,            true, "Enables harmonization of Gop first field couple")
     930
    437931  // Profile and level
    438 #if H_MV
    439   ("Profile", cfg_profiles,   string(""),          "Profile in VpsProfileTierLevel (Indication only)")
    440   ("Level",   cfg_levels ,    string(""),          "Level indication in VpsProfileTierLevel (Indication only)")
    441   ("Tier",    cfg_tiers  ,    string(""),          "Tier indication in VpsProfileTierLevel (Indication only)")
    442   ("InblFlag",m_inblFlag ,    std::vector<Bool>(0), "InblFlags in VpsProfileTierLevel (Indication only)" )
     932#if NH_MV
     933  ("Profile" ,                                        cfg_profiles,                                string(""), "Profile in VpsProfileTierLevel (Indication only)")
     934  ("Level"   ,                                        cfg_levels ,                                 string(""), "Level indication in VpsProfileTierLevel (Indication only)")
     935  ("Tier"    ,                                        cfg_tiers  ,                                 string(""), "Tier indication in VpsProfileTierLevel (Indication only)")
     936  ("InblFlag",                                        m_inblFlag ,                       std::vector<Bool>(0), "InblFlags in VpsProfileTierLevel (Indication only)" )
    443937#else
    444   ("Profile", m_profile,   Profile::NONE, "Profile to be used when encoding (Incomplete)")
    445   ("Level",   m_level,     Level::NONE,   "Level limit to be used, eg 5.1 (Incomplete)")
    446   ("Tier",    m_levelTier, Level::MAIN,   "Tier to use for interpretation of --Level")
    447 #endif
    448   ("ProgressiveSource", m_progressiveSourceFlag, false, "Indicate that source is progressive")
    449   ("InterlacedSource",  m_interlacedSourceFlag,  false, "Indicate that source is interlaced")
    450   ("NonPackedSource",   m_nonPackedConstraintFlag, false, "Indicate that source does not contain frame packing")
    451   ("FrameOnly",         m_frameOnlyConstraintFlag, false, "Indicate that the bitstream contains only frames")
    452  
     938  ("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")
     939  ("Level",                                           m_level,                                    Level::NONE, "Level limit to be used, eg 5.1, or none")
     940  ("Tier",                                            m_levelTier,                                Level::MAIN, "Tier to use for interpretation of --Level (main or high only)")
     941#endif
     942  ("MaxBitDepthConstraint",                           m_bitDepthConstraint,                                0u, "Bit depth to use for profile-constraint for RExt profiles. 0=automatically choose based upon other parameters")
     943  ("MaxChromaFormatConstraint",                       tmpConstraintChromaFormat,                            0, "Chroma-format to use for the profile-constraint for RExt profiles. 0=automatically choose based upon other parameters")
     944  ("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)")
     945  ("OnePictureOnlyConstraintFlag",                    m_onePictureOnlyConstraintFlag,                   false, "Value of general_one_picture_only_constraint_flag to use for RExt profiles (not used if an explicit RExt sub-profile is specified)")
     946  ("LowerBitRateConstraintFlag",                      m_lowerBitRateConstraintFlag,                      true, "Value of general_lower_bit_rate_constraint_flag to use for RExt profiles")
     947
     948  ("ProgressiveSource",                               m_progressiveSourceFlag,                          false, "Indicate that source is progressive")
     949  ("InterlacedSource",                                m_interlacedSourceFlag,                           false, "Indicate that source is interlaced")
     950  ("NonPackedSource",                                 m_nonPackedConstraintFlag,                        false, "Indicate that source does not contain frame packing")
     951  ("FrameOnly",                                       m_frameOnlyConstraintFlag,                        false, "Indicate that the bitstream contains only frames")
     952
    453953  // Unit definition parameters
    454   ("MaxCUWidth",              m_uiMaxCUWidth,             64u)
    455   ("MaxCUHeight",             m_uiMaxCUHeight,            64u)
     954  ("MaxCUWidth",                                      m_uiMaxCUWidth,                                     64u)
     955  ("MaxCUHeight",                                     m_uiMaxCUHeight,                                    64u)
    456956  // todo: remove defaults from MaxCUSize
    457   ("MaxCUSize,s",             m_uiMaxCUWidth,             64u, "Maximum CU size")
    458   ("MaxCUSize,s",             m_uiMaxCUHeight,            64u, "Maximum CU size")
    459   ("MaxPartitionDepth,h",     m_uiMaxCUDepth,              4u, "CU depth")
    460  
    461   ("QuadtreeTULog2MaxSize",   m_uiQuadtreeTULog2MaxSize,   6u, "Maximum TU size in logarithm base 2")
    462   ("QuadtreeTULog2MinSize",   m_uiQuadtreeTULog2MinSize,   2u, "Minimum TU size in logarithm base 2")
    463  
    464   ("QuadtreeTUMaxDepthIntra", m_uiQuadtreeTUMaxDepthIntra, 1u, "Depth of TU tree for intra CUs")
    465   ("QuadtreeTUMaxDepthInter", m_uiQuadtreeTUMaxDepthInter, 2u, "Depth of TU tree for inter CUs")
    466 #if H_MV 
     957  ("MaxCUSize,s",                                     m_uiMaxCUWidth,                                     64u, "Maximum CU size")
     958  ("MaxCUSize,s",                                     m_uiMaxCUHeight,                                    64u, "Maximum CU size")
     959  ("MaxPartitionDepth,h",                             m_uiMaxCUDepth,                                      4u, "CU depth")
     960
     961  ("QuadtreeTULog2MaxSize",                           m_uiQuadtreeTULog2MaxSize,                           6u, "Maximum TU size in logarithm base 2")
     962  ("QuadtreeTULog2MinSize",                           m_uiQuadtreeTULog2MinSize,                           2u, "Minimum TU size in logarithm base 2")
     963
     964  ("QuadtreeTUMaxDepthIntra",                         m_uiQuadtreeTUMaxDepthIntra,                        1u, "Depth of TU tree for intra CUs")
     965  ("QuadtreeTUMaxDepthInter",                         m_uiQuadtreeTUMaxDepthInter,                        2u, "Depth of TU tree for inter CUs")
     966#if NH_MV 
    467967  // Coding structure parameters
    468   ("IntraPeriod,-ip",         m_iIntraPeriod,std::vector<Int>(1,-1), "Intra period in frames, (-1: only first frame), per layer")
     968  ("IntraPeriod,-ip",                                 m_iIntraPeriod,std::vector<Int>(1,-1)                  , "Intra period in frames, (-1: only first frame), per layer")
    469969#else
    470970  // Coding structure paramters
    471 ("IntraPeriod,-ip",         m_iIntraPeriod,              -1, "Intra period in frames, (-1: only first frame)")
    472 #endif
    473 #if ALLOW_RECOVERY_POINT_AS_RAP
    474   ("DecodingRefreshType,-dr", m_iDecodingRefreshType,       0, "Intra refresh type (0:none 1:CRA 2:IDR 3:RecPointSEI)")
    475 #else
    476   ("DecodingRefreshType,-dr", m_iDecodingRefreshType,       0, "Intra refresh type (0:none 1:CRA 2:IDR)")
    477 #endif
    478   ("GOPSize,g",               m_iGOPSize,                   1, "GOP size of temporal structure")
    479   // motion options
    480   ("FastSearch",              m_iFastSearch,                1, "0:Full search  1:Diamond  2:PMVFAST")
    481   ("SearchRange,-sr",         m_iSearchRange,              96, "Motion search range")
    482 #if H_MV
     971  ("IntraPeriod,-ip",                                 m_iIntraPeriod,                                      -1, "Intra period in frames, (-1: only first frame)")
     972#endif
     973  ("DecodingRefreshType,-dr",                         m_iDecodingRefreshType,                               0, "Intra refresh type (0:none 1:CRA 2:IDR 3:RecPointSEI)")
     974  ("GOPSize,g",                                       m_iGOPSize,                                           1, "GOP size of temporal structure")
     975
     976  // motion search options
     977  ("DisableIntraInInter",                             m_bDisableIntraPUsInInterSlices,                  false, "Flag to disable intra PUs in inter slices")
     978  ("FastSearch",                                      m_iFastSearch,                                        1, "0:Full search  1:Diamond  2:PMVFAST")
     979  ("SearchRange,-sr",                                 m_iSearchRange,                                      96, "Motion search range")
     980#if NH_MV
    483981  ("DispSearchRangeRestriction",  m_bUseDisparitySearchRangeRestriction, false, "restrict disparity search range")
    484982  ("VerticalDispSearchRange",     m_iVerticalDisparitySearchRange, 56, "vertical disparity search range")
    485983#endif
    486   ("BipredSearchRange",       m_bipredSearchRange,          4, "Motion search range for bipred refinement")
    487   ("HadamardME",              m_bUseHADME,               true, "Hadamard ME for fractional-pel")
    488   ("ASR",                     m_bUseASR,                false, "Adaptive motion search range")
     984  ("BipredSearchRange",                               m_bipredSearchRange,                                  4, "Motion search range for bipred refinement")
     985  ("ClipForBiPredMEEnabled",                          m_bClipForBiPredMeEnabled,                        false, "Enables clipping in the Bi-Pred ME. It is disabled to reduce encoder run-time")
     986  ("FastMEAssumingSmootherMVEnabled",                 m_bFastMEAssumingSmootherMVEnabled,                true, "Enables fast ME assuming a smoother MV.")
     987
     988  ("HadamardME",                                      m_bUseHADME,                                       true, "Hadamard ME for fractional-pel")
     989  ("ASR",                                             m_bUseASR,                                        false, "Adaptive motion search range")
    489990
    490991  // Mode decision parameters
    491   ("LambdaModifier0,-LM0", m_adLambdaModifier[ 0 ], ( Double )1.0, "Lambda modifier for temporal layer 0")
    492   ("LambdaModifier1,-LM1", m_adLambdaModifier[ 1 ], ( Double )1.0, "Lambda modifier for temporal layer 1")
    493   ("LambdaModifier2,-LM2", m_adLambdaModifier[ 2 ], ( Double )1.0, "Lambda modifier for temporal layer 2")
    494   ("LambdaModifier3,-LM3", m_adLambdaModifier[ 3 ], ( Double )1.0, "Lambda modifier for temporal layer 3")
    495   ("LambdaModifier4,-LM4", m_adLambdaModifier[ 4 ], ( Double )1.0, "Lambda modifier for temporal layer 4")
    496   ("LambdaModifier5,-LM5", m_adLambdaModifier[ 5 ], ( Double )1.0, "Lambda modifier for temporal layer 5")
    497   ("LambdaModifier6,-LM6", m_adLambdaModifier[ 6 ], ( Double )1.0, "Lambda modifier for temporal layer 6")
     992  ("LambdaModifier0,-LM0",                            m_adLambdaModifier[ 0 ],                  ( Double )1.0, "Lambda modifier for temporal layer 0")
     993  ("LambdaModifier1,-LM1",                            m_adLambdaModifier[ 1 ],                  ( Double )1.0, "Lambda modifier for temporal layer 1")
     994  ("LambdaModifier2,-LM2",                            m_adLambdaModifier[ 2 ],                  ( Double )1.0, "Lambda modifier for temporal layer 2")
     995  ("LambdaModifier3,-LM3",                            m_adLambdaModifier[ 3 ],                  ( Double )1.0, "Lambda modifier for temporal layer 3")
     996  ("LambdaModifier4,-LM4",                            m_adLambdaModifier[ 4 ],                  ( Double )1.0, "Lambda modifier for temporal layer 4")
     997  ("LambdaModifier5,-LM5",                            m_adLambdaModifier[ 5 ],                  ( Double )1.0, "Lambda modifier for temporal layer 5")
     998  ("LambdaModifier6,-LM6",                            m_adLambdaModifier[ 6 ],                  ( Double )1.0, "Lambda modifier for temporal layer 6")
    498999
    4991000  /* Quantization parameters */
    500 #if H_MV
     1001#if NH_MV
    5011002  ("QP,q",          m_fQP, std::vector<double>(1,30.0), "Qp values for each layer, if value is float, QP is switched once during encoding")
    5021003#else
    503   ("QP,q",          m_fQP,             30.0, "Qp value, if value is float, QP is switched once during encoding")
    504 #endif
    505   ("DeltaQpRD,-dqr",m_uiDeltaQpRD,       0u, "max dQp offset for slice")
    506   ("MaxDeltaQP,d",  m_iMaxDeltaQP,        0, "max dQp offset for block")
    507   ("MaxCuDQPDepth,-dqd",  m_iMaxCuDQPDepth,        0, "max depth for a minimum CuDQP")
    508 
    509   ("CbQpOffset,-cbqpofs",  m_cbQpOffset,        0, "Chroma Cb QP Offset")
    510   ("CrQpOffset,-crqpofs",  m_crQpOffset,        0, "Chroma Cr QP Offset")
     1004  ("QP,q",                                            m_fQP,                                             30.0, "Qp value, if value is float, QP is switched once during encoding")
     1005#endif
     1006  ("DeltaQpRD,-dqr",                                  m_uiDeltaQpRD,                                       0u, "max dQp offset for slice")
     1007  ("MaxDeltaQP,d",                                    m_iMaxDeltaQP,                                        0, "max dQp offset for block")
     1008  ("MaxCuDQPDepth,-dqd",                              m_iMaxCuDQPDepth,                                     0, "max depth for a minimum CuDQP")
     1009  ("MaxCUChromaQpAdjustmentDepth",                    m_diffCuChromaQpOffsetDepth,                         -1, "Maximum depth for CU chroma Qp adjustment - set less than 0 to disable")
     1010  ("FastDeltaQP",                                     m_bFastDeltaQP,                                   false, "Fast Delta QP Algorithm")
     1011
     1012  ("CbQpOffset,-cbqpofs",                             m_cbQpOffset,                                         0, "Chroma Cb QP Offset")
     1013  ("CrQpOffset,-crqpofs",                             m_crQpOffset,                                         0, "Chroma Cr QP Offset")
    5111014
    5121015#if ADAPTIVE_QP_SELECTION
    513   ("AdaptiveQpSelection,-aqps",   m_bUseAdaptQpSelect,           false, "AdaptiveQpSelection")
    514 #endif
    515 
    516   ("AdaptiveQP,-aq",                m_bUseAdaptiveQP,           false, "QP adaptation based on a psycho-visual model")
    517   ("MaxQPAdaptationRange,-aqr",     m_iQPAdaptationRange,           6, "QP adaptation range")
    518   ("dQPFile,m",                     cfg_dQPFile,           string(""), "dQP file name")
    519   ("RDOQ",                          m_useRDOQ,                  true )
    520   ("RDOQTS",                        m_useRDOQTS,                true )
    521   ("RDpenalty",                     m_rdPenalty,                0,  "RD-penalty for 32x32 TU for intra in non-intra slices. 0:disbaled  1:RD-penalty  2:maximum RD-penalty")
    522  
     1016  ("AdaptiveQpSelection,-aqps",                       m_bUseAdaptQpSelect,                              false, "AdaptiveQpSelection")
     1017#endif
     1018
     1019  ("AdaptiveQP,-aq",                                  m_bUseAdaptiveQP,                                 false, "QP adaptation based on a psycho-visual model")
     1020  ("MaxQPAdaptationRange,-aqr",                       m_iQPAdaptationRange,                                 6, "QP adaptation range")
     1021  ("dQPFile,m",                                       cfg_dQPFile,                                 string(""), "dQP file name")
     1022  ("RDOQ",                                            m_useRDOQ,                                         true)
     1023  ("RDOQTS",                                          m_useRDOQTS,                                       true)
     1024#if T0196_SELECTIVE_RDOQ
     1025  ("SelectiveRDOQ",                                   m_useSelectiveRDOQ,                               false, "Enable selective RDOQ")
     1026#endif
     1027  ("RDpenalty",                                       m_rdPenalty,                                          0,  "RD-penalty for 32x32 TU for intra in non-intra slices. 0:disabled  1:RD-penalty  2:maximum RD-penalty")
     1028
    5231029  // Deblocking filter parameters
    524 #if H_MV
    525   ("LoopFilterDisable",              m_bLoopFilterDisable,             std::vector<Bool>(1,false), "Disable Loop Filter per Layer" )
     1030#if NH_MV
     1031  ("LoopFilterDisable",                               m_bLoopFilterDisable,                             std::vector<Bool>(1,false), "Disable Loop Filter per Layer" )
    5261032#else
    527   ("LoopFilterDisable",              m_bLoopFilterDisable,             false )
    528 #endif
    529   ("LoopFilterOffsetInPPS",          m_loopFilterOffsetInPPS,          false )
    530   ("LoopFilterBetaOffset_div2",      m_loopFilterBetaOffsetDiv2,           0 )
    531   ("LoopFilterTcOffset_div2",        m_loopFilterTcOffsetDiv2,             0 )
    532   ("DeblockingFilterControlPresent", m_DeblockingFilterControlPresent, false )
    533   ("DeblockingFilterMetric",         m_DeblockingFilterMetric,         false )
    534 
    535 #if H_3D_IC
    536   ("IlluCompEnable",           m_abUseIC, true, "Enable illumination compensation")
    537   ("IlluCompLowLatencyEnc",    m_bUseLowLatencyICEnc, false, "Enable low-latency illumination compensation encoding")
    538 #endif
     1033  ("LoopFilterDisable",                               m_bLoopFilterDisable,                             false)
     1034#endif
     1035  ("LoopFilterOffsetInPPS",                           m_loopFilterOffsetInPPS,                           true)
     1036  ("LoopFilterBetaOffset_div2",                       m_loopFilterBetaOffsetDiv2,                           0)
     1037  ("LoopFilterTcOffset_div2",                         m_loopFilterTcOffsetDiv2,                             0)
     1038  ("DeblockingFilterMetric",                          m_DeblockingFilterMetric,                         false)
     1039
    5391040  // Coding tools
    540   ("AMP",                      m_enableAMP,                 true,  "Enable asymmetric motion partitions")
    541   ("TransformSkip",            m_useTransformSkip,          false, "Intra transform skipping")
    542   ("TransformSkipFast",        m_useTransformSkipFast,      false, "Fast intra transform skipping")
    543 #if H_MV
     1041  ("AMP",                                             m_enableAMP,                                       true, "Enable asymmetric motion partitions")
     1042  ("CrossComponentPrediction",                        m_crossComponentPredictionEnabledFlag,            false, "Enable the use of cross-component prediction (not valid in V1 profiles)")
     1043  ("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")
     1044  ("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")
     1045  ("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")
     1046  ("TransformSkip",                                   m_useTransformSkip,                               false, "Intra transform skipping")
     1047  ("TransformSkipFast",                               m_useTransformSkipFast,                           false, "Fast intra transform skipping")
     1048  ("TransformSkipLog2MaxSize",                        m_log2MaxTransformSkipBlockSize,                     2U, "Specify transform-skip maximum size. Minimum 2. (not valid in V1 profiles)")
     1049  ("ImplicitResidualDPCM",                            m_rdpcmEnabledFlag[RDPCM_SIGNAL_IMPLICIT],        false, "Enable implicitly signalled residual DPCM for intra (also known as sample-adaptive intra predict) (not valid in V1 profiles)")
     1050  ("ExplicitResidualDPCM",                            m_rdpcmEnabledFlag[RDPCM_SIGNAL_EXPLICIT],        false, "Enable explicitly signalled residual DPCM for inter (not valid in V1 profiles)")
     1051  ("ResidualRotation",                                m_transformSkipRotationEnabledFlag,               false, "Enable rotation of transform-skipped and transquant-bypassed TUs through 180 degrees prior to entropy coding (not valid in V1 profiles)")
     1052  ("SingleSignificanceMapContext",                    m_transformSkipContextEnabledFlag,                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)")
     1053  ("GolombRiceParameterAdaptation",                   m_persistentRiceAdaptationEnabledFlag,            false, "Enable the adaptation of the Golomb-Rice parameter over the course of each slice")
     1054  ("AlignCABACBeforeBypass",                          m_cabacBypassAlignmentEnabledFlag,                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" )
     1055#if NH_MV
    5441056  ("SAO",                      m_bUseSAO, std::vector<Bool>(1,true), "Enable Sample Adaptive Offset per Layer")
    5451057#else
    546   ("SAO",                      m_bUseSAO,                   true,  "Enable Sample Adaptive Offset")
    547 #endif
    548   ("MaxNumOffsetsPerPic",      m_maxNumOffsetsPerPic,       2048,  "Max number of SAO offset per picture (Default: 2048)")   
    549   ("SAOLcuBoundary",           m_saoLcuBoundary,            false, "0: right/bottom LCU boundary areas skipped from SAO parameter estimation, 1: non-deblocked pixels are used for those areas")
    550   ("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")
    551   ("SliceArgument",            m_sliceArgument,            0,     "Depending on SliceMode being:"
    552                                                                    "\t1: max number of CTUs per slice"
    553                                                                    "\t2: max number of bytes per slice"
    554                                                                    "\t3: max number of tiles per slice")
    555   ("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")
    556   ("SliceSegmentArgument",     m_sliceSegmentArgument,   0,     "Depending on SliceSegmentMode being:"
    557                                                                    "\t1: max number of CTUs per slice segment"
    558                                                                    "\t2: max number of bytes per slice segment"
    559                                                                    "\t3: max number of tiles per slice segment")
    560   ("LFCrossSliceBoundaryFlag", m_bLFCrossSliceBoundaryFlag, true)
    561 
    562   ("ConstrainedIntraPred",     m_bUseConstrainedIntraPred,  false, "Constrained Intra Prediction")
    563 
    564   ("PCMEnabledFlag",           m_usePCM,                    false)
    565   ("PCMLog2MaxSize",           m_pcmLog2MaxSize,            5u)
    566   ("PCMLog2MinSize",           m_uiPCMLog2MinSize,          3u)
    567   ("PCMInputBitDepthFlag",     m_bPCMInputBitDepthFlag,     true)
    568   ("PCMFilterDisableFlag",     m_bPCMFilterDisableFlag,    false)
    569 
    570   ("WeightedPredP,-wpP",          m_useWeightedPred,               false,      "Use weighted prediction in P slices")
    571   ("WeightedPredB,-wpB",          m_useWeightedBiPred,             false,      "Use weighted (bidirectional) prediction in B slices")
    572   ("Log2ParallelMergeLevel",      m_log2ParallelMergeLevel,     2u,          "Parallel merge estimation region")
    573 
    574   //deprecated copies of renamed tile parameters
    575   ("UniformSpacingIdc",           m_tileUniformSpacingFlag,        false,      "deprecated alias of TileUniformSpacing")
    576   ("ColumnWidthArray",            cfgColumnWidth,                  string(""), "deprecated alias of TileColumnWidthArray")
    577   ("RowHeightArray",              cfgRowHeight,                    string(""), "deprecated alias of TileRowHeightArray")
    578 
    579   ("TileUniformSpacing",          m_tileUniformSpacingFlag,        false,      "Indicates that tile columns and rows are distributed uniformly")
    580   ("NumTileColumnsMinus1",        m_numTileColumnsMinus1,          0,          "Number of tile columns in a picture minus 1")
    581   ("NumTileRowsMinus1",           m_numTileRowsMinus1,             0,          "Number of rows in a picture minus 1")
    582   ("TileColumnWidthArray",        cfgColumnWidth,                  string(""), "Array containing tile column width values in units of LCU")
    583   ("TileRowHeightArray",          cfgRowHeight,                    string(""), "Array containing tile row height values in units of LCU")
    584   ("LFCrossTileBoundaryFlag",      m_bLFCrossTileBoundaryFlag,             true,          "1: cross-tile-boundary loop filtering. 0:non-cross-tile-boundary loop filtering")
    585   ("WaveFrontSynchro",            m_iWaveFrontSynchro,             0,          "0: no synchro; 1 synchro with TR; 2 TRR etc")
    586   ("ScalingList",                 m_useScalingListId,              0,          "0: no scaling list, 1: default scaling lists, 2: scaling lists specified in ScalingListFile")
    587   ("ScalingListFile",             cfg_ScalingListFile,             string(""), "Scaling list file name")
    588   ("SignHideFlag,-SBH",                m_signHideFlag, 1)
    589   ("MaxNumMergeCand",             m_maxNumMergeCand,             5u,         "Maximum number of merge candidates")
    590 
     1058  ("SAO",                                             m_bUseSAO,                                         true, "Enable Sample Adaptive Offset")
     1059#endif
     1060  ("TestSAODisableAtPictureLevel",                    m_bTestSAODisableAtPictureLevel,                  false, "Enables the testing of disabling SAO at the picture level after having analysed all blocks")
     1061  ("SaoEncodingRate",                                 m_saoEncodingRate,                                 0.75, "When >0 SAO early picture termination is enabled for luma and chroma")
     1062  ("SaoEncodingRateChroma",                           m_saoEncodingRateChroma,                            0.5, "The SAO early picture termination rate to use for chroma (when m_SaoEncodingRate is >0). If <=0, use results for luma")
     1063  ("MaxNumOffsetsPerPic",                             m_maxNumOffsetsPerPic,                             2048, "Max number of SAO offset per picture (Default: 2048)")
     1064  ("SAOLcuBoundary",                                  m_saoCtuBoundary,                                 false, "0: right/bottom CTU boundary areas skipped from SAO parameter estimation, 1: non-deblocked pixels are used for those areas")
     1065  ("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")
     1066  ("SliceArgument",                                   m_sliceArgument,                                      0, "Depending on SliceMode being:"
     1067                                                                                                               "\t1: max number of CTUs per slice"
     1068                                                                                                               "\t2: max number of bytes per slice"
     1069                                                                                                               "\t3: max number of tiles per slice")
     1070  ("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")
     1071  ("SliceSegmentArgument",                            m_sliceSegmentArgument,                               0, "Depending on SliceSegmentMode being:"
     1072                                                                                                               "\t1: max number of CTUs per slice segment"
     1073                                                                                                               "\t2: max number of bytes per slice segment"
     1074                                                                                                               "\t3: max number of tiles per slice segment")
     1075  ("LFCrossSliceBoundaryFlag",                        m_bLFCrossSliceBoundaryFlag,                       true)
     1076
     1077  ("ConstrainedIntraPred",                            m_bUseConstrainedIntraPred,                       false, "Constrained Intra Prediction")
     1078  ("FastUDIUseMPMEnabled",                            m_bFastUDIUseMPMEnabled,                           true, "If enabled, adapt intra direction search, accounting for MPM")
     1079  ("FastMEForGenBLowDelayEnabled",                    m_bFastMEForGenBLowDelayEnabled,                   true, "If enabled use a fast ME for generalised B Low Delay slices")
     1080  ("UseBLambdaForNonKeyLowDelayPictures",             m_bUseBLambdaForNonKeyLowDelayPictures,            true, "Enables use of B-Lambda for non-key low-delay pictures")
     1081  ("PCMEnabledFlag",                                  m_usePCM,                                         false)
     1082  ("PCMLog2MaxSize",                                  m_pcmLog2MaxSize,                                    5u)
     1083  ("PCMLog2MinSize",                                  m_uiPCMLog2MinSize,                                  3u)
     1084
     1085  ("PCMInputBitDepthFlag",                            m_bPCMInputBitDepthFlag,                           true)
     1086  ("PCMFilterDisableFlag",                            m_bPCMFilterDisableFlag,                          false)
     1087  ("IntraReferenceSmoothing",                         m_enableIntraReferenceSmoothing,                   true, "0: Disable use of intra reference smoothing. 1: Enable use of intra reference smoothing (not valid in V1 profiles)")
     1088  ("WeightedPredP,-wpP",                              m_useWeightedPred,                                false, "Use weighted prediction in P slices")
     1089  ("WeightedPredB,-wpB",                              m_useWeightedBiPred,                              false, "Use weighted (bidirectional) prediction in B slices")
     1090  ("Log2ParallelMergeLevel",                          m_log2ParallelMergeLevel,                            2u, "Parallel merge estimation region")
     1091    //deprecated copies of renamed tile parameters
     1092  ("UniformSpacingIdc",                               m_tileUniformSpacingFlag,                         false,      "deprecated alias of TileUniformSpacing")
     1093  ("ColumnWidthArray",                                cfg_ColumnWidth,                        cfg_ColumnWidth, "deprecated alias of TileColumnWidthArray")
     1094  ("RowHeightArray",                                  cfg_RowHeight,                            cfg_RowHeight, "deprecated alias of TileRowHeightArray")
     1095
     1096  ("TileUniformSpacing",                              m_tileUniformSpacingFlag,                         false,      "Indicates that tile columns and rows are distributed uniformly")
     1097  ("NumTileColumnsMinus1",                            m_numTileColumnsMinus1,                               0,          "Number of tile columns in a picture minus 1")
     1098  ("NumTileRowsMinus1",                               m_numTileRowsMinus1,                                  0,          "Number of rows in a picture minus 1")
     1099  ("TileColumnWidthArray",                            cfg_ColumnWidth,                        cfg_ColumnWidth, "Array containing tile column width values in units of CTU")
     1100  ("TileRowHeightArray",                              cfg_RowHeight,                            cfg_RowHeight, "Array containing tile row height values in units of CTU")
     1101  ("LFCrossTileBoundaryFlag",                         m_bLFCrossTileBoundaryFlag,                        true, "1: cross-tile-boundary loop filtering. 0:non-cross-tile-boundary loop filtering")
     1102  ("WaveFrontSynchro",                                m_iWaveFrontSynchro,                                  0, "0: no synchro; 1 synchro with top-right-right")
     1103  ("ScalingList",                                     m_useScalingListId,                    SCALING_LIST_OFF, "0/off: no scaling list, 1/default: default scaling lists, 2/file: scaling lists specified in ScalingListFile")
     1104  ("ScalingListFile",                                 cfg_ScalingListFile,                         string(""), "Scaling list file name. Use an empty string to produce help.")
     1105  ("SignHideFlag,-SBH",                               m_signHideFlag,                                    true)
     1106  ("MaxNumMergeCand",                                 m_maxNumMergeCand,                                   5u, "Maximum number of merge candidates")
    5911107  /* Misc. */
    592   ("SEIDecodedPictureHash",       m_decodedPictureHashSEIEnabled, 0, "Control generation of decode picture hash SEI messages\n"
    593                                                                     "\t3: checksum\n"
    594                                                                     "\t2: CRC\n"
    595                                                                     "\t1: use MD5\n"
    596                                                                     "\t0: disable")
    597   ("SEIpictureDigest",            m_decodedPictureHashSEIEnabled, 0, "deprecated alias for SEIDecodedPictureHash")
    598   ("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")
    599   ("FEN", m_bUseFastEnc, false, "fast encoder setting")
    600   ("ECU", m_bUseEarlyCU, false, "Early CU setting")
    601   ("FDM", m_useFastDecisionForMerge, true, "Fast decision for Merge RD Cost")
    602   ("CFM", m_bUseCbfFastMode, false, "Cbf fast mode setting")
    603   ("ESD", m_useEarlySkipDetection, false, "Early SKIP detection setting")
    604   ( "RateControl",         m_RCEnableRateControl,   false, "Rate control: enable rate control" )
    605   ( "TargetBitrate",       m_RCTargetBitrate,           0, "Rate control: target bitrate" )
    606   ( "KeepHierarchicalBit", m_RCKeepHierarchicalBit,     0, "Rate control: 0: equal bit allocation; 1: fixed ratio bit allocation; 2: adaptive ratio bit allocation" )
    607   ( "LCULevelRateControl", m_RCLCULevelRC,           true, "Rate control: true: LCU level RC; false: picture level RC" )
    608   ( "RCLCUSeparateModel",  m_RCUseLCUSeparateModel,  true, "Rate control: use LCU level separate R-lambda model" )
    609   ( "InitialQP",           m_RCInitialQP,               0, "Rate control: initial QP" )
    610   ( "RCForceIntraQP",      m_RCForceIntraQP,        false, "Rate control: force intra QP to be equal to initial QP" )
     1108  ("SEIDecodedPictureHash",                           m_decodedPictureHashSEIEnabled,                       0, "Control generation of decode picture hash SEI messages\n"
     1109                                                                                                               "\t3: checksum\n"
     1110                                                                                                               "\t2: CRC\n"
     1111                                                                                                               "\t1: use MD5\n"
     1112                                                                                                               "\t0: disable")
     1113  ("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")
     1114  ("FEN",                                             m_bUseFastEnc,                                    false, "fast encoder setting")
     1115  ("ECU",                                             m_bUseEarlyCU,                                    false, "Early CU setting")
     1116  ("FDM",                                             m_useFastDecisionForMerge,                         true, "Fast decision for Merge RD Cost")
     1117  ("CFM",                                             m_bUseCbfFastMode,                                false, "Cbf fast mode setting")
     1118  ("ESD",                                             m_useEarlySkipDetection,                          false, "Early SKIP detection setting")
     1119  ( "RateControl",                                    m_RCEnableRateControl,                            false, "Rate control: enable rate control" )
     1120  ( "TargetBitrate",                                  m_RCTargetBitrate,                                    0, "Rate control: target bit-rate" )
     1121  ( "KeepHierarchicalBit",                            m_RCKeepHierarchicalBit,                              0, "Rate control: 0: equal bit allocation; 1: fixed ratio bit allocation; 2: adaptive ratio bit allocation" )
     1122  ( "LCULevelRateControl",                            m_RCLCULevelRC,                                    true, "Rate control: true: CTU level RC; false: picture level RC" )
     1123  ( "RCLCUSeparateModel",                             m_RCUseLCUSeparateModel,                           true, "Rate control: use CTU level separate R-lambda model" )
     1124  ( "InitialQP",                                      m_RCInitialQP,                                        0, "Rate control: initial QP" )
     1125  ( "RCForceIntraQP",                                 m_RCForceIntraQP,                                 false, "Rate control: force intra QP to be equal to initial QP" )
    6111126
    6121127#if KWU_RC_VIEWRC_E0227
     
    6171132  ("DepthMADPred, -dm", m_depthMADPred, (UInt)0, "Depth based MAD prediction on/off")
    6181133#endif
    619 #if H_MV
     1134#if NH_MV
    6201135// A lot of this stuff could should actually be derived by the encoder.
    6211136  // VPS VUI
     
    6261141  ("BitRatePresentVpsFlag"       , m_bitRatePresentVpsFlag       , false                                           , "BitRatePresentVpsFlag       ")
    6271142  ("PicRatePresentVpsFlag"       , m_picRatePresentVpsFlag       , false                                           , "PicRatePresentVpsFlag       ")
    628   ("BitRatePresentFlag"          , m_bitRatePresentFlag          , std::vector< Bool >(1,0)  ,MAX_VPS_OP_SETS_PLUS1, "BitRatePresentFlag per sub layer for the N-th layer set")
    629   ("PicRatePresentFlag"          , m_picRatePresentFlag          , std::vector< Bool >(1,0)  ,MAX_VPS_OP_SETS_PLUS1, "PicRatePresentFlag per sub layer for the N-th layer set")
     1143  ("BitRatePresentFlag"          , m_bitRatePresentFlag          , BoolAry1d(1,0)  ,MAX_VPS_OP_SETS_PLUS1, "BitRatePresentFlag per sub layer for the N-th layer set")
     1144  ("PicRatePresentFlag"          , m_picRatePresentFlag          , BoolAry1d(1,0)  ,MAX_VPS_OP_SETS_PLUS1, "PicRatePresentFlag per sub layer for the N-th layer set")
    6301145  ("AvgBitRate"                  , m_avgBitRate                  , std::vector< Int  >(1,0)  ,MAX_VPS_OP_SETS_PLUS1, "AvgBitRate         per sub layer for the N-th layer set")
    6311146  ("MaxBitRate"                  , m_maxBitRate                  , std::vector< Int  >(1,0)  ,MAX_VPS_OP_SETS_PLUS1, "MaxBitRate         per sub layer for the N-th layer set")
     
    6331148  ("AvgPicRate"                  , m_avgPicRate                  , std::vector< Int  >(1,0)  ,MAX_VPS_OP_SETS_PLUS1, "AvgPicRate         per sub layer for the N-th layer set")
    6341149  ("TilesNotInUseFlag"            , m_tilesNotInUseFlag            , true                                          , "TilesNotInUseFlag            ")
    635   ("TilesInUseFlag"               , m_tilesInUseFlag               , std::vector< Bool >(1,false)                   , "TilesInUseFlag               ")
    636   ("LoopFilterNotAcrossTilesFlag" , m_loopFilterNotAcrossTilesFlag , std::vector< Bool >(1,false)                  , "LoopFilterNotAcrossTilesFlag ")
     1150  ("TilesInUseFlag"               , m_tilesInUseFlag               , BoolAry1d(1,false)                   , "TilesInUseFlag               ")
     1151  ("LoopFilterNotAcrossTilesFlag" , m_loopFilterNotAcrossTilesFlag , BoolAry1d(1,false)                  , "LoopFilterNotAcrossTilesFlag ")
    6371152  ("WppNotInUseFlag"              , m_wppNotInUseFlag              , true                                          , "WppNotInUseFlag              ")
    638   ("WppInUseFlag"                 , m_wppInUseFlag                 , std::vector< Bool >(1,0)                      , "WppInUseFlag                 ")
    639   ("TileBoundariesAlignedFlag"   , m_tileBoundariesAlignedFlag   , std::vector< Bool >(1,0)  ,MAX_NUM_LAYERS       , "TileBoundariesAlignedFlag    per direct reference for the N-th layer")
     1153  ("WppInUseFlag"                 , m_wppInUseFlag                 , BoolAry1d(1,0)                      , "WppInUseFlag                 ")
     1154  ("TileBoundariesAlignedFlag"   , m_tileBoundariesAlignedFlag   , BoolAry1d(1,0)  ,MAX_NUM_LAYERS       , "TileBoundariesAlignedFlag    per direct reference for the N-th layer")
    6401155  ("IlpRestrictedRefLayersFlag"  , m_ilpRestrictedRefLayersFlag  , false                                           , "IlpRestrictedRefLayersFlag")
    6411156  ("MinSpatialSegmentOffsetPlus1", m_minSpatialSegmentOffsetPlus1, std::vector< Int  >(1,0)  ,MAX_NUM_LAYERS       , "MinSpatialSegmentOffsetPlus1 per direct reference for the N-th layer")
    642   ("CtuBasedOffsetEnabledFlag"   , m_ctuBasedOffsetEnabledFlag   , std::vector< Bool >(1,0)  ,MAX_NUM_LAYERS       , "CtuBasedOffsetEnabledFlag    per direct reference for the N-th layer")
     1157  ("CtuBasedOffsetEnabledFlag"   , m_ctuBasedOffsetEnabledFlag   , BoolAry1d(1,0)  ,MAX_NUM_LAYERS       , "CtuBasedOffsetEnabledFlag    per direct reference for the N-th layer")
    6431158  ("MinHorizontalCtuOffsetPlus1" , m_minHorizontalCtuOffsetPlus1 , std::vector< Int  >(1,0)  ,MAX_NUM_LAYERS       , "MinHorizontalCtuOffsetPlus1  per direct reference for the N-th layer")
    6441159  ("SingleLayerForNonIrapFlag", m_singleLayerForNonIrapFlag, false                                          , "SingleLayerForNonIrapFlag")
     
    6461161#endif
    6471162
    648   ("TransquantBypassEnableFlag", m_TransquantBypassEnableFlag, false, "transquant_bypass_enable_flag indicator in PPS")
    649   ("CUTransquantBypassFlagForce", m_CUTransquantBypassFlagForce, false, "Force transquant bypass mode, when transquant_bypass_enable_flag is enabled")
    650   ("RecalculateQPAccordingToLambda", m_recalculateQPAccordingToLambda, false, "Recalculate QP values according to lambda values. Do not suggest to be enabled in all intra case")
    651   ("StrongIntraSmoothing,-sis",      m_useStrongIntraSmoothing,           true, "Enable strong intra smoothing for 32x32 blocks")
    652   ("SEIActiveParameterSets",         m_activeParameterSetsSEIEnabled,          0, "Enable generation of active parameter sets SEI messages")
    653   ("VuiParametersPresent,-vui",      m_vuiParametersPresentFlag,           false, "Enable generation of vui_parameters()")
    654   ("AspectRatioInfoPresent",         m_aspectRatioInfoPresentFlag,         false, "Signals whether aspect_ratio_idc is present")
    655   ("AspectRatioIdc",                 m_aspectRatioIdc,                         0, "aspect_ratio_idc")
    656   ("SarWidth",                       m_sarWidth,                               0, "horizontal size of the sample aspect ratio")
    657   ("SarHeight",                      m_sarHeight,                              0, "vertical size of the sample aspect ratio")
    658   ("OverscanInfoPresent",            m_overscanInfoPresentFlag,            false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n")
    659   ("OverscanAppropriate",            m_overscanAppropriateFlag,            false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n")
    660   ("VideoSignalTypePresent",         m_videoSignalTypePresentFlag,         false, "Signals whether video_format, video_full_range_flag, and colour_description_present_flag are present")
    661   ("VideoFormat",                    m_videoFormat,                            5, "Indicates representation of pictures")
    662   ("VideoFullRange",                 m_videoFullRangeFlag,                 false, "Indicates the black level and range of luma and chroma signals")
    663   ("ColourDescriptionPresent",       m_colourDescriptionPresentFlag,       false, "Signals whether colour_primaries, transfer_characteristics and matrix_coefficients are present")
    664   ("ColourPrimaries",                m_colourPrimaries,                        2, "Indicates chromaticity coordinates of the source primaries")
    665   ("TransferCharacteristics",        m_transferCharacteristics,                2, "Indicates the opto-electronic transfer characteristics of the source")
    666   ("MatrixCoefficients",             m_matrixCoefficients,                     2, "Describes the matrix coefficients used in deriving luma and chroma from RGB primaries")
    667   ("ChromaLocInfoPresent",           m_chromaLocInfoPresentFlag,           false, "Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present")
    668   ("ChromaSampleLocTypeTopField",    m_chromaSampleLocTypeTopField,            0, "Specifies the location of chroma samples for top field")
    669   ("ChromaSampleLocTypeBottomField", m_chromaSampleLocTypeBottomField,         0, "Specifies the location of chroma samples for bottom field")
    670   ("NeutralChromaIndication",        m_neutralChromaIndicationFlag,        false, "Indicates that the value of all decoded chroma samples is equal to 1<<(BitDepthCr-1)")
    671   ("DefaultDisplayWindowFlag",       m_defaultDisplayWindowFlag,           false, "Indicates the presence of the Default Window parameters")
    672   ("DefDispWinLeftOffset",           m_defDispWinLeftOffset,                   0, "Specifies the left offset of the default display window from the conformance window")
    673   ("DefDispWinRightOffset",          m_defDispWinRightOffset,                  0, "Specifies the right offset of the default display window from the conformance window")
    674   ("DefDispWinTopOffset",            m_defDispWinTopOffset,                    0, "Specifies the top offset of the default display window from the conformance window")
    675   ("DefDispWinBottomOffset",         m_defDispWinBottomOffset,                 0, "Specifies the bottom offset of the default display window from the conformance window")
    676   ("FrameFieldInfoPresentFlag",      m_frameFieldInfoPresentFlag,               false, "Indicates that pic_struct and field coding related values are present in picture timing SEI messages")
    677   ("PocProportionalToTimingFlag",   m_pocProportionalToTimingFlag,         false, "Indicates that the POC value is proportional to the output time w.r.t. first picture in CVS")
    678   ("NumTicksPocDiffOneMinus1",      m_numTicksPocDiffOneMinus1,                0, "Number of ticks minus 1 that for a POC difference of one")
    679   ("BitstreamRestriction",           m_bitstreamRestrictionFlag,           false, "Signals whether bitstream restriction parameters are present")
    680   ("TilesFixedStructure",            m_tilesFixedStructureFlag,            false, "Indicates that each active picture parameter set has the same values of the syntax elements related to tiles")
    681   ("MotionVectorsOverPicBoundaries", m_motionVectorsOverPicBoundariesFlag, false, "Indicates that no samples outside the picture boundaries are used for inter prediction")
    682   ("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")
    683   ("MaxBitsPerMinCuDenom",           m_maxBitsPerMinCuDenom,                   1, "Indicates an upper bound for the number of bits of coding_unit() data")
    684   ("Log2MaxMvLengthHorizontal",      m_log2MaxMvLengthHorizontal,             15, "Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units")
    685   ("Log2MaxMvLengthVertical",        m_log2MaxMvLengthVertical,               15, "Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units")
    686   ("SEIRecoveryPoint",               m_recoveryPointSEIEnabled,                0, "Control generation of recovery point SEI messages")
    687   ("SEIBufferingPeriod",             m_bufferingPeriodSEIEnabled,              0, "Control generation of buffering period SEI messages")
    688   ("SEIPictureTiming",               m_pictureTimingSEIEnabled,                0, "Control generation of picture timing SEI messages")
    689   ("SEIToneMappingInfo",                       m_toneMappingInfoSEIEnabled,    false, "Control generation of Tone Mapping SEI messages")
    690   ("SEIToneMapId",                             m_toneMapId,                        0, "Specifies Id of Tone Mapping SEI message for a given session")
    691   ("SEIToneMapCancelFlag",                     m_toneMapCancelFlag,            false, "Indicates that Tone Mapping SEI message cancels the persistance or follows")
    692   ("SEIToneMapPersistenceFlag",                m_toneMapPersistenceFlag,        true, "Specifies the persistence of the Tone Mapping SEI message")
    693   ("SEIToneMapCodedDataBitDepth",              m_toneMapCodedDataBitDepth,         8, "Specifies Coded Data BitDepth of Tone Mapping SEI messages")
    694   ("SEIToneMapTargetBitDepth",                 m_toneMapTargetBitDepth,            8, "Specifies Output BitDepth of Tome mapping function")
    695   ("SEIToneMapModelId",                        m_toneMapModelId,                   0, "Specifies Model utilized for mapping coded data into target_bit_depth range\n"
    696                                                                                       "\t0:  linear mapping with clipping\n"
    697                                                                                       "\t1:  sigmoidal mapping\n"
    698                                                                                       "\t2:  user-defined table mapping\n"
    699                                                                                       "\t3:  piece-wise linear mapping\n"
    700                                                                                       "\t4:  luminance dynamic range information ")
    701   ("SEIToneMapMinValue",                              m_toneMapMinValue,                          0, "Specifies the minimum value in mode 0")
    702   ("SEIToneMapMaxValue",                              m_toneMapMaxValue,                       1023, "Specifies the maxmum value in mode 0")
    703   ("SEIToneMapSigmoidMidpoint",                       m_sigmoidMidpoint,                        512, "Specifies the centre point in mode 1")
    704   ("SEIToneMapSigmoidWidth",                          m_sigmoidWidth,                           960, "Specifies the distance between 5% and 95% values of the target_bit_depth in mode 1")
    705   ("SEIToneMapStartOfCodedInterval",                  cfg_startOfCodedInterval,          string(""), "Array of user-defined mapping table")
    706   ("SEIToneMapNumPivots",                             m_numPivots,                                0, "Specifies the number of pivot points in mode 3")
    707   ("SEIToneMapCodedPivotValue",                       cfg_codedPivotValue,               string(""), "Array of pivot point")
    708   ("SEIToneMapTargetPivotValue",                      cfg_targetPivotValue,              string(""), "Array of pivot point")
    709   ("SEIToneMapCameraIsoSpeedIdc",                     m_cameraIsoSpeedIdc,                        0, "Indicates the camera ISO speed for daylight illumination")
    710   ("SEIToneMapCameraIsoSpeedValue",                   m_cameraIsoSpeedValue,                    400, "Specifies the camera ISO speed for daylight illumination of Extended_ISO")
    711   ("SEIToneMapExposureIndexIdc",                      m_exposureIndexIdc,                         0, "Indicates the exposure index setting of the camera")
    712   ("SEIToneMapExposureIndexValue",                    m_exposureIndexValue,                     400, "Specifies the exposure index setting of the cameran of Extended_ISO")
    713   ("SEIToneMapExposureCompensationValueSignFlag",     m_exposureCompensationValueSignFlag,        0, "Specifies the sign of ExposureCompensationValue")
    714   ("SEIToneMapExposureCompensationValueNumerator",    m_exposureCompensationValueNumerator,       0, "Specifies the numerator of ExposureCompensationValue")
    715   ("SEIToneMapExposureCompensationValueDenomIdc",     m_exposureCompensationValueDenomIdc,        2, "Specifies the denominator of ExposureCompensationValue")
    716   ("SEIToneMapRefScreenLuminanceWhite",               m_refScreenLuminanceWhite,                350, "Specifies reference screen brightness setting in units of candela per square metre")
    717   ("SEIToneMapExtendedRangeWhiteLevel",               m_extendedRangeWhiteLevel,                800, "Indicates the luminance dynamic range")
    718   ("SEIToneMapNominalBlackLevelLumaCodeValue",        m_nominalBlackLevelLumaCodeValue,          16, "Specifies luma sample value of the nominal black level assigned decoded pictures")
    719   ("SEIToneMapNominalWhiteLevelLumaCodeValue",        m_nominalWhiteLevelLumaCodeValue,         235, "Specifies luma sample value of the nominal white level assigned decoded pictures")
    720   ("SEIToneMapExtendedWhiteLevelLumaCodeValue",       m_extendedWhiteLevelLumaCodeValue,        300, "Specifies luma sample value of the extended dynamic range assigned decoded pictures")
    721   ("SEIFramePacking",                m_framePackingSEIEnabled,                 0, "Control generation of frame packing SEI messages")
    722   ("SEIFramePackingType",            m_framePackingSEIType,                    0, "Define frame packing arrangement\n"
    723                                                                                   "\t0: checkerboard - pixels alternatively represent either frames\n"
    724                                                                                   "\t1: column alternation - frames are interlaced by column\n"
    725                                                                                   "\t2: row alternation - frames are interlaced by row\n"
    726                                                                                   "\t3: side by side - frames are displayed horizontally\n"
    727                                                                                   "\t4: top bottom - frames are displayed vertically\n"
    728                                                                                   "\t5: frame alternation - one frame is alternated with the other")
    729   ("SEIFramePackingId",              m_framePackingSEIId,                      0, "Id of frame packing SEI message for a given session")
    730   ("SEIFramePackingQuincunx",        m_framePackingSEIQuincunx,                0, "Indicate the presence of a Quincunx type video frame")
    731   ("SEIFramePackingInterpretation",  m_framePackingSEIInterpretation,          0, "Indicate the interpretation of the frame pair\n"
    732                                                                                   "\t0: unspecified\n"
    733                                                                                   "\t1: stereo pair, frame0 represents left view\n"
    734                                                                                   "\t2: stereo pair, frame0 represents right view")
    735   ("SEIDisplayOrientation",          m_displayOrientationSEIAngle,             0, "Control generation of display orientation SEI messages\n"
    736                                                               "\tN: 0 < N < (2^16 - 1) enable display orientation SEI message with anticlockwise_rotation = N and display_orientation_repetition_period = 1\n"
    737                                                               "\t0: disable")
    738   ("SEITemporalLevel0Index",         m_temporalLevel0IndexSEIEnabled,          0, "Control generation of temporal level 0 index SEI messages")
    739   ("SEIGradualDecodingRefreshInfo",  m_gradualDecodingRefreshInfoEnabled,      0, "Control generation of gradual decoding refresh information SEI message")
    740   ("SEIDecodingUnitInfo",             m_decodingUnitInfoSEIEnabled,                       0, "Control generation of decoding unit information SEI message.")
    741   ("SEISOPDescription",              m_SOPDescriptionSEIEnabled,              0, "Control generation of SOP description SEI messages")
    742   ("SEIScalableNesting",             m_scalableNestingSEIEnabled,              0, "Control generation of scalable nesting SEI messages")
    743 #if H_MV
    744   ("SubBitstreamPropSEIEnabled",              m_subBistreamPropSEIEnabled,    false                     ,"Enable signaling of sub-bitstream property SEI message")
    745   ("SEISubBitstreamNumAdditionalSubStreams",  m_sbPropNumAdditionalSubStreams,0, "Number of substreams for which additional information is signalled")
    746   ("SEISubBitstreamSubBitstreamMode",         m_sbPropSubBitstreamMode,       std::vector< Int  >(1,0)  ,"Specifies mode of generation of the i-th sub-bitstream (0 or 1)")
    747   ("SEISubBitstreamOutputLayerSetIdxToVps",   m_sbPropOutputLayerSetIdxToVps, std::vector< Int  >(1,0)  ,"Specifies output layer set index of the i-th sub-bitstream ")
    748   ("SEISubBitstreamHighestSublayerId",        m_sbPropHighestSublayerId,      std::vector< Int  >(1,0)  ,"Specifies highest TemporalId of the i-th sub-bitstream")
    749   ("SEISubBitstreamAvgBitRate",               m_sbPropAvgBitRate,             std::vector< Int  >(1,0)  ,"Specifies average bit rate of the i-th sub-bitstream")
    750   ("SEISubBitstreamMaxBitRate",               m_sbPropMaxBitRate,             std::vector< Int  >(1,0)  ,"Specifies maximum bit rate of the i-th sub-bitstream")
    751 
    752   ("OutputVpsInfo",                           m_outputVpsInfo,                false                     ,"Output information about the layer dependencies and layer sets")
    753 #endif
    754 #if H_3D
    755   ("CameraParameterFile,cpf", m_pchCameraParameterFile,    (Char *) 0, "Camera Parameter File Name")
    756   ("BaseViewCameraNumbers" ,  m_pchBaseViewCameraNumbers,  (Char *) 0, "Numbers of base views")
    757   ("CodedCamParsPrecision",   m_iCodedCamParPrecision,  STD_CAM_PARAMETERS_PRECISION, "precision for coding of camera parameters (in units of 2^(-x) luma samples)" )
    758 /* View Synthesis Optimization */
    759 
    760 #if H_3D_VSO
    761   ("VSOConfig",                       m_pchVSOConfig            , (Char *) 0    , "VSO configuration")
    762   ("VSO",                             m_bUseVSO                 , false         , "Use VSO" )   
    763   ("VSOMode",                         m_uiVSOMode               , (UInt)   4    , "VSO Mode")
    764   ("LambdaScaleVSO",                  m_dLambdaScaleVSO         , (Double) 1    , "Lambda Scaling for VSO")
    765   ("VSOLSTable",                      m_bVSOLSTable             , true          , "Depth QP dependent video/depth rate allocation by Lagrange multiplier" )     
    766   ("ForceLambdaScaleVSO",             m_bForceLambdaScaleVSO    , false         , "Force using Lambda Scale VSO also in non-VSO-Mode")
    767   ("AllowNegDist",                    m_bAllowNegDist           , true          , "Allow negative Distortion in VSO")
    768  
    769   ("UseEstimatedVSD",                 m_bUseEstimatedVSD        , true          , "Model based VSD estimation instead of rendering based for some encoder decisions" )     
    770   ("VSOEarlySkip",                    m_bVSOEarlySkip           , true          , "Early skip of VSO computation if synthesis error assumed to be zero" )     
    771  
    772   ("WVSO",                            m_bUseWVSO                , true          , "Use depth fidelity term for VSO" )
    773   ("VSOWeight",                       m_iVSOWeight              , 10            , "Synthesized View Distortion Change weight" )
    774   ("VSDWeight",                       m_iVSDWeight              , 1             , "View Synthesis Distortion estimate weight" )
    775   ("DWeight",                         m_iDWeight                , 1             , "Depth Distortion weight" )
    776 
     1163  ("TransquantBypassEnableFlag",                      m_TransquantBypassEnableFlag,                     false, "transquant_bypass_enable_flag indicator in PPS")
     1164  ("CUTransquantBypassFlagForce",                     m_CUTransquantBypassFlagForce,                    false, "Force transquant bypass mode, when transquant_bypass_enable_flag is enabled")
     1165  ("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).")
     1166  ("RecalculateQPAccordingToLambda",                  m_recalculateQPAccordingToLambda,                 false, "Recalculate QP values according to lambda values. Do not suggest to be enabled in all intra case")
     1167  ("StrongIntraSmoothing,-sis",                       m_useStrongIntraSmoothing,                         true, "Enable strong intra smoothing for 32x32 blocks")
     1168  ("SEIActiveParameterSets",                          m_activeParameterSetsSEIEnabled,                      0, "Enable generation of active parameter sets SEI messages")
     1169  ("VuiParametersPresent,-vui",                       m_vuiParametersPresentFlag,                       false, "Enable generation of vui_parameters()")
     1170  ("AspectRatioInfoPresent",                          m_aspectRatioInfoPresentFlag,                     false, "Signals whether aspect_ratio_idc is present")
     1171  ("AspectRatioIdc",                                  m_aspectRatioIdc,                                     0, "aspect_ratio_idc")
     1172  ("SarWidth",                                        m_sarWidth,                                           0, "horizontal size of the sample aspect ratio")
     1173  ("SarHeight",                                       m_sarHeight,                                          0, "vertical size of the sample aspect ratio")
     1174  ("OverscanInfoPresent",                             m_overscanInfoPresentFlag,                        false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n")
     1175  ("OverscanAppropriate",                             m_overscanAppropriateFlag,                        false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n")
     1176  ("VideoSignalTypePresent",                          m_videoSignalTypePresentFlag,                     false, "Signals whether video_format, video_full_range_flag, and colour_description_present_flag are present")
     1177  ("VideoFormat",                                     m_videoFormat,                                        5, "Indicates representation of pictures")
     1178  ("VideoFullRange",                                  m_videoFullRangeFlag,                             false, "Indicates the black level and range of luma and chroma signals")
     1179  ("ColourDescriptionPresent",                        m_colourDescriptionPresentFlag,                   false, "Signals whether colour_primaries, transfer_characteristics and matrix_coefficients are present")
     1180  ("ColourPrimaries",                                 m_colourPrimaries,                                    2, "Indicates chromaticity coordinates of the source primaries")
     1181  ("TransferCharacteristics",                         m_transferCharacteristics,                            2, "Indicates the opto-electronic transfer characteristics of the source")
     1182  ("MatrixCoefficients",                              m_matrixCoefficients,                                 2, "Describes the matrix coefficients used in deriving luma and chroma from RGB primaries")
     1183  ("ChromaLocInfoPresent",                            m_chromaLocInfoPresentFlag,                       false, "Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present")
     1184  ("ChromaSampleLocTypeTopField",                     m_chromaSampleLocTypeTopField,                        0, "Specifies the location of chroma samples for top field")
     1185  ("ChromaSampleLocTypeBottomField",                  m_chromaSampleLocTypeBottomField,                     0, "Specifies the location of chroma samples for bottom field")
     1186  ("NeutralChromaIndication",                         m_neutralChromaIndicationFlag,                    false, "Indicates that the value of all decoded chroma samples is equal to 1<<(BitDepthCr-1)")
     1187  ("DefaultDisplayWindowFlag",                        m_defaultDisplayWindowFlag,                       false, "Indicates the presence of the Default Window parameters")
     1188  ("DefDispWinLeftOffset",                            m_defDispWinLeftOffset,                               0, "Specifies the left offset of the default display window from the conformance window")
     1189  ("DefDispWinRightOffset",                           m_defDispWinRightOffset,                              0, "Specifies the right offset of the default display window from the conformance window")
     1190  ("DefDispWinTopOffset",                             m_defDispWinTopOffset,                                0, "Specifies the top offset of the default display window from the conformance window")
     1191  ("DefDispWinBottomOffset",                          m_defDispWinBottomOffset,                             0, "Specifies the bottom offset of the default display window from the conformance window")
     1192  ("FrameFieldInfoPresentFlag",                       m_frameFieldInfoPresentFlag,                      false, "Indicates that pic_struct and field coding related values are present in picture timing SEI messages")
     1193  ("PocProportionalToTimingFlag",                     m_pocProportionalToTimingFlag,                    false, "Indicates that the POC value is proportional to the output time w.r.t. first picture in CVS")
     1194  ("NumTicksPocDiffOneMinus1",                        m_numTicksPocDiffOneMinus1,                           0, "Number of ticks minus 1 that for a POC difference of one")
     1195  ("BitstreamRestriction",                            m_bitstreamRestrictionFlag,                       false, "Signals whether bitstream restriction parameters are present")
     1196  ("TilesFixedStructure",                             m_tilesFixedStructureFlag,                        false, "Indicates that each active picture parameter set has the same values of the syntax elements related to tiles")
     1197  ("MotionVectorsOverPicBoundaries",                  m_motionVectorsOverPicBoundariesFlag,             false, "Indicates that no samples outside the picture boundaries are used for inter prediction")
     1198  ("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")
     1199  ("MaxBitsPerMinCuDenom",                            m_maxBitsPerMinCuDenom,                               1, "Indicates an upper bound for the number of bits of coding_unit() data")
     1200  ("Log2MaxMvLengthHorizontal",                       m_log2MaxMvLengthHorizontal,                         15, "Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units")
     1201  ("Log2MaxMvLengthVertical",                         m_log2MaxMvLengthVertical,                           15, "Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units")
     1202  ("SEIRecoveryPoint",                                m_recoveryPointSEIEnabled,                            0, "Control generation of recovery point SEI messages")
     1203  ("SEIBufferingPeriod",                              m_bufferingPeriodSEIEnabled,                          0, "Control generation of buffering period SEI messages")
     1204  ("SEIPictureTiming",                                m_pictureTimingSEIEnabled,                            0, "Control generation of picture timing SEI messages")
     1205  ("SEIToneMappingInfo",                              m_toneMappingInfoSEIEnabled,                      false, "Control generation of Tone Mapping SEI messages")
     1206  ("SEIToneMapId",                                    m_toneMapId,                                          0, "Specifies Id of Tone Mapping SEI message for a given session")
     1207  ("SEIToneMapCancelFlag",                            m_toneMapCancelFlag,                              false, "Indicates that Tone Mapping SEI message cancels the persistence or follows")
     1208  ("SEIToneMapPersistenceFlag",                       m_toneMapPersistenceFlag,                          true, "Specifies the persistence of the Tone Mapping SEI message")
     1209  ("SEIToneMapCodedDataBitDepth",                     m_toneMapCodedDataBitDepth,                           8, "Specifies Coded Data BitDepth of Tone Mapping SEI messages")
     1210  ("SEIToneMapTargetBitDepth",                        m_toneMapTargetBitDepth,                              8, "Specifies Output BitDepth of Tone mapping function")
     1211  ("SEIToneMapModelId",                               m_toneMapModelId,                                     0, "Specifies Model utilized for mapping coded data into target_bit_depth range\n"
     1212                                                                                                               "\t0:  linear mapping with clipping\n"
     1213                                                                                                               "\t1:  sigmoidal mapping\n"
     1214                                                                                                               "\t2:  user-defined table mapping\n"
     1215                                                                                                               "\t3:  piece-wise linear mapping\n"
     1216                                                                                                               "\t4:  luminance dynamic range information ")
     1217  ("SEIToneMapMinValue",                              m_toneMapMinValue,                                    0, "Specifies the minimum value in mode 0")
     1218  ("SEIToneMapMaxValue",                              m_toneMapMaxValue,                                 1023, "Specifies the maximum value in mode 0")
     1219  ("SEIToneMapSigmoidMidpoint",                       m_sigmoidMidpoint,                                  512, "Specifies the centre point in mode 1")
     1220  ("SEIToneMapSigmoidWidth",                          m_sigmoidWidth,                                     960, "Specifies the distance between 5% and 95% values of the target_bit_depth in mode 1")
     1221  ("SEIToneMapStartOfCodedInterval",                  cfg_startOfCodedInterval,      cfg_startOfCodedInterval, "Array of user-defined mapping table")
     1222  ("SEIToneMapNumPivots",                             m_numPivots,                                          0, "Specifies the number of pivot points in mode 3")
     1223  ("SEIToneMapCodedPivotValue",                       cfg_codedPivotValue,                cfg_codedPivotValue, "Array of pivot point")
     1224  ("SEIToneMapTargetPivotValue",                      cfg_targetPivotValue,              cfg_targetPivotValue, "Array of pivot point")
     1225  ("SEIToneMapCameraIsoSpeedIdc",                     m_cameraIsoSpeedIdc,                                  0, "Indicates the camera ISO speed for daylight illumination")
     1226  ("SEIToneMapCameraIsoSpeedValue",                   m_cameraIsoSpeedValue,                              400, "Specifies the camera ISO speed for daylight illumination of Extended_ISO")
     1227  ("SEIToneMapExposureIndexIdc",                      m_exposureIndexIdc,                                   0, "Indicates the exposure index setting of the camera")
     1228  ("SEIToneMapExposureIndexValue",                    m_exposureIndexValue,                               400, "Specifies the exposure index setting of the camera of Extended_ISO")
     1229  ("SEIToneMapExposureCompensationValueSignFlag",     m_exposureCompensationValueSignFlag,               false, "Specifies the sign of ExposureCompensationValue")
     1230  ("SEIToneMapExposureCompensationValueNumerator",    m_exposureCompensationValueNumerator,                 0, "Specifies the numerator of ExposureCompensationValue")
     1231  ("SEIToneMapExposureCompensationValueDenomIdc",     m_exposureCompensationValueDenomIdc,                  2, "Specifies the denominator of ExposureCompensationValue")
     1232  ("SEIToneMapRefScreenLuminanceWhite",               m_refScreenLuminanceWhite,                          350, "Specifies reference screen brightness setting in units of candela per square metre")
     1233  ("SEIToneMapExtendedRangeWhiteLevel",               m_extendedRangeWhiteLevel,                          800, "Indicates the luminance dynamic range")
     1234  ("SEIToneMapNominalBlackLevelLumaCodeValue",        m_nominalBlackLevelLumaCodeValue,                    16, "Specifies luma sample value of the nominal black level assigned decoded pictures")
     1235  ("SEIToneMapNominalWhiteLevelLumaCodeValue",        m_nominalWhiteLevelLumaCodeValue,                   235, "Specifies luma sample value of the nominal white level assigned decoded pictures")
     1236  ("SEIToneMapExtendedWhiteLevelLumaCodeValue",       m_extendedWhiteLevelLumaCodeValue,                  300, "Specifies luma sample value of the extended dynamic range assigned decoded pictures")
     1237  ("SEIChromaSamplingFilterHint",                     m_chromaSamplingFilterSEIenabled,                 false, "Control generation of the chroma sampling filter hint SEI message")
     1238  ("SEIChromaSamplingHorizontalFilterType",           m_chromaSamplingHorFilterIdc,                         2, "Defines the Index of the chroma sampling horizontal filter\n"
     1239                                                                                                               "\t0: unspecified  - Chroma filter is unknown or is determined by the application"
     1240                                                                                                               "\t1: User-defined - Filter coefficients are specified in the chroma sampling filter hint SEI message"
     1241                                                                                                               "\t2: Standards-defined - ITU-T Rec. T.800 | ISO/IEC15444-1, 5/3 filter")
     1242  ("SEIChromaSamplingVerticalFilterType",             m_chromaSamplingVerFilterIdc,                         2, "Defines the Index of the chroma sampling vertical filter\n"
     1243                                                                                                               "\t0: unspecified  - Chroma filter is unknown or is determined by the application"
     1244                                                                                                               "\t1: User-defined - Filter coefficients are specified in the chroma sampling filter hint SEI message"
     1245                                                                                                               "\t2: Standards-defined - ITU-T Rec. T.800 | ISO/IEC15444-1, 5/3 filter")
     1246  ("SEIFramePacking",                                 m_framePackingSEIEnabled,                             0, "Control generation of frame packing SEI messages")
     1247  ("SEIFramePackingType",                             m_framePackingSEIType,                                0, "Define frame packing arrangement\n"
     1248                                                                                                               "\t3: side by side - frames are displayed horizontally\n"
     1249                                                                                                               "\t4: top bottom - frames are displayed vertically\n"
     1250                                                                                                               "\t5: frame alternation - one frame is alternated with the other")
     1251  ("SEIFramePackingId",                               m_framePackingSEIId,                                  0, "Id of frame packing SEI message for a given session")
     1252  ("SEIFramePackingQuincunx",                         m_framePackingSEIQuincunx,                            0, "Indicate the presence of a Quincunx type video frame")
     1253  ("SEIFramePackingInterpretation",                   m_framePackingSEIInterpretation,                      0, "Indicate the interpretation of the frame pair\n"
     1254                                                                                                               "\t0: unspecified\n"
     1255                                                                                                               "\t1: stereo pair, frame0 represents left view\n"
     1256                                                                                                               "\t2: stereo pair, frame0 represents right view")
     1257  ("SEISegmentedRectFramePacking",                    m_segmentedRectFramePackingSEIEnabled,                0, "Controls generation of segmented rectangular frame packing SEI messages")
     1258  ("SEISegmentedRectFramePackingCancel",              m_segmentedRectFramePackingSEICancel,             false, "If equal to 1, cancels the persistence of any previous SRFPA SEI message")
     1259  ("SEISegmentedRectFramePackingType",                m_segmentedRectFramePackingSEIType,                   0, "Specifies the arrangement of the frames in the reconstructed picture")
     1260  ("SEISegmentedRectFramePackingPersistence",         m_segmentedRectFramePackingSEIPersistence,        false, "If equal to 0, the SEI applies to the current frame only")
     1261  ("SEIDisplayOrientation",                           m_displayOrientationSEIAngle,                         0, "Control generation of display orientation SEI messages\n"
     1262                                                                                                               "\tN: 0 < N < (2^16 - 1) enable display orientation SEI message with anticlockwise_rotation = N and display_orientation_repetition_period = 1\n"
     1263                                                                                                               "\t0: disable")
     1264  ("SEITemporalLevel0Index",                          m_temporalLevel0IndexSEIEnabled,                      0, "Control generation of temporal level 0 index SEI messages")
     1265  ("SEIGradualDecodingRefreshInfo",                   m_gradualDecodingRefreshInfoEnabled,                  0, "Control generation of gradual decoding refresh information SEI message")
     1266  ("SEINoDisplay",                                    m_noDisplaySEITLayer,                                 0, "Control generation of no display SEI message\n"
     1267                                                                                                               "\tN: 0 < N enable no display SEI message for temporal layer N or higher\n"
     1268                                                                                                               "\t0: disable")
     1269  ("SEIDecodingUnitInfo",                             m_decodingUnitInfoSEIEnabled,                         0, "Control generation of decoding unit information SEI message.")
     1270  ("SEISOPDescription",                               m_SOPDescriptionSEIEnabled,                           0, "Control generation of SOP description SEI messages")
     1271  ("SEIScalableNesting",                              m_scalableNestingSEIEnabled,                          0, "Control generation of scalable nesting SEI messages")
     1272  ("SEITempMotionConstrainedTileSets",                m_tmctsSEIEnabled,                                false, "Control generation of temporal motion constrained tile sets SEI message")
     1273  ("SEITimeCodeEnabled",                              m_timeCodeSEIEnabled,                             false, "Control generation of time code information SEI message")
     1274  ("SEITimeCodeNumClockTs",                           m_timeCodeSEINumTs,                                   0, "Number of clock time sets [0..3]")
     1275  ("SEITimeCodeTimeStampFlag",                        cfg_timeCodeSeiTimeStampFlag,          cfg_timeCodeSeiTimeStampFlag,         "Time stamp flag associated to each time set")
     1276  ("SEITimeCodeFieldBasedFlag",                       cfg_timeCodeSeiNumUnitFieldBasedFlag,  cfg_timeCodeSeiNumUnitFieldBasedFlag, "Field based flag associated to each time set")
     1277  ("SEITimeCodeCountingType",                         cfg_timeCodeSeiCountingType,           cfg_timeCodeSeiCountingType,          "Counting type associated to each time set")
     1278  ("SEITimeCodeFullTsFlag",                           cfg_timeCodeSeiFullTimeStampFlag,      cfg_timeCodeSeiFullTimeStampFlag,     "Full time stamp flag associated to each time set")
     1279  ("SEITimeCodeDiscontinuityFlag",                    cfg_timeCodeSeiDiscontinuityFlag,      cfg_timeCodeSeiDiscontinuityFlag,     "Discontinuity flag associated to each time set")
     1280  ("SEITimeCodeCntDroppedFlag",                       cfg_timeCodeSeiCntDroppedFlag,         cfg_timeCodeSeiCntDroppedFlag,        "Counter dropped flag associated to each time set")
     1281  ("SEITimeCodeNumFrames",                            cfg_timeCodeSeiNumberOfFrames,         cfg_timeCodeSeiNumberOfFrames,        "Number of frames associated to each time set")
     1282  ("SEITimeCodeSecondsValue",                         cfg_timeCodeSeiSecondsValue,           cfg_timeCodeSeiSecondsValue,          "Seconds value for each time set")
     1283  ("SEITimeCodeMinutesValue",                         cfg_timeCodeSeiMinutesValue,           cfg_timeCodeSeiMinutesValue,          "Minutes value for each time set")
     1284  ("SEITimeCodeHoursValue",                           cfg_timeCodeSeiHoursValue,             cfg_timeCodeSeiHoursValue,            "Hours value for each time set")
     1285  ("SEITimeCodeSecondsFlag",                          cfg_timeCodeSeiSecondsFlag,            cfg_timeCodeSeiSecondsFlag,           "Flag to signal seconds value presence in each time set")
     1286  ("SEITimeCodeMinutesFlag",                          cfg_timeCodeSeiMinutesFlag,            cfg_timeCodeSeiMinutesFlag,           "Flag to signal minutes value presence in each time set")
     1287  ("SEITimeCodeHoursFlag",                            cfg_timeCodeSeiHoursFlag,              cfg_timeCodeSeiHoursFlag,             "Flag to signal hours value presence in each time set")
     1288  ("SEITimeCodeOffsetLength",                         cfg_timeCodeSeiTimeOffsetLength,       cfg_timeCodeSeiTimeOffsetLength,      "Time offset length associated to each time set")
     1289  ("SEITimeCodeTimeOffset",                           cfg_timeCodeSeiTimeOffsetValue,        cfg_timeCodeSeiTimeOffsetValue,       "Time offset associated to each time set")
     1290  ("SEIKneeFunctionInfo",                             m_kneeSEIEnabled,                                 false, "Control generation of Knee function SEI messages")
     1291  ("SEIKneeFunctionId",                               m_kneeSEIId,                                          0, "Specifies Id of Knee function SEI message for a given session")
     1292  ("SEIKneeFunctionCancelFlag",                       m_kneeSEICancelFlag,                              false, "Indicates that Knee function SEI message cancels the persistence or follows")
     1293  ("SEIKneeFunctionPersistenceFlag",                  m_kneeSEIPersistenceFlag,                          true, "Specifies the persistence of the Knee function SEI message")
     1294  ("SEIKneeFunctionInputDrange",                      m_kneeSEIInputDrange,                              1000, "Specifies the peak luminance level for the input picture of Knee function SEI messages")
     1295  ("SEIKneeFunctionInputDispLuminance",               m_kneeSEIInputDispLuminance,                        100, "Specifies the expected display brightness for the input picture of Knee function SEI messages")
     1296  ("SEIKneeFunctionOutputDrange",                     m_kneeSEIOutputDrange,                             4000, "Specifies the peak luminance level for the output picture of Knee function SEI messages")
     1297  ("SEIKneeFunctionOutputDispLuminance",              m_kneeSEIOutputDispLuminance,                       800, "Specifies the expected display brightness for the output picture of Knee function SEI messages")
     1298  ("SEIKneeFunctionNumKneePointsMinus1",              m_kneeSEINumKneePointsMinus1,                         2, "Specifies the number of knee points - 1")
     1299  ("SEIKneeFunctionInputKneePointValue",              cfg_kneeSEIInputKneePointValue,   cfg_kneeSEIInputKneePointValue, "Array of input knee point")
     1300  ("SEIKneeFunctionOutputKneePointValue",             cfg_kneeSEIOutputKneePointValue, cfg_kneeSEIOutputKneePointValue, "Array of output knee point")
     1301  ("SEIMasteringDisplayColourVolume",                 m_masteringDisplay.colourVolumeSEIEnabled,         false, "Control generation of mastering display colour volume SEI messages")
     1302  ("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)")
     1303  ("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)")
     1304  ("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)")
     1305  ("SEIMasteringDisplayWhitePoint",                   cfg_DisplayWhitePointCode,     cfg_DisplayWhitePointCode, "Mastering display white point CIE xy coordinates in normalised increments of 1/50000 (e.g. 0.333 = 16667)")
     1306#if NH_MV
     1307  ("SubBitstreamPropSEIEnabled",                      m_subBistreamPropSEIEnabled,    false                     ,"Enable signaling of sub-bitstream property SEI message")
     1308  ("SEISubBitstreamNumAdditionalSubStreams",          m_sbPropNumAdditionalSubStreams,0                         ,"Number of substreams for which additional information is signalled")
     1309  ("SEISubBitstreamSubBitstreamMode",                 m_sbPropSubBitstreamMode,       std::vector< Int  >(1,0)  ,"Specifies mode of generation of the i-th sub-bitstream (0 or 1)")
     1310  ("SEISubBitstreamOutputLayerSetIdxToVps",           m_sbPropOutputLayerSetIdxToVps, std::vector< Int  >(1,0)  ,"Specifies output layer set index of the i-th sub-bitstream ")
     1311  ("SEISubBitstreamHighestSublayerId",                m_sbPropHighestSublayerId,      std::vector< Int  >(1,0)  ,"Specifies highest TemporalId of the i-th sub-bitstream")
     1312  ("SEISubBitstreamAvgBitRate",                       m_sbPropAvgBitRate,             std::vector< Int  >(1,0)  ,"Specifies average bit rate of the i-th sub-bitstream")
     1313  ("SEISubBitstreamMaxBitRate",                       m_sbPropMaxBitRate,             std::vector< Int  >(1,0)  ,"Specifies maximum bit rate of the i-th sub-bitstream")
     1314
     1315  ("OutputVpsInfo",                                   m_outputVpsInfo,                false                     ,"Output information about the layer dependencies and layer sets")
     1316#endif
     1317#if NH_3D
     1318/* Camera parameters */ 
     1319  ("Depth420OutputFlag",                              m_depth420OutputFlag,           true                     , "Output depth layers in 4:2:0 ")
     1320  ("CameraParameterFile,cpf",                         m_pchCameraParameterFile,    (Char *) 0,                    "Camera Parameter File Name")
     1321  ("BaseViewCameraNumbers",                           m_pchBaseViewCameraNumbers,  (Char *) 0,                    "Numbers of base views")
     1322  ("CodedCamParsPrecision",                           m_iCodedCamParPrecision,      STD_CAM_PARAMETERS_PRECISION, "precision for coding of camera parameters (in units of 2^(-x) luma samples)" )
     1323
     1324#if NH_3D_VSO
     1325  /* View Synthesis Optimization */
     1326  ("VSOConfig",                                       m_pchVSOConfig            , (Char *) 0                    ,"VSO configuration")
     1327  ("VSO",                                             m_bUseVSO                 , false                         ,"Use VSO" )   
     1328  ("VSOMode",                                         m_uiVSOMode               , (UInt)   4                    ,"VSO Mode")
     1329  ("LambdaScaleVSO",                                  m_dLambdaScaleVSO         , (Double) 1                    ,"Lambda Scaling for VSO")
     1330  ("VSOLSTable",                                      m_bVSOLSTable             , true                          ,"Depth QP dependent video/depth rate allocation by Lagrange multiplier" )     
     1331  ("ForceLambdaScaleVSO",                             m_bForceLambdaScaleVSO    , false                         ,"Force using Lambda Scale VSO also in non-VSO-Mode")
     1332  ("AllowNegDist",                                    m_bAllowNegDist           , true                          ,"Allow negative Distortion in VSO")
     1333                                                                                                             
     1334  ("UseEstimatedVSD",                                 m_bUseEstimatedVSD        , true                          ,"Model based VSD estimation instead of rendering based for some encoder decisions" )     
     1335  ("VSOEarlySkip",                                    m_bVSOEarlySkip           , true                          ,"Early skip of VSO computation if synthesis error assumed to be zero" )     
     1336                                                                                                               
     1337  ("WVSO",                                            m_bUseWVSO                , true                          ,"Use depth fidelity term for VSO" )
     1338  ("VSOWeight",                                       m_iVSOWeight              , 10                            ,"Synthesized View Distortion Change weight" )
     1339  ("VSDWeight",                                       m_iVSDWeight              , 1                             ,"View Synthesis Distortion estimate weight" )
     1340  ("DWeight",                                         m_iDWeight                , 1                             ,"Depth Distortion weight" )
    7771341#endif //HHI_VSO
    778   ("QTL",                             m_bUseQTL                 , true          , "Use depth quad tree limitation (encoder only)" )
    779 
    780   ("IvMvPredFlag"          , m_ivMvPredFlag          , std::vector< Bool >(2,true)                    , "Inter-view motion prediction"              )
    781   ("IvMvScalingFlag"       , m_ivMvScalingFlag       , std::vector< Bool >(2,true)                    , "Inter-view motion vector scaling"          )
    782   ("Log2SubPbSizeMinus3"   , m_log2SubPbSizeMinus3   , 0                                              , "Log2 minus 3 of sub Pb size"               )
    783   ("IvResPredFlag"         , m_ivResPredFlag         , true                                           , "Inter-view residual prediction"            )
    784   ("DepthRefinementFlag"   , m_depthRefinementFlag   , true                                           , "Depth to refine disparity"                 )
    785   ("ViewSynthesisPredFlag" , m_viewSynthesisPredFlag , true                                           , "View synthesis prediction"                 )
    786   ("DepthBasedBlkPartFlag" , m_depthBasedBlkPartFlag , true                                           , "Depth base block partitioning"             )
    787   ("MpiFlag"               , m_mpiFlag               , true                                           , "Motion inheritance from texture to depth"  )
    788   ("Log2MpiSubPbSizeMinus3", m_log2MpiSubPbSizeMinus3, 0                                              , "Log2 minus 3 of sub Pb size for MPI"       )
    789   ("IntraContourFlag"      , m_intraContourFlag      , true                                           , "Intra contour mode"                        )
    790   ("IntraWedgeFlag"        , m_intraWedgeFlag        , true                                           , "Intra wedge mode and segmental depth DCs"  )
    791   ("IntraSdcFlag"          , m_intraSdcFlag          , true                                           , "Intra depth DCs"                           )
    792   ("QtPredFlag"            , m_qtPredFlag            , true                                           , "Quad tree prediction from texture to depth")
    793   ("InterSdcFlag"          , m_interSdcFlag          , true                                           , "Inter depth DCs"                           )
    794   ("DepthIntraSkip"        , m_depthIntraSkipFlag    , true                                           , "Depth intra skip mode"                     )
    795 #endif //H_3D
     1342/* 3D- HEVC Tools */                                                           
     1343  ("QTL"                   ,                          m_bUseQTL                 , true                          , "Use depth quad tree limitation (encoder only)" )
     1344  ("IvMvPredFlag"          ,                          m_ivMvPredFlag            , BoolAry1d(2,true)             , "Inter-view motion prediction"              )
     1345  ("IvMvScalingFlag"       ,                          m_ivMvScalingFlag         , BoolAry1d(2,true)             , "Inter-view motion vector scaling"          )
     1346  ("Log2SubPbSizeMinus3"   ,                          m_log2SubPbSizeMinus3     , 0                             , "Log2 minus 3 of sub Pb size"               )
     1347  ("IvResPredFlag"         ,                          m_ivResPredFlag           , true                          , "Inter-view residual prediction"            )
     1348  ("DepthRefinementFlag"   ,                          m_depthRefinementFlag     , true                          , "Depth to refine disparity"                 )
     1349  ("ViewSynthesisPredFlag" ,                          m_viewSynthesisPredFlag   , true                          , "View synthesis prediction"                 )
     1350  ("DepthBasedBlkPartFlag" ,                          m_depthBasedBlkPartFlag   , true                          , "Depth base block partitioning"             )
     1351  ("MpiFlag"               ,                          m_mpiFlag                 , true                          , "Motion inheritance from texture to depth"  )
     1352  ("Log2MpiSubPbSizeMinus3",                          m_log2MpiSubPbSizeMinus3  , 0                             , "Log2 minus 3 of sub Pb size for MPI"       )
     1353  ("IntraContourFlag"      ,                          m_intraContourFlag        , true                          , "Intra contour mode"                        )
     1354  ("IntraWedgeFlag"        ,                          m_intraWedgeFlag          , true                          , "Intra wedge mode and segmental depth DCs"  )
     1355  ("IntraSdcFlag"          ,                          m_intraSdcFlag            , true                          , "Intra depth DCs"                           )
     1356  ("QtPredFlag"            ,                          m_qtPredFlag              , true                          , "Quad tree prediction from texture to depth")
     1357  ("InterSdcFlag"          ,                          m_interSdcFlag            , true                          , "Inter depth DCs"                           )
     1358  ("DepthIntraSkip"        ,                          m_depthIntraSkipFlag      , true                          , "Depth intra skip mode"                     )
     1359  ("DLT"                   ,                          m_useDLT                  , true                          , "Depth lookup table"                        )
     1360  ("IlluCompEnable"        ,                          m_abUseIC                 , true                          , "Enable illumination compensation"          )
     1361  ("IlluCompLowLatencyEnc" ,                          m_bUseLowLatencyICEnc     , false                         , "Enable low-latency illumination compensation encoding")
     1362#endif //NH_3D
     1363   
    7961364  ;
    7971365
    798 #if H_MV
     1366#if NH_MV
    7991367  // parse coding structure
    8001368  for( Int k = 0; k < MAX_NUM_LAYERS; k++ )
     
    8271395
    8281396
    829       for( Int i = 1; i < MAX_GOP + 1; i++ )
    830       {
     1397  for(Int i=1; i<MAX_GOP+1; i++)
     1398  {
    8311399        std::ostringstream cOSS2;
    8321400        cOSS2<<"Frame"<<i<<"_l"<<k;
     
    8401408  }
    8411409#else
    842   for(Int i=1; i<MAX_GOP+1; i++) {
     1410  for(Int i=1; i<MAX_GOP+1; i++)
     1411  {
    8431412    std::ostringstream cOSS;
    8441413    cOSS<<"Frame"<<i;
     
    8471416#endif
    8481417  po::setDefaults(opts);
    849   const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv);
     1418  po::ErrorReporter err;
     1419  const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv, err);
     1420
     1421  for (list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++)
     1422  {
     1423    fprintf(stderr, "Unhandled argument ignored: `%s'\n", *it);
     1424  }
     1425
     1426  if (argc == 1 || do_help)
     1427  {
     1428    /* argc == 1: no options have been specified */
     1429    po::doHelp(cout, opts);
     1430    return false;
     1431  }
     1432
     1433  if (err.is_errored)
     1434  {
     1435    if (!warnUnknowParameter)
     1436    {
     1437      /* error report has already been printed on stderr */
     1438      return false;
     1439    }
     1440  }
     1441
     1442  /*
     1443   * Set any derived parameters
     1444   */
     1445  /* convert std::string to c string for compatability */
     1446#if !NH_MV
     1447  m_pchInputFile = cfg_InputFile.empty() ? NULL : strdup(cfg_InputFile.c_str());
     1448#endif
     1449  m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str());
     1450#if !NH_MV
     1451  m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str());
     1452#endif
     1453  m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str());
    8501454
    8511455  if(m_isField)
     
    8581462    m_framesToBeEncoded *= 2;
    8591463  }
    860  
    861   for (list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++)
    862   {
    863     fprintf(stderr, "Unhandled argument ignored: `%s'\n", *it);
    864   }
    865  
    866   if (argc == 1 || do_help)
    867   {
    868     /* argc == 1: no options have been specified */
    869     po::doHelp(cout, opts);
    870     return false;
    871   }
    872  
    873   /*
    874    * Set any derived parameters
    875    */
    876   /* convert std::string to c string for compatability */
    877 #if !H_MV
    878   m_pchInputFile = cfg_InputFile.empty() ? NULL : strdup(cfg_InputFile.c_str());
    879 #endif
    880   m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str());
    881 #if !H_MV
    882   m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str());
    883 #endif
    884   m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str());
    885  
    886   Char* pColumnWidth = cfgColumnWidth.empty() ? NULL: strdup(cfgColumnWidth.c_str());
    887   Char* pRowHeight = cfgRowHeight.empty() ? NULL : strdup(cfgRowHeight.c_str());
    8881464
    8891465  if( !m_tileUniformSpacingFlag && m_numTileColumnsMinus1 > 0 )
    8901466  {
    891     char *str;
    892     int  i=0;
    893     m_tileColumnWidth.resize( m_numTileColumnsMinus1 );
    894     str = strtok(pColumnWidth, " ,-");
    895     while(str!=NULL)
    896     {
    897       if( i >= m_numTileColumnsMinus1 )
    898       {
    899         printf( "The number of columns whose width are defined is larger than the allowed number of columns.\n" );
    900         exit( EXIT_FAILURE );
    901       }
    902       m_tileColumnWidth[i] = atoi( str );
    903       str = strtok(NULL, " ,-");
    904       i++;
    905     }
    906     if( i < m_numTileColumnsMinus1 )
     1467    if (cfg_ColumnWidth.values.size() > m_numTileColumnsMinus1)
     1468    {
     1469      printf( "The number of columns whose width are defined is larger than the allowed number of columns.\n" );
     1470      exit( EXIT_FAILURE );
     1471    }
     1472    else if (cfg_ColumnWidth.values.size() < m_numTileColumnsMinus1)
    9071473    {
    9081474      printf( "The width of some columns is not defined.\n" );
    9091475      exit( EXIT_FAILURE );
    9101476    }
     1477    else
     1478    {
     1479      m_tileColumnWidth.resize(m_numTileColumnsMinus1);
     1480      for(UInt i=0; i<cfg_ColumnWidth.values.size(); i++)
     1481      {
     1482        m_tileColumnWidth[i]=cfg_ColumnWidth.values[i];
     1483      }
     1484    }
    9111485  }
    9121486  else
     
    9171491  if( !m_tileUniformSpacingFlag && m_numTileRowsMinus1 > 0 )
    9181492  {
    919     char *str;
    920     int  i=0;
    921     m_tileRowHeight.resize(m_numTileRowsMinus1);
    922     str = strtok(pRowHeight, " ,-");
    923     while(str!=NULL)
    924     {
    925       if( i>=m_numTileRowsMinus1 )
    926       {
    927         printf( "The number of rows whose height are defined is larger than the allowed number of rows.\n" );
    928         exit( EXIT_FAILURE );
    929       }
    930       m_tileRowHeight[i] = atoi( str );
    931       str = strtok(NULL, " ,-");
    932       i++;
    933     }
    934     if( i < m_numTileRowsMinus1 )
     1493    if (cfg_RowHeight.values.size() > m_numTileRowsMinus1)
     1494    {
     1495      printf( "The number of rows whose height are defined is larger than the allowed number of rows.\n" );
     1496      exit( EXIT_FAILURE );
     1497    }
     1498    else if (cfg_RowHeight.values.size() < m_numTileRowsMinus1)
    9351499    {
    9361500      printf( "The height of some rows is not defined.\n" );
    9371501      exit( EXIT_FAILURE );
    938    }
     1502    }
     1503    else
     1504    {
     1505      m_tileRowHeight.resize(m_numTileRowsMinus1);
     1506      for(UInt i=0; i<cfg_RowHeight.values.size(); i++)
     1507      {
     1508        m_tileRowHeight[i]=cfg_RowHeight.values[i];
     1509      }
     1510    }
    9391511  }
    9401512  else
     
    9421514    m_tileRowHeight.clear();
    9431515  }
    944 #if H_MV
    945   free ( pColumnWidth );
    946   free ( pRowHeight   );
    947 #endif
     1516
    9481517  m_scalingListFile = cfg_ScalingListFile.empty() ? NULL : strdup(cfg_ScalingListFile.c_str());
    949  
     1518
    9501519  /* rules for input, output and internal bitdepths as per help text */
    951   if (!m_internalBitDepthY) { m_internalBitDepthY = m_inputBitDepthY; }
    952   if (!m_internalBitDepthC) { m_internalBitDepthC = m_internalBitDepthY; }
    953   if (!m_inputBitDepthC) { m_inputBitDepthC = m_inputBitDepthY; }
    954   if (!m_outputBitDepthY) { m_outputBitDepthY = m_internalBitDepthY; }
    955   if (!m_outputBitDepthC) { m_outputBitDepthC = m_internalBitDepthC; }
    956 
    957   // TODO:ChromaFmt assumes 4:2:0 below
     1520  if (m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ] == 0)
     1521  {
     1522    m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ] = m_inputBitDepth      [CHANNEL_TYPE_LUMA  ];
     1523  }
     1524  if (m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] == 0)
     1525  {
     1526    m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] = m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ];
     1527  }
     1528  if (m_internalBitDepth   [CHANNEL_TYPE_LUMA  ] == 0)
     1529  {
     1530    m_internalBitDepth   [CHANNEL_TYPE_LUMA  ] = m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ];
     1531  }
     1532  if (m_internalBitDepth   [CHANNEL_TYPE_CHROMA] == 0)
     1533  {
     1534    m_internalBitDepth   [CHANNEL_TYPE_CHROMA] = m_internalBitDepth   [CHANNEL_TYPE_LUMA  ];
     1535  }
     1536  if (m_inputBitDepth      [CHANNEL_TYPE_CHROMA] == 0)
     1537  {
     1538    m_inputBitDepth      [CHANNEL_TYPE_CHROMA] = m_inputBitDepth      [CHANNEL_TYPE_LUMA  ];
     1539  }
     1540  if (m_outputBitDepth     [CHANNEL_TYPE_LUMA  ] == 0)
     1541  {
     1542    m_outputBitDepth     [CHANNEL_TYPE_LUMA  ] = m_internalBitDepth   [CHANNEL_TYPE_LUMA  ];
     1543  }
     1544  if (m_outputBitDepth     [CHANNEL_TYPE_CHROMA] == 0)
     1545  {
     1546    m_outputBitDepth     [CHANNEL_TYPE_CHROMA] = m_internalBitDepth   [CHANNEL_TYPE_CHROMA];
     1547  }
     1548
     1549  m_InputChromaFormatIDC = numberToChromaFormat(tmpInputChromaFormat);
     1550  m_chromaFormatIDC      = ((tmpChromaFormat == 0) ? (m_InputChromaFormatIDC) : (numberToChromaFormat(tmpChromaFormat)));
     1551
     1552#if NH_MV
     1553  // parse PTL
     1554  Bool anyEmpty = false;
     1555  if( cfg_profiles.empty() )
     1556  {
     1557#if NH_3D
     1558    cfg_profiles = string("main main 3d-main");
     1559#else
     1560    cfg_profiles = string("main main multiview-main");   
     1561#endif
     1562    fprintf(stderr, "\nWarning: No profiles given, using defaults: %s", cfg_profiles.c_str() );
     1563    anyEmpty = true;
     1564  }
     1565
     1566  if( cfg_levels.empty() )
     1567  {
     1568    cfg_levels = string("5.1 5.1 5.1");
     1569    fprintf(stderr, "\nWarning: No levels given, using defaults: %s", cfg_levels.c_str() );
     1570    anyEmpty = true;
     1571  }
     1572
     1573  if( cfg_tiers.empty() )
     1574  {
     1575    cfg_tiers = string("main main main");
     1576    fprintf(stderr, "\nWarning: No tiers given, using defaults: %s", cfg_tiers.c_str());
     1577    anyEmpty = true;
     1578  }
     1579
     1580  if( m_inblFlag.empty() )
     1581  {
     1582    fprintf(stderr, "\nWarning: No inblFlags given, using defaults:");
     1583    for( Int i = 0; i < 3; i++)
     1584    {
     1585      m_inblFlag.push_back( false );
     1586      fprintf(stderr," %d", (Int) m_inblFlag[i]);
     1587    }
     1588    anyEmpty = true;
     1589  }   
     1590
     1591  if ( anyEmpty )
     1592  {
     1593    fprintf( stderr, "\n" );
     1594  }
     1595
     1596  xReadStrToEnum( cfg_profiles, extendedProfiles  );
     1597  xReadStrToEnum( cfg_levels,   m_level     );
     1598  xReadStrToEnum( cfg_tiers ,   m_levelTier );
     1599
     1600
     1601#if NH_MV
     1602  m_profiles.resize( extendedProfiles.size());
     1603
     1604  for (Int i = 0; i < m_profiles.size(); i++)
     1605  {
     1606    Profile::Name& m_profile             = m_profiles      [i]; 
     1607    ExtendedProfileName& extendedProfile = extendedProfiles[i]; 
     1608#endif
     1609#endif
     1610
     1611  if (extendedProfile >= 1000 && extendedProfile <= 12316)
     1612    {
     1613      m_profile = Profile::MAINREXT;
     1614      if (m_bitDepthConstraint != 0 || tmpConstraintChromaFormat != 0)
     1615      {
     1616        fprintf(stderr, "Error: The bit depth and chroma format constraints are not used when an explicit RExt profile is specified\n");
     1617        exit(EXIT_FAILURE);
     1618      }
     1619      m_bitDepthConstraint     = (extendedProfile%100);
     1620    m_intraConstraintFlag          = ((extendedProfile%10000)>=2000);
     1621    m_onePictureOnlyConstraintFlag = (extendedProfile >= 10000);
     1622      switch ((extendedProfile/100)%10)
     1623      {
     1624      case 0:  tmpConstraintChromaFormat=400; break;
     1625      case 1:  tmpConstraintChromaFormat=420; break;
     1626      case 2:  tmpConstraintChromaFormat=422; break;
     1627      default: tmpConstraintChromaFormat=444; break;
     1628      }
     1629    }
     1630    else
     1631    {
     1632      m_profile = Profile::Name(extendedProfile);
     1633    }
     1634
     1635    if (m_profile == Profile::HIGHTHROUGHPUTREXT )
     1636    {
     1637      if (m_bitDepthConstraint == 0)
     1638      {
     1639        m_bitDepthConstraint = 16;
     1640      }
     1641      m_chromaFormatConstraint = (tmpConstraintChromaFormat == 0) ? CHROMA_444 : numberToChromaFormat(tmpConstraintChromaFormat);
     1642    }
     1643    else if (m_profile == Profile::MAINREXT)
     1644    {
     1645      if (m_bitDepthConstraint == 0 && tmpConstraintChromaFormat == 0)
     1646      {
     1647        // produce a valid combination, if possible.
     1648      const Bool bUsingGeneralRExtTools  = m_transformSkipRotationEnabledFlag        ||
     1649                                           m_transformSkipContextEnabledFlag         ||
     1650                                           m_rdpcmEnabledFlag[RDPCM_SIGNAL_IMPLICIT] ||
     1651                                           m_rdpcmEnabledFlag[RDPCM_SIGNAL_EXPLICIT] ||
     1652          !m_enableIntraReferenceSmoothing         ||
     1653                                           m_persistentRiceAdaptationEnabledFlag     ||
     1654                                           m_log2MaxTransformSkipBlockSize!=2;
     1655      const Bool bUsingChromaQPAdjustment= m_diffCuChromaQpOffsetDepth >= 0;
     1656      const Bool bUsingExtendedPrecision = m_extendedPrecisionProcessingFlag;
     1657      if (m_onePictureOnlyConstraintFlag)
     1658      {
     1659        m_chromaFormatConstraint = CHROMA_444;
     1660        if (m_intraConstraintFlag != true)
     1661        {
     1662          fprintf(stderr, "Error: Intra constraint flag must be true when one_picture_only_constraint_flag is true\n");
     1663          exit(EXIT_FAILURE);
     1664        }
     1665        const Int maxBitDepth = m_chromaFormatIDC==CHROMA_400 ? m_internalBitDepth[CHANNEL_TYPE_LUMA] : std::max(m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA]);
     1666        m_bitDepthConstraint = maxBitDepth>8 ? 16:8;
     1667      }
     1668      else
     1669      {
     1670        m_chromaFormatConstraint = NUM_CHROMA_FORMAT;
     1671        automaticallySelectRExtProfile(bUsingGeneralRExtTools,
     1672          bUsingChromaQPAdjustment,
     1673          bUsingExtendedPrecision,
     1674          m_intraConstraintFlag,
     1675          m_bitDepthConstraint,
     1676          m_chromaFormatConstraint,
     1677          m_chromaFormatIDC==CHROMA_400 ? m_internalBitDepth[CHANNEL_TYPE_LUMA] : std::max(m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA]),
     1678          m_chromaFormatIDC);
     1679      }
     1680    }
     1681      else if (m_bitDepthConstraint == 0 || tmpConstraintChromaFormat == 0)
     1682      {
     1683        fprintf(stderr, "Error: The bit depth and chroma format constraints must either both be specified or both be configured automatically\n");
     1684        exit(EXIT_FAILURE);
     1685      }
     1686      else
     1687      {
     1688        m_chromaFormatConstraint = numberToChromaFormat(tmpConstraintChromaFormat);
     1689      }
     1690    }
     1691    else
     1692    {
     1693      m_chromaFormatConstraint = (tmpConstraintChromaFormat == 0) ? m_chromaFormatIDC : numberToChromaFormat(tmpConstraintChromaFormat);
     1694      m_bitDepthConstraint = (m_profile == Profile::MAIN10?10:8);
     1695    }
     1696#if NH_MV
     1697  }
     1698
     1699  if ( m_numberOfLayers != 0 && ( m_profiles[0] != Profile::MAIN || m_profiles[1] != Profile::MAIN )  )
     1700  {
     1701    fprintf(stderr, "Error: The base layer must conform to the Main profile for Multilayer coding.\n");
     1702    exit(EXIT_FAILURE);
     1703  }
     1704#endif
     1705
     1706
     1707  m_inputColourSpaceConvert = stringToInputColourSpaceConvert(inputColourSpaceConvert, true);
     1708
    9581709  switch (m_conformanceWindowMode)
    9591710  {
     
    9841735        }
    9851736      }
    986       if (m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0)
     1737      if (m_aiPad[0] % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0)
    9871738      {
    9881739        fprintf(stderr, "Error: picture width is not an integer multiple of the specified chroma subsampling\n");
    9891740        exit(EXIT_FAILURE);
    9901741      }
    991       if (m_aiPad[1] % TComSPS::getWinUnitY(CHROMA_420) != 0)
     1742      if (m_aiPad[1] % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0)
    9921743      {
    9931744        fprintf(stderr, "Error: picture height is not an integer multiple of the specified chroma subsampling\n");
     
    10201771    }
    10211772  }
    1022  
     1773
    10231774  // allocate slice-based dQP values
    1024 #if H_MV
     1775#if NH_MV
     1776  for (Int i = (Int)m_layerIdInNuh.size(); i < m_numberOfLayers; i++ )
     1777  {
     1778    m_layerIdInNuh.push_back( i == 0 ? 0 : m_layerIdInNuh[ i - 1 ] + 1 );
     1779  }
     1780  xResizeVector( m_layerIdInNuh );
     1781
    10251782  xResizeVector( m_viewOrderIndex    );
    10261783
     
    10411798  xResizeVector( m_auxId );
    10421799
    1043 #if H_3D
     1800#if NH_3D
    10441801  xResizeVector( m_depthFlag );
    10451802#endif
     
    10621819      {
    10631820        m_aidQP[layer][i] = 1;
     1821      }
     1822    }
     1823
     1824    for(UInt ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++)
     1825    {
     1826      if (saoOffsetBitShift[ch]<0)
     1827      {
     1828        if (m_internalBitDepth[ch]>10)
     1829        {
     1830          m_log2SaoOffsetScale[layer][ch]=UInt(Clip3<Int>(0, m_internalBitDepth[ch]-10, Int(m_internalBitDepth[ch]-10 + 0.165*m_iQP[layer] - 3.22 + 0.5) ) );
     1831        }
     1832        else
     1833        {
     1834          m_log2SaoOffsetScale[layer][ch]=0;
     1835        }
     1836      }
     1837      else
     1838      {
     1839        m_log2SaoOffsetScale[layer][ch]=UInt(saoOffsetBitShift[ch]);
    10641840      }
    10651841    }
     
    10801856  m_aidQP = new Int[ m_framesToBeEncoded + m_iGOPSize + 1 ];
    10811857  ::memset( m_aidQP, 0, sizeof(Int)*( m_framesToBeEncoded + m_iGOPSize + 1 ) );
    1082  
     1858
    10831859  // handling of floating-point QP values
    10841860  // if QP is not integer, sequence is split into two sections having QP and QP+1
     
    10871863  {
    10881864    Int iSwitchPOC = (Int)( m_framesToBeEncoded - (m_fQP - m_iQP)*m_framesToBeEncoded + 0.5 );
    1089    
     1865
    10901866    iSwitchPOC = (Int)( (Double)iSwitchPOC / m_iGOPSize + 0.5 )*m_iGOPSize;
    10911867    for ( Int i=iSwitchPOC; i<m_framesToBeEncoded + m_iGOPSize + 1; i++ )
     
    10941870    }
    10951871  }
    1096 #endif
    1097  
     1872
     1873  for(UInt ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++)
     1874  {
     1875    if (saoOffsetBitShift[ch]<0)
     1876    {
     1877      if (m_internalBitDepth[ch]>10)
     1878      {
     1879        m_log2SaoOffsetScale[ch]=UInt(Clip3<Int>(0, m_internalBitDepth[ch]-10, Int(m_internalBitDepth[ch]-10 + 0.165*m_iQP - 3.22 + 0.5) ) );
     1880      }
     1881      else
     1882      {
     1883        m_log2SaoOffsetScale[ch]=0;
     1884      }
     1885    }
     1886    else
     1887    {
     1888      m_log2SaoOffsetScale[ch]=UInt(saoOffsetBitShift[ch]);
     1889    }
     1890  }
     1891
     1892#endif
     1893
    10981894  // reading external dQP description from file
    10991895  if ( m_pchdQPFile )
     
    11021898    if ( fpt )
    11031899    {
    1104 #if H_MV
     1900#if NH_MV
    11051901      for( Int layer = 0; layer < m_numberOfLayers; layer++ )
    11061902      {
     
    11101906      while ( iPOC < m_framesToBeEncoded )
    11111907      {
    1112         if ( fscanf(fpt, "%d", &iValue ) == EOF ) break;
    1113 #if H_MV
     1908        if ( fscanf(fpt, "%d", &iValue ) == EOF )
     1909        {
     1910          break;
     1911        }
     1912#if NH_MV
    11141913        m_aidQP[layer][ iPOC ] = iValue;
    11151914        iPOC++;
     
    11231922    }
    11241923  }
    1125   m_iWaveFrontSubstreams = m_iWaveFrontSynchro ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1;
    1126 
     1924
     1925  if( m_masteringDisplay.colourVolumeSEIEnabled )
     1926  {
     1927    for(UInt idx=0; idx<6; idx++)
     1928    {
     1929      m_masteringDisplay.primaries[idx/2][idx%2] = UShort((cfg_DisplayPrimariesCode.values.size() > idx) ? cfg_DisplayPrimariesCode.values[idx] : 0);
     1930    }
     1931    for(UInt idx=0; idx<2; idx++)
     1932    {
     1933      m_masteringDisplay.whitePoint[idx] = UShort((cfg_DisplayWhitePointCode.values.size() > idx) ? cfg_DisplayWhitePointCode.values[idx] : 0);
     1934    }
     1935  }
     1936   
    11271937  if( m_toneMappingInfoSEIEnabled && !m_toneMapCancelFlag )
    11281938  {
    1129     Char* pcStartOfCodedInterval = cfg_startOfCodedInterval.empty() ? NULL: strdup(cfg_startOfCodedInterval.c_str());
    1130     Char* pcCodedPivotValue = cfg_codedPivotValue.empty() ? NULL: strdup(cfg_codedPivotValue.c_str());
    1131     Char* pcTargetPivotValue = cfg_targetPivotValue.empty() ? NULL: strdup(cfg_targetPivotValue.c_str());
    1132     if( m_toneMapModelId == 2 && pcStartOfCodedInterval )
    1133     {
    1134       char *startOfCodedInterval;
    1135       UInt num = 1u<< m_toneMapTargetBitDepth;
     1939    if( m_toneMapModelId == 2 && !cfg_startOfCodedInterval.values.empty() )
     1940    {
     1941      const UInt num = 1u<< m_toneMapTargetBitDepth;
    11361942      m_startOfCodedInterval = new Int[num];
    1137       ::memset( m_startOfCodedInterval, 0, sizeof(Int)*num );
    1138       startOfCodedInterval = strtok(pcStartOfCodedInterval, " .");
    1139       int i = 0;
    1140       while( startOfCodedInterval && ( i < num ) )
    1141       {
    1142         m_startOfCodedInterval[i] = atoi( startOfCodedInterval );
    1143         startOfCodedInterval = strtok(NULL, " .");
    1144         i++;
    1145       }
    1146     }
     1943      for(UInt i=0; i<num; i++)
     1944      {
     1945        m_startOfCodedInterval[i] = cfg_startOfCodedInterval.values.size() > i ? cfg_startOfCodedInterval.values[i] : 0;
     1946      }
     1947    }
    11471948    else
    11481949    {
     
    11511952    if( ( m_toneMapModelId == 3 ) && ( m_numPivots > 0 ) )
    11521953    {
    1153       if( pcCodedPivotValue && pcTargetPivotValue )
    1154       {
    1155         char *codedPivotValue;
    1156         char *targetPivotValue;
    1157         m_codedPivotValue = new Int[m_numPivots];
     1954      if( !cfg_codedPivotValue.values.empty() && !cfg_targetPivotValue.values.empty() )
     1955      {
     1956        m_codedPivotValue  = new Int[m_numPivots];
    11581957        m_targetPivotValue = new Int[m_numPivots];
    1159         ::memset( m_codedPivotValue, 0, sizeof(Int)*( m_numPivots ) );
    1160         ::memset( m_targetPivotValue, 0, sizeof(Int)*( m_numPivots ) );
    1161         codedPivotValue = strtok(pcCodedPivotValue, " .");
    1162         int i=0;
    1163         while(codedPivotValue&&i<m_numPivots)
     1958        for(UInt i=0; i<m_numPivots; i++)
    11641959        {
    1165           m_codedPivotValue[i] = atoi( codedPivotValue );
    1166           codedPivotValue = strtok(NULL, " .");
    1167           i++;
    1168         }
    1169         i=0;
    1170         targetPivotValue = strtok(pcTargetPivotValue, " .");
    1171         while(targetPivotValue&&i<m_numPivots)
    1172         {
    1173           m_targetPivotValue[i]= atoi( targetPivotValue );
    1174           targetPivotValue = strtok(NULL, " .");
    1175           i++;
     1960          m_codedPivotValue[i]  = cfg_codedPivotValue.values.size()  > i ? cfg_codedPivotValue.values [i] : 0;
     1961          m_targetPivotValue[i] = cfg_targetPivotValue.values.size() > i ? cfg_targetPivotValue.values[i] : 0;
    11761962        }
    11771963      }
     
    11841970  }
    11851971
    1186 #if H_MV
    1187   // parse PTL
    1188   Bool anyEmpty = false;
    1189   if( cfg_profiles.empty() )
    1190   {
    1191 #if H_3D
    1192     cfg_profiles = string("main main 3d-main");
    1193 #else
    1194     cfg_profiles = string("main main multiview-main");   
    1195 #endif
    1196     fprintf(stderr, "\nWarning: No profiles given, using defaults: %s", cfg_profiles.c_str() );
    1197     anyEmpty = true;
    1198   }
    1199 
    1200   if( cfg_levels.empty() )
    1201   {
    1202     cfg_levels = string("none none none");
    1203     fprintf(stderr, "\nWarning: No levels given, using defaults: %s", cfg_levels.c_str() );
    1204     anyEmpty = true;
    1205   }
    1206 
    1207   if( cfg_tiers.empty() )
    1208   {
    1209     cfg_tiers = string("main main main");
    1210     fprintf(stderr, "\nWarning: No tiers given, using defaults: %s", cfg_tiers.c_str());
    1211     anyEmpty = true;
    1212   }
    1213 
    1214   if( m_inblFlag.empty() )
    1215   {
    1216     fprintf(stderr, "\nWarning: No inblFlags given, using defaults:");
    1217     for( Int i = 0; i < 3; i++)
    1218     {
    1219       m_inblFlag.push_back( false );
    1220       fprintf(stderr," %d", (Int) m_inblFlag[i]);
    1221     }
    1222     anyEmpty = true;
    1223   }   
    1224 
    1225   if ( anyEmpty )
    1226   {
    1227     fprintf( stderr, "\n" );
    1228   }
    1229 
    1230   xReadStrToEnum( cfg_profiles, m_profile   );
    1231   xReadStrToEnum( cfg_levels,   m_level     );
    1232   xReadStrToEnum( cfg_tiers ,   m_levelTier );
    1233 #endif
    1234 #if H_3D
    1235   // set global varibles
    1236   xSetGlobal();
    1237 #if H_3D_VSO
    1238 // Table base optimization
     1972  if( m_kneeSEIEnabled && !m_kneeSEICancelFlag )
     1973  {
     1974    assert ( m_kneeSEINumKneePointsMinus1 >= 0 && m_kneeSEINumKneePointsMinus1 < 999 );
     1975    m_kneeSEIInputKneePoint  = new Int[m_kneeSEINumKneePointsMinus1+1];
     1976    m_kneeSEIOutputKneePoint = new Int[m_kneeSEINumKneePointsMinus1+1];
     1977    for(Int i=0; i<(m_kneeSEINumKneePointsMinus1+1); i++)
     1978    {
     1979      m_kneeSEIInputKneePoint[i]  = cfg_kneeSEIInputKneePointValue.values.size()  > i ? cfg_kneeSEIInputKneePointValue.values[i]  : 1;
     1980      m_kneeSEIOutputKneePoint[i] = cfg_kneeSEIOutputKneePointValue.values.size() > i ? cfg_kneeSEIOutputKneePointValue.values[i] : 0;
     1981    }
     1982  }
     1983
     1984  if(m_timeCodeSEIEnabled)
     1985  {
     1986    for(Int i = 0; i < m_timeCodeSEINumTs && i < MAX_TIMECODE_SEI_SETS; i++)
     1987    {
     1988      m_timeSetArray[i].clockTimeStampFlag    = cfg_timeCodeSeiTimeStampFlag        .values.size()>i ? cfg_timeCodeSeiTimeStampFlag        .values [i] : false;
     1989      m_timeSetArray[i].numUnitFieldBasedFlag = cfg_timeCodeSeiNumUnitFieldBasedFlag.values.size()>i ? cfg_timeCodeSeiNumUnitFieldBasedFlag.values [i] : 0;
     1990      m_timeSetArray[i].countingType          = cfg_timeCodeSeiCountingType         .values.size()>i ? cfg_timeCodeSeiCountingType         .values [i] : 0;
     1991      m_timeSetArray[i].fullTimeStampFlag     = cfg_timeCodeSeiFullTimeStampFlag    .values.size()>i ? cfg_timeCodeSeiFullTimeStampFlag    .values [i] : 0;
     1992      m_timeSetArray[i].discontinuityFlag     = cfg_timeCodeSeiDiscontinuityFlag    .values.size()>i ? cfg_timeCodeSeiDiscontinuityFlag    .values [i] : 0;
     1993      m_timeSetArray[i].cntDroppedFlag        = cfg_timeCodeSeiCntDroppedFlag       .values.size()>i ? cfg_timeCodeSeiCntDroppedFlag       .values [i] : 0;
     1994      m_timeSetArray[i].numberOfFrames        = cfg_timeCodeSeiNumberOfFrames       .values.size()>i ? cfg_timeCodeSeiNumberOfFrames       .values [i] : 0;
     1995      m_timeSetArray[i].secondsValue          = cfg_timeCodeSeiSecondsValue         .values.size()>i ? cfg_timeCodeSeiSecondsValue         .values [i] : 0;
     1996      m_timeSetArray[i].minutesValue          = cfg_timeCodeSeiMinutesValue         .values.size()>i ? cfg_timeCodeSeiMinutesValue         .values [i] : 0;
     1997      m_timeSetArray[i].hoursValue            = cfg_timeCodeSeiHoursValue           .values.size()>i ? cfg_timeCodeSeiHoursValue           .values [i] : 0;
     1998      m_timeSetArray[i].secondsFlag           = cfg_timeCodeSeiSecondsFlag          .values.size()>i ? cfg_timeCodeSeiSecondsFlag          .values [i] : 0;
     1999      m_timeSetArray[i].minutesFlag           = cfg_timeCodeSeiMinutesFlag          .values.size()>i ? cfg_timeCodeSeiMinutesFlag          .values [i] : 0;
     2000      m_timeSetArray[i].hoursFlag             = cfg_timeCodeSeiHoursFlag            .values.size()>i ? cfg_timeCodeSeiHoursFlag            .values [i] : 0;
     2001      m_timeSetArray[i].timeOffsetLength      = cfg_timeCodeSeiTimeOffsetLength     .values.size()>i ? cfg_timeCodeSeiTimeOffsetLength     .values [i] : 0;
     2002      m_timeSetArray[i].timeOffsetValue       = cfg_timeCodeSeiTimeOffsetValue      .values.size()>i ? cfg_timeCodeSeiTimeOffsetValue      .values [i] : 0;
     2003    }
     2004  }
     2005
     2006#if NH_3D
     2007#if NH_3D_VSO
     2008  // Table base optimization
    12392009  // Q&D
    12402010  Double adLambdaScaleTable[] =
    12412011  {  0.031250, 0.031639, 0.032029, 0.032418, 0.032808, 0.033197, 0.033586, 0.033976, 0.034365, 0.034755,
    1242      0.035144, 0.035533, 0.035923, 0.036312, 0.036702, 0.037091, 0.037480, 0.037870, 0.038259, 0.038648,
    1243      0.039038, 0.039427, 0.039817, 0.040206, 0.040595, 0.040985, 0.041374, 0.041764, 0.042153, 0.042542,
    1244      0.042932, 0.043321, 0.043711, 0.044100, 0.044194, 0.053033, 0.061872, 0.070711, 0.079550, 0.088388,
    1245      0.117851, 0.147314, 0.176777, 0.235702, 0.294628, 0.353553, 0.471405, 0.589256, 0.707107, 0.707100,
    1246      0.753550, 0.800000 
     2012  0.035144, 0.035533, 0.035923, 0.036312, 0.036702, 0.037091, 0.037480, 0.037870, 0.038259, 0.038648,
     2013  0.039038, 0.039427, 0.039817, 0.040206, 0.040595, 0.040985, 0.041374, 0.041764, 0.042153, 0.042542,
     2014  0.042932, 0.043321, 0.043711, 0.044100, 0.044194, 0.053033, 0.061872, 0.070711, 0.079550, 0.088388,
     2015  0.117851, 0.147314, 0.176777, 0.235702, 0.294628, 0.353553, 0.471405, 0.589256, 0.707107, 0.707100,
     2016  0.753550, 0.800000 
    12472017  };
    12482018  if ( m_bUseVSO && m_bVSOLSTable )
     
    12612031    m_dLambdaScaleVSO *= adLambdaScaleTable[m_iQP[firstDepthLayer]];
    12622032  }
    1263 #endif
    1264 #if H_3D_VSO
    1265 if ( m_bUseVSO && m_uiVSOMode == 4)
    1266 {
    1267   m_cRenModStrParser.setString( m_iNumberOfViews, m_pchVSOConfig );
     2033  if ( m_bUseVSO && m_uiVSOMode == 4)
     2034  {
     2035    m_cRenModStrParser.setString( m_iNumberOfViews, m_pchVSOConfig );
     2036    m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
     2037      m_internalBitDepth[ CHANNEL_TYPE_LUMA],
     2038      (UInt)m_iCodedCamParPrecision,
     2039      m_FrameSkip,
     2040      (UInt)m_framesToBeEncoded,
     2041      m_pchCameraParameterFile,
     2042      m_pchBaseViewCameraNumbers,
     2043      NULL,
     2044      m_cRenModStrParser.getSynthViews(),
     2045      LOG2_DISP_PREC_LUT );
     2046  }
     2047  else if ( m_bUseVSO && m_uiVSOMode != 4 )
     2048  {
     2049    m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
     2050      m_internalBitDepth[ CHANNEL_TYPE_LUMA],
     2051      (UInt)m_iCodedCamParPrecision,
     2052      m_FrameSkip,
     2053      (UInt)m_framesToBeEncoded,
     2054      m_pchCameraParameterFile,
     2055      m_pchBaseViewCameraNumbers,
     2056      m_pchVSOConfig,
     2057      NULL,
     2058      LOG2_DISP_PREC_LUT );
     2059  }
     2060  else
     2061  {
     2062    m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
     2063      m_internalBitDepth[ CHANNEL_TYPE_LUMA],
     2064      (UInt) m_iCodedCamParPrecision,
     2065      m_FrameSkip,
     2066      (UInt) m_framesToBeEncoded,
     2067      m_pchCameraParameterFile,
     2068      m_pchBaseViewCameraNumbers,
     2069      NULL,
     2070      NULL,
     2071      LOG2_DISP_PREC_LUT );
     2072  }
     2073#else
    12682074  m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
    1269                                       g_bitDepthY,
    1270                                 (UInt)m_iCodedCamParPrecision,
    1271                                       m_FrameSkip,
    1272                                 (UInt)m_framesToBeEncoded,
    1273                                       m_pchCameraParameterFile,
    1274                                       m_pchBaseViewCameraNumbers,
    1275                                       NULL,
    1276                                       m_cRenModStrParser.getSynthViews(),
    1277                                       LOG2_DISP_PREC_LUT );
    1278 }
    1279 else if ( m_bUseVSO && m_uiVSOMode != 4 )
    1280 {
    1281   m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
    1282                                       g_bitDepthY,
    1283                                 (UInt)m_iCodedCamParPrecision,
    1284                                       m_FrameSkip,
    1285                                 (UInt)m_framesToBeEncoded,
    1286                                       m_pchCameraParameterFile,
    1287                                       m_pchBaseViewCameraNumbers,
    1288                                       m_pchVSOConfig,
    1289                                       NULL,
    1290                                       LOG2_DISP_PREC_LUT );
    1291 }
    1292 else
    1293 {
    1294   m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
    1295     g_bitDepthY,
     2075    m_internalBitDepth[ CHANNEL_TYPE_LUMA],
    12962076    (UInt) m_iCodedCamParPrecision,
    12972077    m_FrameSkip,
     
    13022082    NULL,
    13032083    LOG2_DISP_PREC_LUT );
    1304 }
    1305 #else
    1306   m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
    1307     g_bitDepthY,
    1308     (UInt) m_iCodedCamParPrecision,
    1309     m_FrameSkip,
    1310     (UInt) m_framesToBeEncoded,
    1311     m_pchCameraParameterFile,
    1312     m_pchBaseViewCameraNumbers,
    1313     NULL,
    1314     NULL,
    1315     LOG2_DISP_PREC_LUT );
    13162084#endif
    13172085  m_cCameraData.check( false, true );
    13182086#endif
     2087
    13192088  // check validity of input parameters
    13202089  xCheckParameter();
    13212090
    1322 #if !H_3D
    1323   // set global varibles
    1324   xSetGlobal();
    1325 #endif
    1326  
     2091  // compute actual CU depth with respect to config depth and max transform size
     2092  UInt uiAddCUDepth  = 0;
     2093  while( (m_uiMaxCUWidth>>m_uiMaxCUDepth) > ( 1 << ( m_uiQuadtreeTULog2MinSize + uiAddCUDepth )  ) )
     2094  {
     2095    uiAddCUDepth++;
     2096  }
     2097
     2098  m_uiMaxTotalCUDepth = m_uiMaxCUDepth + uiAddCUDepth + getMaxCUDepthOffset(m_chromaFormatIDC, m_uiQuadtreeTULog2MinSize); // if minimum TU larger than 4x4, allow for additional part indices for 4:2:2 SubTUs.
     2099  m_uiLog2DiffMaxMinCodingBlockSize = m_uiMaxCUDepth - 1;
     2100
    13272101  // print-out parameters
    13282102  xPrintParameter();
    1329  
     2103
    13302104  return true;
    13312105}
     2106
     2107
    13322108// ====================================================================================================================
    13332109// Private member functions
    13342110// ====================================================================================================================
    1335 
    1336 Bool confirmPara(Bool bflag, const Char* message);
    13372111
    13382112Void TAppEncCfg::xCheckParameter()
     
    13482122
    13492123
    1350 #if !H_MV
     2124#if !NH_MV
    13512125  if( m_profile==Profile::NONE )
    13522126  {
     
    13652139  Bool check_failed = false; /* abort if there is a fatal configuration problem */
    13662140#define xConfirmPara(a,b) check_failed |= confirmPara(a,b)
     2141
     2142  xConfirmPara(m_pchBitstreamFile==NULL, "A bitstream file name must be specified (BitstreamFile)");
     2143  const UInt maxBitDepth=(m_chromaFormatIDC==CHROMA_400) ? m_internalBitDepth[CHANNEL_TYPE_LUMA] : std::max(m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA]);
     2144  xConfirmPara(m_bitDepthConstraint<maxBitDepth, "The internalBitDepth must not be greater than the bitDepthConstraint value");
     2145  xConfirmPara(m_chromaFormatConstraint<m_chromaFormatIDC, "The chroma format used must not be greater than the chromaFormatConstraint value");
     2146#if NH_MV
     2147  Profile::Name & m_profile = m_profiles[0];
     2148#endif
     2149
     2150  if (m_profile==Profile::MAINREXT || m_profile==Profile::HIGHTHROUGHPUTREXT)
     2151  {
     2152    xConfirmPara(m_lowerBitRateConstraintFlag==false && m_intraConstraintFlag==false, "The lowerBitRateConstraint flag cannot be false when intraConstraintFlag is false");
     2153    xConfirmPara(m_cabacBypassAlignmentEnabledFlag && m_profile!=Profile::HIGHTHROUGHPUTREXT, "AlignCABACBeforeBypass must not be enabled unless the high throughput profile is being used.");
     2154    if (m_profile == Profile::MAINREXT)
     2155    {
     2156      const UInt intraIdx = m_intraConstraintFlag ? 1:0;
     2157      const UInt bitDepthIdx = (m_bitDepthConstraint == 8 ? 0 : (m_bitDepthConstraint ==10 ? 1 : (m_bitDepthConstraint == 12 ? 2 : (m_bitDepthConstraint == 16 ? 3 : 4 ))));
     2158      const UInt chromaFormatIdx = UInt(m_chromaFormatConstraint);
     2159      const Bool bValidProfile = (bitDepthIdx > 3 || chromaFormatIdx>3) ? false : (validRExtProfileNames[intraIdx][bitDepthIdx][chromaFormatIdx] != NONE);
     2160      xConfirmPara(!bValidProfile, "Invalid intra constraint flag, bit depth constraint flag and chroma format constraint flag combination for a RExt profile");
     2161      const Bool bUsingGeneralRExtTools  = m_transformSkipRotationEnabledFlag        ||
     2162                                           m_transformSkipContextEnabledFlag         ||
     2163                                           m_rdpcmEnabledFlag[RDPCM_SIGNAL_IMPLICIT] ||
     2164                                           m_rdpcmEnabledFlag[RDPCM_SIGNAL_EXPLICIT] ||
     2165                                           !m_enableIntraReferenceSmoothing         ||
     2166                                           m_persistentRiceAdaptationEnabledFlag     ||
     2167                                           m_log2MaxTransformSkipBlockSize!=2;
     2168      const Bool bUsingChromaQPTool      = m_diffCuChromaQpOffsetDepth >= 0;
     2169      const Bool bUsingExtendedPrecision = m_extendedPrecisionProcessingFlag;
     2170
     2171      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");
     2172      xConfirmPara(m_bitDepthConstraint != 16 && bUsingExtendedPrecision, "Extended precision can only be used in 16-bit RExt profiles");
     2173      if (!(m_chromaFormatConstraint == CHROMA_400 && m_bitDepthConstraint == 16) && m_chromaFormatConstraint!=CHROMA_444)
     2174      {
     2175        xConfirmPara(bUsingGeneralRExtTools, "Combination of tools and profiles are not possible in the specified RExt profile.");
     2176      }
     2177      xConfirmPara( m_onePictureOnlyConstraintFlag && m_chromaFormatConstraint!=CHROMA_444, "chroma format constraint must be 4:4:4 when one-picture-only constraint flag is 1");
     2178      xConfirmPara( m_onePictureOnlyConstraintFlag && m_bitDepthConstraint != 8 && m_bitDepthConstraint != 16, "bit depth constraint must be 8 or 16 when one-picture-only constraint flag is 1");
     2179      xConfirmPara( m_onePictureOnlyConstraintFlag && m_framesToBeEncoded > 1, "Number of frames to be encoded must be 1 when one-picture-only constraint flag is 1.");
     2180
     2181      if (!m_intraConstraintFlag && m_bitDepthConstraint==16 && m_chromaFormatConstraint==CHROMA_444)
     2182      {
     2183        fprintf(stderr, "********************************************************************************************************\n");
     2184        fprintf(stderr, "** WARNING: The RExt constraint flags describe a non standard combination (used for development only) **\n");
     2185        fprintf(stderr, "********************************************************************************************************\n");
     2186      }
     2187    }
     2188    else
     2189    {
     2190      xConfirmPara( m_chromaFormatConstraint != CHROMA_444, "chroma format constraint must be 4:4:4 in the High Throughput 4:4:4 16-bit Intra profile.");
     2191      xConfirmPara( m_bitDepthConstraint     != 16,         "bit depth constraint must be 4:4:4 in the High Throughput 4:4:4 16-bit Intra profile.");
     2192      xConfirmPara( m_intraConstraintFlag    != 1,          "intra constraint flag must be 1 in the High Throughput 4:4:4 16-bit Intra profile.");
     2193    }
     2194  }
     2195  else
     2196  {
     2197    xConfirmPara(m_bitDepthConstraint!=((m_profile==Profile::MAIN10)?10:8), "BitDepthConstraint must be 8 for MAIN profile and 10 for MAIN10 profile.");
     2198    xConfirmPara(m_chromaFormatConstraint!=CHROMA_420, "ChromaFormatConstraint must be 420 for non main-RExt profiles.");
     2199    xConfirmPara(m_intraConstraintFlag==true, "IntraConstraintFlag must be false for non main_RExt profiles.");
     2200    xConfirmPara(m_lowerBitRateConstraintFlag==false, "LowerBitrateConstraintFlag must be true for non main-RExt profiles.");
     2201    xConfirmPara(m_profile == Profile::MAINSTILLPICTURE && m_framesToBeEncoded > 1, "Number of frames to be encoded must be 1 when main still picture profile is used.");
     2202
     2203    xConfirmPara(m_crossComponentPredictionEnabledFlag==true, "CrossComponentPrediction must not be used for non main-RExt profiles.");
     2204    xConfirmPara(m_log2MaxTransformSkipBlockSize!=2, "Transform Skip Log2 Max Size must be 2 for V1 profiles.");
     2205    xConfirmPara(m_transformSkipRotationEnabledFlag==true, "UseResidualRotation must not be enabled for non main-RExt profiles.");
     2206    xConfirmPara(m_transformSkipContextEnabledFlag==true, "UseSingleSignificanceMapContext must not be enabled for non main-RExt profiles.");
     2207    xConfirmPara(m_rdpcmEnabledFlag[RDPCM_SIGNAL_IMPLICIT]==true, "ImplicitResidualDPCM must not be enabled for non main-RExt profiles.");
     2208    xConfirmPara(m_rdpcmEnabledFlag[RDPCM_SIGNAL_EXPLICIT]==true, "ExplicitResidualDPCM must not be enabled for non main-RExt profiles.");
     2209    xConfirmPara(m_persistentRiceAdaptationEnabledFlag==true, "GolombRiceParameterAdaption must not be enabled for non main-RExt profiles.");
     2210    xConfirmPara(m_extendedPrecisionProcessingFlag==true, "UseExtendedPrecision must not be enabled for non main-RExt profiles.");
     2211    xConfirmPara(m_highPrecisionOffsetsEnabledFlag==true, "UseHighPrecisionPredictionWeighting must not be enabled for non main-RExt profiles.");
     2212    xConfirmPara(m_enableIntraReferenceSmoothing==false, "EnableIntraReferenceSmoothing must be enabled for non main-RExt profiles.");
     2213    xConfirmPara(m_cabacBypassAlignmentEnabledFlag, "AlignCABACBeforeBypass cannot be enabled for non main-RExt profiles.");
     2214  }
     2215
    13672216  // check range of parameters
    1368   xConfirmPara( m_inputBitDepthY < 8,                                                     "InputBitDepth must be at least 8" );
    1369   xConfirmPara( m_inputBitDepthC < 8,                                                     "InputBitDepthC must be at least 8" );
     2217  xConfirmPara( m_inputBitDepth[CHANNEL_TYPE_LUMA  ] < 8,                                   "InputBitDepth must be at least 8" );
     2218  xConfirmPara( m_inputBitDepth[CHANNEL_TYPE_CHROMA] < 8,                                   "InputBitDepthC must be at least 8" );
     2219
     2220#if !RExt__HIGH_BIT_DEPTH_SUPPORT
     2221  if (m_extendedPrecisionProcessingFlag)
     2222  {
     2223    for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
     2224    {
     2225      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...");
     2226    }
     2227  }
     2228  else
     2229  {
     2230    for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
     2231    {
     2232      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...");
     2233    }
     2234  }
     2235#endif
     2236
     2237  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)" );
     2238  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)" );
     2239
     2240#if NH_MV
     2241  for (Int i = 0; i < m_numberOfLayers; i++)
     2242  {
     2243    xConfirmPara( m_log2SaoOffsetScale[i][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");
     2244    xConfirmPara( m_log2SaoOffsetScale[i][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");
     2245  }
     2246#else
     2247  xConfirmPara( m_log2SaoOffsetScale[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");
     2248  xConfirmPara( m_log2SaoOffsetScale[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");
     2249#endif
     2250
     2251  xConfirmPara( m_chromaFormatIDC >= NUM_CHROMA_FORMAT,                                     "ChromaFormatIDC must be either 400, 420, 422 or 444" );
     2252  std::string sTempIPCSC="InputColourSpaceConvert must be empty, "+getListOfColourSpaceConverts(true);
     2253  xConfirmPara( m_inputColourSpaceConvert >= NUMBER_INPUT_COLOUR_SPACE_CONVERSIONS,         sTempIPCSC.c_str() );
     2254  xConfirmPara( m_InputChromaFormatIDC >= NUM_CHROMA_FORMAT,                                "InputChromaFormatIDC must be either 400, 420, 422 or 444" );
    13702255  xConfirmPara( m_iFrameRate <= 0,                                                          "Frame rate must be more than 1" );
    13712256  xConfirmPara( m_framesToBeEncoded <= 0,                                                   "Total Number Of Frames encoded must be more than 0" );
    1372 #if H_MV
     2257#if NH_MV
    13732258  xConfirmPara( m_numberOfLayers > MAX_NUM_LAYER_IDS ,                                      "NumberOfLayers must be less than or equal to MAX_NUM_LAYER_IDS");
    13742259
     
    13762261  xConfirmPara( m_layerIdInNuh[0] != 0      , "LayerIdInNuh must be 0 for the first layer. ");
    13772262  xConfirmPara( (m_layerIdInNuh.size()!=1) && (m_layerIdInNuh.size() < m_numberOfLayers) , "LayerIdInNuh must be given for all layers. ");
    1378  
    1379 #if H_3D
     2263
     2264#if NH_3D
    13802265  xConfirmPara( m_scalabilityMask != 2 && m_scalabilityMask != 3, "Scalability Mask must be equal to 2 or 3. ");
    13812266#else
     
    13832268#endif
    13842269
    1385 #if H_3D
     2270#if NH_3D
    13862271  if ( m_scalabilityMask & ( 1 << DEPTH_ID ) )
    13872272  {
     
    14032288
    14042289  dimBitOffset[ 0 ] = 0;
    1405   for (Int j = 1; j <= ((Int) m_dimIds.size() - m_splittingFlag ? 1 : 0); j++ )
    1406  {
     2290  for (Int j = 1; j <= (((Int) m_dimIds.size() - m_splittingFlag) ? 1 : 0); j++ )
     2291  {
    14072292    dimBitOffset[ j ] = dimBitOffset[ j - 1 ] + m_dimensionIdLen[ j - 1];
    14082293  }
     
    14122297    dimBitOffset[ (Int) m_dimIds.size() ] = 6;
    14132298  }
    1414  
     2299
    14152300  for( Int j = 0; j < m_dimIds.size(); j++ )
    14162301  {   
     
    14182303    xConfirmPara( (m_dimIds[j][0] != 0)                 , "DimensionId of layer 0 must be 0. " );
    14192304    xConfirmPara( m_dimensionIdLen[j] < 1 || m_dimensionIdLen[j] > 8, "DimensionIdLen must be greater than 0 and less than 9 in all dimensions. " );
    1420      
    1421 
    1422    for( Int i = 1; i < m_numberOfLayers; i++ )
    1423    {     
     2305
     2306
     2307    for( Int i = 1; i < m_numberOfLayers; i++ )
     2308    {     
    14242309      xConfirmPara(  ( m_dimIds[j][i] < 0 ) || ( m_dimIds[j][i] > ( ( 1 << m_dimensionIdLen[j] ) - 1 ) )   , "DimensionId shall be in the range of 0 to 2^DimensionIdLen - 1. " );
    14252310      if ( m_splittingFlag )
     
    14282313        xConfirmPara( ( ( layerIdInNuh & ( (1 << dimBitOffset[ j + 1 ] ) - 1) ) >> dimBitOffset[ j ] )  != m_dimIds[j][ i ]  , "When Splitting Flag is equal to 1 dimension ids shall match values derived from layer ids. ");
    14292314      }
    1430    }
    1431  }
    1432 
    1433  for( Int i = 0; i < m_numberOfLayers; i++ )
    1434  {
    1435    for( Int j = 0; j < i; j++ )
    1436    {     
    1437      Int numDiff  = 0;
    1438      Int lastDiff = -1;
    1439      for( Int dim = 0; dim < m_dimIds.size(); dim++ )
    1440      {
    1441        if ( m_dimIds[dim][i] != m_dimIds[dim][j] )
    1442        {
    1443          numDiff ++;
    1444          lastDiff = dim;
    1445        }
    1446      }
    1447 
    1448      Bool allEqual = ( numDiff == 0 );
    1449 
    1450      if ( allEqual )
    1451      {
    1452        printf( "\nError: Positions of Layers %d and %d are identical in scalability space\n", i, j);
    1453      }
    1454 
    1455      xConfirmPara( allEqual , "Each layer shall have a different position in scalability space." );
     2315    }
     2316  }
     2317
     2318  for( Int i = 0; i < m_numberOfLayers; i++ )
     2319  {
     2320    for( Int j = 0; j < i; j++ )
     2321    {     
     2322      Int numDiff  = 0;
     2323      Int lastDiff = -1;
     2324      for( Int dim = 0; dim < m_dimIds.size(); dim++ )
     2325      {
     2326        if ( m_dimIds[dim][i] != m_dimIds[dim][j] )
     2327        {
     2328          numDiff ++;
     2329          lastDiff = dim;
     2330        }
     2331      }
     2332
     2333      Bool allEqual = ( numDiff == 0 );
     2334
     2335      if ( allEqual )
     2336      {
     2337        printf( "\nError: Positions of Layers %d and %d are identical in scalability space\n", i, j);
     2338      }
     2339
     2340      xConfirmPara( allEqual , "Each layer shall have a different position in scalability space." );
    14562341
    14572342#if !H_3D_FCO
    1458      if ( numDiff  == 1 )
    1459      {
    1460        Bool inc = m_dimIds[ lastDiff ][ i ] > m_dimIds[ lastDiff ][ j ];
    1461        Bool shallBeButIsNotIncreasing = ( !inc  ) ;
    1462        if ( shallBeButIsNotIncreasing )
    1463        {       
    1464          printf( "\nError: Positions of Layers %d and %d is not increasing in dimension %d \n", i, j, lastDiff);       
    1465        }
    1466        xConfirmPara( shallBeButIsNotIncreasing,  "DimensionIds shall be increasing within one dimension. " );
    1467      }
    1468 #endif
    1469    }
    1470  }
    1471 
    1472  /// ViewId
    1473  xConfirmPara( m_viewId.size() != m_iNumberOfViews, "The number of ViewIds must be equal to the number of views." );
     2343      if ( numDiff  == 1 )
     2344      {
     2345        Bool inc = m_dimIds[ lastDiff ][ i ] > m_dimIds[ lastDiff ][ j ];
     2346        Bool shallBeButIsNotIncreasing = ( !inc  ) ;
     2347        if ( shallBeButIsNotIncreasing )
     2348        {       
     2349          printf( "\nError: Positions of Layers %d and %d is not increasing in dimension %d \n", i, j, lastDiff);       
     2350        }
     2351        xConfirmPara( shallBeButIsNotIncreasing,  "DimensionIds shall be increasing within one dimension. " );
     2352      }
     2353#endif
     2354    }
     2355  }
     2356
     2357  /// ViewId
     2358  xConfirmPara( m_viewId.size() != m_iNumberOfViews, "The number of ViewIds must be equal to the number of views." );
    14742359
    14752360  /// Layer sets
     
    15322417
    15332418  // PTL
    1534     xConfirmPara( ( m_profile.size() != m_inblFlag.size() || m_profile.size() != m_level.size()  ||  m_profile.size() != m_levelTier.size() ), "The number of Profiles, Levels, Tiers and InblFlags must be equal." );
    1535 
    1536     if ( m_numberOfLayers > 1)
    1537     {
    1538       xConfirmPara( m_profile.size() <= 1, "The number of profiles, tiers, levels, and inblFlags must be greater than 1.");
    1539       xConfirmPara( m_inblFlag[0], "VpsProfileTierLevel[0] must have inblFlag equal to 0");
    1540       if (m_profile.size() > 1 )
    1541       {
    1542         xConfirmPara( m_profile[0]  != m_profile[1], "The profile in VpsProfileTierLevel[1] must be equal to the profile in VpsProfileTierLevel[0].");
    1543         xConfirmPara( m_inblFlag[0] != m_inblFlag[1], "inblFlag in VpsProfileTierLevel[1] must be equal to the inblFlag in VpsProfileTierLevel[0].");
    1544       }
    1545     }
    1546 
    1547     // Layer Dependencies 
     2419  xConfirmPara( ( m_profiles.size() != m_inblFlag.size() || m_profiles.size() != m_level.size()  ||  m_profiles.size() != m_levelTier.size() ), "The number of Profiles, Levels, Tiers and InblFlags must be equal." );
     2420
     2421  if ( m_numberOfLayers > 1)
     2422  {
     2423    xConfirmPara( m_profiles.size() <= 1, "The number of profiles, tiers, levels, and inblFlags must be greater than 1.");
     2424    xConfirmPara( m_inblFlag[0], "VpsProfileTierLevel[0] must have inblFlag equal to 0");
     2425    if (m_profiles.size() > 1 )
     2426    {
     2427      xConfirmPara( m_profiles[0]  != m_profiles[1], "The profile in VpsProfileTierLevel[1] must be equal to the profile in VpsProfileTierLevel[0].");
     2428      xConfirmPara( m_inblFlag[0] != m_inblFlag[1], "inblFlag in VpsProfileTierLevel[1] must be equal to the inblFlag in VpsProfileTierLevel[0].");
     2429    }
     2430  }
     2431
     2432  // Layer Dependencies 
    15482433  for (Int i = 0; i < m_numberOfLayers; i++ )
    15492434  {
     
    15572442  } 
    15582443#endif
     2444
    15592445  xConfirmPara( m_iGOPSize < 1 ,                                                            "GOP Size must be greater or equal to 1" );
    15602446  xConfirmPara( m_iGOPSize > 1 &&  m_iGOPSize % 2,                                          "GOP Size must be a multiple of 2, if GOP Size is greater than 1" );
    1561 #if H_MV
     2447#if NH_MV
    15622448  for( Int layer = 0; layer < m_numberOfLayers; layer++ )
    15632449  {
     
    15672453  xConfirmPara( (m_iIntraPeriod > 0 && m_iIntraPeriod < m_iGOPSize) || m_iIntraPeriod == 0, "Intra period must be more than GOP size, or -1 , not 0" );
    15682454#endif
    1569 #if ALLOW_RECOVERY_POINT_AS_RAP
    15702455  xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 3,                   "Decoding Refresh Type must be comprised between 0 and 3 included" );
    15712456  if(m_iDecodingRefreshType == 3)
     
    15732458    xConfirmPara( !m_recoveryPointSEIEnabled,                                               "When using RecoveryPointSEI messages as RA points, recoveryPointSEI must be enabled" );
    15742459  }
     2460
     2461  if (m_isField)
     2462  {
     2463    if (!m_pictureTimingSEIEnabled)
     2464    {
     2465      fprintf(stderr, "****************************************************************************\n");
     2466      fprintf(stderr, "** WARNING: Picture Timing SEI should be enabled for field coding!        **\n");
     2467      fprintf(stderr, "****************************************************************************\n");
     2468    }
     2469  }
     2470
     2471  if(m_crossComponentPredictionEnabledFlag && (m_chromaFormatIDC != CHROMA_444))
     2472  {
     2473    fprintf(stderr, "****************************************************************************\n");
     2474    fprintf(stderr, "** WARNING: Cross-component prediction is specified for 4:4:4 format only **\n");
     2475    fprintf(stderr, "****************************************************************************\n");
     2476
     2477    m_crossComponentPredictionEnabledFlag = false;
     2478  }
     2479
     2480  if ( m_CUTransquantBypassFlagForce && m_bUseHADME )
     2481  {
     2482    fprintf(stderr, "****************************************************************************\n");
     2483    fprintf(stderr, "** WARNING: --HadamardME has been disabled due to the enabling of         **\n");
     2484    fprintf(stderr, "**          --CUTransquantBypassFlagForce                                 **\n");
     2485    fprintf(stderr, "****************************************************************************\n");
     2486
     2487    m_bUseHADME = false; // this has been disabled so that the lambda is calculated slightly differently for lossless modes (as a result of JCTVC-R0104).
     2488  }
     2489
     2490  xConfirmPara (m_log2MaxTransformSkipBlockSize < 2, "Transform Skip Log2 Max Size must be at least 2 (4x4)");
     2491
     2492  if (m_log2MaxTransformSkipBlockSize!=2 && m_useTransformSkipFast)
     2493  {
     2494    fprintf(stderr, "***************************************************************************\n");
     2495    fprintf(stderr, "** WARNING: Transform skip fast is enabled (which only tests NxN splits),**\n");
     2496    fprintf(stderr, "**          but transform skip log2 max size is not 2 (4x4)              **\n");
     2497    fprintf(stderr, "**          It may be better to disable transform skip fast mode         **\n");
     2498    fprintf(stderr, "***************************************************************************\n");
     2499  }
     2500#if NH_MV
     2501  for( Int layer = 0; layer < m_numberOfLayers; layer++ )
     2502  {
     2503    xConfirmPara( m_iQP[layer] <  -6 * (m_internalBitDepth[CHANNEL_TYPE_LUMA] - 8) || m_iQP[layer] > 51,      "QP exceeds supported range (-QpBDOffsety to 51)" );
     2504    xConfirmPara( m_DeblockingFilterMetric && (m_bLoopFilterDisable[layer] || m_loopFilterOffsetInPPS), "If DeblockingFilterMetric is true then both LoopFilterDisable and LoopFilterOffsetInPPS must be 0");
     2505  }
    15752506#else
    1576   xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 2,                   "Decoding Refresh Type must be equal to 0, 1 or 2" );
    1577 #endif
    1578 #if H_MV
    1579   for( Int layer = 0; layer < m_numberOfLayers; layer++ )
    1580   {
    1581     xConfirmPara( m_iQP[layer] <  -6 * (m_internalBitDepthY - 8) || m_iQP[layer] > 51,      "QP exceeds supported range (-QpBDOffsety to 51)" );
    1582   }
    1583 #else
    1584   xConfirmPara( m_iQP <  -6 * (m_internalBitDepthY - 8) || m_iQP > 51,                    "QP exceeds supported range (-QpBDOffsety to 51)" );
    1585 #endif
    1586   xConfirmPara( m_loopFilterBetaOffsetDiv2 < -6 || m_loopFilterBetaOffsetDiv2 > 6,          "Loop Filter Beta Offset div. 2 exceeds supported range (-6 to 6)");
    1587   xConfirmPara( m_loopFilterTcOffsetDiv2 < -6 || m_loopFilterTcOffsetDiv2 > 6,              "Loop Filter Tc Offset div. 2 exceeds supported range (-6 to 6)");
     2507  xConfirmPara( m_iQP <  -6 * (m_internalBitDepth[CHANNEL_TYPE_LUMA] - 8) || m_iQP > 51,    "QP exceeds supported range (-QpBDOffsety to 51)" );
     2508  xConfirmPara( m_DeblockingFilterMetric && (m_bLoopFilterDisable || m_loopFilterOffsetInPPS), "If DeblockingFilterMetric is true then both LoopFilterDisable and LoopFilterOffsetInPPS must be 0");
     2509#endif
     2510 
     2511  xConfirmPara( m_loopFilterBetaOffsetDiv2 < -6 || m_loopFilterBetaOffsetDiv2 > 6,        "Loop Filter Beta Offset div. 2 exceeds supported range (-6 to 6)");
     2512  xConfirmPara( m_loopFilterTcOffsetDiv2 < -6 || m_loopFilterTcOffsetDiv2 > 6,            "Loop Filter Tc Offset div. 2 exceeds supported range (-6 to 6)");
    15882513  xConfirmPara( m_iFastSearch < 0 || m_iFastSearch > 2,                                     "Fast Search Mode is not supported value (0:Full search  1:Diamond  2:PMVFAST)" );
    15892514  xConfirmPara( m_iSearchRange < 0 ,                                                        "Search Range must be more than 0" );
    15902515  xConfirmPara( m_bipredSearchRange < 0 ,                                                   "Search Range must be more than 0" );
    1591 #if H_MV
     2516#if NH_MV
    15922517  xConfirmPara( m_iVerticalDisparitySearchRange <= 0 ,                                      "Vertical Disparity Search Range must be more than 0" );
    15932518#endif
     
    16032528  if (m_iDecodingRefreshType == 2)
    16042529  {
    1605 #if H_MV
     2530#if NH_MV
    16062531    for (Int i = 0; i < m_numberOfLayers; i++ )
    16072532    {
     
    16122537#endif
    16132538  }
     2539  xConfirmPara( m_uiMaxCUDepth < 1,                                                         "MaxPartitionDepth must be greater than zero");
    16142540  xConfirmPara( (m_uiMaxCUWidth  >> m_uiMaxCUDepth) < 4,                                    "Minimum partition width size should be larger than or equal to 8");
    16152541  xConfirmPara( (m_uiMaxCUHeight >> m_uiMaxCUDepth) < 4,                                    "Minimum partition height size should be larger than or equal to 8");
     
    16182544  xConfirmPara( (m_iSourceWidth  % (m_uiMaxCUWidth  >> (m_uiMaxCUDepth-1)))!=0,             "Resulting coded frame width must be a multiple of the minimum CU size");
    16192545  xConfirmPara( (m_iSourceHeight % (m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)))!=0,             "Resulting coded frame height must be a multiple of the minimum CU size");
    1620  
     2546
    16212547  xConfirmPara( m_uiQuadtreeTULog2MinSize < 2,                                        "QuadtreeTULog2MinSize must be 2 or greater.");
    16222548  xConfirmPara( m_uiQuadtreeTULog2MaxSize > 5,                                        "QuadtreeTULog2MaxSize must be 5 or smaller.");
    1623   xConfirmPara( (1<<m_uiQuadtreeTULog2MaxSize) > m_uiMaxCUWidth,                                        "QuadtreeTULog2MaxSize must be log2(maxCUSize) or smaller.");
    1624  
    16252549  xConfirmPara( m_uiQuadtreeTULog2MaxSize < m_uiQuadtreeTULog2MinSize,                "QuadtreeTULog2MaxSize must be greater than or equal to m_uiQuadtreeTULog2MinSize.");
    1626   xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUWidth >>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS
    1627   xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUHeight>>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS
    1628   xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUWidth  >> m_uiMaxCUDepth ), "Minimum CU width must be greater than minimum transform size." );
    1629   xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUHeight >> m_uiMaxCUDepth ), "Minimum CU height must be greater than minimum transform size." );
     2550  xConfirmPara( (1<<m_uiQuadtreeTULog2MaxSize) > m_uiMaxCUWidth,                      "QuadtreeTULog2MaxSize must be log2(maxCUSize) or smaller.");
     2551  xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) >= ( m_uiMaxCUWidth  >> (m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than or equal to minimum CU size" );
     2552  xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) >= ( m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than or equal to minimum CU size" );
    16302553  xConfirmPara( m_uiQuadtreeTUMaxDepthInter < 1,                                                         "QuadtreeTUMaxDepthInter must be greater than or equal to 1" );
    16312554  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" );
    16322555  xConfirmPara( m_uiQuadtreeTUMaxDepthIntra < 1,                                                         "QuadtreeTUMaxDepthIntra must be greater than or equal to 1" );
    16332556  xConfirmPara( m_uiMaxCUWidth < ( 1 << (m_uiQuadtreeTULog2MinSize + m_uiQuadtreeTUMaxDepthIntra - 1) ), "QuadtreeTUMaxDepthInter must be less than or equal to the difference between log2(maxCUSize) and QuadtreeTULog2MinSize plus 1" );
    1634  
     2557
    16352558  xConfirmPara(  m_maxNumMergeCand < 1,  "MaxNumMergeCand must be 1 or greater.");
    16362559  xConfirmPara(  m_maxNumMergeCand > 5,  "MaxNumMergeCand must be 5 or smaller.");
    1637 
    1638 #if H_3D_ARP
    1639 #endif
    1640 #if H_3D_SPIVMP
     2560#if NH_3D
    16412561  xConfirmPara( m_log2SubPbSizeMinus3 < 0,                                        "Log2SubPbSizeMinus3 must be equal to 0 or greater.");
    16422562  xConfirmPara( m_log2SubPbSizeMinus3 > 3,                                        "Log2SubPbSizeMinus3 must be equal to 3 or smaller.");
     
    16482568#endif
    16492569#if ADAPTIVE_QP_SELECTION
    1650 #if H_MV
     2570#if NH_MV
    16512571  for( Int layer = 0; layer < m_numberOfLayers; layer++ )
    16522572  {
     
    16612581  if( m_usePCM)
    16622582  {
     2583    for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
     2584    {
     2585      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)");
     2586    }
    16632587    xConfirmPara(  m_uiPCMLog2MinSize < 3,                                      "PCMLog2MinSize must be 3 or greater.");
    16642588    xConfirmPara(  m_uiPCMLog2MinSize > 5,                                      "PCMLog2MinSize must be 5 or smaller.");
     
    16772601    xConfirmPara( m_sliceSegmentArgument < 1 ,         "SliceSegmentArgument should be larger than or equal to 1" );
    16782602  }
    1679  
     2603
    16802604  Bool tileFlag = (m_numTileColumnsMinus1 > 0 || m_numTileRowsMinus1 > 0 );
    1681   xConfirmPara( tileFlag && m_iWaveFrontSynchro,            "Tile and Wavefront can not be applied together");
    1682 
    1683   //TODO:ChromaFmt assumes 4:2:0 below
    1684   xConfirmPara( m_iSourceWidth  % TComSPS::getWinUnitX(CHROMA_420) != 0, "Picture width must be an integer multiple of the specified chroma subsampling");
    1685   xConfirmPara( m_iSourceHeight % TComSPS::getWinUnitY(CHROMA_420) != 0, "Picture height must be an integer multiple of the specified chroma subsampling");
    1686 
    1687   xConfirmPara( m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0, "Horizontal padding must be an integer multiple of the specified chroma subsampling");
    1688   xConfirmPara( m_aiPad[1] % TComSPS::getWinUnitY(CHROMA_420) != 0, "Vertical padding must be an integer multiple of the specified chroma subsampling");
    1689 
    1690   xConfirmPara( m_confWinLeft   % TComSPS::getWinUnitX(CHROMA_420) != 0, "Left conformance window offset must be an integer multiple of the specified chroma subsampling");
    1691   xConfirmPara( m_confWinRight  % TComSPS::getWinUnitX(CHROMA_420) != 0, "Right conformance window offset must be an integer multiple of the specified chroma subsampling");
    1692   xConfirmPara( m_confWinTop    % TComSPS::getWinUnitY(CHROMA_420) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling");
    1693   xConfirmPara( m_confWinBottom % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling");
     2605  if (m_profile!=Profile::HIGHTHROUGHPUTREXT)
     2606  {
     2607    xConfirmPara( tileFlag && m_iWaveFrontSynchro,            "Tile and Wavefront can not be applied together, except in the High Throughput Intra 4:4:4 16 profile");
     2608  }
     2609
     2610  xConfirmPara( m_iSourceWidth  % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Picture width must be an integer multiple of the specified chroma subsampling");
     2611  xConfirmPara( m_iSourceHeight % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Picture height must be an integer multiple of the specified chroma subsampling");
     2612
     2613  xConfirmPara( m_aiPad[0] % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Horizontal padding must be an integer multiple of the specified chroma subsampling");
     2614  xConfirmPara( m_aiPad[1] % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Vertical padding must be an integer multiple of the specified chroma subsampling");
     2615
     2616  xConfirmPara( m_confWinLeft   % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Left conformance window offset must be an integer multiple of the specified chroma subsampling");
     2617  xConfirmPara( m_confWinRight  % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Right conformance window offset must be an integer multiple of the specified chroma subsampling");
     2618  xConfirmPara( m_confWinTop    % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling");
     2619  xConfirmPara( m_confWinBottom % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling");
    16942620
    16952621  xConfirmPara( m_defaultDisplayWindowFlag && !m_vuiParametersPresentFlag, "VUI needs to be enabled for default display window");
     
    16972623  if (m_defaultDisplayWindowFlag)
    16982624  {
    1699     xConfirmPara( m_defDispWinLeftOffset   % TComSPS::getWinUnitX(CHROMA_420) != 0, "Left default display window offset must be an integer multiple of the specified chroma subsampling");
    1700     xConfirmPara( m_defDispWinRightOffset  % TComSPS::getWinUnitX(CHROMA_420) != 0, "Right default display window offset must be an integer multiple of the specified chroma subsampling");
    1701     xConfirmPara( m_defDispWinTopOffset    % TComSPS::getWinUnitY(CHROMA_420) != 0, "Top default display window offset must be an integer multiple of the specified chroma subsampling");
    1702     xConfirmPara( m_defDispWinBottomOffset % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom default display window offset must be an integer multiple of the specified chroma subsampling");
    1703   }
    1704 
    1705 #if H_3D
     2625    xConfirmPara( m_defDispWinLeftOffset   % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Left default display window offset must be an integer multiple of the specified chroma subsampling");
     2626    xConfirmPara( m_defDispWinRightOffset  % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Right default display window offset must be an integer multiple of the specified chroma subsampling");
     2627    xConfirmPara( m_defDispWinTopOffset    % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Top default display window offset must be an integer multiple of the specified chroma subsampling");
     2628    xConfirmPara( m_defDispWinBottomOffset % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Bottom default display window offset must be an integer multiple of the specified chroma subsampling");
     2629  }
     2630
     2631#if NH_3D
    17062632  xConfirmPara( m_pchCameraParameterFile    == 0                ,   "CameraParameterFile must be given");
    17072633  xConfirmPara( m_pchBaseViewCameraNumbers  == 0                ,   "BaseViewCameraNumbers must be given" );
    17082634  xConfirmPara( m_iNumberOfViews != m_cCameraData.getBaseViewNumbers().size() ,   "Number of Views in BaseViewCameraNumbers must be equal to NumberOfViews" );
    17092635  xConfirmPara    ( m_iCodedCamParPrecision < 0 || m_iCodedCamParPrecision > 5,       "CodedCamParsPrecision must be in range of 0..5" );
    1710 #if H_3D_VSO
     2636#if NH_3D_VSO
    17112637    if( m_bUseVSO )
    17122638    {
     
    17222648    ui >>= 1;
    17232649    if( (ui & 1) == 1)
     2650    {
    17242651      xConfirmPara( ui != 1 , "Width should be 2^n");
     2652    }
    17252653  }
    17262654  ui = m_uiMaxCUHeight;
     
    17292657    ui >>= 1;
    17302658    if( (ui & 1) == 1)
     2659    {
    17312660      xConfirmPara( ui != 1 , "Height should be 2^n");
    1732   }
    1733 
    1734 #if H_MV
     2661    }
     2662  }
     2663
     2664#if NH_MV
    17352665  // validate that POC of same frame is identical across multiple layers
    17362666  Bool bErrorMvePoc = false;
     
    18802810      Int*      m_numReorderPics     = m_numReorderPicsMvc    [layer]; // It is not a member, but this name helps avoiding code duplication !!!
    18812811#endif
     2812
    18822813  /* if this is an intra-only sequence, ie IntraPeriod=1, don't verify the GOP structure
    18832814   * This permits the ability to omit a GOP structure specification */
    1884 #if H_MV
    1885   if (m_iIntraPeriod[layer] == 1 && m_GOPList[0].m_POC == -1) {
     2815#if NH_MV
     2816  if (m_iIntraPeriod[layer] == 1 && m_GOPList[0].m_POC == -1)
    18862817#else
    1887   if (m_iIntraPeriod == 1 && m_GOPList[0].m_POC == -1) {
    1888 #endif
     2818  if (m_iIntraPeriod == 1 && m_GOPList[0].m_POC == -1)
     2819#endif
     2820  {
    18892821    m_GOPList[0] = GOPEntry();
    18902822    m_GOPList[0].m_QPFactor = 1;
     
    18942826    m_GOPList[0].m_numRefPicsActive = 4;
    18952827  }
    1896  
     2828  else
     2829  {
     2830    xConfirmPara( m_intraConstraintFlag, "IntraConstraintFlag cannot be 1 for inter sequences");
     2831  }
     2832
    18972833  Bool verifiedGOP=false;
    18982834  Bool errorGOP=false;
     
    19062842  }
    19072843  Bool isOK[MAX_GOP];
    1908   for(Int i=0; i<MAX_GOP; i++) 
     2844  for(Int i=0; i<MAX_GOP; i++)
    19092845  {
    19102846    isOK[i]=false;
    19112847  }
    19122848  Int numOK=0;
    1913 #if H_MV
     2849#if NH_MV
    19142850  xConfirmPara( m_iIntraPeriod[layer] >=0&&(m_iIntraPeriod[layer]%m_iGOPSize!=0), "Intra period must be a multiple of GOPSize, or -1" );
    19152851#else
    1916 xConfirmPara( m_iIntraPeriod >=0&&(m_iIntraPeriod%m_iGOPSize!=0), "Intra period must be a multiple of GOPSize, or -1" );
     2852  xConfirmPara( m_iIntraPeriod >=0&&(m_iIntraPeriod%m_iGOPSize!=0), "Intra period must be a multiple of GOPSize, or -1" );
    19172853#endif
    19182854
     
    19242860    }
    19252861  }
    1926  
    1927 #if H_MV
    1928   if ( (m_iIntraPeriod[layer] != 1) && !m_loopFilterOffsetInPPS && m_DeblockingFilterControlPresent && (!m_bLoopFilterDisable[layer]) )
     2862
     2863#if NH_MV
     2864  if ( (m_iIntraPeriod[layer] != 1) && !m_loopFilterOffsetInPPS && (!m_bLoopFilterDisable[layer]) )
    19292865#else
    1930   if ( (m_iIntraPeriod != 1) && !m_loopFilterOffsetInPPS && m_DeblockingFilterControlPresent && (!m_bLoopFilterDisable) )
     2866  if ( (m_iIntraPeriod != 1) && !m_loopFilterOffsetInPPS && (!m_bLoopFilterDisable) )
    19312867#endif
    19322868  {
     
    19372873    }
    19382874  }
     2875
    19392876  m_extraRPSs=0;
    19402877  //start looping through frames in coding order until we can verify that the GOP structure is correct.
    1941   while(!verifiedGOP&&!errorGOP) 
     2878  while(!verifiedGOP&&!errorGOP)
    19422879  {
    19432880    Int curGOP = (checkGOP-1)%m_iGOPSize;
    1944     Int curPOC = ((checkGOP-1)/m_iGOPSize)*m_iGOPSize + m_GOPList[curGOP].m_POC;   
    1945     if(m_GOPList[curGOP].m_POC<0) 
    1946     {
    1947 #if H_MV
     2881    Int curPOC = ((checkGOP-1)/m_iGOPSize)*m_iGOPSize + m_GOPList[curGOP].m_POC;
     2882    if(m_GOPList[curGOP].m_POC<0)
     2883    {
     2884#if NH_MV
    19482885      printf("\nError: found fewer Reference Picture Sets than GOPSize for layer %d\n", layer );
    19492886#else
     
    19522889      errorGOP=true;
    19532890    }
    1954     else 
     2891    else
    19552892    {
    19562893      //check that all reference pictures are available, or have a POC < 0 meaning they might be available in the next GOP.
    19572894      Bool beforeI = false;
    1958       for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) 
     2895      for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++)
    19592896      {
    19602897        Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i];
     
    19632900          beforeI=true;
    19642901        }
    1965         else 
     2902        else
    19662903        {
    19672904          Bool found=false;
    1968           for(Int j=0; j<numRefs; j++) 
     2905          for(Int j=0; j<numRefs; j++)
    19692906          {
    1970             if(refList[j]==absPOC) 
     2907            if(refList[j]==absPOC)
    19712908            {
    19722909              found=true;
     
    19862923          if(!found)
    19872924          {
    1988 #if H_MV
     2925#if NH_MV
    19892926            printf("\nError: ref pic %d is not available for GOP frame %d of layer %d\n", m_GOPList[curGOP].m_referencePics[i], curGOP+1, layer);
    19902927#else
     
    19982935      {
    19992936        //all ref frames were present
    2000         if(!isOK[curGOP]) 
     2937        if(!isOK[curGOP])
    20012938        {
    20022939          numOK++;
     
    20082945        }
    20092946      }
    2010       else 
     2947      else
    20112948      {
    20122949        //create a new GOPEntry for this frame containing all the reference pictures that were available (POC > 0)
    20132950        m_GOPList[m_iGOPSize+m_extraRPSs]=m_GOPList[curGOP];
    20142951        Int newRefs=0;
    2015         for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) 
     2952        for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++)
    20162953        {
    20172954          Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i];
     
    20242961        }
    20252962        Int numPrefRefs = m_GOPList[curGOP].m_numRefPicsActive;
    2026        
     2963
    20272964        for(Int offset = -1; offset>-checkGOP; offset--)
    20282965        {
     
    20402977              }
    20412978            }
    2042             for(Int i=0; i<newRefs; i++) 
     2979            for(Int i=0; i<newRefs; i++)
    20432980            {
    20442981              if(m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[i]==offPOC-curPOC)
     
    20472984              }
    20482985            }
    2049             if(newRef) 
     2986            if(newRef)
    20502987            {
    20512988              Int insertPoint=newRefs;
     
    20953032          Int refPics = m_GOPList[rIdx].m_numRefPics;
    20963033          Int newIdc=0;
    2097           for(Int i = 0; i<= refPics; i++) 
     3034          for(Int i = 0; i<= refPics; i++)
    20983035          {
    20993036            Int deltaPOC = ((i != refPics)? m_GOPList[rIdx].m_referencePics[i] : 0);  // check if the reference abs POC is >= 0
     
    21173054            newIdc++;
    21183055          }
    2119           m_GOPList[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 1; 
     3056          m_GOPList[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 1;
    21203057          m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefIdc = newIdc;
    2121           m_GOPList[m_iGOPSize+m_extraRPSs].m_deltaRPS = refPOC - m_GOPList[m_iGOPSize+m_extraRPSs].m_POC; 
     3058          m_GOPList[m_iGOPSize+m_extraRPSs].m_deltaRPS = refPOC - m_GOPList[m_iGOPSize+m_extraRPSs].m_POC;
    21223059        }
    21233060        curGOP=m_iGOPSize+m_extraRPSs;
     
    21253062      }
    21263063      numRefs=0;
    2127       for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) 
     3064      for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++)
    21283065      {
    21293066        Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i];
    2130         if(absPOC >= 0) 
     3067        if(absPOC >= 0)
    21313068        {
    21323069          refList[numRefs]=absPOC;
     
    21413078  xConfirmPara(errorGOP,"Invalid GOP structure given");
    21423079  m_maxTempLayer = 1;
    2143   for(Int i=0; i<m_iGOPSize; i++) 
     3080  for(Int i=0; i<m_iGOPSize; i++)
    21443081  {
    21453082    if(m_GOPList[i].m_temporalId >= m_maxTempLayer)
     
    21473084      m_maxTempLayer = m_GOPList[i].m_temporalId+1;
    21483085    }
    2149     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");
     3086    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");
    21503087  }
    21513088  for(Int i=0; i<MAX_TLAYER; i++)
     
    21543091    m_maxDecPicBuffering[i] = 1;
    21553092  }
    2156   for(Int i=0; i<m_iGOPSize; i++) 
     3093  for(Int i=0; i<m_iGOPSize; i++)
    21573094  {
    21583095    if(m_GOPList[i].m_numRefPics+1 > m_maxDecPicBuffering[m_GOPList[i].m_temporalId])
     
    21603097      m_maxDecPicBuffering[m_GOPList[i].m_temporalId] = m_GOPList[i].m_numRefPics + 1;
    21613098    }
    2162     Int highestDecodingNumberWithLowerPOC = 0; 
     3099    Int highestDecodingNumberWithLowerPOC = 0;
    21633100    for(Int j=0; j<m_iGOPSize; j++)
    21643101    {
     
    21713108    for(Int j=0; j<highestDecodingNumberWithLowerPOC; j++)
    21723109    {
    2173       if(m_GOPList[j].m_temporalId <= m_GOPList[i].m_temporalId && 
     3110      if(m_GOPList[j].m_temporalId <= m_GOPList[i].m_temporalId &&
    21743111        m_GOPList[j].m_POC > m_GOPList[i].m_POC)
    21753112      {
    21763113        numReorder++;
    21773114      }
    2178     }   
     3115    }
    21793116    if(numReorder > m_numReorderPics[m_GOPList[i].m_temporalId])
    21803117    {
     
    21823119    }
    21833120  }
    2184   for(Int i=0; i<MAX_TLAYER-1; i++) 
     3121  for(Int i=0; i<MAX_TLAYER-1; i++)
    21853122  {
    21863123    // a lower layer can not have higher value of m_numReorderPics than a higher layer
     
    22013138  }
    22023139
    2203 
    22043140  // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ] -  1, inclusive
    22053141  if(m_numReorderPics[MAX_TLAYER-1] > m_maxDecPicBuffering[MAX_TLAYER-1] - 1)
     
    22093145
    22103146  if(m_vuiParametersPresentFlag && m_bitstreamRestrictionFlag)
    2211   { 
     3147  {
    22123148    Int PicSizeInSamplesY =  m_iSourceWidth * m_iSourceHeight;
    22133149    if(tileFlag)
     
    22213157        maxTileWidth = m_uiMaxCUWidth*((widthInCU+m_numTileColumnsMinus1)/(m_numTileColumnsMinus1+1));
    22223158        maxTileHeight = m_uiMaxCUHeight*((heightInCU+m_numTileRowsMinus1)/(m_numTileRowsMinus1+1));
    2223         // if only the last tile-row is one treeblock higher than the others 
     3159        // if only the last tile-row is one treeblock higher than the others
    22243160        // the maxTileHeight becomes smaller if the last row of treeblocks has lower height than the others
    22253161        if(!((heightInCU-1)%(m_numTileRowsMinus1+1)))
    22263162        {
    22273163          maxTileHeight = maxTileHeight - m_uiMaxCUHeight + (m_iSourceHeight % m_uiMaxCUHeight);
    2228         }     
    2229         // if only the last tile-column is one treeblock wider than the others 
    2230         // the maxTileWidth becomes smaller if the last column of treeblocks has lower width than the others   
     3164        }
     3165        // if only the last tile-column is one treeblock wider than the others
     3166        // the maxTileWidth becomes smaller if the last column of treeblocks has lower width than the others
    22313167        if(!((widthInCU-1)%(m_numTileColumnsMinus1+1)))
    22323168        {
     
    22723208      m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/((2*m_iSourceHeight+m_iSourceWidth)*m_uiMaxCUHeight)-4;
    22733209    }
    2274     else if(m_sliceMode == 1)
     3210    else if(m_sliceMode == FIXED_NUMBER_OF_CTU)
    22753211    {
    22763212      m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/(m_sliceArgument*m_uiMaxCUWidth*m_uiMaxCUHeight)-4;
     
    22813217    }
    22823218  }
     3219
    22833220  xConfirmPara( m_iWaveFrontSynchro < 0, "WaveFrontSynchro cannot be negative" );
    2284   xConfirmPara( m_iWaveFrontSubstreams <= 0, "WaveFrontSubstreams must be positive" );
    2285   xConfirmPara( m_iWaveFrontSubstreams > 1 && !m_iWaveFrontSynchro, "Must have WaveFrontSynchro > 0 in order to have WaveFrontSubstreams > 1" );
    22863221
    22873222  xConfirmPara( m_decodedPictureHashSEIEnabled<0 || m_decodedPictureHashSEIEnabled>3, "this hash type is not correct!\n");
     
    22993234  }
    23003235
     3236  if (m_kneeSEIEnabled && !m_kneeSEICancelFlag)
     3237  {
     3238    xConfirmPara( m_kneeSEINumKneePointsMinus1 < 0 || m_kneeSEINumKneePointsMinus1 > 998, "SEIKneeFunctionNumKneePointsMinus1 must be in the range of 0 to 998");
     3239    for ( UInt i=0; i<=m_kneeSEINumKneePointsMinus1; i++ )
     3240    {
     3241      xConfirmPara( m_kneeSEIInputKneePoint[i] < 1 || m_kneeSEIInputKneePoint[i] > 999, "SEIKneeFunctionInputKneePointValue must be in the range of 1 to 999");
     3242      xConfirmPara( m_kneeSEIOutputKneePoint[i] < 0 || m_kneeSEIOutputKneePoint[i] > 1000, "SEIKneeFunctionInputKneePointValue must be in the range of 0 to 1000");
     3243      if ( i > 0 )
     3244      {
     3245        xConfirmPara( m_kneeSEIInputKneePoint[i-1] >= m_kneeSEIInputKneePoint[i],  "The i-th SEIKneeFunctionInputKneePointValue must be greater than the (i-1)-th value");
     3246        xConfirmPara( m_kneeSEIOutputKneePoint[i-1] > m_kneeSEIOutputKneePoint[i],  "The i-th SEIKneeFunctionOutputKneePointValue must be greater than or equal to the (i-1)-th value");
     3247      }
     3248    }
     3249  }
     3250
    23013251  if ( m_RCEnableRateControl )
    23023252  {
     
    23113261    xConfirmPara( m_uiDeltaQpRD > 0, "Rate control cannot be used together with slice level multiple-QP optimization!\n" );
    23123262  }
    2313 #if H_MV
     3263#if NH_MV
    23143264  // VPS VUI
    23153265  for(Int i = 0; i < MAX_VPS_OP_SETS_PLUS1; i++ )
     
    23373287
    23383288  xConfirmPara(m_log2ParallelMergeLevel < 2, "Log2ParallelMergeLevel should be larger than or equal to 2");
     3289
    23393290  if (m_framePackingSEIEnabled)
    23403291  {
    23413292    xConfirmPara(m_framePackingSEIType < 3 || m_framePackingSEIType > 5 , "SEIFramePackingType must be in rage 3 to 5");
    23423293  }
    2343 
    2344 #if H_MV
     3294#if NH_MV
    23453295  }
    23463296  }
     
    23633313  }
    23643314#endif
     3315
     3316  if (m_segmentedRectFramePackingSEIEnabled)
     3317  {
     3318    xConfirmPara(m_framePackingSEIEnabled > 0 , "SEISegmentedRectFramePacking must be 0 when SEIFramePacking is 1");
     3319  }
     3320
     3321  if((m_numTileColumnsMinus1 <= 0) && (m_numTileRowsMinus1 <= 0) && m_tmctsSEIEnabled)
     3322  {
     3323    printf("Warning: SEITempMotionConstrainedTileSets is set to false to disable temporal motion-constrained tile sets SEI message because there are no tiles enabled.\n");
     3324    m_tmctsSEIEnabled = false;
     3325  }
     3326
     3327  if(m_timeCodeSEIEnabled)
     3328  {
     3329    xConfirmPara(m_timeCodeSEINumTs > MAX_TIMECODE_SEI_SETS, "Number of time sets cannot exceed 3");
     3330  }
     3331
    23653332#undef xConfirmPara
    23663333  if (check_failed)
     
    23703337}
    23713338
    2372 /** \todo use of global variables should be removed later
    2373  */
    2374 Void TAppEncCfg::xSetGlobal()
     3339const Char *profileToString(const Profile::Name profile)
    23753340{
    2376   // set max CU width & height
    2377   g_uiMaxCUWidth  = m_uiMaxCUWidth;
    2378   g_uiMaxCUHeight = m_uiMaxCUHeight;
    2379  
    2380   // compute actual CU depth with respect to config depth and max transform size
    2381   g_uiAddCUDepth  = 0;
    2382   while( (m_uiMaxCUWidth>>m_uiMaxCUDepth) > ( 1 << ( m_uiQuadtreeTULog2MinSize + g_uiAddCUDepth )  ) ) g_uiAddCUDepth++;
    2383  
    2384   m_uiMaxCUDepth += g_uiAddCUDepth;
    2385   g_uiAddCUDepth++;
    2386   g_uiMaxCUDepth = m_uiMaxCUDepth;
    2387  
    2388   // set internal bit-depth and constants
    2389   g_bitDepthY = m_internalBitDepthY;
    2390   g_bitDepthC = m_internalBitDepthC;
    2391  
    2392   g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_inputBitDepthY : m_internalBitDepthY;
    2393   g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_inputBitDepthC : m_internalBitDepthC;
     3341  static const UInt numberOfProfiles = sizeof(strToProfile)/sizeof(*strToProfile);
     3342
     3343  for (UInt profileIndex = 0; profileIndex < numberOfProfiles; profileIndex++)
     3344  {
     3345    if (strToProfile[profileIndex].value == profile)
     3346    {
     3347      return strToProfile[profileIndex].str;
     3348    }
     3349  }
     3350
     3351  //if we get here, we didn't find this profile in the list - so there is an error
     3352  std::cerr << "ERROR: Unknown profile \"" << profile << "\" in profileToString" << std::endl;
     3353  assert(false);
     3354  exit(1);
     3355  return "";
    23943356}
    23953357
     
    23973359{
    23983360  printf("\n");
    2399 #if H_MV
     3361#if NH_MV
    24003362  for( Int layer = 0; layer < m_numberOfLayers; layer++)
    24013363  {
    2402     printf("Input File %i                 : %s\n", layer, m_pchInputFileList[layer]);
     3364    printf("Input File %i                     : %s\n", layer, m_pchInputFileList[layer]);
    24033365  }
    24043366#else
    2405   printf("Input          File          : %s\n", m_pchInputFile          );
    2406 #endif
    2407   printf("Bitstream      File          : %s\n", m_pchBitstreamFile      );
    2408 #if H_MV
     3367  printf("Input          File               : %s\n", m_pchInputFile          );
     3368#endif
     3369  printf("Bitstream      File               : %s\n", m_pchBitstreamFile      );
     3370#if NH_MV
    24093371  for( Int layer = 0; layer < m_numberOfLayers; layer++)
    24103372  {
    2411     printf("Reconstruction File %i        : %s\n", layer, m_pchReconFileList[layer]);
     3373    printf("Reconstruction File %i            : %s\n", layer, m_pchReconFileList[layer]);
    24123374  }
    24133375#else
    2414   printf("Reconstruction File          : %s\n", m_pchReconFile          );
    2415 #endif
    2416 #if H_MV
     3376  printf("Reconstruction File               : %s\n", m_pchReconFile          );
     3377#endif
     3378#if NH_MV
    24173379  xPrintParaVector( "NuhLayerId"     , m_layerIdInNuh );
    24183380  if ( m_targetEncLayerIdList.size() > 0)
     
    24213383  }
    24223384  xPrintParaVector( "ViewIdVal"     , m_viewId );
    2423   xPrintParaVector( "ViewOrderIndex", m_viewOrderIndex );
     3385  xPrintParaVector( "ViewOrderIdx"  , m_viewOrderIndex );
    24243386  xPrintParaVector( "AuxId", m_auxId );
    24253387#endif
    2426 #if H_3D
    2427   xPrintParaVector( "DepthFlag", m_depthFlag );
    2428   printf("Coded Camera Param. Precision: %d\n", m_iCodedCamParPrecision);
    2429 #endif
    2430 #if H_MV 
     3388#if NH_3D
     3389  xPrintParaVector( "DepthLayerFlag", m_depthFlag );
     3390  printf("Coded Camera Param. Precision     : %d\n", m_iCodedCamParPrecision); 
     3391#endif
     3392#if NH_MV 
    24313393  xPrintParaVector( "QP"               , m_fQP                );
    24323394  xPrintParaVector( "LoopFilterDisable", m_bLoopFilterDisable );
    24333395  xPrintParaVector( "SAO"              , m_bUseSAO            );
    24343396#endif
    2435   printf("Real     Format              : %dx%d %dHz\n", m_iSourceWidth - m_confWinLeft - m_confWinRight, m_iSourceHeight - m_confWinTop - m_confWinBottom, m_iFrameRate );
    2436   printf("Internal Format              : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate );
     3397
     3398  printf("Real     Format                   : %dx%d %dHz\n", m_iSourceWidth - m_confWinLeft - m_confWinRight, m_iSourceHeight - m_confWinTop - m_confWinBottom, m_iFrameRate );
     3399  printf("Internal Format                   : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate );
     3400  printf("Sequence PSNR output              : %s\n", (m_printMSEBasedSequencePSNR ? "Linear average, MSE-based" : "Linear average only") );
     3401  printf("Sequence MSE output               : %s\n", (m_printSequenceMSE ? "Enabled" : "Disabled") );
     3402  printf("Frame MSE output                  : %s\n", (m_printFrameMSE    ? "Enabled" : "Disabled") );
     3403  printf("Cabac-zero-word-padding           : %s\n", (m_cabacZeroWordPaddingEnabled? "Enabled" : "Disabled") );
    24373404  if (m_isField)
    24383405  {
    2439     printf("Frame/Field          : Field based coding\n");
    2440     printf("Field index          : %u - %d (%d fields)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
    2441     if (m_isTopFieldFirst)
    2442     {
    2443       printf("Field Order            : Top field first\n");
     3406    printf("Frame/Field                       : Field based coding\n");
     3407    printf("Field index                       : %u - %d (%d fields)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
     3408    printf("Field Order                       : %s field first\n", m_isTopFieldFirst?"Top":"Bottom");
     3409
     3410  }
     3411  else
     3412  {
     3413    printf("Frame/Field                       : Frame based coding\n");
     3414    printf("Frame index                       : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
     3415  }
     3416#if NH_MV
     3417  printf("Profile                           :");
     3418  for (Int i = 0; i < m_profiles.size(); i++)
     3419  {
     3420    Profile::Name m_profile = m_profiles[i];
     3421
     3422#endif
     3423    if (m_profile == Profile::MAINREXT)
     3424    {
     3425    ExtendedProfileName validProfileName;
     3426    if (m_onePictureOnlyConstraintFlag)
     3427    {
     3428      validProfileName = m_bitDepthConstraint == 8 ? MAIN_444_STILL_PICTURE : (m_bitDepthConstraint == 16 ? MAIN_444_16_STILL_PICTURE : NONE);
    24443429    }
    24453430    else
    24463431    {
    2447       printf("Field Order            : Bottom field first\n");
    2448     }
    2449   }
    2450   else
    2451   {
    2452     printf("Frame/Field                  : Frame based coding\n");
    2453   printf("Frame index                  : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
    2454   }
    2455   printf("CU size / depth              : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth );
    2456   printf("RQT trans. size (min / max)  : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize );
    2457   printf("Max RQT depth inter          : %d\n", m_uiQuadtreeTUMaxDepthInter);
    2458   printf("Max RQT depth intra          : %d\n", m_uiQuadtreeTUMaxDepthIntra);
    2459   printf("Min PCM size                 : %d\n", 1 << m_uiPCMLog2MinSize);
    2460   printf("Motion search range          : %d\n", m_iSearchRange );
    2461 #if H_MV
    2462   printf("Disp search range restriction: %d\n", m_bUseDisparitySearchRangeRestriction );
    2463   printf("Vertical disp search range   : %d\n", m_iVerticalDisparitySearchRange );
    2464 #endif
    2465 #if H_MV
     3432      const UInt intraIdx = m_intraConstraintFlag ? 1:0;
     3433      const UInt bitDepthIdx = (m_bitDepthConstraint == 8 ? 0 : (m_bitDepthConstraint ==10 ? 1 : (m_bitDepthConstraint == 12 ? 2 : (m_bitDepthConstraint == 16 ? 3 : 4 ))));
     3434      const UInt chromaFormatIdx = UInt(m_chromaFormatConstraint);
     3435      validProfileName = (bitDepthIdx > 3 || chromaFormatIdx>3) ? NONE : validRExtProfileNames[intraIdx][bitDepthIdx][chromaFormatIdx];
     3436    }
     3437      std::string rextSubProfile;
     3438      if (validProfileName!=NONE)
     3439      {
     3440        rextSubProfile=enumToString(strToExtendedProfile, sizeof(strToExtendedProfile)/sizeof(*strToExtendedProfile), validProfileName);
     3441      }
     3442      if (rextSubProfile == "main_444_16")
     3443      {
     3444        rextSubProfile="main_444_16 [NON STANDARD]";
     3445      }
     3446#if NH_MV
     3447      printf(" %s (%s) ", profileToString(m_profile), (rextSubProfile.empty())?"INVALID REXT PROFILE":rextSubProfile.c_str() );
     3448#else
     3449      printf("Profile                           : %s (%s)\n", profileToString(m_profile), (rextSubProfile.empty())?"INVALID REXT PROFILE":rextSubProfile.c_str() );
     3450#endif
     3451    }
     3452    else
     3453    {
     3454#if NH_MV
     3455      printf(" %s ", profileToString(m_profile) );
     3456#else
     3457      printf("Profile                           : %s\n", profileToString(m_profile) );
     3458#endif
     3459    }
     3460#if NH_MV   
     3461  }
     3462  printf("\n");
     3463#endif
     3464
     3465  printf("CU size / depth / total-depth     : %d / %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth, m_uiMaxTotalCUDepth );
     3466  printf("RQT trans. size (min / max)       : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize );
     3467  printf("Max RQT depth inter               : %d\n", m_uiQuadtreeTUMaxDepthInter);
     3468  printf("Max RQT depth intra               : %d\n", m_uiQuadtreeTUMaxDepthIntra);
     3469  printf("Min PCM size                      : %d\n", 1 << m_uiPCMLog2MinSize);
     3470  printf("Motion search range               : %d\n", m_iSearchRange );
     3471#if NH_MV
     3472  printf("Disp search range restriction     : %d\n", m_bUseDisparitySearchRangeRestriction );
     3473  printf("Vertical disp search range        : %d\n", m_iVerticalDisparitySearchRange );
     3474#endif
     3475#if NH_MV
    24663476  xPrintParaVector( "Intra period", m_iIntraPeriod );
    24673477#else
    2468   printf("Intra period                 : %d\n", m_iIntraPeriod );
    2469 #endif
    2470   printf("Decoding refresh type        : %d\n", m_iDecodingRefreshType );
    2471 #if !H_MV
    2472   printf("QP                           : %5.2f\n", m_fQP );
    2473 #endif
    2474   printf("Max dQP signaling depth      : %d\n", m_iMaxCuDQPDepth);
    2475 
    2476   printf("Cb QP Offset                 : %d\n", m_cbQpOffset   );
    2477   printf("Cr QP Offset                 : %d\n", m_crQpOffset);
    2478 
    2479   printf("QP adaptation                : %d (range=%d)\n", m_bUseAdaptiveQP, (m_bUseAdaptiveQP ? m_iQPAdaptationRange : 0) );
    2480   printf("GOP size                     : %d\n", m_iGOPSize );
    2481   printf("Internal bit depth           : (Y:%d, C:%d)\n", m_internalBitDepthY, m_internalBitDepthC );
    2482   printf("PCM sample bit depth         : (Y:%d, C:%d)\n", g_uiPCMBitDepthLuma, g_uiPCMBitDepthChroma );
    2483   printf("RateControl                  : %d\n", m_RCEnableRateControl );
     3478  printf("Intra period                      : %d\n", m_iIntraPeriod );
     3479#endif
     3480  printf("Decoding refresh type             : %d\n", m_iDecodingRefreshType );
     3481#if !NH_MV
     3482  printf("QP                                : %5.2f\n", m_fQP );
     3483#endif
     3484  printf("Max dQP signaling depth           : %d\n", m_iMaxCuDQPDepth);
     3485
     3486  printf("Cb QP Offset                      : %d\n", m_cbQpOffset   );
     3487  printf("Cr QP Offset                      : %d\n", m_crQpOffset);
     3488  printf("QP adaptation                     : %d (range=%d)\n", m_bUseAdaptiveQP, (m_bUseAdaptiveQP ? m_iQPAdaptationRange : 0) );
     3489  printf("GOP size                          : %d\n", m_iGOPSize );
     3490  printf("Input bit depth                   : (Y:%d, C:%d)\n", m_inputBitDepth[CHANNEL_TYPE_LUMA], m_inputBitDepth[CHANNEL_TYPE_CHROMA] );
     3491  printf("MSB-extended bit depth            : (Y:%d, C:%d)\n", m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA], m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] );
     3492  printf("Internal bit depth                : (Y:%d, C:%d)\n", m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA] );
     3493  printf("PCM sample bit depth              : (Y:%d, C:%d)\n", m_bPCMInputBitDepthFlag ? m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA] : m_internalBitDepth[CHANNEL_TYPE_LUMA],
     3494                                                               m_bPCMInputBitDepthFlag ? m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] : m_internalBitDepth[CHANNEL_TYPE_CHROMA] );
     3495  printf("Intra reference smoothing         : %s\n", (m_enableIntraReferenceSmoothing          ? "Enabled" : "Disabled") );
     3496  printf("diff_cu_chroma_qp_offset_depth         : %d\n", m_diffCuChromaQpOffsetDepth);
     3497  printf("extended_precision_processing_flag     : %s\n", (m_extendedPrecisionProcessingFlag         ? "Enabled" : "Disabled") );
     3498  printf("implicit_rdpcm_enabled_flag            : %s\n", (m_rdpcmEnabledFlag[RDPCM_SIGNAL_IMPLICIT] ? "Enabled" : "Disabled") );
     3499  printf("explicit_rdpcm_enabled_flag            : %s\n", (m_rdpcmEnabledFlag[RDPCM_SIGNAL_EXPLICIT] ? "Enabled" : "Disabled") );
     3500  printf("transform_skip_rotation_enabled_flag   : %s\n", (m_transformSkipRotationEnabledFlag        ? "Enabled" : "Disabled") );
     3501  printf("transform_skip_context_enabled_flag    : %s\n", (m_transformSkipContextEnabledFlag         ? "Enabled" : "Disabled") );
     3502  printf("cross_component_prediction_enabled_flag: %s\n", (m_crossComponentPredictionEnabledFlag     ? (m_reconBasedCrossCPredictionEstimate ? "Enabled (reconstructed-residual-based estimate)" : "Enabled (encoder-side-residual-based estimate)") : "Disabled") );
     3503  printf("high_precision_offsets_enabled_flag    : %s\n", (m_highPrecisionOffsetsEnabledFlag         ? "Enabled" : "Disabled") );
     3504  printf("persistent_rice_adaptation_enabled_flag: %s\n", (m_persistentRiceAdaptationEnabledFlag     ? "Enabled" : "Disabled") );
     3505  printf("cabac_bypass_alignment_enabled_flag    : %s\n", (m_cabacBypassAlignmentEnabledFlag         ? "Enabled" : "Disabled") );
     3506#if NH_MV
     3507  Bool anySAO = false;
     3508  IntAry1d saoOffBitShiftL;
     3509  IntAry1d saoOffBitShiftC;
     3510
     3511  for (Int i = 0; i < m_numberOfLayers; i++)
     3512  {
     3513    if ( m_bUseSAO[i] )
     3514    {
     3515      anySAO = true;
     3516      saoOffBitShiftL.push_back( m_log2SaoOffsetScale[i][CHANNEL_TYPE_LUMA] );
     3517      saoOffBitShiftC.push_back( m_log2SaoOffsetScale[i][CHANNEL_TYPE_CHROMA] );
     3518    }
     3519    else
     3520    {
     3521      saoOffBitShiftL.push_back( -1 );
     3522      saoOffBitShiftC.push_back( -1 );
     3523    }
     3524  }
     3525  if (anySAO)
     3526  {
     3527    xPrintParaVector( "Sao Luma Offset bit shifts"  , saoOffBitShiftL );
     3528    xPrintParaVector( "Sao Chroma Offset bit shifts", saoOffBitShiftC );
     3529  }
     3530#else
     3531  if (m_bUseSAO)
     3532  {
     3533    printf("log2_sao_offset_scale_luma             : %d\n", m_log2SaoOffsetScale[CHANNEL_TYPE_LUMA]);
     3534    printf("log2_sao_offset_scale_chroma           : %d\n", m_log2SaoOffsetScale[CHANNEL_TYPE_CHROMA]);
     3535  }
     3536#endif
     3537
     3538  switch (m_costMode)
     3539  {
     3540    case COST_STANDARD_LOSSY:               printf("Cost function:                    : Lossy coding (default)\n"); break;
     3541    case COST_SEQUENCE_LEVEL_LOSSLESS:      printf("Cost function:                    : Sequence_level_lossless coding\n"); break;
     3542    case COST_LOSSLESS_CODING:              printf("Cost function:                    : Lossless coding with fixed QP of %d\n", LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP); break;
     3543    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;
     3544    default:                                printf("Cost function:                    : Unknown\n"); break;
     3545  }
     3546
     3547  printf("RateControl                       : %d\n", m_RCEnableRateControl );
     3548
    24843549  if(m_RCEnableRateControl)
    24853550  {
    2486     printf("TargetBitrate                : %d\n", m_RCTargetBitrate );
    2487     printf("KeepHierarchicalBit          : %d\n", m_RCKeepHierarchicalBit );
    2488     printf("LCULevelRC                   : %d\n", m_RCLCULevelRC );
    2489     printf("UseLCUSeparateModel          : %d\n", m_RCUseLCUSeparateModel );
    2490     printf("InitialQP                    : %d\n", m_RCInitialQP );
    2491     printf("ForceIntraQP                 : %d\n", m_RCForceIntraQP );
     3551    printf("TargetBitrate                     : %d\n", m_RCTargetBitrate );
     3552    printf("KeepHierarchicalBit               : %d\n", m_RCKeepHierarchicalBit );
     3553    printf("LCULevelRC                        : %d\n", m_RCLCULevelRC );
     3554    printf("UseLCUSeparateModel               : %d\n", m_RCUseLCUSeparateModel );
     3555    printf("InitialQP                         : %d\n", m_RCInitialQP );
     3556    printf("ForceIntraQP                      : %d\n", m_RCForceIntraQP );
    24923557
    24933558#if KWU_RC_MADPRED_E0227
     
    25093574    }
    25103575#endif
    2511   }
    2512   printf("Max Num Merge Candidates     : %d\n", m_maxNumMergeCand);
    2513 #if H_3D
    2514   printf("BaseViewCameraNumbers        : %s\n", m_pchBaseViewCameraNumbers );
    2515   printf("Coded Camera Param. Precision: %d\n", m_iCodedCamParPrecision);
    2516 #if H_3D_VSO
    2517   printf("Force use of Lambda Scale    : %d\n", m_bForceLambdaScaleVSO );
     3576
     3577  }
     3578
     3579  printf("Max Num Merge Candidates          : %d\n", m_maxNumMergeCand);
     3580#if NH_3D
     3581  printf("BaseViewCameraNumbers             : %s\n", m_pchBaseViewCameraNumbers );
     3582  printf("Coded Camera Param. Precision     : %d\n", m_iCodedCamParPrecision);
     3583#if NH_3D_VSO
     3584  printf("Force use of Lambda Scale         : %d\n", m_bForceLambdaScaleVSO );
    25183585
    25193586  if ( m_bUseVSO )
    25203587  {   
    2521     printf("VSO Lambda Scale             : %5.2f\n", m_dLambdaScaleVSO );
    2522     printf("VSO Mode                     : %d\n",    m_uiVSOMode       );
    2523     printf("VSO Config                   : %s\n",    m_pchVSOConfig    );
    2524     printf("VSO Negative Distortion      : %d\n",    m_bAllowNegDist ? 1 : 0);
    2525     printf("VSO LS Table                 : %d\n",    m_bVSOLSTable ? 1 : 0);
    2526     printf("VSO Estimated VSD            : %d\n",    m_bUseEstimatedVSD ? 1 : 0);
    2527     printf("VSO Early Skip               : %d\n",    m_bVSOEarlySkip ? 1 : 0);   
     3588    printf("VSO Lambda Scale                  : %5.2f\n", m_dLambdaScaleVSO );
     3589    printf("VSO Mode                          : %d\n",    m_uiVSOMode       );
     3590    printf("VSO Config                        : %s\n",    m_pchVSOConfig    );
     3591    printf("VSO Negative Distortion           : %d\n",    m_bAllowNegDist ? 1 : 0);
     3592    printf("VSO LS Table                      : %d\n",    m_bVSOLSTable ? 1 : 0);
     3593    printf("VSO Estimated VSD                 : %d\n",    m_bUseEstimatedVSD ? 1 : 0);
     3594    printf("VSO Early Skip                    : %d\n",    m_bVSOEarlySkip ? 1 : 0);   
    25283595    if ( m_bUseWVSO )
    2529     printf("Dist. Weights (VSO/VSD/SAD)  : %d/%d/%d\n ", m_iVSOWeight, m_iVSDWeight, m_iDWeight );
     3596    {
     3597      printf("Dist. Weights (VSO/VSD/SAD)       : %d/%d/%d\n ", m_iVSOWeight, m_iVSDWeight, m_iDWeight );   
     3598    }   
    25303599  }
    25313600#endif //HHI_VSO
    2532 #endif //H_3D
     3601#endif //NH_3D
    25333602  printf("\n");
    2534 #if H_MV
     3603#if NH_MV
    25353604  printf("TOOL CFG General: ");
    25363605#else
    25373606  printf("TOOL CFG: ");
    25383607#endif
    2539   printf("IBD:%d ", g_bitDepthY > m_inputBitDepthY || g_bitDepthC > m_inputBitDepthC);
     3608  printf("IBD:%d ", ((m_internalBitDepth[CHANNEL_TYPE_LUMA] > m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA]) || (m_internalBitDepth[CHANNEL_TYPE_CHROMA] > m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA])));
    25403609  printf("HAD:%d ", m_bUseHADME           );
    25413610  printf("RDQ:%d ", m_useRDOQ            );
     
    25523621  printf("TransformSkip:%d ",     m_useTransformSkip              );
    25533622  printf("TransformSkipFast:%d ", m_useTransformSkipFast       );
     3623  printf("TransformSkipLog2MaxSize:%d ", m_log2MaxTransformSkipBlockSize);
    25543624  printf("Slice: M=%d ", m_sliceMode);
    2555   if (m_sliceMode!=0)
     3625  if (m_sliceMode!=NO_SLICES)
    25563626  {
    25573627    printf("A=%d ", m_sliceArgument);
    25583628  }
    25593629  printf("SliceSegment: M=%d ",m_sliceSegmentMode);
    2560   if (m_sliceSegmentMode!=0)
     3630  if (m_sliceSegmentMode!=NO_SLICES)
    25613631  {
    25623632    printf("A=%d ", m_sliceSegmentArgument);
    25633633  }
    25643634  printf("CIP:%d ", m_bUseConstrainedIntraPred);
    2565 #if !H_MV
     3635#if !NH_MV
    25663636  printf("SAO:%d ", (m_bUseSAO)?(1):(0));
    25673637#endif
    25683638  printf("PCM:%d ", (m_usePCM && (1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0);
     3639
    25693640  if (m_TransquantBypassEnableFlag && m_CUTransquantBypassFlagForce)
    25703641  {
    2571     printf("TransQuantBypassEnabled: =1 ");
     3642    printf("TransQuantBypassEnabled: =1");
    25723643  }
    25733644  else
     
    25753646    printf("TransQuantBypassEnabled:%d ", (m_TransquantBypassEnableFlag)? 1:0 );
    25763647  }
     3648
    25773649  printf("WPP:%d ", (Int)m_useWeightedPred);
    25783650  printf("WPB:%d ", (Int)m_useWeightedBiPred);
    25793651  printf("PME:%d ", m_log2ParallelMergeLevel);
     3652  const Int iWaveFrontSubstreams = m_iWaveFrontSynchro ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1;
    25803653  printf(" WaveFrontSynchro:%d WaveFrontSubstreams:%d",
    2581           m_iWaveFrontSynchro, m_iWaveFrontSubstreams);
     3654          m_iWaveFrontSynchro, iWaveFrontSubstreams);
    25823655  printf(" ScalingList:%d ", m_useScalingListId );
    25833656  printf("TMVPMode:%d ", m_TMVPModeId     );
    25843657#if ADAPTIVE_QP_SELECTION
    2585   printf("AQpS:%d ", m_bUseAdaptQpSelect   );
     3658  printf("AQpS:%d", m_bUseAdaptQpSelect   );
    25863659#endif
    25873660
    25883661  printf(" SignBitHidingFlag:%d ", m_signHideFlag);
    2589   printf("RecalQP:%d ", m_recalculateQPAccordingToLambda ? 1 : 0 );
    2590 #if H_3D_VSO
    2591   printf("VSO:%d ", m_bUseVSO   );
     3662  printf("RecalQP:%d", m_recalculateQPAccordingToLambda ? 1 : 0 );
     3663#if NH_3D_VSO
     3664  printf(" VSO:%d ", m_bUseVSO   );
    25923665  printf("WVSO:%d ", m_bUseWVSO ); 
    25933666#endif
    2594 #if H_3D
     3667#if NH_3D
    25953668  printf( "QTL:%d "                  , m_bUseQTL);
    25963669  printf( "IlluCompEnable:%d "       , m_abUseIC);
     
    26173690#endif
    26183691
    2619   printf("\n\n"); 
     3692  printf("\n\n");
    26203693
    26213694  fflush(stdout);
     
    26253698{
    26263699  if (!bflag)
     3700  {
    26273701    return false;
    2628  
     3702  }
     3703
    26293704  printf("Error: %s\n",message);
    26303705  return true;
Note: See TracChangeset for help on using the changeset viewer.