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