Changeset 861 in SHVCSoftware


Ignore:
Timestamp:
12 Aug 2014, 00:51:17 (10 years ago)
Author:
qualcomm
Message:

Support for specifying output layer sets in the configuration file at encoder. (Macro: OUTPUT_LAYER_SETS_CONFIG)

From: Adarsh K. Ramasubramonian <aramasub@…>

Location:
branches/SHM-dev
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/cfg/layers.cfg

    r815 r861  
    4343
    4444
    45 NumLayerSets                  : 1
    46 NumLayerInIdList0             : 2
    47 LayerSetLayerIdList0          : 0 1
     45NumLayerSets                  : 2                       # Include default layer set, value of 0 not allowed
     46NumLayerInIdList1             : 2                       # 0-th layer set is default, need not specify LayerSetLayerIdList0 or NumLayerInIdList0
     47LayerSetLayerIdList1          : 0 1
    4848
    4949NumAddLayerSets               : 0
     50NumOutputLayerSets            : 2                       # Include defualt OLS, value of 0 not allowed
     51DefaultTargetOutputLayerIdc   : 1
     52NumLayersInOutputLayerSet     : 1                       # The number of layers in the 0-th OLS should not be specified,
     53                                                        # ListOfOutputLayers0 need not be specified
     54ListOfOutputLayers1           : 1                       
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.cpp

    r860 r861  
    7272, m_scalingListFile()
    7373, m_elRapSliceBEnabled(0)
     74#if OUTPUT_LAYER_SETS_CONFIG
     75, m_defaultTargetOutputLayerIdc (-1)
     76, m_numOutputLayerSets          (-1)
     77#endif
    7478{
    7579  for(UInt layer=0; layer<MAX_LAYERS; layer++)
     
    580584  }
    581585#endif
     586#if OUTPUT_LAYER_SETS_CONFIG
     587  string* cfg_numLayersInOutputLayerSet = new string;
     588  string* cfg_listOfOutputLayers     = new string[MAX_VPS_OUTPUT_LAYER_SETS_PLUS1];
     589  string* cfg_outputLayerSetIdx      = new string;
     590#endif
    582591#if AVC_BASE
    583592  string  cfg_BLInputFile;
     
    636645  ("NumLayers",               m_numLayers, 1, "Number of layers to code")
    637646#if Q0078_ADD_LAYER_SETS
     647#if OUTPUT_LAYER_SETS_CONFIG
     648  ("NumLayerSets",            m_numLayerSets, 1, "Number of layer sets")
     649#else
    638650  ("NumLayerSets",            m_numLayerSets, 0, "Number of layer sets")
     651#endif
    639652  ("NumLayerInIdList%d",      cfg_numLayerInIdList, 0, MAX_VPS_LAYER_ID_PLUS1, "Number of layers in the set")
    640653  ("LayerSetLayerIdList%d",   cfg_layerSetLayerIdListPtr, string(""), MAX_VPS_LAYER_ID_PLUS1, "Layer IDs for the set")
     
    642655  ("NumHighestLayerIdx%d",    cfg_numHighestLayerIdx, 0, MAX_VPS_LAYER_ID_PLUS1, "Number of highest layer idx")
    643656  ("HighestLayerIdx%d",       cfg_highestLayerIdxPtr, string(""), MAX_VPS_LAYER_ID_PLUS1, "Highest layer idx for an additional layer set")
     657#endif
     658#if OUTPUT_LAYER_SETS_CONFIG
     659  ("DefaultTargetOutputLayerIdc",    m_defaultTargetOutputLayerIdc, 1, "Default target output layers. 0: All layers are output layer, 1: Only highest layer is output layer, 2 or 3: No default output layers")
     660  ("NumOutputLayerSets",            m_numOutputLayerSets, 1, "Number of output layer sets excluding the 0-th output layer set")
     661  ("NumLayersInOutputLayerSet",   cfg_numLayersInOutputLayerSet, string(""), 1 , "List containing number of output layers in the output layer sets")
     662  ("ListOfOutputLayers%d",          cfg_listOfOutputLayers, string(""), MAX_VPS_LAYER_ID_PLUS1, "Layer IDs for the set, in terms of layer ID in the output layer set Range: [0..NumLayersInOutputLayerSet-1]")
     663  ("OutputLayerSetIdx",            cfg_outputLayerSetIdx, string(""), 1, "Corresponding layer set index, only for non-default output layer sets")
    644664#endif
    645665#if AUXILIARY_PICTURES
     
    17011721#endif
    17021722#if Q0078_ADD_LAYER_SETS
     1723#if OUTPUT_LAYER_SETS_CONFIG
     1724  for (Int layerSet = 1; layerSet < m_numLayerSets; layerSet++)
     1725  {
     1726    // Simplifying the code in the #else section, and allowing 0-th layer set t
     1727    assert( scanStringToArray( cfg_layerSetLayerIdList[layerSet], m_numLayerInIdList[layerSet], "NumLayerInIdList", m_layerSetLayerIdList[layerSet] ) );
     1728#else
    17031729  for (Int layerSet = 0; layerSet < m_numLayerSets; layerSet++)
    17041730  {
     
    17261752      }
    17271753    }
     1754#endif
    17281755  }
    17291756  for (Int addLayerSet = 0; addLayerSet < m_numAddLayerSets; addLayerSet++)
    17301757  {
     1758#if OUTPUT_LAYER_SETS_CONFIG
     1759    // Simplifying the code in the #else section
     1760    assert( scanStringToArray( cfg_layerSetLayerIdList[addLayerSet], m_numLayerInIdList[addLayerSet], "NumLayerInIdList",  m_highestLayerIdx[addLayerSet] ) );
     1761#else
    17311762    if (m_numHighestLayerIdx[addLayerSet] > 0)
    17321763    {
     
    17521783      }
    17531784    }
    1754   }
     1785#endif
     1786  }
     1787#endif
     1788#if OUTPUT_LAYER_SETS_CONFIG
     1789  if( m_defaultTargetOutputLayerIdc != -1 )
     1790  {
     1791    assert( m_defaultTargetOutputLayerIdc >= 0 && m_defaultTargetOutputLayerIdc <= 3 );
     1792  }
     1793  assert( m_numOutputLayerSets != 0 );
     1794  assert( m_numOutputLayerSets >= m_numLayerSets + m_numAddLayerSets ); // Number of output layer sets must be at least as many as layer sets.
     1795
     1796  Int *tempArray = NULL;
     1797 
     1798  // If output layer Set Idx is specified, only specify it for the non-default output layer sets
     1799  Int numNonDefaultOls = m_numOutputLayerSets - (m_numLayerSets + m_numAddLayerSets);
     1800  if( numNonDefaultOls )
     1801  {
     1802    assert( scanStringToArray( *cfg_outputLayerSetIdx, numNonDefaultOls, "OutputLayerSetIdx", m_outputLayerSetIdx ) );
     1803    for(Int i = 0; i < numNonDefaultOls; i++)
     1804    {
     1805      assert( m_outputLayerSetIdx[i] >= 0 && m_outputLayerSetIdx[i] < (m_numLayerSets + m_numAddLayerSets) );
     1806    }
     1807  }
     1808
     1809  // Number of output layers in output layer sets
     1810  Bool readStringFlag = scanStringToArray( *cfg_numLayersInOutputLayerSet, m_numOutputLayerSets - 1, "NumLayersInOutputLayerSets", m_numLayersInOutputLayerSet );
     1811  m_numLayersInOutputLayerSet.insert(m_numLayersInOutputLayerSet.begin(), 1);
     1812  // Layers in the output layer set
     1813  m_listOfOutputLayers.resize(m_numOutputLayerSets);
     1814  Int startOlsCtr = 1;
     1815  if( m_defaultTargetOutputLayerIdc == 0 || m_defaultTargetOutputLayerIdc == 1 )
     1816  {
     1817    // Default output layer sets defined
     1818    startOlsCtr = m_numLayerSets + m_numAddLayerSets;
     1819  }
     1820  for( Int olsCtr = 1; olsCtr < m_numOutputLayerSets; olsCtr++ )
     1821  {
     1822    if( olsCtr < startOlsCtr )
     1823    {
     1824      if(scanStringToArray( cfg_listOfOutputLayers[olsCtr], m_numLayersInOutputLayerSet[olsCtr], "ListOfOutputLayers", m_listOfOutputLayers[olsCtr] ) )
     1825      {
     1826        std::cout << "Default OLS defined. Ignoring ListOfOutputLayers" << olsCtr << endl;
     1827      }
     1828    }
     1829    else
     1830    {
     1831      assert( scanStringToArray( cfg_listOfOutputLayers[olsCtr], m_numLayersInOutputLayerSet[olsCtr], "ListOfOutputLayers", m_listOfOutputLayers[olsCtr] ) );
     1832    }
     1833  }
     1834  delete cfg_numLayersInOutputLayerSet;
     1835  delete [] cfg_listOfOutputLayers;
     1836  delete cfg_outputLayerSetIdx;
    17551837#endif
    17561838#endif //SVC_EXTENSION
     
    36703752
    36713753#if SVC_EXTENSION
     3754#if OUTPUT_LAYER_SETS_CONFIG
     3755Void TAppEncCfg::cfgStringToArray(Int **arr, string const cfgString, Int const numEntries, const char* logString)
     3756#else
    36723757Void TAppEncCfg::cfgStringToArray(Int **arr, string cfgString, Int numEntries, const char* logString)
     3758#endif
    36733759{
    36743760  Char *tempChar = cfgString.empty() ? NULL : strdup(cfgString.c_str());
     
    36793765    *arr = new Int[numEntries];
    36803766
     3767#if OUTPUT_LAYER_SETS_CONFIG
     3768    if( tempChar == NULL )
     3769    {
     3770      arrayEntry = NULL;
     3771    }
     3772    else
     3773    {
     3774      arrayEntry = strtok( tempChar, " ,");
     3775    }
     3776#else
    36813777    arrayEntry = strtok( tempChar, " ,");
     3778#endif
    36823779    while(arrayEntry != NULL)
    36833780    {
     
    37093806}
    37103807
     3808#if OUTPUT_LAYER_SETS_CONFIG
     3809Bool TAppEncCfg::scanStringToArray(string const cfgString, Int const numEntries, const char* logString, Int * const returnArray)
     3810{
     3811  Int *tempArray = NULL;
     3812  // For all layer sets
     3813  cfgStringToArray( &tempArray, cfgString, numEntries, logString );
     3814  if(tempArray)
     3815  {
     3816    for(Int i = 0; i < numEntries; i++)
     3817    {
     3818      returnArray[i] = tempArray[i];
     3819    }
     3820    delete [] tempArray; tempArray = NULL;
     3821    return true;
     3822  }
     3823  return false;
     3824}
     3825Bool TAppEncCfg::scanStringToArray(string const cfgString, Int const numEntries, const char* logString, std::vector<Int> & returnVector)
     3826{
     3827  Int *tempArray = NULL;
     3828  // For all layer sets
     3829  cfgStringToArray( &tempArray, cfgString, numEntries, logString );
     3830  if(tempArray)
     3831  {
     3832    returnVector.empty();
     3833    for(Int i = 0; i < numEntries; i++)
     3834    {
     3835      returnVector.push_back(tempArray[i]);
     3836    }
     3837    delete [] tempArray; tempArray = NULL;
     3838    return true;
     3839  }
     3840  return false;
     3841}
     3842#endif
    37113843#endif //SVC_EXTENSION
    37123844//! \}
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.h

    r856 r861  
    7979  Int       m_numHighestLayerIdx[MAX_VPS_LAYER_SETS_PLUS1];
    8080  Int       m_highestLayerIdx[MAX_VPS_LAYER_SETS_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
     81#endif
     82#if OUTPUT_LAYER_SETS_CONFIG
     83  std::vector<Int>                m_outputLayerSetIdx;
     84  Int       m_defaultTargetOutputLayerIdc;
     85  Int       m_numOutputLayerSets;
     86  std::vector<Int>                m_numLayersInOutputLayerSet;
     87  std::vector< std::vector<Int> > m_listOfOutputLayers;
    8188#endif
    8289#else
     
    488495  Int  getWaveFrontSynchro()        { return m_iWaveFrontSynchro; }
    489496  Void getDirFilename(string& filename, string& dir, const string path);
     497#if OUTPUT_LAYER_SETS_CONFIG
     498  Bool scanStringToArray(string const cfgString, Int const numEntries, const char* logString, Int * const returnArray);
     499  Bool scanStringToArray(string const cfgString, Int const numEntries, const char* logString, std::vector<Int> &  returnVector);
     500  Void cfgStringToArray(Int **arr, string const cfgString, Int const numEntries, const char* logString);
     501#else
    490502  Void cfgStringToArray(Int **arr, string cfgString, Int numEntries, const char* logString);
     503#endif
    491504#if REPN_FORMAT_IN_VPS
    492505  RepFormatCfg* getRepFormatCfg(Int i)  { return &m_repFormatCfg[i]; }
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r856 r861  
    11421142
    11431143#if Q0078_ADD_LAYER_SETS
     1144#if OUTPUT_LAYER_SETS_CONFIG
     1145  if (m_numLayerSets > 1)
     1146  {
     1147    vps->setNumLayerSets(m_numLayerSets);
     1148#else
    11441149  if (m_numLayerSets > 0)
    11451150  {
    11461151    vps->setNumLayerSets(m_numLayerSets+1);
     1152#endif
    11471153    for (Int setId = 1; setId < vps->getNumLayerSets(); setId++)
    11481154    {
     
    11541160    for (Int setId = 1; setId < vps->getNumLayerSets(); setId++)
    11551161    {
     1162#if OUTPUT_LAYER_SETS_CONFIG
     1163      for (Int i = 0; i < m_numLayerInIdList[setId]; i++)
     1164      {
     1165        Int layerId = m_layerSetLayerIdList[setId][i];
     1166#else
    11561167      for (Int i = 0; i < m_numLayerInIdList[setId-1]; i++)
    11571168      {
    11581169        Int layerId = m_layerSetLayerIdList[setId-1][i];
    1159 
     1170#endif
    11601171#if O0194_DIFFERENT_BITDEPTH_EL_BL
    11611172        //4
     
    14031414#endif
    14041415#endif
     1416#if OUTPUT_LAYER_SETS_CONFIG
     1417
     1418  vps->setDefaultTargetOutputLayerIdc( m_defaultTargetOutputLayerIdc ); // As per configuration file
     1419
     1420  if( m_numOutputLayerSets == -1 )  // # of output layer sets not specified in the configuration file
     1421  {
     1422    vps->setNumOutputLayerSets(vps->getNumLayerSets());
     1423
     1424    for(i = 1; i < vps->getNumLayerSets(); i++)
     1425    {
     1426        vps->setOutputLayerSetIdx(i, i);
     1427    }
     1428  }
     1429  else
     1430  {
     1431    vps->setNumOutputLayerSets( m_numOutputLayerSets );
     1432    for( Int olsCtr = 0; olsCtr < vps->getNumLayerSets(); olsCtr ++ ) // Default output layer sets
     1433    {
     1434      vps->setOutputLayerSetIdx(i, i);
     1435    }
     1436    for( Int olsCtr = vps->getNumLayerSets(); olsCtr < vps->getNumOutputLayerSets(); olsCtr ++ )  // Non-default output layer sets
     1437    {
     1438      vps->setOutputLayerSetIdx(i, m_outputLayerSetIdx[olsCtr - vps->getNumLayerSets()]);
     1439    }
     1440  }
     1441#endif
    14051442  // Target output layer
    14061443  vps->setNumOutputLayerSets(vps->getNumLayerSets());
    14071444  vps->setNumProfileTierLevel(vps->getNumLayerSets());
     1445#if !OUTPUT_LAYER_SETS_CONFIG // Taken care by configuration file parameter
    14081446#if P0295_DEFAULT_OUT_LAYER_IDC
    14091447  vps->setDefaultTargetOutputLayerIdc(1);
     
    14151453#endif
    14161454#endif
     1455#endif
    14171456  for(i = 1; i < vps->getNumLayerSets(); i++)
    14181457  {
    14191458    vps->setProfileLevelTierIdx(i, i);
     1459#if !OUTPUT_LAYER_SETS_CONFIG
    14201460    vps->setOutputLayerSetIdx(i, i);
     1461#endif
    14211462  } 
    14221463#endif
     
    14331474
    14341475  // derive OutputLayerFlag[i][j]
     1476#if !OUTPUT_LAYER_SETS_CONFIG
    14351477  if( vps->getDefaultTargetOutputLayerIdc() == 1 )
     1478#endif
    14361479  {
    14371480    // default_output_layer_idc equal to 1 specifies that only the layer with the highest value of nuh_layer_id such that nuh_layer_id equal to nuhLayerIdA and
     
    14461489        if( vps->getLayerIdIncludedFlag(lsIdx, layer) )     
    14471490#endif
    1448         {       
     1491        {
     1492#if OUTPUT_LAYER_SETS_CONFIG
     1493          switch(vps->getDefaultTargetOutputLayerIdc())
     1494          {
     1495            case 0: vps->setOutputLayerFlag( lsIdx, layer, 1 );
     1496              break;
     1497            case 1: vps->setOutputLayerFlag( lsIdx, layer, layer == vps->getNumLayersInIdList(lsIdx) - 1 );
     1498              break;
     1499            case 2:
     1500            case 3: vps->setOutputLayerFlag( lsIdx, layer, std::find( m_listOfOutputLayers[lsIdx].begin(), m_listOfOutputLayers[lsIdx].end(), layer) != m_listOfOutputLayers[lsIdx].end() );
     1501              break;
     1502          }
     1503#else
    14491504          vps->setOutputLayerFlag( lsIdx, layer, layer == vps->getNumLayersInIdList(lsIdx) - 1 );
     1505#endif
    14501506        }
    14511507      }
    14521508    }
    1453   }
     1509#if OUTPUT_LAYER_SETS_CONFIG
     1510    for( Int olsIdx = vps->getNumLayerSets(); olsIdx < vps->getNumOutputLayerSets(); olsIdx++ )
     1511    {
     1512      for( UInt layer = 0; layer < vps->getNumLayersInIdList(vps->getOutputLayerSetIdx(olsIdx)); layer++ )
     1513      {
     1514        vps->setOutputLayerFlag( olsIdx, layer, std::find( m_listOfOutputLayers[olsIdx].begin(), m_listOfOutputLayers[olsIdx].end(), layer) != m_listOfOutputLayers[olsIdx].end());
     1515      }
     1516    }
     1517#endif
     1518  }
     1519#if !OUTPUT_LAYER_SETS_CONFIG
    14541520  else
    14551521  {
     
    14571523    assert(!"default_output_layer_idc not equal to 1 is not yet supported");
    14581524  }
     1525#endif
    14591526
    14601527  // Initialize dpb_size_table() for all ouput layer sets in the VPS extension
  • branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h

    r856 r861  
    5151#define POC_RESET_RESTRICTIONS           1      ///< Restrictions on semantics of POC reset-related syntax elements, including one item from R0223
    5252#define POC_RESET_VALUE_RESTRICTION      1      ///< R0223: Restriction on the value of full_poc_reset_flag
     53#define OUTPUT_LAYER_SETS_CONFIG         1
    5354#define O0137_MAX_LAYERID                1      ///< JCTVC-O0137, JCTVC-O0200, JCTVC-O0223: restrict nuh_layer_id and vps_max_layers_minus1
    5455
     
    323324#define MAX_VPS_OP_LAYER_SETS_PLUS1               (MAX_LAYERS+1)
    324325#define MAX_VPS_LAYER_SETS_PLUS1                  1024
     326#define MAX_VPS_OUTPUT_LAYER_SETS_PLUS1           1024
    325327#define MAX_VPS_LAYER_ID_PLUS1                    MAX_LAYERS
    326328#else
Note: See TracChangeset for help on using the changeset viewer.