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


Ignore:
Timestamp:
13 Jul 2015, 20:38:11 (10 years ago)
Author:
seregin
Message:

port rev 4219 and rev 4246

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

Legend:

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

    r1218 r1235  
    106106 */
    107107#if LAYERS_NOT_PRESENT_SEI
    108 Void SEIReader::parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
    109 #else
    110 Void SEIReader::parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
     108Void SEIReader::parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
     109#else
     110Void SEIReader::parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
    111111#endif
    112112{
     
    133133#if O0164_MULTI_LAYER_HRD
    134134#if LAYERS_NOT_PRESENT_SEI
    135 Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps, std::ostream *pDecodedMessageOutputStream, const SEIScalableNesting *nestingSei, const SEIBspNesting *bspNestingSei)
    136 #else
    137 Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps, std::ostream *pDecodedMessageOutputStream, const SEIScalableNesting *nestingSei)
     135Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream, const SEIScalableNesting *nestingSei, const SEIBspNesting *bspNestingSei)
     136#else
     137Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream, const SEIScalableNesting *nestingSei)
    138138#endif
    139139#else
    140140#if LAYERS_NOT_PRESENT_SEI
    141 Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
    142 #else
    143 Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
     141Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
     142#else
     143Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
    144144#endif
    145145#endif
     
    557557
    558558#if SVC_EXTENSION
    559 Void SEIReader::xParseSEIDecodingUnitInfo(SEIDecodingUnitInfo& sei, UInt payloadSize, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps,std::ostream *pDecodedMessageOutputStream)
    560 #else
    561 Void SEIReader::xParseSEIDecodingUnitInfo(SEIDecodingUnitInfo& sei, UInt payloadSize, TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
     559Void SEIReader::xParseSEIDecodingUnitInfo(SEIDecodingUnitInfo& sei, UInt payloadSize, const TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, const TComVPS *vps, std::ostream *pDecodedMessageOutputStream)
     560#else
     561Void SEIReader::xParseSEIDecodingUnitInfo(SEIDecodingUnitInfo& sei, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
    562562#endif
    563563{
     
    568568
    569569#if SVC_EXTENSION
    570   TComHRD *hrd;
     570  const TComHRD *hrd;
    571571  if( bspNestingSei )   // If DU info SEI contained inside a BSP nesting SEI message
    572572  {
     
    577577    Int maxValues = vps->getNumBspSchedulesMinus1(seiOlsIdx, psIdx, maxTemporalId) + 1;
    578578    std::vector<Int> hrdIdx(maxValues, 0);
    579     std::vector<TComHRD *> hrdVec;
     579    std::vector<const TComHRD*> hrdVec;
    580580    std::vector<Int> syntaxElemLen(maxValues, 0);
    581581    for(Int i = 0; i < maxValues; i++)
     
    601601  else
    602602  {
    603     TComVUI *vui = sps->getVuiParameters();
     603    const TComVUI *vui = sps->getVuiParameters();
    604604    hrd = vui->getHrdParameters();
    605605  }
     
    621621  }
    622622#else
    623   TComVUI *vui = sps->getVuiParameters();
     623  const TComVUI *vui = sps->getVuiParameters();
    624624
    625625  if(vui->getHrdParameters()->getSubPicCpbParamsInPicTimingSEIFlag())
     
    642642
    643643#if SVC_EXTENSION
    644 Void SEIReader::xParseSEIBufferingPeriod(SEIBufferingPeriod& sei, UInt payloadSize, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps, std::ostream *pDecodedMessageOutputStream)
    645 #else
    646 Void SEIReader::xParseSEIBufferingPeriod(SEIBufferingPeriod& sei, UInt payloadSize, TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
     644Void SEIReader::xParseSEIBufferingPeriod(SEIBufferingPeriod& sei, UInt payloadSize, const TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, const TComVPS *vps, std::ostream *pDecodedMessageOutputStream)
     645#else
     646Void SEIReader::xParseSEIBufferingPeriod(SEIBufferingPeriod& sei, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
    647647#endif
    648648{
     
    651651
    652652#if SVC_EXTENSION
    653   TComHRD *pHRD;
     653  const TComHRD *pHRD;
    654654  if( bspNestingSei )   // If BP SEI contained inside a BSP nesting SEI message
    655655  {
     
    660660    Int maxValues = vps->getNumBspSchedulesMinus1(seiOlsIdx, psIdx, maxTemporalId) + 1;
    661661    std::vector<Int> hrdIdx(maxValues, 0);
    662     std::vector<TComHRD *> hrdVec;
     662    std::vector<const TComHRD*> hrdVec;
    663663    std::vector<Int> syntaxElemLen(maxValues, 0);
    664664    for(i = 0; i < maxValues; i++)
     
    683683  else
    684684  {
    685     TComVUI *vui = sps->getVuiParameters();
     685    const TComVUI *vui = sps->getVuiParameters();
    686686    pHRD = vui->getHrdParameters();
    687687  }
    688688  // To be done: When contained in an BSP HRD SEI message, the hrd structure is to be chosen differently.
    689689#else
    690   TComVUI *pVUI = sps->getVuiParameters();
    691   TComHRD *pHRD = pVUI->getHrdParameters();
     690  const TComVUI *pVUI = sps->getVuiParameters();
     691  const TComHRD *pHRD = pVUI->getHrdParameters();
    692692#endif
    693693
     
    746746
    747747#if SVC_EXTENSION
    748 Void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, UInt payloadSize, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps, std::ostream *pDecodedMessageOutputStream)
    749 #else
    750 Void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, UInt payloadSize, TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
     748Void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, UInt payloadSize, const TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, const TComVPS *vps, std::ostream *pDecodedMessageOutputStream)
     749#else
     750Void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
    751751#endif
    752752{
     
    755755
    756756#if SVC_EXTENSION
    757   TComHRD *hrd;   
    758   TComVUI *vui = sps->getVuiParameters();
     757  const TComHRD *hrd;   
     758  const TComVUI *vui = sps->getVuiParameters();
    759759  if( bspNestingSei )   // If BP SEI contained inside a BSP nesting SEI message
    760760  {
     
    765765    Int maxValues = vps->getNumBspSchedulesMinus1(seiOlsIdx, psIdx, maxTemporalId) + 1;
    766766    std::vector<Int> hrdIdx(maxValues, 0);
    767     std::vector<TComHRD *> hrdVec;
     767    std::vector<const TComHRD*> hrdVec;
    768768    std::vector<Int> syntaxElemLen(maxValues, 0);
    769769    for(i = 0; i < maxValues; i++)
     
    796796  // To be done: When contained in an BSP HRD SEI message, the hrd structure is to be chosen differently.
    797797#else
    798   TComVUI *vui = sps->getVuiParameters();
    799   TComHRD *hrd = vui->getHrdParameters();
     798  const TComVUI *vui = sps->getVuiParameters();
     799  const TComHRD *hrd = vui->getHrdParameters();
    800800#endif
    801801  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
     
    10611061
    10621062#if LAYERS_NOT_PRESENT_SEI
    1063 Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComVPS *vps, TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
    1064 #else
    1065 Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
     1063Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
     1064#else
     1065Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
    10661066#endif
    10671067{
     
    14231423#if SVC_EXTENSION
    14241424#if LAYERS_NOT_PRESENT_SEI
    1425 Void SEIReader::xParseSEILayersNotPresent(SEILayersNotPresent &sei, UInt payloadSize, TComVPS *vps, std::ostream *pDecodedMessageOutputStream)
     1425Void SEIReader::xParseSEILayersNotPresent(SEILayersNotPresent &sei, UInt payloadSize, const TComVPS *vps, std::ostream *pDecodedMessageOutputStream)
    14261426{
    14271427  UInt uiCode;
     
    14851485
    14861486#if SUB_BITSTREAM_PROPERTY_SEI
    1487 Void SEIReader::xParseSEISubBitstreamProperty(SEISubBitstreamProperty &sei, TComVPS *vps, std::ostream *pDecodedMessageOutputStream)
     1487Void SEIReader::xParseSEISubBitstreamProperty(SEISubBitstreamProperty &sei, const TComVPS *vps, std::ostream *pDecodedMessageOutputStream)
    14881488{
    14891489  UInt uiCode;
     
    15101510#if O0164_MULTI_LAYER_HRD
    15111511#if LAYERS_NOT_PRESENT_SEI
    1512 Void SEIReader::xParseSEIBspNesting(SEIBspNesting &sei, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei, std::ostream *pDecodedMessageOutputStream)
    1513 #else
    1514 Void SEIReader::xParseSEIBspNesting(SEIBspNesting &sei, const NalUnitType nalUnitType, TComSPS *sps, const SEIScalableNesting &nestingSei, std::ostream *pDecodedMessageOutputStream)
     1512Void SEIReader::xParseSEIBspNesting(SEIBspNesting &sei, const NalUnitType nalUnitType, const TComVPS *vps, const TComSPS *sps, const SEIScalableNesting &nestingSei, std::ostream *pDecodedMessageOutputStream)
     1513#else
     1514Void SEIReader::xParseSEIBspNesting(SEIBspNesting &sei, const NalUnitType nalUnitType, const TComSPS *sps, const SEIScalableNesting &nestingSei, std::ostream *pDecodedMessageOutputStream)
    15151515#endif
    15161516{
     
    15371537}
    15381538
    1539 Void SEIReader::xParseSEIBspInitialArrivalTime(SEIBspInitialArrivalTime &sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei, const SEIBspNesting &bspNestingSei, std::ostream *pDecodedMessageOutputStream)
     1539Void SEIReader::xParseSEIBspInitialArrivalTime(SEIBspInitialArrivalTime &sei, const TComVPS *vps, const TComSPS *sps, const SEIScalableNesting &nestingSei, const SEIBspNesting &bspNestingSei, std::ostream *pDecodedMessageOutputStream)
    15401540{
    15411541  assert(vps->getVpsVuiPresentFlag());
    15421542
    1543 #if SVC_EXTENSION
    15441543  UInt uiCode;
    15451544  Int psIdx         = bspNestingSei.m_seiPartitioningSchemeIdx;
     
    15481547  Int maxValues     = vps->getNumBspSchedulesMinus1(seiOlsIdx, psIdx, maxTemporalId) + 1;
    15491548  std::vector<Int> hrdIdx(0, maxValues);
    1550   std::vector<TComHRD *> hrdVec;
     1549  std::vector<const TComHRD*> hrdVec;
    15511550  std::vector<Int> syntaxElemLen;
    15521551  for(Int i = 0; i < maxValues; i++)
     
    15801579    }
    15811580  }
    1582 #else
    1583   UInt schedCombCnt = vps->getNumBspSchedCombinations(nestingSei.m_nestingOpIdx[0]);
    1584   UInt len;
    1585   UInt hrdIdx;
    1586   UInt uiCode;
    1587 
    1588   if (schedCombCnt > 0)
    1589   {
    1590     hrdIdx = vps->getBspCombHrdIdx(nestingSei.m_nestingOpIdx[0], 0, bspNestingSei.m_bspIdx);
    1591   }
    1592   else
    1593   {
    1594     hrdIdx = 0;
    1595   }
    1596 
    1597   TComHRD *hrd = vps->getBspHrd(hrdIdx);
    1598 
    1599   if (hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag())
    1600   {
    1601     len = hrd->getInitialCpbRemovalDelayLengthMinus1() + 1;
    1602   }
    1603   else
    1604   {
    1605     len = 23 + 1;
    1606   }
    1607 
    1608   if (hrd->getNalHrdParametersPresentFlag())
    1609   {
    1610     for(UInt i = 0; i < schedCombCnt; i++)
    1611     {
    1612       sei_read_code( pDecodedMessageOutputStream, len, uiCode, "nal_initial_arrival_delay" ); sei.m_nalInitialArrivalDelay[i] = uiCode;
    1613     }
    1614   }
    1615 #if BSP_INIT_ARRIVAL_SEI
    1616   if( hrd->getVclHrdParametersPresentFlag() )
    1617 #else
    1618   else
    1619 #endif
    1620   {
    1621     for(UInt i = 0; i < schedCombCnt; i++)
    1622     {
    1623       sei_read_code( pDecodedMessageOutputStream, len, uiCode, "vcl_initial_arrival_delay" ); sei.m_vclInitialArrivalDelay[i] = uiCode;
    1624     }
    1625   }
    1626 #endif
    16271581}
    16281582
  • branches/SHM-dev/source/Lib/TLibDecoder/SEIread.h

    r1218 r1235  
    5757  virtual ~SEIReader() {};
    5858#if LAYERS_NOT_PRESENT_SEI
    59   Void parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
     59  Void parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
    6060#else
    61   Void parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
     61  Void parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
    6262#endif
    6363protected:
    6464#if O0164_MULTI_LAYER_HRD
    6565#if LAYERS_NOT_PRESENT_SEI
    66   Void xReadSEImessage                        (SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps, std::ostream *pDecodedMessageOutputStream, const SEIScalableNesting *nestingSei=NULL, const SEIBspNesting *bspNestingSei=NULL);
     66  Void xReadSEImessage                        (SEIMessages& seis, const NalUnitType nalUnitType, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream, const SEIScalableNesting *nestingSei=NULL, const SEIBspNesting *bspNestingSei=NULL);
    6767#else
    68   Void xReadSEImessage                        (SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps, , std::ostream *pDecodedMessageOutputStream, const SEIScalableNesting *nestingSei=NULL);
     68  Void xReadSEImessage                        (SEIMessages& seis, const NalUnitType nalUnitType, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream, const SEIScalableNesting *nestingSei=NULL);
    6969#endif
    7070#else
    7171#if LAYERS_NOT_PRESENT_SEI
    72   Void xReadSEImessage                        (SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
     72  Void xReadSEImessage                        (SEIMessages& seis, const NalUnitType nalUnitType, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
    7373#else
    74   Void xReadSEImessage                        (SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
     74  Void xReadSEImessage                        (SEIMessages& seis, const NalUnitType nalUnitType, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
    7575#endif
    7676#endif
    77   Void xParseSEIuserDataUnregistered          (SEIuserDataUnregistered &sei,          UInt payloadSize,               std::ostream *pDecodedMessageOutputStream);
    78   Void xParseSEIActiveParameterSets           (SEIActiveParameterSets  &sei,          UInt payloadSize,               std::ostream *pDecodedMessageOutputStream);
    79   Void xParseSEIDecodedPictureHash            (SEIDecodedPictureHash& sei,            UInt payloadSize,               std::ostream *pDecodedMessageOutputStream);
     77  Void xParseSEIuserDataUnregistered          (SEIuserDataUnregistered &sei,          UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     78  Void xParseSEIActiveParameterSets           (SEIActiveParameterSets  &sei,          UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     79  Void xParseSEIDecodedPictureHash            (SEIDecodedPictureHash& sei,            UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    8080#if SVC_EXTENSION
    81   Void xParseSEIDecodingUnitInfo              (SEIDecodingUnitInfo& sei,              UInt payloadSize, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps, std::ostream *pDecodedMessageOutputStream);
    82   Void xParseSEIBufferingPeriod               (SEIBufferingPeriod& sei,               UInt payloadSize, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps, std::ostream *pDecodedMessageOutputStream);
    83   Void xParseSEIPictureTiming                 (SEIPictureTiming& sei,                 UInt payloadSize, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps, std::ostream *pDecodedMessageOutputStream);
     81  Void xParseSEIDecodingUnitInfo              (SEIDecodingUnitInfo& sei,              UInt payloadSize, const TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, const TComVPS *vps, std::ostream *pDecodedMessageOutputStream);
     82  Void xParseSEIBufferingPeriod               (SEIBufferingPeriod& sei,               UInt payloadSize, const TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, const TComVPS *vps, std::ostream *pDecodedMessageOutputStream);
     83  Void xParseSEIPictureTiming                 (SEIPictureTiming& sei,                 UInt payloadSize, const TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, const TComVPS *vps, std::ostream *pDecodedMessageOutputStream);
    8484#else
    85   Void xParseSEIDecodingUnitInfo              (SEIDecodingUnitInfo& sei,              UInt payloadSize, TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
    86   Void xParseSEIBufferingPeriod               (SEIBufferingPeriod& sei,               UInt payloadSize, TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
    87   Void xParseSEIPictureTiming                 (SEIPictureTiming& sei,                 UInt payloadSize, TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
     85  Void xParseSEIDecodingUnitInfo              (SEIDecodingUnitInfo& sei,              UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
     86  Void xParseSEIBufferingPeriod               (SEIBufferingPeriod& sei,               UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
     87  Void xParseSEIPictureTiming                 (SEIPictureTiming& sei,                 UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
    8888#endif
    89   Void xParseSEIRecoveryPoint                 (SEIRecoveryPoint& sei,                 UInt payloadSize,               std::ostream *pDecodedMessageOutputStream);
    90   Void xParseSEIFramePacking                  (SEIFramePacking& sei,                  UInt payloadSize,               std::ostream *pDecodedMessageOutputStream);
    91   Void xParseSEISegmentedRectFramePacking     (SEISegmentedRectFramePacking& sei,     UInt payloadSize,               std::ostream *pDecodedMessageOutputStream);
    92   Void xParseSEIDisplayOrientation            (SEIDisplayOrientation &sei,            UInt payloadSize,               std::ostream *pDecodedMessageOutputStream);
    93   Void xParseSEITemporalLevel0Index           (SEITemporalLevel0Index &sei,           UInt payloadSize,               std::ostream *pDecodedMessageOutputStream);
    94   Void xParseSEIRegionRefreshInfo             (SEIGradualDecodingRefreshInfo &sei,    UInt payloadSize,               std::ostream *pDecodedMessageOutputStream);
    95   Void xParseSEINoDisplay                     (SEINoDisplay &sei,                     UInt payloadSize,               std::ostream *pDecodedMessageOutputStream);
    96   Void xParseSEIToneMappingInfo               (SEIToneMappingInfo& sei,               UInt payloadSize,               std::ostream *pDecodedMessageOutputStream);
    97   Void xParseSEISOPDescription                (SEISOPDescription &sei,                UInt payloadSize,               std::ostream *pDecodedMessageOutputStream);
     89  Void xParseSEIRecoveryPoint                 (SEIRecoveryPoint& sei,                 UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     90  Void xParseSEIFramePacking                  (SEIFramePacking& sei,                  UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     91  Void xParseSEISegmentedRectFramePacking     (SEISegmentedRectFramePacking& sei,     UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     92  Void xParseSEIDisplayOrientation            (SEIDisplayOrientation &sei,            UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     93  Void xParseSEITemporalLevel0Index           (SEITemporalLevel0Index &sei,           UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     94  Void xParseSEIRegionRefreshInfo             (SEIGradualDecodingRefreshInfo &sei,    UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     95  Void xParseSEINoDisplay                     (SEINoDisplay &sei,                     UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     96  Void xParseSEIToneMappingInfo               (SEIToneMappingInfo& sei,               UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     97  Void xParseSEISOPDescription                (SEISOPDescription &sei,                UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    9898#if !LAYERS_NOT_PRESENT_SEI
    99   Void xParseSEIScalableNesting               (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
     99  Void xParseSEIScalableNesting               (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
    100100#endif
    101   Void xParseSEITempMotionConstraintsTileSets (SEITempMotionConstrainedTileSets& sei, UInt payloadSize,               std::ostream *pDecodedMessageOutputStream);
    102   Void xParseSEITimeCode                      (SEITimeCode& sei,                      UInt payloadSize,               std::ostream *pDecodedMessageOutputStream);
    103   Void xParseSEIChromaSamplingFilterHint      (SEIChromaSamplingFilterHint& sei,      UInt payloadSize/*,TComSPS* */, std::ostream *pDecodedMessageOutputStream);
    104   Void xParseSEIKneeFunctionInfo              (SEIKneeFunctionInfo& sei,              UInt payloadSize,               std::ostream *pDecodedMessageOutputStream);
    105   Void xParseSEIMasteringDisplayColourVolume  (SEIMasteringDisplayColourVolume& sei,  UInt payloadSize,               std::ostream *pDecodedMessageOutputStream);
     101  Void xParseSEITempMotionConstraintsTileSets (SEITempMotionConstrainedTileSets& sei, UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     102  Void xParseSEITimeCode                      (SEITimeCode& sei,                      UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     103  Void xParseSEIChromaSamplingFilterHint      (SEIChromaSamplingFilterHint& sei,      UInt payloadSize/*,TComSPS* */,       std::ostream *pDecodedMessageOutputStream);
     104  Void xParseSEIKneeFunctionInfo              (SEIKneeFunctionInfo& sei,              UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
     105  Void xParseSEIMasteringDisplayColourVolume  (SEIMasteringDisplayColourVolume& sei,  UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    106106
    107107  Void sei_read_code(std::ostream *pOS, UInt uiLength, UInt& ruiCode, const Char *pSymbolName);
     
    111111
    112112#if Q0074_COLOUR_REMAPPING_SEI
    113   Void xParseSEIColourRemappingInfo           (SEIColourRemappingInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     113  Void xParseSEIColourRemappingInfo           (SEIColourRemappingInfo& sei,           UInt payloadSize,                    std::ostream *pDecodedMessageOutputStream);
    114114#endif
    115115#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
    116   Void xParseSEIInterLayerConstrainedTileSets (SEIInterLayerConstrainedTileSets &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     116  Void xParseSEIInterLayerConstrainedTileSets (SEIInterLayerConstrainedTileSets &sei, UInt payloadSize,                     std::ostream *pDecodedMessageOutputStream);
    117117#endif
    118118#if SUB_BITSTREAM_PROPERTY_SEI
    119 Void   xParseSEISubBitstreamProperty          (SEISubBitstreamProperty &sei, TComVPS *vps, std::ostream *pDecodedMessageOutputStream);
     119Void   xParseSEISubBitstreamProperty          (SEISubBitstreamProperty &sei,          const TComVPS *vps,                  std::ostream *pDecodedMessageOutputStream);
    120120#endif
    121121#if LAYERS_NOT_PRESENT_SEI
    122   Void xParseSEILayersNotPresent              (SEILayersNotPresent &sei, UInt payloadSize, TComVPS *vps ,std::ostream *pDecodedMessageOutputStream);
    123   Void xParseSEIScalableNesting               (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComVPS *vps, TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
     122  Void xParseSEILayersNotPresent              (SEILayersNotPresent &sei,     UInt payloadSize, const TComVPS *vps,          std::ostream *pDecodedMessageOutputStream);
     123  Void xParseSEIScalableNesting               (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream);
    124124#endif
    125125#if O0164_MULTI_LAYER_HRD
    126126#if LAYERS_NOT_PRESENT_SEI
    127   Void xParseSEIBspNesting                    (SEIBspNesting &sei, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei, std::ostream *pDecodedMessageOutputStream);
     127  Void xParseSEIBspNesting                    (SEIBspNesting &sei, const NalUnitType nalUnitType, const TComVPS *vps, const TComSPS *sps, const SEIScalableNesting &nestingSei, std::ostream *pDecodedMessageOutputStream);
    128128#else
    129   Void xParseSEIBspNesting                    (SEIBspNesting &sei, const NalUnitType nalUnitType, TComSPS *sps, const SEIScalableNesting &nestingSei ,std::ostream *pDecodedMessageOutputStream);
     129  Void xParseSEIBspNesting                    (SEIBspNesting &sei, const NalUnitType nalUnitType, const TComSPS *sps, const SEIScalableNesting &nestingSei ,std::ostream *pDecodedMessageOutputStream);
    130130#endif
    131   Void xParseSEIBspInitialArrivalTime         (SEIBspInitialArrivalTime &sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei, const SEIBspNesting &bspNestingSei, std::ostream *pDecodedMessageOutputStream);
    132   Void xParseHrdParameters                    (TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1, std::ostream *pDecodedMessageOutputStream);
     131  Void xParseSEIBspInitialArrivalTime         (SEIBspInitialArrivalTime &sei, const TComVPS *vps, const TComSPS *sps, const SEIScalableNesting &nestingSei, const SEIBspNesting &bspNestingSei, std::ostream *pDecodedMessageOutputStream);
     132  Void xParseHrdParameters                    (TComHRD *hrd,   Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1,      std::ostream *pDecodedMessageOutputStream);
    133133#endif
    134134#if Q0189_TMVP_CONSTRAINTS
    135   Void xParseSEITMVPConstraints               (SEITMVPConstrains& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     135  Void xParseSEITMVPConstraints               (SEITMVPConstrains& sei,                UInt payloadSize,                    std::ostream *pDecodedMessageOutputStream);
    136136#endif
    137137#if Q0247_FRAME_FIELD_INFO
    138   Void xParseSEIFrameFieldInfo                (SEIFrameFieldInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     138  Void xParseSEIFrameFieldInfo                (SEIFrameFieldInfo& sei,                UInt payloadSize,                    std::ostream *pDecodedMessageOutputStream);
    139139#endif
    140140#if P0123_ALPHA_CHANNEL_SEI
    141   Void xParseSEIAlphaChannelInfo              (SEIAlphaChannelInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     141  Void xParseSEIAlphaChannelInfo              (SEIAlphaChannelInfo& sei,              UInt payloadSize,                    std::ostream *pDecodedMessageOutputStream);
    142142#endif
    143143#if Q0096_OVERLAY_SEI
    144   Void xParseSEIOverlayInfo                   (SEIOverlayInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     144  Void xParseSEIOverlayInfo                   (SEIOverlayInfo& sei,                   UInt payloadSize,                    std::ostream *pDecodedMessageOutputStream);
    145145#endif
    146146#if P0138_USE_ALT_CPB_PARAMS_FLAG
    147   Bool xPayloadExtensionPresent       ();
     147  Bool xPayloadExtensionPresent();
    148148#endif
    149149};
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r1230 r1235  
    316316  if(pcPPS->getScalingListPresentFlag ())
    317317  {
    318     parseScalingList( pcPPS->getScalingList() );
     318    parseScalingList( &(pcPPS->getScalingList()) );
    319319  }
    320320
     
    379379                Int cbOffset;
    380380                Int crOffset;
    381                 READ_SVLC(cbOffset, "cb_qp_adjustnemt[i]");
    382                 READ_SVLC(crOffset, "cr_qp_adjustnemt[i]");
     381                READ_SVLC(cbOffset, "cb_qp_adjustment[i]");
     382                READ_SVLC(crOffset, "cr_qp_adjustment[i]");
    383383                pcPPS->setChromaQpAdjTableAt(chromaQpAdjustmentIndex, cbOffset, crOffset);
    384384              }
     
    879879    if(pcSPS->getScalingListPresentFlag ())
    880880    {
    881       parseScalingList( pcSPS->getScalingList() );
     881      parseScalingList( &(pcSPS->getScalingList()) );
    882882    }
    883883#if SVC_EXTENSION
     
    11411141}
    11421142
    1143 Void TDecCavlc::parseSliceHeader (TComSlice* pcSlice, ParameterSetManagerDecoder *parameterSetManager)
     1143Void TDecCavlc::parseSliceHeader (TComSlice* pcSlice, ParameterSetManager *parameterSetManager)
    11441144{
    11451145  UInt  uiCode;
     
    11651165  }
    11661166  READ_UVLC (    uiCode, "slice_pic_parameter_set_id" );  pcSlice->setPPSId(uiCode);
    1167   pps = parameterSetManager->getPrefetchedPPS(uiCode);
     1167  pps = parameterSetManager->getPPS(uiCode);
    11681168  //!KS: need to add error handling code here, if PPS is not available
    11691169  assert(pps!=0);
    1170   sps = parameterSetManager->getPrefetchedSPS(pps->getSPSId());
     1170  sps = parameterSetManager->getSPS(pps->getSPSId());
    11711171  //!KS: need to add error handling code here, if SPS is not available
    11721172  assert(sps!=0);
    11731173  pcSlice->setSPS(sps);
    11741174  pcSlice->setPPS(pps);
     1175
     1176#if SVC_EXTENSION
     1177  TComVPS* vps = parameterSetManager->getVPS(sps->getVPSId());
     1178  pcSlice->setVPS(vps);
     1179
     1180  Int iPOClsb = 0;
     1181#endif
    11751182
    11761183  const ChromaFormat chFmt = sps->getChromaFormatIdc();
     
    12121219  }
    12131220
    1214 #if SVC_EXTENSION
    1215   Int iPOClsb = 0;
    1216 #endif
    1217 
    12181221  if(!pcSlice->getDependentSliceSegmentFlag())
    12191222  {
    12201223#if SVC_EXTENSION
    12211224    Int iBits = 0;
    1222     if(pcSlice->getPPS()->getNumExtraSliceHeaderBits() > iBits)
     1225    if(pps->getNumExtraSliceHeaderBits() > iBits)
    12231226    {
    12241227      READ_FLAG(uiCode, "discardable_flag");
     
    12371240    }
    12381241
    1239     if(pcSlice->getPPS()->getNumExtraSliceHeaderBits() > iBits)
     1242    if(pps->getNumExtraSliceHeaderBits() > iBits)
    12401243    {
    12411244      READ_FLAG(uiCode, "cross_layer_bla_flag");  pcSlice->setCrossLayerBLAFlag( uiCode ? true : false );
     
    12431246    }
    12441247
    1245     for ( ; iBits < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); iBits++)
     1248    for ( ; iBits < pps->getNumExtraSliceHeaderBits(); iBits++)
    12461249    {
    12471250      READ_FLAG(uiCode, "slice_reserved_undetermined_flag[]"); // ignored
    12481251    }
    12491252#else //SVC_EXTENSION
    1250     for (Int i = 0; i < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++)
     1253    for (Int i = 0; i < pps->getNumExtraSliceHeaderBits(); i++)
    12511254    {
    12521255      READ_FLAG(uiCode, "slice_reserved_undetermined_flag[]"); // ignored
     
    12761279
    12771280#if SVC_EXTENSION
    1278     if( ( pcSlice->getLayerId() > 0 && !pcSlice->getVPS()->getPocLsbNotPresentFlag( pcSlice->getVPS()->getLayerIdxInVps(pcSlice->getLayerId())) ) || !pcSlice->getIdrPicFlag() )
     1281    if( ( pcSlice->getLayerId() > 0 && !vps->getPocLsbNotPresentFlag( vps->getLayerIdxInVps(pcSlice->getLayerId())) ) || !pcSlice->getIdrPicFlag() )
    12791282#else
    12801283    else
     
    13361339      {
    13371340        Int numBits = 0;
    1338         while ((1 << numBits) < pcSlice->getSPS()->getRPSList()->getNumberOfReferencePictureSets())
     1341        while ((1 << numBits) < sps->getRPSList()->getNumberOfReferencePictureSets())
    13391342        {
    13401343          numBits++;
     
    13561359        UInt numOfLtrp = 0;
    13571360        UInt numLtrpInSPS = 0;
    1358         if (pcSlice->getSPS()->getNumLongTermRefPicSPS() > 0)
     1361        if (sps->getNumLongTermRefPicSPS() > 0)
    13591362        {
    13601363          READ_UVLC( uiCode, "num_long_term_sps");
     
    13641367        }
    13651368        Int bitsForLtrpInSPS = 0;
    1366         while (pcSlice->getSPS()->getNumLongTermRefPicSPS() > (1 << bitsForLtrpInSPS))
     1369        while (sps->getNumLongTermRefPicSPS() > (1 << bitsForLtrpInSPS))
    13671370        {
    13681371          bitsForLtrpInSPS++;
     
    13711374        numOfLtrp += uiCode;
    13721375        rps->setNumberOfLongtermPictures(numOfLtrp);
    1373         Int maxPicOrderCntLSB = 1 << pcSlice->getSPS()->getBitsForPOC();
     1376        Int maxPicOrderCntLSB = 1 << sps->getBitsForPOC();
    13741377        Int prevDeltaMSB = 0, deltaPocMSBCycleLT = 0;
    13751378        for(Int j=offset+rps->getNumberOfLongtermPictures()-1, k = 0; k < numOfLtrp; j--, k++)
     
    13831386              READ_CODE(bitsForLtrpInSPS, uiCode, "lt_idx_sps[i]");
    13841387            }
    1385             Bool usedByCurrFromSPS=pcSlice->getSPS()->getUsedByCurrPicLtSPSFlag(uiCode);
    1386 
    1387             pocLsbLt = pcSlice->getSPS()->getLtRefPicPocLsbSps(uiCode);
     1388            Bool usedByCurrFromSPS=sps->getUsedByCurrPicLtSPSFlag(uiCode);
     1389
     1390            pocLsbLt = sps->getLtRefPicPocLsbSps(uiCode);
    13881391            rps->setUsed(j,usedByCurrFromSPS);
    13891392          }
    13901393          else
    13911394          {
    1392             READ_CODE(pcSlice->getSPS()->getBitsForPOC(), uiCode, "poc_lsb_lt"); pocLsbLt= uiCode;
     1395            READ_CODE(sps->getBitsForPOC(), uiCode, "poc_lsb_lt"); pocLsbLt= uiCode;
    13931396            READ_FLAG( uiCode, "used_by_curr_pic_lt_flag");     rps->setUsed(j,uiCode);
    13941397          }
     
    14831486        pcSlice->setRPS(rps);
    14841487      }
    1485       if (pcSlice->getSPS()->getTMVPFlagsPresent())
     1488      if (sps->getTMVPFlagsPresent())
    14861489      {
    14871490        READ_FLAG( uiCode, "slice_temporal_mvp_enable_flag" );
     
    14961499#if SVC_EXTENSION
    14971500    pcSlice->setActiveNumILRRefIdx(0);
    1498     if((pcSlice->getLayerId() > 0) && !(pcSlice->getVPS()->getIlpSshSignalingEnabledFlag()) && (pcSlice->getNumILRRefIdx() > 0) )
     1501    if((pcSlice->getLayerId() > 0) && !(vps->getIlpSshSignalingEnabledFlag()) && (pcSlice->getNumILRRefIdx() > 0) )
    14991502    {
    15001503      READ_FLAG(uiCode,"inter_layer_pred_enabled_flag");
     
    15091512            numBits++;
    15101513          }
    1511           if( !pcSlice->getVPS()->getMaxOneActiveRefLayerFlag())
     1514          if( !vps->getMaxOneActiveRefLayerFlag())
    15121515          {
    15131516            READ_CODE( numBits, uiCode,"num_inter_layer_ref_pics_minus1" );
     
    15181521            for( Int i = 0; i < pcSlice->getNumILRRefIdx(); i++ )
    15191522            {
    1520               if( ( pcSlice->getVPS()->getMaxTidIlRefPicsPlus1(pcSlice->getVPS()->getLayerIdxInVps(i), pcSlice->getLayerIdx()) > pcSlice->getTLayer() || pcSlice->getTLayer()==0 ) &&
    1521                     pcSlice->getVPS()->getMaxTSLayersMinus1(pcSlice->getVPS()->getLayerIdxInVps(i)) >=  pcSlice->getTLayer() )
     1523              if( ( vps->getMaxTidIlRefPicsPlus1(vps->getLayerIdxInVps(i), pcSlice->getLayerIdx()) > pcSlice->getTLayer() || pcSlice->getTLayer()==0 ) &&
     1524                    vps->getMaxTSLayersMinus1(vps->getLayerIdxInVps(i)) >=  pcSlice->getTLayer() )
    15221525              {         
    15231526                pcSlice->setActiveNumILRRefIdx(1);
     
    15451548        else
    15461549        {
    1547           Int refLayerId = pcSlice->getVPS()->getRefLayerId(pcSlice->getLayerId(), 0);
    1548           Int refLayerIdx = pcSlice->getVPS()->getLayerIdxInVps(refLayerId);
    1549 
    1550           if( ( pcSlice->getVPS()->getMaxTidIlRefPicsPlus1(refLayerIdx, pcSlice->getLayerIdx()) > pcSlice->getTLayer() || pcSlice->getTLayer()==0 ) &&
    1551                 pcSlice->getVPS()->getMaxTSLayersMinus1(refLayerIdx) >=  pcSlice->getTLayer() )
     1550          Int refLayerId = vps->getRefLayerId(pcSlice->getLayerId(), 0);
     1551          Int refLayerIdx = vps->getLayerIdxInVps(refLayerId);
     1552
     1553          if( ( vps->getMaxTidIlRefPicsPlus1(refLayerIdx, pcSlice->getLayerIdx()) > pcSlice->getTLayer() || pcSlice->getTLayer()==0 ) &&
     1554                vps->getMaxTSLayersMinus1(refLayerIdx) >=  pcSlice->getTLayer() )
    15521555          {
    15531556            pcSlice->setActiveNumILRRefIdx(1);
     
    15571560      }
    15581561    }
    1559     else if( pcSlice->getVPS()->getIlpSshSignalingEnabledFlag() == true &&  (pcSlice->getLayerId() > 0 ))
     1562    else if( vps->getIlpSshSignalingEnabledFlag() == true &&  (pcSlice->getLayerId() > 0 ))
    15601563    {
    15611564      pcSlice->setInterLayerPredEnabledFlag(true);
     
    15661569      for(i = 0, numRefLayerPics = 0;  i < pcSlice->getNumILRRefIdx(); i++ )
    15671570      {
    1568         if( ( pcSlice->getVPS()->getMaxTidIlRefPicsPlus1(pcSlice->getVPS()->getLayerIdxInVps(i), pcSlice->getLayerIdx()) > pcSlice->getTLayer() || pcSlice->getTLayer()==0 ) &&
    1569               pcSlice->getVPS()->getMaxTSLayersMinus1(pcSlice->getVPS()->getLayerIdxInVps(i)) >=  pcSlice->getTLayer() )
     1571        if( ( vps->getMaxTidIlRefPicsPlus1(vps->getLayerIdxInVps(i), pcSlice->getLayerIdx()) > pcSlice->getTLayer() || pcSlice->getTLayer()==0 ) &&
     1572              vps->getMaxTSLayersMinus1(vps->getLayerIdxInVps(i)) >=  pcSlice->getTLayer() )
    15701573        {         
    15711574          refLayerPicIdc[ numRefLayerPics++ ] = i;
     
    15911594      else
    15921595      {
    1593         format = pcSlice->getVPS()->getVpsRepFormat( sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : pcSlice->getVPS()->getVpsRepFormatIdx( pcSlice->getVPS()->getLayerIdxInVps(sps->getLayerId()) ) )->getChromaFormatVpsIdc();
     1596        format = vps->getVpsRepFormat( sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : vps->getVpsRepFormatIdx( vps->getLayerIdxInVps(sps->getLayerId()) ) )->getChromaFormatVpsIdc();
    15941597
    15951598        // conformance check
    1596         assert( (sps->getUpdateRepFormatFlag()==false && pcSlice->getVPS()->getVpsNumRepFormats()==1) || pcSlice->getVPS()->getVpsNumRepFormats() > 1 );
     1599        assert( (sps->getUpdateRepFormatFlag()==false && vps->getVpsNumRepFormats()==1) || vps->getVpsNumRepFormats() > 1 );
    15971600      }
    15981601      if (format != CHROMA_400)
     
    16331636      else
    16341637      {
    1635         pcSlice->setNumRefIdx(REF_PIC_LIST_0, pcSlice->getPPS()->getNumRefIdxL0DefaultActive());
     1638        pcSlice->setNumRefIdx(REF_PIC_LIST_0, pps->getNumRefIdxL0DefaultActive());
    16361639        if (pcSlice->isInterB())
    16371640        {
    1638           pcSlice->setNumRefIdx(REF_PIC_LIST_1, pcSlice->getPPS()->getNumRefIdxL1DefaultActive());
     1641          pcSlice->setNumRefIdx(REF_PIC_LIST_1, pps->getNumRefIdxL1DefaultActive());
    16391642        }
    16401643        else
     
    16481651    if(!pcSlice->isIntra())
    16491652    {
    1650       if( !pcSlice->getPPS()->getListsModificationPresentFlag() || pcSlice->getNumRpsCurrTempList() <= 1 )
     1653      if( !pps->getListsModificationPresentFlag() || pcSlice->getNumRpsCurrTempList() <= 1 )
    16511654      {
    16521655        refPicListModification->setRefPicListModificationFlagL0( 0 );
     
    16911694    if(pcSlice->isInterB())
    16921695    {
    1693       if( !pcSlice->getPPS()->getListsModificationPresentFlag() || pcSlice->getNumRpsCurrTempList() <= 1 )
     1696      if( !pps->getListsModificationPresentFlag() || pcSlice->getNumRpsCurrTempList() <= 1 )
    16941697      {
    16951698        refPicListModification->setRefPicListModificationFlagL1( 0 );
     
    17731776    if ( (pps->getUseWP() && pcSlice->getSliceType()==P_SLICE) || (pps->getWPBiPred() && pcSlice->getSliceType()==B_SLICE) )
    17741777    {
    1775       xParsePredWeightTable(pcSlice);
    1776       pcSlice->initWpScaling();
     1778      xParsePredWeightTable(pcSlice, sps);
     1779      pcSlice->initWpScaling(sps);
    17771780    }
    17781781    if (!pcSlice->isIntra())
     
    17951798    assert( pcSlice->getSliceQp() <=  51 );
    17961799
    1797     if (pcSlice->getPPS()->getSliceChromaQpFlag())
     1800    if (pps->getSliceChromaQpFlag())
    17981801    {
    17991802      if (numValidComp>COMPONENT_Cb)
     
    18031806        assert( pcSlice->getSliceChromaQpDelta(COMPONENT_Cb) >= -12 );
    18041807        assert( pcSlice->getSliceChromaQpDelta(COMPONENT_Cb) <=  12 );
    1805         assert( (pcSlice->getPPS()->getQpOffset(COMPONENT_Cb) + pcSlice->getSliceChromaQpDelta(COMPONENT_Cb)) >= -12 );
    1806         assert( (pcSlice->getPPS()->getQpOffset(COMPONENT_Cb) + pcSlice->getSliceChromaQpDelta(COMPONENT_Cb)) <=  12 );
     1808        assert( (pps->getQpOffset(COMPONENT_Cb) + pcSlice->getSliceChromaQpDelta(COMPONENT_Cb)) >= -12 );
     1809        assert( (pps->getQpOffset(COMPONENT_Cb) + pcSlice->getSliceChromaQpDelta(COMPONENT_Cb)) <=  12 );
    18071810      }
    18081811
     
    18131816        assert( pcSlice->getSliceChromaQpDelta(COMPONENT_Cr) >= -12 );
    18141817        assert( pcSlice->getSliceChromaQpDelta(COMPONENT_Cr) <=  12 );
    1815         assert( (pcSlice->getPPS()->getQpOffset(COMPONENT_Cr) + pcSlice->getSliceChromaQpDelta(COMPONENT_Cr)) >= -12 );
    1816         assert( (pcSlice->getPPS()->getQpOffset(COMPONENT_Cr) + pcSlice->getSliceChromaQpDelta(COMPONENT_Cr)) <=  12 );
    1817       }
    1818     }
    1819 
    1820     if (pcSlice->getPPS()->getChromaQpAdjTableSize() > 0)
     1818        assert( (pps->getQpOffset(COMPONENT_Cr) + pcSlice->getSliceChromaQpDelta(COMPONENT_Cr)) >= -12 );
     1819        assert( (pps->getQpOffset(COMPONENT_Cr) + pcSlice->getSliceChromaQpDelta(COMPONENT_Cr)) <=  12 );
     1820      }
     1821    }
     1822
     1823    if (pps->getChromaQpAdjTableSize() > 0)
    18211824    {
    18221825      READ_FLAG(uiCode, "slice_chroma_qp_adjustment_enabled_flag"); pcSlice->setUseChromaQpAdj(uiCode != 0);
     
    18241827    else pcSlice->setUseChromaQpAdj(false);
    18251828
    1826     if (pcSlice->getPPS()->getDeblockingFilterControlPresentFlag())
    1827     {
    1828       if(pcSlice->getPPS()->getDeblockingFilterOverrideEnabledFlag())
     1829    if (pps->getDeblockingFilterControlPresentFlag())
     1830    {
     1831      if(pps->getDeblockingFilterOverrideEnabledFlag())
    18291832      {
    18301833        READ_FLAG ( uiCode, "deblocking_filter_override_flag" );        pcSlice->setDeblockingFilterOverrideFlag(uiCode ? true : false);
     
    18491852      else
    18501853      {
    1851         pcSlice->setDeblockingFilterDisable   ( pcSlice->getPPS()->getPicDisableDeblockingFilterFlag() );
    1852         pcSlice->setDeblockingFilterBetaOffsetDiv2( pcSlice->getPPS()->getDeblockingFilterBetaOffsetDiv2() );
    1853         pcSlice->setDeblockingFilterTcOffsetDiv2  ( pcSlice->getPPS()->getDeblockingFilterTcOffsetDiv2() );
     1854        pcSlice->setDeblockingFilterDisable   ( pps->getPicDisableDeblockingFilterFlag() );
     1855        pcSlice->setDeblockingFilterBetaOffsetDiv2( pps->getDeblockingFilterBetaOffsetDiv2() );
     1856        pcSlice->setDeblockingFilterTcOffsetDiv2  ( pps->getDeblockingFilterTcOffsetDiv2() );
    18541857      }
    18551858    }
     
    18611864    }
    18621865
    1863     Bool isSAOEnabled = pcSlice->getSPS()->getUseSAO() && (pcSlice->getSaoEnabledFlag(CHANNEL_TYPE_LUMA) || (bChroma && pcSlice->getSaoEnabledFlag(CHANNEL_TYPE_CHROMA)));
     1866    Bool isSAOEnabled = sps->getUseSAO() && (pcSlice->getSaoEnabledFlag(CHANNEL_TYPE_LUMA) || (bChroma && pcSlice->getSaoEnabledFlag(CHANNEL_TYPE_CHROMA)));
    18641867    Bool isDBFEnabled = (!pcSlice->getDeblockingFilterDisable());
    18651868
    1866     if(pcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag() && ( isSAOEnabled || isDBFEnabled ))
     1869    if(pps->getLoopFilterAcrossSlicesEnabledFlag() && ( isSAOEnabled || isDBFEnabled ))
    18671870    {
    18681871      READ_FLAG( uiCode, "slice_loop_filter_across_slices_enabled_flag");
     
    18701873    else
    18711874    {
    1872       uiCode = pcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag()?1:0;
     1875      uiCode = pps->getLoopFilterAcrossSlicesEnabledFlag()?1:0;
    18731876    }
    18741877    pcSlice->setLFCrossSliceBoundaryFlag( (uiCode==1)?true:false);
     
    23792382* \returns Void
    23802383*/
    2381 Void TDecCavlc::xParsePredWeightTable( TComSlice* pcSlice )
     2384Void TDecCavlc::xParsePredWeightTable( TComSlice* pcSlice, const TComSPS *sps )
    23822385{
    23832386        WPScalingParam *wp;
    2384         TComSPS        *sps          = pcSlice->getSPS();
    23852387  const ChromaFormat    chFmt        = sps->getChromaFormatIdc();
    23862388  const Int             numValidComp = Int(getNumberValidComponents(chFmt));
     
    25262528        READ_FLAG( code, "scaling_list_pred_mode_flag");
    25272529        scalingListPredModeFlag = (code) ? true : false;
     2530        scalingList->setScalingListPredModeFlag(sizeId, listId, scalingListPredModeFlag);
    25282531        if(!scalingListPredModeFlag) //Copy Mode
    25292532        {
     
    37333736                }
    37343737
    3735                 READ_CODE(numBits, uiCode, "bsp_comb_hrd_idx[h][i][t][j][k]");      vps->setBspHrdIdx(h, i, t, j, k, uiCode);
     3738                READ_CODE(numBits, uiCode, "bsp_hrd_idx[h][i][t][j][k]");      vps->setBspHrdIdx(h, i, t, j, k, uiCode);
    37363739              }
    37373740
    3738               READ_UVLC(uiCode, "bsp_comb_sched_idx[h][i][t][j][k]");    vps->setBspSchedIdx(h, i, t, j, k, uiCode);
     3741              READ_UVLC(uiCode, "bsp_sched_idx[h][i][t][j][k]");    vps->setBspSchedIdx(h, i, t, j, k, uiCode);
    37393742            }
    37403743          }
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.h

    r1224 r1235  
    8585  Void  parseProfileTier    (ProfileTierLevel *ptl);
    8686  Void  parseHrdParameters  (TComHRD *hrd, Bool cprms_present_flag, UInt tempLevelHigh);
    87   Void  parseSliceHeader    ( TComSlice* pcSlice, ParameterSetManagerDecoder *parameterSetManager);
     87  Void  parseSliceHeader    ( TComSlice* pcSlice, ParameterSetManager *parameterSetManager);
    8888  Void  parseTerminatingBit ( UInt& ruiBit );
    8989  Void  parseRemainingBytes ( Bool noTrailingBytesExpected );
     
    117117  Void parseIPCMInfo        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth);
    118118
    119   Void xParsePredWeightTable ( TComSlice* pcSlice );
     119  Void xParsePredWeightTable ( TComSlice* pcSlice, const TComSPS *sps );
    120120  Void  parseScalingList     ( TComScalingList* scalingList );
    121121  Void xDecodeScalingList    ( TComScalingList *scalingList, UInt sizeId, UInt listId);
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecCu.cpp

    r1203 r1235  
    239239  {
    240240    UInt uiIdx = uiAbsPartIdx;
    241     if( (g_uiMaxCUWidth>>uiDepth) == pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP())
     241    if( (g_uiMaxCUWidth>>uiDepth) == (g_uiMaxCUWidth >> ( pcCU->getSlice()->getPPS()->getMaxCuDQPDepth())) && pcCU->getSlice()->getPPS()->getUseDQP())
    242242    {
    243243      setdQPFlag(true);
     
    245245    }
    246246
    247     if( (g_uiMaxCUWidth>>uiDepth) == pcCU->getSlice()->getPPS()->getMinCuChromaQpAdjSize() && pcCU->getSlice()->getUseChromaQpAdj() )
     247    if( (g_uiMaxCUWidth>>uiDepth) == (g_uiMaxCUWidth >> ( pcCU->getSlice()->getPPS()->getMaxCuChromaQpAdjDepth())) && pcCU->getSlice()->getUseChromaQpAdj() )
    248248    {
    249249      setIsChromaQpAdjCoded(true);
     
    270270      uiIdx += uiQNumParts;
    271271    }
    272     if( (g_uiMaxCUWidth>>uiDepth) == pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP())
     272    if( (g_uiMaxCUWidth>>uiDepth) == (g_uiMaxCUWidth >> ( pcCU->getSlice()->getPPS()->getMaxCuDQPDepth())) && pcCU->getSlice()->getPPS()->getUseDQP())
    273273    {
    274274      if ( getdQPFlag() )
     
    281281  }
    282282
    283   if( (g_uiMaxCUWidth>>uiDepth) >= pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP())
     283  if( (g_uiMaxCUWidth>>uiDepth) >= (g_uiMaxCUWidth >> ( pcCU->getSlice()->getPPS()->getMaxCuDQPDepth())) && pcCU->getSlice()->getPPS()->getUseDQP())
    284284  {
    285285    setdQPFlag(true);
     
    287287  }
    288288
    289   if( (g_uiMaxCUWidth>>uiDepth) >= pcCU->getSlice()->getPPS()->getMinCuChromaQpAdjSize() && pcCU->getSlice()->getUseChromaQpAdj() )
     289  if( (g_uiMaxCUWidth>>uiDepth) >= (g_uiMaxCUWidth >> ( pcCU->getSlice()->getPPS()->getMaxCuChromaQpAdjDepth())) && pcCU->getSlice()->getUseChromaQpAdj() )
    290290  {
    291291    setIsChromaQpAdjCoded(true);
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecEntropy.h

    r1212 r1235  
    7777#endif
    7878
    79   virtual Void parseSliceHeader          ( TComSlice* pcSlice, ParameterSetManagerDecoder *parameterSetManager)       = 0;
     79  virtual Void parseSliceHeader          ( TComSlice* pcSlice, ParameterSetManager *parameterSetManager)       = 0;
    8080
    8181  virtual Void parseTerminatingBit       ( UInt& ruilsLast )                                     = 0;
     
    150150  Void    decodePPS                   ( TComPPS* pcPPS ) { m_pcEntropyDecoderIf->parsePPS(pcPPS); }
    151151#endif
    152   Void    decodeSliceHeader           ( TComSlice* pcSlice, ParameterSetManagerDecoder *parameterSetManager)  { m_pcEntropyDecoderIf->parseSliceHeader(pcSlice, parameterSetManager);         }
     152  Void    decodeSliceHeader           ( TComSlice* pcSlice, ParameterSetManager *parameterSetManager)  { m_pcEntropyDecoderIf->parseSliceHeader(pcSlice, parameterSetManager);         }
    153153
    154154  Void    decodeTerminatingBit        ( UInt& ruiIsLast )       { m_pcEntropyDecoderIf->parseTerminatingBit(ruiIsLast);     }
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecSbac.cpp

    r1230 r1235  
    584584    }
    585585    eMode = (PartSize) uiMode;
    586     if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) )
     586    if ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < g_uiMaxCUDepth-g_uiAddCUDepth )
    587587    {
    588588      if (eMode == SIZE_2NxN)
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecSbac.h

    r1212 r1235  
    8585    ) {}
    8686
    87   Void  parseSliceHeader          ( TComSlice* /*pcSlice*/, ParameterSetManagerDecoder* /*parameterSetManager*/) {}
     87  Void  parseSliceHeader          ( TComSlice* /*pcSlice*/, ParameterSetManager* /*parameterSetManager*/) {}
    8888  Void  parseTerminatingBit       ( UInt& ruiBit );
    8989  Void  parseRemainingBytes       ( Bool noTrailingBytesExpected);
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecSlice.cpp

    r1029 r1235  
    4040//! \ingroup TLibDecoder
    4141//! \{
    42 
    43 #if SVC_EXTENSION
    44 ParameterSetMap<TComVPS> ParameterSetManagerDecoder::m_vpsBuffer(MAX_NUM_VPS);
    45 ParameterSetMap<TComSPS> ParameterSetManagerDecoder::m_spsBuffer(MAX_NUM_SPS);
    46 ParameterSetMap<TComPPS> ParameterSetManagerDecoder::m_ppsBuffer(MAX_NUM_PPS);
    47 #endif
    4842
    4943//////////////////////////////////////////////////////////////////////
     
    271265}
    272266
    273 ParameterSetManagerDecoder::ParameterSetManagerDecoder()
    274 #if !SVC_EXTENSION
    275 : m_vpsBuffer(MAX_NUM_VPS)
    276 , m_spsBuffer(MAX_NUM_SPS)
    277 , m_ppsBuffer(MAX_NUM_PPS)
    278 #endif
    279 {
    280 }
    281 
    282 ParameterSetManagerDecoder::~ParameterSetManagerDecoder()
    283 {
    284 
    285 }
    286 
    287 TComVPS* ParameterSetManagerDecoder::getPrefetchedVPS  (Int vpsId)
    288 {
    289   if (m_vpsBuffer.getPS(vpsId) != NULL )
    290   {
    291     return m_vpsBuffer.getPS(vpsId);
    292   }
    293   else
    294   {
    295     return getVPS(vpsId);
    296   }
    297 }
    298 
    299 
    300 TComSPS* ParameterSetManagerDecoder::getPrefetchedSPS  (Int spsId)
    301 {
    302   if (m_spsBuffer.getPS(spsId) != NULL )
    303   {
    304     return m_spsBuffer.getPS(spsId);
    305   }
    306   else
    307   {
    308     return getSPS(spsId);
    309   }
    310 }
    311 
    312 TComPPS* ParameterSetManagerDecoder::getPrefetchedPPS  (Int ppsId)
    313 {
    314   if (m_ppsBuffer.getPS(ppsId) != NULL )
    315   {
    316     return m_ppsBuffer.getPS(ppsId);
    317   }
    318   else
    319   {
    320     return getPPS(ppsId);
    321   }
    322 }
    323 
    324 Void     ParameterSetManagerDecoder::applyPrefetchedPS()
    325 {
    326   m_vpsMap.mergePSList(m_vpsBuffer);
    327   m_ppsMap.mergePSList(m_ppsBuffer);
    328   m_spsMap.mergePSList(m_spsBuffer);
    329 }
    330 
    331267//! \}
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecSlice.h

    r1029 r1235  
    8888};
    8989
    90 
    91 class ParameterSetManagerDecoder:public ParameterSetManager
    92 {
    93 public:
    94   ParameterSetManagerDecoder();
    95   virtual ~ParameterSetManagerDecoder();
    96   Void     storePrefetchedVPS(TComVPS *vps)  { m_vpsBuffer.storePS( vps->getVPSId(), vps); };
    97   TComVPS* getPrefetchedVPS  (Int vpsId);
    98   Void     storePrefetchedSPS(TComSPS *sps)  { m_spsBuffer.storePS( sps->getSPSId(), sps); };
    99   TComSPS* getPrefetchedSPS  (Int spsId);
    100   Void     storePrefetchedPPS(TComPPS *pps)  { m_ppsBuffer.storePS( pps->getPPSId(), pps); };
    101   TComPPS* getPrefetchedPPS  (Int ppsId);
    102   Void     applyPrefetchedPS();
    103 
    104 private:
    105 #if SVC_EXTENSION
    106   static ParameterSetMap<TComVPS> m_vpsBuffer;
    107   static ParameterSetMap<TComSPS> m_spsBuffer;
    108   static ParameterSetMap<TComPPS> m_ppsBuffer;
    109 #else
    110   ParameterSetMap<TComVPS> m_vpsBuffer;
    111   ParameterSetMap<TComSPS> m_spsBuffer;
    112   ParameterSetMap<TComPPS> m_ppsBuffer;
    113 #endif
    114 };
    115 
    116 
    11790//! \}
    11891
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp

    r1229 r1235  
    223223}
    224224
    225 Void TDecTop::xGetNewPicBuffer ( TComSlice* pcSlice, TComPic*& rpcPic )
    226 {
    227   Int  numReorderPics[MAX_TLAYER];
    228 #if SVC_EXTENSION
    229   Window &conformanceWindow = pcSlice->getConformanceWindow();
     225#if SVC_EXTENSION
     226Void TDecTop::xGetNewPicBuffer( const TComVPS &vps, const TComSPS &sps, const TComPPS &pps, TComPic*& rpcPic, const UInt temporalLayer )
    230227#else
    231   Window &conformanceWindow = pcSlice->getSPS()->getConformanceWindow();
    232 #endif
    233   Window defaultDisplayWindow = pcSlice->getSPS()->getVuiParametersPresentFlag() ? pcSlice->getSPS()->getVuiParameters()->getDefaultDisplayWindow() : Window();
    234 
    235   for( Int temporalLayer=0; temporalLayer < MAX_TLAYER; temporalLayer++)
    236   {
    237 #if SVC_EXTENSION
    238     if( m_commonDecoderParams->getTargetOutputLayerSetIdx() == 0 )
    239     {
    240       assert( this->getLayerId() == 0 );
    241       numReorderPics[temporalLayer] = pcSlice->getSPS()->getNumReorderPics(temporalLayer);
    242     }
    243     else
    244     {
    245       TComVPS *vps = pcSlice->getVPS();
    246       // SHM decoders will use DPB size table in the VPS to determine the number of reorder pictures.
    247       numReorderPics[temporalLayer] = vps->getMaxVpsNumReorderPics( getCommonDecoderParams()->getTargetOutputLayerSetIdx() , temporalLayer);
    248     }
    249 #else
    250     numReorderPics[temporalLayer] = pcSlice->getSPS()->getNumReorderPics(temporalLayer);
    251 #endif
    252   }
    253 
     228Void TDecTop::xGetNewPicBuffer ( const TComSPS &sps, const TComPPS &pps, TComPic*& rpcPic, const UInt temporalLayer )
     229#endif
     230{
    254231#if SVC_EXTENSION
    255232  if( m_commonDecoderParams->getTargetOutputLayerSetIdx() == 0 )
    256233  {
    257     assert( this->getLayerId() == 0 );
    258     m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer());     // m_uiMaxDecPicBuffering has the space for the picture currently being decoded
     234    assert( m_layerId == 0 );
     235    m_iMaxRefPicNum = sps.getMaxDecPicBuffering(temporalLayer);     // m_uiMaxDecPicBuffering has the space for the picture currently being decoded
    259236  }
    260237  else
    261238  {
    262     m_iMaxRefPicNum = pcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1( m_commonDecoderParams->getTargetOutputLayerSetIdx(), pcSlice->getVPS()->getLayerIdcForOls( pcSlice->getVPS()->getOutputLayerSetIdx( m_commonDecoderParams->getTargetOutputLayerSetIdx()), pcSlice->getLayerId() ), pcSlice->getTLayer() ) + 1; // m_uiMaxDecPicBuffering has the space for the picture currently being decoded
     239    m_iMaxRefPicNum = vps.getMaxVpsDecPicBufferingMinus1( m_commonDecoderParams->getTargetOutputLayerSetIdx(), vps.getLayerIdcForOls( vps.getOutputLayerSetIdx( m_commonDecoderParams->getTargetOutputLayerSetIdx()), m_layerId ), temporalLayer ) + 1; // m_uiMaxDecPicBuffering has the space for the picture currently being decoded
    263240  }
    264241
    265242  m_iMaxRefPicNum += 1; // it should be updated if more than 1 resampling picture is used
    266243#else
    267   m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer());     // m_uiMaxDecPicBuffering has the space for the picture currently being decoded
     244  m_iMaxRefPicNum = sps.getMaxDecPicBuffering(temporalLayer);     // m_uiMaxDecPicBuffering has the space for the picture currently being decoded
    268245#endif
    269246 
     
    275252    if(m_layerId > 0)
    276253    {
    277       xSetSpatialEnhLayerFlag( pcSlice, rpcPic );
    278     }
    279 
    280     rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), pcSlice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
    281                      conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true);
     254      xSetSpatialEnhLayerFlag( vps, sps, pps, rpcPic );
     255    }
     256
     257    rpcPic->create( vps, sps, pps, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, true, m_layerId);
    282258#else //SVC_EXTENSION
    283     rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), pcSlice->getSPS()->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
    284                      conformanceWindow, defaultDisplayWindow, numReorderPics, true);
     259    rpcPic->create ( sps, pps, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, true);
    285260#endif //SVC_EXTENSION
    286261   
     
    326301  if( m_layerId > 0 )
    327302  {
    328     xSetSpatialEnhLayerFlag( pcSlice, rpcPic );
    329   }
    330 
    331   rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), pcSlice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
    332                    conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true);
     303    xSetSpatialEnhLayerFlag( vps, sps, pps, rpcPic );
     304  }
     305
     306  rpcPic->create( vps, sps, pps, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, true, m_layerId);
    333307#else  //SVC_EXTENSION
    334   rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), pcSlice->getSPS()->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
    335                    conformanceWindow, defaultDisplayWindow, numReorderPics, true);
     308  rpcPic->create ( sps, pps, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, true);
    336309#endif //SVC_EXTENSION
    337310}
     
    386359{
    387360  printf("\ninserting lost poc : %d\n",iLostPoc);
    388   TComSlice cFillSlice;
    389   cFillSlice.setSPS( m_parameterSetManagerDecoder.getFirstSPS() );
    390   cFillSlice.setPPS( m_parameterSetManagerDecoder.getFirstPPS() );
    391 #if SVC_EXTENSION
    392   cFillSlice.setVPS( m_parameterSetManagerDecoder.getFirstVPS() );
    393   cFillSlice.initSlice( m_layerId );
    394 #else
    395   cFillSlice.initSlice();
    396 #endif
    397361  TComPic *cFillPic;
    398   xGetNewPicBuffer(&cFillSlice,cFillPic);
    399   cFillPic->getSlice(0)->setSPS( m_parameterSetManagerDecoder.getFirstSPS() );
    400   cFillPic->getSlice(0)->setPPS( m_parameterSetManagerDecoder.getFirstPPS() );
    401 #if SVC_EXTENSION
    402   cFillPic->getSlice(0)->setVPS( m_parameterSetManagerDecoder.getFirstVPS() );
     362#if SVC_EXTENSION
     363  xGetNewPicBuffer(*(m_parameterSetManager.getFirstVPS()), *(m_parameterSetManager.getFirstSPS()), *(m_parameterSetManager.getFirstPPS()), cFillPic, 0);
    403364  cFillPic->getSlice(0)->initSlice( m_layerId );
    404365#else
     366  xGetNewPicBuffer(*(m_parameterSetManager.getFirstSPS()), *(m_parameterSetManager.getFirstPPS()), cFillPic, 0);
    405367  cFillPic->getSlice(0)->initSlice();
    406368#endif
     
    445407Void TDecTop::xActivateParameterSets()
    446408{
    447   m_parameterSetManagerDecoder.applyPrefetchedPS();
    448 
    449   TComPPS *pps = m_parameterSetManagerDecoder.getPPS(m_apcSlicePilot->getPPSId());
    450   assert (pps != 0);
    451 
    452   TComSPS *sps = m_parameterSetManagerDecoder.getSPS(pps->getSPSId());
    453   assert (sps != 0);
    454 
    455   if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP()))
    456   {
    457     printf ("Parameter set activation failed!");
    458     assert (0);
    459   }
    460 
    461 #if SVC_EXTENSION
    462   // scaling list settings and checks
    463   TComVPS *activeVPS = m_parameterSetManagerDecoder.getActiveVPS();
    464   TComSPS *activeSPS = m_parameterSetManagerDecoder.getActiveSPS();
    465   TComPPS *activePPS = m_parameterSetManagerDecoder.getActivePPS();
    466 
    467   if( activeSPS->getInferScalingListFlag() )
    468   {
    469     UInt refLayerId = activeSPS->getScalingListRefLayerId();
    470     TComSPS *refSps = m_ppcTDecTop[refLayerId]->getParameterSetManager()->getActiveSPS(); assert( refSps != NULL );
    471 
    472     // 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
    473     if( activeVPS->getNonHEVCBaseLayerFlag() )
    474     {
    475       assert( refLayerId > 0 );
    476     }
    477 
    478     // 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
    479     // 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
    480     assert( refSps->getInferScalingListFlag() == false );
    481 
    482     // 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,
    483     // 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
    484     assert( activeVPS->getRecursiveRefLayerFlag( activeSPS->getLayerId(), refLayerId ) == true );
    485    
    486     if( activeSPS->getScalingList() != refSps->getScalingList() )
    487     {
    488       // delete created instance of scaling list since it will be inferred
    489       delete activeSPS->getScalingList();
    490 
    491       // infer scaling list
    492       activeSPS->setScalingList( refSps->getScalingList() );
    493     }
    494   }
    495 
    496   if( activePPS->getInferScalingListFlag() )
    497   {
    498     UInt refLayerId = activePPS->getScalingListRefLayerId();
    499     TComPPS *refPps = m_ppcTDecTop[refLayerId]->getParameterSetManager()->getActivePPS(); assert( refPps != NULL );
    500 
    501     // 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
    502     if( activeVPS->getNonHEVCBaseLayerFlag() )
    503     {
    504       assert( refLayerId > 0 );
    505     }
    506 
    507     // 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
    508     // 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
    509     assert( refPps->getInferScalingListFlag() == false );
    510 
    511     // 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,
    512     // 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
    513     assert( activeVPS->getRecursiveRefLayerFlag( activePPS->getLayerId(), refLayerId ) == true );
    514    
    515     if( activePPS->getScalingList() != refPps->getScalingList() )
    516     {
    517       // delete created instance of scaling list since it will be inferred
    518       delete activePPS->getScalingList();
    519 
    520       // infer scaling list
    521       activePPS->setScalingList( refPps->getScalingList() );
    522     }
    523 
    524   }
     409  if (m_bFirstSliceInPicture)
     410  {
     411    const TComPPS *pps = m_parameterSetManager.getPPS(m_apcSlicePilot->getPPSId()); // this is a temporary PPS object. Do not store this value
     412    assert (pps != 0);
     413
     414#if SVC_EXTENSION
     415    TComSPS *updateSPS = m_parameterSetManager.getSPS(pps->getSPSId());             // this is a temporary SPS object. Do not store this value
     416#endif
     417    const TComSPS *sps = m_parameterSetManager.getSPS(pps->getSPSId());             // this is a temporary SPS object. Do not store this value
     418    assert (sps != 0);
     419
     420    m_parameterSetManager.clearSPSChangedFlag(sps->getSPSId());
     421    m_parameterSetManager.clearPPSChangedFlag(pps->getPPSId());
     422
     423    if (false == m_parameterSetManager.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP()))
     424    {
     425      printf ("Parameter set activation failed!");
     426      assert (0);
     427    }
     428
     429#if SVC_EXTENSION
     430    // scaling list settings and checks
     431    TComVPS *vps = m_parameterSetManager.getVPS(sps->getVPSId());
     432    assert (vps != 0);
     433
     434    m_parameterSetManager.clearVPSChangedFlag(sps->getVPSId());   
     435
     436    if( sps->getInferScalingListFlag() )
     437    {
     438      UInt refLayerId = sps->getScalingListRefLayerId();
     439      const TComSPS *refSps = m_ppcTDecTop[refLayerId]->getParameterSetManager()->getActiveSPS(); assert( refSps != NULL );
     440
     441      // 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
     442      if( vps->getNonHEVCBaseLayerFlag() )
     443      {
     444        assert( refLayerId > 0 );
     445      }
     446
     447      // 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
     448      // 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
     449      assert( refSps->getInferScalingListFlag() == false );
     450
     451      // 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,
     452      // 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
     453      assert( vps->getRecursiveRefLayerFlag( sps->getLayerId(), refLayerId ) == true );
     454    }
     455
     456    if( pps->getInferScalingListFlag() )
     457    {
     458      UInt refLayerId = pps->getScalingListRefLayerId();
     459      const TComPPS *refPps = m_ppcTDecTop[refLayerId]->getParameterSetManager()->getActivePPS(); assert( refPps != NULL );
     460
     461      // 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
     462      if( vps->getNonHEVCBaseLayerFlag() )
     463      {
     464        assert( refLayerId > 0 );
     465      }
     466
     467      // 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
     468      // 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
     469      assert( refPps->getInferScalingListFlag() == false );
     470
     471      // 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,
     472      // 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
     473      assert( vps->getRecursiveRefLayerFlag( pps->getLayerId(), refLayerId ) == true );
     474    }
    525475
    526476#if AVC_BASE
    527   if( activeVPS->getNonHEVCBaseLayerFlag() )
    528   {
    529     TComPic* pBLPic = (*m_ppcTDecTop[0]->getListPic()->begin());
    530     if( m_layerId > 0 && pBLPic->getPicYuvRec() == NULL )
    531     {
    532       UInt refLayerId = 0;
    533       RepFormat* repFormat = activeVPS->getVpsRepFormat( activeVPS->getVpsRepFormatIdx(refLayerId) );
    534 
    535       Int  numReorderPics[MAX_TLAYER];
    536       Window defaultDisplayWindow;
    537 
    538 #if AUXILIARY_PICTURES
    539       pBLPic->create( repFormat->getPicWidthVpsInLumaSamples(), repFormat->getPicHeightVpsInLumaSamples(), repFormat->getChromaFormatVpsIdc(), activeSPS->getMaxCUWidth(), activeSPS->getMaxCUHeight(), activeSPS->getMaxCUDepth(), repFormat->getConformanceWindowVps(), defaultDisplayWindow, numReorderPics, NULL, true);
     477    if( vps->getNonHEVCBaseLayerFlag() )
     478    {
     479      TComPic* pBLPic = (*m_ppcTDecTop[0]->getListPic()->begin());
     480      if( m_layerId > 0 && pBLPic->getPicYuvRec() == NULL )
     481      {
     482        UInt refLayerId = 0;
     483        const RepFormat* repFormat = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(refLayerId) );
     484
     485        pBLPic->create( *vps, *sps, *pps, sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), true, refLayerId);
     486
     487        // it is needed where the VPS is accessed through the slice
     488        pBLPic->getSlice(0)->setVPS( vps );
     489
     490        g_bitDepthLayer[CHANNEL_TYPE_LUMA][0] = repFormat->getBitDepthVpsLuma();
     491        g_bitDepthLayer[CHANNEL_TYPE_CHROMA][0] = repFormat->getBitDepthVpsChroma();
     492      }
     493    }
     494#endif
     495
     496    if( m_layerId > 0 )
     497    {
     498      // When not present sps_max_sub_layers_minus1 is inferred to be equal to vps_max_sub_layers_minus1.
     499      updateSPS->setMaxTLayers( vps->getMaxTLayers() );
     500
     501      // When not present sps_temporal_id_nesting_flag is inferred to be equal to vps_temporal_id_nesting_flag
     502      updateSPS->setTemporalIdNestingFlag( (sps->getMaxTLayers() > 1) ? vps->getTemporalNestingFlag() : true );
     503
     504      // When sps_max_dec_pic_buffering_minus1[ i ] is not present for i in the range of 0 to sps_max_sub_layers_minus1, inclusive, due to nuh_layer_id being greater than 0,
     505      // it is inferred to be equal to max_vps_dec_pic_buffering_minus1[ TargetOptLayerSetIdx ][ currLayerId ][ i ] of the active VPS, where currLayerId is the nuh_layer_id of the layer that refers to the SPS.
     506      for(UInt i=0; i < sps->getMaxTLayers(); i++)
     507      {
     508        // to avoid compiler warning "array subscript is above array bounds"
     509        assert( i < MAX_TLAYER );
     510
     511        // When sps_max_dec_pic_buffering_minus1[ i ] is not present for i in the range of 0 to sps_max_sub_layers_minus1, inclusive,
     512        // due to MultiLayerExtSpsFlag being equal to 1, for a layer that refers to the SPS and has nuh_layer_id equal to currLayerId,
     513        // the value of sps_max_dec_pic_buffering_minus1[ i ] is inferred to be equal to max_vps_dec_pic_buffering_minus1[ TargetOlsIdx ][ layerIdx ][ i ] of the active VPS,
     514        // where layerIdx is equal to the value such that LayerSetLayerIdList[ TargetDecLayerSetIdx ][ layerIdx ] is equal to currLayerId.
     515        if( sps->getMultiLayerExtSpsFlag() )
     516        {
     517          updateSPS->setMaxDecPicBuffering( vps->getMaxVpsDecPicBufferingMinus1( m_commonDecoderParams->getTargetOutputLayerSetIdx(), vps->getLayerIdcForOls( vps->getOutputLayerSetIdx( m_commonDecoderParams->getTargetOutputLayerSetIdx() ), m_layerId ), i) + 1, i);
     518        }
     519
     520        // The value of sps_max_dec_pic_buffering_minus1[ i ] shall be less than or equal to vps_max_dec_pic_buffering_minus1[ i ] for each value of i.
     521        assert( sps->getMaxDecPicBuffering(i) <= vps->getMaxDecPicBuffering(i) );     
     522      }
     523
     524      UInt layerIdx = vps->getLayerIdxInVps( m_layerId );
     525
     526      if( vps->getBaseLayerPSCompatibilityFlag(layerIdx) )
     527      {
     528        const RepFormat* repFormat = vps->getVpsRepFormat(vps->getVpsRepFormatIdx(layerIdx));
     529
     530        assert( pps->getLayerId() == 0 );
     531        assert( sps->getLayerId() == 0 );
     532        assert( repFormat->getChromaFormatVpsIdc() == sps->getChromaFormatIdc() );
     533        assert( repFormat->getSeparateColourPlaneVpsFlag() == 0 );
     534        assert( repFormat->getPicHeightVpsInLumaSamples() == sps->getPicHeightInLumaSamples() );
     535        assert( repFormat->getPicWidthVpsInLumaSamples()  == sps->getPicWidthInLumaSamples() );
     536        assert( repFormat->getBitDepthVpsLuma()   == sps->getBitDepth(CHANNEL_TYPE_LUMA) );
     537        assert( repFormat->getBitDepthVpsChroma() == sps->getBitDepth(CHANNEL_TYPE_CHROMA) );
     538        assert( repFormat->getConformanceWindowVps().getWindowLeftOffset()   == sps->getConformanceWindow().getWindowLeftOffset() );
     539        assert( repFormat->getConformanceWindowVps().getWindowRightOffset()  == sps->getConformanceWindow().getWindowRightOffset() );
     540        assert( repFormat->getConformanceWindowVps().getWindowTopOffset()    == sps->getConformanceWindow().getWindowTopOffset() );
     541        assert( repFormat->getConformanceWindowVps().getWindowBottomOffset() == sps->getConformanceWindow().getWindowBottomOffset() );
     542      }   
     543    }
     544
     545    //Conformance checking for rep format -- rep format of current picture of current layer shall never be greater rep format defined in VPS for the current layer
     546    UInt layerIdx = vps->getLayerIdxInVps(m_apcSlicePilot->getLayerId());
     547
     548    if ( vps->getVpsExtensionFlag() == 1 && (m_apcSlicePilot->getLayerId() == 0 || sps->getV1CompatibleSPSFlag() == 1) )
     549    {
     550      assert( sps->getPicWidthInLumaSamples()        <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerIdx) )->getPicWidthVpsInLumaSamples() );
     551      assert( sps->getPicHeightInLumaSamples()       <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerIdx) )->getPicHeightVpsInLumaSamples() );
     552      assert( sps->getChromaFormatIdc()              <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerIdx) )->getChromaFormatVpsIdc() );
     553      assert( sps->getBitDepth(CHANNEL_TYPE_LUMA)    <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerIdx) )->getBitDepthVpsLuma() );
     554      assert( sps->getBitDepth(CHANNEL_TYPE_CHROMA)  <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerIdx) )->getBitDepthVpsChroma() );
     555    }
     556    else if ( vps->getVpsExtensionFlag() == 1 )
     557    {
     558      assert( vps->getVpsRepFormat( sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : vps->getVpsRepFormatIdx(layerIdx))->getPicWidthVpsInLumaSamples()  <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerIdx))->getPicWidthVpsInLumaSamples());
     559      assert( vps->getVpsRepFormat( sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : vps->getVpsRepFormatIdx(layerIdx))->getPicHeightVpsInLumaSamples() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerIdx))->getPicHeightVpsInLumaSamples());
     560      assert( vps->getVpsRepFormat( sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : vps->getVpsRepFormatIdx(layerIdx))->getChromaFormatVpsIdc()        <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerIdx))->getChromaFormatVpsIdc());
     561      assert( vps->getVpsRepFormat( sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : vps->getVpsRepFormatIdx(layerIdx))->getBitDepthVpsLuma()           <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerIdx))->getBitDepthVpsLuma());
     562      assert( vps->getVpsRepFormat( sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : vps->getVpsRepFormatIdx(layerIdx))->getBitDepthVpsChroma()         <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerIdx))->getBitDepthVpsChroma());
     563    }
     564#endif //SVC_EXTENSION
     565
     566    // TODO: remove the use of the following globals:
     567    for (UInt channel = 0; channel < MAX_NUM_CHANNEL_TYPE; channel++)
     568    {
     569#if SVC_EXTENSION
     570      g_bitDepth[channel] = isLuma(ChannelType(channel)) ? vps->getBitDepthY(sps, m_apcSlicePilot->getLayerId()) : vps->getBitDepthC(sps, m_apcSlicePilot->getLayerId());
    540571#else
    541       pBLPic->create( repFormat->getPicWidthVpsInLumaSamples(), repFormat->getPicHeightVpsInLumaSamples(), activeSPS->getMaxCUWidth(), activeSPS->getMaxCUHeight(), activeSPS->getMaxCUDepth(), repFormat->getConformanceWindowVps(), defaultDisplayWindow, numReorderPics, NULL, true);
    542 #endif
    543       // it is needed where the VPS is accessed through the slice
    544       pBLPic->getSlice(0)->setVPS( activeVPS );
    545 
    546       g_bitDepthLayer[CHANNEL_TYPE_LUMA][0] = repFormat->getBitDepthVpsLuma();
    547       g_bitDepthLayer[CHANNEL_TYPE_CHROMA][0] = repFormat->getBitDepthVpsChroma();
    548     }
    549   }
    550 #endif
    551 
    552   if( m_layerId > 0 )
    553   {
    554     // When not present sps_max_sub_layers_minus1 is inferred to be equal to vps_max_sub_layers_minus1.
    555     sps->setMaxTLayers( activeVPS->getMaxTLayers() );
    556 
    557     // When not present sps_temporal_id_nesting_flag is inferred to be equal to vps_temporal_id_nesting_flag
    558     sps->setTemporalIdNestingFlag( (sps->getMaxTLayers() > 1) ? activeVPS->getTemporalNestingFlag() : true );
    559 
    560     // When sps_max_dec_pic_buffering_minus1[ i ] is not present for i in the range of 0 to sps_max_sub_layers_minus1, inclusive, due to nuh_layer_id being greater than 0,
    561     // it is inferred to be equal to max_vps_dec_pic_buffering_minus1[ TargetOptLayerSetIdx ][ currLayerId ][ i ] of the active VPS, where currLayerId is the nuh_layer_id of the layer that refers to the SPS.
    562     for(UInt i=0; i < sps->getMaxTLayers(); i++)
    563     {
    564       // to avoid compiler warning "array subscript is above array bounds"
    565       assert( i < MAX_TLAYER );
    566 
    567       // When sps_max_dec_pic_buffering_minus1[ i ] is not present for i in the range of 0 to sps_max_sub_layers_minus1, inclusive,
    568       // due to MultiLayerExtSpsFlag being equal to 1, for a layer that refers to the SPS and has nuh_layer_id equal to currLayerId,
    569       // the value of sps_max_dec_pic_buffering_minus1[ i ] is inferred to be equal to max_vps_dec_pic_buffering_minus1[ TargetOlsIdx ][ layerIdx ][ i ] of the active VPS,
    570       // where layerIdx is equal to the value such that LayerSetLayerIdList[ TargetDecLayerSetIdx ][ layerIdx ] is equal to currLayerId.
    571       if( sps->getMultiLayerExtSpsFlag() )
    572       {
    573         sps->setMaxDecPicBuffering( activeVPS->getMaxVpsDecPicBufferingMinus1( m_commonDecoderParams->getTargetOutputLayerSetIdx(), activeVPS->getLayerIdcForOls( activeVPS->getOutputLayerSetIdx( m_commonDecoderParams->getTargetOutputLayerSetIdx() ), m_layerId ), i) + 1, i);
    574       }
    575 
    576       // The value of sps_max_dec_pic_buffering_minus1[ i ] shall be less than or equal to vps_max_dec_pic_buffering_minus1[ i ] for each value of i.
    577       assert( sps->getMaxDecPicBuffering(i) <= activeVPS->getMaxDecPicBuffering(i) );     
    578     }
    579 
    580     UInt layerIdx = activeVPS->getLayerIdxInVps( m_layerId );
    581 
    582     if( activeVPS->getBaseLayerPSCompatibilityFlag(layerIdx) )
    583     {
    584       RepFormat* repFormat = activeVPS->getVpsRepFormat(activeVPS->getVpsRepFormatIdx(layerIdx));
    585 
    586       assert( pps->getLayerId() == 0 );
    587       assert( sps->getLayerId() == 0 );
    588       assert( repFormat->getChromaFormatVpsIdc() == sps->getChromaFormatIdc() );
    589       assert( repFormat->getSeparateColourPlaneVpsFlag() == 0 );
    590       assert( repFormat->getPicHeightVpsInLumaSamples() == sps->getPicHeightInLumaSamples() );
    591       assert( repFormat->getPicWidthVpsInLumaSamples()  == sps->getPicWidthInLumaSamples() );
    592       assert( repFormat->getBitDepthVpsLuma()   == sps->getBitDepth(CHANNEL_TYPE_LUMA) );
    593       assert( repFormat->getBitDepthVpsChroma() == sps->getBitDepth(CHANNEL_TYPE_CHROMA) );
    594       assert( repFormat->getConformanceWindowVps().getWindowLeftOffset()   == sps->getConformanceWindow().getWindowLeftOffset() );
    595       assert( repFormat->getConformanceWindowVps().getWindowRightOffset()  == sps->getConformanceWindow().getWindowRightOffset() );
    596       assert( repFormat->getConformanceWindowVps().getWindowTopOffset()    == sps->getConformanceWindow().getWindowTopOffset() );
    597       assert( repFormat->getConformanceWindowVps().getWindowBottomOffset() == sps->getConformanceWindow().getWindowBottomOffset() );
    598     }   
    599   }
    600 
    601   //Conformance checking for rep format -- rep format of current picture of current layer shall never be greater rep format defined in VPS for the current layer
    602   UInt layerIdx = activeVPS->getLayerIdxInVps(m_apcSlicePilot->getLayerId());
    603 
    604   if ( activeVPS->getVpsExtensionFlag() == 1 && (m_apcSlicePilot->getLayerId() == 0 || sps->getV1CompatibleSPSFlag() == 1) )
    605   {
    606     assert( sps->getPicWidthInLumaSamples()        <= activeVPS->getVpsRepFormat( activeVPS->getVpsRepFormatIdx(layerIdx) )->getPicWidthVpsInLumaSamples() );
    607     assert( sps->getPicHeightInLumaSamples()       <= activeVPS->getVpsRepFormat( activeVPS->getVpsRepFormatIdx(layerIdx) )->getPicHeightVpsInLumaSamples() );
    608     assert( sps->getChromaFormatIdc()              <= activeVPS->getVpsRepFormat( activeVPS->getVpsRepFormatIdx(layerIdx) )->getChromaFormatVpsIdc() );
    609     assert( sps->getBitDepth(CHANNEL_TYPE_LUMA)    <= activeVPS->getVpsRepFormat( activeVPS->getVpsRepFormatIdx(layerIdx) )->getBitDepthVpsLuma() );
    610     assert( sps->getBitDepth(CHANNEL_TYPE_CHROMA)  <= activeVPS->getVpsRepFormat( activeVPS->getVpsRepFormatIdx(layerIdx) )->getBitDepthVpsChroma() );
    611   }
    612   else if ( activeVPS->getVpsExtensionFlag() == 1 )
    613   {
    614     assert( activeVPS->getVpsRepFormat( sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : activeVPS->getVpsRepFormatIdx(layerIdx))->getPicWidthVpsInLumaSamples()  <= activeVPS->getVpsRepFormat( activeVPS->getVpsRepFormatIdx(layerIdx))->getPicWidthVpsInLumaSamples());
    615     assert( activeVPS->getVpsRepFormat( sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : activeVPS->getVpsRepFormatIdx(layerIdx))->getPicHeightVpsInLumaSamples() <= activeVPS->getVpsRepFormat( activeVPS->getVpsRepFormatIdx(layerIdx))->getPicHeightVpsInLumaSamples());
    616     assert( activeVPS->getVpsRepFormat( sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : activeVPS->getVpsRepFormatIdx(layerIdx))->getChromaFormatVpsIdc()        <= activeVPS->getVpsRepFormat( activeVPS->getVpsRepFormatIdx(layerIdx))->getChromaFormatVpsIdc());
    617     assert( activeVPS->getVpsRepFormat( sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : activeVPS->getVpsRepFormatIdx(layerIdx))->getBitDepthVpsLuma()           <= activeVPS->getVpsRepFormat( activeVPS->getVpsRepFormatIdx(layerIdx))->getBitDepthVpsLuma());
    618     assert( activeVPS->getVpsRepFormat( sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : activeVPS->getVpsRepFormatIdx(layerIdx))->getBitDepthVpsChroma()         <= activeVPS->getVpsRepFormat( activeVPS->getVpsRepFormatIdx(layerIdx))->getBitDepthVpsChroma());
    619   }
    620 #endif //SVC_EXTENSION
    621 
    622   m_apcSlicePilot->setPPS(pps);
    623   m_apcSlicePilot->setSPS(sps);
    624   pps->setSPS(sps);
    625   pps->setNumSubstreams(pps->getEntropyCodingSyncEnabledFlag() ? ((sps->getPicHeightInLumaSamples() + sps->getMaxCUHeight() - 1) / sps->getMaxCUHeight()) * (pps->getNumTileColumnsMinus1() + 1) : ((pps->getNumTileRowsMinus1() + 1)*(pps->getNumTileColumnsMinus1() + 1)));
    626   pps->setMinCuDQPSize( sps->getMaxCUWidth() >> ( pps->getMaxCuDQPDepth()) );
    627   pps->setMinCuChromaQpAdjSize( sps->getMaxCUWidth() >> ( pps->getMaxCuChromaQpAdjDepth()) );
    628 
    629   for (UInt channel = 0; channel < MAX_NUM_CHANNEL_TYPE; channel++)
    630   {
    631 #if SVC_EXTENSION
    632     g_bitDepth[channel] = isLuma(ChannelType(channel)) ? m_apcSlicePilot->getBitDepthY() : m_apcSlicePilot->getBitDepthC();
     572      g_bitDepth[channel] = sps->getBitDepth(ChannelType(channel));
     573#endif
     574      g_maxTrDynamicRange[channel] = (sps->getUseExtendedPrecision()) ? std::max<Int>(15, (g_bitDepth[channel] + 6)) : 15;
     575    }
     576    g_uiMaxCUWidth  = sps->getMaxCUWidth();
     577    g_uiMaxCUHeight = sps->getMaxCUHeight();
     578    g_uiMaxCUDepth  = sps->getMaxCUDepth();
     579#if SVC_EXTENSION
     580    g_uiAddCUDepth  = max (0, sps->getLog2MinCodingBlockSize() - (Int)sps->getQuadtreeTULog2MinSize() + (Int)getMaxCUDepthOffset(vps->getChromaFormatIdc(sps, m_apcSlicePilot->getLayerId()), sps->getQuadtreeTULog2MinSize()));
    633581#else
    634     g_bitDepth[channel] = sps->getBitDepth(ChannelType(channel));
    635 #endif
    636 
    637     if (sps->getUseExtendedPrecision()) g_maxTrDynamicRange[channel] = std::max<Int>(15, (g_bitDepth[channel] + 6));
    638     else                                g_maxTrDynamicRange[channel] = 15;
    639   }
    640   g_uiMaxCUWidth  = sps->getMaxCUWidth();
    641   g_uiMaxCUHeight = sps->getMaxCUHeight();
    642   g_uiMaxCUDepth  = sps->getMaxCUDepth();
    643   g_uiAddCUDepth  = max (0, sps->getLog2MinCodingBlockSize() - (Int)sps->getQuadtreeTULog2MinSize() + (Int)getMaxCUDepthOffset(sps->getChromaFormatIdc(), sps->getQuadtreeTULog2MinSize()));
    644 
    645   for (Int i = 0; i < sps->getLog2DiffMaxMinCodingBlockSize(); i++)
    646   {
    647     sps->setAMPAcc( i, sps->getUseAMP() );
    648   }
    649 
    650   for (Int i = sps->getLog2DiffMaxMinCodingBlockSize(); i < sps->getMaxCUDepth(); i++)
    651   {
    652     sps->setAMPAcc( i, 0 );
    653   }
    654 
    655   m_cSAO.destroy();
    656 #if SVC_EXTENSION
    657   m_cSAO.create( m_apcSlicePilot->getPicWidthInLumaSamples(), m_apcSlicePilot->getPicHeightInLumaSamples(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), pps->getSaoOffsetBitShift(CHANNEL_TYPE_LUMA), pps->getSaoOffsetBitShift(CHANNEL_TYPE_CHROMA) );
     582    g_uiAddCUDepth  = max (0, sps->getLog2MinCodingBlockSize() - (Int)sps->getQuadtreeTULog2MinSize() + (Int)getMaxCUDepthOffset(sps->getChromaFormatIdc(), sps->getQuadtreeTULog2MinSize()));
     583#endif
     584
     585    //  Get a new picture buffer. This will also set up m_pcPic, and therefore give us a SPS and PPS pointer that we can use.
     586#if SVC_EXTENSION
     587    xGetNewPicBuffer( *(vps), *(sps), *(pps), m_pcPic, m_apcSlicePilot->getTLayer() );
    658588#else
    659   m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), pps->getSaoOffsetBitShift(CHANNEL_TYPE_LUMA), pps->getSaoOffsetBitShift(CHANNEL_TYPE_CHROMA) );
    660 #endif
    661   m_cLoopFilter.create( sps->getMaxCUDepth() );
     589    xGetNewPicBuffer (*(sps), *(pps), m_pcPic, m_apcSlicePilot->getTLayer());
     590#endif
     591
     592#if ALIGNED_BUMPING
     593    m_apcSlicePilot->checkLeadingPictureRestrictions(m_cListPic);
     594#else
     595    m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS());
     596#endif
     597
     598    // make the slice-pilot a real slice, and set up the slice-pilot for the next slice
     599    assert(m_pcPic->getNumAllocatedSlice() == (m_uiSliceIdx + 1));
     600    m_apcSlicePilot = m_pcPic->getPicSym()->swapSliceObject(m_apcSlicePilot, m_uiSliceIdx);
     601
     602    // we now have a real slice:
     603    TComSlice *pSlice = m_pcPic->getSlice(m_uiSliceIdx);
     604
     605    // Update the PPS and SPS pointers with the ones of the picture.
     606    pps=pSlice->getPPS();
     607    sps=pSlice->getSPS();
     608
     609    // Initialise the various objects for the new set of settings
     610#if SVC_EXTENSION
     611    m_cSAO.create( pSlice->getPicWidthInLumaSamples(), pSlice->getPicHeightInLumaSamples(), pSlice->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), pps->getSaoOffsetBitShift(CHANNEL_TYPE_LUMA), pps->getSaoOffsetBitShift(CHANNEL_TYPE_CHROMA) );
     612#else
     613    m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), pps->getSaoOffsetBitShift(CHANNEL_TYPE_LUMA), pps->getSaoOffsetBitShift(CHANNEL_TYPE_CHROMA) );
     614#endif
     615    m_cLoopFilter.create( sps->getMaxCUDepth() );
     616    m_cPrediction.initTempBuff(sps->getChromaFormatIdc());
     617
     618    Bool isField = false;
     619    Bool isTopField = false;
     620
     621    if(!m_SEIs.empty())
     622    {
     623      // Check if any new Picture Timing SEI has arrived
     624      SEIMessages pictureTimingSEIs = extractSeisByType (m_SEIs, SEI::PICTURE_TIMING);
     625      if (pictureTimingSEIs.size()>0)
     626      {
     627        SEIPictureTiming* pictureTiming = (SEIPictureTiming*) *(pictureTimingSEIs.begin());
     628        isField    = (pictureTiming->m_picStruct == 1) || (pictureTiming->m_picStruct == 2) || (pictureTiming->m_picStruct == 9) || (pictureTiming->m_picStruct == 10) || (pictureTiming->m_picStruct == 11) || (pictureTiming->m_picStruct == 12);
     629        isTopField = (pictureTiming->m_picStruct == 1) || (pictureTiming->m_picStruct == 9) || (pictureTiming->m_picStruct == 11);
     630      }
     631     
     632#if Q0189_TMVP_CONSTRAINTS
     633      // Check if any new temporal motion vector prediction constraints SEI has arrived
     634      SEIMessages seiTMVPConstrainsList = extractSeisByType (m_SEIs, SEI::TMVP_CONSTRAINTS);
     635      if (seiTMVPConstrainsList.size() > 0)
     636      {
     637        assert ( m_pcPic->getTLayer() == 0 );  //this SEI can present only for AU with Tid equal to 0
     638        SEITMVPConstrains* tmvpConstraintSEI = (SEITMVPConstrains*) *(seiTMVPConstrainsList.begin());
     639        if ( tmvpConstraintSEI->prev_pics_not_used_flag == 1 )
     640        {
     641          //update all pics in the DPB such that they cannot be used for TMPV ref
     642          TComList<TComPic*>::iterator  iterRefPic = m_cListPic.begin(); 
     643          while( iterRefPic != m_cListPic.end() )
     644          {
     645            TComPic *refPic = *iterRefPic;
     646            if( ( refPic->getLayerId() == m_pcPic->getLayerId() ) && refPic->getReconMark() )
     647            {
     648              for(Int i = refPic->getNumAllocatedSlice()-1; i >= 0; i--)
     649              {
     650                TComSlice *refSlice = refPic->getSlice(i);
     651                refSlice->setAvailableForTMVPRefFlag( false );
     652              }
     653            }
     654            iterRefPic++;
     655          }
     656        }
     657      }
     658#endif
     659    }
     660
     661    //Set Field/Frame coding mode
     662    m_pcPic->setField(isField);
     663    m_pcPic->setTopField(isTopField);
     664
     665    // transfer any SEI messages that have been received to the picture
     666    m_pcPic->setSEIs(m_SEIs);
     667    m_SEIs.clear();
     668
     669    // Recursive structure
     670#if SVC_EXTENSION
     671    m_cCuDecoder.create ( sps->getMaxCUDepth(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), pSlice->getChromaFormatIdc() );
     672    m_cCuDecoder.init   ( m_ppcTDecTop, &m_cEntropyDecoder, &m_cTrQuant, &m_cPrediction, m_layerId );
     673#else
     674    m_cCuDecoder.create ( sps->getMaxCUDepth(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getChromaFormatIdc() );
     675    m_cCuDecoder.init   ( &m_cEntropyDecoder, &m_cTrQuant, &m_cPrediction );
     676#endif
     677    m_cTrQuant.init     ( sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxTrSize());
     678
     679    m_cSliceDecoder.create();
     680  }
     681  else
     682  {
     683    // make the slice-pilot a real slice, and set up the slice-pilot for the next slice
     684    m_pcPic->allocateNewSlice();
     685    assert(m_pcPic->getNumAllocatedSlice() == (m_uiSliceIdx + 1));
     686    m_apcSlicePilot = m_pcPic->getPicSym()->swapSliceObject(m_apcSlicePilot, m_uiSliceIdx);
     687
     688    TComSlice *pSlice = m_pcPic->getSlice(m_uiSliceIdx); // we now have a real slice.
     689
     690    const TComSPS *sps = pSlice->getSPS();
     691    const TComPPS *pps = pSlice->getPPS();
     692
     693    // check that the current active PPS has not changed...
     694    if (m_parameterSetManager.getSPSChangedFlag(sps->getSPSId()) )
     695    {
     696      printf("Error - a new SPS has been decoded while processing a picture\n");
     697      exit(1);
     698    }
     699    if (m_parameterSetManager.getPPSChangedFlag(pps->getPPSId()) )
     700    {
     701      printf("Error - a new PPS has been decoded while processing a picture\n");
     702      exit(1);
     703    }
     704
     705    // Check if any new SEI has arrived
     706    if(!m_SEIs.empty())
     707    {
     708      // Currently only decoding Unit SEI message occurring between VCL NALUs copied
     709      SEIMessages &picSEI = m_pcPic->getSEIs();
     710      SEIMessages decodingUnitInfos = extractSeisByType (m_SEIs, SEI::DECODING_UNIT_INFO);
     711      picSEI.insert(picSEI.end(), decodingUnitInfos.begin(), decodingUnitInfos.end());
     712      deleteSEIs(m_SEIs);
     713    }
     714  }
     715
    662716}
    663717
     
    669723{
    670724#if SVC_EXTENSION
    671   m_apcSlicePilot->setVPS( m_parameterSetManagerDecoder.getPrefetchedVPS(0) );
    672 
    673   // Following check should go wherever the VPS is activated
    674   if( !m_apcSlicePilot->getVPS()->getBaseLayerAvailableFlag() )
    675   {
    676     assert(nalu.m_layerId != 0);
    677     assert(m_apcSlicePilot->getVPS()->getNumAddLayerSets() > 0);
    678 
    679     if( m_commonDecoderParams->getTargetOutputLayerSetIdx() >= 0 )
    680     {
    681       UInt layerIdx = m_apcSlicePilot->getVPS()->getOutputLayerSetIdx(getCommonDecoderParams()->getTargetOutputLayerSetIdx());
    682       assert(layerIdx > m_apcSlicePilot->getVPS()->getVpsNumLayerSetsMinus1());
    683     }
    684   } 
    685 
    686725  m_apcSlicePilot->initSlice( nalu.m_layerId );
     726  m_apcSlicePilot->setTLayer( nalu.m_temporalId );
    687727#else //SVC_EXTENSION
    688   m_apcSlicePilot->initSlice();
     728  m_apcSlicePilot->initSlice(); // the slice pilot is an object to prepare for a new slice
     729                                // it is not associated with picture, sps or pps structures.
    689730#endif
    690731
     
    700741
    701742  m_apcSlicePilot->setNalUnitType(nalu.m_nalUnitType);
    702 #if SVC_EXTENSION
    703   m_apcSlicePilot->setTLayer( nalu.m_temporalId );
    704 #endif
     743
    705744  Bool nonReferenceFlag = (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_N ||
    706745                           m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N   ||
     
    716755#endif
    717756
    718 #if SVC_EXTENSION
    719   setRefLayerParams(m_apcSlicePilot->getVPS());
     757  m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManager);
     758
     759#if SVC_EXTENSION
     760  const TComPPS *pps = m_parameterSetManager.getPPS(m_apcSlicePilot->getPPSId());
     761  assert (pps != 0);
     762  const TComSPS *sps = m_parameterSetManager.getSPS(pps->getSPSId());
     763  assert (sps != 0);
     764  const TComVPS *vps = m_parameterSetManager.getVPS(sps->getVPSId());
     765  assert (vps != 0);
     766
     767  // Following check should go wherever the VPS is activated
     768  if( !vps->getBaseLayerAvailableFlag() )
     769  {
     770    assert( nalu.m_layerId != 0 );
     771    assert( vps->getNumAddLayerSets() > 0 );
     772
     773    if( m_commonDecoderParams->getTargetOutputLayerSetIdx() >= 0 )
     774    {
     775      UInt layerIdx = vps->getOutputLayerSetIdx( getCommonDecoderParams()->getTargetOutputLayerSetIdx() );
     776      assert( layerIdx > vps->getVpsNumLayerSetsMinus1() );
     777    }
     778  } 
     779
     780  setRefLayerParams(vps);
    720781  m_apcSlicePilot->setNumMotionPredRefLayers(m_numMotionPredRefLayers);
    721782#endif
    722   m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder);
    723783
    724784  // set POC for dependent slices in skipped pictures
     
    779839  if (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_craNoRaslOutputFlag) //Reset POC MSB when CRA has NoRaslOutputFlag equal to 1
    780840  {
    781     Int iMaxPOClsb = 1 << m_apcSlicePilot->getSPS()->getBitsForPOC();
     841#if !SVC_EXTENSION
     842    TComPPS *pps = m_parameterSetManager.getPPS(m_apcSlicePilot->getPPSId());
     843    assert (pps != 0);
     844    TComSPS *sps = m_parameterSetManager.getSPS(pps->getSPSId());
     845    assert (sps != 0);
     846#endif
     847    Int iMaxPOClsb = 1 << sps->getBitsForPOC();
    782848    m_apcSlicePilot->setPOC( m_apcSlicePilot->getPOC() & (iMaxPOClsb - 1) );
    783849  }
     
    892958    if( m_apcSlicePilot->getPocResetIdc() != 0 )
    893959    {
    894       if( m_apcSlicePilot->getVPS()->getVpsPocLsbAlignedFlag() )
     960      if( vps->getVpsPocLsbAlignedFlag() )
    895961      {
    896962        m_pocResettingFlag = true;
     
    9561022  numAffectedLayers = 1;
    9571023
    958   if( m_apcSlicePilot->getVPS()->getVpsPocLsbAlignedFlag() )
    959   {
    960     for( UInt j = 0; j < m_apcSlicePilot->getVPS()->getNumPredictedLayers(m_apcSlicePilot->getLayerId()); j++ )
    961     {
    962       affectedLayerList[j + 1] = m_apcSlicePilot->getVPS()->getPredictedLayerId(m_apcSlicePilot->getLayerId(), j);
    963     }
    964     numAffectedLayers = m_apcSlicePilot->getVPS()->getNumPredictedLayers(m_apcSlicePilot->getLayerId()) + 1;
     1024  if( vps->getVpsPocLsbAlignedFlag() )
     1025  {
     1026    for( UInt j = 0; j < vps->getNumPredictedLayers(m_apcSlicePilot->getLayerId()); j++ )
     1027    {
     1028      affectedLayerList[j + 1] = vps->getPredictedLayerId(m_apcSlicePilot->getLayerId(), j);
     1029    }
     1030    numAffectedLayers = vps->getNumPredictedLayers(m_apcSlicePilot->getLayerId()) + 1;
    9651031  }
    9661032
     
    11671233  m_apcSlicePilot->setAvailableForTMVPRefFlag( true );
    11681234
    1169   // actual decoding starts here
    1170   xActivateParameterSets();
    1171 
    11721235  // Initialize ILRP if needed, only for the current layer 
    11731236  // ILRP intialization should go along with activation of parameters sets,
     
    11751238  xInitILRP(m_apcSlicePilot);
    11761239
    1177   if (!m_apcSlicePilot->getDependentSliceSegmentFlag())
    1178   {
    1179     m_prevPOC = m_apcSlicePilot->getPOC();
    1180     curLayerId = m_layerId;
    1181     m_uiPrevLayerId = m_layerId;
    1182   }
    1183   m_bFirstSliceInSequence = false;
    1184   m_bFirstSliceInBitstream  = false;
    1185 
    11861240#else //SVC_EXTENSION
    11871241  //we should only get a different poc for a new picture (with CTU address==0)
     
    12051259    m_prevPOC = m_apcSlicePilot->getPOC();
    12061260  }
     1261#endif //SVC_EXTENSION
     1262
     1263  //detect lost reference picture and insert copy of earlier frame.
     1264  {
     1265    Int lostPoc;
     1266    while((lostPoc=m_apcSlicePilot->checkThatAllRefPicsAreAvailable(m_cListPic, m_apcSlicePilot->getRPS(), true, m_pocRandomAccess)) > 0)
     1267    {
     1268      xCreateLostPicture(lostPoc-1);
     1269    }
     1270  }
     1271
     1272  if (!m_apcSlicePilot->getDependentSliceSegmentFlag())
     1273  {
     1274    m_prevPOC = m_apcSlicePilot->getPOC();
     1275#if SVC_EXTENSION
     1276    curLayerId = m_layerId;
     1277    m_uiPrevLayerId = m_layerId;
     1278#endif
     1279  }
    12071280
    12081281  // actual decoding starts here
    12091282  xActivateParameterSets();
    12101283
    1211   if (!m_apcSlicePilot->getDependentSliceSegmentFlag())
    1212   {
    1213     m_prevPOC = m_apcSlicePilot->getPOC();
    1214   }
    12151284  m_bFirstSliceInSequence = false;
    12161285  m_bFirstSliceInBitstream  = false;
    1217 #endif //SVC_EXTENSION
    1218 
    1219   //detect lost reference picture and insert copy of earlier frame.
    1220   Int lostPoc;
    1221   while((lostPoc=m_apcSlicePilot->checkThatAllRefPicsAreAvailable(m_cListPic, m_apcSlicePilot->getRPS(), true, m_pocRandomAccess)) > 0)
    1222   {
    1223     xCreateLostPicture(lostPoc-1);
    1224   }
     1286
     1287  TComSlice* pcSlice = m_pcPic->getPicSym()->getSlice(m_uiSliceIdx);
     1288
     1289#if SVC_EXTENSION
    12251290  if (m_bFirstSliceInPicture)
    12261291  {
    1227 #if SVC_EXTENSION
    12281292#if AVC_BASE
    1229     if( m_layerId > 0 && m_parameterSetManagerDecoder.getPrefetchedVPS(0)->getNonHEVCBaseLayerFlag() )
     1293    if( m_layerId > 0 && vps->getNonHEVCBaseLayerFlag() )
    12301294    {
    12311295      TComPic* pBLPic = (*m_ppcTDecTop[0]->getListPic()->begin());
     
    13361400    if ( m_layerId == 0 && m_apcSlicePilot->getRapPicFlag() && getNoClrasOutputFlag() )
    13371401    {
    1338       for (UInt i = 0; i < m_apcSlicePilot->getVPS()->getMaxLayers(); i++)
     1402      for (UInt i = 0; i < vps->getMaxLayers(); i++)
    13391403      {
    13401404        m_ppcTDecTop[i]->setLayerInitializedFlag(false);
     
    13451409    xCheckLayerReset();
    13461410    xSetLayerInitializedFlag();
    1347 #endif
    1348 
    1349     // Buffer initialize for prediction.
    1350     m_cPrediction.initTempBuff(m_apcSlicePilot->getSPS()->getChromaFormatIdc());
    1351 #if ALIGNED_BUMPING
    1352     m_apcSlicePilot->checkLeadingPictureRestrictions(m_cListPic);
    1353 #else
    1354     m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS());
    1355 #endif
    1356     //  Get a new picture buffer
    1357     xGetNewPicBuffer (m_apcSlicePilot, m_pcPic);
    1358 
     1411   
    13591412#if SVC_POC
    13601413    m_pcPic->setCurrAuFlag( true );
     
    13991452        else
    14001453        {
    1401           if( m_apcSlicePilot->getVPS()->getBaseLayerInternalFlag())
     1454          if( vps->getBaseLayerInternalFlag())
    14021455          {
    14031456            /* When the picture with nuh_layer_id equal to 0 in an access unit is not an IDR picture
     
    14171470      and there is at least one other picture in the same access unit that is not an IRAP picture,
    14181471      the value of poc_reset_idc shall be equal to 1 or 2 for all pictures in the access unit. */
    1419       if( m_baseLayerPicPresentFlag && m_baseLayerIrapFlag && !m_apcSlicePilot->isIRAP() && m_apcSlicePilot->getVPS()->getBaseLayerInternalFlag() )
     1472      if( m_baseLayerPicPresentFlag && m_baseLayerIrapFlag && !m_apcSlicePilot->isIRAP() && vps->getBaseLayerInternalFlag() )
    14201473      {
    14211474        assert( m_apcSlicePilot->getPocResetIdc() == 1 || m_apcSlicePilot->getPocResetIdc() == 2 );
     
    14251478      vps_base_layer_internal_flag is equal to 1 and there is at least one non-IDR picture in the same access unit,
    14261479      the value of poc_reset_idc shall be equal to 2 for all pictures in the access unit. */
    1427       if( m_baseLayerPicPresentFlag && m_baseLayerIdrFlag && !m_apcSlicePilot->isIDR() && m_apcSlicePilot->getVPS()->getBaseLayerInternalFlag() )
     1480      if( m_baseLayerPicPresentFlag && m_baseLayerIdrFlag && !m_apcSlicePilot->isIDR() && vps->getBaseLayerInternalFlag() )
    14281481      {
    14291482        assert( m_apcSlicePilot->getPocResetIdc() == 2 );
     
    14431496    }
    14441497#endif
    1445 
    1446     Bool isField = false;
    1447     Bool isTopField = false;
    1448    
    1449     if(!m_SEIs.empty())
    1450     {
    1451       // Check if any new Picture Timing SEI has arrived
    1452       SEIMessages pictureTimingSEIs = extractSeisByType (m_SEIs, SEI::PICTURE_TIMING);
    1453       if (pictureTimingSEIs.size()>0)
    1454       {
    1455         SEIPictureTiming* pictureTiming = (SEIPictureTiming*) *(pictureTimingSEIs.begin());
    1456         isField    = (pictureTiming->m_picStruct == 1) || (pictureTiming->m_picStruct == 2) || (pictureTiming->m_picStruct == 9) || (pictureTiming->m_picStruct == 10) || (pictureTiming->m_picStruct == 11) || (pictureTiming->m_picStruct == 12);
    1457         isTopField = (pictureTiming->m_picStruct == 1) || (pictureTiming->m_picStruct == 9) || (pictureTiming->m_picStruct == 11);
    1458       }
    1459 
    1460 #if Q0189_TMVP_CONSTRAINTS
    1461       // Check if any new temporal motion vector prediction constraints SEI has arrived
    1462       SEIMessages seiTMVPConstrainsList = extractSeisByType (m_SEIs, SEI::TMVP_CONSTRAINTS);
    1463       if (seiTMVPConstrainsList.size() > 0)
    1464       {
    1465         assert ( m_pcPic->getTLayer() == 0 );  //this SEI can present only for AU with Tid equal to 0
    1466         SEITMVPConstrains* tmvpConstraintSEI = (SEITMVPConstrains*) *(seiTMVPConstrainsList.begin());
    1467         if ( tmvpConstraintSEI->prev_pics_not_used_flag == 1 )
    1468         {
    1469           //update all pics in the DPB such that they cannot be used for TMPV ref
    1470           TComList<TComPic*>::iterator  iterRefPic = m_cListPic.begin(); 
    1471           while( iterRefPic != m_cListPic.end() )
    1472           {
    1473             TComPic *refPic = *iterRefPic;
    1474             if( ( refPic->getLayerId() == m_pcPic->getLayerId() ) && refPic->getReconMark() )
    1475             {
    1476               for(Int i = refPic->getNumAllocatedSlice()-1; i >= 0; i--)
    1477               {
    1478                 TComSlice *refSlice = refPic->getSlice(i);
    1479                 refSlice->setAvailableForTMVPRefFlag( false );
    1480               }
    1481             }
    1482             iterRefPic++;
    1483           }
    1484         }
    1485       }
    1486 #endif
    1487     }
    1488    
    1489     //Set Field/Frame coding mode
    1490     m_pcPic->setField(isField);
    1491     m_pcPic->setTopField(isTopField);
    1492 
    1493     // transfer any SEI messages that have been received to the picture
    1494     m_pcPic->setSEIs(m_SEIs);
    1495     m_SEIs.clear();
    1496 
    1497     // Recursive structure
    1498     m_cCuDecoder.create ( g_uiMaxCUDepth, g_uiMaxCUWidth, g_uiMaxCUHeight, m_apcSlicePilot->getSPS()->getChromaFormatIdc() );
    1499 #if SVC_EXTENSION
    1500     m_cCuDecoder.init   ( m_ppcTDecTop,&m_cEntropyDecoder, &m_cTrQuant, &m_cPrediction, curLayerId );
    1501 #else
    1502     m_cCuDecoder.init   ( &m_cEntropyDecoder, &m_cTrQuant, &m_cPrediction );
    1503 #endif
    1504     m_cTrQuant.init     ( g_uiMaxCUWidth, g_uiMaxCUHeight, m_apcSlicePilot->getSPS()->getMaxTrSize());
    1505 
    1506     m_cSliceDecoder.create();
    1507   }
    1508   else
    1509   {
    1510     // Check if any new SEI has arrived
    1511     if(!m_SEIs.empty())
    1512     {
    1513       // Currently only decoding Unit SEI message occurring between VCL NALUs copied
    1514       SEIMessages &picSEI = m_pcPic->getSEIs();
    1515       SEIMessages decodingUnitInfos = extractSeisByType (m_SEIs, SEI::DECODING_UNIT_INFO);
    1516       picSEI.insert(picSEI.end(), decodingUnitInfos.begin(), decodingUnitInfos.end());
    1517       deleteSEIs(m_SEIs);
    1518     }
    1519   }
    1520 
    1521   //  Set picture slice pointer
    1522   TComSlice*  pcSlice = m_apcSlicePilot;
    1523 
    1524   m_pcPic->getPicSym()->initTiles(pcSlice->getPPS());
    1525   m_pcPic->getPicSym()->initCtuTsRsAddrMaps();
    1526 
     1498  }
     1499#endif //SVC_EXTENSION
     1500   
    15271501  // When decoding the slice header, the stored start and end addresses were actually RS addresses, not TS addresses.
    15281502  // Now, having set up the maps, convert them to the correct form.
     
    15341508    pcSlice->setSliceCurEndCtuTsAddr(m_pcPic->getPicSym()->getCtuRsToTsAddrMap(pcSlice->getSliceCurEndCtuTsAddr()));
    15351509  }
    1536 
    1537   if (m_bFirstSliceInPicture)
    1538   {
    1539     if(m_pcPic->getNumAllocatedSlice() != 1)
    1540     {
    1541       m_pcPic->clearSliceBuffer();
    1542     }
    1543   }
    1544   else
    1545   {
    1546     m_pcPic->allocateNewSlice();
    1547   }
    1548   assert(m_pcPic->getNumAllocatedSlice() == (m_uiSliceIdx + 1));
    1549   m_apcSlicePilot = m_pcPic->getPicSym()->getSlice(m_uiSliceIdx);
    1550   m_pcPic->getPicSym()->setSlice(pcSlice, m_uiSliceIdx);
    1551 
     1510   
    15521511  m_pcPic->setTLayer(nalu.m_temporalId);
    15531512
     
    15771536        UInt refLayerId = pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc);
    15781537#if AVC_BASE
    1579         if( refLayerId == 0 && m_parameterSetManagerDecoder.getActiveVPS()->getNonHEVCBaseLayerFlag() )
     1538        if( refLayerId == 0 && m_parameterSetManager.getActiveVPS()->getNonHEVCBaseLayerFlag() )
    15801539        {         
    15811540          TComPic* pic = *m_ppcTDecTop[0]->getListPic()->begin();
     
    16191578
    16201579        // conformance check: when ScaledRefRegionWidthInSamplesY is equal to RefLayerRegionWidthInSamplesY, PhaseHorY shall be equal to 0, when ScaledRefRegionWidthInSamplesC is equal to RefLayerRegionWidthInSamplesC, PhaseHorC shall be equal to 0, when ScaledRefRegionHeightInSamplesY is equal to RefLayerRegionHeightInSamplesY, PhaseVerY shall be equal to 0, and when ScaledRefRegionHeightInSamplesC is equal to RefLayerRegionHeightInSamplesC, PhaseVerC shall be equal to 0.
    1621         Bool phaseSetPresentFlag;
    1622         Int phaseHorLuma, phaseVerLuma, phaseHorChroma, phaseVerChroma;
    1623         pcSlice->getPPS()->getResamplingPhase( refLayerId, phaseSetPresentFlag, phaseHorLuma, phaseVerLuma, phaseHorChroma, phaseVerChroma );
    1624 
    1625         assert( ( (widthEL  != widthBL)  || (phaseHorLuma == 0 && phaseHorChroma == 0) )
    1626              && ( (heightEL != heightBL) || (phaseVerLuma == 0 && phaseVerChroma == 0) ) );
     1580        const ResamplingPhase &resamplingPhase = pcSlice->getPPS()->getResamplingPhase( refLayerId );
     1581
     1582        assert( ( (widthEL  != widthBL)  || (resamplingPhase.phaseHorLuma == 0 && resamplingPhase.phaseHorChroma == 0) )
     1583             && ( (heightEL != heightBL) || (resamplingPhase.phaseVerLuma == 0 && resamplingPhase.phaseVerChroma == 0) ) );
    16271584
    16281585        g_mvScalingFactor[refLayerIdc][0] = widthEL  == widthBL  ? 4096 : Clip3(-4096, 4095, ((widthEL  << 8) + (widthBL  >> 1)) / widthBL);
     
    16731630        UInt refLayerIdc = pcSlice->getInterLayerPredLayerIdc(i);
    16741631#if AVC_BASE
    1675         if( pcSlice->getVPS()->getRefLayerId( m_layerId, refLayerIdc ) == 0 && m_parameterSetManagerDecoder.getActiveVPS()->getNonHEVCBaseLayerFlag() )
     1632        if( pcSlice->getVPS()->getRefLayerId( m_layerId, refLayerIdc ) == 0 && pcSlice->getVPS()->getNonHEVCBaseLayerFlag() )
    16761633        {
    16771634          pcSlice->setBaseColPic ( refLayerIdc, *m_ppcTDecTop[0]->getListPic()->begin() );
     
    17921749  if(pcSlice->getSPS()->getScalingListFlag())
    17931750  {
    1794     pcSlice->setScalingList ( pcSlice->getSPS()->getScalingList()  );
    1795 
    1796 #if SVC_EXTENSION
    1797     if( pcSlice->getPPS()->getScalingListPresentFlag() || pcSlice->getPPS()->getInferScalingListFlag() )
     1751    TComScalingList scalingList;
     1752
     1753#if SVC_EXTENSION
     1754    if( pcSlice->getPPS()->getInferScalingListFlag() )
     1755    {
     1756      const TComPPS *refPps = m_ppcTDecTop[pcSlice->getPPS()->getScalingListRefLayerId()]->getParameterSetManager()->getActivePPS(); assert( refPps != NULL );
     1757      scalingList = refPps->getScalingList();
     1758    }
     1759    else
     1760#endif
     1761    if(pcSlice->getPPS()->getScalingListPresentFlag())
     1762    {
     1763      scalingList = pcSlice->getPPS()->getScalingList();
     1764    }
     1765#if SVC_EXTENSION
     1766    else if( pcSlice->getSPS()->getInferScalingListFlag() )
     1767    {
     1768      const TComSPS *refSps = m_ppcTDecTop[pcSlice->getSPS()->getScalingListRefLayerId()]->getParameterSetManager()->getActiveSPS(); assert( refSps != NULL );
     1769      scalingList = refSps->getScalingList();
     1770    }
     1771#endif
     1772    else if (pcSlice->getSPS()->getScalingListPresentFlag())
     1773    {
     1774      scalingList = pcSlice->getSPS()->getScalingList();
     1775    }
     1776    else
     1777    {
     1778      scalingList.setDefaultScalingList();
     1779    }
     1780#if SVC_EXTENSION
     1781    m_cTrQuant.setScalingListDec(scalingList, pcSlice->getChromaFormatIdc());
    17981782#else
    1799     if(pcSlice->getPPS()->getScalingListPresentFlag())
    1800 #endif
    1801     {
    1802       pcSlice->setScalingList ( pcSlice->getPPS()->getScalingList()  );
    1803     }
    1804 
    1805 #if SVC_EXTENSION
    1806     if( m_layerId == 0 || ( m_layerId > 0 && !pcSlice->getPPS()->getInferScalingListFlag() && !pcSlice->getSPS()->getInferScalingListFlag() ) )
    1807 #endif
    1808     if(!pcSlice->getPPS()->getScalingListPresentFlag() && !pcSlice->getSPS()->getScalingListPresentFlag())
    1809     {
    1810       pcSlice->setDefaultScalingList();
    1811     }
    1812     m_cTrQuant.setScalingListDec(pcSlice->getScalingList(), pcSlice->getSPS()->getChromaFormatIdc());
     1783    m_cTrQuant.setScalingListDec(scalingList, pcSlice->getSPS()->getChromaFormatIdc());
     1784#endif
    18131785    m_cTrQuant.setUseScalingList(true);
    18141786  }
    18151787  else
    18161788  {
     1789#if SVC_EXTENSION
     1790    m_cTrQuant.setFlatScalingList(pcSlice->getChromaFormatIdc());
     1791#else
    18171792    m_cTrQuant.setFlatScalingList(pcSlice->getSPS()->getChromaFormatIdc());
     1793#endif
    18181794    m_cTrQuant.setUseScalingList(false);
    18191795  }
     
    18331809}
    18341810
    1835 Void TDecTop::xDecodeVPS()
     1811Void TDecTop::xDecodeVPS(const std::vector<UChar> *pNaluData)
    18361812{
    18371813  TComVPS* vps = new TComVPS();
    18381814
    18391815  m_cEntropyDecoder.decodeVPS( vps );
    1840   m_parameterSetManagerDecoder.storePrefetchedVPS(vps);
     1816  m_parameterSetManager.storeVPS(vps, pNaluData);
    18411817#if SVC_EXTENSION
    18421818  checkValueOfTargetOutputLayerSetIdx(vps);
    1843 #endif
    1844 }
    1845 
    1846 Void TDecTop::xDecodeSPS()
     1819
     1820#if AVC_BASE
     1821  if( vps->getNonHEVCBaseLayerFlag() )
     1822  {
     1823    if( !m_ppcTDecTop[0]->getBLReconFile()->good() )
     1824    {
     1825      printf( "Base layer YUV input reading error\n" );
     1826      exit(EXIT_FAILURE);
     1827    }       
     1828  }
     1829  else
     1830  {
     1831    TComList<TComPic*> *cListPic = m_ppcTDecTop[0]->getListPic();
     1832    cListPic->clear();
     1833  }
     1834#endif
     1835
     1836  xDeriveSmallestLayerId(vps);
     1837#endif
     1838}
     1839
     1840Void TDecTop::xDecodeSPS(const std::vector<UChar> *pNaluData)
    18471841{
    18481842  TComSPS* sps = new TComSPS();
     
    18541848#endif
    18551849  m_cEntropyDecoder.decodeSPS( sps );
    1856   m_parameterSetManagerDecoder.storePrefetchedSPS(sps);
     1850  m_parameterSetManager.storeSPS(sps, pNaluData);
    18571851}
    18581852
    18591853#if CGS_3D_ASYMLUT
    1860 Void TDecTop::xDecodePPS( TCom3DAsymLUT * pc3DAsymLUT )
     1854Void TDecTop::xDecodePPS( const std::vector<UChar> *pNaluData, TCom3DAsymLUT * pc3DAsymLUT )
    18611855#else
    1862 Void TDecTop::xDecodePPS()
     1856Void TDecTop::xDecodePPS(const std::vector<UChar> *pNaluData)
    18631857#endif
    18641858{
     
    18731867  m_cEntropyDecoder.decodePPS( pps );
    18741868#endif
    1875   m_parameterSetManagerDecoder.storePrefetchedPPS( pps );
     1869  m_parameterSetManager.storePPS( pps, pNaluData);
    18761870}
    18771871
     
    18871881#endif
    18881882#if LAYERS_NOT_PRESENT_SEI
    1889     m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveVPS(), m_parameterSetManagerDecoder.getActiveSPS(), m_pDecodedSEIOutputStream  );
     1883    m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManager.getActiveVPS(), m_parameterSetManager.getActiveSPS(), m_pDecodedSEIOutputStream  );
    18901884#else
    1891     m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS(), m_pDecodedSEIOutputStream );
     1885    m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManager.getActiveSPS(), m_pDecodedSEIOutputStream );
    18921886#endif
    18931887  }
     
    18951889  {
    18961890#if LAYERS_NOT_PRESENT_SEI
    1897     m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveVPS(), m_parameterSetManagerDecoder.getActiveSPS(), m_pDecodedSEIOutputStream  );
     1891    m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManager.getActiveVPS(), m_parameterSetManager.getActiveSPS(), m_pDecodedSEIOutputStream  );
    18981892#else
    1899     m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveSPS(), m_pDecodedSEIOutputStream );
     1893    m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManager.getActiveSPS(), m_pDecodedSEIOutputStream );
    19001894#endif
    19011895    SEIMessages activeParamSets = getSeisByType(m_SEIs, SEI::ACTIVE_PARAMETER_SETS);
     
    19041898      SEIActiveParameterSets *seiAps = (SEIActiveParameterSets*)(*activeParamSets.begin());
    19051899#if R0247_SEI_ACTIVE
    1906       getLayerDec(0)->m_parameterSetManagerDecoder.applyPrefetchedPS();
    19071900      assert(seiAps->activeSeqParameterSetId.size()>0);
    1908       if( !getLayerDec(0)->m_parameterSetManagerDecoder.activateSPSWithSEI( seiAps->activeSeqParameterSetId[0] ) )
     1901      if( !getLayerDec(0)->m_parameterSetManager.activateSPSWithSEI( seiAps->activeSeqParameterSetId[0] ) )
    19091902      {
    19101903        printf ("Warning SPS activation with Active parameter set SEI failed");
     
    19131906      {
    19141907        Int layerIdx = seiAps->layerSpsIdx[c];
    1915         getLayerDec(layerIdx)->m_parameterSetManagerDecoder.applyPrefetchedPS();
    1916         if( !getLayerDec(layerIdx)->m_parameterSetManagerDecoder.activateSPSWithSEI( seiAps->activeSeqParameterSetId[layerIdx] ) )
     1908        if( !getLayerDec(layerIdx)->m_parameterSetManager.activateSPSWithSEI( seiAps->activeSeqParameterSetId[layerIdx] ) )
    19171909        {
    19181910          printf ("Warning SPS activation with Active parameter set SEI failed");
     
    19201912      }
    19211913#else
    1922       m_parameterSetManagerDecoder.applyPrefetchedPS();
    19231914      assert(seiAps->activeSeqParameterSetId.size()>0);
    1924       if (! m_parameterSetManagerDecoder.activateSPSWithSEI(seiAps->activeSeqParameterSetId[0] ))
     1915      if (! m_parameterSetManager.activateSPSWithSEI(seiAps->activeSeqParameterSetId[0] ))
    19251916      {
    19261917        printf ("Warning SPS activation with Active parameter set SEI failed");
     
    19541945      assert( nalu.m_layerId == 0 ); // Non-conforming bitstream. The value of nuh_layer_id of VPS NAL unit shall be equal to 0.
    19551946#endif
    1956       xDecodeVPS();
     1947      xDecodeVPS(nalu.m_Bitstream->getFifo());
    19571948#if RExt__DECODER_DEBUG_BIT_STATISTICS
    19581949      TComCodingStatistics::IncrementStatisticEP(STATS__BYTE_ALIGNMENT_BITS,nalu.m_Bitstream->readByteAlignment(),0);
    19591950#endif
    19601951#if SVC_EXTENSION
    1961       m_isLastNALWasEos = false;
    1962 #if AVC_BASE
    1963       if( m_parameterSetManagerDecoder.getPrefetchedVPS(0)->getNonHEVCBaseLayerFlag() )
    1964       {
    1965         if( !m_ppcTDecTop[0]->getBLReconFile()->good() )
    1966         {
    1967           printf( "Base layer YUV input reading error\n" );
    1968           exit(EXIT_FAILURE);
    1969         }       
    1970       }
    1971       else
    1972       {
    1973         TComList<TComPic*> *cListPic = m_ppcTDecTop[0]->getListPic();
    1974         cListPic->clear();
    1975       }
    1976 #endif
    1977       xDeriveSmallestLayerId(m_parameterSetManagerDecoder.getPrefetchedVPS(0));
     1952      m_isLastNALWasEos = false;   
    19781953#endif
    19791954      return false;
    19801955
    19811956    case NAL_UNIT_SPS:
    1982       xDecodeSPS();
     1957      xDecodeSPS(nalu.m_Bitstream->getFifo());
    19831958#if RExt__DECODER_DEBUG_BIT_STATISTICS
    19841959      TComCodingStatistics::IncrementStatisticEP(STATS__BYTE_ALIGNMENT_BITS,nalu.m_Bitstream->readByteAlignment(),0);
     
    19871962
    19881963    case NAL_UNIT_PPS:
    1989       xDecodePPS(
    19901964#if CGS_3D_ASYMLUT
    1991         &m_c3DAsymLUTPPS
    1992 #endif
    1993         );
     1965      xDecodePPS( nalu.m_Bitstream->getFifo(), &m_c3DAsymLUTPPS );
     1966#else
     1967      xDecodePPS(nalu.m_Bitstream->getFifo());
     1968#endif
    19941969#if RExt__DECODER_DEBUG_BIT_STATISTICS
    19951970      TComCodingStatistics::IncrementStatisticEP(STATS__BYTE_ALIGNMENT_BITS,nalu.m_Bitstream->readByteAlignment(),0);
     
    22052180Void TDecTop::xInitILRP(TComSlice *slice)
    22062181{
    2207   TComSPS* pcSPS = slice->getSPS();
     2182  const TComVPS* vps  = slice->getVPS();
     2183  const TComSPS* sps  = slice->getSPS();
     2184
    22082185  Int bitDepthY   = slice->getBitDepthY();
    22092186  Int bitDepthC   = slice->getBitDepthC();
    2210   Int picWidth    = slice->getPicWidthInLumaSamples();
    2211   Int picHeight   = slice->getPicHeightInLumaSamples();
    22122187
    22132188  if( m_layerId > 0 )
     
    22162191    g_bitDepth[CHANNEL_TYPE_LUMA]     = bitDepthY;
    22172192    g_bitDepth[CHANNEL_TYPE_CHROMA]   = bitDepthC;
    2218     g_uiMaxCUWidth  = pcSPS->getMaxCUWidth();
    2219     g_uiMaxCUHeight = pcSPS->getMaxCUHeight();
    2220     g_uiMaxCUDepth  = pcSPS->getMaxCUDepth();
    2221     g_uiAddCUDepth  = max (0, pcSPS->getLog2MinCodingBlockSize() - (Int)pcSPS->getQuadtreeTULog2MinSize() );
     2193    g_uiMaxCUWidth  = sps->getMaxCUWidth();
     2194    g_uiMaxCUHeight = sps->getMaxCUHeight();
     2195    g_uiMaxCUDepth  = sps->getMaxCUDepth();
     2196    g_uiAddCUDepth  = max (0, sps->getLog2MinCodingBlockSize() - (Int)sps->getQuadtreeTULog2MinSize() );
    22222197
    22232198    Int  numReorderPics[MAX_TLAYER];
    2224     Window &conformanceWindow = slice->getConformanceWindow();
    2225     Window defaultDisplayWindow = pcSPS->getVuiParametersPresentFlag() ? pcSPS->getVuiParameters()->getDefaultDisplayWindow() : Window();
    22262199
    22272200    for( Int temporalLayer=0; temporalLayer < MAX_TLAYER; temporalLayer++ )
     
    22302203      {
    22312204        assert( this->getLayerId() == 0 );
    2232         numReorderPics[temporalLayer] = pcSPS->getNumReorderPics(temporalLayer);
     2205        numReorderPics[temporalLayer] = sps->getNumReorderPics(temporalLayer);
    22332206      }
    22342207      else
    2235       {
    2236         TComVPS *vps = slice->getVPS();
     2208      {       
    22372209        // SHM decoders will use DPB size table in the VPS to determine the number of reorder pictures.
    22382210        numReorderPics[temporalLayer] = vps->getMaxVpsNumReorderPics( getCommonDecoderParams()->getTargetOutputLayerSetIdx() , temporalLayer);
     
    22442216      for (Int j=0; j < m_numDirectRefLayers; j++)
    22452217      {
    2246 
    22472218        m_cIlpPic[j] = new  TComPic;
    22482219
    2249 #if AUXILIARY_PICTURES
    2250         m_cIlpPic[j]->create(picWidth, picHeight, slice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, pcSPS, true);
    2251 #else
    2252         m_cIlpPic[j]->create(picWidth, picHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, pcSPS, true);
    2253 #endif
     2220        m_cIlpPic[j]->create(*vps, *sps, *slice->getPPS(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, true, m_layerId);
     2221
    22542222        for (Int i=0; i<m_cIlpPic[j]->getPicSym()->getNumberOfCtusInFrame(); i++)
    22552223        {
     
    22632231TDecTop* TDecTop::getRefLayerDec( UInt refLayerIdx )
    22642232{
    2265   TComVPS* vps = m_parameterSetManagerDecoder.getActiveVPS();
     2233  const TComVPS* vps = m_parameterSetManager.getActiveVPS();
    22662234  if( vps->getNumDirectRefLayers( m_layerId ) <= 0 )
    22672235  {
     
    22722240}
    22732241
    2274 Void TDecTop::setRefLayerParams( TComVPS* vps )
     2242Void TDecTop::setRefLayerParams( const TComVPS* vps )
    22752243{
    22762244  for(UInt layerIdx = 0; layerIdx < m_numLayer; layerIdx++)
     
    24042372}
    24052373
    2406 Void TDecTop::markAllPicsAsNoCurrAu(TComVPS *vps)
     2374Void TDecTop::markAllPicsAsNoCurrAu( const TComVPS *vps )
    24072375{
    24082376  for(Int i = 0; i < MAX_LAYERS; i++)
    24092377  {
    2410     TComList<TComPic*>* listPic = this->getLayerDec(vps->getLayerIdInNuh(i))->getListPic();
     2378    TComList<TComPic*>* listPic = m_ppcTDecTop[vps->getLayerIdInNuh(i)]->getListPic();
    24112379    TComList<TComPic*>::iterator  iterPic = listPic->begin();
    24122380    while ( iterPic != listPic->end() )
     
    25702538}
    25712539
    2572 Void TDecTop::xSetSpatialEnhLayerFlag(TComSlice* slice, TComPic* pic)
    2573 {
    2574   for(UInt i = 0; i < slice->getVPS()->getNumDirectRefLayers( m_layerId ); i++ )
    2575   {
    2576     const Window scalEL = slice->getPPS()->getScaledRefLayerWindowForLayer(slice->getVPS()->getRefLayerId(m_layerId, i));
    2577     const Window refEL = slice->getPPS()->getRefLayerWindowForLayer(slice->getVPS()->getRefLayerId(m_layerId, i));
     2540Void TDecTop::xSetSpatialEnhLayerFlag( const TComVPS &vps, const TComSPS &sps, const TComPPS &pps, TComPic* pic )
     2541{
     2542  for(UInt i = 0; i < vps.getNumDirectRefLayers( m_layerId ); i++ )
     2543  {
     2544    const Window scalEL = pps.getScaledRefLayerWindowForLayer(vps.getRefLayerId(m_layerId, i));
     2545    const Window refEL = pps.getRefLayerWindowForLayer(vps.getRefLayerId(m_layerId, i));
    25782546    Bool equalOffsets = scalEL.hasEqualOffset(refEL);
    2579     Bool zeroPhase = slice->getPPS()->hasZeroResamplingPhase(slice->getVPS()->getRefLayerId(m_layerId, i));
     2547    Bool zeroPhase = pps.hasZeroResamplingPhase(vps.getRefLayerId(m_layerId, i));
    25802548
    25812549    TDecTop *pcTDecTopBase = (TDecTop *)getRefLayerDec( i );
    2582     //TComPic*                      pcPic = *(pcTDecTopBase->getListPic()->begin());
    25832550    TComPicYuv* pcPicYuvRecBase = (*(pcTDecTopBase->getListPic()->begin()))->getPicYuvRec();
    25842551
    2585     UInt refLayerId = slice->getVPS()->getRefLayerId(m_layerId, i);
     2552    UInt refLayerId = vps.getRefLayerId(m_layerId, i);
    25862553    Bool sameBitDepths = ( g_bitDepthLayer[CHANNEL_TYPE_LUMA][m_layerId] == g_bitDepthLayer[CHANNEL_TYPE_LUMA][refLayerId] ) && ( g_bitDepthLayer[CHANNEL_TYPE_CHROMA][m_layerId] == g_bitDepthLayer[CHANNEL_TYPE_CHROMA][refLayerId] );
    25872554
    2588     if( pcPicYuvRecBase->getWidth(COMPONENT_Y) == slice->getPicWidthInLumaSamples() && pcPicYuvRecBase->getHeight(COMPONENT_Y) == slice->getPicHeightInLumaSamples() && equalOffsets && zeroPhase )
     2555    if( pcPicYuvRecBase->getWidth(COMPONENT_Y) == vps.getPicWidthInLumaSamples(&sps, m_layerId) && pcPicYuvRecBase->getHeight(COMPONENT_Y) == vps.getPicHeightInLumaSamples(&sps, m_layerId) && equalOffsets && zeroPhase )
    25892556    {
    25902557      pic->setEqualPictureSizeAndOffsetFlag( i, true );
     
    25932560    if( !pic->equalPictureSizeAndOffsetFlag(i) || !sameBitDepths
    25942561#if CGS_3D_ASYMLUT
    2595       || slice->getPPS()->getCGSFlag() > 0
     2562      || pps.getCGSFlag() > 0
    25962563#endif
    25972564#if LAYER_CTB
     
    26032570
    26042571      //only for scalable extension
    2605       assert( slice->getVPS()->getScalabilityMask( SCALABILITY_ID ) == true );
     2572      assert( vps.getScalabilityMask( SCALABILITY_ID ) == true );
    26062573    }
    26072574  }
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.h

    r1223 r1235  
    7575
    7676  TComList<TComPic*>      m_cListPic;         //  Dynamic buffer
    77   ParameterSetManagerDecoder m_parameterSetManagerDecoder;  // storage for parameter sets
     77  ParameterSetManager     m_parameterSetManager;  // storage for parameter sets
    7878  TComSlice*              m_apcSlicePilot;
    7979
     
    152152  Int                     m_prevPicOrderCnt;
    153153#if CONFORMANCE_BITSTREAM_MODE
    154   Bool m_confModeFlag;
    155   std::vector<TComPic>   m_confListPic;         //  Dynamic buffer for storing pictures for conformance purposes
    156 #endif
    157   Bool m_isOutputLayerFlag;
     154  Bool                    m_confModeFlag;
     155  std::vector<TComPic>    m_confListPic;         //  Dynamic buffer for storing pictures for conformance purposes
     156#endif
     157  Bool                    m_isOutputLayerFlag;
    158158#endif //SVC_EXTENSION
    159159
    160160public:
    161161#if SVC_EXTENSION
    162   static Bool                    m_checkPocRestrictionsForCurrAu;
    163   static Int                     m_pocResetIdcOrCurrAu;
    164   static Bool                    m_baseLayerIdrFlag;
    165   static Bool                    m_baseLayerPicPresentFlag;
    166   static Bool                    m_baseLayerIrapFlag;
    167   static Bool                    m_nonBaseIdrPresentFlag;
    168   static Int                     m_nonBaseIdrType;
    169   static Bool                    m_picNonIdrWithRadlPresentFlag;
    170   static Bool                    m_picNonIdrNoLpPresentFlag;
    171   static Int                     m_crossLayerPocResetPeriodId;
    172   static Int                     m_crossLayerPocResetIdc;
     162  static Bool             m_checkPocRestrictionsForCurrAu;
     163  static Int              m_pocResetIdcOrCurrAu;
     164  static Bool             m_baseLayerIdrFlag;
     165  static Bool             m_baseLayerPicPresentFlag;
     166  static Bool             m_baseLayerIrapFlag;
     167  static Bool             m_nonBaseIdrPresentFlag;
     168  static Int              m_nonBaseIdrType;
     169  static Bool             m_picNonIdrWithRadlPresentFlag;
     170  static Bool             m_picNonIdrNoLpPresentFlag;
     171  static Int              m_crossLayerPocResetPeriodId;
     172  static Int              m_crossLayerPocResetIdc;
    173173#endif //SVC_EXTENSION
    174174
     
    189189 
    190190  Void  deletePicBuffer();
    191 
    192  
    193   TComSPS* getActiveSPS() { return m_parameterSetManagerDecoder.getActiveSPS(); }
    194 
    195191
    196192  Void  executeLoopFilters(Int& poc, TComList<TComPic*>*& rpcListPic);
     
    210206  Int       getParseIdc                     ()                              { return m_parseIdc;               }
    211207  Void      setParseIdc                     (Int x)                         { m_parseIdc = x;                  }
    212   Void      markAllPicsAsNoCurrAu           (TComVPS *vps);
     208  Void      markAllPicsAsNoCurrAu           ( const TComVPS *vps );
    213209
    214210  Int       getLastPocPeriodId              ()                              { return m_lastPocPeriodId;        }
     
    240236  Void      setNumMotionPredRefLayers       (Int num)                       { m_numMotionPredRefLayers = num;   }
    241237
    242   Void      setRefLayerParams( TComVPS* vps );
     238  Void      setRefLayerParams( const TComVPS* vps );
    243239
    244240#if AVC_BASE
     
    251247  Void      checkValueOfTargetOutputLayerSetIdx(TComVPS *vps);
    252248
    253   ParameterSetManagerDecoder* getParameterSetManager()                      { return &m_parameterSetManagerDecoder; }
     249  ParameterSetManager* getParameterSetManager()                             { return &m_parameterSetManager; }
    254250
    255251#if CONFORMANCE_BITSTREAM_MODE
    256252  std::vector<TComPic>* getConfListPic() {return &m_confListPic; }
    257   Bool const getConfModeFlag() { return m_confModeFlag; }
    258   Void setConfModeFlag(Bool x) { m_confModeFlag = x; }
     253  Bool      const getConfModeFlag() { return m_confModeFlag; }
     254  Void      setConfModeFlag(Bool x) { m_confModeFlag = x; }
    259255#endif
    260256#endif //SVC_EXTENSION
    261257
    262258protected:
    263   Void  xGetNewPicBuffer  (TComSlice* pcSlice, TComPic*& rpcPic);
    264   Void  xCreateLostPicture (Int iLostPOC);
     259#if SVC_EXTENSION
     260  Void      xGetNewPicBuffer  ( const TComVPS &vps, const TComSPS &sps, const TComPPS &pps, TComPic*& rpcPic, const UInt temporalLayer);
     261#else
     262  Void      xGetNewPicBuffer  (const TComSPS &sps, const TComPPS &pps, TComPic*& rpcPic, const UInt temporalLayer);
     263#endif
     264  Void      xCreateLostPicture (Int iLostPOC);
    265265
    266266  Void      xActivateParameterSets();
    267267#if SVC_EXTENSION
    268268  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC);
    269   Void      xSetSpatialEnhLayerFlag(TComSlice* slice, TComPic* pic);
     269  Void      xSetSpatialEnhLayerFlag( const TComVPS &vps, const TComSPS &sps, const TComPPS &pps, TComPic* pic );
    270270#else
    271271  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay);
    272272#endif
    273   Void      xDecodeVPS();
    274   Void      xDecodeSPS();
     273  Void      xDecodeVPS(const std::vector<UChar> *pNaluData);
     274  Void      xDecodeSPS(const std::vector<UChar> *pNaluData);
    275275#if CGS_3D_ASYMLUT
    276   Void      xDecodePPS( TCom3DAsymLUT * pc3DAsymLUT );
     276  Void      xDecodePPS(const std::vector<UChar> *pNaluData, TCom3DAsymLUT *pc3DAsymLUT);
    277277#else
    278   Void      xDecodePPS();
     278  Void      xDecodePPS(const std::vector<UChar> *pNaluData);
    279279#endif
    280280  Void      xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType );
     
    282282#if SVC_EXTENSION
    283283#if NO_CLRAS_OUTPUT_FLAG
    284   Int  getNoClrasOutputFlag()                { return m_noClrasOutputFlag;}
    285   Void setNoClrasOutputFlag(Bool x)          { m_noClrasOutputFlag = x;   }
    286   Int  getLayerInitializedFlag()             { return m_layerInitializedFlag;}
    287   Void setLayerInitializedFlag(Bool x)       { m_layerInitializedFlag = x;   }
    288   Int  getFirstPicInLayerDecodedFlag()       { return m_firstPicInLayerDecodedFlag;}
    289   Void setFirstPicInLayerDecodedFlag(Bool x) { m_firstPicInLayerDecodedFlag = x;   }
     284  Int       getNoClrasOutputFlag()                { return m_noClrasOutputFlag;}
     285  Void      setNoClrasOutputFlag(Bool x)          { m_noClrasOutputFlag = x;   }
     286  Int       getLayerInitializedFlag()             { return m_layerInitializedFlag;}
     287  Void      setLayerInitializedFlag(Bool x)       { m_layerInitializedFlag = x;   }
     288  Int       getFirstPicInLayerDecodedFlag()       { return m_firstPicInLayerDecodedFlag;}
     289  Void      setFirstPicInLayerDecodedFlag(Bool x) { m_firstPicInLayerDecodedFlag = x;   }
    290290#endif
    291291#if CGS_3D_ASYMLUT
    292   Void initAsymLut(TComSlice *pcSlice);
    293 #endif
    294   Void resetPocRestrictionCheckParameters();
    295   Void xCheckLayerReset();
    296   Void xSetNoRaslOutputFlag();
    297   Void xSetLayerInitializedFlag();
     292  Void     initAsymLut(TComSlice *pcSlice);
     293#endif
     294  Void     resetPocRestrictionCheckParameters();
     295  Void     xCheckLayerReset();
     296  Void     xSetNoRaslOutputFlag();
     297  Void     xSetLayerInitializedFlag();
    298298#endif
    299299};// END CLASS DEFINITION TDecTop
Note: See TracChangeset for help on using the changeset viewer.