Changeset 1419 in SHVCSoftware for branches/SHM-dev/source/Lib/TLibEncoder


Ignore:
Timestamp:
5 Aug 2015, 03:02:48 (9 years ago)
Author:
seregin
Message:

remove global variables g_mvScalingFactor and g_posScalingFactor, and make them TComPic members

Location:
branches/SHM-dev/source/Lib/TLibEncoder
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/Lib/TLibEncoder/TEnc3DAsymLUT.cpp

    r1297 r1419  
    549549  TComPicYuv *pcRecPicBL = pSlice->getBaseColPic(refLayerIdc)->getPicYuvRec();
    550550  // borders of down-sampled picture
    551   Int leftDS =  (scalEL.getWindowLeftOffset()*g_posScalingFactor[refLayerIdc][0]+(1<<15))>>16;
    552   Int rightDS = pcRecPicBL->getWidth(COMPONENT_Y) - 1 + (((scalEL.getWindowRightOffset())*g_posScalingFactor[refLayerIdc][0]+(1<<15))>>16);
    553   Int topDS = (((scalEL.getWindowTopOffset())*g_posScalingFactor[refLayerIdc][1]+(1<<15))>>16);
    554   Int bottomDS = pcRecPicBL->getHeight(COMPONENT_Y) - 1 + (((scalEL.getWindowBottomOffset())*g_posScalingFactor[refLayerIdc][1]+(1<<15))>>16);
     551  Int leftDS =  (scalEL.getWindowLeftOffset() * pSlice->getPic()->getPosScalingFactor(refLayerIdc, 0)+(1<<15))>>16;
     552  Int rightDS = pcRecPicBL->getWidth(COMPONENT_Y) - 1 + (((scalEL.getWindowRightOffset()) * pSlice->getPic()->getPosScalingFactor(refLayerIdc, 0)+(1<<15))>>16);
     553  Int topDS = (((scalEL.getWindowTopOffset()) * pSlice->getPic()->getPosScalingFactor(refLayerIdc, 1)+(1<<15))>>16);
     554  Int bottomDS = pcRecPicBL->getHeight(COMPONENT_Y) - 1 + (((scalEL.getWindowBottomOffset()) * pSlice->getPic()->getPosScalingFactor(refLayerIdc, 1)+(1<<15))>>16);
    555555  // overlapped region
    556556  Int left = max( 0 , leftDS );
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r1415 r1419  
    17321732    if (m_layerId > 0)
    17331733    {
     1734      if( pcSlice->getSliceIdx() == 0 )
     1735      {
     1736        // create buffers for scaling factors
     1737        pcSlice->getPic()->createMvScalingFactor(pcSlice->getNumILRRefIdx());
     1738        pcSlice->getPic()->createPosScalingFactor(pcSlice->getNumILRRefIdx());
     1739      }
     1740
    17341741      Int interLayerPredLayerIdcTmp[MAX_VPS_LAYER_IDX_PLUS1];
    17351742      Int activeNumILRRefIdxTmp = 0;
     
    17731780             && ( (heightEL != heightBL) || (resamplingPhase.phaseVerLuma == 0 && resamplingPhase.phaseVerChroma == 0) ) );
    17741781
    1775         g_mvScalingFactor[refLayerIdc][0] = widthEL  == widthBL  ? 4096 : Clip3(-4096, 4095, ((widthEL  << 8) + (widthBL  >> 1)) / widthBL);
    1776         g_mvScalingFactor[refLayerIdc][1] = heightEL == heightBL ? 4096 : Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL);
    1777 
    1778         g_posScalingFactor[refLayerIdc][0] = ((widthBL  << 16) + (widthEL  >> 1)) / widthEL;
    1779         g_posScalingFactor[refLayerIdc][1] = ((heightBL << 16) + (heightEL >> 1)) / heightEL;
     1782        pcSlice->getPic()->setMvScalingFactor( refLayerIdc,
     1783                                               widthEL  == widthBL  ? 4096 : Clip3(-4096, 4095, ((widthEL  << 8) + (widthBL  >> 1)) / widthBL),
     1784                                               heightEL == heightBL ? 4096 : Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL) );
     1785
     1786        pcSlice->getPic()->setPosScalingFactor( refLayerIdc,
     1787                                                ((widthBL  << 16) + (widthEL  >> 1)) / widthEL,
     1788                                                ((heightBL << 16) + (heightEL >> 1)) / heightEL );
    17801789
    17811790#if CGS_3D_ASYMLUT
     
    17871796          m_Enc3DAsymLUTPicUpdate.addRefLayerId( pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc) );
    17881797
    1789           if( g_posScalingFactor[refLayerIdc][0] < (1<<16) || g_posScalingFactor[refLayerIdc][1] < (1<<16) ) //if(pcPic->isSpatialEnhLayer(refLayerIdc))
     1798          if( pcSlice->getPic()->getMvScalingFactor(refLayerIdc, 0) < (1<<16) || pcSlice->getPic()->getMvScalingFactor(refLayerIdc, 1) < (1<<16) ) //if(pcPic->isSpatialEnhLayer(refLayerIdc))
    17901799          {
    17911800            //downsampling
    1792             downScalePic(pcPic->getPicYuvOrg(), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvOrg(), pcSlice->getBitDepths());
     1801            downScalePic(pcPic->getPicYuvOrg(), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvOrg(), pcSlice->getBitDepths(), pcPic->getPosScalingFactor());
    17931802           
    17941803            m_Enc3DAsymLUTPPS.setDsOrigPic(pcSlice->getBaseColPic(refLayerIdc)->getPicYuvOrg());
     
    32973306        UInt refLayerId = pcSlice->getRefPic(RefPicList(iRefList), iRefIndex)->getLayerId();
    32983307        UInt refLayerIdc = pcSlice->getReferenceLayerIdc(refLayerId);
    3299         assert( g_posScalingFactor[refLayerIdc][0] );
    3300         assert( g_posScalingFactor[refLayerIdc][1] );
    3301 
    3302         printf( "%d(%d, {%1.2f, %1.2f}x)", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex), refLayerId, 65536.0/g_posScalingFactor[refLayerIdc][0], 65536.0/g_posScalingFactor[refLayerIdc][1] );
     3308        assert( pcSlice->getPic()->getPosScalingFactor(refLayerIdc, 0) );
     3309        assert( pcSlice->getPic()->getPosScalingFactor(refLayerIdc, 1) );
     3310
     3311        printf( "%d(%d, {%1.2f, %1.2f}x)", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex), refLayerId, 65536.0/pcSlice->getPic()->getPosScalingFactor(refLayerIdc, 0), 65536.0/pcSlice->getPic()->getPosScalingFactor(refLayerIdc, 1) );
    33033312      }
    33043313      else
     
    41784187}
    41794188
    4180 Void TEncGOP::downScalePic( TComPicYuv* pcYuvSrc, TComPicYuv* pcYuvDest, BitDepths& bitDepth)
     4189Void TEncGOP::downScalePic( TComPicYuv* pcYuvSrc, TComPicYuv* pcYuvDest, BitDepths& bitDepth, Int** posScalingFactor)
    41814190{
    41824191  pcYuvSrc->setBorderExtension(false);
    4183   pcYuvSrc->extendPicBorder   (); // extend the border.
     4192  pcYuvSrc->extendPicBorder(); // extend the border.
    41844193  pcYuvSrc->setBorderExtension(false);
    41854194
     
    41894198  if(!m_temp)
    41904199  {
    4191     initDs(iWidth, iHeight, m_pcCfg->getIntraPeriod()>1);
     4200    initDs(iWidth, iHeight, m_pcCfg->getIntraPeriod()>1, posScalingFactor);
    41924201  }
    41934202
     
    43134322}
    43144323
    4315 Void TEncGOP::initDs(Int iWidth, Int iHeight, Int iType)
     4324Void TEncGOP::initDs(Int iWidth, Int iHeight, Int iType, Int** posScalingFactor)
    43164325{
    43174326  m_iTap = 13;
    4318   if(g_posScalingFactor[0][0] == (1<<15))
     4327  if(posScalingFactor[0][0] == (1<<15))
    43194328  {
    43204329    m_iM = 4;
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.h

    r1415 r1419  
    287287#if CGS_3D_ASYMLUT
    288288  Void xDetermin3DAsymLUT( TComSlice * pSlice , TComPic * pCurPic , UInt refLayerIdc , TEncCfg * pCfg , Bool bSignalPPS );
    289   Void downScalePic( TComPicYuv* pcYuvSrc, TComPicYuv* pcYuvDest, BitDepths& bitDepth);
     289  Void downScalePic( TComPicYuv* pcYuvSrc, TComPicYuv* pcYuvDest, BitDepths& bitDepth, Int** posScalingFactor);
    290290  Void downScaleComponent2x2( const Pel* pSrc, Pel* pDest, const Int iSrcStride, const Int iDestStride, const Int iSrcWidth, const Int iSrcHeight, const Int inputBitDepth, const Int outputBitDepth );
    291291  inline Short xClip( Short x , Int bitdepth );
    292   Void initDs(Int iWidth, Int iHeight, Int iType);
     292  Void initDs(Int iWidth, Int iHeight, Int iType, Int** posScalingFactor);
    293293  Void filterImg( Pel *src, Int iSrcStride, Pel *dst, Int iDstStride, Int height1, Int width1, BitDepths& bitDepth, Int plane );
    294294
Note: See TracChangeset for help on using the changeset viewer.