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