source: 3DVCSoftware/branches/HTM-5.0-Sony/source/App/TAppEncoder/TAppEncCfg.h @ 197

Last change on this file since 197 was 197, checked in by sony, 12 years ago

Add DV_V_RESTRICTION_B0037 macro and two config parameters (DisparitySearchRangeRestriction, VerticalDisparitySearchRange).

It enables to restrict disparity vector range at encoder on motion search.
When users want to try the option, please set DisparitySearchRangeRestriction to 1 and set VerticalDisparitySearchRange to any positive integer value to be tested. The restriction is disabled by default.

  • Property svn:eol-style set to native
File size: 20.2 KB
Line 
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.h
35    \brief    Handle encoder configuration parameters (header)
36*/
37
38#ifndef __TAPPENCCFG__
39#define __TAPPENCCFG__
40
41#include "TLibCommon/CommonDef.h"
42
43#include "TLibEncoder/TEncCfg.h"
44#include "TAppCommon/TAppComCamPara.h"
45#include "TLibRenderer/TRenTop.h"
46#include "TLibRenderer/TRenModel.h"
47#include "TLibRenderer/TRenModSetupStrParser.h"
48
49#include <sstream>
50#include <vector>
51
52//! \ingroup TAppEncoder
53//! \{
54
55// ====================================================================================================================
56// Class definition
57// ====================================================================================================================
58
59/// encoder configuration class
60class TAppEncCfg
61{
62protected:
63  // file I/O
64  std::vector<char*>     m_pchInputFileList;                  ///< source file names
65  std::vector<char*>     m_pchDepthInputFileList;             ///< source depth file names
66  std::vector<char*>     m_pchReconFileList;                  ///< output reconstruction file names
67  std::vector<char*>     m_pchDepthReconFileList;             ///< output depth reconstruction file names
68  char*     m_pchBitstreamFile;                               ///< output bitstream file
69  Double    m_adLambdaModifier[ MAX_TLAYER ];                 ///< Lambda modifier array for each temporal layer
70  // source specification
71  Int       m_iFrameRate;                                     ///< source frame-rates (Hz)
72  unsigned int m_FrameSkip;                                   ///< number of skipped frames from the beginning
73  Int       m_iSourceWidth;                                   ///< source width in pixel
74  Int       m_iSourceHeight;                                  ///< source height in pixel
75#if PIC_CROPPING
76  Int       m_croppingMode;
77  Int       m_cropLeft;
78  Int       m_cropRight;
79  Int       m_cropTop;
80  Int       m_cropBottom;
81#endif
82  Int       m_iFrameToBeEncoded;                              ///< number of encoded frames
83#if !PIC_CROPPING
84  Bool      m_bUsePAD;                                        ///< flag for using source padding
85#endif
86  Int       m_aiPad[2];                                       ///< number of padded pixels for width and height
87 
88  Int       m_iNumberOfViews;                                 ///< number Views to Encode
89  Bool      m_bUsingDepthMaps;
90  // coding structure
91  Int       m_iIntraPeriod;                                   ///< period of I-slice (random access period)
92  Int       m_iDecodingRefreshType;                           ///< random access type
93  Int       m_iGOPSize;                                       ///< GOP size of hierarchical structure
94  Int       m_extraRPSs[MAX_VIEW_NUM];
95  GOPEntryMvc m_GOPListsMvc[MAX_VIEW_NUM][MAX_GOP+1];
96#if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
97  Int       m_numReorderPics[MAX_VIEW_NUM][MAX_TLAYER];       ///< total number of reorder pictures
98  Int       m_maxDecPicBuffering[MAX_VIEW_NUM][MAX_TLAYER];   ///< total number of reference pictures needed for decoding
99#else
100  Int       m_numReorderFrames;                               ///< total number of reorder pictures
101  Int       m_maxNumberOfReferencePictures;                   ///< total number of reference pictures needed for decoding
102#endif
103  Bool      m_bUseLComb;                                      ///< flag for using combined reference list for uni-prediction in B-slices (JCTVC-D421)
104  Bool      m_bLCMod;                                         ///< flag for specifying whether the combined reference list for uni-prediction in B-slices is uploaded explicitly
105  Bool      m_bDisInter4x4;
106  Bool      m_enableNSQT;                                     ///< flag for enabling NSQT
107  Bool      m_enableAMP;
108  // coding quality
109  std::vector<Double>  m_adQP;                                ///< QP value of key-picture (floating point) [0] video, [1] depth
110  std::vector<Int>     m_aiQP;                                ///< QP value of key-picture (integer) [0] video, [1] depth
111#if QC_MVHEVC_B0046
112  std::vector<Int>     m_aiVId;                                ///< view id
113#endif
114  Int       m_aiTLayerQPOffset[MAX_TLAYER];                   ///< QP offset corresponding to temporal layer depth
115  char*     m_pchdQPFile;                                     ///< QP offset for each slice (initialized from external file)
116  Int*      m_aidQP;                                          ///< array of slice QP values
117  Int*      m_aidQPdepth;                                     ///< array of depth slice QP values
118  Int       m_iMaxDeltaQP;                                    ///< max. |delta QP|
119  UInt      m_uiDeltaQpRD;                                    ///< dQP range for multi-pass slice QP optimization
120  Int       m_iMaxCuDQPDepth;                                 ///< Max. depth for a minimum CuDQPSize (0:default)
121
122  Int       m_iChromaQpOffset;                                 ///< ChromaQpOffset    (0:default)
123  Int       m_iChromaQpOffset2nd;                              ///< ChromaQpOffset2nd (0:default)
124
125#if ADAPTIVE_QP_SELECTION
126  Bool      m_bUseAdaptQpSelect;
127#endif
128
129  Bool      m_bUseAdaptiveQP;                                 ///< Flag for enabling QP adaptation based on a psycho-visual model
130  Int       m_iQPAdaptationRange;                             ///< dQP range by QP adaptation
131 
132#if H0566_TLA
133  Int       m_maxTempLayer[MAX_VIEW_NUM];                     ///< Max temporal layer
134#else
135  Bool      m_bTLayering;                                     ///< indicates whether temporal IDs are set based on the hierarchical coding structure
136  Bool      m_abTLayerSwitchingFlag[MAX_TLAYER];              ///< temporal layer switching flags corresponding to each temporal layer
137#endif
138
139  // coding unit (CU) definition
140  UInt      m_uiMaxCUWidth;                                   ///< max. CU width in pixel
141  UInt      m_uiMaxCUHeight;                                  ///< max. CU height in pixel
142  UInt      m_uiMaxCUDepth;                                   ///< max. CU depth
143 
144  // transfom unit (TU) definition
145  UInt      m_uiQuadtreeTULog2MaxSize;
146  UInt      m_uiQuadtreeTULog2MinSize;
147 
148  UInt      m_uiQuadtreeTUMaxDepthInter;
149  UInt      m_uiQuadtreeTUMaxDepthIntra;
150 
151  // coding tools (bit-depth)
152  UInt      m_uiInputBitDepth;                                ///< bit-depth of input file
153  UInt      m_uiOutputBitDepth;                               ///< bit-depth of output file
154  UInt      m_uiInternalBitDepth;                             ///< Internal bit-depth (BitDepth+BitIncrement)
155
156  // coding tools (PCM bit-depth)
157  Bool      m_bPCMInputBitDepthFlag;                          ///< 0: PCM bit-depth is internal bit-depth. 1: PCM bit-depth is input bit-depth.
158  UInt      m_uiPCMBitDepthLuma;                              ///< PCM bit-depth for luma
159
160  // coding tool (lossless)
161#if LOSSLESS_CODING
162  Bool      m_useLossless;                                    ///< flag for using lossless coding
163#endif
164  vector<Bool> m_abUseSAO;
165#if LGE_ILLUCOMP_B0045
166  Bool      m_bUseIC;                                     ///< flag for using illumination compensation for inter-view prediction
167#endif
168#if SAO_UNIT_INTERLEAVING
169  Int       m_maxNumOffsetsPerPic;                            ///< SAO maximun number of offset per picture
170  Bool      m_saoInterleavingFlag;                            ///< SAO interleaving flag
171#endif
172  // coding tools (loop filter)
173  vector<Bool> m_abUseALF;                                    ///< flag for using adaptive loop filter [0] - video, [1] - depth
174  Int       m_iALFEncodePassReduction;                        //!< ALF encoding pass, 0 = original 16-pass, 1 = 1-pass, 2 = 2-pass
175 
176  Int       m_iALFMaxNumberFilters;                           ///< ALF Max Number Filters in one picture
177#if LCU_SYNTAX_ALF
178  Bool      m_bALFParamInSlice;
179  Bool      m_bALFPicBasedEncode;
180#endif
181
182  vector<Bool> m_abLoopFilterDisable;                         ///< flag for using deblocking filter filter [0] - video, [1] - depth
183  Bool      m_loopFilterOffsetInAPS;                         ///< offset for deblocking filter in 0 = slice header, 1 = APS
184  Int       m_loopFilterBetaOffsetDiv2;                     ///< beta offset for deblocking filter
185  Int       m_loopFilterTcOffsetDiv2;                       ///< tc offset for deblocking filter
186#if DBL_CONTROL
187  Bool      m_DeblockingFilterControlPresent;                 ///< deblocking filter control present flag in PPS
188#endif
189 
190  Bool      m_bUseLMChroma;                                  ///< JL: Chroma intra prediction based on luma signal
191
192  // coding tools (PCM)
193  Bool      m_usePCM;                                         ///< flag for using IPCM
194  UInt      m_pcmLog2MaxSize;                                 ///< log2 of maximum PCM block size
195  UInt      m_uiPCMLog2MinSize;                               ///< log2 of minimum PCM block size
196  Bool      m_bPCMFilterDisableFlag;                          ///< PCM filter disable flag
197
198  // coding tools (encoder-only parameters)
199  Bool      m_bUseSBACRD;                                     ///< flag for using RD optimization based on SBAC
200  Bool      m_bUseASR;                                        ///< flag for using adaptive motion search range
201  Bool      m_bUseHADME;                                      ///< flag for using HAD in sub-pel ME
202vector<Bool> m_abUseRDOQ;                                   ///< flag for using RD optimized quantization [0]-video, [1]-depth
203  Int       m_iFastSearch;                                    ///< ME mode, 0 = full, 1 = diamond, 2 = PMVFAST
204  Int       m_iSearchRange;                                   ///< ME search range
205#if DV_V_RESTRICTION_B0037
206  Bool      m_bUseDisparitySearchRangeRestriction;            ///< restrict vertical search range for inter-view prediction
207  Int       m_iVerticalDisparitySearchRange;                  ///< ME vertical search range for inter-view prediction
208#endif
209  Int       m_bipredSearchRange;                              ///< ME search range for bipred refinement
210  Bool      m_bUseFastEnc;                                    ///< flag for using fast encoder setting
211#if HHI_INTERVIEW_SKIP
212  Bool      m_bInterViewSkip;                            ///< usage of interview skip mode ( do not transmit residual)
213#if HHI_INTERVIEW_SKIP_LAMBDA_SCALE
214  Double    m_dInterViewSkipLambdaScale;                 ///< lambda scale for interview skip
215#endif
216#endif
217  Bool      m_bUseEarlyCU;                                    ///< flag for using Early CU setting
218
219#if DEPTH_MAP_GENERATION
220  UInt      m_uiPredDepthMapGeneration;                       ///< using of (virtual) depth maps for texture coding
221#endif
222#if HHI_INTER_VIEW_MOTION_PRED
223  UInt      m_uiMultiviewMvPredMode;                          ///< usage of predictors for multi-view mv prediction
224  UInt      m_uiMultiviewMvRegMode;                           ///< regularization for multiview motion vectors
225  Double    m_dMultiviewMvRegLambdaScale;                     ///< lambda scale for multiview motion vectors regularization
226#endif
227#if HHI_INTER_VIEW_RESIDUAL_PRED
228  UInt      m_uiMultiviewResPredMode;          ///< using multiview residual prediction
229#endif
230
231#if FAST_DECISION_FOR_MRG_RD_COST
232  Bool      m_useFastDecisionForMerge;         ///< flag for using Fast Decision Merge RD-Cost
233#endif
234  Bool      m_bUseCbfFastMode;                 ///< flag for using Cbf Fast PU Mode Decision
235  Int       m_iSliceMode;                      ///< 0: Disable all Recon slice limits, 1 : Maximum number of largest coding units per slice, 2: Maximum number of bytes in a slice
236  Int       m_iSliceArgument;                  ///< If m_iSliceMode==1, m_iSliceArgument=max. # of largest coding units. If m_iSliceMode==2, m_iSliceArgument=max. # of bytes.
237  Int       m_iEntropySliceMode;               ///< 0: Disable all entropy slice limits, 1 : Maximum number of largest coding units per slice, 2: Constraint based entropy slice
238  Int       m_iEntropySliceArgument;           ///< If m_iEntropySliceMode==1, m_iEntropySliceArgument=max. # of largest coding units. If m_iEntropySliceMode==2, m_iEntropySliceArgument=max. # of bins.
239
240  Int       m_iSliceGranularity;               ///< 0: Slices always end at LCU borders. 1-3: slices may end at a depth of 1-3 below LCU level.
241  Bool      m_bLFCrossSliceBoundaryFlag;       ///< 0: Cross-slice-boundary in-loop filtering 1: non-cross-slice-boundary in-loop filtering
242  Int       m_iTileBehaviorControlPresentFlag; //!< 1: tile behavior control parameters are in PPS 0: tile behavior control parameters are not in PPS
243  Bool      m_bLFCrossTileBoundaryFlag;        //!< 1: Cross-tile-boundary in-loop filtering 0: non-cross-tile-boundary in-loop filtering
244  Int       m_iColumnRowInfoPresent;
245  Int       m_iUniformSpacingIdr;
246#if !REMOVE_TILE_DEPENDENCE
247  Int       m_iTileBoundaryIndependenceIdr;
248#endif
249  Int       m_iNumColumnsMinus1;
250  char*     m_pchColumnWidth;
251  Int       m_iNumRowsMinus1;
252  char*     m_pchRowHeight;
253  Int       m_iTileLocationInSliceHeaderFlag; //< enable(1)/disable(0) transmitssion of tile location in slice header
254  Int       m_iTileMarkerFlag;              //< enable(1)/disable(0) transmitssion of light weight tile marker
255  Int       m_iMaxTileMarkerEntryPoints;    //< maximum number of tile markers allowed in a slice (controls degree of parallelism)
256  Double    m_dMaxTileMarkerOffset;         //< Calculated offset. Light weight tile markers will be transmitted for TileIdx= Offset, 2*Offset, 3*Offset ...
257
258  Int       m_iWaveFrontSynchro; //< 0: no WPP. >= 1: WPP is enabled, the "Top right" from which inheritance occurs is this LCU offset in the line above the current.
259  Int       m_iWaveFrontFlush; //< enable(1)/disable(0) the CABAC flush at the end of each line of LCUs.
260  Int       m_iWaveFrontSubstreams; //< If iWaveFrontSynchro, this is the number of substreams per frame (dependent tiles) or per tile (independent tiles).
261
262  Bool      m_bUseConstrainedIntraPred;                       ///< flag for using constrained intra prediction
263 
264  bool m_pictureDigestEnabled; ///< enable(1)/disable(0) md5 computation and SEI signalling
265
266  // weighted prediction
267  Bool      m_bUseWeightPred;                                 ///< Use of explicit Weighting Prediction for P_SLICE
268  UInt      m_uiBiPredIdc;                                    ///< Use of Bi-Directional Weighting Prediction (B_SLICE): explicit(1) or implicit(2)
269
270#if TMVP_DEPTH_SWITCH
271  vector<Bool> m_enableTMVP;                                  ///< Enable TMVP [0] video, [1] depth
272#else
273  Bool      m_enableTMVP;
274#endif
275
276#if MULTIBITS_DATA_HIDING
277  Int       m_signHideFlag;
278  Int       m_signHidingThreshold;
279#endif
280#if HHI_MPI
281  Bool      m_bUseMVI;  ///< flag for using Motion Vector Inheritance for depth map coding
282#endif
283#if RWTH_SDC_DLT_B0036
284  Bool      m_bUseDLT;
285  Bool      m_bUseSDC;
286#endif
287
288  Int       m_useScalingListId;                               ///< using quantization matrix
289  char*     m_scalingListFile;                                ///< quantization matrix file name
290
291  // camera parameter
292  Char*     m_pchCameraParameterFile;                         ///< camera parameter file
293  Char*     m_pchBaseViewCameraNumbers;
294#if !QC_MVHEVC_B0046
295  TAppComCamPara m_cCameraData;
296#endif
297  Int       m_iCodedCamParPrecision;                          ///< precision for coding of camera parameters
298
299#if HHI_VSO
300  Char*     m_pchVSOConfig;
301  Bool      m_bUseVSO;                                    ///< flag for using View Synthesis Optimization
302#if HHI_VSO_LS_TABLE_M23714
303  Bool      m_bVSOLSTable;                                ///< Depth QP dependent Lagrange parameter optimization (m23714)
304#endif
305#if LGE_VSO_EARLY_SKIP_A0093
306  Bool      m_bVSOEarlySkip;                              ///< Early skip of VSO computation (JCT3V-A0093 modification 4)
307#endif
308  //// Used for development by GT, might be removed later
309  Double    m_dLambdaScaleVSO;                            ///< Scaling factor for Lambda in VSO mode
310  Bool      m_bForceLambdaScaleVSO;                       ///< Use Lambda Scale for depth even if VSO is turned off
311#if HHI_VSO_DIST_INT
312  Bool      m_bAllowNegDist;                              ///< Allow negative distortion in VSO
313#endif
314  UInt      m_uiVSOMode;                                  ///< Number of VSO Mode, 1 = , 2 = simple, org vs. ren, 3 = simple, ren vs. ren, 4 = full 
315#endif
316#if SAIT_VSO_EST_A0033
317  Bool      m_bUseEstimatedVSD;                           ///< Flag for using model based VSD estimation instead of VSO for some encoder decisions (JCT3V-A0033 modification 3) 
318#endif
319#if LGE_WVSO_A0119
320  Bool      m_bUseWVSO;                                    ///< flag for using View Synthesis Optimization 
321  Int       m_iVSOWeight;
322  Int       m_iVSDWeight;
323  Int       m_iDWeight;
324#endif
325  // coding tools (depth intra modes)
326#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
327  Bool      m_bUseDMM;                                        ///< flag for using DMM
328#endif
329
330#if OL_QTLIMIT_PREDCODING_B0068
331  Bool      m_bUseQTLPC;                                      ///< flag for using depth QuadTree Limitation + Predictive Coding
332#endif
333
334  // internal member functions
335  Void  xSetGlobal      ();                                   ///< set global variables
336  Void  xCheckParameter ();                                   ///< check validity of configuration values
337  Void  xPrintParameter ();                                   ///< print configuration values
338  Void  xPrintUsage     ();                                   ///< print usage
339 
340  Void  xCleanUpVectors ();                                   ///< clean up vector sizes
341  Void  xInitCameraPars ();                                   ///< init camera parameters
342
343
344  // set MVD Parameters and LUTs
345  Void xSetShiftParameters();
346  Void xGetShiftParameter( UInt uiSourceView, UInt uiTargetView, bool bExternal, double& rdScale, double& rdOffset ); ///< Get one Shift Parameters
347
348  Void  xAppendToFileNameEnd( Char* pchInputFileName, const Char* pchStringToAppend, Char* & rpchOutputFileName);
349
350  Void  xCheckCodingStructureMvc();                           ///< validate and configure inter-view coding structure
351
352  template <class T> Void xCleanUpVector( std::vector<T>& rcVec, const T& rcInvalid );
353#if HHI_VSO
354  // Ren Model String
355  TRenModSetupStrParser       m_cRenModStrParser;
356#endif
357public:
358  TAppEncCfg();
359  virtual ~TAppEncCfg();
360 
361public:
362  Void  create    ();                                         ///< create option handling class
363  Void  destroy   ();                                         ///< destroy option handling class
364  Bool  parseCfg  ( Int argc, Char* argv[] );                 ///< parse configuration file to fill member variables
365 
366};// END CLASS DEFINITION TAppEncCfg
367
368//! \}
369
370#endif // __TAPPENCCFG__
371
Note: See TracBrowser for help on using the repository browser.