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