Changeset 738 in 3DVCSoftware for trunk/source/Lib/TLibDecoder/TDecTop.cpp


Ignore:
Timestamp:
10 Dec 2013, 13:50:12 (11 years ago)
Author:
tech
Message:

Merged HTM-9.0-dev0@731. (MV-HEVC 6 HLS)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibDecoder/TDecTop.cpp

    r724 r738  
    635635#if H_MV
    636636  m_apcSlicePilot->setVPS(vps); 
     637#if H_MV_6_PS_0092_17
     638  // The nuh_layer_id value of the NAL unit containing the PPS that is activated for a layer layerA with nuh_layer_id equal to nuhLayerIdA shall be equal to 0, or nuhLayerIdA, or the nuh_layer_id of a direct or indirect reference layer of layerA.
     639  assert( pps->getLayerId() == m_layerId || pps->getLayerId( ) == 0 || vps->getInDirectDependencyFlag( m_layerId, pps->getLayerId() ) );   
     640  // The nuh_layer_id value of the NAL unit containing the SPS that is activated for a layer layerA with nuh_layer_id equal to nuhLayerIdA shall be equal to 0, or nuhLayerIdA, or the nuh_layer_id of a direct or indirect reference layer of layerA.
     641  assert( sps->getLayerId() == m_layerId || sps->getLayerId( ) == 0 || vps->getInDirectDependencyFlag( m_layerId, sps->getLayerId() ) );
     642#endif
    637643  sps->inferRepFormat  ( vps , m_layerId );
    638644  sps->inferScalingList( m_parameterSetManagerDecoder.getActiveSPS( sps->getSpsScalingListRefLayerId() ) );
     
    665671
    666672#if H_MV
     673#if H_MV_FIX_SKIP_PICTURES
     674Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, Bool newLayerFlag, Bool& sliceSkippedFlag  )
     675#else
    667676Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, Bool newLayerFlag )
     677#endif
    668678{
    669679  assert( nalu.m_layerId == m_layerId );
     
    722732#endif
    723733#endif
     734
     735#if H_MV_LAYER_WISE_STARTUP
     736    xCeckNoClrasOutput();
     737#endif
    724738    // Skip pictures due to random access
    725739    if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay))
     
    727741    m_prevSliceSkipped = true;
    728742    m_skippedPOC = m_apcSlicePilot->getPOC();
     743#if H_MV_FIX_SKIP_PICTURES
     744      sliceSkippedFlag = true;
     745#endif
    729746      return false;
    730747    }
     
    734751    m_prevSliceSkipped = true;
    735752    m_skippedPOC = m_apcSlicePilot->getPOC();
     753#if H_MV_FIX_SKIP_PICTURES
     754      sliceSkippedFlag = true;
     755#endif
    736756      return false;
    737757    }
     
    11711191
    11721192#if H_MV
     1193#if H_MV_FIX_SKIP_PICTURES
     1194Bool TDecTop::decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, Bool newLayerFlag, Bool& sliceSkippedFlag )
     1195#else
    11731196Bool TDecTop::decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, Bool newLayerFlag)
     1197#endif
    11741198#else
    11751199Bool TDecTop::decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay)
     
    12161240    case NAL_UNIT_CODED_SLICE_RASL_R:
    12171241#if H_MV
     1242#if H_MV_FIX_SKIP_PICTURES
     1243      return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay, newLayerFlag, sliceSkippedFlag );
     1244#else
    12181245      return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay, newLayerFlag);
     1246#endif
    12191247#else
    12201248      return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay);
     
    12651293    return true;
    12661294  }
     1295#if H_MV_LAYER_WISE_STARTUP
     1296  else if ( !m_layerInitilizedFlag[ m_layerId ] ) // start of random access point, m_pocRandomAccess has not been set yet.
     1297#else
    12671298  else if (m_pocRandomAccess == MAX_INT) // start of random access point, m_pocRandomAccess has not been set yet.
     1299#endif
    12681300  {
    12691301    if (   m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA
     
    12721304        || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL )
    12731305    {
     1306
     1307#if H_MV_LAYER_WISE_STARTUP
     1308      if ( xAllRefLayersInitilized() )
     1309      {
     1310        m_layerInitilizedFlag[ m_layerId ] = true;
     1311        m_pocRandomAccess = m_apcSlicePilot->getPOC();
     1312      }
     1313      else
     1314      {
     1315        return true;
     1316      }
     1317#else
    12741318      // set the POC random access since we need to skip the reordered pictures in the case of CRA/CRANT/BLA/BLANT.
    12751319      m_pocRandomAccess = m_apcSlicePilot->getPOC();
     1320#endif
    12761321    }
    12771322    else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP )
    12781323    {
     1324#if H_MV_LAYER_WISE_STARTUP
     1325      if ( xAllRefLayersInitilized() )
     1326      {
     1327        m_layerInitilizedFlag[ m_layerId ] = true;
    12791328      m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable.
    12801329    }
    12811330    else
    12821331    {
     1332        return true;
     1333      }
     1334#else
     1335      m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable.
     1336#endif
     1337    }
     1338    else
     1339    {
     1340#if H_MV_FIX_SKIP_PICTURES
     1341      static Bool warningMessage[MAX_NUM_LAYERS];
     1342      static Bool warningInitFlag = false;
     1343     
     1344      if (!warningInitFlag)
     1345      {
     1346        for ( Int i = 0; i < MAX_NUM_LAYERS; i++)
     1347        {
     1348          warningMessage[i] = true;
     1349        }
     1350        warningInitFlag = true;
     1351      }
     1352
     1353      if ( warningMessage[getLayerId()] )
     1354      {
     1355        printf("\nLayer%3d   No valid random access point. VCL NAL units of this layer are discarded until next layer initialization picture. ", getLayerId() );
     1356        warningMessage[m_layerId] = false;
     1357      }
     1358#else
    12831359      static Bool warningMessage = false;
    12841360      if(!warningMessage)
     
    12871363        warningMessage = true;
    12881364      }
     1365#endif
    12891366      return true;
    12901367    }
     
    12961373    return true;
    12971374  }
     1375#if H_MV_LAYER_WISE_STARTUP
     1376  return !m_layerInitilizedFlag[ getLayerId() ];
     1377#else
    12981378  // if we reach here, then the picture is not skipped.
    12991379  return false;
     1380#endif
    13001381}
    13011382
     
    13381419  }
    13391420}
     1421
     1422#if H_MV_LAYER_WISE_STARTUP
     1423Void TDecTop::xCeckNoClrasOutput()
     1424{
     1425  // This part needs further testing!
     1426  if ( getLayerId() == 0 )
     1427  {   
     1428    NalUnitType nut = m_apcSlicePilot->getNalUnitType();
     1429
     1430    Bool isBLA =  ( nut == NAL_UNIT_CODED_SLICE_BLA_W_LP  )  || ( nut == NAL_UNIT_CODED_SLICE_BLA_N_LP ) || ( nut == NAL_UNIT_CODED_SLICE_BLA_W_RADL );
     1431    Bool isIDR  = ( nut == NAL_UNIT_CODED_SLICE_IDR_W_RADL ) || ( nut == NAL_UNIT_CODED_SLICE_IDR_N_LP );
     1432    Bool noClrasOutputFlag  = isBLA || ( isIDR  &&  m_apcSlicePilot->getCrossLayerBlaFlag() );
     1433
     1434    if ( noClrasOutputFlag )
     1435    {
     1436      for (Int i = 0; i < MAX_NUM_LAYER_IDS; i++)
     1437      {
     1438        m_layerInitilizedFlag[i] = false;
     1439      }
     1440    }
     1441  }
     1442}
     1443
     1444Bool TDecTop::xAllRefLayersInitilized()
     1445{
     1446  Bool allRefLayersInitilizedFlag = true;
     1447  TComVPS* vps = m_parameterSetManagerDecoder.getPrefetchedVPS( 0 );
     1448  for (Int i = 0; i < vps->getNumDirectRefLayers( getLayerId()  ); i++ )
     1449  {
     1450    Int refLayerId = vps->getRefLayerId( m_layerId, i );
     1451    allRefLayersInitilizedFlag = allRefLayersInitilizedFlag && m_layerInitilizedFlag[ refLayerId ];
     1452  }
     1453
     1454  return allRefLayersInitilizedFlag;
     1455}
     1456#endif
    13401457#endif
    13411458//! \}
Note: See TracChangeset for help on using the changeset viewer.