Changeset 71 in SHVCSoftware for branches


Ignore:
Timestamp:
8 Mar 2013, 01:22:04 (12 years ago)
Author:
seregin
Message:

formating the code, lossless

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  
    41234123
    41244124#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();
    41304130#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)
    41394139  {
    41404140    uiAbsPartIdxBase = uiCuAbsPartIdx + m_uiAbsIdxInLCU;
     
    41504150    Int iEY = m_uiCUPelY + uiMinUnitSize*(uiRasterAddr/uiNumPartInCUWidth);
    41514151
    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;
    41544154
    41554155    uiCUAddrBase = (iBY/g_uiMaxCUHeight)*cBaseColPic->getFrameWidthInCU() + (iBX/g_uiMaxCUWidth);
     
    41754175  const Window &confEL = m_pcPic->getPicYuvRec()->getConformanceWindow();
    41764176
    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();
    41824182#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();
    41884188#endif
    41894189
     
    41934193  UInt uiMinUnitSize = m_pcPic->getMinCUWidth();
    41944194
    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;
    41974197
    41984198  if ( iBX >= cBaseColPic->getPicYuvRec()->getWidth() || iBY >= cBaseColPic->getPicYuvRec()->getHeight())
     
    42024202
    42034203#if AVC_SYNTAX
    4204   if( iBX >= iBWidth || iBY >= iBHeight ) //outside of the reference layer cropped picture
     4204  if( iBX >= widthBL || iBY >= heightBL ) //outside of the reference layer cropped picture
    42054205  {
    42064206    return NULL;
     
    42294229  const Window &confEL = m_pcPic->getPicYuvRec()->getConformanceWindow();
    42304230
    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();
    42364236#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;
    42464246
    42474247  cMv.set(iMvX, iMvY);
  • branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComPic.cpp

    r67 r71  
    589589#if REF_IDX_MFM
    590590#if !REUSE_BLKMAPPING
    591 Void TComPic::deriveUnitIdxBase( UInt uiUpsamplePelX, UInt uiUpsamplePelY, UInt ratio, UInt& uiBaseCUAddr, UInt& uiBaseAbsPartIdx )
     591Void TComPic::deriveUnitIdxBase( UInt upsamplePelX, UInt upsamplePelY, UInt ratio, UInt& baseCUAddr, UInt& baseAbsPartIdx )
    592592{
    593593  //pixel in the base layer
    594594
    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();
    599599 
    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;
    601601
    602602#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);
    605605#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);
    610610#endif
    611611 
    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);
    616616 
    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];
    622622
    623623  return;
     
    631631  const Window &confEL = getPicYuvRec()->getConformanceWindow();
    632632
    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();
    638638#endif
    639639 
    640640#if !REUSE_MVSCALE  || !REUSE_BLKMAPPING
    641641  UInt upSampleRatio = 0;
    642   if(iEWidth == iBWidth && iEHeight == iBHeight)
     642  if(widthEL == widthBL && heightEL == heightBL)
    643643  {
    644644    upSampleRatio = 2;
    645645  }
    646   else if(2*iEWidth == 3*iBWidth && 2*iEHeight == 3*iBHeight)
     646  else if(2*widthEL == 3*widthBL && 2*heightEL == 3*heightBL)
    647647  {
    648648    upSampleRatio = 3;
    649649  }
    650   else if(iEWidth == 2*iBWidth && iEHeight == 2*iBHeight)
     650  else if(widthEL == 2*widthBL && heightEL == 2*heightBL)
    651651  {
    652652    upSampleRatio = 4;
     
    658658#endif
    659659
    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)) );
    664664
    665665  for(UInt cuIdx = 0; cuIdx < getPicSym()->getNumberOfCUsInFrame(); cuIdx++)  //each LCU
     
    667667    TComDataCU*             pcCUDes = getCU(cuIdx);
    668668
    669     for(UInt uiAbsPartIdx = 0; uiAbsPartIdx < uiNumPartitions; uiAbsPartIdx+=unitNum )  //each 16x16 unit
     669    for(UInt absPartIdx = 0; absPartIdx < numPartitions; absPartIdx+=unitNum )  //each 16x16 unit
    670670    {
    671671      //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;
    675675
    676676#if REUSE_BLKMAPPING
    677677      TComDataCU *pcColCU = 0;
    678       pcColCU = pcCUDes->getBaseColCU(uiPelX + 8, uiPelY + 8, uiBaseCUAddr, uiBaseAbsPartIdx);
     678      pcColCU = pcCUDes->getBaseColCU(pelX + 8, pelY + 8, baseCUAddr, baseAbsPartIdx);
    679679#else
    680       pcPicBase->deriveUnitIdxBase(uiPelX + 8, uiPelY + 8, upSampleRatio, uiBaseCUAddr, uiBaseAbsPartIdx);
     680      pcPicBase->deriveUnitIdxBase(pelX + 8, pelY + 8, upSampleRatio, baseCUAddr, baseAbsPartIdx);
    681681#endif
    682682
    683683#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;
    686686
    687687#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 mode
     688      if( ( xBL < widthBL && yBL < heightBL ) && pcColCU && (pcColCU->getPredictionMode(baseAbsPartIdx) != MODE_NONE) && (pcColCU->getPredictionMode(baseAbsPartIdx) != MODE_INTRA) )  //base layer unit not skip and invalid mode
    689689#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 mode
     690      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
    691691#endif
    692692#else
    693693#if REUSE_BLKMAPPING
    694       if( pcColCU && (pcColCU->getPredictionMode(uiBaseAbsPartIdx) != MODE_NONE) && (pcColCU->getPredictionMode(uiBaseAbsPartIdx) != MODE_INTRA) )  //base layer unit not skip and invalid mode
     694      if( pcColCU && (pcColCU->getPredictionMode(baseAbsPartIdx) != MODE_NONE) && (pcColCU->getPredictionMode(baseAbsPartIdx) != MODE_INTRA) )  //base layer unit not skip and invalid mode
    695695#else
    696       if( (pcPicBase->getCU(uiBaseCUAddr)->getPredictionMode(uiBaseAbsPartIdx) != MODE_NONE) && (pcPicBase->getCU(uiBaseCUAddr)->getPredictionMode(uiBaseAbsPartIdx) != MODE_INTRA) )  //base layer unit not skip and invalid mode
     696      if( (pcPicBase->getCU(baseCUAddr)->getPredictionMode(baseAbsPartIdx) != MODE_NONE) && (pcPicBase->getCU(baseCUAddr)->getPredictionMode(baseAbsPartIdx) != MODE_INTRA) )  //base layer unit not skip and invalid mode
    697697#endif
    698698#endif
     
    703703          TComMvField sMvFieldBase, sMvField;
    704704#if REUSE_BLKMAPPING
    705           pcColCU->getMvField( pcColCU, uiBaseAbsPartIdx, (RefPicList)refPicList, sMvFieldBase);
     705          pcColCU->getMvField( pcColCU, baseAbsPartIdx, (RefPicList)refPicList, sMvFieldBase);
    706706#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);
    708708#endif
    709709          pcCUDes->scaleBaseMV( sMvField, sMvFieldBase );
    710710#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);
    718718          TComMvField sMvField;
    719719          sMvField.setMvField(cScaledMv, refIdx);
    720720#endif
    721721
    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);
    724724        }
    725725      }
     
    727727      {
    728728        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);
    732732      }
    733733
    734734      for(UInt i = 1; i < unitNum; i++ ) 
    735735      {
    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);
    742742  }
    743743}
     
    755755
    756756  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;
    768768   
    769769  filestream->seekg( uiPos, ios_base::beg );
    770770
    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];
    781781     
    782       TComDataCU* pcCU = this->getCU( uiLCUAddr );
     782      TComDataCU* pcCU = this->getCU( addrLCU );
    783783     
    784784      TComMv mv;
     
    789789      filestream->read( &refIdxL0, 1 );
    790790      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 );
    792792
    793793      // RefIdxL1
     
    795795      filestream->read( &refIdxL1, 1 );
    796796      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 );
    798798
    799799      // MV L0
     
    804804      filestream->read( reinterpret_cast<char*>(&temp), 2 );
    805805      mv.setVer( (Short)temp );
    806       pcCU->getCUMvField( REF_PIC_LIST_0 )->setMv( mv, uiPartAddr );
     806      pcCU->getCUMvField( REF_PIC_LIST_0 )->setMv( mv, partAddr );
    807807
    808808      // MV L1
     
    813813      filestream->read( reinterpret_cast<char*>(&temp), 2 );
    814814      mv.setVer( (Short)temp );
    815       pcCU->getCUMvField( REF_PIC_LIST_1 )->setMv( mv, uiPartAddr );
     815      pcCU->getCUMvField( REF_PIC_LIST_1 )->setMv( mv, partAddr );
    816816
    817817      // 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 );     
    822822    }
    823823  }
     
    833833  }
    834834
    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 );
    846848   
    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];
    857859     
    858       TComDataCU* pcCU = this->getCU( uiLCUAddr );
     860      TComDataCU* pcCU = this->getCU( addrLCU );
    859861     
    860862      TComMv mv;
     
    863865
    864866      // 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 );
    869871      }
    870872      assert( refIdxL0 >= - 1 && refIdxL1 >= - 1 );
     
    876878      if( refIdxL0 >= 0 )
    877879      {
    878         mv = pcCU->getCUMvField( REF_PIC_LIST_0 )->getMv( uiPartAddr );
     880        mv = pcCU->getCUMvField( REF_PIC_LIST_0 )->getMv( partAddr );
    879881      }
    880882      temp = (Short)mv.getHor();
     
    887889      if( refIdxL1 >= 0 )
    888890      {
    889         mv = pcCU->getCUMvField( REF_PIC_LIST_1 )->getMv( uiPartAddr );
     891        mv = pcCU->getCUMvField( REF_PIC_LIST_1 )->getMv( partAddr );
    890892      }
    891893      temp = (Short)mv.getHor();
  • branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComPic.h

    r54 r71  
    134134  Void          copyUpsampledMvField  (  TComPic* pcPicBase );
    135135#if !REUSE_BLKMAPPING
    136   Void          deriveUnitIdxBase     (  UInt uiUpsamplePelX, UInt uiUpsamplePelY, UInt ratio, UInt& uiBaseCUAddr, UInt& uiBaseAbsPartIdx );
     136  Void          deriveUnitIdxBase     (  UInt upsamplePelX, UInt upsamplePelY, UInt ratio, UInt& baseCUAddr, UInt& baseAbsPartIdx );
    137137#endif
    138138#endif
  • branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComSlice.cpp

    r69 r71  
    20662066      // should be set if the base layer has its own instance of the reference picture lists, currently EL RPL is reused.
    20672067      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() );     
    20702069      */
    20712070
  • branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComUpsampleFilter.cpp

    r56 r71  
    139139  const Window &confEL = pcUsPic->getConformanceWindow();
    140140
    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();
    148148 
    149149  Pel* piTempBufY = pcTempPic->getLumaAddr();
     
    196196 
    197197#if PHASE_DERIVATION_IN_INTEGER
    198   Int iRefPos16 = 0;
     198  Int refPos16 = 0;
    199199  Int phase    = 0;
    200200  Int refPos   = 0;
     
    212212
    213213  Int chromaPhaseDenominator;
    214   if (iEWidth == 2*iBWidth) // 2x scalability
     214  if (widthEL == 2*widthBL) // 2x scalability
    215215  {
    216216    for ( i = 0; i < 8; i++)
     
    230230#endif
    231231
    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 );
    234234
    235235#if JCTVC_L0178
     
    237237  if( tempBufSizeRight )
    238238  {
    239     piSrcY = piSrcBufY + iBWidth;
     239    piSrcY = piSrcBufY + widthBL;
    240240    piDstY = tempBufRight;
    241241    for( i = 0; i < pcBasePic->getHeight(); i++ )
    242242    {
    243243      memcpy(piDstY, piSrcY, sizeof(Pel) * confBL.getWindowRightOffset());
    244       piSrcY += iBStride;
     244      piSrcY += strideBL;
    245245      piDstY += confBL.getWindowRightOffset();
    246246    }
     
    248248    if(confBL.getWindowRightOffset()>>1)
    249249    {
    250       Int iBStrideChroma = (iBStride>>1);
    251       piSrcU = piSrcBufU + (iBWidth>>1);
     250      Int strideBLChroma = (strideBL>>1);
     251      piSrcU = piSrcBufU + (widthBL>>1);
    252252      piDstU = tempBufRight + confBL.getWindowRightOffset() * pcBasePic->getHeight();
    253       piSrcV = piSrcBufV + (iBWidth>>1);
     253      piSrcV = piSrcBufV + (widthBL>>1);
    254254      piDstV = piDstU + (confBL.getWindowRightOffset()>>1) * (pcBasePic->getHeight()>>1);
    255255   
     
    257257      {
    258258        memcpy(piDstU, piSrcU, sizeof(Pel) * (confBL.getWindowRightOffset()>>1));
    259         piSrcU += iBStrideChroma;
     259        piSrcU += strideBLChroma;
    260260        piDstU += (confBL.getWindowRightOffset()>>1);
    261261       
    262262        memcpy(piDstV, piSrcV, sizeof(Pel) * (confBL.getWindowRightOffset()>>1));
    263         piSrcV += iBStrideChroma;
     263        piSrcV += strideBLChroma;
    264264        piDstV += (confBL.getWindowRightOffset()>>1);
    265265      }
    266266    }
    267267   
    268     pcBasePic->setWidth(iBWidth);
     268    pcBasePic->setWidth(widthBL);
    269269  }
    270270 
    271271  if( tempBufSizeBottom )
    272272  {
    273     piSrcY = piSrcBufY + iBHeight * iBStride;
     273    piSrcY = piSrcBufY + heightBL * strideBL;
    274274    piDstY = tempBufBottom;
    275275    for( i = 0; i < confBL.getWindowBottomOffset(); i++ )
    276276    {
    277277      memcpy(piDstY, piSrcY, sizeof(Pel) * pcBasePic->getWidth());
    278       piSrcY += iBStride;
     278      piSrcY += strideBL;
    279279      piDstY += pcBasePic->getWidth();
    280280    }
     
    282282    if(confBL.getWindowBottomOffset()>>1)
    283283    {
    284       Int iBStrideChroma = (iBStride>>1);
    285       piSrcU = piSrcBufU + (iBHeight>>1) * iBStrideChroma;
     284      Int strideBLChroma = (strideBL>>1);
     285      piSrcU = piSrcBufU + (heightBL>>1) * strideBLChroma;
    286286      piDstU = tempBufBottom + confBL.getWindowBottomOffset() * pcBasePic->getWidth();
    287       piSrcV = piSrcBufV + (iBHeight>>1) * iBStrideChroma;
     287      piSrcV = piSrcBufV + (heightBL>>1) * strideBLChroma;
    288288      piDstV = piDstU + (confBL.getWindowBottomOffset()>>1) * (pcBasePic->getWidth()>>1);
    289289     
     
    291291      {
    292292        memcpy(piDstU, piSrcU, sizeof(Pel) * (pcBasePic->getWidth()>>1));
    293         piSrcU += iBStrideChroma;
     293        piSrcU += strideBLChroma;
    294294        piDstU += (pcBasePic->getWidth()>>1);
    295295       
    296296        memcpy(piDstV, piSrcV, sizeof(Pel) * (pcBasePic->getWidth()>>1));
    297         piSrcV += iBStrideChroma;
     297        piSrcV += strideBLChroma;
    298298        piDstV += (pcBasePic->getWidth()>>1);
    299299      }
    300300    }
    301301
    302     pcBasePic->setHeight(iBHeight);
     302    pcBasePic->setHeight(heightBL);
    303303  }
    304304#endif
     
    308308
    309309#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;
    330329  const Double sFactor12 = sFactor * 12;
    331330#endif
    332331
    333332  //========== 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;
    340339    coeff = m_lumaFilter[phase];
    341340#else
     
    349348    piDstY = piTempBufY + i;
    350349
    351     for( j = 0; j < iBHeight ; j++ )
     350    for( j = 0; j < heightBL ; j++ )
    352351    {
    353352      *piDstY = sumLumaHor(piSrcY, coeff);
    354       piSrcY += iBStride;
    355       piDstY += iEStride;
     353      piSrcY += strideBL;
     354      piDstY += strideEL;
    356355    }
    357356  }
     
    360359  //========== vertical upsampling ===========
    361360  pcTempPic->setBorderExtension(false);
    362   pcTempPic->setHeight(iBHeight);
     361  pcTempPic->setHeight(heightBL);
    363362  pcTempPic->extendPicBorder   (); // extend the border.
    364   pcTempPic->setHeight(iEHeight);
     363  pcTempPic->setHeight(heightEL);
    365364
    366365  const Int nShift = US_FILTER_PREC*2;
    367366  Int iOffset = 1 << (nShift - 1);
    368367
    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;
    375374    coeff = m_lumaFilter[phase];
    376375#else
     
    381380#endif
    382381
    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));
    389388      piSrcY++;
    390389      piDstY++;
     
    394393  //========== UV component upsampling ===========
    395394
    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;
    423422#endif
    424423
    425424  //========== 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;
    432431    coeff = m_chromaFilter[phase];
    433432#else
     
    443442    piDstV = piTempBufV + i;
    444443
    445     for( j = 0; j < iBHeight ; j++ )
     444    for( j = 0; j < heightBL ; j++ )
    446445    {
    447446      *piDstU = sumChromaHor(piSrcU, coeff);
    448447      *piDstV = sumChromaHor(piSrcV, coeff);
    449448
    450       piSrcU += iBStride;
    451       piSrcV += iBStride;
    452       piDstU += iEStride;
    453       piDstV += iEStride;
     449      piSrcU += strideBL;
     450      piSrcV += strideBL;
     451      piDstU += strideEL;
     452      piDstV += strideEL;
    454453    }
    455454  }
     
    457456  //========== vertical upsampling ===========
    458457  pcTempPic->setBorderExtension(false);
    459   pcTempPic->setHeight(iBHeight << 1);
     458  pcTempPic->setHeight(heightBL << 1);
    460459  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;
    469468    coeff = m_chromaFilter[phase];
    470469#else
     
    483482#endif
    484483
    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));
    495494
    496495      piSrcU++;
     
    521520  }
    522521 
    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();
    527526 
    528527  if( tempBufSizeRight )
    529528  {
    530529    piSrcY = tempBufRight;
    531     piDstY = piSrcBufY + iBWidth;
     530    piDstY = piSrcBufY + widthBL;
    532531   
    533532    for( i = 0; i < pcBasePic->getHeight(); i++ )
     
    535534      memcpy(piDstY, piSrcY, sizeof(Pel) * confBL.getWindowRightOffset() );
    536535      piSrcY += confBL.getWindowRightOffset();
    537       piDstY += iBStride;
     536      piDstY += strideBL;
    538537    }
    539538   
    540539    if(confBL.getWindowRightOffset()>>1)
    541540    {
    542       Int iBStrideChroma = (iBStride>>1);
     541      Int strideBLChroma = (strideBL>>1);
    543542      piSrcU = tempBufRight + confBL.getWindowRightOffset() * pcBasePic->getHeight();
    544       piDstU = piSrcBufU + (iBWidth>>1);
     543      piDstU = piSrcBufU + (widthBL>>1);
    545544      piSrcV = piSrcU + (confBL.getWindowRightOffset()>>1) * (pcBasePic->getHeight()>>1);
    546       piDstV = piSrcBufV + (iBWidth>>1);
     545      piDstV = piSrcBufV + (widthBL>>1);
    547546
    548547      for( i = 0; i < pcBasePic->getHeight()>>1; i++ )
     
    550549        memcpy(piDstU, piSrcU, sizeof(Pel) * (confBL.getWindowRightOffset()>>1));
    551550        piSrcU += (confBL.getWindowRightOffset()>>1);
    552         piDstU += iBStrideChroma;
     551        piDstU += strideBLChroma;
    553552       
    554553        memcpy(piDstV, piSrcV, sizeof(Pel) * (confBL.getWindowRightOffset()>>1));
    555554        piSrcV += (confBL.getWindowRightOffset()>>1);
    556         piDstV += iBStrideChroma;
     555        piDstV += strideBLChroma;
    557556      }
    558557    }
     
    561560  if( tempBufSizeBottom )
    562561  {
    563     piDstY = piSrcBufY + iBHeight * iBStride;
     562    piDstY = piSrcBufY + heightBL * strideBL;
    564563    piSrcY = tempBufBottom;
    565564    for( i = 0; i < confBL.getWindowBottomOffset(); i++ )
    566565    {
    567566      memcpy(piDstY, piSrcY, sizeof(Pel) * pcBasePic->getWidth());
    568       piDstY += iBStride;
     567      piDstY += strideBL;
    569568      piSrcY += pcBasePic->getWidth();
    570569    }
     
    572571    if(confBL.getWindowBottomOffset()>>1)
    573572    {
    574       Int iBStrideChroma = (iBStride>>1);
     573      Int strideBLChroma = (strideBL>>1);
    575574      piSrcU = tempBufBottom + confBL.getWindowBottomOffset() * pcBasePic->getWidth();
    576       piDstU = piSrcBufU + (iBHeight>>1) * iBStrideChroma;
     575      piDstU = piSrcBufU + (heightBL>>1) * strideBLChroma;
    577576      piSrcV = piSrcU + (confBL.getWindowBottomOffset()>>1) * (pcBasePic->getWidth()>>1);
    578       piDstV = piSrcBufV + (iBHeight>>1) * iBStrideChroma;
     577      piDstV = piSrcBufV + (heightBL>>1) * strideBLChroma;
    579578           
    580579      for( i = 0; i < confBL.getWindowBottomOffset()>>1; i++ )
     
    582581        memcpy(piDstU, piSrcU, sizeof(Pel) * (pcBasePic->getWidth()>>1));
    583582        piSrcU += (pcBasePic->getWidth()>>1);
    584         piDstU += iBStrideChroma;
     583        piDstU += strideBLChroma;
    585584       
    586585        memcpy(piDstV, piSrcV, sizeof(Pel) * (pcBasePic->getWidth()>>1));
    587586        piSrcV += (pcBasePic->getWidth()>>1);
    588         piDstV += iBStrideChroma;
     587        piDstV += strideBLChroma;
    589588      }
    590589    }
  • branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncGOP.cpp

    r57 r71  
    514514
    515515#if SVC_EXTENSION     
    516       if(m_layerId > 0)
    517       {
    518         TComList<TComPic*> *cListPic = m_ppcTEncTop[m_layerId-1]->getListPic();
    519         pcSlice->setBaseColPic (*cListPic, m_layerId );
     516    if(m_layerId > 0)
     517    {
     518      TComList<TComPic*> *cListPic = m_ppcTEncTop[m_layerId-1]->getListPic();
     519      pcSlice->setBaseColPic (*cListPic, m_layerId );
    520520#if SVC_UPSAMPLING
    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       }
     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    }
    532532#endif
    533533
  • branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncTop.cpp

    r57 r71  
    407407Void TEncTop::encodePrep( TComPicYuv* pcPicYuvOrg )
    408408{
    409   if (pcPicYuvOrg) {
     409  if (pcPicYuvOrg)
     410  {
    410411    // get original YUV
    411412    TComPic* pcPicCurr = NULL;
     
    10941095  {
    10951096    for(Int i=0; i<m_iNumRowsMinus1; i++)
     1097    {
    10961098      uiCummulativeRowHeight += m_puiRowHeight[i];
     1099    }
    10971100
    10981101    if( uiCummulativeRowHeight >= iHeightInCU )
Note: See TracChangeset for help on using the changeset viewer.