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