Ignore:
Timestamp:
4 May 2015, 18:38:08 (10 years ago)
Author:
tech
Message:

Update to HM-16.5.
Starting point for further re-activation of 3D-tools.

Includes:

active:

  • MV-HEVC
  • 3D-HLS (apart from DLT)
  • VSO

inactive:

  • remaining 3D-HEVC tools.
Location:
branches/HTM-14.1-update-dev0/source/App/TAppEncoder
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-14.1-update-dev0/source/App/TAppEncoder/TAppEncCfg.cpp

    r1196 r1200  
    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
     1011  ("CbQpOffset,-cbqpofs",                             m_cbQpOffset,                                         0, "Chroma Cb QP Offset")
     1012  ("CrQpOffset,-crqpofs",                             m_crQpOffset,                                         0, "Chroma Cr QP Offset")
    5111013
    5121014#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  
     1015  ("AdaptiveQpSelection,-aqps",                       m_bUseAdaptQpSelect,                              false, "AdaptiveQpSelection")
     1016#endif
     1017
     1018  ("AdaptiveQP,-aq",                                  m_bUseAdaptiveQP,                                 false, "QP adaptation based on a psycho-visual model")
     1019  ("MaxQPAdaptationRange,-aqr",                       m_iQPAdaptationRange,                                 6, "QP adaptation range")
     1020  ("dQPFile,m",                                       cfg_dQPFile,                                 string(""), "dQP file name")
     1021  ("RDOQ",                                            m_useRDOQ,                                         true)
     1022  ("RDOQTS",                                          m_useRDOQTS,                                       true)
     1023#if T0196_SELECTIVE_RDOQ
     1024  ("SelectiveRDOQ",                                   m_useSelectiveRDOQ,                               false, "Enable selective RDOQ")
     1025#endif
     1026  ("RDpenalty",                                       m_rdPenalty,                                          0,  "RD-penalty for 32x32 TU for intra in non-intra slices. 0:disabled  1:RD-penalty  2:maximum RD-penalty")
     1027
    5231028  // Deblocking filter parameters
    524 #if H_MV
    525   ("LoopFilterDisable",              m_bLoopFilterDisable,             std::vector<Bool>(1,false), "Disable Loop Filter per Layer" )
     1029#if NH_MV
     1030  ("LoopFilterDisable",                               m_bLoopFilterDisable,                             std::vector<Bool>(1,false), "Disable Loop Filter per Layer" )
    5261031#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
     1032  ("LoopFilterDisable",                               m_bLoopFilterDisable,                             false)
     1033#endif
     1034  ("LoopFilterOffsetInPPS",                           m_loopFilterOffsetInPPS,                           true)
     1035  ("LoopFilterBetaOffset_div2",                       m_loopFilterBetaOffsetDiv2,                           0)
     1036  ("LoopFilterTcOffset_div2",                         m_loopFilterTcOffsetDiv2,                             0)
     1037  ("DeblockingFilterMetric",                          m_DeblockingFilterMetric,                         false)
     1038
    5391039  // 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
     1040  ("AMP",                                             m_enableAMP,                                       true, "Enable asymmetric motion partitions")
     1041  ("CrossComponentPrediction",                        m_crossComponentPredictionEnabledFlag,            false, "Enable the use of cross-component prediction (not valid in V1 profiles)")
     1042  ("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")
     1043  ("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")
     1044  ("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")
     1045  ("TransformSkip",                                   m_useTransformSkip,                               false, "Intra transform skipping")
     1046  ("TransformSkipFast",                               m_useTransformSkipFast,                           false, "Fast intra transform skipping")
     1047  ("TransformSkipLog2MaxSize",                        m_log2MaxTransformSkipBlockSize,                     2U, "Specify transform-skip maximum size. Minimum 2. (not valid in V1 profiles)")
     1048  ("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)")
     1049  ("ExplicitResidualDPCM",                            m_rdpcmEnabledFlag[RDPCM_SIGNAL_EXPLICIT],        false, "Enable explicitly signalled residual DPCM for inter (not valid in V1 profiles)")
     1050  ("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)")
     1051  ("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)")
     1052  ("GolombRiceParameterAdaptation",                   m_persistentRiceAdaptationEnabledFlag,            false, "Enable the adaptation of the Golomb-Rice parameter over the course of each slice")
     1053  ("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" )
     1054#if NH_MV
    5441055  ("SAO",                      m_bUseSAO, std::vector<Bool>(1,true), "Enable Sample Adaptive Offset per Layer")
    5451056#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 
     1057  ("SAO",                                             m_bUseSAO,                                         true, "Enable Sample Adaptive Offset")
     1058#endif
     1059  ("TestSAODisableAtPictureLevel",                    m_bTestSAODisableAtPictureLevel,                  false, "Enables the testing of disabling SAO at the picture level after having analysed all blocks")
     1060  ("SaoEncodingRate",                                 m_saoEncodingRate,                                 0.75, "When >0 SAO early picture termination is enabled for luma and chroma")
     1061  ("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")
     1062  ("MaxNumOffsetsPerPic",                             m_maxNumOffsetsPerPic,                             2048, "Max number of SAO offset per picture (Default: 2048)")
     1063  ("SAOLcuBoundary",                                  m_saoCtuBoundary,                                 false, "0: right/bottom CTU boundary areas skipped from SAO parameter estimation, 1: non-deblocked pixels are used for those areas")
     1064  ("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")
     1065  ("SliceArgument",                                   m_sliceArgument,                                      0, "Depending on SliceMode being:"
     1066                                                                                                               "\t1: max number of CTUs per slice"
     1067                                                                                                               "\t2: max number of bytes per slice"
     1068                                                                                                               "\t3: max number of tiles per slice")
     1069  ("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")
     1070  ("SliceSegmentArgument",                            m_sliceSegmentArgument,                               0, "Depending on SliceSegmentMode being:"
     1071                                                                                                               "\t1: max number of CTUs per slice segment"
     1072                                                                                                               "\t2: max number of bytes per slice segment"
     1073                                                                                                               "\t3: max number of tiles per slice segment")
     1074  ("LFCrossSliceBoundaryFlag",                        m_bLFCrossSliceBoundaryFlag,                       true)
     1075
     1076  ("ConstrainedIntraPred",                            m_bUseConstrainedIntraPred,                       false, "Constrained Intra Prediction")
     1077  ("FastUDIUseMPMEnabled",                            m_bFastUDIUseMPMEnabled,                           true, "If enabled, adapt intra direction search, accounting for MPM")
     1078  ("FastMEForGenBLowDelayEnabled",                    m_bFastMEForGenBLowDelayEnabled,                   true, "If enabled use a fast ME for generalised B Low Delay slices")
     1079  ("UseBLambdaForNonKeyLowDelayPictures",             m_bUseBLambdaForNonKeyLowDelayPictures,            true, "Enables use of B-Lambda for non-key low-delay pictures")
     1080  ("PCMEnabledFlag",                                  m_usePCM,                                         false)
     1081  ("PCMLog2MaxSize",                                  m_pcmLog2MaxSize,                                    5u)
     1082  ("PCMLog2MinSize",                                  m_uiPCMLog2MinSize,                                  3u)
     1083
     1084  ("PCMInputBitDepthFlag",                            m_bPCMInputBitDepthFlag,                           true)
     1085  ("PCMFilterDisableFlag",                            m_bPCMFilterDisableFlag,                          false)
     1086  ("IntraReferenceSmoothing",                         m_enableIntraReferenceSmoothing,                   true, "0: Disable use of intra reference smoothing. 1: Enable use of intra reference smoothing (not valid in V1 profiles)")
     1087  ("WeightedPredP,-wpP",                              m_useWeightedPred,                                false, "Use weighted prediction in P slices")
     1088  ("WeightedPredB,-wpB",                              m_useWeightedBiPred,                              false, "Use weighted (bidirectional) prediction in B slices")
     1089  ("Log2ParallelMergeLevel",                          m_log2ParallelMergeLevel,                            2u, "Parallel merge estimation region")
     1090    //deprecated copies of renamed tile parameters
     1091  ("UniformSpacingIdc",                               m_tileUniformSpacingFlag,                         false,      "deprecated alias of TileUniformSpacing")
     1092  ("ColumnWidthArray",                                cfg_ColumnWidth,                        cfg_ColumnWidth, "deprecated alias of TileColumnWidthArray")
     1093  ("RowHeightArray",                                  cfg_RowHeight,                            cfg_RowHeight, "deprecated alias of TileRowHeightArray")
     1094
     1095  ("TileUniformSpacing",                              m_tileUniformSpacingFlag,                         false,      "Indicates that tile columns and rows are distributed uniformly")
     1096  ("NumTileColumnsMinus1",                            m_numTileColumnsMinus1,                               0,          "Number of tile columns in a picture minus 1")
     1097  ("NumTileRowsMinus1",                               m_numTileRowsMinus1,                                  0,          "Number of rows in a picture minus 1")
     1098  ("TileColumnWidthArray",                            cfg_ColumnWidth,                        cfg_ColumnWidth, "Array containing tile column width values in units of CTU")
     1099  ("TileRowHeightArray",                              cfg_RowHeight,                            cfg_RowHeight, "Array containing tile row height values in units of CTU")
     1100  ("LFCrossTileBoundaryFlag",                         m_bLFCrossTileBoundaryFlag,                        true, "1: cross-tile-boundary loop filtering. 0:non-cross-tile-boundary loop filtering")
     1101  ("WaveFrontSynchro",                                m_iWaveFrontSynchro,                                  0, "0: no synchro; 1 synchro with top-right-right")
     1102  ("ScalingList",                                     m_useScalingListId,                    SCALING_LIST_OFF, "0/off: no scaling list, 1/default: default scaling lists, 2/file: scaling lists specified in ScalingListFile")
     1103  ("ScalingListFile",                                 cfg_ScalingListFile,                         string(""), "Scaling list file name. Use an empty string to produce help.")
     1104  ("SignHideFlag,-SBH",                               m_signHideFlag,                                    true)
     1105  ("MaxNumMergeCand",                                 m_maxNumMergeCand,                                   5u, "Maximum number of merge candidates")
    5911106  /* 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" )
     1107  ("SEIDecodedPictureHash",                           m_decodedPictureHashSEIEnabled,                       0, "Control generation of decode picture hash SEI messages\n"
     1108                                                                                                               "\t3: checksum\n"
     1109                                                                                                               "\t2: CRC\n"
     1110                                                                                                               "\t1: use MD5\n"
     1111                                                                                                               "\t0: disable")
     1112  ("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")
     1113  ("FEN",                                             m_bUseFastEnc,                                    false, "fast encoder setting")
     1114  ("ECU",                                             m_bUseEarlyCU,                                    false, "Early CU setting")
     1115  ("FDM",                                             m_useFastDecisionForMerge,                         true, "Fast decision for Merge RD Cost")
     1116  ("CFM",                                             m_bUseCbfFastMode,                                false, "Cbf fast mode setting")
     1117  ("ESD",                                             m_useEarlySkipDetection,                          false, "Early SKIP detection setting")
     1118  ( "RateControl",                                    m_RCEnableRateControl,                            false, "Rate control: enable rate control" )
     1119  ( "TargetBitrate",                                  m_RCTargetBitrate,                                    0, "Rate control: target bit-rate" )
     1120  ( "KeepHierarchicalBit",                            m_RCKeepHierarchicalBit,                              0, "Rate control: 0: equal bit allocation; 1: fixed ratio bit allocation; 2: adaptive ratio bit allocation" )
     1121  ( "LCULevelRateControl",                            m_RCLCULevelRC,                                    true, "Rate control: true: CTU level RC; false: picture level RC" )
     1122  ( "RCLCUSeparateModel",                             m_RCUseLCUSeparateModel,                           true, "Rate control: use CTU level separate R-lambda model" )
     1123  ( "InitialQP",                                      m_RCInitialQP,                                        0, "Rate control: initial QP" )
     1124  ( "RCForceIntraQP",                                 m_RCForceIntraQP,                                 false, "Rate control: force intra QP to be equal to initial QP" )
    6111125
    6121126#if KWU_RC_VIEWRC_E0227
     
    6171131  ("DepthMADPred, -dm", m_depthMADPred, (UInt)0, "Depth based MAD prediction on/off")
    6181132#endif
    619 #if H_MV
     1133#if NH_MV
    6201134// A lot of this stuff could should actually be derived by the encoder.
    6211135  // VPS VUI
     
    6261140  ("BitRatePresentVpsFlag"       , m_bitRatePresentVpsFlag       , false                                           , "BitRatePresentVpsFlag       ")
    6271141  ("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")
     1142  ("BitRatePresentFlag"          , m_bitRatePresentFlag          , BoolAry1d(1,0)  ,MAX_VPS_OP_SETS_PLUS1, "BitRatePresentFlag per sub layer for the N-th layer set")
     1143  ("PicRatePresentFlag"          , m_picRatePresentFlag          , BoolAry1d(1,0)  ,MAX_VPS_OP_SETS_PLUS1, "PicRatePresentFlag per sub layer for the N-th layer set")
    6301144  ("AvgBitRate"                  , m_avgBitRate                  , std::vector< Int  >(1,0)  ,MAX_VPS_OP_SETS_PLUS1, "AvgBitRate         per sub layer for the N-th layer set")
    6311145  ("MaxBitRate"                  , m_maxBitRate                  , std::vector< Int  >(1,0)  ,MAX_VPS_OP_SETS_PLUS1, "MaxBitRate         per sub layer for the N-th layer set")
     
    6331147  ("AvgPicRate"                  , m_avgPicRate                  , std::vector< Int  >(1,0)  ,MAX_VPS_OP_SETS_PLUS1, "AvgPicRate         per sub layer for the N-th layer set")
    6341148  ("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 ")
     1149  ("TilesInUseFlag"               , m_tilesInUseFlag               , BoolAry1d(1,false)                   , "TilesInUseFlag               ")
     1150  ("LoopFilterNotAcrossTilesFlag" , m_loopFilterNotAcrossTilesFlag , BoolAry1d(1,false)                  , "LoopFilterNotAcrossTilesFlag ")
    6371151  ("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")
     1152  ("WppInUseFlag"                 , m_wppInUseFlag                 , BoolAry1d(1,0)                      , "WppInUseFlag                 ")
     1153  ("TileBoundariesAlignedFlag"   , m_tileBoundariesAlignedFlag   , BoolAry1d(1,0)  ,MAX_NUM_LAYERS       , "TileBoundariesAlignedFlag    per direct reference for the N-th layer")
    6401154  ("IlpRestrictedRefLayersFlag"  , m_ilpRestrictedRefLayersFlag  , false                                           , "IlpRestrictedRefLayersFlag")
    6411155  ("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")
     1156  ("CtuBasedOffsetEnabledFlag"   , m_ctuBasedOffsetEnabledFlag   , BoolAry1d(1,0)  ,MAX_NUM_LAYERS       , "CtuBasedOffsetEnabledFlag    per direct reference for the N-th layer")
    6431157  ("MinHorizontalCtuOffsetPlus1" , m_minHorizontalCtuOffsetPlus1 , std::vector< Int  >(1,0)  ,MAX_NUM_LAYERS       , "MinHorizontalCtuOffsetPlus1  per direct reference for the N-th layer")
    6441158  ("SingleLayerForNonIrapFlag", m_singleLayerForNonIrapFlag, false                                          , "SingleLayerForNonIrapFlag")
     
    6461160#endif
    6471161
    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 
     1162  ("TransquantBypassEnableFlag",                      m_TransquantBypassEnableFlag,                     false, "transquant_bypass_enable_flag indicator in PPS")
     1163  ("CUTransquantBypassFlagForce",                     m_CUTransquantBypassFlagForce,                    false, "Force transquant bypass mode, when transquant_bypass_enable_flag is enabled")
     1164  ("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).")
     1165  ("RecalculateQPAccordingToLambda",                  m_recalculateQPAccordingToLambda,                 false, "Recalculate QP values according to lambda values. Do not suggest to be enabled in all intra case")
     1166  ("StrongIntraSmoothing,-sis",                       m_useStrongIntraSmoothing,                         true, "Enable strong intra smoothing for 32x32 blocks")
     1167  ("SEIActiveParameterSets",                          m_activeParameterSetsSEIEnabled,                      0, "Enable generation of active parameter sets SEI messages")
     1168  ("VuiParametersPresent,-vui",                       m_vuiParametersPresentFlag,                       false, "Enable generation of vui_parameters()")
     1169  ("AspectRatioInfoPresent",                          m_aspectRatioInfoPresentFlag,                     false, "Signals whether aspect_ratio_idc is present")
     1170  ("AspectRatioIdc",                                  m_aspectRatioIdc,                                     0, "aspect_ratio_idc")
     1171  ("SarWidth",                                        m_sarWidth,                                           0, "horizontal size of the sample aspect ratio")
     1172  ("SarHeight",                                       m_sarHeight,                                          0, "vertical size of the sample aspect ratio")
     1173  ("OverscanInfoPresent",                             m_overscanInfoPresentFlag,                        false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n")
     1174  ("OverscanAppropriate",                             m_overscanAppropriateFlag,                        false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n")
     1175  ("VideoSignalTypePresent",                          m_videoSignalTypePresentFlag,                     false, "Signals whether video_format, video_full_range_flag, and colour_description_present_flag are present")
     1176  ("VideoFormat",                                     m_videoFormat,                                        5, "Indicates representation of pictures")
     1177  ("VideoFullRange",                                  m_videoFullRangeFlag,                             false, "Indicates the black level and range of luma and chroma signals")
     1178  ("ColourDescriptionPresent",                        m_colourDescriptionPresentFlag,                   false, "Signals whether colour_primaries, transfer_characteristics and matrix_coefficients are present")
     1179  ("ColourPrimaries",                                 m_colourPrimaries,                                    2, "Indicates chromaticity coordinates of the source primaries")
     1180  ("TransferCharacteristics",                         m_transferCharacteristics,                            2, "Indicates the opto-electronic transfer characteristics of the source")
     1181  ("MatrixCoefficients",                              m_matrixCoefficients,                                 2, "Describes the matrix coefficients used in deriving luma and chroma from RGB primaries")
     1182  ("ChromaLocInfoPresent",                            m_chromaLocInfoPresentFlag,                       false, "Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present")
     1183  ("ChromaSampleLocTypeTopField",                     m_chromaSampleLocTypeTopField,                        0, "Specifies the location of chroma samples for top field")
     1184  ("ChromaSampleLocTypeBottomField",                  m_chromaSampleLocTypeBottomField,                     0, "Specifies the location of chroma samples for bottom field")
     1185  ("NeutralChromaIndication",                         m_neutralChromaIndicationFlag,                    false, "Indicates that the value of all decoded chroma samples is equal to 1<<(BitDepthCr-1)")
     1186  ("DefaultDisplayWindowFlag",                        m_defaultDisplayWindowFlag,                       false, "Indicates the presence of the Default Window parameters")
     1187  ("DefDispWinLeftOffset",                            m_defDispWinLeftOffset,                               0, "Specifies the left offset of the default display window from the conformance window")
     1188  ("DefDispWinRightOffset",                           m_defDispWinRightOffset,                              0, "Specifies the right offset of the default display window from the conformance window")
     1189  ("DefDispWinTopOffset",                             m_defDispWinTopOffset,                                0, "Specifies the top offset of the default display window from the conformance window")
     1190  ("DefDispWinBottomOffset",                          m_defDispWinBottomOffset,                             0, "Specifies the bottom offset of the default display window from the conformance window")
     1191  ("FrameFieldInfoPresentFlag",                       m_frameFieldInfoPresentFlag,                      false, "Indicates that pic_struct and field coding related values are present in picture timing SEI messages")
     1192  ("PocProportionalToTimingFlag",                     m_pocProportionalToTimingFlag,                    false, "Indicates that the POC value is proportional to the output time w.r.t. first picture in CVS")
     1193  ("NumTicksPocDiffOneMinus1",                        m_numTicksPocDiffOneMinus1,                           0, "Number of ticks minus 1 that for a POC difference of one")
     1194  ("BitstreamRestriction",                            m_bitstreamRestrictionFlag,                       false, "Signals whether bitstream restriction parameters are present")
     1195  ("TilesFixedStructure",                             m_tilesFixedStructureFlag,                        false, "Indicates that each active picture parameter set has the same values of the syntax elements related to tiles")
     1196  ("MotionVectorsOverPicBoundaries",                  m_motionVectorsOverPicBoundariesFlag,             false, "Indicates that no samples outside the picture boundaries are used for inter prediction")
     1197  ("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")
     1198  ("MaxBitsPerMinCuDenom",                            m_maxBitsPerMinCuDenom,                               1, "Indicates an upper bound for the number of bits of coding_unit() data")
     1199  ("Log2MaxMvLengthHorizontal",                       m_log2MaxMvLengthHorizontal,                         15, "Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units")
     1200  ("Log2MaxMvLengthVertical",                         m_log2MaxMvLengthVertical,                           15, "Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units")
     1201  ("SEIRecoveryPoint",                                m_recoveryPointSEIEnabled,                            0, "Control generation of recovery point SEI messages")
     1202  ("SEIBufferingPeriod",                              m_bufferingPeriodSEIEnabled,                          0, "Control generation of buffering period SEI messages")
     1203  ("SEIPictureTiming",                                m_pictureTimingSEIEnabled,                            0, "Control generation of picture timing SEI messages")
     1204  ("SEIToneMappingInfo",                              m_toneMappingInfoSEIEnabled,                      false, "Control generation of Tone Mapping SEI messages")
     1205  ("SEIToneMapId",                                    m_toneMapId,                                          0, "Specifies Id of Tone Mapping SEI message for a given session")
     1206  ("SEIToneMapCancelFlag",                            m_toneMapCancelFlag,                              false, "Indicates that Tone Mapping SEI message cancels the persistence or follows")
     1207  ("SEIToneMapPersistenceFlag",                       m_toneMapPersistenceFlag,                          true, "Specifies the persistence of the Tone Mapping SEI message")
     1208  ("SEIToneMapCodedDataBitDepth",                     m_toneMapCodedDataBitDepth,                           8, "Specifies Coded Data BitDepth of Tone Mapping SEI messages")
     1209  ("SEIToneMapTargetBitDepth",                        m_toneMapTargetBitDepth,                              8, "Specifies Output BitDepth of Tone mapping function")
     1210  ("SEIToneMapModelId",                               m_toneMapModelId,                                     0, "Specifies Model utilized for mapping coded data into target_bit_depth range\n"
     1211                                                                                                               "\t0:  linear mapping with clipping\n"
     1212                                                                                                               "\t1:  sigmoidal mapping\n"
     1213                                                                                                               "\t2:  user-defined table mapping\n"
     1214                                                                                                               "\t3:  piece-wise linear mapping\n"
     1215                                                                                                               "\t4:  luminance dynamic range information ")
     1216  ("SEIToneMapMinValue",                              m_toneMapMinValue,                                    0, "Specifies the minimum value in mode 0")
     1217  ("SEIToneMapMaxValue",                              m_toneMapMaxValue,                                 1023, "Specifies the maximum value in mode 0")
     1218  ("SEIToneMapSigmoidMidpoint",                       m_sigmoidMidpoint,                                  512, "Specifies the centre point in mode 1")
     1219  ("SEIToneMapSigmoidWidth",                          m_sigmoidWidth,                                     960, "Specifies the distance between 5% and 95% values of the target_bit_depth in mode 1")
     1220  ("SEIToneMapStartOfCodedInterval",                  cfg_startOfCodedInterval,      cfg_startOfCodedInterval, "Array of user-defined mapping table")
     1221  ("SEIToneMapNumPivots",                             m_numPivots,                                          0, "Specifies the number of pivot points in mode 3")
     1222  ("SEIToneMapCodedPivotValue",                       cfg_codedPivotValue,                cfg_codedPivotValue, "Array of pivot point")
     1223  ("SEIToneMapTargetPivotValue",                      cfg_targetPivotValue,              cfg_targetPivotValue, "Array of pivot point")
     1224  ("SEIToneMapCameraIsoSpeedIdc",                     m_cameraIsoSpeedIdc,                                  0, "Indicates the camera ISO speed for daylight illumination")
     1225  ("SEIToneMapCameraIsoSpeedValue",                   m_cameraIsoSpeedValue,                              400, "Specifies the camera ISO speed for daylight illumination of Extended_ISO")
     1226  ("SEIToneMapExposureIndexIdc",                      m_exposureIndexIdc,                                   0, "Indicates the exposure index setting of the camera")
     1227  ("SEIToneMapExposureIndexValue",                    m_exposureIndexValue,                               400, "Specifies the exposure index setting of the camera of Extended_ISO")
     1228  ("SEIToneMapExposureCompensationValueSignFlag",     m_exposureCompensationValueSignFlag,               false, "Specifies the sign of ExposureCompensationValue")
     1229  ("SEIToneMapExposureCompensationValueNumerator",    m_exposureCompensationValueNumerator,                 0, "Specifies the numerator of ExposureCompensationValue")
     1230  ("SEIToneMapExposureCompensationValueDenomIdc",     m_exposureCompensationValueDenomIdc,                  2, "Specifies the denominator of ExposureCompensationValue")
     1231  ("SEIToneMapRefScreenLuminanceWhite",               m_refScreenLuminanceWhite,                          350, "Specifies reference screen brightness setting in units of candela per square metre")
     1232  ("SEIToneMapExtendedRangeWhiteLevel",               m_extendedRangeWhiteLevel,                          800, "Indicates the luminance dynamic range")
     1233  ("SEIToneMapNominalBlackLevelLumaCodeValue",        m_nominalBlackLevelLumaCodeValue,                    16, "Specifies luma sample value of the nominal black level assigned decoded pictures")
     1234  ("SEIToneMapNominalWhiteLevelLumaCodeValue",        m_nominalWhiteLevelLumaCodeValue,                   235, "Specifies luma sample value of the nominal white level assigned decoded pictures")
     1235  ("SEIToneMapExtendedWhiteLevelLumaCodeValue",       m_extendedWhiteLevelLumaCodeValue,                  300, "Specifies luma sample value of the extended dynamic range assigned decoded pictures")
     1236  ("SEIChromaSamplingFilterHint",                     m_chromaSamplingFilterSEIenabled,                 false, "Control generation of the chroma sampling filter hint SEI message")
     1237  ("SEIChromaSamplingHorizontalFilterType",           m_chromaSamplingHorFilterIdc,                         2, "Defines the Index of the chroma sampling horizontal filter\n"
     1238                                                                                                               "\t0: unspecified  - Chroma filter is unknown or is determined by the application"
     1239                                                                                                               "\t1: User-defined - Filter coefficients are specified in the chroma sampling filter hint SEI message"
     1240                                                                                                               "\t2: Standards-defined - ITU-T Rec. T.800 | ISO/IEC15444-1, 5/3 filter")
     1241  ("SEIChromaSamplingVerticalFilterType",             m_chromaSamplingVerFilterIdc,                         2, "Defines the Index of the chroma sampling vertical filter\n"
     1242                                                                                                               "\t0: unspecified  - Chroma filter is unknown or is determined by the application"
     1243                                                                                                               "\t1: User-defined - Filter coefficients are specified in the chroma sampling filter hint SEI message"
     1244                                                                                                               "\t2: Standards-defined - ITU-T Rec. T.800 | ISO/IEC15444-1, 5/3 filter")
     1245  ("SEIFramePacking",                                 m_framePackingSEIEnabled,                             0, "Control generation of frame packing SEI messages")
     1246  ("SEIFramePackingType",                             m_framePackingSEIType,                                0, "Define frame packing arrangement\n"
     1247                                                                                                               "\t3: side by side - frames are displayed horizontally\n"
     1248                                                                                                               "\t4: top bottom - frames are displayed vertically\n"
     1249                                                                                                               "\t5: frame alternation - one frame is alternated with the other")
     1250  ("SEIFramePackingId",                               m_framePackingSEIId,                                  0, "Id of frame packing SEI message for a given session")
     1251  ("SEIFramePackingQuincunx",                         m_framePackingSEIQuincunx,                            0, "Indicate the presence of a Quincunx type video frame")
     1252  ("SEIFramePackingInterpretation",                   m_framePackingSEIInterpretation,                      0, "Indicate the interpretation of the frame pair\n"
     1253                                                                                                               "\t0: unspecified\n"
     1254                                                                                                               "\t1: stereo pair, frame0 represents left view\n"
     1255                                                                                                               "\t2: stereo pair, frame0 represents right view")
     1256  ("SEISegmentedRectFramePacking",                    m_segmentedRectFramePackingSEIEnabled,                0, "Controls generation of segmented rectangular frame packing SEI messages")
     1257  ("SEISegmentedRectFramePackingCancel",              m_segmentedRectFramePackingSEICancel,             false, "If equal to 1, cancels the persistence of any previous SRFPA SEI message")
     1258  ("SEISegmentedRectFramePackingType",                m_segmentedRectFramePackingSEIType,                   0, "Specifies the arrangement of the frames in the reconstructed picture")
     1259  ("SEISegmentedRectFramePackingPersistence",         m_segmentedRectFramePackingSEIPersistence,        false, "If equal to 0, the SEI applies to the current frame only")
     1260  ("SEIDisplayOrientation",                           m_displayOrientationSEIAngle,                         0, "Control generation of display orientation SEI messages\n"
     1261                                                                                                               "\tN: 0 < N < (2^16 - 1) enable display orientation SEI message with anticlockwise_rotation = N and display_orientation_repetition_period = 1\n"
     1262                                                                                                               "\t0: disable")
     1263  ("SEITemporalLevel0Index",                          m_temporalLevel0IndexSEIEnabled,                      0, "Control generation of temporal level 0 index SEI messages")
     1264  ("SEIGradualDecodingRefreshInfo",                   m_gradualDecodingRefreshInfoEnabled,                  0, "Control generation of gradual decoding refresh information SEI message")
     1265  ("SEINoDisplay",                                    m_noDisplaySEITLayer,                                 0, "Control generation of no display SEI message\n"
     1266                                                                                                               "\tN: 0 < N enable no display SEI message for temporal layer N or higher\n"
     1267                                                                                                               "\t0: disable")
     1268  ("SEIDecodingUnitInfo",                             m_decodingUnitInfoSEIEnabled,                         0, "Control generation of decoding unit information SEI message.")
     1269  ("SEISOPDescription",                               m_SOPDescriptionSEIEnabled,                           0, "Control generation of SOP description SEI messages")
     1270  ("SEIScalableNesting",                              m_scalableNestingSEIEnabled,                          0, "Control generation of scalable nesting SEI messages")
     1271  ("SEITempMotionConstrainedTileSets",                m_tmctsSEIEnabled,                                false, "Control generation of temporal motion constrained tile sets SEI message")
     1272  ("SEITimeCodeEnabled",                              m_timeCodeSEIEnabled,                             false, "Control generation of time code information SEI message")
     1273  ("SEITimeCodeNumClockTs",                           m_timeCodeSEINumTs,                                   0, "Number of clock time sets [0..3]")
     1274  ("SEITimeCodeTimeStampFlag",                        cfg_timeCodeSeiTimeStampFlag,          cfg_timeCodeSeiTimeStampFlag,         "Time stamp flag associated to each time set")
     1275  ("SEITimeCodeFieldBasedFlag",                       cfg_timeCodeSeiNumUnitFieldBasedFlag,  cfg_timeCodeSeiNumUnitFieldBasedFlag, "Field based flag associated to each time set")
     1276  ("SEITimeCodeCountingType",                         cfg_timeCodeSeiCountingType,           cfg_timeCodeSeiCountingType,          "Counting type associated to each time set")
     1277  ("SEITimeCodeFullTsFlag",                           cfg_timeCodeSeiFullTimeStampFlag,      cfg_timeCodeSeiFullTimeStampFlag,     "Full time stamp flag associated to each time set")
     1278  ("SEITimeCodeDiscontinuityFlag",                    cfg_timeCodeSeiDiscontinuityFlag,      cfg_timeCodeSeiDiscontinuityFlag,     "Discontinuity flag associated to each time set")
     1279  ("SEITimeCodeCntDroppedFlag",                       cfg_timeCodeSeiCntDroppedFlag,         cfg_timeCodeSeiCntDroppedFlag,        "Counter dropped flag associated to each time set")
     1280  ("SEITimeCodeNumFrames",                            cfg_timeCodeSeiNumberOfFrames,         cfg_timeCodeSeiNumberOfFrames,        "Number of frames associated to each time set")
     1281  ("SEITimeCodeSecondsValue",                         cfg_timeCodeSeiSecondsValue,           cfg_timeCodeSeiSecondsValue,          "Seconds value for each time set")
     1282  ("SEITimeCodeMinutesValue",                         cfg_timeCodeSeiMinutesValue,           cfg_timeCodeSeiMinutesValue,          "Minutes value for each time set")
     1283  ("SEITimeCodeHoursValue",                           cfg_timeCodeSeiHoursValue,             cfg_timeCodeSeiHoursValue,            "Hours value for each time set")
     1284  ("SEITimeCodeSecondsFlag",                          cfg_timeCodeSeiSecondsFlag,            cfg_timeCodeSeiSecondsFlag,           "Flag to signal seconds value presence in each time set")
     1285  ("SEITimeCodeMinutesFlag",                          cfg_timeCodeSeiMinutesFlag,            cfg_timeCodeSeiMinutesFlag,           "Flag to signal minutes value presence in each time set")
     1286  ("SEITimeCodeHoursFlag",                            cfg_timeCodeSeiHoursFlag,              cfg_timeCodeSeiHoursFlag,             "Flag to signal hours value presence in each time set")
     1287  ("SEITimeCodeOffsetLength",                         cfg_timeCodeSeiTimeOffsetLength,       cfg_timeCodeSeiTimeOffsetLength,      "Time offset length associated to each time set")
     1288  ("SEITimeCodeTimeOffset",                           cfg_timeCodeSeiTimeOffsetValue,        cfg_timeCodeSeiTimeOffsetValue,       "Time offset associated to each time set")
     1289  ("SEIKneeFunctionInfo",                             m_kneeSEIEnabled,                                 false, "Control generation of Knee function SEI messages")
     1290  ("SEIKneeFunctionId",                               m_kneeSEIId,                                          0, "Specifies Id of Knee function SEI message for a given session")
     1291  ("SEIKneeFunctionCancelFlag",                       m_kneeSEICancelFlag,                              false, "Indicates that Knee function SEI message cancels the persistence or follows")
     1292  ("SEIKneeFunctionPersistenceFlag",                  m_kneeSEIPersistenceFlag,                          true, "Specifies the persistence of the Knee function SEI message")
     1293  ("SEIKneeFunctionInputDrange",                      m_kneeSEIInputDrange,                              1000, "Specifies the peak luminance level for the input picture of Knee function SEI messages")
     1294  ("SEIKneeFunctionInputDispLuminance",               m_kneeSEIInputDispLuminance,                        100, "Specifies the expected display brightness for the input picture of Knee function SEI messages")
     1295  ("SEIKneeFunctionOutputDrange",                     m_kneeSEIOutputDrange,                             4000, "Specifies the peak luminance level for the output picture of Knee function SEI messages")
     1296  ("SEIKneeFunctionOutputDispLuminance",              m_kneeSEIOutputDispLuminance,                       800, "Specifies the expected display brightness for the output picture of Knee function SEI messages")
     1297  ("SEIKneeFunctionNumKneePointsMinus1",              m_kneeSEINumKneePointsMinus1,                         2, "Specifies the number of knee points - 1")
     1298  ("SEIKneeFunctionInputKneePointValue",              cfg_kneeSEIInputKneePointValue,   cfg_kneeSEIInputKneePointValue, "Array of input knee point")
     1299  ("SEIKneeFunctionOutputKneePointValue",             cfg_kneeSEIOutputKneePointValue, cfg_kneeSEIOutputKneePointValue, "Array of output knee point")
     1300  ("SEIMasteringDisplayColourVolume",                 m_masteringDisplay.colourVolumeSEIEnabled,         false, "Control generation of mastering display colour volume SEI messages")
     1301  ("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)")
     1302  ("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)")
     1303  ("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)")
     1304  ("SEIMasteringDisplayWhitePoint",                   cfg_DisplayWhitePointCode,     cfg_DisplayWhitePointCode, "Mastering display white point CIE xy coordinates in normalised increments of 1/50000 (e.g. 0.333 = 16667)")
     1305#if NH_MV
     1306  ("SubBitstreamPropSEIEnabled",                      m_subBistreamPropSEIEnabled,    false                     ,"Enable signaling of sub-bitstream property SEI message")
     1307  ("SEISubBitstreamNumAdditionalSubStreams",          m_sbPropNumAdditionalSubStreams,0                         ,"Number of substreams for which additional information is signalled")
     1308  ("SEISubBitstreamSubBitstreamMode",                 m_sbPropSubBitstreamMode,       std::vector< Int  >(1,0)  ,"Specifies mode of generation of the i-th sub-bitstream (0 or 1)")
     1309  ("SEISubBitstreamOutputLayerSetIdxToVps",           m_sbPropOutputLayerSetIdxToVps, std::vector< Int  >(1,0)  ,"Specifies output layer set index of the i-th sub-bitstream ")
     1310  ("SEISubBitstreamHighestSublayerId",                m_sbPropHighestSublayerId,      std::vector< Int  >(1,0)  ,"Specifies highest TemporalId of the i-th sub-bitstream")
     1311  ("SEISubBitstreamAvgBitRate",                       m_sbPropAvgBitRate,             std::vector< Int  >(1,0)  ,"Specifies average bit rate of the i-th sub-bitstream")
     1312  ("SEISubBitstreamMaxBitRate",                       m_sbPropMaxBitRate,             std::vector< Int  >(1,0)  ,"Specifies maximum bit rate of the i-th sub-bitstream")
     1313
     1314  ("OutputVpsInfo",                                   m_outputVpsInfo,                false                     ,"Output information about the layer dependencies and layer sets")
     1315#endif
     1316#if NH_3D
     1317/* Camera parameters */ 
     1318  ("Depth420OutputFlag",                              m_depth420OutputFlag,           true                     , "Output depth layers in 4:2:0 ")
     1319  ("CameraParameterFile,cpf",                         m_pchCameraParameterFile,    (Char *) 0,                    "Camera Parameter File Name")
     1320  ("BaseViewCameraNumbers",                           m_pchBaseViewCameraNumbers,  (Char *) 0,                    "Numbers of base views")
     1321  ("CodedCamParsPrecision",                           m_iCodedCamParPrecision,      STD_CAM_PARAMETERS_PRECISION, "precision for coding of camera parameters (in units of 2^(-x) luma samples)" )
     1322
     1323#if NH_3D_VSO
     1324  /* View Synthesis Optimization */
     1325  ("VSOConfig",                                       m_pchVSOConfig            , (Char *) 0                    ,"VSO configuration")
     1326  ("VSO",                                             m_bUseVSO                 , false                         ,"Use VSO" )   
     1327  ("VSOMode",                                         m_uiVSOMode               , (UInt)   4                    ,"VSO Mode")
     1328  ("LambdaScaleVSO",                                  m_dLambdaScaleVSO         , (Double) 1                    ,"Lambda Scaling for VSO")
     1329  ("VSOLSTable",                                      m_bVSOLSTable             , true                          ,"Depth QP dependent video/depth rate allocation by Lagrange multiplier" )     
     1330  ("ForceLambdaScaleVSO",                             m_bForceLambdaScaleVSO    , false                         ,"Force using Lambda Scale VSO also in non-VSO-Mode")
     1331  ("AllowNegDist",                                    m_bAllowNegDist           , true                          ,"Allow negative Distortion in VSO")
     1332                                                                                                             
     1333  ("UseEstimatedVSD",                                 m_bUseEstimatedVSD        , true                          ,"Model based VSD estimation instead of rendering based for some encoder decisions" )     
     1334  ("VSOEarlySkip",                                    m_bVSOEarlySkip           , true                          ,"Early skip of VSO computation if synthesis error assumed to be zero" )     
     1335                                                                                                               
     1336  ("WVSO",                                            m_bUseWVSO                , true                          ,"Use depth fidelity term for VSO" )
     1337  ("VSOWeight",                                       m_iVSOWeight              , 10                            ,"Synthesized View Distortion Change weight" )
     1338  ("VSDWeight",                                       m_iVSDWeight              , 1                             ,"View Synthesis Distortion estimate weight" )
     1339  ("DWeight",                                         m_iDWeight                , 1                             ,"Depth Distortion weight" )
    7771340#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"                     )
     1341/* 3D- HEVC Tools */                                                           
     1342  ("QTL"                   ,                          m_bUseQTL                 , true                          , "Use depth quad tree limitation (encoder only)" )
     1343  ("IvMvPredFlag"          ,                          m_ivMvPredFlag            , BoolAry1d(2,true)             , "Inter-view motion prediction"              )
     1344  ("IvMvScalingFlag"       ,                          m_ivMvScalingFlag         , BoolAry1d(2,true)             , "Inter-view motion vector scaling"          )
     1345  ("Log2SubPbSizeMinus3"   ,                          m_log2SubPbSizeMinus3     , 0                             , "Log2 minus 3 of sub Pb size"               )
     1346  ("IvResPredFlag"         ,                          m_ivResPredFlag           , true                          , "Inter-view residual prediction"            )
     1347  ("DepthRefinementFlag"   ,                          m_depthRefinementFlag     , true                          , "Depth to refine disparity"                 )
     1348  ("ViewSynthesisPredFlag" ,                          m_viewSynthesisPredFlag   , true                          , "View synthesis prediction"                 )
     1349  ("DepthBasedBlkPartFlag" ,                          m_depthBasedBlkPartFlag   , true                          , "Depth base block partitioning"             )
     1350  ("MpiFlag"               ,                          m_mpiFlag                 , true                          , "Motion inheritance from texture to depth"  )
     1351  ("Log2MpiSubPbSizeMinus3",                          m_log2MpiSubPbSizeMinus3  , 0                             , "Log2 minus 3 of sub Pb size for MPI"       )
     1352  ("IntraContourFlag"      ,                          m_intraContourFlag        , true                          , "Intra contour mode"                        )
     1353  ("IntraWedgeFlag"        ,                          m_intraWedgeFlag          , true                          , "Intra wedge mode and segmental depth DCs"  )
     1354  ("IntraSdcFlag"          ,                          m_intraSdcFlag            , true                          , "Intra depth DCs"                           )
     1355  ("QtPredFlag"            ,                          m_qtPredFlag              , true                          , "Quad tree prediction from texture to depth")
     1356  ("InterSdcFlag"          ,                          m_interSdcFlag            , true                          , "Inter depth DCs"                           )
     1357  ("DepthIntraSkip"        ,                          m_depthIntraSkipFlag      , true                          , "Depth intra skip mode"                     )
     1358  ("DLT"                   ,                          m_useDLT                  , true                          , "Depth lookup table"                        )
     1359  ("IlluCompEnable"        ,                          m_abUseIC                 , true                          , "Enable illumination compensation"          )
     1360  ("IlluCompLowLatencyEnc" ,                          m_bUseLowLatencyICEnc     , false                         , "Enable low-latency illumination compensation encoding")
    7951361#endif //H_3D
     1362   
    7961363  ;
    7971364
    798 #if H_MV
     1365#if NH_MV   
    7991366  // parse coding structure
    8001367  for( Int k = 0; k < MAX_NUM_LAYERS; k++ )
     
    8271394
    8281395
    829       for( Int i = 1; i < MAX_GOP + 1; i++ )
    830       {
     1396  for(Int i=1; i<MAX_GOP+1; i++)
     1397  {
    8311398        std::ostringstream cOSS2;
    8321399        cOSS2<<"Frame"<<i<<"_l"<<k;
     
    8401407  }
    8411408#else
    842   for(Int i=1; i<MAX_GOP+1; i++) {
     1409  for(Int i=1; i<MAX_GOP+1; i++)
     1410  {
    8431411    std::ostringstream cOSS;
    8441412    cOSS<<"Frame"<<i;
     
    8471415#endif
    8481416  po::setDefaults(opts);
    849   const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv);
     1417  po::ErrorReporter err;
     1418  const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv, err);
     1419
     1420  for (list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++)
     1421  {
     1422    fprintf(stderr, "Unhandled argument ignored: `%s'\n", *it);
     1423  }
     1424
     1425  if (argc == 1 || do_help)
     1426  {
     1427    /* argc == 1: no options have been specified */
     1428    po::doHelp(cout, opts);
     1429    return false;
     1430  }
     1431
     1432  if (err.is_errored)
     1433  {
     1434    if (!warnUnknowParameter)
     1435    {
     1436      /* error report has already been printed on stderr */
     1437      return false;
     1438    }
     1439  }
     1440
     1441  /*
     1442   * Set any derived parameters
     1443   */
     1444  /* convert std::string to c string for compatability */
     1445#if !NH_MV
     1446  m_pchInputFile = cfg_InputFile.empty() ? NULL : strdup(cfg_InputFile.c_str());
     1447#endif
     1448  m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str());
     1449#if !NH_MV
     1450  m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str());
     1451#endif
     1452  m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str());
    8501453
    8511454  if(m_isField)
     
    8581461    m_framesToBeEncoded *= 2;
    8591462  }
    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());
    8881463
    8891464  if( !m_tileUniformSpacingFlag && m_numTileColumnsMinus1 > 0 )
    8901465  {
    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 )
     1466    if (cfg_ColumnWidth.values.size() > m_numTileColumnsMinus1)
     1467    {
     1468      printf( "The number of columns whose width are defined is larger than the allowed number of columns.\n" );
     1469      exit( EXIT_FAILURE );
     1470    }
     1471    else if (cfg_ColumnWidth.values.size() < m_numTileColumnsMinus1)
    9071472    {
    9081473      printf( "The width of some columns is not defined.\n" );
    9091474      exit( EXIT_FAILURE );
    9101475    }
     1476    else
     1477    {
     1478      m_tileColumnWidth.resize(m_numTileColumnsMinus1);
     1479      for(UInt i=0; i<cfg_ColumnWidth.values.size(); i++)
     1480      {
     1481        m_tileColumnWidth[i]=cfg_ColumnWidth.values[i];
     1482      }
     1483    }
    9111484  }
    9121485  else
     
    9171490  if( !m_tileUniformSpacingFlag && m_numTileRowsMinus1 > 0 )
    9181491  {
    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 )
     1492    if (cfg_RowHeight.values.size() > m_numTileRowsMinus1)
     1493    {
     1494      printf( "The number of rows whose height are defined is larger than the allowed number of rows.\n" );
     1495      exit( EXIT_FAILURE );
     1496    }
     1497    else if (cfg_RowHeight.values.size() < m_numTileRowsMinus1)
    9351498    {
    9361499      printf( "The height of some rows is not defined.\n" );
    9371500      exit( EXIT_FAILURE );
    938    }
     1501    }
     1502    else
     1503    {
     1504      m_tileRowHeight.resize(m_numTileRowsMinus1);
     1505      for(UInt i=0; i<cfg_RowHeight.values.size(); i++)
     1506      {
     1507        m_tileRowHeight[i]=cfg_RowHeight.values[i];
     1508      }
     1509    }
    9391510  }
    9401511  else
     
    9421513    m_tileRowHeight.clear();
    9431514  }
    944 #if H_MV
    945   free ( pColumnWidth );
    946   free ( pRowHeight   );
    947 #endif
     1515
    9481516  m_scalingListFile = cfg_ScalingListFile.empty() ? NULL : strdup(cfg_ScalingListFile.c_str());
    949  
     1517
    9501518  /* 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
     1519  if (m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ] == 0)
     1520  {
     1521    m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ] = m_inputBitDepth      [CHANNEL_TYPE_LUMA  ];
     1522  }
     1523  if (m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] == 0)
     1524  {
     1525    m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] = m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ];
     1526  }
     1527  if (m_internalBitDepth   [CHANNEL_TYPE_LUMA  ] == 0)
     1528  {
     1529    m_internalBitDepth   [CHANNEL_TYPE_LUMA  ] = m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ];
     1530  }
     1531  if (m_internalBitDepth   [CHANNEL_TYPE_CHROMA] == 0)
     1532  {
     1533    m_internalBitDepth   [CHANNEL_TYPE_CHROMA] = m_internalBitDepth   [CHANNEL_TYPE_LUMA  ];
     1534  }
     1535  if (m_inputBitDepth      [CHANNEL_TYPE_CHROMA] == 0)
     1536  {
     1537    m_inputBitDepth      [CHANNEL_TYPE_CHROMA] = m_inputBitDepth      [CHANNEL_TYPE_LUMA  ];
     1538  }
     1539  if (m_outputBitDepth     [CHANNEL_TYPE_LUMA  ] == 0)
     1540  {
     1541    m_outputBitDepth     [CHANNEL_TYPE_LUMA  ] = m_internalBitDepth   [CHANNEL_TYPE_LUMA  ];
     1542  }
     1543  if (m_outputBitDepth     [CHANNEL_TYPE_CHROMA] == 0)
     1544  {
     1545    m_outputBitDepth     [CHANNEL_TYPE_CHROMA] = m_internalBitDepth   [CHANNEL_TYPE_CHROMA];
     1546  }
     1547
     1548  m_InputChromaFormatIDC = numberToChromaFormat(tmpInputChromaFormat);
     1549  m_chromaFormatIDC      = ((tmpChromaFormat == 0) ? (m_InputChromaFormatIDC) : (numberToChromaFormat(tmpChromaFormat)));
     1550
     1551#if NH_MV
     1552  // parse PTL
     1553  Bool anyEmpty = false;
     1554  if( cfg_profiles.empty() )
     1555  {
     1556#if NH_3D
     1557    cfg_profiles = string("main main 3d-main");
     1558#else
     1559    cfg_profiles = string("main main multiview-main");   
     1560#endif
     1561    fprintf(stderr, "\nWarning: No profiles given, using defaults: %s", cfg_profiles.c_str() );
     1562    anyEmpty = true;
     1563  }
     1564
     1565  if( cfg_levels.empty() )
     1566  {
     1567    cfg_levels = string("5.1 5.1 5.1");
     1568    fprintf(stderr, "\nWarning: No levels given, using defaults: %s", cfg_levels.c_str() );
     1569    anyEmpty = true;
     1570  }
     1571
     1572  if( cfg_tiers.empty() )
     1573  {
     1574    cfg_tiers = string("main main main");
     1575    fprintf(stderr, "\nWarning: No tiers given, using defaults: %s", cfg_tiers.c_str());
     1576    anyEmpty = true;
     1577  }
     1578
     1579  if( m_inblFlag.empty() )
     1580  {
     1581    fprintf(stderr, "\nWarning: No inblFlags given, using defaults:");
     1582    for( Int i = 0; i < 3; i++)
     1583    {
     1584      m_inblFlag.push_back( false );
     1585      fprintf(stderr," %d", (Int) m_inblFlag[i]);
     1586    }
     1587    anyEmpty = true;
     1588  }   
     1589
     1590  if ( anyEmpty )
     1591  {
     1592    fprintf( stderr, "\n" );
     1593  }
     1594
     1595  xReadStrToEnum( cfg_profiles, extendedProfiles  );
     1596  xReadStrToEnum( cfg_levels,   m_level     );
     1597  xReadStrToEnum( cfg_tiers ,   m_levelTier );
     1598
     1599
     1600#if NH_MV
     1601  m_profiles.resize( extendedProfiles.size());
     1602
     1603  for (Int i = 0; i < m_profiles.size(); i++)
     1604  {
     1605    Profile::Name& m_profile             = m_profiles      [i]; 
     1606    ExtendedProfileName& extendedProfile = extendedProfiles[i]; 
     1607#endif
     1608#endif
     1609
     1610  if (extendedProfile >= 1000 && extendedProfile <= 12316)
     1611    {
     1612      m_profile = Profile::MAINREXT;
     1613      if (m_bitDepthConstraint != 0 || tmpConstraintChromaFormat != 0)
     1614      {
     1615        fprintf(stderr, "Error: The bit depth and chroma format constraints are not used when an explicit RExt profile is specified\n");
     1616        exit(EXIT_FAILURE);
     1617      }
     1618      m_bitDepthConstraint     = (extendedProfile%100);
     1619    m_intraConstraintFlag          = ((extendedProfile%10000)>=2000);
     1620    m_onePictureOnlyConstraintFlag = (extendedProfile >= 10000);
     1621      switch ((extendedProfile/100)%10)
     1622      {
     1623      case 0:  tmpConstraintChromaFormat=400; break;
     1624      case 1:  tmpConstraintChromaFormat=420; break;
     1625      case 2:  tmpConstraintChromaFormat=422; break;
     1626      default: tmpConstraintChromaFormat=444; break;
     1627      }
     1628    }
     1629    else
     1630    {
     1631      m_profile = Profile::Name(extendedProfile);
     1632    }
     1633
     1634    if (m_profile == Profile::HIGHTHROUGHPUTREXT )
     1635    {
     1636      if (m_bitDepthConstraint == 0)
     1637      {
     1638        m_bitDepthConstraint = 16;
     1639      }
     1640      m_chromaFormatConstraint = (tmpConstraintChromaFormat == 0) ? CHROMA_444 : numberToChromaFormat(tmpConstraintChromaFormat);
     1641    }
     1642    else if (m_profile == Profile::MAINREXT)
     1643    {
     1644      if (m_bitDepthConstraint == 0 && tmpConstraintChromaFormat == 0)
     1645      {
     1646        // produce a valid combination, if possible.
     1647      const Bool bUsingGeneralRExtTools  = m_transformSkipRotationEnabledFlag        ||
     1648                                           m_transformSkipContextEnabledFlag         ||
     1649                                           m_rdpcmEnabledFlag[RDPCM_SIGNAL_IMPLICIT] ||
     1650                                           m_rdpcmEnabledFlag[RDPCM_SIGNAL_EXPLICIT] ||
     1651          !m_enableIntraReferenceSmoothing         ||
     1652                                           m_persistentRiceAdaptationEnabledFlag     ||
     1653                                           m_log2MaxTransformSkipBlockSize!=2;
     1654      const Bool bUsingChromaQPAdjustment= m_diffCuChromaQpOffsetDepth >= 0;
     1655      const Bool bUsingExtendedPrecision = m_extendedPrecisionProcessingFlag;
     1656      if (m_onePictureOnlyConstraintFlag)
     1657      {
     1658        m_chromaFormatConstraint = CHROMA_444;
     1659        if (m_intraConstraintFlag != true)
     1660        {
     1661          fprintf(stderr, "Error: Intra constraint flag must be true when one_picture_only_constraint_flag is true\n");
     1662          exit(EXIT_FAILURE);
     1663        }
     1664        const Int maxBitDepth = m_chromaFormatIDC==CHROMA_400 ? m_internalBitDepth[CHANNEL_TYPE_LUMA] : std::max(m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA]);
     1665        m_bitDepthConstraint = maxBitDepth>8 ? 16:8;
     1666      }
     1667      else
     1668      {
     1669        m_chromaFormatConstraint = NUM_CHROMA_FORMAT;
     1670        automaticallySelectRExtProfile(bUsingGeneralRExtTools,
     1671          bUsingChromaQPAdjustment,
     1672          bUsingExtendedPrecision,
     1673          m_intraConstraintFlag,
     1674          m_bitDepthConstraint,
     1675          m_chromaFormatConstraint,
     1676          m_chromaFormatIDC==CHROMA_400 ? m_internalBitDepth[CHANNEL_TYPE_LUMA] : std::max(m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA]),
     1677          m_chromaFormatIDC);
     1678      }
     1679    }
     1680      else if (m_bitDepthConstraint == 0 || tmpConstraintChromaFormat == 0)
     1681      {
     1682        fprintf(stderr, "Error: The bit depth and chroma format constraints must either both be specified or both be configured automatically\n");
     1683        exit(EXIT_FAILURE);
     1684      }
     1685      else
     1686      {
     1687        m_chromaFormatConstraint = numberToChromaFormat(tmpConstraintChromaFormat);
     1688      }
     1689    }
     1690    else
     1691    {
     1692      m_chromaFormatConstraint = (tmpConstraintChromaFormat == 0) ? m_chromaFormatIDC : numberToChromaFormat(tmpConstraintChromaFormat);
     1693      m_bitDepthConstraint = (m_profile == Profile::MAIN10?10:8);
     1694    }
     1695#if NH_MV
     1696  }
     1697
     1698  if ( m_numberOfLayers != 0 && ( m_profiles[0] != Profile::MAIN || m_profiles[1] != Profile::MAIN )  )
     1699  {
     1700    fprintf(stderr, "Error: The base layer must conform to the Main profile for Multilayer coding.\n");
     1701    exit(EXIT_FAILURE);
     1702  }
     1703#endif
     1704
     1705
     1706  m_inputColourSpaceConvert = stringToInputColourSpaceConvert(inputColourSpaceConvert, true);
     1707
    9581708  switch (m_conformanceWindowMode)
    9591709  {
     
    9841734        }
    9851735      }
    986       if (m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0)
     1736      if (m_aiPad[0] % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0)
    9871737      {
    9881738        fprintf(stderr, "Error: picture width is not an integer multiple of the specified chroma subsampling\n");
    9891739        exit(EXIT_FAILURE);
    9901740      }
    991       if (m_aiPad[1] % TComSPS::getWinUnitY(CHROMA_420) != 0)
     1741      if (m_aiPad[1] % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0)
    9921742      {
    9931743        fprintf(stderr, "Error: picture height is not an integer multiple of the specified chroma subsampling\n");
     
    10201770    }
    10211771  }
    1022  
     1772
    10231773  // allocate slice-based dQP values
    1024 #if H_MV
     1774#if NH_MV
     1775  for (Int i = m_layerIdInNuh.size(); i < m_numberOfLayers; i++ )
     1776  {
     1777    m_layerIdInNuh.push_back( i == 0 ? 0 : m_layerIdInNuh[ i - 1 ] + 1 );
     1778  }
     1779  xResizeVector( m_layerIdInNuh );
     1780
    10251781  xResizeVector( m_viewOrderIndex    );
    10261782
     
    10411797  xResizeVector( m_auxId );
    10421798
    1043 #if H_3D
     1799#if NH_3D
    10441800  xResizeVector( m_depthFlag );
    10451801#endif
     
    10621818      {
    10631819        m_aidQP[layer][i] = 1;
     1820      }
     1821    }
     1822
     1823    for(UInt ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++)
     1824    {
     1825      if (saoOffsetBitShift[ch]<0)
     1826      {
     1827        if (m_internalBitDepth[ch]>10)
     1828        {
     1829          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) ) );
     1830        }
     1831        else
     1832        {
     1833          m_log2SaoOffsetScale[layer][ch]=0;
     1834        }
     1835      }
     1836      else
     1837      {
     1838        m_log2SaoOffsetScale[layer][ch]=UInt(saoOffsetBitShift[ch]);
    10641839      }
    10651840    }
     
    10801855  m_aidQP = new Int[ m_framesToBeEncoded + m_iGOPSize + 1 ];
    10811856  ::memset( m_aidQP, 0, sizeof(Int)*( m_framesToBeEncoded + m_iGOPSize + 1 ) );
    1082  
     1857
    10831858  // handling of floating-point QP values
    10841859  // if QP is not integer, sequence is split into two sections having QP and QP+1
     
    10871862  {
    10881863    Int iSwitchPOC = (Int)( m_framesToBeEncoded - (m_fQP - m_iQP)*m_framesToBeEncoded + 0.5 );
    1089    
     1864
    10901865    iSwitchPOC = (Int)( (Double)iSwitchPOC / m_iGOPSize + 0.5 )*m_iGOPSize;
    10911866    for ( Int i=iSwitchPOC; i<m_framesToBeEncoded + m_iGOPSize + 1; i++ )
     
    10941869    }
    10951870  }
    1096 #endif
    1097  
     1871
     1872  for(UInt ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++)
     1873  {
     1874    if (saoOffsetBitShift[ch]<0)
     1875    {
     1876      if (m_internalBitDepth[ch]>10)
     1877      {
     1878        m_log2SaoOffsetScale[ch]=UInt(Clip3<Int>(0, m_internalBitDepth[ch]-10, Int(m_internalBitDepth[ch]-10 + 0.165*m_iQP - 3.22 + 0.5) ) );
     1879      }
     1880      else
     1881      {
     1882        m_log2SaoOffsetScale[ch]=0;
     1883      }
     1884    }
     1885    else
     1886    {
     1887      m_log2SaoOffsetScale[ch]=UInt(saoOffsetBitShift[ch]);
     1888    }
     1889  }
     1890
     1891#endif
     1892
    10981893  // reading external dQP description from file
    10991894  if ( m_pchdQPFile )
     
    11021897    if ( fpt )
    11031898    {
    1104 #if H_MV
     1899#if NH_MV
    11051900      for( Int layer = 0; layer < m_numberOfLayers; layer++ )
    11061901      {
     
    11101905      while ( iPOC < m_framesToBeEncoded )
    11111906      {
    1112         if ( fscanf(fpt, "%d", &iValue ) == EOF ) break;
    1113 #if H_MV
     1907        if ( fscanf(fpt, "%d", &iValue ) == EOF )
     1908        {
     1909          break;
     1910        }
     1911#if NH_MV
    11141912        m_aidQP[layer][ iPOC ] = iValue;
    11151913        iPOC++;
     
    11231921    }
    11241922  }
    1125   m_iWaveFrontSubstreams = m_iWaveFrontSynchro ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1;
    1126 
     1923
     1924  if( m_masteringDisplay.colourVolumeSEIEnabled )
     1925  {
     1926    for(UInt idx=0; idx<6; idx++)
     1927    {
     1928      m_masteringDisplay.primaries[idx/2][idx%2] = UShort((cfg_DisplayPrimariesCode.values.size() > idx) ? cfg_DisplayPrimariesCode.values[idx] : 0);
     1929    }
     1930    for(UInt idx=0; idx<2; idx++)
     1931    {
     1932      m_masteringDisplay.whitePoint[idx] = UShort((cfg_DisplayWhitePointCode.values.size() > idx) ? cfg_DisplayWhitePointCode.values[idx] : 0);
     1933    }
     1934  }
     1935   
    11271936  if( m_toneMappingInfoSEIEnabled && !m_toneMapCancelFlag )
    11281937  {
    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;
     1938    if( m_toneMapModelId == 2 && !cfg_startOfCodedInterval.values.empty() )
     1939    {
     1940      const UInt num = 1u<< m_toneMapTargetBitDepth;
    11361941      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     }
     1942      for(UInt i=0; i<num; i++)
     1943      {
     1944        m_startOfCodedInterval[i] = cfg_startOfCodedInterval.values.size() > i ? cfg_startOfCodedInterval.values[i] : 0;
     1945      }
     1946    }
    11471947    else
    11481948    {
     
    11511951    if( ( m_toneMapModelId == 3 ) && ( m_numPivots > 0 ) )
    11521952    {
    1153       if( pcCodedPivotValue && pcTargetPivotValue )
    1154       {
    1155         char *codedPivotValue;
    1156         char *targetPivotValue;
    1157         m_codedPivotValue = new Int[m_numPivots];
     1953      if( !cfg_codedPivotValue.values.empty() && !cfg_targetPivotValue.values.empty() )
     1954      {
     1955        m_codedPivotValue  = new Int[m_numPivots];
    11581956        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)
     1957        for(UInt i=0; i<m_numPivots; i++)
    11641958        {
    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++;
     1959          m_codedPivotValue[i]  = cfg_codedPivotValue.values.size()  > i ? cfg_codedPivotValue.values [i] : 0;
     1960          m_targetPivotValue[i] = cfg_targetPivotValue.values.size() > i ? cfg_targetPivotValue.values[i] : 0;
    11761961        }
    11771962      }
     
    11841969  }
    11851970
    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
     1971  if( m_kneeSEIEnabled && !m_kneeSEICancelFlag )
     1972  {
     1973    assert ( m_kneeSEINumKneePointsMinus1 >= 0 && m_kneeSEINumKneePointsMinus1 < 999 );
     1974    m_kneeSEIInputKneePoint  = new Int[m_kneeSEINumKneePointsMinus1+1];
     1975    m_kneeSEIOutputKneePoint = new Int[m_kneeSEINumKneePointsMinus1+1];
     1976    for(Int i=0; i<(m_kneeSEINumKneePointsMinus1+1); i++)
     1977    {
     1978      m_kneeSEIInputKneePoint[i]  = cfg_kneeSEIInputKneePointValue.values.size()  > i ? cfg_kneeSEIInputKneePointValue.values[i]  : 1;
     1979      m_kneeSEIOutputKneePoint[i] = cfg_kneeSEIOutputKneePointValue.values.size() > i ? cfg_kneeSEIOutputKneePointValue.values[i] : 0;
     1980    }
     1981  }
     1982
     1983  if(m_timeCodeSEIEnabled)
     1984  {
     1985    for(Int i = 0; i < m_timeCodeSEINumTs && i < MAX_TIMECODE_SEI_SETS; i++)
     1986    {
     1987      m_timeSetArray[i].clockTimeStampFlag    = cfg_timeCodeSeiTimeStampFlag        .values.size()>i ? cfg_timeCodeSeiTimeStampFlag        .values [i] : false;
     1988      m_timeSetArray[i].numUnitFieldBasedFlag = cfg_timeCodeSeiNumUnitFieldBasedFlag.values.size()>i ? cfg_timeCodeSeiNumUnitFieldBasedFlag.values [i] : 0;
     1989      m_timeSetArray[i].countingType          = cfg_timeCodeSeiCountingType         .values.size()>i ? cfg_timeCodeSeiCountingType         .values [i] : 0;
     1990      m_timeSetArray[i].fullTimeStampFlag     = cfg_timeCodeSeiFullTimeStampFlag    .values.size()>i ? cfg_timeCodeSeiFullTimeStampFlag    .values [i] : 0;
     1991      m_timeSetArray[i].discontinuityFlag     = cfg_timeCodeSeiDiscontinuityFlag    .values.size()>i ? cfg_timeCodeSeiDiscontinuityFlag    .values [i] : 0;
     1992      m_timeSetArray[i].cntDroppedFlag        = cfg_timeCodeSeiCntDroppedFlag       .values.size()>i ? cfg_timeCodeSeiCntDroppedFlag       .values [i] : 0;
     1993      m_timeSetArray[i].numberOfFrames        = cfg_timeCodeSeiNumberOfFrames       .values.size()>i ? cfg_timeCodeSeiNumberOfFrames       .values [i] : 0;
     1994      m_timeSetArray[i].secondsValue          = cfg_timeCodeSeiSecondsValue         .values.size()>i ? cfg_timeCodeSeiSecondsValue         .values [i] : 0;
     1995      m_timeSetArray[i].minutesValue          = cfg_timeCodeSeiMinutesValue         .values.size()>i ? cfg_timeCodeSeiMinutesValue         .values [i] : 0;
     1996      m_timeSetArray[i].hoursValue            = cfg_timeCodeSeiHoursValue           .values.size()>i ? cfg_timeCodeSeiHoursValue           .values [i] : 0;
     1997      m_timeSetArray[i].secondsFlag           = cfg_timeCodeSeiSecondsFlag          .values.size()>i ? cfg_timeCodeSeiSecondsFlag          .values [i] : 0;
     1998      m_timeSetArray[i].minutesFlag           = cfg_timeCodeSeiMinutesFlag          .values.size()>i ? cfg_timeCodeSeiMinutesFlag          .values [i] : 0;
     1999      m_timeSetArray[i].hoursFlag             = cfg_timeCodeSeiHoursFlag            .values.size()>i ? cfg_timeCodeSeiHoursFlag            .values [i] : 0;
     2000      m_timeSetArray[i].timeOffsetLength      = cfg_timeCodeSeiTimeOffsetLength     .values.size()>i ? cfg_timeCodeSeiTimeOffsetLength     .values [i] : 0;
     2001      m_timeSetArray[i].timeOffsetValue       = cfg_timeCodeSeiTimeOffsetValue      .values.size()>i ? cfg_timeCodeSeiTimeOffsetValue      .values [i] : 0;
     2002    }
     2003  }
     2004
     2005#if NH_3D
     2006#if NH_3D_VSO
     2007  // Table base optimization
    12392008  // Q&D
    12402009  Double adLambdaScaleTable[] =
    12412010  {  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 
     2011  0.035144, 0.035533, 0.035923, 0.036312, 0.036702, 0.037091, 0.037480, 0.037870, 0.038259, 0.038648,
     2012  0.039038, 0.039427, 0.039817, 0.040206, 0.040595, 0.040985, 0.041374, 0.041764, 0.042153, 0.042542,
     2013  0.042932, 0.043321, 0.043711, 0.044100, 0.044194, 0.053033, 0.061872, 0.070711, 0.079550, 0.088388,
     2014  0.117851, 0.147314, 0.176777, 0.235702, 0.294628, 0.353553, 0.471405, 0.589256, 0.707107, 0.707100,
     2015  0.753550, 0.800000 
    12472016  };
    12482017  if ( m_bUseVSO && m_bVSOLSTable )
     
    12612030    m_dLambdaScaleVSO *= adLambdaScaleTable[m_iQP[firstDepthLayer]];
    12622031  }
    1263 #endif
    1264 #if H_3D_VSO
    1265 if ( m_bUseVSO && m_uiVSOMode == 4)
    1266 {
    1267   m_cRenModStrParser.setString( m_iNumberOfViews, m_pchVSOConfig );
     2032  if ( m_bUseVSO && m_uiVSOMode == 4)
     2033  {
     2034    m_cRenModStrParser.setString( m_iNumberOfViews, m_pchVSOConfig );
     2035    m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
     2036      m_internalBitDepth[ CHANNEL_TYPE_LUMA],
     2037      (UInt)m_iCodedCamParPrecision,
     2038      m_FrameSkip,
     2039      (UInt)m_framesToBeEncoded,
     2040      m_pchCameraParameterFile,
     2041      m_pchBaseViewCameraNumbers,
     2042      NULL,
     2043      m_cRenModStrParser.getSynthViews(),
     2044      LOG2_DISP_PREC_LUT );
     2045  }
     2046  else if ( m_bUseVSO && m_uiVSOMode != 4 )
     2047  {
     2048    m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
     2049      m_internalBitDepth[ CHANNEL_TYPE_LUMA],
     2050      (UInt)m_iCodedCamParPrecision,
     2051      m_FrameSkip,
     2052      (UInt)m_framesToBeEncoded,
     2053      m_pchCameraParameterFile,
     2054      m_pchBaseViewCameraNumbers,
     2055      m_pchVSOConfig,
     2056      NULL,
     2057      LOG2_DISP_PREC_LUT );
     2058  }
     2059  else
     2060  {
     2061    m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
     2062      m_internalBitDepth[ CHANNEL_TYPE_LUMA],
     2063      (UInt) m_iCodedCamParPrecision,
     2064      m_FrameSkip,
     2065      (UInt) m_framesToBeEncoded,
     2066      m_pchCameraParameterFile,
     2067      m_pchBaseViewCameraNumbers,
     2068      NULL,
     2069      NULL,
     2070      LOG2_DISP_PREC_LUT );
     2071  }
     2072#else
    12682073  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,
     2074    m_internalBitDepth[ CHANNEL_TYPE_LUMA],
    12962075    (UInt) m_iCodedCamParPrecision,
    12972076    m_FrameSkip,
     
    13022081    NULL,
    13032082    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 );
    13162083#endif
    13172084  m_cCameraData.check( false, true );
    13182085#endif
     2086
    13192087  // check validity of input parameters
    13202088  xCheckParameter();
    13212089
    1322 #if !H_3D
    1323   // set global varibles
    1324   xSetGlobal();
    1325 #endif
    1326  
     2090  // compute actual CU depth with respect to config depth and max transform size
     2091  UInt uiAddCUDepth  = 0;
     2092  while( (m_uiMaxCUWidth>>m_uiMaxCUDepth) > ( 1 << ( m_uiQuadtreeTULog2MinSize + uiAddCUDepth )  ) )
     2093  {
     2094    uiAddCUDepth++;
     2095  }
     2096
     2097  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.
     2098  uiAddCUDepth++;
     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  const UInt maxBitDepth=(m_chromaFormatIDC==CHROMA_400) ? m_internalBitDepth[CHANNEL_TYPE_LUMA] : std::max(m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA]);
     2143  xConfirmPara(m_bitDepthConstraint<maxBitDepth, "The internalBitDepth must not be greater than the bitDepthConstraint value");
     2144  xConfirmPara(m_chromaFormatConstraint<m_chromaFormatIDC, "The chroma format used must not be greater than the chromaFormatConstraint value");
     2145#if NH_MV
     2146  Profile::Name & m_profile = m_profiles[0];
     2147#endif
     2148
     2149  if (m_profile==Profile::MAINREXT || m_profile==Profile::HIGHTHROUGHPUTREXT)
     2150  {
     2151    xConfirmPara(m_lowerBitRateConstraintFlag==false && m_intraConstraintFlag==false, "The lowerBitRateConstraint flag cannot be false when intraConstraintFlag is false");
     2152    xConfirmPara(m_cabacBypassAlignmentEnabledFlag && m_profile!=Profile::HIGHTHROUGHPUTREXT, "AlignCABACBeforeBypass must not be enabled unless the high throughput profile is being used.");
     2153    if (m_profile == Profile::MAINREXT)
     2154    {
     2155      const UInt intraIdx = m_intraConstraintFlag ? 1:0;
     2156      const UInt bitDepthIdx = (m_bitDepthConstraint == 8 ? 0 : (m_bitDepthConstraint ==10 ? 1 : (m_bitDepthConstraint == 12 ? 2 : (m_bitDepthConstraint == 16 ? 3 : 4 ))));
     2157      const UInt chromaFormatIdx = UInt(m_chromaFormatConstraint);
     2158      const Bool bValidProfile = (bitDepthIdx > 3 || chromaFormatIdx>3) ? false : (validRExtProfileNames[intraIdx][bitDepthIdx][chromaFormatIdx] != NONE);
     2159      xConfirmPara(!bValidProfile, "Invalid intra constraint flag, bit depth constraint flag and chroma format constraint flag combination for a RExt profile");
     2160      const Bool bUsingGeneralRExtTools  = m_transformSkipRotationEnabledFlag        ||
     2161                                           m_transformSkipContextEnabledFlag         ||
     2162                                           m_rdpcmEnabledFlag[RDPCM_SIGNAL_IMPLICIT] ||
     2163                                           m_rdpcmEnabledFlag[RDPCM_SIGNAL_EXPLICIT] ||
     2164                                           !m_enableIntraReferenceSmoothing         ||
     2165                                           m_persistentRiceAdaptationEnabledFlag     ||
     2166                                           m_log2MaxTransformSkipBlockSize!=2;
     2167      const Bool bUsingChromaQPTool      = m_diffCuChromaQpOffsetDepth >= 0;
     2168      const Bool bUsingExtendedPrecision = m_extendedPrecisionProcessingFlag;
     2169
     2170      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");
     2171      xConfirmPara(m_bitDepthConstraint != 16 && bUsingExtendedPrecision, "Extended precision can only be used in 16-bit RExt profiles");
     2172      if (!(m_chromaFormatConstraint == CHROMA_400 && m_bitDepthConstraint == 16) && m_chromaFormatConstraint!=CHROMA_444)
     2173      {
     2174        xConfirmPara(bUsingGeneralRExtTools, "Combination of tools and profiles are not possible in the specified RExt profile.");
     2175      }
     2176      xConfirmPara( m_onePictureOnlyConstraintFlag && m_chromaFormatConstraint!=CHROMA_444, "chroma format constraint must be 4:4:4 when one-picture-only constraint flag is 1");
     2177      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");
     2178      xConfirmPara( m_onePictureOnlyConstraintFlag && m_framesToBeEncoded > 1, "Number of frames to be encoded must be 1 when one-picture-only constraint flag is 1.");
     2179
     2180      if (!m_intraConstraintFlag && m_bitDepthConstraint==16 && m_chromaFormatConstraint==CHROMA_444)
     2181      {
     2182        fprintf(stderr, "********************************************************************************************************\n");
     2183        fprintf(stderr, "** WARNING: The RExt constraint flags describe a non standard combination (used for development only) **\n");
     2184        fprintf(stderr, "********************************************************************************************************\n");
     2185      }
     2186    }
     2187    else
     2188    {
     2189      xConfirmPara( m_chromaFormatConstraint != CHROMA_444, "chroma format constraint must be 4:4:4 in the High Throughput 4:4:4 16-bit Intra profile.");
     2190      xConfirmPara( m_bitDepthConstraint     != 16,         "bit depth constraint must be 4:4:4 in the High Throughput 4:4:4 16-bit Intra profile.");
     2191      xConfirmPara( m_intraConstraintFlag    != 1,          "intra constraint flag must be 1 in the High Throughput 4:4:4 16-bit Intra profile.");
     2192    }
     2193  }
     2194  else
     2195  {
     2196    xConfirmPara(m_bitDepthConstraint!=((m_profile==Profile::MAIN10)?10:8), "BitDepthConstraint must be 8 for MAIN profile and 10 for MAIN10 profile.");
     2197    xConfirmPara(m_chromaFormatConstraint!=CHROMA_420, "ChromaFormatConstraint must be 420 for non main-RExt profiles.");
     2198    xConfirmPara(m_intraConstraintFlag==true, "IntraConstraintFlag must be false for non main_RExt profiles.");
     2199    xConfirmPara(m_lowerBitRateConstraintFlag==false, "LowerBitrateConstraintFlag must be true for non main-RExt profiles.");
     2200    xConfirmPara(m_profile == Profile::MAINSTILLPICTURE && m_framesToBeEncoded > 1, "Number of frames to be encoded must be 1 when main still picture profile is used.");
     2201
     2202    xConfirmPara(m_crossComponentPredictionEnabledFlag==true, "CrossComponentPrediction must not be used for non main-RExt profiles.");
     2203    xConfirmPara(m_log2MaxTransformSkipBlockSize!=2, "Transform Skip Log2 Max Size must be 2 for V1 profiles.");
     2204    xConfirmPara(m_transformSkipRotationEnabledFlag==true, "UseResidualRotation must not be enabled for non main-RExt profiles.");
     2205    xConfirmPara(m_transformSkipContextEnabledFlag==true, "UseSingleSignificanceMapContext must not be enabled for non main-RExt profiles.");
     2206    xConfirmPara(m_rdpcmEnabledFlag[RDPCM_SIGNAL_IMPLICIT]==true, "ImplicitResidualDPCM must not be enabled for non main-RExt profiles.");
     2207    xConfirmPara(m_rdpcmEnabledFlag[RDPCM_SIGNAL_EXPLICIT]==true, "ExplicitResidualDPCM must not be enabled for non main-RExt profiles.");
     2208    xConfirmPara(m_persistentRiceAdaptationEnabledFlag==true, "GolombRiceParameterAdaption must not be enabled for non main-RExt profiles.");
     2209    xConfirmPara(m_extendedPrecisionProcessingFlag==true, "UseExtendedPrecision must not be enabled for non main-RExt profiles.");
     2210    xConfirmPara(m_highPrecisionOffsetsEnabledFlag==true, "UseHighPrecisionPredictionWeighting must not be enabled for non main-RExt profiles.");
     2211    xConfirmPara(m_enableIntraReferenceSmoothing==false, "EnableIntraReferenceSmoothing must be enabled for non main-RExt profiles.");
     2212    xConfirmPara(m_cabacBypassAlignmentEnabledFlag, "AlignCABACBeforeBypass cannot be enabled for non main-RExt profiles.");
     2213  }
     2214
    13672215  // 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" );
     2216  xConfirmPara( m_inputBitDepth[CHANNEL_TYPE_LUMA  ] < 8,                                   "InputBitDepth must be at least 8" );
     2217  xConfirmPara( m_inputBitDepth[CHANNEL_TYPE_CHROMA] < 8,                                   "InputBitDepthC must be at least 8" );
     2218
     2219#if !RExt__HIGH_BIT_DEPTH_SUPPORT
     2220  if (m_extendedPrecisionProcessingFlag)
     2221  {
     2222    for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
     2223    {
     2224      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...");
     2225    }
     2226  }
     2227  else
     2228  {
     2229    for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
     2230    {
     2231      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...");
     2232    }
     2233  }
     2234#endif
     2235
     2236  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)" );
     2237  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)" );
     2238
     2239#if NH_MV
     2240  for (Int i = 0; i < m_numberOfLayers; i++)
     2241  {
     2242    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");
     2243    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");
     2244  }
     2245#else
     2246  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");
     2247  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");
     2248#endif
     2249
     2250  xConfirmPara( m_chromaFormatIDC >= NUM_CHROMA_FORMAT,                                     "ChromaFormatIDC must be either 400, 420, 422 or 444" );
     2251  std::string sTempIPCSC="InputColourSpaceConvert must be empty, "+getListOfColourSpaceConverts(true);
     2252  xConfirmPara( m_inputColourSpaceConvert >= NUMBER_INPUT_COLOUR_SPACE_CONVERSIONS,         sTempIPCSC.c_str() );
     2253  xConfirmPara( m_InputChromaFormatIDC >= NUM_CHROMA_FORMAT,                                "InputChromaFormatIDC must be either 400, 420, 422 or 444" );
    13702254  xConfirmPara( m_iFrameRate <= 0,                                                          "Frame rate must be more than 1" );
    13712255  xConfirmPara( m_framesToBeEncoded <= 0,                                                   "Total Number Of Frames encoded must be more than 0" );
    1372 #if H_MV
     2256#if NH_MV
    13732257  xConfirmPara( m_numberOfLayers > MAX_NUM_LAYER_IDS ,                                      "NumberOfLayers must be less than or equal to MAX_NUM_LAYER_IDS");
    13742258
     
    13762260  xConfirmPara( m_layerIdInNuh[0] != 0      , "LayerIdInNuh must be 0 for the first layer. ");
    13772261  xConfirmPara( (m_layerIdInNuh.size()!=1) && (m_layerIdInNuh.size() < m_numberOfLayers) , "LayerIdInNuh must be given for all layers. ");
    1378  
    1379 #if H_3D
     2262
     2263#if NH_3D
    13802264  xConfirmPara( m_scalabilityMask != 2 && m_scalabilityMask != 3, "Scalability Mask must be equal to 2 or 3. ");
    13812265#else
     
    13832267#endif
    13842268
    1385 #if H_3D
     2269#if NH_3D
    13862270  if ( m_scalabilityMask & ( 1 << DEPTH_ID ) )
    13872271  {
     
    14042288  dimBitOffset[ 0 ] = 0;
    14052289  for (Int j = 1; j <= ((Int) m_dimIds.size() - m_splittingFlag ? 1 : 0); j++ )
    1406  {
     2290  {
    14072291    dimBitOffset[ j ] = dimBitOffset[ j - 1 ] + m_dimensionIdLen[ j - 1];
    14082292  }
     
    14122296    dimBitOffset[ (Int) m_dimIds.size() ] = 6;
    14132297  }
    1414  
     2298
    14152299  for( Int j = 0; j < m_dimIds.size(); j++ )
    14162300  {   
     
    14182302    xConfirmPara( (m_dimIds[j][0] != 0)                 , "DimensionId of layer 0 must be 0. " );
    14192303    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    {     
     2304
     2305
     2306    for( Int i = 1; i < m_numberOfLayers; i++ )
     2307    {     
    14242308      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. " );
    14252309      if ( m_splittingFlag )
     
    14282312        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. ");
    14292313      }
    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." );
     2314    }
     2315  }
     2316
     2317  for( Int i = 0; i < m_numberOfLayers; i++ )
     2318  {
     2319    for( Int j = 0; j < i; j++ )
     2320    {     
     2321      Int numDiff  = 0;
     2322      Int lastDiff = -1;
     2323      for( Int dim = 0; dim < m_dimIds.size(); dim++ )
     2324      {
     2325        if ( m_dimIds[dim][i] != m_dimIds[dim][j] )
     2326        {
     2327          numDiff ++;
     2328          lastDiff = dim;
     2329        }
     2330      }
     2331
     2332      Bool allEqual = ( numDiff == 0 );
     2333
     2334      if ( allEqual )
     2335      {
     2336        printf( "\nError: Positions of Layers %d and %d are identical in scalability space\n", i, j);
     2337      }
     2338
     2339      xConfirmPara( allEqual , "Each layer shall have a different position in scalability space." );
    14562340
    14572341#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." );
     2342      if ( numDiff  == 1 )
     2343      {
     2344        Bool inc = m_dimIds[ lastDiff ][ i ] > m_dimIds[ lastDiff ][ j ];
     2345        Bool shallBeButIsNotIncreasing = ( !inc  ) ;
     2346        if ( shallBeButIsNotIncreasing )
     2347        {       
     2348          printf( "\nError: Positions of Layers %d and %d is not increasing in dimension %d \n", i, j, lastDiff);       
     2349        }
     2350        xConfirmPara( shallBeButIsNotIncreasing,  "DimensionIds shall be increasing within one dimension. " );
     2351      }
     2352#endif
     2353    }
     2354  }
     2355
     2356  /// ViewId
     2357  xConfirmPara( m_viewId.size() != m_iNumberOfViews, "The number of ViewIds must be equal to the number of views." );
    14742358
    14752359  /// Layer sets
     
    15322416
    15332417  // 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 
     2418  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." );
     2419
     2420  if ( m_numberOfLayers > 1)
     2421  {
     2422    xConfirmPara( m_profiles.size() <= 1, "The number of profiles, tiers, levels, and inblFlags must be greater than 1.");
     2423    xConfirmPara( m_inblFlag[0], "VpsProfileTierLevel[0] must have inblFlag equal to 0");
     2424    if (m_profiles.size() > 1 )
     2425    {
     2426      xConfirmPara( m_profiles[0]  != m_profiles[1], "The profile in VpsProfileTierLevel[1] must be equal to the profile in VpsProfileTierLevel[0].");
     2427      xConfirmPara( m_inblFlag[0] != m_inblFlag[1], "inblFlag in VpsProfileTierLevel[1] must be equal to the inblFlag in VpsProfileTierLevel[0].");
     2428    }
     2429  }
     2430
     2431  // Layer Dependencies 
    15482432  for (Int i = 0; i < m_numberOfLayers; i++ )
    15492433  {
     
    15572441  } 
    15582442#endif
     2443
    15592444  xConfirmPara( m_iGOPSize < 1 ,                                                            "GOP Size must be greater or equal to 1" );
    15602445  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
     2446#if NH_MV
    15622447  for( Int layer = 0; layer < m_numberOfLayers; layer++ )
    15632448  {
     
    15672452  xConfirmPara( (m_iIntraPeriod > 0 && m_iIntraPeriod < m_iGOPSize) || m_iIntraPeriod == 0, "Intra period must be more than GOP size, or -1 , not 0" );
    15682453#endif
    1569 #if ALLOW_RECOVERY_POINT_AS_RAP
    15702454  xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 3,                   "Decoding Refresh Type must be comprised between 0 and 3 included" );
    15712455  if(m_iDecodingRefreshType == 3)
     
    15732457    xConfirmPara( !m_recoveryPointSEIEnabled,                                               "When using RecoveryPointSEI messages as RA points, recoveryPointSEI must be enabled" );
    15742458  }
     2459
     2460  if (m_isField)
     2461  {
     2462    if (!m_pictureTimingSEIEnabled)
     2463    {
     2464      fprintf(stderr, "****************************************************************************\n");
     2465      fprintf(stderr, "** WARNING: Picture Timing SEI should be enabled for field coding!        **\n");
     2466      fprintf(stderr, "****************************************************************************\n");
     2467    }
     2468  }
     2469
     2470  if(m_crossComponentPredictionEnabledFlag && (m_chromaFormatIDC != CHROMA_444))
     2471  {
     2472    fprintf(stderr, "****************************************************************************\n");
     2473    fprintf(stderr, "** WARNING: Cross-component prediction is specified for 4:4:4 format only **\n");
     2474    fprintf(stderr, "****************************************************************************\n");
     2475
     2476    m_crossComponentPredictionEnabledFlag = false;
     2477  }
     2478
     2479  if ( m_CUTransquantBypassFlagForce && m_bUseHADME )
     2480  {
     2481    fprintf(stderr, "****************************************************************************\n");
     2482    fprintf(stderr, "** WARNING: --HadamardME has been disabled due to the enabling of         **\n");
     2483    fprintf(stderr, "**          --CUTransquantBypassFlagForce                                 **\n");
     2484    fprintf(stderr, "****************************************************************************\n");
     2485
     2486    m_bUseHADME = false; // this has been disabled so that the lambda is calculated slightly differently for lossless modes (as a result of JCTVC-R0104).
     2487  }
     2488
     2489  xConfirmPara (m_log2MaxTransformSkipBlockSize < 2, "Transform Skip Log2 Max Size must be at least 2 (4x4)");
     2490
     2491  if (m_log2MaxTransformSkipBlockSize!=2 && m_useTransformSkipFast)
     2492  {
     2493    fprintf(stderr, "***************************************************************************\n");
     2494    fprintf(stderr, "** WARNING: Transform skip fast is enabled (which only tests NxN splits),**\n");
     2495    fprintf(stderr, "**          but transform skip log2 max size is not 2 (4x4)              **\n");
     2496    fprintf(stderr, "**          It may be better to disable transform skip fast mode         **\n");
     2497    fprintf(stderr, "***************************************************************************\n");
     2498  }
     2499#if NH_MV
     2500  for( Int layer = 0; layer < m_numberOfLayers; layer++ )
     2501  {
     2502    xConfirmPara( m_iQP[layer] <  -6 * (m_internalBitDepth[CHANNEL_TYPE_LUMA] - 8) || m_iQP[layer] > 51,      "QP exceeds supported range (-QpBDOffsety to 51)" );
     2503    xConfirmPara( m_DeblockingFilterMetric && (m_bLoopFilterDisable[layer] || m_loopFilterOffsetInPPS), "If DeblockingFilterMetric is true then both LoopFilterDisable and LoopFilterOffsetInPPS must be 0");
     2504  }
    15752505#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)");
     2506  xConfirmPara( m_iQP <  -6 * (m_internalBitDepth[CHANNEL_TYPE_LUMA] - 8) || m_iQP > 51,    "QP exceeds supported range (-QpBDOffsety to 51)" );
     2507  xConfirmPara( m_DeblockingFilterMetric && (m_bLoopFilterDisable || m_loopFilterOffsetInPPS), "If DeblockingFilterMetric is true then both LoopFilterDisable and LoopFilterOffsetInPPS must be 0");
     2508#endif
     2509 
     2510  xConfirmPara( m_loopFilterBetaOffsetDiv2 < -6 || m_loopFilterBetaOffsetDiv2 > 6,        "Loop Filter Beta Offset div. 2 exceeds supported range (-6 to 6)");
     2511  xConfirmPara( m_loopFilterTcOffsetDiv2 < -6 || m_loopFilterTcOffsetDiv2 > 6,            "Loop Filter Tc Offset div. 2 exceeds supported range (-6 to 6)");
    15882512  xConfirmPara( m_iFastSearch < 0 || m_iFastSearch > 2,                                     "Fast Search Mode is not supported value (0:Full search  1:Diamond  2:PMVFAST)" );
    15892513  xConfirmPara( m_iSearchRange < 0 ,                                                        "Search Range must be more than 0" );
    15902514  xConfirmPara( m_bipredSearchRange < 0 ,                                                   "Search Range must be more than 0" );
    1591 #if H_MV
     2515#if NH_MV
    15922516  xConfirmPara( m_iVerticalDisparitySearchRange <= 0 ,                                      "Vertical Disparity Search Range must be more than 0" );
    15932517#endif
     
    16032527  if (m_iDecodingRefreshType == 2)
    16042528  {
    1605 #if H_MV
     2529#if NH_MV
    16062530    for (Int i = 0; i < m_numberOfLayers; i++ )
    16072531    {
     
    16182542  xConfirmPara( (m_iSourceWidth  % (m_uiMaxCUWidth  >> (m_uiMaxCUDepth-1)))!=0,             "Resulting coded frame width must be a multiple of the minimum CU size");
    16192543  xConfirmPara( (m_iSourceHeight % (m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)))!=0,             "Resulting coded frame height must be a multiple of the minimum CU size");
    1620  
     2544
    16212545  xConfirmPara( m_uiQuadtreeTULog2MinSize < 2,                                        "QuadtreeTULog2MinSize must be 2 or greater.");
    16222546  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  
    16252547  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." );
     2548  xConfirmPara( (1<<m_uiQuadtreeTULog2MaxSize) > m_uiMaxCUWidth,                      "QuadtreeTULog2MaxSize must be log2(maxCUSize) or smaller.");
     2549  xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) >= ( m_uiMaxCUWidth  >> (m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than or equal to minimum CU size" );
     2550  xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) >= ( m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than or equal to minimum CU size" );
    16302551  xConfirmPara( m_uiQuadtreeTUMaxDepthInter < 1,                                                         "QuadtreeTUMaxDepthInter must be greater than or equal to 1" );
    16312552  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" );
    16322553  xConfirmPara( m_uiQuadtreeTUMaxDepthIntra < 1,                                                         "QuadtreeTUMaxDepthIntra must be greater than or equal to 1" );
    16332554  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  
     2555
    16352556  xConfirmPara(  m_maxNumMergeCand < 1,  "MaxNumMergeCand must be 1 or greater.");
    16362557  xConfirmPara(  m_maxNumMergeCand > 5,  "MaxNumMergeCand must be 5 or smaller.");
    1637 
    1638 #if H_3D_ARP
    1639 #endif
    1640 #if H_3D_SPIVMP
     2558#if NH_3D
    16412559  xConfirmPara( m_log2SubPbSizeMinus3 < 0,                                        "Log2SubPbSizeMinus3 must be equal to 0 or greater.");
    16422560  xConfirmPara( m_log2SubPbSizeMinus3 > 3,                                        "Log2SubPbSizeMinus3 must be equal to 3 or smaller.");
     
    16482566#endif
    16492567#if ADAPTIVE_QP_SELECTION
    1650 #if H_MV
     2568#if NH_MV
    16512569  for( Int layer = 0; layer < m_numberOfLayers; layer++ )
    16522570  {
     
    16612579  if( m_usePCM)
    16622580  {
     2581    for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
     2582    {
     2583      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)");
     2584    }
    16632585    xConfirmPara(  m_uiPCMLog2MinSize < 3,                                      "PCMLog2MinSize must be 3 or greater.");
    16642586    xConfirmPara(  m_uiPCMLog2MinSize > 5,                                      "PCMLog2MinSize must be 5 or smaller.");
     
    16772599    xConfirmPara( m_sliceSegmentArgument < 1 ,         "SliceSegmentArgument should be larger than or equal to 1" );
    16782600  }
    1679  
     2601
    16802602  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");
     2603  if (m_profile!=Profile::HIGHTHROUGHPUTREXT)
     2604  {
     2605    xConfirmPara( tileFlag && m_iWaveFrontSynchro,            "Tile and Wavefront can not be applied together, except in the High Throughput Intra 4:4:4 16 profile");
     2606  }
     2607
     2608  xConfirmPara( m_iSourceWidth  % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Picture width must be an integer multiple of the specified chroma subsampling");
     2609  xConfirmPara( m_iSourceHeight % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Picture height must be an integer multiple of the specified chroma subsampling");
     2610
     2611  xConfirmPara( m_aiPad[0] % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Horizontal padding must be an integer multiple of the specified chroma subsampling");
     2612  xConfirmPara( m_aiPad[1] % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Vertical padding must be an integer multiple of the specified chroma subsampling");
     2613
     2614  xConfirmPara( m_confWinLeft   % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Left conformance window offset must be an integer multiple of the specified chroma subsampling");
     2615  xConfirmPara( m_confWinRight  % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Right conformance window offset must be an integer multiple of the specified chroma subsampling");
     2616  xConfirmPara( m_confWinTop    % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling");
     2617  xConfirmPara( m_confWinBottom % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling");
    16942618
    16952619  xConfirmPara( m_defaultDisplayWindowFlag && !m_vuiParametersPresentFlag, "VUI needs to be enabled for default display window");
     
    16972621  if (m_defaultDisplayWindowFlag)
    16982622  {
    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
     2623    xConfirmPara( m_defDispWinLeftOffset   % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Left default display window offset must be an integer multiple of the specified chroma subsampling");
     2624    xConfirmPara( m_defDispWinRightOffset  % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Right default display window offset must be an integer multiple of the specified chroma subsampling");
     2625    xConfirmPara( m_defDispWinTopOffset    % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Top default display window offset must be an integer multiple of the specified chroma subsampling");
     2626    xConfirmPara( m_defDispWinBottomOffset % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Bottom default display window offset must be an integer multiple of the specified chroma subsampling");
     2627  }
     2628
     2629#if NH_3D
    17062630  xConfirmPara( m_pchCameraParameterFile    == 0                ,   "CameraParameterFile must be given");
    17072631  xConfirmPara( m_pchBaseViewCameraNumbers  == 0                ,   "BaseViewCameraNumbers must be given" );
    17082632  xConfirmPara( m_iNumberOfViews != m_cCameraData.getBaseViewNumbers().size() ,   "Number of Views in BaseViewCameraNumbers must be equal to NumberOfViews" );
    17092633  xConfirmPara    ( m_iCodedCamParPrecision < 0 || m_iCodedCamParPrecision > 5,       "CodedCamParsPrecision must be in range of 0..5" );
    1710 #if H_3D_VSO
     2634#if NH_3D_VSO
    17112635    if( m_bUseVSO )
    17122636    {
     
    17222646    ui >>= 1;
    17232647    if( (ui & 1) == 1)
     2648    {
    17242649      xConfirmPara( ui != 1 , "Width should be 2^n");
     2650    }
    17252651  }
    17262652  ui = m_uiMaxCUHeight;
     
    17292655    ui >>= 1;
    17302656    if( (ui & 1) == 1)
     2657    {
    17312658      xConfirmPara( ui != 1 , "Height should be 2^n");
    1732   }
    1733 
    1734 #if H_MV
     2659    }
     2660  }
     2661
     2662#if NH_MV
    17352663  // validate that POC of same frame is identical across multiple layers
    17362664  Bool bErrorMvePoc = false;
     
    18802808      Int*      m_numReorderPics     = m_numReorderPicsMvc    [layer]; // It is not a member, but this name helps avoiding code duplication !!!
    18812809#endif
     2810
    18822811  /* if this is an intra-only sequence, ie IntraPeriod=1, don't verify the GOP structure
    18832812   * 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) {
     2813#if NH_MV
     2814  if (m_iIntraPeriod[layer] == 1 && m_GOPList[0].m_POC == -1)
    18862815#else
    1887   if (m_iIntraPeriod == 1 && m_GOPList[0].m_POC == -1) {
    1888 #endif
     2816  if (m_iIntraPeriod == 1 && m_GOPList[0].m_POC == -1)
     2817#endif
     2818  {
    18892819    m_GOPList[0] = GOPEntry();
    18902820    m_GOPList[0].m_QPFactor = 1;
     
    18942824    m_GOPList[0].m_numRefPicsActive = 4;
    18952825  }
    1896  
     2826  else
     2827  {
     2828    xConfirmPara( m_intraConstraintFlag, "IntraConstraintFlag cannot be 1 for inter sequences");
     2829  }
     2830
    18972831  Bool verifiedGOP=false;
    18982832  Bool errorGOP=false;
     
    19062840  }
    19072841  Bool isOK[MAX_GOP];
    1908   for(Int i=0; i<MAX_GOP; i++) 
     2842  for(Int i=0; i<MAX_GOP; i++)
    19092843  {
    19102844    isOK[i]=false;
    19112845  }
    19122846  Int numOK=0;
    1913 #if H_MV
     2847#if NH_MV
    19142848  xConfirmPara( m_iIntraPeriod[layer] >=0&&(m_iIntraPeriod[layer]%m_iGOPSize!=0), "Intra period must be a multiple of GOPSize, or -1" );
    19152849#else
    1916 xConfirmPara( m_iIntraPeriod >=0&&(m_iIntraPeriod%m_iGOPSize!=0), "Intra period must be a multiple of GOPSize, or -1" );
     2850  xConfirmPara( m_iIntraPeriod >=0&&(m_iIntraPeriod%m_iGOPSize!=0), "Intra period must be a multiple of GOPSize, or -1" );
    19172851#endif
    19182852
     
    19242858    }
    19252859  }
    1926  
    1927 #if H_MV
    1928   if ( (m_iIntraPeriod[layer] != 1) && !m_loopFilterOffsetInPPS && m_DeblockingFilterControlPresent && (!m_bLoopFilterDisable[layer]) )
     2860
     2861#if NH_MV
     2862  if ( (m_iIntraPeriod[layer] != 1) && !m_loopFilterOffsetInPPS && (!m_bLoopFilterDisable[layer]) )
    19292863#else
    1930   if ( (m_iIntraPeriod != 1) && !m_loopFilterOffsetInPPS && m_DeblockingFilterControlPresent && (!m_bLoopFilterDisable) )
     2864  if ( (m_iIntraPeriod != 1) && !m_loopFilterOffsetInPPS && (!m_bLoopFilterDisable) )
    19312865#endif
    19322866  {
     
    19372871    }
    19382872  }
     2873
    19392874  m_extraRPSs=0;
    19402875  //start looping through frames in coding order until we can verify that the GOP structure is correct.
    1941   while(!verifiedGOP&&!errorGOP) 
     2876  while(!verifiedGOP&&!errorGOP)
    19422877  {
    19432878    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
     2879    Int curPOC = ((checkGOP-1)/m_iGOPSize)*m_iGOPSize + m_GOPList[curGOP].m_POC;
     2880    if(m_GOPList[curGOP].m_POC<0)
     2881    {
     2882#if NH_MV
    19482883      printf("\nError: found fewer Reference Picture Sets than GOPSize for layer %d\n", layer );
    19492884#else
     
    19522887      errorGOP=true;
    19532888    }
    1954     else 
     2889    else
    19552890    {
    19562891      //check that all reference pictures are available, or have a POC < 0 meaning they might be available in the next GOP.
    19572892      Bool beforeI = false;
    1958       for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) 
     2893      for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++)
    19592894      {
    19602895        Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i];
     
    19632898          beforeI=true;
    19642899        }
    1965         else 
     2900        else
    19662901        {
    19672902          Bool found=false;
    1968           for(Int j=0; j<numRefs; j++) 
     2903          for(Int j=0; j<numRefs; j++)
    19692904          {
    1970             if(refList[j]==absPOC) 
     2905            if(refList[j]==absPOC)
    19712906            {
    19722907              found=true;
     
    19862921          if(!found)
    19872922          {
    1988 #if H_MV
     2923#if NH_MV
    19892924            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);
    19902925#else
     
    19982933      {
    19992934        //all ref frames were present
    2000         if(!isOK[curGOP]) 
     2935        if(!isOK[curGOP])
    20012936        {
    20022937          numOK++;
     
    20082943        }
    20092944      }
    2010       else 
     2945      else
    20112946      {
    20122947        //create a new GOPEntry for this frame containing all the reference pictures that were available (POC > 0)
    20132948        m_GOPList[m_iGOPSize+m_extraRPSs]=m_GOPList[curGOP];
    20142949        Int newRefs=0;
    2015         for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) 
     2950        for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++)
    20162951        {
    20172952          Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i];
     
    20242959        }
    20252960        Int numPrefRefs = m_GOPList[curGOP].m_numRefPicsActive;
    2026        
     2961
    20272962        for(Int offset = -1; offset>-checkGOP; offset--)
    20282963        {
     
    20402975              }
    20412976            }
    2042             for(Int i=0; i<newRefs; i++) 
     2977            for(Int i=0; i<newRefs; i++)
    20432978            {
    20442979              if(m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[i]==offPOC-curPOC)
     
    20472982              }
    20482983            }
    2049             if(newRef) 
     2984            if(newRef)
    20502985            {
    20512986              Int insertPoint=newRefs;
     
    20953030          Int refPics = m_GOPList[rIdx].m_numRefPics;
    20963031          Int newIdc=0;
    2097           for(Int i = 0; i<= refPics; i++) 
     3032          for(Int i = 0; i<= refPics; i++)
    20983033          {
    20993034            Int deltaPOC = ((i != refPics)? m_GOPList[rIdx].m_referencePics[i] : 0);  // check if the reference abs POC is >= 0
     
    21173052            newIdc++;
    21183053          }
    2119           m_GOPList[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 1; 
     3054          m_GOPList[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 1;
    21203055          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; 
     3056          m_GOPList[m_iGOPSize+m_extraRPSs].m_deltaRPS = refPOC - m_GOPList[m_iGOPSize+m_extraRPSs].m_POC;
    21223057        }
    21233058        curGOP=m_iGOPSize+m_extraRPSs;
     
    21253060      }
    21263061      numRefs=0;
    2127       for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) 
     3062      for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++)
    21283063      {
    21293064        Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i];
    2130         if(absPOC >= 0) 
     3065        if(absPOC >= 0)
    21313066        {
    21323067          refList[numRefs]=absPOC;
     
    21413076  xConfirmPara(errorGOP,"Invalid GOP structure given");
    21423077  m_maxTempLayer = 1;
    2143   for(Int i=0; i<m_iGOPSize; i++) 
     3078  for(Int i=0; i<m_iGOPSize; i++)
    21443079  {
    21453080    if(m_GOPList[i].m_temporalId >= m_maxTempLayer)
     
    21473082      m_maxTempLayer = m_GOPList[i].m_temporalId+1;
    21483083    }
    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");
     3084    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");
    21503085  }
    21513086  for(Int i=0; i<MAX_TLAYER; i++)
     
    21543089    m_maxDecPicBuffering[i] = 1;
    21553090  }
    2156   for(Int i=0; i<m_iGOPSize; i++) 
     3091  for(Int i=0; i<m_iGOPSize; i++)
    21573092  {
    21583093    if(m_GOPList[i].m_numRefPics+1 > m_maxDecPicBuffering[m_GOPList[i].m_temporalId])
     
    21603095      m_maxDecPicBuffering[m_GOPList[i].m_temporalId] = m_GOPList[i].m_numRefPics + 1;
    21613096    }
    2162     Int highestDecodingNumberWithLowerPOC = 0; 
     3097    Int highestDecodingNumberWithLowerPOC = 0;
    21633098    for(Int j=0; j<m_iGOPSize; j++)
    21643099    {
     
    21713106    for(Int j=0; j<highestDecodingNumberWithLowerPOC; j++)
    21723107    {
    2173       if(m_GOPList[j].m_temporalId <= m_GOPList[i].m_temporalId && 
     3108      if(m_GOPList[j].m_temporalId <= m_GOPList[i].m_temporalId &&
    21743109        m_GOPList[j].m_POC > m_GOPList[i].m_POC)
    21753110      {
    21763111        numReorder++;
    21773112      }
    2178     }   
     3113    }
    21793114    if(numReorder > m_numReorderPics[m_GOPList[i].m_temporalId])
    21803115    {
     
    21823117    }
    21833118  }
    2184   for(Int i=0; i<MAX_TLAYER-1; i++) 
     3119  for(Int i=0; i<MAX_TLAYER-1; i++)
    21853120  {
    21863121    // a lower layer can not have higher value of m_numReorderPics than a higher layer
     
    22013136  }
    22023137
    2203 
    22043138  // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ] -  1, inclusive
    22053139  if(m_numReorderPics[MAX_TLAYER-1] > m_maxDecPicBuffering[MAX_TLAYER-1] - 1)
     
    22093143
    22103144  if(m_vuiParametersPresentFlag && m_bitstreamRestrictionFlag)
    2211   { 
     3145  {
    22123146    Int PicSizeInSamplesY =  m_iSourceWidth * m_iSourceHeight;
    22133147    if(tileFlag)
     
    22213155        maxTileWidth = m_uiMaxCUWidth*((widthInCU+m_numTileColumnsMinus1)/(m_numTileColumnsMinus1+1));
    22223156        maxTileHeight = m_uiMaxCUHeight*((heightInCU+m_numTileRowsMinus1)/(m_numTileRowsMinus1+1));
    2223         // if only the last tile-row is one treeblock higher than the others 
     3157        // if only the last tile-row is one treeblock higher than the others
    22243158        // the maxTileHeight becomes smaller if the last row of treeblocks has lower height than the others
    22253159        if(!((heightInCU-1)%(m_numTileRowsMinus1+1)))
    22263160        {
    22273161          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   
     3162        }
     3163        // if only the last tile-column is one treeblock wider than the others
     3164        // the maxTileWidth becomes smaller if the last column of treeblocks has lower width than the others
    22313165        if(!((widthInCU-1)%(m_numTileColumnsMinus1+1)))
    22323166        {
     
    22723206      m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/((2*m_iSourceHeight+m_iSourceWidth)*m_uiMaxCUHeight)-4;
    22733207    }
    2274     else if(m_sliceMode == 1)
     3208    else if(m_sliceMode == FIXED_NUMBER_OF_CTU)
    22753209    {
    22763210      m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/(m_sliceArgument*m_uiMaxCUWidth*m_uiMaxCUHeight)-4;
     
    22813215    }
    22823216  }
     3217
    22833218  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" );
    22863219
    22873220  xConfirmPara( m_decodedPictureHashSEIEnabled<0 || m_decodedPictureHashSEIEnabled>3, "this hash type is not correct!\n");
     
    22993232  }
    23003233
     3234  if (m_kneeSEIEnabled && !m_kneeSEICancelFlag)
     3235  {
     3236    xConfirmPara( m_kneeSEINumKneePointsMinus1 < 0 || m_kneeSEINumKneePointsMinus1 > 998, "SEIKneeFunctionNumKneePointsMinus1 must be in the range of 0 to 998");
     3237    for ( UInt i=0; i<=m_kneeSEINumKneePointsMinus1; i++ )
     3238    {
     3239      xConfirmPara( m_kneeSEIInputKneePoint[i] < 1 || m_kneeSEIInputKneePoint[i] > 999, "SEIKneeFunctionInputKneePointValue must be in the range of 1 to 999");
     3240      xConfirmPara( m_kneeSEIOutputKneePoint[i] < 0 || m_kneeSEIOutputKneePoint[i] > 1000, "SEIKneeFunctionInputKneePointValue must be in the range of 0 to 1000");
     3241      if ( i > 0 )
     3242      {
     3243        xConfirmPara( m_kneeSEIInputKneePoint[i-1] >= m_kneeSEIInputKneePoint[i],  "The i-th SEIKneeFunctionInputKneePointValue must be greater than the (i-1)-th value");
     3244        xConfirmPara( m_kneeSEIOutputKneePoint[i-1] > m_kneeSEIOutputKneePoint[i],  "The i-th SEIKneeFunctionOutputKneePointValue must be greater than or equal to the (i-1)-th value");
     3245      }
     3246    }
     3247  }
     3248
    23013249  if ( m_RCEnableRateControl )
    23023250  {
     
    23113259    xConfirmPara( m_uiDeltaQpRD > 0, "Rate control cannot be used together with slice level multiple-QP optimization!\n" );
    23123260  }
    2313 #if H_MV
     3261#if NH_MV
    23143262  // VPS VUI
    23153263  for(Int i = 0; i < MAX_VPS_OP_SETS_PLUS1; i++ )
     
    23373285
    23383286  xConfirmPara(m_log2ParallelMergeLevel < 2, "Log2ParallelMergeLevel should be larger than or equal to 2");
     3287
    23393288  if (m_framePackingSEIEnabled)
    23403289  {
    23413290    xConfirmPara(m_framePackingSEIType < 3 || m_framePackingSEIType > 5 , "SEIFramePackingType must be in rage 3 to 5");
    23423291  }
    2343 
    2344 #if H_MV
     3292#if NH_MV
    23453293  }
    23463294  }
     
    23633311  }
    23643312#endif
     3313
     3314  if (m_segmentedRectFramePackingSEIEnabled)
     3315  {
     3316    xConfirmPara(m_framePackingSEIEnabled > 0 , "SEISegmentedRectFramePacking must be 0 when SEIFramePacking is 1");
     3317  }
     3318
     3319  if((m_numTileColumnsMinus1 <= 0) && (m_numTileRowsMinus1 <= 0) && m_tmctsSEIEnabled)
     3320  {
     3321    printf("Warning: SEITempMotionConstrainedTileSets is set to false to disable temporal motion-constrained tile sets SEI message because there are no tiles enabled.\n");
     3322    m_tmctsSEIEnabled = false;
     3323  }
     3324
     3325  if(m_timeCodeSEIEnabled)
     3326  {
     3327    xConfirmPara(m_timeCodeSEINumTs > MAX_TIMECODE_SEI_SETS, "Number of time sets cannot exceed 3");
     3328  }
     3329
    23653330#undef xConfirmPara
    23663331  if (check_failed)
     
    23703335}
    23713336
    2372 /** \todo use of global variables should be removed later
    2373  */
    2374 Void TAppEncCfg::xSetGlobal()
     3337const Char *profileToString(const Profile::Name profile)
    23753338{
    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;
     3339  static const UInt numberOfProfiles = sizeof(strToProfile)/sizeof(*strToProfile);
     3340
     3341  for (UInt profileIndex = 0; profileIndex < numberOfProfiles; profileIndex++)
     3342  {
     3343    if (strToProfile[profileIndex].value == profile)
     3344    {
     3345      return strToProfile[profileIndex].str;
     3346    }
     3347  }
     3348
     3349  //if we get here, we didn't find this profile in the list - so there is an error
     3350  std::cerr << "ERROR: Unknown profile \"" << profile << "\" in profileToString" << std::endl;
     3351  assert(false);
     3352  exit(1);
     3353  return "";
    23943354}
    23953355
     
    23973357{
    23983358  printf("\n");
    2399 #if H_MV
     3359#if NH_MV
    24003360  for( Int layer = 0; layer < m_numberOfLayers; layer++)
    24013361  {
    2402     printf("Input File %i                 : %s\n", layer, m_pchInputFileList[layer]);
     3362    printf("Input File %i                     : %s\n", layer, m_pchInputFileList[layer]);
    24033363  }
    24043364#else
    2405   printf("Input          File          : %s\n", m_pchInputFile          );
    2406 #endif
    2407   printf("Bitstream      File          : %s\n", m_pchBitstreamFile      );
    2408 #if H_MV
     3365  printf("Input          File               : %s\n", m_pchInputFile          );
     3366#endif
     3367  printf("Bitstream      File               : %s\n", m_pchBitstreamFile      );
     3368#if NH_MV
    24093369  for( Int layer = 0; layer < m_numberOfLayers; layer++)
    24103370  {
    2411     printf("Reconstruction File %i        : %s\n", layer, m_pchReconFileList[layer]);
     3371    printf("Reconstruction File %i            : %s\n", layer, m_pchReconFileList[layer]);
    24123372  }
    24133373#else
    2414   printf("Reconstruction File          : %s\n", m_pchReconFile          );
    2415 #endif
    2416 #if H_MV
     3374  printf("Reconstruction File               : %s\n", m_pchReconFile          );
     3375#endif
     3376#if NH_MV
    24173377  xPrintParaVector( "NuhLayerId"     , m_layerIdInNuh );
    24183378  if ( m_targetEncLayerIdList.size() > 0)
     
    24213381  }
    24223382  xPrintParaVector( "ViewIdVal"     , m_viewId );
    2423   xPrintParaVector( "ViewOrderIndex", m_viewOrderIndex );
     3383  xPrintParaVector( "ViewOrderIdx"  , m_viewOrderIndex );
    24243384  xPrintParaVector( "AuxId", m_auxId );
    24253385#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 
     3386#if NH_3D
     3387  xPrintParaVector( "DepthLayerFlag", m_depthFlag );
     3388  printf("Coded Camera Param. Precision     : %d\n", m_iCodedCamParPrecision); 
     3389#endif
     3390#if NH_MV 
    24313391  xPrintParaVector( "QP"               , m_fQP                );
    24323392  xPrintParaVector( "LoopFilterDisable", m_bLoopFilterDisable );
    24333393  xPrintParaVector( "SAO"              , m_bUseSAO            );
    24343394#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 );
     3395
     3396  printf("Real     Format                   : %dx%d %dHz\n", m_iSourceWidth - m_confWinLeft - m_confWinRight, m_iSourceHeight - m_confWinTop - m_confWinBottom, m_iFrameRate );
     3397  printf("Internal Format                   : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate );
     3398  printf("Sequence PSNR output              : %s\n", (m_printMSEBasedSequencePSNR ? "Linear average, MSE-based" : "Linear average only") );
     3399  printf("Sequence MSE output               : %s\n", (m_printSequenceMSE ? "Enabled" : "Disabled") );
     3400  printf("Frame MSE output                  : %s\n", (m_printFrameMSE    ? "Enabled" : "Disabled") );
     3401  printf("Cabac-zero-word-padding           : %s\n", (m_cabacZeroWordPaddingEnabled? "Enabled" : "Disabled") );
    24373402  if (m_isField)
    24383403  {
    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");
     3404    printf("Frame/Field                       : Field based coding\n");
     3405    printf("Field index                       : %u - %d (%d fields)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
     3406    printf("Field Order                       : %s field first\n", m_isTopFieldFirst?"Top":"Bottom");
     3407
     3408  }
     3409  else
     3410  {
     3411    printf("Frame/Field                       : Frame based coding\n");
     3412    printf("Frame index                       : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
     3413  }
     3414#if NH_MV
     3415  printf("Profile                           :");
     3416  for (Int i = 0; i < m_profiles.size(); i++)
     3417  {
     3418    Profile::Name m_profile = m_profiles[i];
     3419
     3420#endif
     3421    if (m_profile == Profile::MAINREXT)
     3422    {
     3423    ExtendedProfileName validProfileName;
     3424    if (m_onePictureOnlyConstraintFlag)
     3425    {
     3426      validProfileName = m_bitDepthConstraint == 8 ? MAIN_444_STILL_PICTURE : (m_bitDepthConstraint == 16 ? MAIN_444_16_STILL_PICTURE : NONE);
    24443427    }
    24453428    else
    24463429    {
    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
     3430      const UInt intraIdx = m_intraConstraintFlag ? 1:0;
     3431      const UInt bitDepthIdx = (m_bitDepthConstraint == 8 ? 0 : (m_bitDepthConstraint ==10 ? 1 : (m_bitDepthConstraint == 12 ? 2 : (m_bitDepthConstraint == 16 ? 3 : 4 ))));
     3432      const UInt chromaFormatIdx = UInt(m_chromaFormatConstraint);
     3433      validProfileName = (bitDepthIdx > 3 || chromaFormatIdx>3) ? NONE : validRExtProfileNames[intraIdx][bitDepthIdx][chromaFormatIdx];
     3434    }
     3435      std::string rextSubProfile;
     3436      if (validProfileName!=NONE)
     3437      {
     3438        rextSubProfile=enumToString(strToExtendedProfile, sizeof(strToExtendedProfile)/sizeof(*strToExtendedProfile), validProfileName);
     3439      }
     3440      if (rextSubProfile == "main_444_16")
     3441      {
     3442        rextSubProfile="main_444_16 [NON STANDARD]";
     3443      }
     3444#if NH_MV
     3445      printf(" %s (%s) ", profileToString(m_profile), (rextSubProfile.empty())?"INVALID REXT PROFILE":rextSubProfile.c_str() );
     3446#else
     3447      printf("Profile                           : %s (%s)\n", profileToString(m_profile), (rextSubProfile.empty())?"INVALID REXT PROFILE":rextSubProfile.c_str() );
     3448#endif
     3449    }
     3450    else
     3451    {
     3452#if NH_MV
     3453      printf(" %s ", profileToString(m_profile) );
     3454#else
     3455      printf("Profile                           : %s\n", profileToString(m_profile) );
     3456#endif
     3457    }
     3458#if NH_MV   
     3459  }
     3460  printf("\n");
     3461#endif
     3462
     3463  printf("CU size / depth / total-depth     : %d / %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth, m_uiMaxTotalCUDepth );
     3464  printf("RQT trans. size (min / max)       : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize );
     3465  printf("Max RQT depth inter               : %d\n", m_uiQuadtreeTUMaxDepthInter);
     3466  printf("Max RQT depth intra               : %d\n", m_uiQuadtreeTUMaxDepthIntra);
     3467  printf("Min PCM size                      : %d\n", 1 << m_uiPCMLog2MinSize);
     3468  printf("Motion search range               : %d\n", m_iSearchRange );
     3469#if NH_MV
     3470  printf("Disp search range restriction     : %d\n", m_bUseDisparitySearchRangeRestriction );
     3471  printf("Vertical disp search range        : %d\n", m_iVerticalDisparitySearchRange );
     3472#endif
     3473#if NH_MV
    24663474  xPrintParaVector( "Intra period", m_iIntraPeriod );
    24673475#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 );
     3476  printf("Intra period                      : %d\n", m_iIntraPeriod );
     3477#endif
     3478  printf("Decoding refresh type             : %d\n", m_iDecodingRefreshType );
     3479#if !NH_MV
     3480  printf("QP                                : %5.2f\n", m_fQP );
     3481#endif
     3482  printf("Max dQP signaling depth           : %d\n", m_iMaxCuDQPDepth);
     3483
     3484  printf("Cb QP Offset                      : %d\n", m_cbQpOffset   );
     3485  printf("Cr QP Offset                      : %d\n", m_crQpOffset);
     3486  printf("QP adaptation                     : %d (range=%d)\n", m_bUseAdaptiveQP, (m_bUseAdaptiveQP ? m_iQPAdaptationRange : 0) );
     3487  printf("GOP size                          : %d\n", m_iGOPSize );
     3488  printf("Input bit depth                   : (Y:%d, C:%d)\n", m_inputBitDepth[CHANNEL_TYPE_LUMA], m_inputBitDepth[CHANNEL_TYPE_CHROMA] );
     3489  printf("MSB-extended bit depth            : (Y:%d, C:%d)\n", m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA], m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] );
     3490  printf("Internal bit depth                : (Y:%d, C:%d)\n", m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA] );
     3491  printf("PCM sample bit depth              : (Y:%d, C:%d)\n", m_bPCMInputBitDepthFlag ? m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA] : m_internalBitDepth[CHANNEL_TYPE_LUMA],
     3492                                                               m_bPCMInputBitDepthFlag ? m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] : m_internalBitDepth[CHANNEL_TYPE_CHROMA] );
     3493  printf("Intra reference smoothing         : %s\n", (m_enableIntraReferenceSmoothing          ? "Enabled" : "Disabled") );
     3494  printf("diff_cu_chroma_qp_offset_depth         : %d\n", m_diffCuChromaQpOffsetDepth);
     3495  printf("extended_precision_processing_flag     : %s\n", (m_extendedPrecisionProcessingFlag         ? "Enabled" : "Disabled") );
     3496  printf("implicit_rdpcm_enabled_flag            : %s\n", (m_rdpcmEnabledFlag[RDPCM_SIGNAL_IMPLICIT] ? "Enabled" : "Disabled") );
     3497  printf("explicit_rdpcm_enabled_flag            : %s\n", (m_rdpcmEnabledFlag[RDPCM_SIGNAL_EXPLICIT] ? "Enabled" : "Disabled") );
     3498  printf("transform_skip_rotation_enabled_flag   : %s\n", (m_transformSkipRotationEnabledFlag        ? "Enabled" : "Disabled") );
     3499  printf("transform_skip_context_enabled_flag    : %s\n", (m_transformSkipContextEnabledFlag         ? "Enabled" : "Disabled") );
     3500  printf("cross_component_prediction_enabled_flag: %s\n", (m_crossComponentPredictionEnabledFlag     ? (m_reconBasedCrossCPredictionEstimate ? "Enabled (reconstructed-residual-based estimate)" : "Enabled (encoder-side-residual-based estimate)") : "Disabled") );
     3501  printf("high_precision_offsets_enabled_flag    : %s\n", (m_highPrecisionOffsetsEnabledFlag         ? "Enabled" : "Disabled") );
     3502  printf("persistent_rice_adaptation_enabled_flag: %s\n", (m_persistentRiceAdaptationEnabledFlag     ? "Enabled" : "Disabled") );
     3503  printf("cabac_bypass_alignment_enabled_flag    : %s\n", (m_cabacBypassAlignmentEnabledFlag         ? "Enabled" : "Disabled") );
     3504#if NH_MV
     3505  Bool anySAO = false;
     3506  IntAry1d saoOffBitShiftL;
     3507  IntAry1d saoOffBitShiftC;
     3508
     3509  for (Int i = 0; i < m_numberOfLayers; i++)
     3510  {
     3511    if ( m_bUseSAO[i] )
     3512    {
     3513      anySAO = true;
     3514      saoOffBitShiftL.push_back( m_log2SaoOffsetScale[i][CHANNEL_TYPE_LUMA] );
     3515      saoOffBitShiftC.push_back( m_log2SaoOffsetScale[i][CHANNEL_TYPE_CHROMA] );
     3516    }
     3517    else
     3518    {
     3519      saoOffBitShiftL.push_back( -1 );
     3520      saoOffBitShiftC.push_back( -1 );
     3521    }
     3522  }
     3523  if (anySAO)
     3524  {
     3525    xPrintParaVector( "Sao Luma Offset bit shifts"  , saoOffBitShiftL );
     3526    xPrintParaVector( "Sao Chroma Offset bit shifts", saoOffBitShiftC );
     3527  }
     3528#else
     3529  if (m_bUseSAO)
     3530  {
     3531    printf("log2_sao_offset_scale_luma             : %d\n", m_log2SaoOffsetScale[CHANNEL_TYPE_LUMA]);
     3532    printf("log2_sao_offset_scale_chroma           : %d\n", m_log2SaoOffsetScale[CHANNEL_TYPE_CHROMA]);
     3533  }
     3534#endif
     3535
     3536  switch (m_costMode)
     3537  {
     3538    case COST_STANDARD_LOSSY:               printf("Cost function:                    : Lossy coding (default)\n"); break;
     3539    case COST_SEQUENCE_LEVEL_LOSSLESS:      printf("Cost function:                    : Sequence_level_lossless coding\n"); break;
     3540    case COST_LOSSLESS_CODING:              printf("Cost function:                    : Lossless coding with fixed QP of %d\n", LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP); break;
     3541    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;
     3542    default:                                printf("Cost function:                    : Unknown\n"); break;
     3543  }
     3544
     3545  printf("RateControl                       : %d\n", m_RCEnableRateControl );
     3546
    24843547  if(m_RCEnableRateControl)
    24853548  {
    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 );
     3549    printf("TargetBitrate                     : %d\n", m_RCTargetBitrate );
     3550    printf("KeepHierarchicalBit               : %d\n", m_RCKeepHierarchicalBit );
     3551    printf("LCULevelRC                        : %d\n", m_RCLCULevelRC );
     3552    printf("UseLCUSeparateModel               : %d\n", m_RCUseLCUSeparateModel );
     3553    printf("InitialQP                         : %d\n", m_RCInitialQP );
     3554    printf("ForceIntraQP                      : %d\n", m_RCForceIntraQP );
    24923555
    24933556#if KWU_RC_MADPRED_E0227
     
    25093572    }
    25103573#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 );
     3574
     3575  }
     3576
     3577  printf("Max Num Merge Candidates          : %d\n", m_maxNumMergeCand);
     3578#if NH_3D
     3579  printf("BaseViewCameraNumbers             : %s\n", m_pchBaseViewCameraNumbers );
     3580  printf("Coded Camera Param. Precision     : %d\n", m_iCodedCamParPrecision);
     3581#if NH_3D_VSO
     3582  printf("Force use of Lambda Scale         : %d\n", m_bForceLambdaScaleVSO );
    25183583
    25193584  if ( m_bUseVSO )
    25203585  {   
    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);   
     3586    printf("VSO Lambda Scale                  : %5.2f\n", m_dLambdaScaleVSO );
     3587    printf("VSO Mode                          : %d\n",    m_uiVSOMode       );
     3588    printf("VSO Config                        : %s\n",    m_pchVSOConfig    );
     3589    printf("VSO Negative Distortion           : %d\n",    m_bAllowNegDist ? 1 : 0);
     3590    printf("VSO LS Table                      : %d\n",    m_bVSOLSTable ? 1 : 0);
     3591    printf("VSO Estimated VSD                 : %d\n",    m_bUseEstimatedVSD ? 1 : 0);
     3592    printf("VSO Early Skip                    : %d\n",    m_bVSOEarlySkip ? 1 : 0);   
    25283593    if ( m_bUseWVSO )
    2529     printf("Dist. Weights (VSO/VSD/SAD)  : %d/%d/%d\n ", m_iVSOWeight, m_iVSDWeight, m_iDWeight );
     3594    {
     3595      printf("Dist. Weights (VSO/VSD/SAD)       : %d/%d/%d\n ", m_iVSOWeight, m_iVSDWeight, m_iDWeight );   
     3596    }   
    25303597  }
    25313598#endif //HHI_VSO
    25323599#endif //H_3D
    25333600  printf("\n");
    2534 #if H_MV
     3601#if NH_MV
    25353602  printf("TOOL CFG General: ");
    25363603#else
    25373604  printf("TOOL CFG: ");
    25383605#endif
    2539   printf("IBD:%d ", g_bitDepthY > m_inputBitDepthY || g_bitDepthC > m_inputBitDepthC);
     3606  printf("IBD:%d ", ((m_internalBitDepth[CHANNEL_TYPE_LUMA] > m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA]) || (m_internalBitDepth[CHANNEL_TYPE_CHROMA] > m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA])));
    25403607  printf("HAD:%d ", m_bUseHADME           );
    25413608  printf("RDQ:%d ", m_useRDOQ            );
     
    25523619  printf("TransformSkip:%d ",     m_useTransformSkip              );
    25533620  printf("TransformSkipFast:%d ", m_useTransformSkipFast       );
     3621  printf("TransformSkipLog2MaxSize:%d ", m_log2MaxTransformSkipBlockSize);
    25543622  printf("Slice: M=%d ", m_sliceMode);
    2555   if (m_sliceMode!=0)
     3623  if (m_sliceMode!=NO_SLICES)
    25563624  {
    25573625    printf("A=%d ", m_sliceArgument);
    25583626  }
    25593627  printf("SliceSegment: M=%d ",m_sliceSegmentMode);
    2560   if (m_sliceSegmentMode!=0)
     3628  if (m_sliceSegmentMode!=NO_SLICES)
    25613629  {
    25623630    printf("A=%d ", m_sliceSegmentArgument);
    25633631  }
    25643632  printf("CIP:%d ", m_bUseConstrainedIntraPred);
    2565 #if !H_MV
     3633#if !NH_MV
    25663634  printf("SAO:%d ", (m_bUseSAO)?(1):(0));
    25673635#endif
    25683636  printf("PCM:%d ", (m_usePCM && (1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0);
     3637
    25693638  if (m_TransquantBypassEnableFlag && m_CUTransquantBypassFlagForce)
    25703639  {
    2571     printf("TransQuantBypassEnabled: =1 ");
     3640    printf("TransQuantBypassEnabled: =1");
    25723641  }
    25733642  else
     
    25753644    printf("TransQuantBypassEnabled:%d ", (m_TransquantBypassEnableFlag)? 1:0 );
    25763645  }
     3646
    25773647  printf("WPP:%d ", (Int)m_useWeightedPred);
    25783648  printf("WPB:%d ", (Int)m_useWeightedBiPred);
    25793649  printf("PME:%d ", m_log2ParallelMergeLevel);
     3650  const Int iWaveFrontSubstreams = m_iWaveFrontSynchro ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1;
    25803651  printf(" WaveFrontSynchro:%d WaveFrontSubstreams:%d",
    2581           m_iWaveFrontSynchro, m_iWaveFrontSubstreams);
     3652          m_iWaveFrontSynchro, iWaveFrontSubstreams);
    25823653  printf(" ScalingList:%d ", m_useScalingListId );
    25833654  printf("TMVPMode:%d ", m_TMVPModeId     );
    25843655#if ADAPTIVE_QP_SELECTION
    2585   printf("AQpS:%d ", m_bUseAdaptQpSelect   );
     3656  printf("AQpS:%d", m_bUseAdaptQpSelect   );
    25863657#endif
    25873658
    25883659  printf(" SignBitHidingFlag:%d ", m_signHideFlag);
    2589   printf("RecalQP:%d ", m_recalculateQPAccordingToLambda ? 1 : 0 );
    2590 #if H_3D_VSO
    2591   printf("VSO:%d ", m_bUseVSO   );
     3660  printf("RecalQP:%d", m_recalculateQPAccordingToLambda ? 1 : 0 );
     3661#if NH_3D_VSO
     3662  printf(" VSO:%d ", m_bUseVSO   );
    25923663  printf("WVSO:%d ", m_bUseWVSO ); 
    25933664#endif
    2594 #if H_3D
     3665#if NH_3D
    25953666  printf( "QTL:%d "                  , m_bUseQTL);
    25963667  printf( "IlluCompEnable:%d "       , m_abUseIC);
     
    26173688#endif
    26183689
    2619   printf("\n\n"); 
     3690  printf("\n\n");
    26203691
    26213692  fflush(stdout);
     
    26253696{
    26263697  if (!bflag)
     3698  {
    26273699    return false;
    2628  
     3700  }
     3701
    26293702  printf("Error: %s\n",message);
    26303703  return true;
  • branches/HTM-14.1-update-dev0/source/App/TAppEncoder/TAppEncCfg.h

    r1196 r1200  
    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 *
     
    4444#include <sstream>
    4545#include <vector>
    46 #if H_3D
     46#if NH_3D
    4747#include "TAppCommon/TAppComCamPara.h"
    4848#include "TLibRenderer/TRenModel.h"
     
    6161protected:
    6262  // file I/O
    63 #if H_MV
     63#if NH_MV
    6464  std::vector<char*>     m_pchInputFileList;                  ///< source file names
    6565#else
     
    6767#endif
    6868  Char*     m_pchBitstreamFile;                               ///< output bitstream file
    69 #if H_MV
     69#if NH_MV
    7070  std::vector<char*>     m_pchReconFileList;                  ///< output reconstruction file names
    7171  Int                    m_numberOfLayers;                    ///< number of Layers to Encode
     
    7474  Char*     m_pchReconFile;                                   ///< output reconstruction file
    7575#endif
    76   #if H_MV
     76  #if NH_MV
    7777// VPS specification
    78   std::vector< std::vector<Int> > m_dimIds;                   ///< dimension ids ( pointers to m_viewId and m_depthFlag
     78  IntAry2d m_dimIds;                   ///< dimension ids ( pointers to m_viewId and m_depthFlag
    7979  std::vector<Int>       m_viewId;                            ///< view id
    8080  std::vector<Int>       m_viewOrderIndex;                    ///< view order index 
    8181  std::vector<Int>       m_auxId;                             ///< auxiliary id
    82 #if H_3D
     82#if NH_3D
    8383  std::vector<Int>       m_depthFlag;                         ///< depth flag
    8484#endif
     
    9191// layer sets   
    9292  Int                    m_vpsNumLayerSets;                   ///< Number of layer sets
    93   std::vector< std::vector<Int> > m_layerIdsInSets;           ///< LayerIds in vps of layer set
     93  IntAry2d m_layerIdsInSets;           ///< LayerIds in vps of layer set
    9494  Int                    m_numAddLayerSets;                    ///< Number of additional layer sets
    95   std::vector< std::vector<Int> > m_highestLayerIdxPlus1;      ///< HighestLayerIdxPlus1 for each additional layer set and each independent layer (value with index 0 will be ignored)
     95  IntAry2d m_highestLayerIdxPlus1;      ///< HighestLayerIdxPlus1 for each additional layer set and each independent layer (value with index 0 will be ignored)
    9696  Int                    m_defaultOutputLayerIdc;             ///< Specifies output layers of layer sets, 0: output all layers, 1: output highest layers, 2: specified by LayerIdsInDefOuputLayerSet
    9797  std::vector<Int>       m_outputLayerSetIdx;                 ///< Indices of layer sets used as additional output layer sets 
    98   std::vector< std::vector<Int> > m_layerIdsInAddOutputLayerSet; ///< LayerIds in vps of additional output layers
    99   std::vector< std::vector<Int> > m_layerIdsInDefOutputLayerSet; ///< Indices in vps of output layers in layer sets
    100   std::vector< std::vector< Int > > m_profileTierLevelIdx;      ///< Indices of of profile, per layer in layer set
     98  IntAry2d m_layerIdsInAddOutputLayerSet; ///< LayerIds in vps of additional output layers
     99  IntAry2d m_layerIdsInDefOutputLayerSet; ///< Indices in vps of output layers in layer sets
     100  IntAry2d              m_profileTierLevelIdx;      ///< Indices of of profile, per layer in layer set
    101101  std::vector<Bool>      m_altOutputLayerFlag;                ///< Alt output layer flag
    102102
    103103  // Dependencies
    104   std::vector< std::vector<Int> > m_directRefLayers;          ///< LayerIds of direct reference layers
    105   std::vector< std::vector<Int> > m_dependencyTypes;          ///< Dependency types of direct reference layers
     104  IntAry2d m_directRefLayers;          ///< LayerIds of direct reference layers
     105  IntAry2d m_dependencyTypes;          ///< Dependency types of direct reference layers
    106106
    107107  // VPS VUI
     
    119119  std::vector< std::vector<Int  > > m_avgPicRate;
    120120  Bool                              m_tilesNotInUseFlag;
    121   std::vector< Bool >               m_tilesInUseFlag;
    122   std::vector< Bool >               m_loopFilterNotAcrossTilesFlag;
     121  BoolAry1d               m_tilesInUseFlag;
     122  BoolAry1d               m_loopFilterNotAcrossTilesFlag;
    123123  Bool                              m_wppNotInUseFlag;
    124   std::vector< Bool >               m_wppInUseFlag;
     124  BoolAry1d               m_wppInUseFlag;
    125125
    126126  std::vector< std::vector<Bool > > m_tileBoundariesAlignedFlag; 
     
    133133
    134134
    135 #if H_3D_IC
    136   Bool   m_abUseIC;
    137   Bool   m_bUseLowLatencyICEnc;
     135#if NH_3D
     136  Bool      m_abUseIC;
     137  Bool      m_bUseLowLatencyICEnc;
    138138#endif
    139139
     
    142142  // source specification
    143143  Int       m_iFrameRate;                                     ///< source frame-rates (Hz)
    144   UInt      m_FrameSkip;                                      ///< number of skipped frames from the beginning
     144  UInt      m_FrameSkip;                                   ///< number of skipped frames from the beginning
    145145  Int       m_iSourceWidth;                                   ///< source width in pixel
    146146  Int       m_iSourceHeight;                                  ///< source height in pixel (when interlaced = field height)
    147  
     147
    148148  Int       m_iSourceHeightOrg;                               ///< original source height in pixel (when interlaced = frame height)
    149  
    150   bool      m_isField;                                        ///< enable field coding
    151   bool      m_isTopFieldFirst;
    152  
     149
     150  Bool      m_isField;                                        ///< enable field coding
     151  Bool      m_isTopFieldFirst;
     152  Bool      m_bEfficientFieldIRAPEnabled;                     ///< enable an efficient field IRAP structure.
     153  Bool      m_bHarmonizeGopFirstFieldCoupleEnabled;
     154
    153155  Int       m_conformanceWindowMode;
    154156  Int       m_confWinLeft;
     
    158160  Int       m_framesToBeEncoded;                              ///< number of encoded frames
    159161  Int       m_aiPad[2];                                       ///< number of padded pixels for width and height
    160  
     162  InputColourSpaceConversion m_inputColourSpaceConvert;       ///< colour space conversion to apply to input video
     163  Bool      m_snrInternalColourSpace;                       ///< if true, then no colour space conversion is applied for snr calculation, otherwise inverse of input is applied.
     164  Bool      m_outputInternalColourSpace;                    ///< if true, then no colour space conversion is applied for reconstructed video, otherwise inverse of input is applied.
     165  ChromaFormat m_InputChromaFormatIDC;
     166
     167  Bool      m_printMSEBasedSequencePSNR;
     168  Bool      m_printFrameMSE;
     169  Bool      m_printSequenceMSE;
     170  Bool      m_cabacZeroWordPaddingEnabled;
     171  Bool      m_bClipInputVideoToRec709Range;
     172  Bool      m_bClipOutputVideoToRec709Range;
     173
    161174  // profile/level
    162 #if H_MV
    163   std::vector< Profile::Name > m_profile;
     175#if NH_MV
     176  std::vector< Profile::Name > m_profiles;
    164177  std::vector< Level::Tier   > m_levelTier;
    165178  std::vector< Level::Name   > m_level;
     
    170183  Level::Name   m_level;
    171184#endif
    172 
     185  UInt          m_bitDepthConstraint;
     186  ChromaFormat  m_chromaFormatConstraint;
     187  Bool          m_intraConstraintFlag;
     188  Bool          m_onePictureOnlyConstraintFlag;
     189  Bool          m_lowerBitRateConstraintFlag;
    173190  Bool m_progressiveSourceFlag;
    174191  Bool m_interlacedSourceFlag;
    175192  Bool m_nonPackedConstraintFlag;
    176193  Bool m_frameOnlyConstraintFlag;
     194
    177195  // coding structure
    178 #if H_MV
     196#if NH_MV
    179197  std::vector<Int> m_iIntraPeriod;                            ///< period of I-slice (random access period)
    180198#else
     
    183201  Int       m_iDecodingRefreshType;                           ///< random access type
    184202  Int       m_iGOPSize;                                       ///< GOP size of hierarchical structure
    185 #if H_MV
     203#if NH_MV
    186204  Int       m_extraRPSsMvc[MAX_NUM_LAYERS];                       ///< extra RPSs added to handle CRA for each layer
    187205  std::vector< GOPEntry* >  m_GOPListMvc;                            ///< the coding structure entries from the config file for each layer
     
    194212  Int       m_maxDecPicBuffering[MAX_TLAYER];                 ///< total number of pictures in the decoded picture buffer
    195213  #endif
     214  Bool      m_crossComponentPredictionEnabledFlag;                          ///< flag enabling the use of cross-component prediction
     215  Bool      m_reconBasedCrossCPredictionEstimate;             ///< causes the alpha calculation in encoder search to be based on the decoded residual rather than the pre-transform encoder-side residual
     216#if NH_MV
     217  UInt      m_log2SaoOffsetScale[MAX_NUM_LAYERS][MAX_NUM_CHANNEL_TYPE];        ///< number of bits for the upward bit shift operation on the decoded SAO offsets
     218#else
     219  UInt      m_log2SaoOffsetScale[MAX_NUM_CHANNEL_TYPE];       ///< number of bits for the upward bit shift operation on the decoded SAO offsets
     220#endif
    196221  Bool      m_useTransformSkip;                               ///< flag for enabling intra transform skipping
    197222  Bool      m_useTransformSkipFast;                           ///< flag for enabling fast intra transform skipping
     223  UInt      m_log2MaxTransformSkipBlockSize;                  ///< transform-skip maximum size (minimum of 2)
     224  Bool      m_transformSkipRotationEnabledFlag;               ///< control flag for transform-skip/transquant-bypass residual rotation
     225  Bool      m_transformSkipContextEnabledFlag;                ///< control flag for transform-skip/transquant-bypass single significance map context
     226  Bool      m_rdpcmEnabledFlag[NUMBER_OF_RDPCM_SIGNALLING_MODES];///< control flags for residual DPCM
    198227  Bool      m_enableAMP;
     228  Bool      m_persistentRiceAdaptationEnabledFlag;            ///< control flag for Golomb-Rice parameter adaptation over each slice
     229  Bool      m_cabacBypassAlignmentEnabledFlag;
     230
    199231  // coding quality
    200 #if H_MV
     232#if NH_MV
    201233  std::vector<Double>  m_fQP;                                 ///< QP value of key-picture (floating point) for each layer
    202234  std::vector<Int>     m_iQP;                                 ///< QP value of key-picture (integer) for each layer
     
    206238#endif
    207239  Char*     m_pchdQPFile;                                     ///< QP offset for each slice (initialized from external file)
    208 #if H_MV
     240#if NH_MV
    209241  std::vector<Int*> m_aidQP;                                    ///< array of slice QP values for each layer
    210242#else
     
    214246  UInt      m_uiDeltaQpRD;                                    ///< dQP range for multi-pass slice QP optimization
    215247  Int       m_iMaxCuDQPDepth;                                 ///< Max. depth for a minimum CuDQPSize (0:default)
    216 
    217   Int       m_cbQpOffset;                                     ///< Chroma Cb QP Offset (0:default)
     248  Int       m_diffCuChromaQpOffsetDepth;                      ///< If negative, then do not apply chroma qp offsets.
     249
     250  Int       m_cbQpOffset;                                     ///< Chroma Cb QP Offset (0:default)
    218251  Int       m_crQpOffset;                                     ///< Chroma Cr QP Offset (0:default)
    219252
     
    221254  Bool      m_bUseAdaptQpSelect;
    222255#endif
     256  TComSEIMasteringDisplay m_masteringDisplay;
    223257
    224258  Bool      m_bUseAdaptiveQP;                                 ///< Flag for enabling QP adaptation based on a psycho-visual model
    225259  Int       m_iQPAdaptationRange;                             ///< dQP range by QP adaptation
    226  
    227 #if H_MV
     260
     261#if NH_MV
    228262  Int       m_maxTempLayerMvc[MAX_NUM_LAYER_IDS];             ///< Max temporal layer for each layer
    229263#else
     
    232266
    233267  // coding unit (CU) definition
     268  // TODO: Remove MaxCUWidth/MaxCUHeight and replace with MaxCUSize.
    234269  UInt      m_uiMaxCUWidth;                                   ///< max. CU width in pixel
    235270  UInt      m_uiMaxCUHeight;                                  ///< max. CU height in pixel
    236   UInt      m_uiMaxCUDepth;                                   ///< max. CU depth
    237  
     271  UInt      m_uiMaxCUDepth;                                   ///< max. CU depth (as specified by command line)
     272  UInt      m_uiMaxTotalCUDepth;                              ///< max. total CU depth - includes depth of transform-block structure
     273  UInt      m_uiLog2DiffMaxMinCodingBlockSize;                ///< difference between largest and smallest CU depth
     274
    238275  // transfom unit (TU) definition
    239276  UInt      m_uiQuadtreeTULog2MaxSize;
    240277  UInt      m_uiQuadtreeTULog2MinSize;
    241  
     278
    242279  UInt      m_uiQuadtreeTUMaxDepthInter;
    243280  UInt      m_uiQuadtreeTUMaxDepthIntra;
    244  
     281
    245282  // coding tools (bit-depth)
    246   Int       m_inputBitDepthY;                               ///< bit-depth of input file (luma component)
    247   Int       m_inputBitDepthC;                               ///< bit-depth of input file (chroma component)
    248   Int       m_outputBitDepthY;                              ///< bit-depth of output file (luma component)
    249   Int       m_outputBitDepthC;                              ///< bit-depth of output file (chroma component)
    250   Int       m_internalBitDepthY;                            ///< bit-depth codec operates at in luma (input/output files will be converted)
    251   Int       m_internalBitDepthC;                            ///< bit-depth codec operates at in chroma (input/output files will be converted)
     283  Int       m_inputBitDepth   [MAX_NUM_CHANNEL_TYPE];         ///< bit-depth of input file
     284  Int       m_outputBitDepth  [MAX_NUM_CHANNEL_TYPE];         ///< bit-depth of output file
     285  Int       m_MSBExtendedBitDepth[MAX_NUM_CHANNEL_TYPE];      ///< bit-depth of input samples after MSB extension
     286  Int       m_internalBitDepth[MAX_NUM_CHANNEL_TYPE];         ///< bit-depth codec operates at (input/output files will be converted)
     287  Bool      m_extendedPrecisionProcessingFlag;
     288  Bool      m_highPrecisionOffsetsEnabledFlag;
     289
     290  //coding tools (chroma format)
     291  ChromaFormat m_chromaFormatIDC;
    252292
    253293  // coding tools (PCM bit-depth)
     
    255295
    256296  // coding tool (SAO)
    257 #if H_MV
     297#if NH_MV
    258298  std::vector<Bool> m_bUseSAO;
    259299#else
    260   Bool      m_bUseSAO;
    261 #endif
     300  Bool      m_bUseSAO;
     301#endif
     302  Bool      m_bTestSAODisableAtPictureLevel;
     303  Double    m_saoEncodingRate;                                ///< When >0 SAO early picture termination is enabled for luma and chroma
     304  Double    m_saoEncodingRateChroma;                          ///< The SAO early picture termination rate to use for chroma (when m_SaoEncodingRate is >0). If <=0, use results for luma.
    262305  Int       m_maxNumOffsetsPerPic;                            ///< SAO maximun number of offset per picture
    263   Bool      m_saoLcuBoundary;                                 ///< SAO parameter estimation using non-deblocked pixels for LCU bottom and right boundary areas
     306  Bool      m_saoCtuBoundary;                                 ///< SAO parameter estimation using non-deblocked pixels for CTU bottom and right boundary areas
    264307  // coding tools (loop filter)
    265 #if H_MV
     308#if NH_MV
    266309  std::vector<Bool> m_bLoopFilterDisable;                     ///< flag for using deblocking filter for each layer
    267310#else
     
    271314  Int       m_loopFilterBetaOffsetDiv2;                     ///< beta offset for deblocking filter
    272315  Int       m_loopFilterTcOffsetDiv2;                       ///< tc offset for deblocking filter
    273   Bool      m_DeblockingFilterControlPresent;                 ///< deblocking filter control present flag in PPS
    274316  Bool      m_DeblockingFilterMetric;                         ///< blockiness metric in encoder
    275  
     317
    276318  // coding tools (PCM)
    277319  Bool      m_usePCM;                                         ///< flag for using IPCM
     
    279321  UInt      m_uiPCMLog2MinSize;                               ///< log2 of minimum PCM block size
    280322  Bool      m_bPCMFilterDisableFlag;                          ///< PCM filter disable flag
     323  Bool      m_enableIntraReferenceSmoothing;                  ///< flag for enabling(default)/disabling intra reference smoothing/filtering
    281324
    282325  // coding tools (encoder-only parameters)
     
    285328  Bool      m_useRDOQ;                                       ///< flag for using RD optimized quantization
    286329  Bool      m_useRDOQTS;                                     ///< flag for using RD optimized quantization for transform skip
    287   Int      m_rdPenalty;                                      ///< RD-penalty for 32x32 TU for intra in non-intra slices (0: no RD-penalty, 1: RD-penalty, 2: maximum RD-penalty)
     330#if T0196_SELECTIVE_RDOQ
     331  Bool      m_useSelectiveRDOQ;                               ///< flag for using selective RDOQ
     332#endif
     333  Int       m_rdPenalty;                                      ///< RD-penalty for 32x32 TU for intra in non-intra slices (0: no RD-penalty, 1: RD-penalty, 2: maximum RD-penalty)
     334  Bool      m_bDisableIntraPUsInInterSlices;                  ///< Flag for disabling intra predicted PUs in inter slices.
    288335  Int       m_iFastSearch;                                    ///< ME mode, 0 = full, 1 = diamond, 2 = PMVFAST
    289336  Int       m_iSearchRange;                                   ///< ME search range
    290337  Int       m_bipredSearchRange;                              ///< ME search range for bipred refinement
    291 #if H_MV
     338  Bool      m_bClipForBiPredMeEnabled;                        ///< Enables clipping for Bi-Pred ME.
     339  Bool      m_bFastMEAssumingSmootherMVEnabled;               ///< Enables fast ME assuming a smoother MV.
     340#if NH_MV
    292341  Bool      m_bUseDisparitySearchRangeRestriction;            ///< restrict vertical search range for inter-view prediction
    293342  Int       m_iVerticalDisparitySearchRange;                  ///< ME vertical search range for inter-view prediction
     
    295344  Bool      m_bUseFastEnc;                                    ///< flag for using fast encoder setting
    296345  Bool      m_bUseEarlyCU;                                    ///< flag for using Early CU setting
    297   Bool      m_useFastDecisionForMerge;                        ///< flag for using Fast Decision Merge RD-Cost 
     346  Bool      m_useFastDecisionForMerge;                        ///< flag for using Fast Decision Merge RD-Cost
    298347  Bool      m_bUseCbfFastMode;                              ///< flag for using Cbf Fast PU Mode Decision
    299348  Bool      m_useEarlySkipDetection;                         ///< flag for using Early SKIP Detection
    300   Int       m_sliceMode;                                     ///< 0: no slice limits, 1 : max number of CTBs per slice, 2: max number of bytes per slice, 
     349  Int       m_sliceMode;                                     ///< 0: no slice limits, 1 : max number of CTBs per slice, 2: max number of bytes per slice,
    301350                                                             ///< 3: max number of tiles per slice
    302351  Int       m_sliceArgument;                                 ///< argument according to selected slice mode
    303   Int       m_sliceSegmentMode;                              ///< 0: no slice segment limits, 1 : max number of CTBs per slice segment, 2: max number of bytes per slice segment, 
     352  Int       m_sliceSegmentMode;                              ///< 0: no slice segment limits, 1 : max number of CTBs per slice segment, 2: max number of bytes per slice segment,
    304353                                                             ///< 3: max number of tiles per slice segment
    305354  Int       m_sliceSegmentArgument;                          ///< argument according to selected slice segment mode
     
    313362  std::vector<Int> m_tileRowHeight;
    314363  Int       m_iWaveFrontSynchro; //< 0: no WPP. >= 1: WPP is enabled, the "Top right" from which inheritance occurs is this LCU offset in the line above the current.
    315   Int       m_iWaveFrontSubstreams; //< If iWaveFrontSynchro, this is the number of substreams per frame (dependent tiles) or per tile (independent tiles).
     364  Int       m_iWaveFrontFlush; //< enable(1)/disable(0) the CABAC flush at the end of each line of LCUs.
    316365
    317366  Bool      m_bUseConstrainedIntraPred;                       ///< flag for using constrained intra prediction
    318  
     367  Bool      m_bFastUDIUseMPMEnabled;
     368  Bool      m_bFastMEForGenBLowDelayEnabled;
     369  Bool      m_bUseBLambdaForNonKeyLowDelayPictures;
     370
    319371  Int       m_decodedPictureHashSEIEnabled;                    ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message
    320372  Int       m_recoveryPointSEIEnabled;
     
    322374  Int       m_pictureTimingSEIEnabled;
    323375  Bool      m_toneMappingInfoSEIEnabled;
     376  Bool      m_chromaSamplingFilterSEIenabled;
     377  Int       m_chromaSamplingHorFilterIdc;
     378  Int       m_chromaSamplingVerFilterIdc;
    324379  Int       m_toneMapId;
    325380  Bool      m_toneMapCancelFlag;
     
    327382  Int       m_toneMapCodedDataBitDepth;
    328383  Int       m_toneMapTargetBitDepth;
    329   Int       m_toneMapModelId; 
     384  Int       m_toneMapModelId;
    330385  Int       m_toneMapMinValue;
    331386  Int       m_toneMapMaxValue;
     
    337392  Int       m_exposureIndexIdc;
    338393  Int       m_exposureIndexValue;
    339   Int       m_exposureCompensationValueSignFlag;
     394  Bool      m_exposureCompensationValueSignFlag;
    340395  Int       m_exposureCompensationValueNumerator;
    341396  Int       m_exposureCompensationValueDenomIdc;
     
    353408  Int       m_framePackingSEIQuincunx;
    354409  Int       m_framePackingSEIInterpretation;
     410  Int       m_segmentedRectFramePackingSEIEnabled;
     411  Bool      m_segmentedRectFramePackingSEICancel;
     412  Int       m_segmentedRectFramePackingSEIType;
     413  Bool      m_segmentedRectFramePackingSEIPersistence;
    355414  Int       m_displayOrientationSEIAngle;
    356415  Int       m_temporalLevel0IndexSEIEnabled;
    357416  Int       m_gradualDecodingRefreshInfoEnabled;
     417  Int       m_noDisplaySEITLayer;
    358418  Int       m_decodingUnitInfoSEIEnabled;
    359419  Int       m_SOPDescriptionSEIEnabled;
    360420  Int       m_scalableNestingSEIEnabled;
     421  Bool      m_tmctsSEIEnabled;
     422  Bool      m_timeCodeSEIEnabled;
     423  Int       m_timeCodeSEINumTs;
     424  TComSEITimeSet m_timeSetArray[MAX_TIMECODE_SEI_SETS];
     425  Bool      m_kneeSEIEnabled;
     426  Int       m_kneeSEIId;
     427  Bool      m_kneeSEICancelFlag;
     428  Bool      m_kneeSEIPersistenceFlag;
     429  Int       m_kneeSEIInputDrange;
     430  Int       m_kneeSEIInputDispLuminance;
     431  Int       m_kneeSEIOutputDrange;
     432  Int       m_kneeSEIOutputDispLuminance;
     433  Int       m_kneeSEINumKneePointsMinus1;
     434  Int*      m_kneeSEIInputKneePoint;
     435  Int*      m_kneeSEIOutputKneePoint;
    361436  // weighted prediction
    362437  Bool      m_useWeightedPred;                    ///< Use of weighted prediction in P slices
    363438  Bool      m_useWeightedBiPred;                  ///< Use of bi-directional weighted prediction in B slices
    364  
     439
    365440  UInt      m_log2ParallelMergeLevel;                         ///< Parallel merge estimation region
    366441  UInt      m_maxNumMergeCand;                                ///< Max number of merge candidates
    367442
    368443  Int       m_TMVPModeId;
    369   Int       m_signHideFlag;
     444  Bool      m_signHideFlag;
    370445  Bool      m_RCEnableRateControl;                ///< enable rate control or not
    371446  Int       m_RCTargetBitrate;                    ///< target bitrate when rate control is enabled
    372447  Int       m_RCKeepHierarchicalBit;              ///< 0: equal bit allocation; 1: fixed ratio bit allocation; 2: adaptive ratio bit allocation
    373   Bool      m_RCLCULevelRC;                       ///< true: LCU level rate control; false: picture level rate control
    374   Bool      m_RCUseLCUSeparateModel;              ///< use separate R-lambda model at LCU level
     448  Bool      m_RCLCULevelRC;                       ///< true: LCU level rate control; false: picture level rate control NOTE: code-tidy - rename to m_RCCtuLevelRC
     449  Bool      m_RCUseLCUSeparateModel;              ///< use separate R-lambda model at LCU level                        NOTE: code-tidy - rename to m_RCUseCtuSeparateModel
    375450  Int       m_RCInitialQP;                        ///< inital QP for rate control
    376451  Bool      m_RCForceIntraQP;                     ///< force all intra picture to use initial QP or not
    377 
     452 
    378453#if KWU_RC_VIEWRC_E0227
    379454  vector<Int>     m_viewTargetBits;
     
    383458  UInt       m_depthMADPred;
    384459#endif
    385   Int       m_useScalingListId;                               ///< using quantization matrix
     460
     461ScalingListMode m_useScalingListId;                         ///< using quantization matrix
    386462  Char*     m_scalingListFile;                                ///< quantization matrix file name
    387463
    388464  Bool      m_TransquantBypassEnableFlag;                     ///< transquant_bypass_enable_flag setting in PPS.
    389465  Bool      m_CUTransquantBypassFlagForce;                    ///< if transquant_bypass_enable_flag, then, if true, all CU transquant bypass flags will be set to true.
     466  CostMode  m_costMode;                                       ///< Cost mode to use
    390467
    391468  Bool      m_recalculateQPAccordingToLambda;                 ///< recalculate QP value according to the lambda value
     
    427504  Int       m_log2MaxMvLengthHorizontal;                      ///< Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units
    428505  Int       m_log2MaxMvLengthVertical;                        ///< Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units
    429 #if H_MV
     506  std::string m_summaryOutFilename;                           ///< filename to use for producing summary output file.
     507  std::string m_summaryPicFilenameBase;                       ///< Base filename to use for producing summary picture output files. The actual filenames used will have I.txt, P.txt and B.txt appended.
     508  UInt        m_summaryVerboseness;                           ///< Specifies the level of the verboseness of the text output.
     509#if NH_MV
    430510  Bool              m_subBistreamPropSEIEnabled;
    431511  Int               m_sbPropNumAdditionalSubStreams;
     
    437517  Bool              m_outputVpsInfo;
    438518#endif
    439 #if H_3D
     519#if NH_3D
     520  // Output Format
     521  Bool      m_depth420OutputFlag;                             ///< Output depth layers in 4:2:0 format
    440522  // Camera parameters
    441523  Char*     m_pchCameraParameterFile;                         ///< camera parameter file
     
    443525  TAppComCamPara m_cCameraData;
    444526  Int       m_iCodedCamParPrecision;                          ///< precision for coding of camera parameters
    445 #if H_3D_VSO
     527#if NH_3D_VSO
    446528  Char*     m_pchVSOConfig;
    447   Bool      m_bUseVSO;                                    ///< flag for using View Synthesis Optimization
    448   Bool      m_bVSOLSTable;                                ///< Depth QP dependent Lagrange parameter optimization (m23714)
    449   Bool      m_bVSOEarlySkip;                              ///< Early skip of VSO computation (JCT3V-A0093 modification 4)
    450 
    451   //// Used for development by GT, might be removed later
    452   Double    m_dLambdaScaleVSO;                            ///< Scaling factor for Lambda in VSO mode
    453   Bool      m_bForceLambdaScaleVSO;                       ///< Use Lambda Scale for depth even if VSO is turned off
    454   Bool      m_bAllowNegDist;                              ///< Allow negative distortion in VSO
    455   UInt      m_uiVSOMode;                                  ///< Number of VSO Mode, 1 = , 2 = simple, org vs. ren, 3 = simple, ren vs. ren, 4 = full 
    456 
    457   // SAIT_VSO_EST_A0033
    458   Bool      m_bUseEstimatedVSD;                           ///< Flag for using model based VSD estimation instead of VSO for some encoder decisions (JCT3V-A0033 modification 3) 
    459 
    460   // LGE_WVSO_A0119
    461   Bool      m_bUseWVSO;                                    ///< flag for using View Synthesis Optimization 
     529  Bool      m_bUseVSO;                                        ///< flag for using View Synthesis Optimization
     530  Bool      m_bVSOLSTable;                                    ///< Depth QP dependent Lagrange parameter optimization (m23714)
     531  Bool      m_bVSOEarlySkip;                                  ///< Early skip of VSO computation (JCT3V-A0093 modification 4)
     532                                                             
     533  //// Used for development by GT, might be removed later     
     534  Double    m_dLambdaScaleVSO;                                ///< Scaling factor for Lambda in VSO mode
     535  Bool      m_bForceLambdaScaleVSO;                           ///< Use Lambda Scale for depth even if VSO is turned off
     536  Bool      m_bAllowNegDist;                                  ///< Allow negative distortion in VSO
     537  UInt      m_uiVSOMode;                                      ///< Number of VSO Mode, 1 = , 2 = simple, org vs. ren, 3 = simple, ren vs. ren, 4 = full 
     538                                                             
     539  // SAIT_VSO_EST_A0033                                       
     540  Bool      m_bUseEstimatedVSD;                               ///< Flag for using model based VSD estimation instead of VSO for some encoder decisions (JCT3V-A0033 modification 3) 
     541                                                             
     542  // LGE_WVSO_A0119                                           
     543  Bool      m_bUseWVSO;                                       ///< flag for using View Synthesis Optimization 
    462544  Int       m_iVSOWeight;
    463545  Int       m_iVSDWeight;
     
    467549  TRenModSetupStrParser       m_cRenModStrParser;
    468550#endif
    469 #if H_3D_DIM
    470   Bool      m_useDLT;                                        ///< flag for using DLT
    471 #endif
    472 #if H_3D_QTLPC
    473   Bool      m_bUseQTL;                                        ///< flag for using depth QuadTree Limitation
    474 #endif
    475 
    476   std::vector< Bool >    m_ivMvPredFlag;
    477   std::vector< Bool >    m_ivMvScalingFlag;
    478   Int                    m_log2SubPbSizeMinus3;
    479   Bool                   m_ivResPredFlag;
    480   Bool                   m_depthRefinementFlag;
    481   Bool                   m_viewSynthesisPredFlag;
    482   Bool                   m_depthBasedBlkPartFlag;
    483   Bool                   m_mpiFlag;
    484   Int                    m_log2MpiSubPbSizeMinus3;
    485   Bool                   m_intraContourFlag;
    486   Bool                   m_intraWedgeFlag;
    487   Bool                   m_intraSdcFlag;
    488   Bool                   m_qtPredFlag;
    489   Bool                   m_interSdcFlag;
    490   Bool                   m_depthIntraSkipFlag;
     551
     552  Bool       m_useDLT;                                        ///< flag for using DLT
     553  Bool       m_bUseQTL;                                        ///< flag for using depth QuadTree Limitation
     554  BoolAry1d  m_ivMvPredFlag;
     555  BoolAry1d  m_ivMvScalingFlag;
     556  Int        m_log2SubPbSizeMinus3;
     557  Bool       m_ivResPredFlag;
     558  Bool       m_depthRefinementFlag;
     559  Bool       m_viewSynthesisPredFlag;
     560  Bool       m_depthBasedBlkPartFlag;
     561  Bool       m_mpiFlag;
     562  Int        m_log2MpiSubPbSizeMinus3;
     563  Bool       m_intraContourFlag;
     564  Bool       m_intraWedgeFlag;
     565  Bool       m_intraSdcFlag;
     566  Bool       m_qtPredFlag;
     567  Bool       m_interSdcFlag;
     568  Bool       m_depthIntraSkipFlag;
    491569#endif
    492570  // internal member functions
    493   Void  xSetGlobal      ();                                   ///< set global variables
    494571  Void  xCheckParameter ();                                   ///< check validity of configuration values
    495572  Void  xPrintParameter ();                                   ///< print configuration values
    496573  Void  xPrintUsage     ();                                   ///< print usage
    497 #if H_MV
     574#if NH_MV
    498575
    499576  template<typename T>
     
    533610    }
    534611  }
     612
     613  template <typename T>
     614  Void xResizeVector(  std::vector<T> & rpcVector, UInt n )
     615  {
     616    for( Int layer = 0; rpcVector.size() < n; layer++ )
     617    {
     618      assert( rpcVector.size() > 0 );
     619      rpcVector.push_back( rpcVector[layer] );     
     620    }
     621
     622    for( ; rpcVector.size() > n; )
     623    {     
     624      rpcVector.pop_back( );     
     625    }
     626  }
     627
    535628
    536629  template <typename T>
     
    561654  Void xPrintVectorElem( Bool   elem ) { printf(" %d"   , ( elem ? 1 : 0 ));};
    562655#endif
    563 #if H_MV
     656#if NH_MV
    564657  Int   getGOPSize() { return m_iGOPSize; }
    565658#endif
     
    567660  TAppEncCfg();
    568661  virtual ~TAppEncCfg();
    569  
     662
    570663public:
    571664  Void  create    ();                                         ///< create option handling class
    572665  Void  destroy   ();                                         ///< destroy option handling class
    573666  Bool  parseCfg  ( Int argc, Char* argv[] );                 ///< parse configuration file to fill member variables
    574  
     667
    575668};// END CLASS DEFINITION TAppEncCfg
    576669
  • branches/HTM-14.1-update-dev0/source/App/TAppEncoder/TAppEncTop.cpp

    r1196 r1200  
    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 *
     
    4242#include <fcntl.h>
    4343#include <assert.h>
     44#include <iomanip>
    4445
    4546#include "TAppEncTop.h"
     
    5859{
    5960
    60 #if H_MV
     61#if NH_MV
    6162  m_vps = new TComVPS;
    6263#else
     
    6970TAppEncTop::~TAppEncTop()
    7071{
    71 #if H_MV
     72#if NH_MV
    7273  if (m_vps)
    7374  {
     
    8081Void TAppEncTop::xInitLibCfg()
    8182{
    82 #if H_MV
     83#if NH_MV
    8384  TComVPS& vps = (*m_vps);   
    8485#else
     
    8687#endif
    8788 
     89#if NH_3D
     90  vps.createCamPars(m_iNumberOfViews); 
     91#endif
     92
    8893#if H_3D
    89   vps.createCamPars(m_iNumberOfViews);
    9094  TComDLT& dlt = m_dlt;
    9195#endif
    9296
    93 #if H_MV
     97#if NH_MV
    9498  Int maxTempLayer = -1;
    9599  for (Int j = 0; j < m_numberOfLayers; j++)
     
    118122  }
    119123#else
    120   vps.setMaxTLayers                       ( m_maxTempLayer );
     124  vps.setMaxTLayers                                               ( m_maxTempLayer );
    121125  if (m_maxTempLayer == 1)
    122126  {
    123127    vps.setTemporalNestingFlag(true);
    124128  }
    125   vps.setMaxLayers                        ( 1 );
     129  vps.setMaxLayers                                                ( 1 );
    126130  for(Int i = 0; i < MAX_TLAYER; i++)
    127131  {
    128     vps.setNumReorderPics                 ( m_numReorderPics[i], i );
    129     vps.setMaxDecPicBuffering             ( m_maxDecPicBuffering[i], i );
    130   }
    131 #endif
    132 #if H_MV
     132    vps.setNumReorderPics                                         ( m_numReorderPics[i], i );
     133    vps.setMaxDecPicBuffering                                     ( m_maxDecPicBuffering[i], i );
     134  }
     135#endif
     136#if NH_MV
     137  xSetTimingInfo           ( vps );
     138  xSetHrdParameters        ( vps );
    133139  xSetLayerIds             ( vps );   
    134140  xSetDimensionIdAndLength ( vps );
     
    139145  xSetDpbSize              ( vps );
    140146  xSetVPSVUI               ( vps );
    141 #if H_3D
     147#if NH_3D
    142148  xSetCamPara              ( vps );
    143149  m_ivPicLists.setVPS      ( &vps );
     150#endif
     151#if H_3D
    144152  xDeriveDltArray          ( vps, dlt );
    145153#endif
     
    174182  }
    175183
    176 #if H_3D
     184#if NH_3D
    177185  // Set 3d tool parameters
    178 
    179186  for (Int d = 0; d < 2; d++)
    180187  { 
     
    201208  }
    202209#endif
     210
     211
     212  /// Create encoders and set profiles profiles
    203213  for(Int layerIdInVps = 0; layerIdInVps < m_numberOfLayers; layerIdInVps++)
    204214  {
     
    207217    m_acTVideoIOYuvInputFileList.push_back(new TVideoIOYuv);
    208218    m_acTVideoIOYuvReconFileList.push_back(new TVideoIOYuv);
    209     m_picYuvRec                 .push_back(new TComList<TComPicYuv*>) ;
     219#if NH_3D   
     220    Int profileIdc = -1;
     221    for (Int olsIdx = 0; olsIdx < vps.getNumOutputLayerSets(); olsIdx++ )
     222    {   
     223      Int lsIdx = vps.olsIdxToLsIdx( olsIdx );
     224      for(Int i = 0; i < vps.getNumLayersInIdList( lsIdx ); i++ )
     225      {
     226        if( vps.getLayerIdInNuh( layerIdInVps) == vps.getLayerSetLayerIdList(lsIdx, i) )
     227        {
     228          Int ptlIdx = vps.getProfileTierLevelIdx( olsIdx, i );
     229          if ( ptlIdx != -1 )
     230          {
     231            Int curProfileIdc = vps.getPTL(ptlIdx)->getGeneralPTL()->getProfileIdc();
     232            if (profileIdc == -1)   
     233            {
     234              profileIdc = curProfileIdc;
     235            }
     236            else
     237            {   
     238              if ( profileIdc != curProfileIdc )
     239              {             
     240                fprintf(stderr, "Error: ProfileIdc for layer with index %d in VPS not equal in all OLSs. \n", layerIdInVps );
     241                exit(EXIT_FAILURE);
     242              }
     243            }
     244          }
     245        }
     246      }
     247    }
     248
     249    if (profileIdc == -1 )
     250    {
     251      fprintf(stderr, "Error: No profile given for layer with index %d in VPS not equal in all OLS. \n", layerIdInVps );
     252      exit(EXIT_FAILURE);
     253    }
     254    m_acTEncTopList[ layerIdInVps ]->setProfileIdc( profileIdc );
     255#endif
     256  }
     257
     258
     259  for(Int layerIdInVps = 0; layerIdInVps < m_numberOfLayers; layerIdInVps++)
     260  {
     261    m_cListPicYuvRec            .push_back(new TComList<TComPicYuv*>) ;
    210262    m_ivPicLists.push_back( m_acTEncTopList[ layerIdInVps ]->getListPic()  );
    211263    TEncTop& m_cTEncTop = *m_acTEncTopList[ layerIdInVps ];  // It is not a member, but this name helps avoiding code duplication !!!
     
    216268    m_cTEncTop.setViewId                       ( vps.getViewId      (  layerId ) );
    217269    m_cTEncTop.setViewIndex                    ( vps.getViewIndex   (  layerId ) );
    218 #if H_3D
     270#if NH_3D
    219271    Bool isDepth = ( vps.getDepthId     ( layerId ) != 0 ) ;
    220272    m_cTEncTop.setIsDepth                      ( isDepth );
    221273    //====== Camera Parameters =========
    222274    m_cTEncTop.setCameraParameters             ( &m_cCameraData );     
    223 #if H_3D_VSO
     275#if NH_3D_VSO
    224276    //====== VSO =========
    225277    m_cTEncTop.setRenderModelParameters        ( &m_cRenModStrParser );
     
    249301    m_cTEncTop.setUseDLT                       ( isDepth ? m_useDLT   : false );
    250302    m_cTEncTop.setUseQTL                       ( isDepth ? m_bUseQTL  : false );
    251 
    252 
    253   m_cTEncTop.setSps3dExtension                 ( m_sps3dExtension );
     303    m_cTEncTop.setSps3dExtension               ( m_sps3dExtension );
    254304#endif // H_3D
    255305
    256306    m_cTEncTop.setIvPicLists                   ( &m_ivPicLists );
    257 #endif  // H_MV
     307#endif  // NH_MV
    258308  m_cTEncTop.setVPS(&vps);
    259309
     
    262312#endif
    263313
    264 #if H_MV
    265   m_cTEncTop.setProfile(m_profile[0]);
    266   m_cTEncTop.setLevel  (m_levelTier[0], m_level[0]);
    267 #else
    268   m_cTEncTop.setProfile(m_profile);
    269   m_cTEncTop.setLevel(m_levelTier, m_level);
    270 #endif
    271   m_cTEncTop.setProgressiveSourceFlag(m_progressiveSourceFlag);
    272   m_cTEncTop.setInterlacedSourceFlag(m_interlacedSourceFlag);
    273   m_cTEncTop.setNonPackedConstraintFlag(m_nonPackedConstraintFlag);
    274   m_cTEncTop.setFrameOnlyConstraintFlag(m_frameOnlyConstraintFlag);
    275  
    276   m_cTEncTop.setFrameRate                    ( m_iFrameRate );
    277   m_cTEncTop.setFrameSkip                    ( m_FrameSkip );
    278   m_cTEncTop.setSourceWidth                  ( m_iSourceWidth );
    279   m_cTEncTop.setSourceHeight                 ( m_iSourceHeight );
    280   m_cTEncTop.setConformanceWindow            ( m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom );
    281   m_cTEncTop.setFramesToBeEncoded            ( m_framesToBeEncoded );
    282  
     314#if NH_MV
     315  m_cTEncTop.setProfile                                           ( m_profiles[0]);
     316  m_cTEncTop.setLevel                                             ( m_levelTier[0], m_level[0] );
     317#else
     318  m_cTEncTop.setProfile                                           ( m_profile);
     319  m_cTEncTop.setLevel                                             ( m_levelTier, m_level);
     320#endif
     321  m_cTEncTop.setProgressiveSourceFlag                             ( m_progressiveSourceFlag);
     322  m_cTEncTop.setInterlacedSourceFlag                              ( m_interlacedSourceFlag);
     323  m_cTEncTop.setNonPackedConstraintFlag                           ( m_nonPackedConstraintFlag);
     324  m_cTEncTop.setFrameOnlyConstraintFlag                           ( m_frameOnlyConstraintFlag);
     325  m_cTEncTop.setBitDepthConstraintValue                           ( m_bitDepthConstraint );
     326  m_cTEncTop.setChromaFormatConstraintValue                       ( m_chromaFormatConstraint );
     327  m_cTEncTop.setIntraConstraintFlag                               ( m_intraConstraintFlag );
     328  m_cTEncTop.setOnePictureOnlyConstraintFlag                      ( m_onePictureOnlyConstraintFlag );
     329  m_cTEncTop.setLowerBitRateConstraintFlag                        ( m_lowerBitRateConstraintFlag );
     330
     331  m_cTEncTop.setPrintMSEBasedSequencePSNR                         ( m_printMSEBasedSequencePSNR);
     332  m_cTEncTop.setPrintFrameMSE                                     ( m_printFrameMSE);
     333  m_cTEncTop.setPrintSequenceMSE                                  ( m_printSequenceMSE);
     334  m_cTEncTop.setCabacZeroWordPaddingEnabled                       ( m_cabacZeroWordPaddingEnabled );
     335
     336  m_cTEncTop.setFrameRate                                         ( m_iFrameRate );
     337  m_cTEncTop.setFrameSkip                                         ( m_FrameSkip );
     338  m_cTEncTop.setSourceWidth                                       ( m_iSourceWidth );
     339  m_cTEncTop.setSourceHeight                                      ( m_iSourceHeight );
     340  m_cTEncTop.setConformanceWindow                                 ( m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom );
     341  m_cTEncTop.setFramesToBeEncoded                                 ( m_framesToBeEncoded );
     342
    283343  //====== Coding Structure ========
    284 #if H_MV
    285   m_cTEncTop.setIntraPeriod                  ( m_iIntraPeriod[ layerIdInVps ] );
    286 #else
    287   m_cTEncTop.setIntraPeriod                  ( m_iIntraPeriod );
    288 #endif
    289   m_cTEncTop.setDecodingRefreshType          ( m_iDecodingRefreshType );
    290   m_cTEncTop.setGOPSize                      ( m_iGOPSize );
    291 #if H_MV
    292 m_cTEncTop.setGopList                      ( m_GOPListMvc[layerIdInVps] );
    293   m_cTEncTop.setExtraRPSs                    ( m_extraRPSsMvc[layerIdInVps] );
     344#if NH_MV
     345  m_cTEncTop.setIntraPeriod                                       ( m_iIntraPeriod[ layerIdInVps ] );
     346#else
     347  m_cTEncTop.setIntraPeriod                                       ( m_iIntraPeriod );
     348#endif
     349  m_cTEncTop.setDecodingRefreshType                               ( m_iDecodingRefreshType );
     350  m_cTEncTop.setGOPSize                                           ( m_iGOPSize );
     351#if NH_MV
     352  m_cTEncTop.setGopList                                           ( m_GOPListMvc[layerIdInVps] );
     353  m_cTEncTop.setExtraRPSs                                         ( m_extraRPSsMvc[layerIdInVps] );
    294354  for(Int i = 0; i < MAX_TLAYER; i++)
    295355  {
    296     m_cTEncTop.setNumReorderPics             ( m_numReorderPicsMvc[layerIdInVps][i], i );
    297     m_cTEncTop.setMaxDecPicBuffering         ( m_maxDecPicBufferingMvc[layerIdInVps][i], i );
    298   }
    299 #else
    300   m_cTEncTop.setGopList                      ( m_GOPList );
    301   m_cTEncTop.setExtraRPSs                    ( m_extraRPSs );
     356    m_cTEncTop.setNumReorderPics                                  ( m_numReorderPicsMvc[layerIdInVps][i], i );
     357    m_cTEncTop.setMaxDecPicBuffering                              ( m_maxDecPicBufferingMvc[layerIdInVps][i], i );
     358  }
     359#else
     360  m_cTEncTop.setGopList                                           ( m_GOPList );
     361  m_cTEncTop.setExtraRPSs                                         ( m_extraRPSs );
    302362  for(Int i = 0; i < MAX_TLAYER; i++)
    303363  {
    304     m_cTEncTop.setNumReorderPics             ( m_numReorderPics[i], i );
    305     m_cTEncTop.setMaxDecPicBuffering         ( m_maxDecPicBuffering[i], i );
     364    m_cTEncTop.setNumReorderPics                                  ( m_numReorderPics[i], i );
     365    m_cTEncTop.setMaxDecPicBuffering                              ( m_maxDecPicBuffering[i], i );
    306366  }
    307367#endif
    308368  for( UInt uiLoop = 0; uiLoop < MAX_TLAYER; ++uiLoop )
    309369  {
    310     m_cTEncTop.setLambdaModifier( uiLoop, m_adLambdaModifier[ uiLoop ] );
    311   }
    312 #if H_MV
    313   m_cTEncTop.setQP                           ( m_iQP[layerIdInVps] );
    314 #else
    315   m_cTEncTop.setQP                           ( m_iQP );
    316 #endif
    317 
    318   m_cTEncTop.setPad                          ( m_aiPad );
    319 
    320 #if H_MV
    321   m_cTEncTop.setMaxTempLayer                 ( m_maxTempLayerMvc[layerIdInVps] );
    322 #else
    323   m_cTEncTop.setMaxTempLayer                 ( m_maxTempLayer );
     370    m_cTEncTop.setLambdaModifier                                  ( uiLoop, m_adLambdaModifier[ uiLoop ] );
     371  }
     372#if NH_MV
     373  m_cTEncTop.setQP                                                ( m_iQP[layerIdInVps] );
     374#else
     375  m_cTEncTop.setQP                                                ( m_iQP );
     376#endif
     377
     378  m_cTEncTop.setPad                                               ( m_aiPad );
     379
     380#if NH_MV
     381  m_cTEncTop.setMaxTempLayer                                      ( m_maxTempLayerMvc[layerIdInVps] );
     382#else
     383  m_cTEncTop.setMaxTempLayer                                      ( m_maxTempLayer );
    324384#endif
    325385  m_cTEncTop.setUseAMP( m_enableAMP );
    326  
     386
    327387  //===== Slice ========
    328  
     388
    329389  //====== Loop/Deblock Filter ========
    330 #if H_MV
    331   m_cTEncTop.setLoopFilterDisable            ( m_bLoopFilterDisable[layerIdInVps]);
    332 #else
    333   m_cTEncTop.setLoopFilterDisable            ( m_bLoopFilterDisable       );
    334 #endif
    335   m_cTEncTop.setLoopFilterOffsetInPPS        ( m_loopFilterOffsetInPPS );
    336   m_cTEncTop.setLoopFilterBetaOffset         ( m_loopFilterBetaOffsetDiv2  );
    337   m_cTEncTop.setLoopFilterTcOffset           ( m_loopFilterTcOffsetDiv2    );
    338   m_cTEncTop.setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent);
    339   m_cTEncTop.setDeblockingFilterMetric       ( m_DeblockingFilterMetric );
     390#if NH_MV
     391  m_cTEncTop.setLoopFilterDisable                                 ( m_bLoopFilterDisable[layerIdInVps]);
     392#else
     393  m_cTEncTop.setLoopFilterDisable                                 ( m_bLoopFilterDisable       );
     394#endif
     395  m_cTEncTop.setLoopFilterOffsetInPPS                             ( m_loopFilterOffsetInPPS );
     396  m_cTEncTop.setLoopFilterBetaOffset                              ( m_loopFilterBetaOffsetDiv2  );
     397  m_cTEncTop.setLoopFilterTcOffset                                ( m_loopFilterTcOffsetDiv2    );
     398  m_cTEncTop.setDeblockingFilterMetric                            ( m_DeblockingFilterMetric );
    340399
    341400  //====== Motion search ========
    342   m_cTEncTop.setFastSearch                   ( m_iFastSearch  );
    343   m_cTEncTop.setSearchRange                  ( m_iSearchRange );
    344   m_cTEncTop.setBipredSearchRange            ( m_bipredSearchRange );
    345 
    346 #if H_MV
    347   m_cTEncTop.setUseDisparitySearchRangeRestriction ( m_bUseDisparitySearchRangeRestriction );
    348   m_cTEncTop.setVerticalDisparitySearchRange ( m_iVerticalDisparitySearchRange );
     401  m_cTEncTop.setDisableIntraPUsInInterSlices                      ( m_bDisableIntraPUsInInterSlices );
     402  m_cTEncTop.setFastSearch                                        ( m_iFastSearch  );
     403  m_cTEncTop.setSearchRange                                       ( m_iSearchRange );
     404  m_cTEncTop.setBipredSearchRange                                 ( m_bipredSearchRange );
     405  m_cTEncTop.setClipForBiPredMeEnabled                            ( m_bClipForBiPredMeEnabled );
     406  m_cTEncTop.setFastMEAssumingSmootherMVEnabled                   ( m_bFastMEAssumingSmootherMVEnabled );
     407
     408#if NH_MV
     409  m_cTEncTop.setUseDisparitySearchRangeRestriction                ( m_bUseDisparitySearchRangeRestriction );
     410  m_cTEncTop.setVerticalDisparitySearchRange                      ( m_iVerticalDisparitySearchRange );
    349411#endif
    350412  //====== Quality control ========
    351   m_cTEncTop.setMaxDeltaQP                   ( m_iMaxDeltaQP  );
    352   m_cTEncTop.setMaxCuDQPDepth                ( m_iMaxCuDQPDepth  );
    353 
    354   m_cTEncTop.setChromaCbQpOffset               ( m_cbQpOffset     );
    355   m_cTEncTop.setChromaCrQpOffset            ( m_crQpOffset  );
     413  m_cTEncTop.setMaxDeltaQP                                        ( m_iMaxDeltaQP  );
     414  m_cTEncTop.setMaxCuDQPDepth                                     ( m_iMaxCuDQPDepth  );
     415  m_cTEncTop.setDiffCuChromaQpOffsetDepth                         ( m_diffCuChromaQpOffsetDepth );
     416  m_cTEncTop.setChromaCbQpOffset                                  ( m_cbQpOffset     );
     417  m_cTEncTop.setChromaCrQpOffset                                  ( m_crQpOffset  );
     418
     419#if NH_3D
     420  m_cTEncTop.setChromaFormatIdc                                   ( isDepth ? CHROMA_400 : m_chromaFormatIDC );
     421#else
     422  m_cTEncTop.setChromaFormatIdc                                   ( m_chromaFormatIDC  );
     423#endif
    356424
    357425#if ADAPTIVE_QP_SELECTION
    358   m_cTEncTop.setUseAdaptQpSelect             ( m_bUseAdaptQpSelect   );
    359 #endif
    360 
    361   m_cTEncTop.setUseAdaptiveQP                ( m_bUseAdaptiveQP  );
    362   m_cTEncTop.setQPAdaptationRange            ( m_iQPAdaptationRange );
    363  
     426  m_cTEncTop.setUseAdaptQpSelect                                  ( m_bUseAdaptQpSelect   );
     427#endif
     428
     429  m_cTEncTop.setUseAdaptiveQP                                     ( m_bUseAdaptiveQP  );
     430  m_cTEncTop.setQPAdaptationRange                                 ( m_iQPAdaptationRange );
     431  m_cTEncTop.setExtendedPrecisionProcessingFlag                   ( m_extendedPrecisionProcessingFlag );
     432  m_cTEncTop.setHighPrecisionOffsetsEnabledFlag                   ( m_highPrecisionOffsetsEnabledFlag );
    364433  //====== Tool list ========
    365   m_cTEncTop.setDeltaQpRD                    ( m_uiDeltaQpRD  );
    366   m_cTEncTop.setUseASR                       ( m_bUseASR      );
    367   m_cTEncTop.setUseHADME                     ( m_bUseHADME    );
    368 #if H_MV
    369   m_cTEncTop.setdQPs                         ( m_aidQP[layerIdInVps]   );
    370 #else
    371   m_cTEncTop.setdQPs                         ( m_aidQP        );
    372 #endif
    373   m_cTEncTop.setUseRDOQ                      ( m_useRDOQ     );
    374   m_cTEncTop.setUseRDOQTS                    ( m_useRDOQTS   );
    375   m_cTEncTop.setRDpenalty                 ( m_rdPenalty );
    376   m_cTEncTop.setQuadtreeTULog2MaxSize        ( m_uiQuadtreeTULog2MaxSize );
    377   m_cTEncTop.setQuadtreeTULog2MinSize        ( m_uiQuadtreeTULog2MinSize );
    378   m_cTEncTop.setQuadtreeTUMaxDepthInter      ( m_uiQuadtreeTUMaxDepthInter );
    379   m_cTEncTop.setQuadtreeTUMaxDepthIntra      ( m_uiQuadtreeTUMaxDepthIntra );
    380   m_cTEncTop.setUseFastEnc                   ( m_bUseFastEnc  );
    381   m_cTEncTop.setUseEarlyCU                   ( m_bUseEarlyCU  );
    382   m_cTEncTop.setUseFastDecisionForMerge      ( m_useFastDecisionForMerge  );
    383   m_cTEncTop.setUseCbfFastMode            ( m_bUseCbfFastMode  );
    384   m_cTEncTop.setUseEarlySkipDetection            ( m_useEarlySkipDetection );
    385 
    386   m_cTEncTop.setUseTransformSkip             ( m_useTransformSkip      );
    387   m_cTEncTop.setUseTransformSkipFast         ( m_useTransformSkipFast  );
    388   m_cTEncTop.setUseConstrainedIntraPred      ( m_bUseConstrainedIntraPred );
    389   m_cTEncTop.setPCMLog2MinSize          ( m_uiPCMLog2MinSize);
    390   m_cTEncTop.setUsePCM                       ( m_usePCM );
    391   m_cTEncTop.setPCMLog2MaxSize               ( m_pcmLog2MaxSize);
    392   m_cTEncTop.setMaxNumMergeCand              ( m_maxNumMergeCand );
    393  
     434  m_cTEncTop.setDeltaQpRD                                         ( m_uiDeltaQpRD  );
     435  m_cTEncTop.setUseASR                                            ( m_bUseASR      );
     436  m_cTEncTop.setUseHADME                                          ( m_bUseHADME    );
     437#if NH_MV
     438  m_cTEncTop.setdQPs                                              ( m_aidQP[layerIdInVps]   );
     439#else
     440  m_cTEncTop.setdQPs                                              ( m_aidQP        );
     441#endif
     442  m_cTEncTop.setUseRDOQ                                           ( m_useRDOQ     );
     443  m_cTEncTop.setUseRDOQTS                                         ( m_useRDOQTS   );
     444#if T0196_SELECTIVE_RDOQ
     445  m_cTEncTop.setUseSelectiveRDOQ                                  ( m_useSelectiveRDOQ );
     446#endif
     447  m_cTEncTop.setRDpenalty                                         ( m_rdPenalty );
     448  m_cTEncTop.setMaxCUWidth                                        ( m_uiMaxCUWidth );
     449  m_cTEncTop.setMaxCUHeight                                       ( m_uiMaxCUHeight );
     450  m_cTEncTop.setMaxTotalCUDepth                                   ( m_uiMaxTotalCUDepth );
     451  m_cTEncTop.setLog2DiffMaxMinCodingBlockSize                     ( m_uiLog2DiffMaxMinCodingBlockSize );
     452  m_cTEncTop.setQuadtreeTULog2MaxSize                             ( m_uiQuadtreeTULog2MaxSize );
     453  m_cTEncTop.setQuadtreeTULog2MinSize                             ( m_uiQuadtreeTULog2MinSize );
     454  m_cTEncTop.setQuadtreeTUMaxDepthInter                           ( m_uiQuadtreeTUMaxDepthInter );
     455  m_cTEncTop.setQuadtreeTUMaxDepthIntra                           ( m_uiQuadtreeTUMaxDepthIntra );
     456  m_cTEncTop.setUseFastEnc                                        ( m_bUseFastEnc  );
     457  m_cTEncTop.setUseEarlyCU                                        ( m_bUseEarlyCU  );
     458  m_cTEncTop.setUseFastDecisionForMerge                           ( m_useFastDecisionForMerge  );
     459  m_cTEncTop.setUseCbfFastMode                                    ( m_bUseCbfFastMode  );
     460  m_cTEncTop.setUseEarlySkipDetection                             ( m_useEarlySkipDetection );
     461  m_cTEncTop.setCrossComponentPredictionEnabledFlag               ( m_crossComponentPredictionEnabledFlag );
     462  m_cTEncTop.setUseReconBasedCrossCPredictionEstimate             ( m_reconBasedCrossCPredictionEstimate );
     463#if NH_MV
     464  m_cTEncTop.setLog2SaoOffsetScale                                ( CHANNEL_TYPE_LUMA  , m_log2SaoOffsetScale[layerIdInVps][CHANNEL_TYPE_LUMA]   );
     465  m_cTEncTop.setLog2SaoOffsetScale                                ( CHANNEL_TYPE_CHROMA, m_log2SaoOffsetScale[layerIdInVps][CHANNEL_TYPE_CHROMA] );
     466#else
     467  m_cTEncTop.setLog2SaoOffsetScale                                ( CHANNEL_TYPE_LUMA  , m_log2SaoOffsetScale[CHANNEL_TYPE_LUMA]   );
     468  m_cTEncTop.setLog2SaoOffsetScale                                ( CHANNEL_TYPE_CHROMA, m_log2SaoOffsetScale[CHANNEL_TYPE_CHROMA] );
     469#endif
     470  m_cTEncTop.setUseTransformSkip                                  ( m_useTransformSkip      );
     471  m_cTEncTop.setUseTransformSkipFast                              ( m_useTransformSkipFast  );
     472  m_cTEncTop.setTransformSkipRotationEnabledFlag                  ( m_transformSkipRotationEnabledFlag );
     473  m_cTEncTop.setTransformSkipContextEnabledFlag                   ( m_transformSkipContextEnabledFlag   );
     474  m_cTEncTop.setPersistentRiceAdaptationEnabledFlag               ( m_persistentRiceAdaptationEnabledFlag );
     475  m_cTEncTop.setCabacBypassAlignmentEnabledFlag                   ( m_cabacBypassAlignmentEnabledFlag );
     476  m_cTEncTop.setLog2MaxTransformSkipBlockSize                     ( m_log2MaxTransformSkipBlockSize  );
     477  for (UInt signallingModeIndex = 0; signallingModeIndex < NUMBER_OF_RDPCM_SIGNALLING_MODES; signallingModeIndex++)
     478  {
     479    m_cTEncTop.setRdpcmEnabledFlag                                ( RDPCMSignallingMode(signallingModeIndex), m_rdpcmEnabledFlag[signallingModeIndex]);
     480  }
     481  m_cTEncTop.setUseConstrainedIntraPred                           ( m_bUseConstrainedIntraPred );
     482  m_cTEncTop.setFastUDIUseMPMEnabled                              ( m_bFastUDIUseMPMEnabled );
     483  m_cTEncTop.setFastMEForGenBLowDelayEnabled                      ( m_bFastMEForGenBLowDelayEnabled );
     484  m_cTEncTop.setUseBLambdaForNonKeyLowDelayPictures               ( m_bUseBLambdaForNonKeyLowDelayPictures );
     485  m_cTEncTop.setPCMLog2MinSize                                    ( m_uiPCMLog2MinSize);
     486  m_cTEncTop.setUsePCM                                            ( m_usePCM );
     487
     488  // set internal bit-depth and constants
     489  for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
     490  {
     491    m_cTEncTop.setBitDepth((ChannelType)channelType, m_internalBitDepth[channelType]);
     492    m_cTEncTop.setPCMBitDepth((ChannelType)channelType, m_bPCMInputBitDepthFlag ? m_MSBExtendedBitDepth[channelType] : m_internalBitDepth[channelType]);
     493  }
     494
     495  m_cTEncTop.setPCMLog2MaxSize                                    ( m_pcmLog2MaxSize);
     496  m_cTEncTop.setMaxNumMergeCand                                   ( m_maxNumMergeCand );
     497
    394498
    395499  //====== Weighted Prediction ========
    396   m_cTEncTop.setUseWP                   ( m_useWeightedPred      );
    397   m_cTEncTop.setWPBiPred                ( m_useWeightedBiPred   );
     500  m_cTEncTop.setUseWP                                             ( m_useWeightedPred      );
     501  m_cTEncTop.setWPBiPred                                          ( m_useWeightedBiPred   );
    398502  //====== Parallel Merge Estimation ========
    399   m_cTEncTop.setLog2ParallelMergeLevelMinus2 ( m_log2ParallelMergeLevel - 2 );
     503  m_cTEncTop.setLog2ParallelMergeLevelMinus2                      ( m_log2ParallelMergeLevel - 2 );
    400504
    401505  //====== Slice ========
    402   m_cTEncTop.setSliceMode               ( m_sliceMode                );
    403   m_cTEncTop.setSliceArgument           ( m_sliceArgument            );
     506  m_cTEncTop.setSliceMode                                         ( (SliceConstraint) m_sliceMode );
     507  m_cTEncTop.setSliceArgument                                     ( m_sliceArgument            );
    404508
    405509  //====== Dependent Slice ========
    406   m_cTEncTop.setSliceSegmentMode        ( m_sliceSegmentMode         );
    407   m_cTEncTop.setSliceSegmentArgument    ( m_sliceSegmentArgument     );
    408   Int iNumPartInCU = 1<<(m_uiMaxCUDepth<<1);
    409   if(m_sliceSegmentMode==FIXED_NUMBER_OF_LCU)
    410   {
    411     m_cTEncTop.setSliceSegmentArgument ( m_sliceSegmentArgument * iNumPartInCU );
    412   }
    413   if(m_sliceMode==FIXED_NUMBER_OF_LCU)
    414   {
    415     m_cTEncTop.setSliceArgument ( m_sliceArgument * iNumPartInCU );
    416   }
    417   if(m_sliceMode==FIXED_NUMBER_OF_TILES)
    418   {
    419     m_cTEncTop.setSliceArgument ( m_sliceArgument );
    420   }
    421  
    422   if(m_sliceMode == 0 )
     510  m_cTEncTop.setSliceSegmentMode                                  (  (SliceConstraint) m_sliceSegmentMode );
     511  m_cTEncTop.setSliceSegmentArgument                              ( m_sliceSegmentArgument     );
     512
     513  if(m_sliceMode == NO_SLICES )
    423514  {
    424515    m_bLFCrossSliceBoundaryFlag = true;
    425516  }
    426   m_cTEncTop.setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag );
    427 #if H_MV
     517  m_cTEncTop.setLFCrossSliceBoundaryFlag                          ( m_bLFCrossSliceBoundaryFlag );
     518#if NH_MV
    428519  m_cTEncTop.setUseSAO ( m_bUseSAO[layerIdInVps] );
    429520#else
    430   m_cTEncTop.setUseSAO ( m_bUseSAO );
    431 #endif
    432   m_cTEncTop.setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic);
    433 
    434   m_cTEncTop.setSaoLcuBoundary (m_saoLcuBoundary);
    435   m_cTEncTop.setPCMInputBitDepthFlag  ( m_bPCMInputBitDepthFlag);
    436   m_cTEncTop.setPCMFilterDisableFlag  ( m_bPCMFilterDisableFlag);
    437 
    438   m_cTEncTop.setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled);
    439   m_cTEncTop.setRecoveryPointSEIEnabled( m_recoveryPointSEIEnabled );
    440   m_cTEncTop.setBufferingPeriodSEIEnabled( m_bufferingPeriodSEIEnabled );
    441   m_cTEncTop.setPictureTimingSEIEnabled( m_pictureTimingSEIEnabled );
    442   m_cTEncTop.setToneMappingInfoSEIEnabled                 ( m_toneMappingInfoSEIEnabled );
    443   m_cTEncTop.setTMISEIToneMapId                           ( m_toneMapId );
    444   m_cTEncTop.setTMISEIToneMapCancelFlag                   ( m_toneMapCancelFlag );
    445   m_cTEncTop.setTMISEIToneMapPersistenceFlag              ( m_toneMapPersistenceFlag );
    446   m_cTEncTop.setTMISEICodedDataBitDepth                   ( m_toneMapCodedDataBitDepth );
    447   m_cTEncTop.setTMISEITargetBitDepth                      ( m_toneMapTargetBitDepth );
    448   m_cTEncTop.setTMISEIModelID                             ( m_toneMapModelId );
    449   m_cTEncTop.setTMISEIMinValue                            ( m_toneMapMinValue );
    450   m_cTEncTop.setTMISEIMaxValue                            ( m_toneMapMaxValue );
    451   m_cTEncTop.setTMISEISigmoidMidpoint                     ( m_sigmoidMidpoint );
    452   m_cTEncTop.setTMISEISigmoidWidth                        ( m_sigmoidWidth );
    453   m_cTEncTop.setTMISEIStartOfCodedInterva                 ( m_startOfCodedInterval );
    454   m_cTEncTop.setTMISEINumPivots                           ( m_numPivots );
    455   m_cTEncTop.setTMISEICodedPivotValue                     ( m_codedPivotValue );
    456   m_cTEncTop.setTMISEITargetPivotValue                    ( m_targetPivotValue );
    457   m_cTEncTop.setTMISEICameraIsoSpeedIdc                   ( m_cameraIsoSpeedIdc );
    458   m_cTEncTop.setTMISEICameraIsoSpeedValue                 ( m_cameraIsoSpeedValue );
    459   m_cTEncTop.setTMISEIExposureIndexIdc                    ( m_exposureIndexIdc );
    460   m_cTEncTop.setTMISEIExposureIndexValue                  ( m_exposureIndexValue );
    461   m_cTEncTop.setTMISEIExposureCompensationValueSignFlag   ( m_exposureCompensationValueSignFlag );
    462   m_cTEncTop.setTMISEIExposureCompensationValueNumerator  ( m_exposureCompensationValueNumerator );
    463   m_cTEncTop.setTMISEIExposureCompensationValueDenomIdc   ( m_exposureCompensationValueDenomIdc );
    464   m_cTEncTop.setTMISEIRefScreenLuminanceWhite             ( m_refScreenLuminanceWhite );
    465   m_cTEncTop.setTMISEIExtendedRangeWhiteLevel             ( m_extendedRangeWhiteLevel );
    466   m_cTEncTop.setTMISEINominalBlackLevelLumaCodeValue      ( m_nominalBlackLevelLumaCodeValue );
    467   m_cTEncTop.setTMISEINominalWhiteLevelLumaCodeValue      ( m_nominalWhiteLevelLumaCodeValue );
    468   m_cTEncTop.setTMISEIExtendedWhiteLevelLumaCodeValue     ( m_extendedWhiteLevelLumaCodeValue );
    469   m_cTEncTop.setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled );
    470   m_cTEncTop.setFramePackingArrangementSEIType( m_framePackingSEIType );
    471   m_cTEncTop.setFramePackingArrangementSEIId( m_framePackingSEIId );
    472   m_cTEncTop.setFramePackingArrangementSEIQuincunx( m_framePackingSEIQuincunx );
    473   m_cTEncTop.setFramePackingArrangementSEIInterpretation( m_framePackingSEIInterpretation );
    474   m_cTEncTop.setDisplayOrientationSEIAngle( m_displayOrientationSEIAngle );
    475   m_cTEncTop.setTemporalLevel0IndexSEIEnabled( m_temporalLevel0IndexSEIEnabled );
    476   m_cTEncTop.setGradualDecodingRefreshInfoEnabled( m_gradualDecodingRefreshInfoEnabled );
    477   m_cTEncTop.setDecodingUnitInfoSEIEnabled( m_decodingUnitInfoSEIEnabled );
    478   m_cTEncTop.setSOPDescriptionSEIEnabled( m_SOPDescriptionSEIEnabled );
    479   m_cTEncTop.setScalableNestingSEIEnabled( m_scalableNestingSEIEnabled );
    480 #if H_MV
    481   m_cTEncTop.setSubBitstreamPropSEIEnabled( m_subBistreamPropSEIEnabled );
    482   if( m_subBistreamPropSEIEnabled )
    483   {
    484     m_cTEncTop.setNumAdditionalSubStreams ( m_sbPropNumAdditionalSubStreams );
    485     m_cTEncTop.setSubBitstreamMode        ( m_sbPropSubBitstreamMode );
    486     m_cTEncTop.setOutputLayerSetIdxToVps  ( m_sbPropOutputLayerSetIdxToVps );
    487     m_cTEncTop.setHighestSublayerId       ( m_sbPropHighestSublayerId );
    488     m_cTEncTop.setAvgBitRate              ( m_sbPropAvgBitRate );
    489     m_cTEncTop.setMaxBitRate              ( m_sbPropMaxBitRate );
    490   }
    491 #endif
    492   m_cTEncTop.setTileUniformSpacingFlag     ( m_tileUniformSpacingFlag );
    493   m_cTEncTop.setNumColumnsMinus1           ( m_numTileColumnsMinus1 );
    494   m_cTEncTop.setNumRowsMinus1              ( m_numTileRowsMinus1 );
     521  m_cTEncTop.setUseSAO                                            ( m_bUseSAO );
     522#endif
     523  m_cTEncTop.setTestSAODisableAtPictureLevel                      ( m_bTestSAODisableAtPictureLevel );
     524  m_cTEncTop.setSaoEncodingRate                                   ( m_saoEncodingRate );
     525  m_cTEncTop.setSaoEncodingRateChroma                             ( m_saoEncodingRateChroma );
     526  m_cTEncTop.setMaxNumOffsetsPerPic                               ( m_maxNumOffsetsPerPic);
     527
     528  m_cTEncTop.setSaoCtuBoundary                                    ( m_saoCtuBoundary);
     529  m_cTEncTop.setPCMInputBitDepthFlag                              ( m_bPCMInputBitDepthFlag);
     530  m_cTEncTop.setPCMFilterDisableFlag                              ( m_bPCMFilterDisableFlag);
     531
     532  m_cTEncTop.setIntraSmoothingDisabledFlag                        (!m_enableIntraReferenceSmoothing );
     533  m_cTEncTop.setDecodedPictureHashSEIEnabled                      ( m_decodedPictureHashSEIEnabled );
     534  m_cTEncTop.setRecoveryPointSEIEnabled                           ( m_recoveryPointSEIEnabled );
     535  m_cTEncTop.setBufferingPeriodSEIEnabled                         ( m_bufferingPeriodSEIEnabled );
     536  m_cTEncTop.setPictureTimingSEIEnabled                           ( m_pictureTimingSEIEnabled );
     537  m_cTEncTop.setToneMappingInfoSEIEnabled                         ( m_toneMappingInfoSEIEnabled );
     538  m_cTEncTop.setTMISEIToneMapId                                   ( m_toneMapId );
     539  m_cTEncTop.setTMISEIToneMapCancelFlag                           ( m_toneMapCancelFlag );
     540  m_cTEncTop.setTMISEIToneMapPersistenceFlag                      ( m_toneMapPersistenceFlag );
     541  m_cTEncTop.setTMISEICodedDataBitDepth                           ( m_toneMapCodedDataBitDepth );
     542  m_cTEncTop.setTMISEITargetBitDepth                              ( m_toneMapTargetBitDepth );
     543  m_cTEncTop.setTMISEIModelID                                     ( m_toneMapModelId );
     544  m_cTEncTop.setTMISEIMinValue                                    ( m_toneMapMinValue );
     545  m_cTEncTop.setTMISEIMaxValue                                    ( m_toneMapMaxValue );
     546  m_cTEncTop.setTMISEISigmoidMidpoint                             ( m_sigmoidMidpoint );
     547  m_cTEncTop.setTMISEISigmoidWidth                                ( m_sigmoidWidth );
     548  m_cTEncTop.setTMISEIStartOfCodedInterva                         ( m_startOfCodedInterval );
     549  m_cTEncTop.setTMISEINumPivots                                   ( m_numPivots );
     550  m_cTEncTop.setTMISEICodedPivotValue                             ( m_codedPivotValue );
     551  m_cTEncTop.setTMISEITargetPivotValue                            ( m_targetPivotValue );
     552  m_cTEncTop.setTMISEICameraIsoSpeedIdc                           ( m_cameraIsoSpeedIdc );
     553  m_cTEncTop.setTMISEICameraIsoSpeedValue                         ( m_cameraIsoSpeedValue );
     554  m_cTEncTop.setTMISEIExposureIndexIdc                            ( m_exposureIndexIdc );
     555  m_cTEncTop.setTMISEIExposureIndexValue                          ( m_exposureIndexValue );
     556  m_cTEncTop.setTMISEIExposureCompensationValueSignFlag           ( m_exposureCompensationValueSignFlag );
     557  m_cTEncTop.setTMISEIExposureCompensationValueNumerator          ( m_exposureCompensationValueNumerator );
     558  m_cTEncTop.setTMISEIExposureCompensationValueDenomIdc           ( m_exposureCompensationValueDenomIdc );
     559  m_cTEncTop.setTMISEIRefScreenLuminanceWhite                     ( m_refScreenLuminanceWhite );
     560  m_cTEncTop.setTMISEIExtendedRangeWhiteLevel                     ( m_extendedRangeWhiteLevel );
     561  m_cTEncTop.setTMISEINominalBlackLevelLumaCodeValue              ( m_nominalBlackLevelLumaCodeValue );
     562  m_cTEncTop.setTMISEINominalWhiteLevelLumaCodeValue              ( m_nominalWhiteLevelLumaCodeValue );
     563  m_cTEncTop.setTMISEIExtendedWhiteLevelLumaCodeValue             ( m_extendedWhiteLevelLumaCodeValue );
     564  m_cTEncTop.setChromaSamplingFilterHintEnabled                   ( m_chromaSamplingFilterSEIenabled );
     565  m_cTEncTop.setChromaSamplingHorFilterIdc                        ( m_chromaSamplingHorFilterIdc );
     566  m_cTEncTop.setChromaSamplingVerFilterIdc                        ( m_chromaSamplingVerFilterIdc );
     567  m_cTEncTop.setFramePackingArrangementSEIEnabled                 ( m_framePackingSEIEnabled );
     568  m_cTEncTop.setFramePackingArrangementSEIType                    ( m_framePackingSEIType );
     569  m_cTEncTop.setFramePackingArrangementSEIId                      ( m_framePackingSEIId );
     570  m_cTEncTop.setFramePackingArrangementSEIQuincunx                ( m_framePackingSEIQuincunx );
     571  m_cTEncTop.setFramePackingArrangementSEIInterpretation          ( m_framePackingSEIInterpretation );
     572  m_cTEncTop.setSegmentedRectFramePackingArrangementSEIEnabled    ( m_segmentedRectFramePackingSEIEnabled );
     573  m_cTEncTop.setSegmentedRectFramePackingArrangementSEICancel     ( m_segmentedRectFramePackingSEICancel );
     574  m_cTEncTop.setSegmentedRectFramePackingArrangementSEIType       ( m_segmentedRectFramePackingSEIType );
     575  m_cTEncTop.setSegmentedRectFramePackingArrangementSEIPersistence( m_segmentedRectFramePackingSEIPersistence );
     576  m_cTEncTop.setDisplayOrientationSEIAngle                        ( m_displayOrientationSEIAngle );
     577  m_cTEncTop.setTemporalLevel0IndexSEIEnabled                     ( m_temporalLevel0IndexSEIEnabled );
     578  m_cTEncTop.setGradualDecodingRefreshInfoEnabled                 ( m_gradualDecodingRefreshInfoEnabled );
     579  m_cTEncTop.setNoDisplaySEITLayer                                ( m_noDisplaySEITLayer );
     580  m_cTEncTop.setDecodingUnitInfoSEIEnabled                        ( m_decodingUnitInfoSEIEnabled );
     581  m_cTEncTop.setSOPDescriptionSEIEnabled                          ( m_SOPDescriptionSEIEnabled );
     582  m_cTEncTop.setScalableNestingSEIEnabled                         ( m_scalableNestingSEIEnabled );
     583#if NH_MV
     584  m_cTEncTop.setSubBitstreamPropSEIEnabled                        ( m_subBistreamPropSEIEnabled );
     585  if( m_subBistreamPropSEIEnabled )                               
     586  {                                                               
     587    m_cTEncTop.setNumAdditionalSubStreams                         ( m_sbPropNumAdditionalSubStreams );
     588    m_cTEncTop.setSubBitstreamMode                                ( m_sbPropSubBitstreamMode );
     589    m_cTEncTop.setOutputLayerSetIdxToVps                          ( m_sbPropOutputLayerSetIdxToVps );
     590    m_cTEncTop.setHighestSublayerId                               ( m_sbPropHighestSublayerId );
     591    m_cTEncTop.setAvgBitRate                                      ( m_sbPropAvgBitRate );
     592    m_cTEncTop.setMaxBitRate                                      ( m_sbPropMaxBitRate );
     593  }
     594#endif
     595
     596  m_cTEncTop.setTMCTSSEIEnabled                                   ( m_tmctsSEIEnabled );
     597  m_cTEncTop.setTimeCodeSEIEnabled                                ( m_timeCodeSEIEnabled );
     598  m_cTEncTop.setNumberOfTimeSets                                  ( m_timeCodeSEINumTs );
     599  for(Int i = 0; i < m_timeCodeSEINumTs; i++)
     600  {
     601    m_cTEncTop.setTimeSet(m_timeSetArray[i], i);
     602  }
     603  m_cTEncTop.setKneeSEIEnabled                                    ( m_kneeSEIEnabled );
     604  m_cTEncTop.setKneeSEIId                                         ( m_kneeSEIId );
     605  m_cTEncTop.setKneeSEICancelFlag                                 ( m_kneeSEICancelFlag );
     606  m_cTEncTop.setKneeSEIPersistenceFlag                            ( m_kneeSEIPersistenceFlag );
     607  m_cTEncTop.setKneeSEIInputDrange                                ( m_kneeSEIInputDrange );
     608  m_cTEncTop.setKneeSEIInputDispLuminance                         ( m_kneeSEIInputDispLuminance );
     609  m_cTEncTop.setKneeSEIOutputDrange                               ( m_kneeSEIOutputDrange );
     610  m_cTEncTop.setKneeSEIOutputDispLuminance                        ( m_kneeSEIOutputDispLuminance );
     611  m_cTEncTop.setKneeSEINumKneePointsMinus1                        ( m_kneeSEINumKneePointsMinus1 );
     612  m_cTEncTop.setKneeSEIInputKneePoint                             ( m_kneeSEIInputKneePoint );
     613  m_cTEncTop.setKneeSEIOutputKneePoint                            ( m_kneeSEIOutputKneePoint );
     614  m_cTEncTop.setMasteringDisplaySEI                               ( m_masteringDisplay );
     615
     616  m_cTEncTop.setTileUniformSpacingFlag                            ( m_tileUniformSpacingFlag );
     617  m_cTEncTop.setNumColumnsMinus1                                  ( m_numTileColumnsMinus1 );
     618  m_cTEncTop.setNumRowsMinus1                                     ( m_numTileRowsMinus1 );
    495619  if(!m_tileUniformSpacingFlag)
    496620  {
    497     m_cTEncTop.setColumnWidth              ( m_tileColumnWidth );
    498     m_cTEncTop.setRowHeight                ( m_tileRowHeight );
     621    m_cTEncTop.setColumnWidth                                     ( m_tileColumnWidth );
     622    m_cTEncTop.setRowHeight                                       ( m_tileRowHeight );
    499623  }
    500624  m_cTEncTop.xCheckGSParameters();
    501   Int uiTilesCount          = (m_numTileRowsMinus1+1) * (m_numTileColumnsMinus1+1);
     625  Int uiTilesCount = (m_numTileRowsMinus1+1) * (m_numTileColumnsMinus1+1);
    502626  if(uiTilesCount == 1)
    503627  {
    504     m_bLFCrossTileBoundaryFlag = true;
    505   }
    506   m_cTEncTop.setLFCrossTileBoundaryFlag( m_bLFCrossTileBoundaryFlag );
    507   m_cTEncTop.setWaveFrontSynchro           ( m_iWaveFrontSynchro );
    508   m_cTEncTop.setWaveFrontSubstreams        ( m_iWaveFrontSubstreams );
    509   m_cTEncTop.setTMVPModeId ( m_TMVPModeId );
    510   m_cTEncTop.setUseScalingListId           ( m_useScalingListId  );
    511   m_cTEncTop.setScalingListFile            ( m_scalingListFile   );
    512   m_cTEncTop.setSignHideFlag(m_signHideFlag);
     628    m_bLFCrossTileBoundaryFlag = true;
     629  }
     630  m_cTEncTop.setLFCrossTileBoundaryFlag                           ( m_bLFCrossTileBoundaryFlag );
     631  m_cTEncTop.setWaveFrontSynchro                                  ( m_iWaveFrontSynchro );
     632  m_cTEncTop.setTMVPModeId                                        ( m_TMVPModeId );
     633  m_cTEncTop.setUseScalingListId                                  ( m_useScalingListId  );
     634  m_cTEncTop.setScalingListFile                                   ( m_scalingListFile   );
     635  m_cTEncTop.setSignHideFlag                                      ( m_signHideFlag);
    513636#if KWU_RC_VIEWRC_E0227 || KWU_RC_MADPRED_E0227
    514637  if(!m_cTEncTop.getIsDepth())    //only for texture
    515638  {
    516     m_cTEncTop.setUseRateCtrl         ( m_RCEnableRateControl );
    517   }
    518   else
    519   {
    520     m_cTEncTop.setUseRateCtrl         ( 0 );
    521   }
    522 #else
    523     m_cTEncTop.setUseRateCtrl         ( m_RCEnableRateControl );
     639    m_cTEncTop.setUseRateCtrl                                     ( m_RCEnableRateControl );
     640  }                                                         
     641  else                                                       
     642  {                                                         
     643    m_cTEncTop.setUseRateCtrl                                     ( 0 );
     644  }
     645#else
     646  m_cTEncTop.setUseRateCtrl                                       ( m_RCEnableRateControl );
    524647#endif
    525648#if !KWU_RC_VIEWRC_E0227
    526   m_cTEncTop.setTargetBitrate       ( m_RCTargetBitrate );
    527 #endif
    528   m_cTEncTop.setKeepHierBit         ( m_RCKeepHierarchicalBit );
    529   m_cTEncTop.setLCULevelRC          ( m_RCLCULevelRC );
    530   m_cTEncTop.setUseLCUSeparateModel ( m_RCUseLCUSeparateModel );
    531   m_cTEncTop.setInitialQP           ( m_RCInitialQP );
    532   m_cTEncTop.setForceIntraQP        ( m_RCForceIntraQP );
     649  m_cTEncTop.setTargetBitrate                                     ( m_RCTargetBitrate );
     650#endif
     651  m_cTEncTop.setKeepHierBit                                       ( m_RCKeepHierarchicalBit );
     652  m_cTEncTop.setLCULevelRC                                        ( m_RCLCULevelRC );
     653  m_cTEncTop.setUseLCUSeparateModel                               ( m_RCUseLCUSeparateModel );
     654  m_cTEncTop.setInitialQP                                         ( m_RCInitialQP );
     655  m_cTEncTop.setForceIntraQP                                      ( m_RCForceIntraQP );
    533656#if KWU_RC_MADPRED_E0227
    534657  if(m_cTEncTop.getUseRateCtrl() && !m_cTEncTop.getIsDepth())
     
    598721  }
    599722#endif
    600   m_cTEncTop.setTransquantBypassEnableFlag(m_TransquantBypassEnableFlag);
    601   m_cTEncTop.setCUTransquantBypassFlagForceValue(m_CUTransquantBypassFlagForce);
    602   m_cTEncTop.setUseRecalculateQPAccordingToLambda( m_recalculateQPAccordingToLambda );
    603   m_cTEncTop.setUseStrongIntraSmoothing( m_useStrongIntraSmoothing );
    604   m_cTEncTop.setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled );
    605   m_cTEncTop.setVuiParametersPresentFlag( m_vuiParametersPresentFlag );
    606   m_cTEncTop.setAspectRatioInfoPresentFlag( m_aspectRatioInfoPresentFlag);
    607   m_cTEncTop.setAspectRatioIdc( m_aspectRatioIdc );
    608   m_cTEncTop.setSarWidth( m_sarWidth );
    609   m_cTEncTop.setSarHeight( m_sarHeight );
    610   m_cTEncTop.setOverscanInfoPresentFlag( m_overscanInfoPresentFlag );
    611   m_cTEncTop.setOverscanAppropriateFlag( m_overscanAppropriateFlag );
    612   m_cTEncTop.setVideoSignalTypePresentFlag( m_videoSignalTypePresentFlag );
    613   m_cTEncTop.setVideoFormat( m_videoFormat );
    614   m_cTEncTop.setVideoFullRangeFlag( m_videoFullRangeFlag );
    615   m_cTEncTop.setColourDescriptionPresentFlag( m_colourDescriptionPresentFlag );
    616   m_cTEncTop.setColourPrimaries( m_colourPrimaries );
    617   m_cTEncTop.setTransferCharacteristics( m_transferCharacteristics );
    618   m_cTEncTop.setMatrixCoefficients( m_matrixCoefficients );
    619   m_cTEncTop.setChromaLocInfoPresentFlag( m_chromaLocInfoPresentFlag );
    620   m_cTEncTop.setChromaSampleLocTypeTopField( m_chromaSampleLocTypeTopField );
    621   m_cTEncTop.setChromaSampleLocTypeBottomField( m_chromaSampleLocTypeBottomField );
    622   m_cTEncTop.setNeutralChromaIndicationFlag( m_neutralChromaIndicationFlag );
    623   m_cTEncTop.setDefaultDisplayWindow( m_defDispWinLeftOffset, m_defDispWinRightOffset, m_defDispWinTopOffset, m_defDispWinBottomOffset );
    624   m_cTEncTop.setFrameFieldInfoPresentFlag( m_frameFieldInfoPresentFlag );
    625   m_cTEncTop.setPocProportionalToTimingFlag( m_pocProportionalToTimingFlag );
    626   m_cTEncTop.setNumTicksPocDiffOneMinus1   ( m_numTicksPocDiffOneMinus1    );
    627   m_cTEncTop.setBitstreamRestrictionFlag( m_bitstreamRestrictionFlag );
    628   m_cTEncTop.setTilesFixedStructureFlag( m_tilesFixedStructureFlag );
    629   m_cTEncTop.setMotionVectorsOverPicBoundariesFlag( m_motionVectorsOverPicBoundariesFlag );
    630   m_cTEncTop.setMinSpatialSegmentationIdc( m_minSpatialSegmentationIdc );
    631   m_cTEncTop.setMaxBytesPerPicDenom( m_maxBytesPerPicDenom );
    632   m_cTEncTop.setMaxBitsPerMinCuDenom( m_maxBitsPerMinCuDenom );
    633   m_cTEncTop.setLog2MaxMvLengthHorizontal( m_log2MaxMvLengthHorizontal );
    634   m_cTEncTop.setLog2MaxMvLengthVertical( m_log2MaxMvLengthVertical );
    635 #if H_MV
    636   }
    637 #endif
    638 #if H_3D
    639  /// SET Profiles
    640   for(Int layerIdInVps = 0; layerIdInVps < m_numberOfLayers; layerIdInVps++)
    641   {
    642     Int profileIdc = -1;
    643     for (Int olsIdx = 0; olsIdx < vps.getNumOutputLayerSets(); olsIdx++ )
    644     {   
    645       Int lsIdx = vps.olsIdxToLsIdx( olsIdx );
    646       for(Int i = 0; i < vps.getNumLayersInIdList( lsIdx ); i++ )
    647       {
    648         if( vps.getLayerIdInNuh( layerIdInVps) == vps.getLayerSetLayerIdList(lsIdx, i) )
    649         {
    650           Int ptlIdx = vps.getProfileTierLevelIdx( olsIdx, i );
    651           if ( ptlIdx != -1 )
    652           {
    653             Int curProfileIdc = vps.getPTL(ptlIdx)->getGeneralPTL()->getProfileIdc();
    654             if (profileIdc == -1)   
    655             {
    656               profileIdc = curProfileIdc;
    657             }
    658             else
    659             {   
    660               if ( profileIdc != curProfileIdc )
    661               {             
    662                 fprintf(stderr, "Error: ProfileIdc for layer with index %d in VPS not equal in all OLSs. \n", layerIdInVps );
    663                 exit(EXIT_FAILURE);
    664               }
    665             }
    666           }
    667         }
    668       }
    669     }
    670     if (profileIdc == -1 )
    671     {
    672       fprintf(stderr, "Error: No profile given for layer with index %d in VPS not equal in all OLS. \n", layerIdInVps );
    673       exit(EXIT_FAILURE);
    674     }
    675     m_acTEncTopList[ layerIdInVps ]->setProfileIdc( profileIdc );
    676   }
    677 #endif
    678 #if H_3D_VSO
     723  m_cTEncTop.setTransquantBypassEnableFlag                        ( m_TransquantBypassEnableFlag );
     724  m_cTEncTop.setCUTransquantBypassFlagForceValue                  ( m_CUTransquantBypassFlagForce );
     725  m_cTEncTop.setCostMode                                          ( m_costMode );
     726  m_cTEncTop.setUseRecalculateQPAccordingToLambda                 ( m_recalculateQPAccordingToLambda );
     727  m_cTEncTop.setUseStrongIntraSmoothing                           ( m_useStrongIntraSmoothing );
     728  m_cTEncTop.setActiveParameterSetsSEIEnabled                     ( m_activeParameterSetsSEIEnabled );
     729  m_cTEncTop.setVuiParametersPresentFlag                          ( m_vuiParametersPresentFlag );
     730  m_cTEncTop.setAspectRatioInfoPresentFlag                        ( m_aspectRatioInfoPresentFlag);
     731  m_cTEncTop.setAspectRatioIdc                                    ( m_aspectRatioIdc );
     732  m_cTEncTop.setSarWidth                                          ( m_sarWidth );
     733  m_cTEncTop.setSarHeight                                         ( m_sarHeight );
     734  m_cTEncTop.setOverscanInfoPresentFlag                           ( m_overscanInfoPresentFlag );
     735  m_cTEncTop.setOverscanAppropriateFlag                           ( m_overscanAppropriateFlag );
     736  m_cTEncTop.setVideoSignalTypePresentFlag                        ( m_videoSignalTypePresentFlag );
     737  m_cTEncTop.setVideoFormat                                       ( m_videoFormat );
     738  m_cTEncTop.setVideoFullRangeFlag                                ( m_videoFullRangeFlag );
     739  m_cTEncTop.setColourDescriptionPresentFlag                      ( m_colourDescriptionPresentFlag );
     740  m_cTEncTop.setColourPrimaries                                   ( m_colourPrimaries );
     741  m_cTEncTop.setTransferCharacteristics                           ( m_transferCharacteristics );
     742  m_cTEncTop.setMatrixCoefficients                                ( m_matrixCoefficients );
     743  m_cTEncTop.setChromaLocInfoPresentFlag                          ( m_chromaLocInfoPresentFlag );
     744  m_cTEncTop.setChromaSampleLocTypeTopField                       ( m_chromaSampleLocTypeTopField );
     745  m_cTEncTop.setChromaSampleLocTypeBottomField                    ( m_chromaSampleLocTypeBottomField );
     746  m_cTEncTop.setNeutralChromaIndicationFlag                       ( m_neutralChromaIndicationFlag );
     747  m_cTEncTop.setDefaultDisplayWindow                              ( m_defDispWinLeftOffset, m_defDispWinRightOffset, m_defDispWinTopOffset, m_defDispWinBottomOffset );
     748  m_cTEncTop.setFrameFieldInfoPresentFlag                         ( m_frameFieldInfoPresentFlag );
     749  m_cTEncTop.setPocProportionalToTimingFlag                       ( m_pocProportionalToTimingFlag );
     750  m_cTEncTop.setNumTicksPocDiffOneMinus1                          ( m_numTicksPocDiffOneMinus1    );
     751  m_cTEncTop.setBitstreamRestrictionFlag                          ( m_bitstreamRestrictionFlag );
     752  m_cTEncTop.setTilesFixedStructureFlag                           ( m_tilesFixedStructureFlag );
     753  m_cTEncTop.setMotionVectorsOverPicBoundariesFlag                ( m_motionVectorsOverPicBoundariesFlag );
     754  m_cTEncTop.setMinSpatialSegmentationIdc                         ( m_minSpatialSegmentationIdc );
     755  m_cTEncTop.setMaxBytesPerPicDenom                               ( m_maxBytesPerPicDenom );
     756  m_cTEncTop.setMaxBitsPerMinCuDenom                              ( m_maxBitsPerMinCuDenom );
     757  m_cTEncTop.setLog2MaxMvLengthHorizontal                         ( m_log2MaxMvLengthHorizontal );
     758  m_cTEncTop.setLog2MaxMvLengthVertical                           ( m_log2MaxMvLengthVertical );
     759  m_cTEncTop.setEfficientFieldIRAPEnabled                         ( m_bEfficientFieldIRAPEnabled );
     760  m_cTEncTop.setHarmonizeGopFirstFieldCoupleEnabled               ( m_bHarmonizeGopFirstFieldCoupleEnabled );
     761
     762  m_cTEncTop.setSummaryOutFilename                                ( m_summaryOutFilename );
     763  m_cTEncTop.setSummaryPicFilenameBase                            ( m_summaryPicFilenameBase );
     764  m_cTEncTop.setSummaryVerboseness                                ( m_summaryVerboseness );
     765
     766#if NH_MV
     767  }
     768#endif
     769#if NH_3D_VSO
    679770  if ( m_bUseVSO )
    680771  {
     
    682773    {
    683774#if H_3D_VSO_EARLY_SKIP
    684       m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, g_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0, m_bVSOEarlySkip );
    685 #else
    686       m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, g_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0 );
     775      m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0, m_bVSOEarlySkip );
     776#else
     777      m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0 );
    687778#endif
    688779      for ( Int layer = 0; layer < m_numberOfLayers ; layer++ )
     
    717808Void TAppEncTop::xCreateLib()
    718809{
    719 #if H_MV
     810#if NH_MV
    720811  // initialize global variables
    721812  initROM();
     
    726817  for( Int layer=0; layer < m_numberOfLayers; layer++)
    727818  {
    728     m_acTVideoIOYuvInputFileList[layer]->open( m_pchInputFileList[layer],     false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC );  // read  mode
    729     m_acTVideoIOYuvInputFileList[layer]->skipFrames( m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1]);
     819    m_acTVideoIOYuvInputFileList[layer]->open( m_pchInputFileList[layer],     false, m_inputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth );  // read  mode
     820    m_acTVideoIOYuvInputFileList[layer]->skipFrames( m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1], m_InputChromaFormatIDC);
    730821
    731822    if (m_pchReconFileList[layer])
    732823    {
    733       m_acTVideoIOYuvReconFileList[layer]->open( m_pchReconFileList[layer], true, m_outputBitDepthY, m_outputBitDepthC, m_internalBitDepthY, m_internalBitDepthC);  // write mode
     824      m_acTVideoIOYuvReconFileList[layer]->open( m_pchReconFileList[layer], true, m_outputBitDepth, m_outputBitDepth, m_internalBitDepth);  // write mode
    734825    }
    735826    m_acTEncTopList[layer]->create();
     
    737828#else
    738829  // Video I/O
    739   m_cTVideoIOYuvInputFile.open( m_pchInputFile,     false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC );  // read  mode
    740   m_cTVideoIOYuvInputFile.skipFrames(m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1]);
     830  m_cTVideoIOYuvInputFile.open( m_pchInputFile,     false, m_inputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth );  // read  mode
     831  m_cTVideoIOYuvInputFile.skipFrames(m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1], m_InputChromaFormatIDC);
    741832
    742833  if (m_pchReconFile)
    743     m_cTVideoIOYuvReconFile.open(m_pchReconFile, true, m_outputBitDepthY, m_outputBitDepthC, m_internalBitDepthY, m_internalBitDepthC);  // write mode
    744  
     834  {
     835    m_cTVideoIOYuvReconFile.open(m_pchReconFile, true, m_outputBitDepth, m_outputBitDepth, m_internalBitDepth);  // write mode
     836  }
     837
    745838  // Neo Decoder
    746839  m_cTEncTop.create();
     
    750843Void TAppEncTop::xDestroyLib()
    751844{
    752 #if H_MV
     845#if NH_MV
    753846  // destroy ROM
    754847  destroyROM();
     
    766859    delete m_acTEncTopList[layer] ;
    767860    m_acTEncTopList[layer] = NULL;
    768     delete m_picYuvRec[layer] ;
    769     m_picYuvRec[layer] = NULL;
     861    delete m_cListPicYuvRec[layer] ;
     862    m_cListPicYuvRec[layer] = NULL;
    770863  }
    771864#else
     
    773866  m_cTVideoIOYuvInputFile.close();
    774867  m_cTVideoIOYuvReconFile.close();
    775  
     868
    776869  // Neo Decoder
    777870  m_cTEncTop.destroy();
     
    781874Void TAppEncTop::xInitLib(Bool isFieldCoding)
    782875{
    783 #if H_3D
    784 #endif
    785 
    786 #if H_MV
     876#if NH_MV
    787877  for(Int layer=0; layer<m_numberOfLayers; layer++)
    788878  {
     
    794884  }
    795885#else
    796   m_cTEncTop.init( isFieldCoding );
     886  m_cTEncTop.init(isFieldCoding);
    797887#endif
    798888}
     
    819909  }
    820910
     911#if !NH_3D
    821912  TComPicYuv*       pcPicYuvOrg = new TComPicYuv;
     913#endif
    822914  TComPicYuv*       pcPicYuvRec = NULL;
    823  
     915
    824916  // initialize internal class & member variables
    825917  xInitLibCfg();
    826918  xCreateLib();
    827919  xInitLib(m_isField);
    828  
     920
     921  printChromaFormat();
     922
    829923  // main encoder loop
    830 #if H_MV
     924#if NH_MV
    831925  Bool  allEos = false;
    832926  std::vector<Bool>  eos ;
     
    846940  Bool  bEos = false;
    847941#endif
    848  
     942  const InputColourSpaceConversion ipCSC  =  m_inputColourSpaceConvert;
     943  const InputColourSpaceConversion snrCSC = (!m_snrInternalColourSpace) ? m_inputColourSpaceConvert : IPCOLOURSPACE_UNCHANGED;
     944
    849945  list<AccessUnit> outputAccessUnits; ///< list of access units to write out.  is populated by the encoding process
     946 
     947#if NH_3D
     948  TComPicYuv* picYuvOrg[2];
     949  TComPicYuv  picYuvTrueOrg[2];
     950  for (Int d = 0; d < 2 ; d++)
     951  {
     952    picYuvOrg[d] = new TComPicYuv;
     953    picYuvOrg[d]   ->create( m_iSourceWidth, m_isField ? m_iSourceHeightOrg : m_iSourceHeight, ( d > 0 ) ? CHROMA_400 : m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true );
     954    picYuvTrueOrg[d].create( m_iSourceWidth, m_isField ? m_iSourceHeightOrg : m_iSourceHeight, ( d > 0 ) ? CHROMA_400 : m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true );
     955  }
     956#else
     957  TComPicYuv cPicYuvTrueOrg;
    850958
    851959  // allocate original YUV buffer
    852960  if( m_isField )
    853961  {
    854     pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeightOrg, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     962    pcPicYuvOrg->create  ( m_iSourceWidth, m_iSourceHeightOrg, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true );
     963    cPicYuvTrueOrg.create(m_iSourceWidth, m_iSourceHeightOrg, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true);
    855964  }
    856965  else
    857966  {
    858   pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
    859   }
    860  
    861 #if H_MV
     967    pcPicYuvOrg->create  ( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true );
     968    cPicYuvTrueOrg.create(m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true );
     969  }
     970#endif
     971#if NH_MV
    862972  while ( (m_targetEncLayerIdList.size() != 0 ) && !allEos )
    863973  {
    864974    for(Int layer=0; layer < m_numberOfLayers; layer++ )
    865975    {
     976#if NH_3D
     977      TComPicYuv* pcPicYuvOrg    =  picYuvOrg    [ m_depthFlag[layer] ];
     978      TComPicYuv& cPicYuvTrueOrg =  picYuvTrueOrg[ m_depthFlag[layer] ];
     979#endif
    866980      if (!xLayerIdInTargetEncLayerIdList( m_vps->getLayerIdInNuh( layer ) ))
    867981      {
     
    875989        xGetBuffer(pcPicYuvRec, layer);
    876990
    877         // read input YUV file
    878         m_acTVideoIOYuvInputFileList[layer]->read      ( pcPicYuvOrg, m_aiPad );
     991        // read input YUV file       
     992        m_acTVideoIOYuvInputFileList[layer]->read      ( pcPicYuvOrg, &cPicYuvTrueOrg, ipCSC, m_aiPad, m_InputChromaFormatIDC );
    879993        m_acTEncTopList             [layer]->initNewPic( pcPicYuvOrg );
    880994
     
    8991013    for ( Int gopId=0; gopId < gopSize; gopId++ )
    9001014    {
    901 #if H_3D
     1015#if NH_3D
    9021016      UInt iNextPoc = m_acTEncTopList[0] -> getFrameId( gopId );
    9031017      if ( iNextPoc < m_framesToBeEncoded )
     
    9081022      for(Int layer=0; layer < m_numberOfLayers; layer++ )
    9091023      {
     1024#if NH_3D
     1025        TComPicYuv* pcPicYuvOrg    =  picYuvOrg    [ m_depthFlag[layer] ];
     1026        TComPicYuv& cPicYuvTrueOrg =  picYuvTrueOrg[ m_depthFlag[layer] ];
     1027#endif
    9101028        if (!xLayerIdInTargetEncLayerIdList( m_vps->getLayerIdInNuh( layer ) ))
    9111029        {
     
    9131031        }
    9141032
    915 #if H_3D_VSO       
     1033#if NH_3D_VSO       
    9161034          if( m_bUseVSO && m_bUseEstimatedVSD && iNextPoc < m_framesToBeEncoded )
    9171035          {
     
    9231041        Int   iNumEncoded = 0;
    9241042
    925         // call encoding function for one frame         
    926         m_acTEncTopList[layer]->encode( eos[layer], flush[layer] ? 0 : pcPicYuvOrg, *m_picYuvRec[layer], outputAccessUnits, iNumEncoded, gopId );       
     1043        // call encoding function for one frame                               
     1044        m_acTEncTopList[layer]->encode( eos[layer], flush[layer] ? 0 : pcPicYuvOrg, flush[layer] ? 0 : &cPicYuvTrueOrg, snrCSC, *m_cListPicYuvRec[layer], outputAccessUnits, iNumEncoded, gopId );       
    9271045        xWriteOutput(bitstreamFile, iNumEncoded, outputAccessUnits, layer);
    9281046        outputAccessUnits.clear();
     
    9371055    {
    9381056      continue;
    939     }
    940     m_acTEncTopList[layer]->printSummary( m_acTEncTopList[layer]->getNumAllPicCoded(), m_isField );
    941   }
    942 #else
     1057    }   
     1058    m_acTEncTopList[layer]->printSummary(m_isField);
     1059  }
     1060#else
     1061
    9431062  while ( !bEos )
    9441063  {
     
    9471066
    9481067    // read input YUV file
    949     m_cTVideoIOYuvInputFile.read( pcPicYuvOrg, m_aiPad );
     1068    m_cTVideoIOYuvInputFile.read( pcPicYuvOrg, &cPicYuvTrueOrg, ipCSC, m_aiPad, m_InputChromaFormatIDC, m_bClipInputVideoToRec709Range );
    9501069
    9511070    // increase number of received frames
     
    9671086    if ( m_isField )
    9681087    {
    969       m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, m_cListPicYuvRec, outputAccessUnits, iNumEncoded, m_isTopFieldFirst);
     1088      m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, flush ? 0 : &cPicYuvTrueOrg, snrCSC, m_cListPicYuvRec, outputAccessUnits, iNumEncoded, m_isTopFieldFirst );
    9701089    }
    9711090    else
    9721091    {
    973     m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, m_cListPicYuvRec, outputAccessUnits, iNumEncoded );
    974     }
    975    
     1092      m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, flush ? 0 : &cPicYuvTrueOrg, snrCSC, m_cListPicYuvRec, outputAccessUnits, iNumEncoded );
     1093    }
     1094
    9761095    // write bistream to file if necessary
    9771096    if ( iNumEncoded > 0 )
     
    9851104#endif
    9861105
     1106#if NH_3D
     1107  // delete original YUV buffer
     1108  for (Int d = 0; d < 2; d++)
     1109  {
     1110    picYuvOrg[d]->destroy();
     1111    delete picYuvOrg[d];
     1112    picYuvOrg[d] = NULL;
     1113
     1114    picYuvTrueOrg[d].destroy();
     1115  }
     1116#else
    9871117  // delete original YUV buffer
    9881118  pcPicYuvOrg->destroy();
    9891119  delete pcPicYuvOrg;
    9901120  pcPicYuvOrg = NULL;
    991  
    992 #if !H_MV
     1121#endif
     1122
     1123#if !NH_MV
    9931124  // delete used buffers in encoder class
    9941125  m_cTEncTop.deletePicBuffer();
     1126#endif
     1127#if !NH_3D
     1128  cPicYuvTrueOrg.destroy();
    9951129#endif
    9961130
     
    9981132  xDeleteBuffer();
    9991133  xDestroyLib();
    1000  
     1134
    10011135  printRateSummary();
    10021136
     
    10231157 .
    10241158 */
    1025 #if H_MV
     1159#if NH_MV
    10261160Void TAppEncTop::xGetBuffer( TComPicYuv*& rpcPicYuvRec, UInt layer)
    10271161#else
     
    10301164{
    10311165  assert( m_iGOPSize > 0 );
    1032  
     1166
    10331167  // org. buffer
    1034 #if H_MV
    1035   if ( m_picYuvRec[layer]->size() == (UInt)m_iGOPSize )
    1036   {
    1037     rpcPicYuvRec = m_picYuvRec[layer]->popFront();
    1038 #else
    1039   if ( m_cListPicYuvRec.size() == (UInt)m_iGOPSize )
     1168#if NH_MV
     1169  if ( m_cListPicYuvRec[layer]->size() == (UInt)m_iGOPSize )
     1170  {
     1171    rpcPicYuvRec = m_cListPicYuvRec[layer]->popFront();
     1172#else
     1173  if ( m_cListPicYuvRec.size() >= (UInt)m_iGOPSize ) // buffer will be 1 element longer when using field coding, to maintain first field whilst processing second.
    10401174  {
    10411175    rpcPicYuvRec = m_cListPicYuvRec.popFront();
    10421176#endif
    1043 
    10441177  }
    10451178  else
    10461179  {
    10471180    rpcPicYuvRec = new TComPicYuv;
    1048    
    1049     rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
    1050 
    1051   }
    1052 #if H_MV
    1053   m_picYuvRec[layer]->pushBack( rpcPicYuvRec );
     1181#if NH_3D
     1182    rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_depthFlag[layer] > 0 ? CHROMA_400 : m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true );
     1183#else
     1184    rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true );
     1185#endif
     1186
     1187  }
     1188#if NH_MV
     1189  m_cListPicYuvRec[layer]->pushBack( rpcPicYuvRec );
    10541190#else
    10551191  m_cListPicYuvRec.pushBack( rpcPicYuvRec );
     
    10591195Void TAppEncTop::xDeleteBuffer( )
    10601196{
    1061 #if H_MV
    1062   for(Int layer=0; layer<m_picYuvRec.size(); layer++)
    1063   {
    1064     if(m_picYuvRec[layer])
    1065     {
    1066       TComList<TComPicYuv*>::iterator iterPicYuvRec  = m_picYuvRec[layer]->begin();
    1067       Int iSize = Int( m_picYuvRec[layer]->size() );
     1197#if NH_MV
     1198  for(Int layer=0; layer<m_cListPicYuvRec.size(); layer++)
     1199  {
     1200    if(m_cListPicYuvRec[layer])
     1201    {
     1202      TComList<TComPicYuv*>::iterator iterPicYuvRec  = m_cListPicYuvRec[layer]->begin();
     1203      Int iSize = Int( m_cListPicYuvRec[layer]->size() );
    10681204#else
    10691205  TComList<TComPicYuv*>::iterator iterPicYuvRec  = m_cListPicYuvRec.begin();
    1070  
     1206
    10711207  Int iSize = Int( m_cListPicYuvRec.size() );
    10721208#endif
     
    10781214    delete pcPicYuvRec; pcPicYuvRec = NULL;
    10791215  }
    1080 
    1081 #if H_MV
     1216#if NH_MV
    10821217    }
    10831218  }
    10841219#endif 
    1085 }
    1086 
    1087 /** \param iNumEncoded  number of encoded frames
     1220
     1221}
     1222
     1223/**
     1224  Write access units to output file.
     1225  \param bitstreamFile  target bitstream file
     1226  \param iNumEncoded    number of encoded frames
     1227  \param accessUnits    list of access units to be written
    10881228 */
    1089 #if H_MV
    1090 Void TAppEncTop::xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, std::list<AccessUnit>& accessUnits, UInt layerId)
     1229#if NH_MV
     1230Void TAppEncTop::xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, std::list<AccessUnit>& accessUnits, UInt layerIdx)
    10911231#else
    10921232Void TAppEncTop::xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, const std::list<AccessUnit>& accessUnits)
    10931233#endif
    10941234{
     1235  const InputColourSpaceConversion ipCSC = (!m_outputInternalColourSpace) ? m_inputColourSpaceConvert : IPCOLOURSPACE_UNCHANGED;
     1236
    10951237  if (m_isField)
    10961238  {
    10971239    //Reinterlace fields
    10981240    Int i;
    1099 #if H_MV
     1241#if NH_MV
    11001242    if( iNumEncoded > 0 )
    11011243    {
    1102       TComList<TComPicYuv*>::iterator iterPicYuvRec = m_picYuvRec[layerId]->end();
     1244      TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec[layerIdx]->end();
    11031245#else
    11041246    TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.end();
     
    11161258      TComPicYuv*  pcPicYuvRecBottom  = *(iterPicYuvRec++);
    11171259
    1118 #if H_MV
    1119       if (m_pchReconFileList[layerId])
    1120       {
    1121         m_acTVideoIOYuvReconFileList[layerId]->write( pcPicYuvRecTop, pcPicYuvRecBottom, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, m_isTopFieldFirst );
     1260#if NH_MV
     1261      if (m_pchReconFileList[layerIdx])
     1262      {
     1263#if NH_3D
     1264        m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRecTop, pcPicYuvRecBottom, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, m_depth420OutputFlag && m_depthFlag[layerIdx ] ? CHROMA_420 : NUM_CHROMA_FORMAT, m_isTopFieldFirst );
     1265#else
     1266        m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRecTop, pcPicYuvRecBottom, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, NUM_CHROMA_FORMAT, m_isTopFieldFirst );
     1267#endif
    11221268      }
    11231269    }
     
    11361282      if (m_pchReconFile)
    11371283      {
    1138         m_cTVideoIOYuvReconFile.write( pcPicYuvRecTop, pcPicYuvRecBottom, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, m_isTopFieldFirst );
     1284        m_cTVideoIOYuvReconFile.write( pcPicYuvRecTop, pcPicYuvRecBottom, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, NUM_CHROMA_FORMAT, m_isTopFieldFirst );
    11391285      }
    11401286
     
    11521298  {
    11531299    Int i;
    1154 #if H_MV
     1300#if NH_MV
    11551301    if( iNumEncoded > 0 )
    11561302    {
    1157       TComList<TComPicYuv*>::iterator iterPicYuvRec = m_picYuvRec[layerId]->end();
     1303      TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec[layerIdx]->end();
    11581304#else
    11591305    TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.end();
     
    11691315    {
    11701316      TComPicYuv*  pcPicYuvRec  = *(iterPicYuvRec++);
    1171 #if H_MV
    1172       if (m_pchReconFileList[layerId])
    1173       {
    1174         m_acTVideoIOYuvReconFileList[layerId]->write( pcPicYuvRec, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom );
     1317#if NH_MV
     1318      if (m_pchReconFileList[layerIdx])
     1319      {
     1320#if NH_3D
     1321        m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRec, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, m_depth420OutputFlag && m_depthFlag[layerIdx ] ? CHROMA_420 : NUM_CHROMA_FORMAT  );
     1322#else
     1323        m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRec, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom );
     1324#endif
     1325
    11751326      }   
    11761327    }
     
    11881339      if (m_pchReconFile)
    11891340      {
    1190         m_cTVideoIOYuvReconFile.write( pcPicYuvRec, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom );
     1341        m_cTVideoIOYuvReconFile.write( pcPicYuvRec, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom,
     1342            NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range  );
    11911343      }
    11921344
    11931345      const AccessUnit& au = *(iterBitstream++);
    11941346      const vector<UInt>& stats = writeAnnexB(bitstreamFile, au);
    1195       rateStatsAccum(au, stats);   
    1196     }
    1197 #endif
    1198   }
    1199 }
    1200  
     1347      rateStatsAccum(au, stats);
     1348    }
     1349#endif
     1350  }
     1351}
     1352
    12011353/**
    12021354 *
    12031355 */
    1204 void TAppEncTop::rateStatsAccum(const AccessUnit& au, const std::vector<UInt>& annexBsizes)
     1356Void TAppEncTop::rateStatsAccum(const AccessUnit& au, const std::vector<UInt>& annexBsizes)
    12051357{
    12061358  AccessUnit::const_iterator it_au = au.begin();
     
    12401392}
    12411393
    1242 void TAppEncTop::printRateSummary()
    1243 {
    1244 #if H_MV
     1394Void TAppEncTop::printRateSummary()
     1395{
     1396#if NH_MV
    12451397  Double time = (Double) m_frameRcvd[0] / m_iFrameRate;
    12461398  printf("\n");
     
    12491401#endif
    12501402  printf("Bytes written to file: %u (%.3f kbps)\n", m_totalBytes, 0.008 * m_totalBytes / time);
    1251 #if VERBOSE_RATE
     1403  if (m_summaryVerboseness > 0)
     1404  {
    12521405  printf("Bytes for SPS/PPS/Slice (Incl. Annex B): %u (%.3f kbps)\n", m_essentialBytes, 0.008 * m_essentialBytes / time);
    1253 #endif
     1406  }
     1407}
     1408
     1409Void TAppEncTop::printChromaFormat()
     1410{
     1411  std::cout << std::setw(43) << "Input ChromaFormatIDC = ";
     1412  switch (m_InputChromaFormatIDC)
     1413  {
     1414  case CHROMA_400:  std::cout << "  4:0:0"; break;
     1415  case CHROMA_420:  std::cout << "  4:2:0"; break;
     1416  case CHROMA_422:  std::cout << "  4:2:2"; break;
     1417  case CHROMA_444:  std::cout << "  4:4:4"; break;
     1418  default:
     1419    std::cerr << "Invalid";
     1420    exit(1);
     1421  }
     1422  std::cout << std::endl;
     1423
     1424#if NH_MV
     1425  for (Int i = 0; i < m_numberOfLayers; i++)
     1426  {
     1427    std::cout << "Layer " << i << std::setw( 43 - (i > 9 ? 6 : 7) ) << "Internal ChromaFormatIDC = ";
     1428    switch (m_acTEncTopList[i]->getChromaFormatIdc())
     1429#else
     1430    std::cout << std::setw(43) << "Output (internal) ChromaFormatIDC = ";
     1431    switch (m_cTEncTop.getChromaFormatIdc())
     1432#endif
     1433    {
     1434    case CHROMA_400:  std::cout << "  4:0:0"; break;
     1435    case CHROMA_420:  std::cout << "  4:2:0"; break;
     1436    case CHROMA_422:  std::cout << "  4:2:2"; break;
     1437    case CHROMA_444:  std::cout << "  4:4:4"; break;
     1438    default:
     1439      std::cerr << "Invalid";
     1440      exit(1);
     1441    }
     1442#if NH_MV
     1443    std::cout << std::endl;
     1444  }
     1445#endif
     1446  std::cout << "\n" << std::endl;
    12541447}
    12551448
     
    13291522#endif
    13301523
    1331 #if H_MV
     1524#if NH_MV
    13321525Void TAppEncTop::xSetDimensionIdAndLength( TComVPS& vps )
    13331526{   
     
    13371530    vps.setDimensionIdLen( dim, m_dimensionIdLen[ dim ] );
    13381531    for( Int layer = 0; layer <= vps.getMaxLayersMinus1(); layer++ )
    1339 
    13401532    {       
    13411533      vps.setDimensionId( layer, dim, m_dimIds[ dim ][ layer ] );       
     
    13581550
    13591551
    1360 #if H_3D
     1552#if NH_3D
    13611553  vps.initViewCompLayer( );
    13621554#endif
     
    14371629      Int curLayerIdInNuh = vps.getLayerIdInNuh( curLayerIdInVps );     
    14381630      Int maxTid = -1;
    1439 #if H_3D
     1631#if NH_3D
    14401632      if ( vps.getDirectDependencyFlag( curLayerIdInVps, refLayerIdInVps ) )
    14411633      {
     
    14491641            for (Int j = 0; j < geCur.m_numActiveRefLayerPics; j++)
    14501642            {
    1451 #if H_3D
     1643#if NH_3D
    14521644              if ( vps.getIdRefListLayer( curLayerIdInNuh, geCur.m_interLayerPredLayerIdc[ j ] ) == refLayerIdInNuh )
    14531645#else
     
    14601652            }
    14611653          }             
    1462 #if H_3D
     1654#if NH_3D
    14631655        }
    14641656        else
     
    15541746     
    15551747      // check if all reference layers when allRefLayerActiveFlag is equal to 1 are reference layer pictures specified in the gop entry
    1556 #if H_3D
     1748#if NH_3D
    15571749      for (Int k = 0; k < vps.getNumRefListLayers( layerIdInNuh ) && allRefLayersActiveFlag; k++ )
    15581750      {
     
    15801772      {   
    15811773        Bool referenceLayerFoundFlag = false;
    1582 #if H_3D
     1774#if NH_3D
    15831775        for (Int k = 0; k < vps.getNumRefListLayers( layerIdInNuh ); k++ )
    15841776        {
     
    16191811}
    16201812
     1813
     1814Void TAppEncTop::xSetTimingInfo( TComVPS& vps )
     1815{
     1816  vps.getTimingInfo()->setTimingInfoPresentFlag( false );
     1817}
     1818
     1819Void TAppEncTop::xSetHrdParameters( TComVPS& vps )
     1820{
     1821  vps.createHrdParamBuffer();
     1822  for( Int i = 0; i < vps.getNumHrdParameters(); i++ )
     1823  {
     1824    vps.setHrdOpSetIdx( 0, i );
     1825    vps.setCprmsPresentFlag( false, i );
     1826  }
     1827}
     1828
    16211829Void TAppEncTop::xSetLayerIds( TComVPS& vps )
    16221830{
    16231831  vps.setSplittingFlag     ( m_splittingFlag );
    16241832
    1625   Bool nuhLayerIdPresentFlag = !( m_layerIdInNuh.size() == 1 );
    1626   Int  maxNuhLayerId = nuhLayerIdPresentFlag ? xGetMax( m_layerIdInNuh ) : ( m_numberOfLayers - 1 ) ;
    1627 
    1628   vps.setVpsMaxLayerId( maxNuhLayerId );
     1833  Bool nuhLayerIdPresentFlag = false;
     1834 
     1835
     1836  vps.setVpsMaxLayerId( xGetMax( m_layerIdInNuh ) );
     1837
     1838  for (Int i = 0; i < m_numberOfLayers; i++)
     1839  {
     1840    nuhLayerIdPresentFlag = nuhLayerIdPresentFlag || ( m_layerIdInNuh[i] != i );
     1841  }
     1842
    16291843  vps.setVpsNuhLayerIdPresentFlag( nuhLayerIdPresentFlag );
    16301844
     
    16501864
    16511865  // SET PTL
    1652   assert( m_profile.size() == m_level.size() && m_profile.size() == m_levelTier.size() );
    1653   vps.setVpsNumProfileTierLevelMinus1( (Int) m_profile.size() - 1 );
     1866  assert( m_profiles.size() == m_level.size() && m_profiles.size() == m_levelTier.size() );
     1867  vps.setVpsNumProfileTierLevelMinus1( (Int) m_profiles.size() - 1 );
    16541868  for ( Int ptlIdx = 0; ptlIdx <= vps.getVpsNumProfileTierLevelMinus1(); ptlIdx++ )
    16551869  {
    16561870    if ( ptlIdx > 1 )
    16571871    {
    1658       Bool vpsProfilePresentFlag = ( m_profile[ptlIdx] != m_profile[ptlIdx - 1] )
     1872      Bool vpsProfilePresentFlag = ( m_profiles[ptlIdx] != m_profiles[ptlIdx - 1] )
    16591873        || ( m_inblFlag[ptlIdx ] != m_inblFlag[ptlIdx - 1] );
    16601874      vps.setVpsProfilePresentFlag( ptlIdx, vpsProfilePresentFlag );
    16611875    }
    16621876
    1663     xSetProfileTierLevel( vps, ptlIdx, -1, m_profile[ptlIdx], m_level[ptlIdx],
     1877    xSetProfileTierLevel( vps, ptlIdx, -1, m_profiles[ptlIdx], m_level[ptlIdx],
    16641878      m_levelTier[ ptlIdx ], m_progressiveSourceFlag, m_interlacedSourceFlag,
    16651879      m_nonPackedConstraintFlag, m_frameOnlyConstraintFlag,  m_inblFlag[ptlIdx] );     
     
    16951909    break;
    16961910  case Profile::MULTIVIEWMAIN:
    1697 #if H_3D
     1911#if NH_3D
    16981912  case Profile::MAIN3D:
    16991913#endif
     
    17181932{
    17191933
    1720 #if H_3D_DISABLE_CHROMA
    17211934  Bool anyDepth = false;
     1935#if NH_3D
    17221936  for ( Int i = 0; i < m_numberOfLayers; i++ )
    17231937  {
    17241938    vps.setVpsRepFormatIdx( i, m_depthFlag[ i ] ? 1 : 0 );
    1725     anyDepth = anyDepth || m_depthFlag[ i ];
    1726   } 
     1939    anyDepth = anyDepth || m_depthFlag[ i ];
     1940  }
     1941#endif
    17271942
    17281943  vps.setRepFormatIdxPresentFlag( anyDepth );
    1729   vps.setVpsNumRepFormatsMinus1 ( anyDepth ? 1 : 0  );
    1730 
     1944  vps.setVpsNumRepFormatsMinus1 ( anyDepth ? 1 : 0     );
     1945
     1946
     1947  std::vector<TComRepFormat> repFormat;
     1948  repFormat.resize( vps.getVpsNumRepFormatsMinus1() + 1 );
    17311949  for ( Int j = 0; j <= vps.getVpsNumRepFormatsMinus1(); j++ )
    1732   {
    1733     TComRepFormat* repFormat = new TComRepFormat;
    1734 
    1735     repFormat->setBitDepthVpsChromaMinus8   ( g_bitDepthC - 8 );
    1736     repFormat->setBitDepthVpsLumaMinus8     ( g_bitDepthY - 8 );
    1737     repFormat->setChromaFormatVpsIdc        ( j == 1 ? CHROMA_400 : CHROMA_420 );
    1738     repFormat->setPicHeightVpsInLumaSamples ( m_iSourceHeight );
    1739     repFormat->setPicWidthVpsInLumaSamples  ( m_iSourceWidth  );   
    1740     repFormat->setChromaAndBitDepthVpsPresentFlag( true );   
     1950  {           
     1951    repFormat[j].setBitDepthVpsChromaMinus8   ( m_internalBitDepth[CHANNEL_TYPE_LUMA  ] - 8 );
     1952    repFormat[j].setBitDepthVpsLumaMinus8     ( m_internalBitDepth[CHANNEL_TYPE_CHROMA] - 8 );
     1953    repFormat[j].setChromaFormatVpsIdc        ( j == 1 ? CHROMA_400 :  CHROMA_420 );
     1954    repFormat[j].setPicHeightVpsInLumaSamples ( m_iSourceHeight );
     1955    repFormat[j].setPicWidthVpsInLumaSamples  ( m_iSourceWidth  );   
     1956    repFormat[j].setChromaAndBitDepthVpsPresentFlag( true );   
    17411957    // ToDo not supported yet.
    17421958    //repFormat->setSeparateColourPlaneVpsFlag( );
    1743     Bool conformanceWindowVpsFlag = ( m_confWinBottom != 0 ) || ( m_confWinRight != 0 ) || ( m_confWinTop != 0 ) || ( m_confWinBottom != 0 );
    1744     repFormat->setConformanceWindowVpsFlag( conformanceWindowVpsFlag );
    1745     if ( conformanceWindowVpsFlag )
    1746     {   
    1747       repFormat->setConfWinVpsLeftOffset    ( m_confWinLeft   / TComSPS::getWinUnitX( repFormat->getChromaFormatVpsIdc() ) );
    1748       repFormat->setConfWinVpsRightOffset   ( m_confWinRight  / TComSPS::getWinUnitX( repFormat->getChromaFormatVpsIdc() )  );
    1749       repFormat->setConfWinVpsTopOffset     ( m_confWinTop    / TComSPS::getWinUnitY( repFormat->getChromaFormatVpsIdc() )  );
    1750       repFormat->setConfWinVpsBottomOffset  ( m_confWinBottom / TComSPS::getWinUnitY( repFormat->getChromaFormatVpsIdc() ) );
    1751     }
    1752     assert( vps.getRepFormat( j ) == NULL );
    1753     vps.setRepFormat( j , repFormat );
    1754   };
    1755 
    1756 
    1757 #else
    1758   vps.setRepFormatIdxPresentFlag( false );
    1759   vps.setVpsNumRepFormatsMinus1 ( 0    );
    1760 
    1761   TComRepFormat* repFormat = new TComRepFormat;
    1762 
    1763   repFormat->setBitDepthVpsChromaMinus8   ( g_bitDepthC - 8 );
    1764   repFormat->setBitDepthVpsLumaMinus8     ( g_bitDepthY - 8 );
    1765   repFormat->setChromaFormatVpsIdc        ( CHROMA_420      );
    1766   repFormat->setPicHeightVpsInLumaSamples ( m_iSourceHeight );
    1767   repFormat->setPicWidthVpsInLumaSamples  ( m_iSourceWidth  );   
    1768   repFormat->setChromaAndBitDepthVpsPresentFlag( true );   
    1769   // ToDo not supported yet.
    1770   //repFormat->setSeparateColourPlaneVpsFlag( );
    1771 
    1772   repFormat->setConformanceWindowVpsFlag( true );
    1773   repFormat->setConfWinVpsLeftOffset    ( m_confWinLeft   / TComSPS::getWinUnitX( repFormat->getChromaFormatVpsIdc() ) );
    1774   repFormat->setConfWinVpsRightOffset   ( m_confWinRight  / TComSPS::getWinUnitX( repFormat->getChromaFormatVpsIdc() )  );
    1775   repFormat->setConfWinVpsTopOffset     ( m_confWinTop    / TComSPS::getWinUnitY( repFormat->getChromaFormatVpsIdc() )  );
    1776   repFormat->setConfWinVpsBottomOffset  ( m_confWinBottom / TComSPS::getWinUnitY( repFormat->getChromaFormatVpsIdc() ) );
    1777   assert( vps.getRepFormat( 0 ) == NULL );
    1778   vps.setRepFormat( 0 , repFormat );
    1779 #endif
     1959
     1960    repFormat[j].setConformanceWindowVpsFlag( true );
     1961    repFormat[j].setConfWinVpsLeftOffset    ( m_confWinLeft   / TComSPS::getWinUnitX( repFormat[j].getChromaFormatVpsIdc() ) );
     1962    repFormat[j].setConfWinVpsRightOffset   ( m_confWinRight  / TComSPS::getWinUnitX( repFormat[j].getChromaFormatVpsIdc() )  );
     1963    repFormat[j].setConfWinVpsTopOffset     ( m_confWinTop    / TComSPS::getWinUnitY( repFormat[j].getChromaFormatVpsIdc() )  );
     1964    repFormat[j].setConfWinVpsBottomOffset  ( m_confWinBottom / TComSPS::getWinUnitY( repFormat[j].getChromaFormatVpsIdc() ) );
     1965  }
     1966
     1967  vps.setRepFormat( repFormat );
     1968
    17801969}
    17811970
     
    17841973  // These settings need to be verified
    17851974
    1786   TComDpbSize* dpbSize = vps.getDpbSize();
    1787 
    1788   assert ( dpbSize != 0 );
     1975  TComDpbSize dpbSize; 
     1976  dpbSize.init( vps.getNumOutputLayerSets(), vps.getVpsMaxLayerId() + 1, vps.getMaxSubLayersMinus1() + 1 ) ;
     1977 
    17891978
    17901979  for( Int i = 0; i < vps.getNumOutputLayerSets(); i++ )
     
    18011990        if ( vps.getNecessaryLayerFlag( i,k ) && ( vps.getVpsBaseLayerInternalFlag() || vps.getLayerSetLayerIdList( currLsIdx, k ) != 0 ) )
    18021991        {       
    1803           dpbSize->setMaxVpsDecPicBufferingMinus1( i, k, j, m_maxDecPicBufferingMvc[ layerIdInVps ][ j ] - 1 );
     1992          dpbSize.setMaxVpsDecPicBufferingMinus1( i, k, j, m_maxDecPicBufferingMvc[ layerIdInVps ][ j ] - 1 );
    18041993          if ( j > 0 )
    18051994          {
    1806             subLayerDpbInfoPresentFlag = subLayerDpbInfoPresentFlag || ( dpbSize->getMaxVpsDecPicBufferingMinus1( i, k, j ) != dpbSize->getMaxVpsDecPicBufferingMinus1( i, k, j - 1 ) );
     1995            subLayerDpbInfoPresentFlag = subLayerDpbInfoPresentFlag || ( dpbSize.getMaxVpsDecPicBufferingMinus1( i, k, j ) != dpbSize.getMaxVpsDecPicBufferingMinus1( i, k, j - 1 ) );
    18071996          }
    18081997        }
     
    18112000          if (vps.getNecessaryLayerFlag(i,k) && j == 0 && k == 0 )
    18122001          {         
    1813             dpbSize->setMaxVpsDecPicBufferingMinus1(i, k ,j, 0 );
     2002            dpbSize.setMaxVpsDecPicBufferingMinus1(i, k ,j, 0 );
    18142003          }
    18152004        }
     
    18272016      assert( maxNumReorderPics != MIN_INT );
    18282017
    1829       dpbSize->setMaxVpsNumReorderPics( i, j, maxNumReorderPics );
     2018      dpbSize.setMaxVpsNumReorderPics( i, j, maxNumReorderPics );
    18302019      if ( j > 0 )
    18312020      {
    1832         subLayerDpbInfoPresentFlag = subLayerDpbInfoPresentFlag || ( dpbSize->getMaxVpsNumReorderPics( i, j ) != dpbSize->getMaxVpsNumReorderPics( i, j - 1 ) );
     2021        subLayerDpbInfoPresentFlag = subLayerDpbInfoPresentFlag || ( dpbSize.getMaxVpsNumReorderPics( i, j ) != dpbSize.getMaxVpsNumReorderPics( i, j - 1 ) );
    18332022      }
    18342023
    18352024      // To Be Done !
    1836       // dpbSize->setMaxVpsLatencyIncreasePlus1( i, j, xx );
     2025      // dpbSize.setMaxVpsLatencyIncreasePlus1( i, j, xx );
    18372026      if ( j > 0 )
    18382027      {
    1839         subLayerDpbInfoPresentFlag = subLayerDpbInfoPresentFlag || ( dpbSize->getMaxVpsLatencyIncreasePlus1( i, j ) != dpbSize->getMaxVpsLatencyIncreasePlus1( i, j - 1  ) );
     2028        subLayerDpbInfoPresentFlag = subLayerDpbInfoPresentFlag || ( dpbSize.getMaxVpsLatencyIncreasePlus1( i, j ) != dpbSize.getMaxVpsLatencyIncreasePlus1( i, j - 1  ) );
    18402029      }
    18412030
    18422031      if( j > 0 ) 
    18432032      {
    1844         dpbSize->setSubLayerDpbInfoPresentFlag( i, j, subLayerDpbInfoPresentFlag );
     2033        dpbSize.setSubLayerDpbInfoPresentFlag( i, j, subLayerDpbInfoPresentFlag );
    18452034        subLayerFlagInfoPresentFlag = subLayerFlagInfoPresentFlag || subLayerDpbInfoPresentFlag;
    18462035      }       
    18472036    } 
    1848     dpbSize->setSubLayerFlagInfoPresentFlag( i, subLayerFlagInfoPresentFlag );
     2037    dpbSize.setSubLayerFlagInfoPresentFlag( i, subLayerFlagInfoPresentFlag );
    18492038  } 
     2039  vps.setDpbSize( dpbSize );
    18502040}
    18512041
     
    20102200  vps.setVpsVuiPresentFlag( m_vpsVuiPresentFlag );
    20112201
    2012   TComVPSVUI* pcVPSVUI = vps.getVPSVUI(  );
    2013   assert( pcVPSVUI );
     2202  TComVPSVUI vpsVui;
     2203  vpsVui.init(vps.getNumAddLayerSets(),vps.getMaxSubLayersMinus1() + 1, vps.getMaxLayersMinus1() + 1 );
    20142204
    20152205  if ( m_vpsVuiPresentFlag )
     
    20182208    // however preliminary setting it from input parameters
    20192209
    2020     pcVPSVUI->setCrossLayerPicTypeAlignedFlag( m_crossLayerPicTypeAlignedFlag );
    2021     pcVPSVUI->setCrossLayerIrapAlignedFlag   ( m_crossLayerIrapAlignedFlag    );
    2022     pcVPSVUI->setAllLayersIdrAlignedFlag     ( m_allLayersIdrAlignedFlag      );
    2023     pcVPSVUI->setBitRatePresentVpsFlag( m_bitRatePresentVpsFlag );
    2024     pcVPSVUI->setPicRatePresentVpsFlag( m_picRatePresentVpsFlag );
    2025 
    2026     if( pcVPSVUI->getBitRatePresentVpsFlag( )  ||  pcVPSVUI->getPicRatePresentVpsFlag( ) )
     2210    vpsVui.setCrossLayerPicTypeAlignedFlag( m_crossLayerPicTypeAlignedFlag );
     2211    vpsVui.setCrossLayerIrapAlignedFlag   ( m_crossLayerIrapAlignedFlag    );
     2212    vpsVui.setAllLayersIdrAlignedFlag     ( m_allLayersIdrAlignedFlag      );
     2213    vpsVui.setBitRatePresentVpsFlag( m_bitRatePresentVpsFlag );
     2214    vpsVui.setPicRatePresentVpsFlag( m_picRatePresentVpsFlag );
     2215
     2216    if( vpsVui.getBitRatePresentVpsFlag( )  ||  vpsVui.getPicRatePresentVpsFlag( ) )
    20272217    {
    20282218      for( Int i = 0; i  <  vps.getNumLayerSets(); i++ )
     
    20302220        for( Int j = 0; j  <=  vps.getMaxTLayers(); j++ )
    20312221        {
    2032           if( pcVPSVUI->getBitRatePresentVpsFlag( ) && m_bitRatePresentFlag[i].size() > j )
     2222          if( vpsVui.getBitRatePresentVpsFlag( ) && m_bitRatePresentFlag[i].size() > j )
    20332223          {
    2034             pcVPSVUI->setBitRatePresentFlag( i, j, m_bitRatePresentFlag[i][j] );           
     2224            vpsVui.setBitRatePresentFlag( i, j, m_bitRatePresentFlag[i][j] );           
    20352225          }
    2036           if( pcVPSVUI->getPicRatePresentVpsFlag( ) && m_picRatePresentFlag[i].size() > j   )
     2226          if( vpsVui.getPicRatePresentVpsFlag( ) && m_picRatePresentFlag[i].size() > j   )
    20372227          {
    2038             pcVPSVUI->setPicRatePresentFlag( i, j, m_picRatePresentFlag[i][j] );
     2228            vpsVui.setPicRatePresentFlag( i, j, m_picRatePresentFlag[i][j] );
    20392229          }
    2040           if( pcVPSVUI->getBitRatePresentFlag( i, j )  && m_avgBitRate[i].size() > j )
     2230          if( vpsVui.getBitRatePresentFlag( i, j )  && m_avgBitRate[i].size() > j )
    20412231          {
    2042             pcVPSVUI->setAvgBitRate( i, j, m_avgBitRate[i][j] );         
     2232            vpsVui.setAvgBitRate( i, j, m_avgBitRate[i][j] );         
    20432233          }
    2044           if( pcVPSVUI->getBitRatePresentFlag( i, j )  && m_maxBitRate[i].size() > j )
     2234          if( vpsVui.getBitRatePresentFlag( i, j )  && m_maxBitRate[i].size() > j )
    20452235          {
    2046             pcVPSVUI->setMaxBitRate( i, j, m_maxBitRate[i][j] );
     2236            vpsVui.setMaxBitRate( i, j, m_maxBitRate[i][j] );
    20472237          }
    2048           if( pcVPSVUI->getPicRatePresentFlag( i, j ) && m_constantPicRateIdc[i].size() > j )
     2238          if( vpsVui.getPicRatePresentFlag( i, j ) && m_constantPicRateIdc[i].size() > j )
    20492239          {
    2050             pcVPSVUI->setConstantPicRateIdc( i, j, m_constantPicRateIdc[i][j] );
     2240            vpsVui.setConstantPicRateIdc( i, j, m_constantPicRateIdc[i][j] );
    20512241          }
    2052           if( pcVPSVUI->getPicRatePresentFlag( i, j ) && m_avgPicRate[i].size() > j )
     2242          if( vpsVui.getPicRatePresentFlag( i, j ) && m_avgPicRate[i].size() > j )
    20532243          {
    2054             pcVPSVUI->setAvgPicRate( i, j, m_avgPicRate[i][j] );
     2244            vpsVui.setAvgPicRate( i, j, m_avgPicRate[i][j] );
    20552245          }
    20562246        }
     
    20582248    }
    20592249
    2060     pcVPSVUI->setTilesNotInUseFlag( m_tilesNotInUseFlag );
    2061 
    2062     if( !pcVPSVUI->getTilesNotInUseFlag() )
     2250    vpsVui.setTilesNotInUseFlag( m_tilesNotInUseFlag );
     2251
     2252    if( !vpsVui.getTilesNotInUseFlag() )
    20632253    {     
    20642254      for( Int i = 0; i  <=  vps.getMaxLayersMinus1(); i++ )
    20652255      {
    2066         pcVPSVUI->setTilesInUseFlag( i, m_tilesInUseFlag[ i ] );
    2067         if( pcVPSVUI->getTilesInUseFlag( i ) ) 
     2256        vpsVui.setTilesInUseFlag( i, m_tilesInUseFlag[ i ] );
     2257        if( vpsVui.getTilesInUseFlag( i ) ) 
    20682258        {
    2069           pcVPSVUI->setLoopFilterNotAcrossTilesFlag( i, m_loopFilterNotAcrossTilesFlag[ i ] );
     2259          vpsVui.setLoopFilterNotAcrossTilesFlag( i, m_loopFilterNotAcrossTilesFlag[ i ] );
    20702260        }
    20712261      } 
     
    20762266        { 
    20772267          Int layerIdx = vps.getLayerIdInVps( vps.getIdDirectRefLayer(vps.getLayerIdInNuh( i ) , j  )); 
    2078           if( pcVPSVUI->getTilesInUseFlag( i )  &&  pcVPSVUI->getTilesInUseFlag( layerIdx ) ) 
     2268          if( vpsVui.getTilesInUseFlag( i )  &&  vpsVui.getTilesInUseFlag( layerIdx ) ) 
    20792269          {
    2080             pcVPSVUI->setTileBoundariesAlignedFlag( i, j, m_tileBoundariesAlignedFlag[i][j] );
     2270            vpsVui.setTileBoundariesAlignedFlag( i, j, m_tileBoundariesAlignedFlag[i][j] );
    20812271          }
    20822272        } 
     
    20842274    } 
    20852275
    2086     pcVPSVUI->setWppNotInUseFlag( m_wppNotInUseFlag );
    2087 
    2088     if( !pcVPSVUI->getWppNotInUseFlag( ) )
     2276    vpsVui.setWppNotInUseFlag( m_wppNotInUseFlag );
     2277
     2278    if( !vpsVui.getWppNotInUseFlag( ) )
    20892279    {
    20902280      for( Int i = 1; i  <=  vps.getMaxLayersMinus1(); i++ ) 
    20912281      {
    2092         pcVPSVUI->setWppInUseFlag( i, m_wppInUseFlag[ i ]);
    2093       }
    2094     }
    2095 
    2096   pcVPSVUI->setSingleLayerForNonIrapFlag( m_singleLayerForNonIrapFlag );
    2097   pcVPSVUI->setHigherLayerIrapSkipFlag( m_higherLayerIrapSkipFlag );
    2098 
    2099     pcVPSVUI->setIlpRestrictedRefLayersFlag( m_ilpRestrictedRefLayersFlag );
    2100 
    2101     if( pcVPSVUI->getIlpRestrictedRefLayersFlag( ) )
     2282        vpsVui.setWppInUseFlag( i, m_wppInUseFlag[ i ]);
     2283      }
     2284    }
     2285
     2286  vpsVui.setSingleLayerForNonIrapFlag( m_singleLayerForNonIrapFlag );
     2287  vpsVui.setHigherLayerIrapSkipFlag( m_higherLayerIrapSkipFlag );
     2288
     2289    vpsVui.setIlpRestrictedRefLayersFlag( m_ilpRestrictedRefLayersFlag );
     2290
     2291    if( vpsVui.getIlpRestrictedRefLayersFlag( ) )
    21022292    {
    21032293      for( Int i = 1; i  <=  vps.getMaxLayersMinus1(); i++ )
     
    21072297          if ( m_minSpatialSegmentOffsetPlus1[i].size() > j )
    21082298          {       
    2109             pcVPSVUI->setMinSpatialSegmentOffsetPlus1( i, j, m_minSpatialSegmentOffsetPlus1[i][j] );
     2299            vpsVui.setMinSpatialSegmentOffsetPlus1( i, j, m_minSpatialSegmentOffsetPlus1[i][j] );
    21102300          }
    2111           if( pcVPSVUI->getMinSpatialSegmentOffsetPlus1( i, j ) > 0 )
     2301          if( vpsVui.getMinSpatialSegmentOffsetPlus1( i, j ) > 0 )
    21122302          {
    21132303            if ( m_ctuBasedOffsetEnabledFlag[i].size() > j )
    21142304            {       
    2115               pcVPSVUI->setCtuBasedOffsetEnabledFlag( i, j, m_ctuBasedOffsetEnabledFlag[i][j] );
     2305              vpsVui.setCtuBasedOffsetEnabledFlag( i, j, m_ctuBasedOffsetEnabledFlag[i][j] );
    21162306            }
    2117             if( pcVPSVUI->getCtuBasedOffsetEnabledFlag( i, j ) )
     2307            if( vpsVui.getCtuBasedOffsetEnabledFlag( i, j ) )
    21182308            {
    21192309              if ( m_minHorizontalCtuOffsetPlus1[i].size() > j )
    21202310              {
    2121                 pcVPSVUI->setMinHorizontalCtuOffsetPlus1( i, j, m_minHorizontalCtuOffsetPlus1[i][j] );
     2311                vpsVui.setMinHorizontalCtuOffsetPlus1( i, j, m_minHorizontalCtuOffsetPlus1[i][j] );
    21222312              }
    21232313            }
     
    21262316      }
    21272317    }     
    2128     pcVPSVUI->setVideoSignalInfoIdxPresentFlag( true );
    2129     pcVPSVUI->setVpsNumVideoSignalInfoMinus1  ( 0    );
    2130 
    2131     assert ( pcVPSVUI->getVideoSignalInfo( 0 ) == NULL );
    2132 
    2133     TComVideoSignalInfo* videoSignalInfo = new TComVideoSignalInfo;
    2134 
    2135     videoSignalInfo->setColourPrimariesVps        ( m_colourPrimaries );
    2136     videoSignalInfo->setMatrixCoeffsVps           ( m_matrixCoefficients );
    2137     videoSignalInfo->setTransferCharacteristicsVps( m_transferCharacteristics );
    2138     videoSignalInfo->setVideoVpsFormat            ( m_videoFormat );
    2139     videoSignalInfo->setVideoFullRangeVpsFlag     ( m_videoFullRangeFlag ); 
    2140 
    2141     pcVPSVUI->setVideoSignalInfo( 0, videoSignalInfo );       
     2318    vpsVui.setVideoSignalInfoIdxPresentFlag( true );
     2319    vpsVui.setVpsNumVideoSignalInfoMinus1  ( 0    );     
     2320
     2321    std::vector<TComVideoSignalInfo> videoSignalInfos;
     2322    videoSignalInfos.resize( vpsVui.getVpsNumVideoSignalInfoMinus1() + 1 );
     2323
     2324    videoSignalInfos[0].setColourPrimariesVps        ( m_colourPrimaries );
     2325    videoSignalInfos[0].setMatrixCoeffsVps           ( m_matrixCoefficients );
     2326    videoSignalInfos[0].setTransferCharacteristicsVps( m_transferCharacteristics );
     2327    videoSignalInfos[0].setVideoVpsFormat            ( m_videoFormat );
     2328    videoSignalInfos[0].setVideoFullRangeVpsFlag     ( m_videoFullRangeFlag ); 
     2329
     2330    vpsVui.setVideoSignalInfo( videoSignalInfos );       
    21422331
    21432332    for (Int i = 0; i < m_numberOfLayers; i++)
    21442333    {     
    2145       pcVPSVUI->setVpsVideoSignalInfoIdx( i, 0 );
    2146     }
    2147     pcVPSVUI->setVpsVuiBspHrdPresentFlag( false ); // TBD
     2334      vpsVui.setVpsVideoSignalInfoIdx( i, 0 );
     2335    }
     2336    vpsVui.setVpsVuiBspHrdPresentFlag( false ); // TBD
    21482337  }
    21492338  else
    21502339  {
    2151     pcVPSVUI->setCrossLayerIrapAlignedFlag   ( false   );
    2152   }
    2153 }
    2154 
    2155 #if H_3D
     2340    //Default inference when not present.
     2341    vpsVui.setCrossLayerIrapAlignedFlag   ( false   );
     2342  }
     2343  vps.setVPSVUI( vpsVui );
     2344}
     2345
     2346#if NH_3D
    21562347Void TAppEncTop::xSetCamPara                ( TComVPS& vps )
    21572348{
  • branches/HTM-14.1-update-dev0/source/App/TAppEncoder/TAppEncTop.h

    r1196 r1200  
    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 *
     
    4646#include "TLibCommon/AccessUnit.h"
    4747#include "TAppEncCfg.h"
    48 #if H_3D
     48#if NH_3D
    4949#include "../../Lib/TLibRenderer/TRenTop.h"
    5050#endif
     
    6565private:
    6666  // class interface
    67 #if H_MV
     67#if NH_MV
    6868  std::vector<TEncTop*>      m_acTEncTopList ;              ///< encoder class per layer
    6969  std::vector<TVideoIOYuv*>  m_acTVideoIOYuvInputFileList;  ///< input YUV file
    7070  std::vector<TVideoIOYuv*>  m_acTVideoIOYuvReconFileList;  ///< output reconstruction file
    7171 
    72   std::vector<TComList<TComPicYuv*>*>  m_picYuvRec;         ///< list of reconstruction YUV files
     72  std::vector<TComList<TComPicYuv*>*>  m_cListPicYuvRec;         ///< list of reconstruction YUV files
    7373
    7474  std::vector<Int>           m_frameRcvd;                   ///< number of received frames
    7575
    7676  TComPicLists               m_ivPicLists;                  ///< picture buffers of encoder instances
    77 #if H_MV
     77#if NH_MV
    7878  TComVPS*                   m_vps;                         ///< vps
    7979#else
     
    8484  TVideoIOYuv                m_cTVideoIOYuvInputFile;       ///< input YUV file
    8585  TVideoIOYuv                m_cTVideoIOYuvReconFile;       ///< output reconstruction file
    86  
     86
    8787  TComList<TComPicYuv*>      m_cListPicYuvRec;              ///< list of reconstruction YUV files
    88  
     88
    8989  Int                        m_iFrameRcvd;                  ///< number of received frames
    9090#endif
     
    9292#if H_3D
    9393  TComDLT                    m_dlt;                         ///< dlt
     94#endif
     95#if NH_3D
    9496  TComSps3dExtension         m_sps3dExtension;              ///< Currently all layers share the same sps 3D Extension 
    9597#endif
     
    9799  UInt m_essentialBytes;
    98100  UInt m_totalBytes;
    99 #if H_3D_VSO
     101#if NH_3D_VSO
    100102  TRenTop                     m_cRendererTop;
    101103  TRenModel                   m_cRendererModel;   
     
    107109  Void  xInitLib          (Bool isFieldCoding);             ///< initialize encoder class
    108110  Void  xDestroyLib       ();                               ///< destroy encoder class
    109  
     111
    110112  /// obtain required buffers
    111 #if H_MV
     113#if NH_MV
    112114  Void  xGetBuffer(TComPicYuv*& rpcPicYuvRec, UInt layer);
    113115#else
     
    117119  /// delete allocated buffers
    118120  Void  xDeleteBuffer     ();
    119  
     121
    120122  // file I/O
    121 #if H_MV
     123#if NH_MV
    122124  Void xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, std::list<AccessUnit>& accessUnits, UInt layerId); ///< write bitstream to file
    123125#else
    124126  Void xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, const std::list<AccessUnit>& accessUnits); ///< write bitstream to file
    125127#endif
    126   void rateStatsAccum(const AccessUnit& au, const std::vector<UInt>& stats);
    127   void printRateSummary();
     128  Void rateStatsAccum(const AccessUnit& au, const std::vector<UInt>& stats);
     129  Void printRateSummary();
     130  Void printChromaFormat();
    128131
    129 #if H_MV
     132#if NH_MV
     133  Void xSetTimingInfo             ( TComVPS& vps );
     134  Void xSetHrdParameters          ( TComVPS& vps );
    130135  Void xSetLayerIds               ( TComVPS& vps ); 
    131136  Void xSetDimensionIdAndLength   ( TComVPS& vps );
     
    134139  Void xSetProfileTierLevel       ( TComVPS& vps );
    135140
    136   Void xSetProfileTierLevel( TComVPS& vps, Int profileTierLevelIdx, Int subLayer,                             
    137                              Profile::Name profile, Level::Name level, Level::Tier tier,
    138                              Bool progressiveSourceFlag, Bool interlacedSourceFlag,
    139                              Bool nonPackedConstraintFlag, Bool frameOnlyConstraintFlag,
    140                              Bool inbldFlag );
     141  Void xSetProfileTierLevel       ( TComVPS& vps, Int profileTierLevelIdx, Int subLayer,                             
     142                                    Profile::Name profile, Level::Name level, Level::Tier tier,
     143                                    Bool progressiveSourceFlag, Bool interlacedSourceFlag,
     144                                    Bool nonPackedConstraintFlag, Bool frameOnlyConstraintFlag,
     145                                    Bool inbldFlag );
    141146  Void xSetRepFormat              ( TComVPS& vps );
    142147  Void xSetDpbSize                ( TComVPS& vps );
    143148  Void xSetVPSVUI                 ( TComVPS& vps );
    144 #if H_3D
     149#if NH_3D
    145150  Void xSetCamPara                ( TComVPS& vps );
    146151#endif
     
    155160  Void  xAnalyzeInputBaseDepth(UInt layer, UInt uiNumFrames, TComVPS* vps, TComDLT* dlt);
    156161#endif
     162
    157163public:
    158164  TAppEncTop();
    159165  virtual ~TAppEncTop();
    160  
     166
    161167  Void        encode      ();                               ///< main encoding function
    162 #if H_MV
     168#if NH_MV
    163169  TEncTop*    getTEncTop( UInt layer ) { return  m_acTEncTopList[layer]; }  ///< return pointer to encoder class for specific layer
    164170#else
  • branches/HTM-14.1-update-dev0/source/App/TAppEncoder/encmain.cpp

    r1179 r1200  
    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 *
     
    4141#include "TAppCommon/program_options_lite.h"
    4242
    43 using namespace std;
    44 namespace po = df::program_options_lite;
    45 
    4643//! \ingroup TAppEncoder
    4744//! \{
     45
     46#include "../Lib/TLibCommon/Debug.h"
    4847
    4948// ====================================================================================================================
     
    5756  // print information
    5857  fprintf( stdout, "\n" );
    59 #if H_MV
     58#if NH_MV
    6059  fprintf( stdout, "3D-HTM Software: Encoder Version [%s] based on HM Version [%s]", NV_VERSION, HM_VERSION ); 
    6160#else
    62   fprintf( stdout, "HM software: Encoder Version [%s]", NV_VERSION );
     61  fprintf( stdout, "HM software: Encoder Version [%s] (including RExt)", NV_VERSION );
    6362#endif
    6463  fprintf( stdout, NVM_ONOS );
    6564  fprintf( stdout, NVM_COMPILEDBY );
    6665  fprintf( stdout, NVM_BITS );
    67   fprintf( stdout, "\n" );
     66  fprintf( stdout, "\n\n" );
    6867
    6968  // create application encoder class
     
    7675    {
    7776      cTAppEncTop.destroy();
     77#if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST
     78      EnvVar::printEnvVar();
     79#endif
    7880      return 1;
    7981    }
    8082  }
    81   catch (po::ParseFailure& e)
     83  catch (df::program_options_lite::ParseFailure &e)
    8284  {
    83     cerr << "Error parsing option \""<< e.arg <<"\" with argument \""<< e.val <<"\"." << endl;
     85    std::cerr << "Error parsing option \""<< e.arg <<"\" with argument \""<< e.val <<"\"." << std::endl;
    8486    return 1;
    8587  }
    8688
     89#if PRINT_MACRO_VALUES
     90  printMacroSettings();
     91#endif
     92
     93#if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST
     94  EnvVar::printEnvVarInUse();
     95#endif
     96
    8797  // starting time
    88   double dResult;
    89   long lBefore = clock();
     98  Double dResult;
     99  clock_t lBefore = clock();
    90100
    91101  // call encoding function
     
    93103
    94104  // ending time
    95   dResult = (double)(clock()-lBefore) / CLOCKS_PER_SEC;
     105  dResult = (Double)(clock()-lBefore) / CLOCKS_PER_SEC;
    96106  printf("\n Total Time: %12.3f sec.\n", dResult);
    97107
Note: See TracChangeset for help on using the changeset viewer.