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-2013, 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 "TLibCommon/TComRom.h" |
---|
43 | #include "TAppEncCfg.h" |
---|
44 | |
---|
45 | static istream& operator>>(istream &, Level::Name &); |
---|
46 | static istream& operator>>(istream &, Level::Tier &); |
---|
47 | static istream& operator>>(istream &, Profile::Name &); |
---|
48 | |
---|
49 | #include "TAppCommon/program_options_lite.h" |
---|
50 | #include "TLibEncoder/TEncRateCtrl.h" |
---|
51 | #ifdef WIN32 |
---|
52 | #define strdup _strdup |
---|
53 | #endif |
---|
54 | |
---|
55 | using namespace std; |
---|
56 | namespace po = df::program_options_lite; |
---|
57 | |
---|
58 | //! \ingroup TAppEncoder |
---|
59 | //! \{ |
---|
60 | |
---|
61 | // ==================================================================================================================== |
---|
62 | // Constructor / destructor / initialization / destroy |
---|
63 | // ==================================================================================================================== |
---|
64 | |
---|
65 | #if SVC_EXTENSION |
---|
66 | TAppEncCfg::TAppEncCfg() |
---|
67 | : m_pBitstreamFile() |
---|
68 | #if AVC_BASE |
---|
69 | , m_avcBaseLayerFlag(0) |
---|
70 | #endif |
---|
71 | , m_pColumnWidth() |
---|
72 | , m_pRowHeight() |
---|
73 | , m_scalingListFile() |
---|
74 | #if REF_IDX_FRAMEWORK |
---|
75 | , m_elRapSliceBEnabled(0) |
---|
76 | #endif |
---|
77 | { |
---|
78 | for(UInt layer=0; layer<MAX_LAYERS; layer++) |
---|
79 | { |
---|
80 | m_acLayerCfg[layer].setAppEncCfg(this); |
---|
81 | #if M0457_IL_SAMPLE_PRED_ONLY_FLAG |
---|
82 | m_ilSampleOnlyPred[layer] = 0; |
---|
83 | #endif |
---|
84 | } |
---|
85 | memset( m_scalabilityMask, 0, sizeof(m_scalabilityMask) ); |
---|
86 | } |
---|
87 | #else |
---|
88 | TAppEncCfg::TAppEncCfg() |
---|
89 | : m_pchInputFile() |
---|
90 | , m_pchBitstreamFile() |
---|
91 | , m_pchReconFile() |
---|
92 | , m_pchdQPFile() |
---|
93 | , m_pColumnWidth() |
---|
94 | , m_pRowHeight() |
---|
95 | , m_scalingListFile() |
---|
96 | { |
---|
97 | m_aidQP = NULL; |
---|
98 | m_startOfCodedInterval = NULL; |
---|
99 | m_codedPivotValue = NULL; |
---|
100 | m_targetPivotValue = NULL; |
---|
101 | } |
---|
102 | #endif |
---|
103 | |
---|
104 | TAppEncCfg::~TAppEncCfg() |
---|
105 | { |
---|
106 | #if SVC_EXTENSION |
---|
107 | free(m_pBitstreamFile); |
---|
108 | #else |
---|
109 | free(m_pchBitstreamFile); |
---|
110 | if ( m_aidQP ) |
---|
111 | { |
---|
112 | delete[] m_aidQP; |
---|
113 | } |
---|
114 | if ( m_startOfCodedInterval ) |
---|
115 | { |
---|
116 | delete[] m_startOfCodedInterval; |
---|
117 | m_startOfCodedInterval = NULL; |
---|
118 | } |
---|
119 | if ( m_codedPivotValue ) |
---|
120 | { |
---|
121 | delete[] m_codedPivotValue; |
---|
122 | m_codedPivotValue = NULL; |
---|
123 | } |
---|
124 | if ( m_targetPivotValue ) |
---|
125 | { |
---|
126 | delete[] m_targetPivotValue; |
---|
127 | m_targetPivotValue = NULL; |
---|
128 | } |
---|
129 | free(m_pchInputFile); |
---|
130 | #endif |
---|
131 | #if !SVC_EXTENSION |
---|
132 | free(m_pchReconFile); |
---|
133 | free(m_pchdQPFile); |
---|
134 | #endif |
---|
135 | free(m_pColumnWidth); |
---|
136 | free(m_pRowHeight); |
---|
137 | free(m_scalingListFile); |
---|
138 | } |
---|
139 | |
---|
140 | Void TAppEncCfg::create() |
---|
141 | { |
---|
142 | } |
---|
143 | |
---|
144 | Void TAppEncCfg::destroy() |
---|
145 | { |
---|
146 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
147 | #if M0457_PREDICTION_INDICATIONS |
---|
148 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
149 | { |
---|
150 | if( m_acLayerCfg[layer].m_numSamplePredRefLayers > 0 ) |
---|
151 | { |
---|
152 | delete [] m_acLayerCfg[layer].m_samplePredRefLayerIds; |
---|
153 | } |
---|
154 | } |
---|
155 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
156 | { |
---|
157 | if( m_acLayerCfg[layer].m_numMotionPredRefLayers > 0 ) |
---|
158 | { |
---|
159 | delete [] m_acLayerCfg[layer].m_motionPredRefLayerIds; |
---|
160 | } |
---|
161 | } |
---|
162 | #else |
---|
163 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
164 | { |
---|
165 | if( m_acLayerCfg[layer].m_numDirectRefLayers > 0 ) |
---|
166 | { |
---|
167 | delete [] m_acLayerCfg[layer].m_refLayerIds; |
---|
168 | } |
---|
169 | } |
---|
170 | #endif |
---|
171 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
172 | { |
---|
173 | if( m_acLayerCfg[layer].m_numActiveRefLayers > 0 ) |
---|
174 | { |
---|
175 | delete [] m_acLayerCfg[layer].m_predLayerIds; |
---|
176 | } |
---|
177 | } |
---|
178 | #endif |
---|
179 | } |
---|
180 | |
---|
181 | std::istringstream &operator>>(std::istringstream &in, GOPEntry &entry) //input |
---|
182 | { |
---|
183 | in>>entry.m_sliceType; |
---|
184 | in>>entry.m_POC; |
---|
185 | in>>entry.m_QPOffset; |
---|
186 | in>>entry.m_QPFactor; |
---|
187 | in>>entry.m_tcOffsetDiv2; |
---|
188 | in>>entry.m_betaOffsetDiv2; |
---|
189 | in>>entry.m_temporalId; |
---|
190 | in>>entry.m_numRefPicsActive; |
---|
191 | in>>entry.m_numRefPics; |
---|
192 | for ( Int i = 0; i < entry.m_numRefPics; i++ ) |
---|
193 | { |
---|
194 | in>>entry.m_referencePics[i]; |
---|
195 | } |
---|
196 | in>>entry.m_interRPSPrediction; |
---|
197 | #if AUTO_INTER_RPS |
---|
198 | if (entry.m_interRPSPrediction==1) |
---|
199 | { |
---|
200 | in>>entry.m_deltaRPS; |
---|
201 | in>>entry.m_numRefIdc; |
---|
202 | for ( Int i = 0; i < entry.m_numRefIdc; i++ ) |
---|
203 | { |
---|
204 | in>>entry.m_refIdc[i]; |
---|
205 | } |
---|
206 | } |
---|
207 | else if (entry.m_interRPSPrediction==2) |
---|
208 | { |
---|
209 | in>>entry.m_deltaRPS; |
---|
210 | } |
---|
211 | #else |
---|
212 | if (entry.m_interRPSPrediction) |
---|
213 | { |
---|
214 | in>>entry.m_deltaRPS; |
---|
215 | in>>entry.m_numRefIdc; |
---|
216 | for ( Int i = 0; i < entry.m_numRefIdc; i++ ) |
---|
217 | { |
---|
218 | in>>entry.m_refIdc[i]; |
---|
219 | } |
---|
220 | } |
---|
221 | #endif |
---|
222 | return in; |
---|
223 | } |
---|
224 | |
---|
225 | #if SVC_EXTENSION |
---|
226 | void TAppEncCfg::getDirFilename(string& filename, string& dir, const string path) |
---|
227 | { |
---|
228 | size_t pos = path.find_last_of("\\"); |
---|
229 | if(pos != std::string::npos) |
---|
230 | { |
---|
231 | filename.assign(path.begin() + pos + 1, path.end()); |
---|
232 | dir.assign(path.begin(), path.begin() + pos + 1); |
---|
233 | } |
---|
234 | else |
---|
235 | { |
---|
236 | pos = path.find_last_of("/"); |
---|
237 | if(pos != std::string::npos) |
---|
238 | { |
---|
239 | filename.assign(path.begin() + pos + 1, path.end()); |
---|
240 | dir.assign(path.begin(), path.begin() + pos + 1); |
---|
241 | } |
---|
242 | else |
---|
243 | { |
---|
244 | filename = path; |
---|
245 | dir.assign(""); |
---|
246 | } |
---|
247 | } |
---|
248 | } |
---|
249 | #endif |
---|
250 | |
---|
251 | static const struct MapStrToProfile { |
---|
252 | const Char* str; |
---|
253 | Profile::Name value; |
---|
254 | } strToProfile[] = { |
---|
255 | {"none", Profile::NONE}, |
---|
256 | {"main", Profile::MAIN}, |
---|
257 | {"main10", Profile::MAIN10}, |
---|
258 | {"main-still-picture", Profile::MAINSTILLPICTURE}, |
---|
259 | }; |
---|
260 | |
---|
261 | static const struct MapStrToTier { |
---|
262 | const Char* str; |
---|
263 | Level::Tier value; |
---|
264 | } strToTier[] = { |
---|
265 | {"main", Level::MAIN}, |
---|
266 | {"high", Level::HIGH}, |
---|
267 | }; |
---|
268 | |
---|
269 | static const struct MapStrToLevel { |
---|
270 | const Char* str; |
---|
271 | Level::Name value; |
---|
272 | } strToLevel[] = { |
---|
273 | {"none",Level::NONE}, |
---|
274 | {"1", Level::LEVEL1}, |
---|
275 | {"2", Level::LEVEL2}, |
---|
276 | {"2.1", Level::LEVEL2_1}, |
---|
277 | {"3", Level::LEVEL3}, |
---|
278 | {"3.1", Level::LEVEL3_1}, |
---|
279 | {"4", Level::LEVEL4}, |
---|
280 | {"4.1", Level::LEVEL4_1}, |
---|
281 | {"5", Level::LEVEL5}, |
---|
282 | {"5.1", Level::LEVEL5_1}, |
---|
283 | {"5.2", Level::LEVEL5_2}, |
---|
284 | {"6", Level::LEVEL6}, |
---|
285 | {"6.1", Level::LEVEL6_1}, |
---|
286 | {"6.2", Level::LEVEL6_2}, |
---|
287 | }; |
---|
288 | |
---|
289 | template<typename T, typename P> |
---|
290 | static istream& readStrToEnum(P map[], unsigned long mapLen, istream &in, T &val) |
---|
291 | { |
---|
292 | string str; |
---|
293 | in >> str; |
---|
294 | |
---|
295 | for (Int i = 0; i < mapLen; i++) |
---|
296 | { |
---|
297 | if (str == map[i].str) |
---|
298 | { |
---|
299 | val = map[i].value; |
---|
300 | goto found; |
---|
301 | } |
---|
302 | } |
---|
303 | /* not found */ |
---|
304 | in.setstate(ios::failbit); |
---|
305 | found: |
---|
306 | return in; |
---|
307 | } |
---|
308 | |
---|
309 | static istream& operator>>(istream &in, Profile::Name &profile) |
---|
310 | { |
---|
311 | return readStrToEnum(strToProfile, sizeof(strToProfile)/sizeof(*strToProfile), in, profile); |
---|
312 | } |
---|
313 | |
---|
314 | static istream& operator>>(istream &in, Level::Tier &tier) |
---|
315 | { |
---|
316 | return readStrToEnum(strToTier, sizeof(strToTier)/sizeof(*strToTier), in, tier); |
---|
317 | } |
---|
318 | |
---|
319 | static istream& operator>>(istream &in, Level::Name &level) |
---|
320 | { |
---|
321 | return readStrToEnum(strToLevel, sizeof(strToLevel)/sizeof(*strToLevel), in, level); |
---|
322 | } |
---|
323 | |
---|
324 | // ==================================================================================================================== |
---|
325 | // Public member functions |
---|
326 | // ==================================================================================================================== |
---|
327 | |
---|
328 | /** \param argc number of arguments |
---|
329 | \param argv array of arguments |
---|
330 | \retval true when success |
---|
331 | */ |
---|
332 | Bool TAppEncCfg::parseCfg( Int argc, Char* argv[] ) |
---|
333 | { |
---|
334 | Bool do_help = false; |
---|
335 | |
---|
336 | #if SVC_EXTENSION |
---|
337 | string cfg_LayerCfgFile [MAX_LAYERS]; |
---|
338 | string cfg_BitstreamFile; |
---|
339 | string* cfg_InputFile [MAX_LAYERS]; |
---|
340 | string* cfg_ReconFile [MAX_LAYERS]; |
---|
341 | Double* cfg_fQP [MAX_LAYERS]; |
---|
342 | |
---|
343 | Int* cfg_SourceWidth [MAX_LAYERS]; |
---|
344 | Int* cfg_SourceHeight [MAX_LAYERS]; |
---|
345 | Int* cfg_FrameRate [MAX_LAYERS]; |
---|
346 | Int* cfg_IntraPeriod [MAX_LAYERS]; |
---|
347 | Int* cfg_conformanceMode [MAX_LAYERS]; |
---|
348 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
349 | #if M0457_PREDICTION_INDICATIONS |
---|
350 | Int* cfg_numSamplePredRefLayers [MAX_LAYERS]; |
---|
351 | string cfg_samplePredRefLayerIds [MAX_LAYERS]; |
---|
352 | string* cfg_samplePredRefLayerIdsPtr[MAX_LAYERS]; |
---|
353 | Int* cfg_numMotionPredRefLayers [MAX_LAYERS]; |
---|
354 | string cfg_motionPredRefLayerIds [MAX_LAYERS]; |
---|
355 | string* cfg_motionPredRefLayerIdsPtr[MAX_LAYERS]; |
---|
356 | #else |
---|
357 | Int* cfg_numDirectRefLayers [MAX_LAYERS]; |
---|
358 | string cfg_refLayerIds [MAX_LAYERS]; |
---|
359 | string* cfg_refLayerIdsPtr [MAX_LAYERS]; |
---|
360 | #endif |
---|
361 | Int* cfg_numActiveRefLayers [MAX_LAYERS]; |
---|
362 | string cfg_predLayerIds [MAX_LAYERS]; |
---|
363 | string* cfg_predLayerIdsPtr [MAX_LAYERS]; |
---|
364 | #endif |
---|
365 | #if SCALED_REF_LAYER_OFFSETS |
---|
366 | string cfg_scaledRefLayerLeftOffset [MAX_LAYERS]; |
---|
367 | string cfg_scaledRefLayerTopOffset [MAX_LAYERS]; |
---|
368 | string cfg_scaledRefLayerRightOffset [MAX_LAYERS]; |
---|
369 | string cfg_scaledRefLayerBottomOffset [MAX_LAYERS]; |
---|
370 | Int* cfg_numScaledRefLayerOffsets[MAX_LAYERS]; |
---|
371 | |
---|
372 | string* cfg_scaledRefLayerLeftOffsetPtr [MAX_LAYERS]; |
---|
373 | string* cfg_scaledRefLayerTopOffsetPtr [MAX_LAYERS]; |
---|
374 | string* cfg_scaledRefLayerRightOffsetPtr [MAX_LAYERS]; |
---|
375 | string* cfg_scaledRefLayerBottomOffsetPtr [MAX_LAYERS]; |
---|
376 | #endif |
---|
377 | #if RC_SHVC_HARMONIZATION |
---|
378 | Bool* cfg_RCEnableRateControl [MAX_LAYERS]; |
---|
379 | Int* cfg_RCTargetBitRate [MAX_LAYERS]; |
---|
380 | Bool* cfg_RCKeepHierarchicalBit[MAX_LAYERS]; |
---|
381 | Bool* cfg_RCLCULevelRC [MAX_LAYERS]; |
---|
382 | Bool* cfg_RCUseLCUSeparateModel[MAX_LAYERS]; |
---|
383 | Int* cfg_RCInitialQP [MAX_LAYERS]; |
---|
384 | Bool* cfg_RCForceIntraQP [MAX_LAYERS]; |
---|
385 | #endif |
---|
386 | for(UInt layer = 0; layer < MAX_LAYERS; layer++) |
---|
387 | { |
---|
388 | cfg_InputFile[layer] = &m_acLayerCfg[layer].m_cInputFile; |
---|
389 | cfg_ReconFile[layer] = &m_acLayerCfg[layer].m_cReconFile; |
---|
390 | cfg_fQP[layer] = &m_acLayerCfg[layer].m_fQP; |
---|
391 | cfg_SourceWidth[layer] = &m_acLayerCfg[layer].m_iSourceWidth; |
---|
392 | cfg_SourceHeight[layer] = &m_acLayerCfg[layer].m_iSourceHeight; |
---|
393 | cfg_FrameRate[layer] = &m_acLayerCfg[layer].m_iFrameRate; |
---|
394 | cfg_IntraPeriod[layer] = &m_acLayerCfg[layer].m_iIntraPeriod; |
---|
395 | cfg_conformanceMode[layer] = &m_acLayerCfg[layer].m_conformanceMode; |
---|
396 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
397 | #if M0457_PREDICTION_INDICATIONS |
---|
398 | cfg_numSamplePredRefLayers [layer] = &m_acLayerCfg[layer].m_numSamplePredRefLayers; |
---|
399 | cfg_samplePredRefLayerIdsPtr[layer] = &cfg_samplePredRefLayerIds[layer]; |
---|
400 | cfg_numMotionPredRefLayers [layer] = &m_acLayerCfg[layer].m_numMotionPredRefLayers; |
---|
401 | cfg_motionPredRefLayerIdsPtr[layer] = &cfg_motionPredRefLayerIds[layer]; |
---|
402 | #else |
---|
403 | cfg_numDirectRefLayers [layer] = &m_acLayerCfg[layer].m_numDirectRefLayers; |
---|
404 | cfg_refLayerIdsPtr [layer] = &cfg_refLayerIds[layer]; |
---|
405 | #endif |
---|
406 | cfg_numActiveRefLayers [layer] = &m_acLayerCfg[layer].m_numActiveRefLayers; |
---|
407 | cfg_predLayerIdsPtr [layer] = &cfg_predLayerIds[layer]; |
---|
408 | #endif |
---|
409 | #if SCALED_REF_LAYER_OFFSETS |
---|
410 | cfg_numScaledRefLayerOffsets [layer] = &m_acLayerCfg[layer].m_numScaledRefLayerOffsets; |
---|
411 | for(Int i = 0; i < MAX_LAYERS; i++) |
---|
412 | { |
---|
413 | cfg_scaledRefLayerLeftOffsetPtr [layer] = &cfg_scaledRefLayerLeftOffset[layer] ; |
---|
414 | cfg_scaledRefLayerTopOffsetPtr [layer] = &cfg_scaledRefLayerTopOffset[layer] ; |
---|
415 | cfg_scaledRefLayerRightOffsetPtr [layer] = &cfg_scaledRefLayerRightOffset[layer] ; |
---|
416 | cfg_scaledRefLayerBottomOffsetPtr[layer] = &cfg_scaledRefLayerBottomOffset[layer]; |
---|
417 | } |
---|
418 | #endif |
---|
419 | #if RC_SHVC_HARMONIZATION |
---|
420 | cfg_RCEnableRateControl[layer] = &m_acLayerCfg[layer].m_RCEnableRateControl; |
---|
421 | cfg_RCTargetBitRate[layer] = &m_acLayerCfg[layer].m_RCTargetBitrate; |
---|
422 | cfg_RCKeepHierarchicalBit[layer] = &m_acLayerCfg[layer].m_RCKeepHierarchicalBit; |
---|
423 | cfg_RCLCULevelRC[layer] = &m_acLayerCfg[layer].m_RCLCULevelRC; |
---|
424 | cfg_RCUseLCUSeparateModel[layer] = &m_acLayerCfg[layer].m_RCUseLCUSeparateModel; |
---|
425 | cfg_RCInitialQP[layer] = &m_acLayerCfg[layer].m_RCInitialQP; |
---|
426 | cfg_RCForceIntraQP[layer] = &m_acLayerCfg[layer].m_RCForceIntraQP; |
---|
427 | #endif |
---|
428 | } |
---|
429 | #if AVC_BASE |
---|
430 | string cfg_BLInputFile; |
---|
431 | #endif |
---|
432 | #if AVC_SYNTAX |
---|
433 | string cfg_BLSyntaxFile; |
---|
434 | #endif |
---|
435 | #else |
---|
436 | string cfg_InputFile; |
---|
437 | string cfg_BitstreamFile; |
---|
438 | string cfg_ReconFile; |
---|
439 | string cfg_dQPFile; |
---|
440 | #endif |
---|
441 | string cfg_ColumnWidth; |
---|
442 | string cfg_RowHeight; |
---|
443 | string cfg_ScalingListFile; |
---|
444 | string cfg_startOfCodedInterval; |
---|
445 | string cfg_codedPivotValue; |
---|
446 | string cfg_targetPivotValue; |
---|
447 | po::Options opts; |
---|
448 | opts.addOptions() |
---|
449 | ("help", do_help, false, "this help text") |
---|
450 | ("c", po::parseConfigFile, "configuration file name") |
---|
451 | |
---|
452 | // File, I/O and source parameters |
---|
453 | #if SVC_EXTENSION |
---|
454 | ("InputFile%d,-i%d", cfg_InputFile, string(""), MAX_LAYERS, "original YUV input file name for layer %d") |
---|
455 | ("ReconFile%d,-o%d", cfg_ReconFile, string(""), MAX_LAYERS, "reconstruction YUV input file name for layer %d") |
---|
456 | ("LayerConfig%d,-lc%d", cfg_LayerCfgFile, string(""), MAX_LAYERS, "layer %d configuration file name") |
---|
457 | ("SourceWidth%d,-wdt%d", cfg_SourceWidth, 0, MAX_LAYERS, "Source picture width for layer %d") |
---|
458 | ("SourceHeight%d,-hgt%d", cfg_SourceHeight, 0, MAX_LAYERS, "Source picture height for layer %d") |
---|
459 | ("FrameRate%d,-fr%d", cfg_FrameRate, 0, MAX_LAYERS, "Frame rate for layer %d") |
---|
460 | ("LambdaModifier%d,-LM%d", m_adLambdaModifier, ( double )1.0, MAX_TLAYER, "Lambda modifier for temporal layer %d") |
---|
461 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
462 | #if M0457_PREDICTION_INDICATIONS |
---|
463 | ("NumSamplePredRefLayers%d",cfg_numSamplePredRefLayers, -1, MAX_LAYERS, "Number of sample prediction reference layers") |
---|
464 | ("SamplePredRefLayerIds%d", cfg_samplePredRefLayerIdsPtr, string(""), MAX_LAYERS, "sample pred reference layer IDs") |
---|
465 | ("NumMotionPredRefLayers%d",cfg_numMotionPredRefLayers, -1, MAX_LAYERS, "Number of motion prediction reference layers") |
---|
466 | ("MotionPredRefLayerIds%d", cfg_motionPredRefLayerIdsPtr, string(""), MAX_LAYERS, "motion pred reference layer IDs") |
---|
467 | #else |
---|
468 | ("NumDirectRefLayers%d", cfg_numDirectRefLayers, -1, MAX_LAYERS, "Number of direct reference layers") |
---|
469 | ("RefLayerIds%d", cfg_refLayerIdsPtr, string(""), MAX_LAYERS, "direct reference layer IDs") |
---|
470 | #endif |
---|
471 | ("NumActiveRefLayers%d", cfg_numActiveRefLayers, -1, MAX_LAYERS, "Number of active reference layers") |
---|
472 | ("PredLayerIds%d", cfg_predLayerIdsPtr, string(""), MAX_LAYERS, "inter-layer prediction layer IDs") |
---|
473 | #endif |
---|
474 | ("NumLayers", m_numLayers, 1, "Number of layers to code") |
---|
475 | ("ConformanceMode%d", cfg_conformanceMode,0, MAX_LAYERS, "Window conformance mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping") |
---|
476 | ("ScalabilityMask0", m_scalabilityMask[0], 0, "scalability_mask[0] (multiview)") |
---|
477 | ("ScalabilityMask1", m_scalabilityMask[1], 1, "scalability_mask[1] (scalable)" ) |
---|
478 | ("BitstreamFile,b", cfg_BitstreamFile, string(""), "Bitstream output file name") |
---|
479 | ("InputBitDepth", m_inputBitDepthY, 8, "Bit-depth of input file") |
---|
480 | ("OutputBitDepth", m_outputBitDepthY, 0, "Bit-depth of output file (default:InternalBitDepth)") |
---|
481 | ("InternalBitDepth", m_internalBitDepthY, 0, "Bit-depth the codec operates at. (default:InputBitDepth)" |
---|
482 | "If different to InputBitDepth, source data will be converted") |
---|
483 | ("InputBitDepthC", m_inputBitDepthC, 0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)") |
---|
484 | ("OutputBitDepthC", m_outputBitDepthC, 0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)") |
---|
485 | ("InternalBitDepthC", m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)") |
---|
486 | #if SCALED_REF_LAYER_OFFSETS |
---|
487 | ("NumScaledRefLayerOffsets%d", cfg_numScaledRefLayerOffsets, 0, MAX_LAYERS, "Number of scaled offset layer sets ") |
---|
488 | ("ScaledRefLayerLeftOffset%d", cfg_scaledRefLayerLeftOffsetPtr, string(""), MAX_LAYERS, "Horizontal offset of top-left luma sample of scaled base layer picture with respect to" |
---|
489 | " top-left luma sample of the EL picture, in units of two luma samples") |
---|
490 | ("ScaledRefLayerTopOffset%d", cfg_scaledRefLayerTopOffsetPtr, string(""), MAX_LAYERS, "Vertical offset of top-left luma sample of scaled base layer picture with respect to" |
---|
491 | " top-left luma sample of the EL picture, in units of two luma samples") |
---|
492 | ("ScaledRefLayerRightOffset%d", cfg_scaledRefLayerRightOffsetPtr, string(""), MAX_LAYERS, "Horizontal offset of bottom-right luma sample of scaled base layer picture with respect to" |
---|
493 | " bottom-right luma sample of the EL picture, in units of two luma samples") |
---|
494 | ("ScaledRefLayerBottomOffset%d", cfg_scaledRefLayerBottomOffsetPtr,string(""), MAX_LAYERS, "Vertical offset of bottom-right luma sample of scaled base layer picture with respect to" |
---|
495 | " bottom-right luma sample of the EL picture, in units of two luma samples") |
---|
496 | #endif |
---|
497 | #if AVC_BASE |
---|
498 | ("AvcBase,-avc", m_avcBaseLayerFlag, 0, "avc_base_layer_flag") |
---|
499 | ("InputBLFile,-ibl", cfg_BLInputFile, string(""), "Base layer rec YUV input file name") |
---|
500 | #if AVC_SYNTAX |
---|
501 | ("InputBLSyntaxFile,-ibs", cfg_BLSyntaxFile, string(""), "Base layer syntax input file name") |
---|
502 | #endif |
---|
503 | #endif |
---|
504 | #if REF_IDX_FRAMEWORK |
---|
505 | ("EnableElRapB,-use-rap-b", m_elRapSliceBEnabled, 0, "Set ILP over base-layer I picture to B picture (default is P picture)") |
---|
506 | #endif |
---|
507 | #if M0457_IL_SAMPLE_PRED_ONLY_FLAG |
---|
508 | ("IlSampleOnlyPred%d", m_ilSampleOnlyPred, 0, MAX_LAYERS, "Set inter_layer_sample_pred_only_flag for all slices") |
---|
509 | #endif |
---|
510 | #else |
---|
511 | ("InputFile,i", cfg_InputFile, string(""), "Original YUV input file name") |
---|
512 | ("BitstreamFile,b", cfg_BitstreamFile, string(""), "Bitstream output file name") |
---|
513 | ("ReconFile,o", cfg_ReconFile, string(""), "Reconstructed YUV output file name") |
---|
514 | ("SourceWidth,-wdt", m_iSourceWidth, 0, "Source picture width") |
---|
515 | ("SourceHeight,-hgt", m_iSourceHeight, 0, "Source picture height") |
---|
516 | ("InputBitDepth", m_inputBitDepthY, 8, "Bit-depth of input file") |
---|
517 | ("OutputBitDepth", m_outputBitDepthY, 0, "Bit-depth of output file (default:InternalBitDepth)") |
---|
518 | ("InternalBitDepth", m_internalBitDepthY, 0, "Bit-depth the codec operates at. (default:InputBitDepth)" |
---|
519 | "If different to InputBitDepth, source data will be converted") |
---|
520 | ("InputBitDepthC", m_inputBitDepthC, 0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)") |
---|
521 | ("OutputBitDepthC", m_outputBitDepthC, 0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)") |
---|
522 | ("InternalBitDepthC", m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)") |
---|
523 | ("ConformanceMode", m_conformanceMode, 0, "Window conformance mode (0: no window, 1:automatic padding, 2:padding, 3:conformance") |
---|
524 | ("HorizontalPadding,-pdx",m_aiPad[0], 0, "Horizontal source padding for conformance window mode 2") |
---|
525 | ("VerticalPadding,-pdy", m_aiPad[1], 0, "Vertical source padding for conformance window mode 2") |
---|
526 | ("ConfLeft", m_confLeft, 0, "Left offset for window conformance mode 3") |
---|
527 | ("ConfRight", m_confRight, 0, "Right offset for window conformance mode 3") |
---|
528 | ("ConfTop", m_confTop, 0, "Top offset for window conformance mode 3") |
---|
529 | ("ConfBottom", m_confBottom, 0, "Bottom offset for window conformance mode 3") |
---|
530 | ("FrameRate,-fr", m_iFrameRate, 0, "Frame rate") |
---|
531 | #endif |
---|
532 | ("FrameSkip,-fs", m_FrameSkip, 0u, "Number of frames to skip at start of input YUV") |
---|
533 | ("FramesToBeEncoded,f", m_framesToBeEncoded, 0, "Number of frames to be encoded (default=all)") |
---|
534 | |
---|
535 | // Profile and level |
---|
536 | ("Profile", m_profile, Profile::NONE, "Profile to be used when encoding (Incomplete)") |
---|
537 | ("Level", m_level, Level::NONE, "Level limit to be used, eg 5.1 (Incomplete)") |
---|
538 | ("Tier", m_levelTier, Level::MAIN, "Tier to use for interpretation of --Level") |
---|
539 | |
---|
540 | ("ProgressiveSource", m_progressiveSourceFlag, false, "Indicate that source is progressive") |
---|
541 | ("InterlacedSource", m_interlacedSourceFlag, false, "Indicate that source is interlaced") |
---|
542 | ("NonPackedSource", m_nonPackedConstraintFlag, false, "Indicate that source does not contain frame packing") |
---|
543 | ("FrameOnly", m_frameOnlyConstraintFlag, false, "Indicate that the bitstream contains only frames") |
---|
544 | |
---|
545 | // Unit definition parameters |
---|
546 | ("MaxCUWidth", m_uiMaxCUWidth, 64u) |
---|
547 | ("MaxCUHeight", m_uiMaxCUHeight, 64u) |
---|
548 | // todo: remove defaults from MaxCUSize |
---|
549 | ("MaxCUSize,s", m_uiMaxCUWidth, 64u, "Maximum CU size") |
---|
550 | ("MaxCUSize,s", m_uiMaxCUHeight, 64u, "Maximum CU size") |
---|
551 | ("MaxPartitionDepth,h", m_uiMaxCUDepth, 4u, "CU depth") |
---|
552 | |
---|
553 | ("QuadtreeTULog2MaxSize", m_uiQuadtreeTULog2MaxSize, 6u, "Maximum TU size in logarithm base 2") |
---|
554 | ("QuadtreeTULog2MinSize", m_uiQuadtreeTULog2MinSize, 2u, "Minimum TU size in logarithm base 2") |
---|
555 | |
---|
556 | ("QuadtreeTUMaxDepthIntra", m_uiQuadtreeTUMaxDepthIntra, 1u, "Depth of TU tree for intra CUs") |
---|
557 | ("QuadtreeTUMaxDepthInter", m_uiQuadtreeTUMaxDepthInter, 2u, "Depth of TU tree for inter CUs") |
---|
558 | |
---|
559 | // Coding structure paramters |
---|
560 | #if SVC_EXTENSION |
---|
561 | ("IntraPeriod%d,-ip%d", cfg_IntraPeriod, -1, MAX_LAYERS, "intra period in frames for layer %d, (-1: only first frame)") |
---|
562 | #else |
---|
563 | ("IntraPeriod,-ip", m_iIntraPeriod, -1, "Intra period in frames, (-1: only first frame)") |
---|
564 | #endif |
---|
565 | ("DecodingRefreshType,-dr", m_iDecodingRefreshType, 0, "Intra refresh type (0:none 1:CRA 2:IDR)") |
---|
566 | ("GOPSize,g", m_iGOPSize, 1, "GOP size of temporal structure") |
---|
567 | // motion options |
---|
568 | ("FastSearch", m_iFastSearch, 1, "0:Full search 1:Diamond 2:PMVFAST") |
---|
569 | ("SearchRange,-sr", m_iSearchRange, 96, "Motion search range") |
---|
570 | ("BipredSearchRange", m_bipredSearchRange, 4, "Motion search range for bipred refinement") |
---|
571 | ("HadamardME", m_bUseHADME, true, "Hadamard ME for fractional-pel") |
---|
572 | ("ASR", m_bUseASR, false, "Adaptive motion search range") |
---|
573 | |
---|
574 | #if SVC_EXTENSION |
---|
575 | ("LambdaModifier%d,-LM%d", m_adLambdaModifier, ( double )1.0, MAX_TLAYER, "Lambda modifier for temporal layer %d") |
---|
576 | #else |
---|
577 | // Mode decision parameters |
---|
578 | ("LambdaModifier0,-LM0", m_adLambdaModifier[ 0 ], ( Double )1.0, "Lambda modifier for temporal layer 0") |
---|
579 | ("LambdaModifier1,-LM1", m_adLambdaModifier[ 1 ], ( Double )1.0, "Lambda modifier for temporal layer 1") |
---|
580 | ("LambdaModifier2,-LM2", m_adLambdaModifier[ 2 ], ( Double )1.0, "Lambda modifier for temporal layer 2") |
---|
581 | ("LambdaModifier3,-LM3", m_adLambdaModifier[ 3 ], ( Double )1.0, "Lambda modifier for temporal layer 3") |
---|
582 | ("LambdaModifier4,-LM4", m_adLambdaModifier[ 4 ], ( Double )1.0, "Lambda modifier for temporal layer 4") |
---|
583 | ("LambdaModifier5,-LM5", m_adLambdaModifier[ 5 ], ( Double )1.0, "Lambda modifier for temporal layer 5") |
---|
584 | ("LambdaModifier6,-LM6", m_adLambdaModifier[ 6 ], ( Double )1.0, "Lambda modifier for temporal layer 6") |
---|
585 | ("LambdaModifier7,-LM7", m_adLambdaModifier[ 7 ], ( Double )1.0, "Lambda modifier for temporal layer 7") |
---|
586 | #endif |
---|
587 | |
---|
588 | /* Quantization parameters */ |
---|
589 | #if SVC_EXTENSION |
---|
590 | ("QP%d,-q%d", cfg_fQP, 30.0, MAX_LAYERS, "Qp value for layer %d, if value is float, QP is switched once during encoding") |
---|
591 | #else |
---|
592 | ("QP,q", m_fQP, 30.0, "Qp value, if value is float, QP is switched once during encoding") |
---|
593 | #endif |
---|
594 | ("DeltaQpRD,-dqr",m_uiDeltaQpRD, 0u, "max dQp offset for slice") |
---|
595 | ("MaxDeltaQP,d", m_iMaxDeltaQP, 0, "max dQp offset for block") |
---|
596 | ("MaxCuDQPDepth,-dqd", m_iMaxCuDQPDepth, 0, "max depth for a minimum CuDQP") |
---|
597 | |
---|
598 | ("CbQpOffset,-cbqpofs", m_cbQpOffset, 0, "Chroma Cb QP Offset") |
---|
599 | ("CrQpOffset,-crqpofs", m_crQpOffset, 0, "Chroma Cr QP Offset") |
---|
600 | |
---|
601 | #if ADAPTIVE_QP_SELECTION |
---|
602 | ("AdaptiveQpSelection,-aqps", m_bUseAdaptQpSelect, false, "AdaptiveQpSelection") |
---|
603 | #endif |
---|
604 | |
---|
605 | ("AdaptiveQP,-aq", m_bUseAdaptiveQP, false, "QP adaptation based on a psycho-visual model") |
---|
606 | ("MaxQPAdaptationRange,-aqr", m_iQPAdaptationRange, 6, "QP adaptation range") |
---|
607 | #if !SVC_EXTENSION |
---|
608 | ("dQPFile,m", cfg_dQPFile, string(""), "dQP file name") |
---|
609 | #endif |
---|
610 | ("RDOQ", m_useRDOQ, true ) |
---|
611 | ("RDOQTS", m_useRDOQTS, true ) |
---|
612 | ("RDpenalty", m_rdPenalty, 0, "RD-penalty for 32x32 TU for intra in non-intra slices. 0:disbaled 1:RD-penalty 2:maximum RD-penalty") |
---|
613 | // Entropy coding parameters |
---|
614 | ("SBACRD", m_bUseSBACRD, true, "SBAC based RD estimation") |
---|
615 | |
---|
616 | // Deblocking filter parameters |
---|
617 | ("LoopFilterDisable", m_bLoopFilterDisable, false ) |
---|
618 | ("LoopFilterOffsetInPPS", m_loopFilterOffsetInPPS, false ) |
---|
619 | ("LoopFilterBetaOffset_div2", m_loopFilterBetaOffsetDiv2, 0 ) |
---|
620 | ("LoopFilterTcOffset_div2", m_loopFilterTcOffsetDiv2, 0 ) |
---|
621 | ("DeblockingFilterControlPresent", m_DeblockingFilterControlPresent, false ) |
---|
622 | ("DeblockingFilterMetric", m_DeblockingFilterMetric, false ) |
---|
623 | |
---|
624 | // Coding tools |
---|
625 | ("AMP", m_enableAMP, true, "Enable asymmetric motion partitions") |
---|
626 | ("TransformSkip", m_useTransformSkip, false, "Intra transform skipping") |
---|
627 | ("TransformSkipFast", m_useTransformSkipFast, false, "Fast intra transform skipping") |
---|
628 | ("SAO", m_bUseSAO, true, "Enable Sample Adaptive Offset") |
---|
629 | ("MaxNumOffsetsPerPic", m_maxNumOffsetsPerPic, 2048, "Max number of SAO offset per picture (Default: 2048)") |
---|
630 | ("SAOLcuBoundary", m_saoLcuBoundary, false, "0: right/bottom LCU boundary areas skipped from SAO parameter estimation, 1: non-deblocked pixels are used for those areas") |
---|
631 | ("SAOLcuBasedOptimization", m_saoLcuBasedOptimization, true, "0: SAO picture-based optimization, 1: SAO LCU-based optimization ") |
---|
632 | ("SliceMode", m_sliceMode, 0, "0: Disable all Recon slice limits, 1: Enforce max # of LCUs, 2: Enforce max # of bytes, 3:specify tiles per dependent slice") |
---|
633 | ("SliceArgument", m_sliceArgument, 0, "Depending on SliceMode being:" |
---|
634 | "\t1: max number of CTUs per slice" |
---|
635 | "\t2: max number of bytes per slice" |
---|
636 | "\t3: max number of tiles per slice") |
---|
637 | ("SliceSegmentMode", m_sliceSegmentMode, 0, "0: Disable all slice segment limits, 1: Enforce max # of LCUs, 2: Enforce max # of bytes, 3:specify tiles per dependent slice") |
---|
638 | ("SliceSegmentArgument", m_sliceSegmentArgument, 0, "Depending on SliceSegmentMode being:" |
---|
639 | "\t1: max number of CTUs per slice segment" |
---|
640 | "\t2: max number of bytes per slice segment" |
---|
641 | "\t3: max number of tiles per slice segment") |
---|
642 | ("LFCrossSliceBoundaryFlag", m_bLFCrossSliceBoundaryFlag, true) |
---|
643 | |
---|
644 | ("ConstrainedIntraPred", m_bUseConstrainedIntraPred, false, "Constrained Intra Prediction") |
---|
645 | |
---|
646 | ("PCMEnabledFlag", m_usePCM, false) |
---|
647 | ("PCMLog2MaxSize", m_pcmLog2MaxSize, 5u) |
---|
648 | ("PCMLog2MinSize", m_uiPCMLog2MinSize, 3u) |
---|
649 | ("PCMInputBitDepthFlag", m_bPCMInputBitDepthFlag, true) |
---|
650 | ("PCMFilterDisableFlag", m_bPCMFilterDisableFlag, false) |
---|
651 | |
---|
652 | ("LosslessCuEnabled", m_useLossless, false) |
---|
653 | |
---|
654 | ("WeightedPredP,-wpP", m_useWeightedPred, false, "Use weighted prediction in P slices") |
---|
655 | ("WeightedPredB,-wpB", m_useWeightedBiPred, false, "Use weighted (bidirectional) prediction in B slices") |
---|
656 | ("Log2ParallelMergeLevel", m_log2ParallelMergeLevel, 2u, "Parallel merge estimation region") |
---|
657 | ("UniformSpacingIdc", m_iUniformSpacingIdr, 0, "Indicates if the column and row boundaries are distributed uniformly") |
---|
658 | ("NumTileColumnsMinus1", m_iNumColumnsMinus1, 0, "Number of columns in a picture minus 1") |
---|
659 | ("ColumnWidthArray", cfg_ColumnWidth, string(""), "Array containing ColumnWidth values in units of LCU") |
---|
660 | ("NumTileRowsMinus1", m_iNumRowsMinus1, 0, "Number of rows in a picture minus 1") |
---|
661 | ("RowHeightArray", cfg_RowHeight, string(""), "Array containing RowHeight values in units of LCU") |
---|
662 | ("LFCrossTileBoundaryFlag", m_bLFCrossTileBoundaryFlag, true, "1: cross-tile-boundary loop filtering. 0:non-cross-tile-boundary loop filtering") |
---|
663 | ("WaveFrontSynchro", m_iWaveFrontSynchro, 0, "0: no synchro; 1 synchro with TR; 2 TRR etc") |
---|
664 | ("ScalingList", m_useScalingListId, 0, "0: no scaling list, 1: default scaling lists, 2: scaling lists specified in ScalingListFile") |
---|
665 | ("ScalingListFile", cfg_ScalingListFile, string(""), "Scaling list file name") |
---|
666 | ("SignHideFlag,-SBH", m_signHideFlag, 1) |
---|
667 | ("MaxNumMergeCand", m_maxNumMergeCand, 5u, "Maximum number of merge candidates") |
---|
668 | |
---|
669 | /* Misc. */ |
---|
670 | ("SEIDecodedPictureHash", m_decodedPictureHashSEIEnabled, 0, "Control generation of decode picture hash SEI messages\n" |
---|
671 | "\t3: checksum\n" |
---|
672 | "\t2: CRC\n" |
---|
673 | "\t1: use MD5\n" |
---|
674 | "\t0: disable") |
---|
675 | ("SEIpictureDigest", m_decodedPictureHashSEIEnabled, 0, "deprecated alias for SEIDecodedPictureHash") |
---|
676 | ("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") |
---|
677 | ("FEN", m_bUseFastEnc, false, "fast encoder setting") |
---|
678 | ("ECU", m_bUseEarlyCU, false, "Early CU setting") |
---|
679 | ("FDM", m_useFastDecisionForMerge, true, "Fast decision for Merge RD Cost") |
---|
680 | ("CFM", m_bUseCbfFastMode, false, "Cbf fast mode setting") |
---|
681 | ("ESD", m_useEarlySkipDetection, false, "Early SKIP detection setting") |
---|
682 | #if FAST_INTRA_SHVC |
---|
683 | ("FIS", m_useFastIntraScalable, false, "Fast Intra Decision for Scalable HEVC") |
---|
684 | #endif |
---|
685 | #if RATE_CONTROL_LAMBDA_DOMAIN |
---|
686 | #if RC_SHVC_HARMONIZATION |
---|
687 | ("RateControl%d", cfg_RCEnableRateControl, false, MAX_LAYERS, "Rate control: enable rate control for layer %d") |
---|
688 | ("TargetBitrate%d", cfg_RCTargetBitRate, 0, MAX_LAYERS, "Rate control: target bitrate for layer %d") |
---|
689 | ("KeepHierarchicalBit%d", cfg_RCKeepHierarchicalBit, false, MAX_LAYERS, "Rate control: keep hierarchical bit allocation for layer %d") |
---|
690 | ("LCULevelRateControl%d", cfg_RCLCULevelRC, true, MAX_LAYERS, "Rate control: LCU level RC") |
---|
691 | ("RCLCUSeparateModel%d", cfg_RCUseLCUSeparateModel, true, MAX_LAYERS, "Rate control: Use LCU level separate R-lambda model") |
---|
692 | ("InitialQP%d", cfg_RCInitialQP, 0, MAX_LAYERS, "Rate control: initial QP") |
---|
693 | ("RCForceIntraQP%d", cfg_RCForceIntraQP, false, MAX_LAYERS, "Rate control: force intra QP to be equal to initial QP") |
---|
694 | #else |
---|
695 | ( "RateControl", m_RCEnableRateControl, false, "Rate control: enable rate control" ) |
---|
696 | ( "TargetBitrate", m_RCTargetBitrate, 0, "Rate control: target bitrate" ) |
---|
697 | #if M0036_RC_IMPROVEMENT |
---|
698 | ( "KeepHierarchicalBit", m_RCKeepHierarchicalBit, 0, "Rate control: 0: equal bit allocation; 1: fixed ratio bit allocation; 2: adaptive ratio bit allocation" ) |
---|
699 | #else |
---|
700 | ( "KeepHierarchicalBit", m_RCKeepHierarchicalBit, false, "Rate control: keep hierarchical bit allocation in rate control algorithm" ) |
---|
701 | #endif |
---|
702 | ( "LCULevelRateControl", m_RCLCULevelRC, true, "Rate control: true: LCU level RC; false: picture level RC" ) |
---|
703 | ( "RCLCUSeparateModel", m_RCUseLCUSeparateModel, true, "Rate control: use LCU level separate R-lambda model" ) |
---|
704 | ( "InitialQP", m_RCInitialQP, 0, "Rate control: initial QP" ) |
---|
705 | ( "RCForceIntraQP", m_RCForceIntraQP, false, "Rate control: force intra QP to be equal to initial QP" ) |
---|
706 | #endif |
---|
707 | #else |
---|
708 | ("RateCtrl,-rc", m_enableRateCtrl, false, "Rate control on/off") |
---|
709 | ("TargetBitrate,-tbr", m_targetBitrate, 0, "Input target bitrate") |
---|
710 | ("NumLCUInUnit,-nu", m_numLCUInUnit, 0, "Number of LCUs in an Unit") |
---|
711 | #endif |
---|
712 | |
---|
713 | ("TransquantBypassEnableFlag", m_TransquantBypassEnableFlag, false, "transquant_bypass_enable_flag indicator in PPS") |
---|
714 | ("CUTransquantBypassFlagValue", m_CUTransquantBypassFlagValue, false, "Fixed cu_transquant_bypass_flag value, when transquant_bypass_enable_flag is enabled") |
---|
715 | ("RecalculateQPAccordingToLambda", m_recalculateQPAccordingToLambda, false, "Recalculate QP values according to lambda values. Do not suggest to be enabled in all intra case") |
---|
716 | ("StrongIntraSmoothing,-sis", m_useStrongIntraSmoothing, true, "Enable strong intra smoothing for 32x32 blocks") |
---|
717 | ("SEIActiveParameterSets", m_activeParameterSetsSEIEnabled, 0, "Enable generation of active parameter sets SEI messages") |
---|
718 | ("VuiParametersPresent,-vui", m_vuiParametersPresentFlag, false, "Enable generation of vui_parameters()") |
---|
719 | ("AspectRatioInfoPresent", m_aspectRatioInfoPresentFlag, false, "Signals whether aspect_ratio_idc is present") |
---|
720 | ("AspectRatioIdc", m_aspectRatioIdc, 0, "aspect_ratio_idc") |
---|
721 | ("SarWidth", m_sarWidth, 0, "horizontal size of the sample aspect ratio") |
---|
722 | ("SarHeight", m_sarHeight, 0, "vertical size of the sample aspect ratio") |
---|
723 | ("OverscanInfoPresent", m_overscanInfoPresentFlag, false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n") |
---|
724 | ("OverscanAppropriate", m_overscanAppropriateFlag, false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n") |
---|
725 | ("VideoSignalTypePresent", m_videoSignalTypePresentFlag, false, "Signals whether video_format, video_full_range_flag, and colour_description_present_flag are present") |
---|
726 | ("VideoFormat", m_videoFormat, 5, "Indicates representation of pictures") |
---|
727 | ("VideoFullRange", m_videoFullRangeFlag, false, "Indicates the black level and range of luma and chroma signals") |
---|
728 | ("ColourDescriptionPresent", m_colourDescriptionPresentFlag, false, "Signals whether colour_primaries, transfer_characteristics and matrix_coefficients are present") |
---|
729 | ("ColourPrimaries", m_colourPrimaries, 2, "Indicates chromaticity coordinates of the source primaries") |
---|
730 | ("TransferCharateristics", m_transferCharacteristics, 2, "Indicates the opto-electronic transfer characteristics of the source") |
---|
731 | ("MatrixCoefficients", m_matrixCoefficients, 2, "Describes the matrix coefficients used in deriving luma and chroma from RGB primaries") |
---|
732 | ("ChromaLocInfoPresent", m_chromaLocInfoPresentFlag, false, "Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present") |
---|
733 | ("ChromaSampleLocTypeTopField", m_chromaSampleLocTypeTopField, 0, "Specifies the location of chroma samples for top field") |
---|
734 | ("ChromaSampleLocTypeBottomField", m_chromaSampleLocTypeBottomField, 0, "Specifies the location of chroma samples for bottom field") |
---|
735 | ("NeutralChromaIndication", m_neutralChromaIndicationFlag, false, "Indicates that the value of all decoded chroma samples is equal to 1<<(BitDepthCr-1)") |
---|
736 | ("DefaultDisplayWindowFlag", m_defaultDisplayWindowFlag, false, "Indicates the presence of the Default Window parameters") |
---|
737 | ("DefDispWinLeftOffset", m_defDispWinLeftOffset, 0, "Specifies the left offset of the default display window from the conformance window") |
---|
738 | ("DefDispWinRightOffset", m_defDispWinRightOffset, 0, "Specifies the right offset of the default display window from the conformance window") |
---|
739 | ("DefDispWinTopOffset", m_defDispWinTopOffset, 0, "Specifies the top offset of the default display window from the conformance window") |
---|
740 | ("DefDispWinBottomOffset", m_defDispWinBottomOffset, 0, "Specifies the bottom offset of the default display window from the conformance window") |
---|
741 | ("FrameFieldInfoPresentFlag", m_frameFieldInfoPresentFlag, false, "Indicates that pic_struct and field coding related values are present in picture timing SEI messages") |
---|
742 | ("PocProportionalToTimingFlag", m_pocProportionalToTimingFlag, false, "Indicates that the POC value is proportional to the output time w.r.t. first picture in CVS") |
---|
743 | ("NumTicksPocDiffOneMinus1", m_numTicksPocDiffOneMinus1, 0, "Number of ticks minus 1 that for a POC difference of one") |
---|
744 | ("BitstreamRestriction", m_bitstreamRestrictionFlag, false, "Signals whether bitstream restriction parameters are present") |
---|
745 | ("TilesFixedStructure", m_tilesFixedStructureFlag, false, "Indicates that each active picture parameter set has the same values of the syntax elements related to tiles") |
---|
746 | ("MotionVectorsOverPicBoundaries", m_motionVectorsOverPicBoundariesFlag, false, "Indicates that no samples outside the picture boundaries are used for inter prediction") |
---|
747 | ("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") |
---|
748 | ("MaxBitsPerMinCuDenom", m_maxBitsPerMinCuDenom, 1, "Indicates an upper bound for the number of bits of coding_unit() data") |
---|
749 | ("Log2MaxMvLengthHorizontal", m_log2MaxMvLengthHorizontal, 15, "Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units") |
---|
750 | ("Log2MaxMvLengthVertical", m_log2MaxMvLengthVertical, 15, "Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units") |
---|
751 | ("SEIRecoveryPoint", m_recoveryPointSEIEnabled, 0, "Control generation of recovery point SEI messages") |
---|
752 | ("SEIBufferingPeriod", m_bufferingPeriodSEIEnabled, 0, "Control generation of buffering period SEI messages") |
---|
753 | ("SEIPictureTiming", m_pictureTimingSEIEnabled, 0, "Control generation of picture timing SEI messages") |
---|
754 | ("SEIToneMappingInfo", m_toneMappingInfoSEIEnabled, false, "Control generation of Tone Mapping SEI messages") |
---|
755 | ("SEIToneMapId", m_toneMapId, 0, "Specifies Id of Tone Mapping SEI message for a given session") |
---|
756 | ("SEIToneMapCancelFlag", m_toneMapCancelFlag, false, "Indicates that Tone Mapping SEI message cancels the persistance or follows") |
---|
757 | ("SEIToneMapPersistenceFlag", m_toneMapPersistenceFlag, true, "Specifies the persistence of the Tone Mapping SEI message") |
---|
758 | ("SEIToneMapCodedDataBitDepth", m_toneMapCodedDataBitDepth, 8, "Specifies Coded Data BitDepth of Tone Mapping SEI messages") |
---|
759 | ("SEIToneMapTargetBitDepth", m_toneMapTargetBitDepth, 8, "Specifies Output BitDepth of Tome mapping function") |
---|
760 | ("SEIToneMapModelId", m_toneMapModelId, 0, "Specifies Model utilized for mapping coded data into target_bit_depth range\n" |
---|
761 | "\t0: linear mapping with clipping\n" |
---|
762 | "\t1: sigmoidal mapping\n" |
---|
763 | "\t2: user-defined table mapping\n" |
---|
764 | "\t3: piece-wise linear mapping\n" |
---|
765 | "\t4: luminance dynamic range information ") |
---|
766 | ("SEIToneMapMinValue", m_toneMapMinValue, 0, "Specifies the minimum value in mode 0") |
---|
767 | ("SEIToneMapMaxValue", m_toneMapMaxValue, 1023, "Specifies the maxmum value in mode 0") |
---|
768 | ("SEIToneMapSigmoidMidpoint", m_sigmoidMidpoint, 512, "Specifies the centre point in mode 1") |
---|
769 | ("SEIToneMapSigmoidWidth", m_sigmoidWidth, 960, "Specifies the distance between 5% and 95% values of the target_bit_depth in mode 1") |
---|
770 | ("SEIToneMapStartOfCodedInterval", cfg_startOfCodedInterval, string(""), "Array of user-defined mapping table") |
---|
771 | ("SEIToneMapNumPivots", m_numPivots, 0, "Specifies the number of pivot points in mode 3") |
---|
772 | ("SEIToneMapCodedPivotValue", cfg_codedPivotValue, string(""), "Array of pivot point") |
---|
773 | ("SEIToneMapTargetPivotValue", cfg_targetPivotValue, string(""), "Array of pivot point") |
---|
774 | ("SEIToneMapCameraIsoSpeedIdc", m_cameraIsoSpeedIdc, 0, "Indicates the camera ISO speed for daylight illumination") |
---|
775 | ("SEIToneMapCameraIsoSpeedValue", m_cameraIsoSpeedValue, 400, "Specifies the camera ISO speed for daylight illumination of Extended_ISO") |
---|
776 | ("SEIToneMapExposureCompensationValueSignFlag", m_exposureCompensationValueSignFlag, 0, "Specifies the sign of ExposureCompensationValue") |
---|
777 | ("SEIToneMapExposureCompensationValueNumerator", m_exposureCompensationValueNumerator, 0, "Specifies the numerator of ExposureCompensationValue") |
---|
778 | ("SEIToneMapExposureCompensationValueDenomIdc", m_exposureCompensationValueDenomIdc, 2, "Specifies the denominator of ExposureCompensationValue") |
---|
779 | ("SEIToneMapRefScreenLuminanceWhite", m_refScreenLuminanceWhite, 350, "Specifies reference screen brightness setting in units of candela per square metre") |
---|
780 | ("SEIToneMapExtendedRangeWhiteLevel", m_extendedRangeWhiteLevel, 800, "Indicates the luminance dynamic range") |
---|
781 | ("SEIToneMapNominalBlackLevelLumaCodeValue", m_nominalBlackLevelLumaCodeValue, 16, "Specifies luma sample value of the nominal black level assigned decoded pictures") |
---|
782 | ("SEIToneMapNominalWhiteLevelLumaCodeValue", m_nominalWhiteLevelLumaCodeValue, 235, "Specifies luma sample value of the nominal white level assigned decoded pictures") |
---|
783 | ("SEIToneMapExtendedWhiteLevelLumaCodeValue", m_extendedWhiteLevelLumaCodeValue, 300, "Specifies luma sample value of the extended dynamic range assigned decoded pictures") |
---|
784 | ("SEIFramePacking", m_framePackingSEIEnabled, 0, "Control generation of frame packing SEI messages") |
---|
785 | ("SEIFramePackingType", m_framePackingSEIType, 0, "Define frame packing arrangement\n" |
---|
786 | "\t0: checkerboard - pixels alternatively represent either frames\n" |
---|
787 | "\t1: column alternation - frames are interlaced by column\n" |
---|
788 | "\t2: row alternation - frames are interlaced by row\n" |
---|
789 | "\t3: side by side - frames are displayed horizontally\n" |
---|
790 | "\t4: top bottom - frames are displayed vertically\n" |
---|
791 | "\t5: frame alternation - one frame is alternated with the other") |
---|
792 | ("SEIFramePackingId", m_framePackingSEIId, 0, "Id of frame packing SEI message for a given session") |
---|
793 | ("SEIFramePackingQuincunx", m_framePackingSEIQuincunx, 0, "Indicate the presence of a Quincunx type video frame") |
---|
794 | ("SEIFramePackingInterpretation", m_framePackingSEIInterpretation, 0, "Indicate the interpretation of the frame pair\n" |
---|
795 | "\t0: unspecified\n" |
---|
796 | "\t1: stereo pair, frame0 represents left view\n" |
---|
797 | "\t2: stereo pair, frame0 represents right view") |
---|
798 | ("SEIDisplayOrientation", m_displayOrientationSEIAngle, 0, "Control generation of display orientation SEI messages\n" |
---|
799 | "\tN: 0 < N < (2^16 - 1) enable display orientation SEI message with anticlockwise_rotation = N and display_orientation_repetition_period = 1\n" |
---|
800 | "\t0: disable") |
---|
801 | ("SEITemporalLevel0Index", m_temporalLevel0IndexSEIEnabled, 0, "Control generation of temporal level 0 index SEI messages") |
---|
802 | ("SEIGradualDecodingRefreshInfo", m_gradualDecodingRefreshInfoEnabled, 0, "Control generation of gradual decoding refresh information SEI message") |
---|
803 | ("SEIDecodingUnitInfo", m_decodingUnitInfoSEIEnabled, 0, "Control generation of decoding unit information SEI message.") |
---|
804 | #if M0043_LAYERS_PRESENT_SEI |
---|
805 | ("SEILayersPresent", m_layersPresentSEIEnabled, 0, "Control generation of layers present SEI message") |
---|
806 | #endif |
---|
807 | ("SEISOPDescription", m_SOPDescriptionSEIEnabled, 0, "Control generation of SOP description SEI messages") |
---|
808 | ("SEIScalableNesting", m_scalableNestingSEIEnabled, 0, "Control generation of scalable nesting SEI messages") |
---|
809 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
810 | ("AdaptiveResolutionChange", m_adaptiveResolutionChange, 0, "Adaptive resolution change frame number. Should coincide with EL RAP picture. (0: disable)") |
---|
811 | #endif |
---|
812 | ; |
---|
813 | |
---|
814 | for(Int i=1; i<MAX_GOP+1; i++) { |
---|
815 | std::ostringstream cOSS; |
---|
816 | cOSS<<"Frame"<<i; |
---|
817 | opts.addOptions()(cOSS.str(), m_GOPList[i-1], GOPEntry()); |
---|
818 | } |
---|
819 | po::setDefaults(opts); |
---|
820 | const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv); |
---|
821 | |
---|
822 | for (list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++) |
---|
823 | { |
---|
824 | fprintf(stderr, "Unhandled argument ignored: `%s'\n", *it); |
---|
825 | } |
---|
826 | |
---|
827 | if (argc == 1 || do_help) |
---|
828 | { |
---|
829 | /* argc == 1: no options have been specified */ |
---|
830 | po::doHelp(cout, opts); |
---|
831 | return false; |
---|
832 | } |
---|
833 | |
---|
834 | /* |
---|
835 | * Set any derived parameters |
---|
836 | */ |
---|
837 | /* convert std::string to c string for compatability */ |
---|
838 | #if SVC_EXTENSION |
---|
839 | #if AVC_BASE |
---|
840 | if( m_avcBaseLayerFlag ) |
---|
841 | { |
---|
842 | *cfg_InputFile[0] = cfg_BLInputFile; |
---|
843 | } |
---|
844 | #endif |
---|
845 | m_pBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str()); |
---|
846 | #if AVC_SYNTAX |
---|
847 | m_BLSyntaxFile = cfg_BLSyntaxFile.empty() ? NULL : strdup(cfg_BLSyntaxFile.c_str()); |
---|
848 | #endif |
---|
849 | #else |
---|
850 | m_pchInputFile = cfg_InputFile.empty() ? NULL : strdup(cfg_InputFile.c_str()); |
---|
851 | m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str()); |
---|
852 | m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str()); |
---|
853 | m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str()); |
---|
854 | #endif |
---|
855 | |
---|
856 | Char* pColumnWidth = cfg_ColumnWidth.empty() ? NULL: strdup(cfg_ColumnWidth.c_str()); |
---|
857 | Char* pRowHeight = cfg_RowHeight.empty() ? NULL : strdup(cfg_RowHeight.c_str()); |
---|
858 | if( m_iUniformSpacingIdr == 0 && m_iNumColumnsMinus1 > 0 ) |
---|
859 | { |
---|
860 | char *columnWidth; |
---|
861 | int i=0; |
---|
862 | m_pColumnWidth = new UInt[m_iNumColumnsMinus1]; |
---|
863 | columnWidth = strtok(pColumnWidth, " ,-"); |
---|
864 | while(columnWidth!=NULL) |
---|
865 | { |
---|
866 | if( i>=m_iNumColumnsMinus1 ) |
---|
867 | { |
---|
868 | printf( "The number of columns whose width are defined is larger than the allowed number of columns.\n" ); |
---|
869 | exit( EXIT_FAILURE ); |
---|
870 | } |
---|
871 | *( m_pColumnWidth + i ) = atoi( columnWidth ); |
---|
872 | columnWidth = strtok(NULL, " ,-"); |
---|
873 | i++; |
---|
874 | } |
---|
875 | if( i<m_iNumColumnsMinus1 ) |
---|
876 | { |
---|
877 | printf( "The width of some columns is not defined.\n" ); |
---|
878 | exit( EXIT_FAILURE ); |
---|
879 | } |
---|
880 | } |
---|
881 | else |
---|
882 | { |
---|
883 | m_pColumnWidth = NULL; |
---|
884 | } |
---|
885 | |
---|
886 | if( m_iUniformSpacingIdr == 0 && m_iNumRowsMinus1 > 0 ) |
---|
887 | { |
---|
888 | char *rowHeight; |
---|
889 | int i=0; |
---|
890 | m_pRowHeight = new UInt[m_iNumRowsMinus1]; |
---|
891 | rowHeight = strtok(pRowHeight, " ,-"); |
---|
892 | while(rowHeight!=NULL) |
---|
893 | { |
---|
894 | if( i>=m_iNumRowsMinus1 ) |
---|
895 | { |
---|
896 | printf( "The number of rows whose height are defined is larger than the allowed number of rows.\n" ); |
---|
897 | exit( EXIT_FAILURE ); |
---|
898 | } |
---|
899 | *( m_pRowHeight + i ) = atoi( rowHeight ); |
---|
900 | rowHeight = strtok(NULL, " ,-"); |
---|
901 | i++; |
---|
902 | } |
---|
903 | if( i<m_iNumRowsMinus1 ) |
---|
904 | { |
---|
905 | printf( "The height of some rows is not defined.\n" ); |
---|
906 | exit( EXIT_FAILURE ); |
---|
907 | } |
---|
908 | } |
---|
909 | else |
---|
910 | { |
---|
911 | m_pRowHeight = NULL; |
---|
912 | } |
---|
913 | #if SCALED_REF_LAYER_OFFSETS |
---|
914 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
915 | { |
---|
916 | // If number of scaled ref. layer offsets is non-zero, at least one of the offsets should be specified |
---|
917 | if(m_acLayerCfg[layer].m_numScaledRefLayerOffsets) |
---|
918 | { |
---|
919 | assert( strcmp(cfg_scaledRefLayerLeftOffset[layer].c_str(), "") || |
---|
920 | strcmp(cfg_scaledRefLayerRightOffset[layer].c_str(), "") || |
---|
921 | strcmp(cfg_scaledRefLayerTopOffset[layer].c_str(), "") || |
---|
922 | strcmp(cfg_scaledRefLayerBottomOffset[layer].c_str(),"") |
---|
923 | ); |
---|
924 | } |
---|
925 | |
---|
926 | Int *tempArray = NULL; // Contain the value |
---|
927 | // Left offset // |
---|
928 | if(strcmp(cfg_scaledRefLayerLeftOffset[layer].c_str(), "")) |
---|
929 | { |
---|
930 | cfgStringToArray( &tempArray, cfg_scaledRefLayerLeftOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "LeftOffset"); |
---|
931 | if(tempArray) |
---|
932 | { |
---|
933 | for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) |
---|
934 | { |
---|
935 | m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i] = tempArray[i]; |
---|
936 | } |
---|
937 | delete [] tempArray; tempArray = NULL; |
---|
938 | } |
---|
939 | } |
---|
940 | |
---|
941 | // Top offset // |
---|
942 | if(strcmp(cfg_scaledRefLayerTopOffset[layer].c_str(), "")) |
---|
943 | { |
---|
944 | cfgStringToArray( &tempArray, cfg_scaledRefLayerTopOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "TopOffset"); |
---|
945 | if(tempArray) |
---|
946 | { |
---|
947 | for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) |
---|
948 | { |
---|
949 | m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i] = tempArray[i]; |
---|
950 | } |
---|
951 | delete [] tempArray; tempArray = NULL; |
---|
952 | } |
---|
953 | } |
---|
954 | |
---|
955 | // Right offset // |
---|
956 | if(strcmp(cfg_scaledRefLayerRightOffset[layer].c_str(), "")) |
---|
957 | { |
---|
958 | cfgStringToArray( &tempArray, cfg_scaledRefLayerRightOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "RightOffset"); |
---|
959 | if(tempArray) |
---|
960 | { |
---|
961 | for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) |
---|
962 | { |
---|
963 | m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i] = tempArray[i]; |
---|
964 | } |
---|
965 | delete [] tempArray; tempArray = NULL; |
---|
966 | } |
---|
967 | } |
---|
968 | |
---|
969 | // Bottom offset // |
---|
970 | if(strcmp(cfg_scaledRefLayerBottomOffset[layer].c_str(), "")) |
---|
971 | { |
---|
972 | cfgStringToArray( &tempArray, cfg_scaledRefLayerBottomOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "BottomOffset"); |
---|
973 | if(tempArray) |
---|
974 | { |
---|
975 | for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) |
---|
976 | { |
---|
977 | m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i] = tempArray[i]; |
---|
978 | } |
---|
979 | delete [] tempArray; tempArray = NULL; |
---|
980 | } |
---|
981 | } |
---|
982 | } |
---|
983 | #endif |
---|
984 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
985 | #if M0457_PREDICTION_INDICATIONS |
---|
986 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
987 | { |
---|
988 | Char* pSamplePredRefLayerIds = cfg_samplePredRefLayerIds[layer].empty() ? NULL: strdup(cfg_samplePredRefLayerIds[layer].c_str()); |
---|
989 | if( m_acLayerCfg[layer].m_numSamplePredRefLayers > 0 ) |
---|
990 | { |
---|
991 | char *samplePredRefLayerId; |
---|
992 | int i=0; |
---|
993 | m_acLayerCfg[layer].m_samplePredRefLayerIds = new Int[m_acLayerCfg[layer].m_numSamplePredRefLayers]; |
---|
994 | samplePredRefLayerId = strtok(pSamplePredRefLayerIds, " ,-"); |
---|
995 | while(samplePredRefLayerId != NULL) |
---|
996 | { |
---|
997 | if( i >= m_acLayerCfg[layer].m_numSamplePredRefLayers ) |
---|
998 | { |
---|
999 | printf( "NumSamplePredRefLayers: The number of columns whose width are defined is larger than the allowed number of columns.\n" ); |
---|
1000 | exit( EXIT_FAILURE ); |
---|
1001 | } |
---|
1002 | *( m_acLayerCfg[layer].m_samplePredRefLayerIds + i ) = atoi( samplePredRefLayerId ); |
---|
1003 | samplePredRefLayerId = strtok(NULL, " ,-"); |
---|
1004 | i++; |
---|
1005 | } |
---|
1006 | if( i < m_acLayerCfg[layer].m_numSamplePredRefLayers ) |
---|
1007 | { |
---|
1008 | printf( "NumSamplePredRefLayers: The width of some columns is not defined.\n" ); |
---|
1009 | exit( EXIT_FAILURE ); |
---|
1010 | } |
---|
1011 | } |
---|
1012 | else |
---|
1013 | { |
---|
1014 | m_acLayerCfg[layer].m_samplePredRefLayerIds = NULL; |
---|
1015 | } |
---|
1016 | } |
---|
1017 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
1018 | { |
---|
1019 | Char* pMotionPredRefLayerIds = cfg_motionPredRefLayerIds[layer].empty() ? NULL: strdup(cfg_motionPredRefLayerIds[layer].c_str()); |
---|
1020 | if( m_acLayerCfg[layer].m_numMotionPredRefLayers > 0 ) |
---|
1021 | { |
---|
1022 | char *motionPredRefLayerId; |
---|
1023 | int i=0; |
---|
1024 | m_acLayerCfg[layer].m_motionPredRefLayerIds = new Int[m_acLayerCfg[layer].m_numMotionPredRefLayers]; |
---|
1025 | motionPredRefLayerId = strtok(pMotionPredRefLayerIds, " ,-"); |
---|
1026 | while(motionPredRefLayerId != NULL) |
---|
1027 | { |
---|
1028 | if( i >= m_acLayerCfg[layer].m_numMotionPredRefLayers ) |
---|
1029 | { |
---|
1030 | printf( "NumMotionPredRefLayers: The number of columns whose width are defined is larger than the allowed number of columns.\n" ); |
---|
1031 | exit( EXIT_FAILURE ); |
---|
1032 | } |
---|
1033 | *( m_acLayerCfg[layer].m_motionPredRefLayerIds + i ) = atoi( motionPredRefLayerId ); |
---|
1034 | motionPredRefLayerId = strtok(NULL, " ,-"); |
---|
1035 | i++; |
---|
1036 | } |
---|
1037 | if( i < m_acLayerCfg[layer].m_numMotionPredRefLayers ) |
---|
1038 | { |
---|
1039 | printf( "NumMotionPredRefLayers: The width of some columns is not defined.\n" ); |
---|
1040 | exit( EXIT_FAILURE ); |
---|
1041 | } |
---|
1042 | } |
---|
1043 | else |
---|
1044 | { |
---|
1045 | m_acLayerCfg[layer].m_motionPredRefLayerIds = NULL; |
---|
1046 | } |
---|
1047 | } |
---|
1048 | #else |
---|
1049 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
1050 | { |
---|
1051 | Char* pRefLayerIds = cfg_refLayerIds[layer].empty() ? NULL: strdup(cfg_refLayerIds[layer].c_str()); |
---|
1052 | if( m_acLayerCfg[layer].m_numDirectRefLayers > 0 ) |
---|
1053 | { |
---|
1054 | char *refLayerId; |
---|
1055 | int i=0; |
---|
1056 | m_acLayerCfg[layer].m_refLayerIds = new Int[m_acLayerCfg[layer].m_numDirectRefLayers]; |
---|
1057 | refLayerId = strtok(pRefLayerIds, " ,-"); |
---|
1058 | while(refLayerId != NULL) |
---|
1059 | { |
---|
1060 | if( i >= m_acLayerCfg[layer].m_numDirectRefLayers ) |
---|
1061 | { |
---|
1062 | printf( "NumDirectRefLayers: The number of columns whose width are defined is larger than the allowed number of columns.\n" ); |
---|
1063 | exit( EXIT_FAILURE ); |
---|
1064 | } |
---|
1065 | *( m_acLayerCfg[layer].m_refLayerIds + i ) = atoi( refLayerId ); |
---|
1066 | refLayerId = strtok(NULL, " ,-"); |
---|
1067 | i++; |
---|
1068 | } |
---|
1069 | if( i < m_acLayerCfg[layer].m_numDirectRefLayers ) |
---|
1070 | { |
---|
1071 | printf( "NumDirectRefLayers: The width of some columns is not defined.\n" ); |
---|
1072 | exit( EXIT_FAILURE ); |
---|
1073 | } |
---|
1074 | } |
---|
1075 | else |
---|
1076 | { |
---|
1077 | m_acLayerCfg[layer].m_refLayerIds = NULL; |
---|
1078 | } |
---|
1079 | } |
---|
1080 | #endif |
---|
1081 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
1082 | { |
---|
1083 | Char* pPredLayerIds = cfg_predLayerIds[layer].empty() ? NULL: strdup(cfg_predLayerIds[layer].c_str()); |
---|
1084 | if( m_acLayerCfg[layer].m_numActiveRefLayers > 0 ) |
---|
1085 | { |
---|
1086 | char *refLayerId; |
---|
1087 | int i=0; |
---|
1088 | m_acLayerCfg[layer].m_predLayerIds = new Int[m_acLayerCfg[layer].m_numActiveRefLayers]; |
---|
1089 | refLayerId = strtok(pPredLayerIds, " ,-"); |
---|
1090 | while(refLayerId != NULL) |
---|
1091 | { |
---|
1092 | if( i >= m_acLayerCfg[layer].m_numActiveRefLayers ) |
---|
1093 | { |
---|
1094 | printf( "NumActiveRefLayers: The number of columns whose width are defined is larger than the allowed number of columns.\n" ); |
---|
1095 | exit( EXIT_FAILURE ); |
---|
1096 | } |
---|
1097 | *( m_acLayerCfg[layer].m_predLayerIds + i ) = atoi( refLayerId ); |
---|
1098 | refLayerId = strtok(NULL, " ,-"); |
---|
1099 | i++; |
---|
1100 | } |
---|
1101 | if( i < m_acLayerCfg[layer].m_numActiveRefLayers ) |
---|
1102 | { |
---|
1103 | printf( "NumActiveRefLayers: The width of some columns is not defined.\n" ); |
---|
1104 | exit( EXIT_FAILURE ); |
---|
1105 | } |
---|
1106 | } |
---|
1107 | else |
---|
1108 | { |
---|
1109 | m_acLayerCfg[layer].m_predLayerIds = NULL; |
---|
1110 | } |
---|
1111 | } |
---|
1112 | #endif |
---|
1113 | m_scalingListFile = cfg_ScalingListFile.empty() ? NULL : strdup(cfg_ScalingListFile.c_str()); |
---|
1114 | |
---|
1115 | /* rules for input, output and internal bitdepths as per help text */ |
---|
1116 | if (!m_internalBitDepthY) { m_internalBitDepthY = m_inputBitDepthY; } |
---|
1117 | if (!m_internalBitDepthC) { m_internalBitDepthC = m_internalBitDepthY; } |
---|
1118 | if (!m_inputBitDepthC) { m_inputBitDepthC = m_inputBitDepthY; } |
---|
1119 | if (!m_outputBitDepthY) { m_outputBitDepthY = m_internalBitDepthY; } |
---|
1120 | if (!m_outputBitDepthC) { m_outputBitDepthC = m_internalBitDepthC; } |
---|
1121 | |
---|
1122 | #if !SVC_EXTENSION |
---|
1123 | // TODO:ChromaFmt assumes 4:2:0 below |
---|
1124 | switch (m_conformanceMode) |
---|
1125 | { |
---|
1126 | case 0: |
---|
1127 | { |
---|
1128 | // no conformance or padding |
---|
1129 | m_confLeft = m_confRight = m_confTop = m_confBottom = 0; |
---|
1130 | m_aiPad[1] = m_aiPad[0] = 0; |
---|
1131 | break; |
---|
1132 | } |
---|
1133 | case 1: |
---|
1134 | { |
---|
1135 | // automatic padding to minimum CU size |
---|
1136 | Int minCuSize = m_uiMaxCUHeight >> (m_uiMaxCUDepth - 1); |
---|
1137 | if (m_iSourceWidth % minCuSize) |
---|
1138 | { |
---|
1139 | m_aiPad[0] = m_confRight = ((m_iSourceWidth / minCuSize) + 1) * minCuSize - m_iSourceWidth; |
---|
1140 | m_iSourceWidth += m_confRight; |
---|
1141 | } |
---|
1142 | if (m_iSourceHeight % minCuSize) |
---|
1143 | { |
---|
1144 | m_aiPad[1] = m_confBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight; |
---|
1145 | m_iSourceHeight += m_confBottom; |
---|
1146 | } |
---|
1147 | if (m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0) |
---|
1148 | { |
---|
1149 | fprintf(stderr, "Error: picture width is not an integer multiple of the specified chroma subsampling\n"); |
---|
1150 | exit(EXIT_FAILURE); |
---|
1151 | } |
---|
1152 | if (m_aiPad[1] % TComSPS::getWinUnitY(CHROMA_420) != 0) |
---|
1153 | { |
---|
1154 | fprintf(stderr, "Error: picture height is not an integer multiple of the specified chroma subsampling\n"); |
---|
1155 | exit(EXIT_FAILURE); |
---|
1156 | } |
---|
1157 | break; |
---|
1158 | } |
---|
1159 | case 2: |
---|
1160 | { |
---|
1161 | //padding |
---|
1162 | m_iSourceWidth += m_aiPad[0]; |
---|
1163 | m_iSourceHeight += m_aiPad[1]; |
---|
1164 | m_confRight = m_aiPad[0]; |
---|
1165 | m_confBottom = m_aiPad[1]; |
---|
1166 | break; |
---|
1167 | } |
---|
1168 | case 3: |
---|
1169 | { |
---|
1170 | // conformance |
---|
1171 | if ((m_confLeft == 0) && (m_confRight == 0) && (m_confTop == 0) && (m_confBottom == 0)) |
---|
1172 | { |
---|
1173 | fprintf(stderr, "Warning: Conformance window enabled, but all conformance window parameters set to zero\n"); |
---|
1174 | } |
---|
1175 | if ((m_aiPad[1] != 0) || (m_aiPad[0]!=0)) |
---|
1176 | { |
---|
1177 | fprintf(stderr, "Warning: Conformance window enabled, padding parameters will be ignored\n"); |
---|
1178 | } |
---|
1179 | m_aiPad[1] = m_aiPad[0] = 0; |
---|
1180 | break; |
---|
1181 | } |
---|
1182 | } |
---|
1183 | |
---|
1184 | // allocate slice-based dQP values |
---|
1185 | m_aidQP = new Int[ m_framesToBeEncoded + m_iGOPSize + 1 ]; |
---|
1186 | ::memset( m_aidQP, 0, sizeof(Int)*( m_framesToBeEncoded + m_iGOPSize + 1 ) ); |
---|
1187 | |
---|
1188 | // handling of floating-point QP values |
---|
1189 | // if QP is not integer, sequence is split into two sections having QP and QP+1 |
---|
1190 | m_iQP = (Int)( m_fQP ); |
---|
1191 | if ( m_iQP < m_fQP ) |
---|
1192 | { |
---|
1193 | Int iSwitchPOC = (Int)( m_framesToBeEncoded - (m_fQP - m_iQP)*m_framesToBeEncoded + 0.5 ); |
---|
1194 | |
---|
1195 | iSwitchPOC = (Int)( (Double)iSwitchPOC / m_iGOPSize + 0.5 )*m_iGOPSize; |
---|
1196 | for ( Int i=iSwitchPOC; i<m_framesToBeEncoded + m_iGOPSize + 1; i++ ) |
---|
1197 | { |
---|
1198 | m_aidQP[i] = 1; |
---|
1199 | } |
---|
1200 | } |
---|
1201 | |
---|
1202 | // reading external dQP description from file |
---|
1203 | if ( m_pchdQPFile ) |
---|
1204 | { |
---|
1205 | FILE* fpt=fopen( m_pchdQPFile, "r" ); |
---|
1206 | if ( fpt ) |
---|
1207 | { |
---|
1208 | Int iValue; |
---|
1209 | Int iPOC = 0; |
---|
1210 | while ( iPOC < m_framesToBeEncoded ) |
---|
1211 | { |
---|
1212 | if ( fscanf(fpt, "%d", &iValue ) == EOF ) break; |
---|
1213 | m_aidQP[ iPOC ] = iValue; |
---|
1214 | iPOC++; |
---|
1215 | } |
---|
1216 | fclose(fpt); |
---|
1217 | } |
---|
1218 | } |
---|
1219 | m_iWaveFrontSubstreams = m_iWaveFrontSynchro ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1; |
---|
1220 | #endif |
---|
1221 | if( m_toneMappingInfoSEIEnabled && !m_toneMapCancelFlag ) |
---|
1222 | { |
---|
1223 | Char* pcStartOfCodedInterval = cfg_startOfCodedInterval.empty() ? NULL: strdup(cfg_startOfCodedInterval.c_str()); |
---|
1224 | Char* pcCodedPivotValue = cfg_codedPivotValue.empty() ? NULL: strdup(cfg_codedPivotValue.c_str()); |
---|
1225 | Char* pcTargetPivotValue = cfg_targetPivotValue.empty() ? NULL: strdup(cfg_targetPivotValue.c_str()); |
---|
1226 | if( m_toneMapModelId == 2 && pcStartOfCodedInterval ) |
---|
1227 | { |
---|
1228 | char *startOfCodedInterval; |
---|
1229 | UInt num = 1u<< m_toneMapTargetBitDepth; |
---|
1230 | m_startOfCodedInterval = new Int[num]; |
---|
1231 | ::memset( m_startOfCodedInterval, 0, sizeof(Int)*num ); |
---|
1232 | startOfCodedInterval = strtok(pcStartOfCodedInterval, " ."); |
---|
1233 | int i = 0; |
---|
1234 | while( startOfCodedInterval && ( i < num ) ) |
---|
1235 | { |
---|
1236 | m_startOfCodedInterval[i] = atoi( startOfCodedInterval ); |
---|
1237 | startOfCodedInterval = strtok(NULL, " ."); |
---|
1238 | i++; |
---|
1239 | } |
---|
1240 | } |
---|
1241 | else |
---|
1242 | { |
---|
1243 | m_startOfCodedInterval = NULL; |
---|
1244 | } |
---|
1245 | if( ( m_toneMapModelId == 3 ) && ( m_numPivots > 0 ) ) |
---|
1246 | { |
---|
1247 | if( pcCodedPivotValue && pcTargetPivotValue ) |
---|
1248 | { |
---|
1249 | char *codedPivotValue; |
---|
1250 | char *targetPivotValue; |
---|
1251 | m_codedPivotValue = new Int[m_numPivots]; |
---|
1252 | m_targetPivotValue = new Int[m_numPivots]; |
---|
1253 | ::memset( m_codedPivotValue, 0, sizeof(Int)*( m_numPivots ) ); |
---|
1254 | ::memset( m_targetPivotValue, 0, sizeof(Int)*( m_numPivots ) ); |
---|
1255 | codedPivotValue = strtok(pcCodedPivotValue, " ."); |
---|
1256 | int i=0; |
---|
1257 | while(codedPivotValue&&i<m_numPivots) |
---|
1258 | { |
---|
1259 | m_codedPivotValue[i] = atoi( codedPivotValue ); |
---|
1260 | codedPivotValue = strtok(NULL, " ."); |
---|
1261 | i++; |
---|
1262 | } |
---|
1263 | i=0; |
---|
1264 | targetPivotValue = strtok(pcTargetPivotValue, " ."); |
---|
1265 | while(targetPivotValue&&i<m_numPivots) |
---|
1266 | { |
---|
1267 | m_targetPivotValue[i]= atoi( targetPivotValue ); |
---|
1268 | targetPivotValue = strtok(NULL, " ."); |
---|
1269 | i++; |
---|
1270 | } |
---|
1271 | } |
---|
1272 | } |
---|
1273 | else |
---|
1274 | { |
---|
1275 | m_codedPivotValue = NULL; |
---|
1276 | m_targetPivotValue = NULL; |
---|
1277 | } |
---|
1278 | } |
---|
1279 | // check validity of input parameters |
---|
1280 | xCheckParameter(); |
---|
1281 | |
---|
1282 | // set global varibles |
---|
1283 | xSetGlobal(); |
---|
1284 | |
---|
1285 | // print-out parameters |
---|
1286 | xPrintParameter(); |
---|
1287 | |
---|
1288 | return true; |
---|
1289 | } |
---|
1290 | // ==================================================================================================================== |
---|
1291 | // Private member functions |
---|
1292 | // ==================================================================================================================== |
---|
1293 | |
---|
1294 | Bool confirmPara(Bool bflag, const Char* message); |
---|
1295 | |
---|
1296 | Void TAppEncCfg::xCheckParameter() |
---|
1297 | { |
---|
1298 | if (!m_decodedPictureHashSEIEnabled) |
---|
1299 | { |
---|
1300 | fprintf(stderr, "******************************************************************\n"); |
---|
1301 | fprintf(stderr, "** WARNING: --SEIDecodedPictureHash is now disabled by default. **\n"); |
---|
1302 | fprintf(stderr, "** Automatic verification of decoded pictures by a **\n"); |
---|
1303 | fprintf(stderr, "** decoder requires this option to be enabled. **\n"); |
---|
1304 | fprintf(stderr, "******************************************************************\n"); |
---|
1305 | } |
---|
1306 | if( m_profile==Profile::NONE ) |
---|
1307 | { |
---|
1308 | fprintf(stderr, "***************************************************************************\n"); |
---|
1309 | fprintf(stderr, "** WARNING: For conforming bitstreams a valid Profile value must be set! **\n"); |
---|
1310 | fprintf(stderr, "***************************************************************************\n"); |
---|
1311 | } |
---|
1312 | if( m_level==Level::NONE ) |
---|
1313 | { |
---|
1314 | fprintf(stderr, "***************************************************************************\n"); |
---|
1315 | fprintf(stderr, "** WARNING: For conforming bitstreams a valid Level value must be set! **\n"); |
---|
1316 | fprintf(stderr, "***************************************************************************\n"); |
---|
1317 | } |
---|
1318 | |
---|
1319 | Bool check_failed = false; /* abort if there is a fatal configuration problem */ |
---|
1320 | #define xConfirmPara(a,b) check_failed |= confirmPara(a,b) |
---|
1321 | // check range of parameters |
---|
1322 | xConfirmPara( m_inputBitDepthY < 8, "InputBitDepth must be at least 8" ); |
---|
1323 | xConfirmPara( m_inputBitDepthC < 8, "InputBitDepthC must be at least 8" ); |
---|
1324 | #if !SVC_EXTENSION |
---|
1325 | xConfirmPara( m_iFrameRate <= 0, "Frame rate must be more than 1" ); |
---|
1326 | #endif |
---|
1327 | xConfirmPara( m_framesToBeEncoded <= 0, "Total Number Of Frames encoded must be more than 0" ); |
---|
1328 | xConfirmPara( m_iGOPSize < 1 , "GOP Size must be greater or equal to 1" ); |
---|
1329 | xConfirmPara( m_iGOPSize > 1 && m_iGOPSize % 2, "GOP Size must be a multiple of 2, if GOP Size is greater than 1" ); |
---|
1330 | #if !SVC_EXTENSION |
---|
1331 | xConfirmPara( (m_iIntraPeriod > 0 && m_iIntraPeriod < m_iGOPSize) || m_iIntraPeriod == 0, "Intra period must be more than GOP size, or -1 , not 0" ); |
---|
1332 | #endif |
---|
1333 | xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 2, "Decoding Refresh Type must be equal to 0, 1 or 2" ); |
---|
1334 | #if !SVC_EXTENSION |
---|
1335 | xConfirmPara( m_iQP < -6 * (m_internalBitDepthY - 8) || m_iQP > 51, "QP exceeds supported range (-QpBDOffsety to 51)" ); |
---|
1336 | #endif |
---|
1337 | xConfirmPara( m_loopFilterBetaOffsetDiv2 < -6 || m_loopFilterBetaOffsetDiv2 > 6, "Loop Filter Beta Offset div. 2 exceeds supported range (-6 to 6)"); |
---|
1338 | xConfirmPara( m_loopFilterTcOffsetDiv2 < -6 || m_loopFilterTcOffsetDiv2 > 6, "Loop Filter Tc Offset div. 2 exceeds supported range (-6 to 6)"); |
---|
1339 | xConfirmPara( m_iFastSearch < 0 || m_iFastSearch > 2, "Fast Search Mode is not supported value (0:Full search 1:Diamond 2:PMVFAST)" ); |
---|
1340 | xConfirmPara( m_iSearchRange < 0 , "Search Range must be more than 0" ); |
---|
1341 | xConfirmPara( m_bipredSearchRange < 0 , "Search Range must be more than 0" ); |
---|
1342 | xConfirmPara( m_iMaxDeltaQP > 7, "Absolute Delta QP exceeds supported range (0 to 7)" ); |
---|
1343 | xConfirmPara( m_iMaxCuDQPDepth > m_uiMaxCUDepth - 1, "Absolute depth for a minimum CuDQP exceeds maximum coding unit depth" ); |
---|
1344 | |
---|
1345 | xConfirmPara( m_cbQpOffset < -12, "Min. Chroma Cb QP Offset is -12" ); |
---|
1346 | xConfirmPara( m_cbQpOffset > 12, "Max. Chroma Cb QP Offset is 12" ); |
---|
1347 | xConfirmPara( m_crQpOffset < -12, "Min. Chroma Cr QP Offset is -12" ); |
---|
1348 | xConfirmPara( m_crQpOffset > 12, "Max. Chroma Cr QP Offset is 12" ); |
---|
1349 | |
---|
1350 | xConfirmPara( m_iQPAdaptationRange <= 0, "QP Adaptation Range must be more than 0" ); |
---|
1351 | #if !SVC_EXTENSION |
---|
1352 | if (m_iDecodingRefreshType == 2) |
---|
1353 | { |
---|
1354 | xConfirmPara( m_iIntraPeriod > 0 && m_iIntraPeriod <= m_iGOPSize , "Intra period must be larger than GOP size for periodic IDR pictures"); |
---|
1355 | } |
---|
1356 | #endif |
---|
1357 | xConfirmPara( (m_uiMaxCUWidth >> m_uiMaxCUDepth) < 4, "Minimum partition width size should be larger than or equal to 8"); |
---|
1358 | xConfirmPara( (m_uiMaxCUHeight >> m_uiMaxCUDepth) < 4, "Minimum partition height size should be larger than or equal to 8"); |
---|
1359 | xConfirmPara( m_uiMaxCUWidth < 16, "Maximum partition width size should be larger than or equal to 16"); |
---|
1360 | xConfirmPara( m_uiMaxCUHeight < 16, "Maximum partition height size should be larger than or equal to 16"); |
---|
1361 | #if !SVC_EXTENSION |
---|
1362 | xConfirmPara( (m_iSourceWidth % (m_uiMaxCUWidth >> (m_uiMaxCUDepth-1)))!=0, "Resulting coded frame width must be a multiple of the minimum CU size"); |
---|
1363 | xConfirmPara( (m_iSourceHeight % (m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)))!=0, "Resulting coded frame height must be a multiple of the minimum CU size"); |
---|
1364 | #endif |
---|
1365 | |
---|
1366 | xConfirmPara( m_uiQuadtreeTULog2MinSize < 2, "QuadtreeTULog2MinSize must be 2 or greater."); |
---|
1367 | xConfirmPara( m_uiQuadtreeTULog2MaxSize > 5, "QuadtreeTULog2MaxSize must be 5 or smaller."); |
---|
1368 | xConfirmPara( (1<<m_uiQuadtreeTULog2MaxSize) > m_uiMaxCUWidth, "QuadtreeTULog2MaxSize must be log2(maxCUSize) or smaller."); |
---|
1369 | |
---|
1370 | xConfirmPara( m_uiQuadtreeTULog2MaxSize < m_uiQuadtreeTULog2MinSize, "QuadtreeTULog2MaxSize must be greater than or equal to m_uiQuadtreeTULog2MinSize."); |
---|
1371 | xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUWidth >>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS |
---|
1372 | xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUHeight>>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS |
---|
1373 | xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUWidth >> m_uiMaxCUDepth ), "Minimum CU width must be greater than minimum transform size." ); |
---|
1374 | xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUHeight >> m_uiMaxCUDepth ), "Minimum CU height must be greater than minimum transform size." ); |
---|
1375 | xConfirmPara( m_uiQuadtreeTUMaxDepthInter < 1, "QuadtreeTUMaxDepthInter must be greater than or equal to 1" ); |
---|
1376 | 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" ); |
---|
1377 | xConfirmPara( m_uiQuadtreeTUMaxDepthIntra < 1, "QuadtreeTUMaxDepthIntra must be greater than or equal to 1" ); |
---|
1378 | 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" ); |
---|
1379 | |
---|
1380 | xConfirmPara( m_maxNumMergeCand < 1, "MaxNumMergeCand must be 1 or greater."); |
---|
1381 | xConfirmPara( m_maxNumMergeCand > 5, "MaxNumMergeCand must be 5 or smaller."); |
---|
1382 | |
---|
1383 | #if !SVC_EXTENSION |
---|
1384 | #if ADAPTIVE_QP_SELECTION |
---|
1385 | xConfirmPara( m_bUseAdaptQpSelect == true && m_iQP < 0, "AdaptiveQpSelection must be disabled when QP < 0."); |
---|
1386 | xConfirmPara( m_bUseAdaptQpSelect == true && (m_cbQpOffset !=0 || m_crQpOffset != 0 ), "AdaptiveQpSelection must be disabled when ChromaQpOffset is not equal to 0."); |
---|
1387 | #endif |
---|
1388 | #endif |
---|
1389 | |
---|
1390 | if( m_usePCM) |
---|
1391 | { |
---|
1392 | xConfirmPara( m_uiPCMLog2MinSize < 3, "PCMLog2MinSize must be 3 or greater."); |
---|
1393 | xConfirmPara( m_uiPCMLog2MinSize > 5, "PCMLog2MinSize must be 5 or smaller."); |
---|
1394 | xConfirmPara( m_pcmLog2MaxSize > 5, "PCMLog2MaxSize must be 5 or smaller."); |
---|
1395 | xConfirmPara( m_pcmLog2MaxSize < m_uiPCMLog2MinSize, "PCMLog2MaxSize must be equal to or greater than m_uiPCMLog2MinSize."); |
---|
1396 | } |
---|
1397 | |
---|
1398 | xConfirmPara( m_sliceMode < 0 || m_sliceMode > 3, "SliceMode exceeds supported range (0 to 3)" ); |
---|
1399 | if (m_sliceMode!=0) |
---|
1400 | { |
---|
1401 | xConfirmPara( m_sliceArgument < 1 , "SliceArgument should be larger than or equal to 1" ); |
---|
1402 | } |
---|
1403 | xConfirmPara( m_sliceSegmentMode < 0 || m_sliceSegmentMode > 3, "SliceSegmentMode exceeds supported range (0 to 3)" ); |
---|
1404 | if (m_sliceSegmentMode!=0) |
---|
1405 | { |
---|
1406 | xConfirmPara( m_sliceSegmentArgument < 1 , "SliceSegmentArgument should be larger than or equal to 1" ); |
---|
1407 | } |
---|
1408 | |
---|
1409 | Bool tileFlag = (m_iNumColumnsMinus1 > 0 || m_iNumRowsMinus1 > 0 ); |
---|
1410 | xConfirmPara( tileFlag && m_iWaveFrontSynchro, "Tile and Wavefront can not be applied together"); |
---|
1411 | |
---|
1412 | //TODO:ChromaFmt assumes 4:2:0 below |
---|
1413 | #if !SVC_EXTENSION |
---|
1414 | xConfirmPara( m_iSourceWidth % TComSPS::getWinUnitX(CHROMA_420) != 0, "Picture width must be an integer multiple of the specified chroma subsampling"); |
---|
1415 | xConfirmPara( m_iSourceHeight % TComSPS::getWinUnitY(CHROMA_420) != 0, "Picture height must be an integer multiple of the specified chroma subsampling"); |
---|
1416 | |
---|
1417 | xConfirmPara( m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0, "Horizontal padding must be an integer multiple of the specified chroma subsampling"); |
---|
1418 | xConfirmPara( m_aiPad[1] % TComSPS::getWinUnitY(CHROMA_420) != 0, "Vertical padding must be an integer multiple of the specified chroma subsampling"); |
---|
1419 | |
---|
1420 | xConfirmPara( m_confLeft % TComSPS::getWinUnitX(CHROMA_420) != 0, "Left conformance window offset must be an integer multiple of the specified chroma subsampling"); |
---|
1421 | xConfirmPara( m_confRight % TComSPS::getWinUnitX(CHROMA_420) != 0, "Right conformance window offset must be an integer multiple of the specified chroma subsampling"); |
---|
1422 | xConfirmPara( m_confTop % TComSPS::getWinUnitY(CHROMA_420) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling"); |
---|
1423 | xConfirmPara( m_confBottom % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling"); |
---|
1424 | #endif |
---|
1425 | |
---|
1426 | // max CU width and height should be power of 2 |
---|
1427 | UInt ui = m_uiMaxCUWidth; |
---|
1428 | while(ui) |
---|
1429 | { |
---|
1430 | ui >>= 1; |
---|
1431 | if( (ui & 1) == 1) |
---|
1432 | xConfirmPara( ui != 1 , "Width should be 2^n"); |
---|
1433 | } |
---|
1434 | ui = m_uiMaxCUHeight; |
---|
1435 | while(ui) |
---|
1436 | { |
---|
1437 | ui >>= 1; |
---|
1438 | if( (ui & 1) == 1) |
---|
1439 | xConfirmPara( ui != 1 , "Height should be 2^n"); |
---|
1440 | } |
---|
1441 | |
---|
1442 | |
---|
1443 | /* if this is an intra-only sequence, ie IntraPeriod=1, don't verify the GOP structure |
---|
1444 | * This permits the ability to omit a GOP structure specification */ |
---|
1445 | #if SVC_EXTENSION |
---|
1446 | for(UInt layer = 0; layer < MAX_LAYERS; layer++) |
---|
1447 | { |
---|
1448 | Int m_iIntraPeriod = m_acLayerCfg[layer].m_iIntraPeriod; |
---|
1449 | #endif |
---|
1450 | if (m_iIntraPeriod == 1 && m_GOPList[0].m_POC == -1) { |
---|
1451 | m_GOPList[0] = GOPEntry(); |
---|
1452 | m_GOPList[0].m_QPFactor = 1; |
---|
1453 | m_GOPList[0].m_betaOffsetDiv2 = 0; |
---|
1454 | m_GOPList[0].m_tcOffsetDiv2 = 0; |
---|
1455 | m_GOPList[0].m_POC = 1; |
---|
1456 | m_GOPList[0].m_numRefPicsActive = 4; |
---|
1457 | } |
---|
1458 | #if SVC_EXTENSION |
---|
1459 | } |
---|
1460 | #endif |
---|
1461 | |
---|
1462 | Bool verifiedGOP=false; |
---|
1463 | Bool errorGOP=false; |
---|
1464 | Int checkGOP=1; |
---|
1465 | Int numRefs = 1; |
---|
1466 | Int refList[MAX_NUM_REF_PICS+1]; |
---|
1467 | refList[0]=0; |
---|
1468 | Bool isOK[MAX_GOP]; |
---|
1469 | for(Int i=0; i<MAX_GOP; i++) |
---|
1470 | { |
---|
1471 | isOK[i]=false; |
---|
1472 | } |
---|
1473 | Int numOK=0; |
---|
1474 | #if !SVC_EXTENSION |
---|
1475 | xConfirmPara( m_iIntraPeriod >=0&&(m_iIntraPeriod%m_iGOPSize!=0), "Intra period must be a multiple of GOPSize, or -1" ); |
---|
1476 | #endif |
---|
1477 | |
---|
1478 | for(Int i=0; i<m_iGOPSize; i++) |
---|
1479 | { |
---|
1480 | if(m_GOPList[i].m_POC==m_iGOPSize) |
---|
1481 | { |
---|
1482 | xConfirmPara( m_GOPList[i].m_temporalId!=0 , "The last frame in each GOP must have temporal ID = 0 " ); |
---|
1483 | } |
---|
1484 | } |
---|
1485 | |
---|
1486 | #if SVC_EXTENSION |
---|
1487 | xConfirmPara( m_numLayers > MAX_LAYERS , "Number of layers in config file is greater than MAX_LAYERS" ); |
---|
1488 | m_numLayers = m_numLayers > MAX_LAYERS ? MAX_LAYERS : m_numLayers; |
---|
1489 | |
---|
1490 | // verify layer configuration parameters |
---|
1491 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
1492 | { |
---|
1493 | if(m_acLayerCfg[layer].xCheckParameter()) |
---|
1494 | { |
---|
1495 | printf("\nError: invalid configuration parameter found in layer %d \n", layer); |
---|
1496 | check_failed = true; |
---|
1497 | } |
---|
1498 | } |
---|
1499 | |
---|
1500 | // verify layer configuration parameters |
---|
1501 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
1502 | { |
---|
1503 | Int m_iIntraPeriod = m_acLayerCfg[layer].m_iIntraPeriod; |
---|
1504 | #endif |
---|
1505 | if ( (m_iIntraPeriod != 1) && !m_loopFilterOffsetInPPS && m_DeblockingFilterControlPresent && (!m_bLoopFilterDisable) ) |
---|
1506 | { |
---|
1507 | for(Int i=0; i<m_iGOPSize; i++) |
---|
1508 | { |
---|
1509 | 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)" ); |
---|
1510 | 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)" ); |
---|
1511 | } |
---|
1512 | } |
---|
1513 | #if SVC_EXTENSION |
---|
1514 | } |
---|
1515 | #endif |
---|
1516 | |
---|
1517 | m_extraRPSs=0; |
---|
1518 | //start looping through frames in coding order until we can verify that the GOP structure is correct. |
---|
1519 | while(!verifiedGOP&&!errorGOP) |
---|
1520 | { |
---|
1521 | Int curGOP = (checkGOP-1)%m_iGOPSize; |
---|
1522 | Int curPOC = ((checkGOP-1)/m_iGOPSize)*m_iGOPSize + m_GOPList[curGOP].m_POC; |
---|
1523 | if(m_GOPList[curGOP].m_POC<0) |
---|
1524 | { |
---|
1525 | printf("\nError: found fewer Reference Picture Sets than GOPSize\n"); |
---|
1526 | errorGOP=true; |
---|
1527 | } |
---|
1528 | else |
---|
1529 | { |
---|
1530 | //check that all reference pictures are available, or have a POC < 0 meaning they might be available in the next GOP. |
---|
1531 | Bool beforeI = false; |
---|
1532 | for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) |
---|
1533 | { |
---|
1534 | Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i]; |
---|
1535 | if(absPOC < 0) |
---|
1536 | { |
---|
1537 | beforeI=true; |
---|
1538 | } |
---|
1539 | else |
---|
1540 | { |
---|
1541 | Bool found=false; |
---|
1542 | for(Int j=0; j<numRefs; j++) |
---|
1543 | { |
---|
1544 | if(refList[j]==absPOC) |
---|
1545 | { |
---|
1546 | found=true; |
---|
1547 | for(Int k=0; k<m_iGOPSize; k++) |
---|
1548 | { |
---|
1549 | if(absPOC%m_iGOPSize == m_GOPList[k].m_POC%m_iGOPSize) |
---|
1550 | { |
---|
1551 | if(m_GOPList[k].m_temporalId==m_GOPList[curGOP].m_temporalId) |
---|
1552 | { |
---|
1553 | m_GOPList[k].m_refPic = true; |
---|
1554 | } |
---|
1555 | m_GOPList[curGOP].m_usedByCurrPic[i]=m_GOPList[k].m_temporalId<=m_GOPList[curGOP].m_temporalId; |
---|
1556 | } |
---|
1557 | } |
---|
1558 | } |
---|
1559 | } |
---|
1560 | if(!found) |
---|
1561 | { |
---|
1562 | printf("\nError: ref pic %d is not available for GOP frame %d\n",m_GOPList[curGOP].m_referencePics[i],curGOP+1); |
---|
1563 | errorGOP=true; |
---|
1564 | } |
---|
1565 | } |
---|
1566 | } |
---|
1567 | if(!beforeI&&!errorGOP) |
---|
1568 | { |
---|
1569 | //all ref frames were present |
---|
1570 | if(!isOK[curGOP]) |
---|
1571 | { |
---|
1572 | numOK++; |
---|
1573 | isOK[curGOP]=true; |
---|
1574 | if(numOK==m_iGOPSize) |
---|
1575 | { |
---|
1576 | verifiedGOP=true; |
---|
1577 | } |
---|
1578 | } |
---|
1579 | } |
---|
1580 | else |
---|
1581 | { |
---|
1582 | //create a new GOPEntry for this frame containing all the reference pictures that were available (POC > 0) |
---|
1583 | m_GOPList[m_iGOPSize+m_extraRPSs]=m_GOPList[curGOP]; |
---|
1584 | Int newRefs=0; |
---|
1585 | for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) |
---|
1586 | { |
---|
1587 | Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i]; |
---|
1588 | if(absPOC>=0) |
---|
1589 | { |
---|
1590 | m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[newRefs]=m_GOPList[curGOP].m_referencePics[i]; |
---|
1591 | m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[newRefs]=m_GOPList[curGOP].m_usedByCurrPic[i]; |
---|
1592 | newRefs++; |
---|
1593 | } |
---|
1594 | } |
---|
1595 | Int numPrefRefs = m_GOPList[curGOP].m_numRefPicsActive; |
---|
1596 | |
---|
1597 | for(Int offset = -1; offset>-checkGOP; offset--) |
---|
1598 | { |
---|
1599 | //step backwards in coding order and include any extra available pictures we might find useful to replace the ones with POC < 0. |
---|
1600 | Int offGOP = (checkGOP-1+offset)%m_iGOPSize; |
---|
1601 | Int offPOC = ((checkGOP-1+offset)/m_iGOPSize)*m_iGOPSize + m_GOPList[offGOP].m_POC; |
---|
1602 | if(offPOC>=0&&m_GOPList[offGOP].m_temporalId<=m_GOPList[curGOP].m_temporalId) |
---|
1603 | { |
---|
1604 | Bool newRef=false; |
---|
1605 | for(Int i=0; i<numRefs; i++) |
---|
1606 | { |
---|
1607 | if(refList[i]==offPOC) |
---|
1608 | { |
---|
1609 | newRef=true; |
---|
1610 | } |
---|
1611 | } |
---|
1612 | for(Int i=0; i<newRefs; i++) |
---|
1613 | { |
---|
1614 | if(m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[i]==offPOC-curPOC) |
---|
1615 | { |
---|
1616 | newRef=false; |
---|
1617 | } |
---|
1618 | } |
---|
1619 | if(newRef) |
---|
1620 | { |
---|
1621 | Int insertPoint=newRefs; |
---|
1622 | //this picture can be added, find appropriate place in list and insert it. |
---|
1623 | if(m_GOPList[offGOP].m_temporalId==m_GOPList[curGOP].m_temporalId) |
---|
1624 | { |
---|
1625 | m_GOPList[offGOP].m_refPic = true; |
---|
1626 | } |
---|
1627 | for(Int j=0; j<newRefs; j++) |
---|
1628 | { |
---|
1629 | if(m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]<offPOC-curPOC||m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]>0) |
---|
1630 | { |
---|
1631 | insertPoint = j; |
---|
1632 | break; |
---|
1633 | } |
---|
1634 | } |
---|
1635 | Int prev = offPOC-curPOC; |
---|
1636 | Int prevUsed = m_GOPList[offGOP].m_temporalId<=m_GOPList[curGOP].m_temporalId; |
---|
1637 | for(Int j=insertPoint; j<newRefs+1; j++) |
---|
1638 | { |
---|
1639 | Int newPrev = m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]; |
---|
1640 | Int newUsed = m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j]; |
---|
1641 | m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]=prev; |
---|
1642 | m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j]=prevUsed; |
---|
1643 | prevUsed=newUsed; |
---|
1644 | prev=newPrev; |
---|
1645 | } |
---|
1646 | newRefs++; |
---|
1647 | } |
---|
1648 | } |
---|
1649 | if(newRefs>=numPrefRefs) |
---|
1650 | { |
---|
1651 | break; |
---|
1652 | } |
---|
1653 | } |
---|
1654 | m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefPics=newRefs; |
---|
1655 | m_GOPList[m_iGOPSize+m_extraRPSs].m_POC = curPOC; |
---|
1656 | if (m_extraRPSs == 0) |
---|
1657 | { |
---|
1658 | m_GOPList[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 0; |
---|
1659 | m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefIdc = 0; |
---|
1660 | } |
---|
1661 | else |
---|
1662 | { |
---|
1663 | Int rIdx = m_iGOPSize + m_extraRPSs - 1; |
---|
1664 | Int refPOC = m_GOPList[rIdx].m_POC; |
---|
1665 | Int refPics = m_GOPList[rIdx].m_numRefPics; |
---|
1666 | Int newIdc=0; |
---|
1667 | for(Int i = 0; i<= refPics; i++) |
---|
1668 | { |
---|
1669 | Int deltaPOC = ((i != refPics)? m_GOPList[rIdx].m_referencePics[i] : 0); // check if the reference abs POC is >= 0 |
---|
1670 | Int absPOCref = refPOC+deltaPOC; |
---|
1671 | Int refIdc = 0; |
---|
1672 | for (Int j = 0; j < m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefPics; j++) |
---|
1673 | { |
---|
1674 | if ( (absPOCref - curPOC) == m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]) |
---|
1675 | { |
---|
1676 | if (m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j]) |
---|
1677 | { |
---|
1678 | refIdc = 1; |
---|
1679 | } |
---|
1680 | else |
---|
1681 | { |
---|
1682 | refIdc = 2; |
---|
1683 | } |
---|
1684 | } |
---|
1685 | } |
---|
1686 | m_GOPList[m_iGOPSize+m_extraRPSs].m_refIdc[newIdc]=refIdc; |
---|
1687 | newIdc++; |
---|
1688 | } |
---|
1689 | m_GOPList[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 1; |
---|
1690 | m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefIdc = newIdc; |
---|
1691 | m_GOPList[m_iGOPSize+m_extraRPSs].m_deltaRPS = refPOC - m_GOPList[m_iGOPSize+m_extraRPSs].m_POC; |
---|
1692 | } |
---|
1693 | curGOP=m_iGOPSize+m_extraRPSs; |
---|
1694 | m_extraRPSs++; |
---|
1695 | } |
---|
1696 | numRefs=0; |
---|
1697 | for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) |
---|
1698 | { |
---|
1699 | Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i]; |
---|
1700 | if(absPOC >= 0) |
---|
1701 | { |
---|
1702 | refList[numRefs]=absPOC; |
---|
1703 | numRefs++; |
---|
1704 | } |
---|
1705 | } |
---|
1706 | refList[numRefs]=curPOC; |
---|
1707 | numRefs++; |
---|
1708 | } |
---|
1709 | checkGOP++; |
---|
1710 | } |
---|
1711 | xConfirmPara(errorGOP,"Invalid GOP structure given"); |
---|
1712 | m_maxTempLayer = 1; |
---|
1713 | for(Int i=0; i<m_iGOPSize; i++) |
---|
1714 | { |
---|
1715 | if(m_GOPList[i].m_temporalId >= m_maxTempLayer) |
---|
1716 | { |
---|
1717 | m_maxTempLayer = m_GOPList[i].m_temporalId+1; |
---|
1718 | } |
---|
1719 | xConfirmPara(m_GOPList[i].m_sliceType!='B'&&m_GOPList[i].m_sliceType!='P', "Slice type must be equal to B or P"); |
---|
1720 | } |
---|
1721 | for(Int i=0; i<MAX_TLAYER; i++) |
---|
1722 | { |
---|
1723 | m_numReorderPics[i] = 0; |
---|
1724 | m_maxDecPicBuffering[i] = 1; |
---|
1725 | } |
---|
1726 | for(Int i=0; i<m_iGOPSize; i++) |
---|
1727 | { |
---|
1728 | if(m_GOPList[i].m_numRefPics+1 > m_maxDecPicBuffering[m_GOPList[i].m_temporalId]) |
---|
1729 | { |
---|
1730 | m_maxDecPicBuffering[m_GOPList[i].m_temporalId] = m_GOPList[i].m_numRefPics + 1; |
---|
1731 | } |
---|
1732 | |
---|
1733 | #if SVC_EXTENSION |
---|
1734 | m_maxDecPicBuffering[m_GOPList[i].m_temporalId] += 1; // it should be updated if more than 1 resampling picture is used |
---|
1735 | #endif |
---|
1736 | |
---|
1737 | Int highestDecodingNumberWithLowerPOC = 0; |
---|
1738 | for(Int j=0; j<m_iGOPSize; j++) |
---|
1739 | { |
---|
1740 | if(m_GOPList[j].m_POC <= m_GOPList[i].m_POC) |
---|
1741 | { |
---|
1742 | highestDecodingNumberWithLowerPOC = j; |
---|
1743 | } |
---|
1744 | } |
---|
1745 | Int numReorder = 0; |
---|
1746 | for(Int j=0; j<highestDecodingNumberWithLowerPOC; j++) |
---|
1747 | { |
---|
1748 | if(m_GOPList[j].m_temporalId <= m_GOPList[i].m_temporalId && |
---|
1749 | m_GOPList[j].m_POC > m_GOPList[i].m_POC) |
---|
1750 | { |
---|
1751 | numReorder++; |
---|
1752 | } |
---|
1753 | } |
---|
1754 | if(numReorder > m_numReorderPics[m_GOPList[i].m_temporalId]) |
---|
1755 | { |
---|
1756 | m_numReorderPics[m_GOPList[i].m_temporalId] = numReorder; |
---|
1757 | } |
---|
1758 | } |
---|
1759 | for(Int i=0; i<MAX_TLAYER-1; i++) |
---|
1760 | { |
---|
1761 | // a lower layer can not have higher value of m_numReorderPics than a higher layer |
---|
1762 | if(m_numReorderPics[i+1] < m_numReorderPics[i]) |
---|
1763 | { |
---|
1764 | m_numReorderPics[i+1] = m_numReorderPics[i]; |
---|
1765 | } |
---|
1766 | // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ] - 1, inclusive |
---|
1767 | if(m_numReorderPics[i] > m_maxDecPicBuffering[i] - 1) |
---|
1768 | { |
---|
1769 | m_maxDecPicBuffering[i] = m_numReorderPics[i] + 1; |
---|
1770 | } |
---|
1771 | // a lower layer can not have higher value of m_uiMaxDecPicBuffering than a higher layer |
---|
1772 | if(m_maxDecPicBuffering[i+1] < m_maxDecPicBuffering[i]) |
---|
1773 | { |
---|
1774 | m_maxDecPicBuffering[i+1] = m_maxDecPicBuffering[i]; |
---|
1775 | } |
---|
1776 | } |
---|
1777 | |
---|
1778 | |
---|
1779 | // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ] - 1, inclusive |
---|
1780 | if(m_numReorderPics[MAX_TLAYER-1] > m_maxDecPicBuffering[MAX_TLAYER-1] - 1) |
---|
1781 | { |
---|
1782 | m_maxDecPicBuffering[MAX_TLAYER-1] = m_numReorderPics[MAX_TLAYER-1] + 1; |
---|
1783 | } |
---|
1784 | |
---|
1785 | #if SVC_EXTENSION // ToDo: it should be checked for the case when parameters are different for the layers |
---|
1786 | for(UInt layer = 0; layer < MAX_LAYERS; layer++) |
---|
1787 | { |
---|
1788 | Int m_iSourceWidth = m_acLayerCfg[layer].m_iSourceWidth; |
---|
1789 | Int m_iSourceHeight = m_acLayerCfg[layer].m_iSourceHeight; |
---|
1790 | #endif |
---|
1791 | if(m_vuiParametersPresentFlag && m_bitstreamRestrictionFlag) |
---|
1792 | { |
---|
1793 | Int PicSizeInSamplesY = m_iSourceWidth * m_iSourceHeight; |
---|
1794 | if(tileFlag) |
---|
1795 | { |
---|
1796 | Int maxTileWidth = 0; |
---|
1797 | Int maxTileHeight = 0; |
---|
1798 | Int widthInCU = (m_iSourceWidth % m_uiMaxCUWidth) ? m_iSourceWidth/m_uiMaxCUWidth + 1: m_iSourceWidth/m_uiMaxCUWidth; |
---|
1799 | Int heightInCU = (m_iSourceHeight % m_uiMaxCUHeight) ? m_iSourceHeight/m_uiMaxCUHeight + 1: m_iSourceHeight/m_uiMaxCUHeight; |
---|
1800 | if(m_iUniformSpacingIdr) |
---|
1801 | { |
---|
1802 | maxTileWidth = m_uiMaxCUWidth*((widthInCU+m_iNumColumnsMinus1)/(m_iNumColumnsMinus1+1)); |
---|
1803 | maxTileHeight = m_uiMaxCUHeight*((heightInCU+m_iNumRowsMinus1)/(m_iNumRowsMinus1+1)); |
---|
1804 | // if only the last tile-row is one treeblock higher than the others |
---|
1805 | // the maxTileHeight becomes smaller if the last row of treeblocks has lower height than the others |
---|
1806 | if(!((heightInCU-1)%(m_iNumRowsMinus1+1))) |
---|
1807 | { |
---|
1808 | maxTileHeight = maxTileHeight - m_uiMaxCUHeight + (m_iSourceHeight % m_uiMaxCUHeight); |
---|
1809 | } |
---|
1810 | // if only the last tile-column is one treeblock wider than the others |
---|
1811 | // the maxTileWidth becomes smaller if the last column of treeblocks has lower width than the others |
---|
1812 | if(!((widthInCU-1)%(m_iNumColumnsMinus1+1))) |
---|
1813 | { |
---|
1814 | maxTileWidth = maxTileWidth - m_uiMaxCUWidth + (m_iSourceWidth % m_uiMaxCUWidth); |
---|
1815 | } |
---|
1816 | } |
---|
1817 | else // not uniform spacing |
---|
1818 | { |
---|
1819 | if(m_iNumColumnsMinus1<1) |
---|
1820 | { |
---|
1821 | maxTileWidth = m_iSourceWidth; |
---|
1822 | } |
---|
1823 | else |
---|
1824 | { |
---|
1825 | Int accColumnWidth = 0; |
---|
1826 | for(Int col=0; col<(m_iNumColumnsMinus1); col++) |
---|
1827 | { |
---|
1828 | maxTileWidth = m_pColumnWidth[col]>maxTileWidth ? m_pColumnWidth[col]:maxTileWidth; |
---|
1829 | accColumnWidth += m_pColumnWidth[col]; |
---|
1830 | } |
---|
1831 | maxTileWidth = (widthInCU-accColumnWidth)>maxTileWidth ? m_uiMaxCUWidth*(widthInCU-accColumnWidth):m_uiMaxCUWidth*maxTileWidth; |
---|
1832 | } |
---|
1833 | if(m_iNumRowsMinus1<1) |
---|
1834 | { |
---|
1835 | maxTileHeight = m_iSourceHeight; |
---|
1836 | } |
---|
1837 | else |
---|
1838 | { |
---|
1839 | Int accRowHeight = 0; |
---|
1840 | for(Int row=0; row<(m_iNumRowsMinus1); row++) |
---|
1841 | { |
---|
1842 | maxTileHeight = m_pRowHeight[row]>maxTileHeight ? m_pRowHeight[row]:maxTileHeight; |
---|
1843 | accRowHeight += m_pRowHeight[row]; |
---|
1844 | } |
---|
1845 | maxTileHeight = (heightInCU-accRowHeight)>maxTileHeight ? m_uiMaxCUHeight*(heightInCU-accRowHeight):m_uiMaxCUHeight*maxTileHeight; |
---|
1846 | } |
---|
1847 | } |
---|
1848 | Int maxSizeInSamplesY = maxTileWidth*maxTileHeight; |
---|
1849 | m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/maxSizeInSamplesY-4; |
---|
1850 | } |
---|
1851 | else if(m_iWaveFrontSynchro) |
---|
1852 | { |
---|
1853 | m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/((2*m_iSourceHeight+m_iSourceWidth)*m_uiMaxCUHeight)-4; |
---|
1854 | } |
---|
1855 | else if(m_sliceMode == 1) |
---|
1856 | { |
---|
1857 | m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/(m_sliceArgument*m_uiMaxCUWidth*m_uiMaxCUHeight)-4; |
---|
1858 | } |
---|
1859 | else |
---|
1860 | { |
---|
1861 | m_minSpatialSegmentationIdc = 0; |
---|
1862 | } |
---|
1863 | } |
---|
1864 | #if SVC_EXTENSION |
---|
1865 | } |
---|
1866 | #endif |
---|
1867 | xConfirmPara( m_iWaveFrontSynchro < 0, "WaveFrontSynchro cannot be negative" ); |
---|
1868 | #if !SVC_EXTENSION |
---|
1869 | xConfirmPara( m_iWaveFrontSubstreams <= 0, "WaveFrontSubstreams must be positive" ); |
---|
1870 | xConfirmPara( m_iWaveFrontSubstreams > 1 && !m_iWaveFrontSynchro, "Must have WaveFrontSynchro > 0 in order to have WaveFrontSubstreams > 1" ); |
---|
1871 | #endif |
---|
1872 | |
---|
1873 | xConfirmPara( m_decodedPictureHashSEIEnabled<0 || m_decodedPictureHashSEIEnabled>3, "this hash type is not correct!\n"); |
---|
1874 | |
---|
1875 | if (m_toneMappingInfoSEIEnabled) |
---|
1876 | { |
---|
1877 | xConfirmPara( m_toneMapCodedDataBitDepth < 8 || m_toneMapCodedDataBitDepth > 14 , "SEIToneMapCodedDataBitDepth must be in rage 8 to 14"); |
---|
1878 | xConfirmPara( m_toneMapTargetBitDepth < 1 || (m_toneMapTargetBitDepth > 16 && m_toneMapTargetBitDepth < 255) , "SEIToneMapTargetBitDepth must be in rage 1 to 16 or equal to 255"); |
---|
1879 | xConfirmPara( m_toneMapModelId < 0 || m_toneMapModelId > 4 , "SEIToneMapModelId must be in rage 0 to 4"); |
---|
1880 | xConfirmPara( m_cameraIsoSpeedValue == 0, "SEIToneMapCameraIsoSpeedValue shall not be equal to 0"); |
---|
1881 | xConfirmPara( m_extendedRangeWhiteLevel < 100, "SEIToneMapExtendedRangeWhiteLevel should be greater than or equal to 100"); |
---|
1882 | xConfirmPara( m_nominalBlackLevelLumaCodeValue >= m_nominalWhiteLevelLumaCodeValue, "SEIToneMapNominalWhiteLevelLumaCodeValue shall be greater than SEIToneMapNominalBlackLevelLumaCodeValue"); |
---|
1883 | xConfirmPara( m_extendedWhiteLevelLumaCodeValue < m_nominalWhiteLevelLumaCodeValue, "SEIToneMapExtendedWhiteLevelLumaCodeValue shall be greater than or equal to SEIToneMapNominalWhiteLevelLumaCodeValue"); |
---|
1884 | } |
---|
1885 | |
---|
1886 | #if RATE_CONTROL_LAMBDA_DOMAIN |
---|
1887 | #if RC_SHVC_HARMONIZATION |
---|
1888 | for ( Int layer=0; layer<m_numLayers; layer++ ) |
---|
1889 | { |
---|
1890 | if ( m_acLayerCfg[layer].m_RCEnableRateControl ) |
---|
1891 | { |
---|
1892 | if ( m_acLayerCfg[layer].m_RCForceIntraQP ) |
---|
1893 | { |
---|
1894 | if ( m_acLayerCfg[layer].m_RCInitialQP == 0 ) |
---|
1895 | { |
---|
1896 | printf( "\nInitial QP for rate control is not specified. Reset not to use force intra QP!" ); |
---|
1897 | m_acLayerCfg[layer].m_RCForceIntraQP = false; |
---|
1898 | } |
---|
1899 | } |
---|
1900 | } |
---|
1901 | xConfirmPara( m_uiDeltaQpRD > 0, "Rate control cannot be used together with slice level multiple-QP optimization!\n" ); |
---|
1902 | } |
---|
1903 | #else |
---|
1904 | if ( m_RCEnableRateControl ) |
---|
1905 | { |
---|
1906 | if ( m_RCForceIntraQP ) |
---|
1907 | { |
---|
1908 | if ( m_RCInitialQP == 0 ) |
---|
1909 | { |
---|
1910 | printf( "\nInitial QP for rate control is not specified. Reset not to use force intra QP!" ); |
---|
1911 | m_RCForceIntraQP = false; |
---|
1912 | } |
---|
1913 | } |
---|
1914 | xConfirmPara( m_uiDeltaQpRD > 0, "Rate control cannot be used together with slice level multiple-QP optimization!\n" ); |
---|
1915 | } |
---|
1916 | #endif |
---|
1917 | #else |
---|
1918 | if(m_enableRateCtrl) |
---|
1919 | { |
---|
1920 | Int numLCUInWidth = (m_iSourceWidth / m_uiMaxCUWidth) + (( m_iSourceWidth % m_uiMaxCUWidth ) ? 1 : 0); |
---|
1921 | Int numLCUInHeight = (m_iSourceHeight / m_uiMaxCUHeight)+ (( m_iSourceHeight % m_uiMaxCUHeight) ? 1 : 0); |
---|
1922 | Int numLCUInPic = numLCUInWidth * numLCUInHeight; |
---|
1923 | |
---|
1924 | xConfirmPara( (numLCUInPic % m_numLCUInUnit) != 0, "total number of LCUs in a frame should be completely divided by NumLCUInUnit" ); |
---|
1925 | |
---|
1926 | m_iMaxDeltaQP = MAX_DELTA_QP; |
---|
1927 | m_iMaxCuDQPDepth = MAX_CUDQP_DEPTH; |
---|
1928 | } |
---|
1929 | #endif |
---|
1930 | |
---|
1931 | xConfirmPara(!m_TransquantBypassEnableFlag && m_CUTransquantBypassFlagValue, "CUTransquantBypassFlagValue cannot be 1 when TransquantBypassEnableFlag is 0"); |
---|
1932 | |
---|
1933 | xConfirmPara(m_log2ParallelMergeLevel < 2, "Log2ParallelMergeLevel should be larger than or equal to 2"); |
---|
1934 | if (m_framePackingSEIEnabled) |
---|
1935 | { |
---|
1936 | xConfirmPara(m_framePackingSEIType < 3 || m_framePackingSEIType > 5 , "SEIFramePackingType must be in rage 3 to 5"); |
---|
1937 | } |
---|
1938 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
1939 | #if M0457_PREDICTION_INDICATIONS |
---|
1940 | xConfirmPara( (m_acLayerCfg[0].m_numSamplePredRefLayers != 0) && (m_acLayerCfg[0].m_numSamplePredRefLayers != -1), "Layer 0 cannot have any reference layers" ); |
---|
1941 | // NOTE: m_numSamplePredRefLayers (for any layer) could be -1 (not signalled in cfg), in which case only the "previous layer" would be taken for reference |
---|
1942 | for(Int layer = 1; layer < MAX_LAYERS; layer++) |
---|
1943 | { |
---|
1944 | xConfirmPara(m_acLayerCfg[layer].m_numSamplePredRefLayers > layer, "Cannot reference more layers than before current layer"); |
---|
1945 | for(Int i = 0; i < m_acLayerCfg[layer].m_numSamplePredRefLayers; i++) |
---|
1946 | { |
---|
1947 | xConfirmPara(m_acLayerCfg[layer].m_samplePredRefLayerIds[i] > layer, "Cannot reference higher layers"); |
---|
1948 | xConfirmPara(m_acLayerCfg[layer].m_samplePredRefLayerIds[i] == layer, "Cannot reference the current layer itself"); |
---|
1949 | } |
---|
1950 | } |
---|
1951 | xConfirmPara( (m_acLayerCfg[0].m_numMotionPredRefLayers != 0) && (m_acLayerCfg[0].m_numMotionPredRefLayers != -1), "Layer 0 cannot have any reference layers" ); |
---|
1952 | // NOTE: m_numMotionPredRefLayers (for any layer) could be -1 (not signalled in cfg), in which case only the "previous layer" would be taken for reference |
---|
1953 | for(Int layer = 1; layer < MAX_LAYERS; layer++) |
---|
1954 | { |
---|
1955 | xConfirmPara(m_acLayerCfg[layer].m_numMotionPredRefLayers > layer, "Cannot reference more layers than before current layer"); |
---|
1956 | for(Int i = 0; i < m_acLayerCfg[layer].m_numMotionPredRefLayers; i++) |
---|
1957 | { |
---|
1958 | xConfirmPara(m_acLayerCfg[layer].m_motionPredRefLayerIds[i] > layer, "Cannot reference higher layers"); |
---|
1959 | xConfirmPara(m_acLayerCfg[layer].m_motionPredRefLayerIds[i] == layer, "Cannot reference the current layer itself"); |
---|
1960 | } |
---|
1961 | } |
---|
1962 | #else |
---|
1963 | xConfirmPara( (m_acLayerCfg[0].m_numDirectRefLayers != 0) && (m_acLayerCfg[0].m_numDirectRefLayers != -1), "Layer 0 cannot have any reference layers" ); |
---|
1964 | // NOTE: m_numDirectRefLayers (for any layer) could be -1 (not signalled in cfg), in which case only the "previous layer" would be taken for reference |
---|
1965 | for(Int layer = 1; layer < MAX_LAYERS; layer++) |
---|
1966 | { |
---|
1967 | xConfirmPara(m_acLayerCfg[layer].m_numDirectRefLayers > layer, "Cannot reference more layers than before current layer"); |
---|
1968 | for(Int i = 0; i < m_acLayerCfg[layer].m_numDirectRefLayers; i++) |
---|
1969 | { |
---|
1970 | xConfirmPara(m_acLayerCfg[layer].m_refLayerIds[i] > layer, "Cannot reference higher layers"); |
---|
1971 | xConfirmPara(m_acLayerCfg[layer].m_refLayerIds[i] == layer, "Cannot reference the current layer itself"); |
---|
1972 | } |
---|
1973 | } |
---|
1974 | #endif |
---|
1975 | xConfirmPara( (m_acLayerCfg[0].m_numActiveRefLayers != 0) && (m_acLayerCfg[0].m_numActiveRefLayers != -1), "Layer 0 cannot have any active reference layers" ); |
---|
1976 | // NOTE: m_numActiveRefLayers (for any layer) could be -1 (not signalled in cfg), in which case only the "previous layer" would be taken for reference |
---|
1977 | for(Int layer = 1; layer < MAX_LAYERS; layer++) |
---|
1978 | { |
---|
1979 | #if M0457_PREDICTION_INDICATIONS |
---|
1980 | Bool predEnabledFlag[MAX_LAYERS]; |
---|
1981 | for (Int refLayer = 0; refLayer < layer; refLayer++) |
---|
1982 | { |
---|
1983 | predEnabledFlag[refLayer] = false; |
---|
1984 | } |
---|
1985 | for(Int i = 0; i < m_acLayerCfg[layer].m_numSamplePredRefLayers; i++) |
---|
1986 | { |
---|
1987 | predEnabledFlag[m_acLayerCfg[layer].m_samplePredRefLayerIds[i]] = true; |
---|
1988 | } |
---|
1989 | for(Int i = 0; i < m_acLayerCfg[layer].m_numMotionPredRefLayers; i++) |
---|
1990 | { |
---|
1991 | predEnabledFlag[m_acLayerCfg[layer].m_motionPredRefLayerIds[i]] = true; |
---|
1992 | } |
---|
1993 | Int numDirectRefLayers = 0; |
---|
1994 | for (Int refLayer = 0; refLayer < layer; refLayer++) |
---|
1995 | { |
---|
1996 | if (predEnabledFlag[refLayer] == true) numDirectRefLayers++; |
---|
1997 | } |
---|
1998 | xConfirmPara(m_acLayerCfg[layer].m_numActiveRefLayers > numDirectRefLayers, "Cannot reference more layers than NumDirectRefLayers"); |
---|
1999 | for(Int i = 0; i < m_acLayerCfg[layer].m_numActiveRefLayers; i++) |
---|
2000 | { |
---|
2001 | xConfirmPara(m_acLayerCfg[layer].m_predLayerIds[i] >= numDirectRefLayers, "Cannot reference higher layers"); |
---|
2002 | } |
---|
2003 | #else |
---|
2004 | xConfirmPara(m_acLayerCfg[layer].m_numActiveRefLayers > m_acLayerCfg[layer].m_numDirectRefLayers, "Cannot reference more layers than NumDirectRefLayers"); |
---|
2005 | for(Int i = 0; i < m_acLayerCfg[layer].m_numActiveRefLayers; i++) |
---|
2006 | { |
---|
2007 | xConfirmPara(m_acLayerCfg[layer].m_predLayerIds[i] >= m_acLayerCfg[layer].m_numDirectRefLayers, "Cannot reference higher layers"); |
---|
2008 | } |
---|
2009 | #endif |
---|
2010 | } |
---|
2011 | #endif |
---|
2012 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
2013 | if (m_adaptiveResolutionChange > 0) |
---|
2014 | { |
---|
2015 | xConfirmPara(m_numLayers != 2, "Adaptive resolution change works with 2 layers only"); |
---|
2016 | xConfirmPara(m_acLayerCfg[1].m_iIntraPeriod == 0 || (m_adaptiveResolutionChange % m_acLayerCfg[1].m_iIntraPeriod) != 0, "Adaptive resolution change must happen at enhancement layer RAP picture"); |
---|
2017 | } |
---|
2018 | #endif |
---|
2019 | #undef xConfirmPara |
---|
2020 | if (check_failed) |
---|
2021 | { |
---|
2022 | exit(EXIT_FAILURE); |
---|
2023 | } |
---|
2024 | } |
---|
2025 | |
---|
2026 | /** \todo use of global variables should be removed later |
---|
2027 | */ |
---|
2028 | Void TAppEncCfg::xSetGlobal() |
---|
2029 | { |
---|
2030 | // set max CU width & height |
---|
2031 | g_uiMaxCUWidth = m_uiMaxCUWidth; |
---|
2032 | g_uiMaxCUHeight = m_uiMaxCUHeight; |
---|
2033 | |
---|
2034 | // compute actual CU depth with respect to config depth and max transform size |
---|
2035 | g_uiAddCUDepth = 0; |
---|
2036 | while( (m_uiMaxCUWidth>>m_uiMaxCUDepth) > ( 1 << ( m_uiQuadtreeTULog2MinSize + g_uiAddCUDepth ) ) ) g_uiAddCUDepth++; |
---|
2037 | |
---|
2038 | m_uiMaxCUDepth += g_uiAddCUDepth; |
---|
2039 | g_uiAddCUDepth++; |
---|
2040 | g_uiMaxCUDepth = m_uiMaxCUDepth; |
---|
2041 | |
---|
2042 | // set internal bit-depth and constants |
---|
2043 | g_bitDepthY = m_internalBitDepthY; |
---|
2044 | g_bitDepthC = m_internalBitDepthC; |
---|
2045 | |
---|
2046 | g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_inputBitDepthY : m_internalBitDepthY; |
---|
2047 | g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_inputBitDepthC : m_internalBitDepthC; |
---|
2048 | } |
---|
2049 | |
---|
2050 | Void TAppEncCfg::xPrintParameter() |
---|
2051 | { |
---|
2052 | printf("\n"); |
---|
2053 | #if SVC_EXTENSION |
---|
2054 | printf("Total number of layers : %d\n", m_numLayers ); |
---|
2055 | printf("Multiview : %d\n", m_scalabilityMask[0] ); |
---|
2056 | printf("Scalable : %d\n", m_scalabilityMask[1] ); |
---|
2057 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
2058 | printf("Adaptive Resolution Change : %d\n", m_adaptiveResolutionChange ); |
---|
2059 | #endif |
---|
2060 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
2061 | { |
---|
2062 | printf("=== Layer %d settings === \n", layer); |
---|
2063 | #if AVC_SYNTAX |
---|
2064 | m_acLayerCfg[layer].xPrintParameter( layer ); |
---|
2065 | #else |
---|
2066 | m_acLayerCfg[layer].xPrintParameter(); |
---|
2067 | #endif |
---|
2068 | printf("\n"); |
---|
2069 | } |
---|
2070 | printf("=== Common configuration settings === \n"); |
---|
2071 | printf("Bitstream File : %s\n", m_pBitstreamFile ); |
---|
2072 | #else |
---|
2073 | printf("Input File : %s\n", m_pchInputFile ); |
---|
2074 | printf("Bitstream File : %s\n", m_pchBitstreamFile ); |
---|
2075 | printf("Reconstruction File : %s\n", m_pchReconFile ); |
---|
2076 | printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_confLeft - m_confRight, m_iSourceHeight - m_confTop - m_confBottom, m_iFrameRate ); |
---|
2077 | printf("Internal Format : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate ); |
---|
2078 | #endif |
---|
2079 | printf("Frame index : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded ); |
---|
2080 | printf("CU size / depth : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth ); |
---|
2081 | printf("RQT trans. size (min / max) : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize ); |
---|
2082 | printf("Max RQT depth inter : %d\n", m_uiQuadtreeTUMaxDepthInter); |
---|
2083 | printf("Max RQT depth intra : %d\n", m_uiQuadtreeTUMaxDepthIntra); |
---|
2084 | printf("Min PCM size : %d\n", 1 << m_uiPCMLog2MinSize); |
---|
2085 | printf("Motion search range : %d\n", m_iSearchRange ); |
---|
2086 | #if !SVC_EXTENSION |
---|
2087 | printf("Intra period : %d\n", m_iIntraPeriod ); |
---|
2088 | #endif |
---|
2089 | printf("Decoding refresh type : %d\n", m_iDecodingRefreshType ); |
---|
2090 | #if !SVC_EXTENSION |
---|
2091 | printf("QP : %5.2f\n", m_fQP ); |
---|
2092 | #endif |
---|
2093 | printf("Max dQP signaling depth : %d\n", m_iMaxCuDQPDepth); |
---|
2094 | |
---|
2095 | printf("Cb QP Offset : %d\n", m_cbQpOffset ); |
---|
2096 | printf("Cr QP Offset : %d\n", m_crQpOffset); |
---|
2097 | |
---|
2098 | printf("QP adaptation : %d (range=%d)\n", m_bUseAdaptiveQP, (m_bUseAdaptiveQP ? m_iQPAdaptationRange : 0) ); |
---|
2099 | printf("GOP size : %d\n", m_iGOPSize ); |
---|
2100 | printf("Internal bit depth : (Y:%d, C:%d)\n", m_internalBitDepthY, m_internalBitDepthC ); |
---|
2101 | printf("PCM sample bit depth : (Y:%d, C:%d)\n", g_uiPCMBitDepthLuma, g_uiPCMBitDepthChroma ); |
---|
2102 | #if RATE_CONTROL_LAMBDA_DOMAIN |
---|
2103 | #if !RC_SHVC_HARMONIZATION |
---|
2104 | printf("RateControl : %d\n", m_RCEnableRateControl ); |
---|
2105 | if(m_RCEnableRateControl) |
---|
2106 | { |
---|
2107 | printf("TargetBitrate : %d\n", m_RCTargetBitrate ); |
---|
2108 | printf("KeepHierarchicalBit : %d\n", m_RCKeepHierarchicalBit ); |
---|
2109 | printf("LCULevelRC : %d\n", m_RCLCULevelRC ); |
---|
2110 | printf("UseLCUSeparateModel : %d\n", m_RCUseLCUSeparateModel ); |
---|
2111 | printf("InitialQP : %d\n", m_RCInitialQP ); |
---|
2112 | printf("ForceIntraQP : %d\n", m_RCForceIntraQP ); |
---|
2113 | } |
---|
2114 | #endif |
---|
2115 | #else |
---|
2116 | printf("RateControl : %d\n", m_enableRateCtrl); |
---|
2117 | if(m_enableRateCtrl) |
---|
2118 | { |
---|
2119 | printf("TargetBitrate : %d\n", m_targetBitrate); |
---|
2120 | printf("NumLCUInUnit : %d\n", m_numLCUInUnit); |
---|
2121 | } |
---|
2122 | #endif |
---|
2123 | printf("Max Num Merge Candidates : %d\n", m_maxNumMergeCand); |
---|
2124 | printf("\n"); |
---|
2125 | |
---|
2126 | printf("TOOL CFG: "); |
---|
2127 | printf("IBD:%d ", g_bitDepthY > m_inputBitDepthY || g_bitDepthC > m_inputBitDepthC); |
---|
2128 | printf("HAD:%d ", m_bUseHADME ); |
---|
2129 | printf("SRD:%d ", m_bUseSBACRD ); |
---|
2130 | printf("RDQ:%d ", m_useRDOQ ); |
---|
2131 | printf("RDQTS:%d ", m_useRDOQTS ); |
---|
2132 | printf("RDpenalty:%d ", m_rdPenalty ); |
---|
2133 | printf("SQP:%d ", m_uiDeltaQpRD ); |
---|
2134 | printf("ASR:%d ", m_bUseASR ); |
---|
2135 | printf("FEN:%d ", m_bUseFastEnc ); |
---|
2136 | printf("ECU:%d ", m_bUseEarlyCU ); |
---|
2137 | printf("FDM:%d ", m_useFastDecisionForMerge ); |
---|
2138 | printf("CFM:%d ", m_bUseCbfFastMode ); |
---|
2139 | printf("ESD:%d ", m_useEarlySkipDetection ); |
---|
2140 | #if FAST_INTRA_SHVC |
---|
2141 | printf("FIS:%d ", m_useFastIntraScalable ); |
---|
2142 | #endif |
---|
2143 | printf("RQT:%d ", 1 ); |
---|
2144 | printf("TransformSkip:%d ", m_useTransformSkip ); |
---|
2145 | printf("TransformSkipFast:%d ", m_useTransformSkipFast ); |
---|
2146 | printf("Slice: M=%d ", m_sliceMode); |
---|
2147 | if (m_sliceMode!=0) |
---|
2148 | { |
---|
2149 | printf("A=%d ", m_sliceArgument); |
---|
2150 | } |
---|
2151 | printf("SliceSegment: M=%d ",m_sliceSegmentMode); |
---|
2152 | if (m_sliceSegmentMode!=0) |
---|
2153 | { |
---|
2154 | printf("A=%d ", m_sliceSegmentArgument); |
---|
2155 | } |
---|
2156 | printf("CIP:%d ", m_bUseConstrainedIntraPred); |
---|
2157 | printf("SAO:%d ", (m_bUseSAO)?(1):(0)); |
---|
2158 | printf("PCM:%d ", (m_usePCM && (1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0); |
---|
2159 | printf("SAOLcuBasedOptimization:%d ", (m_saoLcuBasedOptimization)?(1):(0)); |
---|
2160 | |
---|
2161 | printf("LosslessCuEnabled:%d ", (m_useLossless)? 1:0 ); |
---|
2162 | printf("WPP:%d ", (Int)m_useWeightedPred); |
---|
2163 | printf("WPB:%d ", (Int)m_useWeightedBiPred); |
---|
2164 | printf("PME:%d ", m_log2ParallelMergeLevel); |
---|
2165 | #if !SVC_EXTENSION |
---|
2166 | printf(" WaveFrontSynchro:%d WaveFrontSubstreams:%d", |
---|
2167 | m_iWaveFrontSynchro, m_iWaveFrontSubstreams); |
---|
2168 | #endif |
---|
2169 | printf(" ScalingList:%d ", m_useScalingListId ); |
---|
2170 | printf("TMVPMode:%d ", m_TMVPModeId ); |
---|
2171 | #if ADAPTIVE_QP_SELECTION |
---|
2172 | printf("AQpS:%d", m_bUseAdaptQpSelect ); |
---|
2173 | #endif |
---|
2174 | |
---|
2175 | printf(" SignBitHidingFlag:%d ", m_signHideFlag); |
---|
2176 | #if SVC_EXTENSION |
---|
2177 | printf("RecalQP:%d ", m_recalculateQPAccordingToLambda ? 1 : 0 ); |
---|
2178 | #if AVC_BASE |
---|
2179 | printf("AvcBase:%d ", m_avcBaseLayerFlag ? 1 : 0); |
---|
2180 | #else |
---|
2181 | printf("AvcBase:%d ", 0); |
---|
2182 | #endif |
---|
2183 | #if REF_IDX_FRAMEWORK |
---|
2184 | printf("REF_IDX_FRAMEWORK:%d ", REF_IDX_FRAMEWORK); |
---|
2185 | printf("EL_RAP_SliceType: %d ", m_elRapSliceBEnabled); |
---|
2186 | printf("REF_IDX_ME_ZEROMV: %d ", REF_IDX_ME_ZEROMV); |
---|
2187 | printf("ENCODER_FAST_MODE: %d ", ENCODER_FAST_MODE); |
---|
2188 | printf("REF_IDX_MFM: %d ", REF_IDX_MFM); |
---|
2189 | #endif |
---|
2190 | #else |
---|
2191 | printf("RecalQP:%d", m_recalculateQPAccordingToLambda ? 1 : 0 ); |
---|
2192 | #endif |
---|
2193 | printf("\n\n"); |
---|
2194 | |
---|
2195 | fflush(stdout); |
---|
2196 | } |
---|
2197 | |
---|
2198 | Bool confirmPara(Bool bflag, const Char* message) |
---|
2199 | { |
---|
2200 | if (!bflag) |
---|
2201 | return false; |
---|
2202 | |
---|
2203 | printf("Error: %s\n",message); |
---|
2204 | return true; |
---|
2205 | } |
---|
2206 | |
---|
2207 | #if SCALED_REF_LAYER_OFFSETS |
---|
2208 | Void TAppEncCfg::cfgStringToArray(Int **arr, string cfgString, Int numEntries, const char* logString) |
---|
2209 | { |
---|
2210 | Char *tempChar = cfgString.empty() ? NULL : strdup(cfgString.c_str()); |
---|
2211 | if( numEntries > 0 ) |
---|
2212 | { |
---|
2213 | Char *arrayEntry; |
---|
2214 | Int i = 0; |
---|
2215 | *arr = new Int[numEntries]; |
---|
2216 | |
---|
2217 | arrayEntry = strtok( tempChar, " ,"); |
---|
2218 | while(arrayEntry != NULL) |
---|
2219 | { |
---|
2220 | if( i >= numEntries ) |
---|
2221 | { |
---|
2222 | printf( "%s: The number of entries specified is larger than the allowed number.\n", logString ); |
---|
2223 | exit( EXIT_FAILURE ); |
---|
2224 | } |
---|
2225 | *( *arr + i ) = atoi( arrayEntry ); |
---|
2226 | arrayEntry = strtok(NULL, " ,"); |
---|
2227 | i++; |
---|
2228 | } |
---|
2229 | if( i < numEntries ) |
---|
2230 | { |
---|
2231 | printf( "%s: Some entries are not specified.\n", logString ); |
---|
2232 | exit( EXIT_FAILURE ); |
---|
2233 | } |
---|
2234 | } |
---|
2235 | else |
---|
2236 | { |
---|
2237 | *arr = NULL; |
---|
2238 | } |
---|
2239 | } |
---|
2240 | #endif |
---|
2241 | //! \} |
---|