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


Ignore:
Timestamp:
29 Jul 2014, 14:03:05 (10 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/TLibDecoder
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r848 r849  
    359359      READ_FLAG( uiCode, "poc_reset_info_present_flag" );
    360360      pcPPS->setPocResetInfoPresentFlag(uiCode ? true : false);
     361#if REF_REGION_OFFSET
     362      READ_UVLC( uiCode,      "num_scaled_ref_layer_offsets" ); pcPPS->setNumScaledRefLayerOffsets(uiCode);
     363      for(Int i = 0; i < pcPPS->getNumScaledRefLayerOffsets(); i++)
     364      {
     365        READ_CODE( 6, uiCode,  "scaled_ref_layer_id" );  pcPPS->setScaledRefLayerId( i, uiCode );
     366        READ_FLAG( uiCode, "scaled_ref_layer_offset_present_flag" );   pcPPS->setScaledRefLayerOffsetPresentFlag( i, uiCode );
     367        if (uiCode)
     368        {
     369          Window& scaledWindow = pcPPS->getScaledRefLayerWindow(i);
     370          READ_SVLC( iCode, "scaled_ref_layer_left_offset" );    scaledWindow.setWindowLeftOffset  (iCode << 1);
     371          READ_SVLC( iCode, "scaled_ref_layer_top_offset" );     scaledWindow.setWindowTopOffset   (iCode << 1);
     372          READ_SVLC( iCode, "scaled_ref_layer_right_offset" );   scaledWindow.setWindowRightOffset (iCode << 1);
     373          READ_SVLC( iCode, "scaled_ref_layer_bottom_offset" );  scaledWindow.setWindowBottomOffset(iCode << 1);
     374#if P0312_VERT_PHASE_ADJ
     375          READ_FLAG( uiCode, "vert_phase_position_enable_flag" ); scaledWindow.setVertPhasePositionEnableFlag(uiCode);  pcPPS->setVertPhasePositionEnableFlag( pcPPS->getScaledRefLayerId(i), uiCode);
     376#endif
     377        }
     378        READ_FLAG( uiCode, "ref_region_offset_present_flag" );   pcPPS->setRefRegionOffsetPresentFlag( i, uiCode );
     379        if (uiCode)
     380        {
     381          Window& refWindow = pcPPS->getRefLayerWindow(i);
     382          READ_SVLC( iCode, "ref_region_left_offset" );    refWindow.setWindowLeftOffset  (iCode << 1);
     383          READ_SVLC( iCode, "ref_region_top_offset" );     refWindow.setWindowTopOffset   (iCode << 1);
     384          READ_SVLC( iCode, "ref_region_right_offset" );   refWindow.setWindowRightOffset (iCode << 1);
     385          READ_SVLC( iCode, "ref_region_bottom_offset" );  refWindow.setWindowBottomOffset(iCode << 1);
     386        }
     387#if R0209_GENERIC_PHASE
     388        READ_FLAG( uiCode, "resample_phase_set_present_flag" );   pcPPS->setResamplePhaseSetPresentFlag( i, uiCode );
     389        if (uiCode)
     390        {
     391          READ_UVLC( uiCode, "phase_hor_luma" );    pcPPS->setPhaseHorLuma ( i, uiCode );
     392          READ_UVLC( uiCode, "phase_ver_luma" );    pcPPS->setPhaseVerLuma ( i, uiCode );
     393          READ_UVLC( uiCode, "phase_hor_chroma_plus8" );  pcPPS->setPhaseHorChroma (i, uiCode - 8);
     394          READ_UVLC( uiCode, "phase_ver_chroma_plus8" );  pcPPS->setPhaseVerChroma (i, uiCode - 8);
     395        }
     396#endif
     397      }
     398#else
     399#if MOVE_SCALED_OFFSET_TO_PPS
     400      READ_UVLC( uiCode,      "num_scaled_ref_layer_offsets" ); pcPPS->setNumScaledRefLayerOffsets(uiCode);
     401      for(Int i = 0; i < pcPPS->getNumScaledRefLayerOffsets(); i++)
     402      {
     403        Window& scaledWindow = pcPPS->getScaledRefLayerWindow(i);
     404#if O0098_SCALED_REF_LAYER_ID
     405        READ_CODE( 6,  uiCode,  "scaled_ref_layer_id" );       pcPPS->setScaledRefLayerId( i, uiCode );
     406#endif
     407        READ_SVLC( iCode, "scaled_ref_layer_left_offset" );    scaledWindow.setWindowLeftOffset  (iCode << 1);
     408        READ_SVLC( iCode, "scaled_ref_layer_top_offset" );     scaledWindow.setWindowTopOffset   (iCode << 1);
     409        READ_SVLC( iCode, "scaled_ref_layer_right_offset" );   scaledWindow.setWindowRightOffset (iCode << 1);
     410        READ_SVLC( iCode, "scaled_ref_layer_bottom_offset" );  scaledWindow.setWindowBottomOffset(iCode << 1);
     411#if P0312_VERT_PHASE_ADJ
     412        READ_FLAG( uiCode, "vert_phase_position_enable_flag" ); scaledWindow.setVertPhasePositionEnableFlag(uiCode);  pcPPS->setVertPhasePositionEnableFlag( pcPPS->getScaledRefLayerId(i), uiCode);
     413#endif
     414      }
     415#endif
     416#endif
    361417#if Q0048_CGS_3D_ASYMLUT
    362418      READ_FLAG( uiCode , "colour_mapping_enabled_flag" );
     
    897953  assert( uiCode == 0 );
    898954
     955#if !MOVE_SCALED_OFFSET_TO_PPS
    899956  if( pcSPS->getLayerId() > 0 )
    900957  {
     
    916973    }
    917974  }
     975#endif
    918976}
    919977#endif
     
    30273085  }
    30283086#if P0312_VERT_PHASE_ADJ
    3029   for(Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ )
    3030   {
    3031     UInt refLayerIdc = rpcSlice->getInterLayerPredLayerIdc(i);
    3032     if( rpcSlice->getSPS()->getVertPhasePositionEnableFlag(refLayerIdc) )
    3033     {
    3034       READ_FLAG( uiCode, "vert_phase_position_flag" ); rpcSlice->setVertPhasePositionFlag( uiCode? true : false, refLayerIdc );
    3035     }
     3087    for(Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ )
     3088    {
     3089      UInt refLayerIdc = rpcSlice->getInterLayerPredLayerIdc(i);
     3090#if !MOVE_SCALED_OFFSET_TO_PPS
     3091      if( rpcSlice->getSPS()->getVertPhasePositionEnableFlag(refLayerIdc) )
     3092#else
     3093      if( rpcSlice->getPPS()->getVertPhasePositionEnableFlag(refLayerIdc) )
     3094#endif
     3095      {
     3096        READ_FLAG( uiCode, "vert_phase_position_flag" ); rpcSlice->setVertPhasePositionFlag( uiCode? true : false, refLayerIdc );
     3097      }
    30363098  }
    30373099#endif
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp

    r834 r849  
    350350      for(UInt i = 0; i < pcSlice->getVPS()->getNumDirectRefLayers( m_layerId ); i++ )
    351351      {
     352#if MOVE_SCALED_OFFSET_TO_PPS
     353#if O0098_SCALED_REF_LAYER_ID
     354        const Window scalEL = pcSlice->getPPS()->getScaledRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, i));
     355#else
     356        const Window scalEL = pcSlice->getPPS()->getScaledRefLayerWindow(i);
     357#endif
     358#else
    352359#if O0098_SCALED_REF_LAYER_ID
    353360        const Window scalEL = pcSlice->getSPS()->getScaledRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, i));
     
    355362        const Window scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(i);
    356363#endif
     364#endif
     365#if REF_REGION_OFFSET
     366        const Window refEL = pcSlice->getPPS()->getRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, i));
     367        Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0
     368                             && refEL.getWindowLeftOffset() == 0 && refEL.getWindowRightOffset() == 0 && refEL.getWindowTopOffset() == 0 && refEL.getWindowBottomOffset() == 0 );
     369#else
    357370        Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0 );
     371#endif
    358372
    359373#if VPS_EXTN_DIRECT_REF_LAYERS
     
    763777
    764778#if P0312_VERT_PHASE_ADJ
     779#if MOVE_SCALED_OFFSET_TO_PPS
     780  if( activeVPS->getVpsVuiVertPhaseInUseFlag() == 0 )
     781  {   
     782    for(Int i = 0; i < activePPS->getNumScaledRefLayerOffsets(); i++)
     783    {
     784      UInt scaledRefLayerId = activePPS->getScaledRefLayerId(i);
     785      if( activePPS->getVertPhasePositionEnableFlag( scaledRefLayerId ) )
     786      {
     787        printf("\nWarning: LayerId = %d: vert_phase_position_enable_flag[%d] = 1, however indication vert_phase_position_in_use_flag = 0\n", m_layerId, scaledRefLayerId );
     788        break;
     789      }
     790    }
     791  }
     792#else
    765793  if( activeVPS->getVpsVuiVertPhaseInUseFlag() == 0 )
    766794  {   
     
    775803    }
    776804  }
     805#endif
    777806#endif
    778807
     
    17261755#endif
    17271756
     1757#if MOVE_SCALED_OFFSET_TO_PPS
     1758#if O0098_SCALED_REF_LAYER_ID
     1759        const Window &scalEL = pcSlice->getPPS()->getScaledRefLayerWindowForLayer(refLayerId);
     1760#else
     1761        const Window &scalEL = pcSlice->getPPS()->getScaledRefLayerWindow(refLayerIdc);
     1762#endif
     1763#else
    17281764#if O0098_SCALED_REF_LAYER_ID
    17291765        const Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindowForLayer(refLayerId);
     
    17311767        const Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc);
    17321768#endif
    1733 
     1769#endif
     1770
     1771#if REF_REGION_OFFSET
     1772        const Window &windowRL = pcSlice->getPPS()->getRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc));
     1773        Int widthBL   = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth() - windowRL.getWindowLeftOffset() - windowRL.getWindowRightOffset();
     1774        Int heightBL  = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight() - windowRL.getWindowTopOffset() - windowRL.getWindowBottomOffset();
     1775#else
    17341776        Int widthBL   = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth();
    17351777        Int heightBL  = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight();
     
    17401782        heightBL -= ( confBL.getWindowTopOffset() + confBL.getWindowBottomOffset() ) * TComSPS::getWinUnitY( chromaFormatIdc );
    17411783#endif
     1784#endif
    17421785        Int widthEL   = pcPic->getPicYuvRec()->getWidth()  - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset();
    17431786        Int heightEL  = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset()  - scalEL.getWindowBottomOffset();
     
    17861829#else
    17871830#if Q0048_CGS_3D_ASYMLUT
    1788             m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc), pcSlice->getVPS()->getPhaseAlignFlag() );
    1789 #else
    1790             m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() );
     1831#if MOVE_SCALED_OFFSET_TO_PPS
     1832          m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), pcSlice->getPPS()->getScaledRefLayerWindow(refLayerIdc), pcSlice->getVPS()->getPhaseAlignFlag() );
     1833#else
     1834          m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc), pcSlice->getVPS()->getPhaseAlignFlag() );
     1835#endif
     1836#else
     1837          m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() );
    17911838#endif
    17921839#endif
     
    17941841#if O0194_JOINT_US_BITSHIFT
    17951842#if Q0048_CGS_3D_ASYMLUT
    1796             m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL );
    1797 #else
    1798             m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL );
     1843#if REF_REGION_OFFSET
     1844          m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL, altRL );
     1845#else
     1846          m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL );
     1847#endif
     1848#else
     1849          m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL );
    17991850#endif
    18001851#else
Note: See TracChangeset for help on using the changeset viewer.