Ignore:
Timestamp:
24 Jun 2013, 16:01:58 (11 years ago)
Author:
tech
Message:

Added encoder parameters related to output layers.

Location:
branches/HTM-DEV-0.3-dev0/source/App/TAppEncoder
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-DEV-0.3-dev0/source/App/TAppEncoder/TAppEncCfg.cpp

    r491 r492  
    392392  ("LayerIdInNuh",          m_layerIdInNuh       , std::vector<Int>(1,0), "LayerId in Nuh")
    393393  ("SplittingFlag",         m_splittingFlag      , false                , "Splitting Flag")   
     394
     395  // Layer Sets + Output Layer Sets + Profile Tier Level
     396  ("VpsNumLayerSets",       m_vpsNumLayerSets    , 1                    , "Number of layer sets")   
     397  ("LayerIdsInSet_%d",      m_layerIdsInSets     , std::vector<Int>(1,0), MAX_VPS_OP_SETS_PLUS1 ,"LayerIds of Layer set") 
     398  ("DefaultOneTargetOutputLayerFlag", m_defaultOneTargetOutputLayerFlag,  false , "Output highest layer of layer sets by default")     
     399  ("OutputLayerSetIdx",     m_outputLayerSetIdx  , std::vector<Int>(1,0), "Indices of layer sets used as additional output layer sets") 
     400  ("LayerIdsInAddOutputLayerSet_%d", m_layerIdsInAddOutputLayerSet      , std::vector<Int>(1,0), MAX_VPS_ADD_OUTPUT_LAYER_SETS, "LayerIds of additional output layers") 
     401  ("ProfileLevelTierIdx",   m_profileLevelTierIdx, std::vector<Int>(1,0), "Indices to profile level tier")
    394402#endif
    395403  ("SourceWidth,-wdt",      m_iSourceWidth,        0, "Source picture width")
     
    12831291  xConfirmPara( m_layerIdInNuh[0] != 0      , "LayerIdInNuh must be 0 for the first layer. ");
    12841292  xConfirmPara( (m_layerIdInNuh.size()!=1) && (m_layerIdInNuh.size() < m_numberOfLayers) , "LayerIdInNuh must be given for all layers. ");
    1285  
     1293
    12861294#if H_3D
    12871295  xConfirmPara( m_scalabilityMask != 1 && m_scalabilityMask != 3, "Scalability Mask must be equal to 1 or 3. ");
     
    12891297  xConfirmPara( m_scalabilityMask != 1 , "Scalability Mask must be equal to 1. ");
    12901298#endif
    1291  
     1299
    12921300  m_dimIds.push_back( m_viewId );
    12931301  const Int viewDimPosition = 0;
     
    12991307  xConfirmPara(  m_dimensionIdLen.size() < m_dimIds.size(), "DimensionIdLen must be given for all dimensions. "   );
    13001308
    1301  for( Int dim = 0; dim < m_dimIds.size(); dim++ )
    1302  {
    1303    xConfirmPara( m_dimIds[dim].size() < m_numberOfLayers,  "DimensionId must be given for all layers and all dimensions. ");   
    1304    xConfirmPara( ( dim != viewDimPosition ) &&  (m_dimIds[dim][0] != 0), "DimensionId of layer 0 must be 0. " );
    1305    xConfirmPara( m_dimensionIdLen[dim] < 1 || m_dimensionIdLen[dim] > 8, "DimensionIdLen must be greater than 0 and less than 9 in all dimensions. " );
    1306    for( Int i = 1; i < m_numberOfLayers; i++ )
    1307    {     
    1308      xConfirmPara(  ( m_dimIds[dim][i] < 0 ) || ( m_dimIds[dim][i] > ( ( 1 << m_dimensionIdLen[dim] ) - 1 ) )   , "DimensionId shall be in the range of 0 to 2^DimensionIdLen - 1. " );
    1309    }
    1310  }
    1311 
    1312  for( Int i = 0; i < m_numberOfLayers; i++ )
    1313  {
    1314    for( Int j = 0; j < i; j++ )
    1315    {     
    1316      Int numDiff  = 0;
    1317      Int lastDiff = -1;
    1318      for( Int dim = 0; dim < m_dimIds.size(); dim++ )
    1319      {
    1320        if ( m_dimIds[dim][i] != m_dimIds[dim][j] )
    1321        {
    1322          numDiff ++;
    1323          lastDiff = dim;
    1324        }
    1325      }
    1326 
    1327      Bool allEqual = ( numDiff == 0 );
    1328 
    1329      if ( allEqual )
    1330      {
    1331        printf( "\nError: Positions of Layers %d and %d are identical in scalability space\n", i, j);
    1332      }
    1333 
    1334      xConfirmPara( allEqual , "Each layer shall have a different position in scalability space." );
    1335 
    1336      if ( numDiff  == 1 )
    1337      {
    1338        Bool inc = m_dimIds[ lastDiff ][ i ] > m_dimIds[ lastDiff ][ j ];
    1339        Bool shallBeButIsNotIncreasing = ( !inc && ( lastDiff != viewDimPosition ) ) ;
    1340        if ( shallBeButIsNotIncreasing )
    1341        {       
    1342          printf( "\nError: Positions of Layers %d and %d is not increasing in dimension %d \n", i, j, lastDiff);       
    1343        }
    1344        xConfirmPara( shallBeButIsNotIncreasing && ( lastDiff != viewDimPosition ),  "DimensionIds shall be increasing within one dimension. " );
    1345      }
    1346    }
    1347  }
    1348 
     1309  for( Int dim = 0; dim < m_dimIds.size(); dim++ )
     1310  {
     1311    xConfirmPara( m_dimIds[dim].size() < m_numberOfLayers,  "DimensionId must be given for all layers and all dimensions. ");   
     1312    xConfirmPara( ( dim != viewDimPosition ) &&  (m_dimIds[dim][0] != 0), "DimensionId of layer 0 must be 0. " );
     1313    xConfirmPara( m_dimensionIdLen[dim] < 1 || m_dimensionIdLen[dim] > 8, "DimensionIdLen must be greater than 0 and less than 9 in all dimensions. " );
     1314    for( Int i = 1; i < m_numberOfLayers; i++ )
     1315    {     
     1316      xConfirmPara(  ( m_dimIds[dim][i] < 0 ) || ( m_dimIds[dim][i] > ( ( 1 << m_dimensionIdLen[dim] ) - 1 ) )   , "DimensionId shall be in the range of 0 to 2^DimensionIdLen - 1. " );
     1317    }
     1318  }
     1319
     1320  for( Int i = 0; i < m_numberOfLayers; i++ )
     1321  {
     1322    for( Int j = 0; j < i; j++ )
     1323    {     
     1324      Int numDiff  = 0;
     1325      Int lastDiff = -1;
     1326      for( Int dim = 0; dim < m_dimIds.size(); dim++ )
     1327      {
     1328        if ( m_dimIds[dim][i] != m_dimIds[dim][j] )
     1329        {
     1330          numDiff ++;
     1331          lastDiff = dim;
     1332        }
     1333      }
     1334
     1335      Bool allEqual = ( numDiff == 0 );
     1336
     1337      if ( allEqual )
     1338      {
     1339        printf( "\nError: Positions of Layers %d and %d are identical in scalability space\n", i, j);
     1340      }
     1341
     1342      xConfirmPara( allEqual , "Each layer shall have a different position in scalability space." );
     1343
     1344      if ( numDiff  == 1 )
     1345      {
     1346        Bool inc = m_dimIds[ lastDiff ][ i ] > m_dimIds[ lastDiff ][ j ];
     1347        Bool shallBeButIsNotIncreasing = ( !inc && ( lastDiff != viewDimPosition ) ) ;
     1348        if ( shallBeButIsNotIncreasing )
     1349        {       
     1350          printf( "\nError: Positions of Layers %d and %d is not increasing in dimension %d \n", i, j, lastDiff);       
     1351        }
     1352        xConfirmPara( shallBeButIsNotIncreasing && ( lastDiff != viewDimPosition ),  "DimensionIds shall be increasing within one dimension. " );
     1353      }
     1354    }
     1355  }
     1356
     1357  /// Layer sets
     1358  xConfirmPara( m_vpsNumLayerSets < 0 || m_vpsNumLayerSets > 1024, "VpsNumLayerSets must be greater than 0 and less than 1025") ;
     1359  for( Int lsIdx = 0; lsIdx < m_vpsNumLayerSets; lsIdx++ )
     1360  {
     1361    if (lsIdx == 0)
     1362    {
     1363      xConfirmPara( m_layerIdsInSets[lsIdx].size() != 1 || m_layerIdsInSets[lsIdx][0] != 0 , "0-th layer shall only include layer 0. ");
     1364    }
     1365    for ( Int i = 0; i < m_layerIdsInSets[lsIdx].size(); i++ )
     1366    {
     1367      xConfirmPara( m_layerIdsInSets[lsIdx][i] < 0 || m_layerIdsInSets[lsIdx].size() >= MAX_NUM_LAYER_IDS, "LayerIdsInSet must be greater than and less than 64" );
     1368    }
     1369  }
     1370
     1371  // Output layer sets
     1372  xConfirmPara( m_outputLayerSetIdx.size() < 0 || m_outputLayerSetIdx.size() > 1024, "The number of output layer set indices must be less than 1025") ;
     1373  for (Int lsIdx = 0; lsIdx < m_outputLayerSetIdx.size(); lsIdx++)
     1374  {   
     1375    Int refLayerSetIdx = m_outputLayerSetIdx[ lsIdx ];
     1376    xConfirmPara(  refLayerSetIdx < 0 || refLayerSetIdx >= m_vpsNumLayerSets, "Output layer set idx must be greater or equal to 0 and less than the VpsNumLayerSets" );
     1377
     1378    for (Int i = 0; i < m_layerIdsInAddOutputLayerSet[ lsIdx ].size(); i++)
     1379    {
     1380      Bool isAlsoInLayerSet = false;
     1381      for (Int j = 0; j < m_layerIdsInSets[ refLayerSetIdx ].size(); j++ )
     1382      {
     1383        if ( m_layerIdsInSets[ refLayerSetIdx ][ j ] == m_layerIdsInAddOutputLayerSet[ lsIdx ][ i ] )
     1384        {
     1385          isAlsoInLayerSet = true;
     1386          break;
     1387        }
     1388        xConfirmPara( !isAlsoInLayerSet, "All output layers must of a output layer set be included in corresponding layer set");
     1389      }
     1390    }
     1391  }
     1392  xConfirmPara( m_profileLevelTierIdx.size() < m_vpsNumLayerSets + m_outputLayerSetIdx.size(), "The number of Profile Level Tier indices must be equal to the number of layer set plus the number of output layer set indices" );
    13491393#endif
    13501394  xConfirmPara( m_iGOPSize < 1 ,                                                            "GOP Size must be greater or equal to 1" );
  • branches/HTM-DEV-0.3-dev0/source/App/TAppEncoder/TAppEncCfg.h

    r488 r492  
    8686  Int                    m_scalabilityMask;                   ///< Mask indicating scalabilities, 1: texture; 3: texture + depth                                                               
    8787  std::vector<Int>       m_dimensionIdLen;                    ///< Length of scalability dimension s
     88
     89  // layer sets
     90  Int                    m_vpsNumLayerSets;                   ///< Number of layer sets
     91  std::vector< std::vector<Int> > m_layerIdsInSets;           ///< LayerIds of Layer set
     92  Bool                   m_defaultOneTargetOutputLayerFlag;   ///< Output highest layer of layer sets by default
     93  Int                    numAddOuputLayerSets;              ///< Number of additional output layer sets
     94  std::vector<Int>       m_outputLayerSetIdx;                 ///< Indices of layer sets used as additional output layer sets 
     95  std::vector< std::vector<Int> > m_layerIdsInAddOutputLayerSet; ///< LayerIds of additional output layers 
     96  std::vector<Int>       m_profileLevelTierIdx;               ///< Indices of of profile level tier
     97
    8898#endif
    8999  Double    m_adLambdaModifier[ MAX_TLAYER ];                 ///< Lambda modifier array for each temporal layer
  • branches/HTM-DEV-0.3-dev0/source/App/TAppEncoder/TAppEncTop.cpp

    r490 r492  
    119119  xSetDimensionIdAndLength ( vps );
    120120  xSetDirectDependencyFlags( vps );
     121  xSetLayerSets            ( vps );
    121122#if H_3D
    122123  vps.initViewIndex();
     
    10311032  return maxVec;
    10321033}
     1034
     1035Void TAppEncTop::xSetLayerSets( TComVPS& vps )
     1036{   
     1037  // Layer sets
     1038  vps.setVpsNumLayerSetsMinus1   ( m_vpsNumLayerSets );
     1039  vps.setVpsNumberLayerSetsMinus1( m_vpsNumLayerSets );
     1040   
     1041  for (Int lsIdx = 0; lsIdx < m_vpsNumLayerSets; lsIdx++ )
     1042  {
     1043    for( Int layerId = 0; layerId < MAX_NUM_LAYER_IDS; layerId++ )
     1044    {
     1045      vps.setLayerIdIncludedFlag( false, lsIdx, layerId );
     1046    }
     1047    for ( Int i = 0; i < m_layerIdsInSets[lsIdx].size(); i++)
     1048    {
     1049      vps.setLayerIdIncludedFlag( true, lsIdx, m_layerIdsInSets[lsIdx][i] );
     1050    }
     1051  }
     1052
     1053  Int numAddOuputLayerSets = m_outputLayerSetIdx.size();
     1054  // Additional output layer sets + profileLevelTierIdx
     1055  vps.setDefaultOneTargetOutputLayerFlag   ( m_defaultOneTargetOutputLayerFlag );
     1056  vps.setMoreOutputLayerSetsThanDefaultFlag( numAddOuputLayerSets       != 0 );   
     1057  vps.setNumAddOutputLayerSetsMinus1       ( numAddOuputLayerSets - 1        );
     1058
     1059  for (Int lsIdx = 1; lsIdx < m_vpsNumLayerSets; lsIdx++)
     1060  {
     1061    vps.setProfileLevelTierIdx( lsIdx, m_profileLevelTierIdx[ lsIdx ] );
     1062  }
     1063
     1064  for (Int addOutLs = 0; addOutLs < numAddOuputLayerSets; addOutLs++ )
     1065  {
     1066    vps.setProfileLevelTierIdx( m_vpsNumLayerSets + addOutLs, m_profileLevelTierIdx[ addOutLs ] );
     1067
     1068    Int refLayerSetIdx = m_outputLayerSetIdx[ addOutLs ];     
     1069    vps.setOutputLayerSetIdxMinus1( m_vpsNumLayerSets + addOutLs, refLayerSetIdx - 1 );
     1070
     1071    for (Int i = 0; i < m_layerIdsInSets[ refLayerSetIdx].size(); i++ )
     1072    {
     1073      Bool outputLayerFlag = false;
     1074      for (Int j = 0; j < m_layerIdsInAddOutputLayerSet[ addOutLs ].size(); j++ )
     1075      {
     1076        if (  m_layerIdsInAddOutputLayerSet[addOutLs][ j ] == m_layerIdsInSets[ refLayerSetIdx][ i ] )
     1077        {
     1078          outputLayerFlag = true;
     1079          break;
     1080        }
     1081      }
     1082      vps.setOutputLayerFlag( m_vpsNumLayerSets + addOutLs, i, outputLayerFlag );       
     1083    }
     1084  }
     1085}
    10331086#endif
    10341087//! \}
  • branches/HTM-DEV-0.3-dev0/source/App/TAppEncoder/TAppEncTop.h

    r446 r492  
    119119  Void xSetDimensionIdAndLength   ( TComVPS& vps );
    120120  Void xSetDirectDependencyFlags  ( TComVPS& vps );
     121  Void xSetLayerSets( TComVPS& vps );
    121122  Int  xGetMax( std::vector<Int>& vec);
    122123#endif
     
    130131#else
    131132  TEncTop&    getTEncTop  ()   { return  m_cTEncTop; }      ///< return encoder class pointer reference
     133 
    132134#endif
    133135};// END CLASS DEFINITION TAppEncTop
Note: See TracChangeset for help on using the changeset viewer.