HEVC Test Model (HM)  HM-16.3
TAppEncCfg.cpp
Go to the documentation of this file.
1 /* The copyright in this software is being made available under the BSD
2  * License, included below. This software may be subject to other third party
3  * and contributor rights, including patent rights, and no such rights are
4  * granted under this license.
5  *
6  * Copyright (c) 2010-2015, ITU/ISO/IEC
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are met:
11  *
12  * * Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above copyright notice,
15  * this list of conditions and the following disclaimer in the documentation
16  * and/or other materials provided with the distribution.
17  * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
18  * be used to endorse or promote products derived from this software without
19  * specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
25  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31  * THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
38 #include <stdlib.h>
39 #include <cassert>
40 #include <cstring>
41 #include <string>
42 #include <limits>
43 #include "TLibCommon/TComRom.h"
44 #include "TAppEncCfg.h"
47 #ifdef WIN32
48 #define strdup _strdup
49 #endif
50 
51 #define MACRO_TO_STRING_HELPER(val) #val
52 #define MACRO_TO_STRING(val) MACRO_TO_STRING_HELPER(val)
53 
54 using namespace std;
55 namespace po = df::program_options_lite;
56 
57 
58 
59 enum ExtendedProfileName // this is used for determining profile strings, where multiple profiles map to a single profile idc with various constraint flag combinations
60 {
61  NONE = 0,
62  MAIN = 1,
63  MAIN10 = 2,
65  MAINREXT = 4,
66  HIGHTHROUGHPUTREXT = 5, // Placeholder profile for development
67  // The following are RExt profiles, which would map to the MAINREXT profile idc.
68  // The enumeration indicates the bit-depth constraint in the bottom 2 digits
69  // the chroma format in the next digit
70  // the intra constraint in the top digit
71  MONOCHROME_8 = 1008,
72  MONOCHROME_12 = 1012,
73  MONOCHROME_16 = 1016,
74  MAIN_12 = 1112,
75  MAIN_422_10 = 1210,
76  MAIN_422_12 = 1212,
77  MAIN_444 = 1308,
78  MAIN_444_10 = 1310,
79  MAIN_444_12 = 1312,
80  MAIN_444_16 = 1316, // non-standard profile definition, used for development purposes
81  MAIN_INTRA = 2108,
82  MAIN_10_INTRA = 2110,
83  MAIN_12_INTRA = 2112,
90 };
91 
92 
95 
96 // ====================================================================================================================
97 // Constructor / destructor / initialization / destroy
98 // ====================================================================================================================
99 
101 : m_pchInputFile()
102 , m_pchBitstreamFile()
103 , m_pchReconFile()
104 , m_inputColourSpaceConvert(IPCOLOURSPACE_UNCHANGED)
105 , m_snrInternalColourSpace(false)
106 , m_outputInternalColourSpace(false)
107 , m_pchdQPFile()
108 , m_scalingListFile()
109 {
110  m_aidQP = NULL;
114 }
115 
117 {
118  if ( m_aidQP )
119  {
120  delete[] m_aidQP;
121  }
123  {
124  delete[] m_startOfCodedInterval;
126  }
127  if ( m_codedPivotValue )
128  {
129  delete[] m_codedPivotValue;
131  }
132  if ( m_targetPivotValue )
133  {
134  delete[] m_targetPivotValue;
136  }
137 
138  free(m_pchInputFile);
139  free(m_pchBitstreamFile);
140  free(m_pchReconFile);
141  free(m_pchdQPFile);
142  free(m_scalingListFile);
143 }
144 
146 {
147 }
148 
150 {
151 }
152 
153 std::istringstream &operator>>(std::istringstream &in, GOPEntry &entry) //input
154 {
155  in>>entry.m_sliceType;
156  in>>entry.m_POC;
157  in>>entry.m_QPOffset;
158  in>>entry.m_QPFactor;
159  in>>entry.m_tcOffsetDiv2;
160  in>>entry.m_betaOffsetDiv2;
161  in>>entry.m_temporalId;
162  in>>entry.m_numRefPicsActive;
163  in>>entry.m_numRefPics;
164  for ( Int i = 0; i < entry.m_numRefPics; i++ )
165  {
166  in>>entry.m_referencePics[i];
167  }
168  in>>entry.m_interRPSPrediction;
169  if (entry.m_interRPSPrediction==1)
170  {
171  in>>entry.m_deltaRPS;
172  in>>entry.m_numRefIdc;
173  for ( Int i = 0; i < entry.m_numRefIdc; i++ )
174  {
175  in>>entry.m_refIdc[i];
176  }
177  }
178  else if (entry.m_interRPSPrediction==2)
179  {
180  in>>entry.m_deltaRPS;
181  }
182  return in;
183 }
184 
185 Bool confirmPara(Bool bflag, const Char* message);
186 
187 static inline ChromaFormat numberToChromaFormat(const Int val)
188 {
189  switch (val)
190  {
191  case 400: return CHROMA_400; break;
192  case 420: return CHROMA_420; break;
193  case 422: return CHROMA_422; break;
194  case 444: return CHROMA_444; break;
195  default: return NUM_CHROMA_FORMAT;
196  }
197 }
198 
199 static const struct MapStrToProfile
200 {
201  const Char* str;
203 }
204 strToProfile[] =
205 {
206  {"none", Profile::NONE },
207  {"main", Profile::MAIN },
208  {"main10", Profile::MAIN10 },
209  {"main-still-picture", Profile::MAINSTILLPICTURE },
210  {"main-RExt", Profile::MAINREXT },
211  {"high-throughput-RExt", Profile::HIGHTHROUGHPUTREXT }
212 };
213 
214 static const struct MapStrToExtendedProfile
215 {
216  const Char* str;
218 }
220 {
221  {"none", NONE },
222  {"main", MAIN },
223  {"main10", MAIN10 },
224  {"main-still-picture", MAINSTILLPICTURE },
225  {"main-RExt", MAINREXT },
226  {"high-throughput-RExt", HIGHTHROUGHPUTREXT },
227  {"monochrome", MONOCHROME_8 },
228  {"monochrome12", MONOCHROME_12 },
229  {"monochrome16", MONOCHROME_16 },
230  {"main12", MAIN_12 },
231  {"main_422_10", MAIN_422_10 },
232  {"main_422_12", MAIN_422_12 },
233  {"main_444", MAIN_444 },
234  {"main_444_10", MAIN_444_10 },
235  {"main_444_12", MAIN_444_12 },
236  {"main_444_16", MAIN_444_16 },
237  {"main_intra", MAIN_INTRA },
238  {"main_10_intra", MAIN_10_INTRA },
239  {"main_12_intra", MAIN_12_INTRA },
240  {"main_422_10_intra", MAIN_422_10_INTRA},
241  {"main_422_12_intra", MAIN_422_12_INTRA},
242  {"main_444_intra", MAIN_444_INTRA },
243  {"main_444_10_intra", MAIN_444_10_INTRA},
244  {"main_444_12_intra", MAIN_444_12_INTRA},
245  {"main_444_16_intra", MAIN_444_16_INTRA}
246 };
247 
248 static const ExtendedProfileName validRExtProfileNames[2/* intraConstraintFlag*/][4/* bit depth constraint 8=0, 10=1, 12=2, 16=3*/][4/*chroma format*/]=
249 {
250  {
251  { MONOCHROME_8, NONE, NONE, MAIN_444 }, // 8-bit inter for 400, 420, 422 and 444
252  { NONE, NONE, MAIN_422_10, MAIN_444_10 }, // 10-bit inter for 400, 420, 422 and 444
253  { MONOCHROME_12, MAIN_12, MAIN_422_12, MAIN_444_12 }, // 12-bit inter for 400, 420, 422 and 444
254  { MONOCHROME_16, NONE, NONE, MAIN_444_16 } // 16-bit inter for 400, 420, 422 and 444 (the latter is non standard used for development)
255  },
256  {
257  { NONE, MAIN_INTRA, NONE, MAIN_444_INTRA }, // 8-bit intra for 400, 420, 422 and 444
258  { NONE, MAIN_10_INTRA, MAIN_422_10_INTRA, MAIN_444_10_INTRA }, // 10-bit intra for 400, 420, 422 and 444
259  { NONE, MAIN_12_INTRA, MAIN_422_12_INTRA, MAIN_444_12_INTRA }, // 12-bit intra for 400, 420, 422 and 444
260  { NONE, NONE, NONE, MAIN_444_16_INTRA } // 16-bit intra for 400, 420, 422 and 444
261  }
262 };
263 
264 static const struct MapStrToTier
265 {
266  const Char* str;
268 }
269 strToTier[] =
270 {
271  {"main", Level::MAIN},
272  {"high", Level::HIGH},
273 };
274 
275 static const struct MapStrToLevel
276 {
277  const Char* str;
279 }
280 strToLevel[] =
281 {
282  {"none",Level::NONE},
283  {"1", Level::LEVEL1},
284  {"2", Level::LEVEL2},
285  {"2.1", Level::LEVEL2_1},
286  {"3", Level::LEVEL3},
287  {"3.1", Level::LEVEL3_1},
288  {"4", Level::LEVEL4},
289  {"4.1", Level::LEVEL4_1},
290  {"5", Level::LEVEL5},
291  {"5.1", Level::LEVEL5_1},
292  {"5.2", Level::LEVEL5_2},
293  {"6", Level::LEVEL6},
294  {"6.1", Level::LEVEL6_1},
295  {"6.2", Level::LEVEL6_2},
296  {"8.5", Level::LEVEL8_5},
297 };
298 
299 static const struct MapStrToCostMode
300 {
301  const Char* str;
303 }
304 strToCostMode[] =
305 {
306  {"lossy", COST_STANDARD_LOSSY},
307  {"sequence_level_lossless", COST_SEQUENCE_LEVEL_LOSSLESS},
308  {"lossless", COST_LOSSLESS_CODING},
309  {"mixed_lossless_lossy", COST_MIXED_LOSSLESS_LOSSY_CODING}
310 };
311 
312 static const struct MapStrToScalingListMode
313 {
314  const Char* str;
316 }
318 {
319  {"0", SCALING_LIST_OFF},
320  {"1", SCALING_LIST_DEFAULT},
321  {"2", SCALING_LIST_FILE_READ},
322  {"off", SCALING_LIST_OFF},
323  {"default", SCALING_LIST_DEFAULT},
324  {"file", SCALING_LIST_FILE_READ}
325 };
326 
327 template<typename T, typename P>
328 static std::string enumToString(P map[], UInt mapLen, const T val)
329 {
330  for (UInt i = 0; i < mapLen; i++)
331  {
332  if (val == map[i].value)
333  {
334  return map[i].str;
335  }
336  }
337  return std::string();
338 }
339 
340 template<typename T, typename P>
341 static istream& readStrToEnum(P map[], UInt mapLen, istream &in, T &val)
342 {
343  string str;
344  in >> str;
345 
346  for (UInt i = 0; i < mapLen; i++)
347  {
348  if (str == map[i].str)
349  {
350  val = map[i].value;
351  goto found;
352  }
353  }
354  /* not found */
355  in.setstate(ios::failbit);
356 found:
357  return in;
358 }
359 
360 //inline to prevent compiler warnings for "unused static function"
361 
362 static inline istream& operator >> (istream &in, ExtendedProfileName &profile)
363 {
364  return readStrToEnum(strToExtendedProfile, sizeof(strToExtendedProfile)/sizeof(*strToExtendedProfile), in, profile);
365 }
366 
367 namespace Level
368 {
369  static inline istream& operator >> (istream &in, Tier &tier)
370  {
371  return readStrToEnum(strToTier, sizeof(strToTier)/sizeof(*strToTier), in, tier);
372  }
373 
374  static inline istream& operator >> (istream &in, Name &level)
375  {
376  return readStrToEnum(strToLevel, sizeof(strToLevel)/sizeof(*strToLevel), in, level);
377  }
378 }
379 
380 static inline istream& operator >> (istream &in, CostMode &mode)
381 {
382  return readStrToEnum(strToCostMode, sizeof(strToCostMode)/sizeof(*strToCostMode), in, mode);
383 }
384 
385 static inline istream& operator >> (istream &in, ScalingListMode &mode)
386 {
388 }
389 
390 template <class T>
392 {
393  const T minValIncl;
394  const T maxValIncl; // Use 0 for unlimited
395  const std::size_t minNumValuesIncl;
396  const std::size_t maxNumValuesIncl; // Use 0 for unlimited
397  std::vector<T> values;
398  SMultiValueInput() : minValIncl(0), maxValIncl(0), minNumValuesIncl(0), maxNumValuesIncl(0), values() { }
399  SMultiValueInput(std::vector<T> &defaults) : minValIncl(0), maxValIncl(0), minNumValuesIncl(0), maxNumValuesIncl(0), values(defaults) { }
400  SMultiValueInput(const T &minValue, const T &maxValue, std::size_t minNumberValues=0, std::size_t maxNumberValues=0)
401  : minValIncl(minValue), maxValIncl(maxValue), minNumValuesIncl(minNumberValues), maxNumValuesIncl(maxNumberValues), values() { }
402  SMultiValueInput(const T &minValue, const T &maxValue, std::size_t minNumberValues, std::size_t maxNumberValues, const T* defValues, const UInt numDefValues)
403  : minValIncl(minValue), maxValIncl(maxValue), minNumValuesIncl(minNumberValues), maxNumValuesIncl(maxNumberValues), values(defValues, defValues+numDefValues) { }
404  SMultiValueInput<T> &operator=(const std::vector<T> &userValues) { values=userValues; return *this; }
405  SMultiValueInput<T> &operator=(const SMultiValueInput<T> &userValues) { values=userValues.values; return *this; }
406 };
407 
408 static inline istream& operator >> (istream &in, SMultiValueInput<UInt> &values)
409 {
410  values.values.clear();
411  string str;
412  in >> str;
413  if (!str.empty())
414  {
415  const Char *pStr=str.c_str();
416  // soak up any whitespace
417  for(;isspace(*pStr);pStr++);
418 
419  while (*pStr != 0)
420  {
421  Char *eptr;
422  UInt val=strtoul(pStr, &eptr, 0);
423  if (*eptr!=0 && !isspace(*eptr) && *eptr!=',')
424  {
425  in.setstate(ios::failbit);
426  break;
427  }
428  if (val<values.minValIncl || val>values.maxValIncl)
429  {
430  in.setstate(ios::failbit);
431  break;
432  }
433 
434  if (values.maxNumValuesIncl != 0 && values.values.size() >= values.maxNumValuesIncl)
435  {
436  in.setstate(ios::failbit);
437  break;
438  }
439  values.values.push_back(val);
440  // soak up any whitespace and up to 1 comma.
441  pStr=eptr;
442  for(;isspace(*pStr);pStr++);
443  if (*pStr == ',')
444  {
445  pStr++;
446  }
447  for(;isspace(*pStr);pStr++);
448  }
449  }
450  if (values.values.size() < values.minNumValuesIncl)
451  {
452  in.setstate(ios::failbit);
453  }
454  return in;
455 }
456 
457 static inline istream& operator >> (istream &in, SMultiValueInput<Int> &values)
458 {
459  values.values.clear();
460  string str;
461  in >> str;
462  if (!str.empty())
463  {
464  const Char *pStr=str.c_str();
465  // soak up any whitespace
466  for(;isspace(*pStr);pStr++);
467 
468  while (*pStr != 0)
469  {
470  Char *eptr;
471  Int val=strtol(pStr, &eptr, 0);
472  if (*eptr!=0 && !isspace(*eptr) && *eptr!=',')
473  {
474  in.setstate(ios::failbit);
475  break;
476  }
477  if (val<values.minValIncl || val>values.maxValIncl)
478  {
479  in.setstate(ios::failbit);
480  break;
481  }
482 
483  if (values.maxNumValuesIncl != 0 && values.values.size() >= values.maxNumValuesIncl)
484  {
485  in.setstate(ios::failbit);
486  break;
487  }
488  values.values.push_back(val);
489  // soak up any whitespace and up to 1 comma.
490  pStr=eptr;
491  for(;isspace(*pStr);pStr++);
492  if (*pStr == ',')
493  {
494  pStr++;
495  }
496  for(;isspace(*pStr);pStr++);
497  }
498  }
499  if (values.values.size() < values.minNumValuesIncl)
500  {
501  in.setstate(ios::failbit);
502  }
503  return in;
504 }
505 
506 static inline istream& operator >> (istream &in, SMultiValueInput<Bool> &values)
507 {
508  values.values.clear();
509  string str;
510  in >> str;
511  if (!str.empty())
512  {
513  const Char *pStr=str.c_str();
514  // soak up any whitespace
515  for(;isspace(*pStr);pStr++);
516 
517  while (*pStr != 0)
518  {
519  Char *eptr;
520  Int val=strtol(pStr, &eptr, 0);
521  if (*eptr!=0 && !isspace(*eptr) && *eptr!=',')
522  {
523  in.setstate(ios::failbit);
524  break;
525  }
526  if (val<Int(values.minValIncl) || val>Int(values.maxValIncl))
527  {
528  in.setstate(ios::failbit);
529  break;
530  }
531 
532  if (values.maxNumValuesIncl != 0 && values.values.size() >= values.maxNumValuesIncl)
533  {
534  in.setstate(ios::failbit);
535  break;
536  }
537  values.values.push_back(val!=0);
538  // soak up any whitespace and up to 1 comma.
539  pStr=eptr;
540  for(;isspace(*pStr);pStr++);
541  if (*pStr == ',')
542  {
543  pStr++;
544  }
545  for(;isspace(*pStr);pStr++);
546  }
547  }
548  if (values.values.size() < values.minNumValuesIncl)
549  {
550  in.setstate(ios::failbit);
551  }
552  return in;
553 }
554 
555 static Void
556 automaticallySelectRExtProfile(const Bool bUsingGeneralRExtTools,
557  const Bool bUsingChromaQPAdjustment,
558  const Bool bUsingExtendedPrecision,
559  const Bool bIntraConstraintFlag,
560  UInt &bitDepthConstraint,
561  ChromaFormat &chromaFormatConstraint,
562  const Int maxBitDepth,
563  const ChromaFormat chromaFormat)
564 {
565  // Try to choose profile, according to table in Q1013.
566  UInt trialBitDepthConstraint=maxBitDepth;
567  if (trialBitDepthConstraint<8)
568  {
569  trialBitDepthConstraint=8;
570  }
571  else if (trialBitDepthConstraint==9 || trialBitDepthConstraint==11)
572  {
573  trialBitDepthConstraint++;
574  }
575  else if (trialBitDepthConstraint>12)
576  {
577  trialBitDepthConstraint=16;
578  }
579 
580  // both format and bit depth constraints are unspecified
581  if (bUsingExtendedPrecision || trialBitDepthConstraint==16)
582  {
583  bitDepthConstraint = 16;
584  chromaFormatConstraint = (!bIntraConstraintFlag && chromaFormat==CHROMA_400) ? CHROMA_400 : CHROMA_444;
585  }
586  else if (bUsingGeneralRExtTools)
587  {
588  if (chromaFormat == CHROMA_400 && !bIntraConstraintFlag)
589  {
590  bitDepthConstraint = 16;
591  chromaFormatConstraint = CHROMA_400;
592  }
593  else
594  {
595  bitDepthConstraint = trialBitDepthConstraint;
596  chromaFormatConstraint = CHROMA_444;
597  }
598  }
599  else if (chromaFormat == CHROMA_400)
600  {
601  if (bIntraConstraintFlag)
602  {
603  chromaFormatConstraint = CHROMA_420; // there is no intra 4:0:0 profile.
604  bitDepthConstraint = trialBitDepthConstraint;
605  }
606  else
607  {
608  chromaFormatConstraint = CHROMA_400;
609  bitDepthConstraint = trialBitDepthConstraint == 8 ? 8 : 12;
610  }
611  }
612  else
613  {
614  bitDepthConstraint = trialBitDepthConstraint;
615  chromaFormatConstraint = chromaFormat;
616  if (bUsingChromaQPAdjustment && chromaFormat == CHROMA_420)
617  {
618  chromaFormatConstraint = CHROMA_422; // 4:2:0 cannot use the chroma qp tool.
619  }
620  if (chromaFormatConstraint == CHROMA_422 && bitDepthConstraint == 8)
621  {
622  bitDepthConstraint = 10; // there is no 8-bit 4:2:2 profile.
623  }
624  if (chromaFormatConstraint == CHROMA_420 && !bIntraConstraintFlag)
625  {
626  bitDepthConstraint = 12; // there is no 8 or 10-bit 4:2:0 inter RExt profile.
627  }
628  }
629 }
630 // ====================================================================================================================
631 // Public member functions
632 // ====================================================================================================================
633 
639 {
640  Bool do_help = false;
641 
642  string cfg_InputFile;
643  string cfg_BitstreamFile;
644  string cfg_ReconFile;
645  string cfg_dQPFile;
646  string cfg_ScalingListFile;
647 
648  Int tmpChromaFormat;
649  Int tmpInputChromaFormat;
650  Int tmpConstraintChromaFormat;
651  string inputColourSpaceConvert;
652  ExtendedProfileName extendedProfile;
653  Int saoOffsetBitShift[MAX_NUM_CHANNEL_TYPE];
654 
655  // Multi-value input fields: // minval, maxval (incl), min_entries, max_entries (incl) [, default values, number of default values]
656  SMultiValueInput<UInt> cfg_ColumnWidth (0, std::numeric_limits<UInt>::max(), 0, std::numeric_limits<UInt>::max());
657  SMultiValueInput<UInt> cfg_RowHeight (0, std::numeric_limits<UInt>::max(), 0, std::numeric_limits<UInt>::max());
658  SMultiValueInput<Int> cfg_startOfCodedInterval (std::numeric_limits<Int>::min(), std::numeric_limits<Int>::max(), 0, 1<<16);
659  SMultiValueInput<Int> cfg_codedPivotValue (std::numeric_limits<Int>::min(), std::numeric_limits<Int>::max(), 0, 1<<16);
660  SMultiValueInput<Int> cfg_targetPivotValue (std::numeric_limits<Int>::min(), std::numeric_limits<Int>::max(), 0, 1<<16);
661 
662  const UInt defaultInputKneeCodes[3] = { 600, 800, 900 };
663  const UInt defaultOutputKneeCodes[3] = { 100, 250, 450 };
664  SMultiValueInput<UInt> cfg_kneeSEIInputKneePointValue (1, 999, 0, 999, defaultInputKneeCodes, sizeof(defaultInputKneeCodes )/sizeof(UInt));
665  SMultiValueInput<UInt> cfg_kneeSEIOutputKneePointValue (0, 1000, 0, 999, defaultOutputKneeCodes, sizeof(defaultOutputKneeCodes)/sizeof(UInt));
666  const Int defaultPrimaryCodes[6] = { 0,50000, 0,0, 50000,0 };
667  const Int defaultWhitePointCode[2] = { 16667, 16667 };
668  SMultiValueInput<Int> cfg_DisplayPrimariesCode (0, 50000, 3, 3, defaultPrimaryCodes, sizeof(defaultPrimaryCodes )/sizeof(Int));
669  SMultiValueInput<Int> cfg_DisplayWhitePointCode (0, 50000, 2, 2, defaultWhitePointCode, sizeof(defaultWhitePointCode)/sizeof(Int));
670 
671  SMultiValueInput<Bool> cfg_timeCodeSeiTimeStampFlag (0, 1, 0, MAX_TIMECODE_SEI_SETS);
672  SMultiValueInput<Bool> cfg_timeCodeSeiNumUnitFieldBasedFlag(0, 1, 0, MAX_TIMECODE_SEI_SETS);
673  SMultiValueInput<Int> cfg_timeCodeSeiCountingType (0, 6, 0, MAX_TIMECODE_SEI_SETS);
674  SMultiValueInput<Bool> cfg_timeCodeSeiFullTimeStampFlag (0, 1, 0, MAX_TIMECODE_SEI_SETS);
675  SMultiValueInput<Bool> cfg_timeCodeSeiDiscontinuityFlag (0, 1, 0, MAX_TIMECODE_SEI_SETS);
676  SMultiValueInput<Bool> cfg_timeCodeSeiCntDroppedFlag (0, 1, 0, MAX_TIMECODE_SEI_SETS);
677  SMultiValueInput<Int> cfg_timeCodeSeiNumberOfFrames (0,511, 0, MAX_TIMECODE_SEI_SETS);
678  SMultiValueInput<Int> cfg_timeCodeSeiSecondsValue (0, 59, 0, MAX_TIMECODE_SEI_SETS);
679  SMultiValueInput<Int> cfg_timeCodeSeiMinutesValue (0, 59, 0, MAX_TIMECODE_SEI_SETS);
680  SMultiValueInput<Int> cfg_timeCodeSeiHoursValue (0, 23, 0, MAX_TIMECODE_SEI_SETS);
681  SMultiValueInput<Bool> cfg_timeCodeSeiSecondsFlag (0, 1, 0, MAX_TIMECODE_SEI_SETS);
682  SMultiValueInput<Bool> cfg_timeCodeSeiMinutesFlag (0, 1, 0, MAX_TIMECODE_SEI_SETS);
683  SMultiValueInput<Bool> cfg_timeCodeSeiHoursFlag (0, 1, 0, MAX_TIMECODE_SEI_SETS);
684  SMultiValueInput<Int> cfg_timeCodeSeiTimeOffsetLength (0, 31, 0, MAX_TIMECODE_SEI_SETS);
685  SMultiValueInput<Int> cfg_timeCodeSeiTimeOffsetValue (std::numeric_limits<Int>::min(), std::numeric_limits<Int>::max(), 0, MAX_TIMECODE_SEI_SETS);
686 
687  po::Options opts;
688  opts.addOptions()
689  ("help", do_help, false, "this help text")
690  ("c", po::parseConfigFile, "configuration file name")
691 
692  // File, I/O and source parameters
693  ("InputFile,i", cfg_InputFile, string(""), "Original YUV input file name")
694  ("BitstreamFile,b", cfg_BitstreamFile, string(""), "Bitstream output file name")
695  ("ReconFile,o", cfg_ReconFile, string(""), "Reconstructed YUV output file name")
696  ("SourceWidth,-wdt", m_iSourceWidth, 0, "Source picture width")
697  ("SourceHeight,-hgt", m_iSourceHeight, 0, "Source picture height")
698  ("InputBitDepth", m_inputBitDepth[CHANNEL_TYPE_LUMA], 8, "Bit-depth of input file")
699  ("OutputBitDepth", m_outputBitDepth[CHANNEL_TYPE_LUMA], 0, "Bit-depth of output file (default:InternalBitDepth)")
700  ("MSBExtendedBitDepth", m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA], 0, "bit depth of luma component after addition of MSBs of value 0 (used for synthesising High Dynamic Range source material). (default:InputBitDepth)")
701  ("InternalBitDepth", m_internalBitDepth[CHANNEL_TYPE_LUMA], 0, "Bit-depth the codec operates at. (default:MSBExtendedBitDepth). If different to MSBExtendedBitDepth, source data will be converted")
702  ("InputBitDepthC", m_inputBitDepth[CHANNEL_TYPE_CHROMA], 0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)")
703  ("OutputBitDepthC", m_outputBitDepth[CHANNEL_TYPE_CHROMA], 0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
704  ("MSBExtendedBitDepthC", m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA], 0, "As per MSBExtendedBitDepth but for chroma component. (default:MSBExtendedBitDepth)")
705  ("InternalBitDepthC", m_internalBitDepth[CHANNEL_TYPE_CHROMA], 0, "As per InternalBitDepth but for chroma component. (default:InternalBitDepth)")
706  ("ExtendedPrecision", m_useExtendedPrecision, false, "Increased internal accuracies to support high bit depths (not valid in V1 profiles)")
707  ("HighPrecisionPredictionWeighting", m_useHighPrecisionPredictionWeighting, false, "Use high precision option for weighted prediction (not valid in V1 profiles)")
708  ("InputColourSpaceConvert", inputColourSpaceConvert, string(""), "Colour space conversion to apply to input video. Permitted values are (empty string=UNCHANGED) " + getListOfColourSpaceConverts(true))
709  ("SNRInternalColourSpace", m_snrInternalColourSpace, false, "If true, then no colour space conversion is applied prior to SNR, otherwise inverse of input is applied.")
710  ("OutputInternalColourSpace", m_outputInternalColourSpace, false, "If true, then no colour space conversion is applied for reconstructed video, otherwise inverse of input is applied.")
711  ("InputChromaFormat", tmpInputChromaFormat, 420, "InputChromaFormatIDC")
712  ("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")
713  ("PrintFrameMSE", m_printFrameMSE, false, "0 (default) emit only bit count and PSNRs for each frame, 1 = also emit MSE values")
714  ("PrintSequenceMSE", m_printSequenceMSE, false, "0 (default) emit only bit rate and PSNRs for the whole sequence, 1 = also emit MSE values")
715  ("CabacZeroWordPaddingEnabled", m_cabacZeroWordPaddingEnabled, true, "0 do not add conforming cabac-zero-words to bit streams, 1 (default) = add cabac-zero-words as required")
716  ("ChromaFormatIDC,-cf", tmpChromaFormat, 0, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat)")
717  ("ConformanceMode", m_conformanceWindowMode, 0, "Deprecated alias of ConformanceWindowMode")
718  ("ConformanceWindowMode", m_conformanceWindowMode, 0, "Window conformance mode (0: no window, 1:automatic padding, 2:padding, 3:conformance")
719  ("HorizontalPadding,-pdx", m_aiPad[0], 0, "Horizontal source padding for conformance window mode 2")
720  ("VerticalPadding,-pdy", m_aiPad[1], 0, "Vertical source padding for conformance window mode 2")
721  ("ConfLeft", m_confWinLeft, 0, "Deprecated alias of ConfWinLeft")
722  ("ConfRight", m_confWinRight, 0, "Deprecated alias of ConfWinRight")
723  ("ConfTop", m_confWinTop, 0, "Deprecated alias of ConfWinTop")
724  ("ConfBottom", m_confWinBottom, 0, "Deprecated alias of ConfWinBottom")
725  ("ConfWinLeft", m_confWinLeft, 0, "Left offset for window conformance mode 3")
726  ("ConfWinRight", m_confWinRight, 0, "Right offset for window conformance mode 3")
727  ("ConfWinTop", m_confWinTop, 0, "Top offset for window conformance mode 3")
728  ("ConfWinBottom", m_confWinBottom, 0, "Bottom offset for window conformance mode 3")
729  ("FrameRate,-fr", m_iFrameRate, 0, "Frame rate")
730  ("FrameSkip,-fs", m_FrameSkip, 0u, "Number of frames to skip at start of input YUV")
731  ("FramesToBeEncoded,f", m_framesToBeEncoded, 0, "Number of frames to be encoded (default=all)")
732 
733  //Field coding parameters
734  ("FieldCoding", m_isField, false, "Signals if it's a field based coding")
735  ("TopFieldFirst, Tff", m_isTopFieldFirst, false, "In case of field based coding, signals whether if it's a top field first or not")
736 
737  // Profile and level
738  ("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")
739  ("Level", m_level, Level::NONE, "Level limit to be used, eg 5.1, or none")
740  ("Tier", m_levelTier, Level::MAIN, "Tier to use for interpretation of --Level (main or high only)")
741  ("MaxBitDepthConstraint", m_bitDepthConstraint, 0u, "Bit depth to use for profile-constraint for RExt profiles. 0=automatically choose based upon other parameters")
742  ("MaxChromaFormatConstraint", tmpConstraintChromaFormat, 0, "Chroma-format to use for the profile-constraint for RExt profiles. 0=automatically choose based upon other parameters")
743  ("IntraConstraintFlag", m_intraConstraintFlag, false, "Value of general_intra_constraint_flag to use for RExt profiles (not used if an explicit RExt sub-profile is specified)")
744  ("LowerBitRateConstraintFlag", m_lowerBitRateConstraintFlag, true, "Value of general_lower_bit_rate_constraint_flag to use for RExt profiles")
745 
746  ("ProgressiveSource", m_progressiveSourceFlag, false, "Indicate that source is progressive")
747  ("InterlacedSource", m_interlacedSourceFlag, false, "Indicate that source is interlaced")
748  ("NonPackedSource", m_nonPackedConstraintFlag, false, "Indicate that source does not contain frame packing")
749  ("FrameOnly", m_frameOnlyConstraintFlag, false, "Indicate that the bitstream contains only frames")
750 
751  // Unit definition parameters
752  ("MaxCUWidth", m_uiMaxCUWidth, 64u)
753  ("MaxCUHeight", m_uiMaxCUHeight, 64u)
754  // todo: remove defaults from MaxCUSize
755  ("MaxCUSize,s", m_uiMaxCUWidth, 64u, "Maximum CU size")
756  ("MaxCUSize,s", m_uiMaxCUHeight, 64u, "Maximum CU size")
757  ("MaxPartitionDepth,h", m_uiMaxCUDepth, 4u, "CU depth")
758 
759  ("QuadtreeTULog2MaxSize", m_uiQuadtreeTULog2MaxSize, 6u, "Maximum TU size in logarithm base 2")
760  ("QuadtreeTULog2MinSize", m_uiQuadtreeTULog2MinSize, 2u, "Minimum TU size in logarithm base 2")
761 
762  ("QuadtreeTUMaxDepthIntra", m_uiQuadtreeTUMaxDepthIntra, 1u, "Depth of TU tree for intra CUs")
763  ("QuadtreeTUMaxDepthInter", m_uiQuadtreeTUMaxDepthInter, 2u, "Depth of TU tree for inter CUs")
764 
765  // Coding structure paramters
766  ("IntraPeriod,-ip", m_iIntraPeriod, -1, "Intra period in frames, (-1: only first frame)")
768  ("DecodingRefreshType,-dr", m_iDecodingRefreshType, 0, "Intra refresh type (0:none 1:CRA 2:IDR 3:RecPointSEI)")
769 #else
770  ("DecodingRefreshType,-dr", m_iDecodingRefreshType, 0, "Intra refresh type (0:none 1:CRA 2:IDR)")
771 #endif
772  ("GOPSize,g", m_iGOPSize, 1, "GOP size of temporal structure")
773 
774  // motion search options
775  ("FastSearch", m_iFastSearch, 1, "0:Full search 1:Diamond 2:PMVFAST")
776  ("SearchRange,-sr", m_iSearchRange, 96, "Motion search range")
777  ("BipredSearchRange", m_bipredSearchRange, 4, "Motion search range for bipred refinement")
778  ("HadamardME", m_bUseHADME, true, "Hadamard ME for fractional-pel")
779  ("ASR", m_bUseASR, false, "Adaptive motion search range")
780 
781  // Mode decision parameters
782  ("LambdaModifier0,-LM0", m_adLambdaModifier[ 0 ], ( Double )1.0, "Lambda modifier for temporal layer 0")
783  ("LambdaModifier1,-LM1", m_adLambdaModifier[ 1 ], ( Double )1.0, "Lambda modifier for temporal layer 1")
784  ("LambdaModifier2,-LM2", m_adLambdaModifier[ 2 ], ( Double )1.0, "Lambda modifier for temporal layer 2")
785  ("LambdaModifier3,-LM3", m_adLambdaModifier[ 3 ], ( Double )1.0, "Lambda modifier for temporal layer 3")
786  ("LambdaModifier4,-LM4", m_adLambdaModifier[ 4 ], ( Double )1.0, "Lambda modifier for temporal layer 4")
787  ("LambdaModifier5,-LM5", m_adLambdaModifier[ 5 ], ( Double )1.0, "Lambda modifier for temporal layer 5")
788  ("LambdaModifier6,-LM6", m_adLambdaModifier[ 6 ], ( Double )1.0, "Lambda modifier for temporal layer 6")
789 
790  /* Quantization parameters */
791  ("QP,q", m_fQP, 30.0, "Qp value, if value is float, QP is switched once during encoding")
792  ("DeltaQpRD,-dqr", m_uiDeltaQpRD, 0u, "max dQp offset for slice")
793  ("MaxDeltaQP,d", m_iMaxDeltaQP, 0, "max dQp offset for block")
794  ("MaxCuDQPDepth,-dqd", m_iMaxCuDQPDepth, 0, "max depth for a minimum CuDQP")
795  ("MaxCUChromaQpAdjustmentDepth", m_maxCUChromaQpAdjustmentDepth, -1, "Maximum depth for CU chroma Qp adjustment - set less than 0 to disable")
796 
797  ("CbQpOffset,-cbqpofs", m_cbQpOffset, 0, "Chroma Cb QP Offset")
798  ("CrQpOffset,-crqpofs", m_crQpOffset, 0, "Chroma Cr QP Offset")
799 
800 #if ADAPTIVE_QP_SELECTION
801  ("AdaptiveQpSelection,-aqps", m_bUseAdaptQpSelect, false, "AdaptiveQpSelection")
802 #endif
803 
804  ("AdaptiveQP,-aq", m_bUseAdaptiveQP, false, "QP adaptation based on a psycho-visual model")
805  ("MaxQPAdaptationRange,-aqr", m_iQPAdaptationRange, 6, "QP adaptation range")
806  ("dQPFile,m", cfg_dQPFile, string(""), "dQP file name")
807  ("RDOQ", m_useRDOQ, true)
808  ("RDOQTS", m_useRDOQTS, true)
809  ("RDpenalty", m_rdPenalty, 0, "RD-penalty for 32x32 TU for intra in non-intra slices. 0:disabled 1:RD-penalty 2:maximum RD-penalty")
810 
811  // Deblocking filter parameters
812  ("LoopFilterDisable", m_bLoopFilterDisable, false)
813  ("LoopFilterOffsetInPPS", m_loopFilterOffsetInPPS, false)
814  ("LoopFilterBetaOffset_div2", m_loopFilterBetaOffsetDiv2, 0)
815  ("LoopFilterTcOffset_div2", m_loopFilterTcOffsetDiv2, 0)
816  ("DeblockingFilterControlPresent", m_DeblockingFilterControlPresent, false)
817  ("DeblockingFilterMetric", m_DeblockingFilterMetric, false)
818 
819  // Coding tools
820  ("AMP", m_enableAMP, true, "Enable asymmetric motion partitions")
821  ("CrossComponentPrediction", m_useCrossComponentPrediction, false, "Enable the use of cross-component prediction (not valid in V1 profiles)")
822  ("ReconBasedCrossCPredictionEstimate", m_reconBasedCrossCPredictionEstimate, false, "When determining the alpha value for cross-component prediction, use the decoded residual rather than the pre-transform encoder-side residual")
823  ("SaoLumaOffsetBitShift", saoOffsetBitShift[CHANNEL_TYPE_LUMA], 0, "Specify the luma SAO bit-shift. If negative, automatically calculate a suitable value based upon bit depth and initial QP")
824  ("SaoChromaOffsetBitShift", saoOffsetBitShift[CHANNEL_TYPE_CHROMA], 0, "Specify the chroma SAO bit-shift. If negative, automatically calculate a suitable value based upon bit depth and initial QP")
825  ("TransformSkip", m_useTransformSkip, false, "Intra transform skipping")
826  ("TransformSkipFast", m_useTransformSkipFast, false, "Fast intra transform skipping")
827  ("TransformSkipLog2MaxSize", m_transformSkipLog2MaxSize, 2U, "Specify transform-skip maximum size. Minimum 2. (not valid in V1 profiles)")
828  ("ImplicitResidualDPCM", m_useResidualDPCM[RDPCM_SIGNAL_IMPLICIT], false, "Enable implicitly signalled residual DPCM for intra (also known as sample-adaptive intra predict) (not valid in V1 profiles)")
829  ("ExplicitResidualDPCM", m_useResidualDPCM[RDPCM_SIGNAL_EXPLICIT], false, "Enable explicitly signalled residual DPCM for inter (not valid in V1 profiles)")
830  ("ResidualRotation", m_useResidualRotation, false, "Enable rotation of transform-skipped and transquant-bypassed TUs through 180 degrees prior to entropy coding (not valid in V1 profiles)")
831  ("SingleSignificanceMapContext", m_useSingleSignificanceMapContext, false, "Enable, for transform-skipped and transquant-bypassed TUs, the selection of a single significance map context variable for all coefficients (not valid in V1 profiles)")
832  ("GolombRiceParameterAdaptation", m_useGolombRiceParameterAdaptation, false, "Enable the adaptation of the Golomb-Rice parameter over the course of each slice")
833  ("AlignCABACBeforeBypass", m_alignCABACBeforeBypass, false, "Align the CABAC engine to a defined fraction of a bit prior to coding bypass data. Must be 1 in high bit rate profile, 0 otherwise" )
834  ("SAO", m_bUseSAO, true, "Enable Sample Adaptive Offset")
835  ("MaxNumOffsetsPerPic", m_maxNumOffsetsPerPic, 2048, "Max number of SAO offset per picture (Default: 2048)")
836  ("SAOLcuBoundary", m_saoCtuBoundary, false, "0: right/bottom CTU boundary areas skipped from SAO parameter estimation, 1: non-deblocked pixels are used for those areas")
837  ("SliceMode", m_sliceMode, 0, "0: Disable all Recon slice limits, 1: Enforce max # of CTUs, 2: Enforce max # of bytes, 3:specify tiles per dependent slice")
838  ("SliceArgument", m_sliceArgument, 0, "Depending on SliceMode being:"
839  "\t1: max number of CTUs per slice"
840  "\t2: max number of bytes per slice"
841  "\t3: max number of tiles per slice")
842  ("SliceSegmentMode", m_sliceSegmentMode, 0, "0: Disable all slice segment limits, 1: Enforce max # of CTUs, 2: Enforce max # of bytes, 3:specify tiles per dependent slice")
843  ("SliceSegmentArgument", m_sliceSegmentArgument, 0, "Depending on SliceSegmentMode being:"
844  "\t1: max number of CTUs per slice segment"
845  "\t2: max number of bytes per slice segment"
846  "\t3: max number of tiles per slice segment")
847  ("LFCrossSliceBoundaryFlag", m_bLFCrossSliceBoundaryFlag, true)
848 
849  ("ConstrainedIntraPred", m_bUseConstrainedIntraPred, false, "Constrained Intra Prediction")
850  ("PCMEnabledFlag", m_usePCM, false)
851  ("PCMLog2MaxSize", m_pcmLog2MaxSize, 5u)
852  ("PCMLog2MinSize", m_uiPCMLog2MinSize, 3u)
853 
854  ("PCMInputBitDepthFlag", m_bPCMInputBitDepthFlag, true)
855  ("PCMFilterDisableFlag", m_bPCMFilterDisableFlag, false)
856  ("IntraReferenceSmoothing", m_enableIntraReferenceSmoothing, true, "0: Disable use of intra reference smoothing. 1: Enable use of intra reference smoothing (not valid in V1 profiles)")
857  ("WeightedPredP,-wpP", m_useWeightedPred, false, "Use weighted prediction in P slices")
858  ("WeightedPredB,-wpB", m_useWeightedBiPred, false, "Use weighted (bidirectional) prediction in B slices")
859  ("Log2ParallelMergeLevel", m_log2ParallelMergeLevel, 2u, "Parallel merge estimation region")
860  //deprecated copies of renamed tile parameters
861  ("UniformSpacingIdc", m_tileUniformSpacingFlag, false, "deprecated alias of TileUniformSpacing")
862  ("ColumnWidthArray", cfg_ColumnWidth, cfg_ColumnWidth, "deprecated alias of TileColumnWidthArray")
863  ("RowHeightArray", cfg_RowHeight, cfg_RowHeight, "deprecated alias of TileRowHeightArray")
864 
865  ("TileUniformSpacing", m_tileUniformSpacingFlag, false, "Indicates that tile columns and rows are distributed uniformly")
866  ("NumTileColumnsMinus1", m_numTileColumnsMinus1, 0, "Number of tile columns in a picture minus 1")
867  ("NumTileRowsMinus1", m_numTileRowsMinus1, 0, "Number of rows in a picture minus 1")
868  ("TileColumnWidthArray", cfg_ColumnWidth, cfg_ColumnWidth, "Array containing tile column width values in units of CTU")
869  ("TileRowHeightArray", cfg_RowHeight, cfg_RowHeight, "Array containing tile row height values in units of CTU")
870  ("LFCrossTileBoundaryFlag", m_bLFCrossTileBoundaryFlag, true, "1: cross-tile-boundary loop filtering. 0:non-cross-tile-boundary loop filtering")
871  ("WaveFrontSynchro", m_iWaveFrontSynchro, 0, "0: no synchro; 1 synchro with top-right-right")
872  ("ScalingList", m_useScalingListId, SCALING_LIST_OFF, "0/off: no scaling list, 1/default: default scaling lists, 2/file: scaling lists specified in ScalingListFile")
873  ("ScalingListFile", cfg_ScalingListFile, string(""), "Scaling list file name. Use an empty string to produce help.")
874  ("SignHideFlag,-SBH", m_signHideFlag, true)
875  ("MaxNumMergeCand", m_maxNumMergeCand, 5u, "Maximum number of merge candidates")
876  /* Misc. */
877  ("SEIDecodedPictureHash", m_decodedPictureHashSEIEnabled, 0, "Control generation of decode picture hash SEI messages\n"
878  "\t3: checksum\n"
879  "\t2: CRC\n"
880  "\t1: use MD5\n"
881  "\t0: disable")
882  ("SEIpictureDigest", m_decodedPictureHashSEIEnabled, 0, "deprecated alias for SEIDecodedPictureHash")
883  ("TMVPMode", m_TMVPModeId, 1, "TMVP mode 0: TMVP disable for all slices. 1: TMVP enable for all slices (default) 2: TMVP enable for certain slices only")
884  ("FEN", m_bUseFastEnc, false, "fast encoder setting")
885  ("ECU", m_bUseEarlyCU, false, "Early CU setting")
886  ("FDM", m_useFastDecisionForMerge, true, "Fast decision for Merge RD Cost")
887  ("CFM", m_bUseCbfFastMode, false, "Cbf fast mode setting")
888  ("ESD", m_useEarlySkipDetection, false, "Early SKIP detection setting")
889  ( "RateControl", m_RCEnableRateControl, false, "Rate control: enable rate control" )
890  ( "TargetBitrate", m_RCTargetBitrate, 0, "Rate control: target bit-rate" )
891  ( "KeepHierarchicalBit", m_RCKeepHierarchicalBit, 0, "Rate control: 0: equal bit allocation; 1: fixed ratio bit allocation; 2: adaptive ratio bit allocation" )
892  ( "LCULevelRateControl", m_RCLCULevelRC, true, "Rate control: true: CTU level RC; false: picture level RC" )
893  ( "RCLCUSeparateModel", m_RCUseLCUSeparateModel, true, "Rate control: use CTU level separate R-lambda model" )
894  ( "InitialQP", m_RCInitialQP, 0, "Rate control: initial QP" )
895  ( "RCForceIntraQP", m_RCForceIntraQP, false, "Rate control: force intra QP to be equal to initial QP" )
896 
897  ("TransquantBypassEnableFlag", m_TransquantBypassEnableFlag, false, "transquant_bypass_enable_flag indicator in PPS")
898  ("CUTransquantBypassFlagForce", m_CUTransquantBypassFlagForce, false, "Force transquant bypass mode, when transquant_bypass_enable_flag is enabled")
899  ("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).")
900  ("RecalculateQPAccordingToLambda", m_recalculateQPAccordingToLambda, false, "Recalculate QP values according to lambda values. Do not suggest to be enabled in all intra case")
901  ("StrongIntraSmoothing,-sis", m_useStrongIntraSmoothing, true, "Enable strong intra smoothing for 32x32 blocks")
902  ("SEIActiveParameterSets", m_activeParameterSetsSEIEnabled, 0, "Enable generation of active parameter sets SEI messages")
903  ("VuiParametersPresent,-vui", m_vuiParametersPresentFlag, false, "Enable generation of vui_parameters()")
904  ("AspectRatioInfoPresent", m_aspectRatioInfoPresentFlag, false, "Signals whether aspect_ratio_idc is present")
905  ("AspectRatioIdc", m_aspectRatioIdc, 0, "aspect_ratio_idc")
906  ("SarWidth", m_sarWidth, 0, "horizontal size of the sample aspect ratio")
907  ("SarHeight", m_sarHeight, 0, "vertical size of the sample aspect ratio")
908  ("OverscanInfoPresent", m_overscanInfoPresentFlag, false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n")
909  ("OverscanAppropriate", m_overscanAppropriateFlag, false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n")
910  ("VideoSignalTypePresent", m_videoSignalTypePresentFlag, false, "Signals whether video_format, video_full_range_flag, and colour_description_present_flag are present")
911  ("VideoFormat", m_videoFormat, 5, "Indicates representation of pictures")
912  ("VideoFullRange", m_videoFullRangeFlag, false, "Indicates the black level and range of luma and chroma signals")
913  ("ColourDescriptionPresent", m_colourDescriptionPresentFlag, false, "Signals whether colour_primaries, transfer_characteristics and matrix_coefficients are present")
914  ("ColourPrimaries", m_colourPrimaries, 2, "Indicates chromaticity coordinates of the source primaries")
915  ("TransferCharacteristics", m_transferCharacteristics, 2, "Indicates the opto-electronic transfer characteristics of the source")
916  ("MatrixCoefficients", m_matrixCoefficients, 2, "Describes the matrix coefficients used in deriving luma and chroma from RGB primaries")
917  ("ChromaLocInfoPresent", m_chromaLocInfoPresentFlag, false, "Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present")
918  ("ChromaSampleLocTypeTopField", m_chromaSampleLocTypeTopField, 0, "Specifies the location of chroma samples for top field")
919  ("ChromaSampleLocTypeBottomField", m_chromaSampleLocTypeBottomField, 0, "Specifies the location of chroma samples for bottom field")
920  ("NeutralChromaIndication", m_neutralChromaIndicationFlag, false, "Indicates that the value of all decoded chroma samples is equal to 1<<(BitDepthCr-1)")
921  ("DefaultDisplayWindowFlag", m_defaultDisplayWindowFlag, false, "Indicates the presence of the Default Window parameters")
922  ("DefDispWinLeftOffset", m_defDispWinLeftOffset, 0, "Specifies the left offset of the default display window from the conformance window")
923  ("DefDispWinRightOffset", m_defDispWinRightOffset, 0, "Specifies the right offset of the default display window from the conformance window")
924  ("DefDispWinTopOffset", m_defDispWinTopOffset, 0, "Specifies the top offset of the default display window from the conformance window")
925  ("DefDispWinBottomOffset", m_defDispWinBottomOffset, 0, "Specifies the bottom offset of the default display window from the conformance window")
926  ("FrameFieldInfoPresentFlag", m_frameFieldInfoPresentFlag, false, "Indicates that pic_struct and field coding related values are present in picture timing SEI messages")
927  ("PocProportionalToTimingFlag", m_pocProportionalToTimingFlag, false, "Indicates that the POC value is proportional to the output time w.r.t. first picture in CVS")
928  ("NumTicksPocDiffOneMinus1", m_numTicksPocDiffOneMinus1, 0, "Number of ticks minus 1 that for a POC difference of one")
929  ("BitstreamRestriction", m_bitstreamRestrictionFlag, false, "Signals whether bitstream restriction parameters are present")
930  ("TilesFixedStructure", m_tilesFixedStructureFlag, false, "Indicates that each active picture parameter set has the same values of the syntax elements related to tiles")
931  ("MotionVectorsOverPicBoundaries", m_motionVectorsOverPicBoundariesFlag, false, "Indicates that no samples outside the picture boundaries are used for inter prediction")
932  ("MaxBytesPerPicDenom", m_maxBytesPerPicDenom, 2, "Indicates a number of bytes not exceeded by the sum of the sizes of the VCL NAL units associated with any coded picture")
933  ("MaxBitsPerMinCuDenom", m_maxBitsPerMinCuDenom, 1, "Indicates an upper bound for the number of bits of coding_unit() data")
934  ("Log2MaxMvLengthHorizontal", m_log2MaxMvLengthHorizontal, 15, "Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units")
935  ("Log2MaxMvLengthVertical", m_log2MaxMvLengthVertical, 15, "Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units")
936  ("SEIRecoveryPoint", m_recoveryPointSEIEnabled, 0, "Control generation of recovery point SEI messages")
937  ("SEIBufferingPeriod", m_bufferingPeriodSEIEnabled, 0, "Control generation of buffering period SEI messages")
938  ("SEIPictureTiming", m_pictureTimingSEIEnabled, 0, "Control generation of picture timing SEI messages")
939  ("SEIToneMappingInfo", m_toneMappingInfoSEIEnabled, false, "Control generation of Tone Mapping SEI messages")
940  ("SEIToneMapId", m_toneMapId, 0, "Specifies Id of Tone Mapping SEI message for a given session")
941  ("SEIToneMapCancelFlag", m_toneMapCancelFlag, false, "Indicates that Tone Mapping SEI message cancels the persistence or follows")
942  ("SEIToneMapPersistenceFlag", m_toneMapPersistenceFlag, true, "Specifies the persistence of the Tone Mapping SEI message")
943  ("SEIToneMapCodedDataBitDepth", m_toneMapCodedDataBitDepth, 8, "Specifies Coded Data BitDepth of Tone Mapping SEI messages")
944  ("SEIToneMapTargetBitDepth", m_toneMapTargetBitDepth, 8, "Specifies Output BitDepth of Tone mapping function")
945  ("SEIToneMapModelId", m_toneMapModelId, 0, "Specifies Model utilized for mapping coded data into target_bit_depth range\n"
946  "\t0: linear mapping with clipping\n"
947  "\t1: sigmoidal mapping\n"
948  "\t2: user-defined table mapping\n"
949  "\t3: piece-wise linear mapping\n"
950  "\t4: luminance dynamic range information ")
951  ("SEIToneMapMinValue", m_toneMapMinValue, 0, "Specifies the minimum value in mode 0")
952  ("SEIToneMapMaxValue", m_toneMapMaxValue, 1023, "Specifies the maximum value in mode 0")
953  ("SEIToneMapSigmoidMidpoint", m_sigmoidMidpoint, 512, "Specifies the centre point in mode 1")
954  ("SEIToneMapSigmoidWidth", m_sigmoidWidth, 960, "Specifies the distance between 5% and 95% values of the target_bit_depth in mode 1")
955  ("SEIToneMapStartOfCodedInterval", cfg_startOfCodedInterval, cfg_startOfCodedInterval, "Array of user-defined mapping table")
956  ("SEIToneMapNumPivots", m_numPivots, 0, "Specifies the number of pivot points in mode 3")
957  ("SEIToneMapCodedPivotValue", cfg_codedPivotValue, cfg_codedPivotValue, "Array of pivot point")
958  ("SEIToneMapTargetPivotValue", cfg_targetPivotValue, cfg_targetPivotValue, "Array of pivot point")
959  ("SEIToneMapCameraIsoSpeedIdc", m_cameraIsoSpeedIdc, 0, "Indicates the camera ISO speed for daylight illumination")
960  ("SEIToneMapCameraIsoSpeedValue", m_cameraIsoSpeedValue, 400, "Specifies the camera ISO speed for daylight illumination of Extended_ISO")
961  ("SEIToneMapExposureIndexIdc", m_exposureIndexIdc, 0, "Indicates the exposure index setting of the camera")
962  ("SEIToneMapExposureIndexValue", m_exposureIndexValue, 400, "Specifies the exposure index setting of the camera of Extended_ISO")
963  ("SEIToneMapExposureCompensationValueSignFlag", m_exposureCompensationValueSignFlag, false, "Specifies the sign of ExposureCompensationValue")
964  ("SEIToneMapExposureCompensationValueNumerator", m_exposureCompensationValueNumerator, 0, "Specifies the numerator of ExposureCompensationValue")
965  ("SEIToneMapExposureCompensationValueDenomIdc", m_exposureCompensationValueDenomIdc, 2, "Specifies the denominator of ExposureCompensationValue")
966  ("SEIToneMapRefScreenLuminanceWhite", m_refScreenLuminanceWhite, 350, "Specifies reference screen brightness setting in units of candela per square metre")
967  ("SEIToneMapExtendedRangeWhiteLevel", m_extendedRangeWhiteLevel, 800, "Indicates the luminance dynamic range")
968  ("SEIToneMapNominalBlackLevelLumaCodeValue", m_nominalBlackLevelLumaCodeValue, 16, "Specifies luma sample value of the nominal black level assigned decoded pictures")
969  ("SEIToneMapNominalWhiteLevelLumaCodeValue", m_nominalWhiteLevelLumaCodeValue, 235, "Specifies luma sample value of the nominal white level assigned decoded pictures")
970  ("SEIToneMapExtendedWhiteLevelLumaCodeValue", m_extendedWhiteLevelLumaCodeValue, 300, "Specifies luma sample value of the extended dynamic range assigned decoded pictures")
971  ("SEIChromaSamplingFilterHint", m_chromaSamplingFilterSEIenabled, false, "Control generation of the chroma sampling filter hint SEI message")
972  ("SEIChromaSamplingHorizontalFilterType", m_chromaSamplingHorFilterIdc, 2, "Defines the Index of the chroma sampling horizontal filter\n"
973  "\t0: unspecified - Chroma filter is unknown or is determined by the application"
974  "\t1: User-defined - Filter coefficients are specified in the chroma sampling filter hint SEI message"
975  "\t2: Standards-defined - ITU-T Rec. T.800 | ISO/IEC15444-1, 5/3 filter")
976  ("SEIChromaSamplingVerticalFilterType", m_chromaSamplingVerFilterIdc, 2, "Defines the Index of the chroma sampling vertical filter\n"
977  "\t0: unspecified - Chroma filter is unknown or is determined by the application"
978  "\t1: User-defined - Filter coefficients are specified in the chroma sampling filter hint SEI message"
979  "\t2: Standards-defined - ITU-T Rec. T.800 | ISO/IEC15444-1, 5/3 filter")
980  ("SEIFramePacking", m_framePackingSEIEnabled, 0, "Control generation of frame packing SEI messages")
981  ("SEIFramePackingType", m_framePackingSEIType, 0, "Define frame packing arrangement\n"
982  "\t3: side by side - frames are displayed horizontally\n"
983  "\t4: top bottom - frames are displayed vertically\n"
984  "\t5: frame alternation - one frame is alternated with the other")
985  ("SEIFramePackingId", m_framePackingSEIId, 0, "Id of frame packing SEI message for a given session")
986  ("SEIFramePackingQuincunx", m_framePackingSEIQuincunx, 0, "Indicate the presence of a Quincunx type video frame")
987  ("SEIFramePackingInterpretation", m_framePackingSEIInterpretation, 0, "Indicate the interpretation of the frame pair\n"
988  "\t0: unspecified\n"
989  "\t1: stereo pair, frame0 represents left view\n"
990  "\t2: stereo pair, frame0 represents right view")
991  ("SEISegmentedRectFramePacking", m_segmentedRectFramePackingSEIEnabled, 0, "Controls generation of segmented rectangular frame packing SEI messages")
992  ("SEISegmentedRectFramePackingCancel", m_segmentedRectFramePackingSEICancel, false, "If equal to 1, cancels the persistence of any previous SRFPA SEI message")
993  ("SEISegmentedRectFramePackingType", m_segmentedRectFramePackingSEIType, 0, "Specifies the arrangement of the frames in the reconstructed picture")
994  ("SEISegmentedRectFramePackingPersistence", m_segmentedRectFramePackingSEIPersistence, false, "If equal to 0, the SEI applies to the current frame only")
995  ("SEIDisplayOrientation", m_displayOrientationSEIAngle, 0, "Control generation of display orientation SEI messages\n"
996  "\tN: 0 < N < (2^16 - 1) enable display orientation SEI message with anticlockwise_rotation = N and display_orientation_repetition_period = 1\n"
997  "\t0: disable")
998  ("SEITemporalLevel0Index", m_temporalLevel0IndexSEIEnabled, 0, "Control generation of temporal level 0 index SEI messages")
999  ("SEIGradualDecodingRefreshInfo", m_gradualDecodingRefreshInfoEnabled, 0, "Control generation of gradual decoding refresh information SEI message")
1000  ("SEINoDisplay", m_noDisplaySEITLayer, 0, "Control generation of no display SEI message\n"
1001  "\tN: 0 < N enable no display SEI message for temporal layer N or higher\n"
1002  "\t0: disable")
1003  ("SEIDecodingUnitInfo", m_decodingUnitInfoSEIEnabled, 0, "Control generation of decoding unit information SEI message.")
1004  ("SEISOPDescription", m_SOPDescriptionSEIEnabled, 0, "Control generation of SOP description SEI messages")
1005  ("SEIScalableNesting", m_scalableNestingSEIEnabled, 0, "Control generation of scalable nesting SEI messages")
1006  ("SEITempMotionConstrainedTileSets", m_tmctsSEIEnabled, false, "Control generation of temporal motion constrained tile sets SEI message")
1007  ("SEITimeCodeEnabled", m_timeCodeSEIEnabled, false, "Control generation of time code information SEI message")
1008  ("SEITimeCodeNumClockTs", m_timeCodeSEINumTs, 0, "Number of clock time sets [0..3]")
1009  ("SEITimeCodeTimeStampFlag", cfg_timeCodeSeiTimeStampFlag, cfg_timeCodeSeiTimeStampFlag, "Time stamp flag associated to each time set")
1010  ("SEITimeCodeFieldBasedFlag", cfg_timeCodeSeiNumUnitFieldBasedFlag, cfg_timeCodeSeiNumUnitFieldBasedFlag, "Field based flag associated to each time set")
1011  ("SEITimeCodeCountingType", cfg_timeCodeSeiCountingType, cfg_timeCodeSeiCountingType, "Counting type associated to each time set")
1012  ("SEITimeCodeFullTsFlag", cfg_timeCodeSeiFullTimeStampFlag, cfg_timeCodeSeiFullTimeStampFlag, "Full time stamp flag associated to each time set")
1013  ("SEITimeCodeDiscontinuityFlag", cfg_timeCodeSeiDiscontinuityFlag, cfg_timeCodeSeiDiscontinuityFlag, "Discontinuity flag associated to each time set")
1014  ("SEITimeCodeCntDroppedFlag", cfg_timeCodeSeiCntDroppedFlag, cfg_timeCodeSeiCntDroppedFlag, "Counter dropped flag associated to each time set")
1015  ("SEITimeCodeNumFrames", cfg_timeCodeSeiNumberOfFrames, cfg_timeCodeSeiNumberOfFrames, "Number of frames associated to each time set")
1016  ("SEITimeCodeSecondsValue", cfg_timeCodeSeiSecondsValue, cfg_timeCodeSeiSecondsValue, "Seconds value for each time set")
1017  ("SEITimeCodeMinutesValue", cfg_timeCodeSeiMinutesValue, cfg_timeCodeSeiMinutesValue, "Minutes value for each time set")
1018  ("SEITimeCodeHoursValue", cfg_timeCodeSeiHoursValue, cfg_timeCodeSeiHoursValue, "Hours value for each time set")
1019  ("SEITimeCodeSecondsFlag", cfg_timeCodeSeiSecondsFlag, cfg_timeCodeSeiSecondsFlag, "Flag to signal seconds value presence in each time set")
1020  ("SEITimeCodeMinutesFlag", cfg_timeCodeSeiMinutesFlag, cfg_timeCodeSeiMinutesFlag, "Flag to signal minutes value presence in each time set")
1021  ("SEITimeCodeHoursFlag", cfg_timeCodeSeiHoursFlag, cfg_timeCodeSeiHoursFlag, "Flag to signal hours value presence in each time set")
1022  ("SEITimeCodeOffsetLength", cfg_timeCodeSeiTimeOffsetLength, cfg_timeCodeSeiTimeOffsetLength, "Time offset length associated to each time set")
1023  ("SEITimeCodeTimeOffset", cfg_timeCodeSeiTimeOffsetValue, cfg_timeCodeSeiTimeOffsetValue, "Time offset associated to each time set")
1024  ("SEIKneeFunctionInfo", m_kneeSEIEnabled, false, "Control generation of Knee function SEI messages")
1025  ("SEIKneeFunctionId", m_kneeSEIId, 0, "Specifies Id of Knee function SEI message for a given session")
1026  ("SEIKneeFunctionCancelFlag", m_kneeSEICancelFlag, false, "Indicates that Knee function SEI message cancels the persistence or follows")
1027  ("SEIKneeFunctionPersistenceFlag", m_kneeSEIPersistenceFlag, true, "Specifies the persistence of the Knee function SEI message")
1028  ("SEIKneeFunctionInputDrange", m_kneeSEIInputDrange, 1000, "Specifies the peak luminance level for the input picture of Knee function SEI messages")
1029  ("SEIKneeFunctionInputDispLuminance", m_kneeSEIInputDispLuminance, 100, "Specifies the expected display brightness for the input picture of Knee function SEI messages")
1030  ("SEIKneeFunctionOutputDrange", m_kneeSEIOutputDrange, 4000, "Specifies the peak luminance level for the output picture of Knee function SEI messages")
1031  ("SEIKneeFunctionOutputDispLuminance", m_kneeSEIOutputDispLuminance, 800, "Specifies the expected display brightness for the output picture of Knee function SEI messages")
1032  ("SEIKneeFunctionNumKneePointsMinus1", m_kneeSEINumKneePointsMinus1, 2, "Specifies the number of knee points - 1")
1033  ("SEIKneeFunctionInputKneePointValue", cfg_kneeSEIInputKneePointValue, cfg_kneeSEIInputKneePointValue, "Array of input knee point")
1034  ("SEIKneeFunctionOutputKneePointValue", cfg_kneeSEIOutputKneePointValue, cfg_kneeSEIOutputKneePointValue, "Array of output knee point")
1035  ("SEIMasteringDisplayColourVolume", m_masteringDisplay.colourVolumeSEIEnabled, false, "Control generation of mastering display colour volume SEI messages")
1036  ("SEIMasteringDisplayMaxLuminance", m_masteringDisplay.maxLuminance, 10000u, "Specifies the mastering display maximum luminance value in units of 1/10000 candela per square metre (32-bit code value)")
1037  ("SEIMasteringDisplayMinLuminance", m_masteringDisplay.minLuminance, 0u, "Specifies the mastering display minimum luminance value in units of 1/10000 candela per square metre (32-bit code value)")
1038  ("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)")
1039  ("SEIMasteringDisplayWhitePoint", cfg_DisplayWhitePointCode, cfg_DisplayWhitePointCode, "Mastering display white point CIE xy coordinates in normalised increments of 1/50000 (e.g. 0.333 = 16667)")
1040 
1041  ;
1042 
1043  for(Int i=1; i<MAX_GOP+1; i++)
1044  {
1045  std::ostringstream cOSS;
1046  cOSS<<"Frame"<<i;
1047  opts.addOptions()(cOSS.str(), m_GOPList[i-1], GOPEntry());
1048  }
1049  po::setDefaults(opts);
1050  const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv);
1051 
1052  for (list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++)
1053  {
1054  fprintf(stderr, "Unhandled argument ignored: `%s'\n", *it);
1055  }
1056 
1057  if (argc == 1 || do_help)
1058  {
1059  /* argc == 1: no options have been specified */
1060  po::doHelp(cout, opts);
1061  return false;
1062  }
1063 
1064  /*
1065  * Set any derived parameters
1066  */
1067  /* convert std::string to c string for compatability */
1068  m_pchInputFile = cfg_InputFile.empty() ? NULL : strdup(cfg_InputFile.c_str());
1069  m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str());
1070  m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str());
1071  m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str());
1072 
1073  if(m_isField)
1074  {
1075  //Frame height
1077  //Field height
1079  //number of fields to encode
1080  m_framesToBeEncoded *= 2;
1081  }
1082 
1084  {
1085  if (cfg_ColumnWidth.values.size() > m_numTileColumnsMinus1)
1086  {
1087  printf( "The number of columns whose width are defined is larger than the allowed number of columns.\n" );
1088  exit( EXIT_FAILURE );
1089  }
1090  else if (cfg_ColumnWidth.values.size() < m_numTileColumnsMinus1)
1091  {
1092  printf( "The width of some columns is not defined.\n" );
1093  exit( EXIT_FAILURE );
1094  }
1095  else
1096  {
1098  for(UInt i=0; i<cfg_ColumnWidth.values.size(); i++)
1099  {
1100  m_tileColumnWidth[i]=cfg_ColumnWidth.values[i];
1101  }
1102  }
1103  }
1104  else
1105  {
1106  m_tileColumnWidth.clear();
1107  }
1108 
1110  {
1111  if (cfg_RowHeight.values.size() > m_numTileRowsMinus1)
1112  {
1113  printf( "The number of rows whose height are defined is larger than the allowed number of rows.\n" );
1114  exit( EXIT_FAILURE );
1115  }
1116  else if (cfg_RowHeight.values.size() < m_numTileRowsMinus1)
1117  {
1118  printf( "The height of some rows is not defined.\n" );
1119  exit( EXIT_FAILURE );
1120  }
1121  else
1122  {
1124  for(UInt i=0; i<cfg_RowHeight.values.size(); i++)
1125  {
1126  m_tileRowHeight[i]=cfg_RowHeight.values[i];
1127  }
1128  }
1129  }
1130  else
1131  {
1132  m_tileRowHeight.clear();
1133  }
1134 
1135  m_scalingListFile = cfg_ScalingListFile.empty() ? NULL : strdup(cfg_ScalingListFile.c_str());
1136 
1137  /* rules for input, output and internal bitdepths as per help text */
1138  if (m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA ] == 0)
1139  {
1141  }
1142  if (m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] == 0)
1143  {
1145  }
1146  if (m_internalBitDepth [CHANNEL_TYPE_LUMA ] == 0)
1147  {
1149  }
1150  if (m_internalBitDepth [CHANNEL_TYPE_CHROMA] == 0)
1151  {
1153  }
1154  if (m_inputBitDepth [CHANNEL_TYPE_CHROMA] == 0)
1155  {
1157  }
1158  if (m_outputBitDepth [CHANNEL_TYPE_LUMA ] == 0)
1159  {
1161  }
1162  if (m_outputBitDepth [CHANNEL_TYPE_CHROMA] == 0)
1163  {
1165  }
1166 
1167  m_InputChromaFormatIDC = numberToChromaFormat(tmpInputChromaFormat);
1168  m_chromaFormatIDC = ((tmpChromaFormat == 0) ? (m_InputChromaFormatIDC) : (numberToChromaFormat(tmpChromaFormat)));
1169 
1170  if (extendedProfile >= 1000 && extendedProfile <= 2316)
1171  {
1173  if (m_bitDepthConstraint != 0 || tmpConstraintChromaFormat != 0)
1174  {
1175  fprintf(stderr, "Error: The bit depth and chroma format constraints are not used when an explicit RExt profile is specified\n");
1176  exit(EXIT_FAILURE);
1177  }
1178  m_bitDepthConstraint = (extendedProfile%100);
1179  m_intraConstraintFlag = (extendedProfile>=2000);
1180  switch ((extendedProfile/100)%10)
1181  {
1182  case 0: tmpConstraintChromaFormat=400; break;
1183  case 1: tmpConstraintChromaFormat=420; break;
1184  case 2: tmpConstraintChromaFormat=422; break;
1185  default: tmpConstraintChromaFormat=444; break;
1186  }
1187  }
1188  else
1189  {
1190  m_profile = Profile::Name(extendedProfile);
1191  }
1192 
1194  {
1195  if (m_bitDepthConstraint == 0)
1196  {
1197  m_bitDepthConstraint = 16;
1198  }
1199  m_chromaFormatConstraint = (tmpConstraintChromaFormat == 0) ? CHROMA_444 : numberToChromaFormat(tmpConstraintChromaFormat);
1200  }
1201  else if (m_profile == Profile::MAINREXT)
1202  {
1203  if (m_bitDepthConstraint == 0 && tmpConstraintChromaFormat == 0)
1204  {
1205  // produce a valid combination, if possible.
1206  const Bool bUsingGeneralRExtTools = m_useResidualRotation ||
1213  const Bool bUsingChromaQPAdjustment= m_maxCUChromaQpAdjustmentDepth >= 0;
1214  const Bool bUsingExtendedPrecision = m_useExtendedPrecision;
1216  automaticallySelectRExtProfile(bUsingGeneralRExtTools,
1217  bUsingChromaQPAdjustment,
1218  bUsingExtendedPrecision,
1222  m_chromaFormatIDC==CHROMA_400 ? m_internalBitDepth[CHANNEL_TYPE_LUMA] : std::max(m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA]),
1224  }
1225  else if (m_bitDepthConstraint == 0 || tmpConstraintChromaFormat == 0)
1226  {
1227  fprintf(stderr, "Error: The bit depth and chroma format constraints must either both be specified or both be configured automatically\n");
1228  exit(EXIT_FAILURE);
1229  }
1230  else
1231  {
1232  m_chromaFormatConstraint = numberToChromaFormat(tmpConstraintChromaFormat);
1233  }
1234  }
1235  else
1236  {
1237  m_chromaFormatConstraint = (tmpConstraintChromaFormat == 0) ? m_chromaFormatIDC : numberToChromaFormat(tmpConstraintChromaFormat);
1239  }
1240 
1241 
1242  m_inputColourSpaceConvert = stringToInputColourSpaceConvert(inputColourSpaceConvert, true);
1243 
1244  switch (m_conformanceWindowMode)
1245  {
1246  case 0:
1247  {
1248  // no conformance or padding
1250  m_aiPad[1] = m_aiPad[0] = 0;
1251  break;
1252  }
1253  case 1:
1254  {
1255  // automatic padding to minimum CU size
1256  Int minCuSize = m_uiMaxCUHeight >> (m_uiMaxCUDepth - 1);
1257  if (m_iSourceWidth % minCuSize)
1258  {
1259  m_aiPad[0] = m_confWinRight = ((m_iSourceWidth / minCuSize) + 1) * minCuSize - m_iSourceWidth;
1260  m_iSourceWidth += m_confWinRight;
1261  }
1262  if (m_iSourceHeight % minCuSize)
1263  {
1264  m_aiPad[1] = m_confWinBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight;
1265  m_iSourceHeight += m_confWinBottom;
1266  if ( m_isField )
1267  {
1269  m_aiPad[1] = m_confWinBottom << 1;
1270  }
1271  }
1273  {
1274  fprintf(stderr, "Error: picture width is not an integer multiple of the specified chroma subsampling\n");
1275  exit(EXIT_FAILURE);
1276  }
1278  {
1279  fprintf(stderr, "Error: picture height is not an integer multiple of the specified chroma subsampling\n");
1280  exit(EXIT_FAILURE);
1281  }
1282  break;
1283  }
1284  case 2:
1285  {
1286  //padding
1287  m_iSourceWidth += m_aiPad[0];
1288  m_iSourceHeight += m_aiPad[1];
1289  m_confWinRight = m_aiPad[0];
1290  m_confWinBottom = m_aiPad[1];
1291  break;
1292  }
1293  case 3:
1294  {
1295  // conformance
1296  if ((m_confWinLeft == 0) && (m_confWinRight == 0) && (m_confWinTop == 0) && (m_confWinBottom == 0))
1297  {
1298  fprintf(stderr, "Warning: Conformance window enabled, but all conformance window parameters set to zero\n");
1299  }
1300  if ((m_aiPad[1] != 0) || (m_aiPad[0]!=0))
1301  {
1302  fprintf(stderr, "Warning: Conformance window enabled, padding parameters will be ignored\n");
1303  }
1304  m_aiPad[1] = m_aiPad[0] = 0;
1305  break;
1306  }
1307  }
1308 
1309  // allocate slice-based dQP values
1310  m_aidQP = new Int[ m_framesToBeEncoded + m_iGOPSize + 1 ];
1311  ::memset( m_aidQP, 0, sizeof(Int)*( m_framesToBeEncoded + m_iGOPSize + 1 ) );
1312 
1313  // handling of floating-point QP values
1314  // if QP is not integer, sequence is split into two sections having QP and QP+1
1315  m_iQP = (Int)( m_fQP );
1316  if ( m_iQP < m_fQP )
1317  {
1318  Int iSwitchPOC = (Int)( m_framesToBeEncoded - (m_fQP - m_iQP)*m_framesToBeEncoded + 0.5 );
1319 
1320  iSwitchPOC = (Int)( (Double)iSwitchPOC / m_iGOPSize + 0.5 )*m_iGOPSize;
1321  for ( Int i=iSwitchPOC; i<m_framesToBeEncoded + m_iGOPSize + 1; i++ )
1322  {
1323  m_aidQP[i] = 1;
1324  }
1325  }
1326 
1327  for(UInt ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++)
1328  {
1329  if (saoOffsetBitShift[ch]<0)
1330  {
1331  if (m_internalBitDepth[ch]>10)
1332  {
1333  m_saoOffsetBitShift[ch]=UInt(Clip3<Int>(0, m_internalBitDepth[ch]-10, Int(m_internalBitDepth[ch]-10 + 0.165*m_iQP - 3.22 + 0.5) ) );
1334  }
1335  else
1336  {
1337  m_saoOffsetBitShift[ch]=0;
1338  }
1339  }
1340  else
1341  {
1342  m_saoOffsetBitShift[ch]=UInt(saoOffsetBitShift[ch]);
1343  }
1344  }
1345 
1346  // reading external dQP description from file
1347  if ( m_pchdQPFile )
1348  {
1349  FILE* fpt=fopen( m_pchdQPFile, "r" );
1350  if ( fpt )
1351  {
1352  Int iValue;
1353  Int iPOC = 0;
1354  while ( iPOC < m_framesToBeEncoded )
1355  {
1356  if ( fscanf(fpt, "%d", &iValue ) == EOF )
1357  {
1358  break;
1359  }
1360  m_aidQP[ iPOC ] = iValue;
1361  iPOC++;
1362  }
1363  fclose(fpt);
1364  }
1365  }
1366 
1368  {
1369  for(UInt idx=0; idx<6; idx++)
1370  {
1371  m_masteringDisplay.primaries[idx/2][idx%2] = UShort((cfg_DisplayPrimariesCode.values.size() > idx) ? cfg_DisplayPrimariesCode.values[idx] : 0);
1372  }
1373  for(UInt idx=0; idx<2; idx++)
1374  {
1375  m_masteringDisplay.whitePoint[idx] = UShort((cfg_DisplayWhitePointCode.values.size() > idx) ? cfg_DisplayWhitePointCode.values[idx] : 0);
1376  }
1377  }
1378 
1380  {
1381  if( m_toneMapModelId == 2 && !cfg_startOfCodedInterval.values.empty() )
1382  {
1383  const UInt num = 1u<< m_toneMapTargetBitDepth;
1384  m_startOfCodedInterval = new Int[num];
1385  for(UInt i=0; i<num; i++)
1386  {
1387  m_startOfCodedInterval[i] = cfg_startOfCodedInterval.values.size() > i ? cfg_startOfCodedInterval.values[i] : 0;
1388  }
1389  }
1390  else
1391  {
1393  }
1394  if( ( m_toneMapModelId == 3 ) && ( m_numPivots > 0 ) )
1395  {
1396  if( !cfg_codedPivotValue.values.empty() && !cfg_targetPivotValue.values.empty() )
1397  {
1400  for(UInt i=0; i<m_numPivots; i++)
1401  {
1402  m_codedPivotValue[i] = cfg_codedPivotValue.values.size() > i ? cfg_codedPivotValue.values [i] : 0;
1403  m_targetPivotValue[i] = cfg_targetPivotValue.values.size() > i ? cfg_targetPivotValue.values[i] : 0;
1404  }
1405  }
1406  }
1407  else
1408  {
1411  }
1412  }
1413 
1415  {
1419  for(Int i=0; i<(m_kneeSEINumKneePointsMinus1+1); i++)
1420  {
1421  m_kneeSEIInputKneePoint[i] = cfg_kneeSEIInputKneePointValue.values.size() > i ? cfg_kneeSEIInputKneePointValue.values[i] : 1;
1422  m_kneeSEIOutputKneePoint[i] = cfg_kneeSEIOutputKneePointValue.values.size() > i ? cfg_kneeSEIOutputKneePointValue.values[i] : 0;
1423  }
1424  }
1425 
1427  {
1428  for(Int i = 0; i < m_timeCodeSEINumTs && i < MAX_TIMECODE_SEI_SETS; i++)
1429  {
1430  m_timeSetArray[i].clockTimeStampFlag = cfg_timeCodeSeiTimeStampFlag .values.size()>i ? cfg_timeCodeSeiTimeStampFlag .values [i] : false;
1431  m_timeSetArray[i].numUnitFieldBasedFlag = cfg_timeCodeSeiNumUnitFieldBasedFlag.values.size()>i ? cfg_timeCodeSeiNumUnitFieldBasedFlag.values [i] : 0;
1432  m_timeSetArray[i].countingType = cfg_timeCodeSeiCountingType .values.size()>i ? cfg_timeCodeSeiCountingType .values [i] : 0;
1433  m_timeSetArray[i].fullTimeStampFlag = cfg_timeCodeSeiFullTimeStampFlag .values.size()>i ? cfg_timeCodeSeiFullTimeStampFlag .values [i] : 0;
1434  m_timeSetArray[i].discontinuityFlag = cfg_timeCodeSeiDiscontinuityFlag .values.size()>i ? cfg_timeCodeSeiDiscontinuityFlag .values [i] : 0;
1435  m_timeSetArray[i].cntDroppedFlag = cfg_timeCodeSeiCntDroppedFlag .values.size()>i ? cfg_timeCodeSeiCntDroppedFlag .values [i] : 0;
1436  m_timeSetArray[i].numberOfFrames = cfg_timeCodeSeiNumberOfFrames .values.size()>i ? cfg_timeCodeSeiNumberOfFrames .values [i] : 0;
1437  m_timeSetArray[i].secondsValue = cfg_timeCodeSeiSecondsValue .values.size()>i ? cfg_timeCodeSeiSecondsValue .values [i] : 0;
1438  m_timeSetArray[i].minutesValue = cfg_timeCodeSeiMinutesValue .values.size()>i ? cfg_timeCodeSeiMinutesValue .values [i] : 0;
1439  m_timeSetArray[i].hoursValue = cfg_timeCodeSeiHoursValue .values.size()>i ? cfg_timeCodeSeiHoursValue .values [i] : 0;
1440  m_timeSetArray[i].secondsFlag = cfg_timeCodeSeiSecondsFlag .values.size()>i ? cfg_timeCodeSeiSecondsFlag .values [i] : 0;
1441  m_timeSetArray[i].minutesFlag = cfg_timeCodeSeiMinutesFlag .values.size()>i ? cfg_timeCodeSeiMinutesFlag .values [i] : 0;
1442  m_timeSetArray[i].hoursFlag = cfg_timeCodeSeiHoursFlag .values.size()>i ? cfg_timeCodeSeiHoursFlag .values [i] : 0;
1443  m_timeSetArray[i].timeOffsetLength = cfg_timeCodeSeiTimeOffsetLength .values.size()>i ? cfg_timeCodeSeiTimeOffsetLength .values [i] : 0;
1444  m_timeSetArray[i].timeOffsetValue = cfg_timeCodeSeiTimeOffsetValue .values.size()>i ? cfg_timeCodeSeiTimeOffsetValue .values [i] : 0;
1445  }
1446  }
1447 
1448  // check validity of input parameters
1449  xCheckParameter();
1450 
1451  // set global varibles
1452  xSetGlobal();
1453 
1454  // print-out parameters
1455  xPrintParameter();
1456 
1457  return true;
1458 }
1459 
1460 
1461 // ====================================================================================================================
1462 // Private member functions
1463 // ====================================================================================================================
1464 
1466 {
1468  {
1469  fprintf(stderr, "******************************************************************\n");
1470  fprintf(stderr, "** WARNING: --SEIDecodedPictureHash is now disabled by default. **\n");
1471  fprintf(stderr, "** Automatic verification of decoded pictures by a **\n");
1472  fprintf(stderr, "** decoder requires this option to be enabled. **\n");
1473  fprintf(stderr, "******************************************************************\n");
1474  }
1475  if( m_profile==Profile::NONE )
1476  {
1477  fprintf(stderr, "***************************************************************************\n");
1478  fprintf(stderr, "** WARNING: For conforming bitstreams a valid Profile value must be set! **\n");
1479  fprintf(stderr, "***************************************************************************\n");
1480  }
1481  if( m_level==Level::NONE )
1482  {
1483  fprintf(stderr, "***************************************************************************\n");
1484  fprintf(stderr, "** WARNING: For conforming bitstreams a valid Level value must be set! **\n");
1485  fprintf(stderr, "***************************************************************************\n");
1486  }
1487 
1488  Bool check_failed = false; /* abort if there is a fatal configuration problem */
1489 #define xConfirmPara(a,b) check_failed |= confirmPara(a,b)
1490 
1492  xConfirmPara(m_bitDepthConstraint<maxBitDepth, "The internalBitDepth must not be greater than the bitDepthConstraint value");
1493  xConfirmPara(m_chromaFormatConstraint<m_chromaFormatIDC, "The chroma format used must not be greater than the chromaFormatConstraint value");
1494 
1496  {
1497  xConfirmPara(m_lowerBitRateConstraintFlag==false && m_intraConstraintFlag==false, "The lowerBitRateConstraint flag cannot be false when intraConstraintFlag is false");
1498  xConfirmPara(m_alignCABACBeforeBypass && m_profile!=Profile::HIGHTHROUGHPUTREXT, "AlignCABACBeforeBypass must not be enabled unless the high throughput profile is being used.");
1500  {
1501  const UInt intraIdx = m_intraConstraintFlag ? 1:0;
1502  const UInt bitDepthIdx = (m_bitDepthConstraint == 8 ? 0 : (m_bitDepthConstraint ==10 ? 1 : (m_bitDepthConstraint == 12 ? 2 : (m_bitDepthConstraint == 16 ? 3 : 4 ))));
1503  const UInt chromaFormatIdx = UInt(m_chromaFormatConstraint);
1504  const Bool bValidProfile = (bitDepthIdx > 3 || chromaFormatIdx>3) ? false : (validRExtProfileNames[intraIdx][bitDepthIdx][chromaFormatIdx] != NONE);
1505  xConfirmPara(!bValidProfile, "Invalid intra constraint flag, bit depth constraint flag and chroma format constraint flag combination for a RExt profile");
1506  const Bool bUsingGeneralRExtTools = m_useResidualRotation ||
1513  const Bool bUsingChromaQPTool = m_maxCUChromaQpAdjustmentDepth >= 0;
1514  const Bool bUsingExtendedPrecision = m_useExtendedPrecision;
1515 
1516  xConfirmPara((m_chromaFormatConstraint==CHROMA_420 || m_chromaFormatConstraint==CHROMA_400) && bUsingChromaQPTool, "CU Chroma QP adjustment cannot be used for 4:0:0 or 4:2:0 RExt profiles");
1517  xConfirmPara(m_bitDepthConstraint != 16 && bUsingExtendedPrecision, "Extended precision can only be used in 16-bit RExt profiles");
1519  {
1520  xConfirmPara(bUsingGeneralRExtTools, "Combination of tools and profiles are not possible in the specified RExt profile.");
1521  }
1523  {
1524  fprintf(stderr, "********************************************************************************************************\n");
1525  fprintf(stderr, "** WARNING: The RExt constraint flags describe a non standard combination (used for development only) **\n");
1526  fprintf(stderr, "********************************************************************************************************\n");
1527  }
1528  }
1529  else
1530  {
1531  xConfirmPara( m_chromaFormatConstraint != CHROMA_444, "chroma format constraint must be 4:4:4 in the High Throughput 4:4:4 16-bit Intra profile.");
1532  xConfirmPara( m_bitDepthConstraint != 16, "bit depth constraint must be 4:4:4 in the High Throughput 4:4:4 16-bit Intra profile.");
1533  xConfirmPara( m_intraConstraintFlag != 1, "intra constraint flag must be 1 in the High Throughput 4:4:4 16-bit Intra profile.");
1534  }
1535  }
1536  else
1537  {
1538  xConfirmPara(m_bitDepthConstraint!=((m_profile==Profile::MAIN10)?10:8), "BitDepthConstraint must be 8 for MAIN profile and 10 for MAIN10 profile.");
1539  xConfirmPara(m_chromaFormatConstraint!=CHROMA_420, "ChromaFormatConstraint must be 420 for non main-RExt profiles.");
1540  xConfirmPara(m_intraConstraintFlag==true, "IntraConstraintFlag must be false for non main_RExt profiles.");
1541  xConfirmPara(m_lowerBitRateConstraintFlag==false, "LowerBitrateConstraintFlag must be true for non main-RExt profiles.");
1542 
1543  xConfirmPara(m_useCrossComponentPrediction==true, "CrossComponentPrediction must not be used for non main-RExt profiles.");
1544  xConfirmPara(m_transformSkipLog2MaxSize!=2, "Transform Skip Log2 Max Size must be 2 for V1 profiles.");
1545  xConfirmPara(m_useResidualRotation==true, "UseResidualRotation must not be enabled for non main-RExt profiles.");
1546  xConfirmPara(m_useSingleSignificanceMapContext==true, "UseSingleSignificanceMapContext must not be enabled for non main-RExt profiles.");
1547  xConfirmPara(m_useResidualDPCM[RDPCM_SIGNAL_IMPLICIT]==true, "ImplicitResidualDPCM must not be enabled for non main-RExt profiles.");
1548  xConfirmPara(m_useResidualDPCM[RDPCM_SIGNAL_EXPLICIT]==true, "ExplicitResidualDPCM must not be enabled for non main-RExt profiles.");
1549  xConfirmPara(m_useGolombRiceParameterAdaptation==true, "GolombRiceParameterAdaption must not be enabled for non main-RExt profiles.");
1550  xConfirmPara(m_useExtendedPrecision==true, "UseExtendedPrecision must not be enabled for non main-RExt profiles.");
1551  xConfirmPara(m_useHighPrecisionPredictionWeighting==true, "UseHighPrecisionPredictionWeighting must not be enabled for non main-RExt profiles.");
1552  xConfirmPara(m_enableIntraReferenceSmoothing==false, "EnableIntraReferenceSmoothing must be enabled for non main-RExt profiles.");
1553  xConfirmPara(m_alignCABACBeforeBypass, "AlignCABACBeforeBypass cannot be enabled for non main-RExt profiles.");
1554  }
1555 
1556  // check range of parameters
1557  xConfirmPara( m_inputBitDepth[CHANNEL_TYPE_LUMA ] < 8, "InputBitDepth must be at least 8" );
1558  xConfirmPara( m_inputBitDepth[CHANNEL_TYPE_CHROMA] < 8, "InputBitDepthC must be at least 8" );
1559 
1560 #if !RExt__HIGH_BIT_DEPTH_SUPPORT
1562  {
1563  for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
1564  {
1565  xConfirmPara((m_internalBitDepth[channelType] > 8) , "Model is not configured to support high enough internal accuracies - enable RExt__HIGH_BIT_DEPTH_SUPPORT to use increased precision internal data types etc...");
1566  }
1567  }
1568  else
1569  {
1570  for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
1571  {
1572  xConfirmPara((m_internalBitDepth[channelType] > 12) , "Model is not configured to support high enough internal accuracies - enable RExt__HIGH_BIT_DEPTH_SUPPORT to use increased precision internal data types etc...");
1573  }
1574  }
1575 #endif
1576 
1577  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)" );
1578  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)" );
1579 
1580  xConfirmPara( m_saoOffsetBitShift[CHANNEL_TYPE_LUMA] > (m_internalBitDepth[CHANNEL_TYPE_LUMA ]<10?0:(m_internalBitDepth[CHANNEL_TYPE_LUMA ]-10)), "SaoLumaOffsetBitShift must be in the range of 0 to InternalBitDepth-10, inclusive");
1581  xConfirmPara( m_saoOffsetBitShift[CHANNEL_TYPE_CHROMA] > (m_internalBitDepth[CHANNEL_TYPE_CHROMA]<10?0:(m_internalBitDepth[CHANNEL_TYPE_CHROMA]-10)), "SaoChromaOffsetBitShift must be in the range of 0 to InternalBitDepthC-10, inclusive");
1582 
1583  xConfirmPara( m_chromaFormatIDC >= NUM_CHROMA_FORMAT, "ChromaFormatIDC must be either 400, 420, 422 or 444" );
1584  std::string sTempIPCSC="InputColourSpaceConvert must be empty, "+getListOfColourSpaceConverts(true);
1586  xConfirmPara( m_InputChromaFormatIDC >= NUM_CHROMA_FORMAT, "InputChromaFormatIDC must be either 400, 420, 422 or 444" );
1587  xConfirmPara( m_iFrameRate <= 0, "Frame rate must be more than 1" );
1588  xConfirmPara( m_framesToBeEncoded <= 0, "Total Number Of Frames encoded must be more than 0" );
1589  xConfirmPara( m_iGOPSize < 1 , "GOP Size must be greater or equal to 1" );
1590  xConfirmPara( m_iGOPSize > 1 && m_iGOPSize % 2, "GOP Size must be a multiple of 2, if GOP Size is greater than 1" );
1591  xConfirmPara( (m_iIntraPeriod > 0 && m_iIntraPeriod < m_iGOPSize) || m_iIntraPeriod == 0, "Intra period must be more than GOP size, or -1 , not 0" );
1592 #if ALLOW_RECOVERY_POINT_AS_RAP
1593  xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 3, "Decoding Refresh Type must be comprised between 0 and 3 included" );
1594  if(m_iDecodingRefreshType == 3)
1595  {
1596  xConfirmPara( !m_recoveryPointSEIEnabled, "When using RecoveryPointSEI messages as RA points, recoveryPointSEI must be enabled" );
1597  }
1598 #else
1599  xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 2, "Decoding Refresh Type must be equal to 0, 1 or 2" );
1600 #endif
1601 
1602  if (m_isField)
1603  {
1605  {
1606  fprintf(stderr, "****************************************************************************\n");
1607  fprintf(stderr, "** WARNING: Picture Timing SEI should be enabled for field coding! **\n");
1608  fprintf(stderr, "****************************************************************************\n");
1609  }
1610  }
1612  {
1613  fprintf(stderr, "****************************************************************************\n");
1614  fprintf(stderr, "** WARNING: using buffering period SEI requires SPS activation with **\n");
1615  fprintf(stderr, "** active parameter sets SEI. Enabling active parameter sets SEI **\n");
1616  fprintf(stderr, "****************************************************************************\n");
1618  }
1620  {
1621  fprintf(stderr, "****************************************************************************\n");
1622  fprintf(stderr, "** WARNING: using picture timing SEI requires SPS activation with active **\n");
1623  fprintf(stderr, "** parameter sets SEI. Enabling active parameter sets SEI. **\n");
1624  fprintf(stderr, "****************************************************************************\n");
1626  }
1627 
1629  {
1630  fprintf(stderr, "****************************************************************************\n");
1631  fprintf(stderr, "** WARNING: Cross-component prediction is specified for 4:4:4 format only **\n");
1632  fprintf(stderr, "****************************************************************************\n");
1633 
1635  }
1636 
1638  {
1639  fprintf(stderr, "****************************************************************************\n");
1640  fprintf(stderr, "** WARNING: --HadamardME has been disabled due to the enabling of **\n");
1641  fprintf(stderr, "** --CUTransquantBypassFlagForce **\n");
1642  fprintf(stderr, "****************************************************************************\n");
1643 
1644  m_bUseHADME = false; // this has been disabled so that the lambda is calculated slightly differently for lossless modes (as a result of JCTVC-R0104).
1645  }
1646 
1647  xConfirmPara (m_transformSkipLog2MaxSize < 2, "Transform Skip Log2 Max Size must be at least 2 (4x4)");
1648 
1650  {
1651  fprintf(stderr, "***************************************************************************\n");
1652  fprintf(stderr, "** WARNING: Transform skip fast is enabled (which only tests NxN splits),**\n");
1653  fprintf(stderr, "** but transform skip log2 max size is not 2 (4x4) **\n");
1654  fprintf(stderr, "** It may be better to disable transform skip fast mode **\n");
1655  fprintf(stderr, "***************************************************************************\n");
1656  }
1657 
1658  xConfirmPara( m_iQP < -6 * (m_internalBitDepth[CHANNEL_TYPE_LUMA] - 8) || m_iQP > 51, "QP exceeds supported range (-QpBDOffsety to 51)" );
1659  xConfirmPara( m_loopFilterBetaOffsetDiv2 < -6 || m_loopFilterBetaOffsetDiv2 > 6, "Loop Filter Beta Offset div. 2 exceeds supported range (-6 to 6)");
1660  xConfirmPara( m_loopFilterTcOffsetDiv2 < -6 || m_loopFilterTcOffsetDiv2 > 6, "Loop Filter Tc Offset div. 2 exceeds supported range (-6 to 6)");
1661  xConfirmPara( m_iFastSearch < 0 || m_iFastSearch > 2, "Fast Search Mode is not supported value (0:Full search 1:Diamond 2:PMVFAST)" );
1662  xConfirmPara( m_iSearchRange < 0 , "Search Range must be more than 0" );
1663  xConfirmPara( m_bipredSearchRange < 0 , "Search Range must be more than 0" );
1664  xConfirmPara( m_iMaxDeltaQP > 7, "Absolute Delta QP exceeds supported range (0 to 7)" );
1665  xConfirmPara( m_iMaxCuDQPDepth > m_uiMaxCUDepth - 1, "Absolute depth for a minimum CuDQP exceeds maximum coding unit depth" );
1666 
1667  xConfirmPara( m_cbQpOffset < -12, "Min. Chroma Cb QP Offset is -12" );
1668  xConfirmPara( m_cbQpOffset > 12, "Max. Chroma Cb QP Offset is 12" );
1669  xConfirmPara( m_crQpOffset < -12, "Min. Chroma Cr QP Offset is -12" );
1670  xConfirmPara( m_crQpOffset > 12, "Max. Chroma Cr QP Offset is 12" );
1671 
1672  xConfirmPara( m_iQPAdaptationRange <= 0, "QP Adaptation Range must be more than 0" );
1673  if (m_iDecodingRefreshType == 2)
1674  {
1675  xConfirmPara( m_iIntraPeriod > 0 && m_iIntraPeriod <= m_iGOPSize , "Intra period must be larger than GOP size for periodic IDR pictures");
1676  }
1677  xConfirmPara( (m_uiMaxCUWidth >> m_uiMaxCUDepth) < 4, "Minimum partition width size should be larger than or equal to 8");
1678  xConfirmPara( (m_uiMaxCUHeight >> m_uiMaxCUDepth) < 4, "Minimum partition height size should be larger than or equal to 8");
1679  xConfirmPara( m_uiMaxCUWidth < 16, "Maximum partition width size should be larger than or equal to 16");
1680  xConfirmPara( m_uiMaxCUHeight < 16, "Maximum partition height size should be larger than or equal to 16");
1681  xConfirmPara( (m_iSourceWidth % (m_uiMaxCUWidth >> (m_uiMaxCUDepth-1)))!=0, "Resulting coded frame width must be a multiple of the minimum CU size");
1682  xConfirmPara( (m_iSourceHeight % (m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)))!=0, "Resulting coded frame height must be a multiple of the minimum CU size");
1683 
1684  xConfirmPara( m_uiQuadtreeTULog2MinSize < 2, "QuadtreeTULog2MinSize must be 2 or greater.");
1685  xConfirmPara( m_uiQuadtreeTULog2MaxSize > 5, "QuadtreeTULog2MaxSize must be 5 or smaller.");
1686  xConfirmPara( m_uiQuadtreeTULog2MaxSize < m_uiQuadtreeTULog2MinSize, "QuadtreeTULog2MaxSize must be greater than or equal to m_uiQuadtreeTULog2MinSize.");
1687  xConfirmPara( (1<<m_uiQuadtreeTULog2MaxSize) > m_uiMaxCUWidth, "QuadtreeTULog2MaxSize must be log2(maxCUSize) or smaller.");
1688  xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) >= ( m_uiMaxCUWidth >> (m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than or equal to minimum CU size" );
1689  xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) >= ( m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than or equal to minimum CU size" );
1690  xConfirmPara( m_uiQuadtreeTUMaxDepthInter < 1, "QuadtreeTUMaxDepthInter must be greater than or equal to 1" );
1691  xConfirmPara( m_uiMaxCUWidth < ( 1 << (m_uiQuadtreeTULog2MinSize + m_uiQuadtreeTUMaxDepthInter - 1) ), "QuadtreeTUMaxDepthInter must be less than or equal to the difference between log2(maxCUSize) and QuadtreeTULog2MinSize plus 1" );
1692  xConfirmPara( m_uiQuadtreeTUMaxDepthIntra < 1, "QuadtreeTUMaxDepthIntra must be greater than or equal to 1" );
1693  xConfirmPara( m_uiMaxCUWidth < ( 1 << (m_uiQuadtreeTULog2MinSize + m_uiQuadtreeTUMaxDepthIntra - 1) ), "QuadtreeTUMaxDepthInter must be less than or equal to the difference between log2(maxCUSize) and QuadtreeTULog2MinSize plus 1" );
1694 
1695  xConfirmPara( m_maxNumMergeCand < 1, "MaxNumMergeCand must be 1 or greater.");
1696  xConfirmPara( m_maxNumMergeCand > 5, "MaxNumMergeCand must be 5 or smaller.");
1697 
1698 #if ADAPTIVE_QP_SELECTION
1699  xConfirmPara( m_bUseAdaptQpSelect == true && m_iQP < 0, "AdaptiveQpSelection must be disabled when QP < 0.");
1700  xConfirmPara( m_bUseAdaptQpSelect == true && (m_cbQpOffset !=0 || m_crQpOffset != 0 ), "AdaptiveQpSelection must be disabled when ChromaQpOffset is not equal to 0.");
1701 #endif
1702 
1703  if( m_usePCM)
1704  {
1705  for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
1706  {
1707  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)");
1708  }
1709  xConfirmPara( m_uiPCMLog2MinSize < 3, "PCMLog2MinSize must be 3 or greater.");
1710  xConfirmPara( m_uiPCMLog2MinSize > 5, "PCMLog2MinSize must be 5 or smaller.");
1711  xConfirmPara( m_pcmLog2MaxSize > 5, "PCMLog2MaxSize must be 5 or smaller.");
1712  xConfirmPara( m_pcmLog2MaxSize < m_uiPCMLog2MinSize, "PCMLog2MaxSize must be equal to or greater than m_uiPCMLog2MinSize.");
1713  }
1714 
1715  xConfirmPara( m_sliceMode < 0 || m_sliceMode > 3, "SliceMode exceeds supported range (0 to 3)" );
1716  if (m_sliceMode!=0)
1717  {
1718  xConfirmPara( m_sliceArgument < 1 , "SliceArgument should be larger than or equal to 1" );
1719  }
1720  xConfirmPara( m_sliceSegmentMode < 0 || m_sliceSegmentMode > 3, "SliceSegmentMode exceeds supported range (0 to 3)" );
1721  if (m_sliceSegmentMode!=0)
1722  {
1723  xConfirmPara( m_sliceSegmentArgument < 1 , "SliceSegmentArgument should be larger than or equal to 1" );
1724  }
1725 
1726  Bool tileFlag = (m_numTileColumnsMinus1 > 0 || m_numTileRowsMinus1 > 0 );
1728  {
1729  xConfirmPara( tileFlag && m_iWaveFrontSynchro, "Tile and Wavefront can not be applied together, except in the High Throughput Intra 4:4:4 16 profile");
1730  }
1731 
1732  xConfirmPara( m_iSourceWidth % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Picture width must be an integer multiple of the specified chroma subsampling");
1733  xConfirmPara( m_iSourceHeight % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Picture height must be an integer multiple of the specified chroma subsampling");
1734 
1735  xConfirmPara( m_aiPad[0] % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Horizontal padding must be an integer multiple of the specified chroma subsampling");
1736  xConfirmPara( m_aiPad[1] % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Vertical padding must be an integer multiple of the specified chroma subsampling");
1737 
1738  xConfirmPara( m_confWinLeft % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Left conformance window offset must be an integer multiple of the specified chroma subsampling");
1739  xConfirmPara( m_confWinRight % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Right conformance window offset must be an integer multiple of the specified chroma subsampling");
1740  xConfirmPara( m_confWinTop % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling");
1741  xConfirmPara( m_confWinBottom % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling");
1742 
1743  xConfirmPara( m_defaultDisplayWindowFlag && !m_vuiParametersPresentFlag, "VUI needs to be enabled for default display window");
1744 
1746  {
1747  xConfirmPara( m_defDispWinLeftOffset % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Left default display window offset must be an integer multiple of the specified chroma subsampling");
1748  xConfirmPara( m_defDispWinRightOffset % TComSPS::getWinUnitX(m_chromaFormatIDC) != 0, "Right default display window offset must be an integer multiple of the specified chroma subsampling");
1749  xConfirmPara( m_defDispWinTopOffset % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Top default display window offset must be an integer multiple of the specified chroma subsampling");
1750  xConfirmPara( m_defDispWinBottomOffset % TComSPS::getWinUnitY(m_chromaFormatIDC) != 0, "Bottom default display window offset must be an integer multiple of the specified chroma subsampling");
1751  }
1752 
1753  // max CU width and height should be power of 2
1754  UInt ui = m_uiMaxCUWidth;
1755  while(ui)
1756  {
1757  ui >>= 1;
1758  if( (ui & 1) == 1)
1759  {
1760  xConfirmPara( ui != 1 , "Width should be 2^n");
1761  }
1762  }
1763  ui = m_uiMaxCUHeight;
1764  while(ui)
1765  {
1766  ui >>= 1;
1767  if( (ui & 1) == 1)
1768  {
1769  xConfirmPara( ui != 1 , "Height should be 2^n");
1770  }
1771  }
1772 
1773  /* if this is an intra-only sequence, ie IntraPeriod=1, don't verify the GOP structure
1774  * This permits the ability to omit a GOP structure specification */
1775  if (m_iIntraPeriod == 1 && m_GOPList[0].m_POC == -1)
1776  {
1777  m_GOPList[0] = GOPEntry();
1778  m_GOPList[0].m_QPFactor = 1;
1779  m_GOPList[0].m_betaOffsetDiv2 = 0;
1780  m_GOPList[0].m_tcOffsetDiv2 = 0;
1781  m_GOPList[0].m_POC = 1;
1783  }
1784  else
1785  {
1786  xConfirmPara( m_intraConstraintFlag, "IntraConstraintFlag cannot be 1 for inter sequences");
1787  }
1788 
1789  Bool verifiedGOP=false;
1790  Bool errorGOP=false;
1791  Int checkGOP=1;
1792  Int numRefs = m_isField ? 2 : 1;
1793  Int refList[MAX_NUM_REF_PICS+1];
1794  refList[0]=0;
1795  if(m_isField)
1796  {
1797  refList[1] = 1;
1798  }
1799  Bool isOK[MAX_GOP];
1800  for(Int i=0; i<MAX_GOP; i++)
1801  {
1802  isOK[i]=false;
1803  }
1804  Int numOK=0;
1805  xConfirmPara( m_iIntraPeriod >=0&&(m_iIntraPeriod%m_iGOPSize!=0), "Intra period must be a multiple of GOPSize, or -1" );
1806 
1807  for(Int i=0; i<m_iGOPSize; i++)
1808  {
1809  if(m_GOPList[i].m_POC==m_iGOPSize)
1810  {
1811  xConfirmPara( m_GOPList[i].m_temporalId!=0 , "The last frame in each GOP must have temporal ID = 0 " );
1812  }
1813  }
1814 
1816  {
1817  for(Int i=0; i<m_iGOPSize; i++)
1818  {
1819  xConfirmPara( (m_GOPList[i].m_betaOffsetDiv2 + m_loopFilterBetaOffsetDiv2) < -6 || (m_GOPList[i].m_betaOffsetDiv2 + m_loopFilterBetaOffsetDiv2) > 6, "Loop Filter Beta Offset div. 2 for one of the GOP entries exceeds supported range (-6 to 6)" );
1820  xConfirmPara( (m_GOPList[i].m_tcOffsetDiv2 + m_loopFilterTcOffsetDiv2) < -6 || (m_GOPList[i].m_tcOffsetDiv2 + m_loopFilterTcOffsetDiv2) > 6, "Loop Filter Tc Offset div. 2 for one of the GOP entries exceeds supported range (-6 to 6)" );
1821  }
1822  }
1823 
1824  m_extraRPSs=0;
1825  //start looping through frames in coding order until we can verify that the GOP structure is correct.
1826  while(!verifiedGOP&&!errorGOP)
1827  {
1828  Int curGOP = (checkGOP-1)%m_iGOPSize;
1829  Int curPOC = ((checkGOP-1)/m_iGOPSize)*m_iGOPSize + m_GOPList[curGOP].m_POC;
1830  if(m_GOPList[curGOP].m_POC<0)
1831  {
1832  printf("\nError: found fewer Reference Picture Sets than GOPSize\n");
1833  errorGOP=true;
1834  }
1835  else
1836  {
1837  //check that all reference pictures are available, or have a POC < 0 meaning they might be available in the next GOP.
1838  Bool beforeI = false;
1839  for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++)
1840  {
1841  Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i];
1842  if(absPOC < 0)
1843  {
1844  beforeI=true;
1845  }
1846  else
1847  {
1848  Bool found=false;
1849  for(Int j=0; j<numRefs; j++)
1850  {
1851  if(refList[j]==absPOC)
1852  {
1853  found=true;
1854  for(Int k=0; k<m_iGOPSize; k++)
1855  {
1856  if(absPOC%m_iGOPSize == m_GOPList[k].m_POC%m_iGOPSize)
1857  {
1858  if(m_GOPList[k].m_temporalId==m_GOPList[curGOP].m_temporalId)
1859  {
1860  m_GOPList[k].m_refPic = true;
1861  }
1863  }
1864  }
1865  }
1866  }
1867  if(!found)
1868  {
1869  printf("\nError: ref pic %d is not available for GOP frame %d\n",m_GOPList[curGOP].m_referencePics[i],curGOP+1);
1870  errorGOP=true;
1871  }
1872  }
1873  }
1874  if(!beforeI&&!errorGOP)
1875  {
1876  //all ref frames were present
1877  if(!isOK[curGOP])
1878  {
1879  numOK++;
1880  isOK[curGOP]=true;
1881  if(numOK==m_iGOPSize)
1882  {
1883  verifiedGOP=true;
1884  }
1885  }
1886  }
1887  else
1888  {
1889  //create a new GOPEntry for this frame containing all the reference pictures that were available (POC > 0)
1890  m_GOPList[m_iGOPSize+m_extraRPSs]=m_GOPList[curGOP];
1891  Int newRefs=0;
1892  for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++)
1893  {
1894  Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i];
1895  if(absPOC>=0)
1896  {
1897  m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[newRefs]=m_GOPList[curGOP].m_referencePics[i];
1898  m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[newRefs]=m_GOPList[curGOP].m_usedByCurrPic[i];
1899  newRefs++;
1900  }
1901  }
1902  Int numPrefRefs = m_GOPList[curGOP].m_numRefPicsActive;
1903 
1904  for(Int offset = -1; offset>-checkGOP; offset--)
1905  {
1906  //step backwards in coding order and include any extra available pictures we might find useful to replace the ones with POC < 0.
1907  Int offGOP = (checkGOP-1+offset)%m_iGOPSize;
1908  Int offPOC = ((checkGOP-1+offset)/m_iGOPSize)*m_iGOPSize + m_GOPList[offGOP].m_POC;
1909  if(offPOC>=0&&m_GOPList[offGOP].m_temporalId<=m_GOPList[curGOP].m_temporalId)
1910  {
1911  Bool newRef=false;
1912  for(Int i=0; i<numRefs; i++)
1913  {
1914  if(refList[i]==offPOC)
1915  {
1916  newRef=true;
1917  }
1918  }
1919  for(Int i=0; i<newRefs; i++)
1920  {
1921  if(m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[i]==offPOC-curPOC)
1922  {
1923  newRef=false;
1924  }
1925  }
1926  if(newRef)
1927  {
1928  Int insertPoint=newRefs;
1929  //this picture can be added, find appropriate place in list and insert it.
1930  if(m_GOPList[offGOP].m_temporalId==m_GOPList[curGOP].m_temporalId)
1931  {
1932  m_GOPList[offGOP].m_refPic = true;
1933  }
1934  for(Int j=0; j<newRefs; j++)
1935  {
1936  if(m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]<offPOC-curPOC||m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]>0)
1937  {
1938  insertPoint = j;
1939  break;
1940  }
1941  }
1942  Int prev = offPOC-curPOC;
1943  Int prevUsed = m_GOPList[offGOP].m_temporalId<=m_GOPList[curGOP].m_temporalId;
1944  for(Int j=insertPoint; j<newRefs+1; j++)
1945  {
1946  Int newPrev = m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j];
1947  Int newUsed = m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j];
1948  m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]=prev;
1949  m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j]=prevUsed;
1950  prevUsed=newUsed;
1951  prev=newPrev;
1952  }
1953  newRefs++;
1954  }
1955  }
1956  if(newRefs>=numPrefRefs)
1957  {
1958  break;
1959  }
1960  }
1961  m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefPics=newRefs;
1962  m_GOPList[m_iGOPSize+m_extraRPSs].m_POC = curPOC;
1963  if (m_extraRPSs == 0)
1964  {
1965  m_GOPList[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 0;
1966  m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefIdc = 0;
1967  }
1968  else
1969  {
1970  Int rIdx = m_iGOPSize + m_extraRPSs - 1;
1971  Int refPOC = m_GOPList[rIdx].m_POC;
1972  Int refPics = m_GOPList[rIdx].m_numRefPics;
1973  Int newIdc=0;
1974  for(Int i = 0; i<= refPics; i++)
1975  {
1976  Int deltaPOC = ((i != refPics)? m_GOPList[rIdx].m_referencePics[i] : 0); // check if the reference abs POC is >= 0
1977  Int absPOCref = refPOC+deltaPOC;
1978  Int refIdc = 0;
1979  for (Int j = 0; j < m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefPics; j++)
1980  {
1981  if ( (absPOCref - curPOC) == m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j])
1982  {
1983  if (m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j])
1984  {
1985  refIdc = 1;
1986  }
1987  else
1988  {
1989  refIdc = 2;
1990  }
1991  }
1992  }
1993  m_GOPList[m_iGOPSize+m_extraRPSs].m_refIdc[newIdc]=refIdc;
1994  newIdc++;
1995  }
1996  m_GOPList[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 1;
1997  m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefIdc = newIdc;
1998  m_GOPList[m_iGOPSize+m_extraRPSs].m_deltaRPS = refPOC - m_GOPList[m_iGOPSize+m_extraRPSs].m_POC;
1999  }
2000  curGOP=m_iGOPSize+m_extraRPSs;
2001  m_extraRPSs++;
2002  }
2003  numRefs=0;
2004  for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++)
2005  {
2006  Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i];
2007  if(absPOC >= 0)
2008  {
2009  refList[numRefs]=absPOC;
2010  numRefs++;
2011  }
2012  }
2013  refList[numRefs]=curPOC;
2014  numRefs++;
2015  }
2016  checkGOP++;
2017  }
2018  xConfirmPara(errorGOP,"Invalid GOP structure given");
2019  m_maxTempLayer = 1;
2020  for(Int i=0; i<m_iGOPSize; i++)
2021  {
2022  if(m_GOPList[i].m_temporalId >= m_maxTempLayer)
2023  {
2025  }
2026  xConfirmPara(m_GOPList[i].m_sliceType!='B' && m_GOPList[i].m_sliceType!='P' && m_GOPList[i].m_sliceType!='I', "Slice type must be equal to B or P or I");
2027  }
2028  for(Int i=0; i<MAX_TLAYER; i++)
2029  {
2030  m_numReorderPics[i] = 0;
2031  m_maxDecPicBuffering[i] = 1;
2032  }
2033  for(Int i=0; i<m_iGOPSize; i++)
2034  {
2035  if(m_GOPList[i].m_numRefPics+1 > m_maxDecPicBuffering[m_GOPList[i].m_temporalId])
2036  {
2037  m_maxDecPicBuffering[m_GOPList[i].m_temporalId] = m_GOPList[i].m_numRefPics + 1;
2038  }
2039  Int highestDecodingNumberWithLowerPOC = 0;
2040  for(Int j=0; j<m_iGOPSize; j++)
2041  {
2042  if(m_GOPList[j].m_POC <= m_GOPList[i].m_POC)
2043  {
2044  highestDecodingNumberWithLowerPOC = j;
2045  }
2046  }
2047  Int numReorder = 0;
2048  for(Int j=0; j<highestDecodingNumberWithLowerPOC; j++)
2049  {
2050  if(m_GOPList[j].m_temporalId <= m_GOPList[i].m_temporalId &&
2051  m_GOPList[j].m_POC > m_GOPList[i].m_POC)
2052  {
2053  numReorder++;
2054  }
2055  }
2056  if(numReorder > m_numReorderPics[m_GOPList[i].m_temporalId])
2057  {
2058  m_numReorderPics[m_GOPList[i].m_temporalId] = numReorder;
2059  }
2060  }
2061  for(Int i=0; i<MAX_TLAYER-1; i++)
2062  {
2063  // a lower layer can not have higher value of m_numReorderPics than a higher layer
2064  if(m_numReorderPics[i+1] < m_numReorderPics[i])
2065  {
2067  }
2068  // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ] - 1, inclusive
2069  if(m_numReorderPics[i] > m_maxDecPicBuffering[i] - 1)
2070  {
2072  }
2073  // a lower layer can not have higher value of m_uiMaxDecPicBuffering than a higher layer
2075  {
2077  }
2078  }
2079 
2080  // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ] - 1, inclusive
2081  if(m_numReorderPics[MAX_TLAYER-1] > m_maxDecPicBuffering[MAX_TLAYER-1] - 1)
2082  {
2083  m_maxDecPicBuffering[MAX_TLAYER-1] = m_numReorderPics[MAX_TLAYER-1] + 1;
2084  }
2085 
2087  {
2088  Int PicSizeInSamplesY = m_iSourceWidth * m_iSourceHeight;
2089  if(tileFlag)
2090  {
2091  Int maxTileWidth = 0;
2092  Int maxTileHeight = 0;
2094  Int heightInCU = (m_iSourceHeight % m_uiMaxCUHeight) ? m_iSourceHeight/m_uiMaxCUHeight + 1: m_iSourceHeight/m_uiMaxCUHeight;
2096  {
2097  maxTileWidth = m_uiMaxCUWidth*((widthInCU+m_numTileColumnsMinus1)/(m_numTileColumnsMinus1+1));
2098  maxTileHeight = m_uiMaxCUHeight*((heightInCU+m_numTileRowsMinus1)/(m_numTileRowsMinus1+1));
2099  // if only the last tile-row is one treeblock higher than the others
2100  // the maxTileHeight becomes smaller if the last row of treeblocks has lower height than the others
2101  if(!((heightInCU-1)%(m_numTileRowsMinus1+1)))
2102  {
2103  maxTileHeight = maxTileHeight - m_uiMaxCUHeight + (m_iSourceHeight % m_uiMaxCUHeight);
2104  }
2105  // if only the last tile-column is one treeblock wider than the others
2106  // the maxTileWidth becomes smaller if the last column of treeblocks has lower width than the others
2107  if(!((widthInCU-1)%(m_numTileColumnsMinus1+1)))
2108  {
2109  maxTileWidth = maxTileWidth - m_uiMaxCUWidth + (m_iSourceWidth % m_uiMaxCUWidth);
2110  }
2111  }
2112  else // not uniform spacing
2113  {
2115  {
2116  maxTileWidth = m_iSourceWidth;
2117  }
2118  else
2119  {
2120  Int accColumnWidth = 0;
2121  for(Int col=0; col<(m_numTileColumnsMinus1); col++)
2122  {
2123  maxTileWidth = m_tileColumnWidth[col]>maxTileWidth ? m_tileColumnWidth[col]:maxTileWidth;
2124  accColumnWidth += m_tileColumnWidth[col];
2125  }
2126  maxTileWidth = (widthInCU-accColumnWidth)>maxTileWidth ? m_uiMaxCUWidth*(widthInCU-accColumnWidth):m_uiMaxCUWidth*maxTileWidth;
2127  }
2128  if(m_numTileRowsMinus1<1)
2129  {
2130  maxTileHeight = m_iSourceHeight;
2131  }
2132  else
2133  {
2134  Int accRowHeight = 0;
2135  for(Int row=0; row<(m_numTileRowsMinus1); row++)
2136  {
2137  maxTileHeight = m_tileRowHeight[row]>maxTileHeight ? m_tileRowHeight[row]:maxTileHeight;
2138  accRowHeight += m_tileRowHeight[row];
2139  }
2140  maxTileHeight = (heightInCU-accRowHeight)>maxTileHeight ? m_uiMaxCUHeight*(heightInCU-accRowHeight):m_uiMaxCUHeight*maxTileHeight;
2141  }
2142  }
2143  Int maxSizeInSamplesY = maxTileWidth*maxTileHeight;
2144  m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/maxSizeInSamplesY-4;
2145  }
2146  else if(m_iWaveFrontSynchro)
2147  {
2148  m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/((2*m_iSourceHeight+m_iSourceWidth)*m_uiMaxCUHeight)-4;
2149  }
2150  else if(m_sliceMode == FIXED_NUMBER_OF_CTU)
2151  {
2153  }
2154  else
2155  {
2157  }
2158  }
2159 
2160  xConfirmPara( m_iWaveFrontSynchro < 0, "WaveFrontSynchro cannot be negative" );
2161 
2162  xConfirmPara( m_decodedPictureHashSEIEnabled<0 || m_decodedPictureHashSEIEnabled>3, "this hash type is not correct!\n");
2163 
2165  {
2166  xConfirmPara( m_toneMapCodedDataBitDepth < 8 || m_toneMapCodedDataBitDepth > 14 , "SEIToneMapCodedDataBitDepth must be in rage 8 to 14");
2167  xConfirmPara( m_toneMapTargetBitDepth < 1 || (m_toneMapTargetBitDepth > 16 && m_toneMapTargetBitDepth < 255) , "SEIToneMapTargetBitDepth must be in rage 1 to 16 or equal to 255");
2168  xConfirmPara( m_toneMapModelId < 0 || m_toneMapModelId > 4 , "SEIToneMapModelId must be in rage 0 to 4");
2169  xConfirmPara( m_cameraIsoSpeedValue == 0, "SEIToneMapCameraIsoSpeedValue shall not be equal to 0");
2170  xConfirmPara( m_exposureIndexValue == 0, "SEIToneMapExposureIndexValue shall not be equal to 0");
2171  xConfirmPara( m_extendedRangeWhiteLevel < 100, "SEIToneMapExtendedRangeWhiteLevel should be greater than or equal to 100");
2172  xConfirmPara( m_nominalBlackLevelLumaCodeValue >= m_nominalWhiteLevelLumaCodeValue, "SEIToneMapNominalWhiteLevelLumaCodeValue shall be greater than SEIToneMapNominalBlackLevelLumaCodeValue");
2173  xConfirmPara( m_extendedWhiteLevelLumaCodeValue < m_nominalWhiteLevelLumaCodeValue, "SEIToneMapExtendedWhiteLevelLumaCodeValue shall be greater than or equal to SEIToneMapNominalWhiteLevelLumaCodeValue");
2174  }
2175 
2177  {
2178  xConfirmPara( m_kneeSEINumKneePointsMinus1 < 0 || m_kneeSEINumKneePointsMinus1 > 998, "SEIKneeFunctionNumKneePointsMinus1 must be in the range of 0 to 998");
2179  for ( UInt i=0; i<=m_kneeSEINumKneePointsMinus1; i++ )
2180  {
2181  xConfirmPara( m_kneeSEIInputKneePoint[i] < 1 || m_kneeSEIInputKneePoint[i] > 999, "SEIKneeFunctionInputKneePointValue must be in the range of 1 to 999");
2182  xConfirmPara( m_kneeSEIOutputKneePoint[i] < 0 || m_kneeSEIOutputKneePoint[i] > 1000, "SEIKneeFunctionInputKneePointValue must be in the range of 0 to 1000");
2183  if ( i > 0 )
2184  {
2185  xConfirmPara( m_kneeSEIInputKneePoint[i-1] >= m_kneeSEIInputKneePoint[i], "The i-th SEIKneeFunctionInputKneePointValue must be greater than the (i-1)-th value");
2186  xConfirmPara( m_kneeSEIOutputKneePoint[i-1] > m_kneeSEIOutputKneePoint[i], "The i-th SEIKneeFunctionOutputKneePointValue must be greater than or equal to the (i-1)-th value");
2187  }
2188  }
2189  }
2190 
2191  if ( m_RCEnableRateControl )
2192  {
2193  if ( m_RCForceIntraQP )
2194  {
2195  if ( m_RCInitialQP == 0 )
2196  {
2197  printf( "\nInitial QP for rate control is not specified. Reset not to use force intra QP!" );
2198  m_RCForceIntraQP = false;
2199  }
2200  }
2201  xConfirmPara( m_uiDeltaQpRD > 0, "Rate control cannot be used together with slice level multiple-QP optimization!\n" );
2202  }
2203 
2204  xConfirmPara(!m_TransquantBypassEnableFlag && m_CUTransquantBypassFlagForce, "CUTransquantBypassFlagForce cannot be 1 when TransquantBypassEnableFlag is 0");
2205 
2206  xConfirmPara(m_log2ParallelMergeLevel < 2, "Log2ParallelMergeLevel should be larger than or equal to 2");
2207 
2209  {
2210  xConfirmPara(m_framePackingSEIType < 3 || m_framePackingSEIType > 5 , "SEIFramePackingType must be in rage 3 to 5");
2211  }
2212 
2214  {
2215  xConfirmPara(m_framePackingSEIEnabled > 0 , "SEISegmentedRectFramePacking must be 0 when SEIFramePacking is 1");
2216  }
2217 
2219  {
2220  printf("SEITempMotionConstrainedTileSets is set to false to disable 'temporal_motion_constrained_tile_sets' SEI because there are no tiles enabled\n");
2221  m_tmctsSEIEnabled = false;
2222  }
2223 
2225  {
2226  xConfirmPara(m_timeCodeSEINumTs > MAX_TIMECODE_SEI_SETS, "Number of time sets cannot exceed 3");
2227  }
2228 
2229 #undef xConfirmPara
2230  if (check_failed)
2231  {
2232  exit(EXIT_FAILURE);
2233  }
2234 }
2235 
2239 {
2240  // set max CU width & height
2243 
2244  // compute actual CU depth with respect to config depth and max transform size
2245  g_uiAddCUDepth = 0;
2247  {
2248  g_uiAddCUDepth++;
2249  }
2250 
2251  g_uiAddCUDepth+=getMaxCUDepthOffset(m_chromaFormatIDC, m_uiQuadtreeTULog2MinSize); // if minimum TU larger than 4x4, allow for additional part indices for 4:2:2 SubTUs.
2252 
2254  g_uiAddCUDepth++;
2256 
2257  // set internal bit-depth and constants
2258  for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
2259  {
2260 #if O0043_BEST_EFFORT_DECODING
2261  g_bitDepthInStream[channelType] = g_bitDepth[channelType] = m_internalBitDepth[channelType];
2262 #else
2263  g_bitDepth [channelType] = m_internalBitDepth[channelType];
2264 #endif
2265  g_PCMBitDepth[channelType] = m_bPCMInputBitDepthFlag ? m_MSBExtendedBitDepth[channelType] : m_internalBitDepth[channelType];
2266  g_maxTrDynamicRange[channelType] = m_useExtendedPrecision? std::max<Int>(15, (g_bitDepth[channelType] + 6)) : 15;
2267  }
2268 }
2269 
2270 const Char *profileToString(const Profile::Name profile)
2271 {
2272  static const UInt numberOfProfiles = sizeof(strToProfile)/sizeof(*strToProfile);
2273 
2274  for (UInt profileIndex = 0; profileIndex < numberOfProfiles; profileIndex++)
2275  {
2276  if (strToProfile[profileIndex].value == profile)
2277  {
2278  return strToProfile[profileIndex].str;
2279  }
2280  }
2281 
2282  //if we get here, we didn't find this profile in the list - so there is an error
2283  std::cerr << "ERROR: Unknown profile \"" << profile << "\" in profileToString" << std::endl;
2284  assert(false);
2285  exit(1);
2286  return "";
2287 }
2288 
2290 {
2291  printf("\n");
2292  printf("Input File : %s\n", m_pchInputFile );
2293  printf("Bitstream File : %s\n", m_pchBitstreamFile );
2294  printf("Reconstruction File : %s\n", m_pchReconFile );
2295  printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_confWinLeft - m_confWinRight, m_iSourceHeight - m_confWinTop - m_confWinBottom, m_iFrameRate );
2296  printf("Internal Format : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate );
2297  printf("Sequence PSNR output : %s\n", (m_printMSEBasedSequencePSNR ? "Linear average, MSE-based" : "Linear average only") );
2298  printf("Sequence MSE output : %s\n", (m_printSequenceMSE ? "Enabled" : "Disabled") );
2299  printf("Frame MSE output : %s\n", (m_printFrameMSE ? "Enabled" : "Disabled") );
2300  printf("Cabac-zero-word-padding : %s\n", (m_cabacZeroWordPaddingEnabled? "Enabled" : "Disabled") );
2301  if (m_isField)
2302  {
2303  printf("Frame/Field : Field based coding\n");
2304  printf("Field index : %u - %d (%d fields)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
2305  printf("Field Order : %s field first\n", m_isTopFieldFirst?"Top":"Bottom");
2306 
2307  }
2308  else
2309  {
2310  printf("Frame/Field : Frame based coding\n");
2311  printf("Frame index : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
2312  }
2314  {
2315  const UInt intraIdx = m_intraConstraintFlag ? 1:0;
2316  const UInt bitDepthIdx = (m_bitDepthConstraint == 8 ? 0 : (m_bitDepthConstraint ==10 ? 1 : (m_bitDepthConstraint == 12 ? 2 : (m_bitDepthConstraint == 16 ? 3 : 4 ))));
2317  const UInt chromaFormatIdx = UInt(m_chromaFormatConstraint);
2318  const ExtendedProfileName validProfileName = (bitDepthIdx > 3 || chromaFormatIdx>3) ? NONE : validRExtProfileNames[intraIdx][bitDepthIdx][chromaFormatIdx];
2319  std::string rextSubProfile;
2320  if (validProfileName!=NONE)
2321  {
2322  rextSubProfile=enumToString(strToExtendedProfile, sizeof(strToExtendedProfile)/sizeof(*strToExtendedProfile), validProfileName);
2323  }
2324  if (rextSubProfile == "main_444_16")
2325  {
2326  rextSubProfile="main_444_16 [NON STANDARD]";
2327  }
2328  printf("Profile : %s (%s)\n", profileToString(m_profile), (rextSubProfile.empty())?"INVALID REXT PROFILE":rextSubProfile.c_str() );
2329  }
2330  else
2331  {
2332  printf("Profile : %s\n", profileToString(m_profile) );
2333  }
2334  printf("CU size / depth : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth );
2335  printf("RQT trans. size (min / max) : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize );
2336  printf("Max RQT depth inter : %d\n", m_uiQuadtreeTUMaxDepthInter);
2337  printf("Max RQT depth intra : %d\n", m_uiQuadtreeTUMaxDepthIntra);
2338  printf("Min PCM size : %d\n", 1 << m_uiPCMLog2MinSize);
2339  printf("Motion search range : %d\n", m_iSearchRange );
2340  printf("Intra period : %d\n", m_iIntraPeriod );
2341  printf("Decoding refresh type : %d\n", m_iDecodingRefreshType );
2342  printf("QP : %5.2f\n", m_fQP );
2343  printf("Max dQP signaling depth : %d\n", m_iMaxCuDQPDepth);
2344 
2345  printf("Cb QP Offset : %d\n", m_cbQpOffset );
2346  printf("Cr QP Offset : %d\n", m_crQpOffset);
2347  printf("Max CU chroma QP adjustment depth : %d\n", m_maxCUChromaQpAdjustmentDepth);
2348  printf("QP adaptation : %d (range=%d)\n", m_bUseAdaptiveQP, (m_bUseAdaptiveQP ? m_iQPAdaptationRange : 0) );
2349  printf("GOP size : %d\n", m_iGOPSize );
2350  printf("Input bit depth : (Y:%d, C:%d)\n", m_inputBitDepth[CHANNEL_TYPE_LUMA], m_inputBitDepth[CHANNEL_TYPE_CHROMA] );
2351  printf("MSB-extended bit depth : (Y:%d, C:%d)\n", m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA], m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA] );
2352  printf("Internal bit depth : (Y:%d, C:%d)\n", m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA] );
2353  printf("PCM sample bit depth : (Y:%d, C:%d)\n", g_PCMBitDepth[CHANNEL_TYPE_LUMA], g_PCMBitDepth[CHANNEL_TYPE_CHROMA] );
2354  printf("Extended precision processing : %s\n", (m_useExtendedPrecision ? "Enabled" : "Disabled") );
2355  printf("Intra reference smoothing : %s\n", (m_enableIntraReferenceSmoothing ? "Enabled" : "Disabled") );
2356  printf("Implicit residual DPCM : %s\n", (m_useResidualDPCM[RDPCM_SIGNAL_IMPLICIT] ? "Enabled" : "Disabled") );
2357  printf("Explicit residual DPCM : %s\n", (m_useResidualDPCM[RDPCM_SIGNAL_EXPLICIT] ? "Enabled" : "Disabled") );
2358  printf("Residual rotation : %s\n", (m_useResidualRotation ? "Enabled" : "Disabled") );
2359  printf("Single significance map context : %s\n", (m_useSingleSignificanceMapContext ? "Enabled" : "Disabled") );
2360  printf("Cross-component prediction : %s\n", (m_useCrossComponentPrediction ? (m_reconBasedCrossCPredictionEstimate ? "Enabled (reconstructed-residual-based estimate)" : "Enabled (encoder-side-residual-based estimate)") : "Disabled") );
2361  printf("High-precision prediction weight : %s\n", (m_useHighPrecisionPredictionWeighting ? "Enabled" : "Disabled") );
2362  printf("Golomb-Rice parameter adaptation : %s\n", (m_useGolombRiceParameterAdaptation ? "Enabled" : "Disabled") );
2363  printf("CABAC bypass bit alignment : %s\n", (m_alignCABACBeforeBypass ? "Enabled" : "Disabled") );
2364  if (m_bUseSAO)
2365  {
2366  printf("Sao Luma Offset bit shifts : %d\n", m_saoOffsetBitShift[CHANNEL_TYPE_LUMA]);
2367  printf("Sao Chroma Offset bit shifts : %d\n", m_saoOffsetBitShift[CHANNEL_TYPE_CHROMA]);
2368  }
2369 
2370  switch (m_costMode)
2371  {
2372  case COST_STANDARD_LOSSY: printf("Cost function: : Lossy coding (default)\n"); break;
2373  case COST_SEQUENCE_LEVEL_LOSSLESS: printf("Cost function: : Sequence_level_lossless coding\n"); break;
2374  case COST_LOSSLESS_CODING: printf("Cost function: : Lossless coding with fixed QP of %d\n", LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP); break;
2375  case COST_MIXED_LOSSLESS_LOSSY_CODING: printf("Cost function: : Mixed_lossless_lossy coding with QP'=%d for lossless evaluation\n", LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME); break;
2376  default: printf("Cost function: : Unknown\n"); break;
2377  }
2378 
2379  printf("RateControl : %d\n", m_RCEnableRateControl );
2380 
2382  {
2383  printf("TargetBitrate : %d\n", m_RCTargetBitrate );
2384  printf("KeepHierarchicalBit : %d\n", m_RCKeepHierarchicalBit );
2385  printf("LCULevelRC : %d\n", m_RCLCULevelRC );
2386  printf("UseLCUSeparateModel : %d\n", m_RCUseLCUSeparateModel );
2387  printf("InitialQP : %d\n", m_RCInitialQP );
2388  printf("ForceIntraQP : %d\n", m_RCForceIntraQP );
2389  }
2390 
2391  printf("Max Num Merge Candidates : %d\n", m_maxNumMergeCand);
2392  printf("\n");
2393 
2394  printf("TOOL CFG: ");
2395  printf("IBD:%d ", ((g_bitDepth[CHANNEL_TYPE_LUMA] > m_MSBExtendedBitDepth[CHANNEL_TYPE_LUMA]) || (g_bitDepth[CHANNEL_TYPE_CHROMA] > m_MSBExtendedBitDepth[CHANNEL_TYPE_CHROMA])));
2396  printf("HAD:%d ", m_bUseHADME );
2397  printf("RDQ:%d ", m_useRDOQ );
2398  printf("RDQTS:%d ", m_useRDOQTS );
2399  printf("RDpenalty:%d ", m_rdPenalty );
2400  printf("SQP:%d ", m_uiDeltaQpRD );
2401  printf("ASR:%d ", m_bUseASR );
2402  printf("FEN:%d ", m_bUseFastEnc );
2403  printf("ECU:%d ", m_bUseEarlyCU );
2404  printf("FDM:%d ", m_useFastDecisionForMerge );
2405  printf("CFM:%d ", m_bUseCbfFastMode );
2406  printf("ESD:%d ", m_useEarlySkipDetection );
2407  printf("RQT:%d ", 1 );
2408  printf("TransformSkip:%d ", m_useTransformSkip );
2409  printf("TransformSkipFast:%d ", m_useTransformSkipFast );
2410  printf("TransformSkipLog2MaxSize:%d ", m_transformSkipLog2MaxSize);
2411  printf("Slice: M=%d ", m_sliceMode);
2412  if (m_sliceMode!=NO_SLICES)
2413  {
2414  printf("A=%d ", m_sliceArgument);
2415  }
2416  printf("SliceSegment: M=%d ",m_sliceSegmentMode);
2418  {
2419  printf("A=%d ", m_sliceSegmentArgument);
2420  }
2421  printf("CIP:%d ", m_bUseConstrainedIntraPred);
2422  printf("SAO:%d ", (m_bUseSAO)?(1):(0));
2423  printf("PCM:%d ", (m_usePCM && (1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0);
2424 
2426  {
2427  printf("TransQuantBypassEnabled: =1");
2428  }
2429  else
2430  {
2431  printf("TransQuantBypassEnabled:%d ", (m_TransquantBypassEnableFlag)? 1:0 );
2432  }
2433 
2434  printf("WPP:%d ", (Int)m_useWeightedPred);
2435  printf("WPB:%d ", (Int)m_useWeightedBiPred);
2436  printf("PME:%d ", m_log2ParallelMergeLevel);
2437  const Int iWaveFrontSubstreams = m_iWaveFrontSynchro ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1;
2438  printf(" WaveFrontSynchro:%d WaveFrontSubstreams:%d",
2439  m_iWaveFrontSynchro, iWaveFrontSubstreams);
2440  printf(" ScalingList:%d ", m_useScalingListId );
2441  printf("TMVPMode:%d ", m_TMVPModeId );
2442 #if ADAPTIVE_QP_SELECTION
2443  printf("AQpS:%d", m_bUseAdaptQpSelect );
2444 #endif
2445 
2446  printf(" SignBitHidingFlag:%d ", m_signHideFlag);
2447  printf("RecalQP:%d", m_recalculateQPAccordingToLambda ? 1 : 0 );
2448 
2449  printf("\n\n");
2450 
2451  fflush(stdout);
2452 }
2453 
2454 Bool confirmPara(Bool bflag, const Char* message)
2455 {
2456  if (!bflag)
2457  {
2458  return false;
2459  }
2460 
2461  printf("Error: %s\n",message);
2462  return true;
2463 }
2464 
UInt m_pcmLog2MaxSize
log2 of maximum PCM block size
Definition: TAppEncCfg.h:188
Void create()
create option handling class
Definition: TAppEncCfg.cpp:145
ChromaFormat m_InputChromaFormatIDC
Definition: TAppEncCfg.h:83
Int m_toneMapModelId
Definition: TAppEncCfg.h:239
TComSEIMasteringDisplay m_masteringDisplay
Definition: TAppEncCfg.h:140
Bool m_RCEnableRateControl
enable rate control or not
Definition: TAppEncCfg.h:300
Bool m_recalculateQPAccordingToLambda
recalculate QP value according to the lambda value
Definition: TAppEncCfg.h:314
Bool m_signHideFlag
Definition: TAppEncCfg.h:299
UInt g_uiMaxCUDepth
Definition: TComRom.cpp:253
Int m_chromaSampleLocTypeTopField
Specifies the location of chroma samples for top field.
Definition: TAppEncCfg.h:333
Int m_sigmoidWidth
Definition: TAppEncCfg.h:243
Bool m_useStrongIntraSmoothing
enable strong intra smoothing for 32x32 blocks where the reference samples are flat ...
Definition: TAppEncCfg.h:315
Int m_iDecodingRefreshType
random access type
Definition: TAppEncCfg.h:105
Bool m_loopFilterOffsetInPPS
offset for deblocking filter in 0 = slice header, 1 = PPS
Definition: TAppEncCfg.h:180
Bool m_kneeSEICancelFlag
Definition: TAppEncCfg.h:282
Int m_betaOffsetDiv2
Definition: TEncCfg.h:55
Int * m_kneeSEIInputKneePoint
Definition: TAppEncCfg.h:289
void parseConfigFile(Options &opts, const string &filename)
static const struct MapStrToLevel strToLevel[]
unsigned short UShort
Definition: TypeDef.h:295
UInt m_uiMaxCUDepth
max. CU depth
Definition: TAppEncCfg.h:151
UInt m_FrameSkip
number of skipped frames from the beginning
Definition: TAppEncCfg.h:64
Bool m_enableAMP
Definition: TAppEncCfg.h:120
Int m_confWinTop
Definition: TAppEncCfg.h:76
#define xConfirmPara(a, b)
Bool m_videoFullRangeFlag
Indicates the black level and range of luma and chroma signals.
Definition: TAppEncCfg.h:327
void doHelp(ostream &out, Options &opts, unsigned columns)
Bool m_colourDescriptionPresentFlag
Signals whether colour_primaries, transfer_characteristics and matrix_coefficients are present...
Definition: TAppEncCfg.h:328
Int m_crQpOffset
Chroma Cr QP Offset (0:default)
Definition: TAppEncCfg.h:135
Bool m_saoCtuBoundary
SAO parameter estimation using non-deblocked pixels for CTU bottom and right boundary areas...
Definition: TAppEncCfg.h:177
Bool m_bUseAdaptiveQP
Flag for enabling QP adaptation based on a psycho-visual model.
Definition: TAppEncCfg.h:142
#define MACRO_TO_STRING(val)
Definition: TAppEncCfg.cpp:52
Int m_log2MaxMvLengthHorizontal
Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units...
Definition: TAppEncCfg.h:350
static const struct MapStrToProfile strToProfile[]
Int m_colourPrimaries
Indicates chromaticity coordinates of the source primaries.
Definition: TAppEncCfg.h:329
Level::Name value
Definition: TAppEncCfg.cpp:278
Bool m_bPCMInputBitDepthFlag
0: PCM bit-depth is internal bit-depth. 1: PCM bit-depth is input bit-depth.
Definition: TAppEncCfg.h:172
void Void
Definition: TypeDef.h:285
const Char * str
Definition: TAppEncCfg.cpp:301
Int m_cbQpOffset
Chroma Cb QP Offset (0:default)
Definition: TAppEncCfg.h:134
Int m_deltaRPS
Definition: TEncCfg.h:64
Int m_matrixCoefficients
Describes the matrix coefficients used in deriving luma and chroma from RGB primaries.
Definition: TAppEncCfg.h:331
Bool m_intraConstraintFlag
Definition: TAppEncCfg.h:96
Int m_MSBExtendedBitDepth[MAX_NUM_CHANNEL_TYPE]
bit-depth of input samples after MSB extension
Definition: TAppEncCfg.h:163
Int m_iQPAdaptationRange
dQP range by QP adaptation
Definition: TAppEncCfg.h:143
Int timeOffsetValue
Definition: TypeDef.h:819
Int m_outputBitDepth[MAX_NUM_CHANNEL_TYPE]
bit-depth of output file
Definition: TAppEncCfg.h:162
Int numberOfFrames
Definition: TypeDef.h:811
Profile::Name value
Definition: TAppEncCfg.cpp:202
Bool m_lowerBitRateConstraintFlag
Definition: TAppEncCfg.h:97
Bool m_toneMappingInfoSEIEnabled
Definition: TAppEncCfg.h:230
Int m_transferCharacteristics
Indicates the opto-electronic transfer characteristics of the source.
Definition: TAppEncCfg.h:330
Bool parseCfg(Int argc, Char *argv[])
parse configuration file to fill member variables
Definition: TAppEncCfg.cpp:638
global variables & functions (header)
Int m_inputBitDepth[MAX_NUM_CHANNEL_TYPE]
bit-depth of input file
Definition: TAppEncCfg.h:161
static std::string enumToString(P map[], UInt mapLen, const T val)
Definition: TAppEncCfg.cpp:328
#define NULL
Definition: CommonDef.h:100
Int m_framePackingSEIId
Definition: TAppEncCfg.h:262
Int m_extendedWhiteLevelLumaCodeValue
Definition: TAppEncCfg.h:256
ChromaFormat m_chromaFormatConstraint
Definition: TAppEncCfg.h:95
Int m_decodingUnitInfoSEIEnabled
Definition: TAppEncCfg.h:273
don't use slices / slice segments
Definition: TypeDef.h:564
Bool m_tmctsSEIEnabled
Definition: TAppEncCfg.h:276
Int m_iFrameRate
source frame-rates (Hz)
Definition: TAppEncCfg.h:63
Int m_chromaSampleLocTypeBottomField
Specifies the location of chroma samples for bottom field.
Definition: TAppEncCfg.h:334
Bool m_snrInternalColourSpace
if true, then no colour space conversion is applied for snr calculation, otherwise inverse of input i...
Definition: TAppEncCfg.h:81
Int m_exposureCompensationValueNumerator
Definition: TAppEncCfg.h:250
Bool m_vuiParametersPresentFlag
enable generation of VUI parameters
Definition: TAppEncCfg.h:318
Int m_kneeSEIInputDrange
Definition: TAppEncCfg.h:284
Bool m_bitstreamRestrictionFlag
Signals whether bitstream restriction parameters are present.
Definition: TAppEncCfg.h:344
char Char
Definition: TypeDef.h:291
Bool m_tilesFixedStructureFlag
Indicates that each active picture parameter set has the same values of the syntax elements related t...
Definition: TAppEncCfg.h:345
Int m_iQP
QP value of key-picture (integer)
Definition: TAppEncCfg.h:126
unsigned int UInt
Definition: TypeDef.h:297
Bool clockTimeStampFlag
Definition: TypeDef.h:805
UInt m_uiQuadtreeTULog2MaxSize
Definition: TAppEncCfg.h:154
Int m_noDisplaySEITLayer
Definition: TAppEncCfg.h:272
#define MAX_TLAYER
max number of temporal layer
Definition: CommonDef.h:192
static Int getWinUnitY(Int chromaFormatIdc)
Definition: TComSlice.h:818
Bool m_DeblockingFilterMetric
blockiness metric in encoder
Definition: TAppEncCfg.h:184
Int m_kneeSEIOutputDispLuminance
Definition: TAppEncCfg.h:287
Int m_iSourceWidth
source width in pixel
Definition: TAppEncCfg.h:65
Int m_sarHeight
vertical size of the sample aspect ratio
Definition: TAppEncCfg.h:322
STL namespace.
Int m_iFastSearch
ME mode, 0 = full, 1 = diamond, 2 = PMVFAST.
Definition: TAppEncCfg.h:199
Int m_numRefPics
Definition: TEncCfg.h:60
Definition: TEncCfg.h:49
Int m_POC
Definition: TEncCfg.h:51
Bool m_useSingleSignificanceMapContext
control flag for transform-skip/transquant-bypass single significance map context ...
Definition: TAppEncCfg.h:118
Bool m_bUseSAO
Definition: TAppEncCfg.h:175
ScalingListMode m_useScalingListId
using quantization matrix
Definition: TAppEncCfg.h:307
UInt g_uiAddCUDepth
Definition: TComRom.cpp:254
const std::size_t minNumValuesIncl
Definition: TAppEncCfg.cpp:395
Int m_cameraIsoSpeedValue
Definition: TAppEncCfg.h:246
Int m_videoFormat
Indicates representation of pictures.
Definition: TAppEncCfg.h:326
const Char * str
Definition: TAppEncCfg.cpp:277
UInt m_log2ParallelMergeLevel
Parallel merge estimation region.
Definition: TAppEncCfg.h:295
const Char * str
Definition: TAppEncCfg.cpp:201
Bool m_motionVectorsOverPicBoundariesFlag
Indicates that no samples outside the picture boundaries are used for inter prediction.
Definition: TAppEncCfg.h:346
Int m_framePackingSEIInterpretation
Definition: TAppEncCfg.h:264
Int m_defDispWinRightOffset
Specifies the right offset from the conformance window of the default window.
Definition: TAppEncCfg.h:338
Bool m_useHighPrecisionPredictionWeighting
Definition: TAppEncCfg.h:166
Int m_framePackingSEIEnabled
Definition: TAppEncCfg.h:260
Int m_displayOrientationSEIAngle
Definition: TAppEncCfg.h:269
Int m_loopFilterTcOffsetDiv2
tc offset for deblocking filter
Definition: TAppEncCfg.h:182
std::vector< Int > m_tileColumnWidth
Definition: TAppEncCfg.h:219
Bool m_aspectRatioInfoPresentFlag
Signals whether aspect_ratio_idc is present.
Definition: TAppEncCfg.h:319
static const struct MapStrToScalingListMode strToScalingListMode[]
Bool m_bLoopFilterDisable
flag for using deblocking filter
Definition: TAppEncCfg.h:179
Int m_exposureIndexValue
Definition: TAppEncCfg.h:248
Bool m_useCrossComponentPrediction
flag enabling the use of cross-component prediction
Definition: TAppEncCfg.h:111
Int m_maxCUChromaQpAdjustmentDepth
Definition: TAppEncCfg.h:132
Int m_referencePics[16]
Definition: TEncCfg.h:61
Int m_sliceMode
Definition: TAppEncCfg.h:207
Void xSetGlobal()
set global variables
Level::Tier value
Definition: TAppEncCfg.cpp:267
Bool m_TransquantBypassEnableFlag
transquant_bypass_enable_flag setting in PPS.
Definition: TAppEncCfg.h:310
Int m_loopFilterBetaOffsetDiv2
beta offset for deblocking filter
Definition: TAppEncCfg.h:181
Int m_exposureCompensationValueDenomIdc
Definition: TAppEncCfg.h:251
SMultiValueInput(const T &minValue, const T &maxValue, std::size_t minNumberValues, std::size_t maxNumberValues, const T *defValues, const UInt numDefValues)
Definition: TAppEncCfg.cpp:402
Bool m_exposureCompensationValueSignFlag
Definition: TAppEncCfg.h:249
Int m_interRPSPrediction
Definition: TEncCfg.h:63
Bool m_frameOnlyConstraintFlag
Definition: TAppEncCfg.h:101
ExtendedProfileName
Definition: TAppEncCfg.cpp:59
static ChromaFormat numberToChromaFormat(const Int val)
Definition: TAppEncCfg.cpp:187
Bool m_bUseFastEnc
flag for using fast encoder setting
Definition: TAppEncCfg.h:202
Int * m_targetPivotValue
Definition: TAppEncCfg.h:259
InputColourSpaceConversion stringToInputColourSpaceConvert(const std::string &value, const Bool bIsForward)
Int m_gradualDecodingRefreshInfoEnabled
Definition: TAppEncCfg.h:271
Int countingType
Definition: TypeDef.h:807
Bool m_timeCodeSEIEnabled
Definition: TAppEncCfg.h:277
Bool m_isField
enable field coding
Definition: TAppEncCfg.h:70
Bool hoursFlag
Definition: TypeDef.h:817
Bool m_isTopFieldFirst
Definition: TAppEncCfg.h:71
Int m_maxNumOffsetsPerPic
SAO maximun number of offset per picture.
Definition: TAppEncCfg.h:176
Int * m_kneeSEIOutputKneePoint
Definition: TAppEncCfg.h:290
Bool m_RCForceIntraQP
force all intra picture to use initial QP or not
Definition: TAppEncCfg.h:306
Bool m_useExtendedPrecision
Definition: TAppEncCfg.h:165
Bool m_useEarlySkipDetection
flag for using Early SKIP Detection
Definition: TAppEncCfg.h:206
Int * m_codedPivotValue
Definition: TAppEncCfg.h:258
Double m_adLambdaModifier[7]
Lambda modifier array for each temporal layer.
Definition: TAppEncCfg.h:61
Bool secondsFlag
Definition: TypeDef.h:815
Bool m_kneeSEIPersistenceFlag
Definition: TAppEncCfg.h:283
Int m_tcOffsetDiv2
Definition: TEncCfg.h:54
Int m_iSourceHeight
source height in pixel (when interlaced = field height)
Definition: TAppEncCfg.h:66
#define MAX_GOP
max. value of hierarchical GOP size
Definition: CommonDef.h:110
Bool m_outputInternalColourSpace
if true, then no colour space conversion is applied for reconstructed video, otherwise inverse of inp...
Definition: TAppEncCfg.h:82
Int m_toneMapCodedDataBitDepth
Definition: TAppEncCfg.h:237
Int m_RCKeepHierarchicalBit
0: equal bit allocation; 1: fixed ratio bit allocation; 2: adaptive ratio bit allocation ...
Definition: TAppEncCfg.h:302
const Char * profileToString(const Profile::Name profile)
Int m_bufferingPeriodSEIEnabled
Definition: TAppEncCfg.h:228
Int m_QPOffset
Definition: TEncCfg.h:52
Int m_toneMapId
Definition: TAppEncCfg.h:234
Int m_recoveryPointSEIEnabled
Definition: TAppEncCfg.h:227
Int m_activeParameterSetsSEIEnabled
Definition: TAppEncCfg.h:316
Int m_toneMapMaxValue
Definition: TAppEncCfg.h:241
Int m_chromaSamplingVerFilterIdc
Definition: TAppEncCfg.h:233
SMultiValueInput(std::vector< T > &defaults)
Definition: TAppEncCfg.cpp:399
Int hoursValue
Definition: TypeDef.h:814
Int m_toneMapTargetBitDepth
Definition: TAppEncCfg.h:238
Bool m_segmentedRectFramePackingSEICancel
Definition: TAppEncCfg.h:266
Bool m_useRDOQTS
flag for using RD optimized quantization for transform skip
Definition: TAppEncCfg.h:197
Int m_defDispWinTopOffset
Specifies the top offset from the conformance window of the default window.
Definition: TAppEncCfg.h:339
Int m_confWinLeft
Definition: TAppEncCfg.h:74
Int m_conformanceWindowMode
Definition: TAppEncCfg.h:73
#define MAX_NUM_REF_PICS
max. number of pictures used for reference
Definition: CommonDef.h:112
bool Bool
Definition: TypeDef.h:286
Int minutesValue
Definition: TypeDef.h:813
Int g_maxTrDynamicRange[MAX_NUM_CHANNEL_TYPE]
Definition: TComRom.cpp:325
std::vector< Int > m_tileRowHeight
Definition: TAppEncCfg.h:220
Int m_confWinBottom
Definition: TAppEncCfg.h:77
UInt g_uiMaxCUHeight
Definition: TComRom.cpp:252
Level::Tier m_levelTier
Definition: TAppEncCfg.h:92
const Char * str
Definition: TAppEncCfg.cpp:266
UInt g_uiMaxCUWidth
Definition: TComRom.cpp:251
Int m_iIntraPeriod
period of I-slice (random access period)
Definition: TAppEncCfg.h:104
Int m_maxBytesPerPicDenom
Indicates a number of bytes not exceeded by the sum of the sizes of the VCL NAL units associated with...
Definition: TAppEncCfg.h:348
Int m_cameraIsoSpeedIdc
Definition: TAppEncCfg.h:245
Int * m_aidQP
array of slice QP values
Definition: TAppEncCfg.h:128
Int m_segmentedRectFramePackingSEIType
Definition: TAppEncCfg.h:267
Bool m_toneMapPersistenceFlag
Definition: TAppEncCfg.h:236
Int m_RCInitialQP
inital QP for rate control
Definition: TAppEncCfg.h:305
Int m_confWinRight
Definition: TAppEncCfg.h:75
UInt m_uiMaxCUWidth
max. CU width in pixel
Definition: TAppEncCfg.h:149
Bool m_chromaSamplingFilterSEIenabled
Definition: TAppEncCfg.h:231
Bool m_bUseEarlyCU
flag for using Early CU setting
Definition: TAppEncCfg.h:203
Bool m_RCLCULevelRC
true: LCU level rate control; false: picture level rate control NOTE: code-tidy - rename to m_RCCtuLe...
Definition: TAppEncCfg.h:303
Bool numUnitFieldBasedFlag
Definition: TypeDef.h:806
Int m_sarWidth
horizontal size of the sample aspect ratio
Definition: TAppEncCfg.h:321
Bool m_bLFCrossTileBoundaryFlag
1: filter across tile boundaries 0: do not filter across tile boundaries
Definition: TAppEncCfg.h:215
static istream & readStrToEnum(P map[], UInt mapLen, istream &in, T &val)
Definition: TAppEncCfg.cpp:341
Int m_maxBitsPerMinCuDenom
Indicates an upper bound for the number of bits of coding_unit() data.
Definition: TAppEncCfg.h:349
Bool m_useWeightedPred
Use of weighted prediction in P slices.
Definition: TAppEncCfg.h:292
#define ALLOW_RECOVERY_POINT_AS_RAP
Definition: TypeDef.h:87
Bool m_useTransformSkip
flag for enabling intra transform skipping
Definition: TAppEncCfg.h:114
Void xCheckParameter()
check validity of configuration values
Int m_iGOPSize
GOP size of hierarchical structure.
Definition: TAppEncCfg.h:106
Int m_sliceSegmentArgument
argument according to selected slice segment mode
Definition: TAppEncCfg.h:212
static istream & operator>>(istream &in, Tier &tier)
Definition: TAppEncCfg.cpp:369
Int m_numRefIdc
Definition: TEncCfg.h:65
Int m_scalableNestingSEIEnabled
Definition: TAppEncCfg.h:275
Int m_bipredSearchRange
ME search range for bipred refinement.
Definition: TAppEncCfg.h:201
Int m_decodedPictureHashSEIEnabled
Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message.
Definition: TAppEncCfg.h:226
Int m_iWaveFrontSynchro
Definition: TAppEncCfg.h:221
Int m_sliceSegmentMode
Definition: TAppEncCfg.h:210
Bool m_cabacZeroWordPaddingEnabled
Definition: TAppEncCfg.h:88
Handle encoder configuration parameters (header)
Double m_fQP
QP value of key-picture (floating point)
Definition: TAppEncCfg.h:125
Profile::Name m_profile
Definition: TAppEncCfg.h:91
Bool m_printFrameMSE
Definition: TAppEncCfg.h:86
UInt m_uiQuadtreeTULog2MinSize
Definition: TAppEncCfg.h:155
Int g_PCMBitDepth[MAX_NUM_CHANNEL_TYPE]
Definition: TComRom.cpp:552
Int m_nominalBlackLevelLumaCodeValue
Definition: TAppEncCfg.h:254
Bool m_printSequenceMSE
Definition: TAppEncCfg.h:87
ChromaFormat m_chromaFormatIDC
Definition: TAppEncCfg.h:169
ChromaFormat
chroma formats (according to semantics of chroma_format_idc)
Definition: TypeDef.h:352
list< const char * > scanArgv(Options &opts, unsigned argc, const char *argv[])
Bool m_progressiveSourceFlag
Definition: TAppEncCfg.h:98
Bool m_printMSEBasedSequencePSNR
Definition: TAppEncCfg.h:85
Bool m_frameFieldInfoPresentFlag
Indicates that pic_struct values are present in picture timing SEI messages.
Definition: TAppEncCfg.h:341
Limit maximum number of largest coding tree units in a slice / slice segments.
Definition: TypeDef.h:565
Bool m_nonPackedConstraintFlag
Definition: TAppEncCfg.h:100
Int m_sliceArgument
argument according to selected slice mode
Definition: TAppEncCfg.h:209
Bool m_useRDOQ
flag for using RD optimized quantization
Definition: TAppEncCfg.h:196
static const struct MapStrToCostMode strToCostMode[]
Bool discontinuityFlag
Definition: TypeDef.h:809
SMultiValueInput< T > & operator=(const std::vector< T > &userValues)
Definition: TAppEncCfg.cpp:404
CostMode
Definition: TypeDef.h:656
Bool confirmPara(Bool bflag, const Char *message)
Bool m_bUseCbfFastMode
flag for using Cbf Fast PU Mode Decision
Definition: TAppEncCfg.h:205
Bool m_toneMapCancelFlag
Definition: TAppEncCfg.h:235
Int m_exposureIndexIdc
Definition: TAppEncCfg.h:247
Bool m_chromaLocInfoPresentFlag
Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present...
Definition: TAppEncCfg.h:332
Bool m_useWeightedBiPred
Use of bi-directional weighted prediction in B slices.
Definition: TAppEncCfg.h:293
Bool m_videoSignalTypePresentFlag
Signals whether video_format, video_full_range_flag, and colour_description_present_flag are present...
Definition: TAppEncCfg.h:325
Name
Definition: TypeDef.h:635
Bool m_RCUseLCUSeparateModel
use separate R-lambda model at LCU level NOTE: code-tidy - rename to m_RCUseCtuSeparateModel ...
Definition: TAppEncCfg.h:304
virtual ~TAppEncCfg()
Definition: TAppEncCfg.cpp:116
Void destroy()
destroy option handling class
Definition: TAppEncCfg.cpp:149
Int m_kneeSEINumKneePointsMinus1
Definition: TAppEncCfg.h:288
Int m_refIdc[16+1]
Definition: TEncCfg.h:66
Bool minutesFlag
Definition: TypeDef.h:816
UInt m_uiPCMLog2MinSize
log2 of minimum PCM block size
Definition: TAppEncCfg.h:189
Bool m_useTransformSkipFast
flag for enabling fast intra transform skipping
Definition: TAppEncCfg.h:115
Int m_temporalLevel0IndexSEIEnabled
Definition: TAppEncCfg.h:270
Int m_kneeSEIOutputDrange
Definition: TAppEncCfg.h:286
Int m_iSourceHeightOrg
original source height in pixel (when interlaced = frame height)
Definition: TAppEncCfg.h:68
Int m_minSpatialSegmentationIdc
Indicates the maximum size of the spatial segments in the pictures in the coded video sequence...
Definition: TAppEncCfg.h:347
UInt m_bitDepthConstraint
Definition: TAppEncCfg.h:94
static const ExtendedProfileName validRExtProfileNames[2][4][4]
Definition: TAppEncCfg.cpp:248
std::string getListOfColourSpaceConverts(const Bool bIsForward)
Bool m_tileUniformSpacingFlag
Definition: TAppEncCfg.h:216
UInt m_uiQuadtreeTUMaxDepthIntra
Definition: TAppEncCfg.h:158
ScalingListMode
Definition: TypeDef.h:545
#define MAX_TIMECODE_SEI_SETS
Maximum number of time sets.
Definition: TypeDef.h:252
Int g_bitDepth[MAX_NUM_CHANNEL_TYPE]
Definition: TComRom.cpp:548
static const struct MapStrToTier strToTier[]
Bool m_bPCMFilterDisableFlag
PCM filter disable flag.
Definition: TAppEncCfg.h:190
InputColourSpaceConversion m_inputColourSpaceConvert
colour space conversion to apply to input video
Definition: TAppEncCfg.h:80
TComSEITimeSet m_timeSetArray[3]
Definition: TAppEncCfg.h:279
const std::size_t maxNumValuesIncl
Definition: TAppEncCfg.cpp:396
Bool m_bUseAdaptQpSelect
Definition: TAppEncCfg.h:138
std::vector< T > values
Definition: TAppEncCfg.cpp:397
Bool m_segmentedRectFramePackingSEIPersistence
Definition: TAppEncCfg.h:268
Char * m_pchReconFile
output reconstruction file
Definition: TAppEncCfg.h:60
Int * m_startOfCodedInterval
Definition: TAppEncCfg.h:257
Int m_framePackingSEIType
Definition: TAppEncCfg.h:261
Int m_numRefPicsActive
Definition: TEncCfg.h:58
Int secondsValue
Definition: TypeDef.h:812
Bool m_DeblockingFilterControlPresent
deblocking filter control present flag in PPS
Definition: TAppEncCfg.h:183
Bool m_useGolombRiceParameterAdaptation
control flag for Golomb-Rice parameter adaptation over each slice
Definition: TAppEncCfg.h:121
Int m_toneMapMinValue
Definition: TAppEncCfg.h:240
UShort whitePoint[2]
Definition: TypeDef.h:828
Int m_aspectRatioIdc
aspect_ratio_idc
Definition: TAppEncCfg.h:320
Int m_timeCodeSEINumTs
Definition: TAppEncCfg.h:278
CostMode m_costMode
Cost mode to use.
Definition: TAppEncCfg.h:312
Int m_pictureTimingSEIEnabled
Definition: TAppEncCfg.h:229
Tier
Definition: TypeDef.h:629
Int m_sigmoidMidpoint
Definition: TAppEncCfg.h:242
static Int getWinUnitX(Int chromaFormatIdc)
Definition: TComSlice.h:817
Int m_numTileColumnsMinus1
Definition: TAppEncCfg.h:217
Char * m_pchdQPFile
QP offset for each slice (initialized from external file)
Definition: TAppEncCfg.h:127
UInt m_uiQuadtreeTUMaxDepthInter
Definition: TAppEncCfg.h:157
Int m_kneeSEIId
Definition: TAppEncCfg.h:281
Bool m_bUseASR
flag for using adaptive motion search range
Definition: TAppEncCfg.h:194
ScalingListMode value
Definition: TAppEncCfg.cpp:315
UInt m_maxNumMergeCand
Max number of merge candidates.
Definition: TAppEncCfg.h:296
Int m_numPivots
Definition: TAppEncCfg.h:244
static Void automaticallySelectRExtProfile(const Bool bUsingGeneralRExtTools, const Bool bUsingChromaQPAdjustment, const Bool bUsingExtendedPrecision, const Bool bIntraConstraintFlag, UInt &bitDepthConstraint, ChromaFormat &chromaFormatConstraint, const Int maxBitDepth, const ChromaFormat chromaFormat)
Definition: TAppEncCfg.cpp:556
Level::Name m_level
Definition: TAppEncCfg.h:93
Bool m_refPic
Definition: TEncCfg.h:57
Bool m_enableIntraReferenceSmoothing
flag for enabling(default)/disabling intra reference smoothing/filtering
Definition: TAppEncCfg.h:191
Bool m_useResidualRotation
control flag for transform-skip/transquant-bypass residual rotation
Definition: TAppEncCfg.h:117
int Int
Definition: TypeDef.h:296
static UInt getMaxCUDepthOffset(const ChromaFormat chFmt, const UInt quadtreeTULog2MinSize)
UInt m_transformSkipLog2MaxSize
transform-skip maximum size (minimum of 2)
Definition: TAppEncCfg.h:116
Char * m_pchInputFile
source file name
Definition: TAppEncCfg.h:58
Bool m_reconBasedCrossCPredictionEstimate
causes the alpha calculation in encoder search to be based on the decoded residual rather than the pr...
Definition: TAppEncCfg.h:112
Int m_chromaSamplingHorFilterIdc
Definition: TAppEncCfg.h:232
Bool m_useResidualDPCM[NUMBER_OF_RDPCM_SIGNALLING_MODES]
control flags for residual DPCM
Definition: TAppEncCfg.h:119
Rate control manager class.
Int m_kneeSEIInputDispLuminance
Definition: TAppEncCfg.h:285
Void xPrintParameter()
print configuration values
#define LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP
QP to use for lossless coding.
Definition: TypeDef.h:227
Bool m_bUseConstrainedIntraPred
flag for using constrained intra prediction
Definition: TAppEncCfg.h:224
Int m_defDispWinBottomOffset
Specifies the bottom offset from the conformance window of the default window.
Definition: TAppEncCfg.h:340
UInt m_uiDeltaQpRD
dQP range for multi-pass slice QP optimization
Definition: TAppEncCfg.h:130
Int m_SOPDescriptionSEIEnabled
Definition: TAppEncCfg.h:274
Int m_TMVPModeId
Definition: TAppEncCfg.h:298
Bool m_defaultDisplayWindowFlag
Indicates the presence of the default window parameters.
Definition: TAppEncCfg.h:336
Bool m_overscanAppropriateFlag
Indicates whether conformant decoded pictures are suitable for display using overscan.
Definition: TAppEncCfg.h:324
Int m_maxDecPicBuffering[7]
total number of pictures in the decoded picture buffer
Definition: TAppEncCfg.h:110
Int m_internalBitDepth[MAX_NUM_CHANNEL_TYPE]
bit-depth codec operates at (input/output files will be converted)
Definition: TAppEncCfg.h:164
Int m_numReorderPics[7]
total number of reorder pictures
Definition: TAppEncCfg.h:109
UInt m_saoOffsetBitShift[MAX_NUM_CHANNEL_TYPE]
number of bits for the upward bit shift operation on the decoded SAO offsets
Definition: TAppEncCfg.h:113
Bool fullTimeStampFlag
Definition: TypeDef.h:808
Int m_refScreenLuminanceWhite
Definition: TAppEncCfg.h:252
Int m_defDispWinLeftOffset
Specifies the left offset from the conformance window of the default window.
Definition: TAppEncCfg.h:337
Int m_temporalId
Definition: TEncCfg.h:56
Char * m_pchBitstreamFile
output bitstream file
Definition: TAppEncCfg.h:59
Bool m_bUseHADME
flag for using HAD in sub-pel ME
Definition: TAppEncCfg.h:195
Int m_iSearchRange
ME search range.
Definition: TAppEncCfg.h:200
Int m_RCTargetBitrate
target bitrate when rate control is enabled
Definition: TAppEncCfg.h:301
Int timeOffsetLength
Definition: TypeDef.h:818
double Double
Definition: TypeDef.h:298
Int m_framePackingSEIQuincunx
Definition: TAppEncCfg.h:263
Bool m_neutralChromaIndicationFlag
Indicates that the value of all decoded chroma samples is equal to 1<<(BitDepthCr-1) ...
Definition: TAppEncCfg.h:335
Bool m_interlacedSourceFlag
Definition: TAppEncCfg.h:99
SMultiValueInput(const T &minValue, const T &maxValue, std::size_t minNumberValues=0, std::size_t maxNumberValues=0)
Definition: TAppEncCfg.cpp:400
Bool m_alignCABACBeforeBypass
Definition: TAppEncCfg.h:122
Int m_numTicksPocDiffOneMinus1
Number of ticks minus 1 that for a POC difference of one.
Definition: TAppEncCfg.h:343
Bool m_CUTransquantBypassFlagForce
if transquant_bypass_enable_flag, then, if true, all CU transquant bypass flags will be set to true...
Definition: TAppEncCfg.h:311
Bool m_usePCM
flag for using IPCM
Definition: TAppEncCfg.h:187
Char * m_scalingListFile
quantization matrix file name
Definition: TAppEncCfg.h:308
std::istringstream & operator>>(std::istringstream &in, GOPEntry &entry)
Definition: TAppEncCfg.cpp:153
Bool cntDroppedFlag
Definition: TypeDef.h:810
Int m_nominalWhiteLevelLumaCodeValue
Definition: TAppEncCfg.h:255
Int m_extraRPSs
extra RPSs added to handle CRA
Definition: TAppEncCfg.h:107
static const struct MapStrToExtendedProfile strToExtendedProfile[]
Int m_maxTempLayer
Max temporal layer.
Definition: TAppEncCfg.h:145
Int m_usedByCurrPic[16]
Definition: TEncCfg.h:62
Bool m_pocProportionalToTimingFlag
Indicates that the POC value is proportional to the output time w.r.t. first picture in CVS...
Definition: TAppEncCfg.h:342
Bool m_useFastDecisionForMerge
flag for using Fast Decision Merge RD-Cost
Definition: TAppEncCfg.h:204
Int m_aiPad[2]
number of padded pixels for width and height
Definition: TAppEncCfg.h:79
Int m_log2MaxMvLengthVertical
Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units...
Definition: TAppEncCfg.h:351
Char m_sliceType
Definition: TEncCfg.h:59
Int m_framesToBeEncoded
number of encoded frames
Definition: TAppEncCfg.h:78
Int m_numTileRowsMinus1
Definition: TAppEncCfg.h:218
Int m_extendedRangeWhiteLevel
Definition: TAppEncCfg.h:253
UInt m_uiMaxCUHeight
max. CU height in pixel
Definition: TAppEncCfg.h:150
GOPEntry m_GOPList[64]
the coding structure entries from the config file
Definition: TAppEncCfg.h:108
Int m_iMaxDeltaQP
max. |delta QP|
Definition: TAppEncCfg.h:129
ExtendedProfileName value
Definition: TAppEncCfg.cpp:217
SMultiValueInput< T > & operator=(const SMultiValueInput< T > &userValues)
Definition: TAppEncCfg.cpp:405
Double m_QPFactor
Definition: TEncCfg.h:53
Int m_iMaxCuDQPDepth
Max. depth for a minimum CuDQPSize (0:default)
Definition: TAppEncCfg.h:131
UShort primaries[3][2]
Definition: TypeDef.h:827
Bool m_bLFCrossSliceBoundaryFlag
1: filter across slice boundaries 0: do not filter across slice boundaries
Definition: TAppEncCfg.h:214
#define LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME
QP' to use for mixed_lossy_lossless coding.
Definition: TypeDef.h:228
Bool m_kneeSEIEnabled
Definition: TAppEncCfg.h:280
Int m_segmentedRectFramePackingSEIEnabled
Definition: TAppEncCfg.h:265
Bool m_overscanInfoPresentFlag
Signals whether overscan_appropriate_flag is present.
Definition: TAppEncCfg.h:323
Int m_rdPenalty
RD-penalty for 32x32 TU for intra in non-intra slices (0: no RD-penalty, 1: RD-penalty, 2: maximum RD-penalty)
Definition: TAppEncCfg.h:198