Changeset 71 in SHVCSoftware for branches/HM-10.0-dev-SHM/source/Lib
- Timestamp:
- 8 Mar 2013, 01:22:04 (12 years ago)
- Location:
- branches/HM-10.0-dev-SHM/source/Lib
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComDataCU.cpp
r56 r71 4123 4123 4124 4124 #if SVC_UPSAMPLING 4125 Int iBWidth= cBaseColPic->getPicYuvRec()->getWidth () - cBaseColPic->getPicYuvRec()->getPicCropLeftOffset() - cBaseColPic->getPicYuvRec()->getPicCropRightOffset();4126 Int iBHeight= cBaseColPic->getPicYuvRec()->getHeight() - cBaseColPic->getPicYuvRec()->getPicCropTopOffset() - cBaseColPic->getPicYuvRec()->getPicCropBottomOffset();4127 4128 Int iEWidth= m_pcPic->getPicYuvRec()->getWidth() - m_pcPic->getPicYuvRec()->getPicCropLeftOffset() - m_pcPic->getPicYuvRec()->getPicCropRightOffset();4129 Int iEHeight= m_pcPic->getPicYuvRec()->getHeight() - m_pcPic->getPicYuvRec()->getPicCropTopOffset() - m_pcPic->getPicYuvRec()->getPicCropBottomOffset();4125 Int widthBL = cBaseColPic->getPicYuvRec()->getWidth () - cBaseColPic->getPicYuvRec()->getPicCropLeftOffset() - cBaseColPic->getPicYuvRec()->getPicCropRightOffset(); 4126 Int heightBL = cBaseColPic->getPicYuvRec()->getHeight() - cBaseColPic->getPicYuvRec()->getPicCropTopOffset() - cBaseColPic->getPicYuvRec()->getPicCropBottomOffset(); 4127 4128 Int widthEL = m_pcPic->getPicYuvRec()->getWidth() - m_pcPic->getPicYuvRec()->getPicCropLeftOffset() - m_pcPic->getPicYuvRec()->getPicCropRightOffset(); 4129 Int heightEL = m_pcPic->getPicYuvRec()->getHeight() - m_pcPic->getPicYuvRec()->getPicCropTopOffset() - m_pcPic->getPicYuvRec()->getPicCropBottomOffset(); 4130 4130 #else 4131 Int iBWidth= cBaseColPic->getPicYuvRec()->getWidth();4132 Int iBHeight= cBaseColPic->getPicYuvRec()->getHeight();4133 4134 Int iEWidth= m_pcPic->getPicYuvRec()->getWidth();4135 Int iEHeight= m_pcPic->getPicYuvRec()->getHeight();4136 #endif 4137 4138 if ( iBWidth == iEWidth && iEHeight == iBHeight)4131 Int widthBL = cBaseColPic->getPicYuvRec()->getWidth(); 4132 Int heightBL = cBaseColPic->getPicYuvRec()->getHeight(); 4133 4134 Int widthEL = m_pcPic->getPicYuvRec()->getWidth(); 4135 Int heightEL = m_pcPic->getPicYuvRec()->getHeight(); 4136 #endif 4137 4138 if (widthBL == widthEL && heightEL == heightBL) 4139 4139 { 4140 4140 uiAbsPartIdxBase = uiCuAbsPartIdx + m_uiAbsIdxInLCU; … … 4150 4150 Int iEY = m_uiCUPelY + uiMinUnitSize*(uiRasterAddr/uiNumPartInCUWidth); 4151 4151 4152 Int iBX = (iEX* iBWidth + iEWidth/2)/iEWidth;4153 Int iBY = (iEY* iBHeight+ iEHeight/2)/iEHeight;4152 Int iBX = (iEX*widthBL + widthEL/2)/widthEL; 4153 Int iBY = (iEY*heightBL+ heightEL/2)/heightEL; 4154 4154 4155 4155 uiCUAddrBase = (iBY/g_uiMaxCUHeight)*cBaseColPic->getFrameWidthInCU() + (iBX/g_uiMaxCUWidth); … … 4175 4175 const Window &confEL = m_pcPic->getPicYuvRec()->getConformanceWindow(); 4176 4176 4177 Int iBWidth= m_pcSlice->getBaseColPic()->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();4178 Int iBHeight= m_pcSlice->getBaseColPic()->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();4179 4180 Int iEWidth= m_pcPic->getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset();4181 Int iEHeight= m_pcPic->getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset();4177 Int widthBL = m_pcSlice->getBaseColPic()->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset(); 4178 Int heightBL = m_pcSlice->getBaseColPic()->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset(); 4179 4180 Int widthEL = m_pcPic->getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset(); 4181 Int heightEL = m_pcPic->getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset(); 4182 4182 #else 4183 Int iBWidth= cBaseColPic->getPicYuvRec()->getWidth();4184 Int iBHeight= cBaseColPic->getPicYuvRec()->getHeight();4185 4186 Int iEWidth= m_pcPic->getPicYuvRec()->getWidth();4187 Int iEHeight= m_pcPic->getPicYuvRec()->getHeight();4183 Int widthBL = cBaseColPic->getPicYuvRec()->getWidth(); 4184 Int heightBL = cBaseColPic->getPicYuvRec()->getHeight(); 4185 4186 Int widthEL = m_pcPic->getPicYuvRec()->getWidth(); 4187 Int heightEL = m_pcPic->getPicYuvRec()->getHeight(); 4188 4188 #endif 4189 4189 … … 4193 4193 UInt uiMinUnitSize = m_pcPic->getMinCUWidth(); 4194 4194 4195 Int iBX = (uiPelX* iBWidth + iEWidth/2)/iEWidth;4196 Int iBY = (uiPelY* iBHeight+ iEHeight/2)/iEHeight;4195 Int iBX = (uiPelX*widthBL + widthEL/2)/widthEL; 4196 Int iBY = (uiPelY*heightBL+ heightEL/2)/heightEL; 4197 4197 4198 4198 if ( iBX >= cBaseColPic->getPicYuvRec()->getWidth() || iBY >= cBaseColPic->getPicYuvRec()->getHeight()) … … 4202 4202 4203 4203 #if AVC_SYNTAX 4204 if( iBX >= iBWidth || iBY >= iBHeight) //outside of the reference layer cropped picture4204 if( iBX >= widthBL || iBY >= heightBL ) //outside of the reference layer cropped picture 4205 4205 { 4206 4206 return NULL; … … 4229 4229 const Window &confEL = m_pcPic->getPicYuvRec()->getConformanceWindow(); 4230 4230 4231 Int iBWidth= m_pcSlice->getBaseColPic()->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();4232 Int iBHeight= m_pcSlice->getBaseColPic()->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();4233 4234 Int iEWidth= m_pcPic->getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset();4235 Int iEHeight= m_pcPic->getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset();4231 Int widthBL = m_pcSlice->getBaseColPic()->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset(); 4232 Int heightBL = m_pcSlice->getBaseColPic()->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset(); 4233 4234 Int widthEL = m_pcPic->getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset(); 4235 Int heightEL = m_pcPic->getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset(); 4236 4236 #else 4237 Int iBWidth= m_pcSlice->getBaseColPic()->getPicYuvRec()->getWidth();4238 Int iBHeight= m_pcSlice->getBaseColPic()->getPicYuvRec()->getHeight();4239 4240 Int iEWidth= m_pcPic->getPicYuvRec()->getWidth();4241 Int iEHeight= m_pcPic->getPicYuvRec()->getHeight();4242 #endif 4243 4244 Int iMvX = (rcMvFieldBase.getHor()* iEWidth + (iBWidth/2 -1) * (rcMvFieldBase.getHor() > 0 ? 1: -1) )/iBWidth;4245 Int iMvY = (rcMvFieldBase.getVer()* iEHeight + (iBHeight/2 -1) * (rcMvFieldBase.getVer() > 0 ? 1: -1) )/iBHeight;4237 Int widthBL = m_pcSlice->getBaseColPic()->getPicYuvRec()->getWidth(); 4238 Int heightBL = m_pcSlice->getBaseColPic()->getPicYuvRec()->getHeight(); 4239 4240 Int widthEL = m_pcPic->getPicYuvRec()->getWidth(); 4241 Int heightEL = m_pcPic->getPicYuvRec()->getHeight(); 4242 #endif 4243 4244 Int iMvX = (rcMvFieldBase.getHor()*widthEL + (widthBL/2 -1) * (rcMvFieldBase.getHor() > 0 ? 1: -1) )/widthBL; 4245 Int iMvY = (rcMvFieldBase.getVer()*heightEL + (heightBL/2 -1) * (rcMvFieldBase.getVer() > 0 ? 1: -1) )/heightBL; 4246 4246 4247 4247 cMv.set(iMvX, iMvY); -
branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComPic.cpp
r67 r71 589 589 #if REF_IDX_MFM 590 590 #if !REUSE_BLKMAPPING 591 Void TComPic::deriveUnitIdxBase( UInt u iUpsamplePelX, UInt uiUpsamplePelY, UInt ratio, UInt& uiBaseCUAddr, UInt& uiBaseAbsPartIdx )591 Void TComPic::deriveUnitIdxBase( UInt upsamplePelX, UInt upsamplePelY, UInt ratio, UInt& baseCUAddr, UInt& baseAbsPartIdx ) 592 592 { 593 593 //pixel in the base layer 594 594 595 UInt uiPelX = (uiUpsamplePelX<<1)/ratio;596 UInt uiPelY = (uiUpsamplePelY<<1)/ratio;597 UInt uiBaseWidth = getPicYuvRec()->getWidth();598 UInt uiBaseHeight = getPicYuvRec()->getHeight();595 UInt pelX = (upsamplePelX<<1)/ratio; 596 UInt pelY = (upsamplePelY<<1)/ratio; 597 UInt baseWidth = getPicYuvRec()->getWidth(); 598 UInt baseHeight = getPicYuvRec()->getHeight(); 599 599 600 UInt uiWidthInCU = ( uiBaseWidth % g_uiMaxCUWidth ) ? uiBaseWidth /g_uiMaxCUWidth + 1 : uiBaseWidth /g_uiMaxCUWidth;600 UInt widthInCU = ( baseWidth % g_uiMaxCUWidth ) ? baseWidth /g_uiMaxCUWidth + 1 : baseWidth /g_uiMaxCUWidth; 601 601 602 602 #if MFM_CLIPPING_FIX 603 uiPelX = (UInt)Clip3<UInt>(0, getPicYuvRec()->getWidth() - 1, uiPelX);604 uiPelY = (UInt)Clip3<UInt>(0, getPicYuvRec()->getHeight() - 1, uiPelY);603 pelX = (UInt)Clip3<UInt>(0, getPicYuvRec()->getWidth() - 1, pelX); 604 pelY = (UInt)Clip3<UInt>(0, getPicYuvRec()->getHeight() - 1, pelY); 605 605 #else 606 UInt uiHeightInCU = ( uiBaseHeight% g_uiMaxCUHeight ) ? uiBaseHeight/ g_uiMaxCUHeight + 1 : uiBaseHeight/ g_uiMaxCUHeight;607 608 uiPelX = (UInt)Clip3<UInt>(0, uiWidthInCU * g_uiMaxCUWidth - 1, uiPelX);609 uiPelY = (UInt)Clip3<UInt>(0, uiHeightInCU * g_uiMaxCUHeight - 1, uiPelY);606 UInt heightInCU = ( baseHeight% g_uiMaxCUHeight ) ? baseHeight/ g_uiMaxCUHeight + 1 : baseHeight/ g_uiMaxCUHeight; 607 608 pelX = (UInt)Clip3<UInt>(0, widthInCU * g_uiMaxCUWidth - 1, pelX); 609 pelY = (UInt)Clip3<UInt>(0, heightInCU * g_uiMaxCUHeight - 1, pelY); 610 610 #endif 611 611 612 uiBaseCUAddr = uiPelY / g_uiMaxCUHeight * uiWidthInCU + uiPelX / g_uiMaxCUWidth;613 614 UInt uiWidthMinPU = g_uiMaxCUWidth / (1<<g_uiMaxCUDepth);615 UInt uiHeightMinPU = g_uiMaxCUHeight/(1<<g_uiMaxCUDepth);612 baseCUAddr = pelY / g_uiMaxCUHeight * widthInCU + pelX / g_uiMaxCUWidth; 613 614 UInt widthMinPU = g_uiMaxCUWidth / (1<<g_uiMaxCUDepth); 615 UInt heightMinPU = g_uiMaxCUHeight/(1<<g_uiMaxCUDepth); 616 616 617 UInt uiAbsPelX = uiPelX - (uiPelX / g_uiMaxCUWidth) * g_uiMaxCUWidth;618 UInt uiAbsPelY = uiPelY - (uiPelY / g_uiMaxCUHeight) * g_uiMaxCUHeight;619 620 UInt RasterIdx = uiAbsPelY / uiHeightMinPU * (g_uiMaxCUWidth/uiWidthMinPU) + uiAbsPelX / uiWidthMinPU;621 uiBaseAbsPartIdx = g_auiRasterToZscan[RasterIdx];617 UInt absPelX = pelX - (pelX / g_uiMaxCUWidth) * g_uiMaxCUWidth; 618 UInt absPelY = pelY - (pelY / g_uiMaxCUHeight) * g_uiMaxCUHeight; 619 620 UInt rasterIdx = absPelY / heightMinPU * (g_uiMaxCUWidth/widthMinPU) + absPelX / widthMinPU; 621 baseAbsPartIdx = g_auiRasterToZscan[rasterIdx]; 622 622 623 623 return; … … 631 631 const Window &confEL = getPicYuvRec()->getConformanceWindow(); 632 632 633 Int iBWidth= pcPicBase->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();634 Int iBHeight= pcPicBase->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();635 636 Int iEWidth= getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset();637 Int iEHeight= getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset();633 Int widthBL = pcPicBase->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset(); 634 Int heightBL = pcPicBase->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset(); 635 636 Int widthEL = getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset(); 637 Int heightEL = getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset(); 638 638 #endif 639 639 640 640 #if !REUSE_MVSCALE || !REUSE_BLKMAPPING 641 641 UInt upSampleRatio = 0; 642 if( iEWidth == iBWidth && iEHeight == iBHeight)642 if(widthEL == widthBL && heightEL == heightBL) 643 643 { 644 644 upSampleRatio = 2; 645 645 } 646 else if(2* iEWidth == 3*iBWidth && 2*iEHeight == 3*iBHeight)646 else if(2*widthEL == 3*widthBL && 2*heightEL == 3*heightBL) 647 647 { 648 648 upSampleRatio = 3; 649 649 } 650 else if( iEWidth == 2*iBWidth && iEHeight == 2*iBHeight)650 else if(widthEL == 2*widthBL && heightEL == 2*heightBL) 651 651 { 652 652 upSampleRatio = 4; … … 658 658 #endif 659 659 660 UInt uiNumPartitions = 1<<(g_uiMaxCUDepth<<1);661 UInt uiWidthMinPU = g_uiMaxCUWidth/(1<<g_uiMaxCUDepth);662 UInt uiHeightMinPU = g_uiMaxCUHeight/(1<<g_uiMaxCUDepth);663 Int unitNum = max (1, (Int)((16/uiWidthMinPU)*(16/uiHeightMinPU)) );660 UInt numPartitions = 1<<(g_uiMaxCUDepth<<1); 661 UInt widthMinPU = g_uiMaxCUWidth/(1<<g_uiMaxCUDepth); 662 UInt heightMinPU = g_uiMaxCUHeight/(1<<g_uiMaxCUDepth); 663 Int unitNum = max (1, (Int)((16/widthMinPU)*(16/heightMinPU)) ); 664 664 665 665 for(UInt cuIdx = 0; cuIdx < getPicSym()->getNumberOfCUsInFrame(); cuIdx++) //each LCU … … 667 667 TComDataCU* pcCUDes = getCU(cuIdx); 668 668 669 for(UInt uiAbsPartIdx = 0; uiAbsPartIdx < uiNumPartitions; uiAbsPartIdx+=unitNum ) //each 16x16 unit669 for(UInt absPartIdx = 0; absPartIdx < numPartitions; absPartIdx+=unitNum ) //each 16x16 unit 670 670 { 671 671 //pixel position of each unit in up-sampled layer 672 UInt uiPelX = pcCUDes->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ];673 UInt uiPelY = pcCUDes->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ];674 UInt uiBaseCUAddr, uiBaseAbsPartIdx;672 UInt pelX = pcCUDes->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[absPartIdx] ]; 673 UInt pelY = pcCUDes->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[absPartIdx] ]; 674 UInt baseCUAddr, baseAbsPartIdx; 675 675 676 676 #if REUSE_BLKMAPPING 677 677 TComDataCU *pcColCU = 0; 678 pcColCU = pcCUDes->getBaseColCU( uiPelX + 8, uiPelY + 8, uiBaseCUAddr, uiBaseAbsPartIdx);678 pcColCU = pcCUDes->getBaseColCU(pelX + 8, pelY + 8, baseCUAddr, baseAbsPartIdx); 679 679 #else 680 pcPicBase->deriveUnitIdxBase( uiPelX + 8, uiPelY + 8, upSampleRatio, uiBaseCUAddr, uiBaseAbsPartIdx);680 pcPicBase->deriveUnitIdxBase(pelX + 8, pelY + 8, upSampleRatio, baseCUAddr, baseAbsPartIdx); 681 681 #endif 682 682 683 683 #if AVC_SYNTAX 684 Int iBX = ( (uiPelX + 8) * iBWidth + iEWidth/2 ) / iEWidth;685 Int iBY = ( (uiPelY + 8) * iBHeight+ iEHeight/2 ) / iEHeight;684 Int xBL = ( (pelX + 8) * widthBL + widthEL/2 ) / widthEL; 685 Int yBL = ( (pelY + 8) * heightBL+ heightEL/2 ) / heightEL; 686 686 687 687 #if REUSE_BLKMAPPING 688 if( ( iBX < iBWidth && iBY < iBHeight ) && pcColCU && (pcColCU->getPredictionMode(uiBaseAbsPartIdx) != MODE_NONE) && (pcColCU->getPredictionMode(uiBaseAbsPartIdx) != MODE_INTRA) ) //base layer unit not skip and invalid mode688 if( ( xBL < widthBL && yBL < heightBL ) && pcColCU && (pcColCU->getPredictionMode(baseAbsPartIdx) != MODE_NONE) && (pcColCU->getPredictionMode(baseAbsPartIdx) != MODE_INTRA) ) //base layer unit not skip and invalid mode 689 689 #else 690 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 mode690 if( ( xBL < widthBL && yBL < heightBL ) && (pcPicBase->getCU(baseCUAddr)->getPredictionMode(baseAbsPartIdx) != MODE_NONE) && (pcPicBase->getCU(baseCUAddr)->getPredictionMode(baseAbsPartIdx) != MODE_INTRA) ) //base layer unit not skip and invalid mode 691 691 #endif 692 692 #else 693 693 #if REUSE_BLKMAPPING 694 if( pcColCU && (pcColCU->getPredictionMode( uiBaseAbsPartIdx) != MODE_NONE) && (pcColCU->getPredictionMode(uiBaseAbsPartIdx) != MODE_INTRA) ) //base layer unit not skip and invalid mode694 if( pcColCU && (pcColCU->getPredictionMode(baseAbsPartIdx) != MODE_NONE) && (pcColCU->getPredictionMode(baseAbsPartIdx) != MODE_INTRA) ) //base layer unit not skip and invalid mode 695 695 #else 696 if( (pcPicBase->getCU( uiBaseCUAddr)->getPredictionMode(uiBaseAbsPartIdx) != MODE_NONE) && (pcPicBase->getCU(uiBaseCUAddr)->getPredictionMode(uiBaseAbsPartIdx) != MODE_INTRA) ) //base layer unit not skip and invalid mode696 if( (pcPicBase->getCU(baseCUAddr)->getPredictionMode(baseAbsPartIdx) != MODE_NONE) && (pcPicBase->getCU(baseCUAddr)->getPredictionMode(baseAbsPartIdx) != MODE_INTRA) ) //base layer unit not skip and invalid mode 697 697 #endif 698 698 #endif … … 703 703 TComMvField sMvFieldBase, sMvField; 704 704 #if REUSE_BLKMAPPING 705 pcColCU->getMvField( pcColCU, uiBaseAbsPartIdx, (RefPicList)refPicList, sMvFieldBase);705 pcColCU->getMvField( pcColCU, baseAbsPartIdx, (RefPicList)refPicList, sMvFieldBase); 706 706 #else 707 pcPicBase->getCU( uiBaseCUAddr)->getMvField( pcPicBase->getCU(uiBaseCUAddr), uiBaseAbsPartIdx, (RefPicList)refPicList, sMvFieldBase);707 pcPicBase->getCU(baseCUAddr)->getMvField( pcPicBase->getCU(baseCUAddr), baseAbsPartIdx, (RefPicList)refPicList, sMvFieldBase); 708 708 #endif 709 709 pcCUDes->scaleBaseMV( sMvField, sMvFieldBase ); 710 710 #else 711 TComMv cMv = pcPicBase->getCU( uiBaseCUAddr)->getCUMvField((RefPicList)refPicList)->getMv(uiBaseAbsPartIdx);712 Int refIdx = pcPicBase->getCU( uiBaseCUAddr)->getCUMvField((RefPicList)refPicList)->getRefIdx(uiBaseAbsPartIdx);713 714 Int Hor = ((Int)upSampleRatio * cMv.getHor())/2 ;715 Int Ver = ((Int)upSampleRatio * cMv.getVer())/2 ;716 717 TComMv cScaledMv( Hor, Ver);711 TComMv cMv = pcPicBase->getCU(baseCUAddr)->getCUMvField((RefPicList)refPicList)->getMv(baseAbsPartIdx); 712 Int refIdx = pcPicBase->getCU(baseCUAddr)->getCUMvField((RefPicList)refPicList)->getRefIdx(baseAbsPartIdx); 713 714 Int hor = ((Int)upSampleRatio * cMv.getHor())/2 ; 715 Int ver = ((Int)upSampleRatio * cMv.getVer())/2 ; 716 717 TComMv cScaledMv(hor, ver); 718 718 TComMvField sMvField; 719 719 sMvField.setMvField(cScaledMv, refIdx); 720 720 #endif 721 721 722 pcCUDes->getCUMvField((RefPicList)refPicList)->setMvField(sMvField, uiAbsPartIdx);723 pcCUDes->setPredictionMode( uiAbsPartIdx, MODE_INTER);722 pcCUDes->getCUMvField((RefPicList)refPicList)->setMvField(sMvField, absPartIdx); 723 pcCUDes->setPredictionMode(absPartIdx, MODE_INTER); 724 724 } 725 725 } … … 727 727 { 728 728 TComMvField zeroMvField; //zero MV and invalid reference index 729 pcCUDes->getCUMvField(REF_PIC_LIST_0)->setMvField(zeroMvField, uiAbsPartIdx);730 pcCUDes->getCUMvField(REF_PIC_LIST_1)->setMvField(zeroMvField, uiAbsPartIdx);731 pcCUDes->setPredictionMode( uiAbsPartIdx, MODE_INTRA);729 pcCUDes->getCUMvField(REF_PIC_LIST_0)->setMvField(zeroMvField, absPartIdx); 730 pcCUDes->getCUMvField(REF_PIC_LIST_1)->setMvField(zeroMvField, absPartIdx); 731 pcCUDes->setPredictionMode(absPartIdx, MODE_INTRA); 732 732 } 733 733 734 734 for(UInt i = 1; i < unitNum; i++ ) 735 735 { 736 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);737 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);738 pcCUDes->setPredictionMode( uiAbsPartIdx+i, pcCUDes->getPredictionMode(uiAbsPartIdx)) ;739 } 740 } 741 memset( pcCUDes->getPartitionSize(), SIZE_2Nx2N, sizeof(char)* uiNumPartitions);736 pcCUDes->getCUMvField(REF_PIC_LIST_0)->setMvField(pcCUDes->getCUMvField(REF_PIC_LIST_0)->getMv(absPartIdx), pcCUDes->getCUMvField(REF_PIC_LIST_0)->getRefIdx(absPartIdx), absPartIdx + i); 737 pcCUDes->getCUMvField(REF_PIC_LIST_1)->setMvField(pcCUDes->getCUMvField(REF_PIC_LIST_1)->getMv(absPartIdx), pcCUDes->getCUMvField(REF_PIC_LIST_1)->getRefIdx(absPartIdx), absPartIdx + i); 738 pcCUDes->setPredictionMode(absPartIdx+i, pcCUDes->getPredictionMode(absPartIdx)) ; 739 } 740 } 741 memset( pcCUDes->getPartitionSize(), SIZE_2Nx2N, sizeof(char)*numPartitions); 742 742 } 743 743 } … … 755 755 756 756 const Window &conf = this->getPicYuvRec()->getConformanceWindow(); 757 UInt uiWidth = this->getPicYuvRec()->getWidth() - conf.getWindowLeftOffset() - conf.getWindowRightOffset();758 UInt uiHeight = this->getPicYuvRec()->getHeight() - conf.getWindowTopOffset() - conf.getWindowBottomOffset();759 UInt64 uiPOC= (UInt64)this->getPOC();760 UInt uiPartWidth = uiWidth / 4;761 UInt uiPartHeight = uiHeight / 4;762 763 UInt uiNumPartInWidth = this->getNumPartInWidth();764 UInt uiNumPartInHeight = this->getNumPartInHeight();765 UInt uiNumPartLCUInWidth = this->getFrameWidthInCU();766 767 UInt64 uiPos = (UInt64) uiPOC * uiWidth * uiHeight * numBytes / 16;757 UInt width = this->getPicYuvRec()->getWidth() - conf.getWindowLeftOffset() - conf.getWindowRightOffset(); 758 UInt height = this->getPicYuvRec()->getHeight() - conf.getWindowTopOffset() - conf.getWindowBottomOffset(); 759 UInt64 poc = (UInt64)this->getPOC(); 760 UInt partWidth = width / 4; 761 UInt partHeight = height / 4; 762 763 UInt numPartInWidth = this->getNumPartInWidth(); 764 UInt numPartInHeight = this->getNumPartInHeight(); 765 UInt numPartLCUInWidth = this->getFrameWidthInCU(); 766 767 UInt64 uiPos = (UInt64)poc * width * height * numBytes / 16; 768 768 769 769 filestream->seekg( uiPos, ios_base::beg ); 770 770 771 for( Int i = 0; i < uiPartHeight; i++ )772 { 773 for( Int j = 0; j < uiPartWidth; j++ )774 { 775 UInt uiX = ( j / uiNumPartInWidth );776 UInt uiY = ( i / uiNumPartInHeight );777 778 UInt uiLCUAddr = uiY * uiNumPartLCUInWidth + uiX;779 UInt uiPartAddr = ( i - uiY * uiNumPartInHeight ) * uiNumPartInWidth + ( j - uiX * uiNumPartInWidth );780 uiPartAddr = g_auiRasterToZscan[uiPartAddr];771 for( Int i = 0; i < partHeight; i++ ) 772 { 773 for( Int j = 0; j < partWidth; j++ ) 774 { 775 UInt x = ( j / numPartInWidth ); 776 UInt y = ( i / numPartInHeight ); 777 778 UInt addrLCU = y * numPartLCUInWidth + x; 779 UInt partAddr = ( i - y * numPartInHeight ) * numPartInWidth + ( j - x * numPartInWidth ); 780 partAddr = g_auiRasterToZscan[partAddr]; 781 781 782 TComDataCU* pcCU = this->getCU( uiLCUAddr);782 TComDataCU* pcCU = this->getCU( addrLCU ); 783 783 784 784 TComMv mv; … … 789 789 filestream->read( &refIdxL0, 1 ); 790 790 assert( refIdxL0 >= -1 ); 791 pcCU->getCUMvField( REF_PIC_LIST_0 )->setRefIdx( (Int)refIdxL0, uiPartAddr );791 pcCU->getCUMvField( REF_PIC_LIST_0 )->setRefIdx( (Int)refIdxL0, partAddr ); 792 792 793 793 // RefIdxL1 … … 795 795 filestream->read( &refIdxL1, 1 ); 796 796 assert( refIdxL1 >= -1 ); 797 pcCU->getCUMvField( REF_PIC_LIST_1 )->setRefIdx( (Int)refIdxL1, uiPartAddr );797 pcCU->getCUMvField( REF_PIC_LIST_1 )->setRefIdx( (Int)refIdxL1, partAddr ); 798 798 799 799 // MV L0 … … 804 804 filestream->read( reinterpret_cast<char*>(&temp), 2 ); 805 805 mv.setVer( (Short)temp ); 806 pcCU->getCUMvField( REF_PIC_LIST_0 )->setMv( mv, uiPartAddr );806 pcCU->getCUMvField( REF_PIC_LIST_0 )->setMv( mv, partAddr ); 807 807 808 808 // MV L1 … … 813 813 filestream->read( reinterpret_cast<char*>(&temp), 2 ); 814 814 mv.setVer( (Short)temp ); 815 pcCU->getCUMvField( REF_PIC_LIST_1 )->setMv( mv, uiPartAddr );815 pcCU->getCUMvField( REF_PIC_LIST_1 )->setMv( mv, partAddr ); 816 816 817 817 // set dependent information 818 pcCU->setPredictionMode( uiPartAddr, ( refIdxL0 == NOT_VALID && refIdxL1 == NOT_VALID ) ? MODE_INTRA : MODE_INTER );819 UInt uiInterDir = ( refIdxL0 != NOT_VALID ) + ( refIdxL1 != NOT_VALID && this->getSlice(0)->isInterB() ) * 2;820 assert( uiInterDir >= 0 && uiInterDir <= 3 );821 pcCU->setInterDir( uiPartAddr, uiInterDir );818 pcCU->setPredictionMode( partAddr, ( refIdxL0 == NOT_VALID && refIdxL1 == NOT_VALID ) ? MODE_INTRA : MODE_INTER ); 819 UInt interDir = ( refIdxL0 != NOT_VALID ) + ( refIdxL1 != NOT_VALID && this->getSlice(0)->isInterB() ) * 2; 820 assert( interDir >= 0 && interDir <= 3 ); 821 pcCU->setInterDir( partAddr, interDir ); 822 822 } 823 823 } … … 833 833 } 834 834 835 UInt uiWidth = this->getPicYuvRec()->getWidth() - getSlice(0)->getSPS()->getPicCropLeftOffset() - getSlice(0)->getSPS()->getPicCropRightOffset(); 836 UInt uiHeight = this->getPicYuvRec()->getHeight() - getSlice(0)->getSPS()->getPicCropTopOffset() - getSlice(0)->getSPS()->getPicCropBottomOffset(); 837 UInt64 uiPOC = (UInt64)this->getPOC(); 838 UInt uiPartWidth = uiWidth / 4; 839 UInt uiPartHeight = uiHeight / 4; 840 841 UInt uiNumPartInWidth = this->getNumPartInWidth(); 842 UInt uiNumPartInHeight = this->getNumPartInHeight(); 843 UInt uiNumPartLCUInWidth = this->getFrameWidthInCU(); 844 845 filestream->seekg( uiPOC * uiWidth * uiHeight * numBytes / 16 ); 835 const Window &conf = this->getConformanceWindow(); 836 UInt width = this->getPicYuvRec()->getWidth() - conf.getWindowLeftOffset() - conf.getWindowRightOffset(); 837 UInt height = this->getPicYuvRec()->getHeight() - conf.getWindowTopOffset() - conf.getWindowBottomOffset(); 838 839 UInt64 poc = (UInt64)this->getPOC(); 840 UInt partWidth = width / 4; 841 UInt partHeight = height / 4; 842 843 UInt numPartInWidth = this->getNumPartInWidth(); 844 UInt numPartInHeight = this->getNumPartInHeight(); 845 UInt numPartLCUInWidth = this->getFrameWidthInCU(); 846 847 filestream->seekg( poc * width * height * numBytes / 16 ); 846 848 847 for( Int i = 0; i < uiPartHeight; i++ )848 { 849 for( Int j = 0; j < uiPartWidth; j++ )850 { 851 UInt uiX = ( j / uiNumPartInWidth );852 UInt uiY = ( i / uiNumPartInHeight );853 854 UInt uiLCUAddr = uiY * uiNumPartLCUInWidth + uiX;855 UInt uiPartAddr = ( i - uiY * uiNumPartInHeight ) * uiNumPartInWidth + ( j - uiX * uiNumPartInWidth );856 uiPartAddr = g_auiRasterToZscan[uiPartAddr];849 for( Int i = 0; i < partHeight; i++ ) 850 { 851 for( Int j = 0; j < partWidth; j++ ) 852 { 853 UInt x = ( j / numPartInWidth ); 854 UInt y = ( i / numPartInHeight ); 855 856 UInt addrLCU = y * numPartLCUInWidth + x; 857 UInt partAddr = ( i - y * numPartInHeight ) * numPartInWidth + ( j - x * numPartInWidth ); 858 partAddr = g_auiRasterToZscan[partAddr]; 857 859 858 TComDataCU* pcCU = this->getCU( uiLCUAddr);860 TComDataCU* pcCU = this->getCU( addrLCU ); 859 861 860 862 TComMv mv; … … 863 865 864 866 // RefIdx 865 if( !pcCU->isIntra( uiPartAddr ) )866 { 867 refIdxL0 = (Char)pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiPartAddr );868 refIdxL1 = (Char)pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiPartAddr );867 if( !pcCU->isIntra( partAddr ) ) 868 { 869 refIdxL0 = (Char)pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( partAddr ); 870 refIdxL1 = (Char)pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( partAddr ); 869 871 } 870 872 assert( refIdxL0 >= - 1 && refIdxL1 >= - 1 ); … … 876 878 if( refIdxL0 >= 0 ) 877 879 { 878 mv = pcCU->getCUMvField( REF_PIC_LIST_0 )->getMv( uiPartAddr );880 mv = pcCU->getCUMvField( REF_PIC_LIST_0 )->getMv( partAddr ); 879 881 } 880 882 temp = (Short)mv.getHor(); … … 887 889 if( refIdxL1 >= 0 ) 888 890 { 889 mv = pcCU->getCUMvField( REF_PIC_LIST_1 )->getMv( uiPartAddr );891 mv = pcCU->getCUMvField( REF_PIC_LIST_1 )->getMv( partAddr ); 890 892 } 891 893 temp = (Short)mv.getHor(); -
branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComPic.h
r54 r71 134 134 Void copyUpsampledMvField ( TComPic* pcPicBase ); 135 135 #if !REUSE_BLKMAPPING 136 Void deriveUnitIdxBase ( UInt u iUpsamplePelX, UInt uiUpsamplePelY, UInt ratio, UInt& uiBaseCUAddr, UInt& uiBaseAbsPartIdx );136 Void deriveUnitIdxBase ( UInt upsamplePelX, UInt upsamplePelY, UInt ratio, UInt& baseCUAddr, UInt& baseAbsPartIdx ); 137 137 #endif 138 138 #endif -
branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComSlice.cpp
r69 r71 2066 2066 // should be set if the base layer has its own instance of the reference picture lists, currently EL RPL is reused. 2067 2067 getRefPic( eRefPicList, refIdx )->setLayerId( 0 ); 2068 getRefPic( eRefPicList, refIdx )->setIsLongTerm( pcSlice->getRefPic( eRefPicList, refIdx )->getIsLongTerm() ); 2069 getRefPic( eRefPicList, refIdx )->setIsUsedAsLongTerm( pcSlice->getRefPic( eRefPicList, refIdx )->getIsUsedAsLongTerm() ); 2068 getRefPic( eRefPicList, refIdx )->setIsLongTerm( pcSlice->getRefPic( eRefPicList, refIdx )->getIsLongTerm() ); 2070 2069 */ 2071 2070 -
branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComUpsampleFilter.cpp
r56 r71 139 139 const Window &confEL = pcUsPic->getConformanceWindow(); 140 140 141 Int iBWidth= pcBasePic->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();142 Int iBHeight= pcBasePic->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();143 Int iBStride= pcBasePic->getStride();144 145 Int iEWidth= pcUsPic->getWidth () - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset();146 Int iEHeight= pcUsPic->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset();147 Int iEStride= pcUsPic->getStride();141 Int widthBL = pcBasePic->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset(); 142 Int heightBL = pcBasePic->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset(); 143 Int strideBL = pcBasePic->getStride(); 144 145 Int widthEL = pcUsPic->getWidth () - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset(); 146 Int heightEL = pcUsPic->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset(); 147 Int strideEL = pcUsPic->getStride(); 148 148 149 149 Pel* piTempBufY = pcTempPic->getLumaAddr(); … … 196 196 197 197 #if PHASE_DERIVATION_IN_INTEGER 198 Int iRefPos16 = 0;198 Int refPos16 = 0; 199 199 Int phase = 0; 200 200 Int refPos = 0; … … 212 212 213 213 Int chromaPhaseDenominator; 214 if ( iEWidth == 2*iBWidth) // 2x scalability214 if (widthEL == 2*widthBL) // 2x scalability 215 215 { 216 216 for ( i = 0; i < 8; i++) … … 230 230 #endif 231 231 232 assert ( iEWidth == 2*iBWidth || 2*iEWidth == 3*iBWidth);233 assert ( iEHeight == 2*iBHeight || 2*iEHeight == 3*iBHeight);232 assert ( widthEL == 2*widthBL || 2*widthEL == 3*widthBL ); 233 assert ( heightEL == 2*heightBL || 2*heightEL == 3*heightBL ); 234 234 235 235 #if JCTVC_L0178 … … 237 237 if( tempBufSizeRight ) 238 238 { 239 piSrcY = piSrcBufY + iBWidth;239 piSrcY = piSrcBufY + widthBL; 240 240 piDstY = tempBufRight; 241 241 for( i = 0; i < pcBasePic->getHeight(); i++ ) 242 242 { 243 243 memcpy(piDstY, piSrcY, sizeof(Pel) * confBL.getWindowRightOffset()); 244 piSrcY += iBStride;244 piSrcY += strideBL; 245 245 piDstY += confBL.getWindowRightOffset(); 246 246 } … … 248 248 if(confBL.getWindowRightOffset()>>1) 249 249 { 250 Int iBStrideChroma = (iBStride>>1);251 piSrcU = piSrcBufU + ( iBWidth>>1);250 Int strideBLChroma = (strideBL>>1); 251 piSrcU = piSrcBufU + (widthBL>>1); 252 252 piDstU = tempBufRight + confBL.getWindowRightOffset() * pcBasePic->getHeight(); 253 piSrcV = piSrcBufV + ( iBWidth>>1);253 piSrcV = piSrcBufV + (widthBL>>1); 254 254 piDstV = piDstU + (confBL.getWindowRightOffset()>>1) * (pcBasePic->getHeight()>>1); 255 255 … … 257 257 { 258 258 memcpy(piDstU, piSrcU, sizeof(Pel) * (confBL.getWindowRightOffset()>>1)); 259 piSrcU += iBStrideChroma;259 piSrcU += strideBLChroma; 260 260 piDstU += (confBL.getWindowRightOffset()>>1); 261 261 262 262 memcpy(piDstV, piSrcV, sizeof(Pel) * (confBL.getWindowRightOffset()>>1)); 263 piSrcV += iBStrideChroma;263 piSrcV += strideBLChroma; 264 264 piDstV += (confBL.getWindowRightOffset()>>1); 265 265 } 266 266 } 267 267 268 pcBasePic->setWidth( iBWidth);268 pcBasePic->setWidth(widthBL); 269 269 } 270 270 271 271 if( tempBufSizeBottom ) 272 272 { 273 piSrcY = piSrcBufY + iBHeight * iBStride;273 piSrcY = piSrcBufY + heightBL * strideBL; 274 274 piDstY = tempBufBottom; 275 275 for( i = 0; i < confBL.getWindowBottomOffset(); i++ ) 276 276 { 277 277 memcpy(piDstY, piSrcY, sizeof(Pel) * pcBasePic->getWidth()); 278 piSrcY += iBStride;278 piSrcY += strideBL; 279 279 piDstY += pcBasePic->getWidth(); 280 280 } … … 282 282 if(confBL.getWindowBottomOffset()>>1) 283 283 { 284 Int iBStrideChroma = (iBStride>>1);285 piSrcU = piSrcBufU + ( iBHeight>>1) * iBStrideChroma;284 Int strideBLChroma = (strideBL>>1); 285 piSrcU = piSrcBufU + (heightBL>>1) * strideBLChroma; 286 286 piDstU = tempBufBottom + confBL.getWindowBottomOffset() * pcBasePic->getWidth(); 287 piSrcV = piSrcBufV + ( iBHeight>>1) * iBStrideChroma;287 piSrcV = piSrcBufV + (heightBL>>1) * strideBLChroma; 288 288 piDstV = piDstU + (confBL.getWindowBottomOffset()>>1) * (pcBasePic->getWidth()>>1); 289 289 … … 291 291 { 292 292 memcpy(piDstU, piSrcU, sizeof(Pel) * (pcBasePic->getWidth()>>1)); 293 piSrcU += iBStrideChroma;293 piSrcU += strideBLChroma; 294 294 piDstU += (pcBasePic->getWidth()>>1); 295 295 296 296 memcpy(piDstV, piSrcV, sizeof(Pel) * (pcBasePic->getWidth()>>1)); 297 piSrcV += iBStrideChroma;297 piSrcV += strideBLChroma; 298 298 piDstV += (pcBasePic->getWidth()>>1); 299 299 } 300 300 } 301 301 302 pcBasePic->setHeight( iBHeight);302 pcBasePic->setHeight(heightBL); 303 303 } 304 304 #endif … … 308 308 309 309 #if PHASE_DERIVATION_IN_INTEGER 310 Int iShiftX = 16; 311 Int iShiftY = 16; 312 313 Int iPhaseX = 0; 314 Int iPhaseY = 0; 315 316 Int iAddX = ( ( ( iBWidth * iPhaseX ) << ( iShiftX - 2 ) ) + ( iEWidth >> 1 ) ) / iEWidth + ( 1 << ( iShiftX - 5 ) ); 317 Int iAddY = ( ( ( iBHeight * iPhaseY ) << ( iShiftY - 2 ) ) + ( iEHeight >> 1 ) ) / iEHeight+ ( 1 << ( iShiftY - 5 ) ); 318 319 Int iDeltaX = 4 * iPhaseX; 320 Int iDeltaY = 4 * iPhaseY; 321 322 323 Int iShiftXM4 = iShiftX - 4; 324 Int iShiftYM4 = iShiftY - 4; 325 326 Int iScaleX = ( ( iBWidth << iShiftX ) + ( iEWidth >> 1 ) ) / iEWidth; 327 Int iScaleY = ( ( iBHeight << iShiftY ) + ( iEHeight >> 1 ) ) / iEHeight; 328 #else 329 const Double sFactor = 1.0 * iBWidth / iEWidth; 310 Int shiftX = 16; 311 Int shiftY = 16; 312 313 Int phaseX = 0; 314 Int phaseY = 0; 315 316 Int addX = ( ( ( widthBL * phaseX ) << ( shiftX - 2 ) ) + ( widthEL >> 1 ) ) / widthEL + ( 1 << ( shiftX - 5 ) ); 317 Int addY = ( ( ( heightBL * phaseY ) << ( shiftY - 2 ) ) + ( heightEL >> 1 ) ) / heightEL+ ( 1 << ( shiftY - 5 ) ); 318 319 Int deltaX = 4 * phaseX; 320 Int deltaY = 4 * phaseY; 321 322 Int shiftXM4 = shiftX - 4; 323 Int shiftYM4 = shiftY - 4; 324 325 Int scaleX = ( ( widthBL << shiftX ) + ( widthEL >> 1 ) ) / widthEL; 326 Int scaleY = ( ( heightBL << shiftY ) + ( heightEL >> 1 ) ) / heightEL; 327 #else 328 const Double sFactor = 1.0 * widthBL / widthEL; 330 329 const Double sFactor12 = sFactor * 12; 331 330 #endif 332 331 333 332 //========== horizontal upsampling =========== 334 for( i = 0; i < iEWidth; i++ )335 { 336 #if PHASE_DERIVATION_IN_INTEGER 337 iRefPos16 = ((i*iScaleX + iAddX) >> iShiftXM4) - iDeltaX;338 phase = iRefPos16 & 15;339 refPos = iRefPos16 >> 4;333 for( i = 0; i < widthEL; i++ ) 334 { 335 #if PHASE_DERIVATION_IN_INTEGER 336 refPos16 = ((i*scaleX + addX) >> shiftXM4) - deltaX; 337 phase = refPos16 & 15; 338 refPos = refPos16 >> 4; 340 339 coeff = m_lumaFilter[phase]; 341 340 #else … … 349 348 piDstY = piTempBufY + i; 350 349 351 for( j = 0; j < iBHeight; j++ )350 for( j = 0; j < heightBL ; j++ ) 352 351 { 353 352 *piDstY = sumLumaHor(piSrcY, coeff); 354 piSrcY += iBStride;355 piDstY += iEStride;353 piSrcY += strideBL; 354 piDstY += strideEL; 356 355 } 357 356 } … … 360 359 //========== vertical upsampling =========== 361 360 pcTempPic->setBorderExtension(false); 362 pcTempPic->setHeight( iBHeight);361 pcTempPic->setHeight(heightBL); 363 362 pcTempPic->extendPicBorder (); // extend the border. 364 pcTempPic->setHeight( iEHeight);363 pcTempPic->setHeight(heightEL); 365 364 366 365 const Int nShift = US_FILTER_PREC*2; 367 366 Int iOffset = 1 << (nShift - 1); 368 367 369 for( j = 0; j < iEHeight; j++ )370 { 371 #if PHASE_DERIVATION_IN_INTEGER 372 iRefPos16 = ((j*iScaleY + iAddY) >> iShiftYM4) - iDeltaY;373 phase = iRefPos16 & 15;374 refPos = iRefPos16 >> 4;368 for( j = 0; j < heightEL; j++ ) 369 { 370 #if PHASE_DERIVATION_IN_INTEGER 371 refPos16 = ((j*scaleY + addY) >> shiftYM4) - deltaY; 372 phase = refPos16 & 15; 373 refPos = refPos16 >> 4; 375 374 coeff = m_lumaFilter[phase]; 376 375 #else … … 381 380 #endif 382 381 383 piSrcY = piTempBufY + (refPos -((NTAPS_US_LUMA>>1) - 1))* iEStride;384 piDstY = piDstBufY + j * iEStride;385 386 for( i = 0; i < iEWidth; i++ )387 { 388 *piDstY = ClipY( (sumLumaVer(piSrcY, coeff, iEStride) + iOffset) >> (nShift));382 piSrcY = piTempBufY + (refPos -((NTAPS_US_LUMA>>1) - 1))*strideEL; 383 piDstY = piDstBufY + j * strideEL; 384 385 for( i = 0; i < widthEL; i++ ) 386 { 387 *piDstY = ClipY( (sumLumaVer(piSrcY, coeff, strideEL) + iOffset) >> (nShift)); 389 388 piSrcY++; 390 389 piDstY++; … … 394 393 //========== UV component upsampling =========== 395 394 396 iEWidth>>= 1;397 iEHeight>>= 1;398 399 iBWidth>>= 1;400 iBHeight>>= 1;401 402 iBStride= pcBasePic->getCStride();403 iEStride= pcUsPic->getCStride();404 405 #if PHASE_DERIVATION_IN_INTEGER 406 iShiftX = 16;407 iShiftY = 16;408 409 iPhaseX = 0;410 iPhaseY = 1;411 412 iAddX = ( ( ( iBWidth * iPhaseX ) << ( iShiftX - 2 ) ) + ( iEWidth >> 1 ) ) / iEWidth + ( 1 << ( iShiftX - 5 ) );413 iAddY = ( ( ( iBHeight * iPhaseY ) << ( iShiftY - 2 ) ) + ( iEHeight >> 1 ) ) / iEHeight+ ( 1 << ( iShiftY - 5 ) );414 415 iDeltaX = 4 * iPhaseX;416 iDeltaY = 4 * iPhaseY;417 418 iShiftXM4 = iShiftX - 4;419 iShiftYM4 = iShiftY - 4;420 421 iScaleX = ( ( iBWidth << iShiftX ) + ( iEWidth >> 1 ) ) / iEWidth;422 iScaleY = ( ( iBHeight << iShiftY ) + ( iEHeight >> 1 ) ) / iEHeight;395 widthEL >>= 1; 396 heightEL >>= 1; 397 398 widthBL >>= 1; 399 heightBL >>= 1; 400 401 strideBL = pcBasePic->getCStride(); 402 strideEL = pcUsPic->getCStride(); 403 404 #if PHASE_DERIVATION_IN_INTEGER 405 shiftX = 16; 406 shiftY = 16; 407 408 phaseX = 0; 409 phaseY = 1; 410 411 addX = ( ( ( widthBL * phaseX ) << ( shiftX - 2 ) ) + ( widthEL >> 1 ) ) / widthEL + ( 1 << ( shiftX - 5 ) ); 412 addY = ( ( ( heightBL * phaseY ) << ( shiftY - 2 ) ) + ( heightEL >> 1 ) ) / heightEL+ ( 1 << ( shiftY - 5 ) ); 413 414 deltaX = 4 * phaseX; 415 deltaY = 4 * phaseY; 416 417 shiftXM4 = shiftX - 4; 418 shiftYM4 = shiftY - 4; 419 420 scaleX = ( ( widthBL << shiftX ) + ( widthEL >> 1 ) ) / widthEL; 421 scaleY = ( ( heightBL << shiftY ) + ( heightEL >> 1 ) ) / heightEL; 423 422 #endif 424 423 425 424 //========== horizontal upsampling =========== 426 for( i = 0; i < iEWidth; i++ )427 { 428 #if PHASE_DERIVATION_IN_INTEGER 429 iRefPos16 = ((i*iScaleX + iAddX) >> iShiftXM4) - iDeltaX;430 phase = iRefPos16 & 15;431 refPos = iRefPos16 >> 4;425 for( i = 0; i < widthEL; i++ ) 426 { 427 #if PHASE_DERIVATION_IN_INTEGER 428 refPos16 = ((i*scaleX + addX) >> shiftXM4) - deltaX; 429 phase = refPos16 & 15; 430 refPos = refPos16 >> 4; 432 431 coeff = m_chromaFilter[phase]; 433 432 #else … … 443 442 piDstV = piTempBufV + i; 444 443 445 for( j = 0; j < iBHeight; j++ )444 for( j = 0; j < heightBL ; j++ ) 446 445 { 447 446 *piDstU = sumChromaHor(piSrcU, coeff); 448 447 *piDstV = sumChromaHor(piSrcV, coeff); 449 448 450 piSrcU += iBStride;451 piSrcV += iBStride;452 piDstU += iEStride;453 piDstV += iEStride;449 piSrcU += strideBL; 450 piSrcV += strideBL; 451 piDstU += strideEL; 452 piDstV += strideEL; 454 453 } 455 454 } … … 457 456 //========== vertical upsampling =========== 458 457 pcTempPic->setBorderExtension(false); 459 pcTempPic->setHeight( iBHeight<< 1);458 pcTempPic->setHeight(heightBL << 1); 460 459 pcTempPic->extendPicBorder (); // extend the border. 461 pcTempPic->setHeight( iEHeight<< 1);462 463 for( j = 0; j < iEHeight; j++ )464 { 465 #if PHASE_DERIVATION_IN_INTEGER 466 iRefPos16 = ((j*iScaleY + iAddY) >> iShiftYM4) - iDeltaY;467 phase = iRefPos16 & 15;468 refPos = iRefPos16 >> 4;460 pcTempPic->setHeight(heightEL << 1); 461 462 for( j = 0; j < heightEL; j++ ) 463 { 464 #if PHASE_DERIVATION_IN_INTEGER 465 refPos16 = ((j*scaleY + addY) >> shiftYM4) - deltaY; 466 phase = refPos16 & 15; 467 refPos = refPos16 >> 4; 469 468 coeff = m_chromaFilter[phase]; 470 469 #else … … 483 482 #endif 484 483 485 piSrcU = piTempBufU + (refPos -((NTAPS_US_CHROMA>>1) - 1))* iEStride;486 piSrcV = piTempBufV + (refPos -((NTAPS_US_CHROMA>>1) - 1))* iEStride;487 488 piDstU = piDstBufU + j* iEStride;489 piDstV = piDstBufV + j* iEStride;490 491 for( i = 0; i < iEWidth; i++ )492 { 493 *piDstU = ClipC( (sumChromaVer(piSrcU, coeff, iEStride) + iOffset) >> (nShift));494 *piDstV = ClipC( (sumChromaVer(piSrcV, coeff, iEStride) + iOffset) >> (nShift));484 piSrcU = piTempBufU + (refPos -((NTAPS_US_CHROMA>>1) - 1))*strideEL; 485 piSrcV = piTempBufV + (refPos -((NTAPS_US_CHROMA>>1) - 1))*strideEL; 486 487 piDstU = piDstBufU + j*strideEL; 488 piDstV = piDstBufV + j*strideEL; 489 490 for( i = 0; i < widthEL; i++ ) 491 { 492 *piDstU = ClipC( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift)); 493 *piDstV = ClipC( (sumChromaVer(piSrcV, coeff, strideEL) + iOffset) >> (nShift)); 495 494 496 495 piSrcU++; … … 521 520 } 522 521 523 iBWidth= pcBasePic->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();524 iBHeight= pcBasePic->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();525 526 iBStride= pcBasePic->getStride();522 widthBL = pcBasePic->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset(); 523 heightBL = pcBasePic->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset(); 524 525 strideBL = pcBasePic->getStride(); 527 526 528 527 if( tempBufSizeRight ) 529 528 { 530 529 piSrcY = tempBufRight; 531 piDstY = piSrcBufY + iBWidth;530 piDstY = piSrcBufY + widthBL; 532 531 533 532 for( i = 0; i < pcBasePic->getHeight(); i++ ) … … 535 534 memcpy(piDstY, piSrcY, sizeof(Pel) * confBL.getWindowRightOffset() ); 536 535 piSrcY += confBL.getWindowRightOffset(); 537 piDstY += iBStride;536 piDstY += strideBL; 538 537 } 539 538 540 539 if(confBL.getWindowRightOffset()>>1) 541 540 { 542 Int iBStrideChroma = (iBStride>>1);541 Int strideBLChroma = (strideBL>>1); 543 542 piSrcU = tempBufRight + confBL.getWindowRightOffset() * pcBasePic->getHeight(); 544 piDstU = piSrcBufU + ( iBWidth>>1);543 piDstU = piSrcBufU + (widthBL>>1); 545 544 piSrcV = piSrcU + (confBL.getWindowRightOffset()>>1) * (pcBasePic->getHeight()>>1); 546 piDstV = piSrcBufV + ( iBWidth>>1);545 piDstV = piSrcBufV + (widthBL>>1); 547 546 548 547 for( i = 0; i < pcBasePic->getHeight()>>1; i++ ) … … 550 549 memcpy(piDstU, piSrcU, sizeof(Pel) * (confBL.getWindowRightOffset()>>1)); 551 550 piSrcU += (confBL.getWindowRightOffset()>>1); 552 piDstU += iBStrideChroma;551 piDstU += strideBLChroma; 553 552 554 553 memcpy(piDstV, piSrcV, sizeof(Pel) * (confBL.getWindowRightOffset()>>1)); 555 554 piSrcV += (confBL.getWindowRightOffset()>>1); 556 piDstV += iBStrideChroma;555 piDstV += strideBLChroma; 557 556 } 558 557 } … … 561 560 if( tempBufSizeBottom ) 562 561 { 563 piDstY = piSrcBufY + iBHeight * iBStride;562 piDstY = piSrcBufY + heightBL * strideBL; 564 563 piSrcY = tempBufBottom; 565 564 for( i = 0; i < confBL.getWindowBottomOffset(); i++ ) 566 565 { 567 566 memcpy(piDstY, piSrcY, sizeof(Pel) * pcBasePic->getWidth()); 568 piDstY += iBStride;567 piDstY += strideBL; 569 568 piSrcY += pcBasePic->getWidth(); 570 569 } … … 572 571 if(confBL.getWindowBottomOffset()>>1) 573 572 { 574 Int iBStrideChroma = (iBStride>>1);573 Int strideBLChroma = (strideBL>>1); 575 574 piSrcU = tempBufBottom + confBL.getWindowBottomOffset() * pcBasePic->getWidth(); 576 piDstU = piSrcBufU + ( iBHeight>>1) * iBStrideChroma;575 piDstU = piSrcBufU + (heightBL>>1) * strideBLChroma; 577 576 piSrcV = piSrcU + (confBL.getWindowBottomOffset()>>1) * (pcBasePic->getWidth()>>1); 578 piDstV = piSrcBufV + ( iBHeight>>1) * iBStrideChroma;577 piDstV = piSrcBufV + (heightBL>>1) * strideBLChroma; 579 578 580 579 for( i = 0; i < confBL.getWindowBottomOffset()>>1; i++ ) … … 582 581 memcpy(piDstU, piSrcU, sizeof(Pel) * (pcBasePic->getWidth()>>1)); 583 582 piSrcU += (pcBasePic->getWidth()>>1); 584 piDstU += iBStrideChroma;583 piDstU += strideBLChroma; 585 584 586 585 memcpy(piDstV, piSrcV, sizeof(Pel) * (pcBasePic->getWidth()>>1)); 587 586 piSrcV += (pcBasePic->getWidth()>>1); 588 piDstV += iBStrideChroma;587 piDstV += strideBLChroma; 589 588 } 590 589 } -
branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncGOP.cpp
r57 r71 514 514 515 515 #if SVC_EXTENSION 516 517 518 519 516 if(m_layerId > 0) 517 { 518 TComList<TComPic*> *cListPic = m_ppcTEncTop[m_layerId-1]->getListPic(); 519 pcSlice->setBaseColPic (*cListPic, m_layerId ); 520 520 #if SVC_UPSAMPLING 521 522 523 524 525 526 527 528 529 530 #endif 531 521 if ( pcPic->isSpatialEnhLayer()) 522 { 523 m_pcPredSearch->upsampleBasePic( pcPic->getFullPelBaseRec(), pcSlice->getBaseColPic()->getPicYuvRec(), pcPic->getPicYuvRec() ); 524 } 525 else 526 { 527 pcPic->setFullPelBaseRec( pcSlice->getBaseColPic()->getPicYuvRec() ); 528 } 529 pcSlice->setFullPelBaseRec ( pcPic->getFullPelBaseRec() ); 530 #endif 531 } 532 532 #endif 533 533 -
branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncTop.cpp
r57 r71 407 407 Void TEncTop::encodePrep( TComPicYuv* pcPicYuvOrg ) 408 408 { 409 if (pcPicYuvOrg) { 409 if (pcPicYuvOrg) 410 { 410 411 // get original YUV 411 412 TComPic* pcPicCurr = NULL; … … 1094 1095 { 1095 1096 for(Int i=0; i<m_iNumRowsMinus1; i++) 1097 { 1096 1098 uiCummulativeRowHeight += m_puiRowHeight[i]; 1099 } 1097 1100 1098 1101 if( uiCummulativeRowHeight >= iHeightInCU )
Note: See TracChangeset for help on using the changeset viewer.