Ticket #1217: HM12.1_transquant_bypass.patch
File HM12.1_transquant_bypass.patch, 31.3 KB (added by karlsharman, 10 years ago) |
---|
-
source/App/TAppEncoder/TAppEncCfg.cpp
392 392 ("PCMInputBitDepthFlag", m_bPCMInputBitDepthFlag, true) 393 393 ("PCMFilterDisableFlag", m_bPCMFilterDisableFlag, false) 394 394 395 ("LosslessCuEnabled", m_useLossless, false)396 397 395 ("WeightedPredP,-wpP", m_useWeightedPred, false, "Use weighted prediction in P slices") 398 396 ("WeightedPredB,-wpB", m_useWeightedBiPred, false, "Use weighted (bidirectional) prediction in B slices") 399 397 ("Log2ParallelMergeLevel", m_log2ParallelMergeLevel, 2u, "Parallel merge estimation region") … … 431 429 ( "RCForceIntraQP", m_RCForceIntraQP, false, "Rate control: force intra QP to be equal to initial QP" ) 432 430 433 431 ("TransquantBypassEnableFlag", m_TransquantBypassEnableFlag, false, "transquant_bypass_enable_flag indicator in PPS") 434 ("CUTransquantBypassFlag Value", m_CUTransquantBypassFlagValue, false, "Fixed cu_transquant_bypass_flag value, when transquant_bypass_enable_flag is enabled")432 ("CUTransquantBypassFlagForce", m_CUTransquantBypassFlagForce, false, "Force transquant bypass mode, when transquant_bypass_enable_flag is enabled") 435 433 ("RecalculateQPAccordingToLambda", m_recalculateQPAccordingToLambda, false, "Recalculate QP values according to lambda values. Do not suggest to be enabled in all intra case") 436 434 ("StrongIntraSmoothing,-sis", m_useStrongIntraSmoothing, true, "Enable strong intra smoothing for 32x32 blocks") 437 435 ("SEIActiveParameterSets", m_activeParameterSetsSEIEnabled, 0, "Enable generation of active parameter sets SEI messages") … … 1351 1349 xConfirmPara( m_uiDeltaQpRD > 0, "Rate control cannot be used together with slice level multiple-QP optimization!\n" ); 1352 1350 } 1353 1351 1354 xConfirmPara(!m_TransquantBypassEnableFlag && m_CUTransquantBypassFlag Value, "CUTransquantBypassFlagValue cannot be 1 when TransquantBypassEnableFlag is 0");1352 xConfirmPara(!m_TransquantBypassEnableFlag && m_CUTransquantBypassFlagForce, "CUTransquantBypassFlagForce cannot be 1 when TransquantBypassEnableFlag is 0"); 1355 1353 1356 1354 xConfirmPara(m_log2ParallelMergeLevel < 2, "Log2ParallelMergeLevel should be larger than or equal to 2"); 1357 1355 if (m_framePackingSEIEnabled) … … 1480 1478 #if !HM_CLEANUP_SAO 1481 1479 printf("SAOLcuBasedOptimization:%d ", (m_saoLcuBasedOptimization)?(1):(0)); 1482 1480 #endif 1483 printf("LosslessCuEnabled:%d ", (m_useLossless)? 1:0 ); 1481 if (m_TransquantBypassEnableFlag && m_CUTransquantBypassFlagForce) 1482 { 1483 printf("TransQuantBypassEnabled: =1 "); 1484 } 1485 else 1486 { 1487 printf("TransQuantBypassEnabled:%d ", (m_TransquantBypassEnableFlag)? 1:0 ); 1488 } 1484 1489 printf("WPP:%d ", (Int)m_useWeightedPred); 1485 1490 printf("WPB:%d ", (Int)m_useWeightedBiPred); 1486 1491 printf("PME:%d ", m_log2ParallelMergeLevel); -
source/App/TAppEncoder/TAppEncCfg.h
141 141 // coding tools (PCM bit-depth) 142 142 Bool m_bPCMInputBitDepthFlag; ///< 0: PCM bit-depth is internal bit-depth. 1: PCM bit-depth is input bit-depth. 143 143 144 // coding tool (lossless) 145 Bool m_useLossless; ///< flag for using lossless coding 144 // coding tool (SAO) 146 145 Bool m_bUseSAO; 147 146 Int m_maxNumOffsetsPerPic; ///< SAO maximun number of offset per picture 148 147 Bool m_saoLcuBoundary; ///< SAO parameter estimation using non-deblocked pixels for LCU bottom and right boundary areas … … 259 258 Char* m_scalingListFile; ///< quantization matrix file name 260 259 261 260 Bool m_TransquantBypassEnableFlag; ///< transquant_bypass_enable_flag setting in PPS. 262 Bool m_CUTransquantBypassFlag Value; ///< if transquant_bypass_enable_flag, the fixed value to use for the per-CU cu_transquant_bypass_flag.261 Bool m_CUTransquantBypassFlagForce; ///< if transquant_bypass_enable_flag, then, if true, all CU transquant bypass flags will be set to true. 263 262 264 263 Bool m_recalculateQPAccordingToLambda; ///< recalculate QP value according to the lambda value 265 264 Bool m_useStrongIntraSmoothing; ///< enable strong intra smoothing for 32x32 blocks where the reference samples are flat -
source/App/TAppEncoder/TAppEncTop.cpp
144 144 m_cTEncTop.setUseAdaptQpSelect ( m_bUseAdaptQpSelect ); 145 145 #endif 146 146 147 Int lowestQP;148 lowestQP = - 6*(g_bitDepthY - 8); // XXX: check149 150 if ((m_iMaxDeltaQP == 0 ) && (m_iQP == lowestQP) && (m_useLossless == true))151 {152 m_bUseAdaptiveQP = false;153 }154 147 m_cTEncTop.setUseAdaptiveQP ( m_bUseAdaptiveQP ); 155 148 m_cTEncTop.setQPAdaptationRange ( m_iQPAdaptationRange ); 156 149 … … 159 152 m_cTEncTop.setDeltaQpRD ( m_uiDeltaQpRD ); 160 153 m_cTEncTop.setUseASR ( m_bUseASR ); 161 154 m_cTEncTop.setUseHADME ( m_bUseHADME ); 162 m_cTEncTop.setUseLossless ( m_useLossless );163 155 m_cTEncTop.setdQPs ( m_aidQP ); 164 156 m_cTEncTop.setUseRDOQ ( m_useRDOQ ); 165 157 m_cTEncTop.setUseRDOQTS ( m_useRDOQTS ); … … 294 286 m_cTEncTop.setInitialQP ( m_RCInitialQP ); 295 287 m_cTEncTop.setForceIntraQP ( m_RCForceIntraQP ); 296 288 m_cTEncTop.setTransquantBypassEnableFlag(m_TransquantBypassEnableFlag); 297 m_cTEncTop.setCUTransquantBypassFlag Value(m_CUTransquantBypassFlagValue);289 m_cTEncTop.setCUTransquantBypassFlagForceValue(m_CUTransquantBypassFlagForce); 298 290 m_cTEncTop.setUseRecalculateQPAccordingToLambda( m_recalculateQPAccordingToLambda ); 299 291 m_cTEncTop.setUseStrongIntraSmoothing( m_useStrongIntraSmoothing ); 300 292 m_cTEncTop.setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled ); -
source/Lib/TLibCommon/TComDataCU.cpp
542 542 *- set qp value according to input qp 543 543 *- set last-coded qp value according to input last-coded qp 544 544 */ 545 Void TComDataCU::initEstData( UInt uiDepth, Int qp )545 Void TComDataCU::initEstData( UInt uiDepth, Int qp, Bool bTransquantBypass ) 546 546 { 547 547 m_dTotalCost = MAX_DOUBLE; 548 548 m_uiTotalDistortion = 0; … … 570 570 m_skipFlag[ui] = false; 571 571 m_pePartSize[ui] = SIZE_NONE; 572 572 m_pePredMode[ui] = MODE_NONE; 573 m_CUTransquantBypass[ui] = false;573 m_CUTransquantBypass[ui] = bTransquantBypass; 574 574 m_pbIPCMFlag[ui] = 0; 575 575 m_phQP[ui] = qp; 576 576 m_pbMergeFlag[ui] = 0; -
source/Lib/TLibCommon/TComDataCU.h
236 236 Void destroy (); 237 237 238 238 Void initCU ( TComPic* pcPic, UInt uiCUAddr ); 239 Void initEstData ( UInt uiDepth, Int qp );239 Void initEstData ( UInt uiDepth, Int qp, Bool bTransquantBypass ); 240 240 Void initSubCU ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp ); 241 241 Void setOutsideCUPart ( UInt uiAbsPartIdx, UInt uiDepth ); 242 242 -
source/Lib/TLibCommon/TComSlice.cpp
1402 1402 , m_bitDepthC ( 8) 1403 1403 , m_qpBDOffsetY ( 0) 1404 1404 , m_qpBDOffsetC ( 0) 1405 , m_useLossless (false)1406 1405 , m_uiPCMBitDepthLuma ( 8) 1407 1406 , m_uiPCMBitDepthChroma ( 8) 1408 1407 , m_bPCMFilterDisableFlag (false) -
source/Lib/TLibCommon/TComSlice.h
715 715 Int m_qpBDOffsetY; 716 716 Int m_qpBDOffsetC; 717 717 718 Bool m_useLossless;719 720 718 UInt m_uiPCMBitDepthLuma; 721 719 UInt m_uiPCMBitDepthChroma; 722 720 Bool m_bPCMFilterDisableFlag; … … 821 819 Void setMaxTrSize ( UInt u ) { m_uiMaxTrSize = u; } 822 820 UInt getMaxTrSize () { return m_uiMaxTrSize; } 823 821 824 // Tool list825 Bool getUseLossless () { return m_useLossless; }826 Void setUseLossless ( Bool b ) { m_useLossless = b; }827 828 822 // AMP accuracy 829 823 Int getAMPAcc ( UInt uiDepth ) { return m_iAMPAcc[uiDepth]; } 830 824 Void setAMPAcc ( UInt uiDepth, Int iAccu ) { assert( uiDepth < g_uiMaxCUDepth); m_iAMPAcc[uiDepth] = iAccu; } -
source/Lib/TLibEncoder/TEncCfg.h
158 158 #if !HM_CLEANUP_SAO 159 159 Bool m_saoLcuBasedOptimization; 160 160 #endif 161 //====== Lossless ========162 Bool m_useLossless;163 161 //====== Motion search ======== 164 162 Int m_iFastSearch; // 0:Full search 1:Diamond 2:PMVFAST 165 163 Int m_iSearchRange; // 0:Full frame … … 279 277 Int m_RCInitialQP; 280 278 Bool m_RCForceIntraQP; 281 279 Bool m_TransquantBypassEnableFlag; ///< transquant_bypass_enable_flag setting in PPS. 282 Bool m_CUTransquantBypassFlag Value; ///< if transquant_bypass_enable_flag, the fixed value to use for the per-CU cu_transquant_bypass_flag.283 TComVPS 280 Bool m_CUTransquantBypassFlagForce; ///< if transquant_bypass_enable_flag, then, if true, all CU transquant bypass flags will be set to true. 281 TComVPS m_cVPS; 284 282 Bool m_recalculateQPAccordingToLambda; ///< recalculate QP value according to the lambda value 285 283 Int m_activeParameterSetsSEIEnabled; ///< enable active parameter set SEI message 286 284 Bool m_vuiParametersPresentFlag; ///< enable generation of VUI parameters … … 396 394 Void setUseAdaptiveQP ( Bool b ) { m_bUseAdaptiveQP = b; } 397 395 Void setQPAdaptationRange ( Int i ) { m_iQPAdaptationRange = i; } 398 396 399 //====== Lossless ========400 Void setUseLossless (Bool b ) { m_useLossless = b; }401 397 //====== Sequence ======== 402 398 Int getFrameRate () { return m_iFrameRate; } 403 399 UInt getFrameSkip () { return m_FrameSkip; } … … 440 436 Int getMaxCuDQPDepth () { return m_iMaxCuDQPDepth; } 441 437 Bool getUseAdaptiveQP () { return m_bUseAdaptiveQP; } 442 438 Int getQPAdaptationRange () { return m_iQPAdaptationRange; } 443 //====== Lossless ========444 Bool getUseLossless () { return m_useLossless; }445 439 446 440 //==== Tool list ======== 447 441 Void setUseSBACRD ( Bool b ) { m_bUseSBACRD = b; } … … 666 660 Void setForceIntraQP ( Bool b ) { m_RCForceIntraQP = b; } 667 661 Bool getTransquantBypassEnableFlag() { return m_TransquantBypassEnableFlag; } 668 662 Void setTransquantBypassEnableFlag(Bool flag) { m_TransquantBypassEnableFlag = flag; } 669 Bool getCUTransquantBypassFlag Value() { return m_CUTransquantBypassFlagValue; }670 Void setCUTransquantBypassFlag Value(Bool flag) { m_CUTransquantBypassFlagValue = flag; }663 Bool getCUTransquantBypassFlagForceValue() { return m_CUTransquantBypassFlagForce; } 664 Void setCUTransquantBypassFlagForceValue(Bool flag) { m_CUTransquantBypassFlagForce = flag; } 671 665 Void setVPS(TComVPS *p) { m_cVPS = *p; } 672 666 TComVPS *getVPS() { return &m_cVPS; } 673 667 Void setUseRecalculateQPAccordingToLambda ( Bool b ) { m_recalculateQPAccordingToLambda = b; } -
source/Lib/TLibEncoder/TEncCu.cpp
375 375 Int iMinQP; 376 376 Int iMaxQP; 377 377 Bool isAddLowestQP = false; 378 Int lowestQP = -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY();379 378 380 379 if( (g_uiMaxCUWidth>>uiDepth) >= rpcTempCU->getSlice()->getPPS()->getMinCuDQPSize() ) 381 380 { 382 381 Int idQP = m_pcEncCfg->getMaxDeltaQP(); 383 382 iMinQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP-idQP ); 384 383 iMaxQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP+idQP ); 385 if ( (rpcTempCU->getSlice()->getSPS()->getUseLossless()) && (lowestQP < iMinQP) && rpcTempCU->getSlice()->getPPS()->getUseDQP() )386 {387 isAddLowestQP = true;388 iMinQP = iMinQP - 1;389 }390 384 } 391 385 else 392 386 { … … 400 394 iMaxQP = m_pcRateCtrl->getRCQP(); 401 395 } 402 396 397 // transquant-bypass (TQB) processing loop variable initialisation --- 398 399 const Int lowestQP = iMinQP; // For TQB, use this QP which is the lowest non TQB QP tested (rather than QP'=0) - that way delta QPs are smaller, and TQB can be tested at all CU levels. 400 401 if ( (rpcTempCU->getSlice()->getPPS()->getTransquantBypassEnableFlag()) ) 402 { 403 isAddLowestQP = true; // mark that the first iteration is to cost TQB mode. 404 iMinQP = iMinQP - 1; // increase loop variable range by 1, to allow testing of TQB mode along with other QPs 405 if ( m_pcEncCfg->getCUTransquantBypassFlagForceValue() ) 406 { 407 iMaxQP = iMinQP; 408 } 409 } 410 403 411 // If slice start or slice end is within this cu... 404 412 TComSlice * pcSlice = rpcTempCU->getPic()->getSlice(rpcTempCU->getPic()->getCurrSliceIdx()); 405 413 Bool bSliceStart = pcSlice->getSliceSegmentCurStartCUAddr()>rpcTempCU->getSCUAddr()&&pcSlice->getSliceSegmentCurStartCUAddr()<rpcTempCU->getSCUAddr()+rpcTempCU->getTotalNumPart(); … … 410 418 { 411 419 for (Int iQP=iMinQP; iQP<=iMaxQP; iQP++) 412 420 { 413 if (isAddLowestQP && (iQP == iMinQP)) 421 const Bool bIsLosslessMode = isAddLowestQP && (iQP == iMinQP); 422 423 if (bIsLosslessMode) 414 424 { 415 425 iQP = lowestQP; 416 426 } 417 427 418 rpcTempCU->initEstData( uiDepth, iQP );428 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 419 429 420 430 // do inter modes, SKIP and 2Nx2N 421 431 if( rpcBestCU->getSlice()->getSliceType() != I_SLICE ) … … 423 433 // 2Nx2N 424 434 if(m_pcEncCfg->getUseEarlySkipDetection()) 425 435 { 426 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N ); rpcTempCU->initEstData( uiDepth, iQP );//by Competition for inter_2Nx2N 436 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N ); 437 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );//by Competition for inter_2Nx2N 427 438 } 428 439 // SKIP 429 440 xCheckRDCostMerge2Nx2N( rpcBestCU, rpcTempCU, &earlyDetectionSkipMode );//by Merge for inter_2Nx2N 430 rpcTempCU->initEstData( uiDepth, iQP );441 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 431 442 432 443 if(!m_pcEncCfg->getUseEarlySkipDetection()) 433 444 { 434 445 // 2Nx2N, NxN 435 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N ); rpcTempCU->initEstData( uiDepth, iQP ); 446 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N ); 447 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 436 448 if(m_pcEncCfg->getUseCbfFastMode()) 437 449 { 438 450 doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0; … … 440 452 } 441 453 } 442 454 443 if ( isAddLowestQP && (iQP == lowestQP))455 if (bIsLosslessMode) 444 456 { 445 457 iQP = iMinQP; 446 458 } … … 450 462 { 451 463 for (Int iQP=iMinQP; iQP<=iMaxQP; iQP++) 452 464 { 453 if (isAddLowestQP && (iQP == iMinQP)) 465 const Bool bIsLosslessMode = isAddLowestQP && (iQP == iMinQP); 466 467 if (bIsLosslessMode) 454 468 { 455 469 iQP = lowestQP; 456 470 } 457 rpcTempCU->initEstData( uiDepth, iQP );471 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 458 472 459 473 // do inter modes, NxN, 2NxN, and Nx2N 460 474 if( rpcBestCU->getSlice()->getSliceType() != I_SLICE ) … … 465 479 if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth && doNotBlockPu) 466 480 { 467 481 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_NxN ); 468 rpcTempCU->initEstData( uiDepth, iQP );482 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 469 483 } 470 484 } 471 485 … … 473 487 if(doNotBlockPu) 474 488 { 475 489 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_Nx2N ); 476 rpcTempCU->initEstData( uiDepth, iQP );490 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 477 491 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_Nx2N ) 478 492 { 479 493 doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0; … … 482 496 if(doNotBlockPu) 483 497 { 484 498 xCheckRDCostInter ( rpcBestCU, rpcTempCU, SIZE_2NxN ); 485 rpcTempCU->initEstData( uiDepth, iQP );499 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 486 500 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxN) 487 501 { 488 502 doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0; … … 510 524 if(doNotBlockPu) 511 525 { 512 526 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU ); 513 rpcTempCU->initEstData( uiDepth, iQP );527 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 514 528 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnU ) 515 529 { 516 530 doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0; … … 519 533 if(doNotBlockPu) 520 534 { 521 535 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD ); 522 rpcTempCU->initEstData( uiDepth, iQP );536 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 523 537 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnD ) 524 538 { 525 539 doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0; … … 532 546 if(doNotBlockPu) 533 547 { 534 548 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU, true ); 535 rpcTempCU->initEstData( uiDepth, iQP );549 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 536 550 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnU ) 537 551 { 538 552 doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0; … … 541 555 if(doNotBlockPu) 542 556 { 543 557 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD, true ); 544 rpcTempCU->initEstData( uiDepth, iQP );558 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 545 559 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnD ) 546 560 { 547 561 doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0; … … 556 570 if(doNotBlockPu) 557 571 { 558 572 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N ); 559 rpcTempCU->initEstData( uiDepth, iQP );573 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 560 574 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_nLx2N ) 561 575 { 562 576 doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0; … … 565 579 if(doNotBlockPu) 566 580 { 567 581 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N ); 568 rpcTempCU->initEstData( uiDepth, iQP );582 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 569 583 } 570 584 } 571 585 #if AMP_MRG … … 574 588 if(doNotBlockPu) 575 589 { 576 590 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N, true ); 577 rpcTempCU->initEstData( uiDepth, iQP );591 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 578 592 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_nLx2N ) 579 593 { 580 594 doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0; … … 583 597 if(doNotBlockPu) 584 598 { 585 599 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N, true ); 586 rpcTempCU->initEstData( uiDepth, iQP );600 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 587 601 } 588 602 } 589 603 #endif 590 604 591 605 #else 592 606 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU ); 593 rpcTempCU->initEstData( uiDepth, iQP );607 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 594 608 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD ); 595 rpcTempCU->initEstData( uiDepth, iQP );609 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 596 610 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N ); 597 rpcTempCU->initEstData( uiDepth, iQP );611 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 598 612 599 613 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N ); 600 rpcTempCU->initEstData( uiDepth, iQP );614 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 601 615 602 616 #endif 603 617 } … … 612 626 rpcBestCU->getCbf( 0, TEXT_CHROMA_V ) != 0 ) // avoid very complex intra if it is unlikely 613 627 { 614 628 xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_2Nx2N ); 615 rpcTempCU->initEstData( uiDepth, iQP );629 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 616 630 if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth ) 617 631 { 618 632 if( rpcTempCU->getWidth(0) > ( 1 << rpcTempCU->getSlice()->getSPS()->getQuadtreeTULog2MinSize() ) ) 619 633 { 620 634 xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_NxN ); 621 rpcTempCU->initEstData( uiDepth, iQP );635 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 622 636 } 623 637 } 624 638 } … … 633 647 if((uiBestBits > uiRawBits) || (rpcBestCU->getTotalCost() > m_pcRdCost->calcRdCost(uiRawBits, 0))) 634 648 { 635 649 xCheckIntraPCM (rpcBestCU, rpcTempCU); 636 rpcTempCU->initEstData( uiDepth, iQP );650 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 637 651 } 638 652 } 639 if ( isAddLowestQP && (iQP == lowestQP))653 if (bIsLosslessMode) 640 654 { 641 655 iQP = iMinQP; 642 656 } … … 677 691 Int idQP = m_pcEncCfg->getMaxDeltaQP(); 678 692 iMinQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP-idQP ); 679 693 iMaxQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP+idQP ); 680 if ( (rpcTempCU->getSlice()->getSPS()->getUseLossless()) && (lowestQP < iMinQP) && rpcTempCU->getSlice()->getPPS()->getUseDQP() )681 {682 isAddLowestQP = true;683 iMinQP = iMinQP - 1;684 }685 694 } 686 695 else if( (g_uiMaxCUWidth>>uiDepth) > rpcTempCU->getSlice()->getPPS()->getMinCuDQPSize() ) 687 696 { … … 708 717 iMinQP = m_pcRateCtrl->getRCQP(); 709 718 iMaxQP = m_pcRateCtrl->getRCQP(); 710 719 } 720 721 if ( m_pcEncCfg->getCUTransquantBypassFlagForceValue() ) 722 { 723 iMaxQP = iMinQP; // If all blocks are forced into using transquant bypass, do not loop here. 724 } 725 711 726 for (Int iQP=iMinQP; iQP<=iMaxQP; iQP++) 712 727 { 713 if (isAddLowestQP && (iQP == iMinQP)) 714 { 715 iQP = lowestQP; 716 } 717 rpcTempCU->initEstData( uiDepth, iQP ); 728 const Bool bIsLosslessMode = false; // False at this level. Next level down may set it to true. 729 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 718 730 719 731 // further split 720 732 if( bSubBranch && uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth ) … … 838 850 } 839 851 xCheckBestMode( rpcBestCU, rpcTempCU, uiDepth); // RD compare current larger prediction 840 852 } // with sub partitioned prediction. 841 if (isAddLowestQP && (iQP == lowestQP))842 {843 iQP = iMinQP;844 }845 853 } 846 854 847 855 rpcBestCU->copyToPic(uiDepth); // Copy Best data to Picture for next partition prediction. … … 1201 1209 TComMvField cMvFieldNeighbours[ 2 * MRG_MAX_NUM_CANDS ]; // double length for mv of both lists 1202 1210 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; 1203 1211 Int numValidMergeCand = 0; 1212 const Bool bTransquantBypassFlag = rpcTempCU->getCUTransquantBypass(0); 1204 1213 1205 1214 for( UInt ui = 0; ui < rpcTempCU->getSlice()->getMaxNumMergeCand(); ++ui ) 1206 1215 { … … 1208 1217 } 1209 1218 UChar uhDepth = rpcTempCU->getDepth( 0 ); 1210 1219 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level 1211 rpcTempCU->setCUTransquantBypassSubParts( m_pcEncCfg->getCUTransquantBypassFlagValue(), 0, uhDepth );1212 1220 rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand ); 1213 1221 1214 1222 Int mergeCandBuffer[MRG_MAX_NUM_CANDS]; … … 1239 1247 { 1240 1248 // set MC parameters 1241 1249 rpcTempCU->setPredModeSubParts( MODE_INTER, 0, uhDepth ); // interprets depth relative to LCU level 1242 rpcTempCU->setCUTransquantBypassSubParts( m_pcEncCfg->getCUTransquantBypassFlagValue(), 0, uhDepth );1250 rpcTempCU->setCUTransquantBypassSubParts( bTransquantBypassFlag, 0, uhDepth ); 1243 1251 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level 1244 1252 rpcTempCU->setMergeFlagSubParts( true, 0, 0, uhDepth ); // interprets depth relative to LCU level 1245 1253 rpcTempCU->setMergeIndexSubParts( uiMergeCand, 0, 0, uhDepth ); // interprets depth relative to LCU level … … 1269 1277 Int orgQP = rpcTempCU->getQP( 0 ); 1270 1278 xCheckDQP( rpcTempCU ); 1271 1279 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth); 1272 rpcTempCU->initEstData( uhDepth, orgQP );1280 rpcTempCU->initEstData( uhDepth, orgQP, bTransquantBypassFlag ); 1273 1281 1274 1282 if( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip ) 1275 1283 { … … 1326 1334 1327 1335 rpcTempCU->setPartSizeSubParts ( ePartSize, 0, uhDepth ); 1328 1336 rpcTempCU->setPredModeSubParts ( MODE_INTER, 0, uhDepth ); 1329 rpcTempCU->setCUTransquantBypassSubParts ( m_pcEncCfg->getCUTransquantBypassFlagValue(), 0, uhDepth );1330 1337 1331 1338 #if AMP_MRG 1332 1339 rpcTempCU->setMergeAMP (true); … … 1357 1364 1358 1365 rpcTempCU->setPartSizeSubParts( eSize, 0, uiDepth ); 1359 1366 rpcTempCU->setPredModeSubParts( MODE_INTRA, 0, uiDepth ); 1360 rpcTempCU->setCUTransquantBypassSubParts( m_pcEncCfg->getCUTransquantBypassFlagValue(), 0, uiDepth );1361 1367 1362 1368 Bool bSeparateLumaChroma = true; // choose estimation mode 1363 1369 UInt uiPreCalcDistC = 0; … … 1418 1424 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); 1419 1425 rpcTempCU->setPredModeSubParts( MODE_INTRA, 0, uiDepth ); 1420 1426 rpcTempCU->setTrIdxSubParts ( 0, 0, uiDepth ); 1421 rpcTempCU->setCUTransquantBypassSubParts( m_pcEncCfg->getCUTransquantBypassFlagValue(), 0, uiDepth );1422 1427 1423 1428 m_pcPredSearch->IPCMSearch( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth]); 1424 1429 -
source/Lib/TLibEncoder/TEncSearch.cpp
1420 1420 Int bestModeIdUV[2] = {0, 0}; 1421 1421 checkTransformSkip &= (widthTransformSkip == 4 && heightTransformSkip == 4); 1422 1422 checkTransformSkip &= (!pcCU->getCUTransquantBypass(0)); 1423 checkTransformSkip &= (!((pcCU->getQP( 0 ) == 0) && (pcCU->getSlice()->getSPS()->getUseLossless())));1424 1423 if ( m_pcEncCfg->getUseTransformSkipFast() ) 1425 1424 { 1426 1425 checkTransformSkip &= (pcCU->getPartitionSize(uiAbsPartIdx)==SIZE_NxN); -
source/Lib/TLibEncoder/TEncSlice.cpp
247 247 dQP = m_pcCfg->getQP(); 248 248 if(eSliceType!=I_SLICE) 249 249 { 250 if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getSPS()->getQpBDOffsetY() ) && (rpcSlice->get SPS()->getUseLossless())))250 if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getSPS()->getQpBDOffsetY() ) && (rpcSlice->getPPS()->getTransquantBypassEnableFlag()))) 251 251 { 252 252 dQP += m_pcCfg->getGOPEntry(iGOPid).m_QPOffset; 253 253 } … … 367 367 if (m_pcCfg->getUseRecalculateQPAccordingToLambda()) 368 368 { 369 369 dQP = xGetQPValueAccordingToLambda( dLambda ); 370 iQP = max( -pSPS->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); 370 iQP = max( -pSPS->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) ); 371 371 } 372 372 373 373 rpcSlice->setSliceQp ( iQP ); -
source/Lib/TLibEncoder/TEncTop.cpp
659 659 m_cSPS.setQuadtreeTUMaxDepthIntra( m_uiQuadtreeTUMaxDepthIntra ); 660 660 661 661 m_cSPS.setTMVPFlagsPresent(false); 662 m_cSPS.setUseLossless ( m_useLossless );663 662 664 663 m_cSPS.setMaxTrSize ( 1 << m_uiQuadtreeTULog2MaxSize ); 665 664 … … 744 743 m_cPPS.setConstrainedIntraPred( m_bUseConstrainedIntraPred ); 745 744 Bool bUseDQP = (getMaxCuDQPDepth() > 0)? true : false; 746 745 747 Int lowestQP = - m_cSPS.getQpBDOffsetY(); 748 749 if(getUseLossless()) 746 if((getMaxDeltaQP() != 0 )|| getUseAdaptiveQP()) 750 747 { 751 if ((getMaxCuDQPDepth() == 0) && (getMaxDeltaQP() == 0 ) && (getQP() == lowestQP) ) 752 { 753 bUseDQP = false; 754 } 755 else 756 { 757 bUseDQP = true; 758 } 748 bUseDQP = true; 759 749 } 760 else761 {762 if(bUseDQP == false)763 {764 if((getMaxDeltaQP() != 0 )|| getUseAdaptiveQP())765 {766 bUseDQP = true;767 }768 }769 }770 750 771 751 if(bUseDQP) 772 752 {