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


Ignore:
Timestamp:
24 Dec 2013, 18:24:19 (11 years ago)
Author:
seregin
Message:

N0371: Scaling list inferring with macro SCALINGLIST_INFERRING

Location:
branches/SHM-4.1-dev/source/Lib/TLibDecoder
Files:
3 edited

Legend:

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

    r525 r528  
    290290    }
    291291  }
     292
     293#if SCALINGLIST_INFERRING
     294  if( pcPPS->getLayerId() > 0 )
     295  {
     296    READ_FLAG( uiCode, "pps_infer_scaling_list_flag" );
     297    pcPPS->setInferScalingListFlag( uiCode );
     298  }
     299
     300  if( pcPPS->getInferScalingListFlag() )
     301  {
     302    READ_UVLC( uiCode, "pps_scaling_list_ref_layer_id" ); pcPPS->setScalingListRefLayerId( uiCode );
     303
     304    // The value of pps_scaling_list_ref_layer_id shall be in the range of 0 to 62, inclusive
     305    assert( pcPPS->getScalingListRefLayerId() <= 62 );
     306
     307    pcPPS->setScalingListPresentFlag( false );
     308  }
     309  else
     310  {
     311#endif
     312
    292313  READ_FLAG( uiCode, "pps_scaling_list_data_present_flag" );           pcPPS->setScalingListPresentFlag( uiCode ? true : false );
    293314
     
    343364#endif
    344365  }
     366
     367#if SCALINGLIST_INFERRING
     368  }
     369#endif
    345370
    346371  READ_FLAG( uiCode, "lists_modification_present_flag");
     
    716741  if(pcSPS->getScalingListFlag())
    717742  {
     743#if SCALINGLIST_INFERRING
     744    if( pcSPS->getLayerId() > 0 )
     745    {
     746      READ_FLAG( uiCode, "sps_infer_scaling_list_flag" ); pcSPS->setInferScalingListFlag( uiCode );
     747    }
     748
     749    if( pcSPS->getInferScalingListFlag() )
     750    {
     751      READ_UVLC( uiCode, "sps_scaling_list_ref_layer_id" ); pcSPS->setScalingListRefLayerId( uiCode );
     752
     753      // The value of pps_scaling_list_ref_layer_id shall be in the range of 0 to 62, inclusive
     754      assert( pcSPS->getScalingListRefLayerId() <= 62 );
     755
     756      pcSPS->setScalingListPresentFlag( false );
     757    }
     758    else
     759    {
     760#endif
    718761    READ_FLAG( uiCode, "sps_scaling_list_data_present_flag" );                 pcSPS->setScalingListPresentFlag ( uiCode );
    719762    if(pcSPS->getScalingListPresentFlag ())
     
    766809
    767810    }
     811#if SCALINGLIST_INFERRING
     812    }
     813#endif
    768814  }
    769815  READ_FLAG( uiCode, "amp_enabled_flag" );                          pcSPS->setUseAMP( uiCode );
  • branches/SHM-4.1-dev/source/Lib/TLibDecoder/TDecTop.cpp

    r526 r528  
    551551  printf("\ninserting lost poc : %d\n",iLostPoc);
    552552  TComSlice cFillSlice;
    553 #if SVC_EXTENSION
    554   cFillSlice.setSPS( m_parameterSetManagerDecoder[m_layerId].getFirstSPS() );
    555   cFillSlice.setPPS( m_parameterSetManagerDecoder[m_layerId].getFirstPPS() );
    556   cFillSlice.setVPS( m_parameterSetManagerDecoder[m_layerId].getFirstVPS() );
    557   cFillSlice.initSlice( m_layerId );
    558 #else
    559553  cFillSlice.setSPS( m_parameterSetManagerDecoder.getFirstSPS() );
    560554  cFillSlice.setPPS( m_parameterSetManagerDecoder.getFirstPPS() );
     555#if SVC_EXTENSION
     556  cFillSlice.setVPS( m_parameterSetManagerDecoder.getFirstVPS() );
     557  cFillSlice.initSlice( m_layerId );
     558#else
    561559  cFillSlice.initSlice();
    562560#endif
    563561  TComPic *cFillPic;
    564562  xGetNewPicBuffer(&cFillSlice,cFillPic);
    565 #if SVC_EXTENSION
    566   cFillPic->getSlice(0)->setSPS( m_parameterSetManagerDecoder[m_layerId].getFirstSPS() );
    567   cFillPic->getSlice(0)->setPPS( m_parameterSetManagerDecoder[m_layerId].getFirstPPS() );
    568   cFillPic->getSlice(0)->setVPS( m_parameterSetManagerDecoder[m_layerId].getFirstVPS() );
    569   cFillPic->getSlice(0)->initSlice( m_layerId );
    570 #else
    571563  cFillPic->getSlice(0)->setSPS( m_parameterSetManagerDecoder.getFirstSPS() );
    572564  cFillPic->getSlice(0)->setPPS( m_parameterSetManagerDecoder.getFirstPPS() );
     565#if SVC_EXTENSION
     566  cFillPic->getSlice(0)->setVPS( m_parameterSetManagerDecoder.getFirstVPS() );
     567  cFillPic->getSlice(0)->initSlice( m_layerId );
     568#else
    573569  cFillPic->getSlice(0)->initSlice();
    574570#endif
     
    613609Void TDecTop::xActivateParameterSets()
    614610{
    615 #if SVC_EXTENSION
    616   m_parameterSetManagerDecoder[m_layerId].applyPrefetchedPS();
    617  
    618   TComPPS *pps = m_parameterSetManagerDecoder[m_layerId].getPPS(m_apcSlicePilot->getPPSId());
    619   assert (pps != 0);
    620 
    621   TComSPS *sps = m_parameterSetManagerDecoder[m_layerId].getSPS(pps->getSPSId());
    622   assert (sps != 0);
    623 
    624   if( false == m_parameterSetManagerDecoder[m_layerId].activatePPS(m_apcSlicePilot->getPPSId(), m_apcSlicePilot->isIRAP()) )
    625 #else
    626611  m_parameterSetManagerDecoder.applyPrefetchedPS();
    627612 
     
    633618
    634619  if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP()))
    635 #endif
    636620  {
    637621    printf ("Parameter set activation failed!");
    638622    assert (0);
    639623  }
     624
     625#if SCALINGLIST_INFERRING
     626  // scaling list settings and checks
     627  TComVPS *activeVPS = m_parameterSetManagerDecoder.getActiveVPS();
     628  TComSPS *activeSPS = m_parameterSetManagerDecoder.getActiveSPS();
     629  TComPPS *activePPS = m_parameterSetManagerDecoder.getActivePPS();
     630
     631  if( activeSPS->getInferScalingListFlag() )
     632  {
     633    UInt refLayerId = activeSPS->getScalingListRefLayerId();
     634    TComSPS *refSps = m_ppcTDecTop[refLayerId]->getParameterSetManager()->getActiveSPS(); assert( refSps != NULL );
     635
     636    // When avc_base_layer_flag is equal to 1, it is a requirement of bitstream conformance that the value of sps_scaling_list_ref_layer_id shall be greater than 0
     637    if( activeVPS->getAvcBaseLayerFlag() )
     638    {
     639      assert( refLayerId > 0 );
     640    }
     641
     642    // It is a requirement of bitstream conformance that, when an SPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB and
     643    // sps_infer_scaling_list_flag in the SPS is equal to 1, sps_infer_scaling_list_flag shall be equal to 0 for the SPS that is active for the layer with nuh_layer_id equal to sps_scaling_list_ref_layer_id
     644    assert( refSps->getInferScalingListFlag() == false );
     645
     646    // It is a requirement of bitstream conformance that, when an SPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB,
     647    // the layer with nuh_layer_id equal to sps_scaling_list_ref_layer_id shall be a direct or indirect reference layer of the layer with nuh_layer_id equal to nuhLayerIdB
     648    assert( activeVPS->getRecursiveRefLayerFlag( activeSPS->getLayerId(), refLayerId ) == true );
     649   
     650    if( activeSPS->getScalingList() != refSps->getScalingList() )
     651    {
     652      // delete created instance of scaling list since it will be inferred
     653      delete activeSPS->getScalingList();
     654
     655      // infer scaling list
     656      activeSPS->setScalingList( refSps->getScalingList() );
     657    }
     658  }
     659
     660  if( activePPS->getInferScalingListFlag() )
     661  {
     662    UInt refLayerId = activePPS->getScalingListRefLayerId();
     663    TComPPS *refPps = m_ppcTDecTop[refLayerId]->getParameterSetManager()->getActivePPS(); assert( refPps != NULL );
     664
     665    // When avc_base_layer_flag is equal to 1, it is a requirement of bitstream conformance that the value of sps_scaling_list_ref_layer_id shall be greater than 0
     666    if( activeVPS->getAvcBaseLayerFlag() )
     667    {
     668      assert( refLayerId > 0 );
     669    }
     670
     671    // It is a requirement of bitstream conformance that, when an PPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB and
     672    // pps_infer_scaling_list_flag in the PPS is equal to 1, pps_infer_scaling_list_flag shall be equal to 0 for the PPS that is active for the layer with nuh_layer_id equal to pps_scaling_list_ref_layer_id
     673    assert( refPps->getInferScalingListFlag() == false );
     674
     675    // It is a requirement of bitstream conformance that, when an PPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB,
     676    // the layer with nuh_layer_id equal to pps_scaling_list_ref_layer_id shall be a direct or indirect reference layer of the layer with nuh_layer_id equal to nuhLayerIdB
     677    assert( activeVPS->getRecursiveRefLayerFlag( activePPS->getLayerId(), refLayerId ) == true );
     678   
     679    if( activePPS->getScalingList() != refPps->getScalingList() )
     680    {
     681      // delete created instance of scaling list since it will be inferred
     682      delete activePPS->getScalingList();
     683
     684      // infer scaling list
     685      activePPS->setScalingList( refPps->getScalingList() );
     686    }
     687
     688  }
     689#endif
    640690
    641691  if( pps->getDependentSliceSegmentsEnabledFlag() )
     
    709759  TComPic*&   pcPic         = m_pcPic;
    710760#if SVC_EXTENSION
    711   m_apcSlicePilot->setVPS( m_parameterSetManagerDecoder[m_layerId].getPrefetchedVPS(0) );
     761  m_apcSlicePilot->setVPS( m_parameterSetManagerDecoder.getPrefetchedVPS(0) );
    712762#if OUTPUT_LAYER_SET_INDEX
    713763  // Following check should go wherever the VPS is activated
     
    751801  m_apcSlicePilot->setNumSamplePredRefLayers( getNumSamplePredRefLayers() );
    752802#endif
    753   m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder[m_layerId]);
    754 #else
     803#endif
    755804  m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder);
    756 #endif
    757805
    758806  // set POC for dependent slices in skipped pictures
     
    950998  {
    951999#if AVC_BASE
    952     if( m_layerId == 1 && m_parameterSetManagerDecoder[0].getPrefetchedVPS(0)->getAvcBaseLayerFlag() )
     1000    if( m_layerId == 1 && m_parameterSetManagerDecoder.getPrefetchedVPS(0)->getAvcBaseLayerFlag() )
    9531001    {
    9541002      TComPic* pBLPic = (*m_ppcTDecTop[0]->getListPic()->begin());
     
    11871235        UInt refLayerIdc = i;
    11881236#if AVC_BASE
    1189         if( pcSlice->getVPS()->getRefLayerId( m_layerId, refLayerIdc ) == 0 && m_parameterSetManagerDecoder[0].getActiveVPS()->getAvcBaseLayerFlag() )
     1237        if( pcSlice->getVPS()->getRefLayerId( m_layerId, refLayerIdc ) == 0 && m_parameterSetManagerDecoder.getActiveVPS()->getAvcBaseLayerFlag() )
    11901238        {
    11911239          pcSlice->setBaseColPic ( refLayerIdc, *m_ppcTDecTop[0]->getListPic()->begin() );
     
    12781326        UInt refLayerIdc = pcSlice->getInterLayerPredLayerIdc(i);
    12791327#if AVC_BASE
    1280         if( pcSlice->getVPS()->getRefLayerId( m_layerId, refLayerIdc ) == 0 && m_parameterSetManagerDecoder[0].getActiveVPS()->getAvcBaseLayerFlag() )
     1328        if( pcSlice->getVPS()->getRefLayerId( m_layerId, refLayerIdc ) == 0 && m_parameterSetManagerDecoder.getActiveVPS()->getAvcBaseLayerFlag() )
    12811329        {
    12821330          pcSlice->setBaseColPic ( refLayerIdc, *m_ppcTDecTop[0]->getListPic()->begin() );
     
    14311479      pcSlice->setScalingList ( pcSlice->getPPS()->getScalingList()  );
    14321480    }
     1481#if SCALINGLIST_INFERRING
     1482    if( m_layerId == 0 || ( m_layerId > 0 && !pcSlice->getPPS()->getInferScalingListFlag() && !pcSlice->getSPS()->getInferScalingListFlag() ) )
     1483#endif
    14331484    if(!pcSlice->getPPS()->getScalingListPresentFlag() && !pcSlice->getSPS()->getScalingListPresentFlag())
    14341485    {
     
    14661517 
    14671518  m_cEntropyDecoder.decodeVPS( vps );
    1468 #if SVC_EXTENSION
    1469   m_parameterSetManagerDecoder[0].storePrefetchedVPS(vps);
    1470 #else
    14711519  m_parameterSetManagerDecoder.storePrefetchedVPS(vps); 
    1472 #endif
    14731520}
    14741521
     
    14781525#if SVC_EXTENSION
    14791526  sps->setLayerId(m_layerId);
    1480   m_cEntropyDecoder.decodeSPS( sps, &m_parameterSetManagerDecoder[0] );
    1481   m_parameterSetManagerDecoder[m_layerId].storePrefetchedSPS(sps);
     1527  m_cEntropyDecoder.decodeSPS( sps, &m_parameterSetManagerDecoder );
     1528  m_parameterSetManagerDecoder.storePrefetchedSPS(sps);
    14821529#if !REPN_FORMAT_IN_VPS   // ILRP can only be initialized at activation 
    14831530  if(m_numLayer>0)
     
    14961543  TComPPS* pps = new TComPPS();
    14971544
    1498 #if IL_SL_SIGNALLING_N0371
    1499   pps->setLayerId(m_layerId);
     1545#if SCALINGLIST_INFERRING || IL_SL_SIGNALLING_N0371
     1546  pps->setLayerId( m_layerId );
    15001547#endif
    15011548
    15021549  m_cEntropyDecoder.decodePPS( pps );
    1503 #if SVC_EXTENSION
    1504   m_parameterSetManagerDecoder[m_layerId].storePrefetchedPPS( pps );
    1505 #else
    15061550  m_parameterSetManagerDecoder.storePrefetchedPPS( pps );
    1507 #endif
    15081551
    15091552  if( pps->getDependentSliceSegmentsEnabledFlag() )
     
    15331576#endif
    15341577#if M0043_LAYERS_PRESENT_SEI
    1535     m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder[m_layerId].getActiveVPS(), m_parameterSetManagerDecoder[m_layerId].getActiveSPS() );
    1536 #else
    1537     m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder[m_layerId].getActiveSPS() );
     1578    m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveVPS(), m_parameterSetManagerDecoder.getActiveSPS() );
     1579#else
     1580    m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() );
    15381581#endif
    15391582  }
     
    15411584  {
    15421585#if M0043_LAYERS_PRESENT_SEI
    1543     m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder[m_layerId].getActiveVPS(), m_parameterSetManagerDecoder[m_layerId].getActiveSPS() );
    1544 #else
    1545     m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder[m_layerId].getActiveSPS() );
     1586    m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveVPS(), m_parameterSetManagerDecoder.getActiveSPS() );
     1587#else
     1588    m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() );
    15461589#endif
    15471590    SEIMessages activeParamSets = getSeisByType(m_SEIs, SEI::ACTIVE_PARAMETER_SETS);
     
    15491592    {
    15501593      SEIActiveParameterSets *seiAps = (SEIActiveParameterSets*)(*activeParamSets.begin());
    1551       m_parameterSetManagerDecoder[m_layerId].applyPrefetchedPS();
     1594      m_parameterSetManagerDecoder.applyPrefetchedPS();
    15521595      assert(seiAps->activeSeqParamSetId.size()>0);
    1553       if (! m_parameterSetManagerDecoder[m_layerId].activateSPSWithSEI(seiAps->activeSeqParamSetId[0] ))
     1596      if( !m_parameterSetManagerDecoder.activateSPSWithSEI( seiAps->activeSeqParamSetId[0] ) )
    15541597      {
    15551598        printf ("Warning SPS activation with Active parameter set SEI failed");
     
    16061649      xDecodeVPS();
    16071650#if AVC_BASE
    1608       if( m_parameterSetManagerDecoder[0].getPrefetchedVPS(0)->getAvcBaseLayerFlag() )
     1651      if( m_parameterSetManagerDecoder.getPrefetchedVPS(0)->getAvcBaseLayerFlag() )
    16091652      {
    16101653        if( !m_ppcTDecTop[0]->getBLReconFile()->good() )
     
    16321675      xDecodeSPS();
    16331676#if AVC_BASE
    1634       if( m_parameterSetManagerDecoder[0].getPrefetchedVPS(0)->getAvcBaseLayerFlag() )
     1677      if( m_parameterSetManagerDecoder.getPrefetchedVPS(0)->getAvcBaseLayerFlag() )
    16351678      {
    16361679        TComPic* pBLPic = (*m_ppcTDecTop[0]->getListPic()->begin());
     
    16381681        {
    16391682          // using EL SPS with spsId = 1
    1640           TComSPS* sps = m_parameterSetManagerDecoder[nalu.m_layerId].getPrefetchedSPS(1);
     1683          TComSPS* sps = m_parameterSetManagerDecoder.getPrefetchedSPS(1);
    16411684          Int  numReorderPics[MAX_TLAYER];
    16421685          Window &conformanceWindow = sps->getConformanceWindow();
     
    17871830TDecTop* TDecTop::getRefLayerDec( UInt refLayerIdc )
    17881831{
    1789   TComVPS* vps = m_parameterSetManagerDecoder[0].getActiveVPS();
     1832  TComVPS* vps = m_parameterSetManagerDecoder.getActiveVPS();
    17901833  if( vps->getNumDirectRefLayers( m_layerId ) <= 0 )
    17911834  {
  • branches/SHM-4.1-dev/source/Lib/TLibDecoder/TDecTop.h

    r521 r528  
    7272
    7373  TComList<TComPic*>      m_cListPic;         //  Dynamic buffer
    74 #if SVC_EXTENSION
    75   ParameterSetManagerDecoder m_parameterSetManagerDecoder[MAX_LAYERS];  // storage for parameter sets
    76 #else
    7774  ParameterSetManagerDecoder m_parameterSetManagerDecoder;  // storage for parameter sets
    78 #endif
    7975
    8076  TComSlice*              m_apcSlicePilot;
     
    249245  Void      checkValueOfOutputLayerSetIdx(TComVPS *vps);
    250246#endif
     247#if SCALINGLIST_INFERRING
     248  ParameterSetManagerDecoder* getParameterSetManager() { return &m_parameterSetManagerDecoder; }
     249#endif
    251250};// END CLASS DEFINITION TDecTop
    252251
Note: See TracChangeset for help on using the changeset viewer.