Changeset 269 in SHVCSoftware


Ignore:
Timestamp:
6 Jun 2013, 05:02:01 (12 years ago)
Author:
seregin
Message:

add config parameter for NumActiveRefLayers

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

Legend:

Unmodified
Added
Removed
  • TabularUnified branches/SHM-2.1-multilayers-dev/source/App/TAppEncoder/TAppEncCfg.cpp

    r245 r269  
    153153    }
    154154  }
     155
     156  for(Int layer = 0; layer < MAX_LAYERS; layer++)
     157  {
     158    if( m_acLayerCfg[layer].m_numActiveRefLayers > 0 )
     159    {
     160      delete [] m_acLayerCfg[layer].m_predLayerIds;
     161    }
     162  }
    155163#endif
    156164}
     
    329337#if VPS_EXTN_DIRECT_REF_LAYERS
    330338  Int*    cfg_numDirectRefLayers [MAX_LAYERS];
    331   string cfg_refLayerIds   [MAX_LAYERS];
    332   string* cfg_refLayerIdsPtr   [MAX_LAYERS];
     339  string  cfg_refLayerIds        [MAX_LAYERS];
     340  string* cfg_refLayerIdsPtr     [MAX_LAYERS];
     341
     342  Int*    cfg_numActiveRefLayers [MAX_LAYERS];
     343  string  cfg_predLayerIds       [MAX_LAYERS];
     344  string* cfg_predLayerIdsPtr    [MAX_LAYERS];
    333345#endif
    334346#if SCALED_REF_LAYER_OFFSETS
     
    360372    cfg_numDirectRefLayers  [layer] = &m_acLayerCfg[layer].m_numDirectRefLayers;
    361373    cfg_refLayerIdsPtr      [layer]  = &cfg_refLayerIds[layer];
     374    cfg_numActiveRefLayers  [layer] = &m_acLayerCfg[layer].m_numActiveRefLayers;
     375    cfg_predLayerIdsPtr     [layer]  = &cfg_predLayerIds[layer];
    362376#endif
    363377#if SCALED_REF_LAYER_OFFSETS
     
    422436  ("NumDirectRefLayers%d",    cfg_numDirectRefLayers, -1, MAX_LAYERS, "Number of direct reference layers")
    423437  ("RefLayerIds%d",           cfg_refLayerIdsPtr, string(""), MAX_LAYERS, "direct reference layer IDs")
     438  ("NumActiveRefLayers%d",    cfg_numActiveRefLayers, -1, MAX_LAYERS, "Number of active reference layers")
     439  ("PredLayerIds%d",          cfg_predLayerIdsPtr, string(""), MAX_LAYERS, "inter-layer prediction layer IDs")
    424440#endif
    425441  ("NumLayers",               m_numLayers, 1, "Number of layers to code")
     
    890906        if( i >= m_acLayerCfg[layer].m_numDirectRefLayers )
    891907        {
    892           printf( "The number of columns whose width are defined is larger than the allowed number of columns.\n" );
     908          printf( "NumDirectRefLayers: The number of columns whose width are defined is larger than the allowed number of columns.\n" );
    893909          exit( EXIT_FAILURE );
    894910        }
     
    899915      if( i < m_acLayerCfg[layer].m_numDirectRefLayers )
    900916      {
    901         printf( "The width of some columns is not defined.\n" );
     917        printf( "NumDirectRefLayers: The width of some columns is not defined.\n" );
    902918        exit( EXIT_FAILURE );
    903919      }
     
    906922    {
    907923      m_acLayerCfg[layer].m_refLayerIds = NULL;
     924    }
     925  }
     926
     927  for(Int layer = 0; layer < MAX_LAYERS; layer++)
     928  {
     929    Char* pPredLayerIds = cfg_predLayerIds[layer].empty() ? NULL: strdup(cfg_predLayerIds[layer].c_str());
     930    if( m_acLayerCfg[layer].m_numActiveRefLayers > 0 )
     931    {
     932      char *refLayerId;
     933      int  i=0;
     934      m_acLayerCfg[layer].m_predLayerIds = new Int[m_acLayerCfg[layer].m_numActiveRefLayers];
     935      refLayerId = strtok(pPredLayerIds, " ,-");
     936      while(refLayerId != NULL)
     937      {
     938        if( i >= m_acLayerCfg[layer].m_numActiveRefLayers )
     939        {
     940          printf( "NumActiveRefLayers: The number of columns whose width are defined is larger than the allowed number of columns.\n" );
     941          exit( EXIT_FAILURE );
     942        }
     943        *( m_acLayerCfg[layer].m_predLayerIds + i ) = atoi( refLayerId );
     944        refLayerId = strtok(NULL, " ,-");
     945        i++;
     946      }
     947      if( i < m_acLayerCfg[layer].m_numActiveRefLayers )
     948      {
     949        printf( "NumActiveRefLayers: The width of some columns is not defined.\n" );
     950        exit( EXIT_FAILURE );
     951      }
     952    }
     953    else
     954    {
     955      m_acLayerCfg[layer].m_predLayerIds = NULL;
    908956    }
    909957  }
     
    18401888    }
    18411889  }
     1890
     1891  xConfirmPara( (m_acLayerCfg[0].m_numActiveRefLayers != 0) && (m_acLayerCfg[0].m_numActiveRefLayers != -1), "Layer 0 cannot have any active reference layers" );
     1892  // NOTE: m_numActiveRefLayers  (for any layer) could be -1 (not signalled in cfg), in which case only the "previous layer" would be taken for reference
     1893  for(Int layer = 1; layer < MAX_LAYERS; layer++)
     1894  {
     1895    xConfirmPara(m_acLayerCfg[layer].m_numActiveRefLayers > m_acLayerCfg[layer].m_numDirectRefLayers, "Cannot reference more layers than NumDirectRefLayers");
     1896    for(Int i = 0; i < m_acLayerCfg[layer].m_numActiveRefLayers; i++)
     1897    {
     1898      xConfirmPara(m_acLayerCfg[layer].m_predLayerIds[i] > m_acLayerCfg[layer].m_numDirectRefLayers, "Cannot reference higher layers");
     1899    }
     1900  }
    18421901#endif
    18431902#undef xConfirmPara
  • TabularUnified branches/SHM-2.1-multilayers-dev/source/App/TAppEncoder/TAppEncLayerCfg.h

    r211 r269  
    4545  Int       *m_refLayerIds;
    4646  Int       m_numDirectRefLayers;
     47  Int       *m_predLayerIds;
     48  Int       m_numActiveRefLayers;
    4749#endif
    4850
     
    108110  Int*    getRefLayerIds()            {return m_refLayerIds;      }
    109111  Int     getRefLayerId(Int i)        {return m_refLayerIds[i];   }
     112
     113  Int     getNumActiveRefLayers()     {return m_numActiveRefLayers;}
     114  Int*    getPredLayerIds()           {return m_predLayerIds;     }
     115  Int     getPredLayerId(Int i)       {return m_predLayerIds[i];  }
    110116#endif
    111117#if RC_SHVC_HARMONIZATION
  • TabularUnified branches/SHM-2.1-multilayers-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r265 r269  
    159159        {
    160160          m_acTEncTop[layer].setRefLayerId             ( i, m_acLayerCfg[layer].getRefLayerId(i));
    161         }       
     161        }
     162      }
     163
     164      if(m_acLayerCfg[layer].getNumActiveRefLayers() == -1)
     165      {
     166        m_acTEncTop[layer].setNumActiveRefLayers( m_acLayerCfg[layer].getNumDirectRefLayers() );
     167        for( Int i = 0; i < m_acTEncTop[layer].getNumActiveRefLayers(); i++ )
     168        {
     169          m_acTEncTop[layer].setPredLayerId(i, i);
     170        }
     171      }
     172      else
     173      {
     174        m_acTEncTop[layer].setNumActiveRefLayers       ( m_acLayerCfg[layer].getNumActiveRefLayers() );     
     175        for(Int i = 0; i < m_acTEncTop[layer].getNumActiveRefLayers(); i++)
     176        {
     177          m_acTEncTop[layer].setPredLayerId             ( i, m_acLayerCfg[layer].getPredLayerId(i));
     178        }
    162179      }
    163180    }
  • TabularUnified branches/SHM-2.1-multilayers-dev/source/Lib/TLibCommon/TypeDef.h

    r242 r269  
    4747#define SCALED_REF_LAYER_OFFSET_FLAG     1      ///< M0309: Signal scaled reference layer offsets in SPS
    4848#define SCALED_REF_LAYER_OFFSETS         1      ///< M0309: Signal scaled reference layer offsets in SPS
    49 #define MAX_LAYERS                       2      ///< max number of layers the codec is supposed to handle
     49#define MAX_LAYERS                       3      ///< max number of layers the codec is supposed to handle
    5050
    5151#define VPS_RENAME                       1      ///< Rename variables max_layer_id and num_layer_sets_minus1 in VPS
  • TabularUnified branches/SHM-2.1-multilayers-dev/source/Lib/TLibEncoder/TEncCfg.h

    r212 r269  
    145145  Int       m_numDirectRefLayers;
    146146  Int       m_refLayerId[MAX_VPS_LAYER_ID_PLUS1];
     147
     148  Int       m_numActiveRefLayers;
     149  Int       m_predLayerId[MAX_VPS_LAYER_ID_PLUS1];
    147150#endif
    148151  //======= Transform =============
     
    405408  Int       getRefLayerId                   (Int i)                         { return m_refLayerId[i];           }
    406409  Void      setRefLayerId                   (Int i, Int refLayerId)         { m_refLayerId[i] = refLayerId;     }
     410
     411  Int       getNumActiveRefLayers           ()                              { return m_numActiveRefLayers;      }
     412  Void      setNumActiveRefLayers           (Int num)                       { m_numActiveRefLayers = num;       }
     413
     414  Int       getPredLayerId                  (Int i)                         { return m_predLayerId[i];          }
     415  Void      setPredLayerId                  (Int i, Int refLayerId)         { m_predLayerId[i] = refLayerId;    }
    407416#endif
    408417  //======== Transform =============
  • TabularUnified branches/SHM-2.1-multilayers-dev/source/Lib/TLibEncoder/TEncSlice.cpp

    r260 r269  
    493493    if( rpcSlice->getNumILRRefIdx() > 0 )
    494494    {
    495       rpcSlice->setActiveNumILRRefIdx( rpcSlice->getNumILRRefIdx() );
     495      rpcSlice->setActiveNumILRRefIdx( m_ppcTEncTop[layerId]->getNumActiveRefLayers() );
    496496      for( Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ )
    497497      {
    498         rpcSlice->setInterLayerPredLayerIdc(i, i);
     498        rpcSlice->setInterLayerPredLayerIdc( m_ppcTEncTop[layerId]->getPredLayerId(i), i );
    499499      }
    500500      rpcSlice->setInterLayerPredEnabledFlag(1);
Note: See TracChangeset for help on using the changeset viewer.