Changeset 582 in SHVCSoftware for branches/SHM-5.0-dev/source


Ignore:
Timestamp:
31 Jan 2014, 20:35:21 (11 years ago)
Author:
qualcomm
Message:

JCTVC-P0192: Resolution-based sub-DPB management <MACRO: RESOLUTION_BASED_DPB)

This patch includes the signaling, and assignment of resolution-based sub-DPB indices. Bumping process will be included in a following patch.

From: Adarsh K. Ramasubramonian <aramasub@…>

Location:
branches/SHM-5.0-dev/source
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-5.0-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r580 r582  
    11771177  vps->deriveLayerIdListVariables();
    11781178#endif
     1179#if RESOLUTION_BASED_DPB
     1180  vps->assignSubDpbIndices();
     1181#else
    11791182  vps->deriveNumberOfSubDpbs();
     1183#endif
    11801184  // Initialize dpb_size_table() for all ouput layer sets in the VPS extension
    11811185  for(i = 1; i < vps->getNumOutputLayerSets(); i++)
     
    11911195      Int maxNumReorderPics = -1;
    11921196#if CHANGE_NUMSUBDPB_IDX
     1197#if RESOLUTION_BASED_DPB
     1198      for(Int k = 0; k < vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet); k++)
     1199#else
    11931200      for(Int k = 0; k < vps->getNumSubDpbs(layerSetIdxForOutputLayerSet); k++)
     1201#endif
    11941202#else
    11951203      for(Int k = 0; k < vps->getNumSubDpbs(i); k++)
     
    11971205      {
    11981206        Int layerId = vps->getLayerSetLayerIdList(layerSetId, k); // k-th layer in the output layer set
     1207#if RESOLUTION_BASED_DPB
     1208        vps->setMaxVpsLayerDecPicBuffMinus1( i, k, j, m_acTEncTop[layerId].getMaxDecPicBuffering(j) - 1 );
     1209        // Add sub-DPB sizes of layers belonging to a sub-DPB. If a different sub-DPB size is calculated
     1210        // at the encoder, modify below
     1211        Int oldValue = vps->getMaxVpsDecPicBufferingMinus1( i, vps->getSubDpbAssigned( layerSetIdxForOutputLayerSet, k ), j );
     1212        oldValue += vps->getMaxVpsLayerDecPicBuffMinus1( i, k, j );
     1213        vps->setMaxVpsDecPicBufferingMinus1( i, vps->getSubDpbAssigned( layerSetIdxForOutputLayerSet, k ), j, oldValue );
     1214#else
    11991215        vps->setMaxVpsDecPicBufferingMinus1( i, k, j,  m_acTEncTop[layerId].getMaxDecPicBuffering(j) - 1 );
     1216#endif
    12001217        maxNumReorderPics       = std::max( maxNumReorderPics, m_acTEncTop[layerId].getNumReorderPics(j));
    12011218      }
  • branches/SHM-5.0-dev/source/Lib/TLibCommon/TComSlice.cpp

    r580 r582  
    19371937, m_bitDepthVpsChroma           (0)
    19381938{}
     1939#if RESOLUTION_BASED_DPB
     1940Void RepFormat::init()
     1941{
     1942  m_chromaFormatVpsIdc          = CHROMA_420;
     1943  m_separateColourPlaneVpsFlag  = false;
     1944  m_picWidthVpsInLumaSamples    = 0;
     1945  m_picHeightVpsInLumaSamples   = 0;
     1946  m_bitDepthVpsLuma             = 0;
     1947  m_bitDepthVpsChroma           = 0;
     1948}
     1949#endif
    19391950#endif
    19401951
     
    21262137  ::memset( m_subLayerDpbInfoPresentFlag,   0, sizeof(m_subLayerDpbInfoPresentFlag )  );
    21272138  ::memset( m_maxVpsDecPicBufferingMinus1,  0, sizeof(m_maxVpsDecPicBufferingMinus1 ) );
     2139#if RESOLUTION_BASED_DPB
     2140  ::memset( m_maxVpsLayerDecPicBuffMinus1,  0, sizeof(m_maxVpsLayerDecPicBuffMinus1 ) );
     2141#endif
    21282142  ::memset( m_maxVpsNumReorderPics,         0, sizeof(m_maxVpsNumReorderPics )        );
    21292143  ::memset( m_maxVpsLatencyIncreasePlus1,   0, sizeof(m_maxVpsLatencyIncreasePlus1 )  );
     
    21822196}
    21832197#endif
     2198#if !RESOLUTION_BASED_DPB
    21842199#if VPS_DPB_SIZE_TABLE
    21852200Void TComVPS::deriveNumberOfSubDpbs()
     
    22052220}
    22062221#endif
     2222#endif
    22072223#if VPS_VUI_TILES_NOT_IN_USE__FLAG
    22082224Void TComVPS::setTilesNotInUseFlag(Bool x)
     
    23292345        checkFlagInner[j] |= ( getMaxVpsNumReorderPics(i, j) != getMaxVpsNumReorderPics(i, j - 1) );
    23302346#if CHANGE_NUMSUBDPB_IDX
    2331         for(Int k = 0; k < getNumSubDpbs(layerSetIdxForOutputLayerSet) && !checkFlagInner[j]; k++)  // If checkFlagInner[j] is true, break and signal the values
     2347        for(Int subDpbIdx = 0; subDpbIdx < getNumSubDpbs(layerSetIdxForOutputLayerSet) && !checkFlagInner[j]; subDpbIdx++)  // If checkFlagInner[j] is true, break and signal the values
    23322348#else
    23332349        for(Int k = 0; k < getNumSubDpbs(i) && !checkFlagInner[j]; k++)  // If checkFlagInner[j] is true, break and signal the values
    23342350#endif
    23352351        {
    2336           checkFlagInner[j] |= ( getMaxVpsDecPicBufferingMinus1(i, k, j - 1) != getMaxVpsDecPicBufferingMinus1(i, k, j) );
     2352          checkFlagInner[j] |= ( getMaxVpsDecPicBufferingMinus1(i, subDpbIdx, j - 1) != getMaxVpsDecPicBufferingMinus1(i, subDpbIdx, j) );
    23372353        }
     2354#if RESOLUTION_BASED_DPB
     2355        for(Int layerIdx = 0; layerIdx < this->getNumLayersInIdList(layerSetIdxForOutputLayerSet) && !checkFlagInner[j]; layerIdx++)  // If checkFlagInner[j] is true, break and signal the values
     2356        {
     2357          checkFlagInner[j] |= ( getMaxVpsLayerDecPicBuffMinus1(i, layerIdx, j - 1) != getMaxVpsLayerDecPicBuffMinus1(i, layerIdx, j) );
     2358        }
     2359#endif
    23382360      }
    23392361      // If checkFlagInner[j] = true, then some value needs to be signalled for the j-th sub-layer
     
    23552377    setSubLayerFlagInfoPresentFlag( i, checkFlagOuter );
    23562378  }
     2379}
     2380#endif
     2381#if RESOLUTION_BASED_DPB
     2382Void TComVPS::assignSubDpbIndices()
     2383{
     2384  RepFormat layerRepFormat  [MAX_LAYERS];
     2385  RepFormat subDpbRepFormat [MAX_LAYERS];
     2386
     2387  for(Int lsIdx = 0; lsIdx < this->getNumLayerSets(); lsIdx++)
     2388  {
     2389    for(Int j = 0; j < MAX_LAYERS; j++)
     2390    {
     2391      layerRepFormat [j].init();
     2392      subDpbRepFormat[j].init();
     2393    }
     2394
     2395    // Assign resolution, bit-depth, colour format for each layer in the layer set
     2396    for(Int i = 0; i < this->getNumLayersInIdList( lsIdx ); i++)
     2397    {
     2398      Int layerIdxInVps = this->getLayerIdInVps( this->getLayerSetLayerIdList(lsIdx, i) );
     2399      Int repFormatIdx  = this->getVpsRepFormatIdx( layerIdxInVps );
     2400      RepFormat* repFormat = this->getVpsRepFormat( repFormatIdx );
     2401
     2402      // Assign the rep_format() to the layer
     2403      layerRepFormat[i] = *repFormat;
     2404    }
     2405
     2406    // ----------------------------------------
     2407    // Sub-DPB assignment
     2408    // ----------------------------------------
     2409    // For the base layer
     2410    m_subDpbAssigned[lsIdx][0] = 0;
     2411    subDpbRepFormat[0] = layerRepFormat[0];
     2412
     2413    // Sub-DPB counter
     2414    Int subDpbCtr = 1;
     2415
     2416    for(Int i = 1; i < this->getNumLayersInIdList( lsIdx ); i++)
     2417    {
     2418      Bool newSubDpbFlag = true;
     2419      for(Int j = 0; (j < subDpbCtr) && (newSubDpbFlag); j++)
     2420      {
     2421        if( RepFormat::checkSameSubDpb( layerRepFormat[i], subDpbRepFormat[j] ) )
     2422        {
     2423          // Belong to i-th sub-DPB
     2424          m_subDpbAssigned[lsIdx][i] = j;
     2425          newSubDpbFlag = false;
     2426        }
     2427      }
     2428      if( newSubDpbFlag )
     2429      {
     2430        // New sub-DPB
     2431        subDpbRepFormat[subDpbCtr] = layerRepFormat[i];
     2432        m_subDpbAssigned[lsIdx][i] = subDpbCtr;
     2433        subDpbCtr++;                                    // Increment # subDpbs
     2434      }
     2435    }
     2436    m_numSubDpbs[lsIdx] = subDpbCtr;
     2437  }
     2438}
     2439Int  TComVPS::findLayerIdxInLayerSet ( Int lsIdx, Int nuhLayerId )
     2440{
     2441  for(Int i = 0; i < this->getNumLayersInIdList(lsIdx); i++)
     2442  {
     2443    if( this->getLayerSetLayerIdList( lsIdx, i) == nuhLayerId )
     2444    {
     2445      return i;
     2446    }
     2447  }
     2448  return -1;  // Layer not found
     2449}
     2450// RepFormat Assignment operator
     2451RepFormat& RepFormat::operator= (const RepFormat &other)
     2452{
     2453  if( this != &other)
     2454  {
     2455    m_chromaAndBitDepthVpsPresentFlag = other.m_chromaAndBitDepthVpsPresentFlag;
     2456    m_chromaFormatVpsIdc              = other.m_chromaFormatVpsIdc;
     2457    m_separateColourPlaneVpsFlag      = other.m_separateColourPlaneVpsFlag;
     2458    m_picWidthVpsInLumaSamples        = other.m_picWidthVpsInLumaSamples;
     2459    m_picHeightVpsInLumaSamples       = other.m_picHeightVpsInLumaSamples;
     2460    m_bitDepthVpsLuma                 = other.m_bitDepthVpsLuma;
     2461    m_bitDepthVpsChroma               = other.m_bitDepthVpsChroma;
     2462  }
     2463  return *this;
     2464}
     2465
     2466// Check whether x and y share the same resolution, chroma format and bit-depth.
     2467Bool RepFormat::checkSameSubDpb(const RepFormat &x, const RepFormat &y)
     2468{
     2469  return (    (x.m_chromaFormatVpsIdc              == y.m_chromaFormatVpsIdc)
     2470          &&  (x.m_picWidthVpsInLumaSamples        == y.m_picWidthVpsInLumaSamples)
     2471          &&  (x.m_picHeightVpsInLumaSamples       == y.m_picHeightVpsInLumaSamples)
     2472          &&  (x.m_bitDepthVpsLuma                 == y.m_bitDepthVpsLuma)
     2473          &&  (x.m_bitDepthVpsChroma               == y.m_bitDepthVpsChroma)
     2474          );
    23572475}
    23582476#endif
  • branches/SHM-5.0-dev/source/Lib/TLibCommon/TComSlice.h

    r580 r582  
    422422public:
    423423  RepFormat();
    424 
     424#if RESOLUTION_BASED_DPB
     425  Void init();
     426  RepFormat& operator= (const RepFormat &);
     427  static Bool checkSameSubDpb(const RepFormat &x, const RepFormat &y);
     428#endif
    425429#if REPN_FORMAT_CONTROL_FLAG
    426430  Bool getChromaAndBitDepthVpsPresentFlag() { return m_chromaAndBitDepthVpsPresentFlag; }
     
    650654  Bool    m_subLayerDpbInfoPresentFlag  [MAX_VPS_OP_LAYER_SETS_PLUS1][MAX_LAYERS];
    651655  Int     m_maxVpsDecPicBufferingMinus1 [MAX_VPS_OP_LAYER_SETS_PLUS1][MAX_LAYERS][MAX_TLAYER];
     656#if RESOLUTION_BASED_DPB
     657  Int     m_maxVpsLayerDecPicBuffMinus1 [MAX_VPS_OP_LAYER_SETS_PLUS1][MAX_LAYERS][MAX_TLAYER]; 
     658#endif
    652659  Int     m_maxVpsNumReorderPics        [MAX_VPS_OP_LAYER_SETS_PLUS1][MAX_LAYERS];
    653660  Int     m_maxVpsLatencyIncreasePlus1  [MAX_VPS_OP_LAYER_SETS_PLUS1][MAX_LAYERS];
     
    670677#if P0307_VPS_NON_VUI_EXTENSION
    671678  Int     m_vpsNonVuiExtLength;
     679#endif
     680#if RESOLUTION_BASED_DPB
     681  Int     m_subDpbAssigned            [MAX_VPS_LAYER_SETS_PLUS1][MAX_LAYERS];
    672682#endif
    673683#endif //SVC_EXTENSION
     
    10201030  Void    setMaxVpsDecPicBufferingMinus1(Int i, Int k, Int j, Int x) { m_maxVpsDecPicBufferingMinus1[i][k][j] = x;    }
    10211031
     1032#if RESOLUTION_BASED_DPB
     1033  Int     getMaxVpsLayerDecPicBuffMinus1(Int i, Int k, Int j)        { assert(i != 0); return m_maxVpsLayerDecPicBuffMinus1[i][k][j]; }
     1034  Void    setMaxVpsLayerDecPicBuffMinus1(Int i, Int k, Int j, Int x) { m_maxVpsLayerDecPicBuffMinus1[i][k][j] = x;    }
     1035#endif
     1036
    10221037  Int     getMaxVpsNumReorderPics(Int i, Int j)         { assert(i != 0); return m_maxVpsNumReorderPics[i][j]; }
    10231038  Void    setMaxVpsNumReorderPics(Int i, Int j, Int x) { m_maxVpsNumReorderPics[i][j] = x;    }
     
    10451060  Int     getVpsNonVuiExtLength()         { return m_vpsNonVuiExtLength; }
    10461061  Void    setVpsNonVuiExtLength(Int x)    { m_vpsNonVuiExtLength = x; }
     1062#endif
     1063#if RESOLUTION_BASED_DPB
     1064  Void assignSubDpbIndices();
     1065  Int  getSubDpbAssigned  (Int lsIdx, Int layerIdx) { return m_subDpbAssigned[lsIdx][layerIdx]; }
     1066  Int  findLayerIdxInLayerSet ( Int lsIdx, Int nuhLayerId );
    10471067#endif
    10481068#endif //SVC_EXTENSION
  • branches/SHM-5.0-dev/source/Lib/TLibCommon/TypeDef.h

    r579 r582  
    5757#define VPS_EXTN_UEV_CODING              1      ///< JCTVC-P0306: Code some syntax elements as ue(v), and remove some syntax elements that duplicate behaviour
    5858#define CHANGE_NUMSUBDPB_IDX             1      ///< Change index of NumSubDpb from output layer set to layer set, to be more aligned with the Spec
     59#define RESOLUTION_BASED_DPB             1      ///< JCTVC-P0192: Assign layers to sub-DPBs based on the rep_format() signaled in the VPS
    5960#define O0109_O0199_FLAGS_TO_VUI         1      ///< JCTVC-O0109, O0199: move single_layer_for_non_irap_flag and higher_layer_flag to vps_vui
    6061#define O0109_VIEW_ID_LEN                1      ///< JCTVC-O0109: view_id_len_minus1 to view_id_len, and add constraint (1<<view_id_len) is greater than or equal to NumViews
  • branches/SHM-5.0-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r579 r582  
    14251425  }
    14261426#endif
     1427#if RESOLUTION_BASED_DPB
     1428  vps->assignSubDpbIndices();
     1429#endif
    14271430  READ_FLAG(uiCode, "max_one_active_ref_layer_flag" );
    14281431  vps->setMaxOneActiveRefLayerFlag(uiCode);
     
    15871590{
    15881591  UInt uiCode;
     1592#if !RESOLUTION_BASED_DPB
    15891593  vps->deriveNumberOfSubDpbs();
     1594#endif
    15901595  for(Int i = 1; i < vps->getNumOutputLayerSets(); i++)
    15911596  {
     
    16221627        }
    16231628        READ_UVLC( uiCode, "max_vps_num_reorder_pics[i][j]" );              vps->setMaxVpsNumReorderPics( i, j, uiCode);
     1629#if RESOLUTION_BASED_DPB
     1630        if( vps->getNumSubDpbs(layerSetIdxForOutputLayerSet) != vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ) ) 
     1631        {
     1632          for(Int k = 0; k < vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ); k++)
     1633          {
     1634            READ_UVLC( uiCode, "max_vps_layer_dec_pic_buff_minus1[i][k][j]" ); vps->setMaxVpsLayerDecPicBuffMinus1( i, k, j, uiCode);
     1635          }
     1636        }
     1637        else  // vps->getNumSubDpbs(layerSetIdxForOutputLayerSet) == vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet )
     1638        {         
     1639          for(Int k = 0; k < vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ); k++)
     1640          {
     1641            vps->setMaxVpsLayerDecPicBuffMinus1( i, k, j, vps->getMaxVpsDecPicBufferingMinus1( i, k, j));
     1642          }
     1643        }
     1644#endif
    16241645        READ_UVLC( uiCode, "max_vps_latency_increase_plus1[i][j]" );        vps->setMaxVpsLatencyIncreasePlus1( i, j, uiCode);
    16251646      }
  • branches/SHM-5.0-dev/source/Lib/TLibDecoder/TDecTop.cpp

    r567 r582  
    8686  m_bRefreshPending            = false;
    8787#endif
     88#if RESOLUTION_BASED_DPB
     89  m_subDpbIdx = -1;
     90#endif
    8891}
    8992
     
    306309  else
    307310  {
     311#if RESOLUTION_BASED_DPB
     312    Int layerSetIdxForOutputLayerSet = pcSlice->getVPS()->getOutputLayerSetIdx( getCommonDecoderParams()->getOutputLayerSetIdx() );
     313    Int layerIdx = pcSlice->getVPS()->findLayerIdxInLayerSet( layerSetIdxForOutputLayerSet, pcSlice->getLayerId() );  assert( layerIdx != -1 );
     314    m_iMaxRefPicNum = pcSlice->getVPS()->getMaxVpsLayerDecPicBuffMinus1( getCommonDecoderParams()->getOutputLayerSetIdx(), layerIdx, pcSlice->getTLayer() ) + 1; // m_uiMaxDecPicBuffering has the space for the picture currently being decoded
     315#else
    308316    m_iMaxRefPicNum = pcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1( getCommonDecoderParams()->getOutputLayerSetIdx(), pcSlice->getLayerId(), pcSlice->getTLayer() ) + 1; // m_uiMaxDecPicBuffering has the space for the picture currently being decoded
     317#endif
    309318  }
    310319#else
     
    816825  // Following check should go wherever the VPS is activated
    817826  checkValueOfOutputLayerSetIdx( m_apcSlicePilot->getVPS());
     827#endif
     828#if RESOLUTION_BASED_DPB
     829  // Following assignment should go wherever a new VPS is activated
     830  assignSubDpbs(m_apcSlicePilot->getVPS());
    818831#endif
    819832  m_apcSlicePilot->initSlice( nalu.m_layerId );
     
    21082121}
    21092122#endif
     2123#if RESOLUTION_BASED_DPB
     2124Void TDecTop::assignSubDpbs(TComVPS *vps)
     2125{
     2126  if( m_subDpbIdx == -1 ) // Sub-DPB index is not already assigned
     2127  {
     2128    Int lsIdx = vps->getOutputLayerSetIdx( getCommonDecoderParams()->getOutputLayerSetIdx() );
     2129
     2130    Int layerIdx = vps->findLayerIdxInLayerSet( lsIdx, getLayerId() );
     2131    assert( layerIdx != -1 ); // Current layer should be found in the layer set.
     2132
     2133    // Copy from the active VPS based on the layer ID.
     2134    m_subDpbIdx = vps->getSubDpbAssigned( lsIdx, layerIdx );
     2135  }
     2136}
     2137#endif
    21102138//! \}
  • branches/SHM-5.0-dev/source/Lib/TLibDecoder/TDecTop.h

    r562 r582  
    144144  Bool                   m_bRefreshPending;
    145145#endif
    146 
     146#if RESOLUTION_BASED_DPB
     147  Int                    m_subDpbIdx;     // Index to the sub-DPB that the layer belongs to.
     148                                          // When new VPS is activated, this should be re-initialized to -1
     149#endif
    147150public:
    148151  TDecTop();
     
    262265  ParameterSetManagerDecoder* getParameterSetManager() { return &m_parameterSetManagerDecoder; }
    263266#endif
     267#if RESOLUTION_BASED_DPB
     268  Void setSubDpbIdx(Int idx)    { m_subDpbIdx = idx; }
     269  Int  getSubDpbIdx()           { return m_subDpbIdx; }
     270  Void assignSubDpbs(TComVPS *vps);
     271#endif
    264272};// END CLASS DEFINITION TDecTop
    265273
  • branches/SHM-5.0-dev/source/Lib/TLibEncoder/TEncCavlc.cpp

    r581 r582  
    12391239        }
    12401240        WRITE_UVLC( vps->getMaxVpsNumReorderPics( i, j), "max_vps_num_reorder_pics[i][j]" );             
     1241#if RESOLUTION_BASED_DPB
     1242        if( vps->getNumSubDpbs(layerSetIdxForOutputLayerSet) != vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ) )  // NumSubDpbs
     1243        {
     1244          for(Int k = 0; k < vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ); k++)
     1245          {
     1246            WRITE_UVLC( vps->getMaxVpsLayerDecPicBuffMinus1( i, k, j), "max_vps_layer_dec_pic_buff_minus1[i][k][j]" );
     1247          }
     1248        }
     1249#endif
    12411250        WRITE_UVLC( vps->getMaxVpsLatencyIncreasePlus1( i, j), "max_vps_latency_increase_plus1[i][j]" );       
    12421251      }
Note: See TracChangeset for help on using the changeset viewer.