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@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified 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//! \}
Note: See TracChangeset for help on using the changeset viewer.