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-2011, 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 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 | |
---|
35 | |
---|
36 | /** \file TAppEncCfg.cpp |
---|
37 | \brief Handle encoder configuration parameters |
---|
38 | */ |
---|
39 | |
---|
40 | #include <stdlib.h> |
---|
41 | #include <math.h> |
---|
42 | #include <cassert> |
---|
43 | #include <cstring> |
---|
44 | #include <string> |
---|
45 | #include "TAppEncCfg.h" |
---|
46 | #include "../../App/TAppCommon/program_options_lite.h" |
---|
47 | |
---|
48 | |
---|
49 | using namespace std; |
---|
50 | namespace po = df::program_options_lite; |
---|
51 | |
---|
52 | /* configuration helper funcs */ |
---|
53 | void doOldStyleCmdlineOn(po::Options& opts, const std::string& arg); |
---|
54 | void doOldStyleCmdlineOff(po::Options& opts, const std::string& arg); |
---|
55 | |
---|
56 | // ==================================================================================================================== |
---|
57 | // Local constants |
---|
58 | // ==================================================================================================================== |
---|
59 | |
---|
60 | /// max value of source padding size |
---|
61 | /** \todo replace it by command line option |
---|
62 | */ |
---|
63 | #define MAX_PAD_SIZE 16 |
---|
64 | #define MAX_INPUT_VIEW_NUM 10 |
---|
65 | #define MAX_ERREF_VIEW_NUM 15 |
---|
66 | |
---|
67 | // ==================================================================================================================== |
---|
68 | // Constructor / destructor / initialization / destroy |
---|
69 | // ==================================================================================================================== |
---|
70 | |
---|
71 | TAppEncCfg::TAppEncCfg() |
---|
72 | { |
---|
73 | m_aidQP = NULL; |
---|
74 | #if HHI_VSO |
---|
75 | m_aaiERViewRefLutInd.resize( MAX_INPUT_VIEW_NUM ); |
---|
76 | #endif |
---|
77 | } |
---|
78 | |
---|
79 | TAppEncCfg::~TAppEncCfg() |
---|
80 | { |
---|
81 | if ( m_aidQP ) |
---|
82 | { |
---|
83 | delete[] m_aidQP; m_aidQP = NULL; |
---|
84 | } |
---|
85 | for(Int i = 0; i< m_pchInputFileList.size(); i++ ) |
---|
86 | { |
---|
87 | if ( m_pchInputFileList[i] != NULL ) |
---|
88 | free (m_pchInputFileList[i]); |
---|
89 | } |
---|
90 | |
---|
91 | for(Int i = 0; i< m_pchDepthInputFileList.size(); i++ ) |
---|
92 | { |
---|
93 | if ( m_pchDepthInputFileList[i] != NULL ) |
---|
94 | free (m_pchDepthInputFileList[i]); |
---|
95 | } |
---|
96 | |
---|
97 | for(Int i = 0; i< m_pchReconFileList.size(); i++ ) |
---|
98 | { |
---|
99 | if ( m_pchReconFileList[i] != NULL ) |
---|
100 | free (m_pchReconFileList[i]); |
---|
101 | } |
---|
102 | |
---|
103 | for(Int i = 0; i< m_pchERRefFileList.size(); i++ ) |
---|
104 | { |
---|
105 | if ( m_pchERRefFileList[i] != NULL ) |
---|
106 | free (m_pchERRefFileList[i]); |
---|
107 | } |
---|
108 | |
---|
109 | if (m_pchBitstreamFile != NULL) |
---|
110 | free (m_pchBitstreamFile) ; |
---|
111 | |
---|
112 | for(Int i = 0; i< m_pchDepthReconFileList.size(); i++ ) |
---|
113 | { |
---|
114 | if ( m_pchDepthReconFileList[i] != NULL ) |
---|
115 | free (m_pchDepthReconFileList[i]); |
---|
116 | } |
---|
117 | |
---|
118 | if (m_pchCameraParameterFile != NULL) |
---|
119 | free (m_pchCameraParameterFile); |
---|
120 | |
---|
121 | if (m_pchBaseViewCameraNumbers != NULL) |
---|
122 | free (m_pchBaseViewCameraNumbers); |
---|
123 | |
---|
124 | #if HHI_VSO |
---|
125 | if ( m_pchVSOConfig != NULL) |
---|
126 | free ( m_pchVSOConfig ); |
---|
127 | #endif |
---|
128 | |
---|
129 | #if POZNAN_STAT_JK |
---|
130 | for(Int i = 0; i< m_pchStatFileList.size(); i++ ) |
---|
131 | { |
---|
132 | if ( m_pchStatFileList[i] != NULL ) |
---|
133 | free (m_pchStatFileList[i]); |
---|
134 | } |
---|
135 | |
---|
136 | for(Int i = 0; i< m_pchDepthStatFileList.size(); i++ ) |
---|
137 | { |
---|
138 | if ( m_pchDepthStatFileList[i] != NULL ) |
---|
139 | free (m_pchDepthStatFileList[i]); |
---|
140 | } |
---|
141 | #endif |
---|
142 | |
---|
143 | } |
---|
144 | |
---|
145 | Void TAppEncCfg::create() |
---|
146 | { |
---|
147 | } |
---|
148 | |
---|
149 | Void TAppEncCfg::destroy() |
---|
150 | { |
---|
151 | } |
---|
152 | |
---|
153 | // ==================================================================================================================== |
---|
154 | // Public member functions |
---|
155 | // ==================================================================================================================== |
---|
156 | |
---|
157 | /** \param argc number of arguments |
---|
158 | \param argv array of arguments |
---|
159 | \retval true when success |
---|
160 | */ |
---|
161 | Bool TAppEncCfg::parseCfg( Int argc, Char* argv[] ) |
---|
162 | { |
---|
163 | bool do_help = false; |
---|
164 | |
---|
165 | string cfg_InputFile; |
---|
166 | string cfg_BitstreamFile; |
---|
167 | string cfg_ReconFile; |
---|
168 | string cfg_dQPFile; |
---|
169 | po::Options opts; |
---|
170 | opts.addOptions() |
---|
171 | ("help", do_help, false, "this help text") |
---|
172 | ("c", po::parseConfigFile, "configuration file name") |
---|
173 | |
---|
174 | /* File, I/O and source parameters */ |
---|
175 | ("InputFile_%d,i_%d", m_pchInputFileList, (char *) 0 , MAX_INPUT_VIEW_NUM , "original Yuv input file name %d") |
---|
176 | ("DepthInputFile_%d,di_%d", m_pchDepthInputFileList, (char *) 0 , MAX_INPUT_VIEW_NUM , "original Yuv depth input file name %d") |
---|
177 | ("ReconFile_%d,o_%d", m_pchReconFileList, (char *) 0 , MAX_INPUT_VIEW_NUM , "reconstructed Yuv output file name %d") |
---|
178 | ("DepthReconFile_%d,do_%d", m_pchDepthReconFileList, (char *) 0 , MAX_INPUT_VIEW_NUM , "reconstructed Yuv depth output file name %d") |
---|
179 | ("BitstreamFile,b", cfg_BitstreamFile, string(""), "bitstream output file name") |
---|
180 | |
---|
181 | ("CodeDepthMaps", m_bUsingDepthMaps, false, "Encode depth maps" ) |
---|
182 | ("CodedCamParsPrecision", m_iCodedCamParPrecision, STD_CAM_PARAMETERS_PRECISION, "precision for coding of camera parameters (in units of 2^(-x) luma samples)" ) |
---|
183 | |
---|
184 | #ifdef WEIGHT_PRED |
---|
185 | ("weighted_pred_flag,-wpP", m_bUseWeightPred, false, "weighted prediction flag (P-Slices)") |
---|
186 | ("weighted_bipred_idc,-wpBidc", m_uiBiPredIdc, 0u, "weighted bipred idc (B-Slices)") |
---|
187 | #endif |
---|
188 | ("SourceWidth,-wdt", m_iSourceWidth, 0, "Source picture width") |
---|
189 | ("SourceHeight,-hgt", m_iSourceHeight, 0, "Source picture height") |
---|
190 | ("InputBitDepth", m_uiInputBitDepth, 8u, "bit-depth of input file") |
---|
191 | ("BitDepth", m_uiInputBitDepth, 8u, "deprecated alias of InputBitDepth") |
---|
192 | ("OutputBitDepth", m_uiOutputBitDepth, 0u, "bit-depth of output file") |
---|
193 | #if ENABLE_IBDI |
---|
194 | ("BitIncrement", m_uiBitIncrement, 0xffffffffu, "bit-depth increasement") |
---|
195 | #endif |
---|
196 | ("InternalBitDepth", m_uiInternalBitDepth, 0u, "Internal bit-depth (BitDepth+BitIncrement)") |
---|
197 | ("HorizontalPadding,-pdx",m_aiPad[0], 0, "horizontal source padding size") |
---|
198 | ("VerticalPadding,-pdy", m_aiPad[1], 0, "vertical source padding size") |
---|
199 | ("PAD", m_bUsePAD, false, "automatic source padding of multiple of 16" ) |
---|
200 | ("FrameRate,-fr", m_iFrameRate, 0, "Frame rate") |
---|
201 | ("FrameSkip,-fs", m_FrameSkip, 0u, "Number of frames to skip at start of input YUV") |
---|
202 | ("FramesToBeEncoded,f", m_iFrameToBeEncoded, 0, "number of frames to be encoded (default=all)") |
---|
203 | ("FrameToBeEncoded", m_iFrameToBeEncoded, 0, "depricated alias of FramesToBeEncoded") |
---|
204 | |
---|
205 | ("NumberOfViews", m_iNumberOfViews, 0, "Number of views") |
---|
206 | |
---|
207 | |
---|
208 | /* Unit definition parameters */ |
---|
209 | ("MaxCUWidth", m_uiMaxCUWidth, 64u) |
---|
210 | ("MaxCUHeight", m_uiMaxCUHeight, 64u) |
---|
211 | /* todo: remove defaults from MaxCUSize */ |
---|
212 | ("MaxCUSize,s", m_uiMaxCUWidth, 64u, "max CU size") |
---|
213 | ("MaxCUSize,s", m_uiMaxCUHeight, 64u, "max CU size") |
---|
214 | ("MaxPartitionDepth,h", m_uiMaxCUDepth, 4u, "CU depth") |
---|
215 | |
---|
216 | ("QuadtreeTULog2MaxSize", m_uiQuadtreeTULog2MaxSize, 6u) |
---|
217 | ("QuadtreeTULog2MinSize", m_uiQuadtreeTULog2MinSize, 2u) |
---|
218 | |
---|
219 | ("QuadtreeTUMaxDepthIntra", m_uiQuadtreeTUMaxDepthIntra, 1u) |
---|
220 | ("QuadtreeTUMaxDepthInter", m_uiQuadtreeTUMaxDepthInter, 2u) |
---|
221 | |
---|
222 | /* Coding structure paramters */ |
---|
223 | ("CodedPictureStoreSize,cpss", m_uiCodedPictureStoreSize, 16u, "Size of coded picture Buffer") |
---|
224 | #if DCM_DECODING_REFRESH |
---|
225 | ("DecodingRefreshType,-dr",m_iDecodingRefreshType, 0, "intra refresh, (0:none 1:CDR 2:IDR)") |
---|
226 | #endif |
---|
227 | ("GOPSize,g", m_iGOPSize, 1, "GOP size of temporal structure") |
---|
228 | ("RateGOPSize,-rg",m_iRateGOPSize, -1, "GOP size of hierarchical QP assignment (-1: implies inherit GOPSize value)") |
---|
229 | #if !HHI_NO_LowDelayCoding |
---|
230 | ("LowDelayCoding", m_bUseLDC, false, "low-delay mode") |
---|
231 | #endif |
---|
232 | #if DCM_COMB_LIST |
---|
233 | ("ListCombination, -lc", m_bUseLComb, true, "combined reference list for uni-prediction in B-slices") |
---|
234 | ("LCModification", m_bLCMod, false, "enables signalling of combined reference list derivation") |
---|
235 | #endif |
---|
236 | |
---|
237 | ("GOPFormatString,gfs", m_cInputFormatString, string(""), "Group of pictures") |
---|
238 | |
---|
239 | /* motion options */ |
---|
240 | ("FastSearch", m_iFastSearch, 1, "0:Full search 1:Diamond 2:PMVFAST") |
---|
241 | ("SearchRange,-sr",m_iSearchRange, 96, "motion search range") |
---|
242 | ("BipredSearchRange", m_bipredSearchRange, 4, "motion search range for bipred refinement") |
---|
243 | ("HadamardME", m_bUseHADME, true, "hadamard ME for fractional-pel") |
---|
244 | ("ASR", m_bUseASR, false, "adaptive motion search range") |
---|
245 | |
---|
246 | /* Quantization parameters */ |
---|
247 | ("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") |
---|
248 | ("DeltaQpRD,-dqr",m_uiDeltaQpRD, 0u, "max dQp offset for slice") |
---|
249 | ("MaxDeltaQP,d", m_iMaxDeltaQP, 0, "max dQp offset for block") |
---|
250 | ("dQPFile,m", m_pchdQPFile , (char*) 0, "dQP file name") |
---|
251 | ("RDOQ", m_abUseRDOQ, std::vector<Bool>(1,true), "Enable RDOQ") |
---|
252 | ("TemporalLayerQPOffset_L0,-tq0", m_aiTLayerQPOffset[0], 0, "QP offset of temporal layer 0") |
---|
253 | ("TemporalLayerQPOffset_L1,-tq1", m_aiTLayerQPOffset[1], 0, "QP offset of temporal layer 1") |
---|
254 | ("TemporalLayerQPOffset_L2,-tq2", m_aiTLayerQPOffset[2], 0, "QP offset of temporal layer 2") |
---|
255 | ("TemporalLayerQPOffset_L3,-tq3", m_aiTLayerQPOffset[3], 0, "QP offset of temporal layer 3") |
---|
256 | ("TemporalLayerQPOffset_L4,-tq4", m_aiTLayerQPOffset[4], 0, "QP offset of temporal layer 3") |
---|
257 | ("TemporalLayerQPOffset_L5,-tq5", m_aiTLayerQPOffset[5], 0, "QP offset of temporal layer 3") |
---|
258 | ("TemporalLayerQPOffset_L6,-tq6", m_aiTLayerQPOffset[6], 0, "QP offset of temporal layer 3") |
---|
259 | ("TemporalLayerQPOffset_L7,-tq7", m_aiTLayerQPOffset[7], 0, "QP offset of temporal layer 3") |
---|
260 | ("TemporalLayerQPOffset_L8,-tq8", m_aiTLayerQPOffset[8], 0, "QP offset of temporal layer 3") |
---|
261 | ("TemporalLayerQPOffset_L9,-tq9", m_aiTLayerQPOffset[9], 0, "QP offset of temporal layer 3") |
---|
262 | |
---|
263 | /* Entropy coding parameters */ |
---|
264 | ("SymbolMode,-sym", m_iSymbolMode, 1, "symbol mode (0=VLC, 1=SBAC)") |
---|
265 | ("SBACRD", m_bUseSBACRD, true, "SBAC based RD estimation") |
---|
266 | |
---|
267 | /* Deblocking filter parameters */ |
---|
268 | ("LoopFilterDisable", m_abLoopFilterDisable, std::vector<Bool>(1,false), "Disables LoopFilter") |
---|
269 | ("LoopFilterAlphaC0Offset", m_iLoopFilterAlphaC0Offset, 0) |
---|
270 | ("LoopFilterBetaOffset", m_iLoopFilterBetaOffset, 0 ) |
---|
271 | |
---|
272 | /* Camera Paremetes */ |
---|
273 | ("CameraParameterFile,cpf", m_pchCameraParameterFile, (Char *) 0, "Camera Parameter File Name") |
---|
274 | ("BaseViewCameraNumbers" , m_pchBaseViewCameraNumbers, (Char *) 0, "Numbers of base views") |
---|
275 | |
---|
276 | |
---|
277 | /* View Synthesis Optimization */ |
---|
278 | |
---|
279 | #if HHI_VSO |
---|
280 | ("VSOConfig", m_pchVSOConfig , (Char *) 0 , "VSO configuration") |
---|
281 | ("VSO", m_bUseVSO , false , "Use VSO" ) |
---|
282 | // GT: For development, will be removed later |
---|
283 | ("VSOMode", m_uiVSOMode , (UInt) 4 , "VSO Mode") |
---|
284 | ("LambdaScaleVSO", m_dLambdaScaleVSO , (Double) 0.5 , "Lambda Scaling for VSO") |
---|
285 | ("ForceLambdaScaleVSO", m_bForceLambdaScaleVSO , false , "Force using Lambda Scale VSO also in non-VSO-Mode") |
---|
286 | #if HHI_VSO_DIST_INT |
---|
287 | ("AllowNegDist", m_bAllowNegDist , true , "Allow negative Distortion in VSO") |
---|
288 | #endif |
---|
289 | |
---|
290 | ("NumberOfExternalRefs", m_iNumberOfExternalRefs , 0 , "Number of virtual external reference views") |
---|
291 | ("ERRefFile_%d,er_%d", m_pchERRefFileList , (char *) 0 , MAX_ERREF_VIEW_NUM , "virtual external reference view file name %d") |
---|
292 | ("VSERViewReferences_%d,evr_%d" , m_aaiERViewRefInd , vector<Int>() , MAX_INPUT_VIEW_NUM, "Numbers of external virtual reference views to be used for this view") |
---|
293 | ("VSBaseViewReferences_%d,bvr_%d", m_aaiBaseViewRefInd , vector<Int>() , MAX_INPUT_VIEW_NUM, "Numbers of external virtual reference views to be used for this view") |
---|
294 | #endif |
---|
295 | |
---|
296 | /* Coding tools */ |
---|
297 | ("MRG", m_bUseMRG, true, "merging of motion partitions") |
---|
298 | |
---|
299 | #if LM_CHROMA |
---|
300 | ("LMChroma", m_bUseLMChroma, true, "intra chroma prediction based on recontructed luma") |
---|
301 | #endif |
---|
302 | |
---|
303 | ("ALF", m_abUseALF, std::vector<Bool>(1,true), "Enables ALF") |
---|
304 | #if MTK_SAO |
---|
305 | ("SAO", m_abUseSAO, std::vector<Bool>(1, true), "SAO") |
---|
306 | #endif |
---|
307 | |
---|
308 | #if MQT_ALF_NPASS |
---|
309 | ("ALFEncodePassReduction", m_iALFEncodePassReduction, 0, "0:Original 16-pass, 1: 1-pass, 2: 2-pass encoding") |
---|
310 | #endif |
---|
311 | #if HHI_RMP_SWITCH |
---|
312 | ("RMP", m_bUseRMP ,true, "Rectangular motion partition" ) |
---|
313 | #endif |
---|
314 | #ifdef ROUNDING_CONTROL_BIPRED |
---|
315 | ("RoundingControlBipred", m_useRoundingControlBipred, false, "Rounding control for bi-prediction") |
---|
316 | #endif |
---|
317 | ("SliceMode", m_iSliceMode, 0, "0: Disable all Recon slice limits, 1: Enforce max # of LCUs, 2: Enforce max # of bytes") |
---|
318 | ("SliceArgument", m_iSliceArgument, 0, "if SliceMode==1 SliceArgument represents max # of LCUs. if SliceMode==2 SliceArgument represents max # of bytes.") |
---|
319 | ("EntropySliceMode", m_iEntropySliceMode, 0, "0: Disable all entropy slice limits, 1: Enforce max # of LCUs, 2: Enforce constraint based entropy slices") |
---|
320 | ("EntropySliceArgument", m_iEntropySliceArgument,0, "if EntropySliceMode==1 SliceArgument represents max # of LCUs. if EntropySliceMode==2 EntropySliceArgument represents max # of bins.") |
---|
321 | #if MTK_NONCROSS_INLOOP_FILTER |
---|
322 | ("LFCrossSliceBoundaryFlag", m_bLFCrossSliceBoundaryFlag, true) |
---|
323 | #endif |
---|
324 | #if CONSTRAINED_INTRA_PRED |
---|
325 | ("ConstrainedIntraPred", m_bUseConstrainedIntraPred, false, "Constrained Intra Prediction") |
---|
326 | #endif |
---|
327 | /* Misc. */ |
---|
328 | ("SEIpictureDigest", m_pictureDigestEnabled, false, "Control generation of picture_digest SEI messages\n" |
---|
329 | "\t1: use MD5\n" |
---|
330 | "\t0: disable") |
---|
331 | ("FEN", m_bUseFastEnc, false, "fast encoder setting") |
---|
332 | |
---|
333 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
334 | ("DMM", m_bUseDMM, false, "add depth modes intra") |
---|
335 | #endif |
---|
336 | #if HHI_MPI |
---|
337 | ("MVI", m_bUseMVI, false, "use motion vector inheritance for depth map coding") |
---|
338 | #endif |
---|
339 | |
---|
340 | /* Multiview tools */ |
---|
341 | #if DEPTH_MAP_GENERATION |
---|
342 | ("PredDepthMapGen", m_uiPredDepthMapGeneration, (UInt)0, "generation of prediction depth maps for motion data prediction" ) |
---|
343 | #endif |
---|
344 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
345 | ("MultiviewMvPred", m_uiMultiviewMvPredMode, (UInt)0, "usage of predicted depth maps" ) |
---|
346 | ("MultiviewMvRegMode", m_uiMultiviewMvRegMode, (UInt)0, "regularization mode for multiview motion vectors" ) |
---|
347 | ("MultiviewMvRegLambdaScale", m_dMultiviewMvRegLambdaScale, (Double)0, "lambda scale for multiview motion vector regularization" ) |
---|
348 | #endif |
---|
349 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
350 | ("MultiviewResPred", m_uiMultiviewResPredMode, (UInt)0, "usage of inter-view residual prediction" ) |
---|
351 | #endif |
---|
352 | |
---|
353 | ("QpChangeFrame", m_iQpChangeFrame, PicOrderCnt(0), "start frame for QP change") |
---|
354 | ("QpChangeOffsetVideo", m_iQpChangeOffsetVideo, 0, "QP change offset for video") |
---|
355 | ("QpChangeOffsetDepth", m_iQpChangeOffsetDepth, 0, "QP change offset for depth") |
---|
356 | #if HHI_INTERVIEW_SKIP |
---|
357 | ("InterViewSkip", m_uiInterViewSkip, (UInt)0, "usage of interview skip" ) |
---|
358 | #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE |
---|
359 | ("InterViewSkipLambdaScale", m_dInterViewSkipLambdaScale, (Double)8, "lambda scale for interview skip" ) |
---|
360 | #endif |
---|
361 | #endif |
---|
362 | #if POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC |
---|
363 | ("textureCuDeltaQpOffset", m_dTextureCuDeltaQpOffset, (Double)(-2.6), "texture block QP changing tool based on coresponding depth block values - offset parameter" ) |
---|
364 | ("textureCuDeltaQpMul", m_dTextureCuDeltaQpMul, (Double)(1), "texture block QP changing tool based on coresponding depth block values - multiplicative parameter" ) |
---|
365 | ("textureCuDeltaQpOffsetTopBottomRow", m_iTextureCuDeltaQpTopBottomRow, (Int)2, "texture block QP changing tool - top and bottom CU rows delta QP parameter" ) |
---|
366 | #endif |
---|
367 | #if POZNAN_NONLINEAR_DEPTH |
---|
368 | ("DepthPower,-dpow", m_fDepthPower, 1.0, "Depth power value (for non-linear processing)") |
---|
369 | #endif |
---|
370 | |
---|
371 | |
---|
372 | /* Compatability with old style -1 FOO or -0 FOO options. */ |
---|
373 | ("1", doOldStyleCmdlineOn, "turn option <name> on") |
---|
374 | ("0", doOldStyleCmdlineOff, "turn option <name> off") |
---|
375 | |
---|
376 | #if POZNAN_STAT_JK |
---|
377 | ("StatFile_%d,sf_%d", m_pchStatFileList, (char *) 0 , MAX_INPUT_VIEW_NUM , "Mode selection staticstics file name for view %d") |
---|
378 | ("DepthStatFile_%d,sf_%d", m_pchDepthStatFileList, (char *) 0 , MAX_INPUT_VIEW_NUM , "Mode selection staticstics file name for depth view %d") |
---|
379 | #endif |
---|
380 | ; |
---|
381 | |
---|
382 | po::setDefaults(opts); |
---|
383 | const list<const char*>& argv_unhandled = po::scanArgv(opts, argc, (const char**) argv); |
---|
384 | |
---|
385 | for (list<const char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++) |
---|
386 | { |
---|
387 | fprintf(stderr, "Unhandled argument ignored: `%s'\n", *it); |
---|
388 | } |
---|
389 | |
---|
390 | if (argc == 1 || do_help) |
---|
391 | { |
---|
392 | /* argc == 1: no options have been specified */ |
---|
393 | po::doHelp(cout, opts); |
---|
394 | xPrintUsage(); |
---|
395 | return false; |
---|
396 | } |
---|
397 | |
---|
398 | /* |
---|
399 | * Set any derived parameters |
---|
400 | */ |
---|
401 | /* convert std::string to c string for compatability */ |
---|
402 | m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str()); |
---|
403 | m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str()); |
---|
404 | |
---|
405 | |
---|
406 | // GT FIX |
---|
407 | if ( m_bUsingDepthMaps ) |
---|
408 | { |
---|
409 | for(Int i = 0; i < m_pchDepthReconFileList.size() ; i++) |
---|
410 | { |
---|
411 | if ((m_pchDepthInputFileList[i] != NULL) && (m_pchReconFileList[i] != NULL) && (i < m_iNumberOfViews) ) |
---|
412 | { |
---|
413 | if (m_pchDepthReconFileList[i] == NULL ) |
---|
414 | { |
---|
415 | xAppendToFileNameEnd( m_pchReconFileList[i], "_depth", m_pchDepthReconFileList[i] ); |
---|
416 | } |
---|
417 | } |
---|
418 | else |
---|
419 | { |
---|
420 | m_pchDepthReconFileList[i] = NULL; |
---|
421 | } |
---|
422 | }; |
---|
423 | } |
---|
424 | // GT FIX END |
---|
425 | |
---|
426 | #if POZNAN_STAT_JK |
---|
427 | if ( m_bUsingDepthMaps ) |
---|
428 | { |
---|
429 | for(Int i = 0; i < m_pchDepthStatFileList.size() ; i++) |
---|
430 | { |
---|
431 | if ((m_pchDepthInputFileList[i] != NULL) && (m_pchStatFileList[i] != NULL) && (i < m_iNumberOfViews) ) |
---|
432 | { |
---|
433 | if (m_pchDepthStatFileList[i] == NULL ) |
---|
434 | { |
---|
435 | xAppendToFileNameEnd( m_pchStatFileList[i], "_depth", m_pchDepthStatFileList[i] ); |
---|
436 | } |
---|
437 | } |
---|
438 | else |
---|
439 | { |
---|
440 | m_pchDepthStatFileList[i] = NULL; |
---|
441 | } |
---|
442 | }; |
---|
443 | } |
---|
444 | #endif |
---|
445 | |
---|
446 | if (m_iRateGOPSize == -1) |
---|
447 | { |
---|
448 | /* if rateGOPSize has not been specified, the default value is GOPSize */ |
---|
449 | m_iRateGOPSize = m_iGOPSize; |
---|
450 | } |
---|
451 | |
---|
452 | // compute source padding size |
---|
453 | if ( m_bUsePAD ) |
---|
454 | { |
---|
455 | if ( m_iSourceWidth%MAX_PAD_SIZE ) |
---|
456 | { |
---|
457 | m_aiPad[0] = (m_iSourceWidth/MAX_PAD_SIZE+1)*MAX_PAD_SIZE - m_iSourceWidth; |
---|
458 | } |
---|
459 | |
---|
460 | if ( m_iSourceHeight%MAX_PAD_SIZE ) |
---|
461 | { |
---|
462 | m_aiPad[1] = (m_iSourceHeight/MAX_PAD_SIZE+1)*MAX_PAD_SIZE - m_iSourceHeight; |
---|
463 | } |
---|
464 | } |
---|
465 | m_iSourceWidth += m_aiPad[0]; |
---|
466 | m_iSourceHeight += m_aiPad[1]; |
---|
467 | |
---|
468 | //GT QP Depth |
---|
469 | if ( m_adQP.size() < 2 ) |
---|
470 | { |
---|
471 | m_adQP.push_back( m_adQP[0] ); |
---|
472 | }; |
---|
473 | for (UInt uiK = 0; uiK < m_adQP.size(); uiK++) |
---|
474 | { |
---|
475 | m_aiQP.push_back( (Int)( m_adQP[uiK] ) ); |
---|
476 | } |
---|
477 | //GT QP Depth end |
---|
478 | |
---|
479 | #if HHI_VSO |
---|
480 | m_bUseVSO = m_bUseVSO && m_bUsingDepthMaps && (m_uiVSOMode != 0); |
---|
481 | #endif |
---|
482 | |
---|
483 | #if POZNAN_NONLINEAR_DEPTH |
---|
484 | if (m_fDepthPower<=0) |
---|
485 | { |
---|
486 | Float fDepthQP = m_adQP[ m_adQP.size() < 2 ? 0 : 1]; |
---|
487 | m_fDepthPower = (fDepthQP-30) *0.25/20.0 + 1.25; |
---|
488 | if (m_fDepthPower<=1.0) m_fDepthPower = 1.0; |
---|
489 | // QP = 30 = 1.25 |
---|
490 | // QP = 50 = 1.5 |
---|
491 | if (m_fDepthPower>=1.66) m_fDepthPower = 1.66; |
---|
492 | }; |
---|
493 | |
---|
494 | #if POZNAN_NONLINEAR_DEPTH_SEND_AS_BYTE |
---|
495 | m_fDepthPower = dequantizeDepthPower(quantizeDepthPower((Float)m_fDepthPower)); |
---|
496 | #endif |
---|
497 | |
---|
498 | #endif |
---|
499 | |
---|
500 | xCleanUpVectors(); |
---|
501 | |
---|
502 | #if HHI_VSO |
---|
503 | if ( m_abUseALF .size() < 2) |
---|
504 | m_abUseALF .push_back( m_bUseVSO ? false : m_abUseALF[0] ); |
---|
505 | |
---|
506 | if ( m_abUseRDOQ.size() < 2) |
---|
507 | m_abUseRDOQ.push_back( m_bUseVSO ? true : m_abUseRDOQ[0] ); |
---|
508 | |
---|
509 | if ( m_abLoopFilterDisable.size() < 2) |
---|
510 | m_abLoopFilterDisable.push_back( m_bUseVSO ? true : m_abLoopFilterDisable[0] ); |
---|
511 | |
---|
512 | if (m_abUseSAO.size() < 2) |
---|
513 | m_abUseSAO.push_back ( m_bUseVSO ? false : m_abUseSAO[0] ); |
---|
514 | #else |
---|
515 | if ( m_abUseALF .size() < 2) |
---|
516 | m_abUseALF .push_back( m_abUseALF[0] ); |
---|
517 | |
---|
518 | if ( m_abUseRDOQ.size() < 2) |
---|
519 | m_abUseRDOQ.push_back( m_abUseRDOQ[0] ); |
---|
520 | |
---|
521 | if ( m_abLoopFilterDisable.size() < 2) |
---|
522 | m_abLoopFilterDisable.push_back( m_abLoopFilterDisable[0] ); |
---|
523 | |
---|
524 | if (m_abUseSAO.size() < 2) |
---|
525 | m_abUseSAO.push_back ( m_abUseSAO[0] ); |
---|
526 | #endif |
---|
527 | |
---|
528 | #if HHI_VSO |
---|
529 | if ( m_bUseVSO ) |
---|
530 | { |
---|
531 | if ( m_iNumberOfExternalRefs != 0 ) |
---|
532 | { |
---|
533 | xCleanUpVector( m_aaiERViewRefInd, vector<Int>() ); |
---|
534 | xCleanUpVector( m_aaiBaseViewRefInd, vector<Int>() ); |
---|
535 | } |
---|
536 | else |
---|
537 | { |
---|
538 | m_aaiERViewRefInd .clear(); |
---|
539 | m_aaiERViewRefInd .resize( m_iNumberOfViews ); |
---|
540 | m_aaiERViewRefLutInd.clear(); |
---|
541 | m_aaiERViewRefLutInd.resize( m_iNumberOfViews ); |
---|
542 | m_aaiBaseViewRefInd .clear(); |
---|
543 | m_aaiBaseViewRefInd .resize( m_iNumberOfViews ); |
---|
544 | } |
---|
545 | } |
---|
546 | #endif |
---|
547 | |
---|
548 | // set global variables |
---|
549 | xSetGlobal(); |
---|
550 | |
---|
551 | // read and check camera parameters |
---|
552 | #if HHI_VSO |
---|
553 | if ( m_bUseVSO && m_uiVSOMode == 4) |
---|
554 | { |
---|
555 | m_cRenModStrParser.setString( m_iNumberOfViews, m_pchVSOConfig ); |
---|
556 | m_cCameraData .init ( (UInt)m_iNumberOfViews, |
---|
557 | m_uiInputBitDepth, |
---|
558 | (UInt)m_iCodedCamParPrecision, |
---|
559 | m_FrameSkip, |
---|
560 | (UInt)m_iFrameToBeEncoded, |
---|
561 | m_pchCameraParameterFile, |
---|
562 | m_pchBaseViewCameraNumbers, |
---|
563 | NULL, |
---|
564 | m_cRenModStrParser.getSynthViews(), |
---|
565 | LOG2_DISP_PREC_LUT |
---|
566 | #if POZNAN_NONLINEAR_DEPTH |
---|
567 | ,m_fDepthPower |
---|
568 | #endif |
---|
569 | ); |
---|
570 | } |
---|
571 | else if ( m_bUseVSO && m_uiVSOMode != 4 ) |
---|
572 | { |
---|
573 | m_cCameraData .init ( (UInt)m_iNumberOfViews, |
---|
574 | m_uiInputBitDepth, |
---|
575 | (UInt)m_iCodedCamParPrecision, |
---|
576 | m_FrameSkip, |
---|
577 | (UInt)m_iFrameToBeEncoded, |
---|
578 | m_pchCameraParameterFile, |
---|
579 | m_pchBaseViewCameraNumbers, |
---|
580 | m_pchVSOConfig, |
---|
581 | NULL, |
---|
582 | LOG2_DISP_PREC_LUT |
---|
583 | #if POZNAN_NONLINEAR_DEPTH |
---|
584 | ,m_fDepthPower |
---|
585 | #endif |
---|
586 | ); |
---|
587 | } |
---|
588 | else |
---|
589 | { |
---|
590 | m_cCameraData .init ( (UInt)m_iNumberOfViews, |
---|
591 | m_uiInputBitDepth, |
---|
592 | (UInt)m_iCodedCamParPrecision, |
---|
593 | m_FrameSkip, |
---|
594 | (UInt)m_iFrameToBeEncoded, |
---|
595 | m_pchCameraParameterFile, |
---|
596 | m_pchBaseViewCameraNumbers, |
---|
597 | NULL, |
---|
598 | NULL, |
---|
599 | LOG2_DISP_PREC_LUT |
---|
600 | #if POZNAN_NONLINEAR_DEPTH |
---|
601 | ,m_fDepthPower |
---|
602 | #endif |
---|
603 | ); |
---|
604 | } |
---|
605 | #else |
---|
606 | m_cCameraData .init ( (UInt)m_iNumberOfViews, |
---|
607 | m_uiInputBitDepth, |
---|
608 | (UInt)m_iCodedCamParPrecision, |
---|
609 | m_FrameSkip, |
---|
610 | (UInt)m_iFrameToBeEncoded, |
---|
611 | m_pchCameraParameterFile, |
---|
612 | m_pchBaseViewCameraNumbers, |
---|
613 | NULL, |
---|
614 | NULL, |
---|
615 | LOG2_DISP_PREC_LUT |
---|
616 | #if POZNAN_NONLINEAR_DEPTH |
---|
617 | ,m_fDepthPower |
---|
618 | #endif |
---|
619 | ); |
---|
620 | #endif |
---|
621 | |
---|
622 | |
---|
623 | // check validity of input parameters |
---|
624 | xCheckParameter(); |
---|
625 | m_cCameraData.check( false, true ); |
---|
626 | |
---|
627 | // print-out parameters |
---|
628 | xPrintParameter(); |
---|
629 | |
---|
630 | return true; |
---|
631 | } |
---|
632 | |
---|
633 | // ==================================================================================================================== |
---|
634 | // Private member functions |
---|
635 | // ==================================================================================================================== |
---|
636 | |
---|
637 | Bool confirmPara(Bool bflag, const char* message); |
---|
638 | |
---|
639 | Void TAppEncCfg::xCheckParameter() |
---|
640 | { |
---|
641 | bool check_failed = false; /* abort if there is a fatal configuration problem */ |
---|
642 | #define xConfirmPara(a,b) check_failed |= confirmPara(a,b) |
---|
643 | // check range of parameters |
---|
644 | #if ENABLE_IBDI |
---|
645 | xConfirmPara( m_uiInternalBitDepth > 0 && (int)m_uiBitIncrement != -1, "InternalBitDepth and BitIncrement may not be specified simultaneously"); |
---|
646 | #else |
---|
647 | xConfirmPara( m_uiInputBitDepth < 8, "InputBitDepth must be at least 8" ); |
---|
648 | #endif |
---|
649 | xConfirmPara( m_iFrameRate <= 0, "Frame rate must be more than 1" ); |
---|
650 | xConfirmPara( m_iFrameToBeEncoded <= 0, "Total Number Of Frames encoded must be more than 1" ); |
---|
651 | xConfirmPara( m_iGOPSize < 1 , "GOP Size must be more than 1" ); |
---|
652 | #if DCM_DECODING_REFRESH |
---|
653 | xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 2, "Decoding Refresh Type must be equal to 0, 1 or 2" ); |
---|
654 | #endif |
---|
655 | //GT QP Depth |
---|
656 | xConfirmPara( m_aiQP[0] < 0 || m_aiQP[0] > 51, "QP exceeds supported range (0 to 51)" ); |
---|
657 | if ( m_aiQP.size() >= 2 ) |
---|
658 | { |
---|
659 | xConfirmPara( m_aiQP[1] < 0 || m_aiQP[1] > 51, "QP Depth exceeds supported range (0 to 51)" ); |
---|
660 | } |
---|
661 | //GT QP Depth End |
---|
662 | #if MQT_ALF_NPASS |
---|
663 | xConfirmPara( m_iALFEncodePassReduction < 0 || m_iALFEncodePassReduction > 2, "ALFEncodePassReduction must be equal to 0, 1 or 2"); |
---|
664 | #endif |
---|
665 | xConfirmPara( m_iLoopFilterAlphaC0Offset < -26 || m_iLoopFilterAlphaC0Offset > 26, "Loop Filter Alpha Offset exceeds supported range (-26 to 26)" ); |
---|
666 | xConfirmPara( m_iLoopFilterBetaOffset < -26 || m_iLoopFilterBetaOffset > 26, "Loop Filter Beta Offset exceeds supported range (-26 to 26)"); |
---|
667 | xConfirmPara( m_iFastSearch < 0 || m_iFastSearch > 2, "Fast Search Mode is not supported value (0:Full search 1:Diamond 2:PMVFAST)" ); |
---|
668 | xConfirmPara( m_iSearchRange < 0 , "Search Range must be more than 0" ); |
---|
669 | xConfirmPara( m_bipredSearchRange < 0 , "Search Range must be more than 0" ); |
---|
670 | xConfirmPara( m_iMaxDeltaQP > 7, "Absolute Delta QP exceeds supported range (0 to 7)" ); |
---|
671 | xConfirmPara( (m_uiMaxCUWidth >> m_uiMaxCUDepth) < 4, "Minimum partition width size should be larger than or equal to 8"); |
---|
672 | xConfirmPara( (m_uiMaxCUHeight >> m_uiMaxCUDepth) < 4, "Minimum partition height size should be larger than or equal to 8"); |
---|
673 | xConfirmPara( m_uiMaxCUWidth < 16, "Maximum partition width size should be larger than or equal to 16"); |
---|
674 | xConfirmPara( m_uiMaxCUHeight < 16, "Maximum partition height size should be larger than or equal to 16"); |
---|
675 | xConfirmPara( (m_iSourceWidth % (m_uiMaxCUWidth >> (m_uiMaxCUDepth-1)))!=0, "Frame width should be multiple of minimum CU size"); |
---|
676 | xConfirmPara( (m_iSourceHeight % (m_uiMaxCUHeight >> (m_uiMaxCUDepth-1)))!=0, "Frame height should be multiple of minimum CU size"); |
---|
677 | |
---|
678 | xConfirmPara( m_uiQuadtreeTULog2MinSize < 2, "QuadtreeTULog2MinSize must be 2 or greater."); |
---|
679 | xConfirmPara( m_uiQuadtreeTULog2MinSize > 5, "QuadtreeTULog2MinSize must be 5 or smaller."); |
---|
680 | xConfirmPara( m_uiQuadtreeTULog2MaxSize < 2, "QuadtreeTULog2MaxSize must be 2 or greater."); |
---|
681 | xConfirmPara( m_uiQuadtreeTULog2MaxSize > 5, "QuadtreeTULog2MaxSize must be 5 or smaller."); |
---|
682 | xConfirmPara( m_uiQuadtreeTULog2MaxSize < m_uiQuadtreeTULog2MinSize, "QuadtreeTULog2MaxSize must be greater than or equal to m_uiQuadtreeTULog2MinSize."); |
---|
683 | xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUWidth >>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS |
---|
684 | xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUHeight>>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS |
---|
685 | xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUWidth >> m_uiMaxCUDepth ), "Minimum CU width must be greater than minimum transform size." ); |
---|
686 | xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUHeight >> m_uiMaxCUDepth ), "Minimum CU height must be greater than minimum transform size." ); |
---|
687 | xConfirmPara( m_uiQuadtreeTUMaxDepthInter < 1, "QuadtreeTUMaxDepthInter must be greater than or equal to 1" ); |
---|
688 | xConfirmPara( m_uiQuadtreeTUMaxDepthInter > m_uiQuadtreeTULog2MaxSize - m_uiQuadtreeTULog2MinSize + 1, "QuadtreeTUMaxDepthInter must be less than or equal to the difference between QuadtreeTULog2MaxSize and QuadtreeTULog2MinSize plus 1" ); |
---|
689 | xConfirmPara( m_uiQuadtreeTUMaxDepthIntra < 1, "QuadtreeTUMaxDepthIntra must be greater than or equal to 1" ); |
---|
690 | xConfirmPara( m_uiQuadtreeTUMaxDepthIntra > m_uiQuadtreeTULog2MaxSize - m_uiQuadtreeTULog2MinSize + 1, "QuadtreeTUMaxDepthIntra must be less than or equal to the difference between QuadtreeTULog2MaxSize and QuadtreeTULog2MinSize plus 1" ); |
---|
691 | |
---|
692 | xConfirmPara( m_iSliceMode < 0 || m_iSliceMode > 2, "SliceMode exceeds supported range (0 to 2)" ); |
---|
693 | if (m_iSliceMode!=0) |
---|
694 | { |
---|
695 | xConfirmPara( m_iSliceArgument < 1 , "SliceArgument should be larger than or equal to 1" ); |
---|
696 | } |
---|
697 | xConfirmPara( m_iEntropySliceMode < 0 || m_iEntropySliceMode > 2, "EntropySliceMode exceeds supported range (0 to 2)" ); |
---|
698 | if (m_iEntropySliceMode!=0) |
---|
699 | { |
---|
700 | xConfirmPara( m_iEntropySliceArgument < 1 , "EntropySliceArgument should be larger than or equal to 1" ); |
---|
701 | } |
---|
702 | |
---|
703 | xConfirmPara( m_iSymbolMode < 0 || m_iSymbolMode > 1, "SymbolMode must be equal to 0 or 1" ); |
---|
704 | |
---|
705 | // Check MultiView stuff |
---|
706 | xConfirmPara ( m_iNumberOfViews > MAX_INPUT_VIEW_NUM , "NumberOfViews must be less than or equal to MAX_INPUT_VIEW_NUM"); |
---|
707 | xConfirmPara ( Int( m_pchInputFileList.size() ) < m_iNumberOfViews, "Number of InputFiles must be greater than or equal to NumberOfViews" ); |
---|
708 | xConfirmPara ( Int( m_pchReconFileList.size() ) < m_iNumberOfViews, "Number of ReconFiles must be greater than or equal to NumberOfViews" ); |
---|
709 | |
---|
710 | xConfirmPara ( m_iCodedCamParPrecision < 0 || m_iCodedCamParPrecision > 5, "CodedCamParsPrecision must be in range of 0..5" ); |
---|
711 | #if DEPTH_MAP_GENERATION |
---|
712 | xConfirmPara ( m_uiPredDepthMapGeneration > 3, "PredDepthMapGen must be less than or equal to 3" ); |
---|
713 | xConfirmPara ( m_uiPredDepthMapGeneration >= 2 && !m_bUsingDepthMaps, "PredDepthMapGen >= 2 requires CodeDepthMaps = 1" ); |
---|
714 | #endif |
---|
715 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
716 | xConfirmPara ( m_uiMultiviewMvPredMode > 7, "MultiviewMvPred must be less than or equal to 7" ); |
---|
717 | xConfirmPara ( m_uiMultiviewMvPredMode > 0 && m_uiPredDepthMapGeneration == 0 , "MultiviewMvPred > 0 requires PredDepthMapGen > 0" ); |
---|
718 | xConfirmPara ( m_uiMultiviewMvRegMode > 1, "MultiviewMvRegMode must be less than or equal to 1" ); |
---|
719 | xConfirmPara ( m_dMultiviewMvRegLambdaScale < 0.0, "MultiviewMvRegLambdaScale must not be negative" ); |
---|
720 | if( m_uiMultiviewMvRegMode ) |
---|
721 | { |
---|
722 | xConfirmPara ( Int( m_pchDepthInputFileList.size() ) < m_iNumberOfViews, "MultiviewMvRegMode > 0 requires the presence of input depth maps" ); |
---|
723 | } |
---|
724 | #endif |
---|
725 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
726 | xConfirmPara ( m_uiMultiviewResPredMode > 1, "MultiviewResPred must be less than or equal to 1" ); |
---|
727 | xConfirmPara ( m_uiMultiviewResPredMode > 0 && m_uiPredDepthMapGeneration == 0 , "MultiviewResPred > 0 requires PredDepthMapGen > 0" ); |
---|
728 | #endif |
---|
729 | |
---|
730 | #if HHI_INTERVIEW_SKIP |
---|
731 | xConfirmPara ( m_uiInterViewSkip > 1, "RenderingSkipMode > 1 not supported" ); |
---|
732 | xConfirmPara ( m_uiInterViewSkip > 0 && !m_bUsingDepthMaps, "RenderingSkipMode > 0 requires CodeDepthMaps = 1" ); |
---|
733 | #endif |
---|
734 | if( m_bUsingDepthMaps ) |
---|
735 | { |
---|
736 | xConfirmPara ( Int( m_pchDepthInputFileList.size() ) < m_iNumberOfViews, "Number of DepthInputFiles must be greater than or equal to NumberOfViews" ); |
---|
737 | xConfirmPara ( Int( m_pchDepthReconFileList.size() ) < m_iNumberOfViews, "Number of DepthReconFiles must be greater than or equal to NumberOfViews" ); |
---|
738 | |
---|
739 | #if HHI_VSO |
---|
740 | if( m_bUseVSO ) |
---|
741 | { |
---|
742 | xConfirmPara( m_pchCameraParameterFile == 0 , "CameraParameterFile must be given"); |
---|
743 | xConfirmPara( m_pchVSOConfig == 0 , "VSO Setup string must be given"); |
---|
744 | xConfirmPara( m_pchBaseViewCameraNumbers == 0 , "BaseViewCameraNumbers must be given" ); |
---|
745 | xConfirmPara( m_iNumberOfViews != m_cCameraData.getBaseViewNumbers().size(), "Number of Views in BaseViewCameraNumbers must be equal to NumberOfViews" ); |
---|
746 | xConfirmPara( m_uiVSOMode < 0 || m_uiVSOMode > 4 , "VSO Mode must be greater than or equal to 0 and less than 5"); |
---|
747 | xConfirmPara( m_iNumberOfExternalRefs > MAX_ERREF_VIEW_NUM, "NumberOfExternalRefs must be less than of equal to TAppMVEncCfg::MAX_ERREF_VIEW_NUM" ); |
---|
748 | xConfirmPara( Int( m_pchERRefFileList .size() ) < m_iNumberOfExternalRefs, "Number of ERRefFileFiles must be greater than or equal to NumberOfExternalRefs" ); |
---|
749 | } |
---|
750 | #endif |
---|
751 | #if POZNAN_NONLINEAR_DEPTH |
---|
752 | printf("Depth map power : %f\n", m_fDepthPower ); |
---|
753 | #endif |
---|
754 | } |
---|
755 | |
---|
756 | #if DCM_COMB_LIST |
---|
757 | #if !HHI_NO_LowDelayCoding |
---|
758 | xConfirmPara( m_bUseLComb==false && m_bUseLDC==false, "LComb can only be 0 if LowDelayCoding is 1" ); |
---|
759 | #else |
---|
760 | xConfirmPara( m_bUseLComb==false, "LComb can only be 0 if LowDelayCoding is 1" ); |
---|
761 | #endif |
---|
762 | #endif |
---|
763 | |
---|
764 | // max CU width and height should be power of 2 |
---|
765 | UInt ui = m_uiMaxCUWidth; |
---|
766 | while(ui) |
---|
767 | { |
---|
768 | ui >>= 1; |
---|
769 | if( (ui & 1) == 1) |
---|
770 | xConfirmPara( ui != 1 , "Width should be 2^n"); |
---|
771 | } |
---|
772 | ui = m_uiMaxCUHeight; |
---|
773 | while(ui) |
---|
774 | { |
---|
775 | ui >>= 1; |
---|
776 | if( (ui & 1) == 1) |
---|
777 | xConfirmPara( ui != 1 , "Height should be 2^n"); |
---|
778 | } |
---|
779 | |
---|
780 | // SBACRD is supported only for SBAC |
---|
781 | if ( m_iSymbolMode == 0 ) |
---|
782 | { |
---|
783 | m_bUseSBACRD = false; |
---|
784 | } |
---|
785 | |
---|
786 | #undef xConfirmPara |
---|
787 | if (check_failed) |
---|
788 | { |
---|
789 | exit(EXIT_FAILURE); |
---|
790 | } |
---|
791 | } |
---|
792 | |
---|
793 | template <class T> |
---|
794 | Void |
---|
795 | TAppEncCfg::xCleanUpVector( std::vector<T>& rcVec, const T& rcInvalid ) |
---|
796 | { |
---|
797 | Int iFirstInv = (Int)rcVec.size(); |
---|
798 | for( Int iIdx = 0; iIdx < (Int)rcVec.size(); iIdx++ ) |
---|
799 | { |
---|
800 | if( rcVec[ iIdx ] == rcInvalid ) |
---|
801 | { |
---|
802 | iFirstInv = iIdx; |
---|
803 | break; |
---|
804 | } |
---|
805 | } |
---|
806 | while( (Int)rcVec.size() > iFirstInv ) |
---|
807 | { |
---|
808 | rcVec.pop_back(); |
---|
809 | } |
---|
810 | } |
---|
811 | |
---|
812 | Void |
---|
813 | TAppEncCfg::xCleanUpVectors() |
---|
814 | { |
---|
815 | xCleanUpVector( m_pchInputFileList, (char*)0 ); |
---|
816 | xCleanUpVector( m_pchDepthInputFileList, (char*)0 ); |
---|
817 | xCleanUpVector( m_pchReconFileList, (char*)0 ); |
---|
818 | xCleanUpVector( m_pchDepthReconFileList, (char*)0 ); |
---|
819 | |
---|
820 | #if HHI_VSO |
---|
821 | if ( m_bUseVSO) |
---|
822 | { |
---|
823 | xCleanUpVector( m_pchERRefFileList, (char*)0 ); |
---|
824 | } |
---|
825 | #endif |
---|
826 | } |
---|
827 | |
---|
828 | /** \todo use of global variables should be removed later |
---|
829 | */ |
---|
830 | Void TAppEncCfg::xSetGlobal() |
---|
831 | { |
---|
832 | // set max CU width & height |
---|
833 | g_uiMaxCUWidth = m_uiMaxCUWidth; |
---|
834 | g_uiMaxCUHeight = m_uiMaxCUHeight; |
---|
835 | |
---|
836 | // compute actual CU depth with respect to config depth and max transform size |
---|
837 | g_uiAddCUDepth = 0; |
---|
838 | while( (m_uiMaxCUWidth>>m_uiMaxCUDepth) > ( 1 << ( m_uiQuadtreeTULog2MinSize + g_uiAddCUDepth ) ) ) g_uiAddCUDepth++; |
---|
839 | |
---|
840 | m_uiMaxCUDepth += g_uiAddCUDepth; |
---|
841 | g_uiAddCUDepth++; |
---|
842 | g_uiMaxCUDepth = m_uiMaxCUDepth; |
---|
843 | |
---|
844 | // set internal bit-depth and constants |
---|
845 | #if ENABLE_IBDI |
---|
846 | if ((int)m_uiBitIncrement != -1) |
---|
847 | { |
---|
848 | g_uiBitDepth = m_uiInputBitDepth; |
---|
849 | g_uiBitIncrement = m_uiBitIncrement; |
---|
850 | m_uiInternalBitDepth = g_uiBitDepth + g_uiBitIncrement; |
---|
851 | } |
---|
852 | else |
---|
853 | { |
---|
854 | g_uiBitDepth = min(8u, m_uiInputBitDepth); |
---|
855 | if (m_uiInternalBitDepth == 0) { |
---|
856 | /* default increement = 2 */ |
---|
857 | m_uiInternalBitDepth = 2 + g_uiBitDepth; |
---|
858 | } |
---|
859 | g_uiBitIncrement = m_uiInternalBitDepth - g_uiBitDepth; |
---|
860 | } |
---|
861 | #else |
---|
862 | #if FULL_NBIT |
---|
863 | g_uiBitDepth = m_uiInternalBitDepth; |
---|
864 | g_uiBitIncrement = 0; |
---|
865 | #else |
---|
866 | g_uiBitDepth = 8; |
---|
867 | g_uiBitIncrement = m_uiInternalBitDepth - g_uiBitDepth; |
---|
868 | #endif |
---|
869 | #endif |
---|
870 | |
---|
871 | g_uiBASE_MAX = ((1<<(g_uiBitDepth))-1); |
---|
872 | |
---|
873 | #if IBDI_NOCLIP_RANGE |
---|
874 | g_uiIBDI_MAX = g_uiBASE_MAX << g_uiBitIncrement; |
---|
875 | #else |
---|
876 | g_uiIBDI_MAX = ((1<<(g_uiBitDepth+g_uiBitIncrement))-1); |
---|
877 | #endif |
---|
878 | |
---|
879 | if (m_uiOutputBitDepth == 0) |
---|
880 | { |
---|
881 | m_uiOutputBitDepth = m_uiInternalBitDepth; |
---|
882 | } |
---|
883 | } |
---|
884 | |
---|
885 | Void TAppEncCfg::xPrintParameter() |
---|
886 | { |
---|
887 | printf("\n"); |
---|
888 | for( Int iCounter = 0; iCounter<m_iNumberOfViews; iCounter++) |
---|
889 | { |
---|
890 | printf("Input File %i : %s\n", iCounter, m_pchInputFileList[iCounter]); |
---|
891 | } |
---|
892 | for( Int iCounter = 0; iCounter < (Int)m_pchDepthInputFileList.size(); iCounter++) |
---|
893 | { |
---|
894 | printf("DepthInput File %i : %s\n", iCounter, m_pchDepthInputFileList[iCounter]); |
---|
895 | } |
---|
896 | printf("Bitstream File : %s\n", m_pchBitstreamFile ); |
---|
897 | for( Int iCounter = 0; iCounter<m_iNumberOfViews; iCounter++) |
---|
898 | { |
---|
899 | printf("Reconstruction File %i : %s\n", iCounter, m_pchReconFileList[iCounter]); |
---|
900 | } |
---|
901 | |
---|
902 | for( Int iCounter = 0; iCounter<(Int)m_pchDepthReconFileList.size(); iCounter++) |
---|
903 | { |
---|
904 | printf("Reconstruction Depth File %i : %s\n", iCounter, m_pchDepthReconFileList[iCounter]); |
---|
905 | } |
---|
906 | #if POZNAN_STAT_JK |
---|
907 | for( Int iCounter = 0; iCounter<m_iNumberOfViews; iCounter++) |
---|
908 | { |
---|
909 | printf("Statistics File %i : %s\n", iCounter, m_pchStatFileList[iCounter]); |
---|
910 | } |
---|
911 | for( Int iCounter = 0; iCounter<m_iNumberOfViews; iCounter++) |
---|
912 | { |
---|
913 | printf("Statistics Depth File %i : %s\n", iCounter, m_pchDepthStatFileList[iCounter]); |
---|
914 | } |
---|
915 | #endif |
---|
916 | printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_aiPad[0], m_iSourceHeight-m_aiPad[1], m_iFrameRate ); |
---|
917 | printf("Internal Format : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate ); |
---|
918 | printf("Frame index : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_iFrameToBeEncoded-1, m_iFrameToBeEncoded ); |
---|
919 | printf("CU size / depth : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth ); |
---|
920 | printf("RQT trans. size (min / max) : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize ); |
---|
921 | printf("Max RQT depth inter : %d\n", m_uiQuadtreeTUMaxDepthInter); |
---|
922 | printf("Max RQT depth intra : %d\n", m_uiQuadtreeTUMaxDepthIntra); |
---|
923 | printf("Motion search range : %d\n", m_iSearchRange ); |
---|
924 | #if DCM_DECODING_REFRESH |
---|
925 | printf("Decoding refresh type : %d\n", m_iDecodingRefreshType ); |
---|
926 | #endif |
---|
927 | printf("QP : %5.2f\n", m_adQP[0] ); |
---|
928 | printf("QP Depth : %5.2f\n", m_adQP[ m_adQP.size() < 2 ? 0 : 1] ); |
---|
929 | printf("Coded Picture Store Size : %d\n", m_uiCodedPictureStoreSize); |
---|
930 | printf("GOP size : %d\n", m_iGOPSize ); |
---|
931 | printf("Rate GOP size : %d\n", m_iRateGOPSize ); |
---|
932 | printf("Internal bit depth : %d\n", m_uiInternalBitDepth ); |
---|
933 | |
---|
934 | if ( m_iSymbolMode == 0 ) |
---|
935 | { |
---|
936 | printf("Entropy coder : VLC\n"); |
---|
937 | } |
---|
938 | else if( m_iSymbolMode == 1 ) |
---|
939 | { |
---|
940 | printf("Entropy coder : CABAC\n"); |
---|
941 | } |
---|
942 | else if( m_iSymbolMode == 2 ) |
---|
943 | { |
---|
944 | printf("Entropy coder : PIPE\n"); |
---|
945 | } |
---|
946 | else |
---|
947 | { |
---|
948 | assert(0); |
---|
949 | } |
---|
950 | |
---|
951 | printf("GOP Format String : %s\n", m_cInputFormatString.c_str() ); |
---|
952 | printf("Loop Filter Disabled : %d %d\n", m_abLoopFilterDisable[0] ? 1 : 0, m_abLoopFilterDisable[1] ? 1 : 0 ); |
---|
953 | printf("Coded Camera Param. Precision: %d\n", m_iCodedCamParPrecision); |
---|
954 | |
---|
955 | #if HHI_VSO |
---|
956 | printf("Force use of Lambda Scale : %d\n", m_bForceLambdaScaleVSO ); |
---|
957 | |
---|
958 | if ( m_bUseVSO ) |
---|
959 | { |
---|
960 | printf("VSO Lambda Scale : %5.2f\n", m_dLambdaScaleVSO ); |
---|
961 | printf("VSO Mode : %d\n", m_uiVSOMode ); |
---|
962 | printf("VSO Config : %s\n", m_pchVSOConfig ); |
---|
963 | #if HHI_VSO_DIST_INT |
---|
964 | printf("VSO Negative Distortion : %d\n", m_bAllowNegDist ? 1 : 0); |
---|
965 | #endif |
---|
966 | } |
---|
967 | #endif |
---|
968 | |
---|
969 | |
---|
970 | printf("\n"); |
---|
971 | |
---|
972 | printf("TOOL CFG GENERAL: "); |
---|
973 | printf("IBD:%d ", !!g_uiBitIncrement); |
---|
974 | printf("HAD:%d ", m_bUseHADME ); |
---|
975 | printf("SRD:%d ", m_bUseSBACRD ); |
---|
976 | printf("SQP:%d ", m_uiDeltaQpRD ); |
---|
977 | printf("ASR:%d ", m_bUseASR ); |
---|
978 | printf("PAD:%d ", m_bUsePAD ); |
---|
979 | printf("LDC:%d ", m_bUseLDC ); |
---|
980 | #if DCM_COMB_LIST |
---|
981 | printf("LComb:%d ", m_bUseLComb ); |
---|
982 | printf("LCMod:%d ", m_bLCMod ); |
---|
983 | #endif |
---|
984 | printf("FEN:%d ", m_bUseFastEnc ); |
---|
985 | printf("RQT:%d ", 1 ); |
---|
986 | printf("MRG:%d ", m_bUseMRG ); // SOPH: Merge Mode |
---|
987 | #if LM_CHROMA |
---|
988 | printf("LMC:%d ", m_bUseLMChroma ); |
---|
989 | #endif |
---|
990 | #if HHI_RMP_SWITCH |
---|
991 | printf("RMP:%d ", m_bUseRMP); |
---|
992 | #endif |
---|
993 | printf("Slice:%d ",m_iSliceMode); |
---|
994 | if (m_iSliceMode!=0) |
---|
995 | { |
---|
996 | printf("(%d) ", m_iSliceArgument); |
---|
997 | } |
---|
998 | printf("EntropySlice:%d ",m_iEntropySliceMode); |
---|
999 | if (m_iEntropySliceMode!=0) |
---|
1000 | { |
---|
1001 | printf("(%d) ", m_iEntropySliceArgument); |
---|
1002 | } |
---|
1003 | #if CONSTRAINED_INTRA_PRED |
---|
1004 | printf("CIP:%d ", m_bUseConstrainedIntraPred); |
---|
1005 | #endif |
---|
1006 | #if MTK_SAO |
---|
1007 | #endif |
---|
1008 | |
---|
1009 | #if POZNAN_MP |
---|
1010 | printf("POZNAN_MP(1){ "); |
---|
1011 | |
---|
1012 | #if POZNAN_MP_USE_DEPTH_MAP_GENERATION |
---|
1013 | printf("dmg=1 "); |
---|
1014 | #else |
---|
1015 | printf("dmg=0 "); |
---|
1016 | #endif |
---|
1017 | |
---|
1018 | #if POZNAN_MP_FILL |
---|
1019 | printf("fill=%d ",POZNAN_MP_FILL_TYPE); |
---|
1020 | #else |
---|
1021 | printf("fill=- "); |
---|
1022 | #endif |
---|
1023 | |
---|
1024 | #if POZNAN_EIVD |
---|
1025 | printf("EIVD(1): "); |
---|
1026 | printf("cand=%d ",POZNAN_EIVD_MERGE_POS); |
---|
1027 | #if POZNAN_EIVD_CALC_PRED_DATA |
---|
1028 | printf("pr=1 "); |
---|
1029 | #else |
---|
1030 | printf("pr=0 "); |
---|
1031 | #endif |
---|
1032 | #if POZNAN_EIVD_COMPRESS_ME_DATA |
---|
1033 | printf("comp=1 "); |
---|
1034 | #else |
---|
1035 | printf("comp=0 "); |
---|
1036 | #endif |
---|
1037 | #if POZNAN_EIVD_USE_IN_NONANCHOR_PIC_ONLY |
---|
1038 | printf("na=1 "); |
---|
1039 | #else |
---|
1040 | printf("na=0 "); |
---|
1041 | #endif |
---|
1042 | #else |
---|
1043 | printf("EIVD(0) "); |
---|
1044 | #endif |
---|
1045 | printf("}"); |
---|
1046 | #else |
---|
1047 | printf("POZNAN_MP(0) "); |
---|
1048 | #endif |
---|
1049 | |
---|
1050 | printf("\n"); |
---|
1051 | printf("TOOL CFG VIDEO : "); |
---|
1052 | printf("ALF:%d ", (m_abUseALF [0] ? 1 : 0) ); |
---|
1053 | printf("SAO:%d ", (m_abUseSAO [0] ? 1 : 0)); |
---|
1054 | printf("RDQ:%d ", (m_abUseRDOQ[0] ? 1 : 0) ); |
---|
1055 | printf("\n"); |
---|
1056 | |
---|
1057 | printf("TOOL CFG DEPTH : "); |
---|
1058 | printf("ALF:%d ", (m_abUseALF [1] ? 1 : 0)); |
---|
1059 | printf("SAO:%d ", (m_abUseSAO [1] ? 1 : 0)); |
---|
1060 | printf("RDQ:%d ", (m_abUseRDOQ[1] ? 1 : 0)); |
---|
1061 | #if HHI_VSO |
---|
1062 | printf("VSO:%d ", m_bUseVSO ); |
---|
1063 | #endif |
---|
1064 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
1065 | printf("DMM:%d ", m_bUseDMM ); |
---|
1066 | #endif |
---|
1067 | #if HHI_MPI |
---|
1068 | printf("MVI:%d ", m_bUseMVI ? 1 : 0 ); |
---|
1069 | #endif |
---|
1070 | printf("\n"); |
---|
1071 | |
---|
1072 | |
---|
1073 | printf("POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH("); |
---|
1074 | #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH |
---|
1075 | printf("1), "); |
---|
1076 | #else |
---|
1077 | printf("0), "); |
---|
1078 | #endif |
---|
1079 | |
---|
1080 | fflush(stdout); |
---|
1081 | } |
---|
1082 | |
---|
1083 | Void TAppEncCfg::xPrintUsage() |
---|
1084 | { |
---|
1085 | printf( " <name> = ALF - adaptive loop filter\n"); |
---|
1086 | printf( " IBD - bit-depth increasement\n"); |
---|
1087 | printf( " GPB - generalized B instead of P in low-delay mode\n"); |
---|
1088 | printf( " HAD - hadamard ME for fractional-pel\n"); |
---|
1089 | printf( " SRD - SBAC based RD estimation\n"); |
---|
1090 | printf( " RDQ - RDOQ\n"); |
---|
1091 | printf( " LDC - low-delay mode\n"); |
---|
1092 | printf( " NRF - non-reference frame marking in last layer\n"); |
---|
1093 | printf( " BQP - hier-P style QP assignment in low-delay mode\n"); |
---|
1094 | printf( " PAD - automatic source padding of multiple of 16\n"); |
---|
1095 | printf( " ASR - adaptive motion search range\n"); |
---|
1096 | printf( " FEN - fast encoder setting\n"); |
---|
1097 | printf( " MRG - merging of motion partitions\n"); // SOPH: Merge Mode |
---|
1098 | |
---|
1099 | #if LM_CHROMA |
---|
1100 | printf( " LMC - intra chroma prediction based on luma\n"); |
---|
1101 | #endif |
---|
1102 | |
---|
1103 | printf( "\n" ); |
---|
1104 | printf( " Example 1) TAppEncoder.exe -c test.cfg -q 32 -g 8 -f 9 -s 64 -h 4\n"); |
---|
1105 | printf(" -> QP 32, hierarchical-B GOP 8, 9 frames, 64x64-8x8 CU (~4x4 PU)\n\n"); |
---|
1106 | printf( " Example 2) TAppEncoder.exe -c test.cfg -q 32 -g 4 -f 9 -s 64 -h 4 -1 LDC\n"); |
---|
1107 | printf(" -> QP 32, hierarchical-P GOP 4, 9 frames, 64x64-8x8 CU (~4x4 PU)\n\n"); |
---|
1108 | } |
---|
1109 | |
---|
1110 | Bool confirmPara(Bool bflag, const char* message) |
---|
1111 | { |
---|
1112 | if (!bflag) |
---|
1113 | return false; |
---|
1114 | |
---|
1115 | printf("Error: %s\n",message); |
---|
1116 | return true; |
---|
1117 | } |
---|
1118 | |
---|
1119 | /* helper function */ |
---|
1120 | /* for handling "-1/-0 FOO" */ |
---|
1121 | void translateOldStyleCmdline(const char* value, po::Options& opts, const std::string& arg) |
---|
1122 | { |
---|
1123 | const char* argv[] = {arg.c_str(), value}; |
---|
1124 | /* replace some short names with their long name varients */ |
---|
1125 | if (arg == "LDC") |
---|
1126 | { |
---|
1127 | argv[0] = "LowDelayCoding"; |
---|
1128 | } |
---|
1129 | else if (arg == "RDQ") |
---|
1130 | { |
---|
1131 | argv[0] = "RDOQ"; |
---|
1132 | } |
---|
1133 | else if (arg == "HAD") |
---|
1134 | { |
---|
1135 | argv[0] = "HadamardME"; |
---|
1136 | } |
---|
1137 | else if (arg == "SRD") |
---|
1138 | { |
---|
1139 | argv[0] = "SBACRD"; |
---|
1140 | } |
---|
1141 | else if (arg == "IBD") |
---|
1142 | { |
---|
1143 | argv[0] = "BitIncrement"; |
---|
1144 | } |
---|
1145 | /* issue a warning for change in FEN behaviour */ |
---|
1146 | if (arg == "FEN") |
---|
1147 | { |
---|
1148 | /* xxx todo */ |
---|
1149 | } |
---|
1150 | po::storePair(opts, argv[0], argv[1]); |
---|
1151 | } |
---|
1152 | |
---|
1153 | void doOldStyleCmdlineOn(po::Options& opts, const std::string& arg) |
---|
1154 | { |
---|
1155 | if (arg == "IBD") |
---|
1156 | { |
---|
1157 | translateOldStyleCmdline("4", opts, arg); |
---|
1158 | return; |
---|
1159 | } |
---|
1160 | translateOldStyleCmdline("1", opts, arg); |
---|
1161 | } |
---|
1162 | |
---|
1163 | void doOldStyleCmdlineOff(po::Options& opts, const std::string& arg) |
---|
1164 | { |
---|
1165 | translateOldStyleCmdline("0", opts, arg); |
---|
1166 | } |
---|
1167 | |
---|
1168 | Void TAppEncCfg::xAppendToFileNameEnd( Char* pchInputFileName, const Char* pchStringToAppend, Char*& rpchOutputFileName) |
---|
1169 | { |
---|
1170 | size_t iInLength = strlen(pchInputFileName); |
---|
1171 | size_t iAppendLength = strlen(pchStringToAppend); |
---|
1172 | |
---|
1173 | rpchOutputFileName = (Char*) malloc(iInLength+iAppendLength+1); |
---|
1174 | Char* pCDot = strrchr(pchInputFileName,'.'); |
---|
1175 | pCDot = pCDot ? pCDot : pchInputFileName + iInLength; |
---|
1176 | size_t iCharsToDot = pCDot - pchInputFileName ; |
---|
1177 | size_t iCharsToEnd = iInLength - iCharsToDot; |
---|
1178 | strncpy(rpchOutputFileName , pchInputFileName , iCharsToDot ); |
---|
1179 | strncpy(rpchOutputFileName+ iCharsToDot , pchStringToAppend , iAppendLength); |
---|
1180 | strncpy(rpchOutputFileName+ iCharsToDot+iAppendLength , pchInputFileName+iCharsToDot, iCharsToEnd ); |
---|
1181 | rpchOutputFileName[iInLength+iAppendLength] = '\0'; |
---|
1182 | } |
---|