Changeset 865 in SHVCSoftware


Ignore:
Timestamp:
13 Aug 2014, 01:39:59 (10 years ago)
Author:
qualcomm
Message:

Derivation of NecessaryLayerFlag (Macro: NECESSARY_LAYER_FLAG)

Derive NecessaryLayerFlag and check the condition specified w.r.t that flag.

From: Adarsh K. Ramasubramonian <aramasub@…>

Location:
branches/SHM-dev/source
Files:
6 edited

Legend:

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

    r864 r865  
    14551455    for( Int olsCtr = 0; olsCtr < vps->getNumLayerSets(); olsCtr ++ ) // Default output layer sets
    14561456    {
    1457       vps->setOutputLayerSetIdx(i, i);
     1457      vps->setOutputLayerSetIdx(olsCtr, olsCtr);
    14581458    }
    14591459    for( Int olsCtr = vps->getNumLayerSets(); olsCtr < vps->getNumOutputLayerSets(); olsCtr ++ )  // Non-default output layer sets
    14601460    {
    1461       vps->setOutputLayerSetIdx(i, m_outputLayerSetIdx[olsCtr - vps->getNumLayerSets()]);
     1461      vps->setOutputLayerSetIdx(olsCtr, m_outputLayerSetIdx[olsCtr - vps->getNumLayerSets()]);
    14621462    }
    14631463  }
     
    15511551  }
    15521552#endif
    1553 
     1553#if NECESSARY_LAYER_FLAG
     1554  vps->deriveNecessaryLayerFlag();
     1555  vps->checkNecessaryLayerFlagCondition();
     1556#endif
    15541557  // Initialize dpb_size_table() for all ouput layer sets in the VPS extension
    15551558  for(i = 1; i < vps->getNumOutputLayerSets(); i++)
  • branches/SHM-dev/source/Lib/TLibCommon/TComSlice.cpp

    r850 r865  
    3636*/
    3737
     38#include <numeric>
    3839#include "CommonDef.h"
    3940#include "TComSlice.h"
     
    24392440  ::memset(m_directDependencyType, 0, sizeof(m_directDependencyType));
    24402441#endif
     2442#if !NECESSARY_LAYER_FLAG
    24412443#if DERIVE_LAYER_ID_LIST_VARIABLES
    24422444  ::memset(m_layerSetLayerIdList,  0, sizeof(m_layerSetLayerIdList));
    24432445  ::memset(m_numLayerInIdList,     0, sizeof(m_numLayerInIdList   ));
     2446#endif
    24442447#endif
    24452448  ::memset(m_profileLevelTierIdx,  0, sizeof(m_profileLevelTierIdx));
     
    25622565{
    25632566  // For layer 0
     2567#if NECESSARY_LAYER_FLAG
     2568  m_numLayerInIdList.push_back(1);
     2569  m_layerSetLayerIdList.resize(m_numLayerSets);
     2570  m_layerSetLayerIdList[0].push_back(0);
     2571#else
    25642572  m_numLayerInIdList[0] = 1;
    25652573  m_layerSetLayerIdList[0][0] = 0;
     2574#endif
    25662575 
    25672576  // For other layers
     
    25742583      if( m_layerIdIncludedFlag[i][m] )
    25752584      {
     2585#if NECESSARY_LAYER_FLAG
     2586        m_layerSetLayerIdList[i].push_back(m);
     2587#else
    25762588        m_layerSetLayerIdList[i][n++] = m;
    2577       }
    2578     }
     2589#endif
     2590      }
     2591    }
     2592#if NECESSARY_LAYER_FLAG
     2593    m_numLayerInIdList.push_back(m_layerSetLayerIdList[i].size());
     2594#else
    25792595    m_numLayerInIdList[i] = n;
     2596#endif
    25802597  }
    25812598}
     
    29933010      hrd->setCbrFlag( i, j, 1, ( j == 0 ) );
    29943011    }
     3012  }
     3013}
     3014#endif
     3015#if NECESSARY_LAYER_FLAG
     3016Void TComVPS::deriveNecessaryLayerFlag()
     3017{
     3018  m_necessaryLayerFlag.empty();
     3019  m_numNecessaryLayers.empty();
     3020  // Assumed that output layer sets and variables RecursiveRefLayer are already derived
     3021  for( Int olsIdx = 0; olsIdx < getNumOutputLayerSets(); olsIdx++)
     3022  {
     3023    deriveNecessaryLayerFlag(olsIdx);
     3024  }
     3025}
     3026Void TComVPS::deriveNecessaryLayerFlag(Int const olsIdx)
     3027{
     3028  Int lsIdx = this->getOutputLayerSetIdx( olsIdx );
     3029  Int numLayersInLs = this->getNumLayersInIdList( lsIdx );
     3030  assert( m_necessaryLayerFlag.size() == olsIdx );   // Function should be called in the correct order.
     3031  m_necessaryLayerFlag.push_back( std::vector<Bool>( numLayersInLs, false ) ); // Initialize to false
     3032  for( Int lsLayerIdx = 0; lsLayerIdx < numLayersInLs; lsLayerIdx++ )
     3033  {
     3034    if( this->m_outputLayerFlag[olsIdx][lsLayerIdx] )
     3035    {
     3036      m_necessaryLayerFlag[olsIdx][lsLayerIdx] = true;
     3037      Int currNuhLayerId = this->m_layerSetLayerIdList[lsIdx][lsLayerIdx];
     3038      for( Int rLsLayerIdx = 0; rLsLayerIdx < lsLayerIdx; rLsLayerIdx++ )
     3039      {
     3040        Int refNuhLayerId = this->m_layerSetLayerIdList[lsIdx][rLsLayerIdx];
     3041        if( this->m_recursiveRefLayerFlag[currNuhLayerId][refNuhLayerId] )
     3042        {
     3043          m_necessaryLayerFlag[olsIdx][rLsLayerIdx] = true;
     3044        }
     3045      }
     3046    }
     3047  }
     3048  m_numNecessaryLayers.push_back(std::accumulate(m_necessaryLayerFlag[olsIdx].begin(), m_necessaryLayerFlag[olsIdx].end(), 0));
     3049}
     3050Void TComVPS::checkNecessaryLayerFlagCondition()
     3051{
     3052  /* It is a requirement of bitstream conformance that for each layer index layerIdx in the range of
     3053  ( vps_base_layer_internal_flag ? 0 : 1 ) to MaxLayersMinus1, inclusive, there shall be at least one OLS with index olsIdx such that
     3054  NecessaryLayerFlag[ olsIdx ][ lsLayerIdx ] is equal to 1 for the value of lsLayerIdx
     3055  for which LayerSetLayerIdList[ OlsIdxToLsIdx[ olsIdx ] ][ lsLayerIdx ] is equal to layer_id_in_nuh[ layerIdx ]. */
     3056  for(Int layerIdx = this->getBaseLayerInternalFlag() ? 0 : 1; layerIdx < this->getMaxLayers(); layerIdx++)
     3057  {
     3058    Bool layerFoundNecessaryLayerFlag = false;
     3059    for(Int olsIdx = 0; olsIdx < this->getNumOutputLayerSets(); olsIdx++)
     3060    {
     3061      Int lsIdx = this->getOutputLayerSetIdx( olsIdx );
     3062      Int currNuhLayerId = this->getLayerIdInNuh( layerIdx );
     3063      std::vector<Int>::iterator iter = std::find( m_layerSetLayerIdList[lsIdx].begin(), m_layerSetLayerIdList[lsIdx].end(), currNuhLayerId );
     3064      if( iter != m_layerSetLayerIdList[lsIdx].end() ) // Layer present in layer set
     3065      {
     3066        size_t positionLayer = iter - m_layerSetLayerIdList[lsIdx].begin();
     3067        if( *(m_necessaryLayerFlag[olsIdx].begin() + positionLayer) == true )
     3068        {
     3069          layerFoundNecessaryLayerFlag = true;
     3070          break;
     3071        }
     3072      }
     3073    }
     3074    assert( layerFoundNecessaryLayerFlag );
    29953075  }
    29963076}
  • branches/SHM-dev/source/Lib/TLibCommon/TComSlice.h

    r851 r865  
    489489#if DERIVE_LAYER_ID_LIST_VARIABLES
    490490#if Q0078_ADD_LAYER_SETS
     491#if NECESSARY_LAYER_FLAG
     492  std::vector< std::vector<Int> >     m_layerSetLayerIdList;
     493  std::vector<Int>                      m_numLayerInIdList;;
     494#else
    491495  Int         m_layerSetLayerIdList[MAX_VPS_LAYER_SETS_PLUS1 + MAX_NUM_ADD_LAYER_SETS][MAX_VPS_LAYER_ID_PLUS1];
    492496  Int         m_numLayerInIdList[MAX_VPS_LAYER_SETS_PLUS1 + MAX_NUM_ADD_LAYER_SETS];
     497#endif
    493498#else
    494499  Int         m_layerSetLayerIdList[MAX_VPS_LAYER_SETS_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
     
    747752#if RESOLUTION_BASED_DPB
    748753  Int        m_subDpbAssigned            [MAX_VPS_LAYER_SETS_PLUS1][MAX_LAYERS];
     754#endif
     755#if NECESSARY_LAYER_FLAG
     756  std::vector< std::vector<Bool> > m_necessaryLayerFlag;
     757  std::vector<Int>               m_numNecessaryLayers;
    749758#endif
    750759#endif //SVC_EXTENSION
     
    12161225  Void setBspHrdParameters( UInt hrdIdx, UInt frameRate, UInt numDU, UInt bitRate, Bool randomAccess );
    12171226#endif
     1227#if NECESSARY_LAYER_FLAG
     1228  Void  deriveNecessaryLayerFlag();
     1229  Void  deriveNecessaryLayerFlag(Int const olsIdx);
     1230  Void  checkNecessaryLayerFlagCondition();
     1231#endif
    12181232#endif //SVC_EXTENSION
    12191233};
  • branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h

    r864 r865  
    5656#if PTL_SIGNALLING
    5757#define LIST_OF_PTL                      1      ///< JCTVC-R0272: Signalling the PTL for the 0-th OLS
     58#define NECESSARY_LAYER_FLAG                   1      ////< Derivation of NecessaryLayerFlag
    5859#endif
    5960#define O0137_MAX_LAYERID                1      ///< JCTVC-O0137, JCTVC-O0200, JCTVC-O0223: restrict nuh_layer_id and vps_max_layers_minus1
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r864 r865  
    14671467#endif
    14681468  vps->setNumOutputLayerSets( numOutputLayerSets );
    1469 
     1469#if NECESSARY_LAYER_FLAG
     1470  // Default output layer set
     1471  vps->setOutputLayerSetIdx(0, 0);
     1472  vps->setOutputLayerFlag(0, 0, true);
     1473  vps->deriveNecessaryLayerFlag(0);
     1474#endif
    14701475  for(i = 1; i < numOutputLayerSets; i++)
    14711476  {
     
    15191524      }
    15201525    }
     1526#if NECESSARY_LAYER_FLAG
     1527    vps->deriveNecessaryLayerFlag(i); 
     1528#endif
    15211529    Int numBits = 1;
    15221530    while ((1 << numBits) < (vps->getNumProfileTierLevel()))
     
    15471555#endif
    15481556  }
     1557#if NECESSARY_LAYER_FLAG
     1558  vps->checkNecessaryLayerFlagCondition(); 
     1559#endif
    15491560#else
    15501561  if( numOutputLayerSets > 1 )
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp

    r864 r865  
    831831    }
    832832  }
     833#if !NECESSARY_FLAG   // Already called once in TAppEncTop.cpp
    833834#if DERIVE_LAYER_ID_LIST_VARIABLES
    834835  pcVPS->deriveLayerIdListVariables();
     836#endif
    835837#endif
    836838  TimingInfo *timingInfo = pcVPS->getTimingInfo();
Note: See TracChangeset for help on using the changeset viewer.