1 | /* The copyright in this software is being made available under the BSD |
---|
2 | * License, included below. This software may be subject to other third party |
---|
3 | * and contributor rights, including patent rights, and no such rights are |
---|
4 | * granted under this license. |
---|
5 | * |
---|
6 | * Copyright (c) 2010-2014, ITU/ISO/IEC |
---|
7 | * All rights reserved. |
---|
8 | * |
---|
9 | * Redistribution and use in source and binary forms, with or without |
---|
10 | * modification, are permitted provided that the following conditions are met: |
---|
11 | * |
---|
12 | * * Redistributions of source code must retain the above copyright notice, |
---|
13 | * this list of conditions and the following disclaimer. |
---|
14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
15 | * this list of conditions and the following disclaimer in the documentation |
---|
16 | * and/or other materials provided with the distribution. |
---|
17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
18 | * be used to endorse or promote products derived from this software without |
---|
19 | * specific prior written permission. |
---|
20 | * |
---|
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
32 | */ |
---|
33 | |
---|
34 | /** \file TAppEncCfg.cpp |
---|
35 | \brief Handle encoder configuration parameters |
---|
36 | */ |
---|
37 | |
---|
38 | #include <stdlib.h> |
---|
39 | #include <cassert> |
---|
40 | #include <cstring> |
---|
41 | #include <string> |
---|
42 | #include "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_maxTidRefPresentFlag(1) |
---|
72 | , m_pColumnWidth() |
---|
73 | , m_pRowHeight() |
---|
74 | , m_scalingListFile() |
---|
75 | , m_elRapSliceBEnabled(0) |
---|
76 | { |
---|
77 | for(UInt layer=0; layer<MAX_LAYERS; layer++) |
---|
78 | { |
---|
79 | m_acLayerCfg[layer].setAppEncCfg(this); |
---|
80 | } |
---|
81 | memset( m_scalabilityMask, 0, sizeof(m_scalabilityMask) ); |
---|
82 | } |
---|
83 | #else |
---|
84 | TAppEncCfg::TAppEncCfg() |
---|
85 | : m_pchInputFile() |
---|
86 | , m_pchBitstreamFile() |
---|
87 | , m_pchReconFile() |
---|
88 | , m_pchdQPFile() |
---|
89 | , m_pColumnWidth() |
---|
90 | , m_pRowHeight() |
---|
91 | , m_scalingListFile() |
---|
92 | { |
---|
93 | m_aidQP = NULL; |
---|
94 | m_startOfCodedInterval = NULL; |
---|
95 | m_codedPivotValue = NULL; |
---|
96 | m_targetPivotValue = NULL; |
---|
97 | } |
---|
98 | #endif |
---|
99 | |
---|
100 | TAppEncCfg::~TAppEncCfg() |
---|
101 | { |
---|
102 | #if SVC_EXTENSION |
---|
103 | free(m_pBitstreamFile); |
---|
104 | #else |
---|
105 | if ( m_aidQP ) |
---|
106 | { |
---|
107 | delete[] m_aidQP; |
---|
108 | } |
---|
109 | if ( m_startOfCodedInterval ) |
---|
110 | { |
---|
111 | delete[] m_startOfCodedInterval; |
---|
112 | m_startOfCodedInterval = NULL; |
---|
113 | } |
---|
114 | if ( m_codedPivotValue ) |
---|
115 | { |
---|
116 | delete[] m_codedPivotValue; |
---|
117 | m_codedPivotValue = NULL; |
---|
118 | } |
---|
119 | if ( m_targetPivotValue ) |
---|
120 | { |
---|
121 | delete[] m_targetPivotValue; |
---|
122 | m_targetPivotValue = NULL; |
---|
123 | } |
---|
124 | free(m_pchInputFile); |
---|
125 | free(m_pchBitstreamFile); |
---|
126 | #endif |
---|
127 | #if !SVC_EXTENSION |
---|
128 | free(m_pchReconFile); |
---|
129 | free(m_pchdQPFile); |
---|
130 | #endif |
---|
131 | free(m_pColumnWidth); |
---|
132 | free(m_pRowHeight); |
---|
133 | free(m_scalingListFile); |
---|
134 | } |
---|
135 | |
---|
136 | Void TAppEncCfg::create() |
---|
137 | { |
---|
138 | } |
---|
139 | |
---|
140 | Void TAppEncCfg::destroy() |
---|
141 | { |
---|
142 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
143 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
144 | { |
---|
145 | if( m_acLayerCfg[layer].m_numSamplePredRefLayers > 0 ) |
---|
146 | { |
---|
147 | delete [] m_acLayerCfg[layer].m_samplePredRefLayerIds; |
---|
148 | m_acLayerCfg[layer].m_samplePredRefLayerIds = NULL; |
---|
149 | } |
---|
150 | if( m_acLayerCfg[layer].m_numMotionPredRefLayers > 0 ) |
---|
151 | { |
---|
152 | delete [] m_acLayerCfg[layer].m_motionPredRefLayerIds; |
---|
153 | m_acLayerCfg[layer].m_motionPredRefLayerIds = NULL; |
---|
154 | } |
---|
155 | if( m_acLayerCfg[layer].m_numActiveRefLayers > 0 ) |
---|
156 | { |
---|
157 | delete [] m_acLayerCfg[layer].m_predLayerIds; |
---|
158 | m_acLayerCfg[layer].m_predLayerIds = NULL; |
---|
159 | } |
---|
160 | } |
---|
161 | #endif |
---|
162 | } |
---|
163 | |
---|
164 | std::istringstream &operator>>(std::istringstream &in, GOPEntry &entry) //input |
---|
165 | { |
---|
166 | in>>entry.m_sliceType; |
---|
167 | in>>entry.m_POC; |
---|
168 | in>>entry.m_QPOffset; |
---|
169 | in>>entry.m_QPFactor; |
---|
170 | in>>entry.m_tcOffsetDiv2; |
---|
171 | in>>entry.m_betaOffsetDiv2; |
---|
172 | in>>entry.m_temporalId; |
---|
173 | in>>entry.m_numRefPicsActive; |
---|
174 | in>>entry.m_numRefPics; |
---|
175 | for ( Int i = 0; i < entry.m_numRefPics; i++ ) |
---|
176 | { |
---|
177 | in>>entry.m_referencePics[i]; |
---|
178 | } |
---|
179 | in>>entry.m_interRPSPrediction; |
---|
180 | #if AUTO_INTER_RPS |
---|
181 | if (entry.m_interRPSPrediction==1) |
---|
182 | { |
---|
183 | in>>entry.m_deltaRPS; |
---|
184 | in>>entry.m_numRefIdc; |
---|
185 | for ( Int i = 0; i < entry.m_numRefIdc; i++ ) |
---|
186 | { |
---|
187 | in>>entry.m_refIdc[i]; |
---|
188 | } |
---|
189 | } |
---|
190 | else if (entry.m_interRPSPrediction==2) |
---|
191 | { |
---|
192 | in>>entry.m_deltaRPS; |
---|
193 | } |
---|
194 | #else |
---|
195 | if (entry.m_interRPSPrediction) |
---|
196 | { |
---|
197 | in>>entry.m_deltaRPS; |
---|
198 | in>>entry.m_numRefIdc; |
---|
199 | for ( Int i = 0; i < entry.m_numRefIdc; i++ ) |
---|
200 | { |
---|
201 | in>>entry.m_refIdc[i]; |
---|
202 | } |
---|
203 | } |
---|
204 | #endif |
---|
205 | return in; |
---|
206 | } |
---|
207 | |
---|
208 | #if AUXILIARY_PICTURES |
---|
209 | static inline ChromaFormat numberToChromaFormat(const Int val) |
---|
210 | { |
---|
211 | switch (val) |
---|
212 | { |
---|
213 | case 400: return CHROMA_400; break; |
---|
214 | case 420: return CHROMA_420; break; |
---|
215 | case 422: return CHROMA_422; break; |
---|
216 | case 444: return CHROMA_444; break; |
---|
217 | default: return NUM_CHROMA_FORMAT; |
---|
218 | } |
---|
219 | } |
---|
220 | #endif |
---|
221 | |
---|
222 | #if SVC_EXTENSION |
---|
223 | void TAppEncCfg::getDirFilename(string& filename, string& dir, const string path) |
---|
224 | { |
---|
225 | size_t pos = path.find_last_of("\\"); |
---|
226 | if(pos != std::string::npos) |
---|
227 | { |
---|
228 | filename.assign(path.begin() + pos + 1, path.end()); |
---|
229 | dir.assign(path.begin(), path.begin() + pos + 1); |
---|
230 | } |
---|
231 | else |
---|
232 | { |
---|
233 | pos = path.find_last_of("/"); |
---|
234 | if(pos != std::string::npos) |
---|
235 | { |
---|
236 | filename.assign(path.begin() + pos + 1, path.end()); |
---|
237 | dir.assign(path.begin(), path.begin() + pos + 1); |
---|
238 | } |
---|
239 | else |
---|
240 | { |
---|
241 | filename = path; |
---|
242 | dir.assign(""); |
---|
243 | } |
---|
244 | } |
---|
245 | } |
---|
246 | #endif |
---|
247 | |
---|
248 | static const struct MapStrToProfile { |
---|
249 | const Char* str; |
---|
250 | Profile::Name value; |
---|
251 | } strToProfile[] = { |
---|
252 | {"none", Profile::NONE}, |
---|
253 | {"main", Profile::MAIN}, |
---|
254 | {"main10", Profile::MAIN10}, |
---|
255 | {"main-still-picture", Profile::MAINSTILLPICTURE}, |
---|
256 | }; |
---|
257 | |
---|
258 | static const struct MapStrToTier { |
---|
259 | const Char* str; |
---|
260 | Level::Tier value; |
---|
261 | } strToTier[] = { |
---|
262 | {"main", Level::MAIN}, |
---|
263 | {"high", Level::HIGH}, |
---|
264 | }; |
---|
265 | |
---|
266 | static const struct MapStrToLevel { |
---|
267 | const Char* str; |
---|
268 | Level::Name value; |
---|
269 | } strToLevel[] = { |
---|
270 | {"none",Level::NONE}, |
---|
271 | {"1", Level::LEVEL1}, |
---|
272 | {"2", Level::LEVEL2}, |
---|
273 | {"2.1", Level::LEVEL2_1}, |
---|
274 | {"3", Level::LEVEL3}, |
---|
275 | {"3.1", Level::LEVEL3_1}, |
---|
276 | {"4", Level::LEVEL4}, |
---|
277 | {"4.1", Level::LEVEL4_1}, |
---|
278 | {"5", Level::LEVEL5}, |
---|
279 | {"5.1", Level::LEVEL5_1}, |
---|
280 | {"5.2", Level::LEVEL5_2}, |
---|
281 | {"6", Level::LEVEL6}, |
---|
282 | {"6.1", Level::LEVEL6_1}, |
---|
283 | {"6.2", Level::LEVEL6_2}, |
---|
284 | }; |
---|
285 | |
---|
286 | template<typename T, typename P> |
---|
287 | static istream& readStrToEnum(P map[], unsigned long mapLen, istream &in, T &val) |
---|
288 | { |
---|
289 | string str; |
---|
290 | in >> str; |
---|
291 | |
---|
292 | for (Int i = 0; i < mapLen; i++) |
---|
293 | { |
---|
294 | if (str == map[i].str) |
---|
295 | { |
---|
296 | val = map[i].value; |
---|
297 | goto found; |
---|
298 | } |
---|
299 | } |
---|
300 | /* not found */ |
---|
301 | in.setstate(ios::failbit); |
---|
302 | found: |
---|
303 | return in; |
---|
304 | } |
---|
305 | |
---|
306 | static istream& operator>>(istream &in, Profile::Name &profile) |
---|
307 | { |
---|
308 | return readStrToEnum(strToProfile, sizeof(strToProfile)/sizeof(*strToProfile), in, profile); |
---|
309 | } |
---|
310 | |
---|
311 | static istream& operator>>(istream &in, Level::Tier &tier) |
---|
312 | { |
---|
313 | return readStrToEnum(strToTier, sizeof(strToTier)/sizeof(*strToTier), in, tier); |
---|
314 | } |
---|
315 | |
---|
316 | static istream& operator>>(istream &in, Level::Name &level) |
---|
317 | { |
---|
318 | return readStrToEnum(strToLevel, sizeof(strToLevel)/sizeof(*strToLevel), in, level); |
---|
319 | } |
---|
320 | |
---|
321 | // ==================================================================================================================== |
---|
322 | // Public member functions |
---|
323 | // ==================================================================================================================== |
---|
324 | |
---|
325 | /** \param argc number of arguments |
---|
326 | \param argv array of arguments |
---|
327 | \retval true when success |
---|
328 | */ |
---|
329 | Bool TAppEncCfg::parseCfg( Int argc, Char* argv[] ) |
---|
330 | { |
---|
331 | Bool do_help = false; |
---|
332 | |
---|
333 | #if SVC_EXTENSION |
---|
334 | string cfg_LayerCfgFile [MAX_LAYERS]; |
---|
335 | string cfg_BitstreamFile; |
---|
336 | string* cfg_InputFile [MAX_LAYERS]; |
---|
337 | string* cfg_ReconFile [MAX_LAYERS]; |
---|
338 | Double* cfg_fQP [MAX_LAYERS]; |
---|
339 | #if Q0074_SEI_COLOR_MAPPING |
---|
340 | string* cfg_seiColorMappingFile[MAX_LAYERS]; |
---|
341 | #endif |
---|
342 | |
---|
343 | #if REPN_FORMAT_IN_VPS |
---|
344 | Int* cfg_repFormatIdx [MAX_LAYERS]; |
---|
345 | #endif |
---|
346 | Int* cfg_SourceWidth [MAX_LAYERS]; |
---|
347 | Int* cfg_SourceHeight [MAX_LAYERS]; |
---|
348 | Int* cfg_FrameRate [MAX_LAYERS]; |
---|
349 | Int* cfg_IntraPeriod [MAX_LAYERS]; |
---|
350 | Int* cfg_conformanceMode [MAX_LAYERS]; |
---|
351 | #if LAYER_CTB |
---|
352 | // coding unit (CU) definition |
---|
353 | UInt* cfg_uiMaxCUWidth[MAX_LAYERS]; ///< max. CU width in pixel |
---|
354 | UInt* cfg_uiMaxCUHeight[MAX_LAYERS]; ///< max. CU height in pixel |
---|
355 | UInt* cfg_uiMaxCUDepth[MAX_LAYERS]; ///< max. CU depth |
---|
356 | |
---|
357 | // transfom unit (TU) definition |
---|
358 | UInt* cfg_uiQuadtreeTULog2MaxSize[MAX_LAYERS]; |
---|
359 | UInt* cfg_uiQuadtreeTULog2MinSize[MAX_LAYERS]; |
---|
360 | |
---|
361 | UInt* cfg_uiQuadtreeTUMaxDepthInter[MAX_LAYERS]; |
---|
362 | UInt* cfg_uiQuadtreeTUMaxDepthIntra[MAX_LAYERS]; |
---|
363 | #endif |
---|
364 | #if AUXILIARY_PICTURES |
---|
365 | Int cfg_tmpChromaFormatIDC [MAX_LAYERS]; |
---|
366 | Int cfg_tmpInputChromaFormat[MAX_LAYERS]; |
---|
367 | Int* cfg_auxId [MAX_LAYERS]; |
---|
368 | #endif |
---|
369 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
370 | Int* cfg_numSamplePredRefLayers [MAX_LAYERS]; |
---|
371 | string cfg_samplePredRefLayerIds [MAX_LAYERS]; |
---|
372 | string* cfg_samplePredRefLayerIdsPtr[MAX_LAYERS]; |
---|
373 | Int* cfg_numMotionPredRefLayers [MAX_LAYERS]; |
---|
374 | string cfg_motionPredRefLayerIds [MAX_LAYERS]; |
---|
375 | string* cfg_motionPredRefLayerIdsPtr[MAX_LAYERS]; |
---|
376 | Int* cfg_numActiveRefLayers [MAX_LAYERS]; |
---|
377 | string cfg_predLayerIds [MAX_LAYERS]; |
---|
378 | string* cfg_predLayerIdsPtr [MAX_LAYERS]; |
---|
379 | #endif |
---|
380 | #if O0098_SCALED_REF_LAYER_ID |
---|
381 | string cfg_scaledRefLayerId [MAX_LAYERS]; |
---|
382 | #endif |
---|
383 | string cfg_scaledRefLayerLeftOffset [MAX_LAYERS]; |
---|
384 | string cfg_scaledRefLayerTopOffset [MAX_LAYERS]; |
---|
385 | string cfg_scaledRefLayerRightOffset [MAX_LAYERS]; |
---|
386 | string cfg_scaledRefLayerBottomOffset [MAX_LAYERS]; |
---|
387 | Int* cfg_numScaledRefLayerOffsets[MAX_LAYERS]; |
---|
388 | #if P0312_VERT_PHASE_ADJ |
---|
389 | string cfg_vertPhasePositionEnableFlag[MAX_LAYERS]; |
---|
390 | #endif |
---|
391 | |
---|
392 | #if O0098_SCALED_REF_LAYER_ID |
---|
393 | string* cfg_scaledRefLayerIdPtr [MAX_LAYERS]; |
---|
394 | #endif |
---|
395 | string* cfg_scaledRefLayerLeftOffsetPtr [MAX_LAYERS]; |
---|
396 | string* cfg_scaledRefLayerTopOffsetPtr [MAX_LAYERS]; |
---|
397 | string* cfg_scaledRefLayerRightOffsetPtr [MAX_LAYERS]; |
---|
398 | string* cfg_scaledRefLayerBottomOffsetPtr [MAX_LAYERS]; |
---|
399 | #if P0312_VERT_PHASE_ADJ |
---|
400 | string* cfg_vertPhasePositionEnableFlagPtr[MAX_LAYERS]; |
---|
401 | #endif |
---|
402 | |
---|
403 | #if RC_SHVC_HARMONIZATION |
---|
404 | Bool* cfg_RCEnableRateControl [MAX_LAYERS]; |
---|
405 | Int* cfg_RCTargetBitRate [MAX_LAYERS]; |
---|
406 | Bool* cfg_RCKeepHierarchicalBit[MAX_LAYERS]; |
---|
407 | Bool* cfg_RCLCULevelRC [MAX_LAYERS]; |
---|
408 | Bool* cfg_RCUseLCUSeparateModel[MAX_LAYERS]; |
---|
409 | Int* cfg_RCInitialQP [MAX_LAYERS]; |
---|
410 | Bool* cfg_RCForceIntraQP [MAX_LAYERS]; |
---|
411 | #endif |
---|
412 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
413 | Int* cfg_InputBitDepthY [MAX_LAYERS]; |
---|
414 | Int* cfg_InternalBitDepthY [MAX_LAYERS]; |
---|
415 | Int* cfg_InputBitDepthC [MAX_LAYERS]; |
---|
416 | Int* cfg_InternalBitDepthC [MAX_LAYERS]; |
---|
417 | Int* cfg_OutputBitDepthY [MAX_LAYERS]; |
---|
418 | Int* cfg_OutputBitDepthC [MAX_LAYERS]; |
---|
419 | #endif |
---|
420 | Int* cfg_maxTidIlRefPicsPlus1[MAX_LAYERS]; |
---|
421 | for(UInt layer = 0; layer < MAX_LAYERS; layer++) |
---|
422 | { |
---|
423 | cfg_InputFile[layer] = &m_acLayerCfg[layer].m_cInputFile; |
---|
424 | cfg_ReconFile[layer] = &m_acLayerCfg[layer].m_cReconFile; |
---|
425 | cfg_fQP[layer] = &m_acLayerCfg[layer].m_fQP; |
---|
426 | #if REPN_FORMAT_IN_VPS |
---|
427 | cfg_repFormatIdx[layer] = &m_acLayerCfg[layer].m_repFormatIdx; |
---|
428 | #endif |
---|
429 | cfg_SourceWidth[layer] = &m_acLayerCfg[layer].m_iSourceWidth; |
---|
430 | cfg_SourceHeight[layer] = &m_acLayerCfg[layer].m_iSourceHeight; |
---|
431 | cfg_FrameRate[layer] = &m_acLayerCfg[layer].m_iFrameRate; |
---|
432 | cfg_IntraPeriod[layer] = &m_acLayerCfg[layer].m_iIntraPeriod; |
---|
433 | cfg_conformanceMode[layer] = &m_acLayerCfg[layer].m_conformanceMode; |
---|
434 | #if Q0074_SEI_COLOR_MAPPING |
---|
435 | cfg_seiColorMappingFile[layer] = &m_acLayerCfg[layer].m_cSeiColorMappingFile; |
---|
436 | #endif |
---|
437 | #if LAYER_CTB |
---|
438 | // coding unit (CU) definition |
---|
439 | cfg_uiMaxCUWidth[layer] = &m_acLayerCfg[layer].m_uiMaxCUWidth; |
---|
440 | cfg_uiMaxCUHeight[layer] = &m_acLayerCfg[layer].m_uiMaxCUHeight; |
---|
441 | cfg_uiMaxCUDepth[layer] = &m_acLayerCfg[layer].m_uiMaxCUDepth; |
---|
442 | |
---|
443 | // transfom unit (TU) definition. |
---|
444 | cfg_uiQuadtreeTULog2MaxSize[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTULog2MaxSize; |
---|
445 | cfg_uiQuadtreeTULog2MinSize[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTULog2MinSize; |
---|
446 | |
---|
447 | cfg_uiQuadtreeTUMaxDepthInter[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthInter; |
---|
448 | cfg_uiQuadtreeTUMaxDepthIntra[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthIntra; |
---|
449 | #endif |
---|
450 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
451 | cfg_numSamplePredRefLayers [layer] = &m_acLayerCfg[layer].m_numSamplePredRefLayers; |
---|
452 | cfg_samplePredRefLayerIdsPtr[layer] = &cfg_samplePredRefLayerIds[layer]; |
---|
453 | cfg_numMotionPredRefLayers [layer] = &m_acLayerCfg[layer].m_numMotionPredRefLayers; |
---|
454 | cfg_motionPredRefLayerIdsPtr[layer] = &cfg_motionPredRefLayerIds[layer]; |
---|
455 | cfg_numActiveRefLayers [layer] = &m_acLayerCfg[layer].m_numActiveRefLayers; |
---|
456 | cfg_predLayerIdsPtr [layer] = &cfg_predLayerIds[layer]; |
---|
457 | #endif |
---|
458 | cfg_numScaledRefLayerOffsets [layer] = &m_acLayerCfg[layer].m_numScaledRefLayerOffsets; |
---|
459 | for(Int i = 0; i < MAX_LAYERS; i++) |
---|
460 | { |
---|
461 | #if O0098_SCALED_REF_LAYER_ID |
---|
462 | cfg_scaledRefLayerIdPtr [layer] = &cfg_scaledRefLayerId[layer]; |
---|
463 | #endif |
---|
464 | cfg_scaledRefLayerLeftOffsetPtr [layer] = &cfg_scaledRefLayerLeftOffset[layer]; |
---|
465 | cfg_scaledRefLayerTopOffsetPtr [layer] = &cfg_scaledRefLayerTopOffset[layer]; |
---|
466 | cfg_scaledRefLayerRightOffsetPtr [layer] = &cfg_scaledRefLayerRightOffset[layer]; |
---|
467 | cfg_scaledRefLayerBottomOffsetPtr[layer] = &cfg_scaledRefLayerBottomOffset[layer]; |
---|
468 | #if P0312_VERT_PHASE_ADJ |
---|
469 | cfg_vertPhasePositionEnableFlagPtr[layer] = &cfg_vertPhasePositionEnableFlag[layer]; |
---|
470 | #endif |
---|
471 | } |
---|
472 | #if RC_SHVC_HARMONIZATION |
---|
473 | cfg_RCEnableRateControl[layer] = &m_acLayerCfg[layer].m_RCEnableRateControl; |
---|
474 | cfg_RCTargetBitRate[layer] = &m_acLayerCfg[layer].m_RCTargetBitrate; |
---|
475 | cfg_RCKeepHierarchicalBit[layer] = &m_acLayerCfg[layer].m_RCKeepHierarchicalBit; |
---|
476 | cfg_RCLCULevelRC[layer] = &m_acLayerCfg[layer].m_RCLCULevelRC; |
---|
477 | cfg_RCUseLCUSeparateModel[layer] = &m_acLayerCfg[layer].m_RCUseLCUSeparateModel; |
---|
478 | cfg_RCInitialQP[layer] = &m_acLayerCfg[layer].m_RCInitialQP; |
---|
479 | cfg_RCForceIntraQP[layer] = &m_acLayerCfg[layer].m_RCForceIntraQP; |
---|
480 | #endif |
---|
481 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
482 | cfg_InputBitDepthY [layer] = &m_acLayerCfg[layer].m_inputBitDepthY; |
---|
483 | cfg_InternalBitDepthY[layer] = &m_acLayerCfg[layer].m_internalBitDepthY; |
---|
484 | cfg_InputBitDepthC [layer] = &m_acLayerCfg[layer].m_inputBitDepthC; |
---|
485 | cfg_InternalBitDepthC[layer] = &m_acLayerCfg[layer].m_internalBitDepthC; |
---|
486 | cfg_OutputBitDepthY [layer] = &m_acLayerCfg[layer].m_outputBitDepthY; |
---|
487 | cfg_OutputBitDepthC [layer] = &m_acLayerCfg[layer].m_outputBitDepthC; |
---|
488 | #endif |
---|
489 | cfg_maxTidIlRefPicsPlus1[layer] = &m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1; |
---|
490 | #if AUXILIARY_PICTURES |
---|
491 | cfg_auxId[layer] = &m_acLayerCfg[layer].m_auxId; |
---|
492 | #endif |
---|
493 | } |
---|
494 | #if Q0078_ADD_LAYER_SETS |
---|
495 | Int* cfg_numLayerInIdList[MAX_VPS_LAYER_SETS_PLUS1]; |
---|
496 | string cfg_layerSetLayerIdList[MAX_VPS_LAYER_SETS_PLUS1]; |
---|
497 | string* cfg_layerSetLayerIdListPtr[MAX_VPS_LAYER_SETS_PLUS1]; |
---|
498 | Int* cfg_numHighestLayerIdx[MAX_VPS_LAYER_SETS_PLUS1]; |
---|
499 | string cfg_highestLayerIdx[MAX_VPS_LAYER_SETS_PLUS1]; |
---|
500 | string* cfg_highestLayerIdxPtr[MAX_VPS_LAYER_SETS_PLUS1]; |
---|
501 | for (UInt i = 0; i < MAX_VPS_LAYER_SETS_PLUS1; i++) |
---|
502 | { |
---|
503 | cfg_numLayerInIdList[i] = &m_numLayerInIdList[i]; |
---|
504 | cfg_layerSetLayerIdListPtr[i] = &cfg_layerSetLayerIdList[i]; |
---|
505 | cfg_highestLayerIdxPtr[i] = &cfg_highestLayerIdx[i]; |
---|
506 | cfg_numHighestLayerIdx[i] = &m_numHighestLayerIdx[i]; |
---|
507 | } |
---|
508 | #endif |
---|
509 | #if AVC_BASE |
---|
510 | string cfg_BLInputFile; |
---|
511 | #endif |
---|
512 | #if AVC_SYNTAX |
---|
513 | string cfg_BLSyntaxFile; |
---|
514 | #endif |
---|
515 | #if N0383_IL_CONSTRAINED_TILE_SETS_SEI |
---|
516 | string cfg_tileSets; |
---|
517 | #endif |
---|
518 | #else //SVC_EXTENSION |
---|
519 | string cfg_InputFile; |
---|
520 | string cfg_BitstreamFile; |
---|
521 | string cfg_ReconFile; |
---|
522 | string cfg_dQPFile; |
---|
523 | #endif //SVC_EXTENSION |
---|
524 | string cfg_ColumnWidth; |
---|
525 | string cfg_RowHeight; |
---|
526 | string cfg_ScalingListFile; |
---|
527 | string cfg_startOfCodedInterval; |
---|
528 | string cfg_codedPivotValue; |
---|
529 | string cfg_targetPivotValue; |
---|
530 | #if P0050_KNEE_FUNCTION_SEI |
---|
531 | string cfg_kneeSEIInputKneePointValue; |
---|
532 | string cfg_kneeSEIOutputKneePointValue; |
---|
533 | #endif |
---|
534 | po::Options opts; |
---|
535 | opts.addOptions() |
---|
536 | ("help", do_help, false, "this help text") |
---|
537 | ("c", po::parseConfigFile, "configuration file name") |
---|
538 | |
---|
539 | // File, I/O and source parameters |
---|
540 | #if SVC_EXTENSION |
---|
541 | ("InputFile%d,-i%d", cfg_InputFile, string(""), MAX_LAYERS, "original YUV input file name for layer %d") |
---|
542 | ("ReconFile%d,-o%d", cfg_ReconFile, string(""), MAX_LAYERS, "reconstruction YUV input file name for layer %d") |
---|
543 | ("LayerConfig%d,-lc%d", cfg_LayerCfgFile, string(""), MAX_LAYERS, "layer %d configuration file name") |
---|
544 | ("SourceWidth%d,-wdt%d", cfg_SourceWidth, 0, MAX_LAYERS, "Source picture width for layer %d") |
---|
545 | ("SourceHeight%d,-hgt%d", cfg_SourceHeight, 0, MAX_LAYERS, "Source picture height for layer %d") |
---|
546 | ("FrameRate%d,-fr%d", cfg_FrameRate, 0, MAX_LAYERS, "Frame rate for layer %d") |
---|
547 | ("LambdaModifier%d,-LM%d", m_adLambdaModifier, ( double )1.0, MAX_TLAYER, "Lambda modifier for temporal layer %d") |
---|
548 | #if O0215_PHASE_ALIGNMENT |
---|
549 | ("PhaseAlignment", m_phaseAlignFlag, false, "indicate the sample location alignment between layers (0: zero position aligned, 1: central position aligned)") |
---|
550 | #endif |
---|
551 | #if REPN_FORMAT_IN_VPS |
---|
552 | ("RepFormatIdx%d", cfg_repFormatIdx, -1, MAX_LAYERS, "Index to the representation format structure used from the VPS") |
---|
553 | #endif |
---|
554 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
555 | ("NumSamplePredRefLayers%d",cfg_numSamplePredRefLayers, -1, MAX_LAYERS, "Number of sample prediction reference layers") |
---|
556 | ("SamplePredRefLayerIds%d", cfg_samplePredRefLayerIdsPtr, string(""), MAX_LAYERS, "sample pred reference layer IDs") |
---|
557 | ("NumMotionPredRefLayers%d",cfg_numMotionPredRefLayers, -1, MAX_LAYERS, "Number of motion prediction reference layers") |
---|
558 | ("MotionPredRefLayerIds%d", cfg_motionPredRefLayerIdsPtr, string(""), MAX_LAYERS, "motion pred reference layer IDs") |
---|
559 | ("NumActiveRefLayers%d", cfg_numActiveRefLayers, -1, MAX_LAYERS, "Number of active reference layers") |
---|
560 | ("PredLayerIds%d", cfg_predLayerIdsPtr, string(""), MAX_LAYERS, "inter-layer prediction layer IDs") |
---|
561 | #endif |
---|
562 | ("NumLayers", m_numLayers, 1, "Number of layers to code") |
---|
563 | #if Q0078_ADD_LAYER_SETS |
---|
564 | ("NumLayerSets", m_numLayerSets, 0, "Number of layer sets") |
---|
565 | ("NumLayerInIdList%d", cfg_numLayerInIdList, 0, MAX_VPS_LAYER_ID_PLUS1, "Number of layers in the set") |
---|
566 | ("LayerSetLayerIdList%d", cfg_layerSetLayerIdListPtr, string(""), MAX_VPS_LAYER_ID_PLUS1, "Layer IDs for the set") |
---|
567 | ("NumAddLayerSets", m_numAddLayerSets, 0, "Number of additional layer sets") |
---|
568 | ("NumHighestLayerIdx%d", cfg_numHighestLayerIdx, 0, MAX_VPS_LAYER_ID_PLUS1, "Number of highest layer idx") |
---|
569 | ("HighestLayerIdx%d", cfg_highestLayerIdxPtr, string(""), MAX_VPS_LAYER_ID_PLUS1, "Highest layer idx for an additional layer set") |
---|
570 | #endif |
---|
571 | #if AUXILIARY_PICTURES |
---|
572 | ("InputChromaFormat%d", cfg_tmpInputChromaFormat, 420, MAX_LAYERS, "InputChromaFormatIDC for layer %d") |
---|
573 | ("ChromaFormatIDC%d,-cf", cfg_tmpChromaFormatIDC, 420, MAX_LAYERS, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat) for layer %d") |
---|
574 | ("AuxId%d", cfg_auxId, 0, MAX_LAYERS, "Auxilary picture ID for layer %d (0: Not aux pic, 1: Alpha plane, 2: Depth picture, 3: Cb enh, 4: Cr enh") |
---|
575 | #endif |
---|
576 | ("ConformanceMode%d", cfg_conformanceMode,0, MAX_LAYERS, "Window conformance mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping") |
---|
577 | ("ScalabilityMask1", m_scalabilityMask[1], 0, "scalability_mask[1] (multiview)") |
---|
578 | ("ScalabilityMask2", m_scalabilityMask[2], 1, "scalability_mask[2] (scalable)" ) |
---|
579 | #if AUXILIARY_PICTURES |
---|
580 | ("ScalabilityMask3", m_scalabilityMask[3], 0, "scalability_mask[3] (auxiliary pictures)" ) |
---|
581 | #endif |
---|
582 | ("BitstreamFile,b", cfg_BitstreamFile, string(""), "Bitstream output file name") |
---|
583 | #if !O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
584 | ("InputBitDepth", m_inputBitDepthY, 8, "Bit-depth of input file") |
---|
585 | ("OutputBitDepth", m_outputBitDepthY, 0, "Bit-depth of output file (default:InternalBitDepth)") |
---|
586 | ("InternalBitDepth", m_internalBitDepthY, 0, "Bit-depth the codec operates at. (default:InputBitDepth)" |
---|
587 | "If different to InputBitDepth, source data will be converted") |
---|
588 | ("InputBitDepthC", m_inputBitDepthC, 0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)") |
---|
589 | ("OutputBitDepthC", m_outputBitDepthC, 0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)") |
---|
590 | ("InternalBitDepthC", m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)") |
---|
591 | #endif |
---|
592 | ("NumScaledRefLayerOffsets%d", cfg_numScaledRefLayerOffsets, 0, MAX_LAYERS, "Number of scaled offset layer sets ") |
---|
593 | #if O0098_SCALED_REF_LAYER_ID |
---|
594 | ("ScaledRefLayerId%d", cfg_scaledRefLayerIdPtr, string(""), MAX_LAYERS, "Layer ID of scaled base layer picture") |
---|
595 | #endif |
---|
596 | ("ScaledRefLayerLeftOffset%d", cfg_scaledRefLayerLeftOffsetPtr, string(""), MAX_LAYERS, "Horizontal offset of top-left luma sample of scaled base layer picture with respect to" |
---|
597 | " top-left luma sample of the EL picture, in units of two luma samples") |
---|
598 | ("ScaledRefLayerTopOffset%d", cfg_scaledRefLayerTopOffsetPtr, string(""), MAX_LAYERS, "Vertical offset of top-left luma sample of scaled base layer picture with respect to" |
---|
599 | " top-left luma sample of the EL picture, in units of two luma samples") |
---|
600 | ("ScaledRefLayerRightOffset%d", cfg_scaledRefLayerRightOffsetPtr, string(""), MAX_LAYERS, "Horizontal offset of bottom-right luma sample of scaled base layer picture with respect to" |
---|
601 | " bottom-right luma sample of the EL picture, in units of two luma samples") |
---|
602 | ("ScaledRefLayerBottomOffset%d", cfg_scaledRefLayerBottomOffsetPtr,string(""), MAX_LAYERS, "Vertical offset of bottom-right luma sample of scaled base layer picture with respect to" |
---|
603 | " bottom-right luma sample of the EL picture, in units of two luma samples") |
---|
604 | #if P0312_VERT_PHASE_ADJ |
---|
605 | ("VertPhasePositionEnableFlag%d", cfg_vertPhasePositionEnableFlagPtr,string(""), MAX_LAYERS, "VertPhasePositionEnableFlag for layer %d") |
---|
606 | #endif |
---|
607 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
608 | ("InputBitDepth%d", cfg_InputBitDepthY, 8, MAX_LAYERS, "Bit-depth of input file for layer %d") |
---|
609 | ("InternalBitDepth%d", cfg_InternalBitDepthY, 0, MAX_LAYERS, "Bit-depth the codec operates at. (default:InputBitDepth) for layer %d ") |
---|
610 | // "If different to InputBitDepth, source data will be converted") |
---|
611 | ("InputBitDepthC%d", cfg_InputBitDepthC, 0, MAX_LAYERS, "As per InputBitDepth but for chroma component. (default:InputBitDepth) for layer %d") |
---|
612 | ("InternalBitDepthC%d", cfg_InternalBitDepthC, 0, MAX_LAYERS, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth) for layer %d") |
---|
613 | ("OutputBitDepth%d", cfg_OutputBitDepthY, 0, MAX_LAYERS, "Bit-depth of output file (default:InternalBitDepth)") |
---|
614 | ("OutputBitDepthC%d", cfg_OutputBitDepthC, 0, MAX_LAYERS, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)") |
---|
615 | #endif |
---|
616 | ("MaxTidRefPresentFlag", m_maxTidRefPresentFlag, true, "max_tid_ref_present_flag (0: not present, 1: present(default)) " ) |
---|
617 | ("MaxTidIlRefPicsPlus1%d", cfg_maxTidIlRefPicsPlus1, 1, MAX_LAYERS, "allowed maximum temporal_id for inter-layer prediction") |
---|
618 | #if O0223_PICTURE_TYPES_ALIGN_FLAG |
---|
619 | ("CrossLayerPictureTypeAlignFlag", m_crossLayerPictureTypeAlignFlag, true, "align picture type across layers" ) |
---|
620 | #endif |
---|
621 | ("CrossLayerIrapAlignFlag", m_crossLayerIrapAlignFlag, true, "align IRAP across layers" ) |
---|
622 | #if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG |
---|
623 | ("CrossLayerAlignedIdrOnlyFlag", m_crossLayerAlignedIdrOnlyFlag, true, "only idr for IRAP across layers" ) |
---|
624 | #endif |
---|
625 | #if O0194_WEIGHTED_PREDICTION_CGS |
---|
626 | ("InterLayerWeightedPred", m_useInterLayerWeightedPred, false, "enable IL WP parameters estimation at encoder" ) |
---|
627 | #endif |
---|
628 | #if AVC_BASE |
---|
629 | ("AvcBase,-avc", m_avcBaseLayerFlag, 0, "avc_base_layer_flag") |
---|
630 | ("InputBLFile,-ibl", cfg_BLInputFile, string(""), "Base layer rec YUV input file name") |
---|
631 | #if AVC_SYNTAX |
---|
632 | ("InputBLSyntaxFile,-ibs", cfg_BLSyntaxFile, string(""), "Base layer syntax input file name") |
---|
633 | #endif |
---|
634 | #endif |
---|
635 | ("EnableElRapB,-use-rap-b", m_elRapSliceBEnabled, 0, "Set ILP over base-layer I picture to B picture (default is P picture)") |
---|
636 | #if Q0074_SEI_COLOR_MAPPING |
---|
637 | ("SEIColorMappingFile%d", cfg_seiColorMappingFile, string(""), MAX_LAYERS, "File Containing SEI Color Mapping data") |
---|
638 | #endif |
---|
639 | #else //SVC_EXTENSION |
---|
640 | ("InputFile,i", cfg_InputFile, string(""), "Original YUV input file name") |
---|
641 | ("BitstreamFile,b", cfg_BitstreamFile, string(""), "Bitstream output file name") |
---|
642 | ("ReconFile,o", cfg_ReconFile, string(""), "Reconstructed YUV output file name") |
---|
643 | ("SourceWidth,-wdt", m_iSourceWidth, 0, "Source picture width") |
---|
644 | ("SourceHeight,-hgt", m_iSourceHeight, 0, "Source picture height") |
---|
645 | ("InputBitDepth", m_inputBitDepthY, 8, "Bit-depth of input file") |
---|
646 | ("OutputBitDepth", m_outputBitDepthY, 0, "Bit-depth of output file (default:InternalBitDepth)") |
---|
647 | ("InternalBitDepth", m_internalBitDepthY, 0, "Bit-depth the codec operates at. (default:InputBitDepth)" |
---|
648 | "If different to InputBitDepth, source data will be converted") |
---|
649 | ("InputBitDepthC", m_inputBitDepthC, 0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)") |
---|
650 | ("OutputBitDepthC", m_outputBitDepthC, 0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)") |
---|
651 | ("InternalBitDepthC", m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)") |
---|
652 | #if AUXILIARY_PICTURES |
---|
653 | ("InputChromaFormat", tmpInputChromaFormat, 420, "InputChromaFormatIDC") |
---|
654 | ("ChromaFormatIDC,-cf", tmpChromaFormat, 0, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat)") |
---|
655 | #endif |
---|
656 | ("ConformanceMode", m_conformanceMode, 0, "Window conformance mode (0: no window, 1:automatic padding, 2:padding, 3:conformance") |
---|
657 | ("HorizontalPadding,-pdx",m_aiPad[0], 0, "Horizontal source padding for conformance window mode 2") |
---|
658 | ("VerticalPadding,-pdy", m_aiPad[1], 0, "Vertical source padding for conformance window mode 2") |
---|
659 | ("ConfLeft", m_confLeft, 0, "Left offset for window conformance mode 3") |
---|
660 | ("ConfRight", m_confRight, 0, "Right offset for window conformance mode 3") |
---|
661 | ("ConfTop", m_confTop, 0, "Top offset for window conformance mode 3") |
---|
662 | ("ConfBottom", m_confBottom, 0, "Bottom offset for window conformance mode 3") |
---|
663 | ("FrameRate,-fr", m_iFrameRate, 0, "Frame rate") |
---|
664 | #endif //SVC_EXTENSION |
---|
665 | ("FrameSkip,-fs", m_FrameSkip, 0u, "Number of frames to skip at start of input YUV") |
---|
666 | ("FramesToBeEncoded,f", m_framesToBeEncoded, 0, "Number of frames to be encoded (default=all)") |
---|
667 | |
---|
668 | //Field coding parameters |
---|
669 | ("FieldCoding", m_isField, false, "Signals if it's a field based coding") |
---|
670 | ("TopFieldFirst, Tff", m_isTopFieldFirst, false, "In case of field based coding, signals whether if it's a top field first or not") |
---|
671 | |
---|
672 | // Profile and level |
---|
673 | ("Profile", m_profile, Profile::NONE, "Profile to be used when encoding (Incomplete)") |
---|
674 | ("Level", m_level, Level::NONE, "Level limit to be used, eg 5.1 (Incomplete)") |
---|
675 | ("Tier", m_levelTier, Level::MAIN, "Tier to use for interpretation of --Level") |
---|
676 | |
---|
677 | ("ProgressiveSource", m_progressiveSourceFlag, false, "Indicate that source is progressive") |
---|
678 | ("InterlacedSource", m_interlacedSourceFlag, false, "Indicate that source is interlaced") |
---|
679 | ("NonPackedSource", m_nonPackedConstraintFlag, false, "Indicate that source does not contain frame packing") |
---|
680 | ("FrameOnly", m_frameOnlyConstraintFlag, false, "Indicate that the bitstream contains only frames") |
---|
681 | |
---|
682 | #if LAYER_CTB |
---|
683 | // Unit definition parameters |
---|
684 | ("MaxCUWidth%d", cfg_uiMaxCUWidth, 64u, MAX_LAYERS, "Maximum CU width") |
---|
685 | ("MaxCUHeight%d", cfg_uiMaxCUHeight, 64u, MAX_LAYERS, "Maximum CU height") |
---|
686 | // todo: remove defaults from MaxCUSize |
---|
687 | ("MaxCUSize%d,s%d", cfg_uiMaxCUWidth, 64u, MAX_LAYERS, "Maximum CU size") |
---|
688 | ("MaxCUSize%d,s%d", cfg_uiMaxCUHeight, 64u, MAX_LAYERS, "Maximum CU size") |
---|
689 | ("MaxPartitionDepth%d,h%d", cfg_uiMaxCUDepth, 4u, MAX_LAYERS, "CU depth") |
---|
690 | |
---|
691 | ("QuadtreeTULog2MaxSize%d", cfg_uiQuadtreeTULog2MaxSize, 6u, MAX_LAYERS, "Maximum TU size in logarithm base 2") |
---|
692 | ("QuadtreeTULog2MinSize%d", cfg_uiQuadtreeTULog2MinSize, 2u, MAX_LAYERS, "Minimum TU size in logarithm base 2") |
---|
693 | |
---|
694 | ("QuadtreeTUMaxDepthIntra%d", cfg_uiQuadtreeTUMaxDepthIntra, 1u, MAX_LAYERS, "Depth of TU tree for intra CUs") |
---|
695 | ("QuadtreeTUMaxDepthInter%d", cfg_uiQuadtreeTUMaxDepthInter, 2u, MAX_LAYERS, "Depth of TU tree for inter CUs") |
---|
696 | |
---|
697 | |
---|
698 | // set the same CU realted settings across all the layers if config file parameters are not layer specific |
---|
699 | ("MaxCUWidth", cfg_uiMaxCUWidth, 64u, MAX_LAYERS, "Maximum CU width") |
---|
700 | ("MaxCUHeight", cfg_uiMaxCUHeight, 64u, MAX_LAYERS, "Maximum CU height") |
---|
701 | // todo: remove defaults from MaxCUSize |
---|
702 | ("MaxCUSize,s", cfg_uiMaxCUWidth, 64u, MAX_LAYERS, "Maximum CU size") |
---|
703 | ("MaxCUSize,s", cfg_uiMaxCUHeight, 64u, MAX_LAYERS, "Maximum CU size") |
---|
704 | ("MaxPartitionDepth,h", cfg_uiMaxCUDepth, 4u, MAX_LAYERS, "CU depth") |
---|
705 | |
---|
706 | ("QuadtreeTULog2MaxSize", cfg_uiQuadtreeTULog2MaxSize, 6u, MAX_LAYERS, "Maximum TU size in logarithm base 2") |
---|
707 | ("QuadtreeTULog2MinSize", cfg_uiQuadtreeTULog2MinSize, 2u, MAX_LAYERS, "Minimum TU size in logarithm base 2") |
---|
708 | |
---|
709 | ("QuadtreeTUMaxDepthIntra", cfg_uiQuadtreeTUMaxDepthIntra, 1u, MAX_LAYERS, "Depth of TU tree for intra CUs") |
---|
710 | ("QuadtreeTUMaxDepthInter", cfg_uiQuadtreeTUMaxDepthInter, 2u, MAX_LAYERS, "Depth of TU tree for inter CUs") |
---|
711 | #else |
---|
712 | // Unit definition parameters |
---|
713 | ("MaxCUWidth", m_uiMaxCUWidth, 64u) |
---|
714 | ("MaxCUHeight", m_uiMaxCUHeight, 64u) |
---|
715 | // todo: remove defaults from MaxCUSize |
---|
716 | ("MaxCUSize,s", m_uiMaxCUWidth, 64u, "Maximum CU size") |
---|
717 | ("MaxCUSize,s", m_uiMaxCUHeight, 64u, "Maximum CU size") |
---|
718 | ("MaxPartitionDepth,h", m_uiMaxCUDepth, 4u, "CU depth") |
---|
719 | |
---|
720 | ("QuadtreeTULog2MaxSize", m_uiQuadtreeTULog2MaxSize, 6u, "Maximum TU size in logarithm base 2") |
---|
721 | ("QuadtreeTULog2MinSize", m_uiQuadtreeTULog2MinSize, 2u, "Minimum TU size in logarithm base 2") |
---|
722 | |
---|
723 | ("QuadtreeTUMaxDepthIntra", m_uiQuadtreeTUMaxDepthIntra, 1u, "Depth of TU tree for intra CUs") |
---|
724 | ("QuadtreeTUMaxDepthInter", m_uiQuadtreeTUMaxDepthInter, 2u, "Depth of TU tree for inter CUs") |
---|
725 | #endif |
---|
726 | |
---|
727 | // Coding structure paramters |
---|
728 | #if SVC_EXTENSION |
---|
729 | ("IntraPeriod%d,-ip%d", cfg_IntraPeriod, -1, MAX_LAYERS, "intra period in frames for layer %d, (-1: only first frame)") |
---|
730 | #else |
---|
731 | ("IntraPeriod,-ip", m_iIntraPeriod, -1, "Intra period in frames, (-1: only first frame)") |
---|
732 | #endif |
---|
733 | #if ALLOW_RECOVERY_POINT_AS_RAP |
---|
734 | ("DecodingRefreshType,-dr", m_iDecodingRefreshType, 0, "Intra refresh type (0:none 1:CRA 2:IDR 3:RecPointSEI)") |
---|
735 | #else |
---|
736 | ("DecodingRefreshType,-dr", m_iDecodingRefreshType, 0, "Intra refresh type (0:none 1:CRA 2:IDR)") |
---|
737 | #endif |
---|
738 | ("GOPSize,g", m_iGOPSize, 1, "GOP size of temporal structure") |
---|
739 | // motion options |
---|
740 | ("FastSearch", m_iFastSearch, 1, "0:Full search 1:Diamond 2:PMVFAST") |
---|
741 | ("SearchRange,-sr", m_iSearchRange, 96, "Motion search range") |
---|
742 | ("BipredSearchRange", m_bipredSearchRange, 4, "Motion search range for bipred refinement") |
---|
743 | ("HadamardME", m_bUseHADME, true, "Hadamard ME for fractional-pel") |
---|
744 | ("ASR", m_bUseASR, false, "Adaptive motion search range") |
---|
745 | |
---|
746 | #if SVC_EXTENSION |
---|
747 | ("LambdaModifier%d,-LM%d", m_adLambdaModifier, ( double )1.0, MAX_TLAYER, "Lambda modifier for temporal layer %d") |
---|
748 | #else |
---|
749 | // Mode decision parameters |
---|
750 | ("LambdaModifier0,-LM0", m_adLambdaModifier[ 0 ], ( Double )1.0, "Lambda modifier for temporal layer 0") |
---|
751 | ("LambdaModifier1,-LM1", m_adLambdaModifier[ 1 ], ( Double )1.0, "Lambda modifier for temporal layer 1") |
---|
752 | ("LambdaModifier2,-LM2", m_adLambdaModifier[ 2 ], ( Double )1.0, "Lambda modifier for temporal layer 2") |
---|
753 | ("LambdaModifier3,-LM3", m_adLambdaModifier[ 3 ], ( Double )1.0, "Lambda modifier for temporal layer 3") |
---|
754 | ("LambdaModifier4,-LM4", m_adLambdaModifier[ 4 ], ( Double )1.0, "Lambda modifier for temporal layer 4") |
---|
755 | ("LambdaModifier5,-LM5", m_adLambdaModifier[ 5 ], ( Double )1.0, "Lambda modifier for temporal layer 5") |
---|
756 | ("LambdaModifier6,-LM6", m_adLambdaModifier[ 6 ], ( Double )1.0, "Lambda modifier for temporal layer 6") |
---|
757 | #endif |
---|
758 | |
---|
759 | /* Quantization parameters */ |
---|
760 | #if SVC_EXTENSION |
---|
761 | ("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") |
---|
762 | #else |
---|
763 | ("QP,q", m_fQP, 30.0, "Qp value, if value is float, QP is switched once during encoding") |
---|
764 | #endif |
---|
765 | ("DeltaQpRD,-dqr",m_uiDeltaQpRD, 0u, "max dQp offset for slice") |
---|
766 | ("MaxDeltaQP,d", m_iMaxDeltaQP, 0, "max dQp offset for block") |
---|
767 | ("MaxCuDQPDepth,-dqd", m_iMaxCuDQPDepth, 0, "max depth for a minimum CuDQP") |
---|
768 | |
---|
769 | ("CbQpOffset,-cbqpofs", m_cbQpOffset, 0, "Chroma Cb QP Offset") |
---|
770 | ("CrQpOffset,-crqpofs", m_crQpOffset, 0, "Chroma Cr QP Offset") |
---|
771 | |
---|
772 | #if ADAPTIVE_QP_SELECTION |
---|
773 | ("AdaptiveQpSelection,-aqps", m_bUseAdaptQpSelect, false, "AdaptiveQpSelection") |
---|
774 | #endif |
---|
775 | |
---|
776 | ("AdaptiveQP,-aq", m_bUseAdaptiveQP, false, "QP adaptation based on a psycho-visual model") |
---|
777 | ("MaxQPAdaptationRange,-aqr", m_iQPAdaptationRange, 6, "QP adaptation range") |
---|
778 | #if !SVC_EXTENSION |
---|
779 | ("dQPFile,m", cfg_dQPFile, string(""), "dQP file name") |
---|
780 | #endif |
---|
781 | ("RDOQ", m_useRDOQ, true ) |
---|
782 | ("RDOQTS", m_useRDOQTS, true ) |
---|
783 | ("RDpenalty", m_rdPenalty, 0, "RD-penalty for 32x32 TU for intra in non-intra slices. 0:disbaled 1:RD-penalty 2:maximum RD-penalty") |
---|
784 | |
---|
785 | // Deblocking filter parameters |
---|
786 | ("LoopFilterDisable", m_bLoopFilterDisable, false ) |
---|
787 | ("LoopFilterOffsetInPPS", m_loopFilterOffsetInPPS, false ) |
---|
788 | ("LoopFilterBetaOffset_div2", m_loopFilterBetaOffsetDiv2, 0 ) |
---|
789 | ("LoopFilterTcOffset_div2", m_loopFilterTcOffsetDiv2, 0 ) |
---|
790 | ("DeblockingFilterControlPresent", m_DeblockingFilterControlPresent, false ) |
---|
791 | ("DeblockingFilterMetric", m_DeblockingFilterMetric, false ) |
---|
792 | |
---|
793 | // Coding tools |
---|
794 | ("AMP", m_enableAMP, true, "Enable asymmetric motion partitions") |
---|
795 | ("TransformSkip", m_useTransformSkip, false, "Intra transform skipping") |
---|
796 | ("TransformSkipFast", m_useTransformSkipFast, false, "Fast intra transform skipping") |
---|
797 | ("SAO", m_bUseSAO, true, "Enable Sample Adaptive Offset") |
---|
798 | ("MaxNumOffsetsPerPic", m_maxNumOffsetsPerPic, 2048, "Max number of SAO offset per picture (Default: 2048)") |
---|
799 | ("SAOLcuBoundary", m_saoLcuBoundary, false, "0: right/bottom LCU boundary areas skipped from SAO parameter estimation, 1: non-deblocked pixels are used for those areas") |
---|
800 | ("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") |
---|
801 | ("SliceArgument", m_sliceArgument, 0, "Depending on SliceMode being:" |
---|
802 | "\t1: max number of CTUs per slice" |
---|
803 | "\t2: max number of bytes per slice" |
---|
804 | "\t3: max number of tiles per slice") |
---|
805 | ("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") |
---|
806 | ("SliceSegmentArgument", m_sliceSegmentArgument, 0, "Depending on SliceSegmentMode being:" |
---|
807 | "\t1: max number of CTUs per slice segment" |
---|
808 | "\t2: max number of bytes per slice segment" |
---|
809 | "\t3: max number of tiles per slice segment") |
---|
810 | ("LFCrossSliceBoundaryFlag", m_bLFCrossSliceBoundaryFlag, true) |
---|
811 | |
---|
812 | ("ConstrainedIntraPred", m_bUseConstrainedIntraPred, false, "Constrained Intra Prediction") |
---|
813 | |
---|
814 | ("PCMEnabledFlag", m_usePCM, false) |
---|
815 | ("PCMLog2MaxSize", m_pcmLog2MaxSize, 5u) |
---|
816 | ("PCMLog2MinSize", m_uiPCMLog2MinSize, 3u) |
---|
817 | ("PCMInputBitDepthFlag", m_bPCMInputBitDepthFlag, true) |
---|
818 | ("PCMFilterDisableFlag", m_bPCMFilterDisableFlag, false) |
---|
819 | |
---|
820 | ("WeightedPredP,-wpP", m_useWeightedPred, false, "Use weighted prediction in P slices") |
---|
821 | ("WeightedPredB,-wpB", m_useWeightedBiPred, false, "Use weighted (bidirectional) prediction in B slices") |
---|
822 | ("Log2ParallelMergeLevel", m_log2ParallelMergeLevel, 2u, "Parallel merge estimation region") |
---|
823 | ("UniformSpacingIdc", m_iUniformSpacingIdr, 0, "Indicates if the column and row boundaries are distributed uniformly") |
---|
824 | ("NumTileColumnsMinus1", m_iNumColumnsMinus1, 0, "Number of columns in a picture minus 1") |
---|
825 | ("ColumnWidthArray", cfg_ColumnWidth, string(""), "Array containing ColumnWidth values in units of LCU") |
---|
826 | ("NumTileRowsMinus1", m_iNumRowsMinus1, 0, "Number of rows in a picture minus 1") |
---|
827 | ("RowHeightArray", cfg_RowHeight, string(""), "Array containing RowHeight values in units of LCU") |
---|
828 | ("LFCrossTileBoundaryFlag", m_bLFCrossTileBoundaryFlag, true, "1: cross-tile-boundary loop filtering. 0:non-cross-tile-boundary loop filtering") |
---|
829 | ("WaveFrontSynchro", m_iWaveFrontSynchro, 0, "0: no synchro; 1 synchro with TR; 2 TRR etc") |
---|
830 | ("ScalingList", m_useScalingListId, 0, "0: no scaling list, 1: default scaling lists, 2: scaling lists specified in ScalingListFile") |
---|
831 | ("ScalingListFile", cfg_ScalingListFile, string(""), "Scaling list file name") |
---|
832 | ("SignHideFlag,-SBH", m_signHideFlag, 1) |
---|
833 | ("MaxNumMergeCand", m_maxNumMergeCand, 5u, "Maximum number of merge candidates") |
---|
834 | |
---|
835 | /* Misc. */ |
---|
836 | ("SEIDecodedPictureHash", m_decodedPictureHashSEIEnabled, 0, "Control generation of decode picture hash SEI messages\n" |
---|
837 | "\t3: checksum\n" |
---|
838 | "\t2: CRC\n" |
---|
839 | "\t1: use MD5\n" |
---|
840 | "\t0: disable") |
---|
841 | ("SEIpictureDigest", m_decodedPictureHashSEIEnabled, 0, "deprecated alias for SEIDecodedPictureHash") |
---|
842 | ("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") |
---|
843 | ("FEN", m_bUseFastEnc, false, "fast encoder setting") |
---|
844 | ("ECU", m_bUseEarlyCU, false, "Early CU setting") |
---|
845 | ("FDM", m_useFastDecisionForMerge, true, "Fast decision for Merge RD Cost") |
---|
846 | ("CFM", m_bUseCbfFastMode, false, "Cbf fast mode setting") |
---|
847 | ("ESD", m_useEarlySkipDetection, false, "Early SKIP detection setting") |
---|
848 | #if FAST_INTRA_SHVC |
---|
849 | ("FIS", m_useFastIntraScalable, false, "Fast Intra Decision for Scalable HEVC") |
---|
850 | #endif |
---|
851 | #if RC_SHVC_HARMONIZATION |
---|
852 | ("RateControl%d", cfg_RCEnableRateControl, false, MAX_LAYERS, "Rate control: enable rate control for layer %d") |
---|
853 | ("TargetBitrate%d", cfg_RCTargetBitRate, 0, MAX_LAYERS, "Rate control: target bitrate for layer %d") |
---|
854 | ("KeepHierarchicalBit%d", cfg_RCKeepHierarchicalBit, false, MAX_LAYERS, "Rate control: keep hierarchical bit allocation for layer %d") |
---|
855 | ("LCULevelRateControl%d", cfg_RCLCULevelRC, true, MAX_LAYERS, "Rate control: LCU level RC") |
---|
856 | ("RCLCUSeparateModel%d", cfg_RCUseLCUSeparateModel, true, MAX_LAYERS, "Rate control: Use LCU level separate R-lambda model") |
---|
857 | ("InitialQP%d", cfg_RCInitialQP, 0, MAX_LAYERS, "Rate control: initial QP") |
---|
858 | ("RCForceIntraQP%d", cfg_RCForceIntraQP, false, MAX_LAYERS, "Rate control: force intra QP to be equal to initial QP") |
---|
859 | #else |
---|
860 | ( "RateControl", m_RCEnableRateControl, false, "Rate control: enable rate control" ) |
---|
861 | ( "TargetBitrate", m_RCTargetBitrate, 0, "Rate control: target bitrate" ) |
---|
862 | ( "KeepHierarchicalBit", m_RCKeepHierarchicalBit, 0, "Rate control: 0: equal bit allocation; 1: fixed ratio bit allocation; 2: adaptive ratio bit allocation" ) |
---|
863 | ( "LCULevelRateControl", m_RCLCULevelRC, true, "Rate control: true: LCU level RC; false: picture level RC" ) |
---|
864 | ( "RCLCUSeparateModel", m_RCUseLCUSeparateModel, true, "Rate control: use LCU level separate R-lambda model" ) |
---|
865 | ( "InitialQP", m_RCInitialQP, 0, "Rate control: initial QP" ) |
---|
866 | ( "RCForceIntraQP", m_RCForceIntraQP, false, "Rate control: force intra QP to be equal to initial QP" ) |
---|
867 | #endif |
---|
868 | |
---|
869 | ("TransquantBypassEnableFlag", m_TransquantBypassEnableFlag, false, "transquant_bypass_enable_flag indicator in PPS") |
---|
870 | ("CUTransquantBypassFlagForce", m_CUTransquantBypassFlagForce, false, "Force transquant bypass mode, when transquant_bypass_enable_flag is enabled") |
---|
871 | ("RecalculateQPAccordingToLambda", m_recalculateQPAccordingToLambda, false, "Recalculate QP values according to lambda values. Do not suggest to be enabled in all intra case") |
---|
872 | ("StrongIntraSmoothing,-sis", m_useStrongIntraSmoothing, true, "Enable strong intra smoothing for 32x32 blocks") |
---|
873 | ("SEIActiveParameterSets", m_activeParameterSetsSEIEnabled, 0, "Enable generation of active parameter sets SEI messages") |
---|
874 | ("VuiParametersPresent,-vui", m_vuiParametersPresentFlag, false, "Enable generation of vui_parameters()") |
---|
875 | ("AspectRatioInfoPresent", m_aspectRatioInfoPresentFlag, false, "Signals whether aspect_ratio_idc is present") |
---|
876 | ("AspectRatioIdc", m_aspectRatioIdc, 0, "aspect_ratio_idc") |
---|
877 | ("SarWidth", m_sarWidth, 0, "horizontal size of the sample aspect ratio") |
---|
878 | ("SarHeight", m_sarHeight, 0, "vertical size of the sample aspect ratio") |
---|
879 | ("OverscanInfoPresent", m_overscanInfoPresentFlag, false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n") |
---|
880 | ("OverscanAppropriate", m_overscanAppropriateFlag, false, "Indicates whether conformant decoded pictures are suitable for display using overscan\n") |
---|
881 | ("VideoSignalTypePresent", m_videoSignalTypePresentFlag, false, "Signals whether video_format, video_full_range_flag, and colour_description_present_flag are present") |
---|
882 | ("VideoFormat", m_videoFormat, 5, "Indicates representation of pictures") |
---|
883 | ("VideoFullRange", m_videoFullRangeFlag, false, "Indicates the black level and range of luma and chroma signals") |
---|
884 | ("ColourDescriptionPresent", m_colourDescriptionPresentFlag, false, "Signals whether colour_primaries, transfer_characteristics and matrix_coefficients are present") |
---|
885 | ("ColourPrimaries", m_colourPrimaries, 2, "Indicates chromaticity coordinates of the source primaries") |
---|
886 | ("TransferCharateristics", m_transferCharacteristics, 2, "Indicates the opto-electronic transfer characteristics of the source") |
---|
887 | ("MatrixCoefficients", m_matrixCoefficients, 2, "Describes the matrix coefficients used in deriving luma and chroma from RGB primaries") |
---|
888 | ("ChromaLocInfoPresent", m_chromaLocInfoPresentFlag, false, "Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present") |
---|
889 | ("ChromaSampleLocTypeTopField", m_chromaSampleLocTypeTopField, 0, "Specifies the location of chroma samples for top field") |
---|
890 | ("ChromaSampleLocTypeBottomField", m_chromaSampleLocTypeBottomField, 0, "Specifies the location of chroma samples for bottom field") |
---|
891 | ("NeutralChromaIndication", m_neutralChromaIndicationFlag, false, "Indicates that the value of all decoded chroma samples is equal to 1<<(BitDepthCr-1)") |
---|
892 | ("DefaultDisplayWindowFlag", m_defaultDisplayWindowFlag, false, "Indicates the presence of the Default Window parameters") |
---|
893 | ("DefDispWinLeftOffset", m_defDispWinLeftOffset, 0, "Specifies the left offset of the default display window from the conformance window") |
---|
894 | ("DefDispWinRightOffset", m_defDispWinRightOffset, 0, "Specifies the right offset of the default display window from the conformance window") |
---|
895 | ("DefDispWinTopOffset", m_defDispWinTopOffset, 0, "Specifies the top offset of the default display window from the conformance window") |
---|
896 | ("DefDispWinBottomOffset", m_defDispWinBottomOffset, 0, "Specifies the bottom offset of the default display window from the conformance window") |
---|
897 | ("FrameFieldInfoPresentFlag", m_frameFieldInfoPresentFlag, false, "Indicates that pic_struct and field coding related values are present in picture timing SEI messages") |
---|
898 | ("PocProportionalToTimingFlag", m_pocProportionalToTimingFlag, false, "Indicates that the POC value is proportional to the output time w.r.t. first picture in CVS") |
---|
899 | ("NumTicksPocDiffOneMinus1", m_numTicksPocDiffOneMinus1, 0, "Number of ticks minus 1 that for a POC difference of one") |
---|
900 | ("BitstreamRestriction", m_bitstreamRestrictionFlag, false, "Signals whether bitstream restriction parameters are present") |
---|
901 | ("TilesFixedStructure", m_tilesFixedStructureFlag, false, "Indicates that each active picture parameter set has the same values of the syntax elements related to tiles") |
---|
902 | ("MotionVectorsOverPicBoundaries", m_motionVectorsOverPicBoundariesFlag, false, "Indicates that no samples outside the picture boundaries are used for inter prediction") |
---|
903 | ("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") |
---|
904 | ("MaxBitsPerMinCuDenom", m_maxBitsPerMinCuDenom, 1, "Indicates an upper bound for the number of bits of coding_unit() data") |
---|
905 | ("Log2MaxMvLengthHorizontal", m_log2MaxMvLengthHorizontal, 15, "Indicate the maximum absolute value of a decoded horizontal MV component in quarter-pel luma units") |
---|
906 | ("Log2MaxMvLengthVertical", m_log2MaxMvLengthVertical, 15, "Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units") |
---|
907 | ("SEIRecoveryPoint", m_recoveryPointSEIEnabled, 0, "Control generation of recovery point SEI messages") |
---|
908 | ("SEIBufferingPeriod", m_bufferingPeriodSEIEnabled, 0, "Control generation of buffering period SEI messages") |
---|
909 | ("SEIPictureTiming", m_pictureTimingSEIEnabled, 0, "Control generation of picture timing SEI messages") |
---|
910 | ("SEIToneMappingInfo", m_toneMappingInfoSEIEnabled, false, "Control generation of Tone Mapping SEI messages") |
---|
911 | ("SEIToneMapId", m_toneMapId, 0, "Specifies Id of Tone Mapping SEI message for a given session") |
---|
912 | ("SEIToneMapCancelFlag", m_toneMapCancelFlag, false, "Indicates that Tone Mapping SEI message cancels the persistance or follows") |
---|
913 | ("SEIToneMapPersistenceFlag", m_toneMapPersistenceFlag, true, "Specifies the persistence of the Tone Mapping SEI message") |
---|
914 | ("SEIToneMapCodedDataBitDepth", m_toneMapCodedDataBitDepth, 8, "Specifies Coded Data BitDepth of Tone Mapping SEI messages") |
---|
915 | ("SEIToneMapTargetBitDepth", m_toneMapTargetBitDepth, 8, "Specifies Output BitDepth of Tome mapping function") |
---|
916 | ("SEIToneMapModelId", m_toneMapModelId, 0, "Specifies Model utilized for mapping coded data into target_bit_depth range\n" |
---|
917 | "\t0: linear mapping with clipping\n" |
---|
918 | "\t1: sigmoidal mapping\n" |
---|
919 | "\t2: user-defined table mapping\n" |
---|
920 | "\t3: piece-wise linear mapping\n" |
---|
921 | "\t4: luminance dynamic range information ") |
---|
922 | ("SEIToneMapMinValue", m_toneMapMinValue, 0, "Specifies the minimum value in mode 0") |
---|
923 | ("SEIToneMapMaxValue", m_toneMapMaxValue, 1023, "Specifies the maxmum value in mode 0") |
---|
924 | ("SEIToneMapSigmoidMidpoint", m_sigmoidMidpoint, 512, "Specifies the centre point in mode 1") |
---|
925 | ("SEIToneMapSigmoidWidth", m_sigmoidWidth, 960, "Specifies the distance between 5% and 95% values of the target_bit_depth in mode 1") |
---|
926 | ("SEIToneMapStartOfCodedInterval", cfg_startOfCodedInterval, string(""), "Array of user-defined mapping table") |
---|
927 | ("SEIToneMapNumPivots", m_numPivots, 0, "Specifies the number of pivot points in mode 3") |
---|
928 | ("SEIToneMapCodedPivotValue", cfg_codedPivotValue, string(""), "Array of pivot point") |
---|
929 | ("SEIToneMapTargetPivotValue", cfg_targetPivotValue, string(""), "Array of pivot point") |
---|
930 | ("SEIToneMapCameraIsoSpeedIdc", m_cameraIsoSpeedIdc, 0, "Indicates the camera ISO speed for daylight illumination") |
---|
931 | ("SEIToneMapCameraIsoSpeedValue", m_cameraIsoSpeedValue, 400, "Specifies the camera ISO speed for daylight illumination of Extended_ISO") |
---|
932 | ("SEIToneMapExposureIndexIdc", m_exposureIndexIdc, 0, "Indicates the exposure index setting of the camera") |
---|
933 | ("SEIToneMapExposureIndexValue", m_exposureIndexValue, 400, "Specifies the exposure index setting of the cameran of Extended_ISO") |
---|
934 | ("SEIToneMapExposureCompensationValueSignFlag", m_exposureCompensationValueSignFlag, 0, "Specifies the sign of ExposureCompensationValue") |
---|
935 | ("SEIToneMapExposureCompensationValueNumerator", m_exposureCompensationValueNumerator, 0, "Specifies the numerator of ExposureCompensationValue") |
---|
936 | ("SEIToneMapExposureCompensationValueDenomIdc", m_exposureCompensationValueDenomIdc, 2, "Specifies the denominator of ExposureCompensationValue") |
---|
937 | ("SEIToneMapRefScreenLuminanceWhite", m_refScreenLuminanceWhite, 350, "Specifies reference screen brightness setting in units of candela per square metre") |
---|
938 | ("SEIToneMapExtendedRangeWhiteLevel", m_extendedRangeWhiteLevel, 800, "Indicates the luminance dynamic range") |
---|
939 | ("SEIToneMapNominalBlackLevelLumaCodeValue", m_nominalBlackLevelLumaCodeValue, 16, "Specifies luma sample value of the nominal black level assigned decoded pictures") |
---|
940 | ("SEIToneMapNominalWhiteLevelLumaCodeValue", m_nominalWhiteLevelLumaCodeValue, 235, "Specifies luma sample value of the nominal white level assigned decoded pictures") |
---|
941 | ("SEIToneMapExtendedWhiteLevelLumaCodeValue", m_extendedWhiteLevelLumaCodeValue, 300, "Specifies luma sample value of the extended dynamic range assigned decoded pictures") |
---|
942 | ("SEIFramePacking", m_framePackingSEIEnabled, 0, "Control generation of frame packing SEI messages") |
---|
943 | ("SEIFramePackingType", m_framePackingSEIType, 0, "Define frame packing arrangement\n" |
---|
944 | "\t0: checkerboard - pixels alternatively represent either frames\n" |
---|
945 | "\t1: column alternation - frames are interlaced by column\n" |
---|
946 | "\t2: row alternation - frames are interlaced by row\n" |
---|
947 | "\t3: side by side - frames are displayed horizontally\n" |
---|
948 | "\t4: top bottom - frames are displayed vertically\n" |
---|
949 | "\t5: frame alternation - one frame is alternated with the other") |
---|
950 | ("SEIFramePackingId", m_framePackingSEIId, 0, "Id of frame packing SEI message for a given session") |
---|
951 | ("SEIFramePackingQuincunx", m_framePackingSEIQuincunx, 0, "Indicate the presence of a Quincunx type video frame") |
---|
952 | ("SEIFramePackingInterpretation", m_framePackingSEIInterpretation, 0, "Indicate the interpretation of the frame pair\n" |
---|
953 | "\t0: unspecified\n" |
---|
954 | "\t1: stereo pair, frame0 represents left view\n" |
---|
955 | "\t2: stereo pair, frame0 represents right view") |
---|
956 | ("SEIDisplayOrientation", m_displayOrientationSEIAngle, 0, "Control generation of display orientation SEI messages\n" |
---|
957 | "\tN: 0 < N < (2^16 - 1) enable display orientation SEI message with anticlockwise_rotation = N and display_orientation_repetition_period = 1\n" |
---|
958 | "\t0: disable") |
---|
959 | ("SEITemporalLevel0Index", m_temporalLevel0IndexSEIEnabled, 0, "Control generation of temporal level 0 index SEI messages") |
---|
960 | ("SEIGradualDecodingRefreshInfo", m_gradualDecodingRefreshInfoEnabled, 0, "Control generation of gradual decoding refresh information SEI message") |
---|
961 | ("SEIDecodingUnitInfo", m_decodingUnitInfoSEIEnabled, 0, "Control generation of decoding unit information SEI message.") |
---|
962 | #if LAYERS_NOT_PRESENT_SEI |
---|
963 | ("SEILayersNotPresent", m_layersNotPresentSEIEnabled, 0, "Control generation of layers not present SEI message") |
---|
964 | #endif |
---|
965 | ("SEISOPDescription", m_SOPDescriptionSEIEnabled, 0, "Control generation of SOP description SEI messages") |
---|
966 | ("SEIScalableNesting", m_scalableNestingSEIEnabled, 0, "Control generation of scalable nesting SEI messages") |
---|
967 | #if P0050_KNEE_FUNCTION_SEI |
---|
968 | ("SEIKneeFunctionInfo", m_kneeSEIEnabled, false, "Control generation of Knee function SEI messages") |
---|
969 | ("SEIKneeFunctionId", m_kneeSEIId, 0, "Specifies Id of Knee function SEI message for a given session") |
---|
970 | ("SEIKneeFunctionCancelFlag", m_kneeSEICancelFlag, false, "Indicates that Knee function SEI message cancels the persistance or follows") |
---|
971 | ("SEIKneeFunctionPersistenceFlag", m_kneeSEIPersistenceFlag, true, "Specifies the persistence of the Knee function SEI message") |
---|
972 | ("SEIKneeFunctionMappingFlag", m_kneeSEIMappingFlag, false, "Specifies the mapping mode of the Knee function SEI message") |
---|
973 | ("SEIKneeFunctionInputDrange", m_kneeSEIInputDrange, 1000, "Specifies the peak luminance level for the input picture of Knee function SEI messages") |
---|
974 | ("SEIKneeFunctionInputDispLuminance", m_kneeSEIInputDispLuminance, 100, "Specifies the expected display brightness for the input picture of Knee function SEI messages") |
---|
975 | ("SEIKneeFunctionOutputDrange", m_kneeSEIOutputDrange, 4000, "Specifies the peak luminance level for the output picture of Knee function SEI messages") |
---|
976 | ("SEIKneeFunctionOutputDispLuminance", m_kneeSEIOutputDispLuminance, 800, "Specifies the expected display brightness for the output picture of Knee function SEI messages") |
---|
977 | ("SEIKneeFunctionNumKneePointsMinus1", m_kneeSEINumKneePointsMinus1, 2, "Specifies the number of knee points - 1") |
---|
978 | ("SEIKneeFunctionInputKneePointValue", cfg_kneeSEIInputKneePointValue, string("600 800 900"), "Array of input knee point") |
---|
979 | ("SEIKneeFunctionOutputKneePointValue", cfg_kneeSEIOutputKneePointValue, string("100 250 450"), "Array of output knee point") |
---|
980 | #endif |
---|
981 | #if Q0189_TMVP_CONSTRAINTS |
---|
982 | ("SEITemporalMotionVectorPredictionConstraints", m_TMVPConstraintsSEIEnabled, 0, "Control generation of TMVP constrants SEI message") |
---|
983 | #endif |
---|
984 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
985 | ("AdaptiveResolutionChange", m_adaptiveResolutionChange, 0, "Adaptive resolution change frame number. Should coincide with EL RAP picture. (0: disable)") |
---|
986 | #endif |
---|
987 | #if HIGHER_LAYER_IRAP_SKIP_FLAG |
---|
988 | ("SkipPictureAtArcSwitch", m_skipPictureAtArcSwitch, false, "Code the higher layer picture in ARC up-switching as a skip picture. (0: disable)") |
---|
989 | #endif |
---|
990 | #if N0383_IL_CONSTRAINED_TILE_SETS_SEI |
---|
991 | ("SEIInterLayerConstrainedTileSets", m_interLayerConstrainedTileSetsSEIEnabled, false, "Control generation of inter layer constrained tile sets SEI message") |
---|
992 | ("IlNumSetsInMessage", m_ilNumSetsInMessage, 0u, "Number of inter layer constrained tile sets") |
---|
993 | ("TileSetsArray", cfg_tileSets, string(""), "Array containing tile sets params (TopLeftTileIndex, BottonRightTileIndex and ilcIdc for each set) ") |
---|
994 | #endif |
---|
995 | #if O0153_ALT_OUTPUT_LAYER_FLAG |
---|
996 | ("AltOutputLayerFlag", m_altOutputLayerFlag, false, "Specifies the value of alt_output_layer_flag in VPS extension") |
---|
997 | #endif |
---|
998 | #if O0149_CROSS_LAYER_BLA_FLAG |
---|
999 | ("CrossLayerBLAFlag", m_crossLayerBLAFlag, false, "Specifies the value of cross_layer_bla_flag in VPS") |
---|
1000 | #endif |
---|
1001 | #if Q0048_CGS_3D_ASYMLUT |
---|
1002 | ("CGS", m_nCGSFlag , 0, "whether CGS is enabled") |
---|
1003 | ("CGSMaxOctantDepth", m_nCGSMaxOctantDepth , 1, "max octant depth") |
---|
1004 | ("CGSMaxYPartNumLog", m_nCGSMaxYPartNumLog2 , 2, "max Y part number ") |
---|
1005 | ("CGSLUTBit", m_nCGSLUTBit , 12, "bit depth of CGS LUT") |
---|
1006 | #endif |
---|
1007 | #if Q0108_TSA_STSA |
---|
1008 | ("InheritCodingStruct%d",m_inheritCodingStruct, 0, MAX_LAYERS, "Predicts the GOP structure of one layer for another layer") |
---|
1009 | #endif |
---|
1010 | ; |
---|
1011 | |
---|
1012 | for(Int i=1; i<MAX_GOP+1; i++) { |
---|
1013 | std::ostringstream cOSS; |
---|
1014 | cOSS<<"Frame"<<i; |
---|
1015 | opts.addOptions()(cOSS.str(), m_GOPList[i-1], GOPEntry()); |
---|
1016 | } |
---|
1017 | |
---|
1018 | #if Q0108_TSA_STSA |
---|
1019 | for (Int i=1; i<MAX_LAYERS; i++) |
---|
1020 | { |
---|
1021 | for(Int j=1; j<MAX_GOP+1; j++) |
---|
1022 | { |
---|
1023 | std::ostringstream cOSS; |
---|
1024 | cOSS<<"Layer"<<i<<"Frame"<<j; |
---|
1025 | opts.addOptions()(cOSS.str(), m_EhGOPList[i][j-1], GOPEntry()); |
---|
1026 | } |
---|
1027 | } |
---|
1028 | #endif |
---|
1029 | |
---|
1030 | po::setDefaults(opts); |
---|
1031 | const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv); |
---|
1032 | |
---|
1033 | #if Q0108_TSA_STSA |
---|
1034 | for (Int i=1; i<MAX_LAYERS; i++) |
---|
1035 | { |
---|
1036 | if(m_inheritCodingStruct[i] == 0) |
---|
1037 | { |
---|
1038 | for(Int j=1; j<MAX_GOP+1; j++) |
---|
1039 | { |
---|
1040 | m_EhGOPList[i][j-1] = m_GOPList[j-1]; |
---|
1041 | } |
---|
1042 | } |
---|
1043 | else if( m_inheritCodingStruct[i] > 0) |
---|
1044 | { |
---|
1045 | for(Int j=1; j<MAX_GOP+1; j++) |
---|
1046 | { |
---|
1047 | m_EhGOPList[i][j-1] = m_EhGOPList[m_inheritCodingStruct[i]][j-1]; |
---|
1048 | } |
---|
1049 | } |
---|
1050 | } |
---|
1051 | #endif |
---|
1052 | |
---|
1053 | if(m_isField) |
---|
1054 | { |
---|
1055 | #if SVC_EXTENSION |
---|
1056 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
1057 | { |
---|
1058 | //Frame height |
---|
1059 | m_acLayerCfg[layer].m_iSourceHeightOrg = m_acLayerCfg[layer].m_iSourceHeight; |
---|
1060 | //Field height |
---|
1061 | m_acLayerCfg[layer].m_iSourceHeight = m_acLayerCfg[layer].m_iSourceHeight >> 1; |
---|
1062 | } |
---|
1063 | #else |
---|
1064 | //Frame height |
---|
1065 | m_iSourceHeightOrg = m_iSourceHeight; |
---|
1066 | //Field height |
---|
1067 | m_iSourceHeight = m_iSourceHeight >> 1; |
---|
1068 | #endif |
---|
1069 | //number of fields to encode |
---|
1070 | m_framesToBeEncoded *= 2; |
---|
1071 | } |
---|
1072 | |
---|
1073 | for (list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++) |
---|
1074 | { |
---|
1075 | fprintf(stderr, "Unhandled argument ignored: `%s'\n", *it); |
---|
1076 | } |
---|
1077 | |
---|
1078 | if (argc == 1 || do_help) |
---|
1079 | { |
---|
1080 | /* argc == 1: no options have been specified */ |
---|
1081 | po::doHelp(cout, opts); |
---|
1082 | return false; |
---|
1083 | } |
---|
1084 | |
---|
1085 | /* |
---|
1086 | * Set any derived parameters |
---|
1087 | */ |
---|
1088 | /* convert std::string to c string for compatability */ |
---|
1089 | #if SVC_EXTENSION |
---|
1090 | #if AVC_BASE |
---|
1091 | if( m_avcBaseLayerFlag ) |
---|
1092 | { |
---|
1093 | *cfg_InputFile[0] = cfg_BLInputFile; |
---|
1094 | } |
---|
1095 | #endif |
---|
1096 | m_pBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str()); |
---|
1097 | #if AVC_SYNTAX |
---|
1098 | m_BLSyntaxFile = cfg_BLSyntaxFile.empty() ? NULL : strdup(cfg_BLSyntaxFile.c_str()); |
---|
1099 | #endif |
---|
1100 | #else //SVC_EXTENSION |
---|
1101 | m_pchInputFile = cfg_InputFile.empty() ? NULL : strdup(cfg_InputFile.c_str()); |
---|
1102 | m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str()); |
---|
1103 | m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str()); |
---|
1104 | m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str()); |
---|
1105 | #endif //SVC_EXTENSION |
---|
1106 | |
---|
1107 | Char* pColumnWidth = cfg_ColumnWidth.empty() ? NULL: strdup(cfg_ColumnWidth.c_str()); |
---|
1108 | Char* pRowHeight = cfg_RowHeight.empty() ? NULL : strdup(cfg_RowHeight.c_str()); |
---|
1109 | if( m_iUniformSpacingIdr == 0 && m_iNumColumnsMinus1 > 0 ) |
---|
1110 | { |
---|
1111 | char *columnWidth; |
---|
1112 | int i=0; |
---|
1113 | m_pColumnWidth = new UInt[m_iNumColumnsMinus1]; |
---|
1114 | columnWidth = strtok(pColumnWidth, " ,-"); |
---|
1115 | while(columnWidth!=NULL) |
---|
1116 | { |
---|
1117 | if( i>=m_iNumColumnsMinus1 ) |
---|
1118 | { |
---|
1119 | printf( "The number of columns whose width are defined is larger than the allowed number of columns.\n" ); |
---|
1120 | exit( EXIT_FAILURE ); |
---|
1121 | } |
---|
1122 | *( m_pColumnWidth + i ) = atoi( columnWidth ); |
---|
1123 | columnWidth = strtok(NULL, " ,-"); |
---|
1124 | i++; |
---|
1125 | } |
---|
1126 | if( i<m_iNumColumnsMinus1 ) |
---|
1127 | { |
---|
1128 | printf( "The width of some columns is not defined.\n" ); |
---|
1129 | exit( EXIT_FAILURE ); |
---|
1130 | } |
---|
1131 | } |
---|
1132 | else |
---|
1133 | { |
---|
1134 | m_pColumnWidth = NULL; |
---|
1135 | } |
---|
1136 | |
---|
1137 | if( m_iUniformSpacingIdr == 0 && m_iNumRowsMinus1 > 0 ) |
---|
1138 | { |
---|
1139 | char *rowHeight; |
---|
1140 | int i=0; |
---|
1141 | m_pRowHeight = new UInt[m_iNumRowsMinus1]; |
---|
1142 | rowHeight = strtok(pRowHeight, " ,-"); |
---|
1143 | while(rowHeight!=NULL) |
---|
1144 | { |
---|
1145 | if( i>=m_iNumRowsMinus1 ) |
---|
1146 | { |
---|
1147 | printf( "The number of rows whose height are defined is larger than the allowed number of rows.\n" ); |
---|
1148 | exit( EXIT_FAILURE ); |
---|
1149 | } |
---|
1150 | *( m_pRowHeight + i ) = atoi( rowHeight ); |
---|
1151 | rowHeight = strtok(NULL, " ,-"); |
---|
1152 | i++; |
---|
1153 | } |
---|
1154 | if( i<m_iNumRowsMinus1 ) |
---|
1155 | { |
---|
1156 | printf( "The height of some rows is not defined.\n" ); |
---|
1157 | exit( EXIT_FAILURE ); |
---|
1158 | } |
---|
1159 | } |
---|
1160 | else |
---|
1161 | { |
---|
1162 | m_pRowHeight = NULL; |
---|
1163 | } |
---|
1164 | #if SVC_EXTENSION |
---|
1165 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
1166 | { |
---|
1167 | // If number of scaled ref. layer offsets is non-zero, at least one of the offsets should be specified |
---|
1168 | if(m_acLayerCfg[layer].m_numScaledRefLayerOffsets) |
---|
1169 | { |
---|
1170 | #if O0098_SCALED_REF_LAYER_ID |
---|
1171 | assert( strcmp(cfg_scaledRefLayerId[layer].c_str(), "")); |
---|
1172 | #endif |
---|
1173 | #if P0312_VERT_PHASE_ADJ |
---|
1174 | assert( strcmp(cfg_scaledRefLayerLeftOffset[layer].c_str(), "") || |
---|
1175 | strcmp(cfg_scaledRefLayerRightOffset[layer].c_str(), "") || |
---|
1176 | strcmp(cfg_scaledRefLayerTopOffset[layer].c_str(), "") || |
---|
1177 | strcmp(cfg_scaledRefLayerBottomOffset[layer].c_str(),"") || |
---|
1178 | strcmp(cfg_vertPhasePositionEnableFlag[layer].c_str(),"") ); |
---|
1179 | #else |
---|
1180 | assert( strcmp(cfg_scaledRefLayerLeftOffset[layer].c_str(), "") || |
---|
1181 | strcmp(cfg_scaledRefLayerRightOffset[layer].c_str(), "") || |
---|
1182 | strcmp(cfg_scaledRefLayerTopOffset[layer].c_str(), "") || |
---|
1183 | strcmp(cfg_scaledRefLayerBottomOffset[layer].c_str(),"") ); |
---|
1184 | #endif |
---|
1185 | } |
---|
1186 | |
---|
1187 | Int *tempArray = NULL; // Contain the value |
---|
1188 | |
---|
1189 | #if O0098_SCALED_REF_LAYER_ID |
---|
1190 | // ID // |
---|
1191 | if(strcmp(cfg_scaledRefLayerId[layer].c_str(), "")) |
---|
1192 | { |
---|
1193 | cfgStringToArray( &tempArray, cfg_scaledRefLayerId[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "ScaledRefLayerId"); |
---|
1194 | if(tempArray) |
---|
1195 | { |
---|
1196 | for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) |
---|
1197 | { |
---|
1198 | m_acLayerCfg[layer].m_scaledRefLayerId[i] = tempArray[i]; |
---|
1199 | } |
---|
1200 | delete [] tempArray; tempArray = NULL; |
---|
1201 | } |
---|
1202 | } |
---|
1203 | #endif |
---|
1204 | |
---|
1205 | // Left offset // |
---|
1206 | if(strcmp(cfg_scaledRefLayerLeftOffset[layer].c_str(), "")) |
---|
1207 | { |
---|
1208 | cfgStringToArray( &tempArray, cfg_scaledRefLayerLeftOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "LeftOffset"); |
---|
1209 | if(tempArray) |
---|
1210 | { |
---|
1211 | for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) |
---|
1212 | { |
---|
1213 | m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i] = tempArray[i]; |
---|
1214 | } |
---|
1215 | delete [] tempArray; tempArray = NULL; |
---|
1216 | } |
---|
1217 | } |
---|
1218 | |
---|
1219 | // Top offset // |
---|
1220 | if(strcmp(cfg_scaledRefLayerTopOffset[layer].c_str(), "")) |
---|
1221 | { |
---|
1222 | cfgStringToArray( &tempArray, cfg_scaledRefLayerTopOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "TopOffset"); |
---|
1223 | if(tempArray) |
---|
1224 | { |
---|
1225 | for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) |
---|
1226 | { |
---|
1227 | m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i] = tempArray[i]; |
---|
1228 | } |
---|
1229 | delete [] tempArray; tempArray = NULL; |
---|
1230 | } |
---|
1231 | } |
---|
1232 | |
---|
1233 | // Right offset // |
---|
1234 | if(strcmp(cfg_scaledRefLayerRightOffset[layer].c_str(), "")) |
---|
1235 | { |
---|
1236 | cfgStringToArray( &tempArray, cfg_scaledRefLayerRightOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "RightOffset"); |
---|
1237 | if(tempArray) |
---|
1238 | { |
---|
1239 | for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) |
---|
1240 | { |
---|
1241 | m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i] = tempArray[i]; |
---|
1242 | } |
---|
1243 | delete [] tempArray; tempArray = NULL; |
---|
1244 | } |
---|
1245 | } |
---|
1246 | |
---|
1247 | // Bottom offset // |
---|
1248 | if(strcmp(cfg_scaledRefLayerBottomOffset[layer].c_str(), "")) |
---|
1249 | { |
---|
1250 | cfgStringToArray( &tempArray, cfg_scaledRefLayerBottomOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "BottomOffset"); |
---|
1251 | if(tempArray) |
---|
1252 | { |
---|
1253 | for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) |
---|
1254 | { |
---|
1255 | m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i] = tempArray[i]; |
---|
1256 | } |
---|
1257 | delete [] tempArray; tempArray = NULL; |
---|
1258 | } |
---|
1259 | } |
---|
1260 | #if P0312_VERT_PHASE_ADJ |
---|
1261 | // VertPhasePositionEnableFlag // |
---|
1262 | if(strcmp(cfg_vertPhasePositionEnableFlag[layer].c_str(), "")) |
---|
1263 | { |
---|
1264 | cfgStringToArray( &tempArray, cfg_vertPhasePositionEnableFlag[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "VertPhasePositionEnableFlag"); |
---|
1265 | if(tempArray) |
---|
1266 | { |
---|
1267 | for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) |
---|
1268 | { |
---|
1269 | m_acLayerCfg[layer].m_vertPhasePositionEnableFlag[i] = tempArray[i]; |
---|
1270 | } |
---|
1271 | delete [] tempArray; tempArray = NULL; |
---|
1272 | } |
---|
1273 | } |
---|
1274 | #endif |
---|
1275 | } |
---|
1276 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
1277 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
1278 | { |
---|
1279 | Char* pSamplePredRefLayerIds = cfg_samplePredRefLayerIds[layer].empty() ? NULL: strdup(cfg_samplePredRefLayerIds[layer].c_str()); |
---|
1280 | if( m_acLayerCfg[layer].m_numSamplePredRefLayers > 0 ) |
---|
1281 | { |
---|
1282 | char *samplePredRefLayerId; |
---|
1283 | int i=0; |
---|
1284 | m_acLayerCfg[layer].m_samplePredRefLayerIds = new Int[m_acLayerCfg[layer].m_numSamplePredRefLayers]; |
---|
1285 | samplePredRefLayerId = strtok(pSamplePredRefLayerIds, " ,-"); |
---|
1286 | while(samplePredRefLayerId != NULL) |
---|
1287 | { |
---|
1288 | if( i >= m_acLayerCfg[layer].m_numSamplePredRefLayers ) |
---|
1289 | { |
---|
1290 | printf( "NumSamplePredRefLayers%d: The number of columns whose width are defined is larger than the allowed number of columns.\n", layer ); |
---|
1291 | exit( EXIT_FAILURE ); |
---|
1292 | } |
---|
1293 | *( m_acLayerCfg[layer].m_samplePredRefLayerIds + i ) = atoi( samplePredRefLayerId ); |
---|
1294 | samplePredRefLayerId = strtok(NULL, " ,-"); |
---|
1295 | i++; |
---|
1296 | } |
---|
1297 | if( i < m_acLayerCfg[layer].m_numSamplePredRefLayers ) |
---|
1298 | { |
---|
1299 | printf( "NumSamplePredRefLayers%d: The width of some columns is not defined.\n", layer ); |
---|
1300 | exit( EXIT_FAILURE ); |
---|
1301 | } |
---|
1302 | } |
---|
1303 | else |
---|
1304 | { |
---|
1305 | m_acLayerCfg[layer].m_samplePredRefLayerIds = NULL; |
---|
1306 | } |
---|
1307 | } |
---|
1308 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
1309 | { |
---|
1310 | Char* pMotionPredRefLayerIds = cfg_motionPredRefLayerIds[layer].empty() ? NULL: strdup(cfg_motionPredRefLayerIds[layer].c_str()); |
---|
1311 | if( m_acLayerCfg[layer].m_numMotionPredRefLayers > 0 ) |
---|
1312 | { |
---|
1313 | char *motionPredRefLayerId; |
---|
1314 | int i=0; |
---|
1315 | m_acLayerCfg[layer].m_motionPredRefLayerIds = new Int[m_acLayerCfg[layer].m_numMotionPredRefLayers]; |
---|
1316 | motionPredRefLayerId = strtok(pMotionPredRefLayerIds, " ,-"); |
---|
1317 | while(motionPredRefLayerId != NULL) |
---|
1318 | { |
---|
1319 | if( i >= m_acLayerCfg[layer].m_numMotionPredRefLayers ) |
---|
1320 | { |
---|
1321 | printf( "NumMotionPredRefLayers%d: The number of columns whose width are defined is larger than the allowed number of columns.\n", layer ); |
---|
1322 | exit( EXIT_FAILURE ); |
---|
1323 | } |
---|
1324 | *( m_acLayerCfg[layer].m_motionPredRefLayerIds + i ) = atoi( motionPredRefLayerId ); |
---|
1325 | motionPredRefLayerId = strtok(NULL, " ,-"); |
---|
1326 | i++; |
---|
1327 | } |
---|
1328 | if( i < m_acLayerCfg[layer].m_numMotionPredRefLayers ) |
---|
1329 | { |
---|
1330 | printf( "NumMotionPredRefLayers%d: The width of some columns is not defined.\n", layer ); |
---|
1331 | exit( EXIT_FAILURE ); |
---|
1332 | } |
---|
1333 | } |
---|
1334 | else |
---|
1335 | { |
---|
1336 | m_acLayerCfg[layer].m_motionPredRefLayerIds = NULL; |
---|
1337 | } |
---|
1338 | } |
---|
1339 | |
---|
1340 | #if AUXILIARY_PICTURES |
---|
1341 | for(UInt layer = 0; layer < MAX_LAYERS; layer++) |
---|
1342 | { |
---|
1343 | m_acLayerCfg[layer].m_InputChromaFormat = numberToChromaFormat(cfg_tmpChromaFormatIDC[layer]); |
---|
1344 | m_acLayerCfg[layer].m_chromaFormatIDC = ((cfg_tmpChromaFormatIDC[layer] == 0) ? (m_acLayerCfg[layer].m_InputChromaFormat ) : (numberToChromaFormat(cfg_tmpChromaFormatIDC[layer]))); |
---|
1345 | } |
---|
1346 | #endif |
---|
1347 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
1348 | { |
---|
1349 | Char* pPredLayerIds = cfg_predLayerIds[layer].empty() ? NULL: strdup(cfg_predLayerIds[layer].c_str()); |
---|
1350 | if( m_acLayerCfg[layer].m_numActiveRefLayers > 0 ) |
---|
1351 | { |
---|
1352 | char *refLayerId; |
---|
1353 | int i=0; |
---|
1354 | m_acLayerCfg[layer].m_predLayerIds = new Int[m_acLayerCfg[layer].m_numActiveRefLayers]; |
---|
1355 | refLayerId = strtok(pPredLayerIds, " ,-"); |
---|
1356 | while(refLayerId != NULL) |
---|
1357 | { |
---|
1358 | if( i >= m_acLayerCfg[layer].m_numActiveRefLayers ) |
---|
1359 | { |
---|
1360 | printf( "NumActiveRefLayers%d: The number of columns whose width are defined is larger than the allowed number of columns.\n", layer ); |
---|
1361 | exit( EXIT_FAILURE ); |
---|
1362 | } |
---|
1363 | *( m_acLayerCfg[layer].m_predLayerIds + i ) = atoi( refLayerId ); |
---|
1364 | refLayerId = strtok(NULL, " ,-"); |
---|
1365 | i++; |
---|
1366 | } |
---|
1367 | if( i < m_acLayerCfg[layer].m_numActiveRefLayers ) |
---|
1368 | { |
---|
1369 | printf( "NumActiveRefLayers%d: The width of some columns is not defined.\n", layer ); |
---|
1370 | exit( EXIT_FAILURE ); |
---|
1371 | } |
---|
1372 | } |
---|
1373 | else |
---|
1374 | { |
---|
1375 | m_acLayerCfg[layer].m_predLayerIds = NULL; |
---|
1376 | } |
---|
1377 | } |
---|
1378 | #endif |
---|
1379 | #if Q0078_ADD_LAYER_SETS |
---|
1380 | for (Int layerSet = 0; layerSet < m_numLayerSets; layerSet++) |
---|
1381 | { |
---|
1382 | if (m_numLayerInIdList[layerSet] > 0) |
---|
1383 | { |
---|
1384 | Char* layerSetLayerIdListDup = cfg_layerSetLayerIdList[layerSet].empty() ? NULL : strdup(cfg_layerSetLayerIdList[layerSet].c_str()); |
---|
1385 | Int i = 0; |
---|
1386 | char *layerId = strtok(layerSetLayerIdListDup, " ,-"); |
---|
1387 | while (layerId != NULL) |
---|
1388 | { |
---|
1389 | if (i >= m_numLayerInIdList[layerSet]) |
---|
1390 | { |
---|
1391 | printf("NumLayerInIdList%d: The number of layers in the set is larger than the allowed number of layers.\n", layerSet); |
---|
1392 | exit(EXIT_FAILURE); |
---|
1393 | } |
---|
1394 | m_layerSetLayerIdList[layerSet][i] = atoi(layerId); |
---|
1395 | layerId = strtok(NULL, " ,-"); |
---|
1396 | i++; |
---|
1397 | } |
---|
1398 | } |
---|
1399 | } |
---|
1400 | for (Int addLayerSet = 0; addLayerSet < m_numAddLayerSets; addLayerSet++) |
---|
1401 | { |
---|
1402 | if (m_numHighestLayerIdx[addLayerSet] > 0) |
---|
1403 | { |
---|
1404 | Char* highestLayrIdxListDup = cfg_highestLayerIdx[addLayerSet].empty() ? NULL : strdup(cfg_highestLayerIdx[addLayerSet].c_str()); |
---|
1405 | Int i = 0; |
---|
1406 | char *layerIdx = strtok(highestLayrIdxListDup, " ,-"); |
---|
1407 | while (layerIdx != NULL) |
---|
1408 | { |
---|
1409 | if (i >= m_numLayerInIdList[addLayerSet]) |
---|
1410 | { |
---|
1411 | printf("NumLayerInIdList%d: The number of layer idx's in the highest layer idx list is larger than the allowed number of idx's.\n", addLayerSet); |
---|
1412 | exit(EXIT_FAILURE); |
---|
1413 | } |
---|
1414 | m_highestLayerIdx[addLayerSet][i] = atoi(layerIdx); |
---|
1415 | layerIdx = strtok(NULL, " ,-"); |
---|
1416 | i++; |
---|
1417 | } |
---|
1418 | } |
---|
1419 | } |
---|
1420 | #endif |
---|
1421 | #endif //SVC_EXTENSION |
---|
1422 | m_scalingListFile = cfg_ScalingListFile.empty() ? NULL : strdup(cfg_ScalingListFile.c_str()); |
---|
1423 | |
---|
1424 | /* rules for input, output and internal bitdepths as per help text */ |
---|
1425 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
1426 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
1427 | { |
---|
1428 | if (!m_acLayerCfg[layer].m_internalBitDepthY) { m_acLayerCfg[layer].m_internalBitDepthY = m_acLayerCfg[layer].m_inputBitDepthY; } |
---|
1429 | if (!m_acLayerCfg[layer].m_internalBitDepthC) { m_acLayerCfg[layer].m_internalBitDepthC = m_acLayerCfg[layer].m_internalBitDepthY; } |
---|
1430 | if (!m_acLayerCfg[layer].m_inputBitDepthC) { m_acLayerCfg[layer].m_inputBitDepthC = m_acLayerCfg[layer].m_inputBitDepthY; } |
---|
1431 | if (!m_acLayerCfg[layer].m_outputBitDepthY) { m_acLayerCfg[layer].m_outputBitDepthY = m_acLayerCfg[layer].m_internalBitDepthY; } |
---|
1432 | if (!m_acLayerCfg[layer].m_outputBitDepthC) { m_acLayerCfg[layer].m_outputBitDepthC = m_acLayerCfg[layer].m_internalBitDepthC; } |
---|
1433 | } |
---|
1434 | #else |
---|
1435 | if (!m_internalBitDepthY) { m_internalBitDepthY = m_inputBitDepthY; } |
---|
1436 | if (!m_internalBitDepthC) { m_internalBitDepthC = m_internalBitDepthY; } |
---|
1437 | if (!m_inputBitDepthC) { m_inputBitDepthC = m_inputBitDepthY; } |
---|
1438 | if (!m_outputBitDepthY) { m_outputBitDepthY = m_internalBitDepthY; } |
---|
1439 | if (!m_outputBitDepthC) { m_outputBitDepthC = m_internalBitDepthC; } |
---|
1440 | #endif |
---|
1441 | |
---|
1442 | #if !SVC_EXTENSION |
---|
1443 | // TODO:ChromaFmt assumes 4:2:0 below |
---|
1444 | switch (m_conformanceMode) |
---|
1445 | { |
---|
1446 | case 0: |
---|
1447 | { |
---|
1448 | // no conformance or padding |
---|
1449 | m_confLeft = m_confRight = m_confTop = m_confBottom = 0; |
---|
1450 | m_aiPad[1] = m_aiPad[0] = 0; |
---|
1451 | break; |
---|
1452 | } |
---|
1453 | case 1: |
---|
1454 | { |
---|
1455 | // automatic padding to minimum CU size |
---|
1456 | Int minCuSize = m_uiMaxCUHeight >> (m_uiMaxCUDepth - 1); |
---|
1457 | if (m_iSourceWidth % minCuSize) |
---|
1458 | { |
---|
1459 | m_aiPad[0] = m_confRight = ((m_iSourceWidth / minCuSize) + 1) * minCuSize - m_iSourceWidth; |
---|
1460 | m_iSourceWidth += m_confRight; |
---|
1461 | } |
---|
1462 | if (m_iSourceHeight % minCuSize) |
---|
1463 | { |
---|
1464 | m_aiPad[1] = m_confBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight; |
---|
1465 | m_iSourceHeight += m_confBottom; |
---|
1466 | if ( m_isField ) |
---|
1467 | { |
---|
1468 | m_iSourceHeightOrg += m_confBottom << 1; |
---|
1469 | m_aiPad[1] = m_confBottom << 1; |
---|
1470 | } |
---|
1471 | } |
---|
1472 | if (m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0) |
---|
1473 | { |
---|
1474 | fprintf(stderr, "Error: picture width is not an integer multiple of the specified chroma subsampling\n"); |
---|
1475 | exit(EXIT_FAILURE); |
---|
1476 | } |
---|
1477 | if (m_aiPad[1] % TComSPS::getWinUnitY(CHROMA_420) != 0) |
---|
1478 | { |
---|
1479 | fprintf(stderr, "Error: picture height is not an integer multiple of the specified chroma subsampling\n"); |
---|
1480 | exit(EXIT_FAILURE); |
---|
1481 | } |
---|
1482 | break; |
---|
1483 | } |
---|
1484 | case 2: |
---|
1485 | { |
---|
1486 | //padding |
---|
1487 | m_iSourceWidth += m_aiPad[0]; |
---|
1488 | m_iSourceHeight += m_aiPad[1]; |
---|
1489 | m_confRight = m_aiPad[0]; |
---|
1490 | m_confBottom = m_aiPad[1]; |
---|
1491 | break; |
---|
1492 | } |
---|
1493 | case 3: |
---|
1494 | { |
---|
1495 | // conformance |
---|
1496 | if ((m_confLeft == 0) && (m_confRight == 0) && (m_confTop == 0) && (m_confBottom == 0)) |
---|
1497 | { |
---|
1498 | fprintf(stderr, "Warning: Conformance window enabled, but all conformance window parameters set to zero\n"); |
---|
1499 | } |
---|
1500 | if ((m_aiPad[1] != 0) || (m_aiPad[0]!=0)) |
---|
1501 | { |
---|
1502 | fprintf(stderr, "Warning: Conformance window enabled, padding parameters will be ignored\n"); |
---|
1503 | } |
---|
1504 | m_aiPad[1] = m_aiPad[0] = 0; |
---|
1505 | break; |
---|
1506 | } |
---|
1507 | } |
---|
1508 | |
---|
1509 | // allocate slice-based dQP values |
---|
1510 | m_aidQP = new Int[ m_framesToBeEncoded + m_iGOPSize + 1 ]; |
---|
1511 | ::memset( m_aidQP, 0, sizeof(Int)*( m_framesToBeEncoded + m_iGOPSize + 1 ) ); |
---|
1512 | |
---|
1513 | // handling of floating-point QP values |
---|
1514 | // if QP is not integer, sequence is split into two sections having QP and QP+1 |
---|
1515 | m_iQP = (Int)( m_fQP ); |
---|
1516 | if ( m_iQP < m_fQP ) |
---|
1517 | { |
---|
1518 | Int iSwitchPOC = (Int)( m_framesToBeEncoded - (m_fQP - m_iQP)*m_framesToBeEncoded + 0.5 ); |
---|
1519 | |
---|
1520 | iSwitchPOC = (Int)( (Double)iSwitchPOC / m_iGOPSize + 0.5 )*m_iGOPSize; |
---|
1521 | for ( Int i=iSwitchPOC; i<m_framesToBeEncoded + m_iGOPSize + 1; i++ ) |
---|
1522 | { |
---|
1523 | m_aidQP[i] = 1; |
---|
1524 | } |
---|
1525 | } |
---|
1526 | |
---|
1527 | // reading external dQP description from file |
---|
1528 | if ( m_pchdQPFile ) |
---|
1529 | { |
---|
1530 | FILE* fpt=fopen( m_pchdQPFile, "r" ); |
---|
1531 | if ( fpt ) |
---|
1532 | { |
---|
1533 | Int iValue; |
---|
1534 | Int iPOC = 0; |
---|
1535 | while ( iPOC < m_framesToBeEncoded ) |
---|
1536 | { |
---|
1537 | if ( fscanf(fpt, "%d", &iValue ) == EOF ) break; |
---|
1538 | m_aidQP[ iPOC ] = iValue; |
---|
1539 | iPOC++; |
---|
1540 | } |
---|
1541 | fclose(fpt); |
---|
1542 | } |
---|
1543 | } |
---|
1544 | m_iWaveFrontSubstreams = m_iWaveFrontSynchro ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1; |
---|
1545 | #endif |
---|
1546 | if( m_toneMappingInfoSEIEnabled && !m_toneMapCancelFlag ) |
---|
1547 | { |
---|
1548 | Char* pcStartOfCodedInterval = cfg_startOfCodedInterval.empty() ? NULL: strdup(cfg_startOfCodedInterval.c_str()); |
---|
1549 | Char* pcCodedPivotValue = cfg_codedPivotValue.empty() ? NULL: strdup(cfg_codedPivotValue.c_str()); |
---|
1550 | Char* pcTargetPivotValue = cfg_targetPivotValue.empty() ? NULL: strdup(cfg_targetPivotValue.c_str()); |
---|
1551 | if( m_toneMapModelId == 2 && pcStartOfCodedInterval ) |
---|
1552 | { |
---|
1553 | char *startOfCodedInterval; |
---|
1554 | UInt num = 1u<< m_toneMapTargetBitDepth; |
---|
1555 | m_startOfCodedInterval = new Int[num]; |
---|
1556 | ::memset( m_startOfCodedInterval, 0, sizeof(Int)*num ); |
---|
1557 | startOfCodedInterval = strtok(pcStartOfCodedInterval, " ."); |
---|
1558 | int i = 0; |
---|
1559 | while( startOfCodedInterval && ( i < num ) ) |
---|
1560 | { |
---|
1561 | m_startOfCodedInterval[i] = atoi( startOfCodedInterval ); |
---|
1562 | startOfCodedInterval = strtok(NULL, " ."); |
---|
1563 | i++; |
---|
1564 | } |
---|
1565 | } |
---|
1566 | else |
---|
1567 | { |
---|
1568 | m_startOfCodedInterval = NULL; |
---|
1569 | } |
---|
1570 | if( ( m_toneMapModelId == 3 ) && ( m_numPivots > 0 ) ) |
---|
1571 | { |
---|
1572 | if( pcCodedPivotValue && pcTargetPivotValue ) |
---|
1573 | { |
---|
1574 | char *codedPivotValue; |
---|
1575 | char *targetPivotValue; |
---|
1576 | m_codedPivotValue = new Int[m_numPivots]; |
---|
1577 | m_targetPivotValue = new Int[m_numPivots]; |
---|
1578 | ::memset( m_codedPivotValue, 0, sizeof(Int)*( m_numPivots ) ); |
---|
1579 | ::memset( m_targetPivotValue, 0, sizeof(Int)*( m_numPivots ) ); |
---|
1580 | codedPivotValue = strtok(pcCodedPivotValue, " ."); |
---|
1581 | int i=0; |
---|
1582 | while(codedPivotValue&&i<m_numPivots) |
---|
1583 | { |
---|
1584 | m_codedPivotValue[i] = atoi( codedPivotValue ); |
---|
1585 | codedPivotValue = strtok(NULL, " ."); |
---|
1586 | i++; |
---|
1587 | } |
---|
1588 | i=0; |
---|
1589 | targetPivotValue = strtok(pcTargetPivotValue, " ."); |
---|
1590 | while(targetPivotValue&&i<m_numPivots) |
---|
1591 | { |
---|
1592 | m_targetPivotValue[i]= atoi( targetPivotValue ); |
---|
1593 | targetPivotValue = strtok(NULL, " ."); |
---|
1594 | i++; |
---|
1595 | } |
---|
1596 | } |
---|
1597 | } |
---|
1598 | else |
---|
1599 | { |
---|
1600 | m_codedPivotValue = NULL; |
---|
1601 | m_targetPivotValue = NULL; |
---|
1602 | } |
---|
1603 | } |
---|
1604 | #if P0050_KNEE_FUNCTION_SEI |
---|
1605 | if( m_kneeSEIEnabled && !m_kneeSEICancelFlag ) |
---|
1606 | { |
---|
1607 | Char* pcInputKneePointValue = cfg_kneeSEIInputKneePointValue.empty() ? NULL : strdup(cfg_kneeSEIInputKneePointValue.c_str()); |
---|
1608 | Char* pcOutputKneePointValue = cfg_kneeSEIOutputKneePointValue.empty() ? NULL : strdup(cfg_kneeSEIOutputKneePointValue.c_str()); |
---|
1609 | assert ( m_kneeSEINumKneePointsMinus1 >= 0 && m_kneeSEINumKneePointsMinus1 < 999 ); |
---|
1610 | m_kneeSEIInputKneePoint = new Int[m_kneeSEINumKneePointsMinus1+1]; |
---|
1611 | m_kneeSEIOutputKneePoint = new Int[m_kneeSEINumKneePointsMinus1+1]; |
---|
1612 | char *InputVal = strtok(pcInputKneePointValue, " .,"); |
---|
1613 | Int i=0; |
---|
1614 | while( InputVal && i<(m_kneeSEINumKneePointsMinus1+1) ) |
---|
1615 | { |
---|
1616 | m_kneeSEIInputKneePoint[i] = (UInt) atoi( InputVal ); |
---|
1617 | InputVal = strtok(NULL, " .,"); |
---|
1618 | i++; |
---|
1619 | } |
---|
1620 | char *OutputVal = strtok(pcOutputKneePointValue, " .,"); |
---|
1621 | i=0; |
---|
1622 | while( OutputVal && i<(m_kneeSEINumKneePointsMinus1+1) ) |
---|
1623 | { |
---|
1624 | m_kneeSEIOutputKneePoint[i] = (UInt) atoi( OutputVal ); |
---|
1625 | OutputVal = strtok(NULL, " .,"); |
---|
1626 | i++; |
---|
1627 | } |
---|
1628 | } |
---|
1629 | #endif |
---|
1630 | |
---|
1631 | #if N0383_IL_CONSTRAINED_TILE_SETS_SEI |
---|
1632 | if (m_interLayerConstrainedTileSetsSEIEnabled) |
---|
1633 | { |
---|
1634 | if (m_iNumColumnsMinus1 == 0 && m_iNumRowsMinus1 == 0) |
---|
1635 | { |
---|
1636 | printf( "Tiles are not defined (needed for inter-layer comnstrained tile sets SEI).\n" ); |
---|
1637 | exit( EXIT_FAILURE ); |
---|
1638 | } |
---|
1639 | Char* pTileSets = cfg_tileSets.empty() ? NULL : strdup(cfg_tileSets.c_str()); |
---|
1640 | int i = 0; |
---|
1641 | char *topLeftTileIndex = strtok(pTileSets, " ,"); |
---|
1642 | while(topLeftTileIndex != NULL) |
---|
1643 | { |
---|
1644 | if( i >= m_ilNumSetsInMessage ) |
---|
1645 | { |
---|
1646 | printf( "The number of tile sets is larger than defined by IlNumSetsInMessage.\n" ); |
---|
1647 | exit( EXIT_FAILURE ); |
---|
1648 | } |
---|
1649 | *( m_topLeftTileIndex + i ) = atoi( topLeftTileIndex ); |
---|
1650 | char *bottonRightTileIndex = strtok(NULL, " ,"); |
---|
1651 | if( bottonRightTileIndex == NULL ) |
---|
1652 | { |
---|
1653 | printf( "BottonRightTileIndex is missing in the tile sets.\n" ); |
---|
1654 | exit( EXIT_FAILURE ); |
---|
1655 | } |
---|
1656 | *( m_bottomRightTileIndex + i ) = atoi( bottonRightTileIndex ); |
---|
1657 | char *ilcIdc = strtok(NULL, " ,"); |
---|
1658 | if( ilcIdc == NULL ) |
---|
1659 | { |
---|
1660 | printf( "IlcIdc is missing in the tile sets.\n" ); |
---|
1661 | exit( EXIT_FAILURE ); |
---|
1662 | } |
---|
1663 | *( m_ilcIdc + i ) = atoi( ilcIdc ); |
---|
1664 | topLeftTileIndex = strtok(NULL, " ,"); |
---|
1665 | i++; |
---|
1666 | } |
---|
1667 | if( i < m_ilNumSetsInMessage ) |
---|
1668 | { |
---|
1669 | printf( "The number of tile sets is smaller than defined by IlNumSetsInMessage.\n" ); |
---|
1670 | exit( EXIT_FAILURE ); |
---|
1671 | } |
---|
1672 | m_skippedTileSetPresentFlag = false; |
---|
1673 | } |
---|
1674 | #endif |
---|
1675 | // check validity of input parameters |
---|
1676 | xCheckParameter(); |
---|
1677 | |
---|
1678 | // set global varibles |
---|
1679 | #if LAYER_CTB |
---|
1680 | for(Int layer = 0; layer < MAX_LAYERS; layer++) |
---|
1681 | { |
---|
1682 | xSetGlobal(layer); |
---|
1683 | } |
---|
1684 | #else |
---|
1685 | xSetGlobal(); |
---|
1686 | #endif |
---|
1687 | |
---|
1688 | // print-out parameters |
---|
1689 | xPrintParameter(); |
---|
1690 | |
---|
1691 | return true; |
---|
1692 | } |
---|
1693 | // ==================================================================================================================== |
---|
1694 | // Private member functions |
---|
1695 | // ==================================================================================================================== |
---|
1696 | |
---|
1697 | Bool confirmPara(Bool bflag, const Char* message); |
---|
1698 | |
---|
1699 | Void TAppEncCfg::xCheckParameter() |
---|
1700 | { |
---|
1701 | if (!m_decodedPictureHashSEIEnabled) |
---|
1702 | { |
---|
1703 | fprintf(stderr, "******************************************************************\n"); |
---|
1704 | fprintf(stderr, "** WARNING: --SEIDecodedPictureHash is now disabled by default. **\n"); |
---|
1705 | fprintf(stderr, "** Automatic verification of decoded pictures by a **\n"); |
---|
1706 | fprintf(stderr, "** decoder requires this option to be enabled. **\n"); |
---|
1707 | fprintf(stderr, "******************************************************************\n"); |
---|
1708 | } |
---|
1709 | if( m_profile==Profile::NONE ) |
---|
1710 | { |
---|
1711 | fprintf(stderr, "***************************************************************************\n"); |
---|
1712 | fprintf(stderr, "** WARNING: For conforming bitstreams a valid Profile value must be set! **\n"); |
---|
1713 | fprintf(stderr, "***************************************************************************\n"); |
---|
1714 | } |
---|
1715 | if( m_level==Level::NONE ) |
---|
1716 | { |
---|
1717 | fprintf(stderr, "***************************************************************************\n"); |
---|
1718 | fprintf(stderr, "** WARNING: For conforming bitstreams a valid Level value must be set! **\n"); |
---|
1719 | fprintf(stderr, "***************************************************************************\n"); |
---|
1720 | } |
---|
1721 | |
---|
1722 | Bool check_failed = false; /* abort if there is a fatal configuration problem */ |
---|
1723 | #define xConfirmPara(a,b) check_failed |= confirmPara(a,b) |
---|
1724 | // check range of parameters |
---|
1725 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
1726 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
1727 | { |
---|
1728 | xConfirmPara( m_acLayerCfg[layer].m_inputBitDepthY < 8, "InputBitDepth must be at least 8" ); |
---|
1729 | xConfirmPara( m_acLayerCfg[layer].m_inputBitDepthC < 8, "InputBitDepthC must be at least 8" ); |
---|
1730 | } |
---|
1731 | #else |
---|
1732 | xConfirmPara( m_inputBitDepthY < 8, "InputBitDepth must be at least 8" ); |
---|
1733 | xConfirmPara( m_inputBitDepthC < 8, "InputBitDepthC must be at least 8" ); |
---|
1734 | #endif |
---|
1735 | #if !SVC_EXTENSION |
---|
1736 | xConfirmPara( m_iFrameRate <= 0, "Frame rate must be more than 1" ); |
---|
1737 | #endif |
---|
1738 | xConfirmPara( m_framesToBeEncoded <= 0, "Total Number Of Frames encoded must be more than 0" ); |
---|
1739 | xConfirmPara( m_iGOPSize < 1 , "GOP Size must be greater or equal to 1" ); |
---|
1740 | xConfirmPara( m_iGOPSize > 1 && m_iGOPSize % 2, "GOP Size must be a multiple of 2, if GOP Size is greater than 1" ); |
---|
1741 | #if !SVC_EXTENSION |
---|
1742 | xConfirmPara( (m_iIntraPeriod > 0 && m_iIntraPeriod < m_iGOPSize) || m_iIntraPeriod == 0, "Intra period must be more than GOP size, or -1 , not 0" ); |
---|
1743 | #endif |
---|
1744 | #if ALLOW_RECOVERY_POINT_AS_RAP |
---|
1745 | xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 3, "Decoding Refresh Type must be comprised between 0 and 3 included" ); |
---|
1746 | if(m_iDecodingRefreshType == 3) |
---|
1747 | { |
---|
1748 | xConfirmPara( !m_recoveryPointSEIEnabled, "When using RecoveryPointSEI messages as RA points, recoveryPointSEI must be enabled" ); |
---|
1749 | } |
---|
1750 | #else |
---|
1751 | xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 2, "Decoding Refresh Type must be equal to 0, 1 or 2" ); |
---|
1752 | #endif |
---|
1753 | #if !SVC_EXTENSION |
---|
1754 | xConfirmPara( m_iQP < -6 * (m_internalBitDepthY - 8) || m_iQP > 51, "QP exceeds supported range (-QpBDOffsety to 51)" ); |
---|
1755 | #endif |
---|
1756 | xConfirmPara( m_loopFilterBetaOffsetDiv2 < -6 || m_loopFilterBetaOffsetDiv2 > 6, "Loop Filter Beta Offset div. 2 exceeds supported range (-6 to 6)"); |
---|
1757 | xConfirmPara( m_loopFilterTcOffsetDiv2 < -6 || m_loopFilterTcOffsetDiv2 > 6, "Loop Filter Tc Offset div. 2 exceeds supported range (-6 to 6)"); |
---|
1758 | xConfirmPara( m_iFastSearch < 0 || m_iFastSearch > 2, "Fast Search Mode is not supported value (0:Full search 1:Diamond 2:PMVFAST)" ); |
---|
1759 | xConfirmPara( m_iSearchRange < 0 , "Search Range must be more than 0" ); |
---|
1760 | xConfirmPara( m_bipredSearchRange < 0 , "Search Range must be more than 0" ); |
---|
1761 | xConfirmPara( m_iMaxDeltaQP > 7, "Absolute Delta QP exceeds supported range (0 to 7)" ); |
---|
1762 | #if LAYER_CTB |
---|
1763 | for(UInt layer = 0; layer < MAX_LAYERS; layer++) |
---|
1764 | { |
---|
1765 | xConfirmPara( m_iMaxCuDQPDepth > m_acLayerCfg[layer].m_uiMaxCUDepth - 1, "Absolute depth for a minimum CuDQP exceeds maximum coding unit depth" ); |
---|
1766 | } |
---|
1767 | #else |
---|
1768 | xConfirmPara( m_iMaxCuDQPDepth > m_uiMaxCUDepth - 1, "Absolute depth for a minimum CuDQP exceeds maximum coding unit depth" ); |
---|
1769 | #endif |
---|
1770 | |
---|
1771 | xConfirmPara( m_cbQpOffset < -12, "Min. Chroma Cb QP Offset is -12" ); |
---|
1772 | xConfirmPara( m_cbQpOffset > 12, "Max. Chroma Cb QP Offset is 12" ); |
---|
1773 | xConfirmPara( m_crQpOffset < -12, "Min. Chroma Cr QP Offset is -12" ); |
---|
1774 | xConfirmPara( m_crQpOffset > 12, "Max. Chroma Cr QP Offset is 12" ); |
---|
1775 | |
---|
1776 | xConfirmPara( m_iQPAdaptationRange <= 0, "QP Adaptation Range must be more than 0" ); |
---|
1777 | #if !SVC_EXTENSION |
---|
1778 | if (m_iDecodingRefreshType == 2) |
---|
1779 | { |
---|
1780 | xConfirmPara( m_iIntraPeriod > 0 && m_iIntraPeriod <= m_iGOPSize , "Intra period must be larger than GOP size for periodic IDR pictures"); |
---|
1781 | } |
---|
1782 | #endif |
---|
1783 | #if !LAYER_CTB |
---|
1784 | xConfirmPara( (m_uiMaxCUWidth >> m_uiMaxCUDepth) < 4, "Minimum partition width size should be larger than or equal to 8"); |
---|
1785 | xConfirmPara( (m_uiMaxCUHeight >> m_uiMaxCUDepth) < 4, "Minimum partition height size should be larger than or equal to 8"); |
---|
1786 | xConfirmPara( m_uiMaxCUWidth < 16, "Maximum partition width size should be larger than or equal to 16"); |
---|
1787 | xConfirmPara( m_uiMaxCUHeight < 16, "Maximum partition height size should be larger than or equal to 16"); |
---|
1788 | #endif |
---|
1789 | #if !SVC_EXTENSION |
---|
1790 | xConfirmPara( (m_iSourceWidth % (m_uiMaxCUWidth >> (m_uiMaxCUDepth-1)))!=0, "Resulting coded frame width must be a multiple of the minimum CU size"); |
---|
1791 | xConfirmPara( (m_iSourceHeight % (m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)))!=0, "Resulting coded frame height must be a multiple of the minimum CU size"); |
---|
1792 | #endif |
---|
1793 | |
---|
1794 | #if !LAYER_CTB |
---|
1795 | xConfirmPara( m_uiQuadtreeTULog2MinSize < 2, "QuadtreeTULog2MinSize must be 2 or greater."); |
---|
1796 | xConfirmPara( m_uiQuadtreeTULog2MaxSize > 5, "QuadtreeTULog2MaxSize must be 5 or smaller."); |
---|
1797 | xConfirmPara( (1<<m_uiQuadtreeTULog2MaxSize) > m_uiMaxCUWidth, "QuadtreeTULog2MaxSize must be log2(maxCUSize) or smaller."); |
---|
1798 | |
---|
1799 | xConfirmPara( m_uiQuadtreeTULog2MaxSize < m_uiQuadtreeTULog2MinSize, "QuadtreeTULog2MaxSize must be greater than or equal to m_uiQuadtreeTULog2MinSize."); |
---|
1800 | xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUWidth >>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS |
---|
1801 | xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUHeight>>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS |
---|
1802 | xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUWidth >> m_uiMaxCUDepth ), "Minimum CU width must be greater than minimum transform size." ); |
---|
1803 | xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUHeight >> m_uiMaxCUDepth ), "Minimum CU height must be greater than minimum transform size." ); |
---|
1804 | xConfirmPara( m_uiQuadtreeTUMaxDepthInter < 1, "QuadtreeTUMaxDepthInter must be greater than or equal to 1" ); |
---|
1805 | 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" ); |
---|
1806 | xConfirmPara( m_uiQuadtreeTUMaxDepthIntra < 1, "QuadtreeTUMaxDepthIntra must be greater than or equal to 1" ); |
---|
1807 | 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" ); |
---|
1808 | #endif |
---|
1809 | |
---|
1810 | xConfirmPara( m_maxNumMergeCand < 1, "MaxNumMergeCand must be 1 or greater."); |
---|
1811 | xConfirmPara( m_maxNumMergeCand > 5, "MaxNumMergeCand must be 5 or smaller."); |
---|
1812 | |
---|
1813 | #if !SVC_EXTENSION |
---|
1814 | #if ADAPTIVE_QP_SELECTION |
---|
1815 | xConfirmPara( m_bUseAdaptQpSelect == true && m_iQP < 0, "AdaptiveQpSelection must be disabled when QP < 0."); |
---|
1816 | xConfirmPara( m_bUseAdaptQpSelect == true && (m_cbQpOffset !=0 || m_crQpOffset != 0 ), "AdaptiveQpSelection must be disabled when ChromaQpOffset is not equal to 0."); |
---|
1817 | #endif |
---|
1818 | #endif |
---|
1819 | |
---|
1820 | if( m_usePCM) |
---|
1821 | { |
---|
1822 | xConfirmPara( m_uiPCMLog2MinSize < 3, "PCMLog2MinSize must be 3 or greater."); |
---|
1823 | xConfirmPara( m_uiPCMLog2MinSize > 5, "PCMLog2MinSize must be 5 or smaller."); |
---|
1824 | xConfirmPara( m_pcmLog2MaxSize > 5, "PCMLog2MaxSize must be 5 or smaller."); |
---|
1825 | xConfirmPara( m_pcmLog2MaxSize < m_uiPCMLog2MinSize, "PCMLog2MaxSize must be equal to or greater than m_uiPCMLog2MinSize."); |
---|
1826 | } |
---|
1827 | |
---|
1828 | xConfirmPara( m_sliceMode < 0 || m_sliceMode > 3, "SliceMode exceeds supported range (0 to 3)" ); |
---|
1829 | if (m_sliceMode!=0) |
---|
1830 | { |
---|
1831 | xConfirmPara( m_sliceArgument < 1 , "SliceArgument should be larger than or equal to 1" ); |
---|
1832 | } |
---|
1833 | xConfirmPara( m_sliceSegmentMode < 0 || m_sliceSegmentMode > 3, "SliceSegmentMode exceeds supported range (0 to 3)" ); |
---|
1834 | if (m_sliceSegmentMode!=0) |
---|
1835 | { |
---|
1836 | xConfirmPara( m_sliceSegmentArgument < 1 , "SliceSegmentArgument should be larger than or equal to 1" ); |
---|
1837 | } |
---|
1838 | |
---|
1839 | Bool tileFlag = (m_iNumColumnsMinus1 > 0 || m_iNumRowsMinus1 > 0 ); |
---|
1840 | xConfirmPara( tileFlag && m_iWaveFrontSynchro, "Tile and Wavefront can not be applied together"); |
---|
1841 | |
---|
1842 | //TODO:ChromaFmt assumes 4:2:0 below |
---|
1843 | #if !SVC_EXTENSION |
---|
1844 | xConfirmPara( m_iSourceWidth % TComSPS::getWinUnitX(CHROMA_420) != 0, "Picture width must be an integer multiple of the specified chroma subsampling"); |
---|
1845 | xConfirmPara( m_iSourceHeight % TComSPS::getWinUnitY(CHROMA_420) != 0, "Picture height must be an integer multiple of the specified chroma subsampling"); |
---|
1846 | |
---|
1847 | xConfirmPara( m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0, "Horizontal padding must be an integer multiple of the specified chroma subsampling"); |
---|
1848 | xConfirmPara( m_aiPad[1] % TComSPS::getWinUnitY(CHROMA_420) != 0, "Vertical padding must be an integer multiple of the specified chroma subsampling"); |
---|
1849 | |
---|
1850 | xConfirmPara( m_confLeft % TComSPS::getWinUnitX(CHROMA_420) != 0, "Left conformance window offset must be an integer multiple of the specified chroma subsampling"); |
---|
1851 | xConfirmPara( m_confRight % TComSPS::getWinUnitX(CHROMA_420) != 0, "Right conformance window offset must be an integer multiple of the specified chroma subsampling"); |
---|
1852 | xConfirmPara( m_confTop % TComSPS::getWinUnitY(CHROMA_420) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling"); |
---|
1853 | xConfirmPara( m_confBottom % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling"); |
---|
1854 | #endif |
---|
1855 | |
---|
1856 | #if !LAYER_CTB |
---|
1857 | // max CU width and height should be power of 2 |
---|
1858 | UInt ui = m_uiMaxCUWidth; |
---|
1859 | while(ui) |
---|
1860 | { |
---|
1861 | ui >>= 1; |
---|
1862 | if( (ui & 1) == 1) |
---|
1863 | xConfirmPara( ui != 1 , "Width should be 2^n"); |
---|
1864 | } |
---|
1865 | ui = m_uiMaxCUHeight; |
---|
1866 | while(ui) |
---|
1867 | { |
---|
1868 | ui >>= 1; |
---|
1869 | if( (ui & 1) == 1) |
---|
1870 | xConfirmPara( ui != 1 , "Height should be 2^n"); |
---|
1871 | } |
---|
1872 | #endif |
---|
1873 | |
---|
1874 | /* if this is an intra-only sequence, ie IntraPeriod=1, don't verify the GOP structure |
---|
1875 | * This permits the ability to omit a GOP structure specification */ |
---|
1876 | #if SVC_EXTENSION |
---|
1877 | #if Q0108_TSA_STSA |
---|
1878 | if( m_acLayerCfg[0].m_iIntraPeriod == 1 && m_GOPList[0].m_POC == -1 ) |
---|
1879 | { |
---|
1880 | m_GOPList[0] = GOPEntry(); |
---|
1881 | m_GOPList[0].m_QPFactor = 1; |
---|
1882 | m_GOPList[0].m_betaOffsetDiv2 = 0; |
---|
1883 | m_GOPList[0].m_tcOffsetDiv2 = 0; |
---|
1884 | m_GOPList[0].m_POC = 1; |
---|
1885 | m_GOPList[0].m_numRefPicsActive = 4; |
---|
1886 | } |
---|
1887 | |
---|
1888 | for(UInt layer = 0; layer < MAX_LAYERS; layer++) |
---|
1889 | { |
---|
1890 | if (m_acLayerCfg[layer].m_iIntraPeriod == 1 && m_EhGOPList[layer][0].m_POC == -1) { |
---|
1891 | m_EhGOPList[layer][0] = GOPEntry(); |
---|
1892 | m_EhGOPList[layer][0].m_QPFactor = 1; |
---|
1893 | m_EhGOPList[layer][0].m_betaOffsetDiv2 = 0; |
---|
1894 | m_EhGOPList[layer][0].m_tcOffsetDiv2 = 0; |
---|
1895 | m_EhGOPList[layer][0].m_POC = 1; |
---|
1896 | m_EhGOPList[layer][0].m_numRefPicsActive = 4; |
---|
1897 | } |
---|
1898 | } |
---|
1899 | #else |
---|
1900 | for(UInt layer = 0; layer < MAX_LAYERS; layer++) |
---|
1901 | { |
---|
1902 | Int m_iIntraPeriod = m_acLayerCfg[layer].m_iIntraPeriod; |
---|
1903 | if (m_iIntraPeriod == 1 && m_GOPList[0].m_POC == -1) { |
---|
1904 | m_GOPList[0] = GOPEntry(); |
---|
1905 | m_GOPList[0].m_QPFactor = 1; |
---|
1906 | m_GOPList[0].m_betaOffsetDiv2 = 0; |
---|
1907 | m_GOPList[0].m_tcOffsetDiv2 = 0; |
---|
1908 | m_GOPList[0].m_POC = 1; |
---|
1909 | m_GOPList[0].m_numRefPicsActive = 4; |
---|
1910 | } |
---|
1911 | } |
---|
1912 | #endif |
---|
1913 | #else |
---|
1914 | if (m_iIntraPeriod == 1 && m_GOPList[0].m_POC == -1) { |
---|
1915 | m_GOPList[0] = GOPEntry(); |
---|
1916 | m_GOPList[0].m_QPFactor = 1; |
---|
1917 | m_GOPList[0].m_betaOffsetDiv2 = 0; |
---|
1918 | m_GOPList[0].m_tcOffsetDiv2 = 0; |
---|
1919 | m_GOPList[0].m_POC = 1; |
---|
1920 | m_GOPList[0].m_numRefPicsActive = 4; |
---|
1921 | } |
---|
1922 | #endif |
---|
1923 | |
---|
1924 | Bool verifiedGOP=false; |
---|
1925 | Bool errorGOP=false; |
---|
1926 | Int checkGOP=1; |
---|
1927 | Int numRefs = m_isField ? 2 : 1; |
---|
1928 | Int refList[MAX_NUM_REF_PICS+1]; |
---|
1929 | refList[0]=0; |
---|
1930 | if(m_isField) |
---|
1931 | { |
---|
1932 | refList[1] = 1; |
---|
1933 | } |
---|
1934 | Bool isOK[MAX_GOP]; |
---|
1935 | for(Int i=0; i<MAX_GOP; i++) |
---|
1936 | { |
---|
1937 | isOK[i]=false; |
---|
1938 | } |
---|
1939 | Int numOK=0; |
---|
1940 | #if !SVC_EXTENSION |
---|
1941 | xConfirmPara( m_iIntraPeriod >=0&&(m_iIntraPeriod%m_iGOPSize!=0), "Intra period must be a multiple of GOPSize, or -1" ); |
---|
1942 | #endif |
---|
1943 | |
---|
1944 | for(Int i=0; i<m_iGOPSize; i++) |
---|
1945 | { |
---|
1946 | if(m_GOPList[i].m_POC==m_iGOPSize) |
---|
1947 | { |
---|
1948 | xConfirmPara( m_GOPList[i].m_temporalId!=0 , "The last frame in each GOP must have temporal ID = 0 " ); |
---|
1949 | } |
---|
1950 | } |
---|
1951 | |
---|
1952 | #if SVC_EXTENSION |
---|
1953 | xConfirmPara( m_numLayers > MAX_LAYERS , "Number of layers in config file is greater than MAX_LAYERS" ); |
---|
1954 | m_numLayers = m_numLayers > MAX_LAYERS ? MAX_LAYERS : m_numLayers; |
---|
1955 | |
---|
1956 | // it can be updated after AVC BL support will be added to the WD |
---|
1957 | if( m_avcBaseLayerFlag ) |
---|
1958 | { |
---|
1959 | m_crossLayerIrapAlignFlag = false; |
---|
1960 | m_crossLayerPictureTypeAlignFlag = false; |
---|
1961 | m_crossLayerAlignedIdrOnlyFlag = false; |
---|
1962 | } |
---|
1963 | |
---|
1964 | // verify layer configuration parameters |
---|
1965 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
1966 | { |
---|
1967 | if(m_acLayerCfg[layer].xCheckParameter(m_isField)) |
---|
1968 | { |
---|
1969 | printf("\nError: invalid configuration parameter found in layer %d \n", layer); |
---|
1970 | check_failed = true; |
---|
1971 | } |
---|
1972 | } |
---|
1973 | |
---|
1974 | // verify layer configuration parameters |
---|
1975 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
1976 | { |
---|
1977 | Int m_iIntraPeriod = m_acLayerCfg[layer].m_iIntraPeriod; |
---|
1978 | #endif |
---|
1979 | if ( (m_iIntraPeriod != 1) && !m_loopFilterOffsetInPPS && m_DeblockingFilterControlPresent && (!m_bLoopFilterDisable) ) |
---|
1980 | { |
---|
1981 | for(Int i=0; i<m_iGOPSize; i++) |
---|
1982 | { |
---|
1983 | 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)" ); |
---|
1984 | 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)" ); |
---|
1985 | } |
---|
1986 | } |
---|
1987 | #if SVC_EXTENSION |
---|
1988 | } |
---|
1989 | #endif |
---|
1990 | |
---|
1991 | #if !Q0108_TSA_STSA |
---|
1992 | m_extraRPSs = 0; |
---|
1993 | #else |
---|
1994 | memset( m_extraRPSs, 0, sizeof( m_extraRPSs ) ); |
---|
1995 | #endif |
---|
1996 | //start looping through frames in coding order until we can verify that the GOP structure is correct. |
---|
1997 | while(!verifiedGOP&&!errorGOP) |
---|
1998 | { |
---|
1999 | Int curGOP = (checkGOP-1)%m_iGOPSize; |
---|
2000 | Int curPOC = ((checkGOP-1)/m_iGOPSize)*m_iGOPSize + m_GOPList[curGOP].m_POC; |
---|
2001 | if(m_GOPList[curGOP].m_POC<0) |
---|
2002 | { |
---|
2003 | printf("\nError: found fewer Reference Picture Sets than GOPSize\n"); |
---|
2004 | errorGOP=true; |
---|
2005 | } |
---|
2006 | else |
---|
2007 | { |
---|
2008 | //check that all reference pictures are available, or have a POC < 0 meaning they might be available in the next GOP. |
---|
2009 | Bool beforeI = false; |
---|
2010 | for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) |
---|
2011 | { |
---|
2012 | Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i]; |
---|
2013 | if(absPOC < 0) |
---|
2014 | { |
---|
2015 | beforeI=true; |
---|
2016 | } |
---|
2017 | else |
---|
2018 | { |
---|
2019 | Bool found=false; |
---|
2020 | for(Int j=0; j<numRefs; j++) |
---|
2021 | { |
---|
2022 | if(refList[j]==absPOC) |
---|
2023 | { |
---|
2024 | found=true; |
---|
2025 | for(Int k=0; k<m_iGOPSize; k++) |
---|
2026 | { |
---|
2027 | if(absPOC%m_iGOPSize == m_GOPList[k].m_POC%m_iGOPSize) |
---|
2028 | { |
---|
2029 | if(m_GOPList[k].m_temporalId==m_GOPList[curGOP].m_temporalId) |
---|
2030 | { |
---|
2031 | m_GOPList[k].m_refPic = true; |
---|
2032 | } |
---|
2033 | m_GOPList[curGOP].m_usedByCurrPic[i]=m_GOPList[k].m_temporalId<=m_GOPList[curGOP].m_temporalId; |
---|
2034 | } |
---|
2035 | } |
---|
2036 | } |
---|
2037 | } |
---|
2038 | if(!found) |
---|
2039 | { |
---|
2040 | printf("\nError: ref pic %d is not available for GOP frame %d\n",m_GOPList[curGOP].m_referencePics[i],curGOP+1); |
---|
2041 | errorGOP=true; |
---|
2042 | } |
---|
2043 | } |
---|
2044 | } |
---|
2045 | if(!beforeI&&!errorGOP) |
---|
2046 | { |
---|
2047 | //all ref frames were present |
---|
2048 | if(!isOK[curGOP]) |
---|
2049 | { |
---|
2050 | numOK++; |
---|
2051 | isOK[curGOP]=true; |
---|
2052 | if(numOK==m_iGOPSize) |
---|
2053 | { |
---|
2054 | verifiedGOP=true; |
---|
2055 | } |
---|
2056 | } |
---|
2057 | } |
---|
2058 | else |
---|
2059 | { |
---|
2060 | //create a new GOPEntry for this frame containing all the reference pictures that were available (POC > 0) |
---|
2061 | #if !Q0108_TSA_STSA |
---|
2062 | m_GOPList[m_iGOPSize+m_extraRPSs]=m_GOPList[curGOP]; |
---|
2063 | #else |
---|
2064 | m_GOPList[m_iGOPSize+m_extraRPSs[0]]=m_GOPList[curGOP]; |
---|
2065 | #endif |
---|
2066 | Int newRefs=0; |
---|
2067 | for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) |
---|
2068 | { |
---|
2069 | Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i]; |
---|
2070 | if(absPOC>=0) |
---|
2071 | { |
---|
2072 | #if !Q0108_TSA_STSA |
---|
2073 | m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[newRefs]=m_GOPList[curGOP].m_referencePics[i]; |
---|
2074 | m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[newRefs]=m_GOPList[curGOP].m_usedByCurrPic[i]; |
---|
2075 | #else |
---|
2076 | m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[newRefs]=m_GOPList[curGOP].m_referencePics[i]; |
---|
2077 | m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_usedByCurrPic[newRefs]=m_GOPList[curGOP].m_usedByCurrPic[i]; |
---|
2078 | #endif |
---|
2079 | newRefs++; |
---|
2080 | } |
---|
2081 | } |
---|
2082 | Int numPrefRefs = m_GOPList[curGOP].m_numRefPicsActive; |
---|
2083 | |
---|
2084 | for(Int offset = -1; offset>-checkGOP; offset--) |
---|
2085 | { |
---|
2086 | //step backwards in coding order and include any extra available pictures we might find useful to replace the ones with POC < 0. |
---|
2087 | Int offGOP = (checkGOP-1+offset)%m_iGOPSize; |
---|
2088 | Int offPOC = ((checkGOP-1+offset)/m_iGOPSize)*m_iGOPSize + m_GOPList[offGOP].m_POC; |
---|
2089 | if(offPOC>=0&&m_GOPList[offGOP].m_temporalId<=m_GOPList[curGOP].m_temporalId) |
---|
2090 | { |
---|
2091 | Bool newRef=false; |
---|
2092 | for(Int i=0; i<numRefs; i++) |
---|
2093 | { |
---|
2094 | if(refList[i]==offPOC) |
---|
2095 | { |
---|
2096 | newRef=true; |
---|
2097 | } |
---|
2098 | } |
---|
2099 | for(Int i=0; i<newRefs; i++) |
---|
2100 | { |
---|
2101 | #if !Q0108_TSA_STSA |
---|
2102 | if(m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[i]==offPOC-curPOC) |
---|
2103 | #else |
---|
2104 | if(m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[i]==offPOC-curPOC) |
---|
2105 | #endif |
---|
2106 | { |
---|
2107 | newRef=false; |
---|
2108 | } |
---|
2109 | } |
---|
2110 | if(newRef) |
---|
2111 | { |
---|
2112 | Int insertPoint=newRefs; |
---|
2113 | //this picture can be added, find appropriate place in list and insert it. |
---|
2114 | if(m_GOPList[offGOP].m_temporalId==m_GOPList[curGOP].m_temporalId) |
---|
2115 | { |
---|
2116 | m_GOPList[offGOP].m_refPic = true; |
---|
2117 | } |
---|
2118 | for(Int j=0; j<newRefs; j++) |
---|
2119 | { |
---|
2120 | #if !Q0108_TSA_STSA |
---|
2121 | if(m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]<offPOC-curPOC||m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]>0) |
---|
2122 | #else |
---|
2123 | if(m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[j]<offPOC-curPOC||m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[j]>0) |
---|
2124 | #endif |
---|
2125 | { |
---|
2126 | insertPoint = j; |
---|
2127 | break; |
---|
2128 | } |
---|
2129 | } |
---|
2130 | Int prev = offPOC-curPOC; |
---|
2131 | Int prevUsed = m_GOPList[offGOP].m_temporalId<=m_GOPList[curGOP].m_temporalId; |
---|
2132 | for(Int j=insertPoint; j<newRefs+1; j++) |
---|
2133 | { |
---|
2134 | #if !Q0108_TSA_STSA |
---|
2135 | Int newPrev = m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]; |
---|
2136 | Int newUsed = m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j]; |
---|
2137 | m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]=prev; |
---|
2138 | m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j]=prevUsed; |
---|
2139 | #else |
---|
2140 | Int newPrev = m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[j]; |
---|
2141 | Int newUsed = m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_usedByCurrPic[j]; |
---|
2142 | m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[j]=prev; |
---|
2143 | m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_usedByCurrPic[j]=prevUsed; |
---|
2144 | #endif |
---|
2145 | |
---|
2146 | prevUsed=newUsed; |
---|
2147 | prev=newPrev; |
---|
2148 | } |
---|
2149 | newRefs++; |
---|
2150 | } |
---|
2151 | } |
---|
2152 | if(newRefs>=numPrefRefs) |
---|
2153 | { |
---|
2154 | break; |
---|
2155 | } |
---|
2156 | } |
---|
2157 | #if !Q0108_TSA_STSA |
---|
2158 | m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefPics=newRefs; |
---|
2159 | m_GOPList[m_iGOPSize+m_extraRPSs].m_POC = curPOC; |
---|
2160 | #else |
---|
2161 | m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_numRefPics=newRefs; |
---|
2162 | m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_POC = curPOC; |
---|
2163 | #endif |
---|
2164 | #if !Q0108_TSA_STSA |
---|
2165 | if (m_extraRPSs == 0) |
---|
2166 | #else |
---|
2167 | if (m_extraRPSs[0] == 0) |
---|
2168 | #endif |
---|
2169 | { |
---|
2170 | #if !Q0108_TSA_STSA |
---|
2171 | m_GOPList[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 0; |
---|
2172 | m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefIdc = 0; |
---|
2173 | #else |
---|
2174 | m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_interRPSPrediction = 0; |
---|
2175 | m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_numRefIdc = 0; |
---|
2176 | #endif |
---|
2177 | } |
---|
2178 | else |
---|
2179 | { |
---|
2180 | #if !Q0108_TSA_STSA |
---|
2181 | Int rIdx = m_iGOPSize + m_extraRPSs - 1; |
---|
2182 | #else |
---|
2183 | Int rIdx = m_iGOPSize + m_extraRPSs[0] - 1; |
---|
2184 | #endif |
---|
2185 | Int refPOC = m_GOPList[rIdx].m_POC; |
---|
2186 | Int refPics = m_GOPList[rIdx].m_numRefPics; |
---|
2187 | Int newIdc=0; |
---|
2188 | for(Int i = 0; i<= refPics; i++) |
---|
2189 | { |
---|
2190 | Int deltaPOC = ((i != refPics)? m_GOPList[rIdx].m_referencePics[i] : 0); // check if the reference abs POC is >= 0 |
---|
2191 | Int absPOCref = refPOC+deltaPOC; |
---|
2192 | Int refIdc = 0; |
---|
2193 | #if !Q0108_TSA_STSA |
---|
2194 | for (Int j = 0; j < m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefPics; j++) |
---|
2195 | { |
---|
2196 | if ( (absPOCref - curPOC) == m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]) |
---|
2197 | { |
---|
2198 | if (m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j]) |
---|
2199 | { |
---|
2200 | refIdc = 1; |
---|
2201 | } |
---|
2202 | else |
---|
2203 | { |
---|
2204 | refIdc = 2; |
---|
2205 | } |
---|
2206 | } |
---|
2207 | } |
---|
2208 | m_GOPList[m_iGOPSize+m_extraRPSs].m_refIdc[newIdc]=refIdc; |
---|
2209 | newIdc++; |
---|
2210 | } |
---|
2211 | m_GOPList[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 1; |
---|
2212 | m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefIdc = newIdc; |
---|
2213 | m_GOPList[m_iGOPSize+m_extraRPSs].m_deltaRPS = refPOC - m_GOPList[m_iGOPSize+m_extraRPSs].m_POC; |
---|
2214 | } |
---|
2215 | curGOP=m_iGOPSize+m_extraRPSs; |
---|
2216 | m_extraRPSs++; |
---|
2217 | } |
---|
2218 | #else |
---|
2219 | for (Int j = 0; j < m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_numRefPics; j++) |
---|
2220 | { |
---|
2221 | if ( (absPOCref - curPOC) == m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[j]) |
---|
2222 | { |
---|
2223 | if (m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_usedByCurrPic[j]) |
---|
2224 | { |
---|
2225 | refIdc = 1; |
---|
2226 | } |
---|
2227 | else |
---|
2228 | { |
---|
2229 | refIdc = 2; |
---|
2230 | } |
---|
2231 | } |
---|
2232 | } |
---|
2233 | m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_refIdc[newIdc]=refIdc; |
---|
2234 | newIdc++; |
---|
2235 | } |
---|
2236 | m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_interRPSPrediction = 1; |
---|
2237 | m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_numRefIdc = newIdc; |
---|
2238 | m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_deltaRPS = refPOC - m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_POC; |
---|
2239 | } |
---|
2240 | curGOP=m_iGOPSize+m_extraRPSs[0]; |
---|
2241 | m_extraRPSs[0]++; |
---|
2242 | } |
---|
2243 | #endif |
---|
2244 | |
---|
2245 | numRefs=0; |
---|
2246 | for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++) |
---|
2247 | { |
---|
2248 | Int absPOC = curPOC+m_GOPList[curGOP].m_referencePics[i]; |
---|
2249 | if(absPOC >= 0) |
---|
2250 | { |
---|
2251 | refList[numRefs]=absPOC; |
---|
2252 | numRefs++; |
---|
2253 | } |
---|
2254 | } |
---|
2255 | refList[numRefs]=curPOC; |
---|
2256 | numRefs++; |
---|
2257 | } |
---|
2258 | checkGOP++; |
---|
2259 | } |
---|
2260 | xConfirmPara(errorGOP,"Invalid GOP structure given"); |
---|
2261 | |
---|
2262 | #if SVC_EXTENSION && Q0108_TSA_STSA |
---|
2263 | for ( Int layerId = 1; layerId < m_numLayers; layerId++ ) |
---|
2264 | { |
---|
2265 | verifiedGOP=false; |
---|
2266 | errorGOP=false; |
---|
2267 | checkGOP=1; |
---|
2268 | numRefs = m_isField ? 2 : 1; |
---|
2269 | refList[0]=0; |
---|
2270 | |
---|
2271 | if(m_isField) |
---|
2272 | { |
---|
2273 | refList[1] = 1; |
---|
2274 | } |
---|
2275 | |
---|
2276 | memset( isOK, 0, sizeof( isOK ) ); |
---|
2277 | numOK=0; |
---|
2278 | |
---|
2279 | for(Int i=0; i<m_iGOPSize; i++) |
---|
2280 | { |
---|
2281 | if(m_EhGOPList[layerId][i].m_POC==m_iGOPSize) |
---|
2282 | { |
---|
2283 | xConfirmPara( m_EhGOPList[layerId][i].m_temporalId!=0 , "The last frame in each GOP must have temporal ID = 0 " ); |
---|
2284 | } |
---|
2285 | } |
---|
2286 | |
---|
2287 | xConfirmPara( m_numLayers > MAX_LAYERS , "Number of layers in config file is greater than MAX_LAYERS" ); |
---|
2288 | m_numLayers = m_numLayers > MAX_LAYERS ? MAX_LAYERS : m_numLayers; |
---|
2289 | |
---|
2290 | // verify layer configuration parameters |
---|
2291 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
2292 | { |
---|
2293 | Int m_iIntraPeriod = m_acLayerCfg[layer].m_iIntraPeriod; |
---|
2294 | if ( (m_iIntraPeriod != 1) && !m_loopFilterOffsetInPPS && m_DeblockingFilterControlPresent && (!m_bLoopFilterDisable) ) |
---|
2295 | { |
---|
2296 | for(Int i=0; i<m_iGOPSize; i++) |
---|
2297 | { |
---|
2298 | xConfirmPara( (m_EhGOPList[layerId][i].m_betaOffsetDiv2 + m_loopFilterBetaOffsetDiv2) < -6 || (m_EhGOPList[layerId][i].m_betaOffsetDiv2 + m_loopFilterBetaOffsetDiv2) > 6, "Loop Filter Beta Offset div. 2 for one of the GOP entries exceeds supported range (-6 to 6)" ); |
---|
2299 | xConfirmPara( (m_EhGOPList[layerId][i].m_tcOffsetDiv2 + m_loopFilterTcOffsetDiv2) < -6 || (m_EhGOPList[layerId][i].m_tcOffsetDiv2 + m_loopFilterTcOffsetDiv2) > 6, "Loop Filter Tc Offset div. 2 for one of the GOP entries exceeds supported range (-6 to 6)" ); |
---|
2300 | } |
---|
2301 | } |
---|
2302 | } |
---|
2303 | |
---|
2304 | //start looping through frames in coding order until we can verify that the GOP structure is correct. |
---|
2305 | while(!verifiedGOP&&!errorGOP) |
---|
2306 | { |
---|
2307 | Int curGOP = (checkGOP-1)%m_iGOPSize; |
---|
2308 | Int curPOC = ((checkGOP-1)/m_iGOPSize)*m_iGOPSize + m_EhGOPList[layerId][curGOP].m_POC; |
---|
2309 | if(m_EhGOPList[layerId][curGOP].m_POC<0) |
---|
2310 | { |
---|
2311 | printf("\nError: found fewer Reference Picture Sets than GOPSize\n"); |
---|
2312 | errorGOP=true; |
---|
2313 | } |
---|
2314 | else |
---|
2315 | { |
---|
2316 | //check that all reference pictures are available, or have a POC < 0 meaning they might be available in the next GOP. |
---|
2317 | Bool beforeI = false; |
---|
2318 | for(Int i = 0; i< m_EhGOPList[layerId][curGOP].m_numRefPics; i++) |
---|
2319 | { |
---|
2320 | Int absPOC = curPOC+m_EhGOPList[layerId][curGOP].m_referencePics[i]; |
---|
2321 | if(absPOC < 0) |
---|
2322 | { |
---|
2323 | beforeI=true; |
---|
2324 | } |
---|
2325 | else |
---|
2326 | { |
---|
2327 | Bool found=false; |
---|
2328 | for(Int j=0; j<numRefs; j++) |
---|
2329 | { |
---|
2330 | if(refList[j]==absPOC) |
---|
2331 | { |
---|
2332 | found=true; |
---|
2333 | for(Int k=0; k<m_iGOPSize; k++) |
---|
2334 | { |
---|
2335 | if(absPOC%m_iGOPSize == m_EhGOPList[layerId][k].m_POC%m_iGOPSize) |
---|
2336 | { |
---|
2337 | if(m_EhGOPList[layerId][k].m_temporalId==m_EhGOPList[layerId][curGOP].m_temporalId) |
---|
2338 | { |
---|
2339 | m_EhGOPList[layerId][k].m_refPic = true; |
---|
2340 | } |
---|
2341 | m_EhGOPList[layerId][curGOP].m_usedByCurrPic[i]=m_EhGOPList[layerId][k].m_temporalId<=m_EhGOPList[layerId][curGOP].m_temporalId; |
---|
2342 | } |
---|
2343 | } |
---|
2344 | } |
---|
2345 | } |
---|
2346 | if(!found) |
---|
2347 | { |
---|
2348 | printf("\nError: ref pic %d is not available for GOP frame %d\n",m_EhGOPList[layerId][curGOP].m_referencePics[i],curGOP+1); |
---|
2349 | errorGOP=true; |
---|
2350 | } |
---|
2351 | } |
---|
2352 | } |
---|
2353 | if(!beforeI&&!errorGOP) |
---|
2354 | { |
---|
2355 | //all ref frames were present |
---|
2356 | if(!isOK[curGOP]) |
---|
2357 | { |
---|
2358 | numOK++; |
---|
2359 | isOK[curGOP]=true; |
---|
2360 | if(numOK==m_iGOPSize) |
---|
2361 | { |
---|
2362 | verifiedGOP=true; |
---|
2363 | } |
---|
2364 | } |
---|
2365 | } |
---|
2366 | else |
---|
2367 | { |
---|
2368 | //create a new GOPEntry for this frame containing all the reference pictures that were available (POC > 0) |
---|
2369 | |
---|
2370 | m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]]=m_EhGOPList[layerId][curGOP]; |
---|
2371 | Int newRefs=0; |
---|
2372 | for(Int i = 0; i< m_EhGOPList[layerId][curGOP].m_numRefPics; i++) |
---|
2373 | { |
---|
2374 | Int absPOC = curPOC+m_EhGOPList[layerId][curGOP].m_referencePics[i]; |
---|
2375 | if(absPOC>=0) |
---|
2376 | { |
---|
2377 | m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_referencePics[newRefs]=m_EhGOPList[layerId][curGOP].m_referencePics[i]; |
---|
2378 | m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_usedByCurrPic[newRefs]=m_EhGOPList[layerId][curGOP].m_usedByCurrPic[i]; |
---|
2379 | newRefs++; |
---|
2380 | } |
---|
2381 | } |
---|
2382 | Int numPrefRefs = m_EhGOPList[layerId][curGOP].m_numRefPicsActive; |
---|
2383 | |
---|
2384 | for(Int offset = -1; offset>-checkGOP; offset--) |
---|
2385 | { |
---|
2386 | //step backwards in coding order and include any extra available pictures we might find useful to replace the ones with POC < 0. |
---|
2387 | Int offGOP = (checkGOP-1+offset)%m_iGOPSize; |
---|
2388 | Int offPOC = ((checkGOP-1+offset)/m_iGOPSize)*m_iGOPSize + m_EhGOPList[layerId][offGOP].m_POC; |
---|
2389 | if(offPOC>=0&&m_EhGOPList[layerId][offGOP].m_temporalId<=m_EhGOPList[layerId][curGOP].m_temporalId) |
---|
2390 | { |
---|
2391 | Bool newRef=false; |
---|
2392 | for(Int i=0; i<numRefs; i++) |
---|
2393 | { |
---|
2394 | if(refList[i]==offPOC) |
---|
2395 | { |
---|
2396 | newRef=true; |
---|
2397 | } |
---|
2398 | } |
---|
2399 | for(Int i=0; i<newRefs; i++) |
---|
2400 | { |
---|
2401 | if(m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_referencePics[i]==offPOC-curPOC) |
---|
2402 | { |
---|
2403 | newRef=false; |
---|
2404 | } |
---|
2405 | } |
---|
2406 | if(newRef) |
---|
2407 | { |
---|
2408 | Int insertPoint=newRefs; |
---|
2409 | //this picture can be added, find appropriate place in list and insert it. |
---|
2410 | if(m_EhGOPList[layerId][offGOP].m_temporalId==m_EhGOPList[layerId][curGOP].m_temporalId) |
---|
2411 | { |
---|
2412 | m_EhGOPList[layerId][offGOP].m_refPic = true; |
---|
2413 | } |
---|
2414 | for(Int j=0; j<newRefs; j++) |
---|
2415 | { |
---|
2416 | if(m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_referencePics[j]<offPOC-curPOC||m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_referencePics[j]>0) |
---|
2417 | { |
---|
2418 | insertPoint = j; |
---|
2419 | break; |
---|
2420 | } |
---|
2421 | } |
---|
2422 | Int prev = offPOC-curPOC; |
---|
2423 | Int prevUsed = m_EhGOPList[layerId][offGOP].m_temporalId<=m_EhGOPList[layerId][curGOP].m_temporalId; |
---|
2424 | for(Int j=insertPoint; j<newRefs+1; j++) |
---|
2425 | { |
---|
2426 | Int newPrev = m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_referencePics[j]; |
---|
2427 | Int newUsed = m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_usedByCurrPic[j]; |
---|
2428 | m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_referencePics[j]=prev; |
---|
2429 | m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_usedByCurrPic[j]=prevUsed; |
---|
2430 | prevUsed=newUsed; |
---|
2431 | prev=newPrev; |
---|
2432 | } |
---|
2433 | newRefs++; |
---|
2434 | } |
---|
2435 | } |
---|
2436 | if(newRefs>=numPrefRefs) |
---|
2437 | { |
---|
2438 | break; |
---|
2439 | } |
---|
2440 | } |
---|
2441 | m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_numRefPics=newRefs; |
---|
2442 | m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_POC = curPOC; |
---|
2443 | if (m_extraRPSs[layerId] == 0) |
---|
2444 | { |
---|
2445 | m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_interRPSPrediction = 0; |
---|
2446 | m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_numRefIdc = 0; |
---|
2447 | } |
---|
2448 | else |
---|
2449 | { |
---|
2450 | Int rIdx = m_iGOPSize + m_extraRPSs[layerId] - 1; |
---|
2451 | Int refPOC = m_EhGOPList[layerId][rIdx].m_POC; |
---|
2452 | Int refPics = m_EhGOPList[layerId][rIdx].m_numRefPics; |
---|
2453 | Int newIdc=0; |
---|
2454 | for(Int i = 0; i<= refPics; i++) |
---|
2455 | { |
---|
2456 | Int deltaPOC = ((i != refPics)? m_EhGOPList[layerId][rIdx].m_referencePics[i] : 0); // check if the reference abs POC is >= 0 |
---|
2457 | Int absPOCref = refPOC+deltaPOC; |
---|
2458 | Int refIdc = 0; |
---|
2459 | for (Int j = 0; j < m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_numRefPics; j++) |
---|
2460 | { |
---|
2461 | if ( (absPOCref - curPOC) == m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_referencePics[j]) |
---|
2462 | { |
---|
2463 | if (m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_usedByCurrPic[j]) |
---|
2464 | { |
---|
2465 | refIdc = 1; |
---|
2466 | } |
---|
2467 | else |
---|
2468 | { |
---|
2469 | refIdc = 2; |
---|
2470 | } |
---|
2471 | } |
---|
2472 | } |
---|
2473 | m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_refIdc[newIdc]=refIdc; |
---|
2474 | newIdc++; |
---|
2475 | } |
---|
2476 | m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_interRPSPrediction = 1; |
---|
2477 | m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_numRefIdc = newIdc; |
---|
2478 | m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_deltaRPS = refPOC - m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_POC; |
---|
2479 | } |
---|
2480 | curGOP=m_iGOPSize+m_extraRPSs[layerId]; |
---|
2481 | m_extraRPSs[layerId]++; |
---|
2482 | } |
---|
2483 | numRefs=0; |
---|
2484 | for(Int i = 0; i< m_EhGOPList[layerId][curGOP].m_numRefPics; i++) |
---|
2485 | { |
---|
2486 | Int absPOC = curPOC+m_EhGOPList[layerId][curGOP].m_referencePics[i]; |
---|
2487 | if(absPOC >= 0) |
---|
2488 | { |
---|
2489 | refList[numRefs]=absPOC; |
---|
2490 | numRefs++; |
---|
2491 | } |
---|
2492 | } |
---|
2493 | refList[numRefs]=curPOC; |
---|
2494 | numRefs++; |
---|
2495 | } |
---|
2496 | checkGOP++; |
---|
2497 | } |
---|
2498 | xConfirmPara(errorGOP,"Invalid GOP structure given"); |
---|
2499 | } |
---|
2500 | #endif |
---|
2501 | |
---|
2502 | m_maxTempLayer = 1; |
---|
2503 | for(Int i=0; i<m_iGOPSize; i++) |
---|
2504 | { |
---|
2505 | if(m_GOPList[i].m_temporalId >= m_maxTempLayer) |
---|
2506 | { |
---|
2507 | m_maxTempLayer = m_GOPList[i].m_temporalId+1; |
---|
2508 | } |
---|
2509 | xConfirmPara(m_GOPList[i].m_sliceType!='B'&&m_GOPList[i].m_sliceType!='P'&&m_GOPList[i].m_sliceType!='I', "Slice type must be equal to B or P or I"); |
---|
2510 | } |
---|
2511 | |
---|
2512 | #if Q0108_TSA_STSA |
---|
2513 | for ( Int layerId = 1; layerId < m_numLayers; layerId++) |
---|
2514 | { |
---|
2515 | m_EhMaxTempLayer[layerId] = 1; |
---|
2516 | for(Int i=0; i<m_iGOPSize; i++) |
---|
2517 | { |
---|
2518 | if(m_EhGOPList[layerId][i].m_temporalId >= m_EhMaxTempLayer[layerId] ) |
---|
2519 | { |
---|
2520 | m_EhMaxTempLayer[layerId] = m_EhGOPList[layerId][i].m_temporalId; |
---|
2521 | } |
---|
2522 | xConfirmPara(m_GOPList[i].m_sliceType!='B'&&m_GOPList[i].m_sliceType!='P'&&m_GOPList[i].m_sliceType!='I', "Slice type must be equal to B or P or I"); |
---|
2523 | } |
---|
2524 | } |
---|
2525 | #endif |
---|
2526 | |
---|
2527 | for(Int i=0; i<MAX_TLAYER; i++) |
---|
2528 | { |
---|
2529 | m_numReorderPics[i] = 0; |
---|
2530 | m_maxDecPicBuffering[i] = 1; |
---|
2531 | } |
---|
2532 | for(Int i=0; i<m_iGOPSize; i++) |
---|
2533 | { |
---|
2534 | if(m_GOPList[i].m_numRefPics+1 > m_maxDecPicBuffering[m_GOPList[i].m_temporalId]) |
---|
2535 | { |
---|
2536 | m_maxDecPicBuffering[m_GOPList[i].m_temporalId] = m_GOPList[i].m_numRefPics + 1; |
---|
2537 | } |
---|
2538 | Int highestDecodingNumberWithLowerPOC = 0; |
---|
2539 | for(Int j=0; j<m_iGOPSize; j++) |
---|
2540 | { |
---|
2541 | if(m_GOPList[j].m_POC <= m_GOPList[i].m_POC) |
---|
2542 | { |
---|
2543 | highestDecodingNumberWithLowerPOC = j; |
---|
2544 | } |
---|
2545 | } |
---|
2546 | Int numReorder = 0; |
---|
2547 | for(Int j=0; j<highestDecodingNumberWithLowerPOC; j++) |
---|
2548 | { |
---|
2549 | if(m_GOPList[j].m_temporalId <= m_GOPList[i].m_temporalId && |
---|
2550 | m_GOPList[j].m_POC > m_GOPList[i].m_POC) |
---|
2551 | { |
---|
2552 | numReorder++; |
---|
2553 | } |
---|
2554 | } |
---|
2555 | if(numReorder > m_numReorderPics[m_GOPList[i].m_temporalId]) |
---|
2556 | { |
---|
2557 | m_numReorderPics[m_GOPList[i].m_temporalId] = numReorder; |
---|
2558 | } |
---|
2559 | } |
---|
2560 | for(Int i=0; i<MAX_TLAYER-1; i++) |
---|
2561 | { |
---|
2562 | // a lower layer can not have higher value of m_numReorderPics than a higher layer |
---|
2563 | if(m_numReorderPics[i+1] < m_numReorderPics[i]) |
---|
2564 | { |
---|
2565 | m_numReorderPics[i+1] = m_numReorderPics[i]; |
---|
2566 | } |
---|
2567 | // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ] - 1, inclusive |
---|
2568 | if(m_numReorderPics[i] > m_maxDecPicBuffering[i] - 1) |
---|
2569 | { |
---|
2570 | m_maxDecPicBuffering[i] = m_numReorderPics[i] + 1; |
---|
2571 | } |
---|
2572 | // a lower layer can not have higher value of m_uiMaxDecPicBuffering than a higher layer |
---|
2573 | if(m_maxDecPicBuffering[i+1] < m_maxDecPicBuffering[i]) |
---|
2574 | { |
---|
2575 | m_maxDecPicBuffering[i+1] = m_maxDecPicBuffering[i]; |
---|
2576 | } |
---|
2577 | } |
---|
2578 | |
---|
2579 | |
---|
2580 | // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ] - 1, inclusive |
---|
2581 | if(m_numReorderPics[MAX_TLAYER-1] > m_maxDecPicBuffering[MAX_TLAYER-1] - 1) |
---|
2582 | { |
---|
2583 | m_maxDecPicBuffering[MAX_TLAYER-1] = m_numReorderPics[MAX_TLAYER-1] + 1; |
---|
2584 | } |
---|
2585 | |
---|
2586 | #if SVC_EXTENSION // ToDo: it should be checked for the case when parameters are different for the layers |
---|
2587 | for(UInt layer = 0; layer < MAX_LAYERS; layer++) |
---|
2588 | { |
---|
2589 | Int m_iSourceWidth = m_acLayerCfg[layer].m_iSourceWidth; |
---|
2590 | Int m_iSourceHeight = m_acLayerCfg[layer].m_iSourceHeight; |
---|
2591 | #if LAYER_CTB |
---|
2592 | Int m_uiMaxCUWidth = m_acLayerCfg[layer].m_uiMaxCUWidth; |
---|
2593 | Int m_uiMaxCUHeight = m_acLayerCfg[layer].m_uiMaxCUHeight; |
---|
2594 | #endif |
---|
2595 | #endif |
---|
2596 | if(m_vuiParametersPresentFlag && m_bitstreamRestrictionFlag) |
---|
2597 | { |
---|
2598 | Int PicSizeInSamplesY = m_iSourceWidth * m_iSourceHeight; |
---|
2599 | if(tileFlag) |
---|
2600 | { |
---|
2601 | Int maxTileWidth = 0; |
---|
2602 | Int maxTileHeight = 0; |
---|
2603 | Int widthInCU = (m_iSourceWidth % m_uiMaxCUWidth) ? m_iSourceWidth/m_uiMaxCUWidth + 1: m_iSourceWidth/m_uiMaxCUWidth; |
---|
2604 | Int heightInCU = (m_iSourceHeight % m_uiMaxCUHeight) ? m_iSourceHeight/m_uiMaxCUHeight + 1: m_iSourceHeight/m_uiMaxCUHeight; |
---|
2605 | if(m_iUniformSpacingIdr) |
---|
2606 | { |
---|
2607 | maxTileWidth = m_uiMaxCUWidth*((widthInCU+m_iNumColumnsMinus1)/(m_iNumColumnsMinus1+1)); |
---|
2608 | maxTileHeight = m_uiMaxCUHeight*((heightInCU+m_iNumRowsMinus1)/(m_iNumRowsMinus1+1)); |
---|
2609 | // if only the last tile-row is one treeblock higher than the others |
---|
2610 | // the maxTileHeight becomes smaller if the last row of treeblocks has lower height than the others |
---|
2611 | if(!((heightInCU-1)%(m_iNumRowsMinus1+1))) |
---|
2612 | { |
---|
2613 | maxTileHeight = maxTileHeight - m_uiMaxCUHeight + (m_iSourceHeight % m_uiMaxCUHeight); |
---|
2614 | } |
---|
2615 | // if only the last tile-column is one treeblock wider than the others |
---|
2616 | // the maxTileWidth becomes smaller if the last column of treeblocks has lower width than the others |
---|
2617 | if(!((widthInCU-1)%(m_iNumColumnsMinus1+1))) |
---|
2618 | { |
---|
2619 | maxTileWidth = maxTileWidth - m_uiMaxCUWidth + (m_iSourceWidth % m_uiMaxCUWidth); |
---|
2620 | } |
---|
2621 | } |
---|
2622 | else // not uniform spacing |
---|
2623 | { |
---|
2624 | if(m_iNumColumnsMinus1<1) |
---|
2625 | { |
---|
2626 | maxTileWidth = m_iSourceWidth; |
---|
2627 | } |
---|
2628 | else |
---|
2629 | { |
---|
2630 | Int accColumnWidth = 0; |
---|
2631 | for(Int col=0; col<(m_iNumColumnsMinus1); col++) |
---|
2632 | { |
---|
2633 | maxTileWidth = m_pColumnWidth[col]>maxTileWidth ? m_pColumnWidth[col]:maxTileWidth; |
---|
2634 | accColumnWidth += m_pColumnWidth[col]; |
---|
2635 | } |
---|
2636 | maxTileWidth = (widthInCU-accColumnWidth)>maxTileWidth ? m_uiMaxCUWidth*(widthInCU-accColumnWidth):m_uiMaxCUWidth*maxTileWidth; |
---|
2637 | } |
---|
2638 | if(m_iNumRowsMinus1<1) |
---|
2639 | { |
---|
2640 | maxTileHeight = m_iSourceHeight; |
---|
2641 | } |
---|
2642 | else |
---|
2643 | { |
---|
2644 | Int accRowHeight = 0; |
---|
2645 | for(Int row=0; row<(m_iNumRowsMinus1); row++) |
---|
2646 | { |
---|
2647 | maxTileHeight = m_pRowHeight[row]>maxTileHeight ? m_pRowHeight[row]:maxTileHeight; |
---|
2648 | accRowHeight += m_pRowHeight[row]; |
---|
2649 | } |
---|
2650 | maxTileHeight = (heightInCU-accRowHeight)>maxTileHeight ? m_uiMaxCUHeight*(heightInCU-accRowHeight):m_uiMaxCUHeight*maxTileHeight; |
---|
2651 | } |
---|
2652 | } |
---|
2653 | Int maxSizeInSamplesY = maxTileWidth*maxTileHeight; |
---|
2654 | m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/maxSizeInSamplesY-4; |
---|
2655 | } |
---|
2656 | else if(m_iWaveFrontSynchro) |
---|
2657 | { |
---|
2658 | m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/((2*m_iSourceHeight+m_iSourceWidth)*m_uiMaxCUHeight)-4; |
---|
2659 | } |
---|
2660 | else if(m_sliceMode == 1) |
---|
2661 | { |
---|
2662 | m_minSpatialSegmentationIdc = 4*PicSizeInSamplesY/(m_sliceArgument*m_uiMaxCUWidth*m_uiMaxCUHeight)-4; |
---|
2663 | } |
---|
2664 | else |
---|
2665 | { |
---|
2666 | m_minSpatialSegmentationIdc = 0; |
---|
2667 | } |
---|
2668 | } |
---|
2669 | #if SVC_EXTENSION |
---|
2670 | } |
---|
2671 | #endif |
---|
2672 | xConfirmPara( m_iWaveFrontSynchro < 0, "WaveFrontSynchro cannot be negative" ); |
---|
2673 | #if !SVC_EXTENSION |
---|
2674 | xConfirmPara( m_iWaveFrontSubstreams <= 0, "WaveFrontSubstreams must be positive" ); |
---|
2675 | xConfirmPara( m_iWaveFrontSubstreams > 1 && !m_iWaveFrontSynchro, "Must have WaveFrontSynchro > 0 in order to have WaveFrontSubstreams > 1" ); |
---|
2676 | #endif |
---|
2677 | |
---|
2678 | xConfirmPara( m_decodedPictureHashSEIEnabled<0 || m_decodedPictureHashSEIEnabled>3, "this hash type is not correct!\n"); |
---|
2679 | |
---|
2680 | if (m_toneMappingInfoSEIEnabled) |
---|
2681 | { |
---|
2682 | xConfirmPara( m_toneMapCodedDataBitDepth < 8 || m_toneMapCodedDataBitDepth > 14 , "SEIToneMapCodedDataBitDepth must be in rage 8 to 14"); |
---|
2683 | xConfirmPara( m_toneMapTargetBitDepth < 1 || (m_toneMapTargetBitDepth > 16 && m_toneMapTargetBitDepth < 255) , "SEIToneMapTargetBitDepth must be in rage 1 to 16 or equal to 255"); |
---|
2684 | xConfirmPara( m_toneMapModelId < 0 || m_toneMapModelId > 4 , "SEIToneMapModelId must be in rage 0 to 4"); |
---|
2685 | xConfirmPara( m_cameraIsoSpeedValue == 0, "SEIToneMapCameraIsoSpeedValue shall not be equal to 0"); |
---|
2686 | xConfirmPara( m_exposureIndexValue == 0, "SEIToneMapExposureIndexValue shall not be equal to 0"); |
---|
2687 | xConfirmPara( m_extendedRangeWhiteLevel < 100, "SEIToneMapExtendedRangeWhiteLevel should be greater than or equal to 100"); |
---|
2688 | xConfirmPara( m_nominalBlackLevelLumaCodeValue >= m_nominalWhiteLevelLumaCodeValue, "SEIToneMapNominalWhiteLevelLumaCodeValue shall be greater than SEIToneMapNominalBlackLevelLumaCodeValue"); |
---|
2689 | xConfirmPara( m_extendedWhiteLevelLumaCodeValue < m_nominalWhiteLevelLumaCodeValue, "SEIToneMapExtendedWhiteLevelLumaCodeValue shall be greater than or equal to SEIToneMapNominalWhiteLevelLumaCodeValue"); |
---|
2690 | } |
---|
2691 | #if P0050_KNEE_FUNCTION_SEI |
---|
2692 | if (m_kneeSEIEnabled && !m_kneeSEICancelFlag) |
---|
2693 | { |
---|
2694 | xConfirmPara( m_kneeSEINumKneePointsMinus1 < 0 || m_kneeSEINumKneePointsMinus1 > 998, "SEIKneeFunctionNumKneePointsMinus1 must be in the range of 0 to 998"); |
---|
2695 | for ( UInt i=0; i<=m_kneeSEINumKneePointsMinus1; i++ ){ |
---|
2696 | xConfirmPara( m_kneeSEIInputKneePoint[i] < 1 || m_kneeSEIInputKneePoint[i] > 999, "SEIKneeFunctionInputKneePointValue must be in the range of 1 to 999"); |
---|
2697 | xConfirmPara( m_kneeSEIOutputKneePoint[i] < 0 || m_kneeSEIOutputKneePoint[i] > 1000, "SEIKneeFunctionInputKneePointValue must be in the range of 0 to 1000"); |
---|
2698 | if ( i > 0 ) |
---|
2699 | { |
---|
2700 | xConfirmPara( m_kneeSEIInputKneePoint[i-1] >= m_kneeSEIInputKneePoint[i], "The i-th SEIKneeFunctionInputKneePointValue must be greather than the (i-1)-th value"); |
---|
2701 | } |
---|
2702 | } |
---|
2703 | } |
---|
2704 | #endif |
---|
2705 | |
---|
2706 | #if RC_SHVC_HARMONIZATION |
---|
2707 | for ( Int layer=0; layer<m_numLayers; layer++ ) |
---|
2708 | { |
---|
2709 | if ( m_acLayerCfg[layer].m_RCEnableRateControl ) |
---|
2710 | { |
---|
2711 | if ( m_acLayerCfg[layer].m_RCForceIntraQP ) |
---|
2712 | { |
---|
2713 | if ( m_acLayerCfg[layer].m_RCInitialQP == 0 ) |
---|
2714 | { |
---|
2715 | printf( "\nInitial QP for rate control is not specified. Reset not to use force intra QP!" ); |
---|
2716 | m_acLayerCfg[layer].m_RCForceIntraQP = false; |
---|
2717 | } |
---|
2718 | } |
---|
2719 | } |
---|
2720 | xConfirmPara( m_uiDeltaQpRD > 0, "Rate control cannot be used together with slice level multiple-QP optimization!\n" ); |
---|
2721 | } |
---|
2722 | #else |
---|
2723 | if ( m_RCEnableRateControl ) |
---|
2724 | { |
---|
2725 | if ( m_RCForceIntraQP ) |
---|
2726 | { |
---|
2727 | if ( m_RCInitialQP == 0 ) |
---|
2728 | { |
---|
2729 | printf( "\nInitial QP for rate control is not specified. Reset not to use force intra QP!" ); |
---|
2730 | m_RCForceIntraQP = false; |
---|
2731 | } |
---|
2732 | } |
---|
2733 | xConfirmPara( m_uiDeltaQpRD > 0, "Rate control cannot be used together with slice level multiple-QP optimization!\n" ); |
---|
2734 | } |
---|
2735 | #endif |
---|
2736 | |
---|
2737 | xConfirmPara(!m_TransquantBypassEnableFlag && m_CUTransquantBypassFlagForce, "CUTransquantBypassFlagForce cannot be 1 when TransquantBypassEnableFlag is 0"); |
---|
2738 | |
---|
2739 | xConfirmPara(m_log2ParallelMergeLevel < 2, "Log2ParallelMergeLevel should be larger than or equal to 2"); |
---|
2740 | if (m_framePackingSEIEnabled) |
---|
2741 | { |
---|
2742 | xConfirmPara(m_framePackingSEIType < 3 || m_framePackingSEIType > 5 , "SEIFramePackingType must be in rage 3 to 5"); |
---|
2743 | } |
---|
2744 | |
---|
2745 | #if SVC_EXTENSION |
---|
2746 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
2747 | xConfirmPara( (m_acLayerCfg[0].m_numSamplePredRefLayers != 0) && (m_acLayerCfg[0].m_numSamplePredRefLayers != -1), "Layer 0 cannot have any reference layers" ); |
---|
2748 | // 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 |
---|
2749 | for(Int layer = 1; layer < MAX_LAYERS; layer++) |
---|
2750 | { |
---|
2751 | xConfirmPara(m_acLayerCfg[layer].m_numSamplePredRefLayers > layer, "Cannot reference more layers than before current layer"); |
---|
2752 | for(Int i = 0; i < m_acLayerCfg[layer].m_numSamplePredRefLayers; i++) |
---|
2753 | { |
---|
2754 | xConfirmPara(m_acLayerCfg[layer].m_samplePredRefLayerIds[i] > layer, "Cannot reference higher layers"); |
---|
2755 | xConfirmPara(m_acLayerCfg[layer].m_samplePredRefLayerIds[i] == layer, "Cannot reference the current layer itself"); |
---|
2756 | } |
---|
2757 | } |
---|
2758 | xConfirmPara( (m_acLayerCfg[0].m_numMotionPredRefLayers != 0) && (m_acLayerCfg[0].m_numMotionPredRefLayers != -1), "Layer 0 cannot have any reference layers" ); |
---|
2759 | // 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 |
---|
2760 | for(Int layer = 1; layer < MAX_LAYERS; layer++) |
---|
2761 | { |
---|
2762 | xConfirmPara(m_acLayerCfg[layer].m_numMotionPredRefLayers > layer, "Cannot reference more layers than before current layer"); |
---|
2763 | for(Int i = 0; i < m_acLayerCfg[layer].m_numMotionPredRefLayers; i++) |
---|
2764 | { |
---|
2765 | xConfirmPara(m_acLayerCfg[layer].m_motionPredRefLayerIds[i] > layer, "Cannot reference higher layers"); |
---|
2766 | xConfirmPara(m_acLayerCfg[layer].m_motionPredRefLayerIds[i] == layer, "Cannot reference the current layer itself"); |
---|
2767 | } |
---|
2768 | } |
---|
2769 | |
---|
2770 | xConfirmPara( (m_acLayerCfg[0].m_numActiveRefLayers != 0) && (m_acLayerCfg[0].m_numActiveRefLayers != -1), "Layer 0 cannot have any active reference layers" ); |
---|
2771 | // 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 |
---|
2772 | for(Int layer = 1; layer < MAX_LAYERS; layer++) |
---|
2773 | { |
---|
2774 | Bool predEnabledFlag[MAX_LAYERS]; |
---|
2775 | for (Int refLayer = 0; refLayer < layer; refLayer++) |
---|
2776 | { |
---|
2777 | predEnabledFlag[refLayer] = false; |
---|
2778 | } |
---|
2779 | for(Int i = 0; i < m_acLayerCfg[layer].m_numSamplePredRefLayers; i++) |
---|
2780 | { |
---|
2781 | predEnabledFlag[m_acLayerCfg[layer].m_samplePredRefLayerIds[i]] = true; |
---|
2782 | } |
---|
2783 | for(Int i = 0; i < m_acLayerCfg[layer].m_numMotionPredRefLayers; i++) |
---|
2784 | { |
---|
2785 | predEnabledFlag[m_acLayerCfg[layer].m_motionPredRefLayerIds[i]] = true; |
---|
2786 | } |
---|
2787 | Int numDirectRefLayers = 0; |
---|
2788 | for (Int refLayer = 0; refLayer < layer; refLayer++) |
---|
2789 | { |
---|
2790 | if (predEnabledFlag[refLayer] == true) numDirectRefLayers++; |
---|
2791 | } |
---|
2792 | xConfirmPara(m_acLayerCfg[layer].m_numActiveRefLayers > numDirectRefLayers, "Cannot reference more layers than NumDirectRefLayers"); |
---|
2793 | for(Int i = 0; i < m_acLayerCfg[layer].m_numActiveRefLayers; i++) |
---|
2794 | { |
---|
2795 | xConfirmPara(m_acLayerCfg[layer].m_predLayerIds[i] >= numDirectRefLayers, "Cannot reference higher layers"); |
---|
2796 | } |
---|
2797 | } |
---|
2798 | #endif //VPS_EXTN_DIRECT_REF_LAYERS |
---|
2799 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
2800 | if (m_adaptiveResolutionChange > 0) |
---|
2801 | { |
---|
2802 | xConfirmPara(m_numLayers != 2, "Adaptive resolution change works with 2 layers only"); |
---|
2803 | 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"); |
---|
2804 | } |
---|
2805 | #endif |
---|
2806 | #if HIGHER_LAYER_IRAP_SKIP_FLAG |
---|
2807 | if (m_adaptiveResolutionChange > 0) |
---|
2808 | { |
---|
2809 | xConfirmPara(m_crossLayerIrapAlignFlag != 0, "Cross layer IRAP alignment must be disabled when using adaptive resolution change."); |
---|
2810 | } |
---|
2811 | if (m_skipPictureAtArcSwitch) |
---|
2812 | { |
---|
2813 | xConfirmPara(m_adaptiveResolutionChange <= 0, "Skip picture at ARC switching only works when Adaptive Resolution Change is active (AdaptiveResolutionChange > 0)"); |
---|
2814 | } |
---|
2815 | #endif |
---|
2816 | for (UInt layer=0; layer < MAX_LAYERS-1; layer++) |
---|
2817 | { |
---|
2818 | xConfirmPara(m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1 < 0 || m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1 > 7, "MaxTidIlRefPicsPlus1 must be in range 0 to 7"); |
---|
2819 | } |
---|
2820 | #if AUXILIARY_PICTURES |
---|
2821 | for (UInt layer=0; layer < MAX_LAYERS-1; layer++) |
---|
2822 | { |
---|
2823 | xConfirmPara(m_acLayerCfg[layer].m_auxId < 0 || m_acLayerCfg[layer].m_auxId > 4, "AuxId must be in range 0 to 4"); |
---|
2824 | xConfirmPara(m_acLayerCfg[layer].m_auxId > 0 && m_acLayerCfg[layer].m_chromaFormatIDC != CHROMA_400, "Auxiliary picture must be monochrome picture"); |
---|
2825 | } |
---|
2826 | #endif |
---|
2827 | #if Q0048_CGS_3D_ASYMLUT |
---|
2828 | xConfirmPara( m_nCGSFlag < 0 || m_nCGSFlag > 1 , "0<=CGS<=1" ); |
---|
2829 | #endif |
---|
2830 | #endif //SVC_EXTENSION |
---|
2831 | #undef xConfirmPara |
---|
2832 | if (check_failed) |
---|
2833 | { |
---|
2834 | exit(EXIT_FAILURE); |
---|
2835 | } |
---|
2836 | } |
---|
2837 | |
---|
2838 | /** \todo use of global variables should be removed later |
---|
2839 | */ |
---|
2840 | #if LAYER_CTB |
---|
2841 | Void TAppEncCfg::xSetGlobal(UInt layerId) |
---|
2842 | { |
---|
2843 | // set max CU width & height |
---|
2844 | g_auiLayerMaxCUWidth[layerId] = m_acLayerCfg[layerId].m_uiMaxCUWidth; |
---|
2845 | g_auiLayerMaxCUHeight[layerId] = m_acLayerCfg[layerId].m_uiMaxCUHeight; |
---|
2846 | |
---|
2847 | // compute actual CU depth with respect to config depth and max transform size |
---|
2848 | g_auiLayerAddCUDepth[layerId] = 0; |
---|
2849 | while( (m_acLayerCfg[layerId].m_uiMaxCUWidth>>m_acLayerCfg[layerId].m_uiMaxCUDepth) > ( 1 << ( m_acLayerCfg[layerId].m_uiQuadtreeTULog2MinSize + g_auiLayerAddCUDepth[layerId] ) ) ) g_auiLayerAddCUDepth[layerId]++; |
---|
2850 | |
---|
2851 | m_acLayerCfg[layerId].m_uiMaxCUDepth += g_auiLayerAddCUDepth[layerId]; |
---|
2852 | g_auiLayerAddCUDepth[layerId]++; |
---|
2853 | g_auiLayerMaxCUDepth[layerId] = m_acLayerCfg[layerId].m_uiMaxCUDepth; |
---|
2854 | |
---|
2855 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
2856 | // set internal bit-depth to constant value to make sure to be updated later |
---|
2857 | g_bitDepthY = -1; |
---|
2858 | g_bitDepthC = -1; |
---|
2859 | |
---|
2860 | g_uiPCMBitDepthLuma = -1; |
---|
2861 | g_uiPCMBitDepthChroma = -1; |
---|
2862 | #else |
---|
2863 | // set internal bit-depth and constants |
---|
2864 | g_bitDepthY = m_internalBitDepthY; |
---|
2865 | g_bitDepthC = m_internalBitDepthC; |
---|
2866 | |
---|
2867 | g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_inputBitDepthY : m_internalBitDepthY; |
---|
2868 | g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_inputBitDepthC : m_internalBitDepthC; |
---|
2869 | #endif |
---|
2870 | } |
---|
2871 | #else |
---|
2872 | Void TAppEncCfg::xSetGlobal() |
---|
2873 | { |
---|
2874 | // set max CU width & height |
---|
2875 | g_uiMaxCUWidth = m_uiMaxCUWidth; |
---|
2876 | g_uiMaxCUHeight = m_uiMaxCUHeight; |
---|
2877 | |
---|
2878 | // compute actual CU depth with respect to config depth and max transform size |
---|
2879 | g_uiAddCUDepth = 0; |
---|
2880 | while( (m_uiMaxCUWidth>>m_uiMaxCUDepth) > ( 1 << ( m_uiQuadtreeTULog2MinSize + g_uiAddCUDepth ) ) ) g_uiAddCUDepth++; |
---|
2881 | |
---|
2882 | m_uiMaxCUDepth += g_uiAddCUDepth; |
---|
2883 | g_uiAddCUDepth++; |
---|
2884 | g_uiMaxCUDepth = m_uiMaxCUDepth; |
---|
2885 | |
---|
2886 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
2887 | // set internal bit-depth to constant value to make sure to be updated later |
---|
2888 | g_bitDepthY = -1; |
---|
2889 | g_bitDepthC = -1; |
---|
2890 | |
---|
2891 | g_uiPCMBitDepthLuma = -1; |
---|
2892 | g_uiPCMBitDepthChroma = -1; |
---|
2893 | #else |
---|
2894 | g_bitDepthY = m_internalBitDepthY; |
---|
2895 | g_bitDepthC = m_internalBitDepthC; |
---|
2896 | |
---|
2897 | g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_inputBitDepthY : m_internalBitDepthY; |
---|
2898 | g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_inputBitDepthC : m_internalBitDepthC; |
---|
2899 | #endif |
---|
2900 | } |
---|
2901 | #endif |
---|
2902 | |
---|
2903 | Void TAppEncCfg::xPrintParameter() |
---|
2904 | { |
---|
2905 | printf("\n"); |
---|
2906 | #if SVC_EXTENSION |
---|
2907 | printf("Total number of layers : %d\n", m_numLayers ); |
---|
2908 | printf("Multiview : %d\n", m_scalabilityMask[VIEW_ORDER_INDEX] ); |
---|
2909 | printf("Scalable : %d\n", m_scalabilityMask[SCALABILITY_ID] ); |
---|
2910 | #if AVC_BASE |
---|
2911 | printf("Base layer : %s\n", m_avcBaseLayerFlag ? "AVC" : "HEVC"); |
---|
2912 | #endif |
---|
2913 | #if AUXILIARY_PICTURES |
---|
2914 | printf("Auxiliary pictures : %d\n", m_scalabilityMask[AUX_ID] ); |
---|
2915 | #endif |
---|
2916 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
2917 | printf("Adaptive Resolution Change : %d\n", m_adaptiveResolutionChange ); |
---|
2918 | #endif |
---|
2919 | #if HIGHER_LAYER_IRAP_SKIP_FLAG |
---|
2920 | printf("Skip picture at ARC switch : %d\n", m_skipPictureAtArcSwitch ); |
---|
2921 | #endif |
---|
2922 | #if O0223_PICTURE_TYPES_ALIGN_FLAG |
---|
2923 | printf("Align picture type : %d\n", m_crossLayerPictureTypeAlignFlag ); |
---|
2924 | #endif |
---|
2925 | printf("Cross layer IRAP alignment : %d\n", m_crossLayerIrapAlignFlag ); |
---|
2926 | #if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG |
---|
2927 | printf("IDR only for IRAP : %d\n", m_crossLayerAlignedIdrOnlyFlag ); |
---|
2928 | #endif |
---|
2929 | #if O0194_WEIGHTED_PREDICTION_CGS |
---|
2930 | printf("InterLayerWeightedPred : %d\n", m_useInterLayerWeightedPred ); |
---|
2931 | #endif |
---|
2932 | for(UInt layer=0; layer<m_numLayers; layer++) |
---|
2933 | { |
---|
2934 | printf("=== Layer %d settings === \n", layer); |
---|
2935 | #if AVC_SYNTAX |
---|
2936 | m_acLayerCfg[layer].xPrintParameter( layer ); |
---|
2937 | #else |
---|
2938 | m_acLayerCfg[layer].xPrintParameter(); |
---|
2939 | #endif |
---|
2940 | printf("\n"); |
---|
2941 | } |
---|
2942 | printf("=== Common configuration settings === \n"); |
---|
2943 | printf("Bitstream File : %s\n", m_pBitstreamFile ); |
---|
2944 | #else |
---|
2945 | printf("Input File : %s\n", m_pchInputFile ); |
---|
2946 | printf("Bitstream File : %s\n", m_pchBitstreamFile ); |
---|
2947 | printf("Reconstruction File : %s\n", m_pchReconFile ); |
---|
2948 | printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_confLeft - m_confRight, m_iSourceHeight - m_confTop - m_confBottom, m_iFrameRate ); |
---|
2949 | printf("Internal Format : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate ); |
---|
2950 | #endif |
---|
2951 | if (m_isField) |
---|
2952 | { |
---|
2953 | printf("Frame/Field : Field based coding\n"); |
---|
2954 | printf("Field index : %u - %d (%d fields)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded ); |
---|
2955 | if (m_isTopFieldFirst) |
---|
2956 | { |
---|
2957 | printf("Field Order : Top field first\n"); |
---|
2958 | } |
---|
2959 | else |
---|
2960 | { |
---|
2961 | printf("Field Order : Bottom field first\n"); |
---|
2962 | } |
---|
2963 | } |
---|
2964 | else |
---|
2965 | { |
---|
2966 | printf("Frame/Field : Frame based coding\n"); |
---|
2967 | printf("Frame index : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded ); |
---|
2968 | } |
---|
2969 | #if !LAYER_CTB |
---|
2970 | printf("CU size / depth : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth ); |
---|
2971 | printf("RQT trans. size (min / max) : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize ); |
---|
2972 | printf("Max RQT depth inter : %d\n", m_uiQuadtreeTUMaxDepthInter); |
---|
2973 | printf("Max RQT depth intra : %d\n", m_uiQuadtreeTUMaxDepthIntra); |
---|
2974 | #endif |
---|
2975 | printf("Min PCM size : %d\n", 1 << m_uiPCMLog2MinSize); |
---|
2976 | printf("Motion search range : %d\n", m_iSearchRange ); |
---|
2977 | #if !SVC_EXTENSION |
---|
2978 | printf("Intra period : %d\n", m_iIntraPeriod ); |
---|
2979 | #endif |
---|
2980 | printf("Decoding refresh type : %d\n", m_iDecodingRefreshType ); |
---|
2981 | #if !SVC_EXTENSION |
---|
2982 | printf("QP : %5.2f\n", m_fQP ); |
---|
2983 | #endif |
---|
2984 | printf("Max dQP signaling depth : %d\n", m_iMaxCuDQPDepth); |
---|
2985 | |
---|
2986 | printf("Cb QP Offset : %d\n", m_cbQpOffset ); |
---|
2987 | printf("Cr QP Offset : %d\n", m_crQpOffset); |
---|
2988 | |
---|
2989 | printf("QP adaptation : %d (range=%d)\n", m_bUseAdaptiveQP, (m_bUseAdaptiveQP ? m_iQPAdaptationRange : 0) ); |
---|
2990 | printf("GOP size : %d\n", m_iGOPSize ); |
---|
2991 | #if !O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
2992 | printf("Internal bit depth : (Y:%d, C:%d)\n", m_internalBitDepthY, m_internalBitDepthC ); |
---|
2993 | printf("PCM sample bit depth : (Y:%d, C:%d)\n", g_uiPCMBitDepthLuma, g_uiPCMBitDepthChroma ); |
---|
2994 | #endif |
---|
2995 | #if O0215_PHASE_ALIGNMENT |
---|
2996 | printf("Cross-layer sample alignment : %d\n", m_phaseAlignFlag); |
---|
2997 | #endif |
---|
2998 | #if !RC_SHVC_HARMONIZATION |
---|
2999 | printf("RateControl : %d\n", m_RCEnableRateControl ); |
---|
3000 | if(m_RCEnableRateControl) |
---|
3001 | { |
---|
3002 | printf("TargetBitrate : %d\n", m_RCTargetBitrate ); |
---|
3003 | printf("KeepHierarchicalBit : %d\n", m_RCKeepHierarchicalBit ); |
---|
3004 | printf("LCULevelRC : %d\n", m_RCLCULevelRC ); |
---|
3005 | printf("UseLCUSeparateModel : %d\n", m_RCUseLCUSeparateModel ); |
---|
3006 | printf("InitialQP : %d\n", m_RCInitialQP ); |
---|
3007 | printf("ForceIntraQP : %d\n", m_RCForceIntraQP ); |
---|
3008 | } |
---|
3009 | #endif |
---|
3010 | |
---|
3011 | printf("Max Num Merge Candidates : %d\n", m_maxNumMergeCand); |
---|
3012 | printf("\n"); |
---|
3013 | |
---|
3014 | printf("TOOL CFG: "); |
---|
3015 | #if !O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
3016 | printf("IBD:%d ", g_bitDepthY > m_inputBitDepthY || g_bitDepthC > m_inputBitDepthC); |
---|
3017 | #endif |
---|
3018 | printf("HAD:%d ", m_bUseHADME ); |
---|
3019 | printf("RDQ:%d ", m_useRDOQ ); |
---|
3020 | printf("RDQTS:%d ", m_useRDOQTS ); |
---|
3021 | printf("RDpenalty:%d ", m_rdPenalty ); |
---|
3022 | printf("SQP:%d ", m_uiDeltaQpRD ); |
---|
3023 | printf("ASR:%d ", m_bUseASR ); |
---|
3024 | printf("FEN:%d ", m_bUseFastEnc ); |
---|
3025 | printf("ECU:%d ", m_bUseEarlyCU ); |
---|
3026 | printf("FDM:%d ", m_useFastDecisionForMerge ); |
---|
3027 | printf("CFM:%d ", m_bUseCbfFastMode ); |
---|
3028 | printf("ESD:%d ", m_useEarlySkipDetection ); |
---|
3029 | #if FAST_INTRA_SHVC |
---|
3030 | printf("FIS:%d ", m_useFastIntraScalable ); |
---|
3031 | #endif |
---|
3032 | printf("RQT:%d ", 1 ); |
---|
3033 | printf("TransformSkip:%d ", m_useTransformSkip ); |
---|
3034 | printf("TransformSkipFast:%d ", m_useTransformSkipFast ); |
---|
3035 | printf("Slice: M=%d ", m_sliceMode); |
---|
3036 | if (m_sliceMode!=0) |
---|
3037 | { |
---|
3038 | printf("A=%d ", m_sliceArgument); |
---|
3039 | } |
---|
3040 | printf("SliceSegment: M=%d ",m_sliceSegmentMode); |
---|
3041 | if (m_sliceSegmentMode!=0) |
---|
3042 | { |
---|
3043 | printf("A=%d ", m_sliceSegmentArgument); |
---|
3044 | } |
---|
3045 | printf("CIP:%d ", m_bUseConstrainedIntraPred); |
---|
3046 | printf("SAO:%d ", (m_bUseSAO)?(1):(0)); |
---|
3047 | #if !LAYER_CTB |
---|
3048 | printf("PCM:%d ", (m_usePCM && (1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0); |
---|
3049 | #endif |
---|
3050 | if (m_TransquantBypassEnableFlag && m_CUTransquantBypassFlagForce) |
---|
3051 | { |
---|
3052 | printf("TransQuantBypassEnabled: =1 "); |
---|
3053 | } |
---|
3054 | else |
---|
3055 | { |
---|
3056 | printf("TransQuantBypassEnabled:%d ", (m_TransquantBypassEnableFlag)? 1:0 ); |
---|
3057 | } |
---|
3058 | printf("WPP:%d ", (Int)m_useWeightedPred); |
---|
3059 | printf("WPB:%d ", (Int)m_useWeightedBiPred); |
---|
3060 | printf("PME:%d ", m_log2ParallelMergeLevel); |
---|
3061 | #if !SVC_EXTENSION |
---|
3062 | printf(" WaveFrontSynchro:%d WaveFrontSubstreams:%d", |
---|
3063 | m_iWaveFrontSynchro, m_iWaveFrontSubstreams); |
---|
3064 | #endif |
---|
3065 | printf(" ScalingList:%d ", m_useScalingListId ); |
---|
3066 | printf("TMVPMode:%d ", m_TMVPModeId ); |
---|
3067 | #if ADAPTIVE_QP_SELECTION |
---|
3068 | printf("AQpS:%d", m_bUseAdaptQpSelect ); |
---|
3069 | #endif |
---|
3070 | |
---|
3071 | printf(" SignBitHidingFlag:%d ", m_signHideFlag); |
---|
3072 | #if SVC_EXTENSION |
---|
3073 | printf("RecalQP:%d ", m_recalculateQPAccordingToLambda ? 1 : 0 ); |
---|
3074 | printf("EL_RAP_SliceType: %d ", m_elRapSliceBEnabled); |
---|
3075 | printf("REF_IDX_ME_ZEROMV: %d ", REF_IDX_ME_ZEROMV); |
---|
3076 | printf("ENCODER_FAST_MODE: %d ", ENCODER_FAST_MODE); |
---|
3077 | printf("REF_IDX_MFM: %d ", REF_IDX_MFM); |
---|
3078 | printf("O0194_DIFFERENT_BITDEPTH_EL_BL: %d ", O0194_DIFFERENT_BITDEPTH_EL_BL); |
---|
3079 | printf("O0194_JOINT_US_BITSHIFT: %d ", O0194_JOINT_US_BITSHIFT); |
---|
3080 | #else |
---|
3081 | printf("RecalQP:%d", m_recalculateQPAccordingToLambda ? 1 : 0 ); |
---|
3082 | #endif |
---|
3083 | #if Q0048_CGS_3D_ASYMLUT |
---|
3084 | printf("CGS: %d CGSMaxOctantDepth: %d CGSMaxYPartNumLog2: %d CGSLUTBit:%d " , m_nCGSFlag , m_nCGSMaxOctantDepth , m_nCGSMaxYPartNumLog2 , m_nCGSLUTBit ); |
---|
3085 | #endif |
---|
3086 | printf("\n\n"); |
---|
3087 | |
---|
3088 | fflush(stdout); |
---|
3089 | } |
---|
3090 | |
---|
3091 | Bool confirmPara(Bool bflag, const Char* message) |
---|
3092 | { |
---|
3093 | if (!bflag) |
---|
3094 | return false; |
---|
3095 | |
---|
3096 | printf("Error: %s\n",message); |
---|
3097 | return true; |
---|
3098 | } |
---|
3099 | |
---|
3100 | #if SVC_EXTENSION |
---|
3101 | Void TAppEncCfg::cfgStringToArray(Int **arr, string cfgString, Int numEntries, const char* logString) |
---|
3102 | { |
---|
3103 | Char *tempChar = cfgString.empty() ? NULL : strdup(cfgString.c_str()); |
---|
3104 | if( numEntries > 0 ) |
---|
3105 | { |
---|
3106 | Char *arrayEntry; |
---|
3107 | Int i = 0; |
---|
3108 | *arr = new Int[numEntries]; |
---|
3109 | |
---|
3110 | arrayEntry = strtok( tempChar, " ,"); |
---|
3111 | while(arrayEntry != NULL) |
---|
3112 | { |
---|
3113 | if( i >= numEntries ) |
---|
3114 | { |
---|
3115 | printf( "%s: The number of entries specified is larger than the allowed number.\n", logString ); |
---|
3116 | exit( EXIT_FAILURE ); |
---|
3117 | } |
---|
3118 | *( *arr + i ) = atoi( arrayEntry ); |
---|
3119 | arrayEntry = strtok(NULL, " ,"); |
---|
3120 | i++; |
---|
3121 | } |
---|
3122 | if( i < numEntries ) |
---|
3123 | { |
---|
3124 | printf( "%s: Some entries are not specified.\n", logString ); |
---|
3125 | exit( EXIT_FAILURE ); |
---|
3126 | } |
---|
3127 | } |
---|
3128 | else |
---|
3129 | { |
---|
3130 | *arr = NULL; |
---|
3131 | } |
---|
3132 | } |
---|
3133 | |
---|
3134 | #endif //SVC_EXTENSION |
---|
3135 | //! \} |
---|