Changeset 628 in SHVCSoftware


Ignore:
Timestamp:
14 Mar 2014, 15:29:06 (11 years ago)
Author:
nokia
Message:

Integrated JCTVC-O0164: Multi-layer HRD operation

Location:
branches/SHM-5.1-dev/source
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-5.1-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r627 r628  
    13591359#endif
    13601360
     1361#if O0164_MULTI_LAYER_HRD
     1362  vps->setVpsVuiBspHrdPresentFlag(false);
     1363  TEncTop *pcCfg = &m_acTEncTop[0];
     1364  if( pcCfg->getBufferingPeriodSEIEnabled() )
     1365  {
     1366    vps->setVpsVuiBspHrdPresentFlag(true);
     1367    vps->setVpsNumBspHrdParametersMinus1(vps->getNumLayerSets() - 2);
     1368    vps->createBspHrdParamBuffer(vps->getVpsNumBspHrdParametersMinus1() + 1);
     1369    for (UInt i = 0; i <= vps->getVpsNumBspHrdParametersMinus1(); i++)
     1370    {
     1371      vps->setBspCprmsPresentFlag(i, true);
     1372
     1373      UInt layerId = i + 1;
     1374      TEncTop *pcCfgLayer = &m_acTEncTop[layerId];
     1375
     1376      Int iPicWidth         = pcCfgLayer->getSourceWidth();
     1377      Int iPicHeight        = pcCfgLayer->getSourceHeight();
     1378      UInt uhTotalDepth      = m_uiMaxCUDepth;
     1379      UInt uiNumPartitions   = 1<<(uhTotalDepth<<1);
     1380      UInt uiMinCUWidth      = m_uiMaxCUWidth  >> uhTotalDepth;
     1381      UInt uiMinCUHeight     = m_uiMaxCUHeight >> uhTotalDepth;
     1382      UInt uiWidthInCU       = ( iPicWidth %m_uiMaxCUWidth  ) ? iPicWidth /m_uiMaxCUWidth  + 1 : iPicWidth /m_uiMaxCUWidth;
     1383      UInt uiHeightInCU      = ( iPicHeight%m_uiMaxCUHeight ) ? iPicHeight/m_uiMaxCUHeight + 1 : iPicHeight/m_uiMaxCUHeight;
     1384      UInt uiNumCUsInFrame   = uiWidthInCU * uiHeightInCU;
     1385
     1386      UInt maxCU = pcCfgLayer->getSliceArgument() >> ( m_uiMaxCUDepth << 1);
     1387      UInt numDU = ( pcCfgLayer->getSliceMode() == 1 ) ? ( uiNumCUsInFrame / maxCU ) : ( 0 );
     1388      if( uiNumCUsInFrame % maxCU != 0 || numDU == 0 )
     1389      {
     1390        numDU ++;
     1391      }
     1392      vps->getBspHrd(i)->setNumDU( numDU );
     1393      vps->setBspHrdParameters( i, pcCfgLayer->getFrameRate(), numDU, pcCfgLayer->getTargetBitrate(), ( pcCfgLayer->getIntraPeriod() > 0 ) );
     1394    }
     1395    for (UInt h = 1; h <= (vps->getNumLayerSets()-1); h++)
     1396    {
     1397      vps->setNumBitstreamPartitions(h, 1);
     1398      for (UInt i = 0; i < vps->getNumBitstreamPartitions(h); i++)
     1399      {
     1400        for (UInt j = 0; j <= (vps->getMaxLayers()-1); j++)
     1401        {
     1402          if (vps->getLayerIdIncludedFlag(h, j) && h == j)
     1403          {
     1404            vps->setLayerInBspFlag(h, i, j, true);
     1405          }
     1406        }
     1407      }
     1408      vps->setNumBspSchedCombinations(h, 1);
     1409      for (UInt i = 0; i < vps->getNumBspSchedCombinations(h); i++)
     1410      {
     1411        for (UInt j = 0; j < vps->getNumBitstreamPartitions(h); j++)
     1412        {
     1413          vps->setBspCombHrdIdx(h, i, j, 0);
     1414          vps->setBspCombSchedIdx(h, i, j, 0);
     1415        }
     1416      }
     1417    }
     1418  }
     1419#endif
     1420
    13611421#else //SVC_EXTENSION
    13621422  m_cTEncTop.init(isFieldCoding);
  • branches/SHM-5.1-dev/source/Lib/TLibCommon/SEI.h

    r616 r628  
    4040//! \{
    4141class TComSPS;
     42#if O0164_MULTI_LAYER_HRD
     43class TComHRD;
     44#endif
    4245
    4346/**
     
    8184   ,SUB_BITSTREAM_PROPERTY               = 139    // Final PayloadType to be defined after finalization
    8285#endif
     86#if O0164_MULTI_LAYER_HRD
     87   ,BSP_NESTING                          = 140
     88   ,BSP_INITIAL_ARRIVAL_TIME             = 141
     89   ,BSP_HRD                              = 142
     90#endif
    8391  };
    8492 
     
    448456Void deleteSEIs (SEIMessages &seiList);
    449457
     458#if O0164_MULTI_LAYER_HRD
     459
     460class SEIBspNesting : public SEI
     461{
     462public:
     463  PayloadType payloadType() const { return BSP_NESTING; }
     464
     465  SEIBspNesting() {}
     466  virtual ~SEIBspNesting()
     467  {
     468    if (!m_callerOwnsSEIs)
     469    {
     470      deleteSEIs(m_nestedSEIs);
     471    }
     472  }
     473
     474  Int  m_bspIdx;
     475  Bool  m_callerOwnsSEIs;
     476  SEIMessages m_nestedSEIs;
     477};
     478
     479class SEIBspInitialArrivalTime : public SEI
     480{
     481public:
     482  PayloadType payloadType() const { return BSP_INITIAL_ARRIVAL_TIME; }
     483
     484  SEIBspInitialArrivalTime () {}
     485  virtual ~SEIBspInitialArrivalTime () {}
     486
     487  UInt m_nalInitialArrivalDelay[256];
     488  UInt m_vclInitialArrivalDelay[256];
     489};
     490
     491class SEIBspHrd : public SEI
     492{
     493public:
     494  PayloadType payloadType() const { return BSP_HRD; }
     495
     496  SEIBspHrd () {}
     497  virtual ~SEIBspHrd () {}
     498
     499  UInt m_seiNumBspHrdParametersMinus1;
     500  Bool m_seiBspCprmsPresentFlag[MAX_VPS_LAYER_SETS_PLUS1];
     501  UInt m_seiNumBitstreamPartitionsMinus1[MAX_VPS_LAYER_SETS_PLUS1];
     502  Bool m_seiLayerInBspFlag[MAX_VPS_LAYER_SETS_PLUS1][8][MAX_LAYERS];
     503  UInt m_seiNumBspSchedCombinationsMinus1[MAX_VPS_LAYER_SETS_PLUS1];
     504  UInt m_seiBspCombHrdIdx[MAX_VPS_LAYER_SETS_PLUS1][16][16];
     505  UInt m_seiBspCombScheddx[MAX_VPS_LAYER_SETS_PLUS1][16][16];
     506  UInt m_vpsMaxLayers;
     507  Bool m_layerIdIncludedFlag[MAX_VPS_LAYER_SETS_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
     508
     509  TComHRD *hrd;
     510};
     511
     512#endif
     513
    450514class SEIScalableNesting : public SEI
    451515{
  • branches/SHM-5.1-dev/source/Lib/TLibCommon/TComRom.h

    r595 r628  
    159159
    160160#ifndef ENC_DEC_TRACE
    161 # define ENC_DEC_TRACE 0
     161# define ENC_DEC_TRACE 1
    162162#endif
    163163
  • branches/SHM-5.1-dev/source/Lib/TLibCommon/TComSlice.cpp

    r627 r628  
    24832483  return -1;  // Layer not found
    24842484}
     2485#if O0164_MULTI_LAYER_HRD
     2486Void TComVPS::setBspHrdParameters( UInt hrdIdx, UInt frameRate, UInt numDU, UInt bitRate, Bool randomAccess )
     2487{
     2488  if( !getVpsVuiBspHrdPresentFlag() )
     2489  {
     2490    return;
     2491  }
     2492
     2493  TComHRD *hrd = getBspHrd(hrdIdx);
     2494
     2495  Bool rateCnt = ( bitRate > 0 );
     2496  hrd->setNalHrdParametersPresentFlag( rateCnt );
     2497  hrd->setVclHrdParametersPresentFlag( rateCnt );
     2498
     2499  hrd->setSubPicCpbParamsPresentFlag( ( numDU > 1 ) );
     2500
     2501  if( hrd->getSubPicCpbParamsPresentFlag() )
     2502  {
     2503    hrd->setTickDivisorMinus2( 100 - 2 );                          //
     2504    hrd->setDuCpbRemovalDelayLengthMinus1( 7 );                    // 8-bit precision ( plus 1 for last DU in AU )
     2505    hrd->setSubPicCpbParamsInPicTimingSEIFlag( true );
     2506    hrd->setDpbOutputDelayDuLengthMinus1( 5 + 7 );                 // With sub-clock tick factor of 100, at least 7 bits to have the same value as AU dpb delay
     2507  }
     2508  else
     2509  {
     2510    hrd->setSubPicCpbParamsInPicTimingSEIFlag( false ); 
     2511  }
     2512
     2513  hrd->setBitRateScale( 4 );                                       // in units of 2~( 6 + 4 ) = 1,024 bps
     2514  hrd->setCpbSizeScale( 6 );                                       // in units of 2~( 4 + 4 ) = 1,024 bit
     2515  hrd->setDuCpbSizeScale( 6 );                                       // in units of 2~( 4 + 4 ) = 1,024 bit
     2516
     2517  hrd->setInitialCpbRemovalDelayLengthMinus1(15);                  // assuming 0.5 sec, log2( 90,000 * 0.5 ) = 16-bit
     2518  if( randomAccess )
     2519  {
     2520    hrd->setCpbRemovalDelayLengthMinus1(5);                        // 32 = 2^5 (plus 1)
     2521    hrd->setDpbOutputDelayLengthMinus1 (5);                        // 32 + 3 = 2^6
     2522  }
     2523  else
     2524  {
     2525    hrd->setCpbRemovalDelayLengthMinus1(9);                        // max. 2^10
     2526    hrd->setDpbOutputDelayLengthMinus1 (9);                        // max. 2^10
     2527  }
     2528
     2529  /*
     2530  Note: only the case of "vps_max_temporal_layers_minus1 = 0" is supported.
     2531  */
     2532  Int i, j;
     2533  UInt birateValue, cpbSizeValue;
     2534  UInt ducpbSizeValue;
     2535  UInt duBitRateValue = 0;
     2536
     2537  for( i = 0; i < MAX_TLAYER; i ++ )
     2538  {
     2539    hrd->setFixedPicRateFlag( i, 1 );
     2540    hrd->setPicDurationInTcMinus1( i, 0 );
     2541    hrd->setLowDelayHrdFlag( i, 0 );
     2542    hrd->setCpbCntMinus1( i, 0 );
     2543
     2544    birateValue  = bitRate;
     2545    cpbSizeValue = bitRate;                                     // 1 second
     2546    ducpbSizeValue = bitRate/numDU;
     2547    duBitRateValue = bitRate;
     2548    for( j = 0; j < ( hrd->getCpbCntMinus1( i ) + 1 ); j ++ )
     2549    {
     2550      hrd->setBitRateValueMinus1( i, j, 0, ( birateValue  - 1 ) );
     2551      hrd->setCpbSizeValueMinus1( i, j, 0, ( cpbSizeValue - 1 ) );
     2552      hrd->setDuCpbSizeValueMinus1( i, j, 0, ( ducpbSizeValue - 1 ) );
     2553      hrd->setCbrFlag( i, j, 0, ( j == 0 ) );
     2554
     2555      hrd->setBitRateValueMinus1( i, j, 1, ( birateValue  - 1) );
     2556      hrd->setCpbSizeValueMinus1( i, j, 1, ( cpbSizeValue - 1 ) );
     2557      hrd->setDuCpbSizeValueMinus1( i, j, 1, ( ducpbSizeValue - 1 ) );
     2558      hrd->setDuBitRateValueMinus1( i, j, 1, ( duBitRateValue - 1 ) );
     2559      hrd->setCbrFlag( i, j, 1, ( j == 0 ) );
     2560    }
     2561  }
     2562}
     2563#endif
    24852564// RepFormat Assignment operator
    24862565RepFormat& RepFormat::operator= (const RepFormat &other)
  • branches/SHM-5.1-dev/source/Lib/TLibCommon/TComSlice.h

    r627 r628  
    685685#endif
    686686
     687#if O0164_MULTI_LAYER_HRD
     688  Bool       m_vpsVuiBspHrdPresentFlag;
     689  UInt       m_vpsNumBspHrdParametersMinus1;
     690  Bool       m_bspCprmsPresentFlag[MAX_VPS_LAYER_SETS_PLUS1];
     691  TComHRD    *m_bspHrd;
     692  UInt       m_numBitstreamPartitions[MAX_VPS_LAYER_SETS_PLUS1];
     693  Bool       m_layerInBspFlag[MAX_VPS_LAYER_SETS_PLUS1][8][MAX_LAYERS];
     694  UInt       m_numBspSchedCombinations[MAX_VPS_LAYER_SETS_PLUS1];
     695  UInt       m_bspCombHrdIdx[MAX_VPS_LAYER_SETS_PLUS1][16][16];
     696  UInt       m_bspCombSchedIdx[MAX_VPS_LAYER_SETS_PLUS1][16][16];
     697#endif
     698
    687699#if P0182_VPS_VUI_PS_FLAG
    688700  UInt        m_SPSId[MAX_LAYERS];
     
    713725    m_cprmsPresentFlag = new Bool   [ getNumHrdParameters() ];
    714726  }
     727
     728#if O0164_MULTI_LAYER_HRD
     729  Void    createBspHrdParamBuffer(UInt numHrds)
     730  {
     731    m_bspHrd    = new TComHRD[ numHrds ];
     732//    m_hrdOpSetIdx      = new UInt   [ getNumHrdParameters() ];
     733//    m_cprmsPresentFlag = new Bool   [ getNumHrdParameters() ];
     734  }
     735#endif
    715736
    716737  TComHRD* getHrdParameters   ( UInt i )             { return &m_hrdParameters[ i ]; }
     
    10051026  Void setAvgPicRate(Int i, Int j, Int x)   { m_avgPicRate[i][j] = x;    }
    10061027#endif
     1028#if O0164_MULTI_LAYER_HRD
     1029  Bool     getVpsVuiBspHrdPresentFlag()                         { return m_vpsVuiBspHrdPresentFlag;      }
     1030  Void     setVpsVuiBspHrdPresentFlag(Bool x)                   { m_vpsVuiBspHrdPresentFlag = x;         }
     1031  UInt     getVpsNumBspHrdParametersMinus1()                    { return m_vpsNumBspHrdParametersMinus1; }
     1032  Void     setVpsNumBspHrdParametersMinus1(UInt i)              { m_vpsNumBspHrdParametersMinus1 = i;    }
     1033  Bool     getBspCprmsPresentFlag(UInt i)                       { return m_bspCprmsPresentFlag[i];       }
     1034  Void     setBspCprmsPresentFlag(UInt i, Bool val)             { m_bspCprmsPresentFlag[i] = val;        }
     1035  TComHRD* getBspHrd(UInt i)                                    { return &m_bspHrd[i];                    }
     1036  UInt     getNumBitstreamPartitions(UInt i)                    { return m_numBitstreamPartitions[i];    }
     1037  Void     setNumBitstreamPartitions(UInt i, UInt val)          { m_numBitstreamPartitions[i] = val;     }
     1038  UInt     getLayerInBspFlag(UInt h, UInt i, UInt j)            { return m_layerInBspFlag[h][i][j];      }
     1039  Void     setLayerInBspFlag(UInt h, UInt i, UInt j, UInt val)  { m_layerInBspFlag[h][i][j] = val;       }
     1040  UInt     getNumBspSchedCombinations(UInt i)                   { return m_numBspSchedCombinations[i];   }
     1041  Void     setNumBspSchedCombinations(UInt i, UInt val)         { m_numBspSchedCombinations[i] = val;    }
     1042  UInt     getBspCombHrdIdx(UInt h, UInt i, UInt j)             { return m_bspCombHrdIdx[h][i][j];       }
     1043  Void     setBspCombHrdIdx(UInt h, UInt i, UInt j, UInt val)   { m_bspCombHrdIdx[h][i][j] = val;        }
     1044  UInt     getBspCombSchedIdx(UInt h, UInt i, UInt j)           { return m_bspCombSchedIdx[h][i][j];     }
     1045  Void     setBspCombSchedIdx(UInt h, UInt i, UInt j, UInt val) { m_bspCombSchedIdx[h][i][j] = val;      }
     1046#endif
    10071047#if P0182_VPS_VUI_PS_FLAG
    10081048  Int     getSPSId       (Int layer)                   { return m_SPSId[layer];          }
     
    11141154  Int  getSubDpbAssigned  (Int lsIdx, Int layerIdx) { return m_subDpbAssigned[lsIdx][layerIdx]; }
    11151155  Int  findLayerIdxInLayerSet ( Int lsIdx, Int nuhLayerId );
     1156#endif
     1157#if O0164_MULTI_LAYER_HRD
     1158  Void setBspHrdParameters( UInt hrdIdx, UInt frameRate, UInt numDU, UInt bitRate, Bool randomAccess );
    11161159#endif
    11171160#endif //SVC_EXTENSION
  • branches/SHM-5.1-dev/source/Lib/TLibCommon/TypeDef.h

    r627 r628  
    7979
    8080#define O0135_DEFAULT_ONE_OUT_SEMANTIC   1      ///< JCTVC-O0135: semantics change of default_one_target_output_layer_idc for auxiliary pictures
     81
     82#define O0164_MULTI_LAYER_HRD            1      ///< JCTVC-O0164: Multi-layer HRD operation
    8183
    8284#define O0194_DIFFERENT_BITDEPTH_EL_BL   1      ///< JCTVC-O0194: Support for different bitdepth values for BL and EL, add required configuration parameters (and Some bugfixes when REPN_FORMAT_IN_VPS (JCTVC-N0092) is enabled)
  • branches/SHM-5.1-dev/source/Lib/TLibDecoder/SEIread.cpp

    r616 r628  
    111111#endif
    112112#if SUB_BITSTREAM_PROPERTY_SEI
    113     case SEI::SUB_BITSTREAM_PROPERTY:
    114       fprintf( g_hTrace, "=========== Sub-bitstream property SEI message ===========\n");
    115       break;
     113  case SEI::SUB_BITSTREAM_PROPERTY:
     114    fprintf( g_hTrace, "=========== Sub-bitstream property SEI message ===========\n");
     115    break;
     116#endif
     117#if O0164_MULTI_LAYER_HRD
     118  case SEI::BSP_NESTING:
     119    fprintf( g_hTrace, "=========== Bitstream parition nesting SEI message ===========\n");
     120    break;
     121  case SEI::BSP_INITIAL_ARRIVAL_TIME:
     122    fprintf( g_hTrace, "=========== Bitstream parition initial arrival time SEI message ===========\n");
     123    break;
     124  case SEI::BSP_HRD:
     125    fprintf( g_hTrace, "=========== Bitstream parition HRD parameters SEI message ===========\n");
     126    break;
    116127#endif
    117128#endif //SVC_EXTENSION
     
    152163}
    153164
     165#if O0164_MULTI_LAYER_HRD
     166#if LAYERS_NOT_PRESENT_SEI
     167Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps, const SEIScalableNesting *nestingSei, const SEIBspNesting *bspNestingSei)
     168#else
     169Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps, const SEIScalableNesting *nestingSei)
     170#endif
     171#else
    154172#if LAYERS_NOT_PRESENT_SEI
    155173Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps)
    156174#else
    157175Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps)
     176#endif
    158177#endif
    159178{
     
    272291      xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, sps);
    273292#endif
     293      break;
    274294#if SVC_EXTENSION
    275295#if LAYERS_NOT_PRESENT_SEI
     
    296316     sei = new SEISubBitstreamProperty;
    297317     xParseSEISubBitstreamProperty((SEISubBitstreamProperty&) *sei);
     318     break;
     319#endif
     320#if O0164_MULTI_LAYER_HRD
     321   case SEI::BSP_NESTING:
     322     sei = new SEIBspNesting;
     323#if LAYERS_NOT_PRESENT_SEI
     324     xParseSEIBspNesting((SEIBspNesting&) *sei, nalUnitType, vps, sps, *nestingSei);
     325#else
     326     xParseSEIBspNesting((SEIBspNesting&) *sei, nalUnitType, sps, *nestingSei);
     327#endif
     328     break;
     329   case SEI::BSP_INITIAL_ARRIVAL_TIME:
     330     sei = new SEIBspInitialArrivalTime;
     331     xParseSEIBspInitialArrivalTime((SEIBspInitialArrivalTime&) *sei, vps, sps, *nestingSei, *bspNestingSei);
     332     break;
     333   case SEI::BSP_HRD:
     334     sei = new SEIBspHrd;
     335     xParseSEIBspHrd((SEIBspHrd&) *sei, sps, *nestingSei);
    298336     break;
    299337#endif
     
    870908  // read nested SEI messages
    871909  do {
     910#if O0164_MULTI_LAYER_HRD
     911#if LAYERS_NOT_PRESENT_SEI
     912    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, vps, sps, &sei);
     913#else
     914    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps, &sei);
     915#endif
     916#else
    872917#if LAYERS_NOT_PRESENT_SEI
    873918    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, vps, sps);
    874919#else
    875920    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps);
     921#endif
    876922#endif
    877923  } while (m_pcBitstream->getNumBitsLeft() > 8);
     
    9741020}
    9751021#endif
     1022
     1023#if O0164_MULTI_LAYER_HRD
     1024#if LAYERS_NOT_PRESENT_SEI
     1025Void SEIReader::xParseSEIBspNesting(SEIBspNesting &sei, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei)
     1026#else
     1027Void SEIReader::xParseSEIBspNesting(SEIBspNesting &sei, const NalUnitType nalUnitType, TComSPS *sps, const SEIScalableNesting &nestingSei)
     1028#endif
     1029{
     1030  UInt uiCode;
     1031  READ_UVLC( uiCode, "bsp_idx" ); sei.m_bspIdx = uiCode;
     1032
     1033  // byte alignment
     1034  while ( m_pcBitstream->getNumBitsRead() % 8 != 0 )
     1035  {
     1036    UInt code;
     1037    READ_FLAG( code, "bsp_nesting_zero_bit" );
     1038  }
     1039
     1040  sei.m_callerOwnsSEIs = false;
     1041
     1042  // read nested SEI messages
     1043  do {
     1044#if LAYERS_NOT_PRESENT_SEI
     1045    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, vps, sps, &nestingSei, &sei);
     1046#else
     1047    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps, &nestingSei);
     1048#endif
     1049  } while (m_pcBitstream->getNumBitsLeft() > 8);
     1050}
     1051
     1052Void SEIReader::xParseSEIBspInitialArrivalTime(SEIBspInitialArrivalTime &sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei, const SEIBspNesting &bspNestingSei)
     1053{
     1054  assert(vps->getVpsVuiPresentFlag());
     1055
     1056  UInt schedCombCnt = vps->getNumBspSchedCombinations(nestingSei.m_nestingOpIdx[0]);
     1057  UInt len;
     1058  UInt hrdIdx;
     1059  UInt uiCode;
     1060
     1061  if (schedCombCnt > 0)
     1062  {
     1063    hrdIdx = vps->getBspCombHrdIdx(nestingSei.m_nestingOpIdx[0], 0, bspNestingSei.m_bspIdx);
     1064  }
     1065  else
     1066  {
     1067    hrdIdx = 0;
     1068  }
     1069
     1070  TComHRD *hrd = vps->getBspHrd(hrdIdx);
     1071
     1072  if (hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag())
     1073  {
     1074    len = hrd->getInitialCpbRemovalDelayLengthMinus1() + 1;
     1075  }
     1076  else
     1077  {
     1078    len = 23 + 1;
     1079  }
     1080
     1081  if (hrd->getNalHrdParametersPresentFlag())
     1082  {
     1083    for(UInt i = 0; i < schedCombCnt; i++)
     1084    {
     1085      READ_CODE( len, uiCode, "nal_initial_arrival_delay" ); sei.m_nalInitialArrivalDelay[i] = uiCode;
     1086    }
     1087  }
     1088  else
     1089  {
     1090    for(UInt i = 0; i < schedCombCnt; i++)
     1091    {
     1092      READ_CODE( len, uiCode, "vcl_initial_arrival_delay" ); sei.m_vclInitialArrivalDelay[i] = uiCode;
     1093    }
     1094  }
     1095}
     1096
     1097Void SEIReader::xParseSEIBspHrd(SEIBspHrd &sei, TComSPS *sps, const SEIScalableNesting &nestingSei)
     1098{
     1099  UInt uiCode;
     1100  READ_UVLC( uiCode, "sei_num_bsp_hrd_parameters_minus1" ); sei.m_seiNumBspHrdParametersMinus1 = uiCode;
     1101  for (UInt i = 0; i <= sei.m_seiNumBspHrdParametersMinus1; i++)
     1102  {
     1103    if (i > 0)
     1104    {
     1105      READ_FLAG( uiCode, "sei_bsp_cprms_present_flag" ); sei.m_seiBspCprmsPresentFlag[i] = uiCode;
     1106    }
     1107    xParseHrdParameters(sei.hrd, i==0 ? 1 : sei.m_seiBspCprmsPresentFlag[i], nestingSei.m_nestingMaxTemporalIdPlus1[0]-1);
     1108  }
     1109  for (UInt h = 0; h <= nestingSei.m_nestingNumOpsMinus1; h++)
     1110  {
     1111    UInt lsIdx = nestingSei.m_nestingOpIdx[h];
     1112    READ_UVLC( uiCode, "num_sei_bitstream_partitions_minus1[i]"); sei.m_seiNumBitstreamPartitionsMinus1[lsIdx] = uiCode;
     1113    for (UInt i = 0; i <= sei.m_seiNumBitstreamPartitionsMinus1[lsIdx]; i++)
     1114    {
     1115      for (UInt j = 0; j < sei.m_vpsMaxLayers; j++)
     1116      {
     1117        if (sei.m_layerIdIncludedFlag[lsIdx][j])
     1118        {
     1119          READ_FLAG( uiCode, "sei_layer_in_bsp_flag[lsIdx][i][j]" ); sei.m_seiLayerInBspFlag[lsIdx][i][j] = uiCode;
     1120        }
     1121      }
     1122    }
     1123    READ_UVLC( uiCode, "sei_num_bsp_sched_combinations_minus1[i]"); sei.m_seiNumBspSchedCombinationsMinus1[lsIdx] = uiCode;
     1124    for (UInt i = 0; i <= sei.m_seiNumBspSchedCombinationsMinus1[lsIdx]; i++)
     1125    {
     1126      for (UInt j = 0; j <= sei.m_seiNumBitstreamPartitionsMinus1[lsIdx]; j++)
     1127      {
     1128        READ_UVLC( uiCode, "sei_bsp_comb_hrd_idx[lsIdx][i][j]"); sei.m_seiBspCombHrdIdx[lsIdx][i][j] = uiCode;
     1129        READ_UVLC( uiCode, "sei_bsp_comb_sched_idx[lsIdx][i][j]"); sei.m_seiBspCombScheddx[lsIdx][i][j] = uiCode;
     1130      }
     1131    }
     1132  }
     1133}
     1134
     1135Void SEIReader::xParseHrdParameters(TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1)
     1136{
     1137  UInt  uiCode;
     1138  if( commonInfPresentFlag )
     1139  {
     1140    READ_FLAG( uiCode, "nal_hrd_parameters_present_flag" );           hrd->setNalHrdParametersPresentFlag( uiCode == 1 ? true : false );
     1141    READ_FLAG( uiCode, "vcl_hrd_parameters_present_flag" );           hrd->setVclHrdParametersPresentFlag( uiCode == 1 ? true : false );
     1142    if( hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag() )
     1143    {
     1144      READ_FLAG( uiCode, "sub_pic_cpb_params_present_flag" );         hrd->setSubPicCpbParamsPresentFlag( uiCode == 1 ? true : false );
     1145      if( hrd->getSubPicCpbParamsPresentFlag() )
     1146      {
     1147        READ_CODE( 8, uiCode, "tick_divisor_minus2" );                hrd->setTickDivisorMinus2( uiCode );
     1148        READ_CODE( 5, uiCode, "du_cpb_removal_delay_length_minus1" ); hrd->setDuCpbRemovalDelayLengthMinus1( uiCode );
     1149        READ_FLAG( uiCode, "sub_pic_cpb_params_in_pic_timing_sei_flag" ); hrd->setSubPicCpbParamsInPicTimingSEIFlag( uiCode == 1 ? true : false );
     1150        READ_CODE( 5, uiCode, "dpb_output_delay_du_length_minus1"  ); hrd->setDpbOutputDelayDuLengthMinus1( uiCode );
     1151      }
     1152      READ_CODE( 4, uiCode, "bit_rate_scale" );                       hrd->setBitRateScale( uiCode );
     1153      READ_CODE( 4, uiCode, "cpb_size_scale" );                       hrd->setCpbSizeScale( uiCode );
     1154      if( hrd->getSubPicCpbParamsPresentFlag() )
     1155      {
     1156        READ_CODE( 4, uiCode, "cpb_size_du_scale" );                  hrd->setDuCpbSizeScale( uiCode );
     1157      }
     1158      READ_CODE( 5, uiCode, "initial_cpb_removal_delay_length_minus1" ); hrd->setInitialCpbRemovalDelayLengthMinus1( uiCode );
     1159      READ_CODE( 5, uiCode, "au_cpb_removal_delay_length_minus1" );      hrd->setCpbRemovalDelayLengthMinus1( uiCode );
     1160      READ_CODE( 5, uiCode, "dpb_output_delay_length_minus1" );       hrd->setDpbOutputDelayLengthMinus1( uiCode );
     1161    }
     1162  }
     1163  Int i, j, nalOrVcl;
     1164  for( i = 0; i <= maxNumSubLayersMinus1; i ++ )
     1165  {
     1166    READ_FLAG( uiCode, "fixed_pic_rate_general_flag" );                     hrd->setFixedPicRateFlag( i, uiCode == 1 ? true : false  );
     1167    if( !hrd->getFixedPicRateFlag( i ) )
     1168    {
     1169      READ_FLAG( uiCode, "fixed_pic_rate_within_cvs_flag" );                hrd->setFixedPicRateWithinCvsFlag( i, uiCode == 1 ? true : false  );
     1170    }
     1171    else
     1172    {
     1173      hrd->setFixedPicRateWithinCvsFlag( i, true );
     1174    }
     1175    hrd->setLowDelayHrdFlag( i, 0 ); // Infered to be 0 when not present
     1176    hrd->setCpbCntMinus1   ( i, 0 ); // Infered to be 0 when not present
     1177    if( hrd->getFixedPicRateWithinCvsFlag( i ) )
     1178    {
     1179      READ_UVLC( uiCode, "elemental_duration_in_tc_minus1" );             hrd->setPicDurationInTcMinus1( i, uiCode );
     1180    }
     1181    else
     1182    {
     1183      READ_FLAG( uiCode, "low_delay_hrd_flag" );                      hrd->setLowDelayHrdFlag( i, uiCode == 1 ? true : false  );
     1184    }
     1185    if (!hrd->getLowDelayHrdFlag( i ))
     1186    {
     1187      READ_UVLC( uiCode, "cpb_cnt_minus1" );                          hrd->setCpbCntMinus1( i, uiCode );
     1188    }
     1189    for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ )
     1190    {
     1191      if( ( ( nalOrVcl == 0 ) && ( hrd->getNalHrdParametersPresentFlag() ) ) ||
     1192          ( ( nalOrVcl == 1 ) && ( hrd->getVclHrdParametersPresentFlag() ) ) )
     1193      {
     1194        for( j = 0; j <= ( hrd->getCpbCntMinus1( i ) ); j ++ )
     1195        {
     1196          READ_UVLC( uiCode, "bit_rate_value_minus1" );             hrd->setBitRateValueMinus1( i, j, nalOrVcl, uiCode );
     1197          READ_UVLC( uiCode, "cpb_size_value_minus1" );             hrd->setCpbSizeValueMinus1( i, j, nalOrVcl, uiCode );
     1198          if( hrd->getSubPicCpbParamsPresentFlag() )
     1199          {
     1200            READ_UVLC( uiCode, "cpb_size_du_value_minus1" );       hrd->setDuCpbSizeValueMinus1( i, j, nalOrVcl, uiCode );
     1201            READ_UVLC( uiCode, "bit_rate_du_value_minus1" );       hrd->setDuBitRateValueMinus1( i, j, nalOrVcl, uiCode );
     1202          }
     1203          READ_FLAG( uiCode, "cbr_flag" );                          hrd->setCbrFlag( i, j, nalOrVcl, uiCode == 1 ? true : false  );
     1204        }
     1205      }
     1206    }
     1207  }
     1208}
     1209#endif
     1210
    9761211#endif //SVC_EXTENSION
    9771212
  • branches/SHM-5.1-dev/source/Lib/TLibDecoder/SEIread.h

    r616 r628  
    6262#endif
    6363protected:
     64#if O0164_MULTI_LAYER_HRD
     65#if LAYERS_NOT_PRESENT_SEI
     66  Void xReadSEImessage                (SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps, const SEIScalableNesting *nestingSei=NULL, const SEIBspNesting *bspNestingSei=NULL);
     67#else
     68  Void xReadSEImessage                (SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps, const SEIScalableNesting *nestingSei=NULL);
     69#endif
     70#else
    6471#if LAYERS_NOT_PRESENT_SEI
    6572  Void xReadSEImessage                (SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps);
    6673#else
    6774  Void xReadSEImessage                (SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps);
     75#endif
    6876#endif
    6977#if P0138_USE_ALT_CPB_PARAMS_FLAG
     
    95103  Void xParseSEIScalableNesting       (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComSPS *sps);
    96104#endif
     105#if O0164_MULTI_LAYER_HRD
     106#if LAYERS_NOT_PRESENT_SEI
     107  Void xParseSEIBspNesting(SEIBspNesting &sei, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei);
     108#else
     109  Void xParseSEIBspNesting(SEIBspNesting &sei, const NalUnitType nalUnitType, TComSPS *sps, const SEIScalableNesting &nestingSei);
     110#endif
     111  Void xParseSEIBspInitialArrivalTime(SEIBspInitialArrivalTime &sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei, const SEIBspNesting &bspNestingSei);
     112  Void xParseSEIBspHrd(SEIBspHrd &sei, TComSPS *sps, const SEIScalableNesting &nestingSei);
     113  Void xParseHrdParameters(TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1);
     114#endif
    97115  Void xParseByteAlign();
    98116};
  • branches/SHM-5.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r627 r628  
    20232023#endif
    20242024
     2025#if O0164_MULTI_LAYER_HRD
     2026    READ_FLAG(uiCode, "vps_vui_bsp_hrd_present_flag" ); vps->setVpsVuiBspHrdPresentFlag(uiCode);
     2027    if (vps->getVpsVuiBspHrdPresentFlag())
     2028    {
     2029      READ_UVLC( uiCode, "vps_num_bsp_hrd_parameters_minus1" ); vps->setVpsNumBspHrdParametersMinus1(uiCode);
     2030      vps->createBspHrdParamBuffer(vps->getVpsNumBspHrdParametersMinus1() + 1);
     2031      for (UInt i = 0; i <= vps->getVpsNumBspHrdParametersMinus1(); i++)
     2032      {
     2033        if (i > 0)
     2034        {
     2035          READ_FLAG( uiCode, "bsp_cprms_present_flag[i]" ); vps->setBspCprmsPresentFlag(i, uiCode);
     2036        }
     2037        parseHrdParameters(vps->getBspHrd(i), i==0 ? 1 : vps->getBspCprmsPresentFlag(i), vps->getMaxTLayers()-1);
     2038      }
     2039      for (UInt h = 1; h <= (vps->getNumLayerSets()-1); h++)
     2040      {
     2041        READ_UVLC( uiCode, "num_bitstream_partitions[i]"); vps->setNumBitstreamPartitions(h, uiCode);
     2042        for (UInt i = 0; i < vps->getNumBitstreamPartitions(h); i++)
     2043        {
     2044          for (UInt j = 0; j <= (vps->getMaxLayers()-1); j++)
     2045          {
     2046            if (vps->getLayerIdIncludedFlag(h, j))
     2047            {
     2048              READ_FLAG( uiCode, "layer_in_bsp_flag[h][i][j]" ); vps->setLayerInBspFlag(h, i, j, uiCode);
     2049            }
     2050          }
     2051        }
     2052        if (vps->getNumBitstreamPartitions(h))
     2053        {
     2054          READ_UVLC( uiCode, "num_bsp_sched_combinations[h]"); vps->setNumBspSchedCombinations(h, uiCode);
     2055          for (UInt i = 0; i < vps->getNumBspSchedCombinations(h); i++)
     2056          {
     2057            for (UInt j = 0; j < vps->getNumBitstreamPartitions(h); j++)
     2058            {
     2059              READ_UVLC( uiCode, "bsp_comb_hrd_idx[h][i][j]"); vps->setBspCombHrdIdx(h, i, j, uiCode);
     2060              READ_UVLC( uiCode, "bsp_comb_sched_idx[h][i][j]"); vps->setBspCombSchedIdx(h, i, j, uiCode);
     2061            }
     2062          }
     2063        }
     2064      }
     2065    }
     2066#endif
     2067
    20252068#if P0182_VPS_VUI_PS_FLAG
    20262069    for(i = 1; i < vps->getMaxLayers(); i++)
  • branches/SHM-5.1-dev/source/Lib/TLibEncoder/SEIwrite.cpp

    r616 r628  
    105105#endif
    106106#if SUB_BITSTREAM_PROPERTY_SEI
    107     case SEI::SUB_BITSTREAM_PROPERTY:
    108       fprintf( g_hTrace, "=========== Sub-bitstream property SEI message ===========\n");
    109       break;
     107  case SEI::SUB_BITSTREAM_PROPERTY:
     108    fprintf( g_hTrace, "=========== Sub-bitstream property SEI message ===========\n");
     109    break;
     110#endif
     111#if O0164_MULTI_LAYER_HRD
     112  case SEI::BSP_NESTING:
     113    fprintf( g_hTrace, "=========== Bitstream partition nesting SEI message ===========\n");
     114    break;
     115  case SEI::BSP_INITIAL_ARRIVAL_TIME:
     116    fprintf( g_hTrace, "=========== Bitstream parition initial arrival time SEI message ===========\n");
     117    break;
     118  case SEI::BSP_HRD:
     119    fprintf( g_hTrace, "=========== Bitstream parition HRD parameters SEI message ===========\n");
     120    break;
    110121#endif
    111122#endif //SVC_EXTENSION
     
    117128#endif
    118129
     130#if O0164_MULTI_LAYER_HRD
     131void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting& nestingSei, const SEIBspNesting& bspNestingSei)
     132#else
    119133void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps)
     134#endif
    120135{
    121136  switch (sei.payloadType())
     
    161176    break;
    162177  case SEI::SCALABLE_NESTING:
     178#if O0164_MULTI_LAYER_HRD
     179    xWriteSEIScalableNesting(bs, *static_cast<const SEIScalableNesting*>(&sei), vps, sps);
     180#else
    163181    xWriteSEIScalableNesting(bs, *static_cast<const SEIScalableNesting*>(&sei), sps);
     182#endif
    164183    break;
    165184#if SVC_EXTENSION
     
    179198     break;
    180199#endif
     200#if O0164_MULTI_LAYER_HRD
     201   case SEI::BSP_NESTING:
     202     xWriteSEIBspNesting(bs, *static_cast<const SEIBspNesting*>(&sei), vps, sps, nestingSei);
     203     break;
     204   case SEI::BSP_INITIAL_ARRIVAL_TIME:
     205     xWriteSEIBspInitialArrivalTime(*static_cast<const SEIBspInitialArrivalTime*>(&sei), vps, sps, nestingSei, bspNestingSei);
     206     break;
     207   case SEI::BSP_HRD:
     208     xWriteSEIBspHrd(*static_cast<const SEIBspHrd*>(&sei), sps, nestingSei);
     209     break;
     210#endif
    181211#endif //SVC_EXTENSION
    182212  default:
     
    189219 * in bitstream bs.
    190220 */
     221#if O0164_MULTI_LAYER_HRD
     222Void SEIWriter::writeSEImessage(TComBitIf& bs, const SEI& sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei)
     223#else
    191224Void SEIWriter::writeSEImessage(TComBitIf& bs, const SEI& sei, TComSPS *sps)
     225#endif
    192226{
    193227  /* calculate how large the payload data is */
     
    202236  g_HLSTraceEnable = false;
    203237#endif
     238#if O0164_MULTI_LAYER_HRD
     239  xWriteSEIpayloadData(bs_count, sei, vps, sps, *nestingSei, *bspNestingSei);
     240#else
    204241  xWriteSEIpayloadData(bs_count, sei, sps);
     242#endif
    205243#if ENC_DEC_TRACE
    206244  g_HLSTraceEnable = traceEnable;
     
    237275#endif
    238276
     277#if O0164_MULTI_LAYER_HRD
     278  xWriteSEIpayloadData(bs, sei, vps, sps, *nestingSei, *bspNestingSei);
     279#else
    239280  xWriteSEIpayloadData(bs, sei, sps);
     281#endif
    240282}
    241283
     
    577619}
    578620
     621#if O0164_MULTI_LAYER_HRD
     622Void SEIWriter::xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComVPS *vps, TComSPS *sps)
     623#else
    579624Void SEIWriter::xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps)
     625#endif
    580626{
    581627  WRITE_FLAG( sei.m_bitStreamSubsetFlag,             "bitstream_subset_flag"         );
     
    587633    for (UInt i = (sei.m_defaultOpFlag ? 1 : 0); i <= sei.m_nestingNumOpsMinus1; i++)
    588634    {
    589       WRITE_CODE( sei.m_nestingNoOpMaxTemporalIdPlus1, 3, "nesting_no_op_max_temporal_id" );
    590635      WRITE_CODE( sei.m_nestingMaxTemporalIdPlus1[i], 3,  "nesting_max_temporal_id"       );
    591636      WRITE_UVLC( sei.m_nestingOpIdx[i],                  "nesting_op_idx"                );
     
    615660  for (SEIMessages::const_iterator it = sei.m_nestedSEIs.begin(); it != sei.m_nestedSEIs.end(); it++)
    616661  {
     662#if O0164_MULTI_LAYER_HRD
     663    writeSEImessage(bs, *(*it), vps, sps, &sei);
     664#else
    617665    writeSEImessage(bs, *(*it), sps);
     666#endif
    618667  }
    619668}
     
    699748}
    700749#endif
     750
     751#if O0164_MULTI_LAYER_HRD
     752Void SEIWriter::xWriteSEIBspNesting(TComBitIf& bs, const SEIBspNesting &sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei)
     753{
     754  WRITE_UVLC( sei.m_bspIdx, "bsp_idx" );
     755
     756  while ( m_pcBitIf->getNumberOfWrittenBits() % 8 != 0 )
     757  {
     758    WRITE_FLAG( 0, "bsp_nesting_zero_bit" );
     759  }
     760
     761  // write nested SEI messages
     762  for (SEIMessages::const_iterator it = sei.m_nestedSEIs.begin(); it != sei.m_nestedSEIs.end(); it++)
     763  {
     764    writeSEImessage(bs, *(*it), vps, sps, &nestingSei, &sei);
     765  }
     766}
     767
     768Void SEIWriter::xWriteSEIBspInitialArrivalTime(const SEIBspInitialArrivalTime &sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei, const SEIBspNesting &bspNestingSei)
     769{
     770  assert(vps->getVpsVuiPresentFlag());
     771
     772  UInt schedCombCnt = vps->getNumBspSchedCombinations(nestingSei.m_nestingOpIdx[0]);
     773  UInt len;
     774  UInt hrdIdx;
     775
     776  if (schedCombCnt > 0)
     777  {
     778    hrdIdx = vps->getBspCombHrdIdx(nestingSei.m_nestingOpIdx[0], 0, bspNestingSei.m_bspIdx);
     779  }
     780  else
     781  {
     782    hrdIdx = 0;
     783  }
     784
     785  TComHRD *hrd = vps->getBspHrd(hrdIdx);
     786
     787  if (hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag())
     788  {
     789    len = hrd->getInitialCpbRemovalDelayLengthMinus1() + 1;
     790  }
     791  else
     792  {
     793    len = 23 + 1;
     794  }
     795
     796  if (hrd->getNalHrdParametersPresentFlag())
     797  {
     798    for(UInt i = 0; i < schedCombCnt; i++)
     799    {
     800      WRITE_CODE( sei.m_nalInitialArrivalDelay[i], len, "nal_initial_arrival_delay" );
     801    }
     802  }
     803  else
     804  {
     805    for(UInt i = 0; i < schedCombCnt; i++)
     806    {
     807      WRITE_CODE( sei.m_vclInitialArrivalDelay[i], len, "vcl_initial_arrival_delay" );
     808    }
     809  }
     810}
     811
     812Void SEIWriter::xWriteSEIBspHrd(const SEIBspHrd &sei, TComSPS *sps, const SEIScalableNesting &nestingSei)
     813{
     814  WRITE_UVLC( sei.m_seiNumBspHrdParametersMinus1, "sei_num_bsp_hrd_parameters_minus1" );
     815  for (UInt i = 0; i <= sei.m_seiNumBspHrdParametersMinus1; i++)
     816  {
     817    if (i > 0)
     818    {
     819      WRITE_FLAG( sei.m_seiBspCprmsPresentFlag[i], "sei_bsp_cprms_present_flag" );
     820    }
     821    xCodeHrdParameters(sei.hrd, i==0 ? 1 : sei.m_seiBspCprmsPresentFlag[i], nestingSei.m_nestingMaxTemporalIdPlus1[0]-1);
     822  }
     823  for (UInt h = 0; h <= nestingSei.m_nestingNumOpsMinus1; h++)
     824  {
     825    UInt lsIdx = nestingSei.m_nestingOpIdx[h];
     826    WRITE_UVLC( sei.m_seiNumBitstreamPartitionsMinus1[lsIdx], "num_sei_bitstream_partitions_minus1[i]");
     827    for (UInt i = 0; i <= sei.m_seiNumBitstreamPartitionsMinus1[lsIdx]; i++)
     828    {
     829      for (UInt j = 0; j < sei.m_vpsMaxLayers; j++)
     830      {
     831        if (sei.m_layerIdIncludedFlag[lsIdx][j])
     832        {
     833          WRITE_FLAG( sei.m_seiLayerInBspFlag[lsIdx][i][j], "sei_layer_in_bsp_flag[lsIdx][i][j]" );
     834        }
     835      }
     836    }
     837    WRITE_UVLC( sei.m_seiNumBspSchedCombinationsMinus1[lsIdx], "sei_num_bsp_sched_combinations_minus1[i]");
     838    for (UInt i = 0; i <= sei.m_seiNumBspSchedCombinationsMinus1[lsIdx]; i++)
     839    {
     840      for (UInt j = 0; j <= sei.m_seiNumBitstreamPartitionsMinus1[lsIdx]; j++)
     841      {
     842        WRITE_UVLC( sei.m_seiBspCombHrdIdx[lsIdx][i][j], "sei_bsp_comb_hrd_idx[lsIdx][i][j]");
     843        WRITE_UVLC( sei.m_seiBspCombScheddx[lsIdx][i][j], "sei_bsp_comb_sched_idx[lsIdx][i][j]");
     844      }
     845    }
     846  }
     847}
     848
     849Void SEIWriter::xCodeHrdParameters( TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1 )
     850{
     851  if( commonInfPresentFlag )
     852  {
     853    WRITE_FLAG( hrd->getNalHrdParametersPresentFlag() ? 1 : 0 ,  "nal_hrd_parameters_present_flag" );
     854    WRITE_FLAG( hrd->getVclHrdParametersPresentFlag() ? 1 : 0 ,  "vcl_hrd_parameters_present_flag" );
     855    if( hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag() )
     856    {
     857      WRITE_FLAG( hrd->getSubPicCpbParamsPresentFlag() ? 1 : 0,  "sub_pic_cpb_params_present_flag" );
     858      if( hrd->getSubPicCpbParamsPresentFlag() )
     859      {
     860        WRITE_CODE( hrd->getTickDivisorMinus2(), 8,              "tick_divisor_minus2" );
     861        WRITE_CODE( hrd->getDuCpbRemovalDelayLengthMinus1(), 5,  "du_cpb_removal_delay_length_minus1" );
     862        WRITE_FLAG( hrd->getSubPicCpbParamsInPicTimingSEIFlag() ? 1 : 0, "sub_pic_cpb_params_in_pic_timing_sei_flag" );
     863        WRITE_CODE( hrd->getDpbOutputDelayDuLengthMinus1(), 5,   "dpb_output_delay_du_length_minus1"  );
     864      }
     865      WRITE_CODE( hrd->getBitRateScale(), 4,                     "bit_rate_scale" );
     866      WRITE_CODE( hrd->getCpbSizeScale(), 4,                     "cpb_size_scale" );
     867      if( hrd->getSubPicCpbParamsPresentFlag() )
     868      {
     869        WRITE_CODE( hrd->getDuCpbSizeScale(), 4,                "du_cpb_size_scale" );
     870      }
     871      WRITE_CODE( hrd->getInitialCpbRemovalDelayLengthMinus1(), 5, "initial_cpb_removal_delay_length_minus1" );
     872      WRITE_CODE( hrd->getCpbRemovalDelayLengthMinus1(),        5, "au_cpb_removal_delay_length_minus1" );
     873      WRITE_CODE( hrd->getDpbOutputDelayLengthMinus1(),         5, "dpb_output_delay_length_minus1" );
     874    }
     875  }
     876  Int i, j, nalOrVcl;
     877  for( i = 0; i <= maxNumSubLayersMinus1; i ++ )
     878  {
     879    WRITE_FLAG( hrd->getFixedPicRateFlag( i ) ? 1 : 0,          "fixed_pic_rate_general_flag");
     880    if( !hrd->getFixedPicRateFlag( i ) )
     881    {
     882      WRITE_FLAG( hrd->getFixedPicRateWithinCvsFlag( i ) ? 1 : 0, "fixed_pic_rate_within_cvs_flag");
     883    }
     884    else
     885    {
     886      hrd->setFixedPicRateWithinCvsFlag( i, true );
     887    }
     888    if( hrd->getFixedPicRateWithinCvsFlag( i ) )
     889    {
     890      WRITE_UVLC( hrd->getPicDurationInTcMinus1( i ),           "elemental_duration_in_tc_minus1");
     891    }
     892    else
     893    {
     894      WRITE_FLAG( hrd->getLowDelayHrdFlag( i ) ? 1 : 0,           "low_delay_hrd_flag");
     895    }
     896    if (!hrd->getLowDelayHrdFlag( i ))
     897    {
     898      WRITE_UVLC( hrd->getCpbCntMinus1( i ),                      "cpb_cnt_minus1");
     899    }
     900   
     901    for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ )
     902    {
     903      if( ( ( nalOrVcl == 0 ) && ( hrd->getNalHrdParametersPresentFlag() ) ) ||
     904          ( ( nalOrVcl == 1 ) && ( hrd->getVclHrdParametersPresentFlag() ) ) )
     905      {
     906        for( j = 0; j <= ( hrd->getCpbCntMinus1( i ) ); j ++ )
     907        {
     908          WRITE_UVLC( hrd->getBitRateValueMinus1( i, j, nalOrVcl ), "bit_rate_value_minus1");
     909          WRITE_UVLC( hrd->getCpbSizeValueMinus1( i, j, nalOrVcl ), "cpb_size_value_minus1");
     910          if( hrd->getSubPicCpbParamsPresentFlag() )
     911          {
     912            WRITE_UVLC( hrd->getDuCpbSizeValueMinus1( i, j, nalOrVcl ), "cpb_size_du_value_minus1"); 
     913            WRITE_UVLC( hrd->getDuBitRateValueMinus1( i, j, nalOrVcl ), "bit_rate_du_value_minus1");
     914          }
     915          WRITE_FLAG( hrd->getCbrFlag( i, j, nalOrVcl ) ? 1 : 0, "cbr_flag");
     916        }
     917      }
     918    }
     919  }
     920}
     921
     922#endif
     923
    701924#endif //SVC_EXTENSION
    702925
  • branches/SHM-5.1-dev/source/Lib/TLibEncoder/SEIwrite.h

    r595 r628  
    4747  virtual ~SEIWriter() {};
    4848
     49#if O0164_MULTI_LAYER_HRD
     50  void writeSEImessage(TComBitIf& bs, const SEI& sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting* nestingSei=NULL, const SEIBspNesting* bspNestingSei=NULL);
     51#else
    4952  void writeSEImessage(TComBitIf& bs, const SEI& sei, TComSPS *sps);
     53#endif
    5054
    5155protected:
     56#if O0164_MULTI_LAYER_HRD
     57  Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting& nestingSei, const SEIBspNesting& bspNestingSei);
     58#else
    5259  Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps);
     60#endif
    5361  Void xWriteSEIuserDataUnregistered(const SEIuserDataUnregistered &sei);
    5462  Void xWriteSEIActiveParameterSets(const SEIActiveParameterSets& sei);
     
    6573  Void xWriteSEIToneMappingInfo(const SEIToneMappingInfo& sei);
    6674  Void xWriteSEISOPDescription(const SEISOPDescription& sei);
     75#if O0164_MULTI_LAYER_HRD
     76  Void xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComVPS *vps, TComSPS *sps);
     77#else
    6778  Void xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps);
     79#endif
    6880  Void xWriteByteAlign();
    6981#if SVC_EXTENSION
     
    7789  Void xWriteSEISubBitstreamProperty(const SEISubBitstreamProperty &sei);
    7890#endif
     91#if O0164_MULTI_LAYER_HRD
     92  Void xWriteSEIBspNesting(TComBitIf& bs, const SEIBspNesting &sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei);
     93  Void xWriteSEIBspInitialArrivalTime(const SEIBspInitialArrivalTime &sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei, const SEIBspNesting &bspNestingSei);
     94  Void xWriteSEIBspHrd(const SEIBspHrd &sei, TComSPS *sps, const SEIScalableNesting &nestingSei);
     95  Void xCodeHrdParameters( TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1 );
     96#endif
    7997#endif //SVC_EXTENSION
    8098};
  • branches/SHM-5.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp

    r627 r628  
    15231523#endif
    15241524#endif
     1525#if O0164_MULTI_LAYER_HRD
     1526    WRITE_FLAG(vps->getVpsVuiBspHrdPresentFlag(), "vps_vui_bsp_hrd_present_flag" );
     1527    if (vps->getVpsVuiBspHrdPresentFlag())
     1528    {
     1529      WRITE_UVLC( vps->getVpsNumBspHrdParametersMinus1(), "vps_num_bsp_hrd_parameters_minus1" );
     1530      for (UInt i = 0; i <= vps->getVpsNumBspHrdParametersMinus1(); i++)
     1531      {
     1532        if (i > 0)
     1533        {
     1534          WRITE_FLAG( vps->getBspCprmsPresentFlag(i), "bsp_cprms_present_flag[i]" );
     1535        }
     1536        codeHrdParameters(vps->getBspHrd(i), i==0 ? 1 : vps->getBspCprmsPresentFlag(i), vps->getMaxTLayers()-1);
     1537      }
     1538      for (UInt h = 1; h <= (vps->getNumLayerSets()-1); h++)
     1539      {
     1540        WRITE_UVLC( vps->getNumBitstreamPartitions(h), "num_bitstream_partitions[i]");
     1541        for (UInt i = 0; i < vps->getNumBitstreamPartitions(h); i++)
     1542        {
     1543          for (UInt j = 0; j <= (vps->getMaxLayers()-1); j++)
     1544          {
     1545            if (vps->getLayerIdIncludedFlag(h, j))
     1546            {
     1547              WRITE_FLAG( vps->getLayerInBspFlag(h, i, j), "layer_in_bsp_flag[h][i][j]" );
     1548            }
     1549          }
     1550        }
     1551        if (vps->getNumBitstreamPartitions(h))
     1552        {
     1553          WRITE_UVLC( vps->getNumBspSchedCombinations(h), "num_bsp_sched_combinations[h]");
     1554          for (UInt i = 0; i < vps->getNumBspSchedCombinations(h); i++)
     1555          {
     1556            for (UInt j = 0; j < vps->getNumBitstreamPartitions(h); j++)
     1557            {
     1558              WRITE_UVLC( vps->getBspCombHrdIdx(h, i, j), "bsp_comb_hrd_idx[h][i][j]");
     1559              WRITE_UVLC( vps->getBspCombSchedIdx(h, i, j), "bsp_comb_sched_idx[h][i][j]");
     1560            }
     1561          }
     1562        }
     1563      }
     1564    }
     1565#endif
    15251566#if P0182_VPS_VUI_PS_FLAG
    15261567    for(i = 1; i < vps->getMaxLayers(); i++)
  • branches/SHM-5.1-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r627 r628  
    303303    //nalu = NALUnit(NAL_UNIT_SEI);
    304304    m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     305#if O0164_MULTI_LAYER_HRD
     306    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, m_pcEncTop->getVPS(), sps);
     307#else
    305308    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps);
     309#endif
    306310    writeRBSPTrailingBits(nalu.m_Bitstream);
    307311    accessUnit.push_back(new NALUnitEBSP(nalu));
     
    316320    nalu = NALUnit(NAL_UNIT_PREFIX_SEI);
    317321    m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     322#if O0164_MULTI_LAYER_HRD
     323    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, m_pcEncTop->getVPS(), sps);
     324#else
    318325    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps);
     326#endif
    319327    writeRBSPTrailingBits(nalu.m_Bitstream);
    320328    accessUnit.push_back(new NALUnitEBSP(nalu));
     
    327335    nalu = NALUnit(NAL_UNIT_PREFIX_SEI);
    328336    m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     337#if O0164_MULTI_LAYER_HRD
     338    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, m_pcEncTop->getVPS(), sps);
     339#else
    329340    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps);
     341#endif
    330342    writeRBSPTrailingBits(nalu.m_Bitstream);
    331343    accessUnit.push_back(new NALUnitEBSP(nalu));
     
    338350    nalu = NALUnit(NAL_UNIT_PREFIX_SEI);
    339351    m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     352#if O0164_MULTI_LAYER_HRD
     353    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, m_pcEncTop->getVPS(), sps);
     354#else
    340355    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps);
     356#endif
    341357    writeRBSPTrailingBits(nalu.m_Bitstream);
    342358    accessUnit.push_back(new NALUnitEBSP(nalu));
     
    350366    SEILayersNotPresent *sei = xCreateSEILayersNotPresent ();
    351367    m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     368#if O0164_MULTI_LAYER_HRD
     369    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, m_pcEncTop->getVPS(), sps);
     370#else
    352371    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps);
     372#endif
    353373    writeRBSPTrailingBits(nalu.m_Bitstream);
    354374    accessUnit.push_back(new NALUnitEBSP(nalu));
     
    364384    nalu = NALUnit(NAL_UNIT_PREFIX_SEI, 0, m_pcCfg->getNumLayer()-1); // For highest layer
    365385    m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     386#if O0164_MULTI_LAYER_HRD
     387    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, m_pcEncTop->getVPS(), sps);
     388#else
    366389    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps);
     390#endif
    367391    writeRBSPTrailingBits(nalu.m_Bitstream);
    368392    accessUnit.push_back(new NALUnitEBSP(nalu));
     
    17351759      xCreateLeadingSEIMessages(accessUnit, pcSlice->getSPS());
    17361760
     1761#if O0164_MULTI_LAYER_HRD
     1762      if (pcSlice->getLayerId() == 0 && m_pcEncTop->getVPS()->getVpsVuiBspHrdPresentFlag())
     1763      {
     1764        OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI, 0, 1);
     1765        m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
     1766        m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     1767        SEIScalableNesting *scalableBspNestingSei = xCreateBspNestingSEI(pcSlice);
     1768        m_seiWriter.writeSEImessage(nalu.m_Bitstream, *scalableBspNestingSei, m_pcEncTop->getVPS(), pcSlice->getSPS());
     1769        writeRBSPTrailingBits(nalu.m_Bitstream);
     1770
     1771        UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit);
     1772        UInt offsetPosition = m_activeParameterSetSEIPresentInAU
     1773          + m_bufferingPeriodSEIPresentInAU
     1774          + m_pictureTimingSEIPresentInAU
     1775          + m_nestedPictureTimingSEIPresentInAU;  // Insert SEI after APS, BP and PT SEI
     1776        AccessUnit::iterator it;
     1777        for(j = 0, it = accessUnit.begin(); j < seiPositionInAu + offsetPosition; j++)
     1778        {
     1779          it++;
     1780        }
     1781        accessUnit.insert(it, new NALUnitEBSP(nalu));
     1782      }
     1783#endif
     1784
    17371785      m_bSeqFirst = false;
    17381786    }
     
    17691817      SOPDescriptionSEI.m_numPicsInSopMinus1 = i - 1;
    17701818
     1819#if O0164_MULTI_LAYER_HRD
     1820      m_seiWriter.writeSEImessage( nalu.m_Bitstream, SOPDescriptionSEI, m_pcEncTop->getVPS(), pcSlice->getSPS());
     1821#else
    17711822      m_seiWriter.writeSEImessage( nalu.m_Bitstream, SOPDescriptionSEI, pcSlice->getSPS());
     1823#endif
    17721824      writeRBSPTrailingBits(nalu.m_Bitstream);
    17731825      accessUnit.push_back(new NALUnitEBSP(nalu));
     
    18531905      sei_buffering_period.m_dpbDelayOffset = 0;
    18541906
     1907#if O0164_MULTI_LAYER_HRD
     1908      m_seiWriter.writeSEImessage( nalu.m_Bitstream, sei_buffering_period, m_pcEncTop->getVPS(), pcSlice->getSPS());
     1909#else
    18551910      m_seiWriter.writeSEImessage( nalu.m_Bitstream, sei_buffering_period, pcSlice->getSPS());
     1911#endif
    18561912      writeRBSPTrailingBits(nalu.m_Bitstream);
    18571913      {
     
    18741930        scalableNestingSEI.m_nestedSEIs.clear();
    18751931        scalableNestingSEI.m_nestedSEIs.push_back(&sei_buffering_period);
     1932#if O0164_MULTI_LAYER_HRD
     1933        m_seiWriter.writeSEImessage( naluTmp.m_Bitstream, scalableNestingSEI, m_pcEncTop->getVPS(), pcSlice->getSPS());
     1934#else
    18761935        m_seiWriter.writeSEImessage( naluTmp.m_Bitstream, scalableNestingSEI, pcSlice->getSPS());
     1936#endif
    18771937        writeRBSPTrailingBits(naluTmp.m_Bitstream);
    18781938        UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit);
     
    19031963        seiGradualDecodingRefreshInfo.m_gdrForegroundFlag = true; // Indicating all "foreground"
    19041964
     1965#if O0164_MULTI_LAYER_HRD
     1966        m_seiWriter.writeSEImessage( nalu.m_Bitstream, seiGradualDecodingRefreshInfo, m_pcEncTop->getVPS(), pcSlice->getSPS() );
     1967#else
    19051968        m_seiWriter.writeSEImessage( nalu.m_Bitstream, seiGradualDecodingRefreshInfo, pcSlice->getSPS() );
     1969#endif
    19061970        writeRBSPTrailingBits(nalu.m_Bitstream);
    19071971        accessUnit.push_back(new NALUnitEBSP(nalu));
     
    19211985      sei_recovery_point.m_brokenLinkFlag    = false;
    19221986
     1987#if O0164_MULTI_LAYER_HRD
     1988      m_seiWriter.writeSEImessage( nalu.m_Bitstream, sei_recovery_point, m_pcEncTop->getVPS(), pcSlice->getSPS() );
     1989#else
    19231990      m_seiWriter.writeSEImessage( nalu.m_Bitstream, sei_recovery_point, pcSlice->getSPS() );
     1991#endif
    19241992      writeRBSPTrailingBits(nalu.m_Bitstream);
    19251993      accessUnit.push_back(new NALUnitEBSP(nalu));
     
    22882356        /* write the SEI messages */
    22892357        m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
     2358#if O0164_MULTI_LAYER_HRD
     2359        m_seiWriter.writeSEImessage(nalu.m_Bitstream, sei_recon_picture_digest, m_pcEncTop->getVPS(), pcSlice->getSPS());
     2360#else
    22902361        m_seiWriter.writeSEImessage(nalu.m_Bitstream, sei_recon_picture_digest, pcSlice->getSPS());
     2362#endif
    22912363        writeRBSPTrailingBits(nalu.m_Bitstream);
    22922364
     
    23122384        /* write the SEI messages */
    23132385        m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
     2386#if O0164_MULTI_LAYER_HRD
     2387        m_seiWriter.writeSEImessage(nalu.m_Bitstream, sei_temporal_level0_index, m_pcEncTop->getVPS(), pcSlice->getSPS());
     2388#else
    23142389        m_seiWriter.writeSEImessage(nalu.m_Bitstream, sei_temporal_level0_index, pcSlice->getSPS());
     2390#endif
    23152391        writeRBSPTrailingBits(nalu.m_Bitstream);
    23162392
     
    24622538          m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
    24632539          pictureTimingSEI.m_picStruct = (isField && pcSlice->getPic()->isTopField())? 1 : isField? 2 : 0;
     2540#if O0164_MULTI_LAYER_HRD
     2541          m_seiWriter.writeSEImessage(nalu.m_Bitstream, pictureTimingSEI, m_pcEncTop->getVPS(), pcSlice->getSPS());
     2542#else
    24642543          m_seiWriter.writeSEImessage(nalu.m_Bitstream, pictureTimingSEI, pcSlice->getSPS());
     2544#endif
    24652545          writeRBSPTrailingBits(nalu.m_Bitstream);
    24662546          UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit);
     
    24812561            scalableNestingSEI.m_nestedSEIs.clear();
    24822562            scalableNestingSEI.m_nestedSEIs.push_back(&pictureTimingSEI);
     2563#if O0164_MULTI_LAYER_HRD
     2564            m_seiWriter.writeSEImessage(nalu.m_Bitstream, scalableNestingSEI, m_pcEncTop->getVPS(), pcSlice->getSPS());
     2565#else
    24832566            m_seiWriter.writeSEImessage(nalu.m_Bitstream, scalableNestingSEI, pcSlice->getSPS());
     2567#endif
    24842568            writeRBSPTrailingBits(nalu.m_Bitstream);
    24852569            UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit);
     
    25132597            {
    25142598              // Insert before the first slice.
     2599#if O0164_MULTI_LAYER_HRD
     2600              m_seiWriter.writeSEImessage(nalu.m_Bitstream, tempSEI, m_pcEncTop->getVPS(), pcSlice->getSPS());
     2601#else
    25152602              m_seiWriter.writeSEImessage(nalu.m_Bitstream, tempSEI, pcSlice->getSPS());
     2603#endif
    25162604              writeRBSPTrailingBits(nalu.m_Bitstream);
    25172605
     
    25352623                {
    25362624                  // Insert before the first slice.
     2625#if O0164_MULTI_LAYER_HRD
     2626                  m_seiWriter.writeSEImessage(nalu.m_Bitstream, tempSEI, m_pcEncTop->getVPS(), pcSlice->getSPS());
     2627#else
    25372628                  m_seiWriter.writeSEImessage(nalu.m_Bitstream, tempSEI, pcSlice->getSPS());
     2629#endif
    25382630                  writeRBSPTrailingBits(nalu.m_Bitstream);
    25392631
     
    36713763}
    36723764#endif
     3765
     3766#if O0164_MULTI_LAYER_HRD
     3767SEIScalableNesting* TEncGOP::xCreateBspNestingSEI(TComSlice *pcSlice)
     3768{
     3769  SEIScalableNesting *seiScalableNesting = new SEIScalableNesting();
     3770  SEIBspInitialArrivalTime *seiBspInitialArrivalTime = new SEIBspInitialArrivalTime();
     3771  SEIBspNesting *seiBspNesting = new SEIBspNesting();
     3772  SEIBufferingPeriod *seiBufferingPeriod = new SEIBufferingPeriod();
     3773
     3774  // Scalable nesting SEI
     3775
     3776  seiScalableNesting->m_bitStreamSubsetFlag           = 1;      // If the nested SEI messages are picture buffereing SEI mesages, picure timing SEI messages or sub-picture timing SEI messages, bitstream_subset_flag shall be equal to 1
     3777  seiScalableNesting->m_nestingOpFlag                 = 1;
     3778  seiScalableNesting->m_defaultOpFlag                 = 0;
     3779  seiScalableNesting->m_nestingNumOpsMinus1           = 0;      //nesting_num_ops_minus1
     3780  seiScalableNesting->m_nestingOpIdx[0]               = 1;
     3781  seiScalableNesting->m_allLayersFlag                 = 0;
     3782  seiScalableNesting->m_nestingNoOpMaxTemporalIdPlus1 = 6 + 1;  //nesting_no_op_max_temporal_id_plus1
     3783  seiScalableNesting->m_nestingNumLayersMinus1        = 1 - 1;  //nesting_num_layers_minus1
     3784  seiScalableNesting->m_nestingLayerId[0]             = 0;
     3785  seiScalableNesting->m_callerOwnsSEIs                = true;
     3786
     3787  // Bitstream partition nesting SEI
     3788
     3789  seiBspNesting->m_bspIdx = 0;
     3790  seiBspNesting->m_callerOwnsSEIs = true;
     3791
     3792  // Buffering period SEI
     3793
     3794  UInt uiInitialCpbRemovalDelay = (90000/2);                      // 0.5 sec
     3795  seiBufferingPeriod->m_initialCpbRemovalDelay      [0][0]     = uiInitialCpbRemovalDelay;
     3796  seiBufferingPeriod->m_initialCpbRemovalDelayOffset[0][0]     = uiInitialCpbRemovalDelay;
     3797  seiBufferingPeriod->m_initialCpbRemovalDelay      [0][1]     = uiInitialCpbRemovalDelay;
     3798  seiBufferingPeriod->m_initialCpbRemovalDelayOffset[0][1]     = uiInitialCpbRemovalDelay;
     3799
     3800  Double dTmp = (Double)pcSlice->getSPS()->getVuiParameters()->getTimingInfo()->getNumUnitsInTick() / (Double)pcSlice->getSPS()->getVuiParameters()->getTimingInfo()->getTimeScale();
     3801
     3802  UInt uiTmp = (UInt)( dTmp * 90000.0 );
     3803  uiInitialCpbRemovalDelay -= uiTmp;
     3804  uiInitialCpbRemovalDelay -= uiTmp / ( pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getTickDivisorMinus2() + 2 );
     3805  seiBufferingPeriod->m_initialAltCpbRemovalDelay      [0][0]  = uiInitialCpbRemovalDelay;
     3806  seiBufferingPeriod->m_initialAltCpbRemovalDelayOffset[0][0]  = uiInitialCpbRemovalDelay;
     3807  seiBufferingPeriod->m_initialAltCpbRemovalDelay      [0][1]  = uiInitialCpbRemovalDelay;
     3808  seiBufferingPeriod->m_initialAltCpbRemovalDelayOffset[0][1]  = uiInitialCpbRemovalDelay;
     3809
     3810  seiBufferingPeriod->m_rapCpbParamsPresentFlag              = 0;
     3811  //for the concatenation, it can be set to one during splicing.
     3812  seiBufferingPeriod->m_concatenationFlag = 0;
     3813  //since the temporal layer HRD is not ready, we assumed it is fixed
     3814  seiBufferingPeriod->m_auCpbRemovalDelayDelta = 1;
     3815  seiBufferingPeriod->m_cpbDelayOffset = 0;
     3816  seiBufferingPeriod->m_dpbDelayOffset = 0;
     3817
     3818  // Intial arrival time SEI message
     3819
     3820  seiBspInitialArrivalTime->m_nalInitialArrivalDelay[0] = 0;
     3821  seiBspInitialArrivalTime->m_vclInitialArrivalDelay[0] = 0;
     3822
     3823
     3824  seiBspNesting->m_nestedSEIs.push_back(seiBufferingPeriod);
     3825  seiBspNesting->m_nestedSEIs.push_back(seiBspInitialArrivalTime);
     3826  seiScalableNesting->m_nestedSEIs.push_back(seiBspNesting); // BSP nesting SEI is contained in scalable nesting SEI
     3827
     3828  return seiScalableNesting;
     3829}
     3830#endif
     3831
    36733832#endif //SVC_EXTENSION
    36743833
  • branches/SHM-5.1-dev/source/Lib/TLibEncoder/TEncGOP.h

    r595 r628  
    211211  SEIInterLayerConstrainedTileSets* xCreateSEIInterLayerConstrainedTileSets();
    212212#endif
     213#if O0164_MULTI_LAYER_HRD
     214  SEIScalableNesting* xCreateBspNestingSEI(TComSlice *pcSlice);
     215#endif
    213216#endif //SVC_EXTENSION
    214217};// END CLASS DEFINITION TEncGOP
Note: See TracChangeset for help on using the changeset viewer.