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