Changeset 849 in SHVCSoftware for branches/SHM-dev/source/Lib/TLibCommon


Ignore:
Timestamp:
29 Jul 2014, 14:03:05 (11 years ago)
Author:
sharp
Message:

JCTVC-R0340 Resampling modifications (Macro:R0340_RESAMPLING_MODIFICATION)

Include generic phase (R0209), ref. region offset (R0013), move scaled ref offset to PPS (R0013), remove clip to scaled ref window (R0220) and ref offset signal change (R0220).

From: Tomoyuki Yamamoto <yamamoto.tomoyuki@…>

Location:
branches/SHM-dev/source/Lib/TLibCommon
Files:
8 edited

Legend:

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

    r828 r849  
    35093509#endif
    35103510
     3511#if MOVE_SCALED_OFFSET_TO_PPS
     3512#if O0098_SCALED_REF_LAYER_ID
     3513  Int leftStartL = baseColPic->getSlice(0)->getPPS()->getScaledRefLayerWindowForLayer(baseColPic->getSlice(0)->getVPS()->getRefLayerId(getSlice()->getLayerId(), refLayerIdc)).getWindowLeftOffset();
     3514  Int topStartL  = baseColPic->getSlice(0)->getPPS()->getScaledRefLayerWindowForLayer(baseColPic->getSlice(0)->getVPS()->getRefLayerId(getSlice()->getLayerId(), refLayerIdc)).getWindowTopOffset();
     3515#else
     3516  Int leftStartL = baseColPic->getSlice(0)->getPPS()->getScaledRefLayerWindow(refLayerIdc).getWindowLeftOffset();
     3517  Int topStartL  = baseColPic->getSlice(0)->getPPS()->getScaledRefLayerWindow(refLayerIdc).getWindowTopOffset();
     3518#endif
     3519#else
    35113520#if O0098_SCALED_REF_LAYER_ID
    35123521  Int leftStartL = baseColPic->getSlice(0)->getSPS()->getScaledRefLayerWindowForLayer(baseColPic->getSlice(0)->getVPS()->getRefLayerId(getSlice()->getLayerId(), refLayerIdc)).getWindowLeftOffset();
     
    35163525  Int topStartL  = baseColPic->getSlice(0)->getSPS()->getScaledRefLayerWindow(refLayerIdc).getWindowTopOffset();
    35173526#endif
    3518 
     3527#endif
     3528
     3529#if REF_REGION_OFFSET
     3530  const Window &windowRL = baseColPic->getSlice(0)->getPPS()->getRefLayerWindow(refLayerIdc);
     3531  Int iBX = (((uiPelX - leftStartL)*g_posScalingFactor[refLayerIdc][0] + (1<<15)) >> 16) + windowRL.getWindowLeftOffset();
     3532  Int iBY = (((uiPelY - topStartL )*g_posScalingFactor[refLayerIdc][1] + (1<<15)) >> 16) + windowRL.getWindowTopOffset();
     3533#else
    35193534#if Q0200_CONFORMANCE_BL_SIZE
    35203535  Int chromaFormatIdc = baseColPic->getSlice(0)->getChromaFormatIdc();
     
    35253540  Int iBY = ((uiPelY - topStartL )*g_posScalingFactor[refLayerIdc][1] + (1<<15)) >> 16;
    35263541#endif
     3542#endif
    35273543
    35283544#if REF_IDX_MFM
  • branches/SHM-dev/source/Lib/TLibCommon/TComPrediction.cpp

    r815 r849  
    796796#else
    797797#if O0194_JOINT_US_BITSHIFT
     798#if REF_REGION_OFFSET
     799Void TComPrediction::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, const Window altRefWindow )
     800{
     801  m_cUsf.upsampleBasePic( refLayerIdc, pcUsPic, pcBasePic, pcTempPic, window, altRefWindow );
     802}
     803#else
    798804Void TComPrediction::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window)
    799805{
    800806  m_cUsf.upsampleBasePic( refLayerIdc, pcUsPic, pcBasePic, pcTempPic, window);
    801807}
     808#endif
    802809#else
    803810Void TComPrediction::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window)
  • branches/SHM-dev/source/Lib/TLibCommon/TComPrediction.h

    r815 r849  
    126126#else
    127127#if O0194_JOINT_US_BITSHIFT
     128#if REF_REGION_OFFSET
     129  Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, const Window altRefWindow );
     130#else
    128131  Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window );
     132#endif
    129133#else
    130134  Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window );
  • branches/SHM-dev/source/Lib/TLibCommon/TComSlice.cpp

    r848 r849  
    571571        UInt refLayerId = m_pcVPS->getRefLayerId( m_layerId, refLayerIdc );
    572572#if RESAMPLING_CONSTRAINT_BUG_FIX
     573#if MOVE_SCALED_OFFSET_TO_PPS
     574#if O0098_SCALED_REF_LAYER_ID
     575        const Window &scalEL = getPPS()->getScaledRefLayerWindowForLayer(refLayerId);
     576#else
     577        const Window &scalEL = getPPS()->getScaledRefLayerWindow(m_interLayerPredLayerIdc[i]);
     578#endif
     579#else
    573580#if O0098_SCALED_REF_LAYER_ID
    574581        const Window &scalEL = getSPS()->getScaledRefLayerWindowForLayer(refLayerId);
    575582#else
    576583        const Window &scalEL = getSPS()->getScaledRefLayerWindow(m_interLayerPredLayerIdc[i]);
     584#endif
    577585#endif
    578586        Int scalingOffset = ((scalEL.getWindowLeftOffset()   == 0 ) &&
     
    30613069, m_layerId                   ( 0 )
    30623070, m_extensionFlag             ( false )
     3071#if !MOVE_SCALED_OFFSET_TO_PPS
    30633072, m_numScaledRefLayerOffsets  ( 0 )
     3073#endif
    30643074#if REPN_FORMAT_IN_VPS
    30653075, m_updateRepFormatFlag       (false)
     
    30843094  ::memset(m_usedByCurrPicLtSPSFlag, 0, sizeof(m_usedByCurrPicLtSPSFlag));
    30853095
     3096#if !MOVE_SCALED_OFFSET_TO_PPS
    30863097#if P0312_VERT_PHASE_ADJ
    30873098  ::memset(m_vertPhasePositionEnableFlag, 0, sizeof(m_vertPhasePositionEnableFlag));
     3099#endif
    30883100#endif
    30893101}
     
    32173229const Int TComSPS::m_winUnitY[]={1,2,1,1};
    32183230
     3231#if !MOVE_SCALED_OFFSET_TO_PPS
    32193232#if O0098_SCALED_REF_LAYER_ID
    32203233Window& TComSPS::getScaledRefLayerWindowForLayer(Int layerId)
     
    32333246  return win;
    32343247}
     3248#endif
     3249#if REF_REGION_OFFSET
     3250Window& TComSPS::getRefLayerWindowForLayer(Int layerId)
     3251{
     3252  static Window win;
     3253
     3254  for (Int i = 0; i < m_numRefLayerOffsets; i++)
     3255  {
     3256    if (layerId == m_refLayerId[i])
     3257    {
     3258      return m_refLayerWindow[i];
     3259    }
     3260  }
     3261
     3262  win.resetWindow();  // reference region offsets are inferred to be zero when not present
     3263  return win;
     3264}
     3265#endif
    32353266#endif
    32363267
     
    32763307, m_pocResetInfoPresentFlag   (false)
    32773308#endif
     3309#if MOVE_SCALED_OFFSET_TO_PPS
     3310, m_numScaledRefLayerOffsets  ( 0 )
     3311#endif
    32783312#if Q0048_CGS_3D_ASYMLUT
    32793313, m_nCGSFlag(0)
     
    32843318{
    32853319  m_scalingList = new TComScalingList;
     3320#if REF_REGION_OFFSET
     3321  ::memset(m_scaledRefLayerOffsetPresentFlag,   0, sizeof(m_scaledRefLayerOffsetPresentFlag));
     3322  ::memset(m_refRegionOffsetPresentFlag,   0, sizeof(m_refRegionOffsetPresentFlag));
     3323#endif
     3324#if R0209_GENERIC_PHASE
     3325  ::memset(m_resamplePhaseSetPresentFlag,   0, sizeof(m_resamplePhaseSetPresentFlag));
     3326  ::memset(m_phaseHorLuma,   0, sizeof(m_phaseHorLuma));
     3327  ::memset(m_phaseVerLuma,   0, sizeof(m_phaseVerLuma));
     3328  ::memset(m_phaseHorChroma, 0, sizeof(m_phaseHorChroma));
     3329  ::memset(m_phaseVerChroma, 0, sizeof(m_phaseVerChroma));
     3330#endif
    32863331}
    32873332
     
    32933338  delete m_scalingList;
    32943339}
     3340
     3341#if MOVE_SCALED_OFFSET_TO_PPS
     3342#if O0098_SCALED_REF_LAYER_ID
     3343Window& TComPPS::getScaledRefLayerWindowForLayer(Int layerId)
     3344{
     3345  static Window win;
     3346
     3347  for (Int i = 0; i < m_numScaledRefLayerOffsets; i++)
     3348  {
     3349    if (layerId == m_scaledRefLayerId[i])
     3350    {
     3351      return m_scaledRefLayerWindow[i];
     3352    }
     3353  }
     3354
     3355  win.resetWindow();  // scaled reference layer offsets are inferred to be zero when not present
     3356  return win;
     3357}
     3358#endif
     3359#if REF_REGION_OFFSET
     3360Window& TComPPS::getRefLayerWindowForLayer(Int layerId)
     3361{
     3362  static Window win;
     3363
     3364  for (Int i = 0; i < m_numScaledRefLayerOffsets; i++)
     3365  {
     3366    if (layerId == m_scaledRefLayerId[i])
     3367    {
     3368      return m_refLayerWindow[i];
     3369    }
     3370  }
     3371
     3372  win.resetWindow();  // reference region offsets are inferred to be zero when not present
     3373  return win;
     3374}
     3375#endif
     3376#endif
    32953377
    32963378TComReferencePictureSet::TComReferencePictureSet()
  • branches/SHM-dev/source/Lib/TLibCommon/TComSlice.h

    r848 r849  
    12431243
    12441244  Bool          getWindowEnabledFlag() const      { return m_enabledFlag; }
    1245 #if P0312_VERT_PHASE_ADJ 
     1245#if P0312_VERT_PHASE_ADJ
    12461246  Void          resetWindow()                     { m_enabledFlag = false; m_winLeftOffset = m_winRightOffset = m_winTopOffset = m_winBottomOffset = 0; m_vertPhasePositionEnableFlag = false; }
    12471247#else
     
    12561256  Int           getWindowBottomOffset() const     { return m_enabledFlag ? m_winBottomOffset: 0; }
    12571257  Void          setWindowBottomOffset(Int val)    { m_winBottomOffset = val; m_enabledFlag = true; }
    1258 
    12591258#if P0312_VERT_PHASE_ADJ
    12601259  Bool          getVertPhasePositionEnableFlag() const     { return m_vertPhasePositionEnableFlag;  }
    12611260  Void          setVertPhasePositionEnableFlag(Bool val)    { m_vertPhasePositionEnableFlag = val;  }
     1261#endif
     1262
     1263#if P0312_VERT_PHASE_ADJ
    12621264  Void          setWindow(Int offsetLeft, Int offsetLRight, Int offsetLTop, Int offsetLBottom, Bool vertPhasePositionEnableFlag = 0)
    12631265#else
     
    15321534 Bool         m_vertPhasePositionEnableFlag[MAX_LAYERS];
    15331535#endif
     1536#if !MOVE_SCALED_OFFSET_TO_PPS
    15341537#if O0098_SCALED_REF_LAYER_ID
    15351538  UInt        m_scaledRefLayerId[MAX_LAYERS];
    15361539#endif
    15371540  Window      m_scaledRefLayerWindow[MAX_LAYERS];
     1541#endif
    15381542#if REPN_FORMAT_IN_VPS
    1539   Bool        m_updateRepFormatFlag;
     1543  Bool m_updateRepFormatFlag;
    15401544#if O0096_REP_FORMAT_INDEX
    15411545  UInt        m_updateRepFormatIndex;
     
    15471551#endif
    15481552#endif //SVC_EXTENSION
     1553
    15491554public:
    15501555  TComSPS();
     
    16931698  Int      getExtensionFlag()                  { return m_extensionFlag;  }
    16941699  Void     setExtensionFlag(Int n)             { m_extensionFlag = n;     }
     1700#if !MOVE_SCALED_OFFSET_TO_PPS
    16951701  UInt     getNumScaledRefLayerOffsets()       { return m_numScaledRefLayerOffsets; }
    16961702  Void     setNumScaledRefLayerOffsets(Int x)  { m_numScaledRefLayerOffsets = x;    }
     
    17051711#endif
    17061712  Window&  getScaledRefLayerWindow( Int x )   { return m_scaledRefLayerWindow[x]; }
     1713#endif
    17071714#if REPN_FORMAT_IN_VPS
    17081715  Bool     getUpdateRepFormatFlag()       { return m_updateRepFormatFlag; }
     
    18161823#if POC_RESET_IDC
    18171824  Bool     m_pocResetInfoPresentFlag;
     1825#endif
     1826#if MOVE_SCALED_OFFSET_TO_PPS
     1827  UInt     m_numScaledRefLayerOffsets;
     1828#if O0098_SCALED_REF_LAYER_ID
     1829  UInt     m_scaledRefLayerId[MAX_LAYERS];
     1830#endif
     1831  Window   m_scaledRefLayerWindow[MAX_LAYERS];
     1832#if REF_REGION_OFFSET
     1833  Window   m_refLayerWindow[MAX_LAYERS];
     1834  Bool     m_scaledRefLayerOffsetPresentFlag[MAX_LAYERS];
     1835  Bool     m_refRegionOffsetPresentFlag[MAX_LAYERS];
     1836#endif
     1837#if R0209_GENERIC_PHASE
     1838  Int      m_phaseHorLuma[MAX_LAYERS];
     1839  Int      m_phaseVerLuma[MAX_LAYERS];
     1840  Int      m_phaseHorChroma[MAX_LAYERS];
     1841  Int      m_phaseVerChroma[MAX_LAYERS];
     1842  Bool     m_resamplePhaseSetPresentFlag[MAX_LAYERS];
     1843#endif
    18181844#endif
    18191845#if Q0048_CGS_3D_ASYMLUT
     
    19441970  Bool getPocResetInfoPresentFlag   ()                    { return m_pocResetInfoPresentFlag; }
    19451971  Void setPocResetInfoPresentFlag   (const Bool val)      { m_pocResetInfoPresentFlag = val; }
     1972#endif
     1973#if MOVE_SCALED_OFFSET_TO_PPS
     1974  UInt     getNumScaledRefLayerOffsets()       { return m_numScaledRefLayerOffsets; }
     1975  Void     setNumScaledRefLayerOffsets(Int x)  { m_numScaledRefLayerOffsets = x;    }
     1976#if O0098_SCALED_REF_LAYER_ID
     1977  UInt     getScaledRefLayerId(Int x)          { return m_scaledRefLayerId[x]; }
     1978  Void     setScaledRefLayerId(Int x, UInt id) { m_scaledRefLayerId[x] = id;   }
     1979  Window&  getScaledRefLayerWindowForLayer( Int layerId );
     1980#endif
     1981  Window&  getScaledRefLayerWindow( Int x )   { return m_scaledRefLayerWindow[x]; }
     1982#if REF_REGION_OFFSET
     1983  Window&  getRefLayerWindowForLayer( Int layerId );
     1984  Window&  getRefLayerWindow( Int x )   { return m_refLayerWindow[x]; }
     1985  Bool getScaledRefLayerOffsetPresentFlag(Int x) { return m_scaledRefLayerOffsetPresentFlag[x]; }
     1986  Void setScaledRefLayerOffsetPresentFlag(Int x, Bool b) { m_scaledRefLayerOffsetPresentFlag[x] = b; }
     1987  Bool getRefRegionOffsetPresentFlag(Int x) { return m_refRegionOffsetPresentFlag[x]; }
     1988  Void setRefRegionOffsetPresentFlag(Int x, Bool b) { m_refRegionOffsetPresentFlag[x] = b; }
     1989#endif
     1990#if R0209_GENERIC_PHASE
     1991  Int getPhaseHorLuma(Int x) { return m_phaseHorLuma[x]; }
     1992  Int getPhaseVerLuma(Int x) { return m_phaseVerLuma[x]; }
     1993  Int getPhaseHorChroma(Int x) { return m_phaseHorChroma[x]; }
     1994  Int getPhaseVerChroma(Int x) { return m_phaseVerChroma[x]; }
     1995  Void setPhaseHorLuma(Int x, Int val) { m_phaseHorLuma[x] = val; }
     1996  Void setPhaseVerLuma(Int x, Int val) { m_phaseVerLuma[x] = val; }
     1997  Void setPhaseHorChroma(Int x, Int val) { m_phaseHorChroma[x] = val; }
     1998  Void setPhaseVerChroma(Int x, Int val) { m_phaseVerChroma[x] = val; }
     1999  Bool getResamplePhaseSetPresentFlag(Int x) { return m_resamplePhaseSetPresentFlag[x]; }
     2000  Void setResamplePhaseSetPresentFlag(Int x, Bool b) { m_resamplePhaseSetPresentFlag[x] = b; }
     2001#endif
    19462002#endif
    19472003#if Q0048_CGS_3D_ASYMLUT
  • branches/SHM-dev/source/Lib/TLibCommon/TComUpsampleFilter.cpp

    r815 r849  
    5959#else
    6060#if O0194_JOINT_US_BITSHIFT
     61#if REF_REGION_OFFSET
     62Void TComUpsampleFilter::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, const Window altRefWindow )
     63#else
    6164Void TComUpsampleFilter::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window )
     65#endif
    6266#else
    6367Void TComUpsampleFilter::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window )
     
    7579#endif
    7680
     81#if MOVE_SCALED_OFFSET_TO_PPS
     82#if O0098_SCALED_REF_LAYER_ID
     83  const Window &scalEL = currSlice->getPPS()->getScaledRefLayerWindowForLayer(refLayerId);
     84#else
     85  const Window &scalEL = currSlice->getPPS()->getScaledRefLayerWindow(refLayerIdc);
     86#endif
     87#if REF_REGION_OFFSET
     88  const Window &windowRL = currSlice->getPPS()->getRefLayerWindow(refLayerIdc);
     89#endif
     90#else
    7791#if O0098_SCALED_REF_LAYER_ID
    7892  const Window &scalEL = currSlice->getSPS()->getScaledRefLayerWindowForLayer(refLayerId);
    7993#else
    8094  const Window &scalEL = currSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc);
     95#endif
    8196#endif
    8297
     
    91106
    92107#if Q0200_CONFORMANCE_BL_SIZE
     108  const Window &confBL = currSlice->getBaseColPic(refLayerIdc)->getConformanceWindow();
     109#endif
     110#if Q0200_CONFORMANCE_BL_SIZE || REF_REGION_OFFSET
    93111  Int chromaFormatIdc = currSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getChromaFormatIdc();
    94   const Window &confBL = currSlice->getBaseColPic(refLayerIdc)->getConformanceWindow();
    95112  Int xScal = TComSPS::getWinUnitX( chromaFormatIdc );
    96113  Int yScal = TComSPS::getWinUnitY( chromaFormatIdc );
     114#endif
     115#if R0209_GENERIC_PHASE
     116  Int phaseHorLuma   = currSlice->getPPS()->getPhaseHorLuma(refLayerIdc);
     117  Int phaseVerLuma   = currSlice->getPPS()->getPhaseVerLuma(refLayerIdc);
     118  Int phaseHorChroma = currSlice->getPPS()->getPhaseHorChroma(refLayerIdc);
     119  Int phaseVerChroma;
     120  if (currSlice->getPPS()->getResamplePhaseSetPresentFlag(refLayerIdc))
     121  {
     122    phaseVerChroma = currSlice->getPPS()->getPhaseVerChroma(refLayerIdc);
     123  }
     124  else
     125  {
     126    Int refRegionHeight = heightBL - windowRL.getWindowTopOffset() - windowRL.getWindowBottomOffset();
     127    phaseVerChroma = (4 * heightEL + (refRegionHeight >> 1)) / refRegionHeight - 4;
     128  }
    97129#endif
    98130#if P0312_VERT_PHASE_ADJ
     
    223255    Int   shiftY = 16;
    224256
     257#if R0209_GENERIC_PHASE
     258    Int phaseX = phaseHorLuma;
     259    Int phaseY = phaseVerLuma;
     260    Int addX = ( ( phaseX * scaleX + 8 ) >> 4 ) -  (1 << ( shiftX - 5 ));
     261    Int addY = ( ( phaseY * scaleY + 8 ) >> 4 ) -  (1 << ( shiftX - 5 ));
     262#if REF_REGION_OFFSET
     263    Int refOffsetX = windowRL.getWindowLeftOffset() << 4;
     264    Int refOffsetY = windowRL.getWindowTopOffset()  << 4;
     265#else
     266#if Q0200_CONFORMANCE_BL_SIZE
     267    Int refOffsetX = ( confBL.getWindowLeftOffset() * xScal ) << 4;
     268    Int refOffsetY = ( confBL.getWindowTopOffset()  * yScal ) << 4;
     269#endif
     270#endif
     271#else
    225272#if O0215_PHASE_ALIGNMENT //for Luma, if Phase 0, then both PhaseX  and PhaseY should be 0. If symmetric: both PhaseX and PhaseY should be 2
    226273    Int   phaseX = 2*phaseAlignFlag;
     
    258305#endif
    259306
     307#if REF_REGION_OFFSET
     308    Int refOffsetX = windowRL.getWindowLeftOffset() << 4;
     309    Int refOffsetY = windowRL.getWindowTopOffset() << 4;
     310#else
    260311#if Q0200_CONFORMANCE_BL_SIZE
    261312    deltaX -= ( confBL.getWindowLeftOffset() * xScal ) << 4;
    262313    deltaY -= ( confBL.getWindowTopOffset() * yScal ) << 4;
    263314#endif
     315#endif
     316#endif
    264317
    265318    Int shiftXM4 = shiftX - 4;
     
    272325    heightBL = min<Int>( pcBasePic->getHeight(), heightEL );
    273326
     327#if R0220_REMOVE_EL_CLIP
     328    Int phaseXL = scalEL.getWindowLeftOffset();
     329    Int phaseYL = scalEL.getWindowTopOffset();
     330    Int rlClipL = -(NTAPS_US_LUMA>>1);
     331    Int rlClipR = widthBL -1 + (NTAPS_US_LUMA>>1);
     332    Int rlClipT = -(NTAPS_US_LUMA>>1);
     333    Int rlClipB = heightBL - 1 + (NTAPS_US_LUMA>>1);
     334#else
    274335    Int leftStartL = scalEL.getWindowLeftOffset();
    275336    Int rightEndL  = pcUsPic->getWidth() - scalEL.getWindowRightOffset();
     
    277338    Int bottomEndL = pcUsPic->getHeight() - scalEL.getWindowBottomOffset();
    278339    Int leftOffset = leftStartL > 0 ? leftStartL : 0;
     340#endif
    279341#if O0194_JOINT_US_BITSHIFT
    280342    // g_bitDepthY was set to EL bit-depth, but shift1 should be calculated using BL bit-depth
     
    293355    for( i = 0; i < widthEL; i++ )
    294356    {
     357#if R0220_REMOVE_EL_CLIP
     358      Int x = i;
     359#if R0209_GENERIC_PHASE
     360      refPos16 = (((x - phaseXL)*scaleX - addX) >> shiftXM4) + refOffsetX;
     361#else
     362#if REF_REGION_OFFSET
     363      refPos16 = (((x - phaseXL)*scaleX + addX) >> shiftXM4) - deltaX + refOffsetX;
     364#else
     365      refPos16 = (((x - phaseXL)*scaleX + addX) >> shiftXM4) - deltaX;
     366#endif
     367#endif
     368#else
    295369      Int x = Clip3( leftStartL, rightEndL - 1, i );
     370#if REF_REGION_OFFSET
     371      refPos16 = (((x - leftStartL)*scaleX + addX) >> shiftXM4) - deltaX + refOffsetX;
     372#else
    296373      refPos16 = (((x - leftStartL)*scaleX + addX) >> shiftXM4) - deltaX;
     374#endif
     375#endif
    297376      phase    = refPos16 & 15;
    298377      refPos   = refPos16 >> 4;
     378#if R0220_REMOVE_EL_CLIP
     379      refPos   = Clip3( rlClipL, rlClipR, refPos );
     380#endif
    299381      coeff = m_lumaFilter[phase];
    300382
     
    325407    for( j = 0; j < pcTempPic->getHeight(); j++ )
    326408    {
     409#if R0220_REMOVE_EL_CLIP
     410      Int y = j;
     411#if R0209_GENERIC_PHASE
     412      refPos16 = ((( y - phaseYL )*scaleY - addY) >> shiftYM4) + refOffsetY;
     413#else
     414#if REF_REGION_OFFSET
     415      refPos16 = ((( y - phaseYL )*scaleY + addY) >> shiftYM4) - deltaY + refOffsetY;
     416#else
     417      refPos16 = ((( y - pahseYL )*scaleY + addY) >> shiftYM4) - deltaY;
     418#endif
     419#endif
     420#else
    327421      Int y = Clip3(topStartL, bottomEndL - 1, j);
     422#if REF_REGION_OFFSET
     423      refPos16 = ((( y - topStartL )*scaleY + addY) >> shiftYM4) - deltaY + refOffsetY;
     424#else
    328425      refPos16 = ((( y - topStartL )*scaleY + addY) >> shiftYM4) - deltaY;
     426#endif
     427#endif
    329428      phase    = refPos16 & 15;
    330429      refPos   = refPos16 >> 4;
     430#if R0220_REMOVE_EL_CLIP
     431      refPos = Clip3( rlClipT, rlClipB, refPos );
     432#endif
    331433      coeff = m_lumaFilter[phase];
    332434
    333435      piSrcY = piTempBufY + (refPos -((NTAPS_US_LUMA>>1) - 1))*strideEL;
    334436      Pel* piDstY0 = piDstBufY + j * strideEL;
    335       piDstY = piDstY0 + leftOffset;
    336       piSrcY += leftOffset;
    337 
    338       for( i = min<Int>(rightEndL, pcTempPic->getWidth()) - max<Int>(0, leftStartL); i > 0; i-- )
     437
     438#if R0220_REMOVE_EL_CLIP
     439      piDstY = piDstY0;
     440
     441      for( i = pcTempPic->getWidth(); i > 0; i-- )
    339442      {
    340443        *piDstY = ClipY( (sumLumaVer(piSrcY, coeff, strideEL) + iOffset) >> (nShift));
     
    342445        piDstY++;
    343446      }
     447#else
     448      piDstY = piDstY0 + leftOffset;
     449      piSrcY += leftOffset;
     450
     451      for( i = min<Int>(rightEndL, pcTempPic->getWidth()) - max<Int>(0, leftStartL); i > 0; i-- )
     452      {
     453        *piDstY = ClipY( (sumLumaVer(piSrcY, coeff, strideEL) + iOffset) >> (nShift));
     454        piSrcY++;
     455        piDstY++;
     456      }
    344457
    345458      for( i = rightEndL; i < pcTempPic->getWidth(); i++ )
     
    355468        piDstY++;
    356469      }
    357 
     470#endif
    358471    }
    359472
     
    374487    strideEL  = pcUsPic->getCStride();
    375488
     489#if R0220_REMOVE_EL_CLIP
     490    Int srlLOffsetC = scalEL.getWindowLeftOffset() >> 1;
     491    Int srlTOffsetC = scalEL.getWindowTopOffset() >> 1;
     492    rlClipL = -(NTAPS_US_CHROMA>>1);
     493    rlClipR = widthBL -1 + (NTAPS_US_CHROMA>>1);
     494    rlClipT = -(NTAPS_US_CHROMA>>1);
     495    rlClipB = heightBL - 1 + (NTAPS_US_CHROMA>>1);
     496#else
    376497    Int leftStartC = scalEL.getWindowLeftOffset() >> 1;
    377498    Int rightEndC  = (pcUsPic->getWidth() >> 1) - (scalEL.getWindowRightOffset() >> 1);
     
    379500    Int bottomEndC = (pcUsPic->getHeight() >> 1) - (scalEL.getWindowBottomOffset() >> 1);
    380501    leftOffset = leftStartC > 0 ? leftStartC : 0;
     502#endif
    381503    shiftX = 16;
    382504    shiftY = 16;
    383505
     506#if R0209_GENERIC_PHASE
     507    addX = ( ( phaseHorChroma * scaleX + 8 ) >> 4 ) -  (1 << ( shiftX - 5 ));
     508    addY = ( ( phaseVerChroma * scaleY + 8 ) >> 4 ) -  (1 << ( shiftX - 5 ));
     509    Int refOffsetXC = (windowRL.getWindowLeftOffset() / xScal) << 4;
     510    Int refOffsetYC = (windowRL.getWindowTopOffset()  / yScal) << 4;
     511#else
    384512#if O0215_PHASE_ALIGNMENT
    385513    Int phaseXC = phaseAlignFlag;
     
    417545#endif
    418546
     547#if REF_REGION_OFFSET
     548    Int refOffsetXC = (windowRL.getWindowLeftOffset() / xScal) << 4;
     549    Int refOffsetYC  = (windowRL.getWindowTopOffset()  / yScal) << 4;
     550#else
    419551#if Q0200_CONFORMANCE_BL_SIZE
    420552    deltaX -= ( ( confBL.getWindowLeftOffset() * xScal ) >> 1 ) << 4;
    421553    deltaY  -= ( ( confBL.getWindowTopOffset() * yScal ) >> 1 ) << 4;
     554#endif
     555#endif
    422556#endif
    423557
     
    447581    for( i = 0; i < widthEL; i++ )
    448582    {
     583#if R0220_REMOVE_EL_CLIP
     584      Int x = i;
     585#if R0209_GENERIC_PHASE
     586      refPos16 = (((x - srlLOffsetC)*scaleX - addX) >> shiftXM4) + refOffsetXC;
     587#else
     588#if REF_REGION_OFFSET
     589      refPos16 = (((x - srlLOffsetC)*scaleX + addX) >> shiftXM4) - deltaX + refOffsetXC;
     590#else
     591      refPos16 = (((x - srlLOffsetC)*scaleX + addX) >> shiftXM4) - deltaX;
     592#endif
     593#endif
     594#else
    449595      Int x = Clip3(leftStartC, rightEndC - 1, i);
     596#if REF_REGION_OFFSET
     597      refPos16 = (((x - leftStartC)*scaleX + addX) >> shiftXM4) - deltaX + refOffsetXC;
     598#else
    450599      refPos16 = (((x - leftStartC)*scaleX + addX) >> shiftXM4) - deltaX;
     600#endif
     601#endif
    451602      phase    = refPos16 & 15;
    452603      refPos   = refPos16 >> 4;
     604#if R0220_REMOVE_EL_CLIP
     605      refPos   = Clip3(rlClipL, rlClipR, refPos);
     606#endif
    453607      coeff = m_chromaFilter[phase];
    454608
     
    485639    for( j = 0; j < pcTempPic->getHeight() >> 1; j++ )
    486640    {
     641#if R0220_REMOVE_EL_CLIP
     642      Int y = j;
     643#if R0209_GENERIC_PHASE
     644      refPos16 = (((y - srlTOffsetC)*scaleX - addY) >> shiftYM4) + refOffsetYC;
     645#else
     646#if REF_REGION_OFFSET
     647      refPos16 = (((y - srlTOffsetC)*scaleY + addY) >> shiftYM4) - deltaY + refOffsetYC;
     648#else
     649      refPos16 = (((y - srlTOffsetC)*scaleY + addY) >> shiftYM4) - deltaY;
     650#endif
     651#endif
     652#else
    487653      Int y = Clip3(topStartC, bottomEndC - 1, j);
     654#if REF_REGION_OFFSET
     655      refPos16 = (((y - topStartC)*scaleY + addY) >> shiftYM4) - deltaY + refOffsetYC;
     656#else
    488657      refPos16 = (((y - topStartC)*scaleY + addY) >> shiftYM4) - deltaY;
     658#endif
     659#endif
    489660      phase    = refPos16 & 15;
    490661      refPos   = refPos16 >> 4;
     662#if R0220_REMOVE_EL_CLIP
     663      refPos = Clip3(rlClipT, rlClipB, refPos);
     664#endif
    491665      coeff = m_chromaFilter[phase];
    492666
     
    496670      Pel* piDstU0 = piDstBufU + j*strideEL;
    497671      Pel* piDstV0 = piDstBufV + j*strideEL;
    498       piDstU = piDstU0 + leftOffset;
    499       piDstV = piDstV0 + leftOffset;
    500       piSrcU += leftOffset;
    501       piSrcV += leftOffset;
    502 
    503       for( i = min<Int>(rightEndC, pcTempPic->getWidth() >> 1) - max<Int>(0, leftStartC); i > 0; i-- )
     672
     673#if R0220_REMOVE_EL_CLIP
     674      piDstU = piDstU0;
     675      piDstV = piDstV0;
     676
     677      for( i = pcTempPic->getWidth() >> 1; i > 0; i-- )
    504678      {
    505679        *piDstU = ClipC( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift));
     
    510684        piDstV++;
    511685      }
     686#else
     687      piDstU = piDstU0 + leftOffset;
     688      piDstV = piDstV0 + leftOffset;
     689      piSrcU += leftOffset;
     690      piSrcV += leftOffset;
     691
     692      for( i = min<Int>(rightEndC, pcTempPic->getWidth() >> 1) - max<Int>(0, leftStartC); i > 0; i-- )
     693      {
     694        *piDstU = ClipC( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift));
     695        *piDstV = ClipC( (sumChromaVer(piSrcV, coeff, strideEL) + iOffset) >> (nShift));
     696        piSrcU++;
     697        piSrcV++;
     698        piDstU++;
     699        piDstV++;
     700      }
    512701
    513702      for( i = rightEndC; i < pcTempPic->getWidth() >> 1; i++ )
     
    528717        piDstV++;
    529718      }
     719#endif
    530720
    531721    }
  • branches/SHM-dev/source/Lib/TLibCommon/TComUpsampleFilter.h

    r713 r849  
    5151#else
    5252#if O0194_JOINT_US_BITSHIFT
     53#if REF_REGION_OFFSET
     54  Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, const Window altRefWindow );
     55#else
    5356  Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window );
     57#endif
    5458#else
    5559  Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window );
  • branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h

    r848 r849  
    6262#define Q0146_SSH_EXT_DATA_BIT           1      ///< JCTVC-Q0146; Bug-fix -- the SSH_EXT_DATA_BIT can have any value -- not required to be 1
    6363
    64 #define Q0200_CONFORMANCE_BL_SIZE        1      ///< JCTVC-Q0200; use conformance picture size in re-sampling processs
    65 #define P0312_VERT_PHASE_ADJ             1      ///< JCTVC-P0312: vertical phase adjustment in re-sampling process (BoG report)
    66 #if P0312_VERT_PHASE_ADJ
    67 #define Q0120_PHASE_CALCULATION          1      ///< JCTVC-Q0120 phase offset derivation for combination of spatial scalibility and field coding.
    68 #endif
    6964#define P0130_EOB                        1      ///< JCTVC-P0130, set layer Id of EOB NALU to be fixed to 0
    7065#define T_ID_EOB_BUG_FIX                 1      ///< Bug fix for the value of temporal id of EOB NALU. It must be set to 0
     
    235230#define HRD_BPB                          1      ///< JCTVC-Q0101 Bitstream Partition Buffering Proposals
    236231#define DPB_CONSTRAINTS                  1      ///< JCTVC-Q0100 RPS DPB constraints
     232
     233#define R0340_RESAMPLING_MODIFICATION    1      ///< JCTVC-R0340: set of changes regarding resampling (as listed below)
     234#if R0340_RESAMPLING_MODIFICATION
     235#define MOVE_SCALED_OFFSET_TO_PPS        1      ///< JCTVC-R0013: move scaled reference layer offset from SPS to PPS
     236#if MOVE_SCALED_OFFSET_TO_PPS
     237#define REF_REGION_OFFSET                1      ///< JCTVC-Q0159/R0220: reference region offset
     238#define R0209_GENERIC_PHASE              1      ///< JCTVC-R0209: resampling with generic phase
     239#define R0220_REMOVE_EL_CLIP             1      ///< JCTVC-R0220: remove clip to scaled ref window in resampling process
     240#endif
     241#else
     242#define Q0200_CONFORMANCE_BL_SIZE        1      ///< JCTVC-Q0200; use conformance picture size in re-sampling processs
     243#define P0312_VERT_PHASE_ADJ             1      ///< JCTVC-P0312: vertical phase adjustment in re-sampling process (BoG report)
     244#if P0312_VERT_PHASE_ADJ
     245#define Q0120_PHASE_CALCULATION          1      ///< JCTVC-Q0120 phase offset derivation for combination of spatial scalibility and field coding.
     246#endif
     247#endif
    237248
    238249/// scalability types
Note: See TracChangeset for help on using the changeset viewer.