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