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


Ignore:
Timestamp:
11 Jul 2018, 15:19:49 (6 years ago)
Author:
tech
Message:

Merged HTM-16.2-dev@1412

File:
1 edited

Legend:

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

    r1405 r1413  
    44 * granted under this license.
    55 *
    6  * Copyright (c) 2010-2016, ITU/ISO/IEC
     6 * Copyright (c) 2010-2017, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    4646#include "TAppCommon/program_options_lite.h"
    4747#include "TLibEncoder/TEncRateCtrl.h"
     48#if NH_MV
     49#include <set>
     50#endif
     51
    4852#ifdef WIN32
    4953#define strdup _strdup
     
    5761
    5862
    59 
    60 enum ExtendedProfileName // this is used for determining profile strings, where multiple profiles map to a single profile idc with various constraint flag combinations
     63#if !NH_MV
     64enum UIProfileName // this is used for determining profile strings, where multiple profiles map to a single profile idc with various constraint flag combinations
    6165{
    62   NONE = 0,
    63   MAIN = 1,
    64   MAIN10 = 2,
    65   MAINSTILLPICTURE = 3,
    66   MAINREXT = 4,
    67   HIGHTHROUGHPUTREXT = 5, // Placeholder profile for development
     66  UI_NONE = 0,
     67  UI_MAIN = 1,
     68  UI_MAIN10 = 2,
     69  UI_MAIN10_STILL_PICTURE=10002,
     70  UI_MAINSTILLPICTURE = 3,
     71  UI_MAINREXT = 4,
     72  UI_HIGHTHROUGHPUTREXT = 5,
    6873  // The following are RExt profiles, which would map to the MAINREXT profile idc.
    6974  // The enumeration indicates the bit-depth constraint in the bottom 2 digits
    7075  //                           the chroma format in the next digit
    71     //                           the intra constraint in the next digit
     76  //                           the intra constraint in the next digit (1 for no intra constraint, 2 for intra constraint)
    7277//                           If it is a RExt still picture, there is a '1' for the top digit.
    7378#if NH_MV
    74   MULTIVIEWMAIN = 6,
     79  UI_MULTIVIEWMAIN    = 6,
    7580#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
     81  UI_MAIN3D            = 8,
     82#endif
     83#endif
     84  UI_MONOCHROME_8      = 1008,
     85  UI_MONOCHROME_12     = 1012,
     86  UI_MONOCHROME_16     = 1016,
     87  UI_MAIN_12           = 1112,
     88  UI_MAIN_422_10       = 1210,
     89  UI_MAIN_422_12       = 1212,
     90  UI_MAIN_444          = 1308,
     91  UI_MAIN_444_10       = 1310,
     92  UI_MAIN_444_12       = 1312,
     93  UI_MAIN_444_16       = 1316, // non-standard profile definition, used for development purposes
     94  UI_MAIN_INTRA        = 2108,
     95  UI_MAIN_10_INTRA     = 2110,
     96  UI_MAIN_12_INTRA     = 2112,
     97  UI_MAIN_422_10_INTRA = 2210,
     98  UI_MAIN_422_12_INTRA = 2212,
     99  UI_MAIN_444_INTRA    = 2308,
     100  UI_MAIN_444_10_INTRA = 2310,
     101  UI_MAIN_444_12_INTRA = 2312,
     102  UI_MAIN_444_16_INTRA = 2316,
     103  UI_MAIN_444_STILL_PICTURE = 11308,
     104  UI_MAIN_444_16_STILL_PICTURE = 12316,
     105  // The following are high throughput profiles, which would map to the HIGHTHROUGHPUTREXT profile idc.
     106  // The enumeration indicates the bit-depth constraint in the bottom 2 digits
     107  //                           the chroma format in the next digit
     108  //                           the intra constraint in the next digit
     109  //                           There is a '2' for the top digit to indicate it is high throughput profile
     110 
     111  UI_HIGHTHROUGHPUT_444     = 21308,
     112  UI_HIGHTHROUGHPUT_444_10  = 21310,
     113  UI_HIGHTHROUGHPUT_444_14  = 21314,
     114  UI_HIGHTHROUGHPUT_444_16_INTRA  = 22316
    100115};
    101 
     116#endif
    102117
    103118//! \ingroup TAppEncoder
     
    112127, m_snrInternalColourSpace(false)
    113128, m_outputInternalColourSpace(false)
     129#if EXTENSION_360_VIDEO
     130, m_ext360(*this)
     131#endif
    114132{
    115133#if !NH_MV
     
    208226
    209227#if NH_MV
     228
     229GOPEntry* TAppEncCfg::xGetGopEntries(Int layerIdInVps)
     230{
     231  return m_GOPListMvc[ m_layerIdxInVpsToGopDefIdx[ layerIdInVps ] ];
     232}
     233
     234GOPEntry* TAppEncCfg::xGetGopEntry(Int layerIdInVps, Int poc)
     235{
     236  GOPEntry* geFound = NULL;
     237  for( Int i = 0; i < ( getGOPSize() + 1) && geFound == NULL ; i++ )
     238  {
     239    GOPEntry* ge = &(xGetGopEntries( layerIdInVps)[ ( i < getGOPSize()  ? i : MAX_GOP ) ]);
     240    if ( ge->m_POC == poc )
     241    {
     242      geFound = ge;       
     243    }
     244  }
     245  assert( geFound != NULL );
     246  return geFound;
     247}
     248
    210249Void TAppEncCfg::xParseSeiCfg()
    211250{
     
    239278  in>>entry.m_POC;
    240279  in>>entry.m_QPOffset;
    241 #if W0038_CQP_ADJ
     280#if X0038_LAMBDA_FROM_QP_CAPABILITY
     281  in>>entry.m_QPOffsetModelOffset;
     282  in>>entry.m_QPOffsetModelScale;
     283#endif
    242284  in>>entry.m_CbQPoffset;
    243285  in>>entry.m_CrQPoffset;
    244 #endif
    245286  in>>entry.m_QPFactor;
    246287  in>>entry.m_tcOffsetDiv2;
     
    302343  }
    303344}
     345
     346#if NH_MV
     347static inline std::vector<ChromaFormat> numberToChromaFormat(const IntAry1d val)
     348{
     349  std::vector<ChromaFormat> chromaFormats;
     350  for( Int i = 0; i < val.size(); i++)
     351  {
     352    chromaFormats.push_back( numberToChromaFormat( val[i] ) );
     353  }
     354  return chromaFormats;
     355}
     356#endif
     357
    304358
    305359static const struct MapStrToProfile
     
    314368  {"main10",               Profile::MAIN10             },
    315369  {"main-still-picture",   Profile::MAINSTILLPICTURE   },
     370  {"main10-still-picture", Profile::MAIN10             },
    316371  {"main-RExt",            Profile::MAINREXT           },
    317372  {"high-throughput-RExt", Profile::HIGHTHROUGHPUTREXT }
    318373#if NH_MV
    319   ,{"multiview-main"     , Profile::MULTIVIEWMAIN      },
     374  ,{"multiview-main"     , Profile::MULTIVIEWMAIN      }
     375#if NH_MV_ALLOW_NON_CONFORMING
     376  ,{"multiview-main_NONCONFORMING", Profile::MULTIVIEWMAIN_NONCONFORMING }
    320377#if NH_3D
    321    {"3d-main"            , Profile::MAIN3D             }
     378  ,{"3d-main_NONCONFORMING"       , Profile::MAIN3D_NONCONFORMING }
     379#endif
     380#endif
     381#if NH_3D
     382   ,{"3d-main"                    , Profile::MAIN3D             }   
    322383#endif
    323384#endif
     
    325386};
    326387
    327 static const struct MapStrToExtendedProfile
     388static const struct MapStrToUIProfileName
    328389{
    329390  const TChar* str;
    330   ExtendedProfileName value;
     391  UIProfileName value;
    331392}
    332 strToExtendedProfile[] =
     393strToUIProfileName[] =
    333394{
    334     {"none",               NONE             },
    335     {"main",               MAIN             },
    336     {"main10",             MAIN10           },
    337     {"main_still_picture",        MAINSTILLPICTURE },
    338     {"main-still-picture",        MAINSTILLPICTURE },
    339     {"main_RExt",                 MAINREXT         },
    340     {"main-RExt",                 MAINREXT         },
    341     {"main_rext",                 MAINREXT         },
    342     {"main-rext",                 MAINREXT         },
    343     {"high_throughput_RExt",      HIGHTHROUGHPUTREXT },
    344     {"high-throughput-RExt",      HIGHTHROUGHPUTREXT },
    345     {"high_throughput_rext",      HIGHTHROUGHPUTREXT },
    346     {"high-throughput-rext",      HIGHTHROUGHPUTREXT },
    347 #if NH_MV
    348     {"multiview-main"     , MULTIVIEWMAIN   },
     395    {"none",                      UI_NONE             },
     396    {"main",                      UI_MAIN             },
     397    {"main10",                    UI_MAIN10           },
     398    {"main10_still_picture",      UI_MAIN10_STILL_PICTURE },
     399    {"main10-still-picture",      UI_MAIN10_STILL_PICTURE },
     400    {"main_still_picture",        UI_MAINSTILLPICTURE },
     401    {"main-still-picture",        UI_MAINSTILLPICTURE },
     402    {"main_RExt",                 UI_MAINREXT         },
     403    {"main-RExt",                 UI_MAINREXT         },
     404    {"main_rext",                 UI_MAINREXT         },
     405    {"main-rext",                 UI_MAINREXT         },
     406    {"high_throughput_RExt",      UI_HIGHTHROUGHPUTREXT },
     407    {"high-throughput-RExt",      UI_HIGHTHROUGHPUTREXT },
     408    {"high_throughput_rext",      UI_HIGHTHROUGHPUTREXT },
     409    {"high-throughput-rext",      UI_HIGHTHROUGHPUTREXT },
     410#if NH_MV
     411    {"multiview-main"     , UI_MULTIVIEWMAIN   },
    349412#if NH_3D
    350     {"3d-main"            , MAIN3D          },
    351 #endif
    352 #endif
    353     {"monochrome",         MONOCHROME_8     },
    354     {"monochrome12",       MONOCHROME_12    },
    355     {"monochrome16",       MONOCHROME_16    },
    356     {"main12",             MAIN_12          },
    357     {"main_422_10",        MAIN_422_10      },
    358     {"main_422_12",        MAIN_422_12      },
    359     {"main_444",           MAIN_444         },
    360     {"main_444_10",        MAIN_444_10      },
    361     {"main_444_12",        MAIN_444_12      },
    362     {"main_444_16",        MAIN_444_16      },
    363     {"main_intra",         MAIN_INTRA       },
    364     {"main_10_intra",      MAIN_10_INTRA    },
    365     {"main_12_intra",      MAIN_12_INTRA    },
    366     {"main_422_10_intra",  MAIN_422_10_INTRA},
    367     {"main_422_12_intra",  MAIN_422_12_INTRA},
    368     {"main_444_intra",     MAIN_444_INTRA   },
    369     {"main_444_still_picture",    MAIN_444_STILL_PICTURE },
    370     {"main_444_10_intra",  MAIN_444_10_INTRA},
    371     {"main_444_12_intra",  MAIN_444_12_INTRA},
    372     {"main_444_16_intra",         MAIN_444_16_INTRA},
    373     {"main_444_16_still_picture", MAIN_444_16_STILL_PICTURE }
     413    {"3d-main"            , UI_MAIN3D          },
     414#endif
     415#if NH_MV_ALLOW_NON_CONFORMING
     416    {"multiview-main_NONCONFORMING"     , UI_MULTIVIEWMAIN_NONCONF   },
     417#if NH_3D
     418    {"3d-main_NONCONFORMING"            , UI_MAIN3D_NONCONF          },
     419#endif
     420#endif
     421#endif
     422    {"monochrome",                UI_MONOCHROME_8     },
     423    {"monochrome12",              UI_MONOCHROME_12    },
     424    {"monochrome16",              UI_MONOCHROME_16    },
     425    {"main12",                    UI_MAIN_12          },
     426    {"main_422_10",               UI_MAIN_422_10      },
     427    {"main_422_12",               UI_MAIN_422_12      },
     428    {"main_444",                  UI_MAIN_444         },
     429    {"main_444_10",               UI_MAIN_444_10      },
     430    {"main_444_12",               UI_MAIN_444_12      },
     431    {"main_444_16",               UI_MAIN_444_16      },
     432    {"main_intra",                UI_MAIN_INTRA       },
     433    {"main_10_intra",             UI_MAIN_10_INTRA    },
     434    {"main_12_intra",             UI_MAIN_12_INTRA    },
     435    {"main_422_10_intra",         UI_MAIN_422_10_INTRA},
     436    {"main_422_12_intra",         UI_MAIN_422_12_INTRA},
     437    {"main_444_intra",            UI_MAIN_444_INTRA   },
     438    {"main_444_still_picture",    UI_MAIN_444_STILL_PICTURE },
     439    {"main_444_10_intra",         UI_MAIN_444_10_INTRA},
     440    {"main_444_12_intra",         UI_MAIN_444_12_INTRA},
     441    {"main_444_16_intra",         UI_MAIN_444_16_INTRA},
     442    {"main_444_16_still_picture", UI_MAIN_444_16_STILL_PICTURE },
     443    {"high_throughput_444",       UI_HIGHTHROUGHPUT_444    },
     444    {"high_throughput_444_10",    UI_HIGHTHROUGHPUT_444_10 },
     445    {"high_throughput_444_14",    UI_HIGHTHROUGHPUT_444_14 },
     446    {"high_throughput_444_16_intra", UI_HIGHTHROUGHPUT_444_16_INTRA }
    374447};
    375448
    376 static const ExtendedProfileName validRExtProfileNames[2/* intraConstraintFlag*/][4/* bit depth constraint 8=0, 10=1, 12=2, 16=3*/][4/*chroma format*/]=
     449static const UIProfileName validRExtHighThroughPutProfileNames[2/* intraConstraintFlag*/][4/* bit depth constraint 8=0, 10=1, 12=2, 16=3*/]=
    377450{
    378     {
    379         { MONOCHROME_8,  NONE,          NONE,              MAIN_444          }, // 8-bit  inter for 400, 420, 422 and 444
    380         { NONE,          NONE,          MAIN_422_10,       MAIN_444_10       }, // 10-bit inter for 400, 420, 422 and 444
    381         { MONOCHROME_12, MAIN_12,       MAIN_422_12,       MAIN_444_12       }, // 12-bit inter for 400, 420, 422 and 444
    382         { MONOCHROME_16, NONE,          NONE,              MAIN_444_16       }  // 16-bit inter for 400, 420, 422 and 444 (the latter is non standard used for development)
     451    { UI_HIGHTHROUGHPUT_444,          UI_HIGHTHROUGHPUT_444_10,          UI_HIGHTHROUGHPUT_444_14,         UI_NONE                         }, // intraConstraintFlag 0 - 8-bit,10-bit,14-bit and 16-bit
     452    { UI_NONE,                        UI_NONE,                           UI_NONE,                          UI_HIGHTHROUGHPUT_444_16_INTRA  }  // intraConstraintFlag 1 - 8-bit,10-bit,14-bit and 16-bit
     453};
     454
     455static const UIProfileName validRExtProfileNames[2/* intraConstraintFlag*/][4/* bit depth constraint 8=0, 10=1, 12=2, 16=3*/][4/*chroma format*/]=
     456{
     457    {
     458        { UI_MONOCHROME_8,  UI_NONE,          UI_NONE,              UI_MAIN_444          }, // 8-bit  inter for 400, 420, 422 and 444
     459        { UI_NONE,          UI_NONE,          UI_MAIN_422_10,       UI_MAIN_444_10       }, // 10-bit inter for 400, 420, 422 and 444
     460        { UI_MONOCHROME_12, UI_MAIN_12,       UI_MAIN_422_12,       UI_MAIN_444_12       }, // 12-bit inter for 400, 420, 422 and 444
     461        { UI_MONOCHROME_16, UI_NONE,          UI_NONE,              UI_MAIN_444_16       }  // 16-bit inter for 400, 420, 422 and 444 (the latter is non standard used for development)
    383462    },
    384463    {
    385         { NONE,          MAIN_INTRA,    NONE,              MAIN_444_INTRA    }, // 8-bit  intra for 400, 420, 422 and 444
    386         { NONE,          MAIN_10_INTRA, MAIN_422_10_INTRA, MAIN_444_10_INTRA }, // 10-bit intra for 400, 420, 422 and 444
    387         { NONE,          MAIN_12_INTRA, MAIN_422_12_INTRA, MAIN_444_12_INTRA }, // 12-bit intra for 400, 420, 422 and 444
    388         { NONE,          NONE,          NONE,              MAIN_444_16_INTRA }  // 16-bit intra for 400, 420, 422 and 444
     464        { UI_NONE,          UI_MAIN_INTRA,    UI_NONE,              UI_MAIN_444_INTRA    }, // 8-bit  intra for 400, 420, 422 and 444
     465        { UI_NONE,          UI_MAIN_10_INTRA, UI_MAIN_422_10_INTRA, UI_MAIN_444_10_INTRA }, // 10-bit intra for 400, 420, 422 and 444
     466        { UI_NONE,          UI_MAIN_12_INTRA, UI_MAIN_422_12_INTRA, UI_MAIN_444_12_INTRA }, // 12-bit intra for 400, 420, 422 and 444
     467        { UI_NONE,          UI_NONE,          UI_NONE,              UI_MAIN_444_16_INTRA }  // 16-bit intra for 400, 420, 422 and 444
    389468    }
    390469};
     
    425504};
    426505
    427 #if U0132_TARGET_BITS_SATURATION
    428506UInt g_uiMaxCpbSize[2][21] =
    429507{
     
    432510  { 0, 0, 0,      0, 0, 0,       0,       0, 0,       0,        0, 0, 30000000, 50000000, 0, 100000000, 160000000, 240000000, 240000000, 480000000, 800000000 }
    433511};
    434 #endif
    435512
    436513static const struct MapStrToCostMode
     
    481558  in >> str;
    482559
    483   for (UInt i = 0; i < mapLen; i++)
    484   {
    485     if (str == map[i].str)
     560  UInt i=0;
     561  for (; i < mapLen && str!=map[i].str; i++);
     562
     563  if (i < mapLen)
    486564    {
    487565      val = map[i].value;
    488       goto found;
    489     }
    490   }
    491   /* not found */
     566    }
     567  else
     568  {
    492569  in.setstate(ios::failbit);
    493 found:
     570  }
    494571  return in;
    495572}
     
    497574//inline to prevent compiler warnings for "unused static function"
    498575
    499 static inline istream& operator >> (istream &in, ExtendedProfileName &profile)
     576static inline istream& operator >> (istream &in, UIProfileName &profile)
    500577{
    501   return readStrToEnum(strToExtendedProfile, sizeof(strToExtendedProfile)/sizeof(*strToExtendedProfile), in, profile);
     578  return readStrToEnum(strToUIProfileName, sizeof(strToUIProfileName)/sizeof(*strToUIProfileName), in, profile);
    502579}
    503580
     
    640717}
    641718
     719#if JVET_E0059_FLOATING_POINT_QP_FIX
     720template <class T>
     721static inline istream& operator >> (std::istream &in, TAppEncCfg::OptionalValue<T> &value)
     722{
     723  in >> std::ws;
     724  if (in.eof())
     725  {
     726    value.bPresent=false;
     727  }
     728  else
     729  {
     730    in >> value.value;
     731    value.bPresent=true;
     732  }
     733  return in;
     734}
     735#endif
     736
    642737static Void
    643738automaticallySelectRExtProfile(const Bool bUsingGeneralRExtTools,
     
    740835#endif
    741836
     837#if NH_MV
     838  IntAry1d tmpInputChromaFormat;
     839  IntAry1d tmpChromaFormat;
     840#if NH_3D
     841  IntAry1d tmpChromaFormatInit;
     842  tmpChromaFormatInit.push_back(420);
     843  tmpChromaFormatInit.push_back(400);
     844#endif
     845  IntAry2d tmpPad(2);
     846
     847  IntAry2d tmpInputBitDepth      (2);
     848  IntAry2d tmpOutputBitDepth     (2);
     849  IntAry2d tmpMSBExtendedBitDepth(2);
     850  IntAry2d tmpInternalBitDepth   (2);
     851
     852#else
     853  Int tmpInputChromaFormat;
    742854  Int tmpChromaFormat;
    743   Int tmpInputChromaFormat;
    744855  Int tmpConstraintChromaFormat;
     856#endif
    745857  Int tmpWeightedPredictionMethod;
    746858  Int tmpFastInterSearchMode;
     
    751863  string inputColourSpaceConvert;
    752864#if NH_MV
    753   std::vector<ExtendedProfileName> extendedProfiles;
    754 #else
    755   ExtendedProfileName extendedProfile;
     865  std::vector<UIProfileName> UIProfiles;
     866#else
     867  UIProfileName UIProfile;
    756868#endif
    757869  Int saoOffsetBitShift[MAX_NUM_CHANNEL_TYPE];
     
    766878  SMultiValueInput<Double> cfg_adIntraLambdaModifier         (0, std::numeric_limits<Double>::max(), 0, MAX_TLAYER); ///< Lambda modifier for Intra pictures, one for each temporal layer. If size>temporalLayer, then use [temporalLayer], else if size>0, use [size()-1], else use m_adLambdaModifier.
    767879
     880  const Int defaultLumaLevelTodQp_QpChangePoints[]   =  {-3,  -2,  -1,   0,   1,   2,   3,   4,   5,   6};
     881  const Int defaultLumaLevelTodQp_LumaChangePoints[] =  { 0, 301, 367, 434, 501, 567, 634, 701, 767, 834};
     882  SMultiValueInput<Int>  cfg_lumaLeveltoDQPMappingQP         (-MAX_QP, MAX_QP,                    0, LUMA_LEVEL_TO_DQP_LUT_MAXSIZE, defaultLumaLevelTodQp_QpChangePoints,   sizeof(defaultLumaLevelTodQp_QpChangePoints  )/sizeof(Int));
     883  SMultiValueInput<Int>  cfg_lumaLeveltoDQPMappingLuma       (0, std::numeric_limits<Int>::max(), 0, LUMA_LEVEL_TO_DQP_LUT_MAXSIZE, defaultLumaLevelTodQp_LumaChangePoints, sizeof(defaultLumaLevelTodQp_LumaChangePoints)/sizeof(Int));
     884  UInt lumaLevelToDeltaQPMode;
    768885
    769886  const UInt defaultInputKneeCodes[3]  = { 600, 800, 900 };
     
    842959  ("ProfileTierLevelIdx_%d"        , m_profileTierLevelIdx         , IntAry1d(0)  , MAX_NUM_LAYERS,                  "Indices to profile level tier for ols")
    843960  // Layer dependencies
    844   ("DirectRefLayers_%d"            , m_directRefLayers             , IntAry1d(0,0), MAX_NUM_LAYERS,                  "LayerIdx in VPS of direct reference layers")
    845   ("DependencyTypes_%d"            , m_dependencyTypes             , IntAry1d(0,0), MAX_NUM_LAYERS,                  "Dependency types of direct reference layers, 0: Sample 1: Motion 2: Sample+Motion")
    846 #endif
     961  ("DirectRefLayers_%d"            , m_directRefLayers               , IntAry1d(0,0), MAX_NUM_LAYERS,                  "LayerIdx in VPS of direct reference layers")
     962  ("DependencyTypes_%d"            , m_dependencyTypes               , IntAry1d(0,0), MAX_NUM_LAYERS,                  "Dependency types of direct reference layers, 0: Sample 1: Motion 2: Sample+Motion")
     963  ("ShareParameterSets"            , m_shareParameterSets            , false        ,                                  "Signal parameter sets only in the base layer.") 
     964  ("LayerIdxInVpsToGopDefIdx"      , m_layerIdxInVpsToGopDefIdx      , IntAry1d(0,0),                                  "Maps the layers to the GOP definitions in the cfg-file.")
     965  ("LayerIdxInVpsToRepFormatIdx"   , m_layerIdxInVpsToRepFormatIdx   , IntAry1d(0,0),                                  "Maps the layers to the vps representation formats, i.e. values of SourceWidth, SourceHeight, InternalBitDepth, ChromaFormatIDC, InputBitDepth, OutputBitDepth, MSBExtendedBitDepth, InputChromaFormat, ConfWinBottom, ConfWinTop, ConfWinRight, ConfWinLeft, VerticalPadding, HorizontalPadding." ) 
     966#endif
     967#if NH_MV
     968  ("SourceWidth,-wdt",                                m_iSourceWidths,                            IntAry1d(1,0), "Source picture width")
     969  ("SourceHeight,-hgt",                               m_iSourceHeights,                           IntAry1d(1,0), "Source picture height")
     970  ("InputBitDepth",                                   tmpInputBitDepth      [CHANNEL_TYPE_LUMA  ], IntAry1d(1,8), "Bit-depth of input file")
     971  ("OutputBitDepth",                                  tmpOutputBitDepth     [CHANNEL_TYPE_LUMA  ], IntAry1d(1,0), "Bit-depth of output file (default:InternalBitDepth)")
     972  ("MSBExtendedBitDepth",                             tmpMSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ], IntAry1d(1,0), "bit depth of luma component after addition of MSBs of value 0 (used for synthesising High Dynamic Range source material). (default:InputBitDepth)")
     973  ("InternalBitDepth",                                tmpInternalBitDepth   [CHANNEL_TYPE_LUMA  ], IntAry1d(1,0), "Bit-depth the codec operates at. (default:MSBExtendedBitDepth). If different to MSBExtendedBitDepth, source data will be converted")
     974  ("InputBitDepthC",                                  tmpInputBitDepth      [CHANNEL_TYPE_CHROMA], IntAry1d(1,0), "As per InputBitDepth but for chroma component. (default:InputBitDepth)")
     975  ("OutputBitDepthC",                                 tmpOutputBitDepth     [CHANNEL_TYPE_CHROMA], IntAry1d(1,0), "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
     976  ("MSBExtendedBitDepthC",                            tmpMSBExtendedBitDepth[CHANNEL_TYPE_CHROMA], IntAry1d(1,0), "As per MSBExtendedBitDepth but for chroma component. (default:MSBExtendedBitDepth)")
     977  ("InternalBitDepthC",                               tmpInternalBitDepth   [CHANNEL_TYPE_CHROMA], IntAry1d(1,0), "As per InternalBitDepth but for chroma component. (default:InternalBitDepth)")
     978#else
    847979  ("SourceWidth,-wdt",                                m_iSourceWidth,                                       0, "Source picture width")
    848980  ("SourceHeight,-hgt",                               m_iSourceHeight,                                      0, "Source picture height")
     
    855987  ("MSBExtendedBitDepthC",                            m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA],           0, "As per MSBExtendedBitDepth but for chroma component. (default:MSBExtendedBitDepth)")
    856988  ("InternalBitDepthC",                               m_internalBitDepth[CHANNEL_TYPE_CHROMA],              0, "As per InternalBitDepth but for chroma component. (default:InternalBitDepth)")
     989#endif
    857990  ("ExtendedPrecision",                               m_extendedPrecisionProcessingFlag,                false, "Increased internal accuracies to support high bit depths (not valid in V1 profiles)")
    858991  ("HighPrecisionPredictionWeighting",                m_highPrecisionOffsetsEnabledFlag,                false, "Use high precision option for weighted prediction (not valid in V1 profiles)")
     
    860993  ("SNRInternalColourSpace",                          m_snrInternalColourSpace,                         false, "If true, then no colour space conversion is applied prior to SNR, otherwise inverse of input is applied.")
    861994  ("OutputInternalColourSpace",                       m_outputInternalColourSpace,                      false, "If true, then no colour space conversion is applied for reconstructed video, otherwise inverse of input is applied.")
     995#if NH_MV
     996  ("InputChromaFormat",                               tmpInputChromaFormat,                   IntAry1d(1,420), "InputChromaFormatIDC")
     997#else
    862998  ("InputChromaFormat",                               tmpInputChromaFormat,                               420, "InputChromaFormatIDC")
     999#endif
    8631000  ("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")
    8641001  ("PrintFrameMSE",                                   m_printFrameMSE,                                  false, "0 (default) emit only bit count and PSNRs for each frame, 1 = also emit MSE values")
    8651002  ("PrintSequenceMSE",                                m_printSequenceMSE,                               false, "0 (default) emit only bit rate and PSNRs for the whole sequence, 1 = also emit MSE values")
     1003#if JVET_F0064_MSSSIM 
     1004  ("PrintMSSSIM",                                     m_printMSSSIM,                                    false, "0 (default) do not print MS-SSIM scores, 1 = print MS-SSIM scores for each frame and for the whole sequence")
     1005#endif
    8661006  ("CabacZeroWordPaddingEnabled",                     m_cabacZeroWordPaddingEnabled,                     true, "0 do not add conforming cabac-zero-words to bit streams, 1 (default) = add cabac-zero-words as required")
     1007#if NH_MV
     1008#if NH_3D
     1009  ("ChromaFormatIDC,-cf",                             tmpChromaFormat,                    tmpChromaFormatInit, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat)")
     1010#else
     1011  ("ChromaFormatIDC,-cf",                             tmpChromaFormat,                          IntAry1d(1,0), "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat)")
     1012#endif
     1013#else
    8671014  ("ChromaFormatIDC,-cf",                             tmpChromaFormat,                                      0, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat)")
     1015#endif
    8681016  ("ConformanceMode",                                 m_conformanceWindowMode,                              0, "Deprecated alias of ConformanceWindowMode")
    8691017  ("ConformanceWindowMode",                           m_conformanceWindowMode,                              0, "Window conformance mode (0: no window, 1:automatic padding, 2:padding, 3:conformance")
     1018#if NH_MV
     1019  ("HorizontalPadding,-pdx",                          tmpPad[0] ,                               IntAry1d(1,0), "Horizontal source padding for conformance window mode 2")
     1020  ("VerticalPadding,-pdy",                            tmpPad[1] ,                               IntAry1d(1,0), "Vertical source padding for conformance window mode 2")
     1021#else
    8701022  ("HorizontalPadding,-pdx",                          m_aiPad[0],                                           0, "Horizontal source padding for conformance window mode 2")
    8711023  ("VerticalPadding,-pdy",                            m_aiPad[1],                                           0, "Vertical source padding for conformance window mode 2")
     1024#endif
     1025
     1026#if NH_MV
     1027  ("ConfWinLeft",                                     m_confWinLefts,                         IntAry1d(1, 0) , "Left offset for window conformance mode 3")
     1028  ("ConfWinRight",                                    m_confWinRights,                        IntAry1d(1, 0) , "Right offset for window conformance mode 3")
     1029  ("ConfWinTop",                                      m_confWinTops,                          IntAry1d(1, 0) , "Top offset for window conformance mode 3")
     1030  ("ConfWinBottom",                                   m_confWinBottoms,                       IntAry1d(1, 0) , "Bottom offset for window conformance mode 3")
     1031#else
    8721032  ("ConfLeft",                                        m_confWinLeft,                                        0, "Deprecated alias of ConfWinLeft")
    8731033  ("ConfRight",                                       m_confWinRight,                                       0, "Deprecated alias of ConfWinRight")
    8741034  ("ConfTop",                                         m_confWinTop,                                         0, "Deprecated alias of ConfWinTop")
    8751035  ("ConfBottom",                                      m_confWinBottom,                                      0, "Deprecated alias of ConfWinBottom")
     1036
    8761037  ("ConfWinLeft",                                     m_confWinLeft,                                        0, "Left offset for window conformance mode 3")
    8771038  ("ConfWinRight",                                    m_confWinRight,                                       0, "Right offset for window conformance mode 3")
    8781039  ("ConfWinTop",                                      m_confWinTop,                                         0, "Top offset for window conformance mode 3")
    8791040  ("ConfWinBottom",                                   m_confWinBottom,                                      0, "Bottom offset for window conformance mode 3")
     1041#endif
     1042 
    8801043  ("AccessUnitDelimiter",                             m_AccessUnitDelimiter,                            false, "Enable Access Unit Delimiter NALUs")
    8811044  ("FrameRate,-fr",                                   m_iFrameRate,                                         0, "Frame rate")
     
    9011064  ("Tier"    ,                                        cfg_tiers  ,                                 string(""), "Tier indication in VpsProfileTierLevel (Indication only)")
    9021065  ("InblFlag",                                        m_inblFlag ,                       std::vector<Bool>(0), "InblFlags in VpsProfileTierLevel (Indication only)" )
    903 #else
    904   ("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")
     1066
     1067  ("MaxBitDepthConstraint",                           m_bitDepthConstraints,           std::vector<Int>( 1,0u) , "Bit depth to use for profile-constraint for RExt profiles. 0=automatically choose based upon other parameters")
     1068  ("MaxChromaFormatConstraint",                       m_tmpConstraintChromaFormats,    IntAry1d(1,     0)       , "Chroma-format to use for the profile-constraint for RExt profiles. 0=automatically choose based upon other parameters")
     1069  ("IntraConstraintFlag",                             m_intraConstraintFlags,          BoolAry1d(1,false)       , "Value of general_intra_constraint_flag to use for RExt profiles (not used if an explicit RExt sub-profile is specified)")
     1070  ("OnePictureOnlyConstraintFlag",                    m_onePictureOnlyConstraintFlags, BoolAry1d(1,false)       , "Value of general_one_picture_only_constraint_flag to use for RExt profiles (not used if an explicit RExt sub-profile is specified)")
     1071  ("LowerBitRateConstraintFlag",                      m_lowerBitRateConstraintFlags,   BoolAry1d(1,true)        , "Value of general_lower_bit_rate_constraint_flag to use for RExt profiles")
     1072  ("ProgressiveSource",                               m_progressiveSourceFlags,        BoolAry1d(1,false)       , "Indicate that source is progressive")
     1073  ("InterlacedSource",                                m_interlacedSourceFlags,         BoolAry1d(1,false)       , "Indicate that source is interlaced")
     1074  ("NonPackedSource",                                 m_nonPackedConstraintFlags,      BoolAry1d(1,false)       , "Indicate that source does not contain frame packing")
     1075  ("FrameOnly",                                       m_frameOnlyConstraintFlags,      BoolAry1d(1,false)       , "Indicate that the bitstream contains only frames")
     1076
     1077#else
     1078  ("Profile",                                         UIProfile,                                      UI_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")
    9051079  ("Level",                                           m_level,                                    Level::NONE, "Level limit to be used, eg 5.1, or none")
    9061080  ("Tier",                                            m_levelTier,                                Level::MAIN, "Tier to use for interpretation of --Level (main or high only)")
    907 #endif
    9081081  ("MaxBitDepthConstraint",                           m_bitDepthConstraint,                                0u, "Bit depth to use for profile-constraint for RExt profiles. 0=automatically choose based upon other parameters")
    9091082  ("MaxChromaFormatConstraint",                       tmpConstraintChromaFormat,                            0, "Chroma-format to use for the profile-constraint for RExt profiles. 0=automatically choose based upon other parameters")
     
    9111084  ("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)")
    9121085  ("LowerBitRateConstraintFlag",                      m_lowerBitRateConstraintFlag,                      true, "Value of general_lower_bit_rate_constraint_flag to use for RExt profiles")
    913 
    9141086  ("ProgressiveSource",                               m_progressiveSourceFlag,                          false, "Indicate that source is progressive")
    9151087  ("InterlacedSource",                                m_interlacedSourceFlag,                           false, "Indicate that source is interlaced")
    9161088  ("NonPackedSource",                                 m_nonPackedConstraintFlag,                        false, "Indicate that source does not contain frame packing")
    9171089  ("FrameOnly",                                       m_frameOnlyConstraintFlag,                        false, "Indicate that the bitstream contains only frames")
     1090
     1091#endif
     1092
    9181093
    9191094  // Unit definition parameters
     
    9391114  ("DecodingRefreshType,-dr",                         m_iDecodingRefreshType,                               0, "Intra refresh type (0:none 1:CRA 2:IDR 3:RecPointSEI)")
    9401115  ("GOPSize,g",                                       m_iGOPSize,                                           1, "GOP size of temporal structure")
     1116#if JCTVC_Y0038_PARAMS
     1117#if NH_MV
     1118  // To keep compatibility to legacy bit streams.
     1119  ("ReWriteParamSetsFlag",                            m_bReWriteParamSetsFlag,                           false, "Enable rewriting of Parameter sets before every (intra) random access point")
     1120#else
     1121  ("ReWriteParamSetsFlag",                            m_bReWriteParamSetsFlag,                           true, "Enable rewriting of Parameter sets before every (intra) random access point")
     1122#endif
     1123#endif
    9411124
    9421125  // motion search options
     
    9671150  ("LambdaModifier6,-LM6",                            m_adLambdaModifier[ 6 ],                  ( Double )1.0, "Lambda modifier for temporal layer 6. If LambdaModifierI is used, this will not affect intra pictures")
    9681151  ("LambdaModifierI,-LMI",                            cfg_adIntraLambdaModifier,    cfg_adIntraLambdaModifier, "Lambda modifiers for Intra pictures, comma separated, up to one the number of temporal layer. If entry for temporalLayer exists, then use it, else if some are specified, use the last, else use the standard LambdaModifiers.")
    969   ("IQPFactor,-IQF",                                  m_dIntraQpFactor,                                  -1.0, "Intra QP Factor for Lambda Computation. If negative, use the default equation: 0.57*(1.0 - Clip3( 0.0, 0.5, 0.05*(Double)(isField ? (GopSize-1)/2 : GopSize-1) ))")
     1152  ("IQPFactor,-IQF",                                  m_dIntraQpFactor,                                  -1.0, "Intra QP Factor for Lambda Computation. If negative, the default will scale lambda based on GOP size (unless LambdaFromQpEnable then IntraQPOffset is used instead)")
    9701153
    9711154  /* Quantization parameters */
    9721155#if NH_MV
     1156#if JVET_E0059_FLOATING_POINT_QP_FIX
     1157  ("QP,q",                                            m_iQP,                                               std::vector<Int>(1,30)  , "Qp value")
     1158  ("QPIncrementFrame,-qpif",                          m_qpIncrementAtSourceFrame,                          std::vector<Int>( 0 ), "If a source file frame number is specified, the internal QP will be incremented for all POCs associated with source frames >= frame number. If empty, do not increment.")
     1159#else
    9731160  ("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")
     1161#endif
     1162#else
     1163#if JVET_E0059_FLOATING_POINT_QP_FIX
     1164  ("QP,q",                                            m_iQP,                                               30, "Qp value")
     1165  ("QPIncrementFrame,-qpif",                          m_qpIncrementAtSourceFrame,       OptionalValue<UInt>(), "If a source file frame number is specified, the internal QP will be incremented for all POCs associated with source frames >= frame number. If empty, do not increment.")
    9741166#else
    9751167  ("QP,q",                                            m_fQP,                                             30.0, "Qp value, if value is float, QP is switched once during encoding")
     1168#endif
     1169#endif
     1170#if X0038_LAMBDA_FROM_QP_CAPABILITY
     1171  ("IntraQPOffset",                                   m_intraQPOffset,                                      0, "Qp offset value for intra slice, typically determined based on GOP size")
     1172  ("LambdaFromQpEnable",                              m_lambdaFromQPEnable,                             false, "Enable flag for derivation of lambda from QP")
    9761173#endif
    9771174  ("DeltaQpRD,-dqr",                                  m_uiDeltaQpRD,                                       0u, "max dQp offset for slice")
     
    9811178  ("FastDeltaQP",                                     m_bFastDeltaQP,                                   false, "Fast Delta QP Algorithm")
    9821179
     1180  ("LumaLevelToDeltaQPMode",                          lumaLevelToDeltaQPMode,                              0u, "Luma based Delta QP 0(default): not used. 1: Based on CTU average, 2: Based on Max luma in CTU")
     1181  ("LumaLevelToDeltaQPMaxValWeight",                  m_lumaLevelToDeltaQPMapping.maxMethodWeight,        1.0, "Weight of block max luma val when LumaLevelToDeltaQPMode = 2")
     1182  ("LumaLevelToDeltaQPMappingLuma",                   cfg_lumaLeveltoDQPMappingLuma,  cfg_lumaLeveltoDQPMappingLuma, "Luma to Delta QP Mapping - luma thresholds")
     1183  ("LumaLevelToDeltaQPMappingDQP",                    cfg_lumaLeveltoDQPMappingQP,  cfg_lumaLeveltoDQPMappingQP, "Luma to Delta QP Mapping - DQP values")
    9831184  ("CbQpOffset,-cbqpofs",                             m_cbQpOffset,                                         0, "Chroma Cb QP Offset")
    9841185  ("CrQpOffset,-crqpofs",                             m_crQpOffset,                                         0, "Chroma Cr QP Offset")
    985 
    986 #if W0038_CQP_ADJ
    987   ("SliceChromaQPOffsetPeriodicity",                  m_sliceChromaQpOffsetPeriodicity,                    0u, "Used in conjunction with Slice Cb/Cr QpOffsetIntraOrPeriodic. Use 0 (default) to disable periodic nature.")
     1186  ("WCGPPSEnable",                                    m_wcgChromaQpControl.enabled,                     false, "1: Enable the WCG PPS chroma modulation scheme. 0 (default) disabled")
     1187  ("WCGPPSCbQpScale",                                 m_wcgChromaQpControl.chromaCbQpScale,               1.0, "WCG PPS Chroma Cb QP Scale")
     1188  ("WCGPPSCrQpScale",                                 m_wcgChromaQpControl.chromaCrQpScale,               1.0, "WCG PPS Chroma Cr QP Scale")
     1189  ("WCGPPSChromaQpScale",                             m_wcgChromaQpControl.chromaQpScale,                 0.0, "WCG PPS Chroma QP Scale")
     1190  ("WCGPPSChromaQpOffset",                            m_wcgChromaQpControl.chromaQpOffset,                0.0, "WCG PPS Chroma QP Offset")
     1191("SliceChromaQPOffsetPeriodicity",                  m_sliceChromaQpOffsetPeriodicity,                    0u, "Used in conjunction with Slice Cb/Cr QpOffsetIntraOrPeriodic. Use 0 (default) to disable periodic nature.")
    9881192  ("SliceCbQpOffsetIntraOrPeriodic",                  m_sliceChromaQpOffsetIntraOrPeriodic[0],              0, "Chroma Cb QP Offset at slice level for I slice or for periodic inter slices as defined by SliceChromaQPOffsetPeriodicity. Replaces offset in the GOP table.")
    9891193  ("SliceCrQpOffsetIntraOrPeriodic",                  m_sliceChromaQpOffsetIntraOrPeriodic[1],              0, "Chroma Cr QP Offset at slice level for I slice or for periodic inter slices as defined by SliceChromaQPOffsetPeriodicity. Replaces offset in the GOP table.")
    990 #endif
    9911194#if ADAPTIVE_QP_SELECTION
    9921195  ("AdaptiveQpSelection,-aqps",                       m_bUseAdaptQpSelect,                              false, "AdaptiveQpSelection")
     
    9981201  ("RDOQ",                                            m_useRDOQ,                                         true)
    9991202  ("RDOQTS",                                          m_useRDOQTS,                                       true)
    1000 #if T0196_SELECTIVE_RDOQ
    10011203  ("SelectiveRDOQ",                                   m_useSelectiveRDOQ,                               false, "Enable selective RDOQ")
    1002 #endif
    10031204  ("RDpenalty",                                       m_rdPenalty,                                          0,  "RD-penalty for 32x32 TU for intra in non-intra slices. 0:disabled  1:RD-penalty  2:maximum RD-penalty")
    10041205
     
    10121213  ("LoopFilterBetaOffset_div2",                       m_loopFilterBetaOffsetDiv2,                           0)
    10131214  ("LoopFilterTcOffset_div2",                         m_loopFilterTcOffsetDiv2,                             0)
    1014 #if W0038_DB_OPT
    10151215  ("DeblockingFilterMetric",                          m_deblockingFilterMetric,                             0)
    1016 #else
    1017   ("DeblockingFilterMetric",                          m_DeblockingFilterMetric,                         false)
    1018 #endif
    10191216  // Coding tools
    10201217  ("AMP",                                             m_enableAMP,                                       true, "Enable asymmetric motion partitions")
     
    10421239  ("MaxNumOffsetsPerPic",                             m_maxNumOffsetsPerPic,                             2048, "Max number of SAO offset per picture (Default: 2048)")
    10431240  ("SAOLcuBoundary",                                  m_saoCtuBoundary,                                 false, "0: right/bottom CTU boundary areas skipped from SAO parameter estimation, 1: non-deblocked pixels are used for those areas")
    1044 #if OPTIONAL_RESET_SAO_ENCODING_AFTER_IRAP
    10451241  ("SAOResetEncoderStateAfterIRAP",                   m_saoResetEncoderStateAfterIRAP,                  false, "When true, resets the encoder's SAO state after an IRAP (POC order). Disabled by default.")
    1046 #endif
    10471242  ("SliceMode",                                       tmpSliceMode,                            Int(NO_SLICES), "0: Disable all Recon slice limits, 1: Enforce max # of CTUs, 2: Enforce max # of bytes, 3:specify tiles per dependent slice")
    10481243  ("SliceArgument",                                   m_sliceArgument,                                      0, "Depending on SliceMode being:"
     
    10861281  ("ScalingList",                                     m_useScalingListId,                    SCALING_LIST_OFF, "0/off: no scaling list, 1/default: default scaling lists, 2/file: scaling lists specified in ScalingListFile")
    10871282  ("ScalingListFile",                                 m_scalingListFileName,                       string(""), "Scaling list file name. Use an empty string to produce help.")
    1088   ("SignHideFlag,-SBH",                               m_signHideFlag,                                    true)
     1283  ("SignHideFlag,-SBH",                               m_signDataHidingEnabledFlag,                                    true)
    10891284  ("MaxNumMergeCand",                                 m_maxNumMergeCand,                                   5u, "Maximum number of merge candidates")
    10901285  /* Misc. */
     
    11071302  ( "InitialQP",                                      m_RCInitialQP,                                        0, "Rate control: initial QP" )
    11081303  ( "RCForceIntraQP",                                 m_RCForceIntraQP,                                 false, "Rate control: force intra QP to be equal to initial QP" )
    1109 
    1110 #if U0132_TARGET_BITS_SATURATION
    11111304  ( "RCCpbSaturation",                                m_RCCpbSaturationEnabled,                         false, "Rate control: enable target bits saturation to avoid CPB overflow and underflow" )
    11121305  ( "RCCpbSize",                                      m_RCCpbSize,                                         0u, "Rate control: CPB size" )
    11131306  ( "RCInitialCpbFullness",                           m_RCInitialCpbFullness,                             0.9, "Rate control: initial CPB fullness" )
    1114 #endif
    1115 
    11161307#if KWU_RC_VIEWRC_E0227
    11171308  ("ViewWiseTargetBits, -vtbr" ,  m_viewTargetBits,  std::vector<Int>(1, 32), "View-wise target bit-rate setting")
     
    11501341#endif
    11511342
    1152   ("TransquantBypassEnableFlag",                      m_TransquantBypassEnableFlag,                     false, "transquant_bypass_enable_flag indicator in PPS")
    1153   ("CUTransquantBypassFlagForce",                     m_CUTransquantBypassFlagForce,                    false, "Force transquant bypass mode, when transquant_bypass_enable_flag is enabled")
     1343  ("TransquantBypassEnable",                          m_TransquantBypassEnabledFlag,                    false, "transquant_bypass_enabled_flag indicator in PPS")
     1344  ("TransquantBypassEnableFlag",                      m_TransquantBypassEnabledFlag,                    false, "deprecated alias for TransquantBypassEnable")
     1345  ("CUTransquantBypassFlagForce",                     m_CUTransquantBypassFlagForce,                    false, "Force transquant bypass mode, when transquant_bypass_enabled_flag is enabled")
    11541346  ("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).")
    11551347  ("RecalculateQPAccordingToLambda",                  m_recalculateQPAccordingToLambda,                 false, "Recalculate QP values according to lambda values. Do not suggest to be enabled in all intra case")
     
    12631455  ("SEIScalableNesting",                              m_scalableNestingSEIEnabled,                      false, "Control generation of scalable nesting SEI messages")
    12641456  ("SEITempMotionConstrainedTileSets",                m_tmctsSEIEnabled,                                false, "Control generation of temporal motion constrained tile sets SEI message")
     1457#if MCTS_ENC_CHECK
     1458  ("SEITMCTSTileConstraint",                          m_tmctsSEITileConstraint,                         false, "Constrain motion vectors at tile boundaries")
     1459#endif
    12651460  ("SEITimeCodeEnabled",                              m_timeCodeSEIEnabled,                             false, "Control generation of time code information SEI message")
    12661461  ("SEITimeCodeNumClockTs",                           m_timeCodeSEINumTs,                                   0, "Number of clock time sets [0..3]")
     
    12961491  ("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)")
    12971492  ("SEIMasteringDisplayWhitePoint",                   cfg_DisplayWhitePointCode,     cfg_DisplayWhitePointCode, "Mastering display white point CIE xy coordinates in normalised increments of 1/50000 (e.g. 0.333 = 16667)")
    1298 #if U0033_ALTERNATIVE_TRANSFER_CHARACTERISTICS_SEI
    12991493  ("SEIPreferredTransferCharacterisics",              m_preferredTransferCharacteristics,                   -1, "Value for the preferred_transfer_characteristics field of the Alternative transfer characteristics SEI which will override the corresponding entry in the VUI. If negative, do not produce the respective SEI message")
    1300 #endif
     1494  ("SEIGreenMetadataType",                            m_greenMetadataType,                   0u, "Value for the green_metadata_type specifies the type of metadata that is present in the SEI message. If green_metadata_type is 1, then metadata enabling quality recovery after low-power encoding is present")
     1495  ("SEIXSDMetricType",                                m_xsdMetricType,                      0u, "Value for the xsd_metric_type indicates the type of the objective quality metric. PSNR is the only type currently supported")
     1496
    13011497#if NH_MV
    13021498  ("SeiCfgFileName_%d",                               m_seiCfgFileNames,             (TChar *) 0 ,MAX_NUM_SEIS , "SEI cfg file name %d")
     
    13311527  ("DWeight",                                         m_iDWeight                , 1                             ,"Depth Distortion weight" )
    13321528#endif //HHI_VSO
     1529
     1530#if NH_3D
    13331531/* 3D- HEVC Tools */                                                           
    1334 #if NH_3D_QTL
    13351532  ("QTL"                   ,                          m_bUseQTL                 , true                          , "Use depth quad tree limitation (encoder only)" )
    1336 #endif
    1337 #if NH_3D
    13381533
    13391534  ("IvMvPredFlag"          ,                          m_ivMvPredFlag            , BoolAry1d(2,true)             , "Inter-view motion prediction"              )
     
    13551550  ("IlluCompEnable"        ,                          m_abUseIC                 , true                          , "Enable illumination compensation"          )
    13561551  ("IlluCompLowLatencyEnc" ,                          m_bUseLowLatencyICEnc     , false                         , "Enable low-latency illumination compensation encoding")
    1357 #endif //NH_3D
    1358    
     1552#endif //NH_3D   
    13591553  ;
    13601554
    1361 #if NH_MV
    1362   // parse coding structure
     1555#if EXTENSION_360_VIDEO
     1556  TExt360AppEncCfg::TExt360AppEncCfgContext ext360CfgContext;
     1557  m_ext360.addOptions(opts, ext360CfgContext);
     1558#endif
     1559
     1560
     1561#if NH_MV
    13631562  for( Int k = 0; k < MAX_NUM_LAYERS; k++ )
    13641563  {
     
    14141613  const list<const TChar*>& argv_unhandled = po::scanArgv(opts, argc, (const TChar**) argv, err);
    14151614
     1615
    14161616  for (list<const TChar*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++)
    14171617  {
     
    14351635  }
    14361636
     1637#if NH_MV
     1638  if ( m_layerIdxInVpsToRepFormatIdx.size() == 0 )
     1639  {
     1640    m_layerIdxInVpsToRepFormatIdx.push_back( 0 );
     1641#if NH_3D
     1642    m_layerIdxInVpsToRepFormatIdx.push_back( 1 );
     1643#endif
     1644  }
     1645
     1646  xResizeVector( m_layerIdxInVpsToRepFormatIdx );
     1647
     1648  // parse coding structure
     1649  if ( m_layerIdxInVpsToGopDefIdx.size() == 0 )
     1650  {
     1651    for( Int k = 0; k < m_numberOfLayers; k++ )
     1652    {
     1653      m_layerIdxInVpsToGopDefIdx.push_back( k );
     1654    }
     1655  }
     1656
     1657  xConvertRepFormatParameters(
     1658    tmpPad                       ,             
     1659    tmpInputBitDepth             ,
     1660    tmpOutputBitDepth            ,
     1661    tmpMSBExtendedBitDepth       ,
     1662    tmpInternalBitDepth          ,
     1663    tmpInputChromaFormat         ,
     1664    tmpChromaFormat
     1665    );
     1666#endif
    14371667  /*
    14381668   * Set any derived parameters
    14391669   */
     1670#if NH_MV
     1671  m_inputFileWidths  = m_iSourceWidths;
     1672  m_inputFileHeights = m_iSourceHeights;
     1673#else
     1674  m_inputFileWidth  = m_iSourceWidth;
     1675  m_inputFileHeight = m_iSourceHeight;
     1676#endif
    14401677
    14411678  m_framesToBeEncoded = ( m_framesToBeEncoded + m_temporalSubsampleRatio - 1 ) / m_temporalSubsampleRatio;
    14421679  m_adIntraLambdaModifier = cfg_adIntraLambdaModifier.values;
     1680
     1681#if NH_MV
     1682  m_iSourceHeightOrgs = m_iSourceHeights;
     1683#endif
    14431684  if(m_isField)
    14441685  {
     1686#if NH_MV
     1687    //Frame height
     1688    m_iSourceHeightOrgs = m_iSourceHeights;
     1689    //Field height
     1690    for (Int i = 0; i < m_iSourceHeights.size(); i++ )
     1691    {
     1692      m_iSourceHeights[i] = m_iSourceHeights[i] >> 1;
     1693    }
     1694#else
    14451695    //Frame height
    14461696    m_iSourceHeightOrg = m_iSourceHeight;
    14471697    //Field height
    14481698    m_iSourceHeight = m_iSourceHeight >> 1;
     1699#endif
    14491700    //number of fields to encode
    14501701    m_framesToBeEncoded *= 2;
     
    15031754  }
    15041755
     1756#if NH_MV
     1757  for (Int i = 0; i < m_numRepFormats; i++ )
     1758  {
     1759    Int* m_MSBExtendedBitDepth   = &m_MSBExtendedBitDepths[i][0];
     1760    Int* m_internalBitDepth      = &m_internalBitDepths   [i][0];
     1761    Int* m_outputBitDepth        = &m_outputBitDepths     [i][0];
     1762    Int* m_inputBitDepth         = &m_inputBitDepths      [i][0];
     1763#endif
    15051764  /* rules for input, output and internal bitdepths as per help text */
    15061765  if (m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA  ] == 0)
     
    15331792  }
    15341793
     1794 
     1795#if NH_MV
     1796  }
    15351797  m_InputChromaFormatIDC = numberToChromaFormat(tmpInputChromaFormat);
     1798#endif
     1799
     1800
     1801#if NH_MV
     1802  std::vector<ChromaFormat> tempChromaFormatIdc = numberToChromaFormat(tmpChromaFormat);
     1803  for(Int i = 0 ; i < m_InputChromaFormatIDC.size(); i++)
     1804  {
     1805    m_chromaFormatIDCs.push_back( ((tmpChromaFormat[i] == 0) ? (m_InputChromaFormatIDC[i]) : tempChromaFormatIdc[i] ) );
     1806  }
     1807#else
    15361808  m_chromaFormatIDC      = ((tmpChromaFormat == 0) ? (m_InputChromaFormatIDC) : (numberToChromaFormat(tmpChromaFormat)));
    1537 
     1809#endif
     1810
     1811#if EXTENSION_360_VIDEO
     1812  m_ext360.processOptions(ext360CfgContext);
     1813#endif
    15381814
    15391815  assert(tmpWeightedPredictionMethod>=0 && tmpWeightedPredictionMethod<=WP_PER_PICTURE_WITH_HISTOGRAM_AND_PER_COMPONENT_AND_CLIPPING_AND_EXTENSION);
     
    15581834  m_motionEstimationSearchMethod=MESearchMethod(tmpMotionEstimationSearchMethod);
    15591835
    1560 #if NH_MV
    1561   // parse PTL
     1836#if NH_MV 
     1837
    15621838  Bool anyEmpty = false;
    15631839  if( cfg_profiles.empty() )
     
    16021878  }
    16031879
    1604   xReadStrToEnum( cfg_profiles, extendedProfiles  );
     1880  xReadStrToEnum( cfg_profiles, m_uiProfiles  );
    16051881  xReadStrToEnum( cfg_levels,   m_level     );
    16061882  xReadStrToEnum( cfg_tiers ,   m_levelTier );
    1607 
    1608 
    1609 #if NH_MV
    1610   m_profiles.resize( extendedProfiles.size());
    1611 
    1612   for (Int i = 0; i < m_profiles.size(); i++)
    1613   {
    1614     Profile::Name& m_profile             = m_profiles      [i]; 
    1615     ExtendedProfileName& extendedProfile = extendedProfiles[i]; 
    1616 #endif
    1617 #endif
    1618 
    1619   if (extendedProfile >= 1000 && extendedProfile <= 12316)
    1620     {
     1883   
     1884#else
     1885    switch (UIProfile)
     1886    {
     1887    case UI_NONE:
     1888      m_profile = Profile::NONE;
     1889      m_onePictureOnlyConstraintFlag = false;
     1890      break;
     1891    case UI_MAIN:
     1892      m_profile = Profile::MAIN;
     1893      m_onePictureOnlyConstraintFlag = false;
     1894      break;
     1895    case UI_MAIN10:
     1896      m_profile = Profile::MAIN10;
     1897      m_onePictureOnlyConstraintFlag = false;
     1898      break;
     1899    case UI_MAINSTILLPICTURE:
     1900      m_profile = Profile::MAINSTILLPICTURE;
     1901      m_onePictureOnlyConstraintFlag = false;
     1902      break;
     1903    case UI_MAIN10_STILL_PICTURE:
     1904      m_profile = Profile::MAIN10;
     1905      m_onePictureOnlyConstraintFlag = true;
     1906      break;
     1907    case UI_MAINREXT:
    16211908      m_profile = Profile::MAINREXT;
    1622       if (m_bitDepthConstraint != 0 || tmpConstraintChromaFormat != 0)
    1623       {
    1624         fprintf(stderr, "Error: The bit depth and chroma format constraints are not used when an explicit RExt profile is specified\n");
    1625         exit(EXIT_FAILURE);
    1626       }
    1627       m_bitDepthConstraint     = (extendedProfile%100);
    1628     m_intraConstraintFlag          = ((extendedProfile%10000)>=2000);
    1629     m_onePictureOnlyConstraintFlag = (extendedProfile >= 10000);
    1630       switch ((extendedProfile/100)%10)
    1631       {
    1632       case 0:  tmpConstraintChromaFormat=400; break;
    1633       case 1:  tmpConstraintChromaFormat=420; break;
    1634       case 2:  tmpConstraintChromaFormat=422; break;
    1635       default: tmpConstraintChromaFormat=444; break;
    1636       }
    1637     }
    1638     else
    1639     {
    1640       m_profile = Profile::Name(extendedProfile);
    1641     }
    1642 
    1643     if (m_profile == Profile::HIGHTHROUGHPUTREXT )
    1644     {
    1645       if (m_bitDepthConstraint == 0)
    1646       {
    1647         m_bitDepthConstraint = 16;
    1648       }
    1649       m_chromaFormatConstraint = (tmpConstraintChromaFormat == 0) ? CHROMA_444 : numberToChromaFormat(tmpConstraintChromaFormat);
    1650     }
    1651     else if (m_profile == Profile::MAINREXT)
    1652     {
    1653       if (m_bitDepthConstraint == 0 && tmpConstraintChromaFormat == 0)
    1654       {
    1655         // produce a valid combination, if possible.
    1656       const Bool bUsingGeneralRExtTools  = m_transformSkipRotationEnabledFlag        ||
    1657                                            m_transformSkipContextEnabledFlag         ||
    1658                                            m_rdpcmEnabledFlag[RDPCM_SIGNAL_IMPLICIT] ||
    1659                                            m_rdpcmEnabledFlag[RDPCM_SIGNAL_EXPLICIT] ||
    1660           !m_enableIntraReferenceSmoothing         ||
    1661                                            m_persistentRiceAdaptationEnabledFlag     ||
    1662                                            m_log2MaxTransformSkipBlockSize!=2;
    1663       const Bool bUsingChromaQPAdjustment= m_diffCuChromaQpOffsetDepth >= 0;
    1664       const Bool bUsingExtendedPrecision = m_extendedPrecisionProcessingFlag;
    1665       if (m_onePictureOnlyConstraintFlag)
    1666       {
    1667         m_chromaFormatConstraint = CHROMA_444;
    1668         if (m_intraConstraintFlag != true)
     1909      m_onePictureOnlyConstraintFlag = false;
     1910      break;
     1911    case UI_HIGHTHROUGHPUTREXT:
     1912      m_profile = Profile::HIGHTHROUGHPUTREXT;
     1913      m_onePictureOnlyConstraintFlag = false;
     1914      break;
     1915    default:
     1916      if (UIProfile >= 1000 && UIProfile <= 12316)
     1917      {
     1918        m_profile = Profile::MAINREXT;
     1919        if (m_bitDepthConstraint != 0 || tmpConstraintChromaFormat != 0)
    16691920        {
    1670           fprintf(stderr, "Error: Intra constraint flag must be true when one_picture_only_constraint_flag is true\n");
     1921          fprintf(stderr, "Error: The bit depth and chroma format constraints are not used when an explicit RExt profile is specified\n");
    16711922          exit(EXIT_FAILURE);
    16721923        }
    1673         const Int maxBitDepth = m_chromaFormatIDC==CHROMA_400 ? m_internalBitDepth[CHANNEL_TYPE_LUMA] : std::max(m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA]);
    1674         m_bitDepthConstraint = maxBitDepth>8 ? 16:8;
     1924        m_bitDepthConstraint           = (UIProfile%100);
     1925        m_intraConstraintFlag          = ((UIProfile%10000)>=2000);
     1926        m_onePictureOnlyConstraintFlag = (UIProfile >= 10000);
     1927        switch ((UIProfile/100)%10)
     1928        {
     1929        case 0:  tmpConstraintChromaFormat=400; break;
     1930        case 1:  tmpConstraintChromaFormat=420; break;
     1931        case 2:  tmpConstraintChromaFormat=422; break;
     1932        default: tmpConstraintChromaFormat=444; break;
     1933        }
     1934      }
     1935      else if (UIProfile >= 21308 && UIProfile <= 22316)
     1936      {
     1937        m_profile = Profile::HIGHTHROUGHPUTREXT;
     1938        if (m_bitDepthConstraint != 0 || tmpConstraintChromaFormat != 0)
     1939        {
     1940          fprintf(stderr, "Error: The bit depth and chroma format constraints are not used when an explicit RExt profile is specified\n");
     1941          exit(EXIT_FAILURE);
     1942        }
     1943        m_bitDepthConstraint           = (UIProfile%100);
     1944        m_intraConstraintFlag          = ((UIProfile%10000)>=2000);
     1945        m_onePictureOnlyConstraintFlag = 0;
     1946        if((UIProfile == UI_HIGHTHROUGHPUT_444) || (UIProfile == UI_HIGHTHROUGHPUT_444_10) )
     1947        {
     1948          assert(m_cabacBypassAlignmentEnabledFlag==0);
     1949        }
     1950        switch ((UIProfile/100)%10)
     1951        {
     1952        case 0:  tmpConstraintChromaFormat=400; break;
     1953        case 1:  tmpConstraintChromaFormat=420; break;
     1954        case 2:  tmpConstraintChromaFormat=422; break;
     1955        default: tmpConstraintChromaFormat=444; break;
     1956        }
    16751957      }
    16761958      else
    16771959      {
    1678         m_chromaFormatConstraint = NUM_CHROMA_FORMAT;
    1679         automaticallySelectRExtProfile(bUsingGeneralRExtTools,
    1680           bUsingChromaQPAdjustment,
    1681           bUsingExtendedPrecision,
    1682           m_intraConstraintFlag,
    1683           m_bitDepthConstraint,
    1684           m_chromaFormatConstraint,
    1685           m_chromaFormatIDC==CHROMA_400 ? m_internalBitDepth[CHANNEL_TYPE_LUMA] : std::max(m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA]),
    1686           m_chromaFormatIDC);
    1687       }
    1688     }
    1689       else if (m_bitDepthConstraint == 0 || tmpConstraintChromaFormat == 0)
    1690       {
    1691         fprintf(stderr, "Error: The bit depth and chroma format constraints must either both be specified or both be configured automatically\n");
     1960        fprintf(stderr, "Error: Unprocessed UI profile\n");
     1961        assert(0);
    16921962        exit(EXIT_FAILURE);
    16931963      }
    1694       else
    1695       {
    1696         m_chromaFormatConstraint = numberToChromaFormat(tmpConstraintChromaFormat);
    1697       }
    1698     }
    1699     else
    1700     {
     1964      break;
     1965    }
     1966
     1967    switch (m_profile)
     1968    {
     1969    case Profile::HIGHTHROUGHPUTREXT:
     1970      {
     1971        if (m_bitDepthConstraint == 0)
     1972        {
     1973          m_bitDepthConstraint = 16;
     1974        }
     1975        m_chromaFormatConstraint = (tmpConstraintChromaFormat == 0) ? CHROMA_444 : numberToChromaFormat(tmpConstraintChromaFormat);
     1976      }
     1977      break;
     1978    case Profile::MAINREXT:
     1979
     1980      {
     1981        if (m_bitDepthConstraint == 0 && tmpConstraintChromaFormat == 0)
     1982        {
     1983          // produce a valid combination, if possible.
     1984          const Bool bUsingGeneralRExtTools  = m_transformSkipRotationEnabledFlag        ||
     1985            m_transformSkipContextEnabledFlag         ||
     1986            m_rdpcmEnabledFlag[RDPCM_SIGNAL_IMPLICIT] ||
     1987            m_rdpcmEnabledFlag[RDPCM_SIGNAL_EXPLICIT] ||
     1988            !m_enableIntraReferenceSmoothing         ||
     1989            m_persistentRiceAdaptationEnabledFlag     ||
     1990            m_log2MaxTransformSkipBlockSize!=2;
     1991          const Bool bUsingChromaQPAdjustment= m_diffCuChromaQpOffsetDepth >= 0;
     1992          const Bool bUsingExtendedPrecision = m_extendedPrecisionProcessingFlag;
     1993          if (m_onePictureOnlyConstraintFlag)
     1994          {
     1995            m_chromaFormatConstraint = CHROMA_444;
     1996            if (m_intraConstraintFlag != true)
     1997            {
     1998              fprintf(stderr, "Error: Intra constraint flag must be true when one_picture_only_constraint_flag is true\n");
     1999              exit(EXIT_FAILURE);
     2000            }
     2001            const Int maxBitDepth = m_chromaFormatIDC==CHROMA_400 ? m_internalBitDepth[CHANNEL_TYPE_LUMA] : std::max(m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA]);
     2002            m_bitDepthConstraint = maxBitDepth>8 ? 16:8;
     2003          }
     2004          else
     2005          {
     2006            m_chromaFormatConstraint = NUM_CHROMA_FORMAT;
     2007            automaticallySelectRExtProfile(bUsingGeneralRExtTools,
     2008              bUsingChromaQPAdjustment,
     2009              bUsingExtendedPrecision,
     2010              m_intraConstraintFlag,
     2011              m_bitDepthConstraint,
     2012              m_chromaFormatConstraint,
     2013              m_chromaFormatIDC==CHROMA_400 ? m_internalBitDepth[CHANNEL_TYPE_LUMA] : std::max(m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA]),
     2014              m_chromaFormatIDC);
     2015          }
     2016        }
     2017        else if (m_bitDepthConstraint == 0 || tmpConstraintChromaFormat == 0)
     2018        {
     2019          fprintf(stderr, "Error: The bit depth and chroma format constraints must either both be specified or both be configured automatically\n");
     2020          exit(EXIT_FAILURE);
     2021        }
     2022        else
     2023        {
     2024          m_chromaFormatConstraint = numberToChromaFormat(tmpConstraintChromaFormat);
     2025        }
     2026      }
     2027      break;
     2028    case Profile::MAIN:
     2029    case Profile::MAIN10:
     2030    case Profile::MAINSTILLPICTURE:
    17012031      m_chromaFormatConstraint = (tmpConstraintChromaFormat == 0) ? m_chromaFormatIDC : numberToChromaFormat(tmpConstraintChromaFormat);
    17022032      m_bitDepthConstraint = (m_profile == Profile::MAIN10?10:8);
    1703     }
    1704 #if NH_MV
    1705   }
    1706 
    1707   if ( m_numberOfLayers != 0 && ( m_profiles[0] != Profile::MAIN || m_profiles[1] != Profile::MAIN )  )
    1708   {
    1709     fprintf(stderr, "Error: The base layer must conform to the Main profile for Multilayer coding.\n");
    1710     exit(EXIT_FAILURE);
    1711   }
    1712 #endif
    1713 
     2033      break;
     2034    case Profile::NONE:
     2035      m_chromaFormatConstraint = m_chromaFormatIDC;
     2036      m_bitDepthConstraint = m_chromaFormatIDC==CHROMA_400 ? m_internalBitDepth[CHANNEL_TYPE_LUMA] : std::max(m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA]);
     2037      break;
     2038    default:
     2039      fprintf(stderr, "Unknown profile selected\n");
     2040      exit(EXIT_FAILURE);
     2041      break;
     2042    }
     2043#endif
    17142044
    17152045  m_inputColourSpaceConvert = stringToInputColourSpaceConvert(inputColourSpaceConvert, true);
    17162046
     2047
     2048#if NH_MV
     2049  for (Int i = 0; i < m_numRepFormats; i++ )
     2050  {
     2051    Int*          m_aiPad            = &m_aiPads[i][0];
     2052    ChromaFormat &m_chromaFormatIDC  = m_chromaFormatIDCs [i];
     2053    Int          &m_confWinRight     = m_confWinRights    [i];
     2054    Int          &m_confWinBottom    = m_confWinBottoms   [i];
     2055    Int          &m_confWinLeft      = m_confWinLefts     [i];
     2056    Int          &m_confWinTop       = m_confWinTops      [i];
     2057    Int          &m_iSourceHeight    = m_iSourceHeights   [i];
     2058    Int          &m_iSourceWidth     = m_iSourceWidths    [i];
     2059    Int          &m_iSourceHeightOrg = m_iSourceHeightOrgs[i];
     2060#endif
    17172061  switch (m_conformanceWindowMode)
    17182062  {
     
    17792123    }
    17802124  }
     2125#if NH_MV
     2126  }
     2127#endif
    17812128
    17822129  if (tmpSliceMode<0 || tmpSliceMode>=Int(NUMBER_OF_SLICE_CONSTRAINT_MODES))
     
    18372184  xResizeVector( m_depthFlag );
    18382185#endif
     2186
     2187#if JVET_E0059_FLOATING_POINT_QP_FIX 
     2188  if ( !m_qpIncrementAtSourceFrame.empty() )
     2189  {
     2190    xResizeVector( m_qpIncrementAtSourceFrame );
     2191  }
     2192  xResizeVector( m_iQP );
     2193#else
    18392194  xResizeVector( m_fQP );
     2195#endif
    18402196
    18412197  for( Int layer = 0; layer < m_numberOfLayers; layer++ )
     
    18442200    ::memset( m_aidQP[layer], 0, sizeof(Int)*( m_framesToBeEncoded + m_iGOPSize + 1 ) );
    18452201
     2202#if JVET_E0059_FLOATING_POINT_QP_FIX
     2203    if ( !m_qpIncrementAtSourceFrame.empty() )
     2204    {
     2205      UInt switchingPOC=0;
     2206      if (m_qpIncrementAtSourceFrame[layer] > m_FrameSkip)
     2207      {
     2208        // if switch source frame (ssf) = 10, and frame skip (fs)=2 and temporal subsample ratio (tsr) =1, then
     2209        //    for this simulation switch at POC 8 (=10-2).
     2210        // if ssf=10, fs=2, tsr=2, then for this simulation, switch at POC 4 (=(10-2)/2): POC0=Src2, POC1=Src4, POC2=Src6, POC3=Src8, POC4=Src10
     2211        switchingPOC = (m_qpIncrementAtSourceFrame[layer] - m_FrameSkip) / m_temporalSubsampleRatio;
     2212      }
     2213      for(UInt i=switchingPOC; i<( m_framesToBeEncoded + m_iGOPSize + 1 ); i++)
     2214      {
     2215        m_aidQP[layer][i]=1;
     2216      }
     2217    }
     2218#else
    18462219    // handling of floating-point QP values
    18472220    // if QP is not integer, sequence is split into two sections having QP and QP+1
     
    18572230      }
    18582231    }
     2232#endif
    18592233
    18602234    for(UInt ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++)
     
    18622236      if (saoOffsetBitShift[ch]<0)
    18632237      {
     2238#if NH_MV
     2239        Int repFormatIdx = m_layerIdxInVpsToRepFormatIdx[ layer ];
     2240        if (m_internalBitDepths[repFormatIdx][ch]>10)
     2241#else
    18642242        if (m_internalBitDepth[ch]>10)
     2243#endif
    18652244        {
    1866           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) ) );
     2245          m_log2SaoOffsetScale[layer][ch]=UInt(Clip3<Int>(0, m_internalBitDepths[repFormatIdx][ch]-10, Int(m_internalBitDepths[repFormatIdx][ch]-10 + 0.165*m_iQP[layer] - 3.22 + 0.5) ) );
    18672246        }
    18682247        else
     
    18932272  ::memset( m_aidQP, 0, sizeof(Int)*( m_framesToBeEncoded + m_iGOPSize + 1 ) );
    18942273
     2274#if JVET_E0059_FLOATING_POINT_QP_FIX
     2275  if (m_qpIncrementAtSourceFrame.bPresent)
     2276  {
     2277    UInt switchingPOC=0;
     2278    if (m_qpIncrementAtSourceFrame.value > m_FrameSkip)
     2279    {
     2280      // if switch source frame (ssf) = 10, and frame skip (fs)=2 and temporal subsample ratio (tsr) =1, then
     2281      //    for this simulation switch at POC 8 (=10-2).
     2282      // if ssf=10, fs=2, tsr=2, then for this simulation, switch at POC 4 (=(10-2)/2): POC0=Src2, POC1=Src4, POC2=Src6, POC3=Src8, POC4=Src10
     2283      switchingPOC = (m_qpIncrementAtSourceFrame.value - m_FrameSkip) / m_temporalSubsampleRatio;
     2284    }
     2285    for(UInt i=switchingPOC; i<( m_framesToBeEncoded + m_iGOPSize + 1 ); i++)
     2286    {
     2287      m_aidQP[i]=1;
     2288    }
     2289  }
     2290#else
    18952291  // handling of floating-point QP values
    18962292  // if QP is not integer, sequence is split into two sections having QP and QP+1
     
    19062302    }
    19072303  }
     2304#endif
    19082305
    19092306  for(UInt ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++)
     
    19272324
    19282325#endif
     2326
     2327  assert(lumaLevelToDeltaQPMode<LUMALVL_TO_DQP_NUM_MODES);
     2328  if (lumaLevelToDeltaQPMode>=LUMALVL_TO_DQP_NUM_MODES)
     2329  {
     2330    exit(EXIT_FAILURE);
     2331  }
     2332  m_lumaLevelToDeltaQPMapping.mode=LumaLevelToDQPMode(lumaLevelToDeltaQPMode);
     2333
     2334  if (m_lumaLevelToDeltaQPMapping.mode)
     2335  {
     2336    assert(  cfg_lumaLeveltoDQPMappingLuma.values.size() == cfg_lumaLeveltoDQPMappingQP.values.size() );
     2337    m_lumaLevelToDeltaQPMapping.mapping.resize(cfg_lumaLeveltoDQPMappingLuma.values.size());
     2338    for(UInt i=0; i<cfg_lumaLeveltoDQPMappingLuma.values.size(); i++)
     2339    {
     2340      m_lumaLevelToDeltaQPMapping.mapping[i]=std::pair<Int,Int>(cfg_lumaLeveltoDQPMappingLuma.values[i], cfg_lumaLeveltoDQPMappingQP.values[i]);
     2341    }
     2342  }
    19292343
    19302344  // reading external dQP description from file
     
    20702484    m_dLambdaScaleVSO *= adLambdaScaleTable[m_iQP[firstDepthLayer]];
    20712485  }
     2486
    20722487  if ( m_bUseVSO && m_uiVSOMode == 4)
    20732488  {
    20742489    m_cRenModStrParser.setString( m_iNumberOfViews, m_pchVSOConfig );
    20752490    m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
    2076       m_internalBitDepth[ CHANNEL_TYPE_LUMA],
     2491      m_internalBitDepths[0][ CHANNEL_TYPE_LUMA],
    20772492      (UInt)m_iCodedCamParPrecision,
    20782493      m_FrameSkip,
     
    20872502  {
    20882503    m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
    2089       m_internalBitDepth[ CHANNEL_TYPE_LUMA],
     2504      m_internalBitDepths[0][ CHANNEL_TYPE_LUMA],
    20902505      (UInt)m_iCodedCamParPrecision,
    20912506      m_FrameSkip,
     
    21022517  {
    21032518    m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
    2104       m_internalBitDepth[ CHANNEL_TYPE_LUMA],
     2519      m_internalBitDepths[0][ CHANNEL_TYPE_LUMA],
    21052520      (UInt) m_iCodedCamParPrecision,
    21062521      m_FrameSkip,
     
    21252540  }
    21262541
    2127   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.
     2542
     2543#if NH_MV
     2544  for (Int i = 0; i < m_numRepFormats; i++ )
     2545  {
     2546    m_uiMaxTotalCUDepth               .push_back( m_uiMaxCUDepth + uiAddCUDepth + getMaxCUDepthOffset(m_chromaFormatIDCs[i], m_uiQuadtreeTULog2MinSize) ); // if minimum TU larger than 4x4, allow for additional part indices for 4:2:2 SubTUs.   
     2547  }
     2548#else
     2549  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. 
     2550#endif
     2551
    21282552  m_uiLog2DiffMaxMinCodingBlockSize = m_uiMaxCUDepth - 1;
    21292553
     
    21342558}
    21352559
     2560#if NH_MV
     2561Void TAppEncCfg::xDeriveProfAndConstrFlags( const TComVPS& vps )
     2562{
     2563
     2564  UInt numPtl = (Int) m_uiProfiles.size();
     2565  m_profiles.resize( numPtl );
     2566  m_chromaFormatConstraints.resize( m_uiProfiles.size() );
     2567 
     2568  xResizeVector( m_onePictureOnlyConstraintFlags , numPtl );
     2569  xResizeVector( m_bitDepthConstraints           , numPtl );
     2570  xResizeVector( m_frameOnlyConstraintFlags      , numPtl );
     2571  xResizeVector( m_nonPackedConstraintFlags      , numPtl );
     2572  xResizeVector( m_intraConstraintFlags          , numPtl ); 
     2573  xResizeVector( m_interlacedSourceFlags         , numPtl );
     2574  xResizeVector( m_progressiveSourceFlags        , numPtl );
     2575  xResizeVector( m_lowerBitRateConstraintFlags   , numPtl );
     2576  xResizeVector( m_tmpConstraintChromaFormats    , numPtl );
     2577
     2578  for (Int i = 0; i < m_profiles.size(); i++)
     2579  {
     2580    UIProfileName UIProfile = m_uiProfiles[i];
     2581
     2582    ChromaFormat maxChromaFormatIdc       ;
     2583    Int          maxInternalBitDepthLuma  ;
     2584    Int          maxInternalBitDepthChroma;
     2585    Int          maxNumRefLayers          ;
     2586
     2587    xGetMaxValuesOfApplicableLayers(vps, i, maxInternalBitDepthLuma,maxInternalBitDepthChroma, maxChromaFormatIdc, maxNumRefLayers );
     2588
     2589    switch ( UIProfile )
     2590    {
     2591    case UI_MULTIVIEWMAIN:
     2592      m_profiles[i] = Profile::MULTIVIEWMAIN;
     2593      m_onePictureOnlyConstraintFlags[i] = false;
     2594      break;
     2595#if NH_3D
     2596    case UI_MAIN3D:
     2597      m_profiles[i] = Profile::MAIN3D;
     2598      m_onePictureOnlyConstraintFlags[i] = false;
     2599      break;
     2600#endif
     2601    case UI_NONE:
     2602      m_profiles[i] = Profile::NONE;
     2603      m_onePictureOnlyConstraintFlags[i] = false;
     2604      break;
     2605    case UI_MAIN:
     2606      m_profiles[i] = Profile::MAIN;
     2607      m_onePictureOnlyConstraintFlags[i] = false;
     2608      break;
     2609    case UI_MAIN10:
     2610      m_profiles[i] = Profile::MAIN10;
     2611      m_onePictureOnlyConstraintFlags[i] = false;
     2612      break;
     2613    case UI_MAINSTILLPICTURE:
     2614      m_profiles[i] = Profile::MAINSTILLPICTURE;
     2615      m_onePictureOnlyConstraintFlags[i] = false;
     2616      break;
     2617    case UI_MAIN10_STILL_PICTURE:
     2618      m_profiles[i] = Profile::MAIN10;
     2619      m_onePictureOnlyConstraintFlags[i] = true;
     2620      break;
     2621    case UI_MAINREXT:
     2622      m_profiles[i] = Profile::MAINREXT;
     2623      m_onePictureOnlyConstraintFlags[i] = false;
     2624      break;
     2625    case UI_HIGHTHROUGHPUTREXT:
     2626      m_profiles[i] = Profile::HIGHTHROUGHPUTREXT;
     2627      m_onePictureOnlyConstraintFlags[i] = false;
     2628      break;
     2629#if NH_MV_ALLOW_NON_CONFORMING
     2630    case UI_MULTIVIEWMAIN_NONCONF:
     2631      m_profiles[i] = Profile::MULTIVIEWMAIN_NONCONFORMING;
     2632      m_onePictureOnlyConstraintFlags[i] = false;
     2633      break;
     2634#if NH_3D
     2635    case UI_MAIN3D_NONCONF:
     2636      m_profiles[i] = Profile::MAIN3D_NONCONFORMING;
     2637      m_onePictureOnlyConstraintFlags[i] = false;
     2638      break;
     2639#endif
     2640#endif
     2641
     2642    default:
     2643      if (UIProfile >= 1000 && UIProfile <= 12316)
     2644      {
     2645        m_profiles[i] = Profile::MAINREXT;
     2646        if (m_bitDepthConstraints[i] != 0 || m_tmpConstraintChromaFormats[i] != 0)
     2647        {
     2648          fprintf(stderr, "Error: The bit depth and chroma format constraints are not used when an explicit RExt profile is specified\n");
     2649          exit(EXIT_FAILURE);
     2650        }
     2651        m_bitDepthConstraints[i]           = (UIProfile%100);
     2652        m_intraConstraintFlags[i]          = ((UIProfile%10000)>=2000);
     2653        m_onePictureOnlyConstraintFlags[i] = (UIProfile >= 10000);
     2654        switch ((UIProfile/100)%10)
     2655        {
     2656        case 0:  m_tmpConstraintChromaFormats[i]=400; break;
     2657        case 1:  m_tmpConstraintChromaFormats[i]=420; break;
     2658        case 2:  m_tmpConstraintChromaFormats[i]=422; break;
     2659        default: m_tmpConstraintChromaFormats[i]=444; break;
     2660        }
     2661      }
     2662      else if (UIProfile >= 21308 && UIProfile <= 22316)
     2663      {
     2664        m_profiles[i] = Profile::HIGHTHROUGHPUTREXT;
     2665        if (m_bitDepthConstraints[i] != 0 || m_tmpConstraintChromaFormats[i] != 0)
     2666        {
     2667          fprintf(stderr, "Error: The bit depth and chroma format constraints are not used when an explicit RExt profile is specified\n");
     2668          exit(EXIT_FAILURE);
     2669        }
     2670        m_bitDepthConstraints[i]           = (UIProfile%100);
     2671        m_intraConstraintFlags[i]          = ((UIProfile%10000)>=2000);
     2672        m_onePictureOnlyConstraintFlags[i] = 0;
     2673        if((UIProfile == UI_HIGHTHROUGHPUT_444) || (UIProfile == UI_HIGHTHROUGHPUT_444_10) )
     2674        {
     2675          assert(m_cabacBypassAlignmentEnabledFlag==0);
     2676        }
     2677        switch ((UIProfile/100)%10)
     2678        {
     2679        case 0:  m_tmpConstraintChromaFormats[i]=400; break;
     2680        case 1:  m_tmpConstraintChromaFormats[i]=420; break;
     2681        case 2:  m_tmpConstraintChromaFormats[i]=422; break;
     2682        default: m_tmpConstraintChromaFormats[i]=444; break;
     2683        }
     2684      }
     2685      else
     2686      {
     2687        fprintf(stderr, "Error: Unprocessed UI profile\n");
     2688        assert(0);
     2689        exit(EXIT_FAILURE);
     2690      }
     2691      break;
     2692    }
     2693
     2694    switch (m_profiles[i])
     2695    {
     2696    case Profile::HIGHTHROUGHPUTREXT:
     2697      {
     2698        if (m_bitDepthConstraints[i] == 0)
     2699        {
     2700          m_bitDepthConstraints[i] = 16;
     2701        }
     2702        m_chromaFormatConstraints[i] = (m_tmpConstraintChromaFormats[i] == 0) ? CHROMA_444 : numberToChromaFormat(m_tmpConstraintChromaFormats[i]);
     2703      }
     2704      break;
     2705    case Profile::MAINREXT:
     2706
     2707      {
     2708        if (m_bitDepthConstraints[i] == 0 && m_tmpConstraintChromaFormats[i] == 0)
     2709        {
     2710          // produce a valid combination, if possible.
     2711          const Bool bUsingGeneralRExtTools  = m_transformSkipRotationEnabledFlag        ||
     2712            m_transformSkipContextEnabledFlag         ||
     2713            m_rdpcmEnabledFlag[RDPCM_SIGNAL_IMPLICIT] ||
     2714            m_rdpcmEnabledFlag[RDPCM_SIGNAL_EXPLICIT] ||
     2715            !m_enableIntraReferenceSmoothing         ||
     2716            m_persistentRiceAdaptationEnabledFlag     ||
     2717            m_log2MaxTransformSkipBlockSize!=2;
     2718          const Bool bUsingChromaQPAdjustment= m_diffCuChromaQpOffsetDepth >= 0;
     2719          const Bool bUsingExtendedPrecision = m_extendedPrecisionProcessingFlag;
     2720          if (m_onePictureOnlyConstraintFlags[i])
     2721          {
     2722            m_chromaFormatConstraints[i] = CHROMA_444;
     2723            if (m_intraConstraintFlags[i] != true)
     2724            {
     2725              fprintf(stderr, "Error: Intra constraint flag must be true when one_picture_only_constraint_flag is true\n");
     2726              exit(EXIT_FAILURE);
     2727            }
     2728            const Int maxBitDepth = maxChromaFormatIdc==CHROMA_400 ? maxInternalBitDepthLuma : std::max( maxInternalBitDepthLuma, maxInternalBitDepthChroma);
     2729            m_bitDepthConstraints[i] = maxBitDepth>8 ? 16:8;
     2730          }
     2731          else
     2732          {
     2733            m_chromaFormatConstraints[i] = NUM_CHROMA_FORMAT;
     2734
     2735            UInt tempBitDepthConstraint = (UInt) m_bitDepthConstraints[i];
     2736
     2737            automaticallySelectRExtProfile(bUsingGeneralRExtTools,
     2738              bUsingChromaQPAdjustment,
     2739              bUsingExtendedPrecision,
     2740              m_intraConstraintFlags[i],
     2741              tempBitDepthConstraint,
     2742              m_chromaFormatConstraints[i],
     2743              maxChromaFormatIdc==CHROMA_400 ? maxInternalBitDepthLuma : std::max(maxInternalBitDepthLuma, maxInternalBitDepthChroma),
     2744              maxChromaFormatIdc);
     2745
     2746            m_bitDepthConstraints[i] = (Int) tempBitDepthConstraint;
     2747          }
     2748        }
     2749        else if (m_bitDepthConstraints[i] == 0 || m_tmpConstraintChromaFormats[i] == 0)
     2750        {
     2751          fprintf(stderr, "Error: The bit depth and chroma format constraints must either both be specified or both be configured automatically\n");
     2752          exit(EXIT_FAILURE);
     2753        }
     2754        else
     2755        {
     2756          m_chromaFormatConstraints[i] = numberToChromaFormat(m_tmpConstraintChromaFormats[i]);
     2757        }
     2758      }
     2759      break;
     2760    case Profile::MAIN:
     2761    case Profile::MAIN10:
     2762    case Profile::MAINSTILLPICTURE:
     2763      m_chromaFormatConstraints[i] = (m_tmpConstraintChromaFormats[i] == 0) ? maxChromaFormatIdc : numberToChromaFormat(m_tmpConstraintChromaFormats[i]);
     2764      m_bitDepthConstraints[i] = (m_profiles[i] == Profile::MAIN10?10:8);
     2765      break;
     2766#if NH_MV_ALLOW_NON_CONFORMING
     2767    case Profile::MULTIVIEWMAIN_NONCONFORMING:
     2768#if NH_3D
     2769    case Profile::MAIN3D_NONCONFORMING:
     2770#endif
     2771#endif
     2772    case Profile::NONE:
     2773
     2774      m_chromaFormatConstraints[i] = maxChromaFormatIdc;
     2775      m_bitDepthConstraints[i]     = maxChromaFormatIdc==CHROMA_400 ? maxInternalBitDepthLuma : std::max(maxInternalBitDepthLuma, maxInternalBitDepthChroma);
     2776      break;
     2777    case Profile::MULTIVIEWMAIN:
     2778      m_chromaFormatConstraints[i] = CHROMA_420;
     2779      m_bitDepthConstraints[i]     = 8;
     2780      break;
     2781
     2782#if NH_3D
     2783    case Profile::MAIN3D:
     2784      // Here depth layers could use a different ptl struct.
     2785      // For simplicity, depth and texture share currently the same.
     2786      m_chromaFormatConstraints[i] = CHROMA_420;
     2787      m_bitDepthConstraints[i]     = 8;
     2788      break;
     2789#endif
     2790    default:
     2791      fprintf(stderr, "Unknown profile selected\n");
     2792      exit(EXIT_FAILURE);
     2793      break;
     2794    }
     2795  }
     2796}
     2797#endif
    21362798
    21372799// ====================================================================================================================
    21382800// Private member functions
    21392801// ====================================================================================================================
     2802
     2803#if NH_MV
     2804Void TAppEncCfg::xCheckProfiles( const TComVPS& vps )
     2805{
     2806  Bool check_failed = false;
     2807
     2808
     2809#define xConfirmPara(a,b) check_failed |= confirmPara(a,b)
     2810
     2811  // TBD: disallow 3D tools when 3D Main profile is not used.
     2812
     2813  for (Int i = 0; i < m_profiles.size(); i++ )
     2814  {
     2815    ChromaFormat maxChromaFormatIdc;
     2816    Int          maxBitDepthLuma   ;
     2817    Int          maxBitDepthChroma ;
     2818    Int          maxNumRefLayers   ;
     2819
     2820    xGetMaxValuesOfApplicableLayers(vps, i, maxBitDepthLuma, maxBitDepthChroma , maxChromaFormatIdc, maxNumRefLayers );
     2821
     2822    const UInt maxBitDepth=(maxChromaFormatIdc==CHROMA_400) ? maxBitDepthLuma : std::max(maxBitDepthLuma, maxBitDepthChroma);
     2823
     2824    xConfirmPara(m_bitDepthConstraints    [i] < maxBitDepth       , "The internalBitDepth must not be greater than the bitDepthConstraint value"      );
     2825    xConfirmPara(m_chromaFormatConstraints[i] < maxChromaFormatIdc, "The chroma format used must not be greater than the chromaFormatConstraint value");
     2826
     2827    switch (m_profiles[i] )
     2828    {
     2829    case Profile::MAINREXT:
     2830    case Profile::HIGHTHROUGHPUTREXT:
     2831
     2832      {
     2833        xConfirmPara(m_lowerBitRateConstraintFlags[i] == false  &&  m_intraConstraintFlags[i] == false                        , "The lowerBitRateConstraint flag cannot be false when intraConstraintFlag is false");
     2834        xConfirmPara(m_cabacBypassAlignmentEnabledFlag          &&              m_profiles[i] != Profile::HIGHTHROUGHPUTREXT  , "AlignCABACBeforeBypass must not be enabled unless the high throughput profile is being used.");
     2835
     2836        if (m_profiles[i] == Profile::MAINREXT)
     2837        {
     2838          const UInt intraIdx        = m_intraConstraintFlags[i] ? 1:0;
     2839          const UInt bitDepthIdx     = (m_bitDepthConstraints[i] == 8 ? 0 : (m_bitDepthConstraints[i] ==10 ? 1 : (m_bitDepthConstraints[i] == 12 ? 2 : (m_bitDepthConstraints[i] == 16 ? 3 : 4 ))));
     2840          const UInt chromaFormatIdx = UInt(m_chromaFormatConstraints[i]);
     2841          const Bool bValidProfile   = (bitDepthIdx > 3 || chromaFormatIdx>3) ? false : (validRExtProfileNames[intraIdx][bitDepthIdx][chromaFormatIdx] != UI_NONE);
     2842
     2843          xConfirmPara(!bValidProfile, "Invalid intra constraint flag, bit depth constraint flag and chroma format constraint flag combination for a RExt profile");
     2844          const Bool bUsingGeneralRExtTools  = m_transformSkipRotationEnabledFlag   ||
     2845            m_transformSkipContextEnabledFlag                                       ||
     2846            m_rdpcmEnabledFlag[RDPCM_SIGNAL_IMPLICIT]                               ||
     2847            m_rdpcmEnabledFlag[RDPCM_SIGNAL_EXPLICIT]                               ||
     2848            !m_enableIntraReferenceSmoothing                                        ||
     2849            m_persistentRiceAdaptationEnabledFlag                                   ||
     2850            m_log2MaxTransformSkipBlockSize!=2;
     2851          const Bool bUsingChromaQPTool      = m_diffCuChromaQpOffsetDepth >= 0;
     2852          const Bool bUsingExtendedPrecision = m_extendedPrecisionProcessingFlag;
     2853
     2854          xConfirmPara((m_chromaFormatConstraints[i]==CHROMA_420 || m_chromaFormatConstraints[i]==CHROMA_400) && bUsingChromaQPTool, "CU Chroma QP adjustment cannot be used for 4:0:0 or 4:2:0 RExt profiles");
     2855          xConfirmPara(m_bitDepthConstraints[i] != 16 && bUsingExtendedPrecision, "Extended precision can only be used in 16-bit RExt profiles");
     2856          if (!(m_chromaFormatConstraints[i] == CHROMA_400 && m_bitDepthConstraints[i] == 16) && m_chromaFormatConstraints[i]!=CHROMA_444)
     2857          {
     2858            xConfirmPara(bUsingGeneralRExtTools, "Combination of tools and profiles are not possible in the specified RExt profile.");
     2859          }
     2860          xConfirmPara( m_onePictureOnlyConstraintFlags[i] && m_chromaFormatConstraints[i]!=CHROMA_444, "chroma format constraint must be 4:4:4 when one-picture-only constraint flag is 1");
     2861          xConfirmPara( m_onePictureOnlyConstraintFlags[i] && m_bitDepthConstraints[i] != 8 && m_bitDepthConstraints[i] != 16, "bit depth constraint must be 8 or 16 when one-picture-only constraint flag is 1");
     2862          xConfirmPara( m_onePictureOnlyConstraintFlags[i] && m_framesToBeEncoded > 1, "Number of frames to be encoded must be 1 when one-picture-only constraint flag is 1.");
     2863
     2864          if (!m_intraConstraintFlags[i] && m_bitDepthConstraints[i]==16 && m_chromaFormatConstraints[i]==CHROMA_444)
     2865          {
     2866            fprintf(stderr, "********************************************************************************************************\n");
     2867            fprintf(stderr, "** WARNING: The RExt constraint flags describe a non standard combination (used for development only) **\n");
     2868            fprintf(stderr, "********************************************************************************************************\n");
     2869          }
     2870        }
     2871        else
     2872        {
     2873          xConfirmPara( m_chromaFormatConstraints[i] != CHROMA_444, "chroma format constraint must be 4:4:4 in the High Throughput 4:4:4 16-bit Intra profile.");
     2874          const UInt intraIdx      =   m_intraConstraintFlags[i]     ? 1     : 0;
     2875          const UInt bitDepthIdx   = ( m_bitDepthConstraints[i] == 8 ? 0     : (m_bitDepthConstraints[i] == 10 ? 1 : (m_bitDepthConstraints[i] == 14 ? 2 : (m_bitDepthConstraints[i] == 16 ? 3 : 4 ))));
     2876          const Bool bValidProfile = ( bitDepthIdx > 3)              ? false : (validRExtHighThroughPutProfileNames[intraIdx][bitDepthIdx] != UI_NONE);
     2877          xConfirmPara(!bValidProfile, "Invalid intra constraint flag and bit depth constraint flag combination for a RExt high profile throughput profile");
     2878          if(bitDepthIdx < 2)
     2879          {
     2880            xConfirmPara((m_extendedPrecisionProcessingFlag || m_cabacBypassAlignmentEnabledFlag), "Invalid configuration for a RExt high throughput 8 and 10 bit profile");
     2881          }
     2882          if(bitDepthIdx == 3)
     2883          {
     2884            xConfirmPara(!m_cabacBypassAlignmentEnabledFlag, "Cabac Bypass Alignment flag must be 1 in the High Throughput 4:4:4 16-bit Intra profile");
     2885          }
     2886          else if(bitDepthIdx < 3)
     2887          {
     2888            xConfirmPara(!m_entropyCodingSyncEnabledFlag, "WPP flag must be 1 in the High Throughput 4:4:4 non 16-bit Intra profile");
     2889          }
     2890        }
     2891      }
     2892      break;
     2893    case Profile::MAIN:
     2894    case Profile::MAIN10:
     2895    case Profile::MAINSTILLPICTURE:
     2896    case Profile::MULTIVIEWMAIN:
     2897#if NH_3D
     2898    case Profile::MAIN3D:
     2899#endif
     2900      {
     2901        xConfirmPara(m_bitDepthConstraints        [i] != ((m_profiles[i]==Profile::MAIN10)?10:8), "BitDepthConstraint must be 8 for MAIN profile, Multiview main profile, and 3D Main profile and 10 for MAIN10 profile.");
     2902#if NH_3D
     2903        if (m_profiles[i] == Profile::MAIN3D )
     2904        {
     2905          xConfirmPara(m_chromaFormatConstraints    [i] != CHROMA_420 && m_chromaFormatConstraints    [i] != CHROMA_400   , "ChromaFormatConstraint must be 420 or 400 for the 3D main profile.");
     2906        }
     2907        else
     2908#endif
     2909        {
     2910          xConfirmPara(m_chromaFormatConstraints    [i] != CHROMA_420   , "ChromaFormatConstraint must be 420 for non main-RExt profiles.");
     2911        }
     2912       
     2913        xConfirmPara(m_intraConstraintFlags       [i] == true         , "IntraConstraintFlag must be false for non main_RExt profiles.");
     2914        xConfirmPara(m_lowerBitRateConstraintFlags[i] == false        , "LowerBitrateConstraintFlag must be true for non main-RExt profiles.");
     2915        xConfirmPara(m_profiles[i] == Profile::MAINSTILLPICTURE && m_framesToBeEncoded > 1, "Number of frames to be encoded must be 1 when main still picture profile is used.");
     2916
     2917        xConfirmPara(m_crossComponentPredictionEnabledFlag    == true , "CrossComponentPrediction must not be used for non main-RExt profiles.");
     2918        xConfirmPara(m_log2MaxTransformSkipBlockSize          != 2    , "Transform Skip Log2 Max Size must be 2 for V1 profiles.");
     2919        xConfirmPara(m_transformSkipRotationEnabledFlag       == true , "UseResidualRotation must not be enabled for non main-RExt profiles.");
     2920        xConfirmPara(m_transformSkipContextEnabledFlag        == true , "UseSingleSignificanceMapContext must not be enabled for non main-RExt profiles.");
     2921        xConfirmPara(m_rdpcmEnabledFlag[RDPCM_SIGNAL_IMPLICIT]== true , "ImplicitResidualDPCM must not be enabled for non main-RExt profiles.");
     2922        xConfirmPara(m_rdpcmEnabledFlag[RDPCM_SIGNAL_EXPLICIT]== true , "ExplicitResidualDPCM must not be enabled for non main-RExt profiles.");
     2923        xConfirmPara(m_persistentRiceAdaptationEnabledFlag    == true , "GolombRiceParameterAdaption must not be enabled for non main-RExt profiles.");
     2924        xConfirmPara(m_extendedPrecisionProcessingFlag        == true , "UseExtendedPrecision must not be enabled for non main-RExt profiles.");
     2925        xConfirmPara(m_highPrecisionOffsetsEnabledFlag        == true , "UseHighPrecisionPredictionWeighting must not be enabled for non main-RExt profiles.");
     2926        xConfirmPara(m_enableIntraReferenceSmoothing          == false, "EnableIntraReferenceSmoothing must be enabled for non main-RExt profiles.");
     2927        xConfirmPara(m_cabacBypassAlignmentEnabledFlag                , "AlignCABACBeforeBypass cannot be enabled for non main-RExt profiles.");
     2928
     2929        if ( m_profiles[i] == Profile::MULTIVIEWMAIN )
     2930        {
     2931          xConfirmPara( maxNumRefLayers > 4, "When using the MV-Main profile, NumRefLayers must be less than or equal to 4 for all layers in the subBitstream"  );
     2932          // -  For a layer with nuh_layer_id iNuhLId equal to any value included in layerIdListTarget that was used to derive subBitstream,
     2933          //    the value of NumRefLayers[ iNuhLId ], which specifies the total number of direct and indirect reference layers and is derived as
     2934          //    specified in F.7.4.3.1, shall be less than or equal to 4.
     2935        }
     2936
     2937#if NH_3D
     2938        if ( m_profiles[i] == Profile::MAIN3D )
     2939        {
     2940          xConfirmPara( maxNumRefLayers > 9, "When using the 3D-Main profile, NumRefLayers must be less than or equal to 9 for all layers in the subBitstream."  );
     2941            // -  For a layer with nuh_layer_id iNuhLId equal to any value included in layerIdListTarget that was used to derive subBitstream,
     2942            //   the value of NumRefLayers[ iNuhLId ], which specifies the total number of direct and indirect reference layers and is derived as
     2943            //   specified in F.7.4.3.1, shall be less than or equal to 9.
     2944        }
     2945#endif
     2946
     2947
     2948      }
     2949      break;
     2950#if NH_MV_ALLOW_NON_CONFORMING
     2951    case Profile::MULTIVIEWMAIN_NONCONFORMING:
     2952#if NH_3D
     2953    case Profile::MAIN3D_NONCONFORMING:
     2954#endif
     2955#endif
     2956    case Profile::NONE:
     2957      // Non-conforming configuration, so all settings are valid.
     2958      break;
     2959    default:
     2960      xConfirmPara( 1, "Unknown profile selected.");
     2961      break;
     2962    }
     2963
     2964    if ( check_failed )
     2965    {
     2966      printf("Error: Checking VpsProfileTierLevel[%d]. \n", i );
     2967      exit(EXIT_FAILURE);
     2968    }
     2969
     2970  }
     2971  #undef xConfirmPara
     2972
     2973  Bool anyMultiLayerProfile = false;
     2974
     2975  for (Int i = 0; i < m_profiles.size(); i++ )
     2976  {
     2977    anyMultiLayerProfile = ( anyMultiLayerProfile
     2978       
     2979      ||  (m_profiles[i] == Profile::MULTIVIEWMAIN)
     2980#if NH_3D
     2981      || ( m_profiles[i] == Profile::MAIN3D       )
     2982#endif
     2983      ) ;
     2984  }
     2985
     2986  if ( anyMultiLayerProfile && ( m_profiles[0] != Profile::MAIN || m_profiles[1] != Profile::MAIN  ) )
     2987  {
     2988    fprintf(stderr, "Error: The base layer must conform to the Main profile for Multilayer coding.\n");
     2989    exit(EXIT_FAILURE);
     2990  }
     2991
     2992}
     2993
     2994#endif
    21402995
    21412996Void TAppEncCfg::xCheckParameter()
     
    21683023  Bool check_failed = false; /* abort if there is a fatal configuration problem */
    21693024#define xConfirmPara(a,b) check_failed |= confirmPara(a,b)
    2170 
     3025 
    21713026  xConfirmPara(m_bitstreamFileName.empty(), "A bitstream file name must be specified (BitstreamFile)");
     3027#if !NH_MV
    21723028  const UInt maxBitDepth=(m_chromaFormatIDC==CHROMA_400) ? m_internalBitDepth[CHANNEL_TYPE_LUMA] : std::max(m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA]);
     3029
    21733030  xConfirmPara(m_bitDepthConstraint<maxBitDepth, "The internalBitDepth must not be greater than the bitDepthConstraint value");
    21743031  xConfirmPara(m_chromaFormatConstraint<m_chromaFormatIDC, "The chroma format used must not be greater than the chromaFormatConstraint value");
    2175 #if NH_MV
    2176   Profile::Name & m_profile = m_profiles[0];
    2177 #endif
    2178 
    2179   if (m_profile==Profile::MAINREXT || m_profile==Profile::HIGHTHROUGHPUTREXT)
     3032
     3033  switch (m_profile)
     3034  {
     3035    case Profile::MAINREXT:
     3036    case Profile::HIGHTHROUGHPUTREXT:
     3037
    21803038  {
    21813039    xConfirmPara(m_lowerBitRateConstraintFlag==false && m_intraConstraintFlag==false, "The lowerBitRateConstraint flag cannot be false when intraConstraintFlag is false");
     
    21863044      const UInt bitDepthIdx = (m_bitDepthConstraint == 8 ? 0 : (m_bitDepthConstraint ==10 ? 1 : (m_bitDepthConstraint == 12 ? 2 : (m_bitDepthConstraint == 16 ? 3 : 4 ))));
    21873045      const UInt chromaFormatIdx = UInt(m_chromaFormatConstraint);
    2188       const Bool bValidProfile = (bitDepthIdx > 3 || chromaFormatIdx>3) ? false : (validRExtProfileNames[intraIdx][bitDepthIdx][chromaFormatIdx] != NONE);
     3046          const Bool bValidProfile = (bitDepthIdx > 3 || chromaFormatIdx>3) ? false : (validRExtProfileNames[intraIdx][bitDepthIdx][chromaFormatIdx] != UI_NONE);
    21893047      xConfirmPara(!bValidProfile, "Invalid intra constraint flag, bit depth constraint flag and chroma format constraint flag combination for a RExt profile");
    21903048      const Bool bUsingGeneralRExtTools  = m_transformSkipRotationEnabledFlag        ||
     
    22183076    {
    22193077      xConfirmPara( m_chromaFormatConstraint != CHROMA_444, "chroma format constraint must be 4:4:4 in the High Throughput 4:4:4 16-bit Intra profile.");
    2220       xConfirmPara( m_bitDepthConstraint     != 16,         "bit depth constraint must be 4:4:4 in the High Throughput 4:4:4 16-bit Intra profile.");
    2221       xConfirmPara( m_intraConstraintFlag    != 1,          "intra constraint flag must be 1 in the High Throughput 4:4:4 16-bit Intra profile.");
    2222     }
    2223   }
    2224   else
     3078          const UInt intraIdx = m_intraConstraintFlag ? 1:0;
     3079          const UInt bitDepthIdx = (m_bitDepthConstraint == 8 ? 0 : (m_bitDepthConstraint ==10 ? 1 : (m_bitDepthConstraint == 14 ? 2 : (m_bitDepthConstraint == 16 ? 3 : 4 ))));
     3080          const Bool bValidProfile = (bitDepthIdx > 3) ? false : (validRExtHighThroughPutProfileNames[intraIdx][bitDepthIdx] != UI_NONE);
     3081          xConfirmPara(!bValidProfile, "Invalid intra constraint flag and bit depth constraint flag combination for a RExt high profile throughput profile");
     3082          if(bitDepthIdx < 2)
     3083          {
     3084            xConfirmPara((m_extendedPrecisionProcessingFlag || m_cabacBypassAlignmentEnabledFlag), "Invalid configuration for a RExt high throughput 8 and 10 bit profile");
     3085    }
     3086          if(bitDepthIdx == 3)
     3087          {
     3088            xConfirmPara(!m_cabacBypassAlignmentEnabledFlag, "Cabac Bypass Alignment flag must be 1 in the High Throughput 4:4:4 16-bit Intra profile");
     3089  }
     3090          else if(bitDepthIdx < 3)
     3091          {
     3092            xConfirmPara(!m_entropyCodingSyncEnabledFlag, "WPP flag must be 1 in the High Throughput 4:4:4 non 16-bit Intra profile");
     3093          }
     3094        }
     3095      }
     3096      break;
     3097    case Profile::MAIN:
     3098    case Profile::MAIN10:
     3099    case Profile::MAINSTILLPICTURE:
    22253100  {
    22263101    xConfirmPara(m_bitDepthConstraint!=((m_profile==Profile::MAIN10)?10:8), "BitDepthConstraint must be 8 for MAIN profile and 10 for MAIN10 profile.");
     
    22423117    xConfirmPara(m_cabacBypassAlignmentEnabledFlag, "AlignCABACBeforeBypass cannot be enabled for non main-RExt profiles.");
    22433118  }
    2244 
     3119      break;
     3120    case Profile::NONE:
     3121      // Non-conforming configuration, so all settings are valid.
     3122      break;
     3123    default:
     3124      xConfirmPara( 1, "Unknown profile selected.");
     3125      break;
     3126  }
     3127#endif
     3128
     3129#if NH_MV
     3130  for (Int i = 0; i < m_numRepFormats; i++ )
     3131  {
     3132    Int* m_internalBitDepth    = &m_internalBitDepths   [i][0];
     3133    Int* m_inputBitDepth       = &m_inputBitDepths      [i][0];
     3134    Int* m_MSBExtendedBitDepth = &m_MSBExtendedBitDepths[i][0]; 
     3135#endif
    22453136  // check range of parameters
    22463137  xConfirmPara( m_inputBitDepth[CHANNEL_TYPE_LUMA  ] < 8,                                   "InputBitDepth must be at least 8" );
     
    22633154  }
    22643155#endif
    2265 
    22663156  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)" );
    22673157  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)" );
    22683158
    22693159#if NH_MV
     3160  }
    22703161  for (Int i = 0; i < m_numberOfLayers; i++)
    22713162  {
    2272     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");
    2273     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");
     3163    Int repFormatIdx = m_layerIdxInVpsToRepFormatIdx[i];
     3164    xConfirmPara( m_log2SaoOffsetScale[i][CHANNEL_TYPE_LUMA]   > (m_internalBitDepths[repFormatIdx][CHANNEL_TYPE_LUMA  ]<10?0:(m_internalBitDepths[repFormatIdx][CHANNEL_TYPE_LUMA  ]-10)), "SaoLumaOffsetBitShift must be in the range of 0 to InternalBitDepth-10, inclusive");
     3165    xConfirmPara( m_log2SaoOffsetScale[i][CHANNEL_TYPE_CHROMA] > (m_internalBitDepths[repFormatIdx][CHANNEL_TYPE_CHROMA]<10?0:(m_internalBitDepths[repFormatIdx][CHANNEL_TYPE_CHROMA]-10)), "SaoChromaOffsetBitShift must be in the range of 0 to InternalBitDepthC-10, inclusive");
     3166  }
     3167
     3168  for (Int i = 0; i < m_numRepFormats; i++)
     3169  {
     3170    xConfirmPara( m_chromaFormatIDCs[i] >= NUM_CHROMA_FORMAT,                                     "ChromaFormatIDC must be either 400, 420, 422 or 444" );
    22743171  }
    22753172#else
    22763173  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");
    22773174  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");
    2278 #endif
    2279 
    22803175  xConfirmPara( m_chromaFormatIDC >= NUM_CHROMA_FORMAT,                                     "ChromaFormatIDC must be either 400, 420, 422 or 444" );
     3176#endif
     3177
    22813178  std::string sTempIPCSC="InputColourSpaceConvert must be empty, "+getListOfColourSpaceConverts(true);
    22823179  xConfirmPara( m_inputColourSpaceConvert >= NUMBER_INPUT_COLOUR_SPACE_CONVERSIONS,         sTempIPCSC.c_str() );
     3180#if NH_MV
     3181  for (Int i = 0 ; i < m_InputChromaFormatIDC.size(); i++ )
     3182  {
     3183    xConfirmPara( m_InputChromaFormatIDC[i] >= NUM_CHROMA_FORMAT,                                "InputChromaFormatIDC must be either 400, 420, 422 or 444" );
     3184  }
     3185#else
    22833186  xConfirmPara( m_InputChromaFormatIDC >= NUM_CHROMA_FORMAT,                                "InputChromaFormatIDC must be either 400, 420, 422 or 444" );
     3187#endif
    22843188  xConfirmPara( m_iFrameRate <= 0,                                                          "Frame rate must be more than 1" );
    22853189  xConfirmPara( m_temporalSubsampleRatio < 1,                                               "Temporal subsample rate must be no less than 1" );
     
    22913195  xConfirmPara( m_layerIdInNuh[0] != 0      , "LayerIdInNuh must be 0 for the first layer. ");
    22923196  xConfirmPara( (m_layerIdInNuh.size()!=1) && (m_layerIdInNuh.size() < m_numberOfLayers) , "LayerIdInNuh must be given for all layers. ");
     3197
     3198#if NH_MV
     3199  xConfirmPara( !m_shareParameterSets && (m_numberOfLayers > 16)                            , "When NumberOfLayers is greater than 16, ShareParameterSets must be 1."); 
     3200  xConfirmPara( ! (m_layerIdxInVpsToGopDefIdx.size() == 0     || m_layerIdxInVpsToGopDefIdx.size() == m_numberOfLayers), "The number of entries in LayerIdxInVpsToGopDefIdx must zero or equal to NumberOfLayers."); 
     3201  xConfirmPara( ! (m_layerIdxInVpsToRepFormatIdx.size() == 0  || m_layerIdxInVpsToRepFormatIdx.size() == m_numberOfLayers), "The number of entries in LayerIdxInVpsToRepFormatIdx must zero or equal to NumberOfLayers."); 
     3202 
     3203#endif
    22933204
    22943205#if NH_3D
     
    23703281      xConfirmPara( allEqual , "Each layer shall have a different position in scalability space." );
    23713282
    2372 #if !H_3D_FCO
    23733283      if ( numDiff  == 1 )
    23743284      {
     
    23813291        xConfirmPara( shallBeButIsNotIncreasing,  "DimensionIds shall be increasing within one dimension. " );
    23823292      }
    2383 #endif
    23843293    }
    23853294  }
     
    24473356
    24483357  // PTL
    2449   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." );
     3358  xConfirmPara( ( m_uiProfiles.size() != m_inblFlag.size() || m_uiProfiles.size() != m_level.size()  ||  m_uiProfiles.size() != m_levelTier.size() ), "The number of Profiles, Levels, Tiers and InblFlags must be equal." );
    24503359
    24513360  if ( m_numberOfLayers > 1)
    24523361  {
    2453     xConfirmPara( m_profiles.size() <= 1, "The number of profiles, tiers, levels, and inblFlags must be greater than 1.");
     3362    xConfirmPara( m_uiProfiles.size() <= 1, "The number of profiles, tiers, levels, and inblFlags must be greater than 1.");
    24543363    xConfirmPara( m_inblFlag[0], "VpsProfileTierLevel[0] must have inblFlag equal to 0");
    2455     if (m_profiles.size() > 1 )
    2456     {
    2457       xConfirmPara( m_profiles[0]  != m_profiles[1], "The profile in VpsProfileTierLevel[1] must be equal to the profile in VpsProfileTierLevel[0].");
     3364    if (m_uiProfiles.size() > 1 )
     3365    {
     3366      xConfirmPara( m_uiProfiles[0]  != m_uiProfiles[1], "The profile in VpsProfileTierLevel[1] must be equal to the profile in VpsProfileTierLevel[0].");
    24583367      xConfirmPara( m_inblFlag[0] != m_inblFlag[1], "inblFlag in VpsProfileTierLevel[1] must be equal to the inblFlag in VpsProfileTierLevel[0].");
    24593368    }
     
    24673376    for (Int j = 0; j < m_directRefLayers[i].size(); j++)
    24683377    {
    2469       xConfirmPara( m_directRefLayers[i][j] < 0 || m_directRefLayers[i][j] >= i , "Reference layer id shall be greater than or equal to 0 and less than dependent layer id");
     3378      if ( m_directRefLayers[i][j] < 0 || m_directRefLayers[i][j] >= i )
     3379      {
     3380        printf( "Error: Reference layer id (%d) shall be greater than or equal to 0 and less than dependent layer id (%d). ", m_directRefLayers[i][j],  i );
     3381        check_failed = true;
     3382      }       
     3383
    24703384      xConfirmPara( m_dependencyTypes[i][j] < 0 || m_dependencyTypes[i][j] >  6 , "Dependency type shall be greater than or equal to 0 and less than 7");
    24713385    }       
     
    24993413  }
    25003414
     3415#if NH_MV
     3416  for (Int i = 0; i < m_numRepFormats; i++)
     3417  {
     3418    if(m_crossComponentPredictionEnabledFlag && (m_chromaFormatIDCs[i] != CHROMA_444))
     3419#else
    25013420  if(m_crossComponentPredictionEnabledFlag && (m_chromaFormatIDC != CHROMA_444))
     3421#endif
    25023422  {
    25033423    fprintf(stderr, "****************************************************************************\n");
     
    25073427    m_crossComponentPredictionEnabledFlag = false;
    25083428  }
     3429#if NH_MV
     3430  }
     3431#endif
    25093432
    25103433  if ( m_CUTransquantBypassFlagForce && m_bUseHADME )
     
    25313454  for( Int layer = 0; layer < m_numberOfLayers; layer++ )
    25323455  {
    2533     xConfirmPara( m_iQP[layer] <  -6 * (m_internalBitDepth[CHANNEL_TYPE_LUMA] - 8) || m_iQP[layer] > 51,      "QP exceeds supported range (-QpBDOffsety to 51)" );
     3456    Int repFormatIdx = m_layerIdxInVpsToRepFormatIdx[layer];
     3457    xConfirmPara( m_iQP[layer] <  -6 * (m_internalBitDepths[repFormatIdx][CHANNEL_TYPE_LUMA] - 8) || m_iQP[layer] > 51,      "QP exceeds supported range (-QpBDOffsety to 51)" );
    25343458    xConfirmPara( m_deblockingFilterMetric!=0 && (m_bLoopFilterDisable[layer] || m_loopFilterOffsetInPPS), "If DeblockingFilterMetric is true then both LoopFilterDisable and LoopFilterOffsetInPPS must be 0");
    25353459  }
    25363460#else
    25373461  xConfirmPara( m_iQP <  -6 * (m_internalBitDepth[CHANNEL_TYPE_LUMA] - 8) || m_iQP > 51,    "QP exceeds supported range (-QpBDOffsety to 51)" );
    2538 #if W0038_DB_OPT
    25393462  xConfirmPara( m_deblockingFilterMetric!=0 && (m_bLoopFilterDisable || m_loopFilterOffsetInPPS), "If DeblockingFilterMetric is non-zero then both LoopFilterDisable and LoopFilterOffsetInPPS must be 0");
    2540 #else
    2541   xConfirmPara( m_DeblockingFilterMetric && (m_bLoopFilterDisable || m_loopFilterOffsetInPPS), "If DeblockingFilterMetric is true then both LoopFilterDisable and LoopFilterOffsetInPPS must be 0");
    2542 #endif
    25433463#endif
    25443464 
     
    25523472#endif
    25533473  xConfirmPara( m_iMaxDeltaQP > 7,                                                          "Absolute Delta QP exceeds supported range (0 to 7)" );
     3474  xConfirmPara(m_lumaLevelToDeltaQPMapping.mode &&  m_uiDeltaQpRD > 0, "Luma-level-based Delta QP cannot be used together with slice level multiple-QP optimization\n" );
    25543475  xConfirmPara( m_iMaxCuDQPDepth > m_uiMaxCUDepth - 1,                                          "Absolute depth for a minimum CuDQP exceeds maximum coding unit depth" );
    25553476
     
    25603481
    25613482  xConfirmPara( m_iQPAdaptationRange <= 0,                                                  "QP Adaptation Range must be more than 0" );
     3483#if NH_MV
     3484  for (Int i = 0; i < m_numberOfLayers; i++ )
     3485  {
     3486    if (m_iDecodingRefreshType == 2 || m_saoResetEncoderStateAfterIRAP)
     3487    {
     3488      xConfirmPara( m_iIntraPeriod[i] > 0 && m_iIntraPeriod[i] <= m_iGOPSize ,                      "Intra period must be larger than GOP size for periodic IDR pictures");
     3489    }
     3490  }
     3491#else
    25623492  if (m_iDecodingRefreshType == 2)
    25633493  {
    2564 #if NH_MV
    2565     for (Int i = 0; i < m_numberOfLayers; i++ )
    2566     {
    2567       xConfirmPara( m_iIntraPeriod[i] > 0 && m_iIntraPeriod[i] <= m_iGOPSize ,                      "Intra period must be larger than GOP size for periodic IDR pictures");
    2568 #if OPTIONAL_RESET_SAO_ENCODING_AFTER_IRAP
     3494   xConfirmPara( m_iIntraPeriod > 0 && m_iIntraPeriod <= m_iGOPSize ,                      "Intra period must be larger than GOP size for periodic IDR pictures");
     3495  }
    25693496  if (m_saoResetEncoderStateAfterIRAP)
    25703497  {
    2571     xConfirmPara( m_iIntraPeriod[i] > 0 && m_iIntraPeriod[i] <= m_iGOPSize ,                      "Intra period must be larger than GOP size when SAOResetEncoderStateAfterIRAP is enabled");
    2572   }
    2573 #endif
    2574 
    2575     }
    2576 #else
    2577 #if OPTIONAL_RESET_SAO_ENCODING_AFTER_IRAP
    2578   if (m_saoResetEncoderStateAfterIRAP)
    2579   {
    25803498    xConfirmPara( m_iIntraPeriod > 0 && m_iIntraPeriod <= m_iGOPSize ,                      "Intra period must be larger than GOP size when SAOResetEncoderStateAfterIRAP is enabled");
    25813499  }
    25823500#endif
    2583 
    2584    xConfirmPara( m_iIntraPeriod > 0 && m_iIntraPeriod <= m_iGOPSize ,                      "Intra period must be larger than GOP size for periodic IDR pictures");
    2585 #endif
    2586   }
     3501 
    25873502  xConfirmPara( m_uiMaxCUDepth < 1,                                                         "MaxPartitionDepth must be greater than zero");
    25883503  xConfirmPara( (m_uiMaxCUWidth  >> m_uiMaxCUDepth) < 4,                                    "Minimum partition width size should be larger than or equal to 8");
     
    25903505  xConfirmPara( m_uiMaxCUWidth < 16,                                                        "Maximum partition width size should be larger than or equal to 16");
    25913506  xConfirmPara( m_uiMaxCUHeight < 16,                                                       "Maximum partition height size should be larger than or equal to 16");
     3507#if NH_MV
     3508  for (Int i = 0; i < m_numRepFormats; i++ )
     3509  {
     3510    xConfirmPara( (m_iSourceWidths[i]  % (m_uiMaxCUWidth  >> (m_uiMaxCUDepth-1)))!=0,             "Resulting coded frame width must be a multiple of the minimum CU size");
     3511    xConfirmPara( (m_iSourceHeights[i] % (m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)))!=0,             "Resulting coded frame height must be a multiple of the minimum CU size");
     3512  }
     3513#else
    25923514  xConfirmPara( (m_iSourceWidth  % (m_uiMaxCUWidth  >> (m_uiMaxCUDepth-1)))!=0,             "Resulting coded frame width must be a multiple of the minimum CU size");
    25933515  xConfirmPara( (m_iSourceHeight % (m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)))!=0,             "Resulting coded frame height must be a multiple of the minimum CU size");
     3516#endif
    25943517
    25953518  xConfirmPara( m_uiQuadtreeTULog2MinSize < 2,                                        "QuadtreeTULog2MinSize must be 2 or greater.");
     
    26313554    for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
    26323555    {
     3556#if NH_MV
     3557      for (Int i = 0; i < m_numRepFormats; i++)
     3558      {
     3559        xConfirmPara(((m_MSBExtendedBitDepths[i][channelType] > m_internalBitDepths[i][channelType]) && m_bPCMInputBitDepthFlag), "PCM bit depth cannot be greater than internal bit depth (PCMInputBitDepthFlag cannot be used when InputBitDepth or MSBExtendedBitDepth > InternalBitDepth)");
     3560      }
     3561#else
    26333562      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)");
     3563#endif
    26343564    }
    26353565    xConfirmPara(  m_uiPCMLog2MinSize < 3,                                      "PCMLog2MinSize must be 3 or greater.");
     
    26493579
    26503580  Bool tileFlag = (m_numTileColumnsMinus1 > 0 || m_numTileRowsMinus1 > 0 );
     3581
     3582#if !NH_MV
    26513583  if (m_profile!=Profile::HIGHTHROUGHPUTREXT)
    26523584  {
    26533585    xConfirmPara( tileFlag && m_entropyCodingSyncEnabledFlag, "Tiles and entropy-coding-sync (Wavefronts) can not be applied together, except in the High Throughput Intra 4:4:4 16 profile");
    26543586  }
     3587#else
     3588  for (Int i = 0; i < m_numRepFormats; i++)
     3589  {
     3590    ChromaFormat m_chromaFormatIDC  = m_chromaFormatIDCs[i];
     3591    Int*         m_aiPad            = &m_aiPads          [i][0];
     3592    Int          m_confWinLeft      = m_confWinLefts    [i];
     3593    Int          m_confWinRight     = m_confWinRights   [i];
     3594    Int          m_confWinTop       = m_confWinTops     [i];
     3595    Int          m_confWinBottom    = m_confWinBottoms  [i]; 
     3596    Int          m_iSourceWidth     = m_iSourceWidths   [i];
     3597    Int          m_iSourceHeight    = m_iSourceHeights  [i];
     3598#endif
    26553599
    26563600  xConfirmPara( m_iSourceWidth  % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Picture width must be an integer multiple of the specified chroma subsampling");
     
    26743618    xConfirmPara( m_defDispWinBottomOffset % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Bottom default display window offset must be an integer multiple of the specified chroma subsampling");
    26753619  }
     3620
     3621#if NH_MV
     3622  }
     3623#endif
    26763624
    26773625#if NH_3D_VSO || NH_3D
     
    27173665      for( Int i = 0; i < MAX_GOP; i++ )
    27183666      {
    2719         if( m_GOPListMvc[k][i].m_POC != m_GOPListMvc[0][i].m_POC )
     3667        if( xGetGopEntries(k)[i].m_POC != xGetGopEntries(0)[i].m_POC )
    27203668        {
    2721           printf( "\nError: Frame%d_l%d POC %d is not identical to Frame%d POC\n", i, k, m_GOPListMvc[k][i].m_POC, i );
     3669          printf( "\nError: Frame%d_l%d POC %d is not identical to Frame%d POC\n", i, k, xGetGopEntries(k)[i].m_POC, i );
    27223670          bErrorMvePoc = true;
    27233671        }
     
    27313679  for( Int i = 0; i < MAX_GOP; i++ )
    27323680  {
    2733     if( m_GOPListMvc[0][i].m_numActiveRefLayerPics != 0 )
     3681    if( xGetGopEntries(0)[i].m_numActiveRefLayerPics != 0 )
    27343682    {
    27353683      printf( "\nError: Frame%d inter_layer refs not available in layer 0\n", i );
     
    27473695      for( Int i = 0; i < MAX_GOP+1; i++ )
    27483696      {
    2749         GOPEntry gopEntry = m_GOPListMvc[layer][i]; 
     3697        GOPEntry gopEntry = xGetGopEntries(layer)[i]; 
    27503698        for( Int j = 0; j < gopEntry.m_numActiveRefLayerPics; j++ )
    27513699        {
     
    27903738          {
    27913739            printf( "\nWarning: temporal references not possible for FrameI_l%d\n", layer );
    2792             for( Int j = 0; j < m_GOPListMvc[layer][MAX_GOP].m_numRefPics; j++ )
     3740            for( Int j = 0; j < xGetGopEntries(layer)[MAX_GOP].m_numRefPics; j++ )
    27933741            {
    27943742              gopEntry.m_referencePics[j] = 0;
     
    28503798    for( Int layer = 0; layer < m_numberOfLayers; layer++ )
    28513799    {
    2852       GOPEntry* m_GOPList            = m_GOPListMvc           [layer]; // It is not a member, but this name helps avoiding code duplication !!!
     3800      GOPEntry* m_GOPList            = xGetGopEntries         (layer); // It is not a member, but this name helps avoiding code duplication !!!
    28533801      Int&      m_extraRPSs          = m_extraRPSsMvc         [layer]; // It is not a member, but this name helps avoiding code duplication !!!
    28543802      Int&      m_maxTempLayer       = m_maxTempLayerMvc      [layer]; // It is not a member, but this name helps avoiding code duplication !!!
    28553803      Int*      m_maxDecPicBuffering = m_maxDecPicBufferingMvc[layer]; // It is not a member, but this name helps avoiding code duplication !!!
    2856       Int*      m_numReorderPics     = m_numReorderPicsMvc    [layer]; // It is not a member, but this name helps avoiding code duplication !!!
     3804      Int*      m_numReorderPics     = m_numReorderPicsMvc    [layer]; // It is not a member, but this name helps avoiding code duplication !!!     
    28573805#endif
    28583806
     
    28743822  else
    28753823  {
     3824#if !NH_MV
    28763825    xConfirmPara( m_intraConstraintFlag, "IntraConstraintFlag cannot be 1 for inter sequences");
     3826#endif
    28773827  }
    28783828
     
    29203870  }
    29213871
    2922 #if W0038_CQP_ADJ
    29233872  for(Int i=0; i<m_iGOPSize; i++)
    29243873  {
     
    29283877    xConfirmPara( abs(m_GOPList[i].m_CrQPoffset + m_crQpOffset) > 12, "Cr QP Offset for one of the GOP entries, when combined with the PPS Cr offset, exceeds supported range (-12 to 12)" );
    29293878  }
    2930   xConfirmPara( abs(m_sliceChromaQpOffsetIntraOrPeriodic[0]                 > 12), "Intra/periodic Cb QP Offset exceeds supported range (-12 to 12)" );
    2931   xConfirmPara( abs(m_sliceChromaQpOffsetIntraOrPeriodic[0]  + m_cbQpOffset > 12), "Intra/periodic Cb QP Offset, when combined with the PPS Cb offset, exceeds supported range (-12 to 12)" );
    2932   xConfirmPara( abs(m_sliceChromaQpOffsetIntraOrPeriodic[1]                 > 12), "Intra/periodic Cr QP Offset exceeds supported range (-12 to 12)" );
    2933   xConfirmPara( abs(m_sliceChromaQpOffsetIntraOrPeriodic[1]  + m_crQpOffset > 12), "Intra/periodic Cr QP Offset, when combined with the PPS Cr offset, exceeds supported range (-12 to 12)" );
    2934 #endif
     3879  xConfirmPara( abs(m_sliceChromaQpOffsetIntraOrPeriodic[0]                 ) > 12, "Intra/periodic Cb QP Offset exceeds supported range (-12 to 12)" );
     3880  xConfirmPara( abs(m_sliceChromaQpOffsetIntraOrPeriodic[0]  + m_cbQpOffset ) > 12, "Intra/periodic Cb QP Offset, when combined with the PPS Cb offset, exceeds supported range (-12 to 12)" );
     3881  xConfirmPara( abs(m_sliceChromaQpOffsetIntraOrPeriodic[1]                 ) > 12, "Intra/periodic Cr QP Offset exceeds supported range (-12 to 12)" );
     3882  xConfirmPara( abs(m_sliceChromaQpOffsetIntraOrPeriodic[1]  + m_crQpOffset ) > 12, "Intra/periodic Cr QP Offset, when combined with the PPS Cr offset, exceeds supported range (-12 to 12)" );
    29353883
    29363884  m_extraRPSs=0;
     
    32064154  if(m_vuiParametersPresentFlag && m_bitstreamRestrictionFlag)
    32074155  {
     4156#if NH_MV
     4157
     4158    if( m_numRepFormats > 1 )
     4159    {
     4160        AOT( true ); //TBD
     4161    }
     4162
     4163    Int m_iSourceWidth  = m_iSourceWidths [0];
     4164    Int m_iSourceHeight = m_iSourceHeights[0];
     4165#endif
    32084166    Int PicSizeInSamplesY =  m_iSourceWidth * m_iSourceHeight;
    32094167    if(tileFlag)
     
    33074265  if (m_chromaResamplingFilterSEIenabled)
    33084266  {
     4267#if NH_MV
     4268    for (Int i = 0 ; i < m_numRepFormats; i++ )
     4269    {
     4270      xConfirmPara( (m_chromaFormatIDCs[i] == CHROMA_400 ), "chromaResamplingFilterSEI is not allowed to be present when ChromaFormatIDC is equal to zero (4:0:0)" );
     4271    }
     4272#else
    33094273    xConfirmPara( (m_chromaFormatIDC == CHROMA_400 ), "chromaResamplingFilterSEI is not allowed to be present when ChromaFormatIDC is equal to zero (4:0:0)" );
     4274#endif
    33104275    xConfirmPara(m_vuiParametersPresentFlag && m_chromaLocInfoPresentFlag && (m_chromaSampleLocTypeTopField != m_chromaSampleLocTypeBottomField ), "When chromaResamplingFilterSEI is enabled, ChromaSampleLocTypeTopField has to be equal to ChromaSampleLocTypeBottomField" );
    33114276  }
     
    33224287    }
    33234288    xConfirmPara( m_uiDeltaQpRD > 0, "Rate control cannot be used together with slice level multiple-QP optimization!\n" );
    3324 #if U0132_TARGET_BITS_SATURATION
    3325 #if NH_MV
    3326     if ((m_RCCpbSaturationEnabled) && (m_level[0]!=Level::NONE) && (m_profile!=Profile::NONE))
    3327     {
    3328       UInt uiLevelIdx = (m_level[0] / 10) + (UInt)((m_level[0] % 10) / 3);    // (m_level / 30)*3 + ((m_level % 10) / 3);
    3329       xConfirmPara(m_RCCpbSize > g_uiMaxCpbSize[m_levelTier[0]][uiLevelIdx], "RCCpbSize should be smaller than or equal to Max CPB size according to tier and level");
    3330       xConfirmPara(m_RCInitialCpbFullness > 1, "RCInitialCpbFullness should be smaller than or equal to 1");
    3331     }
    3332 #else
     4289#if !NH_MV   
    33334290    if ((m_RCCpbSaturationEnabled) && (m_level!=Level::NONE) && (m_profile!=Profile::NONE))
    33344291    {
     
    33384295    }
    33394296#endif
    3340 #endif
    3341   }
    3342 #if U0132_TARGET_BITS_SATURATION
     4297  }
    33434298  else
    33444299  {
    33454300    xConfirmPara( m_RCCpbSaturationEnabled != 0, "Target bits saturation cannot be processed without Rate control" );
    33464301  }
    3347 #endif
     4302
     4303  if (m_vuiParametersPresentFlag)
     4304  {
     4305    xConfirmPara(m_RCTargetBitrate == 0, "A target bit rate is required to be set for VUI/HRD parameters.");
     4306    if (m_RCCpbSize == 0)
     4307    {
     4308      printf ("Warning: CPB size is set equal to zero. Adjusting value to be equal to TargetBitrate!\n");
     4309      m_RCCpbSize = m_RCTargetBitrate;
     4310    }
     4311  }
    33484312
    33494313#if NH_MV
     
    33704334#endif
    33714335
    3372   xConfirmPara(!m_TransquantBypassEnableFlag && m_CUTransquantBypassFlagForce, "CUTransquantBypassFlagForce cannot be 1 when TransquantBypassEnableFlag is 0");
     4336  xConfirmPara(!m_TransquantBypassEnabledFlag && m_CUTransquantBypassFlagForce, "CUTransquantBypassFlagForce cannot be 1 when TransquantBypassEnableFlag is 0");
    33734337
    33744338  xConfirmPara(m_log2ParallelMergeLevel < 2, "Log2ParallelMergeLevel should be larger than or equal to 2");
     
    33944358  }
    33954359
     4360#if MCTS_ENC_CHECK
     4361  if ((m_tmctsSEIEnabled) && (m_tmctsSEITileConstraint) && (m_bLFCrossTileBoundaryFlag) )
     4362  {
     4363    printf("Warning: Constrained Encoding for Temporal Motion Constrained Tile Sets is enabled. Disabling filtering across tile boundaries!\n");
     4364    m_bLFCrossTileBoundaryFlag = false;
     4365  }
     4366#endif
     4367
    33964368  if(m_timeCodeSEIEnabled)
    33974369  {
     
    33994371  }
    34004372
    3401 #if U0033_ALTERNATIVE_TRANSFER_CHARACTERISTICS_SEI
    34024373  xConfirmPara(m_preferredTransferCharacteristics > 255, "transfer_characteristics_idc should not be greater than 255.");
     4374
     4375#if EXTENSION_360_VIDEO
     4376  check_failed |= m_ext360.verifyParameters();
    34034377#endif
    34044378
     
    34294403}
    34304404
     4405#if NH_MV
     4406Void TAppEncCfg::xPrintProfiles()
     4407{
     4408  printf("Profiles                          :");
     4409  for (Int i = 0; i < m_profiles.size(); i++)
     4410  {
     4411    if (m_profiles[i] == Profile::MAINREXT)
     4412    {
     4413      UIProfileName validProfileName;
     4414      if (m_onePictureOnlyConstraintFlags[i])
     4415      {
     4416        validProfileName = m_bitDepthConstraints[i] == 8 ? UI_MAIN_444_STILL_PICTURE : (m_bitDepthConstraints[i] == 16 ? UI_MAIN_444_16_STILL_PICTURE : UI_NONE);
     4417      }
     4418      else
     4419      {
     4420        const UInt intraIdx        =  m_intraConstraintFlags[i] ? 1:0;
     4421        const UInt bitDepthIdx     = (m_bitDepthConstraints[i] == 8 ? 0 : (m_bitDepthConstraints[i] ==10 ? 1 : (m_bitDepthConstraints[i] == 12 ? 2 : (m_bitDepthConstraints[i] == 16 ? 3 : 4 ))));
     4422        const UInt chromaFormatIdx = UInt(m_chromaFormatConstraints[i]);
     4423        validProfileName = (bitDepthIdx > 3 || chromaFormatIdx>3) ? UI_NONE : validRExtProfileNames[intraIdx][bitDepthIdx][chromaFormatIdx];
     4424      }
     4425      std::string rextSubProfile;
     4426      if (validProfileName!=UI_NONE)
     4427      {
     4428        rextSubProfile=enumToString(strToUIProfileName, sizeof(strToUIProfileName)/sizeof(*strToUIProfileName), validProfileName);
     4429      }
     4430      if (rextSubProfile == "main_444_16")
     4431      {
     4432        rextSubProfile="main_444_16 [NON STANDARD]";
     4433      }
     4434      printf(" %s (%s) ", profileToString(m_profiles[i]), (rextSubProfile.empty())?"INVALID REXT PROFILE":rextSubProfile.c_str() );
     4435
     4436    }
     4437    else if (m_profiles[i] == Profile::HIGHTHROUGHPUTREXT)
     4438    {
     4439      UIProfileName validProfileName;
     4440      const UInt intraIdx    = m_intraConstraintFlags[i] ? 1 : 0;
     4441      const UInt bitDepthIdx = (m_bitDepthConstraints[i] == 8 ? 0 : (m_bitDepthConstraints[i] ==10 ? 1 : (m_bitDepthConstraints[i] == 12 ? 2 : (m_bitDepthConstraints[i] == 16 ? 3 : 4 ))));
     4442      validProfileName = (bitDepthIdx > 3) ? UI_NONE : validRExtHighThroughPutProfileNames[intraIdx][bitDepthIdx];
     4443      std::string subProfile;
     4444      if (validProfileName!=UI_NONE)
     4445      {
     4446        subProfile=enumToString(strToUIProfileName, sizeof(strToUIProfileName)/sizeof(*strToUIProfileName), validProfileName);
     4447      }
     4448      printf(" : %s (%s)\n", profileToString(m_profiles[i]), (subProfile.empty())?"INVALID HIGH THROUGHPUT REXT PROFILE":subProfile.c_str() );
     4449    }
     4450    else if (m_profiles[i] == Profile::MAIN10 && m_onePictureOnlyConstraintFlags[i])
     4451    {
     4452      printf(" : %s (main10-still-picture)\n", profileToString(m_profiles[i]) );
     4453    }
     4454    else
     4455    {
     4456      printf(" %s ", profileToString(m_profiles[i]) );
     4457    }
     4458  }
     4459  printf("\n\n");
     4460
     4461}
     4462#endif
     4463
    34314464Void TAppEncCfg::xPrintParameter()
    34324465{
     
    34354468  for( Int layer = 0; layer < m_numberOfLayers; layer++)
    34364469  {
    3437     printf("Input File %i                     : %s\n", layer, m_pchInputFileList[layer]);
     4470    printf("Input          File %i             : %s\n", layer, m_pchInputFileList[layer]);   
    34384471  }
    34394472#else
    34404473  printf("Input          File                    : %s\n", m_inputFileName.c_str()          );
    34414474#endif
    3442   printf("Bitstream      File                    : %s\n", m_bitstreamFileName.c_str()      );
     4475  printf("Bitstream      File               : %s\n", m_bitstreamFileName.c_str()      );
    34434476#if NH_MV
    34444477  for( Int layer = 0; layer < m_numberOfLayers; layer++)
    3445   {
    3446     printf("Reconstruction File %i            : %s\n", layer, m_pchReconFileList[layer]);
     4478  { 
     4479    printf("Reconstruction File %i             : %s\n", layer, m_pchReconFileList[layer]);
    34474480  }
    34484481#else
     
    34644497#endif
    34654498#if NH_MV 
     4499#if !JVET_E0059_FLOATING_POINT_QP_FIX
    34664500  xPrintParaVector( "QP"               , m_fQP                );
     4501#endif
    34674502  xPrintParaVector( "LoopFilterDisable", m_bLoopFilterDisable );
    34684503  xPrintParaVector( "SAO"              , m_bUseSAO            );
    3469 #endif
    3470 
     4504  printf("ShareParameterSets                : %d\n",  m_shareParameterSets ?  1  : 0  );         
     4505#endif
     4506
     4507#if NH_MV
     4508  printf("Real     Format                   :");
     4509  for(Int i = 0; i < m_numRepFormats; i++ )
     4510  {
     4511    printf(" (%dx%d %gHz)", m_iSourceWidths[i] - m_confWinLefts[i] - m_confWinRights[i], m_iSourceHeights[i] - m_confWinTops[i] - m_confWinBottoms[i], (Double)m_iFrameRate/m_temporalSubsampleRatio );
     4512  }
     4513
     4514  printf("\nInternal Format                   :" );
     4515  for(Int i = 0; i < m_numRepFormats; i++ )
     4516  {
     4517
     4518    printf(" (%dx%d %gHz)", m_iSourceWidths[i], m_iSourceHeights[i], (Double)m_iFrameRate/m_temporalSubsampleRatio );
     4519  } 
     4520  printf("\n");
     4521#else
    34714522  printf("Real     Format                        : %dx%d %gHz\n", m_iSourceWidth - m_confWinLeft - m_confWinRight, m_iSourceHeight - m_confWinTop - m_confWinBottom, (Double)m_iFrameRate/m_temporalSubsampleRatio );
    34724523  printf("Internal Format                        : %dx%d %gHz\n", m_iSourceWidth, m_iSourceHeight, (Double)m_iFrameRate/m_temporalSubsampleRatio );
     4524
     4525#endif
    34734526  printf("Sequence PSNR output              : %s\n", (m_printMSEBasedSequencePSNR ? "Linear average, MSE-based" : "Linear average only") );
    34744527  printf("Sequence MSE output               : %s\n", (m_printSequenceMSE ? "Enabled" : "Disabled") );
    34754528  printf("Frame MSE output                  : %s\n", (m_printFrameMSE    ? "Enabled" : "Disabled") );
     4529#if JVET_F0064_MSSSIM 
     4530  printf("MS-SSIM output                    : %s\n", (m_printMSSSIM      ? "Enabled" : "Disabled") );
     4531#endif
    34764532  printf("Cabac-zero-word-padding           : %s\n", (m_cabacZeroWordPaddingEnabled? "Enabled" : "Disabled") );
    34774533  if (m_isField)
     
    34874543    printf("Frame index                       : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
    34884544  }
    3489 #if NH_MV
    3490   printf("Profile                           :");
    3491   for (Int i = 0; i < m_profiles.size(); i++)
    3492   {
    3493     Profile::Name m_profile = m_profiles[i];
    3494 
    3495 #endif
     4545#if !NH_MV
    34964546    if (m_profile == Profile::MAINREXT)
    34974547    {
    3498     ExtendedProfileName validProfileName;
     4548    UIProfileName validProfileName;
    34994549    if (m_onePictureOnlyConstraintFlag)
    35004550    {
    3501       validProfileName = m_bitDepthConstraint == 8 ? MAIN_444_STILL_PICTURE : (m_bitDepthConstraint == 16 ? MAIN_444_16_STILL_PICTURE : NONE);
     4551      validProfileName = m_bitDepthConstraint == 8 ? UI_MAIN_444_STILL_PICTURE : (m_bitDepthConstraint == 16 ? UI_MAIN_444_16_STILL_PICTURE : UI_NONE);
    35024552    }
    35034553    else
     
    35064556      const UInt bitDepthIdx = (m_bitDepthConstraint == 8 ? 0 : (m_bitDepthConstraint ==10 ? 1 : (m_bitDepthConstraint == 12 ? 2 : (m_bitDepthConstraint == 16 ? 3 : 4 ))));
    35074557      const UInt chromaFormatIdx = UInt(m_chromaFormatConstraint);
    3508       validProfileName = (bitDepthIdx > 3 || chromaFormatIdx>3) ? NONE : validRExtProfileNames[intraIdx][bitDepthIdx][chromaFormatIdx];
     4558      validProfileName = (bitDepthIdx > 3 || chromaFormatIdx>3) ? UI_NONE : validRExtProfileNames[intraIdx][bitDepthIdx][chromaFormatIdx];
    35094559    }
    35104560      std::string rextSubProfile;
    3511       if (validProfileName!=NONE)
    3512       {
    3513         rextSubProfile=enumToString(strToExtendedProfile, sizeof(strToExtendedProfile)/sizeof(*strToExtendedProfile), validProfileName);
     4561    if (validProfileName!=UI_NONE)
     4562      {
     4563      rextSubProfile=enumToString(strToUIProfileName, sizeof(strToUIProfileName)/sizeof(*strToUIProfileName), validProfileName);
    35144564      }
    35154565      if (rextSubProfile == "main_444_16")
     
    35174567        rextSubProfile="main_444_16 [NON STANDARD]";
    35184568      }
    3519 #if NH_MV
    3520       printf(" %s (%s) ", profileToString(m_profile), (rextSubProfile.empty())?"INVALID REXT PROFILE":rextSubProfile.c_str() );
    3521 #else
    35224569      printf("Profile                           : %s (%s)\n", profileToString(m_profile), (rextSubProfile.empty())?"INVALID REXT PROFILE":rextSubProfile.c_str() );
    3523 #endif
    3524     }
    3525     else
    3526     {
    3527 #if NH_MV
    3528       printf(" %s ", profileToString(m_profile) );
    3529 #else
     4570  }
     4571  else if (m_profile == Profile::HIGHTHROUGHPUTREXT)
     4572  {
     4573    UIProfileName validProfileName;
     4574    const UInt intraIdx = m_intraConstraintFlag ? 1:0;
     4575    const UInt bitDepthIdx = (m_bitDepthConstraint == 8 ? 0 : (m_bitDepthConstraint ==10 ? 1 : (m_bitDepthConstraint == 12 ? 2 : (m_bitDepthConstraint == 16 ? 3 : 4 ))));
     4576    validProfileName = (bitDepthIdx > 3) ? UI_NONE : validRExtHighThroughPutProfileNames[intraIdx][bitDepthIdx];
     4577    std::string subProfile;
     4578    if (validProfileName!=UI_NONE)
     4579    {
     4580      subProfile=enumToString(strToUIProfileName, sizeof(strToUIProfileName)/sizeof(*strToUIProfileName), validProfileName);
     4581    }
     4582    printf("Profile                                : %s (%s)\n", profileToString(m_profile), (subProfile.empty())?"INVALID HIGH THROUGHPUT REXT PROFILE":subProfile.c_str() );
     4583  }
     4584  else if (m_profile == Profile::MAIN10 && m_onePictureOnlyConstraintFlag)
     4585  {
     4586    printf("Profile                                : %s (main10-still-picture)\n", profileToString(m_profile) );
     4587  }
     4588  else
     4589  {
    35304590      printf("Profile                           : %s\n", profileToString(m_profile) );
    3531 #endif
    3532     }
    3533 #if NH_MV   
    3534   }
    3535   printf("\n");
    3536 #endif
    3537 
     4591   }
     4592#endif
     4593
     4594#if NH_MV
     4595  printf("CU size / depth / total-depth     : %d / %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth, m_uiMaxTotalCUDepth[0] );
     4596#else
    35384597  printf("CU size / depth / total-depth     : %d / %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth, m_uiMaxTotalCUDepth );
     4598#endif
    35394599  printf("RQT trans. size (min / max)       : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize );
    35404600  printf("Max RQT depth inter               : %d\n", m_uiQuadtreeTUMaxDepthInter);
     
    35524612#endif
    35534613  printf("Decoding refresh type             : %d\n", m_iDecodingRefreshType );
    3554 #if !NH_MV
     4614#if JVET_E0059_FLOATING_POINT_QP_FIX
     4615
     4616#if NH_MV
     4617  if ( !m_qpIncrementAtSourceFrame.empty() )
     4618  {
     4619    xPrintParaVector( "QPIncrementFrame", m_qpIncrementAtSourceFrame );     
     4620  }
     4621#else
     4622  if (m_qpIncrementAtSourceFrame.bPresent)
     4623  {
     4624    printf("QP                                     : %d (incrementing internal QP at source frame %d)\n", m_iQP, m_qpIncrementAtSourceFrame.value );
     4625  }
     4626#endif
     4627  else
     4628  {
     4629#if NH_MV
     4630    xPrintParaVector( "QP", m_iQP );
     4631#else
     4632    printf("QP                                     : %d\n", m_iQP );
     4633#endif
     4634  }
     4635#else
    35554636  printf("QP                                : %5.2f\n", m_fQP );
    35564637#endif
     
    35614642  printf("QP adaptation                     : %d (range=%d)\n", m_bUseAdaptiveQP, (m_bUseAdaptiveQP ? m_iQPAdaptationRange : 0) );
    35624643  printf("GOP size                          : %d\n", m_iGOPSize );
     4644
     4645#if NH_MV
     4646  printf("Input bit depth                   :");
     4647  for (Int i = 0; i < m_numRepFormats; i++ )
     4648  {
     4649    printf(" (Y:%d, C:%d)", m_inputBitDepths[i][CHANNEL_TYPE_LUMA], m_inputBitDepths[i][CHANNEL_TYPE_CHROMA] );
     4650  }
     4651
     4652  printf("\nMSB-extended bit depth            :");
     4653  for (Int i = 0; i < m_numRepFormats; i++ )
     4654  {
     4655    printf(" (Y:%d, C:%d)", m_MSBExtendedBitDepths[i][CHANNEL_TYPE_LUMA], m_MSBExtendedBitDepths[i][CHANNEL_TYPE_CHROMA] );
     4656  }
     4657
     4658  printf("\nInternal bit depth                :");
     4659  for (Int i = 0; i < m_numRepFormats; i++ )
     4660  {
     4661    printf(" (Y:%d, C:%d)", m_internalBitDepths[i][CHANNEL_TYPE_LUMA], m_internalBitDepths[i][CHANNEL_TYPE_CHROMA] );
     4662  }
     4663 
     4664  printf("\nPCM sample bit depth              :");
     4665  for (Int i = 0; i < m_numRepFormats; i++ )
     4666  {
     4667    printf(" (Y:%d, C:%d)", m_bPCMInputBitDepthFlag ? m_MSBExtendedBitDepths[i][CHANNEL_TYPE_LUMA]   : m_internalBitDepths[i][CHANNEL_TYPE_LUMA],
     4668                             m_bPCMInputBitDepthFlag ? m_MSBExtendedBitDepths[i][CHANNEL_TYPE_CHROMA] : m_internalBitDepths[i][CHANNEL_TYPE_CHROMA] );
     4669  }
     4670  printf("\n" );
     4671#else
    35634672  printf("Input bit depth                   : (Y:%d, C:%d)\n", m_inputBitDepth[CHANNEL_TYPE_LUMA], m_inputBitDepth[CHANNEL_TYPE_CHROMA] );
    35644673  printf("MSB-extended bit depth            : (Y:%d, C:%d)\n", m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA], m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] );
     
    35664675  printf("PCM sample bit depth              : (Y:%d, C:%d)\n", m_bPCMInputBitDepthFlag ? m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA] : m_internalBitDepth[CHANNEL_TYPE_LUMA],
    35674676                                                               m_bPCMInputBitDepthFlag ? m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] : m_internalBitDepth[CHANNEL_TYPE_CHROMA] );
     4677#endif
    35684678  printf("Intra reference smoothing         : %s\n", (m_enableIntraReferenceSmoothing          ? "Enabled" : "Disabled") );
    35694679  printf("diff_cu_chroma_qp_offset_depth         : %d\n", m_diffCuChromaQpOffsetDepth);
     
    36294739    printf("InitialQP                         : %d\n", m_RCInitialQP );
    36304740    printf("ForceIntraQP                      : %d\n", m_RCForceIntraQP );
    3631 
    3632 #if U0132_TARGET_BITS_SATURATION
    36334741    printf("CpbSaturation                          : %d\n", m_RCCpbSaturationEnabled );
    36344742    if (m_RCCpbSaturationEnabled)
     
    36374745      printf("InitalCpbFullness                      : %.2f\n", m_RCInitialCpbFullness);
    36384746    }
    3639 #endif
    36404747
    36414748#if KWU_RC_MADPRED_E0227
     
    36864793#if NH_MV
    36874794  printf("TOOL CFG General: ");
     4795
     4796  for( Int i = 0; i < m_numRepFormats; i++)
     4797  {
     4798    printf("IBD(%d):%d ", i, ((m_internalBitDepths[i][CHANNEL_TYPE_LUMA] > m_MSBExtendedBitDepths[i][CHANNEL_TYPE_LUMA]) || (m_internalBitDepths[i][CHANNEL_TYPE_CHROMA] > m_MSBExtendedBitDepths[i][CHANNEL_TYPE_CHROMA])));
     4799  }
    36884800#else
    36894801  printf("TOOL CFG: ");
    3690 #endif
    3691   printf("IBD:%d ", ((m_internalBitDepth[CHANNEL_TYPE_LUMA] > m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA]) || (m_internalBitDepth[CHANNEL_TYPE_CHROMA] > m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA])));
     4802    printf("IBD:%d ", ((m_internalBitDepth[CHANNEL_TYPE_LUMA] > m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA]) || (m_internalBitDepth[CHANNEL_TYPE_CHROMA] > m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA])));
     4803#endif
     4804
    36924805  printf("HAD:%d ", m_bUseHADME           );
    36934806  printf("RDQ:%d ", m_useRDOQ            );
    36944807  printf("RDQTS:%d ", m_useRDOQTS        );
    36954808  printf("RDpenalty:%d ", m_rdPenalty  );
     4809  printf("LQP:%d ", m_lumaLevelToDeltaQPMapping.mode     );
    36964810  printf("SQP:%d ", m_uiDeltaQpRD         );
    36974811  printf("ASR:%d ", m_bUseASR             );
     
    37234837  printf("PCM:%d ", (m_usePCM && (1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0);
    37244838
    3725   if (m_TransquantBypassEnableFlag && m_CUTransquantBypassFlagForce)
     4839  if (m_TransquantBypassEnabledFlag && m_CUTransquantBypassFlagForce)
    37264840  {
    37274841    printf("TransQuantBypassEnabled: =1");
     
    37294843  else
    37304844  {
    3731     printf("TransQuantBypassEnabled:%d ", (m_TransquantBypassEnableFlag)? 1:0 );
     4845    printf("TransQuantBypassEnabled:%d ", (m_TransquantBypassEnabledFlag)? 1:0 );
    37324846  }
    37334847
     
    37354849  printf("WPB:%d ", (Int)m_useWeightedBiPred);
    37364850  printf("PME:%d ", m_log2ParallelMergeLevel);
     4851#if NH_MV
     4852  for( Int i = 0; i < m_numRepFormats; i++ )
     4853  {
     4854    const Int iWaveFrontSubstreams = m_entropyCodingSyncEnabledFlag ? (m_iSourceHeights[i] + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1;
     4855    printf(" WaveFrontSynchro(%d):%d WaveFrontSubstreams(%d):%d", i, m_entropyCodingSyncEnabledFlag?1:0, i, iWaveFrontSubstreams );
     4856  }
     4857#else
    37374858  const Int iWaveFrontSubstreams = m_entropyCodingSyncEnabledFlag ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1;
    37384859  printf(" WaveFrontSynchro:%d WaveFrontSubstreams:%d", m_entropyCodingSyncEnabledFlag?1:0, iWaveFrontSubstreams);
     4860#endif
    37394861  printf(" ScalingList:%d ", m_useScalingListId );
    37404862  printf("TMVPMode:%d ", m_TMVPModeId     );
     
    37434865#endif
    37444866
    3745   printf(" SignBitHidingFlag:%d ", m_signHideFlag);
     4867  printf(" SignBitHidingFlag:%d ", m_signDataHidingEnabledFlag);
    37464868  printf("RecalQP:%d", m_recalculateQPAccordingToLambda ? 1 : 0 );
     4869#if EXTENSION_360_VIDEO
     4870  m_ext360.outputConfigurationSummary();
     4871#endif
    37474872#if NH_3D_VSO
    37484873  printf(" VSO:%d ", m_bUseVSO   );
    37494874  printf("WVSO:%d ", m_bUseWVSO ); 
    37504875#endif
    3751 #if NH_3D_QTL
     4876#if NH_3D
    37524877  printf( "QTL:%d "                  , m_bUseQTL);
    3753 #endif
    3754 #if NH_3D
    37554878  printf( "IlluCompEnable:%d "       , m_abUseIC);
    37564879  printf( "IlluCompLowLatencyEnc:%d ",  m_bUseLowLatencyICEnc);
     
    37804903  fflush(stdout);
    37814904}
     4905#if NH_MV
     4906
     4907Void TAppEncCfg::xConfirmRepFormat(const TComVPS& vps )
     4908{
     4909  Bool checkFailed = false;
     4910
     4911  // This might not cover all disallowed cases. To be further tested.
     4912#if NH_3D
     4913  Bool allDepthSameBitDepth = true;
     4914  Bool allSameSize          = true;
     4915  Bool allTextureChroma420  = true;
     4916 
     4917  Int  lastBitDepth         = -1;
     4918  Int  lastWidth            = -1;
     4919  Int  lastHeight           = -1;
     4920
     4921  Int lastChromaFormat     = (Int) CHROMA_420;
     4922
     4923  for(Int i = 0; i <= vps.getMaxLayersMinus1(); i++ )
     4924  {
     4925    Int curLayerIdInNuh = vps.getLayerIdInNuh( i );
     4926
     4927    const TComRepFormat* repFormat = vps.getRepFormat( vps.getVpsRepFormatIdx( i  ) );
     4928
     4929    Int curWidth = repFormat->getPicWidthVpsInLumaSamples();
     4930    allSameSize  = allSameSize && ( lastWidth == -1 || lastWidth  == curWidth );
     4931    lastWidth    = curWidth;
     4932
     4933    Int curHeight = repFormat->getPicHeightVpsInLumaSamples();
     4934    allSameSize   = allSameSize && ( lastHeight == -1 || lastHeight  == curHeight );
     4935    lastHeight    = curHeight;
     4936
     4937    if ( vps.getVpsDepthFlag( curLayerIdInNuh ))
     4938    {
     4939      Int curBitDepth      = repFormat->getBitDepthVpsLumaMinus8();
     4940      allDepthSameBitDepth = allDepthSameBitDepth && ( lastBitDepth == -1 || lastBitDepth  == curBitDepth );
     4941      lastBitDepth         = curBitDepth;
     4942    }
     4943    else
     4944    {
     4945      Int curChromaFormat = repFormat->getChromaFormatVpsIdc();
     4946      allTextureChroma420 = allTextureChroma420 && ( lastChromaFormat  == curChromaFormat );
     4947      lastChromaFormat    = curChromaFormat;
     4948    }
     4949  }
     4950
     4951  checkFailed |= confirmPara( !allDepthSameBitDepth                                         ,  "The HTM implementation requires that InternalBitDepth of all depth layers must be equal."  );
     4952  checkFailed |= confirmPara( !allSameSize           && ( m_bUseVSO || m_bUseEstimatedVSD ) ,  "When VSO or VSD are enabled, the HTM implementation requires that SourceHeight and SourceWidth of all layers must be equal."  );
     4953  checkFailed |= confirmPara( !allTextureChroma420   &&  m_bUseVSO                          ,  "When VSO is enabled, the HTM implementation requires that all textures have ChromaFormat 420."  ); 
     4954#endif
     4955
     4956  // Check reference layers
     4957  for (Int curLayerId = 0; curLayerId <= vps.getMaxLayersMinus1(); curLayerId++ )
     4958  { 
     4959
     4960    const TComRepFormat* curRepFormat = vps.getRepFormat( vps.getVpsRepFormatIdx( curLayerId  ) );
     4961
     4962    Int curLayerIdInNuh      = vps.getLayerIdInNuh( curLayerId );
     4963   
     4964    for( Int i = 0; i < vps.getNumDirectRefLayers( curLayerIdInNuh ); i++ )
     4965    {
     4966      Int refLayerId =  vps.getLayerIdInVps( vps.getIdDirectRefLayer( curLayerIdInNuh, i ));//   refLayers[i];
     4967      const TComRepFormat* refRepFormat = vps.getRepFormat( vps.getVpsRepFormatIdx( refLayerId ) );
     4968
     4969      // Require equal size
     4970      xConfirmSingleRepFormat( checkFailed, "SourceHeight",curLayerId, refLayerId,  curRepFormat->getPicHeightVpsInLumaSamples(), refRepFormat->getPicHeightVpsInLumaSamples() );
     4971      xConfirmSingleRepFormat( checkFailed, "SourceWidth" ,curLayerId, refLayerId,  curRepFormat->getPicWidthVpsInLumaSamples() , refRepFormat->getPicWidthVpsInLumaSamples () );
     4972#if NH_3D
     4973
     4974      // For 3D-HEVC, dependencies can be e.g. from texture 4:2:0 to depth 4:0:0, so check only layers that might be inserted to the reference lists.
     4975    }
     4976
     4977    for( Int i = 0; i < vps.getNumRefListLayers( curLayerIdInNuh  ); i++ )
     4978    {
     4979      Int refLayerId =  vps.getLayerIdInVps( vps.getIdRefListLayer( curLayerIdInNuh, i ) );//   refLayers[i];
     4980      const TComRepFormat* refRepFormat = vps.getRepFormat( vps.getVpsRepFormatIdx( refLayerId ) );
     4981#endif
     4982      // Sample dependency -> require same bit depth and chroma format
     4983      xConfirmSingleRepFormat( checkFailed, "ChromaFormatIDC"          , curLayerId, refLayerId,  curRepFormat->getChromaFormatVpsIdc()     , refRepFormat->getChromaFormatVpsIdc()  );
     4984      xConfirmSingleRepFormat( checkFailed, "InternalBitDepth (Luma)"  , curLayerId, refLayerId,  curRepFormat->getBitDepthVpsLumaMinus8()  , refRepFormat->getBitDepthVpsLumaMinus8());
     4985      xConfirmSingleRepFormat( checkFailed, "InternalBitDepth (Chroma)", curLayerId, refLayerId,  curRepFormat->getBitDepthVpsChromaMinus8(), refRepFormat->getBitDepthVpsChromaMinus8());
     4986    }
     4987    // TBD: add 3D-HEVC constraints e.g. for VSP, QTL
     4988  }
     4989
     4990  if( checkFailed )
     4991  {
     4992    exit(0);
     4993  }
     4994}
     4995
     4996Void TAppEncCfg::xConvertRepFormatParameters(
     4997  IntAry2d& tmpPad                       ,             
     4998  IntAry2d& tmpInputBitDepth             ,
     4999  IntAry2d& tmpOutputBitDepth            ,
     5000  IntAry2d& tmpMSBExtendedBitDepth       ,
     5001  IntAry2d& tmpInternalBitDepth          ,
     5002  IntAry1d& tmpInputChromaFormat         ,
     5003  IntAry1d& tmpChromaFormat
     5004  )
     5005{
     5006  typedef std::pair< IntAry2d*,  IntAry2d* > ParamMapPair;
     5007  std::vector< ParamMapPair > paramTwoElem;
     5008  paramTwoElem.push_back( ParamMapPair( &tmpPad                ,  &m_aiPads               )  );
     5009  paramTwoElem.push_back( ParamMapPair( &tmpInputBitDepth      ,  &m_inputBitDepths       )  );
     5010  paramTwoElem.push_back( ParamMapPair( &tmpOutputBitDepth     ,  &m_outputBitDepths      )  );
     5011  paramTwoElem.push_back( ParamMapPair( &tmpMSBExtendedBitDepth,  &m_MSBExtendedBitDepths )  );
     5012  paramTwoElem.push_back( ParamMapPair( &tmpInternalBitDepth   ,  &m_internalBitDepths    )  );
     5013 
     5014  std::vector< IntAry1d* > paramOneElem;
     5015  paramOneElem.push_back(  &m_confWinLefts  ); 
     5016  paramOneElem.push_back(  &m_confWinRights );
     5017  paramOneElem.push_back(  &m_confWinTops   );
     5018  paramOneElem.push_back(  &m_confWinBottoms);
     5019  paramOneElem.push_back(  &m_iSourceWidths );
     5020  paramOneElem.push_back(  &m_iSourceHeights);
     5021  paramOneElem.push_back(  &tmpInputChromaFormat );
     5022  paramOneElem.push_back(  &tmpChromaFormat );
     5023
     5024
     5025  // Get maximum number of representation formats
     5026  size_t maxSize = 0;
     5027
     5028  for (Int i = 0; i < paramTwoElem.size(); i++)
     5029  {
     5030    for (Int j = 0; j < 2; j++ )
     5031    {
     5032      IntAry1d& curElems = (* (paramTwoElem[i].first) )[j];
     5033      maxSize = std::max<size_t>(  maxSize, curElems.size()  );
     5034    }   
     5035  }
     5036
     5037  for (Int i = 0; i < paramOneElem.size(); i++)
     5038  {
     5039    maxSize = std::max<size_t>(  maxSize, (paramOneElem[i]->size() ) );
     5040  }
     5041
     5042  // Resize to maximum
     5043  for (Int i = 0; i < paramTwoElem.size(); i++)
     5044  {
     5045    IntAry2d& curElems = (* (paramTwoElem[i].first) );   
     5046    for (Int j = 0; j < 2; j++ )
     5047    {
     5048      xResizeVector( curElems[j], (UInt) maxSize );       
     5049    }
     5050  }
     5051
     5052  for (Int i = 0; i < paramOneElem.size(); i++)
     5053  {
     5054    xResizeVector( (*paramOneElem[i]), (UInt) maxSize );             
     5055  }
     5056 
     5057  // Transpose
     5058  for (Int i = 0; i < paramTwoElem.size(); i++)
     5059  {
     5060    IntAry2d&  curElem  = (* (paramTwoElem[i].first  ) );
     5061    IntAry2d&  curElemT = (* (paramTwoElem[i].second ) );
     5062
     5063    curElemT.resize(maxSize);
     5064    for (Int k = 0; k < maxSize; k++ )
     5065    {
     5066      curElemT[k].resize(2);
     5067      for (Int j = 0; j < 2; j++ )
     5068      {
     5069        curElemT[k][j] = curElem[j][k];
     5070      }
     5071    }   
     5072  }
     5073
     5074  m_numRepFormats = (Int) maxSize;
     5075}
     5076
     5077
     5078
     5079Void TAppEncCfg::xGetMaxValuesOfApplicableLayers(const TComVPS& vps, Int vpsPtlIdx, Int& maxBitDepthLuma, Int& maxBitDepthChroma, ChromaFormat& maxChromaFormatIdc, Int& maxNumRefLayers )
     5080{
     5081  maxChromaFormatIdc        = CHROMA_400;
     5082  maxBitDepthLuma   = -1;
     5083  maxBitDepthChroma = -1;
     5084  maxNumRefLayers   = 0;
     5085
     5086  IntAry1d applicableLayerIdsInVps = vps.getLayersOfVpsPtl( vpsPtlIdx );
     5087
     5088  for (Int i = 0; i < applicableLayerIdsInVps.size(); i++ )
     5089  {
     5090    Int curLayerIdInVps       = applicableLayerIdsInVps[ i ];
     5091    Int repFormatIdx          = m_layerIdxInVpsToRepFormatIdx[ curLayerIdInVps ];
     5092    maxChromaFormatIdc        = std::max<ChromaFormat> ( m_chromaFormatIDCs[ repFormatIdx], maxChromaFormatIdc );
     5093    maxBitDepthLuma   = std::max<Int> ( m_internalBitDepths[ repFormatIdx ][CHANNEL_TYPE_LUMA  ], maxBitDepthLuma   );
     5094    maxBitDepthChroma = std::max<Int> ( m_internalBitDepths[ repFormatIdx ][CHANNEL_TYPE_CHROMA], maxBitDepthChroma );
     5095    maxNumRefLayers   = std::max<Int> ( vps.getNumRefLayers( vps.getLayerIdInNuh( curLayerIdInVps ) ), maxNumRefLayers ) ;
     5096  }
     5097}
     5098
     5099#endif
    37825100
    37835101Bool confirmPara(Bool bflag, const TChar* message)
Note: See TracChangeset for help on using the changeset viewer.