Changeset 28 in 3DVCSoftware for branches/0.3-poznan-univ/source/Lib/TLibEncoder
- Timestamp:
- 24 Feb 2012, 20:22:58 (13 years ago)
- Location:
- branches/0.3-poznan-univ/source/Lib/TLibEncoder
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncCavlc.cpp
r5 r28 326 326 xWriteFlag( pcSPS->getUseSAO() ? 1 : 0); 327 327 #endif 328 #if POZNAN_DBMP 329 xWriteFlag( pcSPS->getDBMP() ); 330 #endif 331 #if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU 332 xWriteFlag( pcSPS->getUseCUSkip() ); 333 #endif 328 334 329 335 if( pcSPS->getViewId() || pcSPS->isDepth() ) … … 340 346 #if HHI_MPI 341 347 xWriteFlag( pcSPS->getUseMVI() ? 1 : 0 ); 348 #endif 349 #if POZNAN_NONLINEAR_DEPTH 350 // Depth power coefficient 351 #if POZNAN_NONLINEAR_DEPTH_SEND_AS_BYTE 352 UInt uiCode = quantizeDepthPower(pcSPS->getDepthPower()); 353 xWriteCode(uiCode, 8); 354 #else 355 float fCode = pcSPS->getDepthPower(); 356 UInt uiCode = *((UInt*)&fCode); 357 //uiCode &= ~0x80000000; 358 xWriteCode(uiCode, sizeof(float)*8); // we do not send sign?; 359 #endif 342 360 #endif 343 361 } … … 377 395 } 378 396 #endif 397 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 398 xWriteFlag ( pcSPS->getUseTexDqpAccordingToDepth() ? 1 : 0 ); 399 #endif 379 400 } 380 401 } … … 727 748 728 749 729 #if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI 750 #if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI || POZNAN_DBMP 730 751 Void 731 752 TEncCavlc::codeMergeIndexMV( TComDataCU* pcCU, UInt uiAbsPartIdx ) … … 733 754 UInt uiNumCand = 0; 734 755 UInt uiMergeIdx = pcCU->getMergeIndex( uiAbsPartIdx ); 756 757 #if POZNAN_DBMP 758 UInt uiModIdx; 759 const Bool bDBMPAvailable = pcCU->getSlice()->getMP()->isDBMPEnabled(); 760 if(bDBMPAvailable) 761 { 762 if(uiMergeIdx==POZNAN_DBMP_MRG_CAND) uiMergeIdx = POZNAN_DBMP_MERGE_POS; 763 else if(uiMergeIdx>=POZNAN_DBMP_MERGE_POS) uiMergeIdx++; 764 } 765 #endif 735 766 #if HHI_MPI 736 767 const Bool bMVIAvailable = pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE; … … 750 781 if( uiIdx < uiMviMergePos ) 751 782 { 783 #if POZNAN_DBMP 784 if(bDBMPAvailable) 785 { 786 if(uiIdx==POZNAN_DBMP_MERGE_POS) uiModIdx = POZNAN_DBMP_MRG_CAND; 787 else if(uiIdx>POZNAN_DBMP_MERGE_POS) uiModIdx = uiIdx--; 788 else uiModIdx = uiIdx; 789 } 790 else uiModIdx = uiIdx; 791 if( pcCU->getNeighbourCandIdx( uiModIdx, uiAbsPartIdx ) == uiModIdx + 1 ) 792 { 793 uiNumCand++; 794 } 795 else if( uiIdx < uiMergeIdx ) 796 { 797 uiUnaryIdx--; 798 } 799 #else 752 800 if( pcCU->getNeighbourCandIdx( uiIdx, uiAbsPartIdx ) == uiIdx + 1 ) 753 801 { … … 758 806 uiUnaryIdx--; 759 807 } 808 #endif 760 809 } 761 810 else if( uiIdx > uiMviMergePos ) 762 811 { 812 #if POZNAN_DBMP 813 if(bDBMPAvailable) 814 { 815 if(uiIdx==POZNAN_DBMP_MERGE_POS) uiModIdx = POZNAN_DBMP_MRG_CAND; 816 else if(uiIdx>POZNAN_DBMP_MERGE_POS) uiModIdx = uiIdx--; 817 else uiModIdx = uiIdx; 818 } 819 else uiModIdx = uiIdx; 820 if( pcCU->getNeighbourCandIdx( uiModIdx-1, uiAbsPartIdx ) == uiModIdx ) 821 { 822 uiNumCand++; 823 } 824 else if( uiIdx < uiMergeIdx ) 825 { 826 uiUnaryIdx--; 827 } 828 #else 763 829 if( pcCU->getNeighbourCandIdx( uiIdx - 1, uiAbsPartIdx ) == uiIdx ) 764 830 { … … 769 835 uiUnaryIdx--; 770 836 } 837 #endif 771 838 } 772 839 } … … 775 842 for( UInt uiIdx = 0; uiIdx < MRG_MAX_NUM_CANDS; uiIdx++ ) 776 843 { 844 #if POZNAN_DBMP 845 if(bDBMPAvailable) 846 { 847 if(uiIdx==POZNAN_DBMP_MERGE_POS) uiModIdx = POZNAN_DBMP_MRG_CAND; 848 else if(uiIdx>POZNAN_DBMP_MERGE_POS) uiModIdx = uiIdx--; 849 else uiModIdx = uiIdx; 850 } 851 else uiModIdx = uiIdx; 852 if( pcCU->getNeighbourCandIdx( uiModIdx, uiAbsPartIdx ) == uiModIdx + 1 ) 853 { 854 uiNumCand++; 855 } 856 else if( uiIdx < uiMergeIdx ) 857 { 858 uiUnaryIdx--; 859 } 860 #else 777 861 if( pcCU->getNeighbourCandIdx( uiIdx, uiAbsPartIdx ) == uiIdx + 1 ) 778 862 { … … 783 867 uiUnaryIdx--; 784 868 } 869 #endif 785 870 } 786 871 #endif … … 806 891 Void TEncCavlc::codeMergeIndex ( TComDataCU* pcCU, UInt uiAbsPartIdx ) 807 892 { 893 /* todo JAcek sprawdzic co jest zgane 808 894 #if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI 809 895 #if HHI_INTER_VIEW_MOTION_PRED && HHI_MPI … … 814 900 #else 815 901 if( pcCU->getSlice()->getSPS()->getViewId() > 0 && ( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) == PDM_USE_FOR_MERGE ) 816 #endif 902 #endif//*/ 903 #if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI || POZNAN_DBMP 904 if( 905 #if HHI_INTER_VIEW_MOTION_PRED 906 ( pcCU->getSlice()->getSPS()->getViewId() > 0 && ( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) == PDM_USE_FOR_MERGE ) || 907 #endif 908 #if HHI_MPI 909 ( pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) || 910 #endif 911 #if POZNAN_DBMP 912 ( pcCU->getSlice()->getMP()->isDBMPEnabled() ) || 913 #endif 914 0 915 ) 817 916 { 818 917 codeMergeIndexMV( pcCU, uiAbsPartIdx ); -
branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncCavlc.h
r5 r28 228 228 Void codeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 229 229 Void codeMergeIndex ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 230 #if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI 230 #if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI || POZNAN_DBMP 231 231 Void codeMergeIndexMV ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 232 232 #endif -
branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncCfg.h
r21 r28 206 206 UInt m_uiMultiviewResPredMode; 207 207 #endif 208 #if POZNAN_DBMP 209 UInt m_uiDBMP; 210 #endif 211 #if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU 212 UInt m_uiUseCUSkip; 213 #endif 208 214 209 215 PicOrderCnt m_iQpChangeFrame; … … 217 223 #endif 218 224 225 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 226 Bool m_bUseTexDqpAccordingToDepth; 227 #endif 228 #if POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC 229 Double m_dTexDqpAccordingToDepthOffset; 230 Double m_dTexDqpAccordingToDepthMul; 231 Int m_iTexDqpAccordingToDepthTopBottomRow; 232 #endif 233 #if POZNAN_NONLINEAR_DEPTH 234 Float m_fDepthPower; 235 #endif 236 219 237 public: 220 238 TEncCfg() {} … … 258 276 #endif 259 277 278 #if POZNAN_DBMP 279 Void setDBMP ( UInt u ) { m_uiDBMP = u; } 280 #endif 281 282 #if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU 283 Void setUseCUSkip ( UInt u ) { m_uiUseCUSkip = u; } 284 #endif 285 260 286 #if HHI_INTERVIEW_SKIP 261 287 Void setInterViewSkip ( UInt u ) { m_uiInterViewSkip = u; } … … 306 332 Void setAllowNegDist ( Bool b ) { m_bAllowNegDist = b; }; 307 333 #endif 334 #endif 335 336 #if POZNAN_NONLINEAR_DEPTH 337 inline Float getDepthPower() { return m_fDepthPower; } 338 inline Void setDepthPower(Float p) { m_fDepthPower = p; } 339 #else 340 inline Float getDepthPower() { return 1.0f; } 308 341 #endif 309 342 … … 478 511 Void setQpChangeOffsetDepth( Int iOffset ) { m_iQpChangeOffsetDepth = iOffset; } 479 512 Int getQpChangeOffsetDepth() { return m_iQpChangeOffsetDepth; } 513 514 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 515 Bool getUseTexDqpAccordingToDepth () { return m_bUseTexDqpAccordingToDepth; } 516 Void setUseTexDqpAccordingToDepth ( Bool b ) { m_bUseTexDqpAccordingToDepth = b; } 517 #endif 480 518 }; 481 519 -
branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncCu.cpp
r5 r28 67 67 m_ppcOrigYuv = new TComYuv*[m_uhTotalDepth-1]; 68 68 m_ppcResPredTmp = new TComYuv*[m_uhTotalDepth-1]; 69 #if POZNAN_AVAIL_MAP 70 m_ppcAvailYuv = new TComYuv*[m_uhTotalDepth-1]; 71 #endif 72 #if POZNAN_SYNTH_VIEW 73 m_ppcSynthYuv = new TComYuv*[m_uhTotalDepth-1]; 74 #endif 75 69 76 70 77 #if HHI_MPI … … 93 100 m_ppcOrigYuv [i] = new TComYuv; m_ppcOrigYuv [i]->create(uiWidth, uiHeight); 94 101 102 #if POZNAN_AVAIL_MAP 103 m_ppcAvailYuv [i] = new TComYuv; m_ppcAvailYuv [i]->create(uiWidth, uiHeight); 104 #endif 105 #if POZNAN_SYNTH_VIEW 106 m_ppcSynthYuv [i] = new TComYuv; m_ppcSynthYuv [i]->create(uiWidth, uiHeight); 107 #endif 108 109 95 110 m_ppcResPredTmp [i] = new TComYuv; m_ppcResPredTmp [i]->create(uiWidth, uiHeight); 96 111 } … … 152 167 m_ppcOrigYuv[i]->destroy(); delete m_ppcOrigYuv[i]; m_ppcOrigYuv[i] = NULL; 153 168 } 169 #if POZNAN_AVAIL_MAP 170 if(m_ppcAvailYuv[i]) 171 { 172 m_ppcAvailYuv[i]->destroy(); delete m_ppcAvailYuv[i]; m_ppcAvailYuv[i] = NULL; 173 } 174 #endif 175 #if POZNAN_SYNTH_VIEW 176 if(m_ppcSynthYuv[i]) 177 { 178 m_ppcSynthYuv[i]->destroy(); delete m_ppcSynthYuv[i]; m_ppcSynthYuv[i] = NULL; 179 } 180 #endif 154 181 if(m_ppcResPredTmp[i]) 155 182 { … … 203 230 m_ppcOrigYuv = NULL; 204 231 } 232 #if POZNAN_AVAIL_MAP 233 if(m_ppcAvailYuv) 234 { 235 delete [] m_ppcAvailYuv; 236 m_ppcAvailYuv = NULL; 237 } 238 #endif 239 #if POZNAN_SYNTH_VIEW 240 if(m_ppcSynthYuv) 241 { 242 delete [] m_ppcSynthYuv; 243 m_ppcSynthYuv = NULL; 244 } 245 #endif 205 246 if(m_ppcResPredTmp) 206 247 { … … 354 395 } 355 396 } 397 398 #if POZNAN_DBMP & !POZNAN_DBMP_COMPRESS_ME_DATA 399 //save motion data for every CU point 400 xSaveDBMPData(m_ppcBestCU[0]); 401 #endif 402 356 403 } 357 404 … … 426 473 // get Original YUV data from picture 427 474 m_ppcOrigYuv[uiDepth]->copyFromPicYuv( pcPic->getPicYuvOrg(), rpcBestCU->getAddr(), rpcBestCU->getZorderIdxInCU() ); 428 475 #if POZNAN_AVAIL_MAP 476 if (pcPic->getPicYuvAvail()) m_ppcAvailYuv[uiDepth]->copyFromPicYuv( pcPic->getPicYuvAvail(), rpcBestCU->getAddr(), rpcBestCU->getZorderIdxInCU() ); 477 #endif 478 #if POZNAN_SYNTH_VIEW 479 if (pcPic->getPicYuvSynth()) m_ppcSynthYuv[uiDepth]->copyFromPicYuv( pcPic->getPicYuvSynth(), rpcBestCU->getAddr(), rpcBestCU->getZorderIdxInCU() ); 480 #endif 481 482 #if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU 483 Bool bWholeCUCanBeSynthesized = false; 484 Bool bOneSubCUCanNotBeSynthesied = false; 485 Bool bSubCUCanBeSynthesized[4]; 486 Bool * pbSubCUCanBeSynthesized = bSubCUCanBeSynthesized; 487 pcPic->checkSynthesisAvailability(rpcBestCU, rpcBestCU->getAddr(), rpcBestCU->getZorderIdxInCU(), uiDepth, pbSubCUCanBeSynthesized); //KUBA SYNTH 488 Int iSubCUCanNotBeSynthesized = 0; 489 Int iSubCUCanBeSynthesizedCnt = 0; 490 for(Int i = 0; i < 4; i++) 491 { 492 if (!bSubCUCanBeSynthesized[i]) 493 { 494 iSubCUCanNotBeSynthesized = i; 495 } 496 else 497 { 498 iSubCUCanBeSynthesizedCnt ++; 499 } 500 } 501 if(iSubCUCanBeSynthesizedCnt == 4) 502 { 503 bWholeCUCanBeSynthesized = true; 504 } 505 else if(iSubCUCanBeSynthesizedCnt == 3) 506 { 507 bOneSubCUCanNotBeSynthesied = true; 508 } 509 #endif 429 510 // variables for fast encoder decision 430 511 TComDataCU* pcTempCU; … … 493 574 if( ( uiRPelX < rpcBestCU->getSlice()->getSPS()->getWidth() ) && ( uiBPelY < rpcBestCU->getSlice()->getSPS()->getHeight() ) ) 494 575 { 576 // do CU Skip 577 #if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU 578 if(bWholeCUCanBeSynthesized) 579 { 580 rpcBestCU->getTotalCost() = 0; // Cost of synthesised CU is zero 581 rpcBestCU->getTotalBits() = 0; // Cost of synthesised CU is zero 582 rpcBestCU->getTotalDistortion() = 0; // Distortion of synthesised CU is zero 583 rpcBestCU->setPredModeSubParts( MODE_SYNTH, 0, uiDepth ); 584 rpcBestCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); 585 #if POZNAN_FILL_OCCLUDED_CU_WITH_SYNTHESIS 586 m_ppcRecoYuvBest[uiDepth]->copyFromPicYuv(pcPic->getPicYuvSynth(), rpcBestCU->getAddr(), rpcBestCU->getZorderIdxInCU()); // First copy synthesis YUV part to CU encoder reconstruction YUV structure 587 #else 588 m_ppcRecoYuvBest[uiDepth]->copyFromPicYuv(pcPic->getPicYuvAvail(), rpcBestCU->getAddr(), rpcBestCU->getZorderIdxInCU()); // First copy synthesis YUV part to CU encoder reconstruction YUV structure 589 #endif 590 UInt uiInitTrDepth = rpcBestCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1; 591 rpcBestCU->copyToPic(uiDepth, 0, uiInitTrDepth); 592 xCopyYuv2Pic( rpcBestCU->getPic(), rpcBestCU->getAddr(), rpcBestCU->getZorderIdxInCU(), uiDepth ); // Next copy it to reconstruction YUV buffer in coded picture 593 assert( rpcBestCU->getPartitionSize ( 0 ) != SIZE_NONE ); //Not needed any more ?? 594 assert( rpcBestCU->getPredictionMode( 0 ) != MODE_NONE ); 595 assert( rpcBestCU->getTotalCost ( ) != MAX_DOUBLE ); 596 597 #if HHI_VSO//?? 598 if( m_pcRdCost->getUseRenModel() ) 599 { 600 UInt uiWidth = rpcBestCU->getWidth ( 0 ); 601 UInt uiHeight = rpcBestCU->getHeight( 0 ); 602 Pel* piSrc = m_ppcRecoYuvBest[uiDepth]->getLumaAddr( 0 ); 603 UInt uiSrcStride = m_ppcRecoYuvBest[uiDepth]->getStride(); 604 m_pcRdCost->setRenModelData( rpcBestCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 605 } 606 #endif 607 return; 608 } 609 else if (bOneSubCUCanNotBeSynthesied && (uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth )) // If only one from subCU can not be synthesised than force NxN split but donot signal it in the stream 610 { 611 //printf("CUSkip - OneCanNotBe %d %d %d\n",rpcBestCU->getCUPelX(),rpcBestCU->getCUPelY(),rpcBestCU->getWidth()); 612 // further split !!!!go to line 866!!! 613 #if HHI_VSO 614 // reset Model 615 if( m_pcRdCost->getUseRenModel() ) 616 { 617 UInt uiWidth = m_ppcBestCU[uiDepth]->getWidth ( 0 ); 618 UInt uiHeight = m_ppcBestCU[uiDepth]->getHeight( 0 ); 619 Pel* piSrc = m_ppcOrigYuv[uiDepth]->getLumaAddr( 0 ); 620 UInt uiSrcStride = m_ppcOrigYuv[uiDepth]->getStride(); 621 m_pcRdCost->setRenModelData( m_ppcBestCU[uiDepth], 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 622 } 623 #endif 624 625 UChar uhNextDepth = uiDepth + 1; 626 TComDataCU* pcSubBestPartCU = m_ppcBestCU[uhNextDepth]; 627 TComDataCU* pcSubTempPartCU = m_ppcTempCU[uhNextDepth]; 628 629 for ( UInt uiPartUnitIdx = 0; uiPartUnitIdx < 4; uiPartUnitIdx++ ) //UInt uiPartUnitIdx = iSubCUNotSynthesied; 630 { 631 pcSubBestPartCU->initSubCU( rpcBestCU, uiPartUnitIdx, uhNextDepth ); // clear sub partition datas or init. 632 pcSubTempPartCU->initSubCU( rpcBestCU, uiPartUnitIdx, uhNextDepth ); // clear sub partition datas or init. 633 // pcSubBestPartCU->setLastCodedQP( rpcBestCU->getLastCodedQP() ); 634 // pcSubTempPartCU->setLastCodedQP( rpcBestCU->getLastCodedQP() ); 635 636 if( ( pcSubBestPartCU->getCUPelX() < pcSubBestPartCU->getSlice()->getSPS()->getWidth() ) && ( pcSubBestPartCU->getCUPelY() < pcSubBestPartCU->getSlice()->getSPS()->getHeight() ) ) 637 { 638 if( m_bUseSBACRD ) 639 { 640 if ( 0 == uiPartUnitIdx) //initialize RD with previous depth buffer 641 { 642 m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]); 643 } 644 else 645 { 646 m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]); 647 } 648 } 649 650 xCompressCU( pcSubBestPartCU, pcSubTempPartCU, uhNextDepth ); //Compress SubCU's 651 652 #if HHI_VSO 653 if( m_pcRdCost->getUseRenModel() ) 654 { 655 UInt uiWidth = pcSubBestPartCU->getWidth ( 0 ); 656 UInt uiHeight = pcSubBestPartCU->getHeight( 0 ); 657 Pel* piSrc = m_ppcRecoYuvBest[pcSubBestPartCU->getDepth(0)]->getLumaAddr( 0 ); 658 UInt uiSrcStride = m_ppcRecoYuvBest[pcSubBestPartCU->getDepth(0)]->getStride(); 659 m_pcRdCost->setRenModelData( pcSubBestPartCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 660 } 661 #endif 662 rpcTempCU->copyPartFrom( pcSubBestPartCU, uiPartUnitIdx, uhNextDepth ); // Keep best part data to current temporary data. 663 xCopyYuv2Tmp( pcSubBestPartCU->getTotalNumPart()*uiPartUnitIdx, uhNextDepth ); 664 } 665 } 666 667 if( !bBoundary ) 668 { 669 m_pcEntropyCoder->resetBits(); 670 m_pcEntropyCoder->encodeSplitFlag( rpcTempCU, 0, uiDepth, true ); 671 672 rpcTempCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // split bits 673 } 674 675 #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE 676 if( bFullyRenderedSec ) 677 { 678 m_pcRdCost->setLambdaScale( m_pcEncCfg->getInterViewSkipLambdaScale() ); 679 } 680 else 681 { 682 m_pcRdCost->setLambdaScale( 1 ); 683 } 684 #endif 685 #if HHI_VSO 686 if ( m_pcRdCost->getUseLambdaScaleVSO()) 687 { 688 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 689 } 690 else 691 #endif 692 { 693 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 694 } 695 696 if( m_bUseSBACRD ) 697 { 698 m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]); 699 } 700 //Copy Tmp to Best 701 xCheckBestMode( rpcBestCU, rpcTempCU, uiDepth ); //Roznica z naszym koder // RD compare current larger prediction 702 703 #if HHI_VSO 704 if( m_pcRdCost->getUseRenModel() ) 705 { 706 UInt uiWidth = rpcBestCU->getWidth ( 0 ); 707 UInt uiHeight = rpcBestCU->getHeight( 0 ); 708 Pel* piSrc = m_ppcRecoYuvBest[uiDepth]->getLumaAddr( 0 ); 709 UInt uiSrcStride = m_ppcRecoYuvBest[uiDepth]->getStride(); 710 m_pcRdCost->setRenModelData( rpcBestCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 711 } 712 #endif 713 //Copy result to pic 714 rpcBestCU->copyToPic(uiDepth); // Copy Best data to Picture for next partition prediction. 715 716 if( bBoundary ) 717 return; 718 719 xCopyYuv2Pic( rpcBestCU->getPic(), rpcBestCU->getAddr(), rpcBestCU->getZorderIdxInCU(), uiDepth ); // Copy Yuv data to picture Yuv 720 721 // Assert if Best prediction mode is NONE 722 // Selected mode's RD-cost must be not MAX_DOUBLE. 723 assert( rpcBestCU->getPartitionSize ( 0 ) != SIZE_NONE ); //Not needed any more? 724 assert( rpcBestCU->getPredictionMode( 0 ) != MODE_NONE ); 725 assert( rpcBestCU->getTotalCost ( ) != MAX_DOUBLE ); 726 return; 727 } 728 #endif 729 495 730 // do inter modes 496 731 if( rpcBestCU->getSlice()->getSliceType() != I_SLICE ) … … 836 1071 TComPic* pcPic = pcCU->getPic(); 837 1072 1073 #if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU 1074 if( pcCU->isCUSkiped( uiAbsPartIdx ) && uiDepth == pcCU->getDepth( uiAbsPartIdx )) //If CU Skiped no information is coded into stream 1075 return; 1076 #endif 1077 838 1078 Bool bBoundary = false; 839 1079 UInt uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; … … 842 1082 UInt uiBPelY = uiTPelY + (g_uiMaxCUHeight>>uiDepth) - 1; 843 1083 1084 #if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU 1085 Bool bDontSendSplitFlag = false; 1086 if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < (g_uiMaxCUDepth-g_uiAddCUDepth) ) ) || bBoundary ) //check if CU has 3 synthesied subCU - no split flag is send in that case 1087 { 1088 UInt uiQNumParts = ( pcPic->getNumPartInCU() >> (uiDepth<<1) )>>2; 1089 Int iCUSkipCounter = 0; 1090 UInt uiAbsPartIdxTmp = uiAbsPartIdx; 1091 for ( UInt uiPartUnitIdx = 0; uiPartUnitIdx < 4; uiPartUnitIdx++, uiAbsPartIdxTmp+=uiQNumParts ) 1092 { 1093 if(pcCU->isCUSkiped(uiAbsPartIdxTmp) && (pcCU->getDepth( uiAbsPartIdxTmp ) == uiDepth + 1) ) 1094 { 1095 iCUSkipCounter++; 1096 } 1097 } 1098 if(iCUSkipCounter == 3) 1099 { 1100 bDontSendSplitFlag = true; 1101 } 1102 } 1103 #endif 1104 844 1105 if( ( uiRPelX < pcCU->getSlice()->getSPS()->getWidth() ) && ( uiBPelY < pcCU->getSlice()->getSPS()->getHeight() ) ) 845 1106 { 1107 #if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU 1108 if(!bDontSendSplitFlag) 1109 #endif 846 1110 #if HHI_MPI 847 1111 if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 || uiDepth < pcCU->getTextureModeDepth( uiAbsPartIdx ) ) … … 1019 1283 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; 1020 1284 UInt uiNeighbourCandIdx[MRG_MAX_NUM_CANDS]; //MVs with same idx => same cand 1285 #if POZNAN_DBMP_CALC_PRED_DATA 1286 TComMP* pcMP = rpcTempCU->getSlice()->getMP(); 1287 #endif 1021 1288 1022 1289 #if HHI_INTER_VIEW_RESIDUAL_PRED … … 1075 1342 rpcTempCU->setNeighbourCandIdxSubParts( uiInner, uiNeighbourCandIdx[uiInner], 0, 0,uhDepth ); 1076 1343 } 1344 #if POZNAN_DBMP_CALC_PRED_DATA 1345 if(uiMergeCand==POZNAN_DBMP_MRG_CAND) 1346 { 1347 rpcTempCU->getCUMvField2nd( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand].getMv(), cMvFieldNeighbours[0 + 2*uiMergeCand].getRefIdx(), SIZE_2Nx2N, 0, 0, 0 ); // interprets depth relative to rpcTempCU level 1348 rpcTempCU->getCUMvField2nd( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand].getMv(), cMvFieldNeighbours[1 + 2*uiMergeCand].getRefIdx(), SIZE_2Nx2N, 0, 0, 0 ); // interprets depth relative to rpcTempCU level 1349 } 1350 else 1351 #endif 1352 { 1077 1353 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand].getMv(), cMvFieldNeighbours[0 + 2*uiMergeCand].getRefIdx(), SIZE_2Nx2N, 0, 0, 0 ); // interprets depth relative to rpcTempCU level 1078 1354 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand].getMv(), cMvFieldNeighbours[1 + 2*uiMergeCand].getRefIdx(), SIZE_2Nx2N, 0, 0, 0 ); // interprets depth relative to rpcTempCU level 1355 } 1079 1356 1080 1357 #if HHI_INTER_VIEW_RESIDUAL_PRED … … 1090 1367 if ( uiNoResidual == 0 ){ 1091 1368 #endif 1369 1370 #if POZNAN_DBMP 1371 if(uiMergeCand==POZNAN_DBMP_MRG_CAND){ 1372 m_pcPredSearch->motionCompensation_DBMP ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] ); 1373 #if POZNAN_DBMP_CALC_PRED_DATA 1374 pcMP->setDBMPPredMVField(REF_PIC_LIST_0, rpcTempCU); 1375 pcMP->setDBMPPredMVField(REF_PIC_LIST_1, rpcTempCU); 1376 #endif 1377 } 1378 else 1092 1379 m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] ); 1380 #else 1381 m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] ); 1382 #endif 1093 1383 // save pred adress 1094 1384 pcPredYuvTemp = m_ppcPredYuvTemp[uhDepth]; … … 1100 1390 pcPredYuvTemp = m_ppcPredYuvBest[uhDepth]; 1101 1391 } 1392 #if POZNAN_DBMP_CALC_PRED_DATA 1393 if(uiMergeCand==POZNAN_DBMP_MRG_CAND) 1394 { 1395 //copy motion data representing CU with DBMP for uiNoResidual==0 case 1396 rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->copyFrom(pcMP->getDBMPPredMVField(REF_PIC_LIST_0),rpcTempCU->getTotalNumPart(),0); 1397 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->copyFrom(pcMP->getDBMPPredMVField(REF_PIC_LIST_1),rpcTempCU->getTotalNumPart(),0); 1398 } 1399 #endif 1102 1400 } 1103 1401 #if HHI_VSO … … 1123 1421 Bool bQtRootCbf = rpcTempCU->getQtRootCbf(0) == 1; 1124 1422 #else 1423 #if POZNAN_DBMP 1125 1424 // do MC 1425 if(uiMergeCand==POZNAN_DBMP_MRG_CAND){ 1426 m_pcPredSearch->motionCompensation_DBMP ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] ); 1427 #if POZNAN_DBMP_CALC_PRED_DATA 1428 pcMP->setDBMPPredMVField(REF_PIC_LIST_0, rpcTempCU); 1429 pcMP->setDBMPPredMVField(REF_PIC_LIST_1, rpcTempCU); 1430 #endif 1431 } 1432 else 1126 1433 m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] ); 1434 1435 #endif 1127 1436 1128 1437 // estimate residual and encode everything … … 1412 1721 for( UInt ui = 0; ui < rpcTempCU->getTotalNumPart(); ui++ ) 1413 1722 { 1414 if( pcTextureCU->isIntra( rpcTempCU->getZorderIdxInCU() + ui ) ) 1723 if( pcTextureCU->isIntra( rpcTempCU->getZorderIdxInCU() + ui ) 1724 #if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU 1725 || pcTextureCU->isCUSkiped( rpcTempCU->getZorderIdxInCU() + ui ) 1726 #endif 1727 ) 1415 1728 { 1416 1729 return; -
branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncCu.h
r5 r28 78 78 TComYuv** m_ppcOrigYuv; ///< Original Yuv for each depth 79 79 TComYuv** m_ppcResPredTmp; ///< Temporary residual prediction for each depth 80 #if POZNAN_AVAIL_MAP 81 TComYuv** m_ppcAvailYuv; ///< Avaiability map for each depth 82 #endif 83 #if POZNAN_SYNTH_VIEW 84 TComYuv** m_ppcSynthYuv; ///< Synthetized Yuv for each depth 85 #endif 80 86 81 87 // Data : encoder control … … 156 162 Void xRestoreDepthWidthHeight( TComDataCU* pcCU ); 157 163 #endif 164 165 #if POZNAN_DBMP & !POZNAN_DBMP_COMPRESS_ME_DATA 166 Void xSaveDBMPData(TComDataCU* pcCU) { pcCU->getSlice()->getMP()->saveDBMPData(pcCU);} 167 #endif 158 168 }; 159 169 -
branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncGOP.cpp
r5 r28 293 293 #endif 294 294 295 #if POZNAN_MP 296 #if POZNAN_MP_USE_DEPTH_MAP_GENERATION 297 pcSlice->getMP()->setDepthMapGenerator(m_pcDepthMapGenerator); 298 #else 299 std::vector<TComPic*> apcSpatDepthRefPics = m_pcEncTop->getEncTop()->getSpatialRefPics( pcPic->getViewIdx(), pcSlice->getPOC(), true ); 300 pcSlice->getMP()->setDepthRefPicsList(&apcSpatDepthRefPics); 301 #endif 302 std::vector<TComPic*> apcSpatDataRefPics = m_pcEncTop->getEncTop()->getSpatialRefPics( pcPic->getViewIdx(), pcSlice->getPOC(), m_pcEncTop->isDepthCoder() ); 303 pcSlice->getMP()->setRefPicsList(&apcSpatDataRefPics); 304 pcSlice->getMP()->pairMultiview(pcPic); 305 #endif 306 295 307 while(uiNextCUAddr<pcPic->getPicSym()->getNumberOfCUsInFrame()) // determine slice boundaries 296 308 { … … 615 627 pcBitstreamOut->convertRBSPToPayload(0); 616 628 629 #if POZNAN_MP 630 //pcSlice->getMP()->disable(); 631 #endif 632 617 633 /*#if AMVP_BUFFERCOMPRESS 618 634 pcPic->compressMotion(); // moved to end of access unit … … 799 815 Pel* pOrg = pcPic ->getPicYuvOrg()->getLumaAddr(); 800 816 Pel* pRec = pcPicD->getLumaAddr(); 817 #if POZNAN_CU_SKIP_PSNR 818 Pel* pAvail = NULL; 819 if(pcPic ->getPicYuvAvail()) 820 pAvail = pcPic ->getPicYuvAvail()->getLumaAddr(); 821 UInt64 iPixelsCnt = 0; 822 #endif 801 823 Int iStride = pcPicD->getStride(); 802 824 … … 813 835 Double fRefValueC = fRefValueY / 4.0; 814 836 837 #if POZNAN_CU_SKIP_PSNR 838 if(pAvail) 839 { 815 840 for( y = 0; y < iHeight; y++ ) 816 841 { 817 842 for( x = 0; x < iWidth; x++ ) 818 843 { 844 if(pAvail[x]==0) //If pixel was codded 845 { 819 846 Int iDiff = (Int)( pOrg[x] - pRec[x] ); 820 847 uiSSDY += iDiff * iDiff; 848 iPixelsCnt++; 849 } 821 850 } 822 851 pOrg += iStride; 823 852 pRec += iStride; 853 pAvail+=iStride; 854 } 855 856 fRefValueY = (double) maxval * maxval * iPixelsCnt; 857 } 858 else 859 #endif 860 { 861 for( y = 0; y < iHeight; y++ ) 862 { 863 for( x = 0; x < iWidth; x++ ) 864 { 865 Int iDiff = (Int)( pOrg[x] - pRec[x] ); 866 uiSSDY += iDiff * iDiff; 867 } 868 pOrg += iStride; 869 pRec += iStride; 870 } 824 871 } 825 872 … … 837 884 #endif 838 885 { 839 iHeight >>= 1; 840 iWidth >>= 1; 841 iStride >>= 1; 842 pOrg = pcPic ->getPicYuvOrg()->getCbAddr(); 843 pRec = pcPicD->getCbAddr(); 844 845 for( y = 0; y < iHeight; y++ ) 846 { 847 for( x = 0; x < iWidth; x++ ) 848 { 849 Int iDiff = (Int)( pOrg[x] - pRec[x] ); 850 uiSSDU += iDiff * iDiff; 851 } 852 pOrg += iStride; 853 pRec += iStride; 854 } 855 856 pOrg = pcPic ->getPicYuvOrg()->getCrAddr(); 857 pRec = pcPicD->getCrAddr(); 858 859 for( y = 0; y < iHeight; y++ ) 860 { 861 for( x = 0; x < iWidth; x++ ) 862 { 863 Int iDiff = (Int)( pOrg[x] - pRec[x] ); 864 uiSSDV += iDiff * iDiff; 865 } 866 pOrg += iStride; 867 pRec += iStride; 868 } 886 #if POZNAN_CU_SKIP_PSNR 887 if(pAvail) 888 { 889 iHeight >>= 1; 890 iWidth >>= 1; 891 iStride >>= 1; 892 893 pOrg = pcPic ->getPicYuvOrg()->getCbAddr(); 894 pRec = pcPicD->getCbAddr(); 895 pAvail = pcPic ->getPicYuvAvail()->getLumaAddr(); 896 iPixelsCnt = 0; 897 898 for( y = 0; y < iHeight; y++ ) 899 { 900 for( x = 0; x < iWidth; x++ ) 901 { 902 if(pAvail[x<<1]==0||pAvail[(x<<1)+1]==0|| 903 pAvail[(x+iStride)<<1]==0||pAvail[((x+iStride)<<1)+1]==0) //If pixel was codded 904 { 905 Int iDiff = (Int)( pOrg[x] - pRec[x] ); 906 uiSSDU += iDiff * iDiff; 907 iPixelsCnt++; 908 } 909 } 910 pOrg += iStride; 911 pRec += iStride; 912 pAvail+= (iStride<<2); 913 } 914 915 fRefValueC = (double) maxval * maxval * iPixelsCnt; 916 917 pOrg = pcPic ->getPicYuvOrg()->getCrAddr(); 918 pRec = pcPicD->getCrAddr(); 919 pAvail = pcPic ->getPicYuvAvail()->getLumaAddr(); 920 for( y = 0; y < iHeight; y++ ) 921 { 922 for( x = 0; x < iWidth; x++ ) 923 { 924 if(pAvail[x<<1]==0||pAvail[(x<<1)+1]==0|| 925 pAvail[(x+iStride)<<1]==0||pAvail[((x+iStride)<<1)+1]==0) //If pixel was codded 926 { 927 Int iDiff = (Int)( pOrg[x] - pRec[x] ); 928 uiSSDV += iDiff * iDiff; 929 } 930 } 931 pOrg += iStride; 932 pRec += iStride; 933 pAvail+= iStride<<2; 934 } 935 } 936 else 937 #endif 938 { 939 iHeight >>= 1; 940 iWidth >>= 1; 941 iStride >>= 1; 942 pOrg = pcPic ->getPicYuvOrg()->getCbAddr(); 943 pRec = pcPicD->getCbAddr(); 944 945 for( y = 0; y < iHeight; y++ ) 946 { 947 for( x = 0; x < iWidth; x++ ) 948 { 949 Int iDiff = (Int)( pOrg[x] - pRec[x] ); 950 uiSSDU += iDiff * iDiff; 951 } 952 pOrg += iStride; 953 pRec += iStride; 954 } 955 956 pOrg = pcPic ->getPicYuvOrg()->getCrAddr(); 957 pRec = pcPicD->getCrAddr(); 958 959 for( y = 0; y < iHeight; y++ ) 960 { 961 for( x = 0; x < iWidth; x++ ) 962 { 963 Int iDiff = (Int)( pOrg[x] - pRec[x] ); 964 uiSSDV += iDiff * iDiff; 965 } 966 pOrg += iStride; 967 pRec += iStride; 968 } 969 } 970 869 971 dYPSNR = ( uiSSDY ? 10.0 * log10( fRefValueY / (Double)uiSSDY ) : 99.99 ); 870 972 dUPSNR = ( uiSSDU ? 10.0 * log10( fRefValueC / (Double)uiSSDU ) : 99.99 ); -
branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncSbac.cpp
r5 r28 660 660 661 661 662 #if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI 662 #if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI || POZNAN_DBMP 663 663 Void TEncSbac::codeMergeIndexMV( TComDataCU* pcCU, UInt uiAbsPartIdx ) 664 664 { … … 670 670 const UInt uiMviMergePos = bMVIAvailable ? HHI_MPI_MERGE_POS : MRG_MAX_NUM_CANDS; 671 671 #endif 672 #if POZNAN_DBMP 673 const Bool bDBMPAvailable = pcCU->getSlice()->getMP()->isDBMPEnabled(); 674 #endif 672 675 for( UInt uiIdx = 0; uiIdx < MRG_MAX_NUM_CANDS; uiIdx++ ) 673 676 { … … 692 695 } 693 696 } 697 698 #if POZNAN_DBMP 699 if(bDBMPAvailable) 700 { 701 UInt uiDBMPMergePos = POZNAN_DBMP_MERGE_POS; 702 #if HHI_MPI 703 if(bMVIAvailable && uiDBMPMergePos>=uiMviMergePos) uiDBMPMergePos++; 704 #endif 705 for( Int iIdx = MRG_MAX_NUM_CANDS-2; iIdx >= (Int)uiDBMPMergePos; iIdx-- ) 706 { 707 Int iWrIdx = iIdx+1; 708 #if HHI_MPI 709 if(bMVIAvailable) 710 { 711 if(iIdx==(Int)uiMviMergePos) continue; 712 if(iWrIdx==(Int)uiMviMergePos) iWrIdx++; 713 } 714 #endif 715 if(iWrIdx>=MRG_MAX_NUM_CANDS) continue; 716 717 abAvailable[ iWrIdx ] = abAvailable[ iIdx ]; 718 } 719 abAvailable[ uiDBMPMergePos ] = ( pcCU->getNeighbourCandIdx( POZNAN_DBMP_MRG_CAND, uiAbsPartIdx ) == POZNAN_DBMP_MRG_CAND + 1 ); 720 721 uiNumCand = 0; for( UInt uiIdx = 0; uiIdx < MRG_MAX_NUM_CANDS; uiIdx++ ) if(abAvailable[ uiIdx ]) uiNumCand++; 722 } 723 #endif 724 694 725 AOF( uiNumCand > 1 ); 695 726 … … 718 749 //--- determine unary index --- 719 750 UInt uiMergeIdx = pcCU->getMergeIndex( uiAbsPartIdx ); 751 #if POZNAN_DBMP 752 if(bDBMPAvailable) 753 { 754 if(uiMergeIdx==POZNAN_DBMP_MRG_CAND) uiMergeIdx = POZNAN_DBMP_MERGE_POS; 755 else if(uiMergeIdx>=POZNAN_DBMP_MERGE_POS) uiMergeIdx++; 756 } 757 #endif 720 758 #if HHI_MPI 721 759 if( bMVIAvailable ) … … 783 821 Void TEncSbac::codeMergeIndex( TComDataCU* pcCU, UInt uiAbsPartIdx ) 784 822 { 823 /* todo jacek niech sie wypowie 785 824 #if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI 786 825 #if HHI_INTER_VIEW_MOTION_PRED && HHI_MPI … … 791 830 #else 792 831 if( pcCU->getSlice()->getSPS()->getViewId() > 0 && ( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) == PDM_USE_FOR_MERGE ) 793 #endif 832 #endif//*/ 833 #if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI || POZNAN_DBMP 834 if( 835 #if HHI_INTER_VIEW_MOTION_PRED 836 ( pcCU->getSlice()->getSPS()->getViewId() > 0 && ( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) == PDM_USE_FOR_MERGE ) || 837 #endif 838 #if HHI_MPI 839 ( pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) || 840 #endif 841 #if POZNAN_DBMP 842 ( pcCU->getSlice()->getMP()->isDBMPEnabled() ) || 843 #endif 844 0 845 ) 794 846 { 795 847 codeMergeIndexMV( pcCU, uiAbsPartIdx ); -
branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncSbac.h
r5 r28 166 166 Void codeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 167 167 Void codeMergeIndex ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 168 #if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI 168 #if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI || POZNAN_DBMP 169 169 Void codeMergeIndexMV ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 170 170 #endif -
branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncSearch.cpp
r5 r28 1042 1042 UInt uiAbsSum = 0; 1043 1043 pcCU ->setTrIdxSubParts ( uiTrDepth, uiAbsPartIdx, uiFullDepth ); 1044 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 1045 m_pcTrQuant->setQPforQuant ( pcCU->getQP( 0 ) + pcCU->getQpOffsetForTextCU(uiAbsPartIdx, true), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA ); 1046 #else 1044 1047 m_pcTrQuant->setQPforQuant ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA ); 1048 #endif 1045 1049 m_pcTrQuant->transformNxN ( pcCU, piResi, uiStride, pcCoeff, uiWidth, uiHeight, uiAbsSum, TEXT_LUMA, uiAbsPartIdx ); 1046 1050 … … 1208 1212 //--- transform and quantization --- 1209 1213 UInt uiAbsSum = 0; 1214 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 1215 m_pcTrQuant->setQPforQuant ( pcCU->getQP( 0 ) + pcCU->getQpOffsetForTextCU(uiAbsPartIdx, true), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA ); 1216 #else 1210 1217 m_pcTrQuant->setQPforQuant ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA ); 1218 #endif 1211 1219 m_pcTrQuant->transformNxN ( pcCU, piResi, uiStride, pcCoeff, uiWidth, uiHeight, uiAbsSum, eText, uiAbsPartIdx ); 1212 1220 //--- set coded block flag --- … … 2814 2822 } 2815 2823 2824 #if POZNAN_DBMP 2825 Void TEncSearch::xGetInterPredictionError_DBMP( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPartIdx, UInt& ruiErr, Bool bHadamard ) 2826 { 2827 TComYuv cYuvPred; 2828 cYuvPred.create( pcYuvOrg->getWidth(), pcYuvOrg->getHeight() ); 2829 2830 #ifdef WEIGHT_PRED 2831 UInt uiAbsPartIdx = 0; 2832 Int iWidth = 0; 2833 Int iHeight = 0; 2834 //Int iRefIdx[2]; 2835 pcCU->getPartIndexAndSize( iPartIdx, uiAbsPartIdx, iWidth, iHeight ); 2836 2837 //??????????????????????????????????????????????????????????????????????????????????? 2838 //iRefIdx[0] = pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiAbsPartIdx ); 2839 //iRefIdx[1] = pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiAbsPartIdx ); 2840 //if ( iRefIdx[0]>=0 && iRefIdx[1]<1 ) 2841 // setWpScalingDistParam( pcCU, iRefIdx[0], iRefIdx[1], REF_PIC_LIST_0); 2842 //else 2843 // setWpScalingDistParam( pcCU, iRefIdx[0], iRefIdx[1], REF_PIC_LIST_1); 2844 setWpScalingDistParam( pcCU, -1, -1, REF_PIC_LIST_X);//??? 2845 //??????????????????????????????????????????????????????????????????????????????????? 2846 motionCompensation_DBMP( pcCU, &cYuvPred, REF_PIC_LIST_X, iPartIdx ); 2847 #else 2848 motionCompensation_DBMP( pcCU, &cYuvPred, REF_PIC_LIST_X, iPartIdx ); 2849 2850 UInt uiAbsPartIdx = 0; 2851 Int iWidth = 0; 2852 Int iHeight = 0; 2853 pcCU->getPartIndexAndSize( iPartIdx, uiAbsPartIdx, iWidth, iHeight ); 2854 #endif 2855 2856 DistParam cDistParam; 2857 #ifdef WEIGHT_PRED 2858 cDistParam.applyWeight = false; 2859 #endif 2860 m_pcRdCost->setDistParam( cDistParam, 2861 pcYuvOrg->getLumaAddr( uiAbsPartIdx ), pcYuvOrg->getStride(), 2862 cYuvPred .getLumaAddr( uiAbsPartIdx ), cYuvPred .getStride(), 2863 iWidth, iHeight, m_pcEncCfg->getUseHADME() ); 2864 ruiErr = cDistParam.DistFunc( &cDistParam ); 2865 2866 cYuvPred.destroy(); 2867 } 2868 #endif 2869 2816 2870 /** estimation of best merge coding 2817 2871 * \param pcCU … … 2875 2929 PartSize ePartSize = pcCU->getPartitionSize( 0 ); 2876 2930 2931 #if POZNAN_DBMP_CALC_PRED_DATA 2932 if(uiMergeCand==POZNAN_DBMP_MRG_CAND) 2933 { 2934 pcCU->getCUMvField2nd( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand].getMv(), cMvFieldNeighbours[0 + 2*uiMergeCand].getRefIdx(), ePartSize, uiAbsPartIdx, iPUIdx, 0 ); 2935 pcCU->getCUMvField2nd( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand].getMv(), cMvFieldNeighbours[1 + 2*uiMergeCand].getRefIdx(), ePartSize, uiAbsPartIdx, iPUIdx, 0 ); 2936 } 2937 else 2938 #endif 2939 { 2877 2940 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand].getMv(), cMvFieldNeighbours[0 + 2*uiMergeCand].getRefIdx(), ePartSize, uiAbsPartIdx, iPUIdx, 0 ); 2878 2941 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand].getMv(), cMvFieldNeighbours[1 + 2*uiMergeCand].getRefIdx(), ePartSize, uiAbsPartIdx, iPUIdx, 0 ); 2879 2942 } 2943 2944 #if POZNAN_DBMP 2945 if(uiMergeCand==POZNAN_DBMP_MRG_CAND) 2946 xGetInterPredictionError_DBMP( pcCU, pcYuvOrg, iPUIdx, uiCostCand, m_pcEncCfg->getUseHADME() ); 2947 else 2880 2948 xGetInterPredictionError( pcCU, pcYuvOrg, iPUIdx, uiCostCand, m_pcEncCfg->getUseHADME() ); 2949 #else 2950 xGetInterPredictionError( pcCU, pcYuvOrg, iPUIdx, uiCostCand, m_pcEncCfg->getUseHADME() ); 2951 #endif 2881 2952 2882 2953 if( uiNumCand == 1 ) … … 2886 2957 else 2887 2958 { 2888 if( uiMergeCand == 0 || uiNumCand == 2 ) 2959 UInt uiMergeCandIdx = uiMergeCand; 2960 #if POZNAN_DBMP 2961 if(pcCU->getSlice()->getMP()->isDBMPEnabled()) 2962 { 2963 if(uiMergeCand == POZNAN_DBMP_MRG_CAND) uiMergeCandIdx = POZNAN_DBMP_MERGE_POS; 2964 else if(uiMergeCand >= POZNAN_DBMP_MERGE_POS) uiMergeCandIdx++; 2965 } 2966 #endif 2967 2968 if( uiMergeCandIdx == 0 || uiNumCand == 2 ) 2889 2969 { 2890 2970 uiBitsCand = 2; 2891 2971 } 2892 else if( uiMergeCand == 1 || uiNumCand == 3 )2972 else if( uiMergeCandIdx == 1 || uiNumCand == 3 ) 2893 2973 { 2894 2974 uiBitsCand = 3; 2895 2975 } 2896 else if( uiMergeCand == 2 || uiNumCand == 4 )2976 else if( uiMergeCandIdx == 2 || uiNumCand == 4 ) 2897 2977 { 2898 2978 uiBitsCand = 4; 2899 2979 } 2980 else if( uiMergeCandIdx == 3 || uiNumCand == 5 ) 2981 { 2982 uiBitsCand = 5; 2983 } 2900 2984 else 2901 2985 { 2902 uiBitsCand = 5;2986 uiBitsCand = 6; 2903 2987 } 2904 2988 } … … 2910 2994 pacMvField[0] = cMvFieldNeighbours[0 + 2*uiMergeCand]; 2911 2995 pacMvField[1] = cMvFieldNeighbours[1 + 2*uiMergeCand]; 2996 2997 #if POZNAN_DBMP_CALC_PRED_DATA 2998 if(uiMergeCand==POZNAN_DBMP_MRG_CAND) 2999 { 3000 TComCUMvField* pcDBMPPredMvField; 3001 3002 pcDBMPPredMvField = pcCU->getSlice()->getMP()->getDBMPPredMVField(REF_PIC_LIST_0); 3003 pcDBMPPredMvField->setMv(pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(uiAbsPartIdx),0); 3004 pcDBMPPredMvField->setRefIdx(pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiAbsPartIdx),0); 3005 3006 pcDBMPPredMvField = pcCU->getSlice()->getMP()->getDBMPPredMVField(REF_PIC_LIST_1); 3007 pcDBMPPredMvField->setMv(pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(uiAbsPartIdx),0); 3008 pcDBMPPredMvField->setRefIdx(pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(uiAbsPartIdx),0); 3009 } 3010 #endif 3011 2912 3012 uiInterDir = uhInterDirNeighbours[uiMergeCand]; 2913 3013 uiMergeIndex = uiMergeCand; … … 3604 3704 pcCU->setMergeIndexSubParts( uiMRGIndex, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 3605 3705 pcCU->setInterDirSubParts ( uiMRGInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 3706 3707 #if POZNAN_DBMP_CALC_PRED_DATA 3708 if(uiMRGIndex==POZNAN_DBMP_MRG_CAND) 3709 { 3710 TComCUMvField* pcDBMPPredMvField; 3711 pcDBMPPredMvField = pcCU->getSlice()->getMP()->getDBMPPredMVField(REF_PIC_LIST_0); 3712 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( pcDBMPPredMvField->getMv(0), pcDBMPPredMvField->getRefIdx(0), ePartSize, uiPartAddr, iPartIdx, 0 ); 3713 pcDBMPPredMvField = pcCU->getSlice()->getMP()->getDBMPPredMVField(REF_PIC_LIST_1); 3714 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( pcDBMPPredMvField->getMv(0), pcDBMPPredMvField->getRefIdx(0), ePartSize, uiPartAddr, iPartIdx, 0 ); 3715 3716 pcCU->getCUMvField2nd( REF_PIC_LIST_0 )->setAllMvField( cMRGMvField[0].getMv(), cMRGMvField[0].getRefIdx(), ePartSize, uiPartAddr, iPartIdx, 0 ); 3717 pcCU->getCUMvField2nd( REF_PIC_LIST_1 )->setAllMvField( cMRGMvField[1].getMv(), cMRGMvField[1].getRefIdx(), ePartSize, uiPartAddr, iPartIdx, 0 ); 3718 } 3719 else 3720 #endif 3606 3721 { 3607 3722 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMRGMvField[0].getMv(), cMRGMvField[0].getRefIdx(), ePartSize, uiPartAddr, iPartIdx, 0 ); … … 4998 5113 m_pcEntropyCoder->estimateBit(m_pcTrQuant->m_pcEstBitsSbac, 1<< uiLog2TrSize, TEXT_LUMA ); 4999 5114 } 5115 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 5116 m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ) + pcCU->getQpOffsetForTextCU(uiAbsPartIdx, false), false, pcCU->getSlice()->getSliceType(), TEXT_LUMA ); 5117 #else 5000 5118 m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), false, pcCU->getSlice()->getSliceType(), TEXT_LUMA ); 5119 #endif 5001 5120 m_pcTrQuant->transformNxN( pcCU, pcResi->getLumaAddr( uiAbsPartIdx ), pcResi->getStride (), pcCoeffCurrY, 1<< uiLog2TrSize, 1<< uiLog2TrSize, uiAbsSumY, TEXT_LUMA, uiAbsPartIdx ); 5002 5121 … … 5009 5128 m_pcEntropyCoder->estimateBit(m_pcTrQuant->m_pcEstBitsSbac, 1<<uiLog2TrSizeC, TEXT_CHROMA ); 5010 5129 } 5130 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 5131 m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ) + pcCU->getQpOffsetForTextCU(uiAbsPartIdx, false), false, pcCU->getSlice()->getSliceType(), TEXT_CHROMA ); 5132 #else 5011 5133 m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), false, pcCU->getSlice()->getSliceType(), TEXT_CHROMA ); 5134 #endif 5012 5135 m_pcTrQuant->transformNxN( pcCU, pcResi->getCbAddr( uiAbsPartIdx ), pcResi->getCStride(), pcCoeffCurrU, 1<<uiLog2TrSizeC, 1<<uiLog2TrSizeC, uiAbsSumU, TEXT_CHROMA_U, uiAbsPartIdx ); 5013 5136 m_pcTrQuant->transformNxN( pcCU, pcResi->getCrAddr( uiAbsPartIdx ), pcResi->getCStride(), pcCoeffCurrV, 1<<uiLog2TrSizeC, 1<<uiLog2TrSizeC, uiAbsSumV, TEXT_CHROMA_V, uiAbsPartIdx ); … … 5072 5195 { 5073 5196 Pel *pcResiCurrY = m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( uiAbsPartIdx ); 5197 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 5198 m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ) + pcCU->getQpOffsetForTextCU(uiAbsPartIdx, false), false, pcCU->getSlice()->getSliceType(), TEXT_LUMA ); 5199 #else 5074 5200 m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), false, pcCU->getSlice()->getSliceType(), TEXT_LUMA ); 5201 #endif 5075 5202 #if INTRA_DST_TYPE_7 // Inside Inter Encoder Search. So use conventional DCT. 5076 5203 m_pcTrQuant->invtransformNxN( TEXT_LUMA,REG_DCT, pcResiCurrY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), pcCoeffCurrY, 1<< uiLog2TrSize, 1<< uiLog2TrSize );//this is for inter mode only … … 5150 5277 { 5151 5278 Pel *pcResiCurrU = m_pcQTTempTComYuv[uiQTTempAccessLayer].getCbAddr( uiAbsPartIdx ); 5279 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 5280 m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ) + pcCU->getQpOffsetForTextCU(uiAbsPartIdx, false), false, pcCU->getSlice()->getSliceType(), TEXT_CHROMA ); 5281 #else 5152 5282 m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), false, pcCU->getSlice()->getSliceType(), TEXT_CHROMA ); 5283 #endif 5153 5284 #if INTRA_DST_TYPE_7 // Inside Inter Encoder Search. So use conventional DCT. 5154 5285 m_pcTrQuant->invtransformNxN( TEXT_CHROMA,REG_DCT, pcResiCurrU, m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride(), pcCoeffCurrU, 1<<uiLog2TrSizeC, 1<<uiLog2TrSizeC); … … 5195 5326 if( !uiAbsSumU ) 5196 5327 { 5328 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 5329 m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ) + pcCU->getQpOffsetForTextCU(uiAbsPartIdx, false), false, pcCU->getSlice()->getSliceType(), TEXT_CHROMA ); 5330 #else 5197 5331 m_pcTrQuant->setQPforQuant( pcCU->getQP( 0 ), false, pcCU->getSlice()->getSliceType(), TEXT_CHROMA ); 5332 #endif 5198 5333 } 5199 5334 #if INTRA_DST_TYPE_7 // Inside Inter Encoder Search. So use conventional DCT. -
branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncSearch.h
r5 r28 185 185 186 186 Void xGetInterPredictionError( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPartIdx, UInt& ruiSAD, Bool Hadamard ); 187 #if POZNAN_DBMP 188 Void xGetInterPredictionError_DBMP( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPartIdx, UInt& ruiSAD, Bool Hadamard ); 189 #endif 187 190 188 191 public: -
branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncTop.cpp
r21 r28 63 63 m_bSeqFirst = true; 64 64 m_iFrameNumInCodingOrder = 0; 65 66 #if POZNAN_MP 67 m_pcMP=NULL; 68 #endif 69 65 70 } 66 71 … … 98 103 #endif 99 104 105 #if POZNAN_MP 106 m_pcMP = NULL; 107 #endif 108 100 109 #if MQT_BA_RA && MQT_ALF_NPASS 101 110 if(m_bUseALF) … … 163 172 #endif 164 173 174 #if POZNAN_MP 175 m_pcMP=NULL; 176 #endif 177 165 178 // SBAC RD 166 179 if( m_bUseSBACRD ) … … 205 218 // initialize PPS 206 219 xInitPPS(); 220 #endif 221 222 #if POZNAN_MP 223 m_pcMP = pcTAppEncTop->getMP(); 207 224 #endif 208 225 … … 416 433 { 417 434 pcPic->removeOriginalBuffer (); 435 #if POZNAN_AVAIL_MAP 436 pcPic->removeAvailabilityBuffer(); 437 #endif 438 #if POZNAN_SYNTH_VIEW 439 pcPic->removeSynthesisBuffer(); 440 #endif 441 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 442 pcPic->removeSynthesisDepthBuffer(); 443 #endif 418 444 #if HHI_INTER_VIEW_MOTION_PRED 419 445 pcPic->removeOrgDepthMapBuffer(); … … 508 534 // mark it should be extended 509 535 rpcPic->getPicYuvRec()->setBorderExtension(false); 536 537 #if POZNAN_MP 538 rpcPic->getSlice(0)->setMP(m_pcMP); 539 #endif 510 540 } 511 541 … … 579 609 } 580 610 } 611 612 #if POZNAN_DBMP 613 m_cSPS.setDBMP ( m_uiDBMP ); 614 #endif 615 581 616 m_cSPS.setSPSId( ( m_uiViewId << 1 ) + ( m_bIsDepth ? 1 : 0 ) ); 582 617 … … 618 653 #if HHI_MPI 619 654 m_cSPS.setUseMVI( m_bUseMVI ); 655 #endif 656 657 #if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU 658 m_cSPS.setUseCUSkip( m_uiUseCUSkip ); 659 #endif 660 661 #if POZNAN_NONLINEAR_DEPTH 662 m_cSPS.setDepthPower ( m_fDepthPower ); 663 // OLGIERD: ToDo - QP-Tex should not use getDepthPower() from texture SPS. 664 #endif 665 666 #if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 667 m_cSPS.setUseTexDqpAccordingToDepth ( m_bUseTexDqpAccordingToDepth ); 620 668 #endif 621 669 … … 821 869 822 870 pcPic->setScaleOffset( m_aaiCodedScale, m_aaiCodedOffset ); 823 } 871 872 #if POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC 873 pcPic->setTexDqpAccordingToDepthOffset( getTexDqpAccordingToDepthOffset() ); 874 pcPic->setTexDqpAccordingToDepthMul ( getTexDqpAccordingToDepthMul() ); 875 pcPic->setTexDqpAccordingToDepthTopBottomRow( getTexDqpAccordingToDepthTopBottomRow() ); 876 #endif 877 } -
branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncTop.h
r5 r28 64 64 #include "TEncAnalyze.h" 65 65 66 #if POZNAN_MP 67 #include "../TLibCommon/TComMP.h" 68 #endif 66 69 67 70 // ==================================================================================================================== … … 131 134 132 135 PicOrderCnt m_iFrameNumInCodingOrder; 136 #if POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC 137 Double m_dTexDqpAccordingToDepthOffset; 138 Double m_dTexDqpAccordingToDepthMul; 139 Int m_iTexDqpAccordingToDepthTopBottomRow; 140 #endif 141 142 #if POZNAN_MP 143 TComMP* m_pcMP; 144 #endif 133 145 134 146 protected: … … 217 229 Void encode ( bool bEos, std::map<PicOrderCnt, TComPicYuv*>& rcMapPicYuvRecOut, TComBitstream* pcBitstreamOut, Bool& bNewPicNeeded ); 218 230 Void receivePic( bool bEos, TComPicYuv* pcPicYuvOrg, TComPicYuv* pcPicYuvRec, TComPicYuv* pcOrgPdmDepth = 0 ); 231 232 #if POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC 233 Double getTexDqpAccordingToDepthOffset( ) { return m_dTexDqpAccordingToDepthOffset;} 234 Double getTexDqpAccordingToDepthMul( ) { return m_dTexDqpAccordingToDepthMul;} 235 Int getTexDqpAccordingToDepthTopBottomRow( ){ return m_iTexDqpAccordingToDepthTopBottomRow;} 236 Void setTexDqpAccordingToDepthOffset ( Double dTexDqpAccordingToDepthOffset ){ m_dTexDqpAccordingToDepthOffset = dTexDqpAccordingToDepthOffset; } 237 Void setTexDqpAccordingToDepthMul ( Double dTexDqpAccordingToDepthMul ){ m_dTexDqpAccordingToDepthMul = dTexDqpAccordingToDepthMul; } 238 Void setTexDqpAccordingToDepthTopBottomRow( Int iTexDqpAccordingToDepthTopBottomRow ){ m_iTexDqpAccordingToDepthTopBottomRow = iTexDqpAccordingToDepthTopBottomRow; } 239 #endif 219 240 }; 220 241
Note: See TracChangeset for help on using the changeset viewer.