1 | |
---|
2 | /** \file TAppEncLayerCfg.h |
---|
3 | \brief Handle encoder layer configuration parameters (header) |
---|
4 | */ |
---|
5 | #ifndef __TAPPENCLAYERCFG__ |
---|
6 | #define __TAPPENCLAYERCFG__ |
---|
7 | |
---|
8 | #if SVC_EXTENSION |
---|
9 | #include "TLibCommon/CommonDef.h" |
---|
10 | #include "TLibEncoder/TEncCfg.h" |
---|
11 | #include <sstream> |
---|
12 | #include <iomanip> |
---|
13 | |
---|
14 | using namespace std; |
---|
15 | class TAppEncCfg; |
---|
16 | //! \ingroup TAppEncoder |
---|
17 | //! \{ |
---|
18 | |
---|
19 | // ==================================================================================================================== |
---|
20 | // Class definition |
---|
21 | // ==================================================================================================================== |
---|
22 | |
---|
23 | /// encoder layer configuration class |
---|
24 | class TAppEncLayerCfg |
---|
25 | { |
---|
26 | friend class TAppEncCfg; |
---|
27 | friend class TAppEncTop; |
---|
28 | protected: |
---|
29 | // file I/O0 |
---|
30 | string m_cInputFile; ///< source file name |
---|
31 | string m_cReconFile; ///< output reconstruction file |
---|
32 | |
---|
33 | Int m_iFrameRate; ///< source frame-rates (Hz) |
---|
34 | Int m_iSourceWidth; ///< source width in pixel |
---|
35 | Int m_iSourceHeight; ///< source height in pixel (when interlaced = field height) |
---|
36 | Int m_iSourceHeightOrg; ///< original source height in pixel (when interlaced = frame height) |
---|
37 | Int m_conformanceMode; |
---|
38 | Int m_confWinLeft; |
---|
39 | Int m_confWinRight; |
---|
40 | Int m_confWinTop; |
---|
41 | Int m_confWinBottom; |
---|
42 | Int m_aiPad[2]; ///< number of padded pixels for width and height |
---|
43 | Int m_iIntraPeriod; ///< period of I-slice (random access period) |
---|
44 | Double m_fQP; ///< QP value of key-picture (floating point) |
---|
45 | ChromaFormat m_chromaFormatIDC; |
---|
46 | ChromaFormat m_InputChromaFormatIDC; |
---|
47 | ChromaFormat m_chromaFormatConstraint; |
---|
48 | UInt m_bitDepthConstraint; |
---|
49 | Bool m_intraConstraintFlag; |
---|
50 | Bool m_lowerBitRateConstraintFlag; |
---|
51 | #if AUXILIARY_PICTURES |
---|
52 | Int m_auxId; |
---|
53 | #endif |
---|
54 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
55 | Int *m_samplePredRefLayerIds; |
---|
56 | Int m_numSamplePredRefLayers; |
---|
57 | Int *m_motionPredRefLayerIds; |
---|
58 | Int m_numMotionPredRefLayers; |
---|
59 | Int *m_predLayerIds; |
---|
60 | Int m_numActiveRefLayers; |
---|
61 | #endif |
---|
62 | |
---|
63 | #if LAYER_CTB |
---|
64 | // coding unit (CU) definition |
---|
65 | UInt m_uiMaxCUWidth; ///< max. CU width in pixel |
---|
66 | UInt m_uiMaxCUHeight; ///< max. CU height in pixel |
---|
67 | UInt m_uiMaxCUDepth; ///< max. CU depth |
---|
68 | |
---|
69 | // transfom unit (TU) definition |
---|
70 | UInt m_uiQuadtreeTULog2MaxSize; |
---|
71 | UInt m_uiQuadtreeTULog2MinSize; |
---|
72 | |
---|
73 | UInt m_uiQuadtreeTUMaxDepthInter; |
---|
74 | UInt m_uiQuadtreeTUMaxDepthIntra; |
---|
75 | #endif |
---|
76 | |
---|
77 | #if RC_SHVC_HARMONIZATION |
---|
78 | Bool m_RCEnableRateControl; ///< enable rate control or not |
---|
79 | Int m_RCTargetBitrate; ///< target bitrate when rate control is enabled |
---|
80 | Bool m_RCKeepHierarchicalBit; ///< whether keeping hierarchical bit allocation structure or not |
---|
81 | Bool m_RCLCULevelRC; ///< true: LCU level rate control; false: picture level rate control |
---|
82 | Bool m_RCUseLCUSeparateModel; ///< use separate R-lambda model at LCU level |
---|
83 | Int m_RCInitialQP; ///< inital QP for rate control |
---|
84 | Bool m_RCForceIntraQP; ///< force all intra picture to use initial QP or not |
---|
85 | #endif |
---|
86 | |
---|
87 | Int m_maxTidIlRefPicsPlus1; |
---|
88 | Int m_waveFrontSynchro; ///< 0: no WPP. >= 1: WPP is enabled, the "Top right" from which inheritance occurs is this LCU offset in the line above the current. |
---|
89 | Int m_iWaveFrontSubstreams; ///< If iWaveFrontSynchro, this is the number of substreams per frame (dependent tiles) or per tile (independent tiles). |
---|
90 | |
---|
91 | Int m_iQP; ///< QP value of key-picture (integer) |
---|
92 | char* m_pchdQPFile; ///< QP offset for each slice (initialized from external file) |
---|
93 | Int* m_aidQP; ///< array of slice QP values |
---|
94 | TAppEncCfg* m_cAppEncCfg; ///< pointer to app encoder config |
---|
95 | Int m_numScaledRefLayerOffsets; |
---|
96 | #if O0098_SCALED_REF_LAYER_ID |
---|
97 | Int m_scaledRefLayerId [MAX_LAYERS]; |
---|
98 | #endif |
---|
99 | Int m_scaledRefLayerLeftOffset [MAX_LAYERS]; |
---|
100 | Int m_scaledRefLayerTopOffset [MAX_LAYERS]; |
---|
101 | Int m_scaledRefLayerRightOffset [MAX_LAYERS]; |
---|
102 | Int m_scaledRefLayerBottomOffset[MAX_LAYERS]; |
---|
103 | #if REF_REGION_OFFSET |
---|
104 | Bool m_scaledRefLayerOffsetPresentFlag [MAX_LAYERS]; |
---|
105 | Bool m_refRegionOffsetPresentFlag [MAX_LAYERS]; |
---|
106 | Int m_refRegionLeftOffset [MAX_LAYERS]; |
---|
107 | Int m_refRegionTopOffset [MAX_LAYERS]; |
---|
108 | Int m_refRegionRightOffset [MAX_LAYERS]; |
---|
109 | Int m_refRegionBottomOffset[MAX_LAYERS]; |
---|
110 | #endif |
---|
111 | #if P0312_VERT_PHASE_ADJ |
---|
112 | Bool m_vertPhasePositionEnableFlag[MAX_LAYERS]; |
---|
113 | #endif |
---|
114 | #if R0209_GENERIC_PHASE |
---|
115 | Int m_phaseHorLuma [MAX_LAYERS]; |
---|
116 | Int m_phaseVerLuma [MAX_LAYERS]; |
---|
117 | Int m_phaseHorChroma[MAX_LAYERS]; |
---|
118 | Int m_phaseVerChroma[MAX_LAYERS]; |
---|
119 | Bool m_resamplePhaseSetPresentFlag [MAX_LAYERS]; |
---|
120 | #endif |
---|
121 | |
---|
122 | Int m_inputBitDepth [MAX_NUM_CHANNEL_TYPE]; ///< bit-depth of input file |
---|
123 | Int m_outputBitDepth [MAX_NUM_CHANNEL_TYPE]; ///< bit-depth of output file |
---|
124 | Int m_MSBExtendedBitDepth[MAX_NUM_CHANNEL_TYPE]; ///< bit-depth of input samples after MSB extension |
---|
125 | Int m_internalBitDepth[MAX_NUM_CHANNEL_TYPE]; ///< bit-depth codec operates at (input/output files will be converted) |
---|
126 | UInt m_saoOffsetBitShift[MAX_NUM_CHANNEL_TYPE]; |
---|
127 | Bool m_useExtendedPrecision; |
---|
128 | Bool m_useHighPrecisionPredictionWeighting; |
---|
129 | |
---|
130 | #if REPN_FORMAT_IN_VPS |
---|
131 | Int m_repFormatIdx; |
---|
132 | #endif |
---|
133 | #if Q0074_COLOUR_REMAPPING_SEI |
---|
134 | string m_colourRemapSEIFile; ///< Colour Remapping Information SEI message parameters file |
---|
135 | Int m_colourRemapSEIId; |
---|
136 | Bool m_colourRemapSEICancelFlag; |
---|
137 | Bool m_colourRemapSEIPersistenceFlag; |
---|
138 | Bool m_colourRemapSEIVideoSignalInfoPresentFlag; |
---|
139 | Bool m_colourRemapSEIFullRangeFlag; |
---|
140 | Int m_colourRemapSEIPrimaries; |
---|
141 | Int m_colourRemapSEITransferFunction; |
---|
142 | Int m_colourRemapSEIMatrixCoefficients; |
---|
143 | Int m_colourRemapSEIInputBitDepth; |
---|
144 | Int m_colourRemapSEIBitDepth; |
---|
145 | Int m_colourRemapSEIPreLutNumValMinus1[3]; |
---|
146 | Int* m_colourRemapSEIPreLutCodedValue[3]; |
---|
147 | Int* m_colourRemapSEIPreLutTargetValue[3]; |
---|
148 | Bool m_colourRemapSEIMatrixPresentFlag; |
---|
149 | Int m_colourRemapSEILog2MatrixDenom; |
---|
150 | Int m_colourRemapSEICoeffs[3][3]; |
---|
151 | Int m_colourRemapSEIPostLutNumValMinus1[3]; |
---|
152 | Int* m_colourRemapSEIPostLutCodedValue[3]; |
---|
153 | Int* m_colourRemapSEIPostLutTargetValue[3]; |
---|
154 | #endif |
---|
155 | |
---|
156 | #if MULTIPLE_PTL_SUPPORT |
---|
157 | // profile/level |
---|
158 | Int m_layerPTLIdx; |
---|
159 | #endif |
---|
160 | |
---|
161 | public: |
---|
162 | TAppEncLayerCfg(); |
---|
163 | virtual ~TAppEncLayerCfg(); |
---|
164 | |
---|
165 | public: |
---|
166 | Void create (); ///< create option handling class |
---|
167 | Void destroy (); ///< destroy option handling class |
---|
168 | bool parseCfg ( const string& cfgFileName ); ///< parse layer configuration file to fill member variables |
---|
169 | |
---|
170 | Void xPrintParameter(); |
---|
171 | Bool xCheckParameter( Bool isField ); |
---|
172 | |
---|
173 | Void setAppEncCfg(TAppEncCfg* p) {m_cAppEncCfg = p; } |
---|
174 | |
---|
175 | string getInputFile() {return m_cInputFile; } |
---|
176 | string getReconFile() {return m_cReconFile; } |
---|
177 | Int getFrameRate() {return m_iFrameRate; } |
---|
178 | Int getSourceWidth() {return m_iSourceWidth; } |
---|
179 | Int getSourceHeight() {return m_iSourceHeight; } |
---|
180 | Int getSourceHeightOrg() {return m_iSourceHeightOrg; } |
---|
181 | Int getConformanceMode() { return m_conformanceMode; } |
---|
182 | Int* getPad() {return m_aiPad; } |
---|
183 | Double getFloatQP() {return m_fQP; } |
---|
184 | Int getConfWinLeft() {return m_confWinLeft; } |
---|
185 | Int getConfWinRight() {return m_confWinRight; } |
---|
186 | Int getConfWinTop() {return m_confWinTop; } |
---|
187 | Int getConfWinBottom() {return m_confWinBottom; } |
---|
188 | #if AUXILIARY_PICTURES |
---|
189 | ChromaFormat getInputChromaFormat() {return m_InputChromaFormatIDC;} |
---|
190 | ChromaFormat getChromaFormatIDC() {return m_chromaFormatIDC; } |
---|
191 | Int getAuxId() {return m_auxId; } |
---|
192 | #endif |
---|
193 | |
---|
194 | Int getIntQP() {return m_iQP; } |
---|
195 | Int* getdQPs() {return m_aidQP; } |
---|
196 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
197 | Int getNumSamplePredRefLayers() {return m_numSamplePredRefLayers; } |
---|
198 | Int* getSamplePredRefLayerIds() {return m_samplePredRefLayerIds; } |
---|
199 | Int getSamplePredRefLayerId(Int i) {return m_samplePredRefLayerIds[i]; } |
---|
200 | Int getNumMotionPredRefLayers() {return m_numMotionPredRefLayers; } |
---|
201 | Int* getMotionPredRefLayerIds() {return m_motionPredRefLayerIds; } |
---|
202 | Int getMotionPredRefLayerId(Int i) {return m_motionPredRefLayerIds[i]; } |
---|
203 | |
---|
204 | Int getNumActiveRefLayers() {return m_numActiveRefLayers;} |
---|
205 | Int* getPredLayerIds() {return m_predLayerIds; } |
---|
206 | Int getPredLayerId(Int i) {return m_predLayerIds[i]; } |
---|
207 | #endif |
---|
208 | #if RC_SHVC_HARMONIZATION |
---|
209 | Bool getRCEnableRateControl() {return m_RCEnableRateControl; } |
---|
210 | Int getRCTargetBitrate() {return m_RCTargetBitrate; } |
---|
211 | Bool getRCKeepHierarchicalBit() {return m_RCKeepHierarchicalBit; } |
---|
212 | Bool getRCLCULevelRC() {return m_RCLCULevelRC; } |
---|
213 | Bool getRCUseLCUSeparateModel() {return m_RCUseLCUSeparateModel; } |
---|
214 | Int getRCInitialQP() {return m_RCInitialQP; } |
---|
215 | Bool getRCForceIntraQP() {return m_RCForceIntraQP; } |
---|
216 | #endif |
---|
217 | #if REPN_FORMAT_IN_VPS |
---|
218 | Int getRepFormatIdx() { return m_repFormatIdx; } |
---|
219 | Void setRepFormatIdx(Int x) { m_repFormatIdx = x; } |
---|
220 | Void setSourceWidth(Int x) { m_iSourceWidth = x; } |
---|
221 | Void setSourceHeight(Int x) { m_iSourceHeight = x; } |
---|
222 | #endif |
---|
223 | Int getMaxTidIlRefPicsPlus1() { return m_maxTidIlRefPicsPlus1; } |
---|
224 | #if LAYER_CTB |
---|
225 | UInt getMaxCUWidth() {return m_uiMaxCUWidth; } |
---|
226 | UInt getMaxCUHeight() {return m_uiMaxCUHeight; } |
---|
227 | UInt getMaxCUDepth() {return m_uiMaxCUDepth; } |
---|
228 | #endif |
---|
229 | }; // END CLASS DEFINITION TAppEncLayerCfg |
---|
230 | |
---|
231 | #endif //SVC_EXTENSION |
---|
232 | |
---|
233 | //! \} |
---|
234 | |
---|
235 | #endif // __TAPPENCLAYERCFG__ |
---|