1 | /** \file TAppEncLayerCfg.cpp |
---|
2 | \brief Handle encoder configuration parameters |
---|
3 | */ |
---|
4 | |
---|
5 | #include <stdlib.h> |
---|
6 | #include <cassert> |
---|
7 | #include <cstring> |
---|
8 | #include <string> |
---|
9 | #include "TLibCommon/TComRom.h" |
---|
10 | #include "TAppEncCfg.h" |
---|
11 | #include "TAppEncLayerCfg.h" |
---|
12 | #include "TAppCommon/program_options_lite.h" |
---|
13 | |
---|
14 | #ifdef WIN32 |
---|
15 | #define strdup _strdup |
---|
16 | #endif |
---|
17 | |
---|
18 | using namespace std; |
---|
19 | namespace po = df::program_options_lite; |
---|
20 | |
---|
21 | //! \ingroup TAppEncoder |
---|
22 | //! \{ |
---|
23 | |
---|
24 | |
---|
25 | #if AUXILIARY_PICTURES |
---|
26 | static inline ChromaFormat numberToChromaFormat(const Int val) |
---|
27 | { |
---|
28 | switch (val) |
---|
29 | { |
---|
30 | case 400: return CHROMA_400; break; |
---|
31 | case 420: return CHROMA_420; break; |
---|
32 | case 422: return CHROMA_422; break; |
---|
33 | case 444: return CHROMA_444; break; |
---|
34 | default: return NUM_CHROMA_FORMAT; |
---|
35 | } |
---|
36 | } |
---|
37 | #endif |
---|
38 | |
---|
39 | // ==================================================================================================================== |
---|
40 | // Constructor / destructor / initialization / destroy |
---|
41 | // ==================================================================================================================== |
---|
42 | #if SVC_EXTENSION |
---|
43 | TAppEncLayerCfg::TAppEncLayerCfg() |
---|
44 | :m_cInputFile(string("")), |
---|
45 | m_cReconFile(string("")), |
---|
46 | m_conformanceMode( 0 ), |
---|
47 | m_aidQP(NULL), |
---|
48 | m_repFormatIdx (-1) |
---|
49 | #if Q0074_COLOUR_REMAPPING_SEI |
---|
50 | , m_colourRemapSEIFileRoot(string("")) |
---|
51 | #endif |
---|
52 | { |
---|
53 | #if Q0074_COLOUR_REMAPPING_SEI |
---|
54 | for( Int c=0 ; c<3 ; c++) |
---|
55 | { |
---|
56 | m_colourRemapSEIPreLutCodedValue[c] = NULL; |
---|
57 | m_colourRemapSEIPreLutTargetValue[c] = NULL; |
---|
58 | m_colourRemapSEIPostLutCodedValue[c] = NULL; |
---|
59 | m_colourRemapSEIPostLutTargetValue[c] = NULL; |
---|
60 | } |
---|
61 | #endif |
---|
62 | m_confWinLeft = m_confWinRight = m_confWinTop = m_confWinBottom = 0; |
---|
63 | m_aiPad[1] = m_aiPad[0] = 0; |
---|
64 | m_numRefLayerLocationOffsets = 0; |
---|
65 | ::memset(m_refLocationOffsetLayerId, 0, sizeof(m_refLocationOffsetLayerId)); |
---|
66 | ::memset(m_scaledRefLayerLeftOffset, 0, sizeof(m_scaledRefLayerLeftOffset)); |
---|
67 | ::memset(m_scaledRefLayerTopOffset, 0, sizeof(m_scaledRefLayerTopOffset)); |
---|
68 | ::memset(m_scaledRefLayerRightOffset, 0, sizeof(m_scaledRefLayerRightOffset)); |
---|
69 | ::memset(m_scaledRefLayerBottomOffset, 0, sizeof(m_scaledRefLayerBottomOffset)); |
---|
70 | ::memset(m_scaledRefLayerOffsetPresentFlag, 0, sizeof(m_scaledRefLayerOffsetPresentFlag)); |
---|
71 | ::memset(m_refRegionOffsetPresentFlag, 0, sizeof(m_refRegionOffsetPresentFlag)); |
---|
72 | ::memset(m_refRegionLeftOffset, 0, sizeof(m_refRegionLeftOffset)); |
---|
73 | ::memset(m_refRegionTopOffset, 0, sizeof(m_refRegionTopOffset)); |
---|
74 | ::memset(m_refRegionRightOffset, 0, sizeof(m_refRegionRightOffset)); |
---|
75 | ::memset(m_refRegionBottomOffset, 0, sizeof(m_refRegionBottomOffset)); |
---|
76 | ::memset(m_resamplePhaseSetPresentFlag, 0, sizeof(m_resamplePhaseSetPresentFlag)); |
---|
77 | ::memset(m_phaseHorLuma, 0, sizeof(m_phaseHorLuma)); |
---|
78 | ::memset(m_phaseVerLuma, 0, sizeof(m_phaseVerLuma)); |
---|
79 | ::memset(m_phaseHorChroma, 0, sizeof(m_phaseHorChroma)); |
---|
80 | ::memset(m_phaseVerChroma, 0, sizeof(m_phaseVerChroma)); |
---|
81 | } |
---|
82 | |
---|
83 | TAppEncLayerCfg::~TAppEncLayerCfg() |
---|
84 | { |
---|
85 | if ( m_aidQP ) |
---|
86 | { |
---|
87 | delete[] m_aidQP; |
---|
88 | } |
---|
89 | #if Q0074_COLOUR_REMAPPING_SEI |
---|
90 | for( Int c=0 ; c<3 ; c++) |
---|
91 | { |
---|
92 | if ( m_colourRemapSEIPreLutCodedValue[c] ) |
---|
93 | { |
---|
94 | delete[] m_colourRemapSEIPreLutCodedValue[c]; |
---|
95 | } |
---|
96 | if ( m_colourRemapSEIPreLutTargetValue[c] ) |
---|
97 | { |
---|
98 | delete[] m_colourRemapSEIPreLutTargetValue[c]; |
---|
99 | } |
---|
100 | if ( m_colourRemapSEIPostLutCodedValue[c] ) |
---|
101 | { |
---|
102 | delete[] m_colourRemapSEIPostLutCodedValue[c]; |
---|
103 | } |
---|
104 | if ( m_colourRemapSEIPostLutTargetValue[c] ) |
---|
105 | { |
---|
106 | delete[] m_colourRemapSEIPostLutTargetValue[c]; |
---|
107 | } |
---|
108 | } |
---|
109 | #endif |
---|
110 | } |
---|
111 | |
---|
112 | Void TAppEncLayerCfg::create() |
---|
113 | { |
---|
114 | } |
---|
115 | |
---|
116 | Void TAppEncLayerCfg::destroy() |
---|
117 | { |
---|
118 | } |
---|
119 | |
---|
120 | |
---|
121 | // ==================================================================================================================== |
---|
122 | // Public member functions |
---|
123 | // ==================================================================================================================== |
---|
124 | |
---|
125 | /** \param argc number of arguments |
---|
126 | \param argv array of arguments |
---|
127 | \retval true when success |
---|
128 | */ |
---|
129 | bool TAppEncLayerCfg::parseCfg( const string& cfgFileName ) |
---|
130 | { |
---|
131 | string cfg_InputFile; |
---|
132 | string cfg_ReconFile; |
---|
133 | string cfg_dQPFile; |
---|
134 | #if AUXILIARY_PICTURES |
---|
135 | Int tmpInputChromaFormat; |
---|
136 | Int tmpChromaFormat; |
---|
137 | #endif |
---|
138 | #if Q0074_COLOUR_REMAPPING_SEI |
---|
139 | string cfg_colourRemapSEIFileRoot; |
---|
140 | #endif |
---|
141 | |
---|
142 | po::Options opts; |
---|
143 | opts.addOptions() |
---|
144 | ("InputFile,i", cfg_InputFile, string(""), "original YUV input file name") |
---|
145 | #if AVC_BASE |
---|
146 | ("InputBLFile,-ibl", cfg_InputFile, string(""), "original YUV input file name") |
---|
147 | #endif |
---|
148 | ("ReconFile,o", cfg_ReconFile, string(""), "reconstructed YUV output file name") |
---|
149 | ("SourceWidth,-wdt", m_iSourceWidth, 0, "Source picture width") |
---|
150 | ("SourceHeight,-hgt", m_iSourceHeight, 0, "Source picture height") |
---|
151 | ("CroppingMode", m_conformanceMode, 0, "Cropping mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping") |
---|
152 | #if AUXILIARY_PICTURES |
---|
153 | ("InputChromaFormat", tmpInputChromaFormat, 420, "InputChromaFormatIDC") |
---|
154 | ("ChromaFormatIDC", tmpChromaFormat, 420, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat)") |
---|
155 | #endif |
---|
156 | ("ConfLeft", m_confWinLeft, 0, "Deprecated alias of ConfWinLeft") |
---|
157 | ("ConfRight", m_confWinRight, 0, "Deprecated alias of ConfWinRight") |
---|
158 | ("ConfTop", m_confWinTop, 0, "Deprecated alias of ConfWinTop") |
---|
159 | ("ConfBottom", m_confWinBottom, 0, "Deprecated alias of ConfWinBottom") |
---|
160 | ("ConfWinLeft", m_confWinLeft, 0, "Left offset for window conformance mode 3") |
---|
161 | ("ConfWinRight", m_confWinRight, 0, "Right offset for window conformance mode 3") |
---|
162 | ("ConfWinTop", m_confWinTop, 0, "Top offset for window conformance mode 3") |
---|
163 | ("ConfWinBottom", m_confWinBottom, 0, "Bottom offset for window conformance mode 3") |
---|
164 | ("HorizontalPadding,-pdx",m_aiPad[0], 0, "horizontal source padding for cropping mode 2") |
---|
165 | ("VerticalPadding,-pdy", m_aiPad[1], 0, "vertical source padding for cropping mode 2") |
---|
166 | ("IntraPeriod,-ip", m_iIntraPeriod, -1, "intra period in frames, (-1: only first frame)") |
---|
167 | ("FrameRate,-fr", m_iFrameRate, 0, "Frame rate") |
---|
168 | ("dQPFile,m", cfg_dQPFile, string(""), "dQP file name") |
---|
169 | ("QP,q", m_fQP, 30.0, "Qp value, if value is float, QP is switched once during encoding") |
---|
170 | #if Q0074_COLOUR_REMAPPING_SEI |
---|
171 | ("SEIColourRemappingInfoFileRoot", cfg_colourRemapSEIFileRoot, string(""), "Colour Remapping Information SEI parameters file name") |
---|
172 | #endif |
---|
173 | ; |
---|
174 | |
---|
175 | po::setDefaults(opts); |
---|
176 | po::parseConfigFile(opts, cfgFileName); |
---|
177 | |
---|
178 | m_cInputFile = cfg_InputFile; |
---|
179 | m_cReconFile = cfg_ReconFile; |
---|
180 | m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str()); |
---|
181 | #if AUXILIARY_PICTURES |
---|
182 | m_InputChromaFormatIDC = numberToChromaFormat(tmpInputChromaFormat); |
---|
183 | m_chromaFormatIDC = ((tmpChromaFormat == 0) ? (m_InputChromaFormatIDC) : (numberToChromaFormat(tmpChromaFormat))); |
---|
184 | #endif |
---|
185 | #if Q0074_COLOUR_REMAPPING_SEI |
---|
186 | if( !cfg_colourRemapSEIFileRoot.empty() ) |
---|
187 | { |
---|
188 | m_colourRemapSEIFileRoot = strdup(cfg_colourRemapSEIFileRoot.c_str()); |
---|
189 | } |
---|
190 | #endif |
---|
191 | |
---|
192 | // reading external dQP description from file |
---|
193 | if ( m_pchdQPFile ) |
---|
194 | { |
---|
195 | FILE* fpt=fopen( m_pchdQPFile, "r" ); |
---|
196 | if ( fpt ) |
---|
197 | { |
---|
198 | Int iValue; |
---|
199 | Int iPOC = 0; |
---|
200 | while ( iPOC < m_cAppEncCfg->getNumFrameToBeEncoded() ) |
---|
201 | { |
---|
202 | if ( fscanf(fpt, "%d", &iValue ) == EOF ) break; |
---|
203 | m_aidQP[ iPOC ] = iValue; |
---|
204 | iPOC++; |
---|
205 | } |
---|
206 | fclose(fpt); |
---|
207 | } |
---|
208 | } |
---|
209 | |
---|
210 | return true; |
---|
211 | } |
---|
212 | |
---|
213 | Void TAppEncLayerCfg::xPrintParameter() |
---|
214 | { |
---|
215 | printf("Input File : %s\n", m_cInputFile.c_str() ); |
---|
216 | printf("Reconstruction File : %s\n", m_cReconFile.c_str() ); |
---|
217 | printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - ( m_confWinLeft + m_confWinRight ) * TComSPS::getWinUnitX( m_chromaFormatIDC ), m_iSourceHeight - ( m_confWinTop + m_confWinBottom ) * TComSPS::getWinUnitY( m_chromaFormatIDC ), m_iFrameRate ); |
---|
218 | printf("Internal Format : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate ); |
---|
219 | printf("PTL index : %d\n", m_layerPTLIdx ); |
---|
220 | printf("Input bit depth : (Y:%d, C:%d)\n", m_inputBitDepth[CHANNEL_TYPE_LUMA], m_inputBitDepth[CHANNEL_TYPE_CHROMA] ); |
---|
221 | printf("Internal bit depth : (Y:%d, C:%d)\n", m_internalBitDepth[CHANNEL_TYPE_LUMA], m_internalBitDepth[CHANNEL_TYPE_CHROMA] ); |
---|
222 | printf("PCM sample bit depth : (Y:%d, C:%d)\n", m_cAppEncCfg->getPCMInputBitDepthFlag() ? m_inputBitDepth[CHANNEL_TYPE_LUMA] : m_internalBitDepth[CHANNEL_TYPE_LUMA], m_cAppEncCfg->getPCMInputBitDepthFlag() ? m_inputBitDepth[CHANNEL_TYPE_CHROMA] : m_internalBitDepth[CHANNEL_TYPE_CHROMA] ); |
---|
223 | std::cout << "Input ChromaFormatIDC :"; |
---|
224 | |
---|
225 | switch (m_InputChromaFormatIDC) |
---|
226 | { |
---|
227 | case CHROMA_400: std::cout << " 4:0:0"; break; |
---|
228 | case CHROMA_420: std::cout << " 4:2:0"; break; |
---|
229 | case CHROMA_422: std::cout << " 4:2:2"; break; |
---|
230 | case CHROMA_444: std::cout << " 4:4:4"; break; |
---|
231 | default: |
---|
232 | std::cerr << "Invalid"; |
---|
233 | exit(1); |
---|
234 | } |
---|
235 | std::cout << std::endl; |
---|
236 | |
---|
237 | std::cout << "Output (internal) ChromaFormatIDC :"; |
---|
238 | switch (m_chromaFormatIDC) |
---|
239 | { |
---|
240 | case CHROMA_400: std::cout << " 4:0:0"; break; |
---|
241 | case CHROMA_420: std::cout << " 4:2:0"; break; |
---|
242 | case CHROMA_422: std::cout << " 4:2:2"; break; |
---|
243 | case CHROMA_444: std::cout << " 4:4:4"; break; |
---|
244 | default: |
---|
245 | std::cerr << "Invalid"; |
---|
246 | exit(1); |
---|
247 | } |
---|
248 | printf("\n"); |
---|
249 | printf("CU size / depth : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth ); |
---|
250 | printf("RQT trans. size (min / max) : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize ); |
---|
251 | printf("Max RQT depth inter : %d\n", m_uiQuadtreeTUMaxDepthInter); |
---|
252 | printf("Max RQT depth intra : %d\n", m_uiQuadtreeTUMaxDepthIntra); |
---|
253 | printf("QP : %5.2f\n", m_fQP ); |
---|
254 | printf("Max dQP signaling depth : %d\n", m_iMaxCuDQPDepth); |
---|
255 | printf("Intra period : %d\n", m_iIntraPeriod ); |
---|
256 | #if RC_SHVC_HARMONIZATION |
---|
257 | printf("RateControl : %d\n", m_RCEnableRateControl ); |
---|
258 | if(m_RCEnableRateControl) |
---|
259 | { |
---|
260 | printf("TargetBitrate : %d\n", m_RCTargetBitrate ); |
---|
261 | printf("KeepHierarchicalBit : %d\n", m_RCKeepHierarchicalBit ); |
---|
262 | printf("LCULevelRC : %d\n", m_RCLCULevelRC ); |
---|
263 | printf("UseLCUSeparateModel : %d\n", m_RCUseLCUSeparateModel ); |
---|
264 | printf("InitialQP : %d\n", m_RCInitialQP ); |
---|
265 | printf("ForceIntraQP : %d\n", m_RCForceIntraQP ); |
---|
266 | } |
---|
267 | #endif |
---|
268 | printf("WaveFrontSynchro : %d\n", m_waveFrontSynchro); |
---|
269 | |
---|
270 | const Int iWaveFrontSubstreams = m_waveFrontSynchro ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1; |
---|
271 | printf("WaveFrontSubstreams : %d\n", iWaveFrontSubstreams); |
---|
272 | printf("PCM : %d ", (m_cAppEncCfg->getUsePCM() && (1<<m_cAppEncCfg->getPCMLog2MinSize()) <= m_uiMaxCUWidth)? 1 : 0); |
---|
273 | } |
---|
274 | |
---|
275 | Bool confirmPara(Bool bflag, const char* message); |
---|
276 | |
---|
277 | Bool TAppEncLayerCfg::xCheckParameter( Bool isField ) |
---|
278 | { |
---|
279 | switch (m_conformanceMode) |
---|
280 | { |
---|
281 | case 0: |
---|
282 | { |
---|
283 | // no cropping or padding |
---|
284 | m_confWinLeft = m_confWinRight = m_confWinTop = m_confWinBottom = 0; |
---|
285 | m_aiPad[1] = m_aiPad[0] = 0; |
---|
286 | break; |
---|
287 | } |
---|
288 | case 1: |
---|
289 | { |
---|
290 | // conformance |
---|
291 | if ((m_confWinLeft != 0) || (m_confWinRight != 0) || (m_confWinTop != 0) || (m_confWinBottom != 0)) |
---|
292 | { |
---|
293 | fprintf(stderr, "Warning: Automatic padding enabled, but cropping parameters are set. Undesired size possible.\n"); |
---|
294 | } |
---|
295 | if ((m_aiPad[1] != 0) || (m_aiPad[0] != 0)) |
---|
296 | { |
---|
297 | fprintf(stderr, "Warning: Automatic padding enabled, but padding parameters are also set\n"); |
---|
298 | } |
---|
299 | |
---|
300 | // automatic padding to minimum CU size |
---|
301 | Int minCuSize = m_uiMaxCUHeight >> (m_uiMaxCUDepth - 1); |
---|
302 | |
---|
303 | if (m_iSourceWidth % minCuSize) |
---|
304 | { |
---|
305 | m_aiPad[0] = m_confWinRight = ((m_iSourceWidth / minCuSize) + 1) * minCuSize - m_iSourceWidth; |
---|
306 | m_iSourceWidth += m_confWinRight; |
---|
307 | m_confWinRight /= TComSPS::getWinUnitX( m_chromaFormatIDC ); |
---|
308 | } |
---|
309 | if (m_iSourceHeight % minCuSize) |
---|
310 | { |
---|
311 | m_aiPad[1] = m_confWinBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight; |
---|
312 | m_iSourceHeight += m_confWinBottom; |
---|
313 | if ( isField ) |
---|
314 | { |
---|
315 | m_iSourceHeightOrg += m_confWinBottom << 1; |
---|
316 | m_aiPad[1] = m_confWinBottom << 1; |
---|
317 | } |
---|
318 | m_confWinBottom /= TComSPS::getWinUnitY( m_chromaFormatIDC ); |
---|
319 | } |
---|
320 | break; |
---|
321 | } |
---|
322 | case 2: |
---|
323 | { |
---|
324 | // conformance |
---|
325 | if ((m_confWinLeft != 0) || (m_confWinRight != 0) || (m_confWinTop != 0) || (m_confWinBottom != 0)) |
---|
326 | { |
---|
327 | fprintf(stderr, "Warning: Automatic padding enabled, but cropping parameters are set. Undesired size possible.\n"); |
---|
328 | } |
---|
329 | |
---|
330 | //padding |
---|
331 | m_iSourceWidth += m_aiPad[0]; |
---|
332 | m_iSourceHeight += m_aiPad[1]; |
---|
333 | m_confWinRight = m_aiPad[0]; |
---|
334 | m_confWinBottom = m_aiPad[1]; |
---|
335 | m_confWinRight /= TComSPS::getWinUnitX( m_chromaFormatIDC ); |
---|
336 | m_confWinBottom /= TComSPS::getWinUnitY( m_chromaFormatIDC ); |
---|
337 | break; |
---|
338 | } |
---|
339 | case 3: |
---|
340 | { |
---|
341 | // conformance |
---|
342 | if ((m_confWinLeft == 0) && (m_confWinRight == 0) && (m_confWinTop == 0) && (m_confWinBottom == 0)) |
---|
343 | { |
---|
344 | fprintf(stderr, "Warning: Cropping enabled, but all cropping parameters set to zero\n"); |
---|
345 | } |
---|
346 | if ((m_aiPad[1] != 0) || (m_aiPad[0]!=0)) |
---|
347 | { |
---|
348 | fprintf(stderr, "Warning: Cropping enabled, padding parameters will be ignored\n"); |
---|
349 | } |
---|
350 | m_aiPad[1] = m_aiPad[0] = 0; |
---|
351 | break; |
---|
352 | } |
---|
353 | } |
---|
354 | |
---|
355 | // allocate slice-based dQP values |
---|
356 | Int iFrameToBeEncoded = m_cAppEncCfg->getNumFrameToBeEncoded(); |
---|
357 | Int iGOPSize = m_cAppEncCfg->getGOPSize(); |
---|
358 | if( m_aidQP == NULL ) |
---|
359 | m_aidQP = new Int[iFrameToBeEncoded + iGOPSize + 1 ]; |
---|
360 | ::memset( m_aidQP, 0, sizeof(Int)*( iFrameToBeEncoded + iGOPSize + 1 ) ); |
---|
361 | |
---|
362 | // handling of floating-point QP values |
---|
363 | // if QP is not integer, sequence is split into two sections having QP and QP+1 |
---|
364 | m_iQP = (Int)( m_fQP ); |
---|
365 | if ( m_iQP < m_fQP ) |
---|
366 | { |
---|
367 | Int iSwitchPOC = (Int)( iFrameToBeEncoded - (m_fQP - m_iQP)*iFrameToBeEncoded + 0.5 ); |
---|
368 | |
---|
369 | |
---|
370 | iSwitchPOC = (Int)( (Double)iSwitchPOC / iGOPSize + 0.5 )*iGOPSize; |
---|
371 | for ( Int i=iSwitchPOC; i<iFrameToBeEncoded + iGOPSize + 1; i++ ) |
---|
372 | { |
---|
373 | m_aidQP[i] = 1; |
---|
374 | } |
---|
375 | } |
---|
376 | |
---|
377 | UInt maxCUWidth = m_uiMaxCUWidth; |
---|
378 | UInt maxCUHeight = m_uiMaxCUHeight; |
---|
379 | UInt maxCUDepth = m_uiMaxCUDepth; |
---|
380 | bool check_failed = false; /* abort if there is a fatal configuration problem */ |
---|
381 | #define xConfirmPara(a,b) check_failed |= confirmPara(a,b) |
---|
382 | // check range of parameters |
---|
383 | xConfirmPara( m_iFrameRate <= 0, "Frame rate must be more than 1" ); |
---|
384 | xConfirmPara( (m_iSourceWidth % (maxCUWidth >> (maxCUDepth-1)))!=0, "Resulting coded frame width must be a multiple of the minimum CU size"); |
---|
385 | xConfirmPara( (m_iSourceHeight % (maxCUHeight >> (maxCUDepth-1)))!=0, "Resulting coded frame height must be a multiple of the minimum CU size"); |
---|
386 | xConfirmPara( (m_iIntraPeriod > 0 && m_iIntraPeriod < iGOPSize) || m_iIntraPeriod == 0, "Intra period must be more than GOP size, or -1 , not 0" ); |
---|
387 | if (m_cAppEncCfg->getDecodingRefreshType() == 2) |
---|
388 | { |
---|
389 | xConfirmPara( m_iIntraPeriod > 0 && m_iIntraPeriod <= iGOPSize , "Intra period must be larger than GOP size for periodic IDR pictures"); |
---|
390 | } |
---|
391 | |
---|
392 | xConfirmPara( m_iQP < -6 * (m_internalBitDepth[CHANNEL_TYPE_LUMA] - 8) || m_iQP > 51, "QP exceeds supported range (-QpBDOffsety to 51)" ); |
---|
393 | |
---|
394 | xConfirmPara( m_waveFrontSynchro < 0, "WaveFrontSynchro cannot be negative" ); |
---|
395 | |
---|
396 | //chekc parameters |
---|
397 | xConfirmPara( m_iSourceWidth % TComSPS::getWinUnitX(CHROMA_420) != 0, "Picture width must be an integer multiple of the specified chroma subsampling"); |
---|
398 | xConfirmPara( m_iSourceHeight % TComSPS::getWinUnitY(CHROMA_420) != 0, "Picture height must be an integer multiple of the specified chroma subsampling"); |
---|
399 | |
---|
400 | xConfirmPara( m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0, "Horizontal padding must be an integer multiple of the specified chroma subsampling"); |
---|
401 | xConfirmPara( m_aiPad[1] % TComSPS::getWinUnitY(CHROMA_420) != 0, "Vertical padding must be an integer multiple of the specified chroma subsampling"); |
---|
402 | |
---|
403 | xConfirmPara( m_iMaxCuDQPDepth > m_uiMaxCUDepth - 1, "Absolute depth for a minimum CuDQP exceeds maximum coding unit depth" ); |
---|
404 | |
---|
405 | xConfirmPara( (m_uiMaxCUWidth >> m_uiMaxCUDepth) < 4, "Minimum partition width size should be larger than or equal to 8"); |
---|
406 | xConfirmPara( (m_uiMaxCUHeight >> m_uiMaxCUDepth) < 4, "Minimum partition height size should be larger than or equal to 8"); |
---|
407 | xConfirmPara( m_uiMaxCUWidth < 16, "Maximum partition width size should be larger than or equal to 16"); |
---|
408 | xConfirmPara( m_uiMaxCUHeight < 16, "Maximum partition height size should be larger than or equal to 16"); |
---|
409 | xConfirmPara( m_uiQuadtreeTULog2MinSize < 2, "QuadtreeTULog2MinSize must be 2 or greater."); |
---|
410 | xConfirmPara( m_uiQuadtreeTULog2MaxSize > 5, "QuadtreeTULog2MaxSize must be 5 or smaller."); |
---|
411 | xConfirmPara( (1<<m_uiQuadtreeTULog2MaxSize) > m_uiMaxCUWidth, "QuadtreeTULog2MaxSize must be log2(maxCUSize) or smaller."); |
---|
412 | xConfirmPara( m_uiQuadtreeTULog2MaxSize < m_uiQuadtreeTULog2MinSize, "QuadtreeTULog2MaxSize must be greater than or equal to m_uiQuadtreeTULog2MinSize."); |
---|
413 | xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUWidth >>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS |
---|
414 | xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUHeight>>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS |
---|
415 | xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUWidth >> m_uiMaxCUDepth ), "Minimum CU width must be greater than minimum transform size." ); |
---|
416 | xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUHeight >> m_uiMaxCUDepth ), "Minimum CU height must be greater than minimum transform size." ); |
---|
417 | xConfirmPara( m_uiQuadtreeTUMaxDepthInter < 1, "QuadtreeTUMaxDepthInter must be greater than or equal to 1" ); |
---|
418 | xConfirmPara( m_uiMaxCUWidth < ( 1 << (m_uiQuadtreeTULog2MinSize + m_uiQuadtreeTUMaxDepthInter - 1) ), "QuadtreeTUMaxDepthInter must be less than or equal to the difference between log2(maxCUSize) and QuadtreeTULog2MinSize plus 1" ); |
---|
419 | xConfirmPara( m_uiQuadtreeTUMaxDepthIntra < 1, "QuadtreeTUMaxDepthIntra must be greater than or equal to 1" ); |
---|
420 | xConfirmPara( m_uiMaxCUWidth < ( 1 << (m_uiQuadtreeTULog2MinSize + m_uiQuadtreeTUMaxDepthIntra - 1) ), "QuadtreeTUMaxDepthInter must be less than or equal to the difference between log2(maxCUSize) and QuadtreeTULog2MinSize plus 1" ); |
---|
421 | |
---|
422 | // max CU width and height should be power of 2 |
---|
423 | UInt ui = m_uiMaxCUWidth; |
---|
424 | while(ui) |
---|
425 | { |
---|
426 | ui >>= 1; |
---|
427 | if( (ui & 1) == 1) |
---|
428 | xConfirmPara( ui != 1 , "Width should be 2^n"); |
---|
429 | } |
---|
430 | ui = m_uiMaxCUHeight; |
---|
431 | while(ui) |
---|
432 | { |
---|
433 | ui >>= 1; |
---|
434 | if( (ui & 1) == 1) |
---|
435 | xConfirmPara( ui != 1 , "Height should be 2^n"); |
---|
436 | } |
---|
437 | |
---|
438 | #undef xConfirmPara |
---|
439 | return check_failed; |
---|
440 | } |
---|
441 | |
---|
442 | #endif //SVC_EXTENSION |
---|
443 | |
---|
444 | |
---|
445 | //! \} |
---|