Changeset 55 in SHVCSoftware for trunk/source/Lib/TLibCommon
- Timestamp:
- 4 Mar 2013, 22:43:28 (12 years ago)
- Location:
- trunk/source
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source
- Property svn:mergeinfo changed
/branches/SHM-1.1-dev/source (added) merged: 38-49,52-53
- Property svn:mergeinfo changed
-
trunk/source/Lib/TLibCommon/CommonDef.h
r14 r55 56 56 // ==================================================================================================================== 57 57 58 #define NV_VERSION "1. 0" ///< Current software version58 #define NV_VERSION "1.1" ///< Current software version 59 59 60 60 // ==================================================================================================================== -
trunk/source/Lib/TLibCommon/TComDataCU.cpp
r33 r55 383 383 m_layerId = pcPic->getLayerId(); 384 384 #endif 385 386 385 for(int i=0; i<pcPic->getNumPartInCU(); i++) 387 386 { … … 2906 2905 if(m_layerId) 2907 2906 { 2907 #if MV_SCALING_POS_FIX 2908 pcColCU = getBaseColCU( xP + nPSW/2, yP + nPSH/2, uiCUAddrBase, uiAbsPartAddrBase ); 2909 #else 2908 2910 UInt uiPartIdxCenter; 2909 2911 xDeriveCenterIdx( cCurPS, uiPUIdx, uiPartIdxCenter ); 2910 2912 uiPartIdxCenter -= m_uiAbsIdxInLCU; 2911 2913 pcColCU = getBaseColCU( uiPartIdxCenter, uiCUAddrBase, uiAbsPartAddrBase ); 2914 #endif 2912 2915 2913 2916 #if INTRA_BL … … 4843 4846 } 4844 4847 4845 #if INTRA_BL 4848 #if INTRA_BL && !NO_RESIDUAL_FLAG_FOR_BLPRED 4846 4849 Void TComDataCU::getBaseLumaBlk ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, Pel* piPred, UInt uiStride ) 4847 4850 { … … 4883 4886 TComDataCU* TComDataCU::getBaseColCU( UInt uiCuAbsPartIdx, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase ) 4884 4887 { 4888 #if 1 // it should provide identical resutls 4889 UInt uiPelX = getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiCuAbsPartIdx] ]; 4890 UInt uiPelY = getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiCuAbsPartIdx] ]; 4891 4892 return getBaseColCU( uiPelX, uiPelY, uiCUAddrBase, uiAbsPartIdxBase ); 4893 #else 4885 4894 TComPic* cBaseColPic = m_pcSlice->getBaseColPic(); 4886 4895 … … 4927 4936 4928 4937 return cBaseColPic->getCU(uiCUAddrBase); 4938 #endif 4939 } 4940 4941 TComDataCU* TComDataCU::getBaseColCU( UInt uiPelX, UInt uiPelY, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase ) 4942 { 4943 TComPic* cBaseColPic = m_pcSlice->getBaseColPic(); 4944 4945 #if SVC_UPSAMPLING 4946 Int iBWidth = cBaseColPic->getPicYuvRec()->getWidth () - cBaseColPic->getPicYuvRec()->getPicCropLeftOffset() - cBaseColPic->getPicYuvRec()->getPicCropRightOffset(); 4947 Int iBHeight = cBaseColPic->getPicYuvRec()->getHeight() - cBaseColPic->getPicYuvRec()->getPicCropTopOffset() - cBaseColPic->getPicYuvRec()->getPicCropBottomOffset(); 4948 4949 Int iEWidth = m_pcPic->getPicYuvRec()->getWidth() - m_pcPic->getPicYuvRec()->getPicCropLeftOffset() - m_pcPic->getPicYuvRec()->getPicCropRightOffset(); 4950 Int iEHeight = m_pcPic->getPicYuvRec()->getHeight() - m_pcPic->getPicYuvRec()->getPicCropTopOffset() - m_pcPic->getPicYuvRec()->getPicCropBottomOffset(); 4951 #else 4952 Int iBWidth = cBaseColPic->getPicYuvRec()->getWidth(); 4953 Int iBHeight = cBaseColPic->getPicYuvRec()->getHeight(); 4954 4955 Int iEWidth = m_pcPic->getPicYuvRec()->getWidth(); 4956 Int iEHeight = m_pcPic->getPicYuvRec()->getHeight(); 4957 #endif 4958 4959 uiPelX = (UInt)Clip3<UInt>(0, m_pcPic->getPicYuvRec()->getWidth() - 1, uiPelX); 4960 uiPelY = (UInt)Clip3<UInt>(0, m_pcPic->getPicYuvRec()->getHeight() - 1, uiPelY); 4961 4962 UInt uiMinUnitSize = m_pcPic->getMinCUWidth(); 4963 4964 Int iBX = (uiPelX*iBWidth + iEWidth/2)/iEWidth; 4965 Int iBY = (uiPelY*iBHeight+ iEHeight/2)/iEHeight; 4966 4967 if ( iBX >= cBaseColPic->getPicYuvRec()->getWidth() || iBY >= cBaseColPic->getPicYuvRec()->getHeight()) 4968 { 4969 return NULL; 4970 } 4971 4972 #if AVC_SYNTAX 4973 if( iBX >= iBWidth || iBY >= iBHeight ) //outside of the reference layer cropped picture 4974 { 4975 return NULL; 4976 } 4977 #endif 4978 4979 uiCUAddrBase = (iBY/g_uiMaxCUHeight)*cBaseColPic->getFrameWidthInCU() + (iBX/g_uiMaxCUWidth); 4980 4981 assert(uiCUAddrBase < cBaseColPic->getNumCUsInFrame()); 4982 4983 UInt uiRasterAddrBase = (iBY - (iBY/g_uiMaxCUHeight)*g_uiMaxCUHeight)/uiMinUnitSize*cBaseColPic->getNumPartInWidth() 4984 + (iBX - (iBX/g_uiMaxCUWidth)*g_uiMaxCUWidth)/uiMinUnitSize; 4985 4986 uiAbsPartIdxBase = g_auiRasterToZscan[uiRasterAddrBase]; 4987 4988 return cBaseColPic->getCU(uiCUAddrBase); 4929 4989 } 4930 4990 4931 4991 Void TComDataCU::scaleBaseMV( TComMvField& rcMvFieldEnhance, TComMvField& rcMvFieldBase ) 4932 4992 { 4933 TComMvField cMvFieldBase; 4934 TComMv cMv; 4935 4936 Int iBWidth = m_pcSlice->getBaseColPic()->getPicYuvRec()->getWidth(); 4937 Int iBHeight = m_pcSlice->getBaseColPic()->getPicYuvRec()->getHeight(); 4938 4939 Int iEWidth = m_pcPic->getPicYuvRec()->getWidth(); 4940 Int iEHeight = m_pcPic->getPicYuvRec()->getHeight(); 4941 4942 Int iMvX = (rcMvFieldBase.getHor()*iEWidth + (iBWidth/2 -1) * (rcMvFieldBase.getHor() > 0 ? 1: -1) )/iBWidth; 4943 Int iMvY = (rcMvFieldBase.getVer()*iEHeight + (iBHeight/2 -1) * (rcMvFieldBase.getVer() > 0 ? 1: -1) )/iBHeight; 4944 4945 cMv.set(iMvX, iMvY); 4946 4947 rcMvFieldEnhance.setMvField( cMv, rcMvFieldBase.getRefIdx() ); 4993 TComMvField cMvFieldBase; 4994 TComMv cMv; 4995 4996 #if MV_SCALING_FIX 4997 Int iBWidth = m_pcSlice->getBaseColPic()->getPicYuvRec()->getWidth () - m_pcSlice->getBaseColPic()->getPicYuvRec()->getPicCropLeftOffset() - m_pcSlice->getBaseColPic()->getPicYuvRec()->getPicCropRightOffset(); 4998 Int iBHeight = m_pcSlice->getBaseColPic()->getPicYuvRec()->getHeight() - m_pcSlice->getBaseColPic()->getPicYuvRec()->getPicCropTopOffset() - m_pcSlice->getBaseColPic()->getPicYuvRec()->getPicCropBottomOffset(); 4999 5000 Int iEWidth = m_pcPic->getPicYuvRec()->getWidth() - m_pcPic->getPicYuvRec()->getPicCropLeftOffset() - m_pcPic->getPicYuvRec()->getPicCropRightOffset(); 5001 Int iEHeight = m_pcPic->getPicYuvRec()->getHeight() - m_pcPic->getPicYuvRec()->getPicCropTopOffset() - m_pcPic->getPicYuvRec()->getPicCropBottomOffset(); 5002 #else 5003 Int iBWidth = m_pcSlice->getBaseColPic()->getPicYuvRec()->getWidth(); 5004 Int iBHeight = m_pcSlice->getBaseColPic()->getPicYuvRec()->getHeight(); 5005 5006 Int iEWidth = m_pcPic->getPicYuvRec()->getWidth(); 5007 Int iEHeight = m_pcPic->getPicYuvRec()->getHeight(); 5008 #endif 5009 5010 Int iMvX = (rcMvFieldBase.getHor()*iEWidth + (iBWidth/2 -1) * (rcMvFieldBase.getHor() > 0 ? 1: -1) )/iBWidth; 5011 Int iMvY = (rcMvFieldBase.getVer()*iEHeight + (iBHeight/2 -1) * (rcMvFieldBase.getVer() > 0 ? 1: -1) )/iBHeight; 5012 5013 cMv.set(iMvX, iMvY); 5014 5015 rcMvFieldEnhance.setMvField( cMv, rcMvFieldBase.getRefIdx() ); 4948 5016 } 4949 5017 #endif -
trunk/source/Lib/TLibCommon/TComDataCU.h
r28 r55 526 526 // ------------------------------------------------------------------------------------------------------------------- 527 527 528 #if INTRA_BL 528 #if INTRA_BL && !NO_RESIDUAL_FLAG_FOR_BLPRED 529 529 Void getBaseLumaBlk ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, Pel* piPred, UInt uiStride ); 530 530 Void getBaseChromaBlk ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, Pel* piPred, UInt uiStride, UInt uiChromaId ); … … 593 593 #if SVC_COL_BLK 594 594 TComDataCU* getBaseColCU( UInt uiCuAbsPartIdx, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase ); 595 TComDataCU* getBaseColCU( UInt uiPelX, UInt uiPelY, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase ); 595 596 Void scaleBaseMV( TComMvField& rcMvFieldEnhance, TComMvField& rcMvFieldBase ); 596 597 #endif -
trunk/source/Lib/TLibCommon/TComMotionInfo.h
r28 r55 141 141 Void setAllMvField( TComMvField const & mvField, PartSize eMbMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 ); 142 142 143 #if AVC_SYNTAX 144 Void setMv (TComMv cMv, Int iIdx ) { m_pcMv [iIdx] = cMv; } 145 Void setRefIdx(Int iRefIdx, Int iIdx ) { m_piRefIdx[iIdx] = iRefIdx; } 146 #endif 147 143 148 Void setNumPartition( Int iNumPart ) 144 149 { -
trunk/source/Lib/TLibCommon/TComPic.cpp
r33 r55 66 66 , m_SEIs (NULL) 67 67 #if SVC_EXTENSION 68 , m_layerId( 0 ) 68 69 , m_bSpatialEnhLayer( false ) 69 70 , m_pcFullPelBaseRec( NULL ) … … 96 97 m_pcFullPelBaseRec = new TComPicYuv; m_pcFullPelBaseRec->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps ); 97 98 } 99 100 m_layerId = pcSps->getLayerId(); 98 101 99 102 /* there are no SEI messages associated with this picture initially */ … … 557 560 558 561 #if REF_IDX_MFM 562 #if !REUSE_BLKMAPPING 559 563 Void TComPic::deriveUnitIdxBase( UInt uiUpsamplePelX, UInt uiUpsamplePelY, UInt ratio, UInt& uiBaseCUAddr, UInt& uiBaseAbsPartIdx ) 560 564 { … … 565 569 UInt uiBaseWidth = getPicYuvRec()->getWidth(); 566 570 UInt uiBaseHeight = getPicYuvRec()->getHeight(); 567 571 568 572 UInt uiWidthInCU = ( uiBaseWidth % g_uiMaxCUWidth ) ? uiBaseWidth /g_uiMaxCUWidth + 1 : uiBaseWidth /g_uiMaxCUWidth; 573 574 #if MFM_CLIPPING_FIX 575 uiPelX = (UInt)Clip3<UInt>(0, getPicYuvRec()->getWidth() - 1, uiPelX); 576 uiPelY = (UInt)Clip3<UInt>(0, getPicYuvRec()->getHeight() - 1, uiPelY); 577 #else 569 578 UInt uiHeightInCU = ( uiBaseHeight% g_uiMaxCUHeight ) ? uiBaseHeight/ g_uiMaxCUHeight + 1 : uiBaseHeight/ g_uiMaxCUHeight; 570 579 571 580 uiPelX = (UInt)Clip3<UInt>(0, uiWidthInCU * g_uiMaxCUWidth - 1, uiPelX); 572 581 uiPelY = (UInt)Clip3<UInt>(0, uiHeightInCU * g_uiMaxCUHeight - 1, uiPelY); 582 #endif 573 583 574 584 uiBaseCUAddr = uiPelY / g_uiMaxCUHeight * uiWidthInCU + uiPelX / g_uiMaxCUWidth; … … 585 595 return; 586 596 } 597 #endif 587 598 588 599 Void TComPic::copyUpsampledMvField(TComPic* pcPicBase) 589 600 { 601 #if !REUSE_MVSCALE || !REUSE_BLKMAPPING || AVC_SYNTAX 590 602 Int iBWidth = pcPicBase->getPicYuvRec()->getWidth () - pcPicBase->getPicYuvRec()->getPicCropLeftOffset() - pcPicBase->getPicYuvRec()->getPicCropRightOffset(); 591 603 Int iBHeight = pcPicBase->getPicYuvRec()->getHeight() - pcPicBase->getPicYuvRec()->getPicCropTopOffset() - pcPicBase->getPicYuvRec()->getPicCropBottomOffset(); … … 593 605 Int iEWidth = getPicYuvRec()->getWidth() - getPicYuvRec()->getPicCropLeftOffset() - getPicYuvRec()->getPicCropRightOffset(); 594 606 Int iEHeight = getPicYuvRec()->getHeight() - getPicYuvRec()->getPicCropTopOffset() - getPicYuvRec()->getPicCropBottomOffset(); 607 #endif 595 608 609 #if !REUSE_MVSCALE || !REUSE_BLKMAPPING 596 610 UInt upSampleRatio = 0; 597 611 if(iEWidth == iBWidth && iEHeight == iBHeight) … … 611 625 assert(0); 612 626 } 627 #endif 628 629 UInt uiNumPartitions = 1<<(g_uiMaxCUDepth<<1); 630 UInt uiWidthMinPU = g_uiMaxCUWidth/(1<<g_uiMaxCUDepth); 631 UInt uiHeightMinPU = g_uiMaxCUHeight/(1<<g_uiMaxCUDepth); 632 Int unitNum = max (1, (Int)((16/uiWidthMinPU)*(16/uiHeightMinPU)) ); 613 633 614 634 for(UInt cuIdx = 0; cuIdx < getPicSym()->getNumberOfCUsInFrame(); cuIdx++) //each LCU 615 635 { 616 UInt uiNumPartitions = 1<<(g_uiMaxCUDepth<<1);617 618 636 TComDataCU* pcCUDes = getCU(cuIdx); 619 620 UInt uiWidthMinPU = g_uiMaxCUWidth/(1<<g_uiMaxCUDepth);621 UInt uiHeightMinPU = g_uiMaxCUHeight/(1<<g_uiMaxCUDepth);622 Int unitNum = max (1, (Int)((16/uiWidthMinPU)*(16/uiHeightMinPU)) );623 637 624 638 for(UInt uiAbsPartIdx = 0; uiAbsPartIdx < uiNumPartitions; uiAbsPartIdx+=unitNum ) //each 16x16 unit … … 628 642 UInt uiPelY = pcCUDes->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; 629 643 UInt uiBaseCUAddr, uiBaseAbsPartIdx; 630 pcPicBase->deriveUnitIdxBase(uiPelX + 8, uiPelY + 8, upSampleRatio, uiBaseCUAddr, uiBaseAbsPartIdx); 644 645 #if REUSE_BLKMAPPING 646 TComDataCU *pcColCU = 0; 647 pcColCU = pcCUDes->getBaseColCU(uiPelX + 8, uiPelY + 8, uiBaseCUAddr, uiBaseAbsPartIdx); 648 #else 649 pcPicBase->deriveUnitIdxBase(uiPelX + 8, uiPelY + 8, upSampleRatio, uiBaseCUAddr, uiBaseAbsPartIdx); 650 #endif 651 652 #if AVC_SYNTAX 653 Int iBX = ( (uiPelX + 8) * iBWidth + iEWidth/2 ) / iEWidth; 654 Int iBY = ( (uiPelY + 8) * iBHeight+ iEHeight/2 ) / iEHeight; 655 656 #if REUSE_BLKMAPPING 657 if( ( iBX < iBWidth && iBY < iBHeight ) && pcColCU && (pcColCU->getPredictionMode(uiBaseAbsPartIdx) != MODE_NONE) && (pcColCU->getPredictionMode(uiBaseAbsPartIdx) != MODE_INTRA) ) //base layer unit not skip and invalid mode 658 #else 659 if( ( iBX < iBWidth && iBY < iBHeight ) && (pcPicBase->getCU(uiBaseCUAddr)->getPredictionMode(uiBaseAbsPartIdx) != MODE_NONE) && (pcPicBase->getCU(uiBaseCUAddr)->getPredictionMode(uiBaseAbsPartIdx) != MODE_INTRA) ) //base layer unit not skip and invalid mode 660 #endif 661 #else 662 #if REUSE_BLKMAPPING 663 if( pcColCU && (pcColCU->getPredictionMode(uiBaseAbsPartIdx) != MODE_NONE) && (pcColCU->getPredictionMode(uiBaseAbsPartIdx) != MODE_INTRA) ) //base layer unit not skip and invalid mode 664 #else 631 665 if( (pcPicBase->getCU(uiBaseCUAddr)->getPredictionMode(uiBaseAbsPartIdx) != MODE_NONE) && (pcPicBase->getCU(uiBaseCUAddr)->getPredictionMode(uiBaseAbsPartIdx) != MODE_INTRA) ) //base layer unit not skip and invalid mode 632 { 633 for(UInt list = 0; list < 2; list++) //each list 634 { 635 TComMv cMv = pcPicBase->getCU(uiBaseCUAddr)->getCUMvField((RefPicList)list)->getMv(uiBaseAbsPartIdx); 636 Int refIdx = pcPicBase->getCU(uiBaseCUAddr)->getCUMvField((RefPicList)list)->getRefIdx(uiBaseAbsPartIdx); 666 #endif 667 #endif 668 { 669 for(UInt refPicList = 0; refPicList < 2; refPicList++) //for each reference list 670 { 671 #if REUSE_MVSCALE 672 TComMvField sMvFieldBase, sMvField; 673 #if REUSE_BLKMAPPING 674 pcColCU->getMvField( pcColCU, uiBaseAbsPartIdx, (RefPicList)refPicList, sMvFieldBase); 675 #else 676 pcPicBase->getCU(uiBaseCUAddr)->getMvField( pcPicBase->getCU(uiBaseCUAddr), uiBaseAbsPartIdx, (RefPicList)refPicList, sMvFieldBase); 677 #endif 678 pcCUDes->scaleBaseMV( sMvField, sMvFieldBase ); 679 #else 680 TComMv cMv = pcPicBase->getCU(uiBaseCUAddr)->getCUMvField((RefPicList)refPicList)->getMv(uiBaseAbsPartIdx); 681 Int refIdx = pcPicBase->getCU(uiBaseCUAddr)->getCUMvField((RefPicList)refPicList)->getRefIdx(uiBaseAbsPartIdx); 637 682 638 683 Int Hor = ((Int)upSampleRatio * cMv.getHor())/2 ; … … 642 687 TComMvField sMvField; 643 688 sMvField.setMvField(cScaledMv, refIdx); 644 645 pcCUDes->getCUMvField((RefPicList)list)->setMvField(sMvField, uiAbsPartIdx); 689 #endif 690 691 pcCUDes->getCUMvField((RefPicList)refPicList)->setMvField(sMvField, uiAbsPartIdx); 646 692 pcCUDes->setPredictionMode(uiAbsPartIdx, MODE_INTER); 647 693 } … … 669 715 #endif 670 716 717 #if AVC_SYNTAX 718 Void TComPic::readBLSyntax( fstream* filestream, UInt numBytes ) 719 { 720 if( !filestream->good() ) 721 { 722 return; 723 } 724 725 UInt uiWidth = this->getPicYuvRec()->getWidth() - this->getPicYuvRec()->getPicCropLeftOffset() - this->getPicYuvRec()->getPicCropRightOffset(); 726 UInt uiHeight = this->getPicYuvRec()->getHeight() - this->getPicYuvRec()->getPicCropTopOffset() - this->getPicYuvRec()->getPicCropBottomOffset(); 727 UInt64 uiPOC = (UInt64)this->getPOC(); 728 UInt uiPartWidth = uiWidth / 4; 729 UInt uiPartHeight = uiHeight / 4; 730 731 UInt uiNumPartInWidth = this->getNumPartInWidth(); 732 UInt uiNumPartInHeight = this->getNumPartInHeight(); 733 UInt uiNumPartLCUInWidth = this->getFrameWidthInCU(); 734 735 UInt64 uiPos = (UInt64)uiPOC * uiWidth * uiHeight * numBytes / 16; 736 737 filestream->seekg( uiPos, ios_base::beg ); 738 739 for( Int i = 0; i < uiPartHeight; i++ ) 740 { 741 for( Int j = 0; j < uiPartWidth; j++ ) 742 { 743 UInt uiX = ( j / uiNumPartInWidth ); 744 UInt uiY = ( i / uiNumPartInHeight ); 745 746 UInt uiLCUAddr = uiY * uiNumPartLCUInWidth + uiX; 747 UInt uiPartAddr = ( i - uiY * uiNumPartInHeight ) * uiNumPartInWidth + ( j - uiX * uiNumPartInWidth ); 748 uiPartAddr = g_auiRasterToZscan[uiPartAddr]; 749 750 TComDataCU* pcCU = this->getCU( uiLCUAddr ); 751 752 TComMv mv; 753 Short temp; 754 755 // RefIdxL0 756 Char refIdxL0 = -1; 757 filestream->read( &refIdxL0, 1 ); 758 assert( refIdxL0 >= -1 ); 759 pcCU->getCUMvField( REF_PIC_LIST_0 )->setRefIdx( (Int)refIdxL0, uiPartAddr ); 760 761 // RefIdxL1 762 Char refIdxL1 = -1; 763 filestream->read( &refIdxL1, 1 ); 764 assert( refIdxL1 >= -1 ); 765 pcCU->getCUMvField( REF_PIC_LIST_1 )->setRefIdx( (Int)refIdxL1, uiPartAddr ); 766 767 // MV L0 768 temp = 0; 769 filestream->read( reinterpret_cast<char*>(&temp), 2 ); 770 mv.setHor( (Short)temp ); 771 temp = 0; 772 filestream->read( reinterpret_cast<char*>(&temp), 2 ); 773 mv.setVer( (Short)temp ); 774 pcCU->getCUMvField( REF_PIC_LIST_0 )->setMv( mv, uiPartAddr ); 775 776 // MV L1 777 temp = 0; 778 filestream->read( reinterpret_cast<char*>(&temp), 2 ); 779 mv.setHor( (Short)temp ); 780 temp = 0; 781 filestream->read( reinterpret_cast<char*>(&temp), 2 ); 782 mv.setVer( (Short)temp ); 783 pcCU->getCUMvField( REF_PIC_LIST_1 )->setMv( mv, uiPartAddr ); 784 785 // set dependent information 786 pcCU->setPredictionMode( uiPartAddr, ( refIdxL0 == NOT_VALID && refIdxL1 == NOT_VALID ) ? MODE_INTRA : MODE_INTER ); 787 UInt uiInterDir = ( refIdxL0 != NOT_VALID ) + ( refIdxL1 != NOT_VALID && this->getSlice(0)->isInterB() ) * 2; 788 assert( uiInterDir >= 0 && uiInterDir <= 3 ); 789 pcCU->setInterDir( uiPartAddr, uiInterDir ); 790 } 791 } 792 } 793 #endif 794 795 #if SYNTAX_OUTPUT 796 Void TComPic::wrireBLSyntax( fstream* filestream, UInt numBytes ) 797 { 798 if( !filestream->good() ) 799 { 800 return; 801 } 802 803 UInt uiWidth = this->getPicYuvRec()->getWidth() - getSlice(0)->getSPS()->getPicCropLeftOffset() - getSlice(0)->getSPS()->getPicCropRightOffset(); 804 UInt uiHeight = this->getPicYuvRec()->getHeight() - getSlice(0)->getSPS()->getPicCropTopOffset() - getSlice(0)->getSPS()->getPicCropBottomOffset(); 805 UInt64 uiPOC = (UInt64)this->getPOC(); 806 UInt uiPartWidth = uiWidth / 4; 807 UInt uiPartHeight = uiHeight / 4; 808 809 UInt uiNumPartInWidth = this->getNumPartInWidth(); 810 UInt uiNumPartInHeight = this->getNumPartInHeight(); 811 UInt uiNumPartLCUInWidth = this->getFrameWidthInCU(); 812 813 filestream->seekg( uiPOC * uiWidth * uiHeight * numBytes / 16 ); 814 815 for( Int i = 0; i < uiPartHeight; i++ ) 816 { 817 for( Int j = 0; j < uiPartWidth; j++ ) 818 { 819 UInt uiX = ( j / uiNumPartInWidth ); 820 UInt uiY = ( i / uiNumPartInHeight ); 821 822 UInt uiLCUAddr = uiY * uiNumPartLCUInWidth + uiX; 823 UInt uiPartAddr = ( i - uiY * uiNumPartInHeight ) * uiNumPartInWidth + ( j - uiX * uiNumPartInWidth ); 824 uiPartAddr = g_auiRasterToZscan[uiPartAddr]; 825 826 TComDataCU* pcCU = this->getCU( uiLCUAddr ); 827 828 TComMv mv; 829 Short temp; 830 Char refIdxL0 = NOT_VALID, refIdxL1 = NOT_VALID; 831 832 // RefIdx 833 if( !pcCU->isIntra( uiPartAddr ) ) 834 { 835 refIdxL0 = (Char)pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiPartAddr ); 836 refIdxL1 = (Char)pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiPartAddr ); 837 } 838 assert( refIdxL0 >= - 1 && refIdxL1 >= - 1 ); 839 filestream->put( refIdxL0 ); 840 filestream->put( refIdxL1 ); 841 842 // MV L0 843 mv.setZero(); 844 if( refIdxL0 >= 0 ) 845 { 846 mv = pcCU->getCUMvField( REF_PIC_LIST_0 )->getMv( uiPartAddr ); 847 } 848 temp = (Short)mv.getHor(); 849 filestream->write( reinterpret_cast<char*>(&temp), 2 ); 850 temp = (Short)mv.getVer(); 851 filestream->write( reinterpret_cast<char*>(&temp), 2 ); 852 853 // MV L1 854 mv.setZero(); 855 if( refIdxL1 >= 0 ) 856 { 857 mv = pcCU->getCUMvField( REF_PIC_LIST_1 )->getMv( uiPartAddr ); 858 } 859 temp = (Short)mv.getHor(); 860 filestream->write( reinterpret_cast<char*>(&temp), 2 ); 861 temp = (Short)mv.getVer(); 862 filestream->write( reinterpret_cast<char*>(&temp), 2 ); 863 } 864 } 865 } 866 #endif 867 868 671 869 //! \} -
trunk/source/Lib/TLibCommon/TComPic.h
r28 r55 44 44 #include "TComPicYuv.h" 45 45 #include "TComBitStream.h" 46 #if AVC_BASE || SYNTAX_OUTPUT 47 #include <fstream> 48 #endif 49 46 50 47 51 //! \ingroup TLibCommon … … 125 129 #if REF_IDX_MFM 126 130 Void copyUpsampledMvField ( TComPic* pcPicBase ); 131 #if !REUSE_BLKMAPPING 127 132 Void deriveUnitIdxBase ( UInt uiUpsamplePelX, UInt uiUpsamplePelY, UInt ratio, UInt& uiBaseCUAddr, UInt& uiBaseAbsPartIdx ); 133 #endif 128 134 #endif 129 135 … … 209 215 Void copyUpsampledPictureYuv(TComPicYuv* pcPicYuvIn, TComPicYuv* pcPicYuvOut); 210 216 #endif 217 #if AVC_SYNTAX 218 Void readBLSyntax( fstream* filestream, UInt numBytes ); 219 #endif 220 #if SYNTAX_OUTPUT 221 Void wrireBLSyntax( fstream* filestream, UInt numBytes ); 222 #endif 223 211 224 };// END CLASS DEFINITION TComPic 212 225 … … 214 227 215 228 #endif // __TCOMPIC__ 229 -
trunk/source/Lib/TLibCommon/TComPicSym.h
r2 r55 125 125 UInt getNumberOfCUsInFrame() { return m_uiNumCUsInFrame; } 126 126 TComDataCU*& getCU( UInt uiCUAddr ) { return m_apcTComDataCU[uiCUAddr]; } 127 128 #if AVC_SYNTAX 129 UInt getMaxCUWidth() { return m_uiMaxCUWidth; } 130 UInt getMaxCUHeight() { return m_uiMaxCUHeight; } 131 UInt getMaxDepth() { return m_uhTotalDepth; } 132 #endif 127 133 128 134 Void setSlice(TComSlice* p, UInt i) { m_apcTComSlice[i] = p; } -
trunk/source/Lib/TLibCommon/TComPrediction.cpp
r2 r55 407 407 } 408 408 409 #if INTRA_BL 409 #if INTRA_BL && !NO_RESIDUAL_FLAG_FOR_BLPRED 410 410 Void TComPrediction::getBaseBlk( TComDataCU* pcCU, TComYuv* pcYuvPred, Int iPartAddr, Int iWidth, Int iHeight ) 411 411 { -
trunk/source/Lib/TLibCommon/TComSlice.cpp
r33 r55 562 562 assert(thePoc == pcRefPicBL->getPOC()); 563 563 564 #if REUSE_MVSCALE || REUSE_BLKMAPPING 565 ilpPic[0]->getSlice(0)->setBaseColPic( pcRefPicBL ); 566 #endif 567 564 568 //initialize reference POC of ILP 565 569 for(Int refIdx = 0; refIdx < MAX_NUM_REF; refIdx++) … … 2191 2195 } 2192 2196 #endif 2197 2198 #if SVC_EXTENSION && AVC_SYNTAX 2199 Void TComSlice::initBaseLayerRPL( TComSlice *pcSlice ) 2200 { 2201 // Assumed that RPL of the base layer is same to the EL, otherwise this information should be also dumped and read from the metadata file 2202 setPOC( pcSlice->getPOC() ); 2203 if( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ) 2204 { 2205 setSliceType( I_SLICE ); 2206 } 2207 else 2208 { 2209 setSliceType( pcSlice->getSliceType() ); 2210 } 2211 2212 if( this->isIntra() ) 2213 { 2214 return; 2215 } 2216 2217 //initialize reference POC of BL 2218 for( Int iRefPicList = 0; iRefPicList < 2; iRefPicList++ ) 2219 { 2220 RefPicList eRefPicList = RefPicList( iRefPicList ); 2221 2222 assert( pcSlice->getNumRefIdx( eRefPicList) > 0 ); 2223 setNumRefIdx( eRefPicList, pcSlice->getNumRefIdx( eRefPicList ) - 1 ); 2224 assert( getNumRefIdx( eRefPicList) <= MAX_NUM_REF); 2225 2226 for(Int refIdx = 0; refIdx < getNumRefIdx( eRefPicList ); refIdx++) 2227 { 2228 setRefPOC( pcSlice->getRefPic( eRefPicList, refIdx )->getPOC(), eRefPicList, refIdx ); 2229 setRefPic( pcSlice->getRefPic( eRefPicList, refIdx ), eRefPicList, refIdx ); 2230 /* 2231 // should be set if the base layer has its own instance of the reference picture lists, currently EL RPL is reused. 2232 getRefPic( eRefPicList, refIdx )->setLayerId( 0 ); 2233 getRefPic( eRefPicList, refIdx )->setIsLongTerm( pcSlice->getRefPic( eRefPicList, refIdx )->getIsLongTerm() ); 2234 getRefPic( eRefPicList, refIdx )->setIsUsedAsLongTerm( pcSlice->getRefPic( eRefPicList, refIdx )->getIsUsedAsLongTerm() ); 2235 */ 2236 2237 } 2238 } 2239 return; 2240 } 2241 #endif 2242 2193 2243 //! \} -
trunk/source/Lib/TLibCommon/TComSlice.h
r28 r55 1454 1454 Void setFullPelBaseRec ( TComPicYuv* p) { m_pcFullPelBaseRec = p; } 1455 1455 TComPicYuv* getFullPelBaseRec () { return m_pcFullPelBaseRec; } 1456 1457 #if AVC_SYNTAX 1458 Void initBaseLayerRPL( TComSlice *pcSlice ); 1459 #endif 1456 1460 #endif 1457 1461 -
trunk/source/Lib/TLibCommon/TComUpsampleFilter.cpp
r28 r55 227 227 #endif 228 228 229 230 231 229 assert ( iEWidth == 2*iBWidth || 2*iEWidth == 3*iBWidth ); 232 230 assert ( iEHeight == 2*iBHeight || 2*iEHeight == 3*iBHeight ); -
trunk/source/Lib/TLibCommon/TypeDef.h
r28 r55 40 40 41 41 #define SVC_EXTENSION 1 42 43 #define SYNTAX_BYTES 10 ///< number of bytes taken by syntaxes per 4x4 block [RefIdxL0(1byte), RefIdxL1(1byte), MVxL0(2bytes), MVyL0(2bytes), MVxL1(2bytes), MVyL1(2bytes)] 44 42 45 #if SVC_EXTENSION 43 46 #define MAX_LAYERS 2 ///< max number of layers the codec is supposed to handle … … 49 52 #define BUGFIX_925 1 ///< bug fix ticket #925 50 53 #define ENCODER_BUGFIX 1 ///< L0167: encoder bug fix for inter mode 51 52 54 #define CHROMA_UPSAMPLING 1 ///< L0335: Chroma upsampling with 5 bits coefficients 53 55 54 #define AVC_BASE 0 ///< YUV BL reading for AVC base SVC 55 56 #define MV_SCALING_FIX 1 ///< fixing the base layer MV scaling 57 #define MV_SCALING_POS_FIX 1 ///< use center pixels to get co-located base layer block 58 #define MFM_CLIPPING_FIX 1 ///< set the right picture size for the clipping 59 60 #define AVC_BASE 1 ///< YUV BL reading for AVC base SVC 56 61 #define REF_IDX_FRAMEWORK 0 ///< inter-layer reference framework 62 63 #if AVC_BASE 64 #define AVC_SYNTAX 1 ///< Syntax reading for AVC base 65 #endif 57 66 58 67 #if REF_IDX_FRAMEWORK … … 60 69 #define REF_IDX_ME_ZEROMV 1 ///< L0051: use zero motion for inter-layer reference picture (without fractional ME) 61 70 #define ENCODER_FAST_MODE 1 ///< L0174: enable encoder fast mode. TestMethod 1 is enabled by setting to 1 and TestMethod 2 is enable by setting to 2. By default it is set to 1. 71 #if !AVC_BASE || AVC_SYNTAX 62 72 #define REF_IDX_MFM 1 ///< L0336: motion vector mapping of inter-layer reference picture 73 #endif 74 75 #if REF_IDX_MFM 76 #define REUSE_MVSCALE 1 ///< using the base layer MV scaling function 77 #define REUSE_BLKMAPPING 1 ///< using the base layer get co-located block function 78 #endif 79 63 80 #else 64 81 #define INTRA_BL 1 ///< inter-layer texture prediction … … 69 86 70 87 // Hooks 71 #if !AVC_BASE 88 #if !AVC_BASE || AVC_SYNTAX 72 89 #define SVC_MVP 1 ///< motion hook for merge mode as an example 90 #if !AVC_SYNTAX 73 91 #define SVC_BL_CAND_INTRA 0 ///< Intra Base Mode Prediction hook as an example 74 92 #endif … … 80 98 81 99 #endif 100 #endif 101 #else 102 #define SYNTAX_OUTPUT 1 82 103 #endif 83 104
Note: See TracChangeset for help on using the changeset viewer.