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