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