49 #if EXTENSION_360_VIDEO
50 #include "TAppEncHelper360/TExt360AppEncTop.h"
78 if (m_maxTempLayer == 1)
88 m_cTEncTop.setVPS(&vps);
90 m_cTEncTop.setProfile ( m_profile);
91 m_cTEncTop.setLevel ( m_levelTier, m_level);
92 m_cTEncTop.setProgressiveSourceFlag ( m_progressiveSourceFlag);
93 m_cTEncTop.setInterlacedSourceFlag ( m_interlacedSourceFlag);
94 m_cTEncTop.setNonPackedConstraintFlag ( m_nonPackedConstraintFlag);
95 m_cTEncTop.setFrameOnlyConstraintFlag ( m_frameOnlyConstraintFlag);
96 m_cTEncTop.setBitDepthConstraintValue ( m_bitDepthConstraint );
97 m_cTEncTop.setChromaFormatConstraintValue ( m_chromaFormatConstraint );
98 m_cTEncTop.setIntraConstraintFlag ( m_intraConstraintFlag );
99 m_cTEncTop.setOnePictureOnlyConstraintFlag ( m_onePictureOnlyConstraintFlag );
100 m_cTEncTop.setLowerBitRateConstraintFlag ( m_lowerBitRateConstraintFlag );
102 m_cTEncTop.setPrintMSEBasedSequencePSNR ( m_printMSEBasedSequencePSNR);
103 m_cTEncTop.setPrintFrameMSE ( m_printFrameMSE);
104 m_cTEncTop.setPrintSequenceMSE ( m_printSequenceMSE);
105 #if JVET_F0064_MSSSIM
106 m_cTEncTop.setPrintMSSSIM ( m_printMSSSIM );
108 m_cTEncTop.setCabacZeroWordPaddingEnabled ( m_cabacZeroWordPaddingEnabled );
110 m_cTEncTop.setFrameRate ( m_iFrameRate );
111 m_cTEncTop.setFrameSkip ( m_FrameSkip );
112 m_cTEncTop.setTemporalSubsampleRatio ( m_temporalSubsampleRatio );
113 m_cTEncTop.setSourceWidth ( m_iSourceWidth );
114 m_cTEncTop.setSourceHeight ( m_iSourceHeight );
115 m_cTEncTop.setConformanceWindow ( m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom );
116 m_cTEncTop.setFramesToBeEncoded ( m_framesToBeEncoded );
119 m_cTEncTop.setIntraPeriod ( m_iIntraPeriod );
120 m_cTEncTop.setDecodingRefreshType ( m_iDecodingRefreshType );
121 m_cTEncTop.setGOPSize ( m_iGOPSize );
122 #if JCTVC_Y0038_PARAMS
123 m_cTEncTop.setReWriteParamSetsFlag ( m_bReWriteParamSetsFlag );
125 m_cTEncTop.setGopList ( m_GOPList );
126 m_cTEncTop.setExtraRPSs ( m_extraRPSs );
129 m_cTEncTop.setNumReorderPics ( m_numReorderPics[i], i );
130 m_cTEncTop.setMaxDecPicBuffering ( m_maxDecPicBuffering[i], i );
134 m_cTEncTop.setLambdaModifier ( uiLoop, m_adLambdaModifier[ uiLoop ] );
136 m_cTEncTop.setIntraLambdaModifier ( m_adIntraLambdaModifier );
137 m_cTEncTop.setIntraQpFactor ( m_dIntraQpFactor );
139 m_cTEncTop.setQP ( m_iQP );
141 #if X0038_LAMBDA_FROM_QP_CAPABILITY
142 m_cTEncTop.setIntraQPOffset ( m_intraQPOffset );
143 m_cTEncTop.setLambdaFromQPEnable ( m_lambdaFromQPEnable );
145 m_cTEncTop.setPad ( m_aiPad );
147 m_cTEncTop.setAccessUnitDelimiter ( m_AccessUnitDelimiter );
149 m_cTEncTop.setMaxTempLayer ( m_maxTempLayer );
150 m_cTEncTop.setUseAMP( m_enableAMP );
155 m_cTEncTop.setLoopFilterDisable ( m_bLoopFilterDisable );
156 m_cTEncTop.setLoopFilterOffsetInPPS ( m_loopFilterOffsetInPPS );
157 m_cTEncTop.setLoopFilterBetaOffset ( m_loopFilterBetaOffsetDiv2 );
158 m_cTEncTop.setLoopFilterTcOffset ( m_loopFilterTcOffsetDiv2 );
159 m_cTEncTop.setDeblockingFilterMetric ( m_deblockingFilterMetric );
162 m_cTEncTop.setDisableIntraPUsInInterSlices ( m_bDisableIntraPUsInInterSlices );
163 m_cTEncTop.setMotionEstimationSearchMethod ( m_motionEstimationSearchMethod );
164 m_cTEncTop.setSearchRange ( m_iSearchRange );
165 m_cTEncTop.setBipredSearchRange ( m_bipredSearchRange );
166 m_cTEncTop.setClipForBiPredMeEnabled ( m_bClipForBiPredMeEnabled );
167 m_cTEncTop.setFastMEAssumingSmootherMVEnabled ( m_bFastMEAssumingSmootherMVEnabled );
168 m_cTEncTop.setMinSearchWindow ( m_minSearchWindow );
169 m_cTEncTop.setRestrictMESampling ( m_bRestrictMESampling );
172 m_cTEncTop.setMaxDeltaQP ( m_iMaxDeltaQP );
173 m_cTEncTop.setMaxCuDQPDepth ( m_iMaxCuDQPDepth );
174 m_cTEncTop.setDiffCuChromaQpOffsetDepth ( m_diffCuChromaQpOffsetDepth );
175 m_cTEncTop.setChromaCbQpOffset ( m_cbQpOffset );
176 m_cTEncTop.setChromaCrQpOffset ( m_crQpOffset );
177 m_cTEncTop.setWCGChromaQpControl ( m_wcgChromaQpControl );
178 m_cTEncTop.setSliceChromaOffsetQpIntraOrPeriodic ( m_sliceChromaQpOffsetPeriodicity, m_sliceChromaQpOffsetIntraOrPeriodic );
179 m_cTEncTop.setChromaFormatIdc ( m_chromaFormatIDC );
181 #if ADAPTIVE_QP_SELECTION
182 m_cTEncTop.setUseAdaptQpSelect ( m_bUseAdaptQpSelect );
185 m_cTEncTop.setUseAdaptiveQP ( m_bUseAdaptiveQP );
186 m_cTEncTop.setQPAdaptationRange ( m_iQPAdaptationRange );
187 m_cTEncTop.setExtendedPrecisionProcessingFlag ( m_extendedPrecisionProcessingFlag );
188 m_cTEncTop.setHighPrecisionOffsetsEnabledFlag ( m_highPrecisionOffsetsEnabledFlag );
190 m_cTEncTop.setWeightedPredictionMethod( m_weightedPredictionMethod );
193 m_cTEncTop.setLumaLevelToDeltaQPControls ( m_lumaLevelToDeltaQPMapping );
194 #if X0038_LAMBDA_FROM_QP_CAPABILITY
197 m_cTEncTop.setDeltaQpRD ( m_uiDeltaQpRD );
199 m_cTEncTop.setFastDeltaQp ( m_bFastDeltaQP );
200 m_cTEncTop.setUseASR ( m_bUseASR );
201 m_cTEncTop.setUseHADME ( m_bUseHADME );
202 m_cTEncTop.setdQPs ( m_aidQP );
203 m_cTEncTop.setUseRDOQ ( m_useRDOQ );
204 m_cTEncTop.setUseRDOQTS ( m_useRDOQTS );
205 m_cTEncTop.setUseSelectiveRDOQ ( m_useSelectiveRDOQ );
206 m_cTEncTop.setRDpenalty ( m_rdPenalty );
207 m_cTEncTop.setMaxCUWidth ( m_uiMaxCUWidth );
208 m_cTEncTop.setMaxCUHeight ( m_uiMaxCUHeight );
209 m_cTEncTop.setMaxTotalCUDepth ( m_uiMaxTotalCUDepth );
210 m_cTEncTop.setLog2DiffMaxMinCodingBlockSize ( m_uiLog2DiffMaxMinCodingBlockSize );
211 m_cTEncTop.setQuadtreeTULog2MaxSize ( m_uiQuadtreeTULog2MaxSize );
212 m_cTEncTop.setQuadtreeTULog2MinSize ( m_uiQuadtreeTULog2MinSize );
213 m_cTEncTop.setQuadtreeTUMaxDepthInter ( m_uiQuadtreeTUMaxDepthInter );
214 m_cTEncTop.setQuadtreeTUMaxDepthIntra ( m_uiQuadtreeTUMaxDepthIntra );
215 m_cTEncTop.setFastInterSearchMode ( m_fastInterSearchMode );
216 m_cTEncTop.setUseEarlyCU ( m_bUseEarlyCU );
217 m_cTEncTop.setUseFastDecisionForMerge ( m_useFastDecisionForMerge );
218 m_cTEncTop.setUseCbfFastMode ( m_bUseCbfFastMode );
219 m_cTEncTop.setUseEarlySkipDetection ( m_useEarlySkipDetection );
220 m_cTEncTop.setCrossComponentPredictionEnabledFlag ( m_crossComponentPredictionEnabledFlag );
221 m_cTEncTop.setUseReconBasedCrossCPredictionEstimate ( m_reconBasedCrossCPredictionEstimate );
224 m_cTEncTop.setUseTransformSkip ( m_useTransformSkip );
225 m_cTEncTop.setUseTransformSkipFast ( m_useTransformSkipFast );
226 m_cTEncTop.setTransformSkipRotationEnabledFlag ( m_transformSkipRotationEnabledFlag );
227 m_cTEncTop.setTransformSkipContextEnabledFlag ( m_transformSkipContextEnabledFlag );
228 m_cTEncTop.setPersistentRiceAdaptationEnabledFlag ( m_persistentRiceAdaptationEnabledFlag );
229 m_cTEncTop.setCabacBypassAlignmentEnabledFlag ( m_cabacBypassAlignmentEnabledFlag );
230 m_cTEncTop.setLog2MaxTransformSkipBlockSize ( m_log2MaxTransformSkipBlockSize );
233 m_cTEncTop.setRdpcmEnabledFlag (
RDPCMSignallingMode(signallingModeIndex), m_rdpcmEnabledFlag[signallingModeIndex]);
235 m_cTEncTop.setUseConstrainedIntraPred ( m_bUseConstrainedIntraPred );
236 m_cTEncTop.setFastUDIUseMPMEnabled ( m_bFastUDIUseMPMEnabled );
237 m_cTEncTop.setFastMEForGenBLowDelayEnabled ( m_bFastMEForGenBLowDelayEnabled );
238 m_cTEncTop.setUseBLambdaForNonKeyLowDelayPictures ( m_bUseBLambdaForNonKeyLowDelayPictures );
239 m_cTEncTop.setPCMLog2MinSize ( m_uiPCMLog2MinSize);
240 m_cTEncTop.setUsePCM ( m_usePCM );
245 m_cTEncTop.setBitDepth((
ChannelType)channelType, m_internalBitDepth[channelType]);
246 m_cTEncTop.setPCMBitDepth((
ChannelType)channelType, m_bPCMInputBitDepthFlag ? m_MSBExtendedBitDepth[channelType] : m_internalBitDepth[channelType]);
249 m_cTEncTop.setPCMLog2MaxSize ( m_pcmLog2MaxSize);
250 m_cTEncTop.setMaxNumMergeCand ( m_maxNumMergeCand );
254 m_cTEncTop.setUseWP ( m_useWeightedPred );
255 m_cTEncTop.setWPBiPred ( m_useWeightedBiPred );
258 m_cTEncTop.setLog2ParallelMergeLevelMinus2 ( m_log2ParallelMergeLevel - 2 );
261 m_cTEncTop.setSliceMode ( m_sliceMode );
262 m_cTEncTop.setSliceArgument ( m_sliceArgument );
265 m_cTEncTop.setSliceSegmentMode ( m_sliceSegmentMode );
266 m_cTEncTop.setSliceSegmentArgument ( m_sliceSegmentArgument );
270 m_bLFCrossSliceBoundaryFlag =
true;
272 m_cTEncTop.setLFCrossSliceBoundaryFlag ( m_bLFCrossSliceBoundaryFlag );
273 m_cTEncTop.setUseSAO ( m_bUseSAO );
274 m_cTEncTop.setTestSAODisableAtPictureLevel ( m_bTestSAODisableAtPictureLevel );
275 m_cTEncTop.setSaoEncodingRate ( m_saoEncodingRate );
276 m_cTEncTop.setSaoEncodingRateChroma ( m_saoEncodingRateChroma );
277 m_cTEncTop.setMaxNumOffsetsPerPic ( m_maxNumOffsetsPerPic);
279 m_cTEncTop.setSaoCtuBoundary ( m_saoCtuBoundary);
280 m_cTEncTop.setSaoResetEncoderStateAfterIRAP ( m_saoResetEncoderStateAfterIRAP);
281 m_cTEncTop.setPCMInputBitDepthFlag ( m_bPCMInputBitDepthFlag);
282 m_cTEncTop.setPCMFilterDisableFlag ( m_bPCMFilterDisableFlag);
284 m_cTEncTop.setIntraSmoothingDisabledFlag (!m_enableIntraReferenceSmoothing );
285 m_cTEncTop.setDecodedPictureHashSEIType ( m_decodedPictureHashSEIType );
286 m_cTEncTop.setRecoveryPointSEIEnabled ( m_recoveryPointSEIEnabled );
287 m_cTEncTop.setBufferingPeriodSEIEnabled ( m_bufferingPeriodSEIEnabled );
288 m_cTEncTop.setPictureTimingSEIEnabled ( m_pictureTimingSEIEnabled );
289 m_cTEncTop.setToneMappingInfoSEIEnabled ( m_toneMappingInfoSEIEnabled );
290 m_cTEncTop.setTMISEIToneMapId ( m_toneMapId );
291 m_cTEncTop.setTMISEIToneMapCancelFlag ( m_toneMapCancelFlag );
292 m_cTEncTop.setTMISEIToneMapPersistenceFlag ( m_toneMapPersistenceFlag );
293 m_cTEncTop.setTMISEICodedDataBitDepth ( m_toneMapCodedDataBitDepth );
294 m_cTEncTop.setTMISEITargetBitDepth ( m_toneMapTargetBitDepth );
295 m_cTEncTop.setTMISEIModelID ( m_toneMapModelId );
296 m_cTEncTop.setTMISEIMinValue ( m_toneMapMinValue );
297 m_cTEncTop.setTMISEIMaxValue ( m_toneMapMaxValue );
298 m_cTEncTop.setTMISEISigmoidMidpoint ( m_sigmoidMidpoint );
299 m_cTEncTop.setTMISEISigmoidWidth ( m_sigmoidWidth );
300 m_cTEncTop.setTMISEIStartOfCodedInterva ( m_startOfCodedInterval );
301 m_cTEncTop.setTMISEINumPivots ( m_numPivots );
302 m_cTEncTop.setTMISEICodedPivotValue ( m_codedPivotValue );
303 m_cTEncTop.setTMISEITargetPivotValue ( m_targetPivotValue );
304 m_cTEncTop.setTMISEICameraIsoSpeedIdc ( m_cameraIsoSpeedIdc );
305 m_cTEncTop.setTMISEICameraIsoSpeedValue ( m_cameraIsoSpeedValue );
306 m_cTEncTop.setTMISEIExposureIndexIdc ( m_exposureIndexIdc );
307 m_cTEncTop.setTMISEIExposureIndexValue ( m_exposureIndexValue );
308 m_cTEncTop.setTMISEIExposureCompensationValueSignFlag ( m_exposureCompensationValueSignFlag );
309 m_cTEncTop.setTMISEIExposureCompensationValueNumerator ( m_exposureCompensationValueNumerator );
310 m_cTEncTop.setTMISEIExposureCompensationValueDenomIdc ( m_exposureCompensationValueDenomIdc );
311 m_cTEncTop.setTMISEIRefScreenLuminanceWhite ( m_refScreenLuminanceWhite );
312 m_cTEncTop.setTMISEIExtendedRangeWhiteLevel ( m_extendedRangeWhiteLevel );
313 m_cTEncTop.setTMISEINominalBlackLevelLumaCodeValue ( m_nominalBlackLevelLumaCodeValue );
314 m_cTEncTop.setTMISEINominalWhiteLevelLumaCodeValue ( m_nominalWhiteLevelLumaCodeValue );
315 m_cTEncTop.setTMISEIExtendedWhiteLevelLumaCodeValue ( m_extendedWhiteLevelLumaCodeValue );
316 m_cTEncTop.setChromaResamplingFilterHintEnabled ( m_chromaResamplingFilterSEIenabled );
317 m_cTEncTop.setChromaResamplingHorFilterIdc ( m_chromaResamplingHorFilterIdc );
318 m_cTEncTop.setChromaResamplingVerFilterIdc ( m_chromaResamplingVerFilterIdc );
319 m_cTEncTop.setFramePackingArrangementSEIEnabled ( m_framePackingSEIEnabled );
320 m_cTEncTop.setFramePackingArrangementSEIType ( m_framePackingSEIType );
321 m_cTEncTop.setFramePackingArrangementSEIId ( m_framePackingSEIId );
322 m_cTEncTop.setFramePackingArrangementSEIQuincunx ( m_framePackingSEIQuincunx );
323 m_cTEncTop.setFramePackingArrangementSEIInterpretation ( m_framePackingSEIInterpretation );
324 m_cTEncTop.setSegmentedRectFramePackingArrangementSEIEnabled ( m_segmentedRectFramePackingSEIEnabled );
325 m_cTEncTop.setSegmentedRectFramePackingArrangementSEICancel ( m_segmentedRectFramePackingSEICancel );
326 m_cTEncTop.setSegmentedRectFramePackingArrangementSEIType ( m_segmentedRectFramePackingSEIType );
327 m_cTEncTop.setSegmentedRectFramePackingArrangementSEIPersistence( m_segmentedRectFramePackingSEIPersistence );
328 m_cTEncTop.setDisplayOrientationSEIAngle ( m_displayOrientationSEIAngle );
329 m_cTEncTop.setTemporalLevel0IndexSEIEnabled ( m_temporalLevel0IndexSEIEnabled );
330 m_cTEncTop.setGradualDecodingRefreshInfoEnabled ( m_gradualDecodingRefreshInfoEnabled );
331 m_cTEncTop.setNoDisplaySEITLayer ( m_noDisplaySEITLayer );
332 m_cTEncTop.setDecodingUnitInfoSEIEnabled ( m_decodingUnitInfoSEIEnabled );
333 m_cTEncTop.setSOPDescriptionSEIEnabled ( m_SOPDescriptionSEIEnabled );
334 m_cTEncTop.setScalableNestingSEIEnabled ( m_scalableNestingSEIEnabled );
335 m_cTEncTop.setTMCTSSEIEnabled ( m_tmctsSEIEnabled );
337 m_cTEncTop.setTMCTSSEITileConstraint ( m_tmctsSEITileConstraint );
339 m_cTEncTop.setTimeCodeSEIEnabled ( m_timeCodeSEIEnabled );
340 m_cTEncTop.setNumberOfTimeSets ( m_timeCodeSEINumTs );
341 for(
Int i = 0; i < m_timeCodeSEINumTs; i++)
343 m_cTEncTop.setTimeSet(m_timeSetArray[i], i);
345 m_cTEncTop.setKneeSEIEnabled ( m_kneeSEIEnabled );
346 m_cTEncTop.setKneeFunctionInformationSEI ( m_kneeFunctionInformationSEI );
348 m_cTEncTop.setCcvSEIEnabled (m_ccvSEIEnabled);
349 m_cTEncTop.setCcvSEICancelFlag (m_ccvSEICancelFlag);
350 m_cTEncTop.setCcvSEIPersistenceFlag (m_ccvSEIPersistenceFlag);
352 m_cTEncTop.setCcvSEIEnabled (m_ccvSEIEnabled);
353 m_cTEncTop.setCcvSEICancelFlag (m_ccvSEICancelFlag);
354 m_cTEncTop.setCcvSEIPersistenceFlag (m_ccvSEIPersistenceFlag);
355 m_cTEncTop.setCcvSEIPrimariesPresentFlag (m_ccvSEIPrimariesPresentFlag);
356 m_cTEncTop.setCcvSEIMinLuminanceValuePresentFlag (m_ccvSEIMinLuminanceValuePresentFlag);
357 m_cTEncTop.setCcvSEIMaxLuminanceValuePresentFlag (m_ccvSEIMaxLuminanceValuePresentFlag);
358 m_cTEncTop.setCcvSEIAvgLuminanceValuePresentFlag (m_ccvSEIAvgLuminanceValuePresentFlag);
360 m_cTEncTop.setCcvSEIPrimariesX (m_ccvSEIPrimariesX[i], i);
361 m_cTEncTop.setCcvSEIPrimariesY (m_ccvSEIPrimariesY[i], i);
363 m_cTEncTop.setCcvSEIMinLuminanceValue (m_ccvSEIMinLuminanceValue);
364 m_cTEncTop.setCcvSEIMaxLuminanceValue (m_ccvSEIMaxLuminanceValue);
365 m_cTEncTop.setCcvSEIAvgLuminanceValue (m_ccvSEIAvgLuminanceValue);
367 #if ERP_SR_OV_SEI_MESSAGE
368 m_cTEncTop.setErpSEIEnabled ( m_erpSEIEnabled );
369 m_cTEncTop.setErpSEICancelFlag ( m_erpSEICancelFlag );
370 m_cTEncTop.setErpSEIPersistenceFlag ( m_erpSEIPersistenceFlag );
371 m_cTEncTop.setErpSEIGuardBandFlag ( m_erpSEIGuardBandFlag );
372 m_cTEncTop.setErpSEIGuardBandType ( m_erpSEIGuardBandType );
373 m_cTEncTop.setErpSEILeftGuardBandWidth ( m_erpSEILeftGuardBandWidth );
374 m_cTEncTop.setErpSEIRightGuardBandWidth ( m_erpSEIRightGuardBandWidth );
375 m_cTEncTop.setSphereRotationSEIEnabled ( m_sphereRotationSEIEnabled );
376 m_cTEncTop.setSphereRotationSEICancelFlag ( m_sphereRotationSEICancelFlag );
377 m_cTEncTop.setSphereRotationSEIPersistenceFlag ( m_sphereRotationSEIPersistenceFlag );
378 m_cTEncTop.setSphereRotationSEIYaw ( m_sphereRotationSEIYaw );
379 m_cTEncTop.setSphereRotationSEIPitch ( m_sphereRotationSEIPitch );
380 m_cTEncTop.setSphereRotationSEIRoll ( m_sphereRotationSEIRoll );
381 m_cTEncTop.setOmniViewportSEIEnabled ( m_omniViewportSEIEnabled );
382 m_cTEncTop.setOmniViewportSEIId ( m_omniViewportSEIId );
383 m_cTEncTop.setOmniViewportSEICancelFlag ( m_omniViewportSEICancelFlag );
384 m_cTEncTop.setOmniViewportSEIPersistenceFlag ( m_omniViewportSEIPersistenceFlag );
385 m_cTEncTop.setOmniViewportSEICntMinus1 ( m_omniViewportSEICntMinus1 );
386 m_cTEncTop.setOmniViewportSEIAzimuthCentre ( m_omniViewportSEIAzimuthCentre );
387 m_cTEncTop.setOmniViewportSEIElevationCentre ( m_omniViewportSEIElevationCentre );
388 m_cTEncTop.setOmniViewportSEITiltCentre ( m_omniViewportSEITiltCentre );
389 m_cTEncTop.setOmniViewportSEIHorRange ( m_omniViewportSEIHorRange );
390 m_cTEncTop.setOmniViewportSEIVerRange ( m_omniViewportSEIVerRange );
393 m_cTEncTop.setCmpSEIEnabled (m_cmpSEIEnabled);
394 m_cTEncTop.setCmpSEICmpCancelFlag (m_cmpSEICmpCancelFlag);
395 m_cTEncTop.setCmpSEICmpPersistenceFlag (m_cmpSEICmpPersistenceFlag);
398 m_cTEncTop.setRwpSEIEnabled (m_rwpSEIEnabled);
399 m_cTEncTop.setRwpSEIRwpCancelFlag (m_rwpSEIRwpCancelFlag);
400 m_cTEncTop.setRwpSEIRwpPersistenceFlag (m_rwpSEIRwpPersistenceFlag);
401 m_cTEncTop.setRwpSEIConstituentPictureMatchingFlag (m_rwpSEIConstituentPictureMatchingFlag);
402 m_cTEncTop.setRwpSEINumPackedRegions (m_rwpSEINumPackedRegions);
403 m_cTEncTop.setRwpSEIProjPictureWidth (m_rwpSEIProjPictureWidth);
404 m_cTEncTop.setRwpSEIProjPictureHeight (m_rwpSEIProjPictureHeight);
405 m_cTEncTop.setRwpSEIPackedPictureWidth (m_rwpSEIPackedPictureWidth);
406 m_cTEncTop.setRwpSEIPackedPictureHeight (m_rwpSEIPackedPictureHeight);
407 m_cTEncTop.setRwpSEIRwpTransformType (m_rwpSEIRwpTransformType);
408 m_cTEncTop.setRwpSEIRwpGuardBandFlag (m_rwpSEIRwpGuardBandFlag);
409 m_cTEncTop.setRwpSEIProjRegionWidth (m_rwpSEIProjRegionWidth);
410 m_cTEncTop.setRwpSEIProjRegionHeight (m_rwpSEIProjRegionHeight);
411 m_cTEncTop.setRwpSEIRwpSEIProjRegionTop (m_rwpSEIRwpSEIProjRegionTop);
412 m_cTEncTop.setRwpSEIProjRegionLeft (m_rwpSEIProjRegionLeft);
413 m_cTEncTop.setRwpSEIPackedRegionWidth (m_rwpSEIPackedRegionWidth);
414 m_cTEncTop.setRwpSEIPackedRegionHeight (m_rwpSEIPackedRegionHeight);
415 m_cTEncTop.setRwpSEIPackedRegionTop (m_rwpSEIPackedRegionTop);
416 m_cTEncTop.setRwpSEIPackedRegionLeft (m_rwpSEIPackedRegionLeft);
417 m_cTEncTop.setRwpSEIRwpLeftGuardBandWidth (m_rwpSEIRwpLeftGuardBandWidth);
418 m_cTEncTop.setRwpSEIRwpRightGuardBandWidth (m_rwpSEIRwpRightGuardBandWidth);
419 m_cTEncTop.setRwpSEIRwpTopGuardBandHeight (m_rwpSEIRwpTopGuardBandHeight);
420 m_cTEncTop.setRwpSEIRwpBottomGuardBandHeight (m_rwpSEIRwpBottomGuardBandHeight);
421 m_cTEncTop.setRwpSEIRwpGuardBandNotUsedForPredFlag (m_rwpSEIRwpGuardBandNotUsedForPredFlag);
422 m_cTEncTop.setRwpSEIRwpGuardBandType (m_rwpSEIRwpGuardBandType);
424 m_cTEncTop.setColourRemapInfoSEIFileRoot ( m_colourRemapSEIFileRoot );
425 m_cTEncTop.setMasteringDisplaySEI ( m_masteringDisplay );
426 m_cTEncTop.setSEIAlternativeTransferCharacteristicsSEIEnable ( m_preferredTransferCharacteristics>=0 );
427 m_cTEncTop.setSEIPreferredTransferCharacteristics (
UChar(m_preferredTransferCharacteristics) );
428 m_cTEncTop.setSEIGreenMetadataInfoSEIEnable ( m_greenMetadataType > 0 );
429 m_cTEncTop.setSEIGreenMetadataType (
UChar(m_greenMetadataType) );
430 m_cTEncTop.setSEIXSDMetricType (
UChar(m_xsdMetricType) );
432 m_cTEncTop.setRegionalNestingSEIFileRoot ( m_regionalNestingSEIFileRoot );
434 m_cTEncTop.setTileUniformSpacingFlag ( m_tileUniformSpacingFlag );
435 m_cTEncTop.setNumColumnsMinus1 ( m_numTileColumnsMinus1 );
436 m_cTEncTop.setNumRowsMinus1 ( m_numTileRowsMinus1 );
437 if(!m_tileUniformSpacingFlag)
439 m_cTEncTop.setColumnWidth ( m_tileColumnWidth );
440 m_cTEncTop.setRowHeight ( m_tileRowHeight );
442 m_cTEncTop.xCheckGSParameters();
443 Int uiTilesCount = (m_numTileRowsMinus1+1) * (m_numTileColumnsMinus1+1);
444 if(uiTilesCount == 1)
446 m_bLFCrossTileBoundaryFlag =
true;
448 m_cTEncTop.setLFCrossTileBoundaryFlag ( m_bLFCrossTileBoundaryFlag );
449 m_cTEncTop.setEntropyCodingSyncEnabledFlag ( m_entropyCodingSyncEnabledFlag );
450 m_cTEncTop.setTMVPModeId ( m_TMVPModeId );
451 m_cTEncTop.setUseScalingListId ( m_useScalingListId );
452 m_cTEncTop.setScalingListFileName ( m_scalingListFileName );
453 m_cTEncTop.setSignDataHidingEnabledFlag ( m_signDataHidingEnabledFlag);
454 m_cTEncTop.setUseRateCtrl ( m_RCEnableRateControl );
455 m_cTEncTop.setTargetBitrate ( m_RCTargetBitrate );
456 m_cTEncTop.setKeepHierBit ( m_RCKeepHierarchicalBit );
457 m_cTEncTop.setLCULevelRC ( m_RCLCULevelRC );
458 m_cTEncTop.setUseLCUSeparateModel ( m_RCUseLCUSeparateModel );
459 m_cTEncTop.setInitialQP ( m_RCInitialQP );
460 m_cTEncTop.setForceIntraQP ( m_RCForceIntraQP );
461 m_cTEncTop.setCpbSaturationEnabled ( m_RCCpbSaturationEnabled );
462 m_cTEncTop.setCpbSize ( m_RCCpbSize );
463 m_cTEncTop.setInitialCpbFullness ( m_RCInitialCpbFullness );
464 m_cTEncTop.setTransquantBypassEnabledFlag ( m_TransquantBypassEnabledFlag );
465 m_cTEncTop.setCUTransquantBypassFlagForceValue ( m_CUTransquantBypassFlagForce );
466 m_cTEncTop.setCostMode ( m_costMode );
467 m_cTEncTop.setUseRecalculateQPAccordingToLambda ( m_recalculateQPAccordingToLambda );
468 m_cTEncTop.setUseStrongIntraSmoothing ( m_useStrongIntraSmoothing );
469 m_cTEncTop.setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled );
470 m_cTEncTop.setVuiParametersPresentFlag ( m_vuiParametersPresentFlag );
471 m_cTEncTop.setAspectRatioInfoPresentFlag ( m_aspectRatioInfoPresentFlag);
472 m_cTEncTop.setAspectRatioIdc ( m_aspectRatioIdc );
473 m_cTEncTop.setSarWidth ( m_sarWidth );
474 m_cTEncTop.setSarHeight ( m_sarHeight );
475 m_cTEncTop.setOverscanInfoPresentFlag ( m_overscanInfoPresentFlag );
476 m_cTEncTop.setOverscanAppropriateFlag ( m_overscanAppropriateFlag );
477 m_cTEncTop.setVideoSignalTypePresentFlag ( m_videoSignalTypePresentFlag );
478 m_cTEncTop.setVideoFormat ( m_videoFormat );
479 m_cTEncTop.setVideoFullRangeFlag ( m_videoFullRangeFlag );
480 m_cTEncTop.setColourDescriptionPresentFlag ( m_colourDescriptionPresentFlag );
481 m_cTEncTop.setColourPrimaries ( m_colourPrimaries );
482 m_cTEncTop.setTransferCharacteristics ( m_transferCharacteristics );
483 m_cTEncTop.setMatrixCoefficients ( m_matrixCoefficients );
484 m_cTEncTop.setChromaLocInfoPresentFlag ( m_chromaLocInfoPresentFlag );
485 m_cTEncTop.setChromaSampleLocTypeTopField ( m_chromaSampleLocTypeTopField );
486 m_cTEncTop.setChromaSampleLocTypeBottomField ( m_chromaSampleLocTypeBottomField );
487 m_cTEncTop.setNeutralChromaIndicationFlag ( m_neutralChromaIndicationFlag );
488 m_cTEncTop.setDefaultDisplayWindow ( m_defDispWinLeftOffset, m_defDispWinRightOffset, m_defDispWinTopOffset, m_defDispWinBottomOffset );
489 m_cTEncTop.setFrameFieldInfoPresentFlag ( m_frameFieldInfoPresentFlag );
490 m_cTEncTop.setPocProportionalToTimingFlag ( m_pocProportionalToTimingFlag );
491 m_cTEncTop.setNumTicksPocDiffOneMinus1 ( m_numTicksPocDiffOneMinus1 );
492 m_cTEncTop.setBitstreamRestrictionFlag ( m_bitstreamRestrictionFlag );
493 m_cTEncTop.setTilesFixedStructureFlag ( m_tilesFixedStructureFlag );
494 m_cTEncTop.setMotionVectorsOverPicBoundariesFlag ( m_motionVectorsOverPicBoundariesFlag );
495 m_cTEncTop.setMinSpatialSegmentationIdc ( m_minSpatialSegmentationIdc );
496 m_cTEncTop.setMaxBytesPerPicDenom ( m_maxBytesPerPicDenom );
497 m_cTEncTop.setMaxBitsPerMinCuDenom ( m_maxBitsPerMinCuDenom );
498 m_cTEncTop.setLog2MaxMvLengthHorizontal ( m_log2MaxMvLengthHorizontal );
499 m_cTEncTop.setLog2MaxMvLengthVertical ( m_log2MaxMvLengthVertical );
500 m_cTEncTop.setEfficientFieldIRAPEnabled ( m_bEfficientFieldIRAPEnabled );
501 m_cTEncTop.setHarmonizeGopFirstFieldCoupleEnabled ( m_bHarmonizeGopFirstFieldCoupleEnabled );
503 m_cTEncTop.setSummaryOutFilename ( m_summaryOutFilename );
504 m_cTEncTop.setSummaryPicFilenameBase ( m_summaryPicFilenameBase );
505 m_cTEncTop.setSummaryVerboseness ( m_summaryVerboseness );
511 m_cTVideoIOYuvInputFile.open( m_inputFileName,
false, m_inputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth );
512 m_cTVideoIOYuvInputFile.skipFrames(m_FrameSkip, m_inputFileWidth, m_inputFileHeight, m_InputChromaFormatIDC);
514 if (!m_reconFileName.empty())
516 m_cTVideoIOYuvReconFile.open(m_reconFileName,
true, m_outputBitDepth, m_outputBitDepth, m_internalBitDepth);
526 m_cTVideoIOYuvInputFile.close();
527 m_cTVideoIOYuvReconFile.close();
530 m_cTEncTop.destroy();
535 m_cTEncTop.init(isFieldCoding);
552 fstream bitstreamFile(m_bitstreamFileName.c_str(), fstream::binary | fstream::out);
555 fprintf(stderr,
"\nfailed to open bitstream file `%s' for writing\n", m_bitstreamFileName.c_str());
576 list<AccessUnit> outputAccessUnits;
583 pcPicYuvOrg->
create ( m_iSourceWidth, m_iSourceHeightOrg, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth,
true );
584 cPicYuvTrueOrg.
create(m_iSourceWidth, m_iSourceHeightOrg, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth,
true);
588 pcPicYuvOrg->
create ( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth,
true );
589 cPicYuvTrueOrg.
create(m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth,
true );
592 #if EXTENSION_360_VIDEO
593 TExt360AppEncTop ext360(*
this, m_cTEncTop.getGOPEncoder()->getExt360Data(), *(m_cTEncTop.getGOPEncoder()), *pcPicYuvOrg);
599 xGetBuffer(pcPicYuvRec);
602 #if EXTENSION_360_VIDEO
603 if (ext360.isEnabled())
605 ext360.read(m_cTVideoIOYuvInputFile, *pcPicYuvOrg, cPicYuvTrueOrg, ipCSC);
609 m_cTVideoIOYuvInputFile.read( pcPicYuvOrg, &cPicYuvTrueOrg, ipCSC, m_aiPad, m_InputChromaFormatIDC, m_bClipInputVideoToRec709Range );
612 m_cTVideoIOYuvInputFile.read( pcPicYuvOrg, &cPicYuvTrueOrg, ipCSC, m_aiPad, m_InputChromaFormatIDC, m_bClipInputVideoToRec709Range );
618 bEos = (m_isField && (m_iFrameRcvd == (m_framesToBeEncoded >> 1) )) || ( !m_isField && (m_iFrameRcvd == m_framesToBeEncoded) );
622 if (m_cTVideoIOYuvInputFile.isEof())
627 m_cTEncTop.setFramesToBeEncoded(m_iFrameRcvd);
633 m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, flush ? 0 : &cPicYuvTrueOrg, snrCSC, m_cListPicYuvRec, outputAccessUnits, iNumEncoded, m_isTopFieldFirst );
637 m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, flush ? 0 : &cPicYuvTrueOrg, snrCSC, m_cListPicYuvRec, outputAccessUnits, iNumEncoded );
641 if ( iNumEncoded > 0 )
643 xWriteOutput(bitstreamFile, iNumEncoded, outputAccessUnits);
644 outputAccessUnits.clear();
647 if( m_temporalSubsampleRatio > 1 )
649 m_cTVideoIOYuvInputFile.skipFrames(m_temporalSubsampleRatio-1, m_inputFileWidth, m_inputFileHeight, m_InputChromaFormatIDC);
653 m_cTEncTop.printSummary(m_isField);
661 m_cTEncTop.deletePicBuffer();
685 assert( m_iGOPSize > 0 );
688 if ( m_cListPicYuvRec.size() >= (
UInt)m_iGOPSize )
690 rpcPicYuvRec = m_cListPicYuvRec.popFront();
697 rpcPicYuvRec->
create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth,
true );
700 m_cListPicYuvRec.pushBack( rpcPicYuvRec );
707 Int iSize =
Int( m_cListPicYuvRec.size() );
709 for (
Int i = 0; i < iSize; i++ )
713 delete pcPicYuvRec; pcPicYuvRec =
NULL;
733 list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin();
735 for ( i = 0; i < iNumEncoded; i++ )
740 for ( i = 0; i < iNumEncoded/2; i++ )
742 TComPicYuv* pcPicYuvRecTop = *(iterPicYuvRec++);
743 TComPicYuv* pcPicYuvRecBottom = *(iterPicYuvRec++);
745 if (!m_reconFileName.empty())
747 m_cTVideoIOYuvReconFile.write( pcPicYuvRecTop, pcPicYuvRecBottom, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom,
NUM_CHROMA_FORMAT, m_isTopFieldFirst );
751 const vector<UInt>& statsTop =
writeAnnexB(bitstreamFile, auTop);
752 rateStatsAccum(auTop, statsTop);
754 const AccessUnit& auBottom = *(iterBitstream++);
755 const vector<UInt>& statsBottom =
writeAnnexB(bitstreamFile, auBottom);
756 rateStatsAccum(auBottom, statsBottom);
764 list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin();
766 for ( i = 0; i < iNumEncoded; i++ )
771 for ( i = 0; i < iNumEncoded; i++ )
774 if (!m_reconFileName.empty())
776 m_cTVideoIOYuvReconFile.write( pcPicYuvRec, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom,
781 const vector<UInt>& stats =
writeAnnexB(bitstreamFile, au);
782 rateStatsAccum(au, stats);
792 AccessUnit::const_iterator it_au = au.begin();
793 vector<UInt>::const_iterator it_stats = annexBsizes.begin();
795 for (; it_au != au.end(); it_au++, it_stats++)
797 switch ((*it_au)->m_nalUnitType)
818 m_essentialBytes += *it_stats;
824 m_totalBytes += *it_stats;
830 Double time = (
Double) m_iFrameRcvd / m_iFrameRate * m_temporalSubsampleRatio;
831 printf(
"Bytes written to file: %u (%.3f kbps)\n", m_totalBytes, 0.008 * m_totalBytes / time);
832 if (m_summaryVerboseness > 0)
834 printf(
"Bytes for SPS/PPS/Slice (Incl. Annex B): %u (%.3f kbps)\n", m_essentialBytes, 0.008 * m_essentialBytes / time);
840 std::cout << std::setw(43) <<
"Input ChromaFormatIDC = ";
841 switch (m_InputChromaFormatIDC)
843 case CHROMA_400: std::cout <<
" 4:0:0";
break;
844 case CHROMA_420: std::cout <<
" 4:2:0";
break;
845 case CHROMA_422: std::cout <<
" 4:2:2";
break;
846 case CHROMA_444: std::cout <<
" 4:4:4";
break;
848 std::cerr <<
"Invalid";
851 std::cout << std::endl;
853 std::cout << std::setw(43) <<
"Output (internal) ChromaFormatIDC = ";
854 switch (m_cTEncTop.getChromaFormatIdc())
856 case CHROMA_400: std::cout <<
" 4:0:0";
break;
857 case CHROMA_420: std::cout <<
" 4:2:0";
break;
858 case CHROMA_422: std::cout <<
" 4:2:2";
break;
859 case CHROMA_444: std::cout <<
" 4:4:4";
break;
861 std::cerr <<
"Invalid";
864 std::cout <<
"\n" << std::endl;
Void rateStatsAccum(const AccessUnit &au, const std::vector< UInt > &stats)
Encoder application class (header)
don't use slices / slice segments
Void xDeleteBuffer()
delete allocated buffers
Void xInitLib(Bool isFieldCoding)
initialize encoder class
Void setNumReorderPics(UInt v, UInt tLayer)
Void setMaxLayers(UInt l)
Void xWriteOutput(std::ostream &bitstreamFile, Int iNumEncoded, const std::list< AccessUnit > &accessUnits)
write bitstream to file
Void setMaxDecPicBuffering(UInt v, UInt tLayer)
Void xCreateLib()
create files & encoder class
Void setMaxTLayers(UInt t)
Void xInitLibCfg()
initialize internal variables
Void xGetBuffer(TComPicYuv *&rpcPicYuvRec)
obtain required buffers
static const Int MAX_TLAYER
Explicit temporal layer QP offset - max number of temporal layer.
InputColourSpaceConversion
Void encode()
main encoding function
Void xDestroyLib()
destroy encoder class
Void create(const Int picWidth, const Int picHeight, const ChromaFormat chromaFormatIDC, const UInt maxCUWidth, const UInt maxCUHeight, const UInt maxCUDepth, const Bool bUseMargin)
if true, then a margin of uiMaxCUWidth+16 and uiMaxCUHeight+16 is created around the image...
Void setTemporalNestingFlag(Bool t)
static std::vector< UInt > writeAnnexB(std::ostream &out, const AccessUnit &au)