Changeset 137 in SHVCSoftware for branches/SHM-2.0-dev/source


Ignore:
Timestamp:
2 May 2013, 08:47:06 (12 years ago)
Author:
mediatek
Message:

M0133/M0449: inter-layer MV scaling and pixel mapping position calculation
Author: Peter Chuang <peter.chuang@…>

Location:
branches/SHM-2.0-dev/source/Lib
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-2.0-dev/source/Lib/TLibCommon/TComDataCU.cpp

    r136 r137  
    41754175  TComPic* cBaseColPic = m_pcSlice->getBaseColPic();
    41764176
     4177#if !SIMPLIFIED_MV_POS_SCALING
    41774178#if SVC_UPSAMPLING
    41784179  const Window &confBL = cBaseColPic->getPicYuvRec()->getConformanceWindow();
     
    41914192  Int heightEL  = m_pcPic->getPicYuvRec()->getHeight();
    41924193#endif
     4194#endif
    41934195
    41944196  uiPelX = (UInt)Clip3<UInt>(0, m_pcPic->getPicYuvRec()->getWidth() - 1, uiPelX);
     
    41974199  UInt uiMinUnitSize = m_pcPic->getMinCUWidth();
    41984200
     4201#if SIMPLIFIED_MV_POS_SCALING
     4202  Int iBX = (uiPelX*g_posScalingFactor[m_layerId][0] + (1<<15)) >> 16;
     4203  Int iBY = (uiPelY*g_posScalingFactor[m_layerId][1] + (1<<15)) >> 16;
     4204#else
    41994205  Int iBX = (uiPelX*widthBL + widthEL/2)/widthEL;
    42004206  Int iBY = (uiPelY*heightBL+ heightEL/2)/heightEL;
     4207#endif
    42014208
    42024209  if ( iBX >= cBaseColPic->getPicYuvRec()->getWidth() || iBY >= cBaseColPic->getPicYuvRec()->getHeight())
     
    42284235  TComMvField cMvFieldBase;
    42294236  TComMv cMv;
    4230 
     4237#if SIMPLIFIED_MV_POS_SCALING
     4238  cMv = rcMvFieldBase.getMv().scaleMv( g_mvScalingFactor[m_layerId][0], g_mvScalingFactor[m_layerId][1] );
     4239#else
    42314240#if MV_SCALING_FIX
    42324241  const Window &confBL = m_pcSlice->getBaseColPic()->getPicYuvRec()->getConformanceWindow();
     
    42504259
    42514260  cMv.set(iMvX, iMvY);
     4261#endif
    42524262
    42534263  rcMvFieldEnhance.setMvField( cMv, rcMvFieldBase.getRefIdx() );
  • branches/SHM-2.0-dev/source/Lib/TLibCommon/TComMv.h

    r125 r137  
    149149    return TComMv( mvx, mvy );
    150150  }
     151#if SIMPLIFIED_MV_POS_SCALING
     152  const TComMv scaleMv( Int iScaleX, Int iScaleY ) const
     153  {
     154    Int mvx = Clip3( -32768, 32767, (iScaleX * getHor() + 127 + (iScaleX * getHor() < 0)) >> 8 );
     155    Int mvy = Clip3( -32768, 32767, (iScaleY * getVer() + 127 + (iScaleY * getVer() < 0)) >> 8 );
     156    return TComMv( mvx, mvy );
     157  }
     158#endif
    151159};// END CLASS DEFINITION TComMV
    152160
  • branches/SHM-2.0-dev/source/Lib/TLibCommon/TComRom.cpp

    r133 r137  
    518518Int  g_eTTable[4] = {0,3,1,2};
    519519
     520#if SIMPLIFIED_MV_POS_SCALING
     521Int g_mvScalingFactor  [MAX_LAYERS][2] = {{0,0}, {0,0}};
     522Int g_posScalingFactor [MAX_LAYERS][2] = {{0,0}, {0,0}};
     523#endif
     524
    520525//! \}
  • branches/SHM-2.0-dev/source/Lib/TLibCommon/TComRom.h

    r125 r137  
    273273extern UInt g_scalingListNum  [SCALING_LIST_SIZE_NUM];
    274274extern Int  g_eTTable[4];
     275
     276#if SIMPLIFIED_MV_POS_SCALING
     277extern Int g_mvScalingFactor  [MAX_LAYERS][2];
     278extern Int g_posScalingFactor [MAX_LAYERS][2];
     279#endif
     280
    275281//! \}
    276282
  • branches/SHM-2.0-dev/source/Lib/TLibCommon/TypeDef.h

    r136 r137  
    6464#define MV_SCALING_FIX                   1      ///< fixing the base layer MV scaling
    6565#define MV_SCALING_POS_FIX               1      ///< use center pixels to get co-located base layer block
     66#define SIMPLIFIED_MV_POS_SCALING        1      ///< M0133/M0449: inter-layer MV scaling and pixel mapping position calculation
    6667#define MFM_CLIPPING_FIX                 1      ///< set the right picture size for the clipping
    6768
  • branches/SHM-2.0-dev/source/Lib/TLibDecoder/TDecTop.cpp

    r134 r137  
    922922  }
    923923
     924#if SIMPLIFIED_MV_POS_SCALING
     925  if (m_layerId > 0)
     926  {
     927    const Window &confBL = pcSlice->getBaseColPic()->getPicYuvRec()->getConformanceWindow();
     928    const Window &confEL = pcPic->getPicYuvRec()->getConformanceWindow();
     929
     930    Int widthBL   = pcSlice->getBaseColPic()->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();
     931    Int heightBL  = pcSlice->getBaseColPic()->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();
     932
     933    Int widthEL   = pcPic->getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset();
     934    Int heightEL  = pcPic->getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset();
     935
     936    g_mvScalingFactor[m_layerId][0] = Clip3(-4096, 4095, ((widthEL  << 8) + (widthBL  >> 1)) / widthBL);
     937    g_mvScalingFactor[m_layerId][1] = Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL);
     938
     939    g_posScalingFactor[m_layerId][0] = ((widthBL  << 16) + (widthEL  >> 1)) / widthEL;
     940    g_posScalingFactor[m_layerId][1] = ((heightBL << 16) + (heightEL >> 1)) / heightEL;
     941  }
     942#endif
     943
    924944  //  Decode a picture
    925945  m_cGopDecoder.decompressSlice(nalu.m_Bitstream, pcPic);
  • branches/SHM-2.0-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r134 r137  
    970970
    971971    UInt uiNumSlices = 1;
     972
     973#if SIMPLIFIED_MV_POS_SCALING
     974    if (m_layerId > 0)
     975    {
     976      const Window &confBL = pcSlice->getBaseColPic()->getPicYuvRec()->getConformanceWindow();
     977      const Window &confEL = pcPic->getPicYuvRec()->getConformanceWindow();
     978
     979      Int widthBL   = pcSlice->getBaseColPic()->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();
     980      Int heightBL  = pcSlice->getBaseColPic()->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();
     981
     982      Int widthEL   = pcPic->getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset();
     983      Int heightEL  = pcPic->getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset();
     984
     985      g_mvScalingFactor[m_layerId][0] = Clip3(-4096, 4095, ((widthEL  << 8) + (widthBL  >> 1)) / widthBL);
     986      g_mvScalingFactor[m_layerId][1] = Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL);
     987
     988      g_posScalingFactor[m_layerId][0] = ((widthBL  << 16) + (widthEL  >> 1)) / widthEL;
     989      g_posScalingFactor[m_layerId][1] = ((heightBL << 16) + (heightEL >> 1)) / heightEL;
     990    }
     991#endif
    972992
    973993    UInt uiInternalAddress = pcPic->getNumPartInCU()-4;
Note: See TracChangeset for help on using the changeset viewer.