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