Changeset 32 in SHVCSoftware for branches/SHM-1.0-dev/source/Lib/TLibCommon
- Timestamp:
- 7 Feb 2013, 22:28:07 (13 years ago)
- Location:
- branches/SHM-1.0-dev/source/Lib/TLibCommon
- Files:
-
- 4 edited
-
TComDataCU.cpp (modified) (1 diff)
-
TComPic.cpp (modified) (1 diff)
-
TComSlice.cpp (modified) (1 diff)
-
TComYuv.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-1.0-dev/source/Lib/TLibCommon/TComDataCU.cpp
r23 r32 2146 2146 Bool TComDataCU::xCheckZeroMVILRMerge(UChar uhInterDir, TComMvField& cMvFieldL0, TComMvField& cMvFieldL1) 2147 2147 { 2148 Bool checkZeroMVILR = true;2149 2150 if(uhInterDir&0x1) //list02151 {2152 Int refIdxL0 = cMvFieldL0.getRefIdx();2153 if(getSlice()->getRefPic(REF_PIC_LIST_0, refIdxL0)->getIsILR())2154 checkZeroMVILR &= (cMvFieldL0.getHor() == 0 && cMvFieldL0.getVer() == 0);2155 }2156 if(uhInterDir&0x2) //list12157 {2158 Int refIdxL1 = cMvFieldL1.getRefIdx();2159 if(getSlice()->getRefPic(REF_PIC_LIST_1, refIdxL1)->getIsILR())2160 checkZeroMVILR &= (cMvFieldL1.getHor() == 0 && cMvFieldL1.getVer() == 0);2161 }2162 2163 return checkZeroMVILR;2148 Bool checkZeroMVILR = true; 2149 2150 if(uhInterDir&0x1) //list0 2151 { 2152 Int refIdxL0 = cMvFieldL0.getRefIdx(); 2153 if(getSlice()->getRefPic(REF_PIC_LIST_0, refIdxL0)->getIsILR()) 2154 checkZeroMVILR &= (cMvFieldL0.getHor() == 0 && cMvFieldL0.getVer() == 0); 2155 } 2156 if(uhInterDir&0x2) //list1 2157 { 2158 Int refIdxL1 = cMvFieldL1.getRefIdx(); 2159 if(getSlice()->getRefPic(REF_PIC_LIST_1, refIdxL1)->getIsILR()) 2160 checkZeroMVILR &= (cMvFieldL1.getHor() == 0 && cMvFieldL1.getVer() == 0); 2161 } 2162 2163 return checkZeroMVILR; 2164 2164 } 2165 2165 2166 2166 Bool TComDataCU::xCheckZeroMVILRMvdL1Zero(Int iRefList, Int iRefIdx, Int MvpIdx) 2167 2167 { 2168 RefPicList eRefPicList = iRefList > 0? REF_PIC_LIST_1: REF_PIC_LIST_0;2169 assert(eRefPicList == REF_PIC_LIST_1);2170 2171 Bool checkZeroMVILR = true;2172 2173 if(getSlice()->getRefPic(eRefPicList, iRefIdx)->getIsILR())2174 {2175 AMVPInfo* pcAMVPInfo = getCUMvField(eRefPicList)->getAMVPInfo();2176 TComMv cMv = pcAMVPInfo->m_acMvCand[MvpIdx];2177 checkZeroMVILR &= (cMv.getHor() == 0 && cMv.getVer() == 0);2178 }2179 2180 return checkZeroMVILR;2168 RefPicList eRefPicList = iRefList > 0? REF_PIC_LIST_1: REF_PIC_LIST_0; 2169 assert(eRefPicList == REF_PIC_LIST_1); 2170 2171 Bool checkZeroMVILR = true; 2172 2173 if(getSlice()->getRefPic(eRefPicList, iRefIdx)->getIsILR()) 2174 { 2175 AMVPInfo* pcAMVPInfo = getCUMvField(eRefPicList)->getAMVPInfo(); 2176 TComMv cMv = pcAMVPInfo->m_acMvCand[MvpIdx]; 2177 checkZeroMVILR &= (cMv.getHor() == 0 && cMv.getVer() == 0); 2178 } 2179 2180 return checkZeroMVILR; 2181 2181 } 2182 2182 #endif -
branches/SHM-1.0-dev/source/Lib/TLibCommon/TComPic.cpp
r27 r32 594 594 595 595 596 Int iBWidth = pcPicBase->getPicYuvRec()->getWidth () - pcPicBase->getPicYuvRec()->getPicCropLeftOffset() - pcPicBase->getPicYuvRec()->getPicCropRightOffset();597 Int iBHeight = pcPicBase->getPicYuvRec()->getHeight() - pcPicBase->getPicYuvRec()->getPicCropTopOffset() - pcPicBase->getPicYuvRec()->getPicCropBottomOffset();598 599 Int iEWidth = getPicYuvRec()->getWidth() - getPicYuvRec()->getPicCropLeftOffset() - getPicYuvRec()->getPicCropRightOffset();600 Int iEHeight = getPicYuvRec()->getHeight() - getPicYuvRec()->getPicCropTopOffset() - getPicYuvRec()->getPicCropBottomOffset();601 602 603 UInt upSampleRatio = 0;604 if(iEWidth == iBWidth && iEHeight == iBHeight)605 {606 upSampleRatio = 2;607 }608 else if(2*iEWidth == 3*iBWidth && 2*iEHeight == 3*iBHeight)609 {610 upSampleRatio = 3;611 }612 else if(iEWidth == 2*iBWidth && iEHeight == 2*iBHeight)613 {614 upSampleRatio = 4;615 }616 else617 {618 assert(0);619 }620 621 for(UInt cuIdx = 0; cuIdx < getPicSym()->getNumberOfCUsInFrame(); cuIdx++) //each LCU622 {623 UInt uiNumPartitions = 1<<(g_uiMaxCUDepth<<1);624 625 TComDataCU* pcCUDes = getCU(cuIdx);626 627 UInt uiWidthMinPU = g_uiMaxCUWidth/(1<<g_uiMaxCUDepth);628 UInt uiHeightMinPU = g_uiMaxCUHeight/(1<<g_uiMaxCUDepth);629 Int unitNum = max (1, (Int)((16/uiWidthMinPU)*(16/uiHeightMinPU)) );630 631 for(UInt uiAbsPartIdx = 0; uiAbsPartIdx < uiNumPartitions; uiAbsPartIdx+=unitNum ) //each 16x16 unit632 {633 //pixel position of each unit in up-sampled layer634 UIntuiPelX = pcCUDes->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ];635 UIntuiPelY = pcCUDes->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ];636 UInt uiBaseCUAddr, uiBaseAbsPartIdx;637 pcPicBase->deriveUnitIdxBase(uiPelX + 8, uiPelY + 8, upSampleRatio, uiBaseCUAddr, uiBaseAbsPartIdx);638 if( (pcPicBase->getCU(uiBaseCUAddr)->getPredictionMode(uiBaseAbsPartIdx) != MODE_NONE) && (pcPicBase->getCU(uiBaseCUAddr)->getPredictionMode(uiBaseAbsPartIdx) != MODE_INTRA) ) //base layer unit not skip and invalid mode639 {640 for(UInt list = 0; list < 2; list++) //each list641 {642 TComMv cMv = pcPicBase->getCU(uiBaseCUAddr)->getCUMvField((RefPicList)list)->getMv(uiBaseAbsPartIdx);643 Int refIdx = pcPicBase->getCU(uiBaseCUAddr)->getCUMvField((RefPicList)list)->getRefIdx(uiBaseAbsPartIdx);644 645 Int Hor = ((Int)upSampleRatio * cMv.getHor())/2 ;646 Int Ver = ((Int)upSampleRatio * cMv.getVer())/2 ;647 648 TComMv cScaledMv(Hor, Ver);649 TComMvField sMvField;650 sMvField.setMvField(cScaledMv, refIdx);651 652 pcCUDes->getCUMvField((RefPicList)list)->setMvField(sMvField, uiAbsPartIdx);653 pcCUDes->setPredictionMode(uiAbsPartIdx, MODE_INTER);654 }655 }656 657 else658 {659 TComMvField zeroMvField; //zero MV and invalid reference index660 pcCUDes->getCUMvField(REF_PIC_LIST_0)->setMvField(zeroMvField, uiAbsPartIdx);661 pcCUDes->getCUMvField(REF_PIC_LIST_1)->setMvField(zeroMvField, uiAbsPartIdx);662 pcCUDes->setPredictionMode(uiAbsPartIdx, MODE_INTRA);663 }664 665 for(UInt i = 1; i < unitNum; i++ )666 {667 pcCUDes->getCUMvField(REF_PIC_LIST_0)->setMvField(pcCUDes->getCUMvField(REF_PIC_LIST_0)->getMv(uiAbsPartIdx), pcCUDes->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiAbsPartIdx), uiAbsPartIdx + i);668 pcCUDes->getCUMvField(REF_PIC_LIST_1)->setMvField(pcCUDes->getCUMvField(REF_PIC_LIST_1)->getMv(uiAbsPartIdx), pcCUDes->getCUMvField(REF_PIC_LIST_1)->getRefIdx(uiAbsPartIdx), uiAbsPartIdx + i);669 pcCUDes->setPredictionMode(uiAbsPartIdx+i, pcCUDes->getPredictionMode(uiAbsPartIdx)) ;670 }671 }672 memset( pcCUDes->getPartitionSize(), SIZE_2Nx2N, sizeof(char)*uiNumPartitions);673 }596 Int iBWidth = pcPicBase->getPicYuvRec()->getWidth () - pcPicBase->getPicYuvRec()->getPicCropLeftOffset() - pcPicBase->getPicYuvRec()->getPicCropRightOffset(); 597 Int iBHeight = pcPicBase->getPicYuvRec()->getHeight() - pcPicBase->getPicYuvRec()->getPicCropTopOffset() - pcPicBase->getPicYuvRec()->getPicCropBottomOffset(); 598 599 Int iEWidth = getPicYuvRec()->getWidth() - getPicYuvRec()->getPicCropLeftOffset() - getPicYuvRec()->getPicCropRightOffset(); 600 Int iEHeight = getPicYuvRec()->getHeight() - getPicYuvRec()->getPicCropTopOffset() - getPicYuvRec()->getPicCropBottomOffset(); 601 602 603 UInt upSampleRatio = 0; 604 if(iEWidth == iBWidth && iEHeight == iBHeight) 605 { 606 upSampleRatio = 2; 607 } 608 else if(2*iEWidth == 3*iBWidth && 2*iEHeight == 3*iBHeight) 609 { 610 upSampleRatio = 3; 611 } 612 else if(iEWidth == 2*iBWidth && iEHeight == 2*iBHeight) 613 { 614 upSampleRatio = 4; 615 } 616 else 617 { 618 assert(0); 619 } 620 621 for(UInt cuIdx = 0; cuIdx < getPicSym()->getNumberOfCUsInFrame(); cuIdx++) //each LCU 622 { 623 UInt uiNumPartitions = 1<<(g_uiMaxCUDepth<<1); 624 625 TComDataCU* pcCUDes = getCU(cuIdx); 626 627 UInt uiWidthMinPU = g_uiMaxCUWidth/(1<<g_uiMaxCUDepth); 628 UInt uiHeightMinPU = g_uiMaxCUHeight/(1<<g_uiMaxCUDepth); 629 Int unitNum = max (1, (Int)((16/uiWidthMinPU)*(16/uiHeightMinPU)) ); 630 631 for(UInt uiAbsPartIdx = 0; uiAbsPartIdx < uiNumPartitions; uiAbsPartIdx+=unitNum ) //each 16x16 unit 632 { 633 //pixel position of each unit in up-sampled layer 634 UInt uiPelX = pcCUDes->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; 635 UInt uiPelY = pcCUDes->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; 636 UInt uiBaseCUAddr, uiBaseAbsPartIdx; 637 pcPicBase->deriveUnitIdxBase(uiPelX + 8, uiPelY + 8, upSampleRatio, uiBaseCUAddr, uiBaseAbsPartIdx); 638 if( (pcPicBase->getCU(uiBaseCUAddr)->getPredictionMode(uiBaseAbsPartIdx) != MODE_NONE) && (pcPicBase->getCU(uiBaseCUAddr)->getPredictionMode(uiBaseAbsPartIdx) != MODE_INTRA) ) //base layer unit not skip and invalid mode 639 { 640 for(UInt list = 0; list < 2; list++) //each list 641 { 642 TComMv cMv = pcPicBase->getCU(uiBaseCUAddr)->getCUMvField((RefPicList)list)->getMv(uiBaseAbsPartIdx); 643 Int refIdx = pcPicBase->getCU(uiBaseCUAddr)->getCUMvField((RefPicList)list)->getRefIdx(uiBaseAbsPartIdx); 644 645 Int Hor = ((Int)upSampleRatio * cMv.getHor())/2 ; 646 Int Ver = ((Int)upSampleRatio * cMv.getVer())/2 ; 647 648 TComMv cScaledMv(Hor, Ver); 649 TComMvField sMvField; 650 sMvField.setMvField(cScaledMv, refIdx); 651 652 pcCUDes->getCUMvField((RefPicList)list)->setMvField(sMvField, uiAbsPartIdx); 653 pcCUDes->setPredictionMode(uiAbsPartIdx, MODE_INTER); 654 } 655 } 656 657 else 658 { 659 TComMvField zeroMvField; //zero MV and invalid reference index 660 pcCUDes->getCUMvField(REF_PIC_LIST_0)->setMvField(zeroMvField, uiAbsPartIdx); 661 pcCUDes->getCUMvField(REF_PIC_LIST_1)->setMvField(zeroMvField, uiAbsPartIdx); 662 pcCUDes->setPredictionMode(uiAbsPartIdx, MODE_INTRA); 663 } 664 665 for(UInt i = 1; i < unitNum; i++ ) 666 { 667 pcCUDes->getCUMvField(REF_PIC_LIST_0)->setMvField(pcCUDes->getCUMvField(REF_PIC_LIST_0)->getMv(uiAbsPartIdx), pcCUDes->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiAbsPartIdx), uiAbsPartIdx + i); 668 pcCUDes->getCUMvField(REF_PIC_LIST_1)->setMvField(pcCUDes->getCUMvField(REF_PIC_LIST_1)->getMv(uiAbsPartIdx), pcCUDes->getCUMvField(REF_PIC_LIST_1)->getRefIdx(uiAbsPartIdx), uiAbsPartIdx + i); 669 pcCUDes->setPredictionMode(uiAbsPartIdx+i, pcCUDes->getPredictionMode(uiAbsPartIdx)) ; 670 } 671 } 672 memset( pcCUDes->getPartitionSize(), SIZE_2Nx2N, sizeof(char)*uiNumPartitions); 673 } 674 674 } 675 675 #endif -
branches/SHM-1.0-dev/source/Lib/TLibCommon/TComSlice.cpp
r27 r32 580 580 for(Int refIdx = 0; refIdx < pcRefPicBL->getSlice(0)->getNumRefIdx(REF_PIC_LIST_0); refIdx++) 581 581 { 582 ilpPic[0]->getSlice(0)->setRefPOC(pcRefPicBL->getSlice(0)->getRefPOC(REF_PIC_LIST_0, refIdx), REF_PIC_LIST_0, refIdx);582 ilpPic[0]->getSlice(0)->setRefPOC(pcRefPicBL->getSlice(0)->getRefPOC(REF_PIC_LIST_0, refIdx), REF_PIC_LIST_0, refIdx); 583 583 } 584 584 for(Int refIdx = 0; refIdx < pcRefPicBL->getSlice(0)->getNumRefIdx(REF_PIC_LIST_1); refIdx++) 585 585 { 586 ilpPic[0]->getSlice(0)->setRefPOC(pcRefPicBL->getSlice(0)->getRefPOC(REF_PIC_LIST_1, refIdx), REF_PIC_LIST_1, refIdx);586 ilpPic[0]->getSlice(0)->setRefPOC(pcRefPicBL->getSlice(0)->getRefPOC(REF_PIC_LIST_1, refIdx), REF_PIC_LIST_1, refIdx); 587 587 } 588 588 for(Int refIdx = 0; refIdx < pcRefPicBL->getSlice(0)->getNumRefIdx(REF_PIC_LIST_0); refIdx++) 589 589 { 590 ilpPic[0]->getSlice(0)->setRefPic(pcRefPicBL->getSlice(0)->getRefPic(REF_PIC_LIST_0, refIdx), REF_PIC_LIST_0, refIdx);590 ilpPic[0]->getSlice(0)->setRefPic(pcRefPicBL->getSlice(0)->getRefPic(REF_PIC_LIST_0, refIdx), REF_PIC_LIST_0, refIdx); 591 591 } 592 592 for(Int refIdx = 0; refIdx < pcRefPicBL->getSlice(0)->getNumRefIdx(REF_PIC_LIST_1); refIdx++) 593 593 { 594 ilpPic[0]->getSlice(0)->setRefPic(pcRefPicBL->getSlice(0)->getRefPic(REF_PIC_LIST_1, refIdx), REF_PIC_LIST_1, refIdx);594 ilpPic[0]->getSlice(0)->setRefPic(pcRefPicBL->getSlice(0)->getRefPic(REF_PIC_LIST_1, refIdx), REF_PIC_LIST_1, refIdx); 595 595 } 596 596 return; -
branches/SHM-1.0-dev/source/Lib/TLibCommon/TComYuv.h
r17 r32 116 116 Void copyFromPicChroma ( TComPicYuv* pcPicYuvSrc, UInt iCuAddr, UInt uiAbsZorderIdx ); 117 117 #if NO_RESIDUAL_FLAG_FOR_BLPRED 118 Void copyFromPicLuma ( TComPicYuv* pcPicYuvSrc, UInt iCuAddr, UInt uiZorderIdxInCU, UInt uiAbsZorderIdx, UInt uiWidth, UInt uiHeight );118 Void copyFromPicLuma ( TComPicYuv* pcPicYuvSrc, UInt iCuAddr, UInt uiZorderIdxInCU, UInt uiAbsZorderIdx, UInt uiWidth, UInt uiHeight ); 119 119 Void copyFromPicChroma( TComPicYuv* pcPicYuvSrc, UInt iCuAddr, UInt uiZorderIdxInCU, UInt uiAbsZorderIdx, UInt uiCWidth, UInt uiCHeight, UInt uiChromaId ); 120 120 #endif
Note: See TracChangeset for help on using the changeset viewer.