Changeset 1313 in 3DVCSoftware for trunk/source/App/TAppEncoder/TAppEncTop.cpp
- Timestamp:
- 13 Aug 2015, 17:38:13 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/App/TAppEncoder/TAppEncTop.cpp
r1196 r1313 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-2015, ITU/ISO/IEC6 * Copyright (c) 2010-2015, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 42 42 #include <fcntl.h> 43 43 #include <assert.h> 44 #include <iomanip> 44 45 45 46 #include "TAppEncTop.h" … … 58 59 { 59 60 60 #if H_MV61 #if NH_MV 61 62 m_vps = new TComVPS; 62 63 #else … … 69 70 TAppEncTop::~TAppEncTop() 70 71 { 71 #if H_MV72 #if NH_MV 72 73 if (m_vps) 73 74 { … … 80 81 Void TAppEncTop::xInitLibCfg() 81 82 { 82 #if H_MV83 #if NH_MV 83 84 TComVPS& vps = (*m_vps); 84 85 #else … … 86 87 #endif 87 88 88 #if H_3D 89 vps.createCamPars(m_iNumberOfViews); 90 TComDLT& dlt = m_dlt; 91 #endif 92 93 #if H_MV 89 #if NH_3D 90 vps.createCamPars(m_iNumberOfViews); 91 #endif 92 93 #if NH_3D_DLT 94 TComDLT dlt = TComDLT(); 95 #endif 96 97 #if NH_MV 94 98 Int maxTempLayer = -1; 95 99 for (Int j = 0; j < m_numberOfLayers; j++) … … 118 122 } 119 123 #else 120 vps.setMaxTLayers ( m_maxTempLayer );124 vps.setMaxTLayers ( m_maxTempLayer ); 121 125 if (m_maxTempLayer == 1) 122 126 { 123 127 vps.setTemporalNestingFlag(true); 124 128 } 125 vps.setMaxLayers ( 1 );129 vps.setMaxLayers ( 1 ); 126 130 for(Int i = 0; i < MAX_TLAYER; i++) 127 131 { 128 vps.setNumReorderPics ( m_numReorderPics[i], i ); 129 vps.setMaxDecPicBuffering ( m_maxDecPicBuffering[i], i ); 130 } 131 #endif 132 #if H_MV 132 vps.setNumReorderPics ( m_numReorderPics[i], i ); 133 vps.setMaxDecPicBuffering ( m_maxDecPicBuffering[i], i ); 134 } 135 #endif 136 #if NH_MV 137 xSetTimingInfo ( vps ); 138 xSetHrdParameters ( vps ); 133 139 xSetLayerIds ( vps ); 134 140 xSetDimensionIdAndLength ( vps ); … … 139 145 xSetDpbSize ( vps ); 140 146 xSetVPSVUI ( vps ); 141 #if H_3D147 #if NH_3D 142 148 xSetCamPara ( vps ); 143 149 m_ivPicLists.setVPS ( &vps ); 144 xDeriveDltArray ( vps, dlt ); 150 #endif 151 #if NH_3D_DLT 152 xDeriveDltArray ( vps, &dlt ); 145 153 #endif 146 154 if ( m_targetEncLayerIdList.size() == 0 ) … … 174 182 } 175 183 176 #if H_3D184 #if NH_3D 177 185 // Set 3d tool parameters 178 179 186 for (Int d = 0; d < 2; d++) 180 187 { … … 201 208 } 202 209 #endif 210 211 212 /// Create encoders and set profiles profiles 203 213 for(Int layerIdInVps = 0; layerIdInVps < m_numberOfLayers; layerIdInVps++) 204 214 { … … 207 217 m_acTVideoIOYuvInputFileList.push_back(new TVideoIOYuv); 208 218 m_acTVideoIOYuvReconFileList.push_back(new TVideoIOYuv); 209 m_picYuvRec .push_back(new TComList<TComPicYuv*>) ; 219 #if NH_3D 220 Int profileIdc = -1; 221 for (Int olsIdx = 0; olsIdx < vps.getNumOutputLayerSets(); olsIdx++ ) 222 { 223 Int lsIdx = vps.olsIdxToLsIdx( olsIdx ); 224 for(Int i = 0; i < vps.getNumLayersInIdList( lsIdx ); i++ ) 225 { 226 if( vps.getLayerIdInNuh( layerIdInVps) == vps.getLayerSetLayerIdList(lsIdx, i) ) 227 { 228 Int ptlIdx = vps.getProfileTierLevelIdx( olsIdx, i ); 229 if ( ptlIdx != -1 ) 230 { 231 Int curProfileIdc = vps.getPTL(ptlIdx)->getGeneralPTL()->getProfileIdc(); 232 if (profileIdc == -1) 233 { 234 profileIdc = curProfileIdc; 235 } 236 else 237 { 238 if ( profileIdc != curProfileIdc ) 239 { 240 fprintf(stderr, "Error: ProfileIdc for layer with index %d in VPS not equal in all OLSs. \n", layerIdInVps ); 241 exit(EXIT_FAILURE); 242 } 243 } 244 } 245 } 246 } 247 } 248 249 if (profileIdc == -1 ) 250 { 251 fprintf(stderr, "Error: No profile given for layer with index %d in VPS not equal in all OLS. \n", layerIdInVps ); 252 exit(EXIT_FAILURE); 253 } 254 m_acTEncTopList[ layerIdInVps ]->setProfileIdc( profileIdc ); 255 #endif 256 } 257 258 259 for(Int layerIdInVps = 0; layerIdInVps < m_numberOfLayers; layerIdInVps++) 260 { 261 m_cListPicYuvRec .push_back(new TComList<TComPicYuv*>) ; 210 262 m_ivPicLists.push_back( m_acTEncTopList[ layerIdInVps ]->getListPic() ); 211 263 TEncTop& m_cTEncTop = *m_acTEncTopList[ layerIdInVps ]; // It is not a member, but this name helps avoiding code duplication !!! … … 216 268 m_cTEncTop.setViewId ( vps.getViewId ( layerId ) ); 217 269 m_cTEncTop.setViewIndex ( vps.getViewIndex ( layerId ) ); 218 #if H_3D270 #if NH_3D 219 271 Bool isDepth = ( vps.getDepthId ( layerId ) != 0 ) ; 220 272 m_cTEncTop.setIsDepth ( isDepth ); 221 273 //====== Camera Parameters ========= 222 274 m_cTEncTop.setCameraParameters ( &m_cCameraData ); 223 #if H_3D_VSO275 #if NH_3D_VSO 224 276 //====== VSO ========= 225 277 m_cTEncTop.setRenderModelParameters ( &m_cRenModStrParser ); … … 239 291 m_cTEncTop.setDWeight ( isDepth ? m_iDWeight : 0 ); 240 292 #endif // H_3D_VSO 241 #if H_3D_IC293 #if NH_3D_IC 242 294 m_cTEncTop.setUseIC ( vps.getViewIndex( layerId ) == 0 || isDepth ? false : m_abUseIC ); 243 295 m_cTEncTop.setUseICLowLatencyEnc ( m_bUseLowLatencyICEnc ); … … 249 301 m_cTEncTop.setUseDLT ( isDepth ? m_useDLT : false ); 250 302 m_cTEncTop.setUseQTL ( isDepth ? m_bUseQTL : false ); 251 252 253 m_cTEncTop.setSps3dExtension ( m_sps3dExtension ); 254 #endif // H_3D 303 m_cTEncTop.setSps3dExtension ( m_sps3dExtension ); 304 #endif // NH_3D 255 305 256 306 m_cTEncTop.setIvPicLists ( &m_ivPicLists ); 257 #endif // H_MV307 #endif // NH_MV 258 308 m_cTEncTop.setVPS(&vps); 259 309 260 #if H_3D 261 m_cTEncTop.setDLT(&dlt); 262 #endif 263 264 #if H_MV 265 m_cTEncTop.setProfile(m_profile[0]); 266 m_cTEncTop.setLevel (m_levelTier[0], m_level[0]); 267 #else 268 m_cTEncTop.setProfile(m_profile); 269 m_cTEncTop.setLevel(m_levelTier, m_level); 270 #endif 271 m_cTEncTop.setProgressiveSourceFlag(m_progressiveSourceFlag); 272 m_cTEncTop.setInterlacedSourceFlag(m_interlacedSourceFlag); 273 m_cTEncTop.setNonPackedConstraintFlag(m_nonPackedConstraintFlag); 274 m_cTEncTop.setFrameOnlyConstraintFlag(m_frameOnlyConstraintFlag); 275 276 m_cTEncTop.setFrameRate ( m_iFrameRate ); 277 m_cTEncTop.setFrameSkip ( m_FrameSkip ); 278 m_cTEncTop.setSourceWidth ( m_iSourceWidth ); 279 m_cTEncTop.setSourceHeight ( m_iSourceHeight ); 280 m_cTEncTop.setConformanceWindow ( m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom ); 281 m_cTEncTop.setFramesToBeEncoded ( m_framesToBeEncoded ); 282 310 #if NH_3D_DLT 311 m_cTEncTop.setDLT(dlt); 312 #endif 313 314 #if NH_MV 315 m_cTEncTop.setProfile ( m_profiles[0]); 316 m_cTEncTop.setLevel ( m_levelTier[0], m_level[0] ); 317 #else 318 m_cTEncTop.setProfile ( m_profile); 319 m_cTEncTop.setLevel ( m_levelTier, m_level); 320 #endif 321 m_cTEncTop.setProgressiveSourceFlag ( m_progressiveSourceFlag); 322 m_cTEncTop.setInterlacedSourceFlag ( m_interlacedSourceFlag); 323 m_cTEncTop.setNonPackedConstraintFlag ( m_nonPackedConstraintFlag); 324 m_cTEncTop.setFrameOnlyConstraintFlag ( m_frameOnlyConstraintFlag); 325 m_cTEncTop.setBitDepthConstraintValue ( m_bitDepthConstraint ); 326 m_cTEncTop.setChromaFormatConstraintValue ( m_chromaFormatConstraint ); 327 m_cTEncTop.setIntraConstraintFlag ( m_intraConstraintFlag ); 328 m_cTEncTop.setOnePictureOnlyConstraintFlag ( m_onePictureOnlyConstraintFlag ); 329 m_cTEncTop.setLowerBitRateConstraintFlag ( m_lowerBitRateConstraintFlag ); 330 331 m_cTEncTop.setPrintMSEBasedSequencePSNR ( m_printMSEBasedSequencePSNR); 332 m_cTEncTop.setPrintFrameMSE ( m_printFrameMSE); 333 m_cTEncTop.setPrintSequenceMSE ( m_printSequenceMSE); 334 m_cTEncTop.setCabacZeroWordPaddingEnabled ( m_cabacZeroWordPaddingEnabled ); 335 336 m_cTEncTop.setFrameRate ( m_iFrameRate ); 337 m_cTEncTop.setFrameSkip ( m_FrameSkip ); 338 m_cTEncTop.setSourceWidth ( m_iSourceWidth ); 339 m_cTEncTop.setSourceHeight ( m_iSourceHeight ); 340 m_cTEncTop.setConformanceWindow ( m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom ); 341 m_cTEncTop.setFramesToBeEncoded ( m_framesToBeEncoded ); 342 283 343 //====== Coding Structure ======== 284 #if H_MV285 m_cTEncTop.setIntraPeriod ( m_iIntraPeriod[ layerIdInVps ] );286 #else 287 m_cTEncTop.setIntraPeriod ( m_iIntraPeriod );288 #endif 289 m_cTEncTop.setDecodingRefreshType ( m_iDecodingRefreshType );290 m_cTEncTop.setGOPSize ( m_iGOPSize );291 #if H_MV292 m_cTEncTop.setGopList( m_GOPListMvc[layerIdInVps] );293 m_cTEncTop.setExtraRPSs ( m_extraRPSsMvc[layerIdInVps] );344 #if NH_MV 345 m_cTEncTop.setIntraPeriod ( m_iIntraPeriod[ layerIdInVps ] ); 346 #else 347 m_cTEncTop.setIntraPeriod ( m_iIntraPeriod ); 348 #endif 349 m_cTEncTop.setDecodingRefreshType ( m_iDecodingRefreshType ); 350 m_cTEncTop.setGOPSize ( m_iGOPSize ); 351 #if NH_MV 352 m_cTEncTop.setGopList ( m_GOPListMvc[layerIdInVps] ); 353 m_cTEncTop.setExtraRPSs ( m_extraRPSsMvc[layerIdInVps] ); 294 354 for(Int i = 0; i < MAX_TLAYER; i++) 295 355 { 296 m_cTEncTop.setNumReorderPics ( m_numReorderPicsMvc[layerIdInVps][i], i );297 m_cTEncTop.setMaxDecPicBuffering ( m_maxDecPicBufferingMvc[layerIdInVps][i], i );298 } 299 #else 300 m_cTEncTop.setGopList ( m_GOPList );301 m_cTEncTop.setExtraRPSs ( m_extraRPSs );356 m_cTEncTop.setNumReorderPics ( m_numReorderPicsMvc[layerIdInVps][i], i ); 357 m_cTEncTop.setMaxDecPicBuffering ( m_maxDecPicBufferingMvc[layerIdInVps][i], i ); 358 } 359 #else 360 m_cTEncTop.setGopList ( m_GOPList ); 361 m_cTEncTop.setExtraRPSs ( m_extraRPSs ); 302 362 for(Int i = 0; i < MAX_TLAYER; i++) 303 363 { 304 m_cTEncTop.setNumReorderPics ( m_numReorderPics[i], i );305 m_cTEncTop.setMaxDecPicBuffering ( m_maxDecPicBuffering[i], i );364 m_cTEncTop.setNumReorderPics ( m_numReorderPics[i], i ); 365 m_cTEncTop.setMaxDecPicBuffering ( m_maxDecPicBuffering[i], i ); 306 366 } 307 367 #endif 308 368 for( UInt uiLoop = 0; uiLoop < MAX_TLAYER; ++uiLoop ) 309 369 { 310 m_cTEncTop.setLambdaModifier ( uiLoop, m_adLambdaModifier[ uiLoop ] );311 } 312 #if H_MV313 m_cTEncTop.setQP ( m_iQP[layerIdInVps] );314 #else 315 m_cTEncTop.setQP ( m_iQP );316 #endif 317 318 m_cTEncTop.setPad ( m_aiPad );319 320 #if H_MV321 m_cTEncTop.setMaxTempLayer ( m_maxTempLayerMvc[layerIdInVps] );322 #else 323 m_cTEncTop.setMaxTempLayer ( m_maxTempLayer );370 m_cTEncTop.setLambdaModifier ( uiLoop, m_adLambdaModifier[ uiLoop ] ); 371 } 372 #if NH_MV 373 m_cTEncTop.setQP ( m_iQP[layerIdInVps] ); 374 #else 375 m_cTEncTop.setQP ( m_iQP ); 376 #endif 377 378 m_cTEncTop.setPad ( m_aiPad ); 379 380 #if NH_MV 381 m_cTEncTop.setMaxTempLayer ( m_maxTempLayerMvc[layerIdInVps] ); 382 #else 383 m_cTEncTop.setMaxTempLayer ( m_maxTempLayer ); 324 384 #endif 325 385 m_cTEncTop.setUseAMP( m_enableAMP ); 326 386 327 387 //===== Slice ======== 328 388 329 389 //====== Loop/Deblock Filter ======== 330 #if H_MV 331 m_cTEncTop.setLoopFilterDisable ( m_bLoopFilterDisable[layerIdInVps]); 332 #else 333 m_cTEncTop.setLoopFilterDisable ( m_bLoopFilterDisable ); 334 #endif 335 m_cTEncTop.setLoopFilterOffsetInPPS ( m_loopFilterOffsetInPPS ); 336 m_cTEncTop.setLoopFilterBetaOffset ( m_loopFilterBetaOffsetDiv2 ); 337 m_cTEncTop.setLoopFilterTcOffset ( m_loopFilterTcOffsetDiv2 ); 338 m_cTEncTop.setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent); 339 m_cTEncTop.setDeblockingFilterMetric ( m_DeblockingFilterMetric ); 390 #if NH_MV 391 m_cTEncTop.setLoopFilterDisable ( m_bLoopFilterDisable[layerIdInVps]); 392 #else 393 m_cTEncTop.setLoopFilterDisable ( m_bLoopFilterDisable ); 394 #endif 395 m_cTEncTop.setLoopFilterOffsetInPPS ( m_loopFilterOffsetInPPS ); 396 m_cTEncTop.setLoopFilterBetaOffset ( m_loopFilterBetaOffsetDiv2 ); 397 m_cTEncTop.setLoopFilterTcOffset ( m_loopFilterTcOffsetDiv2 ); 398 m_cTEncTop.setDeblockingFilterMetric ( m_DeblockingFilterMetric ); 340 399 341 400 //====== Motion search ======== 342 m_cTEncTop.setFastSearch ( m_iFastSearch ); 343 m_cTEncTop.setSearchRange ( m_iSearchRange ); 344 m_cTEncTop.setBipredSearchRange ( m_bipredSearchRange ); 345 346 #if H_MV 347 m_cTEncTop.setUseDisparitySearchRangeRestriction ( m_bUseDisparitySearchRangeRestriction ); 348 m_cTEncTop.setVerticalDisparitySearchRange ( m_iVerticalDisparitySearchRange ); 401 m_cTEncTop.setDisableIntraPUsInInterSlices ( m_bDisableIntraPUsInInterSlices ); 402 m_cTEncTop.setFastSearch ( m_iFastSearch ); 403 m_cTEncTop.setSearchRange ( m_iSearchRange ); 404 m_cTEncTop.setBipredSearchRange ( m_bipredSearchRange ); 405 m_cTEncTop.setClipForBiPredMeEnabled ( m_bClipForBiPredMeEnabled ); 406 m_cTEncTop.setFastMEAssumingSmootherMVEnabled ( m_bFastMEAssumingSmootherMVEnabled ); 407 408 #if NH_MV 409 m_cTEncTop.setUseDisparitySearchRangeRestriction ( m_bUseDisparitySearchRangeRestriction ); 410 m_cTEncTop.setVerticalDisparitySearchRange ( m_iVerticalDisparitySearchRange ); 349 411 #endif 350 412 //====== Quality control ======== 351 m_cTEncTop.setMaxDeltaQP ( m_iMaxDeltaQP ); 352 m_cTEncTop.setMaxCuDQPDepth ( m_iMaxCuDQPDepth ); 353 354 m_cTEncTop.setChromaCbQpOffset ( m_cbQpOffset ); 355 m_cTEncTop.setChromaCrQpOffset ( m_crQpOffset ); 413 m_cTEncTop.setMaxDeltaQP ( m_iMaxDeltaQP ); 414 m_cTEncTop.setMaxCuDQPDepth ( m_iMaxCuDQPDepth ); 415 m_cTEncTop.setDiffCuChromaQpOffsetDepth ( m_diffCuChromaQpOffsetDepth ); 416 m_cTEncTop.setChromaCbQpOffset ( m_cbQpOffset ); 417 m_cTEncTop.setChromaCrQpOffset ( m_crQpOffset ); 418 419 #if NH_3D 420 m_cTEncTop.setChromaFormatIdc ( isDepth ? CHROMA_400 : m_chromaFormatIDC ); 421 #else 422 m_cTEncTop.setChromaFormatIdc ( m_chromaFormatIDC ); 423 #endif 356 424 357 425 #if ADAPTIVE_QP_SELECTION 358 m_cTEncTop.setUseAdaptQpSelect ( m_bUseAdaptQpSelect ); 359 #endif 360 361 m_cTEncTop.setUseAdaptiveQP ( m_bUseAdaptiveQP ); 362 m_cTEncTop.setQPAdaptationRange ( m_iQPAdaptationRange ); 363 426 m_cTEncTop.setUseAdaptQpSelect ( m_bUseAdaptQpSelect ); 427 #endif 428 429 m_cTEncTop.setUseAdaptiveQP ( m_bUseAdaptiveQP ); 430 m_cTEncTop.setQPAdaptationRange ( m_iQPAdaptationRange ); 431 m_cTEncTop.setExtendedPrecisionProcessingFlag ( m_extendedPrecisionProcessingFlag ); 432 m_cTEncTop.setHighPrecisionOffsetsEnabledFlag ( m_highPrecisionOffsetsEnabledFlag ); 364 433 //====== Tool list ======== 365 m_cTEncTop.setDeltaQpRD ( m_uiDeltaQpRD ); 366 m_cTEncTop.setUseASR ( m_bUseASR ); 367 m_cTEncTop.setUseHADME ( m_bUseHADME ); 368 #if H_MV 369 m_cTEncTop.setdQPs ( m_aidQP[layerIdInVps] ); 370 #else 371 m_cTEncTop.setdQPs ( m_aidQP ); 372 #endif 373 m_cTEncTop.setUseRDOQ ( m_useRDOQ ); 374 m_cTEncTop.setUseRDOQTS ( m_useRDOQTS ); 375 m_cTEncTop.setRDpenalty ( m_rdPenalty ); 376 m_cTEncTop.setQuadtreeTULog2MaxSize ( m_uiQuadtreeTULog2MaxSize ); 377 m_cTEncTop.setQuadtreeTULog2MinSize ( m_uiQuadtreeTULog2MinSize ); 378 m_cTEncTop.setQuadtreeTUMaxDepthInter ( m_uiQuadtreeTUMaxDepthInter ); 379 m_cTEncTop.setQuadtreeTUMaxDepthIntra ( m_uiQuadtreeTUMaxDepthIntra ); 380 m_cTEncTop.setUseFastEnc ( m_bUseFastEnc ); 381 m_cTEncTop.setUseEarlyCU ( m_bUseEarlyCU ); 382 m_cTEncTop.setUseFastDecisionForMerge ( m_useFastDecisionForMerge ); 383 m_cTEncTop.setUseCbfFastMode ( m_bUseCbfFastMode ); 384 m_cTEncTop.setUseEarlySkipDetection ( m_useEarlySkipDetection ); 385 386 m_cTEncTop.setUseTransformSkip ( m_useTransformSkip ); 387 m_cTEncTop.setUseTransformSkipFast ( m_useTransformSkipFast ); 388 m_cTEncTop.setUseConstrainedIntraPred ( m_bUseConstrainedIntraPred ); 389 m_cTEncTop.setPCMLog2MinSize ( m_uiPCMLog2MinSize); 390 m_cTEncTop.setUsePCM ( m_usePCM ); 391 m_cTEncTop.setPCMLog2MaxSize ( m_pcmLog2MaxSize); 392 m_cTEncTop.setMaxNumMergeCand ( m_maxNumMergeCand ); 393 434 m_cTEncTop.setDeltaQpRD ( m_uiDeltaQpRD ); 435 m_cTEncTop.setFastDeltaQp ( m_bFastDeltaQP ); 436 m_cTEncTop.setUseASR ( m_bUseASR ); 437 m_cTEncTop.setUseHADME ( m_bUseHADME ); 438 #if NH_MV 439 m_cTEncTop.setdQPs ( m_aidQP[layerIdInVps] ); 440 #else 441 m_cTEncTop.setdQPs ( m_aidQP ); 442 #endif 443 m_cTEncTop.setUseRDOQ ( m_useRDOQ ); 444 m_cTEncTop.setUseRDOQTS ( m_useRDOQTS ); 445 #if T0196_SELECTIVE_RDOQ 446 m_cTEncTop.setUseSelectiveRDOQ ( m_useSelectiveRDOQ ); 447 #endif 448 m_cTEncTop.setRDpenalty ( m_rdPenalty ); 449 m_cTEncTop.setMaxCUWidth ( m_uiMaxCUWidth ); 450 m_cTEncTop.setMaxCUHeight ( m_uiMaxCUHeight ); 451 m_cTEncTop.setMaxTotalCUDepth ( m_uiMaxTotalCUDepth ); 452 m_cTEncTop.setLog2DiffMaxMinCodingBlockSize ( m_uiLog2DiffMaxMinCodingBlockSize ); 453 m_cTEncTop.setQuadtreeTULog2MaxSize ( m_uiQuadtreeTULog2MaxSize ); 454 m_cTEncTop.setQuadtreeTULog2MinSize ( m_uiQuadtreeTULog2MinSize ); 455 m_cTEncTop.setQuadtreeTUMaxDepthInter ( m_uiQuadtreeTUMaxDepthInter ); 456 m_cTEncTop.setQuadtreeTUMaxDepthIntra ( m_uiQuadtreeTUMaxDepthIntra ); 457 m_cTEncTop.setUseFastEnc ( m_bUseFastEnc ); 458 m_cTEncTop.setUseEarlyCU ( m_bUseEarlyCU ); 459 m_cTEncTop.setUseFastDecisionForMerge ( m_useFastDecisionForMerge ); 460 m_cTEncTop.setUseCbfFastMode ( m_bUseCbfFastMode ); 461 m_cTEncTop.setUseEarlySkipDetection ( m_useEarlySkipDetection ); 462 m_cTEncTop.setCrossComponentPredictionEnabledFlag ( m_crossComponentPredictionEnabledFlag ); 463 m_cTEncTop.setUseReconBasedCrossCPredictionEstimate ( m_reconBasedCrossCPredictionEstimate ); 464 #if NH_MV 465 m_cTEncTop.setLog2SaoOffsetScale ( CHANNEL_TYPE_LUMA , m_log2SaoOffsetScale[layerIdInVps][CHANNEL_TYPE_LUMA] ); 466 m_cTEncTop.setLog2SaoOffsetScale ( CHANNEL_TYPE_CHROMA, m_log2SaoOffsetScale[layerIdInVps][CHANNEL_TYPE_CHROMA] ); 467 #else 468 m_cTEncTop.setLog2SaoOffsetScale ( CHANNEL_TYPE_LUMA , m_log2SaoOffsetScale[CHANNEL_TYPE_LUMA] ); 469 m_cTEncTop.setLog2SaoOffsetScale ( CHANNEL_TYPE_CHROMA, m_log2SaoOffsetScale[CHANNEL_TYPE_CHROMA] ); 470 #endif 471 m_cTEncTop.setUseTransformSkip ( m_useTransformSkip ); 472 m_cTEncTop.setUseTransformSkipFast ( m_useTransformSkipFast ); 473 m_cTEncTop.setTransformSkipRotationEnabledFlag ( m_transformSkipRotationEnabledFlag ); 474 m_cTEncTop.setTransformSkipContextEnabledFlag ( m_transformSkipContextEnabledFlag ); 475 m_cTEncTop.setPersistentRiceAdaptationEnabledFlag ( m_persistentRiceAdaptationEnabledFlag ); 476 m_cTEncTop.setCabacBypassAlignmentEnabledFlag ( m_cabacBypassAlignmentEnabledFlag ); 477 m_cTEncTop.setLog2MaxTransformSkipBlockSize ( m_log2MaxTransformSkipBlockSize ); 478 for (UInt signallingModeIndex = 0; signallingModeIndex < NUMBER_OF_RDPCM_SIGNALLING_MODES; signallingModeIndex++) 479 { 480 m_cTEncTop.setRdpcmEnabledFlag ( RDPCMSignallingMode(signallingModeIndex), m_rdpcmEnabledFlag[signallingModeIndex]); 481 } 482 m_cTEncTop.setUseConstrainedIntraPred ( m_bUseConstrainedIntraPred ); 483 m_cTEncTop.setFastUDIUseMPMEnabled ( m_bFastUDIUseMPMEnabled ); 484 m_cTEncTop.setFastMEForGenBLowDelayEnabled ( m_bFastMEForGenBLowDelayEnabled ); 485 m_cTEncTop.setUseBLambdaForNonKeyLowDelayPictures ( m_bUseBLambdaForNonKeyLowDelayPictures ); 486 m_cTEncTop.setPCMLog2MinSize ( m_uiPCMLog2MinSize); 487 m_cTEncTop.setUsePCM ( m_usePCM ); 488 489 // set internal bit-depth and constants 490 for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++) 491 { 492 m_cTEncTop.setBitDepth((ChannelType)channelType, m_internalBitDepth[channelType]); 493 m_cTEncTop.setPCMBitDepth((ChannelType)channelType, m_bPCMInputBitDepthFlag ? m_MSBExtendedBitDepth[channelType] : m_internalBitDepth[channelType]); 494 } 495 496 m_cTEncTop.setPCMLog2MaxSize ( m_pcmLog2MaxSize); 497 m_cTEncTop.setMaxNumMergeCand ( m_maxNumMergeCand ); 498 394 499 395 500 //====== Weighted Prediction ======== 396 m_cTEncTop.setUseWP ( m_useWeightedPred );397 m_cTEncTop.setWPBiPred ( m_useWeightedBiPred );501 m_cTEncTop.setUseWP ( m_useWeightedPred ); 502 m_cTEncTop.setWPBiPred ( m_useWeightedBiPred ); 398 503 //====== Parallel Merge Estimation ======== 399 m_cTEncTop.setLog2ParallelMergeLevelMinus2 ( m_log2ParallelMergeLevel - 2 );504 m_cTEncTop.setLog2ParallelMergeLevelMinus2 ( m_log2ParallelMergeLevel - 2 ); 400 505 401 506 //====== Slice ======== 402 m_cTEncTop.setSliceMode ( m_sliceMode);403 m_cTEncTop.setSliceArgument ( m_sliceArgument );507 m_cTEncTop.setSliceMode ( (SliceConstraint) m_sliceMode ); 508 m_cTEncTop.setSliceArgument ( m_sliceArgument ); 404 509 405 510 //====== Dependent Slice ======== 406 m_cTEncTop.setSliceSegmentMode ( m_sliceSegmentMode ); 407 m_cTEncTop.setSliceSegmentArgument ( m_sliceSegmentArgument ); 408 Int iNumPartInCU = 1<<(m_uiMaxCUDepth<<1); 409 if(m_sliceSegmentMode==FIXED_NUMBER_OF_LCU) 410 { 411 m_cTEncTop.setSliceSegmentArgument ( m_sliceSegmentArgument * iNumPartInCU ); 412 } 413 if(m_sliceMode==FIXED_NUMBER_OF_LCU) 414 { 415 m_cTEncTop.setSliceArgument ( m_sliceArgument * iNumPartInCU ); 416 } 417 if(m_sliceMode==FIXED_NUMBER_OF_TILES) 418 { 419 m_cTEncTop.setSliceArgument ( m_sliceArgument ); 420 } 421 422 if(m_sliceMode == 0 ) 511 m_cTEncTop.setSliceSegmentMode ( (SliceConstraint) m_sliceSegmentMode ); 512 m_cTEncTop.setSliceSegmentArgument ( m_sliceSegmentArgument ); 513 514 if(m_sliceMode == NO_SLICES ) 423 515 { 424 516 m_bLFCrossSliceBoundaryFlag = true; 425 517 } 426 m_cTEncTop.setLFCrossSliceBoundaryFlag ( m_bLFCrossSliceBoundaryFlag );427 #if H_MV518 m_cTEncTop.setLFCrossSliceBoundaryFlag ( m_bLFCrossSliceBoundaryFlag ); 519 #if NH_MV 428 520 m_cTEncTop.setUseSAO ( m_bUseSAO[layerIdInVps] ); 429 521 #else 430 m_cTEncTop.setUseSAO ( m_bUseSAO ); 431 #endif 432 m_cTEncTop.setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic); 433 434 m_cTEncTop.setSaoLcuBoundary (m_saoLcuBoundary); 435 m_cTEncTop.setPCMInputBitDepthFlag ( m_bPCMInputBitDepthFlag); 436 m_cTEncTop.setPCMFilterDisableFlag ( m_bPCMFilterDisableFlag); 437 438 m_cTEncTop.setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled); 439 m_cTEncTop.setRecoveryPointSEIEnabled( m_recoveryPointSEIEnabled ); 440 m_cTEncTop.setBufferingPeriodSEIEnabled( m_bufferingPeriodSEIEnabled ); 441 m_cTEncTop.setPictureTimingSEIEnabled( m_pictureTimingSEIEnabled ); 442 m_cTEncTop.setToneMappingInfoSEIEnabled ( m_toneMappingInfoSEIEnabled ); 443 m_cTEncTop.setTMISEIToneMapId ( m_toneMapId ); 444 m_cTEncTop.setTMISEIToneMapCancelFlag ( m_toneMapCancelFlag ); 445 m_cTEncTop.setTMISEIToneMapPersistenceFlag ( m_toneMapPersistenceFlag ); 446 m_cTEncTop.setTMISEICodedDataBitDepth ( m_toneMapCodedDataBitDepth ); 447 m_cTEncTop.setTMISEITargetBitDepth ( m_toneMapTargetBitDepth ); 448 m_cTEncTop.setTMISEIModelID ( m_toneMapModelId ); 449 m_cTEncTop.setTMISEIMinValue ( m_toneMapMinValue ); 450 m_cTEncTop.setTMISEIMaxValue ( m_toneMapMaxValue ); 451 m_cTEncTop.setTMISEISigmoidMidpoint ( m_sigmoidMidpoint ); 452 m_cTEncTop.setTMISEISigmoidWidth ( m_sigmoidWidth ); 453 m_cTEncTop.setTMISEIStartOfCodedInterva ( m_startOfCodedInterval ); 454 m_cTEncTop.setTMISEINumPivots ( m_numPivots ); 455 m_cTEncTop.setTMISEICodedPivotValue ( m_codedPivotValue ); 456 m_cTEncTop.setTMISEITargetPivotValue ( m_targetPivotValue ); 457 m_cTEncTop.setTMISEICameraIsoSpeedIdc ( m_cameraIsoSpeedIdc ); 458 m_cTEncTop.setTMISEICameraIsoSpeedValue ( m_cameraIsoSpeedValue ); 459 m_cTEncTop.setTMISEIExposureIndexIdc ( m_exposureIndexIdc ); 460 m_cTEncTop.setTMISEIExposureIndexValue ( m_exposureIndexValue ); 461 m_cTEncTop.setTMISEIExposureCompensationValueSignFlag ( m_exposureCompensationValueSignFlag ); 462 m_cTEncTop.setTMISEIExposureCompensationValueNumerator ( m_exposureCompensationValueNumerator ); 463 m_cTEncTop.setTMISEIExposureCompensationValueDenomIdc ( m_exposureCompensationValueDenomIdc ); 464 m_cTEncTop.setTMISEIRefScreenLuminanceWhite ( m_refScreenLuminanceWhite ); 465 m_cTEncTop.setTMISEIExtendedRangeWhiteLevel ( m_extendedRangeWhiteLevel ); 466 m_cTEncTop.setTMISEINominalBlackLevelLumaCodeValue ( m_nominalBlackLevelLumaCodeValue ); 467 m_cTEncTop.setTMISEINominalWhiteLevelLumaCodeValue ( m_nominalWhiteLevelLumaCodeValue ); 468 m_cTEncTop.setTMISEIExtendedWhiteLevelLumaCodeValue ( m_extendedWhiteLevelLumaCodeValue ); 469 m_cTEncTop.setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled ); 470 m_cTEncTop.setFramePackingArrangementSEIType( m_framePackingSEIType ); 471 m_cTEncTop.setFramePackingArrangementSEIId( m_framePackingSEIId ); 472 m_cTEncTop.setFramePackingArrangementSEIQuincunx( m_framePackingSEIQuincunx ); 473 m_cTEncTop.setFramePackingArrangementSEIInterpretation( m_framePackingSEIInterpretation ); 474 m_cTEncTop.setDisplayOrientationSEIAngle( m_displayOrientationSEIAngle ); 475 m_cTEncTop.setTemporalLevel0IndexSEIEnabled( m_temporalLevel0IndexSEIEnabled ); 476 m_cTEncTop.setGradualDecodingRefreshInfoEnabled( m_gradualDecodingRefreshInfoEnabled ); 477 m_cTEncTop.setDecodingUnitInfoSEIEnabled( m_decodingUnitInfoSEIEnabled ); 478 m_cTEncTop.setSOPDescriptionSEIEnabled( m_SOPDescriptionSEIEnabled ); 479 m_cTEncTop.setScalableNestingSEIEnabled( m_scalableNestingSEIEnabled ); 480 #if H_MV 481 m_cTEncTop.setSubBitstreamPropSEIEnabled( m_subBistreamPropSEIEnabled ); 482 if( m_subBistreamPropSEIEnabled ) 483 { 484 m_cTEncTop.setNumAdditionalSubStreams ( m_sbPropNumAdditionalSubStreams ); 485 m_cTEncTop.setSubBitstreamMode ( m_sbPropSubBitstreamMode ); 486 m_cTEncTop.setOutputLayerSetIdxToVps ( m_sbPropOutputLayerSetIdxToVps ); 487 m_cTEncTop.setHighestSublayerId ( m_sbPropHighestSublayerId ); 488 m_cTEncTop.setAvgBitRate ( m_sbPropAvgBitRate ); 489 m_cTEncTop.setMaxBitRate ( m_sbPropMaxBitRate ); 490 } 491 #endif 492 m_cTEncTop.setTileUniformSpacingFlag ( m_tileUniformSpacingFlag ); 493 m_cTEncTop.setNumColumnsMinus1 ( m_numTileColumnsMinus1 ); 494 m_cTEncTop.setNumRowsMinus1 ( m_numTileRowsMinus1 ); 522 m_cTEncTop.setUseSAO ( m_bUseSAO ); 523 #endif 524 m_cTEncTop.setTestSAODisableAtPictureLevel ( m_bTestSAODisableAtPictureLevel ); 525 m_cTEncTop.setSaoEncodingRate ( m_saoEncodingRate ); 526 m_cTEncTop.setSaoEncodingRateChroma ( m_saoEncodingRateChroma ); 527 m_cTEncTop.setMaxNumOffsetsPerPic ( m_maxNumOffsetsPerPic); 528 529 m_cTEncTop.setSaoCtuBoundary ( m_saoCtuBoundary); 530 m_cTEncTop.setPCMInputBitDepthFlag ( m_bPCMInputBitDepthFlag); 531 m_cTEncTop.setPCMFilterDisableFlag ( m_bPCMFilterDisableFlag); 532 533 m_cTEncTop.setIntraSmoothingDisabledFlag (!m_enableIntraReferenceSmoothing ); 534 m_cTEncTop.setDecodedPictureHashSEIEnabled ( m_decodedPictureHashSEIEnabled ); 535 m_cTEncTop.setRecoveryPointSEIEnabled ( m_recoveryPointSEIEnabled ); 536 m_cTEncTop.setBufferingPeriodSEIEnabled ( m_bufferingPeriodSEIEnabled ); 537 m_cTEncTop.setPictureTimingSEIEnabled ( m_pictureTimingSEIEnabled ); 538 m_cTEncTop.setToneMappingInfoSEIEnabled ( m_toneMappingInfoSEIEnabled ); 539 m_cTEncTop.setTMISEIToneMapId ( m_toneMapId ); 540 m_cTEncTop.setTMISEIToneMapCancelFlag ( m_toneMapCancelFlag ); 541 m_cTEncTop.setTMISEIToneMapPersistenceFlag ( m_toneMapPersistenceFlag ); 542 m_cTEncTop.setTMISEICodedDataBitDepth ( m_toneMapCodedDataBitDepth ); 543 m_cTEncTop.setTMISEITargetBitDepth ( m_toneMapTargetBitDepth ); 544 m_cTEncTop.setTMISEIModelID ( m_toneMapModelId ); 545 m_cTEncTop.setTMISEIMinValue ( m_toneMapMinValue ); 546 m_cTEncTop.setTMISEIMaxValue ( m_toneMapMaxValue ); 547 m_cTEncTop.setTMISEISigmoidMidpoint ( m_sigmoidMidpoint ); 548 m_cTEncTop.setTMISEISigmoidWidth ( m_sigmoidWidth ); 549 m_cTEncTop.setTMISEIStartOfCodedInterva ( m_startOfCodedInterval ); 550 m_cTEncTop.setTMISEINumPivots ( m_numPivots ); 551 m_cTEncTop.setTMISEICodedPivotValue ( m_codedPivotValue ); 552 m_cTEncTop.setTMISEITargetPivotValue ( m_targetPivotValue ); 553 m_cTEncTop.setTMISEICameraIsoSpeedIdc ( m_cameraIsoSpeedIdc ); 554 m_cTEncTop.setTMISEICameraIsoSpeedValue ( m_cameraIsoSpeedValue ); 555 m_cTEncTop.setTMISEIExposureIndexIdc ( m_exposureIndexIdc ); 556 m_cTEncTop.setTMISEIExposureIndexValue ( m_exposureIndexValue ); 557 m_cTEncTop.setTMISEIExposureCompensationValueSignFlag ( m_exposureCompensationValueSignFlag ); 558 m_cTEncTop.setTMISEIExposureCompensationValueNumerator ( m_exposureCompensationValueNumerator ); 559 m_cTEncTop.setTMISEIExposureCompensationValueDenomIdc ( m_exposureCompensationValueDenomIdc ); 560 m_cTEncTop.setTMISEIRefScreenLuminanceWhite ( m_refScreenLuminanceWhite ); 561 m_cTEncTop.setTMISEIExtendedRangeWhiteLevel ( m_extendedRangeWhiteLevel ); 562 m_cTEncTop.setTMISEINominalBlackLevelLumaCodeValue ( m_nominalBlackLevelLumaCodeValue ); 563 m_cTEncTop.setTMISEINominalWhiteLevelLumaCodeValue ( m_nominalWhiteLevelLumaCodeValue ); 564 m_cTEncTop.setTMISEIExtendedWhiteLevelLumaCodeValue ( m_extendedWhiteLevelLumaCodeValue ); 565 m_cTEncTop.setChromaSamplingFilterHintEnabled ( m_chromaSamplingFilterSEIenabled ); 566 m_cTEncTop.setChromaSamplingHorFilterIdc ( m_chromaSamplingHorFilterIdc ); 567 m_cTEncTop.setChromaSamplingVerFilterIdc ( m_chromaSamplingVerFilterIdc ); 568 m_cTEncTop.setFramePackingArrangementSEIEnabled ( m_framePackingSEIEnabled ); 569 m_cTEncTop.setFramePackingArrangementSEIType ( m_framePackingSEIType ); 570 m_cTEncTop.setFramePackingArrangementSEIId ( m_framePackingSEIId ); 571 m_cTEncTop.setFramePackingArrangementSEIQuincunx ( m_framePackingSEIQuincunx ); 572 m_cTEncTop.setFramePackingArrangementSEIInterpretation ( m_framePackingSEIInterpretation ); 573 m_cTEncTop.setSegmentedRectFramePackingArrangementSEIEnabled ( m_segmentedRectFramePackingSEIEnabled ); 574 m_cTEncTop.setSegmentedRectFramePackingArrangementSEICancel ( m_segmentedRectFramePackingSEICancel ); 575 m_cTEncTop.setSegmentedRectFramePackingArrangementSEIType ( m_segmentedRectFramePackingSEIType ); 576 m_cTEncTop.setSegmentedRectFramePackingArrangementSEIPersistence( m_segmentedRectFramePackingSEIPersistence ); 577 m_cTEncTop.setDisplayOrientationSEIAngle ( m_displayOrientationSEIAngle ); 578 m_cTEncTop.setTemporalLevel0IndexSEIEnabled ( m_temporalLevel0IndexSEIEnabled ); 579 m_cTEncTop.setGradualDecodingRefreshInfoEnabled ( m_gradualDecodingRefreshInfoEnabled ); 580 m_cTEncTop.setNoDisplaySEITLayer ( m_noDisplaySEITLayer ); 581 m_cTEncTop.setDecodingUnitInfoSEIEnabled ( m_decodingUnitInfoSEIEnabled ); 582 m_cTEncTop.setSOPDescriptionSEIEnabled ( m_SOPDescriptionSEIEnabled ); 583 m_cTEncTop.setScalableNestingSEIEnabled ( m_scalableNestingSEIEnabled ); 584 #if NH_MV 585 m_cTEncTop.setSubBitstreamPropSEIEnabled ( m_subBistreamPropSEIEnabled ); 586 if( m_subBistreamPropSEIEnabled ) 587 { 588 m_cTEncTop.setNumAdditionalSubStreams ( m_sbPropNumAdditionalSubStreams ); 589 m_cTEncTop.setSubBitstreamMode ( m_sbPropSubBitstreamMode ); 590 m_cTEncTop.setOutputLayerSetIdxToVps ( m_sbPropOutputLayerSetIdxToVps ); 591 m_cTEncTop.setHighestSublayerId ( m_sbPropHighestSublayerId ); 592 m_cTEncTop.setAvgBitRate ( m_sbPropAvgBitRate ); 593 m_cTEncTop.setMaxBitRate ( m_sbPropMaxBitRate ); 594 } 595 #endif 596 597 m_cTEncTop.setTMCTSSEIEnabled ( m_tmctsSEIEnabled ); 598 m_cTEncTop.setTimeCodeSEIEnabled ( m_timeCodeSEIEnabled ); 599 m_cTEncTop.setNumberOfTimeSets ( m_timeCodeSEINumTs ); 600 for(Int i = 0; i < m_timeCodeSEINumTs; i++) 601 { 602 m_cTEncTop.setTimeSet(m_timeSetArray[i], i); 603 } 604 m_cTEncTop.setKneeSEIEnabled ( m_kneeSEIEnabled ); 605 m_cTEncTop.setKneeSEIId ( m_kneeSEIId ); 606 m_cTEncTop.setKneeSEICancelFlag ( m_kneeSEICancelFlag ); 607 m_cTEncTop.setKneeSEIPersistenceFlag ( m_kneeSEIPersistenceFlag ); 608 m_cTEncTop.setKneeSEIInputDrange ( m_kneeSEIInputDrange ); 609 m_cTEncTop.setKneeSEIInputDispLuminance ( m_kneeSEIInputDispLuminance ); 610 m_cTEncTop.setKneeSEIOutputDrange ( m_kneeSEIOutputDrange ); 611 m_cTEncTop.setKneeSEIOutputDispLuminance ( m_kneeSEIOutputDispLuminance ); 612 m_cTEncTop.setKneeSEINumKneePointsMinus1 ( m_kneeSEINumKneePointsMinus1 ); 613 m_cTEncTop.setKneeSEIInputKneePoint ( m_kneeSEIInputKneePoint ); 614 m_cTEncTop.setKneeSEIOutputKneePoint ( m_kneeSEIOutputKneePoint ); 615 m_cTEncTop.setMasteringDisplaySEI ( m_masteringDisplay ); 616 617 m_cTEncTop.setTileUniformSpacingFlag ( m_tileUniformSpacingFlag ); 618 m_cTEncTop.setNumColumnsMinus1 ( m_numTileColumnsMinus1 ); 619 m_cTEncTop.setNumRowsMinus1 ( m_numTileRowsMinus1 ); 495 620 if(!m_tileUniformSpacingFlag) 496 621 { 497 m_cTEncTop.setColumnWidth ( m_tileColumnWidth );498 m_cTEncTop.setRowHeight ( m_tileRowHeight );622 m_cTEncTop.setColumnWidth ( m_tileColumnWidth ); 623 m_cTEncTop.setRowHeight ( m_tileRowHeight ); 499 624 } 500 625 m_cTEncTop.xCheckGSParameters(); 501 Int uiTilesCount 626 Int uiTilesCount = (m_numTileRowsMinus1+1) * (m_numTileColumnsMinus1+1); 502 627 if(uiTilesCount == 1) 503 628 { 504 m_bLFCrossTileBoundaryFlag = true; 505 } 506 m_cTEncTop.setLFCrossTileBoundaryFlag( m_bLFCrossTileBoundaryFlag ); 507 m_cTEncTop.setWaveFrontSynchro ( m_iWaveFrontSynchro ); 508 m_cTEncTop.setWaveFrontSubstreams ( m_iWaveFrontSubstreams ); 509 m_cTEncTop.setTMVPModeId ( m_TMVPModeId ); 510 m_cTEncTop.setUseScalingListId ( m_useScalingListId ); 511 m_cTEncTop.setScalingListFile ( m_scalingListFile ); 512 m_cTEncTop.setSignHideFlag(m_signHideFlag); 629 m_bLFCrossTileBoundaryFlag = true; 630 } 631 m_cTEncTop.setLFCrossTileBoundaryFlag ( m_bLFCrossTileBoundaryFlag ); 632 m_cTEncTop.setWaveFrontSynchro ( m_iWaveFrontSynchro ); 633 m_cTEncTop.setTMVPModeId ( m_TMVPModeId ); 634 m_cTEncTop.setUseScalingListId ( m_useScalingListId ); 635 m_cTEncTop.setScalingListFile ( m_scalingListFile ); 636 m_cTEncTop.setSignHideFlag ( m_signHideFlag); 513 637 #if KWU_RC_VIEWRC_E0227 || KWU_RC_MADPRED_E0227 514 638 if(!m_cTEncTop.getIsDepth()) //only for texture 515 639 { 516 m_cTEncTop.setUseRateCtrl ( m_RCEnableRateControl );517 } 518 else 519 { 520 m_cTEncTop.setUseRateCtrl ( 0 );521 } 522 #else 523 m_cTEncTop.setUseRateCtrl( m_RCEnableRateControl );640 m_cTEncTop.setUseRateCtrl ( m_RCEnableRateControl ); 641 } 642 else 643 { 644 m_cTEncTop.setUseRateCtrl ( 0 ); 645 } 646 #else 647 m_cTEncTop.setUseRateCtrl ( m_RCEnableRateControl ); 524 648 #endif 525 649 #if !KWU_RC_VIEWRC_E0227 526 m_cTEncTop.setTargetBitrate ( m_RCTargetBitrate );527 #endif 528 m_cTEncTop.setKeepHierBit ( m_RCKeepHierarchicalBit );529 m_cTEncTop.setLCULevelRC ( m_RCLCULevelRC );530 m_cTEncTop.setUseLCUSeparateModel ( m_RCUseLCUSeparateModel );531 m_cTEncTop.setInitialQP ( m_RCInitialQP );532 m_cTEncTop.setForceIntraQP ( m_RCForceIntraQP );650 m_cTEncTop.setTargetBitrate ( m_RCTargetBitrate ); 651 #endif 652 m_cTEncTop.setKeepHierBit ( m_RCKeepHierarchicalBit ); 653 m_cTEncTop.setLCULevelRC ( m_RCLCULevelRC ); 654 m_cTEncTop.setUseLCUSeparateModel ( m_RCUseLCUSeparateModel ); 655 m_cTEncTop.setInitialQP ( m_RCInitialQP ); 656 m_cTEncTop.setForceIntraQP ( m_RCForceIntraQP ); 533 657 #if KWU_RC_MADPRED_E0227 534 658 if(m_cTEncTop.getUseRateCtrl() && !m_cTEncTop.getIsDepth()) … … 598 722 } 599 723 #endif 600 m_cTEncTop.setTransquantBypassEnableFlag(m_TransquantBypassEnableFlag); 601 m_cTEncTop.setCUTransquantBypassFlagForceValue(m_CUTransquantBypassFlagForce); 602 m_cTEncTop.setUseRecalculateQPAccordingToLambda( m_recalculateQPAccordingToLambda ); 603 m_cTEncTop.setUseStrongIntraSmoothing( m_useStrongIntraSmoothing ); 604 m_cTEncTop.setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled ); 605 m_cTEncTop.setVuiParametersPresentFlag( m_vuiParametersPresentFlag ); 606 m_cTEncTop.setAspectRatioInfoPresentFlag( m_aspectRatioInfoPresentFlag); 607 m_cTEncTop.setAspectRatioIdc( m_aspectRatioIdc ); 608 m_cTEncTop.setSarWidth( m_sarWidth ); 609 m_cTEncTop.setSarHeight( m_sarHeight ); 610 m_cTEncTop.setOverscanInfoPresentFlag( m_overscanInfoPresentFlag ); 611 m_cTEncTop.setOverscanAppropriateFlag( m_overscanAppropriateFlag ); 612 m_cTEncTop.setVideoSignalTypePresentFlag( m_videoSignalTypePresentFlag ); 613 m_cTEncTop.setVideoFormat( m_videoFormat ); 614 m_cTEncTop.setVideoFullRangeFlag( m_videoFullRangeFlag ); 615 m_cTEncTop.setColourDescriptionPresentFlag( m_colourDescriptionPresentFlag ); 616 m_cTEncTop.setColourPrimaries( m_colourPrimaries ); 617 m_cTEncTop.setTransferCharacteristics( m_transferCharacteristics ); 618 m_cTEncTop.setMatrixCoefficients( m_matrixCoefficients ); 619 m_cTEncTop.setChromaLocInfoPresentFlag( m_chromaLocInfoPresentFlag ); 620 m_cTEncTop.setChromaSampleLocTypeTopField( m_chromaSampleLocTypeTopField ); 621 m_cTEncTop.setChromaSampleLocTypeBottomField( m_chromaSampleLocTypeBottomField ); 622 m_cTEncTop.setNeutralChromaIndicationFlag( m_neutralChromaIndicationFlag ); 623 m_cTEncTop.setDefaultDisplayWindow( m_defDispWinLeftOffset, m_defDispWinRightOffset, m_defDispWinTopOffset, m_defDispWinBottomOffset ); 624 m_cTEncTop.setFrameFieldInfoPresentFlag( m_frameFieldInfoPresentFlag ); 625 m_cTEncTop.setPocProportionalToTimingFlag( m_pocProportionalToTimingFlag ); 626 m_cTEncTop.setNumTicksPocDiffOneMinus1 ( m_numTicksPocDiffOneMinus1 ); 627 m_cTEncTop.setBitstreamRestrictionFlag( m_bitstreamRestrictionFlag ); 628 m_cTEncTop.setTilesFixedStructureFlag( m_tilesFixedStructureFlag ); 629 m_cTEncTop.setMotionVectorsOverPicBoundariesFlag( m_motionVectorsOverPicBoundariesFlag ); 630 m_cTEncTop.setMinSpatialSegmentationIdc( m_minSpatialSegmentationIdc ); 631 m_cTEncTop.setMaxBytesPerPicDenom( m_maxBytesPerPicDenom ); 632 m_cTEncTop.setMaxBitsPerMinCuDenom( m_maxBitsPerMinCuDenom ); 633 m_cTEncTop.setLog2MaxMvLengthHorizontal( m_log2MaxMvLengthHorizontal ); 634 m_cTEncTop.setLog2MaxMvLengthVertical( m_log2MaxMvLengthVertical ); 635 #if H_MV 636 } 637 #endif 638 #if H_3D 639 /// SET Profiles 640 for(Int layerIdInVps = 0; layerIdInVps < m_numberOfLayers; layerIdInVps++) 641 { 642 Int profileIdc = -1; 643 for (Int olsIdx = 0; olsIdx < vps.getNumOutputLayerSets(); olsIdx++ ) 644 { 645 Int lsIdx = vps.olsIdxToLsIdx( olsIdx ); 646 for(Int i = 0; i < vps.getNumLayersInIdList( lsIdx ); i++ ) 647 { 648 if( vps.getLayerIdInNuh( layerIdInVps) == vps.getLayerSetLayerIdList(lsIdx, i) ) 649 { 650 Int ptlIdx = vps.getProfileTierLevelIdx( olsIdx, i ); 651 if ( ptlIdx != -1 ) 652 { 653 Int curProfileIdc = vps.getPTL(ptlIdx)->getGeneralPTL()->getProfileIdc(); 654 if (profileIdc == -1) 655 { 656 profileIdc = curProfileIdc; 657 } 658 else 659 { 660 if ( profileIdc != curProfileIdc ) 661 { 662 fprintf(stderr, "Error: ProfileIdc for layer with index %d in VPS not equal in all OLSs. \n", layerIdInVps ); 663 exit(EXIT_FAILURE); 664 } 665 } 666 } 667 } 668 } 669 } 670 if (profileIdc == -1 ) 671 { 672 fprintf(stderr, "Error: No profile given for layer with index %d in VPS not equal in all OLS. \n", layerIdInVps ); 673 exit(EXIT_FAILURE); 674 } 675 m_acTEncTopList[ layerIdInVps ]->setProfileIdc( profileIdc ); 676 } 677 #endif 678 #if H_3D_VSO 724 m_cTEncTop.setTransquantBypassEnableFlag ( m_TransquantBypassEnableFlag ); 725 m_cTEncTop.setCUTransquantBypassFlagForceValue ( m_CUTransquantBypassFlagForce ); 726 m_cTEncTop.setCostMode ( m_costMode ); 727 m_cTEncTop.setUseRecalculateQPAccordingToLambda ( m_recalculateQPAccordingToLambda ); 728 m_cTEncTop.setUseStrongIntraSmoothing ( m_useStrongIntraSmoothing ); 729 m_cTEncTop.setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled ); 730 m_cTEncTop.setVuiParametersPresentFlag ( m_vuiParametersPresentFlag ); 731 m_cTEncTop.setAspectRatioInfoPresentFlag ( m_aspectRatioInfoPresentFlag); 732 m_cTEncTop.setAspectRatioIdc ( m_aspectRatioIdc ); 733 m_cTEncTop.setSarWidth ( m_sarWidth ); 734 m_cTEncTop.setSarHeight ( m_sarHeight ); 735 m_cTEncTop.setOverscanInfoPresentFlag ( m_overscanInfoPresentFlag ); 736 m_cTEncTop.setOverscanAppropriateFlag ( m_overscanAppropriateFlag ); 737 m_cTEncTop.setVideoSignalTypePresentFlag ( m_videoSignalTypePresentFlag ); 738 m_cTEncTop.setVideoFormat ( m_videoFormat ); 739 m_cTEncTop.setVideoFullRangeFlag ( m_videoFullRangeFlag ); 740 m_cTEncTop.setColourDescriptionPresentFlag ( m_colourDescriptionPresentFlag ); 741 m_cTEncTop.setColourPrimaries ( m_colourPrimaries ); 742 m_cTEncTop.setTransferCharacteristics ( m_transferCharacteristics ); 743 m_cTEncTop.setMatrixCoefficients ( m_matrixCoefficients ); 744 m_cTEncTop.setChromaLocInfoPresentFlag ( m_chromaLocInfoPresentFlag ); 745 m_cTEncTop.setChromaSampleLocTypeTopField ( m_chromaSampleLocTypeTopField ); 746 m_cTEncTop.setChromaSampleLocTypeBottomField ( m_chromaSampleLocTypeBottomField ); 747 m_cTEncTop.setNeutralChromaIndicationFlag ( m_neutralChromaIndicationFlag ); 748 m_cTEncTop.setDefaultDisplayWindow ( m_defDispWinLeftOffset, m_defDispWinRightOffset, m_defDispWinTopOffset, m_defDispWinBottomOffset ); 749 m_cTEncTop.setFrameFieldInfoPresentFlag ( m_frameFieldInfoPresentFlag ); 750 m_cTEncTop.setPocProportionalToTimingFlag ( m_pocProportionalToTimingFlag ); 751 m_cTEncTop.setNumTicksPocDiffOneMinus1 ( m_numTicksPocDiffOneMinus1 ); 752 m_cTEncTop.setBitstreamRestrictionFlag ( m_bitstreamRestrictionFlag ); 753 m_cTEncTop.setTilesFixedStructureFlag ( m_tilesFixedStructureFlag ); 754 m_cTEncTop.setMotionVectorsOverPicBoundariesFlag ( m_motionVectorsOverPicBoundariesFlag ); 755 m_cTEncTop.setMinSpatialSegmentationIdc ( m_minSpatialSegmentationIdc ); 756 m_cTEncTop.setMaxBytesPerPicDenom ( m_maxBytesPerPicDenom ); 757 m_cTEncTop.setMaxBitsPerMinCuDenom ( m_maxBitsPerMinCuDenom ); 758 m_cTEncTop.setLog2MaxMvLengthHorizontal ( m_log2MaxMvLengthHorizontal ); 759 m_cTEncTop.setLog2MaxMvLengthVertical ( m_log2MaxMvLengthVertical ); 760 m_cTEncTop.setEfficientFieldIRAPEnabled ( m_bEfficientFieldIRAPEnabled ); 761 m_cTEncTop.setHarmonizeGopFirstFieldCoupleEnabled ( m_bHarmonizeGopFirstFieldCoupleEnabled ); 762 763 m_cTEncTop.setSummaryOutFilename ( m_summaryOutFilename ); 764 m_cTEncTop.setSummaryPicFilenameBase ( m_summaryPicFilenameBase ); 765 m_cTEncTop.setSummaryVerboseness ( m_summaryVerboseness ); 766 767 #if NH_MV 768 } 769 #endif 770 #if NH_3D_VSO 679 771 if ( m_bUseVSO ) 680 772 { … … 682 774 { 683 775 #if H_3D_VSO_EARLY_SKIP 684 m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, g_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0, m_bVSOEarlySkip );685 #else 686 m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, g_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0 );776 m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0, m_bVSOEarlySkip ); 777 #else 778 m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0 ); 687 779 #endif 688 780 for ( Int layer = 0; layer < m_numberOfLayers ; layer++ ) … … 717 809 Void TAppEncTop::xCreateLib() 718 810 { 719 #if H_MV811 #if NH_MV 720 812 // initialize global variables 721 813 initROM(); 722 #if H_3D_DIM_DMM814 #if NH_3D_DMM 723 815 initWedgeLists( true ); 724 816 #endif … … 726 818 for( Int layer=0; layer < m_numberOfLayers; layer++) 727 819 { 728 m_acTVideoIOYuvInputFileList[layer]->open( m_pchInputFileList[layer], false, m_inputBitDepth Y, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC); // read mode729 m_acTVideoIOYuvInputFileList[layer]->skipFrames( m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1] );820 m_acTVideoIOYuvInputFileList[layer]->open( m_pchInputFileList[layer], false, m_inputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth ); // read mode 821 m_acTVideoIOYuvInputFileList[layer]->skipFrames( m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1], m_InputChromaFormatIDC); 730 822 731 823 if (m_pchReconFileList[layer]) 732 824 { 733 m_acTVideoIOYuvReconFileList[layer]->open( m_pchReconFileList[layer], true, m_outputBitDepth Y, m_outputBitDepthC, m_internalBitDepthY, m_internalBitDepthC); // write mode825 m_acTVideoIOYuvReconFileList[layer]->open( m_pchReconFileList[layer], true, m_outputBitDepth, m_outputBitDepth, m_internalBitDepth); // write mode 734 826 } 735 827 m_acTEncTopList[layer]->create(); … … 737 829 #else 738 830 // Video I/O 739 m_cTVideoIOYuvInputFile.open( m_pchInputFile, false, m_inputBitDepth Y, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC); // read mode740 m_cTVideoIOYuvInputFile.skipFrames(m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1] );831 m_cTVideoIOYuvInputFile.open( m_pchInputFile, false, m_inputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth ); // read mode 832 m_cTVideoIOYuvInputFile.skipFrames(m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1], m_InputChromaFormatIDC); 741 833 742 834 if (m_pchReconFile) 743 m_cTVideoIOYuvReconFile.open(m_pchReconFile, true, m_outputBitDepthY, m_outputBitDepthC, m_internalBitDepthY, m_internalBitDepthC); // write mode 744 835 { 836 m_cTVideoIOYuvReconFile.open(m_pchReconFile, true, m_outputBitDepth, m_outputBitDepth, m_internalBitDepth); // write mode 837 } 838 745 839 // Neo Decoder 746 840 m_cTEncTop.create(); … … 750 844 Void TAppEncTop::xDestroyLib() 751 845 { 752 #if H_MV846 #if NH_MV 753 847 // destroy ROM 754 848 destroyROM(); … … 766 860 delete m_acTEncTopList[layer] ; 767 861 m_acTEncTopList[layer] = NULL; 768 delete m_ picYuvRec[layer] ;769 m_ picYuvRec[layer] = NULL;862 delete m_cListPicYuvRec[layer] ; 863 m_cListPicYuvRec[layer] = NULL; 770 864 } 771 865 #else … … 773 867 m_cTVideoIOYuvInputFile.close(); 774 868 m_cTVideoIOYuvReconFile.close(); 775 869 776 870 // Neo Decoder 777 871 m_cTEncTop.destroy(); … … 781 875 Void TAppEncTop::xInitLib(Bool isFieldCoding) 782 876 { 783 #if H_3D 784 #endif 785 786 #if H_MV 877 #if NH_MV 787 878 for(Int layer=0; layer<m_numberOfLayers; layer++) 788 879 { … … 794 885 } 795 886 #else 796 m_cTEncTop.init( isFieldCoding);887 m_cTEncTop.init(isFieldCoding); 797 888 #endif 798 889 } … … 819 910 } 820 911 912 #if !NH_3D 821 913 TComPicYuv* pcPicYuvOrg = new TComPicYuv; 914 #endif 822 915 TComPicYuv* pcPicYuvRec = NULL; 823 916 824 917 // initialize internal class & member variables 825 918 xInitLibCfg(); 826 919 xCreateLib(); 827 920 xInitLib(m_isField); 828 921 922 printChromaFormat(); 923 829 924 // main encoder loop 830 #if H_MV925 #if NH_MV 831 926 Bool allEos = false; 832 927 std::vector<Bool> eos ; … … 846 941 Bool bEos = false; 847 942 #endif 848 943 const InputColourSpaceConversion ipCSC = m_inputColourSpaceConvert; 944 const InputColourSpaceConversion snrCSC = (!m_snrInternalColourSpace) ? m_inputColourSpaceConvert : IPCOLOURSPACE_UNCHANGED; 945 849 946 list<AccessUnit> outputAccessUnits; ///< list of access units to write out. is populated by the encoding process 947 948 #if NH_3D 949 TComPicYuv* picYuvOrg[2]; 950 TComPicYuv picYuvTrueOrg[2]; 951 for (Int d = 0; d < 2 ; d++) 952 { 953 picYuvOrg[d] = new TComPicYuv; 954 picYuvOrg[d] ->create( m_iSourceWidth, m_isField ? m_iSourceHeightOrg : m_iSourceHeight, ( d > 0 ) ? CHROMA_400 : m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true ); 955 picYuvTrueOrg[d].create( m_iSourceWidth, m_isField ? m_iSourceHeightOrg : m_iSourceHeight, ( d > 0 ) ? CHROMA_400 : m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true ); 956 } 957 #else 958 TComPicYuv cPicYuvTrueOrg; 850 959 851 960 // allocate original YUV buffer 852 961 if( m_isField ) 853 962 { 854 pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeightOrg, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 963 pcPicYuvOrg->create ( m_iSourceWidth, m_iSourceHeightOrg, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true ); 964 cPicYuvTrueOrg.create(m_iSourceWidth, m_iSourceHeightOrg, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true); 855 965 } 856 966 else 857 967 { 858 pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 859 } 860 861 #if H_MV 968 pcPicYuvOrg->create ( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true ); 969 cPicYuvTrueOrg.create(m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true ); 970 } 971 #endif 972 #if NH_MV 862 973 while ( (m_targetEncLayerIdList.size() != 0 ) && !allEos ) 863 974 { 864 975 for(Int layer=0; layer < m_numberOfLayers; layer++ ) 865 976 { 977 #if NH_3D 978 TComPicYuv* pcPicYuvOrg = picYuvOrg [ m_depthFlag[layer] ]; 979 TComPicYuv& cPicYuvTrueOrg = picYuvTrueOrg[ m_depthFlag[layer] ]; 980 #endif 866 981 if (!xLayerIdInTargetEncLayerIdList( m_vps->getLayerIdInNuh( layer ) )) 867 982 { … … 875 990 xGetBuffer(pcPicYuvRec, layer); 876 991 877 // read input YUV file 878 m_acTVideoIOYuvInputFileList[layer]->read ( pcPicYuvOrg, m_aiPad);992 // read input YUV file 993 m_acTVideoIOYuvInputFileList[layer]->read ( pcPicYuvOrg, &cPicYuvTrueOrg, ipCSC, m_aiPad, m_InputChromaFormatIDC ); 879 994 m_acTEncTopList [layer]->initNewPic( pcPicYuvOrg ); 880 995 … … 899 1014 for ( Int gopId=0; gopId < gopSize; gopId++ ) 900 1015 { 901 #if H_3D1016 #if NH_3D 902 1017 UInt iNextPoc = m_acTEncTopList[0] -> getFrameId( gopId ); 903 1018 if ( iNextPoc < m_framesToBeEncoded ) … … 908 1023 for(Int layer=0; layer < m_numberOfLayers; layer++ ) 909 1024 { 1025 #if NH_3D 1026 TComPicYuv* pcPicYuvOrg = picYuvOrg [ m_depthFlag[layer] ]; 1027 TComPicYuv& cPicYuvTrueOrg = picYuvTrueOrg[ m_depthFlag[layer] ]; 1028 #endif 910 1029 if (!xLayerIdInTargetEncLayerIdList( m_vps->getLayerIdInNuh( layer ) )) 911 1030 { … … 913 1032 } 914 1033 915 #if H_3D_VSO1034 #if NH_3D_VSO 916 1035 if( m_bUseVSO && m_bUseEstimatedVSD && iNextPoc < m_framesToBeEncoded ) 917 1036 { … … 923 1042 Int iNumEncoded = 0; 924 1043 925 // call encoding function for one frame 926 m_acTEncTopList[layer]->encode( eos[layer], flush[layer] ? 0 : pcPicYuvOrg, *m_picYuvRec[layer], outputAccessUnits, iNumEncoded, gopId );1044 // call encoding function for one frame 1045 m_acTEncTopList[layer]->encode( eos[layer], flush[layer] ? 0 : pcPicYuvOrg, flush[layer] ? 0 : &cPicYuvTrueOrg, snrCSC, *m_cListPicYuvRec[layer], outputAccessUnits, iNumEncoded, gopId ); 927 1046 xWriteOutput(bitstreamFile, iNumEncoded, outputAccessUnits, layer); 928 1047 outputAccessUnits.clear(); … … 937 1056 { 938 1057 continue; 939 } 940 m_acTEncTopList[layer]->printSummary( m_acTEncTopList[layer]->getNumAllPicCoded(), m_isField ); 941 } 942 #else 1058 } 1059 m_acTEncTopList[layer]->printSummary(m_isField); 1060 } 1061 #else 1062 943 1063 while ( !bEos ) 944 1064 { … … 947 1067 948 1068 // read input YUV file 949 m_cTVideoIOYuvInputFile.read( pcPicYuvOrg, m_aiPad);1069 m_cTVideoIOYuvInputFile.read( pcPicYuvOrg, &cPicYuvTrueOrg, ipCSC, m_aiPad, m_InputChromaFormatIDC, m_bClipInputVideoToRec709Range ); 950 1070 951 1071 // increase number of received frames … … 967 1087 if ( m_isField ) 968 1088 { 969 m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, m_cListPicYuvRec, outputAccessUnits, iNumEncoded, m_isTopFieldFirst);1089 m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, flush ? 0 : &cPicYuvTrueOrg, snrCSC, m_cListPicYuvRec, outputAccessUnits, iNumEncoded, m_isTopFieldFirst ); 970 1090 } 971 1091 else 972 1092 { 973 m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, m_cListPicYuvRec, outputAccessUnits, iNumEncoded );974 } 975 1093 m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, flush ? 0 : &cPicYuvTrueOrg, snrCSC, m_cListPicYuvRec, outputAccessUnits, iNumEncoded ); 1094 } 1095 976 1096 // write bistream to file if necessary 977 1097 if ( iNumEncoded > 0 ) … … 985 1105 #endif 986 1106 1107 #if NH_3D 1108 // delete original YUV buffer 1109 for (Int d = 0; d < 2; d++) 1110 { 1111 picYuvOrg[d]->destroy(); 1112 delete picYuvOrg[d]; 1113 picYuvOrg[d] = NULL; 1114 1115 picYuvTrueOrg[d].destroy(); 1116 } 1117 #else 987 1118 // delete original YUV buffer 988 1119 pcPicYuvOrg->destroy(); 989 1120 delete pcPicYuvOrg; 990 1121 pcPicYuvOrg = NULL; 991 992 #if !H_MV 1122 #endif 1123 1124 #if !NH_MV 993 1125 // delete used buffers in encoder class 994 1126 m_cTEncTop.deletePicBuffer(); 1127 #endif 1128 #if !NH_3D 1129 cPicYuvTrueOrg.destroy(); 995 1130 #endif 996 1131 … … 998 1133 xDeleteBuffer(); 999 1134 xDestroyLib(); 1000 1135 1001 1136 printRateSummary(); 1002 1137 … … 1023 1158 . 1024 1159 */ 1025 #if H_MV1160 #if NH_MV 1026 1161 Void TAppEncTop::xGetBuffer( TComPicYuv*& rpcPicYuvRec, UInt layer) 1027 1162 #else … … 1030 1165 { 1031 1166 assert( m_iGOPSize > 0 ); 1032 1167 1033 1168 // org. buffer 1034 #if H_MV1035 if ( m_ picYuvRec[layer]->size() == (UInt)m_iGOPSize )1036 { 1037 rpcPicYuvRec = m_ picYuvRec[layer]->popFront();1038 #else 1039 if ( m_cListPicYuvRec.size() == (UInt)m_iGOPSize )1169 #if NH_MV 1170 if ( m_cListPicYuvRec[layer]->size() == (UInt)m_iGOPSize ) 1171 { 1172 rpcPicYuvRec = m_cListPicYuvRec[layer]->popFront(); 1173 #else 1174 if ( m_cListPicYuvRec.size() >= (UInt)m_iGOPSize ) // buffer will be 1 element longer when using field coding, to maintain first field whilst processing second. 1040 1175 { 1041 1176 rpcPicYuvRec = m_cListPicYuvRec.popFront(); 1042 1177 #endif 1043 1044 1178 } 1045 1179 else 1046 1180 { 1047 1181 rpcPicYuvRec = new TComPicYuv; 1048 1049 rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 1050 1051 } 1052 #if H_MV 1053 m_picYuvRec[layer]->pushBack( rpcPicYuvRec ); 1182 #if NH_3D 1183 rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_depthFlag[layer] > 0 ? CHROMA_400 : m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true ); 1184 #else 1185 rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, true ); 1186 #endif 1187 1188 } 1189 #if NH_MV 1190 m_cListPicYuvRec[layer]->pushBack( rpcPicYuvRec ); 1054 1191 #else 1055 1192 m_cListPicYuvRec.pushBack( rpcPicYuvRec ); … … 1059 1196 Void TAppEncTop::xDeleteBuffer( ) 1060 1197 { 1061 #if H_MV1062 for(Int layer=0; layer<m_ picYuvRec.size(); layer++)1063 { 1064 if(m_ picYuvRec[layer])1065 { 1066 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_ picYuvRec[layer]->begin();1067 Int iSize = Int( m_ picYuvRec[layer]->size() );1198 #if NH_MV 1199 for(Int layer=0; layer<m_cListPicYuvRec.size(); layer++) 1200 { 1201 if(m_cListPicYuvRec[layer]) 1202 { 1203 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec[layer]->begin(); 1204 Int iSize = Int( m_cListPicYuvRec[layer]->size() ); 1068 1205 #else 1069 1206 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.begin(); 1070 1207 1071 1208 Int iSize = Int( m_cListPicYuvRec.size() ); 1072 1209 #endif … … 1078 1215 delete pcPicYuvRec; pcPicYuvRec = NULL; 1079 1216 } 1080 1081 #if H_MV 1217 #if NH_MV 1082 1218 } 1083 1219 } 1084 1220 #endif 1085 } 1086 1087 /** \param iNumEncoded number of encoded frames 1221 1222 } 1223 1224 /** 1225 Write access units to output file. 1226 \param bitstreamFile target bitstream file 1227 \param iNumEncoded number of encoded frames 1228 \param accessUnits list of access units to be written 1088 1229 */ 1089 #if H_MV1090 Void TAppEncTop::xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, std::list<AccessUnit>& accessUnits, UInt layerId )1230 #if NH_MV 1231 Void TAppEncTop::xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, std::list<AccessUnit>& accessUnits, UInt layerIdx) 1091 1232 #else 1092 1233 Void TAppEncTop::xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, const std::list<AccessUnit>& accessUnits) 1093 1234 #endif 1094 1235 { 1236 const InputColourSpaceConversion ipCSC = (!m_outputInternalColourSpace) ? m_inputColourSpaceConvert : IPCOLOURSPACE_UNCHANGED; 1237 1095 1238 if (m_isField) 1096 1239 { 1097 1240 //Reinterlace fields 1098 1241 Int i; 1099 #if H_MV1242 #if NH_MV 1100 1243 if( iNumEncoded > 0 ) 1101 1244 { 1102 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_ picYuvRec[layerId]->end();1245 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec[layerIdx]->end(); 1103 1246 #else 1104 1247 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.end(); … … 1116 1259 TComPicYuv* pcPicYuvRecBottom = *(iterPicYuvRec++); 1117 1260 1118 #if H_MV 1119 if (m_pchReconFileList[layerId]) 1120 { 1121 m_acTVideoIOYuvReconFileList[layerId]->write( pcPicYuvRecTop, pcPicYuvRecBottom, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, m_isTopFieldFirst ); 1261 #if NH_MV 1262 if (m_pchReconFileList[layerIdx]) 1263 { 1264 #if NH_3D 1265 m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRecTop, pcPicYuvRecBottom, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, m_depth420OutputFlag && m_depthFlag[layerIdx ] ? CHROMA_420 : NUM_CHROMA_FORMAT, m_isTopFieldFirst ); 1266 #else 1267 m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRecTop, pcPicYuvRecBottom, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, NUM_CHROMA_FORMAT, m_isTopFieldFirst ); 1268 #endif 1122 1269 } 1123 1270 } … … 1136 1283 if (m_pchReconFile) 1137 1284 { 1138 m_cTVideoIOYuvReconFile.write( pcPicYuvRecTop, pcPicYuvRecBottom, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, m_isTopFieldFirst );1285 m_cTVideoIOYuvReconFile.write( pcPicYuvRecTop, pcPicYuvRecBottom, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, NUM_CHROMA_FORMAT, m_isTopFieldFirst ); 1139 1286 } 1140 1287 … … 1152 1299 { 1153 1300 Int i; 1154 #if H_MV1301 #if NH_MV 1155 1302 if( iNumEncoded > 0 ) 1156 1303 { 1157 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_ picYuvRec[layerId]->end();1304 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec[layerIdx]->end(); 1158 1305 #else 1159 1306 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.end(); … … 1169 1316 { 1170 1317 TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); 1171 #if H_MV 1172 if (m_pchReconFileList[layerId]) 1173 { 1174 m_acTVideoIOYuvReconFileList[layerId]->write( pcPicYuvRec, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom ); 1318 #if NH_MV 1319 if (m_pchReconFileList[layerIdx]) 1320 { 1321 #if NH_3D 1322 m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRec, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, m_depth420OutputFlag && m_depthFlag[layerIdx ] ? CHROMA_420 : NUM_CHROMA_FORMAT ); 1323 #else 1324 m_acTVideoIOYuvReconFileList[layerIdx]->write( pcPicYuvRec, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom ); 1325 #endif 1326 1175 1327 } 1176 1328 } … … 1188 1340 if (m_pchReconFile) 1189 1341 { 1190 m_cTVideoIOYuvReconFile.write( pcPicYuvRec, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom ); 1342 m_cTVideoIOYuvReconFile.write( pcPicYuvRec, ipCSC, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, 1343 NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range ); 1191 1344 } 1192 1345 1193 1346 const AccessUnit& au = *(iterBitstream++); 1194 1347 const vector<UInt>& stats = writeAnnexB(bitstreamFile, au); 1195 rateStatsAccum(au, stats); 1196 } 1197 #endif 1198 } 1199 } 1200 1348 rateStatsAccum(au, stats); 1349 } 1350 #endif 1351 } 1352 } 1353 1201 1354 /** 1202 1355 * 1203 1356 */ 1204 void TAppEncTop::rateStatsAccum(const AccessUnit& au, const std::vector<UInt>& annexBsizes)1357 Void TAppEncTop::rateStatsAccum(const AccessUnit& au, const std::vector<UInt>& annexBsizes) 1205 1358 { 1206 1359 AccessUnit::const_iterator it_au = au.begin(); … … 1240 1393 } 1241 1394 1242 void TAppEncTop::printRateSummary()1243 { 1244 #if H_MV1395 Void TAppEncTop::printRateSummary() 1396 { 1397 #if NH_MV 1245 1398 Double time = (Double) m_frameRcvd[0] / m_iFrameRate; 1246 1399 printf("\n"); … … 1249 1402 #endif 1250 1403 printf("Bytes written to file: %u (%.3f kbps)\n", m_totalBytes, 0.008 * m_totalBytes / time); 1251 #if VERBOSE_RATE 1404 if (m_summaryVerboseness > 0) 1405 { 1252 1406 printf("Bytes for SPS/PPS/Slice (Incl. Annex B): %u (%.3f kbps)\n", m_essentialBytes, 0.008 * m_essentialBytes / time); 1253 #endif 1254 } 1255 1256 #if H_3D_DIM_DLT 1407 } 1408 } 1409 1410 Void TAppEncTop::printChromaFormat() 1411 { 1412 std::cout << std::setw(43) << "Input ChromaFormatIDC = "; 1413 switch (m_InputChromaFormatIDC) 1414 { 1415 case CHROMA_400: std::cout << " 4:0:0"; break; 1416 case CHROMA_420: std::cout << " 4:2:0"; break; 1417 case CHROMA_422: std::cout << " 4:2:2"; break; 1418 case CHROMA_444: std::cout << " 4:4:4"; break; 1419 default: 1420 std::cerr << "Invalid"; 1421 exit(1); 1422 } 1423 std::cout << std::endl; 1424 1425 #if NH_MV 1426 for (Int i = 0; i < m_numberOfLayers; i++) 1427 { 1428 std::cout << "Layer " << i << std::setw( 43 - (i > 9 ? 6 : 7) ) << "Internal ChromaFormatIDC = "; 1429 switch (m_acTEncTopList[i]->getChromaFormatIdc()) 1430 #else 1431 std::cout << std::setw(43) << "Output (internal) ChromaFormatIDC = "; 1432 switch (m_cTEncTop.getChromaFormatIdc()) 1433 #endif 1434 { 1435 case CHROMA_400: std::cout << " 4:0:0"; break; 1436 case CHROMA_420: std::cout << " 4:2:0"; break; 1437 case CHROMA_422: std::cout << " 4:2:2"; break; 1438 case CHROMA_444: std::cout << " 4:4:4"; break; 1439 default: 1440 std::cerr << "Invalid"; 1441 exit(1); 1442 } 1443 #if NH_MV 1444 std::cout << std::endl; 1445 } 1446 #endif 1447 std::cout << "\n" << std::endl; 1448 } 1449 1450 #if NH_3D_DLT 1257 1451 Void TAppEncTop::xAnalyzeInputBaseDepth(UInt layer, UInt uiNumFrames, TComVPS* vps, TComDLT* dlt) 1258 1452 { 1259 1453 TComPicYuv* pcDepthPicYuvOrg = new TComPicYuv; 1454 TComPicYuv* pcDepthPicYuvTrueOrg = new TComPicYuv; 1260 1455 // allocate original YUV buffer 1261 pcDepthPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); 1456 pcDepthPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, false ); 1457 pcDepthPicYuvTrueOrg->create( m_iSourceWidth, m_iSourceHeight, CHROMA_420, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxTotalCUDepth, false ); 1262 1458 1263 1459 TVideoIOYuv* depthVideoFile = new TVideoIOYuv; 1264 1460 1265 UInt uiMaxDepthValue = ((1 << g_bitDepthY)-1);1461 UInt uiMaxDepthValue = ((1 << m_inputBitDepth[CHANNEL_TYPE_LUMA])-1); 1266 1462 1267 Bool abValidDepths[256];1463 std::vector<Bool> abValidDepths(256, false); 1268 1464 1269 depthVideoFile->open( m_pchInputFileList[layer], false, m_inputBitDepth Y, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC ); // read mode1465 depthVideoFile->open( m_pchInputFileList[layer], false, m_inputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth ); 1270 1466 1271 // initialize boolean array1272 for(Int p=0; p<=uiMaxDepthValue; p++)1273 abValidDepths[p] = false;1467 Int iHeight = pcDepthPicYuvOrg->getHeight(COMPONENT_Y); 1468 Int iWidth = pcDepthPicYuvOrg->getWidth(COMPONENT_Y); 1469 Int iStride = pcDepthPicYuvOrg->getStride(COMPONENT_Y); 1274 1470 1275 Int iHeight = pcDepthPicYuvOrg->getHeight(); 1276 Int iWidth = pcDepthPicYuvOrg->getWidth(); 1277 Int iStride = pcDepthPicYuvOrg->getStride(); 1278 1279 Pel* pInDM = pcDepthPicYuvOrg->getLumaAddr(); 1471 Pel* pInDM = pcDepthPicYuvOrg->getAddr(COMPONENT_Y); 1280 1472 1281 1473 for(Int uiFrame=0; uiFrame < uiNumFrames; uiFrame++ ) 1282 1474 { 1283 depthVideoFile->read( pcDepthPicYuvOrg, m_aiPad);1475 depthVideoFile->read( pcDepthPicYuvOrg, pcDepthPicYuvTrueOrg, IPCOLOURSPACE_UNCHANGED, m_aiPad, m_InputChromaFormatIDC, m_bClipInputVideoToRec709Range ); 1284 1476 1285 1477 // check all pixel values … … 1301 1493 pcDepthPicYuvOrg->destroy(); 1302 1494 delete pcDepthPicYuvOrg; 1495 pcDepthPicYuvTrueOrg->destroy(); 1496 delete pcDepthPicYuvTrueOrg; 1303 1497 1304 1498 // convert boolean array to idx2Depth LUT 1305 Int* aiIdx2DepthValue = (Int*) calloc(uiMaxDepthValue, sizeof(Int));1499 std::vector<Int> aiIdx2DepthValue(256, 0); 1306 1500 Int iNumDepthValues = 0; 1307 1501 for(Int p=0; p<=uiMaxDepthValue; p++) … … 1313 1507 } 1314 1508 1315 if( uiNumFrames == 0 || numBitsForValue(iNumDepthValues) == g_bitDepthY)1509 if( uiNumFrames == 0 || gCeilLog2(iNumDepthValues) == m_inputBitDepth[CHANNEL_TYPE_LUMA] ) 1316 1510 { 1317 1511 dlt->setUseDLTFlag(layer, false); … … 1323 1517 dlt->setDepthLUTs(layer, aiIdx2DepthValue, iNumDepthValues); 1324 1518 } 1325 1326 // free temporary memory 1327 free(aiIdx2DepthValue); 1328 } 1329 #endif 1330 1331 #if H_MV 1519 } 1520 #endif 1521 1522 #if NH_MV 1332 1523 Void TAppEncTop::xSetDimensionIdAndLength( TComVPS& vps ) 1333 1524 { … … 1337 1528 vps.setDimensionIdLen( dim, m_dimensionIdLen[ dim ] ); 1338 1529 for( Int layer = 0; layer <= vps.getMaxLayersMinus1(); layer++ ) 1339 1340 1530 { 1341 1531 vps.setDimensionId( layer, dim, m_dimIds[ dim ][ layer ] ); … … 1358 1548 1359 1549 1360 #if H_3D1550 #if NH_3D 1361 1551 vps.initViewCompLayer( ); 1362 1552 #endif … … 1437 1627 Int curLayerIdInNuh = vps.getLayerIdInNuh( curLayerIdInVps ); 1438 1628 Int maxTid = -1; 1439 #if H_3D1629 #if NH_3D 1440 1630 if ( vps.getDirectDependencyFlag( curLayerIdInVps, refLayerIdInVps ) ) 1441 1631 { … … 1449 1639 for (Int j = 0; j < geCur.m_numActiveRefLayerPics; j++) 1450 1640 { 1451 #if H_3D1641 #if NH_3D 1452 1642 if ( vps.getIdRefListLayer( curLayerIdInNuh, geCur.m_interLayerPredLayerIdc[ j ] ) == refLayerIdInNuh ) 1453 1643 #else … … 1460 1650 } 1461 1651 } 1462 #if H_3D1652 #if NH_3D 1463 1653 } 1464 1654 else … … 1554 1744 1555 1745 // check if all reference layers when allRefLayerActiveFlag is equal to 1 are reference layer pictures specified in the gop entry 1556 #if H_3D1746 #if NH_3D 1557 1747 for (Int k = 0; k < vps.getNumRefListLayers( layerIdInNuh ) && allRefLayersActiveFlag; k++ ) 1558 1748 { … … 1580 1770 { 1581 1771 Bool referenceLayerFoundFlag = false; 1582 #if H_3D1772 #if NH_3D 1583 1773 for (Int k = 0; k < vps.getNumRefListLayers( layerIdInNuh ); k++ ) 1584 1774 { … … 1619 1809 } 1620 1810 1811 1812 Void TAppEncTop::xSetTimingInfo( TComVPS& vps ) 1813 { 1814 vps.getTimingInfo()->setTimingInfoPresentFlag( false ); 1815 } 1816 1817 Void TAppEncTop::xSetHrdParameters( TComVPS& vps ) 1818 { 1819 vps.createHrdParamBuffer(); 1820 for( Int i = 0; i < vps.getNumHrdParameters(); i++ ) 1821 { 1822 vps.setHrdOpSetIdx( 0, i ); 1823 vps.setCprmsPresentFlag( false, i ); 1824 } 1825 } 1826 1621 1827 Void TAppEncTop::xSetLayerIds( TComVPS& vps ) 1622 1828 { 1623 1829 vps.setSplittingFlag ( m_splittingFlag ); 1624 1830 1625 Bool nuhLayerIdPresentFlag = !( m_layerIdInNuh.size() == 1 ); 1626 Int maxNuhLayerId = nuhLayerIdPresentFlag ? xGetMax( m_layerIdInNuh ) : ( m_numberOfLayers - 1 ) ; 1627 1628 vps.setVpsMaxLayerId( maxNuhLayerId ); 1831 Bool nuhLayerIdPresentFlag = false; 1832 1833 1834 vps.setVpsMaxLayerId( xGetMax( m_layerIdInNuh ) ); 1835 1836 for (Int i = 0; i < m_numberOfLayers; i++) 1837 { 1838 nuhLayerIdPresentFlag = nuhLayerIdPresentFlag || ( m_layerIdInNuh[i] != i ); 1839 } 1840 1629 1841 vps.setVpsNuhLayerIdPresentFlag( nuhLayerIdPresentFlag ); 1630 1842 … … 1650 1862 1651 1863 // SET PTL 1652 assert( m_profile .size() == m_level.size() && m_profile.size() == m_levelTier.size() );1653 vps.setVpsNumProfileTierLevelMinus1( (Int) m_profile .size() - 1 );1864 assert( m_profiles.size() == m_level.size() && m_profiles.size() == m_levelTier.size() ); 1865 vps.setVpsNumProfileTierLevelMinus1( (Int) m_profiles.size() - 1 ); 1654 1866 for ( Int ptlIdx = 0; ptlIdx <= vps.getVpsNumProfileTierLevelMinus1(); ptlIdx++ ) 1655 1867 { 1656 1868 if ( ptlIdx > 1 ) 1657 1869 { 1658 Bool vpsProfilePresentFlag = ( m_profile [ptlIdx] != m_profile[ptlIdx - 1] )1870 Bool vpsProfilePresentFlag = ( m_profiles[ptlIdx] != m_profiles[ptlIdx - 1] ) 1659 1871 || ( m_inblFlag[ptlIdx ] != m_inblFlag[ptlIdx - 1] ); 1660 1872 vps.setVpsProfilePresentFlag( ptlIdx, vpsProfilePresentFlag ); 1661 1873 } 1662 1874 1663 xSetProfileTierLevel( vps, ptlIdx, -1, m_profile [ptlIdx], m_level[ptlIdx],1875 xSetProfileTierLevel( vps, ptlIdx, -1, m_profiles[ptlIdx], m_level[ptlIdx], 1664 1876 m_levelTier[ ptlIdx ], m_progressiveSourceFlag, m_interlacedSourceFlag, 1665 1877 m_nonPackedConstraintFlag, m_frameOnlyConstraintFlag, m_inblFlag[ptlIdx] ); … … 1695 1907 break; 1696 1908 case Profile::MULTIVIEWMAIN: 1697 #if H_3D1909 #if NH_3D 1698 1910 case Profile::MAIN3D: 1699 1911 #endif … … 1718 1930 { 1719 1931 1720 #if H_3D_DISABLE_CHROMA1721 1932 Bool anyDepth = false; 1933 #if NH_3D 1722 1934 for ( Int i = 0; i < m_numberOfLayers; i++ ) 1723 1935 { 1724 1936 vps.setVpsRepFormatIdx( i, m_depthFlag[ i ] ? 1 : 0 ); 1725 anyDepth = anyDepth || m_depthFlag[ i ]; 1726 } 1937 anyDepth = anyDepth || m_depthFlag[ i ]; 1938 } 1939 #endif 1727 1940 1728 1941 vps.setRepFormatIdxPresentFlag( anyDepth ); 1729 vps.setVpsNumRepFormatsMinus1 ( anyDepth ? 1 : 0 ); 1730 1942 vps.setVpsNumRepFormatsMinus1 ( anyDepth ? 1 : 0 ); 1943 1944 1945 std::vector<TComRepFormat> repFormat; 1946 repFormat.resize( vps.getVpsNumRepFormatsMinus1() + 1 ); 1731 1947 for ( Int j = 0; j <= vps.getVpsNumRepFormatsMinus1(); j++ ) 1732 { 1733 TComRepFormat* repFormat = new TComRepFormat; 1734 1735 repFormat->setBitDepthVpsChromaMinus8 ( g_bitDepthC - 8 ); 1736 repFormat->setBitDepthVpsLumaMinus8 ( g_bitDepthY - 8 ); 1737 repFormat->setChromaFormatVpsIdc ( j == 1 ? CHROMA_400 : CHROMA_420 ); 1738 repFormat->setPicHeightVpsInLumaSamples ( m_iSourceHeight ); 1739 repFormat->setPicWidthVpsInLumaSamples ( m_iSourceWidth ); 1740 repFormat->setChromaAndBitDepthVpsPresentFlag( true ); 1948 { 1949 repFormat[j].setBitDepthVpsChromaMinus8 ( m_internalBitDepth[CHANNEL_TYPE_LUMA ] - 8 ); 1950 repFormat[j].setBitDepthVpsLumaMinus8 ( m_internalBitDepth[CHANNEL_TYPE_CHROMA] - 8 ); 1951 repFormat[j].setChromaFormatVpsIdc ( j == 1 ? CHROMA_400 : CHROMA_420 ); 1952 repFormat[j].setPicHeightVpsInLumaSamples ( m_iSourceHeight ); 1953 repFormat[j].setPicWidthVpsInLumaSamples ( m_iSourceWidth ); 1954 repFormat[j].setChromaAndBitDepthVpsPresentFlag( true ); 1741 1955 // ToDo not supported yet. 1742 1956 //repFormat->setSeparateColourPlaneVpsFlag( ); 1743 Bool conformanceWindowVpsFlag = ( m_confWinBottom != 0 ) || ( m_confWinRight != 0 ) || ( m_confWinTop != 0 ) || ( m_confWinBottom != 0 ); 1744 repFormat->setConformanceWindowVpsFlag( conformanceWindowVpsFlag ); 1745 if ( conformanceWindowVpsFlag ) 1746 { 1747 repFormat->setConfWinVpsLeftOffset ( m_confWinLeft / TComSPS::getWinUnitX( repFormat->getChromaFormatVpsIdc() ) ); 1748 repFormat->setConfWinVpsRightOffset ( m_confWinRight / TComSPS::getWinUnitX( repFormat->getChromaFormatVpsIdc() ) ); 1749 repFormat->setConfWinVpsTopOffset ( m_confWinTop / TComSPS::getWinUnitY( repFormat->getChromaFormatVpsIdc() ) ); 1750 repFormat->setConfWinVpsBottomOffset ( m_confWinBottom / TComSPS::getWinUnitY( repFormat->getChromaFormatVpsIdc() ) ); 1751 } 1752 assert( vps.getRepFormat( j ) == NULL ); 1753 vps.setRepFormat( j , repFormat ); 1754 }; 1755 1756 1757 #else 1758 vps.setRepFormatIdxPresentFlag( false ); 1759 vps.setVpsNumRepFormatsMinus1 ( 0 ); 1760 1761 TComRepFormat* repFormat = new TComRepFormat; 1762 1763 repFormat->setBitDepthVpsChromaMinus8 ( g_bitDepthC - 8 ); 1764 repFormat->setBitDepthVpsLumaMinus8 ( g_bitDepthY - 8 ); 1765 repFormat->setChromaFormatVpsIdc ( CHROMA_420 ); 1766 repFormat->setPicHeightVpsInLumaSamples ( m_iSourceHeight ); 1767 repFormat->setPicWidthVpsInLumaSamples ( m_iSourceWidth ); 1768 repFormat->setChromaAndBitDepthVpsPresentFlag( true ); 1769 // ToDo not supported yet. 1770 //repFormat->setSeparateColourPlaneVpsFlag( ); 1771 1772 repFormat->setConformanceWindowVpsFlag( true ); 1773 repFormat->setConfWinVpsLeftOffset ( m_confWinLeft / TComSPS::getWinUnitX( repFormat->getChromaFormatVpsIdc() ) ); 1774 repFormat->setConfWinVpsRightOffset ( m_confWinRight / TComSPS::getWinUnitX( repFormat->getChromaFormatVpsIdc() ) ); 1775 repFormat->setConfWinVpsTopOffset ( m_confWinTop / TComSPS::getWinUnitY( repFormat->getChromaFormatVpsIdc() ) ); 1776 repFormat->setConfWinVpsBottomOffset ( m_confWinBottom / TComSPS::getWinUnitY( repFormat->getChromaFormatVpsIdc() ) ); 1777 assert( vps.getRepFormat( 0 ) == NULL ); 1778 vps.setRepFormat( 0 , repFormat ); 1779 #endif 1957 1958 repFormat[j].setConformanceWindowVpsFlag( true ); 1959 repFormat[j].setConfWinVpsLeftOffset ( m_confWinLeft / TComSPS::getWinUnitX( repFormat[j].getChromaFormatVpsIdc() ) ); 1960 repFormat[j].setConfWinVpsRightOffset ( m_confWinRight / TComSPS::getWinUnitX( repFormat[j].getChromaFormatVpsIdc() ) ); 1961 repFormat[j].setConfWinVpsTopOffset ( m_confWinTop / TComSPS::getWinUnitY( repFormat[j].getChromaFormatVpsIdc() ) ); 1962 repFormat[j].setConfWinVpsBottomOffset ( m_confWinBottom / TComSPS::getWinUnitY( repFormat[j].getChromaFormatVpsIdc() ) ); 1963 } 1964 1965 vps.setRepFormat( repFormat ); 1966 1780 1967 } 1781 1968 … … 1784 1971 // These settings need to be verified 1785 1972 1786 TComDpbSize * dpbSize = vps.getDpbSize();1787 1788 assert ( dpbSize != 0 );1973 TComDpbSize dpbSize; 1974 dpbSize.init( vps.getNumOutputLayerSets(), vps.getVpsMaxLayerId() + 1, vps.getMaxSubLayersMinus1() + 1 ) ; 1975 1789 1976 1790 1977 for( Int i = 0; i < vps.getNumOutputLayerSets(); i++ ) … … 1801 1988 if ( vps.getNecessaryLayerFlag( i,k ) && ( vps.getVpsBaseLayerInternalFlag() || vps.getLayerSetLayerIdList( currLsIdx, k ) != 0 ) ) 1802 1989 { 1803 dpbSize ->setMaxVpsDecPicBufferingMinus1( i, k, j, m_maxDecPicBufferingMvc[ layerIdInVps ][ j ] - 1 );1990 dpbSize.setMaxVpsDecPicBufferingMinus1( i, k, j, m_maxDecPicBufferingMvc[ layerIdInVps ][ j ] - 1 ); 1804 1991 if ( j > 0 ) 1805 1992 { 1806 subLayerDpbInfoPresentFlag = subLayerDpbInfoPresentFlag || ( dpbSize ->getMaxVpsDecPicBufferingMinus1( i, k, j ) != dpbSize->getMaxVpsDecPicBufferingMinus1( i, k, j - 1 ) );1993 subLayerDpbInfoPresentFlag = subLayerDpbInfoPresentFlag || ( dpbSize.getMaxVpsDecPicBufferingMinus1( i, k, j ) != dpbSize.getMaxVpsDecPicBufferingMinus1( i, k, j - 1 ) ); 1807 1994 } 1808 1995 } … … 1811 1998 if (vps.getNecessaryLayerFlag(i,k) && j == 0 && k == 0 ) 1812 1999 { 1813 dpbSize ->setMaxVpsDecPicBufferingMinus1(i, k ,j, 0 );2000 dpbSize.setMaxVpsDecPicBufferingMinus1(i, k ,j, 0 ); 1814 2001 } 1815 2002 } … … 1827 2014 assert( maxNumReorderPics != MIN_INT ); 1828 2015 1829 dpbSize ->setMaxVpsNumReorderPics( i, j, maxNumReorderPics );2016 dpbSize.setMaxVpsNumReorderPics( i, j, maxNumReorderPics ); 1830 2017 if ( j > 0 ) 1831 2018 { 1832 subLayerDpbInfoPresentFlag = subLayerDpbInfoPresentFlag || ( dpbSize ->getMaxVpsNumReorderPics( i, j ) != dpbSize->getMaxVpsNumReorderPics( i, j - 1 ) );2019 subLayerDpbInfoPresentFlag = subLayerDpbInfoPresentFlag || ( dpbSize.getMaxVpsNumReorderPics( i, j ) != dpbSize.getMaxVpsNumReorderPics( i, j - 1 ) ); 1833 2020 } 1834 2021 1835 2022 // To Be Done ! 1836 // dpbSize ->setMaxVpsLatencyIncreasePlus1( i, j, xx );2023 // dpbSize.setMaxVpsLatencyIncreasePlus1( i, j, xx ); 1837 2024 if ( j > 0 ) 1838 2025 { 1839 subLayerDpbInfoPresentFlag = subLayerDpbInfoPresentFlag || ( dpbSize ->getMaxVpsLatencyIncreasePlus1( i, j ) != dpbSize->getMaxVpsLatencyIncreasePlus1( i, j - 1 ) );2026 subLayerDpbInfoPresentFlag = subLayerDpbInfoPresentFlag || ( dpbSize.getMaxVpsLatencyIncreasePlus1( i, j ) != dpbSize.getMaxVpsLatencyIncreasePlus1( i, j - 1 ) ); 1840 2027 } 1841 2028 1842 2029 if( j > 0 ) 1843 2030 { 1844 dpbSize ->setSubLayerDpbInfoPresentFlag( i, j, subLayerDpbInfoPresentFlag );2031 dpbSize.setSubLayerDpbInfoPresentFlag( i, j, subLayerDpbInfoPresentFlag ); 1845 2032 subLayerFlagInfoPresentFlag = subLayerFlagInfoPresentFlag || subLayerDpbInfoPresentFlag; 1846 2033 } 1847 2034 } 1848 dpbSize ->setSubLayerFlagInfoPresentFlag( i, subLayerFlagInfoPresentFlag );2035 dpbSize.setSubLayerFlagInfoPresentFlag( i, subLayerFlagInfoPresentFlag ); 1849 2036 } 2037 vps.setDpbSize( dpbSize ); 1850 2038 } 1851 2039 … … 2010 2198 vps.setVpsVuiPresentFlag( m_vpsVuiPresentFlag ); 2011 2199 2012 TComVPSVUI * pcVPSVUI = vps.getVPSVUI( );2013 assert( pcVPSVUI );2200 TComVPSVUI vpsVui; 2201 vpsVui.init(vps.getNumAddLayerSets(),vps.getMaxSubLayersMinus1() + 1, vps.getMaxLayersMinus1() + 1 ); 2014 2202 2015 2203 if ( m_vpsVuiPresentFlag ) … … 2018 2206 // however preliminary setting it from input parameters 2019 2207 2020 pcVPSVUI->setCrossLayerPicTypeAlignedFlag( m_crossLayerPicTypeAlignedFlag );2021 pcVPSVUI->setCrossLayerIrapAlignedFlag ( m_crossLayerIrapAlignedFlag );2022 pcVPSVUI->setAllLayersIdrAlignedFlag ( m_allLayersIdrAlignedFlag );2023 pcVPSVUI->setBitRatePresentVpsFlag( m_bitRatePresentVpsFlag );2024 pcVPSVUI->setPicRatePresentVpsFlag( m_picRatePresentVpsFlag );2025 2026 if( pcVPSVUI->getBitRatePresentVpsFlag( ) || pcVPSVUI->getPicRatePresentVpsFlag( ) )2208 vpsVui.setCrossLayerPicTypeAlignedFlag( m_crossLayerPicTypeAlignedFlag ); 2209 vpsVui.setCrossLayerIrapAlignedFlag ( m_crossLayerIrapAlignedFlag ); 2210 vpsVui.setAllLayersIdrAlignedFlag ( m_allLayersIdrAlignedFlag ); 2211 vpsVui.setBitRatePresentVpsFlag( m_bitRatePresentVpsFlag ); 2212 vpsVui.setPicRatePresentVpsFlag( m_picRatePresentVpsFlag ); 2213 2214 if( vpsVui.getBitRatePresentVpsFlag( ) || vpsVui.getPicRatePresentVpsFlag( ) ) 2027 2215 { 2028 2216 for( Int i = 0; i < vps.getNumLayerSets(); i++ ) … … 2030 2218 for( Int j = 0; j <= vps.getMaxTLayers(); j++ ) 2031 2219 { 2032 if( pcVPSVUI->getBitRatePresentVpsFlag( ) && m_bitRatePresentFlag[i].size() > j )2220 if( vpsVui.getBitRatePresentVpsFlag( ) && m_bitRatePresentFlag[i].size() > j ) 2033 2221 { 2034 pcVPSVUI->setBitRatePresentFlag( i, j, m_bitRatePresentFlag[i][j] );2222 vpsVui.setBitRatePresentFlag( i, j, m_bitRatePresentFlag[i][j] ); 2035 2223 } 2036 if( pcVPSVUI->getPicRatePresentVpsFlag( ) && m_picRatePresentFlag[i].size() > j )2224 if( vpsVui.getPicRatePresentVpsFlag( ) && m_picRatePresentFlag[i].size() > j ) 2037 2225 { 2038 pcVPSVUI->setPicRatePresentFlag( i, j, m_picRatePresentFlag[i][j] );2226 vpsVui.setPicRatePresentFlag( i, j, m_picRatePresentFlag[i][j] ); 2039 2227 } 2040 if( pcVPSVUI->getBitRatePresentFlag( i, j ) && m_avgBitRate[i].size() > j )2228 if( vpsVui.getBitRatePresentFlag( i, j ) && m_avgBitRate[i].size() > j ) 2041 2229 { 2042 pcVPSVUI->setAvgBitRate( i, j, m_avgBitRate[i][j] );2230 vpsVui.setAvgBitRate( i, j, m_avgBitRate[i][j] ); 2043 2231 } 2044 if( pcVPSVUI->getBitRatePresentFlag( i, j ) && m_maxBitRate[i].size() > j )2232 if( vpsVui.getBitRatePresentFlag( i, j ) && m_maxBitRate[i].size() > j ) 2045 2233 { 2046 pcVPSVUI->setMaxBitRate( i, j, m_maxBitRate[i][j] );2234 vpsVui.setMaxBitRate( i, j, m_maxBitRate[i][j] ); 2047 2235 } 2048 if( pcVPSVUI->getPicRatePresentFlag( i, j ) && m_constantPicRateIdc[i].size() > j )2236 if( vpsVui.getPicRatePresentFlag( i, j ) && m_constantPicRateIdc[i].size() > j ) 2049 2237 { 2050 pcVPSVUI->setConstantPicRateIdc( i, j, m_constantPicRateIdc[i][j] );2238 vpsVui.setConstantPicRateIdc( i, j, m_constantPicRateIdc[i][j] ); 2051 2239 } 2052 if( pcVPSVUI->getPicRatePresentFlag( i, j ) && m_avgPicRate[i].size() > j )2240 if( vpsVui.getPicRatePresentFlag( i, j ) && m_avgPicRate[i].size() > j ) 2053 2241 { 2054 pcVPSVUI->setAvgPicRate( i, j, m_avgPicRate[i][j] );2242 vpsVui.setAvgPicRate( i, j, m_avgPicRate[i][j] ); 2055 2243 } 2056 2244 } … … 2058 2246 } 2059 2247 2060 pcVPSVUI->setTilesNotInUseFlag( m_tilesNotInUseFlag );2061 2062 if( ! pcVPSVUI->getTilesNotInUseFlag() )2248 vpsVui.setTilesNotInUseFlag( m_tilesNotInUseFlag ); 2249 2250 if( !vpsVui.getTilesNotInUseFlag() ) 2063 2251 { 2064 2252 for( Int i = 0; i <= vps.getMaxLayersMinus1(); i++ ) 2065 2253 { 2066 pcVPSVUI->setTilesInUseFlag( i, m_tilesInUseFlag[ i ] );2067 if( pcVPSVUI->getTilesInUseFlag( i ) )2254 vpsVui.setTilesInUseFlag( i, m_tilesInUseFlag[ i ] ); 2255 if( vpsVui.getTilesInUseFlag( i ) ) 2068 2256 { 2069 pcVPSVUI->setLoopFilterNotAcrossTilesFlag( i, m_loopFilterNotAcrossTilesFlag[ i ] );2257 vpsVui.setLoopFilterNotAcrossTilesFlag( i, m_loopFilterNotAcrossTilesFlag[ i ] ); 2070 2258 } 2071 2259 } … … 2076 2264 { 2077 2265 Int layerIdx = vps.getLayerIdInVps( vps.getIdDirectRefLayer(vps.getLayerIdInNuh( i ) , j )); 2078 if( pcVPSVUI->getTilesInUseFlag( i ) && pcVPSVUI->getTilesInUseFlag( layerIdx ) )2266 if( vpsVui.getTilesInUseFlag( i ) && vpsVui.getTilesInUseFlag( layerIdx ) ) 2079 2267 { 2080 pcVPSVUI->setTileBoundariesAlignedFlag( i, j, m_tileBoundariesAlignedFlag[i][j] );2268 vpsVui.setTileBoundariesAlignedFlag( i, j, m_tileBoundariesAlignedFlag[i][j] ); 2081 2269 } 2082 2270 } … … 2084 2272 } 2085 2273 2086 pcVPSVUI->setWppNotInUseFlag( m_wppNotInUseFlag );2087 2088 if( ! pcVPSVUI->getWppNotInUseFlag( ) )2274 vpsVui.setWppNotInUseFlag( m_wppNotInUseFlag ); 2275 2276 if( !vpsVui.getWppNotInUseFlag( ) ) 2089 2277 { 2090 2278 for( Int i = 1; i <= vps.getMaxLayersMinus1(); i++ ) 2091 2279 { 2092 pcVPSVUI->setWppInUseFlag( i, m_wppInUseFlag[ i ]);2093 } 2094 } 2095 2096 pcVPSVUI->setSingleLayerForNonIrapFlag( m_singleLayerForNonIrapFlag );2097 pcVPSVUI->setHigherLayerIrapSkipFlag( m_higherLayerIrapSkipFlag );2098 2099 pcVPSVUI->setIlpRestrictedRefLayersFlag( m_ilpRestrictedRefLayersFlag );2100 2101 if( pcVPSVUI->getIlpRestrictedRefLayersFlag( ) )2280 vpsVui.setWppInUseFlag( i, m_wppInUseFlag[ i ]); 2281 } 2282 } 2283 2284 vpsVui.setSingleLayerForNonIrapFlag( m_singleLayerForNonIrapFlag ); 2285 vpsVui.setHigherLayerIrapSkipFlag( m_higherLayerIrapSkipFlag ); 2286 2287 vpsVui.setIlpRestrictedRefLayersFlag( m_ilpRestrictedRefLayersFlag ); 2288 2289 if( vpsVui.getIlpRestrictedRefLayersFlag( ) ) 2102 2290 { 2103 2291 for( Int i = 1; i <= vps.getMaxLayersMinus1(); i++ ) … … 2107 2295 if ( m_minSpatialSegmentOffsetPlus1[i].size() > j ) 2108 2296 { 2109 pcVPSVUI->setMinSpatialSegmentOffsetPlus1( i, j, m_minSpatialSegmentOffsetPlus1[i][j] );2297 vpsVui.setMinSpatialSegmentOffsetPlus1( i, j, m_minSpatialSegmentOffsetPlus1[i][j] ); 2110 2298 } 2111 if( pcVPSVUI->getMinSpatialSegmentOffsetPlus1( i, j ) > 0 )2299 if( vpsVui.getMinSpatialSegmentOffsetPlus1( i, j ) > 0 ) 2112 2300 { 2113 2301 if ( m_ctuBasedOffsetEnabledFlag[i].size() > j ) 2114 2302 { 2115 pcVPSVUI->setCtuBasedOffsetEnabledFlag( i, j, m_ctuBasedOffsetEnabledFlag[i][j] );2303 vpsVui.setCtuBasedOffsetEnabledFlag( i, j, m_ctuBasedOffsetEnabledFlag[i][j] ); 2116 2304 } 2117 if( pcVPSVUI->getCtuBasedOffsetEnabledFlag( i, j ) )2305 if( vpsVui.getCtuBasedOffsetEnabledFlag( i, j ) ) 2118 2306 { 2119 2307 if ( m_minHorizontalCtuOffsetPlus1[i].size() > j ) 2120 2308 { 2121 pcVPSVUI->setMinHorizontalCtuOffsetPlus1( i, j, m_minHorizontalCtuOffsetPlus1[i][j] );2309 vpsVui.setMinHorizontalCtuOffsetPlus1( i, j, m_minHorizontalCtuOffsetPlus1[i][j] ); 2122 2310 } 2123 2311 } … … 2126 2314 } 2127 2315 } 2128 pcVPSVUI->setVideoSignalInfoIdxPresentFlag( true ); 2129 pcVPSVUI->setVpsNumVideoSignalInfoMinus1 ( 0 ); 2130 2131 assert ( pcVPSVUI->getVideoSignalInfo( 0 ) == NULL ); 2132 2133 TComVideoSignalInfo* videoSignalInfo = new TComVideoSignalInfo; 2134 2135 videoSignalInfo->setColourPrimariesVps ( m_colourPrimaries ); 2136 videoSignalInfo->setMatrixCoeffsVps ( m_matrixCoefficients ); 2137 videoSignalInfo->setTransferCharacteristicsVps( m_transferCharacteristics ); 2138 videoSignalInfo->setVideoVpsFormat ( m_videoFormat ); 2139 videoSignalInfo->setVideoFullRangeVpsFlag ( m_videoFullRangeFlag ); 2140 2141 pcVPSVUI->setVideoSignalInfo( 0, videoSignalInfo ); 2316 vpsVui.setVideoSignalInfoIdxPresentFlag( true ); 2317 vpsVui.setVpsNumVideoSignalInfoMinus1 ( 0 ); 2318 2319 std::vector<TComVideoSignalInfo> videoSignalInfos; 2320 videoSignalInfos.resize( vpsVui.getVpsNumVideoSignalInfoMinus1() + 1 ); 2321 2322 videoSignalInfos[0].setColourPrimariesVps ( m_colourPrimaries ); 2323 videoSignalInfos[0].setMatrixCoeffsVps ( m_matrixCoefficients ); 2324 videoSignalInfos[0].setTransferCharacteristicsVps( m_transferCharacteristics ); 2325 videoSignalInfos[0].setVideoVpsFormat ( m_videoFormat ); 2326 videoSignalInfos[0].setVideoFullRangeVpsFlag ( m_videoFullRangeFlag ); 2327 2328 vpsVui.setVideoSignalInfo( videoSignalInfos ); 2142 2329 2143 2330 for (Int i = 0; i < m_numberOfLayers; i++) 2144 2331 { 2145 pcVPSVUI->setVpsVideoSignalInfoIdx( i, 0 );2146 } 2147 pcVPSVUI->setVpsVuiBspHrdPresentFlag( false ); // TBD2332 vpsVui.setVpsVideoSignalInfoIdx( i, 0 ); 2333 } 2334 vpsVui.setVpsVuiBspHrdPresentFlag( false ); // TBD 2148 2335 } 2149 2336 else 2150 2337 { 2151 pcVPSVUI->setCrossLayerIrapAlignedFlag ( false ); 2152 } 2153 } 2154 2155 #if H_3D 2338 //Default inference when not present. 2339 vpsVui.setCrossLayerIrapAlignedFlag ( false ); 2340 } 2341 vps.setVPSVUI( vpsVui ); 2342 } 2343 2344 #if NH_3D 2156 2345 Void TAppEncTop::xSetCamPara ( TComVPS& vps ) 2157 2346 { … … 2198 2387 2199 2388 2200 #if H_3D 2201 2202 Void TAppEncTop::xDeriveDltArray( TComVPS& vps, TComDLT& dlt ) 2389 #if NH_3D_DLT 2390 Void TAppEncTop::xDeriveDltArray( TComVPS& vps, TComDLT* dlt ) 2203 2391 { 2204 2392 Int iNumDepthViews = 0; … … 2214 2402 } 2215 2403 2216 dlt.setUseDLTFlag( layer , isDepth && m_useDLT ); 2217 if( dlt.getUseDLTFlag( layer ) ) 2218 { 2219 xAnalyzeInputBaseDepth(layer, max(m_iIntraPeriod[layer], 24), &vps, &dlt); 2220 bDltPresentFlag = bDltPresentFlag || dlt.getUseDLTFlag(layer); 2221 dlt.setInterViewDltPredEnableFlag(layer, (dlt.getUseDLTFlag(layer) && (layer>1))); 2222 } 2223 } 2224 2225 dlt.setDltPresentFlag( bDltPresentFlag ); 2226 dlt.setNumDepthViews ( iNumDepthViews ); 2404 dlt->setUseDLTFlag( layer , isDepth && m_useDLT ); 2405 if( dlt->getUseDLTFlag( layer ) ) 2406 { 2407 xAnalyzeInputBaseDepth(layer, max(m_iIntraPeriod[layer], 24), &vps, dlt); 2408 bDltPresentFlag = bDltPresentFlag || dlt->getUseDLTFlag(layer); 2409 dlt->setInterViewDltPredEnableFlag(layer, (dlt->getUseDLTFlag(layer) && (layer>1))); 2410 2411 // ----------------------------- determine whether to use bit-map ----------------------------- 2412 Bool bDltBitMapRepFlag = false; 2413 UInt uiNumBitsNonBitMap = 0; 2414 UInt uiNumBitsBitMap = 0; 2415 2416 UInt uiMaxDiff = 0; 2417 UInt uiMinDiff = MAX_INT; 2418 UInt uiLengthMinDiff = 0; 2419 UInt uiLengthDltDiffMinusMin = 0; 2420 2421 std::vector<Int> aiIdx2DepthValue_coded(256, 0); 2422 UInt uiNumDepthValues_coded = 0; 2423 2424 uiNumDepthValues_coded = dlt->getNumDepthValues(layer); 2425 for( UInt ui = 0; ui<uiNumDepthValues_coded; ui++ ) 2426 { 2427 aiIdx2DepthValue_coded[ui] = dlt->idx2DepthValue(layer, ui); 2428 } 2429 2430 if( dlt->getInterViewDltPredEnableFlag( layer ) ) 2431 { 2432 AOF( vps.getDepthId( 1 ) == 1 ); 2433 AOF( layer > 1 ); 2434 // assumes ref layer id to be 1 2435 std::vector<Int> piRefDLT = dlt->idx2DepthValue( 1 ); 2436 UInt uiRefNum = dlt->getNumDepthValues( 1 ); 2437 dlt->getDeltaDLT(layer, piRefDLT, uiRefNum, aiIdx2DepthValue_coded, uiNumDepthValues_coded); 2438 } 2439 2440 std::vector<UInt> puiDltDiffValues(uiNumDepthValues_coded, 0); 2441 2442 for (UInt d = 1; d < uiNumDepthValues_coded; d++) 2443 { 2444 puiDltDiffValues[d] = aiIdx2DepthValue_coded[d] - aiIdx2DepthValue_coded[d-1]; 2445 2446 if ( uiMaxDiff < puiDltDiffValues[d] ) 2447 { 2448 uiMaxDiff = puiDltDiffValues[d]; 2449 } 2450 2451 if ( uiMinDiff > puiDltDiffValues[d] ) 2452 { 2453 uiMinDiff = puiDltDiffValues[d]; 2454 } 2455 } 2456 2457 // counting bits 2458 // diff coding branch 2459 uiNumBitsNonBitMap += 8; // u(v) bits for num_depth_values_in_dlt[layerId] (i.e. num_entry[ layerId ]) 2460 2461 if ( uiNumDepthValues_coded > 1 ) 2462 { 2463 uiNumBitsNonBitMap += 8; // u(v) bits for max_diff[ layerId ] 2464 } 2465 2466 if ( uiNumDepthValues_coded > 2 ) 2467 { 2468 uiLengthMinDiff = (UInt) gCeilLog2(uiMaxDiff + 1); 2469 uiNumBitsNonBitMap += uiLengthMinDiff; // u(v) bits for min_diff[ layerId ] 2470 } 2471 2472 uiNumBitsNonBitMap += 8; // u(v) bits for dlt_depth_value0[ layerId ] 2473 2474 if (uiMaxDiff > uiMinDiff) 2475 { 2476 uiLengthDltDiffMinusMin = (UInt) gCeilLog2(uiMaxDiff - uiMinDiff + 1); 2477 uiNumBitsNonBitMap += uiLengthDltDiffMinusMin * (uiNumDepthValues_coded - 1); // u(v) bits for dlt_depth_value_diff_minus_min[ layerId ][ j ] 2478 } 2479 2480 // bit map branch 2481 uiNumBitsBitMap = 1 << m_inputBitDepth[CHANNEL_TYPE_LUMA]; 2482 2483 // determine bDltBitMapFlag 2484 bDltBitMapRepFlag = (uiNumBitsBitMap > uiNumBitsNonBitMap) ? false : true; 2485 2486 dlt->setUseBitmapRep(layer, bDltBitMapRepFlag); 2487 } 2488 } 2489 2490 dlt->setDltPresentFlag( bDltPresentFlag ); 2491 dlt->setNumDepthViews ( iNumDepthViews ); 2492 dlt->setDepthViewBitDepth( m_inputBitDepth[CHANNEL_TYPE_LUMA] ); 2227 2493 } 2228 2494 #endif
Note: See TracChangeset for help on using the changeset viewer.