Changeset 873 in SHVCSoftware


Ignore:
Timestamp:
21 Aug 2014, 03:10:10 (10 years ago)
Author:
sharp
Message:

Resampling bugfix -- (1) fix resampling bypass flag, (2) conformance check on resampling params
(Macro: RESAMPLING_FIX)

From: Tomoyuki Yamamoto <yamamoto.tomoyuki@…>

Location:
branches/SHM-dev/source/Lib
Files:
6 edited

Legend:

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

    r872 r873  
    287287}
    288288#endif
     289
    289290/**
    290291 - allocate table to contain substream sizes to be written to the slice header.
     
    35403541}
    35413542#endif
     3543
     3544#if RESAMPLING_FIX
     3545#if R0209_GENERIC_PHASE
     3546Bool TComPPS::hasZeroResamplingPhase(Int refLayerIdc)
     3547{
     3548  Int phaseHorLuma   = this->getPhaseHorLuma(refLayerIdc);
     3549  Int phaseVerLuma   = this->getPhaseVerLuma(refLayerIdc);
     3550  Int phaseHorChroma = this->getPhaseHorChroma(refLayerIdc);
     3551  Int phaseVerChroma = this->getPhaseVerChroma(refLayerIdc);
     3552  return ( phaseHorLuma == 0 && phaseHorChroma == 0 && phaseVerLuma == 0 && phaseVerChroma == 0);
     3553}
     3554#endif
     3555#endif
     3556
    35423557#endif
    35433558
  • branches/SHM-dev/source/Lib/TLibCommon/TComSlice.h

    r872 r873  
    443443  Bool          getVertPhasePositionEnableFlag() const     { return m_vertPhasePositionEnableFlag;  }
    444444  Void          setVertPhasePositionEnableFlag(Bool val)    { m_vertPhasePositionEnableFlag = val;  }
     445#endif
     446#if REF_REGION_OFFSET && RESAMPLING_FIX
     447  Bool          hasEqualOffset(const Window& ref) const
     448  {
     449    return (    this->getWindowLeftOffset()   == ref.getWindowLeftOffset()
     450             && this->getWindowTopOffset()    == ref.getWindowTopOffset()
     451             && this->getWindowRightOffset()  == ref.getWindowRightOffset()
     452             && this->getWindowBottomOffset() == ref.getWindowBottomOffset() );
     453  }
    445454#endif
    446455
     
    20402049  Bool getResamplePhaseSetPresentFlag(Int x) { return m_resamplePhaseSetPresentFlag[x]; }
    20412050  Void setResamplePhaseSetPresentFlag(Int x, Bool b) { m_resamplePhaseSetPresentFlag[x] = b; }
     2051#if RESAMPLING_FIX
     2052  Bool hasZeroResamplingPhase(Int layerId);
     2053#endif
    20422054#endif
    20432055#endif
     
    26292641#endif
    26302642
    2631 
    26322643#endif //SVC_EXTENSION
    26332644protected:
  • branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h

    r872 r873  
    255255#define R0209_GENERIC_PHASE              1      ///< JCTVC-R0209: resampling with generic phase
    256256#define R0220_REMOVE_EL_CLIP             1      ///< JCTVC-R0220: remove clip to scaled ref window in resampling process
     257#define RESAMPLING_FIX                   1      ///< Resampling fix -- equal offset check and conformance check
    257258#endif
    258259#else
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp

    r869 r873  
    381381#if REF_REGION_OFFSET
    382382        const Window refEL = pcSlice->getPPS()->getRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, i));
     383#if RESAMPLING_FIX
     384        Bool equalOffsets = scalEL.hasEqualOffset(refEL);
     385#if R0209_GENERIC_PHASE
     386        Bool zeroPhase = pcSlice->getPPS()->hasZeroResamplingPhase(pcSlice->getVPS()->getRefLayerId(m_layerId, i));
     387#endif
     388#else
    383389        Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0
    384390                             && refEL.getWindowLeftOffset() == 0 && refEL.getWindowRightOffset() == 0 && refEL.getWindowTopOffset() == 0 && refEL.getWindowBottomOffset() == 0 );
     391#endif
    385392#else
    386393        Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0 );
     
    399406        Bool sameBitDepths = ( g_bitDepthYLayer[m_layerId] == g_bitDepthYLayer[refLayerId] ) && ( g_bitDepthCLayer[m_layerId] == g_bitDepthCLayer[refLayerId] );
    400407
    401         if( pcPicYuvRecBase->getWidth() != pcSlice->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getPicHeightInLumaSamples() || !zeroOffsets || !sameBitDepths
     408        if( pcPicYuvRecBase->getWidth() != pcSlice->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getPicHeightInLumaSamples() || !sameBitDepths
     409#if REF_REGION_OFFSET && RESAMPLING_FIX
     410          || !equalOffsets
     411#if R0209_GENERIC_PHASE
     412          || !zeroPhase
     413#endif
     414#else
     415          || !zeroOffsets
     416#endif
    402417#if Q0048_CGS_3D_ASYMLUT
    403418          || pcSlice->getPPS()->getCGSFlag() > 0
     
    408423          )
    409424#else
    410         if(pcPicYuvRecBase->getWidth() != pcSlice->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getPicHeightInLumaSamples() || !zeroOffsets )
    411 #endif
    412 #else
    413         if(pcPicYuvRecBase->getWidth() != pcSlice->getSPS()->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getSPS()->getPicHeightInLumaSamples() || !zeroOffsets )
     425        if(pcPicYuvRecBase->getWidth() != pcSlice->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getPicHeightInLumaSamples()
     426#if REF_REGION_OFFSET && RESAMPLING_FIX
     427          || !equalOffsets
     428#if R0209_GENERIC_PHASE
     429          || !zeroPhase
     430#endif
     431#else
     432          || !zeroOffsets
     433#endif
     434        )
     435#endif
     436#else
     437        if(pcPicYuvRecBase->getWidth() != pcSlice->getSPS()->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getSPS()->getPicHeightInLumaSamples()
     438#if REF_REGION_OFFSET && RESAMPLING_FIX
     439          || !equalOffsets
     440#if R0209_GENERIC_PHASE
     441          || !zeroPhase
     442#endif
     443#else
     444          || !zeroOffsets
     445#endif
     446        )
    414447#endif
    415448        {
     
    19742007        Int widthEL   = pcPic->getPicYuvRec()->getWidth()  - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset();
    19752008        Int heightEL  = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset()  - scalEL.getWindowBottomOffset();
     2009
     2010#if RESAMPLING_FIX
     2011#if REF_REGION_OFFSET
     2012        // conformance check: the values of RefLayerRegionWidthInSamplesY, RefLayerRegionHeightInSamplesY, ScaledRefRegionWidthInSamplesY and ScaledRefRegionHeightInSamplesY shall be greater than 0
     2013        assert(widthEL > 0 && heightEL > 0 && widthBL > 0 && widthEL > 0);
     2014
     2015        // conformance check: ScaledRefRegionWidthInSamplesY shall be greater or equal to RefLayerRegionWidthInSamplesY and ScaledRefRegionHeightInSamplesY shall be greater or equal to RefLayerRegionHeightInSamplesY
     2016        assert(widthEL >= widthBL && heightEL >= heightBL);
     2017
     2018#if R0209_GENERIC_PHASE
     2019        // conformance check: when ScaledRefRegionWidthInSamplesY is equal to RefLayerRegionWidthInSamplesY, PhaseHorY shall be equal to 0, when ScaledRefRegionWidthInSamplesC is equal to RefLayerRegionWidthInSamplesC, PhaseHorC shall be equal to 0, when ScaledRefRegionHeightInSamplesY is equal to RefLayerRegionHeightInSamplesY, PhaseVerY shall be equal to 0, and when ScaledRefRegionHeightInSamplesC is equal to RefLayerRegionHeightInSamplesC, PhaseVerC shall be equal to 0.
     2020        Int phaseHorLuma   = pcSlice->getPPS()->getPhaseHorLuma(refLayerIdc);
     2021        Int phaseVerLuma   = pcSlice->getPPS()->getPhaseVerLuma(refLayerIdc);
     2022        Int phaseHorChroma = pcSlice->getPPS()->getPhaseHorChroma(refLayerIdc);
     2023        Int phaseVerChroma = pcSlice->getPPS()->getPhaseVerChroma(refLayerIdc);
     2024        assert( ( (widthEL  != widthBL)  || (phaseHorLuma == 0 && phaseHorChroma == 0) )
     2025             && ( (heightEL != heightBL) || (phaseVerLuma == 0 && phaseVerChroma == 0) ) );
     2026#endif
     2027#endif
     2028#endif
    19762029
    19772030        g_mvScalingFactor[refLayerIdc][0] = widthEL  == widthBL  ? 4096 : Clip3(-4096, 4095, ((widthEL  << 8) + (widthBL  >> 1)) / widthBL);
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r868 r873  
    11241124        Int widthEL   = pcPic->getPicYuvRec()->getWidth()  - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset();
    11251125        Int heightEL  = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset()  - scalEL.getWindowBottomOffset();
     1126
     1127#if RESAMPLING_FIX
     1128#if REF_REGION_OFFSET
     1129        // conformance check: the values of RefLayerRegionWidthInSamplesY, RefLayerRegionHeightInSamplesY, ScaledRefRegionWidthInSamplesY and ScaledRefRegionHeightInSamplesY shall be greater than 0
     1130        assert(widthEL > 0 && heightEL > 0 && widthBL > 0 && widthEL > 0);
     1131
     1132        // conformance check: ScaledRefRegionWidthInSamplesY shall be greater or equal to RefLayerRegionWidthInSamplesY and ScaledRefRegionHeightInSamplesY shall be greater or equal to RefLayerRegionHeightInSamplesY
     1133        assert(widthEL >= widthBL && heightEL >= heightBL);
     1134
     1135#if R0209_GENERIC_PHASE
     1136        // conformance check: when ScaledRefRegionWidthInSamplesY is equal to RefLayerRegionWidthInSamplesY, PhaseHorY shall be equal to 0, when ScaledRefRegionWidthInSamplesC is equal to RefLayerRegionWidthInSamplesC, PhaseHorC shall be equal to 0, when ScaledRefRegionHeightInSamplesY is equal to RefLayerRegionHeightInSamplesY, PhaseVerY shall be equal to 0, and when ScaledRefRegionHeightInSamplesC is equal to RefLayerRegionHeightInSamplesC, PhaseVerC shall be equal to 0.
     1137        Int phaseHorLuma   = pcSlice->getPPS()->getPhaseHorLuma(refLayerIdc);
     1138        Int phaseVerLuma   = pcSlice->getPPS()->getPhaseVerLuma(refLayerIdc);
     1139        Int phaseHorChroma = pcSlice->getPPS()->getPhaseHorChroma(refLayerIdc);
     1140        Int phaseVerChroma = pcSlice->getPPS()->getPhaseVerChroma(refLayerIdc);
     1141        assert( ( (widthEL  != widthBL)  || (phaseHorLuma == 0 && phaseHorChroma == 0) )
     1142             && ( (heightEL != heightBL) || (phaseVerLuma == 0 && phaseVerChroma == 0) ) );
     1143#endif
     1144#endif
     1145#endif
    11261146
    11271147        g_mvScalingFactor[refLayerIdc][0] = widthEL  == widthBL  ? 4096 : Clip3(-4096, 4095, ((widthEL  << 8) + (widthBL  >> 1)) / widthBL);
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.cpp

    r869 r873  
    794794#if REF_REGION_OFFSET
    795795          const Window altRL  = getPPS()->getRefLayerWindowForLayer(m_cVPS.getRefLayerId(m_layerId, i));
     796#if RESAMPLING_FIX
     797          Bool equalOffsets = scalEL.hasEqualOffset(altRL);
     798#if R0209_GENERIC_PHASE
     799          Bool zeroPhase = getPPS()->hasZeroResamplingPhase(m_cVPS.getRefLayerId(m_layerId, i));
     800#endif
     801#else
    796802          Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0
    797803                               && altRL.getWindowLeftOffset() == 0 && altRL.getWindowRightOffset() == 0 && altRL.getWindowTopOffset() == 0 && altRL.getWindowBottomOffset() == 0);
     804#endif
    798805#else
    799806          Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0 );
     
    809816          Bool sameBitDepths = ( g_bitDepthYLayer[m_layerId] == g_bitDepthYLayer[refLayerId] ) && ( g_bitDepthCLayer[m_layerId] == g_bitDepthCLayer[refLayerId] );
    810817
    811           if( m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !zeroOffsets || !sameBitDepths
     818          if( m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !sameBitDepths
     819#if REF_REGION_OFFSET && RESAMPLING_FIX
     820            || !equalOffsets
     821#if R0209_GENERIC_PHASE
     822            || !zeroPhase
     823#endif
     824#else
     825            || !zeroOffsets
     826#endif
    812827#if Q0048_CGS_3D_ASYMLUT
    813828            || m_cPPS.getCGSFlag() > 0
     
    818833            )
    819834#else
    820           if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !zeroOffsets )
     835          if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight()
     836#if REF_REGION_OFFSET && RESAMPLING_FIX
     837            || !equalOffsets
     838#if R0209_GENERIC_PHASE
     839            || !zeroPhase
     840#endif
     841#else
     842            || !zeroOffsets
     843#endif
     844          )
    821845#endif
    822846          {
     
    868892#if REF_REGION_OFFSET
    869893          const Window altRL  = getPPS()->getRefLayerWindowForLayer(m_cVPS.getRefLayerId(m_layerId, i));
     894#if RESAMPLING_FIX
     895          Bool equalOffsets = scalEL.hasEqualOffset(altRL);
     896#if R0209_GENERIC_PHASE
     897          Bool zeroPhase = getPPS()->hasZeroResamplingPhase(m_cVPS.getRefLayerId(m_layerId, i));
     898#endif
     899#else
    870900          Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0
    871901                               && altRL.getWindowLeftOffset() == 0 && altRL.getWindowRightOffset() == 0 && altRL.getWindowTopOffset() == 0 && altRL.getWindowBottomOffset() == 0);
     902#endif
    872903#else
    873904          Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0 );
     
    883914          Bool sameBitDepths = ( g_bitDepthYLayer[m_layerId] == g_bitDepthYLayer[refLayerId] ) && ( g_bitDepthCLayer[m_layerId] == g_bitDepthCLayer[refLayerId] );
    884915
    885           if( m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !zeroOffsets || !sameBitDepths
     916          if( m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !sameBitDepths
     917#if REF_REGION_OFFSET && RESAMPLING_FIX
     918            || !equalOffsets
     919#if R0209_GENERIC_PHASE
     920            || !zeroPhase
     921#endif
     922#else
     923            || !zeroOffsets
     924#endif
    886925#if Q0048_CGS_3D_ASYMLUT
    887926            || m_cPPS.getCGSFlag() > 0
     
    892931)
    893932#else
    894           if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !zeroOffsets )
     933          if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight()
     934#if REF_REGION_OFFSET && RESAMPLING_FIX
     935            || !equalOffsets
     936#if R0209_GENERIC_PHASE
     937            || !zeroPhase
     938#endif
     939#else
     940            || !zeroOffsets
     941#endif
     942          )
    895943#endif
    896944          {
Note: See TracChangeset for help on using the changeset viewer.