1 | |
---|
2 | |
---|
3 | /** \file TAppEncCfg.h |
---|
4 | \brief Handle encoder configuration parameters (header) |
---|
5 | */ |
---|
6 | |
---|
7 | #ifndef __TAPPENCCFG__ |
---|
8 | #define __TAPPENCCFG__ |
---|
9 | |
---|
10 | #include "../../Lib/TLibCommon/CommonDef.h" |
---|
11 | #include "../../Lib/TLibCommon/TComMVDRefData.h" |
---|
12 | #include "../../App/TAppCommon/TAppComCamPara.h" |
---|
13 | #include "../../Lib/TLibRenderer/TRenTop.h" |
---|
14 | #include "../../Lib/TLibRenderer/TRenModel.h" |
---|
15 | #include "../../Lib/TLibRenderer/TRenModSetupStrParser.h" |
---|
16 | |
---|
17 | #include <string> |
---|
18 | #include <vector> |
---|
19 | |
---|
20 | // ==================================================================================================================== |
---|
21 | // Class definition |
---|
22 | // ==================================================================================================================== |
---|
23 | |
---|
24 | /// encoder configuration class |
---|
25 | class TAppEncCfg |
---|
26 | { |
---|
27 | protected: |
---|
28 | // file I/O |
---|
29 | char* m_pchBitstreamFile; ///< output bitstream file |
---|
30 | |
---|
31 | std::vector<char*> m_pchInputFileList; ///< source file names |
---|
32 | std::vector<char*> m_pchDepthInputFileList; ///< source depth file names |
---|
33 | std::vector<char*> m_pchReconFileList; ///< output reconstruction file names |
---|
34 | std::vector<char*> m_pchDepthReconFileList; ///< output depth reconstruction file names |
---|
35 | |
---|
36 | std::vector<char*> m_pchERRefFileList; ///< virtual external reference view files names |
---|
37 | |
---|
38 | // source specification |
---|
39 | Int m_iFrameRate; ///< source frame-rates (Hz) |
---|
40 | unsigned int m_FrameSkip; ///< number of skipped frames from the beginning |
---|
41 | Int m_iSourceWidth; ///< source width in pixel |
---|
42 | Int m_iSourceHeight; ///< source height in pixel |
---|
43 | Int m_iFrameToBeEncoded; ///< number of encoded frames |
---|
44 | Bool m_bUsePAD; ///< flag for using source padding |
---|
45 | Int m_aiPad[2]; ///< number of padded pixels for width and height |
---|
46 | |
---|
47 | Int m_iNumberOfViews; ///< number Views to Encode |
---|
48 | Bool m_bUsingDepthMaps ; |
---|
49 | |
---|
50 | |
---|
51 | // coding structure |
---|
52 | #if DCM_DECODING_REFRESH |
---|
53 | Int m_iDecodingRefreshType; ///< random access type |
---|
54 | #endif |
---|
55 | UInt m_uiCodedPictureStoreSize ; |
---|
56 | Int m_iGOPSize; ///< GOP size of hierarchical structure |
---|
57 | Int m_iRateGOPSize; ///< GOP size for QP variance |
---|
58 | #if !SB_NO_LowDelayCoding |
---|
59 | Bool m_bUseLDC; ///< flag for using low-delay coding mode |
---|
60 | #endif |
---|
61 | #if DCM_COMB_LIST |
---|
62 | Bool m_bUseLComb; ///< flag for using combined reference list for uni-prediction in B-slices (JCTVC-D421) |
---|
63 | Bool m_bLCMod; ///< flag for specifying whether the combined reference list for uni-prediction in B-slices is uploaded explicitly |
---|
64 | #endif |
---|
65 | // SB |
---|
66 | std::string m_cInputFormatString ; // GOP string |
---|
67 | // coding quality |
---|
68 | //GT QP Depth |
---|
69 | std::vector<Double> m_adQP; ///< QP value of key-picture (floating point) [0] video, [1] depth |
---|
70 | std::vector<Int> m_aiQP; ///< QP value of key-picture (integer) |
---|
71 | //GT QP Depth end |
---|
72 | Int m_aiTLayerQPOffset[MAX_TLAYER]; ///< QP offset corresponding to temporal layer depth |
---|
73 | char* m_pchdQPFile; ///< QP offset for each slice (initialized from external file) |
---|
74 | Int* m_aidQP; ///< array of slice QP values |
---|
75 | Int m_iMaxDeltaQP; ///< max. |delta QP| |
---|
76 | UInt m_uiDeltaQpRD; ///< dQP range for multi-pass slice QP optimization |
---|
77 | |
---|
78 | // coding unit (CU) definition |
---|
79 | UInt m_uiMaxCUWidth; ///< max. CU width in pixel |
---|
80 | UInt m_uiMaxCUHeight; ///< max. CU height in pixel |
---|
81 | UInt m_uiMaxCUDepth; ///< max. CU depth |
---|
82 | |
---|
83 | // transfom unit (TU) definition |
---|
84 | UInt m_uiQuadtreeTULog2MaxSize; |
---|
85 | UInt m_uiQuadtreeTULog2MinSize; |
---|
86 | |
---|
87 | UInt m_uiQuadtreeTUMaxDepthInter; |
---|
88 | UInt m_uiQuadtreeTUMaxDepthIntra; |
---|
89 | |
---|
90 | // coding tools (bit-depth) |
---|
91 | UInt m_uiInputBitDepth; ///< bit-depth of input file |
---|
92 | UInt m_uiOutputBitDepth; ///< bit-depth of output file |
---|
93 | #ifdef ENABLE_IBDI |
---|
94 | UInt m_uiBitIncrement; ///< bit-depth increment |
---|
95 | #endif |
---|
96 | UInt m_uiInternalBitDepth; ///< Internal bit-depth (BitDepth+BitIncrement) |
---|
97 | |
---|
98 | #if MTK_SAO |
---|
99 | vector<Bool> m_abUseSAO; |
---|
100 | #endif |
---|
101 | |
---|
102 | // coding tools (loop filter) |
---|
103 | vector<Bool> m_abUseALF; ///< flag for using adaptive loop filter [0] - video, [1] - depth |
---|
104 | #ifdef MQT_ALF_NPASS |
---|
105 | Int m_iALFEncodePassReduction; ///< ALF encoding pass, 0 = original 16-pass, 1 = 1-pass, 2 = 2-pass |
---|
106 | #endif |
---|
107 | |
---|
108 | vector<Bool> m_abLoopFilterDisable; ///< flag for using deblocking filter filter [0] - video, [1] - depth |
---|
109 | Int m_iLoopFilterAlphaC0Offset; ///< alpha offset for deblocking filter |
---|
110 | Int m_iLoopFilterBetaOffset; ///< beta offset for deblocking filter |
---|
111 | |
---|
112 | // coding tools (entropy coder) |
---|
113 | Int m_iSymbolMode; ///< entropy coder mode, 0 = VLC, 1 = CABAC |
---|
114 | |
---|
115 | // coding tools (inter - merge motion partitions) |
---|
116 | Bool m_bUseMRG; ///< SOPH: flag for using motion partition Merge Mode |
---|
117 | |
---|
118 | #if LM_CHROMA |
---|
119 | Bool m_bUseLMChroma; ///< JL: Chroma intra prediction based on luma signal |
---|
120 | #endif |
---|
121 | |
---|
122 | #if HHI_RMP_SWITCH |
---|
123 | Bool m_bUseRMP; |
---|
124 | #endif |
---|
125 | |
---|
126 | // coding tools (encoder-only parameters) |
---|
127 | Bool m_bUseSBACRD; ///< flag for using RD optimization based on SBAC |
---|
128 | Bool m_bUseASR; ///< flag for using adaptive motion search range |
---|
129 | Bool m_bUseHADME; ///< flag for using HAD in sub-pel ME |
---|
130 | vector<Bool> m_abUseRDOQ; ///< flag for using RD optimized quantization [0]-video, [1]-depth |
---|
131 | Int m_iFastSearch; ///< ME mode, 0 = full, 1 = diamond, 2 = PMVFAST |
---|
132 | Int m_iSearchRange; ///< ME search range |
---|
133 | Int m_bipredSearchRange; ///< ME search range for bipred refinement |
---|
134 | Bool m_bUseFastEnc; ///< flag for using fast encoder setting |
---|
135 | |
---|
136 | UInt m_uiPredDepthMapGeneration; ///< using of (virtual) depth maps for texture coding |
---|
137 | UInt m_uiMultiviewMvPredMode; ///< usage of predictors for multi-view mv prediction |
---|
138 | UInt m_uiMultiviewMvRegMode; ///< regularization for multiview motion vectors |
---|
139 | Double m_dMultiviewMvRegLambdaScale; ///< lambda scale for multiview motion vectors regularization |
---|
140 | UInt m_uiMultiviewResPredMode; ///< using multiview residual prediction |
---|
141 | |
---|
142 | #if SB_INTERVIEW_SKIP |
---|
143 | UInt m_uiInterViewSkip; ///< usage of interview skip mode ( do not transmit residual) |
---|
144 | #if SB_INTERVIEW_SKIP_LAMBDA_SCALE |
---|
145 | Double m_dInterViewSkipLambdaScale; ///< lambda scale for interview skip |
---|
146 | #endif |
---|
147 | #endif |
---|
148 | //GT campara |
---|
149 | // camera parameter |
---|
150 | Char* m_pchCameraParameterFile; ///< camera parameter file |
---|
151 | Char* m_pchBaseViewCameraNumbers; |
---|
152 | TAppComCamPara m_cCameraData; |
---|
153 | //GT campara end |
---|
154 | Int m_iCodedCamParPrecision; ///< precision for coding of camera parameters |
---|
155 | |
---|
156 | TRenTop m_cUsedPelsRenderer; ///< renderer for used pels map |
---|
157 | |
---|
158 | //GT VSO |
---|
159 | Char* m_pchVSOConfig; |
---|
160 | Bool m_bUseVSO; ///< flag for using View Synthesis Optimization |
---|
161 | |
---|
162 | //// Used for development by GT, might be removed later |
---|
163 | Double m_dLambdaScaleVSO; ///< Scaling factor for Lambda in VSO mode |
---|
164 | Bool m_bForceLambdaScaleVSO; ///< Use Lambda Scale for depth even if VSO is turned off |
---|
165 | #if RDO_DIST_INT |
---|
166 | Bool m_bAllowNegDist; ///< Allow negative distortion in VSO |
---|
167 | #endif |
---|
168 | UInt m_uiVSOMode; ///< Number of VSO Mode, 1 = , 2 = simple, org vs. ren, 3 = simple, ren vs. ren, 4 = full |
---|
169 | Int m_iNumberOfExternalRefs; ///< number Virtual External Reference Views |
---|
170 | std::vector< std::vector<Int> > m_aaiBaseViewRefInd; ///< View numbers of Base View References |
---|
171 | std::vector< std::vector<Int> > m_aaiERViewRefInd; ///< View numbers of External ViewReferences |
---|
172 | std::vector< std::vector<Int> > m_aaiERViewRefLutInd; ///< Indices of LUTs used for External View References |
---|
173 | |
---|
174 | //GT VSO end |
---|
175 | |
---|
176 | 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 |
---|
177 | Int m_iSliceArgument; ///< If m_iSliceMode==1, m_iSliceArgument=max. # of largest coding units. If m_iSliceMode==2, m_iSliceArgument=max. # of bytes. |
---|
178 | Int m_iEntropySliceMode; ///< 0: Disable all entropy slice limits, 1 : Maximum number of largest coding units per slice, 2: Constraint based entropy slice |
---|
179 | Int m_iEntropySliceArgument;///< If m_iEntropySliceMode==1, m_iEntropySliceArgument=max. # of largest coding units. If m_iEntropySliceMode==2, m_iEntropySliceArgument=max. # of bins. |
---|
180 | |
---|
181 | #if MTK_NONCROSS_INLOOP_FILTER |
---|
182 | Bool m_bLFCrossSliceBoundaryFlag; ///< 0: Cross-slice-boundary in-loop filtering 1: non-cross-slice-boundary in-loop filtering |
---|
183 | #endif |
---|
184 | #ifdef ROUNDING_CONTROL_BIPRED |
---|
185 | Bool m_useRoundingControlBipred; |
---|
186 | #endif |
---|
187 | #if CONSTRAINED_INTRA_PRED |
---|
188 | Bool m_bUseConstrainedIntraPred; ///< flag for using constrained intra prediction |
---|
189 | #endif |
---|
190 | #if HHI_DMM_INTRA |
---|
191 | Bool m_bUseDepthModelModes; |
---|
192 | #endif |
---|
193 | Bool m_bUseMVI; ///< flag for using Motion Vector Inheritance for depth map coding |
---|
194 | Bool m_bOmitUnusedBlocks; ///< flag for not coding blocks not used for rendering |
---|
195 | |
---|
196 | PicOrderCnt m_iQpChangeFrame; |
---|
197 | Int m_iQpChangeOffsetVideo; |
---|
198 | Int m_iQpChangeOffsetDepth; |
---|
199 | |
---|
200 | bool m_pictureDigestEnabled; ///< enable(1)/disable(0) md5 computation and SEI signalling |
---|
201 | |
---|
202 | //====== Weighted Prediction ======== |
---|
203 | #ifdef WEIGHT_PRED |
---|
204 | Bool m_bUseWeightPred; ///< Use of explicit Weighting Prediction for P_SLICE |
---|
205 | UInt m_uiBiPredIdc; ///< Use of Bi-Directional Weighting Prediction (B_SLICE): explicit(1) or implicit(2) |
---|
206 | #endif |
---|
207 | |
---|
208 | // internal member functions |
---|
209 | Void xSetGlobal (); ///< set global variables |
---|
210 | Void xCheckParameter (); ///< check validity of configuration values |
---|
211 | Void xPrintParameter (); ///< print configuration values |
---|
212 | Void xPrintUsage (); ///< print usage |
---|
213 | |
---|
214 | Void xCleanUpVectors (); ///< clean up vector sizes |
---|
215 | Void xInitCameraPars (); ///< init camera parameters |
---|
216 | |
---|
217 | |
---|
218 | // set MVD Parameters and LUTs |
---|
219 | Void xSetShiftParameters(); |
---|
220 | Void xGetShiftParameter( UInt uiSourceView, UInt uiTargetView, bool bExternal, double& rdScale, double& rdOffset ); ///< Get one Shift Parameters |
---|
221 | |
---|
222 | // util |
---|
223 | Void xAppendToFileNameEnd( Char* pchInputFileName, const Char* pchStringToAppend, Char* & rpchOutputFileName); |
---|
224 | Bool xConfirmParameter(Bool bflag, const char* message); |
---|
225 | |
---|
226 | |
---|
227 | template <class T> Void xCleanUpVector( std::vector<T>& rcVec, const T& rcInvalid ); |
---|
228 | |
---|
229 | // Ren Model String |
---|
230 | TRenModSetupStrParser m_cRenModStrParser; |
---|
231 | public: |
---|
232 | |
---|
233 | TAppEncCfg(); |
---|
234 | virtual ~TAppEncCfg(); |
---|
235 | |
---|
236 | public: |
---|
237 | Void create (); ///< create option handling class |
---|
238 | Void destroy (); ///< destroy option handling class |
---|
239 | Bool parseCfg ( Int argc, Char* argv[] ); ///< parse configuration file to fill member variables |
---|
240 | |
---|
241 | };// END CLASS DEFINITION TAppEncCfg |
---|
242 | |
---|
243 | #endif // __TAPPENCCFG__ |
---|
244 | |
---|