Changeset 595 in SHVCSoftware for trunk/source/Lib/TLibEncoder/TEncCu.cpp
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/SHM-5.0-dev merged: 591,593-594
- Property svn:mergeinfo changed
-
trunk/source
- Property svn:mergeinfo changed
/branches/SHM-5.0-dev/source merged: 593
- Property svn:mergeinfo changed
-
trunk/source/Lib/TLibEncoder/TEncCu.cpp
r588 r595 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 3, ITU/ISO/IEC6 * Copyright (c) 2010-2014, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 223 223 m_pcRDGoOnSbacCoder = pcEncTop->getRDGoOnSbacCoder(); 224 224 225 m_bUseSBACRD = pcEncTop->getUseSBACRD();226 225 m_pcRateCtrl = pcEncTop->getRateCtrl(); 227 226 } … … 394 393 Int iMaxQP; 395 394 Bool isAddLowestQP = false; 396 #if REPN_FORMAT_IN_VPS397 Int lowestQP = -rpcTempCU->getSlice()->getQpBDOffsetY();398 #else399 Int lowestQP = -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY();400 #endif401 395 402 396 if( (g_uiMaxCUWidth>>uiDepth) >= rpcTempCU->getSlice()->getPPS()->getMinCuDQPSize() ) … … 409 403 iMinQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP-idQP ); 410 404 iMaxQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP+idQP ); 411 #endif 412 if ( (rpcTempCU->getSlice()->getSPS()->getUseLossless()) && (lowestQP < iMinQP) && rpcTempCU->getSlice()->getPPS()->getUseDQP() ) 413 { 414 isAddLowestQP = true; 415 iMinQP = iMinQP - 1; 416 } 405 #endif 417 406 } 418 407 else … … 426 415 iMinQP = m_pcRateCtrl->getRCQP(); 427 416 iMaxQP = m_pcRateCtrl->getRCQP(); 417 } 418 419 // transquant-bypass (TQB) processing loop variable initialisation --- 420 421 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. 422 423 if ( (rpcTempCU->getSlice()->getPPS()->getTransquantBypassEnableFlag()) ) 424 { 425 isAddLowestQP = true; // mark that the first iteration is to cost TQB mode. 426 iMinQP = iMinQP - 1; // increase loop variable range by 1, to allow testing of TQB mode along with other QPs 427 if ( m_pcEncCfg->getCUTransquantBypassFlagForceValue() ) 428 { 429 iMaxQP = iMinQP; 430 } 428 431 } 429 432 … … 443 446 if (m_pcEncCfg->getSkipPictureAtArcSwitch() && m_pcEncCfg->getAdaptiveResolutionChange() > 0 && pcSlice->getLayerId() == 1 && pcSlice->getPOC() == m_pcEncCfg->getAdaptiveResolutionChange()) 444 447 { 445 rpcTempCU->initEstData( uiDepth, iBaseQP ); 448 Int iQP = iBaseQP; 449 const Bool bIsLosslessMode = isAddLowestQP && (iQP == iMinQP); 450 451 if( bIsLosslessMode ) 452 { 453 iQP = lowestQP; 454 } 455 456 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 446 457 447 458 xCheckRDCostMerge2Nx2N( rpcBestCU, rpcTempCU, &earlyDetectionSkipMode, true ); … … 466 477 for (Int iQP=iMinQP; iQP<=iMaxQP; iQP++) 467 478 { 468 if (isAddLowestQP && (iQP == iMinQP)) 479 const Bool bIsLosslessMode = isAddLowestQP && (iQP == iMinQP); 480 481 if (bIsLosslessMode) 469 482 { 470 483 iQP = lowestQP; 471 484 } 472 485 473 rpcTempCU->initEstData( uiDepth, iQP );486 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 474 487 475 488 // do inter modes, SKIP and 2Nx2N … … 483 496 if(m_pcEncCfg->getUseEarlySkipDetection()) 484 497 { 485 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N ); rpcTempCU->initEstData( uiDepth, iQP );//by Competition for inter_2Nx2N 498 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N ); 499 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );//by Competition for inter_2Nx2N 486 500 } 487 501 // SKIP 488 502 xCheckRDCostMerge2Nx2N( rpcBestCU, rpcTempCU, &earlyDetectionSkipMode );//by Merge for inter_2Nx2N 489 rpcTempCU->initEstData( uiDepth, iQP );503 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 490 504 491 505 #if (ENCODER_FAST_MODE == 2) … … 496 510 { 497 511 // 2Nx2N, NxN 498 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N ); rpcTempCU->initEstData( uiDepth, iQP ); 512 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N ); 513 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 499 514 if(m_pcEncCfg->getUseCbfFastMode()) 500 515 { … … 507 522 } 508 523 509 if ( isAddLowestQP && (iQP == lowestQP))524 if (bIsLosslessMode) 510 525 { 511 526 iQP = iMinQP; … … 517 532 for (Int iQP=iMinQP; iQP<=iMaxQP; iQP++) 518 533 { 519 if (isAddLowestQP && (iQP == iMinQP)) 534 const Bool bIsLosslessMode = isAddLowestQP && (iQP == iMinQP); 535 536 if (bIsLosslessMode) 520 537 { 521 538 iQP = lowestQP; 522 539 } 523 rpcTempCU->initEstData( uiDepth, iQP );540 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 524 541 525 542 // do inter modes, NxN, 2NxN, and Nx2N … … 536 553 { 537 554 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_NxN ); 538 rpcTempCU->initEstData( uiDepth, iQP );555 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 539 556 } 540 557 } … … 544 561 { 545 562 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_Nx2N ); 546 rpcTempCU->initEstData( uiDepth, iQP );563 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 547 564 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_Nx2N ) 548 565 { … … 553 570 { 554 571 xCheckRDCostInter ( rpcBestCU, rpcTempCU, SIZE_2NxN ); 555 rpcTempCU->initEstData( uiDepth, iQP );572 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 556 573 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxN) 557 574 { … … 581 598 { 582 599 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU ); 583 rpcTempCU->initEstData( uiDepth, iQP );600 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 584 601 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnU ) 585 602 { … … 590 607 { 591 608 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD ); 592 rpcTempCU->initEstData( uiDepth, iQP );609 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 593 610 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnD ) 594 611 { … … 603 620 { 604 621 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU, true ); 605 rpcTempCU->initEstData( uiDepth, iQP );622 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 606 623 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnU ) 607 624 { … … 612 629 { 613 630 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD, true ); 614 rpcTempCU->initEstData( uiDepth, iQP );631 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 615 632 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnD ) 616 633 { … … 627 644 { 628 645 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N ); 629 rpcTempCU->initEstData( uiDepth, iQP );646 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 630 647 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_nLx2N ) 631 648 { … … 636 653 { 637 654 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N ); 638 rpcTempCU->initEstData( uiDepth, iQP );655 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 639 656 } 640 657 } … … 645 662 { 646 663 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N, true ); 647 rpcTempCU->initEstData( uiDepth, iQP );664 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 648 665 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_nLx2N ) 649 666 { … … 654 671 { 655 672 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N, true ); 656 rpcTempCU->initEstData( uiDepth, iQP );673 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 657 674 } 658 675 } … … 661 678 #else 662 679 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU ); 663 rpcTempCU->initEstData( uiDepth, iQP );680 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 664 681 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD ); 665 rpcTempCU->initEstData( uiDepth, iQP );682 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 666 683 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N ); 667 rpcTempCU->initEstData( uiDepth, iQP );684 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 668 685 669 686 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N ); 670 rpcTempCU->initEstData( uiDepth, iQP );687 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 671 688 672 689 #endif … … 691 708 { 692 709 xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_2Nx2N ); 693 rpcTempCU->initEstData( uiDepth, iQP);710 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 694 711 if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth ) 695 712 { … … 697 714 { 698 715 xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_NxN ); 699 rpcTempCU->initEstData( uiDepth, iQP);716 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 700 717 } 701 718 } … … 712 729 { 713 730 xCheckIntraPCM (rpcBestCU, rpcTempCU); 714 rpcTempCU->initEstData( uiDepth, iQP );731 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 715 732 } 716 733 } … … 725 742 { 726 743 xCheckRDCostILRUni( rpcBestCU, rpcTempCU, pcSlice->getInterLayerPredLayerIdc(refLayer)); 727 rpcTempCU->initEstData( uiDepth, iQP );744 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 728 745 } 729 746 } 730 747 #endif 731 748 732 if ( isAddLowestQP && (iQP == lowestQP))749 if (bIsLosslessMode) 733 750 { 734 751 iQP = iMinQP; … … 740 757 m_pcEntropyCoder->encodeSplitFlag( rpcBestCU, 0, uiDepth, true ); 741 758 rpcBestCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // split bits 742 if(m_pcEncCfg->getUseSBACRD())743 {744 759 rpcBestCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 745 }746 760 rpcBestCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcBestCU->getTotalBits(), rpcBestCU->getTotalDistortion() ); 747 761 … … 778 792 iMinQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP-idQP ); 779 793 iMaxQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP+idQP ); 780 #endif 781 if ( (rpcTempCU->getSlice()->getSPS()->getUseLossless()) && (lowestQP < iMinQP) && rpcTempCU->getSlice()->getPPS()->getUseDQP() ) 782 { 783 isAddLowestQP = true; 784 iMinQP = iMinQP - 1; 785 } 794 #endif 786 795 } 787 796 else if( (g_uiMaxCUWidth>>uiDepth) > rpcTempCU->getSlice()->getPPS()->getMinCuDQPSize() ) … … 810 819 iMaxQP = m_pcRateCtrl->getRCQP(); 811 820 } 821 822 if ( m_pcEncCfg->getCUTransquantBypassFlagForceValue() ) 823 { 824 iMaxQP = iMinQP; // If all blocks are forced into using transquant bypass, do not loop here. 825 } 826 812 827 for (Int iQP=iMinQP; iQP<=iMaxQP; iQP++) 813 828 { 814 if (isAddLowestQP && (iQP == iMinQP)) 815 { 816 iQP = lowestQP; 817 } 818 rpcTempCU->initEstData( uiDepth, iQP ); 829 const Bool bIsLosslessMode = false; // False at this level. Next level down may set it to true. 830 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 819 831 820 832 // further split … … 837 849 #endif 838 850 { 839 if ( m_bUseSBACRD )851 if ( 0 == uiPartUnitIdx) //initialize RD with previous depth buffer 840 852 { 841 if ( 0 == uiPartUnitIdx) //initialize RD with previous depth buffer 842 { 843 m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]); 844 } 845 else 846 { 847 m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]); 848 } 853 m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]); 854 } 855 else 856 { 857 m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]); 849 858 } 850 859 … … 878 887 879 888 rpcTempCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // split bits 880 if(m_pcEncCfg->getUseSBACRD()) 881 { 882 rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 883 } 889 rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 884 890 } 885 891 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); … … 913 919 m_pcEntropyCoder->encodeQP( rpcTempCU, uiTargetPartIdx, false ); 914 920 rpcTempCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // dQP bits 915 if(m_pcEncCfg->getUseSBACRD()) 916 { 917 rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 918 } 921 rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 919 922 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 920 923 #endif … … 930 933 } 931 934 932 if( m_bUseSBACRD ) 933 { 934 m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]); 935 } 935 m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]); 936 936 937 Bool isEndOfSlice = rpcBestCU->getSlice()->getSliceMode()==FIXED_NUMBER_OF_BYTES 937 938 && (rpcBestCU->getTotalBits()>rpcBestCU->getSlice()->getSliceArgument()<<3); … … 944 945 xCheckBestMode( rpcBestCU, rpcTempCU, uiDepth); // RD compare current larger prediction 945 946 } // with sub partitioned prediction. 946 if (isAddLowestQP && (iQP == lowestQP))947 {948 iQP = iMinQP;949 }950 947 } 951 948 … … 1334 1331 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; 1335 1332 Int numValidMergeCand = 0; 1333 const Bool bTransquantBypassFlag = rpcTempCU->getCUTransquantBypass(0); 1336 1334 1337 1335 for( UInt ui = 0; ui < rpcTempCU->getSlice()->getMaxNumMergeCand(); ++ui ) … … 1341 1339 UChar uhDepth = rpcTempCU->getDepth( 0 ); 1342 1340 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level 1343 rpcTempCU->setCUTransquantBypassSubParts( m_pcEncCfg->getCUTransquantBypassFlagValue(), 0, uhDepth );1344 1341 rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand ); 1345 1342 … … 1385 1382 // set MC parameters 1386 1383 rpcTempCU->setPredModeSubParts( MODE_INTER, 0, uhDepth ); // interprets depth relative to LCU level 1387 rpcTempCU->setCUTransquantBypassSubParts( m_pcEncCfg->getCUTransquantBypassFlagValue(), 0, uhDepth );1384 rpcTempCU->setCUTransquantBypassSubParts( bTransquantBypassFlag, 0, uhDepth ); 1388 1385 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level 1389 1386 rpcTempCU->setMergeFlagSubParts( true, 0, 0, uhDepth ); // interprets depth relative to LCU level … … 1415 1412 xCheckDQP( rpcTempCU ); 1416 1413 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth); 1417 rpcTempCU->initEstData( uhDepth, orgQP );1414 rpcTempCU->initEstData( uhDepth, orgQP, bTransquantBypassFlag ); 1418 1415 1419 1416 if( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip ) … … 1478 1475 rpcTempCU->setPartSizeSubParts ( ePartSize, 0, uhDepth ); 1479 1476 rpcTempCU->setPredModeSubParts ( MODE_INTER, 0, uhDepth ); 1480 rpcTempCU->setCUTransquantBypassSubParts ( m_pcEncCfg->getCUTransquantBypassFlagValue(), 0, uhDepth );1481 1477 1482 1478 #if AMP_MRG … … 1509 1505 rpcTempCU->setPartSizeSubParts( eSize, 0, uiDepth ); 1510 1506 rpcTempCU->setPredModeSubParts( MODE_INTRA, 0, uiDepth ); 1511 rpcTempCU->setCUTransquantBypassSubParts( m_pcEncCfg->getCUTransquantBypassFlagValue(), 0, uiDepth );1512 1507 1513 1508 Bool bSeparateLumaChroma = true; // choose estimation mode … … 1539 1534 setdQPFlag( bCodeDQP ); 1540 1535 1541 if( m_bUseSBACRD )m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]);1536 m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]); 1542 1537 1543 1538 rpcTempCU->getTotalBits() = m_pcEntropyCoder->getNumberOfWrittenBits(); 1544 if(m_pcEncCfg->getUseSBACRD()) 1545 { 1546 rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 1547 } 1539 rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 1548 1540 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 1549 1541 … … 1570 1562 rpcTempCU->setPredModeSubParts( MODE_INTRA, 0, uiDepth ); 1571 1563 rpcTempCU->setTrIdxSubParts ( 0, 0, uiDepth ); 1572 rpcTempCU->setCUTransquantBypassSubParts( m_pcEncCfg->getCUTransquantBypassFlagValue(), 0, uiDepth );1573 1564 1574 1565 m_pcPredSearch->IPCMSearch( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth]); 1575 1566 1576 if( m_bUseSBACRD )m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]);1567 m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]); 1577 1568 1578 1569 m_pcEntropyCoder->resetBits(); … … 1586 1577 m_pcEntropyCoder->encodeIPCMInfo ( rpcTempCU, 0, true ); 1587 1578 1588 if( m_bUseSBACRD )m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]);1579 m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]); 1589 1580 1590 1581 rpcTempCU->getTotalBits() = m_pcEntropyCoder->getNumberOfWrittenBits(); 1591 if(m_pcEncCfg->getUseSBACRD()) 1592 { 1593 rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 1594 } 1582 rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 1595 1583 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 1596 1584 … … 1627 1615 pcCU = NULL; 1628 1616 1629 if( m_bUseSBACRD )// store temp best CI for next CU coding1630 1617 // store temp best CI for next CU coding 1618 m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]->store(m_pppcRDSbacCoder[uiDepth][CI_NEXT_BEST]); 1631 1619 } 1632 1620 } … … 1644 1632 m_pcEntropyCoder->encodeQP( pcCU, 0, false ); 1645 1633 pcCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // dQP bits 1646 if(m_pcEncCfg->getUseSBACRD()) 1647 { 1648 pcCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 1649 } 1634 pcCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 1650 1635 pcCU->getTotalCost() = m_pcRdCost->calcRdCost( pcCU->getTotalBits(), pcCU->getTotalDistortion() ); 1651 1636 #endif … … 1795 1780 } 1796 1781 1782 /** Collect ARL statistics from one LCU 1783 * \param pcCU 1784 */ 1785 Void TEncCu::xLcuCollectARLStats(TComDataCU* rpcCU ) 1786 { 1787 Double cSum[ LEVEL_RANGE + 1 ]; //: the sum of DCT coefficients corresponding to datatype and quantization output 1788 UInt numSamples[ LEVEL_RANGE + 1 ]; //: the number of coefficients corresponding to datatype and quantization output 1789 1790 TCoeff* pCoeffY = rpcCU->getCoeffY(); 1791 Int* pArlCoeffY = rpcCU->getArlCoeffY(); 1792 1793 UInt uiMinCUWidth = g_uiMaxCUWidth >> g_uiMaxCUDepth; 1794 UInt uiMinNumCoeffInCU = 1 << uiMinCUWidth; 1795 1796 memset( cSum, 0, sizeof( Double )*(LEVEL_RANGE+1) ); 1797 memset( numSamples, 0, sizeof( UInt )*(LEVEL_RANGE+1) ); 1798 1799 // Collect stats to cSum[][] and numSamples[][] 1800 for(Int i = 0; i < rpcCU->getTotalNumPart(); i ++ ) 1801 { 1802 UInt uiTrIdx = rpcCU->getTransformIdx(i); 1803 1804 if(rpcCU->getPredictionMode(i) == MODE_INTER) 1805 if( rpcCU->getCbf( i, TEXT_LUMA, uiTrIdx ) ) 1806 { 1807 xTuCollectARLStats(pCoeffY, pArlCoeffY, uiMinNumCoeffInCU, cSum, numSamples); 1808 }//Note that only InterY is processed. QP rounding is based on InterY data only. 1809 1810 pCoeffY += uiMinNumCoeffInCU; 1811 pArlCoeffY += uiMinNumCoeffInCU; 1812 } 1813 1814 for(Int u=1; u<LEVEL_RANGE;u++) 1815 { 1816 m_pcTrQuant->getSliceSumC()[u] += cSum[ u ] ; 1817 m_pcTrQuant->getSliceNSamples()[u] += numSamples[ u ] ; 1818 } 1819 m_pcTrQuant->getSliceSumC()[LEVEL_RANGE] += cSum[ LEVEL_RANGE ] ; 1820 m_pcTrQuant->getSliceNSamples()[LEVEL_RANGE] += numSamples[ LEVEL_RANGE ] ; 1821 } 1822 #endif 1823 1824 #if SVC_EXTENSION 1797 1825 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 1798 1826 Bool TEncCu::xCheckTileSetConstraint( TComDataCU*& rpcCU ) … … 1861 1889 #endif 1862 1890 1863 /** Collect ARL statistics from one LCU1864 * \param pcCU1865 */1866 Void TEncCu::xLcuCollectARLStats(TComDataCU* rpcCU )1867 {1868 Double cSum[ LEVEL_RANGE + 1 ]; //: the sum of DCT coefficients corresponding to datatype and quantization output1869 UInt numSamples[ LEVEL_RANGE + 1 ]; //: the number of coefficients corresponding to datatype and quantization output1870 1871 TCoeff* pCoeffY = rpcCU->getCoeffY();1872 Int* pArlCoeffY = rpcCU->getArlCoeffY();1873 1874 UInt uiMinCUWidth = g_uiMaxCUWidth >> g_uiMaxCUDepth;1875 UInt uiMinNumCoeffInCU = 1 << uiMinCUWidth;1876 1877 memset( cSum, 0, sizeof( Double )*(LEVEL_RANGE+1) );1878 memset( numSamples, 0, sizeof( UInt )*(LEVEL_RANGE+1) );1879 1880 // Collect stats to cSum[][] and numSamples[][]1881 for(Int i = 0; i < rpcCU->getTotalNumPart(); i ++ )1882 {1883 UInt uiTrIdx = rpcCU->getTransformIdx(i);1884 1885 if(rpcCU->getPredictionMode(i) == MODE_INTER)1886 if( rpcCU->getCbf( i, TEXT_LUMA, uiTrIdx ) )1887 {1888 xTuCollectARLStats(pCoeffY, pArlCoeffY, uiMinNumCoeffInCU, cSum, numSamples);1889 }//Note that only InterY is processed. QP rounding is based on InterY data only.1890 1891 pCoeffY += uiMinNumCoeffInCU;1892 pArlCoeffY += uiMinNumCoeffInCU;1893 }1894 1895 for(Int u=1; u<LEVEL_RANGE;u++)1896 {1897 m_pcTrQuant->getSliceSumC()[u] += cSum[ u ] ;1898 m_pcTrQuant->getSliceNSamples()[u] += numSamples[ u ] ;1899 }1900 m_pcTrQuant->getSliceSumC()[LEVEL_RANGE] += cSum[ LEVEL_RANGE ] ;1901 m_pcTrQuant->getSliceNSamples()[LEVEL_RANGE] += numSamples[ LEVEL_RANGE ] ;1902 }1903 #endif1904 1905 1891 #if (ENCODER_FAST_MODE) 1906 1892 Void TEncCu::xCheckRDCostILRUni(TComDataCU *&rpcBestCU, TComDataCU *&rpcTempCU, UInt refLayerId) … … 1913 1899 rpcTempCU->setPartSizeSubParts ( SIZE_2Nx2N, 0, uhDepth ); //2Nx2N 1914 1900 rpcTempCU->setPredModeSubParts ( MODE_INTER, 0, uhDepth ); 1915 rpcTempCU->setCUTransquantBypassSubParts ( m_pcEncCfg->getCUTransquantBypassFlag Value(), 0, uhDepth );1901 rpcTempCU->setCUTransquantBypassSubParts ( m_pcEncCfg->getCUTransquantBypassFlagForceValue(), 0, uhDepth ); 1916 1902 Bool exitILR = m_pcPredSearch->predInterSearchILRUni( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], refLayerId ); 1917 1903 if(!exitILR) … … 1926 1912 } 1927 1913 #endif 1914 #endif //SVC_EXTENSION 1928 1915 //! \}
Note: See TracChangeset for help on using the changeset viewer.