source: 3DVCSoftware/branches/HTM-6.2-dev2-Qualcomm/source/App/TAppEncoder/TAppEncCfg.h @ 1417

Last change on this file since 1417 was 373, checked in by zhang, 12 years ago

JCT3V-D0177: ARP

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