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