Changeset 1325 in 3DVCSoftware for branches/HTM-15.1-MV-draft-4/source/Lib/TLibEncoder/TEncCu.cpp
- Timestamp:
- 7 Sep 2015, 18:40:35 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-15.1-MV-draft-4/source/Lib/TLibEncoder/TEncCu.cpp
r1321 r1325 68 68 m_ppcTempCU = new TComDataCU*[m_uhTotalDepth-1]; 69 69 70 #if NH_3D_ARP71 m_ppcWeightedTempCU = new TComDataCU*[m_uhTotalDepth-1];72 #endif73 70 74 71 m_ppcPredYuvBest = new TComYuv*[m_uhTotalDepth-1]; … … 79 76 m_ppcRecoYuvTemp = new TComYuv*[m_uhTotalDepth-1]; 80 77 m_ppcOrigYuv = new TComYuv*[m_uhTotalDepth-1]; 81 #if NH_3D_DBBP82 m_ppcOrigYuvDBBP = new TComYuv*[m_uhTotalDepth-1];83 #endif84 78 85 79 UInt uiNumPartitions; … … 92 86 m_ppcBestCU[i] = new TComDataCU; m_ppcBestCU[i]->create( chromaFormat, uiNumPartitions, uiWidth, uiHeight, false, uiMaxWidth >> (m_uhTotalDepth - 1) ); 93 87 m_ppcTempCU[i] = new TComDataCU; m_ppcTempCU[i]->create( chromaFormat, uiNumPartitions, uiWidth, uiHeight, false, uiMaxWidth >> (m_uhTotalDepth - 1) ); 94 #if NH_3D_ARP95 m_ppcWeightedTempCU[i] = new TComDataCU; m_ppcWeightedTempCU[i]->create( chromaFormat, uiNumPartitions, uiWidth, uiHeight, false, uiMaxWidth >> (m_uhTotalDepth - 1) );96 #endif97 88 98 89 m_ppcPredYuvBest[i] = new TComYuv; m_ppcPredYuvBest[i]->create(uiWidth, uiHeight, chromaFormat); … … 105 96 106 97 m_ppcOrigYuv [i] = new TComYuv; m_ppcOrigYuv [i]->create(uiWidth, uiHeight, chromaFormat); 107 #if NH_3D_DBBP108 m_ppcOrigYuvDBBP[i] = new TComYuv; m_ppcOrigYuvDBBP[i]->create(uiWidth, uiHeight, chromaFormat);109 #endif110 98 111 99 } … … 113 101 m_bEncodeDQP = false; 114 102 115 #if KWU_RC_MADPRED_E0227116 m_LCUPredictionSAD = 0;117 m_addSADDepth = 0;118 m_temporalSAD = 0;119 m_spatialSAD = 0;120 #endif121 103 122 104 m_stillToCodeChromaQpOffsetFlag = false; … … 147 129 m_ppcTempCU[i]->destroy(); delete m_ppcTempCU[i]; m_ppcTempCU[i] = NULL; 148 130 } 149 #if NH_3D_ARP150 if(m_ppcWeightedTempCU[i])151 {152 m_ppcWeightedTempCU[i]->destroy(); delete m_ppcWeightedTempCU[i]; m_ppcWeightedTempCU[i] = NULL;153 }154 #endif155 131 if(m_ppcPredYuvBest[i]) 156 132 { … … 181 157 m_ppcOrigYuv[i]->destroy(); delete m_ppcOrigYuv[i]; m_ppcOrigYuv[i] = NULL; 182 158 } 183 #if NH_3D_DBBP184 if(m_ppcOrigYuvDBBP[i])185 {186 m_ppcOrigYuvDBBP[i]->destroy(); delete m_ppcOrigYuvDBBP[i]; m_ppcOrigYuvDBBP[i] = NULL;187 }188 #endif189 159 } 190 160 if(m_ppcBestCU) … … 199 169 } 200 170 201 #if NH_3D_ARP202 if(m_ppcWeightedTempCU)203 {204 delete [] m_ppcWeightedTempCU;205 m_ppcWeightedTempCU = NULL;206 }207 #endif208 171 if(m_ppcPredYuvBest) 209 172 { … … 241 204 m_ppcOrigYuv = NULL; 242 205 } 243 #if NH_3D_DBBP244 if(m_ppcOrigYuvDBBP)245 {246 delete [] m_ppcOrigYuvDBBP;247 m_ppcOrigYuvDBBP = NULL;248 }249 #endif250 206 } 251 207 … … 281 237 m_ppcTempCU[0]->initCtu( pCtu->getPic(), pCtu->getCtuRsAddr() ); 282 238 283 #if NH_3D_ARP 284 m_ppcWeightedTempCU[0]->initCtu( pCtu->getPic(), pCtu->getCtuRsAddr() ); 285 #endif 286 287 #if KWU_RC_MADPRED_E0227 288 m_LCUPredictionSAD = 0; 289 m_addSADDepth = 0; 290 m_temporalSAD = 0; 291 m_spatialSAD = 0; 292 #endif 239 293 240 294 241 // analysis of CU … … 421 368 422 369 423 #if NH_3D_QTLPC424 Bool bLimQtPredFalg = pcPic->getSlice(0)->getQtPredFlag();425 TComPic *pcTexture = rpcBestCU->getSlice()->getTexturePic();426 427 Bool depthMapDetect = (pcTexture != NULL);428 Bool bIntraSliceDetect = (rpcBestCU->getSlice()->getSliceType() == I_SLICE);429 430 Bool rapPic = (rpcBestCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || rpcBestCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || rpcBestCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA);431 432 Bool bTry2NxN = true;433 Bool bTryNx2N = true;434 #endif435 370 436 371 // get Original YUV data from picture 437 372 m_ppcOrigYuv[uiDepth]->copyFromPicYuv( pcPic->getPicYuvOrg(), rpcBestCU->getCtuRsAddr(), rpcBestCU->getZorderIdxInCtu() ); 438 373 439 #if NH_3D_QTLPC440 Bool bTrySplit = true;441 Bool bTrySplitDQP = true;442 #endif443 374 // variable for Cbf fast mode PU decision 444 375 Bool doNotBlockPu = true; 445 376 Bool earlyDetectionSkipMode = false; 446 377 447 #if NH_3D_NBDV448 DisInfo DvInfo;449 DvInfo.m_acNBDV.setZero();450 DvInfo.m_aVIdxCan = 0;451 #if NH_3D_NBDV_REF452 DvInfo.m_acDoNBDV.setZero();453 #endif454 #endif455 378 const UInt uiLPelX = rpcBestCU->getCUPelX(); 456 379 const UInt uiRPelX = uiLPelX + rpcBestCU->getWidth(0) - 1; … … 509 432 } 510 433 511 #if NH_3D_IC512 Bool bICEnabled = rpcTempCU->getSlice()->getViewIndex() && ( rpcTempCU->getSlice()->getSliceType() == P_SLICE || rpcTempCU->getSlice()->getSliceType() == B_SLICE ) && !rpcTempCU->getSlice()->getIsDepth();513 bICEnabled = bICEnabled && rpcTempCU->getSlice()->getApplyIC();514 #endif515 434 516 435 TComSlice * pcSlice = rpcTempCU->getPic()->getSlice(rpcTempCU->getPic()->getCurrSliceIdx()); 517 436 518 437 const Bool bBoundary = !( uiRPelX < sps.getPicWidthInLumaSamples() && uiBPelY < sps.getPicHeightInLumaSamples() ); 519 #if NH_3D_FAST_TEXTURE_ENCODING520 Bool bIVFMerge = false;521 Int iIVFMaxD = 0;522 Bool bFMD = false;523 Bool bSubBranch = true;524 #endif525 438 if ( !bBoundary ) 526 439 { … … 534 447 } 535 448 536 #if NH_3D_QTLPC537 bTrySplit = true;538 #endif539 449 540 450 m_cuChromaQpOffsetIdxPlus1 = 0; … … 552 462 553 463 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 554 #if NH_3D_QTLPC 555 //logic for setting bTrySplit using the partition information that is stored of the texture colocated CU 556 #if H_3D_FCO 557 if(depthMapDetect && !bIntraSliceDetect && !rapPic && ( m_pcEncCfg->getUseQTL() || bLimQtPredFalg ) && pcTexture->getReconMark()) 558 #else 559 if(depthMapDetect && !bIntraSliceDetect && !rapPic && ( m_pcEncCfg->getUseQTL() || bLimQtPredFalg )) 560 #endif 561 { 562 TComDataCU* pcTextureCU = pcTexture->getCtu( rpcBestCU->getCtuRsAddr() ); //Corresponding texture LCU 563 UInt uiCUIdx = rpcBestCU->getZorderIdxInCtu(); 564 assert(pcTextureCU->getDepth(uiCUIdx) >= uiDepth); //Depth cannot be more partitioned than the texture. 565 if (pcTextureCU->getDepth(uiCUIdx) > uiDepth || pcTextureCU->getPartitionSize(uiCUIdx) == SIZE_NxN) //Texture was split. 566 { 567 bTrySplit = true; 568 bTryNx2N = true; 569 bTry2NxN = true; 570 } 571 else 572 { 573 bTrySplit = false; 574 bTryNx2N = false; 575 bTry2NxN = false; 576 if( pcTextureCU->getDepth(uiCUIdx) == uiDepth && pcTextureCU->getPartitionSize(uiCUIdx) != SIZE_2Nx2N) 577 { 578 if(pcTextureCU->getPartitionSize(uiCUIdx)==SIZE_2NxN || pcTextureCU->getPartitionSize(uiCUIdx)==SIZE_2NxnU|| pcTextureCU->getPartitionSize(uiCUIdx)==SIZE_2NxnD) 579 { 580 bTry2NxN = true; 581 } 582 else 583 { 584 bTryNx2N = true; 585 } 586 } 587 } 588 } 589 #endif 590 591 #if NH_3D_NBDV 592 if( rpcTempCU->getSlice()->getSliceType() != I_SLICE ) 593 { 594 #if NH_3D_ARP && NH_3D_IV_MERGE && NH_3D_VSP 595 if( rpcTempCU->getSlice()->getIvResPredFlag() || rpcTempCU->getSlice()->getIvMvPredFlag() || rpcTempCU->getSlice()->getViewSynthesisPredFlag() ) 596 #else 597 #if NH_3D_IV_MERGE && NH_3D_VSP 598 if( rpcTempCU->getSlice()->getIvMvPredFlag() || rpcTempCU->getSlice()->getViewSynthesisPredFlag() ) 599 #else 600 #if NH_3D_ARP && NH_3D_VSP 601 if( rpcTempCU->getSlice()->getIvResPredFlag() || rpcTempCU->getSlice()->getViewSynthesisPredFlag() ) 602 #else 603 #if NH_3D_VSP 604 if( rpcTempCU->getSlice()->getViewSynthesisPredFlag() ) 605 #else 606 #if NH_3D_ARP 607 if( rpcTempCU->getSlice()->getIvResPredFlag() ) 608 #else 609 #if H_3D_IV_MERGE 610 if( rpcTempCU->getSlice()->getVPS()->getIvMvPredFlag(rpcTempCU->getSlice()->getLayerId()) ) 611 #else 612 #if NH_3D_DBBP 613 if( rpcTempCU->getSlice()->getDepthBasedBlkPartFlag() ) 614 #else 615 if (0) 616 #endif 617 #endif 618 #endif 619 #endif 620 #endif 621 #endif 622 #endif 623 { 624 PartSize ePartTemp = rpcTempCU->getPartitionSize(0); 625 rpcTempCU->setPartSizeSubParts(SIZE_2Nx2N, 0, uiDepth); 626 #if NH_3D_IV_MERGE 627 if (rpcTempCU->getSlice()->getIsDepth() ) 628 { 629 rpcTempCU->getDispforDepth(0, 0, &DvInfo); 630 } 631 else 632 { 633 #endif 634 #if NH_3D_NBDV_REF 635 if( rpcTempCU->getSlice()->getDepthRefinementFlag() ) 636 { 637 rpcTempCU->getDisMvpCandNBDV(&DvInfo, true); 638 } 639 else 640 #endif 641 { 642 rpcTempCU->getDisMvpCandNBDV(&DvInfo); 643 } 644 #if NH_3D_IV_MERGE 645 } 646 #endif 647 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 648 rpcBestCU->setDvInfoSubParts(DvInfo, 0, uiDepth); 649 rpcTempCU->setPartSizeSubParts( ePartTemp, 0, uiDepth ); 650 } 651 } 652 #if NH_3D_FAST_TEXTURE_ENCODING 653 if(rpcTempCU->getSlice()->getViewIndex() && !rpcTempCU->getSlice()->getIsDepth() && rpcTempCU->getSlice()->getDefaultRefViewIdxAvailableFlag() ) 654 { 655 PartSize ePartTemp = rpcTempCU->getPartitionSize(0); 656 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); 657 rpcTempCU->getIVNStatus( 0, &DvInfo, bIVFMerge, iIVFMaxD); 658 rpcTempCU->setPartSizeSubParts( ePartTemp, 0, uiDepth ); 659 } 660 #endif 661 #endif 464 662 465 // do inter modes, SKIP and 2Nx2N 663 466 if( rpcBestCU->getSlice()->getSliceType() != I_SLICE ) 664 467 { 665 #if NH_3D_IC666 for( UInt uiICId = 0; uiICId < ( bICEnabled ? 2 : 1 ); uiICId++ )667 {668 Bool bICFlag = uiICId ? true : false;669 #endif670 468 // 2Nx2N 671 469 if(m_pcEncCfg->getUseEarlySkipDetection()) 672 470 { 673 #if NH_3D_IC674 rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);675 #endif676 #if NH_3D_FAST_TEXTURE_ENCODING677 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N DEBUG_STRING_PASS_INTO(sDebug), bFMD ); rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );//by Competition for inter_2Nx2N678 #else679 471 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N DEBUG_STRING_PASS_INTO(sDebug) ); 680 472 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );//by Competition for inter_2Nx2N 681 #endif682 #if NH_3D_VSP || NH_3D_DBBP683 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);684 #endif685 473 } 686 474 // SKIP 687 #if NH_3D_IC688 rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);689 #endif690 475 xCheckRDCostMerge2Nx2N( rpcBestCU, rpcTempCU DEBUG_STRING_PASS_INTO(sDebug), &earlyDetectionSkipMode );//by Merge for inter_2Nx2N 691 #if NH_3D_FAST_TEXTURE_ENCODING692 bFMD = bIVFMerge && rpcBestCU->isSkipped(0);693 #endif694 476 695 477 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 696 #if NH_3D_VSP || NH_3D_DBBP697 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);698 #endif699 478 700 479 if(!m_pcEncCfg->getUseEarlySkipDetection()) 701 480 { 702 481 // 2Nx2N, NxN 703 #if NH_3D_IC704 rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);705 #endif706 #if NH_3D_FAST_TEXTURE_ENCODING707 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N DEBUG_STRING_PASS_INTO(sDebug), bFMD ); rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );708 #else709 482 710 483 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N DEBUG_STRING_PASS_INTO(sDebug) ); 711 484 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 712 #endif713 #if NH_3D_VSP || NH_3D_DBBP714 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);715 #endif716 #if NH_3D_DBBP717 if( rpcTempCU->getSlice()->getDepthBasedBlkPartFlag() && rpcTempCU->getSlice()->getDefaultRefViewIdxAvailableFlag() )718 {719 xCheckRDCostInterDBBP( rpcBestCU, rpcTempCU DEBUG_STRING_PASS_INTO(sDebug), false );720 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );721 #if NH_3D_VSP || NH_3D_DBBP722 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);723 #endif724 }725 #endif726 485 727 486 if(m_pcEncCfg->getUseCbfFastMode()) … … 730 489 } 731 490 } 732 #if NH_3D_IC733 }734 #endif735 491 } 736 #if NH_3D_QTLPC737 if(depthMapDetect && !bIntraSliceDetect && !rapPic && ( m_pcEncCfg->getUseQTL() || bLimQtPredFalg ))738 {739 bTrySplitDQP = bTrySplit;740 }741 #endif742 492 743 493 if (bIsLosslessMode) // Restore loop variable if lossless mode was searched. … … 747 497 } 748 498 749 #if KWU_RC_MADPRED_E0227750 if ( uiDepth <= m_addSADDepth )751 {752 m_LCUPredictionSAD += m_temporalSAD;753 m_addSADDepth = uiDepth;754 }755 #endif756 #if NH_3D_ENC_DEPTH757 if( rpcBestCU->getSlice()->getIsDepth() && rpcBestCU->getSlice()->isIRAP() )758 {759 earlyDetectionSkipMode = false;760 }761 #endif762 #if NH_3D_DIS763 rpcTempCU->initEstData( uiDepth, iMinQP, isAddLowestQP );764 if( rpcBestCU->getSlice()->getDepthIntraSkipFlag() )765 {766 xCheckRDCostDIS( rpcBestCU, rpcTempCU, SIZE_2Nx2N DEBUG_STRING_PASS_INTO(sDebug) );767 rpcTempCU->initEstData( uiDepth, iMinQP, isAddLowestQP );768 }769 #endif770 499 if(!earlyDetectionSkipMode) 771 500 { … … 789 518 { 790 519 if( uiDepth == sps.getLog2DiffMaxMinCodingBlockSize() && doNotBlockPu 791 #if NH_3D_QTLPC792 && bTrySplit793 #endif794 520 ) 795 521 { 796 #if NH_3D_FAST_TEXTURE_ENCODING797 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_NxN DEBUG_STRING_PASS_INTO(sDebug), bFMD );798 #else799 522 800 523 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_NxN DEBUG_STRING_PASS_INTO(sDebug) ); 801 #endif802 524 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 803 #if NH_3D_VSP || NH_3D_DBBP804 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);805 #endif806 525 807 526 } … … 809 528 810 529 if(doNotBlockPu 811 #if NH_3D_QTLPC812 && bTryNx2N813 #endif814 530 ) 815 531 { 816 #if NH_3D_FAST_TEXTURE_ENCODING817 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_Nx2N DEBUG_STRING_PASS_INTO(sDebug), bFMD );818 #else819 532 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_Nx2N DEBUG_STRING_PASS_INTO(sDebug) ); 820 #endif821 533 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 822 #if NH_3D_VSP || NH_3D_DBBP823 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);824 #endif825 534 826 535 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_Nx2N ) … … 830 539 } 831 540 if(doNotBlockPu 832 #if NH_3D_QTLPC833 && bTry2NxN834 #endif835 541 ) 836 542 { 837 #if NH_3D_FAST_TEXTURE_ENCODING838 xCheckRDCostInter ( rpcBestCU, rpcTempCU, SIZE_2NxN DEBUG_STRING_PASS_INTO(sDebug), bFMD );839 #else840 543 841 544 xCheckRDCostInter ( rpcBestCU, rpcTempCU, SIZE_2NxN DEBUG_STRING_PASS_INTO(sDebug) ); 842 #endif843 545 844 546 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 845 #if NH_3D_VSP || NH_3D_DBBP846 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);847 #endif848 547 849 548 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxN) … … 871 570 { 872 571 if(doNotBlockPu 873 #if NH_3D_QTLPC874 && bTry2NxN875 #endif876 572 ) 877 573 { 878 #if NH_3D_FAST_TEXTURE_ENCODING879 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU DEBUG_STRING_PASS_INTO(sDebug), bFMD );880 #else881 574 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU DEBUG_STRING_PASS_INTO(sDebug) ); 882 #endif883 575 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 884 #if NH_3D_VSP || NH_3D_DBBP885 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);886 #endif887 576 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnU ) 888 577 { … … 891 580 } 892 581 if(doNotBlockPu 893 #if NH_3D_QTLPC894 && bTry2NxN895 #endif896 582 ) 897 583 { 898 #if NH_3D_FAST_TEXTURE_ENCODING899 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD DEBUG_STRING_PASS_INTO(sDebug), bFMD );900 #else901 584 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD DEBUG_STRING_PASS_INTO(sDebug) ); 902 #endif903 585 904 586 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 905 #if NH_3D_VSP || NH_3D_DBBP906 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);907 #endif908 587 909 588 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnD ) … … 917 596 { 918 597 if(doNotBlockPu 919 #if NH_3D_QTLPC920 && bTry2NxN921 #endif922 598 ) 923 599 { 924 #if NH_3D_FAST_TEXTURE_ENCODING925 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU DEBUG_STRING_PASS_INTO(sDebug), bFMD, true );926 #else927 600 928 601 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU DEBUG_STRING_PASS_INTO(sDebug), true ); 929 #endif930 602 931 603 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 932 #if NH_3D_VSP || NH_3D_DBBP933 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);934 #endif935 604 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnU ) 936 605 { … … 939 608 } 940 609 if(doNotBlockPu 941 #if NH_3D_QTLPC942 && bTry2NxN943 #endif944 610 ) 945 611 { 946 #if NH_3D_FAST_TEXTURE_ENCODING947 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD DEBUG_STRING_PASS_INTO(sDebug), bFMD, true );948 #else949 612 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD DEBUG_STRING_PASS_INTO(sDebug), true ); 950 #endif951 613 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 952 #if NH_3D_VSP || NH_3D_DBBP953 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);954 #endif955 614 956 615 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnD ) … … 966 625 { 967 626 if(doNotBlockPu 968 #if NH_3D_QTLPC969 && bTryNx2N970 #endif971 627 ) 972 628 { 973 #if NH_3D_FAST_TEXTURE_ENCODING974 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N DEBUG_STRING_PASS_INTO(sDebug), bFMD );975 #else976 629 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N DEBUG_STRING_PASS_INTO(sDebug) ); 977 #endif978 630 979 631 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 980 #if NH_3D_VSP || NH_3D_DBBP981 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);982 #endif983 632 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_nLx2N ) 984 633 { … … 987 636 } 988 637 if(doNotBlockPu 989 #if NH_3D_QTLPC990 && bTryNx2N991 #endif992 638 ) 993 639 { 994 #if NH_3D_FAST_TEXTURE_ENCODING995 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N DEBUG_STRING_PASS_INTO(sDebug), bFMD );996 #else997 640 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N DEBUG_STRING_PASS_INTO(sDebug) ); 998 #endif999 641 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1000 #if NH_3D_VSP || NH_3D_DBBP1001 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);1002 #endif1003 642 } 1004 643 } … … 1007 646 { 1008 647 if(doNotBlockPu 1009 #if NH_3D_QTLPC1010 && bTryNx2N1011 #endif1012 648 ) 1013 649 { 1014 #if NH_3D_FAST_TEXTURE_ENCODING1015 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N DEBUG_STRING_PASS_INTO(sDebug), bFMD, true );1016 #else1017 650 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N DEBUG_STRING_PASS_INTO(sDebug), true ); 1018 #endif1019 651 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1020 #if NH_3D_VSP || NH_3D_DBBP1021 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);1022 #endif1023 652 if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_nLx2N ) 1024 653 { … … 1027 656 } 1028 657 if(doNotBlockPu 1029 #if NH_3D_QTLPC1030 && bTryNx2N1031 #endif1032 658 ) 1033 659 { 1034 #if NH_3D_FAST_TEXTURE_ENCODING1035 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N DEBUG_STRING_PASS_INTO(sDebug), bFMD, true );1036 #else1037 660 1038 661 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N DEBUG_STRING_PASS_INTO(sDebug), true ); 1039 #endif1040 662 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1041 #if NH_3D_VSP || NH_3D_DBBP1042 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);1043 #endif1044 663 1045 664 } … … 1048 667 1049 668 #else 1050 #if NH_3D_QTLPC1051 if (bTry2NxN)1052 {1053 #endif1054 669 1055 670 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU ); 1056 671 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1057 #if NH_3D_VSP || NH_3D_DBBP1058 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);1059 #endif1060 672 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD ); 1061 673 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1062 #if NH_3D_VSP || NH_3D_DBBP1063 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);1064 #endif1065 #if NH_3D_QTLPC1066 }1067 if (bTryNx2N)1068 {1069 #endif1070 674 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N ); 1071 675 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1072 #if NH_3D_VSP || NH_3D_DBBP1073 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);1074 #endif1075 676 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N ); 1076 677 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1077 #if NH_3D_VSP || NH_3D_DBBP1078 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);1079 #endif1080 #if NH_3D_QTLPC1081 }1082 #endif1083 678 1084 679 … … 1086 681 } 1087 682 } 1088 #if NH_3D_FAST_TEXTURE_ENCODING1089 if(!bFMD)1090 {1091 #endif1092 683 1093 684 // do normal intra modes … … 1100 691 ((rpcBestCU->getCbf( 0, COMPONENT_Cb ) != 0) && (numberValidComponents > COMPONENT_Cb)) || 1101 692 ((rpcBestCU->getCbf( 0, COMPONENT_Cr ) != 0) && (numberValidComponents > COMPONENT_Cr)) // avoid very complex intra if it is unlikely 1102 #if NH_3D_ENC_DEPTH1103 || rpcBestCU->getSlice()->getIsDepth()1104 #endif1105 693 ))) 1106 694 { 1107 #if NH_3D_ENC_DEPTH1108 Bool bOnlyIVP = false;1109 Bool bUseIVP = true;1110 if( (rpcBestCU->getSlice()->getSliceType() != I_SLICE) &&1111 !( (rpcBestCU->getCbf( 0, COMPONENT_Y ) != 0) ||1112 ((rpcBestCU->getCbf( 0, COMPONENT_Cb ) != 0) && (numberValidComponents > COMPONENT_Cb)) ||1113 ((rpcBestCU->getCbf( 0, COMPONENT_Cr ) != 0) && (numberValidComponents > COMPONENT_Cr)) ) &&1114 (rpcBestCU->getSlice()->getIsDepth() && !(rpcBestCU->getSlice()->isIRAP())) )1115 {1116 bOnlyIVP = true;1117 bUseIVP = rpcBestCU->getSlice()->getIntraContourFlag();1118 }1119 if( bUseIVP )1120 {1121 xCheckRDCostIntra( rpcBestCU, rpcTempCU, intraCost, SIZE_2Nx2N DEBUG_STRING_PASS_INTO(sDebug), bOnlyIVP );1122 #else1123 695 xCheckRDCostIntra( rpcBestCU, rpcTempCU, intraCost, SIZE_2Nx2N DEBUG_STRING_PASS_INTO(sDebug) ); 1124 #endif1125 #if KWU_RC_MADPRED_E02271126 if ( uiDepth <= m_addSADDepth )1127 {1128 m_LCUPredictionSAD += m_spatialSAD;1129 m_addSADDepth = uiDepth;1130 }1131 #endif1132 696 1133 697 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1134 698 if( uiDepth == sps.getLog2DiffMaxMinCodingBlockSize() ) 1135 699 { 1136 #if NH_3D_QTLPC //Try IntraNxN1137 if(bTrySplit)1138 {1139 #endif1140 700 if( rpcTempCU->getWidth(0) > ( 1 << sps.getQuadtreeTULog2MinSize() ) ) 1141 701 { 1142 702 Double tmpIntraCost; 1143 #if NH_3D_ENC_DEPTH1144 xCheckRDCostIntra( rpcBestCU, rpcTempCU, tmpIntraCost, SIZE_NxN DEBUG_STRING_PASS_INTO(sDebug), bOnlyIVP );1145 #else1146 703 xCheckRDCostIntra( rpcBestCU, rpcTempCU, tmpIntraCost, SIZE_NxN DEBUG_STRING_PASS_INTO(sDebug) ); 1147 #endif1148 704 1149 705 intraCost = std::min(intraCost, tmpIntraCost); 1150 706 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1151 707 } 1152 #if NH_3D_QTLPC1153 }1154 #endif1155 708 } 1156 #if NH_3D_ENC_DEPTH1157 }1158 #endif1159 709 } 1160 710 … … 1166 716 UInt uiRawBits = getTotalBits(rpcBestCU->getWidth(0), rpcBestCU->getHeight(0), rpcBestCU->getPic()->getChromaFormat(), sps.getBitDepths().recon); 1167 717 UInt uiBestBits = rpcBestCU->getTotalBits(); 1168 #if NH_3D_VSO // M71169 Double dRDCostTemp = m_pcRdCost->getUseLambdaScaleVSO() ? m_pcRdCost->calcRdCostVSO(uiRawBits, 0) : m_pcRdCost->calcRdCost(uiRawBits, 0);1170 if((uiBestBits > uiRawBits) || (rpcBestCU->getTotalCost() > dRDCostTemp ))1171 #else1172 718 if((uiBestBits > uiRawBits) || (rpcBestCU->getTotalCost() > m_pcRdCost->calcRdCost(uiRawBits, 0))) 1173 #endif1174 719 1175 720 { … … 1178 723 } 1179 724 } 1180 #if NH_3D_FAST_TEXTURE_ENCODING1181 }1182 #endif1183 725 if (bIsLosslessMode) // Restore loop variable if lossless mode was searched. 1184 726 { … … 1195 737 rpcBestCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // split bits 1196 738 rpcBestCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 1197 #if NH_3D_VSO // M81198 if ( m_pcRdCost->getUseVSO() )1199 {1200 rpcBestCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcBestCU->getTotalBits(), rpcBestCU->getTotalDistortion() );1201 }1202 else1203 #endif1204 739 rpcBestCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcBestCU->getTotalBits(), rpcBestCU->getTotalDistortion() ); 1205 740 m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_NEXT_BEST]); 1206 741 } 1207 #if NH_3D_FAST_TEXTURE_ENCODING1208 if(rpcBestCU->getSlice()->getViewIndex() && !rpcBestCU->getSlice()->getIsDepth() && (uiDepth >=iIVFMaxD) && rpcBestCU->isSkipped(0))1209 {1210 bSubBranch = false;1211 }1212 #endif1213 742 } 1214 743 … … 1247 776 iMaxQP = iMinQP; // If all TUs are forced into using transquant bypass, do not loop here. 1248 777 } 1249 #if NH_3D_FAST_TEXTURE_ENCODING1250 bSubBranch = bSubBranch && (bBoundary || !( m_pcEncCfg->getUseEarlyCU() && rpcBestCU->getTotalCost()!=MAX_DOUBLE && rpcBestCU->isSkipped(0) ));1251 #else1252 778 const Bool bSubBranch = bBoundary || !( m_pcEncCfg->getUseEarlyCU() && rpcBestCU->getTotalCost()!=MAX_DOUBLE && rpcBestCU->isSkipped(0) ); 1253 #endif1254 #if NH_3D_QTLPC1255 if( bSubBranch && uiDepth < sps.getLog2DiffMaxMinCodingBlockSize() && (!getFastDeltaQp() || uiWidth > fastDeltaQPCuMaxSize || bBoundary) && bTrySplitDQP )1256 #else1257 779 if( bSubBranch && uiDepth < sps.getLog2DiffMaxMinCodingBlockSize() && (!getFastDeltaQp() || uiWidth > fastDeltaQPCuMaxSize || bBoundary)) 1258 #endif1259 780 { 1260 781 // further split … … 1265 786 rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 1266 787 1267 #if NH_3D_VSO // M91268 // reset Model1269 if( m_pcRdCost->getUseRenModel() )1270 {1271 UInt uiWidthOy = m_ppcOrigYuv[uiDepth]->getWidth ( COMPONENT_Y );1272 UInt uiHeightOy = m_ppcOrigYuv[uiDepth]->getHeight( COMPONENT_Y );1273 Pel* piSrc = m_ppcOrigYuv[uiDepth]->getAddr ( COMPONENT_Y, 0 );1274 UInt uiSrcStride = m_ppcOrigYuv[uiDepth]->getStride( COMPONENT_Y );1275 m_pcRdCost->setRenModelData( m_ppcBestCU[uiDepth], 0, piSrc, uiSrcStride, uiWidthOy, uiHeightOy );1276 }1277 #endif1278 788 UChar uhNextDepth = uiDepth+1; 1279 789 TComDataCU* pcSubBestPartCU = m_ppcBestCU[uhNextDepth]; … … 1281 791 DEBUG_STRING_NEW(sTempDebug) 1282 792 1283 #if NH_3D_ARP1284 m_ppcWeightedTempCU[uhNextDepth]->setSlice( m_ppcWeightedTempCU[ uiDepth]->getSlice());1285 m_ppcWeightedTempCU[uhNextDepth]->setPic ( m_ppcWeightedTempCU[ uiDepth] );1286 #endif1287 793 for ( UInt uiPartUnitIdx = 0; uiPartUnitIdx < 4; uiPartUnitIdx++ ) 1288 794 { … … 1336 842 rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 1337 843 } 1338 #if NH_3D_VSO // M101339 if ( m_pcRdCost->getUseVSO() )1340 {1341 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );1342 }1343 else1344 #endif1345 844 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 1346 845 … … 1365 864 rpcTempCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // dQP bits 1366 865 rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 1367 #if NH_3D_VSO // M111368 if ( m_pcRdCost->getUseLambdaScaleVSO())1369 {1370 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );1371 }1372 else1373 #endif1374 866 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 1375 867 … … 1411 903 } 1412 904 } 1413 #if NH_3D_VSO // M121414 if( m_pcRdCost->getUseRenModel() )1415 {1416 UInt uiWidthRy = m_ppcRecoYuvBest[uiDepth]->getWidth ( COMPONENT_Y );1417 UInt uiHeightRy = m_ppcRecoYuvBest[uiDepth]->getHeight ( COMPONENT_Y );1418 Pel* piSrc = m_ppcRecoYuvBest[uiDepth]->getAddr ( COMPONENT_Y, 0 );1419 UInt uiSrcStride = m_ppcRecoYuvBest[uiDepth]->getStride ( COMPONENT_Y );1420 m_pcRdCost->setRenModelData( rpcBestCU, 0, piSrc, uiSrcStride, uiWidthRy, uiHeightRy );1421 }1422 #endif1423 905 1424 906 DEBUG_STRING_APPEND(sDebug_, sDebug); … … 1592 1074 1593 1075 m_pcEntropyCoder->encodeMergeIndex( pcCU, uiAbsPartIdx ); 1594 #if NH_3D_ARP1595 m_pcEntropyCoder->encodeARPW( pcCU , uiAbsPartIdx );1596 #endif1597 #if NH_3D_IC1598 m_pcEntropyCoder->encodeICFlag ( pcCU, uiAbsPartIdx );1599 #endif1600 1076 1601 1077 finishCU(pcCU,uiAbsPartIdx); … … 1603 1079 } 1604 1080 1605 #if NH_3D_DIS1606 m_pcEntropyCoder->encodeDIS( pcCU, uiAbsPartIdx );1607 if(!pcCU->getDISFlag(uiAbsPartIdx))1608 {1609 #endif1610 1081 m_pcEntropyCoder->encodePredMode( pcCU, uiAbsPartIdx ); 1611 1082 m_pcEntropyCoder->encodePartSize( pcCU, uiAbsPartIdx, uiDepth ); … … 1617 1088 if(pcCU->getIPCMFlag(uiAbsPartIdx)) 1618 1089 { 1619 #if NH_3D_SDC_INTRA1620 m_pcEntropyCoder->encodeSDCFlag( pcCU, uiAbsPartIdx );1621 #endif1622 1090 1623 1091 // Encode slice finish … … 1629 1097 // prediction Info ( Intra : direction mode, Inter : Mv, reference idx ) 1630 1098 m_pcEntropyCoder->encodePredInfo( pcCU, uiAbsPartIdx ); 1631 #if NH_3D_DBBP1632 m_pcEntropyCoder->encodeDBBPFlag( pcCU, uiAbsPartIdx );1633 #endif1634 #if NH_3D_SDC_INTRA1635 m_pcEntropyCoder->encodeSDCFlag( pcCU, uiAbsPartIdx );1636 #endif1637 #if NH_3D_ARP1638 m_pcEntropyCoder->encodeARPW( pcCU , uiAbsPartIdx );1639 #endif1640 #if NH_3D_IC1641 m_pcEntropyCoder->encodeICFlag ( pcCU, uiAbsPartIdx );1642 #endif1643 1099 1644 1100 // Encode Coefficients … … 1648 1104 setCodeChromaQpAdjFlag( codeChromaQpAdj ); 1649 1105 setdQPFlag( bCodeDQP ); 1650 #if NH_3D_DIS1651 }1652 #endif1653 1106 1654 1107 … … 1789 1242 #endif 1790 1243 1791 #if NH_3D_MLC1792 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists1793 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];1794 #else1795 1244 TComMvField cMvFieldNeighbours[2 * MRG_MAX_NUM_CANDS]; // double length for mv of both lists 1796 1245 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; 1797 #endif1798 1246 Int numValidMergeCand = 0; 1799 1247 const Bool bTransquantBypassFlag = rpcTempCU->getCUTransquantBypass(0); … … 1804 1252 } 1805 1253 UChar uhDepth = rpcTempCU->getDepth( 0 ); 1806 #if NH_3D_IC 1807 Bool bICFlag = rpcTempCU->getICFlag( 0 ); 1808 #endif 1809 #if NH_3D_VSO // M1 //necessary here? 1810 if( m_pcRdCost->getUseRenModel() ) 1811 { 1812 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth ( COMPONENT_Y ); 1813 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight( COMPONENT_Y ); 1814 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getAddr ( COMPONENT_Y ); 1815 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride( COMPONENT_Y ); 1816 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 1817 } 1818 #endif 1819 1820 #if NH_3D_ARP 1821 DisInfo cOrigDisInfo = rpcTempCU->getDvInfo(0); 1822 #else 1823 #endif 1254 1824 1255 1825 1256 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to CTU level 1826 1257 1827 #if NH_3D_SPIVMP 1828 Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM]; 1829 memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM); 1830 TComMvField* pcMvFieldSP; 1831 UChar* puhInterDirSP; 1832 pcMvFieldSP = new TComMvField[rpcTempCU->getPic()->getPicSym()->getNumPartitionsInCtu()*2]; 1833 puhInterDirSP = new UChar[rpcTempCU->getPic()->getPicSym()->getNumPartitionsInCtu()]; 1834 #endif 1835 1836 #if NH_3D_VSP 1837 #if !NH_3D_ARP 1838 Int vspFlag[MRG_MAX_NUM_CANDS_MEM]; 1839 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); 1840 #if NH_3D_MLC 1841 rpcTempCU->initAvailableFlags(); 1842 #endif 1843 rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); 1844 #if NH_3D_MLC 1845 rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours 1846 #if NH_3D_SPIVMP 1847 , pcMvFieldSP, puhInterDirSP 1848 #endif 1849 , numValidMergeCand 1850 ); 1851 1852 rpcTempCU->buildMCL( cMvFieldNeighbours,uhInterDirNeighbours, vspFlag 1853 #if NH_3D_SPIVMP 1854 , bSPIVMPFlag 1855 #endif 1856 , numValidMergeCand 1857 ); 1858 #endif 1859 #endif 1860 #else 1861 #if NH_3D_MLC 1862 rpcTempCU->initAvailableFlags(); 1863 #endif 1258 1864 1259 rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand ); 1865 #if NH_3D_MLC 1866 rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours 1867 #if H_3D_SPIVMP 1868 , pcMvFieldSP, puhInterDirSP 1869 #endif 1870 , numValidMergeCand 1871 ); 1872 #if NH_3D_MLC 1873 rpcTempCU->buildMCL( cMvFieldNeighbours,uhInterDirNeighbours 1874 #if H_3D_SPIVMP 1875 , bSPIVMPFlag 1876 #endif 1877 , numValidMergeCand 1878 ); 1879 #endif 1880 #endif 1881 #endif 1882 1883 #if NH_3D_MLC 1884 Int mergeCandBuffer[MRG_MAX_NUM_CANDS_MEM]; 1885 #else 1260 1886 1261 Int mergeCandBuffer[MRG_MAX_NUM_CANDS]; 1887 #endif1888 #if NH_3D_MLC1889 for( UInt ui = 0; ui < rpcTempCU->getSlice()->getMaxNumMergeCand(); ++ui )1890 #else1891 1262 for( UInt ui = 0; ui < numValidMergeCand; ++ui ) 1892 #endif1893 1263 { 1894 1264 mergeCandBuffer[ui] = 0; … … 1908 1278 DEBUG_STRING_NEW(bestStr) 1909 1279 1910 #if NH_3D_ARP1911 Int nARPWMax = rpcTempCU->getSlice()->getARPStepNum() - 1;1912 #if NH_3D_IC1913 if( nARPWMax < 0 || bICFlag )1914 #else1915 if( nARPWMax < 0 )1916 #endif1917 {1918 nARPWMax = 0;1919 }1920 for( Int nARPW=nARPWMax; nARPW >= 0 ; nARPW-- )1921 {1922 #if NH_3D1923 #if DEBUG_STRING1924 bestStr.clear();1925 #endif1926 #endif1927 #if NH_3D_IV_MERGE1928 memset( mergeCandBuffer, 0, MRG_MAX_NUM_CANDS_MEM*sizeof(Int) );1929 #else1930 memset( mergeCandBuffer, 0, MRG_MAX_NUM_CANDS * sizeof(Int) );1931 #endif1932 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level1933 rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth );1934 #if NH_3D_IC1935 rpcTempCU->setICFlagSubParts( bICFlag, 0, 0, uhDepth );1936 #endif1937 rpcTempCU->getDvInfo(0) = cOrigDisInfo;1938 rpcTempCU->setDvInfoSubParts(cOrigDisInfo, 0, uhDepth );1939 #if NH_3D_VSP1940 Int vspFlag[MRG_MAX_NUM_CANDS_MEM];1941 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);1942 #endif1943 #if NH_3D1944 #if NH_3D_MLC1945 rpcTempCU->initAvailableFlags();1946 #endif1947 rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );1948 rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours1949 #if NH_3D_SPIVMP1950 , pcMvFieldSP, puhInterDirSP1951 #endif1952 , numValidMergeCand1953 );1954 1955 rpcTempCU->buildMCL( cMvFieldNeighbours,uhInterDirNeighbours1956 #if NH_3D_VSP1957 , vspFlag1958 #endif1959 #if NH_3D_SPIVMP1960 , bSPIVMPFlag1961 #endif1962 , numValidMergeCand1963 );1964 1965 #else1966 rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand );1967 #endif1968 1969 1970 #endif1971 1280 1972 1281 for( UInt uiNoResidual = 0; uiNoResidual < iteration; ++uiNoResidual ) … … 1978 1287 for( UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand ) 1979 1288 { 1980 #if NH_3D_IC1981 if( rpcTempCU->getSlice()->getApplyIC() && rpcTempCU->getSlice()->getIcSkipParseFlag() )1982 {1983 if( bICFlag && uiMergeCand == 0 )1984 {1985 continue;1986 }1987 }1988 #endif1989 1289 #if NH_MV 1990 1290 D_PRINT_INC_INDENT ( g_traceModeCheck, "uiMergeCand: "+ n2s(uiMergeCand) ); … … 1998 1298 // set MC parameters 1999 1299 rpcTempCU->setPredModeSubParts( MODE_INTER, 0, uhDepth ); // interprets depth relative to CTU level 2000 #if NH_3D_IC2001 rpcTempCU->setICFlagSubParts( bICFlag, 0, 0, uhDepth );2002 #endif2003 1300 rpcTempCU->setCUTransquantBypassSubParts( bTransquantBypassFlag, 0, uhDepth ); 2004 1301 rpcTempCU->setChromaQpAdjSubParts( bTransquantBypassFlag ? 0 : m_cuChromaQpOffsetIdxPlus1, 0, uhDepth ); … … 2006 1303 rpcTempCU->setMergeFlagSubParts( true, 0, 0, uhDepth ); // interprets depth relative to CTU level 2007 1304 rpcTempCU->setMergeIndexSubParts( uiMergeCand, 0, 0, uhDepth ); // interprets depth relative to CTU level 2008 #if NH_3D_ARP 2009 rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth ); 2010 #endif 2011 2012 #if NH_3D_VSP 2013 rpcTempCU->setVSPFlagSubParts( vspFlag[uiMergeCand], 0, 0, uhDepth ); 2014 #endif 2015 #if NH_3D_SPIVMP 2016 rpcTempCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeCand], 0, 0, uhDepth); 2017 if (bSPIVMPFlag[uiMergeCand]) 1305 2018 1306 { 2019 UInt uiSPAddr;2020 Int iWidth = rpcTempCU->getWidth(0);2021 Int iHeight = rpcTempCU->getHeight(0);2022 Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;2023 rpcTempCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);2024 for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++)2025 {2026 rpcTempCU->getSPAbsPartIdx(0, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr);2027 rpcTempCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight);2028 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(rpcTempCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight);2029 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(rpcTempCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight);2030 }2031 }2032 else2033 #endif2034 {2035 #if NH_3D_VSP2036 if ( vspFlag[uiMergeCand] )2037 {2038 UInt partAddr;2039 Int vspSize;2040 Int width, height;2041 rpcTempCU->getPartIndexAndSize( 0, partAddr, width, height );2042 if( uhInterDirNeighbours[ uiMergeCand ] & 0x01 )2043 {2044 rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_0, cMvFieldNeighbours[ 2*uiMergeCand + 0 ].getRefIdx(), vspSize );2045 rpcTempCU->setVSPFlag( partAddr, vspSize );2046 }2047 else2048 {2049 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level2050 }2051 if( uhInterDirNeighbours[ uiMergeCand ] & 0x02 )2052 {2053 rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_1 , cMvFieldNeighbours[ 2*uiMergeCand + 1 ].getRefIdx(), vspSize );2054 rpcTempCU->setVSPFlag( partAddr, vspSize );2055 }2056 else2057 {2058 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level2059 }2060 rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level2061 }2062 else2063 {2064 #endif2065 1307 rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to CTU level 2066 1308 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 2067 1309 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level 2068 #if NH_3D_VSP2069 }2070 #endif2071 1310 } 2072 1311 // do MC 2073 1312 m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] ); 2074 1313 // estimate residual and encode everything 2075 #if NH_3D_VSO //M22076 if( m_pcRdCost->getUseRenModel() )2077 { //Reset2078 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth ( COMPONENT_Y );2079 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight ( COMPONENT_Y );2080 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getAddr ( COMPONENT_Y );2081 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride ( COMPONENT_Y );2082 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );2083 }2084 #endif2085 1314 m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, 2086 1315 m_ppcOrigYuv [uhDepth], … … 2100 1329 mergeCandBuffer[uiMergeCand] = 1; 2101 1330 } 2102 #if NH_3D_DIS2103 rpcTempCU->setDISFlagSubParts( false, 0, uhDepth );2104 #endif2105 #if NH_3D_VSP2106 if( rpcTempCU->getSkipFlag(0) )2107 {2108 rpcTempCU->setTrIdxSubParts(0, 0, uhDepth);2109 }2110 #endif2111 #if NH_3D_SDC_INTER2112 TComDataCU *rpcTempCUPre = rpcTempCU;2113 #endif2114 1331 Int orgQP = rpcTempCU->getQP( 0 ); 2115 1332 xCheckDQP( rpcTempCU ); 2116 1333 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth DEBUG_STRING_PASS_INTO(bestStr) DEBUG_STRING_PASS_INTO(tmpStr)); 2117 #if NH_3D_SDC_INTER2118 if( rpcTempCU->getSlice()->getInterSdcFlag() && !uiNoResidual )2119 {2120 Double dOffsetCost[3] = {MAX_DOUBLE,MAX_DOUBLE,MAX_DOUBLE};2121 for( Int uiOffest = 1 ; uiOffest <= 5 ; uiOffest++ )2122 {2123 if( uiOffest > 3)2124 {2125 if ( dOffsetCost[0] < (0.9*dOffsetCost[1]) && dOffsetCost[0] < (0.9*dOffsetCost[2]) )2126 {2127 continue;2128 }2129 if ( dOffsetCost[1] < dOffsetCost[0] && dOffsetCost[0] < dOffsetCost[2] && uiOffest == 5)2130 {2131 continue;2132 }2133 if ( dOffsetCost[0] < dOffsetCost[1] && dOffsetCost[2] < dOffsetCost[0] && uiOffest == 4)2134 {2135 continue;2136 }2137 }2138 if( rpcTempCU != rpcTempCUPre )2139 {2140 rpcTempCU->initEstData( uhDepth, orgQP, bTransquantBypassFlag );2141 rpcTempCU->copyPartFrom( rpcBestCU, 0, uhDepth );2142 }2143 rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );2144 #if NH_3D_DIS2145 rpcTempCU->setDISFlagSubParts( false, 0, uhDepth );2146 #endif2147 rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth );2148 rpcTempCU->setCbfSubParts( 1, COMPONENT_Y, 0, uhDepth );2149 #if NH_3D_VSO //M22150 if( m_pcRdCost->getUseRenModel() )2151 { //Reset2152 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth ( COMPONENT_Y );2153 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight ( COMPONENT_Y );2154 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getAddr ( COMPONENT_Y );2155 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride ( COMPONENT_Y );2156 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );2157 }2158 #endif2159 Int iSdcOffset = 0;2160 if(uiOffest % 2 == 0)2161 {2162 iSdcOffset = uiOffest >> 1;2163 }2164 else2165 {2166 iSdcOffset = -1 * (uiOffest >> 1);2167 }2168 m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU,2169 m_ppcOrigYuv[uhDepth],2170 ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth],2171 m_ppcResiYuvTemp[uhDepth],2172 m_ppcRecoYuvTemp[uhDepth],2173 iSdcOffset,2174 uhDepth );2175 if (uiOffest <= 3 )2176 {2177 dOffsetCost [uiOffest -1] = rpcTempCU->getTotalCost();2178 }2179 2180 xCheckDQP( rpcTempCU );2181 xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth DEBUG_STRING_PASS_INTO(bestStr) DEBUG_STRING_PASS_INTO(tmpStr) );2182 }2183 }2184 #endif2185 1334 2186 1335 rpcTempCU->initEstData( uhDepth, orgQP, bTransquantBypassFlag ); … … 2188 1337 if( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip ) 2189 1338 { 2190 #if NH_3D_SDC_INTER2191 if( rpcTempCU->getSlice()->getInterSdcFlag() )2192 {2193 bestIsSkip = !rpcBestCU->getSDCFlag( 0 ) && ( rpcBestCU->getQtRootCbf(0) == 0 );2194 }2195 else2196 {2197 #endif2198 1339 bestIsSkip = rpcBestCU->getQtRootCbf(0) == 0; 2199 #if NH_3D_SDC_INTER2200 }2201 #endif2202 1340 } 2203 1341 } … … 2242 1380 } 2243 1381 DEBUG_STRING_APPEND(sDebug, bestStr) 2244 #if NH_3D_ARP2245 }2246 #endif2247 #if NH_3D_SPIVMP2248 delete[] pcMvFieldSP;2249 delete[] puhInterDirSP;2250 #endif2251 1382 #if NH_MV 2252 1383 D_DEC_INDENT( g_traceModeCheck ); … … 2256 1387 2257 1388 #if AMP_MRG 2258 #if NH_3D_FAST_TEXTURE_ENCODING2259 Void TEncCu::xCheckRDCostInter( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize DEBUG_STRING_FN_DECLARE(sDebug), Bool bFMD, Bool bUseMRG)2260 #else2261 1389 Void TEncCu::xCheckRDCostInter( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize DEBUG_STRING_FN_DECLARE(sDebug), Bool bUseMRG) 2262 #endif2263 1390 #else 2264 1391 Void TEncCu::xCheckRDCostInter( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize ) … … 2283 1410 2284 1411 // prior to this, rpcTempCU will have just been reset using rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode ); 2285 #if NH_3D_ARP2286 const Bool bTransquantBypassFlag = rpcTempCU->getCUTransquantBypass(0);2287 #endif2288 #if NH_3D_FAST_TEXTURE_ENCODING2289 if(!(bFMD && (ePartSize == SIZE_2Nx2N))) //have motion estimation or merge check2290 {2291 #endif2292 1412 UChar uhDepth = rpcTempCU->getDepth( 0 ); 2293 #if NH_3D_ARP2294 Bool bFirstTime = true;2295 Int nARPWMax = rpcTempCU->getSlice()->getARPStepNum() - 1;2296 #if NH_3D_IC2297 if( nARPWMax < 0 || ePartSize != SIZE_2Nx2N || rpcTempCU->getICFlag(0) )2298 #else2299 if( nARPWMax < 0 || ePartSize != SIZE_2Nx2N )2300 #endif2301 {2302 nARPWMax = 0;2303 }2304 2305 for( Int nARPW = 0; nARPW <= nARPWMax; nARPW++ )2306 {2307 #if DEBUG_STRING && H_MV_ENC_DEC_TRAC2308 sTest.clear();2309 #endif2310 2311 if( !bFirstTime && rpcTempCU->getSlice()->getIvResPredFlag() )2312 {2313 rpcTempCU->initEstData( rpcTempCU->getDepth(0), rpcTempCU->getQP(0),bTransquantBypassFlag );2314 }2315 #endif2316 #if NH_3D_VSO // M32317 if( m_pcRdCost->getUseRenModel() )2318 {2319 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth ( COMPONENT_Y );2320 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight( COMPONENT_Y );2321 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getAddr ( COMPONENT_Y );2322 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride( COMPONENT_Y );2323 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );2324 }2325 #endif2326 #if NH_3D_DIS2327 rpcTempCU->setDISFlagSubParts( false, 0, uhDepth );2328 #endif2329 1413 rpcTempCU->setPartSizeSubParts ( ePartSize, 0, uhDepth ); 2330 1414 rpcTempCU->setPredModeSubParts ( MODE_INTER, 0, uhDepth ); 2331 1415 rpcTempCU->setChromaQpAdjSubParts( rpcTempCU->getCUTransquantBypass(0) ? 0 : m_cuChromaQpOffsetIdxPlus1, 0, uhDepth ); 2332 #if NH_3D_ARP2333 rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth );2334 #endif2335 #if NH_3D_ARP2336 if( bFirstTime == false && nARPWMax )2337 {2338 rpcTempCU->copyPartFrom( m_ppcWeightedTempCU[uhDepth] , 0 , uhDepth );2339 rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth );2340 2341 m_pcPredSearch->motionCompensation( rpcTempCU , m_ppcPredYuvTemp[uhDepth] );2342 }2343 else2344 {2345 bFirstTime = false;2346 #endif2347 1416 #if AMP_MRG 2348 1417 rpcTempCU->setMergeAMP (true); 2349 #if NH_3D_FAST_TEXTURE_ENCODING2350 m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth] DEBUG_STRING_PASS_INTO(sTest), bFMD, false, bUseMRG );2351 #else2352 1418 m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth] DEBUG_STRING_PASS_INTO(sTest), false, bUseMRG ); 2353 #endif2354 1419 2355 1420 #else 2356 1421 m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth] ); 2357 1422 #endif 2358 #if NH_3D_ARP2359 if( nARPWMax )2360 {2361 m_ppcWeightedTempCU[uhDepth]->copyPartFrom( rpcTempCU , 0 , uhDepth );2362 }2363 }2364 #endif2365 1423 2366 1424 #if AMP_MRG 2367 1425 if ( !rpcTempCU->getMergeAMP() ) 2368 1426 { 2369 #if NH_3D_ARP2370 if( nARPWMax )2371 {2372 continue;2373 }2374 else2375 #endif2376 1427 { 2377 1428 #if NH_MV … … 2382 1433 } 2383 1434 #endif 2384 #if KWU_RC_MADPRED_E02272385 if ( m_pcEncCfg->getUseRateCtrl() && m_pcEncCfg->getLCULevelRC() && ePartSize == SIZE_2Nx2N && uhDepth <= m_addSADDepth )2386 {2387 UInt SAD = m_pcRdCost->getSADPart( g_bitDepthY, m_ppcPredYuvTemp[uhDepth]->getLumaAddr(), m_ppcPredYuvTemp[uhDepth]->getStride(),2388 m_ppcOrigYuv[uhDepth]->getLumaAddr(), m_ppcOrigYuv[uhDepth]->getStride(),2389 rpcTempCU->getWidth(0), rpcTempCU->getHeight(0) );2390 m_temporalSAD = (Int)SAD;2391 }2392 #endif2393 1435 2394 1436 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) ); 2395 #if NH_3D_VSP2396 if( rpcTempCU->getQtRootCbf(0)==0 )2397 {2398 rpcTempCU->setTrIdxSubParts(0, 0, uhDepth);2399 }2400 #endif2401 #if NH_3D_VSO // M42402 if( m_pcRdCost->getUseLambdaScaleVSO() )2403 {2404 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );2405 }2406 else2407 #endif2408 1437 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 2409 1438 … … 2411 1440 DebugInterPredResiReco(sTest, *(m_ppcPredYuvTemp[uhDepth]), *(m_ppcResiYuvBest[uhDepth]), *(m_ppcRecoYuvTemp[uhDepth]), DebugStringGetPredModeMask(rpcTempCU->getPredictionMode(0))); 2412 1441 #endif 2413 #if NH_3D_SDC_INTER2414 TComDataCU *rpcTempCUPre = rpcTempCU;2415 #endif2416 1442 2417 1443 xCheckDQP( rpcTempCU ); 2418 1444 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth DEBUG_STRING_PASS_INTO(sDebug) DEBUG_STRING_PASS_INTO(sTest)); 2419 #if NH_3D_SDC_INTER2420 if( rpcTempCU->getSlice()->getInterSdcFlag() && ePartSize == SIZE_2Nx2N)2421 {2422 Double dOffsetCost[3] = {MAX_DOUBLE,MAX_DOUBLE,MAX_DOUBLE};2423 for( Int uiOffest = 1 ; uiOffest <= 5 ; uiOffest++ )2424 {2425 if( uiOffest > 3)2426 {2427 if ( dOffsetCost[0] < (0.9*dOffsetCost[1]) && dOffsetCost[0] < (0.9*dOffsetCost[2]) )2428 {2429 continue;2430 }2431 if ( dOffsetCost[1] < dOffsetCost[0] && dOffsetCost[0] < dOffsetCost[2] && uiOffest == 5)2432 {2433 continue;2434 }2435 if ( dOffsetCost[0] < dOffsetCost[1] && dOffsetCost[2] < dOffsetCost[0] && uiOffest == 4)2436 {2437 continue;2438 }2439 }2440 2441 if( rpcTempCU != rpcTempCUPre )2442 {2443 Int orgQP = rpcBestCU->getQP( 0 );2444 rpcTempCU->initEstData( uhDepth, orgQP ,bTransquantBypassFlag );2445 rpcTempCU->copyPartFrom( rpcBestCU, 0, uhDepth );2446 }2447 rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );2448 #if NH_3D_DIS2449 rpcTempCU->setDISFlagSubParts( false, 0, uhDepth );2450 #endif2451 rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth );2452 rpcTempCU->setCbfSubParts( 1, COMPONENT_Y, 0, uhDepth );2453 #if NH_3D_VSO // M32454 if( m_pcRdCost->getUseRenModel() )2455 {2456 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth ( COMPONENT_Y );2457 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight( COMPONENT_Y );2458 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getAddr ( COMPONENT_Y );2459 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride( COMPONENT_Y );2460 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );2461 }2462 #endif2463 2464 Int iSdcOffset = 0;2465 if(uiOffest % 2 == 0)2466 {2467 iSdcOffset = uiOffest >> 1;2468 }2469 else2470 {2471 iSdcOffset = -1 * (uiOffest >> 1);2472 }2473 m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU,2474 m_ppcOrigYuv[uhDepth],2475 ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth],2476 m_ppcResiYuvTemp[uhDepth],2477 m_ppcRecoYuvTemp[uhDepth],2478 iSdcOffset,2479 uhDepth );2480 if (uiOffest <= 3 )2481 {2482 dOffsetCost [uiOffest -1] = rpcTempCU->getTotalCost();2483 }2484 2485 xCheckDQP( rpcTempCU );2486 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth DEBUG_STRING_PASS_INTO(sDebug) DEBUG_STRING_PASS_INTO(sTest));2487 }2488 2489 }2490 #endif2491 #if NH_3D_ARP2492 }2493 #endif2494 #if NH_3D_FAST_TEXTURE_ENCODING2495 }2496 #endif2497 1445 #if NH_MV 2498 1446 D_DEC_INDENT( g_traceModeCheck ); … … 2500 1448 } 2501 1449 2502 #if NH_3D_DBBP 2503 Void TEncCu::xInvalidateOriginalSegments( TComYuv* pOrigYuv, TComYuv* pOrigYuvTemp, Bool* pMask, UInt uiValidSegment ) 2504 { 2505 UInt uiWidth = pOrigYuv->getWidth (COMPONENT_Y); 2506 UInt uiHeight = pOrigYuv->getHeight(COMPONENT_Y); 2507 Pel* piSrc = pOrigYuv->getAddr(COMPONENT_Y); 2508 UInt uiSrcStride = pOrigYuv->getStride(COMPONENT_Y); 2509 Pel* piDst = pOrigYuvTemp->getAddr(COMPONENT_Y); 2510 UInt uiDstStride = pOrigYuvTemp->getStride(COMPONENT_Y); 2511 2512 UInt uiMaskStride= MAX_CU_SIZE; 2513 2514 AOF( uiWidth == uiHeight ); 2515 2516 // backup pointer 2517 Bool* pMaskStart = pMask; 2518 2519 for (Int y=0; y<uiHeight; y++) 2520 { 2521 for (Int x=0; x<uiWidth; x++) 2522 { 2523 UChar ucSegment = (UChar)pMask[x]; 2524 AOF( ucSegment < 2 ); 2525 2526 piDst[x] = (ucSegment==uiValidSegment)?piSrc[x]:DBBP_INVALID_SHORT; 2527 } 2528 2529 piSrc += uiSrcStride; 2530 piDst += uiDstStride; 2531 pMask += uiMaskStride; 2532 } 2533 2534 // now invalidate chroma 2535 Pel* piSrcU = pOrigYuv->getAddr(COMPONENT_Cb); 2536 Pel* piSrcV = pOrigYuv->getAddr(COMPONENT_Cr); 2537 UInt uiSrcStrideC = pOrigYuv->getStride(COMPONENT_Cb); 2538 Pel* piDstU = pOrigYuvTemp->getAddr(COMPONENT_Cb); 2539 Pel* piDstV = pOrigYuvTemp->getAddr(COMPONENT_Cr); 2540 UInt uiDstStrideC = pOrigYuvTemp->getStride(COMPONENT_Cb); 2541 pMask = pMaskStart; 2542 2543 for (Int y=0; y<uiHeight/2; y++) 2544 { 2545 for (Int x=0; x<uiWidth/2; x++) 2546 { 2547 UChar ucSegment = (UChar)pMask[x*2]; 2548 AOF( ucSegment < 2 ); 2549 2550 piDstU[x] = (ucSegment==uiValidSegment)?piSrcU[x]:DBBP_INVALID_SHORT; 2551 piDstV[x] = (ucSegment==uiValidSegment)?piSrcV[x]:DBBP_INVALID_SHORT; 2552 } 2553 2554 piSrcU += uiSrcStrideC; 2555 piSrcV += uiSrcStrideC; 2556 piDstU += uiDstStrideC; 2557 piDstV += uiDstStrideC; 2558 pMask += 2*uiMaskStride; 2559 } 2560 } 2561 #endif 2562 2563 #if NH_3D_DBBP 2564 Void TEncCu::xCheckRDCostInterDBBP( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU DEBUG_STRING_FN_DECLARE(sDebug), Bool bUseMRG ) 2565 { 2566 DEBUG_STRING_NEW(sTest) 2567 AOF( !rpcTempCU->getSlice()->getIsDepth() ); 2568 2569 UChar uhDepth = rpcTempCU->getDepth( 0 ); 2570 2571 #if NH_3D_VSO 2572 if( m_pcRdCost->getUseRenModel() ) 2573 { 2574 UInt uiWidth = m_ppcOrigYuv[uhDepth]->getWidth ( COMPONENT_Y ); 2575 UInt uiHeight = m_ppcOrigYuv[uhDepth]->getHeight( COMPONENT_Y ); 2576 Pel* piSrc = m_ppcOrigYuv[uhDepth]->getAddr ( COMPONENT_Y ); 2577 UInt uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride( COMPONENT_Y ); 2578 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 2579 } 2580 #endif 2581 2582 UInt uiWidth = rpcTempCU->getWidth(0); 2583 UInt uiHeight = rpcTempCU->getHeight(0); 2584 AOF( uiWidth == uiHeight ); 2585 2586 #if NH_3D_DBBP 2587 if(uiWidth <= 8) 2588 { 2589 return; 2590 } 2591 #endif 2592 2593 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); 2594 2595 // fetch virtual depth block 2596 UInt uiDepthStride = 0; 2597 #if H_3D_FCO 2598 Pel* pDepthPels = rpcTempCU->getVirtualDepthBlock(rpcTempCU->getZorderIdxInCU(), uiWidth, uiHeight, uiDepthStride); 2599 #else 2600 Pel* pDepthPels = rpcTempCU->getVirtualDepthBlock(0, uiWidth, uiHeight, uiDepthStride); 2601 #endif 2602 AOF( pDepthPels != NULL ); 2603 AOF( uiDepthStride != 0 ); 2604 2605 PartSize eVirtualPartSize = m_pcPredSearch->getPartitionSizeFromDepth(pDepthPels, uiDepthStride, uiWidth, rpcTempCU); 2606 2607 // derive partitioning from depth 2608 Bool pMask[MAX_CU_SIZE*MAX_CU_SIZE]; 2609 Bool bValidMask = m_pcPredSearch->getSegmentMaskFromDepth(pDepthPels, uiDepthStride, uiWidth, uiHeight, pMask, rpcTempCU); 2610 2611 if( !bValidMask ) 2612 { 2613 return; 2614 } 2615 2616 // find optimal motion/disparity vector for each segment 2617 DisInfo originalDvInfo = rpcTempCU->getDvInfo(0); 2618 DbbpTmpData* pDBBPTmpData = rpcTempCU->getDBBPTmpData(); 2619 TComYuv* apPredYuv[2] = { m_ppcRecoYuvTemp[uhDepth], m_ppcPredYuvTemp[uhDepth] }; 2620 2621 // find optimal motion vector fields for both segments (as 2Nx2N) 2622 rpcTempCU->setDepthSubParts( uhDepth, 0 ); 2623 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); 2624 rpcTempCU->setPredModeSubParts( MODE_INTER, 0, uhDepth ); 2625 for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ ) 2626 { 2627 rpcTempCU->setDBBPFlagSubParts(true, 0, 0, uhDepth); 2628 rpcTempCU->setDvInfoSubParts(originalDvInfo, 0, uhDepth); 2629 2630 // invalidate all other segments in original YUV 2631 xInvalidateOriginalSegments(m_ppcOrigYuv[uhDepth], m_ppcOrigYuvDBBP[uhDepth], pMask, uiSegment); 2632 2633 // do motion estimation for this segment 2634 m_pcRdCost->setUseMask(true); 2635 rpcTempCU->getDBBPTmpData()->eVirtualPartSize = eVirtualPartSize; 2636 rpcTempCU->getDBBPTmpData()->uiVirtualPartIndex = uiSegment; 2637 m_pcPredSearch->predInterSearch( rpcTempCU, m_ppcOrigYuvDBBP[uhDepth], apPredYuv[uiSegment], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth] DEBUG_STRING_PASS_INTO(sTest), false, bUseMRG ); 2638 m_pcRdCost->setUseMask(false); 2639 2640 // extract motion parameters of full block for this segment 2641 pDBBPTmpData->auhInterDir[uiSegment] = rpcTempCU->getInterDir(0); 2642 2643 pDBBPTmpData->abMergeFlag[uiSegment] = rpcTempCU->getMergeFlag(0); 2644 pDBBPTmpData->auhMergeIndex[uiSegment] = rpcTempCU->getMergeIndex(0); 2645 2646 #if NH_3D_VSP 2647 AOF( rpcTempCU->getSPIVMPFlag(0) == false ); 2648 AOF( rpcTempCU->getVSPFlag(0) == 0 ); 2649 #endif 2650 2651 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) 2652 { 2653 RefPicList eRefList = (RefPicList)uiRefListIdx; 2654 2655 pDBBPTmpData->acMvd[uiSegment][eRefList] = rpcTempCU->getCUMvField(eRefList)->getMvd(0); 2656 pDBBPTmpData->aiMvpNum[uiSegment][eRefList] = rpcTempCU->getMVPNum(eRefList, 0); 2657 pDBBPTmpData->aiMvpIdx[uiSegment][eRefList] = rpcTempCU->getMVPIdx(eRefList, 0); 2658 2659 rpcTempCU->getMvField(rpcTempCU, 0, eRefList, pDBBPTmpData->acMvField[uiSegment][eRefList]); 2660 } 2661 } 2662 2663 // store final motion/disparity information in each PU using derived partitioning 2664 rpcTempCU->setDepthSubParts( uhDepth, 0 ); 2665 rpcTempCU->setPartSizeSubParts ( eVirtualPartSize, 0, uhDepth ); 2666 rpcTempCU->setPredModeSubParts ( MODE_INTER, 0, uhDepth ); 2667 2668 UInt uiPUOffset = ( g_auiPUOffset[UInt( eVirtualPartSize )] << ( ( rpcTempCU->getSlice()->getSPS()->getMaxTotalCUDepth() - uhDepth ) << 1 ) ) >> 4; 2669 for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ ) 2670 { 2671 UInt uiPartAddr = uiSegment*uiPUOffset; 2672 2673 rpcTempCU->setDBBPFlagSubParts(true, uiPartAddr, uiSegment, uhDepth); 2674 2675 // now set stored information from 2Nx2N motion search to each partition 2676 rpcTempCU->setInterDirSubParts(pDBBPTmpData->auhInterDir[uiSegment], uiPartAddr, uiSegment, uhDepth); // interprets depth relative to LCU level 2677 2678 rpcTempCU->setMergeFlagSubParts(pDBBPTmpData->abMergeFlag[uiSegment], uiPartAddr, uiSegment, uhDepth); 2679 rpcTempCU->setMergeIndexSubParts(pDBBPTmpData->auhMergeIndex[uiSegment], uiPartAddr, uiSegment, uhDepth); 2680 2681 for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) 2682 { 2683 RefPicList eRefList = (RefPicList)uiRefListIdx; 2684 2685 rpcTempCU->getCUMvField( eRefList )->setAllMvd(pDBBPTmpData->acMvd[uiSegment][eRefList], eVirtualPartSize, uiPartAddr, 0, uiSegment); 2686 rpcTempCU->setMVPNum(eRefList, uiPartAddr, pDBBPTmpData->aiMvpNum[uiSegment][eRefList]); 2687 rpcTempCU->setMVPIdx(eRefList, uiPartAddr, pDBBPTmpData->aiMvpIdx[uiSegment][eRefList]); 2688 2689 rpcTempCU->getCUMvField( eRefList )->setAllMvField( pDBBPTmpData->acMvField[uiSegment][eRefList], eVirtualPartSize, uiPartAddr, 0, uiSegment ); // interprets depth relative to rpcTempCU level 2690 } 2691 } 2692 2693 // reconstruct final prediction signal by combining both segments 2694 Int bitDepthY = rpcTempCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA); 2695 m_pcPredSearch->combineSegmentsWithMask(apPredYuv, m_ppcPredYuvTemp[uhDepth], pMask, uiWidth, uiHeight, 0, eVirtualPartSize, bitDepthY); 2696 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) ); 2697 2698 xCheckDQP( rpcTempCU ); 2699 xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth DEBUG_STRING_PASS_INTO(sDebug) DEBUG_STRING_PASS_INTO(sTest) ); 2700 } 2701 #endif 2702 #if NH_3D_DIS 2703 Void TEncCu::xCheckRDCostDIS( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize eSize DEBUG_STRING_FN_DECLARE(sDebug) ) 2704 { 2705 DEBUG_STRING_NEW(sTest) 2706 UInt uiDepth = rpcTempCU->getDepth( 0 ); 2707 if( !rpcBestCU->getSlice()->getIsDepth() || (eSize != SIZE_2Nx2N)) 2708 { 2709 return; 2710 } 2711 2712 #if NH_MV 2713 D_PRINT_INC_INDENT(g_traceModeCheck, "xCheckRDCostDIS" ); 2714 #endif 2715 2716 #if NH_3D_VSO // M5 2717 if( m_pcRdCost->getUseRenModel() ) 2718 { 2719 UInt uiWidth = m_ppcOrigYuv[uiDepth]->getWidth ( COMPONENT_Y ); 2720 UInt uiHeight = m_ppcOrigYuv[uiDepth]->getHeight ( COMPONENT_Y ); 2721 Pel* piSrc = m_ppcOrigYuv[uiDepth]->getAddr ( COMPONENT_Y ); 2722 UInt uiSrcStride = m_ppcOrigYuv[uiDepth]->getStride ( COMPONENT_Y ); 2723 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 2724 } 2725 #endif 2726 2727 rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth ); 2728 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); 2729 rpcTempCU->setPredModeSubParts( MODE_INTRA, 0, uiDepth ); 2730 rpcTempCU->setCUTransquantBypassSubParts( rpcTempCU->getCUTransquantBypass(0), 0, uiDepth ); 2731 2732 rpcTempCU->setTrIdxSubParts(0, 0, uiDepth); 2733 rpcTempCU->setCbfSubParts(0, COMPONENT_Y, 0, uiDepth); 2734 rpcTempCU->setDISFlagSubParts(true, 0, uiDepth); 2735 rpcTempCU->setIntraDirSubParts(CHANNEL_TYPE_LUMA, DC_IDX, 0, uiDepth); 2736 #if NH_3D_SDC_INTRA 2737 rpcTempCU->setSDCFlagSubParts( false, 0, uiDepth); 2738 #endif 2739 2740 UInt uiPreCalcDistC; 2741 m_pcPredSearch ->estIntraPredDIS ( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], uiPreCalcDistC, false ); 2742 2743 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC 2744 Int oldTraceCopyBack = g_traceCopyBack; 2745 g_traceCopyBack = false; 2746 #endif 2747 m_ppcRecoYuvTemp[uiDepth]->copyToPicComponent(COMPONENT_Y, rpcTempCU->getPic()->getPicYuvRec(), rpcTempCU->getCtuRsAddr(), rpcTempCU->getZorderIdxInCtu() ); 2748 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC 2749 g_traceCopyBack = oldTraceCopyBack; 2750 #endif 2751 2752 m_pcEntropyCoder->resetBits(); 2753 if ( rpcTempCU->getSlice()->getPPS()->getTransquantBypassEnableFlag()) 2754 { 2755 m_pcEntropyCoder->encodeCUTransquantBypassFlag( rpcTempCU, 0, true ); 2756 } 2757 m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0, true ); 2758 m_pcEntropyCoder->encodeDIS( rpcTempCU, 0, true ); 2759 2760 m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]); 2761 2762 rpcTempCU->getTotalBits() = m_pcEntropyCoder->getNumberOfWrittenBits(); 2763 rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 2764 2765 #if NH_3D_VSO // M6 2766 if( m_pcRdCost->getUseLambdaScaleVSO()) 2767 { 2768 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 2769 } 2770 else 2771 #endif 2772 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 2773 2774 xCheckDQP( rpcTempCU ); 2775 xCheckBestMode(rpcBestCU, rpcTempCU, uiDepth DEBUG_STRING_PASS_INTO(sDebug) DEBUG_STRING_PASS_INTO(sTest) ); 2776 #if NH_MV 2777 D_DEC_INDENT( g_traceModeCheck ); 2778 #endif 2779 } 2780 #endif 1450 2781 1451 Void TEncCu::xCheckRDCostIntra( TComDataCU *&rpcBestCU, 2782 1452 TComDataCU *&rpcTempCU, … … 2784 1454 PartSize eSize 2785 1455 DEBUG_STRING_FN_DECLARE(sDebug) 2786 #if NH_3D_ENC_DEPTH2787 , Bool bOnlyIVP2788 #endif2789 1456 ) 2790 1457 { … … 2805 1472 2806 1473 UInt uiDepth = rpcTempCU->getDepth( 0 ); 2807 #if NH_3D_VSO // M52808 if( m_pcRdCost->getUseRenModel() )2809 {2810 UInt uiWidth = m_ppcOrigYuv[uiDepth]->getWidth ( COMPONENT_Y );2811 UInt uiHeight = m_ppcOrigYuv[uiDepth]->getHeight ( COMPONENT_Y );2812 Pel* piSrc = m_ppcOrigYuv[uiDepth]->getAddr ( COMPONENT_Y );2813 UInt uiSrcStride = m_ppcOrigYuv[uiDepth]->getStride ( COMPONENT_Y );2814 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );2815 }2816 #endif2817 1474 2818 1475 rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth ); 2819 #if NH_3D_DIS2820 rpcTempCU->setDISFlagSubParts( false, 0, uiDepth );2821 #endif2822 1476 2823 1477 … … 2829 1483 2830 1484 m_pcPredSearch->estIntraPredLumaQT( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], resiLuma DEBUG_STRING_PASS_INTO(sTest) 2831 #if NH_3D_ENC_DEPTH2832 , bOnlyIVP2833 #endif2834 1485 ); 2835 1486 … … 2841 1492 } 2842 1493 2843 #if NH_3D_SDC_INTRA2844 if( rpcTempCU->getSDCFlag( 0 ) )2845 {2846 assert( rpcTempCU->getTransformIdx(0) == 0 );2847 assert( rpcTempCU->getCbf(0, COMPONENT_Y) == 1 );2848 }2849 #endif2850 1494 2851 1495 m_pcEntropyCoder->resetBits(); … … 2856 1500 } 2857 1501 m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0, true ); 2858 #if NH_3D_DIS2859 m_pcEntropyCoder->encodeDIS( rpcTempCU, 0, true );2860 if(!rpcTempCU->getDISFlag(0))2861 {2862 #endif2863 1502 m_pcEntropyCoder->encodePredMode( rpcTempCU, 0, true ); 2864 1503 m_pcEntropyCoder->encodePartSize( rpcTempCU, 0, uiDepth, true ); 2865 1504 m_pcEntropyCoder->encodePredInfo( rpcTempCU, 0 ); 2866 1505 m_pcEntropyCoder->encodeIPCMInfo(rpcTempCU, 0, true ); 2867 #if NH_3D_SDC_INTRA2868 m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true );2869 #endif2870 1506 2871 1507 // Encode Coefficients … … 2875 1511 setCodeChromaQpAdjFlag( codeChromaQpAdjFlag ); 2876 1512 setdQPFlag( bCodeDQP ); 2877 #if NH_3D_DIS2878 }2879 #endif2880 1513 m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]); 2881 1514 2882 1515 rpcTempCU->getTotalBits() = m_pcEntropyCoder->getNumberOfWrittenBits(); 2883 1516 rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 2884 #if NH_3D_VSO // M62885 if( m_pcRdCost->getUseLambdaScaleVSO())2886 {2887 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );2888 }2889 else2890 #endif2891 1517 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 2892 1518 … … 2924 1550 UInt uiDepth = rpcTempCU->getDepth( 0 ); 2925 1551 2926 #if NH_3D_VSO // VERY NEW2927 if( m_pcRdCost->getUseRenModel() )2928 {2929 UInt uiWidth = m_ppcOrigYuv[uiDepth]->getWidth ( COMPONENT_Y );2930 UInt uiHeight = m_ppcOrigYuv[uiDepth]->getHeight ( COMPONENT_Y );2931 Pel* piSrc = m_ppcOrigYuv[uiDepth]->getAddr ( COMPONENT_Y );2932 UInt uiSrcStride = m_ppcOrigYuv[uiDepth]->getStride ( COMPONENT_Y );2933 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );2934 }2935 #endif2936 1552 rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth ); 2937 #if NH_3D_DIS2938 rpcTempCU->setDISFlagSubParts( false, 0, uiDepth );2939 #endif2940 1553 rpcTempCU->setIPCMFlag(0, true); 2941 1554 rpcTempCU->setIPCMFlagSubParts (true, 0, rpcTempCU->getDepth(0)); … … 2957 1570 2958 1571 m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0, true ); 2959 #if NH_3D_DIS2960 m_pcEntropyCoder->encodeDIS( rpcTempCU, 0, true );2961 #endif2962 1572 m_pcEntropyCoder->encodePredMode ( rpcTempCU, 0, true ); 2963 1573 m_pcEntropyCoder->encodePartSize ( rpcTempCU, 0, uiDepth, true ); 2964 1574 m_pcEntropyCoder->encodeIPCMInfo ( rpcTempCU, 0, true ); 2965 #if NH_3D_SDC_INTRA2966 m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true );2967 #endif2968 1575 m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]); 2969 1576 2970 1577 rpcTempCU->getTotalBits() = m_pcEntropyCoder->getNumberOfWrittenBits(); 2971 1578 rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 2972 #if NH_3D_VSO // M442973 if ( m_pcRdCost->getUseVSO() )2974 {2975 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );2976 }2977 else2978 #endif2979 1579 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 2980 1580 … … 3043 1643 pcCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // dQP bits 3044 1644 pcCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded(); 3045 #if NH_3D_VSO // M453046 if ( m_pcRdCost->getUseVSO() )3047 {3048 pcCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( pcCU->getTotalBits(), pcCU->getTotalDistortion() );3049 }3050 else3051 #endif3052 1645 pcCU->getTotalCost() = m_pcRdCost->calcRdCost( pcCU->getTotalBits(), pcCU->getTotalDistortion() ); 3053 1646 }
Note: See TracChangeset for help on using the changeset viewer.