Changeset 292 in SHVCSoftware for branches


Ignore:
Timestamp:
18 Jun 2013, 23:11:33 (12 years ago)
Author:
vidyo
Message:

Implementation of M0043 - Layers Present SEI.
This is disabled by default. Enable this by setting M0043_LAYERS_PRESENT_SEI to 1

Location:
branches/SHM-2.1-dev/source
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncCfg.cpp

    r290 r292  
    821821  ("SEIGradualDecodingRefreshInfo",  m_gradualDecodingRefreshInfoEnabled,      0, "Control generation of gradual decoding refresh information SEI message")
    822822  ("SEIDecodingUnitInfo",             m_decodingUnitInfoSEIEnabled,                       0, "Control generation of decoding unit information SEI message.")
     823#if M0043_LAYERS_PRESENT_SEI
     824  ("SEILayersPresent",               m_layersPresentSEIEnabled,                0, "Control generation of layers present SEI message")
     825#endif
    823826#if L0208_SOP_DESCRIPTION_SEI
    824827  ("SEISOPDescription",              m_SOPDescriptionSEIEnabled,              0, "Control generation of SOP description SEI messages")
  • branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncCfg.h

    r288 r292  
    274274  Int       m_gradualDecodingRefreshInfoEnabled;
    275275  Int       m_decodingUnitInfoSEIEnabled;
     276#if M0043_LAYERS_PRESENT_SEI
     277  Int       m_layersPresentSEIEnabled;
     278#endif
    276279#if L0208_SOP_DESCRIPTION_SEI
    277280  Int       m_SOPDescriptionSEIEnabled;
  • branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r290 r292  
    388388    m_acTEncTop[layer].setGradualDecodingRefreshInfoEnabled( m_gradualDecodingRefreshInfoEnabled );
    389389    m_acTEncTop[layer].setDecodingUnitInfoSEIEnabled( m_decodingUnitInfoSEIEnabled );
     390#if M0043_LAYERS_PRESENT_SEI
     391    m_acTEncTop[layer].setLayersPresentSEIEnabled( m_layersPresentSEIEnabled );
     392#endif
    390393#if L0208_SOP_DESCRIPTION_SEI
    391394    m_acTEncTop[layer].setSOPDescriptionSEIEnabled( m_SOPDescriptionSEIEnabled );
     
    725728  m_cTEncTop.setGradualDecodingRefreshInfoEnabled( m_gradualDecodingRefreshInfoEnabled );
    726729  m_cTEncTop.setDecodingUnitInfoSEIEnabled( m_decodingUnitInfoSEIEnabled );
     730#if M0043_LAYERS_PRESENT_SEI
     731  m_cTEncTop.setLayersPresentSEIEnabled( m_layersPresentSEIEnabled );
     732#endif
    727733#if L0208_SOP_DESCRIPTION_SEI
    728734  m_cTEncTop.setSOPDescriptionSEIEnabled( m_SOPDescriptionSEIEnabled );
  • branches/SHM-2.1-dev/source/Lib/TLibCommon/SEI.h

    r191 r292  
    7272    SCALABLE_NESTING                     = 133,
    7373    REGION_REFRESH_INFO                  = 134,
     74#if M0043_LAYERS_PRESENT_SEI
     75    LAYERS_PRESENT                       = 137,
     76#endif
    7477  };
    7578 
     
    354357  Bool m_gdrForegroundFlag;
    355358};
     359
     360#if M0043_LAYERS_PRESENT_SEI
     361class SEILayersPresent : public SEI
     362{
     363public:
     364  PayloadType payloadType() const { return LAYERS_PRESENT; }
     365
     366  SEILayersPresent() {}
     367  virtual ~SEILayersPresent() {}
     368
     369  UInt m_activeVpsId;
     370  UInt m_vpsMaxLayers;
     371  Bool m_layerPresentFlag[MAX_LAYERS];
     372};
     373#endif
    356374
    357375#if L0208_SOP_DESCRIPTION_SEI
  • branches/SHM-2.1-dev/source/Lib/TLibCommon/TypeDef.h

    r291 r292  
    135135#define FIX1071 1 ///< Temporary fix for issue #1071
    136136
     137
     138#define M0043_LAYERS_PRESENT_SEI      0 ///< M0043: add layers present SEI
    137139#define L0208_SOP_DESCRIPTION_SEI     1 ///< L0208: add SOP descrioption SEI
    138140#define MAX_NUM_PICS_IN_SOP           1024
  • branches/SHM-2.1-dev/source/Lib/TLibDecoder/SEIread.cpp

    r191 r292  
    9595    break;
    9696#endif
     97#if M0043_LAYERS_PRESENT_SEI
     98  case SEI::LAYERS_PRESENT:
     99    fprintf( g_hTrace, "=========== Layers Present SEI message ===========\n");
     100    break;
     101#endif
    97102#if L0208_SOP_DESCRIPTION_SEI
    98103  case SEI::SOP_DESCRIPTION:
     
    115120 * unmarshal a single SEI message from bitstream bs
    116121 */
     122#if M0043_LAYERS_PRESENT_SEI
     123void SEIReader::parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps)
     124#else
    117125void SEIReader::parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps)
     126#endif
    118127{
    119128  setBitstream(bs);
     
    122131  do
    123132  {
     133#if M0043_LAYERS_PRESENT_SEI
     134    xReadSEImessage(seis, nalUnitType, vps, sps);
     135#else
    124136    xReadSEImessage(seis, nalUnitType, sps);
     137#endif
    125138    /* SEI messages are an integer number of bytes, something has failed
    126139    * in the parsing if bitstream not byte-aligned */
     
    133146}
    134147
     148#if M0043_LAYERS_PRESENT_SEI
     149Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps)
     150#else
    135151Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps)
     152#endif
    136153{
    137154#if ENC_DEC_TRACE
     
    240257      break;
    241258#endif
     259#if M0043_LAYERS_PRESENT_SEI
     260    case SEI::LAYERS_PRESENT:
     261      if (!vps)
     262      {
     263        printf ("Warning: Found Layers present SEI message, but no active VPS is available. Ignoring.");
     264      }
     265      else
     266      {
     267        sei = new SEILayersPresent;
     268        xParseSEILayersPresent((SEILayersPresent&) *sei, payloadSize, vps);
     269      }
     270      break;
     271#endif
    242272#if L0208_SOP_DESCRIPTION_SEI
    243273    case SEI::SOP_DESCRIPTION:
     
    249279    case SEI::SCALABLE_NESTING:
    250280      sei = new SEIScalableNesting;
     281#if M0043_LAYERS_PRESENT_SEI
     282      xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, vps, sps);
     283#else
    251284      xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, sps);
     285#endif
    252286      break;
    253287#endif
     
    751785#endif
    752786
     787#if M0043_LAYERS_PRESENT_SEI
     788Void SEIReader::xParseSEILayersPresent(SEILayersPresent &sei, UInt payloadSize, TComVPS *vps)
     789{
     790  UInt uiCode;
     791  UInt i = 0;
     792
     793  READ_UVLC( uiCode,           "lp_sei_active_vps_id" ); sei.m_activeVpsId = uiCode;
     794  assert(vps->getVPSId() == sei.m_activeVpsId);
     795  sei.m_vpsMaxLayers = vps->getMaxLayers();
     796  for (; i < sei.m_vpsMaxLayers; i++)
     797  {
     798    READ_FLAG( uiCode,         "layer_present_flag"   ); sei.m_layerPresentFlag[i] = uiCode ? true : false;
     799  }
     800  for (; i < MAX_LAYERS; i++)
     801  {
     802    sei.m_layerPresentFlag[i] = false;
     803  }
     804  xParseByteAlign();
     805}
     806#endif
     807
    753808#if L0208_SOP_DESCRIPTION_SEI
    754809Void SEIReader::xParseSEISOPDescription(SEISOPDescription &sei, UInt payloadSize)
     
    777832#endif
    778833
     834
    779835#if K0180_SCALABLE_NESTING_SEI
     836#if M0043_LAYERS_PRESENT_SEI
     837Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComVPS *vps, TComSPS *sps)
     838#else
    780839Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComSPS *sps)
     840#endif
    781841{
    782842  UInt uiCode;
     
    820880  // read nested SEI messages
    821881  do {
     882#if M0043_LAYERS_PRESENT_SEI
     883    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, vps, sps);
     884#else
    822885    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps);
     886#endif
    823887  } while (m_pcBitstream->getNumBitsLeft() > 8);
    824888
  • branches/SHM-2.1-dev/source/Lib/TLibDecoder/SEIread.h

    r191 r292  
    5656  SEIReader() {};
    5757  virtual ~SEIReader() {};
     58#if M0043_LAYERS_PRESENT_SEI
     59  Void parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps);
     60#else
    5861  Void parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps);
     62#endif
    5963protected:
     64#if M0043_LAYERS_PRESENT_SEI
     65  Void xReadSEImessage                (SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps);
     66#else
    6067  Void xReadSEImessage                (SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps);
     68#endif
    6169  Void xParseSEIuserDataUnregistered  (SEIuserDataUnregistered &sei, UInt payloadSize);
    6270  Void xParseSEIActiveParameterSets   (SEIActiveParameterSets  &sei, UInt payloadSize);
     
    7381  Void xParseSEIToneMappingInfo       (SEIToneMappingInfo& sei, UInt payloadSize);
    7482#endif
     83#if M0043_LAYERS_PRESENT_SEI
     84  Void xParseSEILayersPresent         (SEILayersPresent &sei, UInt payloadSize, TComVPS *vps);
     85#endif
    7586#if L0208_SOP_DESCRIPTION_SEI
    7687  Void xParseSEISOPDescription        (SEISOPDescription &sei, UInt payloadSize);
    7788#endif
    7889#if K0180_SCALABLE_NESTING_SEI
     90#if M0043_LAYERS_PRESENT_SEI
     91  Void xParseSEIScalableNesting       (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComVPS *vps, TComSPS *sps);
     92#else
    7993  Void xParseSEIScalableNesting       (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComSPS *sps);
     94#endif
    8095#endif
    8196  Void xParseByteAlign();
  • branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecTop.cpp

    r291 r292  
    10981098  if(nalUnitType == NAL_UNIT_SUFFIX_SEI)
    10991099  {
     1100#if M0043_LAYERS_PRESENT_SEI
     1101    m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder[m_layerId].getActiveVPS(), m_parameterSetManagerDecoder[m_layerId].getActiveSPS() );
     1102#else
    11001103    m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder[m_layerId].getActiveSPS() );
     1104#endif
    11011105  }
    11021106  else
    11031107  {
     1108#if M0043_LAYERS_PRESENT_SEI
     1109    m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder[m_layerId].getActiveVPS(), m_parameterSetManagerDecoder[m_layerId].getActiveSPS() );
     1110#else
    11041111    m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder[m_layerId].getActiveSPS() );
     1112#endif
    11051113    SEIMessages activeParamSets = getSeisByType(m_SEIs, SEI::ACTIVE_PARAMETER_SETS);
    11061114    if (activeParamSets.size()>0)
     
    11181126  if(nalUnitType == NAL_UNIT_SUFFIX_SEI)
    11191127  {
     1128#if M0043_LAYERS_PRESENT_SEI
     1129    m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveVPS(), m_parameterSetManagerDecoder.getActiveSPS() );
     1130#else
    11201131    m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() );
     1132#endif
    11211133  }
    11221134  else
    11231135  {
     1136#if M0043_LAYERS_PRESENT_SEI
     1137    m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveVPS(), m_parameterSetManagerDecoder.getActiveSPS() );
     1138#else
    11241139    m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() );
     1140#endif
    11251141    SEIMessages activeParamSets = getSeisByType(m_SEIs, SEI::ACTIVE_PARAMETER_SETS);
    11261142    if (activeParamSets.size()>0)
  • branches/SHM-2.1-dev/source/Lib/TLibEncoder/SEIwrite.cpp

    r191 r292  
    8989    break;
    9090#endif
     91#if M0043_LAYERS_PRESENT_SEI
     92  case SEI::LAYERS_PRESENT:
     93    fprintf( g_hTrace, "=========== Layers Present SEI message ===========\n");
     94    break;
     95#endif
    9196#if L0208_SOP_DESCRIPTION_SEI
    9297  case SEI::SOP_DESCRIPTION:
     
    150155  case SEI::TONE_MAPPING_INFO:
    151156    xWriteSEIToneMappingInfo(*static_cast<const SEIToneMappingInfo*>(&sei));
     157    break;
     158#endif
     159#if M0043_LAYERS_PRESENT_SEI
     160  case SEI::LAYERS_PRESENT:
     161    xWriteSEILayersPresent(*static_cast<const SEILayersPresent*>(&sei));
    152162    break;
    153163#endif
     
    591601}
    592602
     603#if M0043_LAYERS_PRESENT_SEI
     604Void SEIWriter::xWriteSEILayersPresent(const SEILayersPresent& sei)
     605{
     606  WRITE_UVLC( sei.m_activeVpsId,           "lp_sei_active_vps_id" );
     607  for (UInt i = 0; i < sei.m_vpsMaxLayers; i++)
     608  {
     609    WRITE_FLAG( sei.m_layerPresentFlag[i], "layer_present_flag"   );
     610  }
     611  xWriteByteAlign();
     612}
     613#endif
     614
    593615#if L0208_SOP_DESCRIPTION_SEI
    594616Void SEIWriter::xWriteSEISOPDescription(const SEISOPDescription& sei)
  • branches/SHM-2.1-dev/source/Lib/TLibEncoder/SEIwrite.h

    r191 r292  
    7070  Void xWriteSEIToneMappingInfo(const SEIToneMappingInfo& sei);
    7171#endif
     72#if M0043_LAYERS_PRESENT_SEI
     73  Void xWriteSEILayersPresent(const SEILayersPresent& sei);
     74#endif
    7275#if L0208_SOP_DESCRIPTION_SEI
    7376  Void xWriteSEISOPDescription(const SEISOPDescription& sei);
  • branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncCfg.h

    r290 r292  
    289289  Int       m_gradualDecodingRefreshInfoEnabled;
    290290  Int       m_decodingUnitInfoSEIEnabled;
     291#if M0043_LAYERS_PRESENT_SEI
     292  Int       m_layersPresentSEIEnabled;
     293#endif
    291294#if L0208_SOP_DESCRIPTION_SEI
    292295  Int       m_SOPDescriptionSEIEnabled;
     
    733736  Void  setDecodingUnitInfoSEIEnabled(Int b)                { m_decodingUnitInfoSEIEnabled = b;    }
    734737  Int   getDecodingUnitInfoSEIEnabled()                     { return m_decodingUnitInfoSEIEnabled; }
     738#if M0043_LAYERS_PRESENT_SEI
     739  Void  setLayersPresentSEIEnabled(Int b)                { m_layersPresentSEIEnabled = b; }
     740  Int   getLayersPresentSEIEnabled()                     { return m_layersPresentSEIEnabled; }
     741#endif
    735742#if L0208_SOP_DESCRIPTION_SEI
    736743  Void  setSOPDescriptionSEIEnabled(Int b)                { m_SOPDescriptionSEIEnabled = b; }
  • branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r291 r292  
    173173}
    174174
     175#if M0043_LAYERS_PRESENT_SEI
     176SEILayersPresent* TEncGOP::xCreateSEILayersPresent ()
     177{
     178  UInt i = 0;
     179  SEILayersPresent *seiLayersPresent = new SEILayersPresent();
     180  seiLayersPresent->m_activeVpsId = m_pcCfg->getVPS()->getVPSId();
     181  seiLayersPresent->m_vpsMaxLayers = m_pcCfg->getVPS()->getMaxLayers();
     182  for ( ; i < seiLayersPresent->m_vpsMaxLayers; i++)
     183  {
     184    seiLayersPresent->m_layerPresentFlag[i] = true;
     185  }
     186  for ( ; i < MAX_LAYERS; i++)
     187  {
     188    seiLayersPresent->m_layerPresentFlag[i] = false;
     189  }
     190  return seiLayersPresent;
     191}
     192#endif
     193
    175194SEIFramePacking* TEncGOP::xCreateSEIFramePacking()
    176195{
     
    319338#endif
    320339  }
     340
     341#if M0043_LAYERS_PRESENT_SEI
     342  if(m_pcCfg->getLayersPresentSEIEnabled())
     343  {
     344    SEILayersPresent *sei = xCreateSEILayersPresent ();
     345    m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     346    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps);
     347    writeRBSPTrailingBits(nalu.m_Bitstream);
     348    accessUnit.push_back(new NALUnitEBSP(nalu));
     349    delete sei;
     350  }
     351#endif
    321352
    322353  if(m_pcCfg->getFramePackingArrangementSEIEnabled())
  • branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncGOP.h

    r291 r292  
    180180
    181181  SEIActiveParameterSets* xCreateSEIActiveParameterSets (TComSPS *sps);
     182#if M0043_LAYERS_PRESENT_SEI
     183  SEILayersPresent*       xCreateSEILayersPresent ();
     184#endif
    182185  SEIFramePacking*        xCreateSEIFramePacking();
    183186  SEIDisplayOrientation*  xCreateSEIDisplayOrientation();
Note: See TracChangeset for help on using the changeset viewer.