Changeset 118 in SHVCSoftware for branches/HM-10.0-dev-SHM


Ignore:
Timestamp:
11 Apr 2013, 00:34:54 (12 years ago)
Author:
qualcomm
Message:

Signaling direct reference layers in VPS extension (MACRO: VPS_EXTN_DIRECT_REF_LAYERS)

Includes signaling of direct_dependency_flag in VPS extension, that indicates the direct reference layers of all the layers. Includes configuration file support using NumDirectRefLayers%d and RefLayerIds%d. Arbitrary values of nuh_layer_id for different layers would still need configuration file support for layer_id_in_nuh.

From: Adarsh K. Ramasubramonian <aramasub@…>

Location:
branches/HM-10.0-dev-SHM/source
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/HM-10.0-dev-SHM/source/App/TAppEncoder/TAppEncCfg.cpp

    r74 r118  
    292292  Int*    cfg_IntraPeriod   [MAX_LAYERS];
    293293  Int*    cfg_conformanceMode  [MAX_LAYERS];
     294#if VPS_EXTN_DIRECT_REF_LAYERS
     295  Int*    cfg_numDirectRefLayers [MAX_LAYERS];
     296  string cfg_refLayerIds   [MAX_LAYERS];
     297  string* cfg_refLayerIdsPtr   [MAX_LAYERS];
     298#endif
    294299  for(UInt layer = 0; layer < MAX_LAYERS; layer++)
    295300  {
     
    302307    cfg_IntraPeriod[layer]  = &m_acLayerCfg[layer].m_iIntraPeriod;
    303308    cfg_conformanceMode[layer] = &m_acLayerCfg[layer].m_conformanceMode;
     309#if VPS_EXTN_DIRECT_REF_LAYERS
     310    cfg_numDirectRefLayers  [layer] = &m_acLayerCfg[layer].m_numDirectRefLayers;
     311    cfg_refLayerIdsPtr      [layer]  = &cfg_refLayerIds[layer];
     312#endif
    304313  }
    305314#if AVC_SYNTAX
     
    337346  ("FrameRate%d,-fr%d",       cfg_FrameRate,  0, MAX_LAYERS, "Frame rate for layer %d")
    338347  ("LambdaModifier%d,-LM%d",  m_adLambdaModifier, ( double )1.0, MAX_TLAYER, "Lambda modifier for temporal layer %d")
     348#if VPS_EXTN_DIRECT_REF_LAYERS
     349  ("NumDirectRefLayers%d",    cfg_numDirectRefLayers, -1, MAX_LAYERS, "Number of direct reference layers")
     350  ("RefLayerIds%d",           cfg_refLayerIdsPtr, string(""), MAX_LAYERS, "direct reference layer IDs")
     351#endif
    339352  ("NumLayers",               m_numLayers, 1, "Number of layers to code")
    340353  ("ConformanceMode%d",       cfg_conformanceMode,0, MAX_LAYERS, "Window conformance mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping")
     
    717730    m_pRowHeight = NULL;
    718731  }
     732#if VPS_EXTN_DIRECT_REF_LAYERS
     733  for(Int layer = 0; layer < MAX_LAYERS; layer++)
     734  {
     735    Char* pRefLayerIds = cfg_refLayerIds[layer].empty() ? NULL: strdup(cfg_refLayerIds[layer].c_str());
     736    if( m_acLayerCfg[layer].m_numDirectRefLayers > 0 )
     737    {
     738      char *refLayerId;
     739      int  i=0;
     740      m_acLayerCfg[layer].m_refLayerIds = new Int[m_acLayerCfg[layer].m_numDirectRefLayers];
     741      refLayerId = strtok(pRefLayerIds, " ,-");
     742      while(refLayerId != NULL)
     743      {
     744        if( i >= m_acLayerCfg[layer].m_numDirectRefLayers )
     745        {
     746          printf( "The number of columns whose width are defined is larger than the allowed number of columns.\n" );
     747          exit( EXIT_FAILURE );
     748        }
     749        *( m_acLayerCfg[layer].m_refLayerIds + i ) = atoi( refLayerId );
     750        refLayerId = strtok(NULL, " ,-");
     751        i++;
     752      }
     753      if( i < m_acLayerCfg[layer].m_numDirectRefLayers )
     754      {
     755        printf( "The width of some columns is not defined.\n" );
     756        exit( EXIT_FAILURE );
     757      }
     758    }
     759    else
     760    {
     761      m_acLayerCfg[layer].m_refLayerIds = NULL;
     762    }
     763  }
     764#endif
    719765#if SIGNAL_BITRATE_PICRATE_IN_VPS
    720766  readBoolString(cfg_bitRateInfoPresentFlag, m_bitRatePicRateMaxTLayers, m_bitRateInfoPresentFlag, "bit rate info. present flag" );
     
    15111557  }
    15121558#endif
    1513 
     1559#if VPS_EXTN_DIRECT_REF_LAYERS
     1560  xConfirmPara( (m_acLayerCfg[0].m_numDirectRefLayers != 0) && (m_acLayerCfg[0].m_numDirectRefLayers != -1), "Layer 0 cannot have any reference layers" );
     1561  // NOTE: m_numDirectRefLayers  (for any layer) could be -1 (not signalled in cfg), in which case only the "previous layer" would be taken for reference
     1562  for(Int layer = 1; layer < MAX_LAYERS; layer++)
     1563  {
     1564    xConfirmPara(m_acLayerCfg[layer].m_numDirectRefLayers > layer, "Cannot reference more layers than before current layer");
     1565    for(Int i = 0; i < m_acLayerCfg[layer].m_numDirectRefLayers; i++)
     1566    {
     1567      xConfirmPara(m_acLayerCfg[layer].m_refLayerIds[i] > layer, "Cannot reference higher layers");
     1568      xConfirmPara(m_acLayerCfg[layer].m_refLayerIds[i] == layer, "Cannot reference the current layer itself");
     1569    }
     1570  }
     1571#endif
    15141572#undef xConfirmPara
    15151573  if (check_failed)
  • branches/HM-10.0-dev-SHM/source/App/TAppEncoder/TAppEncLayerCfg.h

    r54 r118  
    4242  Int       m_iIntraPeriod;                                   ///< period of I-slice (random access period)
    4343  Double    m_fQP;                                            ///< QP value of key-picture (floating point)
    44 
     44#if VPS_EXTN_DIRECT_REF_LAYERS
     45  Int       *m_refLayerIds;
     46  Int       m_numDirectRefLayers;
     47#endif
    4548#if SVC_EXTENSION
    4649  Int       m_iWaveFrontSubstreams; //< If iWaveFrontSynchro, this is the number of substreams per frame (dependent tiles) or per tile (independent tiles).
     
    8083  Int     getIntQP()                  {return m_iQP;              }
    8184  Int*    getdQPs()                   {return m_aidQP;            }
    82 
     85#if VPS_EXTN_DIRECT_REF_LAYERS
     86  Int     getNumDirectRefLayers()     {return m_numDirectRefLayers;}
     87  Int*    getRefLayerIds()            {return m_refLayerIds;      }
     88  Int     getRefLayerId(Int i)        {return m_refLayerIds[i];   }
     89#endif
    8390}; // END CLASS DEFINITION TAppEncLayerCfg
    8491
  • branches/HM-10.0-dev-SHM/source/App/TAppEncoder/TAppEncTop.cpp

    r116 r118  
    140140    m_acTEncTop[layer].setMaxTempLayer                 ( m_maxTempLayer );
    141141    m_acTEncTop[layer].setUseAMP( m_enableAMP );
    142 
     142#if VPS_EXTN_DIRECT_REF_LAYERS
     143    if(layer)
     144    {
     145      if(m_acLayerCfg[layer].getNumDirectRefLayers() == -1)
     146      {
     147        // Not included in the configuration file; assume that each layer depends on previous layer
     148        m_acTEncTop[layer].setNumDirectRefLayers       (1);      // One ref. layer
     149        m_acTEncTop[layer].setRefLayerId               (0, layer - 1);   // Previous layer
     150      }
     151      else
     152      {
     153        m_acTEncTop[layer].setNumDirectRefLayers       ( m_acLayerCfg[layer].getNumDirectRefLayers() );     
     154        for(Int i = 0; i < m_acTEncTop[layer].getNumDirectRefLayers(); i++)
     155        {
     156          m_acTEncTop[layer].setRefLayerId             ( i, m_acLayerCfg[layer].getRefLayerId(i));
     157        }       
     158      }
     159    }
     160#endif
    143161    //===== Slice ========
    144162
     
    763781  }
    764782#endif
     783#if VPS_EXTN_DIRECT_REF_LAYERS
     784  // Direct reference layers
     785  for(UInt layerCtr = 1;layerCtr <= vps->getMaxLayers() - 1; layerCtr++)
     786  {
     787    vps->setNumDirectRefLayers( layerCtr, m_acTEncTop[layerCtr].getNumDirectRefLayers() );
     788    for(Int i = 0; i < vps->getNumDirectRefLayers(layerCtr); i++)
     789    {
     790      vps->setRefLayerId( layerCtr, i, m_acTEncTop[layerCtr].getRefLayerId(i) );
     791    }
     792    // Set direct dependency flag
     793    // Initialize flag to 0
     794    for(Int refLayerCtr = 0; refLayerCtr < layerCtr; refLayerCtr++)
     795    {
     796      vps->setDirectDependencyFlag( layerCtr, refLayerCtr, false );
     797    }
     798    for(Int i = 0; i < vps->getNumDirectRefLayers(layerCtr); i++)
     799    {
     800      vps->setDirectDependencyFlag( layerCtr, vps->getLayerIdInVps(m_acTEncTop[layerCtr].getRefLayerId(i)), true);
     801    }
     802  }
     803#endif
    765804#else
    766805  m_cTEncTop.init();
  • branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComSlice.cpp

    r115 r118  
    15061506  ::memset(m_outputLayerSetIdx, 0, sizeof(m_outputLayerSetIdx));
    15071507  ::memset(m_outputLayerFlag, 0, sizeof(m_outputLayerFlag));
     1508#endif
     1509#if VPS_EXTN_DIRECT_REF_LAYERS
     1510  ::memset(m_directDependencyFlag, 0, sizeof(m_directDependencyFlag));
     1511  ::memset(m_numDirectRefLayers,   0, sizeof(m_numDirectRefLayers  ));
     1512  ::memset(m_refLayerId,           0, sizeof(m_refLayerId          ));
    15081513#endif
    15091514}
  • branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComSlice.h

    r115 r118  
    541541  UInt       m_outputLayerSetIdx[MAX_VPS_LAYER_SETS_PLUS1];
    542542  Bool       m_outputLayerFlag[MAX_VPS_LAYER_SETS_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
    543   // .. More declarations here
     543#endif
     544#if VPS_EXTN_DIRECT_REF_LAYERS
     545  Bool       m_directDependencyFlag[MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
     546  UInt       m_numDirectRefLayers[MAX_VPS_LAYER_ID_PLUS1];
     547  UInt       m_refLayerId[MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
    544548#endif
    545549
     
    656660  Bool   getOutputLayerFlag(Int layerSet, Int layerId)          { return m_outputLayerFlag[layerSet][layerId]; }
    657661  Void   setOutputLayerFlag(Int layerSet, Int layerId, Bool x)  { m_outputLayerFlag[layerSet][layerId] = x;    }
     662#endif
     663#if VPS_EXTN_DIRECT_REF_LAYERS
     664  // Direct dependency of layers
     665  Bool   getDirectDependencyFlag(Int i, Int j)                  { return m_directDependencyFlag[i][j]; }
     666  Void   setDirectDependencyFlag(Int i, Int j, Bool x)          { m_directDependencyFlag[i][j] = x;    }
     667 
     668  UInt   getNumDirectRefLayers(Int i)                                { return m_numDirectRefLayers[i];         }
     669  Void   setNumDirectRefLayers(Int i, UInt x)                        { m_numDirectRefLayers[i] = x;            }
     670
     671  UInt   getRefLayerId(Int i, Int j)                            { return m_refLayerId[i][j];           }
     672  Void   setRefLayerId(Int i, Int j, UInt x)                    { m_refLayerId[i][j] = x;              }
    658673#endif
    659674};
  • branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TypeDef.h

    r117 r118  
    5050#define VPS_EXTN_OP_LAYER_SETS           1      ///< Include output layer sets in VPS extension
    5151#define VPS_EXTN_PROFILE_INFO            1      ///< Include profile information for layer sets in VPS extension
     52#define VPS_EXTN_DIRECT_REF_LAYERS       1      ///< Include indication of direct dependency of layers in VPS extension
    5253#endif
    5354#define MAX_LAYERS                       2      ///< max number of layers the codec is supposed to handle
  • branches/HM-10.0-dev-SHM/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r116 r118  
    934934  } 
    935935#endif
    936   // ... More syntax elements to be parsed here
     936#if VPS_EXTN_DIRECT_REF_LAYERS
     937  // For layer 0
     938  vps->setNumDirectRefLayers(0, 0);
     939  // For other layers
     940  for( Int layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++)
     941  {
     942    UInt numDirectRefLayers = 0;
     943    for( Int refLayerCtr = 0; refLayerCtr < layerCtr; refLayerCtr++)
     944    {
     945      READ_FLAG(uiCode, "direct_dependency_flag[i][j]" ); vps->setDirectDependencyFlag(layerCtr, refLayerCtr, uiCode? true : false);
     946      if(uiCode)
     947      {
     948        vps->setRefLayerId(layerCtr, numDirectRefLayers, refLayerCtr);
     949        numDirectRefLayers++;
     950      }
     951    }
     952    vps->setNumDirectRefLayers(layerCtr, numDirectRefLayers);
     953  }
     954#endif
    937955}
    938956#endif
  • branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncCavlc.cpp

    r116 r118  
    731731  }
    732732#endif
    733   // ... More syntax elements to be written here
     733#if VPS_EXTN_DIRECT_REF_LAYERS
     734  for( Int layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++)
     735  {
     736    for( Int refLayerCtr = 0; refLayerCtr < layerCtr; refLayerCtr++)
     737    {
     738      WRITE_FLAG(vps->getDirectDependencyFlag(layerCtr, refLayerCtr), "direct_dependency_flag[i][j]" );
     739    }
     740  }
     741#endif
    734742}
    735743#endif
  • branches/HM-10.0-dev-SHM/source/Lib/TLibEncoder/TEncCfg.h

    r54 r118  
    142142  Int       m_maxTempLayer;                      ///< Max temporal layer
    143143  Bool m_useAMP;
     144#if VPS_EXTN_DIRECT_REF_LAYERS
     145  Int       m_numDirectRefLayers;
     146  Int       m_refLayerId[MAX_VPS_LAYER_ID_PLUS1];
     147#endif
    144148  //======= Transform =============
    145149  UInt      m_uiQuadtreeTULog2MaxSize;
     
    350354  Bool      getMaxTempLayer                 ()                              { return m_maxTempLayer;              }
    351355  Void      setMaxTempLayer                 ( Int maxTempLayer )            { m_maxTempLayer = maxTempLayer;      }
     356#if VPS_EXTN_DIRECT_REF_LAYERS
     357  Int       getNumDirectRefLayers           ()                              { return m_numDirectRefLayers;      }
     358  Void      setNumDirectRefLayers           (Int num)                       { m_numDirectRefLayers = num;       }
     359
     360  Int       getRefLayerId                   (Int i)                         { return m_refLayerId[i];           }
     361  Void      setRefLayerId                   (Int i, Int refLayerId)         { m_refLayerId[i] = refLayerId;     }
     362#endif
    352363  //======== Transform =============
    353364  Void      setQuadtreeTULog2MaxSize        ( UInt  u )      { m_uiQuadtreeTULog2MaxSize = u; }
Note: See TracChangeset for help on using the changeset viewer.