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-2012, 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 | #include "TAppCommon/program_options_lite.h" |
---|
45 | |
---|
46 | #ifdef WIN32 |
---|
47 | #define strdup _strdup |
---|
48 | #endif |
---|
49 | |
---|
50 | using namespace std; |
---|
51 | namespace po = df::program_options_lite; |
---|
52 | |
---|
53 | //! \ingroup TAppEncoder |
---|
54 | //! \{ |
---|
55 | |
---|
56 | /* configuration helper funcs */ |
---|
57 | void doOldStyleCmdlineOn(po::Options& opts, const std::string& arg); |
---|
58 | void doOldStyleCmdlineOff(po::Options& opts, const std::string& arg); |
---|
59 | |
---|
60 | // ==================================================================================================================== |
---|
61 | // Local constants |
---|
62 | // ==================================================================================================================== |
---|
63 | |
---|
64 | /// max value of source padding size |
---|
65 | /** \todo replace it by command line option |
---|
66 | */ |
---|
67 | #define MAX_PAD_SIZE 16 |
---|
68 | |
---|
69 | // ==================================================================================================================== |
---|
70 | // Constructor / destructor / initialization / destroy |
---|
71 | // ==================================================================================================================== |
---|
72 | |
---|
73 | TAppEncCfg::TAppEncCfg() |
---|
74 | { |
---|
75 | m_aidQP = NULL; |
---|
76 | #if FIXES |
---|
77 | m_aidQPdepth = NULL; |
---|
78 | #endif |
---|
79 | } |
---|
80 | |
---|
81 | TAppEncCfg::~TAppEncCfg() |
---|
82 | { |
---|
83 | if ( m_aidQP ) |
---|
84 | { |
---|
85 | delete[] m_aidQP; m_aidQP = NULL; |
---|
86 | } |
---|
87 | |
---|
88 | #if FIXES |
---|
89 | if ( m_aidQPdepth ) |
---|
90 | { |
---|
91 | delete[] m_aidQPdepth; m_aidQPdepth = NULL; |
---|
92 | } |
---|
93 | #endif |
---|
94 | |
---|
95 | for(Int i = 0; i< m_pchInputFileList.size(); i++ ) |
---|
96 | { |
---|
97 | if ( m_pchInputFileList[i] != NULL ) |
---|
98 | free (m_pchInputFileList[i]); |
---|
99 | } |
---|
100 | for(Int i = 0; i< m_pchDepthInputFileList.size(); i++ ) |
---|
101 | { |
---|
102 | if ( m_pchDepthInputFileList[i] != NULL ) |
---|
103 | free (m_pchDepthInputFileList[i]); |
---|
104 | } |
---|
105 | for(Int i = 0; i< m_pchReconFileList.size(); i++ ) |
---|
106 | { |
---|
107 | if ( m_pchReconFileList[i] != NULL ) |
---|
108 | free (m_pchReconFileList[i]); |
---|
109 | } |
---|
110 | for(Int i = 0; i< m_pchDepthReconFileList.size(); i++ ) |
---|
111 | { |
---|
112 | if ( m_pchDepthReconFileList[i] != NULL ) |
---|
113 | free (m_pchDepthReconFileList[i]); |
---|
114 | } |
---|
115 | if (m_pchBitstreamFile != NULL) |
---|
116 | free (m_pchBitstreamFile) ; |
---|
117 | #if HHI_VSO |
---|
118 | if ( m_pchVSOConfig != NULL) |
---|
119 | free ( m_pchVSOConfig ); |
---|
120 | #endif |
---|
121 | |
---|
122 | } |
---|
123 | |
---|
124 | Void TAppEncCfg::create() |
---|
125 | { |
---|
126 | } |
---|
127 | |
---|
128 | Void TAppEncCfg::destroy() |
---|
129 | { |
---|
130 | } |
---|
131 | |
---|
132 | std::istringstream &operator>>( std::istringstream &in, GOPEntryMvc &entry ) //input |
---|
133 | { |
---|
134 | in>>entry.m_sliceType; |
---|
135 | in>>entry.m_POC; |
---|
136 | in>>entry.m_QPOffset; |
---|
137 | in>>entry.m_QPFactor; |
---|
138 | in>>entry.m_temporalId; |
---|
139 | in>>entry.m_numRefPicsActive; |
---|
140 | in>>entry.m_refPic; |
---|
141 | in>>entry.m_numRefPics; |
---|
142 | for ( Int i = 0; i < entry.m_numRefPics; i++ ) |
---|
143 | { |
---|
144 | in>>entry.m_referencePics[i]; |
---|
145 | } |
---|
146 | in>>entry.m_interRPSPrediction; |
---|
147 | if (entry.m_interRPSPrediction) |
---|
148 | { |
---|
149 | in>>entry.m_deltaRIdxMinus1; |
---|
150 | in>>entry.m_deltaRPS; |
---|
151 | in>>entry.m_numRefIdc; |
---|
152 | for ( Int i = 0; i < entry.m_numRefIdc; i++ ) |
---|
153 | { |
---|
154 | in>>entry.m_refIdc[i]; |
---|
155 | } |
---|
156 | } |
---|
157 | in>>entry.m_numInterViewRefPics; |
---|
158 | for( Int i = 0; i < entry.m_numInterViewRefPics; i++ ) |
---|
159 | { |
---|
160 | in>>entry.m_interViewRefs[i]; |
---|
161 | } |
---|
162 | for( Int i = 0; i < entry.m_numInterViewRefPics; i++ ) |
---|
163 | { |
---|
164 | in>>entry.m_interViewRefPosL0[i]; |
---|
165 | } |
---|
166 | for( Int i = 0; i < entry.m_numInterViewRefPics; i++ ) |
---|
167 | { |
---|
168 | in>>entry.m_interViewRefPosL1[i]; |
---|
169 | } |
---|
170 | return in; |
---|
171 | } |
---|
172 | |
---|
173 | // ==================================================================================================================== |
---|
174 | // Public member functions |
---|
175 | // ==================================================================================================================== |
---|
176 | |
---|
177 | /** \param argc number of arguments |
---|
178 | \param argv array of arguments |
---|
179 | \retval true when success |
---|
180 | */ |
---|
181 | Bool TAppEncCfg::parseCfg( Int argc, Char* argv[] ) |
---|
182 | { |
---|
183 | bool do_help = false; |
---|
184 | |
---|
185 | string cfg_BitstreamFile; |
---|
186 | string cfg_dQPFile; |
---|
187 | string cfg_ColumnWidth; |
---|
188 | string cfg_RowHeight; |
---|
189 | string cfg_ScalingListFile; |
---|
190 | po::Options opts; |
---|
191 | opts.addOptions() |
---|
192 | ("help", do_help, false, "this help text") |
---|
193 | ("c", po::parseConfigFile, "configuration file name") |
---|
194 | |
---|
195 | /* File, I/O and source parameters */ |
---|
196 | ("InputFile_%d,i_%d", m_pchInputFileList, (char *) 0 , MAX_VIEW_NUM , "original Yuv input file name %d") |
---|
197 | ("DepthInputFile_%d,di_%d", m_pchDepthInputFileList, (char *) 0 , MAX_VIEW_NUM , "original Yuv depth input file name %d") |
---|
198 | ("ReconFile_%d,o_%d", m_pchReconFileList, (char *) 0 , MAX_VIEW_NUM , "reconstructed Yuv output file name %d") |
---|
199 | ("DepthReconFile_%d,do_%d", m_pchDepthReconFileList, (char *) 0 , MAX_VIEW_NUM , "reconstructed Yuv depth output file name %d") |
---|
200 | ("BitstreamFile,b", cfg_BitstreamFile, string(""), "bitstream output file name") |
---|
201 | ("CodeDepthMaps", m_bUsingDepthMaps, false, "Encode depth maps" ) |
---|
202 | ("CodedCamParsPrecision", m_iCodedCamParPrecision, STD_CAM_PARAMETERS_PRECISION, "precision for coding of camera parameters (in units of 2^(-x) luma samples)" ) |
---|
203 | ("LambdaModifier0,-LM0", m_adLambdaModifier[ 0 ], ( double )1.0, "Lambda modifier for temporal layer 0") |
---|
204 | ("LambdaModifier1,-LM1", m_adLambdaModifier[ 1 ], ( double )1.0, "Lambda modifier for temporal layer 1") |
---|
205 | ("LambdaModifier2,-LM2", m_adLambdaModifier[ 2 ], ( double )1.0, "Lambda modifier for temporal layer 2") |
---|
206 | ("LambdaModifier3,-LM3", m_adLambdaModifier[ 3 ], ( double )1.0, "Lambda modifier for temporal layer 3") |
---|
207 | ("SourceWidth,-wdt", m_iSourceWidth, 0, "Source picture width") |
---|
208 | ("SourceHeight,-hgt", m_iSourceHeight, 0, "Source picture height") |
---|
209 | #if PIC_CROPPING |
---|
210 | ("CroppingMode", m_croppingMode, 0, "Cropping mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping") |
---|
211 | ("CropLeft", m_cropLeft, 0, "Left cropping/padding for cropping mode 3") |
---|
212 | ("CropRight", m_cropRight, 0, "Right cropping/padding for cropping mode 3") |
---|
213 | ("CropTop", m_cropTop, 0, "Top cropping/padding for cropping mode 3") |
---|
214 | ("CropBottom", m_cropBottom, 0, "Bottom cropping/padding for cropping mode 3") |
---|
215 | ("HorizontalPadding,-pdx",m_aiPad[0], 0, "horizontal source padding for cropping mode 2") |
---|
216 | ("VerticalPadding,-pdy", m_aiPad[1], 0, "vertical source padding for cropping mode 2") |
---|
217 | #endif |
---|
218 | ("InputBitDepth", m_uiInputBitDepth, 8u, "bit-depth of input file") |
---|
219 | ("BitDepth", m_uiInputBitDepth, 8u, "deprecated alias of InputBitDepth") |
---|
220 | ("OutputBitDepth", m_uiOutputBitDepth, 0u, "bit-depth of output file") |
---|
221 | ("InternalBitDepth", m_uiInternalBitDepth, 0u, "Internal bit-depth (BitDepth+BitIncrement)") |
---|
222 | #if !PIC_CROPPING |
---|
223 | ("HorizontalPadding,-pdx",m_aiPad[0], 0, "horizontal source padding size") |
---|
224 | ("VerticalPadding,-pdy", m_aiPad[1], 0, "vertical source padding size") |
---|
225 | ("PAD", m_bUsePAD, false, "automatic source padding of multiple of 16" ) |
---|
226 | #endif |
---|
227 | ("FrameRate,-fr", m_iFrameRate, 0, "Frame rate") |
---|
228 | ("FrameSkip,-fs", m_FrameSkip, 0u, "Number of frames to skip at start of input YUV") |
---|
229 | ("FramesToBeEncoded,f", m_iFrameToBeEncoded, 0, "number of frames to be encoded (default=all)") |
---|
230 | ("FrameToBeEncoded", m_iFrameToBeEncoded, 0, "depricated alias of FramesToBeEncoded") |
---|
231 | |
---|
232 | ("NumberOfViews", m_iNumberOfViews, 0, "Number of views") |
---|
233 | /* Unit definition parameters */ |
---|
234 | ("MaxCUWidth", m_uiMaxCUWidth, 64u) |
---|
235 | ("MaxCUHeight", m_uiMaxCUHeight, 64u) |
---|
236 | /* todo: remove defaults from MaxCUSize */ |
---|
237 | ("MaxCUSize,s", m_uiMaxCUWidth, 64u, "max CU size") |
---|
238 | ("MaxCUSize,s", m_uiMaxCUHeight, 64u, "max CU size") |
---|
239 | ("MaxPartitionDepth,h", m_uiMaxCUDepth, 4u, "CU depth") |
---|
240 | |
---|
241 | ("QuadtreeTULog2MaxSize", m_uiQuadtreeTULog2MaxSize, 6u) |
---|
242 | ("QuadtreeTULog2MinSize", m_uiQuadtreeTULog2MinSize, 2u) |
---|
243 | |
---|
244 | ("QuadtreeTUMaxDepthIntra", m_uiQuadtreeTUMaxDepthIntra, 1u) |
---|
245 | ("QuadtreeTUMaxDepthInter", m_uiQuadtreeTUMaxDepthInter, 2u) |
---|
246 | |
---|
247 | /* Coding structure paramters */ |
---|
248 | ("IntraPeriod,-ip",m_iIntraPeriod, -1, "intra period in frames, (-1: only first frame)") |
---|
249 | ("DecodingRefreshType,-dr",m_iDecodingRefreshType, 0, "intra refresh, (0:none 1:CRA 2:IDR)") |
---|
250 | ("GOPSize,g", m_iGOPSize, 1, "GOP size of temporal structure") |
---|
251 | #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER |
---|
252 | ("MaxNumberOfReorderPictures", m_numReorderFrames, -1, "Max. number of reorder pictures: -1: encoder determines value, >=0: set explicitly") |
---|
253 | ("MaxNumberOfReferencePictures", m_maxNumberOfReferencePictures, 6, "Max. number of reference pictures") |
---|
254 | #endif |
---|
255 | ("ListCombination,-lc", m_bUseLComb, true, "combined reference list flag for uni-prediction in B-slices") |
---|
256 | ("LCModification", m_bLCMod, false, "enables signalling of combined reference list derivation") |
---|
257 | ("DisableInter4x4", m_bDisInter4x4, true, "Disable Inter 4x4") |
---|
258 | ("NSQT", m_enableNSQT, true, "Enable non-square transforms") |
---|
259 | ("AMP", m_enableAMP, true, "Enable asymmetric motion partitions") |
---|
260 | /* motion options */ |
---|
261 | ("FastSearch", m_iFastSearch, 1, "0:Full search 1:Diamond 2:PMVFAST") |
---|
262 | ("SearchRange,-sr",m_iSearchRange, 96, "motion search range") |
---|
263 | ("BipredSearchRange", m_bipredSearchRange, 4, "motion search range for bipred refinement") |
---|
264 | ("HadamardME", m_bUseHADME, true, "hadamard ME for fractional-pel") |
---|
265 | ("ASR", m_bUseASR, false, "adaptive motion search range") |
---|
266 | |
---|
267 | /* Quantization parameters */ |
---|
268 | ("QP,q", m_adQP, std::vector<double>(1,32), "Qp value, if value is float, QP is switched once during encoding, if two values are given the second is used for depth") |
---|
269 | ("DeltaQpRD,-dqr",m_uiDeltaQpRD, 0u, "max dQp offset for slice") |
---|
270 | ("MaxDeltaQP,d", m_iMaxDeltaQP, 0, "max dQp offset for block") |
---|
271 | ("MaxCuDQPDepth,-dqd", m_iMaxCuDQPDepth, 0, "max depth for a minimum CuDQP") |
---|
272 | |
---|
273 | ("ChromaQpOffset, -cqo", m_iChromaQpOffset, 0, "ChromaQpOffset") |
---|
274 | ("ChromaQpOffset2nd,-cqo2", m_iChromaQpOffset2nd, 0, "ChromaQpOffset2nd") |
---|
275 | |
---|
276 | #if ADAPTIVE_QP_SELECTION |
---|
277 | ("AdaptiveQpSelection,-aqps", m_bUseAdaptQpSelect, false, "AdaptiveQpSelection") |
---|
278 | #endif |
---|
279 | |
---|
280 | ("AdaptiveQP,-aq", m_bUseAdaptiveQP, false, "QP adaptation based on a psycho-visual model") |
---|
281 | ("MaxQPAdaptationRange,-aqr", m_iQPAdaptationRange, 6, "QP adaptation range") |
---|
282 | ("dQPFile,m", cfg_dQPFile, string(""), "dQP file name") |
---|
283 | ("RDOQ", m_abUseRDOQ, std::vector<Bool>(1,true), "Enable RDOQ") |
---|
284 | ("TemporalLayerQPOffset_L0,-tq0", m_aiTLayerQPOffset[0], MAX_QP + 1, "QP offset of temporal layer 0") |
---|
285 | ("TemporalLayerQPOffset_L1,-tq1", m_aiTLayerQPOffset[1], MAX_QP + 1, "QP offset of temporal layer 1") |
---|
286 | ("TemporalLayerQPOffset_L2,-tq2", m_aiTLayerQPOffset[2], MAX_QP + 1, "QP offset of temporal layer 2") |
---|
287 | ("TemporalLayerQPOffset_L3,-tq3", m_aiTLayerQPOffset[3], MAX_QP + 1, "QP offset of temporal layer 3") |
---|
288 | |
---|
289 | #if !H0566_TLA |
---|
290 | ("TLayeringBasedOnCodingStruct,-tl", m_bTLayering, false, "Temporal ID is set based on the hierarchical coding structure") |
---|
291 | |
---|
292 | ("TLayerSwitchingFlag_L0,-ts0", m_abTLayerSwitchingFlag[0], false, "Switching flag for temporal layer 0") |
---|
293 | ("TLayerSwitchingFlag_L1,-ts1", m_abTLayerSwitchingFlag[1], false, "Switching flag for temporal layer 1") |
---|
294 | ("TLayerSwitchingFlag_L2,-ts2", m_abTLayerSwitchingFlag[2], false, "Switching flag for temporal layer 2") |
---|
295 | ("TLayerSwitchingFlag_L3,-ts3", m_abTLayerSwitchingFlag[3], false, "Switching flag for temporal layer 3") |
---|
296 | #endif |
---|
297 | |
---|
298 | /* Entropy coding parameters */ |
---|
299 | ("SBACRD", m_bUseSBACRD, true, "SBAC based RD estimation") |
---|
300 | |
---|
301 | /* Deblocking filter parameters */ |
---|
302 | ("LoopFilterDisable", m_abLoopFilterDisable, std::vector<Bool>(1,false), "Disables LoopFilter") |
---|
303 | |
---|
304 | ("LoopFilterOffsetInAPS", m_loopFilterOffsetInAPS, false) |
---|
305 | ("LoopFilterBetaOffset_div2", m_loopFilterBetaOffsetDiv2, 0 ) |
---|
306 | ("LoopFilterTcOffset_div2", m_loopFilterTcOffsetDiv2, 0 ) |
---|
307 | #if DBL_CONTROL |
---|
308 | ("DeblockingFilterControlPresent", m_DeblockingFilterControlPresent, false) |
---|
309 | #endif |
---|
310 | |
---|
311 | /* Camera Paremetes */ |
---|
312 | ("CameraParameterFile,cpf", m_pchCameraParameterFile, (Char *) 0, "Camera Parameter File Name") |
---|
313 | ("BaseViewCameraNumbers" , m_pchBaseViewCameraNumbers, (Char *) 0, "Numbers of base views") |
---|
314 | |
---|
315 | /* View Synthesis Optimization */ |
---|
316 | |
---|
317 | #if HHI_VSO |
---|
318 | ("VSOConfig", m_pchVSOConfig , (Char *) 0 , "VSO configuration") |
---|
319 | ("VSO", m_bUseVSO , false , "Use VSO" ) |
---|
320 | ("VSOMode", m_uiVSOMode , (UInt) 4 , "VSO Mode") |
---|
321 | ("LambdaScaleVSO", m_dLambdaScaleVSO , (Double) 1 , "Lambda Scaling for VSO") |
---|
322 | |
---|
323 | #if HHI_VSO_LS_TABLE |
---|
324 | ("VSOLSTable", m_bVSOLSTable , true , "Depth QP dependent video/depth rate allocation by Lagrange multiplier" ) |
---|
325 | #endif |
---|
326 | |
---|
327 | #if SAIT_VSO_EST_A0033 |
---|
328 | ("UseEstimatedVSD", m_bUseEstimatedVSD , true , "Model based VSD estimation instead of rendering based for some encoder decisions" ) |
---|
329 | #endif |
---|
330 | #if LGE_VSO_EARLY_SKIP_A0093 |
---|
331 | ("VSOEarlySkip", m_bVSOEarlySkip , true , "Early skip of VSO computation if synthesis error assumed to be zero" ) |
---|
332 | #endif |
---|
333 | ("ForceLambdaScaleVSO", m_bForceLambdaScaleVSO , false , "Force using Lambda Scale VSO also in non-VSO-Mode") |
---|
334 | #if HHI_VSO_DIST_INT |
---|
335 | ("AllowNegDist", m_bAllowNegDist , true , "Allow negative Distortion in VSO") |
---|
336 | #endif |
---|
337 | #if LGE_WVSO_A0119 |
---|
338 | ("WVSO", m_bWVSO , true , "Use WVSO" ) |
---|
339 | ("VSOWeight", m_iVSOWeight , 10 , "VSO Weight" ) |
---|
340 | ("VSDWeight", m_iVSDWeight , 1 , "SAIT Weight" ) |
---|
341 | ("DWeight", m_iDWeight , 1 , "SSE Weight" ) |
---|
342 | #endif |
---|
343 | |
---|
344 | #endif |
---|
345 | |
---|
346 | #if DEPTH_MAP_GENERATION |
---|
347 | ("PredDepthMapGen", m_uiPredDepthMapGeneration, (UInt)0, "generation of prediction depth maps for motion data prediction" ) |
---|
348 | #endif |
---|
349 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
350 | ("MultiviewMvPred", m_uiMultiviewMvPredMode, (UInt)0, "usage of predicted depth maps" ) |
---|
351 | ("MultiviewMvRegMode", m_uiMultiviewMvRegMode, (UInt)0, "regularization mode for multiview motion vectors" ) |
---|
352 | ("MultiviewMvRegLambdaScale", m_dMultiviewMvRegLambdaScale, (Double)0, "lambda scale for multiview motion vector regularization" ) |
---|
353 | #endif |
---|
354 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
355 | ("MultiviewResPred", m_uiMultiviewResPredMode, (UInt)0, "usage of inter-view residual prediction" ) |
---|
356 | #endif |
---|
357 | |
---|
358 | /* Coding tools */ |
---|
359 | ("LMChroma", m_bUseLMChroma, true, "intra chroma prediction based on recontructed luma") |
---|
360 | |
---|
361 | ("ALF", m_abUseALF, std::vector<Bool>(1,true), "Enables ALF") |
---|
362 | ("SAO", m_abUseSAO, std::vector<Bool>(1, true), "SAO") |
---|
363 | #if SAO_UNIT_INTERLEAVING |
---|
364 | ("MaxNumOffsetsPerPic", m_maxNumOffsetsPerPic, 2048, "2048: default") |
---|
365 | ("SAOInterleaving", m_saoInterleavingFlag, false, "0: SAO Picture Mode, 1: SAO Interleaving ") |
---|
366 | #endif |
---|
367 | |
---|
368 | ("ALFEncodePassReduction", m_iALFEncodePassReduction, 0, "0:Original 16-pass, 1: 1-pass, 2: 2-pass encoding") |
---|
369 | |
---|
370 | ("ALFMaxNumFilter,-ALFMNF", m_iALFMaxNumberFilters, 16, "16: No Constrained, 1-15: Constrained max number of filter") |
---|
371 | #if LCU_SYNTAX_ALF |
---|
372 | ("ALFParamInSlice", m_bALFParamInSlice, false, "ALF parameters in 0: APS, 1: slice header") |
---|
373 | ("ALFPicBasedEncode", m_bALFPicBasedEncode, true, "ALF picture-based encoding 0: false, 1: true") |
---|
374 | #endif |
---|
375 | |
---|
376 | ("SliceMode", m_iSliceMode, 0, "0: Disable all Recon slice limits, 1: Enforce max # of LCUs, 2: Enforce max # of bytes") |
---|
377 | ("SliceArgument", m_iSliceArgument, 0, "if SliceMode==1 SliceArgument represents max # of LCUs. if SliceMode==2 SliceArgument represents max # of bytes.") |
---|
378 | ("EntropySliceMode", m_iEntropySliceMode, 0, "0: Disable all entropy slice limits, 1: Enforce max # of LCUs, 2: Enforce constraint based entropy slices") |
---|
379 | ("EntropySliceArgument", m_iEntropySliceArgument,0, "if EntropySliceMode==1 SliceArgument represents max # of LCUs. if EntropySliceMode==2 EntropySliceArgument represents max # of bins.") |
---|
380 | ("SliceGranularity", m_iSliceGranularity, 0, "0: Slices always end at LCU borders. 1-3: slices may end at a depth of 1-3 below LCU level.") |
---|
381 | ("LFCrossSliceBoundaryFlag", m_bLFCrossSliceBoundaryFlag, true) |
---|
382 | |
---|
383 | ("ConstrainedIntraPred", m_bUseConstrainedIntraPred, false, "Constrained Intra Prediction") |
---|
384 | ("PCMEnabledFlag", m_usePCM , false) |
---|
385 | ("PCMLog2MaxSize", m_pcmLog2MaxSize, 5u) |
---|
386 | ("PCMLog2MinSize", m_uiPCMLog2MinSize, 3u) |
---|
387 | |
---|
388 | ("PCMInputBitDepthFlag", m_bPCMInputBitDepthFlag, true) |
---|
389 | ("PCMFilterDisableFlag", m_bPCMFilterDisableFlag, false) |
---|
390 | #if LOSSLESS_CODING |
---|
391 | ("LosslessCuEnabled", m_useLossless, false) |
---|
392 | #endif |
---|
393 | ("weighted_pred_flag,-wpP", m_bUseWeightPred, false, "weighted prediction flag (P-Slices)") |
---|
394 | ("weighted_bipred_idc,-wpBidc", m_uiBiPredIdc, 0u, "weighted bipred idc (B-Slices)") |
---|
395 | ("TileInfoPresentFlag", m_iColumnRowInfoPresent, 1, "0: tiles parameters are NOT present in the PPS. 1: tiles parameters are present in the PPS") |
---|
396 | ("UniformSpacingIdc", m_iUniformSpacingIdr, 0, "Indicates if the column and row boundaries are distributed uniformly") |
---|
397 | #if !REMOVE_TILE_DEPENDENCE |
---|
398 | ("TileBoundaryIndependenceIdc", m_iTileBoundaryIndependenceIdr, 1, "Indicates if the column and row boundaries break the prediction") |
---|
399 | #endif |
---|
400 | ("NumTileColumnsMinus1", m_iNumColumnsMinus1, 0, "Number of columns in a picture minus 1") |
---|
401 | ("ColumnWidthArray", cfg_ColumnWidth, string(""), "Array containing ColumnWidth values in units of LCU") |
---|
402 | ("NumTileRowsMinus1", m_iNumRowsMinus1, 0, "Number of rows in a picture minus 1") |
---|
403 | ("RowHeightArray", cfg_RowHeight, string(""), "Array containing RowHeight values in units of LCU") |
---|
404 | ("TileLocationInSliceHeaderFlag", m_iTileLocationInSliceHeaderFlag, 0, "0: Disable transmission of tile location in slice header. 1: Transmit tile locations in slice header.") |
---|
405 | ("TileMarkerFlag", m_iTileMarkerFlag, 0, "0: Disable transmission of lightweight tile marker. 1: Transmit light weight tile marker.") |
---|
406 | ("MaxTileMarkerEntryPoints", m_iMaxTileMarkerEntryPoints, 4, "Maximum number of uniformly-spaced tile entry points (using light weigh tile markers). Default=4. If number of tiles < MaxTileMarkerEntryPoints then all tiles have entry points.") |
---|
407 | ("TileControlPresentFlag", m_iTileBehaviorControlPresentFlag, 1, "0: tiles behavior control parameters are NOT present in the PPS. 1: tiles behavior control parameters are present in the PPS") |
---|
408 | ("LFCrossTileBoundaryFlag", m_bLFCrossTileBoundaryFlag, true, "1: cross-tile-boundary loop filtering. 0:non-cross-tile-boundary loop filtering") |
---|
409 | ("WaveFrontSynchro", m_iWaveFrontSynchro, 0, "0: no synchro; 1 synchro with TR; 2 TRR etc") |
---|
410 | ("WaveFrontFlush", m_iWaveFrontFlush, 0, "Flush and terminate CABAC coding for each LCU line") |
---|
411 | ("WaveFrontSubstreams", m_iWaveFrontSubstreams, 1, "# coded substreams wanted; per tile if TileBoundaryIndependenceIdc is 1, otherwise per frame") |
---|
412 | ("ScalingList", m_useScalingListId, 0, "0: no scaling list, 1: default scaling lists, 2: scaling lists specified in ScalingListFile") |
---|
413 | ("ScalingListFile", cfg_ScalingListFile, string(""), "Scaling list file name") |
---|
414 | #if MULTIBITS_DATA_HIDING |
---|
415 | ("SignHideFlag,-SBH", m_signHideFlag, 1) |
---|
416 | ("SignHideThreshold,-TSIG", m_signHidingThreshold, 4) |
---|
417 | #endif |
---|
418 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
419 | ("DMM", m_bUseDMM, false, "depth model modes flag") |
---|
420 | #endif |
---|
421 | |
---|
422 | /* Misc. */ |
---|
423 | ("SEIpictureDigest", m_pictureDigestEnabled, true, "Control generation of picture_digest SEI messages\n" |
---|
424 | "\t1: use MD5\n" |
---|
425 | "\t0: disable") |
---|
426 | |
---|
427 | ("TMVP", m_enableTMVP, true, "Enable TMVP" ) |
---|
428 | |
---|
429 | ("FEN", m_bUseFastEnc, false, "fast encoder setting") |
---|
430 | ("ECU", m_bUseEarlyCU, false, "Early CU setting") |
---|
431 | #if FAST_DECISION_FOR_MRG_RD_COST |
---|
432 | ("FDM", m_useFastDecisionForMerge, true, "Fast decision for Merge RD Cost") |
---|
433 | #endif |
---|
434 | ("CFM", m_bUseCbfFastMode, false, "Cbf fast mode setting") |
---|
435 | #if HHI_INTERVIEW_SKIP |
---|
436 | ("InterViewSkip", m_bInterViewSkip, false, "usage of interview skip" ) |
---|
437 | #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE |
---|
438 | ("InterViewSkipLambdaScale", m_dInterViewSkipLambdaScale, (Double)8, "lambda scale for interview skip" ) |
---|
439 | #endif |
---|
440 | #endif |
---|
441 | /* Compatability with old style -1 FOO or -0 FOO options. */ |
---|
442 | ("1", doOldStyleCmdlineOn, "turn option <name> on") |
---|
443 | ("0", doOldStyleCmdlineOff, "turn option <name> off") |
---|
444 | #if HHI_MPI |
---|
445 | ("MVI", m_bUseMVI, false, "use motion vector inheritance for depth map coding") |
---|
446 | #endif |
---|
447 | ; |
---|
448 | |
---|
449 | // parse coding structure |
---|
450 | for( Int k = 0; k < MAX_VIEW_NUM; k++ ) |
---|
451 | { |
---|
452 | if( k == 0 ) |
---|
453 | { |
---|
454 | for( Int i = 1; i < MAX_GOP + 1; i++ ) |
---|
455 | { |
---|
456 | std::ostringstream cOSS; |
---|
457 | cOSS<<"Frame"<<i; |
---|
458 | opts.addOptions()( cOSS.str(), m_GOPListsMvc[k][i-1], GOPEntryMvc() ); |
---|
459 | } |
---|
460 | } |
---|
461 | else |
---|
462 | { |
---|
463 | std::ostringstream cOSS1; |
---|
464 | cOSS1<<"FrameI"<<"_v"<<k; |
---|
465 | opts.addOptions()(cOSS1.str(), m_GOPListsMvc[k][MAX_GOP], GOPEntryMvc()); |
---|
466 | |
---|
467 | for( Int i = 1; i < MAX_GOP + 1; i++ ) |
---|
468 | { |
---|
469 | std::ostringstream cOSS2; |
---|
470 | cOSS2<<"Frame"<<i<<"_v"<<k; |
---|
471 | opts.addOptions()(cOSS2.str(), m_GOPListsMvc[k][i-1], GOPEntryMvc()); |
---|
472 | } |
---|
473 | } |
---|
474 | } |
---|
475 | |
---|
476 | po::setDefaults(opts); |
---|
477 | const list<const char*>& argv_unhandled = po::scanArgv(opts, argc, (const char**) argv); |
---|
478 | |
---|
479 | for (list<const char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++) |
---|
480 | { |
---|
481 | fprintf(stderr, "Unhandled argument ignored: `%s'\n", *it); |
---|
482 | } |
---|
483 | |
---|
484 | if (argc == 1 || do_help) |
---|
485 | { |
---|
486 | /* argc == 1: no options have been specified */ |
---|
487 | po::doHelp(cout, opts); |
---|
488 | xPrintUsage(); |
---|
489 | return false; |
---|
490 | } |
---|
491 | |
---|
492 | /* |
---|
493 | * Set any derived parameters |
---|
494 | */ |
---|
495 | /* convert std::string to c string for compatability */ |
---|
496 | m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str()); |
---|
497 | m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str()); |
---|
498 | |
---|
499 | m_pchColumnWidth = cfg_ColumnWidth.empty() ? NULL: strdup(cfg_ColumnWidth.c_str()); |
---|
500 | m_pchRowHeight = cfg_RowHeight.empty() ? NULL : strdup(cfg_RowHeight.c_str()); |
---|
501 | m_scalingListFile = cfg_ScalingListFile.empty() ? NULL : strdup(cfg_ScalingListFile.c_str()); |
---|
502 | |
---|
503 | if ( m_bUsingDepthMaps ) |
---|
504 | { |
---|
505 | for(Int i = 0; i < m_pchDepthReconFileList.size() ; i++) |
---|
506 | { |
---|
507 | if ((m_pchDepthInputFileList[i] != NULL) && (m_pchReconFileList[i] != NULL) && (i < m_iNumberOfViews) ) |
---|
508 | { |
---|
509 | if (m_pchDepthReconFileList[i] == NULL ) |
---|
510 | { |
---|
511 | xAppendToFileNameEnd( m_pchReconFileList[i], "_depth", m_pchDepthReconFileList[i] ); |
---|
512 | } |
---|
513 | } |
---|
514 | else |
---|
515 | { |
---|
516 | m_pchDepthReconFileList[i] = NULL; |
---|
517 | } |
---|
518 | }; |
---|
519 | } |
---|
520 | if ( m_adQP.size() < 2 ) |
---|
521 | { |
---|
522 | m_adQP.push_back( m_adQP[0] ); |
---|
523 | }; |
---|
524 | for (UInt uiK = 0; uiK < m_adQP.size(); uiK++) |
---|
525 | { |
---|
526 | m_aiQP.push_back( (Int)( m_adQP[uiK] ) ); |
---|
527 | } |
---|
528 | |
---|
529 | #if PIC_CROPPING |
---|
530 | switch (m_croppingMode) |
---|
531 | { |
---|
532 | case 0: |
---|
533 | { |
---|
534 | // no cropping or padding |
---|
535 | m_cropLeft = m_cropRight = m_cropTop = m_cropBottom = 0; |
---|
536 | m_aiPad[1] = m_aiPad[0] = 0; |
---|
537 | break; |
---|
538 | } |
---|
539 | case 1: |
---|
540 | { |
---|
541 | // automatic padding to minimum CU size |
---|
542 | Int minCuSize = m_uiMaxCUHeight >> (m_uiMaxCUDepth - 1); |
---|
543 | if (m_iSourceWidth % minCuSize) |
---|
544 | { |
---|
545 | m_aiPad[0] = m_cropRight = ((m_iSourceWidth / minCuSize) + 1) * minCuSize - m_iSourceWidth; |
---|
546 | m_iSourceWidth += m_cropRight; |
---|
547 | } |
---|
548 | if (m_iSourceHeight % minCuSize) |
---|
549 | { |
---|
550 | m_aiPad[1] = m_cropBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight; |
---|
551 | m_iSourceHeight += m_cropBottom; |
---|
552 | } |
---|
553 | break; |
---|
554 | } |
---|
555 | case 2: |
---|
556 | { |
---|
557 | //padding |
---|
558 | m_iSourceWidth += m_aiPad[0]; |
---|
559 | m_iSourceHeight += m_aiPad[1]; |
---|
560 | m_cropRight = m_aiPad[0]; |
---|
561 | m_cropBottom = m_aiPad[1]; |
---|
562 | break; |
---|
563 | } |
---|
564 | case 3: |
---|
565 | { |
---|
566 | // cropping |
---|
567 | if ((m_cropLeft == 0) && (m_cropRight == 0) && (m_cropTop == 0) && (m_cropBottom == 0)) |
---|
568 | { |
---|
569 | fprintf(stderr, "Warning: Cropping enabled, but all cropping parameters set to zero\n"); |
---|
570 | } |
---|
571 | if ((m_aiPad[1] != 0) || (m_aiPad[0]!=0)) |
---|
572 | { |
---|
573 | fprintf(stderr, "Warning: Cropping enabled, padding parameters will be ignored\n"); |
---|
574 | } |
---|
575 | m_aiPad[1] = m_aiPad[0] = 0; |
---|
576 | break; |
---|
577 | } |
---|
578 | } |
---|
579 | #else |
---|
580 | |
---|
581 | // compute source padding size |
---|
582 | if ( m_bUsePAD ) |
---|
583 | { |
---|
584 | if ( m_iSourceWidth%MAX_PAD_SIZE ) |
---|
585 | { |
---|
586 | m_aiPad[0] = (m_iSourceWidth/MAX_PAD_SIZE+1)*MAX_PAD_SIZE - m_iSourceWidth; |
---|
587 | } |
---|
588 | |
---|
589 | if ( m_iSourceHeight%MAX_PAD_SIZE ) |
---|
590 | { |
---|
591 | m_aiPad[1] = (m_iSourceHeight/MAX_PAD_SIZE+1)*MAX_PAD_SIZE - m_iSourceHeight; |
---|
592 | } |
---|
593 | } |
---|
594 | m_iSourceWidth += m_aiPad[0]; |
---|
595 | m_iSourceHeight += m_aiPad[1]; |
---|
596 | #endif |
---|
597 | |
---|
598 | // allocate slice-based dQP values |
---|
599 | m_aidQP = new Int[ m_iFrameToBeEncoded + m_iGOPSize + 1 ]; |
---|
600 | m_aidQPdepth = new Int[ m_iFrameToBeEncoded + m_iGOPSize + 1 ]; |
---|
601 | ::memset( m_aidQP, 0, sizeof(Int)*( m_iFrameToBeEncoded + m_iGOPSize + 1 ) ); |
---|
602 | ::memset( m_aidQPdepth, 0, sizeof(Int)*( m_iFrameToBeEncoded + m_iGOPSize + 1 ) ); |
---|
603 | |
---|
604 | // handling of floating-point QP values |
---|
605 | // if QP is not integer, sequence is split into two sections having QP and QP+1 |
---|
606 | m_aiQP[0] = (Int)( m_adQP[0] ); |
---|
607 | if ( m_aiQP[0] < m_adQP[0] ) |
---|
608 | { |
---|
609 | Int iSwitchPOC = (Int)( m_iFrameToBeEncoded - (m_adQP[0] - m_aiQP[0])*m_iFrameToBeEncoded + 0.5 ); |
---|
610 | |
---|
611 | iSwitchPOC = (Int)( (Double)iSwitchPOC / m_iGOPSize + 0.5 )*m_iGOPSize; |
---|
612 | for ( Int i=iSwitchPOC; i<m_iFrameToBeEncoded + m_iGOPSize + 1; i++ ) |
---|
613 | { |
---|
614 | m_aidQP[i] = 1; |
---|
615 | } |
---|
616 | } |
---|
617 | |
---|
618 | m_aiQP[1] = (Int)( m_adQP[1] ); |
---|
619 | if ( m_aiQP[1] < m_adQP[1] ) |
---|
620 | { |
---|
621 | Int iSwitchPOC = (Int)( m_iFrameToBeEncoded - (m_adQP[1] - m_aiQP[1])*m_iFrameToBeEncoded + 0.5 ); |
---|
622 | |
---|
623 | iSwitchPOC = (Int)( (Double)iSwitchPOC / m_iGOPSize + 0.5 )*m_iGOPSize; |
---|
624 | for ( Int i=iSwitchPOC; i<m_iFrameToBeEncoded + m_iGOPSize + 1; i++ ) |
---|
625 | { |
---|
626 | m_aidQPdepth[i] = 1; |
---|
627 | } |
---|
628 | } |
---|
629 | |
---|
630 | // reading external dQP description from file |
---|
631 | if ( m_pchdQPFile ) |
---|
632 | { |
---|
633 | FILE* fpt=fopen( m_pchdQPFile, "r" ); |
---|
634 | if ( fpt ) |
---|
635 | { |
---|
636 | Int iValue; |
---|
637 | Int iPOC = 0; |
---|
638 | while ( iPOC < m_iFrameToBeEncoded ) |
---|
639 | { |
---|
640 | if ( fscanf(fpt, "%d", &iValue ) == EOF ) break; |
---|
641 | m_aidQP[ iPOC ] = iValue; |
---|
642 | iPOC++; |
---|
643 | } |
---|
644 | fclose(fpt); |
---|
645 | } |
---|
646 | } |
---|
647 | |
---|
648 | #if HHI_VSO |
---|
649 | m_bUseVSO = m_bUseVSO && m_bUsingDepthMaps && (m_uiVSOMode != 0); |
---|
650 | #endif |
---|
651 | |
---|
652 | #if LGE_WVSO_A0119 |
---|
653 | m_bWVSO = m_bUseVSO && m_bWVSO && m_bUsingDepthMaps; |
---|
654 | #endif |
---|
655 | xCleanUpVectors(); |
---|
656 | |
---|
657 | #if HHI_VSO |
---|
658 | if ( m_abUseALF .size() < 2) |
---|
659 | m_abUseALF .push_back( m_bUseVSO ? false : m_abUseALF[0] ); |
---|
660 | |
---|
661 | if ( m_abUseRDOQ.size() < 2) |
---|
662 | m_abUseRDOQ.push_back( m_bUseVSO ? true : m_abUseRDOQ[0] ); |
---|
663 | |
---|
664 | if ( m_abLoopFilterDisable.size() < 2) |
---|
665 | m_abLoopFilterDisable.push_back( m_bUseVSO ? true : m_abLoopFilterDisable[0] ); |
---|
666 | |
---|
667 | if (m_abUseSAO.size() < 2) |
---|
668 | m_abUseSAO.push_back ( m_bUseVSO ? false : m_abUseSAO[0] ); |
---|
669 | #else |
---|
670 | if ( m_abUseALF .size() < 2) |
---|
671 | m_abUseALF .push_back( m_abUseALF[0] ); |
---|
672 | |
---|
673 | if ( m_abUseRDOQ.size() < 2) |
---|
674 | m_abUseRDOQ.push_back( m_abUseRDOQ[0] ); |
---|
675 | |
---|
676 | if ( m_abLoopFilterDisable.size() < 2) |
---|
677 | m_abLoopFilterDisable.push_back( m_abLoopFilterDisable[0] ); |
---|
678 | |
---|
679 | if (m_abUseSAO.size() < 2) |
---|
680 | m_abUseSAO.push_back ( m_abUseSAO[0] ); |
---|
681 | #endif |
---|
682 | |
---|
683 | #if HHI_VSO |
---|
684 | |
---|
685 | #if HHI_VSO_LS_TABLE |
---|
686 | // Q&D |
---|
687 | Double adLambdaScaleTable[] = |
---|
688 | { 0.031250, 0.031639, 0.032029, 0.032418, 0.032808, 0.033197, 0.033586, 0.033976, 0.034365, 0.034755, |
---|
689 | 0.035144, 0.035533, 0.035923, 0.036312, 0.036702, 0.037091, 0.037480, 0.037870, 0.038259, 0.038648, |
---|
690 | 0.039038, 0.039427, 0.039817, 0.040206, 0.040595, 0.040985, 0.041374, 0.041764, 0.042153, 0.042542, |
---|
691 | 0.042932, 0.043321, 0.043711, 0.044100, 0.044194, 0.053033, 0.061872, 0.070711, 0.079550, 0.088388, |
---|
692 | 0.117851, 0.147314, 0.176777, 0.235702, 0.294628, 0.353553, 0.471405, 0.589256, 0.707107, 0.707100, |
---|
693 | 0.753550, 0.800000 |
---|
694 | }; |
---|
695 | if ( m_bVSOLSTable ) |
---|
696 | { |
---|
697 | AOT( (m_aiQP[1] < 0) || (m_aiQP[1] > 51)); |
---|
698 | m_dLambdaScaleVSO *= adLambdaScaleTable[m_aiQP[1]]; |
---|
699 | } |
---|
700 | #endif |
---|
701 | #endif |
---|
702 | |
---|
703 | // set global variables |
---|
704 | xSetGlobal(); |
---|
705 | |
---|
706 | // read and check camera parameters |
---|
707 | #if HHI_VSO |
---|
708 | if ( m_bUseVSO && m_uiVSOMode == 4) |
---|
709 | { |
---|
710 | m_cRenModStrParser.setString( m_iNumberOfViews, m_pchVSOConfig ); |
---|
711 | m_cCameraData .init ( (UInt)m_iNumberOfViews, |
---|
712 | m_uiInputBitDepth, |
---|
713 | (UInt)m_iCodedCamParPrecision, |
---|
714 | m_FrameSkip, |
---|
715 | (UInt)m_iFrameToBeEncoded, |
---|
716 | m_pchCameraParameterFile, |
---|
717 | m_pchBaseViewCameraNumbers, |
---|
718 | NULL, |
---|
719 | m_cRenModStrParser.getSynthViews(), |
---|
720 | LOG2_DISP_PREC_LUT ); |
---|
721 | } |
---|
722 | else if ( m_bUseVSO && m_uiVSOMode != 4 ) |
---|
723 | { |
---|
724 | m_cCameraData .init ( (UInt)m_iNumberOfViews, |
---|
725 | m_uiInputBitDepth, |
---|
726 | (UInt)m_iCodedCamParPrecision, |
---|
727 | m_FrameSkip, |
---|
728 | (UInt)m_iFrameToBeEncoded, |
---|
729 | m_pchCameraParameterFile, |
---|
730 | m_pchBaseViewCameraNumbers, |
---|
731 | m_pchVSOConfig, |
---|
732 | NULL, |
---|
733 | LOG2_DISP_PREC_LUT ); |
---|
734 | } |
---|
735 | else |
---|
736 | { |
---|
737 | m_cCameraData .init ( (UInt)m_iNumberOfViews, |
---|
738 | m_uiInputBitDepth, |
---|
739 | (UInt)m_iCodedCamParPrecision, |
---|
740 | m_FrameSkip, |
---|
741 | (UInt)m_iFrameToBeEncoded, |
---|
742 | m_pchCameraParameterFile, |
---|
743 | m_pchBaseViewCameraNumbers, |
---|
744 | NULL, |
---|
745 | NULL, |
---|
746 | LOG2_DISP_PREC_LUT ); |
---|
747 | } |
---|
748 | #else |
---|
749 | m_cCameraData .init ( (UInt)m_iNumberOfViews, |
---|
750 | m_uiInputBitDepth, |
---|
751 | (UInt)m_iCodedCamParPrecision, |
---|
752 | m_FrameSkip, |
---|
753 | (UInt)m_iFrameToBeEncoded, |
---|
754 | m_pchCameraParameterFile, |
---|
755 | m_pchBaseViewCameraNumbers, |
---|
756 | NULL, |
---|
757 | NULL, |
---|
758 | LOG2_DISP_PREC_LUT ); |
---|
759 | #endif |
---|
760 | |
---|
761 | |
---|
762 | // check validity of input parameters |
---|
763 | xCheckParameter(); |
---|
764 | m_cCameraData.check( false, true ); |
---|
765 | |
---|
766 | // print-out parameters |
---|
767 | xPrintParameter(); |
---|
768 | |
---|
769 | return true; |
---|
770 | } |
---|
771 | |
---|
772 | // ==================================================================================================================== |
---|
773 | // Private member functions |
---|
774 | // ==================================================================================================================== |
---|
775 | |
---|
776 | Bool confirmPara(Bool bflag, const char* message); |
---|
777 | |
---|
778 | Void TAppEncCfg::xCheckParameter() |
---|
779 | { |
---|
780 | bool check_failed = false; /* abort if there is a fatal configuration problem */ |
---|
781 | #define xConfirmPara(a,b) check_failed |= confirmPara(a,b) |
---|
782 | // check range of parameters |
---|
783 | xConfirmPara( m_uiInputBitDepth < 8, "InputBitDepth must be at least 8" ); |
---|
784 | xConfirmPara( m_iFrameRate <= 0, "Frame rate must be more than 1" ); |
---|
785 | xConfirmPara( m_iFrameToBeEncoded <= 0, "Total Number Of Frames encoded must be more than 0" ); |
---|
786 | xConfirmPara( m_iGOPSize < 1 , "GOP Size must be greater or equal to 1" ); |
---|
787 | xConfirmPara( m_iGOPSize > 1 && m_iGOPSize % 2, "GOP Size must be a multiple of 2, if GOP Size is greater than 1" ); |
---|
788 | xConfirmPara( (m_iIntraPeriod > 0 && m_iIntraPeriod < m_iGOPSize) || m_iIntraPeriod == 0, "Intra period must be more than GOP size, or -1 , not 0" ); |
---|
789 | xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 2, "Decoding Refresh Type must be equal to 0, 1 or 2" ); |
---|
790 | #if H0736_AVC_STYLE_QP_RANGE |
---|
791 | xConfirmPara( m_aiQP[0] < -6 * ((Int)m_uiInternalBitDepth - 8) || m_aiQP[0] > 51, "QP exceeds supported range (-QpBDOffsety to 51)" ); |
---|
792 | if ( m_aiQP.size() >= 2 ) |
---|
793 | { |
---|
794 | xConfirmPara( m_aiQP[1] < -6 * ((Int)m_uiInternalBitDepth - 8) || m_aiQP[1] > 51, "QP depth exceeds supported range (-QpBDOffsety to 51)" ); |
---|
795 | } |
---|
796 | #else |
---|
797 | xConfirmPara( m_aiQP[0] < 0 || m_aiQP[0] > 51, "QP exceeds supported range (0 to 51)" ); |
---|
798 | if ( m_aiQP.size() >= 2 ) |
---|
799 | { |
---|
800 | xConfirmPara( m_aiQP[1] < 0 || m_aiQP[1] > 51, "QP Depth exceeds supported range (0 to 51)" ); |
---|
801 | } |
---|
802 | #endif |
---|
803 | xConfirmPara( m_iALFEncodePassReduction < 0 || m_iALFEncodePassReduction > 2, "ALFEncodePassReduction must be equal to 0, 1 or 2"); |
---|
804 | #if LCU_SYNTAX_ALF |
---|
805 | xConfirmPara( m_iALFMaxNumberFilters < 1, "ALFMaxNumFilter should be larger than 1"); |
---|
806 | #else |
---|
807 | xConfirmPara( m_iALFMaxNumberFilters < 1 || m_iALFMaxNumberFilters > 16, "ALFMaxNumFilter exceeds supported range (1 to 16)"); |
---|
808 | #endif |
---|
809 | xConfirmPara( m_loopFilterBetaOffsetDiv2 < -13 || m_loopFilterBetaOffsetDiv2 > 13, "Loop Filter Beta Offset div. 2 exceeds supported range (-13 to 13)"); |
---|
810 | xConfirmPara( m_loopFilterTcOffsetDiv2 < -13 || m_loopFilterTcOffsetDiv2 > 13, "Loop Filter Tc Offset div. 2 exceeds supported range (-13 to 13)"); |
---|
811 | xConfirmPara( m_iFastSearch < 0 || m_iFastSearch > 2, "Fast Search Mode is not supported value (0:Full search 1:Diamond 2:PMVFAST)" ); |
---|
812 | xConfirmPara( m_iSearchRange < 0 , "Search Range must be more than 0" ); |
---|
813 | xConfirmPara( m_bipredSearchRange < 0 , "Search Range must be more than 0" ); |
---|
814 | xConfirmPara( m_iMaxDeltaQP > 7, "Absolute Delta QP exceeds supported range (0 to 7)" ); |
---|
815 | xConfirmPara( m_iMaxCuDQPDepth > m_uiMaxCUDepth - 1, "Absolute depth for a minimum CuDQP exceeds maximum coding unit depth" ); |
---|
816 | |
---|
817 | xConfirmPara( m_iChromaQpOffset < -12, "Min. Chroma Qp Offset is -12" ); |
---|
818 | xConfirmPara( m_iChromaQpOffset > 12, "Max. Chroma Qp Offset is 12" ); |
---|
819 | xConfirmPara( m_iChromaQpOffset2nd < -12, "Min. Chroma Qp Offset 2nd is -12" ); |
---|
820 | xConfirmPara( m_iChromaQpOffset2nd > 12, "Max. Chroma Qp Offset 2nd is 12" ); |
---|
821 | |
---|
822 | xConfirmPara( m_iQPAdaptationRange <= 0, "QP Adaptation Range must be more than 0" ); |
---|
823 | if (m_iDecodingRefreshType == 2) |
---|
824 | { |
---|
825 | xConfirmPara( m_iIntraPeriod > 0 && m_iIntraPeriod <= m_iGOPSize , "Intra period must be larger than GOP size for periodic IDR pictures"); |
---|
826 | } |
---|
827 | xConfirmPara( (m_uiMaxCUWidth >> m_uiMaxCUDepth) < 4, "Minimum partition width size should be larger than or equal to 8"); |
---|
828 | xConfirmPara( (m_uiMaxCUHeight >> m_uiMaxCUDepth) < 4, "Minimum partition height size should be larger than or equal to 8"); |
---|
829 | xConfirmPara( m_uiMaxCUWidth < 16, "Maximum partition width size should be larger than or equal to 16"); |
---|
830 | xConfirmPara( m_uiMaxCUHeight < 16, "Maximum partition height size should be larger than or equal to 16"); |
---|
831 | #if PIC_CROPPING |
---|
832 | xConfirmPara( (m_iSourceWidth % (m_uiMaxCUWidth >> (m_uiMaxCUDepth-1)))!=0, "Resulting coded frame width must be a multiple of the minimum CU size"); |
---|
833 | xConfirmPara( (m_iSourceHeight % (m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)))!=0, "Resulting coded frame height must be a multiple of the minimum CU size"); |
---|
834 | #else |
---|
835 | xConfirmPara( (m_iSourceWidth % (m_uiMaxCUWidth >> (m_uiMaxCUDepth-1)))!=0, "Frame width should be multiple of minimum CU size"); |
---|
836 | xConfirmPara( (m_iSourceHeight % (m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)))!=0, "Frame height should be multiple of minimum CU size"); |
---|
837 | #endif |
---|
838 | |
---|
839 | xConfirmPara( m_uiQuadtreeTULog2MinSize < 2, "QuadtreeTULog2MinSize must be 2 or greater."); |
---|
840 | xConfirmPara( m_uiQuadtreeTULog2MinSize > 5, "QuadtreeTULog2MinSize must be 5 or smaller."); |
---|
841 | xConfirmPara( m_uiQuadtreeTULog2MaxSize < 2, "QuadtreeTULog2MaxSize must be 2 or greater."); |
---|
842 | xConfirmPara( m_uiQuadtreeTULog2MaxSize > 5, "QuadtreeTULog2MaxSize must be 5 or smaller."); |
---|
843 | xConfirmPara( m_uiQuadtreeTULog2MaxSize < m_uiQuadtreeTULog2MinSize, "QuadtreeTULog2MaxSize must be greater than or equal to m_uiQuadtreeTULog2MinSize."); |
---|
844 | xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUWidth >>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS |
---|
845 | xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUHeight>>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS |
---|
846 | xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUWidth >> m_uiMaxCUDepth ), "Minimum CU width must be greater than minimum transform size." ); |
---|
847 | xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUHeight >> m_uiMaxCUDepth ), "Minimum CU height must be greater than minimum transform size." ); |
---|
848 | xConfirmPara( m_uiQuadtreeTUMaxDepthInter < 1, "QuadtreeTUMaxDepthInter must be greater than or equal to 1" ); |
---|
849 | xConfirmPara( m_uiQuadtreeTUMaxDepthInter > m_uiQuadtreeTULog2MaxSize - m_uiQuadtreeTULog2MinSize + 1, "QuadtreeTUMaxDepthInter must be less than or equal to the difference between QuadtreeTULog2MaxSize and QuadtreeTULog2MinSize plus 1" ); |
---|
850 | xConfirmPara( m_uiQuadtreeTUMaxDepthIntra < 1, "QuadtreeTUMaxDepthIntra must be greater than or equal to 1" ); |
---|
851 | xConfirmPara( m_uiQuadtreeTUMaxDepthIntra > m_uiQuadtreeTULog2MaxSize - m_uiQuadtreeTULog2MinSize + 1, "QuadtreeTUMaxDepthIntra must be less than or equal to the difference between QuadtreeTULog2MaxSize and QuadtreeTULog2MinSize plus 1" ); |
---|
852 | |
---|
853 | xConfirmPara( m_iNumberOfViews > MAX_VIEW_NUM , "NumberOfViews must be less than or equal to MAX_VIEW_NUM"); |
---|
854 | xConfirmPara ( Int( m_pchInputFileList.size() ) < m_iNumberOfViews, "Number of InputFiles must be greater than or equal to NumberOfViews" ); |
---|
855 | xConfirmPara ( Int( m_pchReconFileList.size() ) < m_iNumberOfViews, "Number of ReconFiles must be greater than or equal to NumberOfViews" ); |
---|
856 | xConfirmPara ( m_iCodedCamParPrecision < 0 || m_iCodedCamParPrecision > 5, "CodedCamParsPrecision must be in range of 0..5" ); |
---|
857 | #if HHI_INTERVIEW_SKIP |
---|
858 | xConfirmPara ( m_bInterViewSkip && !m_bUsingDepthMaps, "RenderingSkipMode requires CodeDepthMaps = 1" ); |
---|
859 | #endif |
---|
860 | #if DEPTH_MAP_GENERATION |
---|
861 | xConfirmPara ( m_uiPredDepthMapGeneration > 2, "PredDepthMapGen must be less than or equal to 2" ); |
---|
862 | xConfirmPara ( m_uiPredDepthMapGeneration >= 2 && !m_bUsingDepthMaps, "PredDepthMapGen >= 2 requires CodeDepthMaps = 1" ); |
---|
863 | #endif |
---|
864 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
865 | xConfirmPara ( m_uiMultiviewMvPredMode > 7, "MultiviewMvPred must be less than or equal to 7" ); |
---|
866 | xConfirmPara ( m_uiMultiviewMvPredMode > 0 && m_uiPredDepthMapGeneration == 0 , "MultiviewMvPred > 0 requires PredDepthMapGen > 0" ); |
---|
867 | xConfirmPara ( m_uiMultiviewMvRegMode > 1, "MultiviewMvRegMode must be less than or equal to 1" ); |
---|
868 | xConfirmPara ( m_dMultiviewMvRegLambdaScale < 0.0, "MultiviewMvRegLambdaScale must not be negative" ); |
---|
869 | if( m_uiMultiviewMvRegMode ) |
---|
870 | { |
---|
871 | xConfirmPara ( Int( m_pchDepthInputFileList.size() ) < m_iNumberOfViews, "MultiviewMvRegMode > 0 requires the presence of input depth maps" ); |
---|
872 | } |
---|
873 | #endif |
---|
874 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
875 | xConfirmPara ( m_uiMultiviewResPredMode > 1, "MultiviewResPred must be less than or equal to 1" ); |
---|
876 | xConfirmPara ( m_uiMultiviewResPredMode > 0 && m_uiPredDepthMapGeneration == 0 , "MultiviewResPred > 0 requires PredDepthMapGen > 0" ); |
---|
877 | #endif |
---|
878 | if( m_bUsingDepthMaps ) |
---|
879 | { |
---|
880 | xConfirmPara ( Int( m_pchDepthInputFileList.size() ) < m_iNumberOfViews, "Number of DepthInputFiles must be greater than or equal to NumberOfViews" ); |
---|
881 | xConfirmPara ( Int( m_pchDepthReconFileList.size() ) < m_iNumberOfViews, "Number of DepthReconFiles must be greater than or equal to NumberOfViews" ); |
---|
882 | |
---|
883 | #if HHI_VSO |
---|
884 | if( m_bUseVSO ) |
---|
885 | { |
---|
886 | xConfirmPara( m_pchCameraParameterFile == 0 , "CameraParameterFile must be given"); |
---|
887 | xConfirmPara( m_pchVSOConfig == 0 , "VSO Setup string must be given"); |
---|
888 | xConfirmPara( m_pchBaseViewCameraNumbers == 0 , "BaseViewCameraNumbers must be given" ); |
---|
889 | xConfirmPara( m_iNumberOfViews != m_cCameraData.getBaseViewNumbers().size(), "Number of Views in BaseViewCameraNumbers must be equal to NumberOfViews" ); |
---|
890 | xConfirmPara( m_uiVSOMode > 4 , "VSO Mode must be less than 5"); |
---|
891 | } |
---|
892 | #endif |
---|
893 | } |
---|
894 | #if ADAPTIVE_QP_SELECTION |
---|
895 | #if H0736_AVC_STYLE_QP_RANGE |
---|
896 | xConfirmPara( m_bUseAdaptQpSelect == true && m_aiQP[0] < 0, "AdaptiveQpSelection must be disabled when QP < 0."); |
---|
897 | xConfirmPara( m_bUseAdaptQpSelect == true && m_aiQP[1] < 0, "AdaptiveQpSelection must be disabled when QP < 0."); |
---|
898 | xConfirmPara( m_bUseAdaptQpSelect == true && (m_iChromaQpOffset !=0 || m_iChromaQpOffset2nd != 0 ), "AdaptiveQpSelection must be disabled when ChromaQpOffset is not equal to 0."); |
---|
899 | #endif |
---|
900 | #endif |
---|
901 | |
---|
902 | if( m_usePCM) |
---|
903 | { |
---|
904 | xConfirmPara( m_uiPCMLog2MinSize < 3, "PCMLog2MinSize must be 3 or greater."); |
---|
905 | xConfirmPara( m_uiPCMLog2MinSize > 5, "PCMLog2MinSize must be 5 or smaller."); |
---|
906 | xConfirmPara( m_pcmLog2MaxSize > 5, "PCMLog2MaxSize must be 5 or smaller."); |
---|
907 | xConfirmPara( m_pcmLog2MaxSize < m_uiPCMLog2MinSize, "PCMLog2MaxSize must be equal to or greater than m_uiPCMLog2MinSize."); |
---|
908 | } |
---|
909 | |
---|
910 | #if FIXED_NUMBER_OF_TILES_SLICE_MODE |
---|
911 | xConfirmPara( m_iSliceMode < 0 || m_iSliceMode > 3, "SliceMode exceeds supported range (0 to 3)" ); |
---|
912 | #endif |
---|
913 | if (m_iSliceMode!=0) |
---|
914 | { |
---|
915 | xConfirmPara( m_iSliceArgument < 1 , "SliceArgument should be larger than or equal to 1" ); |
---|
916 | } |
---|
917 | #if FIXED_NUMBER_OF_TILES_SLICE_MODE |
---|
918 | if (m_iSliceMode==3) |
---|
919 | { |
---|
920 | xConfirmPara( m_iSliceGranularity > 0 , "When SliceMode == 3 is chosen, the SliceGranularity must be 0" ); |
---|
921 | } |
---|
922 | #endif |
---|
923 | xConfirmPara( m_iEntropySliceMode < 0 || m_iEntropySliceMode > 2, "EntropySliceMode exceeds supported range (0 to 2)" ); |
---|
924 | if (m_iEntropySliceMode!=0) |
---|
925 | { |
---|
926 | xConfirmPara( m_iEntropySliceArgument < 1 , "EntropySliceArgument should be larger than or equal to 1" ); |
---|
927 | } |
---|
928 | xConfirmPara( m_iSliceGranularity >= m_uiMaxCUDepth, "SliceGranularity must be smaller than maximum cu depth"); |
---|
929 | xConfirmPara( m_iSliceGranularity <0 || m_iSliceGranularity > 3, "SliceGranularity exceeds supported range (0 to 3)" ); |
---|
930 | xConfirmPara( m_iSliceGranularity > m_iMaxCuDQPDepth, "SliceGranularity must be smaller smaller than or equal to maximum dqp depth" ); |
---|
931 | |
---|
932 | #if NO_COMBINED_PARALLEL |
---|
933 | bool tileFlag = (m_iNumColumnsMinus1 > 0 || m_iNumRowsMinus1 > 0 ); |
---|
934 | xConfirmPara( tileFlag && m_iEntropySliceMode, "Tile and Entropy Slice can not be applied together"); |
---|
935 | xConfirmPara( tileFlag && m_iWaveFrontSynchro, "Tile and Wavefront can not be applied together"); |
---|
936 | xConfirmPara( m_iWaveFrontSynchro && m_iEntropySliceMode, "Wavefront and Entropy Slice can not be applied together"); |
---|
937 | #endif |
---|
938 | |
---|
939 | // max CU width and height should be power of 2 |
---|
940 | UInt ui = m_uiMaxCUWidth; |
---|
941 | while(ui) |
---|
942 | { |
---|
943 | ui >>= 1; |
---|
944 | if( (ui & 1) == 1) |
---|
945 | xConfirmPara( ui != 1 , "Width should be 2^n"); |
---|
946 | } |
---|
947 | ui = m_uiMaxCUHeight; |
---|
948 | while(ui) |
---|
949 | { |
---|
950 | ui >>= 1; |
---|
951 | if( (ui & 1) == 1) |
---|
952 | xConfirmPara( ui != 1 , "Height should be 2^n"); |
---|
953 | } |
---|
954 | |
---|
955 | xConfirmPara( m_iWaveFrontSynchro < 0, "WaveFrontSynchro cannot be negative" ); |
---|
956 | xConfirmPara( m_iWaveFrontFlush < 0, "WaveFrontFlush cannot be negative" ); |
---|
957 | xConfirmPara( m_iWaveFrontSubstreams <= 0, "WaveFrontSubstreams must be positive" ); |
---|
958 | xConfirmPara( m_iWaveFrontSubstreams > 1 && !m_iWaveFrontSynchro, "Must have WaveFrontSynchro > 0 in order to have WaveFrontSubstreams > 1" ); |
---|
959 | |
---|
960 | #undef xConfirmPara |
---|
961 | if (check_failed) |
---|
962 | { |
---|
963 | exit(EXIT_FAILURE); |
---|
964 | } |
---|
965 | |
---|
966 | xCheckCodingStructureMvc(); |
---|
967 | } |
---|
968 | |
---|
969 | Void TAppEncCfg::xCheckCodingStructureMvc() |
---|
970 | { |
---|
971 | bool check_failed = false; /* abort if there is a fatal configuration problem */ |
---|
972 | #define xConfirmPara(a,b) check_failed |= confirmPara(a,b) |
---|
973 | |
---|
974 | // validate that POC of same frame is identical across multiple views |
---|
975 | Bool bErrorMvePoc = false; |
---|
976 | if( m_iNumberOfViews > 1 ) |
---|
977 | { |
---|
978 | for( Int k = 1; k < m_iNumberOfViews; k++ ) |
---|
979 | { |
---|
980 | for( Int i = 0; i < MAX_GOP; i++ ) |
---|
981 | { |
---|
982 | if( m_GOPListsMvc[k][i].m_POC != m_GOPListsMvc[0][i].m_POC ) |
---|
983 | { |
---|
984 | printf( "\nError: Frame%d_v%d POC %d is not identical to Frame%d POC\n", i, k, m_GOPListsMvc[k][i].m_POC, i ); |
---|
985 | bErrorMvePoc = true; |
---|
986 | } |
---|
987 | } |
---|
988 | } |
---|
989 | } |
---|
990 | xConfirmPara( bErrorMvePoc, "Invalid inter-view POC structure given" ); |
---|
991 | |
---|
992 | // validate that baseview has no inter-view refs |
---|
993 | Bool bErrorIvpBase = false; |
---|
994 | for( Int i = 0; i < MAX_GOP; i++ ) |
---|
995 | { |
---|
996 | if( m_GOPListsMvc[0][i].m_numInterViewRefPics != 0 ) |
---|
997 | { |
---|
998 | printf( "\nError: Frame%d inter_view refs not available in view 0\n", i ); |
---|
999 | bErrorIvpBase = true; |
---|
1000 | } |
---|
1001 | } |
---|
1002 | xConfirmPara( bErrorIvpBase, "Inter-view refs not possible in base view" ); |
---|
1003 | |
---|
1004 | // validate inter-view refs |
---|
1005 | Bool bErrorIvpEnhV = false; |
---|
1006 | if( m_iNumberOfViews > 1 ) |
---|
1007 | { |
---|
1008 | for( Int k = 1; k < m_iNumberOfViews; k++ ) |
---|
1009 | { |
---|
1010 | for( Int i = 0; i < MAX_GOP+1; i++ ) |
---|
1011 | { |
---|
1012 | for( Int j = 0; j < m_GOPListsMvc[k][i].m_numInterViewRefPics; j++ ) |
---|
1013 | { |
---|
1014 | Int iAbsViewId = m_GOPListsMvc[k][i].m_interViewRefs[j] + k; |
---|
1015 | if( iAbsViewId < 0 || iAbsViewId >= k ) |
---|
1016 | { |
---|
1017 | printf( "\nError: inter-view ref pic %d is not available for Frame%d_v%d\n", m_GOPListsMvc[k][i].m_interViewRefs[j], i, k ); |
---|
1018 | bErrorIvpEnhV = true; |
---|
1019 | } |
---|
1020 | if( m_GOPListsMvc[k][i].m_interViewRefPosL0[j] < 0 || m_GOPListsMvc[k][i].m_interViewRefPosL0[j] > m_GOPListsMvc[k][i].m_numRefPicsActive ) |
---|
1021 | { |
---|
1022 | printf( "\nError: inter-view ref pos %d on L0 is not available for Frame%d_v%d\n", m_GOPListsMvc[k][i].m_interViewRefPosL0[j], i, k ); |
---|
1023 | bErrorIvpEnhV = true; |
---|
1024 | } |
---|
1025 | if( m_GOPListsMvc[k][i].m_interViewRefPosL1[j] < 0 || m_GOPListsMvc[k][i].m_interViewRefPosL1[j] > m_GOPListsMvc[k][i].m_numRefPicsActive ) |
---|
1026 | { |
---|
1027 | printf( "\nError: inter-view ref pos %d on L1 is not available for Frame%d_v%d\n", m_GOPListsMvc[k][i].m_interViewRefPosL1[j], i, k ); |
---|
1028 | bErrorIvpEnhV = true; |
---|
1029 | } |
---|
1030 | } |
---|
1031 | if( i == MAX_GOP ) // inter-view refs at I pic position in base view |
---|
1032 | { |
---|
1033 | if( m_GOPListsMvc[k][MAX_GOP].m_sliceType != 'B' && m_GOPListsMvc[k][MAX_GOP].m_sliceType != 'P' && m_GOPListsMvc[k][MAX_GOP].m_sliceType != 'I' ) |
---|
1034 | { |
---|
1035 | printf( "\nError: slice type of FrameI_v%d must be equal to B or P or I\n", k ); |
---|
1036 | bErrorIvpEnhV = true; |
---|
1037 | } |
---|
1038 | |
---|
1039 | if( m_GOPListsMvc[k][MAX_GOP].m_POC != 0 ) |
---|
1040 | { |
---|
1041 | printf( "\nError: POC %d not possible for FrameI_v%d, must be 0\n", m_GOPListsMvc[k][MAX_GOP].m_POC, k ); |
---|
1042 | bErrorIvpEnhV = true; |
---|
1043 | } |
---|
1044 | |
---|
1045 | if( m_GOPListsMvc[k][MAX_GOP].m_temporalId != 0 ) |
---|
1046 | { |
---|
1047 | printf( "\nWarning: Temporal id of FrameI_v%d must be 0 (cp. I-frame in base view)\n", k ); |
---|
1048 | m_GOPListsMvc[k][MAX_GOP].m_temporalId = 0; |
---|
1049 | } |
---|
1050 | |
---|
1051 | if( !(m_GOPListsMvc[k][MAX_GOP].m_refPic) ) |
---|
1052 | { |
---|
1053 | printf( "\nWarning: FrameI_v%d must be ref pic (cp. I-frame in base view)\n", k ); |
---|
1054 | m_GOPListsMvc[k][MAX_GOP].m_refPic = true; |
---|
1055 | } |
---|
1056 | |
---|
1057 | if( m_GOPListsMvc[k][MAX_GOP].m_numRefPics != 0 ) |
---|
1058 | { |
---|
1059 | printf( "\nWarning: temporal references not possible for FrameI_v%d\n", k ); |
---|
1060 | for( Int j = 0; j < m_GOPListsMvc[k][MAX_GOP].m_numRefPics; j++ ) |
---|
1061 | { |
---|
1062 | m_GOPListsMvc[k][MAX_GOP].m_referencePics[j] = 0; |
---|
1063 | } |
---|
1064 | m_GOPListsMvc[k][MAX_GOP].m_numRefPics = 0; |
---|
1065 | } |
---|
1066 | |
---|
1067 | if( m_GOPListsMvc[k][MAX_GOP].m_interRPSPrediction ) |
---|
1068 | { |
---|
1069 | printf( "\nError: inter RPS prediction not possible for FrameI_v%d, must be 0\n", k ); |
---|
1070 | bErrorIvpEnhV = true; |
---|
1071 | } |
---|
1072 | |
---|
1073 | if( m_GOPListsMvc[k][MAX_GOP].m_sliceType == 'I' && m_GOPListsMvc[k][MAX_GOP].m_numInterViewRefPics != 0 ) |
---|
1074 | { |
---|
1075 | printf( "\nError: inter-view prediction not possible for FrameI_v%d with slice type I, #IV_ref_pics must be 0\n", k ); |
---|
1076 | bErrorIvpEnhV = true; |
---|
1077 | } |
---|
1078 | |
---|
1079 | if( m_GOPListsMvc[k][MAX_GOP].m_numRefPicsActive > m_GOPListsMvc[k][MAX_GOP].m_numInterViewRefPics ) |
---|
1080 | { |
---|
1081 | m_GOPListsMvc[k][MAX_GOP].m_numRefPicsActive = m_GOPListsMvc[k][MAX_GOP].m_numInterViewRefPics; |
---|
1082 | } |
---|
1083 | |
---|
1084 | if( m_GOPListsMvc[k][MAX_GOP].m_sliceType == 'P' ) |
---|
1085 | { |
---|
1086 | if( m_GOPListsMvc[k][MAX_GOP].m_numInterViewRefPics < 1 ) |
---|
1087 | { |
---|
1088 | printf( "\nError: #IV_ref_pics must be at least one for FrameI_v%d with slice type P\n", k ); |
---|
1089 | bErrorIvpEnhV = true; |
---|
1090 | } |
---|
1091 | else |
---|
1092 | { |
---|
1093 | for( Int j = 0; j < m_GOPListsMvc[k][MAX_GOP].m_numInterViewRefPics; j++ ) |
---|
1094 | { |
---|
1095 | if( m_GOPListsMvc[k][MAX_GOP].m_interViewRefPosL1[j] != 0 ) |
---|
1096 | { |
---|
1097 | printf( "\nError: inter-view ref pos %d on L1 not possible for FrameI_v%d with slice type P\n", m_GOPListsMvc[k][MAX_GOP].m_interViewRefPosL1[j], k ); |
---|
1098 | bErrorIvpEnhV = true; |
---|
1099 | } |
---|
1100 | } |
---|
1101 | } |
---|
1102 | } |
---|
1103 | |
---|
1104 | if( m_GOPListsMvc[k][MAX_GOP].m_sliceType == 'B' && m_GOPListsMvc[k][MAX_GOP].m_numInterViewRefPics < 1 ) |
---|
1105 | { |
---|
1106 | printf( "\nError: #IV_ref_pics must be at least one for FrameI_v%d with slice type B\n", k ); |
---|
1107 | bErrorIvpEnhV = true; |
---|
1108 | } |
---|
1109 | } |
---|
1110 | } |
---|
1111 | } |
---|
1112 | } |
---|
1113 | xConfirmPara( bErrorIvpEnhV, "Invalid inter-view coding structure for enhancement views given" ); |
---|
1114 | |
---|
1115 | // validate temporal coding structure |
---|
1116 | if( !bErrorMvePoc && !bErrorIvpBase && !bErrorIvpEnhV ) |
---|
1117 | { |
---|
1118 | for( Int viewId = 0; viewId < m_iNumberOfViews; viewId++ ) |
---|
1119 | { |
---|
1120 | Bool verifiedGOP = false; |
---|
1121 | Bool errorGOP = false; |
---|
1122 | Int checkGOP = 1; |
---|
1123 | Int numRefs = 1; |
---|
1124 | Int refList[MAX_NUM_REF_PICS+1]; |
---|
1125 | refList[0] = 0; |
---|
1126 | Bool isOK[MAX_GOP]; |
---|
1127 | for( Int i = 0; i < MAX_GOP; i++ ) { isOK[i] = false; } |
---|
1128 | Int numOK = 0; |
---|
1129 | #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER |
---|
1130 | Int numReorderFramesRequired=0; |
---|
1131 | m_maxNumberOfReferencePictures=0; |
---|
1132 | Int lastDisp = -1; |
---|
1133 | #endif |
---|
1134 | m_extraRPSs[viewId] = 0; |
---|
1135 | //start looping through frames in coding order until we can verify that the GOP structure is correct. |
---|
1136 | while( !verifiedGOP && !errorGOP ) |
---|
1137 | { |
---|
1138 | Int curGOP = (checkGOP-1)%m_iGOPSize; |
---|
1139 | Int curPOC = ((checkGOP-1)/m_iGOPSize)*m_iGOPSize + m_GOPListsMvc[viewId][curGOP].m_POC; |
---|
1140 | if( m_GOPListsMvc[viewId][curGOP].m_POC < 0 ) |
---|
1141 | { |
---|
1142 | printf( "\nError: found fewer Reference Picture Sets than GOPSize for view %d\n", viewId ); |
---|
1143 | errorGOP = true; |
---|
1144 | } |
---|
1145 | else |
---|
1146 | { |
---|
1147 | //check that all reference pictures are available, or have a POC < 0 meaning they might be available in the next GOP. |
---|
1148 | Bool beforeI = false; |
---|
1149 | for( Int i = 0; i < m_GOPListsMvc[viewId][curGOP].m_numRefPics; i++ ) |
---|
1150 | { |
---|
1151 | Int absPOC = curPOC + m_GOPListsMvc[viewId][curGOP].m_referencePics[i]; |
---|
1152 | if( absPOC < 0 ) |
---|
1153 | { |
---|
1154 | beforeI = true; |
---|
1155 | } |
---|
1156 | else |
---|
1157 | { |
---|
1158 | Bool found = false; |
---|
1159 | for( Int j = 0; j < numRefs; j++ ) |
---|
1160 | { |
---|
1161 | if( refList[j] == absPOC ) |
---|
1162 | { |
---|
1163 | found = true; |
---|
1164 | for( Int k = 0; k < m_iGOPSize; k++ ) |
---|
1165 | { |
---|
1166 | if( absPOC%m_iGOPSize == m_GOPListsMvc[viewId][k].m_POC%m_iGOPSize ) |
---|
1167 | { |
---|
1168 | m_GOPListsMvc[viewId][curGOP].m_usedByCurrPic[i] = (m_GOPListsMvc[viewId][k].m_temporalId <= m_GOPListsMvc[viewId][curGOP].m_temporalId); |
---|
1169 | } |
---|
1170 | } |
---|
1171 | } |
---|
1172 | } |
---|
1173 | if( !found ) |
---|
1174 | { |
---|
1175 | printf("\nError: ref pic %d is not available for GOP frame %d of view %d\n", m_GOPListsMvc[viewId][curGOP].m_referencePics[i], curGOP+1, viewId ); |
---|
1176 | errorGOP = true; |
---|
1177 | } |
---|
1178 | } |
---|
1179 | } |
---|
1180 | if( !beforeI && !errorGOP ) |
---|
1181 | { |
---|
1182 | //all ref frames were present |
---|
1183 | if( !isOK[curGOP] ) |
---|
1184 | { |
---|
1185 | numOK++; |
---|
1186 | isOK[curGOP] = true; |
---|
1187 | if( numOK == m_iGOPSize ) |
---|
1188 | { |
---|
1189 | verifiedGOP = true; |
---|
1190 | } |
---|
1191 | } |
---|
1192 | } |
---|
1193 | else |
---|
1194 | { |
---|
1195 | //create a new GOPEntry for this frame containing all the reference pictures that were available (POC > 0) |
---|
1196 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]] = m_GOPListsMvc[viewId][curGOP]; |
---|
1197 | Int newRefs = 0; |
---|
1198 | for( Int i = 0; i < m_GOPListsMvc[viewId][curGOP].m_numRefPics; i++ ) |
---|
1199 | { |
---|
1200 | Int absPOC = curPOC + m_GOPListsMvc[viewId][curGOP].m_referencePics[i]; |
---|
1201 | if( absPOC >= 0 ) |
---|
1202 | { |
---|
1203 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_referencePics[newRefs] = m_GOPListsMvc[viewId][curGOP].m_referencePics[i]; |
---|
1204 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_usedByCurrPic[newRefs] = m_GOPListsMvc[viewId][curGOP].m_usedByCurrPic[i]; |
---|
1205 | newRefs++; |
---|
1206 | } |
---|
1207 | } |
---|
1208 | Int numPrefRefs = m_GOPListsMvc[viewId][curGOP].m_numRefPicsActive; |
---|
1209 | |
---|
1210 | for( Int offset = -1; offset > -checkGOP; offset-- ) |
---|
1211 | { |
---|
1212 | //step backwards in coding order and include any extra available pictures we might find useful to replace the ones with POC < 0. |
---|
1213 | Int offGOP = (checkGOP - 1 + offset)%m_iGOPSize; |
---|
1214 | Int offPOC = ((checkGOP - 1 + offset)/m_iGOPSize) * m_iGOPSize + m_GOPListsMvc[viewId][offGOP].m_POC; |
---|
1215 | if( offPOC >= 0 && m_GOPListsMvc[viewId][offGOP].m_refPic && m_GOPListsMvc[viewId][offGOP].m_temporalId <= m_GOPListsMvc[viewId][curGOP].m_temporalId ) |
---|
1216 | { |
---|
1217 | Bool newRef = false; |
---|
1218 | for( Int i = 0; i < numRefs; i++ ) |
---|
1219 | { |
---|
1220 | if( refList[i] == offPOC ) |
---|
1221 | { |
---|
1222 | newRef = true; |
---|
1223 | } |
---|
1224 | } |
---|
1225 | for( Int i = 0; i < newRefs; i++ ) |
---|
1226 | { |
---|
1227 | if( m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_referencePics[i] == (offPOC - curPOC) ) |
---|
1228 | { |
---|
1229 | newRef = false; |
---|
1230 | } |
---|
1231 | } |
---|
1232 | if( newRef ) |
---|
1233 | { |
---|
1234 | Int insertPoint = newRefs; |
---|
1235 | //this picture can be added, find appropriate place in list and insert it. |
---|
1236 | for( Int j = 0; j < newRefs; j++ ) |
---|
1237 | { |
---|
1238 | if( m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_referencePics[j] < (offPOC - curPOC) || |
---|
1239 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_referencePics[j] > 0 ) |
---|
1240 | { |
---|
1241 | insertPoint = j; |
---|
1242 | break; |
---|
1243 | } |
---|
1244 | } |
---|
1245 | Int prev = offPOC - curPOC; |
---|
1246 | Int prevUsed = (m_GOPListsMvc[viewId][offGOP].m_temporalId <= m_GOPListsMvc[viewId][curGOP].m_temporalId); |
---|
1247 | for( Int j = insertPoint; j < newRefs+1; j++ ) |
---|
1248 | { |
---|
1249 | Int newPrev = m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_referencePics[j]; |
---|
1250 | Int newUsed = m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_usedByCurrPic[j]; |
---|
1251 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_referencePics[j] = prev; |
---|
1252 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_usedByCurrPic[j] = prevUsed; |
---|
1253 | prevUsed = newUsed; |
---|
1254 | prev = newPrev; |
---|
1255 | } |
---|
1256 | newRefs++; |
---|
1257 | } |
---|
1258 | } |
---|
1259 | if( newRefs >= numPrefRefs ) |
---|
1260 | { |
---|
1261 | break; |
---|
1262 | } |
---|
1263 | } |
---|
1264 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_numRefPics = newRefs; |
---|
1265 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_POC = curPOC; |
---|
1266 | if( m_extraRPSs[viewId] == 0 ) |
---|
1267 | { |
---|
1268 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_interRPSPrediction = 0; |
---|
1269 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_numRefIdc = 0; |
---|
1270 | } |
---|
1271 | else |
---|
1272 | { |
---|
1273 | Int rIdx = m_iGOPSize + m_extraRPSs[viewId] - 1; |
---|
1274 | Int refPOC = m_GOPListsMvc[viewId][rIdx].m_POC; |
---|
1275 | Int refPics = m_GOPListsMvc[viewId][rIdx].m_numRefPics; |
---|
1276 | Int newIdc = 0; |
---|
1277 | for( Int i = 0; i <= refPics; i++ ) |
---|
1278 | { |
---|
1279 | Int deltaPOC = ((i != refPics)? m_GOPListsMvc[viewId][rIdx].m_referencePics[i] : 0); // check if the reference abs POC is >= 0 |
---|
1280 | Int absPOCref = refPOC + deltaPOC; |
---|
1281 | Int refIdc = 0; |
---|
1282 | for( Int j = 0; j < m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_numRefPics; j++ ) |
---|
1283 | { |
---|
1284 | if( (absPOCref - curPOC) == m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_referencePics[j] ) |
---|
1285 | { |
---|
1286 | if( m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_usedByCurrPic[j] ) |
---|
1287 | { |
---|
1288 | refIdc = 1; |
---|
1289 | } |
---|
1290 | else |
---|
1291 | { |
---|
1292 | refIdc = 2; |
---|
1293 | } |
---|
1294 | } |
---|
1295 | } |
---|
1296 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_refIdc[newIdc] = refIdc; |
---|
1297 | newIdc++; |
---|
1298 | } |
---|
1299 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_interRPSPrediction = 1; |
---|
1300 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_numRefIdc = newIdc; |
---|
1301 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_deltaRPS = refPOC - m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_POC; |
---|
1302 | m_GOPListsMvc[viewId][m_iGOPSize+m_extraRPSs[viewId]].m_deltaRIdxMinus1 = 0; |
---|
1303 | } |
---|
1304 | curGOP = m_iGOPSize + m_extraRPSs[viewId]; |
---|
1305 | m_extraRPSs[viewId]++; |
---|
1306 | } |
---|
1307 | numRefs = 0; |
---|
1308 | for( Int i = 0; i < m_GOPListsMvc[viewId][curGOP].m_numRefPics; i++ ) |
---|
1309 | { |
---|
1310 | Int absPOC = curPOC + m_GOPListsMvc[viewId][curGOP].m_referencePics[i]; |
---|
1311 | if( absPOC >= 0 ) |
---|
1312 | { |
---|
1313 | refList[numRefs] = absPOC; |
---|
1314 | numRefs++; |
---|
1315 | } |
---|
1316 | } |
---|
1317 | #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER |
---|
1318 | if(m_maxNumberOfReferencePictures<numRefs) |
---|
1319 | { |
---|
1320 | m_maxNumberOfReferencePictures=numRefs; |
---|
1321 | } |
---|
1322 | #endif |
---|
1323 | refList[numRefs] = curPOC; |
---|
1324 | numRefs++; |
---|
1325 | #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER |
---|
1326 | Int nonDisplayed=0; |
---|
1327 | for(Int i=0; i<numRefs; i++) |
---|
1328 | { |
---|
1329 | if(refList[i]==lastDisp+1) |
---|
1330 | { |
---|
1331 | lastDisp=refList[i]; |
---|
1332 | i=0; |
---|
1333 | } |
---|
1334 | } |
---|
1335 | for(Int i=0; i<numRefs; i++) |
---|
1336 | { |
---|
1337 | if(refList[i]>lastDisp) |
---|
1338 | { |
---|
1339 | nonDisplayed++; |
---|
1340 | } |
---|
1341 | } |
---|
1342 | if(nonDisplayed>numReorderFramesRequired) |
---|
1343 | { |
---|
1344 | numReorderFramesRequired=nonDisplayed; |
---|
1345 | } |
---|
1346 | #endif |
---|
1347 | } |
---|
1348 | checkGOP++; |
---|
1349 | } |
---|
1350 | #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER |
---|
1351 | if (m_numReorderFrames == -1) |
---|
1352 | { |
---|
1353 | m_numReorderFrames = numReorderFramesRequired; |
---|
1354 | } |
---|
1355 | #endif |
---|
1356 | xConfirmPara( errorGOP, "Invalid GOP structure given" ); |
---|
1357 | #if H0566_TLA |
---|
1358 | m_maxTempLayer[viewId] = 1; |
---|
1359 | #endif |
---|
1360 | for( Int i = 0; i < m_iGOPSize; i++ ) |
---|
1361 | { |
---|
1362 | #if H0566_TLA |
---|
1363 | if( m_GOPListsMvc[viewId][i].m_temporalId >= m_maxTempLayer[viewId] ) |
---|
1364 | { |
---|
1365 | m_maxTempLayer[viewId] = m_GOPListsMvc[viewId][i].m_temporalId + 1; |
---|
1366 | } |
---|
1367 | #endif |
---|
1368 | xConfirmPara( m_GOPListsMvc[viewId][i].m_sliceType != 'B' && m_GOPListsMvc[viewId][i].m_sliceType != 'P', "Slice type must be equal to B or P" ); |
---|
1369 | } |
---|
1370 | |
---|
1371 | #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER |
---|
1372 | for( Int i = 0; i < MAX_TLAYER; i++ ) |
---|
1373 | { |
---|
1374 | m_numReorderPics[viewId][i] = 0; |
---|
1375 | m_maxDecPicBuffering[viewId][i] = 0; |
---|
1376 | } |
---|
1377 | for( Int i = 0; i < m_iGOPSize; i++ ) |
---|
1378 | { |
---|
1379 | if( m_GOPListsMvc[viewId][i].m_numRefPics > m_maxDecPicBuffering[viewId][m_GOPListsMvc[viewId][i].m_temporalId] ) |
---|
1380 | { |
---|
1381 | m_maxDecPicBuffering[viewId][m_GOPListsMvc[viewId][i].m_temporalId] = m_GOPListsMvc[viewId][i].m_numRefPics; |
---|
1382 | } |
---|
1383 | Int highestDecodingNumberWithLowerPOC = 0; |
---|
1384 | for( Int j = 0; j < m_iGOPSize; j++ ) |
---|
1385 | { |
---|
1386 | if( m_GOPListsMvc[viewId][j].m_POC <= m_GOPListsMvc[viewId][i].m_POC ) |
---|
1387 | { |
---|
1388 | highestDecodingNumberWithLowerPOC = j; |
---|
1389 | } |
---|
1390 | } |
---|
1391 | Int numReorder = 0; |
---|
1392 | for( Int j = 0; j < highestDecodingNumberWithLowerPOC; j++ ) |
---|
1393 | { |
---|
1394 | if( m_GOPListsMvc[viewId][j].m_temporalId <= m_GOPListsMvc[viewId][i].m_temporalId && |
---|
1395 | m_GOPListsMvc[viewId][j].m_POC > m_GOPListsMvc[viewId][i].m_POC ) |
---|
1396 | { |
---|
1397 | numReorder++; |
---|
1398 | } |
---|
1399 | } |
---|
1400 | if( numReorder > m_numReorderPics[viewId][m_GOPListsMvc[viewId][i].m_temporalId] ) |
---|
1401 | { |
---|
1402 | m_numReorderPics[viewId][m_GOPListsMvc[viewId][i].m_temporalId] = numReorder; |
---|
1403 | } |
---|
1404 | } |
---|
1405 | for( Int i = 0; i < MAX_TLAYER-1; i++ ) |
---|
1406 | { |
---|
1407 | // a lower layer can not have higher value of m_numReorderPics than a higher layer |
---|
1408 | if( m_numReorderPics[viewId][i+1] < m_numReorderPics[viewId][i] ) |
---|
1409 | { |
---|
1410 | m_numReorderPics[viewId][i+1] = m_numReorderPics[viewId][i]; |
---|
1411 | } |
---|
1412 | // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ], inclusive |
---|
1413 | if( m_numReorderPics[viewId][i] > m_maxDecPicBuffering[viewId][i] ) |
---|
1414 | { |
---|
1415 | m_maxDecPicBuffering[viewId][i] = m_numReorderPics[viewId][i]; |
---|
1416 | } |
---|
1417 | // a lower layer can not have higher value of m_uiMaxDecPicBuffering than a higher layer |
---|
1418 | if( m_maxDecPicBuffering[viewId][i+1] < m_maxDecPicBuffering[viewId][i] ) |
---|
1419 | { |
---|
1420 | m_maxDecPicBuffering[viewId][i+1] = m_maxDecPicBuffering[viewId][i]; |
---|
1421 | } |
---|
1422 | } |
---|
1423 | // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ], inclusive |
---|
1424 | if( m_numReorderPics[viewId][MAX_TLAYER-1] > m_maxDecPicBuffering[viewId][MAX_TLAYER-1] ) |
---|
1425 | { |
---|
1426 | m_maxDecPicBuffering[viewId][MAX_TLAYER-1] = m_numReorderPics[viewId][MAX_TLAYER-1]; |
---|
1427 | } |
---|
1428 | #endif |
---|
1429 | |
---|
1430 | #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER |
---|
1431 | xConfirmPara( m_bUseLComb == false && m_numReorderPics[viewId][MAX_TLAYER-1] != 0, "ListCombination can only be 0 in low delay coding (more precisely when L0 and L1 are identical)" ); // Note however this is not the full necessary condition as ref_pic_list_combination_flag can only be 0 if L0 == L1. |
---|
1432 | #else |
---|
1433 | xConfirmPara( m_bUseLComb==false && m_numReorderFrames!=0, "ListCombination can only be 0 in low delay coding (more precisely when L0 and L1 are identical)" ); // Note however this is not the full necessary condition as ref_pic_list_combination_flag can only be 0 if L0 == L1. |
---|
1434 | xConfirmPara( m_numReorderFrames < numReorderFramesRequired, "For the used GOP the encoder requires more pictures for reordering than specified in MaxNumberOfReorderPictures" ); |
---|
1435 | #endif |
---|
1436 | } |
---|
1437 | } |
---|
1438 | #undef xConfirmPara |
---|
1439 | if( check_failed ) |
---|
1440 | { |
---|
1441 | exit(EXIT_FAILURE); |
---|
1442 | } |
---|
1443 | } |
---|
1444 | |
---|
1445 | template <class T> |
---|
1446 | Void |
---|
1447 | TAppEncCfg::xCleanUpVector( std::vector<T>& rcVec, const T& rcInvalid ) |
---|
1448 | { |
---|
1449 | Int iFirstInv = (Int)rcVec.size(); |
---|
1450 | for( Int iIdx = 0; iIdx < (Int)rcVec.size(); iIdx++ ) |
---|
1451 | { |
---|
1452 | if( rcVec[ iIdx ] == rcInvalid ) |
---|
1453 | { |
---|
1454 | iFirstInv = iIdx; |
---|
1455 | break; |
---|
1456 | } |
---|
1457 | } |
---|
1458 | while( (Int)rcVec.size() > iFirstInv ) |
---|
1459 | { |
---|
1460 | rcVec.pop_back(); |
---|
1461 | } |
---|
1462 | } |
---|
1463 | |
---|
1464 | Void |
---|
1465 | TAppEncCfg::xCleanUpVectors() |
---|
1466 | { |
---|
1467 | xCleanUpVector( m_pchInputFileList, (char*)0 ); |
---|
1468 | xCleanUpVector( m_pchDepthInputFileList, (char*)0 ); |
---|
1469 | xCleanUpVector( m_pchReconFileList, (char*)0 ); |
---|
1470 | xCleanUpVector( m_pchDepthReconFileList, (char*)0 ); |
---|
1471 | } |
---|
1472 | |
---|
1473 | /** \todo use of global variables should be removed later |
---|
1474 | */ |
---|
1475 | Void TAppEncCfg::xSetGlobal() |
---|
1476 | { |
---|
1477 | // set max CU width & height |
---|
1478 | g_uiMaxCUWidth = m_uiMaxCUWidth; |
---|
1479 | g_uiMaxCUHeight = m_uiMaxCUHeight; |
---|
1480 | |
---|
1481 | // compute actual CU depth with respect to config depth and max transform size |
---|
1482 | g_uiAddCUDepth = 0; |
---|
1483 | while( (m_uiMaxCUWidth>>m_uiMaxCUDepth) > ( 1 << ( m_uiQuadtreeTULog2MinSize + g_uiAddCUDepth ) ) ) g_uiAddCUDepth++; |
---|
1484 | |
---|
1485 | m_uiMaxCUDepth += g_uiAddCUDepth; |
---|
1486 | g_uiAddCUDepth++; |
---|
1487 | g_uiMaxCUDepth = m_uiMaxCUDepth; |
---|
1488 | |
---|
1489 | // set internal bit-depth and constants |
---|
1490 | #if FULL_NBIT |
---|
1491 | g_uiBitDepth = m_uiInternalBitDepth; |
---|
1492 | g_uiBitIncrement = 0; |
---|
1493 | #else |
---|
1494 | g_uiBitDepth = 8; |
---|
1495 | g_uiBitIncrement = m_uiInternalBitDepth - g_uiBitDepth; |
---|
1496 | #endif |
---|
1497 | |
---|
1498 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
1499 | g_iDeltaDCsQuantOffset = g_uiBitIncrement - 2; |
---|
1500 | #endif |
---|
1501 | |
---|
1502 | g_uiBASE_MAX = ((1<<(g_uiBitDepth))-1); |
---|
1503 | |
---|
1504 | #if IBDI_NOCLIP_RANGE |
---|
1505 | g_uiIBDI_MAX = g_uiBASE_MAX << g_uiBitIncrement; |
---|
1506 | #else |
---|
1507 | g_uiIBDI_MAX = ((1<<(g_uiBitDepth+g_uiBitIncrement))-1); |
---|
1508 | #endif |
---|
1509 | |
---|
1510 | if (m_uiOutputBitDepth == 0) |
---|
1511 | { |
---|
1512 | m_uiOutputBitDepth = m_uiInternalBitDepth; |
---|
1513 | } |
---|
1514 | |
---|
1515 | g_uiPCMBitDepthLuma = m_uiPCMBitDepthLuma = ((m_bPCMInputBitDepthFlag)? m_uiInputBitDepth : m_uiInternalBitDepth); |
---|
1516 | g_uiPCMBitDepthChroma = ((m_bPCMInputBitDepthFlag)? m_uiInputBitDepth : m_uiInternalBitDepth); |
---|
1517 | } |
---|
1518 | |
---|
1519 | Void TAppEncCfg::xPrintParameter() |
---|
1520 | { |
---|
1521 | printf("\n"); |
---|
1522 | for( Int iCounter = 0; iCounter< m_iNumberOfViews; iCounter++) |
---|
1523 | { |
---|
1524 | printf("Texture Input File %i : %s\n", iCounter, m_pchInputFileList[iCounter]); |
---|
1525 | } |
---|
1526 | if( m_bUsingDepthMaps ) |
---|
1527 | { |
---|
1528 | for( Int iCounter = 0; iCounter < m_iNumberOfViews; iCounter++) |
---|
1529 | { |
---|
1530 | printf("Depth Input File %i : %s\n", iCounter, m_pchDepthInputFileList[iCounter]); |
---|
1531 | } |
---|
1532 | } |
---|
1533 | printf("Bitstream File : %s\n", m_pchBitstreamFile ); |
---|
1534 | for( Int iCounter = 0; iCounter< m_iNumberOfViews; iCounter++) |
---|
1535 | { |
---|
1536 | printf("Texture Reconstruction File %i : %s\n", iCounter, m_pchReconFileList[iCounter]); |
---|
1537 | } |
---|
1538 | if( m_bUsingDepthMaps ) |
---|
1539 | { |
---|
1540 | for( Int iCounter = 0; iCounter< m_iNumberOfViews; iCounter++) |
---|
1541 | { |
---|
1542 | printf("Depth Reconstruction File %i : %s\n", iCounter, m_pchDepthReconFileList[iCounter]); |
---|
1543 | } |
---|
1544 | } |
---|
1545 | #if PIC_CROPPING |
---|
1546 | printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_cropLeft - m_cropRight, m_iSourceHeight - m_cropTop - m_cropBottom, m_iFrameRate ); |
---|
1547 | #else |
---|
1548 | printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_aiPad[0], m_iSourceHeight-m_aiPad[1], m_iFrameRate ); |
---|
1549 | #endif |
---|
1550 | printf("Internal Format : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate ); |
---|
1551 | printf("Frame index : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_iFrameToBeEncoded-1, m_iFrameToBeEncoded ); |
---|
1552 | printf("CU size / depth : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth ); |
---|
1553 | printf("RQT trans. size (min / max) : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize ); |
---|
1554 | printf("Max RQT depth inter : %d\n", m_uiQuadtreeTUMaxDepthInter); |
---|
1555 | printf("Max RQT depth intra : %d\n", m_uiQuadtreeTUMaxDepthIntra); |
---|
1556 | printf("Min PCM size : %d\n", 1 << m_uiPCMLog2MinSize); |
---|
1557 | printf("Motion search range : %d\n", m_iSearchRange ); |
---|
1558 | printf("Intra period : %d\n", m_iIntraPeriod ); |
---|
1559 | printf("Decoding refresh type : %d\n", m_iDecodingRefreshType ); |
---|
1560 | printf("QP Texture : %5.2f\n", m_adQP[0] ); |
---|
1561 | if( m_bUsingDepthMaps ) |
---|
1562 | { |
---|
1563 | printf("QP Depth : %5.2f\n", m_adQP[ m_adQP.size() < 2 ? 0 : 1] ); |
---|
1564 | } |
---|
1565 | printf("Max dQP signaling depth : %d\n", m_iMaxCuDQPDepth); |
---|
1566 | |
---|
1567 | printf("Chroma Qp Offset : %d\n", m_iChromaQpOffset ); |
---|
1568 | printf("Chroma Qp Offset 2nd : %d\n", m_iChromaQpOffset2nd); |
---|
1569 | |
---|
1570 | printf("QP adaptation : %d (range=%d)\n", m_bUseAdaptiveQP, (m_bUseAdaptiveQP ? m_iQPAdaptationRange : 0) ); |
---|
1571 | printf("GOP size : %d\n", m_iGOPSize ); |
---|
1572 | printf("Internal bit depth : %d\n", m_uiInternalBitDepth ); |
---|
1573 | printf("PCM sample bit depth : %d\n", m_uiPCMBitDepthLuma ); |
---|
1574 | if((m_uiMaxCUWidth >> m_uiMaxCUDepth) == 4) |
---|
1575 | { |
---|
1576 | printf("DisableInter4x4 : %d\n", m_bDisInter4x4); |
---|
1577 | } |
---|
1578 | |
---|
1579 | printf("Loop Filter Disabled : %d %d\n", m_abLoopFilterDisable[0] ? 1 : 0, m_abLoopFilterDisable[1] ? 1 : 0 ); |
---|
1580 | printf("Coded Camera Param. Precision: %d\n", m_iCodedCamParPrecision); |
---|
1581 | |
---|
1582 | #if HHI_VSO |
---|
1583 | printf("Force use of Lambda Scale : %d\n", m_bForceLambdaScaleVSO ); |
---|
1584 | |
---|
1585 | if ( m_bUseVSO ) |
---|
1586 | { |
---|
1587 | printf("VSO Lambda Scale : %5.2f\n", m_dLambdaScaleVSO ); |
---|
1588 | printf("VSO Mode : %d\n", m_uiVSOMode ); |
---|
1589 | printf("VSO Config : %s\n", m_pchVSOConfig ); |
---|
1590 | #if HHI_VSO_DIST_INT |
---|
1591 | printf("VSO Negative Distortion : %d\n", m_bAllowNegDist ? 1 : 0); |
---|
1592 | #endif |
---|
1593 | #if HHI_VSO_LS_TABLE |
---|
1594 | printf("VSO LS Table : %d\n", m_bVSOLSTable ? 1 : 0); |
---|
1595 | #endif |
---|
1596 | #if SAIT_VSO_EST_A0033 |
---|
1597 | printf("VSO Estimated VSD : %d\n", m_bUseEstimatedVSD ? 1 : 0); |
---|
1598 | #endif |
---|
1599 | #if LGE_VSO_EARLY_SKIP_A0093 |
---|
1600 | printf("VSO Early Skip : %d\n", m_bVSOEarlySkip ? 1 : 0); |
---|
1601 | #endif |
---|
1602 | |
---|
1603 | } |
---|
1604 | #endif |
---|
1605 | #if HHI_INTERVIEW_SKIP |
---|
1606 | printf("InterView Skip: : %d\n", m_bInterViewSkip ? 1:0 ); |
---|
1607 | printf("InterView Skip Lambda Scale : %f\n", m_dInterViewSkipLambdaScale ); |
---|
1608 | #endif |
---|
1609 | |
---|
1610 | printf("\n"); |
---|
1611 | |
---|
1612 | printf("TOOL CFG General: "); |
---|
1613 | #if LCU_SYNTAX_ALF |
---|
1614 | printf("ALFMNF:%d ", m_iALFMaxNumberFilters); |
---|
1615 | printf("ALFInSlice:%d ", m_bALFParamInSlice); |
---|
1616 | printf("ALFPicEnc:%d ", m_bALFPicBasedEncode); |
---|
1617 | #endif |
---|
1618 | printf("IBD:%d ", !!g_uiBitIncrement); |
---|
1619 | printf("HAD:%d ", m_bUseHADME ); |
---|
1620 | printf("SRD:%d ", m_bUseSBACRD ); |
---|
1621 | printf("SQP:%d ", m_uiDeltaQpRD ); |
---|
1622 | printf("ASR:%d ", m_bUseASR ); |
---|
1623 | #if !PIC_CROPPING |
---|
1624 | printf("PAD:%d ", m_bUsePAD ); |
---|
1625 | #endif |
---|
1626 | printf("LComb:%d ", m_bUseLComb ); |
---|
1627 | printf("LCMod:%d ", m_bLCMod ); |
---|
1628 | printf("FEN:%d ", m_bUseFastEnc ); |
---|
1629 | printf("ECU:%d ", m_bUseEarlyCU ); |
---|
1630 | #if FAST_DECISION_FOR_MRG_RD_COST |
---|
1631 | printf("FDM:%d ", m_useFastDecisionForMerge ); |
---|
1632 | #endif |
---|
1633 | printf("CFM:%d ", m_bUseCbfFastMode ); |
---|
1634 | printf("RQT:%d ", 1 ); |
---|
1635 | printf("LMC:%d ", m_bUseLMChroma ); |
---|
1636 | printf("Slice: G=%d M=%d ", m_iSliceGranularity, m_iSliceMode); |
---|
1637 | if (m_iSliceMode!=0) |
---|
1638 | { |
---|
1639 | printf("A=%d ", m_iSliceArgument); |
---|
1640 | } |
---|
1641 | printf("EntropySlice: M=%d ",m_iEntropySliceMode); |
---|
1642 | if (m_iEntropySliceMode!=0) |
---|
1643 | { |
---|
1644 | printf("A=%d ", m_iEntropySliceArgument); |
---|
1645 | } |
---|
1646 | printf("CIP:%d ", m_bUseConstrainedIntraPred); |
---|
1647 | #if BURST_IPCM |
---|
1648 | printf("PCM:%d ", (m_usePCM && (1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0); |
---|
1649 | #else |
---|
1650 | printf("PCM:%d ", ((1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0); |
---|
1651 | #endif |
---|
1652 | #if SAO_UNIT_INTERLEAVING |
---|
1653 | printf("SAOInterleaving:%d ", (m_saoInterleavingFlag)?(1):(0)); |
---|
1654 | #endif |
---|
1655 | #if LOSSLESS_CODING |
---|
1656 | printf("LosslessCuEnabled:%d ", (m_useLossless)? 1:0 ); |
---|
1657 | #endif |
---|
1658 | printf("WPP:%d ", (Int)m_bUseWeightPred); |
---|
1659 | printf("WPB:%d ", m_uiBiPredIdc); |
---|
1660 | #if !REMOVE_TILE_DEPENDENCE |
---|
1661 | printf("TileBoundaryIndependence:%d ", m_iTileBoundaryIndependenceIdr ); |
---|
1662 | #endif |
---|
1663 | printf("TileLocationInSliceHdr:%d ", m_iTileLocationInSliceHeaderFlag); |
---|
1664 | printf("TileMarker:%d", m_iTileMarkerFlag); |
---|
1665 | if (m_iTileMarkerFlag) |
---|
1666 | { |
---|
1667 | printf("[%d] ", m_iMaxTileMarkerEntryPoints); |
---|
1668 | } |
---|
1669 | else |
---|
1670 | { |
---|
1671 | printf(" "); |
---|
1672 | } |
---|
1673 | printf(" WaveFrontSynchro:%d WaveFrontFlush:%d WaveFrontSubstreams:%d", |
---|
1674 | m_iWaveFrontSynchro, m_iWaveFrontFlush, m_iWaveFrontSubstreams); |
---|
1675 | printf(" ScalingList:%d ", m_useScalingListId ); |
---|
1676 | |
---|
1677 | printf("TMVP:%d ", m_enableTMVP ); |
---|
1678 | |
---|
1679 | #if ADAPTIVE_QP_SELECTION |
---|
1680 | printf("AQpS:%d", m_bUseAdaptQpSelect ); |
---|
1681 | #endif |
---|
1682 | |
---|
1683 | #if MULTIBITS_DATA_HIDING |
---|
1684 | printf(" SignBitHidingFlag:%d SignBitHidingThreshold:%d", m_signHideFlag, m_signHidingThreshold); |
---|
1685 | #endif |
---|
1686 | printf("\n"); |
---|
1687 | printf("TOOL CFG VIDEO : "); |
---|
1688 | printf("ALF:%d ", (m_abUseALF [0] ? 1 : 0) ); |
---|
1689 | printf("SAO:%d ", (m_abUseSAO [0] ? 1 : 0)); |
---|
1690 | printf("RDQ:%d ", (m_abUseRDOQ[0] ? 1 : 0) ); |
---|
1691 | printf("\n"); |
---|
1692 | |
---|
1693 | printf("TOOL CFG DEPTH : "); |
---|
1694 | printf("ALF:%d ", (m_abUseALF [1] ? 1 : 0)); |
---|
1695 | printf("SAO:%d ", (m_abUseSAO [1] ? 1 : 0)); |
---|
1696 | printf("RDQ:%d ", (m_abUseRDOQ[1] ? 1 : 0)); |
---|
1697 | #if HHI_VSO |
---|
1698 | printf("VSO:%d ", m_bUseVSO ); |
---|
1699 | #endif |
---|
1700 | #if LGE_WVSO_A0119 |
---|
1701 | printf("WVSO:%d ", m_bWVSO ); |
---|
1702 | #endif |
---|
1703 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
1704 | printf("DMM:%d ", m_bUseDMM ); |
---|
1705 | #endif |
---|
1706 | #if HHI_MPI |
---|
1707 | printf("MVI:%d ", m_bUseMVI ? 1 : 0 ); |
---|
1708 | #endif |
---|
1709 | #if LGE_WVSO_A0119 |
---|
1710 | printf("\nVSO : SAIT : SAD weight = %d : %d : %d ", m_iVSOWeight, m_iVSDWeight, m_iDWeight ); |
---|
1711 | #endif |
---|
1712 | printf("\n\n"); |
---|
1713 | |
---|
1714 | fflush(stdout); |
---|
1715 | } |
---|
1716 | |
---|
1717 | Void TAppEncCfg::xPrintUsage() |
---|
1718 | { |
---|
1719 | printf( " <name> = ALF - adaptive loop filter\n"); |
---|
1720 | printf( " IBD - bit-depth increasement\n"); |
---|
1721 | printf( " GPB - generalized B instead of P in low-delay mode\n"); |
---|
1722 | printf( " HAD - hadamard ME for fractional-pel\n"); |
---|
1723 | printf( " SRD - SBAC based RD estimation\n"); |
---|
1724 | printf( " RDQ - RDOQ\n"); |
---|
1725 | printf( " LDC - low-delay mode\n"); |
---|
1726 | printf( " NRF - non-reference frame marking in last layer\n"); |
---|
1727 | printf( " BQP - hier-P style QP assignment in low-delay mode\n"); |
---|
1728 | printf( " PAD - automatic source padding of multiple of 16\n"); |
---|
1729 | printf( " ASR - adaptive motion search range\n"); |
---|
1730 | printf( " FEN - fast encoder setting\n"); |
---|
1731 | printf( " ECU - Early CU setting\n"); |
---|
1732 | printf( " CFM - Cbf fast mode setting\n"); |
---|
1733 | printf( " LMC - intra chroma prediction based on luma\n"); |
---|
1734 | printf( "\n" ); |
---|
1735 | printf( " Example 1) TAppEncoder.exe -c test.cfg -q 32 -g 8 -f 9 -s 64 -h 4\n"); |
---|
1736 | printf(" -> QP 32, hierarchical-B GOP 8, 9 frames, 64x64-8x8 CU (~4x4 PU)\n\n"); |
---|
1737 | printf( " Example 2) TAppEncoder.exe -c test.cfg -q 32 -g 4 -f 9 -s 64 -h 4 -1 LDC\n"); |
---|
1738 | printf(" -> QP 32, hierarchical-P GOP 4, 9 frames, 64x64-8x8 CU (~4x4 PU)\n\n"); |
---|
1739 | } |
---|
1740 | |
---|
1741 | Bool confirmPara(Bool bflag, const char* message) |
---|
1742 | { |
---|
1743 | if (!bflag) |
---|
1744 | return false; |
---|
1745 | |
---|
1746 | printf("Error: %s\n",message); |
---|
1747 | return true; |
---|
1748 | } |
---|
1749 | |
---|
1750 | /* helper function */ |
---|
1751 | /* for handling "-1/-0 FOO" */ |
---|
1752 | void translateOldStyleCmdline(const char* value, po::Options& opts, const std::string& arg) |
---|
1753 | { |
---|
1754 | const char* argv[] = {arg.c_str(), value}; |
---|
1755 | /* replace some short names with their long name varients */ |
---|
1756 | if (arg == "LDC") |
---|
1757 | { |
---|
1758 | argv[0] = "LowDelayCoding"; |
---|
1759 | } |
---|
1760 | else if (arg == "RDQ") |
---|
1761 | { |
---|
1762 | argv[0] = "RDOQ"; |
---|
1763 | } |
---|
1764 | else if (arg == "HAD") |
---|
1765 | { |
---|
1766 | argv[0] = "HadamardME"; |
---|
1767 | } |
---|
1768 | else if (arg == "SRD") |
---|
1769 | { |
---|
1770 | argv[0] = "SBACRD"; |
---|
1771 | } |
---|
1772 | else if (arg == "IBD") |
---|
1773 | { |
---|
1774 | argv[0] = "BitIncrement"; |
---|
1775 | } |
---|
1776 | /* issue a warning for change in FEN behaviour */ |
---|
1777 | if (arg == "FEN") |
---|
1778 | { |
---|
1779 | /* xxx todo */ |
---|
1780 | } |
---|
1781 | po::storePair(opts, argv[0], argv[1]); |
---|
1782 | } |
---|
1783 | |
---|
1784 | void doOldStyleCmdlineOn(po::Options& opts, const std::string& arg) |
---|
1785 | { |
---|
1786 | if (arg == "IBD") |
---|
1787 | { |
---|
1788 | translateOldStyleCmdline("4", opts, arg); |
---|
1789 | return; |
---|
1790 | } |
---|
1791 | translateOldStyleCmdline("1", opts, arg); |
---|
1792 | } |
---|
1793 | |
---|
1794 | void doOldStyleCmdlineOff(po::Options& opts, const std::string& arg) |
---|
1795 | { |
---|
1796 | translateOldStyleCmdline("0", opts, arg); |
---|
1797 | } |
---|
1798 | |
---|
1799 | Void TAppEncCfg::xAppendToFileNameEnd( Char* pchInputFileName, const Char* pchStringToAppend, Char*& rpchOutputFileName) |
---|
1800 | { |
---|
1801 | size_t iInLength = strlen(pchInputFileName); |
---|
1802 | size_t iAppendLength = strlen(pchStringToAppend); |
---|
1803 | |
---|
1804 | rpchOutputFileName = (Char*) malloc(iInLength+iAppendLength+1); |
---|
1805 | Char* pCDot = strrchr(pchInputFileName,'.'); |
---|
1806 | pCDot = pCDot ? pCDot : pchInputFileName + iInLength; |
---|
1807 | size_t iCharsToDot = pCDot - pchInputFileName ; |
---|
1808 | size_t iCharsToEnd = iInLength - iCharsToDot; |
---|
1809 | strncpy(rpchOutputFileName , pchInputFileName , iCharsToDot ); |
---|
1810 | strncpy(rpchOutputFileName+ iCharsToDot , pchStringToAppend , iAppendLength); |
---|
1811 | strncpy(rpchOutputFileName+ iCharsToDot+iAppendLength , pchInputFileName+iCharsToDot, iCharsToEnd ); |
---|
1812 | rpchOutputFileName[iInLength+iAppendLength] = '\0'; |
---|
1813 | } |
---|
1814 | |
---|
1815 | //! \} |
---|