Changeset 1412 in 3DVCSoftware for branches/HTM-16.2-dev/source/Lib/TLibEncoder/TEncCu.cpp
- Timestamp:
- 12 Apr 2018, 11:12:21 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-16.2-dev/source/Lib/TLibEncoder/TEncCu.cpp
r1405 r1412 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 6, ITU/ISO/IEC6 * Copyright (c) 2010-2017, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 46 46 using namespace std; 47 47 48 49 48 //! \ingroup TLibEncoder 50 49 //! \{ … … 68 67 m_ppcTempCU = new TComDataCU*[m_uhTotalDepth-1]; 69 68 70 #if NH_3D _ARP69 #if NH_3D 71 70 m_ppcWeightedTempCU = new TComDataCU*[m_uhTotalDepth-1]; 72 71 #endif … … 79 78 m_ppcRecoYuvTemp = new TComYuv*[m_uhTotalDepth-1]; 80 79 m_ppcOrigYuv = new TComYuv*[m_uhTotalDepth-1]; 81 #if NH_3D _DBBP80 #if NH_3D 82 81 m_ppcOrigYuvDBBP = new TComYuv*[m_uhTotalDepth-1]; 83 82 #endif … … 92 91 m_ppcBestCU[i] = new TComDataCU; m_ppcBestCU[i]->create( chromaFormat, uiNumPartitions, uiWidth, uiHeight, false, uiMaxWidth >> (m_uhTotalDepth - 1) ); 93 92 m_ppcTempCU[i] = new TComDataCU; m_ppcTempCU[i]->create( chromaFormat, uiNumPartitions, uiWidth, uiHeight, false, uiMaxWidth >> (m_uhTotalDepth - 1) ); 94 #if NH_3D _ARP93 #if NH_3D 95 94 m_ppcWeightedTempCU[i] = new TComDataCU; m_ppcWeightedTempCU[i]->create( chromaFormat, uiNumPartitions, uiWidth, uiHeight, false, uiMaxWidth >> (m_uhTotalDepth - 1) ); 96 95 #endif … … 105 104 106 105 m_ppcOrigYuv [i] = new TComYuv; m_ppcOrigYuv [i]->create(uiWidth, uiHeight, chromaFormat); 107 #if NH_3D _DBBP106 #if NH_3D 108 107 m_ppcOrigYuvDBBP[i] = new TComYuv; m_ppcOrigYuvDBBP[i]->create(uiWidth, uiHeight, chromaFormat); 109 108 #endif … … 147 146 m_ppcTempCU[i]->destroy(); delete m_ppcTempCU[i]; m_ppcTempCU[i] = NULL; 148 147 } 149 #if NH_3D _ARP148 #if NH_3D 150 149 if(m_ppcWeightedTempCU[i]) 151 150 { … … 181 180 m_ppcOrigYuv[i]->destroy(); delete m_ppcOrigYuv[i]; m_ppcOrigYuv[i] = NULL; 182 181 } 183 #if NH_3D _DBBP182 #if NH_3D 184 183 if(m_ppcOrigYuvDBBP[i]) 185 184 { … … 199 198 } 200 199 201 #if NH_3D _ARP200 #if NH_3D 202 201 if(m_ppcWeightedTempCU) 203 202 { … … 241 240 m_ppcOrigYuv = NULL; 242 241 } 243 #if NH_3D _DBBP242 #if NH_3D 244 243 if(m_ppcOrigYuvDBBP) 245 244 { … … 266 265 267 266 m_pcRateCtrl = pcEncTop->getRateCtrl(); 267 m_lumaQPOffset = 0; 268 initLumaDeltaQpLUT(); 268 269 } 269 270 … … 281 282 m_ppcTempCU[0]->initCtu( pCtu->getPic(), pCtu->getCtuRsAddr() ); 282 283 283 #if NH_3D _ARP284 #if NH_3D 284 285 m_ppcWeightedTempCU[0]->initCtu( pCtu->getPic(), pCtu->getCtuRsAddr() ); 285 286 #endif … … 329 330 // Protected member functions 330 331 // ==================================================================================================================== 332 333 Void TEncCu::initLumaDeltaQpLUT() 334 { 335 const LumaLevelToDeltaQPMapping &mapping=m_pcEncCfg->getLumaLevelToDeltaQPMapping(); 336 337 if ( !mapping.isEnabled() ) 338 { 339 return; 340 } 341 342 // map the sparse LumaLevelToDeltaQPMapping.mapping to a fully populated linear table. 343 344 Int lastDeltaQPValue=0; 345 std::size_t nextSparseIndex=0; 346 for(Int index=0; index<LUMA_LEVEL_TO_DQP_LUT_MAXSIZE; index++) 347 { 348 while (nextSparseIndex < mapping.mapping.size() && index>=mapping.mapping[nextSparseIndex].first) 349 { 350 lastDeltaQPValue=mapping.mapping[nextSparseIndex].second; 351 nextSparseIndex++; 352 } 353 m_lumaLevelToDeltaQPLUT[index]=lastDeltaQPValue; 354 } 355 } 356 357 Int TEncCu::calculateLumaDQP(TComDataCU *pCU, const UInt absPartIdx, const TComYuv * pOrgYuv) 358 { 359 const Pel *pY = pOrgYuv->getAddr(COMPONENT_Y, absPartIdx); 360 const Int stride = pOrgYuv->getStride(COMPONENT_Y); 361 Int width = pCU->getWidth(absPartIdx); 362 Int height = pCU->getHeight(absPartIdx); 363 Double avg = 0; 364 365 // limit the block by picture size 366 const TComSPS* pSPS = pCU->getSlice()->getSPS(); 367 if ( pCU->getCUPelX() + width > pSPS->getPicWidthInLumaSamples() ) 368 { 369 width = pSPS->getPicWidthInLumaSamples() - pCU->getCUPelX(); 370 } 371 if ( pCU->getCUPelY() + height > pSPS->getPicHeightInLumaSamples() ) 372 { 373 height = pSPS->getPicHeightInLumaSamples() - pCU->getCUPelY(); 374 } 375 376 // Get QP offset derived from Luma level 377 if ( m_pcEncCfg->getLumaLevelToDeltaQPMapping().mode == LUMALVL_TO_DQP_AVG_METHOD ) 378 { 379 // Use avg method 380 Int sum = 0; 381 for (Int y = 0; y < height; y++) 382 { 383 for (Int x = 0; x < width; x++) 384 { 385 sum += pY[x]; 386 } 387 pY += stride; 388 } 389 avg = (Double)sum/(width*height); 390 } 391 else 392 { 393 // Use maximum luma value 394 Int maxVal = 0; 395 for (Int y = 0; y < height; y++) 396 { 397 for (Int x = 0; x < width; x++) 398 { 399 if (pY[x] > maxVal) 400 { 401 maxVal = pY[x]; 402 } 403 } 404 pY += stride; 405 } 406 // use a percentage of the maxVal 407 avg = (Double)maxVal * m_pcEncCfg->getLumaLevelToDeltaQPMapping().maxMethodWeight; 408 } 409 410 Int lumaIdx = Clip3<Int>(0, Int(LUMA_LEVEL_TO_DQP_LUT_MAXSIZE)-1, Int(avg+0.5) ); 411 Int QP = m_lumaLevelToDeltaQPLUT[lumaIdx]; 412 return QP; 413 } 414 331 415 //! Derive small set of test modes for AMP encoder speed-up 332 416 #if AMP_ENC_SPEEDUP … … 420 504 const UInt fastDeltaQPCuMaxSize = Clip3(sps.getMaxCUHeight()>>sps.getLog2DiffMaxMinCodingBlockSize(), sps.getMaxCUHeight(), 32u); 421 505 422 #if NH_3D_QTL 423 #if NH_3D_QTLPC 506 #if NH_3D 424 507 Bool bLimQtPredFalg = pcPic->getSlice(0)->getQtPredFlag(); 425 #else426 Bool bLimQtPredFalg = false;427 #endif428 508 TComPic *pcTexture = rpcBestCU->getSlice()->getTexturePic(); 429 509 … … 440 520 m_ppcOrigYuv[uiDepth]->copyFromPicYuv( pcPic->getPicYuvOrg(), rpcBestCU->getCtuRsAddr(), rpcBestCU->getZorderIdxInCtu() ); 441 521 442 #if NH_3D _QTL522 #if NH_3D 443 523 Bool bTrySplit = true; 444 524 Bool bTrySplitDQP = true; … … 448 528 Bool earlyDetectionSkipMode = false; 449 529 450 #if NH_3D _NBDV530 #if NH_3D 451 531 DisInfo DvInfo; 452 532 DvInfo.m_acNBDV.setZero(); 453 533 DvInfo.m_aVIdxCan = 0; 454 #if NH_3D_NBDV_REF455 534 DvInfo.m_acDoNBDV.setZero(); 456 #endif457 535 #endif 458 536 const UInt uiLPelX = rpcBestCU->getCUPelX(); … … 492 570 } 493 571 572 if ( m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() ) 573 { 574 if ( uiDepth <= pps.getMaxCuDQPDepth() ) 575 { 576 // keep using the same m_QP_LUMA_OFFSET in the same CTU 577 m_lumaQPOffset = calculateLumaDQP(rpcTempCU, 0, m_ppcOrigYuv[uiDepth]); 578 } 579 iMinQP = Clip3(-sps.getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, iBaseQP - m_lumaQPOffset); 580 iMaxQP = iMinQP; // force encode choose the modified QO 581 } 582 494 583 if ( m_pcEncCfg->getUseRateCtrl() ) 495 584 { … … 502 591 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. 503 592 504 if ( (pps.getTransquantBypassEnable Flag()) )593 if ( (pps.getTransquantBypassEnabledFlag()) ) 505 594 { 506 595 isAddLowestQP = true; // mark that the first iteration is to cost TQB mode. … … 512 601 } 513 602 514 #if NH_3D _IC603 #if NH_3D 515 604 Bool bICEnabled = rpcTempCU->getSlice()->getViewIndex() && ( rpcTempCU->getSlice()->getSliceType() == P_SLICE || rpcTempCU->getSlice()->getSliceType() == B_SLICE ) && !rpcTempCU->getSlice()->getIsDepth(); 516 605 bICEnabled = bICEnabled && rpcTempCU->getSlice()->getApplyIC(); … … 536 625 iQP = lowestQP; 537 626 } 538 539 #if NH_3D_QTL 627 if ( m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() && uiDepth <= pps.getMaxCuDQPDepth() ) 628 { 629 getSliceEncoder()->updateLambda(pcSlice, iQP); 630 } 631 632 633 634 #if NH_3D 540 635 bTrySplit = true; 541 636 #endif … … 555 650 556 651 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 557 #if NH_3D _QTL652 #if NH_3D 558 653 //logic for setting bTrySplit using the partition information that is stored of the texture colocated CU 559 #if H_3D_FCO560 if(depthMapDetect && !bIntraSliceDetect && !rapPic && ( m_pcEncCfg->getUseQTL() || bLimQtPredFalg ) && pcTexture->getReconMark())561 #else562 654 if(depthMapDetect && !bIntraSliceDetect && !rapPic && ( m_pcEncCfg->getUseQTL() || bLimQtPredFalg )) 563 #endif564 655 { 565 656 TComDataCU* pcTextureCU = pcTexture->getCtu( rpcBestCU->getCtuRsAddr() ); //Corresponding texture LCU … … 592 683 #endif 593 684 594 #if NH_3D _NBDV685 #if NH_3D 595 686 if( rpcTempCU->getSlice()->getSliceType() != I_SLICE ) 596 687 { 597 #if NH_3D_ARP && NH_3D_IV_MERGE && NH_3D_VSP598 688 if( rpcTempCU->getSlice()->getIvResPredFlag() || rpcTempCU->getSlice()->getIvMvPredFlag() || rpcTempCU->getSlice()->getViewSynthesisPredFlag() ) 599 #else600 #if NH_3D_IV_MERGE && NH_3D_VSP601 if( rpcTempCU->getSlice()->getIvMvPredFlag() || rpcTempCU->getSlice()->getViewSynthesisPredFlag() )602 #else603 #if NH_3D_ARP && NH_3D_VSP604 if( rpcTempCU->getSlice()->getIvResPredFlag() || rpcTempCU->getSlice()->getViewSynthesisPredFlag() )605 #else606 #if NH_3D_VSP607 if( rpcTempCU->getSlice()->getViewSynthesisPredFlag() )608 #else609 #if NH_3D_ARP610 if( rpcTempCU->getSlice()->getIvResPredFlag() )611 #else612 #if H_3D_IV_MERGE613 if( rpcTempCU->getSlice()->getVPS()->getIvMvPredFlag(rpcTempCU->getSlice()->getLayerId()) )614 #else615 #if NH_3D_DBBP616 if( rpcTempCU->getSlice()->getDepthBasedBlkPartFlag() )617 #else618 if (0)619 #endif620 #endif621 #endif622 #endif623 #endif624 #endif625 #endif626 689 { 627 690 PartSize ePartTemp = rpcTempCU->getPartitionSize(0); 628 691 rpcTempCU->setPartSizeSubParts(SIZE_2Nx2N, 0, uiDepth); 629 #if NH_3D_IV_MERGE630 692 if (rpcTempCU->getSlice()->getIsDepth() ) 631 693 { … … 634 696 else 635 697 { 636 #endif637 #if NH_3D_NBDV_REF638 698 if( rpcTempCU->getSlice()->getDepthRefinementFlag() ) 639 699 { … … 641 701 } 642 702 else 643 #endif644 703 { 645 704 rpcTempCU->getDisMvpCandNBDV(&DvInfo); 646 705 } 647 #if NH_3D_IV_MERGE 648 } 649 #endif 706 } 650 707 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 651 708 rpcBestCU->setDvInfoSubParts(DvInfo, 0, uiDepth); … … 666 723 if( rpcBestCU->getSlice()->getSliceType() != I_SLICE ) 667 724 { 668 #if NH_3D _IC725 #if NH_3D 669 726 for( UInt uiICId = 0; uiICId < ( bICEnabled ? 2 : 1 ); uiICId++ ) 670 727 { … … 674 731 if(m_pcEncCfg->getUseEarlySkipDetection()) 675 732 { 676 #if NH_3D _IC733 #if NH_3D 677 734 rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth); 678 735 #endif … … 683 740 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );//by Competition for inter_2Nx2N 684 741 #endif 685 #if NH_3D _VSP || NH_3D_DBBP742 #if NH_3D 686 743 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 687 744 #endif 688 745 } 689 746 // SKIP 690 #if NH_3D _IC747 #if NH_3D 691 748 rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth); 692 749 #endif … … 697 754 698 755 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 699 #if NH_3D _VSP || NH_3D_DBBP756 #if NH_3D 700 757 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 701 758 #endif … … 704 761 { 705 762 // 2Nx2N, NxN 706 #if NH_3D _IC763 #if NH_3D 707 764 rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth); 708 765 #endif … … 714 771 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 715 772 #endif 716 #if NH_3D _VSP || NH_3D_DBBP773 #if NH_3D 717 774 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 718 #endif719 #if NH_3D_DBBP720 775 if( rpcTempCU->getSlice()->getDepthBasedBlkPartFlag() && rpcTempCU->getSlice()->getDefaultRefViewIdxAvailableFlag() ) 721 776 { 722 777 xCheckRDCostInterDBBP( rpcBestCU, rpcTempCU DEBUG_STRING_PASS_INTO(sDebug), false ); 723 778 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 724 #if NH_3D_VSP || NH_3D_DBBP725 779 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 726 #endif727 780 } 728 781 #endif … … 733 786 } 734 787 } 735 #if NH_3D _IC788 #if NH_3D 736 789 } 737 790 #endif 738 791 } 739 #if NH_3D _QTL792 #if NH_3D 740 793 if(depthMapDetect && !bIntraSliceDetect && !rapPic && ( m_pcEncCfg->getUseQTL() || bLimQtPredFalg )) 741 794 { … … 757 810 } 758 811 #endif 759 #if NH_3D _ENC_DEPTH812 #if NH_3D 760 813 if( rpcBestCU->getSlice()->getIsDepth() && rpcBestCU->getSlice()->isIRAP() ) 761 814 { 762 815 earlyDetectionSkipMode = false; 763 816 } 764 #endif 765 #if NH_3D_DIS 817 766 818 rpcTempCU->initEstData( uiDepth, iMinQP, isAddLowestQP ); 767 819 if( rpcBestCU->getSlice()->getDepthIntraSkipFlag() ) … … 792 844 { 793 845 if( uiDepth == sps.getLog2DiffMaxMinCodingBlockSize() && doNotBlockPu 794 #if NH_3D _QTL846 #if NH_3D 795 847 && bTrySplit 796 848 #endif … … 804 856 #endif 805 857 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 806 #if NH_3D _VSP || NH_3D_DBBP858 #if NH_3D 807 859 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 808 860 #endif … … 812 864 813 865 if(doNotBlockPu 814 #if NH_3D _QTL866 #if NH_3D 815 867 && bTryNx2N 816 868 #endif … … 823 875 #endif 824 876 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 825 #if NH_3D _VSP || NH_3D_DBBP877 #if NH_3D 826 878 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 827 879 #endif … … 833 885 } 834 886 if(doNotBlockPu 835 #if NH_3D _QTL887 #if NH_3D 836 888 && bTry2NxN 837 889 #endif … … 846 898 847 899 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 848 #if NH_3D _VSP || NH_3D_DBBP900 #if NH_3D 849 901 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 850 902 #endif … … 874 926 { 875 927 if(doNotBlockPu 876 #if NH_3D _QTL928 #if NH_3D 877 929 && bTry2NxN 878 930 #endif … … 885 937 #endif 886 938 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 887 #if NH_3D _VSP || NH_3D_DBBP939 #if NH_3D 888 940 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 889 941 #endif … … 894 946 } 895 947 if(doNotBlockPu 896 #if NH_3D _QTL948 #if NH_3D 897 949 && bTry2NxN 898 950 #endif … … 906 958 907 959 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 908 #if NH_3D _VSP || NH_3D_DBBP960 #if NH_3D 909 961 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 910 962 #endif … … 920 972 { 921 973 if(doNotBlockPu 922 #if NH_3D _QTL974 #if NH_3D 923 975 && bTry2NxN 924 976 #endif … … 933 985 934 986 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 935 #if NH_3D _VSP || NH_3D_DBBP987 #if NH_3D 936 988 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 937 989 #endif … … 942 994 } 943 995 if(doNotBlockPu 944 #if NH_3D _QTL996 #if NH_3D 945 997 && bTry2NxN 946 998 #endif … … 953 1005 #endif 954 1006 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 955 #if NH_3D _VSP || NH_3D_DBBP1007 #if NH_3D 956 1008 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 957 1009 #endif … … 969 1021 { 970 1022 if(doNotBlockPu 971 #if NH_3D _QTL1023 #if NH_3D 972 1024 && bTryNx2N 973 1025 #endif … … 981 1033 982 1034 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 983 #if NH_3D _VSP || NH_3D_DBBP1035 #if NH_3D 984 1036 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 985 1037 #endif … … 990 1042 } 991 1043 if(doNotBlockPu 992 #if NH_3D _QTL1044 #if NH_3D 993 1045 && bTryNx2N 994 1046 #endif … … 1001 1053 #endif 1002 1054 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1003 #if NH_3D _VSP || NH_3D_DBBP1055 #if NH_3D 1004 1056 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 1005 1057 #endif … … 1010 1062 { 1011 1063 if(doNotBlockPu 1012 #if NH_3D _QTL1064 #if NH_3D 1013 1065 && bTryNx2N 1014 1066 #endif … … 1021 1073 #endif 1022 1074 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1023 #if NH_3D _VSP || NH_3D_DBBP1075 #if NH_3D 1024 1076 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 1025 1077 #endif … … 1030 1082 } 1031 1083 if(doNotBlockPu 1032 #if NH_3D _QTL1084 #if NH_3D 1033 1085 && bTryNx2N 1034 1086 #endif … … 1042 1094 #endif 1043 1095 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1044 #if NH_3D _VSP || NH_3D_DBBP1096 #if NH_3D 1045 1097 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 1046 1098 #endif … … 1051 1103 1052 1104 #else 1053 #if NH_3D _QTL1105 #if NH_3D 1054 1106 if (bTry2NxN) 1055 1107 { 1056 1108 #endif 1057 1058 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU ); 1059 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1060 #if NH_3D_VSP || NH_3D_DBBP 1061 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 1062 #endif 1063 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD ); 1064 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1065 #if NH_3D_VSP || NH_3D_DBBP 1066 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 1067 #endif 1068 #if NH_3D_QTL 1109 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU ); 1110 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1111 #if NH_3D 1112 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 1113 #endif 1114 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD ); 1115 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1116 #if NH_3D 1117 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 1069 1118 } 1070 1119 if (bTryNx2N) 1071 1120 { 1072 1121 #endif 1073 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N ); 1074 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1075 #if NH_3D_VSP || NH_3D_DBBP 1076 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 1077 #endif 1078 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N ); 1079 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1080 #if NH_3D_VSP || NH_3D_DBBP 1081 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 1082 #endif 1083 #if NH_3D_QTL 1122 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N ); 1123 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1124 #if NH_3D 1125 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 1126 #endif 1127 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N ); 1128 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1129 #if NH_3D 1130 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 1084 1131 } 1085 1132 #endif … … 1093 1140 { 1094 1141 #endif 1095 1096 1142 // do normal intra modes 1097 1143 // speedup for inter frames 1098 1144 1099 if((rpcBestCU->getSlice()->getSliceType() == I_SLICE) || 1100 ((!m_pcEncCfg->getDisableIntraPUsInInterSlices()) && ( 1101 (rpcBestCU->getCbf( 0, COMPONENT_Y ) != 0) || 1102 ((rpcBestCU->getCbf( 0, COMPONENT_Cb ) != 0) && (numberValidComponents > COMPONENT_Cb)) || 1103 ((rpcBestCU->getCbf( 0, COMPONENT_Cr ) != 0) && (numberValidComponents > COMPONENT_Cr)) // avoid very complex intra if it is unlikely 1104 #if NH_3D_ENC_DEPTH 1145 1146 #if MCTS_ENC_CHECK 1147 if ( m_pcEncCfg->getTMCTSSEITileConstraint() || (rpcBestCU->getSlice()->getSliceType() == I_SLICE) || 1148 ((!m_pcEncCfg->getDisableIntraPUsInInterSlices()) && ( 1149 (rpcBestCU->getCbf(0, COMPONENT_Y) != 0) || 1150 ((rpcBestCU->getCbf(0, COMPONENT_Cb) != 0) && (numberValidComponents > COMPONENT_Cb)) || 1151 ((rpcBestCU->getCbf(0, COMPONENT_Cr) != 0) && (numberValidComponents > COMPONENT_Cr)) // avoid very complex intra if it is unlikely 1152 #else 1153 if((rpcBestCU->getSlice()->getSliceType() == I_SLICE) || 1154 ((!m_pcEncCfg->getDisableIntraPUsInInterSlices()) && ( 1155 (rpcBestCU->getCbf( 0, COMPONENT_Y ) != 0) || 1156 ((rpcBestCU->getCbf( 0, COMPONENT_Cb ) != 0) && (numberValidComponents > COMPONENT_Cb)) || 1157 ((rpcBestCU->getCbf( 0, COMPONENT_Cr ) != 0) && (numberValidComponents > COMPONENT_Cr)) // avoid very complex intra if it is unlikely 1158 #endif 1159 #if NH_3D 1105 1160 || rpcBestCU->getSlice()->getIsDepth() 1106 1161 #endif 1107 1162 ))) 1108 {1109 #if NH_3D _ENC_DEPTH1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 #else 1125 xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_2Nx2N DEBUG_STRING_PASS_INTO(sDebug) );1163 { 1164 #if NH_3D 1165 Bool bOnlyIVP = false; 1166 Bool bUseIVP = true; 1167 if( (rpcBestCU->getSlice()->getSliceType() != I_SLICE) && 1168 !( (rpcBestCU->getCbf( 0, COMPONENT_Y ) != 0) || 1169 ((rpcBestCU->getCbf( 0, COMPONENT_Cb ) != 0) && (numberValidComponents > COMPONENT_Cb)) || 1170 ((rpcBestCU->getCbf( 0, COMPONENT_Cr ) != 0) && (numberValidComponents > COMPONENT_Cr)) ) && 1171 (rpcBestCU->getSlice()->getIsDepth() && !(rpcBestCU->getSlice()->isIRAP())) ) 1172 { 1173 bOnlyIVP = true; 1174 bUseIVP = rpcBestCU->getSlice()->getIntraContourFlag(); 1175 } 1176 if( bUseIVP ) 1177 { 1178 xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_2Nx2N DEBUG_STRING_PASS_INTO(sDebug), bOnlyIVP ); 1179 #else 1180 xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_2Nx2N DEBUG_STRING_PASS_INTO(sDebug) ); 1126 1181 #endif 1127 1182 #if KWU_RC_MADPRED_E0227 … … 1133 1188 #endif 1134 1189 1135 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );1136 if( uiDepth == sps.getLog2DiffMaxMinCodingBlockSize() )1137 {1138 #if NH_3D _QTL//Try IntraNxN1190 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1191 if( uiDepth == sps.getLog2DiffMaxMinCodingBlockSize() ) 1192 { 1193 #if NH_3D //Try IntraNxN 1139 1194 if(bTrySplit) 1140 1195 { 1141 1196 #endif 1142 if( rpcTempCU->getWidth(0) > ( 1 << sps.getQuadtreeTULog2MinSize() ) )1143 {1144 #if NH_3D _ENC_DEPTH1145 xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_NxN DEBUG_STRING_PASS_INTO(sDebug), bOnlyIVP );1146 #else 1147 xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_NxN DEBUG_STRING_PASS_INTO(sDebug) );1197 if( rpcTempCU->getWidth(0) > ( 1 << sps.getQuadtreeTULog2MinSize() ) ) 1198 { 1199 #if NH_3D 1200 xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_NxN DEBUG_STRING_PASS_INTO(sDebug), bOnlyIVP ); 1201 #else 1202 xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_NxN DEBUG_STRING_PASS_INTO(sDebug) ); 1148 1203 #endif 1149 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1204 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1205 } 1206 #if NH_3D 1207 } 1208 #endif 1150 1209 } 1151 #if NH_3D_QTL 1152 } 1153 #endif 1154 } 1155 #if NH_3D_ENC_DEPTH 1210 #if NH_3D 1156 1211 } 1157 1212 #endif … … 1171 1226 if((uiBestBits > uiRawBits) || (rpcBestCU->getTotalCost() > m_pcRdCost->calcRdCost(uiRawBits, 0))) 1172 1227 #endif 1173 1174 1228 { 1175 1229 xCheckIntraPCM (rpcBestCU, rpcTempCU); … … 1236 1290 } 1237 1291 1292 if ( m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() ) 1293 { 1294 iMinQP = Clip3(-sps.getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, iBaseQP - m_lumaQPOffset); 1295 iMaxQP = iMinQP; 1296 } 1297 1238 1298 if ( m_pcEncCfg->getUseRateCtrl() ) 1239 1299 { … … 1251 1311 const Bool bSubBranch = bBoundary || !( m_pcEncCfg->getUseEarlyCU() && rpcBestCU->getTotalCost()!=MAX_DOUBLE && rpcBestCU->isSkipped(0) ); 1252 1312 #endif 1253 #if NH_3D _QTL1313 #if NH_3D 1254 1314 if( bSubBranch && uiDepth < sps.getLog2DiffMaxMinCodingBlockSize() && (!getFastDeltaQp() || uiWidth > fastDeltaQPCuMaxSize || bBoundary) && bTrySplitDQP ) 1255 1315 #else … … 1258 1318 { 1259 1319 // further split 1320 Double splitTotalCost = 0; 1321 1260 1322 for (Int iQP=iMinQP; iQP<=iMaxQP; iQP++) 1261 1323 { … … 1280 1342 DEBUG_STRING_NEW(sTempDebug) 1281 1343 1282 #if NH_3D _ARP1344 #if NH_3D 1283 1345 m_ppcWeightedTempCU[uhNextDepth]->setSlice( m_ppcWeightedTempCU[ uiDepth]->getSlice()); 1284 1346 m_ppcWeightedTempCU[uhNextDepth]->setPic ( m_ppcWeightedTempCU[ uiDepth] ); … … 1318 1380 rpcTempCU->copyPartFrom( pcSubBestPartCU, uiPartUnitIdx, uhNextDepth ); // Keep best part data to current temporary data. 1319 1381 xCopyYuv2Tmp( pcSubBestPartCU->getTotalNumPart()*uiPartUnitIdx, uhNextDepth ); 1382 if ( m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() && pps.getMaxCuDQPDepth() >= 1 ) 1383 { 1384 splitTotalCost += pcSubBestPartCU->getTotalCost(); 1385 } 1320 1386 } 1321 1387 else … … 1331 1397 m_pcEntropyCoder->resetBits(); 1332 1398 m_pcEntropyCoder->encodeSplitFlag( rpcTempCU, 0, uiDepth, true ); 1399 if ( m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() && pps.getMaxCuDQPDepth() >= 1 ) 1400 { 1401 Int splitBits = m_pcEntropyCoder->getNumberOfWrittenBits(); 1402 Double splitBitCost = m_pcRdCost->calcRdCost( splitBits, 0 ); 1403 splitTotalCost += splitBitCost; 1404 } 1333 1405 1334 1406 rpcTempCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // split bits 1335 1407 rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 1336 1408 } 1409 if ( m_pcEncCfg->getLumaLevelToDeltaQPMapping().isEnabled() && pps.getMaxCuDQPDepth() >= 1 ) 1410 { 1411 rpcTempCU->getTotalCost() = splitTotalCost; 1412 } 1413 else 1414 { 1337 1415 #if NH_3D_VSO // M10 1338 1416 if ( m_pcRdCost->getUseLambdaScaleVSO() ) … … 1343 1421 #endif 1344 1422 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 1423 } 1345 1424 1346 1425 if( uiDepth == pps.getMaxCuDQPDepth() && pps.getUseDQP()) … … 1572 1651 } 1573 1652 1574 if (pps.getTransquantBypassEnable Flag())1653 if (pps.getTransquantBypassEnabledFlag()) 1575 1654 { 1576 1655 m_pcEntropyCoder->encodeCUTransquantBypassFlag( pcCU, uiAbsPartIdx ); … … 1591 1670 1592 1671 m_pcEntropyCoder->encodeMergeIndex( pcCU, uiAbsPartIdx ); 1593 #if NH_3D _ARP1672 #if NH_3D 1594 1673 m_pcEntropyCoder->encodeARPW( pcCU , uiAbsPartIdx ); 1595 #endif1596 #if NH_3D_IC1597 1674 m_pcEntropyCoder->encodeICFlag ( pcCU, uiAbsPartIdx ); 1598 1675 #endif … … 1602 1679 } 1603 1680 1604 #if NH_3D _DIS1681 #if NH_3D 1605 1682 m_pcEntropyCoder->encodeDIS( pcCU, uiAbsPartIdx ); 1606 1683 if(!pcCU->getDISFlag(uiAbsPartIdx)) 1607 1684 { 1608 1685 #endif 1609 m_pcEntropyCoder->encodePredMode( pcCU, uiAbsPartIdx );1610 m_pcEntropyCoder->encodePartSize( pcCU, uiAbsPartIdx, uiDepth );1611 1612 if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N )1613 {1614 m_pcEntropyCoder->encodeIPCMInfo( pcCU, uiAbsPartIdx );1615 1616 if(pcCU->getIPCMFlag(uiAbsPartIdx))1617 {1618 #if NH_3D _SDC_INTRA1619 m_pcEntropyCoder->encodeSDCFlag( pcCU, uiAbsPartIdx );1686 m_pcEntropyCoder->encodePredMode( pcCU, uiAbsPartIdx ); 1687 m_pcEntropyCoder->encodePartSize( pcCU, uiAbsPartIdx, uiDepth ); 1688 1689 if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) 1690 { 1691 m_pcEntropyCoder->encodeIPCMInfo( pcCU, uiAbsPartIdx ); 1692 1693 if(pcCU->getIPCMFlag(uiAbsPartIdx)) 1694 { 1695 #if NH_3D 1696 m_pcEntropyCoder->encodeSDCFlag( pcCU, uiAbsPartIdx ); 1620 1697 #endif 1621 1698 1622 // Encode slice finish 1623 finishCU(pcCU,uiAbsPartIdx); 1624 return; 1625 } 1626 } 1627 1628 // prediction Info ( Intra : direction mode, Inter : Mv, reference idx ) 1629 m_pcEntropyCoder->encodePredInfo( pcCU, uiAbsPartIdx ); 1630 #if NH_3D_DBBP 1631 m_pcEntropyCoder->encodeDBBPFlag( pcCU, uiAbsPartIdx ); 1632 #endif 1633 #if NH_3D_SDC_INTRA 1634 m_pcEntropyCoder->encodeSDCFlag( pcCU, uiAbsPartIdx ); 1635 #endif 1636 #if NH_3D_ARP 1637 m_pcEntropyCoder->encodeARPW( pcCU , uiAbsPartIdx ); 1638 #endif 1639 #if NH_3D_IC 1640 m_pcEntropyCoder->encodeICFlag ( pcCU, uiAbsPartIdx ); 1641 #endif 1642 1643 // Encode Coefficients 1644 Bool bCodeDQP = getdQPFlag(); 1645 Bool codeChromaQpAdj = getCodeChromaQpAdjFlag(); 1646 m_pcEntropyCoder->encodeCoeff( pcCU, uiAbsPartIdx, uiDepth, bCodeDQP, codeChromaQpAdj ); 1647 setCodeChromaQpAdjFlag( codeChromaQpAdj ); 1648 setdQPFlag( bCodeDQP ); 1649 #if NH_3D_DIS 1699 // Encode slice finish 1700 finishCU(pcCU,uiAbsPartIdx); 1701 return; 1702 } 1703 } 1704 1705 // prediction Info ( Intra : direction mode, Inter : Mv, reference idx ) 1706 m_pcEntropyCoder->encodePredInfo( pcCU, uiAbsPartIdx ); 1707 #if NH_3D 1708 m_pcEntropyCoder->encodeDBBPFlag( pcCU, uiAbsPartIdx ); 1709 m_pcEntropyCoder->encodeSDCFlag( pcCU, uiAbsPartIdx ); 1710 m_pcEntropyCoder->encodeARPW( pcCU , uiAbsPartIdx ); 1711 m_pcEntropyCoder->encodeICFlag ( pcCU, uiAbsPartIdx ); 1712 #endif 1713 1714 // Encode Coefficients 1715 Bool bCodeDQP = getdQPFlag(); 1716 Bool codeChromaQpAdj = getCodeChromaQpAdjFlag(); 1717 m_pcEntropyCoder->encodeCoeff( pcCU, uiAbsPartIdx, uiDepth, bCodeDQP, codeChromaQpAdj ); 1718 setCodeChromaQpAdjFlag( codeChromaQpAdj ); 1719 setdQPFlag( bCodeDQP ); 1720 #if NH_3D 1650 1721 } 1651 1722 #endif … … 1788 1859 #endif 1789 1860 1790 #if NH_3D _MLC1861 #if NH_3D 1791 1862 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists 1792 1863 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM]; … … 1803 1874 } 1804 1875 UChar uhDepth = rpcTempCU->getDepth( 0 ); 1805 #if NH_3D _IC1876 #if NH_3D 1806 1877 Bool bICFlag = rpcTempCU->getICFlag( 0 ); 1807 1878 #endif … … 1817 1888 #endif 1818 1889 1819 #if NH_3D _ARP1890 #if NH_3D 1820 1891 DisInfo cOrigDisInfo = rpcTempCU->getDvInfo(0); 1821 #else1822 1892 #endif 1823 1893 1824 1894 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to CTU level 1825 1895 1826 #if NH_3D _SPIVMP1896 #if NH_3D 1827 1897 Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM]; 1828 1898 memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM); … … 1831 1901 pcMvFieldSP = new TComMvField[rpcTempCU->getPic()->getPicSym()->getNumPartitionsInCtu()*2]; 1832 1902 puhInterDirSP = new UChar[rpcTempCU->getPic()->getPicSym()->getNumPartitionsInCtu()]; 1833 #endif 1834 1835 #if NH_3D_VSP 1836 #if !NH_3D_ARP 1837 Int vspFlag[MRG_MAX_NUM_CANDS_MEM]; 1838 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); 1839 #if NH_3D_MLC 1840 rpcTempCU->initAvailableFlags(); 1841 #endif 1842 rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); 1843 #if NH_3D_MLC 1844 rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours 1845 #if NH_3D_SPIVMP 1846 , pcMvFieldSP, puhInterDirSP 1847 #endif 1848 , numValidMergeCand 1849 ); 1850 1851 rpcTempCU->buildMCL( cMvFieldNeighbours,uhInterDirNeighbours, vspFlag 1852 #if NH_3D_SPIVMP 1853 , bSPIVMPFlag 1854 #endif 1855 , numValidMergeCand 1856 ); 1857 #endif 1858 #endif 1859 #else 1860 #if NH_3D_MLC 1861 rpcTempCU->initAvailableFlags(); 1862 #endif 1903 Int mergeCandBuffer[MRG_MAX_NUM_CANDS_MEM]; 1904 1905 for( UInt ui = 0; ui < rpcTempCU->getSlice()->getMaxNumMergeCand(); ++ui ) 1906 #else 1907 1908 #if MCTS_ENC_CHECK 1909 UInt numSpatialMergeCandidates = 0; 1910 rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, numSpatialMergeCandidates ); 1911 #else 1863 1912 rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand ); 1864 #if NH_3D_MLC 1865 rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours 1866 #if H_3D_SPIVMP 1867 , pcMvFieldSP, puhInterDirSP 1868 #endif 1869 , numValidMergeCand 1870 ); 1871 #if NH_3D_MLC 1872 rpcTempCU->buildMCL( cMvFieldNeighbours,uhInterDirNeighbours 1873 #if H_3D_SPIVMP 1874 , bSPIVMPFlag 1875 #endif 1876 , numValidMergeCand 1877 ); 1878 #endif 1879 #endif 1880 #endif 1881 1882 #if NH_3D_MLC 1883 Int mergeCandBuffer[MRG_MAX_NUM_CANDS_MEM]; 1884 #else 1913 #endif 1885 1914 Int mergeCandBuffer[MRG_MAX_NUM_CANDS]; 1886 #endif1887 #if NH_3D_MLC1888 for( UInt ui = 0; ui < rpcTempCU->getSlice()->getMaxNumMergeCand(); ++ui )1889 #else1890 1915 for( UInt ui = 0; ui < numValidMergeCand; ++ui ) 1891 1916 #endif … … 1893 1918 mergeCandBuffer[ui] = 0; 1894 1919 } 1920 1921 #if MCTS_ENC_CHECK && !NH_3D 1922 if (m_pcEncCfg->getTMCTSSEITileConstraint() && rpcTempCU->isLastColumnCTUInTile()) 1923 { 1924 numValidMergeCand = numSpatialMergeCandidates; 1925 } 1926 #endif 1895 1927 1896 1928 Bool bestIsSkip = false; … … 1907 1939 DEBUG_STRING_NEW(bestStr) 1908 1940 1909 #if NH_3D _ARP1941 #if NH_3D 1910 1942 Int nARPWMax = rpcTempCU->getSlice()->getARPStepNum() - 1; 1911 #if NH_3D_IC1912 1943 if( nARPWMax < 0 || bICFlag ) 1913 #else1914 if( nARPWMax < 0 )1915 #endif1916 1944 { 1917 1945 nARPWMax = 0; … … 1919 1947 for( Int nARPW=nARPWMax; nARPW >= 0 ; nARPW-- ) 1920 1948 { 1921 #if NH_3D1922 1949 #if DEBUG_STRING 1923 1950 bestStr.clear(); 1924 1951 #endif 1925 #endif1926 #if NH_3D_IV_MERGE1927 1952 memset( mergeCandBuffer, 0, MRG_MAX_NUM_CANDS_MEM*sizeof(Int) ); 1928 #else1929 memset( mergeCandBuffer, 0, MRG_MAX_NUM_CANDS * sizeof(Int) );1930 #endif1931 1953 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level 1932 1954 rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth ); 1933 #if NH_3D_IC1934 1955 rpcTempCU->setICFlagSubParts( bICFlag, 0, 0, uhDepth ); 1935 #endif1936 1956 rpcTempCU->getDvInfo(0) = cOrigDisInfo; 1937 1957 rpcTempCU->setDvInfoSubParts(cOrigDisInfo, 0, uhDepth ); 1938 #if NH_3D_VSP1939 1958 Int vspFlag[MRG_MAX_NUM_CANDS_MEM]; 1940 1959 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); 1941 #endif1942 #if NH_3D1943 #if NH_3D_MLC1944 1960 rpcTempCU->initAvailableFlags(); 1945 #endif 1961 #if MCTS_ENC_CHECK 1962 UInt numSpatialMergeCandidates = 0; 1963 rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, numSpatialMergeCandidates ); 1964 #else 1946 1965 rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); 1947 rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours 1948 #if NH_3D_SPIVMP 1949 , pcMvFieldSP, puhInterDirSP 1950 #endif 1951 , numValidMergeCand 1952 ); 1953 1954 rpcTempCU->buildMCL( cMvFieldNeighbours,uhInterDirNeighbours 1955 #if NH_3D_VSP 1956 , vspFlag 1957 #endif 1958 #if NH_3D_SPIVMP 1959 , bSPIVMPFlag 1960 #endif 1961 , numValidMergeCand 1962 ); 1963 1964 #else 1965 rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand ); 1966 #endif 1967 1968 1966 #endif 1967 rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, pcMvFieldSP, puhInterDirSP, numValidMergeCand ); 1968 1969 rpcTempCU->buildMCL( cMvFieldNeighbours,uhInterDirNeighbours , vspFlag , bSPIVMPFlag, numValidMergeCand ); 1969 1970 #endif 1970 1971 … … 1977 1978 for( UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand ) 1978 1979 { 1979 #if NH_3D _IC1980 #if NH_3D 1980 1981 if( rpcTempCU->getSlice()->getApplyIC() && rpcTempCU->getSlice()->getIcSkipParseFlag() ) 1981 1982 { … … 1997 1998 // set MC parameters 1998 1999 rpcTempCU->setPredModeSubParts( MODE_INTER, 0, uhDepth ); // interprets depth relative to CTU level 1999 #if NH_3D _IC2000 #if NH_3D 2000 2001 rpcTempCU->setICFlagSubParts( bICFlag, 0, 0, uhDepth ); 2001 2002 #endif … … 2005 2006 rpcTempCU->setMergeFlagSubParts( true, 0, 0, uhDepth ); // interprets depth relative to CTU level 2006 2007 rpcTempCU->setMergeIndexSubParts( uiMergeCand, 0, 0, uhDepth ); // interprets depth relative to CTU level 2007 #if NH_3D _ARP2008 #if NH_3D 2008 2009 rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth ); 2009 #endif2010 2011 #if NH_3D_VSP2012 2010 rpcTempCU->setVSPFlagSubParts( vspFlag[uiMergeCand], 0, 0, uhDepth ); 2013 #endif2014 #if NH_3D_SPIVMP2015 2011 rpcTempCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeCand], 0, 0, uhDepth); 2016 2012 if (bSPIVMPFlag[uiMergeCand]) … … 2030 2026 } 2031 2027 else 2032 #endif2033 2028 { 2034 #if NH_3D_VSP2035 2029 if ( vspFlag[uiMergeCand] ) 2036 2030 { … … 2062 2056 { 2063 2057 #endif 2064 rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to CTU level2065 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level2066 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level2067 #if NH_3D _VSP2058 rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to CTU level 2059 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 2060 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 2061 #if NH_3D 2068 2062 } 2069 2063 #endif 2070 } 2064 #if MCTS_ENC_CHECK 2065 if ( m_pcEncCfg->getTMCTSSEITileConstraint () && (!(m_pcPredSearch->checkTMctsMvp(rpcTempCU)))) 2066 { 2067 continue; 2068 } 2069 #endif 2070 #if NH_3D 2071 } 2072 #endif 2071 2073 // do MC 2072 2074 m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] ); … … 2099 2101 mergeCandBuffer[uiMergeCand] = 1; 2100 2102 } 2101 #if NH_3D _DIS2103 #if NH_3D 2102 2104 rpcTempCU->setDISFlagSubParts( false, 0, uhDepth ); 2103 #endif2104 #if NH_3D_VSP2105 2105 if( rpcTempCU->getSkipFlag(0) ) 2106 2106 { 2107 2107 rpcTempCU->setTrIdxSubParts(0, 0, uhDepth); 2108 2108 } 2109 #endif2110 #if NH_3D_SDC_INTER2111 2109 TComDataCU *rpcTempCUPre = rpcTempCU; 2112 2110 #endif … … 2114 2112 xCheckDQP( rpcTempCU ); 2115 2113 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth DEBUG_STRING_PASS_INTO(bestStr) DEBUG_STRING_PASS_INTO(tmpStr)); 2116 #if NH_3D _SDC_INTER2114 #if NH_3D 2117 2115 if( rpcTempCU->getSlice()->getInterSdcFlag() && !uiNoResidual ) 2118 2116 { … … 2141 2139 } 2142 2140 rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth ); 2143 #if NH_3D_DIS2144 2141 rpcTempCU->setDISFlagSubParts( false, 0, uhDepth ); 2145 #endif2146 2142 rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth ); 2147 2143 rpcTempCU->setCbfSubParts( 1, COMPONENT_Y, 0, uhDepth ); … … 2187 2183 if( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip ) 2188 2184 { 2189 #if NH_3D _SDC_INTER2185 #if NH_3D 2190 2186 if( rpcTempCU->getSlice()->getInterSdcFlag() ) 2191 2187 { … … 2196 2192 #endif 2197 2193 bestIsSkip = rpcBestCU->getQtRootCbf(0) == 0; 2198 #if NH_3D _SDC_INTER2194 #if NH_3D 2199 2195 } 2200 2196 #endif … … 2241 2237 } 2242 2238 DEBUG_STRING_APPEND(sDebug, bestStr) 2243 #if NH_3D_ARP 2239 2240 #if NH_3D 2244 2241 } 2245 #endif2246 #if NH_3D_SPIVMP2247 2242 delete[] pcMvFieldSP; 2248 2243 delete[] puhInterDirSP; 2249 2244 #endif 2245 2250 2246 #if NH_MV 2251 2247 D_DEC_INDENT( g_traceModeCheck ); … … 2282 2278 2283 2279 // prior to this, rpcTempCU will have just been reset using rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 2284 #if NH_3D _ARP2280 #if NH_3D 2285 2281 const Bool bTransquantBypassFlag = rpcTempCU->getCUTransquantBypass(0); 2286 2282 #endif … … 2290 2286 #endif 2291 2287 UChar uhDepth = rpcTempCU->getDepth( 0 ); 2292 #if NH_3D _ARP2288 #if NH_3D 2293 2289 Bool bFirstTime = true; 2294 2290 Int nARPWMax = rpcTempCU->getSlice()->getARPStepNum() - 1; 2295 #if NH_3D_IC 2291 2296 2292 if( nARPWMax < 0 || ePartSize != SIZE_2Nx2N || rpcTempCU->getICFlag(0) ) 2297 #else2298 if( nARPWMax < 0 || ePartSize != SIZE_2Nx2N )2299 #endif2300 2293 { 2301 2294 nARPWMax = 0; … … 2323 2316 } 2324 2317 #endif 2325 #if NH_3D _DIS2318 #if NH_3D 2326 2319 rpcTempCU->setDISFlagSubParts( false, 0, uhDepth ); 2327 2320 #endif … … 2329 2322 rpcTempCU->setPredModeSubParts ( MODE_INTER, 0, uhDepth ); 2330 2323 rpcTempCU->setChromaQpAdjSubParts( rpcTempCU->getCUTransquantBypass(0) ? 0 : m_cuChromaQpOffsetIdxPlus1, 0, uhDepth ); 2331 #if NH_3D_ARP 2324 2325 #if MCTS_ENC_CHECK 2326 rpcTempCU->setTMctsMvpIsValid(true); 2327 #endif 2328 2329 #if NH_3D 2332 2330 rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth ); 2333 #endif2334 #if NH_3D_ARP2335 2331 if( bFirstTime == false && nARPWMax ) 2336 2332 { … … 2355 2351 m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth] ); 2356 2352 #endif 2357 #if NH_3D _ARP2353 #if NH_3D 2358 2354 if( nARPWMax ) 2359 2355 { … … 2366 2362 if ( !rpcTempCU->getMergeAMP() ) 2367 2363 { 2368 #if NH_3D _ARP2364 #if NH_3D 2369 2365 if( nARPWMax ) 2370 2366 { … … 2391 2387 #endif 2392 2388 2389 #if MCTS_ENC_CHECK 2390 if (m_pcEncCfg->getTMCTSSEITileConstraint() && (!rpcTempCU->getTMctsMvpIsValid())) 2391 { 2392 return; 2393 } 2394 #endif 2395 2396 2393 2397 m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], false DEBUG_STRING_PASS_INTO(sTest) ); 2394 #if NH_3D _VSP2398 #if NH_3D 2395 2399 if( rpcTempCU->getQtRootCbf(0)==0 ) 2396 2400 { … … 2410 2414 DebugInterPredResiReco(sTest, *(m_ppcPredYuvTemp[uhDepth]), *(m_ppcResiYuvBest[uhDepth]), *(m_ppcRecoYuvTemp[uhDepth]), DebugStringGetPredModeMask(rpcTempCU->getPredictionMode(0))); 2411 2415 #endif 2412 #if NH_3D _SDC_INTER2416 #if NH_3D 2413 2417 TComDataCU *rpcTempCUPre = rpcTempCU; 2414 2418 #endif … … 2416 2420 xCheckDQP( rpcTempCU ); 2417 2421 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth DEBUG_STRING_PASS_INTO(sDebug) DEBUG_STRING_PASS_INTO(sTest)); 2418 #if NH_3D _SDC_INTER2422 #if NH_3D 2419 2423 if( rpcTempCU->getSlice()->getInterSdcFlag() && ePartSize == SIZE_2Nx2N) 2420 2424 { … … 2445 2449 } 2446 2450 rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth ); 2447 #if NH_3D_DIS2448 2451 rpcTempCU->setDISFlagSubParts( false, 0, uhDepth ); 2449 #endif2450 2452 rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth ); 2451 2453 rpcTempCU->setCbfSubParts( 1, COMPONENT_Y, 0, uhDepth ); … … 2487 2489 2488 2490 } 2489 #endif2490 #if NH_3D_ARP2491 2491 } 2492 2492 #endif … … 2499 2499 } 2500 2500 2501 #if NH_3D _DBBP2501 #if NH_3D 2502 2502 Void TEncCu::xInvalidateOriginalSegments( TComYuv* pOrigYuv, TComYuv* pOrigYuvTemp, Bool* pMask, UInt uiValidSegment ) 2503 2503 { … … 2558 2558 } 2559 2559 } 2560 #endif 2561 2562 #if NH_3D_DBBP 2560 2563 2561 Void TEncCu::xCheckRDCostInterDBBP( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU DEBUG_STRING_FN_DECLARE(sDebug), Bool bUseMRG ) 2564 2562 { … … 2583 2581 AOF( uiWidth == uiHeight ); 2584 2582 2585 #if NH_3D_DBBP2586 2583 if(uiWidth <= 8) 2587 2584 { 2588 2585 return; 2589 2586 } 2590 #endif2591 2587 2592 2588 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); … … 2594 2590 // fetch virtual depth block 2595 2591 UInt uiDepthStride = 0; 2596 #if H_3D_FCO2597 Pel* pDepthPels = rpcTempCU->getVirtualDepthBlock(rpcTempCU->getZorderIdxInCU(), uiWidth, uiHeight, uiDepthStride);2598 #else2599 2592 Pel* pDepthPels = rpcTempCU->getVirtualDepthBlock(0, uiWidth, uiHeight, uiDepthStride); 2600 #endif2601 2593 AOF( pDepthPels != NULL ); 2602 2594 AOF( uiDepthStride != 0 ); … … 2643 2635 pDBBPTmpData->auhMergeIndex[uiSegment] = rpcTempCU->getMergeIndex(0); 2644 2636 2645 #if NH_3D_VSP2646 2637 AOF( rpcTempCU->getSPIVMPFlag(0) == false ); 2647 2638 AOF( rpcTempCU->getVSPFlag(0) == 0 ); 2648 #endif2649 2639 2650 2640 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) … … 2698 2688 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth DEBUG_STRING_PASS_INTO(sDebug) DEBUG_STRING_PASS_INTO(sTest) ); 2699 2689 } 2700 #endif 2701 #if NH_3D_DIS 2690 2702 2691 Void TEncCu::xCheckRDCostDIS( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize eSize DEBUG_STRING_FN_DECLARE(sDebug) ) 2703 2692 { … … 2733 2722 rpcTempCU->setDISFlagSubParts(true, 0, uiDepth); 2734 2723 rpcTempCU->setIntraDirSubParts(CHANNEL_TYPE_LUMA, DC_IDX, 0, uiDepth); 2735 #if NH_3D_SDC_INTRA2736 2724 rpcTempCU->setSDCFlagSubParts( false, 0, uiDepth); 2737 #endif2738 2725 2739 2726 UInt uiPreCalcDistC; … … 2750 2737 2751 2738 m_pcEntropyCoder->resetBits(); 2752 if ( rpcTempCU->getSlice()->getPPS()->getTransquantBypassEnable Flag())2739 if ( rpcTempCU->getSlice()->getPPS()->getTransquantBypassEnabledFlag()) 2753 2740 { 2754 2741 m_pcEntropyCoder->encodeCUTransquantBypassFlag( rpcTempCU, 0, true ); … … 2782 2769 PartSize eSize 2783 2770 DEBUG_STRING_FN_DECLARE(sDebug) 2784 #if NH_3D _ENC_DEPTH2771 #if NH_3D 2785 2772 , Bool bOnlyIVP 2786 2773 #endif … … 2798 2785 } 2799 2786 } 2787 2800 2788 #if NH_MV 2801 2789 D_PRINT_INC_INDENT (g_traceModeCheck, "xCheckRDCostIntra; eSize: " + n2s(eSize) ); … … 2815 2803 2816 2804 rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth ); 2817 #if NH_3D _DIS2805 #if NH_3D 2818 2806 rpcTempCU->setDISFlagSubParts( false, 0, uiDepth ); 2819 2807 #endif … … 2827 2815 2828 2816 m_pcPredSearch->estIntraPredLumaQT( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], resiLuma DEBUG_STRING_PASS_INTO(sTest) 2829 #if NH_3D _ENC_DEPTH2817 #if NH_3D 2830 2818 , bOnlyIVP 2831 2819 #endif … … 2839 2827 } 2840 2828 2841 #if NH_3D _SDC_INTRA2829 #if NH_3D 2842 2830 if( rpcTempCU->getSDCFlag( 0 ) ) 2843 2831 { … … 2849 2837 m_pcEntropyCoder->resetBits(); 2850 2838 2851 if ( rpcTempCU->getSlice()->getPPS()->getTransquantBypassEnable Flag())2839 if ( rpcTempCU->getSlice()->getPPS()->getTransquantBypassEnabledFlag()) 2852 2840 { 2853 2841 m_pcEntropyCoder->encodeCUTransquantBypassFlag( rpcTempCU, 0, true ); 2854 2842 } 2855 2843 m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0, true ); 2856 #if NH_3D _DIS2844 #if NH_3D 2857 2845 m_pcEntropyCoder->encodeDIS( rpcTempCU, 0, true ); 2858 2846 if(!rpcTempCU->getDISFlag(0)) … … 2863 2851 m_pcEntropyCoder->encodePredInfo( rpcTempCU, 0 ); 2864 2852 m_pcEntropyCoder->encodeIPCMInfo(rpcTempCU, 0, true ); 2865 #if NH_3D _SDC_INTRA2853 #if NH_3D 2866 2854 m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true ); 2867 2855 #endif … … 2873 2861 setCodeChromaQpAdjFlag( codeChromaQpAdjFlag ); 2874 2862 setdQPFlag( bCodeDQP ); 2875 #if NH_3D _DIS2863 #if NH_3D 2876 2864 } 2877 2865 #endif … … 2931 2919 #endif 2932 2920 rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth ); 2933 #if NH_3D _DIS2921 #if NH_3D 2934 2922 rpcTempCU->setDISFlagSubParts( false, 0, uiDepth ); 2935 2923 #endif … … 2947 2935 m_pcEntropyCoder->resetBits(); 2948 2936 2949 if ( rpcTempCU->getSlice()->getPPS()->getTransquantBypassEnable Flag())2937 if ( rpcTempCU->getSlice()->getPPS()->getTransquantBypassEnabledFlag()) 2950 2938 { 2951 2939 m_pcEntropyCoder->encodeCUTransquantBypassFlag( rpcTempCU, 0, true ); … … 2953 2941 2954 2942 m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0, true ); 2955 #if NH_3D _DIS2943 #if NH_3D 2956 2944 m_pcEntropyCoder->encodeDIS( rpcTempCU, 0, true ); 2957 2945 #endif … … 2959 2947 m_pcEntropyCoder->encodePartSize ( rpcTempCU, 0, uiDepth, true ); 2960 2948 m_pcEntropyCoder->encodeIPCMInfo ( rpcTempCU, 0, true ); 2961 #if NH_3D _SDC_INTRA2949 #if NH_3D 2962 2950 m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true ); 2963 2951 #endif
Note: See TracChangeset for help on using the changeset viewer.