Changeset 1073 in SHVCSoftware for branches/SHM-dev/source


Ignore:
Timestamp:
6 Mar 2015, 03:10:49 (10 years ago)
Author:
seregin
Message:

fix the index for getMaxVpsDecPicBufferingMinus1

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

Legend:

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

    r1057 r1073  
    35833583#endif
    35843584#if VPS_DPB_SIZE_TABLE
     3585Int TComVPS::getLayerIdcInOls( Int olsIdx, Int layerId )
     3586{
     3587  Int layerIdc = -1;
     3588
     3589  std::vector<Int>::iterator it = std::find( m_layerSetLayerIdList[olsIdx].begin(), m_layerSetLayerIdList[olsIdx].end(), layerId );
     3590
     3591  if( it != m_layerSetLayerIdList[olsIdx].end() )
     3592  {
     3593    layerIdc = std::distance( m_layerSetLayerIdList[olsIdx].begin(), it );
     3594  }
     3595
     3596  assert( layerIdc >= 0 );
     3597
     3598  return layerIdc;
     3599}
     3600
    35853601Void TComVPS::determineSubDpbInfoFlags()
    35863602{
  • branches/SHM-dev/source/Lib/TLibCommon/TComSlice.h

    r1061 r1073  
    14121412#endif
    14131413#if VPS_DPB_SIZE_TABLE
    1414   Bool   getSubLayerFlagInfoPresentFlag(Int i)         {return m_subLayerFlagInfoPresentFlag[i]; }
    1415   Void   setSubLayerFlagInfoPresentFlag(Int i, Bool x) {m_subLayerFlagInfoPresentFlag[i] = x;    }
    1416 
    1417   Bool   getSubLayerDpbInfoPresentFlag(Int i, Int j)         {return m_subLayerDpbInfoPresentFlag[i][j]; }
    1418   Void   setSubLayerDpbInfoPresentFlag(Int i, Int j, Bool x) {m_subLayerDpbInfoPresentFlag[i][j] = x;    }
     1414  Bool   getSubLayerFlagInfoPresentFlag(Int olsIdx)         { return m_subLayerFlagInfoPresentFlag[olsIdx]; }
     1415  Void   setSubLayerFlagInfoPresentFlag(Int olsIdx, Bool x) { m_subLayerFlagInfoPresentFlag[olsIdx] = x;    }
     1416
     1417  Bool   getSubLayerDpbInfoPresentFlag(Int olsIdx, Int subLayerIdx)         { return m_subLayerDpbInfoPresentFlag[olsIdx][subLayerIdx]; }
     1418  Void   setSubLayerDpbInfoPresentFlag(Int olsIdx, Int subLayerIdx, Bool x) { m_subLayerDpbInfoPresentFlag[olsIdx][subLayerIdx] = x;    }
    14191419
    14201420  // For the 0-th output layer set, use the date from the active SPS for base layer.
    1421   Int    getMaxVpsDecPicBufferingMinus1(Int i, Int k, Int j)         { assert(i != 0); return m_maxVpsDecPicBufferingMinus1[i][k][j]; }
    1422   Void   setMaxVpsDecPicBufferingMinus1(Int i, Int k, Int j, Int x) { m_maxVpsDecPicBufferingMinus1[i][k][j] = x;    }
     1421  Int    getMaxVpsDecPicBufferingMinus1(Int olsIdx, Int subDpbIdx, Int subLayerIdx)        { assert(olsIdx != 0); return m_maxVpsDecPicBufferingMinus1[olsIdx][subDpbIdx][subLayerIdx]; }
     1422  Void   setMaxVpsDecPicBufferingMinus1(Int olsIdx, Int subDpbIdx, Int subLayerIdx, Int x) { m_maxVpsDecPicBufferingMinus1[olsIdx][subDpbIdx][subLayerIdx] = x;    }
     1423  Int    getLayerIdcInOls( Int olsIdx, Int layerId );
    14231424
    14241425#if RESOLUTION_BASED_DPB
     
    14271428#endif
    14281429
    1429   Int    getMaxVpsNumReorderPics(Int i, Int j)        { assert(i != 0); return m_maxVpsNumReorderPics[i][j]; }
    1430   Void   setMaxVpsNumReorderPics(Int i, Int j, Int x) { m_maxVpsNumReorderPics[i][j] = x;    }
    1431 
    1432   Int    getMaxVpsLatencyIncreasePlus1(Int i, Int j)        { assert(i != 0); return m_maxVpsLatencyIncreasePlus1[i][j]; }
    1433   Void   setMaxVpsLatencyIncreasePlus1(Int i, Int j, Int x) { m_maxVpsLatencyIncreasePlus1[i][j] = x;    }
    1434 
    1435   Int    getNumSubDpbs(Int i)                          { return m_numSubDpbs[i]; }
    1436   Void   setNumSubDpbs(Int i, Int x)                   { m_numSubDpbs[i] = x;    }
     1430  Int    getMaxVpsNumReorderPics(Int olsIdx, Int subLayerIdx)        { assert(olsIdx != 0); return m_maxVpsNumReorderPics[olsIdx][subLayerIdx]; }
     1431  Void   setMaxVpsNumReorderPics(Int olsIdx, Int subLayerIdx, Int x) { m_maxVpsNumReorderPics[olsIdx][subLayerIdx] = x;    }
     1432
     1433  Int    getMaxVpsLatencyIncreasePlus1(Int olsIdx, Int subLayerIdx)        { assert(olsIdx != 0); return m_maxVpsLatencyIncreasePlus1[olsIdx][subLayerIdx]; }
     1434  Void   setMaxVpsLatencyIncreasePlus1(Int olsIdx, Int subLayerIdx, Int x) { m_maxVpsLatencyIncreasePlus1[olsIdx][subLayerIdx] = x;    }
     1435
     1436  Int    getNumSubDpbs(Int olsIdx)                          { return m_numSubDpbs[olsIdx]; }
     1437  Void   setNumSubDpbs(Int olsIdx, Int x)                   { m_numSubDpbs[olsIdx] = x;    }
    14371438  Void   determineSubDpbInfoFlags();
    14381439#endif
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r1060 r1073  
    15361536          if(chkAssert)
    15371537          {
    1538             UInt layerIdx = pcSlice->getVPS()->getLayerIdxInVps(pcSlice->getLayerId());
    1539             assert(rps->getNumberOfNegativePictures() <= pcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1(ii, layerIdx, pcSlice->getVPS()->getMaxSLayersInLayerSetMinus1(ii)));
    1540             assert(rps->getNumberOfPositivePictures() <= pcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1(ii, layerIdx, pcSlice->getVPS()->getMaxSLayersInLayerSetMinus1(ii)) - rps->getNumberOfNegativePictures());
    1541             assert((rps->getNumberOfPositivePictures() + rps->getNumberOfNegativePictures() + rps->getNumberOfLongtermPictures()) <= pcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1(ii, layerIdx, pcSlice->getVPS()->getMaxSLayersInLayerSetMinus1(ii)));
     1538            UInt layerIdc = pcSlice->getVPS()->getLayerIdcInOls( ii, pcSlice->getLayerId() );
     1539            assert(rps->getNumberOfNegativePictures() <= pcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1(ii, layerIdc, pcSlice->getVPS()->getMaxSLayersInLayerSetMinus1(ii)));
     1540            assert(rps->getNumberOfPositivePictures() <= pcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1(ii, layerIdc, pcSlice->getVPS()->getMaxSLayersInLayerSetMinus1(ii)) - rps->getNumberOfNegativePictures());
     1541            assert((rps->getNumberOfPositivePictures() + rps->getNumberOfNegativePictures() + rps->getNumberOfLongtermPictures()) <= pcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1(ii, layerIdc, pcSlice->getVPS()->getMaxSLayersInLayerSetMinus1(ii)));
    15421542          }
    15431543        }
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp

    r1069 r1073  
    256256  {
    257257#if USE_DPB_SIZE_TABLE
    258     if( getCommonDecoderParams()->getTargetOutputLayerSetIdx() == 0 )
     258    if( m_commonDecoderParams->getTargetOutputLayerSetIdx() == 0 )
    259259    {
    260260      assert( this->getLayerId() == 0 );
     
    273273
    274274#if USE_DPB_SIZE_TABLE
    275   if( getCommonDecoderParams()->getTargetOutputLayerSetIdx() == 0 )
     275  if( m_commonDecoderParams->getTargetOutputLayerSetIdx() == 0 )
    276276  {
    277277    assert( this->getLayerId() == 0 );
     
    285285    m_iMaxRefPicNum = pcSlice->getVPS()->getMaxVpsLayerDecPicBuffMinus1( getCommonDecoderParams()->getTargetOutputLayerSetIdx(), layerIdx, pcSlice->getTLayer() ) + 1; // m_uiMaxDecPicBuffering has the space for the picture currently being decoded
    286286#else
    287     m_iMaxRefPicNum = pcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1( getCommonDecoderParams()->getTargetOutputLayerSetIdx(), pcSlice->getLayerId(), pcSlice->getTLayer() ) + 1; // m_uiMaxDecPicBuffering has the space for the picture currently being decoded
     287    m_iMaxRefPicNum = pcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1( m_commonDecoderParams->getTargetOutputLayerSetIdx(), pcSlice->getVPS()->getLayerIdcInOls( pcSlice->getVPS()->getOutputLayerSetIdx( m_commonDecoderParams->getTargetOutputLayerSetIdx()), pcSlice->getLayerId() ), pcSlice->getTLayer() ) + 1; // m_uiMaxDecPicBuffering has the space for the picture currently being decoded
    288288#endif
    289289  }
     
    300300    rpcPic = new TComPic();
    301301
    302 #if SVC_EXTENSION //Temporal solution, should be modified
     302#if SVC_EXTENSION
    303303    if(m_layerId > 0)
    304304    {
    305       for(UInt i = 0; i < pcSlice->getVPS()->getNumDirectRefLayers( m_layerId ); i++ )
    306       {
    307 #if MOVE_SCALED_OFFSET_TO_PPS
    308 #if O0098_SCALED_REF_LAYER_ID
    309         const Window scalEL = pcSlice->getPPS()->getScaledRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, i));
    310 #else
    311         const Window scalEL = pcSlice->getPPS()->getScaledRefLayerWindow(i);
    312 #endif
    313 #else
    314 #if O0098_SCALED_REF_LAYER_ID
    315         const Window scalEL = pcSlice->getSPS()->getScaledRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, i));
    316 #else
    317         const Window scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(i);
    318 #endif
    319 #endif
    320 #if REF_REGION_OFFSET
    321         const Window refEL = pcSlice->getPPS()->getRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, i));
    322 #if RESAMPLING_FIX
    323         Bool equalOffsets = scalEL.hasEqualOffset(refEL);
    324 #if R0209_GENERIC_PHASE
    325         Bool zeroPhase = pcSlice->getPPS()->hasZeroResamplingPhase(pcSlice->getVPS()->getRefLayerId(m_layerId, i));
    326 #endif
    327 #else
    328         Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0
    329                              && refEL.getWindowLeftOffset() == 0 && refEL.getWindowRightOffset() == 0 && refEL.getWindowTopOffset() == 0 && refEL.getWindowBottomOffset() == 0 );
    330 #endif
    331 #else
    332         Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0 );
    333 #endif
    334 
    335 #if VPS_EXTN_DIRECT_REF_LAYERS
    336         TDecTop *pcTDecTopBase = (TDecTop *)getRefLayerDec( i );
    337 #else
    338         TDecTop *pcTDecTopBase = (TDecTop *)getLayerDec( m_layerId-1 );
    339 #endif
    340         //TComPic*                      pcPic = *(pcTDecTopBase->getListPic()->begin());
    341         TComPicYuv* pcPicYuvRecBase = (*(pcTDecTopBase->getListPic()->begin()))->getPicYuvRec();
    342 #if REPN_FORMAT_IN_VPS
    343 #if O0194_DIFFERENT_BITDEPTH_EL_BL
    344         UInt refLayerId = pcSlice->getVPS()->getRefLayerId(m_layerId, i);
    345         Bool sameBitDepths = ( g_bitDepthLayer[CHANNEL_TYPE_LUMA][m_layerId] == g_bitDepthLayer[CHANNEL_TYPE_LUMA][refLayerId] ) && ( g_bitDepthLayer[CHANNEL_TYPE_CHROMA][m_layerId] == g_bitDepthLayer[CHANNEL_TYPE_CHROMA][refLayerId] );
    346 
    347 #if REF_IDX_MFM
    348         if( pcPicYuvRecBase->getWidth(COMPONENT_Y) == pcSlice->getPicWidthInLumaSamples() && pcPicYuvRecBase->getHeight(COMPONENT_Y) == pcSlice->getPicHeightInLumaSamples() && equalOffsets && zeroPhase )
    349         {
    350           rpcPic->setEqualPictureSizeAndOffsetFlag( i, true );
    351         }
    352 
    353         if( !rpcPic->equalPictureSizeAndOffsetFlag(i) || !sameBitDepths
    354 #else
    355         if( pcPicYuvRecBase->getWidth() != pcSlice->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getPicHeightInLumaSamples() || !sameBitDepths
    356 #if REF_REGION_OFFSET && RESAMPLING_FIX
    357           || !equalOffsets
    358 #if R0209_GENERIC_PHASE
    359           || !zeroPhase
    360 #endif
    361 #else
    362           || !zeroOffsets
    363 #endif
    364 #endif
    365 #if Q0048_CGS_3D_ASYMLUT
    366           || pcSlice->getPPS()->getCGSFlag() > 0
    367 #endif
    368 #if LAYER_CTB
    369           || pcTDecTopBase->getActiveSPS()->getMaxCUWidth() != m_ppcTDecTop[m_layerId]->getActiveSPS()->getMaxCUWidth() || pcTDecTopBase->getActiveSPS()->getMaxCUHeight() != m_ppcTDecTop[m_layerId]->getActiveSPS()->getMaxCUHeight() || pcTDecTopBase->getActiveSPS()->getMaxCUDepth() != m_ppcTDecTop[m_layerId]->getActiveSPS()->getMaxCUDepth()
    370 #endif
    371           )
    372 #else
    373         if(pcPicYuvRecBase->getWidth() != pcSlice->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getPicHeightInLumaSamples()
    374 #if REF_REGION_OFFSET && RESAMPLING_FIX
    375           || !equalOffsets
    376 #if R0209_GENERIC_PHASE
    377           || !zeroPhase
    378 #endif
    379 #else
    380           || !zeroOffsets
    381 #endif
    382         )
    383 #endif
    384 #else
    385         if(pcPicYuvRecBase->getWidth() != pcSlice->getSPS()->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getSPS()->getPicHeightInLumaSamples()
    386 #if REF_REGION_OFFSET && RESAMPLING_FIX
    387           || !equalOffsets
    388 #if R0209_GENERIC_PHASE
    389           || !zeroPhase
    390 #endif
    391 #else
    392           || !zeroOffsets
    393 #endif
    394         )
    395 #endif
    396         {
    397           rpcPic->setSpatialEnhLayerFlag( i, true );
    398 
    399           //only for scalable extension
    400           assert( pcSlice->getVPS()->getScalabilityMask( SCALABILITY_ID ) == true );
    401         }
    402       }
     305      xSetSpatialEnhLayerFlag( pcSlice, rpcPic );
    403306    }
    404307
     
    455358
    456359#if SVC_EXTENSION
     360  if( m_layerId > 0 )
     361  {
     362    xSetSpatialEnhLayerFlag( pcSlice, rpcPic );
     363  }
     364
    457365#if REPN_FORMAT_IN_VPS
    458366  rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), pcSlice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
     
    757665      assert( i < MAX_TLAYER );
    758666#if LAYER_DECPICBUFF_PARAM && RESOLUTION_BASED_DPB
    759       sps->setMaxDecPicBuffering( activeVPS->getMaxVpsLayerDecPicBuffMinus1( getCommonDecoderParams()->getTargetOutputLayerSetIdx(), sps->getLayerId(), i) + 1, i);
    760 #else
    761       sps->setMaxDecPicBuffering( activeVPS->getMaxVpsDecPicBufferingMinus1( getCommonDecoderParams()->getTargetOutputLayerSetIdx(), sps->getLayerId(), i) + 1, i);
     667      sps->setMaxDecPicBuffering( activeVPS->getMaxVpsLayerDecPicBuffMinus1( m_commonDecoderParams->getTargetOutputLayerSetIdx(), sps->getLayerId(), i) + 1, i);
     668#else
     669      sps->setMaxDecPicBuffering( activeVPS->getMaxVpsDecPicBufferingMinus1( m_commonDecoderParams->getTargetOutputLayerSetIdx(), activeVPS->getLayerIdcInOls( activeVPS->getOutputLayerSetIdx( m_commonDecoderParams->getTargetOutputLayerSetIdx() ), sps->getLayerId() ), i) + 1, i);
    762670#endif
    763671    }
     
    32993207#endif
    33003208
     3209Void TDecTop::xSetSpatialEnhLayerFlag(TComSlice* slice, TComPic* pic)
     3210{
     3211  for(UInt i = 0; i < slice->getVPS()->getNumDirectRefLayers( m_layerId ); i++ )
     3212  {
     3213    const Window scalEL = slice->getPPS()->getScaledRefLayerWindowForLayer(slice->getVPS()->getRefLayerId(m_layerId, i));
     3214    const Window refEL = slice->getPPS()->getRefLayerWindowForLayer(slice->getVPS()->getRefLayerId(m_layerId, i));
     3215    Bool equalOffsets = scalEL.hasEqualOffset(refEL);
     3216    Bool zeroPhase = slice->getPPS()->hasZeroResamplingPhase(slice->getVPS()->getRefLayerId(m_layerId, i));
     3217
     3218    TDecTop *pcTDecTopBase = (TDecTop *)getRefLayerDec( i );
     3219    //TComPic*                      pcPic = *(pcTDecTopBase->getListPic()->begin());
     3220    TComPicYuv* pcPicYuvRecBase = (*(pcTDecTopBase->getListPic()->begin()))->getPicYuvRec();
     3221
     3222    UInt refLayerId = slice->getVPS()->getRefLayerId(m_layerId, i);
     3223    Bool sameBitDepths = ( g_bitDepthLayer[CHANNEL_TYPE_LUMA][m_layerId] == g_bitDepthLayer[CHANNEL_TYPE_LUMA][refLayerId] ) && ( g_bitDepthLayer[CHANNEL_TYPE_CHROMA][m_layerId] == g_bitDepthLayer[CHANNEL_TYPE_CHROMA][refLayerId] );
     3224
     3225    if( pcPicYuvRecBase->getWidth(COMPONENT_Y) == slice->getPicWidthInLumaSamples() && pcPicYuvRecBase->getHeight(COMPONENT_Y) == slice->getPicHeightInLumaSamples() && equalOffsets && zeroPhase )
     3226    {
     3227      pic->setEqualPictureSizeAndOffsetFlag( i, true );
     3228    }
     3229
     3230    if( !pic->equalPictureSizeAndOffsetFlag(i) || !sameBitDepths
     3231#if Q0048_CGS_3D_ASYMLUT
     3232      || slice->getPPS()->getCGSFlag() > 0
     3233#endif
     3234#if LAYER_CTB
     3235      || pcTDecTopBase->getActiveSPS()->getMaxCUWidth() != m_ppcTDecTop[m_layerId]->getActiveSPS()->getMaxCUWidth() || pcTDecTopBase->getActiveSPS()->getMaxCUHeight() != m_ppcTDecTop[m_layerId]->getActiveSPS()->getMaxCUHeight() || pcTDecTopBase->getActiveSPS()->getMaxCUDepth() != m_ppcTDecTop[m_layerId]->getActiveSPS()->getMaxCUDepth()
     3236#endif
     3237      )
     3238    {
     3239      pic->setSpatialEnhLayerFlag( i, true );
     3240
     3241      //only for scalable extension
     3242      assert( slice->getVPS()->getScalabilityMask( SCALABILITY_ID ) == true );
     3243    }
     3244  }
     3245}
     3246
    33013247#endif //SVC_EXTENSION
    33023248
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.h

    r1057 r1073  
    336336  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC);
    337337#endif
     338  Void      xSetSpatialEnhLayerFlag(TComSlice* slice, TComPic* pic);
    338339#else
    339340  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay);
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp

    r1057 r1073  
    28012801#endif
    28022802#endif
    2803           WRITE_UVLC( vps->getMaxVpsDecPicBufferingMinus1( i, k, j), "max_vps_dec_pic_buffering_minus1[i][k][j]" );
     2803          WRITE_UVLC( vps->getMaxVpsDecPicBufferingMinus1( i, k, j ), "max_vps_dec_pic_buffering_minus1[i][k][j]" );
    28042804        }
    28052805        WRITE_UVLC( vps->getMaxVpsNumReorderPics( i, j), "max_vps_num_reorder_pics[i][j]" );             
Note: See TracChangeset for help on using the changeset viewer.