Changeset 816 in 3DVCSoftware for branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon
- Timestamp:
- 3 Feb 2014, 11:35:43 (11 years ago)
- Location:
- branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/ContextTables.h
r773 r816 125 125 #define NUM_INTER_SDC_RESIDUAL_CTX 1 ///< number of context models for abs of inter SDC residual 126 126 #endif 127 128 #if H_3D_DBBP 129 #define DBBP_NUM_FLAG_CTX 1 130 #endif 127 131 // ==================================================================================================================== 128 132 // Tables … … 459 463 //! \} 460 464 461 462 #endif 465 #if H_3D_DBBP 466 static const UChar INIT_DBBP_FLAG[3][DBBP_NUM_FLAG_CTX] = 467 { 468 { CNU }, 469 { CNU }, 470 { CNU }, 471 }; 472 #endif 473 474 #endif -
branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComDataCU.cpp
r809 r816 153 153 m_pucInterSDCMask = NULL; 154 154 #endif 155 #if H_3D_DBBP 156 m_pbDBBPFlag = NULL; 157 #endif 155 158 156 159 #if MTK_DDD_G0063 … … 288 291 } 289 292 #endif 293 #if H_3D_DBBP 294 m_pbDBBPFlag = (Bool* )xMalloc(Bool, uiNumPartition); 295 #endif 290 296 } 291 297 else … … 425 431 if ( m_apSegmentInterDCOffset[i] ) { xFree( m_apSegmentInterDCOffset[i] ); m_apSegmentInterDCOffset[i] = NULL; } 426 432 } 433 #endif 434 #if H_3D_DBBP 435 if ( m_pbDBBPFlag ) { xFree(m_pbDBBPFlag); m_pbDBBPFlag = NULL; } 427 436 #endif 428 437 } … … 577 586 #if H_3D_INTER_SDC 578 587 m_pbInterSDCFlag[ui] = pcFrom->m_pbInterSDCFlag[ui]; 588 #endif 589 #if H_3D_DBBP 590 m_pbDBBPFlag[ui] = pcFrom->m_pbDBBPFlag[ui]; 579 591 #endif 580 592 } … … 653 665 memset( m_apSegmentInterDCOffset[i] + firstElement, 0, numElements * sizeof( *m_apSegmentInterDCOffset[i] ) ); 654 666 } 667 #endif 668 #if H_3D_DBBP 669 memset( m_pbDBBPFlag + firstElement, false, numElements * sizeof( *m_pbDBBPFlag ) ); 655 670 #endif 656 671 } … … 832 847 } 833 848 #endif 849 #if H_3D_DBBP 850 m_pbDBBPFlag[ui] = false; 851 #endif 834 852 } 835 853 } … … 950 968 memset( m_apSegmentInterDCOffset[i], 0, sizeof( Int ) * m_uiNumPartition ); 951 969 } 970 #endif 971 #if H_3D_DBBP 972 memset( m_pbDBBPFlag, 0, iSizeInBool ); 952 973 #endif 953 974 … … 1034 1055 } 1035 1056 #endif 1057 #if H_3D_DBBP 1058 m_pbDBBPFlag[ui]=pcCU->m_pbDBBPFlag[uiPartOffset+ui]; 1059 #endif 1036 1060 } 1037 1061 } … … 1195 1219 } 1196 1220 #endif 1221 #if H_3D_DBBP 1222 m_pbDBBPFlag = pcCU->getDBBPFlag() + uiPart; 1223 #endif 1197 1224 m_puhDepth=pcCU->getDepth() + uiPart; 1198 1225 m_puhWidth=pcCU->getWidth() + uiPart; … … 1311 1338 m_pucDisparityDerivedDepth = pcCU->getDDDepth() + uiAbsPartIdx; 1312 1339 m_pbUseDDD = pcCU->getUseDDD() + uiAbsPartIdx; 1340 #endif 1341 1342 #if H_3D_DBBP 1343 m_pbDBBPFlag = pcCU->getDBBPFlag() + uiAbsPartIdx; 1313 1344 #endif 1314 1345 … … 1400 1431 } 1401 1432 #endif 1433 #if H_3D_DBBP 1434 memcpy( m_pbDBBPFlag + uiOffset, pcCU->getDBBPFlag(), iSizeInBool ); 1435 #endif 1402 1436 1403 1437 memcpy( m_puhDepth + uiOffset, pcCU->getDepth(), iSizeInUchar ); … … 1527 1561 } 1528 1562 #endif 1563 #if H_3D_DBBP 1564 memcpy( rpcCU->getDBBPFlag() + m_uiAbsIdxInLCU, m_pbDBBPFlag, iSizeInBool ); 1565 #endif 1566 1529 1567 memcpy( rpcCU->getDepth() + m_uiAbsIdxInLCU, m_puhDepth, iSizeInUchar ); 1530 1568 memcpy( rpcCU->getWidth() + m_uiAbsIdxInLCU, m_puhWidth, iSizeInUchar ); … … 1640 1678 } 1641 1679 #endif 1680 #if H_3D_DBBP 1681 memcpy( rpcCU->getDBBPFlag() + uiPartOffset, m_pbDBBPFlag, iSizeInBool ); 1682 #endif 1683 1642 1684 memcpy( rpcCU->getDepth() + uiPartOffset, m_puhDepth, iSizeInUchar ); 1643 1685 memcpy( rpcCU->getWidth() + uiPartOffset, m_puhWidth, iSizeInUchar ); … … 2378 2420 2379 2421 return uiCtx; 2422 } 2423 #endif 2424 2425 #if H_3D_DBBP 2426 Pel* TComDataCU::getVirtualDepthBlock(UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt& uiDepthStride) 2427 { 2428 // get coded and reconstructed depth view 2429 TComPicYuv* depthPicYuv = NULL; 2430 Pel* pDepthPels = NULL; 2431 2432 // DBBP is a texture coding tool 2433 if( getSlice()->getIsDepth() ) 2434 return NULL; 2435 2436 #if H_3D_FCO 2437 TComPic* depthPic = getSlice()->getIvPic(true, getSlice()->getViewIndex() ); 2438 2439 if( depthPic && depthPic->getPicYuvRec() != NULL && depthPic->getIsDepth() ) // depth first 2440 { 2441 depthPicYuv = depthPic->getPicYuvRec(); 2442 depthPicYuv->extendPicBorder(); 2443 2444 // get collocated depth block for current CU 2445 uiDepthStride = depthPicYuv->getStride(); 2446 pDepthPels = depthPicYuv->getLumaAddr( getAddr(), uiAbsPartIdx ); 2447 } 2448 else // texture first 2449 #else 2450 { 2451 DisInfo DvInfo = getDvInfo(uiAbsPartIdx); 2452 2453 TComPic* baseDepthPic = getSlice()->getIvPic (true, DvInfo.m_aVIdxCan); 2454 2455 if( baseDepthPic == NULL || baseDepthPic->getPicYuvRec() == NULL ) 2456 return NULL; 2457 2458 depthPicYuv = baseDepthPic->getPicYuvRec(); 2459 depthPicYuv->extendPicBorder(); 2460 uiDepthStride = depthPicYuv->getStride(); 2461 2462 Int iBlkX = ( getAddr() % baseDepthPic->getFrameWidthInCU() ) * g_uiMaxCUWidth + g_auiRasterToPelX[ g_auiZscanToRaster[ getZorderIdxInCU()+uiAbsPartIdx ] ]; 2463 Int iBlkY = ( getAddr() / baseDepthPic->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ getZorderIdxInCU()+uiAbsPartIdx ] ]; 2464 2465 Int iPictureWidth = depthPicYuv->getWidth(); 2466 Int iPictureHeight = depthPicYuv->getHeight(); 2467 2468 Int iWidth = uiWidth; 2469 Int iHeight = uiHeight; 2470 2471 Bool depthRefineFlag = false; 2472 #if H_3D_NBDV_REF 2473 depthRefineFlag = m_pcSlice->getVPS()->getDepthRefinementFlag( m_pcSlice->getLayerIdInVps() ); 2474 #endif // H_3D_NBDV_REF 2475 2476 TComMv cDv = depthRefineFlag ? DvInfo.m_acDoNBDV : DvInfo.m_acNBDV; 2477 2478 Int depthPosX = Clip3(0, iPictureWidth - iWidth, iBlkX + ((cDv.getHor()+2)>>2)); 2479 Int depthPosY = Clip3(0, iPictureHeight- iHeight, iBlkY + ((cDv.getVer()+2)>>2)); 2480 2481 pDepthPels = depthPicYuv->getLumaAddr() + depthPosX + depthPosY * uiDepthStride; 2482 } 2483 #endif 2484 2485 AOF( depthPicYuv != NULL ); 2486 AOF( pDepthPels != NULL ); 2487 AOF( uiDepthStride != 0 ); 2488 2489 return pDepthPels; 2490 } 2491 #endif 2492 2493 #if H_3D_DBBP 2494 Void TComDataCU::setDBBPFlagSubParts ( Bool bDBBPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ) 2495 { 2496 setSubPart( bDBBPFlag, m_pbDBBPFlag, uiAbsPartIdx, uiDepth, uiPartIdx ); 2380 2497 } 2381 2498 #endif … … 4030 4147 #if H_3D_ARP 4031 4148 Bool bARPFlag = getARPW(uiAbsPartIdx)>0 ? true : false; 4149 #endif 4150 #if H_3D_DBBP 4151 Bool bDBBPFlag = getDBBPFlag(uiAbsPartIdx); 4032 4152 #endif 4033 4153 … … 4696 4816 pbSPIVMPFlag[iCount] = true; 4697 4817 #endif 4818 #if H_3D_DBBP 4819 pbSPIVMPFlag[iCount] &= !bDBBPFlag; 4820 #endif 4698 4821 if( ( ivCandDir[0] & 1 ) == 1 ) 4699 4822 { … … 5809 5932 Int height = 0; 5810 5933 UInt partAddr; 5934 5935 #if H_3D_DBBP 5936 if( getDBBPFlag(0) ) 5937 return true; 5938 #endif 5811 5939 5812 5940 getPartIndexAndSize( puIdx, partAddr, width, height ); -
branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComDataCU.h
r809 r816 97 97 }; 98 98 99 #if H_3D_DBBP 100 typedef struct _DBBPTmpData 101 { 102 TComMv acMvd[2][2]; // for two segments and two lists 103 TComMvField acMvField[2][2]; // for two segments and two lists 104 Int aiMvpNum[2][2]; // for two segments and two lists 105 Int aiMvpIdx[2][2]; // for two segments and two lists 106 UChar auhInterDir[2]; // for two segments 107 Bool abMergeFlag[2]; // for two segments 108 UChar auhMergeIndex[2]; // for two segments 109 Char ahVSPFlag[2]; // for two segments 110 DisInfo acDvInfo[2]; // for two segments 111 112 PartSize eVirtualPartSize; 113 UInt uiVirtualPartIndex; 114 } DBBPTmpData; 115 #endif 99 116 100 117 // ==================================================================================================================== … … 223 240 UChar* m_pucInterSDCMask; 224 241 #endif 242 #if H_3D_DBBP 243 Bool* m_pbDBBPFlag; ///< array of DBBP flags 244 DBBPTmpData m_sDBBPTmpData; 245 #endif 225 246 #if H_3D 226 247 Bool m_bAvailableFlagA1; ///< A1 available flag … … 362 383 Void setCUTransquantBypassSubParts( Bool flag, UInt uiAbsPartIdx, UInt uiDepth ); 363 384 385 #if H_3D_DBBP 386 Pel* getVirtualDepthBlock(UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt& uiDepthStride); 387 #endif 388 364 389 Bool* getSkipFlag () { return m_skipFlag; } 365 390 Bool getSkipFlag (UInt idx) { return m_skipFlag[idx]; } … … 373 398 Void setPredictionMode ( UInt uiIdx, PredMode uh){ m_pePredMode[uiIdx] = uh; } 374 399 Void setPredModeSubParts ( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth ); 400 401 #if H_3D_DBBP 402 Bool* getDBBPFlag () { return m_pbDBBPFlag; } 403 Bool getDBBPFlag ( UInt uiIdx ) { return m_pbDBBPFlag[uiIdx]; } 404 Void setDBBPFlag ( UInt uiIdx, Bool b ) { m_pbDBBPFlag[uiIdx] = b; } 405 Void setDBBPFlagSubParts ( Bool bDBBPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth ); 406 DBBPTmpData* getDBBPTmpData () { return &m_sDBBPTmpData; } 407 #endif 375 408 376 409 UChar* getWidth () { return m_puhWidth; } -
branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComPrediction.cpp
r809 r816 601 601 #endif 602 602 603 #if H_3D_DBBP 604 PartSize TComPrediction::getPartitionSizeFromDepth(Pel* pDepthPels, UInt uiDepthStride, UInt uiSize) 605 { 606 // find virtual partitioning for this CU based on depth block 607 // segmentation of texture block --> mask IDs 608 Pel* pDepthBlockStart = pDepthPels; 609 610 // first compute average of depth block for thresholding 611 Int iSumDepth = 0; 612 Int iSubSample = 4; 613 for (Int y=0; y<uiSize; y+=iSubSample) 614 { 615 for (Int x=0; x<uiSize; x+=iSubSample) 616 { 617 Int depthPel = pDepthPels[x]; 618 619 iSumDepth += depthPel; 620 } 621 622 // next row 623 pDepthPels += uiDepthStride*iSubSample; 624 } 625 626 Int iSizeInBits = g_aucConvertToBit[uiSize] - g_aucConvertToBit[iSubSample]; // respect sub-sampling factor 627 Int iMean = iSumDepth >> iSizeInBits*2; // iMean /= (uiWidth*uiHeight); 628 AOF( iMean == iSumDepth/((uiSize/iSubSample)*(uiSize/iSubSample) ) ); 629 AOF( iMean >= 0 && iMean < 256); 630 631 // start again for segmentation 632 pDepthPels = pDepthBlockStart; 633 634 // start mapping process 635 Bool bAMPAvail = uiSize > 8; 636 Int matchedPartSum[6][2] = {{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}}; // counter for each part size and boolean option 637 PartSize virtualPartSizes[6] = { SIZE_Nx2N, SIZE_2NxN, SIZE_2NxnU, SIZE_2NxnD, SIZE_nLx2N, SIZE_nRx2N }; 638 639 UInt uiHalfSize = uiSize>>1; 640 UInt uiQuarterSize = uiSize>>2; 641 642 for (Int y=0; y<uiSize; y+=iSubSample) 643 { 644 for (Int x=0; x<uiSize; x+=iSubSample) 645 { 646 Int depthPel = pDepthPels[x]; 647 648 // decide which segment this pixel belongs to 649 Int ucSegment = (Int)(depthPel>iMean); 650 AOF( ucSegment == 0 || ucSegment == 1 ); 651 652 // Matched Filter to find optimal (conventional) partitioning 653 654 // SIZE_Nx2N 655 if(x<uiHalfSize) // left 656 matchedPartSum[0][ucSegment]++; 657 else // right 658 matchedPartSum[0][1-ucSegment]++; 659 660 // SIZE_2NxN 661 if(y<uiHalfSize) // top 662 matchedPartSum[1][ucSegment]++; 663 else // bottom 664 matchedPartSum[1][1-ucSegment]++; 665 666 if( bAMPAvail ) 667 { 668 // SIZE_2NxnU 669 if(y<uiQuarterSize) // top (1/4) 670 matchedPartSum[2][ucSegment]++; 671 else // bottom (3/4) 672 matchedPartSum[2][1-ucSegment]++; 673 674 // SIZE_2NxnD 675 if(y<(uiQuarterSize*3)) // top (3/4) 676 matchedPartSum[3][ucSegment]++; 677 else // bottom (1/4) 678 matchedPartSum[3][1-ucSegment]++; 679 680 // SIZE_nLx2N 681 if(x<uiQuarterSize) // left (1/4) 682 matchedPartSum[4][ucSegment]++; 683 else // right (3/4) 684 matchedPartSum[4][1-ucSegment]++; 685 686 // SIZE_nRx2N 687 if(x<(uiQuarterSize*3)) // left (3/4) 688 matchedPartSum[5][ucSegment]++; 689 else // right (1/4) 690 matchedPartSum[5][1-ucSegment]++; 691 } 692 } 693 694 // next row 695 pDepthPels += uiDepthStride*iSubSample; 696 } 697 698 PartSize matchedPartSize = SIZE_NONE; 699 700 Int iMaxMatchSum = 0; 701 for(Int p=0; p<6; p++) // loop over partition sizes 702 { 703 for( Int b=0; b<=1; b++ ) // loop over boolean options 704 { 705 if(matchedPartSum[p][b] > iMaxMatchSum) 706 { 707 iMaxMatchSum = matchedPartSum[p][b]; 708 matchedPartSize = virtualPartSizes[p]; 709 } 710 } 711 } 712 713 AOF( matchedPartSize != SIZE_NONE ); 714 715 return matchedPartSize; 716 } 717 718 Bool TComPrediction::getSegmentMaskFromDepth( Pel* pDepthPels, UInt uiDepthStride, UInt uiWidth, UInt uiHeight, Bool* pMask ) 719 { 720 AOF( uiWidth == uiHeight ); 721 722 // segmentation of texture block --> mask IDs 723 Pel* pDepthBlockStart = pDepthPels; 724 725 // first compute average of depth block for thresholding 726 Int iSumDepth = 0; 727 Int uiMinDepth = MAX_INT; 728 Int uiMaxDepth = 0; 729 for (Int y=0; y<uiHeight; y++) 730 { 731 for (Int x=0; x<uiWidth; x++) 732 { 733 Int depthPel = pDepthPels[x]; 734 iSumDepth += depthPel; 735 736 if( depthPel > uiMaxDepth ) 737 uiMaxDepth = depthPel; 738 if( depthPel < uiMinDepth ) 739 uiMinDepth = depthPel; 740 } 741 742 // next row 743 pDepthPels += uiDepthStride; 744 } 745 746 // don't generate mask for blocks with small depth range (encoder decision) 747 if( uiMaxDepth - uiMinDepth < 10 ) 748 return false; 749 750 Int iSizeInBits = g_aucConvertToBit[uiWidth]+2; 751 Int iMean = iSumDepth >> iSizeInBits*2; // iMean /= (uiWidth*uiHeight); 752 AOF( iMean == iSumDepth/(uiWidth*uiHeight) ); 753 AOF( iMean >= 0 && iMean < 256); 754 755 // start again for segmentation 756 pDepthPels = pDepthBlockStart; 757 758 Bool bInvertMask = pDepthPels[0]>iMean; // top-left segment needs to be mapped to partIdx 0 759 760 // generate mask 761 UInt uiSumPix[2] = {0,0}; 762 for (Int y=0; y<uiHeight; y++) 763 { 764 for (Int x=0; x<uiHeight; x++) 765 { 766 Int depthPel = pDepthPels[x]; 767 768 // decide which segment this pixel belongs to 769 Int ucSegment = (Int)(depthPel>iMean); 770 AOF( ucSegment == 0 || ucSegment == 1 ); 771 772 if( bInvertMask ) 773 ucSegment = 1-ucSegment; 774 775 // count pixels for each segment 776 uiSumPix[ucSegment]++; 777 778 // set mask value 779 pMask[x] = (Bool)ucSegment; 780 } 781 782 // next row 783 pDepthPels += uiDepthStride; 784 pMask += MAX_CU_SIZE; 785 } 786 787 // don't generate valid mask for tiny segments (encoder decision) 788 // each segment needs to cover at least 1/8th of block 789 UInt uiMinPixPerSegment = (uiWidth*uiHeight) >> 3; 790 if( !( uiSumPix[0] > uiMinPixPerSegment && uiSumPix[1] > uiMinPixPerSegment ) ) 791 return false; 792 793 // all good 794 return true; 795 } 796 797 Void TComPrediction::combineSegmentsWithMask( TComYuv* pInYuv[2], TComYuv* pOutYuv, Bool* pMask, UInt uiWidth, UInt uiHeight, UInt uiPartAddr ) 798 { 799 Pel* piSrc[2] = {pInYuv[0]->getLumaAddr(uiPartAddr), pInYuv[1]->getLumaAddr(uiPartAddr)}; 800 UInt uiSrcStride = pInYuv[0]->getStride(); 801 Pel* piDst = pOutYuv->getLumaAddr(uiPartAddr); 802 UInt uiDstStride = pOutYuv->getStride(); 803 804 UInt uiMaskStride= MAX_CU_SIZE; 805 806 // backup pointer 807 Bool* pMaskStart = pMask; 808 809 // combine luma first 810 for (Int y=0; y<uiHeight; y++) 811 { 812 for (Int x=0; x<uiWidth; x++) 813 { 814 UChar ucSegment = (UChar)pMask[x]; 815 AOF( ucSegment < 2 ); 816 817 // filtering 818 Bool t = (y==0)?pMaskStart[(y+1)*uiMaskStride+x]:pMaskStart[(y-1)*uiMaskStride+x]; 819 Bool l = (x==0)?pMaskStart[y*uiMaskStride+x+1]:pMaskStart[y*uiMaskStride+x-1]; 820 Bool b = (y==uiHeight-1)?pMaskStart[(y-1)*uiMaskStride+x]:pMaskStart[(y+1)*uiMaskStride+x]; 821 Bool r = (x==uiWidth-1)?pMaskStart[y*uiMaskStride+x-1]:pMaskStart[y*uiMaskStride+x+1]; 822 823 Bool bBlend = !((t&&l&&b&&r) || (!t&&!l&&!b&&!r)); 824 piDst[x] = bBlend?((piSrc[0][x]+piSrc[1][x]+1)>>1):piSrc[ucSegment][x]; 825 } 826 827 piSrc[0] += uiSrcStride; 828 piSrc[1] += uiSrcStride; 829 piDst += uiDstStride; 830 pMask += uiMaskStride; 831 } 832 833 // now combine chroma 834 Pel* piSrcU[2] = { pInYuv[0]->getCbAddr(uiPartAddr), pInYuv[1]->getCbAddr(uiPartAddr) }; 835 Pel* piSrcV[2] = { pInYuv[0]->getCrAddr(uiPartAddr), pInYuv[1]->getCrAddr(uiPartAddr) }; 836 UInt uiSrcStrideC = pInYuv[0]->getCStride(); 837 Pel* piDstU = pOutYuv->getCbAddr(uiPartAddr); 838 Pel* piDstV = pOutYuv->getCrAddr(uiPartAddr); 839 UInt uiDstStrideC = pOutYuv->getCStride(); 840 UInt uiWidthC = uiWidth >> 1; 841 UInt uiHeightC = uiHeight >> 1; 842 pMask = pMaskStart; 843 844 for (Int y=0; y<uiHeightC; y++) 845 { 846 for (Int x=0; x<uiWidthC; x++) 847 { 848 UChar ucSegment = (UChar)pMask[x*2]; 849 AOF( ucSegment < 2 ); 850 851 // filtering 852 Bool t = (y==0)?pMaskStart[(y+1)*2*uiMaskStride+x*2]:pMaskStart[(y-1)*2*uiMaskStride+x*2]; 853 Bool l = (x==0)?pMaskStart[y*2*uiMaskStride+(x+1)*2]:pMaskStart[y*2*uiMaskStride+(x-1)*2]; 854 Bool b = (y==uiHeightC-1)?pMaskStart[(y-1)*2*uiMaskStride+x*2]:pMaskStart[(y+1)*2*uiMaskStride+x*2]; 855 Bool r = (x==uiWidthC-1)?pMaskStart[y*2*uiMaskStride+(x-1)*2]:pMaskStart[y*2*uiMaskStride+(x+1)*2]; 856 857 Bool bBlend = !((t&&l&&b&&r) || (!t&&!l&&!b&&!r)); 858 859 piDstU[x] = bBlend?((piSrcU[0][x]+piSrcU[1][x]+1)>>1):piSrcU[ucSegment][x]; 860 piDstV[x] = bBlend?((piSrcV[0][x]+piSrcV[1][x]+1)>>1):piSrcV[ucSegment][x]; 861 } 862 863 piSrcU[0] += uiSrcStrideC; 864 piSrcU[1] += uiSrcStrideC; 865 piSrcV[0] += uiSrcStrideC; 866 piSrcV[1] += uiSrcStrideC; 867 piDstU += uiDstStrideC; 868 piDstV += uiDstStrideC; 869 pMask += 2*uiMaskStride; 870 } 871 } 872 #endif 873 603 874 Void TComPrediction::motionCompensation ( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList, Int iPartIdx ) 604 875 { -
branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComPrediction.h
r809 r816 179 179 #endif 180 180 #endif 181 182 #if H_3D_DBBP 183 PartSize getPartitionSizeFromDepth(Pel* pDepthPels, UInt uiDepthStride, UInt uiSize); 184 Bool getSegmentMaskFromDepth( Pel* pDepthPels, UInt uiDepthStride, UInt uiWidth, UInt uiHeight, Bool* pMask ); 185 Void combineSegmentsWithMask( TComYuv* pInYuv[2], TComYuv* pOutYuv, Bool* pMask, UInt uiWidth, UInt uiHeight, UInt uiPartAddr = 0 ); 186 #endif 181 187 182 188 Pel predIntraGetPredValDC ( Int* pSrc, Int iSrcStride, UInt iWidth, UInt iHeight, Bool bAbove, Bool bLeft ); -
branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComRdCost.cpp
r655 r816 326 326 rcDistParam.DistFunc = m_afpDistortFunc[eDFunc + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ]; 327 327 328 #if H_3D_DBBP 329 if( g_bTestVirtualParts ) 330 { 331 if( eDFunc >= DF_SSE && eDFunc <= DF_SSE16N ) 332 rcDistParam.DistFunc = TComRdCost::xGetMaskedSSE; 333 else if( eDFunc >= DF_SAD && eDFunc <= DF_SADS16N ) 334 rcDistParam.DistFunc = TComRdCost::xGetMaskedSAD; 335 else if( eDFunc >= DF_HADS && eDFunc <= DF_HADS16N ) 336 rcDistParam.DistFunc = TComRdCost::xGetMaskedHADs; 337 else if( eDFunc >= DF_VSD && eDFunc <= DF_VSD16N ) 338 rcDistParam.DistFunc = TComRdCost::xGetMaskedVSD; 339 else if( eDFunc >= DF_SAD12 && eDFunc <= DF_SADS48 ) 340 rcDistParam.DistFunc = TComRdCost::xGetMaskedSAD; 341 } 342 #endif 343 328 344 // initialize 329 345 rcDistParam.iSubShift = 0; … … 357 373 { 358 374 rcDistParam.DistFunc = m_afpDistortFunc[45 ]; 375 } 376 #endif 377 378 #if H_3D_DBBP 379 if( g_bTestVirtualParts ) 380 { 381 rcDistParam.DistFunc = TComRdCost::xGetMaskedSAD; 359 382 } 360 383 #endif … … 411 434 rcDistParam.DistFunc = m_afpDistortFunc[DF_HADS + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ]; 412 435 } 436 437 #if H_3D_DBBP 438 if( g_bTestVirtualParts ) 439 { 440 if( !bHADME ) 441 rcDistParam.DistFunc = TComRdCost::xGetMaskedSAD; 442 else 443 rcDistParam.DistFunc = TComRdCost::xGetMaskedHADs; 444 } 445 #endif 413 446 414 447 // initialize … … 433 466 rcDP.bitDepth = bitDepth; 434 467 rcDP.DistFunc = m_afpDistortFunc[ ( bHadamard ? DF_HADS : DF_SADS ) + g_aucConvertToBit[ iWidth ] + 1 ]; 468 469 #if H_3D_DBBP 470 if( g_bTestVirtualParts ) 471 { 472 if( !bHadamard ) 473 rcDP.DistFunc = TComRdCost::xGetMaskedSAD; 474 else 475 rcDP.DistFunc = TComRdCost::xGetMaskedHADs; 476 } 477 #endif 478 435 479 #if NS_HAD 436 480 rcDP.bUseNSHAD = bUseNSHAD; … … 631 675 // Distortion functions 632 676 // ==================================================================================================================== 677 678 #if H_3D_DBBP 679 // -------------------------------------------------------------------------------------------------------------------- 680 // Masked distortion functions 681 // -------------------------------------------------------------------------------------------------------------------- 682 683 UInt TComRdCost::xGetMaskedSSE( DistParam* pcDtParam ) 684 { 685 Pel* piOrg = pcDtParam->pOrg; 686 Pel* piCur = pcDtParam->pCur; 687 Int iRows = pcDtParam->iRows; 688 Int iCols = pcDtParam->iCols; 689 Int iStrideOrg = pcDtParam->iStrideOrg; 690 Int iStrideCur = pcDtParam->iStrideCur; 691 692 UInt uiSum = 0; 693 694 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1); 695 696 Int iTemp; 697 698 for( ; iRows != 0; iRows-- ) 699 { 700 for (Int n = 0; n < iCols; n++ ) 701 { 702 if( piOrg[n] != DBBP_INVALID_SHORT ) 703 { 704 iTemp = piOrg[n ] - piCur[n ]; 705 uiSum += ( iTemp * iTemp ) >> uiShift; 706 } 707 } 708 piOrg += iStrideOrg; 709 piCur += iStrideCur; 710 } 711 712 return ( uiSum ); 713 } 714 715 UInt TComRdCost::xGetMaskedSAD( DistParam* pcDtParam ) 716 { 717 718 AOF(!pcDtParam->bApplyWeight); 719 #if H_3D_IC 720 AOF(!pcDtParam->bUseIC); 721 #endif 722 723 Pel* piOrg = pcDtParam->pOrg; 724 Pel* piCur = pcDtParam->pCur; 725 Int iRows = pcDtParam->iRows; 726 Int iCols = pcDtParam->iCols; 727 Int iStrideCur = pcDtParam->iStrideCur; 728 Int iStrideOrg = pcDtParam->iStrideOrg; 729 730 UInt uiSum = 0; 731 732 for( ; iRows != 0; iRows-- ) 733 { 734 for (Int n = 0; n < iCols; n++ ) 735 { 736 if( piOrg[n] != DBBP_INVALID_SHORT ) 737 uiSum += abs( piOrg[n] - piCur[n] ); 738 } 739 piOrg += iStrideOrg; 740 piCur += iStrideCur; 741 } 742 743 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8); 744 } 745 746 UInt TComRdCost::xGetMaskedHADs( DistParam* pcDtParam ) 747 { 748 AOF(!pcDtParam->bApplyWeight); 749 #if H_3D_IC 750 AOF(!pcDtParam->bUseIC); 751 #endif 752 Pel* piOrg = pcDtParam->pOrg; 753 Pel* piCur = pcDtParam->pCur; 754 Int iRows = pcDtParam->iRows; 755 Int iCols = pcDtParam->iCols; 756 Int iStrideCur = pcDtParam->iStrideCur; 757 Int iStrideOrg = pcDtParam->iStrideOrg; 758 Int iStep = pcDtParam->iStep; 759 760 Int x, y; 761 762 UInt uiSum = 0; 763 764 #if NS_HAD 765 if( ( ( iRows % 8 == 0) && (iCols % 8 == 0) && ( iRows == iCols ) ) || ( ( iRows % 8 == 0 ) && (iCols % 8 == 0) && !pcDtParam->bUseNSHAD ) ) 766 #else 767 if( ( iRows % 8 == 0) && (iCols % 8 == 0) ) 768 #endif 769 { 770 Int iOffsetOrg = iStrideOrg<<3; 771 Int iOffsetCur = iStrideCur<<3; 772 for ( y=0; y<iRows; y+= 8 ) 773 { 774 for ( x=0; x<iCols; x+= 8 ) 775 { 776 if( piOrg[x] != DBBP_INVALID_SHORT ) 777 uiSum += xCalcHADs8x8( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 778 } 779 piOrg += iOffsetOrg; 780 piCur += iOffsetCur; 781 } 782 } 783 #if NS_HAD 784 else if ( ( iCols > 8 ) && ( iCols > iRows ) && pcDtParam->bUseNSHAD ) 785 { 786 Int iOffsetOrg = iStrideOrg<<2; 787 Int iOffsetCur = iStrideCur<<2; 788 for ( y=0; y<iRows; y+= 4 ) 789 { 790 for ( x=0; x<iCols; x+= 16 ) 791 { 792 if( piOrg[x] != DBBP_INVALID_SHORT ) 793 uiSum += xCalcHADs16x4( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 794 } 795 piOrg += iOffsetOrg; 796 piCur += iOffsetCur; 797 } 798 } 799 else if ( ( iRows > 8 ) && ( iCols < iRows ) && pcDtParam->bUseNSHAD ) 800 { 801 Int iOffsetOrg = iStrideOrg<<4; 802 Int iOffsetCur = iStrideCur<<4; 803 for ( y=0; y<iRows; y+= 16 ) 804 { 805 for ( x=0; x<iCols; x+= 4 ) 806 { 807 if( piOrg[x] != DBBP_INVALID_SHORT ) 808 uiSum += xCalcHADs4x16( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 809 } 810 piOrg += iOffsetOrg; 811 piCur += iOffsetCur; 812 } 813 } 814 #endif 815 else if( ( iRows % 4 == 0) && (iCols % 4 == 0) ) 816 { 817 Int iOffsetOrg = iStrideOrg<<2; 818 Int iOffsetCur = iStrideCur<<2; 819 820 for ( y=0; y<iRows; y+= 4 ) 821 { 822 for ( x=0; x<iCols; x+= 4 ) 823 { 824 if( piOrg[x] != DBBP_INVALID_SHORT ) 825 uiSum += xCalcHADs4x4( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 826 } 827 piOrg += iOffsetOrg; 828 piCur += iOffsetCur; 829 } 830 } 831 else if( ( iRows % 2 == 0) && (iCols % 2 == 0) ) 832 { 833 Int iOffsetOrg = iStrideOrg<<1; 834 Int iOffsetCur = iStrideCur<<1; 835 for ( y=0; y<iRows; y+=2 ) 836 { 837 for ( x=0; x<iCols; x+=2 ) 838 { 839 if( piOrg[x] != DBBP_INVALID_SHORT ) 840 uiSum += xCalcHADs2x2( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 841 } 842 piOrg += iOffsetOrg; 843 piCur += iOffsetCur; 844 } 845 } 846 else 847 { 848 assert(false); 849 } 850 851 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8); 852 } 853 854 UInt TComRdCost::xGetMaskedVSD( DistParam* pcDtParam ) 855 { 856 Pel* piOrg = pcDtParam->pOrg; 857 Pel* piCur = pcDtParam->pCur; 858 Pel* piVirRec = pcDtParam->pVirRec; 859 Pel* piVirOrg = pcDtParam->pVirOrg; 860 Int iRows = pcDtParam->iRows; 861 Int iCols = pcDtParam->iCols; 862 Int iStrideOrg = pcDtParam->iStrideOrg; 863 Int iStrideCur = pcDtParam->iStrideCur; 864 Int iStrideVir = pcDtParam->iStrideVir; 865 866 UInt uiSum = 0; 867 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1; 868 869 Int dDM; 870 871 for ( Int y = 0 ; y < iRows ; y++ ) 872 { 873 for (Int x = 0; x < iCols; x++ ) 874 { 875 if( piOrg[x] != DBBP_INVALID_SHORT ) 876 { 877 dDM = (Int) ( piOrg[x ] - piCur[x ] ); 878 uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift; 879 } 880 } 881 piOrg += iStrideOrg; 882 piCur += iStrideCur; 883 } 884 885 return ( uiSum ); 886 } 887 #endif 633 888 634 889 // -------------------------------------------------------------------------------------------------------------------- -
branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComRdCost.h
r655 r816 334 334 #endif 335 335 336 #if H_3D_DBBP 337 static UInt xGetMaskedSSE ( DistParam* pcDtParam ); 338 static UInt xGetMaskedSAD ( DistParam* pcDtParam ); 339 static UInt xGetMaskedHADs ( DistParam* pcDtParam ); 340 static UInt xGetMaskedVSD ( DistParam* pcDtParam ); 341 #endif 342 336 343 public: 337 344 #if WEIGHTED_CHROMA_DISTORTION -
branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComRom.cpp
r773 r816 106 106 // ==================================================================================================================== 107 107 108 #if H_3D_DBBP 109 Bool g_bTestVirtualParts; 110 #endif 111 108 112 UInt g_uiMaxCUWidth = MAX_CU_SIZE; 109 113 UInt g_uiMaxCUHeight = MAX_CU_SIZE; -
branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComRom.h
r773 r816 72 72 // ==================================================================================================================== 73 73 74 #if H_3D_DBBP 75 extern Bool g_bTestVirtualParts; 76 #endif 77 74 78 // flexible conversion from relative to absolute index 75 79 extern UInt g_auiZscanToRaster[ MAX_NUM_SPU_W*MAX_NUM_SPU_W ]; -
branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComSlice.cpp
r795 r816 1827 1827 #if H_3D_INTER_SDC 1828 1828 m_bInterSDCFlag [ i ] = false; 1829 #endif 1830 #if H_3D_DBBP 1831 m_dbbpFlag [ i ] = false; 1829 1832 #endif 1830 1833 #if H_3D_IV_MERGE -
branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TComSlice.h
r795 r816 805 805 Bool m_bInterSDCFlag[MAX_NUM_LAYERS ]; 806 806 #endif 807 #if H_3D_DBBP 808 Bool m_dbbpFlag[MAX_NUM_LAYERS]; 809 #endif 807 810 #if H_3D_IV_MERGE 808 811 Bool m_bMPIFlag[MAX_NUM_LAYERS ]; … … 955 958 Bool inferOutputLayerFlag( Int layerSetIdx, Int i ) { return ( getDefaultOneTargetOutputLayerIdc( ) == 0 || ( ( getDefaultOneTargetOutputLayerIdc( ) == 1 ) && ( i == m_layerSetLayerIdList[layerSetIdx].size() - 1 ) )); } 956 959 957 Void setProfileLevelTierIdx( Int outLayerSetIdx, Int val ) { m_profileLevelTierIdx[ outLayerSetIdx = val ]; }960 Void setProfileLevelTierIdx( Int outLayerSetIdx, Int val ) { m_profileLevelTierIdx[ outLayerSetIdx ] = val; } 958 961 Int getProfileLevelTierIdx( Int outLayerSetIdx ) { return m_profileLevelTierIdx[ outLayerSetIdx ]; } 959 962 Void setAltOutputLayerFlag( Bool flag ) { m_altOutputLayerFlag = flag; } … … 1081 1084 Bool getInterSDCFlag ( Int layerIdInVps ) { return m_bInterSDCFlag[layerIdInVps]; } 1082 1085 Void setInterSDCFlag ( Int layerIdInVps, Bool bval ){ m_bInterSDCFlag[layerIdInVps] = bval; } 1086 #endif 1087 #if H_3D_DBBP 1088 Bool getUseDBBP ( Int layerIdInVps ) { return m_dbbpFlag[layerIdInVps]; } 1089 Void setUseDBBP ( Int layerIdInVps, Bool bval ){ m_dbbpFlag[layerIdInVps] = bval; } 1083 1090 #endif 1084 1091 #if H_3D_IV_MERGE -
branches/HTM-9.3-dev1-RWTH/source/Lib/TLibCommon/TypeDef.h
r809 r816 179 179 #define H_3D_FCO 0 // Flexible coding order for 3D 180 180 181 #define H_3D_DBBP 1 // DBBP: Depth-based Block Partitioning and Merging 182 183 181 184 182 185 … … 269 272 #define IC_CONST_SHIFT 5 270 273 #define IC_SHIFT_DIFF 12 274 #endif 275 276 ///// ***** DEPTH-BASED BLOCK PARTITIONING ********* 277 #if H_3D_DBBP 278 #define DBBP_INVALID_SHORT (-4) 279 #define RWTH_DBBP_PACK_MODE SIZE_2NxN 271 280 #endif 272 281
Note: See TracChangeset for help on using the changeset viewer.